1function makeMap(str, expectsLowerCase) { 2 const map2 = /* @__PURE__ */ Object.create(null); 3 const list = str.split(","); 4 for (let i = 0; i < list.length; i++) { 5 map2[list[i]] = true; 6 } 7 return expectsLowerCase ? (val) => !!map2[val.toLowerCase()] : (val) => !!map2[val]; 8} 9const EMPTY_OBJ = {}; 10const EMPTY_ARR = []; 11const NOOP = () => { 12}; 13const NO = () => false; 14const onRE = /^on[^a-z]/; 15const isOn = (key) => onRE.test(key); 16const isModelListener = (key) => key.startsWith("onUpdate:"); 17const extend$1 = Object.assign; 18const remove = (arr, el) => { 19 const i = arr.indexOf(el); 20 if (i > -1) { 21 arr.splice(i, 1); 22 } 23}; 24const hasOwnProperty$o = Object.prototype.hasOwnProperty; 25const hasOwn = (val, key) => hasOwnProperty$o.call(val, key); 26const isArray$5 = Array.isArray; 27const isMap$2 = (val) => toTypeString(val) === "[object Map]"; 28const isSet$2 = (val) => toTypeString(val) === "[object Set]"; 29const isDate$2 = (val) => toTypeString(val) === "[object Date]"; 30const isRegExp = (val) => toTypeString(val) === "[object RegExp]"; 31const isFunction$4 = (val) => typeof val === "function"; 32const isString$3 = (val) => typeof val === "string"; 33const isSymbol$1 = (val) => typeof val === "symbol"; 34const isObject$3 = (val) => val !== null && typeof val === "object"; 35const isPromise = (val) => { 36 return isObject$3(val) && isFunction$4(val.then) && isFunction$4(val.catch); 37}; 38const objectToString$2 = Object.prototype.toString; 39const toTypeString = (value) => objectToString$2.call(value); 40const toRawType = (value) => { 41 return toTypeString(value).slice(8, -1); 42}; 43const isPlainObject$3 = (val) => toTypeString(val) === "[object Object]"; 44const isIntegerKey = (key) => isString$3(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; 45const isReservedProp = /* @__PURE__ */ makeMap( 46 // the leading comma is intentional so empty string "" is also included 47 ",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" 48); 49const cacheStringFunction = (fn) => { 50 const cache2 = /* @__PURE__ */ Object.create(null); 51 return (str) => { 52 const hit = cache2[str]; 53 return hit || (cache2[str] = fn(str)); 54 }; 55}; 56const camelizeRE = /-(\w)/g; 57const camelize = cacheStringFunction((str) => { 58 return str.replace(camelizeRE, (_, c2) => c2 ? c2.toUpperCase() : ""); 59}); 60const hyphenateRE = /\B([A-Z])/g; 61const hyphenate = cacheStringFunction( 62 (str) => str.replace(hyphenateRE, "-$1").toLowerCase() 63); 64const capitalize = cacheStringFunction( 65 (str) => str.charAt(0).toUpperCase() + str.slice(1) 66); 67const toHandlerKey = cacheStringFunction( 68 (str) => str ? `on${capitalize(str)}` : `` 69); 70const hasChanged = (value, oldValue) => !Object.is(value, oldValue); 71const invokeArrayFns = (fns, arg) => { 72 for (let i = 0; i < fns.length; i++) { 73 fns[i](arg); 74 } 75}; 76const def = (obj, key, value) => { 77 Object.defineProperty(obj, key, { 78 configurable: true, 79 enumerable: false, 80 value 81 }); 82}; 83const looseToNumber = (val) => { 84 const n2 = parseFloat(val); 85 return isNaN(n2) ? val : n2; 86}; 87const toNumber = (val) => { 88 const n2 = isString$3(val) ? Number(val) : NaN; 89 return isNaN(n2) ? val : n2; 90}; 91let _globalThis; 92const getGlobalThis = () => { 93 return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); 94}; 95const GLOBALS_WHITE_LISTED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console"; 96const isGloballyWhitelisted = /* @__PURE__ */ makeMap(GLOBALS_WHITE_LISTED); 97function normalizeStyle(value) { 98 if (isArray$5(value)) { 99 const res = {}; 100 for (let i = 0; i < value.length; i++) { 101 const item = value[i]; 102 const normalized = isString$3(item) ? parseStringStyle(item) : normalizeStyle(item); 103 if (normalized) { 104 for (const key in normalized) { 105 res[key] = normalized[key]; 106 } 107 } 108 } 109 return res; 110 } else if (isString$3(value)) { 111 return value; 112 } else if (isObject$3(value)) { 113 return value; 114 } 115}
116const listDelimiterRE = /;(?![^(]*\))/g; 117const propertyDelimiterRE = /:([^]+)/; 118const styleCommentRE = /\/\*[^]*?\*\//g; 119function parseStringStyle(cssText) { 120 const ret = {}; 121 cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { 122 if (item) { 123 const tmp = item.split(propertyDelimiterRE); 124 tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); 125 } 126 }); 127 return ret; 128} 129function normalizeClass(value) { 130 let res = ""; 131 if (isString$3(value)) { 132 res = value; 133 } else if (isArray$5(value)) { 134 for (let i = 0; i < value.length; i++) { 135 const normalized = normalizeClass(value[i]); 136 if (normalized) { 137 res += normalized + " "; 138 } 139 } 140 } else if (isObject$3(value)) { 141 for (const name in value) { 142 if (value[name]) { 143 res += name + " "; 144 } 145 } 146 } 147 return res.trim(); 148} 149function normalizeProps(props) { 150 if (!props) 151 return null; 152 let { class: klass, style: style2 } = props; 153 if (klass && !isString$3(klass)) { 154 props.class = normalizeClass(klass); 155 } 156 if (style2) { 157 props.style = normalizeStyle(style2); 158 } 159 return props; 160} 161const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; 162const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); 163function includeBooleanAttr(value) { 164 return !!value || value === ""; 165} 166function looseCompareArrays(a, b) { 167 if (a.length !== b.length) 168 return false; 169 let equal = true; 170 for (let i = 0; equal && i < a.length; i++) { 171 equal = looseEqual(a[i], b[i]); 172 } 173 return equal; 174} 175function looseEqual(a, b) { 176 if (a === b) 177 return true; 178 let aValidType = isDate$2(a); 179 let bValidType = isDate$2(b); 180 if (aValidType || bValidType) { 181 return aValidType && bValidType ? a.getTime() === b.getTime() : false; 182 } 183 aValidType = isSymbol$1(a); 184 bValidType = isSymbol$1(b); 185 if (aValidType || bValidType) { 186 return a === b; 187 } 188 aValidType = isArray$5(a); 189 bValidType = isArray$5(b); 190 if (aValidType || bValidType) { 191 return aValidType && bValidType ? looseCompareArrays(a, b) : false; 192 } 193 aValidType = isObject$3(a); 194 bValidType = isObject$3(b); 195 if (aValidType || bValidType) { 196 if (!aValidType || !bValidType) { 197 return false; 198 } 199 const aKeysCount = Object.keys(a).length; 200 const bKeysCount = Object.keys(b).length; 201 if (aKeysCount !== bKeysCount) { 202 return false; 203 } 204 for (const key in a) { 205 const aHasKey = a.hasOwnProperty(key); 206 const bHasKey = b.hasOwnProperty(key); 207 if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) { 208 return false; 209 } 210 } 211 } 212 return String(a) === String(b); 213} 214function looseIndexOf(arr, val) { 215 return arr.findIndex((item) => looseEqual(item, val)); 216} 217const toDisplayString = (val) => { 218 return isString$3(val) ? val : val == null ? "" : isArray$5(val) || isObject$3(val) && (val.toString === objectToString$2 || !isFunction$4(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val); 219}; 220const replacer = (_key, val) => { 221 if (val && val.__v_isRef) { 222 return replacer(_key, val.value); 223 } else if (isMap$2(val)) { 224 return { 225 [`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => { 226 entries[`${key} =>`] = val2; 227 return entries; 228 }, {}) 229 }; 230 } else if (isSet$2(val)) { 231 return { 232 [`Set(${val.size})`]: [...val.values()] 233 }; 234 } else if (isObject$3(val) && !isArray$5(val) && !isPlainObject$3(val)) { 235 return String(val); 236 } 237 return val; 238}; 239let activeEffectScope; 240class EffectScope { 241 constructor(detached = false) { 242 this.detached = detached; 243 this._active = true; 244 this.effects = []; 245 this.cleanups = []; 246 this.parent = activeEffectScope; 247 if (!detached && activeEffectScope) { 248 this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( 249 this 250 ) - 1; 251 } 252 } 253 get active() { 254 return this._active; 255 } 256 run(fn) { 257 if (this._active) { 258 const currentEffectScope = activeEffectScope;
259 try { 260 activeEffectScope = this; 261 return fn(); 262 } finally { 263 activeEffectScope = currentEffectScope; 264 } 265 } 266 } 267 /** 268 * This should only be called on non-detached scopes 269 * @internal 270 */ 271 on() { 272 activeEffectScope = this; 273 } 274 /** 275 * This should only be called on non-detached scopes 276 * @internal 277 */ 278 off() { 279 activeEffectScope = this.parent; 280 } 281 stop(fromParent) { 282 if (this._active) { 283 let i, l2; 284 for (i = 0, l2 = this.effects.length; i < l2; i++) { 285 this.effects[i].stop(); 286 } 287 for (i = 0, l2 = this.cleanups.length; i < l2; i++) { 288 this.cleanups[i](); 289 } 290 if (this.scopes) { 291 for (i = 0, l2 = this.scopes.length; i < l2; i++) { 292 this.scopes[i].stop(true); 293 } 294 } 295 if (!this.detached && this.parent && !fromParent) { 296 const last = this.parent.scopes.pop(); 297 if (last && last !== this) { 298 this.parent.scopes[this.index] = last; 299 last.index = this.index; 300 } 301 } 302 this.parent = void 0; 303 this._active = false; 304 } 305 } 306} 307function effectScope(detached) { 308 return new EffectScope(detached); 309} 310function recordEffectScope(effect2, scope = activeEffectScope) { 311 if (scope && scope.active) { 312 scope.effects.push(effect2); 313 } 314} 315function getCurrentScope() { 316 return activeEffectScope; 317} 318function onScopeDispose(fn) { 319 if (activeEffectScope) { 320 activeEffectScope.cleanups.push(fn); 321 } 322} 323const createDep = (effects) => { 324 const dep = new Set(effects); 325 dep.w = 0; 326 dep.n = 0; 327 return dep; 328}; 329const wasTracked = (dep) => (dep.w & trackOpBit) > 0; 330const newTracked = (dep) => (dep.n & trackOpBit) > 0; 331const initDepMarkers = ({ deps }) => { 332 if (deps.length) { 333 for (let i = 0; i < deps.length; i++) { 334 deps[i].w |= trackOpBit; 335 } 336 } 337}; 338const finalizeDepMarkers = (effect2) => { 339 const { deps } = effect2; 340 if (deps.length) { 341 let ptr = 0; 342 for (let i = 0; i < deps.length; i++) { 343 const dep = deps[i]; 344 if (wasTracked(dep) && !newTracked(dep)) { 345 dep.delete(effect2); 346 } else { 347 deps[ptr++] = dep; 348 } 349 dep.w &= ~trackOpBit; 350 dep.n &= ~trackOpBit; 351 } 352 deps.length = ptr; 353 } 354}; 355const targetMap = /* @__PURE__ */ new WeakMap(); 356let effectTrackDepth = 0; 357let trackOpBit = 1; 358const maxMarkerBits = 30; 359let activeEffect; 360const ITERATE_KEY = Symbol(""); 361const MAP_KEY_ITERATE_KEY = Symbol(""); 362class ReactiveEffect { 363 constructor(fn, scheduler2 = null, scope) { 364 this.fn = fn; 365 this.scheduler = scheduler2; 366 this.active = true; 367 this.deps = []; 368 this.parent = void 0; 369 recordEffectScope(this, scope); 370 } 371 run() { 372 if (!this.active) { 373 return this.fn(); 374 } 375 let parent = activeEffect; 376 let lastShouldTrack = shouldTrack; 377 while (parent) { 378 if (parent === this) { 379 return; 380 } 381 parent = parent.parent; 382 } 383 try { 384 this.parent = activeEffect; 385 activeEffect = this; 386 shouldTrack = true; 387 trackOpBit = 1 << ++effectTrackDepth; 388 if (effectTrackDepth <= maxMarkerBits) { 389 initDepMarkers(this); 390 } else { 391 cleanupEffect(this); 392 } 393 return this.fn(); 394 } finally { 395 if (effectTrackDepth <= maxMarkerBits) { 396 finalizeDepMarkers(this); 397 } 398 trackOpBit = 1 << --effectTrackDepth; 399 activeEffect = this.parent; 400 shouldTrack = lastShouldTrack; 401 this.parent = void 0; 402 if (this.deferStop) { 403 this.stop(); 404 } 405 } 406 } 407 stop() { 408 if (activeEffect === this) { 409 this.deferStop = true; 410 } else if (this.active) { 411 cleanupEffect(this); 412 if (this.onStop) { 413 this.onStop(); 414 } 415 this.active = false; 416 } 417 } 418} 419function cleanupEffect(effect2) { 420 const { deps } = effect2; 421 if (deps.length) { 422 for (let i = 0; i < deps.length; i++) { 423 deps[i].delete(effect2); 424 } 425 deps.length = 0; 426 } 427} 428function effect(fn, options) { 429 if (fn.effect) { 430 fn = fn.effect.fn; 431 } 432 const _effect = new ReactiveEffect(fn); 433 if (options) { 434 extend$1(_effect, options); 435 if (options.scope) 436 recordEffectScope(_effect, options.scope); 437 } 438 if (!options || !options.lazy) { 439 _effect.run(); 440 } 441 const runner = _effect.run.bind(_effect); 442 runner.effect = _effect; 443 return runner; 444} 445function stop(runner) { 446 runner.effect.stop(); 447} 448let shouldTrack = true; 449const trackStack = []; 450function pauseTracking() { 451 trackStack.push(shouldTrack); 452 shouldTrack = false;
453} 454function resetTracking() { 455 const last = trackStack.pop(); 456 shouldTrack = last === void 0 ? true : last; 457} 458function track(target, type4, key) { 459 if (shouldTrack && activeEffect) { 460 let depsMap = targetMap.get(target); 461 if (!depsMap) { 462 targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); 463 } 464 let dep = depsMap.get(key); 465 if (!dep) { 466 depsMap.set(key, dep = createDep()); 467 } 468 trackEffects(dep); 469 } 470} 471function trackEffects(dep, debuggerEventExtraInfo) { 472 let shouldTrack2 = false; 473 if (effectTrackDepth <= maxMarkerBits) { 474 if (!newTracked(dep)) { 475 dep.n |= trackOpBit; 476 shouldTrack2 = !wasTracked(dep); 477 } 478 } else { 479 shouldTrack2 = !dep.has(activeEffect); 480 } 481 if (shouldTrack2) { 482 dep.add(activeEffect); 483 activeEffect.deps.push(dep); 484 } 485} 486function trigger$1(target, type4, key, newValue, oldValue, oldTarget) { 487 const depsMap = targetMap.get(target); 488 if (!depsMap) { 489 return; 490 } 491 let deps = []; 492 if (type4 === "clear") { 493 deps = [...depsMap.values()]; 494 } else if (key === "length" && isArray$5(target)) { 495 const newLength = Number(newValue); 496 depsMap.forEach((dep, key2) => {
497 if (key2 === "length" || key2 >= newLength) { 498 deps.push(dep); 499 } 500 }); 501 } else { 502 if (key !== void 0) { 503 deps.push(depsMap.get(key)); 504 } 505 switch (type4) { 506 case "add": 507 if (!isArray$5(target)) { 508 deps.push(depsMap.get(ITERATE_KEY)); 509 if (isMap$2(target)) { 510 deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); 511 } 512 } else if (isIntegerKey(key)) { 513 deps.push(depsMap.get("length")); 514 } 515 break; 516 case "delete": 517 if (!isArray$5(target)) { 518 deps.push(depsMap.get(ITERATE_KEY)); 519 if (isMap$2(target)) { 520 deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); 521 } 522 } 523 break; 524 case "set": 525 if (isMap$2(target)) { 526 deps.push(depsMap.get(ITERATE_KEY)); 527 } 528 break; 529 } 530 } 531 if (deps.length === 1) { 532 if (deps[0]) { 533 { 534 triggerEffects(deps[0]); 535 } 536 } 537 } else { 538 const effects = []; 539 for (const dep of deps) { 540 if (dep) { 541 effects.push(...dep); 542 } 543 } 544 { 545 triggerEffects(createDep(effects)); 546 } 547 } 548} 549function triggerEffects(dep, debuggerEventExtraInfo) { 550 const effects = isArray$5(dep) ? dep : [...dep]; 551 for (const effect2 of effects) { 552 if (effect2.computed) { 553 triggerEffect(effect2); 554 } 555 } 556 for (const effect2 of effects) { 557 if (!effect2.computed) { 558 triggerEffect(effect2); 559 } 560 } 561} 562function triggerEffect(effect2, debuggerEventExtraInfo) { 563 if (effect2 !== activeEffect || effect2.allowRecurse) { 564 if (effect2.scheduler) { 565 effect2.scheduler(); 566 } else { 567 effect2.run(); 568 } 569 } 570} 571function getDepFromReactive(object4, key) { 572 var _a2; 573 return (_a2 = targetMap.get(object4)) == null ? void 0 : _a2.get(key); 574} 575const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); 576const builtInSymbols = new Set( 577 /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol$1) 578); 579const get$1 = /* @__PURE__ */ createGetter(); 580const shallowGet = /* @__PURE__ */ createGetter(false, true); 581const readonlyGet = /* @__PURE__ */ createGetter(true); 582const shallowReadonlyGet = /* @__PURE__ */ createGetter(true, true); 583const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations(); 584function createArrayInstrumentations() { 585 const instrumentations = {}; 586 ["includes", "indexOf", "lastIndexOf"].forEach((key) => { 587 instrumentations[key] = function(...args) { 588 const arr = toRaw(this); 589 for (let i = 0, l2 = this.length; i < l2; i++) { 590 track(arr, "get", i + ""); 591 } 592 const res = arr[key](...args); 593 if (res === -1 || res === false) { 594 return arr[key](...args.map(toRaw)); 595 } else { 596 return res; 597 } 598 }; 599 }); 600 ["push", "pop", "shift", "unshift", "splice"].forEach((key) => { 601 instrumentations[key] = function(...args) { 602 pauseTracking(); 603 const res = toRaw(this)[key].apply(this, args); 604 resetTracking(); 605 return res; 606 }; 607 }); 608 return instrumentations; 609} 610function hasOwnProperty$n(key) { 611 const obj = toRaw(this); 612 track(obj, "has", key); 613 return obj.hasOwnProperty(key); 614} 615function createGetter(isReadonly2 = false, shallow = false) { 616 return function get2(target, key, receiver) { 617 if (key === "__v_isReactive") { 618 return !isReadonly2; 619 } else if (key === "__v_isReadonly") { 620 return isReadonly2; 621 } else if (key === "__v_isShallow") { 622 return shallow; 623 } else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) { 624 return target; 625 } 626 const targetIsArray = isArray$5(target); 627 if (!isReadonly2) { 628 if (targetIsArray && hasOwn(arrayInstrumentations, key)) { 629 return Reflect.get(arrayInstrumentations, key, receiver); 630 } 631 if (key === "hasOwnProperty") { 632 return hasOwnProperty$n; 633 } 634 } 635 const res = Reflect.get(target, key, receiver);
636 if (isSymbol$1(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { 637 return res; 638 } 639 if (!isReadonly2) { 640 track(target, "get", key); 641 } 642 if (shallow) { 643 return res; 644 } 645 if (isRef(res)) { 646 return targetIsArray && isIntegerKey(key) ? res : res.value; 647 } 648 if (isObject$3(res)) { 649 return isReadonly2 ? readonly(res) : reactive(res); 650 } 651 return res; 652 }; 653} 654const set$1 = /* @__PURE__ */ createSetter(); 655const shallowSet = /* @__PURE__ */ createSetter(true); 656function createSetter(shallow = false) { 657 return function set2(target, key, value, receiver) { 658 let oldValue = target[key]; 659 if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) { 660 return false; 661 } 662 if (!shallow) { 663 if (!isShallow(value) && !isReadonly(value)) { 664 oldValue = toRaw(oldValue); 665 value = toRaw(value); 666 } 667 if (!isArray$5(target) && isRef(oldValue) && !isRef(value)) { 668 oldValue.value = value; 669 return true; 670 } 671 } 672 const hadKey = isArray$5(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); 673 const result = Reflect.set(target, key, value, receiver); 674 if (target === toRaw(receiver)) { 675 if (!hadKey) { 676 trigger$1(target, "add", key, value); 677 } else if (hasChanged(value, oldValue)) { 678 trigger$1(target, "set", key, value); 679 } 680 } 681 return result; 682 }; 683} 684function deleteProperty(target, key) { 685 const hadKey = hasOwn(target, key); 686 target[key]; 687 const result = Reflect.deleteProperty(target, key); 688 if (result && hadKey) { 689 trigger$1(target, "delete", key, void 0); 690 } 691 return result; 692} 693function has$1(target, key) { 694 const result = Reflect.has(target, key); 695 if (!isSymbol$1(key) || !builtInSymbols.has(key)) { 696 track(target, "has", key); 697 } 698 return result; 699} 700function ownKeys(target) { 701 track(target, "iterate", isArray$5(target) ? "length" : ITERATE_KEY); 702 return Reflect.ownKeys(target); 703} 704const mutableHandlers = { 705 get: get$1, 706 set: set$1, 707 deleteProperty, 708 has: has$1, 709 ownKeys 710}; 711const readonlyHandlers = { 712 get: readonlyGet, 713 set(target, key) { 714 return true; 715 }, 716 deleteProperty(target, key) { 717 return true; 718 } 719}; 720const shallowReactiveHandlers = /* @__PURE__ */ extend$1( 721 {}, 722 mutableHandlers, 723 { 724 get: shallowGet, 725 set: shallowSet 726 } 727); 728const shallowReadonlyHandlers = /* @__PURE__ */ extend$1( 729 {}, 730 readonlyHandlers, 731 { 732 get: shallowReadonlyGet 733 } 734); 735const toShallow = (value) => value; 736const getProto = (v) => Reflect.getPrototypeOf(v); 737function get$2(target, key, isReadonly2 = false, isShallow2 = false) { 738 target = target["__v_raw"]; 739 const rawTarget = toRaw(target); 740 const rawKey = toRaw(key); 741 if (!isReadonly2) { 742 if (key !== rawKey) { 743 track(rawTarget, "get", key); 744 } 745 track(rawTarget, "get", rawKey); 746 } 747 const { has: has2 } = getProto(rawTarget); 748 const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; 749 if (has2.call(rawTarget, key)) { 750 return wrap(target.get(key)); 751 } else if (has2.call(rawTarget, rawKey)) { 752 return wrap(target.get(rawKey)); 753 } else if (target !== rawTarget) { 754 target.get(key); 755 } 756} 757function has(key, isReadonly2 = false) { 758 const target = this["__v_raw"]; 759 const rawTarget = toRaw(target); 760 const rawKey = toRaw(key); 761 if (!isReadonly2) { 762 if (key !== rawKey) { 763 track(rawTarget, "has", key); 764 } 765 track(rawTarget, "has", rawKey); 766 } 767 return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); 768} 769function size$1(target, isReadonly2 = false) { 770 target = target["__v_raw"]; 771 !isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY); 772 return Reflect.get(target, "size", target); 773} 774function add(value) { 775 value = toRaw(value); 776 const target = toRaw(this); 777 const proto = getProto(target); 778 const hadKey = proto.has.call(target, value); 779 if (!hadKey) { 780 target.add(value); 781 trigger$1(target, "add", value, value); 782 } 783 return this; 784} 785function set(key, value) { 786 value = toRaw(value); 787 const target = toRaw(this); 788 const { has: has2, get: get2 } = getProto(target); 789 let hadKey = has2.call(target, key); 790 if (!hadKey) { 791 key = toRaw(key); 792 hadKey = has2.call(target, key); 793 } 794 const oldValue = get2.call(target, key); 795 target.set(key, value); 796 if (!hadKey) { 797 trigger$1(target, "add", key, value); 798 } else if (hasChanged(value, oldValue)) { 799 trigger$1(target, "set", key, value); 800 } 801 return this; 802} 803function deleteEntry(key) { 804 const target = toRaw(this); 805 const { has: has2, get: get2 } = getProto(target); 806 let hadKey = has2.call(target, key); 807 if (!hadKey) { 808 key = toRaw(key); 809 hadKey = has2.call(target, key); 810 } 811 get2 ? get2.call(target, key) : void 0; 812 const result = target.delete(key); 813 if (hadKey) { 814 trigger$1(target, "delete", key, void 0); 815 } 816 return result; 817} 818function clear() { 819 const target = toRaw(this); 820 const hadItems = target.size !== 0; 821 const result = target.clear(); 822 if (hadItems) { 823 trigger$1(target, "clear", void 0, void 0); 824 } 825 return result; 826} 827function createForEach(isReadonly2, isShallow2) { 828 return function forEach3(callback, thisArg) { 829 const observed = this; 830 const target = observed["__v_raw"]; 831 const rawTarget = toRaw(target); 832 const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; 833 !isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY); 834 return target.forEach((value, key) => { 835 return callback.call(thisArg, wrap(value), wrap(key), observed); 836 }); 837 }; 838} 839function createIterableMethod(method4, isReadonly2, isShallow2) { 840 return function(...args) { 841 const target = this["__v_raw"]; 842 const rawTarget = toRaw(target); 843 const targetIsMap = isMap$2(rawTarget); 844 const isPair = method4 === "entries" || method4 === Symbol.iterator && targetIsMap; 845 const isKeyOnly = method4 === "keys" && targetIsMap; 846 const innerIterator = target[method4](...args); 847 const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; 848 !isReadonly2 && track( 849 rawTarget, 850 "iterate", 851 isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY 852 ); 853 return { 854 // iterator protocol 855 next() { 856 const { value, done } = innerIterator.next(); 857 return done ? { value, done } : { 858 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
859 done 860 }; 861 }, 862 // iterable protocol 863 [Symbol.iterator]() { 864 return this; 865 } 866 }; 867 }; 868} 869function createReadonlyMethod(type4) { 870 return function(...args) { 871 return type4 === "delete" ? false : this; 872 }; 873} 874function createInstrumentations() { 875 const mutableInstrumentations2 = { 876 get(key) { 877 return get$2(this, key); 878 }, 879 get size() { 880 return size$1(this); 881 }, 882 has, 883 add, 884 set, 885 delete: deleteEntry, 886 clear, 887 forEach: createForEach(false, false) 888 }; 889 const shallowInstrumentations2 = { 890 get(key) { 891 return get$2(this, key, false, true); 892 }, 893 get size() { 894 return size$1(this); 895 }, 896 has, 897 add, 898 set, 899 delete: deleteEntry, 900 clear, 901 forEach: createForEach(false, true) 902 }; 903 const readonlyInstrumentations2 = { 904 get(key) { 905 return get$2(this, key, true); 906 }, 907 get size() { 908 return size$1(this, true); 909 }, 910 has(key) { 911 return has.call(this, key, true); 912 }, 913 add: createReadonlyMethod("add"), 914 set: createReadonlyMethod("set"), 915 delete: createReadonlyMethod("delete"), 916 clear: createReadonlyMethod("clear"), 917 forEach: createForEach(true, false) 918 }; 919 const shallowReadonlyInstrumentations2 = { 920 get(key) { 921 return get$2(this, key, true, true); 922 }, 923 get size() { 924 return size$1(this, true); 925 }, 926 has(key) { 927 return has.call(this, key, true); 928 }, 929 add: createReadonlyMethod("add"), 930 set: createReadonlyMethod("set"), 931 delete: createReadonlyMethod("delete"), 932 clear: createReadonlyMethod("clear"), 933 forEach: createForEach(true, true) 934 }; 935 const iteratorMethods = ["keys", "values", "entries", Symbol.iterator]; 936 iteratorMethods.forEach((method4) => { 937 mutableInstrumentations2[method4] = createIterableMethod( 938 method4, 939 false, 940 false 941 ); 942 readonlyInstrumentations2[method4] = createIterableMethod( 943 method4, 944 true, 945 false 946 ); 947 shallowInstrumentations2[method4] = createIterableMethod( 948 method4, 949 false, 950 true 951 ); 952 shallowReadonlyInstrumentations2[method4] = createIterableMethod( 953 method4, 954 true, 955 true 956 ); 957 }); 958 return [ 959 mutableInstrumentations2, 960 readonlyInstrumentations2, 961 shallowInstrumentations2, 962 shallowReadonlyInstrumentations2 963 ]; 964} 965const [ 966 mutableInstrumentations, 967 readonlyInstrumentations, 968 shallowInstrumentations, 969 shallowReadonlyInstrumentations 970] = /* @__PURE__ */ createInstrumentations(); 971function createInstrumentationGetter(isReadonly2, shallow) { 972 const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations; 973 return (target, key, receiver) => { 974 if (key === "__v_isReactive") { 975 return !isReadonly2; 976 } else if (key === "__v_isReadonly") { 977 return isReadonly2; 978 } else if (key === "__v_raw") { 979 return target; 980 } 981 return Reflect.get( 982 hasOwn(instrumentations, key) && key in target ? instrumentations : target, 983 key, 984 receiver 985 ); 986 }; 987} 988const mutableCollectionHandlers = { 989 get: /* @__PURE__ */ createInstrumentationGetter(false, false) 990}; 991const shallowCollectionHandlers = { 992 get: /* @__PURE__ */ createInstrumentationGetter(false, true) 993}; 994const readonlyCollectionHandlers = { 995 get: /* @__PURE__ */ createInstrumentationGetter(true, false) 996}; 997const shallowReadonlyCollectionHandlers = { 998 get: /* @__PURE__ */ createInstrumentationGetter(true, true) 999}; 1000const reactiveMap = /* @__PURE__ */ new WeakMap(); 1001const shallowReactiveMap = /* @__PURE__ */ new WeakMap(); 1002const readonlyMap = /* @__PURE__ */ new WeakMap(); 1003const shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); 1004function targetTypeMap(rawType) { 1005 switch (rawType) { 1006 case "Object": 1007 case "Array": 1008 return 1; 1009 case "Map": 1010 case "Set": 1011 case "WeakMap": 1012 case "WeakSet": 1013 return 2; 1014 default: 1015 return 0; 1016 } 1017} 1018function getTargetType(value) { 1019 return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value)); 1020} 1021function reactive(target) { 1022 if (isReadonly(target)) { 1023 return target; 1024 } 1025 return createReactiveObject( 1026 target, 1027 false, 1028 mutableHandlers, 1029 mutableCollectionHandlers, 1030 reactiveMap 1031 ); 1032} 1033function shallowReactive(target) { 1034 return createReactiveObject( 1035 target, 1036 false, 1037 shallowReactiveHandlers, 1038 shallowCollectionHandlers, 1039 shallowReactiveMap 1040 ); 1041} 1042function readonly(target) { 1043 return createReactiveObject( 1044 target, 1045 true, 1046 readonlyHandlers, 1047 readonlyCollectionHandlers, 1048 readonlyMap 1049 ); 1050} 1051function shallowReadonly(target) { 1052 return createReactiveObject( 1053 target, 1054 true, 1055 shallowReadonlyHandlers, 1056 shallowReadonlyCollectionHandlers, 1057 shallowReadonlyMap 1058 ); 1059} 1060function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { 1061 if (!isObject$3(target)) { 1062 return target; 1063 } 1064 if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { 1065 return target; 1066 } 1067 const existingProxy = proxyMap.get(target); 1068 if (existingProxy) { 1069 return existingProxy; 1070 } 1071 const targetType = getTargetType(target); 1072 if (targetType === 0) { 1073 return target; 1074 } 1075 const proxy = new Proxy( 1076 target, 1077 targetType === 2 ? collectionHandlers : baseHandlers 1078 ); 1079 proxyMap.set(target, proxy); 1080 return proxy; 1081} 1082function isReactive(value) { 1083 if (isReadonly(value)) { 1084 return isReactive(value["__v_raw"]); 1085 } 1086 return !!(value && value["__v_isReactive"]); 1087} 1088function isReadonly(value) { 1089 return !!(value && value["__v_isReadonly"]); 1090} 1091function isShallow(value) { 1092 return !!(value && value["__v_isShallow"]); 1093} 1094function isProxy(value) { 1095 return isReactive(value) || isReadonly(value); 1096} 1097function toRaw(observed) { 1098 const raw = observed && observed["__v_raw"]; 1099 return raw ? toRaw(raw) : observed; 1100} 1101function markRaw(value) { 1102 def(value, "__v_skip", true); 1103 return value; 1104} 1105const toReactive = (value) => isObject$3(value) ? reactive(value) : value; 1106const toReadonly = (value) => isObject$3(value) ? readonly(value) : value; 1107function trackRefValue(ref2) { 1108 if (shouldTrack && activeEffect) { 1109 ref2 = toRaw(ref2); 1110 { 1111 trackEffects(ref2.dep || (ref2.dep = createDep())); 1112 } 1113 } 1114} 1115function triggerRefValue(ref2, newVal) { 1116 ref2 = toRaw(ref2); 1117 const dep = ref2.dep; 1118 if (dep) { 1119 { 1120 triggerEffects(dep); 1121 } 1122 } 1123} 1124function isRef(r) { 1125 return !!(r && r.__v_isRef === true); 1126} 1127function ref(value) { 1128 return createRef(value, false); 1129} 1130function shallowRef(value) { 1131 return createRef(value, true); 1132} 1133function createRef(rawValue, shallow) { 1134 if (isRef(rawValue)) { 1135 return rawValue; 1136 } 1137 return new RefImpl(rawValue, shallow); 1138} 1139class RefImpl {
1140 constructor(value, __v_isShallow) { 1141 this.__v_isShallow = __v_isShallow; 1142 this.dep = void 0; 1143 this.__v_isRef = true; 1144 this._rawValue = __v_isShallow ? value : toRaw(value); 1145 this._value = __v_isShallow ? value : toReactive(value); 1146 } 1147 get value() { 1148 trackRefValue(this); 1149 return this._value; 1150 } 1151 set value(newVal) { 1152 const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal); 1153 newVal = useDirectValue ? newVal : toRaw(newVal); 1154 if (hasChanged(newVal, this._rawValue)) { 1155 this._rawValue = newVal; 1156 this._value = useDirectValue ? newVal : toReactive(newVal); 1157 triggerRefValue(this); 1158 } 1159 } 1160} 1161function triggerRef(ref2) { 1162 triggerRefValue(ref2); 1163} 1164function unref(ref2) { 1165 return isRef(ref2) ? ref2.value : ref2; 1166} 1167function toValue(source) { 1168 return isFunction$4(source) ? source() : unref(source); 1169} 1170const shallowUnwrapHandlers = { 1171 get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), 1172 set: (target, key, value, receiver) => { 1173 const oldValue = target[key]; 1174 if (isRef(oldValue) && !isRef(value)) { 1175 oldValue.value = value; 1176 return true; 1177 } else { 1178 return Reflect.set(target, key, value, receiver); 1179 } 1180 } 1181}; 1182function proxyRefs(objectWithRefs) { 1183 return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); 1184} 1185class CustomRefImpl { 1186 constructor(factory) { 1187 this.dep = void 0; 1188 this.__v_isRef = true; 1189 const { get: get2, set: set2 } = factory( 1190 () => trackRefValue(this), 1191 () => triggerRefValue(this) 1192 ); 1193 this._get = get2; 1194 this._set = set2; 1195 } 1196 get value() { 1197 return this._get(); 1198 } 1199 set value(newVal) { 1200 this._set(newVal); 1201 } 1202} 1203function customRef(factory) { 1204 return new CustomRefImpl(factory); 1205} 1206function toRefs(object4) { 1207 const ret = isArray$5(object4) ? new Array(object4.length) : {}; 1208 for (const key in object4) { 1209 ret[key] = propertyToRef(object4, key); 1210 } 1211 return ret; 1212} 1213class ObjectRefImpl { 1214 constructor(_object, _key, _defaultValue) { 1215 this._object = _object; 1216 this._key = _key; 1217 this._defaultValue = _defaultValue; 1218 this.__v_isRef = true; 1219 } 1220 get value() { 1221 const val = this._object[this._key]; 1222 return val === void 0 ? this._defaultValue : val; 1223 } 1224 set value(newVal) { 1225 this._object[this._key] = newVal; 1226 } 1227 get dep() { 1228 return getDepFromReactive(toRaw(this._object), this._key); 1229 } 1230} 1231class GetterRefImpl { 1232 constructor(_getter) { 1233 this._getter = _getter; 1234 this.__v_isRef = true; 1235 this.__v_isReadonly = true; 1236 } 1237 get value() { 1238 return this._getter(); 1239 } 1240} 1241function toRef(source, key, defaultValue) { 1242 if (isRef(source)) { 1243 return source; 1244 } else if (isFunction$4(source)) { 1245 return new GetterRefImpl(source); 1246 } else if (isObject$3(source) && arguments.length > 1) { 1247 return propertyToRef(source, key, defaultValue); 1248 } else { 1249 return ref(source); 1250 } 1251} 1252function propertyToRef(source, key, defaultValue) { 1253 const val = source[key]; 1254 return isRef(val) ? val : new ObjectRefImpl( 1255 source, 1256 key, 1257 defaultValue 1258 ); 1259} 1260class ComputedRefImpl { 1261 constructor(getter, _setter, isReadonly2, isSSR) { 1262 this._setter = _setter; 1263 this.dep = void 0; 1264 this.__v_isRef = true; 1265 this["__v_isReadonly"] = false; 1266 this._dirty = true; 1267 this.effect = new ReactiveEffect(getter, () => { 1268 if (!this._dirty) { 1269 this._dirty = true; 1270 triggerRefValue(this); 1271 } 1272 }); 1273 this.effect.computed = this; 1274 this.effect.active = this._cacheable = !isSSR; 1275 this["__v_isReadonly"] = isReadonly2; 1276 } 1277 get value() { 1278 const self2 = toRaw(this); 1279 trackRefValue(self2); 1280 if (self2._dirty || !self2._cacheable) { 1281 self2._dirty = false; 1282 self2._value = self2.effect.run(); 1283 } 1284 return self2._value; 1285 } 1286 set value(newValue) { 1287 this._setter(newValue); 1288 } 1289} 1290function computed$1(getterOrOptions, debugOptions, isSSR = false) { 1291 let getter; 1292 let setter; 1293 const onlyGetter = isFunction$4(getterOrOptions); 1294 if (onlyGetter) { 1295 getter = getterOrOptions; 1296 setter = NOOP; 1297 } else { 1298 getter = getterOrOptions.get; 1299 setter = getterOrOptions.set; 1300 } 1301 const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR); 1302 return cRef; 1303} 1304function warn$4(msg2, ...args) { 1305 return; 1306} 1307function assertNumber(val, type4) { 1308 return; 1309} 1310function callWithErrorHandling(fn, instance, type4, args) { 1311 let res; 1312 try { 1313 res = args ? fn(...args) : fn(); 1314 } catch (err) { 1315 handleError(err, instance, type4); 1316 } 1317 return res; 1318} 1319function callWithAsyncErrorHandling(fn, instance, type4, args) { 1320 if (isFunction$4(fn)) { 1321 const res = callWithErrorHandling(fn, instance, type4, args); 1322 if (res && isPromise(res)) { 1323 res.catch((err) => { 1324 handleError(err, instance, type4); 1325 }); 1326 } 1327 return res; 1328 } 1329 const values = []; 1330 for (let i = 0; i < fn.length; i++) { 1331 values.push(callWithAsyncErrorHandling(fn[i], instance, type4, args)); 1332 } 1333 return values; 1334} 1335function handleError(err, instance, type4, throwInDev = true) { 1336 const contextVNode = instance ? instance.vnode : null; 1337 if (instance) {
1338 let cur = instance.parent; 1339 const exposedInstance = instance.proxy; 1340 const errorInfo = type4; 1341 while (cur) { 1342 const errorCapturedHooks = cur.ec; 1343 if (errorCapturedHooks) { 1344 for (let i = 0; i < errorCapturedHooks.length; i++) { 1345 if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) { 1346 return; 1347 } 1348 } 1349 } 1350 cur = cur.parent; 1351 } 1352 const appErrorHandler = instance.appContext.config.errorHandler; 1353 if (appErrorHandler) { 1354 callWithErrorHandling( 1355 appErrorHandler, 1356 null, 1357 10, 1358 [err, exposedInstance, errorInfo] 1359 ); 1360 return; 1361 } 1362 } 1363 logError(err, type4, contextVNode, throwInDev); 1364} 1365function logError(err, type4, contextVNode, throwInDev = true) { 1366 { 1367 console.error(err); 1368 } 1369} 1370let isFlushing = false; 1371let isFlushPending = false; 1372const queue = []; 1373let flushIndex = 0; 1374const pendingPostFlushCbs = []; 1375let activePostFlushCbs = null; 1376let postFlushIndex = 0; 1377const resolvedPromise = /* @__PURE__ */ Promise.resolve(); 1378let currentFlushPromise = null; 1379function nextTick(fn) { 1380 const p2 = currentFlushPromise || resolvedPromise; 1381 return fn ? p2.then(this ? fn.bind(this) : fn) : p2; 1382} 1383function findInsertionIndex(id) { 1384 let start = flushIndex + 1; 1385 let end = queue.length; 1386 while (start < end) { 1387 const middle = start + end >>> 1; 1388 const middleJobId = getId(queue[middle]); 1389 middleJobId < id ? start = middle + 1 : end = middle; 1390 } 1391 return start; 1392} 1393function queueJob(job) { 1394 if (!queue.length || !queue.includes( 1395 job, 1396 isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex 1397 )) { 1398 if (job.id == null) { 1399 queue.push(job); 1400 } else { 1401 queue.splice(findInsertionIndex(job.id), 0, job); 1402 } 1403 queueFlush(); 1404 } 1405} 1406function queueFlush() { 1407 if (!isFlushing && !isFlushPending) { 1408 isFlushPending = true; 1409 currentFlushPromise = resolvedPromise.then(flushJobs); 1410 } 1411}
1412function invalidateJob(job) { 1413 const i = queue.indexOf(job); 1414 if (i > flushIndex) { 1415 queue.splice(i, 1); 1416 } 1417} 1418function queuePostFlushCb(cb) { 1419 if (!isArray$5(cb)) { 1420 if (!activePostFlushCbs || !activePostFlushCbs.includes( 1421 cb, 1422 cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex 1423 )) { 1424 pendingPostFlushCbs.push(cb); 1425 } 1426 } else { 1427 pendingPostFlushCbs.push(...cb); 1428 } 1429 queueFlush(); 1430} 1431function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) { 1432 for (; i < queue.length; i++) { 1433 const cb = queue[i]; 1434 if (cb && cb.pre) { 1435 queue.splice(i, 1); 1436 i--; 1437 cb(); 1438 } 1439 } 1440} 1441function flushPostFlushCbs(seen) { 1442 if (pendingPostFlushCbs.length) { 1443 const deduped = [...new Set(pendingPostFlushCbs)]; 1444 pendingPostFlushCbs.length = 0; 1445 if (activePostFlushCbs) { 1446 activePostFlushCbs.push(...deduped); 1447 return; 1448 } 1449 activePostFlushCbs = deduped; 1450 activePostFlushCbs.sort((a, b) => getId(a) - getId(b)); 1451 for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) { 1452 activePostFlushCbs[postFlushIndex](); 1453 } 1454 activePostFlushCbs = null; 1455 postFlushIndex = 0; 1456 } 1457} 1458const getId = (job) => job.id == null ? Infinity : job.id; 1459const comparator = (a, b) => { 1460 const diff2 = getId(a) - getId(b); 1461 if (diff2 === 0) { 1462 if (a.pre && !b.pre) 1463 return -1; 1464 if (b.pre && !a.pre) 1465 return 1; 1466 } 1467 return diff2; 1468}; 1469function flushJobs(seen) { 1470 isFlushPending = false; 1471 isFlushing = true; 1472 queue.sort(comparator); 1473 const check = NOOP; 1474 try { 1475 for (flushIndex = 0; flushIndex < queue.length; flushIndex++) { 1476 const job = queue[flushIndex]; 1477 if (job && job.active !== false) { 1478 if (false) 1479 ; 1480 callWithErrorHandling(job, null, 14); 1481 } 1482 } 1483 } finally { 1484 flushIndex = 0; 1485 queue.length = 0; 1486 flushPostFlushCbs(); 1487 isFlushing = false; 1488 currentFlushPromise = null; 1489 if (queue.length || pendingPostFlushCbs.length) { 1490 flushJobs(); 1491 } 1492 } 1493} 1494let devtools; 1495let buffer = []; 1496function setDevtoolsHook(hook, target) { 1497 var _a2, _b; 1498 devtools = hook; 1499 if (devtools) { 1500 devtools.enabled = true; 1501 buffer.forEach(({ event, args }) => devtools.emit(event, ...args)); 1502 buffer = []; 1503 } else if ( 1504 // handle late devtools injection - only do this if we are in an actual 1505 // browser environment to avoid the timer handle stalling test runner exit 1506 // (#4815) 1507 typeof window !== "undefined" && // some envs mock window but not fully 1508 window.HTMLElement && // also exclude jsdom 1509 !((_b = (_a2 = window.navigator) == null ? void 0 : _a2.userAgent) == null ? void 0 : _b.includes("jsdom")) 1510 ) { 1511 const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []; 1512 replay.push((newHook) => { 1513 setDevtoolsHook(newHook, target); 1514 }); 1515 setTimeout(() => { 1516 if (!devtools) { 1517 target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null; 1518 buffer = []; 1519 } 1520 }, 3e3); 1521 } else { 1522 buffer = []; 1523 } 1524} 1525function emit(instance, event, ...rawArgs) { 1526 if (instance.isUnmounted) 1527 return; 1528 const props = instance.vnode.props || EMPTY_OBJ; 1529 let args = rawArgs; 1530 const isModelListener2 = event.startsWith("update:"); 1531 const modelArg = isModelListener2 && event.slice(7); 1532 if (modelArg && modelArg in props) { 1533 const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`; 1534 const { number: number4, trim: trim2 } = props[modifiersKey] || EMPTY_OBJ; 1535 if (trim2) { 1536 args = rawArgs.map((a) => isString$3(a) ? a.trim() : a); 1537 } 1538 if (number4) { 1539 args = rawArgs.map(looseToNumber); 1540 } 1541 } 1542 let handlerName; 1543 let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249) 1544 props[handlerName = toHandlerKey(camelize(event))]; 1545 if (!handler && isModelListener2) { 1546 handler = props[handlerName = toHandlerKey(hyphenate(event))]; 1547 } 1548 if (handler) { 1549 callWithAsyncErrorHandling( 1550 handler, 1551 instance, 1552 6, 1553 args 1554 ); 1555 } 1556 const onceHandler = props[handlerName + `Once`]; 1557 if (onceHandler) { 1558 if (!instance.emitted) { 1559 instance.emitted = {}; 1560 } else if (instance.emitted[handlerName]) { 1561 return; 1562 } 1563 instance.emitted[handlerName] = true; 1564 callWithAsyncErrorHandling( 1565 onceHandler, 1566 instance, 1567 6, 1568 args 1569 ); 1570 } 1571} 1572function normalizeEmitsOptions(comp, appContext, asMixin = false) { 1573 const cache2 = appContext.emitsCache;
vendor: 6,061 bytes, lines 1574-1813
1574 const cached = cache2.get(comp); 1575 if (cached !== void 0) { 1576 return cached; 1577 } 1578 const raw = comp.emits; 1579 let normalized = {}; 1580 let hasExtends = false; 1581 if (!isFunction$4(comp)) { 1582 const extendEmits = (raw2) => { 1583 const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true); 1584 if (normalizedFromExtend) { 1585 hasExtends = true; 1586 extend$1(normalized, normalizedFromExtend); 1587 } 1588 }; 1589 if (!asMixin && appContext.mixins.length) { 1590 appContext.mixins.forEach(extendEmits); 1591 } 1592 if (comp.extends) { 1593 extendEmits(comp.extends); 1594 } 1595 if (comp.mixins) { 1596 comp.mixins.forEach(extendEmits); 1597 } 1598 } 1599 if (!raw && !hasExtends) { 1600 if (isObject$3(comp)) { 1601 cache2.set(comp, null); 1602 } 1603 return null; 1604 } 1605 if (isArray$5(raw)) { 1606 raw.forEach((key) => normalized[key] = null); 1607 } else { 1608 extend$1(normalized, raw); 1609 } 1610 if (isObject$3(comp)) { 1611 cache2.set(comp, normalized); 1612 } 1613 return normalized; 1614} 1615function isEmitListener(options, key) { 1616 if (!options || !isOn(key)) { 1617 return false; 1618 } 1619 key = key.slice(2).replace(/Once$/, ""); 1620 return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key); 1621} 1622let currentRenderingInstance = null; 1623let currentScopeId = null; 1624function setCurrentRenderingInstance(instance) { 1625 const prev = currentRenderingInstance; 1626 currentRenderingInstance = instance; 1627 currentScopeId = instance && instance.type.__scopeId || null; 1628 return prev; 1629} 1630function pushScopeId(id) { 1631 currentScopeId = id; 1632} 1633function popScopeId() { 1634 currentScopeId = null; 1635} 1636const withScopeId = (_id) => withCtx; 1637function withCtx(fn, ctx2 = currentRenderingInstance, isNonScopedSlot) { 1638 if (!ctx2) 1639 return fn; 1640 if (fn._n) { 1641 return fn; 1642 } 1643 const renderFnWithContext = (...args) => { 1644 if (renderFnWithContext._d) { 1645 setBlockTracking(-1); 1646 } 1647 const prevInstance = setCurrentRenderingInstance(ctx2); 1648 let res; 1649 try { 1650 res = fn(...args); 1651 } finally { 1652 setCurrentRenderingInstance(prevInstance); 1653 if (renderFnWithContext._d) { 1654 setBlockTracking(1); 1655 } 1656 } 1657 return res; 1658 }; 1659 renderFnWithContext._n = true; 1660 renderFnWithContext._c = true; 1661 renderFnWithContext._d = true; 1662 return renderFnWithContext; 1663} 1664function markAttrsAccessed() { 1665} 1666function renderComponentRoot(instance) { 1667 const { 1668 type: Component, 1669 vnode, 1670 proxy, 1671 withProxy, 1672 props, 1673 propsOptions: [propsOptions], 1674 slots, 1675 attrs, 1676 emit: emit2, 1677 render: render2, 1678 renderCache, 1679 data: data2, 1680 setupState, 1681 ctx: ctx2, 1682 inheritAttrs 1683 } = instance; 1684 let result; 1685 let fallthroughAttrs; 1686 const prev = setCurrentRenderingInstance(instance); 1687 try { 1688 if (vnode.shapeFlag & 4) { 1689 const proxyToUse = withProxy || proxy; 1690 result = normalizeVNode( 1691 render2.call( 1692 proxyToUse, 1693 proxyToUse, 1694 renderCache, 1695 props, 1696 setupState, 1697 data2, 1698 ctx2 1699 ) 1700 ); 1701 fallthroughAttrs = attrs; 1702 } else { 1703 const render22 = Component; 1704 if (false) 1705 ; 1706 result = normalizeVNode( 1707 render22.length > 1 ? render22( 1708 props, 1709 false ? { 1710 get attrs() { 1711 markAttrsAccessed(); 1712 return attrs; 1713 }, 1714 slots, 1715 emit: emit2 1716 } : { attrs, slots, emit: emit2 } 1717 ) : render22( 1718 props, 1719 null 1720 /* we know it doesn't need it */ 1721 ) 1722 ); 1723 fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs); 1724 } 1725 } catch (err) { 1726 blockStack.length = 0; 1727 handleError(err, instance, 1); 1728 result = createVNode(Comment); 1729 } 1730 let root2 = result; 1731 if (fallthroughAttrs && inheritAttrs !== false) { 1732 const keys2 = Object.keys(fallthroughAttrs); 1733 const { shapeFlag } = root2; 1734 if (keys2.length) { 1735 if (shapeFlag & (1 | 6)) { 1736 if (propsOptions && keys2.some(isModelListener)) { 1737 fallthroughAttrs = filterModelListeners( 1738 fallthroughAttrs, 1739 propsOptions 1740 ); 1741 } 1742 root2 = cloneVNode(root2, fallthroughAttrs); 1743 } 1744 } 1745 } 1746 if (vnode.dirs) { 1747 root2 = cloneVNode(root2); 1748 root2.dirs = root2.dirs ? root2.dirs.concat(vnode.dirs) : vnode.dirs; 1749 } 1750 if (vnode.transition) { 1751 root2.transition = vnode.transition; 1752 } 1753 { 1754 result = root2; 1755 } 1756 setCurrentRenderingInstance(prev); 1757 return result; 1758} 1759function filterSingleRoot(children) { 1760 let singleRoot; 1761 for (let i = 0; i < children.length; i++) { 1762 const child = children[i]; 1763 if (isVNode(child)) { 1764 if (child.type !== Comment || child.children === "v-if") { 1765 if (singleRoot) { 1766 return; 1767 } else { 1768 singleRoot = child; 1769 } 1770 } 1771 } else { 1772 return; 1773 } 1774 } 1775 return singleRoot; 1776} 1777const getFunctionalFallthrough = (attrs) => { 1778 let res; 1779 for (const key in attrs) { 1780 if (key === "class" || key === "style" || isOn(key)) { 1781 (res || (res = {}))[key] = attrs[key]; 1782 } 1783 } 1784 return res; 1785}; 1786const filterModelListeners = (attrs, props) => { 1787 const res = {}; 1788 for (const key in attrs) { 1789 if (!isModelListener(key) || !(key.slice(9) in props)) { 1790 res[key] = attrs[key]; 1791 } 1792 } 1793 return res; 1794}; 1795function shouldUpdateComponent(prevVNode, nextVNode, optimized) { 1796 const { props: prevProps, children: prevChildren, component } = prevVNode; 1797 const { props: nextProps, children: nextChildren, patchFlag } = nextVNode; 1798 const emits = component.emitsOptions; 1799 if (nextVNode.dirs || nextVNode.transition) { 1800 return true; 1801 } 1802 if (optimized && patchFlag >= 0) { 1803 if (patchFlag & 1024) { 1804 return true; 1805 } 1806 if (patchFlag & 16) { 1807 if (!prevProps) { 1808 return !!nextProps; 1809 } 1810 return hasPropsChanged(prevProps, nextProps, emits); 1811 } else if (patchFlag & 8) { 1812 const dynamicProps = nextVNode.dynamicProps; 1813 for (let i = 0; i < dynamicProps.length; i++) {
1814 const key = dynamicProps[i]; 1815 if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) { 1816 return true; 1817 } 1818 } 1819 } 1820 } else { 1821 if (prevChildren || nextChildren) { 1822 if (!nextChildren || !nextChildren.$stable) { 1823 return true; 1824 } 1825 } 1826 if (prevProps === nextProps) { 1827 return false; 1828 } 1829 if (!prevProps) { 1830 return !!nextProps; 1831 } 1832 if (!nextProps) { 1833 return true; 1834 } 1835 return hasPropsChanged(prevProps, nextProps, emits); 1836 } 1837 return false; 1838} 1839function hasPropsChanged(prevProps, nextProps, emitsOptions) { 1840 const nextKeys = Object.keys(nextProps); 1841 if (nextKeys.length !== Object.keys(prevProps).length) { 1842 return true; 1843 } 1844 for (let i = 0; i < nextKeys.length; i++) { 1845 const key = nextKeys[i]; 1846 if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) { 1847 return true; 1848 } 1849 } 1850 return false; 1851} 1852function updateHOCHostEl({ vnode, parent }, el) { 1853 while (parent && parent.subTree === vnode) { 1854 (vnode = parent.vnode).el = el; 1855 parent = parent.parent; 1856 } 1857} 1858const isSuspense = (type4) => type4.__isSuspense; 1859const SuspenseImpl = { 1860 name: "Suspense", 1861 // In order to make Suspense tree-shakable, we need to avoid importing it 1862 // directly in the renderer. The renderer checks for the __isSuspense flag 1863 // on a vnode's type and calls the `process` method, passing in renderer 1864 // internals. 1865 __isSuspense: true, 1866 process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG2, slotScopeIds, optimized, rendererInternals) { 1867 if (n1 == null) { 1868 mountSuspense( 1869 n2, 1870 container, 1871 anchor, 1872 parentComponent, 1873 parentSuspense, 1874 isSVG2, 1875 slotScopeIds, 1876 optimized, 1877 rendererInternals 1878 ); 1879 } else { 1880 patchSuspense( 1881 n1, 1882 n2, 1883 container, 1884 anchor, 1885 parentComponent, 1886 isSVG2, 1887 slotScopeIds, 1888 optimized, 1889 rendererInternals 1890 ); 1891 } 1892 }, 1893 hydrate: hydrateSuspense, 1894 create: createSuspenseBoundary, 1895 normalize: normalizeSuspenseChildren 1896}; 1897const Suspense = SuspenseImpl; 1898function triggerEvent(vnode, name) { 1899 const eventListener = vnode.props && vnode.props[name]; 1900 if (isFunction$4(eventListener)) { 1901 eventListener(); 1902 } 1903} 1904function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, isSVG2, slotScopeIds, optimized, rendererInternals) { 1905 const { 1906 p: patch, 1907 o: { createElement: createElement2 } 1908 } = rendererInternals; 1909 const hiddenContainer = createElement2("div"); 1910 const suspense = vnode.suspense = createSuspenseBoundary( 1911 vnode, 1912 parentSuspense, 1913 parentComponent, 1914 container, 1915 hiddenContainer, 1916 anchor, 1917 isSVG2, 1918 slotScopeIds, 1919 optimized, 1920 rendererInternals 1921 ); 1922 patch( 1923 null, 1924 suspense.pendingBranch = vnode.ssContent, 1925 hiddenContainer, 1926 null, 1927 parentComponent, 1928 suspense, 1929 isSVG2, 1930 slotScopeIds 1931 ); 1932 if (suspense.deps > 0) { 1933 triggerEvent(vnode, "onPending"); 1934 triggerEvent(vnode, "onFallback"); 1935 patch( 1936 null, 1937 vnode.ssFallback, 1938 container, 1939 anchor, 1940 parentComponent, 1941 null, 1942 // fallback tree will not have suspense context 1943 isSVG2, 1944 slotScopeIds 1945 ); 1946 setActiveBranch(suspense, vnode.ssFallback); 1947 } else { 1948 suspense.resolve(false, true); 1949 } 1950} 1951function patchSuspense(n1, n2, container, anchor, parentComponent, isSVG2, slotScopeIds, optimized, { p: patch, um: unmount2, o: { createElement: createElement2 } }) { 1952 const suspense = n2.suspense = n1.suspense; 1953 suspense.vnode = n2; 1954 n2.el = n1.el; 1955 const newBranch = n2.ssContent; 1956 const newFallback = n2.ssFallback; 1957 const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense; 1958 if (pendingBranch) { 1959 suspense.pendingBranch = newBranch; 1960 if (isSameVNodeType(newBranch, pendingBranch)) { 1961 patch( 1962 pendingBranch, 1963 newBranch, 1964 suspense.hiddenContainer, 1965 null, 1966 parentComponent, 1967 suspense, 1968 isSVG2, 1969 slotScopeIds, 1970 optimized 1971 ); 1972 if (suspense.deps <= 0) { 1973 suspense.resolve(); 1974 } else if (isInFallback) { 1975 patch( 1976 activeBranch, 1977 newFallback, 1978 container, 1979 anchor, 1980 parentComponent, 1981 null, 1982 // fallback tree will not have suspense context 1983 isSVG2, 1984 slotScopeIds, 1985 optimized 1986 );
1987 setActiveBranch(suspense, newFallback); 1988 } 1989 } else { 1990 suspense.pendingId++; 1991 if (isHydrating) { 1992 suspense.isHydrating = false; 1993 suspense.activeBranch = pendingBranch; 1994 } else { 1995 unmount2(pendingBranch, parentComponent, suspense); 1996 } 1997 suspense.deps = 0; 1998 suspense.effects.length = 0; 1999 suspense.hiddenContainer = createElement2("div"); 2000 if (isInFallback) { 2001 patch( 2002 null, 2003 newBranch, 2004 suspense.hiddenContainer, 2005 null, 2006 parentComponent, 2007 suspense, 2008 isSVG2, 2009 slotScopeIds, 2010 optimized 2011 ); 2012 if (suspense.deps <= 0) { 2013 suspense.resolve(); 2014 } else { 2015 patch( 2016 activeBranch, 2017 newFallback, 2018 container, 2019 anchor, 2020 parentComponent, 2021 null, 2022 // fallback tree will not have suspense context 2023 isSVG2, 2024 slotScopeIds, 2025 optimized 2026 );
2027 setActiveBranch(suspense, newFallback); 2028 } 2029 } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) { 2030 patch( 2031 activeBranch, 2032 newBranch, 2033 container, 2034 anchor, 2035 parentComponent, 2036 suspense, 2037 isSVG2, 2038 slotScopeIds, 2039 optimized 2040 ); 2041 suspense.resolve(true); 2042 } else { 2043 patch( 2044 null, 2045 newBranch, 2046 suspense.hiddenContainer, 2047 null, 2048 parentComponent, 2049 suspense, 2050 isSVG2, 2051 slotScopeIds, 2052 optimized 2053 ); 2054 if (suspense.deps <= 0) { 2055 suspense.resolve(); 2056 } 2057 } 2058 } 2059 } else { 2060 if (activeBranch && isSameVNodeType(newBranch, activeBranch)) { 2061 patch( 2062 activeBranch, 2063 newBranch, 2064 container, 2065 anchor, 2066 parentComponent, 2067 suspense, 2068 isSVG2, 2069 slotScopeIds, 2070 optimized 2071 ); 2072 setActiveBranch(suspense, newBranch); 2073 } else { 2074 triggerEvent(n2, "onPending"); 2075 suspense.pendingBranch = newBranch; 2076 suspense.pendingId++; 2077 patch( 2078 null, 2079 newBranch, 2080 suspense.hiddenContainer, 2081 null, 2082 parentComponent, 2083 suspense, 2084 isSVG2, 2085 slotScopeIds, 2086 optimized 2087 ); 2088 if (suspense.deps <= 0) { 2089 suspense.resolve(); 2090 } else { 2091 const { timeout, pendingId } = suspense; 2092 if (timeout > 0) { 2093 setTimeout(() => { 2094 if (suspense.pendingId === pendingId) { 2095 suspense.fallback(newFallback); 2096 } 2097 }, timeout); 2098 } else if (timeout === 0) { 2099 suspense.fallback(newFallback); 2100 } 2101 } 2102 } 2103 } 2104} 2105function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, isSVG2, slotScopeIds, optimized, rendererInternals, isHydrating = false) { 2106 const { 2107 p: patch, 2108 m: move2, 2109 um: unmount2, 2110 n: next, 2111 o: { parentNode, remove: remove2 } 2112 } = rendererInternals; 2113 let parentSuspenseId; 2114 const isSuspensible = isVNodeSuspensible(vnode); 2115 if (isSuspensible) { 2116 if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) { 2117 parentSuspenseId = parentSuspense.pendingId; 2118 parentSuspense.deps++; 2119 } 2120 } 2121 const timeout = vnode.props ? toNumber(vnode.props.timeout) : void 0; 2122 const suspense = { 2123 vnode, 2124 parent: parentSuspense, 2125 parentComponent, 2126 isSVG: isSVG2, 2127 container, 2128 hiddenContainer, 2129 anchor, 2130 deps: 0, 2131 pendingId: 0, 2132 timeout: typeof timeout === "number" ? timeout : -1, 2133 activeBranch: null, 2134 pendingBranch: null, 2135 isInFallback: true, 2136 isHydrating, 2137 isUnmounted: false, 2138 effects: [], 2139 resolve(resume = false, sync = false) { 2140 const { 2141 vnode: vnode2, 2142 activeBranch, 2143 pendingBranch, 2144 pendingId, 2145 effects, 2146 parentComponent: parentComponent2, 2147 container: container2 2148 } = suspense; 2149 if (suspense.isHydrating) { 2150 suspense.isHydrating = false; 2151 } else if (!resume) { 2152 const delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in"; 2153 if (delayEnter) { 2154 activeBranch.transition.afterLeave = () => { 2155 if (pendingId === suspense.pendingId) { 2156 move2(pendingBranch, container2, anchor2, 0); 2157 } 2158 }; 2159 } 2160 let { anchor: anchor2 } = suspense; 2161 if (activeBranch) { 2162 anchor2 = next(activeBranch); 2163 unmount2(activeBranch, parentComponent2, suspense, true); 2164 } 2165 if (!delayEnter) { 2166 move2(pendingBranch, container2, anchor2, 0); 2167 } 2168 } 2169 setActiveBranch(suspense, pendingBranch); 2170 suspense.pendingBranch = null; 2171 suspense.isInFallback = false; 2172 let parent = suspense.parent; 2173 let hasUnresolvedAncestor = false; 2174 while (parent) { 2175 if (parent.pendingBranch) { 2176 parent.effects.push(...effects); 2177 hasUnresolvedAncestor = true; 2178 break; 2179 } 2180 parent = parent.parent; 2181 } 2182 if (!hasUnresolvedAncestor) { 2183 queuePostFlushCb(effects); 2184 } 2185 suspense.effects = []; 2186 if (isSuspensible) { 2187 if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) { 2188 parentSuspense.deps--; 2189 if (parentSuspense.deps === 0 && !sync) { 2190 parentSuspense.resolve(); 2191 } 2192 } 2193 } 2194 triggerEvent(vnode2, "onResolve"); 2195 }, 2196 fallback(fallbackVNode) { 2197 if (!suspense.pendingBranch) { 2198 return; 2199 } 2200 const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, isSVG: isSVG22 } = suspense; 2201 triggerEvent(vnode2, "onFallback"); 2202 const anchor2 = next(activeBranch); 2203 const mountFallback = () => { 2204 if (!suspense.isInFallback) { 2205 return; 2206 } 2207 patch( 2208 null, 2209 fallbackVNode, 2210 container2, 2211 anchor2, 2212 parentComponent2, 2213 null, 2214 // fallback tree will not have suspense context 2215 isSVG22, 2216 slotScopeIds, 2217 optimized 2218 );
2219 setActiveBranch(suspense, fallbackVNode); 2220 }; 2221 const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in"; 2222 if (delayEnter) { 2223 activeBranch.transition.afterLeave = mountFallback; 2224 } 2225 suspense.isInFallback = true; 2226 unmount2( 2227 activeBranch, 2228 parentComponent2, 2229 null, 2230 // no suspense so unmount hooks fire now 2231 true 2232 // shouldRemove 2233 ); 2234 if (!delayEnter) { 2235 mountFallback(); 2236 } 2237 }, 2238 move(container2, anchor2, type4) { 2239 suspense.activeBranch && move2(suspense.activeBranch, container2, anchor2, type4); 2240 suspense.container = container2; 2241 }, 2242 next() { 2243 return suspense.activeBranch && next(suspense.activeBranch); 2244 }, 2245 registerDep(instance, setupRenderEffect) { 2246 const isInPendingSuspense = !!suspense.pendingBranch; 2247 if (isInPendingSuspense) { 2248 suspense.deps++; 2249 } 2250 const hydratedEl = instance.vnode.el; 2251 instance.asyncDep.catch((err) => { 2252 handleError(err, instance, 0); 2253 }).then((asyncSetupResult) => { 2254 if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) { 2255 return; 2256 } 2257 instance.asyncResolved = true; 2258 const { vnode: vnode2 } = instance; 2259 handleSetupResult(instance, asyncSetupResult, false); 2260 if (hydratedEl) { 2261 vnode2.el = hydratedEl; 2262 } 2263 const placeholder = !hydratedEl && instance.subTree.el; 2264 setupRenderEffect( 2265 instance, 2266 vnode2, 2267 // component may have been moved before resolve. 2268 // if this is not a hydration, instance.subTree will be the comment 2269 // placeholder. 2270 parentNode(hydratedEl || instance.subTree.el), 2271 // anchor will not be used if this is hydration, so only need to 2272 // consider the comment placeholder case. 2273 hydratedEl ? null : next(instance.subTree), 2274 suspense, 2275 isSVG2, 2276 optimized 2277 ); 2278 if (placeholder) { 2279 remove2(placeholder); 2280 } 2281 updateHOCHostEl(instance, vnode2.el); 2282 if (isInPendingSuspense && --suspense.deps === 0) { 2283 suspense.resolve(); 2284 } 2285 }); 2286 }, 2287 unmount(parentSuspense2, doRemove) { 2288 suspense.isUnmounted = true; 2289 if (suspense.activeBranch) { 2290 unmount2( 2291 suspense.activeBranch, 2292 parentComponent, 2293 parentSuspense2, 2294 doRemove 2295 ); 2296 } 2297 if (suspense.pendingBranch) { 2298 unmount2( 2299 suspense.pendingBranch, 2300 parentComponent, 2301 parentSuspense2, 2302 doRemove 2303 ); 2304 } 2305 } 2306 }; 2307 return suspense; 2308} 2309function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG2, slotScopeIds, optimized, rendererInternals, hydrateNode) { 2310 const suspense = vnode.suspense = createSuspenseBoundary( 2311 vnode, 2312 parentSuspense, 2313 parentComponent, 2314 node.parentNode, 2315 document.createElement("div"), 2316 null, 2317 isSVG2, 2318 slotScopeIds, 2319 optimized, 2320 rendererInternals, 2321 true 2322 /* hydrating */ 2323 ); 2324 const result = hydrateNode( 2325 node, 2326 suspense.pendingBranch = vnode.ssContent, 2327 parentComponent, 2328 suspense, 2329 slotScopeIds, 2330 optimized 2331 ); 2332 if (suspense.deps === 0) { 2333 suspense.resolve(false, true); 2334 } 2335 return result; 2336} 2337function normalizeSuspenseChildren(vnode) { 2338 const { shapeFlag, children } = vnode; 2339 const isSlotChildren = shapeFlag & 32; 2340 vnode.ssContent = normalizeSuspenseSlot( 2341 isSlotChildren ? children.default : children 2342 ); 2343 vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment); 2344} 2345function normalizeSuspenseSlot(s2) { 2346 let block; 2347 if (isFunction$4(s2)) { 2348 const trackBlock = isBlockTreeEnabled && s2._c; 2349 if (trackBlock) { 2350 s2._d = false; 2351 openBlock(); 2352 } 2353 s2 = s2(); 2354 if (trackBlock) { 2355 s2._d = true; 2356 block = currentBlock; 2357 closeBlock(); 2358 } 2359 } 2360 if (isArray$5(s2)) { 2361 const singleChild = filterSingleRoot(s2); 2362 s2 = singleChild; 2363 } 2364 s2 = normalizeVNode(s2); 2365 if (block && !s2.dynamicChildren) { 2366 s2.dynamicChildren = block.filter((c2) => c2 !== s2); 2367 } 2368 return s2; 2369} 2370function queueEffectWithSuspense(fn, suspense) { 2371 if (suspense && suspense.pendingBranch) { 2372 if (isArray$5(fn)) { 2373 suspense.effects.push(...fn); 2374 } else { 2375 suspense.effects.push(fn); 2376 } 2377 } else { 2378 queuePostFlushCb(fn); 2379 } 2380} 2381function setActiveBranch(suspense, branch) { 2382 suspense.activeBranch = branch; 2383 const { vnode, parentComponent } = suspense; 2384 const el = vnode.el = branch.el; 2385 if (parentComponent && parentComponent.subTree === vnode) { 2386 parentComponent.vnode.el = el; 2387 updateHOCHostEl(parentComponent, el); 2388 } 2389} 2390function isVNodeSuspensible(vnode) { 2391 var _a2; 2392 return ((_a2 = vnode.props) == null ? void 0 : _a2.suspensible) != null && vnode.props.suspensible !== false; 2393} 2394function watchEffect(effect2, options) { 2395 return doWatch(effect2, null, options); 2396} 2397function watchPostEffect(effect2, options) { 2398 return doWatch( 2399 effect2, 2400 null, 2401 { flush: "post" } 2402 ); 2403} 2404function watchSyncEffect(effect2, options) { 2405 return doWatch( 2406 effect2, 2407 null, 2408 { flush: "sync" } 2409 ); 2410} 2411const INITIAL_WATCHER_VALUE = {}; 2412function watch(source, cb, options) { 2413 return doWatch(source, cb, options); 2414} 2415function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) { 2416 var _a2; 2417 const instance = getCurrentScope() === ((_a2 = currentInstance) == null ? void 0 : _a2.scope) ? currentInstance : null; 2418 let getter; 2419 let forceTrigger = false;
2420 let isMultiSource = false; 2421 if (isRef(source)) { 2422 getter = () => source.value; 2423 forceTrigger = isShallow(source); 2424 } else if (isReactive(source)) { 2425 getter = () => source; 2426 deep = true; 2427 } else if (isArray$5(source)) { 2428 isMultiSource = true; 2429 forceTrigger = source.some((s2) => isReactive(s2) || isShallow(s2)); 2430 getter = () => source.map((s2) => { 2431 if (isRef(s2)) { 2432 return s2.value; 2433 } else if (isReactive(s2)) { 2434 return traverse(s2); 2435 } else if (isFunction$4(s2)) { 2436 return callWithErrorHandling(s2, instance, 2); 2437 } else 2438 ; 2439 }); 2440 } else if (isFunction$4(source)) { 2441 if (cb) { 2442 getter = () => callWithErrorHandling(source, instance, 2); 2443 } else { 2444 getter = () => { 2445 if (instance && instance.isUnmounted) { 2446 return; 2447 } 2448 if (cleanup) { 2449 cleanup(); 2450 } 2451 return callWithAsyncErrorHandling( 2452 source, 2453 instance, 2454 3, 2455 [onCleanup] 2456 ); 2457 }; 2458 } 2459 } else { 2460 getter = NOOP; 2461 } 2462 if (cb && deep) { 2463 const baseGetter = getter; 2464 getter = () => traverse(baseGetter()); 2465 } 2466 let cleanup; 2467 let onCleanup = (fn) => { 2468 cleanup = effect2.onStop = () => { 2469 callWithErrorHandling(fn, instance, 4); 2470 }; 2471 }; 2472 let ssrCleanup; 2473 if (isInSSRComponentSetup) { 2474 onCleanup = NOOP; 2475 if (!cb) { 2476 getter(); 2477 } else if (immediate) { 2478 callWithAsyncErrorHandling(cb, instance, 3, [ 2479 getter(), 2480 isMultiSource ? [] : void 0, 2481 onCleanup 2482 ]); 2483 } 2484 if (flush === "sync") { 2485 const ctx2 = useSSRContext(); 2486 ssrCleanup = ctx2.__watcherHandles || (ctx2.__watcherHandles = []); 2487 } else { 2488 return NOOP; 2489 } 2490 } 2491 let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE; 2492 const job = () => { 2493 if (!effect2.active) { 2494 return; 2495 } 2496 if (cb) { 2497 const newValue = effect2.run(); 2498 if (deep || forceTrigger || (isMultiSource ? newValue.some( 2499 (v, i) => hasChanged(v, oldValue[i]) 2500 ) : hasChanged(newValue, oldValue)) || false) { 2501 if (cleanup) { 2502 cleanup(); 2503 } 2504 callWithAsyncErrorHandling(cb, instance, 3, [ 2505 newValue, 2506 // pass undefined as the old value when it's changed for the first time 2507 oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, 2508 onCleanup 2509 ]); 2510 oldValue = newValue; 2511 } 2512 } else { 2513 effect2.run(); 2514 } 2515 }; 2516 job.allowRecurse = !!cb; 2517 let scheduler2; 2518 if (flush === "sync") { 2519 scheduler2 = job; 2520 } else if (flush === "post") { 2521 scheduler2 = () => queuePostRenderEffect(job, instance && instance.suspense); 2522 } else { 2523 job.pre = true; 2524 if (instance) 2525 job.id = instance.uid; 2526 scheduler2 = () => queueJob(job); 2527 } 2528 const effect2 = new ReactiveEffect(getter, scheduler2); 2529 if (cb) { 2530 if (immediate) { 2531 job(); 2532 } else { 2533 oldValue = effect2.run(); 2534 } 2535 } else if (flush === "post") { 2536 queuePostRenderEffect( 2537 effect2.run.bind(effect2), 2538 instance && instance.suspense 2539 ); 2540 } else { 2541 effect2.run(); 2542 } 2543 const unwatch = () => { 2544 effect2.stop(); 2545 if (instance && instance.scope) { 2546 remove(instance.scope.effects, effect2); 2547 } 2548 }; 2549 if (ssrCleanup) 2550 ssrCleanup.push(unwatch); 2551 return unwatch; 2552} 2553function instanceWatch(source, value, options) { 2554 const publicThis = this.proxy; 2555 const getter = isString$3(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis); 2556 let cb; 2557 if (isFunction$4(value)) { 2558 cb = value; 2559 } else { 2560 cb = value.handler; 2561 options = value; 2562 } 2563 const cur = currentInstance; 2564 setCurrentInstance(this); 2565 const res = doWatch(getter, cb.bind(publicThis), options); 2566 if (cur) { 2567 setCurrentInstance(cur); 2568 } else { 2569 unsetCurrentInstance(); 2570 } 2571 return res; 2572} 2573function createPathGetter(ctx2, path) { 2574 const segments = path.split("."); 2575 return () => {
2576 let cur = ctx2; 2577 for (let i = 0; i < segments.length && cur; i++) { 2578 cur = cur[segments[i]]; 2579 } 2580 return cur; 2581 }; 2582} 2583function traverse(value, seen) { 2584 if (!isObject$3(value) || value["__v_skip"]) { 2585 return value; 2586 } 2587 seen = seen || /* @__PURE__ */ new Set(); 2588 if (seen.has(value)) { 2589 return value; 2590 } 2591 seen.add(value); 2592 if (isRef(value)) { 2593 traverse(value.value, seen); 2594 } else if (isArray$5(value)) { 2595 for (let i = 0; i < value.length; i++) { 2596 traverse(value[i], seen); 2597 } 2598 } else if (isSet$2(value) || isMap$2(value)) { 2599 value.forEach((v) => { 2600 traverse(v, seen); 2601 }); 2602 } else if (isPlainObject$3(value)) { 2603 for (const key in value) { 2604 traverse(value[key], seen); 2605 } 2606 } 2607 return value; 2608} 2609function withDirectives(vnode, directives) { 2610 const internalInstance = currentRenderingInstance; 2611 if (internalInstance === null) { 2612 return vnode; 2613 } 2614 const instance = getExposeProxy(internalInstance) || internalInstance.proxy; 2615 const bindings = vnode.dirs || (vnode.dirs = []); 2616 for (let i = 0; i < directives.length; i++) { 2617 let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i]; 2618 if (dir) { 2619 if (isFunction$4(dir)) { 2620 dir = { 2621 mounted: dir, 2622 updated: dir 2623 }; 2624 } 2625 if (dir.deep) { 2626 traverse(value); 2627 } 2628 bindings.push({ 2629 dir, 2630 instance, 2631 value, 2632 oldValue: void 0, 2633 arg, 2634 modifiers 2635 }); 2636 } 2637 } 2638 return vnode; 2639} 2640function invokeDirectiveHook(vnode, prevVNode, instance, name) { 2641 const bindings = vnode.dirs; 2642 const oldBindings = prevVNode && prevVNode.dirs; 2643 for (let i = 0; i < bindings.length; i++) { 2644 const binding = bindings[i]; 2645 if (oldBindings) { 2646 binding.oldValue = oldBindings[i].value; 2647 } 2648 let hook = binding.dir[name]; 2649 if (hook) { 2650 pauseTracking(); 2651 callWithAsyncErrorHandling(hook, instance, 8, [ 2652 vnode.el, 2653 binding, 2654 vnode, 2655 prevVNode 2656 ]); 2657 resetTracking(); 2658 } 2659 } 2660} 2661function useTransitionState() { 2662 const state = { 2663 isMounted: false, 2664 isLeaving: false, 2665 isUnmounting: false, 2666 leavingVNodes: /* @__PURE__ */ new Map() 2667 }; 2668 onMounted(() => { 2669 state.isMounted = true; 2670 }); 2671 onBeforeUnmount(() => { 2672 state.isUnmounting = true; 2673 }); 2674 return state; 2675} 2676const TransitionHookValidator = [Function, Array]; 2677const BaseTransitionPropsValidators = { 2678 mode: String, 2679 appear: Boolean, 2680 persisted: Boolean, 2681 // enter 2682 onBeforeEnter: TransitionHookValidator, 2683 onEnter: TransitionHookValidator, 2684 onAfterEnter: TransitionHookValidator, 2685 onEnterCancelled: TransitionHookValidator, 2686 // leave 2687 onBeforeLeave: TransitionHookValidator, 2688 onLeave: TransitionHookValidator, 2689 onAfterLeave: TransitionHookValidator, 2690 onLeaveCancelled: TransitionHookValidator, 2691 // appear 2692 onBeforeAppear: TransitionHookValidator, 2693 onAppear: TransitionHookValidator, 2694 onAfterAppear: TransitionHookValidator, 2695 onAppearCancelled: TransitionHookValidator 2696}; 2697const BaseTransitionImpl = { 2698 name: `BaseTransition`, 2699 props: BaseTransitionPropsValidators, 2700 setup(props, { slots }) { 2701 const instance = getCurrentInstance(); 2702 const state = useTransitionState(); 2703 let prevTransitionKey; 2704 return () => { 2705 const children = slots.default && getTransitionRawChildren(slots.default(), true); 2706 if (!children || !children.length) { 2707 return; 2708 } 2709 let child = children[0]; 2710 if (children.length > 1) { 2711 for (const c2 of children) { 2712 if (c2.type !== Comment) { 2713 child = c2; 2714 break; 2715 } 2716 } 2717 } 2718 const rawProps = toRaw(props); 2719 const { mode } = rawProps; 2720 if (state.isLeaving) { 2721 return emptyPlaceholder(child); 2722 } 2723 const innerChild = getKeepAliveChild(child); 2724 if (!innerChild) { 2725 return emptyPlaceholder(child); 2726 } 2727 const enterHooks = resolveTransitionHooks( 2728 innerChild, 2729 rawProps, 2730 state, 2731 instance 2732 ); 2733 setTransitionHooks(innerChild, enterHooks);
2734 const oldChild = instance.subTree; 2735 const oldInnerChild = oldChild && getKeepAliveChild(oldChild); 2736 let transitionKeyChanged = false; 2737 const { getTransitionKey } = innerChild.type; 2738 if (getTransitionKey) { 2739 const key = getTransitionKey(); 2740 if (prevTransitionKey === void 0) { 2741 prevTransitionKey = key; 2742 } else if (key !== prevTransitionKey) { 2743 prevTransitionKey = key; 2744 transitionKeyChanged = true; 2745 } 2746 } 2747 if (oldInnerChild && oldInnerChild.type !== Comment && (!isSameVNodeType(innerChild, oldInnerChild) || transitionKeyChanged)) { 2748 const leavingHooks = resolveTransitionHooks( 2749 oldInnerChild, 2750 rawProps, 2751 state, 2752 instance 2753 ); 2754 setTransitionHooks(oldInnerChild, leavingHooks); 2755 if (mode === "out-in") { 2756 state.isLeaving = true; 2757 leavingHooks.afterLeave = () => { 2758 state.isLeaving = false; 2759 if (instance.update.active !== false) { 2760 instance.update(); 2761 } 2762 }; 2763 return emptyPlaceholder(child); 2764 } else if (mode === "in-out" && innerChild.type !== Comment) { 2765 leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => { 2766 const leavingVNodesCache = getLeavingNodesForType( 2767 state, 2768 oldInnerChild 2769 ); 2770 leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild; 2771 el._leaveCb = () => { 2772 earlyRemove(); 2773 el._leaveCb = void 0; 2774 delete enterHooks.delayedLeave; 2775 }; 2776 enterHooks.delayedLeave = delayedLeave; 2777 }; 2778 } 2779 } 2780 return child; 2781 }; 2782 } 2783}; 2784const BaseTransition = BaseTransitionImpl; 2785function getLeavingNodesForType(state, vnode) { 2786 const { leavingVNodes } = state; 2787 let leavingVNodesCache = leavingVNodes.get(vnode.type); 2788 if (!leavingVNodesCache) { 2789 leavingVNodesCache = /* @__PURE__ */ Object.create(null); 2790 leavingVNodes.set(vnode.type, leavingVNodesCache); 2791 } 2792 return leavingVNodesCache; 2793} 2794function resolveTransitionHooks(vnode, props, state, instance) { 2795 const { 2796 appear, 2797 mode, 2798 persisted = false, 2799 onBeforeEnter, 2800 onEnter, 2801 onAfterEnter, 2802 onEnterCancelled, 2803 onBeforeLeave, 2804 onLeave, 2805 onAfterLeave, 2806 onLeaveCancelled, 2807 onBeforeAppear, 2808 onAppear, 2809 onAfterAppear, 2810 onAppearCancelled 2811 } = props; 2812 const key = String(vnode.key); 2813 const leavingVNodesCache = getLeavingNodesForType(state, vnode); 2814 const callHook2 = (hook, args) => { 2815 hook && callWithAsyncErrorHandling( 2816 hook, 2817 instance, 2818 9, 2819 args 2820 ); 2821 }; 2822 const callAsyncHook = (hook, args) => { 2823 const done = args[1]; 2824 callHook2(hook, args); 2825 if (isArray$5(hook)) { 2826 if (hook.every((hook2) => hook2.length <= 1)) 2827 done(); 2828 } else if (hook.length <= 1) { 2829 done(); 2830 } 2831 }; 2832 const hooks = { 2833 mode, 2834 persisted, 2835 beforeEnter(el) { 2836 let hook = onBeforeEnter; 2837 if (!state.isMounted) { 2838 if (appear) { 2839 hook = onBeforeAppear || onBeforeEnter; 2840 } else { 2841 return; 2842 } 2843 } 2844 if (el._leaveCb) { 2845 el._leaveCb( 2846 true 2847 /* cancelled */ 2848 ); 2849 } 2850 const leavingVNode = leavingVNodesCache[key]; 2851 if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el._leaveCb) { 2852 leavingVNode.el._leaveCb(); 2853 } 2854 callHook2(hook, [el]); 2855 }, 2856 enter(el) { 2857 let hook = onEnter; 2858 let afterHook = onAfterEnter; 2859 let cancelHook = onEnterCancelled; 2860 if (!state.isMounted) { 2861 if (appear) { 2862 hook = onAppear || onEnter; 2863 afterHook = onAfterAppear || onAfterEnter; 2864 cancelHook = onAppearCancelled || onEnterCancelled; 2865 } else { 2866 return; 2867 } 2868 } 2869 let called = false; 2870 const done = el._enterCb = (cancelled) => { 2871 if (called) 2872 return; 2873 called = true; 2874 if (cancelled) { 2875 callHook2(cancelHook, [el]); 2876 } else { 2877 callHook2(afterHook, [el]); 2878 } 2879 if (hooks.delayedLeave) { 2880 hooks.delayedLeave(); 2881 } 2882 el._enterCb = void 0; 2883 }; 2884 if (hook) { 2885 callAsyncHook(hook, [el, done]); 2886 } else { 2887 done(); 2888 } 2889 }, 2890 leave(el, remove2) {
2891 const key2 = String(vnode.key); 2892 if (el._enterCb) { 2893 el._enterCb( 2894 true 2895 /* cancelled */ 2896 ); 2897 } 2898 if (state.isUnmounting) { 2899 return remove2(); 2900 } 2901 callHook2(onBeforeLeave, [el]); 2902 let called = false; 2903 const done = el._leaveCb = (cancelled) => { 2904 if (called) 2905 return; 2906 called = true; 2907 remove2(); 2908 if (cancelled) { 2909 callHook2(onLeaveCancelled, [el]); 2910 } else { 2911 callHook2(onAfterLeave, [el]); 2912 } 2913 el._leaveCb = void 0; 2914 if (leavingVNodesCache[key2] === vnode) { 2915 delete leavingVNodesCache[key2]; 2916 } 2917 }; 2918 leavingVNodesCache[key2] = vnode; 2919 if (onLeave) { 2920 callAsyncHook(onLeave, [el, done]); 2921 } else { 2922 done(); 2923 } 2924 }, 2925 clone(vnode2) { 2926 return resolveTransitionHooks(vnode2, props, state, instance); 2927 } 2928 }; 2929 return hooks; 2930} 2931function emptyPlaceholder(vnode) { 2932 if (isKeepAlive(vnode)) { 2933 vnode = cloneVNode(vnode); 2934 vnode.children = null; 2935 return vnode; 2936 } 2937} 2938function getKeepAliveChild(vnode) { 2939 return isKeepAlive(vnode) ? vnode.children ? vnode.children[0] : void 0 : vnode; 2940} 2941function setTransitionHooks(vnode, hooks) { 2942 if (vnode.shapeFlag & 6 && vnode.component) { 2943 setTransitionHooks(vnode.component.subTree, hooks); 2944 } else if (vnode.shapeFlag & 128) { 2945 vnode.ssContent.transition = hooks.clone(vnode.ssContent); 2946 vnode.ssFallback.transition = hooks.clone(vnode.ssFallback); 2947 } else { 2948 vnode.transition = hooks; 2949 } 2950} 2951function getTransitionRawChildren(children, keepComment = false, parentKey) { 2952 let ret = []; 2953 let keyedFragmentCount = 0; 2954 for (let i = 0; i < children.length; i++) {
2955 let child = children[i]; 2956 const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i); 2957 if (child.type === Fragment) { 2958 if (child.patchFlag & 128) 2959 keyedFragmentCount++; 2960 ret = ret.concat( 2961 getTransitionRawChildren(child.children, keepComment, key) 2962 ); 2963 } else if (keepComment || child.type !== Comment) { 2964 ret.push(key != null ? cloneVNode(child, { key }) : child); 2965 } 2966 } 2967 if (keyedFragmentCount > 1) { 2968 for (let i = 0; i < ret.length; i++) { 2969 ret[i].patchFlag = -2; 2970 } 2971 } 2972 return ret; 2973} 2974function defineComponent(options, extraOptions) { 2975 return isFunction$4(options) ? ( 2976 // #8326: extend call and options.name access are considered side-effects 2977 // by Rollup, so we have to wrap it in a pure-annotated IIFE. 2978 /* @__PURE__ */ (() => extend$1({ name: options.name }, extraOptions, { setup: options }))() 2979 ) : options; 2980} 2981const isAsyncWrapper = (i) => !!i.type.__asyncLoader; 2982function defineAsyncComponent(source) { 2983 if (isFunction$4(source)) { 2984 source = { loader: source }; 2985 } 2986 const { 2987 loader, 2988 loadingComponent, 2989 errorComponent, 2990 delay = 200, 2991 timeout, 2992 // undefined = never times out 2993 suspensible = true, 2994 onError: userOnError 2995 } = source; 2996 let pendingRequest = null; 2997 let resolvedComp; 2998 let retries = 0; 2999 const retry = () => { 3000 retries++; 3001 pendingRequest = null; 3002 return load(); 3003 }; 3004 const load = () => { 3005 let thisRequest; 3006 return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => { 3007 err = err instanceof Error ? err : new Error(String(err)); 3008 if (userOnError) { 3009 return new Promise((resolve2, reject) => { 3010 const userRetry = () => resolve2(retry()); 3011 const userFail = () => reject(err); 3012 userOnError(err, userRetry, userFail, retries + 1); 3013 }); 3014 } else { 3015 throw err; 3016 } 3017 }).then((comp) => { 3018 if (thisRequest !== pendingRequest && pendingRequest) { 3019 return pendingRequest; 3020 } 3021 if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) { 3022 comp = comp.default; 3023 } 3024 resolvedComp = comp; 3025 return comp; 3026 })); 3027 }; 3028 return defineComponent({ 3029 name: "AsyncComponentWrapper", 3030 __asyncLoader: load, 3031 get __asyncResolved() { 3032 return resolvedComp; 3033 }, 3034 setup() { 3035 const instance = currentInstance; 3036 if (resolvedComp) { 3037 return () => createInnerComp(resolvedComp, instance); 3038 } 3039 const onError = (err) => { 3040 pendingRequest = null; 3041 handleError( 3042 err, 3043 instance, 3044 13, 3045 !errorComponent 3046 /* do not throw in dev if user provided error component */ 3047 ); 3048 }; 3049 if (suspensible && instance.suspense || isInSSRComponentSetup) { 3050 return load().then((comp) => { 3051 return () => createInnerComp(comp, instance); 3052 }).catch((err) => { 3053 onError(err); 3054 return () => errorComponent ? createVNode(errorComponent, { 3055 error: err 3056 }) : null; 3057 }); 3058 } 3059 const loaded = ref(false); 3060 const error = ref(); 3061 const delayed = ref(!!delay); 3062 if (delay) { 3063 setTimeout(() => { 3064 delayed.value = false; 3065 }, delay); 3066 } 3067 if (timeout != null) { 3068 setTimeout(() => { 3069 if (!loaded.value && !error.value) { 3070 const err = new Error( 3071 `Async component timed out after ${timeout}ms.` 3072 ); 3073 onError(err); 3074 error.value = err; 3075 } 3076 }, timeout); 3077 } 3078 load().then(() => { 3079 loaded.value = true; 3080 if (instance.parent && isKeepAlive(instance.parent.vnode)) { 3081 queueJob(instance.parent.update); 3082 } 3083 }).catch((err) => { 3084 onError(err); 3085 error.value = err; 3086 }); 3087 return () => { 3088 if (loaded.value && resolvedComp) { 3089 return createInnerComp(resolvedComp, instance); 3090 } else if (error.value && errorComponent) { 3091 return createVNode(errorComponent, { 3092 error: error.value 3093 }); 3094 } else if (loadingComponent && !delayed.value) { 3095 return createVNode(loadingComponent); 3096 } 3097 }; 3098 } 3099 }); 3100} 3101function createInnerComp(comp, parent) { 3102 const { ref: ref2, props, children, ce } = parent.vnode; 3103 const vnode = createVNode(comp, props, children); 3104 vnode.ref = ref2; 3105 vnode.ce = ce; 3106 delete parent.vnode.ce; 3107 return vnode; 3108} 3109const isKeepAlive = (vnode) => vnode.type.__isKeepAlive; 3110const KeepAliveImpl = { 3111 name: `KeepAlive`, 3112 // Marker for special handling inside the renderer. We are not using a === 3113 // check directly on KeepAlive in the renderer, because importing it directly 3114 // would prevent it from being tree-shaken. 3115 __isKeepAlive: true, 3116 props: {
vendor: 4,498 bytes, lines 3117-3257
3117 include: [String, RegExp, Array], 3118 exclude: [String, RegExp, Array], 3119 max: [String, Number] 3120 }, 3121 setup(props, { slots }) { 3122 const instance = getCurrentInstance(); 3123 const sharedContext = instance.ctx; 3124 if (!sharedContext.renderer) { 3125 return () => { 3126 const children = slots.default && slots.default(); 3127 return children && children.length === 1 ? children[0] : children; 3128 }; 3129 } 3130 const cache2 = /* @__PURE__ */ new Map(); 3131 const keys2 = /* @__PURE__ */ new Set(); 3132 let current = null; 3133 const parentSuspense = instance.suspense; 3134 const { 3135 renderer: { 3136 p: patch, 3137 m: move2, 3138 um: _unmount, 3139 o: { createElement: createElement2 } 3140 } 3141 } = sharedContext; 3142 const storageContainer = createElement2("div"); 3143 sharedContext.activate = (vnode, container, anchor, isSVG2, optimized) => { 3144 const instance2 = vnode.component; 3145 move2(vnode, container, anchor, 0, parentSuspense); 3146 patch( 3147 instance2.vnode, 3148 vnode, 3149 container, 3150 anchor, 3151 instance2, 3152 parentSuspense, 3153 isSVG2, 3154 vnode.slotScopeIds, 3155 optimized 3156 ); 3157 queuePostRenderEffect(() => { 3158 instance2.isDeactivated = false; 3159 if (instance2.a) { 3160 invokeArrayFns(instance2.a); 3161 } 3162 const vnodeHook = vnode.props && vnode.props.onVnodeMounted; 3163 if (vnodeHook) { 3164 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 3165 } 3166 }, parentSuspense); 3167 }; 3168 sharedContext.deactivate = (vnode) => { 3169 const instance2 = vnode.component; 3170 move2(vnode, storageContainer, null, 1, parentSuspense); 3171 queuePostRenderEffect(() => { 3172 if (instance2.da) { 3173 invokeArrayFns(instance2.da); 3174 } 3175 const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted; 3176 if (vnodeHook) { 3177 invokeVNodeHook(vnodeHook, instance2.parent, vnode); 3178 } 3179 instance2.isDeactivated = true; 3180 }, parentSuspense); 3181 }; 3182 function unmount2(vnode) { 3183 resetShapeFlag(vnode); 3184 _unmount(vnode, instance, parentSuspense, true); 3185 } 3186 function pruneCache(filter) { 3187 cache2.forEach((vnode, key) => { 3188 const name = getComponentName(vnode.type); 3189 if (name && (!filter || !filter(name))) { 3190 pruneCacheEntry(key); 3191 } 3192 }); 3193 } 3194 function pruneCacheEntry(key) { 3195 const cached = cache2.get(key); 3196 if (!current || !isSameVNodeType(cached, current)) { 3197 unmount2(cached); 3198 } else if (current) { 3199 resetShapeFlag(current); 3200 } 3201 cache2.delete(key); 3202 keys2.delete(key); 3203 } 3204 watch( 3205 () => [props.include, props.exclude], 3206 ([include, exclude]) => { 3207 include && pruneCache((name) => matches(include, name)); 3208 exclude && pruneCache((name) => !matches(exclude, name)); 3209 }, 3210 // prune post-render after `current` has been updated 3211 { flush: "post", deep: true } 3212 ); 3213 let pendingCacheKey = null; 3214 const cacheSubtree = () => { 3215 if (pendingCacheKey != null) { 3216 cache2.set(pendingCacheKey, getInnerChild(instance.subTree)); 3217 } 3218 }; 3219 onMounted(cacheSubtree); 3220 onUpdated(cacheSubtree); 3221 onBeforeUnmount(() => { 3222 cache2.forEach((cached) => { 3223 const { subTree, suspense } = instance; 3224 const vnode = getInnerChild(subTree); 3225 if (cached.type === vnode.type && cached.key === vnode.key) { 3226 resetShapeFlag(vnode); 3227 const da = vnode.component.da; 3228 da && queuePostRenderEffect(da, suspense); 3229 return; 3230 } 3231 unmount2(cached); 3232 }); 3233 }); 3234 return () => { 3235 pendingCacheKey = null; 3236 if (!slots.default) { 3237 return null; 3238 } 3239 const children = slots.default(); 3240 const rawVNode = children[0]; 3241 if (children.length > 1) { 3242 current = null; 3243 return children; 3244 } else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) { 3245 current = null; 3246 return rawVNode; 3247 } 3248 let vnode = getInnerChild(rawVNode); 3249 const comp = vnode.type; 3250 const name = getComponentName( 3251 isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp 3252 ); 3253 const { include, exclude, max } = props; 3254 if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) { 3255 current = vnode; 3256 return rawVNode; 3257 }
vendor: 1,484 bytes, lines 3258-3306
3258 const key = vnode.key == null ? comp : vnode.key; 3259 const cachedVNode = cache2.get(key); 3260 if (vnode.el) { 3261 vnode = cloneVNode(vnode); 3262 if (rawVNode.shapeFlag & 128) { 3263 rawVNode.ssContent = vnode; 3264 } 3265 } 3266 pendingCacheKey = key; 3267 if (cachedVNode) { 3268 vnode.el = cachedVNode.el; 3269 vnode.component = cachedVNode.component; 3270 if (vnode.transition) { 3271 setTransitionHooks(vnode, vnode.transition); 3272 } 3273 vnode.shapeFlag |= 512; 3274 keys2.delete(key); 3275 keys2.add(key); 3276 } else { 3277 keys2.add(key); 3278 if (max && keys2.size > parseInt(max, 10)) { 3279 pruneCacheEntry(keys2.values().next().value); 3280 } 3281 } 3282 vnode.shapeFlag |= 256; 3283 current = vnode; 3284 return isSuspense(rawVNode.type) ? rawVNode : vnode; 3285 }; 3286 } 3287}; 3288const KeepAlive = KeepAliveImpl; 3289function matches(pattern4, name) { 3290 if (isArray$5(pattern4)) { 3291 return pattern4.some((p2) => matches(p2, name)); 3292 } else if (isString$3(pattern4)) { 3293 return pattern4.split(",").includes(name); 3294 } else if (isRegExp(pattern4)) { 3295 return pattern4.test(name); 3296 } 3297 return false; 3298} 3299function onActivated(hook, target) { 3300 registerKeepAliveHook(hook, "a", target); 3301} 3302function onDeactivated(hook, target) { 3303 registerKeepAliveHook(hook, "da", target); 3304} 3305function registerKeepAliveHook(hook, type4, target = currentInstance) { 3306 const wrappedHook = hook.__wdc || (hook.__wdc = () => {
3307 let current = target; 3308 while (current) { 3309 if (current.isDeactivated) { 3310 return; 3311 } 3312 current = current.parent; 3313 } 3314 return hook(); 3315 }); 3316 injectHook(type4, wrappedHook, target); 3317 if (target) { 3318 let current = target.parent; 3319 while (current && current.parent) { 3320 if (isKeepAlive(current.parent.vnode)) { 3321 injectToKeepAliveRoot(wrappedHook, type4, target, current); 3322 } 3323 current = current.parent; 3324 } 3325 } 3326} 3327function injectToKeepAliveRoot(hook, type4, target, keepAliveRoot) { 3328 const injected = injectHook( 3329 type4, 3330 hook, 3331 keepAliveRoot, 3332 true 3333 /* prepend */ 3334 ); 3335 onUnmounted(() => { 3336 remove(keepAliveRoot[type4], injected); 3337 }, target); 3338} 3339function resetShapeFlag(vnode) { 3340 vnode.shapeFlag &= ~256; 3341 vnode.shapeFlag &= ~512; 3342} 3343function getInnerChild(vnode) { 3344 return vnode.shapeFlag & 128 ? vnode.ssContent : vnode; 3345} 3346function injectHook(type4, hook, target = currentInstance, prepend = false) { 3347 if (target) { 3348 const hooks = target[type4] || (target[type4] = []); 3349 const wrappedHook = hook.__weh || (hook.__weh = (...args) => { 3350 if (target.isUnmounted) { 3351 return; 3352 } 3353 pauseTracking(); 3354 setCurrentInstance(target); 3355 const res = callWithAsyncErrorHandling(hook, target, type4, args); 3356 unsetCurrentInstance(); 3357 resetTracking(); 3358 return res; 3359 }); 3360 if (prepend) { 3361 hooks.unshift(wrappedHook); 3362 } else { 3363 hooks.push(wrappedHook); 3364 } 3365 return wrappedHook; 3366 } 3367} 3368const createHook = (lifecycle) => (hook, target = currentInstance) => ( 3369 // post-create lifecycle registrations are noops during SSR (except for serverPrefetch) 3370 (!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target) 3371); 3372const onBeforeMount = createHook("bm"); 3373const onMounted = createHook("m"); 3374const onBeforeUpdate = createHook("bu"); 3375const onUpdated = createHook("u"); 3376const onBeforeUnmount = createHook("bum"); 3377const onUnmounted = createHook("um"); 3378const onServerPrefetch = createHook("sp"); 3379const onRenderTriggered = createHook( 3380 "rtg" 3381); 3382const onRenderTracked = createHook( 3383 "rtc" 3384); 3385function onErrorCaptured(hook, target = currentInstance) { 3386 injectHook("ec", hook, target); 3387} 3388const COMPONENTS = "components"; 3389const DIRECTIVES = "directives"; 3390function resolveComponent(name, maybeSelfReference) { 3391 return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name; 3392} 3393const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc"); 3394function resolveDynamicComponent(component) { 3395 if (isString$3(component)) { 3396 return resolveAsset(COMPONENTS, component, false) || component; 3397 } else { 3398 return component || NULL_DYNAMIC_COMPONENT; 3399 } 3400} 3401function resolveDirective(name) { 3402 return resolveAsset(DIRECTIVES, name); 3403} 3404function resolveAsset(type4, name, warnMissing = true, maybeSelfReference = false) { 3405 const instance = currentRenderingInstance || currentInstance; 3406 if (instance) { 3407 const Component = instance.type; 3408 if (type4 === COMPONENTS) { 3409 const selfName = getComponentName( 3410 Component, 3411 false 3412 /* do not include inferred name to avoid breaking existing code */ 3413 ); 3414 if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) { 3415 return Component; 3416 } 3417 } 3418 const res = ( 3419 // local registration 3420 // check instance[type] first which is resolved for options API 3421 resolve(instance[type4] || Component[type4], name) || // global registration 3422 resolve(instance.appContext[type4], name) 3423 ); 3424 if (!res && maybeSelfReference) { 3425 return Component; 3426 } 3427 return res; 3428 } 3429} 3430function resolve(registry, name) { 3431 return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]); 3432} 3433function renderList(source, renderItem, cache2, index) { 3434 let ret; 3435 const cached = cache2 && cache2[index]; 3436 if (isArray$5(source) || isString$3(source)) { 3437 ret = new Array(source.length); 3438 for (let i = 0, l2 = source.length; i < l2; i++) { 3439 ret[i] = renderItem(source[i], i, void 0, cached && cached[i]); 3440 } 3441 } else if (typeof source === "number") { 3442 ret = new Array(source); 3443 for (let i = 0; i < source; i++) { 3444 ret[i] = renderItem(i + 1, i, void 0, cached && cached[i]); 3445 } 3446 } else if (isObject$3(source)) { 3447 if (source[Symbol.iterator]) { 3448 ret = Array.from( 3449 source, 3450 (item, i) => renderItem(item, i, void 0, cached && cached[i]) 3451 ); 3452 } else {
3453 const keys2 = Object.keys(source); 3454 ret = new Array(keys2.length); 3455 for (let i = 0, l2 = keys2.length; i < l2; i++) { 3456 const key = keys2[i]; 3457 ret[i] = renderItem(source[key], key, i, cached && cached[i]); 3458 } 3459 } 3460 } else { 3461 ret = []; 3462 } 3463 if (cache2) { 3464 cache2[index] = ret; 3465 } 3466 return ret; 3467} 3468function createSlots(slots, dynamicSlots) { 3469 for (let i = 0; i < dynamicSlots.length; i++) { 3470 const slot = dynamicSlots[i]; 3471 if (isArray$5(slot)) { 3472 for (let j = 0; j < slot.length; j++) { 3473 slots[slot[j].name] = slot[j].fn; 3474 } 3475 } else if (slot) { 3476 slots[slot.name] = slot.key ? (...args) => { 3477 const res = slot.fn(...args); 3478 if (res) 3479 res.key = slot.key; 3480 return res; 3481 } : slot.fn; 3482 } 3483 } 3484 return slots; 3485} 3486function renderSlot(slots, name, props = {}, fallback, noSlotted) { 3487 if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) { 3488 if (name !== "default") 3489 props.name = name; 3490 return createVNode("slot", props, fallback && fallback()); 3491 } 3492 let slot = slots[name]; 3493 if (slot && slot._c) { 3494 slot._d = false; 3495 } 3496 openBlock(); 3497 const validSlotContent = slot && ensureValidVNode$1(slot(props)); 3498 const rendered = createBlock( 3499 Fragment, 3500 { 3501 key: props.key || // slot content array of a dynamic conditional slot may have a branch 3502 // key attached in the `createSlots` helper, respect that 3503 validSlotContent && validSlotContent.key || `_${name}` 3504 }, 3505 validSlotContent || (fallback ? fallback() : []), 3506 validSlotContent && slots._ === 1 ? 64 : -2 3507 ); 3508 if (!noSlotted && rendered.scopeId) { 3509 rendered.slotScopeIds = [rendered.scopeId + "-s"]; 3510 } 3511 if (slot && slot._c) { 3512 slot._d = true; 3513 } 3514 return rendered; 3515} 3516function ensureValidVNode$1(vnodes) { 3517 return vnodes.some((child) => { 3518 if (!isVNode(child)) 3519 return true; 3520 if (child.type === Comment) 3521 return false; 3522 if (child.type === Fragment && !ensureValidVNode$1(child.children)) 3523 return false; 3524 return true; 3525 }) ? vnodes : null; 3526} 3527function toHandlers(obj, preserveCaseIfNecessary) { 3528 const ret = {}; 3529 for (const key in obj) { 3530 ret[preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key)] = obj[key]; 3531 } 3532 return ret; 3533} 3534const getPublicInstance = (i) => { 3535 if (!i) 3536 return null; 3537 if (isStatefulComponent(i)) 3538 return getExposeProxy(i) || i.proxy; 3539 return getPublicInstance(i.parent); 3540}; 3541const publicPropertiesMap = ( 3542 // Move PURE marker to new line to workaround compiler discarding it 3543 // due to type annotation 3544 /* @__PURE__ */ extend$1(/* @__PURE__ */ Object.create(null), { 3545 $: (i) => i, 3546 $el: (i) => i.vnode.el, 3547 $data: (i) => i.data, 3548 $props: (i) => i.props, 3549 $attrs: (i) => i.attrs, 3550 $slots: (i) => i.slots, 3551 $refs: (i) => i.refs, 3552 $parent: (i) => getPublicInstance(i.parent), 3553 $root: (i) => getPublicInstance(i.root), 3554 $emit: (i) => i.emit, 3555 $options: (i) => resolveMergedOptions(i), 3556 $forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)), 3557 $nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)), 3558 $watch: (i) => instanceWatch.bind(i) 3559 }) 3560); 3561const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key); 3562const PublicInstanceProxyHandlers = { 3563 get({ _: instance }, key) { 3564 const { ctx: ctx2, setupState, data: data2, props, accessCache, type: type4, appContext } = instance; 3565 let normalizedProps; 3566 if (key[0] !== "$") { 3567 const n2 = accessCache[key]; 3568 if (n2 !== void 0) { 3569 switch (n2) { 3570 case 1: 3571 return setupState[key]; 3572 case 2: 3573 return data2[key]; 3574 case 4: 3575 return ctx2[key]; 3576 case 3: 3577 return props[key]; 3578 } 3579 } else if (hasSetupBinding(setupState, key)) { 3580 accessCache[key] = 1; 3581 return setupState[key]; 3582 } else if (data2 !== EMPTY_OBJ && hasOwn(data2, key)) { 3583 accessCache[key] = 2; 3584 return data2[key]; 3585 } else if ( 3586 // only cache other properties when instance has declared (thus stable) 3587 // props 3588 (normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key) 3589 ) { 3590 accessCache[key] = 3; 3591 return props[key]; 3592 } else if (ctx2 !== EMPTY_OBJ && hasOwn(ctx2, key)) { 3593 accessCache[key] = 4; 3594 return ctx2[key]; 3595 } else if (shouldCacheAccess) { 3596 accessCache[key] = 0; 3597 } 3598 } 3599 const publicGetter = publicPropertiesMap[key];
3600 let cssModule, globalProperties; 3601 if (publicGetter) { 3602 if (key === "$attrs") { 3603 track(instance, "get", key); 3604 } 3605 return publicGetter(instance); 3606 } else if ( 3607 // css module (injected by vue-loader) 3608 (cssModule = type4.__cssModules) && (cssModule = cssModule[key]) 3609 ) { 3610 return cssModule; 3611 } else if (ctx2 !== EMPTY_OBJ && hasOwn(ctx2, key)) { 3612 accessCache[key] = 4; 3613 return ctx2[key]; 3614 } else if ( 3615 // global properties 3616 globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key) 3617 ) { 3618 { 3619 return globalProperties[key]; 3620 } 3621 } else 3622 ; 3623 }, 3624 set({ _: instance }, key, value) { 3625 const { data: data2, setupState, ctx: ctx2 } = instance; 3626 if (hasSetupBinding(setupState, key)) { 3627 setupState[key] = value; 3628 return true; 3629 } else if (data2 !== EMPTY_OBJ && hasOwn(data2, key)) { 3630 data2[key] = value; 3631 return true; 3632 } else if (hasOwn(instance.props, key)) { 3633 return false; 3634 } 3635 if (key[0] === "$" && key.slice(1) in instance) { 3636 return false; 3637 } else { 3638 { 3639 ctx2[key] = value; 3640 } 3641 } 3642 return true; 3643 }, 3644 has({ 3645 _: { data: data2, setupState, accessCache, ctx: ctx2, appContext, propsOptions } 3646 }, key) { 3647 let normalizedProps; 3648 return !!accessCache[key] || data2 !== EMPTY_OBJ && hasOwn(data2, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx2, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key); 3649 }, 3650 defineProperty(target, key, descriptor) { 3651 if (descriptor.get != null) { 3652 target._.accessCache[key] = 0; 3653 } else if (hasOwn(descriptor, "value")) { 3654 this.set(target, key, descriptor.value, null); 3655 } 3656 return Reflect.defineProperty(target, key, descriptor); 3657 } 3658}; 3659const RuntimeCompiledPublicInstanceProxyHandlers = /* @__PURE__ */ extend$1( 3660 {}, 3661 PublicInstanceProxyHandlers, 3662 { 3663 get(target, key) { 3664 if (key === Symbol.unscopables) { 3665 return; 3666 } 3667 return PublicInstanceProxyHandlers.get(target, key, target); 3668 }, 3669 has(_, key) { 3670 const has2 = key[0] !== "_" && !isGloballyWhitelisted(key); 3671 return has2; 3672 } 3673 } 3674); 3675function defineProps() { 3676 return null; 3677} 3678function defineEmits() { 3679 return null; 3680} 3681function defineExpose(exposed) { 3682} 3683function defineOptions(options) { 3684} 3685function defineSlots() { 3686 return null; 3687} 3688function defineModel() { 3689} 3690function withDefaults(props, defaults2) { 3691 return null; 3692} 3693function useSlots() { 3694 return getContext().slots; 3695} 3696function useAttrs() { 3697 return getContext().attrs; 3698} 3699function useModel(props, name, options) { 3700 const i = getCurrentInstance(); 3701 if (options && options.local) { 3702 const proxy = ref(props[name]); 3703 watch( 3704 () => props[name], 3705 (v) => proxy.value = v 3706 ); 3707 watch(proxy, (value) => { 3708 if (value !== props[name]) { 3709 i.emit(`update:${name}`, value); 3710 } 3711 }); 3712 return proxy; 3713 } else { 3714 return { 3715 __v_isRef: true, 3716 get value() { 3717 return props[name]; 3718 }, 3719 set value(value) { 3720 i.emit(`update:${name}`, value); 3721 } 3722 }; 3723 } 3724} 3725function getContext() { 3726 const i = getCurrentInstance(); 3727 return i.setupContext || (i.setupContext = createSetupContext(i)); 3728} 3729function normalizePropsOrEmits(props) { 3730 return isArray$5(props) ? props.reduce( 3731 (normalized, p2) => (normalized[p2] = null, normalized), 3732 {} 3733 ) : props; 3734} 3735function mergeDefaults(raw, defaults2) { 3736 const props = normalizePropsOrEmits(raw); 3737 for (const key in defaults2) { 3738 if (key.startsWith("__skip")) 3739 continue; 3740 let opt = props[key]; 3741 if (opt) { 3742 if (isArray$5(opt) || isFunction$4(opt)) { 3743 opt = props[key] = { type: opt, default: defaults2[key] }; 3744 } else { 3745 opt.default = defaults2[key]; 3746 } 3747 } else if (opt === null) { 3748 opt = props[key] = { default: defaults2[key] }; 3749 } else 3750 ; 3751 if (opt && defaults2[`__skip_${key}`]) { 3752 opt.skipFactory = true; 3753 } 3754 } 3755 return props; 3756} 3757function mergeModels(a, b) { 3758 if (!a || !b) 3759 return a || b; 3760 if (isArray$5(a) && isArray$5(b)) 3761 return a.concat(b); 3762 return extend$1({}, normalizePropsOrEmits(a), normalizePropsOrEmits(b)); 3763} 3764function createPropsRestProxy(props, excludedKeys) { 3765 const ret = {}; 3766 for (const key in props) { 3767 if (!excludedKeys.includes(key)) { 3768 Object.defineProperty(ret, key, { 3769 enumerable: true, 3770 get: () => props[key] 3771 }); 3772 } 3773 } 3774 return ret; 3775} 3776function withAsyncContext(getAwaitable) { 3777 const ctx2 = getCurrentInstance(); 3778 let awaitable = getAwaitable(); 3779 unsetCurrentInstance();
vendor: 19,031 bytes, lines 3780-4458
3780 if (isPromise(awaitable)) { 3781 awaitable = awaitable.catch((e) => { 3782 setCurrentInstance(ctx2); 3783 throw e; 3784 }); 3785 } 3786 return [awaitable, () => setCurrentInstance(ctx2)]; 3787} 3788let shouldCacheAccess = true; 3789function applyOptions(instance) { 3790 const options = resolveMergedOptions(instance); 3791 const publicThis = instance.proxy; 3792 const ctx2 = instance.ctx; 3793 shouldCacheAccess = false; 3794 if (options.beforeCreate) { 3795 callHook$1(options.beforeCreate, instance, "bc"); 3796 } 3797 const { 3798 // state 3799 data: dataOptions, 3800 computed: computedOptions, 3801 methods, 3802 watch: watchOptions, 3803 provide: provideOptions, 3804 inject: injectOptions, 3805 // lifecycle 3806 created, 3807 beforeMount, 3808 mounted, 3809 beforeUpdate, 3810 updated, 3811 activated, 3812 deactivated, 3813 beforeDestroy, 3814 beforeUnmount, 3815 destroyed, 3816 unmounted, 3817 render: render2, 3818 renderTracked, 3819 renderTriggered, 3820 errorCaptured, 3821 serverPrefetch, 3822 // public API 3823 expose, 3824 inheritAttrs, 3825 // assets 3826 components, 3827 directives, 3828 filters 3829 } = options; 3830 const checkDuplicateProperties = null; 3831 if (injectOptions) { 3832 resolveInjections(injectOptions, ctx2, checkDuplicateProperties); 3833 } 3834 if (methods) { 3835 for (const key in methods) { 3836 const methodHandler = methods[key]; 3837 if (isFunction$4(methodHandler)) { 3838 { 3839 ctx2[key] = methodHandler.bind(publicThis); 3840 } 3841 } 3842 } 3843 } 3844 if (dataOptions) { 3845 const data2 = dataOptions.call(publicThis, publicThis); 3846 if (!isObject$3(data2)) 3847 ; 3848 else { 3849 instance.data = reactive(data2); 3850 } 3851 } 3852 shouldCacheAccess = true; 3853 if (computedOptions) { 3854 for (const key in computedOptions) { 3855 const opt = computedOptions[key]; 3856 const get2 = isFunction$4(opt) ? opt.bind(publicThis, publicThis) : isFunction$4(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP; 3857 const set2 = !isFunction$4(opt) && isFunction$4(opt.set) ? opt.set.bind(publicThis) : NOOP; 3858 const c2 = computed({ 3859 get: get2, 3860 set: set2 3861 }); 3862 Object.defineProperty(ctx2, key, { 3863 enumerable: true, 3864 configurable: true, 3865 get: () => c2.value, 3866 set: (v) => c2.value = v 3867 }); 3868 } 3869 } 3870 if (watchOptions) { 3871 for (const key in watchOptions) { 3872 createWatcher(watchOptions[key], ctx2, publicThis, key); 3873 } 3874 } 3875 if (provideOptions) { 3876 const provides = isFunction$4(provideOptions) ? provideOptions.call(publicThis) : provideOptions; 3877 Reflect.ownKeys(provides).forEach((key) => { 3878 provide(key, provides[key]); 3879 }); 3880 } 3881 if (created) { 3882 callHook$1(created, instance, "c"); 3883 } 3884 function registerLifecycleHook(register2, hook) { 3885 if (isArray$5(hook)) { 3886 hook.forEach((_hook) => register2(_hook.bind(publicThis))); 3887 } else if (hook) { 3888 register2(hook.bind(publicThis)); 3889 } 3890 } 3891 registerLifecycleHook(onBeforeMount, beforeMount); 3892 registerLifecycleHook(onMounted, mounted); 3893 registerLifecycleHook(onBeforeUpdate, beforeUpdate); 3894 registerLifecycleHook(onUpdated, updated); 3895 registerLifecycleHook(onActivated, activated); 3896 registerLifecycleHook(onDeactivated, deactivated); 3897 registerLifecycleHook(onErrorCaptured, errorCaptured); 3898 registerLifecycleHook(onRenderTracked, renderTracked); 3899 registerLifecycleHook(onRenderTriggered, renderTriggered); 3900 registerLifecycleHook(onBeforeUnmount, beforeUnmount); 3901 registerLifecycleHook(onUnmounted, unmounted); 3902 registerLifecycleHook(onServerPrefetch, serverPrefetch); 3903 if (isArray$5(expose)) { 3904 if (expose.length) { 3905 const exposed = instance.exposed || (instance.exposed = {}); 3906 expose.forEach((key) => { 3907 Object.defineProperty(exposed, key, { 3908 get: () => publicThis[key], 3909 set: (val) => publicThis[key] = val 3910 }); 3911 }); 3912 } else if (!instance.exposed) { 3913 instance.exposed = {}; 3914 } 3915 } 3916 if (render2 && instance.render === NOOP) { 3917 instance.render = render2; 3918 } 3919 if (inheritAttrs != null) { 3920 instance.inheritAttrs = inheritAttrs; 3921 } 3922 if (components) 3923 instance.components = components; 3924 if (directives) 3925 instance.directives = directives; 3926} 3927function resolveInjections(injectOptions, ctx2, checkDuplicateProperties = NOOP) { 3928 if (isArray$5(injectOptions)) { 3929 injectOptions = normalizeInject(injectOptions); 3930 } 3931 for (const key in injectOptions) { 3932 const opt = injectOptions[key]; 3933 let injected; 3934 if (isObject$3(opt)) { 3935 if ("default" in opt) { 3936 injected = inject( 3937 opt.from || key, 3938 opt.default, 3939 true 3940 /* treat default function as factory */ 3941 ); 3942 } else { 3943 injected = inject(opt.from || key); 3944 } 3945 } else { 3946 injected = inject(opt); 3947 } 3948 if (isRef(injected)) { 3949 Object.defineProperty(ctx2, key, { 3950 enumerable: true, 3951 configurable: true, 3952 get: () => injected.value, 3953 set: (v) => injected.value = v 3954 }); 3955 } else { 3956 ctx2[key] = injected; 3957 } 3958 } 3959} 3960function callHook$1(hook, instance, type4) { 3961 callWithAsyncErrorHandling( 3962 isArray$5(hook) ? hook.map((h2) => h2.bind(instance.proxy)) : hook.bind(instance.proxy), 3963 instance, 3964 type4 3965 ); 3966} 3967function createWatcher(raw, ctx2, publicThis, key) { 3968 const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key]; 3969 if (isString$3(raw)) { 3970 const handler = ctx2[raw]; 3971 if (isFunction$4(handler)) { 3972 watch(getter, handler); 3973 } 3974 } else if (isFunction$4(raw)) { 3975 watch(getter, raw.bind(publicThis)); 3976 } else if (isObject$3(raw)) { 3977 if (isArray$5(raw)) { 3978 raw.forEach((r) => createWatcher(r, ctx2, publicThis, key)); 3979 } else { 3980 const handler = isFunction$4(raw.handler) ? raw.handler.bind(publicThis) : ctx2[raw.handler]; 3981 if (isFunction$4(handler)) { 3982 watch(getter, handler, raw); 3983 } 3984 } 3985 } else 3986 ; 3987} 3988function resolveMergedOptions(instance) { 3989 const base2 = instance.type; 3990 const { mixins, extends: extendsOptions } = base2; 3991 const { 3992 mixins: globalMixins, 3993 optionsCache: cache2, 3994 config: { optionMergeStrategies } 3995 } = instance.appContext; 3996 const cached = cache2.get(base2); 3997 let resolved; 3998 if (cached) { 3999 resolved = cached; 4000 } else if (!globalMixins.length && !mixins && !extendsOptions) { 4001 { 4002 resolved = base2; 4003 } 4004 } else { 4005 resolved = {}; 4006 if (globalMixins.length) { 4007 globalMixins.forEach( 4008 (m) => mergeOptions(resolved, m, optionMergeStrategies, true) 4009 ); 4010 } 4011 mergeOptions(resolved, base2, optionMergeStrategies); 4012 } 4013 if (isObject$3(base2)) { 4014 cache2.set(base2, resolved); 4015 } 4016 return resolved; 4017} 4018function mergeOptions(to, from, strats, asMixin = false) { 4019 const { mixins, extends: extendsOptions } = from; 4020 if (extendsOptions) { 4021 mergeOptions(to, extendsOptions, strats, true); 4022 } 4023 if (mixins) { 4024 mixins.forEach( 4025 (m) => mergeOptions(to, m, strats, true) 4026 ); 4027 } 4028 for (const key in from) { 4029 if (asMixin && key === "expose") 4030 ; 4031 else { 4032 const strat = internalOptionMergeStrats[key] || strats && strats[key]; 4033 to[key] = strat ? strat(to[key], from[key]) : from[key]; 4034 } 4035 } 4036 return to; 4037} 4038const internalOptionMergeStrats = { 4039 data: mergeDataFn, 4040 props: mergeEmitsOrPropsOptions, 4041 emits: mergeEmitsOrPropsOptions, 4042 // objects 4043 methods: mergeObjectOptions, 4044 computed: mergeObjectOptions, 4045 // lifecycle 4046 beforeCreate: mergeAsArray, 4047 created: mergeAsArray, 4048 beforeMount: mergeAsArray, 4049 mounted: mergeAsArray, 4050 beforeUpdate: mergeAsArray, 4051 updated: mergeAsArray, 4052 beforeDestroy: mergeAsArray, 4053 beforeUnmount: mergeAsArray, 4054 destroyed: mergeAsArray, 4055 unmounted: mergeAsArray, 4056 activated: mergeAsArray, 4057 deactivated: mergeAsArray, 4058 errorCaptured: mergeAsArray, 4059 serverPrefetch: mergeAsArray, 4060 // assets 4061 components: mergeObjectOptions, 4062 directives: mergeObjectOptions, 4063 // watch 4064 watch: mergeWatchOptions, 4065 // provide / inject 4066 provide: mergeDataFn, 4067 inject: mergeInject 4068}; 4069function mergeDataFn(to, from) { 4070 if (!from) { 4071 return to; 4072 } 4073 if (!to) { 4074 return from; 4075 } 4076 return function mergedDataFn() { 4077 return extend$1( 4078 isFunction$4(to) ? to.call(this, this) : to, 4079 isFunction$4(from) ? from.call(this, this) : from 4080 ); 4081 }; 4082} 4083function mergeInject(to, from) { 4084 return mergeObjectOptions(normalizeInject(to), normalizeInject(from)); 4085} 4086function normalizeInject(raw) { 4087 if (isArray$5(raw)) { 4088 const res = {}; 4089 for (let i = 0; i < raw.length; i++) { 4090 res[raw[i]] = raw[i]; 4091 } 4092 return res; 4093 } 4094 return raw; 4095} 4096function mergeAsArray(to, from) { 4097 return to ? [...new Set([].concat(to, from))] : from; 4098} 4099function mergeObjectOptions(to, from) { 4100 return to ? extend$1(/* @__PURE__ */ Object.create(null), to, from) : from; 4101} 4102function mergeEmitsOrPropsOptions(to, from) { 4103 if (to) { 4104 if (isArray$5(to) && isArray$5(from)) { 4105 return [.../* @__PURE__ */ new Set([...to, ...from])]; 4106 } 4107 return extend$1( 4108 /* @__PURE__ */ Object.create(null), 4109 normalizePropsOrEmits(to), 4110 normalizePropsOrEmits(from != null ? from : {}) 4111 ); 4112 } else { 4113 return from; 4114 } 4115} 4116function mergeWatchOptions(to, from) { 4117 if (!to) 4118 return from; 4119 if (!from) 4120 return to; 4121 const merged = extend$1(/* @__PURE__ */ Object.create(null), to); 4122 for (const key in from) { 4123 merged[key] = mergeAsArray(to[key], from[key]); 4124 } 4125 return merged; 4126} 4127function createAppContext() { 4128 return { 4129 app: null, 4130 config: { 4131 isNativeTag: NO, 4132 performance: false, 4133 globalProperties: {}, 4134 optionMergeStrategies: {}, 4135 errorHandler: void 0, 4136 warnHandler: void 0, 4137 compilerOptions: {} 4138 }, 4139 mixins: [], 4140 components: {}, 4141 directives: {}, 4142 provides: /* @__PURE__ */ Object.create(null), 4143 optionsCache: /* @__PURE__ */ new WeakMap(), 4144 propsCache: /* @__PURE__ */ new WeakMap(), 4145 emitsCache: /* @__PURE__ */ new WeakMap() 4146 }; 4147} 4148let uid$1 = 0; 4149function createAppAPI(render2, hydrate2) { 4150 return function createApp2(rootComponent, rootProps = null) { 4151 if (!isFunction$4(rootComponent)) { 4152 rootComponent = extend$1({}, rootComponent); 4153 } 4154 if (rootProps != null && !isObject$3(rootProps)) { 4155 rootProps = null; 4156 } 4157 const context = createAppContext(); 4158 const installedPlugins = /* @__PURE__ */ new Set(); 4159 let isMounted2 = false; 4160 const app = context.app = { 4161 _uid: uid$1++, 4162 _component: rootComponent, 4163 _props: rootProps, 4164 _container: null, 4165 _context: context, 4166 _instance: null, 4167 version: version$1, 4168 get config() { 4169 return context.config; 4170 }, 4171 set config(v) { 4172 }, 4173 use(plugin2, ...options) { 4174 if (installedPlugins.has(plugin2)) 4175 ; 4176 else if (plugin2 && isFunction$4(plugin2.install)) { 4177 installedPlugins.add(plugin2); 4178 plugin2.install(app, ...options); 4179 } else if (isFunction$4(plugin2)) { 4180 installedPlugins.add(plugin2); 4181 plugin2(app, ...options); 4182 } else 4183 ; 4184 return app; 4185 }, 4186 mixin(mixin) { 4187 { 4188 if (!context.mixins.includes(mixin)) { 4189 context.mixins.push(mixin); 4190 } 4191 } 4192 return app; 4193 }, 4194 component(name, component) { 4195 if (!component) { 4196 return context.components[name]; 4197 } 4198 context.components[name] = component; 4199 return app; 4200 }, 4201 directive(name, directive) { 4202 if (!directive) { 4203 return context.directives[name]; 4204 } 4205 context.directives[name] = directive; 4206 return app; 4207 }, 4208 mount(rootContainer, isHydrate, isSVG2) { 4209 if (!isMounted2) { 4210 const vnode = createVNode( 4211 rootComponent, 4212 rootProps 4213 ); 4214 vnode.appContext = context; 4215 if (isHydrate && hydrate2) { 4216 hydrate2(vnode, rootContainer); 4217 } else { 4218 render2(vnode, rootContainer, isSVG2); 4219 } 4220 isMounted2 = true; 4221 app._container = rootContainer; 4222 rootContainer.__vue_app__ = app; 4223 return getExposeProxy(vnode.component) || vnode.component.proxy; 4224 } 4225 }, 4226 unmount() { 4227 if (isMounted2) { 4228 render2(null, app._container); 4229 delete app._container.__vue_app__; 4230 } 4231 }, 4232 provide(key, value) { 4233 context.provides[key] = value; 4234 return app; 4235 }, 4236 runWithContext(fn) { 4237 currentApp = app; 4238 try { 4239 return fn(); 4240 } finally { 4241 currentApp = null; 4242 } 4243 } 4244 }; 4245 return app; 4246 }; 4247} 4248let currentApp = null; 4249function provide(key, value) { 4250 if (!currentInstance) 4251 ; 4252 else { 4253 let provides = currentInstance.provides; 4254 const parentProvides = currentInstance.parent && currentInstance.parent.provides; 4255 if (parentProvides === provides) { 4256 provides = currentInstance.provides = Object.create(parentProvides); 4257 } 4258 provides[key] = value; 4259 } 4260} 4261function inject(key, defaultValue, treatDefaultAsFactory = false) { 4262 const instance = currentInstance || currentRenderingInstance; 4263 if (instance || currentApp) { 4264 const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides; 4265 if (provides && key in provides) { 4266 return provides[key]; 4267 } else if (arguments.length > 1) { 4268 return treatDefaultAsFactory && isFunction$4(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; 4269 } else 4270 ; 4271 } 4272} 4273function hasInjectionContext() { 4274 return !!(currentInstance || currentRenderingInstance || currentApp); 4275} 4276function initProps(instance, rawProps, isStateful, isSSR = false) { 4277 const props = {}; 4278 const attrs = {}; 4279 def(attrs, InternalObjectKey, 1); 4280 instance.propsDefaults = /* @__PURE__ */ Object.create(null); 4281 setFullProps(instance, rawProps, props, attrs); 4282 for (const key in instance.propsOptions[0]) { 4283 if (!(key in props)) { 4284 props[key] = void 0; 4285 } 4286 } 4287 if (isStateful) { 4288 instance.props = isSSR ? props : shallowReactive(props); 4289 } else { 4290 if (!instance.type.props) { 4291 instance.props = attrs; 4292 } else { 4293 instance.props = props; 4294 } 4295 } 4296 instance.attrs = attrs; 4297} 4298function updateProps(instance, rawProps, rawPrevProps, optimized) { 4299 const { 4300 props, 4301 attrs, 4302 vnode: { patchFlag } 4303 } = instance; 4304 const rawCurrentProps = toRaw(props); 4305 const [options] = instance.propsOptions; 4306 let hasAttrsChanged = false; 4307 if ( 4308 // always force full diff in dev 4309 // - #1942 if hmr is enabled with sfc component 4310 // - vite#872 non-sfc component used by sfc component 4311 (optimized || patchFlag > 0) && !(patchFlag & 16) 4312 ) { 4313 if (patchFlag & 8) { 4314 const propsToUpdate = instance.vnode.dynamicProps; 4315 for (let i = 0; i < propsToUpdate.length; i++) { 4316 let key = propsToUpdate[i]; 4317 if (isEmitListener(instance.emitsOptions, key)) { 4318 continue; 4319 } 4320 const value = rawProps[key]; 4321 if (options) { 4322 if (hasOwn(attrs, key)) { 4323 if (value !== attrs[key]) { 4324 attrs[key] = value; 4325 hasAttrsChanged = true; 4326 } 4327 } else { 4328 const camelizedKey = camelize(key); 4329 props[camelizedKey] = resolvePropValue( 4330 options, 4331 rawCurrentProps, 4332 camelizedKey, 4333 value, 4334 instance, 4335 false 4336 /* isAbsent */ 4337 ); 4338 } 4339 } else { 4340 if (value !== attrs[key]) { 4341 attrs[key] = value; 4342 hasAttrsChanged = true; 4343 } 4344 } 4345 } 4346 } 4347 } else { 4348 if (setFullProps(instance, rawProps, props, attrs)) { 4349 hasAttrsChanged = true; 4350 } 4351 let kebabKey; 4352 for (const key in rawCurrentProps) { 4353 if (!rawProps || // for camelCase 4354 !hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case 4355 // and converted to camelCase (#955) 4356 ((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) { 4357 if (options) { 4358 if (rawPrevProps && // for camelCase 4359 (rawPrevProps[key] !== void 0 || // for kebab-case 4360 rawPrevProps[kebabKey] !== void 0)) { 4361 props[key] = resolvePropValue( 4362 options, 4363 rawCurrentProps, 4364 key, 4365 void 0, 4366 instance, 4367 true 4368 /* isAbsent */ 4369 ); 4370 } 4371 } else { 4372 delete props[key]; 4373 } 4374 } 4375 } 4376 if (attrs !== rawCurrentProps) { 4377 for (const key in attrs) { 4378 if (!rawProps || !hasOwn(rawProps, key) && true) { 4379 delete attrs[key]; 4380 hasAttrsChanged = true; 4381 } 4382 } 4383 } 4384 } 4385 if (hasAttrsChanged) { 4386 trigger$1(instance, "set", "$attrs"); 4387 } 4388} 4389function setFullProps(instance, rawProps, props, attrs) { 4390 const [options, needCastKeys] = instance.propsOptions; 4391 let hasAttrsChanged = false; 4392 let rawCastValues; 4393 if (rawProps) { 4394 for (let key in rawProps) { 4395 if (isReservedProp(key)) { 4396 continue; 4397 } 4398 const value = rawProps[key]; 4399 let camelKey; 4400 if (options && hasOwn(options, camelKey = camelize(key))) { 4401 if (!needCastKeys || !needCastKeys.includes(camelKey)) { 4402 props[camelKey] = value; 4403 } else { 4404 (rawCastValues || (rawCastValues = {}))[camelKey] = value; 4405 } 4406 } else if (!isEmitListener(instance.emitsOptions, key)) { 4407 if (!(key in attrs) || value !== attrs[key]) { 4408 attrs[key] = value; 4409 hasAttrsChanged = true; 4410 } 4411 } 4412 } 4413 } 4414 if (needCastKeys) { 4415 const rawCurrentProps = toRaw(props); 4416 const castValues = rawCastValues || EMPTY_OBJ; 4417 for (let i = 0; i < needCastKeys.length; i++) { 4418 const key = needCastKeys[i]; 4419 props[key] = resolvePropValue( 4420 options, 4421 rawCurrentProps, 4422 key, 4423 castValues[key], 4424 instance, 4425 !hasOwn(castValues, key) 4426 ); 4427 } 4428 } 4429 return hasAttrsChanged; 4430} 4431function resolvePropValue(options, props, key, value, instance, isAbsent) { 4432 const opt = options[key]; 4433 if (opt != null) { 4434 const hasDefault = hasOwn(opt, "default"); 4435 if (hasDefault && value === void 0) { 4436 const defaultValue = opt.default; 4437 if (opt.type !== Function && !opt.skipFactory && isFunction$4(defaultValue)) { 4438 const { propsDefaults } = instance; 4439 if (key in propsDefaults) { 4440 value = propsDefaults[key]; 4441 } else { 4442 setCurrentInstance(instance); 4443 value = propsDefaults[key] = defaultValue.call( 4444 null, 4445 props 4446 ); 4447 unsetCurrentInstance(); 4448 } 4449 } else { 4450 value = defaultValue; 4451 } 4452 } 4453 if (opt[ 4454 0 4455 /* shouldCast */ 4456 ]) { 4457 if (isAbsent && !hasDefault) { 4458 value = false;
4459 } else if (opt[ 4460 1 4461 /* shouldCastTrue */ 4462 ] && (value === "" || value === hyphenate(key))) { 4463 value = true; 4464 } 4465 } 4466 } 4467 return value; 4468} 4469function normalizePropsOptions(comp, appContext, asMixin = false) { 4470 const cache2 = appContext.propsCache; 4471 const cached = cache2.get(comp); 4472 if (cached) { 4473 return cached; 4474 } 4475 const raw = comp.props; 4476 const normalized = {}; 4477 const needCastKeys = []; 4478 let hasExtends = false; 4479 if (!isFunction$4(comp)) { 4480 const extendProps = (raw2) => { 4481 hasExtends = true; 4482 const [props, keys2] = normalizePropsOptions(raw2, appContext, true); 4483 extend$1(normalized, props); 4484 if (keys2) 4485 needCastKeys.push(...keys2); 4486 }; 4487 if (!asMixin && appContext.mixins.length) { 4488 appContext.mixins.forEach(extendProps); 4489 } 4490 if (comp.extends) { 4491 extendProps(comp.extends); 4492 } 4493 if (comp.mixins) { 4494 comp.mixins.forEach(extendProps); 4495 } 4496 } 4497 if (!raw && !hasExtends) { 4498 if (isObject$3(comp)) { 4499 cache2.set(comp, EMPTY_ARR); 4500 } 4501 return EMPTY_ARR; 4502 } 4503 if (isArray$5(raw)) { 4504 for (let i = 0; i < raw.length; i++) { 4505 const normalizedKey = camelize(raw[i]); 4506 if (validatePropName(normalizedKey)) { 4507 normalized[normalizedKey] = EMPTY_OBJ; 4508 } 4509 } 4510 } else if (raw) { 4511 for (const key in raw) { 4512 const normalizedKey = camelize(key); 4513 if (validatePropName(normalizedKey)) { 4514 const opt = raw[key]; 4515 const prop = normalized[normalizedKey] = isArray$5(opt) || isFunction$4(opt) ? { type: opt } : extend$1({}, opt); 4516 if (prop) { 4517 const booleanIndex = getTypeIndex(Boolean, prop.type); 4518 const stringIndex = getTypeIndex(String, prop.type); 4519 prop[ 4520 0 4521 /* shouldCast */ 4522 ] = booleanIndex > -1; 4523 prop[ 4524 1 4525 /* shouldCastTrue */ 4526 ] = stringIndex < 0 || booleanIndex < stringIndex; 4527 if (booleanIndex > -1 || hasOwn(prop, "default")) { 4528 needCastKeys.push(normalizedKey); 4529 } 4530 } 4531 } 4532 } 4533 } 4534 const res = [normalized, needCastKeys]; 4535 if (isObject$3(comp)) { 4536 cache2.set(comp, res); 4537 } 4538 return res; 4539} 4540function validatePropName(key) { 4541 if (key[0] !== "$") { 4542 return true; 4543 } 4544 return false; 4545} 4546function getType(ctor) { 4547 const match2 = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/); 4548 return match2 ? match2[2] : ctor === null ? "null" : ""; 4549} 4550function isSameType(a, b) { 4551 return getType(a) === getType(b); 4552} 4553function getTypeIndex(type4, expectedTypes) { 4554 if (isArray$5(expectedTypes)) { 4555 return expectedTypes.findIndex((t) => isSameType(t, type4)); 4556 } else if (isFunction$4(expectedTypes)) { 4557 return isSameType(expectedTypes, type4) ? 0 : -1; 4558 } 4559 return -1; 4560} 4561const isInternalKey = (key) => key[0] === "_" || key === "$stable"; 4562const normalizeSlotValue = (value) => isArray$5(value) ? value.map(normalizeVNode) : [normalizeVNode(value)]; 4563const normalizeSlot = (key, rawSlot, ctx2) => { 4564 if (rawSlot._n) { 4565 return rawSlot; 4566 } 4567 const normalized = withCtx((...args) => { 4568 if (false) 4569 ; 4570 return normalizeSlotValue(rawSlot(...args)); 4571 }, ctx2); 4572 normalized._c = false; 4573 return normalized; 4574}; 4575const normalizeObjectSlots = (rawSlots, slots, instance) => { 4576 const ctx2 = rawSlots._ctx; 4577 for (const key in rawSlots) { 4578 if (isInternalKey(key)) 4579 continue; 4580 const value = rawSlots[key]; 4581 if (isFunction$4(value)) { 4582 slots[key] = normalizeSlot(key, value, ctx2); 4583 } else if (value != null) { 4584 const normalized = normalizeSlotValue(value); 4585 slots[key] = () => normalized; 4586 } 4587 } 4588}; 4589const normalizeVNodeSlots = (instance, children) => { 4590 const normalized = normalizeSlotValue(children); 4591 instance.slots.default = () => normalized; 4592}; 4593const initSlots = (instance, children) => { 4594 if (instance.vnode.shapeFlag & 32) { 4595 const type4 = children._; 4596 if (type4) { 4597 instance.slots = toRaw(children); 4598 def(children, "_", type4); 4599 } else { 4600 normalizeObjectSlots( 4601 children, 4602 instance.slots = {} 4603 ); 4604 } 4605 } else { 4606 instance.slots = {}; 4607 if (children) { 4608 normalizeVNodeSlots(instance, children); 4609 } 4610 } 4611 def(instance.slots, InternalObjectKey, 1); 4612}; 4613const updateSlots = (instance, children, optimized) => { 4614 const { vnode, slots } = instance; 4615 let needDeletionCheck = true; 4616 let deletionComparisonTarget = EMPTY_OBJ; 4617 if (vnode.shapeFlag & 32) { 4618 const type4 = children._; 4619 if (type4) { 4620 if (optimized && type4 === 1) { 4621 needDeletionCheck = false;
4622 } else { 4623 extend$1(slots, children); 4624 if (!optimized && type4 === 1) { 4625 delete slots._; 4626 } 4627 } 4628 } else { 4629 needDeletionCheck = !children.$stable; 4630 normalizeObjectSlots(children, slots); 4631 } 4632 deletionComparisonTarget = children; 4633 } else if (children) { 4634 normalizeVNodeSlots(instance, children); 4635 deletionComparisonTarget = { default: 1 }; 4636 } 4637 if (needDeletionCheck) { 4638 for (const key in slots) { 4639 if (!isInternalKey(key) && !(key in deletionComparisonTarget)) { 4640 delete slots[key]; 4641 } 4642 } 4643 } 4644}; 4645function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { 4646 if (isArray$5(rawRef)) { 4647 rawRef.forEach( 4648 (r, i) => setRef( 4649 r, 4650 oldRawRef && (isArray$5(oldRawRef) ? oldRawRef[i] : oldRawRef), 4651 parentSuspense, 4652 vnode, 4653 isUnmount 4654 ) 4655 ); 4656 return; 4657 } 4658 if (isAsyncWrapper(vnode) && !isUnmount) { 4659 return; 4660 } 4661 const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el; 4662 const value = isUnmount ? null : refValue; 4663 const { i: owner, r: ref2 } = rawRef; 4664 const oldRef = oldRawRef && oldRawRef.r; 4665 const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs; 4666 const setupState = owner.setupState; 4667 if (oldRef != null && oldRef !== ref2) { 4668 if (isString$3(oldRef)) { 4669 refs[oldRef] = null; 4670 if (hasOwn(setupState, oldRef)) { 4671 setupState[oldRef] = null; 4672 } 4673 } else if (isRef(oldRef)) { 4674 oldRef.value = null; 4675 } 4676 } 4677 if (isFunction$4(ref2)) { 4678 callWithErrorHandling(ref2, owner, 12, [value, refs]); 4679 } else { 4680 const _isString = isString$3(ref2); 4681 const _isRef = isRef(ref2); 4682 if (_isString || _isRef) { 4683 const doSet = () => { 4684 if (rawRef.f) { 4685 const existing = _isString ? hasOwn(setupState, ref2) ? setupState[ref2] : refs[ref2] : ref2.value; 4686 if (isUnmount) { 4687 isArray$5(existing) && remove(existing, refValue); 4688 } else { 4689 if (!isArray$5(existing)) { 4690 if (_isString) { 4691 refs[ref2] = [refValue]; 4692 if (hasOwn(setupState, ref2)) { 4693 setupState[ref2] = refs[ref2]; 4694 } 4695 } else { 4696 ref2.value = [refValue]; 4697 if (rawRef.k) 4698 refs[rawRef.k] = ref2.value; 4699 } 4700 } else if (!existing.includes(refValue)) { 4701 existing.push(refValue); 4702 } 4703 } 4704 } else if (_isString) { 4705 refs[ref2] = value; 4706 if (hasOwn(setupState, ref2)) { 4707 setupState[ref2] = value; 4708 } 4709 } else if (_isRef) { 4710 ref2.value = value; 4711 if (rawRef.k) 4712 refs[rawRef.k] = value; 4713 } else 4714 ; 4715 }; 4716 if (value) { 4717 doSet.id = -1; 4718 queuePostRenderEffect(doSet, parentSuspense); 4719 } else { 4720 doSet(); 4721 } 4722 } 4723 } 4724} 4725let hasMismatch = false; 4726const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== "foreignObject"; 4727const isComment = (node) => node.nodeType === 8; 4728function createHydrationFunctions(rendererInternals) { 4729 const { 4730 mt: mountComponent, 4731 p: patch, 4732 o: { 4733 patchProp: patchProp2, 4734 createText, 4735 nextSibling, 4736 parentNode, 4737 remove: remove2, 4738 insert, 4739 createComment 4740 } 4741 } = rendererInternals; 4742 const hydrate2 = (vnode, container) => { 4743 if (!container.hasChildNodes()) { 4744 patch(null, vnode, container); 4745 flushPostFlushCbs(); 4746 container._vnode = vnode; 4747 return; 4748 } 4749 hasMismatch = false; 4750 hydrateNode(container.firstChild, vnode, null, null, null); 4751 flushPostFlushCbs(); 4752 container._vnode = vnode; 4753 if (hasMismatch && true) { 4754 console.error(`Hydration completed but contains mismatches.`); 4755 } 4756 }; 4757 const hydrateNode = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized = false) => { 4758 const isFragmentStart = isComment(node) && node.data === "["; 4759 const onMismatch = () => handleMismatch( 4760 node, 4761 vnode, 4762 parentComponent, 4763 parentSuspense, 4764 slotScopeIds, 4765 isFragmentStart 4766 ); 4767 const { type: type4, ref: ref2, shapeFlag, patchFlag } = vnode; 4768 let domType = node.nodeType; 4769 vnode.el = node; 4770 if (patchFlag === -2) { 4771 optimized = false;
4772 vnode.dynamicChildren = null; 4773 } 4774 let nextNode = null; 4775 switch (type4) { 4776 case Text: 4777 if (domType !== 3) { 4778 if (vnode.children === "") { 4779 insert(vnode.el = createText(""), parentNode(node), node); 4780 nextNode = node; 4781 } else { 4782 nextNode = onMismatch(); 4783 } 4784 } else { 4785 if (node.data !== vnode.children) { 4786 hasMismatch = true; 4787 node.data = vnode.children; 4788 } 4789 nextNode = nextSibling(node); 4790 } 4791 break; 4792 case Comment: 4793 if (domType !== 8 || isFragmentStart) { 4794 nextNode = onMismatch(); 4795 } else { 4796 nextNode = nextSibling(node); 4797 } 4798 break; 4799 case Static: 4800 if (isFragmentStart) { 4801 node = nextSibling(node); 4802 domType = node.nodeType; 4803 } 4804 if (domType === 1 || domType === 3) { 4805 nextNode = node; 4806 const needToAdoptContent = !vnode.children.length; 4807 for (let i = 0; i < vnode.staticCount; i++) { 4808 if (needToAdoptContent) 4809 vnode.children += nextNode.nodeType === 1 ? nextNode.outerHTML : nextNode.data; 4810 if (i === vnode.staticCount - 1) { 4811 vnode.anchor = nextNode; 4812 } 4813 nextNode = nextSibling(nextNode); 4814 } 4815 return isFragmentStart ? nextSibling(nextNode) : nextNode; 4816 } else { 4817 onMismatch(); 4818 } 4819 break; 4820 case Fragment: 4821 if (!isFragmentStart) { 4822 nextNode = onMismatch(); 4823 } else { 4824 nextNode = hydrateFragment( 4825 node, 4826 vnode, 4827 parentComponent, 4828 parentSuspense, 4829 slotScopeIds, 4830 optimized 4831 ); 4832 } 4833 break; 4834 default: 4835 if (shapeFlag & 1) { 4836 if (domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) { 4837 nextNode = onMismatch(); 4838 } else { 4839 nextNode = hydrateElement( 4840 node, 4841 vnode, 4842 parentComponent, 4843 parentSuspense, 4844 slotScopeIds, 4845 optimized 4846 ); 4847 } 4848 } else if (shapeFlag & 6) { 4849 vnode.slotScopeIds = slotScopeIds; 4850 const container = parentNode(node); 4851 mountComponent( 4852 vnode, 4853 container, 4854 null, 4855 parentComponent, 4856 parentSuspense, 4857 isSVGContainer(container), 4858 optimized 4859 ); 4860 nextNode = isFragmentStart ? locateClosingAsyncAnchor(node) : nextSibling(node); 4861 if (nextNode && isComment(nextNode) && nextNode.data === "teleport end") { 4862 nextNode = nextSibling(nextNode); 4863 } 4864 if (isAsyncWrapper(vnode)) { 4865 let subTree; 4866 if (isFragmentStart) { 4867 subTree = createVNode(Fragment); 4868 subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild; 4869 } else { 4870 subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div"); 4871 } 4872 subTree.el = node; 4873 vnode.component.subTree = subTree; 4874 } 4875 } else if (shapeFlag & 64) { 4876 if (domType !== 8) { 4877 nextNode = onMismatch(); 4878 } else { 4879 nextNode = vnode.type.hydrate( 4880 node, 4881 vnode, 4882 parentComponent, 4883 parentSuspense, 4884 slotScopeIds, 4885 optimized, 4886 rendererInternals, 4887 hydrateChildren 4888 ); 4889 } 4890 } else if (shapeFlag & 128) { 4891 nextNode = vnode.type.hydrate( 4892 node, 4893 vnode, 4894 parentComponent, 4895 parentSuspense, 4896 isSVGContainer(parentNode(node)), 4897 slotScopeIds, 4898 optimized, 4899 rendererInternals, 4900 hydrateNode 4901 ); 4902 } else 4903 ; 4904 } 4905 if (ref2 != null) { 4906 setRef(ref2, null, parentSuspense, vnode); 4907 } 4908 return nextNode; 4909 }; 4910 const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4911 optimized = optimized || !!vnode.dynamicChildren; 4912 const { type: type4, props, patchFlag, shapeFlag, dirs } = vnode; 4913 const forcePatchValue = type4 === "input" && dirs || type4 === "option"; 4914 if (forcePatchValue || patchFlag !== -1) { 4915 if (dirs) { 4916 invokeDirectiveHook(vnode, null, parentComponent, "created"); 4917 } 4918 if (props) { 4919 if (forcePatchValue || !optimized || patchFlag & (16 | 32)) { 4920 for (const key in props) { 4921 if (forcePatchValue && key.endsWith("value") || isOn(key) && !isReservedProp(key)) { 4922 patchProp2( 4923 el, 4924 key, 4925 null, 4926 props[key], 4927 false, 4928 void 0, 4929 parentComponent 4930 ); 4931 } 4932 } 4933 } else if (props.onClick) { 4934 patchProp2( 4935 el, 4936 "onClick", 4937 null, 4938 props.onClick, 4939 false, 4940 void 0, 4941 parentComponent 4942 ); 4943 } 4944 } 4945 let vnodeHooks;
4946 if (vnodeHooks = props && props.onVnodeBeforeMount) { 4947 invokeVNodeHook(vnodeHooks, parentComponent, vnode); 4948 } 4949 if (dirs) { 4950 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 4951 } 4952 if ((vnodeHooks = props && props.onVnodeMounted) || dirs) { 4953 queueEffectWithSuspense(() => { 4954 vnodeHooks && invokeVNodeHook(vnodeHooks, parentComponent, vnode); 4955 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 4956 }, parentSuspense); 4957 } 4958 if (shapeFlag & 16 && // skip if element has innerHTML / textContent 4959 !(props && (props.innerHTML || props.textContent))) { 4960 let next = hydrateChildren( 4961 el.firstChild, 4962 vnode, 4963 el, 4964 parentComponent, 4965 parentSuspense, 4966 slotScopeIds, 4967 optimized 4968 ); 4969 while (next) { 4970 hasMismatch = true; 4971 const cur = next; 4972 next = next.nextSibling; 4973 remove2(cur); 4974 } 4975 } else if (shapeFlag & 8) { 4976 if (el.textContent !== vnode.children) { 4977 hasMismatch = true; 4978 el.textContent = vnode.children; 4979 } 4980 } 4981 } 4982 return el.nextSibling; 4983 }; 4984 const hydrateChildren = (node, parentVNode, container, parentComponent, parentSuspense, slotScopeIds, optimized) => { 4985 optimized = optimized || !!parentVNode.dynamicChildren; 4986 const children = parentVNode.children; 4987 const l2 = children.length; 4988 for (let i = 0; i < l2; i++) { 4989 const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]); 4990 if (node) { 4991 node = hydrateNode( 4992 node, 4993 vnode, 4994 parentComponent, 4995 parentSuspense, 4996 slotScopeIds, 4997 optimized 4998 ); 4999 } else if (vnode.type === Text && !vnode.children) { 5000 continue; 5001 } else { 5002 hasMismatch = true; 5003 patch( 5004 null, 5005 vnode, 5006 container, 5007 null, 5008 parentComponent, 5009 parentSuspense, 5010 isSVGContainer(container), 5011 slotScopeIds 5012 ); 5013 } 5014 } 5015 return node; 5016 }; 5017 const hydrateFragment = (node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => { 5018 const { slotScopeIds: fragmentSlotScopeIds } = vnode; 5019 if (fragmentSlotScopeIds) { 5020 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 5021 } 5022 const container = parentNode(node); 5023 const next = hydrateChildren( 5024 nextSibling(node), 5025 vnode, 5026 container, 5027 parentComponent, 5028 parentSuspense, 5029 slotScopeIds, 5030 optimized 5031 ); 5032 if (next && isComment(next) && next.data === "]") { 5033 return nextSibling(vnode.anchor = next); 5034 } else { 5035 hasMismatch = true; 5036 insert(vnode.anchor = createComment(`]`), container, next); 5037 return next; 5038 } 5039 }; 5040 const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => { 5041 hasMismatch = true; 5042 vnode.el = null; 5043 if (isFragment) { 5044 const end = locateClosingAsyncAnchor(node); 5045 while (true) { 5046 const next2 = nextSibling(node); 5047 if (next2 && next2 !== end) { 5048 remove2(next2); 5049 } else { 5050 break; 5051 } 5052 } 5053 } 5054 const next = nextSibling(node); 5055 const container = parentNode(node); 5056 remove2(node); 5057 patch( 5058 null, 5059 vnode, 5060 container, 5061 next, 5062 parentComponent, 5063 parentSuspense, 5064 isSVGContainer(container), 5065 slotScopeIds 5066 ); 5067 return next; 5068 }; 5069 const locateClosingAsyncAnchor = (node) => { 5070 let match2 = 0; 5071 while (node) { 5072 node = nextSibling(node); 5073 if (node && isComment(node)) { 5074 if (node.data === "[") 5075 match2++; 5076 if (node.data === "]") { 5077 if (match2 === 0) { 5078 return nextSibling(node); 5079 } else { 5080 match2--; 5081 } 5082 } 5083 } 5084 } 5085 return node; 5086 }; 5087 return [hydrate2, hydrateNode]; 5088} 5089const queuePostRenderEffect = queueEffectWithSuspense; 5090function createRenderer(options) { 5091 return baseCreateRenderer(options); 5092} 5093function createHydrationRenderer(options) { 5094 return baseCreateRenderer(options, createHydrationFunctions); 5095} 5096function baseCreateRenderer(options, createHydrationFns) { 5097 const target = getGlobalThis(); 5098 target.__VUE__ = true; 5099 const { 5100 insert: hostInsert, 5101 remove: hostRemove, 5102 patchProp: hostPatchProp, 5103 createElement: hostCreateElement, 5104 createText: hostCreateText, 5105 createComment: hostCreateComment, 5106 setText: hostSetText, 5107 setElementText: hostSetElementText, 5108 parentNode: hostParentNode, 5109 nextSibling: hostNextSibling,
vendor: 37,658 bytes, lines 5110-6415
5110 setScopeId: hostSetScopeId = NOOP, 5111 insertStaticContent: hostInsertStaticContent 5112 } = options; 5113 const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG2 = false, slotScopeIds = null, optimized = !!n2.dynamicChildren) => { 5114 if (n1 === n2) { 5115 return; 5116 } 5117 if (n1 && !isSameVNodeType(n1, n2)) { 5118 anchor = getNextHostNode(n1); 5119 unmount2(n1, parentComponent, parentSuspense, true); 5120 n1 = null; 5121 } 5122 if (n2.patchFlag === -2) { 5123 optimized = false; 5124 n2.dynamicChildren = null; 5125 } 5126 const { type: type4, ref: ref2, shapeFlag } = n2; 5127 switch (type4) { 5128 case Text: 5129 processText(n1, n2, container, anchor); 5130 break; 5131 case Comment: 5132 processCommentNode(n1, n2, container, anchor); 5133 break; 5134 case Static: 5135 if (n1 == null) { 5136 mountStaticNode(n2, container, anchor, isSVG2); 5137 } 5138 break; 5139 case Fragment: 5140 processFragment( 5141 n1, 5142 n2, 5143 container, 5144 anchor, 5145 parentComponent, 5146 parentSuspense, 5147 isSVG2, 5148 slotScopeIds, 5149 optimized 5150 ); 5151 break; 5152 default: 5153 if (shapeFlag & 1) { 5154 processElement( 5155 n1, 5156 n2, 5157 container, 5158 anchor, 5159 parentComponent, 5160 parentSuspense, 5161 isSVG2, 5162 slotScopeIds, 5163 optimized 5164 ); 5165 } else if (shapeFlag & 6) { 5166 processComponent( 5167 n1, 5168 n2, 5169 container, 5170 anchor, 5171 parentComponent, 5172 parentSuspense, 5173 isSVG2, 5174 slotScopeIds, 5175 optimized 5176 ); 5177 } else if (shapeFlag & 64) { 5178 type4.process( 5179 n1, 5180 n2, 5181 container, 5182 anchor, 5183 parentComponent, 5184 parentSuspense, 5185 isSVG2, 5186 slotScopeIds, 5187 optimized, 5188 internals 5189 ); 5190 } else if (shapeFlag & 128) { 5191 type4.process( 5192 n1, 5193 n2, 5194 container, 5195 anchor, 5196 parentComponent, 5197 parentSuspense, 5198 isSVG2, 5199 slotScopeIds, 5200 optimized, 5201 internals 5202 ); 5203 } else 5204 ; 5205 } 5206 if (ref2 != null && parentComponent) { 5207 setRef(ref2, n1 && n1.ref, parentSuspense, n2 || n1, !n2); 5208 } 5209 }; 5210 const processText = (n1, n2, container, anchor) => { 5211 if (n1 == null) { 5212 hostInsert( 5213 n2.el = hostCreateText(n2.children), 5214 container, 5215 anchor 5216 ); 5217 } else { 5218 const el = n2.el = n1.el; 5219 if (n2.children !== n1.children) { 5220 hostSetText(el, n2.children); 5221 } 5222 } 5223 }; 5224 const processCommentNode = (n1, n2, container, anchor) => { 5225 if (n1 == null) { 5226 hostInsert( 5227 n2.el = hostCreateComment(n2.children || ""), 5228 container, 5229 anchor 5230 ); 5231 } else { 5232 n2.el = n1.el; 5233 } 5234 }; 5235 const mountStaticNode = (n2, container, anchor, isSVG2) => { 5236 [n2.el, n2.anchor] = hostInsertStaticContent( 5237 n2.children, 5238 container, 5239 anchor, 5240 isSVG2, 5241 n2.el, 5242 n2.anchor 5243 ); 5244 }; 5245 const moveStaticNode = ({ el, anchor }, container, nextSibling) => { 5246 let next; 5247 while (el && el !== anchor) { 5248 next = hostNextSibling(el); 5249 hostInsert(el, container, nextSibling); 5250 el = next; 5251 } 5252 hostInsert(anchor, container, nextSibling); 5253 }; 5254 const removeStaticNode = ({ el, anchor }) => { 5255 let next; 5256 while (el && el !== anchor) { 5257 next = hostNextSibling(el); 5258 hostRemove(el); 5259 el = next; 5260 } 5261 hostRemove(anchor); 5262 }; 5263 const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG2, slotScopeIds, optimized) => { 5264 isSVG2 = isSVG2 || n2.type === "svg"; 5265 if (n1 == null) { 5266 mountElement( 5267 n2, 5268 container, 5269 anchor, 5270 parentComponent, 5271 parentSuspense, 5272 isSVG2, 5273 slotScopeIds, 5274 optimized 5275 ); 5276 } else { 5277 patchElement( 5278 n1, 5279 n2, 5280 parentComponent, 5281 parentSuspense, 5282 isSVG2, 5283 slotScopeIds, 5284 optimized 5285 ); 5286 } 5287 }; 5288 const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG2, slotScopeIds, optimized) => { 5289 let el; 5290 let vnodeHook; 5291 const { type: type4, props, shapeFlag, transition, dirs } = vnode; 5292 el = vnode.el = hostCreateElement( 5293 vnode.type, 5294 isSVG2, 5295 props && props.is, 5296 props 5297 ); 5298 if (shapeFlag & 8) { 5299 hostSetElementText(el, vnode.children); 5300 } else if (shapeFlag & 16) { 5301 mountChildren( 5302 vnode.children, 5303 el, 5304 null, 5305 parentComponent, 5306 parentSuspense, 5307 isSVG2 && type4 !== "foreignObject", 5308 slotScopeIds, 5309 optimized 5310 ); 5311 } 5312 if (dirs) { 5313 invokeDirectiveHook(vnode, null, parentComponent, "created"); 5314 } 5315 setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent); 5316 if (props) { 5317 for (const key in props) { 5318 if (key !== "value" && !isReservedProp(key)) { 5319 hostPatchProp( 5320 el, 5321 key, 5322 null, 5323 props[key], 5324 isSVG2, 5325 vnode.children, 5326 parentComponent, 5327 parentSuspense, 5328 unmountChildren 5329 ); 5330 } 5331 } 5332 if ("value" in props) { 5333 hostPatchProp(el, "value", null, props.value); 5334 } 5335 if (vnodeHook = props.onVnodeBeforeMount) { 5336 invokeVNodeHook(vnodeHook, parentComponent, vnode); 5337 } 5338 } 5339 if (dirs) { 5340 invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); 5341 } 5342 const needCallTransitionHooks = (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted; 5343 if (needCallTransitionHooks) { 5344 transition.beforeEnter(el); 5345 } 5346 hostInsert(el, container, anchor); 5347 if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) { 5348 queuePostRenderEffect(() => { 5349 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 5350 needCallTransitionHooks && transition.enter(el); 5351 dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); 5352 }, parentSuspense); 5353 } 5354 }; 5355 const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => { 5356 if (scopeId) { 5357 hostSetScopeId(el, scopeId); 5358 } 5359 if (slotScopeIds) { 5360 for (let i = 0; i < slotScopeIds.length; i++) { 5361 hostSetScopeId(el, slotScopeIds[i]); 5362 } 5363 } 5364 if (parentComponent) { 5365 let subTree = parentComponent.subTree; 5366 if (vnode === subTree) { 5367 const parentVNode = parentComponent.vnode; 5368 setScopeId( 5369 el, 5370 parentVNode, 5371 parentVNode.scopeId, 5372 parentVNode.slotScopeIds, 5373 parentComponent.parent 5374 ); 5375 } 5376 } 5377 }; 5378 const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG2, slotScopeIds, optimized, start = 0) => { 5379 for (let i = start; i < children.length; i++) { 5380 const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]); 5381 patch( 5382 null, 5383 child, 5384 container, 5385 anchor, 5386 parentComponent, 5387 parentSuspense, 5388 isSVG2, 5389 slotScopeIds, 5390 optimized 5391 ); 5392 } 5393 }; 5394 const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG2, slotScopeIds, optimized) => { 5395 const el = n2.el = n1.el; 5396 let { patchFlag, dynamicChildren, dirs } = n2; 5397 patchFlag |= n1.patchFlag & 16; 5398 const oldProps = n1.props || EMPTY_OBJ; 5399 const newProps = n2.props || EMPTY_OBJ; 5400 let vnodeHook; 5401 parentComponent && toggleRecurse(parentComponent, false); 5402 if (vnodeHook = newProps.onVnodeBeforeUpdate) { 5403 invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 5404 } 5405 if (dirs) { 5406 invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate"); 5407 } 5408 parentComponent && toggleRecurse(parentComponent, true); 5409 const areChildrenSVG = isSVG2 && n2.type !== "foreignObject"; 5410 if (dynamicChildren) { 5411 patchBlockChildren( 5412 n1.dynamicChildren, 5413 dynamicChildren, 5414 el, 5415 parentComponent, 5416 parentSuspense, 5417 areChildrenSVG, 5418 slotScopeIds 5419 ); 5420 } else if (!optimized) { 5421 patchChildren( 5422 n1, 5423 n2, 5424 el, 5425 null, 5426 parentComponent, 5427 parentSuspense, 5428 areChildrenSVG, 5429 slotScopeIds, 5430 false 5431 ); 5432 } 5433 if (patchFlag > 0) { 5434 if (patchFlag & 16) { 5435 patchProps( 5436 el, 5437 n2, 5438 oldProps, 5439 newProps, 5440 parentComponent, 5441 parentSuspense, 5442 isSVG2 5443 ); 5444 } else { 5445 if (patchFlag & 2) { 5446 if (oldProps.class !== newProps.class) { 5447 hostPatchProp(el, "class", null, newProps.class, isSVG2); 5448 } 5449 } 5450 if (patchFlag & 4) { 5451 hostPatchProp(el, "style", oldProps.style, newProps.style, isSVG2); 5452 } 5453 if (patchFlag & 8) { 5454 const propsToUpdate = n2.dynamicProps; 5455 for (let i = 0; i < propsToUpdate.length; i++) { 5456 const key = propsToUpdate[i]; 5457 const prev = oldProps[key]; 5458 const next = newProps[key]; 5459 if (next !== prev || key === "value") { 5460 hostPatchProp( 5461 el, 5462 key, 5463 prev, 5464 next, 5465 isSVG2, 5466 n1.children, 5467 parentComponent, 5468 parentSuspense, 5469 unmountChildren 5470 ); 5471 } 5472 } 5473 } 5474 } 5475 if (patchFlag & 1) { 5476 if (n1.children !== n2.children) { 5477 hostSetElementText(el, n2.children); 5478 } 5479 } 5480 } else if (!optimized && dynamicChildren == null) { 5481 patchProps( 5482 el, 5483 n2, 5484 oldProps, 5485 newProps, 5486 parentComponent, 5487 parentSuspense, 5488 isSVG2 5489 ); 5490 } 5491 if ((vnodeHook = newProps.onVnodeUpdated) || dirs) { 5492 queuePostRenderEffect(() => { 5493 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1); 5494 dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated"); 5495 }, parentSuspense); 5496 } 5497 }; 5498 const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG2, slotScopeIds) => { 5499 for (let i = 0; i < newChildren.length; i++) { 5500 const oldVNode = oldChildren[i]; 5501 const newVNode = newChildren[i]; 5502 const container = ( 5503 // oldVNode may be an errored async setup() component inside Suspense 5504 // which will not have a mounted element 5505 oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent 5506 // of the Fragment itself so it can move its children. 5507 (oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement 5508 // which also requires the correct parent container 5509 !isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. 5510 oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : ( 5511 // In other cases, the parent container is not actually used so we 5512 // just pass the block element here to avoid a DOM parentNode call. 5513 fallbackContainer 5514 ) 5515 ); 5516 patch( 5517 oldVNode, 5518 newVNode, 5519 container, 5520 null, 5521 parentComponent, 5522 parentSuspense, 5523 isSVG2, 5524 slotScopeIds, 5525 true 5526 ); 5527 } 5528 }; 5529 const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG2) => { 5530 if (oldProps !== newProps) { 5531 if (oldProps !== EMPTY_OBJ) { 5532 for (const key in oldProps) { 5533 if (!isReservedProp(key) && !(key in newProps)) { 5534 hostPatchProp( 5535 el, 5536 key, 5537 oldProps[key], 5538 null, 5539 isSVG2, 5540 vnode.children, 5541 parentComponent, 5542 parentSuspense, 5543 unmountChildren 5544 ); 5545 } 5546 } 5547 } 5548 for (const key in newProps) { 5549 if (isReservedProp(key)) 5550 continue; 5551 const next = newProps[key]; 5552 const prev = oldProps[key]; 5553 if (next !== prev && key !== "value") { 5554 hostPatchProp( 5555 el, 5556 key, 5557 prev, 5558 next, 5559 isSVG2, 5560 vnode.children, 5561 parentComponent, 5562 parentSuspense, 5563 unmountChildren 5564 ); 5565 } 5566 } 5567 if ("value" in newProps) { 5568 hostPatchProp(el, "value", oldProps.value, newProps.value); 5569 } 5570 } 5571 }; 5572 const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG2, slotScopeIds, optimized) => { 5573 const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText(""); 5574 const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText(""); 5575 let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2; 5576 if (fragmentSlotScopeIds) { 5577 slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; 5578 } 5579 if (n1 == null) { 5580 hostInsert(fragmentStartAnchor, container, anchor); 5581 hostInsert(fragmentEndAnchor, container, anchor); 5582 mountChildren( 5583 n2.children, 5584 container, 5585 fragmentEndAnchor, 5586 parentComponent, 5587 parentSuspense, 5588 isSVG2, 5589 slotScopeIds, 5590 optimized 5591 ); 5592 } else { 5593 if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result 5594 // of renderSlot() with no valid children 5595 n1.dynamicChildren) { 5596 patchBlockChildren( 5597 n1.dynamicChildren, 5598 dynamicChildren, 5599 container, 5600 parentComponent, 5601 parentSuspense, 5602 isSVG2, 5603 slotScopeIds 5604 ); 5605 if ( 5606 // #2080 if the stable fragment has a key, it's a <template v-for> that may 5607 // get moved around. Make sure all root level vnodes inherit el. 5608 // #2134 or if it's a component root, it may also get moved around 5609 // as the component is being moved. 5610 n2.key != null || parentComponent && n2 === parentComponent.subTree 5611 ) { 5612 traverseStaticChildren( 5613 n1, 5614 n2, 5615 true 5616 /* shallow */ 5617 ); 5618 } 5619 } else { 5620 patchChildren( 5621 n1, 5622 n2, 5623 container, 5624 fragmentEndAnchor, 5625 parentComponent, 5626 parentSuspense, 5627 isSVG2, 5628 slotScopeIds, 5629 optimized 5630 ); 5631 } 5632 } 5633 }; 5634 const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG2, slotScopeIds, optimized) => { 5635 n2.slotScopeIds = slotScopeIds; 5636 if (n1 == null) { 5637 if (n2.shapeFlag & 512) { 5638 parentComponent.ctx.activate( 5639 n2, 5640 container, 5641 anchor, 5642 isSVG2, 5643 optimized 5644 ); 5645 } else { 5646 mountComponent( 5647 n2, 5648 container, 5649 anchor, 5650 parentComponent, 5651 parentSuspense, 5652 isSVG2, 5653 optimized 5654 ); 5655 } 5656 } else { 5657 updateComponent(n1, n2, optimized); 5658 } 5659 }; 5660 const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG2, optimized) => { 5661 const instance = initialVNode.component = createComponentInstance( 5662 initialVNode, 5663 parentComponent, 5664 parentSuspense 5665 ); 5666 if (isKeepAlive(initialVNode)) { 5667 instance.ctx.renderer = internals; 5668 } 5669 { 5670 setupComponent(instance); 5671 } 5672 if (instance.asyncDep) { 5673 parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect); 5674 if (!initialVNode.el) { 5675 const placeholder = instance.subTree = createVNode(Comment); 5676 processCommentNode(null, placeholder, container, anchor); 5677 } 5678 return; 5679 } 5680 setupRenderEffect( 5681 instance, 5682 initialVNode, 5683 container, 5684 anchor, 5685 parentSuspense, 5686 isSVG2, 5687 optimized 5688 ); 5689 }; 5690 const updateComponent = (n1, n2, optimized) => { 5691 const instance = n2.component = n1.component; 5692 if (shouldUpdateComponent(n1, n2, optimized)) { 5693 if (instance.asyncDep && !instance.asyncResolved) { 5694 updateComponentPreRender(instance, n2, optimized); 5695 return; 5696 } else { 5697 instance.next = n2; 5698 invalidateJob(instance.update); 5699 instance.update(); 5700 } 5701 } else { 5702 n2.el = n1.el; 5703 instance.vnode = n2; 5704 } 5705 }; 5706 const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG2, optimized) => { 5707 const componentUpdateFn = () => { 5708 if (!instance.isMounted) { 5709 let vnodeHook; 5710 const { el, props } = initialVNode; 5711 const { bm, m, parent } = instance; 5712 const isAsyncWrapperVNode = isAsyncWrapper(initialVNode); 5713 toggleRecurse(instance, false); 5714 if (bm) { 5715 invokeArrayFns(bm); 5716 } 5717 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) { 5718 invokeVNodeHook(vnodeHook, parent, initialVNode); 5719 } 5720 toggleRecurse(instance, true); 5721 if (el && hydrateNode) { 5722 const hydrateSubTree = () => { 5723 instance.subTree = renderComponentRoot(instance); 5724 hydrateNode( 5725 el, 5726 instance.subTree, 5727 instance, 5728 parentSuspense, 5729 null 5730 ); 5731 }; 5732 if (isAsyncWrapperVNode) { 5733 initialVNode.type.__asyncLoader().then( 5734 // note: we are moving the render call into an async callback, 5735 // which means it won't track dependencies - but it's ok because 5736 // a server-rendered async wrapper is already in resolved state 5737 // and it will never need to change. 5738 () => !instance.isUnmounted && hydrateSubTree() 5739 ); 5740 } else { 5741 hydrateSubTree(); 5742 } 5743 } else { 5744 const subTree = instance.subTree = renderComponentRoot(instance); 5745 patch( 5746 null, 5747 subTree, 5748 container, 5749 anchor, 5750 instance, 5751 parentSuspense, 5752 isSVG2 5753 ); 5754 initialVNode.el = subTree.el; 5755 } 5756 if (m) { 5757 queuePostRenderEffect(m, parentSuspense); 5758 } 5759 if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) { 5760 const scopedInitialVNode = initialVNode; 5761 queuePostRenderEffect( 5762 () => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode), 5763 parentSuspense 5764 ); 5765 } 5766 if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) { 5767 instance.a && queuePostRenderEffect(instance.a, parentSuspense); 5768 } 5769 instance.isMounted = true; 5770 initialVNode = container = anchor = null; 5771 } else { 5772 let { next, bu, u, parent, vnode } = instance; 5773 let originNext = next; 5774 let vnodeHook; 5775 toggleRecurse(instance, false); 5776 if (next) { 5777 next.el = vnode.el; 5778 updateComponentPreRender(instance, next, optimized); 5779 } else { 5780 next = vnode; 5781 } 5782 if (bu) { 5783 invokeArrayFns(bu); 5784 } 5785 if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) { 5786 invokeVNodeHook(vnodeHook, parent, next, vnode); 5787 } 5788 toggleRecurse(instance, true); 5789 const nextTree = renderComponentRoot(instance); 5790 const prevTree = instance.subTree; 5791 instance.subTree = nextTree; 5792 patch( 5793 prevTree, 5794 nextTree, 5795 // parent may have changed if it's in a teleport 5796 hostParentNode(prevTree.el), 5797 // anchor may have changed if it's in a fragment 5798 getNextHostNode(prevTree), 5799 instance, 5800 parentSuspense, 5801 isSVG2 5802 ); 5803 next.el = nextTree.el; 5804 if (originNext === null) { 5805 updateHOCHostEl(instance, nextTree.el); 5806 } 5807 if (u) { 5808 queuePostRenderEffect(u, parentSuspense); 5809 } 5810 if (vnodeHook = next.props && next.props.onVnodeUpdated) { 5811 queuePostRenderEffect( 5812 () => invokeVNodeHook(vnodeHook, parent, next, vnode), 5813 parentSuspense 5814 ); 5815 } 5816 } 5817 }; 5818 const effect2 = instance.effect = new ReactiveEffect( 5819 componentUpdateFn, 5820 () => queueJob(update), 5821 instance.scope 5822 // track it in component's effect scope 5823 ); 5824 const update = instance.update = () => effect2.run(); 5825 update.id = instance.uid; 5826 toggleRecurse(instance, true); 5827 update(); 5828 }; 5829 const updateComponentPreRender = (instance, nextVNode, optimized) => { 5830 nextVNode.component = instance; 5831 const prevProps = instance.vnode.props; 5832 instance.vnode = nextVNode; 5833 instance.next = null; 5834 updateProps(instance, nextVNode.props, prevProps, optimized); 5835 updateSlots(instance, nextVNode.children, optimized); 5836 pauseTracking(); 5837 flushPreFlushCbs(); 5838 resetTracking(); 5839 }; 5840 const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG2, slotScopeIds, optimized = false) => { 5841 const c1 = n1 && n1.children; 5842 const prevShapeFlag = n1 ? n1.shapeFlag : 0; 5843 const c2 = n2.children; 5844 const { patchFlag, shapeFlag } = n2; 5845 if (patchFlag > 0) { 5846 if (patchFlag & 128) { 5847 patchKeyedChildren( 5848 c1, 5849 c2, 5850 container, 5851 anchor, 5852 parentComponent, 5853 parentSuspense, 5854 isSVG2, 5855 slotScopeIds, 5856 optimized 5857 ); 5858 return; 5859 } else if (patchFlag & 256) { 5860 patchUnkeyedChildren( 5861 c1, 5862 c2, 5863 container, 5864 anchor, 5865 parentComponent, 5866 parentSuspense, 5867 isSVG2, 5868 slotScopeIds, 5869 optimized 5870 ); 5871 return; 5872 } 5873 } 5874 if (shapeFlag & 8) { 5875 if (prevShapeFlag & 16) { 5876 unmountChildren(c1, parentComponent, parentSuspense); 5877 } 5878 if (c2 !== c1) { 5879 hostSetElementText(container, c2); 5880 } 5881 } else { 5882 if (prevShapeFlag & 16) { 5883 if (shapeFlag & 16) { 5884 patchKeyedChildren( 5885 c1, 5886 c2, 5887 container, 5888 anchor, 5889 parentComponent, 5890 parentSuspense, 5891 isSVG2, 5892 slotScopeIds, 5893 optimized 5894 ); 5895 } else { 5896 unmountChildren(c1, parentComponent, parentSuspense, true); 5897 } 5898 } else { 5899 if (prevShapeFlag & 8) { 5900 hostSetElementText(container, ""); 5901 } 5902 if (shapeFlag & 16) { 5903 mountChildren( 5904 c2, 5905 container, 5906 anchor, 5907 parentComponent, 5908 parentSuspense, 5909 isSVG2, 5910 slotScopeIds, 5911 optimized 5912 ); 5913 } 5914 } 5915 } 5916 }; 5917 const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG2, slotScopeIds, optimized) => { 5918 c1 = c1 || EMPTY_ARR; 5919 c2 = c2 || EMPTY_ARR; 5920 const oldLength = c1.length; 5921 const newLength = c2.length; 5922 const commonLength = Math.min(oldLength, newLength); 5923 let i; 5924 for (i = 0; i < commonLength; i++) { 5925 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 5926 patch( 5927 c1[i], 5928 nextChild, 5929 container, 5930 null, 5931 parentComponent, 5932 parentSuspense, 5933 isSVG2, 5934 slotScopeIds, 5935 optimized 5936 ); 5937 } 5938 if (oldLength > newLength) { 5939 unmountChildren( 5940 c1, 5941 parentComponent, 5942 parentSuspense, 5943 true, 5944 false, 5945 commonLength 5946 ); 5947 } else { 5948 mountChildren( 5949 c2, 5950 container, 5951 anchor, 5952 parentComponent, 5953 parentSuspense, 5954 isSVG2, 5955 slotScopeIds, 5956 optimized, 5957 commonLength 5958 ); 5959 } 5960 }; 5961 const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG2, slotScopeIds, optimized) => { 5962 let i = 0; 5963 const l2 = c2.length; 5964 let e1 = c1.length - 1; 5965 let e2 = l2 - 1; 5966 while (i <= e1 && i <= e2) { 5967 const n1 = c1[i]; 5968 const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 5969 if (isSameVNodeType(n1, n2)) { 5970 patch( 5971 n1, 5972 n2, 5973 container, 5974 null, 5975 parentComponent, 5976 parentSuspense, 5977 isSVG2, 5978 slotScopeIds, 5979 optimized 5980 ); 5981 } else { 5982 break; 5983 } 5984 i++; 5985 } 5986 while (i <= e1 && i <= e2) { 5987 const n1 = c1[e1]; 5988 const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]); 5989 if (isSameVNodeType(n1, n2)) { 5990 patch( 5991 n1, 5992 n2, 5993 container, 5994 null, 5995 parentComponent, 5996 parentSuspense, 5997 isSVG2, 5998 slotScopeIds, 5999 optimized 6000 ); 6001 } else { 6002 break; 6003 } 6004 e1--; 6005 e2--; 6006 } 6007 if (i > e1) { 6008 if (i <= e2) { 6009 const nextPos = e2 + 1; 6010 const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor; 6011 while (i <= e2) { 6012 patch( 6013 null, 6014 c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]), 6015 container, 6016 anchor, 6017 parentComponent, 6018 parentSuspense, 6019 isSVG2, 6020 slotScopeIds, 6021 optimized 6022 ); 6023 i++; 6024 } 6025 } 6026 } else if (i > e2) { 6027 while (i <= e1) { 6028 unmount2(c1[i], parentComponent, parentSuspense, true); 6029 i++; 6030 } 6031 } else { 6032 const s1 = i; 6033 const s2 = i; 6034 const keyToNewIndexMap = /* @__PURE__ */ new Map(); 6035 for (i = s2; i <= e2; i++) { 6036 const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); 6037 if (nextChild.key != null) { 6038 keyToNewIndexMap.set(nextChild.key, i); 6039 } 6040 } 6041 let j; 6042 let patched = 0; 6043 const toBePatched = e2 - s2 + 1; 6044 let moved = false; 6045 let maxNewIndexSoFar = 0; 6046 const newIndexToOldIndexMap = new Array(toBePatched); 6047 for (i = 0; i < toBePatched; i++) 6048 newIndexToOldIndexMap[i] = 0; 6049 for (i = s1; i <= e1; i++) { 6050 const prevChild = c1[i]; 6051 if (patched >= toBePatched) { 6052 unmount2(prevChild, parentComponent, parentSuspense, true); 6053 continue; 6054 } 6055 let newIndex; 6056 if (prevChild.key != null) { 6057 newIndex = keyToNewIndexMap.get(prevChild.key); 6058 } else { 6059 for (j = s2; j <= e2; j++) { 6060 if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) { 6061 newIndex = j; 6062 break; 6063 } 6064 } 6065 } 6066 if (newIndex === void 0) { 6067 unmount2(prevChild, parentComponent, parentSuspense, true); 6068 } else { 6069 newIndexToOldIndexMap[newIndex - s2] = i + 1; 6070 if (newIndex >= maxNewIndexSoFar) { 6071 maxNewIndexSoFar = newIndex; 6072 } else { 6073 moved = true; 6074 } 6075 patch( 6076 prevChild, 6077 c2[newIndex], 6078 container, 6079 null, 6080 parentComponent, 6081 parentSuspense, 6082 isSVG2, 6083 slotScopeIds, 6084 optimized 6085 ); 6086 patched++; 6087 } 6088 } 6089 const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR; 6090 j = increasingNewIndexSequence.length - 1; 6091 for (i = toBePatched - 1; i >= 0; i--) { 6092 const nextIndex = s2 + i; 6093 const nextChild = c2[nextIndex]; 6094 const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor; 6095 if (newIndexToOldIndexMap[i] === 0) { 6096 patch( 6097 null, 6098 nextChild, 6099 container, 6100 anchor, 6101 parentComponent, 6102 parentSuspense, 6103 isSVG2, 6104 slotScopeIds, 6105 optimized 6106 ); 6107 } else if (moved) { 6108 if (j < 0 || i !== increasingNewIndexSequence[j]) { 6109 move2(nextChild, container, anchor, 2); 6110 } else { 6111 j--; 6112 } 6113 } 6114 } 6115 } 6116 }; 6117 const move2 = (vnode, container, anchor, moveType, parentSuspense = null) => { 6118 const { el, type: type4, transition, children, shapeFlag } = vnode; 6119 if (shapeFlag & 6) { 6120 move2(vnode.component.subTree, container, anchor, moveType); 6121 return; 6122 } 6123 if (shapeFlag & 128) { 6124 vnode.suspense.move(container, anchor, moveType); 6125 return; 6126 } 6127 if (shapeFlag & 64) { 6128 type4.move(vnode, container, anchor, internals); 6129 return; 6130 } 6131 if (type4 === Fragment) { 6132 hostInsert(el, container, anchor); 6133 for (let i = 0; i < children.length; i++) { 6134 move2(children[i], container, anchor, moveType); 6135 } 6136 hostInsert(vnode.anchor, container, anchor); 6137 return; 6138 } 6139 if (type4 === Static) { 6140 moveStaticNode(vnode, container, anchor); 6141 return; 6142 } 6143 const needTransition = moveType !== 2 && shapeFlag & 1 && transition; 6144 if (needTransition) { 6145 if (moveType === 0) { 6146 transition.beforeEnter(el); 6147 hostInsert(el, container, anchor); 6148 queuePostRenderEffect(() => transition.enter(el), parentSuspense); 6149 } else { 6150 const { leave, delayLeave, afterLeave } = transition; 6151 const remove22 = () => hostInsert(el, container, anchor); 6152 const performLeave = () => { 6153 leave(el, () => { 6154 remove22(); 6155 afterLeave && afterLeave(); 6156 }); 6157 }; 6158 if (delayLeave) { 6159 delayLeave(el, remove22, performLeave); 6160 } else { 6161 performLeave(); 6162 } 6163 } 6164 } else { 6165 hostInsert(el, container, anchor); 6166 } 6167 }; 6168 const unmount2 = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => { 6169 const { 6170 type: type4, 6171 props, 6172 ref: ref2, 6173 children, 6174 dynamicChildren, 6175 shapeFlag, 6176 patchFlag, 6177 dirs 6178 } = vnode; 6179 if (ref2 != null) { 6180 setRef(ref2, null, parentSuspense, vnode, true); 6181 } 6182 if (shapeFlag & 256) { 6183 parentComponent.ctx.deactivate(vnode); 6184 return; 6185 } 6186 const shouldInvokeDirs = shapeFlag & 1 && dirs; 6187 const shouldInvokeVnodeHook = !isAsyncWrapper(vnode); 6188 let vnodeHook; 6189 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) { 6190 invokeVNodeHook(vnodeHook, parentComponent, vnode); 6191 } 6192 if (shapeFlag & 6) { 6193 unmountComponent(vnode.component, parentSuspense, doRemove); 6194 } else { 6195 if (shapeFlag & 128) { 6196 vnode.suspense.unmount(parentSuspense, doRemove); 6197 return; 6198 } 6199 if (shouldInvokeDirs) { 6200 invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount"); 6201 } 6202 if (shapeFlag & 64) { 6203 vnode.type.remove( 6204 vnode, 6205 parentComponent, 6206 parentSuspense, 6207 optimized, 6208 internals, 6209 doRemove 6210 ); 6211 } else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments 6212 (type4 !== Fragment || patchFlag > 0 && patchFlag & 64)) { 6213 unmountChildren( 6214 dynamicChildren, 6215 parentComponent, 6216 parentSuspense, 6217 false, 6218 true 6219 ); 6220 } else if (type4 === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) { 6221 unmountChildren(children, parentComponent, parentSuspense); 6222 } 6223 if (doRemove) { 6224 remove2(vnode); 6225 } 6226 } 6227 if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) { 6228 queuePostRenderEffect(() => { 6229 vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); 6230 shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted"); 6231 }, parentSuspense); 6232 } 6233 }; 6234 const remove2 = (vnode) => { 6235 const { type: type4, el, anchor, transition } = vnode; 6236 if (type4 === Fragment) { 6237 { 6238 removeFragment(el, anchor); 6239 } 6240 return; 6241 } 6242 if (type4 === Static) { 6243 removeStaticNode(vnode); 6244 return; 6245 } 6246 const performRemove = () => { 6247 hostRemove(el); 6248 if (transition && !transition.persisted && transition.afterLeave) { 6249 transition.afterLeave(); 6250 } 6251 }; 6252 if (vnode.shapeFlag & 1 && transition && !transition.persisted) { 6253 const { leave, delayLeave } = transition; 6254 const performLeave = () => leave(el, performRemove); 6255 if (delayLeave) { 6256 delayLeave(vnode.el, performRemove, performLeave); 6257 } else { 6258 performLeave(); 6259 } 6260 } else { 6261 performRemove(); 6262 } 6263 }; 6264 const removeFragment = (cur, end) => { 6265 let next; 6266 while (cur !== end) { 6267 next = hostNextSibling(cur); 6268 hostRemove(cur); 6269 cur = next; 6270 } 6271 hostRemove(end); 6272 }; 6273 const unmountComponent = (instance, parentSuspense, doRemove) => { 6274 const { bum, scope, update, subTree, um } = instance; 6275 if (bum) { 6276 invokeArrayFns(bum); 6277 } 6278 scope.stop(); 6279 if (update) { 6280 update.active = false; 6281 unmount2(subTree, instance, parentSuspense, doRemove); 6282 } 6283 if (um) { 6284 queuePostRenderEffect(um, parentSuspense); 6285 } 6286 queuePostRenderEffect(() => { 6287 instance.isUnmounted = true; 6288 }, parentSuspense); 6289 if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) { 6290 parentSuspense.deps--; 6291 if (parentSuspense.deps === 0) { 6292 parentSuspense.resolve(); 6293 } 6294 } 6295 }; 6296 const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => { 6297 for (let i = start; i < children.length; i++) { 6298 unmount2(children[i], parentComponent, parentSuspense, doRemove, optimized); 6299 } 6300 }; 6301 const getNextHostNode = (vnode) => { 6302 if (vnode.shapeFlag & 6) { 6303 return getNextHostNode(vnode.component.subTree); 6304 } 6305 if (vnode.shapeFlag & 128) { 6306 return vnode.suspense.next(); 6307 } 6308 return hostNextSibling(vnode.anchor || vnode.el); 6309 }; 6310 const render2 = (vnode, container, isSVG2) => { 6311 if (vnode == null) { 6312 if (container._vnode) { 6313 unmount2(container._vnode, null, null, true); 6314 } 6315 } else { 6316 patch(container._vnode || null, vnode, container, null, null, null, isSVG2); 6317 } 6318 flushPreFlushCbs(); 6319 flushPostFlushCbs(); 6320 container._vnode = vnode; 6321 }; 6322 const internals = { 6323 p: patch, 6324 um: unmount2, 6325 m: move2, 6326 r: remove2, 6327 mt: mountComponent, 6328 mc: mountChildren, 6329 pc: patchChildren, 6330 pbc: patchBlockChildren, 6331 n: getNextHostNode, 6332 o: options 6333 }; 6334 let hydrate2; 6335 let hydrateNode; 6336 if (createHydrationFns) { 6337 [hydrate2, hydrateNode] = createHydrationFns( 6338 internals 6339 ); 6340 } 6341 return { 6342 render: render2, 6343 hydrate: hydrate2, 6344 createApp: createAppAPI(render2, hydrate2) 6345 }; 6346} 6347function toggleRecurse({ effect: effect2, update }, allowed) { 6348 effect2.allowRecurse = update.allowRecurse = allowed; 6349} 6350function traverseStaticChildren(n1, n2, shallow = false) { 6351 const ch1 = n1.children; 6352 const ch2 = n2.children; 6353 if (isArray$5(ch1) && isArray$5(ch2)) { 6354 for (let i = 0; i < ch1.length; i++) { 6355 const c1 = ch1[i]; 6356 let c2 = ch2[i]; 6357 if (c2.shapeFlag & 1 && !c2.dynamicChildren) { 6358 if (c2.patchFlag <= 0 || c2.patchFlag === 32) { 6359 c2 = ch2[i] = cloneIfMounted(ch2[i]); 6360 c2.el = c1.el; 6361 } 6362 if (!shallow) 6363 traverseStaticChildren(c1, c2); 6364 } 6365 if (c2.type === Text) { 6366 c2.el = c1.el; 6367 } 6368 } 6369 } 6370} 6371function getSequence(arr) { 6372 const p2 = arr.slice(); 6373 const result = [0]; 6374 let i, j, u, v, c2; 6375 const len2 = arr.length; 6376 for (i = 0; i < len2; i++) { 6377 const arrI = arr[i]; 6378 if (arrI !== 0) { 6379 j = result[result.length - 1]; 6380 if (arr[j] < arrI) { 6381 p2[i] = j; 6382 result.push(i); 6383 continue; 6384 } 6385 u = 0; 6386 v = result.length - 1; 6387 while (u < v) { 6388 c2 = u + v >> 1; 6389 if (arr[result[c2]] < arrI) { 6390 u = c2 + 1; 6391 } else { 6392 v = c2; 6393 } 6394 } 6395 if (arrI < arr[result[u]]) { 6396 if (u > 0) { 6397 p2[i] = result[u - 1]; 6398 } 6399 result[u] = i; 6400 } 6401 } 6402 } 6403 u = result.length; 6404 v = result[u - 1]; 6405 while (u-- > 0) { 6406 result[u] = v; 6407 v = p2[v]; 6408 } 6409 return result; 6410} 6411const isTeleport = (type4) => type4.__isTeleport; 6412const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === ""); 6413const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement; 6414const resolveTarget = (props, select) => { 6415 const targetSelector = props && props.to;
6416 if (isString$3(targetSelector)) { 6417 if (!select) { 6418 return null; 6419 } else { 6420 const target = select(targetSelector); 6421 return target; 6422 } 6423 } else { 6424 return targetSelector; 6425 } 6426}; 6427const TeleportImpl = { 6428 __isTeleport: true, 6429 process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG2, slotScopeIds, optimized, internals) { 6430 const { 6431 mc: mountChildren, 6432 pc: patchChildren, 6433 pbc: patchBlockChildren, 6434 o: { insert, querySelector, createText, createComment } 6435 } = internals; 6436 const disabled = isTeleportDisabled(n2.props); 6437 let { shapeFlag, children, dynamicChildren } = n2; 6438 if (n1 == null) { 6439 const placeholder = n2.el = createText(""); 6440 const mainAnchor = n2.anchor = createText(""); 6441 insert(placeholder, container, anchor); 6442 insert(mainAnchor, container, anchor); 6443 const target = n2.target = resolveTarget(n2.props, querySelector); 6444 const targetAnchor = n2.targetAnchor = createText(""); 6445 if (target) { 6446 insert(targetAnchor, target); 6447 isSVG2 = isSVG2 || isTargetSVG(target); 6448 } 6449 const mount2 = (container2, anchor2) => { 6450 if (shapeFlag & 16) { 6451 mountChildren( 6452 children, 6453 container2, 6454 anchor2, 6455 parentComponent, 6456 parentSuspense, 6457 isSVG2, 6458 slotScopeIds, 6459 optimized 6460 ); 6461 } 6462 }; 6463 if (disabled) { 6464 mount2(container, mainAnchor); 6465 } else if (target) { 6466 mount2(target, targetAnchor); 6467 } 6468 } else { 6469 n2.el = n1.el; 6470 const mainAnchor = n2.anchor = n1.anchor; 6471 const target = n2.target = n1.target; 6472 const targetAnchor = n2.targetAnchor = n1.targetAnchor; 6473 const wasDisabled = isTeleportDisabled(n1.props); 6474 const currentContainer = wasDisabled ? container : target; 6475 const currentAnchor = wasDisabled ? mainAnchor : targetAnchor; 6476 isSVG2 = isSVG2 || isTargetSVG(target); 6477 if (dynamicChildren) { 6478 patchBlockChildren( 6479 n1.dynamicChildren, 6480 dynamicChildren, 6481 currentContainer, 6482 parentComponent, 6483 parentSuspense, 6484 isSVG2, 6485 slotScopeIds 6486 ); 6487 traverseStaticChildren(n1, n2, true); 6488 } else if (!optimized) { 6489 patchChildren( 6490 n1, 6491 n2, 6492 currentContainer, 6493 currentAnchor, 6494 parentComponent, 6495 parentSuspense, 6496 isSVG2, 6497 slotScopeIds, 6498 false 6499 ); 6500 } 6501 if (disabled) { 6502 if (!wasDisabled) { 6503 moveTeleport( 6504 n2, 6505 container, 6506 mainAnchor, 6507 internals, 6508 1 6509 ); 6510 } 6511 } else { 6512 if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) { 6513 const nextTarget = n2.target = resolveTarget( 6514 n2.props, 6515 querySelector 6516 ); 6517 if (nextTarget) { 6518 moveTeleport( 6519 n2, 6520 nextTarget, 6521 null, 6522 internals, 6523 0 6524 ); 6525 } 6526 } else if (wasDisabled) { 6527 moveTeleport( 6528 n2, 6529 target, 6530 targetAnchor, 6531 internals, 6532 1 6533 ); 6534 } 6535 } 6536 } 6537 updateCssVars(n2); 6538 }, 6539 remove(vnode, parentComponent, parentSuspense, optimized, { um: unmount2, o: { remove: hostRemove } }, doRemove) { 6540 const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode; 6541 if (target) { 6542 hostRemove(targetAnchor); 6543 } 6544 if (doRemove || !isTeleportDisabled(props)) { 6545 hostRemove(anchor); 6546 if (shapeFlag & 16) { 6547 for (let i = 0; i < children.length; i++) { 6548 const child = children[i]; 6549 unmount2( 6550 child, 6551 parentComponent, 6552 parentSuspense, 6553 true, 6554 !!child.dynamicChildren 6555 ); 6556 } 6557 } 6558 } 6559 }, 6560 move: moveTeleport, 6561 hydrate: hydrateTeleport 6562}; 6563function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move2 }, moveType = 2) { 6564 if (moveType === 0) { 6565 insert(vnode.targetAnchor, container, parentAnchor); 6566 } 6567 const { el, anchor, shapeFlag, children, props } = vnode; 6568 const isReorder = moveType === 2; 6569 if (isReorder) { 6570 insert(el, container, parentAnchor); 6571 } 6572 if (!isReorder || isTeleportDisabled(props)) { 6573 if (shapeFlag & 16) { 6574 for (let i = 0; i < children.length; i++) { 6575 move2( 6576 children[i], 6577 container, 6578 parentAnchor, 6579 2 6580 ); 6581 } 6582 } 6583 } 6584 if (isReorder) { 6585 insert(anchor, container, parentAnchor); 6586 } 6587} 6588function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, { 6589 o: { nextSibling, parentNode, querySelector } 6590}, hydrateChildren) { 6591 const target = vnode.target = resolveTarget( 6592 vnode.props, 6593 querySelector 6594 ); 6595 if (target) { 6596 const targetNode = target._lpa || target.firstChild; 6597 if (vnode.shapeFlag & 16) { 6598 if (isTeleportDisabled(vnode.props)) { 6599 vnode.anchor = hydrateChildren( 6600 nextSibling(node), 6601 vnode, 6602 parentNode(node), 6603 parentComponent, 6604 parentSuspense, 6605 slotScopeIds, 6606 optimized 6607 ); 6608 vnode.targetAnchor = targetNode;
6609 } else { 6610 vnode.anchor = nextSibling(node); 6611 let targetAnchor = targetNode; 6612 while (targetAnchor) { 6613 targetAnchor = nextSibling(targetAnchor); 6614 if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") { 6615 vnode.targetAnchor = targetAnchor; 6616 target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor); 6617 break; 6618 } 6619 } 6620 hydrateChildren( 6621 targetNode, 6622 vnode, 6623 target, 6624 parentComponent, 6625 parentSuspense, 6626 slotScopeIds, 6627 optimized 6628 ); 6629 } 6630 } 6631 updateCssVars(vnode); 6632 } 6633 return vnode.anchor && nextSibling(vnode.anchor); 6634} 6635const Teleport = TeleportImpl; 6636function updateCssVars(vnode) { 6637 const ctx2 = vnode.ctx; 6638 if (ctx2 && ctx2.ut) { 6639 let node = vnode.children[0].el; 6640 while (node !== vnode.targetAnchor) { 6641 if (node.nodeType === 1) 6642 node.setAttribute("data-v-owner", ctx2.uid); 6643 node = node.nextSibling; 6644 } 6645 ctx2.ut(); 6646 } 6647} 6648const Fragment = Symbol.for("v-fgt"); 6649const Text = Symbol.for("v-txt"); 6650const Comment = Symbol.for("v-cmt"); 6651const Static = Symbol.for("v-stc"); 6652const blockStack = []; 6653let currentBlock = null; 6654function openBlock(disableTracking = false) { 6655 blockStack.push(currentBlock = disableTracking ? null : []); 6656} 6657function closeBlock() { 6658 blockStack.pop(); 6659 currentBlock = blockStack[blockStack.length - 1] || null; 6660} 6661let isBlockTreeEnabled = 1; 6662function setBlockTracking(value) { 6663 isBlockTreeEnabled += value; 6664} 6665function setupBlock(vnode) { 6666 vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null; 6667 closeBlock(); 6668 if (isBlockTreeEnabled > 0 && currentBlock) { 6669 currentBlock.push(vnode); 6670 } 6671 return vnode; 6672} 6673function createElementBlock(type4, props, children, patchFlag, dynamicProps, shapeFlag) { 6674 return setupBlock( 6675 createBaseVNode( 6676 type4, 6677 props, 6678 children, 6679 patchFlag, 6680 dynamicProps, 6681 shapeFlag, 6682 true 6683 /* isBlock */ 6684 ) 6685 ); 6686} 6687function createBlock(type4, props, children, patchFlag, dynamicProps) { 6688 return setupBlock( 6689 createVNode( 6690 type4, 6691 props, 6692 children, 6693 patchFlag, 6694 dynamicProps, 6695 true 6696 /* isBlock: prevent a block from tracking itself */ 6697 ) 6698 ); 6699} 6700function isVNode(value) { 6701 return value ? value.__v_isVNode === true : false; 6702} 6703function isSameVNodeType(n1, n2) { 6704 return n1.type === n2.type && n1.key === n2.key; 6705} 6706function transformVNodeArgs(transformer) { 6707} 6708const InternalObjectKey = `__vInternal`; 6709const normalizeKey = ({ key }) => key != null ? key : null; 6710const normalizeRef = ({ 6711 ref: ref2, 6712 ref_key, 6713 ref_for 6714}) => { 6715 if (typeof ref2 === "number") { 6716 ref2 = "" + ref2; 6717 } 6718 return ref2 != null ? isString$3(ref2) || isRef(ref2) || isFunction$4(ref2) ? { i: currentRenderingInstance, r: ref2, k: ref_key, f: !!ref_for } : ref2 : null; 6719}; 6720function createBaseVNode(type4, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type4 === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) { 6721 const vnode = { 6722 __v_isVNode: true, 6723 __v_skip: true, 6724 type: type4, 6725 props, 6726 key: props && normalizeKey(props), 6727 ref: props && normalizeRef(props), 6728 scopeId: currentScopeId, 6729 slotScopeIds: null, 6730 children, 6731 component: null, 6732 suspense: null, 6733 ssContent: null, 6734 ssFallback: null, 6735 dirs: null, 6736 transition: null, 6737 el: null, 6738 anchor: null, 6739 target: null, 6740 targetAnchor: null, 6741 staticCount: 0, 6742 shapeFlag, 6743 patchFlag, 6744 dynamicProps, 6745 dynamicChildren: null, 6746 appContext: null, 6747 ctx: currentRenderingInstance 6748 }; 6749 if (needFullChildrenNormalization) { 6750 normalizeChildren(vnode, children); 6751 if (shapeFlag & 128) { 6752 type4.normalize(vnode); 6753 } 6754 } else if (children) { 6755 vnode.shapeFlag |= isString$3(children) ? 8 : 16; 6756 } 6757 if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself 6758 !isBlockNode && // has current parent block 6759 currentBlock && // presence of a patch flag indicates this node needs patching on updates. 6760 // component nodes also should always be patched, because even if the 6761 // component doesn't need to update, it needs to persist the instance on to 6762 // the next vnode so that it can be properly unmounted later. 6763 (vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the 6764 // vnode should not be considered dynamic due to handler caching. 6765 vnode.patchFlag !== 32) {
vendor: 6,289 bytes, lines 6766-6959
6766 currentBlock.push(vnode); 6767 } 6768 return vnode; 6769} 6770const createVNode = _createVNode; 6771function _createVNode(type4, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) { 6772 if (!type4 || type4 === NULL_DYNAMIC_COMPONENT) { 6773 type4 = Comment; 6774 } 6775 if (isVNode(type4)) { 6776 const cloned = cloneVNode( 6777 type4, 6778 props, 6779 true 6780 /* mergeRef: true */ 6781 ); 6782 if (children) { 6783 normalizeChildren(cloned, children); 6784 } 6785 if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) { 6786 if (cloned.shapeFlag & 6) { 6787 currentBlock[currentBlock.indexOf(type4)] = cloned; 6788 } else { 6789 currentBlock.push(cloned); 6790 } 6791 } 6792 cloned.patchFlag |= -2; 6793 return cloned; 6794 } 6795 if (isClassComponent(type4)) { 6796 type4 = type4.__vccOpts; 6797 } 6798 if (props) { 6799 props = guardReactiveProps(props); 6800 let { class: klass, style: style2 } = props; 6801 if (klass && !isString$3(klass)) { 6802 props.class = normalizeClass(klass); 6803 } 6804 if (isObject$3(style2)) { 6805 if (isProxy(style2) && !isArray$5(style2)) { 6806 style2 = extend$1({}, style2); 6807 } 6808 props.style = normalizeStyle(style2); 6809 } 6810 } 6811 const shapeFlag = isString$3(type4) ? 1 : isSuspense(type4) ? 128 : isTeleport(type4) ? 64 : isObject$3(type4) ? 4 : isFunction$4(type4) ? 2 : 0; 6812 return createBaseVNode( 6813 type4, 6814 props, 6815 children, 6816 patchFlag, 6817 dynamicProps, 6818 shapeFlag, 6819 isBlockNode, 6820 true 6821 ); 6822} 6823function guardReactiveProps(props) { 6824 if (!props) 6825 return null; 6826 return isProxy(props) || InternalObjectKey in props ? extend$1({}, props) : props; 6827} 6828function cloneVNode(vnode, extraProps, mergeRef = false) { 6829 const { props, ref: ref2, patchFlag, children } = vnode; 6830 const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props; 6831 const cloned = { 6832 __v_isVNode: true, 6833 __v_skip: true, 6834 type: vnode.type, 6835 props: mergedProps, 6836 key: mergedProps && normalizeKey(mergedProps), 6837 ref: extraProps && extraProps.ref ? ( 6838 // #2078 in the case of <component :is="vnode" ref="extra"/> 6839 // if the vnode itself already has a ref, cloneVNode will need to merge 6840 // the refs so the single vnode can be set on multiple refs 6841 mergeRef && ref2 ? isArray$5(ref2) ? ref2.concat(normalizeRef(extraProps)) : [ref2, normalizeRef(extraProps)] : normalizeRef(extraProps) 6842 ) : ref2, 6843 scopeId: vnode.scopeId, 6844 slotScopeIds: vnode.slotScopeIds, 6845 children, 6846 target: vnode.target, 6847 targetAnchor: vnode.targetAnchor, 6848 staticCount: vnode.staticCount, 6849 shapeFlag: vnode.shapeFlag, 6850 // if the vnode is cloned with extra props, we can no longer assume its 6851 // existing patch flag to be reliable and need to add the FULL_PROPS flag. 6852 // note: preserve flag for fragments since they use the flag for children 6853 // fast paths only. 6854 patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag, 6855 dynamicProps: vnode.dynamicProps, 6856 dynamicChildren: vnode.dynamicChildren, 6857 appContext: vnode.appContext, 6858 dirs: vnode.dirs, 6859 transition: vnode.transition, 6860 // These should technically only be non-null on mounted VNodes. However, 6861 // they *should* be copied for kept-alive vnodes. So we just always copy 6862 // them since them being non-null during a mount doesn't affect the logic as 6863 // they will simply be overwritten. 6864 component: vnode.component, 6865 suspense: vnode.suspense, 6866 ssContent: vnode.ssContent && cloneVNode(vnode.ssContent), 6867 ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback), 6868 el: vnode.el, 6869 anchor: vnode.anchor, 6870 ctx: vnode.ctx, 6871 ce: vnode.ce 6872 }; 6873 return cloned; 6874} 6875function createTextVNode(text = " ", flag = 0) { 6876 return createVNode(Text, null, text, flag); 6877} 6878function createStaticVNode(content, numberOfNodes) { 6879 const vnode = createVNode(Static, null, content); 6880 vnode.staticCount = numberOfNodes; 6881 return vnode; 6882} 6883function createCommentVNode(text = "", asBlock = false) { 6884 return asBlock ? (openBlock(), createBlock(Comment, null, text)) : createVNode(Comment, null, text); 6885} 6886function normalizeVNode(child) { 6887 if (child == null || typeof child === "boolean") { 6888 return createVNode(Comment); 6889 } else if (isArray$5(child)) { 6890 return createVNode( 6891 Fragment, 6892 null, 6893 // #3666, avoid reference pollution when reusing vnode 6894 child.slice() 6895 ); 6896 } else if (typeof child === "object") { 6897 return cloneIfMounted(child); 6898 } else { 6899 return createVNode(Text, null, String(child)); 6900 } 6901} 6902function cloneIfMounted(child) { 6903 return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child); 6904} 6905function normalizeChildren(vnode, children) { 6906 let type4 = 0; 6907 const { shapeFlag } = vnode; 6908 if (children == null) { 6909 children = null; 6910 } else if (isArray$5(children)) { 6911 type4 = 16; 6912 } else if (typeof children === "object") { 6913 if (shapeFlag & (1 | 64)) { 6914 const slot = children.default; 6915 if (slot) { 6916 slot._c && (slot._d = false); 6917 normalizeChildren(vnode, slot()); 6918 slot._c && (slot._d = true); 6919 } 6920 return; 6921 } else { 6922 type4 = 32; 6923 const slotFlag = children._; 6924 if (!slotFlag && !(InternalObjectKey in children)) { 6925 children._ctx = currentRenderingInstance; 6926 } else if (slotFlag === 3 && currentRenderingInstance) { 6927 if (currentRenderingInstance.slots._ === 1) { 6928 children._ = 1; 6929 } else { 6930 children._ = 2; 6931 vnode.patchFlag |= 1024; 6932 } 6933 } 6934 } 6935 } else if (isFunction$4(children)) { 6936 children = { default: children, _ctx: currentRenderingInstance }; 6937 type4 = 32; 6938 } else { 6939 children = String(children); 6940 if (shapeFlag & 64) { 6941 type4 = 16; 6942 children = [createTextVNode(children)]; 6943 } else { 6944 type4 = 8; 6945 } 6946 } 6947 vnode.children = children; 6948 vnode.shapeFlag |= type4; 6949} 6950function mergeProps(...args) { 6951 const ret = {}; 6952 for (let i = 0; i < args.length; i++) { 6953 const toMerge = args[i]; 6954 for (const key in toMerge) { 6955 if (key === "class") { 6956 if (ret.class !== toMerge.class) { 6957 ret.class = normalizeClass([ret.class, toMerge.class]); 6958 } 6959 } else if (key === "style") {
6960 ret.style = normalizeStyle([ret.style, toMerge.style]); 6961 } else if (isOn(key)) { 6962 const existing = ret[key]; 6963 const incoming = toMerge[key]; 6964 if (incoming && existing !== incoming && !(isArray$5(existing) && existing.includes(incoming))) { 6965 ret[key] = existing ? [].concat(existing, incoming) : incoming; 6966 } 6967 } else if (key !== "") { 6968 ret[key] = toMerge[key]; 6969 } 6970 } 6971 } 6972 return ret; 6973} 6974function invokeVNodeHook(hook, instance, vnode, prevVNode = null) { 6975 callWithAsyncErrorHandling(hook, instance, 7, [ 6976 vnode, 6977 prevVNode 6978 ]); 6979} 6980const emptyAppContext = createAppContext(); 6981let uid = 0; 6982function createComponentInstance(vnode, parent, suspense) { 6983 const type4 = vnode.type; 6984 const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext; 6985 const instance = { 6986 uid: uid++, 6987 vnode, 6988 type: type4, 6989 parent, 6990 appContext, 6991 root: null, 6992 // to be immediately set 6993 next: null, 6994 subTree: null, 6995 // will be set synchronously right after creation 6996 effect: null, 6997 update: null, 6998 // will be set synchronously right after creation 6999 scope: new EffectScope( 7000 true 7001 /* detached */ 7002 ), 7003 render: null, 7004 proxy: null, 7005 exposed: null, 7006 exposeProxy: null, 7007 withProxy: null, 7008 provides: parent ? parent.provides : Object.create(appContext.provides), 7009 accessCache: null, 7010 renderCache: [], 7011 // local resolved assets 7012 components: null, 7013 directives: null, 7014 // resolved props and emits options 7015 propsOptions: normalizePropsOptions(type4, appContext), 7016 emitsOptions: normalizeEmitsOptions(type4, appContext), 7017 // emit 7018 emit: null, 7019 // to be set immediately 7020 emitted: null, 7021 // props default value 7022 propsDefaults: EMPTY_OBJ, 7023 // inheritAttrs 7024 inheritAttrs: type4.inheritAttrs, 7025 // state 7026 ctx: EMPTY_OBJ, 7027 data: EMPTY_OBJ, 7028 props: EMPTY_OBJ, 7029 attrs: EMPTY_OBJ, 7030 slots: EMPTY_OBJ, 7031 refs: EMPTY_OBJ, 7032 setupState: EMPTY_OBJ, 7033 setupContext: null, 7034 attrsProxy: null, 7035 slotsProxy: null, 7036 // suspense related 7037 suspense, 7038 suspenseId: suspense ? suspense.pendingId : 0, 7039 asyncDep: null, 7040 asyncResolved: false, 7041 // lifecycle hooks 7042 // not using enums here because it results in computed properties 7043 isMounted: false, 7044 isUnmounted: false, 7045 isDeactivated: false, 7046 bc: null, 7047 c: null, 7048 bm: null, 7049 m: null, 7050 bu: null, 7051 u: null, 7052 um: null, 7053 bum: null, 7054 da: null, 7055 a: null, 7056 rtg: null, 7057 rtc: null, 7058 ec: null, 7059 sp: null 7060 }; 7061 { 7062 instance.ctx = { _: instance }; 7063 } 7064 instance.root = parent ? parent.root : instance; 7065 instance.emit = emit.bind(null, instance); 7066 if (vnode.ce) { 7067 vnode.ce(instance); 7068 } 7069 return instance; 7070} 7071let currentInstance = null; 7072const getCurrentInstance = () => currentInstance || currentRenderingInstance; 7073let internalSetCurrentInstance; 7074let globalCurrentInstanceSetters; 7075let settersKey = "__VUE_INSTANCE_SETTERS__"; 7076{ 7077 if (!(globalCurrentInstanceSetters = getGlobalThis()[settersKey])) { 7078 globalCurrentInstanceSetters = getGlobalThis()[settersKey] = []; 7079 } 7080 globalCurrentInstanceSetters.push((i) => currentInstance = i); 7081 internalSetCurrentInstance = (instance) => { 7082 if (globalCurrentInstanceSetters.length > 1) { 7083 globalCurrentInstanceSetters.forEach((s2) => s2(instance)); 7084 } else { 7085 globalCurrentInstanceSetters[0](instance); 7086 } 7087 }; 7088} 7089const setCurrentInstance = (instance) => { 7090 internalSetCurrentInstance(instance); 7091 instance.scope.on(); 7092}; 7093const unsetCurrentInstance = () => { 7094 currentInstance && currentInstance.scope.off(); 7095 internalSetCurrentInstance(null); 7096}; 7097function isStatefulComponent(instance) { 7098 return instance.vnode.shapeFlag & 4; 7099} 7100let isInSSRComponentSetup = false; 7101function setupComponent(instance, isSSR = false) { 7102 isInSSRComponentSetup = isSSR; 7103 const { props, children } = instance.vnode; 7104 const isStateful = isStatefulComponent(instance); 7105 initProps(instance, props, isStateful, isSSR); 7106 initSlots(instance, children); 7107 const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; 7108 isInSSRComponentSetup = false;
7109 return setupResult; 7110} 7111function setupStatefulComponent(instance, isSSR) { 7112 const Component = instance.type; 7113 instance.accessCache = /* @__PURE__ */ Object.create(null); 7114 instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers)); 7115 const { setup } = Component; 7116 if (setup) { 7117 const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null; 7118 setCurrentInstance(instance); 7119 pauseTracking(); 7120 const setupResult = callWithErrorHandling( 7121 setup, 7122 instance, 7123 0, 7124 [instance.props, setupContext] 7125 ); 7126 resetTracking(); 7127 unsetCurrentInstance(); 7128 if (isPromise(setupResult)) { 7129 setupResult.then(unsetCurrentInstance, unsetCurrentInstance); 7130 if (isSSR) { 7131 return setupResult.then((resolvedResult) => { 7132 handleSetupResult(instance, resolvedResult, isSSR); 7133 }).catch((e) => { 7134 handleError(e, instance, 0); 7135 }); 7136 } else { 7137 instance.asyncDep = setupResult; 7138 } 7139 } else { 7140 handleSetupResult(instance, setupResult, isSSR); 7141 } 7142 } else { 7143 finishComponentSetup(instance, isSSR); 7144 } 7145} 7146function handleSetupResult(instance, setupResult, isSSR) { 7147 if (isFunction$4(setupResult)) { 7148 if (instance.type.__ssrInlineRender) { 7149 instance.ssrRender = setupResult; 7150 } else { 7151 instance.render = setupResult; 7152 } 7153 } else if (isObject$3(setupResult)) { 7154 instance.setupState = proxyRefs(setupResult); 7155 } else 7156 ; 7157 finishComponentSetup(instance, isSSR); 7158} 7159let compile; 7160let installWithProxy; 7161function registerRuntimeCompiler(_compile) { 7162 compile = _compile; 7163 installWithProxy = (i) => { 7164 if (i.render._rc) { 7165 i.withProxy = new Proxy(i.ctx, RuntimeCompiledPublicInstanceProxyHandlers); 7166 } 7167 }; 7168} 7169const isRuntimeOnly = () => !compile; 7170function finishComponentSetup(instance, isSSR, skipOptions) { 7171 const Component = instance.type; 7172 if (!instance.render) { 7173 if (!isSSR && compile && !Component.render) { 7174 const template = Component.template || resolveMergedOptions(instance).template; 7175 if (template) { 7176 const { isCustomElement, compilerOptions } = instance.appContext.config; 7177 const { delimiters, compilerOptions: componentCompilerOptions } = Component; 7178 const finalCompilerOptions = extend$1( 7179 extend$1( 7180 { 7181 isCustomElement, 7182 delimiters 7183 }, 7184 compilerOptions 7185 ), 7186 componentCompilerOptions 7187 ); 7188 Component.render = compile(template, finalCompilerOptions); 7189 } 7190 } 7191 instance.render = Component.render || NOOP; 7192 if (installWithProxy) { 7193 installWithProxy(instance); 7194 } 7195 } 7196 { 7197 setCurrentInstance(instance); 7198 pauseTracking(); 7199 applyOptions(instance); 7200 resetTracking(); 7201 unsetCurrentInstance(); 7202 } 7203} 7204function getAttrsProxy(instance) { 7205 return instance.attrsProxy || (instance.attrsProxy = new Proxy( 7206 instance.attrs, 7207 { 7208 get(target, key) { 7209 track(instance, "get", "$attrs"); 7210 return target[key]; 7211 } 7212 } 7213 )); 7214} 7215function createSetupContext(instance) { 7216 const expose = (exposed) => { 7217 instance.exposed = exposed || {}; 7218 }; 7219 { 7220 return { 7221 get attrs() { 7222 return getAttrsProxy(instance); 7223 }, 7224 slots: instance.slots, 7225 emit: instance.emit, 7226 expose 7227 }; 7228 } 7229} 7230function getExposeProxy(instance) { 7231 if (instance.exposed) { 7232 return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), { 7233 get(target, key) { 7234 if (key in target) { 7235 return target[key]; 7236 } else if (key in publicPropertiesMap) { 7237 return publicPropertiesMap[key](instance); 7238 } 7239 }, 7240 has(target, key) { 7241 return key in target || key in publicPropertiesMap; 7242 } 7243 })); 7244 } 7245} 7246function getComponentName(Component, includeInferred = true) { 7247 return isFunction$4(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name; 7248} 7249function isClassComponent(value) { 7250 return isFunction$4(value) && "__vccOpts" in value; 7251} 7252const computed = (getterOrOptions, debugOptions) => { 7253 return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup); 7254}; 7255function h(type4, propsOrChildren, children) { 7256 const l2 = arguments.length; 7257 if (l2 === 2) { 7258 if (isObject$3(propsOrChildren) && !isArray$5(propsOrChildren)) { 7259 if (isVNode(propsOrChildren)) { 7260 return createVNode(type4, null, [propsOrChildren]); 7261 } 7262 return createVNode(type4, propsOrChildren); 7263 } else { 7264 return createVNode(type4, null, propsOrChildren); 7265 } 7266 } else { 7267 if (l2 > 3) { 7268 children = Array.prototype.slice.call(arguments, 2); 7269 } else if (l2 === 3 && isVNode(children)) { 7270 children = [children]; 7271 } 7272 return createVNode(type4, propsOrChildren, children); 7273 } 7274} 7275const ssrContextKey$1 = Symbol.for("v-scx"); 7276const useSSRContext = () => { 7277 { 7278 const ctx2 = inject(ssrContextKey$1); 7279 return ctx2; 7280 } 7281}; 7282function initCustomFormatter() { 7283 { 7284 return; 7285 } 7286} 7287function withMemo(memo, render2, cache2, index) {
7288 const cached = cache2[index]; 7289 if (cached && isMemoSame(cached, memo)) { 7290 return cached; 7291 } 7292 const ret = render2(); 7293 ret.memo = memo.slice(); 7294 return cache2[index] = ret; 7295} 7296function isMemoSame(cached, memo) { 7297 const prev = cached.memo; 7298 if (prev.length != memo.length) { 7299 return false; 7300 } 7301 for (let i = 0; i < prev.length; i++) { 7302 if (hasChanged(prev[i], memo[i])) { 7303 return false; 7304 } 7305 } 7306 if (isBlockTreeEnabled > 0 && currentBlock) { 7307 currentBlock.push(cached); 7308 } 7309 return true; 7310} 7311const version$1 = "3.3.4"; 7312const _ssrUtils = { 7313 createComponentInstance, 7314 setupComponent, 7315 renderComponentRoot, 7316 setCurrentRenderingInstance, 7317 isVNode, 7318 normalizeVNode 7319}; 7320const ssrUtils = _ssrUtils; 7321const resolveFilter = null; 7322const compatUtils = null; 7323const svgNS = "http://www.w3.org/2000/svg"; 7324const doc = typeof document !== "undefined" ? document : null; 7325const templateContainer = doc && /* @__PURE__ */ doc.createElement("template"); 7326const nodeOps = { 7327 insert: (child, parent, anchor) => { 7328 parent.insertBefore(child, anchor || null); 7329 }, 7330 remove: (child) => { 7331 const parent = child.parentNode; 7332 if (parent) { 7333 parent.removeChild(child); 7334 } 7335 }, 7336 createElement: (tag, isSVG2, is, props) => { 7337 const el = isSVG2 ? doc.createElementNS(svgNS, tag) : doc.createElement(tag, is ? { is } : void 0); 7338 if (tag === "select" && props && props.multiple != null) { 7339 el.setAttribute("multiple", props.multiple); 7340 } 7341 return el; 7342 }, 7343 createText: (text) => doc.createTextNode(text), 7344 createComment: (text) => doc.createComment(text), 7345 setText: (node, text) => { 7346 node.nodeValue = text; 7347 }, 7348 setElementText: (el, text) => { 7349 el.textContent = text; 7350 }, 7351 parentNode: (node) => node.parentNode, 7352 nextSibling: (node) => node.nextSibling, 7353 querySelector: (selector) => doc.querySelector(selector), 7354 setScopeId(el, id) { 7355 el.setAttribute(id, ""); 7356 }, 7357 // __UNSAFE__ 7358 // Reason: innerHTML. 7359 // Static content here can only come from compiled templates. 7360 // As long as the user only uses trusted templates, this is safe. 7361 insertStaticContent(content, parent, anchor, isSVG2, start, end) { 7362 const before = anchor ? anchor.previousSibling : parent.lastChild; 7363 if (start && (start === end || start.nextSibling)) { 7364 while (true) { 7365 parent.insertBefore(start.cloneNode(true), anchor); 7366 if (start === end || !(start = start.nextSibling)) 7367 break; 7368 } 7369 } else { 7370 templateContainer.innerHTML = isSVG2 ? `<svg>${content}</svg>` : content; 7371 const template = templateContainer.content; 7372 if (isSVG2) { 7373 const wrapper = template.firstChild; 7374 while (wrapper.firstChild) { 7375 template.appendChild(wrapper.firstChild); 7376 } 7377 template.removeChild(wrapper); 7378 } 7379 parent.insertBefore(template, anchor); 7380 } 7381 return [ 7382 // first 7383 before ? before.nextSibling : parent.firstChild, 7384 // last 7385 anchor ? anchor.previousSibling : parent.lastChild 7386 ]; 7387 } 7388}; 7389function patchClass(el, value, isSVG2) { 7390 const transitionClasses = el._vtc; 7391 if (transitionClasses) { 7392 value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" "); 7393 } 7394 if (value == null) { 7395 el.removeAttribute("class"); 7396 } else if (isSVG2) { 7397 el.setAttribute("class", value); 7398 } else { 7399 el.className = value; 7400 } 7401} 7402function patchStyle(el, prev, next) { 7403 const style2 = el.style; 7404 const isCssString = isString$3(next); 7405 if (next && !isCssString) { 7406 if (prev && !isString$3(prev)) { 7407 for (const key in prev) { 7408 if (next[key] == null) { 7409 setStyle(style2, key, ""); 7410 } 7411 } 7412 } 7413 for (const key in next) { 7414 setStyle(style2, key, next[key]); 7415 } 7416 } else { 7417 const currentDisplay = style2.display; 7418 if (isCssString) { 7419 if (prev !== next) { 7420 style2.cssText = next; 7421 } 7422 } else if (prev) { 7423 el.removeAttribute("style"); 7424 } 7425 if ("_vod" in el) { 7426 style2.display = currentDisplay; 7427 } 7428 } 7429} 7430const importantRE = /\s*!important$/; 7431function setStyle(style2, name, val) { 7432 if (isArray$5(val)) { 7433 val.forEach((v) => setStyle(style2, name, v)); 7434 } else { 7435 if (val == null) 7436 val = ""; 7437 if (name.startsWith("--")) { 7438 style2.setProperty(name, val); 7439 } else { 7440 const prefixed = autoPrefix(style2, name); 7441 if (importantRE.test(val)) { 7442 style2.setProperty( 7443 hyphenate(prefixed), 7444 val.replace(importantRE, ""), 7445 "important" 7446 ); 7447 } else { 7448 style2[prefixed] = val; 7449 } 7450 } 7451 } 7452} 7453const prefixes = ["Webkit", "Moz", "ms"]; 7454const prefixCache = {}; 7455function autoPrefix(style2, rawName) { 7456 const cached = prefixCache[rawName]; 7457 if (cached) { 7458 return cached; 7459 } 7460 let name = camelize(rawName); 7461 if (name !== "filter" && name in style2) { 7462 return prefixCache[rawName] = name; 7463 } 7464 name = capitalize(name); 7465 for (let i = 0; i < prefixes.length; i++) { 7466 const prefixed = prefixes[i] + name; 7467 if (prefixed in style2) { 7468 return prefixCache[rawName] = prefixed; 7469 } 7470 } 7471 return rawName; 7472} 7473const xlinkNS = "http://www.w3.org/1999/xlink"; 7474function patchAttr(el, key, value, isSVG2, instance) { 7475 if (isSVG2 && key.startsWith("xlink:")) { 7476 if (value == null) { 7477 el.removeAttributeNS(xlinkNS, key.slice(6, key.length)); 7478 } else { 7479 el.setAttributeNS(xlinkNS, key, value); 7480 } 7481 } else { 7482 const isBoolean = isSpecialBooleanAttr(key); 7483 if (value == null || isBoolean && !includeBooleanAttr(value)) { 7484 el.removeAttribute(key); 7485 } else { 7486 el.setAttribute(key, isBoolean ? "" : value); 7487 } 7488 } 7489} 7490function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) { 7491 if (key === "innerHTML" || key === "textContent") { 7492 if (prevChildren) { 7493 unmountChildren(prevChildren, parentComponent, parentSuspense); 7494 } 7495 el[key] = value == null ? "" : value; 7496 return; 7497 } 7498 const tag = el.tagName; 7499 if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally 7500 !tag.includes("-")) { 7501 el._value = value; 7502 const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value; 7503 const newValue = value == null ? "" : value; 7504 if (oldValue !== newValue) { 7505 el.value = newValue; 7506 } 7507 if (value == null) { 7508 el.removeAttribute(key); 7509 } 7510 return; 7511 } 7512 let needRemove = false;
vendor: 4,120 bytes, lines 7513-7652
7513 if (value === "" || value == null) { 7514 const type4 = typeof el[key]; 7515 if (type4 === "boolean") { 7516 value = includeBooleanAttr(value); 7517 } else if (value == null && type4 === "string") { 7518 value = ""; 7519 needRemove = true; 7520 } else if (type4 === "number") { 7521 value = 0; 7522 needRemove = true; 7523 } 7524 } 7525 try { 7526 el[key] = value; 7527 } catch (e) { 7528 } 7529 needRemove && el.removeAttribute(key); 7530} 7531function addEventListener(el, event, handler, options) { 7532 el.addEventListener(event, handler, options); 7533} 7534function removeEventListener(el, event, handler, options) { 7535 el.removeEventListener(event, handler, options); 7536} 7537function patchEvent(el, rawName, prevValue, nextValue, instance = null) { 7538 const invokers = el._vei || (el._vei = {}); 7539 const existingInvoker = invokers[rawName]; 7540 if (nextValue && existingInvoker) { 7541 existingInvoker.value = nextValue; 7542 } else { 7543 const [name, options] = parseName(rawName); 7544 if (nextValue) { 7545 const invoker = invokers[rawName] = createInvoker(nextValue, instance); 7546 addEventListener(el, name, invoker, options); 7547 } else if (existingInvoker) { 7548 removeEventListener(el, name, existingInvoker, options); 7549 invokers[rawName] = void 0; 7550 } 7551 } 7552} 7553const optionsModifierRE = /(?:Once|Passive|Capture)$/; 7554function parseName(name) { 7555 let options; 7556 if (optionsModifierRE.test(name)) { 7557 options = {}; 7558 let m; 7559 while (m = name.match(optionsModifierRE)) { 7560 name = name.slice(0, name.length - m[0].length); 7561 options[m[0].toLowerCase()] = true; 7562 } 7563 } 7564 const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)); 7565 return [event, options]; 7566} 7567let cachedNow = 0; 7568const p = /* @__PURE__ */ Promise.resolve(); 7569const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now()); 7570function createInvoker(initialValue, instance) { 7571 const invoker = (e) => { 7572 if (!e._vts) { 7573 e._vts = Date.now(); 7574 } else if (e._vts <= invoker.attached) { 7575 return; 7576 } 7577 callWithAsyncErrorHandling( 7578 patchStopImmediatePropagation(e, invoker.value), 7579 instance, 7580 5, 7581 [e] 7582 ); 7583 }; 7584 invoker.value = initialValue; 7585 invoker.attached = getNow(); 7586 return invoker; 7587} 7588function patchStopImmediatePropagation(e, value) { 7589 if (isArray$5(value)) { 7590 const originalStop = e.stopImmediatePropagation; 7591 e.stopImmediatePropagation = () => { 7592 originalStop.call(e); 7593 e._stopped = true; 7594 }; 7595 return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2)); 7596 } else { 7597 return value; 7598 } 7599} 7600const nativeOnRE = /^on[a-z]/; 7601const patchProp = (el, key, prevValue, nextValue, isSVG2 = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => { 7602 if (key === "class") { 7603 patchClass(el, nextValue, isSVG2); 7604 } else if (key === "style") { 7605 patchStyle(el, prevValue, nextValue); 7606 } else if (isOn(key)) { 7607 if (!isModelListener(key)) { 7608 patchEvent(el, key, prevValue, nextValue, parentComponent); 7609 } 7610 } else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG2)) { 7611 patchDOMProp( 7612 el, 7613 key, 7614 nextValue, 7615 prevChildren, 7616 parentComponent, 7617 parentSuspense, 7618 unmountChildren 7619 ); 7620 } else { 7621 if (key === "true-value") { 7622 el._trueValue = nextValue; 7623 } else if (key === "false-value") { 7624 el._falseValue = nextValue; 7625 } 7626 patchAttr(el, key, nextValue, isSVG2); 7627 } 7628}; 7629function shouldSetAsProp(el, key, value, isSVG2) { 7630 if (isSVG2) { 7631 if (key === "innerHTML" || key === "textContent") { 7632 return true; 7633 } 7634 if (key in el && nativeOnRE.test(key) && isFunction$4(value)) { 7635 return true; 7636 } 7637 return false; 7638 } 7639 if (key === "spellcheck" || key === "draggable" || key === "translate") { 7640 return false; 7641 } 7642 if (key === "form") { 7643 return false; 7644 } 7645 if (key === "list" && el.tagName === "INPUT") { 7646 return false; 7647 } 7648 if (key === "type" && el.tagName === "TEXTAREA") { 7649 return false; 7650 } 7651 if (nativeOnRE.test(key) && isString$3(value)) { 7652 return false;
7653 } 7654 return key in el; 7655} 7656function defineCustomElement(options, hydrate2) { 7657 const Comp = defineComponent(options); 7658 class VueCustomElement extends VueElement { 7659 constructor(initialProps) { 7660 super(Comp, initialProps, hydrate2); 7661 } 7662 } 7663 VueCustomElement.def = Comp; 7664 return VueCustomElement; 7665} 7666const defineSSRCustomElement = (options) => { 7667 return defineCustomElement(options, hydrate); 7668}; 7669const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class { 7670}; 7671class VueElement extends BaseClass { 7672 constructor(_def, _props = {}, hydrate2) { 7673 super(); 7674 this._def = _def; 7675 this._props = _props; 7676 this._instance = null; 7677 this._connected = false; 7678 this._resolved = false; 7679 this._numberProps = null; 7680 if (this.shadowRoot && hydrate2) { 7681 hydrate2(this._createVNode(), this.shadowRoot); 7682 } else { 7683 this.attachShadow({ mode: "open" }); 7684 if (!this._def.__asyncLoader) { 7685 this._resolveProps(this._def); 7686 } 7687 } 7688 } 7689 connectedCallback() { 7690 this._connected = true; 7691 if (!this._instance) { 7692 if (this._resolved) { 7693 this._update(); 7694 } else { 7695 this._resolveDef(); 7696 } 7697 } 7698 } 7699 disconnectedCallback() { 7700 this._connected = false; 7701 nextTick(() => { 7702 if (!this._connected) { 7703 render$5(null, this.shadowRoot); 7704 this._instance = null; 7705 } 7706 }); 7707 } 7708 /** 7709 * resolve inner component definition (handle possible async component) 7710 */ 7711 _resolveDef() { 7712 this._resolved = true; 7713 for (let i = 0; i < this.attributes.length; i++) { 7714 this._setAttr(this.attributes[i].name); 7715 } 7716 new MutationObserver((mutations) => { 7717 for (const m of mutations) { 7718 this._setAttr(m.attributeName); 7719 } 7720 }).observe(this, { attributes: true }); 7721 const resolve2 = (def2, isAsync = false) => { 7722 const { props, styles: styles2 } = def2; 7723 let numberProps; 7724 if (props && !isArray$5(props)) { 7725 for (const key in props) { 7726 const opt = props[key]; 7727 if (opt === Number || opt && opt.type === Number) { 7728 if (key in this._props) { 7729 this._props[key] = toNumber(this._props[key]); 7730 } 7731 (numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true; 7732 } 7733 } 7734 } 7735 this._numberProps = numberProps; 7736 if (isAsync) { 7737 this._resolveProps(def2); 7738 } 7739 this._applyStyles(styles2); 7740 this._update(); 7741 }; 7742 const asyncDef = this._def.__asyncLoader; 7743 if (asyncDef) { 7744 asyncDef().then((def2) => resolve2(def2, true)); 7745 } else { 7746 resolve2(this._def); 7747 } 7748 } 7749 _resolveProps(def2) { 7750 const { props } = def2; 7751 const declaredPropKeys = isArray$5(props) ? props : Object.keys(props || {}); 7752 for (const key of Object.keys(this)) { 7753 if (key[0] !== "_" && declaredPropKeys.includes(key)) { 7754 this._setProp(key, this[key], true, false); 7755 } 7756 } 7757 for (const key of declaredPropKeys.map(camelize)) { 7758 Object.defineProperty(this, key, { 7759 get() { 7760 return this._getProp(key); 7761 }, 7762 set(val) { 7763 this._setProp(key, val); 7764 } 7765 }); 7766 } 7767 } 7768 _setAttr(key) { 7769 let value = this.getAttribute(key); 7770 const camelKey = camelize(key); 7771 if (this._numberProps && this._numberProps[camelKey]) { 7772 value = toNumber(value); 7773 } 7774 this._setProp(camelKey, value, false); 7775 } 7776 /** 7777 * @internal 7778 */ 7779 _getProp(key) { 7780 return this._props[key]; 7781 } 7782 /** 7783 * @internal 7784 */ 7785 _setProp(key, val, shouldReflect = true, shouldUpdate = true) { 7786 if (val !== this._props[key]) { 7787 this._props[key] = val; 7788 if (shouldUpdate && this._instance) { 7789 this._update(); 7790 } 7791 if (shouldReflect) { 7792 if (val === true) { 7793 this.setAttribute(hyphenate(key), ""); 7794 } else if (typeof val === "string" || typeof val === "number") { 7795 this.setAttribute(hyphenate(key), val + ""); 7796 } else if (!val) { 7797 this.removeAttribute(hyphenate(key)); 7798 } 7799 } 7800 } 7801 } 7802 _update() { 7803 render$5(this._createVNode(), this.shadowRoot); 7804 } 7805 _createVNode() { 7806 const vnode = createVNode(this._def, extend$1({}, this._props)); 7807 if (!this._instance) { 7808 vnode.ce = (instance) => { 7809 this._instance = instance; 7810 instance.isCE = true; 7811 const dispatch = (event, args) => { 7812 this.dispatchEvent( 7813 new CustomEvent(event, { 7814 detail: args 7815 }) 7816 ); 7817 }; 7818 instance.emit = (event, ...args) => { 7819 dispatch(event, args); 7820 if (hyphenate(event) !== event) { 7821 dispatch(hyphenate(event), args); 7822 } 7823 }; 7824 let parent = this; 7825 while (parent = parent && (parent.parentNode || parent.host)) { 7826 if (parent instanceof VueElement) { 7827 instance.parent = parent._instance; 7828 instance.provides = parent._instance.provides; 7829 break; 7830 } 7831 } 7832 }; 7833 } 7834 return vnode; 7835 } 7836 _applyStyles(styles2) { 7837 if (styles2) { 7838 styles2.forEach((css) => { 7839 const s2 = document.createElement("style"); 7840 s2.textContent = css; 7841 this.shadowRoot.appendChild(s2); 7842 }); 7843 } 7844 } 7845} 7846function useCssModule(name = "$style") { 7847 { 7848 const instance = getCurrentInstance(); 7849 if (!instance) { 7850 return EMPTY_OBJ; 7851 } 7852 const modules = instance.type.__cssModules; 7853 if (!modules) { 7854 return EMPTY_OBJ; 7855 } 7856 const mod = modules[name]; 7857 if (!mod) { 7858 return EMPTY_OBJ; 7859 } 7860 return mod; 7861 } 7862} 7863function useCssVars(getter) { 7864 const instance = getCurrentInstance(); 7865 if (!instance) { 7866 return; 7867 } 7868 const updateTeleports = instance.ut = (vars = getter(instance.proxy)) => { 7869 Array.from( 7870 document.querySelectorAll(`[data-v-owner="${instance.uid}"]`) 7871 ).forEach((node) => setVarsOnNode(node, vars)); 7872 }; 7873 const setVars = () => { 7874 const vars = getter(instance.proxy); 7875 setVarsOnVNode(instance.subTree, vars); 7876 updateTeleports(vars); 7877 }; 7878 watchPostEffect(setVars); 7879 onMounted(() => { 7880 const ob = new MutationObserver(setVars); 7881 ob.observe(instance.subTree.el.parentNode, { childList: true }); 7882 onUnmounted(() => ob.disconnect()); 7883 }); 7884} 7885function setVarsOnVNode(vnode, vars) { 7886 if (vnode.shapeFlag & 128) { 7887 const suspense = vnode.suspense; 7888 vnode = suspense.activeBranch; 7889 if (suspense.pendingBranch && !suspense.isHydrating) { 7890 suspense.effects.push(() => { 7891 setVarsOnVNode(suspense.activeBranch, vars); 7892 }); 7893 } 7894 } 7895 while (vnode.component) { 7896 vnode = vnode.component.subTree; 7897 } 7898 if (vnode.shapeFlag & 1 && vnode.el) { 7899 setVarsOnNode(vnode.el, vars); 7900 } else if (vnode.type === Fragment) {
7901 vnode.children.forEach((c2) => setVarsOnVNode(c2, vars)); 7902 } else if (vnode.type === Static) { 7903 let { el, anchor } = vnode; 7904 while (el) { 7905 setVarsOnNode(el, vars); 7906 if (el === anchor) 7907 break; 7908 el = el.nextSibling; 7909 } 7910 } 7911} 7912function setVarsOnNode(el, vars) { 7913 if (el.nodeType === 1) { 7914 const style2 = el.style; 7915 for (const key in vars) { 7916 style2.setProperty(`--${key}`, vars[key]); 7917 } 7918 } 7919} 7920const TRANSITION = "transition"; 7921const ANIMATION = "animation"; 7922const Transition = (props, { slots }) => h(BaseTransition, resolveTransitionProps(props), slots); 7923Transition.displayName = "Transition"; 7924const DOMTransitionPropsValidators = { 7925 name: String, 7926 type: String, 7927 css: { 7928 type: Boolean, 7929 default: true 7930 }, 7931 duration: [String, Number, Object], 7932 enterFromClass: String, 7933 enterActiveClass: String, 7934 enterToClass: String, 7935 appearFromClass: String, 7936 appearActiveClass: String, 7937 appearToClass: String, 7938 leaveFromClass: String, 7939 leaveActiveClass: String, 7940 leaveToClass: String 7941}; 7942const TransitionPropsValidators = Transition.props = /* @__PURE__ */ extend$1( 7943 {}, 7944 BaseTransitionPropsValidators, 7945 DOMTransitionPropsValidators 7946); 7947const callHook = (hook, args = []) => { 7948 if (isArray$5(hook)) { 7949 hook.forEach((h2) => h2(...args)); 7950 } else if (hook) { 7951 hook(...args); 7952 } 7953}; 7954const hasExplicitCallback = (hook) => { 7955 return hook ? isArray$5(hook) ? hook.some((h2) => h2.length > 1) : hook.length > 1 : false; 7956}; 7957function resolveTransitionProps(rawProps) { 7958 const baseProps = {}; 7959 for (const key in rawProps) { 7960 if (!(key in DOMTransitionPropsValidators)) { 7961 baseProps[key] = rawProps[key]; 7962 } 7963 } 7964 if (rawProps.css === false) { 7965 return baseProps; 7966 } 7967 const { 7968 name = "v", 7969 type: type4, 7970 duration: duration2, 7971 enterFromClass = `${name}-enter-from`, 7972 enterActiveClass = `${name}-enter-active`, 7973 enterToClass = `${name}-enter-to`, 7974 appearFromClass = enterFromClass, 7975 appearActiveClass = enterActiveClass, 7976 appearToClass = enterToClass, 7977 leaveFromClass = `${name}-leave-from`, 7978 leaveActiveClass = `${name}-leave-active`, 7979 leaveToClass = `${name}-leave-to` 7980 } = rawProps; 7981 const durations = normalizeDuration(duration2); 7982 const enterDuration = durations && durations[0]; 7983 const leaveDuration = durations && durations[1]; 7984 const { 7985 onBeforeEnter, 7986 onEnter, 7987 onEnterCancelled, 7988 onLeave, 7989 onLeaveCancelled, 7990 onBeforeAppear = onBeforeEnter, 7991 onAppear = onEnter, 7992 onAppearCancelled = onEnterCancelled 7993 } = baseProps; 7994 const finishEnter = (el, isAppear, done) => { 7995 removeTransitionClass(el, isAppear ? appearToClass : enterToClass); 7996 removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass); 7997 done && done(); 7998 }; 7999 const finishLeave = (el, done) => { 8000 el._isLeaving = false; 8001 removeTransitionClass(el, leaveFromClass); 8002 removeTransitionClass(el, leaveToClass); 8003 removeTransitionClass(el, leaveActiveClass); 8004 done && done(); 8005 }; 8006 const makeEnterHook = (isAppear) => { 8007 return (el, done) => { 8008 const hook = isAppear ? onAppear : onEnter; 8009 const resolve2 = () => finishEnter(el, isAppear, done); 8010 callHook(hook, [el, resolve2]); 8011 nextFrame(() => { 8012 removeTransitionClass(el, isAppear ? appearFromClass : enterFromClass); 8013 addTransitionClass(el, isAppear ? appearToClass : enterToClass); 8014 if (!hasExplicitCallback(hook)) { 8015 whenTransitionEnds(el, type4, enterDuration, resolve2); 8016 } 8017 }); 8018 }; 8019 }; 8020 return extend$1(baseProps, { 8021 onBeforeEnter(el) { 8022 callHook(onBeforeEnter, [el]); 8023 addTransitionClass(el, enterFromClass); 8024 addTransitionClass(el, enterActiveClass); 8025 }, 8026 onBeforeAppear(el) { 8027 callHook(onBeforeAppear, [el]); 8028 addTransitionClass(el, appearFromClass); 8029 addTransitionClass(el, appearActiveClass); 8030 }, 8031 onEnter: makeEnterHook(false), 8032 onAppear: makeEnterHook(true), 8033 onLeave(el, done) { 8034 el._isLeaving = true; 8035 const resolve2 = () => finishLeave(el, done); 8036 addTransitionClass(el, leaveFromClass); 8037 forceReflow(); 8038 addTransitionClass(el, leaveActiveClass); 8039 nextFrame(() => { 8040 if (!el._isLeaving) { 8041 return; 8042 } 8043 removeTransitionClass(el, leaveFromClass); 8044 addTransitionClass(el, leaveToClass); 8045 if (!hasExplicitCallback(onLeave)) { 8046 whenTransitionEnds(el, type4, leaveDuration, resolve2); 8047 } 8048 }); 8049 callHook(onLeave, [el, resolve2]); 8050 }, 8051 onEnterCancelled(el) { 8052 finishEnter(el, false); 8053 callHook(onEnterCancelled, [el]); 8054 }, 8055 onAppearCancelled(el) { 8056 finishEnter(el, true); 8057 callHook(onAppearCancelled, [el]); 8058 }, 8059 onLeaveCancelled(el) { 8060 finishLeave(el); 8061 callHook(onLeaveCancelled, [el]); 8062 } 8063 }); 8064} 8065function normalizeDuration(duration2) { 8066 if (duration2 == null) { 8067 return null; 8068 } else if (isObject$3(duration2)) { 8069 return [NumberOf(duration2.enter), NumberOf(duration2.leave)]; 8070 } else { 8071 const n2 = NumberOf(duration2); 8072 return [n2, n2]; 8073 } 8074} 8075function NumberOf(val) { 8076 const res = toNumber(val); 8077 return res; 8078} 8079function addTransitionClass(el, cls) {
8080 cls.split(/\s+/).forEach((c2) => c2 && el.classList.add(c2)); 8081 (el._vtc || (el._vtc = /* @__PURE__ */ new Set())).add(cls); 8082} 8083function removeTransitionClass(el, cls) { 8084 cls.split(/\s+/).forEach((c2) => c2 && el.classList.remove(c2)); 8085 const { _vtc } = el; 8086 if (_vtc) { 8087 _vtc.delete(cls); 8088 if (!_vtc.size) { 8089 el._vtc = void 0; 8090 } 8091 } 8092} 8093function nextFrame(cb) { 8094 requestAnimationFrame(() => { 8095 requestAnimationFrame(cb); 8096 }); 8097} 8098let endId = 0; 8099function whenTransitionEnds(el, expectedType, explicitTimeout, resolve2) { 8100 const id = el._endId = ++endId; 8101 const resolveIfNotStale = () => { 8102 if (id === el._endId) { 8103 resolve2(); 8104 } 8105 }; 8106 if (explicitTimeout) { 8107 return setTimeout(resolveIfNotStale, explicitTimeout); 8108 } 8109 const { type: type4, timeout, propCount } = getTransitionInfo(el, expectedType); 8110 if (!type4) { 8111 return resolve2(); 8112 } 8113 const endEvent = type4 + "end"; 8114 let ended = 0; 8115 const end = () => { 8116 el.removeEventListener(endEvent, onEnd); 8117 resolveIfNotStale(); 8118 }; 8119 const onEnd = (e) => { 8120 if (e.target === el && ++ended >= propCount) { 8121 end(); 8122 } 8123 }; 8124 setTimeout(() => { 8125 if (ended < propCount) { 8126 end(); 8127 } 8128 }, timeout + 1); 8129 el.addEventListener(endEvent, onEnd); 8130} 8131function getTransitionInfo(el, expectedType) { 8132 const styles2 = window.getComputedStyle(el); 8133 const getStyleProperties = (key) => (styles2[key] || "").split(", "); 8134 const transitionDelays = getStyleProperties(`${TRANSITION}Delay`); 8135 const transitionDurations = getStyleProperties(`${TRANSITION}Duration`); 8136 const transitionTimeout = getTimeout(transitionDelays, transitionDurations); 8137 const animationDelays = getStyleProperties(`${ANIMATION}Delay`); 8138 const animationDurations = getStyleProperties(`${ANIMATION}Duration`); 8139 const animationTimeout = getTimeout(animationDelays, animationDurations); 8140 let type4 = null; 8141 let timeout = 0; 8142 let propCount = 0; 8143 if (expectedType === TRANSITION) { 8144 if (transitionTimeout > 0) { 8145 type4 = TRANSITION; 8146 timeout = transitionTimeout; 8147 propCount = transitionDurations.length; 8148 } 8149 } else if (expectedType === ANIMATION) { 8150 if (animationTimeout > 0) { 8151 type4 = ANIMATION; 8152 timeout = animationTimeout; 8153 propCount = animationDurations.length; 8154 } 8155 } else { 8156 timeout = Math.max(transitionTimeout, animationTimeout); 8157 type4 = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null; 8158 propCount = type4 ? type4 === TRANSITION ? transitionDurations.length : animationDurations.length : 0; 8159 } 8160 const hasTransform = type4 === TRANSITION && /\b(transform|all)(,|$)/.test( 8161 getStyleProperties(`${TRANSITION}Property`).toString() 8162 ); 8163 return { 8164 type: type4, 8165 timeout, 8166 propCount, 8167 hasTransform 8168 }; 8169} 8170function getTimeout(delays, durations) { 8171 while (delays.length < durations.length) { 8172 delays = delays.concat(delays); 8173 } 8174 return Math.max(...durations.map((d, i) => toMs(d) + toMs(delays[i]))); 8175} 8176function toMs(s2) { 8177 return Number(s2.slice(0, -1).replace(",", ".")) * 1e3; 8178} 8179function forceReflow() { 8180 return document.body.offsetHeight; 8181} 8182const positionMap = /* @__PURE__ */ new WeakMap(); 8183const newPositionMap = /* @__PURE__ */ new WeakMap(); 8184const TransitionGroupImpl = { 8185 name: "TransitionGroup", 8186 props: /* @__PURE__ */ extend$1({}, TransitionPropsValidators, { 8187 tag: String, 8188 moveClass: String 8189 }), 8190 setup(props, { slots }) { 8191 const instance = getCurrentInstance(); 8192 const state = useTransitionState(); 8193 let prevChildren; 8194 let children; 8195 onUpdated(() => { 8196 if (!prevChildren.length) { 8197 return; 8198 } 8199 const moveClass = props.moveClass || `${props.name || "v"}-move`; 8200 if (!hasCSSTransform( 8201 prevChildren[0].el, 8202 instance.vnode.el, 8203 moveClass 8204 )) { 8205 return; 8206 } 8207 prevChildren.forEach(callPendingCbs); 8208 prevChildren.forEach(recordPosition); 8209 const movedChildren = prevChildren.filter(applyTranslation); 8210 forceReflow(); 8211 movedChildren.forEach((c2) => { 8212 const el = c2.el; 8213 const style2 = el.style; 8214 addTransitionClass(el, moveClass); 8215 style2.transform = style2.webkitTransform = style2.transitionDuration = ""; 8216 const cb = el._moveCb = (e) => { 8217 if (e && e.target !== el) { 8218 return; 8219 } 8220 if (!e || /transform$/.test(e.propertyName)) { 8221 el.removeEventListener("transitionend", cb); 8222 el._moveCb = null; 8223 removeTransitionClass(el, moveClass); 8224 } 8225 }; 8226 el.addEventListener("transitionend", cb); 8227 }); 8228 }); 8229 return () => { 8230 const rawProps = toRaw(props); 8231 const cssTransitionProps = resolveTransitionProps(rawProps); 8232 let tag = rawProps.tag || Fragment; 8233 prevChildren = children; 8234 children = slots.default ? getTransitionRawChildren(slots.default()) : []; 8235 for (let i = 0; i < children.length; i++) { 8236 const child = children[i]; 8237 if (child.key != null) { 8238 setTransitionHooks( 8239 child, 8240 resolveTransitionHooks(child, cssTransitionProps, state, instance) 8241 ); 8242 } 8243 } 8244 if (prevChildren) { 8245 for (let i = 0; i < prevChildren.length; i++) { 8246 const child = prevChildren[i]; 8247 setTransitionHooks( 8248 child, 8249 resolveTransitionHooks(child, cssTransitionProps, state, instance) 8250 ); 8251 positionMap.set(child, child.el.getBoundingClientRect()); 8252 } 8253 } 8254 return createVNode(tag, null, children); 8255 }; 8256 } 8257}; 8258const removeMode = (props) => delete props.mode; 8259/* @__PURE__ */ removeMode(TransitionGroupImpl.props); 8260const TransitionGroup = TransitionGroupImpl; 8261function callPendingCbs(c2) { 8262 const el = c2.el; 8263 if (el._moveCb) { 8264 el._moveCb(); 8265 } 8266 if (el._enterCb) { 8267 el._enterCb(); 8268 } 8269} 8270function recordPosition(c2) { 8271 newPositionMap.set(c2, c2.el.getBoundingClientRect()); 8272} 8273function applyTranslation(c2) { 8274 const oldPos = positionMap.get(c2); 8275 const newPos = newPositionMap.get(c2); 8276 const dx = oldPos.left - newPos.left; 8277 const dy = oldPos.top - newPos.top; 8278 if (dx || dy) { 8279 const s2 = c2.el.style; 8280 s2.transform = s2.webkitTransform = `translate(${dx}px,${dy}px)`; 8281 s2.transitionDuration = "0s"; 8282 return c2; 8283 } 8284} 8285function hasCSSTransform(el, root2, moveClass) { 8286 const clone2 = el.cloneNode(); 8287 if (el._vtc) {
8288 el._vtc.forEach((cls) => { 8289 cls.split(/\s+/).forEach((c2) => c2 && clone2.classList.remove(c2)); 8290 }); 8291 } 8292 moveClass.split(/\s+/).forEach((c2) => c2 && clone2.classList.add(c2)); 8293 clone2.style.display = "none"; 8294 const container = root2.nodeType === 1 ? root2 : root2.parentNode; 8295 container.appendChild(clone2); 8296 const { hasTransform } = getTransitionInfo(clone2); 8297 container.removeChild(clone2); 8298 return hasTransform; 8299} 8300const getModelAssigner = (vnode) => { 8301 const fn = vnode.props["onUpdate:modelValue"] || false; 8302 return isArray$5(fn) ? (value) => invokeArrayFns(fn, value) : fn; 8303}; 8304function onCompositionStart(e) { 8305 e.target.composing = true; 8306} 8307function onCompositionEnd(e) { 8308 const target = e.target; 8309 if (target.composing) { 8310 target.composing = false; 8311 target.dispatchEvent(new Event("input")); 8312 } 8313} 8314const vModelText = { 8315 created(el, { modifiers: { lazy, trim: trim2, number: number4 } }, vnode) { 8316 el._assign = getModelAssigner(vnode); 8317 const castToNumber = number4 || vnode.props && vnode.props.type === "number"; 8318 addEventListener(el, lazy ? "change" : "input", (e) => { 8319 if (e.target.composing) 8320 return; 8321 let domValue = el.value; 8322 if (trim2) { 8323 domValue = domValue.trim(); 8324 } 8325 if (castToNumber) { 8326 domValue = looseToNumber(domValue); 8327 } 8328 el._assign(domValue); 8329 }); 8330 if (trim2) { 8331 addEventListener(el, "change", () => { 8332 el.value = el.value.trim(); 8333 }); 8334 } 8335 if (!lazy) { 8336 addEventListener(el, "compositionstart", onCompositionStart); 8337 addEventListener(el, "compositionend", onCompositionEnd); 8338 addEventListener(el, "change", onCompositionEnd); 8339 } 8340 }, 8341 // set value on mounted so it's after min/max for type="range" 8342 mounted(el, { value }) { 8343 el.value = value == null ? "" : value; 8344 }, 8345 beforeUpdate(el, { value, modifiers: { lazy, trim: trim2, number: number4 } }, vnode) { 8346 el._assign = getModelAssigner(vnode); 8347 if (el.composing) 8348 return; 8349 if (document.activeElement === el && el.type !== "range") { 8350 if (lazy) { 8351 return; 8352 } 8353 if (trim2 && el.value.trim() === value) { 8354 return; 8355 } 8356 if ((number4 || el.type === "number") && looseToNumber(el.value) === value) { 8357 return; 8358 } 8359 } 8360 const newValue = value == null ? "" : value; 8361 if (el.value !== newValue) { 8362 el.value = newValue; 8363 } 8364 } 8365}; 8366const vModelCheckbox = { 8367 // #4096 array checkboxes need to be deep traversed 8368 deep: true, 8369 created(el, _, vnode) { 8370 el._assign = getModelAssigner(vnode); 8371 addEventListener(el, "change", () => { 8372 const modelValue = el._modelValue; 8373 const elementValue = getValue$3(el); 8374 const checked = el.checked; 8375 const assign = el._assign; 8376 if (isArray$5(modelValue)) { 8377 const index = looseIndexOf(modelValue, elementValue); 8378 const found = index !== -1; 8379 if (checked && !found) { 8380 assign(modelValue.concat(elementValue)); 8381 } else if (!checked && found) { 8382 const filtered = [...modelValue]; 8383 filtered.splice(index, 1); 8384 assign(filtered); 8385 } 8386 } else if (isSet$2(modelValue)) { 8387 const cloned = new Set(modelValue); 8388 if (checked) { 8389 cloned.add(elementValue); 8390 } else { 8391 cloned.delete(elementValue); 8392 } 8393 assign(cloned); 8394 } else { 8395 assign(getCheckboxValue(el, checked)); 8396 } 8397 }); 8398 }, 8399 // set initial checked on mount to wait for true-value/false-value 8400 mounted: setChecked, 8401 beforeUpdate(el, binding, vnode) { 8402 el._assign = getModelAssigner(vnode); 8403 setChecked(el, binding, vnode); 8404 } 8405}; 8406function setChecked(el, { value, oldValue }, vnode) { 8407 el._modelValue = value; 8408 if (isArray$5(value)) { 8409 el.checked = looseIndexOf(value, vnode.props.value) > -1; 8410 } else if (isSet$2(value)) { 8411 el.checked = value.has(vnode.props.value); 8412 } else if (value !== oldValue) { 8413 el.checked = looseEqual(value, getCheckboxValue(el, true)); 8414 } 8415} 8416const vModelRadio = { 8417 created(el, { value }, vnode) { 8418 el.checked = looseEqual(value, vnode.props.value); 8419 el._assign = getModelAssigner(vnode); 8420 addEventListener(el, "change", () => { 8421 el._assign(getValue$3(el)); 8422 }); 8423 }, 8424 beforeUpdate(el, { value, oldValue }, vnode) { 8425 el._assign = getModelAssigner(vnode); 8426 if (value !== oldValue) { 8427 el.checked = looseEqual(value, vnode.props.value); 8428 } 8429 } 8430}; 8431const vModelSelect = { 8432 // <select multiple> value need to be deep traversed 8433 deep: true, 8434 created(el, { value, modifiers: { number: number4 } }, vnode) { 8435 const isSetModel = isSet$2(value); 8436 addEventListener(el, "change", () => { 8437 const selectedVal = Array.prototype.filter.call(el.options, (o) => o.selected).map( 8438 (o) => number4 ? looseToNumber(getValue$3(o)) : getValue$3(o) 8439 ); 8440 el._assign( 8441 el.multiple ? isSetModel ? new Set(selectedVal) : selectedVal : selectedVal[0] 8442 ); 8443 }); 8444 el._assign = getModelAssigner(vnode); 8445 }, 8446 // set value in mounted & updated because <select> relies on its children 8447 // <option>s. 8448 mounted(el, { value }) { 8449 setSelected(el, value); 8450 }, 8451 beforeUpdate(el, _binding, vnode) { 8452 el._assign = getModelAssigner(vnode); 8453 }, 8454 updated(el, { value }) { 8455 setSelected(el, value); 8456 } 8457}; 8458function setSelected(el, value) { 8459 const isMultiple = el.multiple; 8460 if (isMultiple && !isArray$5(value) && !isSet$2(value)) { 8461 return; 8462 } 8463 for (let i = 0, l2 = el.options.length; i < l2; i++) { 8464 const option = el.options[i]; 8465 const optionValue = getValue$3(option); 8466 if (isMultiple) { 8467 if (isArray$5(value)) { 8468 option.selected = looseIndexOf(value, optionValue) > -1; 8469 } else { 8470 option.selected = value.has(optionValue); 8471 } 8472 } else { 8473 if (looseEqual(getValue$3(option), value)) { 8474 if (el.selectedIndex !== i) 8475 el.selectedIndex = i; 8476 return; 8477 } 8478 } 8479 } 8480 if (!isMultiple && el.selectedIndex !== -1) { 8481 el.selectedIndex = -1; 8482 } 8483} 8484function getValue$3(el) { 8485 return "_value" in el ? el._value : el.value; 8486} 8487function getCheckboxValue(el, checked) { 8488 const key = checked ? "_trueValue" : "_falseValue"; 8489 return key in el ? el[key] : checked; 8490} 8491const vModelDynamic = { 8492 created(el, binding, vnode) { 8493 callModelHook(el, binding, vnode, null, "created"); 8494 }, 8495 mounted(el, binding, vnode) { 8496 callModelHook(el, binding, vnode, null, "mounted"); 8497 }, 8498 beforeUpdate(el, binding, vnode, prevVNode) { 8499 callModelHook(el, binding, vnode, prevVNode, "beforeUpdate"); 8500 }, 8501 updated(el, binding, vnode, prevVNode) { 8502 callModelHook(el, binding, vnode, prevVNode, "updated"); 8503 } 8504}; 8505function resolveDynamicModel(tagName, type4) { 8506 switch (tagName) { 8507 case "SELECT": 8508 return vModelSelect; 8509 case "TEXTAREA": 8510 return vModelText; 8511 default: 8512 switch (type4) { 8513 case "checkbox": 8514 return vModelCheckbox; 8515 case "radio": 8516 return vModelRadio; 8517 default: 8518 return vModelText; 8519 } 8520 } 8521} 8522function callModelHook(el, binding, vnode, prevVNode, hook) { 8523 const modelToUse = resolveDynamicModel( 8524 el.tagName, 8525 vnode.props && vnode.props.type 8526 ); 8527 const fn = modelToUse[hook]; 8528 fn && fn(el, binding, vnode, prevVNode); 8529} 8530function initVModelForSSR() { 8531 vModelText.getSSRProps = ({ value }) => ({ value }); 8532 vModelRadio.getSSRProps = ({ value }, vnode) => { 8533 if (vnode.props && looseEqual(vnode.props.value, value)) { 8534 return { checked: true }; 8535 } 8536 }; 8537 vModelCheckbox.getSSRProps = ({ value }, vnode) => { 8538 if (isArray$5(value)) { 8539 if (vnode.props && looseIndexOf(value, vnode.props.value) > -1) { 8540 return { checked: true }; 8541 } 8542 } else if (isSet$2(value)) { 8543 if (vnode.props && value.has(vnode.props.value)) { 8544 return { checked: true }; 8545 } 8546 } else if (value) { 8547 return { checked: true }; 8548 } 8549 }; 8550 vModelDynamic.getSSRProps = (binding, vnode) => { 8551 if (typeof vnode.type !== "string") { 8552 return; 8553 } 8554 const modelToUse = resolveDynamicModel( 8555 // resolveDynamicModel expects an uppercase tag name, but vnode.type is lowercase 8556 vnode.type.toUpperCase(), 8557 vnode.props && vnode.props.type 8558 ); 8559 if (modelToUse.getSSRProps) { 8560 return modelToUse.getSSRProps(binding, vnode); 8561 } 8562 }; 8563} 8564const systemModifiers = ["ctrl", "shift", "alt", "meta"]; 8565const modifierGuards = { 8566 stop: (e) => e.stopPropagation(), 8567 prevent: (e) => e.preventDefault(), 8568 self: (e) => e.target !== e.currentTarget, 8569 ctrl: (e) => !e.ctrlKey, 8570 shift: (e) => !e.shiftKey, 8571 alt: (e) => !e.altKey, 8572 meta: (e) => !e.metaKey, 8573 left: (e) => "button" in e && e.button !== 0, 8574 middle: (e) => "button" in e && e.button !== 1, 8575 right: (e) => "button" in e && e.button !== 2, 8576 exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m)) 8577}; 8578const withModifiers = (fn, modifiers) => { 8579 return (event, ...args) => { 8580 for (let i = 0; i < modifiers.length; i++) { 8581 const guard = modifierGuards[modifiers[i]]; 8582 if (guard && guard(event, modifiers)) 8583 return; 8584 } 8585 return fn(event, ...args); 8586 }; 8587}; 8588const keyNames = { 8589 esc: "escape", 8590 space: " ", 8591 up: "arrow-up", 8592 left: "arrow-left", 8593 right: "arrow-right", 8594 down: "arrow-down", 8595 delete: "backspace" 8596}; 8597const withKeys = (fn, modifiers) => { 8598 return (event) => { 8599 if (!("key" in event)) { 8600 return; 8601 } 8602 const eventKey = hyphenate(event.key); 8603 if (modifiers.some((k) =>
8603 k === eventKey || keyNames[k] === eventKey)) { 8604 return fn(event); 8605 } 8606 }; 8607}; 8608const vShow = { 8609 beforeMount(el, { value }, { transition }) { 8610 el._vod = el.style.display === "none" ? "" : el.style.display; 8611 if (transition && value) { 8612 transition.beforeEnter(el); 8613 } else { 8614 setDisplay(el, value); 8615 } 8616 }, 8617 mounted(el, { value }, { transition }) { 8618 if (transition && value) { 8619 transition.enter(el); 8620 } 8621 }, 8622 updated(el, { value, oldValue }, { transition }) { 8623 if (!value === !oldValue) 8624 return; 8625 if (transition) { 8626 if (value) { 8627 transition.beforeEnter(el); 8628 setDisplay(el, true); 8629 transition.enter(el); 8630 } else { 8631 transition.leave(el, () => { 8632 setDisplay(el, false); 8633 }); 8634 } 8635 } else { 8636 setDisplay(el, value); 8637 } 8638 }, 8639 beforeUnmount(el, { value }) { 8640 setDisplay(el, value); 8641 } 8642}; 8643function setDisplay(el, value) { 8644 el.style.display = value ? el._vod : "none"; 8645} 8646function initVShowForSSR() { 8647 vShow.getSSRProps = ({ value }) => { 8648 if (!value) { 8649 return { style: { display: "none" } }; 8650 } 8651 }; 8652} 8653const rendererOptions = /* @__PURE__ */ extend$1({ patchProp }, nodeOps); 8654let renderer; 8655let enabledHydration = false; 8656function ensureRenderer() { 8657 return renderer || (renderer = createRenderer(rendererOptions)); 8658} 8659function ensureHydrationRenderer() { 8660 renderer = enabledHydration ? renderer : createHydrationRenderer(rendererOptions); 8661 enabledHydration = true; 8662 return renderer; 8663} 8664const render$5 = (...args) => { 8665 ensureRenderer().render(...args); 8666}; 8667const hydrate = (...args) => { 8668 ensureHydrationRenderer().hydrate(...args); 8669}; 8670const createApp = (...args) => { 8671 const app = ensureRenderer().createApp(...args); 8672 const { mount: mount2 } = app; 8673 app.mount = (containerOrSelector) => { 8674 const container = normalizeContainer(containerOrSelector); 8675 if (!container) 8676 return; 8677 const component = app._component; 8678 if (!isFunction$4(component) && !component.render && !component.template) { 8679 component.template = container.innerHTML; 8680 } 8681 container.innerHTML = ""; 8682 const proxy = mount2(container, false, container instanceof SVGElement); 8683 if (container instanceof Element) { 8684 container.removeAttribute("v-cloak"); 8685 container.setAttribute("data-v-app", ""); 8686 } 8687 return proxy; 8688 }; 8689 return app; 8690}; 8691const createSSRApp = (...args) => { 8692 const app = ensureHydrationRenderer().createApp(...args); 8693 const { mount: mount2 } = app; 8694 app.mount = (containerOrSelector) => { 8695 const container = normalizeContainer(containerOrSelector); 8696 if (container) { 8697 return mount2(container, true, container instanceof SVGElement); 8698 } 8699 }; 8700 return app; 8701}; 8702function normalizeContainer(container) { 8703 if (isString$3(container)) { 8704 const res = document.querySelector(container); 8705 return res; 8706 } 8707 return container; 8708} 8709let ssrDirectiveInitialized = false; 8710const initDirectivesForSSR = () => { 8711 if (!ssrDirectiveInitialized) { 8712 ssrDirectiveInitialized = true; 8713 initVModelForSSR(); 8714 initVShowForSSR(); 8715 } 8716}; 8717function warn$3(location, message) { 8718 console.error(`[naive/${location}]: ${message}`); 8719} 8720function throwError$1(location, message) { 8721 throw new Error(`[naive/${location}]: ${message}`); 8722} 8723function createInjectionKey$1(key) { 8724 return key; 8725} 8726function murmur2$1(str) { 8727 var h2 = 0; 8728 var k, i = 0, len2 = str.length; 8729 for (; len2 >= 4; ++i, len2 -= 4) { 8730 k = str.charCodeAt(i) & 255 | (str.charCodeAt(++i) & 255) << 8 | (str.charCodeAt(++i) & 255) << 16 | (str.charCodeAt(++i) & 255) << 24; 8731 k = /* Math.imul(k, m): */ 8732 (k & 65535) * 1540483477 + ((k >>> 16) * 59797 << 16); 8733 k ^= /* k >>> r: */ 8734 k >>> 24; 8735 h2 = /* Math.imul(k, m): */ 8736 (k & 65535) * 1540483477 + ((k >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */ 8737 (h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16); 8738 } 8739 switch (len2) { 8740 case 3: 8741 h2 ^= (str.charCodeAt(i + 2) & 255) << 16; 8742 case 2: 8743 h2 ^= (str.charCodeAt(i + 1) & 255) << 8; 8744 case 1: 8745 h2 ^= str.charCodeAt(i) & 255; 8746 h2 = /* Math.imul(h, m): */ 8747 (h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16); 8748 } 8749 h2 ^= h2 >>> 13; 8750 h2 = /* Math.imul(h, m): */ 8751 (h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16); 8752 return ((h2 ^ h2 >>> 15) >>> 0).toString(36); 8753} 8754function useMemo$1(getterOrOptions) { 8755 const computedValueRef = computed(getterOrOptions); 8756 const valueRef = ref(computedValueRef.value); 8757 watch(computedValueRef, (value) => { 8758 valueRef.value = value; 8759 }); 8760 if (typeof getterOrOptions === "function") { 8761 return valueRef; 8762 } else { 8763 return { 8764 __v_isRef: true, 8765 get value() { 8766 return valueRef.value; 8767 }, 8768 set value(v) { 8769 getterOrOptions.set(v); 8770 } 8771 }; 8772 } 8773} 8774var freeGlobal$2 = typeof global == "object" && global && global.Object === Object && global; 8775const freeGlobal$3 = freeGlobal$2; 8776var freeSelf$1 = typeof self == "object" && self && self.Object === Object && self; 8777var root$2 = freeGlobal$3 || freeSelf$1 || Function("return this")(); 8778const root$3 = root$2; 8779var Symbol$3 = root$3.Symbol; 8780const Symbol$4 = Symbol$3; 8781var objectProto$q = Object.prototype; 8782var hasOwnProperty$m = objectProto$q.hasOwnProperty; 8783var nativeObjectToString$3 = objectProto$q.toString; 8784var symToStringTag$3 = Symbol$4 ? Symbol$4.toStringTag : void 0; 8785function getRawTag$1(value) { 8786 var isOwn = hasOwnProperty$m.call(value, symToStringTag$3), tag = value[symToStringTag$3]; 8787 try { 8788 value[symToStringTag$3] = void 0; 8789 var unmasked = true; 8790 } catch (e) { 8791 } 8792 var result = nativeObjectToString$3.call(value); 8793 if (unmasked) { 8794 if (isOwn) { 8795 value[symToStringTag$3] = tag; 8796 } else { 8797 delete value[symToStringTag$3]; 8798 } 8799 } 8800 return result; 8801} 8802var objectProto$p = Object.prototype; 8803var nativeObjectToString$2 = objectProto$p.toString; 8804function objectToString$1(value) { 8805 return nativeObjectToString$2.call(value); 8806} 8807var nullTag$1 = "[object Null]", undefinedTag$1 = "[object Undef
8807ined]"; 8808var symToStringTag$2 = Symbol$4 ? Symbol$4.toStringTag : void 0; 8809function baseGetTag$1(value) { 8810 if (value == null) { 8811 return value === void 0 ? undefinedTag$1 : nullTag$1; 8812 } 8813 return symToStringTag$2 && symToStringTag$2 in Object(value) ? getRawTag$1(value) : objectToString$1(value); 8814} 8815function isObjectLike$1(value) { 8816 return value != null && typeof value == "object"; 8817} 8818var isArray$3 = Array.isArray; 8819const isArray$4 = isArray$3; 8820function isObject$2(value) { 8821 var type4 = typeof value; 8822 return value != null && (type4 == "object" || type4 == "function"); 8823} 8824function identity$2(value) { 8825 return value; 8826} 8827var asyncTag$1 = "[object AsyncFunction]", funcTag$4 = "[object Function]", genTag$2 = "[object GeneratorFunction]", proxyTag$1 = "[object Proxy]"; 8828function isFunction$3(value) { 8829 if (!isObject$2(value)) { 8830 return false; 8831 } 8832 var tag = baseGetTag$1(value); 8833 return tag == funcTag$4 || tag == genTag$2 || tag == asyncTag$1 || tag == proxyTag$1; 8834} 8835var coreJsData$2 = root$3["__core-js_shared__"]; 8836const coreJsData$3 = coreJsData$2; 8837var maskSrcKey$1 = function() { 8838 var uid2 = /[^.]+$/.exec(coreJsData$3 && coreJsData$3.keys && coreJsData$3.keys.IE_PROTO || ""); 8839 return uid2 ? "Symbol(src)_1." + uid2 : ""; 8840}(); 8841function isMasked$1(func) { 8842 return !!maskSrcKey$1 && maskSrcKey$1 in func; 8843} 8844var funcProto$5 = Function.prototype; 8845var funcToString$5 = funcProto$5.toString; 8846function toSource$1(func) { 8847 if (func != null) { 8848 try { 8849 return funcToString$5.call(func); 8850 } catch (e) { 8851 } 8852 try { 8853 return func + ""; 8854 } catch (e) { 8855 } 8856 } 8857 return ""; 8858} 8859var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g; 8860var reIsHostCtor$1 = /^\[object .+?Constructor\]$/; 8861var funcProto$4 = Function.prototype, objectProto$o = Object.prototype; 8862var funcToString$4 = funcProto$4.toString; 8863var hasOwnProperty$l = objectProto$o.hasOwnProperty; 8864var reIsNative$1 = RegExp( 8865 "^" + funcToString$4.call(hasOwnProperty$l).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" 8866); 8867function baseIsNative$1(value) { 8868 if (!isObject$2(value) || isMasked$1(value)) { 8869 return false; 8870 } 8871 var pattern4 = isFunction$3(value) ? reIsNative$1 : reIsHostCtor$1; 8872 return pattern4.test(toSource$1(value)); 8873} 8874function getValue$2(object4, key) { 8875 return object4 == null ? void 0 : object4[key]; 8876} 8877function getNative$1(object4, key) { 8878 var value = getValue$2(object4, key); 8879 return baseIsNative$1(value) ? value : void 0; 8880} 8881var objectCreate$1 = Object.create; 8882var baseCreate$2 = function() { 8883 function object4() { 8884 } 8885 return function(proto) { 8886 if (!isObject$2(proto)) { 8887 return {}; 8888 } 8889 if (objectCreate$1) { 8890 return objectCreate$1(proto); 8891 } 8892 object4.prototype = proto; 8893 var result = new object4(); 8894 object4.prototype = void 0; 8895 return result; 8896 }; 8897}(); 8898const baseCreate$3 = baseCreate$2; 8899function apply$1(func, thisArg, args) { 8900 switch (args.length) { 8901 case 0: 8902 return func.call(thisArg); 8903 case 1: 8904 return func.call(thisArg, args[0]); 8905 case 2: 8906 return func.call(thisArg, args[0], args[1]); 8907 case 3: 8908 return func.call(thisArg, args[0], args[1], args[2]); 8909 } 8910 return func.apply(thisArg, args); 8911} 8912function copyArray$1(source, array4) { 8913 var index = -1, length = source.length; 8914 array4 || (array4 = Array(length)); 8915 while (++index < length) { 8916 array4[index] = source[index]; 8917 } 8918 return array4; 8919} 8920var HOT_COUNT$1 = 800, HOT_SPAN$1 = 16; 8921var nativeNow$1 = Date.now; 8922function shortOut$1(func) { 8923 var count = 0, lastCalled = 0; 8924 return function() { 8925 var stamp = nativeNow$1(), remaining = HOT_SPAN$1 - (stamp - lastCalled); 8926 lastCalled = stamp; 8927 if (remaining > 0) { 8928 if (++count >= HOT_COUNT$1) { 8929 return arguments[0]; 8930 } 8931 } else { 8932 count = 0; 8933 } 8934 return func.apply(void 0, arguments); 8935 }; 8936} 8937function constant$1(value) { 8938 return function() { 8939 return value; 8940 }; 8941} 8942var defineProperty$2 = function() { 8943 try { 8944 var func = getNative$1(Object, "defineProperty"); 8945 func({}, "", {}); 8946 return func; 8947 } catch (e) { 8948 } 8949}(); 8950const defineProperty$3 = defineProperty$2; 8951var baseSetToString$2 = !defineProperty$3 ? identity$2 : function(func, string3) { 8952 return defineProperty$3(func, "toString", { 8953 "configurable": true, 8954 "enumerable": false, 8955 "value": constant$1(string3), 8956 "writable": true 8957 }); 8958}; 8959const baseSetToString$3 = baseSetToString$2; 8960var setToString$2 = shortOut$1(baseSetToString$3); 8961const setToString$3 = setToString$2; 8962var MAX_SAFE_INTEGER$3 = 9007199254740991; 8963var reIsUint$1 = /^(?:0|[1-9]\d*)$/; 8964function isIndex$1(value, length) { 8965 var type4 = typeof value; 8966 length = length == null ? MAX_SAFE_INTEGER$3 : length; 8967 return !!length && (type4 == "number" || type4 != "symbol" && reIsUint$1.test(value)) && (value > -1 && value % 1 == 0 && value < length); 8968} 8969function baseAssignValue$1(object4, key, value) { 8970 if (key == "__proto__" && defineProperty$3) { 8971 defineProperty$3(object4, key, { 8972 "configurable": true, 8973 "enumerable": true, 8974 "value": value, 8975 "writable": true 8976 }); 8977 } else { 8978 object4[key] = value; 8979 } 8980} 8981function eq$1(value, other) { 8982 return value === other || value !== value && other !== other; 8983} 8984var objectProto$n = Object.prototype; 8985var hasOwnProperty$k = objectProto$n.hasOwnProperty; 8986function assignValue$1(object4, key, value) { 8987 var objValue = object4[key]; 8988 if (!(hasOwnProperty$k.call(object4, key) && eq$1(objValue, value)) || value === void 0 && !(key in object4)) { 8989 baseAssignValue$1(object4, key, value); 8990 } 8991} 8992function copyObject$1(source, props, object4, customizer) { 8993 var isNew = !object4; 8994 object4 || (object4 = {}); 8995 var index = -1, length = props.length; 8996 while (++index < length) { 8997 var key = props[index]; 8998 var newValue = customizer ? customizer(object4[key], source[key], key, object4, source) : void 0; 8999 if (newValue === void 0) { 9000 newValue = source[key]; 9001 } 9002 if (isNew) { 9003 baseAssignValue$1(object4, key, newValue); 9004 } else { 9005 assignValue$1(object4, key, newValue); 9006 } 9007 } 9008 return object4; 9009} 9010var nativeMax$1 = Math.max; 9011function overRest$1(func, start, transform) { 9012 start = nativeMax$1(start === void 0 ? func.length - 1 : start, 0); 9013 return function() { 9014 var args = arguments, index = -1, length = nativeMax$1(args.length - start, 0), array4 = Array(length); 9015 while (++index < length) { 9016 array4[index] = args[start + index]; 9017 } 9018 index = -1; 9019 var otherArgs = Array(start + 1); 9020 while (++index < start) { 9021 otherArgs[index] = args[index]; 9022 } 9023 otherArgs[start] = transform(array4); 9024 return apply$1(func, this, otherArgs); 9025 }; 9026} 9027function baseRest$1(func, start) { 9028 return setToString$3(overRest$1(func, start, identity$2), func + ""); 9029} 9030var MAX_SAFE_INTEGER$2 = 9007199254740991; 9031function isLength$1(value) { 9032 return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$2; 9033} 9034function isArrayLike$1(value) { 9035 return value != null && isLength$1(value.length) && !isFunction$3(value); 9036} 9037function isIterateeCall$1(value, index, object4) { 9038 if (!isObject$2(object4)) { 9039 return false;
9040 } 9041 var type4 = typeof index; 9042 if (type4 == "number" ? isArrayLike$1(object4) && isIndex$1(index, object4.length) : type4 == "string" && index in object4) { 9043 return eq$1(object4[index], value); 9044 } 9045 return false; 9046} 9047function createAssigner$1(assigner) { 9048 return baseRest$1(function(object4, sources) { 9049 var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0; 9050 customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0; 9051 if (guard && isIterateeCall$1(sources[0], sources[1], guard)) { 9052 customizer = length < 3 ? void 0 : customizer; 9053 length = 1; 9054 } 9055 object4 = Object(object4); 9056 while (++index < length) { 9057 var source = sources[index]; 9058 if (source) { 9059 assigner(object4, source, index, customizer); 9060 } 9061 } 9062 return object4; 9063 }); 9064} 9065var objectProto$m = Object.prototype; 9066function isPrototype$1(value) { 9067 var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$m; 9068 return value === proto; 9069} 9070function baseTimes$1(n2, iteratee) { 9071 var index = -1, result = Array(n2); 9072 while (++index < n2) { 9073 result[index] = iteratee(index); 9074 } 9075 return result; 9076} 9077var argsTag$5 = "[object Arguments]"; 9078function baseIsArguments$1(value) { 9079 return isObjectLike$1(value) && baseGetTag$1(value) == argsTag$5; 9080} 9081var objectProto$l = Object.prototype; 9082var hasOwnProperty$j = objectProto$l.hasOwnProperty; 9083var propertyIsEnumerable$2 = objectProto$l.propertyIsEnumerable; 9084var isArguments$2 = baseIsArguments$1(function() { 9085 return arguments; 9086}()) ? baseIsArguments$1 : function(value) { 9087 return isObjectLike$1(value) && hasOwnProperty$j.call(value, "callee") && !propertyIsEnumerable$2.call(value, "callee"); 9088}; 9089const isArguments$3 = isArguments$2; 9090function stubFalse$1() { 9091 return false; 9092} 9093var freeExports$5 = typeof exports == "object" && exports && !exports.nodeType && exports; 9094var freeModule$5 = freeExports$5 && typeof module == "object" && module && !module.nodeType && module; 9095var moduleExports$5 = freeModule$5 && freeModule$5.exports === freeExports$5; 9096var Buffer$4 = moduleExports$5 ? root$3.Buffer : void 0; 9097var nativeIsBuffer$1 = Buffer$4 ? Buffer$4.isBuffer : void 0; 9098var isBuffer$3 = nativeIsBuffer$1 || stubFalse$1; 9099const isBuffer$4 = isBuffer$3; 9100var argsTag$4 = "[object Arguments]", arrayTag$3 = "[object Array]", boolTag$4 = "[object Boolean]", dateTag$4 = "[object Date]", errorTag$3 = "[object Error]", funcTag$3 = "[object Function]", mapTag$6 = "[object Map]", numberTag$4 = "[object Number]", objectTag$6 = "[object Object]", regexpTag$4 = "[object RegExp]", setTag$6 = "[object Set]", stringTag$4 = "[object String]", weakMapTag$3 = "[object WeakMap]"; 9101var arrayBufferTag$4 = "[object ArrayBuffer]", dataViewTag$5 = "[object DataView]", float32Tag$3 = "[object Float32Array]", float64Tag$3 = "[object Float64Array]", int8Tag$3 = "[object Int8Array]", int16Tag$3 = "[object Int16Array]", int32Tag$3 = "[object Int32Array]", uint8Tag$3 = "[object Uint8Array]", uint8ClampedTag$3 = "[object Uint8ClampedArray]", uint16Tag$3 = "[object Uint16Array]", uint32Tag$3 = "[object Uint32Array]"; 9102var typedArrayTags$1 = {}; 9103typedArrayTags$1[float32Tag$3] = typedArrayTags$1[float64Tag$3] = typedArrayTags$1[int8Tag$3] = typedArrayTags$1[int16Tag$3] = typedArrayTags$1[int32Tag$3] = typedArrayTags$1[uint8Tag$3] = typedArrayTags$1[uint8ClampedTag$3] = typedArrayTags$1[uint16Tag$3] = typedArrayTags$1[uint32Tag$3] = true; 9104typedArrayTags$1[argsTag$4] = typedArrayTags$1[arrayTag$3] = typedArrayTags$1[arrayBufferTag$4] = typedArrayTags$1[boolTag$4] = typedArrayTags$1[dataViewTag$5] = typedArrayTags$1[dateTag$4] = typedArrayTags$1[errorTag$3] = typedArrayTags$1[funcTag$3] = typedArrayTags$1[mapTag$6] = typedArrayTags$1[numberTag$4] = typedArrayTags$1[objectTag$6] = typedArrayTags$1[regexpTag$4] = typedArrayTags$1[setTag$6] = typedArrayTags$1[stringTag$4] = typedArrayTags$1[weakMapTag$3] = false; 9105function baseIsTypedArray$1(value) { 9106 return isObjectLike$1(value) && isLength$1(value.length) && !!typedArrayTags$1[baseGetTag$1(value)]; 9107} 9108function baseUnary$1(func) { 9109 return function(value) { 9110 return func(value); 9111 }; 9112} 9113var freeExports$4 = typeof exports == "object" && exports && !exports.nodeType && exports; 9114var freeModule$4 = freeExports$4 && typeof module == "object" && module && !module.nodeType && module; 9115var moduleExports$4 = freeModule$4 && freeModule$4.exports === freeExports$4; 9116var freeProcess$1 = moduleExports$4 && freeGlobal$3.process; 9117var nodeUtil$2 = function() { 9118 try { 9119 var types2 = freeModule$4 && freeModule$4.require && freeModule$4.require("util").t
9119ypes; 9120 if (types2) { 9121 return types2; 9122 } 9123 return freeProcess$1 && freeProcess$1.binding && freeProcess$1.binding("util"); 9124 } catch (e) { 9125 } 9126}(); 9127const nodeUtil$3 = nodeUtil$2; 9128var nodeIsTypedArray$1 = nodeUtil$3 && nodeUtil$3.isTypedArray; 9129var isTypedArray$3 = nodeIsTypedArray$1 ? baseUnary$1(nodeIsTypedArray$1) : baseIsTypedArray$1; 9130const isTypedArray$4 = isTypedArray$3; 9131var objectProto$k = Object.prototype; 9132var hasOwnProperty$i = objectProto$k.hasOwnProperty; 9133function arrayLikeKeys$1(value, inherited) { 9134 var isArr = isArray$4(value), isArg = !isArr && isArguments$3(value), isBuff = !isArr && !isArg && isBuffer$4(value), isType = !isArr && !isArg && !isBuff && isTypedArray$4(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes$1(value.length, String) : [], length = result.length; 9135 for (var key in value) { 9136 if ((inherited || hasOwnProperty$i.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. 9137 (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. 9138 isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. 9139 isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. 9140 isIndex$1(key, length)))) { 9141 result.push(key); 9142 } 9143 } 9144 return result; 9145} 9146function overArg$1(func, transform) { 9147 return function(arg) { 9148 return func(transform(arg)); 9149 }; 9150} 9151function nativeKeysIn$1(object4) { 9152 var result = []; 9153 if (object4 != null) { 9154 for (var key in Object(object4)) { 9155 result.push(key); 9156 } 9157 } 9158 return result; 9159} 9160var objectProto$j = Object.prototype; 9161var hasOwnProperty$h = objectProto$j.hasOwnProperty; 9162function baseKeysIn$1(object4) { 9163 if (!isObject$2(object4)) { 9164 return nativeKeysIn$1(object4); 9165 } 9166 var isProto = isPrototype$1(object4), result = []; 9167 for (var key in object4) { 9168 if (!(key == "constructor" && (isProto || !hasOwnProperty$h.call(object4, key)))) { 9169 result.push(key); 9170 } 9171 } 9172 return result; 9173} 9174function keysIn$1(object4) { 9175 return isArrayLike$1(object4) ? arrayLikeKeys$1(object4, true) : baseKeysIn$1(object4); 9176} 9177var nativeCreate$2 = getNative$1(Object, "create"); 9178const nativeCreate$3 = nativeCreate$2; 9179function hashClear$1() { 9180 this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {}; 9181 this.size = 0; 9182} 9183function hashDelete$1(key) { 9184 var result = this.has(key) && delete this.__data__[key]; 9185 this.size -= result ? 1 : 0; 9186 return result; 9187} 9188var HASH_UNDEFINED$4 = "__lodash_hash_undefined__"; 9189var objectProto$i = Object.prototype; 9190var hasOwnProperty$g = objectProto$i.hasOwnProperty; 9191function hashGet$1(key) { 9192 var data2 = this.__data__; 9193 if (nativeCreate$3) { 9194 var result = data2[key]; 9195 return result === HASH_UNDEFINED$4 ? void 0 : result; 9196 } 9197 return hasOwnProperty$g.call(data2, key) ? data2[key] : void 0; 9198} 9199var objectProto$h = Object.prototype; 9200var hasOwnProperty$f = objectProto$h.hasOwnProperty; 9201function hashHas$1(key) { 9202 var data2 = this.__data__; 9203 return nativeCreate$3 ? data2[key] !== void 0 : hasOwnProperty$f.call(data2, key); 9204} 9205var HASH_UNDEFINED$3 = "__lodash_hash_undefined__"; 9206function hashSet$1(key, value) { 9207 var data2 = this.__data__; 9208 this.size += this.has(key) ? 0 : 1; 9209 data2[key] = nativeCreate$3 && value === void 0 ? HASH_UNDEFINED$3 : value; 9210 return this; 9211} 9212function Hash$1(entries) { 9213 var index = -1, length = entries == null ? 0 : entries.length; 9214 this.clear(); 9215 while (++index < length) { 9216 var entry = entries[index]; 9217 this.set(entry[0], entry[1]); 9218 } 9219} 9220Hash$1.prototype.clear = hashClear$1; 9221Hash$1.prototype["delete"] = hashDelete$1; 9222Hash$1.prototype.get = hashGet$1; 9223Hash$1.prototype.has = hashHas$1; 9224Hash$1.prototype.set = hashSet$1; 9225function listCacheClear$1() { 9226 this.__data__ = []; 9227 this.size = 0; 9228} 9229function assocIndexOf$1(array4, key) { 9230 var length = array4.length; 9231 while (length--) { 9232 if (eq$1(array4[length][0], key)) { 9233 return length; 9234 } 9235 } 9236 return -1; 9237} 9238var arrayProto$1 = Array.prototype; 9239var splice$1 = arrayProto$1.splice; 9240function listCacheDelete$1(key) { 9241 var data2 = this.__data__, index = assocIndexOf$1(data2, key); 9242 if (index < 0) { 9243 return false;
vendor: 4,121 bytes, lines 9244-9381
9244 } 9245 var lastIndex = data2.length - 1; 9246 if (index == lastIndex) { 9247 data2.pop(); 9248 } else { 9249 splice$1.call(data2, index, 1); 9250 } 9251 --this.size; 9252 return true; 9253} 9254function listCacheGet$1(key) { 9255 var data2 = this.__data__, index = assocIndexOf$1(data2, key); 9256 return index < 0 ? void 0 : data2[index][1]; 9257} 9258function listCacheHas$1(key) { 9259 return assocIndexOf$1(this.__data__, key) > -1; 9260} 9261function listCacheSet$1(key, value) { 9262 var data2 = this.__data__, index = assocIndexOf$1(data2, key); 9263 if (index < 0) { 9264 ++this.size; 9265 data2.push([key, value]); 9266 } else { 9267 data2[index][1] = value; 9268 } 9269 return this; 9270} 9271function ListCache$1(entries) { 9272 var index = -1, length = entries == null ? 0 : entries.length; 9273 this.clear(); 9274 while (++index < length) { 9275 var entry = entries[index]; 9276 this.set(entry[0], entry[1]); 9277 } 9278} 9279ListCache$1.prototype.clear = listCacheClear$1; 9280ListCache$1.prototype["delete"] = listCacheDelete$1; 9281ListCache$1.prototype.get = listCacheGet$1; 9282ListCache$1.prototype.has = listCacheHas$1; 9283ListCache$1.prototype.set = listCacheSet$1; 9284var Map$3 = getNative$1(root$3, "Map"); 9285const Map$4 = Map$3; 9286function mapCacheClear$1() { 9287 this.size = 0; 9288 this.__data__ = { 9289 "hash": new Hash$1(), 9290 "map": new (Map$4 || ListCache$1)(), 9291 "string": new Hash$1() 9292 }; 9293} 9294function isKeyable$1(value) { 9295 var type4 = typeof value; 9296 return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value !== "__proto__" : value === null; 9297} 9298function getMapData$1(map2, key) { 9299 var data2 = map2.__data__; 9300 return isKeyable$1(key) ? data2[typeof key == "string" ? "string" : "hash"] : data2.map; 9301} 9302function mapCacheDelete$1(key) { 9303 var result = getMapData$1(this, key)["delete"](key); 9304 this.size -= result ? 1 : 0; 9305 return result; 9306} 9307function mapCacheGet$1(key) { 9308 return getMapData$1(this, key).get(key); 9309} 9310function mapCacheHas$1(key) { 9311 return getMapData$1(this, key).has(key); 9312} 9313function mapCacheSet$1(key, value) { 9314 var data2 = getMapData$1(this, key), size2 = data2.size; 9315 data2.set(key, value); 9316 this.size += data2.size == size2 ? 0 : 1; 9317 return this; 9318} 9319function MapCache$1(entries) { 9320 var index = -1, length = entries == null ? 0 : entries.length; 9321 this.clear(); 9322 while (++index < length) { 9323 var entry = entries[index]; 9324 this.set(entry[0], entry[1]); 9325 } 9326} 9327MapCache$1.prototype.clear = mapCacheClear$1; 9328MapCache$1.prototype["delete"] = mapCacheDelete$1; 9329MapCache$1.prototype.get = mapCacheGet$1; 9330MapCache$1.prototype.has = mapCacheHas$1; 9331MapCache$1.prototype.set = mapCacheSet$1; 9332var getPrototype$2 = overArg$1(Object.getPrototypeOf, Object); 9333const getPrototype$3 = getPrototype$2; 9334var objectTag$5 = "[object Object]"; 9335var funcProto$3 = Function.prototype, objectProto$g = Object.prototype; 9336var funcToString$3 = funcProto$3.toString; 9337var hasOwnProperty$e = objectProto$g.hasOwnProperty; 9338var objectCtorString$1 = funcToString$3.call(Object); 9339function isPlainObject$2(value) { 9340 if (!isObjectLike$1(value) || baseGetTag$1(value) != objectTag$5) { 9341 return false; 9342 } 9343 var proto = getPrototype$3(value); 9344 if (proto === null) { 9345 return true; 9346 } 9347 var Ctor = hasOwnProperty$e.call(proto, "constructor") && proto.constructor; 9348 return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString$3.call(Ctor) == objectCtorString$1; 9349} 9350function stackClear$1() { 9351 this.__data__ = new ListCache$1(); 9352 this.size = 0; 9353} 9354function stackDelete$1(key) { 9355 var data2 = this.__data__, result = data2["delete"](key); 9356 this.size = data2.size; 9357 return result; 9358} 9359function stackGet$1(key) { 9360 return this.__data__.get(key); 9361} 9362function stackHas$1(key) { 9363 return this.__data__.has(key); 9364} 9365var LARGE_ARRAY_SIZE$1 = 200; 9366function stackSet$1(key, value) { 9367 var data2 = this.__data__; 9368 if (data2 instanceof ListCache$1) { 9369 var pairs = data2.__data__; 9370 if (!Map$4 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) { 9371 pairs.push([key, value]); 9372 this.size = ++data2.size; 9373 return this; 9374 } 9375 data2 = this.__data__ = new MapCache$1(pairs); 9376 } 9377 data2.set(key, value); 9378 this.size = data2.size; 9379 return this; 9380} 9381function Stack$1(entries) {
9382 var data2 = this.__data__ = new ListCache$1(entries); 9383 this.size = data2.size; 9384} 9385Stack$1.prototype.clear = stackClear$1; 9386Stack$1.prototype["delete"] = stackDelete$1; 9387Stack$1.prototype.get = stackGet$1; 9388Stack$1.prototype.has = stackHas$1; 9389Stack$1.prototype.set = stackSet$1; 9390var freeExports$3 = typeof exports == "object" && exports && !exports.nodeType && exports; 9391var freeModule$3 = freeExports$3 && typeof module == "object" && module && !module.nodeType && module; 9392var moduleExports$3 = freeModule$3 && freeModule$3.exports === freeExports$3; 9393var Buffer$3 = moduleExports$3 ? root$3.Buffer : void 0, allocUnsafe$1 = Buffer$3 ? Buffer$3.allocUnsafe : void 0; 9394function cloneBuffer$1(buffer2, isDeep) { 9395 if (isDeep) { 9396 return buffer2.slice(); 9397 } 9398 var length = buffer2.length, result = allocUnsafe$1 ? allocUnsafe$1(length) : new buffer2.constructor(length); 9399 buffer2.copy(result); 9400 return result; 9401} 9402var Uint8Array$3 = root$3.Uint8Array; 9403const Uint8Array$4 = Uint8Array$3; 9404function cloneArrayBuffer$1(arrayBuffer) { 9405 var result = new arrayBuffer.constructor(arrayBuffer.byteLength); 9406 new Uint8Array$4(result).set(new Uint8Array$4(arrayBuffer)); 9407 return result; 9408} 9409function cloneTypedArray$1(typedArray, isDeep) { 9410 var buffer2 = isDeep ? cloneArrayBuffer$1(typedArray.buffer) : typedArray.buffer; 9411 return new typedArray.constructor(buffer2, typedArray.byteOffset, typedArray.length); 9412} 9413function initCloneObject$1(object4) { 9414 return typeof object4.constructor == "function" && !isPrototype$1(object4) ? baseCreate$3(getPrototype$3(object4)) : {}; 9415} 9416function createBaseFor$1(fromRight) { 9417 return function(object4, iteratee, keysFunc) { 9418 var index = -1, iterable = Object(object4), props = keysFunc(object4), length = props.length; 9419 while (length--) { 9420 var key = props[fromRight ? length : ++index]; 9421 if (iteratee(iterable[key], key, iterable) === false) { 9422 break; 9423 } 9424 } 9425 return object4; 9426 }; 9427} 9428var baseFor$2 = createBaseFor$1(); 9429const baseFor$3 = baseFor$2; 9430function assignMergeValue$1(object4, key, value) { 9431 if (value !== void 0 && !eq$1(object4[key], value) || value === void 0 && !(key in object4)) { 9432 baseAssignValue$1(object4, key, value); 9433 } 9434} 9435function isArrayLikeObject$1(value) { 9436 return isObjectLike$1(value) && isArrayLike$1(value); 9437} 9438function safeGet$1(object4, key) { 9439 if (key === "constructor" && typeof object4[key] === "function") { 9440 return; 9441 } 9442 if (key == "__proto__") { 9443 return; 9444 } 9445 return object4[key]; 9446} 9447function toPlainObject$1(value) { 9448 return copyObject$1(value, keysIn$1(value)); 9449} 9450function baseMergeDeep$1(object4, source, key, srcIndex, mergeFunc, customizer, stack2) { 9451 var objValue = safeGet$1(object4, key), srcValue = safeGet$1(source, key), stacked = stack2.get(srcValue); 9452 if (stacked) { 9453 assignMergeValue$1(object4, key, stacked); 9454 return; 9455 } 9456 var newValue = customizer ? customizer(objValue, srcValue, key + "", object4, source, stack2) : void 0; 9457 var isCommon = newValue === void 0; 9458 if (isCommon) { 9459 var isArr = isArray$4(srcValue), isBuff = !isArr && isBuffer$4(srcValue), isTyped = !isArr && !isBuff && isTypedArray$4(srcValue); 9460 newValue = srcValue; 9461 if (isArr || isBuff || isTyped) { 9462 if (isArray$4(objValue)) { 9463 newValue = objValue; 9464 } else if (isArrayLikeObject$1(objValue)) { 9465 newValue = copyArray$1(objValue); 9466 } else if (isBuff) { 9467 isCommon = false; 9468 newValue = cloneBuffer$1(srcValue, true); 9469 } else if (isTyped) { 9470 isCommon = false; 9471 newValue = cloneTypedArray$1(srcValue, true); 9472 } else { 9473 newValue = []; 9474 } 9475 } else if (isPlainObject$2(srcValue) || isArguments$3(srcValue)) { 9476 newValue = objValue; 9477 if (isArguments$3(objValue)) { 9478 newValue = toPlainObject$1(objValue); 9479 } else if (!isObject$2(objValue) || isFunction$3(objValue)) { 9480 newValue = initCloneObject$1(srcValue); 9481 } 9482 } else { 9483 isCommon = false; 9484 } 9485 } 9486 if (isCommon) { 9487 stack2.set(srcValue, newValue); 9488 mergeFunc(newValue, srcValue, srcIndex, customizer, stack2); 9489 stack2["delete"](srcValue); 9490 } 9491 assignMergeValue$1(object4, key, newValue); 9492} 9493function baseMerge$1(object4, source, srcIndex, customizer, stack2) { 9494 if (object4 === source) { 9495 return; 9496 } 9497 baseFor$3(source, function(srcValue, key) { 9498 stack2 || (stack2 = new Stack$1()); 9499 if (isObject$2(srcValue)) { 9500 baseMergeDeep$1(object4, source, key, srcIndex, baseMerge$1, customizer, stack2); 9501 } else { 9502 var newValue = customizer ? customizer(safeGet$1(object4, key), srcValue, key + "", object4, source, stack2) : void 0; 9503 if (newValue === void 0) { 9504 newValue = srcValue; 9505 } 9506 assignMergeValue$1(object4, key, newValue); 9507 } 9508 }, keysIn$1); 9509} 9510var merge$4 = createAssigner$1(function(object4, source, srcIndex) { 9511 baseMerge$1(object4, source, srcIndex); 9512}); 9513const merge$5 = merge$4; 9514const configProviderInjectionKey$1 = createInjectionKey$1("n-config-provider"); 9515const defaultClsPrefix$1 = "n"; 9516function useConfig$1(props = {}, options = { 9517 defaultBordered: true 9518}) { 9519 const NConfigProvider2 = inject(configProviderInjectionKey$1, null); 9520 return { 9521 // NConfigProvider, 9522 inlineThemeDisabled: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.inlineThemeDisabled, 9523 mergedRtlRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedRtlRef, 9524 mergedComponentPropsRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedComponentPropsRef, 9525 mergedBreakpointsRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBreakpointsRef, 9526 mergedBorderedRef: computed(() => { 9527 var _a2, _b; 9528 const { 9529 bordered 9530 } = props; 9531 if (bordered !== void 0) 9532 return bordered; 9533 return (_b = (_a2 = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBorderedRef.value) !== null && _a2 !== void 0 ? _a2 : options.defaultBordered) !== null && _b !== void 0 ? _b : true; 9534 }), 9535 mergedClsPrefixRef: NConfigProvider2 ? NConfigProvider2.mergedClsPrefixRef : shallowRef(defaultClsPrefix$1), 9536 namespaceRef: computed(() => NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedNamespaceRef.value) 9537 }; 9538} 9539const itIT$1 = {
9540 name: "it-IT", 9541 global: { 9542 undo: "Annulla", 9543 redo: "Ripeti", 9544 confirm: "Conferma", 9545 clear: "Cancella" 9546 }, 9547 Popconfirm: { 9548 positiveText: "Conferma", 9549 negativeText: "Annulla" 9550 }, 9551 Cascader: { 9552 placeholder: "Si prega di selezionare", 9553 loading: "Caricamento", 9554 loadingRequiredMessage: (label) => `Carica tutti i discendenti di ${label} prima di controllarlo.` 9555 }, 9556 Time: { 9557 dateFormat: "dd/MM/yyyy", 9558 dateTimeFormat: "dd/MM/yyyy HH:mm:ss" 9559 }, 9560 DatePicker: { 9561 yearFormat: "yyyy", 9562 monthFormat: "MMM", 9563 dayFormat: "eeeeee", 9564 yearTypeFormat: "yyyy", 9565 monthTypeFormat: "yyyy-MM", 9566 dateFormat: "yyyy-MM-dd", 9567 dateTimeFormat: "yyyy-MM-dd HH:mm:ss", 9568 quarterFormat: "yyyy-qqq", 9569 weekFormat: "yyyy-w", 9570 clear: "Cancella", 9571 now: "Adesso", 9572 confirm: "Conferma", 9573 selectTime: "Seleziona ora", 9574 selectDate: "Seleziona data", 9575 datePlaceholder: "Seleziona data", 9576 datetimePlaceholder: "Seleziona data e ora", 9577 monthPlaceholder: "Seleziona mese", 9578 yearPlaceholder: "Seleziona anno", 9579 quarterPlaceholder: "Seleziona trimestre", 9580 weekPlaceholder: "Select Week", 9581 startDatePlaceholder: "Data inizio", 9582 endDatePlaceholder: "Data fine", 9583 startDatetimePlaceholder: "Data e ora di inizio", 9584 endDatetimePlaceholder: "Data e ora di fine", 9585 // FIXME: translation needed 9586 startMonthPlaceholder: "Start Month", 9587 endMonthPlaceholder: "End Month", 9588 monthBeforeYear: true, 9589 firstDayOfWeek: 0, 9590 today: "Oggi" 9591 }, 9592 DataTable: { 9593 checkTableAll: "Seleziona tutto nella tabella", 9594 uncheckTableAll: "Deseleziona tutto nella tabella", 9595 confirm: "Conferma", 9596 clear: "Cancella" 9597 }, 9598 LegacyTransfer: { 9599 sourceTitle: "Fonte", 9600 targetTitle: "Destinazione" 9601 }, 9602 // TODO: translation 9603 Transfer: { 9604 selectAll: "Select all", 9605 unselectAll: "Unselect all", 9606 clearAll: "Clear", 9607 total: (num) => `Total ${num} items`, 9608 selected: (num) => `${num} items selected` 9609 }, 9610 Empty: { 9611 description: "Nessun Dato" 9612 }, 9613 Select: { 9614 placeholder: "Si prega di selezionare" 9615 }, 9616 TimePicker: { 9617 placeholder: "Seleziona ora", 9618 positiveText: "OK", 9619 negativeText: "Annulla", 9620 now: "Ora", 9621 clear: "Cancella" 9622 }, 9623 Pagination: { 9624 goto: "Vai a", 9625 selectionSuffix: "per pagina" 9626 }, 9627 DynamicTags: { 9628 add: "Aggiungi" 9629 }, 9630 Log: { 9631 loading: "Caricamento" 9632 }, 9633 Input: { 9634 placeholder: "Si prega di inserire" 9635 }, 9636 InputNumber: { 9637 placeholder: "Si prega di inserire" 9638 }, 9639 DynamicInput: { 9640 create: "Crea" 9641 }, 9642 ThemeEditor: { 9643 title: "Editor Tema", 9644 clearAllVars: "Cancella tutte le variabili", 9645 clearSearch: "Cancella ricerca", 9646 filterCompName: "Filtra componenti", 9647 filterVarName: "Filtra variabili", 9648 import: "Importa", 9649 export: "Esporta", 9650 restore: "Ripristina" 9651 }, 9652 Image: { 9653 tipPrevious: "Immagine precedente (â)", 9654 tipNext: "Immagine successiva (â)", 9655 tipCounterclockwise: "Ruota a sinistra", 9656 tipClockwise: "Ruota a destra", 9657 tipZoomOut: "Ingrandisci", 9658 tipZoomIn: "Riduci", 9659 tipDownload: "Download", 9660 tipClose: "Chiudi (Esc)", 9661 // TODO: translation 9662 tipOriginalSize: "Zoom to original size" 9663 } 9664}; 9665const itIT$2 = itIT$1; 9666function buildFormatLongFn$1(args) { 9667 return function() { 9668 var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 9669 var width = options.width ? String(options.width) : args.defaultWidth; 9670 var format2 = args.formats[width] || args.formats[args.defaultWidth]; 9671 return format2; 9672 }; 9673} 9674function requiredArgs(required4, args) { 9675 if (args.length < required4) { 9676 throw new TypeError(required4 + " argument" + (required4 > 1 ? "s" : "") + " required, but only " + args.length + " present"); 9677 } 9678} 9679function _typeof(o) { 9680 "@babel/helpers - typeof"; 9681 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) { 9682 return typeof o2; 9683 } : function(o2) { 9684 return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2; 9685 }, _typeof(o); 9686} 9687function toDate(argument) { 9688 requiredArgs(1, arguments); 9689 var argStr = Object.prototype.toString.call(argument); 9690 if (argument instanceof Date || _typeof(argument) === "object" && argStr === "[object Date]") { 9691 return new Date(argument.getTime()); 9692 } else if (typeof argument === "number" || argStr === "[object Number]") { 9693 return new Date(argument); 9694 } else { 9695 if ((typeof argument === "string" || argStr === "[object String]") && typeof console !== "undefined") {
9696 console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"); 9697 console.warn(new Error().stack); 9698 } 9699 return /* @__PURE__ */ new Date(NaN); 9700 } 9701} 9702function toInteger(dirtyNumber) { 9703 if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) { 9704 return NaN; 9705 } 9706 var number4 = Number(dirtyNumber); 9707 if (isNaN(number4)) { 9708 return number4; 9709 } 9710 return number4 < 0 ? Math.ceil(number4) : Math.floor(number4); 9711} 9712var defaultOptions = {}; 9713function getDefaultOptions() { 9714 return defaultOptions; 9715} 9716function startOfUTCWeek(dirtyDate, options) { 9717 var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; 9718 requiredArgs(1, arguments); 9719 var defaultOptions2 = getDefaultOptions(); 9720 var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions2.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions2.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); 9721 if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { 9722 throw new RangeError("weekStartsOn must be between 0 and 6 inclusively"); 9723 } 9724 var date4 = toDate(dirtyDate); 9725 var day = date4.getUTCDay(); 9726 var diff2 = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; 9727 date4.setUTCDate(date4.getUTCDate() - diff2); 9728 date4.setUTCHours(0, 0, 0, 0); 9729 return date4; 9730} 9731function isSameUTCWeek(dirtyDateLeft, dirtyDateRight, options) { 9732 requiredArgs(2, arguments); 9733 var dateLeftStartOfWeek = startOfUTCWeek(dirtyDateLeft, options); 9734 var dateRightStartOfWeek = startOfUTCWeek(dirtyDateRight, options); 9735 return dateLeftStartOfWeek.getTime() === dateRightStartOfWeek.getTime(); 9736} 9737function buildLocalizeFn$1(args) { 9738 return function(dirtyIndex, options) { 9739 var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone"; 9740 var valuesArray; 9741 if (context === "formatting" && args.formattingValues) { 9742 var defaultWidth = args.defaultFormattingWidth || args.defaultWidth; 9743 var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth; 9744 valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; 9745 } else { 9746 var _defaultWidth = args.defaultWidth; 9747 var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth; 9748 valuesArray = args.values[_width] || args.values[_defaultWidth]; 9749 } 9750 var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; 9751 return valuesArray[index]; 9752 }; 9753} 9754function buildMatchFn$1(args) { 9755 return function(string3) { 9756 var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 9757 var width = options.width; 9758 var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth]; 9759 var matchResult = string3.match(matchPattern); 9760 if (!matchResult) { 9761 return null; 9762 } 9763 var matchedString = matchResult[0]; 9764 var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; 9765 var key = Array.isArray(parsePatterns) ? findIndex$1(parsePatterns, function(pattern4) { 9766 return pattern4.test(matchedString); 9767 }) : findKey$1(parsePatterns, function(pattern4) { 9768 return pattern4.test(matchedString); 9769 }); 9770 var value; 9771 value = args.valueCallback ? args.valueCallback(key) : key; 9772 value = options.valueCallback ? options.valueCallback(value) : value; 9773 var rest = string3.slice(matchedString.length); 9774 return { 9775 value, 9776 rest 9777 }; 9778 }; 9779} 9780function findKey$1(object4, predicate) { 9781 for (var key in object4) { 9782 if (object4.hasOwnProperty(key) && predicate(object4[key])) { 9783 return key; 9784 } 9785 } 9786 return void 0; 9787} 9788function findIndex$1(array4, predicate) { 9789 for (var key = 0; key < array4.length; key++) { 9790 if (predicate(array4[key])) { 9791 return key; 9792 } 9793 } 9794 return void 0; 9795} 9796function buildMatchPatternFn$1(args) { 9797 return function(string3) { 9798 var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 9799 var matchResult = string3.match(args.matchPattern); 9800 if (!matchResult) 9801 return null; 9802 var matchedString = matchResult[0]; 9803 var parseResult = string3.match(args.parsePattern); 9804 if (!parseResult) 9805 return null; 9806 var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; 9807 value = options.valueCallback ? options.valueCallback(value) : value; 9808 var rest = string3.slice(matchedString.length); 9809 return { 9810 value, 9811 rest 9812 }; 9813 }; 9814} 9815var formatDistanceLocale$1 = { 9816 lessThanXSeconds: { 9817 one: "meno di un secondo", 9818 other: "meno di {{count}} secondi" 9819 }, 9820 xSeconds: { 9821 one: "un secondo", 9822 other: "{{count}} secondi" 9823 }, 9824 halfAMinute: "alcuni secondi", 9825 lessThanXMinutes: { 9826 one: "meno di un minuto", 9827 other: "meno di {{count}} minuti" 9828 }, 9829 xMinutes: { 9830 one: "un minuto", 9831 other: "{{count}} minuti" 9832 }, 9833 aboutXHours: { 9834 one: "circa un'ora", 9835 other: "circa {{count}} ore" 9836 }, 9837 xHours: { 9838 one: "un'ora", 9839 other: "{{count}} ore" 9840 }, 9841 xDays: { 9842 one: "un giorno", 9843 other: "{{count}} giorni" 9844 }, 9845 aboutXWeeks: { 9846 one: "circa una settimana", 9847 other: "circa {{count}} settimane" 9848 }, 9849 xWeeks: { 9850 one: "una settimana", 9851 other: "{{count}} settimane" 9852 }, 9853 aboutXMonths: { 9854 one: "circa un mese", 9855 other: "circa {{count}} mesi" 9856 }, 9857 xMonths: { 9858 one: "un mese", 9859 other: "{{count}} mesi" 9860 }, 9861 aboutXYears: { 9862 one: "circa un anno", 9863 other: "circa {{count}} anni" 9864 }, 9865 xYears: { 9866 one: "un anno", 9867 other: "{{count}} anni" 9868 }, 9869 overXYears: { 9870 one: "più di un anno", 9871 other: "più di {{count}} anni" 9872 }, 9873 almostXYears: { 9874 one: "quasi un anno", 9875 other: "quasi {{count}} anni" 9876 } 9877}; 9878var formatDistance$2 = function formatDistance(token, count, options) { 9879 var result; 9880 var tokenValue = formatDistanceLocale$1[token]; 9881 if (typeof tokenValue === "string") { 9882 result = tokenValue; 9883 } else if (count === 1) { 9884 result = tokenValue.one; 9885 } else { 9886 result = tokenValue.other.replace("{{count}}", count.toString()); 9887 } 9888 if (options !== null && options !== void 0 && options.addSuffix) { 9889 if (options.comparison && options.comparison > 0) { 9890 return "tra " + result; 9891 } else { 9892 return result + " fa"; 9893 } 9894 } 9895 return result; 9896}; 9897const formatDistance$3 = formatDistance$2; 9898var dateFormats$1 = { 9899 full: "EEEE d MMMM y", 9900 long: "d MMMM y", 9901 medium: "d MMM y", 9902 short: "dd/MM/y" 9903}; 9904var timeFormats$1 = { 9905 full: "HH:mm:ss zzzz", 9906 long: "HH:mm:ss z", 9907 medium: "HH:mm:ss", 9908 short: "HH:mm" 9909}; 9910var dateTimeFormats$1 = { 9911 full: "{{date}} {{time}}", 9912 long: "{{date}} {{time}}", 9913 medium: "{{date}} {{time}}", 9914 short: "{{date}} {{time}}" 9915}; 9916var formatLong$2 = { 9917 date: buildFormatLongFn$1({ 9918 formats: dateFormats$1, 9919 defaultWidth: "full" 9920 }), 9921 time: buildFormatLongFn$1({ 9922 formats: timeFormats$1, 9923 defaultWidth: "full" 9924 }), 9925 dateTime: buildFormatLongFn$1({ 9926 formats: dateTimeFormats$1, 9927 defaultWidth: "full" 9928 }) 9929}; 9930const formatLong$3 = formatLong$2; 9931var weekdays$1 = ["domenica", "lunedì", "martedì", "mercoledì", "giovedì", "venerdì", "sabato"]; 9932function _lastWeek(day) { 9933 switch (day) { 9934 case 0: 9935 return "'domenica scorsa alle' p"; 9936 default: 9937 return "'" + weekdays$1[day] + " scorso alle' p"; 9938 } 9939} 9940function thisWeek(day) { 9941 return "'" + weekdays$1[day] + " alle' p"; 9942} 9943function _nextWeek(day) { 9944 switch (day) { 9945 case 0: 9946 return "'domenica prossima alle' p"; 9947 default: 9948 return "'" + weekdays$1[day] + " prossimo alle' p"; 9949 } 9950} 9951var formatRelativeLocale$1 = { 9952 lastWeek: function lastWeek(date4, baseDate, options) { 9953 var day = date4.getUTCDay(); 9954 if (isSameUTCWeek(date4, baseDate, options)) { 9955 return thisWeek(day); 9956 } else { 9957 return _lastWeek(day); 9958 } 9959 }, 9960 yesterday: "'ieri alle' p", 9961 today: "'oggi alle' p", 9962 tomorrow: "'domani alle' p", 9963 nextWeek: function nextWeek(date4, baseDate, options) { 9964 var day = date4.getUTCDay(); 9965 if (isSameUTCWeek(date4, baseDate, options)) { 9966 return thisWeek(day); 9967 } else { 9968 return _nextWeek(day); 9969 } 9970 }, 9971 other: "P" 9972}; 9973var formatRelative$2 = function formatRelative(token, date4, baseDate, options) { 9974 var format2 = formatRelativeLocale$1[token]; 9975 if (typeof format2 === "function") { 9976 return format2(date4, baseDate, options); 9977 } 9978 return format2; 9979}; 9980const formatRelative$3 = formatRelative$2; 9981var eraValues$1 = { 9982 narrow: ["aC", "dC"], 9983 abbreviated: ["a.C.", "d.C."], 9984 wide: ["avanti Cristo", "dopo Cristo"] 9985}; 9986var quarterValues$1 = { 9987 narrow: ["1", "2", "3", "4"], 9988 abbreviated: ["T1", "T2", "T3", "T4"], 9989 wide: ["1º trimestre", "2º trimestre", "3º trimestre", "4º trimestre"] 9990}; 9991var monthValues$1 = { 9992 narrow: ["G", "F", "M", "A", "M", "G", "L", "A", "S", "O", "N", "D"], 9993 abbreviated: ["gen", "feb", "mar", "apr", "mag", "giu", "lug", "ago", "set", "ott", "nov", "dic"], 9994 wide: ["gennaio", "febbraio", "marzo", "aprile", "maggio", "giugno", "luglio", "agosto", "settembre", "ottobre", "novembre", "dicembre"] 9995}
9995; 9996var dayValues$1 = { 9997 narrow: ["D", "L", "M", "M", "G", "V", "S"], 9998 short: ["dom", "lun", "mar", "mer", "gio", "ven", "sab"], 9999 abbreviated: ["dom", "lun", "mar", "mer", "gio", "ven", "sab"], 10000 wide: ["domenica", "lunedì", "martedì", "mercoledì", "giovedì", "venerdì", "sabato"] 10001}; 10002var dayPeriodValues$1 = { 10003 narrow: { 10004 am: "m.", 10005 pm: "p.", 10006 midnight: "mezzanotte", 10007 noon: "mezzogiorno", 10008 morning: "mattina", 10009 afternoon: "pomeriggio", 10010 evening: "sera", 10011 night: "notte" 10012 }, 10013 abbreviated: { 10014 am: "AM", 10015 pm: "PM", 10016 midnight: "mezzanotte", 10017 noon: "mezzogiorno", 10018 morning: "mattina", 10019 afternoon: "pomeriggio", 10020 evening: "sera", 10021 night: "notte" 10022 }, 10023 wide: { 10024 am: "AM", 10025 pm: "PM", 10026 midnight: "mezzanotte", 10027 noon: "mezzogiorno", 10028 morning: "mattina", 10029 afternoon: "pomeriggio", 10030 evening: "sera", 10031 night: "notte" 10032 } 10033}; 10034var formattingDayPeriodValues$1 = { 10035 narrow: { 10036 am: "m.", 10037 pm: "p.", 10038 midnight: "mezzanotte", 10039 noon: "mezzogiorno", 10040 morning: "di mattina", 10041 afternoon: "del pomeriggio", 10042 evening: "di sera", 10043 night: "di notte" 10044 }, 10045 abbreviated: { 10046 am: "AM", 10047 pm: "PM", 10048 midnight: "mezzanotte", 10049 noon: "mezzogiorno", 10050 morning: "di mattina", 10051 afternoon: "del pomeriggio", 10052 evening: "di sera", 10053 night: "di notte" 10054 }, 10055 wide: { 10056 am: "AM", 10057 pm: "PM", 10058 midnight: "mezzanotte", 10059 noon: "mezzogiorno", 10060 morning: "di mattina", 10061 afternoon: "del pomeriggio", 10062 evening: "di sera", 10063 night: "di notte" 10064 } 10065}; 10066var ordinalNumber$1 = function ordinalNumber(dirtyNumber, _options) { 10067 var number4 = Number(dirtyNumber); 10068 return String(number4); 10069}; 10070var localize$2 = { 10071 ordinalNumber: ordinalNumber$1, 10072 era: buildLocalizeFn$1({ 10073 values: eraValues$1, 10074 defaultWidth: "wide" 10075 }), 10076 quarter: buildLocalizeFn$1({ 10077 values: quarterValues$1, 10078 defaultWidth: "wide", 10079 argumentCallback: function argumentCallback(quarter) { 10080 return quarter - 1; 10081 } 10082 }), 10083 month: buildLocalizeFn$1({ 10084 values: monthValues$1, 10085 defaultWidth: "wide" 10086 }), 10087 day: buildLocalizeFn$1({ 10088 values: dayValues$1, 10089 defaultWidth: "wide" 10090 }), 10091 dayPeriod: buildLocalizeFn$1({ 10092 values: dayPeriodValues$1, 10093 defaultWidth: "wide", 10094 formattingValues: formattingDayPeriodValues$1, 10095 defaultFormattingWidth: "wide" 10096 }) 10097}; 10098const localize$3 = localize$2; 10099var matchOrdinalNumberPattern$1 = /^(\d+)(º)?/i; 10100var parseOrdinalNumberPattern$1 = /\d+/i; 10101var matchEraPatterns$1 = { 10102 narrow: /^(aC|dC)/i, 10103 abbreviated: /^(a\.?\s?C\.?|a\.?\s?e\.?\s?v\.?|d\.?\s?C\.?|e\.?\s?v\.?)/i, 10104 wide: /^(avanti Cristo|avanti Era Volgare|dopo Cristo|Era Volgare)/i 10105}; 10106var parseEraPatterns$1 = { 10107 any: [/^a/i, /^(d|e)/i] 10108}; 10109var matchQuarterPatterns$1 = { 10110 narrow: /^[1234]/i, 10111 abbreviated: /^t[1234]/i, 10112 wide: /^[1234](º)? trimestre/i 10113}; 10114var parseQuarterPatterns$1 = { 10115 any: [/1/i, /2/i, /3/i, /4/i] 10116}; 10117var matchMonthPatterns$1 = { 10118 narrow: /^[gfmalsond]/i, 10119 abbreviated: /^(gen|feb|mar|apr|mag|giu|lug|ago|set|ott|nov|dic)/i, 10120 wide: /^(gennaio|febbraio|marzo|aprile|maggio|giugno|luglio|agosto|settembre|ottobre|novembre|dicembre)/i 10121}; 10122var parseMonthPatterns$1 = { 10123 narrow: [/^g/i, /^f/i, /^m/i, /^a/i, /^m/i, /^g/i, /^l/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i], 10124 any: [/^ge/i, /^f/i, /^mar/i, /^ap/i, /^mag/i, /^gi/i, /^l/i, /^ag/i, /^s/i, /^o/i, /^n/i, /^d/i] 10125}; 10126var matchDayPatterns$1 = { 10127 narrow: /^[dlmgvs]/i, 10128 short: /^(do|lu|ma|me|gi|ve|sa)/i, 10129 abbreviated: /^(dom|lun|mar|mer|gio|ven|sab)/i, 10130 wide: /^(domenica|luned[i|ì]|marted[i|ì]|mercoled[i|ì]|gioved[i|ì]|venerd[i|ì]|sabato)/i 10131}; 10132var parseDayPatterns$1 = { 10133 narrow: [/^d/i, /^l/i, /^m/i, /^m/i, /^g/i, /^v/i, /^s/i], 10134 any: [/^d/i, /^l/i, /^ma/i, /^me/i, /^g/i, /^v/i, /^s/i] 10135}; 10136var matchDayPeriodPatterns$1 = { 10137 narrow: /^(a|m\.|p|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i, 10138 any: /^([ap]\.?\s?m\.?|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i 10139}; 10140var parseDayPeriodPatterns$1 = { 10141 any: { 10142 am: /^a/i, 10143 pm: /^p/i, 10144 midnight: /^mezza/i, 10145 noon: /^mezzo/i, 10146 morning: /mattina/i, 10147 afternoon: /pomeriggio/i, 10148 evening: /sera/i, 10149 night: /notte/i 10150 } 10151}; 10152var match$3 = { 10153 ordinalNumber: buildMatchPatternFn$1({ 10154 matchPattern: matchOrdinalNumberPattern$1, 10155 parsePattern: parseOrdinalNumberPattern$1, 10156 valueCallback: function valueCallback(value) { 10157 return parseInt(value, 10); 10158 } 10159 }), 10160 era: buildMatchFn$1({ 10161 matchPatterns: matchEraPatterns$1, 10162 defaultMatchWidth: "wide", 10163 parsePatterns: parseEraPatterns$1, 10164 defaultParseWidth: "any" 10165 }), 10166 quarter: buildMatchFn$1({ 10167 matchPatterns: matchQuarterPatterns$1, 10168 defaultMatchWidth: "wide", 10169 parsePatterns: parseQuarterPatterns$1, 10170 defaultParseWidth: "any", 10171 valueCallback: function valueCallback2(index) { 10172 return index + 1; 10173 } 10174 }), 10175 month: buildMatchFn$1({ 10176 matchPatterns: matchMonthPatterns$1, 10177 defaultMatchWidth: "wide", 10178 parsePatterns: parseMonthPatterns$1, 10179 defaultParseWidth: "any" 10180 }), 10181 day: buildMatchFn$1({ 10182 matchPatterns: matchDayPatterns$1, 10183 defaultMatchWidth: "wide", 10184 parsePatterns: parseDayPatterns$1, 10185 defaultParseWidth: "any" 10186 }), 10187 dayPeriod: buildMatchFn$1({ 10188 matchPatterns: matchDayPeriodPatterns$1, 10189 defaultMatchWidth: "any", 10190 parsePatterns: parseDayPeriodPatterns$1, 10191 defaultParseWidth: "any" 10192 }) 10193}; 10194const match$4 = match$3; 10195var locale$1 = { 10196 code: "it", 10197 formatDistance: formatDistance$3, 10198 formatLong: formatLong$3, 10199 formatRelative: formatRelative$3, 10200 localize: localize$3, 10201 match: match$4, 10202 options: { 10203 weekStartsOn: 1, 10204 firstWeekContainsDate: 4 10205 } 10206}; 10207const itIT = locale$1; 10208const dateItIT = {
10209 name: "it-IT", 10210 locale: itIT 10211}; 10212const dateItIT$1 = dateItIT; 10213const configProviderProps = { 10214 abstract: Boolean, 10215 bordered: { 10216 type: Boolean, 10217 default: void 0 10218 }, 10219 clsPrefix: { 10220 type: String, 10221 default: defaultClsPrefix$1 10222 }, 10223 locale: Object, 10224 dateLocale: Object, 10225 namespace: String, 10226 rtl: Array, 10227 tag: { 10228 type: String, 10229 default: "div" 10230 }, 10231 hljs: Object, 10232 katex: Object, 10233 theme: Object, 10234 themeOverrides: Object, 10235 componentOptions: Object, 10236 icons: Object, 10237 breakpoints: Object, 10238 preflightStyleDisabled: Boolean, 10239 inlineThemeDisabled: { 10240 type: Boolean, 10241 default: void 0 10242 }, 10243 // deprecated 10244 as: { 10245 type: String, 10246 validator: () => { 10247 warn$3("config-provider", "`as` is deprecated, please use `tag` instead."); 10248 return true; 10249 }, 10250 default: void 0 10251 } 10252}; 10253const NConfigProvider = defineComponent({ 10254 name: "ConfigProvider", 10255 alias: ["App"], 10256 props: configProviderProps, 10257 setup(props) { 10258 const NConfigProvider2 = inject(configProviderInjectionKey$1, null); 10259 const mergedThemeRef = computed(() => { 10260 const { 10261 theme 10262 } = props; 10263 if (theme === null) 10264 return void 0; 10265 const inheritedTheme = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeRef.value; 10266 return theme === void 0 ? inheritedTheme : inheritedTheme === void 0 ? theme : Object.assign({}, inheritedTheme, theme); 10267 }); 10268 const mergedThemeOverridesRef = computed(() => { 10269 const { 10270 themeOverrides 10271 } = props; 10272 if (themeOverrides === null) 10273 return void 0; 10274 if (themeOverrides === void 0) { 10275 return NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeOverridesRef.value; 10276 } else { 10277 const inheritedThemeOverrides = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeOverridesRef.value; 10278 if (inheritedThemeOverrides === void 0) { 10279 return themeOverrides; 10280 } else { 10281 return merge$5({}, inheritedThemeOverrides, themeOverrides); 10282 } 10283 } 10284 }); 10285 const mergedNamespaceRef = useMemo$1(() => { 10286 const { 10287 namespace: namespace2 10288 } = props; 10289 return namespace2 === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedNamespaceRef.value : namespace2; 10290 }); 10291 const mergedBorderedRef = useMemo$1(() => { 10292 const { 10293 bordered 10294 } = props; 10295 return bordered === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBorderedRef.value : bordered; 10296 }); 10297 const mergedIconsRef = computed(() => { 10298 const { 10299 icons 10300 } = props; 10301 return icons === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedIconsRef.value : icons; 10302 }); 10303 const mergedComponentPropsRef = computed(() => { 10304 const { 10305 componentOptions 10306 } = props; 10307 if (componentOptions !== void 0) 10308 return componentOptions; 10309 return NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedComponentPropsRef.value; 10310 }); 10311 const mergedClsPrefixRef = computed(() => { 10312 const { 10313 clsPrefix 10314 } = props; 10315 if (clsPrefix !== void 0) 10316 return clsPrefix; 10317 if (NConfigProvider2) 10318 return NConfigProvider2.mergedClsPrefixRef.value; 10319 return defaultClsPrefix$1; 10320 }); 10321 const mergedRtlRef = computed(() => { 10322 var _a2; 10323 const { 10324 rtl 10325 } = props; 10326 if (rtl === void 0) { 10327 return NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedRtlRef.value; 10328 } 10329 const rtlEnabledState = {}; 10330 for (const rtlInfo of rtl) { 10331 rtlEnabledState[rtlInfo.name] = markRaw(rtlInfo); 10332 (_a2 = rtlInfo.peers) === null || _a2 === void 0 ? void 0 : _a2.forEach((peerRtlInfo) => { 10333 if (!(peerRtlInfo.name in rtlEnabledState)) { 10334 rtlEnabledState[peerRtlInfo.name] = markRaw(peerRtlInfo); 10335 } 10336 }); 10337 } 10338 return rtlEnabledState; 10339 }); 10340 const mergedBreakpointsRef = computed(() => { 10341 return props.breakpoints || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBreakpointsRef.value); 10342 }); 10343 const inlineThemeDisabled = props.inlineThemeDisabled || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.inlineThemeDisabled); 10344 const preflightStyleDisabled = props.preflightStyleDisabled || (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.preflightStyleDisabled); 10345 const mergedThemeHashRef = computed(() => { 10346 const { 10347 value: theme 10348 } = mergedThemeRef; 10349 const { 10350 value: mergedThemeOverrides 10351 } = mergedThemeOverridesRef; 10352 const hasThemeOverrides = mergedThemeOverrides && Object.keys(mergedThemeOverrides).length !== 0; 10353 const themeName = theme === null || theme === void 0 ? void 0 : theme.name; 10354 if (themeName) { 10355 if (hasThemeOverrides) { 10356 return `${themeName}-${murmur2$1(JSON.stringify(mergedThemeOverridesRef.value))}`; 10357 } 10358 return themeName; 10359 } else { 10360 if (hasThemeOverrides) { 10361 return murmur2$1(JSON.stringify(mergedThemeOverridesRef.value)); 10362 } 10363 return ""; 10364 } 10365 }); 10366 provide(configProviderInjectionKey$1, { 10367 mergedThemeHashRef, 10368 mergedBreakpointsRef, 10369 mergedRtlRef, 10370 mergedIconsRef, 10371 mergedComponentPropsRef, 10372 mergedBorderedRef, 10373 mergedNamespaceRef, 10374 mergedClsPrefixRef, 10375 mergedLocaleRef: computed(() => { 10376 const { 10377 locale: locale2 10378 } = props; 10379 if (locale2 === null) 10380 return void 0; 10381 return locale2 === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedLocaleRef.value : locale2; 10382 }), 10383 mergedDateLocaleRef: computed(() => { 10384 const { 10385 dateLocale 10386 } = props; 10387 if (dateLocale === null) 10388 return void 0; 10389 return dateLocale === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedDateLocaleRef.value : dateLocale; 10390 }), 10391 mergedHljsRef: computed(() => { 10392 const { 10393 hljs 10394 } = props; 10395 return hljs === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedHljsRef.value : hljs; 10396 }), 10397 mergedKatexRef: computed(() => { 10398 const { 10399 katex 10400 } = props; 10401 return katex === void 0 ? NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedKatexRef.value : katex; 10402 }), 10403 mergedThemeRef, 10404 mergedThemeOverridesRef, 10405 inlineThemeDisabled: inlineThemeDisabled || false, 10406 preflightStyleDisabled: preflightStyleDisabled || false 10407 }); 10408 return { 10409 mergedClsPrefix: mergedClsPrefixRef, 10410 mergedBordered: mergedBorderedRef, 10411 mergedNamespace: mergedNamespaceRef, 10412 mergedTheme: mergedThemeRef, 10413 mergedThemeOverrides: mergedThemeOverridesRef 10414 }; 10415 }, 10416 render() { 10417 var _a2, _b, _c, _d; 10418 return !this.abstract ? h(this.as || this.tag, { 10419 class: `${this.mergedClsPrefix || defaultClsPrefix$1}-config-provider` 10420 }, (_b = (_a2 = this.$slots).default) === null || _b === void 0 ? void 0 : _b.call(_a2)) : (_d = (_c = this.$slots).default) === null || _d === void 0 ? void 0 : _d.call(_c); 10421 } 10422}); 10423var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; 10424function getDefaultExportFromCjs(x) { 10425 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; 10426} 10427let onceCbs = [];
10428const paramsMap = /* @__PURE__ */ new WeakMap(); 10429function flushOnceCallbacks() { 10430 onceCbs.forEach((cb) => cb(...paramsMap.get(cb))); 10431 onceCbs = []; 10432} 10433function beforeNextFrameOnce(cb, ...params) { 10434 paramsMap.set(cb, params); 10435 if (onceCbs.includes(cb)) 10436 return; 10437 onceCbs.push(cb) === 1 && requestAnimationFrame(flushOnceCallbacks); 10438} 10439function happensIn(e, dataSetPropName) { 10440 let { target } = e; 10441 while (target) { 10442 if (target.dataset) { 10443 if (target.dataset[dataSetPropName] !== void 0) 10444 return true; 10445 } 10446 target = target.parentElement; 10447 } 10448 return false; 10449} 10450function getPreciseEventTarget(event) { 10451 return event.composedPath()[0] || null; 10452} 10453function depx(value) { 10454 if (typeof value === "string") { 10455 if (value.endsWith("px")) { 10456 return Number(value.slice(0, value.length - 2)); 10457 } 10458 return Number(value); 10459 } 10460 return value; 10461} 10462function pxfy(value) { 10463 if (value === void 0 || value === null) 10464 return void 0; 10465 if (typeof value === "number") 10466 return `${value}px`; 10467 if (value.endsWith("px")) 10468 return value; 10469 return `${value}px`; 10470} 10471function getMargin(value, position) { 10472 const parts = value.trim().split(/\s+/g); 10473 const margin = { 10474 top: parts[0] 10475 }; 10476 switch (parts.length) { 10477 case 1: 10478 margin.right = parts[0]; 10479 margin.bottom = parts[0]; 10480 margin.left = parts[0]; 10481 break; 10482 case 2: 10483 margin.right = parts[1]; 10484 margin.left = parts[1]; 10485 margin.bottom = parts[0]; 10486 break; 10487 case 3: 10488 margin.right = parts[1]; 10489 margin.bottom = parts[2]; 10490 margin.left = parts[1]; 10491 break; 10492 case 4: 10493 margin.right = parts[1]; 10494 margin.bottom = parts[2]; 10495 margin.left = parts[3]; 10496 break; 10497 default: 10498 throw new Error("[seemly/getMargin]:" + value + " is not a valid value."); 10499 } 10500 if (position === void 0) 10501 return margin; 10502 return margin[position]; 10503} 10504const colors = { 10505 black: "#000", 10506 silver: "#C0C0C0", 10507 gray: "#808080", 10508 white: "#FFF", 10509 maroon: "#800000", 10510 red: "#F00", 10511 purple: "#800080", 10512 fuchsia: "#F0F", 10513 green: "#008000", 10514 lime: "#0F0", 10515 olive: "#808000", 10516 yellow: "#FF0", 10517 navy: "#000080", 10518 blue: "#00F", 10519 teal: "#008080", 10520 aqua: "#0FF", 10521 transparent: "#0000" 10522}; 10523const prefix$1 = "^\\s*"; 10524const suffix = "\\s*$"; 10525const float = "\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*"; 10526const hex = "([0-9A-Fa-f])"; 10527const dhex = "([0-9A-Fa-f]{2})"; 10528const rgbRegex = new RegExp(`${prefix$1}rgb\\s*\\(${float},${float},${float}\\)${suffix}`); 10529const rgbaRegex = new RegExp(`${prefix$1}rgba\\s*\\(${float},${float},${float},${float}\\)${suffix}`); 10530const sHexRegex = new RegExp(`${prefix$1}#${hex}${hex}${hex}${suffix}`); 10531const hexRegex = new RegExp(`${prefix$1}#${dhex}${dhex}${dhex}${suffix}`); 10532const sHexaRegex = new RegExp(`${prefix$1}#${hex}${hex}${hex}${hex}${suffix}`); 10533const hexaRegex = new RegExp(`${prefix$1}#${dhex}${dhex}${dhex}${dhex}${suffix}`); 10534function parseHex(value) { 10535 return parseInt(value, 16); 10536} 10537function rgba(color) { 10538 try { 10539 let i; 10540 if (i = hexRegex.exec(color)) { 10541 return [parseHex(i[1]), parseHex(i[2]), parseHex(i[3]), 1]; 10542 } else if (i = rgbRegex.exec(color)) { 10543 return [roundChannel(i[1]), roundChannel(i[5]), roundChannel(i[9]), 1]; 10544 } else if (i = rgbaRegex.exec(color)) { 10545 return [ 10546 roundChannel(i[1]), 10547 roundChannel(i[5]), 10548 roundChannel(i[9]), 10549 roundAlpha(i[13]) 10550 ]; 10551 } else if (i = sHexRegex.exec(color)) { 10552 return [ 10553 parseHex(i[1] + i[1]), 10554 parseHex(i[2] + i[2]), 10555 parseHex(i[3] + i[3]), 10556 1 10557 ]; 10558 } else if (i = hexaRegex.exec(color)) { 10559 return [ 10560 parseHex(i[1]), 10561 parseHex(i[2]), 10562 parseHex(i[3]), 10563 roundAlpha(parseHex(i[4]) / 255) 10564 ]; 10565 } else if (i = sHexaRegex.exec(color)) { 10566 return [ 10567 parseHex(i[1] + i[1]), 10568 parseHex(i[2] + i[2]), 10569 parseHex(i[3] + i[3]), 10570 roundAlpha(parseHex(i[4] + i[4]) / 255) 10571 ]; 10572 } else if (color in colors) { 10573 return rgba(colors[color]); 10574 } 10575 throw new Error(`[seemly/rgba]: Invalid color value ${color}.`); 10576 } catch (e) { 10577 throw e; 10578 } 10579} 10580function normalizeAlpha(alphaValue) { 10581 return alphaValue > 1 ? 1 : alphaValue < 0 ? 0 : alphaValue; 10582} 10583function stringifyRgba(r, g, b, a) { 10584 return `rgba(${roundChannel(r)}
10584, ${roundChannel(g)}, ${roundChannel(b)}, ${normalizeAlpha(a)})`; 10585} 10586function compositeChannel(v1, a1, v2, a2, a) { 10587 return roundChannel((v1 * a1 * (1 - a2) + v2 * a2) / a); 10588} 10589function composite(background, overlay2) { 10590 if (!Array.isArray(background)) 10591 background = rgba(background); 10592 if (!Array.isArray(overlay2)) 10593 overlay2 = rgba(overlay2); 10594 const a1 = background[3]; 10595 const a2 = overlay2[3]; 10596 const alpha = roundAlpha(a1 + a2 - a1 * a2); 10597 return stringifyRgba(compositeChannel(background[0], a1, overlay2[0], a2, alpha), compositeChannel(background[1], a1, overlay2[1], a2, alpha), compositeChannel(background[2], a1, overlay2[2], a2, alpha), alpha); 10598} 10599function changeColor(base2, options) { 10600 const [r, g, b, a = 1] = Array.isArray(base2) ? base2 : rgba(base2); 10601 if (options.alpha) { 10602 return stringifyRgba(r, g, b, options.alpha); 10603 } 10604 return stringifyRgba(r, g, b, a); 10605} 10606function scaleColor(base2, options) { 10607 const [r, g, b, a = 1] = Array.isArray(base2) ? base2 : rgba(base2); 10608 const { lightness = 1, alpha = 1 } = options; 10609 return toRgbaString([r * lightness, g * lightness, b * lightness, a * alpha]); 10610} 10611function roundAlpha(value) { 10612 const v = Math.round(Number(value) * 100) / 100; 10613 if (v > 1) 10614 return 1; 10615 if (v < 0) 10616 return 0; 10617 return v; 10618} 10619function roundChannel(value) { 10620 const v = Math.round(Number(value)); 10621 if (v > 255) 10622 return 255; 10623 if (v < 0) 10624 return 0; 10625 return v; 10626} 10627function toRgbaString(base2) { 10628 const [r, g, b] = base2; 10629 if (3 in base2) { 10630 return `rgba(${roundChannel(r)}, ${roundChannel(g)}, ${roundChannel(b)}, ${roundAlpha(base2[3])})`; 10631 } 10632 return `rgba(${roundChannel(r)}, ${roundChannel(g)}, ${roundChannel(b)}, 1)`; 10633} 10634function createId(length = 8) { 10635 return Math.random().toString(16).slice(2, 2 + length); 10636} 10637function repeat(count, v) { 10638 const ret = []; 10639 for (let i = 0; i < count; ++i) { 10640 ret.push(v); 10641 } 10642 return ret; 10643} 10644function getSlot$1(instance, slotName = "default", fallback = []) { 10645 const slots = instance.$slots; 10646 const slot = slots[slotName]; 10647 if (slot === void 0) 10648 return fallback; 10649 return slot(); 10650} 10651function keep(object4, keys2 = [], rest) { 10652 const keepedObject = {}; 10653 keys2.forEach((key) => { 10654 keepedObject[key] = object4[key]; 10655 }); 10656 return Object.assign(keepedObject, rest); 10657} 10658function flatten$2(vNodes, filterCommentNode = true, result = []) { 10659 vNodes.forEach((vNode) => { 10660 if (vNode === null) 10661 return; 10662 if (typeof vNode !== "object") { 10663 if (typeof vNode === "string" || typeof vNode === "number") { 10664 result.push(createTextVNode(String(vNode))); 10665 } 10666 return; 10667 } 10668 if (Array.isArray(vNode)) { 10669 flatten$2(vNode, filterCommentNode, result); 10670 return; 10671 } 10672 if (vNode.type === Fragment) { 10673 if (vNode.children === null) 10674 return; 10675 if (Array.isArray(vNode.children)) { 10676 flatten$2(vNode.children, filterCommentNode, result); 10677 } 10678 } else { 10679 if (vNode.type === Comment && filterCommentNode) 10680 return; 10681 result.push(vNode); 10682 } 10683 }); 10684 return result; 10685} 10686function call(funcs, ...args) { 10687 if (Array.isArray(funcs)) { 10688 funcs.forEach((func) => call(func, ...args)); 10689 } else 10690 return funcs(...args); 10691} 10692function keysOf(obj) { 10693 return Object.keys(obj); 10694} 10695const render$4 = (r, ...args) => { 10696 if (typeof r === "function") { 10697 return r(...args); 10698 } else if (typeof r === "string") { 10699 return createTextVNode(r); 10700 } else if (typeof r === "number") { 10701 return createTextVNode(String(r)); 10702 } else { 10703 return null; 10704 } 10705}; 10706function warn$2(location, message) { 10707 console.error(`[naive/${location}]: ${message}`); 10708} 10709function throwError(location, message) { 10710 throw new Error(`[naive/${location}]: ${message}`); 10711} 10712function getTitleAttribute(value) { 10713 switch (typeof value) { 10714 case "string": 10715 return value || void 0; 10716 case "number": 10717 return String(value); 10718 default: 10719 return void 0; 10720 } 10721} 10722function getFirstSlotVNode(slots, slotName = "default", props = void 0) { 10723 const slot = slots[slotName]; 10724 if (!slot) { 10725 warn$2("getFirstSlotVNode", `slot[${slotName}] is empty`); 10726 return null; 10727 } 10728 const slotContent = flatten$2(slot(props)); 10729 if (slotContent.length === 1) { 10730 return slotContent[0]; 10731 } else { 10732 warn$2("getFirstSlotVNode", `slot[${slotName}] should have exactly one child`); 10733 return null; 10734 } 10735} 10736function createInjectionKey(key) { 10737 return key; 10738} 10739function ensureValidVNode(vnodes) { 10740 return vnodes.some((child) => { 10741 if (!isVNode(child)) { 10742 return true; 10743 } 10744 if (child.type === Comment) { 10745 return false;
10746 } 10747 if (child.type === Fragment && !ensureValidVNode(child.children)) { 10748 return false; 10749 } 10750 return true; 10751 }) ? vnodes : null; 10752} 10753function resolveSlot(slot, fallback) { 10754 return slot && ensureValidVNode(slot()) || fallback(); 10755} 10756function resolveSlotWithProps(slot, props, fallback) { 10757 return slot && ensureValidVNode(slot(props)) || fallback(props); 10758} 10759function resolveWrappedSlot(slot, wrapper) { 10760 const children = slot && ensureValidVNode(slot()); 10761 return wrapper(children || null); 10762} 10763function resolveWrappedSlotWithProps(slot, props, wrapper) { 10764 const children = slot && ensureValidVNode(slot(props)); 10765 return wrapper(children || null); 10766} 10767function isSlotEmpty(slot) { 10768 return !(slot && ensureValidVNode(slot())); 10769} 10770function mergeEventHandlers(handlers) { 10771 const filteredHandlers = handlers.filter((handler) => handler !== void 0); 10772 if (filteredHandlers.length === 0) 10773 return void 0; 10774 if (filteredHandlers.length === 1) 10775 return filteredHandlers[0]; 10776 return (e) => { 10777 handlers.forEach((handler) => { 10778 if (handler) { 10779 handler(e); 10780 } 10781 }); 10782 }; 10783} 10784const Wrapper = defineComponent({ 10785 render() { 10786 var _a2, _b; 10787 return (_b = (_a2 = this.$slots).default) === null || _b === void 0 ? void 0 : _b.call(_a2); 10788 } 10789}); 10790const pureNumberRegex = /^(\d|\.)+$/; 10791const numberRegex = /(\d|\.)+/; 10792function formatLength(length, { 10793 c: c2 = 1, 10794 offset: offset2 = 0, 10795 attachPx = true 10796} = {}) { 10797 if (typeof length === "number") { 10798 const result = (length + offset2) * c2; 10799 if (result === 0) 10800 return "0"; 10801 return `${result}px`; 10802 } else if (typeof length === "string") { 10803 if (pureNumberRegex.test(length)) { 10804 const result = (Number(length) + offset2) * c2; 10805 if (attachPx) { 10806 if (result === 0) 10807 return "0"; 10808 return `${result}px`; 10809 } else { 10810 return `${result}`; 10811 } 10812 } else { 10813 const result = numberRegex.exec(length); 10814 if (!result) 10815 return length; 10816 return length.replace(numberRegex, String((Number(result[0]) + offset2) * c2)); 10817 } 10818 } 10819 return length; 10820} 10821function color2Class(color) { 10822 return color.replace(/#|\(|\)|,|\s|\./g, "_"); 10823} 10824function ampCount(selector) { 10825 let cnt = 0; 10826 for (let i = 0; i < selector.length; ++i) { 10827 if (selector[i] === "&") 10828 ++cnt; 10829 } 10830 return cnt; 10831} 10832const separatorRegex = /\s*,(?![^(]*\))\s*/g; 10833const extraSpaceRegex = /\s+/g; 10834function resolveSelectorWithAmp(amp, selector) { 10835 const nextAmp = []; 10836 selector.split(separatorRegex).forEach((partialSelector) => { 10837 let round = ampCount(partialSelector); 10838 if (!round) { 10839 amp.forEach((partialAmp) => { 10840 nextAmp.push( 10841 // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions 10842 (partialAmp && partialAmp + " ") + partialSelector 10843 ); 10844 }); 10845 return; 10846 } else if (round === 1) { 10847 amp.forEach((partialAmp) => { 10848 nextAmp.push(partialSelector.replace("&", partialAmp)); 10849 }); 10850 return; 10851 } 10852 let partialNextAmp = [ 10853 partialSelector 10854 ]; 10855 while (round--) { 10856 const nextPartialNextAmp = []; 10857 partialNextAmp.forEach((selectorItr) => { 10858 amp.forEach((partialAmp) => { 10859 nextPartialNextAmp.push(selectorItr.replace("&", partialAmp)); 10860 }); 10861 }); 10862 partialNextAmp = nextPartialNextAmp; 10863 } 10864 partialNextAmp.forEach((part) => nextAmp.push(part)); 10865 }); 10866 return nextAmp; 10867} 10868function resolveSelector(amp, selector) { 10869 const nextAmp = []; 10870 selector.split(separatorRegex).forEach((partialSelector) => { 10871 amp.forEach((partialAmp) => { 10872 nextAmp.push((partialAmp && partialAmp + " ") + partialSelector); 10873 }); 10874 }); 10875 return nextAmp; 10876} 10877function parseSelectorPath(selectorPaths) { 10878 let amp = [""]; 10879 selectorPaths.forEach((selector) => { 10880 selector = selector && selector.trim(); 10881 if ( 10882 // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions 10883 !selector 10884 ) { 10885 return; 10886 } 10887 if (selector.includes("&")) { 10888 amp = resolveSelectorWithAmp(amp, selector); 10889 } else { 10890 amp = resolveSelector(amp, selector); 10891 } 10892 }); 10893 return amp.join(", ").replace(extraSpaceRegex, " "); 10894} 10895function removeElement(el) { 10896 if (!el) 10897 return; 10898 const parentElement = el.parentElement; 10899 if (parentElement) 10900 parentElement.removeChild(el); 10901} 10902function queryElement(id, parent) { 10903 return (parent !== null && parent !== void 0 ? parent : document.head).querySelector(`style[cssr-id="${id}"]`); 10904} 10905function createElement(id) { 10906 const el = document.createElement("style"); 10907 el.setAttribute("cssr-id", id); 10908 return el; 10909} 10910function isMediaOrSupports(selector) { 10911 if (!selector) 10912 return false;
10913 return /^\s*@(s|m)/.test(selector); 10914} 10915const kebabRegex = /[A-Z]/g; 10916function kebabCase(pattern4) { 10917 return pattern4.replace(kebabRegex, (match2) => "-" + match2.toLowerCase()); 10918} 10919function unwrapProperty(prop, indent = " ") { 10920 if (typeof prop === "object" && prop !== null) { 10921 return " {\n" + Object.entries(prop).map((v) => { 10922 return indent + ` ${kebabCase(v[0])}: ${v[1]};`; 10923 }).join("\n") + "\n" + indent + "}"; 10924 } 10925 return `: ${prop};`; 10926} 10927function unwrapProperties(props, instance, params) { 10928 if (typeof props === "function") { 10929 return props({ 10930 context: instance.context, 10931 props: params 10932 }); 10933 } 10934 return props; 10935} 10936function createStyle(selector, props, instance, params) { 10937 if (!props) 10938 return ""; 10939 const unwrappedProps = unwrapProperties(props, instance, params); 10940 if (!unwrappedProps) 10941 return ""; 10942 if (typeof unwrappedProps === "string") { 10943 return `${selector} { 10944${unwrappedProps} 10945}`; 10946 } 10947 const propertyNames = Object.keys(unwrappedProps); 10948 if (propertyNames.length === 0) { 10949 if (instance.config.keepEmptyBlock) 10950 return selector + " {\n}"; 10951 return ""; 10952 } 10953 const statements = selector ? [ 10954 selector + " {" 10955 ] : []; 10956 propertyNames.forEach((propertyName) => { 10957 const property2 = unwrappedProps[propertyName]; 10958 if (propertyName === "raw") { 10959 statements.push("\n" + property2 + "\n"); 10960 return; 10961 } 10962 propertyName = kebabCase(propertyName); 10963 if (property2 !== null && property2 !== void 0) { 10964 statements.push(` ${propertyName}${unwrapProperty(property2)}`); 10965 } 10966 }); 10967 if (selector) { 10968 statements.push("}"); 10969 } 10970 return statements.join("\n"); 10971} 10972function loopCNodeListWithCallback(children, options, callback) { 10973 if (!children) 10974 return; 10975 children.forEach((child) => { 10976 if (Array.isArray(child)) { 10977 loopCNodeListWithCallback(child, options, callback); 10978 } else if (typeof child === "function") { 10979 const grandChildren = child(options); 10980 if (Array.isArray(grandChildren)) { 10981 loopCNodeListWithCallback(grandChildren, options, callback); 10982 } else if (grandChildren) { 10983 callback(grandChildren); 10984 } 10985 } else if (child) { 10986 callback(child); 10987 } 10988 }); 10989} 10990function traverseCNode(node, selectorPaths, styles2, instance, params) { 10991 const $ = node.$; 10992 let blockSelector = ""; 10993 if (!$ || typeof $ === "string") { 10994 if (isMediaOrSupports($)) { 10995 blockSelector = $; 10996 } else { 10997 selectorPaths.push($); 10998 } 10999 } else if (typeof $ === "function") { 11000 const selector2 = $({ 11001 context: instance.context, 11002 props: params 11003 }); 11004 if (isMediaOrSupports(selector2)) { 11005 blockSelector = selector2; 11006 } else { 11007 selectorPaths.push(selector2); 11008 } 11009 } else { 11010 if ($.before) 11011 $.before(instance.context); 11012 if (!$.$ || typeof $.$ === "string") { 11013 if (isMediaOrSupports($.$)) { 11014 blockSelector = $.$; 11015 } else { 11016 selectorPaths.push($.$); 11017 } 11018 } else if ($.$) { 11019 const selector2 = $.$({ 11020 context: instance.context, 11021 props: params 11022 }); 11023 if (isMediaOrSupports(selector2)) { 11024 blockSelector = selector2; 11025 } else { 11026 selectorPaths.push(selector2); 11027 } 11028 } 11029 } 11030 const selector = parseSelectorPath(selectorPaths); 11031 const style2 = createStyle(selector, node.props, instance, params); 11032 if (blockSelector) { 11033 styles2.push(`${blockSelector} {`); 11034 } else if (style2.length) { 11035 styles2.push(style2); 11036 } 11037 if (node.children) { 11038 loopCNodeListWithCallback(node.children, { 11039 context: instance.context, 11040 props: params 11041 }, (childNode) => { 11042 if (typeof childNode === "string") { 11043 const style3 = createStyle(selector, { raw: childNode }, instance, params); 11044 styles2.push(style3); 11045 } else { 11046 traverseCNode(childNode, selectorPaths, styles2, instance, params); 11047 } 11048 }); 11049 } 11050 selectorPaths.pop(); 11051 if (blockSelector) { 11052 styles2.push("}"); 11053 } 11054 if ($ && $.after) 11055 $.after(instance.context); 11056} 11057function render$3(node, instance, props) { 11058 const styles2 = []; 11059 traverseCNode(node, [], styles2, instance, props); 11060 return styles2.join("\n\n"); 11061} 11062function murmur2(str) { 11063 var h2 = 0; 11064 var k, i = 0, len2 = str.length; 11065 for (; len2 >= 4; ++i, len2 -= 4) { 11066 k = str.charCodeAt(i) & 255 | (str.charCodeAt(++i) & 255) << 8 | (str.charCodeAt(++i) & 255) << 16 | (str.charCodeAt(++i) & 255) << 24; 11067 k = /* Math.imul(k, m): */ 11068 (k & 65535) * 1540483477 + ((k >>> 16) * 59797 << 16); 11069 k ^= /* k >>> r: */ 11070 k >>> 24; 11071 h2 = /* Math.imul(k, m): */ 11072 (k & 65535) * 1540483477 + ((k >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */ 11073 (h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16); 11074 } 11075 switch (len2) { 11076 case 3: 11077 h2 ^= (str.charCodeAt(i + 2) & 255) << 16; 11078 case 2: 11079 h2 ^= (str.charCodeAt(i + 1) & 255) << 8; 11080 case 1: 11081 h2 ^= str.charCodeAt(i) & 255; 11082 h2 = /* Math.imul(h, m): */ 11083 (h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16); 11084 } 11085 h2 ^= h2 >>> 13; 11086 h2 = /* Math.imul(h, m): */ 11087 (h2 & 65535) * 1540483477 + ((h2 >>> 16) * 59797 << 16); 11088 return ((h2 ^ h2 >>> 15) >>> 0).toString(36); 11089} 11090if (typeof window !== "undefined") { 11091 window.__cssrContext = {}; 11092} 11093function unmount(instance, node, id, parent) { 11094 const { els } = node; 11095 if (id === void 0) {
11096 els.forEach(removeElement); 11097 node.els = []; 11098 } else { 11099 const target = queryElement(id, parent); 11100 if (target && els.includes(target)) { 11101 removeElement(target); 11102 node.els = els.filter((el) => el !== target); 11103 } 11104 } 11105} 11106function addElementToList(els, target) { 11107 els.push(target); 11108} 11109function mount(instance, node, id, props, head, force, anchorMetaName, parent, ssrAdapter2) { 11110 let style2; 11111 if (id === void 0) { 11112 style2 = node.render(props); 11113 id = murmur2(style2); 11114 } 11115 if (ssrAdapter2) { 11116 ssrAdapter2.adapter(id, style2 !== null && style2 !== void 0 ? style2 : node.render(props)); 11117 return; 11118 } 11119 if (parent === void 0) { 11120 parent = document.head; 11121 } 11122 const queriedTarget = queryElement(id, parent); 11123 if (queriedTarget !== null && !force) { 11124 return queriedTarget; 11125 } 11126 const target = queriedTarget !== null && queriedTarget !== void 0 ? queriedTarget : createElement(id); 11127 if (style2 === void 0) 11128 style2 = node.render(props); 11129 target.textContent = style2; 11130 if (queriedTarget !== null) 11131 return queriedTarget; 11132 if (anchorMetaName) { 11133 const anchorMetaEl = parent.querySelector(`meta[name="${anchorMetaName}"]`); 11134 if (anchorMetaEl) { 11135 parent.insertBefore(target, anchorMetaEl); 11136 addElementToList(node.els, target); 11137 return target; 11138 } 11139 } 11140 if (head) { 11141 parent.insertBefore(target, parent.querySelector("style, link")); 11142 } else { 11143 parent.appendChild(target); 11144 } 11145 addElementToList(node.els, target); 11146 return target; 11147} 11148function wrappedRender(props) { 11149 return render$3(this, this.instance, props); 11150} 11151function wrappedMount(options = {}) { 11152 const { id, ssr, props, head = false, force = false, anchorMetaName, parent } = options; 11153 const targetElement = mount(this.instance, this, id, props, head, force, anchorMetaName, parent, ssr); 11154 return targetElement; 11155} 11156function wrappedUnmount(options = {}) { 11157 const { id, parent } = options; 11158 unmount(this.instance, this, id, parent); 11159} 11160const createCNode = function(instance, $, props, children) { 11161 return { 11162 instance, 11163 $, 11164 props, 11165 children, 11166 els: [], 11167 render: wrappedRender, 11168 mount: wrappedMount, 11169 unmount: wrappedUnmount 11170 }; 11171}; 11172const c$2 = function(instance, $, props, children) { 11173 if (Array.isArray($)) { 11174 return createCNode(instance, { $: null }, null, $); 11175 } else if (Array.isArray(props)) { 11176 return createCNode(instance, $, null, props); 11177 } else if (Array.isArray(children)) { 11178 return createCNode(instance, $, props, children); 11179 } else { 11180 return createCNode(instance, $, props, null); 11181 } 11182}; 11183function CssRender(config = {}) { 11184 const cssr2 = { 11185 c: (...args) => c$2(cssr2, ...args), 11186 use: (plugin2, ...args) => plugin2.install(cssr2, ...args), 11187 find: queryElement, 11188 context: {}, 11189 config 11190 }; 11191 return cssr2; 11192} 11193function exists(id, ssr) { 11194 if (id === void 0) 11195 return false; 11196 if (ssr) { 11197 const { context: { ids } } = ssr; 11198 return ids.has(id); 11199 } 11200 return queryElement(id) !== null; 11201} 11202function plugin$1(options) { 11203 let _bPrefix = "."; 11204 let _ePrefix = "__"; 11205 let _mPrefix = "--"; 11206 let c2; 11207 if (options) { 11208 let t = options.blockPrefix; 11209 if (t) { 11210 _bPrefix = t; 11211 } 11212 t = options.elementPrefix; 11213 if (t) { 11214 _ePrefix = t; 11215 } 11216 t = options.modifierPrefix; 11217 if (t) { 11218 _mPrefix = t; 11219 } 11220 } 11221 const _plugin = { 11222 install(instance) { 11223 c2 = instance.c; 11224 const ctx2 = instance.context; 11225 ctx2.bem = {}; 11226 ctx2.bem.b = null; 11227 ctx2.bem.els = null; 11228 } 11229 }; 11230 function b(arg) { 11231 let memorizedB; 11232 let memorizedE; 11233 return { 11234 before(ctx2) { 11235 memorizedB = ctx2.bem.b; 11236 memorizedE = ctx2.bem.els; 11237 ctx2.bem.els = null; 11238 }, 11239 after(ctx2) { 11240 ctx2.bem.b = memorizedB; 11241 ctx2.bem.els = memorizedE; 11242 }, 11243 $({ context, props }) { 11244 arg = typeof arg === "string" ? arg : arg({ context, props }); 11245 context.bem.b = arg; 11246 return `${(props === null || props === void 0 ? void 0 : props.bPrefix) || _bPrefix}${context.bem.b}`; 11247 } 11248 }; 11249 } 11250 function e(arg) { 11251 let memorizedE; 11252 return { 11253 before(ctx2) { 11254 memorizedE = ctx2.bem.els; 11255 }, 11256 after(ctx2) { 11257 ctx2.bem.els = memorizedE; 11258 }, 11259 $({ context, props }) { 11260 arg = typeof arg === "string" ? arg : arg({ context, props }); 11261 context.bem.els = arg.split(",").map((v) => v.trim()); 11262 return context.bem.els.map((el) => `${(props === null || props === void 0 ? void 0 : props.bPrefix) || _bPrefix}${context.bem.b}${_ePrefix}${el}`).join(", "); 11263 } 11264 }; 11265 } 11266 function m(arg) { 11267 return { 11268 $({ context, props }) { 11269 arg = typeof arg === "string" ? arg : arg({ context, props }); 11270 const modifiers = arg.split(",").map((v) => v.trim()); 11271 function elementToSelector(el) { 11272 return modifiers.map((modifier) => `&${(props === null || props === void 0 ? void 0 : props.bPrefix) || _bPrefix}${context.bem.b}${el !== void 0 ? `${_ePrefix}${el}` : ""}${_mPrefix}${modifier}`).join(", "); 11273 } 11274 const els = context.bem.els; 11275 if (els !== null) { 11276 return elementToSelector(els[0]); 11277 } else { 11278 return elementToSelector(); 11279 } 11280 } 11281 }; 11282 } 11283 function notM(arg) { 11284 return { 11285 $({ context, props }) { 11286 arg = typeof arg === "string" ? arg : arg({ context, props }); 11287 const els = context.bem.els; 11288 return `&:not(${(props === null || props === void 0 ? void 0 : props.bPrefix) || _bPrefix}${context.bem.b}${els !== null && els.length > 0 ? `${_ePrefix}${els[0]}` : ""}${_mPrefix}${arg})`; 11289 } 11290 }; 11291 } 11292 const cB2 = (...args) => c2(b(args[0]), args[1], args[2]); 11293 const cE2 = (...args) => c2(e(args[0]), args[1], args[2]); 11294 const cM2 = (...args) => c2(m(args[0]), args[1], args[2]); 11295 const cNotM2 = (...args) => c2(notM(args[0]), args[1], args[2]); 11296 Object.assign(_plugin, { 11297 cB: cB2, 11298 cE: cE2, 11299 cM: cM2, 11300 cNotM: cNotM2 11301 }); 11302 return _plugin; 11303} 11304const namespace = "n"; 11305const prefix = `.${namespace}-`; 11306const elementPrefix = "__"; 11307const modifierPrefix = "--"; 11308const cssr = CssRender(); 11309const plugin = plugin$1({ 11310 blockPrefix: prefix, 11311 elementPrefix, 11312 modifierPrefix 11313}); 11314cssr.use(plugin); 11315const { 11316 c: c$1, 11317 find 11318} = cssr; 11319const { 11320 cB, 11321 cE, 11322 cM, 11323 cNotM 11324} = plugin; 11325function insideModal(style2) { 11326 return c$1(({ 11327 props: { 11328 bPrefix 11329 } 11330 }) => `${bPrefix || prefix}modal, ${bPrefix || prefix}drawer`, [style2]); 11331} 11332function insidePopover(style2) { 11333 return c$1(({ 11334 props: { 11335 bPrefix 11336 } 11337 }) => `${bPrefix || prefix}popover`, [style2]); 11338} 11339function asModal(style2) { 11340 return c$1(({ 11341 props: { 11342 bPrefix 11343 } 11344 }) => `&${bPrefix || prefix}modal`, style2); 11345} 11346const cCB = (...args) => { 11347 return c$1(">", [cB(...args)]); 11348}; 11349function createKey(prefix2, suffix2) { 11350 return prefix2 + (suffix2 === "default" ? "" : suffix2.replace(/^[a-z]/, (startChar) => startChar.toUpperCase())); 11351} 11352let _isJsdom; 11353function isJsdom() { 11354 if (_isJsdom === void 0) { 11355 _isJsdom = navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"); 11356 } 11357 return _isJsdom; 11358} 11359const isBrowser$2 = typeof document !== "undefined" && typeof window !== "undefined"; 11360const eventSet = /* @__PURE__ */ new WeakSet(); 11361function markEventEffectPerformed(event) { 11362 eventSet.add(event); 11363} 11364function eventEffectNotPerformed(event) { 11365 return !eventSet.has(event); 11366} 11367function useInjectionInstanceCollection(injectionName, collectionKey, registerKeyRef) { 11368 var _a2; 11369 const injection = inject(injectionName, null); 11370 if (injection === null) 11371 return; 11372 const vm = (_a2 = getCurrentInstance()) === null || _a2 === void 0 ? void 0 : _a2.proxy; 11373 watch(registerKeyRef, registerInstance); 11374 registerInstance(registerKeyRef.value); 11375 onBeforeUnmount(() => { 11376 registerInstance(void 0, registerKeyRef.value); 11377 }); 11378 function registerInstance(key, oldKey) { 11379 if (!injection) 11380 return; 11381 const collection = injection[collectionKey]; 11382 if (oldKey !== void 0) 11383 removeInstance(collection, oldKey); 11384 if (key !== void 0) 11385 addInstance(collection, key); 11386 } 11387 function removeInstance(collection, key) { 11388 if (!collection[key]) 11389 collection[key] = []; 11390 collection[key].splice(collection[key].findIndex((instance) => instance === vm), 1); 11391 } 11392 function addInstance(collection, key) { 11393 if (!collection[key]) 11394 collection[key] = []; 11395 if (!~collection[key].findIndex((instance) => instance === vm)) { 11396 collection[key].push(vm); 11397 } 11398 } 11399} 11400function useFalseUntilTruthy(originalRef) { 11401 const currentRef = ref(!!originalRef.value); 11402 if (currentRef.value) 11403 return readonly(currentRef); 11404 const stop2 = watch(originalRef, (value) => { 11405 if (value) { 11406 currentRef.value = true; 11407 stop2(); 11408 } 11409 }); 11410 return readonly(currentRef); 11411} 11412function useMemo(getterOrOptions) { 11413 const computedValueRef = computed(getterOrOptions); 11414 const valueRef = ref(computedValueRef.value); 11415 watch(computedValueRef, (value) => { 11416 valueRef.value = value; 11417 }); 11418 if (typeof getterOrOptions === "function") { 11419 return valueRef; 11420 } else { 11421 return { 11422 __v_isRef: true, 11423 get value() { 11424 return valueRef.value; 11425 }, 11426 set value(v) { 11427 getterOrOptions.set(v); 11428 } 11429 }; 11430 } 11431} 11432function hasInstance() { 11433 return getCurrentInstance() !== null; 11434} 11435const isBrowser$1 = typeof window !== "undefined"; 11436let fontsReady; 11437let isFontReady; 11438const init = () => { 11439 var _a2, _b; 11440 fontsReady = isBrowser$1 ? (_b = (_a2 = document) === null || _a2 === void 0 ? void 0 : _a2.fonts) === null || _b === void 0 ? void 0 : _b.ready : void 0; 11441 isFontReady = false;
11442 if (fontsReady !== void 0) { 11443 void fontsReady.then(() => { 11444 isFontReady = true; 11445 }); 11446 } else { 11447 isFontReady = true; 11448 } 11449}; 11450init(); 11451function onFontsReady(cb) { 11452 if (isFontReady) 11453 return; 11454 let deactivated = false; 11455 onMounted(() => { 11456 if (!isFontReady) { 11457 fontsReady === null || fontsReady === void 0 ? void 0 : fontsReady.then(() => { 11458 if (deactivated) 11459 return; 11460 cb(); 11461 }); 11462 } 11463 }); 11464 onBeforeUnmount(() => { 11465 deactivated = true; 11466 }); 11467} 11468function getEventTarget(e) { 11469 const path = e.composedPath(); 11470 return path[0]; 11471} 11472const traps = { 11473 mousemoveoutside: /* @__PURE__ */ new WeakMap(), 11474 clickoutside: /* @__PURE__ */ new WeakMap() 11475}; 11476function createTrapHandler(name, el, originalHandler) { 11477 if (name === "mousemoveoutside") { 11478 const moveHandler = (e) => { 11479 if (el.contains(getEventTarget(e))) 11480 return; 11481 originalHandler(e); 11482 }; 11483 return { 11484 mousemove: moveHandler, 11485 touchstart: moveHandler 11486 }; 11487 } else if (name === "clickoutside") { 11488 let mouseDownOutside = false;
vendor: 6,028 bytes, lines 11489-11675
11489 const downHandler = (e) => { 11490 mouseDownOutside = !el.contains(getEventTarget(e)); 11491 }; 11492 const upHanlder = (e) => { 11493 if (!mouseDownOutside) 11494 return; 11495 if (el.contains(getEventTarget(e))) 11496 return; 11497 originalHandler(e); 11498 }; 11499 return { 11500 mousedown: downHandler, 11501 mouseup: upHanlder, 11502 touchstart: downHandler, 11503 touchend: upHanlder 11504 }; 11505 } 11506 console.error( 11507 // eslint-disable-next-line @typescript-eslint/restrict-template-expressions 11508 `[evtd/create-trap-handler]: name \`${name}\` is invalid. This could be a bug of evtd.` 11509 ); 11510 return {}; 11511} 11512function ensureTrapHandlers(name, el, handler) { 11513 const handlers = traps[name]; 11514 let elHandlers = handlers.get(el); 11515 if (elHandlers === void 0) { 11516 handlers.set(el, elHandlers = /* @__PURE__ */ new WeakMap()); 11517 } 11518 let trapHandler = elHandlers.get(handler); 11519 if (trapHandler === void 0) { 11520 elHandlers.set(handler, trapHandler = createTrapHandler(name, el, handler)); 11521 } 11522 return trapHandler; 11523} 11524function trapOn(name, el, handler, options) { 11525 if (name === "mousemoveoutside" || name === "clickoutside") { 11526 const trapHandlers = ensureTrapHandlers(name, el, handler); 11527 Object.keys(trapHandlers).forEach((key) => { 11528 on(key, document, trapHandlers[key], options); 11529 }); 11530 return true; 11531 } 11532 return false; 11533} 11534function trapOff(name, el, handler, options) { 11535 if (name === "mousemoveoutside" || name === "clickoutside") { 11536 const trapHandlers = ensureTrapHandlers(name, el, handler); 11537 Object.keys(trapHandlers).forEach((key) => { 11538 off(key, document, trapHandlers[key], options); 11539 }); 11540 return true; 11541 } 11542 return false; 11543} 11544function createDelegate() { 11545 if (typeof window === "undefined") { 11546 return { 11547 on: () => { 11548 }, 11549 off: () => { 11550 } 11551 }; 11552 } 11553 const propagationStopped = /* @__PURE__ */ new WeakMap(); 11554 const immediatePropagationStopped = /* @__PURE__ */ new WeakMap(); 11555 function trackPropagation() { 11556 propagationStopped.set(this, true); 11557 } 11558 function trackImmediate() { 11559 propagationStopped.set(this, true); 11560 immediatePropagationStopped.set(this, true); 11561 } 11562 function spy(event, propName, fn) { 11563 const source = event[propName]; 11564 event[propName] = function() { 11565 fn.apply(event, arguments); 11566 return source.apply(event, arguments); 11567 }; 11568 return event; 11569 } 11570 function unspy(event, propName) { 11571 event[propName] = Event.prototype[propName]; 11572 } 11573 const currentTargets = /* @__PURE__ */ new WeakMap(); 11574 const currentTargetDescriptor = Object.getOwnPropertyDescriptor(Event.prototype, "currentTarget"); 11575 function getCurrentTarget() { 11576 var _a2; 11577 return (_a2 = currentTargets.get(this)) !== null && _a2 !== void 0 ? _a2 : null; 11578 } 11579 function defineCurrentTarget(event, getter) { 11580 if (currentTargetDescriptor === void 0) 11581 return; 11582 Object.defineProperty(event, "currentTarget", { 11583 configurable: true, 11584 enumerable: true, 11585 get: getter !== null && getter !== void 0 ? getter : currentTargetDescriptor.get 11586 }); 11587 } 11588 const phaseToTypeToElToHandlers = { 11589 bubble: {}, 11590 capture: {} 11591 }; 11592 const typeToWindowEventHandlers = {}; 11593 function createUnifiedHandler() { 11594 const delegeteHandler = function(e) { 11595 const { type: type4, eventPhase, bubbles } = e; 11596 const target = getEventTarget(e); 11597 if (eventPhase === 2) 11598 return; 11599 const phase = eventPhase === 1 ? "capture" : "bubble"; 11600 let cursor = target; 11601 const path = []; 11602 while (true) { 11603 if (cursor === null) 11604 cursor = window; 11605 path.push(cursor); 11606 if (cursor === window) { 11607 break; 11608 } 11609 cursor = cursor.parentNode || null; 11610 } 11611 const captureElToHandlers = phaseToTypeToElToHandlers.capture[type4]; 11612 const bubbleElToHandlers = phaseToTypeToElToHandlers.bubble[type4]; 11613 spy(e, "stopPropagation", trackPropagation); 11614 spy(e, "stopImmediatePropagation", trackImmediate); 11615 defineCurrentTarget(e, getCurrentTarget); 11616 if (phase === "capture") { 11617 if (captureElToHandlers === void 0) 11618 return; 11619 for (let i = path.length - 1; i >= 0; --i) { 11620 if (propagationStopped.has(e)) 11621 break; 11622 const target2 = path[i]; 11623 const handlers = captureElToHandlers.get(target2); 11624 if (handlers !== void 0) { 11625 currentTargets.set(e, target2); 11626 for (const handler of handlers) { 11627 if (immediatePropagationStopped.has(e)) 11628 break; 11629 handler(e); 11630 } 11631 } 11632 if (i === 0 && !bubbles && bubbleElToHandlers !== void 0) { 11633 const bubbleHandlers = bubbleElToHandlers.get(target2); 11634 if (bubbleHandlers !== void 0) { 11635 for (const handler of bubbleHandlers) { 11636 if (immediatePropagationStopped.has(e)) 11637 break; 11638 handler(e); 11639 } 11640 } 11641 } 11642 } 11643 } else if (phase === "bubble") { 11644 if (bubbleElToHandlers === void 0) 11645 return; 11646 for (let i = 0; i < path.length; ++i) { 11647 if (propagationStopped.has(e)) 11648 break; 11649 const target2 = path[i]; 11650 const handlers = bubbleElToHandlers.get(target2); 11651 if (handlers !== void 0) { 11652 currentTargets.set(e, target2); 11653 for (const handler of handlers) { 11654 if (immediatePropagationStopped.has(e)) 11655 break; 11656 handler(e); 11657 } 11658 } 11659 } 11660 } 11661 unspy(e, "stopPropagation"); 11662 unspy(e, "stopImmediatePropagation"); 11663 defineCurrentTarget(e); 11664 }; 11665 delegeteHandler.displayName = "evtdUnifiedHandler"; 11666 return delegeteHandler; 11667 } 11668 function createUnifiedWindowEventHandler() { 11669 const delegateHandler = function(e) { 11670 const { type: type4, eventPhase } = e; 11671 if (eventPhase !== 2) 11672 return; 11673 const handlers = typeToWindowEventHandlers[type4]; 11674 if (handlers === void 0) 11675 return;
11676 handlers.forEach((handler) => handler(e)); 11677 }; 11678 delegateHandler.displayName = "evtdUnifiedWindowEventHandler"; 11679 return delegateHandler; 11680 } 11681 const unifiedHandler = createUnifiedHandler(); 11682 const unfiendWindowEventHandler = createUnifiedWindowEventHandler(); 11683 function ensureElToHandlers(phase, type4) { 11684 const phaseHandlers = phaseToTypeToElToHandlers[phase]; 11685 if (phaseHandlers[type4] === void 0) { 11686 phaseHandlers[type4] = /* @__PURE__ */ new Map(); 11687 window.addEventListener(type4, unifiedHandler, phase === "capture"); 11688 } 11689 return phaseHandlers[type4]; 11690 } 11691 function ensureWindowEventHandlers(type4) { 11692 const windowEventHandlers = typeToWindowEventHandlers[type4]; 11693 if (windowEventHandlers === void 0) { 11694 typeToWindowEventHandlers[type4] = /* @__PURE__ */ new Set(); 11695 window.addEventListener(type4, unfiendWindowEventHandler); 11696 } 11697 return typeToWindowEventHandlers[type4]; 11698 } 11699 function ensureHandlers(elToHandlers, el) { 11700 let elHandlers = elToHandlers.get(el); 11701 if (elHandlers === void 0) { 11702 elToHandlers.set(el, elHandlers = /* @__PURE__ */ new Set()); 11703 } 11704 return elHandlers; 11705 } 11706 function handlerExist(el, phase, type4, handler) { 11707 const elToHandlers = phaseToTypeToElToHandlers[phase][type4]; 11708 if (elToHandlers !== void 0) { 11709 const handlers = elToHandlers.get(el); 11710 if (handlers !== void 0) { 11711 if (handlers.has(handler)) 11712 return true; 11713 } 11714 } 11715 return false; 11716 } 11717 function windowEventHandlerExist(type4, handler) { 11718 const handlers = typeToWindowEventHandlers[type4]; 11719 if (handlers !== void 0) { 11720 if (handlers.has(handler)) { 11721 return true; 11722 } 11723 } 11724 return false; 11725 } 11726 function on2(type4, el, handler, options) { 11727 let mergedHandler; 11728 if (typeof options === "object" && options.once === true) { 11729 mergedHandler = (e) => { 11730 off2(type4, el, mergedHandler, options); 11731 handler(e); 11732 }; 11733 } else { 11734 mergedHandler = handler; 11735 } 11736 const trapped = trapOn(type4, el, mergedHandler, options); 11737 if (trapped) 11738 return; 11739 const phase = options === true || typeof options === "object" && options.capture === true ? "capture" : "bubble"; 11740 const elToHandlers = ensureElToHandlers(phase, type4); 11741 const handlers = ensureHandlers(elToHandlers, el); 11742 if (!handlers.has(mergedHandler)) 11743 handlers.add(mergedHandler); 11744 if (el === window) { 11745 const windowEventHandlers = ensureWindowEventHandlers(type4); 11746 if (!windowEventHandlers.has(mergedHandler)) { 11747 windowEventHandlers.add(mergedHandler); 11748 } 11749 } 11750 } 11751 function off2(type4, el, handler, options) { 11752 const trapped = trapOff(type4, el, handler, options); 11753 if (trapped) 11754 return; 11755 const capture = options === true || typeof options === "object" && options.capture === true; 11756 const phase = capture ? "capture" : "bubble"; 11757 const elToHandlers = ensureElToHandlers(phase, type4); 11758 const handlers = ensureHandlers(elToHandlers, el); 11759 if (el === window) { 11760 const mirrorPhase = capture ? "bubble" : "capture"; 11761 if (!handlerExist(el, mirrorPhase, type4, handler) && windowEventHandlerExist(type4, handler)) { 11762 const windowEventHandlers = typeToWindowEventHandlers[type4]; 11763 windowEventHandlers.delete(handler); 11764 if (windowEventHandlers.size === 0) { 11765 window.removeEventListener(type4, unfiendWindowEventHandler); 11766 typeToWindowEventHandlers[type4] = void 0; 11767 } 11768 } 11769 } 11770 if (handlers.has(handler)) 11771 handlers.delete(handler); 11772 if (handlers.size === 0) { 11773 elToHandlers.delete(el); 11774 } 11775 if (elToHandlers.size === 0) { 11776 window.removeEventListener(type4, unifiedHandler, phase === "capture"); 11777 phaseToTypeToElToHandlers[phase][type4] = void 0; 11778 } 11779 } 11780 return { 11781 on: on2, 11782 off: off2 11783 }; 11784} 11785const { on, off } = createDelegate(); 11786const mousePositionRef = ref(null); 11787function clickHandler(e) { 11788 if (e.clientX > 0 || e.clientY > 0) { 11789 mousePositionRef.value = { 11790 x: e.clientX, 11791 y: e.clientY 11792 }; 11793 } else { 11794 const { target } = e; 11795 if (target instanceof Element) { 11796 const { left, top, width, height } = target.getBoundingClientRect(); 11797 if (left > 0 || top > 0) { 11798 mousePositionRef.value = { 11799 x: left + width / 2, 11800 y: top + height / 2 11801 }; 11802 } else { 11803 mousePositionRef.value = { x: 0, y: 0 }; 11804 } 11805 } else { 11806 mousePositionRef.value = null; 11807 } 11808 } 11809} 11810let usedCount$1 = 0; 11811let managable$1 = true; 11812function useClickPosition() { 11813 if (!isBrowser$1) 11814 return readonly(ref(null)); 11815 if (usedCount$1 === 0) 11816 on("click", document, clickHandler, true); 11817 const setup = () => { 11818 usedCount$1 += 1; 11819 }; 11820 if (managable$1 && (managable$1 = hasInstance())) { 11821 onBeforeMount(setup); 11822 onBeforeUnmount(() => { 11823 usedCount$1 -= 1; 11824 if (usedCount$1 === 0) 11825 off("click", document, clickHandler, true); 11826 }); 11827 } else { 11828 setup(); 11829 } 11830 return readonly(mousePositionRef); 11831} 11832const clickedTimeRef = ref(void 0); 11833let usedCount = 0; 11834function handleClick() { 11835 clickedTimeRef.value = Date.now(); 11836} 11837let managable = true; 11838function useClicked(timeout) { 11839 if (!isBrowser$1) 11840 return readonly(ref(false)); 11841 const clickedRef = ref(false); 11842 let timerId = null; 11843 function clearTimer() { 11844 if (timerId !== null) 11845 window.clearTimeout(timerId); 11846 } 11847 function clickedHandler() { 11848 clearTimer(); 11849 clickedRef.value = true; 11850 timerId = window.setTimeout(() => { 11851 clickedRef.value = false;
11852 }, timeout); 11853 } 11854 if (usedCount === 0) { 11855 on("click", window, handleClick, true); 11856 } 11857 const setup = () => { 11858 usedCount += 1; 11859 on("click", window, clickedHandler, true); 11860 }; 11861 if (managable && (managable = hasInstance())) { 11862 onBeforeMount(setup); 11863 onBeforeUnmount(() => { 11864 usedCount -= 1; 11865 if (usedCount === 0) { 11866 off("click", window, handleClick, true); 11867 } 11868 off("click", window, clickedHandler, true); 11869 clearTimer(); 11870 }); 11871 } else { 11872 setup(); 11873 } 11874 return readonly(clickedRef); 11875} 11876function useMergedState(controlledStateRef, uncontrolledStateRef) { 11877 watch(controlledStateRef, (value) => { 11878 if (value !== void 0) { 11879 uncontrolledStateRef.value = value; 11880 } 11881 }); 11882 return computed(() => { 11883 if (controlledStateRef.value === void 0) { 11884 return uncontrolledStateRef.value; 11885 } 11886 return controlledStateRef.value; 11887 }); 11888} 11889function isMounted() { 11890 const isMounted2 = ref(false); 11891 onMounted(() => { 11892 isMounted2.value = true; 11893 }); 11894 return readonly(isMounted2); 11895} 11896function useCompitable(reactive2, keys2) { 11897 return computed(() => { 11898 for (const key of keys2) { 11899 if (reactive2[key] !== void 0) 11900 return reactive2[key]; 11901 } 11902 return reactive2[keys2[keys2.length - 1]]; 11903 }); 11904} 11905const isIos = (typeof window === "undefined" ? false : /iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) && // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions 11906!window.MSStream; 11907function useIsIos() { 11908 return isIos; 11909} 11910const internalSelectionMenuInjectionKey = createInjectionKey("n-internal-select-menu"); 11911const internalSelectionMenuBodyInjectionKey = createInjectionKey("n-internal-select-menu-body"); 11912const modalBodyInjectionKey = createInjectionKey("n-modal-body"); 11913const modalProviderInjectionKey = createInjectionKey("n-modal-provider"); 11914const modalInjectionKey = createInjectionKey("n-modal"); 11915const drawerBodyInjectionKey = createInjectionKey("n-drawer-body"); 11916const popoverBodyInjectionKey = createInjectionKey("n-popover-body"); 11917const teleportDisabled = "__disabled__"; 11918function useAdjustedTo(props) { 11919 const modal = inject(modalBodyInjectionKey, null); 11920 const drawer = inject(drawerBodyInjectionKey, null); 11921 const popover = inject(popoverBodyInjectionKey, null); 11922 const selectMenu = inject(internalSelectionMenuBodyInjectionKey, null); 11923 const fullscreenElementRef = ref(); 11924 if (typeof document !== "undefined") { 11925 fullscreenElementRef.value = document.fullscreenElement; 11926 const handleFullscreenChange = () => { 11927 fullscreenElementRef.value = document.fullscreenElement; 11928 }; 11929 onMounted(() => { 11930 on("fullscreenchange", document, handleFullscreenChange); 11931 }); 11932 onBeforeUnmount(() => { 11933 off("fullscreenchange", document, handleFullscreenChange); 11934 }); 11935 } 11936 return useMemo(() => { 11937 var _a2; 11938 const { 11939 to 11940 } = props; 11941 if (to !== void 0) { 11942 if (to === false) 11943 return teleportDisabled; 11944 if (to === true) 11945 return fullscreenElementRef.value || "body"; 11946 return to; 11947 } 11948 if (modal === null || modal === void 0 ? void 0 : modal.value) { 11949 return (_a2 = modal.value.$el) !== null && _a2 !== void 0 ? _a2 : modal.value; 11950 } 11951 if (drawer === null || drawer === void 0 ? void 0 : drawer.value) 11952 return drawer.value; 11953 if (popover === null || popover === void 0 ? void 0 : popover.value) 11954 return popover.value; 11955 if (selectMenu === null || selectMenu === void 0 ? void 0 : selectMenu.value) 11956 return selectMenu.value; 11957 return to !== null && to !== void 0 ? to : fullscreenElementRef.value || "body"; 11958 }); 11959} 11960useAdjustedTo.tdkey = teleportDisabled; 11961useAdjustedTo.propTo = { 11962 type: [String, Object, Boolean], 11963 default: void 0 11964}; 11965let houdiniRegistered = false; 11966function useHoudini() { 11967 if (!isBrowser$2) 11968 return; 11969 if (!window.CSS) 11970 return; 11971 if (!houdiniRegistered) { 11972 houdiniRegistered = true; 11973 if ("registerProperty" in (window === null || window === void 0 ? void 0 : window.CSS)) { 11974 try { 11975 ; 11976 CSS.registerProperty({ 11977 name: "--n-color-start", 11978 syntax: "<color>", 11979 inherits: false, 11980 initialValue: "#0000" 11981 }); 11982 CSS.registerProperty({ 11983 name: "--n-color-end", 11984 syntax: "<color>", 11985 inherits: false, 11986 initialValue: "#0000" 11987 }); 11988 } catch (e) { 11989 } 11990 } 11991 } 11992} 11993function getSlot(scope, slots, slotName = "default") { 11994 const slot = slots[slotName]; 11995 if (slot === void 0) { 11996 throw new Error(`[vueuc/${scope}]: slot[${slotName}] is empty.`); 11997 } 11998 return slot(); 11999} 12000function flatten$1(vNodes, filterCommentNode = true, result = []) {
12001 vNodes.forEach((vNode) => { 12002 if (vNode === null) 12003 return; 12004 if (typeof vNode !== "object") { 12005 if (typeof vNode === "string" || typeof vNode === "number") { 12006 result.push(createTextVNode(String(vNode))); 12007 } 12008 return; 12009 } 12010 if (Array.isArray(vNode)) { 12011 flatten$1(vNode, filterCommentNode, result); 12012 return; 12013 } 12014 if (vNode.type === Fragment) { 12015 if (vNode.children === null) 12016 return; 12017 if (Array.isArray(vNode.children)) { 12018 flatten$1(vNode.children, filterCommentNode, result); 12019 } 12020 } else if (vNode.type !== Comment) { 12021 result.push(vNode); 12022 } 12023 }); 12024 return result; 12025} 12026function getFirstVNode(scope, slots, slotName = "default") { 12027 const slot = slots[slotName]; 12028 if (slot === void 0) { 12029 throw new Error(`[vueuc/${scope}]: slot[${slotName}] is empty.`); 12030 } 12031 const content = flatten$1(slot()); 12032 if (content.length === 1) { 12033 return content[0]; 12034 } else { 12035 throw new Error(`[vueuc/${scope}]: slot[${slotName}] should have exactly one child.`); 12036 } 12037} 12038let viewMeasurer = null;
12039function ensureViewBoundingRect() { 12040 if (viewMeasurer === null) { 12041 viewMeasurer = document.getElementById("v-binder-view-measurer"); 12042 if (viewMeasurer === null) { 12043 viewMeasurer = document.createElement("div"); 12044 viewMeasurer.id = "v-binder-view-measurer"; 12045 const { style: style2 } = viewMeasurer; 12046 style2.position = "fixed"; 12047 style2.left = "0"; 12048 style2.right = "0"; 12049 style2.top = "0"; 12050 style2.bottom = "0"; 12051 style2.pointerEvents = "none"; 12052 style2.visibility = "hidden"; 12053 document.body.appendChild(viewMeasurer); 12054 } 12055 } 12056 return viewMeasurer.getBoundingClientRect(); 12057} 12058function getPointRect(x, y) { 12059 const viewRect = ensureViewBoundingRect(); 12060 return { 12061 top: y, 12062 left: x, 12063 height: 0, 12064 width: 0, 12065 right: viewRect.width - x, 12066 bottom: viewRect.height - y 12067 }; 12068} 12069function getRect(el) { 12070 const elRect = el.getBoundingClientRect(); 12071 const viewRect = ensureViewBoundingRect(); 12072 return { 12073 left: elRect.left - viewRect.left, 12074 top: elRect.top - viewRect.top, 12075 bottom: viewRect.height + viewRect.top - elRect.bottom, 12076 right: viewRect.width + viewRect.left - elRect.right, 12077 width: elRect.width, 12078 height: elRect.height 12079 }; 12080} 12081function getParentNode(node) { 12082 if (node.nodeType === 9) { 12083 return null; 12084 } 12085 return node.parentNode; 12086} 12087function getScrollParent(node) { 12088 if (node === null) 12089 return null; 12090 const parentNode = getParentNode(node); 12091 if (parentNode === null) { 12092 return null; 12093 } 12094 if (parentNode.nodeType === 9) { 12095 return document; 12096 } 12097 if (parentNode.nodeType === 1) { 12098 const { overflow, overflowX, overflowY } = getComputedStyle(parentNode); 12099 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 12100 return parentNode; 12101 } 12102 } 12103 return getScrollParent(parentNode); 12104} 12105const Binder = defineComponent({ 12106 name: "Binder", 12107 props: { 12108 syncTargetWithParent: Boolean, 12109 syncTarget: { 12110 type: Boolean, 12111 default: true 12112 } 12113 }, 12114 setup(props) { 12115 var _a2; 12116 provide("VBinder", (_a2 = getCurrentInstance()) === null || _a2 === void 0 ? void 0 : _a2.proxy); 12117 const VBinder2 = inject("VBinder", null); 12118 const targetRef = ref(null); 12119 const setTargetRef = (el) => { 12120 targetRef.value = el; 12121 if (VBinder2 && props.syncTargetWithParent) { 12122 VBinder2.setTargetRef(el); 12123 } 12124 }; 12125 let scrollableNodes = []; 12126 const ensureScrollListener = () => { 12127 let cursor = targetRef.value; 12128 while (true) { 12129 cursor = getScrollParent(cursor); 12130 if (cursor === null) 12131 break; 12132 scrollableNodes.push(cursor); 12133 } 12134 for (const el of scrollableNodes) { 12135 on("scroll", el, onScroll, true); 12136 } 12137 }; 12138 const removeScrollListeners = () => { 12139 for (const el of scrollableNodes) { 12140 off("scroll", el, onScroll, true); 12141 } 12142 scrollableNodes = []; 12143 }; 12144 const followerScrollListeners = /* @__PURE__ */ new Set(); 12145 const addScrollListener = (listener) => { 12146 if (followerScrollListeners.size === 0) { 12147 ensureScrollListener(); 12148 } 12149 if (!followerScrollListeners.has(listener)) { 12150 followerScrollListeners.add(listener); 12151 } 12152 }; 12153 const removeScrollListener = (listener) => { 12154 if (followerScrollListeners.has(listener)) { 12155 followerScrollListeners.delete(listener); 12156 } 12157 if (followerScrollListeners.size === 0) { 12158 removeScrollListeners(); 12159 } 12160 }; 12161 const onScroll = () => { 12162 beforeNextFrameOnce(onScrollRaf); 12163 }; 12164 const onScrollRaf = () => { 12165 followerScrollListeners.forEach((listener) => listener()); 12166 }; 12167 const followerResizeListeners = /* @__PURE__ */ new Set(); 12168 const addResizeListener = (listener) => { 12169 if (followerResizeListeners.size === 0) { 12170 on("resize", window, onResize); 12171 } 12172 if (!followerResizeListeners.has(listener)) { 12173 followerResizeListeners.add(listener); 12174 } 12175 }; 12176 const removeResizeListener = (listener) => { 12177 if (followerResizeListeners.has(listener)) { 12178 followerResizeListeners.delete(listener); 12179 } 12180 if (followerResizeListeners.size === 0) { 12181 off("resize", window, onResize); 12182 } 12183 }; 12184 const onResize = () => {
12185 followerResizeListeners.forEach((listener) => listener()); 12186 }; 12187 onBeforeUnmount(() => { 12188 off("resize", window, onResize); 12189 removeScrollListeners(); 12190 }); 12191 return { 12192 targetRef, 12193 setTargetRef, 12194 addScrollListener, 12195 removeScrollListener, 12196 addResizeListener, 12197 removeResizeListener 12198 }; 12199 }, 12200 render() { 12201 return getSlot("binder", this.$slots); 12202 } 12203}); 12204const VBinder = Binder; 12205const VTarget = defineComponent({ 12206 name: "Target", 12207 setup() { 12208 const { setTargetRef, syncTarget } = inject("VBinder"); 12209 const setTargetDirective = { 12210 mounted: setTargetRef, 12211 updated: setTargetRef 12212 }; 12213 return { 12214 syncTarget, 12215 setTargetDirective 12216 }; 12217 }, 12218 render() { 12219 const { syncTarget, setTargetDirective } = this; 12220 if (syncTarget) { 12221 return withDirectives(getFirstVNode("follower", this.$slots), [ 12222 [setTargetDirective] 12223 ]); 12224 } 12225 return getFirstVNode("follower", this.$slots); 12226 } 12227}); 12228const ctxKey$1 = "@@mmoContext"; 12229const mousemoveoutside = { 12230 mounted(el, { value }) { 12231 el[ctxKey$1] = { 12232 handler: void 0 12233 }; 12234 if (typeof value === "function") { 12235 el[ctxKey$1].handler = value; 12236 on("mousemoveoutside", el, value); 12237 } 12238 }, 12239 updated(el, { value }) { 12240 const ctx2 = el[ctxKey$1]; 12241 if (typeof value === "function") { 12242 if (ctx2.handler) { 12243 if (ctx2.handler !== value) { 12244 off("mousemoveoutside", el, ctx2.handler); 12245 ctx2.handler = value; 12246 on("mousemoveoutside", el, value); 12247 } 12248 } else { 12249 el[ctxKey$1].handler = value; 12250 on("mousemoveoutside", el, value); 12251 } 12252 } else { 12253 if (ctx2.handler) { 12254 off("mousemoveoutside", el, ctx2.handler); 12255 ctx2.handler = void 0; 12256 } 12257 } 12258 }, 12259 unmounted(el) { 12260 const { handler } = el[ctxKey$1]; 12261 if (handler) { 12262 off("mousemoveoutside", el, handler); 12263 } 12264 el[ctxKey$1].handler = void 0; 12265 } 12266}; 12267const mousemoveoutside$1 = mousemoveoutside; 12268const ctxKey = "@@coContext"; 12269const clickoutside = { 12270 mounted(el, { value, modifiers }) { 12271 el[ctxKey] = { 12272 handler: void 0 12273 }; 12274 if (typeof value === "function") { 12275 el[ctxKey].handler = value; 12276 on("clickoutside", el, value, { 12277 capture: modifiers.capture 12278 }); 12279 } 12280 }, 12281 updated(el, { value, modifiers }) { 12282 const ctx2 = el[ctxKey]; 12283 if (typeof value === "function") { 12284 if (ctx2.handler) { 12285 if (ctx2.handler !== value) { 12286 off("clickoutside", el, ctx2.handler, { 12287 capture: modifiers.capture 12288 }); 12289 ctx2.handler = value; 12290 on("clickoutside", el, value, { 12291 capture: modifiers.capture 12292 }); 12293 } 12294 } else { 12295 el[ctxKey].handler = value; 12296 on("clickoutside", el, value, { 12297 capture: modifiers.capture 12298 }); 12299 } 12300 } else { 12301 if (ctx2.handler) { 12302 off("clickoutside", el, ctx2.handler, { 12303 capture: modifiers.capture 12304 }); 12305 ctx2.handler = void 0; 12306 } 12307 } 12308 }, 12309 unmounted(el, { modifiers }) { 12310 const { handler } = el[ctxKey]; 12311 if (handler) { 12312 off("clickoutside", el, handler, { 12313 capture: modifiers.capture 12314 }); 12315 } 12316 el[ctxKey].handler = void 0; 12317 } 12318}; 12319const clickoutside$1 = clickoutside; 12320function warn$1(location, message) { 12321 console.error(`[vdirs/${location}]: ${message}`); 12322} 12323class ZIndexManager { 12324 constructor() { 12325 this.elementZIndex = /* @__PURE__ */ new Map(); 12326 this.nextZIndex = 2e3; 12327 } 12328 get elementCount() { 12329 return this.elementZIndex.size; 12330 } 12331 ensureZIndex(el, zIndex) { 12332 const { elementZIndex } = this; 12333 if (zIndex !== void 0) { 12334 el.style.zIndex = `${zIndex}`; 12335 elementZIndex.delete(el); 12336 return; 12337 } 12338 const { nextZIndex } = this; 12339 if (elementZIndex.has(el)) { 12340 const currentZIndex = elementZIndex.get(el); 12341 if (currentZIndex + 1 === this.nextZIndex) 12342 return; 12343 } 12344 el.style.zIndex = `${nextZIndex}`; 12345 elementZIndex.set(el, nextZIndex); 12346 this.nextZIndex = nextZIndex + 1; 12347 this.squashState(); 12348 } 12349 unregister(el, zIndex) { 12350 const { elementZIndex } = this; 12351 if (elementZIndex.has(el)) { 12352 elementZIndex.delete(el); 12353 } else if (zIndex === void 0) { 12354 warn$1("z-index-manager/unregister-element", "Element not found when unregistering."); 12355 } 12356 this.squashState(); 12357 } 12358 squashState() { 12359 const { elementCount } = this; 12360 if (!elementCount) { 12361 this.nextZIndex = 2e3; 12362 } 12363 if (this.nextZIndex - elementCount > 2500) 12364 this.rearrange(); 12365 } 12366 rearrange() { 12367 const elementZIndexPair = Array.from(this.elementZIndex.entries()); 12368 elementZIndexPair.sort((pair1, pair2) => { 12369 return pair1[1] - pair2[1]; 12370 }); 12371 this.nextZIndex = 2e3; 12372 elementZIndexPair.forEach((pair) => { 12373 const el = pair[0]; 12374 const zIndex = this.nextZIndex++; 12375 if (`${zIndex}` !== el.style.zIndex) 12376 el.style.zIndex = `${zIndex}`; 12377 }); 12378 } 12379} 12380const zIndexManager = new ZIndexManager(); 12381const ctx = "@@ziContext"; 12382const zindexable = { 12383 mounted(el, bindings) { 12384 const { value = {} } = bindings; 12385 const { zIndex, enabled } = value; 12386 el[ctx] = { 12387 enabled: !!enabled, 12388 initialized: false 12389 }; 12390 if (enabled) { 12391 zIndexManager.ensureZIndex(el, zIndex); 12392 el[ctx].initialized = true; 12393 } 12394 }, 12395 updated(el, bindings) { 12396 const { value = {} } = bindings; 12397 const { zIndex, enabled } = value; 12398 const cachedEnabled = el[ctx].enabled; 12399 if (enabled && !cachedEnabled) { 12400 zIndexManager.ensureZIndex(el, zIndex); 12401 el[ctx].initialized = true; 12402 } 12403 el[ctx].enabled = !!enabled; 12404 }, 12405 unmounted(el, bindings) { 12406 if (!el[ctx].initialized) 12407 return; 12408 const { value = {} } = bindings; 12409 const { zIndex } = value; 12410 zIndexManager.unregister(el, zIndex); 12411 } 12412}; 12413const zindexable$1 = zindexable; 12414const ssrContextKey = "@css-render/vue3-ssr";
12415function createStyleString(id, style2) { 12416 return `<style cssr-id="${id}"> 12417${style2} 12418</style>`; 12419} 12420function ssrAdapter(id, style2, ssrContext) { 12421 const { styles: styles2, ids } = ssrContext; 12422 if (ids.has(id)) 12423 return; 12424 if (styles2 !== null) { 12425 ids.add(id); 12426 styles2.push(createStyleString(id, style2)); 12427 } 12428} 12429const isBrowser = typeof document !== "undefined"; 12430function useSsrAdapter() { 12431 if (isBrowser) 12432 return void 0; 12433 const context = inject(ssrContextKey, null); 12434 if (context === null) 12435 return void 0; 12436 return { 12437 adapter: (id, style2) => ssrAdapter(id, style2, context), 12438 context 12439 }; 12440} 12441function warn(location, message) { 12442 console.error(`[vueuc/${location}]: ${message}`); 12443} 12444const { c } = CssRender(); 12445const cssrAnchorMetaName$1 = "vueuc-style"; 12446function lowBit(n2) { 12447 return n2 & -n2; 12448} 12449class FinweckTree { 12450 /** 12451 * @param l length of the array 12452 * @param min min value of the array 12453 */ 12454 constructor(l2, min) { 12455 this.l = l2; 12456 this.min = min; 12457 const ft = new Array(l2 + 1); 12458 for (let i = 0; i < l2 + 1; ++i) { 12459 ft[i] = 0; 12460 } 12461 this.ft = ft; 12462 } 12463 /** 12464 * Add arr[i] by n, start from 0 12465 * @param i the index of the element to be added 12466 * @param n the value to be added 12467 */ 12468 add(i, n2) { 12469 if (n2 === 0) 12470 return; 12471 const { l: l2, ft } = this; 12472 i += 1; 12473 while (i <= l2) { 12474 ft[i] += n2; 12475 i += lowBit(i); 12476 } 12477 } 12478 /** 12479 * Get the value of index i 12480 * @param i index 12481 * @returns value of the index 12482 */ 12483 get(i) { 12484 return this.sum(i + 1) - this.sum(i); 12485 } 12486 /** 12487 * Get the sum of first i elements 12488 * @param i count of head elements to be added 12489 * @returns the sum of first i elements 12490 */ 12491 sum(i) { 12492 if (i === void 0) 12493 i = this.l; 12494 if (i <= 0) 12495 return 0; 12496 const { ft, min, l: l2 } = this; 12497 if (i > l2) 12498 throw new Error("[FinweckTree.sum]: `i` is larger than length."); 12499 let ret = i * min; 12500 while (i > 0) { 12501 ret += ft[i]; 12502 i -= lowBit(i); 12503 } 12504 return ret; 12505 } 12506 /** 12507 * Get the largest count of head elements whose sum are <= threshold 12508 * @param threshold 12509 * @returns the largest count of head elements whose sum are <= threshold 12510 */ 12511 getBound(threshold) { 12512 let l2 = 0; 12513 let r = this.l; 12514 while (r > l2) { 12515 const m = Math.floor((l2 + r) / 2); 12516 const sumM = this.sum(m); 12517 if (sumM > threshold) { 12518 r = m; 12519 continue; 12520 } else if (sumM < threshold) { 12521 if (l2 === m) { 12522 if (this.sum(l2 + 1) <= threshold) 12523 return l2 + 1; 12524 return m; 12525 } 12526 l2 = m; 12527 } else { 12528 return m; 12529 } 12530 } 12531 return l2; 12532 } 12533} 12534function resolveTo(selector) { 12535 if (typeof selector === "string") { 12536 return document.querySelector(selector); 12537 } 12538 return selector(); 12539} 12540const LazyTeleport = defineComponent({ 12541 name: "LazyTeleport", 12542 props: { 12543 to: { 12544 type: [String, Object], 12545 default: void 0 12546 }, 12547 disabled: Boolean, 12548 show: { 12549 type: Boolean, 12550 required: true 12551 } 12552 }, 12553 setup(props) { 12554 return { 12555 showTeleport: useFalseUntilTruthy(toRef(props, "show")), 12556 mergedTo: computed(() => { 12557 const { to } = props; 12558 return to !== null && to !== void 0 ? to : "body"; 12559 }) 12560 }; 12561 }, 12562 render() { 12563 return this.showTeleport ? this.disabled ? getSlot("lazy-teleport", this.$slots) : h(Teleport, { 12564 disabled: this.disabled, 12565 to: this.mergedTo 12566 }, getSlot("lazy-teleport", this.$slots)) : null; 12567 } 12568}); 12569const oppositionPositions = { 12570 top: "bottom", 12571 bottom: "top", 12572 left: "right", 12573 right: "left" 12574}; 12575const oppositeAligns = { 12576 start: "end", 12577 center: "center", 12578 end: "start" 12579}; 12580const propToCompare = { 12581 top: "height", 12582 bottom: "height", 12583 left: "width", 12584 right: "width" 12585}; 12586const transformOrigins = { 12587 "bottom-start": "top left", 12588 bottom: "top center", 12589 "bottom-end": "top right", 12590 "top-start": "bottom left", 12591 top: "bottom center", 12592 "top-end": "bottom right", 12593 "right-start": "top left", 12594 right: "center left", 12595 "right-end": "bottom left", 12596 "left-start": "top right", 12597 left: "center right", 12598 "left-end": "bottom right" 12599}; 12600const overlapTransformOrigin = { 12601 "bottom-start": "bottom left", 12602 bottom: "bottom center", 12603 "bottom-end": "bottom right", 12604 "top-start": "top left", 12605 top: "top center", 12606 "top-end": "top right", 12607 "right-start": "top right", 12608 right: "center right", 12609 "right-end": "bottom right", 12610 "left-start": "top left", 12611 left: "center left", 12612 "left-end": "bottom left" 12613}; 12614const oppositeAlignCssPositionProps = { 12615 "bottom-start": "right", 12616 "bottom-end": "left", 12617 "top-start": "right", 12618 "top-end": "left", 12619 "right-start": "bottom", 12620 "right-end": "top", 12621 "left-start": "bottom", 12622 "left-end": "top" 12623}; 12624const keepOffsetDirection = { 12625 top: true, 12626 bottom: false, 12627 left: true, 12628 right: false 12629 // left-- 12630}; 12631const cssPositionToOppositeAlign = { 12632 top: "end", 12633 bottom: "start", 12634 left: "end", 12635 right: "start" 12636}; 12637function getPlacementAndOffsetOfFollower(placement, targetRect, followerRect, shift, flip, overlap) { 12638 if (!flip || overlap) { 12639 return { placement, top: 0, left: 0 }; 12640 } 12641 const [position, align] = placement.split("-");
12642 let properAlign = align !== null && align !== void 0 ? align : "center"; 12643 let properOffset = { 12644 top: 0, 12645 left: 0 12646 }; 12647 const deriveOffset = (oppositeAlignCssSizeProp, alignCssPositionProp, offsetVertically2) => { 12648 let left = 0; 12649 let top = 0; 12650 const diff2 = followerRect[oppositeAlignCssSizeProp] - targetRect[alignCssPositionProp] - targetRect[oppositeAlignCssSizeProp]; 12651 if (diff2 > 0 && shift) { 12652 if (offsetVertically2) { 12653 top = keepOffsetDirection[alignCssPositionProp] ? diff2 : -diff2; 12654 } else { 12655 left = keepOffsetDirection[alignCssPositionProp] ? diff2 : -diff2; 12656 } 12657 } 12658 return { 12659 left, 12660 top 12661 }; 12662 }; 12663 const offsetVertically = position === "left" || position === "right"; 12664 if (properAlign !== "center") { 12665 const oppositeAlignCssPositionProp = oppositeAlignCssPositionProps[placement]; 12666 const currentAlignCssPositionProp = oppositionPositions[oppositeAlignCssPositionProp]; 12667 const oppositeAlignCssSizeProp = propToCompare[oppositeAlignCssPositionProp]; 12668 if (followerRect[oppositeAlignCssSizeProp] > targetRect[oppositeAlignCssSizeProp]) { 12669 if ( 12670 // current space is not enough 12671 // ----------[ target ]---------| 12672 // -------[ follower ] 12673 targetRect[oppositeAlignCssPositionProp] + targetRect[oppositeAlignCssSizeProp] < followerRect[oppositeAlignCssSizeProp] 12674 ) { 12675 const followerOverTargetSize = (followerRect[oppositeAlignCssSizeProp] - targetRect[oppositeAlignCssSizeProp]) / 2; 12676 if (targetRect[oppositeAlignCssPositionProp] < followerOverTargetSize || targetRect[currentAlignCssPositionProp] < followerOverTargetSize) { 12677 if (targetRect[oppositeAlignCssPositionProp] < targetRect[currentAlignCssPositionProp]) { 12678 properAlign = oppositeAligns[align]; 12679 properOffset = deriveOffset(oppositeAlignCssSizeProp, currentAlignCssPositionProp, offsetVertically); 12680 } else { 12681 properOffset = deriveOffset(oppositeAlignCssSizeProp, oppositeAlignCssPositionProp, offsetVertically); 12682 } 12683 } else { 12684 properAlign = "center"; 12685 } 12686 } 12687 } else if (followerRect[oppositeAlignCssSizeProp] < targetRect[oppositeAlignCssSizeProp]) { 12688 if (targetRect[currentAlignCssPositionProp] < 0 && // opposite align has larger space 12689 // ------------[ target ] 12690 // ----------------[follower] 12691 targetRect[oppositeAlignCssPositionProp] > targetRect[currentAlignCssPositionProp]) { 12692 properAlign = oppositeAligns[align]; 12693 } 12694 } 12695 } else { 12696 const possibleAlternativeAlignCssPositionProp1 = position === "bottom" || position === "top" ? "left" : "top"; 12697 const possibleAlternativeAlignCssPositionProp2 = oppositionPositions[possibleAlternativeAlignCssPositionProp1]; 12698 const alternativeAlignCssSizeProp = propToCompare[possibleAlternativeAlignCssPositionProp1]; 12699 const followerOverTargetSize = (followerRect[alternativeAlignCssSizeProp] - targetRect[alternativeAlignCssSizeProp]) / 2; 12700 if ( 12701 // center is not enough 12702 // ----------- [ target ]--| 12703 // -------[ follower ] 12704 targetRect[possibleAlternativeAlignCssPositionProp1] < followerOverTargetSize || targetRect[possibleAlternativeAlignCssPositionProp2] < followerOverTargetSize 12705 ) { 12706 if (targetRect[possibleAlternativeAlignCssPositionProp1] > targetRect[possibleAlternativeAlignCssPositionProp2]) { 12707 properAlign = cssPositionToOppositeAlign[possibleAlternativeAlignCssPositionProp1]; 12708 properOffset = deriveOffset(alternativeAlignCssSizeProp, possibleAlternativeAlignCssPositionProp1, offsetVertically); 12709 } else { 12710 properAlign = cssPositionToOppositeAlign[possibleAlternativeAlignCssPositionProp2]; 12711 properOffset = deriveOffset(alternativeAlignCssSizeProp, possibleAlternativeAlignCssPositionProp2, offsetVertically); 12712 } 12713 } 12714 } 12715 let properPosition = position; 12716 if ( 12717 // space is not enough 12718 targetRect[position] < followerRect[propToCompare[position]] && // opposite position's space is larger 12719 targetRect[position] < targetRect[oppositionPositions[position]] 12720 ) { 12721 properPosition = oppositionPositions[position]; 12722 } 12723 return { 12724 placement: properAlign !== "center" ? `${properPosition}-${properAlign}` : properPosition, 12725 left: properOffset.left, 12726 top: properOffset.top 12727 }; 12728} 12729function getProperTransformOrigin(placement, overlap) { 12730 if (overlap) 12731 return overlapTransformOrigin[placement]; 12732 return transformOrigins[placement]; 12733} 12734function getOffset(placement, offsetRect, targetRect, offsetTopToStandardPlacement, offsetLeftToStandardPlacement, overlap) { 12735 if (overlap) { 12736 switch (placement) { 12737 case "bottom-start": 12738 return { 12739 top: `${Math.round(targetRect.top - offsetRect.top + targetRect.height)}px`, 12740 left: `${Math.round(targetRect.left - offsetRect.left)}px`, 12741 transform: "translateY(-100%)" 12742 }; 12743 case "bottom-end": 12744 return { 12745 top: `${Math.round(targetRect.top - offsetRect.top + targetRect.height)}px`, 12746 left: `${Math.round(targetRect.left - offsetRect.left + targetRect.width)}px`, 12747 transform: "translateX(-100%) translateY(-100%)" 12748 }; 12749 case "top-start": 12750 return { 12751 top: `${Math.round(targetRect.top - offsetRect.top)}px`, 12752 left: `${Math.round(targetRect.left - offsetRect.left)}px`, 12753 transform: "" 12754 }; 12755 case "top-end": 12756 return { 12757 top: `${Math.round(targetRect.top - offsetRect.top)}px`, 12758 left: `${Math.round(targetRect.left - offsetRect.left + targetRect.width)}px`, 12759 transform: "translateX(-100%)" 12760 }; 12761 case "right-start": 12762 return { 12763 top: `${Math.round(targetRect.top - offsetRect.top)}px`, 12764 left: `${Math.round(targetRect.left - offsetRect.left + targetRect.width)}px`, 12765 transform: "translateX(-100%)" 12766 }; 12767 case "right-end": 12768 return { 12769 top: `${Math.round(targetRect.top - offsetRect.top + targetRect.height)}px`, 12770 left: `${Math.round(targetRect.left - offsetRect.left + targetRect.width)}px`, 12771 transform: "translateX(-100%) translateY(-100%)" 12772 }; 12773 case "left-start": 12774 return { 12775 top: `${Math.round(targetRect.top - offsetRect.top)}px`, 12776 left: `${Math.round(targetRect.left - offsetRect.left)}px`, 12777 transform: "" 12778 }; 12779 case "left-end": 12780 return { 12781 top: `${Math.round(targetRect.top - offsetRect.top + targetRect.height)}px`, 12782 left: `${Math.round(targetRect.left - offsetRect.left)}px`, 12783 transform: "translateY(-100%)" 12784 }; 12785 case "top": 12786 return { 12787 top: `${Math.round(targetRect.top - offsetRect.top)}px`, 12788 left: `${Math.round(targetRect.left - offsetRect.left + targetRect.width / 2)}px`, 12789 transform: "translateX(-50%)" 12790 }; 12791 case "right": 12792 return { 12793 top: `${Math.round(targetRect.top - offsetRect.top + targetRect.height / 2)}px`, 12794 left: `${Math.round(targetRect.left - offsetRect.left + targetRect.width)}px`, 12795 transform: "translateX(-100%) translateY(-50%)" 12796 };
12797 case "left": 12798 return { 12799 top: `${Math.round(targetRect.top - offsetRect.top + targetRect.height / 2)}px`, 12800 left: `${Math.round(targetRect.left - offsetRect.left)}px`, 12801 transform: "translateY(-50%)" 12802 }; 12803 case "bottom": 12804 default: 12805 return { 12806 top: `${Math.round(targetRect.top - offsetRect.top + targetRect.height)}px`, 12807 left: `${Math.round(targetRect.left - offsetRect.left + targetRect.width / 2)}px`, 12808 transform: "translateX(-50%) translateY(-100%)" 12809 }; 12810 } 12811 } 12812 switch (placement) { 12813 case "bottom-start": 12814 return { 12815 top: `${Math.round(targetRect.top - offsetRect.top + targetRect.height + offsetTopToStandardPlacement)}px`, 12816 left: `${Math.round(targetRect.left - offsetRect.left + offsetLeftToStandardPlacement)}px`, 12817 transform: "" 12818 }; 12819 case "bottom-end": 12820 return { 12821 top: `${Math.round(targetRect.top - offsetRect.top + targetRect.height + offsetTopToStandardPlacement)}px`, 12822 left: `${Math.round(targetRect.left - offsetRect.left + targetRect.width + offsetLeftToStandardPlacement)}px`, 12823 transform: "translateX(-100%)" 12824 }; 12825 case "top-start": 12826 return { 12827 top: `${Math.round(targetRect.top - offsetRect.top + offsetTopToStandardPlacement)}px`, 12828 left: `${Math.round(targetRect.left - offsetRect.left + offsetLeftToStandardPlacement)}px`, 12829 transform: "translateY(-100%)" 12830 }; 12831 case "top-end": 12832 return { 12833 top: `${Math.round(targetRect.top - offsetRect.top + offsetTopToStandardPlacement)}px`, 12834 left: `${Math.round(targetRect.left - offsetRect.left + targetRect.width + offsetLeftToStandardPlacement)}px`, 12835 transform: "translateX(-100%) translateY(-100%)" 12836 }; 12837 case "right-start": 12838 return { 12839 top: `${Math.round(targetRect.top - offsetRect.top + offsetTopToStandardPlacement)}px`, 12840 left: `${Math.round(targetRect.left - offsetRect.left + targetRect.width + offsetLeftToStandardPlacement)}px`, 12841 transform: "" 12842 }; 12843 case "right-end": 12844 return { 12845 top: `${Math.round(targetRect.top - offsetRect.top + targetRect.height + offsetTopToStandardPlacement)}px`, 12846 left: `${Math.round(targetRect.left - offsetRect.left + targetRect.width + offsetLeftToStandardPlacement)}px`, 12847 transform: "translateY(-100%)" 12848 }; 12849 case "left-start": 12850 return { 12851 top: `${Math.round(targetRect.top - offsetRect.top + offsetTopToStandardPlacement)}px`, 12852 left: `${Math.round(targetRect.left - offsetRect.left + offsetLeftToStandardPlacement)}px`, 12853 transform: "translateX(-100%)" 12854 }; 12855 case "left-end": 12856 return { 12857 top: `${Math.round(targetRect.top - offsetRect.top + targetRect.height + offsetTopToStandardPlacement)}px`, 12858 left: `${Math.round(targetRect.left - offsetRect.left + offsetLeftToStandardPlacement)}px`, 12859 transform: "translateX(-100%) translateY(-100%)" 12860 }; 12861 case "top": 12862 return { 12863 top: `${Math.round(targetRect.top - offsetRect.top + offsetTopToStandardPlacement)}px`, 12864 left: `${Math.round(targetRect.left - offsetRect.left + targetRect.width / 2 + offsetLeftToStandardPlacement)}px`, 12865 transform: "translateY(-100%) translateX(-50%)" 12866 }; 12867 case "right": 12868 return { 12869 top: `${Math.round(targetRect.top - offsetRect.top + targetRect.height / 2 + offsetTopToStandardPlacement)}px`, 12870 left: `${Math.round(targetRect.left - offsetRect.left + targetRect.width + offsetLeftToStandardPlacement)}px`, 12871 transform: "translateY(-50%)" 12872 }; 12873 case "left": 12874 return { 12875 top: `${Math.round(targetRect.top - offsetRect.top + targetRect.height / 2 + offsetTopToStandardPlacement)}px`, 12876 left: `${Math.round(targetRect.left - offsetRect.left + offsetLeftToStandardPlacement)}px`, 12877 transform: "translateY(-50%) translateX(-100%)" 12878 }; 12879 case "bottom": 12880 default: 12881 return { 12882 top: `${Math.round(targetRect.top - offsetRect.top + targetRect.height + offsetTopToStandardPlacement)}px`, 12883 left: `${Math.round(targetRect.left - offsetRect.left + targetRect.width / 2 + offsetLeftToStandardPlacement)}px`, 12884 transform: "translateX(-50%)" 12885 }; 12886 } 12887} 12888const style$p = c([ 12889 c(".v-binder-follower-container", { 12890 position: "absolute", 12891 left: "0", 12892 right: "0", 12893 top: "0", 12894 height: "0", 12895 pointerEvents: "none", 12896 zIndex: "auto" 12897 }), 12898 c(".v-binder-follower-content", { 12899 position: "absolute", 12900 zIndex: "auto" 12901 }, [ 12902 c("> *", { 12903 pointerEvents: "all" 12904 }) 12905 ]) 12906]); 12907const VFollower = defineComponent({ 12908 name: "Follower", 12909 inheritAttrs: false, 12910 props: { 12911 show: Boolean, 12912 enabled: { 12913 type: Boolean, 12914 default: void 0 12915 }, 12916 placement: { 12917 type: String, 12918 default: "bottom" 12919 }, 12920 syncTrigger: { 12921 type: Array, 12922 default: ["resize", "scroll"] 12923 }, 12924 to: [String, Object], 12925 flip: { 12926 type: Boolean, 12927 default: true 12928 }, 12929 internalShift: Boolean, 12930 x: Number, 12931 y: Number, 12932 width: String, 12933 minWidth: String, 12934 containerClass: String, 12935 teleportDisabled: Boolean, 12936 zindexable: { 12937 type: Boolean, 12938 default: true 12939 }, 12940 zIndex: Number, 12941 overlap: Boolean 12942 }, 12943 setup(props) { 12944 const VBinder2 = inject("VBinder"); 12945 const mergedEnabledRef = useMemo(() => { 12946 return props.enabled !== void 0 ? props.enabled : props.show; 12947 }); 12948 const followerRef = ref(null); 12949 const offsetContainerRef = ref(null); 12950 const ensureListeners = () => { 12951 const { syncTrigger } = props; 12952 if (syncTrigger.includes("scroll")) { 12953 VBinder2.addScrollListener(syncPosition); 12954 } 12955 if (syncTrigger.includes("resize")) { 12956 VBinder2.addResizeListener(syncPosition); 12957 } 12958 }; 12959 const removeListeners = () => { 12960 VBinder2.removeScrollListener(syncPosition); 12961 VBinder2.removeResizeListener(syncPosition); 12962 }; 12963 onMounted(() => { 12964 if (mergedEnabledRef.value) { 12965 syncPosition(); 12966 ensureListeners(); 12967 } 12968 }); 12969 const ssrAdapter2 = useSsrAdapter(); 12970 style$p.mount({ 12971 id: "vueuc/binder", 12972 head: true, 12973 anchorMetaName: cssrAnchorMetaName$1, 12974 ssr: ssrAdapter2 12975 }); 12976 onBeforeUnmount(() => { 12977 removeListeners(); 12978 }); 12979 onFontsReady(() => { 12980 if (mergedEnabledRef.value) { 12981 syncPosition(); 12982 } 12983 }); 12984 const syncPosition = () => { 12985 if (!mergedEnabledRef.value) { 12986 return; 12987 } 12988 const follower = followerRef.value; 12989 if (follower === null) 12990 return; 12991 const target = VBinder2.targetRef; 12992 const { x, y, overlap } = props; 12993 const targetRect = x !== void 0 && y !== void 0 ? getPointRect(x, y) : getRect(target); 12994 follower.style.setProperty("--v-target-width", `${Math.round(targetRect.width)}px`); 12995 follower.style.setProperty("--v-target-height", `${Math.round(targetRect.height)}px`); 12996 const { width, minWidth, placement, internalShift, flip } = props; 12997 follower.setAttribute("v-placement", placement); 12998 if (overlap) { 12999 follower.setAttribute("v-overlap", ""); 13000 } else { 13001 follower.removeAttribute("v-overlap"); 13002 } 13003 const { style: style2 }
13003 = follower; 13004 if (width === "target") { 13005 style2.width = `${targetRect.width}px`; 13006 } else if (width !== void 0) { 13007 style2.width = width; 13008 } else { 13009 style2.width = ""; 13010 } 13011 if (minWidth === "target") { 13012 style2.minWidth = `${targetRect.width}px`; 13013 } else if (minWidth !== void 0) { 13014 style2.minWidth = minWidth; 13015 } else { 13016 style2.minWidth = ""; 13017 } 13018 const followerRect = getRect(follower); 13019 const offsetContainerRect = getRect(offsetContainerRef.value); 13020 const { left: offsetLeftToStandardPlacement, top: offsetTopToStandardPlacement, placement: properPlacement } = getPlacementAndOffsetOfFollower(placement, targetRect, followerRect, internalShift, flip, overlap); 13021 const properTransformOrigin = getProperTransformOrigin(properPlacement, overlap); 13022 const { left, top, transform } = getOffset(properPlacement, offsetContainerRect, targetRect, offsetTopToStandardPlacement, offsetLeftToStandardPlacement, overlap); 13023 follower.setAttribute("v-placement", properPlacement); 13024 follower.style.setProperty("--v-offset-left", `${Math.round(offsetLeftToStandardPlacement)}px`); 13025 follower.style.setProperty("--v-offset-top", `${Math.round(offsetTopToStandardPlacement)}px`); 13026 follower.style.transform = `translateX(${left}) translateY(${top}) ${transform}`; 13027 follower.style.setProperty("--v-transform-origin", properTransformOrigin); 13028 follower.style.transformOrigin = properTransformOrigin; 13029 }; 13030 watch(mergedEnabledRef, (value) => { 13031 if (value) { 13032 ensureListeners(); 13033 syncOnNextTick(); 13034 } else { 13035 removeListeners(); 13036 } 13037 }); 13038 const syncOnNextTick = () => { 13039 nextTick().then(syncPosition).catch((e) => console.error(e)); 13040 }; 13041 [ 13042 "placement", 13043 "x", 13044 "y", 13045 "internalShift", 13046 "flip", 13047 "width", 13048 "overlap", 13049 "minWidth" 13050 ].forEach((prop) => { 13051 watch(toRef(props, prop), syncPosition); 13052 }); 13053 ["teleportDisabled"].forEach((prop) => { 13054 watch(toRef(props, prop), syncOnNextTick); 13055 }); 13056 watch(toRef(props, "syncTrigger"), (value) => { 13057 if (!value.includes("resize")) { 13058 VBinder2.removeResizeListener(syncPosition); 13059 } else { 13060 VBinder2.addResizeListener(syncPosition); 13061 } 13062 if (!value.includes("scroll")) { 13063 VBinder2.removeScrollListener(syncPosition); 13064 } else { 13065 VBinder2.addScrollListener(syncPosition); 13066 } 13067 }); 13068 const isMountedRef = isMounted(); 13069 const mergedToRef = useMemo(() => { 13070 const { to } = props; 13071 if (to !== void 0) 13072 return to; 13073 if (isMountedRef.value) { 13074 return void 0; 13075 } 13076 return void 0; 13077 }); 13078 return { 13079 VBinder: VBinder2, 13080 mergedEnabled: mergedEnabledRef, 13081 offsetContainerRef, 13082 followerRef, 13083 mergedTo: mergedToRef, 13084 syncPosition 13085 }; 13086 }, 13087 render() { 13088 return h(LazyTeleport, { 13089 show: this.show, 13090 to: this.mergedTo, 13091 disabled: this.teleportDisabled 13092 }, { 13093 default: () => { 13094 var _a2, _b; 13095 const vNode = h("div", { 13096 class: ["v-binder-follower-container", this.containerClass], 13097 ref: "offsetContainerRef" 13098 }, [ 13099 h("div", { 13100 class: "v-binder-follower-content", 13101 ref: "followerRef" 13102 }, (_b = (_a2 = this.$slots).default) === null || _b === void 0 ? void 0 : _b.call(_a2)) 13103 ]); 13104 if (this.zindexable) { 13105 return withDirectives(vNode, [ 13106 [ 13107 zindexable$1, 13108 { 13109 enabled: this.mergedEnabled, 13110 zIndex: this.zIndex 13111 } 13112 ] 13113 ]); 13114 } 13115 return vNode; 13116 } 13117 }); 13118 } 13119}); 13120var resizeObservers = []; 13121var hasActiveObservations = function() { 13122 return resizeObservers.some(function(ro) { 13123 return ro.activeTargets.length > 0; 13124 }); 13125}; 13126var hasSkippedObservations = function() { 13127 return resizeObservers.some(function(ro) { 13128 return ro.skippedTargets.length > 0; 13129 }); 13130}; 13131var msg = "ResizeObserver loop completed with undelivered notifications."; 13132var deliverResizeLoopError = function() { 13133 var event; 13134 if (typeof ErrorEvent === "function") { 13135 event = new ErrorEvent("error", { 13136 message: msg 13137 }); 13138 } else { 13139 event = document.createEvent("Event"); 13140 event.initEvent("error", false, false); 13141 event.message = msg; 13142 } 13143 window.dispatchEvent(event); 13144}; 13145var ResizeObserverBoxOptions; 13146(function(ResizeObserverBoxOptions2) { 13147 ResizeObserverBoxOptions2["BORDER_BOX"] = "border-box"; 13148 ResizeObserverBoxOptions2["CONTENT_BOX"] = "content-box"; 13149 ResizeObserverBoxOptions2["DEVICE_PIXEL_CONTENT_BOX"] = "device-pixel-content-box"; 13150})(ResizeObserverBoxOptions || (ResizeObserverBoxOptions = {})); 13151var freeze = function(obj) { 13152 return Object.freeze(obj); 13153}; 13154var ResizeObserverSize = function() { 13155 function ResizeObserverSize2(inlineSize, blockSize) { 13156 this.inlineSize = inlineSize; 13157 this.blockSize = blockSize; 13158 freeze(this); 13159 } 13160 return ResizeObserverSize2; 13161}(); 13162var DOMRectReadOnly = function() { 13163 function DOMRectReadOnly2(x, y, width, height) { 13164 this.x = x; 13165 this.y = y; 13166 this.width = width; 13167 this.height = height; 13168 this.top = this.y; 13169 this.left = this.x; 13170 this.bottom = this.top + this.height; 13171 this.right = this.left + this.width; 13172 return freeze(this); 13173 } 13174 DOMRectReadOnly2.prototype.toJSON = function() { 13175 var _a2 = this, x = _a2.x, y = _a2.y, top = _a2.top, right = _a2.right, bottom = _a2.bottom, left = _a2.left, width = _a2.width, height = _a2.height; 13176 return { x, y, top, right, bottom, left, width, height }; 13177 }; 13178 DOMRectReadOnly2.fromRect = function(rectangle) { 13179 return new DOMRectReadOnly2(rectangle.x, rectangle.y, rectangle.width, rectangle.height); 13180 }; 13181 return DOMRectReadOnly2; 13182}(); 13183var isSVG = function(target) { 13184 return target instanceof SVGElement && "getBBox" in target; 13185}; 13186var isHidden = function(target) { 13187 if (isSVG(target)) { 13188 var _a2 = target.getBBox(), width = _a2.width, height = _a2.height; 13189 return !width && !height; 13190 } 13191 var _b = target, offsetWidth = _b.offsetWidth, offsetHeight = _b.offsetHeight; 13192 return !(offsetWidth || offsetHeight || target.getClientRects().length); 13193}; 13194var isElement = function(obj) { 13195 var _a2; 13196 if (obj instanceof Element) { 13197 return true; 13198 } 13199 var scope = (_a2 = obj === null || obj === void 0 ? void 0 : obj.ownerDocument) === null || _a2 === void 0 ? void 0 : _a2.defaultView; 13200 return !!(scope && obj instanceof scope.Element); 13201}; 13202var isReplacedElement = function(target) { 13203 switch (target.tagName) { 13204 case "INPUT": 13205 if (target.type !== "image") { 13206 break; 13207 } 13208 case "VIDEO": 13209 case "AUDIO": 13210 case "EMBED": 13211 case "OBJECT": 13212 case "CANVAS": 13213 case "IFRAME": 13214 case "IMG": 13215 return true; 13216 } 13217 return false;
vendor: 9,107 bytes, lines 13218-13488
13218}; 13219var global$1 = typeof window !== "undefined" ? window : {}; 13220var cache = /* @__PURE__ */ new WeakMap(); 13221var scrollRegexp = /auto|scroll/; 13222var verticalRegexp = /^tb|vertical/; 13223var IE = /msie|trident/i.test(global$1.navigator && global$1.navigator.userAgent); 13224var parseDimension = function(pixel) { 13225 return parseFloat(pixel || "0"); 13226}; 13227var size = function(inlineSize, blockSize, switchSizes) { 13228 if (inlineSize === void 0) { 13229 inlineSize = 0; 13230 } 13231 if (blockSize === void 0) { 13232 blockSize = 0; 13233 } 13234 if (switchSizes === void 0) { 13235 switchSizes = false; 13236 } 13237 return new ResizeObserverSize((switchSizes ? blockSize : inlineSize) || 0, (switchSizes ? inlineSize : blockSize) || 0); 13238}; 13239var zeroBoxes = freeze({ 13240 devicePixelContentBoxSize: size(), 13241 borderBoxSize: size(), 13242 contentBoxSize: size(), 13243 contentRect: new DOMRectReadOnly(0, 0, 0, 0) 13244}); 13245var calculateBoxSizes = function(target, forceRecalculation) { 13246 if (forceRecalculation === void 0) { 13247 forceRecalculation = false; 13248 } 13249 if (cache.has(target) && !forceRecalculation) { 13250 return cache.get(target); 13251 } 13252 if (isHidden(target)) { 13253 cache.set(target, zeroBoxes); 13254 return zeroBoxes; 13255 } 13256 var cs = getComputedStyle(target); 13257 var svg = isSVG(target) && target.ownerSVGElement && target.getBBox(); 13258 var removePadding = !IE && cs.boxSizing === "border-box"; 13259 var switchSizes = verticalRegexp.test(cs.writingMode || ""); 13260 var canScrollVertically = !svg && scrollRegexp.test(cs.overflowY || ""); 13261 var canScrollHorizontally = !svg && scrollRegexp.test(cs.overflowX || ""); 13262 var paddingTop = svg ? 0 : parseDimension(cs.paddingTop); 13263 var paddingRight = svg ? 0 : parseDimension(cs.paddingRight); 13264 var paddingBottom = svg ? 0 : parseDimension(cs.paddingBottom); 13265 var paddingLeft = svg ? 0 : parseDimension(cs.paddingLeft); 13266 var borderTop = svg ? 0 : parseDimension(cs.borderTopWidth); 13267 var borderRight = svg ? 0 : parseDimension(cs.borderRightWidth); 13268 var borderBottom = svg ? 0 : parseDimension(cs.borderBottomWidth); 13269 var borderLeft = svg ? 0 : parseDimension(cs.borderLeftWidth); 13270 var horizontalPadding = paddingLeft + paddingRight; 13271 var verticalPadding = paddingTop + paddingBottom; 13272 var horizontalBorderArea = borderLeft + borderRight; 13273 var verticalBorderArea = borderTop + borderBottom; 13274 var horizontalScrollbarThickness = !canScrollHorizontally ? 0 : target.offsetHeight - verticalBorderArea - target.clientHeight; 13275 var verticalScrollbarThickness = !canScrollVertically ? 0 : target.offsetWidth - horizontalBorderArea - target.clientWidth; 13276 var widthReduction = removePadding ? horizontalPadding + horizontalBorderArea : 0; 13277 var heightReduction = removePadding ? verticalPadding + verticalBorderArea : 0; 13278 var contentWidth = svg ? svg.width : parseDimension(cs.width) - widthReduction - verticalScrollbarThickness; 13279 var contentHeight = svg ? svg.height : parseDimension(cs.height) - heightReduction - horizontalScrollbarThickness; 13280 var borderBoxWidth = contentWidth + horizontalPadding + verticalScrollbarThickness + horizontalBorderArea; 13281 var borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea; 13282 var boxes = freeze({ 13283 devicePixelContentBoxSize: size(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes), 13284 borderBoxSize: size(borderBoxWidth, borderBoxHeight, switchSizes), 13285 contentBoxSize: size(contentWidth, contentHeight, switchSizes), 13286 contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight) 13287 }); 13288 cache.set(target, boxes); 13289 return boxes; 13290}; 13291var calculateBoxSize = function(target, observedBox, forceRecalculation) { 13292 var _a2 = calculateBoxSizes(target, forceRecalculation), borderBoxSize = _a2.borderBoxSize, contentBoxSize = _a2.contentBoxSize, devicePixelContentBoxSize = _a2.devicePixelContentBoxSize; 13293 switch (observedBox) { 13294 case ResizeObserverBoxOptions.DEVICE_PIXEL_CONTENT_BOX: 13295 return devicePixelContentBoxSize; 13296 case ResizeObserverBoxOptions.BORDER_BOX: 13297 return borderBoxSize; 13298 default: 13299 return contentBoxSize; 13300 } 13301}; 13302var ResizeObserverEntry = function() { 13303 function ResizeObserverEntry2(target) { 13304 var boxes = calculateBoxSizes(target); 13305 this.target = target; 13306 this.contentRect = boxes.contentRect; 13307 this.borderBoxSize = freeze([boxes.borderBoxSize]); 13308 this.contentBoxSize = freeze([boxes.contentBoxSize]); 13309 this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]); 13310 } 13311 return ResizeObserverEntry2; 13312}(); 13313var calculateDepthForNode = function(node) { 13314 if (isHidden(node)) { 13315 return Infinity; 13316 } 13317 var depth = 0; 13318 var parent = node.parentNode; 13319 while (parent) { 13320 depth += 1; 13321 parent = parent.parentNode; 13322 } 13323 return depth; 13324}; 13325var broadcastActiveObservations = function() { 13326 var shallowestDepth = Infinity; 13327 var callbacks2 = []; 13328 resizeObservers.forEach(function processObserver(ro) { 13329 if (ro.activeTargets.length === 0) { 13330 return; 13331 } 13332 var entries = []; 13333 ro.activeTargets.forEach(function processTarget(ot) { 13334 var entry = new ResizeObserverEntry(ot.target); 13335 var targetDepth = calculateDepthForNode(ot.target); 13336 entries.push(entry); 13337 ot.lastReportedSize = calculateBoxSize(ot.target, ot.observedBox); 13338 if (targetDepth < shallowestDepth) { 13339 shallowestDepth = targetDepth; 13340 } 13341 }); 13342 callbacks2.push(function resizeObserverCallback() { 13343 ro.callback.call(ro.observer, entries, ro.observer); 13344 }); 13345 ro.activeTargets.splice(0, ro.activeTargets.length); 13346 }); 13347 for (var _i = 0, callbacks_1 = callbacks2; _i < callbacks_1.length; _i++) { 13348 var callback = callbacks_1[_i]; 13349 callback(); 13350 } 13351 return shallowestDepth; 13352}; 13353var gatherActiveObservationsAtDepth = function(depth) { 13354 resizeObservers.forEach(function processObserver(ro) { 13355 ro.activeTargets.splice(0, ro.activeTargets.length); 13356 ro.skippedTargets.splice(0, ro.skippedTargets.length); 13357 ro.observationTargets.forEach(function processTarget(ot) { 13358 if (ot.isActive()) { 13359 if (calculateDepthForNode(ot.target) > depth) { 13360 ro.activeTargets.push(ot); 13361 } else { 13362 ro.skippedTargets.push(ot); 13363 } 13364 } 13365 }); 13366 }); 13367}; 13368var process$1 = function() { 13369 var depth = 0; 13370 gatherActiveObservationsAtDepth(depth); 13371 while (hasActiveObservations()) { 13372 depth = broadcastActiveObservations(); 13373 gatherActiveObservationsAtDepth(depth); 13374 } 13375 if (hasSkippedObservations()) { 13376 deliverResizeLoopError(); 13377 } 13378 return depth > 0; 13379}; 13380var trigger; 13381var callbacks = []; 13382var notify = function() { 13383 return callbacks.splice(0).forEach(function(cb) { 13384 return cb(); 13385 }); 13386}; 13387var queueMicroTask = function(callback) { 13388 if (!trigger) { 13389 var toggle_1 = 0; 13390 var el_1 = document.createTextNode(""); 13391 var config = { characterData: true }; 13392 new MutationObserver(function() { 13393 return notify(); 13394 }).observe(el_1, config); 13395 trigger = function() { 13396 el_1.textContent = "".concat(toggle_1 ? toggle_1-- : toggle_1++); 13397 }; 13398 } 13399 callbacks.push(callback); 13400 trigger(); 13401}; 13402var queueResizeObserver = function(cb) { 13403 queueMicroTask(function ResizeObserver() { 13404 requestAnimationFrame(cb); 13405 }); 13406}; 13407var watching = 0; 13408var isWatching = function() { 13409 return !!watching; 13410}; 13411var CATCH_PERIOD = 250; 13412var observerConfig = { attributes: true, characterData: true, childList: true, subtree: true }; 13413var events = [ 13414 "resize", 13415 "load", 13416 "transitionend", 13417 "animationend", 13418 "animationstart", 13419 "animationiteration", 13420 "keyup", 13421 "keydown", 13422 "mouseup", 13423 "mousedown", 13424 "mouseover", 13425 "mouseout", 13426 "blur", 13427 "focus" 13428]; 13429var time = function(timeout) { 13430 if (timeout === void 0) { 13431 timeout = 0; 13432 } 13433 return Date.now() + timeout; 13434}; 13435var scheduled = false; 13436var Scheduler = function() { 13437 function Scheduler2() { 13438 var _this = this; 13439 this.stopped = true; 13440 this.listener = function() { 13441 return _this.schedule(); 13442 }; 13443 } 13444 Scheduler2.prototype.run = function(timeout) { 13445 var _this = this; 13446 if (timeout === void 0) { 13447 timeout = CATCH_PERIOD; 13448 } 13449 if (scheduled) { 13450 return; 13451 } 13452 scheduled = true; 13453 var until = time(timeout); 13454 queueResizeObserver(function() { 13455 var elementsHaveResized = false; 13456 try { 13457 elementsHaveResized = process$1(); 13458 } finally { 13459 scheduled = false; 13460 timeout = until - time(); 13461 if (!isWatching()) { 13462 return; 13463 } 13464 if (elementsHaveResized) { 13465 _this.run(1e3); 13466 } else if (timeout > 0) { 13467 _this.run(timeout); 13468 } else { 13469 _this.start(); 13470 } 13471 } 13472 }); 13473 }; 13474 Scheduler2.prototype.schedule = function() { 13475 this.stop(); 13476 this.run(); 13477 }; 13478 Scheduler2.prototype.observe = function() { 13479 var _this = this; 13480 var cb = function() { 13481 return _this.observer && _this.observer.observe(document.body, observerConfig); 13482 }; 13483 document.body ? cb() : global$1.addEventListener("DOMContentLoaded", cb); 13484 }; 13485 Scheduler2.prototype.start = function() { 13486 var _this = this; 13487 if (this.stopped) { 13488 this.stopped = false;
13489 this.observer = new MutationObserver(this.listener); 13490 this.observe(); 13491 events.forEach(function(name) { 13492 return global$1.addEventListener(name, _this.listener, true); 13493 }); 13494 } 13495 }; 13496 Scheduler2.prototype.stop = function() { 13497 var _this = this; 13498 if (!this.stopped) { 13499 this.observer && this.observer.disconnect(); 13500 events.forEach(function(name) { 13501 return global$1.removeEventListener(name, _this.listener, true); 13502 }); 13503 this.stopped = true; 13504 } 13505 }; 13506 return Scheduler2; 13507}(); 13508var scheduler = new Scheduler(); 13509var updateCount = function(n2) { 13510 !watching && n2 > 0 && scheduler.start(); 13511 watching += n2; 13512 !watching && scheduler.stop(); 13513}; 13514var skipNotifyOnElement = function(target) { 13515 return !isSVG(target) && !isReplacedElement(target) && getComputedStyle(target).display === "inline"; 13516}; 13517var ResizeObservation = function() { 13518 function ResizeObservation2(target, observedBox) { 13519 this.target = target; 13520 this.observedBox = observedBox || ResizeObserverBoxOptions.CONTENT_BOX; 13521 this.lastReportedSize = { 13522 inlineSize: 0, 13523 blockSize: 0 13524 }; 13525 } 13526 ResizeObservation2.prototype.isActive = function() { 13527 var size2 = calculateBoxSize(this.target, this.observedBox, true); 13528 if (skipNotifyOnElement(this.target)) { 13529 this.lastReportedSize = size2; 13530 } 13531 if (this.lastReportedSize.inlineSize !== size2.inlineSize || this.lastReportedSize.blockSize !== size2.blockSize) { 13532 return true; 13533 } 13534 return false; 13535 }; 13536 return ResizeObservation2; 13537}(); 13538var ResizeObserverDetail = function() { 13539 function ResizeObserverDetail2(resizeObserver, callback) { 13540 this.activeTargets = []; 13541 this.skippedTargets = []; 13542 this.observationTargets = []; 13543 this.observer = resizeObserver; 13544 this.callback = callback; 13545 } 13546 return ResizeObserverDetail2; 13547}(); 13548var observerMap = /* @__PURE__ */ new WeakMap(); 13549var getObservationIndex = function(observationTargets, target) { 13550 for (var i = 0; i < observationTargets.length; i += 1) { 13551 if (observationTargets[i].target === target) { 13552 return i; 13553 } 13554 } 13555 return -1; 13556}; 13557var ResizeObserverController = function() { 13558 function ResizeObserverController2() { 13559 } 13560 ResizeObserverController2.connect = function(resizeObserver, callback) { 13561 var detail = new ResizeObserverDetail(resizeObserver, callback); 13562 observerMap.set(resizeObserver, detail); 13563 }; 13564 ResizeObserverController2.observe = function(resizeObserver, target, options) { 13565 var detail = observerMap.get(resizeObserver); 13566 var firstObservation = detail.observationTargets.length === 0; 13567 if (getObservationIndex(detail.observationTargets, target) < 0) { 13568 firstObservation && resizeObservers.push(detail); 13569 detail.observationTargets.push(new ResizeObservation(target, options && options.box)); 13570 updateCount(1); 13571 scheduler.schedule(); 13572 } 13573 }; 13574 ResizeObserverController2.unobserve = function(resizeObserver, target) { 13575 var detail = observerMap.get(resizeObserver); 13576 var index = getObservationIndex(detail.observationTargets, target); 13577 var lastObservation = detail.observationTargets.length === 1; 13578 if (index >= 0) { 13579 lastObservation && resizeObservers.splice(resizeObservers.indexOf(detail), 1); 13580 detail.observationTargets.splice(index, 1); 13581 updateCount(-1); 13582 } 13583 }; 13584 ResizeObserverController2.disconnect = function(resizeObserver) { 13585 var _this = this; 13586 var detail = observerMap.get(resizeObserver); 13587 detail.observationTargets.slice().forEach(function(ot) { 13588 return _this.unobserve(resizeObserver, ot.target); 13589 }); 13590 detail.activeTargets.splice(0, detail.activeTargets.length); 13591 }; 13592 return ResizeObserverController2; 13593}(); 13594var ResizeObserver$1 = function() { 13595 function ResizeObserver(callback) { 13596 if (arguments.length === 0) { 13597 throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present."); 13598 } 13599 if (typeof callback !== "function") { 13600 throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function."); 13601 } 13602 ResizeObserverController.connect(this, callback); 13603 } 13604 ResizeObserver.prototype.observe = function(target, options) { 13605 if (arguments.length === 0) { 13606 throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present."); 13607 } 13608 if (!isElement(target)) { 13609 throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element"); 13610 } 13611 ResizeObserverController.observe(this, target, options); 13612 }; 13613 ResizeObserver.prototype.unobserve = function(target) { 13614 if (arguments.length === 0) { 13615 throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present."); 13616 } 13617 if (!isElement(target)) { 13618 throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element"); 13619 } 13620 ResizeObserverController.unobserve(this, target); 13621 }; 13622 ResizeObserver.prototype.disconnect = function() { 13623 ResizeObserverController.disconnect(this); 13624 }; 13625 ResizeObserver.toString = function() { 13626 return "function ResizeObserver () { [polyfill code] }"; 13627 }; 13628 return ResizeObserver; 13629}(); 13630class ResizeObserverDelegate { 13631 constructor() { 13632 this.handleResize = this.handleResize.bind(this); 13633 this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver$1)(this.handleResize); 13634 this.elHandlersMap = /* @__PURE__ */ new Map(); 13635 } 13636 handleResize(entries) {
13637 for (const entry of entries) { 13638 const handler = this.elHandlersMap.get(entry.target); 13639 if (handler !== void 0) { 13640 handler(entry); 13641 } 13642 } 13643 } 13644 registerHandler(el, handler) { 13645 this.elHandlersMap.set(el, handler); 13646 this.observer.observe(el); 13647 } 13648 unregisterHandler(el) { 13649 if (!this.elHandlersMap.has(el)) { 13650 return; 13651 } 13652 this.elHandlersMap.delete(el); 13653 this.observer.unobserve(el); 13654 } 13655} 13656const resizeObserverManager = new ResizeObserverDelegate(); 13657const VResizeObserver = defineComponent({ 13658 name: "ResizeObserver", 13659 props: { 13660 onResize: Function 13661 }, 13662 setup(props) { 13663 let registered = false; 13664 const proxy = getCurrentInstance().proxy; 13665 function handleResize(entry) { 13666 const { onResize } = props; 13667 if (onResize !== void 0) 13668 onResize(entry); 13669 } 13670 onMounted(() => { 13671 const el = proxy.$el; 13672 if (el === void 0) { 13673 warn("resize-observer", "$el does not exist."); 13674 return; 13675 } 13676 if (el.nextElementSibling !== el.nextSibling) { 13677 if (el.nodeType === 3 && el.nodeValue !== "") { 13678 warn("resize-observer", "$el can not be observed (it may be a text node)."); 13679 return; 13680 } 13681 } 13682 if (el.nextElementSibling !== null) { 13683 resizeObserverManager.registerHandler(el.nextElementSibling, handleResize); 13684 registered = true; 13685 } 13686 }); 13687 onBeforeUnmount(() => { 13688 if (registered) { 13689 resizeObserverManager.unregisterHandler(proxy.$el.nextElementSibling); 13690 } 13691 }); 13692 }, 13693 render() { 13694 return renderSlot(this.$slots, "default"); 13695 } 13696}); 13697let maybeTouch; 13698function ensureMaybeTouch() { 13699 if (typeof document === "undefined") 13700 return false; 13701 if (maybeTouch === void 0) {
13702 if ("matchMedia" in window) { 13703 maybeTouch = window.matchMedia("(pointer:coarse)").matches; 13704 } else { 13705 maybeTouch = false; 13706 } 13707 } 13708 return maybeTouch; 13709} 13710let wheelScale; 13711function ensureWheelScale() { 13712 if (typeof document === "undefined") 13713 return 1; 13714 if (wheelScale === void 0) { 13715 wheelScale = "chrome" in window ? window.devicePixelRatio : 1; 13716 } 13717 return wheelScale; 13718} 13719const xScrollInjextionKey = "VVirtualListXScroll"; 13720function setupXScroll({ columnsRef, renderColRef, renderItemWithColsRef }) { 13721 const listWidthRef = ref(0); 13722 const scrollLeftRef = ref(0); 13723 const xFinweckTreeRef = computed(() => { 13724 const columns = columnsRef.value; 13725 if (columns.length === 0) { 13726 return null; 13727 } 13728 const ft = new FinweckTree(columns.length, 0); 13729 columns.forEach((column, index) => { 13730 ft.add(index, column.width); 13731 }); 13732 return ft; 13733 }); 13734 const startIndexRef = useMemo(() => { 13735 const xFinweckTree = xFinweckTreeRef.value; 13736 if (xFinweckTree !== null) { 13737 return Math.max(xFinweckTree.getBound(scrollLeftRef.value) - 1, 0); 13738 } else { 13739 return 0; 13740 } 13741 }); 13742 const getLeft = (index) => { 13743 const xFinweckTree = xFinweckTreeRef.value; 13744 if (xFinweckTree !== null) { 13745 return xFinweckTree.sum(index); 13746 } else { 13747 return 0; 13748 } 13749 }; 13750 const endIndexRef = useMemo(() => { 13751 const xFinweckTree = xFinweckTreeRef.value; 13752 if (xFinweckTree !== null) { 13753 return Math.min(xFinweckTree.getBound(scrollLeftRef.value + listWidthRef.value) + 1, columnsRef.value.length - 1); 13754 } else { 13755 return 0; 13756 } 13757 }); 13758 provide(xScrollInjextionKey, { 13759 startIndexRef, 13760 endIndexRef, 13761 columnsRef, 13762 renderColRef, 13763 renderItemWithColsRef, 13764 getLeft 13765 }); 13766 return { 13767 listWidthRef, 13768 scrollLeftRef 13769 }; 13770} 13771const VirtualListRow = defineComponent({ 13772 name: "VirtualListRow", 13773 props: { 13774 index: { type: Number, required: true }, 13775 item: { 13776 type: Object, 13777 required: true 13778 } 13779 }, 13780 setup() { 13781 const { startIndexRef, endIndexRef, columnsRef, getLeft, renderColRef, renderItemWithColsRef } = ( 13782 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion 13783 inject(xScrollInjextionKey) 13784 ); 13785 return { 13786 startIndex: startIndexRef, 13787 endIndex: endIndexRef, 13788 columns: columnsRef, 13789 renderCol: renderColRef, 13790 renderItemWithCols: renderItemWithColsRef, 13791 getLeft 13792 }; 13793 }, 13794 render() { 13795 const { startIndex, endIndex, columns, renderCol, renderItemWithCols, getLeft, item } = this; 13796 if (renderItemWithCols != null) { 13797 return renderItemWithCols({ 13798 itemIndex: this.index, 13799 startColIndex: startIndex, 13800 endColIndex: endIndex, 13801 allColumns: columns, 13802 item, 13803 getLeft 13804 }); 13805 } 13806 if (renderCol != null) { 13807 const items = []; 13808 for (let i = startIndex; i <= endIndex; ++i) { 13809 const column = columns[i]; 13810 items.push(renderCol({ column, left: getLeft(i), item })); 13811 } 13812 return items; 13813 } 13814 return null; 13815 } 13816}); 13817const styles = c(".v-vl", { 13818 maxHeight: "inherit", 13819 height: "100%", 13820 overflow: "auto", 13821 minWidth: "1px" 13822 // a zero width container won't be scrollable 13823}, [ 13824 c("&:not(.v-vl--show-scrollbar)", { 13825 scrollbarWidth: "none" 13826 }, [ 13827 c("&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb", { 13828 width: 0, 13829 height: 0, 13830 display: "none" 13831 }) 13832 ]) 13833]); 13834const VVirtualList = defineComponent({ 13835 name: "VirtualList", 13836 inheritAttrs: false, 13837 props: { 13838 showScrollbar: { 13839 type: Boolean, 13840 default: true 13841 }, 13842 columns: { 13843 type: Array, 13844 default: () => [] 13845 }, 13846 renderCol: Function, 13847 renderItemWithCols: Function, 13848 items: { 13849 type: Array, 13850 default: () => [] 13851 }, 13852 // it is suppose to be the min height 13853 itemSize: { 13854 type: Number, 13855 required: true 13856 }, 13857 itemResizable: Boolean, 13858 itemsStyle: [String, Object], 13859 visibleItemsTag: { 13860 type: [String, Object], 13861 default: "div" 13862 }, 13863 visibleItemsProps: Object, 13864 ignoreItemResize: Boolean, 13865 onScroll: Function, 13866 onWheel: Function, 13867 onResize: Function, 13868 defaultScrollKey: [Number, String], 13869 defaultScrollIndex: Number,
13870 keyField: { 13871 type: String, 13872 default: "key" 13873 }, 13874 // Whether it is a good API? 13875 // ResizeObserver + footer & header is not enough. 13876 // Too complex for simple case 13877 paddingTop: { 13878 type: [Number, String], 13879 default: 0 13880 }, 13881 paddingBottom: { 13882 type: [Number, String], 13883 default: 0 13884 } 13885 }, 13886 setup(props) { 13887 const ssrAdapter2 = useSsrAdapter(); 13888 styles.mount({ 13889 id: "vueuc/virtual-list", 13890 head: true, 13891 anchorMetaName: cssrAnchorMetaName$1, 13892 ssr: ssrAdapter2 13893 }); 13894 onMounted(() => { 13895 const { defaultScrollIndex, defaultScrollKey } = props; 13896 if (defaultScrollIndex !== void 0 && defaultScrollIndex !== null) { 13897 scrollTo({ index: defaultScrollIndex }); 13898 } else if (defaultScrollKey !== void 0 && defaultScrollKey !== null) { 13899 scrollTo({ key: defaultScrollKey }); 13900 } 13901 }); 13902 let isDeactivated = false; 13903 let activateStateInitialized = false; 13904 onActivated(() => { 13905 isDeactivated = false; 13906 if (!activateStateInitialized) { 13907 activateStateInitialized = true; 13908 return; 13909 } 13910 scrollTo({ top: scrollTopRef.value, left: scrollLeftRef.value }); 13911 }); 13912 onDeactivated(() => { 13913 isDeactivated = true; 13914 if (!activateStateInitialized) { 13915 activateStateInitialized = true; 13916 } 13917 }); 13918 const totalWidthRef = useMemo(() => { 13919 if (props.renderCol == null && props.renderItemWithCols == null) { 13920 return void 0; 13921 } 13922 if (props.columns.length === 0) 13923 return void 0; 13924 let width = 0; 13925 props.columns.forEach((column) => { 13926 width += column.width; 13927 }); 13928 return width; 13929 }); 13930 const keyIndexMapRef = computed(() => { 13931 const map2 = /* @__PURE__ */ new Map(); 13932 const { keyField } = props; 13933 props.items.forEach((item, index) => { 13934 map2.set(item[keyField], index); 13935 }); 13936 return map2; 13937 }); 13938 const { scrollLeftRef, listWidthRef } = setupXScroll({ 13939 columnsRef: toRef(props, "columns"), 13940 renderColRef: toRef(props, "renderCol"), 13941 renderItemWithColsRef: toRef(props, "renderItemWithCols") 13942 }); 13943 const listElRef = ref(null); 13944 const listHeightRef = ref(void 0); 13945 const keyToHeightOffset = /* @__PURE__ */ new Map(); 13946 const finweckTreeRef = computed(() => { 13947 const { items, itemSize, keyField } = props; 13948 const ft = new FinweckTree(items.length, itemSize); 13949 items.forEach((item, index) => { 13950 const key = item[keyField]; 13951 const heightOffset = keyToHeightOffset.get(key); 13952 if (heightOffset !== void 0) { 13953 ft.add(index, heightOffset); 13954 } 13955 }); 13956 return ft; 13957 }); 13958 const finweckTreeUpdateTrigger = ref(0); 13959 const scrollTopRef = ref(0); 13960 const startIndexRef = useMemo(() => { 13961 return Math.max(finweckTreeRef.value.getBound(scrollTopRef.value - depx(props.paddingTop)) - 1, 0); 13962 }); 13963 const viewportItemsRef = computed(() => { 13964 const { value: listHeight } = listHeightRef; 13965 if (listHeight === void 0) 13966 return []; 13967 const { items, itemSize } = props; 13968 const startIndex = startIndexRef.value; 13969 const endIndex = Math.min(startIndex + Math.ceil(listHeight / itemSize + 1), items.length - 1); 13970 const viewportItems = []; 13971 for (let i = startIndex; i <= endIndex; ++i) { 13972 viewportItems.push(items[i]); 13973 } 13974 return viewportItems; 13975 }); 13976 const scrollTo = (options, y) => { 13977 if (typeof options === "number") { 13978 scrollToPosition(options, y, "auto"); 13979 return; 13980 } 13981 const { left, top, index, key, position, behavior, debounce = true } = options; 13982 if (left !== void 0 || top !== void 0) { 13983 scrollToPosition(left, top, behavior); 13984 } else if (index !== void 0) { 13985 scrollToIndex(index, behavior, debounce); 13986 } else if (key !== void 0) { 13987 const toIndex = keyIndexMapRef.value.get(key); 13988 if (toIndex !== void 0) 13989 scrollToIndex(toIndex, behavior, debounce); 13990 } else if (position === "bottom") { 13991 scrollToPosition(0, Number.MAX_SAFE_INTEGER, behavior); 13992 } else if (position === "top") { 13993 scrollToPosition(0, 0, behavior); 13994 } 13995 }; 13996 let anchorIndex; 13997 let anchorTimerId = null; 13998 function scrollToIndex(index, behavior, debounce) { 13999 const { value: ft } = finweckTreeRef; 14000 const targetTop = ft.sum(index) + depx(props.paddingTop); 14001 if (!debounce) { 14002 listElRef.value.scrollTo({ 14003 left: 0, 14004 top: targetTop, 14005 behavior 14006 }); 14007 } else { 14008 anchorIndex = index; 14009 if (anchorTimerId !== null) { 14010 window.clearTimeout(anchorTimerId); 14011 } 14012 anchorTimerId = window.setTimeout(() => { 14013 anchorIndex = void 0; 14014 anchorTimerId = null; 14015 }, 16); 14016 const { scrollTop, offsetHeight } = listElRef.value; 14017 if (targetTop > scrollTop) { 14018 const itemSize = ft.get(index); 14019 if (targetTop + itemSize <= scrollTop + offsetHeight) 14020 ; 14021 else { 14022 listElRef.value.scrollTo({ 14023 left: 0, 14024 top: targetTop + itemSize - offsetHeight, 14025 behavior 14026 }); 14027 } 14028 } else { 14029 listElRef.value.scrollTo({ 14030 left: 0, 14031 top: targetTop, 14032 behavior 14033 }); 14034 } 14035 } 14036 } 14037 function scrollToPosition(left, top, behavior) { 14038 listElRef.value.scrollTo({ 14039 left, 14040 top, 14041 behavior 14042 }); 14043 } 14044 function handleItemResize(key, entry) { 14045 var _a2, _b, _c; 14046 if (isDeactivated) 14047 return; 14048 if (props.ignoreItemResize) 14049 return;
14050 if (isHideByVShow(entry.target)) 14051 return; 14052 const { value: ft } = finweckTreeRef; 14053 const index = keyIndexMapRef.value.get(key); 14054 const previousHeight = ft.get(index); 14055 const height = (_c = (_b = (_a2 = entry.borderBoxSize) === null || _a2 === void 0 ? void 0 : _a2[0]) === null || _b === void 0 ? void 0 : _b.blockSize) !== null && _c !== void 0 ? _c : entry.contentRect.height; 14056 if (height === previousHeight) 14057 return; 14058 const offset2 = height - props.itemSize; 14059 if (offset2 === 0) { 14060 keyToHeightOffset.delete(key); 14061 } else { 14062 keyToHeightOffset.set(key, height - props.itemSize); 14063 } 14064 const delta = height - previousHeight; 14065 if (delta === 0) 14066 return; 14067 ft.add(index, delta); 14068 const listEl = listElRef.value; 14069 if (listEl != null) { 14070 if (anchorIndex === void 0) { 14071 const previousHeightSum = ft.sum(index); 14072 if (listEl.scrollTop > previousHeightSum) { 14073 listEl.scrollBy(0, delta); 14074 } 14075 } else { 14076 if (index < anchorIndex) { 14077 listEl.scrollBy(0, delta); 14078 } else if (index === anchorIndex) { 14079 const previousHeightSum = ft.sum(index); 14080 if (height + previousHeightSum > // Note, listEl shouldn't have border, nor offsetHeight won't be 14081 // correct 14082 listEl.scrollTop + listEl.offsetHeight) { 14083 listEl.scrollBy(0, delta); 14084 } 14085 } 14086 } 14087 syncViewport(); 14088 } 14089 finweckTreeUpdateTrigger.value++; 14090 } 14091 const mayUseWheel = !ensureMaybeTouch(); 14092 let wheelCatched = false; 14093 function handleListScroll(e) { 14094 var _a2; 14095 (_a2 = props.onScroll) === null || _a2 === void 0 ? void 0 : _a2.call(props, e); 14096 if (!mayUseWheel || !wheelCatched) { 14097 syncViewport(); 14098 } 14099 } 14100 function handleListWheel(e) { 14101 var _a2; 14102 (_a2 = props.onWheel) === null || _a2 === void 0 ? void 0 : _a2.call(props, e); 14103 if (mayUseWheel) { 14104 const listEl = listElRef.value; 14105 if (listEl != null) { 14106 if (e.deltaX === 0) { 14107 if (listEl.scrollTop === 0 && e.deltaY <= 0) { 14108 return; 14109 } 14110 if (listEl.scrollTop + listEl.offsetHeight >= listEl.scrollHeight && e.deltaY >= 0) { 14111 return; 14112 } 14113 } 14114 e.preventDefault(); 14115 listEl.scrollTop += e.deltaY / ensureWheelScale(); 14116 listEl.scrollLeft += e.deltaX / ensureWheelScale(); 14117 syncViewport(); 14118 wheelCatched = true; 14119 beforeNextFrameOnce(() => { 14120 wheelCatched = false; 14121 }); 14122 } 14123 } 14124 } 14125 function handleListResize(entry) { 14126 if (isDeactivated) 14127 return; 14128 if (isHideByVShow(entry.target)) 14129 return; 14130 if (props.renderCol == null && props.renderItemWithCols == null) { 14131 if (entry.contentRect.height === listHeightRef.value) 14132 return; 14133 } else { 14134 if (entry.contentRect.height === listHeightRef.value && entry.contentRect.width === listWidthRef.value) { 14135 return; 14136 } 14137 } 14138 listHeightRef.value = entry.contentRect.height; 14139 listWidthRef.value = entry.contentRect.width; 14140 const { onResize } = props; 14141 if (onResize !== void 0) 14142 onResize(entry); 14143 } 14144 function syncViewport() { 14145 const { value: listEl } = listElRef; 14146 if (listEl == null) 14147 return; 14148 scrollTopRef.value = listEl.scrollTop; 14149 scrollLeftRef.value = listEl.scrollLeft; 14150 } 14151 function isHideByVShow(el) { 14152 let cursor = el; 14153 while (cursor !== null) { 14154 if (cursor.style.display === "none") 14155 return true; 14156 cursor = cursor.parentElement; 14157 } 14158 return false; 14159 } 14160 return { 14161 listHeight: listHeightRef, 14162 listStyle: { 14163 overflow: "auto" 14164 }, 14165 keyToIndex: keyIndexMapRef, 14166 itemsStyle: computed(() => { 14167 const { itemResizable } = props; 14168 const height = pxfy(finweckTreeRef.value.sum()); 14169 finweckTreeUpdateTrigger.value; 14170 return [ 14171 props.itemsStyle, 14172 { 14173 boxSizing: "content-box", 14174 width: pxfy(totalWidthRef.value), 14175 height: itemResizable ? "" : height, 14176 minHeight: itemResizable ? height : "", 14177 paddingTop: pxfy(props.paddingTop), 14178 paddingBottom: pxfy(props.paddingBottom) 14179 } 14180 ]; 14181 }), 14182 visibleItemsStyle: computed(() => { 14183 finweckTreeUpdateTrigger.value; 14184 return { 14185 transform: `translateY(${pxfy(finweckTreeRef.value.sum(startIndexRef.value))})` 14186 }; 14187 }), 14188 viewportItems: viewportItemsRef, 14189 listElRef, 14190 itemsElRef: ref(null), 14191 scrollTo, 14192 handleListResize, 14193 handleListScroll, 14194 handleListWheel, 14195 handleItemResize 14196 }; 14197 }, 14198 render() { 14199 const { itemResizable, keyField, keyToIndex, visibleItemsTag } = this; 14200 return h(VResizeObserver, { 14201 onResize: this.handleListResize 14202 }, {
14203 default: () => { 14204 var _a2, _b; 14205 return h("div", mergeProps(this.$attrs, { 14206 class: ["v-vl", this.showScrollbar && "v-vl--show-scrollbar"], 14207 onScroll: this.handleListScroll, 14208 onWheel: this.handleListWheel, 14209 ref: "listElRef" 14210 }), [ 14211 this.items.length !== 0 ? h("div", { 14212 ref: "itemsElRef", 14213 class: "v-vl-items", 14214 style: this.itemsStyle 14215 }, [ 14216 h(visibleItemsTag, Object.assign({ 14217 class: "v-vl-visible-items", 14218 style: this.visibleItemsStyle 14219 }, this.visibleItemsProps), { 14220 default: () => { 14221 const { renderCol, renderItemWithCols } = this; 14222 return this.viewportItems.map((item) => { 14223 const key = item[keyField]; 14224 const index = keyToIndex.get(key); 14225 const renderedCols = renderCol != null ? h(VirtualListRow, { 14226 index, 14227 item 14228 }) : void 0; 14229 const renderedItemWithCols = renderItemWithCols != null ? h(VirtualListRow, { 14230 index, 14231 item 14232 }) : void 0; 14233 const itemVNode = this.$slots.default({ 14234 item, 14235 renderedCols, 14236 renderedItemWithCols, 14237 index 14238 })[0]; 14239 if (itemResizable) { 14240 return h(VResizeObserver, { 14241 key, 14242 onResize: (entry) => this.handleItemResize(key, entry) 14243 }, { 14244 default: () => itemVNode 14245 }); 14246 } 14247 itemVNode.key = key; 14248 return itemVNode; 14249 }); 14250 } 14251 }) 14252 ]) : (_b = (_a2 = this.$slots).empty) === null || _b === void 0 ? void 0 : _b.call(_a2) 14253 ]); 14254 } 14255 }); 14256 } 14257}); 14258const hiddenAttr = "v-hidden"; 14259const style$o = c("[v-hidden]", { 14260 display: "none!important" 14261}); 14262const VOverflow = defineComponent({ 14263 name: "Overflow", 14264 props: { 14265 getCounter: Function, 14266 getTail: Function, 14267 updateCounter: Function, 14268 onUpdateCount: Function, 14269 onUpdateOverflow: Function 14270 }, 14271 setup(props, { slots }) { 14272 const selfRef = ref(null); 14273 const counterRef = ref(null); 14274 function deriveCounter(options) { 14275 const { value: self2 } = selfRef; 14276 const { getCounter, getTail } = props; 14277 let counter; 14278 if (getCounter !== void 0) 14279 counter = getCounter(); 14280 else { 14281 counter = counterRef.value; 14282 } 14283 if (!self2 || !counter) 14284 return; 14285 if (counter.hasAttribute(hiddenAttr)) { 14286 counter.removeAttribute(hiddenAttr); 14287 } 14288 const { children } = self2; 14289 if (options.showAllItemsBeforeCalculate) { 14290 for (const child of children) { 14291 if (child.hasAttribute(hiddenAttr)) { 14292 child.removeAttribute(hiddenAttr); 14293 } 14294 } 14295 } 14296 const containerWidth = self2.offsetWidth; 14297 const childWidths = []; 14298 const tail = slots.tail ? getTail === null || getTail === void 0 ? void 0 : getTail() : null; 14299 let childWidthSum = tail ? tail.offsetWidth : 0; 14300 let overflow = false; 14301 const len2 = self2.children.length - (slots.tail ? 1 : 0); 14302 for (let i = 0; i < len2 - 1; ++i) { 14303 if (i < 0) 14304 continue; 14305 const child = children[i]; 14306 if (overflow) { 14307 if (!child.hasAttribute(hiddenAttr)) { 14308 child.setAttribute(hiddenAttr, ""); 14309 } 14310 continue; 14311 } else if (child.hasAttribute(hiddenAttr)) { 14312 child.removeAttribute(hiddenAttr); 14313 } 14314 const childWidth = child.offsetWidth; 14315 childWidthSum += childWidth; 14316 childWidths[i] = childWidth; 14317 if (childWidthSum > containerWidth) { 14318 const { updateCounter } = props; 14319 for (let j = i; j >= 0; --j) { 14320 const restCount = len2 - 1 - j; 14321 if (updateCounter !== void 0) { 14322 updateCounter(restCount); 14323 } else { 14324 counter.textContent = `${restCount}`; 14325 } 14326 const counterWidth = counter.offsetWidth; 14327 childWidthSum -= childWidths[j]; 14328 if (childWidthSum + counterWidth <= containerWidth || j === 0) { 14329 overflow = true; 14330 i = j - 1; 14331 if (tail) { 14332 if (i === -1) { 14333 tail.style.maxWidth = `${containerWidth - counterWidth}px`; 14334 tail.style.boxSizing = "border-box"; 14335 } else { 14336 tail.style.maxWidth = ""; 14337 } 14338 } 14339 const { onUpdateCount } = props; 14340 if (onUpdateCount) 14341 onUpdateCount(restCount); 14342 break; 14343 } 14344 } 14345 } 14346 } 14347 const { onUpdateOverflow } = props; 14348 if (!overflow) { 14349 if (onUpdateOverflow !== void 0) { 14350 onUpdateOverflow(false); 14351 } 14352 counter.setAttribute(hiddenAttr, ""); 14353 } else { 14354 if (onUpdateOverflow !== void 0) { 14355 onUpdateOverflow(true); 14356 } 14357 } 14358 } 14359 const ssrAdapter2 = useSsrAdapter(); 14360 style$o.mount({ 14361 id: "vueuc/overflow", 14362 head: true, 14363 anchorMetaName: cssrAnchorMetaName$1, 14364 ssr: ssrAdapter2 14365 }); 14366 onMounted(() => deriveCounter({ 14367 showAllItemsBeforeCalculate: false 14368 })); 14369 return { 14370 selfRef, 14371 counterRef, 14372 sync: deriveCounter 14373 }; 14374 }, 14375 render() { 14376 const { $slots } = this; 14377 nextTick(() => this.sync({ 14378 showAllItemsBeforeCalculate: false 14379 })); 14380 return h("div", { 14381 class: "v-overflow", 14382 ref: "selfRef" 14383 }, [ 14384 renderSlot($slots, "default"), 14385 // $slots.counter should only has 1 element 14386 $slots.counter ? $slots.counter() : h("span", { 14387 style: { 14388 display: "inline-block" 14389 }, 14390 ref: "counterRef" 14391 }), 14392 // $slots.tail should only has 1 element 14393 $slots.tail ? $slots.tail() : null 14394 ]); 14395 } 14396}); 14397function isHTMLElement(node) { 14398 return node instanceof HTMLElement; 14399} 14400function focusFirstDescendant(node) { 14401 for (let i = 0; i < node.childNodes.length; i++) { 14402 const child = node.childNodes[i]; 14403 if (isHTMLElement(child)) { 14404 if (attemptFocus(child) || focusFirstDescendant(child)) { 14405 return true; 14406 } 14407 } 14408 } 14409 return false;
14410} 14411function focusLastDescendant(element) { 14412 for (let i = element.childNodes.length - 1; i >= 0; i--) { 14413 const child = element.childNodes[i]; 14414 if (isHTMLElement(child)) { 14415 if (attemptFocus(child) || focusLastDescendant(child)) { 14416 return true; 14417 } 14418 } 14419 } 14420 return false; 14421} 14422function attemptFocus(element) { 14423 if (!isFocusable(element)) { 14424 return false; 14425 } 14426 try { 14427 element.focus({ preventScroll: true }); 14428 } catch (e) { 14429 } 14430 return document.activeElement === element; 14431} 14432function isFocusable(element) { 14433 if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) { 14434 return true; 14435 } 14436 if (element.getAttribute("disabled")) { 14437 return false; 14438 } 14439 switch (element.nodeName) { 14440 case "A": 14441 return !!element.href && element.rel !== "ignore"; 14442 case "INPUT": 14443 return element.type !== "hidden" && element.type !== "file"; 14444 case "BUTTON": 14445 case "SELECT": 14446 case "TEXTAREA": 14447 return true; 14448 default: 14449 return false; 14450 } 14451} 14452let stack = []; 14453const FocusTrap = defineComponent({ 14454 name: "FocusTrap", 14455 props: { 14456 disabled: Boolean, 14457 active: Boolean, 14458 autoFocus: { 14459 type: Boolean, 14460 default: true 14461 }, 14462 onEsc: Function, 14463 initialFocusTo: String, 14464 finalFocusTo: String, 14465 returnFocusOnDeactivated: { 14466 type: Boolean, 14467 default: true 14468 } 14469 }, 14470 setup(props) { 14471 const id = createId(); 14472 const focusableStartRef = ref(null); 14473 const focusableEndRef = ref(null); 14474 let activated = false; 14475 let ignoreInternalFocusChange = false; 14476 const lastFocusedElement = typeof document === "undefined" ? null : document.activeElement; 14477 function isCurrentActive() { 14478 const currentActiveId = stack[stack.length - 1]; 14479 return currentActiveId === id; 14480 } 14481 function handleDocumentKeydown(e) { 14482 var _a2; 14483 if (e.code === "Escape") { 14484 if (isCurrentActive()) { 14485 (_a2 = props.onEsc) === null || _a2 === void 0 ? void 0 : _a2.call(props, e); 14486 } 14487 } 14488 } 14489 onMounted(() => { 14490 watch(() => props.active, (value) => { 14491 if (value) { 14492 activate(); 14493 on("keydown", document, handleDocumentKeydown); 14494 } else { 14495 off("keydown", document, handleDocumentKeydown); 14496 if (activated) { 14497 deactivate(); 14498 } 14499 } 14500 }, { 14501 immediate: true 14502 }); 14503 }); 14504 onBeforeUnmount(() => { 14505 off("keydown", document, handleDocumentKeydown); 14506 if (activated) 14507 deactivate(); 14508 }); 14509 function handleDocumentFocus(e) { 14510 if (ignoreInternalFocusChange) 14511 return; 14512 if (isCurrentActive()) { 14513 const mainEl = getMainEl(); 14514 if (mainEl === null) 14515 return; 14516 if (mainEl.contains(getPreciseEventTarget(e))) 14517 return; 14518 resetFocusTo("first"); 14519 } 14520 } 14521 function getMainEl() { 14522 const focusableStartEl = focusableStartRef.value; 14523 if (focusableStartEl === null) 14524 return null; 14525 let mainEl = focusableStartEl; 14526 while (true) { 14527 mainEl = mainEl.nextSibling; 14528 if (mainEl === null) 14529 break; 14530 if (mainEl instanceof Element && mainEl.tagName === "DIV") { 14531 break; 14532 } 14533 } 14534 return mainEl; 14535 } 14536 function activate() { 14537 var _a2; 14538 if (props.disabled) 14539 return; 14540 stack.push(id); 14541 if (props.autoFocus) { 14542 const { initialFocusTo } = props; 14543 if (initialFocusTo === void 0) { 14544 resetFocusTo("first"); 14545 } else { 14546 (_a2 = resolveTo(initialFocusTo)) === null || _a2 === void 0 ? void 0 : _a2.focus({ preventScroll: true }); 14547 } 14548 } 14549 activated = true; 14550 document.addEventListener("focus", handleDocumentFocus, true); 14551 } 14552 function deactivate() { 14553 var _a2; 14554 if (props.disabled) 14555 return; 14556 document.removeEventListener("focus", handleDocumentFocus, true); 14557 stack = stack.filter((idInStack) => idInStack !== id); 14558 if (isCurrentActive()) 14559 return; 14560 const { finalFocusTo } = props; 14561 if (finalFocusTo !== void 0) { 14562 (_a2 = resolveTo(finalFocusTo)) === null || _a2 === void 0 ? void 0 : _a2.focus({ preventScroll: true }); 14563 } else if (props.returnFocusOnDeactivated) { 14564 if (lastFocusedElement instanceof HTMLElement) { 14565 ignoreInternalFocusChange = true; 14566 lastFocusedElement.focus({ preventScroll: true }); 14567 ignoreInternalFocusChange = false;
14568 } 14569 } 14570 } 14571 function resetFocusTo(target) { 14572 if (!isCurrentActive()) 14573 return; 14574 if (props.active) { 14575 const focusableStartEl = focusableStartRef.value; 14576 const focusableEndEl = focusableEndRef.value; 14577 if (focusableStartEl !== null && focusableEndEl !== null) { 14578 const mainEl = getMainEl(); 14579 if (mainEl == null || mainEl === focusableEndEl) { 14580 ignoreInternalFocusChange = true; 14581 focusableStartEl.focus({ preventScroll: true }); 14582 ignoreInternalFocusChange = false; 14583 return; 14584 } 14585 ignoreInternalFocusChange = true; 14586 const focused = target === "first" ? focusFirstDescendant(mainEl) : focusLastDescendant(mainEl); 14587 ignoreInternalFocusChange = false; 14588 if (!focused) { 14589 ignoreInternalFocusChange = true; 14590 focusableStartEl.focus({ preventScroll: true }); 14591 ignoreInternalFocusChange = false; 14592 } 14593 } 14594 } 14595 } 14596 function handleStartFocus(e) { 14597 if (ignoreInternalFocusChange) 14598 return; 14599 const mainEl = getMainEl(); 14600 if (mainEl === null) 14601 return; 14602 if (e.relatedTarget !== null && mainEl.contains(e.relatedTarget)) { 14603 resetFocusTo("last"); 14604 } else { 14605 resetFocusTo("first"); 14606 } 14607 } 14608 function handleEndFocus(e) { 14609 if (ignoreInternalFocusChange) 14610 return; 14611 if (e.relatedTarget !== null && e.relatedTarget === focusableStartRef.value) { 14612 resetFocusTo("last"); 14613 } else { 14614 resetFocusTo("first"); 14615 } 14616 } 14617 return { 14618 focusableStartRef, 14619 focusableEndRef, 14620 focusableStyle: "position: absolute; height: 0; width: 0;", 14621 handleStartFocus, 14622 handleEndFocus 14623 }; 14624 }, 14625 render() { 14626 const { default: defaultSlot } = this.$slots; 14627 if (defaultSlot === void 0) 14628 return null; 14629 if (this.disabled) 14630 return defaultSlot(); 14631 const { active, focusableStyle } = this; 14632 return h(Fragment, null, [ 14633 h("div", { 14634 "aria-hidden": "true", 14635 tabindex: active ? "0" : "-1", 14636 ref: "focusableStartRef", 14637 style: focusableStyle, 14638 onFocus: this.handleStartFocus 14639 }), 14640 defaultSlot(), 14641 h("div", { 14642 "aria-hidden": "true", 14643 style: focusableStyle, 14644 ref: "focusableEndRef", 14645 tabindex: active ? "0" : "-1", 14646 onFocus: this.handleEndFocus 14647 }) 14648 ]); 14649 } 14650}); 14651function useOnResize(elRef, onResize) { 14652 if (onResize) { 14653 onMounted(() => { 14654 const { 14655 value: el 14656 } = elRef; 14657 if (el) { 14658 resizeObserverManager.registerHandler(el, onResize); 14659 } 14660 }); 14661 onBeforeUnmount(() => { 14662 const { 14663 value: el 14664 } = elRef; 14665 if (el) { 14666 resizeObserverManager.unregisterHandler(el); 14667 } 14668 }); 14669 } 14670} 14671let lockCount = 0; 14672let originalMarginRight = ""; 14673let originalOverflow = ""; 14674let originalOverflowX = ""; 14675let originalOverflowY = ""; 14676const lockHtmlScrollRightCompensationRef = ref("0px"); 14677function useLockHtmlScroll(lockRef) { 14678 if (typeof document === "undefined") 14679 return; 14680 const el = document.documentElement; 14681 let watchStopHandle; 14682 let activated = false; 14683 const unlock = () => { 14684 el.style.marginRight = originalMarginRight; 14685 el.style.overflow = originalOverflow; 14686 el.style.overflowX = originalOverflowX; 14687 el.style.overflowY = originalOverflowY; 14688 lockHtmlScrollRightCompensationRef.value = "0px"; 14689 }; 14690 onMounted(() => { 14691 watchStopHandle = watch(lockRef, (value) => { 14692 if (value) { 14693 if (!lockCount) { 14694 const scrollbarWidth = window.innerWidth - el.offsetWidth; 14695 if (scrollbarWidth > 0) { 14696 originalMarginRight = el.style.marginRight; 14697 el.style.marginRight = `${scrollbarWidth}px`; 14698 lockHtmlScrollRightCompensationRef.value = `${scrollbarWidth}px`; 14699 } 14700 originalOverflow = el.style.overflow; 14701 originalOverflowX = el.style.overflowX; 14702 originalOverflowY = el.style.overflowY; 14703 el.style.overflow = "hidden"; 14704 el.style.overflowX = "hidden"; 14705 el.style.overflowY = "hidden"; 14706 } 14707 activated = true; 14708 lockCount++; 14709 } else { 14710 lockCount--; 14711 if (!lockCount) { 14712 unlock(); 14713 } 14714 activated = false;
14715 } 14716 }, { 14717 immediate: true 14718 }); 14719 }); 14720 onBeforeUnmount(() => { 14721 watchStopHandle === null || watchStopHandle === void 0 ? void 0 : watchStopHandle(); 14722 if (activated) { 14723 lockCount--; 14724 if (!lockCount) { 14725 unlock(); 14726 } 14727 activated = false; 14728 } 14729 }); 14730} 14731const isComposingRef = ref(false); 14732const compositionStartHandler = () => { 14733 isComposingRef.value = true; 14734}; 14735const compositionEndHandler = () => { 14736 isComposingRef.value = false; 14737}; 14738let mountedCount = 0; 14739const useIsComposing = () => { 14740 if (isBrowser$2) { 14741 onBeforeMount(() => { 14742 if (!mountedCount) { 14743 window.addEventListener("compositionstart", compositionStartHandler); 14744 window.addEventListener("compositionend", compositionEndHandler); 14745 } 14746 mountedCount++; 14747 }); 14748 onBeforeUnmount(() => { 14749 if (mountedCount <= 1) { 14750 window.removeEventListener("compositionstart", compositionStartHandler); 14751 window.removeEventListener("compositionend", compositionEndHandler); 14752 mountedCount = 0; 14753 } else { 14754 mountedCount--; 14755 } 14756 }); 14757 } 14758 return isComposingRef; 14759}; 14760function useReactivated(callback) { 14761 const isDeactivatedRef = { 14762 isDeactivated: false 14763 }; 14764 let activateStateInitialized = false; 14765 onActivated(() => { 14766 isDeactivatedRef.isDeactivated = false; 14767 if (!activateStateInitialized) { 14768 activateStateInitialized = true; 14769 return; 14770 } 14771 callback(); 14772 }); 14773 onDeactivated(() => { 14774 isDeactivatedRef.isDeactivated = true; 14775 if (!activateStateInitialized) { 14776 activateStateInitialized = true; 14777 } 14778 }); 14779 return isDeactivatedRef; 14780} 14781const formItemInjectionKey = createInjectionKey("n-form-item"); 14782function useFormItem(props, { 14783 defaultSize = "medium", 14784 mergedSize, 14785 mergedDisabled 14786} = {}) { 14787 const NFormItem2 = inject(formItemInjectionKey, null); 14788 provide(formItemInjectionKey, null); 14789 const mergedSizeRef = computed(mergedSize ? () => mergedSize(NFormItem2) : () => { 14790 const { 14791 size: size2 14792 } = props; 14793 if (size2) 14794 return size2; 14795 if (NFormItem2) { 14796 const { 14797 mergedSize: mergedSize2 14798 } = NFormItem2; 14799 if (mergedSize2.value !== void 0) { 14800 return mergedSize2.value; 14801 } 14802 } 14803 return defaultSize; 14804 }); 14805 const mergedDisabledRef = computed(mergedDisabled ? () => mergedDisabled(NFormItem2) : () => { 14806 const { 14807 disabled 14808 } = props; 14809 if (disabled !== void 0) { 14810 return disabled; 14811 } 14812 if (NFormItem2) { 14813 return NFormItem2.disabled.value; 14814 } 14815 return false; 14816 }); 14817 const mergedStatusRef = computed(() => { 14818 const { 14819 status 14820 } = props; 14821 if (status) 14822 return status; 14823 return NFormItem2 === null || NFormItem2 === void 0 ? void 0 : NFormItem2.mergedValidationStatus.value; 14824 }); 14825 onBeforeUnmount(() => { 14826 if (NFormItem2) { 14827 NFormItem2.restoreValidation(); 14828 } 14829 }); 14830 return { 14831 mergedSizeRef, 14832 mergedDisabledRef, 14833 mergedStatusRef, 14834 nTriggerFormBlur() { 14835 if (NFormItem2) { 14836 NFormItem2.handleContentBlur(); 14837 } 14838 }, 14839 nTriggerFormChange() { 14840 if (NFormItem2) { 14841 NFormItem2.handleContentChange(); 14842 } 14843 }, 14844 nTriggerFormFocus() { 14845 if (NFormItem2) { 14846 NFormItem2.handleContentFocus(); 14847 } 14848 }, 14849 nTriggerFormInput() { 14850 if (NFormItem2) { 14851 NFormItem2.handleContentInput(); 14852 } 14853 } 14854 }; 14855} 14856var freeGlobal = typeof global == "object" && global && global.Object === Object && global; 14857const freeGlobal$1 = freeGlobal; 14858var freeSelf = typeof self == "object" && self && self.Object === Object && self; 14859var root = freeGlobal$1 || freeSelf || Function("return this")(); 14860const root$1 = root; 14861var Symbol$1 = root$1.Symbol; 14862const Symbol$2 = Symbol$1; 14863var objectProto$f = Object.prototype; 14864var hasOwnProperty$d = objectProto$f.hasOwnProperty; 14865var nativeObjectToString$1 = objectProto$f.toString; 14866var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0; 14867function getRawTag(value) { 14868 var isOwn = hasOwnProperty$d.call(value, symToStringTag$1), tag = value[symToStringTag$1]; 14869 try { 14870 value[symToStringTag$1] = void 0; 14871 var unmasked = true; 14872 } catch (e) { 14873 } 14874 var result = nativeObjectToString$1.call(value); 14875 if (unmasked) { 14876 if (isOwn) { 14877 value[symToStringTag$1] = tag; 14878 } else { 14879 delete value[symToStringTag$1]; 14880 } 14881 } 14882 return result; 14883} 14884var objectProto$e = Object.prototype; 14885var nativeObjectToString = objectProto$e.toString; 14886function objectToString(value) { 14887 return nativeObjectToString.call(value); 14888}
14889var nullTag = "[object Null]", undefinedTag = "[object Undefined]"; 14890var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0; 14891function baseGetTag(value) { 14892 if (value == null) { 14893 return value === void 0 ? undefinedTag : nullTag; 14894 } 14895 return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value); 14896} 14897function isObjectLike(value) { 14898 return value != null && typeof value == "object"; 14899} 14900var symbolTag$3 = "[object Symbol]"; 14901function isSymbol(value) { 14902 return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3; 14903} 14904function arrayMap(array4, iteratee) { 14905 var index = -1, length = array4 == null ? 0 : array4.length, result = Array(length); 14906 while (++index < length) { 14907 result[index] = iteratee(array4[index], index, array4); 14908 } 14909 return result; 14910} 14911var isArray$1 = Array.isArray; 14912const isArray$2 = isArray$1; 14913var INFINITY$1 = 1 / 0; 14914var symbolProto$2 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0; 14915function baseToString(value) { 14916 if (typeof value == "string") { 14917 return value; 14918 } 14919 if (isArray$2(value)) { 14920 return arrayMap(value, baseToString) + ""; 14921 } 14922 if (isSymbol(value)) { 14923 return symbolToString ? symbolToString.call(value) : ""; 14924 } 14925 var result = value + ""; 14926 return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result; 14927} 14928function isObject$1(value) { 14929 var type4 = typeof value; 14930 return value != null && (type4 == "object" || type4 == "function"); 14931} 14932function identity$1(value) { 14933 return value; 14934} 14935var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]"; 14936function isFunction$2(value) { 14937 if (!isObject$1(value)) { 14938 return false; 14939 } 14940 var tag = baseGetTag(value); 14941 return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag; 14942} 14943var coreJsData = root$1["__core-js_shared__"]; 14944const coreJsData$1 = coreJsData; 14945var maskSrcKey = function() { 14946 var uid2 = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || ""); 14947 return uid2 ? "Symbol(src)_1." + uid2 : ""; 14948}(); 14949function isMasked(func) { 14950 return !!maskSrcKey && maskSrcKey in func; 14951} 14952var funcProto$2 = Function.prototype; 14953var funcToString$2 = funcProto$2.toString; 14954function toSource(func) { 14955 if (func != null) { 14956 try { 14957 return funcToString$2.call(func); 14958 } catch (e) { 14959 } 14960 try { 14961 return func + ""; 14962 } catch (e) { 14963 } 14964 } 14965 return ""; 14966} 14967var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; 14968var reIsHostCtor = /^\[object .+?Constructor\]$/; 14969var funcProto$1 = Function.prototype, objectProto$d = Object.prototype; 14970var funcToString$1 = funcProto$1.toString; 14971var hasOwnProperty$c = objectProto$d.hasOwnProperty; 14972var reIsNative = RegExp( 14973 "^" + funcToString$1.call(hasOwnProperty$c).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" 14974); 14975function baseIsNative(value) { 14976 if (!isObject$1(value) || isMasked(value)) { 14977 return false; 14978 } 14979 var pattern4 = isFunction$2(value) ? reIsNative : reIsHostCtor; 14980 return pattern4.test(toSource(value)); 14981} 14982function getValue$1(object4, key) { 14983 return object4 == null ? void 0 : object4[key]; 14984} 14985function getNative(object4, key) { 14986 var value = getValue$1(object4, key); 14987 return baseIsNative(value) ? value : void 0; 14988} 14989var WeakMap$1 = getNative(root$1, "WeakMap"); 14990const WeakMap$2 = WeakMap$1; 14991var objectCreate = Object.create; 14992var baseCreate = function() { 14993 function object4() { 14994 } 14995 return function(proto) { 14996 if (!isObject$1(proto)) { 14997 return {}; 14998 } 14999 if (objectCreate) { 15000 return objectCreate(proto); 15001 } 15002 object4.prototype = proto; 15003 var result = new object4(); 15004 object4.prototype = void 0; 15005 return result; 15006 }; 15007}(); 15008const baseCreate$1 = baseCreate; 15009function apply(func, thisArg, args) { 15010 switch (args.length) { 15011 case 0: 15012 return func.call(thisArg); 15013 case 1: 15014 return func.call(thisArg, args[0]); 15015 case 2: 15016 return func.call(thisArg, args[0], args[1]); 15017 case 3: 15018 return func.call(thisArg, args[0], args[1], args[2]); 15019 } 15020 return func.apply(thisArg, args); 15021} 15022function copyArray(source, array4) { 15023 var index = -1, length = source.length; 15024 array4 || (array4 = Array(length)); 15025 while (++index < length) { 15026 array4[index] = source[index]; 15027 } 15028 return array4; 15029} 15030var HOT_COUNT = 800, HOT_SPAN = 16; 15031var nativeNow = Date.now; 15032function shortOut(func) { 15033 var count = 0, lastCalled = 0; 15034 return function() { 15035 var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); 15036 lastCalled = stamp; 15037 if (remaining > 0) { 15038 if (++count >= HOT_COUNT) { 15039 return arguments[0]; 15040 } 15041 } else { 15042 count = 0; 15043 } 15044 return func.apply(void 0, arguments); 15045 }; 15046} 15047function constant(value) { 15048 return function() { 15049 return value; 15050 }; 15051} 15052var defineProperty = function() { 15053 try { 15054 var func = getNative(Object, "defineProperty"); 15055 func({}, "", {}); 15056 return func; 15057 } catch (e) { 15058 } 15059}(); 15060const defineProperty$1 = defineProperty; 15061var baseSetToString = !defineProperty$1 ? identity$1 : function(func, string3) { 15062 return defineProperty$1(func, "toString", { 15063 "configurable": true, 15064 "enumerable": false, 15065 "value": constant(string3), 15066 "writable": true 15067 }); 15068}; 15069const baseSetToString$1 = baseSetToString; 15070var setToString = shortOut(baseSetToString$1); 15071const setToString$1 = setToString; 15072function arrayEach(array4, iteratee) { 15073 var index = -1, length = array4 == null ? 0 : array4.length; 15074 while (++index < length) { 15075 if (iteratee(array4[index], index, array4) === false) { 15076 break; 15077 } 15078 } 15079 return array4; 15080} 15081var MAX_SAFE_INTEGER$1 = 9007199254740991; 15082var reIsUint = /^(?:0|[1-9]\d*)$/; 15083function isIndex(value, length) { 15084 var type4 = typeof value; 15085 length = length == null ? MAX_SAFE_INTEGER$1 : length; 15086 return !!length && (type4 == "number" || type4 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); 15087} 15088function baseAssignValue(object4, key, value) { 15089 if (key == "__proto__" && defineProperty$1) { 15090 defineProperty$1(object4, key, { 15091 "configurable": true, 15092 "enumerable": true, 15093 "value": value, 15094 "writable": true 15095 }); 15096 } else { 15097 object4[key] = value; 15098 } 15099} 15100function eq(value, other) { 15101 return value === other || value !== value && other !== other; 15102} 15103var objectProto$c = Object.prototype; 15104var hasOwnProperty$b = objectProto$c.hasOwnProperty; 15105function assignValue(object4, key, value) { 15106 var objValue = object4[key]; 15107 if (!(hasOwnProperty$b.call(object4, key) && eq(objValue, value)) || value === void 0 && !(key in object4)) { 15108 baseAssignValue(object4, key, value); 15109 } 15110} 15111function copyObject(source, props, object4, customizer) { 15112 var isNew = !object4; 15113 object4 || (object4 = {}); 15114 var index = -1, length = props.length; 15115 while (++index < length) { 15116 var key = props[index]; 15117 var newValue = customizer ? customizer(object4[key], source[key], key, object4, source) : void 0; 15118 if (newValue === void 0) { 15119 newValue = source[key]; 15120 } 15121 if (isNew) { 15122 baseAssignValue(object4, key, newValue); 15123 } else { 15124 assignValue(object4, key, newValue); 15125 } 15126 } 15127 return object4; 15128} 15129var nativeMax = Math.max; 15130function overRest(func, start, transform) { 15131 start = nativeMax(start === void 0 ? func.length - 1 : start, 0); 15132 return function() { 15133 var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array4 = Array(length); 15134 while (++index < length) { 15135 array4[index] = args[start + index]; 15136 } 15137 index = -1; 15138 var otherArgs = Array(start + 1); 15139 while (++index < start) { 15140 otherArgs[index] = args[index]; 15141 } 15142 otherArgs[start] = transform(array4); 15143 return apply(func, this, otherArgs); 15144 }; 15145} 15146function baseRest(func, start) { 15147 return setToString$1(overRest(func, start, identity$1), func + ""); 15148} 15149var MAX_SAFE_INTEGER = 9007199254740991; 15150function isLength(value) { 15151 return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; 15152} 15153function isArrayLike(value) { 15154 return value != null && isLength(value.length) && !isFunction$2(value); 15155} 15156function isIterateeCall(value, index, object4) { 15157 if (!isObject$1(object4)) { 15158 return false;
15159 } 15160 var type4 = typeof index; 15161 if (type4 == "number" ? isArrayLike(object4) && isIndex(index, object4.length) : type4 == "string" && index in object4) { 15162 return eq(object4[index], value); 15163 } 15164 return false; 15165} 15166function createAssigner(assigner) { 15167 return baseRest(function(object4, sources) { 15168 var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0; 15169 customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0; 15170 if (guard && isIterateeCall(sources[0], sources[1], guard)) { 15171 customizer = length < 3 ? void 0 : customizer; 15172 length = 1; 15173 } 15174 object4 = Object(object4); 15175 while (++index < length) { 15176 var source = sources[index]; 15177 if (source) { 15178 assigner(object4, source, index, customizer); 15179 } 15180 } 15181 return object4; 15182 }); 15183} 15184var objectProto$b = Object.prototype; 15185function isPrototype(value) { 15186 var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$b; 15187 return value === proto; 15188} 15189function baseTimes(n2, iteratee) { 15190 var index = -1, result = Array(n2); 15191 while (++index < n2) { 15192 result[index] = iteratee(index); 15193 } 15194 return result; 15195} 15196var argsTag$3 = "[object Arguments]"; 15197function baseIsArguments(value) { 15198 return isObjectLike(value) && baseGetTag(value) == argsTag$3; 15199} 15200var objectProto$a = Object.prototype; 15201var hasOwnProperty$a = objectProto$a.hasOwnProperty; 15202var propertyIsEnumerable$1 = objectProto$a.propertyIsEnumerable; 15203var isArguments = baseIsArguments(function() { 15204 return arguments; 15205}()) ? baseIsArguments : function(value) { 15206 return isObjectLike(value) && hasOwnProperty$a.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee"); 15207}; 15208const isArguments$1 = isArguments; 15209function stubFalse() { 15210 return false; 15211} 15212var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports; 15213var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module; 15214var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2; 15215var Buffer$2 = moduleExports$2 ? root$1.Buffer : void 0; 15216var nativeIsBuffer = Buffer$2 ? Buffer$2.isBuffer : void 0; 15217var isBuffer$1 = nativeIsBuffer || stubFalse; 15218const isBuffer$2 = isBuffer$1; 15219var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", objectTag$4 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]"; 15220var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]"; 15221var typedArrayTags = {}; 15222typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true; 15223typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$5] = typedArrayTags[numberTag$3] = typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$3] = typedArrayTags[setTag$5] = typedArrayTags[stringTag$3] = typedArrayTags[weakMapTag$2] = false; 15224function baseIsTypedArray(value) { 15225 return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; 15226} 15227function baseUnary(func) { 15228 return function(value) { 15229 return func(value); 15230 }; 15231} 15232var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports; 15233var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module; 15234var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1; 15235var freeProcess = moduleExports$1 && freeGlobal$1.process; 15236var nodeUtil = function() { 15237 try { 15238 var types2 = freeModule$1 && freeModule$1.require && freeModule$1.require("util").t
15238ypes; 15239 if (types2) { 15240 return types2; 15241 } 15242 return freeProcess && freeProcess.binding && freeProcess.binding("util"); 15243 } catch (e) { 15244 } 15245}(); 15246const nodeUtil$1 = nodeUtil; 15247var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray; 15248var isTypedArray$1 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; 15249const isTypedArray$2 = isTypedArray$1; 15250var objectProto$9 = Object.prototype; 15251var hasOwnProperty$9 = objectProto$9.hasOwnProperty; 15252function arrayLikeKeys(value, inherited) { 15253 var isArr = isArray$2(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$2(value), isType = !isArr && !isArg && !isBuff && isTypedArray$2(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length; 15254 for (var key in value) { 15255 if ((inherited || hasOwnProperty$9.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. 15256 (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. 15257 isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. 15258 isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. 15259 isIndex(key, length)))) { 15260 result.push(key); 15261 } 15262 } 15263 return result; 15264} 15265function overArg(func, transform) { 15266 return function(arg) { 15267 return func(transform(arg)); 15268 }; 15269} 15270var nativeKeys = overArg(Object.keys, Object); 15271const nativeKeys$1 = nativeKeys; 15272var objectProto$8 = Object.prototype; 15273var hasOwnProperty$8 = objectProto$8.hasOwnProperty; 15274function baseKeys(object4) { 15275 if (!isPrototype(object4)) { 15276 return nativeKeys$1(object4); 15277 } 15278 var result = []; 15279 for (var key in Object(object4)) { 15280 if (hasOwnProperty$8.call(object4, key) && key != "constructor") { 15281 result.push(key); 15282 } 15283 } 15284 return result; 15285} 15286function keys(object4) { 15287 return isArrayLike(object4) ? arrayLikeKeys(object4) : baseKeys(object4); 15288} 15289function nativeKeysIn(object4) { 15290 var result = []; 15291 if (object4 != null) { 15292 for (var key in Object(object4)) { 15293 result.push(key); 15294 } 15295 } 15296 return result; 15297} 15298var objectProto$7 = Object.prototype; 15299var hasOwnProperty$7 = objectProto$7.hasOwnProperty; 15300function baseKeysIn(object4) { 15301 if (!isObject$1(object4)) { 15302 return nativeKeysIn(object4); 15303 } 15304 var isProto = isPrototype(object4), result = []; 15305 for (var key in object4) { 15306 if (!(key == "constructor" && (isProto || !hasOwnProperty$7.call(object4, key)))) { 15307 result.push(key); 15308 } 15309 } 15310 return result; 15311} 15312function keysIn(object4) { 15313 return isArrayLike(object4) ? arrayLikeKeys(object4, true) : baseKeysIn(object4); 15314} 15315var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/; 15316function isKey(value, object4) { 15317 if (isArray$2(value)) { 15318 return false; 15319 } 15320 var type4 = typeof value; 15321 if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value == null || isSymbol(value)) { 15322 return true; 15323 } 15324 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object4 != null && value in Object(object4); 15325} 15326var nativeCreate = getNative(Object, "create"); 15327const nativeCreate$1 = nativeCreate; 15328function hashClear() { 15329 this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {}; 15330 this.size = 0; 15331} 15332function hashDelete(key) { 15333 var result = this.has(key) && delete this.__data__[key]; 15334 this.size -= result ? 1 : 0; 15335 return result; 15336} 15337var HASH_UNDEFINED$2 = "__lodash_hash_undefined__"; 15338var objectProto$6 = Object.prototype; 15339var hasOwnProperty$6 = objectProto$6.hasOwnProperty; 15340function hashGet(key) { 15341 var data2 = this.__data__; 15342 if (nativeCreate$1) { 15343 var result = data2[key]; 15344 return result === HASH_UNDEFINED$2 ? void 0 : result; 15345 } 15346 return hasOwnProperty$6.call(data2, key) ? data2[key] : void 0; 15347} 15348var objectProto$5 = Object.prototype; 15349var hasOwnProperty$5 = objectProto$5.hasOwnProperty; 15350function hashHas(key) { 15351 var data2 = this.__data__; 15352 return nativeCreate$1 ? data2[key] !== void 0 : hasOwnProperty$5.call(data2, key); 15353} 15354var HASH_UNDEFINED$1 = "__lodash_hash_undefined__"; 15355function hashSet(key, value) { 15356 var data2 = this.__data__; 15357 this.size += this.has(key) ? 0 : 1; 15358 data2[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED$1 : value; 15359 return this; 15360} 15361function Hash(entries) { 15362 var index = -1, length = entries == null ? 0 : entries.length; 15363 this.clear(); 15364 while (++index < length) { 15365 var entry = entries[index]; 15366 this.set(entry[0], entry[1]); 15367 } 15368} 15369Hash.prototype.clear = hashClear; 15370Hash.prototype["delete"] = hashDelete; 15371Hash.prototype.get = hashGet; 15372Hash.prototype.has = hashHas; 15373Hash.prototype.set = hashSet; 15374function listCacheClear() { 15375 this.__data__ = []; 15376 this.size = 0; 15377} 15378function assocIndexOf(array4, key) { 15379 var length = array4.length; 15380 while (length--) { 15381 if (eq(array4[length][0], key)) { 15382 return length; 15383 } 15384 } 15385 return -1; 15386} 15387var arrayProto = Array.prototype; 15388var splice = arrayProto.splice; 15389function listCacheDelete(key) { 15390 var data2 = this.__data__, index = assocIndexOf(data2, key); 15391 if (index < 0) { 15392 return false;
15393 } 15394 var lastIndex = data2.length - 1; 15395 if (index == lastIndex) { 15396 data2.pop(); 15397 } else { 15398 splice.call(data2, index, 1); 15399 } 15400 --this.size; 15401 return true; 15402} 15403function listCacheGet(key) { 15404 var data2 = this.__data__, index = assocIndexOf(data2, key); 15405 return index < 0 ? void 0 : data2[index][1]; 15406} 15407function listCacheHas(key) { 15408 return assocIndexOf(this.__data__, key) > -1; 15409} 15410function listCacheSet(key, value) { 15411 var data2 = this.__data__, index = assocIndexOf(data2, key); 15412 if (index < 0) { 15413 ++this.size; 15414 data2.push([key, value]); 15415 } else { 15416 data2[index][1] = value; 15417 } 15418 return this; 15419} 15420function ListCache(entries) { 15421 var index = -1, length = entries == null ? 0 : entries.length; 15422 this.clear(); 15423 while (++index < length) { 15424 var entry = entries[index]; 15425 this.set(entry[0], entry[1]); 15426 } 15427} 15428ListCache.prototype.clear = listCacheClear; 15429ListCache.prototype["delete"] = listCacheDelete; 15430ListCache.prototype.get = listCacheGet; 15431ListCache.prototype.has = listCacheHas; 15432ListCache.prototype.set = listCacheSet; 15433var Map$1 = getNative(root$1, "Map"); 15434const Map$2 = Map$1; 15435function mapCacheClear() { 15436 this.size = 0; 15437 this.__data__ = { 15438 "hash": new Hash(), 15439 "map": new (Map$2 || ListCache)(), 15440 "string": new Hash() 15441 }; 15442} 15443function isKeyable(value) { 15444 var type4 = typeof value; 15445 return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value !== "__proto__" : value === null; 15446} 15447function getMapData(map2, key) { 15448 var data2 = map2.__data__; 15449 return isKeyable(key) ? data2[typeof key == "string" ? "string" : "hash"] : data2.map; 15450} 15451function mapCacheDelete(key) { 15452 var result = getMapData(this, key)["delete"](key); 15453 this.size -= result ? 1 : 0; 15454 return result; 15455} 15456function mapCacheGet(key) { 15457 return getMapData(this, key).get(key); 15458} 15459function mapCacheHas(key) { 15460 return getMapData(this, key).has(key); 15461} 15462function mapCacheSet(key, value) { 15463 var data2 = getMapData(this, key), size2 = data2.size; 15464 data2.set(key, value); 15465 this.size += data2.size == size2 ? 0 : 1; 15466 return this; 15467} 15468function MapCache(entries) { 15469 var index = -1, length = entries == null ? 0 : entries.length; 15470 this.clear(); 15471 while (++index < length) { 15472 var entry = entries[index]; 15473 this.set(entry[0], entry[1]); 15474 } 15475} 15476MapCache.prototype.clear = mapCacheClear; 15477MapCache.prototype["delete"] = mapCacheDelete; 15478MapCache.prototype.get = mapCacheGet; 15479MapCache.prototype.has = mapCacheHas; 15480MapCache.prototype.set = mapCacheSet; 15481var FUNC_ERROR_TEXT = "Expected a function"; 15482function memoize(func, resolver) { 15483 if (typeof func != "function" || resolver != null && typeof resolver != "function") { 15484 throw new TypeError(FUNC_ERROR_TEXT); 15485 } 15486 var memoized = function() { 15487 var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache2 = memoized.cache; 15488 if (cache2.has(key)) { 15489 return cache2.get(key); 15490 } 15491 var result = func.apply(this, args); 15492 memoized.cache = cache2.set(key, result) || cache2; 15493 return result; 15494 }; 15495 memoized.cache = new (memoize.Cache || MapCache)(); 15496 return memoized; 15497} 15498memoize.Cache = MapCache; 15499var MAX_MEMOIZE_SIZE = 500; 15500function memoizeCapped(func) { 15501 var result = memoize(func, function(key) { 15502 if (cache2.size === MAX_MEMOIZE_SIZE) { 15503 cache2.clear(); 15504 } 15505 return key; 15506 }); 15507 var cache2 = result.cache; 15508 return result; 15509} 15510var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; 15511var reEscapeChar = /\\(\\)?/g; 15512var stringToPath = memoizeCapped(function(string3) { 15513 var result = []; 15514 if (string3.charCodeAt(0) === 46) { 15515 result.push(""); 15516 } 15517 string3.replace(rePropName, function(match2, number4, quote, subString) { 15518 result.push(quote ? subString.replace(reEscapeChar, "$1") : number4 || match2); 15519 }); 15520 return result; 15521}); 15522const stringToPath$1 = stringToPath; 15523function toString$1(value) { 15524 return value == null ? "" : baseToString(value); 15525} 15526function castPath(value, object4) { 15527 if (isArray$2(value)) { 15528 return value; 15529 } 15530 return isKey(value, object4) ? [value] : stringToPath$1(toString$1(value)); 15531} 15532var INFINITY = 1 / 0; 15533function toKey(value) { 15534 if (typeof value == "string" || isSymbol(value)) { 15535 return value; 15536 } 15537 var result = value + ""; 15538 return result == "0" && 1 / value == -INFINITY ? "-0" : result; 15539} 15540function baseGet(object4, path) { 15541 path = castPath(path, object4); 15542 var index = 0, length = path.length; 15543 while (object4 != null && index < length) { 15544 object4 = object4[toKey(path[index++])]; 15545 } 15546 return index && index == length ? object4 : void 0; 15547} 15548function get(object4, path, defaultValue) { 15549 var result = object4 == null ? void 0 : baseGet(object4, path); 15550 return result === void 0 ? defaultValue : result; 15551} 15552function arrayPush(array4, values) { 15553 var index = -1, length = values.length, offset2 = array4.length; 15554 while (++index < length) { 15555 array4[offset2 + index] = values[index]; 15556 } 15557 return array4; 15558} 15559var getPrototype = overArg(Object.getPrototypeOf, Object); 15560const getPrototype$1 = getPrototype; 15561var objectTag$3 = "[object Object]"; 15562var funcProto = Function.prototype, objectProto$4 = Object.prototype; 15563var funcToString = funcProto.toString; 15564var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
vendor: 4,239 bytes, lines 15565-15666
15565var objectCtorString = funcToString.call(Object); 15566function isPlainObject$1(value) { 15567 if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) { 15568 return false; 15569 } 15570 var proto = getPrototype$1(value); 15571 if (proto === null) { 15572 return true; 15573 } 15574 var Ctor = hasOwnProperty$4.call(proto, "constructor") && proto.constructor; 15575 return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; 15576} 15577function baseSlice(array4, start, end) { 15578 var index = -1, length = array4.length; 15579 if (start < 0) { 15580 start = -start > length ? 0 : length + start; 15581 } 15582 end = end > length ? length : end; 15583 if (end < 0) { 15584 end += length; 15585 } 15586 length = start > end ? 0 : end - start >>> 0; 15587 start >>>= 0; 15588 var result = Array(length); 15589 while (++index < length) { 15590 result[index] = array4[index + start]; 15591 } 15592 return result; 15593} 15594function castSlice(array4, start, end) { 15595 var length = array4.length; 15596 end = end === void 0 ? length : end; 15597 return !start && end >= length ? array4 : baseSlice(array4, start, end); 15598} 15599var rsAstralRange$1 = "\\ud800-\\udfff", rsComboMarksRange$1 = "\\u0300-\\u036f", reComboHalfMarksRange$1 = "\\ufe20-\\ufe2f", rsComboSymbolsRange$1 = "\\u20d0-\\u20ff", rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1, rsVarRange$1 = "\\ufe0e\\ufe0f"; 15600var rsZWJ$1 = "\\u200d"; 15601var reHasUnicode = RegExp("[" + rsZWJ$1 + rsAstralRange$1 + rsComboRange$1 + rsVarRange$1 + "]"); 15602function hasUnicode(string3) { 15603 return reHasUnicode.test(string3); 15604} 15605function asciiToArray(string3) { 15606 return string3.split(""); 15607} 15608var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsVarRange = "\\ufe0e\\ufe0f"; 15609var rsAstral = "[" + rsAstralRange + "]", rsCombo = "[" + rsComboRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsZWJ = "\\u200d"; 15610var reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")"; 15611var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g"); 15612function unicodeToArray(string3) { 15613 return string3.match(reUnicode) || []; 15614} 15615function stringToArray(string3) { 15616 return hasUnicode(string3) ? unicodeToArray(string3) : asciiToArray(string3); 15617} 15618function createCaseFirst(methodName) { 15619 return function(string3) { 15620 string3 = toString$1(string3); 15621 var strSymbols = hasUnicode(string3) ? stringToArray(string3) : void 0; 15622 var chr = strSymbols ? strSymbols[0] : string3.charAt(0); 15623 var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string3.slice(1); 15624 return chr[methodName]() + trailing; 15625 }; 15626} 15627var upperFirst = createCaseFirst("toUpperCase"); 15628const upperFirst$1 = upperFirst; 15629function stackClear() { 15630 this.__data__ = new ListCache(); 15631 this.size = 0; 15632} 15633function stackDelete(key) { 15634 var data2 = this.__data__, result = data2["delete"](key); 15635 this.size = data2.size; 15636 return result; 15637} 15638function stackGet(key) { 15639 return this.__data__.get(key); 15640} 15641function stackHas(key) { 15642 return this.__data__.has(key); 15643} 15644var LARGE_ARRAY_SIZE = 200; 15645function stackSet(key, value) { 15646 var data2 = this.__data__; 15647 if (data2 instanceof ListCache) { 15648 var pairs = data2.__data__; 15649 if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) { 15650 pairs.push([key, value]); 15651 this.size = ++data2.size; 15652 return this; 15653 } 15654 data2 = this.__data__ = new MapCache(pairs); 15655 } 15656 data2.set(key, value); 15657 this.size = data2.size; 15658 return this; 15659} 15660function Stack(entries) { 15661 var data2 = this.__data__ = new ListCache(entries); 15662 this.size = data2.size; 15663} 15664Stack.prototype.clear = stackClear; 15665Stack.prototype["delete"] = stackDelete; 15666Stack.prototype.get = stackGet;
vendor: 5,948 bytes, lines 15667-15806
15667Stack.prototype.has = stackHas; 15668Stack.prototype.set = stackSet; 15669function baseAssign(object4, source) { 15670 return object4 && copyObject(source, keys(source), object4); 15671} 15672function baseAssignIn(object4, source) { 15673 return object4 && copyObject(source, keysIn(source), object4); 15674} 15675var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports; 15676var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module; 15677var moduleExports = freeModule && freeModule.exports === freeExports; 15678var Buffer$1 = moduleExports ? root$1.Buffer : void 0, allocUnsafe = Buffer$1 ? Buffer$1.allocUnsafe : void 0; 15679function cloneBuffer(buffer2, isDeep) { 15680 if (isDeep) { 15681 return buffer2.slice(); 15682 } 15683 var length = buffer2.length, result = allocUnsafe ? allocUnsafe(length) : new buffer2.constructor(length); 15684 buffer2.copy(result); 15685 return result; 15686} 15687function arrayFilter(array4, predicate) { 15688 var index = -1, length = array4 == null ? 0 : array4.length, resIndex = 0, result = []; 15689 while (++index < length) { 15690 var value = array4[index]; 15691 if (predicate(value, index, array4)) { 15692 result[resIndex++] = value; 15693 } 15694 } 15695 return result; 15696} 15697function stubArray() { 15698 return []; 15699} 15700var objectProto$3 = Object.prototype; 15701var propertyIsEnumerable = objectProto$3.propertyIsEnumerable; 15702var nativeGetSymbols$1 = Object.getOwnPropertySymbols; 15703var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object4) { 15704 if (object4 == null) { 15705 return []; 15706 } 15707 object4 = Object(object4); 15708 return arrayFilter(nativeGetSymbols$1(object4), function(symbol) { 15709 return propertyIsEnumerable.call(object4, symbol); 15710 }); 15711}; 15712const getSymbols$1 = getSymbols; 15713function copySymbols(source, object4) { 15714 return copyObject(source, getSymbols$1(source), object4); 15715} 15716var nativeGetSymbols = Object.getOwnPropertySymbols; 15717var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object4) { 15718 var result = []; 15719 while (object4) { 15720 arrayPush(result, getSymbols$1(object4)); 15721 object4 = getPrototype$1(object4); 15722 } 15723 return result; 15724}; 15725const getSymbolsIn$1 = getSymbolsIn; 15726function copySymbolsIn(source, object4) { 15727 return copyObject(source, getSymbolsIn$1(source), object4); 15728} 15729function baseGetAllKeys(object4, keysFunc, symbolsFunc) { 15730 var result = keysFunc(object4); 15731 return isArray$2(object4) ? result : arrayPush(result, symbolsFunc(object4)); 15732} 15733function getAllKeys(object4) { 15734 return baseGetAllKeys(object4, keys, getSymbols$1); 15735} 15736function getAllKeysIn(object4) { 15737 return baseGetAllKeys(object4, keysIn, getSymbolsIn$1); 15738} 15739var DataView = getNative(root$1, "DataView"); 15740const DataView$1 = DataView; 15741var Promise$1 = getNative(root$1, "Promise"); 15742const Promise$2 = Promise$1; 15743var Set$1 = getNative(root$1, "Set"); 15744const Set$2 = Set$1; 15745var mapTag$4 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$4 = "[object Set]", weakMapTag$1 = "[object WeakMap]"; 15746var dataViewTag$3 = "[object DataView]"; 15747var dataViewCtorString = toSource(DataView$1), mapCtorString = toSource(Map$2), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$2), weakMapCtorString = toSource(WeakMap$2); 15748var getTag = baseGetTag; 15749if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3 || Map$2 && getTag(new Map$2()) != mapTag$4 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$2 && getTag(new Set$2()) != setTag$4 || WeakMap$2 && getTag(new WeakMap$2()) != weakMapTag$1) { 15750 getTag = function(value) { 15751 var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : ""; 15752 if (ctorString) { 15753 switch (ctorString) { 15754 case dataViewCtorString: 15755 return dataViewTag$3; 15756 case mapCtorString: 15757 return mapTag$4; 15758 case promiseCtorString: 15759 return promiseTag; 15760 case setCtorString: 15761 return setTag$4; 15762 case weakMapCtorString: 15763 return weakMapTag$1; 15764 } 15765 } 15766 return result; 15767 }; 15768} 15769const getTag$1 = getTag; 15770var objectProto$2 = Object.prototype; 15771var hasOwnProperty$3 = objectProto$2.hasOwnProperty; 15772function initCloneArray(array4) { 15773 var length = array4.length, result = new array4.constructor(length); 15774 if (length && typeof array4[0] == "string" && hasOwnProperty$3.call(array4, "index")) { 15775 result.index = array4.index; 15776 result.input = array4.input; 15777 } 15778 return result; 15779} 15780var Uint8Array$1 = root$1.Uint8Array; 15781const Uint8Array$2 = Uint8Array$1; 15782function cloneArrayBuffer(arrayBuffer) { 15783 var result = new arrayBuffer.constructor(arrayBuffer.byteLength); 15784 new Uint8Array$2(result).set(new Uint8Array$2(arrayBuffer)); 15785 return result; 15786} 15787function cloneDataView(dataView, isDeep) { 15788 var buffer2 = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; 15789 return new dataView.constructor(buffer2, dataView.byteOffset, dataView.byteLength); 15790} 15791var reFlags = /\w*$/; 15792function cloneRegExp(regexp4) { 15793 var result = new regexp4.constructor(regexp4.source, reFlags.exec(regexp4)); 15794 result.lastIndex = regexp4.lastIndex; 15795 return result; 15796} 15797var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0; 15798function cloneSymbol(symbol) { 15799 return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {}; 15800} 15801function cloneTypedArray(typedArray, isDeep) { 15802 var buffer2 = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; 15803 return new typedArray.constructor(buffer2, typedArray.byteOffset, typedArray.length); 15804} 15805var boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", mapTag$3 = "[object Map]", numberTag$2 = "[object Number]", regexpTag$2 = "[object RegExp]", setTag$3 = "[object Set]", stringTag$2 = "[object String]", symbolTag$2 = "[object Symbol]"; 15806var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array
vendor: 5,105 bytes, lines 15806-15911
15806]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]"; 15807function initCloneByTag(object4, tag, isDeep) { 15808 var Ctor = object4.constructor; 15809 switch (tag) { 15810 case arrayBufferTag$2: 15811 return cloneArrayBuffer(object4); 15812 case boolTag$2: 15813 case dateTag$2: 15814 return new Ctor(+object4); 15815 case dataViewTag$2: 15816 return cloneDataView(object4, isDeep); 15817 case float32Tag$1: 15818 case float64Tag$1: 15819 case int8Tag$1: 15820 case int16Tag$1: 15821 case int32Tag$1: 15822 case uint8Tag$1: 15823 case uint8ClampedTag$1: 15824 case uint16Tag$1: 15825 case uint32Tag$1: 15826 return cloneTypedArray(object4, isDeep); 15827 case mapTag$3: 15828 return new Ctor(); 15829 case numberTag$2: 15830 case stringTag$2: 15831 return new Ctor(object4); 15832 case regexpTag$2: 15833 return cloneRegExp(object4); 15834 case setTag$3: 15835 return new Ctor(); 15836 case symbolTag$2: 15837 return cloneSymbol(object4); 15838 } 15839} 15840function initCloneObject(object4) { 15841 return typeof object4.constructor == "function" && !isPrototype(object4) ? baseCreate$1(getPrototype$1(object4)) : {}; 15842} 15843var mapTag$2 = "[object Map]"; 15844function baseIsMap(value) { 15845 return isObjectLike(value) && getTag$1(value) == mapTag$2; 15846} 15847var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap; 15848var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; 15849const isMap$1 = isMap; 15850var setTag$2 = "[object Set]"; 15851function baseIsSet(value) { 15852 return isObjectLike(value) && getTag$1(value) == setTag$2; 15853} 15854var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet; 15855var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; 15856const isSet$1 = isSet; 15857var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$1 = 4; 15858var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$1 = "[object Map]", numberTag$1 = "[object Number]", objectTag$1 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$1 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]"; 15859var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]"; 15860var cloneableTags = {}; 15861cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$1] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$1] = cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; 15862cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; 15863function baseClone(value, bitmask, customizer, key, object4, stack2) { 15864 var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1; 15865 if (customizer) { 15866 result = object4 ? customizer(value, key, object4, stack2) : customizer(value); 15867 } 15868 if (result !== void 0) { 15869 return result; 15870 } 15871 if (!isObject$1(value)) { 15872 return value; 15873 } 15874 var isArr = isArray$2(value); 15875 if (isArr) { 15876 result = initCloneArray(value); 15877 if (!isDeep) { 15878 return copyArray(value, result); 15879 } 15880 } else { 15881 var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag; 15882 if (isBuffer$2(value)) { 15883 return cloneBuffer(value, isDeep); 15884 } 15885 if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object4) { 15886 result = isFlat || isFunc ? {} : initCloneObject(value); 15887 if (!isDeep) { 15888 return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value)); 15889 } 15890 } else { 15891 if (!cloneableTags[tag]) { 15892 return object4 ? value : {}; 15893 } 15894 result = initCloneByTag(value, tag, isDeep); 15895 } 15896 } 15897 stack2 || (stack2 = new Stack()); 15898 var stacked = stack2.get(value); 15899 if (stacked) { 15900 return stacked; 15901 } 15902 stack2.set(value, result); 15903 if (isSet$1(value)) { 15904 value.forEach(function(subValue) { 15905 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack2)); 15906 }); 15907 } else if (isMap$1(value)) { 15908 value.forEach(function(subValue, key2) { 15909 result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack2)); 15910 }); 15911 }
15912 var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys; 15913 var props = isArr ? void 0 : keysFunc(value); 15914 arrayEach(props || value, function(subValue, key2) { 15915 if (props) { 15916 key2 = subValue; 15917 subValue = value[key2]; 15918 } 15919 assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack2)); 15920 }); 15921 return result; 15922} 15923var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4; 15924function cloneDeep(value) { 15925 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); 15926} 15927var HASH_UNDEFINED = "__lodash_hash_undefined__"; 15928function setCacheAdd(value) { 15929 this.__data__.set(value, HASH_UNDEFINED); 15930 return this; 15931} 15932function setCacheHas(value) { 15933 return this.__data__.has(value); 15934} 15935function SetCache(values) { 15936 var index = -1, length = values == null ? 0 : values.length; 15937 this.__data__ = new MapCache(); 15938 while (++index < length) { 15939 this.add(values[index]); 15940 } 15941} 15942SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; 15943SetCache.prototype.has = setCacheHas; 15944function arraySome(array4, predicate) { 15945 var index = -1, length = array4 == null ? 0 : array4.length; 15946 while (++index < length) { 15947 if (predicate(array4[index], index, array4)) { 15948 return true; 15949 } 15950 } 15951 return false; 15952} 15953function cacheHas(cache2, key) { 15954 return cache2.has(key); 15955} 15956var COMPARE_PARTIAL_FLAG$5 = 1, COMPARE_UNORDERED_FLAG$3 = 2; 15957function equalArrays(array4, other, bitmask, customizer, equalFunc, stack2) { 15958 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array4.length, othLength = other.length; 15959 if (arrLength != othLength && !(isPartial && othLength > arrLength)) { 15960 return false; 15961 } 15962 var arrStacked = stack2.get(array4); 15963 var othStacked = stack2.get(other); 15964 if (arrStacked && othStacked) { 15965 return arrStacked == other && othStacked == array4; 15966 } 15967 var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0; 15968 stack2.set(array4, other); 15969 stack2.set(other, array4); 15970 while (++index < arrLength) { 15971 var arrValue = array4[index], othValue = other[index]; 15972 if (customizer) { 15973 var compared = isPartial ? customizer(othValue, arrValue, index, other, array4, stack2) : customizer(arrValue, othValue, index, array4, other, stack2); 15974 } 15975 if (compared !== void 0) { 15976 if (compared) { 15977 continue; 15978 } 15979 result = false;
vendor: 4,275 bytes, lines 15980-16095
15980 break; 15981 } 15982 if (seen) { 15983 if (!arraySome(other, function(othValue2, othIndex) { 15984 if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack2))) { 15985 return seen.push(othIndex); 15986 } 15987 })) { 15988 result = false; 15989 break; 15990 } 15991 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack2))) { 15992 result = false; 15993 break; 15994 } 15995 } 15996 stack2["delete"](array4); 15997 stack2["delete"](other); 15998 return result; 15999} 16000function mapToArray(map2) { 16001 var index = -1, result = Array(map2.size); 16002 map2.forEach(function(value, key) { 16003 result[++index] = [key, value]; 16004 }); 16005 return result; 16006} 16007function setToArray(set2) { 16008 var index = -1, result = Array(set2.size); 16009 set2.forEach(function(value) { 16010 result[++index] = value; 16011 }); 16012 return result; 16013} 16014var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2; 16015var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]"; 16016var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]"; 16017var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0; 16018function equalByTag(object4, other, tag, bitmask, customizer, equalFunc, stack2) { 16019 switch (tag) { 16020 case dataViewTag: 16021 if (object4.byteLength != other.byteLength || object4.byteOffset != other.byteOffset) { 16022 return false; 16023 } 16024 object4 = object4.buffer; 16025 other = other.buffer; 16026 case arrayBufferTag: 16027 if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array$2(object4), new Uint8Array$2(other))) { 16028 return false; 16029 } 16030 return true; 16031 case boolTag: 16032 case dateTag: 16033 case numberTag: 16034 return eq(+object4, +other); 16035 case errorTag: 16036 return object4.name == other.name && object4.message == other.message; 16037 case regexpTag: 16038 case stringTag: 16039 return object4 == other + ""; 16040 case mapTag: 16041 var convert2 = mapToArray; 16042 case setTag: 16043 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4; 16044 convert2 || (convert2 = setToArray); 16045 if (object4.size != other.size && !isPartial) { 16046 return false; 16047 } 16048 var stacked = stack2.get(object4); 16049 if (stacked) { 16050 return stacked == other; 16051 } 16052 bitmask |= COMPARE_UNORDERED_FLAG$2; 16053 stack2.set(object4, other); 16054 var result = equalArrays(convert2(object4), convert2(other), bitmask, customizer, equalFunc, stack2); 16055 stack2["delete"](object4); 16056 return result; 16057 case symbolTag: 16058 if (symbolValueOf) { 16059 return symbolValueOf.call(object4) == symbolValueOf.call(other); 16060 } 16061 } 16062 return false; 16063} 16064var COMPARE_PARTIAL_FLAG$3 = 1; 16065var objectProto$1 = Object.prototype; 16066var hasOwnProperty$2 = objectProto$1.hasOwnProperty; 16067function equalObjects(object4, other, bitmask, customizer, equalFunc, stack2) { 16068 var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object4), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; 16069 if (objLength != othLength && !isPartial) { 16070 return false; 16071 } 16072 var index = objLength; 16073 while (index--) { 16074 var key = objProps[index]; 16075 if (!(isPartial ? key in other : hasOwnProperty$2.call(other, key))) { 16076 return false; 16077 } 16078 } 16079 var objStacked = stack2.get(object4); 16080 var othStacked = stack2.get(other); 16081 if (objStacked && othStacked) { 16082 return objStacked == other && othStacked == object4; 16083 } 16084 var result = true; 16085 stack2.set(object4, other); 16086 stack2.set(other, object4); 16087 var skipCtor = isPartial; 16088 while (++index < objLength) { 16089 key = objProps[index]; 16090 var objValue = object4[key], othValue = other[key]; 16091 if (customizer) { 16092 var compared = isPartial ? customizer(othValue, objValue, key, other, object4, stack2) : customizer(objValue, othValue, key, object4, other, stack2); 16093 } 16094 if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack2) : compared)) { 16095 result = false;
vendor: 4,711 bytes, lines 16096-16218
16096 break; 16097 } 16098 skipCtor || (skipCtor = key == "constructor"); 16099 } 16100 if (result && !skipCtor) { 16101 var objCtor = object4.constructor, othCtor = other.constructor; 16102 if (objCtor != othCtor && ("constructor" in object4 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { 16103 result = false; 16104 } 16105 } 16106 stack2["delete"](object4); 16107 stack2["delete"](other); 16108 return result; 16109} 16110var COMPARE_PARTIAL_FLAG$2 = 1; 16111var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]"; 16112var objectProto = Object.prototype; 16113var hasOwnProperty$1 = objectProto.hasOwnProperty; 16114function baseIsEqualDeep(object4, other, bitmask, customizer, equalFunc, stack2) { 16115 var objIsArr = isArray$2(object4), othIsArr = isArray$2(other), objTag = objIsArr ? arrayTag : getTag$1(object4), othTag = othIsArr ? arrayTag : getTag$1(other); 16116 objTag = objTag == argsTag ? objectTag : objTag; 16117 othTag = othTag == argsTag ? objectTag : othTag; 16118 var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; 16119 if (isSameTag && isBuffer$2(object4)) { 16120 if (!isBuffer$2(other)) { 16121 return false; 16122 } 16123 objIsArr = true; 16124 objIsObj = false; 16125 } 16126 if (isSameTag && !objIsObj) { 16127 stack2 || (stack2 = new Stack()); 16128 return objIsArr || isTypedArray$2(object4) ? equalArrays(object4, other, bitmask, customizer, equalFunc, stack2) : equalByTag(object4, other, objTag, bitmask, customizer, equalFunc, stack2); 16129 } 16130 if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) { 16131 var objIsWrapped = objIsObj && hasOwnProperty$1.call(object4, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$1.call(other, "__wrapped__"); 16132 if (objIsWrapped || othIsWrapped) { 16133 var objUnwrapped = objIsWrapped ? object4.value() : object4, othUnwrapped = othIsWrapped ? other.value() : other; 16134 stack2 || (stack2 = new Stack()); 16135 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack2); 16136 } 16137 } 16138 if (!isSameTag) { 16139 return false; 16140 } 16141 stack2 || (stack2 = new Stack()); 16142 return equalObjects(object4, other, bitmask, customizer, equalFunc, stack2); 16143} 16144function baseIsEqual(value, other, bitmask, customizer, stack2) { 16145 if (value === other) { 16146 return true; 16147 } 16148 if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) { 16149 return value !== value && other !== other; 16150 } 16151 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack2); 16152} 16153var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2; 16154function baseIsMatch(object4, source, matchData, customizer) { 16155 var index = matchData.length, length = index, noCustomizer = !customizer; 16156 if (object4 == null) { 16157 return !length; 16158 } 16159 object4 = Object(object4); 16160 while (index--) { 16161 var data2 = matchData[index]; 16162 if (noCustomizer && data2[2] ? data2[1] !== object4[data2[0]] : !(data2[0] in object4)) { 16163 return false; 16164 } 16165 } 16166 while (++index < length) { 16167 data2 = matchData[index]; 16168 var key = data2[0], objValue = object4[key], srcValue = data2[1]; 16169 if (noCustomizer && data2[2]) { 16170 if (objValue === void 0 && !(key in object4)) { 16171 return false; 16172 } 16173 } else { 16174 var stack2 = new Stack(); 16175 if (customizer) { 16176 var result = customizer(objValue, srcValue, key, object4, source, stack2); 16177 } 16178 if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack2) : result)) { 16179 return false; 16180 } 16181 } 16182 } 16183 return true; 16184} 16185function isStrictComparable(value) { 16186 return value === value && !isObject$1(value); 16187} 16188function getMatchData(object4) { 16189 var result = keys(object4), length = result.length; 16190 while (length--) { 16191 var key = result[length], value = object4[key]; 16192 result[length] = [key, value, isStrictComparable(value)]; 16193 } 16194 return result; 16195} 16196function matchesStrictComparable(key, srcValue) { 16197 return function(object4) { 16198 if (object4 == null) { 16199 return false; 16200 } 16201 return object4[key] === srcValue && (srcValue !== void 0 || key in Object(object4)); 16202 }; 16203} 16204function baseMatches(source) { 16205 var matchData = getMatchData(source); 16206 if (matchData.length == 1 && matchData[0][2]) { 16207 return matchesStrictComparable(matchData[0][0], matchData[0][1]); 16208 } 16209 return function(object4) { 16210 return object4 === source || baseIsMatch(object4, source, matchData); 16211 }; 16212} 16213function baseHasIn(object4, key) { 16214 return object4 != null && key in Object(object4); 16215} 16216function hasPath(object4, path, hasFunc) { 16217 path = castPath(path, object4); 16218 var index = -1, length = path.length, result = false;
16219 while (++index < length) { 16220 var key = toKey(path[index]); 16221 if (!(result = object4 != null && hasFunc(object4, key))) { 16222 break; 16223 } 16224 object4 = object4[key]; 16225 } 16226 if (result || ++index != length) { 16227 return result; 16228 } 16229 length = object4 == null ? 0 : object4.length; 16230 return !!length && isLength(length) && isIndex(key, length) && (isArray$2(object4) || isArguments$1(object4)); 16231} 16232function hasIn(object4, path) { 16233 return object4 != null && hasPath(object4, path, baseHasIn); 16234} 16235var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; 16236function baseMatchesProperty(path, srcValue) { 16237 if (isKey(path) && isStrictComparable(srcValue)) { 16238 return matchesStrictComparable(toKey(path), srcValue); 16239 } 16240 return function(object4) { 16241 var objValue = get(object4, path); 16242 return objValue === void 0 && objValue === srcValue ? hasIn(object4, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); 16243 }; 16244} 16245function baseProperty(key) { 16246 return function(object4) { 16247 return object4 == null ? void 0 : object4[key]; 16248 }; 16249} 16250function basePropertyDeep(path) { 16251 return function(object4) { 16252 return baseGet(object4, path); 16253 }; 16254} 16255function property(path) { 16256 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); 16257} 16258function baseIteratee(value) { 16259 if (typeof value == "function") { 16260 return value; 16261 } 16262 if (value == null) { 16263 return identity$1; 16264 } 16265 if (typeof value == "object") { 16266 return isArray$2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); 16267 } 16268 return property(value); 16269} 16270function createBaseFor(fromRight) { 16271 return function(object4, iteratee, keysFunc) { 16272 var index = -1, iterable = Object(object4), props = keysFunc(object4), length = props.length; 16273 while (length--) { 16274 var key = props[fromRight ? length : ++index]; 16275 if (iteratee(iterable[key], key, iterable) === false) { 16276 break; 16277 } 16278 } 16279 return object4; 16280 }; 16281} 16282var baseFor = createBaseFor(); 16283const baseFor$1 = baseFor; 16284function baseForOwn(object4, iteratee) { 16285 return object4 && baseFor$1(object4, iteratee, keys); 16286} 16287function createBaseEach(eachFunc, fromRight) { 16288 return function(collection, iteratee) { 16289 if (collection == null) { 16290 return collection; 16291 } 16292 if (!isArrayLike(collection)) { 16293 return eachFunc(collection, iteratee); 16294 } 16295 var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection); 16296 while (fromRight ? index-- : ++index < length) { 16297 if (iteratee(iterable[index], index, iterable) === false) { 16298 break; 16299 } 16300 } 16301 return collection; 16302 }; 16303} 16304var baseEach = createBaseEach(baseForOwn); 16305const baseEach$1 = baseEach; 16306function assignMergeValue(object4, key, value) { 16307 if (value !== void 0 && !eq(object4[key], value) || value === void 0 && !(key in object4)) { 16308 baseAssignValue(object4, key, value); 16309 } 16310} 16311function isArrayLikeObject(value) { 16312 return isObjectLike(value) && isArrayLike(value); 16313} 16314function safeGet(object4, key) { 16315 if (key === "constructor" && typeof object4[key] === "function") { 16316 return; 16317 } 16318 if (key == "__proto__") { 16319 return; 16320 } 16321 return object4[key]; 16322} 16323function toPlainObject(value) { 16324 return copyObject(value, keysIn(value)); 16325} 16326function baseMergeDeep(object4, source, key, srcIndex, mergeFunc, customizer, stack2) { 16327 var objValue = safeGet(object4, key), srcValue = safeGet(source, key), stacked = stack2.get(srcValue); 16328 if (stacked) { 16329 assignMergeValue(object4, key, stacked); 16330 return; 16331 } 16332 var newValue = customizer ? customizer(objValue, srcValue, key + "", object4, source, stack2) : void 0; 16333 var isCommon = newValue === void 0; 16334 if (isCommon) { 16335 var isArr = isArray$2(srcValue), isBuff = !isArr && isBuffer$2(srcValue), isTyped = !isArr && !isBuff && isTypedArray$2(srcValue); 16336 newValue = srcValue; 16337 if (isArr || isBuff || isTyped) { 16338 if (isArray$2(objValue)) { 16339 newValue = objValue; 16340 } else if (isArrayLikeObject(objValue)) { 16341 newValue = copyArray(objValue); 16342 } else if (isBuff) { 16343 isCommon = false; 16344 newValue = cloneBuffer(srcValue, true); 16345 } else if (isTyped) { 16346 isCommon = false;
16347 newValue = cloneTypedArray(srcValue, true); 16348 } else { 16349 newValue = []; 16350 } 16351 } else if (isPlainObject$1(srcValue) || isArguments$1(srcValue)) { 16352 newValue = objValue; 16353 if (isArguments$1(objValue)) { 16354 newValue = toPlainObject(objValue); 16355 } else if (!isObject$1(objValue) || isFunction$2(objValue)) { 16356 newValue = initCloneObject(srcValue); 16357 } 16358 } else { 16359 isCommon = false; 16360 } 16361 } 16362 if (isCommon) { 16363 stack2.set(srcValue, newValue); 16364 mergeFunc(newValue, srcValue, srcIndex, customizer, stack2); 16365 stack2["delete"](srcValue); 16366 } 16367 assignMergeValue(object4, key, newValue); 16368} 16369function baseMerge(object4, source, srcIndex, customizer, stack2) { 16370 if (object4 === source) { 16371 return; 16372 } 16373 baseFor$1(source, function(srcValue, key) { 16374 stack2 || (stack2 = new Stack()); 16375 if (isObject$1(srcValue)) { 16376 baseMergeDeep(object4, source, key, srcIndex, baseMerge, customizer, stack2); 16377 } else { 16378 var newValue = customizer ? customizer(safeGet(object4, key), srcValue, key + "", object4, source, stack2) : void 0; 16379 if (newValue === void 0) { 16380 newValue = srcValue; 16381 } 16382 assignMergeValue(object4, key, newValue); 16383 } 16384 }, keysIn); 16385} 16386function baseMap(collection, iteratee) { 16387 var index = -1, result = isArrayLike(collection) ? Array(collection.length) : []; 16388 baseEach$1(collection, function(value, key, collection2) { 16389 result[++index] = iteratee(value, key, collection2); 16390 }); 16391 return result; 16392} 16393function map(collection, iteratee) { 16394 var func = isArray$2(collection) ? arrayMap : baseMap; 16395 return func(collection, baseIteratee(iteratee)); 16396} 16397var merge$2 = createAssigner(function(object4, source, srcIndex) { 16398 baseMerge(object4, source, srcIndex); 16399}); 16400const merge$3 = merge$2; 16401const commonVariables$8 = { 16402 fontFamily: 'v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"', 16403 fontFamilyMono: "v-mono, SFMono-Regular, Menlo, Consolas, Courier, monospace", 16404 fontWeight: "400", 16405 fontWeightStrong: "500", 16406 cubicBezierEaseInOut: "cubic-bezier(.4, 0, .2, 1)", 16407 cubicBezierEaseOut: "cubic-bezier(0, 0, .2, 1)", 16408 cubicBezierEaseIn: "cubic-bezier(.4, 0, 1, 1)", 16409 borderRadius: "3px", 16410 borderRadiusSmall: "2px", 16411 fontSize: "14px", 16412 fontSizeMini: "12px", 16413 fontSizeTiny: "12px", 16414 fontSizeSmall: "14px", 16415 fontSizeMedium: "14px", 16416 fontSizeLarge: "15px", 16417 fontSizeHuge: "16px", 16418 lineHeight: "1.6", 16419 heightMini: "16px", 16420 // private now, it's too small 16421 heightTiny: "22px", 16422 heightSmall: "28px", 16423 heightMedium: "34px", 16424 heightLarge: "40px", 16425 heightHuge: "46px" 16426}; 16427const { 16428 fontSize, 16429 fontFamily, 16430 lineHeight 16431} = commonVariables$8; 16432const globalStyle = c$1("body", ` 16433 margin: 0; 16434 font-size: ${fontSize}; 16435 font-family: ${fontFamily}; 16436 line-height: ${lineHeight}; 16437 -webkit-text-size-adjust: 100%; 16438 -webkit-tap-highlight-color: transparent; 16439`, [c$1("input", ` 16440 font-family: inherit; 16441 font-size: inherit; 16442 `)]); 16443const configProviderInjectionKey = createInjectionKey("n-config-provider"); 16444const cssrAnchorMetaName = "naive-ui-style"; 16445function createTheme(theme) { 16446 return theme; 16447} 16448function useTheme(resolveId, mountId, style2, defaultTheme, props, clsPrefixRef) { 16449 const ssrAdapter2 = useSsrAdapter(); 16450 const NConfigProvider2 = inject(configProviderInjectionKey, null); 16451 if (style2) { 16452 const mountStyle = () => { 16453 const clsPrefix = clsPrefixRef === null || clsPrefixRef === void 0 ? void 0 : clsPrefixRef.value; 16454 style2.mount({ 16455 id: clsPrefix === void 0 ? mountId : clsPrefix + mountId, 16456 head: true, 16457 props: { 16458 bPrefix: clsPrefix ? `.${clsPrefix}-` : void 0 16459 }, 16460 anchorMetaName: cssrAnchorMetaName, 16461 ssr: ssrAdapter2 16462 }); 16463 if (!(NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.preflightStyleDisabled)) { 16464 globalStyle.mount({ 16465 id: "n-global", 16466 head: true, 16467 anchorMetaName: cssrAnchorMetaName, 16468 ssr: ssrAdapter2 16469 }); 16470 } 16471 }; 16472 if (ssrAdapter2) { 16473 mountStyle(); 16474 } else { 16475 onBeforeMount(mountStyle); 16476 } 16477 } 16478 const mergedThemeRef = computed(() => { 16479 var _a2; 16480 const { 16481 theme: { 16482 common: selfCommon, 16483 self: self2, 16484 peers = {} 16485 } = {}, 16486 themeOverrides: selfOverrides = {}, 16487 builtinThemeOverrides: builtinOverrides = {} 16488 } = props; 16489 const { 16490 common: selfCommonOverrides, 16491 peers: peersOverrides 16492 } = selfOverrides; 16493 const { 16494 common: globalCommon = void 0, 16495 [resolveId]: { 16496 common: globalSelfCommon = void 0, 16497 self: globalSelf = void 0, 16498 peers: globalPeers = {} 16499 } = {} 16500 } = (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeRef.value) || {}; 16501 const { 16502 common: globalCommonOverrides = void 0, 16503 [resolveId]: globalSelfOverrides = {} 16504 } = (NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedThemeOverridesRef.value) || {}; 16505 const { 16506 common: globalSelfCommonOverrides, 16507 peers: globalPeersOverrides = {} 16508 } = globalSelfOverrides; 16509 const mergedCommon = merge$3({}, selfCommon || globalSelfCommon || globalCommon || defaultTheme.common, globalCommonOverrides, globalSelfCommonOverrides, selfCommonOverrides); 16510 const mergedSelf = merge$3( 16511 // {}, executed every time, no need for empty obj 16512 (_a2 = self2 || globalSelf || defaultTheme.self) === null || _a2 === void 0 ? void 0 : _a2(mergedCommon), 16513 builtinOverrides, 16514 globalSelfOverrides, 16515 selfOverrides 16516 ); 16517 return { 16518 common: mergedCommon, 16519 self: mergedSelf, 16520 peers: merge$3({}, defaultTheme.peers, globalPeers, peers), 16521 peerOverrides: merge$3({}, builtinOverrides.peers, globalPeersOverrides, peersOverrides) 16522 }; 16523 }); 16524 return mergedThemeRef; 16525} 16526useTheme.props = { 16527 theme: Object, 16528 themeOverrides: Object, 16529 builtinThemeOverrides: Object 16530}; 16531const defaultClsPrefix = "n"; 16532function useConfig(props = {}, options = { 16533 defaultBordered: true 16534}) { 16535 const NConfigProvider2 = inject(configProviderInjectionKey, null); 16536 return { 16537 // NConfigProvider, 16538 inlineThemeDisabled: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.inlineThemeDisabled, 16539 mergedRtlRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedRtlRef, 16540 mergedComponentPropsRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedComponentPropsRef, 16541 mergedBreakpointsRef: NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBreakpointsRef, 16542 mergedBorderedRef: computed(() => { 16543 var _a2, _b; 16544 const { 16545 bordered 16546 } = props; 16547 if (bordered !== void 0) 16548 return bordered; 16549 return (_b = (_a2 = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedBorderedRef.value) !== null && _a2 !== void 0 ? _a2 : options.defaultBordered) !== null && _b !== void 0 ? _b : true; 16550 }), 16551 mergedClsPrefixRef: NConfigProvider2 ? NConfigProvider2.mergedClsPrefixRef : shallowRef(defaultClsPrefix), 16552 namespaceRef: computed(() => NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedNamespaceRef.value) 16553 }; 16554} 16555function useMergedClsPrefix() { 16556 const NConfigProvider2 = inject(configProviderInjectionKey, null); 16557 return NConfigProvider2 ? NConfigProvider2.mergedClsPrefixRef : shallowRef(defaultClsPrefix); 16558} 16559const enUS = { 16560 name: "en-US", 16561 global: { 16562 undo: "Undo", 16563 redo: "Redo", 16564 confirm: "Confirm", 16565 clear: "Clear" 16566 }, 16567 Popconfirm: { 16568 positiveText: "Confirm", 16569 negativeText: "Cancel" 16570 }, 16571 Cascader: { 16572 placeholder: "Please Select", 16573 loading: "Loading", 16574 loadingRequiredMessage: (label) => `Please load all ${label}
16574's descendants before checking it.` 16575 }, 16576 Time: { 16577 dateFormat: "yyyy-MM-dd", 16578 dateTimeFormat: "yyyy-MM-dd HH:mm:ss" 16579 }, 16580 DatePicker: { 16581 yearFormat: "yyyy", 16582 monthFormat: "MMM", 16583 dayFormat: "eeeeee", 16584 yearTypeFormat: "yyyy", 16585 monthTypeFormat: "yyyy-MM", 16586 dateFormat: "yyyy-MM-dd", 16587 dateTimeFormat: "yyyy-MM-dd HH:mm:ss", 16588 quarterFormat: "yyyy-qqq", 16589 weekFormat: "yyyy-w", 16590 clear: "Clear", 16591 now: "Now", 16592 confirm: "Confirm", 16593 selectTime: "Select Time", 16594 selectDate: "Select Date", 16595 datePlaceholder: "Select Date", 16596 datetimePlaceholder: "Select Date and Time", 16597 monthPlaceholder: "Select Month", 16598 yearPlaceholder: "Select Year", 16599 quarterPlaceholder: "Select Quarter", 16600 weekPlaceholder: "Select Week", 16601 startDatePlaceholder: "Start Date", 16602 endDatePlaceholder: "End Date", 16603 startDatetimePlaceholder: "Start Date and Time", 16604 endDatetimePlaceholder: "End Date and Time", 16605 startMonthPlaceholder: "Start Month", 16606 endMonthPlaceholder: "End Month", 16607 monthBeforeYear: true, 16608 firstDayOfWeek: 6, 16609 today: "Today" 16610 }, 16611 DataTable: { 16612 checkTableAll: "Select all in the table", 16613 uncheckTableAll: "Unselect all in the table", 16614 confirm: "Confirm", 16615 clear: "Clear" 16616 }, 16617 LegacyTransfer: { 16618 sourceTitle: "Source", 16619 targetTitle: "Target" 16620 }, 16621 Transfer: { 16622 selectAll: "Select all", 16623 unselectAll: "Unselect all", 16624 clearAll: "Clear", 16625 total: (num) => `Total ${num} items`, 16626 selected: (num) => `${num} items selected` 16627 }, 16628 Empty: { 16629 description: "No Data" 16630 }, 16631 Select: { 16632 placeholder: "Please Select" 16633 }, 16634 TimePicker: { 16635 placeholder: "Select Time", 16636 positiveText: "OK", 16637 negativeText: "Cancel", 16638 now: "Now", 16639 clear: "Clear" 16640 }, 16641 Pagination: { 16642 goto: "Goto", 16643 selectionSuffix: "page" 16644 }, 16645 DynamicTags: { 16646 add: "Add" 16647 }, 16648 Log: { 16649 loading: "Loading" 16650 }, 16651 Input: { 16652 placeholder: "Please Input" 16653 }, 16654 InputNumber: { 16655 placeholder: "Please Input" 16656 }, 16657 DynamicInput: { 16658 create: "Create" 16659 }, 16660 ThemeEditor: { 16661 title: "Theme Editor", 16662 clearAllVars: "Clear All Variables", 16663 clearSearch: "Clear Search", 16664 filterCompName: "Filter Component Name", 16665 filterVarName: "Filter Variable Name", 16666 import: "Import", 16667 export: "Export", 16668 restore: "Reset to Default" 16669 }, 16670 Image: { 16671 tipPrevious: "Previous picture (â)", 16672 tipNext: "Next picture (â)", 16673 tipCounterclockwise: "Counterclockwise", 16674 tipClockwise: "Clockwise", 16675 tipZoomOut: "Zoom out", 16676 tipZoomIn: "Zoom in", 16677 tipDownload: "Download", 16678 tipClose: "Close (Esc)", 16679 // TODO: translation 16680 tipOriginalSize: "Zoom to original size" 16681 } 16682}; 16683const enUS$1 = enUS; 16684function buildFormatLongFn(args) { 16685 return function() { 16686 var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 16687 var width = options.width ? String(options.width) : args.defaultWidth; 16688 var format2 = args.formats[width] || args.formats[args.defaultWidth]; 16689 return format2; 16690 }; 16691} 16692function buildLocalizeFn(args) { 16693 return function(dirtyIndex, options) { 16694 var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone"; 16695 var valuesArray; 16696 if (context === "formatting" && args.formattingValues) { 16697 var defaultWidth = args.defaultFormattingWidth || args.defaultWidth; 16698 var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth; 16699 valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; 16700 } else { 16701 var _defaultWidth = args.defaultWidth; 16702 var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth; 16703 valuesArray = args.values[_width] || args.values[_defaultWidth]; 16704 } 16705 var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; 16706 return valuesArray[index]; 16707 }; 16708} 16709function buildMatchFn(args) { 16710 return function(string3) { 16711 var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 16712 var width = options.width; 16713 var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth]; 16714 var matchResult = string3.match(matchPattern); 16715 if (!matchResult) { 16716 return null; 16717 } 16718 var matchedString = matchResult[0]; 16719 var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; 16720 var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function(pattern4) { 16721 return pattern4.test(matchedString); 16722 }) : findKey(parsePatterns, function(pattern4) { 16723 return pattern4.test(matchedString); 16724 }); 16725 var value; 16726 value = args.valueCallback ? args.valueCallback(key) : key; 16727 value = options.valueCallback ? options.valueCallback(value) : value; 16728 var rest = string3.slice(matchedString.length); 16729 return { 16730 value, 16731 rest 16732 }; 16733 }; 16734} 16735function findKey(object4, predicate) { 16736 for (var key in object4) { 16737 if (object4.hasOwnProperty(key) && predicate(object4[key])) { 16738 return key; 16739 } 16740 } 16741 return void 0; 16742} 16743function findIndex(array4, predicate) { 16744 for (var key = 0; key < array4.length; key++) { 16745 if (predicate(array4[key])) { 16746 return key; 16747 } 16748 } 16749 return void 0; 16750} 16751function buildMatchPatternFn(args) { 16752 return function(string3) { 16753 var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 16754 var matchResult = string3.match(args.matchPattern); 16755 if (!matchResult) 16756 return null; 16757 var matchedString = matchResult[0]; 16758 var parseResult = string3.match(args.parsePattern); 16759 if (!parseResult) 16760 return null; 16761 var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; 16762 value = options.valueCallback ? options.valueCallback(value) : value; 16763 var rest = string3.slice(matchedString.length); 16764 return { 16765 value, 16766 rest 16767 }; 16768 }; 16769} 16770var formatDistanceLocale = { 16771 lessThanXSeconds: { 16772 one: "less than a second", 16773 other: "less than {{count}} seconds" 16774 }, 16775 xSeconds: { 16776 one: "1 second", 16777 other: "{{count}} seconds" 16778 }, 16779 halfAMinute: "half a minute", 16780 lessThanXMinutes: { 16781 one: "less than a minute", 16782 other: "less than {{count}} minutes" 16783 }, 16784 xMinutes: { 16785 one: "1 minute", 16786 other: "{{count}} minutes" 16787 }, 16788 aboutXHours: { 16789 one: "about 1 hour", 16790 other: "about {{count}} hours" 16791 }, 16792 xHours: { 16793 one: "1 hour", 16794 other: "{{count}} hours" 16795 }, 16796 xDays: { 16797 one: "1 day", 16798 other: "{{count}} days" 16799 }, 16800 aboutXWeeks: { 16801 one: "about 1 week", 16802 other: "about {{count}} weeks" 16803 }, 16804 xWeeks: { 16805 one: "1 week", 16806 other: "{{count}} weeks" 16807 }, 16808 aboutXMonths: { 16809 one: "about 1 month", 16810 other: "about {{count}} months" 16811 }, 16812 xMonths: { 16813 one: "1 month", 16814 other: "{{count}} months" 16815 }, 16816 aboutXYears: { 16817 one: "about 1 year", 16818 other: "about {{count}} years" 16819 }, 16820 xYears: { 16821 one: "1 year", 16822 other: "{{count}} years" 16823 }, 16824 overXYears: { 16825 one: "over 1 year", 16826 other: "over {{count}} years" 16827 }, 16828 almostXYears: { 16829 one: "almost 1 year", 16830 other: "almost {{count}} years" 16831 } 16832}; 16833var formatDistance2 = function formatDistance3(token, count, options) { 16834 var result; 16835 var tokenValue = formatDistanceLocale[token]; 16836 if (typeof tokenValue === "string") { 16837 result = tokenValue; 16838 } else if (count === 1) { 16839 result = tokenValue.one; 16840 } else { 16841 result = tokenValue.other.replace("{{count}}", count.toString()); 16842 } 16843 if (options !== null && options !== void 0 && options.addSuffix) { 16844 if (options.comparison && options.comparison > 0) { 16845 return "in " + result; 16846 } else { 16847 return result + " ago"; 16848 } 16849 } 16850 return result; 16851}; 16852const formatDistance$1 = formatDistance2; 16853var dateFormats = { 16854 full: "EEEE, MMMM do, y", 16855 long: "MMMM do, y", 16856 medium: "MMM d, y", 16857 short: "MM/dd/yyyy" 16858}; 16859var timeFormats = { 16860 full: "h:mm:ss a zzzz", 16861 long: "h:mm:ss a z", 16862 medium: "h:mm:ss a", 16863 short: "h:mm a" 16864}; 16865var dateTimeFormats = { 16866 full: "{{date}} 'at' {{time}}", 16867 long: "{{date}} 'at' {{time}}", 16868 medium: "{{date}}, {{time}}", 16869 short: "{{date}}, {{time}}" 16870}; 16871var formatLong = { 16872 date: buildFormatLongFn({ 16873 formats: dateFormats, 16874 defaultWidth: "full" 16875 }), 16876 time: buildFormatLongFn({ 16877 formats: timeFormats, 16878 defaultWidth: "full" 16879 }), 16880 dateTime: buildFormatLongFn({ 16881 formats: dateTimeFormats, 16882 defaultWidth: "full" 16883 }) 16884}; 16885const formatLong$1 = formatLong; 16886var formatRelativeLocale = { 16887 lastWeek: "'last' eeee 'at' p", 16888 yesterday: "'yesterday at' p", 16889 today: "'today at' p", 16890 tomorrow: "'tomorrow at' p", 16891 nextWeek: "eeee 'at' p", 16892 other: "P" 16893}; 16894var formatRelative2 = function formatRelative3(token, _date, _baseDate, _options) { 16895 return formatRelativeLocale[token]; 16896}; 16897const formatRelative$1 = formatRelative2; 16898var eraValues = { 16899 narrow: ["B", "A"], 16900 abbreviated: ["BC", "AD"], 16901 wide: ["Before Christ", "Anno Domini"] 16902}; 16903var quarterValues = { 16904 narrow: ["1", "2", "3", "4"], 16905 abbreviated: ["Q1", "Q2", "Q3", "Q4"], 16906 wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"] 16907}; 16908var monthValues = { 16909 narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], 16910 abbreviated: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], 16911 wide: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
16911November", "December"] 16912}; 16913var dayValues = { 16914 narrow: ["S", "M", "T", "W", "T", "F", "S"], 16915 short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], 16916 abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 16917 wide: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] 16918}; 16919var dayPeriodValues = { 16920 narrow: { 16921 am: "a", 16922 pm: "p", 16923 midnight: "mi", 16924 noon: "n", 16925 morning: "morning", 16926 afternoon: "afternoon", 16927 evening: "evening", 16928 night: "night" 16929 }, 16930 abbreviated: { 16931 am: "AM", 16932 pm: "PM", 16933 midnight: "midnight", 16934 noon: "noon", 16935 morning: "morning", 16936 afternoon: "afternoon", 16937 evening: "evening", 16938 night: "night" 16939 }, 16940 wide: { 16941 am: "a.m.", 16942 pm: "p.m.", 16943 midnight: "midnight", 16944 noon: "noon", 16945 morning: "morning", 16946 afternoon: "afternoon", 16947 evening: "evening", 16948 night: "night" 16949 } 16950}; 16951var formattingDayPeriodValues = { 16952 narrow: { 16953 am: "a", 16954 pm: "p", 16955 midnight: "mi", 16956 noon: "n", 16957 morning: "in the morning", 16958 afternoon: "in the afternoon", 16959 evening: "in the evening", 16960 night: "at night" 16961 }, 16962 abbreviated: { 16963 am: "AM", 16964 pm: "PM", 16965 midnight: "midnight", 16966 noon: "noon", 16967 morning: "in the morning", 16968 afternoon: "in the afternoon", 16969 evening: "in the evening", 16970 night: "at night" 16971 }, 16972 wide: { 16973 am: "a.m.", 16974 pm: "p.m.", 16975 midnight: "midnight", 16976 noon: "noon", 16977 morning: "in the morning", 16978 afternoon: "in the afternoon", 16979 evening: "in the evening", 16980 night: "at night" 16981 } 16982}; 16983var ordinalNumber2 = function ordinalNumber3(dirtyNumber, _options) { 16984 var number4 = Number(dirtyNumber); 16985 var rem100 = number4 % 100; 16986 if (rem100 > 20 || rem100 < 10) { 16987 switch (rem100 % 10) { 16988 case 1: 16989 return number4 + "st"; 16990 case 2: 16991 return number4 + "nd"; 16992 case 3: 16993 return number4 + "rd"; 16994 } 16995 } 16996 return number4 + "th"; 16997}; 16998var localize = { 16999 ordinalNumber: ordinalNumber2, 17000 era: buildLocalizeFn({ 17001 values: eraValues, 17002 defaultWidth: "wide" 17003 }), 17004 quarter: buildLocalizeFn({ 17005 values: quarterValues, 17006 defaultWidth: "wide", 17007 argumentCallback: function argumentCallback2(quarter) { 17008 return quarter - 1; 17009 } 17010 }), 17011 month: buildLocalizeFn({ 17012 values: monthValues, 17013 defaultWidth: "wide" 17014 }), 17015 day: buildLocalizeFn({ 17016 values: dayValues, 17017 defaultWidth: "wide" 17018 }), 17019 dayPeriod: buildLocalizeFn({ 17020 values: dayPeriodValues, 17021 defaultWidth: "wide", 17022 formattingValues: formattingDayPeriodValues, 17023 defaultFormattingWidth: "wide" 17024 }) 17025}; 17026const localize$1 = localize; 17027var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; 17028var parseOrdinalNumberPattern = /\d+/i; 17029var matchEraPatterns = { 17030 narrow: /^(b|a)/i, 17031 abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, 17032 wide: /^(before christ|before common era|anno domini|common era)/i 17033}; 17034var parseEraPatterns = { 17035 any: [/^b/i, /^(a|c)/i] 17036}; 17037var matchQuarterPatterns = { 17038 narrow: /^[1234]/i, 17039 abbreviated: /^q[1234]/i, 17040 wide: /^[1234](th|st|nd|rd)? quarter/i 17041}; 17042var parseQuarterPatterns = { 17043 any: [/1/i, /2/i, /3/i, /4/i] 17044}; 17045var matchMonthPatterns = { 17046 narrow: /^[jfmasond]/i, 17047 abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, 17048 wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i 17049}; 17050var parseMonthPatterns = { 17051 narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i], 17052 any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i] 17053}; 17054var matchDayPatterns = { 17055 narrow: /^[smtwf]/i, 17056 short: /^(su|mo|tu|we|th|fr|sa)/i, 17057 abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, 17058 wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i 17059}; 17060var parseDayPatterns = { 17061 narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], 17062 any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] 17063}; 17064var matchDayPeriodPatterns = { 17065 narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, 17066 any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i 17067}; 17068var parseDayPeriodPatterns = { 17069 any: { 17070 am: /^a/i, 17071 pm: /^p/i, 17072 midnight: /^mi/i, 17073 noon: /^no/i, 17074 morning: /morning/i, 17075 afternoon: /afternoon/i, 17076 evening: /evening/i, 17077 night: /night/i 17078 } 17079}; 17080var match$1 = { 17081 ordinalNumber: buildMatchPatternFn({ 17082 matchPattern: matchOrdinalNumberPattern, 17083 parsePattern: parseOrdinalNumberPattern, 17084 valueCallback: function valueCallback3(value) { 17085 return parseInt(value, 10); 17086 } 17087 }), 17088 era: buildMatchFn({ 17089 matchPatterns: matchEraPatterns, 17090 defaultMatchWidth: "wide", 17091 parsePatterns: parseEraPatterns, 17092 defaultParseWidth: "any" 17093 }), 17094 quarter: buildMatchFn({ 17095 matchPatterns: matchQuarterPatterns, 17096 defaultMatchWidth: "wide", 17097 parsePatterns: parseQuarterPatterns, 17098 defaultParseWidth: "any", 17099 valueCallback: function valueCallback4(index) { 17100 return index + 1; 17101 } 17102 }), 17103 month: buildMatchFn({ 17104 matchPatterns: matchMonthPatterns, 17105 defaultMatchWidth: "wide", 17106 parsePatterns: parseMonthPatterns, 17107 defaultParseWidth: "any" 17108 }), 17109 day: buildMatchFn({ 17110 matchPatterns: matchDayPatterns, 17111 defaultMatchWidth: "wide", 17112 parsePatterns: parseDayPatterns, 17113 defaultParseWidth: "any" 17114 }), 17115 dayPeriod: buildMatchFn({ 17116 matchPatterns: matchDayPeriodPatterns, 17117 defaultMatchWidth: "any", 17118 parsePatterns: parseDayPeriodPatterns, 17119 defaultParseWidth: "any" 17120 }) 17121}; 17122const match$2 = match$1; 17123var locale = { 17124 code: "en-US", 17125 formatDistance: formatDistance$1, 17126 formatLong: formatLong$1, 17127 formatRelative: formatRelative$1, 17128 localize: localize$1, 17129 match: match$2, 17130 options: { 17131 weekStartsOn: 0, 17132 firstWeekContainsDate: 1 17133 } 17134}; 17135const defaultLocale$1 = locale; 17136const dateEnUs = { 17137 name: "en-US", 17138 locale: defaultLocale$1 17139}; 17140const dateEnUS = dateEnUs; 17141function useLocale(ns) { 17142 const { 17143 mergedLocaleRef, 17144 mergedDateLocaleRef 17145 } = inject(configProviderInjectionKey, null) || {}; 17146 const localeRef = computed(() => { 17147 var _a2, _b; 17148 return (_b = (_a2 = mergedLocaleRef === null || mergedLocaleRef === void 0 ? void 0 : mergedLocaleRef.value) === null || _a2 === void 0 ? void 0 : _a2[ns]) !== null && _b !== void 0 ? _b : enUS$1[ns]; 17149 }); 17150 const dateLocaleRef = computed(() => { 17151 var _a2; 17152 return (_a2 = mergedDateLocaleRef === null || mergedDateLocaleRef === void 0 ? void 0 : mergedDateLocaleRef.value) !== null && _a2 !== void 0 ? _a2 : dateEnUS; 17153 }); 17154 return { 17155 dateLocaleRef, 17156 localeRef 17157 }; 17158} 17159function useStyle(mountId, style2, clsPrefixRef) { 17160 if (!style2) { 17161 return; 17162 } 17163 const ssrAdapter2 = useSsrAdapter(); 17164 const NConfigProvider2 = inject(configProviderInjectionKey, null); 17165 const mountStyle = () => { 17166 const clsPrefix = clsPrefixRef.value; 17167 style2.mount({ 17168 id: clsPrefix === void 0 ? mountId : clsPrefix + mountId, 17169 head: true, 17170 anchorMetaName: cssrAnchorMetaName, 17171 props: { 17172 bPrefix: clsPrefix ? `.${clsPrefix}-` : void 0 17173 }, 17174 ssr: ssrAdapter2 17175 }); 17176 if (!(NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.preflightStyleDisabled)) { 17177 globalStyle.mount({ 17178 id: "n-global", 17179 head: true, 17180 anchorMetaName: cssrAnchorMetaName, 17181 ssr: ssrAdapter2 17182 }); 17183 } 17184 }; 17185 if (ssrAdapter2) { 17186 mountStyle(); 17187 } else { 17188 onBeforeMount(mountStyle); 17189 } 17190} 17191function useThemeClass(componentName, hashRef, cssVarsRef, props) { 17192 var _a2; 17193 if (!cssVarsRef) 17194 throwError("useThemeClass", "cssVarsRef is not passed"); 17195 const mergedThemeHashRef = (_a2 = inject(configProviderInjectionKey, null)) === null || _a2 === void 0 ? void 0 : _a2.mergedThemeHashRef;
17196 const themeClassRef = ref(""); 17197 const ssrAdapter2 = useSsrAdapter(); 17198 let renderCallback; 17199 const hashClassPrefix = `__${componentName}`; 17200 const mountStyle = () => { 17201 let finalThemeHash = hashClassPrefix; 17202 const hashValue = hashRef ? hashRef.value : void 0; 17203 const themeHash = mergedThemeHashRef === null || mergedThemeHashRef === void 0 ? void 0 : mergedThemeHashRef.value; 17204 if (themeHash) 17205 finalThemeHash += "-" + themeHash; 17206 if (hashValue) 17207 finalThemeHash += "-" + hashValue; 17208 const { 17209 themeOverrides, 17210 builtinThemeOverrides 17211 } = props; 17212 if (themeOverrides) { 17213 finalThemeHash += "-" + murmur2(JSON.stringify(themeOverrides)); 17214 } 17215 if (builtinThemeOverrides) { 17216 finalThemeHash += "-" + murmur2(JSON.stringify(builtinThemeOverrides)); 17217 } 17218 themeClassRef.value = finalThemeHash; 17219 renderCallback = () => { 17220 const cssVars = cssVarsRef.value; 17221 let style2 = ""; 17222 for (const key in cssVars) { 17223 style2 += `${key}: ${cssVars[key]};`; 17224 } 17225 c$1(`.${finalThemeHash}`, style2).mount({ 17226 id: finalThemeHash, 17227 ssr: ssrAdapter2 17228 }); 17229 renderCallback = void 0; 17230 }; 17231 }; 17232 watchEffect(() => { 17233 mountStyle(); 17234 }); 17235 return { 17236 themeClass: themeClassRef, 17237 onRender: () => { 17238 renderCallback === null || renderCallback === void 0 ? void 0 : renderCallback(); 17239 } 17240 }; 17241} 17242function useRtl(mountId, rtlStateRef, clsPrefixRef) { 17243 if (!rtlStateRef) 17244 return void 0; 17245 const ssrAdapter2 = useSsrAdapter(); 17246 const componentRtlStateRef = computed(() => { 17247 const { 17248 value: rtlState 17249 } = rtlStateRef; 17250 if (!rtlState) { 17251 return void 0; 17252 } 17253 const componentRtlState = rtlState[mountId]; 17254 if (!componentRtlState) { 17255 return void 0; 17256 } 17257 return componentRtlState; 17258 }); 17259 const mountStyle = () => { 17260 watchEffect(() => { 17261 const { 17262 value: clsPrefix 17263 } = clsPrefixRef; 17264 const id = `${clsPrefix}${mountId}Rtl`; 17265 if (exists(id, ssrAdapter2)) 17266 return; 17267 const { 17268 value: componentRtlState 17269 } = componentRtlStateRef; 17270 if (!componentRtlState) 17271 return; 17272 componentRtlState.style.mount({ 17273 id, 17274 head: true, 17275 anchorMetaName: cssrAnchorMetaName, 17276 props: { 17277 bPrefix: clsPrefix ? `.${clsPrefix}-` : void 0 17278 }, 17279 ssr: ssrAdapter2 17280 }); 17281 }); 17282 }; 17283 if (ssrAdapter2) { 17284 mountStyle(); 17285 } else { 17286 onBeforeMount(mountStyle); 17287 } 17288 return componentRtlStateRef; 17289} 17290const AddIcon = defineComponent({ 17291 name: "Add", 17292 render() { 17293 return h("svg", { 17294 width: "512", 17295 height: "512", 17296 viewBox: "0 0 512 512", 17297 fill: "none", 17298 xmlns: "http://www.w3.org/2000/svg" 17299 }, h("path", { 17300 d: "M256 112V400M400 256H112", 17301 stroke: "currentColor", 17302 "stroke-width": "32", 17303 "stroke-linecap": "round", 17304 "stroke-linejoin": "round" 17305 })); 17306 } 17307}); 17308function replaceable(name, icon) { 17309 return defineComponent({ 17310 name: upperFirst$1(name), 17311 setup() { 17312 var _a2; 17313 const mergedIconsRef = (_a2 = inject(configProviderInjectionKey, null)) === null || _a2 === void 0 ? void 0 : _a2.mergedIconsRef; 17314 return () => { 17315 var _a3; 17316 const iconOverride = (_a3 = mergedIconsRef === null || mergedIconsRef === void 0 ? void 0 : mergedIconsRef.value) === null || _a3 === void 0 ? void 0 : _a3[name]; 17317 return iconOverride ? iconOverride() : icon; 17318 }; 17319 } 17320 }); 17321} 17322const FinishedIcon = defineComponent({ 17323 name: "Checkmark", 17324 render() { 17325 return h("svg", { 17326 xmlns: "http://www.w3.org/2000/svg", 17327 viewBox: "0 0 16 16" 17328 }, h("g", { 17329 fill: "none" 17330 }, h("path", { 17331 d: "M14.046 3.486a.75.75 0 0 1-.032 1.06l-7.93 7.474a.85.85 0 0 1-1.188-.022l-2.68-2.72a.75.75 0 1 1 1.068-1.053l2.234 2.267l7.468-7.038a.75.75 0 0 1 1.06.032z", 17332 fill: "currentColor" 17333 }))); 17334 } 17335}); 17336const ChevronLeftIcon = defineComponent({ 17337 name: "ChevronLeft", 17338 render() { 17339 return h("svg", { 17340 viewBox: "0 0 16 16", 17341 fill: "none", 17342 xmlns: "http://www.w3.org/2000/svg" 17343 }, h("path", { 17344 d: "M10.3536 3.14645C10.5488 3.34171 10.5488 3.65829 10.3536 3.85355L6.20711 8L10.3536 12.1464C10.5488 12.3417 10.5488 12.6583 10.3536 12.8536C10.1583 13.0488 9.84171 13.0488 9.64645 12.8536L5.14645 8.35355C4.95118 8.15829 4.95118 7.84171 5.14645 7.64645L9.64645 3.14645C9.84171 2.95118 10.1583 2.95118 10.3536 3.14645Z", 17345 fill: "currentColor" 17346 })); 17347 } 17348}); 17349const ChevronRightIcon = defineComponent({ 17350 name: "ChevronRight", 17351 render() { 17352 return h("svg", {
17353 viewBox: "0 0 16 16", 17354 fill: "none", 17355 xmlns: "http://www.w3.org/2000/svg" 17356 }, h("path", { 17357 d: "M5.64645 3.14645C5.45118 3.34171 5.45118 3.65829 5.64645 3.85355L9.79289 8L5.64645 12.1464C5.45118 12.3417 5.45118 12.6583 5.64645 12.8536C5.84171 13.0488 6.15829 13.0488 6.35355 12.8536L10.8536 8.35355C11.0488 8.15829 11.0488 7.84171 10.8536 7.64645L6.35355 3.14645C6.15829 2.95118 5.84171 2.95118 5.64645 3.14645Z", 17358 fill: "currentColor" 17359 })); 17360 } 17361}); 17362const ErrorIcon$1 = replaceable("close", h("svg", { 17363 viewBox: "0 0 12 12", 17364 version: "1.1", 17365 xmlns: "http://www.w3.org/2000/svg", 17366 "aria-hidden": true 17367}, h("g", { 17368 stroke: "none", 17369 "stroke-width": "1", 17370 fill: "none", 17371 "fill-rule": "evenodd" 17372}, h("g", { 17373 fill: "currentColor", 17374 "fill-rule": "nonzero" 17375}, h("path", { 17376 d: "M2.08859116,2.2156945 L2.14644661,2.14644661 C2.32001296,1.97288026 2.58943736,1.95359511 2.7843055,2.08859116 L2.85355339,2.14644661 L6,5.293 L9.14644661,2.14644661 C9.34170876,1.95118446 9.65829124,1.95118446 9.85355339,2.14644661 C10.0488155,2.34170876 10.0488155,2.65829124 9.85355339,2.85355339 L6.707,6 L9.85355339,9.14644661 C10.0271197,9.32001296 10.0464049,9.58943736 9.91140884,9.7843055 L9.85355339,9.85355339 C9.67998704,10.0271197 9.41056264,10.0464049 9.2156945,9.91140884 L9.14644661,9.85355339 L6,6.707 L2.85355339,9.85355339 C2.65829124,10.0488155 2.34170876,10.0488155 2.14644661,9.85355339 C1.95118446,9.65829124 1.95118446,9.34170876 2.14644661,9.14644661 L5.293,6 L2.14644661,2.85355339 C1.97288026,2.67998704 1.95359511,2.41056264 2.08859116,2.2156945 L2.14644661,2.14644661 L2.08859116,2.2156945 Z" 17377}))))); 17378const EyeIcon = defineComponent({ 17379 name: "Eye", 17380 render() { 17381 return h("svg", { 17382 xmlns: "http://www.w3.org/2000/svg", 17383 viewBox: "0 0 512 512" 17384 }, h("path", { 17385 d: "M255.66 112c-77.94 0-157.89 45.11-220.83 135.33a16 16 0 0 0-.27 17.77C82.92 340.8 161.8 400 255.66 400c92.84 0 173.34-59.38 221.79-135.25a16.14 16.14 0 0 0 0-17.47C428.89 172.28 347.8 112 255.66 112z", 17386 fill: "none", 17387 stroke: "currentColor", 17388 "stroke-linecap": "round", 17389 "stroke-linejoin": "round", 17390 "stroke-width": "32" 17391 }), h("circle", { 17392 cx: "256", 17393 cy: "256", 17394 r: "80", 17395 fill: "none", 17396 stroke: "currentColor", 17397 "stroke-miterlimit": "10", 17398 "stroke-width": "32" 17399 })); 17400 } 17401}); 17402const EyeOffIcon = defineComponent({ 17403 name: "EyeOff", 17404 render() { 17405 return h("svg", { 17406 xmlns: "http://www.w3.org/2000/svg", 17407 viewBox: "0 0 512 512" 17408 }, h("path", { 17409 d: "M432 448a15.92 15.92 0 0 1-11.31-4.69l-352-352a16 16 0 0 1 22.62-22.62l352 352A16 16 0 0 1 432 448z", 17410 fill: "currentColor" 17411 }), h("path", { 17412 d: "M255.66 384c-41.49 0-81.5-12.28-118.92-36.5c-34.07-22-64.74-53.51-88.7-91v-.08c19.94-28.57 41.78-52.73 65.24-72.21a2 2 0 0 0 .14-2.94L93.5 161.38a2 2 0 0 0-2.71-.12c-24.92 21-48.05 46.76-69.08 76.92a31.92 31.92 0 0 0-.64 35.54c26.41 41.33 60.4 76.14 98.28 100.65C162 402 207.9 416 255.66 416a239.13 239.13 0 0 0 75.8-12.58a2 2 0 0 0 .77-3.31l-21.58-21.58a4 4 0 0 0-3.83-1a204.8 204.8 0 0 1-51.16 6.47z", 17413 fill: "currentColor" 17414 }), h("path", { 17415 d: "M490.84 238.6c-26.46-40.92-60.79-75.68-99.27-100.53C349 110.55 302 96 255.66 96a227.34 227.34 0 0 0-74.89 12.83a2 2 0 0 0-.75 3.31l21.55 21.55a4 4 0 0 0 3.88 1a192.82 192.82 0 0 1 50.21-6.69c40.69 0 80.58 12.43 118.55 37c34.71 22.4 65.74 53.88 89.76 91a.13.13 0 0 1 0 .16a310.72 310.72 0 0 1-64.12 72.73a2 2 0 0 0-.15 2.95l19.9 19.89a2 2 0 0 0 2.7.13a343.49 343.49 0 0 0 68.64-78.48a32.2 32.2 0 0 0-.1-34.78z", 17416 fill: "currentColor" 17417 }), h("path", { 17418 d: "M256 160a95.88 95.88 0 0 0-21.37 2.4a2 2 0 0 0-1 3.38l112.59 112.56a2 2 0 0 0 3.38-1A96 96 0 0 0 256 160z", 17419 fill: "currentColor" 17420 }), h("path", { 17421 d: "M165.78 233.66a2 2 0 0 0-3.38 1a96 96 0 0 0 115 115a2 2 0 0 0 1-3.38z", 17422 fill: "currentColor" 17423 })); 17424 } 17425}); 17426const EmptyIcon = defineComponent({ 17427 name: "Empty", 17428 render() { 17429 return h("svg", { 17430 viewBox: "0 0 28 28", 17431 fill: "none", 17432 xmlns: "http://www.w3.org/2000/svg" 17433 }, h("path", { 17434 d: "M26 7.5C26 11.0899 23.0899 14 19.5 14C15.9101 14 13 11.0899 13 7.5C13 3.91015 15.9101 1 19.5 1C23.0899 1 26 3.91015 26 7.5ZM16.8536 4.14645C16.6583 3.95118 16.3417 3.95118 16.1464 4.14645C15.9512 4.34171 15.9512 4.65829 16.1464 4.85355L18.7929 7.5L16.1464 10.1464C15.9512 10.3417 15.9512 10.6583 16.1464 10.8536C16.3417 11.0488 16.6583 11.0488 16.8536 10.8536L19.5 8.20711L22.1464 10.8536C22.3417 11.0488 22.6583 11.0488 22.8536 10.8536C23.0488 10.6583 23.0488 10.3417 22.8536 10.1464L20.2071 7.5L22.8536 4.85355C23.0488 4.65829 23.0488 4.34171 22.8536 4.14645C22.6583 3.95118 22.3417 3.95118 22.1464 4.14645L19.5 6.79289L16.8536 4.14645Z", 17435 fill: "currentColor" 17436 }), h("path", { 17437 d: "M25 22.75V12.5991C24.5572 13.0765 24.053 13.4961 23.5 13.8454V16H17.5L17.3982 16.0068C17.0322 16.0565 16.75 16.3703 16.75 16.75C16.75 18.2688 15.5188 19.5 14 19.5C12.4812 19.5 11.25 18.2688 11.25 16.75L11.2432 16.6482C11.1935 16.2822 10.8797 16 10.5 16H4.5V7.25C4.5 6.2835 5.2835 5.5 6.25 5.5H12.2696C12.4146 4.97463 12.6153 4.47237 12.865 4H6.25C4.45507 4 3 5.45507 3 7.25V22.75C3 24.5449 4.45507 26 6.25 26H21.75C23.5449 26 25 24.5449 25 22.75ZM4.5 22.75V17.5H9.81597L9.85751 17.7041C10.2905 19.5919 11.9808 21 14 21L14.215 20.9947C16.2095 20.8953 17.842 19.4209 18.184 17.5H23.5V22.75C23.5 23.7165 22.7165 24.5 21.75 24.5H6.25C5.2835 24.5 4.5 23.7165 4.5 22.75Z", 17438 fill: "currentColor" 17439 })); 17440 } 17441}); 17442const ErrorIcon = replaceable("error", h("svg", { 17443 viewBox: "0 0 48 48", 17444 version: "1.1", 17445 xmlns: "http://www.w3.org/2000/svg" 17446}, h("g", { 17447 stroke: "none", 17448 "stroke-width": "1", 17449 "fill-rule": "evenodd" 17450}, h("g", { 17451 "fill-rule": "nonzero" 17452}, h("path", {
17453 d: "M24,4 C35.045695,4 44,12.954305 44,24 C44,35.045695 35.045695,44 24,44 C12.954305,44 4,35.045695 4,24 C4,12.954305 12.954305,4 24,4 Z M17.8838835,16.1161165 L17.7823881,16.0249942 C17.3266086,15.6583353 16.6733914,15.6583353 16.2176119,16.0249942 L16.1161165,16.1161165 L16.0249942,16.2176119 C15.6583353,16.6733914 15.6583353,17.3266086 16.0249942,17.7823881 L16.1161165,17.8838835 L22.233,24 L16.1161165,30.1161165 L16.0249942,30.2176119 C15.6583353,30.6733914 15.6583353,31.3266086 16.0249942,31.7823881 L16.1161165,31.8838835 L16.2176119,31.9750058 C16.6733914,32.3416647 17.3266086,32.3416647 17.7823881,31.9750058 L17.8838835,31.8838835 L24,25.767 L30.1161165,31.8838835 L30.2176119,31.9750058 C30.6733914,32.3416647 31.3266086,32.3416647 31.7823881,31.9750058 L31.8838835,31.8838835 L31.9750058,31.7823881 C32.3416647,31.3266086 32.3416647,30.6733914 31.9750058,30.2176119 L31.8838835,30.1161165 L25.767,24 L31.8838835,17.8838835 L31.9750058,17.7823881 C32.3416647,17.3266086 32.3416647,16.6733914 31.9750058,16.2176119 L31.8838835,16.1161165 L31.7823881,16.0249942 C31.3266086,15.6583353 30.6733914,15.6583353 30.2176119,16.0249942 L30.1161165,16.1161165 L24,22.233 L17.8838835,16.1161165 L17.7823881,16.0249942 L17.8838835,16.1161165 Z" 17454}))))); 17455const InfoIcon = replaceable("info", h("svg", { 17456 viewBox: "0 0 28 28", 17457 version: "1.1", 17458 xmlns: "http://www.w3.org/2000/svg" 17459}, h("g", { 17460 stroke: "none", 17461 "stroke-width": "1", 17462 "fill-rule": "evenodd" 17463}, h("g", { 17464 "fill-rule": "nonzero" 17465}, h("path", { 17466 d: "M14,2 C20.6274,2 26,7.37258 26,14 C26,20.6274 20.6274,26 14,26 C7.37258,26 2,20.6274 2,14 C2,7.37258 7.37258,2 14,2 Z M14,11 C13.4477,11 13,11.4477 13,12 L13,12 L13,20 C13,20.5523 13.4477,21 14,21 C14.5523,21 15,20.5523 15,20 L15,20 L15,12 C15,11.4477 14.5523,11 14,11 Z M14,6.75 C13.3096,6.75 12.75,7.30964 12.75,8 C12.75,8.69036 13.3096,9.25 14,9.25 C14.6904,9.25 15.25,8.69036 15.25,8 C15.25,7.30964 14.6904,6.75 14,6.75 Z" 17467}))))); 17468const SuccessIcon = replaceable("success", h("svg", { 17469 viewBox: "0 0 48 48", 17470 version: "1.1", 17471 xmlns: "http://www.w3.org/2000/svg" 17472}, h("g", { 17473 stroke: "none", 17474 "stroke-width": "1", 17475 "fill-rule": "evenodd" 17476}, h("g", { 17477 "fill-rule": "nonzero" 17478}, h("path", { 17479 d: "M24,4 C35.045695,4 44,12.954305 44,24 C44,35.045695 35.045695,44 24,44 C12.954305,44 4,35.045695 4,24 C4,12.954305 12.954305,4 24,4 Z M32.6338835,17.6161165 C32.1782718,17.1605048 31.4584514,17.1301307 30.9676119,17.5249942 L30.8661165,17.6161165 L20.75,27.732233 L17.1338835,24.1161165 C16.6457281,23.6279612 15.8542719,23.6279612 15.3661165,24.1161165 C14.9105048,24.5717282 14.8801307,25.2915486 15.2749942,25.7823881 L15.3661165,25.8838835 L19.8661165,30.3838835 C20.3217282,30.8394952 21.0415486,30.8698693 21.5323881,30.4750058 L21.6338835,30.3838835 L32.6338835,19.3838835 C33.1220388,18.8957281 33.1220388,18.1042719 32.6338835,17.6161165 Z" 17480}))))); 17481const WarningIcon = replaceable("warning", h("svg", { 17482 viewBox: "0 0 24 24", 17483 version: "1.1", 17484 xmlns: "http://www.w3.org/2000/svg" 17485}, h("g", { 17486 stroke: "none", 17487 "stroke-width": "1", 17488 "fill-rule": "evenodd" 17489}, h("g", { 17490 "fill-rule": "nonzero" 17491}, h("path", { 17492 d: "M12,2 C17.523,2 22,6.478 22,12 C22,17.522 17.523,22 12,22 C6.477,22 2,17.522 2,12 C2,6.478 6.477,2 12,2 Z M12.0018002,15.0037242 C11.450254,15.0037242 11.0031376,15.4508407 11.0031376,16.0023869 C11.0031376,16.553933 11.450254,17.0010495 12.0018002,17.0010495 C12.5533463,17.0010495 13.0004628,16.553933 13.0004628,16.0023869 C13.0004628,15.4508407 12.5533463,15.0037242 12.0018002,15.0037242 Z M11.99964,7 C11.4868042,7.00018474 11.0642719,7.38637706 11.0066858,7.8837365 L11,8.00036004 L11.0018003,13.0012393 L11.00857,13.117858 C11.0665141,13.6151758 11.4893244,14.0010638 12.0021602,14.0008793 C12.514996,14.0006946 12.9375283,13.6145023 12.9951144,13.1171428 L13.0018002,13.0005193 L13,7.99964009 L12.9932303,7.8830214 C12.9352861,7.38570354 12.5124758,6.99981552 11.99964,7 Z" 17493}))))); 17494const ChevronDownIcon = defineComponent({ 17495 name: "ChevronDown", 17496 render() { 17497 return h("svg", { 17498 viewBox: "0 0 16 16", 17499 fill: "none", 17500 xmlns: "http://www.w3.org/2000/svg" 17501 }, h("path", { 17502 d: "M3.14645 5.64645C3.34171 5.45118 3.65829 5.45118 3.85355 5.64645L8 9.79289L12.1464 5.64645C12.3417 5.45118 12.6583 5.45118 12.8536 5.64645C13.0488 5.84171 13.0488 6.15829 12.8536 6.35355L8.35355 10.8536C8.15829 11.0488 7.84171 11.0488 7.64645 10.8536L3.14645 6.35355C2.95118 6.15829 2.95118 5.84171 3.14645 5.64645Z", 17503 fill: "currentColor" 17504 })); 17505 } 17506}); 17507const ClearIcon = replaceable("clear", h("svg", { 17508 viewBox: "0 0 16 16", 17509 version: "1.1", 17510 xmlns: "http://www.w3.org/2000/svg" 17511}, h("g", { 17512 stroke: "none", 17513 "stroke-width": "1", 17514 fill: "none", 17515 "fill-rule": "evenodd" 17516}, h("g", { 17517 fill: "currentColor", 17518 "fill-rule": "nonzero" 17519}, h("path", { 17520 d: "M8,2 C11.3137085,2 14,4.6862915 14,8 C14,11.3137085 11.3137085,14 8,14 C4.6862915,14 2,11.3137085 2,8 C2,4.6862915 4.6862915,2 8,2 Z M6.5343055,5.83859116 C6.33943736,5.70359511 6.07001296,5.72288026 5.89644661,5.89644661 L5.89644661,5.89644661 L5.83859116,5.9656945 C5.70359511,6.16056264 5.72288026,6.42998704 5.89644661,6.60355339 L5.89
17520644661,6.60355339 L7.293,8 L5.89644661,9.39644661 L5.83859116,9.4656945 C5.70359511,9.66056264 5.72288026,9.92998704 5.89644661,10.1035534 L5.89644661,10.1035534 L5.9656945,10.1614088 C6.16056264,10.2964049 6.42998704,10.2771197 6.60355339,10.1035534 L6.60355339,10.1035534 L8,8.707 L9.39644661,10.1035534 L9.4656945,10.1614088 C9.66056264,10.2964049 9.92998704,10.2771197 10.1035534,10.1035534 L10.1035534,10.1035534 L10.1614088,10.0343055 C10.2964049,9.83943736 10.2771197,9.57001296 10.1035534,9.39644661 L10.1035534,9.39644661 L8.707,8 L10.1035534,6.60355339 L10.1614088,6.5343055 C10.2964049,6.33943736 10.2771197,6.07001296 10.1035534,5.89644661 L10.1035534,5.89644661 L10.0343055,5.83859116 C9.83943736,5.70359511 9.57001296,5.72288026 9.39644661,5.89644661 L9.39644661,5.89644661 L8,7.293 L6.60355339,5.89644661 Z" 17521}))))); 17522const NIconSwitchTransition = defineComponent({ 17523 name: "BaseIconSwitchTransition", 17524 setup(_, { 17525 slots 17526 }) { 17527 const isMountedRef = isMounted(); 17528 return () => h(Transition, { 17529 name: "icon-switch-transition", 17530 appear: isMountedRef.value 17531 }, slots); 17532 } 17533}); 17534const NFadeInExpandTransition = defineComponent({ 17535 name: "FadeInExpandTransition", 17536 props: { 17537 appear: Boolean, 17538 group: Boolean, 17539 mode: String, 17540 onLeave: Function, 17541 onAfterLeave: Function, 17542 onAfterEnter: Function, 17543 width: Boolean, 17544 // reverse mode is only used in tree 17545 // it make it from expanded to collapsed after mounted 17546 reverse: Boolean 17547 }, 17548 setup(props, { 17549 slots 17550 }) { 17551 function handleBeforeLeave(el) { 17552 if (props.width) { 17553 el.style.maxWidth = `${el.offsetWidth}px`; 17554 } else { 17555 el.style.maxHeight = `${el.offsetHeight}px`; 17556 } 17557 void el.offsetWidth; 17558 } 17559 function handleLeave(el) { 17560 if (props.width) { 17561 el.style.maxWidth = "0"; 17562 } else { 17563 el.style.maxHeight = "0"; 17564 } 17565 void el.offsetWidth; 17566 const { 17567 onLeave 17568 } = props; 17569 if (onLeave) 17570 onLeave(); 17571 } 17572 function handleAfterLeave(el) { 17573 if (props.width) { 17574 el.style.maxWidth = ""; 17575 } else { 17576 el.style.maxHeight = ""; 17577 } 17578 const { 17579 onAfterLeave 17580 } = props; 17581 if (onAfterLeave) 17582 onAfterLeave(); 17583 } 17584 function handleEnter(el) { 17585 el.style.transition = "none"; 17586 if (props.width) { 17587 const memorizedWidth = el.offsetWidth; 17588 el.style.maxWidth = "0"; 17589 void el.offsetWidth; 17590 el.style.transition = ""; 17591 el.style.maxWidth = `${memorizedWidth}px`; 17592 } else { 17593 if (props.reverse) { 17594 el.style.maxHeight = `${el.offsetHeight}px`; 17595 void el.offsetHeight; 17596 el.style.transition = ""; 17597 el.style.maxHeight = "0"; 17598 } else { 17599 const memorizedHeight = el.offsetHeight; 17600 el.style.maxHeight = "0"; 17601 void el.offsetWidth; 17602 el.style.transition = ""; 17603 el.style.maxHeight = `${memorizedHeight}px`; 17604 } 17605 } 17606 void el.offsetWidth; 17607 } 17608 function handleAfterEnter(el) { 17609 var _a2; 17610 if (props.width) { 17611 el.style.maxWidth = ""; 17612 } else { 17613 if (!props.reverse) { 17614 el.style.maxHeight = ""; 17615 } 17616 } 17617 (_a2 = props.onAfterEnter) === null || _a2 === void 0 ? void 0 : _a2.call(props); 17618 } 17619 return () => { 17620 const { 17621 group, 17622 width, 17623 appear, 17624 mode 17625 } = props; 17626 const type4 = group ? TransitionGroup : Transition; 17627 const resolvedProps = { 17628 name: width ? "fade-in-width-expand-transition" : "fade-in-height-expand-transition", 17629 appear, 17630 onEnter: handleEnter, 17631 onAfterEnter: handleAfterEnter, 17632 onBeforeLeave: handleBeforeLeave, 17633 onLeave: handleLeave, 17634 onAfterLeave: handleAfterLeave 17635 }; 17636 if (!group) { 17637 resolvedProps.mode = mode; 17638 } 17639 return h(type4, resolvedProps, slots); 17640 }; 17641 } 17642}); 17643const style$n = cB("base-icon", ` 17644 height: 1em; 17645 width: 1em; 17646 line-height: 1em; 17647 text-align: center; 17648 display: inline-block; 17649 position: relative; 17650 fill: currentColor; 17651 transform: translateZ(0); 17652`, [c$1("svg", ` 17653 height: 1em; 17654 width: 1em; 17655 `)]); 17656const NBaseIcon = defineComponent({ 17657 name: "BaseIcon", 17658 props: { 17659 role: String,
17660 ariaLabel: String, 17661 ariaDisabled: { 17662 type: Boolean, 17663 default: void 0 17664 }, 17665 ariaHidden: { 17666 type: Boolean, 17667 default: void 0 17668 }, 17669 clsPrefix: { 17670 type: String, 17671 required: true 17672 }, 17673 onClick: Function, 17674 onMousedown: Function, 17675 onMouseup: Function 17676 }, 17677 setup(props) { 17678 useStyle("-base-icon", style$n, toRef(props, "clsPrefix")); 17679 }, 17680 render() { 17681 return h("i", { 17682 class: `${this.clsPrefix}-base-icon`, 17683 onClick: this.onClick, 17684 onMousedown: this.onMousedown, 17685 onMouseup: this.onMouseup, 17686 role: this.role, 17687 "aria-label": this.ariaLabel, 17688 "aria-hidden": this.ariaHidden, 17689 "aria-disabled": this.ariaDisabled 17690 }, this.$slots); 17691 } 17692}); 17693const style$m = cB("base-close", ` 17694 display: flex; 17695 align-items: center; 17696 justify-content: center; 17697 cursor: pointer; 17698 background-color: transparent; 17699 color: var(--n-close-icon-color); 17700 border-radius: var(--n-close-border-radius); 17701 height: var(--n-close-size); 17702 width: var(--n-close-size); 17703 font-size: var(--n-close-icon-size); 17704 outline: none; 17705 border: none; 17706 position: relative; 17707 padding: 0; 17708`, [cM("absolute", ` 17709 height: var(--n-close-icon-size); 17710 width: var(--n-close-icon-size); 17711 `), c$1("&::before", ` 17712 content: ""; 17713 position: absolute; 17714 width: var(--n-close-size); 17715 height: var(--n-close-size); 17716 left: 50%; 17717 top: 50%; 17718 transform: translateY(-50%) translateX(-50%); 17719 transition: inherit; 17720 border-radius: inherit; 17721 `), cNotM("disabled", [c$1("&:hover", ` 17722 color: var(--n-close-icon-color-hover); 17723 `), c$1("&:hover::before", ` 17724 background-color: var(--n-close-color-hover); 17725 `), c$1("&:focus::before", ` 17726 background-color: var(--n-close-color-hover); 17727 `), c$1("&:active", ` 17728 color: var(--n-close-icon-color-pressed); 17729 `), c$1("&:active::before", ` 17730 background-color: var(--n-close-color-pressed); 17731 `)]), cM("disabled", ` 17732 cursor: not-allowed; 17733 color: var(--n-close-icon-color-disabled); 17734 background-color: transparent; 17735 `), cM("round", [c$1("&::before", ` 17736 border-radius: 50%; 17737 `)])]); 17738const NBaseClose = defineComponent({ 17739 name: "BaseClose", 17740 props: { 17741 isButtonTag: { 17742 type: Boolean, 17743 default: true 17744 }, 17745 clsPrefix: { 17746 type: String, 17747 required: true 17748 }, 17749 disabled: { 17750 type: Boolean, 17751 default: void 0 17752 }, 17753 focusable: { 17754 type: Boolean, 17755 default: true 17756 }, 17757 round: Boolean, 17758 onClick: Function, 17759 absolute: Boolean 17760 }, 17761 setup(props) { 17762 useStyle("-base-close", style$m, toRef(props, "clsPrefix")); 17763 return () => { 17764 const { 17765 clsPrefix, 17766 disabled, 17767 absolute, 17768 round, 17769 isButtonTag 17770 } = props; 17771 const Tag = isButtonTag ? "button" : "div"; 17772 return h(Tag, { 17773 type: isButtonTag ? "button" : void 0, 17774 tabindex: disabled || !props.focusable ? -1 : 0, 17775 "aria-disabled": disabled, 17776 "aria-label": "close", 17777 role: isButtonTag ? void 0 : "button", 17778 disabled, 17779 class: [`${clsPrefix}-base-close`, absolute && `${clsPrefix}-base-close--absolute`, disabled && `${clsPrefix}-base-close--disabled`, round && `${clsPrefix}-base-close--round`], 17780 onMousedown: (e) => { 17781 if (!props.focusable) { 17782 e.preventDefault(); 17783 } 17784 }, 17785 onClick: props.onClick 17786 }, h(NBaseIcon, { 17787 clsPrefix 17788 }, { 17789 default: () => h(ErrorIcon$1, null) 17790 })); 17791 }; 17792 } 17793}); 17794const FocusDetector = defineComponent({ 17795 props: { 17796 onFocus: Function, 17797 onBlur: Function 17798 }, 17799 setup(props) { 17800 return () => h("div", { 17801 style: "width: 0; height: 0", 17802 tabindex: 0, 17803 onFocus: props.onFocus, 17804 onBlur: props.onBlur 17805 }); 17806 } 17807}); 17808const { 17809 cubicBezierEaseInOut: cubicBezierEaseInOut$4 17810} = commonVariables$8; 17811function iconSwitchTransition({ 17812 originalTransform = "", 17813 left = 0, 17814 top = 0, 17815 transition = `all .3s ${cubicBezierEaseInOut$4} !important` 17816} = {}) { 17817 return [c$1("&.icon-switch-transition-enter-from, &.icon-switch-transition-leave-to", { 17818 transform: originalTransform + " scale(0.75)", 17819 left, 17820 top, 17821 opacity: 0 17822 }), c$1("&.icon-switch-transition-enter-to, &.icon-switch-transition-leave-from", { 17823 transform: `scale(1) ${originalTransform}`, 17824 left, 17825 top, 17826 opacity: 1 17827 }), c$1("&.icon-switch-transition-enter-active, &.icon-switch-transition-leave-active", { 17828 transformOrigin: "center", 17829 position: "absolute", 17830 left, 17831 top, 17832 transition 17833 })]; 17834} 17835const style$l = c$1([c$1("@keyframes rotator", ` 17836 0% { 17837 -webkit-transform: rotate(0deg); 17838 transform: rotate(0deg); 17839 } 17840 100% { 17841 -webkit-transform: rotate(360deg); 17842 transform: rotate(360deg); 17843 }`), cB("base-loading", ` 17844 position: relative; 17845 line-height: 0; 17846 width: 1em; 17847 height: 1em; 17848 `, [cE("transition-wrapper", ` 17849 position: absolute; 17850 width: 100%; 17851 height: 100%; 17852 `, [iconSwitchTransition()]), cE("placeholder", ` 17853 position: absolute; 17854 left: 50%; 17855 top: 50%; 17856 transform: translateX(-50%) translateY(-50%); 17857 `, [iconSwitchTransition({ 17858 left: "50%", 17859 top: "50%", 17860 originalTransform: "translateX(-50%) translateY(-50%)" 17861})]), cE("container", ` 17862 animation: rotator 3s linear infinite both; 17863 `, [cE("icon", ` 17864 height: 1em; 17865 width: 1em; 17866 `)])])]); 17867const duration = "1.6s"; 17868const exposedLoadingProps = { 17869 strokeWidth: { 17870 type: Number, 17871 default: 28 17872 }, 17873 stroke: { 17874 type: String, 17875 default: void 0 17876 } 17877}; 17878const NBaseLoading = defineComponent({ 17879 name: "BaseLoading", 17880 props: Object.assign({ 17881 clsPrefix: { 17882 type: String, 17883 required: true 17884 }, 17885 show: { 17886 type: Boolean, 17887 default: true 17888 }, 17889 scale: { 17890 type: Number, 17891 default: 1 17892 }, 17893 radius: { 17894 type: Number, 17895 default: 100 17896 } 17897 }, exposedLoadingProps), 17898 setup(props) { 17899 useStyle("-base-loading", style$l, toRef(props, "clsPrefix")); 17900 }, 17901 render() { 17902 const { 17903 clsPrefix, 17904 radius, 17905 strokeWidth, 17906 stroke, 17907 scale 17908 } = this;
17909 const scaledRadius = radius / scale; 17910 return h("div", { 17911 class: `${clsPrefix}-base-loading`, 17912 role: "img", 17913 "aria-label": "loading" 17914 }, h(NIconSwitchTransition, null, { 17915 default: () => this.show ? h("div", { 17916 key: "icon", 17917 class: `${clsPrefix}-base-loading__transition-wrapper` 17918 }, h("div", { 17919 class: `${clsPrefix}-base-loading__container` 17920 }, h("svg", { 17921 class: `${clsPrefix}-base-loading__icon`, 17922 viewBox: `0 0 ${2 * scaledRadius} ${2 * scaledRadius}`, 17923 xmlns: "http://www.w3.org/2000/svg", 17924 style: { 17925 color: stroke 17926 } 17927 }, h("g", null, h("animateTransform", { 17928 attributeName: "transform", 17929 type: "rotate", 17930 values: `0 ${scaledRadius} ${scaledRadius};270 ${scaledRadius} ${scaledRadius}`, 17931 begin: "0s", 17932 dur: duration, 17933 fill: "freeze", 17934 repeatCount: "indefinite" 17935 }), h("circle", { 17936 class: `${clsPrefix}-base-loading__icon`, 17937 fill: "none", 17938 stroke: "currentColor", 17939 "stroke-width": strokeWidth, 17940 "stroke-linecap": "round", 17941 cx: scaledRadius, 17942 cy: scaledRadius, 17943 r: radius - strokeWidth / 2, 17944 "stroke-dasharray": 5.67 * radius, 17945 "stroke-dashoffset": 18.48 * radius 17946 }, h("animateTransform", { 17947 attributeName: "transform", 17948 type: "rotate", 17949 values: `0 ${scaledRadius} ${scaledRadius};135 ${scaledRadius} ${scaledRadius};450 ${scaledRadius} ${scaledRadius}`, 17950 begin: "0s", 17951 dur: duration, 17952 fill: "freeze", 17953 repeatCount: "indefinite" 17954 }), h("animate", { 17955 attributeName: "stroke-dashoffset", 17956 values: `${5.67 * radius};${1.42 * radius};${5.67 * radius}`, 17957 begin: "0s", 17958 dur: duration, 17959 fill: "freeze", 17960 repeatCount: "indefinite" 17961 })))))) : h("div", { 17962 key: "placeholder", 17963 class: `${clsPrefix}-base-loading__placeholder` 17964 }, this.$slots) 17965 })); 17966 } 17967}); 17968function toArray$1(arg) { 17969 if (Array.isArray(arg)) 17970 return arg; 17971 return [arg]; 17972} 17973const TRAVERSE_COMMAND = { 17974 STOP: "STOP" 17975}; 17976function traverseWithCb(treeNode, callback) { 17977 const command = callback(treeNode); 17978 if (treeNode.children !== void 0 && command !== TRAVERSE_COMMAND.STOP) { 17979 treeNode.children.forEach((childNode) => traverseWithCb(childNode, callback)); 17980 } 17981} 17982function getNonLeafKeys(treeNodes, options = {}) { 17983 const { preserveGroup = false } = options; 17984 const keys2 = []; 17985 const cb = preserveGroup ? (node) => { 17986 if (!node.isLeaf) { 17987 keys2.push(node.key); 17988 traverse2(node.children); 17989 } 17990 } : (node) => { 17991 if (!node.isLeaf) { 17992 if (!node.isGroup) 17993 keys2.push(node.key); 17994 traverse2(node.children); 17995 } 17996 }; 17997 function traverse2(nodes) { 17998 nodes.forEach(cb); 17999 } 18000 traverse2(treeNodes); 18001 return keys2; 18002} 18003function isLeaf(rawNode, getChildren) { 18004 const { isLeaf: isLeaf2 } = rawNode; 18005 if (isLeaf2 !== void 0) 18006 return isLeaf2; 18007 else if (!getChildren(rawNode)) 18008 return true; 18009 return false; 18010} 18011function defaultGetChildren(node) { 18012 return node.children; 18013} 18014function defaultGetKey(node) { 18015 return node.key; 18016} 18017function isIgnored() { 18018 return false; 18019} 18020function isShallowLoaded(rawNode, getChildren) { 18021 const { isLeaf: isLeaf2 } = rawNode; 18022 if (isLeaf2 === false && !Array.isArray(getChildren(rawNode))) 18023 return false; 18024 return true; 18025} 18026function isDisabled(rawNode) { 18027 return rawNode.disabled === true; 18028} 18029function isExpilicitlyNotLoaded(rawNode, getChildren) { 18030 return rawNode.isLeaf === false && !Array.isArray(getChildren(rawNode)); 18031} 18032function unwrapCheckedKeys(result) { 18033 var _a2; 18034 if (result === void 0 || result === null) 18035 return []; 18036 if (Array.isArray(result)) 18037 return result; 18038 return (_a2 = result.checkedKeys) !== null && _a2 !== void 0 ? _a2 : []; 18039} 18040function unwrapIndeterminateKeys(result) { 18041 var _a2; 18042 if (result === void 0 || result === null || Array.isArray(result)) { 18043 return []; 18044 } 18045 return (_a2 = result.indeterminateKeys) !== null && _a2 !== void 0 ? _a2 : []; 18046} 18047function merge$1(originalKeys, keysToAdd) { 18048 const set2 = new Set(originalKeys);
18049 keysToAdd.forEach((key) => { 18050 if (!set2.has(key)) { 18051 set2.add(key); 18052 } 18053 }); 18054 return Array.from(set2); 18055} 18056function minus(originalKeys, keysToRemove) { 18057 const set2 = new Set(originalKeys); 18058 keysToRemove.forEach((key) => { 18059 if (set2.has(key)) { 18060 set2.delete(key); 18061 } 18062 }); 18063 return Array.from(set2); 18064} 18065function isGroup(rawNode) { 18066 return (rawNode === null || rawNode === void 0 ? void 0 : rawNode.type) === "group"; 18067} 18068function createIndexGetter(treeNodes) { 18069 const map2 = /* @__PURE__ */ new Map(); 18070 treeNodes.forEach((treeNode, i) => { 18071 map2.set(treeNode.key, i); 18072 }); 18073 return (key) => { 18074 var _a2; 18075 return (_a2 = map2.get(key)) !== null && _a2 !== void 0 ? _a2 : null; 18076 }; 18077} 18078class SubtreeNotLoadedError extends Error { 18079 constructor() { 18080 super(); 18081 this.message = "SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."; 18082 } 18083} 18084function getExtendedCheckedKeySetAfterCheck(checkKeys, currentCheckedKeys, treeMate, allowNotLoaded) { 18085 return getExtendedCheckedKeySet(currentCheckedKeys.concat(checkKeys), treeMate, allowNotLoaded, false); 18086} 18087function getAvailableAscendantNodeSet(uncheckedKeys, treeMate) { 18088 const visitedKeys = /* @__PURE__ */ new Set(); 18089 uncheckedKeys.forEach((uncheckedKey) => { 18090 const uncheckedTreeNode = treeMate.treeNodeMap.get(uncheckedKey); 18091 if (uncheckedTreeNode !== void 0) { 18092 let nodeCursor = uncheckedTreeNode.parent; 18093 while (nodeCursor !== null) { 18094 if (nodeCursor.disabled) 18095 break; 18096 if (visitedKeys.has(nodeCursor.key)) 18097 break; 18098 else { 18099 visitedKeys.add(nodeCursor.key); 18100 } 18101 nodeCursor = nodeCursor.parent; 18102 } 18103 } 18104 }); 18105 return visitedKeys; 18106} 18107function getExtendedCheckedKeySetAfterUncheck(uncheckedKeys, currentCheckedKeys, treeMate, allowNotLoaded) { 18108 const extendedCheckedKeySet = getExtendedCheckedKeySet(currentCheckedKeys, treeMate, allowNotLoaded, false); 18109 const extendedKeySetToUncheck = getExtendedCheckedKeySet(uncheckedKeys, treeMate, allowNotLoaded, true); 18110 const ascendantKeySet = getAvailableAscendantNodeSet(uncheckedKeys, treeMate); 18111 const keysToRemove = []; 18112 extendedCheckedKeySet.forEach((key) => { 18113 if (extendedKeySetToUncheck.has(key) || ascendantKeySet.has(key)) { 18114 keysToRemove.push(key); 18115 } 18116 }); 18117 keysToRemove.forEach((key) => extendedCheckedKeySet.delete(key)); 18118 return extendedCheckedKeySet; 18119} 18120function getCheckedKeys(options, treeMate) { 18121 const { checkedKeys, keysToCheck, keysToUncheck, indeterminateKeys, cascade, leafOnly, checkStrategy, allowNotLoaded } = options; 18122 if (!cascade) { 18123 if (keysToCheck !== void 0) { 18124 return { 18125 checkedKeys: merge$1(checkedKeys, keysToCheck), 18126 indeterminateKeys: Array.from(indeterminateKeys) 18127 }; 18128 } else if (keysToUncheck !== void 0) { 18129 return { 18130 checkedKeys: minus(checkedKeys, keysToUncheck), 18131 indeterminateKeys: Array.from(indeterminateKeys) 18132 }; 18133 } else { 18134 return { 18135 checkedKeys: Array.from(checkedKeys), 18136 indeterminateKeys: Array.from(indeterminateKeys) 18137 }; 18138 } 18139 } 18140 const { levelTreeNodeMap } = treeMate; 18141 let extendedCheckedKeySet; 18142 if (keysToUncheck !== void 0) { 18143 extendedCheckedKeySet = getExtendedCheckedKeySetAfterUncheck(keysToUncheck, checkedKeys, treeMate, allowNotLoaded); 18144 } else if (keysToCheck !== void 0) { 18145 extendedCheckedKeySet = getExtendedCheckedKeySetAfterCheck(keysToCheck, checkedKeys, treeMate, allowNotLoaded); 18146 } else { 18147 extendedCheckedKeySet = getExtendedCheckedKeySet(checkedKeys, treeMate, allowNotLoaded, false); 18148 } 18149 const checkStrategyIsParent = checkStrategy === "parent"; 18150 const checkStrategyIsChild = checkStrategy === "child" || leafOnly; 18151 const syntheticCheckedKeySet = extendedCheckedKeySet; 18152 const syntheticIndeterminateKeySet = /* @__PURE__ */ new Set(); 18153 const maxLevel = Math.max.apply(null, Array.from(levelTreeNodeMap.keys())); 18154 for (let level = maxLevel; level >= 0; level -= 1) { 18155 const levelIsZero = level === 0; 18156 const levelTreeNodes = levelTreeNodeMap.get(level); 18157 for (const levelTreeNode of levelTreeNodes) { 18158 if (levelTreeNode.isLeaf) 18159 continue; 18160 const { key: levelTreeNodeKey, shallowLoaded } = levelTreeNode; 18161 if (checkStrategyIsChild && shallowLoaded) {
18162 levelTreeNode.children.forEach((v) => { 18163 if (!v.disabled && !v.isLeaf && v.shallowLoaded && syntheticCheckedKeySet.has(v.key)) { 18164 syntheticCheckedKeySet.delete(v.key); 18165 } 18166 }); 18167 } 18168 if (levelTreeNode.disabled || !shallowLoaded) { 18169 continue; 18170 } 18171 let fullyChecked = true; 18172 let partialChecked = false; 18173 let allDisabled = true; 18174 for (const childNode of levelTreeNode.children) { 18175 const childKey = childNode.key; 18176 if (childNode.disabled) 18177 continue; 18178 if (allDisabled) 18179 allDisabled = false; 18180 if (syntheticCheckedKeySet.has(childKey)) { 18181 partialChecked = true; 18182 } else if (syntheticIndeterminateKeySet.has(childKey)) { 18183 partialChecked = true; 18184 fullyChecked = false; 18185 break; 18186 } else { 18187 fullyChecked = false; 18188 if (partialChecked) { 18189 break; 18190 } 18191 } 18192 } 18193 if (fullyChecked && !allDisabled) { 18194 if (checkStrategyIsParent) { 18195 levelTreeNode.children.forEach((v) => { 18196 if (!v.disabled && syntheticCheckedKeySet.has(v.key)) { 18197 syntheticCheckedKeySet.delete(v.key); 18198 } 18199 }); 18200 } 18201 syntheticCheckedKeySet.add(levelTreeNodeKey); 18202 } else if (partialChecked) { 18203 syntheticIndeterminateKeySet.add(levelTreeNodeKey); 18204 } 18205 if (levelIsZero && checkStrategyIsChild && syntheticCheckedKeySet.has(levelTreeNodeKey)) { 18206 syntheticCheckedKeySet.delete(levelTreeNodeKey); 18207 } 18208 } 18209 } 18210 return { 18211 checkedKeys: Array.from(syntheticCheckedKeySet), 18212 indeterminateKeys: Array.from(syntheticIndeterminateKeySet) 18213 }; 18214} 18215function getExtendedCheckedKeySet(checkedKeys, treeMate, allowNotLoaded, isUnchecking) { 18216 const { treeNodeMap, getChildren } = treeMate; 18217 const visitedKeySet = /* @__PURE__ */ new Set(); 18218 const extendedKeySet = new Set(checkedKeys); 18219 checkedKeys.forEach((checkedKey) => { 18220 const checkedTreeNode = treeNodeMap.get(checkedKey); 18221 if (checkedTreeNode !== void 0) { 18222 traverseWithCb(checkedTreeNode, (treeNode) => { 18223 if (treeNode.disabled) { 18224 return TRAVERSE_COMMAND.STOP; 18225 } 18226 const { key } = treeNode; 18227 if (visitedKeySet.has(key)) 18228 return; 18229 visitedKeySet.add(key); 18230 extendedKeySet.add(key); 18231 if (isExpilicitlyNotLoaded(treeNode.rawNode, getChildren)) { 18232 if (isUnchecking) { 18233 return TRAVERSE_COMMAND.STOP; 18234 } else if (!allowNotLoaded) { 18235 throw new SubtreeNotLoadedError(); 18236 } 18237 } 18238 }); 18239 } 18240 }); 18241 return extendedKeySet; 18242} 18243function getPath(key, { includeGroup = false, includeSelf = true }, treeMate) { 18244 var _a2; 18245 const treeNodeMap = treeMate.treeNodeMap; 18246 let treeNode = key === null || key === void 0 ? null : (_a2 = treeNodeMap.get(key)) !== null && _a2 !== void 0 ? _a2 : null; 18247 const mergedPath = { 18248 keyPath: [], 18249 treeNodePath: [], 18250 treeNode 18251 }; 18252 if (treeNode === null || treeNode === void 0 ? void 0 : treeNode.ignored) { 18253 mergedPath.treeNode = null; 18254 return mergedPath; 18255 } 18256 while (treeNode) { 18257 if (!treeNode.ignored && (includeGroup || !treeNode.isGroup)) { 18258 mergedPath.treeNodePath.push(treeNode); 18259 } 18260 treeNode = treeNode.parent; 18261 } 18262 mergedPath.treeNodePath.reverse(); 18263 if (!includeSelf) 18264 mergedPath.treeNodePath.pop(); 18265 mergedPath.keyPath = mergedPath.treeNodePath.map((treeNode2) => treeNode2.key); 18266 return mergedPath; 18267} 18268function getFirstAvailableNode(nodes) { 18269 if (nodes.length === 0) 18270 return null; 18271 const node = nodes[0]; 18272 if (node.isGroup || node.ignored || node.disabled) { 18273 return node.getNext(); 18274 } 18275 return node; 18276} 18277function rawGetNext(node, loop) { 18278 const sibs = node.siblings; 18279 const l2 = sibs.length; 18280 const { index } = node; 18281 if (loop) { 18282 return sibs[(index + 1) % l2]; 18283 } else { 18284 if (index === sibs.length - 1) 18285 return null; 18286 return sibs[index + 1]; 18287 } 18288} 18289function move(fromNode, dir, { loop = false, includeDisabled = false } = {}) { 18290 const iterate = dir === "prev" ? rawGetPrev : rawGetNext; 18291 const getChildOptions = { 18292 reverse: dir === "prev" 18293 }; 18294 let meet = false;
18295 let endNode = null; 18296 function traverse2(node) { 18297 if (node === null) 18298 return; 18299 if (node === fromNode) { 18300 if (!meet) { 18301 meet = true; 18302 } else if (!fromNode.disabled && !fromNode.isGroup) { 18303 endNode = fromNode; 18304 return; 18305 } 18306 } else { 18307 if ((!node.disabled || includeDisabled) && !node.ignored && !node.isGroup) { 18308 endNode = node; 18309 return; 18310 } 18311 } 18312 if (node.isGroup) { 18313 const child = getChild(node, getChildOptions); 18314 if (child !== null) { 18315 endNode = child; 18316 } else { 18317 traverse2(iterate(node, loop)); 18318 } 18319 } else { 18320 const nextNode = iterate(node, false); 18321 if (nextNode !== null) { 18322 traverse2(nextNode); 18323 } else { 18324 const parent = rawGetParent(node); 18325 if (parent === null || parent === void 0 ? void 0 : parent.isGroup) { 18326 traverse2(iterate(parent, loop)); 18327 } else if (loop) { 18328 traverse2(iterate(node, true)); 18329 } 18330 } 18331 } 18332 } 18333 traverse2(fromNode); 18334 return endNode; 18335} 18336function rawGetPrev(node, loop) { 18337 const sibs = node.siblings; 18338 const l2 = sibs.length; 18339 const { index } = node; 18340 if (loop) { 18341 return sibs[(index - 1 + l2) % l2]; 18342 } else { 18343 if (index === 0) 18344 return null; 18345 return sibs[index - 1]; 18346 } 18347} 18348function rawGetParent(node) { 18349 return node.parent; 18350} 18351function getChild(node, options = {}) { 18352 const { reverse = false } = options; 18353 const { children } = node; 18354 if (children) { 18355 const { length } = children; 18356 const start = reverse ? length - 1 : 0; 18357 const end = reverse ? -1 : length; 18358 const delta = reverse ? -1 : 1; 18359 for (let i = start; i !== end; i += delta) { 18360 const child = children[i]; 18361 if (!child.disabled && !child.ignored) { 18362 if (child.isGroup) { 18363 const childInGroup = getChild(child, options); 18364 if (childInGroup !== null) 18365 return childInGroup; 18366 } else { 18367 return child; 18368 } 18369 } 18370 } 18371 } 18372 return null; 18373} 18374const moveMethods = { 18375 getChild() { 18376 if (this.ignored) 18377 return null; 18378 return getChild(this); 18379 }, 18380 getParent() { 18381 const { parent } = this; 18382 if (parent === null || parent === void 0 ? void 0 : parent.isGroup) { 18383 return parent.getParent(); 18384 } 18385 return parent; 18386 }, 18387 getNext(options = {}) { 18388 return move(this, "next", options); 18389 }, 18390 getPrev(options = {}) { 18391 return move(this, "prev", options); 18392 } 18393}; 18394function flatten(treeNodes, expandedKeys) { 18395 const expandedKeySet = expandedKeys ? new Set(expandedKeys) : void 0; 18396 const flattenedNodes = []; 18397 function traverse2(treeNodes2) { 18398 treeNodes2.forEach((treeNode) => { 18399 flattenedNodes.push(treeNode); 18400 if (treeNode.isLeaf || !treeNode.children || treeNode.ignored) 18401 return; 18402 if (treeNode.isGroup) { 18403 traverse2(treeNode.children); 18404 } else if ( 18405 // normal non-leaf node 18406 expandedKeySet === void 0 || expandedKeySet.has(treeNode.key) 18407 ) { 18408 traverse2(treeNode.children); 18409 } 18410 }); 18411 } 18412 traverse2(treeNodes); 18413 return flattenedNodes; 18414} 18415function contains(parent, child) { 18416 const parentKey = parent.key; 18417 while (child) { 18418 if (child.key === parentKey) 18419 return true; 18420 child = child.parent; 18421 } 18422 return false; 18423} 18424function createTreeNodes(rawNodes, treeNodeMap, levelTreeNodeMap, nodeProto, getChildren, parent = null, level = 0) { 18425 const treeNodes = []; 18426 rawNodes.forEach((rawNode, index) => { 18427 var _a2; 18428 const treeNode = Object.create(nodeProto); 18429 treeNode.rawNode = rawNode; 18430 treeNode.siblings = treeNodes; 18431 treeNode.level = level; 18432 treeNode.index = index; 18433 treeNode.isFirstChild = index === 0; 18434 treeNode.isLastChild = index + 1 === rawNodes.length; 18435 treeNode.parent = parent; 18436 if (!treeNode.ignored) { 18437 const rawChildren = getChildren(rawNode); 18438 if (Array.isArray(rawChildren)) { 18439 treeNode.children = createTreeNodes(rawChildren, treeNodeMap, levelTreeNodeMap, nodeProto, getChildren, treeNode, level + 1); 18440 } 18441 } 18442 treeNodes.push(treeNode); 18443 treeNodeMap.set(treeNode.key, treeNode); 18444 if (!levelTreeNodeMap.has(level)) 18445 levelTreeNodeMap.set(level, []); 18446 (_a2 = levelTreeNodeMap.get(level)) === null || _a2 === void 0 ? void 0 : _a2.push(treeNode); 18447 }); 18448 return treeNodes; 18449} 18450function createTreeMate(rawNodes, options = {}) { 18451 var _a2; 18452 const treeNodeMap = /* @__PURE__ */ new Map(); 18453 const levelTreeNodeMap = /* @__PURE__ */ new Map(); 18454 const { getDisabled = isDisabled, getIgnored: getIgnored2 = isIgnored, getIsGroup: getIsGroup2 = isGroup, getKey = defaultGetKey } = options; 18455 const _getChildren = (_a2 = options.getChildren) !== null && _a2 !== void 0 ? _a2 : defaultGetChildren; 18456 const getChildren = options.ignoreEmptyChildren ? (node) => { 18457 const children = _getChildren(node); 18458 if (Array.isArray(children)) { 18459 if (!children.length) 18460 return null; 18461 return children; 18462 } 18463 return children; 18464 } : _getChildren; 18465 const nodeProto = Object.assign({ 18466 get key() { 18467 return getKey(this.rawNode); 18468 }, 18469 get disabled() { 18470 return getDisabled(this.rawNode); 18471 }, 18472 get isGroup() { 18473 return getIsGroup2(this.rawNode); 18474 }, 18475 get isLeaf() { 18476 return isLeaf(this.rawNode, getChildren); 18477 }, 18478 get shallowLoaded() { 18479 return isShallowLoaded(this.rawNode, getChildren); 18480 }, 18481 get ignored() { 18482 return getIgnored2(this.rawNode); 18483 }, 18484 contains(node) { 18485 return contains(this, node); 18486 } 18487 }, moveMethods); 18488 const treeNodes = createTreeNodes(rawNodes, treeNodeMap, levelTreeNodeMap, nodeProto, getChildren); 18489 function getNode(key) {
18490 if (key === null || key === void 0) 18491 return null; 18492 const tmNode = treeNodeMap.get(key); 18493 if (tmNode && !tmNode.isGroup && !tmNode.ignored) { 18494 return tmNode; 18495 } 18496 return null; 18497 } 18498 function _getNode(key) { 18499 if (key === null || key === void 0) 18500 return null; 18501 const tmNode = treeNodeMap.get(key); 18502 if (tmNode && !tmNode.ignored) { 18503 return tmNode; 18504 } 18505 return null; 18506 } 18507 function getPrev(key, options2) { 18508 const node = _getNode(key); 18509 if (!node) 18510 return null; 18511 return node.getPrev(options2); 18512 } 18513 function getNext(key, options2) { 18514 const node = _getNode(key); 18515 if (!node) 18516 return null; 18517 return node.getNext(options2); 18518 } 18519 function getParent(key) { 18520 const node = _getNode(key); 18521 if (!node) 18522 return null; 18523 return node.getParent(); 18524 } 18525 function getChild2(key) { 18526 const node = _getNode(key); 18527 if (!node) 18528 return null; 18529 return node.getChild(); 18530 } 18531 const treemate = { 18532 treeNodes, 18533 treeNodeMap, 18534 levelTreeNodeMap, 18535 maxLevel: Math.max(...levelTreeNodeMap.keys()), 18536 getChildren, 18537 getFlattenedNodes(expandedKeys) { 18538 return flatten(treeNodes, expandedKeys); 18539 }, 18540 getNode, 18541 getPrev, 18542 getNext, 18543 getParent, 18544 getChild: getChild2, 18545 getFirstAvailableNode() { 18546 return getFirstAvailableNode(treeNodes); 18547 }, 18548 getPath(key, options2 = {}) { 18549 return getPath(key, options2, treemate); 18550 }, 18551 getCheckedKeys(checkedKeys, options2 = {}) { 18552 const { cascade = true, leafOnly = false, checkStrategy = "all", allowNotLoaded = false } = options2; 18553 return getCheckedKeys({ 18554 checkedKeys: unwrapCheckedKeys(checkedKeys), 18555 indeterminateKeys: unwrapIndeterminateKeys(checkedKeys), 18556 cascade, 18557 leafOnly, 18558 checkStrategy, 18559 allowNotLoaded 18560 }, treemate); 18561 }, 18562 check(keysToCheck, checkedKeys, options2 = {}) { 18563 const { cascade = true, leafOnly = false, checkStrategy = "all", allowNotLoaded = false } = options2; 18564 return getCheckedKeys({ 18565 checkedKeys: unwrapCheckedKeys(checkedKeys), 18566 indeterminateKeys: unwrapIndeterminateKeys(checkedKeys), 18567 keysToCheck: keysToCheck === void 0 || keysToCheck === null ? [] : toArray$1(keysToCheck), 18568 cascade, 18569 leafOnly, 18570 checkStrategy, 18571 allowNotLoaded 18572 }, treemate); 18573 }, 18574 uncheck(keysToUncheck, checkedKeys, options2 = {}) { 18575 const { cascade = true, leafOnly = false, checkStrategy = "all", allowNotLoaded = false } = options2; 18576 return getCheckedKeys({ 18577 checkedKeys: unwrapCheckedKeys(checkedKeys), 18578 indeterminateKeys: unwrapIndeterminateKeys(checkedKeys), 18579 keysToUncheck: keysToUncheck === null || keysToUncheck === void 0 ? [] : toArray$1(keysToUncheck), 18580 cascade, 18581 leafOnly, 18582 checkStrategy, 18583 allowNotLoaded 18584 }, treemate); 18585 }, 18586 getNonLeafKeys(options2 = {}) { 18587 return getNonLeafKeys(treeNodes, options2); 18588 } 18589 }; 18590 return treemate; 18591} 18592const base = { 18593 neutralBase: "#FFF", 18594 neutralInvertBase: "#000", 18595 neutralTextBase: "#000", 18596 neutralPopover: "#fff", 18597 neutralCard: "#fff", 18598 neutralModal: "#fff", 18599 neutralBody: "#fff", 18600 alpha1: "0.82", 18601 alpha2: "0.72", 18602 alpha3: "0.38", 18603 alpha4: "0.24", 18604 // disabled text, placeholder, icon 18605 alpha5: "0.18", 18606 // disabled placeholder 18607 alphaClose: "0.6", 18608 alphaDisabled: "0.5", 18609 alphaDisabledInput: "0.02", 18610 alphaPending: "0.05", 18611 alphaTablePending: "0.02", 18612 alphaPressed: "0.07", 18613 alphaAvatar: "0.2", 18614 alphaRail: "0.14", 18615 alphaProgressRail: ".08", 18616 alphaBorder: "0.12", 18617 alphaDivider: "0.06", 18618 alphaInput: "0", 18619 alphaAction: "0.02", 18620 alphaTab: "0.04", 18621 alphaScrollbar: "0.25", 18622 alphaScrollbarHover: "0.4", 18623 alphaCode: "0.05", 18624 alphaTag: "0.02", 18625 // primary 18626 primaryHover: "#36ad6a", 18627 primaryDefault: "#18a058", 18628 primaryActive: "#0c7a43", 18629 primarySuppl: "#36ad6a", 18630 // info 18631 infoHover: "#4098fc", 18632 infoDefault: "#2080f0", 18633 infoActive: "#1060c9", 18634 infoSuppl: "#4098fc", 18635 // error 18636 errorHover: "#de576d", 18637 errorDefault: "#d03050", 18638 errorActive: "#ab1f3f", 18639 errorSuppl: "#de576d", 18640 // warning 18641 warningHover: "#fcb040", 18642 warningDefault: "#f0a020", 18643 warningActive: "#c97c10", 18644 warningSuppl: "#fcb040", 18645 // success 18646 successHover: "#36ad6a", 18647 successDefault: "#18a058", 18648 successActive: "#0c7a43", 18649 successSuppl: "#36ad6a" 18650};
18651const baseBackgroundRgb = rgba(base.neutralBase); 18652const baseInvertBackgroundRgb = rgba(base.neutralInvertBase); 18653const overlayPrefix = "rgba(" + baseInvertBackgroundRgb.slice(0, 3).join(", ") + ", "; 18654function overlay(alpha) { 18655 return overlayPrefix + String(alpha) + ")"; 18656} 18657function neutral(alpha) { 18658 const overlayRgba = Array.from(baseInvertBackgroundRgb); 18659 overlayRgba[3] = Number(alpha); 18660 return composite(baseBackgroundRgb, overlayRgba); 18661} 18662const derived = Object.assign(Object.assign({ 18663 name: "common" 18664}, commonVariables$8), { 18665 baseColor: base.neutralBase, 18666 // primary color 18667 primaryColor: base.primaryDefault, 18668 primaryColorHover: base.primaryHover, 18669 primaryColorPressed: base.primaryActive, 18670 primaryColorSuppl: base.primarySuppl, 18671 // info color 18672 infoColor: base.infoDefault, 18673 infoColorHover: base.infoHover, 18674 infoColorPressed: base.infoActive, 18675 infoColorSuppl: base.infoSuppl, 18676 // success color 18677 successColor: base.successDefault, 18678 successColorHover: base.successHover, 18679 successColorPressed: base.successActive, 18680 successColorSuppl: base.successSuppl, 18681 // warning color 18682 warningColor: base.warningDefault, 18683 warningColorHover: base.warningHover, 18684 warningColorPressed: base.warningActive, 18685 warningColorSuppl: base.warningSuppl, 18686 // error color 18687 errorColor: base.errorDefault, 18688 errorColorHover: base.errorHover, 18689 errorColorPressed: base.errorActive, 18690 errorColorSuppl: base.errorSuppl, 18691 // text color 18692 textColorBase: base.neutralTextBase, 18693 textColor1: "rgb(31, 34, 37)", 18694 textColor2: "rgb(51, 54, 57)", 18695 textColor3: "rgb(118, 124, 130)", 18696 // textColor4: neutral(base.alpha4), // disabled, placeholder, icon 18697 // textColor5: neutral(base.alpha5), 18698 textColorDisabled: neutral(base.alpha4), 18699 placeholderColor: neutral(base.alpha4), 18700 placeholderColorDisabled: neutral(base.alpha5), 18701 iconColor: neutral(base.alpha4), 18702 iconColorHover: scaleColor(neutral(base.alpha4), { 18703 lightness: 0.75 18704 }), 18705 iconColorPressed: scaleColor(neutral(base.alpha4), { 18706 lightness: 0.9 18707 }), 18708 iconColorDisabled: neutral(base.alpha5), 18709 opacity1: base.alpha1, 18710 opacity2: base.alpha2, 18711 opacity3: base.alpha3, 18712 opacity4: base.alpha4, 18713 opacity5: base.alpha5, 18714 dividerColor: "rgb(239, 239, 245)", 18715 borderColor: "rgb(224, 224, 230)", 18716 // close 18717 closeIconColor: neutral(Number(base.alphaClose)), 18718 closeIconColorHover: neutral(Number(base.alphaClose)), 18719 closeIconColorPressed: neutral(Number(base.alphaClose)), 18720 closeColorHover: "rgba(0, 0, 0, .09)", 18721 closeColorPressed: "rgba(0, 0, 0, .13)", 18722 // clear 18723 clearColor: neutral(base.alpha4), 18724 clearColorHover: scaleColor(neutral(base.alpha4), { 18725 lightness: 0.75 18726 }), 18727 clearColorPressed: scaleColor(neutral(base.alpha4), { 18728 lightness: 0.9 18729 }), 18730 scrollbarColor: overlay(base.alphaScrollbar), 18731 scrollbarColorHover: overlay(base.alphaScrollbarHover), 18732 scrollbarWidth: "5px", 18733 scrollbarHeight: "5px", 18734 scrollbarBorderRadius: "5px", 18735 progressRailColor: neutral(base.alphaProgressRail), 18736 railColor: "rgb(219, 219, 223)", 18737 popoverColor: base.neutralPopover, 18738 tableColor: base.neutralCard, 18739 cardColor: base.neutralCard, 18740 modalColor: base.neutralModal, 18741 bodyColor: base.neutralBody, 18742 tagColor: "#eee", 18743 avatarColor: neutral(base.alphaAvatar), 18744 invertedColor: "rgb(0, 20, 40)", 18745 inputColor: neutral(base.alphaInput), 18746 codeColor: "rgb(244, 244, 248)", 18747 tabColor: "rgb(247, 247, 250)", 18748 actionColor: "rgb(250, 250, 252)", 18749 tableHeaderColor: "rgb(250, 250, 252)", 18750 hoverColor: "rgb(243, 243, 245)", 18751 // use color with alpha since it can be nested with header filter & sorter effect 18752 tableColorHover: "rgba(0, 0, 100, 0.03)", 18753 tableColorStriped: "rgba(0, 0, 100, 0.02)", 18754 pressedColor: "rgb(237, 237, 239)", 18755 opacityDisabled: base.alphaDisabled, 18756 inputColorDisabled: "rgb(250, 250, 252)", 18757 // secondary button color 18758 // can also be used in tertiary button & quaternary button 18759 buttonColor2: "rgba(46, 51, 56, .05)", 18760 buttonColor2Hover: "rgba(46, 51, 56, .09)", 18761 buttonColor2Pressed: "rgba(46, 51, 56, .13)", 18762 boxShadow1: "0 1px 2px -2px rgba(0, 0, 0, .08), 0 3px 6px 0 rgba(0, 0, 0, .06), 0 5px 12px 4px rgba(0, 0, 0, .04)", 18763 boxShadow2: "0 3px 6px -4px rgba(0, 0, 0, .12), 0 6px 16px 0 rgba(0, 0, 0, .08), 0 9px 28px 8px rgba(0, 0, 0, .05)", 18764 boxShadow3: "0 6px 16px -9px rgba(0, 0, 0, .08), 0 9px 28px 0 rgba(0, 0, 0, .05), 0 12px 48px 16px rgba(0, 0, 0, .03)" 18765}); 18766const commonLight = derived; 18767const commonVars$3 = { 18768 iconSizeSmall: "34px", 18769 iconSizeMedium: "40px", 18770 iconSizeLarge: "46px", 18771 iconSizeHuge: "52px" 18772}; 18773const self$j = (vars) => { 18774 const { 18775 textColorDisabled, 18776 iconColor, 18777 textColor2, 18778 fontSizeSmall, 18779 fontSizeMedium, 18780 fontSizeLarge, 18781 fontSizeHuge 18782 } = vars; 18783 return Object.assign(Object.assign({}, commonVars$3), { 18784 fontSizeSmall, 18785 fontSizeMedium, 18786 fontSizeLarge, 18787 fontSizeHuge, 18788 textColor: textColorDisabled, 18789 iconColor, 18790 extraTextColor: textColor2 18791 }); 18792}; 18793const emptyLight = { 18794 name: "Empty", 18795 common: commonLight, 18796 self: self$j 18797}; 18798const emptyLight$1 = emptyLight; 18799const style$k = cB("empty", ` 18800 display: flex; 18801 flex-direction: column; 18802 align-items: center; 18803 font-size: var(--n-font-size); 18804`, [cE("icon", ` 18805 width: var(--n-icon-size); 18806 height: var(--n-icon-size); 18807 font-size: var(--n-icon-size); 18808 line-height: var(--n-icon-size); 18809 color: var(--n-icon-color); 18810 transition: 18811 color .3s var(--n-bezier); 18812 `, [c$1("+", [cE("description", ` 18813 margin-top: 8px; 18814 `)])]), cE("description", ` 18815 transition: color .3s var(--n-bezier); 18816 color: var(--n-text-color); 18817 `), cE("extra", ` 18818 text-align: center; 18819 transition: color .3s var(--n-bezier); 18820 margin-top: 12px; 18821 color: var(--n-extra-text-color); 18822 `)]); 18823const emptyProps = Object.assign(Object.assign({}, useTheme.props), { 18824 description: String, 18825 showDescription: { 18826 type: Boolean, 18827 default: true 18828 }, 18829 showIcon: { 18830 type: Boolean, 18831 default: true 18832 }, 18833 size: { 18834 type: String, 18835 default: "medium" 18836 },
18837 renderIcon: Function 18838}); 18839const NEmpty = defineComponent({ 18840 name: "Empty", 18841 props: emptyProps, 18842 setup(props) { 18843 const { 18844 mergedClsPrefixRef, 18845 inlineThemeDisabled 18846 } = useConfig(props); 18847 const themeRef = useTheme("Empty", "-empty", style$k, emptyLight$1, props, mergedClsPrefixRef); 18848 const { 18849 localeRef 18850 } = useLocale("Empty"); 18851 const NConfigProvider2 = inject(configProviderInjectionKey, null); 18852 const mergedDescriptionRef = computed(() => { 18853 var _a2, _b, _c; 18854 return (_a2 = props.description) !== null && _a2 !== void 0 ? _a2 : (_c = (_b = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedComponentPropsRef.value) === null || _b === void 0 ? void 0 : _b.Empty) === null || _c === void 0 ? void 0 : _c.description; 18855 }); 18856 const mergedRenderIconRef = computed(() => { 18857 var _a2, _b; 18858 return ((_b = (_a2 = NConfigProvider2 === null || NConfigProvider2 === void 0 ? void 0 : NConfigProvider2.mergedComponentPropsRef.value) === null || _a2 === void 0 ? void 0 : _a2.Empty) === null || _b === void 0 ? void 0 : _b.renderIcon) || (() => h(EmptyIcon, null)); 18859 }); 18860 const cssVarsRef = computed(() => { 18861 const { 18862 size: size2 18863 } = props; 18864 const { 18865 common: { 18866 cubicBezierEaseInOut: cubicBezierEaseInOut2 18867 }, 18868 self: { 18869 [createKey("iconSize", size2)]: iconSize, 18870 [createKey("fontSize", size2)]: fontSize2, 18871 textColor, 18872 iconColor, 18873 extraTextColor 18874 } 18875 } = themeRef.value; 18876 return { 18877 "--n-icon-size": iconSize, 18878 "--n-font-size": fontSize2, 18879 "--n-bezier": cubicBezierEaseInOut2, 18880 "--n-text-color": textColor, 18881 "--n-icon-color": iconColor, 18882 "--n-extra-text-color": extraTextColor 18883 }; 18884 }); 18885 const themeClassHandle = inlineThemeDisabled ? useThemeClass("empty", computed(() => { 18886 let hash = ""; 18887 const { 18888 size: size2 18889 } = props; 18890 hash += size2[0]; 18891 return hash; 18892 }), cssVarsRef, props) : void 0; 18893 return { 18894 mergedClsPrefix: mergedClsPrefixRef, 18895 mergedRenderIcon: mergedRenderIconRef, 18896 localizedDescription: computed(() => { 18897 return mergedDescriptionRef.value || localeRef.value.description; 18898 }), 18899 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef, 18900 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 18901 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 18902 }; 18903 }, 18904 render() { 18905 const { 18906 $slots, 18907 mergedClsPrefix, 18908 onRender 18909 } = this; 18910 onRender === null || onRender === void 0 ? void 0 : onRender(); 18911 return h("div", { 18912 class: [`${mergedClsPrefix}-empty`, this.themeClass], 18913 style: this.cssVars 18914 }, this.showIcon ? h("div", { 18915 class: `${mergedClsPrefix}-empty__icon` 18916 }, $slots.icon ? $slots.icon() : h(NBaseIcon, { 18917 clsPrefix: mergedClsPrefix 18918 }, { 18919 default: this.mergedRenderIcon 18920 })) : null, this.showDescription ? h("div", { 18921 class: `${mergedClsPrefix}-empty__description` 18922 }, $slots.default ? $slots.default() : this.localizedDescription) : null, $slots.extra ? h("div", { 18923 class: `${mergedClsPrefix}-empty__extra` 18924 }, $slots.extra()) : null); 18925 } 18926}); 18927const self$i = (vars) => { 18928 const { 18929 scrollbarColor, 18930 scrollbarColorHover 18931 } = vars; 18932 return { 18933 color: scrollbarColor, 18934 colorHover: scrollbarColorHover 18935 }; 18936}; 18937const scrollbarLight = { 18938 name: "Scrollbar", 18939 common: commonLight, 18940 self: self$i 18941}; 18942const scrollbarLight$1 = scrollbarLight; 18943const { 18944 cubicBezierEaseInOut: cubicBezierEaseInOut$3 18945} = commonVariables$8; 18946function fadeInTransition({ 18947 name = "fade-in", 18948 enterDuration = "0.2s", 18949 leaveDuration = "0.2s", 18950 enterCubicBezier = cubicBezierEaseInOut$3, 18951 leaveCubicBezier = cubicBezierEaseInOut$3 18952} = {}) { 18953 return [c$1(`&.${name}-transition-enter-active`, { 18954 transition: `all ${enterDuration} ${enterCubicBezier}!important` 18955 }), c$1(`&.${name}-transition-leave-active`, { 18956 transition: `all ${leaveDuration} ${leaveCubicBezier}!important` 18957 }), c$1(`&.${name}-transition-enter-from, &.${name}-transition-leave-to`, { 18958 opacity: 0 18959 }), c$1(`&.${name}-transition-leave-from, &.${name}-transition-enter-to`, { 18960 opacity: 1 18961 })]; 18962} 18963const style$j = cB("scrollbar", ` 18964 overflow: hidden; 18965 position: relative; 18966 z-index: auto; 18967 height: 100%; 18968 width: 100%; 18969`, [c$1(">", [cB("scrollbar-container", ` 18970 width: 100%; 18971 overflow: scroll; 18972 height: 100%; 18973 min-height: inherit; 18974 max-height: inherit; 18975 scrollbar-width: none; 18976 `, [c$1("&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb", ` 18977 width: 0; 18978 height: 0; 18979 display: none; 18980 `), c$1(">", [cB("scrollbar-content", ` 18981 box-sizing: border-box; 18982 min-width: 100%; 18983 `)])])]), c$1(">, +", [cB("scrollbar-rail", ` 18984 position: absolute; 18985 pointer-events: none; 18986 user-select: none; 18987 -webkit-user-select: none; 18988 `, [cM("horizontal", ` 18989 left: 2px; 18990 right: 2px; 18991 bottom: 4px; 18992 height: var(--n-scrollbar-height); 18993 `, [c$1(">", [cE("scrollbar", ` 18994 height: var(--n-scrollbar-height); 18995 border-radius: var(--n-scrollbar-border-radius); 18996 right: 0; 18997 `)])]), cM("vertical", ` 18998 right: 4px; 18999 top: 2px; 19000 bottom: 2px; 19001 width: var(--n-scrollbar-width); 19002 `, [c$1(">", [cE("scrollbar", ` 19003 width: var(--n-scrollbar-width); 19004 border-radius: var(--n-scrollbar-border-radius); 19005 bottom: 0; 19006 `)])]), cM("disabled", [c$1(">", [cE("scrollbar", "pointer-events: none;")])]), c$1(">", [cE("scrollbar", ` 19007 z-index: 1; 19008 position: absolute; 19009 cursor: pointer; 19010 pointer-events: all; 19011 background-color: var(--n-scrollbar-color); 19012 transition: background-color .2s var(--n-scrollbar-bezier); 19013 `, [fadeInTransition(), c$1("&:hover", "background-color: var(--n-scrollbar-color-hover);")])])])])]); 19014const scrollbarProps = Object.assign(Object.assign({}, useTheme.props), { 19015 size: { 19016 type: Number, 19017 default: 5 19018 }, 19019 duration: { 19020 type: Number, 19021 default: 0 19022 }, 19023 scrollable: { 19024 type: Boolean, 19025 default: true 19026 }, 19027 xScrollable: Boolean, 19028 trigger: { 19029 type: String, 19030 default: "hover" 19031 }, 19032 useUnifiedContainer: Boolean,
19033 triggerDisplayManually: Boolean, 19034 // If container is set, resize observer won't not attached 19035 container: Function, 19036 content: Function, 19037 containerClass: String, 19038 containerStyle: [String, Object], 19039 contentClass: [String, Array], 19040 contentStyle: [String, Object], 19041 horizontalRailStyle: [String, Object], 19042 verticalRailStyle: [String, Object], 19043 onScroll: Function, 19044 onWheel: Function, 19045 onResize: Function, 19046 internalOnUpdateScrollLeft: Function, 19047 internalHoistYRail: Boolean 19048}); 19049const Scrollbar = defineComponent({ 19050 name: "Scrollbar", 19051 props: scrollbarProps, 19052 inheritAttrs: false, 19053 setup(props) { 19054 const { 19055 mergedClsPrefixRef, 19056 inlineThemeDisabled, 19057 mergedRtlRef 19058 } = useConfig(props); 19059 const rtlEnabledRef = useRtl("Scrollbar", mergedRtlRef, mergedClsPrefixRef); 19060 const wrapperRef = ref(null); 19061 const containerRef = ref(null); 19062 const contentRef = ref(null); 19063 const yRailRef = ref(null); 19064 const xRailRef = ref(null); 19065 const contentHeightRef = ref(null); 19066 const contentWidthRef = ref(null); 19067 const containerHeightRef = ref(null); 19068 const containerWidthRef = ref(null); 19069 const yRailSizeRef = ref(null); 19070 const xRailSizeRef = ref(null); 19071 const containerScrollTopRef = ref(0); 19072 const containerScrollLeftRef = ref(0); 19073 const isShowXBarRef = ref(false); 19074 const isShowYBarRef = ref(false); 19075 let yBarPressed = false; 19076 let xBarPressed = false; 19077 let xBarVanishTimerId; 19078 let yBarVanishTimerId; 19079 let memoYTop = 0; 19080 let memoXLeft = 0; 19081 let memoMouseX = 0; 19082 let memoMouseY = 0; 19083 const isIos2 = useIsIos(); 19084 const yBarSizeRef = computed(() => { 19085 const { 19086 value: containerHeight 19087 } = containerHeightRef; 19088 const { 19089 value: contentHeight 19090 } = contentHeightRef; 19091 const { 19092 value: yRailSize 19093 } = yRailSizeRef; 19094 if (containerHeight === null || contentHeight === null || yRailSize === null) { 19095 return 0; 19096 } else { 19097 return Math.min(containerHeight, yRailSize * containerHeight / contentHeight + props.size * 1.5); 19098 } 19099 }); 19100 const yBarSizePxRef = computed(() => { 19101 return `${yBarSizeRef.value}px`; 19102 }); 19103 const xBarSizeRef = computed(() => { 19104 const { 19105 value: containerWidth 19106 } = containerWidthRef; 19107 const { 19108 value: contentWidth 19109 } = contentWidthRef; 19110 const { 19111 value: xRailSize 19112 } = xRailSizeRef; 19113 if (containerWidth === null || contentWidth === null || xRailSize === null) { 19114 return 0; 19115 } else { 19116 return xRailSize * containerWidth / contentWidth + props.size * 1.5; 19117 } 19118 }); 19119 const xBarSizePxRef = computed(() => { 19120 return `${xBarSizeRef.value}px`; 19121 }); 19122 const yBarTopRef = computed(() => { 19123 const { 19124 value: containerHeight 19125 } = containerHeightRef; 19126 const { 19127 value: containerScrollTop 19128 } = containerScrollTopRef; 19129 const { 19130 value: contentHeight 19131 } = contentHeightRef; 19132 const { 19133 value: yRailSize 19134 } = yRailSizeRef; 19135 if (containerHeight === null || contentHeight === null || yRailSize === null) { 19136 return 0; 19137 } else { 19138 const heightDiff = contentHeight - containerHeight; 19139 if (!heightDiff) 19140 return 0; 19141 return containerScrollTop / heightDiff * (yRailSize - yBarSizeRef.value); 19142 } 19143 }); 19144 const yBarTopPxRef = computed(() => { 19145 return `${yBarTopRef.value}px`; 19146 }); 19147 const xBarLeftRef = computed(() => { 19148 const { 19149 value: containerWidth 19150 } = containerWidthRef; 19151 const { 19152 value: containerScrollLeft 19153 } = containerScrollLeftRef; 19154 const { 19155 value: contentWidth 19156 } = contentWidthRef; 19157 const { 19158 value: xRailSize 19159 } = xRailSizeRef; 19160 if (containerWidth === null || contentWidth === null || xRailSize === null) { 19161 return 0; 19162 } else { 19163 const widthDiff = contentWidth - containerWidth; 19164 if (!widthDiff) 19165 return 0; 19166 return containerScrollLeft / widthDiff * (xRailSize - xBarSizeRef.value); 19167 } 19168 }); 19169 const xBarLeftPxRef = computed(() => { 19170 return `${xBarLeftRef.value}px`; 19171 }); 19172 const needYBarRef = computed(() => { 19173 const { 19174 value: containerHeight 19175 } = containerHeightRef; 19176 const { 19177 value: contentHeight 19178 } = contentHeightRef; 19179 return containerHeight !== null && contentHeight !== null && contentHeight > containerHeight; 19180 }); 19181 const needXBarRef = computed(() => { 19182 const { 19183 value: containerWidth 19184 } = containerWidthRef; 19185 const { 19186 value: contentWidth 19187 } = contentWidthRef; 19188 return containerWidth !== null && contentWidth !== null && contentWidth > containerWidth; 19189 }); 19190 const mergedShowXBarRef = computed(() => { 19191 const { 19192 trigger: trigger2 19193 } = props; 19194 return trigger2 === "none" || isShowXBarRef.value; 19195 }); 19196 const mergedShowYBarRef = computed(() => { 19197 const { 19198 trigger: trigger2 19199 } = props; 19200 return trigger2 === "none" || isShowYBarRef.value; 19201 }); 19202 const mergedContainerRef = computed(() => { 19203 const { 19204 container 19205 } = props; 19206 if (container) 19207 return container(); 19208 return containerRef.value; 19209 }); 19210 const mergedContentRef = computed(() => { 19211 const { 19212 content 19213 } = props; 19214 if (content) 19215 return content(); 19216 return contentRef.value; 19217 }); 19218 const activateState = useReactivated(() => { 19219 if (!props.container) { 19220 scrollTo({ 19221 top: containerScrollTopRef.value, 19222 left: containerScrollLeftRef.value 19223 }); 19224 } 19225 }); 19226 const handleContentResize = () => { 19227 if (activateState.isDeactivated) 19228 return; 19229 sync(); 19230 }; 19231 const handleContainerResize = (e) => { 19232 if (activateState.isDeactivated) 19233 return; 19234 const { 19235 onResize 19236 } = props; 19237 if (onResize) 19238 onResize(e); 19239 sync(); 19240 }; 19241 const scrollTo = (options, y) => { 19242 if (!props.scrollable) 19243 return; 19244 if (typeof options === "number") { 19245 scrollToPosition(options, y !== null && y !== void 0 ? y : 0, 0, false, "auto"); 19246 return; 19247 } 19248 const { 19249 left, 19250 top, 19251 index, 19252 elSize, 19253 position, 19254 behavior, 19255 el, 19256 debounce = true 19257 } = options; 19258 if (left !== void 0 || top !== void 0) { 19259 scrollToPosition(left !== null && left !== void 0 ? left : 0, top !== null && top !== void 0 ? top : 0, 0, false, behavior); 19260 } 19261 if (el !== void 0) { 19262 scrollToPosition(0, el.offsetTop, el.offsetHeight, debounce, behavior); 19263 } else if (index !== void 0 && elSize !== void 0) { 19264 scrollToPosition(0, index * elSize, elSize, debounce, behavior); 19265 } else if (position === "bottom") { 19266 scrollToPosition(0, Number.MAX_SAFE_INTEGER, 0, false, behavior); 19267 } else if (position === "top") { 19268 scrollToPosition(0, 0, 0, false, behavior); 19269 } 19270 }; 19271 const scrollBy = (options, y) => { 19272 if (!props.scrollable) 19273 return; 19274 const { 19275 value: container 19276 } = mergedContainerRef; 19277 if (!container) 19278 return; 19279 if (typeof options === "object") { 19280 container.scrollBy(options); 19281 } else { 19282 container.scrollBy(options, y || 0); 19283 } 19284 }; 19285 function scrollToPosition(left, top, elSize, debounce, behavior) { 19286 const { 19287 value: container 19288 } = mergedContainerRef; 19289 if (!container) 19290 return; 19291 if (debounce) { 19292 const { 19293 scrollTop, 19294 offsetHeight 19295 } = container; 19296 if (top > scrollTop) { 19297 if (top + elSize <= scrollTop + offsetHeight) 19298 ; 19299 else { 19300 container.scrollTo({ 19301 left, 19302 top: top + elSize - offsetHeight, 19303 behavior 19304 }); 19305 } 19306 return; 19307 } 19308 } 19309 container.scrollTo({ 19310 left, 19311 top, 19312 behavior 19313 }); 19314 } 19315 function handleMouseEnterWrapper() { 19316 showXBar(); 19317 showYBar(); 19318 sync(); 19319 } 19320 function handleMouseLeaveWrapper() { 19321 hideBar(); 19322 } 19323 function hideBar() { 19324 hideYBar(); 19325 hideXBar(); 19326 } 19327 function hideYBar() { 19328 if (yBarVanishTimerId !== void 0) { 19329 window.clearTimeout(yBarVanishTimerId); 19330 } 19331 yBarVanishTimerId = window.setTimeout(() => { 19332 isShowYBarRef.value = false;
19333 }, props.duration); 19334 } 19335 function hideXBar() { 19336 if (xBarVanishTimerId !== void 0) { 19337 window.clearTimeout(xBarVanishTimerId); 19338 } 19339 xBarVanishTimerId = window.setTimeout(() => { 19340 isShowXBarRef.value = false; 19341 }, props.duration); 19342 } 19343 function showXBar() { 19344 if (xBarVanishTimerId !== void 0) { 19345 window.clearTimeout(xBarVanishTimerId); 19346 } 19347 isShowXBarRef.value = true; 19348 } 19349 function showYBar() { 19350 if (yBarVanishTimerId !== void 0) { 19351 window.clearTimeout(yBarVanishTimerId); 19352 } 19353 isShowYBarRef.value = true; 19354 } 19355 function handleScroll(e) { 19356 const { 19357 onScroll 19358 } = props; 19359 if (onScroll) 19360 onScroll(e); 19361 syncScrollState(); 19362 } 19363 function syncScrollState() { 19364 const { 19365 value: container 19366 } = mergedContainerRef; 19367 if (container) { 19368 containerScrollTopRef.value = container.scrollTop; 19369 containerScrollLeftRef.value = container.scrollLeft * ((rtlEnabledRef === null || rtlEnabledRef === void 0 ? void 0 : rtlEnabledRef.value) ? -1 : 1); 19370 } 19371 } 19372 function syncPositionState() { 19373 const { 19374 value: content 19375 } = mergedContentRef; 19376 if (content) { 19377 contentHeightRef.value = content.offsetHeight; 19378 contentWidthRef.value = content.offsetWidth; 19379 } 19380 const { 19381 value: container 19382 } = mergedContainerRef; 19383 if (container) { 19384 containerHeightRef.value = container.offsetHeight; 19385 containerWidthRef.value = container.offsetWidth; 19386 } 19387 const { 19388 value: xRailEl 19389 } = xRailRef; 19390 const { 19391 value: yRailEl 19392 } = yRailRef; 19393 if (xRailEl) { 19394 xRailSizeRef.value = xRailEl.offsetWidth; 19395 } 19396 if (yRailEl) { 19397 yRailSizeRef.value = yRailEl.offsetHeight; 19398 } 19399 } 19400 function syncUnifiedContainer() { 19401 const { 19402 value: container 19403 } = mergedContainerRef; 19404 if (container) { 19405 containerScrollTopRef.value = container.scrollTop; 19406 containerScrollLeftRef.value = container.scrollLeft * ((rtlEnabledRef === null || rtlEnabledRef === void 0 ? void 0 : rtlEnabledRef.value) ? -1 : 1); 19407 containerHeightRef.value = container.offsetHeight; 19408 containerWidthRef.value = container.offsetWidth; 19409 contentHeightRef.value = container.scrollHeight; 19410 contentWidthRef.value = container.scrollWidth; 19411 } 19412 const { 19413 value: xRailEl 19414 } = xRailRef; 19415 const { 19416 value: yRailEl 19417 } = yRailRef; 19418 if (xRailEl) { 19419 xRailSizeRef.value = xRailEl.offsetWidth; 19420 } 19421 if (yRailEl) { 19422 yRailSizeRef.value = yRailEl.offsetHeight; 19423 } 19424 } 19425 function sync() { 19426 if (!props.scrollable) 19427 return; 19428 if (props.useUnifiedContainer) { 19429 syncUnifiedContainer(); 19430 } else { 19431 syncPositionState(); 19432 syncScrollState(); 19433 } 19434 } 19435 function isMouseUpAway(e) { 19436 var _a2; 19437 return !((_a2 = wrapperRef.value) === null || _a2 === void 0 ? void 0 : _a2.contains(getPreciseEventTarget(e))); 19438 } 19439 function handleXScrollMouseDown(e) { 19440 e.preventDefault(); 19441 e.stopPropagation(); 19442 xBarPressed = true; 19443 on("mousemove", window, handleXScrollMouseMove, true); 19444 on("mouseup", window, handleXScrollMouseUp, true); 19445 memoXLeft = containerScrollLeftRef.value; 19446 memoMouseX = (rtlEnabledRef === null || rtlEnabledRef === void 0 ? void 0 : rtlEnabledRef.value) ? window.innerWidth - e.clientX : e.clientX; 19447 } 19448 function handleXScrollMouseMove(e) { 19449 if (!xBarPressed) 19450 return; 19451 if (xBarVanishTimerId !== void 0) { 19452 window.clearTimeout(xBarVanishTimerId); 19453 } 19454 if (yBarVanishTimerId !== void 0) { 19455 window.clearTimeout(yBarVanishTimerId); 19456 } 19457 const { 19458 value: containerWidth 19459 } = containerWidthRef; 19460 const { 19461 value: contentWidth 19462 } = contentWidthRef; 19463 const { 19464 value: xBarSize 19465 } = xBarSizeRef; 19466 if (containerWidth === null || contentWidth === null) 19467 return; 19468 const dX = (rtlEnabledRef === null || rtlEnabledRef === void 0 ? void 0 : rtlEnabledRef.value) ? window.innerWidth - e.clientX - memoMouseX : e.clientX - memoMouseX; 19469 const dScrollLeft = dX * (contentWidth - containerWidth) / (containerWidth - xBarSize); 19470 const toScrollLeftUpperBound = contentWidth - containerWidth; 19471 let toScrollLeft = memoXLeft + dScrollLeft; 19472 toScrollLeft = Math.min(toScrollLeftUpperBound, toScrollLeft); 19473 toScrollLeft = Math.max(toScrollLeft, 0); 19474 const { 19475 value: container 19476 } = mergedContainerRef; 19477 if (container) { 19478 container.scrollLeft = toScrollLeft * ((rtlEnabledRef === null || rtlEnabledRef === void 0 ? void 0 : rtlEnabledRef.value) ? -1 : 1); 19479 const { 19480 internalOnUpdateScrollLeft 19481 } = props; 19482 if (internalOnUpdateScrollLeft) 19483 internalOnUpdateScrollLeft(toScrollLeft); 19484 } 19485 } 19486 function handleXScrollMouseUp(e) { 19487 e.preventDefault(); 19488 e.stopPropagation(); 19489 off("mousemove", window, handleXScrollMouseMove, true); 19490 off("mouseup", window, handleXScrollMouseUp, true); 19491 xBarPressed = false;
19492 sync(); 19493 if (isMouseUpAway(e)) { 19494 hideBar(); 19495 } 19496 } 19497 function handleYScrollMouseDown(e) { 19498 e.preventDefault(); 19499 e.stopPropagation(); 19500 yBarPressed = true; 19501 on("mousemove", window, handleYScrollMouseMove, true); 19502 on("mouseup", window, handleYScrollMouseUp, true); 19503 memoYTop = containerScrollTopRef.value; 19504 memoMouseY = e.clientY; 19505 } 19506 function handleYScrollMouseMove(e) { 19507 if (!yBarPressed) 19508 return; 19509 if (xBarVanishTimerId !== void 0) { 19510 window.clearTimeout(xBarVanishTimerId); 19511 } 19512 if (yBarVanishTimerId !== void 0) { 19513 window.clearTimeout(yBarVanishTimerId); 19514 } 19515 const { 19516 value: containerHeight 19517 } = containerHeightRef; 19518 const { 19519 value: contentHeight 19520 } = contentHeightRef; 19521 const { 19522 value: yBarSize 19523 } = yBarSizeRef; 19524 if (containerHeight === null || contentHeight === null) 19525 return; 19526 const dY = e.clientY - memoMouseY; 19527 const dScrollTop = dY * (contentHeight - containerHeight) / (containerHeight - yBarSize); 19528 const toScrollTopUpperBound = contentHeight - containerHeight; 19529 let toScrollTop = memoYTop + dScrollTop; 19530 toScrollTop = Math.min(toScrollTopUpperBound, toScrollTop); 19531 toScrollTop = Math.max(toScrollTop, 0); 19532 const { 19533 value: container 19534 } = mergedContainerRef; 19535 if (container) { 19536 container.scrollTop = toScrollTop; 19537 } 19538 } 19539 function handleYScrollMouseUp(e) { 19540 e.preventDefault(); 19541 e.stopPropagation(); 19542 off("mousemove", window, handleYScrollMouseMove, true); 19543 off("mouseup", window, handleYScrollMouseUp, true); 19544 yBarPressed = false; 19545 sync(); 19546 if (isMouseUpAway(e)) { 19547 hideBar(); 19548 } 19549 } 19550 watchEffect(() => { 19551 const { 19552 value: needXBar 19553 } = needXBarRef; 19554 const { 19555 value: needYBar 19556 } = needYBarRef; 19557 const { 19558 value: mergedClsPrefix 19559 } = mergedClsPrefixRef; 19560 const { 19561 value: xRailEl 19562 } = xRailRef; 19563 const { 19564 value: yRailEl 19565 } = yRailRef; 19566 if (xRailEl) { 19567 if (!needXBar) { 19568 xRailEl.classList.add(`${mergedClsPrefix}-scrollbar-rail--disabled`); 19569 } else { 19570 xRailEl.classList.remove(`${mergedClsPrefix}-scrollbar-rail--disabled`); 19571 } 19572 } 19573 if (yRailEl) { 19574 if (!needYBar) { 19575 yRailEl.classList.add(`${mergedClsPrefix}-scrollbar-rail--disabled`); 19576 } else { 19577 yRailEl.classList.remove(`${mergedClsPrefix}-scrollbar-rail--disabled`); 19578 } 19579 } 19580 }); 19581 onMounted(() => { 19582 if (props.container) 19583 return; 19584 sync(); 19585 }); 19586 onBeforeUnmount(() => { 19587 if (xBarVanishTimerId !== void 0) { 19588 window.clearTimeout(xBarVanishTimerId); 19589 } 19590 if (yBarVanishTimerId !== void 0) { 19591 window.clearTimeout(yBarVanishTimerId); 19592 } 19593 off("mousemove", window, handleYScrollMouseMove, true); 19594 off("mouseup", window, handleYScrollMouseUp, true); 19595 }); 19596 const themeRef = useTheme("Scrollbar", "-scrollbar", style$j, scrollbarLight$1, props, mergedClsPrefixRef); 19597 const cssVarsRef = computed(() => { 19598 const { 19599 common: { 19600 cubicBezierEaseInOut: cubicBezierEaseInOut2, 19601 scrollbarBorderRadius, 19602 scrollbarHeight, 19603 scrollbarWidth 19604 }, 19605 self: { 19606 color, 19607 colorHover 19608 } 19609 } = themeRef.value; 19610 return { 19611 "--n-scrollbar-bezier": cubicBezierEaseInOut2, 19612 "--n-scrollbar-color": color, 19613 "--n-scrollbar-color-hover": colorHover, 19614 "--n-scrollbar-border-radius": scrollbarBorderRadius, 19615 "--n-scrollbar-width": scrollbarWidth, 19616 "--n-scrollbar-height": scrollbarHeight 19617 }; 19618 }); 19619 const themeClassHandle = inlineThemeDisabled ? useThemeClass("scrollbar", void 0, cssVarsRef, props) : void 0; 19620 const exposedMethods = { 19621 scrollTo, 19622 scrollBy, 19623 sync, 19624 syncUnifiedContainer, 19625 handleMouseEnterWrapper, 19626 handleMouseLeaveWrapper 19627 }; 19628 return Object.assign(Object.assign({}, exposedMethods), { 19629 mergedClsPrefix: mergedClsPrefixRef, 19630 rtlEnabled: rtlEnabledRef, 19631 containerScrollTop: containerScrollTopRef, 19632 wrapperRef, 19633 containerRef, 19634 contentRef, 19635 yRailRef, 19636 xRailRef, 19637 needYBar: needYBarRef, 19638 needXBar: needXBarRef, 19639 yBarSizePx: yBarSizePxRef, 19640 xBarSizePx: xBarSizePxRef, 19641 yBarTopPx: yBarTopPxRef, 19642 xBarLeftPx: xBarLeftPxRef, 19643 isShowXBar: mergedShowXBarRef, 19644 isShowYBar: mergedShowYBarRef, 19645 isIos: isIos2, 19646 handleScroll, 19647 handleContentResize, 19648 handleContainerResize, 19649 handleYScrollMouseDown, 19650 handleXScrollMouseDown, 19651 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef,
19652 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 19653 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 19654 }); 19655 }, 19656 render() { 19657 var _a2; 19658 const { 19659 $slots, 19660 mergedClsPrefix, 19661 triggerDisplayManually, 19662 rtlEnabled, 19663 internalHoistYRail 19664 } = this; 19665 if (!this.scrollable) 19666 return (_a2 = $slots.default) === null || _a2 === void 0 ? void 0 : _a2.call($slots); 19667 const triggerIsNone = this.trigger === "none"; 19668 const createYRail = (className, style2) => { 19669 return h("div", { 19670 ref: "yRailRef", 19671 class: [`${mergedClsPrefix}-scrollbar-rail`, `${mergedClsPrefix}-scrollbar-rail--vertical`, className], 19672 "data-scrollbar-rail": true, 19673 style: [style2 || "", this.verticalRailStyle], 19674 "aria-hidden": true 19675 }, h( 19676 // eslint-disable-next-line @typescript-eslint/no-unsafe-argument 19677 triggerIsNone ? Wrapper : Transition, 19678 triggerIsNone ? null : { 19679 name: "fade-in-transition" 19680 }, 19681 { 19682 default: () => this.needYBar && this.isShowYBar && !this.isIos ? h("div", { 19683 class: `${mergedClsPrefix}-scrollbar-rail__scrollbar`, 19684 style: { 19685 height: this.yBarSizePx, 19686 top: this.yBarTopPx 19687 }, 19688 onMousedown: this.handleYScrollMouseDown 19689 }) : null 19690 } 19691 )); 19692 }; 19693 const createChildren = () => { 19694 var _a3, _b; 19695 (_a3 = this.onRender) === null || _a3 === void 0 ? void 0 : _a3.call(this); 19696 return h("div", mergeProps(this.$attrs, { 19697 role: "none", 19698 ref: "wrapperRef", 19699 class: [`${mergedClsPrefix}-scrollbar`, this.themeClass, rtlEnabled && `${mergedClsPrefix}-scrollbar--rtl`], 19700 style: this.cssVars, 19701 onMouseenter: triggerDisplayManually ? void 0 : this.handleMouseEnterWrapper, 19702 onMouseleave: triggerDisplayManually ? void 0 : this.handleMouseLeaveWrapper 19703 }), [this.container ? (_b = $slots.default) === null || _b === void 0 ? void 0 : _b.call($slots) : h("div", { 19704 role: "none", 19705 ref: "containerRef", 19706 class: [`${mergedClsPrefix}-scrollbar-container`, this.containerClass], 19707 style: this.containerStyle, 19708 onScroll: this.handleScroll, 19709 onWheel: this.onWheel 19710 }, h(VResizeObserver, { 19711 onResize: this.handleContentResize 19712 }, { 19713 default: () => h("div", { 19714 ref: "contentRef", 19715 role: "none", 19716 style: [{ 19717 width: this.xScrollable ? "fit-content" : null 19718 }, this.contentStyle], 19719 class: [`${mergedClsPrefix}-scrollbar-content`, this.contentClass] 19720 }, $slots) 19721 })), internalHoistYRail ? null : createYRail(void 0, void 0), this.xScrollable && h("div", { 19722 ref: "xRailRef", 19723 class: [`${mergedClsPrefix}-scrollbar-rail`, `${mergedClsPrefix}-scrollbar-rail--horizontal`], 19724 style: this.horizontalRailStyle, 19725 "data-scrollbar-rail": true, 19726 "aria-hidden": true 19727 }, h( 19728 // eslint-disable-next-line @typescript-eslint/no-unsafe-argument 19729 triggerIsNone ? Wrapper : Transition, 19730 triggerIsNone ? null : { 19731 name: "fade-in-transition" 19732 }, 19733 { 19734 default: () => this.needXBar && this.isShowXBar && !this.isIos ? h("div", { 19735 class: `${mergedClsPrefix}-scrollbar-rail__scrollbar`, 19736 style: { 19737 width: this.xBarSizePx, 19738 right: rtlEnabled ? this.xBarLeftPx : void 0, 19739 left: rtlEnabled ? void 0 : this.xBarLeftPx 19740 }, 19741 onMousedown: this.handleXScrollMouseDown 19742 }) : null 19743 } 19744 ))]); 19745 }; 19746 const scrollbarNode = this.container ? createChildren() : h(VResizeObserver, { 19747 onResize: this.handleContainerResize 19748 }, { 19749 default: createChildren 19750 }); 19751 if (internalHoistYRail) { 19752 return h(Fragment, null, scrollbarNode, createYRail(this.themeClass, this.cssVars)); 19753 } else { 19754 return scrollbarNode; 19755 } 19756 } 19757}); 19758const NScrollbar = Scrollbar; 19759const XScrollbar = Scrollbar; 19760const commonVariables$7 = { 19761 height: "calc(var(--n-option-height) * 7.6)", 19762 paddingSmall: "4px 0", 19763 paddingMedium: "4px 0", 19764 paddingLarge: "4px 0", 19765 paddingHuge: "4px 0", 19766 optionPaddingSmall: "0 12px", 19767 optionPaddingMedium: "0 12px", 19768 optionPaddingLarge: "0 12px", 19769 optionPaddingHuge: "0 12px", 19770 loadingSize: "18px" 19771}; 19772const self$h = (vars) => { 19773 const { 19774 borderRadius, 19775 popoverColor, 19776 textColor3, 19777 dividerColor, 19778 textColor2, 19779 primaryColorPressed, 19780 textColorDisabled, 19781 primaryColor, 19782 opacityDisabled, 19783 hoverColor, 19784 fontSizeSmall, 19785 fontSizeMedium, 19786 fontSizeLarge, 19787 fontSizeHuge, 19788 heightSmall, 19789 heightMedium, 19790 heightLarge, 19791 heightHuge 19792 } = vars; 19793 return Object.assign(Object.assign({}, commonVariables$7), { 19794 optionFontSizeSmall: fontSizeSmall, 19795 optionFontSizeMedium: fontSizeMedium, 19796 optionFontSizeLarge: fontSizeLarge, 19797 optionFontSizeHuge: fontSizeHuge, 19798 optionHeightSmall: heightSmall,
19799 optionHeightMedium: heightMedium, 19800 optionHeightLarge: heightLarge, 19801 optionHeightHuge: heightHuge, 19802 borderRadius, 19803 color: popoverColor, 19804 groupHeaderTextColor: textColor3, 19805 actionDividerColor: dividerColor, 19806 optionTextColor: textColor2, 19807 optionTextColorPressed: primaryColorPressed, 19808 optionTextColorDisabled: textColorDisabled, 19809 optionTextColorActive: primaryColor, 19810 optionOpacityDisabled: opacityDisabled, 19811 optionCheckColor: primaryColor, 19812 optionColorPending: hoverColor, 19813 optionColorActive: "rgba(0, 0, 0, 0)", 19814 optionColorActivePending: hoverColor, 19815 actionTextColor: textColor2, 19816 loadingColor: primaryColor 19817 }); 19818}; 19819const internalSelectMenuLight = createTheme({ 19820 name: "InternalSelectMenu", 19821 common: commonLight, 19822 peers: { 19823 Scrollbar: scrollbarLight$1, 19824 Empty: emptyLight$1 19825 }, 19826 self: self$h 19827}); 19828const internalSelectMenuLight$1 = internalSelectMenuLight; 19829function renderCheckMark(show, clsPrefix) { 19830 return h(Transition, { 19831 name: "fade-in-scale-up-transition" 19832 }, { 19833 default: () => show ? h(NBaseIcon, { 19834 clsPrefix, 19835 class: `${clsPrefix}-base-select-option__check` 19836 }, { 19837 default: () => h(FinishedIcon) 19838 }) : null 19839 }); 19840} 19841const NSelectOption = defineComponent({ 19842 name: "NBaseSelectOption", 19843 props: { 19844 clsPrefix: { 19845 type: String, 19846 required: true 19847 }, 19848 tmNode: { 19849 type: Object, 19850 required: true 19851 } 19852 }, 19853 setup(props) { 19854 const { 19855 valueRef, 19856 pendingTmNodeRef, 19857 multipleRef, 19858 valueSetRef, 19859 renderLabelRef, 19860 renderOptionRef, 19861 labelFieldRef, 19862 valueFieldRef, 19863 showCheckmarkRef, 19864 nodePropsRef, 19865 handleOptionClick, 19866 handleOptionMouseEnter 19867 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion 19868 } = inject(internalSelectionMenuInjectionKey); 19869 const isPendingRef = useMemo(() => { 19870 const { 19871 value: pendingTmNode 19872 } = pendingTmNodeRef; 19873 if (!pendingTmNode) 19874 return false; 19875 return props.tmNode.key === pendingTmNode.key; 19876 }); 19877 function handleClick2(e) { 19878 const { 19879 tmNode 19880 } = props; 19881 if (tmNode.disabled) 19882 return; 19883 handleOptionClick(e, tmNode); 19884 } 19885 function handleMouseEnter(e) { 19886 const { 19887 tmNode 19888 } = props; 19889 if (tmNode.disabled) 19890 return; 19891 handleOptionMouseEnter(e, tmNode); 19892 } 19893 function handleMouseMove(e) { 19894 const { 19895 tmNode 19896 } = props; 19897 const { 19898 value: isPending 19899 } = isPendingRef; 19900 if (tmNode.disabled || isPending) 19901 return; 19902 handleOptionMouseEnter(e, tmNode); 19903 } 19904 return { 19905 multiple: multipleRef, 19906 isGrouped: useMemo(() => { 19907 const { 19908 tmNode 19909 } = props; 19910 const { 19911 parent 19912 } = tmNode; 19913 return parent && parent.rawNode.type === "group"; 19914 }), 19915 showCheckmark: showCheckmarkRef, 19916 nodeProps: nodePropsRef, 19917 isPending: isPendingRef, 19918 isSelected: useMemo(() => { 19919 const { 19920 value 19921 } = valueRef; 19922 const { 19923 value: multiple 19924 } = multipleRef; 19925 if (value === null) 19926 return false; 19927 const optionValue = props.tmNode.rawNode[valueFieldRef.value]; 19928 if (multiple) { 19929 const { 19930 value: valueSet 19931 } = valueSetRef; 19932 return valueSet.has(optionValue); 19933 } else { 19934 return value === optionValue; 19935 } 19936 }), 19937 labelField: labelFieldRef, 19938 renderLabel: renderLabelRef, 19939 renderOption: renderOptionRef, 19940 handleMouseMove, 19941 handleMouseEnter, 19942 handleClick: handleClick2 19943 }; 19944 }, 19945 render() { 19946 const { 19947 clsPrefix, 19948 tmNode: { 19949 rawNode 19950 }, 19951 isSelected, 19952 isPending, 19953 isGrouped, 19954 showCheckmark, 19955 nodeProps, 19956 renderOption, 19957 renderLabel, 19958 handleClick: handleClick2, 19959 handleMouseEnter, 19960 handleMouseMove 19961 } = this; 19962 const checkmark = renderCheckMark(isSelected, clsPrefix); 19963 const children = renderLabel ? [renderLabel(rawNode, isSelected), showCheckmark && checkmark] : [render$4(rawNode[this.labelField], rawNode, isSelected), showCheckmark && checkmark]; 19964 const attrs = nodeProps === null || nodeProps === void 0 ? void 0 : nodeProps(rawNode); 19965 const node = h("div", Object.assign({}, attrs, { 19966 class: [`${clsPrefix}-base-select-option`, rawNode.class, attrs === null || attrs === void 0 ? void 0 : attrs.class, { 19967 [`${clsPrefix}-base-select-option--disabled`]: rawNode.disabled, 19968 [`${clsPrefix}-base-select-option--selected`]: isSelected, 19969 [`${clsPrefix}-base-select-option--grouped`]: isGrouped, 19970 [`${clsPrefix}-base-select-option--pending`]: isPending, 19971 [`${clsPrefix}-base-select-option--show-checkmark`]: showCheckmark 19972 }], 19973 style: [(attrs === null || attrs === void 0 ? void 0 : attrs.style) || "", rawNode.style || ""], 19974 onClick: mergeEventHandlers([handleClick2, attrs === null || attrs === void 0 ? void 0 : attrs.onClick]), 19975 onMouseenter: mergeEventHandlers([handleMouseEnter, attrs === null || attrs === void 0 ? void 0 : attrs.onMouseenter]), 19976 onMousemove: mergeEventHandlers([handleMouseMove, attrs === null || attrs === void 0 ? void 0 : attrs.onMousemove]) 19977 }), h("div", { 19978 class: `${clsPrefix}-base-select-option__content` 19979 }, children)); 19980 return rawNode.render ? rawNode.render({ 19981 node, 19982 option: rawNode, 19983 selected: isSelected 19984 }) : renderOption ? renderOption({ 19985 node, 19986 option: rawNode, 19987 selected: isSelected 19988 }) : node; 19989 } 19990}); 19991const NSelectGroupHeader = defineComponent({ 19992 name: "NBaseSelectGroupHeader", 19993 props: { 19994 clsPrefix: { 19995 type: String, 19996 required: true 19997 }, 19998 tmNode: { 19999 type: Object, 20000 required: true 20001 } 20002 }, 20003 setup() { 20004 const { 20005 renderLabelRef, 20006 renderOptionRef, 20007 labelFieldRef, 20008 nodePropsRef 20009 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion 20010 } = inject(internalSelectionMenuInjectionKey); 20011 return { 20012 labelField: labelFieldRef,
20013 nodeProps: nodePropsRef, 20014 renderLabel: renderLabelRef, 20015 renderOption: renderOptionRef 20016 }; 20017 }, 20018 render() { 20019 const { 20020 clsPrefix, 20021 renderLabel, 20022 renderOption, 20023 nodeProps, 20024 tmNode: { 20025 rawNode 20026 } 20027 } = this; 20028 const attrs = nodeProps === null || nodeProps === void 0 ? void 0 : nodeProps(rawNode); 20029 const children = renderLabel ? renderLabel(rawNode, false) : render$4(rawNode[this.labelField], rawNode, false); 20030 const node = h("div", Object.assign({}, attrs, { 20031 class: [`${clsPrefix}-base-select-group-header`, attrs === null || attrs === void 0 ? void 0 : attrs.class] 20032 }), children); 20033 return rawNode.render ? rawNode.render({ 20034 node, 20035 option: rawNode 20036 }) : renderOption ? renderOption({ 20037 node, 20038 option: rawNode, 20039 selected: false 20040 }) : node; 20041 } 20042}); 20043const { 20044 cubicBezierEaseIn: cubicBezierEaseIn$1, 20045 cubicBezierEaseOut: cubicBezierEaseOut$1 20046} = commonVariables$8; 20047function fadeInScaleUpTransition({ 20048 transformOrigin = "inherit", 20049 duration: duration2 = ".2s", 20050 enterScale = ".9", 20051 originalTransform = "", 20052 originalTransition = "" 20053} = {}) { 20054 return [c$1("&.fade-in-scale-up-transition-leave-active", { 20055 transformOrigin, 20056 transition: `opacity ${duration2} ${cubicBezierEaseIn$1}, transform ${duration2} ${cubicBezierEaseIn$1} ${originalTransition && "," + originalTransition}` 20057 }), c$1("&.fade-in-scale-up-transition-enter-active", { 20058 transformOrigin, 20059 transition: `opacity ${duration2} ${cubicBezierEaseOut$1}, transform ${duration2} ${cubicBezierEaseOut$1} ${originalTransition && "," + originalTransition}` 20060 }), c$1("&.fade-in-scale-up-transition-enter-from, &.fade-in-scale-up-transition-leave-to", { 20061 opacity: 0, 20062 transform: `${originalTransform} scale(${enterScale})` 20063 }), c$1("&.fade-in-scale-up-transition-leave-from, &.fade-in-scale-up-transition-enter-to", { 20064 opacity: 1, 20065 transform: `${originalTransform} scale(1)` 20066 })]; 20067} 20068const style$i = cB("base-select-menu", ` 20069 line-height: 1.5; 20070 outline: none; 20071 z-index: 0; 20072 position: relative; 20073 border-radius: var(--n-border-radius); 20074 transition: 20075 background-color .3s var(--n-bezier), 20076 box-shadow .3s var(--n-bezier); 20077 background-color: var(--n-color); 20078`, [cB("scrollbar", ` 20079 max-height: var(--n-height); 20080 `), cB("virtual-list", ` 20081 max-height: var(--n-height); 20082 `), cB("base-select-option", ` 20083 min-height: var(--n-option-height); 20084 font-size: var(--n-option-font-size); 20085 display: flex; 20086 align-items: center; 20087 `, [cE("content", ` 20088 z-index: 1; 20089 white-space: nowrap; 20090 text-overflow: ellipsis; 20091 overflow: hidden; 20092 `)]), cB("base-select-group-header", ` 20093 min-height: var(--n-option-height); 20094 font-size: .93em; 20095 display: flex; 20096 align-items: center; 20097 `), cB("base-select-menu-option-wrapper", ` 20098 position: relative; 20099 width: 100%; 20100 `), cE("loading, empty", ` 20101 display: flex; 20102 padding: 12px 32px; 20103 flex: 1; 20104 justify-content: center; 20105 `), cE("loading", ` 20106 color: var(--n-loading-color); 20107 font-size: var(--n-loading-size); 20108 `), cE("header", ` 20109 padding: 8px var(--n-option-padding-left); 20110 font-size: var(--n-option-font-size); 20111 transition: 20112 color .3s var(--n-bezier), 20113 border-color .3s var(--n-bezier); 20114 border-bottom: 1px solid var(--n-action-divider-color); 20115 color: var(--n-action-text-color); 20116 `), cE("action", ` 20117 padding: 8px var(--n-option-padding-left); 20118 font-size: var(--n-option-font-size); 20119 transition: 20120 color .3s var(--n-bezier), 20121 border-color .3s var(--n-bezier); 20122 border-top: 1px solid var(--n-action-divider-color); 20123 color: var(--n-action-text-color); 20124 `), cB("base-select-group-header", ` 20125 position: relative; 20126 cursor: default; 20127 padding: var(--n-option-padding); 20128 color: var(--n-group-header-text-color); 20129 `), cB("base-select-option", ` 20130 cursor: pointer; 20131 position: relative; 20132 padding: var(--n-option-padding); 20133 transition: 20134 color .3s var(--n-bezier), 20135 opacity .3s var(--n-bezier); 20136 box-sizing: border-box; 20137 color: var(--n-option-text-color); 20138 opacity: 1; 20139 `, [cM("show-checkmark", ` 20140 padding-right: calc(var(--n-option-padding-right) + 20px); 20141 `), c$1("&::before", ` 20142 content: ""; 20143 position: absolute; 20144 left: 4px; 20145 right: 4px; 20146 top: 0; 20147 bottom: 0; 20148 border-radius: var(--n-border-radius); 20149 transition: background-color .3s var(--n-bezier); 20150 `), c$1("&:active", ` 20151 color: var(--n-option-text-color-pressed); 20152 `), cM("grouped", ` 20153 padding-left: calc(var(--n-option-padding-left) * 1.5); 20154 `), cM("pending", [c$1("&::before", ` 20155 background-color: var(--n-option-color-pending); 20156 `)]), cM("selected", ` 20157 color: var(--n-option-text-color-active); 20158 `, [c$1("&::before", ` 20159 background-color: var(--n-option-color-active); 20160 `), cM("pending", [c$1("&::before", ` 20161 background-color: var(--n-option-color-active-pending); 20162 `)])]), cM("disabled", `
20163 cursor: not-allowed; 20164 `, [cNotM("selected", ` 20165 color: var(--n-option-text-color-disabled); 20166 `), cM("selected", ` 20167 opacity: var(--n-option-opacity-disabled); 20168 `)]), cE("check", ` 20169 font-size: 16px; 20170 position: absolute; 20171 right: calc(var(--n-option-padding-right) - 4px); 20172 top: calc(50% - 7px); 20173 color: var(--n-option-check-color); 20174 transition: color .3s var(--n-bezier); 20175 `, [fadeInScaleUpTransition({ 20176 enterScale: "0.5" 20177})])])]); 20178const NInternalSelectMenu = defineComponent({ 20179 name: "InternalSelectMenu", 20180 props: Object.assign(Object.assign({}, useTheme.props), { 20181 clsPrefix: { 20182 type: String, 20183 required: true 20184 }, 20185 scrollable: { 20186 type: Boolean, 20187 default: true 20188 }, 20189 treeMate: { 20190 type: Object, 20191 required: true 20192 }, 20193 multiple: Boolean, 20194 size: { 20195 type: String, 20196 default: "medium" 20197 }, 20198 value: { 20199 type: [String, Number, Array], 20200 default: null 20201 }, 20202 autoPending: Boolean, 20203 virtualScroll: { 20204 type: Boolean, 20205 default: true 20206 }, 20207 // show is used to toggle pending state initialization 20208 show: { 20209 type: Boolean, 20210 default: true 20211 }, 20212 labelField: { 20213 type: String, 20214 default: "label" 20215 }, 20216 valueField: { 20217 type: String, 20218 default: "value" 20219 }, 20220 loading: Boolean, 20221 focusable: Boolean, 20222 renderLabel: Function, 20223 renderOption: Function, 20224 nodeProps: Function, 20225 showCheckmark: { 20226 type: Boolean, 20227 default: true 20228 }, 20229 onMousedown: Function, 20230 onScroll: Function, 20231 onFocus: Function, 20232 onBlur: Function, 20233 onKeyup: Function, 20234 onKeydown: Function, 20235 onTabOut: Function, 20236 onMouseenter: Function, 20237 onMouseleave: Function, 20238 onResize: Function, 20239 resetMenuOnOptionsChange: { 20240 type: Boolean, 20241 default: true 20242 }, 20243 inlineThemeDisabled: Boolean, 20244 // deprecated 20245 onToggle: Function 20246 }), 20247 setup(props) { 20248 const { 20249 mergedClsPrefixRef, 20250 mergedRtlRef 20251 } = useConfig(props); 20252 const rtlEnabledRef = useRtl("InternalSelectMenu", mergedRtlRef, mergedClsPrefixRef); 20253 const themeRef = useTheme("InternalSelectMenu", "-internal-select-menu", style$i, internalSelectMenuLight$1, props, toRef(props, "clsPrefix")); 20254 const selfRef = ref(null); 20255 const virtualListRef = ref(null); 20256 const scrollbarRef = ref(null); 20257 const flattenedNodesRef = computed(() => props.treeMate.getFlattenedNodes()); 20258 const fIndexGetterRef = computed(() => createIndexGetter(flattenedNodesRef.value)); 20259 const pendingNodeRef = ref(null); 20260 function initPendingNode() { 20261 const { 20262 treeMate 20263 } = props; 20264 let defaultPendingNode = null; 20265 const { 20266 value 20267 } = props; 20268 if (value === null) { 20269 defaultPendingNode = treeMate.getFirstAvailableNode(); 20270 } else { 20271 if (props.multiple) { 20272 defaultPendingNode = treeMate.getNode((value || [])[(value || []).length - 1]); 20273 } else { 20274 defaultPendingNode = treeMate.getNode(value); 20275 } 20276 if (!defaultPendingNode || defaultPendingNode.disabled) { 20277 defaultPendingNode = treeMate.getFirstAvailableNode(); 20278 } 20279 } 20280 if (defaultPendingNode) { 20281 setPendingTmNode(defaultPendingNode); 20282 } else { 20283 setPendingTmNode(null); 20284 } 20285 } 20286 function clearPendingNodeIfInvalid() { 20287 const { 20288 value: pendingNode 20289 } = pendingNodeRef; 20290 if (pendingNode && !props.treeMate.getNode(pendingNode.key)) { 20291 pendingNodeRef.value = null; 20292 } 20293 } 20294 let initPendingNodeWatchStopHandle; 20295 watch(() => props.show, (show) => { 20296 if (show) { 20297 initPendingNodeWatchStopHandle = watch(() => props.treeMate, () => { 20298 if (props.resetMenuOnOptionsChange) { 20299 if (props.autoPending) { 20300 initPendingNode(); 20301 } else { 20302 clearPendingNodeIfInvalid(); 20303 } 20304 void nextTick(scrollToPendingNode); 20305 } else { 20306 clearPendingNodeIfInvalid(); 20307 } 20308 }, { 20309 immediate: true 20310 }); 20311 } else { 20312 initPendingNodeWatchStopHandle === null || initPendingNodeWatchStopHandle === void 0 ? void 0 : initPendingNodeWatchStopHandle(); 20313 } 20314 }, {
20315 immediate: true 20316 }); 20317 onBeforeUnmount(() => { 20318 initPendingNodeWatchStopHandle === null || initPendingNodeWatchStopHandle === void 0 ? void 0 : initPendingNodeWatchStopHandle(); 20319 }); 20320 const itemSizeRef = computed(() => { 20321 return depx(themeRef.value.self[createKey("optionHeight", props.size)]); 20322 }); 20323 const paddingRef = computed(() => { 20324 return getMargin(themeRef.value.self[createKey("padding", props.size)]); 20325 }); 20326 const valueSetRef = computed(() => { 20327 if (props.multiple && Array.isArray(props.value)) { 20328 return new Set(props.value); 20329 } 20330 return /* @__PURE__ */ new Set(); 20331 }); 20332 const emptyRef = computed(() => { 20333 const tmNodes = flattenedNodesRef.value; 20334 return tmNodes && tmNodes.length === 0; 20335 }); 20336 function doToggle(tmNode) { 20337 const { 20338 onToggle 20339 } = props; 20340 if (onToggle) 20341 onToggle(tmNode); 20342 } 20343 function doScroll(e) { 20344 const { 20345 onScroll 20346 } = props; 20347 if (onScroll) 20348 onScroll(e); 20349 } 20350 function handleVirtualListScroll(e) { 20351 var _a2; 20352 (_a2 = scrollbarRef.value) === null || _a2 === void 0 ? void 0 : _a2.sync(); 20353 doScroll(e); 20354 } 20355 function handleVirtualListResize() { 20356 var _a2; 20357 (_a2 = scrollbarRef.value) === null || _a2 === void 0 ? void 0 : _a2.sync(); 20358 } 20359 function getPendingTmNode() { 20360 const { 20361 value: pendingTmNode 20362 } = pendingNodeRef; 20363 if (pendingTmNode) 20364 return pendingTmNode; 20365 return null; 20366 } 20367 function handleOptionMouseEnter(e, tmNode) { 20368 if (tmNode.disabled) 20369 return; 20370 setPendingTmNode(tmNode, false); 20371 } 20372 function handleOptionClick(e, tmNode) { 20373 if (tmNode.disabled) 20374 return; 20375 doToggle(tmNode); 20376 } 20377 function handleKeyUp(e) { 20378 var _a2; 20379 if (happensIn(e, "action")) 20380 return; 20381 (_a2 = props.onKeyup) === null || _a2 === void 0 ? void 0 : _a2.call(props, e); 20382 } 20383 function handleKeyDown(e) { 20384 var _a2; 20385 if (happensIn(e, "action")) 20386 return; 20387 (_a2 = props.onKeydown) === null || _a2 === void 0 ? void 0 : _a2.call(props, e); 20388 } 20389 function handleMouseDown(e) { 20390 var _a2; 20391 (_a2 = props.onMousedown) === null || _a2 === void 0 ? void 0 : _a2.call(props, e); 20392 if (props.focusable) 20393 return; 20394 e.preventDefault(); 20395 } 20396 function next() { 20397 const { 20398 value: pendingTmNode 20399 } = pendingNodeRef; 20400 if (pendingTmNode) { 20401 setPendingTmNode(pendingTmNode.getNext({ 20402 loop: true 20403 }), true); 20404 } 20405 } 20406 function prev() { 20407 const { 20408 value: pendingTmNode 20409 } = pendingNodeRef; 20410 if (pendingTmNode) { 20411 setPendingTmNode(pendingTmNode.getPrev({ 20412 loop: true 20413 }), true); 20414 } 20415 } 20416 function setPendingTmNode(tmNode, doScroll2 = false) { 20417 pendingNodeRef.value = tmNode; 20418 if (doScroll2) 20419 scrollToPendingNode(); 20420 } 20421 function scrollToPendingNode() { 20422 var _a2, _b; 20423 const tmNode = pendingNodeRef.value; 20424 if (!tmNode) 20425 return; 20426 const fIndex = fIndexGetterRef.value(tmNode.key); 20427 if (fIndex === null) 20428 return; 20429 if (props.virtualScroll) { 20430 (_a2 = virtualListRef.value) === null || _a2 === void 0 ? void 0 : _a2.scrollTo({ 20431 index: fIndex 20432 }); 20433 } else { 20434 (_b = scrollbarRef.value) === null || _b === void 0 ? void 0 : _b.scrollTo({ 20435 index: fIndex, 20436 elSize: itemSizeRef.value 20437 }); 20438 } 20439 } 20440 function handleFocusin(e) { 20441 var _a2, _b; 20442 if ((_a2 = selfRef.value) === null || _a2 === void 0 ? void 0 : _a2.contains(e.target)) { 20443 (_b = props.onFocus) === null || _b === void 0 ? void 0 : _b.call(props, e); 20444 } 20445 } 20446 function handleFocusout(e) { 20447 var _a2, _b; 20448 if (!((_a2 = selfRef.value) === null || _a2 === void 0 ? void 0 : _a2.contains(e.relatedTarget))) { 20449 (_b = props.onBlur) === null || _b === void 0 ? void 0 : _b.call(props, e); 20450 } 20451 } 20452 provide(internalSelectionMenuInjectionKey, { 20453 handleOptionMouseEnter, 20454 handleOptionClick, 20455 valueSetRef, 20456 pendingTmNodeRef: pendingNodeRef, 20457 nodePropsRef: toRef(props, "nodeProps"), 20458 showCheckmarkRef: toRef(props, "showCheckmark"), 20459 multipleRef: toRef(props, "multiple"), 20460 valueRef: toRef(props, "value"), 20461 renderLabelRef: toRef(props, "renderLabel"), 20462 renderOptionRef: toRef(props, "renderOption"), 20463 labelFieldRef: toRef(props, "labelField"), 20464 valueFieldRef: toRef(props, "valueField") 20465 }); 20466 provide(internalSelectionMenuBodyInjectionKey, selfRef); 20467 onMounted(() => { 20468 const { 20469 value 20470 } = scrollbarRef; 20471 if (value) 20472 value.sync(); 20473 }); 20474 const cssVarsRef = computed(() => { 20475 const { 20476 size: size2 20477 } = props; 20478 const { 20479 common: { 20480 cubicBezierEaseInOut: cubicBezierEaseInOut2 20481 }, 20482 self: { 20483 height, 20484 borderRadius, 20485 color, 20486 groupHeaderTextColor,
20487 actionDividerColor, 20488 optionTextColorPressed, 20489 optionTextColor, 20490 optionTextColorDisabled, 20491 optionTextColorActive, 20492 optionOpacityDisabled, 20493 optionCheckColor, 20494 actionTextColor, 20495 optionColorPending, 20496 optionColorActive, 20497 loadingColor, 20498 loadingSize, 20499 optionColorActivePending, 20500 [createKey("optionFontSize", size2)]: fontSize2, 20501 [createKey("optionHeight", size2)]: optionHeight, 20502 [createKey("optionPadding", size2)]: optionPadding 20503 } 20504 } = themeRef.value; 20505 return { 20506 "--n-height": height, 20507 "--n-action-divider-color": actionDividerColor, 20508 "--n-action-text-color": actionTextColor, 20509 "--n-bezier": cubicBezierEaseInOut2, 20510 "--n-border-radius": borderRadius, 20511 "--n-color": color, 20512 "--n-option-font-size": fontSize2, 20513 "--n-group-header-text-color": groupHeaderTextColor, 20514 "--n-option-check-color": optionCheckColor, 20515 "--n-option-color-pending": optionColorPending, 20516 "--n-option-color-active": optionColorActive, 20517 "--n-option-color-active-pending": optionColorActivePending, 20518 "--n-option-height": optionHeight, 20519 "--n-option-opacity-disabled": optionOpacityDisabled, 20520 "--n-option-text-color": optionTextColor, 20521 "--n-option-text-color-active": optionTextColorActive, 20522 "--n-option-text-color-disabled": optionTextColorDisabled, 20523 "--n-option-text-color-pressed": optionTextColorPressed, 20524 "--n-option-padding": optionPadding, 20525 "--n-option-padding-left": getMargin(optionPadding, "left"), 20526 "--n-option-padding-right": getMargin(optionPadding, "right"), 20527 "--n-loading-color": loadingColor, 20528 "--n-loading-size": loadingSize 20529 }; 20530 }); 20531 const { 20532 inlineThemeDisabled 20533 } = props; 20534 const themeClassHandle = inlineThemeDisabled ? useThemeClass("internal-select-menu", computed(() => props.size[0]), cssVarsRef, props) : void 0; 20535 const exposedProps = { 20536 selfRef, 20537 next, 20538 prev, 20539 getPendingTmNode 20540 }; 20541 useOnResize(selfRef, props.onResize); 20542 return Object.assign({ 20543 mergedTheme: themeRef, 20544 mergedClsPrefix: mergedClsPrefixRef, 20545 rtlEnabled: rtlEnabledRef, 20546 virtualListRef, 20547 scrollbarRef, 20548 itemSize: itemSizeRef, 20549 padding: paddingRef, 20550 flattenedNodes: flattenedNodesRef, 20551 empty: emptyRef, 20552 virtualListContainer() { 20553 const { 20554 value 20555 } = virtualListRef; 20556 return value === null || value === void 0 ? void 0 : value.listElRef; 20557 }, 20558 virtualListContent() { 20559 const { 20560 value 20561 } = virtualListRef; 20562 return value === null || value === void 0 ? void 0 : value.itemsElRef; 20563 }, 20564 doScroll, 20565 handleFocusin, 20566 handleFocusout, 20567 handleKeyUp, 20568 handleKeyDown, 20569 handleMouseDown, 20570 handleVirtualListResize, 20571 handleVirtualListScroll, 20572 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef, 20573 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 20574 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 20575 }, exposedProps); 20576 }, 20577 render() { 20578 const { 20579 $slots, 20580 virtualScroll, 20581 clsPrefix, 20582 mergedTheme, 20583 themeClass, 20584 onRender 20585 } = this; 20586 onRender === null || onRender === void 0 ? void 0 : onRender(); 20587 return h("div", { 20588 ref: "selfRef", 20589 tabindex: this.focusable ? 0 : -1, 20590 class: [`${clsPrefix}-base-select-menu`, this.rtlEnabled && `${clsPrefix}-base-select-menu--rtl`, themeClass, this.multiple && `${clsPrefix}-base-select-menu--multiple`], 20591 style: this.cssVars, 20592 onFocusin: this.handleFocusin, 20593 onFocusout: this.handleFocusout, 20594 onKeyup: this.handleKeyUp, 20595 onKeydown: this.handleKeyDown, 20596 onMousedown: this.handleMouseDown, 20597 onMouseenter: this.onMouseenter, 20598 onMouseleave: this.onMouseleave 20599 }, resolveWrappedSlot($slots.header, (children) => children && h("div", { 20600 class: `${clsPrefix}-base-select-menu__header`, 20601 "data-header": true, 20602 key: "header" 20603 }, children)), this.loading ? h("div", { 20604 class: `${clsPrefix}-base-select-menu__loading` 20605 }, h(NBaseLoading, { 20606 clsPrefix, 20607 strokeWidth: 20 20608 })) : !this.empty ? h(NScrollbar, { 20609 ref: "scrollbarRef", 20610 theme: mergedTheme.peers.Scrollbar, 20611 themeOverrides: mergedTheme.peerOverrides.Scrollbar, 20612 scrollable: this.scrollable, 20613 container: virtualScroll ? this.virtualListContainer : void 0, 20614 content: virtualScroll ? this.virtualListContent : void 0, 20615 onScroll: virtualScroll ? void 0 : this.doScroll 20616 }, {
20617 default: () => { 20618 return virtualScroll ? h(VVirtualList, { 20619 ref: "virtualListRef", 20620 class: `${clsPrefix}-virtual-list`, 20621 items: this.flattenedNodes, 20622 itemSize: this.itemSize, 20623 showScrollbar: false, 20624 paddingTop: this.padding.top, 20625 paddingBottom: this.padding.bottom, 20626 onResize: this.handleVirtualListResize, 20627 onScroll: this.handleVirtualListScroll, 20628 itemResizable: true 20629 }, { 20630 default: ({ 20631 item: tmNode 20632 }) => { 20633 return tmNode.isGroup ? h(NSelectGroupHeader, { 20634 key: tmNode.key, 20635 clsPrefix, 20636 tmNode 20637 }) : tmNode.ignored ? null : h(NSelectOption, { 20638 clsPrefix, 20639 key: tmNode.key, 20640 tmNode 20641 }); 20642 } 20643 }) : h("div", { 20644 class: `${clsPrefix}-base-select-menu-option-wrapper`, 20645 style: { 20646 paddingTop: this.padding.top, 20647 paddingBottom: this.padding.bottom 20648 } 20649 }, this.flattenedNodes.map((tmNode) => tmNode.isGroup ? h(NSelectGroupHeader, { 20650 key: tmNode.key, 20651 clsPrefix, 20652 tmNode 20653 }) : h(NSelectOption, { 20654 clsPrefix, 20655 key: tmNode.key, 20656 tmNode 20657 }))); 20658 } 20659 }) : h("div", { 20660 class: `${clsPrefix}-base-select-menu__empty`, 20661 "data-empty": true 20662 }, resolveSlot($slots.empty, () => [h(NEmpty, { 20663 theme: mergedTheme.peers.Empty, 20664 themeOverrides: mergedTheme.peerOverrides.Empty 20665 })])), resolveWrappedSlot($slots.action, (children) => children && [h("div", { 20666 class: `${clsPrefix}-base-select-menu__action`, 20667 "data-action": true, 20668 key: "action" 20669 }, children), h(FocusDetector, { 20670 onFocus: this.onTabOut, 20671 key: "focus-detector" 20672 })])); 20673 } 20674}); 20675const style$h = cB("base-wave", ` 20676 position: absolute; 20677 left: 0; 20678 right: 0; 20679 top: 0; 20680 bottom: 0; 20681 border-radius: inherit; 20682`); 20683const NBaseWave = defineComponent({ 20684 name: "BaseWave", 20685 props: { 20686 clsPrefix: { 20687 type: String, 20688 required: true 20689 } 20690 }, 20691 setup(props) { 20692 useStyle("-base-wave", style$h, toRef(props, "clsPrefix")); 20693 const selfRef = ref(null); 20694 const activeRef = ref(false); 20695 let animationTimerId = null; 20696 onBeforeUnmount(() => { 20697 if (animationTimerId !== null) { 20698 window.clearTimeout(animationTimerId); 20699 } 20700 }); 20701 return { 20702 active: activeRef, 20703 selfRef, 20704 play() { 20705 if (animationTimerId !== null) { 20706 window.clearTimeout(animationTimerId); 20707 activeRef.value = false; 20708 animationTimerId = null; 20709 } 20710 void nextTick(() => { 20711 var _a2; 20712 void ((_a2 = selfRef.value) === null || _a2 === void 0 ? void 0 : _a2.offsetHeight); 20713 activeRef.value = true; 20714 animationTimerId = window.setTimeout(() => { 20715 activeRef.value = false; 20716 animationTimerId = null; 20717 }, 1e3); 20718 }); 20719 } 20720 }; 20721 }, 20722 render() { 20723 const { 20724 clsPrefix 20725 } = this; 20726 return h("div", { 20727 ref: "selfRef", 20728 "aria-hidden": true, 20729 class: [`${clsPrefix}-base-wave`, this.active && `${clsPrefix}-base-wave--active`] 20730 }); 20731 } 20732}); 20733const commonVariables$6 = { 20734 space: "6px", 20735 spaceArrow: "10px", 20736 arrowOffset: "10px", 20737 arrowOffsetVertical: "10px", 20738 arrowHeight: "6px", 20739 padding: "8px 14px" 20740}; 20741const self$g = (vars) => { 20742 const { 20743 boxShadow2, 20744 popoverColor, 20745 textColor2, 20746 borderRadius, 20747 fontSize: fontSize2, 20748 dividerColor 20749 } = vars; 20750 return Object.assign(Object.assign({}, commonVariables$6), { 20751 fontSize: fontSize2, 20752 borderRadius, 20753 color: popoverColor, 20754 dividerColor, 20755 textColor: textColor2, 20756 boxShadow: boxShadow2 20757 }); 20758}; 20759const popoverLight = { 20760 name: "Popover", 20761 common: commonLight, 20762 self: self$g 20763}; 20764const popoverLight$1 = popoverLight; 20765const oppositePlacement = { 20766 top: "bottom", 20767 bottom: "top", 20768 left: "right", 20769 right: "left" 20770}; 20771const arrowSize = "var(--n-arrow-height) * 1.414"; 20772const style$g = c$1([cB("popover", ` 20773 transition: 20774 box-shadow .3s var(--n-bezier), 20775 background-color .3s var(--n-bezier), 20776 color .3s var(--n-bezier); 20777 position: relative; 20778 font-size: var(--n-font-size); 20779 color: var(--n-text-color);
20780 box-shadow: var(--n-box-shadow); 20781 word-break: break-word; 20782 `, [c$1(">", [cB("scrollbar", ` 20783 height: inherit; 20784 max-height: inherit; 20785 `)]), cNotM("raw", ` 20786 background-color: var(--n-color); 20787 border-radius: var(--n-border-radius); 20788 `, [cNotM("scrollable", [cNotM("show-header-or-footer", "padding: var(--n-padding);")])]), cE("header", ` 20789 padding: var(--n-padding); 20790 border-bottom: 1px solid var(--n-divider-color); 20791 transition: border-color .3s var(--n-bezier); 20792 `), cE("footer", ` 20793 padding: var(--n-padding); 20794 border-top: 1px solid var(--n-divider-color); 20795 transition: border-color .3s var(--n-bezier); 20796 `), cM("scrollable, show-header-or-footer", [cE("content", ` 20797 padding: var(--n-padding); 20798 `)])]), cB("popover-shared", ` 20799 transform-origin: inherit; 20800 `, [ 20801 cB("popover-arrow-wrapper", ` 20802 position: absolute; 20803 overflow: hidden; 20804 pointer-events: none; 20805 `, [cB("popover-arrow", ` 20806 transition: background-color .3s var(--n-bezier); 20807 position: absolute; 20808 display: block; 20809 width: calc(${arrowSize}); 20810 height: calc(${arrowSize}); 20811 box-shadow: 0 0 8px 0 rgba(0, 0, 0, .12); 20812 transform: rotate(45deg); 20813 background-color: var(--n-color); 20814 pointer-events: all; 20815 `)]), 20816 // body transition 20817 c$1("&.popover-transition-enter-from, &.popover-transition-leave-to", ` 20818 opacity: 0; 20819 transform: scale(.85); 20820 `), 20821 c$1("&.popover-transition-enter-to, &.popover-transition-leave-from", ` 20822 transform: scale(1); 20823 opacity: 1; 20824 `), 20825 c$1("&.popover-transition-enter-active", ` 20826 transition: 20827 box-shadow .3s var(--n-bezier), 20828 background-color .3s var(--n-bezier), 20829 color .3s var(--n-bezier), 20830 opacity .15s var(--n-bezier-ease-out), 20831 transform .15s var(--n-bezier-ease-out); 20832 `), 20833 c$1("&.popover-transition-leave-active", ` 20834 transition: 20835 box-shadow .3s var(--n-bezier), 20836 background-color .3s var(--n-bezier), 20837 color .3s var(--n-bezier), 20838 opacity .15s var(--n-bezier-ease-in), 20839 transform .15s var(--n-bezier-ease-in); 20840 `) 20841]), placementStyle("top-start", ` 20842 top: calc(${arrowSize} / -2); 20843 left: calc(${getArrowOffset("top-start")} - var(--v-offset-left)); 20844 `), placementStyle("top", ` 20845 top: calc(${arrowSize} / -2); 20846 transform: translateX(calc(${arrowSize} / -2)) rotate(45deg); 20847 left: 50%; 20848 `), placementStyle("top-end", ` 20849 top: calc(${arrowSize} / -2); 20850 right: calc(${getArrowOffset("top-end")} + var(--v-offset-left)); 20851 `), placementStyle("bottom-start", ` 20852 bottom: calc(${arrowSize} / -2); 20853 left: calc(${getArrowOffset("bottom-start")} - var(--v-offset-left)); 20854 `), placementStyle("bottom", ` 20855 bottom: calc(${arrowSize} / -2); 20856 transform: translateX(calc(${arrowSize} / -2)) rotate(45deg); 20857 left: 50%; 20858 `), placementStyle("bottom-end", ` 20859 bottom: calc(${arrowSize} / -2); 20860 right: calc(${getArrowOffset("bottom-end")} + var(--v-offset-left)); 20861 `), placementStyle("left-start", ` 20862 left: calc(${arrowSize} / -2); 20863 top: calc(${getArrowOffset("left-start")} - var(--v-offset-top)); 20864 `), placementStyle("left", ` 20865 left: calc(${arrowSize} / -2); 20866 transform: translateY(calc(${arrowSize} / -2)) rotate(45deg); 20867 top: 50%; 20868 `), placementStyle("left-end", ` 20869 left: calc(${arrowSize} / -2); 20870 bottom: calc(${getArrowOffset("left-end")} + var(--v-offset-top)); 20871 `), placementStyle("right-start", ` 20872 right: calc(${arrowSize} / -2); 20873 top: calc(${getArrowOffset("right-start")} - var(--v-offset-top)); 20874 `), placementStyle("right", ` 20875 right: calc(${arrowSize} / -2); 20876 transform: translateY(calc(${arrowSize} / -2)) rotate(45deg); 20877 top: 50%; 20878 `), placementStyle("right-end", ` 20879 right: calc(${arrowSize} / -2); 20880 bottom: calc(${getArrowOffset("right-end")} + var(--v-offset-top)); 20881 `), ...map({ 20882 top: ["right-start", "left-start"], 20883 right: ["top-end", "bottom-end"], 20884 bottom: ["right-end", "left-end"], 20885 left: ["top-start", "bottom-start"] 20886}, (placements, direction) => { 20887 const isVertical = ["right", "left"].includes(direction); 20888 const sizeType = isVertical ? "width" : "height"; 20889 return placements.map((placement) => { 20890 const isReverse = placement.split("-")[1] === "end"; 20891 const targetSize = `var(--v-target-${sizeType}, 0px)`; 20892 const centerOffset = `calc((${targetSize} - ${arrowSize}) / 2)`; 20893 const offset2 = getArrowOffset(placement); 20894 return c$1(`[v-placement="${placement}"] >`, [cB("popover-shared", [cM("center-arrow", [cB("popover-arrow", `${direction}: calc(max(${centerOffset}, ${offset2}) ${isReverse ? "+" : "-"} var(--v-offset-${isVertical ? "left" : "top"}));`)])])]); 20895 }); 20896})]); 20897function getArrowOffset(placement) { 20898 return ["top", "bottom"].includes(placement.split("-")[0]) ? "var(--n-arrow-offset)" : "var(--n-arrow-offset-vertical)"; 20899} 20900function placementStyle(placement, arrowStyleLiteral) { 20901 const position = placement.split("-")[0]; 20902 const sizeStyle = ["top", "bottom"].includes(position) ? "height: var(--n-space-arrow);" : "width: var(--n-space-arrow);"; 20903 return c$1(`[v-placement="${placement}"] >`, [cB("popover-shared", ` 20904 margin-${oppositePlacement[position]}: var(--n-space); 20905 `, [cM("show-arrow", ` 20906 margin-${oppositePlacement[position]}: var(--n-space-arrow); 20907 `), cM("overlap", ` 20908 margin: 0; 20909 `), cCB("popover-arrow-wrapper", ` 20910 right: 0; 20911 left: 0; 20912 top: 0; 20913 bottom: 0; 20914 ${position}: 100%; 20915 ${oppositePlacement[position]}: auto; 20916 ${sizeStyle} 20917 `, [cB("popover-arrow", arrowStyleLiteral)])])]); 20918} 20919const popoverBodyProps = Object.assign(Object.assign({}, useTheme.props), { 20920 to: useAdjustedTo.propTo, 20921 show: Boolean, 20922 trigger: String, 20923 showArrow: Boolean, 20924 delay: Number, 20925 duration: Number, 20926 raw: Boolean, 20927 arrowPointToCenter: Boolean, 20928 arrowClass: String, 20929 arrowStyle: [String, Object], 20930 arrowWrapperClass: String, 20931 arrowWrapperStyle: [String, Object], 20932 displayDirective: String, 20933 x: Number, 20934 y: Number, 20935 flip: Boolean, 20936 overlap: Boolean, 20937 placement: String, 20938 width: [Number, String], 20939 keepAliveOnHover: Boolean, 20940 scrollable: Boolean,
20941 contentClass: String, 20942 contentStyle: [Object, String], 20943 headerClass: String, 20944 headerStyle: [Object, String], 20945 footerClass: String, 20946 footerStyle: [Object, String], 20947 // private 20948 internalDeactivateImmediately: Boolean, 20949 animated: Boolean, 20950 onClickoutside: Function, 20951 internalTrapFocus: Boolean, 20952 internalOnAfterLeave: Function, 20953 // deprecated 20954 minWidth: Number, 20955 maxWidth: Number 20956}); 20957const renderArrow = ({ 20958 arrowClass, 20959 arrowStyle, 20960 arrowWrapperClass, 20961 arrowWrapperStyle, 20962 clsPrefix 20963}) => { 20964 return h("div", { 20965 key: "__popover-arrow__", 20966 style: arrowWrapperStyle, 20967 class: [`${clsPrefix}-popover-arrow-wrapper`, arrowWrapperClass] 20968 }, h("div", { 20969 class: [`${clsPrefix}-popover-arrow`, arrowClass], 20970 style: arrowStyle 20971 })); 20972}; 20973const NPopoverBody = defineComponent({ 20974 name: "PopoverBody", 20975 inheritAttrs: false, 20976 props: popoverBodyProps, 20977 setup(props, { 20978 slots, 20979 attrs 20980 }) { 20981 const { 20982 namespaceRef, 20983 mergedClsPrefixRef, 20984 inlineThemeDisabled 20985 } = useConfig(props); 20986 const themeRef = useTheme("Popover", "-popover", style$g, popoverLight$1, props, mergedClsPrefixRef); 20987 const followerRef = ref(null); 20988 const NPopover2 = inject("NPopover"); 20989 const bodyRef = ref(null); 20990 const followerEnabledRef = ref(props.show); 20991 const displayedRef = ref(false); 20992 watchEffect(() => { 20993 const { 20994 show 20995 } = props; 20996 if (show && !isJsdom() && !props.internalDeactivateImmediately) { 20997 displayedRef.value = true; 20998 } 20999 }); 21000 const directivesRef = computed(() => { 21001 const { 21002 trigger: trigger2, 21003 onClickoutside 21004 } = props; 21005 const directives = []; 21006 const { 21007 positionManuallyRef: { 21008 value: positionManually 21009 } 21010 } = NPopover2; 21011 if (!positionManually) { 21012 if (trigger2 === "click" && !onClickoutside) { 21013 directives.push([clickoutside$1, handleClickOutside, void 0, { 21014 capture: true 21015 }]); 21016 } 21017 if (trigger2 === "hover") { 21018 directives.push([mousemoveoutside$1, handleMouseMoveOutside]); 21019 } 21020 } 21021 if (onClickoutside) { 21022 directives.push([clickoutside$1, handleClickOutside, void 0, { 21023 capture: true 21024 }]); 21025 } 21026 if (props.displayDirective === "show" || props.animated && displayedRef.value) { 21027 directives.push([vShow, props.show]); 21028 } 21029 return directives; 21030 }); 21031 const styleRef = computed(() => { 21032 const width = props.width === "trigger" ? void 0 : formatLength(props.width); 21033 const style2 = []; 21034 if (width) { 21035 style2.push({ 21036 width 21037 }); 21038 } 21039 const { 21040 maxWidth, 21041 minWidth 21042 } = props; 21043 if (maxWidth) { 21044 style2.push({ 21045 maxWidth: formatLength(maxWidth) 21046 }); 21047 } 21048 if (minWidth) { 21049 style2.push({ 21050 maxWidth: formatLength(minWidth) 21051 }); 21052 } 21053 if (!inlineThemeDisabled) { 21054 style2.push(cssVarsRef.value); 21055 } 21056 return style2; 21057 }); 21058 const cssVarsRef = computed(() => { 21059 const { 21060 common: { 21061 cubicBezierEaseInOut: cubicBezierEaseInOut2, 21062 cubicBezierEaseIn: cubicBezierEaseIn2, 21063 cubicBezierEaseOut: cubicBezierEaseOut2 21064 }, 21065 self: { 21066 space, 21067 spaceArrow, 21068 padding, 21069 fontSize: fontSize2, 21070 textColor, 21071 dividerColor, 21072 color, 21073 boxShadow, 21074 borderRadius, 21075 arrowHeight, 21076 arrowOffset, 21077 arrowOffsetVertical 21078 } 21079 } = themeRef.value; 21080 return { 21081 "--n-box-shadow": boxShadow, 21082 "--n-bezier": cubicBezierEaseInOut2, 21083 "--n-bezier-ease-in": cubicBezierEaseIn2, 21084 "--n-bezier-ease-out": cubicBezierEaseOut2, 21085 "--n-font-size": fontSize2, 21086 "--n-text-color": textColor, 21087 "--n-color": color, 21088 "--n-divider-color": dividerColor, 21089 "--n-border-radius": borderRadius, 21090 "--n-arrow-height": arrowHeight, 21091 "--n-arrow-offset": arrowOffset, 21092 "--n-arrow-offset-vertical": arrowOffsetVertical, 21093 "--n-padding": padding,
21094 "--n-space": space, 21095 "--n-space-arrow": spaceArrow 21096 }; 21097 }); 21098 const themeClassHandle = inlineThemeDisabled ? useThemeClass("popover", void 0, cssVarsRef, props) : void 0; 21099 NPopover2.setBodyInstance({ 21100 syncPosition 21101 }); 21102 onBeforeUnmount(() => { 21103 NPopover2.setBodyInstance(null); 21104 }); 21105 watch(toRef(props, "show"), (value) => { 21106 if (props.animated) 21107 return; 21108 if (value) { 21109 followerEnabledRef.value = true; 21110 } else { 21111 followerEnabledRef.value = false; 21112 } 21113 }); 21114 function syncPosition() { 21115 var _a2; 21116 (_a2 = followerRef.value) === null || _a2 === void 0 ? void 0 : _a2.syncPosition(); 21117 } 21118 function handleMouseEnter(e) { 21119 if (props.trigger === "hover" && props.keepAliveOnHover && props.show) { 21120 NPopover2.handleMouseEnter(e); 21121 } 21122 } 21123 function handleMouseLeave(e) { 21124 if (props.trigger === "hover" && props.keepAliveOnHover) { 21125 NPopover2.handleMouseLeave(e); 21126 } 21127 } 21128 function handleMouseMoveOutside(e) { 21129 if (props.trigger === "hover" && !getTriggerElement().contains(getPreciseEventTarget(e))) { 21130 NPopover2.handleMouseMoveOutside(e); 21131 } 21132 } 21133 function handleClickOutside(e) { 21134 if (props.trigger === "click" && !getTriggerElement().contains(getPreciseEventTarget(e)) || props.onClickoutside) { 21135 NPopover2.handleClickOutside(e); 21136 } 21137 } 21138 function getTriggerElement() { 21139 return NPopover2.getTriggerElement(); 21140 } 21141 provide(popoverBodyInjectionKey, bodyRef); 21142 provide(drawerBodyInjectionKey, null); 21143 provide(modalBodyInjectionKey, null); 21144 function renderContentNode() { 21145 themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender(); 21146 const shouldRenderDom = props.displayDirective === "show" || props.show || props.animated && displayedRef.value; 21147 if (!shouldRenderDom) { 21148 return null; 21149 } 21150 let contentNode; 21151 const renderBody = NPopover2.internalRenderBodyRef.value; 21152 const { 21153 value: mergedClsPrefix 21154 } = mergedClsPrefixRef; 21155 if (!renderBody) { 21156 const { 21157 value: extraClass 21158 } = NPopover2.extraClassRef; 21159 const { 21160 internalTrapFocus 21161 } = props; 21162 const hasHeaderOrFooter = !isSlotEmpty(slots.header) || !isSlotEmpty(slots.footer); 21163 const renderContentInnerNode = () => { 21164 var _a2, _b; 21165 const body = hasHeaderOrFooter ? h(Fragment, null, resolveWrappedSlot(slots.header, (children) => { 21166 return children ? h("div", { 21167 class: [`${mergedClsPrefix}-popover__header`, props.headerClass], 21168 style: props.headerStyle 21169 }, children) : null; 21170 }), resolveWrappedSlot(slots.default, (children) => { 21171 return children ? h("div", { 21172 class: [`${mergedClsPrefix}-popover__content`, props.contentClass], 21173 style: props.contentStyle 21174 }, slots) : null; 21175 }), resolveWrappedSlot(slots.footer, (children) => { 21176 return children ? h("div", { 21177 class: [`${mergedClsPrefix}-popover__footer`, props.footerClass], 21178 style: props.footerStyle 21179 }, children) : null; 21180 })) : props.scrollable ? (_a2 = slots.default) === null || _a2 === void 0 ? void 0 : _a2.call(slots) : h("div", { 21181 class: [`${mergedClsPrefix}-popover__content`, props.contentClass], 21182 style: props.contentStyle 21183 }, slots); 21184 const maybeScrollableBody = props.scrollable ? h(XScrollbar, { 21185 contentClass: hasHeaderOrFooter ? void 0 : `${mergedClsPrefix}-popover__content ${(_b = props.contentClass) !== null && _b !== void 0 ? _b : ""}`, 21186 contentStyle: hasHeaderOrFooter ? void 0 : props.contentStyle 21187 }, { 21188 default: () => body 21189 }) : body; 21190 const arrow = props.showArrow ? renderArrow({ 21191 arrowClass: props.arrowClass, 21192 arrowStyle: props.arrowStyle, 21193 arrowWrapperClass: props.arrowWrapperClass, 21194 arrowWrapperStyle: props.arrowWrapperStyle, 21195 clsPrefix: mergedClsPrefix 21196 }) : null; 21197 return [maybeScrollableBody, arrow]; 21198 }; 21199 contentNode = h("div", mergeProps({ 21200 class: [`${mergedClsPrefix}-popover`, `${mergedClsPrefix}
21200-popover-shared`, themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass.value, extraClass.map((v) => `${mergedClsPrefix}-${v}`), { 21201 [`${mergedClsPrefix}-popover--scrollable`]: props.scrollable, 21202 [`${mergedClsPrefix}-popover--show-header-or-footer`]: hasHeaderOrFooter, 21203 [`${mergedClsPrefix}-popover--raw`]: props.raw, 21204 [`${mergedClsPrefix}-popover-shared--overlap`]: props.overlap, 21205 [`${mergedClsPrefix}-popover-shared--show-arrow`]: props.showArrow, 21206 [`${mergedClsPrefix}-popover-shared--center-arrow`]: props.arrowPointToCenter 21207 }], 21208 ref: bodyRef, 21209 style: styleRef.value, 21210 onKeydown: NPopover2.handleKeydown, 21211 onMouseenter: handleMouseEnter, 21212 onMouseleave: handleMouseLeave 21213 }, attrs), internalTrapFocus ? h(FocusTrap, { 21214 active: props.show, 21215 autoFocus: true 21216 }, { 21217 default: renderContentInnerNode 21218 }) : renderContentInnerNode()); 21219 } else { 21220 contentNode = renderBody( 21221 // The popover class and overlap class must exists, they will be used 21222 // to place the body & transition animation. 21223 // Shadow class exists for reuse box-shadow. 21224 [`${mergedClsPrefix}-popover-shared`, themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass.value, props.overlap && `${mergedClsPrefix}-popover-shared--overlap`, props.showArrow && `${mergedClsPrefix}-popover-shared--show-arrow`, props.arrowPointToCenter && `${mergedClsPrefix}-popover-shared--center-arrow`], 21225 bodyRef, 21226 styleRef.value, 21227 handleMouseEnter, 21228 handleMouseLeave 21229 ); 21230 } 21231 return withDirectives(contentNode, directivesRef.value); 21232 } 21233 return { 21234 displayed: displayedRef, 21235 namespace: namespaceRef, 21236 isMounted: NPopover2.isMountedRef, 21237 zIndex: NPopover2.zIndexRef, 21238 followerRef, 21239 adjustedTo: useAdjustedTo(props), 21240 followerEnabled: followerEnabledRef, 21241 renderContentNode 21242 }; 21243 }, 21244 render() { 21245 return h(VFollower, { 21246 ref: "followerRef", 21247 zIndex: this.zIndex, 21248 show: this.show, 21249 enabled: this.followerEnabled, 21250 to: this.adjustedTo, 21251 x: this.x, 21252 y: this.y, 21253 flip: this.flip, 21254 placement: this.placement, 21255 containerClass: this.namespace, 21256 overlap: this.overlap, 21257 width: this.width === "trigger" ? "target" : void 0, 21258 teleportDisabled: this.adjustedTo === useAdjustedTo.tdkey 21259 }, { 21260 default: () => { 21261 return this.animated ? h(Transition, { 21262 name: "popover-transition", 21263 appear: this.isMounted, 21264 // Don't use watch to enable follower, since the transition may 21265 // make position sync timing very subtle and buggy. 21266 onEnter: () => { 21267 this.followerEnabled = true; 21268 }, 21269 onAfterLeave: () => { 21270 var _a2; 21271 (_a2 = this.internalOnAfterLeave) === null || _a2 === void 0 ? void 0 : _a2.call(this); 21272 this.followerEnabled = false; 21273 this.displayed = false; 21274 } 21275 }, { 21276 default: this.renderContentNode 21277 }) : this.renderContentNode(); 21278 } 21279 }); 21280 } 21281}); 21282const bodyPropKeys = Object.keys(popoverBodyProps); 21283const triggerEventMap = { 21284 focus: ["onFocus", "onBlur"], 21285 click: ["onClick"], 21286 hover: ["onMouseenter", "onMouseleave"], 21287 manual: [], 21288 nested: ["onFocus", "onBlur", "onMouseenter", "onMouseleave", "onClick"] 21289}; 21290function appendEvents(vNode, trigger2, events2) { 21291 triggerEventMap[trigger2].forEach((eventName) => { 21292 if (!vNode.props) 21293 vNode.props = {}; 21294 else { 21295 vNode.props = Object.assign({}, vNode.props); 21296 } 21297 const originalHandler = vNode.props[eventName]; 21298 const handler = events2[eventName]; 21299 if (!originalHandler) 21300 vNode.props[eventName] = handler; 21301 else { 21302 vNode.props[eventName] = (...args) => { 21303 originalHandler(...args); 21304 handler(...args); 21305 }; 21306 } 21307 }); 21308} 21309const popoverBaseProps = { 21310 show: { 21311 type: Boolean, 21312 default: void 0 21313 }, 21314 defaultShow: Boolean, 21315 showArrow: { 21316 type: Boolean, 21317 default: true 21318 }, 21319 trigger: { 21320 type: String, 21321 default: "hover" 21322 }, 21323 delay: { 21324 type: Number, 21325 default: 100 21326 }, 21327 duration: { 21328 type: Number, 21329 default: 100 21330 }, 21331 raw: Boolean, 21332 placement: { 21333 type: String, 21334 default: "top" 21335 }, 21336 x: Number, 21337 y: Number, 21338 arrowPointToCenter: Boolean, 21339 disabled: Boolean, 21340 getDisabled: Function, 21341 displayDirective: { 21342 type: String, 21343 default: "if" 21344 }, 21345 arrowClass: String, 21346 arrowStyle: [String, Object], 21347 arrowWrapperClass: String, 21348 arrowWrapperStyle: [String, Object], 21349 flip: { 21350 type: Boolean, 21351 default: true 21352 }, 21353 animated: { 21354 type: Boolean, 21355 default: true 21356 }, 21357 width: { 21358 type: [Number, String], 21359 default: void 0 21360 }, 21361 overlap: Boolean, 21362 keepAliveOnHover: { 21363 type: Boolean, 21364 default: true 21365 }, 21366 zIndex: Number, 21367 to: useAdjustedTo.propTo, 21368 scrollable: Boolean,
21369 contentClass: String, 21370 contentStyle: [Object, String], 21371 headerClass: String, 21372 headerStyle: [Object, String], 21373 footerClass: String, 21374 footerStyle: [Object, String], 21375 // events 21376 onClickoutside: Function, 21377 "onUpdate:show": [Function, Array], 21378 onUpdateShow: [Function, Array], 21379 // internal 21380 internalDeactivateImmediately: Boolean, 21381 internalSyncTargetWithParent: Boolean, 21382 internalInheritedEventHandlers: { 21383 type: Array, 21384 default: () => [] 21385 }, 21386 internalTrapFocus: Boolean, 21387 internalExtraClass: { 21388 type: Array, 21389 default: () => [] 21390 }, 21391 // deprecated 21392 onShow: [Function, Array], 21393 onHide: [Function, Array], 21394 arrow: { 21395 type: Boolean, 21396 default: void 0 21397 }, 21398 minWidth: Number, 21399 maxWidth: Number 21400}; 21401const popoverProps = Object.assign(Object.assign(Object.assign({}, useTheme.props), popoverBaseProps), { 21402 internalOnAfterLeave: Function, 21403 internalRenderBody: Function 21404}); 21405const NPopover = defineComponent({ 21406 name: "Popover", 21407 inheritAttrs: false, 21408 props: popoverProps, 21409 __popover__: true, 21410 setup(props) { 21411 const isMountedRef = isMounted(); 21412 const binderInstRef = ref(null); 21413 const controlledShowRef = computed(() => props.show); 21414 const uncontrolledShowRef = ref(props.defaultShow); 21415 const mergedShowWithoutDisabledRef = useMergedState(controlledShowRef, uncontrolledShowRef); 21416 const mergedShowConsideringDisabledPropRef = useMemo(() => { 21417 if (props.disabled) 21418 return false; 21419 return mergedShowWithoutDisabledRef.value; 21420 }); 21421 const getMergedDisabled = () => { 21422 if (props.disabled) 21423 return true; 21424 const { 21425 getDisabled 21426 } = props; 21427 if (getDisabled === null || getDisabled === void 0 ? void 0 : getDisabled()) 21428 return true; 21429 return false; 21430 }; 21431 const getMergedShow = () => { 21432 if (getMergedDisabled()) 21433 return false; 21434 return mergedShowWithoutDisabledRef.value; 21435 }; 21436 const compatibleShowArrowRef = useCompitable(props, ["arrow", "showArrow"]); 21437 const mergedShowArrowRef = computed(() => { 21438 if (props.overlap) 21439 return false; 21440 return compatibleShowArrowRef.value; 21441 }); 21442 let bodyInstance = null; 21443 const showTimerIdRef = ref(null); 21444 const hideTimerIdRef = ref(null); 21445 const positionManuallyRef = useMemo(() => { 21446 return props.x !== void 0 && props.y !== void 0; 21447 }); 21448 function doUpdateShow(value) { 21449 const { 21450 "onUpdate:show": _onUpdateShow, 21451 onUpdateShow, 21452 onShow, 21453 onHide 21454 } = props; 21455 uncontrolledShowRef.value = value; 21456 if (_onUpdateShow) { 21457 call(_onUpdateShow, value); 21458 } 21459 if (onUpdateShow) { 21460 call(onUpdateShow, value); 21461 } 21462 if (value && onShow) { 21463 call(onShow, true); 21464 } 21465 if (value && onHide) { 21466 call(onHide, false); 21467 } 21468 } 21469 function syncPosition() { 21470 if (bodyInstance) { 21471 bodyInstance.syncPosition(); 21472 } 21473 } 21474 function clearShowTimer() { 21475 const { 21476 value: showTimerId 21477 } = showTimerIdRef; 21478 if (showTimerId) { 21479 window.clearTimeout(showTimerId); 21480 showTimerIdRef.value = null; 21481 } 21482 } 21483 function clearHideTimer() { 21484 const { 21485 value: hideTimerId 21486 } = hideTimerIdRef; 21487 if (hideTimerId) { 21488 window.clearTimeout(hideTimerId); 21489 hideTimerIdRef.value = null; 21490 } 21491 } 21492 function handleFocus() { 21493 const mergedDisabled = getMergedDisabled(); 21494 if (props.trigger === "focus" && !mergedDisabled) { 21495 if (getMergedShow()) 21496 return; 21497 doUpdateShow(true); 21498 } 21499 } 21500 function handleBlur() { 21501 const mergedDisabled = getMergedDisabled(); 21502 if (props.trigger === "focus" && !mergedDisabled) { 21503 if (!getMergedShow()) 21504 return; 21505 doUpdateShow(false); 21506 } 21507 } 21508 function handleMouseEnter() { 21509 const mergedDisabled = getMergedDisabled(); 21510 if (props.trigger === "hover" && !mergedDisabled) { 21511 clearHideTimer(); 21512 if (showTimerIdRef.value !== null) 21513 return; 21514 if (getMergedShow()) 21515 return; 21516 const delayCallback = () => { 21517 doUpdateShow(true); 21518 showTimerIdRef.value = null; 21519 }; 21520 const { 21521 delay 21522 } = props; 21523 if (delay === 0) { 21524 delayCallback(); 21525 } else { 21526 showTimerIdRef.value = window.setTimeout(delayCallback, delay); 21527 } 21528 } 21529 } 21530 function handleMouseLeave() { 21531 const mergedDisabled = getMergedDisabled(); 21532 if (props.trigger === "hover" && !mergedDisabled) { 21533 clearShowTimer(); 21534 if (hideTimerIdRef.value !== null) 21535 return; 21536 if (!getMergedShow()) 21537 return; 21538 const delayedCallback = () => { 21539 doUpdateShow(false); 21540 hideTimerIdRef.value = null; 21541 }; 21542 const { 21543 duration: duration2 21544 } = props; 21545 if (duration2 === 0) { 21546 delayedCallback(); 21547 } else { 21548 hideTimerIdRef.value = window.setTimeout(delayedCallback, duration2); 21549 } 21550 } 21551 } 21552 function handleMouseMoveOutside() { 21553 handleMouseLeave(); 21554 } 21555 function handleClickOutside(e) { 21556 var _a2; 21557 if (!getMergedShow()) 21558 return; 21559 if (props.trigger === "click") { 21560 clearShowTimer(); 21561 clearHideTimer(); 21562 doUpdateShow(false); 21563 } 21564 (_a2 = props.onClickoutside) === null || _a2 === void 0 ? void 0 : _a2.call(props, e); 21565 } 21566 function handleClick2() { 21567 if (props.trigger === "click" && !getMergedDisabled()) { 21568 clearShowTimer(); 21569 clearHideTimer(); 21570 const nextShow = !getMergedShow(); 21571 doUpdateShow(nextShow); 21572 } 21573 } 21574 function handleKeydown(e) { 21575 if (!props.internalTrapFocus) 21576 return; 21577 if (e.key === "Escape") { 21578 clearShowTimer(); 21579 clearHideTimer(); 21580 doUpdateShow(false); 21581 } 21582 } 21583 function setShow(value) { 21584 uncontrolledShowRef.value = value; 21585 } 21586 function getTriggerElement() { 21587 var _a2; 21588 return (_a2 = binderInstRef.value) === null || _a2 === void 0 ? void 0 : _a2.targetRef; 21589 } 21590 function setBodyInstance(value) { 21591 bodyInstance = value; 21592 } 21593 provide("NPopover", { 21594 getTriggerElement, 21595 handleKeydown, 21596 handleMouseEnter, 21597 handleMouseLeave, 21598 handleClickOutside, 21599 handleMouseMoveOutside, 21600 setBodyInstance, 21601 positionManuallyRef, 21602 isMountedRef, 21603 zIndexRef: toRef(props, "zIndex"), 21604 extraClassRef: toRef(props, "internalExtraClass"), 21605 internalRenderBodyRef: toRef(props, "internalRenderBody") 21606 }); 21607 watchEffect(() => { 21608 if (mergedShowWithoutDisabledRef.value && getMergedDisabled()) { 21609 doUpdateShow(false); 21610 } 21611 }); 21612 const returned = { 21613 binderInstRef, 21614 positionManually: positionManuallyRef, 21615 mergedShowConsideringDisabledProp: mergedShowConsideringDisabledPropRef, 21616 // if to show popover body 21617 uncontrolledShow: uncontrolledShowRef, 21618 mergedShowArrow: mergedShowArrowRef, 21619 getMergedShow, 21620 setShow, 21621 handleClick: handleClick2, 21622 handleMouseEnter, 21623 handleMouseLeave, 21624 handleFocus, 21625 handleBlur, 21626 syncPosition 21627 }; 21628 return returned; 21629 }, 21630 render() { 21631 var _a2; 21632 const { 21633 positionManually, 21634 $slots: slots 21635 } = this; 21636 let triggerVNode; 21637 let popoverInside = false;
21638 if (!positionManually) { 21639 if (slots.activator) { 21640 triggerVNode = getFirstSlotVNode(slots, "activator"); 21641 } else { 21642 triggerVNode = getFirstSlotVNode(slots, "trigger"); 21643 } 21644 if (triggerVNode) { 21645 triggerVNode = cloneVNode(triggerVNode); 21646 triggerVNode = triggerVNode.type === Text ? h("span", [triggerVNode]) : triggerVNode; 21647 const handlers = { 21648 onClick: this.handleClick, 21649 onMouseenter: this.handleMouseEnter, 21650 onMouseleave: this.handleMouseLeave, 21651 onFocus: this.handleFocus, 21652 onBlur: this.handleBlur 21653 }; 21654 if ((_a2 = triggerVNode.type) === null || _a2 === void 0 ? void 0 : _a2.__popover__) { 21655 popoverInside = true; 21656 if (!triggerVNode.props) { 21657 triggerVNode.props = { 21658 internalSyncTargetWithParent: true, 21659 internalInheritedEventHandlers: [] 21660 }; 21661 } 21662 triggerVNode.props.internalSyncTargetWithParent = true; 21663 if (!triggerVNode.props.internalInheritedEventHandlers) { 21664 triggerVNode.props.internalInheritedEventHandlers = [handlers]; 21665 } else { 21666 triggerVNode.props.internalInheritedEventHandlers = [handlers, ...triggerVNode.props.internalInheritedEventHandlers]; 21667 } 21668 } else { 21669 const { 21670 internalInheritedEventHandlers 21671 } = this; 21672 const ascendantAndCurrentHandlers = [handlers, ...internalInheritedEventHandlers]; 21673 const mergedHandlers = { 21674 onBlur: (e) => { 21675 ascendantAndCurrentHandlers.forEach((_handlers) => { 21676 _handlers.onBlur(e); 21677 }); 21678 }, 21679 onFocus: (e) => { 21680 ascendantAndCurrentHandlers.forEach((_handlers) => { 21681 _handlers.onFocus(e); 21682 }); 21683 }, 21684 onClick: (e) => { 21685 ascendantAndCurrentHandlers.forEach((_handlers) => { 21686 _handlers.onClick(e); 21687 }); 21688 }, 21689 onMouseenter: (e) => { 21690 ascendantAndCurrentHandlers.forEach((_handlers) => { 21691 _handlers.onMouseenter(e); 21692 }); 21693 }, 21694 onMouseleave: (e) => { 21695 ascendantAndCurrentHandlers.forEach((_handlers) => { 21696 _handlers.onMouseleave(e); 21697 }); 21698 } 21699 }; 21700 appendEvents(triggerVNode, internalInheritedEventHandlers ? "nested" : positionManually ? "manual" : this.trigger, mergedHandlers); 21701 } 21702 } 21703 } 21704 return h(VBinder, { 21705 ref: "binderInstRef", 21706 syncTarget: !popoverInside, 21707 syncTargetWithParent: this.internalSyncTargetWithParent 21708 }, { 21709 default: () => { 21710 void this.mergedShowConsideringDisabledProp; 21711 const mergedShow = this.getMergedShow(); 21712 return [this.internalTrapFocus && mergedShow ? withDirectives(h("div", { 21713 style: { 21714 position: "fixed", 21715 inset: 0 21716 } 21717 }), [[zindexable$1, { 21718 enabled: mergedShow, 21719 zIndex: this.zIndex 21720 }]]) : null, positionManually ? null : h(VTarget, null, { 21721 default: () => triggerVNode 21722 }), h(NPopoverBody, keep(this.$props, bodyPropKeys, Object.assign(Object.assign({}, this.$attrs), { 21723 showArrow: this.mergedShowArrow, 21724 show: mergedShow 21725 })), { 21726 default: () => { 21727 var _a3, _b; 21728 return (_b = (_a3 = this.$slots).default) === null || _b === void 0 ? void 0 : _b.call(_a3); 21729 }, 21730 header: () => { 21731 var _a3, _b; 21732 return (_b = (_a3 = this.$slots).header) === null || _b === void 0 ? void 0 : _b.call(_a3); 21733 }, 21734 footer: () => { 21735 var _a3, _b; 21736 return (_b = (_a3 = this.$slots).footer) === null || _b === void 0 ? void 0 : _b.call(_a3); 21737 } 21738 })]; 21739 } 21740 }); 21741 } 21742}); 21743const commonVariables$5 = { 21744 closeIconSizeTiny: "12px", 21745 closeIconSizeSmall: "12px", 21746 closeIconSizeMedium: "14px", 21747 closeIconSizeLarge: "14px", 21748 closeSizeTiny: "16px", 21749 closeSizeSmall: "16px", 21750 closeSizeMedium: "18px", 21751 closeSizeLarge: "18px", 21752 padding: "0 7px", 21753 closeMargin: "0 0 0 4px" 21754}; 21755const self$f = (vars) => { 21756 const { 21757 textColor2, 21758 primaryColorHover, 21759 primaryColorPressed, 21760 primaryColor, 21761 infoColor, 21762 successColor, 21763 warningColor, 21764 errorColor, 21765 baseColor, 21766 borderColor, 21767 opacityDisabled, 21768 tagColor, 21769 closeIconColor, 21770 closeIconColorHover, 21771 closeIconColorPressed, 21772 borderRadiusSmall: borderRadius, 21773 fontSizeMini, 21774 fontSizeTiny, 21775 fontSizeSmall, 21776 fontSizeMedium, 21777 heightMini, 21778 heightTiny, 21779 heightSmall, 21780 heightMedium, 21781 closeColorHover, 21782 closeColorPressed, 21783 buttonColor2Hover, 21784 buttonColor2Pressed, 21785 fontWeightStrong 21786 } = vars; 21787 return Object.assign(Object.assign({}, commonVariables$5), { 21788 closeBorderRadius: borderRadius, 21789 heightTiny: heightMini, 21790 heightSmall: heightTiny,
21791 heightMedium: heightSmall, 21792 heightLarge: heightMedium, 21793 borderRadius, 21794 opacityDisabled, 21795 fontSizeTiny: fontSizeMini, 21796 fontSizeSmall: fontSizeTiny, 21797 fontSizeMedium: fontSizeSmall, 21798 fontSizeLarge: fontSizeMedium, 21799 fontWeightStrong, 21800 // checked 21801 textColorCheckable: textColor2, 21802 textColorHoverCheckable: textColor2, 21803 textColorPressedCheckable: textColor2, 21804 textColorChecked: baseColor, 21805 colorCheckable: "#0000", 21806 colorHoverCheckable: buttonColor2Hover, 21807 colorPressedCheckable: buttonColor2Pressed, 21808 colorChecked: primaryColor, 21809 colorCheckedHover: primaryColorHover, 21810 colorCheckedPressed: primaryColorPressed, 21811 // default 21812 border: `1px solid ${borderColor}`, 21813 textColor: textColor2, 21814 color: tagColor, 21815 colorBordered: "rgb(250, 250, 252)", 21816 closeIconColor, 21817 closeIconColorHover, 21818 closeIconColorPressed, 21819 closeColorHover, 21820 closeColorPressed, 21821 borderPrimary: `1px solid ${changeColor(primaryColor, { 21822 alpha: 0.3 21823 })}`, 21824 textColorPrimary: primaryColor, 21825 colorPrimary: changeColor(primaryColor, { 21826 alpha: 0.12 21827 }), 21828 colorBorderedPrimary: changeColor(primaryColor, { 21829 alpha: 0.1 21830 }), 21831 closeIconColorPrimary: primaryColor, 21832 closeIconColorHoverPrimary: primaryColor, 21833 closeIconColorPressedPrimary: primaryColor, 21834 closeColorHoverPrimary: changeColor(primaryColor, { 21835 alpha: 0.12 21836 }), 21837 closeColorPressedPrimary: changeColor(primaryColor, { 21838 alpha: 0.18 21839 }), 21840 borderInfo: `1px solid ${changeColor(infoColor, { 21841 alpha: 0.3 21842 })}`, 21843 textColorInfo: infoColor, 21844 colorInfo: changeColor(infoColor, { 21845 alpha: 0.12 21846 }), 21847 colorBorderedInfo: changeColor(infoColor, { 21848 alpha: 0.1 21849 }), 21850 closeIconColorInfo: infoColor, 21851 closeIconColorHoverInfo: infoColor, 21852 closeIconColorPressedInfo: infoColor, 21853 closeColorHoverInfo: changeColor(infoColor, { 21854 alpha: 0.12 21855 }), 21856 closeColorPressedInfo: changeColor(infoColor, { 21857 alpha: 0.18 21858 }), 21859 borderSuccess: `1px solid ${changeColor(successColor, { 21860 alpha: 0.3 21861 })}`, 21862 textColorSuccess: successColor, 21863 colorSuccess: changeColor(successColor, { 21864 alpha: 0.12 21865 }), 21866 colorBorderedSuccess: changeColor(successColor, { 21867 alpha: 0.1 21868 }), 21869 closeIconColorSuccess: successColor, 21870 closeIconColorHoverSuccess: successColor, 21871 closeIconColorPressedSuccess: successColor, 21872 closeColorHoverSuccess: changeColor(successColor, { 21873 alpha: 0.12 21874 }), 21875 closeColorPressedSuccess: changeColor(successColor, { 21876 alpha: 0.18 21877 }), 21878 borderWarning: `1px solid ${changeColor(warningColor, { 21879 alpha: 0.35 21880 })}`, 21881 textColorWarning: warningColor, 21882 colorWarning: changeColor(warningColor, { 21883 alpha: 0.15 21884 }), 21885 colorBorderedWarning: changeColor(warningColor, { 21886 alpha: 0.12 21887 }), 21888 closeIconColorWarning: warningColor, 21889 closeIconColorHoverWarning: warningColor, 21890 closeIconColorPressedWarning: warningColor, 21891 closeColorHoverWarning: changeColor(warningColor, { 21892 alpha: 0.12 21893 }), 21894 closeColorPressedWarning: changeColor(warningColor, { 21895 alpha: 0.18 21896 }), 21897 borderError: `1px solid ${changeColor(errorColor, { 21898 alpha: 0.23 21899 })}`, 21900 textColorError: errorColor, 21901 colorError: changeColor(errorColor, { 21902 alpha: 0.1 21903 }), 21904 colorBorderedError: changeColor(errorColor, { 21905 alpha: 0.08 21906 }), 21907 closeIconColorError: errorColor, 21908 closeIconColorHoverError: errorColor, 21909 closeIconColorPressedError: errorColor, 21910 closeColorHoverError: changeColor(errorColor, { 21911 alpha: 0.12 21912 }), 21913 closeColorPressedError: changeColor(errorColor, { 21914 alpha: 0.18 21915 }) 21916 }); 21917}; 21918const tagLight = { 21919 name: "Tag", 21920 common: commonLight, 21921 self: self$f 21922}; 21923const tagLight$1 = tagLight; 21924const commonProps = { 21925 color: Object, 21926 type: { 21927 type: String, 21928 default: "default" 21929 }, 21930 round: Boolean, 21931 size: { 21932 type: String, 21933 default: "medium" 21934 }, 21935 closable: Boolean, 21936 disabled: { 21937 type: Boolean, 21938 default: void 0 21939 } 21940}; 21941const style$f = cB("tag", ` 21942 --n-close-margin: var(--n-close-margin-top) var(--n-close-margin-right) var(--n-close-margin-bottom) var(--n-close-margin-left); 21943 white-space: nowrap; 21944 position: relative; 21945 box-sizing: border-box; 21946 cursor: default; 21947 display: inline-flex; 21948 align-items: center; 21949 flex-wrap: nowrap; 21950 padding: var(--n-padding); 21951 border-radius: var(--n-border-radius); 21952 color: var(--n-text-color); 21953 background-color: var(--n-color); 21954 transition: 21955 border-color .3s var(--n-bezier), 21956 background-color .3s var(--n-bezier), 21957 color .3s var(--n-bezier), 21958 box-shadow .3s var(--n-bezier), 21959 opacity .3s var(--n-bezier); 21960 line-height: 1; 21961 height: var(--n-height); 21962 font-size: var(--n-font-size); 21963`, [cM("strong", ` 21964 font-weight: var(--n-font-weight-strong); 21965 `), cE("border", ` 21966 pointer-events: none; 21967 position: absolute; 21968 left: 0; 21969 right: 0; 21970 top: 0; 21971 bottom: 0; 21972 border-radius: inherit; 21973 border: var(--n-border); 21974 transition: border-color .3s var(--n-bezier); 21975 `), cE("icon", ` 21976 display: flex; 21977 margin: 0 4px 0 0; 21978 color: var(--n-text-color); 21979 transition: color .3s var(--n-bezier); 21980 font-size: var(--n-avatar-size-override); 21981 `), cE("avatar", ` 21982 display: flex; 21983 margin: 0 6px 0 0; 21984 `), cE("close", ` 21985 margin: var(--n-close-margin); 21986 transition: 21987 background-color .3s var(--n-bezier), 21988 color .3s var(--n-bezier); 21989 `), cM("round", ` 21990 padding: 0 calc(var(--n-height) / 3); 21991 border-radius: calc(var(--n-height) / 2); 21992 `, [cE("icon", ` 21993 margin: 0 4px 0 calc((var(--n-height) - 8px) / -2); 21994 `), cE("avatar", ` 21995 margin: 0 6px 0 calc((var(--n-height) - 8px) / -2); 21996 `), cM("closable", ` 21997 padding: 0 calc(var(--n-height) / 4) 0 calc(var(--n-height) / 3); 21998 `)]), cM("icon, avatar", [cM("round", ` 21999 padding: 0 calc(var(--n-height) / 3) 0 calc(var(--n-height) / 2); 22000 `)]), cM("disabled", `
22001 cursor: not-allowed !important; 22002 opacity: var(--n-opacity-disabled); 22003 `), cM("checkable", ` 22004 cursor: pointer; 22005 box-shadow: none; 22006 color: var(--n-text-color-checkable); 22007 background-color: var(--n-color-checkable); 22008 `, [cNotM("disabled", [c$1("&:hover", "background-color: var(--n-color-hover-checkable);", [cNotM("checked", "color: var(--n-text-color-hover-checkable);")]), c$1("&:active", "background-color: var(--n-color-pressed-checkable);", [cNotM("checked", "color: var(--n-text-color-pressed-checkable);")])]), cM("checked", ` 22009 color: var(--n-text-color-checked); 22010 background-color: var(--n-color-checked); 22011 `, [cNotM("disabled", [c$1("&:hover", "background-color: var(--n-color-checked-hover);"), c$1("&:active", "background-color: var(--n-color-checked-pressed);")])])])]); 22012const tagProps = Object.assign(Object.assign(Object.assign({}, useTheme.props), commonProps), { 22013 bordered: { 22014 type: Boolean, 22015 default: void 0 22016 }, 22017 checked: Boolean, 22018 checkable: Boolean, 22019 strong: Boolean, 22020 triggerClickOnClose: Boolean, 22021 onClose: [Array, Function], 22022 onMouseenter: Function, 22023 onMouseleave: Function, 22024 "onUpdate:checked": Function, 22025 onUpdateChecked: Function, 22026 // private 22027 internalCloseFocusable: { 22028 type: Boolean, 22029 default: true 22030 }, 22031 internalCloseIsButtonTag: { 22032 type: Boolean, 22033 default: true 22034 }, 22035 // deprecated 22036 onCheckedChange: Function 22037}); 22038const tagInjectionKey = createInjectionKey("n-tag"); 22039const NTag = defineComponent({ 22040 name: "Tag", 22041 props: tagProps, 22042 setup(props) { 22043 const contentRef = ref(null); 22044 const { 22045 mergedBorderedRef, 22046 mergedClsPrefixRef, 22047 inlineThemeDisabled, 22048 mergedRtlRef 22049 } = useConfig(props); 22050 const themeRef = useTheme("Tag", "-tag", style$f, tagLight$1, props, mergedClsPrefixRef); 22051 provide(tagInjectionKey, { 22052 roundRef: toRef(props, "round") 22053 }); 22054 function handleClick2(e) { 22055 if (!props.disabled) { 22056 if (props.checkable) { 22057 const { 22058 checked, 22059 onCheckedChange, 22060 onUpdateChecked, 22061 "onUpdate:checked": _onUpdateChecked 22062 } = props; 22063 if (onUpdateChecked) 22064 onUpdateChecked(!checked); 22065 if (_onUpdateChecked) 22066 _onUpdateChecked(!checked); 22067 if (onCheckedChange) 22068 onCheckedChange(!checked); 22069 } 22070 } 22071 } 22072 function handleCloseClick(e) { 22073 if (!props.triggerClickOnClose) { 22074 e.stopPropagation(); 22075 } 22076 if (!props.disabled) { 22077 const { 22078 onClose 22079 } = props; 22080 if (onClose) 22081 call(onClose, e); 22082 } 22083 } 22084 const tagPublicMethods = { 22085 setTextContent(textContent) { 22086 const { 22087 value 22088 } = contentRef; 22089 if (value) 22090 value.textContent = textContent; 22091 } 22092 }; 22093 const rtlEnabledRef = useRtl("Tag", mergedRtlRef, mergedClsPrefixRef); 22094 const cssVarsRef = computed(() => { 22095 const { 22096 type: type4, 22097 size: size2, 22098 color: { 22099 color, 22100 textColor 22101 } = {} 22102 } = props; 22103 const { 22104 common: { 22105 cubicBezierEaseInOut: cubicBezierEaseInOut2 22106 }, 22107 self: { 22108 padding, 22109 closeMargin, 22110 borderRadius, 22111 opacityDisabled, 22112 textColorCheckable, 22113 textColorHoverCheckable, 22114 textColorPressedCheckable, 22115 textColorChecked, 22116 colorCheckable, 22117 colorHoverCheckable, 22118 colorPressedCheckable, 22119 colorChecked, 22120 colorCheckedHover, 22121 colorCheckedPressed, 22122 closeBorderRadius, 22123 fontWeightStrong, 22124 [createKey("colorBordered", type4)]: colorBordered, 22125 [createKey("closeSize", size2)]: closeSize, 22126 [createKey("closeIconSize", size2)]: closeIconSize, 22127 [createKey("fontSize", size2)]: fontSize2, 22128 [createKey("height", size2)]: height, 22129 [createKey("color", type4)]: typedColor, 22130 [createKey("textColor", type4)]: typeTextColor, 22131 [createKey("border", type4)]: border,
22132 [createKey("closeIconColor", type4)]: closeIconColor, 22133 [createKey("closeIconColorHover", type4)]: closeIconColorHover, 22134 [createKey("closeIconColorPressed", type4)]: closeIconColorPressed, 22135 [createKey("closeColorHover", type4)]: closeColorHover, 22136 [createKey("closeColorPressed", type4)]: closeColorPressed 22137 } 22138 } = themeRef.value; 22139 const closeMarginDiscrete = getMargin(closeMargin); 22140 return { 22141 "--n-font-weight-strong": fontWeightStrong, 22142 "--n-avatar-size-override": `calc(${height} - 8px)`, 22143 "--n-bezier": cubicBezierEaseInOut2, 22144 "--n-border-radius": borderRadius, 22145 "--n-border": border, 22146 "--n-close-icon-size": closeIconSize, 22147 "--n-close-color-pressed": closeColorPressed, 22148 "--n-close-color-hover": closeColorHover, 22149 "--n-close-border-radius": closeBorderRadius, 22150 "--n-close-icon-color": closeIconColor, 22151 "--n-close-icon-color-hover": closeIconColorHover, 22152 "--n-close-icon-color-pressed": closeIconColorPressed, 22153 "--n-close-icon-color-disabled": closeIconColor, 22154 "--n-close-margin-top": closeMarginDiscrete.top, 22155 "--n-close-margin-right": closeMarginDiscrete.right, 22156 "--n-close-margin-bottom": closeMarginDiscrete.bottom, 22157 "--n-close-margin-left": closeMarginDiscrete.left, 22158 "--n-close-size": closeSize, 22159 "--n-color": color || (mergedBorderedRef.value ? colorBordered : typedColor), 22160 "--n-color-checkable": colorCheckable, 22161 "--n-color-checked": colorChecked, 22162 "--n-color-checked-hover": colorCheckedHover, 22163 "--n-color-checked-pressed": colorCheckedPressed, 22164 "--n-color-hover-checkable": colorHoverCheckable, 22165 "--n-color-pressed-checkable": colorPressedCheckable, 22166 "--n-font-size": fontSize2, 22167 "--n-height": height, 22168 "--n-opacity-disabled": opacityDisabled, 22169 "--n-padding": padding, 22170 "--n-text-color": textColor || typeTextColor, 22171 "--n-text-color-checkable": textColorCheckable, 22172 "--n-text-color-checked": textColorChecked, 22173 "--n-text-color-hover-checkable": textColorHoverCheckable, 22174 "--n-text-color-pressed-checkable": textColorPressedCheckable 22175 }; 22176 }); 22177 const themeClassHandle = inlineThemeDisabled ? useThemeClass("tag", computed(() => { 22178 let hash = ""; 22179 const { 22180 type: type4, 22181 size: size2, 22182 color: { 22183 color, 22184 textColor 22185 } = {} 22186 } = props; 22187 hash += type4[0]; 22188 hash += size2[0]; 22189 if (color) { 22190 hash += `a${color2Class(color)}`; 22191 } 22192 if (textColor) { 22193 hash += `b${color2Class(textColor)}`; 22194 } 22195 if (mergedBorderedRef.value) { 22196 hash += "c"; 22197 } 22198 return hash; 22199 }), cssVarsRef, props) : void 0; 22200 return Object.assign(Object.assign({}, tagPublicMethods), { 22201 rtlEnabled: rtlEnabledRef, 22202 mergedClsPrefix: mergedClsPrefixRef, 22203 contentRef, 22204 mergedBordered: mergedBorderedRef, 22205 handleClick: handleClick2, 22206 handleCloseClick, 22207 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef, 22208 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 22209 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 22210 }); 22211 }, 22212 render() { 22213 var _a2, _b; 22214 const { 22215 mergedClsPrefix, 22216 rtlEnabled, 22217 closable, 22218 color: { 22219 borderColor 22220 } = {}, 22221 round, 22222 onRender, 22223 $slots 22224 } = this; 22225 onRender === null || onRender === void 0 ? void 0 : onRender(); 22226 const avatarNode = resolveWrappedSlot($slots.avatar, (children) => children && h("div", { 22227 class: `${mergedClsPrefix}-tag__avatar` 22228 }, children)); 22229 const iconNode = resolveWrappedSlot($slots.icon, (children) => children && h("div", { 22230 class: `${mergedClsPrefix}-tag__icon` 22231 }, children)); 22232 return h("div", { 22233 class: [`${mergedClsPrefix}-tag`, this.themeClass, { 22234 [`${mergedClsPrefix}-tag--rtl`]: rtlEnabled, 22235 [`${mergedClsPrefix}-tag--strong`]: this.strong, 22236 [`${mergedClsPrefix}-tag--disabled`]: this.disabled, 22237 [`${mergedClsPrefix}-tag--checkable`]: this.checkable, 22238 [`${mergedClsPrefix}-tag--checked`]: this.checkable && this.checked, 22239 [`${mergedClsPrefix}-tag--round`]: round, 22240 [`${mergedClsPrefix}-tag--avatar`]: avatarNode, 22241 [`${mergedClsPrefix}-tag--icon`]: iconNode, 22242 [`${mergedClsPrefix}-tag--closable`]: closable 22243 }], 22244 style: this.cssVars, 22245 onClick: this.handleClick, 22246 onMouseenter: this.onMouseenter, 22247 onMouseleave: this.onMouseleave 22248 }, iconNode || avatarNode, h("span", { 22249 class: `${mergedClsPrefix}-tag__content`, 22250 ref: "contentRef" 22251 }, (_b = (_a2 = this.$slots).default) === null || _b === void 0 ? void 0 : _b.call(_a2)), !this.checkable && closable ? h(NBaseClose, { 22252 clsPrefix: mergedClsPrefix, 22253 class: `${mergedClsPrefix}-tag__close`, 22254 disabled: this.disabled, 22255 onClick: this.handleCloseClick, 22256 focusable: this.internalCloseFocusable, 22257 round, 22258 isButtonTag: this.internalCloseIsButtonTag, 22259 absolute: true 22260 }) : null, !this.checkable && this.mergedBordered ? h("div", { 22261 class: `${mergedClsPrefix}-tag__border`, 22262 style: { 22263 borderColor 22264 } 22265 }) : null); 22266 } 22267}); 22268const style$e = cB("base-clear", ` 22269 flex-shrink: 0; 22270 height: 1em; 22271 width: 1em; 22272 position: relative; 22273`, [c$1(">", [cE("clear", ` 22274 font-size: var(--n-clear-size); 22275 height: 1em; 22276 width: 1em; 22277 cursor: pointer; 22278 color: var(--n-clear-color); 22279 transition: color .3s var(--n-bezier); 22280 display: flex; 22281 `, [c$1("&:hover", ` 22282 color: var(--n-clear-color-hover)!important; 22283 `), c$1("&:active", ` 22284 color: var(--n-clear-color-pressed)!important; 22285 `)]), cE("placeholder", ` 22286 display: flex; 22287 `), cE("clear, placeholder", ` 22288 position: absolute; 22289 left: 50%; 22290 top: 50%; 22291 transform: translateX(-50%) translateY(-50%); 22292 `, [iconSwitchTransition({ 22293 originalTransform: "translateX(-50%) translateY(-50%)", 22294 left: "50%", 22295 top: "50%" 22296})])])]); 22297const NBaseClear = defineComponent({ 22298 name: "BaseClear", 22299 props: { 22300 clsPrefix: { 22301 type: String, 22302 required: true 22303 }, 22304 show: Boolean, 22305 onClear: Function 22306 }, 22307 setup(props) { 22308 useStyle("-base-clear", style$e, toRef(props, "clsPrefix")); 22309 return { 22310 handleMouseDown(e) { 22311 e.preventDefault(); 22312 } 22313 }; 22314 }, 22315 render() { 22316 const { 22317 clsPrefix 22318 } = this; 22319 return h("div", { 22320 class: `${clsPrefix}-base-clear` 22321 }, h(NIconSwitchTransition, null, { 22322 default: () => { 22323 var _a2, _b; 22324 return this.show ? h("div", { 22325 key: "dismiss", 22326 class: `${clsPrefix}-base-clear__clear`, 22327 onClick: this.onClear, 22328 onMousedown: this.handleMouseDown, 22329 "data-clear": true 22330 }, resolveSlot(this.$slots.icon, () => [h(NBaseIcon, { 22331 clsPrefix 22332 }, { 22333 default: () => h(ClearIcon, null) 22334 })])) : h("div", { 22335 key: "icon", 22336 class: `${clsPrefix}-base-clear__placeholder` 22337 }, (_b = (_a2 = this.$slots).placeholder) === null || _b === void 0 ? void 0 : _b.call(_a2)); 22338 } 22339 })); 22340 } 22341}); 22342const NBaseSuffix = defineComponent({ 22343 name: "InternalSelectionSuffix", 22344 props: { 22345 clsPrefix: { 22346 type: String, 22347 required: true 22348 }, 22349 showArrow: { 22350 type: Boolean, 22351 default: void 0 22352 }, 22353 showClear: { 22354 type: Boolean, 22355 default: void 0 22356 }, 22357 loading: { 22358 type: Boolean, 22359 default: false 22360 }, 22361 onClear: Function 22362 }, 22363 setup(props, { 22364 slots 22365 }) { 22366 return () => { 22367 const { 22368 clsPrefix 22369 } = props; 22370 return h(NBaseLoading, { 22371 clsPrefix, 22372 class: `${clsPrefix}-base-suffix`, 22373 strokeWidth: 24, 22374 scale: 0.85, 22375 show: props.loading 22376 }, { 22377 default: () => props.showArrow ? h(NBaseClear, { 22378 clsPrefix, 22379 show: props.showClear, 22380 onClear: props.onClear 22381 }, { 22382 placeholder: () => h(NBaseIcon, { 22383 clsPrefix, 22384 class: `${clsPrefix}-base-suffix__arrow` 22385 }, { 22386 default: () => resolveSlot(slots.default, () => [h(ChevronDownIcon, null)]) 22387 }) 22388 }) : null 22389 }); 22390 }; 22391 } 22392}); 22393const commonVars$2 = { 22394 paddingSingle: "0 26px 0 12px", 22395 paddingMultiple: "3px 26px 0 12px", 22396 clearSize: "16px", 22397 arrowSize: "16px" 22398}; 22399const self$e = (vars) => { 22400 const { 22401 borderRadius, 22402 textColor2, 22403 textColorDisabled, 22404 inputColor, 22405 inputColorDisabled, 22406 primaryColor, 22407 primaryColorHover, 22408 warningColor, 22409 warningColorHover, 22410 errorColor, 22411 errorColorHover, 22412 borderColor, 22413 iconColor, 22414 iconColorDisabled, 22415 clearColor, 22416 clearColorHover, 22417 clearColorPressed, 22418 placeholderColor, 22419 placeholderColorDisabled, 22420 fontSizeTiny, 22421 fontSizeSmall, 22422 fontSizeMedium, 22423 fontSizeLarge, 22424 heightTiny, 22425 heightSmall, 22426 heightMedium, 22427 heightLarge 22428 } = vars; 22429 return Object.assign(Object.assign({}, commonVars$2), { 22430 fontSizeTiny, 22431 fontSizeSmall, 22432 fontSizeMedium, 22433 fontSizeLarge, 22434 heightTiny, 22435 heightSmall, 22436 heightMedium, 22437 heightLarge, 22438 borderRadius, 22439 // default 22440 textColor: textColor2, 22441 textColorDisabled, 22442 placeholderColor, 22443 placeholderColorDisabled, 22444 color: inputColor, 22445 colorDisabled: inputColorDisabled, 22446 colorActive: inputColor, 22447 border: `1px solid ${borderColor}`, 22448 borderHover: `1px solid ${primaryColorHover}`, 22449 borderActive: `1px solid ${primaryColor}`, 22450 borderFocus: `1px solid ${primaryColorHover}`, 22451 boxShadowHover: "none", 22452 boxShadowActive: `0 0 0 2px ${changeColor(primaryColor, { 22453 alpha: 0.2 22454 })}`, 22455 boxShadowFocus: `0 0 0 2px ${changeColor(primaryColor, { 22456 alpha: 0.2 22457 })}`, 22458 caretColor: primaryColor, 22459 arrowColor: iconColor, 22460 arrowColorDisabled: iconColorDisabled, 22461 loadingColor: primaryColor, 22462 // warning 22463 borderWarning: `1px solid ${warningColor}`, 22464 borderHoverWarning: `1px solid ${warningColorHover}`, 22465 borderActiveWarning: `1px solid ${warningColor}`, 22466 borderFocusWarning: `1px solid ${warningColorHover}`, 22467 boxShadowHoverWarning: "none", 22468 boxShadowActiveWarning: `0 0 0 2px ${changeColor(warningColor, { 22469 alpha: 0.2 22470 })}`, 22471 boxShadowFocusWarning: `0 0 0 2px ${changeColor(warningColor, { 22472 alpha: 0.2 22473 })}`, 22474 colorActiveWarning: inputColor, 22475 caretColorWarning: warningColor, 22476 // error 22477 borderError: `1px solid ${errorColor}`, 22478 borderHoverError: `1px solid ${errorColorHover}`, 22479 borderActiveError: `1px solid ${errorColor}`, 22480 borderFocusError: `1px solid ${errorColorHover}`, 22481 boxShadowHoverError: "none", 22482 boxShadowActiveError: `0 0 0 2px ${changeColor(errorColor, { 22483 alpha: 0.2 22484 })}`, 22485 boxShadowFocusError: `0 0 0 2px ${changeColor(errorColor, { 22486 alpha: 0.2 22487 })}`, 22488 colorActiveError: inputColor, 22489 caretColorError: errorColor, 22490 clearColor, 22491 clearColorHover, 22492 clearColorPressed 22493 }); 22494}; 22495const internalSelectionLight = createTheme({ 22496 name: "InternalSelection", 22497 common: commonLight, 22498 peers: { 22499 Popover: popoverLight$1 22500 }, 22501 self: self$e 22502}); 22503const internalSelectionLight$1 = internalSelectionLight; 22504const style$d = c$1([cB("base-selection", ` 22505 --n-padding-single: var(--n-padding-single-top) var(--n-padding-single-right) var(--n-padding-single-bottom) var(--n-padding-single-left); 22506 --n-padding-multiple: var(--n-padding-multiple-top) var(--n-padding-multiple-right) var(--n-padding-multiple-bottom) var(--n-padding-multiple-left); 22507 position: relative; 22508 z-index: auto; 22509 box-shadow: none; 22510 width: 100%; 22511 max-width: 100%; 22512 display: inline-block; 22513 vertical-align: bottom; 22514 border-radius: var(--n-border-radius); 22515 min-height: var(--n-height); 22516 line-height: 1.5; 22517 font-size: var(--n-font-size); 22518 `, [cB("base-loading", ` 22519 color: var(--n-loading-color); 22520 `), cB("base-selection-tags", "min-height: var(--n-height);"), cE("border, state-border", ` 22521 position: absolute; 22522 left: 0; 22523 right: 0; 22524 top: 0; 22525 bottom: 0; 22526 pointer-events: none; 22527 border: var(--n-border); 22528 border-radius: inherit; 22529 transition: 22530 box-shadow .3s var(--n-bezier), 22531 border-color .3s var(--n-bezier); 22532 `), cE("state-border", ` 22533 z-index: 1; 22534 border-color: #0000; 22535 `), cB("base-suffix", ` 22536 cursor: pointer; 22537 position: absolute; 22538 top: 50%; 22539 transform: translateY(-50%); 22540 right: 10px; 22541 `, [cE("arrow", ` 22542 font-size: var(--n-arrow-size); 22543 color: var(--n-arrow-color); 22544 transition: color .3s var(--n-bezier); 22545 `)]), cB("base-selection-overlay", ` 22546 display: flex; 22547 align-items: center; 22548 white-space: nowrap; 22549 pointer-events: none; 22550 position: absolute; 22551 top: 0; 22552 right: 0; 22553 bottom: 0; 22554 left: 0; 22555 padding: var(--n-padding-single); 22556 transition: color .3s var(--n-bezier); 22557 `, [cE("wrapper", ` 22558 flex-basis: 0; 22559 flex-grow: 1; 22560 overflow: hidden; 22561 text-overflow: ellipsis;
22562 `)]), cB("base-selection-placeholder", ` 22563 color: var(--n-placeholder-color); 22564 `, [cE("inner", ` 22565 max-width: 100%; 22566 overflow: hidden; 22567 `)]), cB("base-selection-tags", ` 22568 cursor: pointer; 22569 outline: none; 22570 box-sizing: border-box; 22571 position: relative; 22572 z-index: auto; 22573 display: flex; 22574 padding: var(--n-padding-multiple); 22575 flex-wrap: wrap; 22576 align-items: center; 22577 width: 100%; 22578 vertical-align: bottom; 22579 background-color: var(--n-color); 22580 border-radius: inherit; 22581 transition: 22582 color .3s var(--n-bezier), 22583 box-shadow .3s var(--n-bezier), 22584 background-color .3s var(--n-bezier); 22585 `), cB("base-selection-label", ` 22586 height: var(--n-height); 22587 display: inline-flex; 22588 width: 100%; 22589 vertical-align: bottom; 22590 cursor: pointer; 22591 outline: none; 22592 z-index: auto; 22593 box-sizing: border-box; 22594 position: relative; 22595 transition: 22596 color .3s var(--n-bezier), 22597 box-shadow .3s var(--n-bezier), 22598 background-color .3s var(--n-bezier); 22599 border-radius: inherit; 22600 background-color: var(--n-color); 22601 align-items: center; 22602 `, [cB("base-selection-input", ` 22603 font-size: inherit; 22604 line-height: inherit; 22605 outline: none; 22606 cursor: pointer; 22607 box-sizing: border-box; 22608 border:none; 22609 width: 100%; 22610 padding: var(--n-padding-single); 22611 background-color: #0000; 22612 color: var(--n-text-color); 22613 transition: color .3s var(--n-bezier); 22614 caret-color: var(--n-caret-color); 22615 `, [cE("content", ` 22616 text-overflow: ellipsis; 22617 overflow: hidden; 22618 white-space: nowrap; 22619 `)]), cE("render-label", ` 22620 color: var(--n-text-color); 22621 `)]), cNotM("disabled", [c$1("&:hover", [cE("state-border", ` 22622 box-shadow: var(--n-box-shadow-hover); 22623 border: var(--n-border-hover); 22624 `)]), cM("focus", [cE("state-border", ` 22625 box-shadow: var(--n-box-shadow-focus); 22626 border: var(--n-border-focus); 22627 `)]), cM("active", [cE("state-border", ` 22628 box-shadow: var(--n-box-shadow-active); 22629 border: var(--n-border-active); 22630 `), cB("base-selection-label", "background-color: var(--n-color-active);"), cB("base-selection-tags", "background-color: var(--n-color-active);")])]), cM("disabled", "cursor: not-allowed;", [cE("arrow", ` 22631 color: var(--n-arrow-color-disabled); 22632 `), cB("base-selection-label", ` 22633 cursor: not-allowed; 22634 background-color: var(--n-color-disabled); 22635 `, [cB("base-selection-input", ` 22636 cursor: not-allowed; 22637 color: var(--n-text-color-disabled); 22638 `), cE("render-label", ` 22639 color: var(--n-text-color-disabled); 22640 `)]), cB("base-selection-tags", ` 22641 cursor: not-allowed; 22642 background-color: var(--n-color-disabled); 22643 `), cB("base-selection-placeholder", ` 22644 cursor: not-allowed; 22645 color: var(--n-placeholder-color-disabled); 22646 `)]), cB("base-selection-input-tag", ` 22647 height: calc(var(--n-height) - 6px); 22648 line-height: calc(var(--n-height) - 6px); 22649 outline: none; 22650 display: none; 22651 position: relative; 22652 margin-bottom: 3px; 22653 max-width: 100%; 22654 vertical-align: bottom; 22655 `, [cE("input", ` 22656 font-size: inherit; 22657 font-family: inherit; 22658 min-width: 1px; 22659 padding: 0; 22660 background-color: #0000; 22661 outline: none; 22662 border: none; 22663 max-width: 100%; 22664 overflow: hidden; 22665 width: 1em; 22666 line-height: inherit; 22667 cursor: pointer; 22668 color: var(--n-text-color); 22669 caret-color: var(--n-caret-color); 22670 `), cE("mirror", ` 22671 position: absolute; 22672 left: 0; 22673 top: 0; 22674 white-space: pre; 22675 visibility: hidden; 22676 user-select: none; 22677 -webkit-user-select: none; 22678 opacity: 0; 22679 `)]), ["warning", "error"].map((status) => cM(`${status}-status`, [cE("state-border", `border: var(--n-border-${status});`), cNotM("disabled", [c$1("&:hover", [cE("state-border", ` 22680 box-shadow: var(--n-box-shadow-hover-${status}); 22681 border: var(--n-border-hover-${status}); 22682 `)]), cM("active", [cE("state-border", ` 22683 box-shadow: var(--n-box-shadow-active-${status}); 22684 border: var(--n-border-active-${status}); 22685 `), cB("base-selection-label", `background-color: var(--n-color-active-${status});`), cB("base-selection-tags", `background-color: var(--n-color-active-${status});`)]), cM("focus", [cE("state-border", ` 22686 box-shadow: var(--n-box-shadow-focus-${status}); 22687 border: var(--n-border-focus-${status}); 22688 `)])])]))]), cB("base-selection-popover", ` 22689 margin-bottom: -3px; 22690 display: flex; 22691 flex-wrap: wrap; 22692 margin-right: -8px; 22693 `), cB("base-selection-tag-wrapper", ` 22694 max-width: 100%; 22695 display: inline-flex; 22696 padding: 0 7px 3px 0; 22697 `, [c$1("&:last-child", "padding-right: 0;"), cB("tag", ` 22698 font-size: 14px; 22699 max-width: 100%; 22700 `, [cE("content", ` 22701 line-height: 1.25; 22702 text-overflow: ellipsis; 22703 overflow: hidden; 22704 `)])])]); 22705const NInternalSelection = defineComponent({ 22706 name: "InternalSelection", 22707 props: Object.assign(Object.assign({}, useTheme.props), { 22708 clsPrefix: { 22709 type: String, 22710 required: true 22711 }, 22712 bordered: { 22713 type: Boolean, 22714 default: void 0 22715 }, 22716 active: Boolean, 22717 pattern: { 22718 type: String, 22719 default: "" 22720 }, 22721 placeholder: String, 22722 selectedOption: { 22723 type: Object, 22724 default: null 22725 }, 22726 selectedOptions: { 22727 type: Array, 22728 default: null 22729 }, 22730 labelField: { 22731 type: String, 22732 default: "label" 22733 }, 22734 valueField: { 22735 type: String, 22736 default: "value" 22737 }, 22738 multiple: Boolean, 22739 filterable: Boolean, 22740 clearable: Boolean, 22741 disabled: Boolean, 22742 size: { 22743 type: String, 22744 default: "medium" 22745 }, 22746 loading: Boolean, 22747 autofocus: Boolean, 22748 showArrow: { 22749 type: Boolean, 22750 default: true 22751 }, 22752 inputProps: Object, 22753 focused: Boolean, 22754 renderTag: Function, 22755 onKeydown: Function, 22756 onClick: Function, 22757 onBlur: Function, 22758 onFocus: Function, 22759 onDeleteOption: Function, 22760 maxTagCount: [String, Number], 22761 ellipsisTagPopoverProps: Object, 22762 onClear: Function, 22763 onPatternInput: Function, 22764 onPatternFocus: Function, 22765 onPatternBlur: Function, 22766 renderLabel: Function, 22767 status: String, 22768 inlineThemeDisabled: Boolean, 22769 ignoreComposition: { 22770 type: Boolean, 22771 default: true 22772 }, 22773 onResize: Function 22774 }), 22775 setup(props) { 22776 const { 22777 mergedClsPrefixRef, 22778 mergedRtlRef 22779 } = useConfig(props); 22780 const rtlEnabledRef = useRtl("InternalSelection", mergedRtlRef, mergedClsPrefixRef); 22781 const patternInputMirrorRef = ref(null); 22782 const patternInputRef = ref(null); 22783 const selfRef = ref(null); 22784 const multipleElRef = ref(null); 22785 const singleElRef = ref(null); 22786 const patternInputWrapperRef = ref(null); 22787 const counterRef = ref(null); 22788 const counterWrapperRef = ref(null); 22789 const overflowRef = ref(null); 22790 const inputTagElRef = ref(null); 22791 const showTagsPopoverRef = ref(false); 22792 const patternInputFocusedRef = ref(false); 22793 const hoverRef = ref(false); 22794 const themeRef = useTheme("InternalSelection", "-internal-selection", style$d, internalSelectionLight$1, props, toRef(props, "clsPrefix")); 22795 const mergedClearableRef = computed(() => { 22796 return props.clearable && !props.disabled && (hoverRef.value || props.active); 22797 }); 22798 const filterablePlaceholderRef = computed(() => { 22799 return props.selectedOption ? props.renderTag ? props.renderTag({ 22800 option: props.selectedOption, 22801 handleClose: () => { 22802 } 22803 }) : props.renderLabel ? props.renderLabel(props.selectedOption, true) : render$4(props.selectedOption[props.labelField], props.selectedOption, true) : props.placeholder; 22804 }); 22805 const labelRef = computed(() => { 22806 const option = props.selectedOption; 22807 if (!option) 22808 return void 0; 22809 return option[props.labelField]; 22810 }); 22811 const selectedRef = computed(() => { 22812 if (props.multiple) { 22813 return !!(Array.isArray(props.selectedOptions) && props.selectedOptions.length); 22814 } else { 22815 return props.selectedOption !== null; 22816 } 22817 }); 22818 function syncMirrorWidth() { 22819 var _a2; 22820 const { 22821 value: patternInputMirrorEl 22822 } = patternInputMirrorRef; 22823 if (patternInputMirrorEl) { 22824 const { 22825 value: patternInputEl 22826 } = patternInputRef; 22827 if (patternInputEl) { 22828 patternInputEl.style.width = `${patternInputMirrorEl.offsetWidth}px`; 22829 if (props.maxTagCount !== "responsive") { 22830 (_a2 = overflowRef.value) === null || _a2 === void 0 ? void 0 : _a2.sync({ 22831 showAllItemsBeforeCalculate: false 22832 }); 22833 } 22834 } 22835 } 22836 } 22837 function hideInputTag() { 22838 const { 22839 value: inputTagEl 22840 } = inputTagElRef; 22841 if (inputTagEl) 22842 inputTagEl.style.display = "none"; 22843 } 22844 function showInputTag() { 22845 const { 22846 value: inputTagEl 22847 } = inputTagElRef; 22848 if (inputTagEl) 22849 inputTagEl.style.display = "inline-block"; 22850 } 22851 watch(toRef(props, "active"), (value) => { 22852 if (!value) 22853 hideInputTag(); 22854 }); 22855 watch(toRef(props, "pattern"), () => { 22856 if (props.multiple) { 22857 void nextTick(syncMirrorWidth); 22858 } 22859 }); 22860 function doFocus(e) { 22861 const { 22862 onFocus 22863 } = props; 22864 if (onFocus) 22865 onFocus(e); 22866 } 22867 function doBlur(e) { 22868 const { 22869 onBlur 22870 } = props; 22871 if (onBlur) 22872 onBlur(e); 22873 } 22874 function doDeleteOption(value) { 22875 const { 22876 onDeleteOption 22877 } = props; 22878 if (onDeleteOption) 22879 onDeleteOption(value); 22880 } 22881 function doClear(e) { 22882 const { 22883 onClear 22884 } = props; 22885 if (onClear) 22886 onClear(e); 22887 } 22888 function doPatternInput(value) { 22889 const { 22890 onPatternInput 22891 } = props; 22892 if (onPatternInput) 22893 onPatternInput(value); 22894 } 22895 function handleFocusin(e) { 22896 var _a2; 22897 if (!e.relatedTarget || !((_a2 = selfRef.value) === null || _a2 === void 0 ? void 0 : _a2.contains(e.relatedTarget))) { 22898 doFocus(e); 22899 } 22900 } 22901 function handleFocusout(e) { 22902 var _a2; 22903 if ((_a2 = selfRef.value) === null || _a2 === void 0 ? void 0 : _a2.contains(e.relatedTarget)) 22904 return; 22905 doBlur(e); 22906 } 22907 function handleClear(e) { 22908 doClear(e); 22909 } 22910 function handleMouseEnter() { 22911 hoverRef.value = true; 22912 } 22913 function handleMouseLeave() { 22914 hoverRef.value = false;
22915 } 22916 function handleMouseDown(e) { 22917 if (!props.active || !props.filterable) 22918 return; 22919 if (e.target === patternInputRef.value) 22920 return; 22921 e.preventDefault(); 22922 } 22923 function handleDeleteOption(option) { 22924 doDeleteOption(option); 22925 } 22926 function handlePatternKeyDown(e) { 22927 if (e.key === "Backspace" && !isComposingRef2.value) { 22928 if (!props.pattern.length) { 22929 const { 22930 selectedOptions 22931 } = props; 22932 if (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) { 22933 handleDeleteOption(selectedOptions[selectedOptions.length - 1]); 22934 } 22935 } 22936 } 22937 } 22938 const isComposingRef2 = ref(false); 22939 let cachedInputEvent = null; 22940 function handlePatternInputInput(e) { 22941 const { 22942 value: patternInputMirrorEl 22943 } = patternInputMirrorRef; 22944 if (patternInputMirrorEl) { 22945 const inputText = e.target.value; 22946 patternInputMirrorEl.textContent = inputText; 22947 syncMirrorWidth(); 22948 } 22949 if (props.ignoreComposition) { 22950 if (!isComposingRef2.value) { 22951 doPatternInput(e); 22952 } else { 22953 cachedInputEvent = e; 22954 } 22955 } else { 22956 doPatternInput(e); 22957 } 22958 } 22959 function handleCompositionStart() { 22960 isComposingRef2.value = true; 22961 } 22962 function handleCompositionEnd() { 22963 isComposingRef2.value = false; 22964 if (props.ignoreComposition) { 22965 doPatternInput(cachedInputEvent); 22966 } 22967 cachedInputEvent = null; 22968 } 22969 function handlePatternInputFocus(e) { 22970 var _a2; 22971 patternInputFocusedRef.value = true; 22972 (_a2 = props.onPatternFocus) === null || _a2 === void 0 ? void 0 : _a2.call(props, e); 22973 } 22974 function handlePatternInputBlur(e) { 22975 var _a2; 22976 patternInputFocusedRef.value = false; 22977 (_a2 = props.onPatternBlur) === null || _a2 === void 0 ? void 0 : _a2.call(props, e); 22978 } 22979 function blur() { 22980 var _a2, _b; 22981 if (props.filterable) { 22982 patternInputFocusedRef.value = false; 22983 (_a2 = patternInputWrapperRef.value) === null || _a2 === void 0 ? void 0 : _a2.blur(); 22984 (_b = patternInputRef.value) === null || _b === void 0 ? void 0 : _b.blur(); 22985 } else if (props.multiple) { 22986 const { 22987 value: multipleEl 22988 } = multipleElRef; 22989 multipleEl === null || multipleEl === void 0 ? void 0 : multipleEl.blur(); 22990 } else { 22991 const { 22992 value: singleEl 22993 } = singleElRef; 22994 singleEl === null || singleEl === void 0 ? void 0 : singleEl.blur(); 22995 } 22996 } 22997 function focus() { 22998 var _a2, _b, _c; 22999 if (props.filterable) { 23000 patternInputFocusedRef.value = false; 23001 (_a2 = patternInputWrapperRef.value) === null || _a2 === void 0 ? void 0 : _a2.focus(); 23002 } else if (props.multiple) { 23003 (_b = multipleElRef.value) === null || _b === void 0 ? void 0 : _b.focus(); 23004 } else { 23005 (_c = singleElRef.value) === null || _c === void 0 ? void 0 : _c.focus(); 23006 } 23007 } 23008 function focusInput() { 23009 const { 23010 value: patternInputEl 23011 } = patternInputRef; 23012 if (patternInputEl) { 23013 showInputTag(); 23014 patternInputEl.focus(); 23015 } 23016 } 23017 function blurInput() { 23018 const { 23019 value: patternInputEl 23020 } = patternInputRef; 23021 if (patternInputEl) { 23022 patternInputEl.blur(); 23023 } 23024 } 23025 function updateCounter(count) { 23026 const { 23027 value 23028 } = counterRef; 23029 if (value) { 23030 value.setTextContent(`+${count}`); 23031 } 23032 } 23033 function getCounter() { 23034 const { 23035 value 23036 } = counterWrapperRef; 23037 return value; 23038 } 23039 function getTail() { 23040 return patternInputRef.value; 23041 } 23042 let enterTimerId = null; 23043 function clearEnterTimer() { 23044 if (enterTimerId !== null) 23045 window.clearTimeout(enterTimerId); 23046 } 23047 function handleMouseEnterCounter() { 23048 if (props.active) 23049 return; 23050 clearEnterTimer(); 23051 enterTimerId = window.setTimeout(() => { 23052 if (selectedRef.value) { 23053 showTagsPopoverRef.value = true; 23054 } 23055 }, 100); 23056 } 23057 function handleMouseLeaveCounter() { 23058 clearEnterTimer(); 23059 } 23060 function onPopoverUpdateShow(show) { 23061 if (!show) { 23062 clearEnterTimer(); 23063 showTagsPopoverRef.value = false;
23064 } 23065 } 23066 watch(selectedRef, (value) => { 23067 if (!value) { 23068 showTagsPopoverRef.value = false; 23069 } 23070 }); 23071 onMounted(() => { 23072 watchEffect(() => { 23073 const patternInputWrapperEl = patternInputWrapperRef.value; 23074 if (!patternInputWrapperEl) 23075 return; 23076 if (props.disabled) { 23077 patternInputWrapperEl.removeAttribute("tabindex"); 23078 } else { 23079 patternInputWrapperEl.tabIndex = patternInputFocusedRef.value ? -1 : 0; 23080 } 23081 }); 23082 }); 23083 useOnResize(selfRef, props.onResize); 23084 const { 23085 inlineThemeDisabled 23086 } = props; 23087 const cssVarsRef = computed(() => { 23088 const { 23089 size: size2 23090 } = props; 23091 const { 23092 common: { 23093 cubicBezierEaseInOut: cubicBezierEaseInOut2 23094 }, 23095 self: { 23096 borderRadius, 23097 color, 23098 placeholderColor, 23099 textColor, 23100 paddingSingle, 23101 paddingMultiple, 23102 caretColor, 23103 colorDisabled, 23104 textColorDisabled, 23105 placeholderColorDisabled, 23106 colorActive, 23107 boxShadowFocus, 23108 boxShadowActive, 23109 boxShadowHover, 23110 border, 23111 borderFocus, 23112 borderHover, 23113 borderActive, 23114 arrowColor, 23115 arrowColorDisabled, 23116 loadingColor, 23117 // form warning 23118 colorActiveWarning, 23119 boxShadowFocusWarning, 23120 boxShadowActiveWarning, 23121 boxShadowHoverWarning, 23122 borderWarning, 23123 borderFocusWarning, 23124 borderHoverWarning, 23125 borderActiveWarning, 23126 // form error 23127 colorActiveError, 23128 boxShadowFocusError, 23129 boxShadowActiveError, 23130 boxShadowHoverError, 23131 borderError, 23132 borderFocusError, 23133 borderHoverError, 23134 borderActiveError, 23135 // clear 23136 clearColor, 23137 clearColorHover, 23138 clearColorPressed, 23139 clearSize, 23140 // arrow 23141 arrowSize: arrowSize2, 23142 [createKey("height", size2)]: height, 23143 [createKey("fontSize", size2)]: fontSize2 23144 } 23145 } = themeRef.value; 23146 const paddingSingleDiscrete = getMargin(paddingSingle); 23147 const paddingMultipleDiscrete = getMargin(paddingMultiple); 23148 return { 23149 "--n-bezier": cubicBezierEaseInOut2, 23150 "--n-border": border, 23151 "--n-border-active": borderActive, 23152 "--n-border-focus": borderFocus, 23153 "--n-border-hover": borderHover, 23154 "--n-border-radius": borderRadius, 23155 "--n-box-shadow-active": boxShadowActive, 23156 "--n-box-shadow-focus": boxShadowFocus, 23157 "--n-box-shadow-hover": boxShadowHover, 23158 "--n-caret-color": caretColor, 23159 "--n-color": color, 23160 "--n-color-active": colorActive, 23161 "--n-color-disabled": colorDisabled, 23162 "--n-font-size": fontSize2, 23163 "--n-height": height, 23164 "--n-padding-single-top": paddingSingleDiscrete.top, 23165 "--n-padding-multiple-top": paddingMultipleDiscrete.top, 23166 "--n-padding-single-right": paddingSingleDiscrete.right, 23167 "--n-padding-multiple-right": paddingMultipleDiscrete.right, 23168 "--n-padding-single-left": paddingSingleDiscrete.left, 23169 "--n-padding-multiple-left": paddingMultipleDiscrete.left, 23170 "--n-padding-single-bottom": paddingSingleDiscrete.bottom, 23171 "--n-padding-multiple-bottom": paddingMultipleDiscrete.bottom, 23172 "--n-placeholder-color": placeholderColor, 23173 "--n-placeholder-color-disabled": placeholderColorDisabled, 23174 "--n-text-color": textColor, 23175 "--n-text-color-disabled": textColorDisabled, 23176 "--n-arrow-color": arrowColor, 23177 "--n-arrow-color-disabled": arrowColorDisabled, 23178 "--n-loading-color": loadingColor, 23179 // form warning 23180 "--n-color-active-warning": colorActiveWarning, 23181 "--n-box-shadow-focus-warning": boxShadowFocusWarning, 23182 "--n-box-shadow-active-warning": boxShadowActiveWarning, 23183 "--n-box-shadow-hover-warning": boxShadowHoverWarning, 23184 "--n-border-warning": borderWarning, 23185 "--n-border-focus-warning": borderFocusWarning, 23186 "--n-border-hover-warning": borderHoverWarning, 23187 "--n-border-active-warning": borderActiveWarning, 23188 // form error 23189 "--n-color-active-error": colorActiveError,
23190 "--n-box-shadow-focus-error": boxShadowFocusError, 23191 "--n-box-shadow-active-error": boxShadowActiveError, 23192 "--n-box-shadow-hover-error": boxShadowHoverError, 23193 "--n-border-error": borderError, 23194 "--n-border-focus-error": borderFocusError, 23195 "--n-border-hover-error": borderHoverError, 23196 "--n-border-active-error": borderActiveError, 23197 // clear 23198 "--n-clear-size": clearSize, 23199 "--n-clear-color": clearColor, 23200 "--n-clear-color-hover": clearColorHover, 23201 "--n-clear-color-pressed": clearColorPressed, 23202 // arrow-size 23203 "--n-arrow-size": arrowSize2 23204 }; 23205 }); 23206 const themeClassHandle = inlineThemeDisabled ? useThemeClass("internal-selection", computed(() => { 23207 return props.size[0]; 23208 }), cssVarsRef, props) : void 0; 23209 return { 23210 mergedTheme: themeRef, 23211 mergedClearable: mergedClearableRef, 23212 mergedClsPrefix: mergedClsPrefixRef, 23213 rtlEnabled: rtlEnabledRef, 23214 patternInputFocused: patternInputFocusedRef, 23215 filterablePlaceholder: filterablePlaceholderRef, 23216 label: labelRef, 23217 selected: selectedRef, 23218 showTagsPanel: showTagsPopoverRef, 23219 isComposing: isComposingRef2, 23220 // dom ref 23221 counterRef, 23222 counterWrapperRef, 23223 patternInputMirrorRef, 23224 patternInputRef, 23225 selfRef, 23226 multipleElRef, 23227 singleElRef, 23228 patternInputWrapperRef, 23229 overflowRef, 23230 inputTagElRef, 23231 handleMouseDown, 23232 handleFocusin, 23233 handleClear, 23234 handleMouseEnter, 23235 handleMouseLeave, 23236 handleDeleteOption, 23237 handlePatternKeyDown, 23238 handlePatternInputInput, 23239 handlePatternInputBlur, 23240 handlePatternInputFocus, 23241 handleMouseEnterCounter, 23242 handleMouseLeaveCounter, 23243 handleFocusout, 23244 handleCompositionEnd, 23245 handleCompositionStart, 23246 onPopoverUpdateShow, 23247 focus, 23248 focusInput, 23249 blur, 23250 blurInput, 23251 updateCounter, 23252 getCounter, 23253 getTail, 23254 renderLabel: props.renderLabel, 23255 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef, 23256 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 23257 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 23258 }; 23259 }, 23260 render() { 23261 const { 23262 status, 23263 multiple, 23264 size: size2, 23265 disabled, 23266 filterable, 23267 maxTagCount, 23268 bordered, 23269 clsPrefix, 23270 ellipsisTagPopoverProps, 23271 onRender, 23272 renderTag, 23273 renderLabel 23274 } = this; 23275 onRender === null || onRender === void 0 ? void 0 : onRender(); 23276 const maxTagCountResponsive = maxTagCount === "responsive"; 23277 const maxTagCountNumeric = typeof maxTagCount === "number"; 23278 const useMaxTagCount = maxTagCountResponsive || maxTagCountNumeric; 23279 const suffix2 = h(Wrapper, null, { 23280 default: () => h(NBaseSuffix, { 23281 clsPrefix, 23282 loading: this.loading, 23283 showArrow: this.showArrow, 23284 showClear: this.mergedClearable && this.selected, 23285 onClear: this.handleClear 23286 }, { 23287 default: () => { 23288 var _a2, _b; 23289 return (_b = (_a2 = this.$slots).arrow) === null || _b === void 0 ? void 0 : _b.call(_a2); 23290 } 23291 }) 23292 }); 23293 let body; 23294 if (multiple) { 23295 const { 23296 labelField 23297 } = this; 23298 const createTag = (option) => h("div", { 23299 class: `${clsPrefix}-base-selection-tag-wrapper`, 23300 key: option.value 23301 }, renderTag ? renderTag({ 23302 option, 23303 handleClose: () => { 23304 this.handleDeleteOption(option); 23305 } 23306 }) : h(NTag, { 23307 size: size2, 23308 closable: !option.disabled, 23309 disabled, 23310 onClose: () => { 23311 this.handleDeleteOption(option); 23312 }, 23313 internalCloseIsButtonTag: false, 23314 internalCloseFocusable: false 23315 }, { 23316 default: () => renderLabel ? renderLabel(option, true) : render$4(option[labelField], option, true) 23317 })); 23318 const createOriginalTagNodes = () => (maxTagCountNumeric ? this.selectedOptions.slice(0, maxTagCount) : this.selectedOptions).map(createTag); 23319 const input = filterable ? h("div", { 23320 class: `${clsPrefix}-base-selection-input-tag`, 23321 ref: "inputTagElRef", 23322 key: "__input-tag__" 23323 }, h("input", Object.assign({}, this.inputProps, { 23324 ref: "patternInputRef", 23325 tabindex: -1, 23326 disabled, 23327 value: this.pattern, 23328 autofocus: this.autofocus, 23329 class: `${clsPrefix}-base-selection-input-tag__input`, 23330 onBlur: this.handlePatternInputBlur, 23331 onFocus: this.handlePatternInputFocus, 23332 onKeydown: this.handlePatternKeyDown, 23333 onInput: this.handlePatternInputInput, 23334 onCompositionstart: this.handleCompositionStart, 23335 onCompositionend: this.handleCompositionEnd 23336 })), h("span", { 23337 ref: "patternInputMirrorRef", 23338 class: `${clsPrefix}-base-selection-input-tag__mirror` 23339 }, this.pattern)) : null; 23340 const renderCounter = maxTagCountResponsive ? () => h("div", { 23341 class: `${clsPrefix}-base-selection-tag-wrapper`, 23342 ref: "counterWrapperRef" 23343 }, h(NTag, { 23344 size: size2, 23345 ref: "counterRef", 23346 onMouseenter: this.handleMouseEnterCounter, 23347 onMouseleave: this.handleMouseLeaveCounter, 23348 disabled 23349 })) : void 0; 23350 let counter; 23351 if (maxTagCountNumeric) { 23352 const rest = this.selectedOptions.length - maxTagCount; 23353 if (rest > 0) { 23354 counter = h("div", { 23355 class: `${clsPrefix}-base-selection-tag-wrapper`, 23356 key: "__counter__" 23357 }, h(NTag, { 23358 size: size2, 23359 ref: "counterRef", 23360 onMouseenter: this.handleMouseEnterCounter, 23361 disabled 23362 }, { 23363 default: () => `+${rest}` 23364 })); 23365 } 23366 } 23367 const tags = maxTagCountResponsive ? filterable ? h(VOverflow, { 23368 ref: "overflowRef", 23369 updateCounter: this.updateCounter, 23370 getCounter: this.getCounter, 23371 getTail: this.getTail, 23372 style: { 23373 width: "100%", 23374 display: "flex", 23375 overflow: "hidden" 23376 } 23377 }, { 23378 default: createOriginalTagNodes, 23379 counter: renderCounter, 23380 tail: () => input 23381 }) : h(VOverflow, { 23382 ref: "overflowRef", 23383 updateCounter: this.updateCounter, 23384 getCounter: this.getCounter, 23385 style: { 23386 width: "100%", 23387 display: "flex", 23388 overflow: "hidden" 23389 } 23390 }, { 23391 default: createOriginalTagNodes, 23392 counter: renderCounter 23393 }) : maxTagCountNumeric && counter ? createOriginalTagNodes().concat(counter) : createOriginalTagNodes(); 23394 const renderPopover = useMaxTagCount ? () => h("div", { 23395 class: `${clsPrefix}
23395-base-selection-popover` 23396 }, maxTagCountResponsive ? createOriginalTagNodes() : this.selectedOptions.map(createTag)) : void 0; 23397 const popoverProps2 = useMaxTagCount ? Object.assign({ 23398 show: this.showTagsPanel, 23399 trigger: "hover", 23400 overlap: true, 23401 placement: "top", 23402 width: "trigger", 23403 onUpdateShow: this.onPopoverUpdateShow, 23404 theme: this.mergedTheme.peers.Popover, 23405 themeOverrides: this.mergedTheme.peerOverrides.Popover 23406 }, ellipsisTagPopoverProps) : null; 23407 const showPlaceholder = this.selected ? false : this.active ? !this.pattern && !this.isComposing : true; 23408 const placeholder = showPlaceholder ? h("div", { 23409 class: `${clsPrefix}-base-selection-placeholder ${clsPrefix}-base-selection-overlay` 23410 }, h("div", { 23411 class: `${clsPrefix}-base-selection-placeholder__inner` 23412 }, this.placeholder)) : null; 23413 const popoverTrigger = filterable ? h("div", { 23414 ref: "patternInputWrapperRef", 23415 class: `${clsPrefix}-base-selection-tags` 23416 }, tags, maxTagCountResponsive ? null : input, suffix2) : h("div", { 23417 ref: "multipleElRef", 23418 class: `${clsPrefix}-base-selection-tags`, 23419 tabindex: disabled ? void 0 : 0 23420 }, tags, suffix2); 23421 body = h(Fragment, null, useMaxTagCount ? h(NPopover, Object.assign({}, popoverProps2, { 23422 scrollable: true, 23423 style: "max-height: calc(var(--v-target-height) * 6.6);" 23424 }), { 23425 trigger: () => popoverTrigger, 23426 default: renderPopover 23427 }) : popoverTrigger, placeholder); 23428 } else { 23429 if (filterable) { 23430 const hasInput = this.pattern || this.isComposing; 23431 const showPlaceholder = this.active ? !hasInput : !this.selected; 23432 const showSelectedLabel = this.active ? false : this.selected; 23433 body = h("div", { 23434 ref: "patternInputWrapperRef", 23435 class: `${clsPrefix}-base-selection-label`, 23436 title: this.patternInputFocused ? void 0 : getTitleAttribute(this.label) 23437 }, h("input", Object.assign({}, this.inputProps, { 23438 ref: "patternInputRef", 23439 class: `${clsPrefix}-base-selection-input`, 23440 value: this.active ? this.pattern : "", 23441 placeholder: "", 23442 readonly: disabled, 23443 disabled, 23444 tabindex: -1, 23445 autofocus: this.autofocus, 23446 onFocus: this.handlePatternInputFocus, 23447 onBlur: this.handlePatternInputBlur, 23448 onInput: this.handlePatternInputInput, 23449 onCompositionstart: this.handleCompositionStart, 23450 onCompositionend: this.handleCompositionEnd 23451 })), showSelectedLabel ? h("div", { 23452 class: `${clsPrefix}-base-selection-label__render-label ${clsPrefix}-base-selection-overlay`, 23453 key: "input" 23454 }, h("div", { 23455 class: `${clsPrefix}-base-selection-overlay__wrapper` 23456 }, renderTag ? renderTag({ 23457 option: this.selectedOption, 23458 handleClose: () => { 23459 } 23460 }) : renderLabel ? renderLabel(this.selectedOption, true) : render$4(this.label, this.selectedOption, true))) : null, showPlaceholder ? h("div", { 23461 class: `${clsPrefix}-base-selection-placeholder ${clsPrefix}-base-selection-overlay`, 23462 key: "placeholder" 23463 }, h("div", { 23464 class: `${clsPrefix}-base-selection-overlay__wrapper` 23465 }, this.filterablePlaceholder)) : null, suffix2); 23466 } else { 23467 body = h("div", { 23468 ref: "singleElRef", 23469 class: `${clsPrefix}-base-selection-label`, 23470 tabindex: this.disabled ? void 0 : 0 23471 }, this.label !== void 0 ? h("div", { 23472 class: `${clsPrefix}-base-selection-input`, 23473 title: getTitleAttribute(this.label), 23474 key: "input" 23475 }, h("div", { 23476 class: `${clsPrefix}-base-selection-input__content` 23477 }, renderTag ? renderTag({ 23478 option: this.selectedOption, 23479 handleClose: () => { 23480 } 23481 }) : renderLabel ? renderLabel(this.selectedOption, true) : render$4(this.label, this.selectedOption, true))) : h("div", { 23482 class: `${clsPrefix}
23482-base-selection-placeholder ${clsPrefix}-base-selection-overlay`, 23483 key: "placeholder" 23484 }, h("div", { 23485 class: `${clsPrefix}-base-selection-placeholder__inner` 23486 }, this.placeholder)), suffix2); 23487 } 23488 } 23489 return h("div", { 23490 ref: "selfRef", 23491 class: [`${clsPrefix}-base-selection`, this.rtlEnabled && `${clsPrefix}-base-selection--rtl`, this.themeClass, status && `${clsPrefix}-base-selection--${status}-status`, { 23492 [`${clsPrefix}-base-selection--active`]: this.active, 23493 [`${clsPrefix}-base-selection--selected`]: this.selected || this.active && this.pattern, 23494 [`${clsPrefix}-base-selection--disabled`]: this.disabled, 23495 [`${clsPrefix}-base-selection--multiple`]: this.multiple, 23496 // focus is not controlled by selection itself since it always need 23497 // to be managed together with menu. provide :focus style will cause 23498 // many redundant codes. 23499 [`${clsPrefix}-base-selection--focus`]: this.focused 23500 }], 23501 style: this.cssVars, 23502 onClick: this.onClick, 23503 onMouseenter: this.handleMouseEnter, 23504 onMouseleave: this.handleMouseLeave, 23505 onKeydown: this.onKeydown, 23506 onFocusin: this.handleFocusin, 23507 onFocusout: this.handleFocusout, 23508 onMousedown: this.handleMouseDown 23509 }, body, bordered ? h("div", { 23510 class: `${clsPrefix}-base-selection__border` 23511 }) : null, bordered ? h("div", { 23512 class: `${clsPrefix}-base-selection__state-border` 23513 }) : null); 23514 } 23515}); 23516const { 23517 cubicBezierEaseInOut: cubicBezierEaseInOut$2 23518} = commonVariables$8; 23519function fadeInWidthExpandTransition({ 23520 duration: duration2 = ".2s", 23521 delay = ".1s" 23522} = {}) { 23523 return [c$1("&.fade-in-width-expand-transition-leave-from, &.fade-in-width-expand-transition-enter-to", { 23524 opacity: 1 23525 }), c$1("&.fade-in-width-expand-transition-leave-to, &.fade-in-width-expand-transition-enter-from", ` 23526 opacity: 0!important; 23527 margin-left: 0!important; 23528 margin-right: 0!important; 23529 `), c$1("&.fade-in-width-expand-transition-leave-active", ` 23530 overflow: hidden; 23531 transition:
23532 opacity ${duration2} ${cubicBezierEaseInOut$2}, 23533 max-width ${duration2} ${cubicBezierEaseInOut$2} ${delay}, 23534 margin-left ${duration2} ${cubicBezierEaseInOut$2} ${delay}, 23535 margin-right ${duration2} ${cubicBezierEaseInOut$2} ${delay}; 23536 `), c$1("&.fade-in-width-expand-transition-enter-active", ` 23537 overflow: hidden; 23538 transition: 23539 opacity ${duration2} ${cubicBezierEaseInOut$2} ${delay}, 23540 max-width ${duration2} ${cubicBezierEaseInOut$2}, 23541 margin-left ${duration2} ${cubicBezierEaseInOut$2}, 23542 margin-right ${duration2} ${cubicBezierEaseInOut$2}; 23543 `)]; 23544} 23545const { 23546 cubicBezierEaseInOut: cubicBezierEaseInOut$1, 23547 cubicBezierEaseOut, 23548 cubicBezierEaseIn 23549} = commonVariables$8; 23550function fadeInHeightExpandTransition({ 23551 overflow = "hidden", 23552 duration: duration2 = ".3s", 23553 originalTransition = "", 23554 leavingDelay = "0s", 23555 foldPadding = false, 23556 enterToProps = void 0, 23557 leaveToProps = void 0, 23558 reverse = false 23559} = {}) { 23560 const enterClass = reverse ? "leave" : "enter"; 23561 const leaveClass = reverse ? "enter" : "leave"; 23562 return [c$1(`&.fade-in-height-expand-transition-${leaveClass}-from, 23563 &.fade-in-height-expand-transition-${enterClass}-to`, Object.assign(Object.assign({}, enterToProps), { 23564 opacity: 1 23565 })), c$1(`&.fade-in-height-expand-transition-${leaveClass}-to, 23566 &.fade-in-height-expand-transition-${enterClass}-from`, Object.assign(Object.assign({}, leaveToProps), { 23567 opacity: 0, 23568 marginTop: "0 !important", 23569 marginBottom: "0 !important", 23570 paddingTop: foldPadding ? "0 !important" : void 0, 23571 paddingBottom: foldPadding ? "0 !important" : void 0 23572 })), c$1(`&.fade-in-height-expand-transition-${leaveClass}-active`, ` 23573 overflow: ${overflow}; 23574 transition: 23575 max-height ${duration2} ${cubicBezierEaseInOut$1} ${leavingDelay}, 23576 opacity ${duration2} ${cubicBezierEaseOut} ${leavingDelay}, 23577 margin-top ${duration2} ${cubicBezierEaseInOut$1} ${leavingDelay}, 23578 margin-bottom ${duration2} ${cubicBezierEaseInOut$1} ${leavingDelay}, 23579 padding-top ${duration2} ${cubicBezierEaseInOut$1} ${leavingDelay}, 23580 padding-bottom ${duration2} ${cubicBezierEaseInOut$1} ${leavingDelay} 23581 ${originalTransition ? "," + originalTransition : ""} 23582 `), c$1(`&.fade-in-height-expand-transition-${enterClass}-active`, ` 23583 overflow: ${overflow}; 23584 transition: 23585 max-height ${duration2} ${cubicBezierEaseInOut$1}, 23586 opacity ${duration2} ${cubicBezierEaseIn}, 23587 margin-top ${duration2} ${cubicBezierEaseInOut$1}, 23588 margin-bottom ${duration2} ${cubicBezierEaseInOut$1}, 23589 padding-top ${duration2} ${cubicBezierEaseInOut$1}, 23590 padding-bottom ${duration2} ${cubicBezierEaseInOut$1} 23591 ${originalTransition ? "," + originalTransition : ""} 23592 `)]; 23593} 23594function getIsGroup(option) { 23595 return option.type === "group"; 23596} 23597function getIgnored(option) { 23598 return option.type === "ignored"; 23599} 23600function patternMatched(pattern4, value) { 23601 try { 23602 return !!(1 + value.toString().toLowerCase().indexOf(pattern4.trim().toLowerCase())); 23603 } catch (err) { 23604 return false; 23605 } 23606} 23607function createTmOptions(valueField, childrenField) { 23608 const options = { 23609 getIsGroup, 23610 getIgnored, 23611 getKey(option) { 23612 if (getIsGroup(option)) { 23613 return option.name || option.key || "key-required"; 23614 } 23615 return option[valueField]; 23616 }, 23617 getChildren(option) { 23618 return option[childrenField]; 23619 } 23620 }; 23621 return options; 23622} 23623function filterOptions(originalOpts, filter, pattern4, childrenField) { 23624 if (!filter) 23625 return originalOpts; 23626 function traverse2(options) { 23627 if (!Array.isArray(options)) 23628 return []; 23629 const filteredOptions = []; 23630 for (const option of options) { 23631 if (getIsGroup(option)) { 23632 const children = traverse2(option[childrenField]); 23633 if (children.length) { 23634 filteredOptions.push(Object.assign({}, option, { 23635 [childrenField]: children 23636 })); 23637 } 23638 } else if (getIgnored(option)) { 23639 continue; 23640 } else if (filter(pattern4, option)) { 23641 filteredOptions.push(option); 23642 } 23643 } 23644 return filteredOptions; 23645 } 23646 return traverse2(originalOpts); 23647} 23648function createValOptMap(options, valueField, childrenField) { 23649 const valOptMap = /* @__PURE__ */ new Map(); 23650 options.forEach((option) => { 23651 if (getIsGroup(option)) {
23652 option[childrenField].forEach((selectGroupOption) => { 23653 valOptMap.set(selectGroupOption[valueField], selectGroupOption); 23654 }); 23655 } else { 23656 valOptMap.set(option[valueField], option); 23657 } 23658 }); 23659 return valOptMap; 23660} 23661const isChrome = isBrowser$2 && "chrome" in window; 23662isBrowser$2 && navigator.userAgent.includes("Firefox"); 23663const isSafari = isBrowser$2 && navigator.userAgent.includes("Safari") && !isChrome; 23664const commonVariables$4 = { 23665 paddingTiny: "0 8px", 23666 paddingSmall: "0 10px", 23667 paddingMedium: "0 12px", 23668 paddingLarge: "0 14px", 23669 clearSize: "16px" 23670}; 23671const self$d = (vars) => { 23672 const { 23673 textColor2, 23674 textColor3, 23675 textColorDisabled, 23676 primaryColor, 23677 primaryColorHover, 23678 inputColor, 23679 inputColorDisabled, 23680 borderColor, 23681 warningColor, 23682 warningColorHover, 23683 errorColor, 23684 errorColorHover, 23685 borderRadius, 23686 lineHeight: lineHeight2, 23687 fontSizeTiny, 23688 fontSizeSmall, 23689 fontSizeMedium, 23690 fontSizeLarge, 23691 heightTiny, 23692 heightSmall, 23693 heightMedium, 23694 heightLarge, 23695 actionColor, 23696 clearColor, 23697 clearColorHover, 23698 clearColorPressed, 23699 placeholderColor, 23700 placeholderColorDisabled, 23701 iconColor, 23702 iconColorDisabled, 23703 iconColorHover, 23704 iconColorPressed 23705 } = vars; 23706 return Object.assign(Object.assign({}, commonVariables$4), { 23707 countTextColorDisabled: textColorDisabled, 23708 countTextColor: textColor3, 23709 heightTiny, 23710 heightSmall, 23711 heightMedium, 23712 heightLarge, 23713 fontSizeTiny, 23714 fontSizeSmall, 23715 fontSizeMedium, 23716 fontSizeLarge, 23717 lineHeight: lineHeight2, 23718 lineHeightTextarea: lineHeight2, 23719 borderRadius, 23720 iconSize: "16px", 23721 groupLabelColor: actionColor, 23722 groupLabelTextColor: textColor2, 23723 textColor: textColor2, 23724 textColorDisabled, 23725 textDecorationColor: textColor2, 23726 caretColor: primaryColor, 23727 placeholderColor, 23728 placeholderColorDisabled, 23729 color: inputColor, 23730 colorDisabled: inputColorDisabled, 23731 colorFocus: inputColor, 23732 groupLabelBorder: `1px solid ${borderColor}`, 23733 border: `1px solid ${borderColor}`, 23734 borderHover: `1px solid ${primaryColorHover}`, 23735 borderDisabled: `1px solid ${borderColor}`, 23736 borderFocus: `1px solid ${primaryColorHover}`, 23737 boxShadowFocus: `0 0 0 2px ${changeColor(primaryColor, { 23738 alpha: 0.2 23739 })}`, 23740 loadingColor: primaryColor, 23741 // warning 23742 loadingColorWarning: warningColor, 23743 borderWarning: `1px solid ${warningColor}`, 23744 borderHoverWarning: `1px solid ${warningColorHover}`, 23745 colorFocusWarning: inputColor, 23746 borderFocusWarning: `1px solid ${warningColorHover}`, 23747 boxShadowFocusWarning: `0 0 0 2px ${changeColor(warningColor, { 23748 alpha: 0.2 23749 })}`, 23750 caretColorWarning: warningColor, 23751 // error 23752 loadingColorError: errorColor, 23753 borderError: `1px solid ${errorColor}`, 23754 borderHoverError: `1px solid ${errorColorHover}`, 23755 colorFocusError: inputColor, 23756 borderFocusError: `1px solid ${errorColorHover}`, 23757 boxShadowFocusError: `0 0 0 2px ${changeColor(errorColor, { 23758 alpha: 0.2 23759 })}`, 23760 caretColorError: errorColor, 23761 clearColor, 23762 clearColorHover, 23763 clearColorPressed, 23764 iconColor, 23765 iconColorDisabled, 23766 iconColorHover, 23767 iconColorPressed, 23768 suffixTextColor: textColor2 23769 }); 23770}; 23771const inputLight = { 23772 name: "Input", 23773 common: commonLight, 23774 self: self$d 23775}; 23776const inputLight$1 = inputLight; 23777const inputInjectionKey = createInjectionKey("n-input"); 23778function len(s2) { 23779 let count = 0; 23780 for (const _ of s2) { 23781 count++; 23782 } 23783 return count; 23784} 23785function isEmptyInputValue(value) { 23786 return value === "" || value == null; 23787} 23788function useCursor(inputElRef) { 23789 const selectionRef = ref(null); 23790 function recordCursor() { 23791 const { 23792 value: input 23793 } = inputElRef; 23794 if (!(input === null || input === void 0 ? void 0 : input.focus)) { 23795 reset(); 23796 return; 23797 } 23798 const { 23799 selectionStart, 23800 selectionEnd, 23801 value 23802 } = input; 23803 if (selectionStart == null || selectionEnd == null) { 23804 reset(); 23805 return; 23806 } 23807 selectionRef.value = { 23808 start: selectionStart, 23809 end: selectionEnd, 23810 beforeText: value.slice(0, selectionStart), 23811 afterText: value.slice(selectionEnd) 23812 }; 23813 }
23814 function restoreCursor() { 23815 var _a2; 23816 const { 23817 value: selection 23818 } = selectionRef; 23819 const { 23820 value: inputEl 23821 } = inputElRef; 23822 if (!selection || !inputEl) { 23823 return; 23824 } 23825 const { 23826 value 23827 } = inputEl; 23828 const { 23829 start, 23830 beforeText, 23831 afterText 23832 } = selection; 23833 let startPos = value.length; 23834 if (value.endsWith(afterText)) { 23835 startPos = value.length - afterText.length; 23836 } else if (value.startsWith(beforeText)) { 23837 startPos = beforeText.length; 23838 } else { 23839 const beforeLastChar = beforeText[start - 1]; 23840 const newIndex = value.indexOf(beforeLastChar, start - 1); 23841 if (newIndex !== -1) { 23842 startPos = newIndex + 1; 23843 } 23844 } 23845 (_a2 = inputEl.setSelectionRange) === null || _a2 === void 0 ? void 0 : _a2.call(inputEl, startPos, startPos); 23846 } 23847 function reset() { 23848 selectionRef.value = null; 23849 } 23850 watch(inputElRef, reset); 23851 return { 23852 recordCursor, 23853 restoreCursor 23854 }; 23855} 23856const WordCount = defineComponent({ 23857 name: "InputWordCount", 23858 setup(_, { 23859 slots 23860 }) { 23861 const { 23862 mergedValueRef, 23863 maxlengthRef, 23864 mergedClsPrefixRef, 23865 countGraphemesRef 23866 } = ( 23867 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion 23868 inject(inputInjectionKey) 23869 ); 23870 const wordCountRef = computed(() => { 23871 const { 23872 value: mergedValue 23873 } = mergedValueRef; 23874 if (mergedValue === null || Array.isArray(mergedValue)) 23875 return 0; 23876 return (countGraphemesRef.value || len)(mergedValue); 23877 }); 23878 return () => { 23879 const { 23880 value: maxlength 23881 } = maxlengthRef; 23882 const { 23883 value: mergedValue 23884 } = mergedValueRef; 23885 return h("span", { 23886 class: `${mergedClsPrefixRef.value}-input-word-count` 23887 }, resolveSlotWithProps(slots.default, { 23888 value: mergedValue === null || Array.isArray(mergedValue) ? "" : mergedValue 23889 }, () => [maxlength === void 0 ? wordCountRef.value : `${wordCountRef.value} / ${maxlength}`])); 23890 }; 23891 } 23892}); 23893const style$c = cB("input", ` 23894 max-width: 100%; 23895 cursor: text; 23896 line-height: 1.5; 23897 z-index: auto; 23898 outline: none; 23899 box-sizing: border-box; 23900 position: relative; 23901 display: inline-flex; 23902 border-radius: var(--n-border-radius); 23903 background-color: var(--n-color); 23904 transition: background-color .3s var(--n-bezier); 23905 font-size: var(--n-font-size); 23906 --n-padding-vertical: calc((var(--n-height) - 1.5 * var(--n-font-size)) / 2); 23907`, [ 23908 // common 23909 cE("input, textarea", ` 23910 overflow: hidden; 23911 flex-grow: 1; 23912 position: relative; 23913 `), 23914 cE("input-el, textarea-el, input-mirror, textarea-mirror, separator, placeholder", ` 23915 box-sizing: border-box; 23916 font-size: inherit; 23917 line-height: 1.5; 23918 font-family: inherit; 23919 border: none; 23920 outline: none; 23921 background-color: #0000; 23922 text-align: inherit; 23923 transition: 23924 -webkit-text-fill-color .3s var(--n-bezier), 23925 caret-color .3s var(--n-bezier), 23926 color .3s var(--n-bezier), 23927 text-decoration-color .3s var(--n-bezier); 23928 `), 23929 cE("input-el, textarea-el", ` 23930 -webkit-appearance: none; 23931 scrollbar-width: none; 23932 width: 100%; 23933 min-width: 0; 23934 text-decoration-color: var(--n-text-decoration-color); 23935 color: var(--n-text-color); 23936 caret-color: var(--n-caret-color); 23937 background-color: transparent; 23938 `, [c$1("&::-webkit-scrollbar, &::-webkit-scrollbar-track-piece, &::-webkit-scrollbar-thumb", ` 23939 width: 0; 23940 height: 0; 23941 display: none; 23942 `), c$1("&::placeholder", ` 23943 color: #0000; 23944 -webkit-text-fill-color: transparent !important; 23945 `), c$1("&:-webkit-autofill ~", [cE("placeholder", "display: none;")])]), 23946 cM("round", [cNotM("textarea", "border-radius: calc(var(--n-height) / 2);")]), 23947 cE("placeholder", ` 23948 pointer-events: none; 23949 position: absolute; 23950 left: 0; 23951 right: 0; 23952 top: 0; 23953 bottom: 0; 23954 overflow: hidden; 23955 color: var(--n-placeholder-color); 23956 `, [c$1("span", ` 23957 width: 100%; 23958 display: inline-block; 23959 `)]), 23960 cM("textarea", [cE("placeholder", "overflow: visible;")]), 23961 cNotM("autosize", "width: 100%;"), 23962 cM("autosize", [cE("textarea-el, input-el", ` 23963 position: absolute; 23964 top: 0; 23965 left: 0; 23966 height: 100%; 23967 `)]), 23968 // input 23969 cB("input-wrapper", ` 23970 overflow: hidden; 23971 display: inline-flex; 23972 flex-grow: 1; 23973 position: relative; 23974 padding-left: var(--n-padding-left); 23975 padding-right: var(--n-padding-right); 23976 `), 23977 cE("input-mirror", ` 23978 padding: 0; 23979 height: var(--n-height); 23980 line-height: var(--n-height); 23981 overflow: hidden; 23982 visibility: hidden; 23983 position: static; 23984 white-space: pre; 23985 pointer-events: none; 23986 `), 23987 cE("input-el", ` 23988 padding: 0; 23989 height: var(--n-height); 23990 line-height: var(--n-height); 23991 `, [c$1("&[type=password]::-ms-reveal", "display: none;"), c$1("+", [cE("placeholder", ` 23992 display: flex; 23993 align-items: center; 23994 `)])]), 23995 cNotM("textarea", [cE("placeholder", "white-space: nowrap;")]), 23996 cE("eye", ` 23997 display: flex; 23998 align-items: center; 23999 justify-content: center; 24000 transition: color .3s var(--n-bezier); 24001 `), 24002 // textarea 24003 cM("textarea", "width: 100%;", [cB("input-word-count", ` 24004 position: absolute; 24005 right: var(--n-padding-right); 24006 bottom: var(--n-padding-vertical); 24007 `), cM("resizable", [cB("input-wrapper", ` 24008 resize: vertical; 24009 min-height: var(--n-height);
24010 `)]), cE("textarea-el, textarea-mirror, placeholder", ` 24011 height: 100%; 24012 padding-left: 0; 24013 padding-right: 0; 24014 padding-top: var(--n-padding-vertical); 24015 padding-bottom: var(--n-padding-vertical); 24016 word-break: break-word; 24017 display: inline-block; 24018 vertical-align: bottom; 24019 box-sizing: border-box; 24020 line-height: var(--n-line-height-textarea); 24021 margin: 0; 24022 resize: none; 24023 white-space: pre-wrap; 24024 scroll-padding-block-end: var(--n-padding-vertical); 24025 `), cE("textarea-mirror", ` 24026 width: 100%; 24027 pointer-events: none; 24028 overflow: hidden; 24029 visibility: hidden; 24030 position: static; 24031 white-space: pre-wrap; 24032 overflow-wrap: break-word; 24033 `)]), 24034 // pair 24035 cM("pair", [cE("input-el, placeholder", "text-align: center;"), cE("separator", ` 24036 display: flex; 24037 align-items: center; 24038 transition: color .3s var(--n-bezier); 24039 color: var(--n-text-color); 24040 white-space: nowrap; 24041 `, [cB("icon", ` 24042 color: var(--n-icon-color); 24043 `), cB("base-icon", ` 24044 color: var(--n-icon-color); 24045 `)])]), 24046 cM("disabled", ` 24047 cursor: not-allowed; 24048 background-color: var(--n-color-disabled); 24049 `, [cE("border", "border: var(--n-border-disabled);"), cE("input-el, textarea-el", ` 24050 cursor: not-allowed; 24051 color: var(--n-text-color-disabled); 24052 text-decoration-color: var(--n-text-color-disabled); 24053 `), cE("placeholder", "color: var(--n-placeholder-color-disabled);"), cE("separator", "color: var(--n-text-color-disabled);", [cB("icon", ` 24054 color: var(--n-icon-color-disabled); 24055 `), cB("base-icon", ` 24056 color: var(--n-icon-color-disabled); 24057 `)]), cB("input-word-count", ` 24058 color: var(--n-count-text-color-disabled); 24059 `), cE("suffix, prefix", "color: var(--n-text-color-disabled);", [cB("icon", ` 24060 color: var(--n-icon-color-disabled); 24061 `), cB("internal-icon", ` 24062 color: var(--n-icon-color-disabled); 24063 `)])]), 24064 cNotM("disabled", [cE("eye", ` 24065 color: var(--n-icon-color); 24066 cursor: pointer; 24067 `, [c$1("&:hover", ` 24068 color: var(--n-icon-color-hover); 24069 `), c$1("&:active", ` 24070 color: var(--n-icon-color-pressed); 24071 `)]), c$1("&:hover", [cE("state-border", "border: var(--n-border-hover);")]), cM("focus", "background-color: var(--n-color-focus);", [cE("state-border", ` 24072 border: var(--n-border-focus); 24073 box-shadow: var(--n-box-shadow-focus); 24074 `)])]), 24075 cE("border, state-border", ` 24076 box-sizing: border-box; 24077 position: absolute; 24078 left: 0; 24079 right: 0; 24080 top: 0; 24081 bottom: 0; 24082 pointer-events: none; 24083 border-radius: inherit; 24084 border: var(--n-border); 24085 transition: 24086 box-shadow .3s var(--n-bezier), 24087 border-color .3s var(--n-bezier); 24088 `), 24089 cE("state-border", ` 24090 border-color: #0000; 24091 z-index: 1; 24092 `), 24093 cE("prefix", "margin-right: 4px;"), 24094 cE("suffix", ` 24095 margin-left: 4px; 24096 `), 24097 cE("suffix, prefix", ` 24098 transition: color .3s var(--n-bezier); 24099 flex-wrap: nowrap; 24100 flex-shrink: 0; 24101 line-height: var(--n-height); 24102 white-space: nowrap; 24103 display: inline-flex; 24104 align-items: center; 24105 justify-content: center; 24106 color: var(--n-suffix-text-color); 24107 `, [cB("base-loading", ` 24108 font-size: var(--n-icon-size); 24109 margin: 0 2px; 24110 color: var(--n-loading-color); 24111 `), cB("base-clear", ` 24112 font-size: var(--n-icon-size); 24113 `, [cE("placeholder", [cB("base-icon", ` 24114 transition: color .3s var(--n-bezier); 24115 color: var(--n-icon-color); 24116 font-size: var(--n-icon-size); 24117 `)])]), c$1(">", [cB("icon", ` 24118 transition: color .3s var(--n-bezier); 24119 color: var(--n-icon-color); 24120 font-size: var(--n-icon-size); 24121 `)]), cB("base-icon", ` 24122 font-size: var(--n-icon-size); 24123 `)]), 24124 cB("input-word-count", ` 24125 pointer-events: none; 24126 line-height: 1.5; 24127 font-size: .85em; 24128 color: var(--n-count-text-color); 24129 transition: color .3s var(--n-bezier); 24130 margin-left: 4px; 24131 font-variant: tabular-nums; 24132 `), 24133 ["warning", "error"].map((status) => cM(`${status}-status`, [cNotM("disabled", [cB("base-loading", ` 24134 color: var(--n-loading-color-${status}) 24135 `), cE("input-el, textarea-el", ` 24136 caret-color: var(--n-caret-color-${status}); 24137 `), cE("state-border", ` 24138 border: var(--n-border-${status}); 24139 `), c$1("&:hover", [cE("state-border", ` 24140 border: var(--n-border-hover-${status}); 24141 `)]), c$1("&:focus", ` 24142 background-color: var(--n-color-focus-${status}); 24143 `, [cE("state-border", ` 24144 box-shadow: var(--n-box-shadow-focus-${status}); 24145 border: var(--n-border-focus-${status}); 24146 `)]), cM("focus", ` 24147 background-color: var(--n-color-focus-${status}); 24148 `, [cE("state-border", `
24149 box-shadow: var(--n-box-shadow-focus-${status}); 24150 border: var(--n-border-focus-${status}); 24151 `)])])])) 24152]); 24153const safariStyle = cB("input", [cM("disabled", [cE("input-el, textarea-el", ` 24154 -webkit-text-fill-color: var(--n-text-color-disabled); 24155 `)])]); 24156const inputProps = Object.assign(Object.assign({}, useTheme.props), { 24157 bordered: { 24158 type: Boolean, 24159 default: void 0 24160 }, 24161 type: { 24162 type: String, 24163 default: "text" 24164 }, 24165 placeholder: [Array, String], 24166 defaultValue: { 24167 type: [String, Array], 24168 default: null 24169 }, 24170 value: [String, Array], 24171 disabled: { 24172 type: Boolean, 24173 default: void 0 24174 }, 24175 size: String, 24176 rows: { 24177 type: [Number, String], 24178 default: 3 24179 }, 24180 round: Boolean, 24181 minlength: [String, Number], 24182 maxlength: [String, Number], 24183 clearable: Boolean, 24184 autosize: { 24185 type: [Boolean, Object], 24186 default: false 24187 }, 24188 pair: Boolean, 24189 separator: String, 24190 readonly: { 24191 type: [String, Boolean], 24192 default: false 24193 }, 24194 passivelyActivated: Boolean, 24195 showPasswordOn: String, 24196 stateful: { 24197 type: Boolean, 24198 default: true 24199 }, 24200 autofocus: Boolean, 24201 inputProps: Object, 24202 resizable: { 24203 type: Boolean, 24204 default: true 24205 }, 24206 showCount: Boolean, 24207 loading: { 24208 type: Boolean, 24209 default: void 0 24210 }, 24211 allowInput: Function, 24212 renderCount: Function, 24213 onMousedown: Function, 24214 onKeydown: Function, 24215 onKeyup: [Function, Array], 24216 onInput: [Function, Array], 24217 onFocus: [Function, Array], 24218 onBlur: [Function, Array], 24219 onClick: [Function, Array], 24220 onChange: [Function, Array], 24221 onClear: [Function, Array], 24222 countGraphemes: Function, 24223 status: String, 24224 "onUpdate:value": [Function, Array], 24225 onUpdateValue: [Function, Array], 24226 /** private */ 24227 textDecoration: [String, Array], 24228 attrSize: { 24229 type: Number, 24230 default: 20 24231 }, 24232 onInputBlur: [Function, Array], 24233 onInputFocus: [Function, Array], 24234 onDeactivate: [Function, Array], 24235 onActivate: [Function, Array], 24236 onWrapperFocus: [Function, Array], 24237 onWrapperBlur: [Function, Array], 24238 internalDeactivateOnEnter: Boolean, 24239 internalForceFocus: Boolean, 24240 internalLoadingBeforeSuffix: { 24241 type: Boolean, 24242 default: true 24243 }, 24244 /** deprecated */ 24245 showPasswordToggle: Boolean 24246}); 24247const NInput = defineComponent({ 24248 name: "Input", 24249 props: inputProps, 24250 setup(props) { 24251 const { 24252 mergedClsPrefixRef, 24253 mergedBorderedRef, 24254 inlineThemeDisabled, 24255 mergedRtlRef 24256 } = useConfig(props); 24257 const themeRef = useTheme("Input", "-input", style$c, inputLight$1, props, mergedClsPrefixRef); 24258 if (isSafari) { 24259 useStyle("-input-safari", safariStyle, mergedClsPrefixRef); 24260 } 24261 const wrapperElRef = ref(null); 24262 const textareaElRef = ref(null); 24263 const textareaMirrorElRef = ref(null); 24264 const inputMirrorElRef = ref(null); 24265 const inputElRef = ref(null); 24266 const inputEl2Ref = ref(null); 24267 const currentFocusedInputRef = ref(null); 24268 const focusedInputCursorControl = useCursor(currentFocusedInputRef); 24269 const textareaScrollbarInstRef = ref(null); 24270 const { 24271 localeRef 24272 } = useLocale("Input"); 24273 const uncontrolledValueRef = ref(props.defaultValue); 24274 const controlledValueRef = toRef(props, "value"); 24275 const mergedValueRef = useMergedState(controlledValueRef, uncontrolledValueRef); 24276 const formItem = useFormItem(props); 24277 const { 24278 mergedSizeRef, 24279 mergedDisabledRef, 24280 mergedStatusRef 24281 } = formItem; 24282 const focusedRef = ref(false); 24283 const hoverRef = ref(false); 24284 const isComposingRef2 = ref(false); 24285 const activatedRef = ref(false); 24286 let syncSource = null; 24287 const mergedPlaceholderRef = computed(() => { 24288 const { 24289 placeholder, 24290 pair 24291 } = props; 24292 if (pair) { 24293 if (Array.isArray(placeholder)) { 24294 return placeholder; 24295 } else if (placeholder === void 0) { 24296 return ["", ""]; 24297 } 24298 return [placeholder, placeholder]; 24299 } else if (placeholder === void 0) { 24300 return [localeRef.value.placeholder]; 24301 } else { 24302 return [placeholder]; 24303 } 24304 }); 24305 const showPlaceholder1Ref = computed(() => { 24306 const { 24307 value: isComposing 24308 } = isComposingRef2; 24309 const { 24310 value: mergedValue 24311 } = mergedValueRef; 24312 const { 24313 value: mergedPlaceholder 24314 } = mergedPlaceholderRef; 24315 return !isComposing && (isEmptyInputValue(mergedValue) || Array.isArray(mergedValue) && isEmptyInputValue(mergedValue[0])) && mergedPlaceholder[0]; 24316 }); 24317 const showPlaceholder2Ref = computed(() => { 24318 const { 24319 value: isComposing 24320 } = isComposingRef2; 24321 const { 24322 value: mergedValue 24323 } = mergedValueRef; 24324 const { 24325 value: mergedPlaceholder 24326 } = mergedPlaceholderRef; 24327 return !isComposing && mergedPlaceholder[1] && (isEmptyInputValue(mergedValue) || Array.isArray(mergedValue) && isEmptyInputValue(mergedValue[1])); 24328 }); 24329 const mergedFocusRef = useMemo(() => { 24330 return props.internalForceFocus || focusedRef.value; 24331 }); 24332 const showClearButton = useMemo(() => { 24333 if (mergedDisabledRef.value || props.readonly || !props.clearable || !mergedFocusRef.value && !hoverRef.value) { 24334 return false;
24335 } 24336 const { 24337 value: mergedValue 24338 } = mergedValueRef; 24339 const { 24340 value: mergedFocus 24341 } = mergedFocusRef; 24342 if (props.pair) { 24343 return !!(Array.isArray(mergedValue) && (mergedValue[0] || mergedValue[1])) && (hoverRef.value || mergedFocus); 24344 } else { 24345 return !!mergedValue && (hoverRef.value || mergedFocus); 24346 } 24347 }); 24348 const mergedShowPasswordOnRef = computed(() => { 24349 const { 24350 showPasswordOn 24351 } = props; 24352 if (showPasswordOn) { 24353 return showPasswordOn; 24354 } 24355 if (props.showPasswordToggle) 24356 return "click"; 24357 return void 0; 24358 }); 24359 const passwordVisibleRef = ref(false); 24360 const textDecorationStyleRef = computed(() => { 24361 const { 24362 textDecoration 24363 } = props; 24364 if (!textDecoration) 24365 return ["", ""]; 24366 if (Array.isArray(textDecoration)) { 24367 return textDecoration.map((v) => ({ 24368 textDecoration: v 24369 })); 24370 } 24371 return [{ 24372 textDecoration 24373 }]; 24374 }); 24375 const textAreaScrollContainerWidthRef = ref(void 0); 24376 const updateTextAreaStyle = () => { 24377 var _a2, _b; 24378 if (props.type === "textarea") { 24379 const { 24380 autosize 24381 } = props; 24382 if (autosize) { 24383 textAreaScrollContainerWidthRef.value = (_b = (_a2 = textareaScrollbarInstRef.value) === null || _a2 === void 0 ? void 0 : _a2.$el) === null || _b === void 0 ? void 0 : _b.offsetWidth; 24384 } 24385 if (!textareaElRef.value) 24386 return; 24387 if (typeof autosize === "boolean") 24388 return; 24389 const { 24390 paddingTop: stylePaddingTop, 24391 paddingBottom: stylePaddingBottom, 24392 lineHeight: styleLineHeight 24393 } = window.getComputedStyle(textareaElRef.value); 24394 const paddingTop = Number(stylePaddingTop.slice(0, -2)); 24395 const paddingBottom = Number(stylePaddingBottom.slice(0, -2)); 24396 const lineHeight2 = Number(styleLineHeight.slice(0, -2)); 24397 const { 24398 value: textareaMirrorEl 24399 } = textareaMirrorElRef; 24400 if (!textareaMirrorEl) 24401 return; 24402 if (autosize.minRows) { 24403 const minRows = Math.max(autosize.minRows, 1); 24404 const styleMinHeight = `${paddingTop + paddingBottom + lineHeight2 * minRows}px`; 24405 textareaMirrorEl.style.minHeight = styleMinHeight; 24406 } 24407 if (autosize.maxRows) { 24408 const styleMaxHeight = `${paddingTop + paddingBottom + lineHeight2 * autosize.maxRows}px`; 24409 textareaMirrorEl.style.maxHeight = styleMaxHeight; 24410 } 24411 } 24412 }; 24413 const maxlengthRef = computed(() => { 24414 const { 24415 maxlength 24416 } = props; 24417 return maxlength === void 0 ? void 0 : Number(maxlength); 24418 }); 24419 onMounted(() => { 24420 const { 24421 value 24422 } = mergedValueRef; 24423 if (!Array.isArray(value)) { 24424 syncMirror(value); 24425 } 24426 }); 24427 const vm = getCurrentInstance().proxy; 24428 function doUpdateValue(value, meta) { 24429 const { 24430 onUpdateValue, 24431 "onUpdate:value": _onUpdateValue, 24432 onInput 24433 } = props; 24434 const { 24435 nTriggerFormInput 24436 } = formItem; 24437 if (onUpdateValue) 24438 call(onUpdateValue, value, meta); 24439 if (_onUpdateValue) 24440 call(_onUpdateValue, value, meta); 24441 if (onInput) 24442 call(onInput, value, meta); 24443 uncontrolledValueRef.value = value; 24444 nTriggerFormInput(); 24445 } 24446 function doChange(value, meta) { 24447 const { 24448 onChange 24449 } = props; 24450 const { 24451 nTriggerFormChange 24452 } = formItem; 24453 if (onChange) 24454 call(onChange, value, meta); 24455 uncontrolledValueRef.value = value; 24456 nTriggerFormChange(); 24457 } 24458 function doBlur(e) { 24459 const { 24460 onBlur 24461 } = props; 24462 const { 24463 nTriggerFormBlur 24464 } = formItem; 24465 if (onBlur) 24466 call(onBlur, e); 24467 nTriggerFormBlur(); 24468 } 24469 function doFocus(e) { 24470 const { 24471 onFocus 24472 } = props; 24473 const { 24474 nTriggerFormFocus 24475 } = formItem; 24476 if (onFocus) 24477 call(onFocus, e); 24478 nTriggerFormFocus(); 24479 } 24480 function doClear(e) { 24481 const { 24482 onClear 24483 } = props; 24484 if (onClear) 24485 call(onClear, e); 24486 } 24487 function doUpdateValueBlur(e) { 24488 const { 24489 onInputBlur 24490 } = props; 24491 if (onInputBlur) 24492 call(onInputBlur, e); 24493 } 24494 function doUpdateValueFocus(e) { 24495 const { 24496 onInputFocus 24497 } = props; 24498 if (onInputFocus) 24499 call(onInputFocus, e); 24500 } 24501 function doDeactivate() { 24502 const { 24503 onDeactivate 24504 } = props; 24505 if (onDeactivate) 24506 call(onDeactivate); 24507 } 24508 function doActivate() { 24509 const { 24510 onActivate 24511 } = props; 24512 if (onActivate) 24513 call(onActivate); 24514 } 24515 function doClick(e) { 24516 const { 24517 onClick 24518 } = props; 24519 if (onClick) 24520 call(onClick, e); 24521 } 24522 function doWrapperFocus(e) { 24523 const { 24524 onWrapperFocus 24525 } = props; 24526 if (onWrapperFocus) 24527 call(onWrapperFocus, e); 24528 } 24529 function doWrapperBlur(e) { 24530 const { 24531 onWrapperBlur 24532 } = props; 24533 if (onWrapperBlur) 24534 call(onWrapperBlur, e); 24535 } 24536 function handleCompositionStart() { 24537 isComposingRef2.value = true; 24538 } 24539 function handleCompositionEnd(e) { 24540 isComposingRef2.value = false;
24541 if (e.target === inputEl2Ref.value) { 24542 handleInput(e, 1); 24543 } else { 24544 handleInput(e, 0); 24545 } 24546 } 24547 function handleInput(e, index = 0, event = "input") { 24548 const targetValue = e.target.value; 24549 syncMirror(targetValue); 24550 if (e instanceof InputEvent && !e.isComposing) { 24551 isComposingRef2.value = false; 24552 } 24553 if (props.type === "textarea") { 24554 const { 24555 value: textareaScrollbarInst 24556 } = textareaScrollbarInstRef; 24557 if (textareaScrollbarInst) { 24558 textareaScrollbarInst.syncUnifiedContainer(); 24559 } 24560 } 24561 syncSource = targetValue; 24562 if (isComposingRef2.value) 24563 return; 24564 focusedInputCursorControl.recordCursor(); 24565 const isIncomingValueValid = allowInput(targetValue); 24566 if (isIncomingValueValid) { 24567 if (!props.pair) { 24568 event === "input" ? doUpdateValue(targetValue, { 24569 source: index 24570 }) : doChange(targetValue, { 24571 source: index 24572 }); 24573 } else { 24574 let { 24575 value 24576 } = mergedValueRef; 24577 if (!Array.isArray(value)) { 24578 value = ["", ""]; 24579 } else { 24580 value = [value[0], value[1]]; 24581 } 24582 value[index] = targetValue; 24583 event === "input" ? doUpdateValue(value, { 24584 source: index 24585 }) : doChange(value, { 24586 source: index 24587 }); 24588 } 24589 } 24590 vm.$forceUpdate(); 24591 if (!isIncomingValueValid) { 24592 void nextTick(focusedInputCursorControl.restoreCursor); 24593 } 24594 } 24595 function allowInput(value) { 24596 const { 24597 countGraphemes, 24598 maxlength, 24599 minlength 24600 } = props; 24601 if (countGraphemes) { 24602 let graphemesCount; 24603 if (maxlength !== void 0) { 24604 if (graphemesCount === void 0) { 24605 graphemesCount = countGraphemes(value); 24606 } 24607 if (graphemesCount > Number(maxlength)) 24608 return false; 24609 } 24610 if (minlength !== void 0) { 24611 if (graphemesCount === void 0) { 24612 graphemesCount = countGraphemes(value); 24613 } 24614 if (graphemesCount < Number(maxlength)) 24615 return false; 24616 } 24617 } 24618 const { 24619 allowInput: allowInput2 24620 } = props; 24621 if (typeof allowInput2 === "function") { 24622 return allowInput2(value); 24623 } 24624 return true; 24625 } 24626 function handleInputBlur(e) { 24627 doUpdateValueBlur(e); 24628 if (e.relatedTarget === wrapperElRef.value) { 24629 doDeactivate(); 24630 } 24631 if (!(e.relatedTarget !== null && (e.relatedTarget === inputElRef.value || e.relatedTarget === inputEl2Ref.value || e.relatedTarget === textareaElRef.value))) { 24632 activatedRef.value = false; 24633 } 24634 dealWithEvent(e, "blur"); 24635 currentFocusedInputRef.value = null; 24636 } 24637 function handleInputFocus(e, index) { 24638 doUpdateValueFocus(e); 24639 focusedRef.value = true; 24640 activatedRef.value = true; 24641 doActivate(); 24642 dealWithEvent(e, "focus"); 24643 if (index === 0) { 24644 currentFocusedInputRef.value = inputElRef.value; 24645 } else if (index === 1) { 24646 currentFocusedInputRef.value = inputEl2Ref.value; 24647 } else if (index === 2) { 24648 currentFocusedInputRef.value = textareaElRef.value; 24649 } 24650 } 24651 function handleWrapperBlur(e) { 24652 if (props.passivelyActivated) { 24653 doWrapperBlur(e); 24654 dealWithEvent(e, "blur"); 24655 } 24656 } 24657 function handleWrapperFocus(e) { 24658 if (props.passivelyActivated) { 24659 focusedRef.value = true; 24660 doWrapperFocus(e); 24661 dealWithEvent(e, "focus"); 24662 } 24663 } 24664 function dealWithEvent(e, type4) { 24665 if (e.relatedTarget !== null && (e.relatedTarget === inputElRef.value || e.relatedTarget === inputEl2Ref.value || e.relatedTarget === textareaElRef.value || e.relatedTarget === wrapperElRef.value)) 24666 ; 24667 else { 24668 if (type4 === "focus") { 24669 doFocus(e); 24670 focusedRef.value = true; 24671 } else if (type4 === "blur") { 24672 doBlur(e); 24673 focusedRef.value = false;
24674 } 24675 } 24676 } 24677 function handleChange(e, index) { 24678 handleInput(e, index, "change"); 24679 } 24680 function handleClick2(e) { 24681 doClick(e); 24682 } 24683 function handleClear(e) { 24684 doClear(e); 24685 clearValue(); 24686 } 24687 function clearValue() { 24688 if (props.pair) { 24689 doUpdateValue(["", ""], { 24690 source: "clear" 24691 }); 24692 doChange(["", ""], { 24693 source: "clear" 24694 }); 24695 } else { 24696 doUpdateValue("", { 24697 source: "clear" 24698 }); 24699 doChange("", { 24700 source: "clear" 24701 }); 24702 } 24703 } 24704 function handleMouseDown(e) { 24705 const { 24706 onMousedown 24707 } = props; 24708 if (onMousedown) 24709 onMousedown(e); 24710 const { 24711 tagName 24712 } = e.target; 24713 if (tagName !== "INPUT" && tagName !== "TEXTAREA") { 24714 if (props.resizable) { 24715 const { 24716 value: wrapperEl 24717 } = wrapperElRef; 24718 if (wrapperEl) { 24719 const { 24720 left, 24721 top, 24722 width, 24723 height 24724 } = wrapperEl.getBoundingClientRect(); 24725 const resizeHandleSize = 14; 24726 if (left + width - resizeHandleSize < e.clientX && e.clientX < left + width && top + height - resizeHandleSize < e.clientY && e.clientY < top + height) { 24727 return; 24728 } 24729 } 24730 } 24731 e.preventDefault(); 24732 if (!focusedRef.value) { 24733 focus(); 24734 } 24735 } 24736 } 24737 function handleMouseEnter() { 24738 var _a2; 24739 hoverRef.value = true; 24740 if (props.type === "textarea") { 24741 (_a2 = textareaScrollbarInstRef.value) === null || _a2 === void 0 ? void 0 : _a2.handleMouseEnterWrapper(); 24742 } 24743 } 24744 function handleMouseLeave() { 24745 var _a2; 24746 hoverRef.value = false; 24747 if (props.type === "textarea") { 24748 (_a2 = textareaScrollbarInstRef.value) === null || _a2 === void 0 ? void 0 : _a2.handleMouseLeaveWrapper(); 24749 } 24750 } 24751 function handlePasswordToggleClick() { 24752 if (mergedDisabledRef.value) 24753 return; 24754 if (mergedShowPasswordOnRef.value !== "click") 24755 return; 24756 passwordVisibleRef.value = !passwordVisibleRef.value; 24757 } 24758 function handlePasswordToggleMousedown(e) { 24759 if (mergedDisabledRef.value) 24760 return; 24761 e.preventDefault(); 24762 const preventDefaultOnce = (e2) => { 24763 e2.preventDefault(); 24764 off("mouseup", document, preventDefaultOnce); 24765 }; 24766 on("mouseup", document, preventDefaultOnce); 24767 if (mergedShowPasswordOnRef.value !== "mousedown") 24768 return; 24769 passwordVisibleRef.value = true; 24770 const hidePassword = () => { 24771 passwordVisibleRef.value = false; 24772 off("mouseup", document, hidePassword); 24773 }; 24774 on("mouseup", document, hidePassword); 24775 } 24776 function handleWrapperKeyup(e) { 24777 if (props.onKeyup) 24778 call(props.onKeyup, e); 24779 } 24780 function handleWrapperKeydown(e) { 24781 if (props.onKeydown) 24782 call(props.onKeydown, e); 24783 switch (e.key) { 24784 case "Escape": 24785 handleWrapperKeydownEsc(); 24786 break; 24787 case "Enter": 24788 handleWrapperKeydownEnter(e); 24789 break; 24790 } 24791 } 24792 function handleWrapperKeydownEnter(e) { 24793 var _a2, _b; 24794 if (props.passivelyActivated) { 24795 const { 24796 value: focused 24797 } = activatedRef; 24798 if (focused) { 24799 if (props.internalDeactivateOnEnter) { 24800 handleWrapperKeydownEsc(); 24801 } 24802 return; 24803 } 24804 e.preventDefault(); 24805 if (props.type === "textarea") { 24806 (_a2 = textareaElRef.value) === null || _a2 === void 0 ? void 0 : _a2.focus(); 24807 } else { 24808 (_b = inputElRef.value) === null || _b === void 0 ? void 0 : _b.focus(); 24809 } 24810 } 24811 } 24812 function handleWrapperKeydownEsc() { 24813 if (props.passivelyActivated) { 24814 activatedRef.value = false; 24815 void nextTick(() => { 24816 var _a2; 24817 (_a2 = wrapperElRef.value) === null || _a2 === void 0 ? void 0 : _a2.focus(); 24818 }); 24819 } 24820 } 24821 function focus() { 24822 var _a2, _b, _c; 24823 if (mergedDisabledRef.value) 24824 return; 24825 if (props.passivelyActivated) { 24826 (_a2 = wrapperElRef.value) === null || _a2 === void 0 ? void 0 : _a2.focus(); 24827 } else { 24828 (_b = textareaElRef.value) === null || _b === void 0 ? void 0 : _b.focus(); 24829 (_c = inputElRef.value) === null || _c === void 0 ? void 0 : _c.focus(); 24830 } 24831 } 24832 function blur() { 24833 var _a2; 24834 if ((_a2 = wrapperElRef.value) === null || _a2 === void 0 ? void 0 : _a2.contains(document.activeElement)) { 24835 document.activeElement.blur(); 24836 } 24837 } 24838 function select() { 24839 var _a2, _b; 24840 (_a2 = textareaElRef.value) === null || _a2 === void 0 ? void 0 : _a2.select(); 24841 (_b = inputElRef.value) === null || _b === void 0 ? void 0 : _b.select(); 24842 } 24843 function activate() { 24844 if (mergedDisabledRef.value) 24845 return; 24846 if (textareaElRef.value) 24847 textareaElRef.value.focus(); 24848 else if (inputElRef.value) 24849 inputElRef.value.focus(); 24850 } 24851 function deactivate() { 24852 const { 24853 value: wrapperEl 24854 } = wrapperElRef; 24855 if ((wrapperEl === null || wrapperEl === void 0 ? void 0 : wrapperEl.contains(document.activeElement)) && wrapperEl !== document.activeElement) { 24856 handleWrapperKeydownEsc(); 24857 } 24858 } 24859 function scrollTo(options) { 24860 if (props.type === "textarea") { 24861 const { 24862 value: textareaEl 24863 } = textareaElRef; 24864 textareaEl === null || textareaEl === void 0 ? void 0 : textareaEl.scrollTo(options); 24865 } else { 24866 const { 24867 value: inputEl 24868 } = inputElRef; 24869 inputEl === null || inputEl === void 0 ? void 0 : inputEl.scrollTo(options); 24870 } 24871 } 24872 function syncMirror(value) { 24873 const { 24874 type: type4, 24875 pair, 24876 autosize 24877 } = props; 24878 if (!pair && autosize) { 24879 if (type4 === "textarea") { 24880 const { 24881 value: textareaMirrorEl 24882 } = textareaMirrorElRef; 24883 if (textareaMirrorEl) { 24884 textareaMirrorEl.textContent = (value !== null && value !== void 0 ? value : "") + "\r\n"; 24885 } 24886 } else { 24887 const { 24888 value: inputMirrorEl 24889 } = inputMirrorElRef; 24890 if (inputMirrorEl) { 24891 if (value) { 24892 inputMirrorEl.textContent = value; 24893 } else { 24894 inputMirrorEl.innerHTML = " "; 24895 } 24896 } 24897 } 24898 } 24899 } 24900 function handleTextAreaMirrorResize() { 24901 updateTextAreaStyle(); 24902 } 24903 const placeholderStyleRef = ref({ 24904 top: "0" 24905 }); 24906 function handleTextAreaScroll(e) { 24907 var _a2; 24908 const { 24909 scrollTop 24910 } = e.target; 24911 placeholderStyleRef.value.top = `${-scrollTop}px`; 24912 (_a2 = textareaScrollbarInstRef.value) === null || _a2 === void 0 ? void 0 : _a2.syncUnifiedContainer(); 24913 } 24914 let stopWatchMergedValue1 = null; 24915 watchEffect(() => { 24916 const { 24917 autosize, 24918 type: type4 24919 } = props; 24920 if (autosize && type4 === "textarea") { 24921 stopWatchMergedValue1 = watch(mergedValueRef, (value) => { 24922 if (!Array.isArray(value) && value !== syncSource) { 24923 syncMirror(value); 24924 } 24925 }); 24926 } else { 24927 stopWatchMergedValue1 === null || stopWatchMergedValue1 === void 0 ? void 0 : stopWatchMergedValue1(); 24928 } 24929 }); 24930 let stopWatchMergedValue2 = null; 24931 watchEffect(() => { 24932 if (props.type === "textarea") { 24933 stopWatchMergedValue2 = watch(mergedValueRef, (value) => { 24934 var _a2; 24935 if (!Array.isArray(value) && value !== syncSource) { 24936 (_a2 = textareaScrollbarInstRef.value) === null || _a2 === void 0 ? void 0 : _a2.syncUnifiedContainer(); 24937 } 24938 }); 24939 } else { 24940 stopWatchMergedValue2 === null || stopWatchMergedValue2 === void 0 ? void 0 : stopWatchMergedValue2(); 24941 } 24942 }); 24943 provide(inputInjectionKey, { 24944 mergedValueRef, 24945 maxlengthRef, 24946 mergedClsPrefixRef, 24947 countGraphemesRef: toRef(props, "countGraphemes") 24948 }); 24949 const exposedProps = { 24950 wrapperElRef, 24951 inputElRef, 24952 textareaElRef, 24953 isCompositing: isComposingRef2, 24954 clear: clearValue, 24955 focus, 24956 blur, 24957 select, 24958 deactivate, 24959 activate, 24960 scrollTo 24961 }; 24962 const rtlEnabledRef = useRtl("Input", mergedRtlRef, mergedClsPrefixRef); 24963 const cssVarsRef = computed(() => { 24964 const { 24965 value: size2 24966 } = mergedSizeRef; 24967 const { 24968 common: { 24969 cubicBezierEaseInOut: cubicBezierEaseInOut2 24970 }, 24971 self: { 24972 color, 24973 borderRadius, 24974 textColor, 24975 caretColor, 24976 caretColorError, 24977 caretColorWarning, 24978 textDecorationColor, 24979 border, 24980 borderDisabled, 24981 borderHover, 24982 borderFocus, 24983 placeholderColor, 24984 placeholderColorDisabled, 24985 lineHeightTextarea,
vendor: 5,434 bytes, lines 24986-25138
24986 colorDisabled, 24987 colorFocus, 24988 textColorDisabled, 24989 boxShadowFocus, 24990 iconSize, 24991 colorFocusWarning, 24992 boxShadowFocusWarning, 24993 borderWarning, 24994 borderFocusWarning, 24995 borderHoverWarning, 24996 colorFocusError, 24997 boxShadowFocusError, 24998 borderError, 24999 borderFocusError, 25000 borderHoverError, 25001 clearSize, 25002 clearColor, 25003 clearColorHover, 25004 clearColorPressed, 25005 iconColor, 25006 iconColorDisabled, 25007 suffixTextColor, 25008 countTextColor, 25009 countTextColorDisabled, 25010 iconColorHover, 25011 iconColorPressed, 25012 loadingColor, 25013 loadingColorError, 25014 loadingColorWarning, 25015 [createKey("padding", size2)]: padding, 25016 [createKey("fontSize", size2)]: fontSize2, 25017 [createKey("height", size2)]: height 25018 } 25019 } = themeRef.value; 25020 const { 25021 left: paddingLeft, 25022 right: paddingRight 25023 } = getMargin(padding); 25024 return { 25025 "--n-bezier": cubicBezierEaseInOut2, 25026 "--n-count-text-color": countTextColor, 25027 "--n-count-text-color-disabled": countTextColorDisabled, 25028 "--n-color": color, 25029 "--n-font-size": fontSize2, 25030 "--n-border-radius": borderRadius, 25031 "--n-height": height, 25032 "--n-padding-left": paddingLeft, 25033 "--n-padding-right": paddingRight, 25034 "--n-text-color": textColor, 25035 "--n-caret-color": caretColor, 25036 "--n-text-decoration-color": textDecorationColor, 25037 "--n-border": border, 25038 "--n-border-disabled": borderDisabled, 25039 "--n-border-hover": borderHover, 25040 "--n-border-focus": borderFocus, 25041 "--n-placeholder-color": placeholderColor, 25042 "--n-placeholder-color-disabled": placeholderColorDisabled, 25043 "--n-icon-size": iconSize, 25044 "--n-line-height-textarea": lineHeightTextarea, 25045 "--n-color-disabled": colorDisabled, 25046 "--n-color-focus": colorFocus, 25047 "--n-text-color-disabled": textColorDisabled, 25048 "--n-box-shadow-focus": boxShadowFocus, 25049 "--n-loading-color": loadingColor, 25050 // form warning 25051 "--n-caret-color-warning": caretColorWarning, 25052 "--n-color-focus-warning": colorFocusWarning, 25053 "--n-box-shadow-focus-warning": boxShadowFocusWarning, 25054 "--n-border-warning": borderWarning, 25055 "--n-border-focus-warning": borderFocusWarning, 25056 "--n-border-hover-warning": borderHoverWarning, 25057 "--n-loading-color-warning": loadingColorWarning, 25058 // form error 25059 "--n-caret-color-error": caretColorError, 25060 "--n-color-focus-error": colorFocusError, 25061 "--n-box-shadow-focus-error": boxShadowFocusError, 25062 "--n-border-error": borderError, 25063 "--n-border-focus-error": borderFocusError, 25064 "--n-border-hover-error": borderHoverError, 25065 "--n-loading-color-error": loadingColorError, 25066 // clear-button 25067 "--n-clear-color": clearColor, 25068 "--n-clear-size": clearSize, 25069 "--n-clear-color-hover": clearColorHover, 25070 "--n-clear-color-pressed": clearColorPressed, 25071 "--n-icon-color": iconColor, 25072 "--n-icon-color-hover": iconColorHover, 25073 "--n-icon-color-pressed": iconColorPressed, 25074 "--n-icon-color-disabled": iconColorDisabled, 25075 "--n-suffix-text-color": suffixTextColor 25076 }; 25077 }); 25078 const themeClassHandle = inlineThemeDisabled ? useThemeClass("input", computed(() => { 25079 const { 25080 value: size2 25081 } = mergedSizeRef; 25082 return size2[0]; 25083 }), cssVarsRef, props) : void 0; 25084 return Object.assign(Object.assign({}, exposedProps), { 25085 // DOM ref 25086 wrapperElRef, 25087 inputElRef, 25088 inputMirrorElRef, 25089 inputEl2Ref, 25090 textareaElRef, 25091 textareaMirrorElRef, 25092 textareaScrollbarInstRef, 25093 // value 25094 rtlEnabled: rtlEnabledRef, 25095 uncontrolledValue: uncontrolledValueRef, 25096 mergedValue: mergedValueRef, 25097 passwordVisible: passwordVisibleRef, 25098 mergedPlaceholder: mergedPlaceholderRef, 25099 showPlaceholder1: showPlaceholder1Ref, 25100 showPlaceholder2: showPlaceholder2Ref, 25101 mergedFocus: mergedFocusRef, 25102 isComposing: isComposingRef2, 25103 activated: activatedRef, 25104 showClearButton, 25105 mergedSize: mergedSizeRef, 25106 mergedDisabled: mergedDisabledRef, 25107 textDecorationStyle: textDecorationStyleRef, 25108 mergedClsPrefix: mergedClsPrefixRef, 25109 mergedBordered: mergedBorderedRef, 25110 mergedShowPasswordOn: mergedShowPasswordOnRef, 25111 placeholderStyle: placeholderStyleRef, 25112 mergedStatus: mergedStatusRef, 25113 textAreaScrollContainerWidth: textAreaScrollContainerWidthRef, 25114 // methods 25115 handleTextAreaScroll, 25116 handleCompositionStart, 25117 handleCompositionEnd, 25118 handleInput, 25119 handleInputBlur, 25120 handleInputFocus, 25121 handleWrapperBlur, 25122 handleWrapperFocus, 25123 handleMouseEnter, 25124 handleMouseLeave, 25125 handleMouseDown, 25126 handleChange, 25127 handleClick: handleClick2, 25128 handleClear, 25129 handlePasswordToggleClick, 25130 handlePasswordToggleMousedown, 25131 handleWrapperKeydown, 25132 handleWrapperKeyup, 25133 handleTextAreaMirrorResize, 25134 getTextareaScrollContainer: () => { 25135 return textareaElRef.value; 25136 }, 25137 mergedTheme: themeRef, 25138 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef,
25139 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 25140 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 25141 }); 25142 }, 25143 render() { 25144 var _a2, _b; 25145 const { 25146 mergedClsPrefix, 25147 mergedStatus, 25148 themeClass, 25149 type: type4, 25150 countGraphemes, 25151 onRender 25152 } = this; 25153 const $slots = this.$slots; 25154 onRender === null || onRender === void 0 ? void 0 : onRender(); 25155 return h("div", { 25156 ref: "wrapperElRef", 25157 class: [`${mergedClsPrefix}-input`, themeClass, mergedStatus && `${mergedClsPrefix}-input--${mergedStatus}-status`, { 25158 [`${mergedClsPrefix}-input--rtl`]: this.rtlEnabled, 25159 [`${mergedClsPrefix}-input--disabled`]: this.mergedDisabled, 25160 [`${mergedClsPrefix}-input--textarea`]: type4 === "textarea", 25161 [`${mergedClsPrefix}-input--resizable`]: this.resizable && !this.autosize, 25162 [`${mergedClsPrefix}-input--autosize`]: this.autosize, 25163 [`${mergedClsPrefix}-input--round`]: this.round && !(type4 === "textarea"), 25164 [`${mergedClsPrefix}-input--pair`]: this.pair, 25165 [`${mergedClsPrefix}-input--focus`]: this.mergedFocus, 25166 [`${mergedClsPrefix}-input--stateful`]: this.stateful 25167 }], 25168 style: this.cssVars, 25169 tabindex: !this.mergedDisabled && this.passivelyActivated && !this.activated ? 0 : void 0, 25170 onFocus: this.handleWrapperFocus, 25171 onBlur: this.handleWrapperBlur, 25172 onClick: this.handleClick, 25173 onMousedown: this.handleMouseDown, 25174 onMouseenter: this.handleMouseEnter, 25175 onMouseleave: this.handleMouseLeave, 25176 onCompositionstart: this.handleCompositionStart, 25177 onCompositionend: this.handleCompositionEnd, 25178 onKeyup: this.handleWrapperKeyup, 25179 onKeydown: this.handleWrapperKeydown 25180 }, h("div", { 25181 class: `${mergedClsPrefix}-input-wrapper` 25182 }, resolveWrappedSlot($slots.prefix, (children) => children && h("div", { 25183 class: `${mergedClsPrefix}-input__prefix` 25184 }, children)), type4 === "textarea" ? h(NScrollbar, { 25185 ref: "textareaScrollbarInstRef", 25186 class: `${mergedClsPrefix}-input__textarea`, 25187 container: this.getTextareaScrollContainer, 25188 triggerDisplayManually: true, 25189 useUnifiedContainer: true, 25190 internalHoistYRail: true 25191 }, { 25192 default: () => { 25193 var _a3, _b2; 25194 const { 25195 textAreaScrollContainerWidth 25196 } = this; 25197 const scrollContainerWidthStyle = { 25198 width: this.autosize && textAreaScrollContainerWidth && `${textAreaScrollContainerWidth}px` 25199 }; 25200 return h(Fragment, null, h("textarea", Object.assign({}, this.inputProps, { 25201 ref: "textareaElRef", 25202 class: [`${mergedClsPrefix}-input__textarea-el`, (_a3 = this.inputProps) === null || _a3 === void 0 ? void 0 : _a3.class], 25203 autofocus: this.autofocus, 25204 rows: Number(this.rows), 25205 placeholder: this.placeholder, 25206 value: this.mergedValue, 25207 disabled: this.mergedDisabled, 25208 maxlength: countGraphemes ? void 0 : this.maxlength, 25209 minlength: countGraphemes ? void 0 : this.minlength, 25210 readonly: this.readonly, 25211 tabindex: this.passivelyActivated && !this.activated ? -1 : void 0, 25212 style: [this.textDecorationStyle[0], (_b2 = this.inputProps) === null || _b2 === void 0 ? void 0 : _b2.style, scrollContainerWidthStyle], 25213 onBlur: this.handleInputBlur, 25214 onFocus: (e) => { 25215 this.handleInputFocus(e, 2); 25216 }, 25217 onInput: this.handleInput, 25218 onChange: this.handleChange, 25219 onScroll: this.handleTextAreaScroll 25220 })), this.showPlaceholder1 ? h("div", { 25221 class: `${mergedClsPrefix}-input__placeholder`, 25222 style: [this.placeholderStyle, scrollContainerWidthStyle], 25223 key: "placeholder" 25224 }, this.mergedPlaceholder[0]) : null, this.autosize ? h(VResizeObserver, { 25225 onResize: this.handleTextAreaMirrorResize 25226 }, { 25227 default: () => h("div", { 25228 ref: "textareaMirrorElRef", 25229 class: `${mergedClsPrefix}
25229-input__textarea-mirror`, 25230 key: "mirror" 25231 }) 25232 }) : null); 25233 } 25234 }) : h("div", { 25235 class: `${mergedClsPrefix}-input__input` 25236 }, h("input", Object.assign({ 25237 type: type4 === "password" && this.mergedShowPasswordOn && this.passwordVisible ? "text" : type4 25238 }, this.inputProps, { 25239 ref: "inputElRef", 25240 class: [`${mergedClsPrefix}-input__input-el`, (_a2 = this.inputProps) === null || _a2 === void 0 ? void 0 : _a2.class], 25241 style: [this.textDecorationStyle[0], (_b = this.inputProps) === null || _b === void 0 ? void 0 : _b.style], 25242 tabindex: this.passivelyActivated && !this.activated ? -1 : void 0, 25243 placeholder: this.mergedPlaceholder[0], 25244 disabled: this.mergedDisabled, 25245 maxlength: countGraphemes ? void 0 : this.maxlength, 25246 minlength: countGraphemes ? void 0 : this.minlength, 25247 value: Array.isArray(this.mergedValue) ? this.mergedValue[0] : this.mergedValue, 25248 readonly: this.readonly, 25249 autofocus: this.autofocus, 25250 size: this.attrSize, 25251 onBlur: this.handleInputBlur, 25252 onFocus: (e) => { 25253 this.handleInputFocus(e, 0); 25254 }, 25255 onInput: (e) => { 25256 this.handleInput(e, 0); 25257 }, 25258 onChange: (e) => { 25259 this.handleChange(e, 0); 25260 } 25261 })), this.showPlaceholder1 ? h("div", { 25262 class: `${mergedClsPrefix}-input__placeholder` 25263 }, h("span", null, this.mergedPlaceholder[0])) : null, this.autosize ? h("div", { 25264 class: `${mergedClsPrefix}-input__input-mirror`, 25265 key: "mirror", 25266 ref: "inputMirrorElRef" 25267 }, "Â ") : null), !this.pair && resolveWrappedSlot($slots.suffix, (children) => { 25268 return children || this.clearable || this.showCount || this.mergedShowPasswordOn || this.loading !== void 0 ? h("div", { 25269 class: `${mergedClsPrefix}-input__suffix` 25270 }, [resolveWrappedSlot($slots["clear-icon-placeholder"], (children2) => { 25271 return (this.clearable || children2) && h(NBaseClear, { 25272 clsPrefix: mergedClsPrefix, 25273 show: this.showClearButton, 25274 onClear: this.handleClear 25275 }, { 25276 placeholder: () => children2, 25277 icon: () => { 25278 var _a3, _b2; 25279 return (_b2 = (_a3 = this.$slots)["clear-icon"]) === null || _b2 === void 0 ? void 0 : _b2.call(_a3); 25280 } 25281 }); 25282 }), !this.internalLoadingBeforeSuffix ? children : null, this.loading !== void 0 ? h(NBaseSuffix, { 25283 clsPrefix: mergedClsPrefix, 25284 loading: this.loading, 25285 showArrow: false, 25286 showClear: false, 25287 style: this.cssVars 25288 }) : null, this.internalLoadingBeforeSuffix ? children : null, this.showCount && this.type !== "textarea" ? h(WordCount, null, { 25289 default: (props) => { 25290 var _a3; 25291 return (_a3 = $slots.count) === null || _a3 === void 0 ? void 0 : _a3.call($slots, props); 25292 } 25293 }) : null, this.mergedShowPasswordOn && this.type === "password" ? h("div", { 25294 class: `${mergedClsPrefix}-input__eye`, 25295 onMousedown: this.handlePasswordToggleMousedown, 25296 onClick: this.handlePasswordToggleClick 25297 }, this.passwordVisible ? resolveSlot($slots["password-visible-icon"], () => [h(NBaseIcon, { 25298 clsPrefix: mergedClsPrefix 25299 }, { 25300 default: () => h(EyeIcon, null) 25301 })]) : resolveSlot($slots["password-invisible-icon"], () => [h(NBaseIcon, { 25302 clsPrefix: mergedClsPrefix 25303 }, { 25304 default: () => h(EyeOffIcon, null) 25305 })])) : null]) : null; 25306 })), this.pair ? h("span", { 25307 class: `${mergedClsPrefix}-input__separator` 25308 }, resolveSlot($slots.separator, () => [this.separator])) : null, this.pair ? h("div", { 25309 class: `${mergedClsPrefix}-input-wrapper` 25310 }, h("div", { 25311 class: `${mergedClsPrefix}-input__input` 25312 }, h("input", { 25313 ref: "inputEl2Ref", 25314 type: this.type, 25315 class: `${mergedClsPrefix}-input__input-el`, 25316 tabindex: this.passivelyActivated && !this.activated ? -1 : void 0, 25317 placeholder: this.mergedPlaceholder[1], 25318 disabled: this.mergedDisabled, 25319 maxlength: countGraphemes ? void 0 : this.maxlength, 25320 minlength: countGraphemes ? void 0 : this.minlength, 25321 value: Array.isArray(this.mergedValue) ? this.mergedValue[1] : void 0, 25322 readonly: this.readonly, 25323 style: this.textDecorationStyle[1], 25324 onBlur: this.handleInputBlur, 25325 onFocus: (e) => { 25326 this.handleInputFocus(e, 1); 25327 }, 25328 onInput: (e) => { 25329 this.handleInput(e, 1); 25330 }, 25331 onChange: (e) => { 25332 this.handleChange(e, 1); 25333 } 25334 }), this.showPlaceholder2 ? h("div", { 25335 class: `${mergedClsPrefix}-input__placeholder` 25336 }, h("span", null, this.mergedPlaceholder[1])) : null), resolveWrappedSlot($slots.suffix, (children) => { 25337 return (this.clearable || children) && h("div", { 25338 class: `${mergedClsPrefix}-input__suffix` 25339 }, [this.clearable && h(NBaseClear, { 25340 clsPrefix: mergedClsPrefix, 25341 show: this.showClearButton, 25342 onClear: this.handleClear 25343 }, { 25344 icon: () => { 25345 var _a3; 25346 return (_a3 = $slots["clear-icon"]) === null || _a3 === void 0 ? void 0 : _a3.call($slots); 25347 }, 25348 placeholder: () => { 25349 var _a3; 25350 return (_a3 = $slots["clear-icon-placeholder"]) === null || _a3 === void 0 ? void 0 : _a3.call($slots); 25351 } 25352 }), children]); 25353 })) : null, this.mergedBordered ? h("div", { 25354 class: `${mergedClsPrefix}-input__border` 25355 }) : null, this.mergedBordered ? h("div", { 25356 class: `${mergedClsPrefix}-input__state-border` 25357 }) : null, this.showCount && type4 === "textarea" ? h(WordCount, null, { 25358 default: (props) => { 25359 var _a3; 25360 const { 25361 renderCount 25362 } = this; 25363 if (renderCount) { 25364 return renderCount(props); 25365 } 25366 return (_a3 = $slots.count) === null || _a3 === void 0 ? void 0 : _a3.call($slots, props); 25367 } 25368 }) : null); 25369 } 25370}); 25371const isImageSupportNativeLazy = isBrowser$2 && "loading" in document.createElement("img"); 25372const resolveOptionsAndHash = (options = {}) => { 25373 var _a2; 25374 const { 25375 root: root2 = null 25376 } = options; 25377 return { 25378 hash: `${options.rootMargin || "0px 0px 0px 0px"}-${Array.isArray(options.threshold) ? options.threshold.join(",") : (_a2 = options.threshold) !== null && _a2 !== void 0 ? _a2 : "0"}`, 25379 options: Object.assign(Object.assign({}, options), { 25380 root: (typeof root2 === "string" ? document.querySelector(root2) : root2) || document.documentElement 25381 }) 25382 }; 25383}; 25384const observers = /* @__PURE__ */ new WeakMap(); 25385const unobserveHandleMap = /* @__PURE__ */ new WeakMap(); 25386const shouldStartLoadingRefMap = /* @__PURE__ */ new WeakMap(); 25387const observeIntersection = (el, options, shouldStartLoadingRef) => { 25388 if (!el) 25389 return () => { 25390 }; 25391 const resolvedOptionsAndHash = resolveOptionsAndHash(options); 25392 const { 25393 root: root2 25394 } = resolvedOptionsAndHash.options; 25395 let rootObservers; 25396 const _rootObservers = observers.get(root2); 25397 if (_rootObservers) { 25398 rootObservers = _rootObservers; 25399 } else { 25400 rootObservers = /* @__PURE__ */ new Map(); 25401 observers.set(root2, rootObservers); 25402 } 25403 let observer; 25404 let observerAndObservedElements; 25405 if (rootObservers.has(resolvedOptionsAndHash.hash)) { 25406 observerAndObservedElements = // eslint-disable-next-line @typescript-eslint/no-non-null-assertion 25407 rootObservers.get(resolvedOptionsAndHash.hash); 25408 if (!observerAndObservedElements[1].has(el)) { 25409 observer = observerAndObservedElements[0]; 25410 observerAndObservedElements[1].add(el); 25411 observer.observe(el); 25412 } 25413 } else { 25414 observer = new IntersectionObserver((entries) => {
25415 entries.forEach((entry) => { 25416 if (entry.isIntersecting) { 25417 const _unobserve = unobserveHandleMap.get(entry.target); 25418 const _shouldStartLoadingRef = shouldStartLoadingRefMap.get(entry.target); 25419 if (_unobserve) 25420 _unobserve(); 25421 if (_shouldStartLoadingRef) { 25422 _shouldStartLoadingRef.value = true; 25423 } 25424 } 25425 }); 25426 }, resolvedOptionsAndHash.options); 25427 observer.observe(el); 25428 observerAndObservedElements = [observer, /* @__PURE__ */ new Set([el])]; 25429 rootObservers.set(resolvedOptionsAndHash.hash, observerAndObservedElements); 25430 } 25431 let unobservered = false; 25432 const unobserve = () => { 25433 if (unobservered) 25434 return; 25435 unobserveHandleMap.delete(el); 25436 shouldStartLoadingRefMap.delete(el); 25437 unobservered = true; 25438 if (observerAndObservedElements[1].has(el)) { 25439 observerAndObservedElements[0].unobserve(el); 25440 observerAndObservedElements[1].delete(el); 25441 } 25442 if (observerAndObservedElements[1].size <= 0) { 25443 rootObservers.delete(resolvedOptionsAndHash.hash); 25444 } 25445 if (!rootObservers.size) { 25446 observers.delete(root2); 25447 } 25448 }; 25449 unobserveHandleMap.set(el, unobserve); 25450 shouldStartLoadingRefMap.set(el, shouldStartLoadingRef); 25451 return unobserve; 25452}; 25453function createHoverColor(rgb) { 25454 return composite(rgb, [255, 255, 255, 0.16]); 25455} 25456function createPressedColor(rgb) { 25457 return composite(rgb, [0, 0, 0, 0.12]); 25458} 25459const buttonGroupInjectionKey = createInjectionKey("n-button-group"); 25460const commonVariables$3 = { 25461 paddingTiny: "0 6px", 25462 paddingSmall: "0 10px", 25463 paddingMedium: "0 14px", 25464 paddingLarge: "0 18px", 25465 paddingRoundTiny: "0 10px", 25466 paddingRoundSmall: "0 14px", 25467 paddingRoundMedium: "0 18px", 25468 paddingRoundLarge: "0 22px", 25469 iconMarginTiny: "6px", 25470 iconMarginSmall: "6px", 25471 iconMarginMedium: "6px", 25472 iconMarginLarge: "6px", 25473 iconSizeTiny: "14px", 25474 iconSizeSmall: "18px", 25475 iconSizeMedium: "18px", 25476 iconSizeLarge: "20px", 25477 rippleDuration: ".6s" 25478}; 25479const self$c = (vars) => { 25480 const { 25481 heightTiny, 25482 heightSmall, 25483 heightMedium, 25484 heightLarge, 25485 borderRadius, 25486 fontSizeTiny, 25487 fontSizeSmall, 25488 fontSizeMedium, 25489 fontSizeLarge, 25490 opacityDisabled, 25491 textColor2, 25492 textColor3, 25493 primaryColorHover, 25494 primaryColorPressed, 25495 borderColor, 25496 primaryColor, 25497 baseColor, 25498 infoColor, 25499 infoColorHover, 25500 infoColorPressed, 25501 successColor, 25502 successColorHover, 25503 successColorPressed, 25504 warningColor, 25505 warningColorHover, 25506 warningColorPressed, 25507 errorColor, 25508 errorColorHover, 25509 errorColorPressed, 25510 fontWeight, 25511 buttonColor2, 25512 buttonColor2Hover, 25513 buttonColor2Pressed, 25514 fontWeightStrong 25515 } = vars; 25516 return Object.assign(Object.assign({}, commonVariables$3), { 25517 heightTiny, 25518 heightSmall, 25519 heightMedium, 25520 heightLarge, 25521 borderRadiusTiny: borderRadius, 25522 borderRadiusSmall: borderRadius, 25523 borderRadiusMedium: borderRadius, 25524 borderRadiusLarge: borderRadius, 25525 fontSizeTiny, 25526 fontSizeSmall, 25527 fontSizeMedium, 25528 fontSizeLarge, 25529 opacityDisabled, 25530 // secondary 25531 colorOpacitySecondary: "0.16", 25532 colorOpacitySecondaryHover: "0.22", 25533 colorOpacitySecondaryPressed: "0.28", 25534 colorSecondary: buttonColor2, 25535 colorSecondaryHover: buttonColor2Hover, 25536 colorSecondaryPressed: buttonColor2Pressed, 25537 // tertiary 25538 colorTertiary: buttonColor2, 25539 colorTertiaryHover: buttonColor2Hover, 25540 colorTertiaryPressed: buttonColor2Pressed, 25541 // quaternary 25542 colorQuaternary: "#0000", 25543 colorQuaternaryHover: buttonColor2Hover, 25544 colorQuaternaryPressed: buttonColor2Pressed, 25545 // default type 25546 color: "#0000", 25547 colorHover: "#0000", 25548 colorPressed: "#0000", 25549 colorFocus: "#0000", 25550 colorDisabled: "#0000", 25551 textColor: textColor2, 25552 textColorTertiary: textColor3, 25553 textColorHover: primaryColorHover, 25554 textColorPressed: primaryColorPressed, 25555 textColorFocus: primaryColorHover, 25556 textColorDisabled: textColor2, 25557 textColorText: textColor2, 25558 textColorTextHover: primaryColorHover, 25559 textColorTextPressed: primaryColorPressed, 25560 textColorTextFocus: primaryColorHover, 25561 textColorTextDisabled: textColor2, 25562 textColorGhost: textColor2, 25563 textColorGhostHover: primaryColorHover, 25564 textColorGhostPressed: primaryColorPressed, 25565 textColorGhostFocus: primaryColorHover, 25566 textColorGhostDisabled: textColor2, 25567 border: `1px solid ${borderColor}`, 25568 borderHover: `1px solid ${primaryColorHover}`, 25569 borderPressed: `1px solid ${primaryColorPressed}`, 25570 borderFocus: `1px solid ${primaryColorHover}`, 25571 borderDisabled: `1px solid ${borderColor}`, 25572 rippleColor: primaryColor, 25573 // primary 25574 colorPrimary: primaryColor, 25575 colorHoverPrimary: primaryColorHover, 25576 colorPressedPrimary: primaryColorPressed, 25577 colorFocusPrimary: primaryColorHover, 25578 colorDisabledPrimary: primaryColor, 25579 textColorPrimary: baseColor, 25580 textColorHoverPrimary: baseColor, 25581 textColorPressedPrimary: baseColor, 25582 textColorFocusPrimary: baseColor, 25583 textColorDisabledPrimary: baseColor, 25584 textColorTextPrimary: primaryColor, 25585 textColorTextHoverPrimary: primaryColorHover, 25586 textColorTextPressedPrimary: primaryColorPressed, 25587 textColorTextFocusPrimary: primaryColorHover, 25588 textColorTextDisabledPrimary: textColor2, 25589 textColorGhostPrimary: primaryColor, 25590 textColorGhostHoverPrimary: primaryColorHover, 25591 textColorGhostPressedPrimary: primaryColorPressed, 25592 textColorGhostFocusPrimary: primaryColorHover, 25593 textColorGhostDisabledPrimary: primaryColor, 25594 borderPrimary: `1px solid ${primaryColor}`, 25595 borderHoverPrimary: `1px solid ${primaryColorHover}`, 25596 borderPressedPrimary: `1px solid ${primaryColorPressed}`, 25597 borderFocusPrimary: `1px solid ${primaryColorHover}`, 25598 borderDisabledPrimary: `1px solid ${primaryColor}`, 25599 rippleColorPrimary: primaryColor, 25600 // info 25601 colorInfo: infoColor, 25602 colorHoverInfo: infoColorHover, 25603 colorPressedInfo: infoColorPressed, 25604 colorFocusInfo: infoColorHover, 25605 colorDisabledInfo: infoColor, 25606 textColorInfo: baseColor, 25607 textColorHoverInfo: baseColor, 25608 textColorPressedInfo: baseColor, 25609 textColorFocusInfo: baseColor, 25610 textColorDisabledInfo: baseColor, 25611 textColorTextInfo: infoColor, 25612 textColorTextHoverInfo: infoColorHover, 25613 textColorTextPressedInfo: infoColorPressed, 25614 textColorTextFocusInfo: infoColorHover, 25615 textColorTextDisabledInfo: textColor2, 25616 textColorGhostInfo: infoColor, 25617 textColorGhostHoverInfo: infoColorHover, 25618 textColorGhostPressedInfo: infoColorPressed, 25619 textColorGhostFocusInfo: infoColorHover, 25620 textColorGhostDisabledInfo: infoColor, 25621 borderInfo: `1px solid ${infoColor}`, 25622 borderHoverInfo: `1px solid ${infoColorHover}`, 25623 borderPressedInfo: `1px solid ${infoColorPressed}`, 25624 borderFocusInfo: `1px solid ${infoColorHover}`, 25625 borderDisabledInfo: `1px solid ${infoColor}`, 25626 rippleColorInfo: infoColor, 25627 // success 25628 colorSuccess: successColor, 25629 colorHoverSuccess: successColorHover, 25630 colorPressedSuccess: successColorPressed, 25631 colorFocusSuccess: successColorHover, 25632 colorDisabledSuccess: successColor, 25633 textColorSuccess: baseColor, 25634 textColorHoverSuccess: baseColor, 25635 textColorPressedSuccess: baseColor, 25636 textColorFocusSuccess: baseColor, 25637 textColorDisabledSuccess: baseColor, 25638 textColorTextSuccess: successColor, 25639 textColorTextHoverSuccess: successColorHover, 25640 textColorTextPressedSuccess: successColorPressed, 25641 textColorTextFocusSuccess: successColorHover, 25642 textColorTextDisabledSuccess: textColor2, 25643 textColorGhostSuccess: successColor, 25644 textColorGhostHoverSuccess: successColorHover, 25645 textColorGhostPressedSuccess: successColorPressed, 25646 textColorGhostFocusSuccess: successColorHover, 25647 textColorGhostDisabledSuccess: successColor, 25648 borderSuccess: `1px solid ${successColor}`, 25649 borderHoverSuccess: `1px solid ${successColorHover}`, 25650 borderPressedSuccess: `1px solid ${successColorPressed}`, 25651 borderFocusSuccess: `1px solid ${successColorHover}`, 25652 borderDisabledSuccess: `1px solid ${successColor}`, 25653 rippleColorSuccess: successColor, 25654 // warning 25655 colorWarning: warningColor, 25656 colorHoverWarning: warningColorHover, 25657 colorPressedWarning: warningColorPressed, 25658 colorFocusWarning: warningColorHover, 25659 colorDisabledWarning: warningColor, 25660 textColorWarning: baseColor, 25661 textColorHoverWarning: baseColor, 25662 textColorPressedWarning: baseColor, 25663 textColorFocusWarning: baseColor, 25664 textColorDisabledWarning: baseColor, 25665 textColorTextWarning: warningColor, 25666 textColorTextHoverWarning: warningColorHover, 25667 textColorTextPressedWarning: warningColorPressed, 25668 textColorTextFocusWarning: warningColorHover, 25669 textColorTextDisabledWarning: textColor2, 25670 textColorGhostWarning: warningColor, 25671 textColorGhostHoverWarning: warningColorHover, 25672 textColorGhostPressedWarning: warningColorPressed, 25673 textColorGhostFocusWarning: warningColorHover, 25674 textColorGhostDisabledWarning: warningColor, 25675 borderWarning: `1px solid ${warningColor}`, 25676 borderHoverWarning: `1px solid ${warningColorHover}`, 25677 borderPressedWarning: `1px solid ${warningColorPressed}`, 25678 borderFocusWarning: `1px solid ${warningColorHover}`, 25679 borderDisabledWarning: `1px solid ${warningColor}`, 25680 rippleColorWarning: warningColor, 25681 // error 25682 colorError: errorColor, 25683 colorHoverError: errorColorHover, 25684 colorPressedError: errorColorPressed, 25685 colorFocusError: errorColorHover, 25686 colorDisabledError: errorColor, 25687 textColorError: baseColor, 25688 textColorHoverError: baseColor, 25689 textColorPressedError: baseColor, 25690 textColorFocusError: baseColor, 25691 textColorDisabledError: baseColor, 25692 textColorTextError: errorColor, 25693 textColorTextHoverError: errorColorHover, 25694 textColorTextPressedError: errorColorPressed, 25695 textColorTextFocusError: errorColorHover, 25696 textColorTextDisabledError: textColor2, 25697 textColorGhostError: errorColor, 25698 textColorGhostHoverError: errorColorHover, 25699 textColorGhostPressedError: errorColorPressed, 25700 textColorGhostFocusError: errorColorHover, 25701 textColorGhostDisabledError: errorColor, 25702 borderError: `1px solid ${errorColor}`, 25703 borderHoverError: `1px solid ${errorColorHover}`, 25704 borderPressedError: `1px solid ${errorColorPressed}`, 25705 borderFocusError: `1px solid ${errorColorHover}`, 25706 borderDisabledError: `1px solid ${errorColor}`, 25707 rippleColorError: errorColor, 25708 waveOpacity: "0.6", 25709 fontWeight, 25710 fontWeightStrong 25711 }); 25712}; 25713const buttonLight = { 25714 name: "Button", 25715 common: commonLight, 25716 self: self$c 25717}; 25718const buttonLight$1 = buttonLight; 25719const style$b = c$1([cB("button", ` 25720 margin: 0; 25721 font-weight: var(--n-font-weight); 25722 line-height: 1; 25723 font-family: inherit; 25724 padding: var(--n-padding); 25725 height: var(--n-height); 25726 font-size: var(--n-font-size); 25727 border-radius: var(--n-border-radius); 25728 color: var(--n-text-color); 25729 background-color: var(--n-color); 25730 width: var(--n-width); 25731 white-space: nowrap; 25732 outline: none; 25733 position: relative; 25734 z-index: auto; 25735 border: none;
25736 display: inline-flex; 25737 flex-wrap: nowrap; 25738 flex-shrink: 0; 25739 align-items: center; 25740 justify-content: center; 25741 user-select: none; 25742 -webkit-user-select: none; 25743 text-align: center; 25744 cursor: pointer; 25745 text-decoration: none; 25746 transition: 25747 color .3s var(--n-bezier), 25748 background-color .3s var(--n-bezier), 25749 opacity .3s var(--n-bezier), 25750 border-color .3s var(--n-bezier); 25751 `, [cM("color", [cE("border", { 25752 borderColor: "var(--n-border-color)" 25753}), cM("disabled", [cE("border", { 25754 borderColor: "var(--n-border-color-disabled)" 25755})]), cNotM("disabled", [c$1("&:focus", [cE("state-border", { 25756 borderColor: "var(--n-border-color-focus)" 25757})]), c$1("&:hover", [cE("state-border", { 25758 borderColor: "var(--n-border-color-hover)" 25759})]), c$1("&:active", [cE("state-border", { 25760 borderColor: "var(--n-border-color-pressed)" 25761})]), cM("pressed", [cE("state-border", { 25762 borderColor: "var(--n-border-color-pressed)" 25763})])])]), cM("disabled", { 25764 backgroundColor: "var(--n-color-disabled)", 25765 color: "var(--n-text-color-disabled)" 25766}, [cE("border", { 25767 border: "var(--n-border-disabled)" 25768})]), cNotM("disabled", [c$1("&:focus", { 25769 backgroundColor: "var(--n-color-focus)", 25770 color: "var(--n-text-color-focus)" 25771}, [cE("state-border", { 25772 border: "var(--n-border-focus)" 25773})]), c$1("&:hover", { 25774 backgroundColor: "var(--n-color-hover)", 25775 color: "var(--n-text-color-hover)" 25776}, [cE("state-border", { 25777 border: "var(--n-border-hover)" 25778})]), c$1("&:active", { 25779 backgroundColor: "var(--n-color-pressed)", 25780 color: "var(--n-text-color-pressed)" 25781}, [cE("state-border", { 25782 border: "var(--n-border-pressed)" 25783})]), cM("pressed", { 25784 backgroundColor: "var(--n-color-pressed)", 25785 color: "var(--n-text-color-pressed)" 25786}, [cE("state-border", { 25787 border: "var(--n-border-pressed)" 25788})])]), cM("loading", "cursor: wait;"), cB("base-wave", ` 25789 pointer-events: none; 25790 top: 0; 25791 right: 0; 25792 bottom: 0; 25793 left: 0; 25794 animation-iteration-count: 1; 25795 animation-duration: var(--n-ripple-duration); 25796 animation-timing-function: var(--n-bezier-ease-out), var(--n-bezier-ease-out); 25797 `, [cM("active", { 25798 zIndex: 1, 25799 animationName: "button-wave-spread, button-wave-opacity" 25800})]), isBrowser$2 && "MozBoxSizing" in document.createElement("div").style ? c$1("&::moz-focus-inner", { 25801 border: 0 25802}) : null, cE("border, state-border", ` 25803 position: absolute; 25804 left: 0; 25805 top: 0; 25806 right: 0; 25807 bottom: 0; 25808 border-radius: inherit; 25809 transition: border-color .3s var(--n-bezier); 25810 pointer-events: none; 25811 `), cE("border", { 25812 border: "var(--n-border)" 25813}), cE("state-border", { 25814 border: "var(--n-border)", 25815 borderColor: "#0000", 25816 zIndex: 1 25817}), cE("icon", ` 25818 margin: var(--n-icon-margin); 25819 margin-left: 0; 25820 height: var(--n-icon-size); 25821 width: var(--n-icon-size); 25822 max-width: var(--n-icon-size); 25823 font-size: var(--n-icon-size); 25824 position: relative; 25825 flex-shrink: 0; 25826 `, [cB("icon-slot", ` 25827 height: var(--n-icon-size); 25828 width: var(--n-icon-size); 25829 position: absolute; 25830 left: 0; 25831 top: 50%; 25832 transform: translateY(-50%); 25833 display: flex; 25834 align-items: center; 25835 justify-content: center; 25836 `, [iconSwitchTransition({ 25837 top: "50%", 25838 originalTransform: "translateY(-50%)" 25839})]), fadeInWidthExpandTransition()]), cE("content", ` 25840 display: flex; 25841 align-items: center; 25842 flex-wrap: nowrap; 25843 min-width: 0; 25844 `, [c$1("~", [cE("icon", { 25845 margin: "var(--n-icon-margin)", 25846 marginRight: 0 25847})])]), cM("block", ` 25848 display: flex; 25849 width: 100%; 25850 `), cM("dashed", [cE("border, state-border", { 25851 borderStyle: "dashed !important" 25852})]), cM("disabled", { 25853 cursor: "not-allowed", 25854 opacity: "var(--n-opacity-disabled)" 25855})]), c$1("@keyframes button-wave-spread", { 25856 from: { 25857 boxShadow: "0 0 0.5px 0 var(--n-ripple-color)" 25858 }, 25859 to: { 25860 // don't use exact 5px since chrome will display the animation with glitches 25861 boxShadow: "0 0 0.5px 4.5px var(--n-ripple-color)" 25862 } 25863}), c$1("@keyframes button-wave-opacity", { 25864 from: { 25865 opacity: "var(--n-wave-opacity)" 25866 }, 25867 to: { 25868 opacity: 0 25869 } 25870})]); 25871const buttonProps = Object.assign(Object.assign({}, useTheme.props), { 25872 color: String, 25873 textColor: String, 25874 text: Boolean, 25875 block: Boolean, 25876 loading: Boolean, 25877 disabled: Boolean, 25878 circle: Boolean, 25879 size: String, 25880 ghost: Boolean, 25881 round: Boolean, 25882 secondary: Boolean, 25883 tertiary: Boolean, 25884 quaternary: Boolean, 25885 strong: Boolean, 25886 focusable: { 25887 type: Boolean, 25888 default: true 25889 }, 25890 keyboard: { 25891 type: Boolean, 25892 default: true 25893 }, 25894 tag: { 25895 type: String, 25896 default: "button" 25897 }, 25898 type: { 25899 type: String, 25900 default: "default" 25901 }, 25902 dashed: Boolean,
25903 renderIcon: Function, 25904 iconPlacement: { 25905 type: String, 25906 default: "left" 25907 }, 25908 attrType: { 25909 type: String, 25910 default: "button" 25911 }, 25912 bordered: { 25913 type: Boolean, 25914 default: true 25915 }, 25916 onClick: [Function, Array], 25917 nativeFocusBehavior: { 25918 type: Boolean, 25919 default: !isSafari 25920 } 25921}); 25922const Button = defineComponent({ 25923 name: "Button", 25924 props: buttonProps, 25925 setup(props) { 25926 const selfElRef = ref(null); 25927 const waveElRef = ref(null); 25928 const enterPressedRef = ref(false); 25929 const showBorderRef = useMemo(() => { 25930 return !props.quaternary && !props.tertiary && !props.secondary && !props.text && (!props.color || props.ghost || props.dashed) && props.bordered; 25931 }); 25932 const NButtonGroup = inject(buttonGroupInjectionKey, {}); 25933 const { 25934 mergedSizeRef 25935 } = useFormItem({}, { 25936 defaultSize: "medium", 25937 mergedSize: (NFormItem2) => { 25938 const { 25939 size: size2 25940 } = props; 25941 if (size2) 25942 return size2; 25943 const { 25944 size: buttonGroupSize 25945 } = NButtonGroup; 25946 if (buttonGroupSize) 25947 return buttonGroupSize; 25948 const { 25949 mergedSize: formItemSize2 25950 } = NFormItem2 || {}; 25951 if (formItemSize2) { 25952 return formItemSize2.value; 25953 } 25954 return "medium"; 25955 } 25956 }); 25957 const mergedFocusableRef = computed(() => { 25958 return props.focusable && !props.disabled; 25959 }); 25960 const handleMousedown = (e) => { 25961 var _a2; 25962 if (!mergedFocusableRef.value) { 25963 e.preventDefault(); 25964 } 25965 if (props.nativeFocusBehavior) { 25966 return; 25967 } 25968 e.preventDefault(); 25969 if (props.disabled) { 25970 return; 25971 } 25972 if (mergedFocusableRef.value) { 25973 (_a2 = selfElRef.value) === null || _a2 === void 0 ? void 0 : _a2.focus({ 25974 preventScroll: true 25975 }); 25976 } 25977 }; 25978 const handleClick2 = (e) => { 25979 var _a2; 25980 if (!props.disabled && !props.loading) { 25981 const { 25982 onClick 25983 } = props; 25984 if (onClick) 25985 call(onClick, e); 25986 if (!props.text) { 25987 (_a2 = waveElRef.value) === null || _a2 === void 0 ? void 0 : _a2.play(); 25988 } 25989 } 25990 }; 25991 const handleKeyup = (e) => { 25992 switch (e.key) { 25993 case "Enter": 25994 if (!props.keyboard) { 25995 return; 25996 } 25997 enterPressedRef.value = false; 25998 } 25999 }; 26000 const handleKeydown = (e) => { 26001 switch (e.key) { 26002 case "Enter": 26003 if (!props.keyboard || props.loading) { 26004 e.preventDefault(); 26005 return; 26006 } 26007 enterPressedRef.value = true; 26008 } 26009 }; 26010 const handleBlur = () => { 26011 enterPressedRef.value = false; 26012 }; 26013 const { 26014 inlineThemeDisabled, 26015 mergedClsPrefixRef, 26016 mergedRtlRef 26017 } = useConfig(props); 26018 const themeRef = useTheme("Button", "-button", style$b, buttonLight$1, props, mergedClsPrefixRef); 26019 const rtlEnabledRef = useRtl("Button", mergedRtlRef, mergedClsPrefixRef); 26020 const cssVarsRef = computed(() => { 26021 const theme = themeRef.value; 26022 const { 26023 common: { 26024 cubicBezierEaseInOut: cubicBezierEaseInOut2, 26025 cubicBezierEaseOut: cubicBezierEaseOut2 26026 }, 26027 self: self2 26028 } = theme; 26029 const { 26030 rippleDuration, 26031 opacityDisabled, 26032 fontWeight, 26033 fontWeightStrong 26034 } = self2; 26035 const size2 = mergedSizeRef.value; 26036 const { 26037 dashed, 26038 type: type4, 26039 ghost, 26040 text, 26041 color, 26042 round, 26043 circle, 26044 textColor, 26045 secondary, 26046 tertiary, 26047 quaternary, 26048 strong 26049 } = props; 26050 const fontProps = { 26051 "font-weight": strong ? fontWeightStrong : fontWeight 26052 }; 26053 let colorProps = { 26054 "--n-color": "initial", 26055 "--n-color-hover": "initial", 26056 "--n-color-pressed": "initial", 26057 "--n-color-focus": "initial", 26058 "--n-color-disabled": "initial", 26059 "--n-ripple-color": "initial", 26060 "--n-text-color": "initial", 26061 "--n-text-color-hover": "initial", 26062 "--n-text-color-pressed": "initial", 26063 "--n-text-color-focus": "initial", 26064 "--n-text-color-disabled": "initial" 26065 };
26066 const typeIsTertiary = type4 === "tertiary"; 26067 const typeIsDefault = type4 === "default"; 26068 const mergedType = typeIsTertiary ? "default" : type4; 26069 if (text) { 26070 const propTextColor = textColor || color; 26071 const mergedTextColor = propTextColor || self2[createKey("textColorText", mergedType)]; 26072 colorProps = { 26073 "--n-color": "#0000", 26074 "--n-color-hover": "#0000", 26075 "--n-color-pressed": "#0000", 26076 "--n-color-focus": "#0000", 26077 "--n-color-disabled": "#0000", 26078 "--n-ripple-color": "#0000", 26079 "--n-text-color": mergedTextColor, 26080 "--n-text-color-hover": propTextColor ? createHoverColor(propTextColor) : self2[createKey("textColorTextHover", mergedType)], 26081 "--n-text-color-pressed": propTextColor ? createPressedColor(propTextColor) : self2[createKey("textColorTextPressed", mergedType)], 26082 "--n-text-color-focus": propTextColor ? createHoverColor(propTextColor) : self2[createKey("textColorTextHover", mergedType)], 26083 "--n-text-color-disabled": propTextColor || self2[createKey("textColorTextDisabled", mergedType)] 26084 }; 26085 } else if (ghost || dashed) { 26086 const mergedTextColor = textColor || color; 26087 colorProps = { 26088 "--n-color": "#0000", 26089 "--n-color-hover": "#0000", 26090 "--n-color-pressed": "#0000", 26091 "--n-color-focus": "#0000", 26092 "--n-color-disabled": "#0000", 26093 "--n-ripple-color": color || self2[createKey("rippleColor", mergedType)], 26094 "--n-text-color": mergedTextColor || self2[createKey("textColorGhost", mergedType)], 26095 "--n-text-color-hover": mergedTextColor ? createHoverColor(mergedTextColor) : self2[createKey("textColorGhostHover", mergedType)], 26096 "--n-text-color-pressed": mergedTextColor ? createPressedColor(mergedTextColor) : self2[createKey("textColorGhostPressed", mergedType)], 26097 "--n-text-color-focus": mergedTextColor ? createHoverColor(mergedTextColor) : self2[createKey("textColorGhostHover", mergedType)], 26098 "--n-text-color-disabled": mergedTextColor || self2[createKey("textColorGhostDisabled", mergedType)] 26099 }; 26100 } else if (secondary) { 26101 const typeTextColor = typeIsDefault ? self2.textColor : typeIsTertiary ? self2.textColorTertiary : self2[createKey("color", mergedType)]; 26102 const mergedTextColor = color || typeTextColor; 26103 const isColoredType = type4 !== "default" && type4 !== "tertiary"; 26104 colorProps = { 26105 "--n-color": isColoredType ? changeColor(mergedTextColor, { 26106 alpha: Number(self2.colorOpacitySecondary) 26107 }) : self2.colorSecondary, 26108 "--n-color-hover": isColoredType ? changeColor(mergedTextColor, { 26109 alpha: Number(self2.colorOpacitySecondaryHover) 26110 }) : self2.colorSecondaryHover, 26111 "--n-color-pressed": isColoredType ? changeColor(mergedTextColor, { 26112 alpha: Number(self2.colorOpacitySecondaryPressed) 26113 }) : self2.colorSecondaryPressed, 26114 "--n-color-focus": isColoredType ? changeColor(mergedTextColor, { 26115 alpha: Number(self2.colorOpacitySecondaryHover) 26116 }) : self2.colorSecondaryHover, 26117 "--n-color-disabled": self2.colorSecondary, 26118 "--n-ripple-color": "#0000", 26119 "--n-text-color": mergedTextColor, 26120 "--n-text-color-hover": mergedTextColor, 26121 "--n-text-color-pressed": mergedTextColor, 26122 "--n-text-color-focus": mergedTextColor, 26123 "--n-text-color-disabled": mergedTextColor 26124 }; 26125 } else if (tertiary || quaternary) { 26126 const typeColor = typeIsDefault ? self2.textColor : typeIsTertiary ? self2.textColorTertiary : self2[createKey("color", mergedType)]; 26127 const mergedColor = color || typeColor; 26128 if (tertiary) { 26129 colorProps["--n-color"] = self2.colorTertiary; 26130 colorProps["--n-color-hover"] = self2.colorTertiaryHover; 26131 colorProps["--n-color-pressed"] = self2.colorTertiaryPressed; 26132 colorProps["--n-color-focus"] = self2.colorSecondaryHover; 26133 colorProps["--n-color-disabled"] = self2.colorTertiary; 26134 } else { 26135 colorProps["--n-color"] = self2.colorQuaternary; 26136 colorProps["--n-color-hover"] = self2.colorQuaternaryHover; 26137 colorProps["--n-color-pressed"] = self2.colorQuaternaryPressed; 26138 colorProps["--n-color-focus"] = self2.colorQuaternaryHover; 26139 colorProps["--n-color-disabled"] = self2.colorQuaternary; 26140 } 26141 colorProps["--n-ripple-color"] = "#0000"; 26142 colorProps["--n-text-color"] = mergedColor; 26143 colorProps["--n-text-color-hover"] = mergedColor; 26144 colorProps["--n-text-color-pressed"] = mergedColor; 26145 colorProps["--n-text-color-focus"] = mergedColor; 26146 colorProps["--n-text-color-disabled"] = mergedColor; 26147 } else { 26148 colorProps = { 26149 "--n-color": color || self2[createKey("color", mergedType)], 26150 "--n-color-hover": color ? createHoverColor(color) : self2[createKey("colorHover", mergedType)], 26151 "--n-color-pressed": color ? createPressedColor(color) : self2[createKey("colorPressed", mergedType)], 26152 "--n-color-focus": color ? createHoverColor(color) : self2[createKey("colorFocus", mergedType)], 26153 "--n-color-disabled": color || self2[createKey("colorDisabled", mergedType)], 26154 "--n-ripple-color": color || self2[createKey("rippleColor", mergedType)], 26155 "--n-text-color": textColor || (color ? self2.textColorPrimary : typeIsTertiary ? self2.textColorTertiary : self2[createKey("textColor", mergedType)]), 26156 "--n-text-color-hover": textColor || (color ? self2.textColorHoverPrimary : self2[createKey("textColorHover", mergedType)]), 26157 "--n-text-color-pressed": textColor || (color ? self2.textColorPressedPrimary : self2[createKey("textColorPressed", mergedType)]), 26158 "--n-text-color-focus": textColor || (color ? self2.textColorFocusPrimary : self2[createKey("textColorFocus", mergedType)]), 26159 "--n-text-color-disabled": textColor || (color ? self2.textColorDisabledPrimary : self2[createKey("textColorDisabled", mergedType)]) 26160 }; 26161 } 26162 let borderProps = { 26163 "--n-border": "initial", 26164 "--n-border-hover": "initial", 26165 "--n-border-pressed": "initial", 26166 "--n-border-focus": "initial", 26167 "--n-border-disabled": "initial" 26168 }; 26169 if (text) { 26170 borderProps = { 26171 "--n-border": "none", 26172 "--n-border-hover": "none", 26173 "--n-border-pressed": "none", 26174 "--n-border-focus": "none", 26175 "--n-border-disabled": "none" 26176 }; 26177 } else { 26178 borderProps = { 26179 "--n-border": self2[createKey("border", mergedType)], 26180 "--n-border-hover": self2[createKey("borderHover", mergedType)], 26181 "--n-border-pressed": self2[createKey("borderPressed", mergedType)], 26182 "--n-border-focus": self2[createKey("borderFocus", mergedType)], 26183 "--n-border-disabled": self2[createKey("borderDisabled", mergedType)] 26184 }; 26185 } 26186 const { 26187 [createKey("height", size2)]: height, 26188 [createKey("fontSize", size2)]: fontSize2, 26189 [createKey("padding", size2)]: padding, 26190 [createKey("paddingRound", size2)]: paddingRound, 26191 [createKey("iconSize", size2)]: iconSize, 26192 [createKey("borderRadius", size2)]: borderRadius, 26193 [createKey("iconMargin", size2)]: iconMargin, 26194 waveOpacity 26195 } = self2; 26196 const sizeProps = {
26197 "--n-width": circle && !text ? height : "initial", 26198 "--n-height": text ? "initial" : height, 26199 "--n-font-size": fontSize2, 26200 "--n-padding": circle ? "initial" : text ? "initial" : round ? paddingRound : padding, 26201 "--n-icon-size": iconSize, 26202 "--n-icon-margin": iconMargin, 26203 "--n-border-radius": text ? "initial" : circle || round ? height : borderRadius 26204 }; 26205 return Object.assign(Object.assign(Object.assign(Object.assign({ 26206 "--n-bezier": cubicBezierEaseInOut2, 26207 "--n-bezier-ease-out": cubicBezierEaseOut2, 26208 "--n-ripple-duration": rippleDuration, 26209 "--n-opacity-disabled": opacityDisabled, 26210 "--n-wave-opacity": waveOpacity 26211 }, fontProps), colorProps), borderProps), sizeProps); 26212 }); 26213 const themeClassHandle = inlineThemeDisabled ? useThemeClass("button", computed(() => { 26214 let hash = ""; 26215 const { 26216 dashed, 26217 type: type4, 26218 ghost, 26219 text, 26220 color, 26221 round, 26222 circle, 26223 textColor, 26224 secondary, 26225 tertiary, 26226 quaternary, 26227 strong 26228 } = props; 26229 if (dashed) 26230 hash += "a"; 26231 if (ghost) 26232 hash += "b"; 26233 if (text) 26234 hash += "c"; 26235 if (round) 26236 hash += "d"; 26237 if (circle) 26238 hash += "e"; 26239 if (secondary) 26240 hash += "f"; 26241 if (tertiary) 26242 hash += "g"; 26243 if (quaternary) 26244 hash += "h"; 26245 if (strong) 26246 hash += "i"; 26247 if (color) 26248 hash += "j" + color2Class(color); 26249 if (textColor) 26250 hash += "k" + color2Class(textColor); 26251 const { 26252 value: size2 26253 } = mergedSizeRef; 26254 hash += "l" + size2[0]; 26255 hash += "m" + type4[0]; 26256 return hash; 26257 }), cssVarsRef, props) : void 0; 26258 return { 26259 selfElRef, 26260 waveElRef, 26261 mergedClsPrefix: mergedClsPrefixRef, 26262 mergedFocusable: mergedFocusableRef, 26263 mergedSize: mergedSizeRef, 26264 showBorder: showBorderRef, 26265 enterPressed: enterPressedRef, 26266 rtlEnabled: rtlEnabledRef, 26267 handleMousedown, 26268 handleKeydown, 26269 handleBlur, 26270 handleKeyup, 26271 handleClick: handleClick2, 26272 customColorCssVars: computed(() => { 26273 const { 26274 color 26275 } = props; 26276 if (!color) 26277 return null; 26278 const hoverColor = createHoverColor(color); 26279 return { 26280 "--n-border-color": color, 26281 "--n-border-color-hover": hoverColor, 26282 "--n-border-color-pressed": createPressedColor(color), 26283 "--n-border-color-focus": hoverColor, 26284 "--n-border-color-disabled": color 26285 }; 26286 }), 26287 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef, 26288 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 26289 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 26290 }; 26291 }, 26292 render() { 26293 const { 26294 mergedClsPrefix, 26295 tag: Component, 26296 onRender 26297 } = this; 26298 onRender === null || onRender === void 0 ? void 0 : onRender(); 26299 const children = resolveWrappedSlot(this.$slots.default, (children2) => children2 && h("span", { 26300 class: `${mergedClsPrefix}-button__content` 26301 }, children2)); 26302 return h(Component, { 26303 ref: "selfElRef", 26304 class: [ 26305 this.themeClass, 26306 `${mergedClsPrefix}-button`, 26307 `${mergedClsPrefix}-button--${this.type}-type`, 26308 `${mergedClsPrefix}-button--${this.mergedSize}-type`, 26309 this.rtlEnabled && `${mergedClsPrefix}-button--rtl`, 26310 this.disabled && `${mergedClsPrefix}-button--disabled`, 26311 this.block && `${mergedClsPrefix}-button--block`, 26312 this.enterPressed && `${mergedClsPrefix}-button--pressed`, 26313 !this.text && this.dashed && `${mergedClsPrefix}-button--dashed`, 26314 this.color && `${mergedClsPrefix}-button--color`, 26315 this.secondary && `${mergedClsPrefix}-button--secondary`, 26316 this.loading && `${mergedClsPrefix}-button--loading`, 26317 this.ghost && `${mergedClsPrefix}-button--ghost` 26318 // required for button group border collapse 26319 ], 26320 tabindex: this.mergedFocusable ? 0 : -1, 26321 type: this.attrType, 26322 style: this.cssVars, 26323 disabled: this.disabled, 26324 onClick: this.handleClick, 26325 onBlur: this.handleBlur, 26326 onMousedown: this.handleMousedown, 26327 onKeyup: this.handleKeyup,
26328 onKeydown: this.handleKeydown 26329 }, this.iconPlacement === "right" && children, h(NFadeInExpandTransition, { 26330 width: true 26331 }, { 26332 default: () => resolveWrappedSlot(this.$slots.icon, (children2) => (this.loading || this.renderIcon || children2) && h("span", { 26333 class: `${mergedClsPrefix}-button__icon`, 26334 style: { 26335 margin: isSlotEmpty(this.$slots.default) ? "0" : "" 26336 } 26337 }, h(NIconSwitchTransition, null, { 26338 default: () => this.loading ? h(NBaseLoading, { 26339 clsPrefix: mergedClsPrefix, 26340 key: "loading", 26341 class: `${mergedClsPrefix}-icon-slot`, 26342 strokeWidth: 20 26343 }) : h("div", { 26344 key: "icon", 26345 class: `${mergedClsPrefix}-icon-slot`, 26346 role: "none" 26347 }, this.renderIcon ? this.renderIcon() : children2) 26348 }))) 26349 }), this.iconPlacement === "left" && children, !this.text ? h(NBaseWave, { 26350 ref: "waveElRef", 26351 clsPrefix: mergedClsPrefix 26352 }) : null, this.showBorder ? h("div", { 26353 "aria-hidden": true, 26354 class: `${mergedClsPrefix}-button__border`, 26355 style: this.customColorCssVars 26356 }) : null, this.showBorder ? h("div", { 26357 "aria-hidden": true, 26358 class: `${mergedClsPrefix}-button__state-border`, 26359 style: this.customColorCssVars 26360 }) : null); 26361 } 26362}); 26363const NButton = Button; 26364const XButton = Button; 26365const commonVariables$2 = { 26366 paddingSmall: "12px 16px 12px", 26367 paddingMedium: "19px 24px 20px", 26368 paddingLarge: "23px 32px 24px", 26369 paddingHuge: "27px 40px 28px", 26370 titleFontSizeSmall: "16px", 26371 titleFontSizeMedium: "18px", 26372 titleFontSizeLarge: "18px", 26373 titleFontSizeHuge: "18px", 26374 closeIconSize: "18px", 26375 closeSize: "22px" 26376}; 26377const self$b = (vars) => { 26378 const { 26379 primaryColor, 26380 borderRadius, 26381 lineHeight: lineHeight2, 26382 fontSize: fontSize2, 26383 cardColor, 26384 textColor2, 26385 textColor1, 26386 dividerColor, 26387 fontWeightStrong, 26388 closeIconColor, 26389 closeIconColorHover, 26390 closeIconColorPressed, 26391 closeColorHover, 26392 closeColorPressed, 26393 modalColor, 26394 boxShadow1, 26395 popoverColor, 26396 actionColor 26397 } = vars; 26398 return Object.assign(Object.assign({}, commonVariables$2), { 26399 lineHeight: lineHeight2, 26400 color: cardColor, 26401 colorModal: modalColor, 26402 colorPopover: popoverColor, 26403 colorTarget: primaryColor, 26404 colorEmbedded: actionColor, 26405 colorEmbeddedModal: actionColor, 26406 colorEmbeddedPopover: actionColor, 26407 textColor: textColor2, 26408 titleTextColor: textColor1, 26409 borderColor: dividerColor, 26410 actionColor, 26411 titleFontWeight: fontWeightStrong, 26412 closeColorHover, 26413 closeColorPressed, 26414 closeBorderRadius: borderRadius, 26415 closeIconColor, 26416 closeIconColorHover, 26417 closeIconColorPressed, 26418 fontSizeSmall: fontSize2, 26419 fontSizeMedium: fontSize2, 26420 fontSizeLarge: fontSize2, 26421 fontSizeHuge: fontSize2, 26422 boxShadow: boxShadow1, 26423 borderRadius 26424 }); 26425}; 26426const cardLight = { 26427 name: "Card", 26428 common: commonLight, 26429 self: self$b 26430}; 26431const cardLight$1 = cardLight; 26432const style$a = c$1([cB("card", ` 26433 font-size: var(--n-font-size); 26434 line-height: var(--n-line-height); 26435 display: flex; 26436 flex-direction: column; 26437 width: 100%; 26438 box-sizing: border-box; 26439 position: relative; 26440 border-radius: var(--n-border-radius); 26441 background-color: var(--n-color); 26442 color: var(--n-text-color); 26443 word-break: break-word; 26444 transition: 26445 color .3s var(--n-bezier), 26446 background-color .3s var(--n-bezier), 26447 box-shadow .3s var(--n-bezier), 26448 border-color .3s var(--n-bezier); 26449 `, [asModal({ 26450 background: "var(--n-color-modal)" 26451}), cM("hoverable", [c$1("&:hover", "box-shadow: var(--n-box-shadow);")]), cM("content-segmented", [c$1(">", [cE("content", { 26452 paddingTop: "var(--n-padding-bottom)" 26453})])]), cM("content-soft-segmented", [c$1(">", [cE("content", ` 26454 margin: 0 var(--n-padding-left); 26455 padding: var(--n-padding-bottom) 0; 26456 `)])]), cM("footer-segmented", [c$1(">", [cE("footer", { 26457 paddingTop: "var(--n-padding-bottom)" 26458})])]), cM("footer-soft-segmented", [c$1(">", [cE("footer", ` 26459 padding: var(--n-padding-bottom) 0; 26460 margin: 0 var(--n-padding-left); 26461 `)])]), c$1(">
26461", [cB("card-header", ` 26462 box-sizing: border-box; 26463 display: flex; 26464 align-items: center; 26465 font-size: var(--n-title-font-size); 26466 padding: 26467 var(--n-padding-top) 26468 var(--n-padding-left) 26469 var(--n-padding-bottom) 26470 var(--n-padding-left); 26471 `, [cE("main", ` 26472 font-weight: var(--n-title-font-weight); 26473 transition: color .3s var(--n-bezier); 26474 flex: 1; 26475 min-width: 0; 26476 color: var(--n-title-text-color); 26477 `), cE("extra", ` 26478 display: flex; 26479 align-items: center; 26480 font-size: var(--n-font-size); 26481 font-weight: 400; 26482 transition: color .3s var(--n-bezier); 26483 color: var(--n-text-color); 26484 `), cE("close", ` 26485 margin: 0 0 0 8px; 26486 transition: 26487 background-color .3s var(--n-bezier), 26488 color .3s var(--n-bezier); 26489 `)]), cE("action", ` 26490 box-sizing: border-box; 26491 transition: 26492 background-color .3s var(--n-bezier), 26493 border-color .3s var(--n-bezier); 26494 background-clip: padding-box; 26495 background-color: var(--n-action-color); 26496 `), cE("content", "flex: 1; min-width: 0;"), cE("content, footer", ` 26497 box-sizing: border-box; 26498 padding: 0 var(--n-padding-left) var(--n-padding-bottom) var(--n-padding-left); 26499 font-size: var(--n-font-size); 26500 `, [c$1("&:first-child", { 26501 paddingTop: "var(--n-padding-bottom)" 26502})]), cE("action", ` 26503 background-color: var(--n-action-color); 26504 padding: var(--n-padding-bottom) var(--n-padding-left); 26505 border-bottom-left-radius: var(--n-border-radius); 26506 border-bottom-right-radius: var(--n-border-radius); 26507 `)]), cB("card-cover", ` 26508 overflow: hidden; 26509 width: 100%; 26510 border-radius: var(--n-border-radius) var(--n-border-radius) 0 0; 26511 `, [c$1("img", ` 26512 display: block; 26513 width: 100%; 26514 `)]), cM("bordered", ` 26515 border: 1px solid var(--n-border-color); 26516 `, [c$1("&:target", "border-color: var(--n-color-target);")]), cM("action-segmented", [c$1(">", [cE("action", [c$1("&:not(:first-child)", { 26517 borderTop: "1px solid var(--n-border-color)" 26518})])])]), cM("content-segmented, content-soft-segmented", [c$1(">", [cE("content", { 26519 transition: "border-color 0.3s var(--n-bezier)" 26520}, [c$1("&:not(:first-child)", { 26521 borderTop: "1px solid var(--n-border-color)" 26522})])])]), cM("footer-segmented, footer-soft-segmented", [c$1(">", [cE("footer", { 26523 transition: "border-color 0.3s var(--n-bezier)" 26524}, [c$1("&:not(:first-child)", { 26525 borderTop: "1px solid var(--n-border-color)" 26526})])])]), cM("embedded", ` 26527 background-color: var(--n-color-embedded); 26528 `)]), insideModal(cB("card", ` 26529 background: var(--n-color-modal); 26530 `, [cM("embedded", ` 26531 background-color: var(--n-color-embedded-modal); 26532 `)])), insidePopover(cB("card", ` 26533 background: var(--n-color-popover); 26534 `, [cM("embedded", ` 26535 background-color: var(--n-color-embedded-popover); 26536 `)]))]); 26537const cardBaseProps = { 26538 title: String, 26539 contentClass: String, 26540 contentStyle: [Object, String], 26541 headerClass: String, 26542 headerStyle: [Object, String], 26543 headerExtraClass: String, 26544 headerExtraStyle: [Object, String], 26545 footerClass: String, 26546 footerStyle: [Object, String], 26547 embedded: Boolean, 26548 segmented: { 26549 type: [Boolean, Object], 26550 default: false 26551 }, 26552 size: { 26553 type: String, 26554 default: "medium" 26555 }, 26556 bordered: { 26557 type: Boolean, 26558 default: true 26559 }, 26560 closable: Boolean, 26561 hoverable: Boolean, 26562 role: String, 26563 onClose: [Function, Array], 26564 tag: { 26565 type: String, 26566 default: "div" 26567 } 26568}; 26569const cardBasePropKeys = keysOf(cardBaseProps); 26570const cardProps = Object.assign(Object.assign({}, useTheme.props), cardBaseProps); 26571const NCard = defineComponent({ 26572 name: "Card", 26573 props: cardProps, 26574 setup(props) { 26575 const handleCloseClick = () => { 26576 const { 26577 onClose 26578 } = props; 26579 if (onClose) 26580 call(onClose); 26581 }; 26582 const { 26583 inlineThemeDisabled, 26584 mergedClsPrefixRef, 26585 mergedRtlRef 26586 } = useConfig(props); 26587 const themeRef = useTheme("Card", "-card", style$a, cardLight$1, props, mergedClsPrefixRef); 26588 const rtlEnabledRef = useRtl("Card", mergedRtlRef, mergedClsPrefixRef); 26589 const cssVarsRef = computed(() => { 26590 const { 26591 size: size2 26592 } = props; 26593 const { 26594 self: { 26595 color, 26596 colorModal, 26597 colorTarget, 26598 textColor, 26599 titleTextColor, 26600 titleFontWeight, 26601 borderColor, 26602 actionColor, 26603 borderRadius, 26604 lineHeight: lineHeight2, 26605 closeIconColor, 26606 closeIconColorHover, 26607 closeIconColorPressed, 26608 closeColorHover, 26609 closeColorPressed, 26610 closeBorderRadius, 26611 closeIconSize, 26612 closeSize, 26613 boxShadow, 26614 colorPopover, 26615 colorEmbedded, 26616 colorEmbeddedModal, 26617 colorEmbeddedPopover, 26618 [createKey("padding", size2)]: padding, 26619 [createKey("fontSize", size2)]: fontSize2, 26620 [createKey("titleFontSize", size2)]: titleFontSize 26621 }, 26622 common: { 26623 cubicBezierEaseInOut: cubicBezierEaseInOut2 26624 } 26625 } = themeRef.value; 26626 const { 26627 top: paddingTop, 26628 left: paddingLeft, 26629 bottom: paddingBottom 26630 } = getMargin(padding); 26631 return { 26632 "--n-bezier": cubicBezierEaseInOut2, 26633 "--n-border-radius": borderRadius, 26634 "--n-color": color,
26635 "--n-color-modal": colorModal, 26636 "--n-color-popover": colorPopover, 26637 "--n-color-embedded": colorEmbedded, 26638 "--n-color-embedded-modal": colorEmbeddedModal, 26639 "--n-color-embedded-popover": colorEmbeddedPopover, 26640 "--n-color-target": colorTarget, 26641 "--n-text-color": textColor, 26642 "--n-line-height": lineHeight2, 26643 "--n-action-color": actionColor, 26644 "--n-title-text-color": titleTextColor, 26645 "--n-title-font-weight": titleFontWeight, 26646 "--n-close-icon-color": closeIconColor, 26647 "--n-close-icon-color-hover": closeIconColorHover, 26648 "--n-close-icon-color-pressed": closeIconColorPressed, 26649 "--n-close-color-hover": closeColorHover, 26650 "--n-close-color-pressed": closeColorPressed, 26651 "--n-border-color": borderColor, 26652 "--n-box-shadow": boxShadow, 26653 // size 26654 "--n-padding-top": paddingTop, 26655 "--n-padding-bottom": paddingBottom, 26656 "--n-padding-left": paddingLeft, 26657 "--n-font-size": fontSize2, 26658 "--n-title-font-size": titleFontSize, 26659 "--n-close-size": closeSize, 26660 "--n-close-icon-size": closeIconSize, 26661 "--n-close-border-radius": closeBorderRadius 26662 }; 26663 }); 26664 const themeClassHandle = inlineThemeDisabled ? useThemeClass("card", computed(() => { 26665 return props.size[0]; 26666 }), cssVarsRef, props) : void 0; 26667 return { 26668 rtlEnabled: rtlEnabledRef, 26669 mergedClsPrefix: mergedClsPrefixRef, 26670 mergedTheme: themeRef, 26671 handleCloseClick, 26672 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef, 26673 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 26674 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 26675 }; 26676 }, 26677 render() { 26678 const { 26679 segmented, 26680 bordered, 26681 hoverable, 26682 mergedClsPrefix, 26683 rtlEnabled, 26684 onRender, 26685 embedded, 26686 tag: Component, 26687 $slots 26688 } = this; 26689 onRender === null || onRender === void 0 ? void 0 : onRender(); 26690 return h(Component, { 26691 class: [`${mergedClsPrefix}-card`, this.themeClass, embedded && `${mergedClsPrefix}-card--embedded`, { 26692 [`${mergedClsPrefix}-card--rtl`]: rtlEnabled, 26693 [`${mergedClsPrefix}-card--content${typeof segmented !== "boolean" && segmented.content === "soft" ? "-soft" : ""}-segmented`]: segmented === true || segmented !== false && segmented.content, 26694 [`${mergedClsPrefix}-card--footer${typeof segmented !== "boolean" && segmented.footer === "soft" ? "-soft" : ""}-segmented`]: segmented === true || segmented !== false && segmented.footer, 26695 [`${mergedClsPrefix}-card--action-segmented`]: segmented === true || segmented !== false && segmented.action, 26696 [`${mergedClsPrefix}-card--bordered`]: bordered, 26697 [`${mergedClsPrefix}-card--hoverable`]: hoverable 26698 }], 26699 style: this.cssVars, 26700 role: this.role 26701 }, resolveWrappedSlot($slots.cover, (children) => children && h("div", { 26702 class: `${mergedClsPrefix}-card-cover`, 26703 role: "none" 26704 }, children)), resolveWrappedSlot($slots.header, (children) => { 26705 return children || this.title || this.closable ? h("div", { 26706 class: [`${mergedClsPrefix}-card-header`, this.headerClass], 26707 style: this.headerStyle 26708 }, h("div", { 26709 class: `${mergedClsPrefix}-card-header__main`, 26710 role: "heading" 26711 }, children || this.title), resolveWrappedSlot($slots["header-extra"], (children2) => children2 && h("div", { 26712 class: [`${mergedClsPrefix}-card-header__extra`, this.headerExtraClass], 26713 style: this.headerExtraStyle 26714 }, children2)), this.closable ? h(NBaseClose, { 26715 clsPrefix: mergedClsPrefix, 26716 class: `${mergedClsPrefix}-card-header__close`, 26717 onClick: this.handleCloseClick, 26718 absolute: true 26719 }) : null) : null; 26720 }), resolveWrappedSlot($slots.default, (children) => children && h("div", { 26721 class: [`${mergedClsPrefix}-card__content`, this.contentClass], 26722 style: this.contentStyle, 26723 role: "none" 26724 }, children)), resolveWrappedSlot($slots.footer, (children) => children && [h("div", { 26725 class: [`${mergedClsPrefix}-card__footer`, this.footerClass], 26726 style: this.footerStyle, 26727 role: "none" 26728 }, children)]), resolveWrappedSlot($slots.action, (children) => children && h("div", { 26729 class: `${mergedClsPrefix}-card__action`, 26730 role: "none" 26731 }, children))); 26732 } 26733}); 26734const commonVariables$1 = { 26735 sizeSmall: "14px", 26736 sizeMedium: "16px", 26737 sizeLarge: "18px", 26738 labelPadding: "0 8px", 26739 labelFontWeight: "400" 26740}; 26741const self$a = (vars) => { 26742 const { 26743 baseColor, 26744 inputColorDisabled, 26745 cardColor, 26746 modalColor, 26747 popoverColor, 26748 textColorDisabled, 26749 borderColor, 26750 primaryColor, 26751 textColor2, 26752 fontSizeSmall, 26753 fontSizeMedium, 26754 fontSizeLarge, 26755 borderRadiusSmall, 26756 lineHeight: lineHeight2 26757 }
26757 = vars; 26758 return Object.assign(Object.assign({}, commonVariables$1), { 26759 labelLineHeight: lineHeight2, 26760 fontSizeSmall, 26761 fontSizeMedium, 26762 fontSizeLarge, 26763 borderRadius: borderRadiusSmall, 26764 color: baseColor, 26765 colorChecked: primaryColor, 26766 colorDisabled: inputColorDisabled, 26767 colorDisabledChecked: inputColorDisabled, 26768 colorTableHeader: cardColor, 26769 colorTableHeaderModal: modalColor, 26770 colorTableHeaderPopover: popoverColor, 26771 checkMarkColor: baseColor, 26772 checkMarkColorDisabled: textColorDisabled, 26773 checkMarkColorDisabledChecked: textColorDisabled, 26774 border: `1px solid ${borderColor}`, 26775 borderDisabled: `1px solid ${borderColor}`, 26776 borderDisabledChecked: `1px solid ${borderColor}`, 26777 borderChecked: `1px solid ${primaryColor}`, 26778 borderFocus: `1px solid ${primaryColor}`, 26779 boxShadowFocus: `0 0 0 2px ${changeColor(primaryColor, { 26780 alpha: 0.3 26781 })}`, 26782 textColor: textColor2, 26783 textColorDisabled 26784 }); 26785}; 26786const checkboxLight = { 26787 name: "Checkbox", 26788 common: commonLight, 26789 self: self$a 26790}; 26791const checkboxLight$1 = checkboxLight; 26792const CheckMark = h("svg", { 26793 viewBox: "0 0 64 64", 26794 class: "check-icon" 26795}, h("path", { 26796 d: "M50.42,16.76L22.34,39.45l-8.1-11.46c-1.12-1.58-3.3-1.96-4.88-0.84c-1.58,1.12-1.95,3.3-0.84,4.88l10.26,14.51 c0.56,0.79,1.42,1.31,2.38,1.45c0.16,0.02,0.32,0.03,0.48,0.03c0.8,0,1.57-0.27,2.2-0.78l30.99-25.03c1.5-1.21,1.74-3.42,0.52-4.92 C54.13,15.78,51.93,15.55,50.42,16.76z" 26797})); 26798const LineMark = h("svg", { 26799 viewBox: "0 0 100 100", 26800 class: "line-icon" 26801}, h("path", { 26802 d: "M80.2,55.5H21.4c-2.8,0-5.1-2.5-5.1-5.5l0,0c0-3,2.3-5.5,5.1-5.5h58.7c2.8,0,5.1,2.5,5.1,5.5l0,0C85.2,53.1,82.9,55.5,80.2,55.5z" 26803})); 26804const checkboxGroupInjectionKey = createInjectionKey("n-checkbox-group"); 26805const style$9 = c$1([ 26806 cB("checkbox", ` 26807 font-size: var(--n-font-size); 26808 outline: none; 26809 cursor: pointer; 26810 display: inline-flex; 26811 flex-wrap: nowrap; 26812 align-items: flex-start; 26813 word-break: break-word; 26814 line-height: var(--n-size); 26815 --n-merged-color-table: var(--n-color-table); 26816 `, [cM("show-label", "line-height: var(--n-label-line-height);"), c$1("&:hover", [cB("checkbox-box", [cE("border", "border: var(--n-border-checked);")])]), c$1("&:focus:not(:active)", [cB("checkbox-box", [cE("border", ` 26817 border: var(--n-border-focus); 26818 box-shadow: var(--n-box-shadow-focus); 26819 `)])]), cM("inside-table", [cB("checkbox-box", ` 26820 background-color: var(--n-merged-color-table); 26821 `)]), cM("checked", [cB("checkbox-box", ` 26822 background-color: var(--n-color-checked); 26823 `, [cB("checkbox-icon", [ 26824 // if not set width to 100%, safari & old chrome won't display the icon 26825 c$1(".check-icon", ` 26826 opacity: 1; 26827 transform: scale(1); 26828 `) 26829 ])])]), cM("indeterminate", [cB("checkbox-box", [cB("checkbox-icon", [c$1(".check-icon", ` 26830 opacity: 0; 26831 transform: scale(.5); 26832 `), c$1(".line-icon", ` 26833 opacity: 1; 26834 transform: scale(1); 26835 `)])])]), cM("checked, indeterminate", [c$1("&:focus:not(:active)", [cB("checkbox-box", [cE("border", ` 26836 border: var(--n-border-checked); 26837 box-shadow: var(--n-box-shadow-focus); 26838 `)])]), cB("checkbox-box", ` 26839 background-color: var(--n-color-checked); 26840 border-left: 0; 26841 border-top: 0; 26842 `, [cE("border", { 26843 border: "var(--n-border-checked)" 26844 })])]), cM("disabled", { 26845 cursor: "not-allowed" 26846 }, [cM("checked", [cB("checkbox-box", ` 26847 background-color: var(--n-color-disabled-checked); 26848 `, [cE("border", { 26849 border: "var(--n-border-disabled-checked)" 26850 }), cB("checkbox-icon", [c$1(".check-icon, .line-icon", { 26851 fill: "var(--n-check-mark-color-disabled-checked)" 26852 })])])]), cB("checkbox-box", ` 26853 background-color: var(--n-color-disabled); 26854 `, [cE("border", ` 26855 border: var(--n-border-disabled); 26856 `), cB("checkbox-icon", [c$1(".check-icon, .line-icon", ` 26857 fill: var(--n-check-mark-color-disabled); 26858 `)])]), cE("label", ` 26859 color: var(--n-text-color-disabled); 26860 `)]), cB("checkbox-box-wrapper", ` 26861 position: relative; 26862 width: var(--n-size); 26863 flex-shrink: 0; 26864 flex-grow: 0; 26865 user-select: none; 26866 -webkit-user-select: none; 26867 `), cB("checkbox-box", ` 26868 position: absolute; 26869 left: 0; 26870 top: 50%; 26871 transform: translateY(-50%); 26872 height: var(--n-size); 26873 width: var(--n-size); 26874 display: inline-block; 26875 box-sizing: border-box; 26876 border-radius: var(--n-border-radius); 26877 background-color: var(--n-color); 26878 transition: background-color 0.3s var(--n-bezier); 26879 `, [cE("border", ` 26880 transition: 26881 border-color .3s var(--n-bezier), 26882 box-shadow .3s var(--n-bezier); 26883 border-radius: inherit; 26884 position: absolute; 26885 left: 0; 26886 right: 0; 26887 top: 0; 26888 bottom: 0; 26889 border: var(--n-border); 26890 `), cB("checkbox-icon", ` 26891 display: flex; 26892 align-items: center; 26893 justify-content: center; 26894 position: absolute; 26895 left: 1px; 26896 right: 1px; 26897 top: 1px; 26898 bottom: 1px; 26899 `, [c$1(".check-icon, .line-icon", ` 26900 width: 100%; 26901 fill: var(--n-check-mark-color); 26902 opacity: 0; 26903 transform: scale(0.5); 26904 transform-origin: center; 26905 transition: 26906 fill 0.3s var(--n-bezier), 26907 transform 0.3s var(--n-bezier), 26908 opacity 0.3s var(--n-bezier), 26909 border-color 0.3s var(--n-bezier); 26910 `), iconSwitchTransition({ 26911 left: "1px", 26912 top: "1px" 26913 })])]), cE("label", ` 26914 color: var(--n-text-color); 26915 transition: color .3s var(--n-bezier); 26916 user-select: none; 26917 -webkit-user-select: none; 26918 padding: var(--n-label-padding);
26919 font-weight: var(--n-label-font-weight); 26920 `, [c$1("&:empty", { 26921 display: "none" 26922 })])]), 26923 // modal table header checkbox 26924 insideModal(cB("checkbox", ` 26925 --n-merged-color-table: var(--n-color-table-modal); 26926 `)), 26927 // popover table header checkbox 26928 insidePopover(cB("checkbox", ` 26929 --n-merged-color-table: var(--n-color-table-popover); 26930 `)) 26931]); 26932const checkboxProps = Object.assign(Object.assign({}, useTheme.props), { 26933 size: String, 26934 checked: { 26935 type: [Boolean, String, Number], 26936 default: void 0 26937 }, 26938 defaultChecked: { 26939 type: [Boolean, String, Number], 26940 default: false 26941 }, 26942 value: [String, Number], 26943 disabled: { 26944 type: Boolean, 26945 default: void 0 26946 }, 26947 indeterminate: Boolean, 26948 label: String, 26949 focusable: { 26950 type: Boolean, 26951 default: true 26952 }, 26953 checkedValue: { 26954 type: [Boolean, String, Number], 26955 default: true 26956 }, 26957 uncheckedValue: { 26958 type: [Boolean, String, Number], 26959 default: false 26960 }, 26961 "onUpdate:checked": [Function, Array], 26962 onUpdateChecked: [Function, Array], 26963 // private 26964 privateInsideTable: Boolean, 26965 // deprecated 26966 onChange: [Function, Array] 26967}); 26968const NCheckbox = defineComponent({ 26969 name: "Checkbox", 26970 props: checkboxProps, 26971 setup(props) { 26972 const selfRef = ref(null); 26973 const { 26974 mergedClsPrefixRef, 26975 inlineThemeDisabled, 26976 mergedRtlRef 26977 } = useConfig(props); 26978 const formItem = useFormItem(props, { 26979 mergedSize(NFormItem2) { 26980 const { 26981 size: size2 26982 } = props; 26983 if (size2 !== void 0) 26984 return size2; 26985 if (NCheckboxGroup) { 26986 const { 26987 value: mergedSize 26988 } = NCheckboxGroup.mergedSizeRef; 26989 if (mergedSize !== void 0) { 26990 return mergedSize; 26991 } 26992 } 26993 if (NFormItem2) { 26994 const { 26995 mergedSize 26996 } = NFormItem2; 26997 if (mergedSize !== void 0) 26998 return mergedSize.value; 26999 } 27000 return "medium"; 27001 }, 27002 mergedDisabled(NFormItem2) { 27003 const { 27004 disabled 27005 } = props; 27006 if (disabled !== void 0) 27007 return disabled; 27008 if (NCheckboxGroup) { 27009 if (NCheckboxGroup.disabledRef.value) 27010 return true; 27011 const { 27012 maxRef: { 27013 value: max 27014 }, 27015 checkedCountRef 27016 } = NCheckboxGroup; 27017 if (max !== void 0 && checkedCountRef.value >= max && !renderedCheckedRef.value) { 27018 return true; 27019 } 27020 const { 27021 minRef: { 27022 value: min 27023 } 27024 } = NCheckboxGroup; 27025 if (min !== void 0 && checkedCountRef.value <= min && renderedCheckedRef.value) { 27026 return true; 27027 } 27028 } 27029 if (NFormItem2) { 27030 return NFormItem2.disabled.value; 27031 } 27032 return false; 27033 } 27034 }); 27035 const { 27036 mergedDisabledRef, 27037 mergedSizeRef 27038 } = formItem; 27039 const NCheckboxGroup = inject(checkboxGroupInjectionKey, null); 27040 const uncontrolledCheckedRef = ref(props.defaultChecked); 27041 const controlledCheckedRef = toRef(props, "checked"); 27042 const mergedCheckedRef = useMergedState(controlledCheckedRef, uncontrolledCheckedRef); 27043 const renderedCheckedRef = useMemo(() => { 27044 if (NCheckboxGroup) { 27045 const groupValueSet = NCheckboxGroup.valueSetRef.value; 27046 if (groupValueSet && props.value !== void 0) { 27047 return groupValueSet.has(props.value); 27048 } 27049 return false; 27050 } else { 27051 return mergedCheckedRef.value === props.checkedValue; 27052 } 27053 }); 27054 const themeRef = useTheme("Checkbox", "-checkbox", style$9, checkboxLight$1, props, mergedClsPrefixRef); 27055 function toggle(e) { 27056 if (NCheckboxGroup && props.value !== void 0) { 27057 NCheckboxGroup.toggleCheckbox(!renderedCheckedRef.value, props.value); 27058 } else { 27059 const { 27060 onChange, 27061 "onUpdate:checked": _onUpdateCheck, 27062 onUpdateChecked 27063 } = props; 27064 const { 27065 nTriggerFormInput, 27066 nTriggerFormChange 27067 } = formItem; 27068 const nextChecked = renderedCheckedRef.value ? props.uncheckedValue : props.checkedValue; 27069 if (_onUpdateCheck) { 27070 call(_onUpdateCheck, nextChecked, e); 27071 } 27072 if (onUpdateChecked) { 27073 call(onUpdateChecked, nextChecked, e); 27074 } 27075 if (onChange) 27076 call(onChange, nextChecked, e); 27077 nTriggerFormInput(); 27078 nTriggerFormChange(); 27079 uncontrolledCheckedRef.value = nextChecked; 27080 } 27081 } 27082 function handleClick2(e) { 27083 if (!mergedDisabledRef.value) { 27084 toggle(e); 27085 } 27086 } 27087 function handleKeyUp(e) { 27088 if (mergedDisabledRef.value) 27089 return; 27090 switch (e.key) { 27091 case " ": 27092 case "Enter": 27093 toggle(e); 27094 } 27095 } 27096 function handleKeyDown(e) { 27097 switch (e.key) { 27098 case " ": 27099 e.preventDefault(); 27100 } 27101 } 27102 const exposedMethods = { 27103 focus: () => { 27104 var _a2; 27105 (_a2 = selfRef.value) === null || _a2 === void 0 ? void 0 : _a2.focus(); 27106 }, 27107 blur: () => { 27108 var _a2; 27109 (_a2 = selfRef.value) === null || _a2 === void 0 ? void 0 : _a2.blur(); 27110 } 27111 }; 27112 const rtlEnabledRef = useRtl("Checkbox", mergedRtlRef, mergedClsPrefixRef); 27113 const cssVarsRef = computed(() => { 27114 const { 27115 value: mergedSize 27116 } = mergedSizeRef; 27117 const { 27118 common: { 27119 cubicBezierEaseInOut: cubicBezierEaseInOut2 27120 }, 27121 self: { 27122 borderRadius, 27123 color, 27124 colorChecked, 27125 colorDisabled, 27126 colorTableHeader, 27127 colorTableHeaderModal, 27128 colorTableHeaderPopover, 27129 checkMarkColor, 27130 checkMarkColorDisabled, 27131 border, 27132 borderFocus, 27133 borderDisabled, 27134 borderChecked, 27135 boxShadowFocus, 27136 textColor, 27137 textColorDisabled, 27138 checkMarkColorDisabledChecked, 27139 colorDisabledChecked, 27140 borderDisabledChecked, 27141 labelPadding, 27142 labelLineHeight, 27143 labelFontWeight, 27144 [createKey("fontSize", mergedSize)]: fontSize2, 27145 [createKey("size", mergedSize)]: size2 27146 } 27147 } = themeRef.value; 27148 return { 27149 "--n-label-line-height": labelLineHeight,
27150 "--n-label-font-weight": labelFontWeight, 27151 "--n-size": size2, 27152 "--n-bezier": cubicBezierEaseInOut2, 27153 "--n-border-radius": borderRadius, 27154 "--n-border": border, 27155 "--n-border-checked": borderChecked, 27156 "--n-border-focus": borderFocus, 27157 "--n-border-disabled": borderDisabled, 27158 "--n-border-disabled-checked": borderDisabledChecked, 27159 "--n-box-shadow-focus": boxShadowFocus, 27160 "--n-color": color, 27161 "--n-color-checked": colorChecked, 27162 "--n-color-table": colorTableHeader, 27163 "--n-color-table-modal": colorTableHeaderModal, 27164 "--n-color-table-popover": colorTableHeaderPopover, 27165 "--n-color-disabled": colorDisabled, 27166 "--n-color-disabled-checked": colorDisabledChecked, 27167 "--n-text-color": textColor, 27168 "--n-text-color-disabled": textColorDisabled, 27169 "--n-check-mark-color": checkMarkColor, 27170 "--n-check-mark-color-disabled": checkMarkColorDisabled, 27171 "--n-check-mark-color-disabled-checked": checkMarkColorDisabledChecked, 27172 "--n-font-size": fontSize2, 27173 "--n-label-padding": labelPadding 27174 }; 27175 }); 27176 const themeClassHandle = inlineThemeDisabled ? useThemeClass("checkbox", computed(() => mergedSizeRef.value[0]), cssVarsRef, props) : void 0; 27177 return Object.assign(formItem, exposedMethods, { 27178 rtlEnabled: rtlEnabledRef, 27179 selfRef, 27180 mergedClsPrefix: mergedClsPrefixRef, 27181 mergedDisabled: mergedDisabledRef, 27182 renderedChecked: renderedCheckedRef, 27183 mergedTheme: themeRef, 27184 labelId: createId(), 27185 handleClick: handleClick2, 27186 handleKeyUp, 27187 handleKeyDown, 27188 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef, 27189 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 27190 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 27191 }); 27192 }, 27193 render() { 27194 var _a2; 27195 const { 27196 $slots, 27197 renderedChecked, 27198 mergedDisabled, 27199 indeterminate, 27200 privateInsideTable, 27201 cssVars, 27202 labelId, 27203 label, 27204 mergedClsPrefix, 27205 focusable, 27206 handleKeyUp, 27207 handleKeyDown, 27208 handleClick: handleClick2 27209 } = this; 27210 (_a2 = this.onRender) === null || _a2 === void 0 ? void 0 : _a2.call(this); 27211 const labelNode = resolveWrappedSlot($slots.default, (children) => { 27212 if (label || children) { 27213 return h("span", { 27214 class: `${mergedClsPrefix}-checkbox__label`, 27215 id: labelId 27216 }, label || children); 27217 } 27218 return null; 27219 }); 27220 return h("div", { 27221 ref: "selfRef", 27222 class: [`${mergedClsPrefix}-checkbox`, this.themeClass, this.rtlEnabled && `${mergedClsPrefix}-checkbox--rtl`, renderedChecked && `${mergedClsPrefix}-checkbox--checked`, mergedDisabled && `${mergedClsPrefix}-checkbox--disabled`, indeterminate && `${mergedClsPrefix}-checkbox--indeterminate`, privateInsideTable && `${mergedClsPrefix}-checkbox--inside-table`, labelNode && `${mergedClsPrefix}-checkbox--show-label`], 27223 tabindex: mergedDisabled || !focusable ? void 0 : 0, 27224 role: "checkbox", 27225 "aria-checked": indeterminate ? "mixed" : renderedChecked, 27226 "aria-labelledby": labelId, 27227 style: cssVars, 27228 onKeyup: handleKeyUp, 27229 onKeydown: handleKeyDown, 27230 onClick: handleClick2, 27231 onMousedown: () => { 27232 on("selectstart", window, (e) => { 27233 e.preventDefault(); 27234 }, { 27235 once: true 27236 }); 27237 } 27238 }, h("div", { 27239 class: `${mergedClsPrefix}-checkbox-box-wrapper` 27240 }, "Â ", h("div", { 27241 class: `${mergedClsPrefix}-checkbox-box` 27242 }, h(NIconSwitchTransition, null, { 27243 default: () => this.indeterminate ? h("div", { 27244 key: "indeterminate", 27245 class: `${mergedClsPrefix}-checkbox-icon` 27246 }, LineMark) : h("div", { 27247 key: "check", 27248 class: `${mergedClsPrefix}-checkbox-icon` 27249 }, CheckMark) 27250 }), h("div", { 27251 class: `${mergedClsPrefix}-checkbox-box__border` 27252 }))), labelNode); 27253 } 27254}); 27255const self$9 = (vars) => { 27256 const { 27257 fontWeight, 27258 textColor1, 27259 textColor2, 27260 textColorDisabled, 27261 dividerColor, 27262 fontSize: fontSize2 27263 }
27263 = vars; 27264 return { 27265 titleFontSize: fontSize2, 27266 titleFontWeight: fontWeight, 27267 dividerColor, 27268 titleTextColor: textColor1, 27269 titleTextColorDisabled: textColorDisabled, 27270 fontSize: fontSize2, 27271 textColor: textColor2, 27272 arrowColor: textColor2, 27273 arrowColorDisabled: textColorDisabled, 27274 itemMargin: "16px 0 0 0", 27275 titlePadding: "16px 0 0 0" 27276 }; 27277}; 27278const collapseLight = { 27279 name: "Collapse", 27280 common: commonLight, 27281 self: self$9 27282}; 27283const collapseLight$1 = collapseLight; 27284const style$8 = cB("collapse", "width: 100%;", [cB("collapse-item", ` 27285 font-size: var(--n-font-size); 27286 color: var(--n-text-color); 27287 transition: 27288 color .3s var(--n-bezier), 27289 border-color .3s var(--n-bezier); 27290 margin: var(--n-item-margin); 27291 `, [cM("disabled", [cE("header", "cursor: not-allowed;", [cE("header-main", ` 27292 color: var(--n-title-text-color-disabled); 27293 `), cB("collapse-item-arrow", ` 27294 color: var(--n-arrow-color-disabled); 27295 `)])]), cB("collapse-item", "margin-left: 32px;"), c$1("&:first-child", "margin-top: 0;"), c$1("&:first-child >", [cE("header", "padding-top: 0;")]), cM("left-arrow-placement", [cE("header", [cB("collapse-item-arrow", "margin-right: 4px;")])]), cM("right-arrow-placement", [cE("header", [cB("collapse-item-arrow", "margin-left: 4px;")])]), cE("content-wrapper", [cE("content-inner", "padding-top: 16px;"), fadeInHeightExpandTransition({ 27296 duration: "0.15s" 27297})]), cM("active", [cE("header", [cM("active", [cB("collapse-item-arrow", "transform: rotate(90deg);")])])]), c$1("&:not(:first-child)", "border-top: 1px solid var(--n-divider-color);"), cNotM("disabled", [cM("trigger-area-main", [cE("header", [cE("header-main", "cursor: pointer;"), cB("collapse-item-arrow", "cursor: default;")])]), cM("trigger-area-arrow", [cE("header", [cB("collapse-item-arrow", "cursor: pointer;")])]), cM("trigger-area-extra", [cE("header", [cE("header-extra", "cursor: pointer;")])])]), cE("header", ` 27298 font-size: var(--n-title-font-size); 27299 display: flex; 27300 flex-wrap: nowrap; 27301 align-items: center; 27302 transition: color .3s var(--n-bezier); 27303 position: relative; 27304 padding: var(--n-title-padding); 27305 color: var(--n-title-text-color); 27306 `, [cE("header-main", ` 27307 display: flex; 27308 flex-wrap: nowrap; 27309 align-items: center; 27310 font-weight: var(--n-title-font-weight); 27311 transition: color .3s var(--n-bezier); 27312 flex: 1; 27313 color: var(--n-title-text-color); 27314 `), cE("header-extra", ` 27315 display: flex; 27316 align-items: center; 27317 transition: color .3s var(--n-bezier); 27318 color: var(--n-text-color); 27319 `), cB("collapse-item-arrow", ` 27320 display: flex; 27321 transition: 27322 transform .15s var(--n-bezier), 27323 color .3s var(--n-bezier); 27324 font-size: 18px; 27325 color: var(--n-arrow-color); 27326 `)])])]); 27327const collapseProps = Object.assign(Object.assign({}, useTheme.props), { 27328 defaultExpandedNames: { 27329 type: [Array, String], 27330 default: null 27331 }, 27332 expandedNames: [Array, String], 27333 arrowPlacement: { 27334 type: String, 27335 default: "left" 27336 }, 27337 accordion: { 27338 type: Boolean, 27339 default: false 27340 }, 27341 displayDirective: { 27342 type: String, 27343 default: "if" 27344 }, 27345 triggerAreas: { 27346 type: Array, 27347 default: () => ["main", "extra", "arrow"] 27348 }, 27349 onItemHeaderClick: [Function, Array], 27350 "onUpdate:expandedNames": [Function, Array], 27351 onUpdateExpandedNames: [Function, Array], 27352 // deprecated 27353 onExpandedNamesChange: { 27354 type: [Function, Array], 27355 validator: () => { 27356 return true; 27357 }, 27358 default: void 0 27359 } 27360}); 27361const collapseInjectionKey = createInjectionKey("n-collapse"); 27362const NCollapse = defineComponent({ 27363 name: "Collapse", 27364 props: collapseProps, 27365 setup(props, { 27366 slots 27367 }) { 27368 const { 27369 mergedClsPrefixRef, 27370 inlineThemeDisabled, 27371 mergedRtlRef 27372 } = useConfig(props); 27373 const uncontrolledExpandedNamesRef = ref(props.defaultExpandedNames); 27374 const controlledExpandedNamesRef = computed(() => props.expandedNames); 27375 const mergedExpandedNamesRef = useMergedState(controlledExpandedNamesRef, uncontrolledExpandedNamesRef); 27376 const themeRef = useTheme("Collapse", "-collapse", style$8, collapseLight$1, props, mergedClsPrefixRef); 27377 function doUpdateExpandedNames(names) { 27378 const { 27379 "onUpdate:expandedNames": _onUpdateExpandedNames, 27380 onUpdateExpandedNames, 27381 onExpandedNamesChange 27382 } = props; 27383 if (onUpdateExpandedNames) { 27384 call(onUpdateExpandedNames, names); 27385 } 27386 if (_onUpdateExpandedNames) { 27387 call(_onUpdateExpandedNames, names); 27388 } 27389 if (onExpandedNamesChange) { 27390 call(onExpandedNamesChange, names); 27391 } 27392 uncontrolledExpandedNamesRef.value = names; 27393 } 27394 function doItemHeaderClick(info) { 27395 const { 27396 onItemHeaderClick 27397 } = props; 27398 if (onItemHeaderClick) { 27399 call(onItemHeaderClick, info); 27400 } 27401 } 27402 function toggleItem(collapse, name, event) { 27403 const { 27404 accordion 27405 } = props; 27406 const { 27407 value: expandedNames 27408 } = mergedExpandedNamesRef; 27409 if (accordion) { 27410 if (collapse) { 27411 doUpdateExpandedNames([name]); 27412 doItemHeaderClick({ 27413 name, 27414 expanded: true, 27415 event 27416 }); 27417 } else { 27418 doUpdateExpandedNames([]); 27419 doItemHeaderClick({ 27420 name, 27421 expanded: false, 27422 event 27423 }); 27424 } 27425 } else { 27426 if (!Array.isArray(expandedNames)) { 27427 doUpdateExpandedNames([name]); 27428 doItemHeaderClick({ 27429 name, 27430 expanded: true, 27431 event 27432 }); 27433 } else { 27434 const activeNames = expandedNames.slice(); 27435 const index = activeNames.findIndex((activeName) => name === activeName); 27436 if (~index) { 27437 activeNames.splice(index, 1); 27438 doUpdateExpandedNames(activeNames); 27439 doItemHeaderClick({ 27440 name, 27441 expanded: false, 27442 event 27443 }); 27444 } else { 27445 activeNames.push(name); 27446 doUpdateExpandedNames(activeNames); 27447 doItemHeaderClick({ 27448 name, 27449 expanded: true, 27450 event 27451 }); 27452 } 27453 } 27454 } 27455 } 27456 provide(collapseInjectionKey, { 27457 props, 27458 mergedClsPrefixRef, 27459 expandedNamesRef: mergedExpandedNamesRef, 27460 slots, 27461 toggleItem 27462 });
27463 const rtlEnabledRef = useRtl("Collapse", mergedRtlRef, mergedClsPrefixRef); 27464 const cssVarsRef = computed(() => { 27465 const { 27466 common: { 27467 cubicBezierEaseInOut: cubicBezierEaseInOut2 27468 }, 27469 self: { 27470 titleFontWeight, 27471 dividerColor, 27472 titlePadding, 27473 titleTextColor, 27474 titleTextColorDisabled, 27475 textColor, 27476 arrowColor, 27477 fontSize: fontSize2, 27478 titleFontSize, 27479 arrowColorDisabled, 27480 itemMargin 27481 } 27482 } = themeRef.value; 27483 return { 27484 "--n-font-size": fontSize2, 27485 "--n-bezier": cubicBezierEaseInOut2, 27486 "--n-text-color": textColor, 27487 "--n-divider-color": dividerColor, 27488 "--n-title-padding": titlePadding, 27489 "--n-title-font-size": titleFontSize, 27490 "--n-title-text-color": titleTextColor, 27491 "--n-title-text-color-disabled": titleTextColorDisabled, 27492 "--n-title-font-weight": titleFontWeight, 27493 "--n-arrow-color": arrowColor, 27494 "--n-arrow-color-disabled": arrowColorDisabled, 27495 "--n-item-margin": itemMargin 27496 }; 27497 }); 27498 const themeClassHandle = inlineThemeDisabled ? useThemeClass("collapse", void 0, cssVarsRef, props) : void 0; 27499 return { 27500 rtlEnabled: rtlEnabledRef, 27501 mergedTheme: themeRef, 27502 mergedClsPrefix: mergedClsPrefixRef, 27503 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef, 27504 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 27505 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 27506 }; 27507 }, 27508 render() { 27509 var _a2; 27510 (_a2 = this.onRender) === null || _a2 === void 0 ? void 0 : _a2.call(this); 27511 return h("div", { 27512 class: [`${this.mergedClsPrefix}-collapse`, this.rtlEnabled && `${this.mergedClsPrefix}-collapse--rtl`, this.themeClass], 27513 style: this.cssVars 27514 }, this.$slots); 27515 } 27516}); 27517const NCollapseItemContent = defineComponent({ 27518 name: "CollapseItemContent", 27519 props: { 27520 displayDirective: { 27521 type: String, 27522 required: true 27523 }, 27524 show: Boolean, 27525 clsPrefix: { 27526 type: String, 27527 required: true 27528 } 27529 }, 27530 setup(props) { 27531 const onceTrueRef = useFalseUntilTruthy(toRef(props, "show")); 27532 return { 27533 onceTrue: onceTrueRef 27534 }; 27535 }, 27536 render() { 27537 return h(NFadeInExpandTransition, null, { 27538 default: () => { 27539 const { 27540 show, 27541 displayDirective, 27542 onceTrue, 27543 clsPrefix 27544 } = this; 27545 const useVShow = displayDirective === "show" && onceTrue; 27546 const contentNode = h("div", { 27547 class: `${clsPrefix}-collapse-item__content-wrapper` 27548 }, h("div", { 27549 class: `${clsPrefix}-collapse-item__content-inner` 27550 }, this.$slots)); 27551 return useVShow ? withDirectives(contentNode, [[vShow, show]]) : show ? contentNode : null; 27552 } 27553 }); 27554 } 27555}); 27556const collapseItemProps = { 27557 title: String, 27558 name: [String, Number], 27559 disabled: Boolean, 27560 displayDirective: String 27561}; 27562const NCollapseItem = defineComponent({ 27563 name: "CollapseItem", 27564 props: collapseItemProps, 27565 setup(props) { 27566 const { 27567 mergedRtlRef 27568 } = useConfig(props); 27569 const randomName = createId(); 27570 const mergedNameRef = useMemo(() => { 27571 var _a2; 27572 return (_a2 = props.name) !== null && _a2 !== void 0 ? _a2 : randomName; 27573 }); 27574 const NCollapse2 = inject(collapseInjectionKey); 27575 if (!NCollapse2) { 27576 throwError("collapse-item", "`n-collapse-item` must be placed inside `n-collapse`."); 27577 } 27578 const { 27579 expandedNamesRef, 27580 props: collapseProps2, 27581 mergedClsPrefixRef, 27582 slots: collapseSlots 27583 } = NCollapse2; 27584 const collapsedRef = computed(() => { 27585 const { 27586 value: expandedNames 27587 } = expandedNamesRef; 27588 if (Array.isArray(expandedNames)) { 27589 const { 27590 value: name 27591 } = mergedNameRef; 27592 return !~expandedNames.findIndex((expandedName) => expandedName === name); 27593 } else if (expandedNames) { 27594 const { 27595 value: name 27596 } = mergedNameRef; 27597 return name !== expandedNames; 27598 } 27599 return true; 27600 });
27601 const rtlEnabledRef = useRtl("Collapse", mergedRtlRef, mergedClsPrefixRef); 27602 return { 27603 rtlEnabled: rtlEnabledRef, 27604 collapseSlots, 27605 randomName, 27606 mergedClsPrefix: mergedClsPrefixRef, 27607 collapsed: collapsedRef, 27608 triggerAreas: toRef(collapseProps2, "triggerAreas"), 27609 mergedDisplayDirective: computed(() => { 27610 const { 27611 displayDirective 27612 } = props; 27613 if (displayDirective) { 27614 return displayDirective; 27615 } else { 27616 return collapseProps2.displayDirective; 27617 } 27618 }), 27619 arrowPlacement: computed(() => { 27620 return collapseProps2.arrowPlacement; 27621 }), 27622 handleClick(e) { 27623 let happensInArea = "main"; 27624 if (happensIn(e, "arrow")) 27625 happensInArea = "arrow"; 27626 if (happensIn(e, "extra")) 27627 happensInArea = "extra"; 27628 if (!collapseProps2.triggerAreas.includes(happensInArea)) { 27629 return; 27630 } 27631 if (NCollapse2 && !props.disabled) { 27632 NCollapse2.toggleItem(collapsedRef.value, mergedNameRef.value, e); 27633 } 27634 } 27635 }; 27636 }, 27637 render() { 27638 const { 27639 collapseSlots, 27640 $slots, 27641 arrowPlacement, 27642 collapsed, 27643 mergedDisplayDirective, 27644 mergedClsPrefix, 27645 disabled, 27646 triggerAreas 27647 } = this; 27648 const headerNode = resolveSlotWithProps($slots.header, { 27649 collapsed 27650 }, () => [this.title]); 27651 const headerExtraSlot = $slots["header-extra"] || collapseSlots["header-extra"]; 27652 const arrowSlot = $slots.arrow || collapseSlots.arrow; 27653 return h("div", { 27654 class: [`${mergedClsPrefix}-collapse-item`, `${mergedClsPrefix}-collapse-item--${arrowPlacement}-arrow-placement`, disabled && `${mergedClsPrefix}-collapse-item--disabled`, !collapsed && `${mergedClsPrefix}-collapse-item--active`, triggerAreas.map((area) => { 27655 return `${mergedClsPrefix}-collapse-item--trigger-area-${area}`; 27656 })] 27657 }, h("div", { 27658 class: [`${mergedClsPrefix}-collapse-item__header`, !collapsed && `${mergedClsPrefix}-collapse-item__header--active`] 27659 }, h("div", { 27660 class: `${mergedClsPrefix}-collapse-item__header-main`, 27661 onClick: this.handleClick 27662 }, arrowPlacement === "right" && headerNode, h("div", { 27663 class: `${mergedClsPrefix}-collapse-item-arrow`, 27664 key: this.rtlEnabled ? 0 : 1, 27665 "data-arrow": true 27666 }, resolveSlotWithProps(arrowSlot, { 27667 collapsed 27668 }, () => { 27669 var _a2; 27670 return [h(NBaseIcon, { 27671 clsPrefix: mergedClsPrefix 27672 }, { 27673 default: (_a2 = collapseSlots.expandIcon) !== null && _a2 !== void 0 ? _a2 : () => this.rtlEnabled ? h(ChevronLeftIcon, null) : h(ChevronRightIcon, null) 27674 })]; 27675 })), arrowPlacement === "left" && headerNode), resolveWrappedSlotWithProps(headerExtraSlot, { 27676 collapsed 27677 }, (children) => h("div", { 27678 class: `${mergedClsPrefix}-collapse-item__header-extra`, 27679 onClick: this.handleClick, 27680 "data-extra": true 27681 }, children))), h(NCollapseItemContent, { 27682 clsPrefix: mergedClsPrefix, 27683 displayDirective: mergedDisplayDirective, 27684 show: !collapsed 27685 }, $slots)); 27686 } 27687}); 27688function self$8(vars) { 27689 const { 27690 boxShadow2 27691 } = vars; 27692 return { 27693 menuBoxShadow: boxShadow2 27694 }; 27695} 27696const selectLight = createTheme({ 27697 name: "Select", 27698 common: commonLight, 27699 peers: { 27700 InternalSelection: internalSelectionLight$1, 27701 InternalSelectMenu: internalSelectMenuLight$1 27702 }, 27703 self: self$8 27704}); 27705const selectLight$1 = selectLight; 27706const style$7 = c$1([cB("select", ` 27707 z-index: auto; 27708 outline: none; 27709 width: 100%; 27710 position: relative; 27711 `), cB("select-menu", ` 27712 margin: 4px 0; 27713 box-shadow: var(--n-menu-box-shadow); 27714 `, [fadeInScaleUpTransition({ 27715 originalTransition: "background-color .3s var(--n-bezier), box-shadow .3s var(--n-bezier)" 27716})])]); 27717const selectProps = Object.assign(Object.assign({}, useTheme.props), { 27718 to: useAdjustedTo.propTo, 27719 bordered: { 27720 type: Boolean, 27721 default: void 0 27722 }, 27723 clearable: Boolean, 27724 clearFilterAfterSelect: { 27725 type: Boolean, 27726 default: true 27727 }, 27728 options: { 27729 type: Array, 27730 default: () => [] 27731 }, 27732 defaultValue: { 27733 type: [String, Number, Array], 27734 default: null 27735 }, 27736 keyboard: { 27737 type: Boolean, 27738 default: true 27739 }, 27740 value: [String, Number, Array], 27741 placeholder: String, 27742 menuProps: Object, 27743 multiple: Boolean, 27744 size: String, 27745 filterable: Boolean, 27746 disabled: { 27747 type: Boolean, 27748 default: void 0 27749 }, 27750 remote: Boolean, 27751 loading: Boolean, 27752 filter: Function, 27753 placement: { 27754 type: String, 27755 default: "bottom-start" 27756 }, 27757 widthMode: { 27758 type: String, 27759 default: "trigger" 27760 }, 27761 tag: Boolean, 27762 onCreate: Function, 27763 fallbackOption: { 27764 type: [Function, Boolean], 27765 default: void 0 27766 }, 27767 show: { 27768 type: Boolean, 27769 default: void 0 27770 }, 27771 showArrow: { 27772 type: Boolean, 27773 default: true 27774 }, 27775 maxTagCount: [Number, String], 27776 ellipsisTagPopoverProps: Object, 27777 consistentMenuWidth: { 27778 type: Boolean, 27779 default: true 27780 }, 27781 virtualScroll: { 27782 type: Boolean, 27783 default: true 27784 }, 27785 labelField: { 27786 type: String, 27787 default: "label" 27788 }, 27789 valueField: { 27790 type: String, 27791 default: "value" 27792 }, 27793 childrenField: { 27794 type: String, 27795 default: "children" 27796 }, 27797 renderLabel: Function, 27798 renderOption: Function, 27799 renderTag: Function, 27800 "onUpdate:value": [Function, Array], 27801 inputProps: Object, 27802 nodeProps: Function, 27803 ignoreComposition: { 27804 type: Boolean, 27805 default: true 27806 }, 27807 showOnFocus: Boolean, 27808 // for jsx 27809 onUpdateValue: [Function, Array], 27810 onBlur: [Function, Array],
27811 onClear: [Function, Array], 27812 onFocus: [Function, Array], 27813 onScroll: [Function, Array], 27814 onSearch: [Function, Array], 27815 onUpdateShow: [Function, Array], 27816 "onUpdate:show": [Function, Array], 27817 displayDirective: { 27818 type: String, 27819 default: "show" 27820 }, 27821 resetMenuOnOptionsChange: { 27822 type: Boolean, 27823 default: true 27824 }, 27825 status: String, 27826 showCheckmark: { 27827 type: Boolean, 27828 default: true 27829 }, 27830 /** deprecated */ 27831 onChange: [Function, Array], 27832 items: Array 27833}); 27834const NSelect = defineComponent({ 27835 name: "Select", 27836 props: selectProps, 27837 setup(props) { 27838 const { 27839 mergedClsPrefixRef, 27840 mergedBorderedRef, 27841 namespaceRef, 27842 inlineThemeDisabled 27843 } = useConfig(props); 27844 const themeRef = useTheme("Select", "-select", style$7, selectLight$1, props, mergedClsPrefixRef); 27845 const uncontrolledValueRef = ref(props.defaultValue); 27846 const controlledValueRef = toRef(props, "value"); 27847 const mergedValueRef = useMergedState(controlledValueRef, uncontrolledValueRef); 27848 const focusedRef = ref(false); 27849 const patternRef = ref(""); 27850 const treeMateRef = computed(() => { 27851 const { 27852 valueField, 27853 childrenField 27854 } = props; 27855 const options = createTmOptions(valueField, childrenField); 27856 return createTreeMate(filteredOptionsRef.value, options); 27857 }); 27858 const valOptMapRef = computed(() => createValOptMap(localOptionsRef.value, props.valueField, props.childrenField)); 27859 const uncontrolledShowRef = ref(false); 27860 const mergedShowRef = useMergedState(toRef(props, "show"), uncontrolledShowRef); 27861 const triggerRef2 = ref(null); 27862 const followerRef = ref(null); 27863 const menuRef = ref(null); 27864 const { 27865 localeRef 27866 } = useLocale("Select"); 27867 const localizedPlaceholderRef = computed(() => { 27868 var _a2; 27869 return (_a2 = props.placeholder) !== null && _a2 !== void 0 ? _a2 : localeRef.value.placeholder; 27870 }); 27871 const compitableOptionsRef = useCompitable(props, ["items", "options"]); 27872 const emptyArray = []; 27873 const createdOptionsRef = ref([]); 27874 const beingCreatedOptionsRef = ref([]); 27875 const memoValOptMapRef = ref(/* @__PURE__ */ new Map()); 27876 const wrappedFallbackOptionRef = computed(() => { 27877 const { 27878 fallbackOption 27879 } = props; 27880 if (fallbackOption === void 0) { 27881 const { 27882 labelField, 27883 valueField 27884 } = props; 27885 return (value) => ({ 27886 [labelField]: String(value), 27887 [valueField]: value 27888 }); 27889 } 27890 if (fallbackOption === false) 27891 return false; 27892 return (value) => { 27893 return Object.assign(fallbackOption(value), { 27894 value 27895 }); 27896 }; 27897 }); 27898 const localOptionsRef = computed(() => { 27899 return beingCreatedOptionsRef.value.concat(createdOptionsRef.value).concat(compitableOptionsRef.value); 27900 }); 27901 const resolvedFilterRef = computed(() => { 27902 const { 27903 filter 27904 } = props; 27905 if (filter) 27906 return filter; 27907 const { 27908 labelField, 27909 valueField 27910 } = props; 27911 return (pattern4, option) => { 27912 if (!option) 27913 return false; 27914 const label = option[labelField]; 27915 if (typeof label === "string") { 27916 return patternMatched(pattern4, label); 27917 } 27918 const value = option[valueField]; 27919 if (typeof value === "string") { 27920 return patternMatched(pattern4, value); 27921 } 27922 if (typeof value === "number") { 27923 return patternMatched(pattern4, String(value)); 27924 } 27925 return false; 27926 }; 27927 }); 27928 const filteredOptionsRef = computed(() => { 27929 if (props.remote) { 27930 return compitableOptionsRef.value; 27931 } else { 27932 const { 27933 value: localOptions 27934 } = localOptionsRef; 27935 const { 27936 value: pattern4 27937 } = patternRef; 27938 if (!pattern4.length || !props.filterable) { 27939 return localOptions; 27940 } else { 27941 return filterOptions(localOptions, resolvedFilterRef.value, pattern4, props.childrenField); 27942 } 27943 } 27944 }); 27945 function getMergedOptions(values) { 27946 const remote = props.remote; 27947 const { 27948 value: memoValOptMap 27949 } = memoValOptMapRef; 27950 const { 27951 value: valOptMap 27952 } = valOptMapRef; 27953 const { 27954 value: wrappedFallbackOption 27955 } = wrappedFallbackOptionRef; 27956 const options = [];
27957 values.forEach((value) => { 27958 if (valOptMap.has(value)) { 27959 options.push(valOptMap.get(value)); 27960 } else if (remote && memoValOptMap.has(value)) { 27961 options.push(memoValOptMap.get(value)); 27962 } else if (wrappedFallbackOption) { 27963 const option = wrappedFallbackOption(value); 27964 if (option) { 27965 options.push(option); 27966 } 27967 } 27968 }); 27969 return options; 27970 } 27971 const selectedOptionsRef = computed(() => { 27972 if (props.multiple) { 27973 const { 27974 value: values 27975 } = mergedValueRef; 27976 if (!Array.isArray(values)) 27977 return []; 27978 return getMergedOptions(values); 27979 } 27980 return null; 27981 }); 27982 const selectedOptionRef = computed(() => { 27983 const { 27984 value: mergedValue 27985 } = mergedValueRef; 27986 if (!props.multiple && !Array.isArray(mergedValue)) { 27987 if (mergedValue === null) 27988 return null; 27989 return getMergedOptions([mergedValue])[0] || null; 27990 } 27991 return null; 27992 }); 27993 const formItem = useFormItem(props); 27994 const { 27995 mergedSizeRef, 27996 mergedDisabledRef, 27997 mergedStatusRef 27998 } = formItem; 27999 function doUpdateValue(value, option) { 28000 const { 28001 onChange, 28002 "onUpdate:value": _onUpdateValue, 28003 onUpdateValue 28004 } = props; 28005 const { 28006 nTriggerFormChange, 28007 nTriggerFormInput 28008 } = formItem; 28009 if (onChange) 28010 call(onChange, value, option); 28011 if (onUpdateValue) 28012 call(onUpdateValue, value, option); 28013 if (_onUpdateValue) { 28014 call(_onUpdateValue, value, option); 28015 } 28016 uncontrolledValueRef.value = value; 28017 nTriggerFormChange(); 28018 nTriggerFormInput(); 28019 } 28020 function doBlur(e) { 28021 const { 28022 onBlur 28023 } = props; 28024 const { 28025 nTriggerFormBlur 28026 } = formItem; 28027 if (onBlur) 28028 call(onBlur, e); 28029 nTriggerFormBlur(); 28030 } 28031 function doClear() { 28032 const { 28033 onClear 28034 } = props; 28035 if (onClear) 28036 call(onClear); 28037 } 28038 function doFocus(e) { 28039 const { 28040 onFocus, 28041 showOnFocus 28042 } = props; 28043 const { 28044 nTriggerFormFocus 28045 } = formItem; 28046 if (onFocus) 28047 call(onFocus, e); 28048 nTriggerFormFocus(); 28049 if (showOnFocus) { 28050 openMenu(); 28051 } 28052 } 28053 function doSearch(value) { 28054 const { 28055 onSearch 28056 } = props; 28057 if (onSearch) 28058 call(onSearch, value); 28059 } 28060 function doScroll(e) { 28061 const { 28062 onScroll 28063 } = props; 28064 if (onScroll) 28065 call(onScroll, e); 28066 } 28067 function updateMemorizedOptions() { 28068 var _a2; 28069 const { 28070 remote, 28071 multiple 28072 } = props; 28073 if (remote) { 28074 const { 28075 value: memoValOptMap 28076 } = memoValOptMapRef; 28077 if (multiple) { 28078 const { 28079 valueField 28080 } = props; 28081 (_a2 = selectedOptionsRef.value) === null || _a2 === void 0 ? void 0 : _a2.forEach((option) => { 28082 memoValOptMap.set(option[valueField], option); 28083 }); 28084 } else { 28085 const option = selectedOptionRef.value; 28086 if (option) { 28087 memoValOptMap.set(option[props.valueField], option); 28088 } 28089 } 28090 } 28091 } 28092 function doUpdateShow(value) { 28093 const { 28094 onUpdateShow, 28095 "onUpdate:show": _onUpdateShow 28096 } = props; 28097 if (onUpdateShow) 28098 call(onUpdateShow, value); 28099 if (_onUpdateShow) 28100 call(_onUpdateShow, value); 28101 uncontrolledShowRef.value = value; 28102 } 28103 function openMenu() { 28104 if (!mergedDisabledRef.value) { 28105 doUpdateShow(true); 28106 uncontrolledShowRef.value = true; 28107 if (props.filterable) { 28108 focusSelectionInput(); 28109 } 28110 } 28111 } 28112 function closeMenu() { 28113 doUpdateShow(false); 28114 } 28115 function handleMenuAfterLeave() { 28116 patternRef.value = ""; 28117 beingCreatedOptionsRef.value = emptyArray; 28118 } 28119 const activeWithoutMenuOpenRef = ref(false); 28120 function onTriggerInputFocus() { 28121 if (props.filterable) { 28122 activeWithoutMenuOpenRef.value = true; 28123 } 28124 } 28125 function onTriggerInputBlur() { 28126 if (props.filterable) { 28127 activeWithoutMenuOpenRef.value = false;
28128 if (!mergedShowRef.value) { 28129 handleMenuAfterLeave(); 28130 } 28131 } 28132 } 28133 function handleTriggerClick() { 28134 if (mergedDisabledRef.value) 28135 return; 28136 if (!mergedShowRef.value) { 28137 openMenu(); 28138 } else { 28139 if (!props.filterable) { 28140 closeMenu(); 28141 } else { 28142 focusSelectionInput(); 28143 } 28144 } 28145 } 28146 function handleTriggerBlur(e) { 28147 var _a2, _b; 28148 if ((_b = (_a2 = menuRef.value) === null || _a2 === void 0 ? void 0 : _a2.selfRef) === null || _b === void 0 ? void 0 : _b.contains(e.relatedTarget)) { 28149 return; 28150 } 28151 focusedRef.value = false; 28152 doBlur(e); 28153 closeMenu(); 28154 } 28155 function handleTriggerFocus(e) { 28156 doFocus(e); 28157 focusedRef.value = true; 28158 } 28159 function handleMenuFocus(e) { 28160 focusedRef.value = true; 28161 } 28162 function handleMenuBlur(e) { 28163 var _a2; 28164 if ((_a2 = triggerRef2.value) === null || _a2 === void 0 ? void 0 : _a2.$el.contains(e.relatedTarget)) 28165 return; 28166 focusedRef.value = false; 28167 doBlur(e); 28168 closeMenu(); 28169 } 28170 function handleMenuTabOut() { 28171 var _a2; 28172 (_a2 = triggerRef2.value) === null || _a2 === void 0 ? void 0 : _a2.focus(); 28173 closeMenu(); 28174 } 28175 function handleMenuClickOutside(e) { 28176 var _a2; 28177 if (mergedShowRef.value) { 28178 if (!((_a2 = triggerRef2.value) === null || _a2 === void 0 ? void 0 : _a2.$el.contains(getPreciseEventTarget(e)))) { 28179 closeMenu(); 28180 } 28181 } 28182 } 28183 function createClearedMultipleSelectValue(value) { 28184 if (!Array.isArray(value)) 28185 return []; 28186 if (wrappedFallbackOptionRef.value) { 28187 return Array.from(value); 28188 } else { 28189 const { 28190 remote 28191 } = props; 28192 const { 28193 value: valOptMap 28194 } = valOptMapRef; 28195 if (remote) { 28196 const { 28197 value: memoValOptMap 28198 } = memoValOptMapRef; 28199 return value.filter((v) => valOptMap.has(v) || memoValOptMap.has(v)); 28200 } else { 28201 return value.filter((v) => valOptMap.has(v)); 28202 } 28203 } 28204 } 28205 function handleToggleByTmNode(tmNode) { 28206 handleToggleByOption(tmNode.rawNode); 28207 } 28208 function handleToggleByOption(option) { 28209 if (mergedDisabledRef.value) 28210 return; 28211 const { 28212 tag, 28213 remote, 28214 clearFilterAfterSelect, 28215 valueField 28216 } = props; 28217 if (tag && !remote) { 28218 const { 28219 value: beingCreatedOptions 28220 } = beingCreatedOptionsRef; 28221 const beingCreatedOption = beingCreatedOptions[0] || null; 28222 if (beingCreatedOption) { 28223 const createdOptions = createdOptionsRef.value; 28224 if (!createdOptions.length) { 28225 createdOptionsRef.value = [beingCreatedOption]; 28226 } else { 28227 createdOptions.push(beingCreatedOption); 28228 } 28229 beingCreatedOptionsRef.value = emptyArray; 28230 } 28231 } 28232 if (remote) { 28233 memoValOptMapRef.value.set(option[valueField], option); 28234 } 28235 if (props.multiple) { 28236 const changedValue = createClearedMultipleSelectValue(mergedValueRef.value); 28237 const index = changedValue.findIndex((value) => value === option[valueField]); 28238 if (~index) { 28239 changedValue.splice(index, 1); 28240 if (tag && !remote) { 28241 const createdOptionIndex = getCreatedOptionIndex(option[valueField]); 28242 if (~createdOptionIndex) { 28243 createdOptionsRef.value.splice(createdOptionIndex, 1); 28244 if (clearFilterAfterSelect) 28245 patternRef.value = ""; 28246 } 28247 } 28248 } else { 28249 changedValue.push(option[valueField]); 28250 if (clearFilterAfterSelect) 28251 patternRef.value = ""; 28252 } 28253 doUpdateValue(changedValue, getMergedOptions(changedValue)); 28254 } else { 28255 if (tag && !remote) { 28256 const createdOptionIndex = getCreatedOptionIndex(option[valueField]); 28257 if (~createdOptionIndex) { 28258 createdOptionsRef.value = [createdOptionsRef.value[createdOptionIndex]]; 28259 } else { 28260 createdOptionsRef.value = emptyArray; 28261 } 28262 } 28263 focusSelection(); 28264 closeMenu(); 28265 doUpdateValue(option[valueField], option); 28266 } 28267 } 28268 function getCreatedOptionIndex(optionValue) { 28269 const createdOptions = createdOptionsRef.value; 28270 return createdOptions.findIndex((createdOption) => createdOption[props.valueField] === optionValue); 28271 } 28272 function handlePatternInput(e) { 28273 if (!mergedShowRef.value) { 28274 openMenu(); 28275 } 28276 const { 28277 value 28278 } = e.target; 28279 patternRef.value = value; 28280 const { 28281 tag, 28282 remote 28283 } = props; 28284 doSearch(value); 28285 if (tag && !remote) { 28286 if (!value) { 28287 beingCreatedOptionsRef.value = emptyArray; 28288 return; 28289 } 28290 const { 28291 onCreate 28292 } = props; 28293 const optionBeingCreated = onCreate ? onCreate(value) : { 28294 [props.labelField]: value, 28295 [props.valueField]: value 28296 }; 28297 const { 28298 valueField, 28299 labelField 28300 } = props; 28301 if (compitableOptionsRef.value.some((option) => { 28302 return option[valueField] === optionBeingCreated[valueField] || option[labelField] === optionBeingCreated[labelField]; 28303 }) || createdOptionsRef.value.some((option) => { 28304 return option[valueField] === optionBeingCreated[valueField] || option[labelField] === optionBeingCreated[labelField]; 28305 })) { 28306 beingCreatedOptionsRef.value = emptyArray; 28307 } else { 28308 beingCreatedOptionsRef.value = [optionBeingCreated]; 28309 } 28310 } 28311 } 28312 function handleClear(e) { 28313 e.stopPropagation(); 28314 const { 28315 multiple 28316 } = props; 28317 if (!multiple && props.filterable) { 28318 closeMenu(); 28319 } 28320 doClear(); 28321 if (multiple) { 28322 doUpdateValue([], []); 28323 } else { 28324 doUpdateValue(null, null); 28325 } 28326 } 28327 function handleMenuMousedown(e) { 28328 if (!happensIn(e, "action") && !happensIn(e, "empty")) 28329 e.preventDefault(); 28330 } 28331 function handleMenuScroll(e) { 28332 doScroll(e); 28333 } 28334 function handleKeydown(e) { 28335 var _a2, _b, _c, _d, _e; 28336 if (!props.keyboard) { 28337 e.preventDefault(); 28338 return; 28339 } 28340 switch (e.key) { 28341 case " ": 28342 if (props.filterable) 28343 break; 28344 else { 28345 e.preventDefault(); 28346 } 28347 case "Enter": 28348 if (!((_a2 = triggerRef2.value) === null || _a2 === void 0 ? void 0 : _a2.isComposing)) { 28349 if (mergedShowRef.value) { 28350 const pendingTmNode = (_b = menuRef.value) === null || _b === void 0 ? void 0 : _b.getPendingTmNode(); 28351 if (pendingTmNode) { 28352 handleToggleByTmNode(pendingTmNode); 28353 } else if (!props.filterable) { 28354 closeMenu(); 28355 focusSelection(); 28356 } 28357 } else { 28358 openMenu(); 28359 if (props.tag && activeWithoutMenuOpenRef.value) { 28360 const beingCreatedOption = beingCreatedOptionsRef.value[0]; 28361 if (beingCreatedOption) { 28362 const optionValue = beingCreatedOption[props.valueField]; 28363 const { 28364 value: mergedValue 28365 } = mergedValueRef; 28366 if (props.multiple) { 28367 if (Array.isArray(mergedValue) && mergedValue.some((value) => value === optionValue)) 28368 ; 28369 else { 28370 handleToggleByOption(beingCreatedOption); 28371 } 28372 } else { 28373 handleToggleByOption(beingCreatedOption); 28374 } 28375 } 28376 } 28377 } 28378 } 28379 e.preventDefault(); 28380 break; 28381 case "ArrowUp": 28382 e.preventDefault(); 28383 if (props.loading) 28384 return; 28385 if (mergedShowRef.value) { 28386 (_c = menuRef.value) === null || _c === void 0 ? void 0 : _c.prev(); 28387 } 28388 break; 28389 case "ArrowDown": 28390 e.preventDefault(); 28391 if (props.loading) 28392 return; 28393 if (mergedShowRef.value) { 28394 (_d = menuRef.value) === null || _d === void 0 ? void 0 : _d.next(); 28395 } else { 28396 openMenu(); 28397 } 28398 break; 28399 case "Escape": 28400 if (mergedShowRef.value) { 28401 markEventEffectPerformed(e); 28402 closeMenu(); 28403 } 28404 (_e = triggerRef2.value) === null || _e === void 0 ? void 0 : _e.focus(); 28405 break; 28406 } 28407 } 28408 function focusSelection() { 28409 var _a2; 28410 (_a2 = triggerRef2.value) === null || _a2 === void 0 ? void 0 : _a2.focus(); 28411 } 28412 function focusSelectionInput() { 28413 var _a2; 28414 (_a2 = triggerRef2.value) === null || _a2 === void 0 ? void 0 : _a2.focusInput(); 28415 } 28416 function handleTriggerOrMenuResize() { 28417 var _a2; 28418 if (!mergedShowRef.value) 28419 return; 28420 (_a2 = followerRef.value) === null || _a2 === void 0 ? void 0 : _a2.syncPosition(); 28421 } 28422 updateMemorizedOptions(); 28423 watch(toRef(props, "options"), updateMemorizedOptions); 28424 const exposedMethods = { 28425 focus: () => { 28426 var _a2; 28427 (_a2 = triggerRef2.value) === null || _a2 === void 0 ? void 0 : _a2.focus(); 28428 }, 28429 focusInput: () => { 28430 var _a2; 28431 (_a2 = triggerRef2.value) === null || _a2 === void 0 ? void 0 : _a2.focusInput(); 28432 }, 28433 blur: () => { 28434 var _a2; 28435 (_a2 = triggerRef2.value) === null || _a2 === void 0 ? void 0 : _a2.blur(); 28436 }, 28437 blurInput: () => { 28438 var _a2; 28439 (_a2 = triggerRef2.value) === null || _a2 === void 0 ? void 0 : _a2.blurInput(); 28440 } 28441 }; 28442 const cssVarsRef = computed(() => { 28443 const { 28444 self: { 28445 menuBoxShadow 28446 } 28447 } = themeRef.value; 28448 return { 28449 "--n-menu-box-shadow": menuBoxShadow 28450 }; 28451 });
28452 const themeClassHandle = inlineThemeDisabled ? useThemeClass("select", void 0, cssVarsRef, props) : void 0; 28453 return Object.assign(Object.assign({}, exposedMethods), { 28454 mergedStatus: mergedStatusRef, 28455 mergedClsPrefix: mergedClsPrefixRef, 28456 mergedBordered: mergedBorderedRef, 28457 namespace: namespaceRef, 28458 treeMate: treeMateRef, 28459 isMounted: isMounted(), 28460 triggerRef: triggerRef2, 28461 menuRef, 28462 pattern: patternRef, 28463 uncontrolledShow: uncontrolledShowRef, 28464 mergedShow: mergedShowRef, 28465 adjustedTo: useAdjustedTo(props), 28466 uncontrolledValue: uncontrolledValueRef, 28467 mergedValue: mergedValueRef, 28468 followerRef, 28469 localizedPlaceholder: localizedPlaceholderRef, 28470 selectedOption: selectedOptionRef, 28471 selectedOptions: selectedOptionsRef, 28472 mergedSize: mergedSizeRef, 28473 mergedDisabled: mergedDisabledRef, 28474 focused: focusedRef, 28475 activeWithoutMenuOpen: activeWithoutMenuOpenRef, 28476 inlineThemeDisabled, 28477 onTriggerInputFocus, 28478 onTriggerInputBlur, 28479 handleTriggerOrMenuResize, 28480 handleMenuFocus, 28481 handleMenuBlur, 28482 handleMenuTabOut, 28483 handleTriggerClick, 28484 handleToggle: handleToggleByTmNode, 28485 handleDeleteOption: handleToggleByOption, 28486 handlePatternInput, 28487 handleClear, 28488 handleTriggerBlur, 28489 handleTriggerFocus, 28490 handleKeydown, 28491 handleMenuAfterLeave, 28492 handleMenuClickOutside, 28493 handleMenuScroll, 28494 handleMenuKeydown: handleKeydown, 28495 handleMenuMousedown, 28496 mergedTheme: themeRef, 28497 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef, 28498 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 28499 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 28500 }); 28501 }, 28502 render() { 28503 return h("div", { 28504 class: `${this.mergedClsPrefix}-select` 28505 }, h(VBinder, null, { 28506 default: () => [h(VTarget, null, { 28507 default: () => h(NInternalSelection, { 28508 ref: "triggerRef", 28509 inlineThemeDisabled: this.inlineThemeDisabled, 28510 status: this.mergedStatus, 28511 inputProps: this.inputProps, 28512 clsPrefix: this.mergedClsPrefix, 28513 showArrow: this.showArrow, 28514 maxTagCount: this.maxTagCount, 28515 ellipsisTagPopoverProps: this.ellipsisTagPopoverProps, 28516 bordered: this.mergedBordered, 28517 active: this.activeWithoutMenuOpen || this.mergedShow, 28518 pattern: this.pattern, 28519 placeholder: this.localizedPlaceholder, 28520 selectedOption: this.selectedOption, 28521 selectedOptions: this.selectedOptions, 28522 multiple: this.multiple, 28523 renderTag: this.renderTag, 28524 renderLabel: this.renderLabel, 28525 filterable: this.filterable, 28526 clearable: this.clearable, 28527 disabled: this.mergedDisabled, 28528 size: this.mergedSize, 28529 theme: this.mergedTheme.peers.InternalSelection, 28530 labelField: this.labelField, 28531 valueField: this.valueField, 28532 themeOverrides: this.mergedTheme.peerOverrides.InternalSelection, 28533 loading: this.loading, 28534 focused: this.focused, 28535 onClick: this.handleTriggerClick, 28536 onDeleteOption: this.handleDeleteOption, 28537 onPatternInput: this.handlePatternInput, 28538 onClear: this.handleClear, 28539 onBlur: this.handleTriggerBlur, 28540 onFocus: this.handleTriggerFocus, 28541 onKeydown: this.handleKeydown, 28542 onPatternBlur: this.onTriggerInputBlur, 28543 onPatternFocus: this.onTriggerInputFocus, 28544 onResize: this.handleTriggerOrMenuResize, 28545 ignoreComposition: this.ignoreComposition 28546 }, { 28547 arrow: () => { 28548 var _a2, _b; 28549 return [(_b = (_a2 = this.$slots).arrow) === null || _b === void 0 ? void 0 : _b.call(_a2)]; 28550 } 28551 }) 28552 }), h(VFollower, { 28553 ref: "followerRef", 28554 show: this.mergedShow, 28555 to: this.adjustedTo, 28556 teleportDisabled: this.adjustedTo === useAdjustedTo.tdkey, 28557 containerClass: this.namespace, 28558 width: this.consistentMenuWidth ? "target" : void 0, 28559 minWidth: "target", 28560 placement: this.placement 28561 }, { 28562 default: () => h(Transition, { 28563 name: "fade-in-scale-up-transition", 28564 appear: this.isMounted, 28565 onAfterLeave: this.handleMenuAfterLeave 28566 }, { 28567 default: () => { 28568 var _a2, _b, _c; 28569 if (!(this.mergedShow || this.displayDirective === "show")) { 28570 return null; 28571 } 28572 (_a2 = this.onRender) === null || _a2 === void 0 ? void 0 : _a2.call(this); 28573 return withDirectives(h(NInternalSelectMenu, Object.assign({}, this.menuProps, { 28574 ref: "menuRef", 28575 onResize: this.handleTriggerOrMenuResize, 28576 inlineThemeDisabled: this.inlineThemeDisabled, 28577 virtualScroll: this.consistentMenuWidth && this.virtualScroll, 28578 class: [`${this.mergedClsPrefix}-select-menu`, this.themeClass, (_b = this.menuProps) === null || _b === void 0 ? void 0 : _b.class], 28579 clsPrefix: this.mergedClsPrefix, 28580 focusable: true, 28581 labelField: this.labelField, 28582 valueField: this.valueField, 28583 autoPending: true, 28584 nodeProps: this.nodeProps, 28585 theme: this.mergedTheme.peers.InternalSelectMenu, 28586 themeOverrides: this.mergedTheme.peerOverrides.InternalSelectMenu, 28587 treeMate: this.treeMate, 28588 multiple: this.multiple, 28589 size: "medium", 28590 renderOption: this.renderOption, 28591 renderLabel: this.renderLabel, 28592 value: this.mergedValue, 28593 style: [(_c = this.menuProps) === null || _c === void 0 ? void 0 : _c.style, this.cssVars], 28594 onToggle: this.handleToggle, 28595 onScroll: this.handleMenuScroll, 28596 onFocus: this.handleMenuFocus, 28597 onBlur: this.handleMenuBlur, 28598 onKeydown: this.handleMenuKeydown, 28599 onTabOut: this.handleMenuTabOut, 28600 onMousedown: this.handleMenuMousedown, 28601 show: this.mergedShow, 28602 showCheckmark: this.showCheckmark, 28603 resetMenuOnOptionsChange: this.resetMenuOnOptionsChange 28604 }), { 28605 empty: () => { 28606 var _a3, _b2; 28607 return [(_b2 = (_a3 = this.$slots).empty) === null || _b2 === void 0 ? void 0 : _b2.call(_a3)]; 28608 }, 28609 header: () => { 28610 var _a3, _b2; 28611 return [(_b2 = (_a3 = this.$slots).header) === null || _b2 === void 0 ? void 0 : _b2.call(_a3)]; 28612 }, 28613 action: () => { 28614 var _a3, _b2; 28615 return [(_b2 = (_a3 = this.$slots).action) === null || _b2 === void 0 ? void 0 : _b2.call(_a3)]; 28616 } 28617 }), this.displayDirective === "show" ? [[vShow, this.mergedShow], [clickoutside$1, this.handleMenuClickOutside, void 0, { 28618 capture: true 28619 }]] : [[clickoutside$1, this.handleMenuClickOutside, void 0, { 28620 capture: true 28621 }]]); 28622 } 28623 }) 28624 })] 28625 })); 28626 } 28627}); 28628const commonVars$1 = { 28629 padding: "8px 14px" 28630}; 28631const self$7 = (vars) => { 28632 const { 28633 borderRadius, 28634 boxShadow2, 28635 baseColor 28636 } = vars; 28637 return Object.assign(Object.assign({}, commonVars$1), { 28638 borderRadius, 28639 boxShadow: boxShadow2, 28640 color: composite(baseColor, "rgba(0, 0, 0, .85)"), 28641 textColor: baseColor 28642 }); 28643}; 28644const tooltipLight = createTheme({ 28645 name: "Tooltip", 28646 common: commonLight, 28647 peers: { 28648 Popover: popoverLight$1 28649 }, 28650 self: self$7 28651}); 28652const tooltipLight$1 = tooltipLight; 28653const ellipsisLight = createTheme({ 28654 name: "Ellipsis", 28655 common: commonLight, 28656 peers: { 28657 Tooltip: tooltipLight$1 28658 } 28659}); 28660const ellipsisLight$1 = ellipsisLight; 28661const tooltipProps = Object.assign(Object.assign({}, popoverBaseProps), useTheme.props); 28662const NTooltip = defineComponent({ 28663 name: "Tooltip", 28664 props: tooltipProps, 28665 __popover__: true, 28666 setup(props) { 28667 const { 28668 mergedClsPrefixRef 28669 } = useConfig(props); 28670 const themeRef = useTheme("Tooltip", "-tooltip", void 0, tooltipLight$1, props, mergedClsPrefixRef); 28671 const popoverRef = ref(null); 28672 const tooltipExposedMethod = { 28673 syncPosition() { 28674 popoverRef.value.syncPosition(); 28675 }, 28676 setShow(show) { 28677 popoverRef.value.setShow(show); 28678 } 28679 }; 28680 return Object.assign(Object.assign({}, tooltipExposedMethod), { 28681 popoverRef, 28682 mergedTheme: themeRef, 28683 popoverThemeOverrides: computed(() => { 28684 return themeRef.value.self; 28685 }) 28686 }); 28687 }, 28688 render() { 28689 const { 28690 mergedTheme, 28691 internalExtraClass 28692 } = this; 28693 return h(NPopover, Object.assign(Object.assign({}, this.$props), { 28694 theme: mergedTheme.peers.Popover, 28695 themeOverrides: mergedTheme.peerOverrides.Popover, 28696 builtinThemeOverrides: this.popoverThemeOverrides, 28697 internalExtraClass: internalExtraClass.concat("tooltip"), 28698 ref: "popoverRef" 28699 }), this.$slots); 28700 } 28701}); 28702const style$6 = cB("ellipsis", { 28703 overflow: "hidden" 28704}, [cNotM("line-clamp", ` 28705 white-space: nowrap; 28706 display: inline-block; 28707 vertical-align: bottom; 28708 max-width: 100%; 28709 `), cM("line-clamp", ` 28710 display: -webkit-inline-box; 28711 -webkit-box-orient: vertical; 28712 `), cM("cursor-pointer", ` 28713 cursor: pointer; 28714 `)]); 28715function createLineClampClass(clsPrefix) { 28716 return `${clsPrefix}-ellipsis--line-clamp`; 28717} 28718function createCursorClass(clsPrefix, cursor) { 28719 return `${clsPrefix}-ellipsis--cursor-${cursor}`; 28720} 28721const ellipsisProps = Object.assign(Object.assign({}, useTheme.props), { 28722 expandTrigger: String, 28723 lineClamp: [Number, String], 28724 tooltip: { 28725 type: [Boolean, Object], 28726 default: true 28727 } 28728}); 28729const NEllipsis = defineComponent({ 28730 name: "Ellipsis", 28731 inheritAttrs: false, 28732 props: ellipsisProps, 28733 setup(props, { 28734 slots, 28735 attrs 28736 }) { 28737 const mergedClsPrefixRef = useMergedClsPrefix(); 28738 const mergedTheme = useTheme("Ellipsis", "-ellipsis", style$6, ellipsisLight$1, props, mergedClsPrefixRef); 28739 const triggerRef2 = ref(null); 28740 const triggerInnerRef = ref(null); 28741 const tooltipRef = ref(null); 28742 const expandedRef = ref(false); 28743 const ellipsisStyleRef = computed(() => { 28744 const { 28745 lineClamp 28746 } = props; 28747 const { 28748 value: expanded 28749 } = expandedRef; 28750 if (lineClamp !== void 0) { 28751 return { 28752 textOverflow: "", 28753 "-webkit-line-clamp": expanded ? "" : lineClamp 28754 }; 28755 } else { 28756 return { 28757 textOverflow: expanded ? "" : "ellipsis", 28758 "-webkit-line-clamp": "" 28759 }; 28760 } 28761 }); 28762 function getTooltipDisabled() { 28763 let tooltipDisabled = false;
28764 const { 28765 value: expanded 28766 } = expandedRef; 28767 if (expanded) 28768 return true; 28769 const { 28770 value: trigger2 28771 } = triggerRef2; 28772 if (trigger2) { 28773 const { 28774 lineClamp 28775 } = props; 28776 syncEllipsisStyle(trigger2); 28777 if (lineClamp !== void 0) { 28778 tooltipDisabled = trigger2.scrollHeight <= trigger2.offsetHeight; 28779 } else { 28780 const { 28781 value: triggerInner 28782 } = triggerInnerRef; 28783 if (triggerInner) { 28784 tooltipDisabled = triggerInner.getBoundingClientRect().width <= trigger2.getBoundingClientRect().width; 28785 } 28786 } 28787 syncCursorStyle(trigger2, tooltipDisabled); 28788 } 28789 return tooltipDisabled; 28790 } 28791 const handleClickRef = computed(() => { 28792 return props.expandTrigger === "click" ? () => { 28793 var _a2; 28794 const { 28795 value: expanded 28796 } = expandedRef; 28797 if (expanded) { 28798 (_a2 = tooltipRef.value) === null || _a2 === void 0 ? void 0 : _a2.setShow(false); 28799 } 28800 expandedRef.value = !expanded; 28801 } : void 0; 28802 }); 28803 onDeactivated(() => { 28804 var _a2; 28805 if (props.tooltip) { 28806 (_a2 = tooltipRef.value) === null || _a2 === void 0 ? void 0 : _a2.setShow(false); 28807 } 28808 }); 28809 const renderTrigger = () => h("span", Object.assign({}, mergeProps(attrs, { 28810 class: [`${mergedClsPrefixRef.value}-ellipsis`, props.lineClamp !== void 0 ? createLineClampClass(mergedClsPrefixRef.value) : void 0, props.expandTrigger === "click" ? createCursorClass(mergedClsPrefixRef.value, "pointer") : void 0], 28811 style: ellipsisStyleRef.value 28812 }), { 28813 ref: "triggerRef", 28814 onClick: handleClickRef.value, 28815 onMouseenter: ( 28816 // get tooltip disabled will derive cursor style 28817 props.expandTrigger === "click" ? getTooltipDisabled : void 0 28818 ) 28819 }), props.lineClamp ? slots : h("span", { 28820 ref: "triggerInnerRef" 28821 }, slots)); 28822 function syncEllipsisStyle(trigger2) { 28823 if (!trigger2) 28824 return; 28825 const latestStyle = ellipsisStyleRef.value; 28826 const lineClampClass = createLineClampClass(mergedClsPrefixRef.value); 28827 if (props.lineClamp !== void 0) { 28828 syncTriggerClass(trigger2, lineClampClass, "add"); 28829 } else { 28830 syncTriggerClass(trigger2, lineClampClass, "remove"); 28831 } 28832 for (const key in latestStyle) { 28833 if (trigger2.style[key] !== latestStyle[key]) { 28834 trigger2.style[key] = latestStyle[key]; 28835 } 28836 } 28837 } 28838 function syncCursorStyle(trigger2, tooltipDisabled) { 28839 const cursorClass = createCursorClass(mergedClsPrefixRef.value, "pointer"); 28840 if (props.expandTrigger === "click" && !tooltipDisabled) { 28841 syncTriggerClass(trigger2, cursorClass, "add"); 28842 } else { 28843 syncTriggerClass(trigger2, cursorClass, "remove"); 28844 } 28845 } 28846 function syncTriggerClass(trigger2, styleClass, action) { 28847 if (action === "add") { 28848 if (!trigger2.classList.contains(styleClass)) { 28849 trigger2.classList.add(styleClass); 28850 } 28851 } else { 28852 if (trigger2.classList.contains(styleClass)) { 28853 trigger2.classList.remove(styleClass); 28854 } 28855 } 28856 } 28857 return { 28858 mergedTheme, 28859 triggerRef: triggerRef2, 28860 triggerInnerRef, 28861 tooltipRef, 28862 handleClick: handleClickRef, 28863 renderTrigger, 28864 getTooltipDisabled 28865 }; 28866 }, 28867 render() { 28868 var _a2; 28869 const { 28870 tooltip, 28871 renderTrigger, 28872 $slots 28873 } = this; 28874 if (tooltip) { 28875 const { 28876 mergedTheme 28877 } = this; 28878 return h(NTooltip, Object.assign({ 28879 ref: "tooltipRef", 28880 placement: "top" 28881 }, tooltip, { 28882 getDisabled: this.getTooltipDisabled, 28883 theme: mergedTheme.peers.Tooltip, 28884 themeOverrides: mergedTheme.peerOverrides.Tooltip 28885 }), { 28886 trigger: renderTrigger, 28887 default: (_a2 = $slots.tooltip) !== null && _a2 !== void 0 ? _a2 : $slots.default 28888 }); 28889 } else 28890 return renderTrigger(); 28891 } 28892}); 28893const self$6 = (vars) => { 28894 const { 28895 textColorBase, 28896 opacity1, 28897 opacity2, 28898 opacity3, 28899 opacity4, 28900 opacity5 28901 } = vars; 28902 return { 28903 color: textColorBase, 28904 opacity1Depth: opacity1, 28905 opacity2Depth: opacity2, 28906 opacity3Depth: opacity3, 28907 opacity4Depth: opacity4, 28908 opacity5Depth: opacity5 28909 }; 28910}; 28911const iconLight = { 28912 name: "Icon", 28913 common: commonLight, 28914 self: self$6 28915}; 28916const iconLight$1 = iconLight; 28917const style$5 = cB("icon", ` 28918 height: 1em; 28919 width: 1em; 28920 line-height: 1em; 28921 text-align: center;
28922 display: inline-block; 28923 position: relative; 28924 fill: currentColor; 28925 transform: translateZ(0); 28926`, [cM("color-transition", { 28927 transition: "color .3s var(--n-bezier)" 28928}), cM("depth", { 28929 color: "var(--n-color)" 28930}, [c$1("svg", { 28931 opacity: "var(--n-opacity)", 28932 transition: "opacity .3s var(--n-bezier)" 28933})]), c$1("svg", { 28934 height: "1em", 28935 width: "1em" 28936})]); 28937const iconProps = Object.assign(Object.assign({}, useTheme.props), { 28938 depth: [String, Number], 28939 size: [Number, String], 28940 color: String, 28941 component: Object 28942}); 28943const NIcon = defineComponent({ 28944 _n_icon__: true, 28945 name: "Icon", 28946 inheritAttrs: false, 28947 props: iconProps, 28948 setup(props) { 28949 const { 28950 mergedClsPrefixRef, 28951 inlineThemeDisabled 28952 } = useConfig(props); 28953 const themeRef = useTheme("Icon", "-icon", style$5, iconLight$1, props, mergedClsPrefixRef); 28954 const cssVarsRef = computed(() => { 28955 const { 28956 depth 28957 } = props; 28958 const { 28959 common: { 28960 cubicBezierEaseInOut: cubicBezierEaseInOut2 28961 }, 28962 self: self2 28963 } = themeRef.value; 28964 if (depth !== void 0) { 28965 const { 28966 color, 28967 [`opacity${depth}Depth`]: opacity 28968 } = self2; 28969 return { 28970 "--n-bezier": cubicBezierEaseInOut2, 28971 "--n-color": color, 28972 "--n-opacity": opacity 28973 }; 28974 } 28975 return { 28976 "--n-bezier": cubicBezierEaseInOut2, 28977 "--n-color": "", 28978 "--n-opacity": "" 28979 }; 28980 }); 28981 const themeClassHandle = inlineThemeDisabled ? useThemeClass("icon", computed(() => `${props.depth || "d"}`), cssVarsRef, props) : void 0; 28982 return { 28983 mergedClsPrefix: mergedClsPrefixRef, 28984 mergedStyle: computed(() => { 28985 const { 28986 size: size2, 28987 color 28988 } = props; 28989 return { 28990 fontSize: formatLength(size2), 28991 color 28992 }; 28993 }), 28994 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef, 28995 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 28996 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 28997 }; 28998 }, 28999 render() { 29000 var _a2; 29001 const { 29002 $parent, 29003 depth, 29004 mergedClsPrefix, 29005 component, 29006 onRender, 29007 themeClass 29008 } = this; 29009 if ((_a2 = $parent === null || $parent === void 0 ? void 0 : $parent.$options) === null || _a2 === void 0 ? void 0 : _a2._n_icon__) { 29010 warn$2("icon", "don't wrap `n-icon` inside `n-icon`"); 29011 } 29012 onRender === null || onRender === void 0 ? void 0 : onRender(); 29013 return h("i", mergeProps(this.$attrs, { 29014 role: "img", 29015 class: [`${mergedClsPrefix}-icon`, themeClass, { 29016 [`${mergedClsPrefix}-icon--depth`]: depth, 29017 [`${mergedClsPrefix}-icon--color-transition`]: depth !== void 0 29018 }], 29019 style: [this.cssVars, this.mergedStyle] 29020 }), component ? h(component) : this.$slots); 29021 } 29022}); 29023const commonVars = { 29024 titleFontSize: "18px", 29025 padding: "16px 28px 20px 28px", 29026 iconSize: "28px", 29027 actionSpace: "12px", 29028 contentMargin: "8px 0 16px 0", 29029 iconMargin: "0 4px 0 0", 29030 iconMarginIconTop: "4px 0 8px 0", 29031 closeSize: "22px", 29032 closeIconSize: "18px", 29033 closeMargin: "20px 26px 0 0", 29034 closeMarginIconTop: "10px 16px 0 0" 29035}; 29036const self$5 = (vars) => { 29037 const { 29038 textColor1, 29039 textColor2, 29040 modalColor, 29041 closeIconColor, 29042 closeIconColorHover, 29043 closeIconColorPressed, 29044 closeColorHover, 29045 closeColorPressed, 29046 infoColor, 29047 successColor, 29048 warningColor, 29049 errorColor, 29050 primaryColor, 29051 dividerColor, 29052 borderRadius, 29053 fontWeightStrong, 29054 lineHeight: lineHeight2, 29055 fontSize: fontSize2 29056 } = vars; 29057 return Object.assign(Object.assign({}, commonVars), { 29058 fontSize: fontSize2, 29059 lineHeight: lineHeight2, 29060 border: `1px solid ${dividerColor}`, 29061 titleTextColor: textColor1, 29062 textColor: textColor2, 29063 color: modalColor, 29064 closeColorHover, 29065 closeColorPressed, 29066 closeIconColor, 29067 closeIconColorHover, 29068 closeIconColorPressed, 29069 closeBorderRadius: borderRadius, 29070 iconColor: primaryColor, 29071 iconColorInfo: infoColor, 29072 iconColorSuccess: successColor, 29073 iconColorWarning: warningColor, 29074 iconColorError: errorColor, 29075 borderRadius, 29076 titleFontWeight: fontWeightStrong 29077 }); 29078}; 29079const dialogLight = createTheme({ 29080 name: "Dialog", 29081 common: commonLight, 29082 peers: { 29083 Button: buttonLight$1 29084 }, 29085 self: self$5 29086}); 29087const dialogLight$1 = dialogLight; 29088const dialogProps = { 29089 icon: Function, 29090 type: { 29091 type: String, 29092 default: "default" 29093 }, 29094 title: [String, Function], 29095 closable: { 29096 type: Boolean, 29097 default: true 29098 }, 29099 negativeText: String, 29100 positiveText: String, 29101 positiveButtonProps: Object, 29102 negativeButtonProps: Object, 29103 content: [String, Function], 29104 action: Function, 29105 showIcon: { 29106 type: Boolean, 29107 default: true 29108 }, 29109 loading: Boolean, 29110 bordered: Boolean, 29111 iconPlacement: String, 29112 onPositiveClick: Function, 29113 onNegativeClick: Function, 29114 onClose: Function 29115}; 29116const dialogPropKeys = keysOf(dialogProps); 29117const style$4 = c$1([cB("dialog", ` 29118 --n-icon-margin: var(--n-icon-margin-top) var(--n-icon-margin-right) var(--n-icon-margin-bottom) var(--n-icon-margin-left); 29119 word-break: break-word; 29120 line-height: var(--n-line-height); 29121 position: relative; 29122 background: var(--n-color); 29123 color: var(--n-text-color); 29124 box-sizing: border-box; 29125 margin: auto; 29126 border-radius: var(--n-border-radius); 29127 padding: var(--n-padding); 29128 transition: 29129 border-color .3s var(--n-bezier), 29130 background-color .3s var(--n-bezier), 29131 color .3s var(--n-bezier); 29132 `, [cE("icon", { 29133 color: "var(--n-icon-color)" 29134}), cM("bordered", { 29135 border: "var(--n-border)" 29136}), cM("icon-top", [cE("close", { 29137 margin: "var(--n-close-margin)" 29138}), cE("icon", { 29139 margin: "var(--n-icon-margin)" 29140}), cE("content", { 29141 textAlign: "center" 29142}), cE("title", { 29143 justifyContent: "center" 29144}), cE("action", { 29145 justifyContent: "center" 29146})]), cM("icon-left", [cE("icon", { 29147 margin: "var(--n-icon-margin)" 29148}), cM("closable", [cE("title", ` 29149 padding-right: calc(var(--n-close-size) + 6px); 29150 `)])]), cE("close", ` 29151 position: absolute; 29152 right: 0; 29153 top: 0; 29154 margin: var(--n-close-margin); 29155 transition: 29156 background-color .3s var(--n-bezier), 29157 color .3s var(--n-bezier); 29158 z-index: 1; 29159 `), cE("content", ` 29160 font-size: var(--n-font-size); 29161 margin: var(--n-content-margin); 29162 position: relative; 29163 word-break: break-word; 29164 `, [cM("last", "margin-bottom: 0;")]), cE("action", ` 29165 display: flex; 29166 justify-content: flex-end; 29167 `, [c$1("> *:not(:last-child)", ` 29168 margin-right: var(--n-action-space); 29169 `)]), cE("icon", ` 29170 font-size: var(--n-icon-size); 29171 transition: color .3s var(--n-bezier); 29172 `), cE("title", ` 29173 transition: color .3s var(--n-bezier); 29174 display: flex; 29175 align-items: center; 29176 font-size: var(--n-title-font-size);
29177 font-weight: var(--n-title-font-weight); 29178 color: var(--n-title-text-color); 29179 `), cB("dialog-icon-container", ` 29180 display: flex; 29181 justify-content: center; 29182 `)]), insideModal(cB("dialog", ` 29183 width: 446px; 29184 max-width: calc(100vw - 32px); 29185 `)), cB("dialog", [asModal(` 29186 width: 446px; 29187 max-width: calc(100vw - 32px); 29188 `)])]); 29189const iconRenderMap = { 29190 default: () => h(InfoIcon, null), 29191 info: () => h(InfoIcon, null), 29192 success: () => h(SuccessIcon, null), 29193 warning: () => h(WarningIcon, null), 29194 error: () => h(ErrorIcon, null) 29195}; 29196const NDialog = defineComponent({ 29197 name: "Dialog", 29198 alias: [ 29199 "NimbusConfirmCard", 29200 // deprecated 29201 "Confirm" 29202 // deprecated 29203 ], 29204 props: Object.assign(Object.assign({}, useTheme.props), dialogProps), 29205 setup(props) { 29206 const { 29207 mergedComponentPropsRef, 29208 mergedClsPrefixRef, 29209 inlineThemeDisabled, 29210 mergedRtlRef 29211 } = useConfig(props); 29212 const rtlEnabledRef = useRtl("Dialog", mergedRtlRef, mergedClsPrefixRef); 29213 const mergedIconPlacementRef = computed(() => { 29214 var _a2, _b; 29215 const { 29216 iconPlacement 29217 } = props; 29218 return iconPlacement || ((_b = (_a2 = mergedComponentPropsRef === null || mergedComponentPropsRef === void 0 ? void 0 : mergedComponentPropsRef.value) === null || _a2 === void 0 ? void 0 : _a2.Dialog) === null || _b === void 0 ? void 0 : _b.iconPlacement) || "left"; 29219 }); 29220 function handlePositiveClick(e) { 29221 const { 29222 onPositiveClick 29223 } = props; 29224 if (onPositiveClick) 29225 onPositiveClick(e); 29226 } 29227 function handleNegativeClick(e) { 29228 const { 29229 onNegativeClick 29230 } = props; 29231 if (onNegativeClick) 29232 onNegativeClick(e); 29233 } 29234 function handleCloseClick() { 29235 const { 29236 onClose 29237 } = props; 29238 if (onClose) 29239 onClose(); 29240 } 29241 const themeRef = useTheme("Dialog", "-dialog", style$4, dialogLight$1, props, mergedClsPrefixRef); 29242 const cssVarsRef = computed(() => { 29243 const { 29244 type: type4 29245 } = props; 29246 const iconPlacement = mergedIconPlacementRef.value; 29247 const { 29248 common: { 29249 cubicBezierEaseInOut: cubicBezierEaseInOut2 29250 }, 29251 self: { 29252 fontSize: fontSize2, 29253 lineHeight: lineHeight2, 29254 border, 29255 titleTextColor, 29256 textColor, 29257 color, 29258 closeBorderRadius, 29259 closeColorHover, 29260 closeColorPressed, 29261 closeIconColor, 29262 closeIconColorHover, 29263 closeIconColorPressed, 29264 closeIconSize, 29265 borderRadius, 29266 titleFontWeight, 29267 titleFontSize, 29268 padding, 29269 iconSize, 29270 actionSpace, 29271 contentMargin, 29272 closeSize, 29273 [iconPlacement === "top" ? "iconMarginIconTop" : "iconMargin"]: iconMargin, 29274 [iconPlacement === "top" ? "closeMarginIconTop" : "closeMargin"]: closeMargin, 29275 [createKey("iconColor", type4)]: iconColor 29276 } 29277 } = themeRef.value; 29278 const iconMarginDiscrete = getMargin(iconMargin); 29279 return { 29280 "--n-font-size": fontSize2, 29281 "--n-icon-color": iconColor, 29282 "--n-bezier": cubicBezierEaseInOut2, 29283 "--n-close-margin": closeMargin, 29284 "--n-icon-margin-top": iconMarginDiscrete.top, 29285 "--n-icon-margin-right": iconMarginDiscrete.right, 29286 "--n-icon-margin-bottom": iconMarginDiscrete.bottom, 29287 "--n-icon-margin-left": iconMarginDiscrete.left, 29288 "--n-icon-size": iconSize, 29289 "--n-close-size": closeSize, 29290 "--n-close-icon-size": closeIconSize, 29291 "--n-close-border-radius": closeBorderRadius, 29292 "--n-close-color-hover": closeColorHover, 29293 "--n-close-color-pressed": closeColorPressed, 29294 "--n-close-icon-color": closeIconColor, 29295 "--n-close-icon-color-hover": closeIconColorHover, 29296 "--n-close-icon-color-pressed": closeIconColorPressed, 29297 "--n-color": color, 29298 "--n-text-color": textColor, 29299 "--n-border-radius": borderRadius, 29300 "--n-padding": padding, 29301 "--n-line-height": lineHeight2, 29302 "--n-border": border, 29303 "--n-content-margin": contentMargin, 29304 "--n-title-font-size": titleFontSize,
29305 "--n-title-font-weight": titleFontWeight, 29306 "--n-title-text-color": titleTextColor, 29307 "--n-action-space": actionSpace 29308 }; 29309 }); 29310 const themeClassHandle = inlineThemeDisabled ? useThemeClass("dialog", computed(() => `${props.type[0]}${mergedIconPlacementRef.value[0]}`), cssVarsRef, props) : void 0; 29311 return { 29312 mergedClsPrefix: mergedClsPrefixRef, 29313 rtlEnabled: rtlEnabledRef, 29314 mergedIconPlacement: mergedIconPlacementRef, 29315 mergedTheme: themeRef, 29316 handlePositiveClick, 29317 handleNegativeClick, 29318 handleCloseClick, 29319 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef, 29320 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 29321 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 29322 }; 29323 }, 29324 render() { 29325 var _a2; 29326 const { 29327 bordered, 29328 mergedIconPlacement, 29329 cssVars, 29330 closable, 29331 showIcon, 29332 title, 29333 content, 29334 action, 29335 negativeText, 29336 positiveText, 29337 positiveButtonProps, 29338 negativeButtonProps, 29339 handlePositiveClick, 29340 handleNegativeClick, 29341 mergedTheme, 29342 loading, 29343 type: type4, 29344 mergedClsPrefix 29345 } = this; 29346 (_a2 = this.onRender) === null || _a2 === void 0 ? void 0 : _a2.call(this); 29347 const icon = showIcon ? h(NBaseIcon, { 29348 clsPrefix: mergedClsPrefix, 29349 class: `${mergedClsPrefix}-dialog__icon` 29350 }, { 29351 default: () => resolveWrappedSlot(this.$slots.icon, (children) => children || (this.icon ? render$4(this.icon) : iconRenderMap[this.type]())) 29352 }) : null; 29353 const actionNode = resolveWrappedSlot(this.$slots.action, (children) => children || positiveText || negativeText || action ? h("div", { 29354 class: `${mergedClsPrefix}-dialog__action` 29355 }, children || (action ? [render$4(action)] : [this.negativeText && h(NButton, Object.assign({ 29356 theme: mergedTheme.peers.Button, 29357 themeOverrides: mergedTheme.peerOverrides.Button, 29358 ghost: true, 29359 size: "small", 29360 onClick: handleNegativeClick 29361 }, negativeButtonProps), { 29362 default: () => render$4(this.negativeText) 29363 }), this.positiveText && h(NButton, Object.assign({ 29364 theme: mergedTheme.peers.Button, 29365 themeOverrides: mergedTheme.peerOverrides.Button, 29366 size: "small", 29367 type: type4 === "default" ? "primary" : type4, 29368 disabled: loading, 29369 loading, 29370 onClick: handlePositiveClick 29371 }, positiveButtonProps), { 29372 default: () => render$4(this.positiveText) 29373 })])) : null); 29374 return h("div", { 29375 class: [`${mergedClsPrefix}-dialog`, this.themeClass, this.closable && `${mergedClsPrefix}-dialog--closable`, `${mergedClsPrefix}-dialog--icon-${mergedIconPlacement}`, bordered && `${mergedClsPrefix}-dialog--bordered`, this.rtlEnabled && `${mergedClsPrefix}-dialog--rtl`], 29376 style: cssVars, 29377 role: "dialog" 29378 }, closable ? resolveWrappedSlot(this.$slots.close, (node) => { 29379 const classNames = [`${mergedClsPrefix}-dialog__close`, this.rtlEnabled && `${mergedClsPrefix}-dialog--rtl`]; 29380 return node ? h("div", { 29381 class: classNames 29382 }, node) : h(NBaseClose, { 29383 clsPrefix: mergedClsPrefix, 29384 class: classNames, 29385 onClick: this.handleCloseClick 29386 }); 29387 }) : null, showIcon && mergedIconPlacement === "top" ? h("div", { 29388 class: `${mergedClsPrefix}-dialog-icon-container` 29389 }, icon) : null, h("div", { 29390 class: `${mergedClsPrefix}-dialog__title` 29391 }, showIcon && mergedIconPlacement === "left" ? icon : null, resolveSlot(this.$slots.header, () => [render$4(title)])), h("div", { 29392 class: [`${mergedClsPrefix}-dialog__content`, actionNode ? "" : `${mergedClsPrefix}-dialog__content--last`] 29393 }, resolveSlot(this.$slots.default, () => [render$4(content)])), actionNode); 29394 } 29395}); 29396const dialogProviderInjectionKey = createInjectionKey("n-dialog-provider"); 29397const self$4 = (vars) => { 29398 const { 29399 modalColor, 29400 textColor2, 29401 boxShadow3 29402 } = vars; 29403 return { 29404 color: modalColor, 29405 textColor: textColor2, 29406 boxShadow: boxShadow3 29407 }; 29408}; 29409const modalLight = createTheme({ 29410 name: "Modal", 29411 common: commonLight, 29412 peers: { 29413 Scrollbar: scrollbarLight$1, 29414 Dialog: dialogLight$1, 29415 Card: cardLight$1 29416 }, 29417 self: self$4 29418}); 29419const modalLight$1 = modalLight; 29420const presetProps = Object.assign(Object.assign({}, cardBaseProps), dialogProps); 29421const presetPropsKeys = keysOf(presetProps); 29422const NModalBodyWrapper = defineComponent({ 29423 name: "ModalBody", 29424 inheritAttrs: false, 29425 props: Object.assign(Object.assign({ 29426 show: { 29427 type: Boolean, 29428 required: true 29429 }, 29430 preset: String, 29431 displayDirective: { 29432 type: String, 29433 required: true 29434 }, 29435 trapFocus: { 29436 type: Boolean, 29437 default: true 29438 }, 29439 autoFocus: { 29440 type: Boolean, 29441 default: true 29442 }, 29443 blockScroll: Boolean 29444 }, presetProps), { 29445 renderMask: Function, 29446 // events 29447 onClickoutside: Function, 29448 onBeforeLeave: { 29449 type: Function, 29450 required: true 29451 }, 29452 onAfterLeave: { 29453 type: Function, 29454 required: true 29455 }, 29456 onPositiveClick: { 29457 type: Function, 29458 required: true 29459 }, 29460 onNegativeClick: { 29461 type: Function, 29462 required: true 29463 }, 29464 onClose: { 29465 type: Function, 29466 required: true 29467 }, 29468 onAfterEnter: Function,
29469 onEsc: Function 29470 }), 29471 setup(props) { 29472 const bodyRef = ref(null); 29473 const scrollbarRef = ref(null); 29474 const displayedRef = ref(props.show); 29475 const transformOriginXRef = ref(null); 29476 const transformOriginYRef = ref(null); 29477 watch(toRef(props, "show"), (value) => { 29478 if (value) 29479 displayedRef.value = true; 29480 }); 29481 useLockHtmlScroll(computed(() => props.blockScroll && displayedRef.value)); 29482 const NModal2 = inject(modalInjectionKey); 29483 function styleTransformOrigin() { 29484 if (NModal2.transformOriginRef.value === "center") { 29485 return ""; 29486 } 29487 const { 29488 value: transformOriginX 29489 } = transformOriginXRef; 29490 const { 29491 value: transformOriginY 29492 } = transformOriginYRef; 29493 if (transformOriginX === null || transformOriginY === null) { 29494 return ""; 29495 } else if (scrollbarRef.value) { 29496 const scrollTop = scrollbarRef.value.containerScrollTop; 29497 return `${transformOriginX}px ${transformOriginY + scrollTop}px`; 29498 } 29499 return ""; 29500 } 29501 function syncTransformOrigin(el) { 29502 if (NModal2.transformOriginRef.value === "center") { 29503 return; 29504 } 29505 const mousePosition = NModal2.getMousePosition(); 29506 if (!mousePosition) { 29507 return; 29508 } 29509 if (!scrollbarRef.value) 29510 return; 29511 const scrollTop = scrollbarRef.value.containerScrollTop; 29512 const { 29513 offsetLeft, 29514 offsetTop 29515 } = el; 29516 if (mousePosition) { 29517 const top = mousePosition.y; 29518 const left = mousePosition.x; 29519 transformOriginXRef.value = -(offsetLeft - left); 29520 transformOriginYRef.value = -(offsetTop - top - scrollTop); 29521 } 29522 el.style.transformOrigin = styleTransformOrigin(); 29523 } 29524 function handleEnter(el) { 29525 void nextTick(() => { 29526 syncTransformOrigin(el); 29527 }); 29528 } 29529 function handleBeforeLeave(el) { 29530 el.style.transformOrigin = styleTransformOrigin(); 29531 props.onBeforeLeave(); 29532 } 29533 function handleAfterLeave() { 29534 displayedRef.value = false; 29535 transformOriginXRef.value = null; 29536 transformOriginYRef.value = null; 29537 props.onAfterLeave(); 29538 } 29539 function handleCloseClick() { 29540 const { 29541 onClose 29542 } = props; 29543 if (onClose) { 29544 onClose(); 29545 } 29546 } 29547 function handleNegativeClick() { 29548 props.onNegativeClick(); 29549 } 29550 function handlePositiveClick() { 29551 props.onPositiveClick(); 29552 } 29553 const childNodeRef = ref(null); 29554 watch(childNodeRef, (node) => { 29555 if (node) { 29556 void nextTick(() => { 29557 const el = node.el; 29558 if (el && bodyRef.value !== el) { 29559 bodyRef.value = el; 29560 } 29561 }); 29562 } 29563 }); 29564 provide(modalBodyInjectionKey, bodyRef); 29565 provide(drawerBodyInjectionKey, null); 29566 provide(popoverBodyInjectionKey, null); 29567 return { 29568 mergedTheme: NModal2.mergedThemeRef, 29569 appear: NModal2.appearRef, 29570 isMounted: NModal2.isMountedRef, 29571 mergedClsPrefix: NModal2.mergedClsPrefixRef, 29572 bodyRef, 29573 scrollbarRef, 29574 displayed: displayedRef, 29575 childNodeRef, 29576 handlePositiveClick, 29577 handleNegativeClick, 29578 handleCloseClick, 29579 handleAfterLeave, 29580 handleBeforeLeave, 29581 handleEnter 29582 }; 29583 }, 29584 render() { 29585 const { 29586 $slots, 29587 $attrs, 29588 handleEnter, 29589 handleAfterLeave, 29590 handleBeforeLeave, 29591 preset, 29592 mergedClsPrefix 29593 } = this; 29594 let childNode = null; 29595 if (!preset) { 29596 childNode = getFirstSlotVNode($slots); 29597 if (!childNode) { 29598 warn$2("modal", "default slot is empty"); 29599 return; 29600 } 29601 childNode = cloneVNode(childNode); 29602 childNode.props = mergeProps({ 29603 class: `${mergedClsPrefix}-modal` 29604 }, $attrs, childNode.props || {}); 29605 } 29606 return this.displayDirective === "show" || this.displayed || this.show ? withDirectives(h("div", { 29607 role: "none", 29608 class: `${mergedClsPrefix}-modal-body-wrapper` 29609 }, h(NScrollbar, { 29610 ref: "scrollbarRef", 29611 theme: this.mergedTheme.peers.Scrollbar, 29612 themeOverrides: this.mergedTheme.peerOverrides.Scrollbar, 29613 contentClass: `${mergedClsPrefix}-modal-scroll-content` 29614 }, {
29615 default: () => { 29616 var _a2; 29617 return [(_a2 = this.renderMask) === null || _a2 === void 0 ? void 0 : _a2.call(this), h(FocusTrap, { 29618 disabled: !this.trapFocus, 29619 active: this.show, 29620 onEsc: this.onEsc, 29621 autoFocus: this.autoFocus 29622 }, { 29623 default: () => { 29624 var _a3; 29625 return h(Transition, { 29626 name: "fade-in-scale-up-transition", 29627 appear: (_a3 = this.appear) !== null && _a3 !== void 0 ? _a3 : this.isMounted, 29628 onEnter: handleEnter, 29629 onAfterEnter: this.onAfterEnter, 29630 onAfterLeave: handleAfterLeave, 29631 onBeforeLeave: handleBeforeLeave 29632 }, { 29633 default: () => { 29634 const dirs = [[vShow, this.show]]; 29635 const { 29636 onClickoutside 29637 } = this; 29638 if (onClickoutside) { 29639 dirs.push([clickoutside$1, this.onClickoutside, void 0, { 29640 capture: true 29641 }]); 29642 } 29643 return withDirectives(this.preset === "confirm" || this.preset === "dialog" ? h(NDialog, Object.assign({}, this.$attrs, { 29644 class: [`${mergedClsPrefix}-modal`, this.$attrs.class], 29645 ref: "bodyRef", 29646 theme: this.mergedTheme.peers.Dialog, 29647 themeOverrides: this.mergedTheme.peerOverrides.Dialog 29648 }, keep(this.$props, dialogPropKeys), { 29649 "aria-modal": "true" 29650 }), $slots) : this.preset === "card" ? h(NCard, Object.assign({}, this.$attrs, { 29651 ref: "bodyRef", 29652 class: [`${mergedClsPrefix}-modal`, this.$attrs.class], 29653 theme: this.mergedTheme.peers.Card, 29654 themeOverrides: this.mergedTheme.peerOverrides.Card 29655 }, keep(this.$props, cardBasePropKeys), { 29656 "aria-modal": "true", 29657 role: "dialog" 29658 }), $slots) : this.childNodeRef = childNode, dirs); 29659 } 29660 }); 29661 } 29662 })]; 29663 } 29664 })), [[vShow, this.displayDirective === "if" || this.displayed || this.show]]) : null; 29665 } 29666}); 29667const style$3 = c$1([cB("modal-container", ` 29668 position: fixed; 29669 left: 0; 29670 top: 0; 29671 height: 0; 29672 width: 0; 29673 display: flex; 29674 `), cB("modal-mask", ` 29675 position: fixed; 29676 left: 0; 29677 right: 0; 29678 top: 0; 29679 bottom: 0; 29680 background-color: rgba(0, 0, 0, .4); 29681 `, [fadeInTransition({ 29682 enterDuration: ".25s", 29683 leaveDuration: ".25s", 29684 enterCubicBezier: "var(--n-bezier-ease-out)", 29685 leaveCubicBezier: "var(--n-bezier-ease-out)" 29686})]), cB("modal-body-wrapper", ` 29687 position: fixed; 29688 left: 0; 29689 right: 0; 29690 top: 0; 29691 bottom: 0; 29692 overflow: visible; 29693 `, [cB("modal-scroll-content", ` 29694 min-height: 100%; 29695 display: flex; 29696 position: relative; 29697 `)]), cB("modal", ` 29698 position: relative; 29699 align-self: center; 29700 color: var(--n-text-color); 29701 margin: auto; 29702 box-shadow: var(--n-box-shadow); 29703 `, [fadeInScaleUpTransition({ 29704 duration: ".25s", 29705 enterScale: ".5" 29706})])]); 29707const modalProps = Object.assign(Object.assign(Object.assign(Object.assign({}, useTheme.props), { 29708 show: Boolean, 29709 unstableShowMask: { 29710 type: Boolean, 29711 default: true 29712 }, 29713 maskClosable: { 29714 type: Boolean, 29715 default: true 29716 }, 29717 preset: String, 29718 to: [String, Object], 29719 displayDirective: { 29720 type: String, 29721 default: "if" 29722 }, 29723 transformOrigin: { 29724 type: String, 29725 default: "mouse" 29726 }, 29727 zIndex: Number, 29728 autoFocus: { 29729 type: Boolean, 29730 default: true 29731 }, 29732 trapFocus: { 29733 type: Boolean, 29734 default: true 29735 }, 29736 closeOnEsc: { 29737 type: Boolean, 29738 default: true 29739 }, 29740 blockScroll: { 29741 type: Boolean, 29742 default: true 29743 } 29744}), presetProps), { 29745 // events 29746 onEsc: Function, 29747 "onUpdate:show": [Function, Array], 29748 onUpdateShow: [Function, Array], 29749 onAfterEnter: Function, 29750 onBeforeLeave: Function, 29751 onAfterLeave: Function, 29752 onClose: Function, 29753 onPositiveClick: Function, 29754 onNegativeClick: Function, 29755 onMaskClick: Function, 29756 // private 29757 internalDialog: Boolean, 29758 internalModal: Boolean, 29759 internalAppear: { 29760 type: Boolean, 29761 default: void 0 29762 }, 29763 // deprecated 29764 overlayStyle: [String, Object], 29765 onBeforeHide: Function, 29766 onAfterHide: Function, 29767 onHide: Function 29768}); 29769const NModal = defineComponent({ 29770 name: "Modal", 29771 inheritAttrs: false, 29772 props: modalProps, 29773 setup(props) { 29774 const containerRef = ref(null); 29775 const { 29776 mergedClsPrefixRef, 29777 namespaceRef, 29778 inlineThemeDisabled 29779 } = useConfig(props); 29780 const themeRef = useTheme("Modal", "-modal", style$3, modalLight$1, props, mergedClsPrefixRef); 29781 const clickedRef = useClicked(64); 29782 const clickedPositionRef = useClickPosition(); 29783 const isMountedRef = isMounted(); 29784 const NDialogProvider = props.internalDialog ? inject(dialogProviderInjectionKey, null) : null; 29785 const NModalProvider = props.internalModal ? inject(modalProviderInjectionKey, null) : null; 29786 const isComposingRef2 = useIsComposing(); 29787 function doUpdateShow(show) { 29788 const { 29789 onUpdateShow, 29790 "onUpdate:show": _onUpdateShow, 29791 onHide 29792 } = props; 29793 if (onUpdateShow) 29794 call(onUpdateShow, show); 29795 if (_onUpdateShow) 29796 call(_onUpdateShow, show); 29797 if (onHide && !show) 29798 onHide(show); 29799 } 29800 function handleCloseClick() { 29801 const { 29802 onClose 29803 } = props; 29804 if (onClose) { 29805 void Promise.resolve(onClose()).then((value) => { 29806 if (value === false) 29807 return; 29808 doUpdateShow(false); 29809 }); 29810 } else { 29811 doUpdateShow(false); 29812 } 29813 } 29814 function handlePositiveClick() { 29815 const { 29816 onPositiveClick 29817 } = props; 29818 if (onPositiveClick) { 29819 void Promise.resolve(onPositiveClick()).then((value) => { 29820 if (value === false) 29821 return; 29822 doUpdateShow(false); 29823 }); 29824 } else { 29825 doUpdateShow(false); 29826 } 29827 } 29828 function handleNegativeClick() { 29829 const { 29830 onNegativeClick 29831 } = props; 29832 if (onNegativeClick) { 29833 void Promise.resolve(onNegativeClick()).then((value) => { 29834 if (value === false) 29835 return; 29836 doUpdateShow(false); 29837 }); 29838 } else { 29839 doUpdateShow(false); 29840 } 29841 } 29842 function handleBeforeLeave() { 29843 const { 29844 onBeforeLeave, 29845 onBeforeHide 29846 } = props; 29847 if (onBeforeLeave) 29848 call(onBeforeLeave); 29849 if (onBeforeHide) 29850 onBeforeHide(); 29851 } 29852 function handleAfterLeave() { 29853 const { 29854 onAfterLeave, 29855 onAfterHide 29856 } = props; 29857 if (onAfterLeave) 29858 call(onAfterLeave); 29859 if (onAfterHide) 29860 onAfterHide(); 29861 } 29862 function handleClickoutside(e) { 29863 var _a2; 29864 const { 29865 onMaskClick 29866 } = props; 29867 if (onMaskClick) { 29868 onMaskClick(e); 29869 } 29870 if (props.maskClosable) { 29871 if ((_a2 = containerRef.value) === null || _a2 === void 0 ? void 0 : _a2.contains(getPreciseEventTarget(e))) { 29872 doUpdateShow(false); 29873 } 29874 } 29875 } 29876 function handleEsc(e) { 29877 var _a2; 29878 (_a2 = props.onEsc) === null || _a2 === void 0 ? void 0 : _a2.call(props); 29879 if (props.show && props.closeOnEsc && eventEffectNotPerformed(e)) { 29880 !isComposingRef2.value && doUpdateShow(false); 29881 } 29882 } 29883 provide(modalInjectionKey, { 29884 getMousePosition: () => { 29885 const mergedProvider = NDialogProvider || NModalProvider; 29886 if (mergedProvider) { 29887 const { 29888 clickedRef: clickedRef2, 29889 clickedPositionRef: clickedPositionRef2 29890 } = mergedProvider; 29891 if (clickedRef2.value && clickedPositionRef2.value) { 29892 return clickedPositionRef2.value; 29893 } 29894 } 29895 if (clickedRef.value) { 29896 return clickedPositionRef.value; 29897 } 29898 return null; 29899 }, 29900 mergedClsPrefixRef, 29901 mergedThemeRef: themeRef, 29902 isMountedRef, 29903 appearRef: toRef(props, "internalAppear"), 29904 transformOriginRef: toRef(props, "transformOrigin") 29905 }); 29906 const cssVarsRef = computed(() => { 29907 const { 29908 common: { 29909 cubicBezierEaseOut: cubicBezierEaseOut2 29910 }, 29911 self: { 29912 boxShadow, 29913 color, 29914 textColor 29915 } 29916 } = themeRef.value; 29917 return { 29918 "--n-bezier-ease-out": cubicBezierEaseOut2,
29919 "--n-box-shadow": boxShadow, 29920 "--n-color": color, 29921 "--n-text-color": textColor 29922 }; 29923 }); 29924 const themeClassHandle = inlineThemeDisabled ? useThemeClass("theme-class", void 0, cssVarsRef, props) : void 0; 29925 return { 29926 mergedClsPrefix: mergedClsPrefixRef, 29927 namespace: namespaceRef, 29928 isMounted: isMountedRef, 29929 containerRef, 29930 presetProps: computed(() => { 29931 const pickedProps = keep(props, presetPropsKeys); 29932 return pickedProps; 29933 }), 29934 handleEsc, 29935 handleAfterLeave, 29936 handleClickoutside, 29937 handleBeforeLeave, 29938 doUpdateShow, 29939 handleNegativeClick, 29940 handlePositiveClick, 29941 handleCloseClick, 29942 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef, 29943 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 29944 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 29945 }; 29946 }, 29947 render() { 29948 const { 29949 mergedClsPrefix 29950 } = this; 29951 return h(LazyTeleport, { 29952 to: this.to, 29953 show: this.show 29954 }, { 29955 default: () => { 29956 var _a2; 29957 (_a2 = this.onRender) === null || _a2 === void 0 ? void 0 : _a2.call(this); 29958 const { 29959 unstableShowMask 29960 } = this; 29961 return withDirectives(h("div", { 29962 role: "none", 29963 ref: "containerRef", 29964 class: [`${mergedClsPrefix}-modal-container`, this.themeClass, this.namespace], 29965 style: this.cssVars 29966 }, h(NModalBodyWrapper, Object.assign({ 29967 style: this.overlayStyle 29968 }, this.$attrs, { 29969 ref: "bodyWrapper", 29970 displayDirective: this.displayDirective, 29971 show: this.show, 29972 preset: this.preset, 29973 autoFocus: this.autoFocus, 29974 trapFocus: this.trapFocus, 29975 blockScroll: this.blockScroll 29976 }, this.presetProps, { 29977 onEsc: this.handleEsc, 29978 onClose: this.handleCloseClick, 29979 onNegativeClick: this.handleNegativeClick, 29980 onPositiveClick: this.handlePositiveClick, 29981 onBeforeLeave: this.handleBeforeLeave, 29982 onAfterEnter: this.onAfterEnter, 29983 onAfterLeave: this.handleAfterLeave, 29984 onClickoutside: unstableShowMask ? void 0 : this.handleClickoutside, 29985 renderMask: unstableShowMask ? () => { 29986 var _a3; 29987 return h(Transition, { 29988 name: "fade-in-transition", 29989 key: "mask", 29990 appear: (_a3 = this.internalAppear) !== null && _a3 !== void 0 ? _a3 : this.isMounted 29991 }, { 29992 default: () => { 29993 return this.show ? h("div", { 29994 "aria-hidden": true, 29995 ref: "containerRef", 29996 class: `${mergedClsPrefix}-modal-mask`, 29997 onClick: this.handleClickoutside 29998 }) : null; 29999 } 30000 }); 30001 } : void 0 30002 }), this.$slots)), [[zindexable$1, { 30003 zIndex: this.zIndex, 30004 enabled: this.show 30005 }]]); 30006 } 30007 }); 30008 } 30009}); 30010const self$3 = (vars) => { 30011 const { 30012 textColor1, 30013 dividerColor, 30014 fontWeightStrong 30015 } = vars; 30016 return { 30017 textColor: textColor1, 30018 color: dividerColor, 30019 fontWeight: fontWeightStrong 30020 }; 30021}; 30022const dividerLight = { 30023 name: "Divider", 30024 common: commonLight, 30025 self: self$3 30026}; 30027const dividerLight$1 = dividerLight; 30028const style$2 = cB("divider", ` 30029 position: relative; 30030 display: flex; 30031 width: 100%; 30032 box-sizing: border-box; 30033 font-size: 16px; 30034 color: var(--n-text-color); 30035 transition: 30036 color .3s var(--n-bezier), 30037 background-color .3s var(--n-bezier); 30038`, [cNotM("vertical", ` 30039 margin-top: 24px; 30040 margin-bottom: 24px; 30041 `, [cNotM("no-title", ` 30042 display: flex; 30043 align-items: center; 30044 `)]), cE("title", ` 30045 display: flex; 30046 align-items: center; 30047 margin-left: 12px; 30048 margin-right: 12px; 30049 white-space: nowrap; 30050 font-weight: var(--n-font-weight); 30051 `), cM("title-position-left", [cE("line", [cM("left", { 30052 width: "28px" 30053})])]), cM("title-position-right", [cE("line", [cM("right", { 30054 width: "28px" 30055})])]), cM("dashed", [cE("line", ` 30056 background-color: #0000; 30057 height: 0px; 30058 width: 100%; 30059 border-style: dashed; 30060 border-width: 1px 0 0; 30061 `)]), cM("vertical", ` 30062 display: inline-block; 30063 height: 1em; 30064 margin: 0 8px; 30065 vertical-align: middle; 30066 width: 1px; 30067 `), cE("line", ` 30068 border: none; 30069 transition: background-color .3s var(--n-bezier), border-color .3s var(--n-bezier); 30070 height: 1px; 30071 width: 100%; 30072 margin: 0; 30073 `), cNotM("dashed", [cE("line", { 30074 backgroundColor: "var(--n-color)" 30075})]), cM("dashed", [cE("line", { 30076 borderColor: "var(--n-color)" 30077})]), cM("vertical", { 30078 backgroundColor: "var(--n-color)" 30079})]); 30080const dividerProps = Object.assign(Object.assign({}, useTheme.props), { 30081 titlePlacement: { 30082 type: String, 30083 default: "center" 30084 }, 30085 dashed: Boolean, 30086 vertical: Boolean 30087}); 30088const NDivider = defineComponent({ 30089 name: "Divider", 30090 props: dividerProps, 30091 setup(props) { 30092 const { 30093 mergedClsPrefixRef, 30094 inlineThemeDisabled 30095 } = useConfig(props); 30096 const themeRef = useTheme("Divider", "-divider", style$2, dividerLight$1, props, mergedClsPrefixRef); 30097 const cssVarsRef = computed(() => { 30098 const { 30099 common: { 30100 cubicBezierEaseInOut: cubicBezierEaseInOut2 30101 }, 30102 self: { 30103 color, 30104 textColor, 30105 fontWeight 30106 } 30107 } = themeRef.value; 30108 return { 30109 "--n-bezier": cubicBezierEaseInOut2, 30110 "--n-color": color, 30111 "--n-text-color": textColor, 30112 "--n-font-weight": fontWeight 30113 }; 30114 });
30115 const themeClassHandle = inlineThemeDisabled ? useThemeClass("divider", void 0, cssVarsRef, props) : void 0; 30116 return { 30117 mergedClsPrefix: mergedClsPrefixRef, 30118 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef, 30119 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 30120 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 30121 }; 30122 }, 30123 render() { 30124 var _a2; 30125 const { 30126 $slots, 30127 titlePlacement, 30128 vertical, 30129 dashed, 30130 cssVars, 30131 mergedClsPrefix 30132 } = this; 30133 (_a2 = this.onRender) === null || _a2 === void 0 ? void 0 : _a2.call(this); 30134 return h("div", { 30135 role: "separator", 30136 class: [`${mergedClsPrefix}-divider`, this.themeClass, { 30137 [`${mergedClsPrefix}-divider--vertical`]: vertical, 30138 [`${mergedClsPrefix}-divider--no-title`]: !$slots.default, 30139 [`${mergedClsPrefix}-divider--dashed`]: dashed, 30140 [`${mergedClsPrefix}-divider--title-position-${titlePlacement}`]: $slots.default && titlePlacement 30141 }], 30142 style: cssVars 30143 }, !vertical ? h("div", { 30144 class: `${mergedClsPrefix}-divider__line ${mergedClsPrefix}-divider__line--left` 30145 }) : null, !vertical && $slots.default ? h(Fragment, null, h("div", { 30146 class: `${mergedClsPrefix}-divider__title` 30147 }, this.$slots), h("div", { 30148 class: `${mergedClsPrefix}-divider__line ${mergedClsPrefix}-divider__line--right` 30149 })) : null); 30150 } 30151}); 30152const commonVariables = { 30153 feedbackPadding: "4px 0 0 2px", 30154 feedbackHeightSmall: "24px", 30155 feedbackHeightMedium: "24px", 30156 feedbackHeightLarge: "26px", 30157 feedbackFontSizeSmall: "13px", 30158 feedbackFontSizeMedium: "14px", 30159 feedbackFontSizeLarge: "14px", 30160 labelFontSizeLeftSmall: "14px", 30161 labelFontSizeLeftMedium: "14px", 30162 labelFontSizeLeftLarge: "15px", 30163 labelFontSizeTopSmall: "13px", 30164 labelFontSizeTopMedium: "14px", 30165 labelFontSizeTopLarge: "14px", 30166 labelHeightSmall: "24px", 30167 labelHeightMedium: "26px", 30168 labelHeightLarge: "28px", 30169 labelPaddingVertical: "0 0 6px 2px", 30170 labelPaddingHorizontal: "0 12px 0 0", 30171 labelTextAlignVertical: "left", 30172 labelTextAlignHorizontal: "right", 30173 labelFontWeight: "400" 30174}; 30175const self$2 = (vars) => { 30176 const { 30177 heightSmall, 30178 heightMedium, 30179 heightLarge, 30180 textColor1, 30181 errorColor, 30182 warningColor, 30183 lineHeight: lineHeight2, 30184 textColor3 30185 } = vars; 30186 return Object.assign(Object.assign({}, commonVariables), { 30187 blankHeightSmall: heightSmall, 30188 blankHeightMedium: heightMedium, 30189 blankHeightLarge: heightLarge, 30190 lineHeight: lineHeight2, 30191 labelTextColor: textColor1, 30192 asteriskColor: errorColor, 30193 feedbackTextColorError: errorColor, 30194 feedbackTextColorWarning: warningColor, 30195 feedbackTextColor: textColor3 30196 }); 30197}; 30198const formLight = { 30199 name: "Form", 30200 common: commonLight, 30201 self: self$2 30202}; 30203const formLight$1 = formLight; 30204const formInjectionKey = createInjectionKey("n-form"); 30205const formItemInstsInjectionKey = createInjectionKey("n-form-item-insts"); 30206function _extends() { 30207 _extends = Object.assign ? Object.assign.bind() : function(target) { 30208 for (var i = 1; i < arguments.length; i++) { 30209 var source = arguments[i]; 30210 for (var key in source) { 30211 if (Object.prototype.hasOwnProperty.call(source, key)) { 30212 target[key] = source[key]; 30213 } 30214 } 30215 } 30216 return target; 30217 }; 30218 return _extends.apply(this, arguments); 30219} 30220function _inheritsLoose(subClass, superClass) { 30221 subClass.prototype = Object.create(superClass.prototype); 30222 subClass.prototype.constructor = subClass; 30223 _setPrototypeOf(subClass, superClass); 30224} 30225function _getPrototypeOf(o) { 30226 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) { 30227 return o2.__proto__ || Object.getPrototypeOf(o2); 30228 }; 30229 return _getPrototypeOf(o); 30230} 30231function _setPrototypeOf(o, p2) { 30232 _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p3) { 30233 o2.__proto__ = p3; 30234 return o2; 30235 }; 30236 return _setPrototypeOf(o, p2); 30237} 30238function _isNativeReflectConstruct() { 30239 if (typeof Reflect === "undefined" || !Reflect.construct) 30240 return false;
30241 if (Reflect.construct.sham) 30242 return false; 30243 if (typeof Proxy === "function") 30244 return true; 30245 try { 30246 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { 30247 })); 30248 return true; 30249 } catch (e) { 30250 return false; 30251 } 30252} 30253function _construct(Parent, args, Class) { 30254 if (_isNativeReflectConstruct()) { 30255 _construct = Reflect.construct.bind(); 30256 } else { 30257 _construct = function _construct2(Parent2, args2, Class2) { 30258 var a = [null]; 30259 a.push.apply(a, args2); 30260 var Constructor = Function.bind.apply(Parent2, a); 30261 var instance = new Constructor(); 30262 if (Class2) 30263 _setPrototypeOf(instance, Class2.prototype); 30264 return instance; 30265 }; 30266 } 30267 return _construct.apply(null, arguments); 30268} 30269function _isNativeFunction(fn) { 30270 return Function.toString.call(fn).indexOf("[native code]") !== -1; 30271} 30272function _wrapNativeSuper(Class) { 30273 var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0; 30274 _wrapNativeSuper = function _wrapNativeSuper2(Class2) { 30275 if (Class2 === null || !_isNativeFunction(Class2)) 30276 return Class2; 30277 if (typeof Class2 !== "function") { 30278 throw new TypeError("Super expression must either be null or a function"); 30279 } 30280 if (typeof _cache !== "undefined") { 30281 if (_cache.has(Class2)) 30282 return _cache.get(Class2); 30283 _cache.set(Class2, Wrapper2); 30284 } 30285 function Wrapper2() { 30286 return _construct(Class2, arguments, _getPrototypeOf(this).constructor); 30287 } 30288 Wrapper2.prototype = Object.create(Class2.prototype, { 30289 constructor: { 30290 value: Wrapper2, 30291 enumerable: false, 30292 writable: true, 30293 configurable: true 30294 } 30295 }); 30296 return _setPrototypeOf(Wrapper2, Class2); 30297 }; 30298 return _wrapNativeSuper(Class); 30299} 30300var formatRegExp = /%[sdj%]/g; 30301var warning = function warning2() { 30302}; 30303if (typeof process !== "undefined" && process.env && false) { 30304 warning = function warning3(type4, errors) { 30305 if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") { 30306 if (errors.every(function(e) { 30307 return typeof e === "string"; 30308 })) { 30309 console.warn(type4, errors); 30310 } 30311 } 30312 }; 30313} 30314function convertFieldsError(errors) { 30315 if (!errors || !errors.length) 30316 return null; 30317 var fields = {}; 30318 errors.forEach(function(error) { 30319 var field = error.field; 30320 fields[field] = fields[field] || []; 30321 fields[field].push(error); 30322 }); 30323 return fields; 30324} 30325function format(template) { 30326 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 30327 args[_key - 1] = arguments[_key]; 30328 } 30329 var i = 0; 30330 var len2 = args.length; 30331 if (typeof template === "function") { 30332 return template.apply(null, args); 30333 } 30334 if (typeof template === "string") { 30335 var str = template.replace(formatRegExp, function(x) { 30336 if (x === "%%") { 30337 return "%"; 30338 } 30339 if (i >= len2) { 30340 return x; 30341 } 30342 switch (x) { 30343 case "%s": 30344 return String(args[i++]); 30345 case "%d": 30346 return Number(args[i++]); 30347 case "%j": 30348 try { 30349 return JSON.stringify(args[i++]); 30350 } catch (_) { 30351 return "[Circular]"; 30352 } 30353 break; 30354 default: 30355 return x; 30356 } 30357 }); 30358 return str; 30359 } 30360 return template; 30361} 30362function isNativeStringType(type4) { 30363 return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern"; 30364} 30365function isEmptyValue(value, type4) { 30366 if (value === void 0 || value === null) { 30367 return true; 30368 } 30369 if (type4 === "array" && Array.isArray(value) && !value.length) { 30370 return true; 30371 } 30372 if (isNativeStringType(type4) && typeof value === "string" && !value) { 30373 return true; 30374 } 30375 return false; 30376} 30377function asyncParallelArray(arr, func, callback) { 30378 var results = []; 30379 var total = 0; 30380 var arrLength = arr.length; 30381 function count(errors) { 30382 results.push.apply(results, errors || []); 30383 total++; 30384 if (total === arrLength) { 30385 callback(results); 30386 } 30387 } 30388 arr.forEach(function(a) { 30389 func(a, count); 30390 }); 30391} 30392function asyncSerialArray(arr, func, callback) { 30393 var index = 0; 30394 var arrLength = arr.length; 30395 function next(errors) { 30396 if (errors && errors.length) { 30397 callback(errors); 30398 return; 30399 } 30400 var original = index; 30401 index = index + 1; 30402 if (original < arrLength) { 30403 func(arr[original], next); 30404 } else { 30405 callback([]); 30406 } 30407 } 30408 next([]); 30409} 30410function flattenObjArr(objArr) { 30411 var ret = []; 30412 Object.keys(objArr).forEach(function(k) {
30413 ret.push.apply(ret, objArr[k] || []); 30414 }); 30415 return ret; 30416} 30417var AsyncValidationError = /* @__PURE__ */ function(_Error) { 30418 _inheritsLoose(AsyncValidationError2, _Error); 30419 function AsyncValidationError2(errors, fields) { 30420 var _this; 30421 _this = _Error.call(this, "Async Validation Error") || this; 30422 _this.errors = errors; 30423 _this.fields = fields; 30424 return _this; 30425 } 30426 return AsyncValidationError2; 30427}(/* @__PURE__ */ _wrapNativeSuper(Error)); 30428function asyncMap(objArr, option, func, callback, source) { 30429 if (option.first) { 30430 var _pending = new Promise(function(resolve2, reject) { 30431 var next = function next2(errors) { 30432 callback(errors); 30433 return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve2(source); 30434 }; 30435 var flattenArr = flattenObjArr(objArr); 30436 asyncSerialArray(flattenArr, func, next); 30437 }); 30438 _pending["catch"](function(e) { 30439 return e; 30440 }); 30441 return _pending; 30442 } 30443 var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || []; 30444 var objArrKeys = Object.keys(objArr); 30445 var objArrLength = objArrKeys.length; 30446 var total = 0; 30447 var results = []; 30448 var pending = new Promise(function(resolve2, reject) { 30449 var next = function next2(errors) { 30450 results.push.apply(results, errors); 30451 total++; 30452 if (total === objArrLength) { 30453 callback(results); 30454 return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve2(source); 30455 } 30456 }; 30457 if (!objArrKeys.length) { 30458 callback(results); 30459 resolve2(source); 30460 } 30461 objArrKeys.forEach(function(key) { 30462 var arr = objArr[key]; 30463 if (firstFields.indexOf(key) !== -1) { 30464 asyncSerialArray(arr, func, next); 30465 } else { 30466 asyncParallelArray(arr, func, next); 30467 } 30468 }); 30469 }); 30470 pending["catch"](function(e) { 30471 return e; 30472 }); 30473 return pending; 30474} 30475function isErrorObj(obj) { 30476 return !!(obj && obj.message !== void 0); 30477} 30478function getValue(value, path) { 30479 var v = value; 30480 for (var i = 0; i < path.length; i++) { 30481 if (v == void 0) { 30482 return v; 30483 } 30484 v = v[path[i]]; 30485 } 30486 return v; 30487} 30488function complementError(rule, source) { 30489 return function(oe) { 30490 var fieldValue; 30491 if (rule.fullFields) { 30492 fieldValue = getValue(source, rule.fullFields); 30493 } else { 30494 fieldValue = source[oe.field || rule.fullField]; 30495 } 30496 if (isErrorObj(oe)) { 30497 oe.field = oe.field || rule.fullField; 30498 oe.fieldValue = fieldValue; 30499 return oe; 30500 } 30501 return { 30502 message: typeof oe === "function" ? oe() : oe, 30503 fieldValue, 30504 field: oe.field || rule.fullField 30505 }; 30506 }; 30507} 30508function deepMerge(target, source) { 30509 if (source) { 30510 for (var s2 in source) { 30511 if (source.hasOwnProperty(s2)) { 30512 var value = source[s2]; 30513 if (typeof value === "object" && typeof target[s2] === "object") { 30514 target[s2] = _extends({}, target[s2], value); 30515 } else { 30516 target[s2] = value; 30517 } 30518 } 30519 } 30520 } 30521 return target; 30522} 30523var required$1 = function required(rule, value, source, errors, options, type4) { 30524 if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) { 30525 errors.push(format(options.messages.required, rule.fullField)); 30526 } 30527}; 30528var whitespace = function whitespace2(rule, value, source, errors, options) { 30529 if (/^\s+$/.test(value) || value === "") { 30530 errors.push(format(options.messages.whitespace, rule.fullField)); 30531 } 30532}; 30533var urlReg; 30534var getUrlRegex = function() { 30535 if (urlReg) { 30536 return urlReg; 30537 } 30538 var word = "[a-fA-F\\d:]"; 30539 var b = function b2(options) { 30540 return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : ""; 30541 }; 30542 var v4 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}"; 30543 var v6seg = "[a-fA-F\\d]{1,4}"; 30544 var v6 = ("\n(?:\n(?:" + v6seg + ":){7}(?:" + v6seg + "|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:" + v6seg + ":){6}(?:" + v4 + "|:" + v6seg + "|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:" + v6seg + ":){5}(?::" + v4 + "|(?::" + v6seg + "){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:" + v6seg + ":){4}(?:(?::" + v6seg + "){0,1}:" + v4 + "|(?::" + v6seg + "){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:" + v6seg + ":){3}(?:(?::" + v6seg + "){0,2}:" + v4 + "|(?::" + v6seg + "){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:" + v6seg + ":){2}(?:(?::" + v6seg + "){0,3}:" + v4 + "|(?::" + v6seg + "){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:" + v6seg + ":){1}(?:(?::" + v6seg + "){0,4}:" + v4 + "|(?::" + v6seg + "){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::" + v6seg + "){0,5}:" + v4 + "|(?::" + v6seg + "){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim(); 30545 var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)"); 30546 var v4exact = new RegExp("^" + v4 + "$"); 30547 var v6exact = new RegExp("^" + v6 + "$"); 30548 var ip = function ip2(options) { 30549 return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g"); 30550 }; 30551 ip.v4 = function(options) { 30552 return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g"); 30553 }; 30554 ip.v6 = function(options) { 30555 return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g"); 30556 }; 30557 var protocol = "(?:(?:[a-z]+:)?//)"; 30558 var auth = "(?:\\S+(?::\\S*)?@)?"; 30559 var ipv4 = ip.v4().source; 30560 var ipv6 = ip.v6().source; 30561 var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)"; 30562 var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"; 30563 var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))"; 30564 var port = "(?::\\d{2,5})?"; 30565 var path = '(?:[/?#][^\\s"]*)?'; 30566 var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host
30566+ domain + tld + ")" + port + path; 30567 urlReg = new RegExp("(?:^" + regex + "$)", "i"); 30568 return urlReg; 30569}; 30570var pattern$2 = { 30571 // http://emailregex.com/ 30572 email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/, 30573 // url: new RegExp( 30574 // '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$', 30575 // 'i', 30576 // ), 30577 hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i 30578}; 30579var types = { 30580 integer: function integer(value) { 30581 return types.number(value) && parseInt(value, 10) === value; 30582 }, 30583 "float": function float2(value) { 30584 return types.number(value) && !types.integer(value); 30585 }, 30586 array: function array(value) { 30587 return Array.isArray(value); 30588 }, 30589 regexp: function regexp(value) { 30590 if (value instanceof RegExp) { 30591 return true; 30592 } 30593 try { 30594 return !!new RegExp(value); 30595 } catch (e) { 30596 return false; 30597 } 30598 }, 30599 date: function date(value) { 30600 return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime()); 30601 }, 30602 number: function number(value) { 30603 if (isNaN(value)) { 30604 return false; 30605 } 30606 return typeof value === "number"; 30607 }, 30608 object: function object(value) { 30609 return typeof value === "object" && !types.array(value); 30610 }, 30611 method: function method(value) { 30612 return typeof value === "function"; 30613 }, 30614 email: function email(value) { 30615 return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email); 30616 }, 30617 url: function url(value) { 30618 return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex()); 30619 }, 30620 hex: function hex2(value) { 30621 return typeof value === "string" && !!value.match(pattern$2.hex); 30622 } 30623}; 30624var type$1 = function type(rule, value, source, errors, options) { 30625 if (rule.required && value === void 0) { 30626 required$1(rule, value, source, errors, options); 30627 return; 30628 } 30629 var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"]; 30630 var ruleType = rule.type; 30631 if (custom.indexOf(ruleType) > -1) { 30632 if (!types[ruleType](value)) { 30633 errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type)); 30634 } 30635 } else if (ruleType && typeof value !== rule.type) { 30636 errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type)); 30637 } 30638}; 30639var range = function range2(rule, value, source, errors, options) { 30640 var len2 = typeof rule.len === "number"; 30641 var min = typeof rule.min === "number"; 30642 var max = typeof rule.max === "number"; 30643 var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; 30644 var val = value; 30645 var key = null; 30646 var num = typeof value === "number"; 30647 var str = typeof value === "string"; 30648 var arr = Array.isArray(value); 30649 if (num) { 30650 key = "number"; 30651 } else if (str) { 30652 key = "string"; 30653 } else if (arr) { 30654 key = "array"; 30655 } 30656 if (!key) { 30657 return false; 30658 } 30659 if (arr) { 30660 val = value.length; 30661 } 30662 if (str) { 30663 val = value.replace(spRegexp, "_").length; 30664 } 30665 if (len2) { 30666 if (val !== rule.len) { 30667 errors.push(format(options.messages[key].len, rule.fullField, rule.len)); 30668 } 30669 } else if (min && !max && val < rule.min) { 30670 errors.push(format(options.messages[key].min, rule.fullField, rule.min)); 30671 } else if (max && !min && val > rule.max) { 30672 errors.push(format(options.messages[key].max, rule.fullField, rule.max)); 30673 } else if (min && max && (val < rule.min || val > rule.max)) { 30674 errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max)); 30675 } 30676}; 30677var ENUM$1 = "enum"; 30678var enumerable$1 = function enumerable(rule, value, source, errors, options) { 30679 rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : []; 30680 if (rule[ENUM$1].indexOf(value) === -1) { 30681 errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", "))); 30682 } 30683}; 30684var pattern$1 = function pattern(rule, value, source, errors, options) { 30685 if (rule.pattern) { 30686 if (rule.pattern instanceof RegExp) { 30687 rule.pattern.lastIndex = 0; 30688 if (!rule.pattern.test(value)) { 30689 errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern)); 30690 } 30691 } else if (typeof rule.pattern === "string") { 30692 var _pattern = new RegExp(rule.pattern); 30693 if (!_pattern.test(value)) { 30694 errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern)); 30695 } 30696 } 30697 } 30698}; 30699var rules = { 30700 required: required$1, 30701 whitespace, 30702 type: type$1, 30703 range, 30704 "enum": enumerable$1, 30705 pattern: pattern$1 30706}; 30707var string = function string2(rule, value, callback, source, options) { 30708 var errors = [];
30709 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 30710 if (validate) { 30711 if (isEmptyValue(value, "string") && !rule.required) { 30712 return callback(); 30713 } 30714 rules.required(rule, value, source, errors, options, "string"); 30715 if (!isEmptyValue(value, "string")) { 30716 rules.type(rule, value, source, errors, options); 30717 rules.range(rule, value, source, errors, options); 30718 rules.pattern(rule, value, source, errors, options); 30719 if (rule.whitespace === true) { 30720 rules.whitespace(rule, value, source, errors, options); 30721 } 30722 } 30723 } 30724 callback(errors); 30725}; 30726var method2 = function method3(rule, value, callback, source, options) { 30727 var errors = []; 30728 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 30729 if (validate) { 30730 if (isEmptyValue(value) && !rule.required) { 30731 return callback(); 30732 } 30733 rules.required(rule, value, source, errors, options); 30734 if (value !== void 0) { 30735 rules.type(rule, value, source, errors, options); 30736 } 30737 } 30738 callback(errors); 30739}; 30740var number2 = function number3(rule, value, callback, source, options) { 30741 var errors = []; 30742 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 30743 if (validate) { 30744 if (value === "") { 30745 value = void 0; 30746 } 30747 if (isEmptyValue(value) && !rule.required) { 30748 return callback(); 30749 } 30750 rules.required(rule, value, source, errors, options); 30751 if (value !== void 0) { 30752 rules.type(rule, value, source, errors, options); 30753 rules.range(rule, value, source, errors, options); 30754 } 30755 } 30756 callback(errors); 30757}; 30758var _boolean = function _boolean2(rule, value, callback, source, options) { 30759 var errors = []; 30760 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 30761 if (validate) { 30762 if (isEmptyValue(value) && !rule.required) { 30763 return callback(); 30764 } 30765 rules.required(rule, value, source, errors, options); 30766 if (value !== void 0) { 30767 rules.type(rule, value, source, errors, options); 30768 } 30769 } 30770 callback(errors); 30771}; 30772var regexp2 = function regexp3(rule, value, callback, source, options) { 30773 var errors = []; 30774 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 30775 if (validate) { 30776 if (isEmptyValue(value) && !rule.required) { 30777 return callback(); 30778 } 30779 rules.required(rule, value, source, errors, options); 30780 if (!isEmptyValue(value)) { 30781 rules.type(rule, value, source, errors, options); 30782 } 30783 } 30784 callback(errors); 30785}; 30786var integer2 = function integer3(rule, value, callback, source, options) { 30787 var errors = []; 30788 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 30789 if (validate) { 30790 if (isEmptyValue(value) && !rule.required) { 30791 return callback(); 30792 } 30793 rules.required(rule, value, source, errors, options); 30794 if (value !== void 0) { 30795 rules.type(rule, value, source, errors, options); 30796 rules.range(rule, value, source, errors, options); 30797 } 30798 } 30799 callback(errors); 30800}; 30801var floatFn = function floatFn2(rule, value, callback, source, options) { 30802 var errors = []; 30803 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 30804 if (validate) { 30805 if (isEmptyValue(value) && !rule.required) { 30806 return callback(); 30807 } 30808 rules.required(rule, value, source, errors, options); 30809 if (value !== void 0) { 30810 rules.type(rule, value, source, errors, options); 30811 rules.range(rule, value, source, errors, options); 30812 } 30813 } 30814 callback(errors); 30815}; 30816var array2 = function array3(rule, value, callback, source, options) { 30817 var errors = []; 30818 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 30819 if (validate) { 30820 if ((value === void 0 || value === null) && !rule.required) { 30821 return callback(); 30822 } 30823 rules.required(rule, value, source, errors, options, "array"); 30824 if (value !== void 0 && value !== null) { 30825 rules.type(rule, value, source, errors, options); 30826 rules.range(rule, value, source, errors, options); 30827 } 30828 } 30829 callback(errors); 30830}; 30831var object2 = function object3(rule, value, callback, source, options) { 30832 var errors = [];
30833 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 30834 if (validate) { 30835 if (isEmptyValue(value) && !rule.required) { 30836 return callback(); 30837 } 30838 rules.required(rule, value, source, errors, options); 30839 if (value !== void 0) { 30840 rules.type(rule, value, source, errors, options); 30841 } 30842 } 30843 callback(errors); 30844}; 30845var ENUM = "enum"; 30846var enumerable2 = function enumerable3(rule, value, callback, source, options) { 30847 var errors = []; 30848 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 30849 if (validate) { 30850 if (isEmptyValue(value) && !rule.required) { 30851 return callback(); 30852 } 30853 rules.required(rule, value, source, errors, options); 30854 if (value !== void 0) { 30855 rules[ENUM](rule, value, source, errors, options); 30856 } 30857 } 30858 callback(errors); 30859}; 30860var pattern2 = function pattern3(rule, value, callback, source, options) { 30861 var errors = []; 30862 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 30863 if (validate) { 30864 if (isEmptyValue(value, "string") && !rule.required) { 30865 return callback(); 30866 } 30867 rules.required(rule, value, source, errors, options); 30868 if (!isEmptyValue(value, "string")) { 30869 rules.pattern(rule, value, source, errors, options); 30870 } 30871 } 30872 callback(errors); 30873}; 30874var date2 = function date3(rule, value, callback, source, options) { 30875 var errors = []; 30876 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 30877 if (validate) { 30878 if (isEmptyValue(value, "date") && !rule.required) { 30879 return callback(); 30880 } 30881 rules.required(rule, value, source, errors, options); 30882 if (!isEmptyValue(value, "date")) { 30883 var dateObject; 30884 if (value instanceof Date) { 30885 dateObject = value; 30886 } else { 30887 dateObject = new Date(value); 30888 } 30889 rules.type(rule, dateObject, source, errors, options); 30890 if (dateObject) { 30891 rules.range(rule, dateObject.getTime(), source, errors, options); 30892 } 30893 } 30894 } 30895 callback(errors); 30896}; 30897var required2 = function required3(rule, value, callback, source, options) { 30898 var errors = []; 30899 var type4 = Array.isArray(value) ? "array" : typeof value; 30900 rules.required(rule, value, source, errors, options, type4); 30901 callback(errors); 30902}; 30903var type2 = function type3(rule, value, callback, source, options) { 30904 var ruleType = rule.type; 30905 var errors = []; 30906 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 30907 if (validate) { 30908 if (isEmptyValue(value, ruleType) && !rule.required) { 30909 return callback(); 30910 } 30911 rules.required(rule, value, source, errors, options, ruleType); 30912 if (!isEmptyValue(value, ruleType)) { 30913 rules.type(rule, value, source, errors, options); 30914 } 30915 } 30916 callback(errors); 30917}; 30918var any = function any2(rule, value, callback, source, options) { 30919 var errors = []; 30920 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); 30921 if (validate) { 30922 if (isEmptyValue(value) && !rule.required) { 30923 return callback(); 30924 } 30925 rules.required(rule, value, source, errors, options); 30926 } 30927 callback(errors); 30928}; 30929var validators$2 = { 30930 string, 30931 method: method2, 30932 number: number2, 30933 "boolean": _boolean, 30934 regexp: regexp2, 30935 integer: integer2, 30936 "float": floatFn, 30937 array: array2, 30938 object: object2, 30939 "enum": enumerable2, 30940 pattern: pattern2, 30941 date: date2, 30942 url: type2, 30943 hex: type2, 30944 email: type2, 30945 required: required2, 30946 any 30947}; 30948function newMessages() { 30949 return { 30950 "default": "Validation error on field %s", 30951 required: "%s is required", 30952 "enum": "%s must be one of %s", 30953 whitespace: "%s cannot be empty", 30954 date: { 30955 format: "%s date %s is invalid for format %s", 30956 parse: "%s date could not be parsed, %s is invalid ", 30957 invalid: "%s date %s is invalid" 30958 }, 30959 types: { 30960 string: "%s is not a %s", 30961 method: "%s is not a %s (function)", 30962 array: "%s is not an %s", 30963 object: "%s is not an %s", 30964 number: "%s is not a %s", 30965 date: "%s is not a %s", 30966 "boolean": "%s is not a %s", 30967 integer: "%s is not an %s", 30968 "float": "%s is not a %s", 30969 regexp: "%s is not a valid %s", 30970 email: "%s is not a valid %s", 30971 url: "%s is not a valid %s", 30972 hex: "%s is not a valid %s" 30973 }, 30974 string: { 30975 len: "%s must be exactly %s characters", 30976 min: "%s must be at least %s characters", 30977 max: "%s cannot be longer than %s characters", 30978 range: "%s must be between %s and %s characters" 30979 }, 30980 number: { 30981 len: "%s must equal %s", 30982 min: "%s cannot be less than %s", 30983 max: "%s cannot be greater than %s", 30984 range: "%s must be between %s and %s" 30985 }, 30986 array: { 30987 len: "%s must be exactly %s in length", 30988 min: "%s cannot be less than %s in length", 30989 max: "%s cannot be greater than %s in length", 30990 range: "%s must be between %s and %s in length" 30991 }, 30992 pattern: { 30993 mismatch: "%s value %s does not match pattern %s" 30994 }, 30995 clone: function clone2() { 30996 var cloned = JSON.parse(JSON.stringify(this)); 30997 cloned.clone = this.clone; 30998 return cloned; 30999 } 31000 }; 31001} 31002var messages = newMessages(); 31003var Schema = /* @__PURE__ */ function() { 31004 function Schema2(descriptor) { 31005 this.rules = null; 31006 this._messages = messages; 31007 this.define(descriptor); 31008 } 31009 var _proto = Schema2.prototype; 31010 _proto.define = function define(rules2) { 31011 var _this = this; 31012 if (!rules2) { 31013 throw new Error("Cannot configure a schema with no rules"); 31014 } 31015 if (typeof rules2 !== "object" || Array.isArray(rules2)) { 31016 throw new Error("Rules must be an object"); 31017 } 31018 this.rules = {};
31019 Object.keys(rules2).forEach(function(name) { 31020 var item = rules2[name]; 31021 _this.rules[name] = Array.isArray(item) ? item : [item]; 31022 }); 31023 }; 31024 _proto.messages = function messages2(_messages) { 31025 if (_messages) { 31026 this._messages = deepMerge(newMessages(), _messages); 31027 } 31028 return this._messages; 31029 }; 31030 _proto.validate = function validate(source_, o, oc) { 31031 var _this2 = this; 31032 if (o === void 0) { 31033 o = {}; 31034 } 31035 if (oc === void 0) { 31036 oc = function oc2() { 31037 }; 31038 } 31039 var source = source_; 31040 var options = o; 31041 var callback = oc; 31042 if (typeof options === "function") { 31043 callback = options; 31044 options = {}; 31045 } 31046 if (!this.rules || Object.keys(this.rules).length === 0) { 31047 if (callback) { 31048 callback(null, source); 31049 } 31050 return Promise.resolve(source); 31051 } 31052 function complete(results) { 31053 var errors = []; 31054 var fields = {}; 31055 function add2(e) { 31056 if (Array.isArray(e)) { 31057 var _errors; 31058 errors = (_errors = errors).concat.apply(_errors, e); 31059 } else { 31060 errors.push(e); 31061 } 31062 } 31063 for (var i = 0; i < results.length; i++) { 31064 add2(results[i]); 31065 } 31066 if (!errors.length) { 31067 callback(null, source); 31068 } else { 31069 fields = convertFieldsError(errors); 31070 callback(errors, fields); 31071 } 31072 } 31073 if (options.messages) { 31074 var messages$1 = this.messages(); 31075 if (messages$1 === messages) { 31076 messages$1 = newMessages(); 31077 } 31078 deepMerge(messages$1, options.messages); 31079 options.messages = messages$1; 31080 } else { 31081 options.messages = this.messages(); 31082 } 31083 var series = {}; 31084 var keys2 = options.keys || Object.keys(this.rules); 31085 keys2.forEach(function(z) { 31086 var arr = _this2.rules[z]; 31087 var value = source[z]; 31088 arr.forEach(function(r) { 31089 var rule = r; 31090 if (typeof rule.transform === "function") { 31091 if (source === source_) { 31092 source = _extends({}, source); 31093 } 31094 value = source[z] = rule.transform(value); 31095 } 31096 if (typeof rule === "function") { 31097 rule = { 31098 validator: rule 31099 }; 31100 } else { 31101 rule = _extends({}, rule); 31102 } 31103 rule.validator = _this2.getValidationMethod(rule); 31104 if (!rule.validator) { 31105 return; 31106 } 31107 rule.field = z; 31108 rule.fullField = rule.fullField || z; 31109 rule.type = _this2.getType(rule); 31110 series[z] = series[z] || []; 31111 series[z].push({ 31112 rule, 31113 value, 31114 source, 31115 field: z 31116 }); 31117 }); 31118 }); 31119 var errorFields = {}; 31120 return asyncMap(series, options, function(data2, doIt) { 31121 var rule = data2.rule; 31122 var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object"); 31123 deep = deep && (rule.required || !rule.required && data2.value); 31124 rule.field = data2.field; 31125 function addFullField(key, schema) { 31126 return _extends({}, schema, { 31127 fullField: rule.fullField + "." + key, 31128 fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key] 31129 }); 31130 } 31131 function cb(e) { 31132 if (e === void 0) { 31133 e = []; 31134 } 31135 var errorList = Array.isArray(e) ? e : [e]; 31136 if (!options.suppressWarning && errorList.length) { 31137 Schema2.warning("async-validator:", errorList); 31138 } 31139 if (errorList.length && rule.message !== void 0) { 31140 errorList = [].concat(rule.message); 31141 } 31142 var filledErrors = errorList.map(complementError(rule, source)); 31143 if (options.first && filledErrors.length) { 31144 errorFields[rule.field] = 1; 31145 return doIt(filledErrors); 31146 } 31147 if (!deep) { 31148 doIt(filledErrors); 31149 } else { 31150 if (rule.required && !data2.value) { 31151 if (rule.message !== void 0) { 31152 filledErrors = [].concat(rule.message).map(complementError(rule, source)); 31153 } else if (options.error) {
31154 filledErrors = [options.error(rule, format(options.messages.required, rule.field))]; 31155 } 31156 return doIt(filledErrors); 31157 } 31158 var fieldsSchema = {}; 31159 if (rule.defaultField) { 31160 Object.keys(data2.value).map(function(key) { 31161 fieldsSchema[key] = rule.defaultField; 31162 }); 31163 } 31164 fieldsSchema = _extends({}, fieldsSchema, data2.rule.fields); 31165 var paredFieldsSchema = {}; 31166 Object.keys(fieldsSchema).forEach(function(field) { 31167 var fieldSchema = fieldsSchema[field]; 31168 var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema]; 31169 paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field)); 31170 }); 31171 var schema = new Schema2(paredFieldsSchema); 31172 schema.messages(options.messages); 31173 if (data2.rule.options) { 31174 data2.rule.options.messages = options.messages; 31175 data2.rule.options.error = options.error; 31176 } 31177 schema.validate(data2.value, data2.rule.options || options, function(errs) { 31178 var finalErrors = []; 31179 if (filledErrors && filledErrors.length) { 31180 finalErrors.push.apply(finalErrors, filledErrors); 31181 } 31182 if (errs && errs.length) { 31183 finalErrors.push.apply(finalErrors, errs); 31184 } 31185 doIt(finalErrors.length ? finalErrors : null); 31186 }); 31187 } 31188 } 31189 var res; 31190 if (rule.asyncValidator) { 31191 res = rule.asyncValidator(rule, data2.value, cb, data2.source, options); 31192 } else if (rule.validator) { 31193 try { 31194 res = rule.validator(rule, data2.value, cb, data2.source, options); 31195 } catch (error) { 31196 console.error == null ? void 0 : console.error(error); 31197 if (!options.suppressValidatorError) { 31198 setTimeout(function() { 31199 throw error; 31200 }, 0); 31201 } 31202 cb(error.message); 31203 } 31204 if (res === true) { 31205 cb(); 31206 } else if (res === false) { 31207 cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails"); 31208 } else if (res instanceof Array) { 31209 cb(res); 31210 } else if (res instanceof Error) { 31211 cb(res.message); 31212 } 31213 } 31214 if (res && res.then) { 31215 res.then(function() { 31216 return cb(); 31217 }, function(e) { 31218 return cb(e); 31219 }); 31220 } 31221 }, function(results) { 31222 complete(results); 31223 }, source); 31224 }; 31225 _proto.getType = function getType2(rule) { 31226 if (rule.type === void 0 && rule.pattern instanceof RegExp) { 31227 rule.type = "pattern"; 31228 } 31229 if (typeof rule.validator !== "function" && rule.type && !validators$2.hasOwnProperty(rule.type)) { 31230 throw new Error(format("Unknown rule type %s", rule.type)); 31231 } 31232 return rule.type || "string"; 31233 }; 31234 _proto.getValidationMethod = function getValidationMethod(rule) { 31235 if (typeof rule.validator === "function") { 31236 return rule.validator; 31237 } 31238 var keys2 = Object.keys(rule); 31239 var messageIndex = keys2.indexOf("message"); 31240 if (messageIndex !== -1) { 31241 keys2.splice(messageIndex, 1); 31242 } 31243 if (keys2.length === 1 && keys2[0] === "required") { 31244 return validators$2.required; 31245 } 31246 return validators$2[this.getType(rule)] || void 0; 31247 }; 31248 return Schema2; 31249}(); 31250Schema.register = function register(type4, validator2) { 31251 if (typeof validator2 !== "function") { 31252 throw new Error("Cannot register a validator by type, validator is not a function"); 31253 } 31254 validators$2[type4] = validator2; 31255}; 31256Schema.warning = warning; 31257Schema.messages = messages; 31258Schema.validators = validators$2; 31259function formItemSize(props) { 31260 const NForm = inject(formInjectionKey, null); 31261 return { 31262 mergedSize: computed(() => { 31263 if (props.size !== void 0) 31264 return props.size; 31265 if ((NForm === null || NForm === void 0 ? void 0 : NForm.props.size) !== void 0) 31266 return NForm.props.size; 31267 return "medium"; 31268 }) 31269 }; 31270} 31271function formItemMisc(props) { 31272 const NForm = inject(formInjectionKey, null); 31273 const mergedLabelPlacementRef = computed(() => { 31274 const { 31275 labelPlacement 31276 } = props; 31277 if (labelPlacement !== void 0) 31278 return labelPlacement; 31279 if (NForm === null || NForm === void 0 ? void 0 : NForm.props.labelPlacement) 31280 return NForm.props.labelPlacement; 31281 return "top"; 31282 }); 31283 const isAutoLabelWidthRef = computed(() => { 31284 return mergedLabelPlacementRef.value === "left" && (props.labelWidth === "auto" || (NForm === null || NForm === void 0 ? void 0 : NForm.props.labelWidth) === "auto"); 31285 }); 31286 const mergedLabelWidthRef = computed(() => { 31287 if (mergedLabelPlacementRef.value === "top") 31288 return; 31289 const { 31290 labelWidth 31291 } = props; 31292 if (labelWidth !== void 0 && labelWidth !== "auto") { 31293 return formatLength(labelWidth); 31294 } 31295 if (isAutoLabelWidthRef.value) { 31296 const autoComputedWidth = NForm === null || NForm === void 0 ? void 0 : NForm.maxChildLabelWidthRef.value; 31297 if (autoComputedWidth !== void 0) { 31298 return formatLength(autoComputedWidth); 31299 } else { 31300 return void 0; 31301 } 31302 } 31303 if ((NForm === null || NForm === void 0 ? void 0 : NForm.props.labelWidth) !== void 0) {
31304 return formatLength(NForm.props.labelWidth); 31305 } 31306 return void 0; 31307 }); 31308 const mergedLabelAlignRef = computed(() => { 31309 const { 31310 labelAlign 31311 } = props; 31312 if (labelAlign) 31313 return labelAlign; 31314 if (NForm === null || NForm === void 0 ? void 0 : NForm.props.labelAlign) 31315 return NForm.props.labelAlign; 31316 return void 0; 31317 }); 31318 const mergedLabelStyleRef = computed(() => { 31319 var _a2; 31320 return [(_a2 = props.labelProps) === null || _a2 === void 0 ? void 0 : _a2.style, props.labelStyle, { 31321 width: mergedLabelWidthRef.value 31322 }]; 31323 }); 31324 const mergedShowRequireMarkRef = computed(() => { 31325 const { 31326 showRequireMark 31327 } = props; 31328 if (showRequireMark !== void 0) 31329 return showRequireMark; 31330 return NForm === null || NForm === void 0 ? void 0 : NForm.props.showRequireMark; 31331 }); 31332 const mergedRequireMarkPlacementRef = computed(() => { 31333 const { 31334 requireMarkPlacement 31335 } = props; 31336 if (requireMarkPlacement !== void 0) 31337 return requireMarkPlacement; 31338 return (NForm === null || NForm === void 0 ? void 0 : NForm.props.requireMarkPlacement) || "right"; 31339 }); 31340 const validationErroredRef = ref(false); 31341 const validationWarnedRef = ref(false); 31342 const mergedValidationStatusRef = computed(() => { 31343 const { 31344 validationStatus 31345 } = props; 31346 if (validationStatus !== void 0) 31347 return validationStatus; 31348 if (validationErroredRef.value) 31349 return "error"; 31350 if (validationWarnedRef.value) 31351 return "warning"; 31352 return void 0; 31353 }); 31354 const mergedShowFeedbackRef = computed(() => { 31355 const { 31356 showFeedback 31357 } = props; 31358 if (showFeedback !== void 0) 31359 return showFeedback; 31360 if ((NForm === null || NForm === void 0 ? void 0 : NForm.props.showFeedback) !== void 0) 31361 return NForm.props.showFeedback; 31362 return true; 31363 }); 31364 const mergedShowLabelRef = computed(() => { 31365 const { 31366 showLabel 31367 } = props; 31368 if (showLabel !== void 0) 31369 return showLabel; 31370 if ((NForm === null || NForm === void 0 ? void 0 : NForm.props.showLabel) !== void 0) 31371 return NForm.props.showLabel; 31372 return true; 31373 }); 31374 return { 31375 validationErrored: validationErroredRef, 31376 validationWarned: validationWarnedRef, 31377 mergedLabelStyle: mergedLabelStyleRef, 31378 mergedLabelPlacement: mergedLabelPlacementRef, 31379 mergedLabelAlign: mergedLabelAlignRef, 31380 mergedShowRequireMark: mergedShowRequireMarkRef, 31381 mergedRequireMarkPlacement: mergedRequireMarkPlacementRef, 31382 mergedValidationStatus: mergedValidationStatusRef, 31383 mergedShowFeedback: mergedShowFeedbackRef, 31384 mergedShowLabel: mergedShowLabelRef, 31385 isAutoLabelWidth: isAutoLabelWidthRef 31386 }; 31387} 31388function formItemRule(props) { 31389 const NForm = inject(formInjectionKey, null); 31390 const compatibleRulePathRef = computed(() => { 31391 const { 31392 rulePath 31393 } = props; 31394 if (rulePath !== void 0) 31395 return rulePath; 31396 const { 31397 path 31398 } = props; 31399 if (path !== void 0) 31400 return path; 31401 return void 0; 31402 }); 31403 const mergedRulesRef = computed(() => { 31404 const rules2 = []; 31405 const { 31406 rule 31407 } = props; 31408 if (rule !== void 0) { 31409 if (Array.isArray(rule)) 31410 rules2.push(...rule); 31411 else 31412 rules2.push(rule); 31413 } 31414 if (NForm) { 31415 const { 31416 rules: formRules 31417 } = NForm.props; 31418 const { 31419 value: rulePath 31420 } = compatibleRulePathRef; 31421 if (formRules !== void 0 && rulePath !== void 0) { 31422 const formRule = get(formRules, rulePath); 31423 if (formRule !== void 0) { 31424 if (Array.isArray(formRule)) { 31425 rules2.push(...formRule); 31426 } else { 31427 rules2.push(formRule); 31428 } 31429 } 31430 } 31431 } 31432 return rules2; 31433 }); 31434 const hasRequiredRuleRef = computed(() => { 31435 return mergedRulesRef.value.some((rule) => rule.required); 31436 }); 31437 const mergedRequiredRef = computed(() => { 31438 return hasRequiredRuleRef.value || props.required; 31439 }); 31440 return { 31441 mergedRules: mergedRulesRef, 31442 mergedRequired: mergedRequiredRef 31443 }; 31444} 31445const { 31446 cubicBezierEaseInOut 31447} = commonVariables$8; 31448function fadeDownTransition({ 31449 name = "fade-down", 31450 fromOffset = "-4px", 31451 enterDuration = ".3s", 31452 leaveDuration = ".3s", 31453 enterCubicBezier = cubicBezierEaseInOut, 31454 leaveCubicBezier = cubicBezierEaseInOut 31455} = {}) { 31456 return [c$1(`&.${name}-transition-enter-from, &.${name}-transition-leave-to`, { 31457 opacity: 0, 31458 transform: `translateY(${fromOffset})` 31459 }), c$1(`&.${name}-transition-enter-to, &.${name}-transition-leave-from`, { 31460 opacity: 1, 31461 transform: "translateY(0)" 31462 }), c$1(`&.${name}-transition-leave-active`, { 31463 transition: `opacity ${leaveDuration} ${leaveCubicBezier}, transform ${leaveDuration} ${leaveCubicBezier}` 31464 }), c$1(`&.${name}-transition-enter-active`, { 31465 transition: `opacity ${enterDuration} ${enterCubicBezier}, transform ${enterDuration} ${enterCubicBezier}` 31466 })]; 31467} 31468const style$1 = cB("form-item", ` 31469 display: grid; 31470 line-height: var(--n-line-height); 31471`, [cB("form-item-label", ` 31472 grid-area: label; 31473 align-items: center; 31474 line-height: 1.25; 31475 text-align: var(--n-label-text-align); 31476 font-size: var(--n-label-font-size); 31477 min-height: var(--n-label-height); 31478 padding: var(--n-label-padding); 31479 color: var(--n-label-text-color); 31480 transition: color .3s var(--n-bezier); 31481 box-sizing: border-box;
31482 font-weight: var(--n-label-font-weight); 31483 `, [cE("asterisk", ` 31484 white-space: nowrap; 31485 user-select: none; 31486 -webkit-user-select: none; 31487 color: var(--n-asterisk-color); 31488 transition: color .3s var(--n-bezier); 31489 `), cE("asterisk-placeholder", ` 31490 grid-area: mark; 31491 user-select: none; 31492 -webkit-user-select: none; 31493 visibility: hidden; 31494 `)]), cB("form-item-blank", ` 31495 grid-area: blank; 31496 min-height: var(--n-blank-height); 31497 `), cM("auto-label-width", [cB("form-item-label", "white-space: nowrap;")]), cM("left-labelled", ` 31498 grid-template-areas: 31499 "label blank" 31500 "label feedback"; 31501 grid-template-columns: auto minmax(0, 1fr); 31502 grid-template-rows: auto 1fr; 31503 align-items: flex-start; 31504 `, [cB("form-item-label", ` 31505 display: grid; 31506 grid-template-columns: 1fr auto; 31507 min-height: var(--n-blank-height); 31508 height: auto; 31509 box-sizing: border-box; 31510 flex-shrink: 0; 31511 flex-grow: 0; 31512 `, [cM("reverse-columns-space", ` 31513 grid-template-columns: auto 1fr; 31514 `), cM("left-mark", ` 31515 grid-template-areas: 31516 "mark text" 31517 ". text"; 31518 `), cM("right-mark", ` 31519 grid-template-areas: 31520 "text mark" 31521 "text ."; 31522 `), cM("right-hanging-mark", ` 31523 grid-template-areas: 31524 "text mark" 31525 "text ."; 31526 `), cE("text", ` 31527 grid-area: text; 31528 `), cE("asterisk", ` 31529 grid-area: mark; 31530 align-self: end; 31531 `)])]), cM("top-labelled", ` 31532 grid-template-areas: 31533 "label" 31534 "blank" 31535 "feedback"; 31536 grid-template-rows: minmax(var(--n-label-height), auto) 1fr; 31537 grid-template-columns: minmax(0, 100%); 31538 `, [cM("no-label", ` 31539 grid-template-areas: 31540 "blank" 31541 "feedback"; 31542 grid-template-rows: 1fr; 31543 `), cB("form-item-label", ` 31544 display: flex; 31545 align-items: flex-start; 31546 justify-content: var(--n-label-text-align); 31547 `)]), cB("form-item-blank", ` 31548 box-sizing: border-box; 31549 display: flex; 31550 align-items: center; 31551 position: relative; 31552 `), cB("form-item-feedback-wrapper", ` 31553 grid-area: feedback; 31554 box-sizing: border-box; 31555 min-height: var(--n-feedback-height); 31556 font-size: var(--n-feedback-font-size); 31557 line-height: 1.25; 31558 transform-origin: top left; 31559 `, [c$1("&:not(:empty)", ` 31560 padding: var(--n-feedback-padding); 31561 `), cB("form-item-feedback", { 31562 transition: "color .3s var(--n-bezier)", 31563 color: "var(--n-feedback-text-color)" 31564}, [cM("warning", { 31565 color: "var(--n-feedback-text-color-warning)" 31566}), cM("error", { 31567 color: "var(--n-feedback-text-color-error)" 31568}), fadeDownTransition({ 31569 fromOffset: "-3px", 31570 enterDuration: ".3s", 31571 leaveDuration: ".2s" 31572})])])]); 31573var __awaiter = globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) { 31574 function adopt(value) { 31575 return value instanceof P ? value : new P(function(resolve2) { 31576 resolve2(value); 31577 }); 31578 } 31579 return new (P || (P = Promise))(function(resolve2, reject) { 31580 function fulfilled(value) { 31581 try { 31582 step(generator.next(value)); 31583 } catch (e) { 31584 reject(e); 31585 } 31586 } 31587 function rejected(value) { 31588 try { 31589 step(generator["throw"](value)); 31590 } catch (e) { 31591 reject(e); 31592 } 31593 } 31594 function step(result) { 31595 result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); 31596 } 31597 step((generator = generator.apply(thisArg, _arguments || [])).next()); 31598 }); 31599}; 31600const formItemProps = Object.assign(Object.assign({}, useTheme.props), { 31601 label: String, 31602 labelWidth: [Number, String], 31603 labelStyle: [String, Object], 31604 labelAlign: String, 31605 labelPlacement: String, 31606 path: String, 31607 first: Boolean, 31608 rulePath: String, 31609 required: Boolean, 31610 showRequireMark: { 31611 type: Boolean, 31612 default: void 0 31613 }, 31614 requireMarkPlacement: String,
31615 showFeedback: { 31616 type: Boolean, 31617 default: void 0 31618 }, 31619 rule: [Object, Array], 31620 size: String, 31621 ignorePathChange: Boolean, 31622 validationStatus: String, 31623 feedback: String, 31624 showLabel: { 31625 type: Boolean, 31626 default: void 0 31627 }, 31628 labelProps: Object 31629}); 31630function wrapValidator(validator2, async) { 31631 return (...args) => { 31632 try { 31633 const validateResult = validator2(...args); 31634 if (!async && (typeof validateResult === "boolean" || validateResult instanceof Error || Array.isArray(validateResult)) || // Error[] 31635 (validateResult === null || validateResult === void 0 ? void 0 : validateResult.then)) { 31636 return validateResult; 31637 } else if (validateResult === void 0) { 31638 return true; 31639 } else { 31640 warn$2("form-item/validate", `You return a ${typeof validateResult} typed value in the validator method, which is not recommended. Please use ` + (async ? "`Promise`" : "`boolean`, `Error` or `Promise`") + " typed value instead."); 31641 return true; 31642 } 31643 } catch (err) { 31644 warn$2("form-item/validate", "An error is catched in the validation, so the validation won't be done. Your callback in `validate` method of `n-form` or `n-form-item` won't be called in this validation."); 31645 console.error(err); 31646 return void 0; 31647 } 31648 }; 31649} 31650const NFormItem = defineComponent({ 31651 name: "FormItem", 31652 props: formItemProps, 31653 setup(props) { 31654 useInjectionInstanceCollection(formItemInstsInjectionKey, "formItems", toRef(props, "path")); 31655 const { 31656 mergedClsPrefixRef, 31657 inlineThemeDisabled 31658 } = useConfig(props); 31659 const NForm = inject(formInjectionKey, null); 31660 const formItemSizeRefs = formItemSize(props); 31661 const formItemMiscRefs = formItemMisc(props); 31662 const { 31663 validationErrored: validationErroredRef, 31664 validationWarned: validationWarnedRef 31665 } = formItemMiscRefs; 31666 const { 31667 mergedRequired: mergedRequiredRef, 31668 mergedRules: mergedRulesRef 31669 } = formItemRule(props); 31670 const { 31671 mergedSize: mergedSizeRef 31672 } = formItemSizeRefs; 31673 const { 31674 mergedLabelPlacement: labelPlacementRef, 31675 mergedLabelAlign: labelTextAlignRef, 31676 mergedRequireMarkPlacement: mergedRequireMarkPlacementRef 31677 } = formItemMiscRefs; 31678 const renderExplainsRef = ref([]); 31679 const feedbackIdRef = ref(createId()); 31680 const mergedDisabledRef = NForm ? toRef(NForm.props, "disabled") : ref(false); 31681 const themeRef = useTheme("Form", "-form-item", style$1, formLight$1, props, mergedClsPrefixRef); 31682 watch(toRef(props, "path"), () => { 31683 if (props.ignorePathChange) 31684 return; 31685 restoreValidation(); 31686 }); 31687 function restoreValidation() { 31688 renderExplainsRef.value = []; 31689 validationErroredRef.value = false; 31690 validationWarnedRef.value = false; 31691 if (props.feedback) { 31692 feedbackIdRef.value = createId(); 31693 } 31694 } 31695 function handleContentBlur() { 31696 void internalValidate("blur"); 31697 } 31698 function handleContentChange() { 31699 void internalValidate("change"); 31700 } 31701 function handleContentFocus() { 31702 void internalValidate("focus"); 31703 } 31704 function handleContentInput() { 31705 void internalValidate("input"); 31706 } 31707 function validate(options, callback) { 31708 return __awaiter(this, void 0, void 0, function* () { 31709 let trigger2; 31710 let validateCallback; 31711 let shouldRuleBeApplied; 31712 let asyncValidatorOptions; 31713 if (typeof options === "string") { 31714 trigger2 = options; 31715 validateCallback = callback; 31716 } else if (options !== null && typeof options === "object") { 31717 trigger2 = options.trigger; 31718 validateCallback = options.callback; 31719 shouldRuleBeApplied = options.shouldRuleBeApplied; 31720 asyncValidatorOptions = options.options; 31721 } 31722 return yield new Promise((resolve2, reject) => { 31723 void internalValidate(trigger2, shouldRuleBeApplied, asyncValidatorOptions).then(({ 31724 valid, 31725 errors, 31726 warnings 31727 }) => { 31728 if (valid) { 31729 if (validateCallback) { 31730 validateCallback(void 0, { 31731 warnings 31732 }); 31733 } 31734 resolve2({ 31735 warnings 31736 }); 31737 } else { 31738 if (validateCallback) { 31739 validateCallback(errors, { 31740 warnings 31741 }); 31742 } 31743 reject(errors); 31744 } 31745 }); 31746 }); 31747 }); 31748 } 31749 const internalValidate = (trigger2 = null, shouldRuleBeApplied = () => true, options = { 31750 suppressWarning: true 31751 }) => __awaiter(this, void 0, void 0, function* () { 31752 const { 31753 path 31754 } = props; 31755 if (!options) { 31756 options = {}; 31757 } else { 31758 if (!options.first) 31759 options.first = props.first; 31760 } 31761 const { 31762 value: rules2 31763 } = mergedRulesRef; 31764 const value = NForm ? get(NForm.props.model, path || "") : void 0; 31765 const messageRenderers = {}; 31766 const originalMessageRendersMessage = {}; 31767 const activeRules = (!trigger2 ? rules2 : rules2.filter((rule) => { 31768 if (Array.isArray(rule.trigger)) { 31769 return rule.trigger.includes(trigger2); 31770 } else { 31771 return rule.trigger === trigger2; 31772 } 31773 })).filter(shouldRuleBeApplied).map((rule, i) => { 31774 const shallowClonedRule = Object.assign({}, rule); 31775 if (shallowClonedRule.validator) { 31776 shallowClonedRule.validator = wrapValidator(shallowClonedRule.validator, false); 31777 } 31778 if (shallowClonedRule.asyncValidator) { 31779 shallowClonedRule.asyncValidator = wrapValidator(shallowClonedRule.asyncValidator, true); 31780 } 31781 if (shallowClonedRule.renderMessage) { 31782 const rendererKey = `__renderMessage__${i}`; 31783 originalMessageRendersMessage[rendererKey] = shallowClonedRule.message; 31784 shallowClonedRule.message = rendererKey; 31785 messageRenderers[rendererKey] = shallowClonedRule.renderMessage; 31786 } 31787 return shallowClonedRule; 31788 }); 31789 const activeErrorRules = activeRules.filter((r) => r.level !== "warning"); 31790 const activeWarningRules = activeRules.filter((r) => r.level === "warning"); 31791 const mergedPath = path !== null && path !== void 0 ? path : "__n_no_path__"; 31792 const validator2 = new Schema({ 31793 [mergedPath]: activeErrorRules 31794 }); 31795 const warningValidator = new Schema({ 31796 [mergedPath]: activeWarningRules 31797 }); 31798 const { 31799 validateMessages 31800 } = (NForm === null || NForm === void 0 ? void 0 : NForm.props) || {}; 31801 if (validateMessages) { 31802 validator2.messages(validateMessages); 31803 warningValidator.messages(validateMessages); 31804 } 31805 const renderMessages = (errors) => { 31806 renderExplainsRef.value = errors.map((error) => { 31807 const transformedMessage = (error === null || error === void 0 ? void 0 : error.message) || ""; 31808 return { 31809 key: transformedMessage, 31810 render: () => { 31811 if (transformedMessage.startsWith("__renderMessage__")) { 31812 return messageRenderers[transformedMessage](); 31813 } 31814 return transformedMessage; 31815 } 31816 }; 31817 });
31818 errors.forEach((error) => { 31819 var _a2; 31820 if ((_a2 = error.message) === null || _a2 === void 0 ? void 0 : _a2.startsWith("__renderMessage__")) { 31821 error.message = originalMessageRendersMessage[error.message]; 31822 } 31823 }); 31824 }; 31825 const validationResult = { 31826 valid: true, 31827 errors: void 0, 31828 warnings: void 0 31829 }; 31830 if (activeErrorRules.length) { 31831 const errors = yield new Promise((resolve2) => { 31832 void validator2.validate({ 31833 [mergedPath]: value 31834 }, options, resolve2); 31835 }); 31836 if (errors === null || errors === void 0 ? void 0 : errors.length) { 31837 validationErroredRef.value = true; 31838 validationResult.valid = false; 31839 validationResult.errors = errors; 31840 renderMessages(errors); 31841 } 31842 } 31843 if (activeWarningRules.length && !validationResult.errors) { 31844 const warnings = yield new Promise((resolve2) => { 31845 void warningValidator.validate({ 31846 [mergedPath]: value 31847 }, options, resolve2); 31848 }); 31849 if (warnings === null || warnings === void 0 ? void 0 : warnings.length) { 31850 renderMessages(warnings); 31851 validationWarnedRef.value = true; 31852 validationResult.warnings = warnings; 31853 } 31854 } 31855 if (activeErrorRules.length + activeWarningRules.length > 0 && !validationResult.errors && !validationResult.warnings) { 31856 restoreValidation(); 31857 } 31858 return validationResult; 31859 }); 31860 provide(formItemInjectionKey, { 31861 path: toRef(props, "path"), 31862 disabled: mergedDisabledRef, 31863 mergedSize: formItemSizeRefs.mergedSize, 31864 mergedValidationStatus: formItemMiscRefs.mergedValidationStatus, 31865 restoreValidation, 31866 handleContentBlur, 31867 handleContentChange, 31868 handleContentFocus, 31869 handleContentInput 31870 }); 31871 const exposedRef = { 31872 validate, 31873 restoreValidation, 31874 internalValidate 31875 }; 31876 const labelElementRef = ref(null); 31877 onMounted(() => { 31878 if (!formItemMiscRefs.isAutoLabelWidth.value) 31879 return; 31880 const labelElement = labelElementRef.value; 31881 if (labelElement !== null) { 31882 const memoizedWhitespace = labelElement.style.whiteSpace; 31883 labelElement.style.whiteSpace = "nowrap"; 31884 labelElement.style.width = ""; 31885 NForm === null || NForm === void 0 ? void 0 : NForm.deriveMaxChildLabelWidth(Number(getComputedStyle(labelElement).width.slice(0, -2))); 31886 labelElement.style.whiteSpace = memoizedWhitespace; 31887 } 31888 }); 31889 const cssVarsRef = computed(() => { 31890 var _a2; 31891 const { 31892 value: size2 31893 } = mergedSizeRef; 31894 const { 31895 value: labelPlacement 31896 } = labelPlacementRef; 31897 const direction = labelPlacement === "top" ? "vertical" : "horizontal"; 31898 const { 31899 common: { 31900 cubicBezierEaseInOut: cubicBezierEaseInOut2 31901 }, 31902 self: { 31903 labelTextColor, 31904 asteriskColor, 31905 lineHeight: lineHeight2, 31906 feedbackTextColor, 31907 feedbackTextColorWarning, 31908 feedbackTextColorError, 31909 feedbackPadding, 31910 labelFontWeight, 31911 [createKey("labelHeight", size2)]: labelHeight, 31912 [createKey("blankHeight", size2)]: blankHeight, 31913 [createKey("feedbackFontSize", size2)]: feedbackFontSize, 31914 [createKey("feedbackHeight", size2)]: feedbackHeight, 31915 [createKey("labelPadding", direction)]: labelPadding, 31916 [createKey("labelTextAlign", direction)]: labelTextAlign, 31917 [createKey(createKey("labelFontSize", labelPlacement), size2)]: labelFontSize 31918 } 31919 } = themeRef.value; 31920 let mergedLabelTextAlign = (_a2 = labelTextAlignRef.value) !== null && _a2 !== void 0 ? _a2 : labelTextAlign; 31921 if (labelPlacement === "top") { 31922 mergedLabelTextAlign = mergedLabelTextAlign === "right" ? "flex-end" : "flex-start"; 31923 } 31924 const cssVars = { 31925 "--n-bezier": cubicBezierEaseInOut2, 31926 "--n-line-height": lineHeight2, 31927 "--n-blank-height": blankHeight, 31928 "--n-label-font-size": labelFontSize, 31929 "--n-label-text-align": mergedLabelTextAlign, 31930 "--n-label-height": labelHeight, 31931 "--n-label-padding": labelPadding,
31932 "--n-label-font-weight": labelFontWeight, 31933 "--n-asterisk-color": asteriskColor, 31934 "--n-label-text-color": labelTextColor, 31935 "--n-feedback-padding": feedbackPadding, 31936 "--n-feedback-font-size": feedbackFontSize, 31937 "--n-feedback-height": feedbackHeight, 31938 "--n-feedback-text-color": feedbackTextColor, 31939 "--n-feedback-text-color-warning": feedbackTextColorWarning, 31940 "--n-feedback-text-color-error": feedbackTextColorError 31941 }; 31942 return cssVars; 31943 }); 31944 const themeClassHandle = inlineThemeDisabled ? useThemeClass("form-item", computed(() => { 31945 var _a2; 31946 return `${mergedSizeRef.value[0]}${labelPlacementRef.value[0]}${((_a2 = labelTextAlignRef.value) === null || _a2 === void 0 ? void 0 : _a2[0]) || ""}`; 31947 }), cssVarsRef, props) : void 0; 31948 const reverseColSpaceRef = computed(() => { 31949 return labelPlacementRef.value === "left" && mergedRequireMarkPlacementRef.value === "left" && labelTextAlignRef.value === "left"; 31950 }); 31951 return Object.assign(Object.assign(Object.assign(Object.assign({ 31952 labelElementRef, 31953 mergedClsPrefix: mergedClsPrefixRef, 31954 mergedRequired: mergedRequiredRef, 31955 feedbackId: feedbackIdRef, 31956 renderExplains: renderExplainsRef, 31957 reverseColSpace: reverseColSpaceRef 31958 }, formItemMiscRefs), formItemSizeRefs), exposedRef), { 31959 cssVars: inlineThemeDisabled ? void 0 : cssVarsRef, 31960 themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, 31961 onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender 31962 }); 31963 }, 31964 render() { 31965 const { 31966 $slots, 31967 mergedClsPrefix, 31968 mergedShowLabel, 31969 mergedShowRequireMark, 31970 mergedRequireMarkPlacement, 31971 onRender 31972 } = this; 31973 const renderedShowRequireMark = mergedShowRequireMark !== void 0 ? mergedShowRequireMark : this.mergedRequired; 31974 onRender === null || onRender === void 0 ? void 0 : onRender(); 31975 const renderLabel = () => { 31976 const labelText = this.$slots.label ? this.$slots.label() : this.label; 31977 if (!labelText) 31978 return null; 31979 const textNode = h("span", { 31980 class: `${mergedClsPrefix}-form-item-label__text` 31981 }, labelText); 31982 const markNode = renderedShowRequireMark ? h("span", { 31983 class: `${mergedClsPrefix}-form-item-label__asterisk` 31984 }, mergedRequireMarkPlacement !== "left" ? "Â *" : "*Â ") : mergedRequireMarkPlacement === "right-hanging" && h("span", { 31985 class: `${mergedClsPrefix}-form-item-label__asterisk-placeholder` 31986 }, "Â *"); 31987 const { 31988 labelProps 31989 } = this; 31990 return h("label", Object.assign({}, labelProps, { 31991 class: [labelProps === null || labelProps === void 0 ? void 0 : labelProps.class, `${mergedClsPrefix}-form-item-label`, `${mergedClsPrefix}-form-item-label--${mergedRequireMarkPlacement}-mark`, this.reverseColSpace && `${mergedClsPrefix}-form-item-label--reverse-columns-space`], 31992 style: this.mergedLabelStyle, 31993 ref: "labelElementRef" 31994 }), mergedRequireMarkPlacement === "left" ? [markNode, textNode] : [textNode, markNode]); 31995 }; 31996 return h("div", { 31997 class: [`${mergedClsPrefix}-form-item`, this.themeClass, `${mergedClsPrefix}-form-item--${this.mergedSize}-size`, `${mergedClsPrefix}-form-item--${this.mergedLabelPlacement}-labelled`, this.isAutoLabelWidth && `${mergedClsPrefix}-form-item--auto-label-width`, !mergedShowLabel && `${mergedClsPrefix}-form-item--no-label`], 31998 style: this.cssVars 31999 }, mergedShowLabel && renderLabel(), h("div", { 32000 class: [`${mergedClsPrefix}-form-item-blank`, this.mergedValidationStatus && `${mergedClsPrefix}-form-item-blank--${this.mergedValidationStatus}`] 32001 }, $slots), this.mergedShowFeedback ? h("div", { 32002 key: this.feedbackId, 32003 class: `${mergedClsPrefix}-form-item-feedback-wrapper` 32004 }, h(Transition, { 32005 name: "fade-down-transition", 32006 mode: "out-in" 32007 }, { 32008 default: () => { 32009 const { 32010 mergedValidationStatus 32011 } = this; 32012 return resolveWrappedSlot($slots.feedback, (children) => { 32013 var _a2; 32014 const { 32015 feedback 32016 } = this; 32017 const feedbackNodes = children || feedback ? h("div", { 32018 key: "__feedback__", 32019 class: `${mergedClsPrefix}-form-item-feedback__line` 32020 }, children || feedback) : this.renderExplains.length ? (_a2 = this.renderExplains) === null || _a2 === void 0 ? void 0 : _a2.map(({ 32021 key, 32022 render: render2 32023 }) => h("div", { 32024 key, 32025 class: `${mergedClsPrefix}-form-item-feedback__line` 32026 }, render2())) : null; 32027 return feedbackNodes ? mergedValidationStatus === "warning" ? h("div", { 32028 key: "controlled-warning", 32029 class: `${mergedClsPrefix}-form-item-feedback ${mergedClsPrefix}-form-item-feedback--warning` 32030 }, feedbackNodes) : mergedValidationStatus === "error" ? h("div", { 32031 key: "controlled-error", 32032 class: `${mergedClsPrefix}-form-item-feedback ${mergedClsPrefix}-form-item-feedback--error` 32033 }, feedbackNodes) : mergedValidationStatus === "success" ? h("div", { 32034 key: "controlled-success", 32035 class: `${mergedClsPrefix}-form-item-feedback ${mergedClsPrefix}-form-item-feedback--success` 32036 }, feedbackNodes) : h("div", { 32037 key: "controlled-default", 32038 class: `${mergedClsPrefix}-form-item-feedback` 32039 }, feedbackNodes) : null; 32040 }); 32041 } 32042 })) : null); 32043 } 32044}); 32045const self$1 = (vars) => { 32046 const { 32047 heightSmall, 32048 heightMedium, 32049 heightLarge, 32050 borderRadius 32051 } = vars; 32052 return { 32053 color: "#eee", 32054 colorEnd: "#ddd", 32055 borderRadius, 32056 heightSmall, 32057 heightMedium, 32058 heightLarge 32059 }; 32060}; 32061const skeletonLight = { 32062 name: "Skeleton", 32063 common: commonLight, 32064 self: self$1 32065}; 32066const style = c$1([cB("skeleton", ` 32067 height: 1em; 32068 width: 100%; 32069 transition: 32070 --n-color-start .3s var(--n-bezier), 32071 --n-color-end .3s var(--n-bezier), 32072 background-color .3s var(--n-bezier); 32073 animation: 2s skeleton-loading infinite cubic-bezier(0.36, 0, 0.64, 1); 32074 background-color: var(--n-color-start); 32075 `), c$1("@keyframes skeleton-loading", ` 32076 0% { 32077 background: var(--n-color-start); 32078 } 32079 40% { 32080 background: var(--n-color-end); 32081 } 32082 80% { 32083 background: var(--n-color-start); 32084 } 32085 100% { 32086 background: var(--n-color-start); 32087 } 32088 `)]); 32089const skeletonProps = Object.assign(Object.assign({}, useTheme.props), { 32090 text: Boolean, 32091 round: Boolean,
32092 circle: Boolean, 32093 height: [String, Number], 32094 width: [String, Number], 32095 size: String, 32096 repeat: { 32097 type: Number, 32098 default: 1 32099 }, 32100 animated: { 32101 type: Boolean, 32102 default: true 32103 }, 32104 sharp: { 32105 type: Boolean, 32106 default: true 32107 } 32108}); 32109const NSkeleton = defineComponent({ 32110 name: "Skeleton", 32111 inheritAttrs: false, 32112 props: skeletonProps, 32113 setup(props) { 32114 useHoudini(); 32115 const { 32116 mergedClsPrefixRef 32117 } = useConfig(props); 32118 const themeRef = useTheme("Skeleton", "-skeleton", style, skeletonLight, props, mergedClsPrefixRef); 32119 return { 32120 mergedClsPrefix: mergedClsPrefixRef, 32121 style: computed(() => { 32122 var _a2, _b; 32123 const theme = themeRef.value; 32124 const { 32125 common: { 32126 cubicBezierEaseInOut: cubicBezierEaseInOut2 32127 } 32128 } = theme; 32129 const selfThemeVars = theme.self; 32130 const { 32131 color, 32132 colorEnd, 32133 borderRadius 32134 } = selfThemeVars; 32135 let sizeHeight; 32136 const { 32137 circle, 32138 sharp, 32139 round, 32140 width, 32141 height, 32142 size: size2, 32143 text, 32144 animated 32145 } = props; 32146 if (size2 !== void 0) { 32147 sizeHeight = selfThemeVars[createKey("height", size2)]; 32148 } 32149 const mergedWidth = circle ? (_a2 = width !== null && width !== void 0 ? width : height) !== null && _a2 !== void 0 ? _a2 : sizeHeight : width; 32150 const mergedHeight = (_b = circle ? width !== null && width !== void 0 ? width : height : height) !== null && _b !== void 0 ? _b : sizeHeight; 32151 return { 32152 display: text ? "inline-block" : "", 32153 verticalAlign: text ? "-0.125em" : "", 32154 borderRadius: circle ? "50%" : round ? "4096px" : sharp ? "" : borderRadius, 32155 width: typeof mergedWidth === "number" ? pxfy(mergedWidth) : mergedWidth, 32156 height: typeof mergedHeight === "number" ? pxfy(mergedHeight) : mergedHeight, 32157 animation: !animated ? "none" : "", 32158 "--n-bezier": cubicBezierEaseInOut2, 32159 "--n-color-start": color, 32160 "--n-color-end": colorEnd 32161 }; 32162 }) 32163 }; 32164 }, 32165 render() { 32166 const { 32167 repeat: repeatProp, 32168 style: style2, 32169 mergedClsPrefix, 32170 $attrs 32171 } = this; 32172 const child = h("div", mergeProps({ 32173 class: `${mergedClsPrefix}-skeleton`, 32174 style: style2 32175 }, $attrs)); 32176 if (repeatProp > 1) { 32177 return h(Fragment, null, repeat(repeatProp, null).map((_) => [child, "\n"])); 32178 } 32179 return child; 32180 } 32181}); 32182class LuxonError extends Error { 32183} 32184class InvalidDateTimeError extends LuxonError { 32185 constructor(reason) { 32186 super(`Invalid DateTime: ${reason.toMessage()}`); 32187 } 32188} 32189class InvalidIntervalError extends LuxonError { 32190 constructor(reason) { 32191 super(`Invalid Interval: ${reason.toMessage()}`); 32192 } 32193} 32194class InvalidDurationError extends LuxonError { 32195 constructor(reason) { 32196 super(`Invalid Duration: ${reason.toMessage()}`); 32197 } 32198} 32199class ConflictingSpecificationError extends LuxonError { 32200} 32201class InvalidUnitError extends LuxonError { 32202 constructor(unit) { 32203 super(`Invalid unit ${unit}`); 32204 } 32205} 32206class InvalidArgumentError extends LuxonError { 32207} 32208class ZoneIsAbstractError extends LuxonError { 32209 constructor() { 32210 super("Zone is an abstract class"); 32211 } 32212} 32213const n = "numeric", s = "short", l = "long"; 32214const DATE_SHORT = { 32215 year: n, 32216 month: n, 32217 day: n 32218}; 32219const DATE_MED = { 32220 year: n, 32221 month: s, 32222 day: n 32223}; 32224const DATE_MED_WITH_WEEKDAY = { 32225 year: n, 32226 month: s, 32227 day: n, 32228 weekday: s 32229}; 32230const DATE_FULL = { 32231 year: n, 32232 month: l, 32233 day: n 32234}; 32235const DATE_HUGE = { 32236 year: n, 32237 month: l, 32238 day: n, 32239 weekday: l 32240}; 32241const TIME_SIMPLE = { 32242 hour: n, 32243 minute: n 32244}; 32245const TIME_WITH_SECONDS = { 32246 hour: n, 32247 minute: n, 32248 second: n 32249}; 32250const TIME_WITH_SHORT_OFFSET = { 32251 hour: n, 32252 minute: n, 32253 second: n, 32254 timeZoneName: s 32255}; 32256const TIME_WITH_LONG_OFFSET = { 32257 hour: n, 32258 minute: n, 32259 second: n, 32260 timeZoneName: l 32261}; 32262const TIME_24_SIMPLE = { 32263 hour: n, 32264 minute: n, 32265 hourCycle: "h23" 32266}; 32267const TIME_24_WITH_SECONDS = { 32268 hour: n, 32269 minute: n, 32270 second: n, 32271 hourCycle: "h23" 32272}; 32273const TIME_24_WITH_SHORT_OFFSET = { 32274 hour: n, 32275 minute: n, 32276 second: n, 32277 hourCycle: "h23", 32278 timeZoneName: s 32279}; 32280const TIME_24_WITH_LONG_OFFSET = { 32281 hour: n, 32282 minute: n, 32283 second: n, 32284 hourCycle: "h23", 32285 timeZoneName: l 32286}; 32287const DATETIME_SHORT = { 32288 year: n, 32289 month: n, 32290 day: n, 32291 hour: n, 32292 minute: n 32293}; 32294const DATETIME_SHORT_WITH_SECONDS = { 32295 year: n, 32296 month: n, 32297 day: n, 32298 hour: n, 32299 minute: n, 32300 second: n 32301}; 32302const DATETIME_MED = { 32303 year: n, 32304 month: s, 32305 day: n, 32306 hour: n, 32307 minute: n 32308}; 32309const DATETIME_MED_WITH_SECONDS = { 32310 year: n, 32311 month: s, 32312 day: n, 32313 hour: n, 32314 minute: n, 32315 second: n 32316}; 32317const DATETIME_MED_WITH_WEEKDAY = { 32318 year: n, 32319 month: s, 32320 day: n, 32321 weekday: s, 32322 hour: n, 32323 minute: n 32324}; 32325const DATETIME_FULL = { 32326 year: n, 32327 month: l, 32328 day: n, 32329 hour: n, 32330 minute: n, 32331 timeZoneName: s 32332}; 32333const DATETIME_FULL_WITH_SECONDS = { 32334 year: n, 32335 month: l, 32336 day: n, 32337 hour: n, 32338 minute: n, 32339 second: n, 32340 timeZoneName: s 32341}; 32342const DATETIME_HUGE = { 32343 year: n, 32344 month: l, 32345 day: n, 32346 weekday: l, 32347 hour: n, 32348 minute: n, 32349 timeZoneName: l 32350}; 32351const DATETIME_HUGE_WITH_SECONDS = { 32352 year: n, 32353 month: l, 32354 day: n, 32355 weekday: l, 32356 hour: n, 32357 minute: n, 32358 second: n, 32359 timeZoneName: l 32360}; 32361class Zone { 32362 /** 32363 * The type of zone 32364 * @abstract 32365 * @type {string} 32366 */ 32367 get type() { 32368 throw new ZoneIsAbstractError(); 32369 } 32370 /** 32371 * The name of this zone. 32372 * @abstract 32373 * @type {string} 32374 */ 32375 get name() { 32376 throw new ZoneIsAbstractError(); 32377 } 32378 get ianaName() { 32379 return this.name; 32380 } 32381 /** 32382 * Returns whether the offset is known to be fixed for the whole year. 32383 * @abstract 32384 * @type {boolean} 32385 */ 32386 get isUniversal() { 32387 throw new ZoneIsAbstractError(); 32388 } 32389 /** 32390 * Returns the offset's common name (such as EST) at the specified timestamp 32391 * @abstract 32392 * @param {number} ts - Epoch milliseconds for which to get the name 32393 * @param {Object} opts - Options to affect the format 32394 * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. 32395 * @param {string} opts.locale - What locale to return the offset name in. 32396 * @return {string} 32397 */ 32398 offsetName(ts, opts) { 32399 throw new ZoneIsAbstractError(); 32400 } 32401 /** 32402 * Returns the offset's value as a string 32403 * @abstract 32404 * @param {number} ts - Epoch milliseconds for which to get the offset 32405 * @param {string} format - What style of offset to return. 32406 * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively 32407 * @return {string} 32408 */ 32409 formatOffset(ts, format2) { 32410 throw new ZoneIsAbstractError(); 32411 } 32412 /** 32413 * Return the offset in minutes for this zone at the specified timestamp. 32414 * @abstract 32415 * @param {number} ts - Epoch milliseconds for which to compute the offset 32416 * @return {number} 32417 */ 32418 offset(ts) { 32419 throw new ZoneIsAbstractError(); 32420 } 32421 /** 32422 * Return whether this Zone is equal to another zone 32423 * @abstract 32424 * @param {Zone} otherZone - the zone to compare 32425 * @return {boolean} 32426 */ 32427 equals(otherZone) { 32428 throw new ZoneIsAbstractError(); 32429 } 32430 /** 32431 * Return whether this Zone is valid. 32432 * @abstract 32433 * @type {boolean} 32434 */ 32435 get isValid() { 32436 throw new ZoneIsAbstractError(); 32437 } 32438} 32439let singleton$1 = null; 32440class SystemZone extends Zone { 32441 /** 32442 * Get a singleton instance of the local zone 32443 * @return {SystemZone} 32444 */ 32445 static get instance() { 32446 if (singleton$1 === null) { 32447 singleton$1 = new SystemZone(); 32448 } 32449 return singleton$1; 32450 } 32451 /** @override **/ 32452 get type() { 32453 return "system"; 32454 } 32455 /** @override **/ 32456 get name() { 32457 return new Intl.DateTimeFormat().resolvedOptions().timeZone; 32458 } 32459 /** @override **/ 32460 get isUniversal() { 32461 return false;
vendor: 4,878 bytes, lines 32462-32646
32462 } 32463 /** @override **/ 32464 offsetName(ts, { format: format2, locale: locale2 }) { 32465 return parseZoneInfo(ts, format2, locale2); 32466 } 32467 /** @override **/ 32468 formatOffset(ts, format2) { 32469 return formatOffset(this.offset(ts), format2); 32470 } 32471 /** @override **/ 32472 offset(ts) { 32473 return -new Date(ts).getTimezoneOffset(); 32474 } 32475 /** @override **/ 32476 equals(otherZone) { 32477 return otherZone.type === "system"; 32478 } 32479 /** @override **/ 32480 get isValid() { 32481 return true; 32482 } 32483} 32484let dtfCache = {}; 32485function makeDTF(zone) { 32486 if (!dtfCache[zone]) { 32487 dtfCache[zone] = new Intl.DateTimeFormat("en-US", { 32488 hour12: false, 32489 timeZone: zone, 32490 year: "numeric", 32491 month: "2-digit", 32492 day: "2-digit", 32493 hour: "2-digit", 32494 minute: "2-digit", 32495 second: "2-digit", 32496 era: "short" 32497 }); 32498 } 32499 return dtfCache[zone]; 32500} 32501const typeToPos = { 32502 year: 0, 32503 month: 1, 32504 day: 2, 32505 era: 3, 32506 hour: 4, 32507 minute: 5, 32508 second: 6 32509}; 32510function hackyOffset(dtf, date4) { 32511 const formatted = dtf.format(date4).replace(/\u200E/g, ""), parsed = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(formatted), [, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed; 32512 return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond]; 32513} 32514function partsOffset(dtf, date4) { 32515 const formatted = dtf.formatToParts(date4); 32516 const filled = []; 32517 for (let i = 0; i < formatted.length; i++) { 32518 const { type: type4, value } = formatted[i]; 32519 const pos = typeToPos[type4]; 32520 if (type4 === "era") { 32521 filled[pos] = value; 32522 } else if (!isUndefined$1(pos)) { 32523 filled[pos] = parseInt(value, 10); 32524 } 32525 } 32526 return filled; 32527} 32528let ianaZoneCache = {}; 32529class IANAZone extends Zone { 32530 /** 32531 * @param {string} name - Zone name 32532 * @return {IANAZone} 32533 */ 32534 static create(name) { 32535 if (!ianaZoneCache[name]) { 32536 ianaZoneCache[name] = new IANAZone(name); 32537 } 32538 return ianaZoneCache[name]; 32539 } 32540 /** 32541 * Reset local caches. Should only be necessary in testing scenarios. 32542 * @return {void} 32543 */ 32544 static resetCache() { 32545 ianaZoneCache = {}; 32546 dtfCache = {}; 32547 } 32548 /** 32549 * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that. 32550 * @param {string} s - The string to check validity on 32551 * @example IANAZone.isValidSpecifier("America/New_York") //=> true 32552 * @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false 32553 * @deprecated This method returns false for some valid IANA names. Use isValidZone instead. 32554 * @return {boolean} 32555 */ 32556 static isValidSpecifier(s2) { 32557 return this.isValidZone(s2); 32558 } 32559 /** 32560 * Returns whether the provided string identifies a real zone 32561 * @param {string} zone - The string to check 32562 * @example IANAZone.isValidZone("America/New_York") //=> true 32563 * @example IANAZone.isValidZone("Fantasia/Castle") //=> false 32564 * @example IANAZone.isValidZone("Sport~~blorp") //=> false 32565 * @return {boolean} 32566 */ 32567 static isValidZone(zone) { 32568 if (!zone) { 32569 return false; 32570 } 32571 try { 32572 new Intl.DateTimeFormat("en-US", { timeZone: zone }).format(); 32573 return true; 32574 } catch (e) { 32575 return false; 32576 } 32577 } 32578 constructor(name) { 32579 super(); 32580 this.zoneName = name; 32581 this.valid = IANAZone.isValidZone(name); 32582 } 32583 /** @override **/ 32584 get type() { 32585 return "iana"; 32586 } 32587 /** @override **/ 32588 get name() { 32589 return this.zoneName; 32590 } 32591 /** @override **/ 32592 get isUniversal() { 32593 return false; 32594 } 32595 /** @override **/ 32596 offsetName(ts, { format: format2, locale: locale2 }) { 32597 return parseZoneInfo(ts, format2, locale2, this.name); 32598 } 32599 /** @override **/ 32600 formatOffset(ts, format2) { 32601 return formatOffset(this.offset(ts), format2); 32602 } 32603 /** @override **/ 32604 offset(ts) { 32605 const date4 = new Date(ts); 32606 if (isNaN(date4)) 32607 return NaN; 32608 const dtf = makeDTF(this.name); 32609 let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts ? partsOffset(dtf, date4) : hackyOffset(dtf, date4); 32610 if (adOrBc === "BC") { 32611 year = -Math.abs(year) + 1; 32612 } 32613 const adjustedHour = hour === 24 ? 0 : hour; 32614 const asUTC = objToLocalTS({ 32615 year, 32616 month, 32617 day, 32618 hour: adjustedHour, 32619 minute, 32620 second, 32621 millisecond: 0 32622 }); 32623 let asTS = +date4; 32624 const over = asTS % 1e3; 32625 asTS -= over >= 0 ? over : 1e3 + over; 32626 return (asUTC - asTS) / (60 * 1e3); 32627 } 32628 /** @override **/ 32629 equals(otherZone) { 32630 return otherZone.type === "iana" && otherZone.name === this.name; 32631 } 32632 /** @override **/ 32633 get isValid() { 32634 return this.valid; 32635 } 32636} 32637let intlLFCache = {}; 32638function getCachedLF(locString, opts = {}) { 32639 const key = JSON.stringify([locString, opts]); 32640 let dtf = intlLFCache[key]; 32641 if (!dtf) { 32642 dtf = new Intl.ListFormat(locString, opts); 32643 intlLFCache[key] = dtf; 32644 } 32645 return dtf; 32646}
vendor: 5,413 bytes, lines 32647-32833
32647let intlDTCache = {}; 32648function getCachedDTF(locString, opts = {}) { 32649 const key = JSON.stringify([locString, opts]); 32650 let dtf = intlDTCache[key]; 32651 if (!dtf) { 32652 dtf = new Intl.DateTimeFormat(locString, opts); 32653 intlDTCache[key] = dtf; 32654 } 32655 return dtf; 32656} 32657let intlNumCache = {}; 32658function getCachedINF(locString, opts = {}) { 32659 const key = JSON.stringify([locString, opts]); 32660 let inf = intlNumCache[key]; 32661 if (!inf) { 32662 inf = new Intl.NumberFormat(locString, opts); 32663 intlNumCache[key] = inf; 32664 } 32665 return inf; 32666} 32667let intlRelCache = {}; 32668function getCachedRTF(locString, opts = {}) { 32669 const { base: base2, ...cacheKeyOpts } = opts; 32670 const key = JSON.stringify([locString, cacheKeyOpts]); 32671 let inf = intlRelCache[key]; 32672 if (!inf) { 32673 inf = new Intl.RelativeTimeFormat(locString, opts); 32674 intlRelCache[key] = inf; 32675 } 32676 return inf; 32677} 32678let sysLocaleCache = null; 32679function systemLocale() { 32680 if (sysLocaleCache) { 32681 return sysLocaleCache; 32682 } else { 32683 sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale; 32684 return sysLocaleCache; 32685 } 32686} 32687function parseLocaleString(localeStr) { 32688 const xIndex = localeStr.indexOf("-x-"); 32689 if (xIndex !== -1) { 32690 localeStr = localeStr.substring(0, xIndex); 32691 } 32692 const uIndex = localeStr.indexOf("-u-"); 32693 if (uIndex === -1) { 32694 return [localeStr]; 32695 } else { 32696 let options; 32697 let selectedStr; 32698 try { 32699 options = getCachedDTF(localeStr).resolvedOptions(); 32700 selectedStr = localeStr; 32701 } catch (e) { 32702 const smaller = localeStr.substring(0, uIndex); 32703 options = getCachedDTF(smaller).resolvedOptions(); 32704 selectedStr = smaller; 32705 } 32706 const { numberingSystem, calendar } = options; 32707 return [selectedStr, numberingSystem, calendar]; 32708 } 32709} 32710function intlConfigString(localeStr, numberingSystem, outputCalendar) { 32711 if (outputCalendar || numberingSystem) { 32712 if (!localeStr.includes("-u-")) { 32713 localeStr += "-u"; 32714 } 32715 if (outputCalendar) { 32716 localeStr += `-ca-${outputCalendar}`; 32717 } 32718 if (numberingSystem) { 32719 localeStr += `-nu-${numberingSystem}`; 32720 } 32721 return localeStr; 32722 } else { 32723 return localeStr; 32724 } 32725} 32726function mapMonths(f) { 32727 const ms = []; 32728 for (let i = 1; i <= 12; i++) { 32729 const dt = DateTime.utc(2016, i, 1); 32730 ms.push(f(dt)); 32731 } 32732 return ms; 32733} 32734function mapWeekdays(f) { 32735 const ms = []; 32736 for (let i = 1; i <= 7; i++) { 32737 const dt = DateTime.utc(2016, 11, 13 + i); 32738 ms.push(f(dt)); 32739 } 32740 return ms; 32741} 32742function listStuff(loc, length, defaultOK, englishFn, intlFn) { 32743 const mode = loc.listingMode(defaultOK); 32744 if (mode === "error") { 32745 return null; 32746 } else if (mode === "en") { 32747 return englishFn(length); 32748 } else { 32749 return intlFn(length); 32750 } 32751} 32752function supportsFastNumbers(loc) { 32753 if (loc.numberingSystem && loc.numberingSystem !== "latn") { 32754 return false; 32755 } else { 32756 return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === "latn"; 32757 } 32758} 32759class PolyNumberFormatter { 32760 constructor(intl, forceSimple, opts) { 32761 this.padTo = opts.padTo || 0; 32762 this.floor = opts.floor || false; 32763 const { padTo, floor, ...otherOpts } = opts; 32764 if (!forceSimple || Object.keys(otherOpts).length > 0) { 32765 const intlOpts = { useGrouping: false, ...opts }; 32766 if (opts.padTo > 0) 32767 intlOpts.minimumIntegerDigits = opts.padTo; 32768 this.inf = getCachedINF(intl, intlOpts); 32769 } 32770 } 32771 format(i) { 32772 if (this.inf) { 32773 const fixed = this.floor ? Math.floor(i) : i; 32774 return this.inf.format(fixed); 32775 } else { 32776 const fixed = this.floor ? Math.floor(i) : roundTo(i, 3); 32777 return padStart(fixed, this.padTo); 32778 } 32779 } 32780} 32781class PolyDateFormatter { 32782 constructor(dt, intl, opts) { 32783 this.opts = opts; 32784 this.originalZone = void 0; 32785 let z = void 0; 32786 if (this.opts.timeZone) { 32787 this.dt = dt; 32788 } else if (dt.zone.type === "fixed") { 32789 const gmtOffset = -1 * (dt.offset / 60); 32790 const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`; 32791 if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) { 32792 z = offsetZ; 32793 this.dt = dt; 32794 } else { 32795 z = "UTC"; 32796 this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({ minutes: dt.offset }); 32797 this.originalZone = dt.zone; 32798 } 32799 } else if (dt.zone.type === "system") { 32800 this.dt = dt; 32801 } else if (dt.zone.type === "iana") { 32802 this.dt = dt; 32803 z = dt.zone.name; 32804 } else { 32805 z = "UTC"; 32806 this.dt = dt.setZone("UTC").plus({ minutes: dt.offset }); 32807 this.originalZone = dt.zone; 32808 } 32809 const intlOpts = { ...this.opts }; 32810 intlOpts.timeZone = intlOpts.timeZone || z; 32811 this.dtf = getCachedDTF(intl, intlOpts); 32812 } 32813 format() { 32814 if (this.originalZone) { 32815 return this.formatToParts().map(({ value }) => value).join(""); 32816 } 32817 return this.dtf.format(this.dt.toJSDate()); 32818 } 32819 formatToParts() { 32820 const parts = this.dtf.formatToParts(this.dt.toJSDate()); 32821 if (this.originalZone) { 32822 return parts.map((part) => { 32823 if (part.type === "timeZoneName") { 32824 const offsetName = this.originalZone.offsetName(this.dt.ts, { 32825 locale: this.dt.locale, 32826 format: this.opts.timeZoneName 32827 }); 32828 return { 32829 ...part, 32830 value: offsetName 32831 }; 32832 } else { 32833 return part;
32834 } 32835 }); 32836 } 32837 return parts; 32838 } 32839 resolvedOptions() { 32840 return this.dtf.resolvedOptions(); 32841 } 32842} 32843class PolyRelFormatter { 32844 constructor(intl, isEnglish, opts) { 32845 this.opts = { style: "long", ...opts }; 32846 if (!isEnglish && hasRelative()) { 32847 this.rtf = getCachedRTF(intl, opts); 32848 } 32849 } 32850 format(count, unit) { 32851 if (this.rtf) { 32852 return this.rtf.format(count, unit); 32853 } else { 32854 return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long"); 32855 } 32856 } 32857 formatToParts(count, unit) { 32858 if (this.rtf) { 32859 return this.rtf.formatToParts(count, unit); 32860 } else { 32861 return []; 32862 } 32863 } 32864} 32865class Locale { 32866 static fromOpts(opts) { 32867 return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN); 32868 } 32869 static create(locale2, numberingSystem, outputCalendar, defaultToEN = false) { 32870 const specifiedLocale = locale2 || Settings.defaultLocale; 32871 const localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()); 32872 const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem; 32873 const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar; 32874 return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale); 32875 } 32876 static resetCache() { 32877 sysLocaleCache = null; 32878 intlDTCache = {}; 32879 intlNumCache = {}; 32880 intlRelCache = {}; 32881 } 32882 static fromObject({ locale: locale2, numberingSystem, outputCalendar } = {}) { 32883 return Locale.create(locale2, numberingSystem, outputCalendar); 32884 } 32885 constructor(locale2, numbering, outputCalendar, specifiedLocale) { 32886 const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale2); 32887 this.locale = parsedLocale; 32888 this.numberingSystem = numbering || parsedNumberingSystem || null; 32889 this.outputCalendar = outputCalendar || parsedOutputCalendar || null; 32890 this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar); 32891 this.weekdaysCache = { format: {}, standalone: {} }; 32892 this.monthsCache = { format: {}, standalone: {} }; 32893 this.meridiemCache = null; 32894 this.eraCache = {}; 32895 this.specifiedLocale = specifiedLocale; 32896 this.fastNumbersCached = null; 32897 } 32898 get fastNumbers() { 32899 if (this.fastNumbersCached == null) { 32900 this.fastNumbersCached = supportsFastNumbers(this); 32901 } 32902 return this.fastNumbersCached; 32903 } 32904 listingMode() { 32905 const isActuallyEn = this.isEnglish(); 32906 const hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory"); 32907 return isActuallyEn && hasNoWeirdness ? "en" : "intl"; 32908 } 32909 clone(alts) { 32910 if (!alts || Object.getOwnPropertyNames(alts).length === 0) { 32911 return this; 32912 } else { 32913 return Locale.create( 32914 alts.locale || this.specifiedLocale, 32915 alts.numberingSystem || this.numberingSystem, 32916 alts.outputCalendar || this.outputCalendar, 32917 alts.defaultToEN || false 32918 ); 32919 } 32920 } 32921 redefaultToEN(alts = {}) { 32922 return this.clone({ ...alts, defaultToEN: true }); 32923 } 32924 redefaultToSystem(alts = {}) { 32925 return this.clone({ ...alts, defaultToEN: false }); 32926 } 32927 months(length, format2 = false, defaultOK = true) { 32928 return listStuff(this, length, defaultOK, months, () => { 32929 const intl = format2 ? { month: length, day: "numeric" } : { month: length }, formatStr = format2 ? "format" : "standalone"; 32930 if (!this.monthsCache[formatStr][length]) { 32931 this.monthsCache[formatStr][length] = mapMonths((dt) => this.extract(dt, intl, "month")); 32932 } 32933 return this.monthsCache[formatStr][length]; 32934 }); 32935 } 32936 weekdays(length, format2 = false, defaultOK = true) { 32937 return listStuff(this, length, defaultOK, weekdays, () => { 32938 const intl = format2 ? { weekday: length, year: "numeric", month: "long", day: "numeric" } : { weekday: length }, formatStr = format2 ? "format" : "standalone"; 32939 if (!this.weekdaysCache[formatStr][length]) { 32940 this.weekdaysCache[formatStr][length] = mapWeekdays( 32941 (dt) => this.extract(dt, intl, "weekday") 32942 ); 32943 } 32944 return this.weekdaysCache[formatStr][length]; 32945 }); 32946 } 32947 meridiems(defaultOK = true) { 32948 return listStuff( 32949 this, 32950 void 0, 32951 defaultOK, 32952 () => meridiems, 32953 () => { 32954 if (!this.meridiemCache) { 32955 const intl = { hour: "numeric", hourCycle: "h12" }; 32956 this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map( 32957 (dt) => this.extract(dt, intl, "dayperiod") 32958 ); 32959 } 32960 return this.meridiemCache; 32961 } 32962 ); 32963 } 32964 eras(length, defaultOK = true) { 32965 return listStuff(this, length, defaultOK, eras, () => { 32966 const intl = { era: length }; 32967 if (!this.eraCache[length]) { 32968 this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map( 32969 (dt) => this.extract(dt, intl, "era") 32970 ); 32971 } 32972 return this.eraCache[length]; 32973 }); 32974 } 32975 extract(dt, intlOpts, field) { 32976 const df = this.dtFormatter(dt, intlOpts), results = df.formatToParts(), matching = results.find((m) => m.type.toLowerCase() === field); 32977 return matching ? matching.value : null; 32978 } 32979 numberFormatter(opts = {}) { 32980 return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts); 32981 } 32982 dtFormatter(dt, intlOpts = {}) { 32983 return new PolyDateFormatter(dt, this.intl, intlOpts); 32984 } 32985 relFormatter(opts = {}) { 32986 return new PolyRelFormatter(this.intl, this.isEnglish(), opts); 32987 } 32988 listFormatter(opts = {}) { 32989 return getCachedLF(this.intl, opts); 32990 } 32991 isEnglish() { 32992 return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us"); 32993 } 32994 equals(other) { 32995 return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar; 32996 } 32997} 32998let singleton = null; 32999class FixedOffsetZone extends Zone { 33000 /** 33001 * Get a singleton instance of UTC 33002 * @return {FixedOffsetZone} 33003 */ 33004 static get utcInstance() { 33005 if (singleton === null) { 33006 singleton = new FixedOffsetZone(0); 33007 } 33008 return singleton; 33009 } 33010 /** 33011 * Get an instance with a specified offset 33012 * @param {number} offset - The offset in minutes 33013 * @return {FixedOffsetZone} 33014 */ 33015 static instance(offset2) { 33016 return offset2 === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset2); 33017 } 33018 /** 33019 * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6" 33020 * @param {string} s - The offset string to parse 33021 * @example FixedOffsetZone.parseSpecifier("UTC+6") 33022 * @example FixedOffsetZone.parseSpecifier("UTC+06") 33023 * @example FixedOffsetZone.parseSpecifier("UTC-6:00") 33024 * @return {FixedOffsetZone} 33025 */ 33026 static parseSpecifier(s2) { 33027 if (s2) { 33028 const r = s2.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i); 33029 if (r) { 33030 return new FixedOffsetZone(signedOffset(r[1], r[2])); 33031 } 33032 } 33033 return null; 33034 } 33035 constructor(offset2) { 33036 super(); 33037 this.fixed = offset2; 33038 } 33039 /** @override **/ 33040 get type() { 33041 return "fixed"; 33042 } 33043 /** @override **/ 33044 get name() { 33045 return this.fixed === 0 ? "UTC" : `UTC${formatOffset(this.fixed, "narrow")}`; 33046 } 33047 get ianaName() { 33048 if (this.fixed === 0) {
vendor: 4,278 bytes, lines 33049-33206
33049 return "Etc/UTC"; 33050 } else { 33051 return `Etc/GMT${formatOffset(-this.fixed, "narrow")}`; 33052 } 33053 } 33054 /** @override **/ 33055 offsetName() { 33056 return this.name; 33057 } 33058 /** @override **/ 33059 formatOffset(ts, format2) { 33060 return formatOffset(this.fixed, format2); 33061 } 33062 /** @override **/ 33063 get isUniversal() { 33064 return true; 33065 } 33066 /** @override **/ 33067 offset() { 33068 return this.fixed; 33069 } 33070 /** @override **/ 33071 equals(otherZone) { 33072 return otherZone.type === "fixed" && otherZone.fixed === this.fixed; 33073 } 33074 /** @override **/ 33075 get isValid() { 33076 return true; 33077 } 33078} 33079class InvalidZone extends Zone { 33080 constructor(zoneName) { 33081 super(); 33082 this.zoneName = zoneName; 33083 } 33084 /** @override **/ 33085 get type() { 33086 return "invalid"; 33087 } 33088 /** @override **/ 33089 get name() { 33090 return this.zoneName; 33091 } 33092 /** @override **/ 33093 get isUniversal() { 33094 return false; 33095 } 33096 /** @override **/ 33097 offsetName() { 33098 return null; 33099 } 33100 /** @override **/ 33101 formatOffset() { 33102 return ""; 33103 } 33104 /** @override **/ 33105 offset() { 33106 return NaN; 33107 } 33108 /** @override **/ 33109 equals() { 33110 return false; 33111 } 33112 /** @override **/ 33113 get isValid() { 33114 return false; 33115 } 33116} 33117function normalizeZone(input, defaultZone2) { 33118 if (isUndefined$1(input) || input === null) { 33119 return defaultZone2; 33120 } else if (input instanceof Zone) { 33121 return input; 33122 } else if (isString$2(input)) { 33123 const lowered = input.toLowerCase(); 33124 if (lowered === "default") 33125 return defaultZone2; 33126 else if (lowered === "local" || lowered === "system") 33127 return SystemZone.instance; 33128 else if (lowered === "utc" || lowered === "gmt") 33129 return FixedOffsetZone.utcInstance; 33130 else 33131 return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input); 33132 } else if (isNumber$1(input)) { 33133 return FixedOffsetZone.instance(input); 33134 } else if (typeof input === "object" && input.offset && typeof input.offset === "number") { 33135 return input; 33136 } else { 33137 return new InvalidZone(input); 33138 } 33139} 33140let now = () => Date.now(), defaultZone = "system", defaultLocale = null, defaultNumberingSystem = null, defaultOutputCalendar = null, twoDigitCutoffYear = 60, throwOnInvalid; 33141class Settings { 33142 /** 33143 * Get the callback for returning the current timestamp. 33144 * @type {function} 33145 */ 33146 static get now() { 33147 return now; 33148 } 33149 /** 33150 * Set the callback for returning the current timestamp. 33151 * The function should return a number, which will be interpreted as an Epoch millisecond count 33152 * @type {function} 33153 * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future 33154 * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time 33155 */ 33156 static set now(n2) { 33157 now = n2; 33158 } 33159 /** 33160 * Set the default time zone to create DateTimes in. Does not affect existing instances. 33161 * Use the value "system" to reset this value to the system's time zone. 33162 * @type {string} 33163 */ 33164 static set defaultZone(zone) { 33165 defaultZone = zone; 33166 } 33167 /** 33168 * Get the default time zone object currently used to create DateTimes. Does not affect existing instances. 33169 * The default value is the system's time zone (the one set on the machine that runs this code). 33170 * @type {Zone} 33171 */ 33172 static get defaultZone() { 33173 return normalizeZone(defaultZone, SystemZone.instance); 33174 } 33175 /** 33176 * Get the default locale to create DateTimes with. Does not affect existing instances. 33177 * @type {string} 33178 */ 33179 static get defaultLocale() { 33180 return defaultLocale; 33181 } 33182 /** 33183 * Set the default locale to create DateTimes with. Does not affect existing instances. 33184 * @type {string} 33185 */ 33186 static set defaultLocale(locale2) { 33187 defaultLocale = locale2; 33188 } 33189 /** 33190 * Get the default numbering system to create DateTimes with. Does not affect existing instances. 33191 * @type {string} 33192 */ 33193 static get defaultNumberingSystem() { 33194 return defaultNumberingSystem; 33195 } 33196 /** 33197 * Set the default numbering system to create DateTimes with. Does not affect existing instances. 33198 * @type {string} 33199 */ 33200 static set defaultNumberingSystem(numberingSystem) { 33201 defaultNumberingSystem = numberingSystem; 33202 } 33203 /** 33204 * Get the default output calendar to create DateTimes with. Does not affect existing instances. 33205 * @type {string} 33206 */
33207 static get defaultOutputCalendar() { 33208 return defaultOutputCalendar; 33209 } 33210 /** 33211 * Set the default output calendar to create DateTimes with. Does not affect existing instances. 33212 * @type {string} 33213 */ 33214 static set defaultOutputCalendar(outputCalendar) { 33215 defaultOutputCalendar = outputCalendar; 33216 } 33217 /** 33218 * Get the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century. 33219 * @type {number} 33220 */ 33221 static get twoDigitCutoffYear() { 33222 return twoDigitCutoffYear; 33223 } 33224 /** 33225 * Set the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century. 33226 * @type {number} 33227 * @example Settings.twoDigitCutoffYear = 0 // cut-off year is 0, so all 'yy' are interpretted as current century 33228 * @example Settings.twoDigitCutoffYear = 50 // '49' -> 1949; '50' -> 2050 33229 * @example Settings.twoDigitCutoffYear = 1950 // interpretted as 50 33230 * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpretted as 50 33231 */ 33232 static set twoDigitCutoffYear(cutoffYear) { 33233 twoDigitCutoffYear = cutoffYear % 100; 33234 } 33235 /** 33236 * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals 33237 * @type {boolean} 33238 */ 33239 static get throwOnInvalid() { 33240 return throwOnInvalid; 33241 } 33242 /** 33243 * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals 33244 * @type {boolean} 33245 */ 33246 static set throwOnInvalid(t) { 33247 throwOnInvalid = t; 33248 } 33249 /** 33250 * Reset Luxon's global caches. Should only be necessary in testing scenarios. 33251 * @return {void} 33252 */ 33253 static resetCaches() { 33254 Locale.resetCache(); 33255 IANAZone.resetCache(); 33256 } 33257} 33258function isUndefined$1(o) { 33259 return typeof o === "undefined"; 33260} 33261function isNumber$1(o) { 33262 return typeof o === "number"; 33263} 33264function isInteger(o) { 33265 return typeof o === "number" && o % 1 === 0; 33266} 33267function isString$2(o) { 33268 return typeof o === "string"; 33269} 33270function isDate$1(o) { 33271 return Object.prototype.toString.call(o) === "[object Date]"; 33272} 33273function hasRelative() { 33274 try { 33275 return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat; 33276 } catch (e) { 33277 return false; 33278 } 33279} 33280function maybeArray(thing) { 33281 return Array.isArray(thing) ? thing : [thing]; 33282} 33283function bestBy(arr, by, compare) { 33284 if (arr.length === 0) { 33285 return void 0; 33286 } 33287 return arr.reduce((best, next) => { 33288 const pair = [by(next), next]; 33289 if (!best) { 33290 return pair; 33291 } else if (compare(best[0], pair[0]) === best[0]) { 33292 return best; 33293 } else { 33294 return pair; 33295 } 33296 }, null)[1]; 33297} 33298function pick(obj, keys2) { 33299 return keys2.reduce((a, k) => { 33300 a[k] = obj[k]; 33301 return a; 33302 }, {}); 33303} 33304function hasOwnProperty(obj, prop) { 33305 return Object.prototype.hasOwnProperty.call(obj, prop); 33306} 33307function integerBetween(thing, bottom, top) { 33308 return isInteger(thing) && thing >= bottom && thing <= top; 33309} 33310function floorMod(x, n2) { 33311 return x - n2 * Math.floor(x / n2); 33312} 33313function padStart(input, n2 = 2) { 33314 const isNeg = input < 0; 33315 let padded; 33316 if (isNeg) { 33317 padded = "-" + ("" + -input).padStart(n2, "0"); 33318 } else { 33319 padded = ("" + input).padStart(n2, "0"); 33320 } 33321 return padded; 33322} 33323function parseInteger(string3) { 33324 if (isUndefined$1(string3) || string3 === null || string3 === "") { 33325 return void 0; 33326 } else { 33327 return parseInt(string3, 10); 33328 } 33329} 33330function parseFloating(string3) { 33331 if (isUndefined$1(string3) || string3 === null || string3 === "") { 33332 return void 0; 33333 } else { 33334 return parseFloat(string3); 33335 } 33336} 33337function parseMillis(fraction) { 33338 if (isUndefined$1(fraction) || fraction === null || fraction === "") { 33339 return void 0; 33340 } else { 33341 const f = parseFloat("0." + fraction) * 1e3; 33342 return Math.floor(f); 33343 } 33344} 33345function roundTo(number4, digits, towardZero = false) { 33346 const factor = 10 ** digits, rounder = towardZero ? Math.trunc : Math.round; 33347 return rounder(number4 * factor) / factor; 33348} 33349function isLeapYear(year) { 33350 return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); 33351} 33352function daysInYear(year) { 33353 return isLeapYear(year) ? 366 : 365; 33354} 33355function daysInMonth(year, month) { 33356 const modMonth = floorMod(month - 1, 12) + 1, modYear = year + (month - modMonth) / 12; 33357 if (modMonth === 2) { 33358 return isLeapYear(modYear) ? 29 : 28; 33359 } else { 33360 return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1]; 33361 } 33362} 33363function objToLocalTS(obj) { 33364 let d = Date.UTC( 33365 obj.year, 33366 obj.month - 1, 33367 obj.day, 33368 obj.hour, 33369 obj.minute, 33370 obj.second, 33371 obj.millisecond 33372 ); 33373 if (obj.year < 100 && obj.year >= 0) { 33374 d = new Date(d); 33375 d.setUTCFullYear(obj.year, obj.month - 1, obj.day); 33376 } 33377 return +d; 33378} 33379function weeksInWeekYear(weekYear) { 33380 const p1 = (weekYear + Math.floor(weekYear / 4) - Math.floor(weekYear / 100) + Math.floor(weekYear / 400)) % 7, last = weekYear - 1, p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7; 33381 return p1 === 4 || p2 === 3 ? 53 : 52; 33382} 33383function untruncateYear(year) { 33384 if (year > 99) { 33385 return year; 33386 } else 33387 return year > Settings.twoDigitCutoffYear ? 1900 + year : 2e3 + year; 33388} 33389function parseZoneInfo(ts, offsetFormat, locale2, timeZone = null) { 33390 const date4 = new Date(ts), intlOpts = { 33391 hourCycle: "h23", 33392 year: "numeric", 33393 month: "2-digit", 33394 day: "2-digit", 33395 hour: "2-digit", 33396 minute: "2-digit" 33397 }; 33398 if (timeZone) { 33399 intlOpts.timeZone = timeZone; 33400 } 33401 const modified = { timeZoneName: offsetFormat, ...intlOpts }; 33402 const parsed = new Intl.DateTimeFormat(locale2, modified).formatToParts(date4).find((m) => m.type.toLowerCase() === "timezonename"); 33403 return parsed ? parsed.value : null; 33404} 33405function signedOffset(offHourStr, offMinuteStr) { 33406 let offHour = parseInt(offHourStr, 10); 33407 if (Number.isNaN(offHour)) { 33408 offHour = 0; 33409 } 33410 const offMin = parseInt(offMinuteStr, 10) || 0, offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin; 33411 return offHour * 60 + offMinSigned; 33412} 33413function asNumber(value) { 33414 const numericValue = Number(value); 33415 if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue)) 33416 throw new InvalidArgumentError(`Invalid unit value ${value}`); 33417 return numericValue; 33418} 33419function normalizeObject(obj, normalizer) { 33420 const normalized = {}; 33421 for (const u in obj) { 33422 if (hasOwnProperty(obj, u)) { 33423 const v = obj[u]; 33424 if (v === void 0 || v === null) 33425 continue; 33426 normalized[normalizer(u)] = asNumber(v); 33427 } 33428 } 33429 return normalized; 33430} 33431function formatOffset(offset2, format2) { 33432 const hours = Math.trunc(Math.abs(offset2 / 60)), minutes = Math.trunc(Math.abs(offset2 % 60)), sign = offset2 >= 0 ? "+" : "-"; 33433 switch (format2) { 33434 case "short": 33435 return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`; 33436 case "narrow": 33437 return `${sign}${hours}${minutes > 0 ? `:${minutes}` : ""}`; 33438 case "techie": 33439 return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`; 33440 default: 33441 throw new RangeError(`Value format ${format2} is out of range for property format`); 33442 } 33443} 33444function timeObject(obj) { 33445 return pick(obj, ["hour", "minute", "second", "millisecond"]); 33446} 33447const monthsLong = [ 33448 "January", 33449 "February", 33450 "March", 33451 "April", 33452 "May", 33453 "June", 33454 "July", 33455 "August", 33456 "September", 33457 "October", 33458 "November", 33459 "December" 33460]; 33461const monthsShort = [ 33462 "Jan", 33463 "Feb", 33464 "Mar", 33465 "Apr", 33466 "May", 33467 "Jun", 33468 "Jul", 33469 "Aug", 33470 "Sep", 33471 "Oct", 33472 "Nov", 33473 "Dec" 33474];
vendor: 4,922 bytes, lines 33475-33646
33475const monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]; 33476function months(length) { 33477 switch (length) { 33478 case "narrow": 33479 return [...monthsNarrow]; 33480 case "short": 33481 return [...monthsShort]; 33482 case "long": 33483 return [...monthsLong]; 33484 case "numeric": 33485 return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; 33486 case "2-digit": 33487 return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; 33488 default: 33489 return null; 33490 } 33491} 33492const weekdaysLong = [ 33493 "Monday", 33494 "Tuesday", 33495 "Wednesday", 33496 "Thursday", 33497 "Friday", 33498 "Saturday", 33499 "Sunday" 33500]; 33501const weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; 33502const weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"]; 33503function weekdays(length) { 33504 switch (length) { 33505 case "narrow": 33506 return [...weekdaysNarrow]; 33507 case "short": 33508 return [...weekdaysShort]; 33509 case "long": 33510 return [...weekdaysLong]; 33511 case "numeric": 33512 return ["1", "2", "3", "4", "5", "6", "7"]; 33513 default: 33514 return null; 33515 } 33516} 33517const meridiems = ["AM", "PM"]; 33518const erasLong = ["Before Christ", "Anno Domini"]; 33519const erasShort = ["BC", "AD"]; 33520const erasNarrow = ["B", "A"]; 33521function eras(length) { 33522 switch (length) { 33523 case "narrow": 33524 return [...erasNarrow]; 33525 case "short": 33526 return [...erasShort]; 33527 case "long": 33528 return [...erasLong]; 33529 default: 33530 return null; 33531 } 33532} 33533function meridiemForDateTime(dt) { 33534 return meridiems[dt.hour < 12 ? 0 : 1]; 33535} 33536function weekdayForDateTime(dt, length) { 33537 return weekdays(length)[dt.weekday - 1]; 33538} 33539function monthForDateTime(dt, length) { 33540 return months(length)[dt.month - 1]; 33541} 33542function eraForDateTime(dt, length) { 33543 return eras(length)[dt.year < 0 ? 0 : 1]; 33544} 33545function formatRelativeTime(unit, count, numeric = "always", narrow = false) { 33546 const units = { 33547 years: ["year", "yr."], 33548 quarters: ["quarter", "qtr."], 33549 months: ["month", "mo."], 33550 weeks: ["week", "wk."], 33551 days: ["day", "day", "days"], 33552 hours: ["hour", "hr."], 33553 minutes: ["minute", "min."], 33554 seconds: ["second", "sec."] 33555 }; 33556 const lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1; 33557 if (numeric === "auto" && lastable) { 33558 const isDay = unit === "days"; 33559 switch (count) { 33560 case 1: 33561 return isDay ? "tomorrow" : `next ${units[unit][0]}`; 33562 case -1: 33563 return isDay ? "yesterday" : `last ${units[unit][0]}`; 33564 case 0: 33565 return isDay ? "today" : `this ${units[unit][0]}`; 33566 } 33567 } 33568 const isInPast = Object.is(count, -0) || count < 0, fmtValue = Math.abs(count), singular = fmtValue === 1, lilUnits = units[unit], fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit; 33569 return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`; 33570} 33571function stringifyTokens(splits, tokenToString) { 33572 let s2 = ""; 33573 for (const token of splits) { 33574 if (token.literal) { 33575 s2 += token.val; 33576 } else { 33577 s2 += tokenToString(token.val); 33578 } 33579 } 33580 return s2; 33581} 33582const macroTokenToFormatOpts = { 33583 D: DATE_SHORT, 33584 DD: DATE_MED, 33585 DDD: DATE_FULL, 33586 DDDD: DATE_HUGE, 33587 t: TIME_SIMPLE, 33588 tt: TIME_WITH_SECONDS, 33589 ttt: TIME_WITH_SHORT_OFFSET, 33590 tttt: TIME_WITH_LONG_OFFSET, 33591 T: TIME_24_SIMPLE, 33592 TT: TIME_24_WITH_SECONDS, 33593 TTT: TIME_24_WITH_SHORT_OFFSET, 33594 TTTT: TIME_24_WITH_LONG_OFFSET, 33595 f: DATETIME_SHORT, 33596 ff: DATETIME_MED, 33597 fff: DATETIME_FULL, 33598 ffff: DATETIME_HUGE, 33599 F: DATETIME_SHORT_WITH_SECONDS, 33600 FF: DATETIME_MED_WITH_SECONDS, 33601 FFF: DATETIME_FULL_WITH_SECONDS, 33602 FFFF: DATETIME_HUGE_WITH_SECONDS 33603}; 33604class Formatter { 33605 static create(locale2, opts = {}) { 33606 return new Formatter(locale2, opts); 33607 } 33608 static parseFormat(fmt) { 33609 let current = null, currentFull = "", bracketed = false; 33610 const splits = []; 33611 for (let i = 0; i < fmt.length; i++) { 33612 const c2 = fmt.charAt(i); 33613 if (c2 === "'") { 33614 if (currentFull.length > 0) { 33615 splits.push({ literal: bracketed || /^\s+$/.test(currentFull), val: currentFull }); 33616 } 33617 current = null; 33618 currentFull = ""; 33619 bracketed = !bracketed; 33620 } else if (bracketed) { 33621 currentFull += c2; 33622 } else if (c2 === current) { 33623 currentFull += c2; 33624 } else { 33625 if (currentFull.length > 0) { 33626 splits.push({ literal: /^\s+$/.test(currentFull), val: currentFull }); 33627 } 33628 currentFull = c2; 33629 current = c2; 33630 } 33631 } 33632 if (currentFull.length > 0) { 33633 splits.push({ literal: bracketed || /^\s+$/.test(currentFull), val: currentFull }); 33634 } 33635 return splits; 33636 } 33637 static macroTokenToFormatOpts(token) { 33638 return macroTokenToFormatOpts[token]; 33639 } 33640 constructor(locale2, formatOpts) { 33641 this.opts = formatOpts; 33642 this.loc = locale2; 33643 this.systemLoc = null; 33644 } 33645 formatWithSystemDefault(dt, opts) { 33646 if (this.systemLoc === null) {
vendor: 8,965 bytes, lines 33647-33894
33647 this.systemLoc = this.loc.redefaultToSystem(); 33648 } 33649 const df = this.systemLoc.dtFormatter(dt, { ...this.opts, ...opts }); 33650 return df.format(); 33651 } 33652 formatDateTime(dt, opts = {}) { 33653 const df = this.loc.dtFormatter(dt, { ...this.opts, ...opts }); 33654 return df.format(); 33655 } 33656 formatDateTimeParts(dt, opts = {}) { 33657 const df = this.loc.dtFormatter(dt, { ...this.opts, ...opts }); 33658 return df.formatToParts(); 33659 } 33660 formatInterval(interval, opts = {}) { 33661 const df = this.loc.dtFormatter(interval.start, { ...this.opts, ...opts }); 33662 return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate()); 33663 } 33664 resolvedOptions(dt, opts = {}) { 33665 const df = this.loc.dtFormatter(dt, { ...this.opts, ...opts }); 33666 return df.resolvedOptions(); 33667 } 33668 num(n2, p2 = 0) { 33669 if (this.opts.forceSimple) { 33670 return padStart(n2, p2); 33671 } 33672 const opts = { ...this.opts }; 33673 if (p2 > 0) { 33674 opts.padTo = p2; 33675 } 33676 return this.loc.numberFormatter(opts).format(n2); 33677 } 33678 formatDateTimeFromString(dt, fmt) { 33679 const knownEnglish = this.loc.listingMode() === "en", useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", string3 = (opts, extract) => this.loc.extract(dt, opts, extract), formatOffset2 = (opts) => { 33680 if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) { 33681 return "Z"; 33682 } 33683 return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : ""; 33684 }, meridiem = () => knownEnglish ? meridiemForDateTime(dt) : string3({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), month = (length, standalone) => knownEnglish ? monthForDateTime(dt, length) : string3(standalone ? { month: length } : { month: length, day: "numeric" }, "month"), weekday = (length, standalone) => knownEnglish ? weekdayForDateTime(dt, length) : string3( 33685 standalone ? { weekday: length } : { weekday: length, month: "long", day: "numeric" }, 33686 "weekday" 33687 ), maybeMacro = (token) => { 33688 const formatOpts = Formatter.macroTokenToFormatOpts(token); 33689 if (formatOpts) { 33690 return this.formatWithSystemDefault(dt, formatOpts); 33691 } else { 33692 return token; 33693 } 33694 }, era = (length) => knownEnglish ? eraForDateTime(dt, length) : string3({ era: length }, "era"), tokenToString = (token) => { 33695 switch (token) { 33696 case "S": 33697 return this.num(dt.millisecond); 33698 case "u": 33699 case "SSS": 33700 return this.num(dt.millisecond, 3); 33701 case "s": 33702 return this.num(dt.second); 33703 case "ss": 33704 return this.num(dt.second, 2); 33705 case "uu": 33706 return this.num(Math.floor(dt.millisecond / 10), 2); 33707 case "uuu": 33708 return this.num(Math.floor(dt.millisecond / 100)); 33709 case "m": 33710 return this.num(dt.minute); 33711 case "mm": 33712 return this.num(dt.minute, 2); 33713 case "h": 33714 return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12); 33715 case "hh": 33716 return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2); 33717 case "H": 33718 return this.num(dt.hour); 33719 case "HH": 33720 return this.num(dt.hour, 2); 33721 case "Z": 33722 return formatOffset2({ format: "narrow", allowZ: this.opts.allowZ }); 33723 case "ZZ": 33724 return formatOffset2({ format: "short", allowZ: this.opts.allowZ }); 33725 case "ZZZ": 33726 return formatOffset2({ format: "techie", allowZ: this.opts.allowZ }); 33727 case "ZZZZ": 33728 return dt.zone.offsetName(dt.ts, { format: "short", locale: this.loc.locale }); 33729 case "ZZZZZ": 33730 return dt.zone.offsetName(dt.ts, { format: "long", locale: this.loc.locale }); 33731 case "z": 33732 return dt.zoneName; 33733 case "a": 33734 return meridiem(); 33735 case "d": 33736 return useDateTimeFormatter ? string3({ day: "numeric" }, "day") : this.num(dt.day); 33737 case "dd": 33738 return useDateTimeFormatter ? string3({ day: "2-digit" }, "day") : this.num(dt.day, 2); 33739 case "c": 33740 return this.num(dt.weekday); 33741 case "ccc": 33742 return weekday("short", true); 33743 case "cccc": 33744 return weekday("long", true); 33745 case "ccccc": 33746 return weekday("narrow", true); 33747 case "E": 33748 return this.num(dt.weekday); 33749 case "EEE": 33750 return weekday("short", false); 33751 case "EEEE": 33752 return weekday("long", false); 33753 case "EEEEE": 33754 return weekday("narrow", false); 33755 case "L": 33756 return useDateTimeFormatter ? string3({ month: "numeric", day: "numeric" }, "month") : this.num(dt.month); 33757 case "LL": 33758 return useDateTimeFormatter ? string3({ month: "2-digit", day: "numeric" }, "month") : this.num(dt.month, 2); 33759 case "LLL": 33760 return month("short", true); 33761 case "LLLL": 33762 return month("long", true); 33763 case "LLLLL": 33764 return month("narrow", true); 33765 case "M": 33766 return useDateTimeFormatter ? string3({ month: "numeric" }, "month") : this.num(dt.month); 33767 case "MM": 33768 return useDateTimeFormatter ? string3({ month: "2-digit" }, "month") : this.num(dt.month, 2); 33769 case "MMM": 33770 return month("short", false); 33771 case "MMMM": 33772 return month("long", false); 33773 case "MMMMM": 33774 return month("narrow", false); 33775 case "y": 33776 return useDateTimeFormatter ? string3({ year: "numeric" }, "year") : this.num(dt.year); 33777 case "yy": 33778 return useDateTimeFormatter ? string3({ year: "2-digit" }, "year") : this.num(dt.year.toString().slice(-2), 2); 33779 case "yyyy": 33780 return useDateTimeFormatter ? string3({ year: "numeric" }, "year") : this.num(dt.year, 4); 33781 case "yyyyyy": 33782 return useDateTimeFormatter ? string3({ year: "numeric" }, "year") : this.num(dt.year, 6); 33783 case "G": 33784 return era("short"); 33785 case "GG": 33786 return era("long"); 33787 case "GGGGG": 33788 return era("narrow"); 33789 case "kk": 33790 return this.num(dt.weekYear.toString().slice(-2), 2); 33791 case "kkkk": 33792 return this.num(dt.weekYear, 4); 33793 case "W": 33794 return this.num(dt.weekNumber); 33795 case "WW": 33796 return this.num(dt.weekNumber, 2); 33797 case "o": 33798 return this.num(dt.ordinal); 33799 case "ooo": 33800 return this.num(dt.ordinal, 3); 33801 case "q": 33802 return this.num(dt.quarter); 33803 case "qq": 33804 return this.num(dt.quarter, 2); 33805 case "X": 33806 return this.num(Math.floor(dt.ts / 1e3)); 33807 case "x": 33808 return this.num(dt.ts); 33809 default: 33810 return maybeMacro(token); 33811 } 33812 }; 33813 return stringifyTokens(Formatter.parseFormat(fmt), tokenToString); 33814 } 33815 formatDurationFromString(dur, fmt) { 33816 const tokenToField = (token) => { 33817 switch (token[0]) { 33818 case "S": 33819 return "millisecond"; 33820 case "s": 33821 return "second"; 33822 case "m": 33823 return "minute"; 33824 case "h": 33825 return "hour"; 33826 case "d": 33827 return "day"; 33828 case "w": 33829 return "week"; 33830 case "M": 33831 return "month"; 33832 case "y": 33833 return "year"; 33834 default: 33835 return null; 33836 } 33837 }, tokenToString = (lildur) => (token) => { 33838 const mapped = tokenToField(token); 33839 if (mapped) { 33840 return this.num(lildur.get(mapped), token.length); 33841 } else { 33842 return token; 33843 } 33844 }, tokens = Formatter.parseFormat(fmt), realTokens = tokens.reduce( 33845 (found, { literal, val }) => literal ? found : found.concat(val), 33846 [] 33847 ), collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t)); 33848 return stringifyTokens(tokens, tokenToString(collapsed)); 33849 } 33850} 33851class Invalid { 33852 constructor(reason, explanation) { 33853 this.reason = reason; 33854 this.explanation = explanation; 33855 } 33856 toMessage() { 33857 if (this.explanation) { 33858 return `${this.reason}: ${this.explanation}`; 33859 } else { 33860 return this.reason; 33861 } 33862 } 33863} 33864const ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/; 33865function combineRegexes(...regexes) { 33866 const full = regexes.reduce((f, r) => f + r.source, ""); 33867 return RegExp(`^${full}$`); 33868} 33869function combineExtractors(...extractors) { 33870 return (m) => extractors.reduce( 33871 ([mergedVals, mergedZone, cursor], ex) => { 33872 const [val, zone, next] = ex(m, cursor); 33873 return [{ ...mergedVals, ...val }, zone || mergedZone, next]; 33874 }, 33875 [{}, null, 1] 33876 ).slice(0, 2); 33877} 33878function parse(s2, ...patterns) { 33879 if (s2 == null) { 33880 return [null, null]; 33881 } 33882 for (const [regex, extractor] of patterns) { 33883 const m = regex.exec(s2); 33884 if (m) { 33885 return extractor(m); 33886 } 33887 } 33888 return [null, null]; 33889} 33890function simpleParse(...keys2) { 33891 return (match2, cursor) => { 33892 const ret = {}; 33893 let i; 33894 for (i = 0; i < keys2.length; i++) {
vendor: 5,016 bytes, lines 33895-34019
33895 ret[keys2[i]] = parseInteger(match2[cursor + i]); 33896 } 33897 return [ret, null, cursor + i]; 33898 }; 33899} 33900const offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/; 33901const isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`; 33902const isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/; 33903const isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`); 33904const isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`); 33905const isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/; 33906const isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/; 33907const isoOrdinalRegex = /(\d{4})-?(\d{3})/; 33908const extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"); 33909const extractISOOrdinalData = simpleParse("year", "ordinal"); 33910const sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/; 33911const sqlTimeRegex = RegExp( 33912 `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?` 33913); 33914const sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`); 33915function int(match2, pos, fallback) { 33916 const m = match2[pos]; 33917 return isUndefined$1(m) ? fallback : parseInteger(m); 33918} 33919function extractISOYmd(match2, cursor) { 33920 const item = { 33921 year: int(match2, cursor), 33922 month: int(match2, cursor + 1, 1), 33923 day: int(match2, cursor + 2, 1) 33924 }; 33925 return [item, null, cursor + 3]; 33926} 33927function extractISOTime(match2, cursor) { 33928 const item = { 33929 hours: int(match2, cursor, 0), 33930 minutes: int(match2, cursor + 1, 0), 33931 seconds: int(match2, cursor + 2, 0), 33932 milliseconds: parseMillis(match2[cursor + 3]) 33933 }; 33934 return [item, null, cursor + 4]; 33935} 33936function extractISOOffset(match2, cursor) { 33937 const local = !match2[cursor] && !match2[cursor + 1], fullOffset = signedOffset(match2[cursor + 1], match2[cursor + 2]), zone = local ? null : FixedOffsetZone.instance(fullOffset); 33938 return [{}, zone, cursor + 3]; 33939} 33940function extractIANAZone(match2, cursor) { 33941 const zone = match2[cursor] ? IANAZone.create(match2[cursor]) : null; 33942 return [{}, zone, cursor + 1]; 33943} 33944const isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`); 33945const isoDuration = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/; 33946function extractISODuration(match2) { 33947 const [s2, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] = match2; 33948 const hasNegativePrefix = s2[0] === "-"; 33949 const negativeSeconds = secondStr && secondStr[0] === "-"; 33950 const maybeNegate = (num, force = false) => num !== void 0 && (force || num && hasNegativePrefix) ? -num : num; 33951 return [ 33952 { 33953 years: maybeNegate(parseFloating(yearStr)), 33954 months: maybeNegate(parseFloating(monthStr)), 33955 weeks: maybeNegate(parseFloating(weekStr)), 33956 days: maybeNegate(parseFloating(dayStr)), 33957 hours: maybeNegate(parseFloating(hourStr)), 33958 minutes: maybeNegate(parseFloating(minuteStr)), 33959 seconds: maybeNegate(parseFloating(secondStr), secondStr === "-0"), 33960 milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds) 33961 } 33962 ]; 33963} 33964const obsOffsets = { 33965 GMT: 0, 33966 EDT: -4 * 60, 33967 EST: -5 * 60, 33968 CDT: -5 * 60, 33969 CST: -6 * 60, 33970 MDT: -6 * 60, 33971 MST: -7 * 60, 33972 PDT: -7 * 60, 33973 PST: -8 * 60 33974}; 33975function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { 33976 const result = { 33977 year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr), 33978 month: monthsShort.indexOf(monthStr) + 1, 33979 day: parseInteger(dayStr), 33980 hour: parseInteger(hourStr), 33981 minute: parseInteger(minuteStr) 33982 }; 33983 if (secondStr) 33984 result.second = parseInteger(secondStr); 33985 if (weekdayStr) { 33986 result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1; 33987 } 33988 return result; 33989} 33990const rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/; 33991function extractRFC2822(match2) { 33992 const [ 33993 , 33994 weekdayStr, 33995 dayStr, 33996 monthStr, 33997 yearStr, 33998 hourStr, 33999 minuteStr, 34000 secondStr, 34001 obsOffset, 34002 milOffset, 34003 offHourStr, 34004 offMinuteStr 34005 ] = match2, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); 34006 let offset2; 34007 if (obsOffset) { 34008 offset2 = obsOffsets[obsOffset]; 34009 } else if (milOffset) { 34010 offset2 = 0; 34011 } else { 34012 offset2 = signedOffset(offHourStr, offMinuteStr); 34013 } 34014 return [result, new FixedOffsetZone(offset2)]; 34015} 34016function preprocessRFC2822(s2) { 34017 return s2.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim(); 34018} 34019const rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, rfc850 = /^(Monday|Tuesday|Wednesday|Thursday|Frid
34019ay|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/; 34020function extractRFC1123Or850(match2) { 34021 const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match2, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); 34022 return [result, FixedOffsetZone.utcInstance]; 34023} 34024function extractASCII(match2) { 34025 const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match2, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); 34026 return [result, FixedOffsetZone.utcInstance]; 34027} 34028const isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex); 34029const isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex); 34030const isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex); 34031const isoTimeCombinedRegex = combineRegexes(isoTimeRegex);
vendor: 4,496 bytes, lines 34032-34197
34032const extractISOYmdTimeAndOffset = combineExtractors( 34033 extractISOYmd, 34034 extractISOTime, 34035 extractISOOffset, 34036 extractIANAZone 34037); 34038const extractISOWeekTimeAndOffset = combineExtractors( 34039 extractISOWeekData, 34040 extractISOTime, 34041 extractISOOffset, 34042 extractIANAZone 34043); 34044const extractISOOrdinalDateAndTime = combineExtractors( 34045 extractISOOrdinalData, 34046 extractISOTime, 34047 extractISOOffset, 34048 extractIANAZone 34049); 34050const extractISOTimeAndOffset = combineExtractors( 34051 extractISOTime, 34052 extractISOOffset, 34053 extractIANAZone 34054); 34055function parseISODate(s2) { 34056 return parse( 34057 s2, 34058 [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], 34059 [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], 34060 [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime], 34061 [isoTimeCombinedRegex, extractISOTimeAndOffset] 34062 ); 34063} 34064function parseRFC2822Date(s2) { 34065 return parse(preprocessRFC2822(s2), [rfc2822, extractRFC2822]); 34066} 34067function parseHTTPDate(s2) { 34068 return parse( 34069 s2, 34070 [rfc1123, extractRFC1123Or850], 34071 [rfc850, extractRFC1123Or850], 34072 [ascii, extractASCII] 34073 ); 34074} 34075function parseISODuration(s2) { 34076 return parse(s2, [isoDuration, extractISODuration]); 34077} 34078const extractISOTimeOnly = combineExtractors(extractISOTime); 34079function parseISOTimeOnly(s2) { 34080 return parse(s2, [isoTimeOnly, extractISOTimeOnly]); 34081} 34082const sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex); 34083const sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex); 34084const extractISOTimeOffsetAndIANAZone = combineExtractors( 34085 extractISOTime, 34086 extractISOOffset, 34087 extractIANAZone 34088); 34089function parseSQL(s2) { 34090 return parse( 34091 s2, 34092 [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], 34093 [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone] 34094 ); 34095} 34096const INVALID$2 = "Invalid Duration"; 34097const lowOrderMatrix = { 34098 weeks: { 34099 days: 7, 34100 hours: 7 * 24, 34101 minutes: 7 * 24 * 60, 34102 seconds: 7 * 24 * 60 * 60, 34103 milliseconds: 7 * 24 * 60 * 60 * 1e3 34104 }, 34105 days: { 34106 hours: 24, 34107 minutes: 24 * 60, 34108 seconds: 24 * 60 * 60, 34109 milliseconds: 24 * 60 * 60 * 1e3 34110 }, 34111 hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1e3 }, 34112 minutes: { seconds: 60, milliseconds: 60 * 1e3 }, 34113 seconds: { milliseconds: 1e3 } 34114}, casualMatrix = { 34115 years: { 34116 quarters: 4, 34117 months: 12, 34118 weeks: 52, 34119 days: 365, 34120 hours: 365 * 24, 34121 minutes: 365 * 24 * 60, 34122 seconds: 365 * 24 * 60 * 60, 34123 milliseconds: 365 * 24 * 60 * 60 * 1e3 34124 }, 34125 quarters: { 34126 months: 3, 34127 weeks: 13, 34128 days: 91, 34129 hours: 91 * 24, 34130 minutes: 91 * 24 * 60, 34131 seconds: 91 * 24 * 60 * 60, 34132 milliseconds: 91 * 24 * 60 * 60 * 1e3 34133 }, 34134 months: { 34135 weeks: 4, 34136 days: 30, 34137 hours: 30 * 24, 34138 minutes: 30 * 24 * 60, 34139 seconds: 30 * 24 * 60 * 60, 34140 milliseconds: 30 * 24 * 60 * 60 * 1e3 34141 }, 34142 ...lowOrderMatrix 34143}, daysInYearAccurate = 146097 / 400, daysInMonthAccurate = 146097 / 4800, accurateMatrix = { 34144 years: { 34145 quarters: 4, 34146 months: 12, 34147 weeks: daysInYearAccurate / 7, 34148 days: daysInYearAccurate, 34149 hours: daysInYearAccurate * 24, 34150 minutes: daysInYearAccurate * 24 * 60, 34151 seconds: daysInYearAccurate * 24 * 60 * 60, 34152 milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1e3 34153 }, 34154 quarters: { 34155 months: 3, 34156 weeks: daysInYearAccurate / 28, 34157 days: daysInYearAccurate / 4, 34158 hours: daysInYearAccurate * 24 / 4, 34159 minutes: daysInYearAccurate * 24 * 60 / 4, 34160 seconds: daysInYearAccurate * 24 * 60 * 60 / 4, 34161 milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1e3 / 4 34162 }, 34163 months: { 34164 weeks: daysInMonthAccurate / 7, 34165 days: daysInMonthAccurate, 34166 hours: daysInMonthAccurate * 24, 34167 minutes: daysInMonthAccurate * 24 * 60, 34168 seconds: daysInMonthAccurate * 24 * 60 * 60, 34169 milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1e3 34170 }, 34171 ...lowOrderMatrix 34172}; 34173const orderedUnits$1 = [ 34174 "years", 34175 "quarters", 34176 "months", 34177 "weeks", 34178 "days", 34179 "hours", 34180 "minutes", 34181 "seconds", 34182 "milliseconds" 34183]; 34184const reverseUnits = orderedUnits$1.slice(0).reverse(); 34185function clone$1(dur, alts, clear2 = false) { 34186 const conf = { 34187 values: clear2 ? alts.values : { ...dur.values, ...alts.values || {} }, 34188 loc: dur.loc.clone(alts.loc), 34189 conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy, 34190 matrix: alts.matrix || dur.matrix 34191 }; 34192 return new Duration(conf); 34193} 34194function antiTrunc(n2) { 34195 return n2 < 0 ? Math.floor(n2) : Math.ceil(n2); 34196} 34197function convert(matrix, fromMap, fromUnit, toMap, toUnit) {
34198 const conv = matrix[toUnit][fromUnit], raw = fromMap[fromUnit] / conv, sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]), added = !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw); 34199 toMap[toUnit] += added; 34200 fromMap[fromUnit] -= added * conv; 34201} 34202function normalizeValues(matrix, vals) { 34203 reverseUnits.reduce((previous, current) => { 34204 if (!isUndefined$1(vals[current])) { 34205 if (previous) { 34206 convert(matrix, vals, previous, vals, current); 34207 } 34208 return current; 34209 } else { 34210 return previous; 34211 } 34212 }, null); 34213} 34214function removeZeroes(vals) { 34215 const newVals = {}; 34216 for (const [key, value] of Object.entries(vals)) { 34217 if (value !== 0) { 34218 newVals[key] = value; 34219 } 34220 } 34221 return newVals; 34222} 34223class Duration { 34224 /** 34225 * @private 34226 */ 34227 constructor(config) { 34228 const accurate = config.conversionAccuracy === "longterm" || false; 34229 let matrix = accurate ? accurateMatrix : casualMatrix; 34230 if (config.matrix) { 34231 matrix = config.matrix; 34232 } 34233 this.values = config.values; 34234 this.loc = config.loc || Locale.create(); 34235 this.conversionAccuracy = accurate ? "longterm" : "casual"; 34236 this.invalid = config.invalid || null; 34237 this.matrix = matrix; 34238 this.isLuxonDuration = true; 34239 } 34240 /** 34241 * Create Duration from a number of milliseconds. 34242 * @param {number} count of milliseconds 34243 * @param {Object} opts - options for parsing 34244 * @param {string} [opts.locale='en-US'] - the locale to use 34245 * @param {string} opts.numberingSystem - the numbering system to use 34246 * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use 34247 * @return {Duration} 34248 */ 34249 static fromMillis(count, opts) { 34250 return Duration.fromObject({ milliseconds: count }, opts); 34251 } 34252 /** 34253 * Create a Duration from a JavaScript object with keys like 'years' and 'hours'. 34254 * If this object is empty then a zero milliseconds duration is returned. 34255 * @param {Object} obj - the object to create the DateTime from 34256 * @param {number} obj.years 34257 * @param {number} obj.quarters 34258 * @param {number} obj.months 34259 * @param {number} obj.weeks 34260 * @param {number} obj.days 34261 * @param {number} obj.hours 34262 * @param {number} obj.minutes 34263 * @param {number} obj.seconds 34264 * @param {number} obj.milliseconds 34265 * @param {Object} [opts=[]] - options for creating this Duration 34266 * @param {string} [opts.locale='en-US'] - the locale to use 34267 * @param {string} opts.numberingSystem - the numbering system to use 34268 * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use 34269 * @param {string} [opts.matrix=Object] - the custom conversion system to use 34270 * @return {Duration} 34271 */ 34272 static fromObject(obj, opts = {}) { 34273 if (obj == null || typeof obj !== "object") { 34274 throw new InvalidArgumentError( 34275 `Duration.fromObject: argument expected to be an object, got ${obj === null ? "null" : typeof obj}` 34276 ); 34277 } 34278 return new Duration({ 34279 values: normalizeObject(obj, Duration.normalizeUnit), 34280 loc: Locale.fromObject(opts), 34281 conversionAccuracy: opts.conversionAccuracy, 34282 matrix: opts.matrix 34283 }); 34284 } 34285 /** 34286 * Create a Duration from DurationLike. 34287 * 34288 * @param {Object | number | Duration} durationLike 34289 * One of: 34290 * - object with keys like 'years' and 'hours'. 34291 * - number representing milliseconds 34292 * - Duration instance 34293 * @return {Duration} 34294 */ 34295 static fromDurationLike(durationLike) { 34296 if (isNumber$1(durationLike)) { 34297 return Duration.fromMillis(durationLike); 34298 } else if (Duration.isDuration(durationLike)) { 34299 return durationLike; 34300 } else if (typeof durationLike === "object") { 34301 return Duration.fromObject(durationLike); 34302 } else { 34303 throw new InvalidArgumentError( 34304 `Unknown duration argument ${durationLike} of type ${typeof durationLike}` 34305 ); 34306 } 34307 } 34308 /** 34309 * Create a Duration from an ISO 8601 duration string. 34310 * @param {string} text - text to parse 34311 * @param {Object} opts - options for parsing 34312 * @param {string} [opts.locale='en-US'] - the locale to use 34313 * @param {string} opts.numberingSystem - the numbering system to use 34314 * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use 34315 * @param {string} [opts.matrix=Object] - the preset conversion system to use 34316 * @see https://en.wikipedia.org/wiki/ISO_8601#Durations 34317 * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } 34318 * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 } 34319 * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 } 34320 * @return {Duration} 34321 */ 34322 static fromISO(text, opts) { 34323 const [parsed] = parseISODuration(text); 34324 if (parsed) { 34325 return Duration.fromObject(parsed, opts); 34326 } else { 34327 return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`); 34328 } 34329 } 34330 /** 34331 * Create a Duration from an ISO 8601 time string. 34332 * @param {string} text - text to parse 34333 * @param {Object} opts - options for parsing 34334 * @param {string} [opts.locale='en-US'] - the locale to use 34335 * @param {string} opts.numberingSystem - the numbering system to use 34336 * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use 34337 * @param {string} [opts.matrix=Object] - the conversion system to use 34338 * @see https://en.wikipedia.org/wiki/ISO_8601#Times 34339 * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 } 34340 * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } 34341 * @example Duration.fromISOTime('T11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } 34342 * @example Duration.fromISOTime('1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } 34343 * @example Duration.fromISOTime('T1100').toObject() //=> { hours: 11, minutes: 0, seconds: 0 } 34344 * @return {Duration} 34345 */ 34346 static fromISOTime(text, opts) { 34347 const [parsed] = parseISOTimeOnly(text); 34348 if (parsed) { 34349 return Duration.fromObject(parsed, opts); 34350 } else { 34351 return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`); 34352 } 34353 } 34354 /**
34355 * Create an invalid Duration. 34356 * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent 34357 * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information 34358 * @return {Duration} 34359 */ 34360 static invalid(reason, explanation = null) { 34361 if (!reason) { 34362 throw new InvalidArgumentError("need to specify a reason the Duration is invalid"); 34363 } 34364 const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); 34365 if (Settings.throwOnInvalid) { 34366 throw new InvalidDurationError(invalid); 34367 } else { 34368 return new Duration({ invalid }); 34369 } 34370 } 34371 /** 34372 * @private 34373 */ 34374 static normalizeUnit(unit) { 34375 const normalized = { 34376 year: "years", 34377 years: "years", 34378 quarter: "quarters", 34379 quarters: "quarters", 34380 month: "months", 34381 months: "months", 34382 week: "weeks", 34383 weeks: "weeks", 34384 day: "days", 34385 days: "days", 34386 hour: "hours", 34387 hours: "hours", 34388 minute: "minutes", 34389 minutes: "minutes", 34390 second: "seconds", 34391 seconds: "seconds", 34392 millisecond: "milliseconds", 34393 milliseconds: "milliseconds" 34394 }[unit ? unit.toLowerCase() : unit]; 34395 if (!normalized) 34396 throw new InvalidUnitError(unit); 34397 return normalized; 34398 } 34399 /** 34400 * Check if an object is a Duration. Works across context boundaries 34401 * @param {object} o 34402 * @return {boolean} 34403 */ 34404 static isDuration(o) { 34405 return o && o.isLuxonDuration || false; 34406 } 34407 /** 34408 * Get the locale of a Duration, such 'en-GB' 34409 * @type {string} 34410 */ 34411 get locale() { 34412 return this.isValid ? this.loc.locale : null; 34413 } 34414 /** 34415 * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration 34416 * 34417 * @type {string} 34418 */ 34419 get numberingSystem() { 34420 return this.isValid ? this.loc.numberingSystem : null; 34421 } 34422 /** 34423 * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens: 34424 * * `S` for milliseconds 34425 * * `s` for seconds 34426 * * `m` for minutes 34427 * * `h` for hours 34428 * * `d` for days 34429 * * `w` for weeks 34430 * * `M` for months 34431 * * `y` for years 34432 * Notes: 34433 * * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits 34434 * * Tokens can be escaped by wrapping with single quotes. 34435 * * The duration will be converted to the set of units in the format string using {@link Duration#shiftTo} and the Durations's conversion accuracy setting. 34436 * @param {string} fmt - the format string 34437 * @param {Object} opts - options 34438 * @param {boolean} [opts.floor=true] - floor numerical values 34439 * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2" 34440 * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002" 34441 * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000" 34442 * @return {string} 34443 */ 34444 toFormat(fmt, opts = {}) { 34445 const fmtOpts = { 34446 ...opts, 34447 floor: opts.round !== false && opts.floor !== false 34448 }; 34449 return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2; 34450 } 34451 /** 34452 * Returns a string representation of a Duration with all units included. 34453 * To modify its behavior use the `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant. 34454 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat 34455 * @param opts - On option object to override the formatting. Accepts the same keys as the options parameter of the native `Int.NumberFormat` constructor, as well as `listStyle`. 34456 * @example 34457 * ```js 34458 * var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 }) 34459 * dur.toHuman() //=> '1 day, 5 hours, 6 minutes' 34460 * dur.toHuman({ listStyle: "long" }) //=> '1 day, 5 hours, and 6 minutes' 34461 * dur.toHuman({ unitDisplay: "short" }) //=> '1 day, 5 hr, 6 min' 34462 * ``` 34463 */ 34464 toHuman(opts = {}) {
34465 const l2 = orderedUnits$1.map((unit) => { 34466 const val = this.values[unit]; 34467 if (isUndefined$1(val)) { 34468 return null; 34469 } 34470 return this.loc.numberFormatter({ style: "unit", unitDisplay: "long", ...opts, unit: unit.slice(0, -1) }).format(val); 34471 }).filter((n2) => n2); 34472 return this.loc.listFormatter({ type: "conjunction", style: opts.listStyle || "narrow", ...opts }).format(l2); 34473 } 34474 /** 34475 * Returns a JavaScript object with this Duration's values. 34476 * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 } 34477 * @return {Object} 34478 */ 34479 toObject() { 34480 if (!this.isValid) 34481 return {}; 34482 return { ...this.values }; 34483 } 34484 /** 34485 * Returns an ISO 8601-compliant string representation of this Duration. 34486 * @see https://en.wikipedia.org/wiki/ISO_8601#Durations 34487 * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S' 34488 * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S' 34489 * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M' 34490 * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M' 34491 * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S' 34492 * @return {string} 34493 */ 34494 toISO() { 34495 if (!this.isValid) 34496 return null; 34497 let s2 = "P"; 34498 if (this.years !== 0) 34499 s2 += this.years + "Y"; 34500 if (this.months !== 0 || this.quarters !== 0) 34501 s2 += this.months + this.quarters * 3 + "M"; 34502 if (this.weeks !== 0) 34503 s2 += this.weeks + "W"; 34504 if (this.days !== 0) 34505 s2 += this.days + "D"; 34506 if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) 34507 s2 += "T"; 34508 if (this.hours !== 0) 34509 s2 += this.hours + "H"; 34510 if (this.minutes !== 0) 34511 s2 += this.minutes + "M"; 34512 if (this.seconds !== 0 || this.milliseconds !== 0) 34513 s2 += roundTo(this.seconds + this.milliseconds / 1e3, 3) + "S"; 34514 if (s2 === "P") 34515 s2 += "T0S"; 34516 return s2; 34517 } 34518 /** 34519 * Returns an ISO 8601-compliant string representation of this Duration, formatted as a time of day. 34520 * Note that this will return null if the duration is invalid, negative, or equal to or greater than 24 hours. 34521 * @see https://en.wikipedia.org/wiki/ISO_8601#Times 34522 * @param {Object} opts - options 34523 * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 34524 * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 34525 * @param {boolean} [opts.includePrefix=false] - include the `T` prefix 34526 * @param {string} [opts.format='extended'] - choose between the basic and extended format 34527 * @example Duration.fromObject({ hours: 11 }).toISOTime() //=> '11:00:00.000' 34528 * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressMilliseconds: true }) //=> '11:00:00' 34529 * @example Duration.fromObject({ hours: 11 }).toISOTime({ suppressSeconds: true }) //=> '11:00' 34530 * @example Duration.fromObject({ hours: 11 }).toISOTime({ includePrefix: true }) //=> 'T11:00:00.000' 34531 * @example Duration.fromObject({ hours: 11 }).toISOTime({ format: 'basic' }) //=> '110000.000' 34532 * @return {string} 34533 */ 34534 toISOTime(opts = {}) { 34535 if (!this.isValid) 34536 return null; 34537 const millis = this.toMillis(); 34538 if (millis < 0 || millis >= 864e5) 34539 return null; 34540 opts = { 34541 suppressMilliseconds: false, 34542 suppressSeconds: false, 34543 includePrefix: false, 34544 format: "extended", 34545 ...opts 34546 }; 34547 const value = this.shiftTo("hours", "minutes", "seconds", "milliseconds"); 34548 let fmt = opts.format === "basic" ? "hhmm" : "hh:mm"; 34549 if (!opts.suppressSeconds || value.seconds !== 0 || value.milliseconds !== 0) { 34550 fmt += opts.format === "basic" ? "ss" : ":ss"; 34551 if (!opts.suppressMilliseconds || value.milliseconds !== 0) { 34552 fmt += ".SSS"; 34553 } 34554 } 34555 let str = value.toFormat(fmt); 34556 if (opts.includePrefix) { 34557 str = "T" + str; 34558 } 34559 return str; 34560 } 34561 /** 34562 * Returns an ISO 8601 representation of this Duration appropriate for use in JSON. 34563 * @return {string} 34564 */ 34565 toJSON() { 34566 return this.toISO(); 34567 } 34568 /** 34569 * Returns an ISO 8601 representation of this Duration appropriate for use in debugging. 34570 * @return {string} 34571 */ 34572 toString() { 34573 return this.toISO(); 34574 } 34575 /** 34576 * Returns an milliseconds value of this Duration. 34577 * @return {number} 34578 */ 34579 toMillis() { 34580 return this.as("milliseconds"); 34581 } 34582 /** 34583 * Returns an milliseconds value of this Duration. Alias of {@link toMillis} 34584 * @return {number} 34585 */ 34586 valueOf() { 34587 return this.toMillis(); 34588 } 34589 /** 34590 * Make this Duration longer by the specified amount. Return a newly-constructed Duration. 34591 * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() 34592 * @return {Duration} 34593 */ 34594 plus(duration2) { 34595 if (!this.isValid) 34596 return this; 34597 const dur = Duration.fromDurationLike(duration2), result = {}; 34598 for (const k of orderedUnits$1) { 34599 if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) { 34600 result[k] = dur.get(k) + this.get(k); 34601 } 34602 } 34603 return clone$1(this, { values: result }, true); 34604 } 34605 /** 34606 * Make this Duration shorter by the specified amount. Return a newly-constructed Duration. 34607 * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() 34608 * @return {Duration} 34609 */ 34610 minus(duration2) { 34611 if (!this.isValid) 34612 return this; 34613 const dur = Duration.fromDurationLike(duration2); 34614 return this.plus(dur.negate()); 34615 } 34616 /** 34617 * Scale this Duration by the specified amount. Return a newly-constructed Duration. 34618 * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Mu
34618st return a number. 34619 * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 } 34620 * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "hours" ? x * 2 : x) //=> { hours: 2, minutes: 30 } 34621 * @return {Duration} 34622 */ 34623 mapUnits(fn) { 34624 if (!this.isValid) 34625 return this; 34626 const result = {}; 34627 for (const k of Object.keys(this.values)) { 34628 result[k] = asNumber(fn(this.values[k], k)); 34629 } 34630 return clone$1(this, { values: result }, true); 34631 } 34632 /** 34633 * Get the value of unit. 34634 * @param {string} unit - a unit such as 'minute' or 'day' 34635 * @example Duration.fromObject({years: 2, days: 3}).get('years') //=> 2 34636 * @example Duration.fromObject({years: 2, days: 3}).get('months') //=> 0 34637 * @example Duration.fromObject({years: 2, days: 3}).get('days') //=> 3 34638 * @return {number} 34639 */ 34640 get(unit) { 34641 return this[Duration.normalizeUnit(unit)]; 34642 } 34643 /** 34644 * "Set" the values of specified units. Return a newly-constructed Duration. 34645 * @param {Object} values - a mapping of units to numbers 34646 * @example dur.set({ years: 2017 }) 34647 * @example dur.set({ hours: 8, minutes: 30 }) 34648 * @return {Duration} 34649 */ 34650 set(values) { 34651 if (!this.isValid) 34652 return this; 34653 const mixed = { ...this.values, ...normalizeObject(values, Duration.normalizeUnit) }; 34654 return clone$1(this, { values: mixed }); 34655 } 34656 /** 34657 * "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration. 34658 * @example dur.reconfigure({ locale: 'en-GB' }) 34659 * @return {Duration} 34660 */ 34661 reconfigure({ locale: locale2, numberingSystem, conversionAccuracy, matrix } = {}) { 34662 const loc = this.loc.clone({ locale: locale2, numberingSystem }); 34663 const opts = { loc, matrix, conversionAccuracy }; 34664 return clone$1(this, opts); 34665 } 34666 /** 34667 * Return the length of the duration in the specified unit. 34668 * @param {string} unit - a unit such as 'minutes' or 'days' 34669 * @example Duration.fromObject({years: 1}).as('days') //=> 365 34670 * @example Duration.fromObject({years: 1}).as('months') //=> 12 34671 * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5 34672 * @return {number} 34673 */ 34674 as(unit) { 34675 return this.isValid ? this.shiftTo(unit).get(unit) : NaN; 34676 } 34677 /** 34678 * Reduce this Duration to its canonical representation in its current units. 34679 * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 } 34680 * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 } 34681 * @return {Duration} 34682 */ 34683 normalize() { 34684 if (!this.isValid) 34685 return this; 34686 const vals = this.toObject(); 34687 normalizeValues(this.matrix, vals); 34688 return clone$1(this, { values: vals }, true); 34689 } 34690 /** 34691 * Rescale units to its largest representation 34692 * @example Duration.fromObject({ milliseconds: 90000 }).rescale().toObject() //=> { minutes: 1, seconds: 30 } 34693 * @return {Duration} 34694 */ 34695 rescale() { 34696 if (!this.isValid) 34697 return this; 34698 const vals = removeZeroes(this.normalize().shiftToAll().toObject()); 34699 return clone$1(this, { values: vals }, true); 34700 } 34701 /** 34702 * Convert this Duration into its representation in a different set of units. 34703 * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 } 34704 * @return {Duration} 34705 */ 34706 shiftTo(...units) { 34707 if (!this.isValid) 34708 return this; 34709 if (units.length === 0) { 34710 return this; 34711 } 34712 units = units.map((u) => Duration.normalizeUnit(u)); 34713 const built = {}, accumulated = {}, vals = this.toObject(); 34714 let lastUnit; 34715 for (const k of orderedUnits$1) { 34716 if (units.indexOf(k) >= 0) { 34717 lastUnit = k; 34718 let own = 0; 34719 for (const ak in accumulated) { 34720 own += this.matrix[ak][k] * accumulated[ak]; 34721 accumulated[ak] = 0; 34722 } 34723 if (isNumber$1(vals[k])) { 34724 own += vals[k]; 34725 } 34726 const i = Math.trunc(own); 34727 built[k] = i; 34728 accumulated[k] = (own * 1e3 - i * 1e3) / 1e3; 34729 for (const down in vals) { 34730 if (orderedUnits$1.indexOf(down) > orderedUnits$1.indexOf(k)) { 34731 convert(this.matrix, vals, down, built, k); 34732 } 34733 } 34734 } else if (isNumber$1(vals[k])) { 34735 accumulated[k] = vals[k]; 34736 } 34737 } 34738 for (const key in accumulated) { 34739 if (accumulated[key] !== 0) { 34740 built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key]; 34741 } 34742 } 34743 return clone$1(this, { values: built }, true).normalize(); 34744 } 34745 /** 34746 * Shift this Duration to all available units. 34747 * Same as shiftTo("years", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds") 34748 * @return {Duration} 34749 */ 34750 shiftToAll() { 34751 if (!this.isValid) 34752 return this; 34753 return this.shiftTo(
vendor: 4,085 bytes, lines 34754-34919
34754 "years", 34755 "months", 34756 "weeks", 34757 "days", 34758 "hours", 34759 "minutes", 34760 "seconds", 34761 "milliseconds" 34762 ); 34763 } 34764 /** 34765 * Return the negative of this Duration. 34766 * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 } 34767 * @return {Duration} 34768 */ 34769 negate() { 34770 if (!this.isValid) 34771 return this; 34772 const negated = {}; 34773 for (const k of Object.keys(this.values)) { 34774 negated[k] = this.values[k] === 0 ? 0 : -this.values[k]; 34775 } 34776 return clone$1(this, { values: negated }, true); 34777 } 34778 /** 34779 * Get the years. 34780 * @type {number} 34781 */ 34782 get years() { 34783 return this.isValid ? this.values.years || 0 : NaN; 34784 } 34785 /** 34786 * Get the quarters. 34787 * @type {number} 34788 */ 34789 get quarters() { 34790 return this.isValid ? this.values.quarters || 0 : NaN; 34791 } 34792 /** 34793 * Get the months. 34794 * @type {number} 34795 */ 34796 get months() { 34797 return this.isValid ? this.values.months || 0 : NaN; 34798 } 34799 /** 34800 * Get the weeks 34801 * @type {number} 34802 */ 34803 get weeks() { 34804 return this.isValid ? this.values.weeks || 0 : NaN; 34805 } 34806 /** 34807 * Get the days. 34808 * @type {number} 34809 */ 34810 get days() { 34811 return this.isValid ? this.values.days || 0 : NaN; 34812 } 34813 /** 34814 * Get the hours. 34815 * @type {number} 34816 */ 34817 get hours() { 34818 return this.isValid ? this.values.hours || 0 : NaN; 34819 } 34820 /** 34821 * Get the minutes. 34822 * @type {number} 34823 */ 34824 get minutes() { 34825 return this.isValid ? this.values.minutes || 0 : NaN; 34826 } 34827 /** 34828 * Get the seconds. 34829 * @return {number} 34830 */ 34831 get seconds() { 34832 return this.isValid ? this.values.seconds || 0 : NaN; 34833 } 34834 /** 34835 * Get the milliseconds. 34836 * @return {number} 34837 */ 34838 get milliseconds() { 34839 return this.isValid ? this.values.milliseconds || 0 : NaN; 34840 } 34841 /** 34842 * Returns whether the Duration is invalid. Invalid durations are returned by diff operations 34843 * on invalid DateTimes or Intervals. 34844 * @return {boolean} 34845 */ 34846 get isValid() { 34847 return this.invalid === null; 34848 } 34849 /** 34850 * Returns an error code if this Duration became invalid, or null if the Duration is valid 34851 * @return {string} 34852 */ 34853 get invalidReason() { 34854 return this.invalid ? this.invalid.reason : null; 34855 } 34856 /** 34857 * Returns an explanation of why this Duration became invalid, or null if the Duration is valid 34858 * @type {string} 34859 */ 34860 get invalidExplanation() { 34861 return this.invalid ? this.invalid.explanation : null; 34862 } 34863 /** 34864 * Equality check 34865 * Two Durations are equal iff they have the same units and the same values for each unit. 34866 * @param {Duration} other 34867 * @return {boolean} 34868 */ 34869 equals(other) { 34870 if (!this.isValid || !other.isValid) { 34871 return false; 34872 } 34873 if (!this.loc.equals(other.loc)) { 34874 return false; 34875 } 34876 function eq2(v1, v2) { 34877 if (v1 === void 0 || v1 === 0) 34878 return v2 === void 0 || v2 === 0; 34879 return v1 === v2; 34880 } 34881 for (const u of orderedUnits$1) { 34882 if (!eq2(this.values[u], other.values[u])) { 34883 return false; 34884 } 34885 } 34886 return true; 34887 } 34888} 34889const INVALID$1 = "Invalid Interval"; 34890function validateStartEnd(start, end) { 34891 if (!start || !start.isValid) { 34892 return Interval.invalid("missing or invalid start"); 34893 } else if (!end || !end.isValid) { 34894 return Interval.invalid("missing or invalid end"); 34895 } else if (end < start) { 34896 return Interval.invalid( 34897 "end before start", 34898 `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}` 34899 ); 34900 } else { 34901 return null; 34902 } 34903} 34904class Interval { 34905 /** 34906 * @private 34907 */ 34908 constructor(config) { 34909 this.s = config.start; 34910 this.e = config.end; 34911 this.invalid = config.invalid || null; 34912 this.isLuxonInterval = true; 34913 } 34914 /** 34915 * Create an invalid Interval. 34916 * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent 34917 * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information 34918 * @return {Interval} 34919 */
vendor: 5,342 bytes, lines 34920-35077
34920 static invalid(reason, explanation = null) { 34921 if (!reason) { 34922 throw new InvalidArgumentError("need to specify a reason the Interval is invalid"); 34923 } 34924 const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); 34925 if (Settings.throwOnInvalid) { 34926 throw new InvalidIntervalError(invalid); 34927 } else { 34928 return new Interval({ invalid }); 34929 } 34930 } 34931 /** 34932 * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end. 34933 * @param {DateTime|Date|Object} start 34934 * @param {DateTime|Date|Object} end 34935 * @return {Interval} 34936 */ 34937 static fromDateTimes(start, end) { 34938 const builtStart = friendlyDateTime(start), builtEnd = friendlyDateTime(end); 34939 const validateError = validateStartEnd(builtStart, builtEnd); 34940 if (validateError == null) { 34941 return new Interval({ 34942 start: builtStart, 34943 end: builtEnd 34944 }); 34945 } else { 34946 return validateError; 34947 } 34948 } 34949 /** 34950 * Create an Interval from a start DateTime and a Duration to extend to. 34951 * @param {DateTime|Date|Object} start 34952 * @param {Duration|Object|number} duration - the length of the Interval. 34953 * @return {Interval} 34954 */ 34955 static after(start, duration2) { 34956 const dur = Duration.fromDurationLike(duration2), dt = friendlyDateTime(start); 34957 return Interval.fromDateTimes(dt, dt.plus(dur)); 34958 } 34959 /** 34960 * Create an Interval from an end DateTime and a Duration to extend backwards to. 34961 * @param {DateTime|Date|Object} end 34962 * @param {Duration|Object|number} duration - the length of the Interval. 34963 * @return {Interval} 34964 */ 34965 static before(end, duration2) { 34966 const dur = Duration.fromDurationLike(duration2), dt = friendlyDateTime(end); 34967 return Interval.fromDateTimes(dt.minus(dur), dt); 34968 } 34969 /** 34970 * Create an Interval from an ISO 8601 string. 34971 * Accepts `<start>/<end>`, `<start>/<duration>`, and `<duration>/<end>` formats. 34972 * @param {string} text - the ISO string to parse 34973 * @param {Object} [opts] - options to pass {@link DateTime#fromISO} and optionally {@link Duration#fromISO} 34974 * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals 34975 * @return {Interval} 34976 */ 34977 static fromISO(text, opts) { 34978 const [s2, e] = (text || "").split("/", 2); 34979 if (s2 && e) { 34980 let start, startIsValid; 34981 try { 34982 start = DateTime.fromISO(s2, opts); 34983 startIsValid = start.isValid; 34984 } catch (e2) { 34985 startIsValid = false; 34986 } 34987 let end, endIsValid; 34988 try { 34989 end = DateTime.fromISO(e, opts); 34990 endIsValid = end.isValid; 34991 } catch (e2) { 34992 endIsValid = false; 34993 } 34994 if (startIsValid && endIsValid) { 34995 return Interval.fromDateTimes(start, end); 34996 } 34997 if (startIsValid) { 34998 const dur = Duration.fromISO(e, opts); 34999 if (dur.isValid) { 35000 return Interval.after(start, dur); 35001 } 35002 } else if (endIsValid) { 35003 const dur = Duration.fromISO(s2, opts); 35004 if (dur.isValid) { 35005 return Interval.before(end, dur); 35006 } 35007 } 35008 } 35009 return Interval.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`); 35010 } 35011 /** 35012 * Check if an object is an Interval. Works across context boundaries 35013 * @param {object} o 35014 * @return {boolean} 35015 */ 35016 static isInterval(o) { 35017 return o && o.isLuxonInterval || false; 35018 } 35019 /** 35020 * Returns the start of the Interval 35021 * @type {DateTime} 35022 */ 35023 get start() { 35024 return this.isValid ? this.s : null; 35025 } 35026 /** 35027 * Returns the end of the Interval 35028 * @type {DateTime} 35029 */ 35030 get end() { 35031 return this.isValid ? this.e : null; 35032 } 35033 /** 35034 * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'. 35035 * @type {boolean} 35036 */ 35037 get isValid() { 35038 return this.invalidReason === null; 35039 } 35040 /** 35041 * Returns an error code if this Interval is invalid, or null if the Interval is valid 35042 * @type {string} 35043 */ 35044 get invalidReason() { 35045 return this.invalid ? this.invalid.reason : null; 35046 } 35047 /** 35048 * Returns an explanation of why this Interval became invalid, or null if the Interval is valid 35049 * @type {string} 35050 */ 35051 get invalidExplanation() { 35052 return this.invalid ? this.invalid.explanation : null; 35053 } 35054 /** 35055 * Returns the length of the Interval in the specified unit. 35056 * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in. 35057 * @return {number} 35058 */ 35059 length(unit = "milliseconds") { 35060 return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN; 35061 } 35062 /** 35063 * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part. 35064 * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day' 35065 * asks 'what dates are included in this interval?', not 'how many days long is this interval?' 35066 * @param {string} [unit='milliseconds'] - the unit of time to count. 35067 * @return {number} 35068 */ 35069 count(unit = "milliseconds") { 35070 if (!this.isValid) 35071 return NaN; 35072 const start = this.start.startOf(unit), end = this.end.startOf(unit); 35073 return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf()); 35074 } 35075 /** 35076 * Returns whether this Interval's start and end are both in the same unit of time 35077 * @param {string}
35077 unit - the unit of time to check sameness on 35078 * @return {boolean} 35079 */ 35080 hasSame(unit) { 35081 return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false; 35082 } 35083 /** 35084 * Return whether this Interval has the same start and end DateTimes. 35085 * @return {boolean} 35086 */ 35087 isEmpty() { 35088 return this.s.valueOf() === this.e.valueOf(); 35089 } 35090 /** 35091 * Return whether this Interval's start is after the specified DateTime. 35092 * @param {DateTime} dateTime 35093 * @return {boolean} 35094 */ 35095 isAfter(dateTime) { 35096 if (!this.isValid) 35097 return false; 35098 return this.s > dateTime; 35099 } 35100 /** 35101 * Return whether this Interval's end is before the specified DateTime. 35102 * @param {DateTime} dateTime 35103 * @return {boolean} 35104 */ 35105 isBefore(dateTime) { 35106 if (!this.isValid) 35107 return false; 35108 return this.e <= dateTime; 35109 } 35110 /** 35111 * Return whether this Interval contains the specified DateTime. 35112 * @param {DateTime} dateTime 35113 * @return {boolean} 35114 */ 35115 contains(dateTime) { 35116 if (!this.isValid) 35117 return false; 35118 return this.s <= dateTime && this.e > dateTime; 35119 } 35120 /** 35121 * "Sets" the start and/or end dates. Returns a newly-constructed Interval. 35122 * @param {Object} values - the values to set 35123 * @param {DateTime} values.start - the starting DateTime 35124 * @param {DateTime} values.end - the ending DateTime 35125 * @return {Interval} 35126 */ 35127 set({ start, end } = {}) { 35128 if (!this.isValid) 35129 return this; 35130 return Interval.fromDateTimes(start || this.s, end || this.e); 35131 } 35132 /** 35133 * Split this Interval at each of the specified DateTimes 35134 * @param {...DateTime} dateTimes - the unit of time to count. 35135 * @return {Array} 35136 */ 35137 splitAt(...dateTimes) { 35138 if (!this.isValid) 35139 return []; 35140 const sorted = dateTimes.map(friendlyDateTime).filter((d) => this.contains(d)).sort(), results = []; 35141 let { s: s2 } = this, i = 0; 35142 while (s2 < this.e) { 35143 const added = sorted[i] || this.e, next = +added > +this.e ? this.e : added; 35144 results.push(Interval.fromDateTimes(s2, next)); 35145 s2 = next; 35146 i += 1; 35147 } 35148 return results; 35149 } 35150 /** 35151 * Split this Interval into smaller Intervals, each of the specified length. 35152 * Left over time is grouped into a smaller interval 35153 * @param {Duration|Object|number} duration - The length of each resulting interval. 35154 * @return {Array} 35155 */ 35156 splitBy(duration2) { 35157 const dur = Duration.fromDurationLike(duration2); 35158 if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) { 35159 return []; 35160 } 35161 let { s: s2 } = this, idx = 1, next; 35162 const results = []; 35163 while (s2 < this.e) { 35164 const added = this.start.plus(dur.mapUnits((x) => x * idx)); 35165 next = +added > +this.e ? this.e : added; 35166 results.push(Interval.fromDateTimes(s2, next)); 35167 s2 = next; 35168 idx += 1; 35169 } 35170 return results; 35171 } 35172 /** 35173 * Split this Interval into the specified number of smaller intervals. 35174 * @param {number} numberOfParts - The number of Intervals to divide the Interval into. 35175 * @return {Array} 35176 */ 35177 divideEqually(numberOfParts) { 35178 if (!this.isValid) 35179 return []; 35180 return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts); 35181 } 35182 /** 35183 * Return whether this Interval overlaps with the specified Interval 35184 * @param {Interval} other 35185 * @return {boolean} 35186 */ 35187 overlaps(other) { 35188 return this.e > other.s && this.s < other.e; 35189 } 35190 /** 35191 * Return whether this Interval's end is adjacent to the specified Interval's start. 35192 * @param {Interval} other 35193 * @return {boolean} 35194 */ 35195 abutsStart(other) { 35196 if (!this.isValid) 35197 return false; 35198 return +this.e === +other.s; 35199 } 35200 /** 35201 * Return whether this Interval's start is adjacent to the specified Interval's end. 35202 * @param {Interval} other 35203 * @return {boolean} 35204 */ 35205 abutsEnd(other) { 35206 if (!this.isValid) 35207 return false; 35208 return +other.e === +this.s; 35209 } 35210 /** 35211 * Return whether this Interval engulfs the start and end of the specified Interval. 35212 * @param {Interval} other 35213 * @return {boolean} 35214 */ 35215 engulfs(other) { 35216 if (!this.isValid) 35217 return false;
vendor: 4,413 bytes, lines 35218-35336
35218 return this.s <= other.s && this.e >= other.e; 35219 } 35220 /** 35221 * Return whether this Interval has the same start and end as the specified Interval. 35222 * @param {Interval} other 35223 * @return {boolean} 35224 */ 35225 equals(other) { 35226 if (!this.isValid || !other.isValid) { 35227 return false; 35228 } 35229 return this.s.equals(other.s) && this.e.equals(other.e); 35230 } 35231 /** 35232 * Return an Interval representing the intersection of this Interval and the specified Interval. 35233 * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. 35234 * Returns null if the intersection is empty, meaning, the intervals don't intersect. 35235 * @param {Interval} other 35236 * @return {Interval} 35237 */ 35238 intersection(other) { 35239 if (!this.isValid) 35240 return this; 35241 const s2 = this.s > other.s ? this.s : other.s, e = this.e < other.e ? this.e : other.e; 35242 if (s2 >= e) { 35243 return null; 35244 } else { 35245 return Interval.fromDateTimes(s2, e); 35246 } 35247 } 35248 /** 35249 * Return an Interval representing the union of this Interval and the specified Interval. 35250 * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals. 35251 * @param {Interval} other 35252 * @return {Interval} 35253 */ 35254 union(other) { 35255 if (!this.isValid) 35256 return this; 35257 const s2 = this.s < other.s ? this.s : other.s, e = this.e > other.e ? this.e : other.e; 35258 return Interval.fromDateTimes(s2, e); 35259 } 35260 /** 35261 * Merge an array of Intervals into a equivalent minimal set of Intervals. 35262 * Combines overlapping and adjacent Intervals. 35263 * @param {Array} intervals 35264 * @return {Array} 35265 */ 35266 static merge(intervals) { 35267 const [found, final] = intervals.sort((a, b) => a.s - b.s).reduce( 35268 ([sofar, current], item) => { 35269 if (!current) { 35270 return [sofar, item]; 35271 } else if (current.overlaps(item) || current.abutsStart(item)) { 35272 return [sofar, current.union(item)]; 35273 } else { 35274 return [sofar.concat([current]), item]; 35275 } 35276 }, 35277 [[], null] 35278 ); 35279 if (final) { 35280 found.push(final); 35281 } 35282 return found; 35283 } 35284 /** 35285 * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals. 35286 * @param {Array} intervals 35287 * @return {Array} 35288 */ 35289 static xor(intervals) { 35290 let start = null, currentCount = 0; 35291 const results = [], ends = intervals.map((i) => [ 35292 { time: i.s, type: "s" }, 35293 { time: i.e, type: "e" } 35294 ]), flattened = Array.prototype.concat(...ends), arr = flattened.sort((a, b) => a.time - b.time); 35295 for (const i of arr) { 35296 currentCount += i.type === "s" ? 1 : -1; 35297 if (currentCount === 1) { 35298 start = i.time; 35299 } else { 35300 if (start && +start !== +i.time) { 35301 results.push(Interval.fromDateTimes(start, i.time)); 35302 } 35303 start = null; 35304 } 35305 } 35306 return Interval.merge(results); 35307 } 35308 /** 35309 * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals. 35310 * @param {...Interval} intervals 35311 * @return {Array} 35312 */ 35313 difference(...intervals) { 35314 return Interval.xor([this].concat(intervals)).map((i) => this.intersection(i)).filter((i) => i && !i.isEmpty()); 35315 } 35316 /** 35317 * Returns a string representation of this Interval appropriate for debugging. 35318 * @return {string} 35319 */ 35320 toString() { 35321 if (!this.isValid) 35322 return INVALID$1; 35323 return `[${this.s.toISO()} â ${this.e.toISO()})`; 35324 } 35325 /** 35326 * Returns a localized string representing this Interval. Accepts the same options as the 35327 * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as 35328 * {@link DateTime.DATE_FULL} or {@link DateTime.TIME_SIMPLE}. The exact behavior of this method 35329 * is browser-specific, but in general it will return an appropriate representation of the 35330 * Interval in the assigned locale. Defaults to the system's locale if no locale has been 35331 * specified. 35332 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat 35333 * @param {Object} [formatOpts=DateTime.DATE_SHORT] - Either a DateTime preset or 35334 * Intl.DateTimeFormat constructor options. 35335 * @param {Object} opts - Options to override the configuration of the start DateTime. 35336 * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleStr
35336ing(); //=> 11/7/2022 â 11/8/2022 35337 * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL); //=> November 7 â 8, 2022 35338 * @example Interval.fromISO('2022-11-07T09:00Z/2022-11-08T09:00Z').toLocaleString(DateTime.DATE_FULL, { locale: 'fr-FR' }); //=> 7â8 novembre 2022 35339 * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString(DateTime.TIME_SIMPLE); //=> 6:00 â 8:00 PM 35340 * @example Interval.fromISO('2022-11-07T17:00Z/2022-11-07T19:00Z').toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> Mon, Nov 07, 6:00 â 8:00 p 35341 * @return {string} 35342 */ 35343 toLocaleString(formatOpts = DATE_SHORT, opts = {}) { 35344 return this.isValid ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this) : INVALID$1; 35345 } 35346 /** 35347 * Returns an ISO 8601-compliant string representation of this Interval. 35348 * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals 35349 * @param {Object} opts - The same options as {@link DateTime#toISO} 35350 * @return {string} 35351 */ 35352 toISO(opts) { 35353 if (!this.isValid) 35354 return INVALID$1; 35355 return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`; 35356 } 35357 /** 35358 * Returns an ISO 8601-compliant string representation of date of this Interval. 35359 * The time components are ignored. 35360 * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals 35361 * @return {string} 35362 */ 35363 toISODate() { 35364 if (!this.isValid) 35365 return INVALID$1; 35366 return `${this.s.toISODate()}/${this.e.toISODate()}`; 35367 } 35368 /** 35369 * Returns an ISO 8601-compliant string representation of time of this Interval. 35370 * The date components are ignored. 35371 * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals 35372 * @param {Object} opts - The same options as {@link DateTime#toISO} 35373 * @return {string} 35374 */ 35375 toISOTime(opts) { 35376 if (!this.isValid) 35377 return INVALID$1; 35378 return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`; 35379 } 35380 /** 35381 * Returns a string representation of this Interval formatted according to the specified format 35382 * string. **You may not want this.** See {@link Interval#toLocaleString} for a more flexible 35383 * formatting tool. 35384 * @param {string} dateFormat - The format string. This string formats the start and end time. 35385 * See {@link DateTime#toFormat} for details. 35386 * @param {Object} opts - Options. 35387 * @param {string} [opts.separator = ' â '] - A separator to place between the start and end 35388 * representations. 35389 * @return {string} 35390 */ 35391 toFormat(dateFormat, { separator = " â " } = {}) { 35392 if (!this.isValid) 35393 return INVALID$1; 35394 return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`; 35395 } 35396 /** 35397 * Return a Duration representing the time spanned by this interval. 35398 * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration. 35399 * @param {Object} opts - options that affect the creation of the Duration 35400 * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use 35401 * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 } 35402 * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 } 35403 * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 } 35404 * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 } 35405 * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 } 35406 * @return {Duration} 35407 */ 35408 toDuration(unit, opts) { 35409 if (!this.isValid) { 35410 return Duration.invalid(this.invalidReason); 35411 } 35412 return this.e.diff(this.s, unit, opts); 35413 } 35414 /** 35415 * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes 35416 * @param {function} mapFn 35417 * @return {Interval} 35418 * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC()) 35419 * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 })) 35420 */ 35421 mapEndpoints(mapFn) { 35422 return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e)); 35423 } 35424} 35425class Info { 35426 /** 35427 * Return whether the specified zone contains a DST. 35428 * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone. 35429 * @return {boolean} 35430 */ 35431 static hasDST(zone = Settings.defaultZone) { 35432 const proto = DateTime.now().setZone(zone).set({ month: 12 }); 35433 return !zone.isUniversal && proto.offset !== proto.set({ month: 6 }).offset; 35434 } 35435 /** 35436 * Return whether the specified zone is a valid IANA specifier. 35437 * @param {string} zone - Zone to check 35438 * @return {boolean} 35439 */ 35440 static isValidIANAZone(zone) { 35441 return IANAZone.isValidZone(zone); 35442 } 35443 /** 35444 * Converts the input into a {@link Zone} instance. 35445 * 35446 * * If `input` is already a Zone instance, it is returned unchanged. 35447 * * If `input` is a string containing a valid time zone name, a Zone instance 35448 * with that name is returned. 35449 * * If `input` is a string that doesn't refer to a known time zone, a Zone 35450 * instance with {@link Zone#isValid} == false is returned. 35451 * * If `input is a number, a Zone instance with the specified fixed offset 35452 * in minutes is returned. 35453 * * If `input` is `null` or `undefined`, the default zone is returned. 35454 * @param {string|Zone|number} [input] - the value to be converted 35455 * @return {Zone} 35456 */ 35457 static normalizeZone(input) { 35458 return normalizeZone(input, Settings.defaultZone); 35459 } 35460 /** 35461 * Return an array of standalone month names. 35462 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat 35463 * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" 35464 * @param {Object} opts - options 35465 * @param {string} [opts.locale] - the locale code 35466 * @param {string} [opts.numberingSystem=null] - the numbering system 35467 * @param {string} [opts.locObj=null] - an existing locale object to use 35468 * @param {string} [opts.outputCalendar='gregory'] - the calendar 35469 * @example Info.months()[0] //=> 'January' 35470 * @example Info.months('short')[0] //=> 'Jan' 35471 * @example Info.months('numeric')[0] //=> '1' 35472 * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.' 35473 * @example Info.months('numeric', { locale: 'ar' })[0] //=> 'Ù¡' 35474 * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'RabiÊ» I' 35475 * @return {Array} 35476 */ 35477 static months(length = "long", { locale: locale2 = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}) { 35478 return (locObj || Locale.create(locale2, numberingSystem, outputCalendar)).months(length); 35479 } 35480 /** 35481 * Return an array of format month names. 35482 * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that 35483 * changes the string. 35484 * See {@link Info#months} 35485 * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" 35486 * @param {Object} opts - options 35487 * @param {string} [opts.locale] - the locale code 35488 * @param {string} [opts.numberingSystem=null] - the numbering system 35489 * @param {string} [opts.locObj=null] - an existing locale object to use 35490 * @param {string} [opts.outputCalendar='gregory'] - the calendar 35491 * @return {Array} 35492 */ 35493 static monthsFormat(length = "long", { locale: locale2 = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}) { 35494 return (locObj || Locale.create(locale2, numberingSystem, outputCalendar)).months(length, true); 35495 } 35496 /** 35497 * Return an array of standalone week names. 35498 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat 35499 * @param {string} [length='long'] - the length of the weekday representation, such as "narrow", "short", "long". 35500 * @param {Object} opts - options 35501 * @param {string} [opts.locale] - the locale code 35502 * @param {string} [opts.numberingSystem=null] - the numbering system 35503 * @param {string} [opts.locObj=null] - an existing locale object to use 35504 * @example Info.weekdays()[0] //=> 'Monday' 35505 * @example Info.weekdays('short')[0] //=> 'Mon' 35506 * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' 35507 * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'Ø§ÙØ§Ø«ÙÙÙ' 35508 * @return {Array} 35509 */ 35510 static weekdays(length = "long", { locale: locale2 = null, numberingSystem = null, locObj = null } = {}) { 35511 return (locObj || Locale.create(locale2, numberingSystem, null)).weekdays(length); 35512 } 35513 /** 35514 * Return an array of format week names. 35515 * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that 35516 * changes the string. 35517 * See {@link Info#weekdays} 35518 * @param {string} [length='long'] - the length of the month representation, such as "narrow", "short", "long". 35519 * @param {Object} opts - options 35520 * @param {string} [opts.locale=null] - the locale code 35521 * @param {string} [opts.numberingSystem=null] - the numbering system 35522 * @param {string} [opts.locObj=null] - an existing locale object to use 35523 * @return {Array} 35524 */ 35525 static weekdaysFormat(length = "long", { locale: locale2 = null, numberingSystem = null, locObj = null } = {}) { 35526 return (locObj || Locale.create(locale2, numberingSystem, null)).weekdays(length, true); 35527 } 35528 /** 35529 * Return an array of meridiems. 35530 * @param {Object} opts - options 35531 * @param {string} [opts.locale] - the locale code 35532 * @example Info.meridiems() //=> [ 'AM', 'PM' ] 35533 * @example Info.meridiems({ locale: 'my' }) //=> [ 'áá¶áááº', 'ááá±' ] 35534 * @return {Array} 35535 */ 35536 static meridiems({ locale: locale2 = null } = {}) { 35537 return Locale.create(locale2).meridiems(); 35538 } 35539 /** 35540 * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian. 35541 * @param {string} [length='short'] - the length of the era representation, such as "short" or "long". 35542 * @param {Object} opts - options 35543 * @param {string} [opts.locale] - the locale code 35544 * @example Info.eras() //=> [ 'BC', 'AD' ] 35545 * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] 35546 * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] 35547 * @return {Array} 35548 */ 35549 static eras(length = "short", { locale: locale2 = null } = {}) { 35550 return Locale.create(locale2, null, "gregory").eras(length); 35551 } 35552 /** 35553 * Return the set of available features in this environment. 35554 * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case. 35555 * Keys: 35556 * * `relative`: whether this environment supports relative time formatting 35557 * @example Info.features() //=> { relative: false } 35558 * @return {Object} 35559 */ 35560 static features() { 35561 return { relative: hasRelative() }; 35562 } 35563} 35564function dayDiff(earlier, later) {
35565 const utcDayStart = (dt) => dt.toUTC(0, { keepLocalTime: true }).startOf("day").valueOf(), ms = utcDayStart(later) - utcDayStart(earlier); 35566 return Math.floor(Duration.fromMillis(ms).as("days")); 35567} 35568function highOrderDiffs(cursor, later, units) { 35569 const differs = [ 35570 ["years", (a, b) => b.year - a.year], 35571 ["quarters", (a, b) => b.quarter - a.quarter + (b.year - a.year) * 4], 35572 ["months", (a, b) => b.month - a.month + (b.year - a.year) * 12], 35573 [ 35574 "weeks", 35575 (a, b) => { 35576 const days = dayDiff(a, b); 35577 return (days - days % 7) / 7; 35578 } 35579 ], 35580 ["days", dayDiff] 35581 ]; 35582 const results = {}; 35583 const earlier = cursor; 35584 let lowestOrder, highWater; 35585 for (const [unit, differ] of differs) { 35586 if (units.indexOf(unit) >= 0) { 35587 lowestOrder = unit; 35588 results[unit] = differ(cursor, later); 35589 highWater = earlier.plus(results); 35590 if (highWater > later) { 35591 results[unit]--; 35592 cursor = earlier.plus(results); 35593 } else { 35594 cursor = highWater; 35595 } 35596 } 35597 } 35598 return [cursor, results, highWater, lowestOrder]; 35599} 35600function diff(earlier, later, units, opts) { 35601 let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units); 35602 const remainingMillis = later - cursor; 35603 const lowerOrderUnits = units.filter( 35604 (u) => ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0 35605 ); 35606 if (lowerOrderUnits.length === 0) { 35607 if (highWater < later) { 35608 highWater = cursor.plus({ [lowestOrder]: 1 }); 35609 } 35610 if (highWater !== cursor) { 35611 results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor); 35612 } 35613 } 35614 const duration2 = Duration.fromObject(results, opts); 35615 if (lowerOrderUnits.length > 0) { 35616 return Duration.fromMillis(remainingMillis, opts).shiftTo(...lowerOrderUnits).plus(duration2); 35617 } else { 35618 return duration2; 35619 } 35620} 35621const numberingSystems = { 35622 arab: "[Ù -Ù©]", 35623 arabext: "[Û°-Û¹]", 35624 bali: "[á-á]", 35625 beng: "[০-৯]", 35626 deva: "[०-९]", 35627 fullwide: "[ï¼-ï¼]", 35628 gujr: "[૦-૯]", 35629 hanidec: "[ã|ä¸|äº|ä¸|å|äº|å |ä¸|å «|ä¹]", 35630 khmr: "[á -á©]", 35631 knda: "[೦-೯]", 35632 laoo: "[à»-à»]", 35633 limb: "[á¥-á¥]", 35634 mlym: "[൦-൯]", 35635 mong: "[á -á ]", 35636 mymr: "[á-á]", 35637 orya: "[à¦-à¯]", 35638 tamldec: "[௦-௯]", 35639 telu: "[౦-౯]", 35640 thai: "[à¹-à¹]", 35641 tibt: "[༠-༩]", 35642 latn: "\\d" 35643}; 35644const numberingSystemsUTF16 = { 35645 arab: [1632, 1641], 35646 arabext: [1776, 1785], 35647 bali: [6992, 7001], 35648 beng: [2534, 2543], 35649 deva: [2406, 2415], 35650 fullwide: [65296, 65303], 35651 gujr: [2790, 2799], 35652 khmr: [6112, 6121], 35653 knda: [3302, 3311], 35654 laoo: [3792, 3801], 35655 limb: [6470, 6479], 35656 mlym: [3430, 3439], 35657 mong: [6160, 6169], 35658 mymr: [4160, 4169], 35659 orya: [2918, 2927], 35660 tamldec: [3046, 3055], 35661 telu: [3174, 3183], 35662 thai: [3664, 3673], 35663 tibt: [3872, 3881] 35664}; 35665const hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split(""); 35666function parseDigits(str) { 35667 let value = parseInt(str, 10); 35668 if (isNaN(value)) { 35669 value = ""; 35670 for (let i = 0; i < str.length; i++) { 35671 const code = str.charCodeAt(i); 35672 if (str[i].search(numberingSystems.hanidec) !== -1) { 35673 value += hanidecChars.indexOf(str[i]); 35674 } else { 35675 for (const key in numberingSystemsUTF16) { 35676 const [min, max] = numberingSystemsUTF16[key]; 35677 if (code >= min && code <= max) { 35678 value += code - min; 35679 } 35680 } 35681 } 35682 } 35683 return parseInt(value, 10); 35684 } else { 35685 return value; 35686 } 35687} 35688function digitRegex({ numberingSystem }, append = "") { 35689 return new RegExp(`${numberingSystems[numberingSystem || "latn"]}${append}`); 35690} 35691const MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support"; 35692function intUnit(regex, post = (i) => i) { 35693 return { regex, deser: ([s2]) => post(parseDigits(s2)) }; 35694} 35695const NBSP = String.fromCharCode(160); 35696const spaceOrNBSP = `[ ${NBSP}]`; 35697const spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g"); 35698function fixListRegex(s2) { 35699 return s2.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP); 35700} 35701function stripInsensitivities(s2) { 35702 return s2.replace(/\./g, "").replace(spaceOrNBSPRegExp, " ").toLowerCase(); 35703} 35704function oneOf(strings, startIndex) { 35705 if (strings === null) { 35706 return null; 35707 } else { 35708 return { 35709 regex: RegExp(strings.map(fixListRegex).join("|")), 35710 deser: ([s2]) => strings.findIndex((i) => stripInsensitivities(s2) === stripInsensitivities(i)) + startIndex 35711 }; 35712 } 35713} 35714function offset(regex, groups) { 35715 return { regex, deser: ([, h2, m]) => signedOffset(h2, m), groups }; 35716} 35717function simple(regex) { 35718 return { regex, deser: ([s2]) => s2 }; 35719} 35720function escapeToken(value) { 35721 return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); 35722} 35723function unitForToken(token, loc) { 35724 const one = digitRegex(loc), two = digitRegex(loc, "{2}"), three = digitRegex(loc, "{3}"), four = digitRegex(loc, "{4}"), six = digitRegex(loc, "{6}"), oneOrTwo = digitRegex(loc, "{1,2}"), oneToThree = digitRegex(loc, "{1,3}"), oneToSix = digitRegex(loc, "{1,6}"), oneToNine = digitRegex(loc, "{1,9}"), twoToFour = digitRegex(loc, "{2,4}"), fourToSix = digitRegex(loc, "{4,6}"), literal = (t) => ({ regex: RegExp(escapeToken(t.val)), deser: ([s2]) => s2, literal: true }), unitate = (t) => { 35725 if (token.literal) { 35726 return literal(t); 35727 } 35728 switch (t.val) { 35729 case "G": 35730 return oneOf(loc.eras("short", false), 0); 35731 case "GG": 35732 return oneOf(loc.eras("long", false), 0); 35733 case "y": 35734 return intUnit(oneToSix); 35735 case "yy": 35736 return intUnit(twoToFour, untruncateYear); 35737 case "yyyy": 35738 return intUnit(four); 35739 case "yyyyy": 35740 return intUnit(fourToSix); 35741 case "yyyyyy": 35742 return intUnit(six); 35743 case "M": 35744 return intUnit(oneOrTwo); 35745 case "MM": 35746 return intUnit(two); 35747 case "MMM": 35748 return oneOf(loc.months("short", true, false), 1); 35749 case "MMMM": 35750 return oneOf(loc.months("long", true, false), 1); 35751 case "L": 35752 return intUnit(oneOrTwo); 35753 case "LL": 35754 return intUnit(two); 35755 case "LLL": 35756 return oneOf(loc.months("short", false, false), 1); 35757 case "LLLL": 35758 return oneOf(loc.months("long", false, false), 1); 35759 case "d": 35760 return intUnit(oneOrTwo); 35761 case "dd": 35762 return intUnit(two); 35763 case "o": 35764 return intUnit(oneToThree); 35765 case "ooo": 35766 return intUnit(three); 35767 case "HH": 35768 return intUnit(two); 35769 case "H": 35770 return intUnit(oneOrTwo); 35771 case "hh": 35772 return intUnit(two); 35773 case "h": 35774 return intUnit(oneOrTwo); 35775 case "mm": 35776 return intUnit(two); 35777 case "m": 35778 return intUnit(oneOrTwo); 35779 case "q": 35780 return intUnit(oneOrTwo); 35781 case "qq": 35782 return intUnit(two); 35783 case "s": 35784 return intUnit(oneOrTwo); 35785 case "ss": 35786 return intUnit(two); 35787 case "S": 35788 return intUnit(oneToThree); 35789 case "SSS": 35790 return intUnit(three); 35791 case "u": 35792 return simple(oneToNine); 35793 case "uu": 35794 return simple(oneOrTwo); 35795 case "uuu": 35796 return intUnit(one); 35797 case "a": 35798 return oneOf(loc.meridiems(), 0); 35799 case "kkkk": 35800 return intUnit(four); 35801 case "kk": 35802 return intUnit(twoToFour, untruncateYear); 35803 case "W": 35804 return intUnit(oneOrTwo); 35805 case "WW": 35806 return intUnit(two); 35807 case "E": 35808 case "c": 35809 return intUnit(one); 35810 case "EEE": 35811 return oneOf(loc.weekdays("short", false, false), 1); 35812 case "EEEE": 35813 return oneOf(loc.weekdays("long", false, false), 1); 35814 case "ccc": 35815 return oneOf(loc.weekdays("short", true, false), 1); 35816 case "cccc": 35817 return oneOf(loc.weekdays("long", true, false), 1); 35818 case "Z": 35819 case "ZZ": 35820 return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2); 35821 case "ZZZ": 35822 return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2); 35823 case "z": 35824 return simple(/[a-z_+-/]{1,256}?/i); 35825 case " ": 35826 return simple(/[^\S\n\r]/); 35827 default: 35828 return literal(t); 35829 } 35830 }; 35831 const unit = unitate(token) || { 35832 invalidReason: MISSING_FTP 35833 }; 35834 unit.token = token; 35835 return unit; 35836} 35837const partTypeStyleToTokenVal = { 35838 year: { 35839 "2-digit": "yy", 35840 numeric: "yyyyy" 35841 }, 35842 month: { 35843 numeric: "M", 35844 "2-digit": "MM", 35845 short: "MMM", 35846 long: "MMMM" 35847 }, 35848 day: { 35849 numeric: "d", 35850 "2-digit": "dd" 35851 }, 35852 weekday: { 35853 short: "EEE", 35854 long: "EEEE" 35855 }, 35856 dayperiod: "a", 35857 dayPeriod: "a", 35858 hour: { 35859 numeric: "h", 35860 "2-digit": "hh" 35861 }, 35862 minute: { 35863 numeric: "m", 35864 "2-digit": "mm" 35865 }, 35866 second: { 35867 numeric: "s", 35868 "2-digit": "ss" 35869 }, 35870 timeZoneName: { 35871 long: "ZZZZZ", 35872 short: "ZZZ" 35873 } 35874}; 35875function tokenForPart(part, formatOpts) { 35876 const { type: type4, value } = part;
vendor: 3,612 bytes, lines 35877-36014
35877 if (type4 === "literal") { 35878 const isSpace = /^\s+$/.test(value); 35879 return { 35880 literal: !isSpace, 35881 val: isSpace ? " " : value 35882 }; 35883 } 35884 const style2 = formatOpts[type4]; 35885 let val = partTypeStyleToTokenVal[type4]; 35886 if (typeof val === "object") { 35887 val = val[style2]; 35888 } 35889 if (val) { 35890 return { 35891 literal: false, 35892 val 35893 }; 35894 } 35895 return void 0; 35896} 35897function buildRegex(units) { 35898 const re = units.map((u) => u.regex).reduce((f, r) => `${f}(${r.source})`, ""); 35899 return [`^${re}$`, units]; 35900} 35901function match(input, regex, handlers) { 35902 const matches2 = input.match(regex); 35903 if (matches2) { 35904 const all2 = {}; 35905 let matchIndex = 1; 35906 for (const i in handlers) { 35907 if (hasOwnProperty(handlers, i)) { 35908 const h2 = handlers[i], groups = h2.groups ? h2.groups + 1 : 1; 35909 if (!h2.literal && h2.token) { 35910 all2[h2.token.val[0]] = h2.deser(matches2.slice(matchIndex, matchIndex + groups)); 35911 } 35912 matchIndex += groups; 35913 } 35914 } 35915 return [matches2, all2]; 35916 } else { 35917 return [matches2, {}]; 35918 } 35919} 35920function dateTimeFromMatches(matches2) { 35921 const toField = (token) => { 35922 switch (token) { 35923 case "S": 35924 return "millisecond"; 35925 case "s": 35926 return "second"; 35927 case "m": 35928 return "minute"; 35929 case "h": 35930 case "H": 35931 return "hour"; 35932 case "d": 35933 return "day"; 35934 case "o": 35935 return "ordinal"; 35936 case "L": 35937 case "M": 35938 return "month"; 35939 case "y": 35940 return "year"; 35941 case "E": 35942 case "c": 35943 return "weekday"; 35944 case "W": 35945 return "weekNumber"; 35946 case "k": 35947 return "weekYear"; 35948 case "q": 35949 return "quarter"; 35950 default: 35951 return null; 35952 } 35953 }; 35954 let zone = null; 35955 let specificOffset; 35956 if (!isUndefined$1(matches2.z)) { 35957 zone = IANAZone.create(matches2.z); 35958 } 35959 if (!isUndefined$1(matches2.Z)) { 35960 if (!zone) { 35961 zone = new FixedOffsetZone(matches2.Z); 35962 } 35963 specificOffset = matches2.Z; 35964 } 35965 if (!isUndefined$1(matches2.q)) { 35966 matches2.M = (matches2.q - 1) * 3 + 1; 35967 } 35968 if (!isUndefined$1(matches2.h)) { 35969 if (matches2.h < 12 && matches2.a === 1) { 35970 matches2.h += 12; 35971 } else if (matches2.h === 12 && matches2.a === 0) { 35972 matches2.h = 0; 35973 } 35974 } 35975 if (matches2.G === 0 && matches2.y) { 35976 matches2.y = -matches2.y; 35977 } 35978 if (!isUndefined$1(matches2.u)) { 35979 matches2.S = parseMillis(matches2.u); 35980 } 35981 const vals = Object.keys(matches2).reduce((r, k) => { 35982 const f = toField(k); 35983 if (f) { 35984 r[f] = matches2[k]; 35985 } 35986 return r; 35987 }, {}); 35988 return [vals, zone, specificOffset]; 35989} 35990let dummyDateTimeCache = null; 35991function getDummyDateTime() { 35992 if (!dummyDateTimeCache) { 35993 dummyDateTimeCache = DateTime.fromMillis(1555555555555); 35994 } 35995 return dummyDateTimeCache; 35996} 35997function maybeExpandMacroToken(token, locale2) { 35998 if (token.literal) { 35999 return token; 36000 } 36001 const formatOpts = Formatter.macroTokenToFormatOpts(token.val); 36002 const tokens = formatOptsToTokens(formatOpts, locale2); 36003 if (tokens == null || tokens.includes(void 0)) { 36004 return token; 36005 } 36006 return tokens; 36007} 36008function expandMacroTokens(tokens, locale2) { 36009 return Array.prototype.concat(...tokens.map((t) => maybeExpandMacroToken(t, locale2))); 36010} 36011function explainFromTokens(locale2, input, format2) { 36012 const tokens = expandMacroTokens(Formatter.parseFormat(format2), locale2), units = tokens.map((t) => unitForToken(t, locale2)), disqualifyingUnit = units.find((t) => t.invalidReason); 36013 if (disqualifyingUnit) { 36014 return { input, tokens, invalidReason: disqualifyingUnit.invali
36014dReason }; 36015 } else { 36016 const [regexString, handlers] = buildRegex(units), regex = RegExp(regexString, "i"), [rawMatches, matches2] = match(input, regex, handlers), [result, zone, specificOffset] = matches2 ? dateTimeFromMatches(matches2) : [null, null, void 0]; 36017 if (hasOwnProperty(matches2, "a") && hasOwnProperty(matches2, "H")) { 36018 throw new ConflictingSpecificationError( 36019 "Can't include meridiem when specifying 24-hour format" 36020 ); 36021 } 36022 return { input, tokens, regex, rawMatches, matches: matches2, result, zone, specificOffset }; 36023 } 36024} 36025function parseFromTokens(locale2, input, format2) { 36026 const { result, zone, specificOffset, invalidReason } = explainFromTokens(locale2, input, format2); 36027 return [result, zone, specificOffset, invalidReason]; 36028} 36029function formatOptsToTokens(formatOpts, locale2) { 36030 if (!formatOpts) { 36031 return null; 36032 } 36033 const formatter = Formatter.create(locale2, formatOpts); 36034 const parts = formatter.formatDateTimeParts(getDummyDateTime()); 36035 return parts.map((p2) => tokenForPart(p2, formatOpts)); 36036} 36037const nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; 36038function unitOutOfRange(unit, value) { 36039 return new Invalid( 36040 "unit out of range", 36041 `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid` 36042 ); 36043} 36044function dayOfWeek(year, month, day) { 36045 const d = new Date(Date.UTC(year, month - 1, day)); 36046 if (year < 100 && year >= 0) { 36047 d.setUTCFullYear(d.getUTCFullYear() - 1900); 36048 } 36049 const js = d.getUTCDay(); 36050 return js === 0 ? 7 : js; 36051} 36052function computeOrdinal(year, month, day) { 36053 return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1]; 36054} 36055function uncomputeOrdinal(year, ordinal) { 36056 const table = isLeapYear(year) ? leapLadder : nonLeapLadder, month0 = table.findIndex((i) => i < ordinal), day = ordinal - table[month0]; 36057 return { month: month0 + 1, day }; 36058} 36059function gregorianToWeek(gregObj) { 36060 const { year, month, day } = gregObj, ordinal = computeOrdinal(year, month, day), weekday = dayOfWeek(year, month, day); 36061 let weekNumber = Math.floor((ordinal - weekday + 10) / 7), weekYear; 36062 if (weekNumber < 1) { 36063 weekYear = year - 1; 36064 weekNumber = weeksInWeekYear(weekYear); 36065 } else if (weekNumber > weeksInWeekYear(year)) { 36066 weekYear = year + 1; 36067 weekNumber = 1; 36068 } else { 36069 weekYear = year; 36070 } 36071 return { weekYear, weekNumber, weekday, ...timeObject(gregObj) }; 36072} 36073function weekToGregorian(weekData) { 36074 const { weekYear, weekNumber, weekday } = weekData, weekdayOfJan4 = dayOfWeek(weekYear, 1, 4), yearInDays = daysInYear(weekYear); 36075 let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3, year; 36076 if (ordinal < 1) { 36077 year = weekYear - 1; 36078 ordinal += daysInYear(year); 36079 } else if (ordinal > yearInDays) { 36080 year = weekYear + 1; 36081 ordinal -= daysInYear(weekYear); 36082 } else { 36083 year = weekYear; 36084 } 36085 const { month, day } = uncomputeOrdinal(year, ordinal); 36086 return { year, month, day, ...timeObject(weekData) }; 36087} 36088function gregorianToOrdinal(gregData) { 36089 const { year, month, day } = gregData; 36090 const ordinal = computeOrdinal(year, month, day); 36091 return { year, ordinal, ...timeObject(gregData) }; 36092} 36093function ordinalToGregorian(ordinalData) { 36094 const { year, ordinal } = ordinalData; 36095 const { month, day } = uncomputeOrdinal(year, ordinal); 36096 return { year, month, day, ...timeObject(ordinalData) }; 36097} 36098function hasInvalidWeekData(obj) { 36099 const validYear = isInteger(obj.weekYear), validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)), validWeekday = integerBetween(obj.weekday, 1, 7); 36100 if (!validYear) { 36101 return unitOutOfRange("weekYear", obj.weekYear); 36102 } else if (!validWeek) { 36103 return unitOutOfRange("week", obj.week); 36104 } else if (!validWeekday) { 36105 return unitOutOfRange("weekday", obj.weekday); 36106 } else 36107 return false; 36108} 36109function hasInvalidOrdinalData(obj) { 36110 const validYear = isInteger(obj.year), validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year)); 36111 if (!validYear) { 36112 return unitOutOfRange("year", obj.year); 36113 } else if (!validOrdinal) { 36114 return unitOutOfRange("ordinal", obj.ordinal); 36115 } else 36116 return false;
vendor: 1,574 bytes, lines 36117-36160
36117} 36118function hasInvalidGregorianData(obj) { 36119 const validYear = isInteger(obj.year), validMonth = integerBetween(obj.month, 1, 12), validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); 36120 if (!validYear) { 36121 return unitOutOfRange("year", obj.year); 36122 } else if (!validMonth) { 36123 return unitOutOfRange("month", obj.month); 36124 } else if (!validDay) { 36125 return unitOutOfRange("day", obj.day); 36126 } else 36127 return false; 36128} 36129function hasInvalidTimeData(obj) { 36130 const { hour, minute, second, millisecond } = obj; 36131 const validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, validMinute = integerBetween(minute, 0, 59), validSecond = integerBetween(second, 0, 59), validMillisecond = integerBetween(millisecond, 0, 999); 36132 if (!validHour) { 36133 return unitOutOfRange("hour", hour); 36134 } else if (!validMinute) { 36135 return unitOutOfRange("minute", minute); 36136 } else if (!validSecond) { 36137 return unitOutOfRange("second", second); 36138 } else if (!validMillisecond) { 36139 return unitOutOfRange("millisecond", millisecond); 36140 } else 36141 return false; 36142} 36143const INVALID = "Invalid DateTime"; 36144const MAX_DATE = 864e13; 36145function unsupportedZone(zone) { 36146 return new Invalid("unsupported zone", `the zone "${zone.name}" is not supported`); 36147} 36148function possiblyCachedWeekData(dt) { 36149 if (dt.weekData === null) { 36150 dt.weekData = gregorianToWeek(dt.c); 36151 } 36152 return dt.weekData; 36153} 36154function clone(inst, alts) { 36155 const current = { 36156 ts: inst.ts, 36157 zone: inst.zone, 36158 c: inst.c, 36159 o: inst.o, 36160 loc: inst.loc,
vendor: 3,927 bytes, lines 36161-36293
36161 invalid: inst.invalid 36162 }; 36163 return new DateTime({ ...current, ...alts, old: current }); 36164} 36165function fixOffset(localTS, o, tz) { 36166 let utcGuess = localTS - o * 60 * 1e3; 36167 const o2 = tz.offset(utcGuess); 36168 if (o === o2) { 36169 return [utcGuess, o]; 36170 } 36171 utcGuess -= (o2 - o) * 60 * 1e3; 36172 const o3 = tz.offset(utcGuess); 36173 if (o2 === o3) { 36174 return [utcGuess, o2]; 36175 } 36176 return [localTS - Math.min(o2, o3) * 60 * 1e3, Math.max(o2, o3)]; 36177} 36178function tsToObj(ts, offset2) { 36179 ts += offset2 * 60 * 1e3; 36180 const d = new Date(ts); 36181 return { 36182 year: d.getUTCFullYear(), 36183 month: d.getUTCMonth() + 1, 36184 day: d.getUTCDate(), 36185 hour: d.getUTCHours(), 36186 minute: d.getUTCMinutes(), 36187 second: d.getUTCSeconds(), 36188 millisecond: d.getUTCMilliseconds() 36189 }; 36190} 36191function objToTS(obj, offset2, zone) { 36192 return fixOffset(objToLocalTS(obj), offset2, zone); 36193} 36194function adjustTime(inst, dur) { 36195 const oPre = inst.o, year = inst.c.year + Math.trunc(dur.years), month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3, c2 = { 36196 ...inst.c, 36197 year, 36198 month, 36199 day: Math.min(inst.c.day, daysInMonth(year, month)) + Math.trunc(dur.days) + Math.trunc(dur.weeks) * 7 36200 }, millisToAdd = Duration.fromObject({ 36201 years: dur.years - Math.trunc(dur.years), 36202 quarters: dur.quarters - Math.trunc(dur.quarters), 36203 months: dur.months - Math.trunc(dur.months), 36204 weeks: dur.weeks - Math.trunc(dur.weeks), 36205 days: dur.days - Math.trunc(dur.days), 36206 hours: dur.hours, 36207 minutes: dur.minutes, 36208 seconds: dur.seconds, 36209 milliseconds: dur.milliseconds 36210 }).as("milliseconds"), localTS = objToLocalTS(c2); 36211 let [ts, o] = fixOffset(localTS, oPre, inst.zone); 36212 if (millisToAdd !== 0) { 36213 ts += millisToAdd; 36214 o = inst.zone.offset(ts); 36215 } 36216 return { ts, o }; 36217} 36218function parseDataToDateTime(parsed, parsedZone, opts, format2, text, specificOffset) { 36219 const { setZone, zone } = opts; 36220 if (parsed && Object.keys(parsed).length !== 0 || parsedZone) { 36221 const interpretationZone = parsedZone || zone, inst = DateTime.fromObject(parsed, { 36222 ...opts, 36223 zone: interpretationZone, 36224 specificOffset 36225 }); 36226 return setZone ? inst : inst.setZone(zone); 36227 } else { 36228 return DateTime.invalid( 36229 new Invalid("unparsable", `the input "${text}" can't be parsed as ${format2}`) 36230 ); 36231 } 36232} 36233function toTechFormat(dt, format2, allowZ = true) { 36234 return dt.isValid ? Formatter.create(Locale.create("en-US"), { 36235 allowZ, 36236 forceSimple: true 36237 }).formatDateTimeFromString(dt, format2) : null; 36238} 36239function toISODate(o, extended) { 36240 const longFormat = o.c.year > 9999 || o.c.year < 0; 36241 let c2 = ""; 36242 if (longFormat && o.c.year >= 0) 36243 c2 += "+"; 36244 c2 += padStart(o.c.year, longFormat ? 6 : 4); 36245 if (extended) { 36246 c2 += "-"; 36247 c2 += padStart(o.c.month); 36248 c2 += "-"; 36249 c2 += padStart(o.c.day); 36250 } else { 36251 c2 += padStart(o.c.month); 36252 c2 += padStart(o.c.day); 36253 } 36254 return c2; 36255} 36256function toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone) { 36257 let c2 = padStart(o.c.hour); 36258 if (extended) { 36259 c2 += ":"; 36260 c2 += padStart(o.c.minute); 36261 if (o.c.second !== 0 || !suppressSeconds) { 36262 c2 += ":"; 36263 } 36264 } else { 36265 c2 += padStart(o.c.minute); 36266 } 36267 if (o.c.second !== 0 || !suppressSeconds) { 36268 c2 += padStart(o.c.second); 36269 if (o.c.millisecond !== 0 || !suppressMilliseconds) { 36270 c2 += "."; 36271 c2 += padStart(o.c.millisecond, 3); 36272 } 36273 } 36274 if (includeOffset) { 36275 if (o.isOffsetFixed && o.offset === 0 && !extendedZone) { 36276 c2 += "Z"; 36277 } else if (o.o < 0) { 36278 c2 += "-"; 36279 c2 += padStart(Math.trunc(-o.o / 60)); 36280 c2 += ":"; 36281 c2 += padStart(Math.trunc(-o.o % 60)); 36282 } else { 36283 c2 += "+"; 36284 c2 += padStart(Math.trunc(o.o / 60)); 36285 c2 += ":"; 36286 c2 += padStart(Math.trunc(o.o % 60)); 36287 } 36288 } 36289 if (extendedZone) { 36290 c2 += "[" + o.zone.ianaName + "]"; 36291 } 36292 return c2; 36293}
36294const defaultUnitValues = { 36295 month: 1, 36296 day: 1, 36297 hour: 0, 36298 minute: 0, 36299 second: 0, 36300 millisecond: 0 36301}, defaultWeekUnitValues = { 36302 weekNumber: 1, 36303 weekday: 1, 36304 hour: 0, 36305 minute: 0, 36306 second: 0, 36307 millisecond: 0 36308}, defaultOrdinalUnitValues = { 36309 ordinal: 1, 36310 hour: 0, 36311 minute: 0, 36312 second: 0, 36313 millisecond: 0 36314}; 36315const orderedUnits = ["year", "month", "day", "hour", "minute", "second", "millisecond"], orderedWeekUnits = [ 36316 "weekYear", 36317 "weekNumber", 36318 "weekday", 36319 "hour", 36320 "minute", 36321 "second", 36322 "millisecond" 36323], orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; 36324function normalizeUnit(unit) { 36325 const normalized = { 36326 year: "year", 36327 years: "year", 36328 month: "month", 36329 months: "month", 36330 day: "day", 36331 days: "day", 36332 hour: "hour", 36333 hours: "hour", 36334 minute: "minute", 36335 minutes: "minute", 36336 quarter: "quarter", 36337 quarters: "quarter", 36338 second: "second", 36339 seconds: "second", 36340 millisecond: "millisecond", 36341 milliseconds: "millisecond", 36342 weekday: "weekday", 36343 weekdays: "weekday", 36344 weeknumber: "weekNumber", 36345 weeksnumber: "weekNumber", 36346 weeknumbers: "weekNumber", 36347 weekyear: "weekYear", 36348 weekyears: "weekYear", 36349 ordinal: "ordinal" 36350 }[unit.toLowerCase()]; 36351 if (!normalized) 36352 throw new InvalidUnitError(unit); 36353 return normalized; 36354} 36355function quickDT(obj, opts) { 36356 const zone = normalizeZone(opts.zone, Settings.defaultZone), loc = Locale.fromObject(opts), tsNow = Settings.now(); 36357 let ts, o; 36358 if (!isUndefined$1(obj.year)) { 36359 for (const u of orderedUnits) { 36360 if (isUndefined$1(obj[u])) {
vendor: 5,348 bytes, lines 36361-36485
36361 obj[u] = defaultUnitValues[u]; 36362 } 36363 } 36364 const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); 36365 if (invalid) { 36366 return DateTime.invalid(invalid); 36367 } 36368 const offsetProvis = zone.offset(tsNow); 36369 [ts, o] = objToTS(obj, offsetProvis, zone); 36370 } else { 36371 ts = tsNow; 36372 } 36373 return new DateTime({ ts, zone, loc, o }); 36374} 36375function diffRelative(start, end, opts) { 36376 const round = isUndefined$1(opts.round) ? true : opts.round, format2 = (c2, unit) => { 36377 c2 = roundTo(c2, round || opts.calendary ? 0 : 2, true); 36378 const formatter = end.loc.clone(opts).relFormatter(opts); 36379 return formatter.format(c2, unit); 36380 }, differ = (unit) => { 36381 if (opts.calendary) { 36382 if (!end.hasSame(start, unit)) { 36383 return end.startOf(unit).diff(start.startOf(unit), unit).get(unit); 36384 } else 36385 return 0; 36386 } else { 36387 return end.diff(start, unit).get(unit); 36388 } 36389 }; 36390 if (opts.unit) { 36391 return format2(differ(opts.unit), opts.unit); 36392 } 36393 for (const unit of opts.units) { 36394 const count = differ(unit); 36395 if (Math.abs(count) >= 1) { 36396 return format2(count, unit); 36397 } 36398 } 36399 return format2(start > end ? -0 : 0, opts.units[opts.units.length - 1]); 36400} 36401function lastOpts(argList) { 36402 let opts = {}, args; 36403 if (argList.length > 0 && typeof argList[argList.length - 1] === "object") { 36404 opts = argList[argList.length - 1]; 36405 args = Array.from(argList).slice(0, argList.length - 1); 36406 } else { 36407 args = Array.from(argList); 36408 } 36409 return [opts, args]; 36410} 36411class DateTime { 36412 /** 36413 * @access private 36414 */ 36415 constructor(config) { 36416 const zone = config.zone || Settings.defaultZone; 36417 let invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null); 36418 this.ts = isUndefined$1(config.ts) ? Settings.now() : config.ts; 36419 let c2 = null, o = null; 36420 if (!invalid) { 36421 const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone); 36422 if (unchanged) { 36423 [c2, o] = [config.old.c, config.old.o]; 36424 } else { 36425 const ot = zone.offset(this.ts); 36426 c2 = tsToObj(this.ts, ot); 36427 invalid = Number.isNaN(c2.year) ? new Invalid("invalid input") : null; 36428 c2 = invalid ? null : c2; 36429 o = invalid ? null : ot; 36430 } 36431 } 36432 this._zone = zone; 36433 this.loc = config.loc || Locale.create(); 36434 this.invalid = invalid; 36435 this.weekData = null; 36436 this.c = c2; 36437 this.o = o; 36438 this.isLuxonDateTime = true; 36439 } 36440 // CONSTRUCT 36441 /** 36442 * Create a DateTime for the current instant, in the system's time zone. 36443 * 36444 * Use Settings to override these default values if needed. 36445 * @example DateTime.now().toISO() //~> now in the ISO format 36446 * @return {DateTime} 36447 */ 36448 static now() { 36449 return new DateTime({}); 36450 } 36451 /** 36452 * Create a local DateTime 36453 * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used 36454 * @param {number} [month=1] - The month, 1-indexed 36455 * @param {number} [day=1] - The day of the month, 1-indexed 36456 * @param {number} [hour=0] - The hour of the day, in 24-hour time 36457 * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 36458 * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 36459 * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 36460 * @example DateTime.local() //~> now 36461 * @example DateTime.local({ zone: "America/New_York" }) //~> now, in US east coast time 36462 * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 36463 * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 36464 * @example DateTime.local(2017, 3, 12, { locale: "fr" }) //~> 2017-03-12T00:00:00, with a French locale 36465 * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 36466 * @example DateTime.local(2017, 3, 12, 5, { zone: "utc" }) //~> 2017-03-12T05:00:00, in UTC 36467 * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 36468 * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 36469 * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 36470 * @return {DateTime} 36471 */ 36472 static local() { 36473 const [opts, args] = lastOpts(arguments), [year, month, day, hour, minute, second, millisecond] = args; 36474 return quickDT({ year, month, day, hour, minute, second, millisecond }, opts); 36475 } 36476 /** 36477 * Create a DateTime in UTC 36478 * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used 36479 * @param {number} [month=1] - The month, 1-indexed 36480 * @param {number} [day=1] - The day of the month 36481 * @param {number} [hour=0] - The hour of the day, in 24-hour time 36482 * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 36483 * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 36484 * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 36485 * @param {Object} options - configuration options for the DateTime
36486 * @param {string} [options.locale] - a locale to set on the resulting DateTime instance 36487 * @param {string} [options.outputCalendar] - the output calendar to set on the resulting DateTime instance 36488 * @param {string} [options.numberingSystem] - the numbering system to set on the resulting DateTime instance 36489 * @example DateTime.utc() //~> now 36490 * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z 36491 * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z 36492 * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z 36493 * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z 36494 * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z 36495 * @example DateTime.utc(2017, 3, 12, 5, 45, { locale: "fr" }) //~> 2017-03-12T05:45:00Z with a French locale 36496 * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z 36497 * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765, { locale: "fr" }) //~> 2017-03-12T05:45:10.765Z with a French locale 36498 * @return {DateTime} 36499 */ 36500 static utc() { 36501 const [opts, args] = lastOpts(arguments), [year, month, day, hour, minute, second, millisecond] = args; 36502 opts.zone = FixedOffsetZone.utcInstance; 36503 return quickDT({ year, month, day, hour, minute, second, millisecond }, opts); 36504 } 36505 /** 36506 * Create a DateTime from a JavaScript Date object. Uses the default zone. 36507 * @param {Date} date - a JavaScript Date object 36508 * @param {Object} options - configuration options for the DateTime 36509 * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into 36510 * @return {DateTime} 36511 */ 36512 static fromJSDate(date4, options = {}) { 36513 const ts = isDate$1(date4) ? date4.valueOf() : NaN; 36514 if (Number.isNaN(ts)) { 36515 return DateTime.invalid("invalid input"); 36516 } 36517 const zoneToUse = normalizeZone(options.zone, Settings.defaultZone); 36518 if (!zoneToUse.isValid) { 36519 return DateTime.invalid(unsupportedZone(zoneToUse)); 36520 } 36521 return new DateTime({ 36522 ts, 36523 zone: zoneToUse, 36524 loc: Locale.fromObject(options) 36525 }); 36526 } 36527 /** 36528 * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. 36529 * @param {number} milliseconds - a number of milliseconds since 1970 UTC 36530 * @param {Object} options - configuration options for the DateTime 36531 * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into 36532 * @param {string} [options.locale] - a locale to set on the resulting DateTime instance 36533 * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance 36534 * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance 36535 * @return {DateTime} 36536 */ 36537 static fromMillis(milliseconds, options = {}) { 36538 if (!isNumber$1(milliseconds)) { 36539 throw new InvalidArgumentError( 36540 `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}` 36541 ); 36542 } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) { 36543 return DateTime.invalid("Timestamp out of range"); 36544 } else { 36545 return new DateTime({ 36546 ts: milliseconds, 36547 zone: normalizeZone(options.zone, Settings.defaultZone), 36548 loc: Locale.fromObject(options) 36549 }); 36550 } 36551 } 36552 /** 36553 * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. 36554 * @param {number} seconds - a number of seconds since 1970 UTC 36555 * @param {Object} options - configuration options for the DateTime 36556 * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into 36557 * @param {string} [options.locale] - a locale to set on the resulting DateTime instance 36558 * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance 36559 * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance 36560 * @return {DateTime} 36561 */ 36562 static fromSeconds(seconds, options = {}) { 36563 if (!isNumber$1(seconds)) { 36564 throw new InvalidArgumentError("fromSeconds requires a numerical input"); 36565 } else { 36566 return new DateTime({ 36567 ts: seconds * 1e3, 36568 zone: normalizeZone(options.zone, Settings.defaultZone), 36569 loc: Locale.fromObject(options) 36570 }); 36571 } 36572 } 36573 /** 36574 * Create a DateTime from a JavaScript object with keys like 'year' and 'hour' with reasonable defaults. 36575 * @param {Object} obj - the object to create the DateTime from 36576 * @param {number} obj.year - a year, such as 1987 36577 * @param {number} obj.month - a month, 1-12 36578 * @param {number} obj.day - a day of the month, 1-31, depending on the month 36579 * @param {number} obj.ordinal - day of the year, 1-365 or 366 36580 * @param {number} obj.weekYear - an ISO week year 36581 * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year 36582 * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday 36583 * @param {number} obj.hour - hour of the day, 0-23 36584 * @param {number} obj.minute - minute of the hour, 0-59 36585 * @param {number} obj.second - second of the minute, 0-59 36586 * @param {number} obj.millisecond - millisecond of the second, 0-999 36587 * @param {Object} opts - options for creating this DateTime
36588 * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone() 36589 * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance 36590 * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance 36591 * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance 36592 * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' 36593 * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' 36594 * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 36595 * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'utc' }), 36596 * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' }) 36597 * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' }) 36598 * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' 36599 * @return {DateTime} 36600 */ 36601 static fromObject(obj, opts = {}) { 36602 obj = obj || {}; 36603 const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone); 36604 if (!zoneToUse.isValid) { 36605 return DateTime.invalid(unsupportedZone(zoneToUse)); 36606 } 36607 const tsNow = Settings.now(), offsetProvis = !isUndefined$1(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow), normalized = normalizeObject(obj, normalizeUnit), containsOrdinal = !isUndefined$1(normalized.ordinal), containsGregorYear = !isUndefined$1(normalized.year), containsGregorMD = !isUndefined$1(normalized.month) || !isUndefined$1(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber, loc = Locale.fromObject(opts); 36608 if ((containsGregor || containsOrdinal) && definiteWeekDef) { 36609 throw new ConflictingSpecificationError( 36610 "Can't mix weekYear/weekNumber units with year/month/day or ordinals" 36611 ); 36612 } 36613 if (containsGregorMD && containsOrdinal) { 36614 throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); 36615 } 36616 const useWeekData = definiteWeekDef || normalized.weekday && !containsGregor; 36617 let units, defaultValues, objNow = tsToObj(tsNow, offsetProvis); 36618 if (useWeekData) { 36619 units = orderedWeekUnits; 36620 defaultValues = defaultWeekUnitValues; 36621 objNow = gregorianToWeek(objNow); 36622 } else if (containsOrdinal) { 36623 units = orderedOrdinalUnits; 36624 defaultValues = defaultOrdinalUnitValues; 36625 objNow = gregorianToOrdinal(objNow); 36626 } else { 36627 units = orderedUnits;
36628 defaultValues = defaultUnitValues; 36629 } 36630 let foundFirst = false; 36631 for (const u of units) { 36632 const v = normalized[u]; 36633 if (!isUndefined$1(v)) { 36634 foundFirst = true; 36635 } else if (foundFirst) { 36636 normalized[u] = defaultValues[u]; 36637 } else { 36638 normalized[u] = objNow[u]; 36639 } 36640 } 36641 const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), invalid = higherOrderInvalid || hasInvalidTimeData(normalized); 36642 if (invalid) { 36643 return DateTime.invalid(invalid); 36644 } 36645 const gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse), inst = new DateTime({ 36646 ts: tsFinal, 36647 zone: zoneToUse, 36648 o: offsetFinal, 36649 loc 36650 }); 36651 if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) { 36652 return DateTime.invalid( 36653 "mismatched weekday", 36654 `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}` 36655 ); 36656 } 36657 return inst; 36658 } 36659 /** 36660 * Create a DateTime from an ISO 8601 string 36661 * @param {string} text - the ISO string 36662 * @param {Object} opts - options to affect the creation 36663 * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone 36664 * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one 36665 * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance 36666 * @param {string} [opts.outputCalendar] - the output calendar to set on the resulting DateTime instance 36667 * @param {string} [opts.numberingSystem] - the numbering system to set on the resulting DateTime instance 36668 * @example DateTime.fromISO('2016-05-25T09:08:34.123') 36669 * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00') 36670 * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true}) 36671 * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'}) 36672 * @example DateTime.fromISO('2016-W05-4') 36673 * @return {DateTime} 36674 */ 36675 static fromISO(text, opts = {}) { 36676 const [vals, parsedZone] = parseISODate(text); 36677 return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text); 36678 } 36679 /** 36680 * Create a DateTime from an RFC 2822 string 36681 * @param {string} text - the RFC 2822 string 36682 * @param {Object} opts - options to affect the creation 36683 * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. 36684 * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one 36685 * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance 36686 * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance 36687 * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance 36688 * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT') 36689 * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600') 36690 * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z') 36691 * @return {DateTime} 36692 */ 36693 static fromRFC2822(text, opts = {}) { 36694 const [vals, parsedZone] = parseRFC2822Date(text); 36695 return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text); 36696 } 36697 /** 36698 * Create a DateTime from an HTTP header date 36699 * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 36700 * @param {string} text - the HTTP header date 36701 * @param {Object} opts - options to affect the creation 36702 * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of str
36702ing, merely the zone the resulting DateTime is expressed in. 36703 * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods. 36704 * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance 36705 * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance 36706 * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance 36707 * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT') 36708 * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT') 36709 * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994') 36710 * @return {DateTime} 36711 */ 36712 static fromHTTP(text, opts = {}) { 36713 const [vals, parsedZone] = parseHTTPDate(text); 36714 return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts); 36715 } 36716 /** 36717 * Create a DateTime from an input string and format string. 36718 * Defaults to en-US if no locale has been specified, regardless of the system's locale. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/parsing?id=table-of-tokens). 36719 * @param {string} text - the string to parse 36720 * @param {string} fmt - the format the string is expected to be in (see the link below for the formats) 36721 * @param {Object} opts - options to affect the creation 36722 * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone 36723 * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one 36724 * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale 36725 * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system 36726 * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance 36727 * @return {DateTime} 36728 */ 36729 static fromFormat(text, fmt, opts = {}) { 36730 if (isUndefined$1(text) || isUndefined$1(fmt)) { 36731 throw new InvalidArgumentError("fromFormat requires an input string and a format"); 36732 } 36733 const { locale: locale2 = null, numberingSystem = null } = opts, localeToUse = Locale.fromOpts({ 36734 locale: locale2, 36735 numberingSystem, 36736 defaultToEN: true 36737 }), [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt); 36738 if (invalid) { 36739 return DateTime.invalid(invalid); 36740 } else { 36741 return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset); 36742 } 36743 } 36744 /** 36745 * @deprecated use fromFormat instead 36746 */ 36747 static fromString(text, fmt, opts = {}) { 36748 return DateTime.fromFormat(text, fmt, opts); 36749 } 36750 /** 36751 * Create a DateTime from a SQL date, time, or datetime 36752 * Defaults to en-US if no locale has been specified, regardless of the system's locale 36753 * @param {string} text - the string to parse 36754 * @param {Object} opts - options to affect the creation 36755 * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone 36756 * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one 36757 * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale 36758 * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system 36759 * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance 36760 * @example DateTime.fromSQL('2017-05-15') 36761 * @example DateTime.fromSQL('2017-05-15 09:12:34') 36762 * @example DateTime.fromSQL('2017-05-15 09:12:34.342') 36763 * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00') 36764 * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles') 36765 * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true }) 36766 * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' }) 36767 * @example DateTime.fromSQL('09:12:34.342') 36768 * @return {DateTime} 36769 */ 36770 static fromSQL(text, opts = {}) { 36771 const [vals, parsedZone] = parseSQL(text); 36772 return parseDataToDateTime(vals, parsedZone, opts, "SQL", text); 36773 } 36774 /**
36775 * Create an invalid DateTime. 36776 * @param {DateTime} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent 36777 * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information 36778 * @return {DateTime} 36779 */ 36780 static invalid(reason, explanation = null) { 36781 if (!reason) { 36782 throw new InvalidArgumentError("need to specify a reason the DateTime is invalid"); 36783 } 36784 const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); 36785 if (Settings.throwOnInvalid) { 36786 throw new InvalidDateTimeError(invalid); 36787 } else { 36788 return new DateTime({ invalid }); 36789 } 36790 } 36791 /** 36792 * Check if an object is an instance of DateTime. Works across context boundaries 36793 * @param {object} o 36794 * @return {boolean} 36795 */ 36796 static isDateTime(o) { 36797 return o && o.isLuxonDateTime || false; 36798 } 36799 /** 36800 * Produce the format string for a set of options 36801 * @param formatOpts 36802 * @param localeOpts 36803 * @returns {string} 36804 */ 36805 static parseFormatForOpts(formatOpts, localeOpts = {}) { 36806 const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts)); 36807 return !tokenList ? null : tokenList.map((t) => t ? t.val : null).join(""); 36808 } 36809 /** 36810 * Produce the the fully expanded format token for the locale 36811 * Does NOT quote characters, so quoted tokens will not round trip correctly 36812 * @param fmt 36813 * @param localeOpts 36814 * @returns {string} 36815 */ 36816 static expandFormat(fmt, localeOpts = {}) { 36817 const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts)); 36818 return expanded.map((t) => t.val).join(""); 36819 } 36820 // INFO 36821 /** 36822 * Get the value of unit. 36823 * @param {string} unit - a unit such as 'minute' or 'day' 36824 * @example DateTime.local(2017, 7, 4).get('month'); //=> 7 36825 * @example DateTime.local(2017, 7, 4).get('day'); //=> 4 36826 * @return {number} 36827 */ 36828 get(unit) { 36829 return this[unit]; 36830 } 36831 /** 36832 * Returns whether the DateTime is valid. Invalid DateTimes occur when: 36833 * * The DateTime was created from invalid calendar information, such as the 13th month or February 30 36834 * * The DateTime was created by an operation on another invalid date 36835 * @type {boolean} 36836 */ 36837 get isValid() { 36838 return this.invalid === null; 36839 } 36840 /** 36841 * Returns an error code if this DateTime is invalid, or null if the DateTime is valid 36842 * @type {string} 36843 */ 36844 get invalidReason() { 36845 return this.invalid ? this.invalid.reason : null; 36846 } 36847 /** 36848 * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid 36849 * @type {string} 36850 */ 36851 get invalidExplanation() { 36852 return this.invalid ? this.invalid.explanation : null; 36853 } 36854 /** 36855 * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime 36856 * 36857 * @type {string} 36858 */ 36859 get locale() { 36860 return this.isValid ? this.loc.locale : null; 36861 } 36862 /** 36863 * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime 36864 * 36865 * @type {string} 36866 */ 36867 get numberingSystem() { 36868 return this.isValid ? this.loc.numberingSystem : null; 36869 } 36870 /** 36871 * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime 36872 * 36873 * @type {string} 36874 */
vendor: 4,296 bytes, lines 36875-37024
36875 get outputCalendar() { 36876 return this.isValid ? this.loc.outputCalendar : null; 36877 } 36878 /** 36879 * Get the time zone associated with this DateTime. 36880 * @type {Zone} 36881 */ 36882 get zone() { 36883 return this._zone; 36884 } 36885 /** 36886 * Get the name of the time zone. 36887 * @type {string} 36888 */ 36889 get zoneName() { 36890 return this.isValid ? this.zone.name : null; 36891 } 36892 /** 36893 * Get the year 36894 * @example DateTime.local(2017, 5, 25).year //=> 2017 36895 * @type {number} 36896 */ 36897 get year() { 36898 return this.isValid ? this.c.year : NaN; 36899 } 36900 /** 36901 * Get the quarter 36902 * @example DateTime.local(2017, 5, 25).quarter //=> 2 36903 * @type {number} 36904 */ 36905 get quarter() { 36906 return this.isValid ? Math.ceil(this.c.month / 3) : NaN; 36907 } 36908 /** 36909 * Get the month (1-12). 36910 * @example DateTime.local(2017, 5, 25).month //=> 5 36911 * @type {number} 36912 */ 36913 get month() { 36914 return this.isValid ? this.c.month : NaN; 36915 } 36916 /** 36917 * Get the day of the month (1-30ish). 36918 * @example DateTime.local(2017, 5, 25).day //=> 25 36919 * @type {number} 36920 */ 36921 get day() { 36922 return this.isValid ? this.c.day : NaN; 36923 } 36924 /** 36925 * Get the hour of the day (0-23). 36926 * @example DateTime.local(2017, 5, 25, 9).hour //=> 9 36927 * @type {number} 36928 */ 36929 get hour() { 36930 return this.isValid ? this.c.hour : NaN; 36931 } 36932 /** 36933 * Get the minute of the hour (0-59). 36934 * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30 36935 * @type {number} 36936 */ 36937 get minute() { 36938 return this.isValid ? this.c.minute : NaN; 36939 } 36940 /** 36941 * Get the second of the minute (0-59). 36942 * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52 36943 * @type {number} 36944 */ 36945 get second() { 36946 return this.isValid ? this.c.second : NaN; 36947 } 36948 /** 36949 * Get the millisecond of the second (0-999). 36950 * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654 36951 * @type {number} 36952 */ 36953 get millisecond() { 36954 return this.isValid ? this.c.millisecond : NaN; 36955 } 36956 /** 36957 * Get the week year 36958 * @see https://en.wikipedia.org/wiki/ISO_week_date 36959 * @example DateTime.local(2014, 12, 31).weekYear //=> 2015 36960 * @type {number} 36961 */ 36962 get weekYear() { 36963 return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN; 36964 } 36965 /** 36966 * Get the week number of the week year (1-52ish). 36967 * @see https://en.wikipedia.org/wiki/ISO_week_date 36968 * @example DateTime.local(2017, 5, 25).weekNumber //=> 21 36969 * @type {number} 36970 */ 36971 get weekNumber() { 36972 return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN; 36973 } 36974 /** 36975 * Get the day of the week. 36976 * 1 is Monday and 7 is Sunday 36977 * @see https://en.wikipedia.org/wiki/ISO_week_date 36978 * @example DateTime.local(2014, 11, 31).weekday //=> 4 36979 * @type {number} 36980 */ 36981 get weekday() { 36982 return this.isValid ? possiblyCachedWeekData(this).weekday : NaN; 36983 } 36984 /** 36985 * Get the ordinal (meaning the day of the year) 36986 * @example DateTime.local(2017, 5, 25).ordinal //=> 145 36987 * @type {number|DateTime} 36988 */ 36989 get ordinal() { 36990 return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN; 36991 } 36992 /** 36993 * Get the human readable short month name, such as 'Oct'. 36994 * Defaults to the system's locale if no locale has been specified 36995 * @example DateTime.local(2017, 10, 30).monthShort //=> Oct 36996 * @type {string} 36997 */ 36998 get monthShort() { 36999 return this.isValid ? Info.months("short", { locObj: this.loc })[this.month - 1] : null; 37000 } 37001 /** 37002 * Get the human readable long month name, such as 'October'. 37003 * Defaults to the system's locale if no locale has been specified 37004 * @example DateTime.local(2017, 10, 30).monthLong //=> October 37005 * @type {string} 37006 */ 37007 get monthLong() { 37008 return this.isValid ? Info.months("long", { locObj: this.loc })[this.month - 1] : null; 37009 } 37010 /** 37011 * Get the human readable short weekday, such as 'Mon'. 37012 * Defaults to the system's locale if no locale has been specified 37013 * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon 37014 * @type {string} 37015 */ 37016 get weekdayShort() { 37017 return this.isValid ? Info.weekdays("short", { locObj: this.loc })[this.weekday - 1] : null; 37018 } 37019 /** 37020 * Get the human readable long weekday, such as 'Monday'. 37021 * Defaults to the system's locale if no locale has been specified 37022 * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday 37023 * @type {string} 37024 */
37025 get weekdayLong() { 37026 return this.isValid ? Info.weekdays("long", { locObj: this.loc })[this.weekday - 1] : null; 37027 } 37028 /** 37029 * Get the UTC offset of this DateTime in minutes 37030 * @example DateTime.now().offset //=> -240 37031 * @example DateTime.utc().offset //=> 0 37032 * @type {number} 37033 */ 37034 get offset() { 37035 return this.isValid ? +this.o : NaN; 37036 } 37037 /** 37038 * Get the short human name for the zone's current offset, for example "EST" or "EDT". 37039 * Defaults to the system's locale if no locale has been specified 37040 * @type {string} 37041 */ 37042 get offsetNameShort() { 37043 if (this.isValid) { 37044 return this.zone.offsetName(this.ts, { 37045 format: "short", 37046 locale: this.locale 37047 }); 37048 } else { 37049 return null; 37050 } 37051 } 37052 /** 37053 * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time". 37054 * Defaults to the system's locale if no locale has been specified 37055 * @type {string} 37056 */ 37057 get offsetNameLong() { 37058 if (this.isValid) { 37059 return this.zone.offsetName(this.ts, { 37060 format: "long", 37061 locale: this.locale 37062 }); 37063 } else { 37064 return null; 37065 } 37066 } 37067 /** 37068 * Get whether this zone's offset ever changes, as in a DST. 37069 * @type {boolean} 37070 */ 37071 get isOffsetFixed() { 37072 return this.isValid ? this.zone.isUniversal : null; 37073 } 37074 /** 37075 * Get whether the DateTime is in a DST. 37076 * @type {boolean} 37077 */ 37078 get isInDST() { 37079 if (this.isOffsetFixed) { 37080 return false; 37081 } else { 37082 return this.offset > this.set({ month: 1, day: 1 }).offset || this.offset > this.set({ month: 5 }).offset; 37083 } 37084 } 37085 /** 37086 * Returns true if this DateTime is in a leap year, false otherwise 37087 * @example DateTime.local(2016).isInLeapYear //=> true 37088 * @example DateTime.local(2013).isInLeapYear //=> false 37089 * @type {boolean} 37090 */ 37091 get isInLeapYear() { 37092 return isLeapYear(this.year); 37093 } 37094 /** 37095 * Returns the number of days in this DateTime's month 37096 * @example DateTime.local(2016, 2).daysInMonth //=> 29 37097 * @example DateTime.local(2016, 3).daysInMonth //=> 31 37098 * @type {number} 37099 */ 37100 get daysInMonth() { 37101 return daysInMonth(this.year, this.month); 37102 } 37103 /** 37104 * Returns the number of days in this DateTime's year 37105 * @example DateTime.local(2016).daysInYear //=> 366 37106 * @example DateTime.local(2013).daysInYear //=> 365 37107 * @type {number} 37108 */ 37109 get daysInYear() { 37110 return this.isValid ? daysInYear(this.year) : NaN; 37111 } 37112 /** 37113 * Returns the number of weeks in this DateTime's year 37114 * @see https://en.wikipedia.org/wiki/ISO_week_date 37115 * @example DateTime.local(2004).weeksInWeekYear //=> 53 37116 * @example DateTime.local(2013).weeksInWeekYear //=> 52 37117 * @type {number} 37118 */ 37119 get weeksInWeekYear() { 37120 return this.isValid ? weeksInWeekYear(this.weekYear) : NaN; 37121 } 37122 /** 37123 * Returns the resolved Intl options for this DateTime. 37124 * This is useful in understanding the behavior of formatting methods 37125 * @param {Object} opts - the same options as toLocaleString 37126 * @return {Object} 37127 */ 37128 resolvedLocaleOptions(opts = {}) { 37129 const { locale: locale2, numberingSystem, calendar } = Formatter.create( 37130 this.loc.clone(opts), 37131 opts 37132 ).resolvedOptions(this); 37133 return { locale: locale2, numberingSystem, outputCalendar: calendar }; 37134 } 37135 // TRANSFORM 37136 /** 37137 * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. 37138 * 37139 * Equivalent to {@link DateTime#setZone}('utc') 37140 * @param {number} [offset=0] - optionally, an offset from UTC in minutes 37141 * @param {Object} [opts={}] - options to pass to `setZone()` 37142 * @return {DateTime} 37143 */ 37144 toUTC(offset2 = 0, opts = {}) { 37145 return this.setZone(FixedOffsetZone.instance(offset2), opts); 37146 } 37147 /** 37148 * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime. 37149 * 37150 * Equivalent to `setZone('local')` 37151 * @return {DateTime} 37152 */ 37153 toLocal() { 37154 return this.setZone(Settings.defaultZone); 37155 } 37156 /** 37157 * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. 37158 * 37159 * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link DateTime#plus}. You may wish to use {@link DateTime#toLocal} and {@link DateTime#toUTC}
37159 which provide simple convenience wrappers for commonly used zones. 37160 * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link DateTime#Zone} class. 37161 * @param {Object} opts - options 37162 * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this. 37163 * @return {DateTime} 37164 */ 37165 setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) { 37166 zone = normalizeZone(zone, Settings.defaultZone); 37167 if (zone.equals(this.zone)) { 37168 return this; 37169 } else if (!zone.isValid) { 37170 return DateTime.invalid(unsupportedZone(zone)); 37171 } else { 37172 let newTS = this.ts; 37173 if (keepLocalTime || keepCalendarTime) { 37174 const offsetGuess = zone.offset(this.ts); 37175 const asObj = this.toObject(); 37176 [newTS] = objToTS(asObj, offsetGuess, zone); 37177 } 37178 return clone(this, { ts: newTS, zone }); 37179 } 37180 } 37181 /** 37182 * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime. 37183 * @param {Object} properties - the properties to set 37184 * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' }) 37185 * @return {DateTime} 37186 */ 37187 reconfigure({ locale: locale2, numberingSystem, outputCalendar } = {}) { 37188 const loc = this.loc.clone({ locale: locale2, numberingSystem, outputCalendar }); 37189 return clone(this, { loc }); 37190 } 37191 /** 37192 * "Set" the locale. Returns a newly-constructed DateTime. 37193 * Just a convenient alias for reconfigure({ locale }) 37194 * @example DateTime.local(2017, 5, 25).setLocale('en-GB') 37195 * @return {DateTime} 37196 */ 37197 setLocale(locale2) { 37198 return this.reconfigure({ locale: locale2 }); 37199 } 37200 /** 37201 * "Set" the values of specified units. Returns a newly-constructed DateTime. 37202 * You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}. 37203 * @param {Object} values - a mapping of units to numbers 37204 * @example dt.set({ year: 2017 }) 37205 * @example dt.set({ hour: 8, minute: 30 }) 37206 * @example dt.set({ weekday: 5 }) 37207 * @example dt.set({ year: 2005, ordinal: 234 }) 37208 * @return {DateTime} 37209 */ 37210 set(values) { 37211 if (!this.isValid) 37212 return this; 37213 const normalized = normalizeObject(values, normalizeUnit), settingWeekStuff = !isUndefined$1(normalized.weekYear) || !isUndefined$1(normalized.weekNumber) || !isUndefined$1(normalized.weekday), containsOrdinal = !isUndefined$1(normalized.ordinal), containsGregorYear = !isUndefined$1(normalized.year), containsGregorMD = !isUndefined$1(normalized.month) || !isUndefined$1(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber; 37214 if ((containsGregor || containsOrdinal) && definiteWeekDef) { 37215 throw new ConflictingSpecificationError( 37216 "Can't mix weekYear/weekNumber units with year/month/day or ordinals" 37217 ); 37218 } 37219 if (containsGregorMD && containsOrdinal) { 37220 throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); 37221 } 37222 let mixed; 37223 if (settingWeekStuff) { 37224 mixed = weekToGregorian({ ...gregorianToWeek(this.c), ...normalized }); 37225 } else if (!isUndefined$1(normalized.ordinal)) { 37226 mixed = ordinalToGregorian({ ...gregorianToOrdinal(this.c), ...normalized }); 37227 } else { 37228 mixed = { ...this.toObject(), ...normalized }; 37229 if (isUndefined$1(normalized.day)) { 37230 mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day); 37231 } 37232 } 37233 const [ts, o] = objToTS(mixed, this.o, this.zone); 37234 return clone(this, { ts, o }); 37235 } 37236 /** 37237 * Add a period of time to this DateTime and return the resulting DateTime 37238 * 37239 * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between. 37240 * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() 37241 * @example DateTime.now().plus(123) //~> in 123 milliseconds 37242 * @example DateTime.now().plus({ minutes: 15 }) //~> in 15 minutes 37243 * @example DateTime.now().plus({ days: 1 }) //~> this time tomorrow 37244 * @example DateTime.now().plus({ days: -1 }) //~> this time yesterday 37245 * @example DateTime.now().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min 37246 * @example DateTime.now().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min 37247 * @return {DateTime} 37248 */ 37249 plus(duration2) { 37250 if (!this.isValid) 37251 return this; 37252 const dur = Duration.fromDurationLike(duration2);
vendor: 4,764 bytes, lines 37253-37343
37253 return clone(this, adjustTime(this, dur)); 37254 } 37255 /** 37256 * Subtract a period of time to this DateTime and return the resulting DateTime 37257 * See {@link DateTime#plus} 37258 * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() 37259 @return {DateTime} 37260 */ 37261 minus(duration2) { 37262 if (!this.isValid) 37263 return this; 37264 const dur = Duration.fromDurationLike(duration2).negate(); 37265 return clone(this, adjustTime(this, dur)); 37266 } 37267 /** 37268 * "Set" this DateTime to the beginning of a unit of time. 37269 * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. 37270 * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01' 37271 * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01' 37272 * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays 37273 * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00' 37274 * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00' 37275 * @return {DateTime} 37276 */ 37277 startOf(unit) { 37278 if (!this.isValid) 37279 return this; 37280 const o = {}, normalizedUnit = Duration.normalizeUnit(unit); 37281 switch (normalizedUnit) { 37282 case "years": 37283 o.month = 1; 37284 case "quarters": 37285 case "months": 37286 o.day = 1; 37287 case "weeks": 37288 case "days": 37289 o.hour = 0; 37290 case "hours": 37291 o.minute = 0; 37292 case "minutes": 37293 o.second = 0; 37294 case "seconds": 37295 o.millisecond = 0; 37296 break; 37297 } 37298 if (normalizedUnit === "weeks") { 37299 o.weekday = 1; 37300 } 37301 if (normalizedUnit === "quarters") { 37302 const q = Math.ceil(this.month / 3); 37303 o.month = (q - 1) * 3 + 1; 37304 } 37305 return this.set(o); 37306 } 37307 /** 37308 * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time 37309 * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. 37310 * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00' 37311 * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00' 37312 * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays 37313 * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00' 37314 * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00' 37315 * @return {DateTime} 37316 */ 37317 endOf(unit) { 37318 return this.isValid ? this.plus({ [unit]: 1 }).startOf(unit).minus(1) : this; 37319 } 37320 // OUTPUT 37321 /** 37322 * Returns a string representation of this DateTime formatted according to the specified format string. 37323 * **You may not want this.** See {@link DateTime#toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/#/formatting?id=table-of-tokens). 37324 * Defaults to en-US if no locale has been specified, regardless of the system's locale. 37325 * @param {string} fmt - the format string 37326 * @param {Object} opts - opts to override the configuration options on this DateTime 37327 * @example DateTime.now().toFormat('yyyy LLL dd') //=> '2017 Apr 22' 37328 * @example DateTime.now().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22' 37329 * @example DateTime.now().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22' 37330 * @example DateTime.now().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes' 37331 * @return {string} 37332 */ 37333 toFormat(fmt, opts = {}) { 37334 return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID; 37335 } 37336 /** 37337 * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`. 37338 * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation 37339 * of the DateTime in the assigned locale. 37340 * Defaults to the system's locale if no locale has been specified 37341 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat 37342 * @param formatOpts {Object} - Intl.DateTimeFormat constructor options and configuration options 37343 * @param {Object} opts - opts to override the configuration options on this DateTime
37344 * @example DateTime.now().toLocaleString(); //=> 4/20/2017 37345 * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017' 37346 * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017' 37347 * @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022' 37348 * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM' 37349 * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM' 37350 * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20' 37351 * @example DateTime.now().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM' 37352 * @example DateTime.now().toLocaleString({ hour: '2-digit', minute: '2-digit', hourCycle: 'h23' }); //=> '11:32' 37353 * @return {string} 37354 */ 37355 toLocaleString(formatOpts = DATE_SHORT, opts = {}) { 37356 return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID; 37357 } 37358 /** 37359 * Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output. 37360 * Defaults to the system's locale if no locale has been specified 37361 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts 37362 * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`. 37363 * @example DateTime.now().toLocaleParts(); //=> [ 37364 * //=> { type: 'day', value: '25' }, 37365 * //=> { type: 'literal', value: '/' }, 37366 * //=> { type: 'month', value: '05' }, 37367 * //=> { type: 'literal', value: '/' }, 37368 * //=> { type: 'year', value: '1982' } 37369 * //=> ] 37370 */ 37371 toLocaleParts(opts = {}) { 37372 return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : []; 37373 } 37374 /** 37375 * Returns an ISO 8601-compliant string representation of this DateTime 37376 * @param {Object} opts - options 37377 * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 37378 * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 37379 * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' 37380 * @param {boolean} [opts.extendedZone=false] - add the time zone format extension 37381 * @param {string} [opts.format='extended'] - choose between the basic and extended format 37382 * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' 37383 * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00' 37384 * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335' 37385 * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400' 37386 * @return {string} 37387 */ 37388 toISO({ 37389 format: format2 = "extended", 37390 suppressSeconds = false, 37391 suppressMilliseconds = false, 37392 includeOffset = true, 37393 extendedZone = false 37394 } = {}) { 37395 if (!this.isValid) { 37396 return null; 37397 } 37398 const ext = format2 === "extended"; 37399 let c2 = toISODate(this, ext); 37400 c2 += "T"; 37401 c2 += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone); 37402 return c2; 37403 } 37404 /** 37405 * Returns an ISO 8601-compliant string representation of this DateTime's date component 37406 * @param {Object} opts - options 37407 * @param {string} [opts.format='extended'] - choose between the basic and extended format 37408 * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25' 37409 * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525' 37410 * @return {string} 37411 */ 37412 toISODate({ format: format2 = "extended" } = {}) { 37413 if (!this.isValid) { 37414 return null; 37415 } 37416 return toISODate(this, format2 === "extended"); 37417 } 37418 /** 37419 * Returns an ISO 8601-compliant string representation of this DateTime's week date 37420 * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2' 37421 * @return {string} 37422 */ 37423 toISOWeekDate() { 37424 return toTechFormat(this, "kkkk-'W'WW-c"); 37425 } 37426 /** 37427 * Returns an ISO 8601-compliant string representation of this DateTime's time component 37428 * @param {Object} opts - options 37429 * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 37430 * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 37431 * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' 37432 * @param {boolean} [opts.extendedZone=true] - add the time zone format extension 37433 * @param {boolean} [opts.includePrefix=false] - include the `T` prefix 37434 * @param {string} [opts.format='extended'] - choose between the basic and extended format 37435 * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z' 37436 * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z' 37437 * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z' 37438 * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z' 37439 * @return {string} 37440 */ 37441 toISOTime({ 37442 suppressMilliseconds = false, 37443 suppressSeconds = false, 37444 includeOffset = true, 37445 includePrefix = false, 37446 extendedZone = false, 37447 format: format2 = "extended" 37448 } = {}) { 37449 if (!this.isValid) { 37450 return null; 37451 }
vendor: 2,728 bytes, lines 37452-37520
37452 let c2 = includePrefix ? "T" : ""; 37453 return c2 + toISOTime( 37454 this, 37455 format2 === "extended", 37456 suppressSeconds, 37457 suppressMilliseconds, 37458 includeOffset, 37459 extendedZone 37460 ); 37461 } 37462 /** 37463 * Returns an RFC 2822-compatible string representation of this DateTime 37464 * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' 37465 * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' 37466 * @return {string} 37467 */ 37468 toRFC2822() { 37469 return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false); 37470 } 37471 /** 37472 * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT. 37473 * Specifically, the string conforms to RFC 1123. 37474 * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 37475 * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' 37476 * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT' 37477 * @return {string} 37478 */ 37479 toHTTP() { 37480 return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'"); 37481 } 37482 /** 37483 * Returns a string representation of this DateTime appropriate for use in SQL Date 37484 * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13' 37485 * @return {string} 37486 */ 37487 toSQLDate() { 37488 if (!this.isValid) { 37489 return null; 37490 } 37491 return toISODate(this, true); 37492 } 37493 /** 37494 * Returns a string representation of this DateTime appropriate for use in SQL Time 37495 * @param {Object} opts - options 37496 * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. 37497 * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' 37498 * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' 37499 * @example DateTime.utc().toSQL() //=> '05:15:16.345' 37500 * @example DateTime.now().toSQL() //=> '05:15:16.345 -04:00' 37501 * @example DateTime.now().toSQL({ includeOffset: false }) //=> '05:15:16.345' 37502 * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York' 37503 * @return {string} 37504 */ 37505 toSQLTime({ includeOffset = true, includeZone = false, includeOffsetSpace = true } = {}) { 37506 let fmt = "HH:mm:ss.SSS"; 37507 if (includeZone || includeOffset) { 37508 if (includeOffsetSpace) { 37509 fmt += " "; 37510 } 37511 if (includeZone) { 37512 fmt += "z"; 37513 } else if (includeOffset) { 37514 fmt += "ZZ"; 37515 } 37516 } 37517 return toTechFormat(this, fmt, true); 37518 } 37519 /** 37520 * Returns a string representation of this DateTime appropriate for use in SQL DateTime
37521 * @param {Object} opts - options 37522 * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. 37523 * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' 37524 * @param {boolean} [opts.includeOffsetSpace=true] - include the space between the time and the offset, such as '05:15:16.345 -04:00' 37525 * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' 37526 * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' 37527 * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' 37528 * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York' 37529 * @return {string} 37530 */ 37531 toSQL(opts = {}) { 37532 if (!this.isValid) { 37533 return null; 37534 } 37535 return `${this.toSQLDate()} ${this.toSQLTime(opts)}`; 37536 } 37537 /** 37538 * Returns a string representation of this DateTime appropriate for debugging 37539 * @return {string} 37540 */ 37541 toString() { 37542 return this.isValid ? this.toISO() : INVALID; 37543 } 37544 /** 37545 * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis} 37546 * @return {number} 37547 */ 37548 valueOf() { 37549 return this.toMillis(); 37550 } 37551 /** 37552 * Returns the epoch milliseconds of this DateTime. 37553 * @return {number} 37554 */ 37555 toMillis() { 37556 return this.isValid ? this.ts : NaN; 37557 } 37558 /** 37559 * Returns the epoch seconds of this DateTime. 37560 * @return {number} 37561 */ 37562 toSeconds() { 37563 return this.isValid ? this.ts / 1e3 : NaN; 37564 } 37565 /** 37566 * Returns the epoch seconds (as a whole number) of this DateTime. 37567 * @return {number} 37568 */ 37569 toUnixInteger() { 37570 return this.isValid ? Math.floor(this.ts / 1e3) : NaN; 37571 } 37572 /** 37573 * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. 37574 * @return {string} 37575 */ 37576 toJSON() { 37577 return this.toISO(); 37578 } 37579 /** 37580 * Returns a BSON serializable equivalent to this DateTime. 37581 * @return {Date} 37582 */ 37583 toBSON() { 37584 return this.toJSDate(); 37585 } 37586 /** 37587 * Returns a JavaScript object with this DateTime's year, month, day, and so on. 37588 * @param opts - options for generating the object 37589 * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output 37590 * @example DateTime.now().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 } 37591 * @return {Object} 37592 */ 37593 toObject(opts = {}) { 37594 if (!this.isValid) 37595 return {}; 37596 const base2 = { ...this.c }; 37597 if (opts.includeConfig) { 37598 base2.outputCalendar = this.outputCalendar; 37599 base2.numberingSystem = this.loc.numberingSystem; 37600 base2.locale = this.loc.locale; 37601 } 37602 return base2; 37603 } 37604 /** 37605 * Returns a JavaScript Date equivalent to this DateTime. 37606 * @return {Date} 37607 */ 37608 toJSDate() { 37609 return new Date(this.isValid ? this.ts : NaN); 37610 } 37611 // COMPARE 37612 /** 37613 * Return the difference between two DateTimes as a Duration. 37614 * @param {DateTime} otherDateTime - the DateTime to compare this one to 37615 * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration. 37616 * @param {Object} opts - options that affect the creation of the Duration 37617 * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use 37618 * @example 37619 * var i1 = DateTime.fromISO('1982-05-25T09:45'), 37620 * i2 = DateTime.fromISO('1983-10-14T10:30'); 37621 * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 } 37622 * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 } 37623 * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 } 37624 * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 } 37625 * @return {Duration} 37626 */ 37627 diff(otherDateTime, unit = "milliseconds", opts = {}) { 37628 if (!this.isValid || !otherDateTime.isValid) { 37629 return Duration.invalid("created by diffing an invalid DateTime"); 37630 } 37631 const durOpts = { locale: this.locale, numberingSystem: this.numberingSystem, ...opts }; 37632 const units = maybeArray(unit).map(Duration.normalizeUnit), otherIsLater = otherDateTime.valueOf() > this.valueOf(), earlier = otherIsLater ? this : otherDateTime, later = otherIsLater ? otherDateTime : this, diffed = diff(earlier, later, units, durOpts); 37633 return otherIsLater ? diffed.negate() : diffed; 37634 } 37635 /** 37636 * Return the difference between this DateTime and right now. 37637 * See {@link DateTime#diff} 37638 * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration 37639 * @param {Object} opts - options that affect the creation of the Duration 37640 * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use 37641 * @return {Duration} 37642 */ 37643 diffNow(unit = "milliseconds", opts = {}) { 37644 return this.diff(DateTime.now(), unit, opts); 37645 } 37646 /** 37647 * Return an Interval spanning between this DateTime and another DateTime
37648 * @param {DateTime} otherDateTime - the other end point of the Interval 37649 * @return {Interval} 37650 */ 37651 until(otherDateTime) { 37652 return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this; 37653 } 37654 /** 37655 * Return whether this DateTime is in the same unit of time as another DateTime. 37656 * Higher-order units must also be identical for this function to return `true`. 37657 * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed. 37658 * @param {DateTime} otherDateTime - the other DateTime 37659 * @param {string} unit - the unit of time to check sameness on 37660 * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day 37661 * @return {boolean} 37662 */ 37663 hasSame(otherDateTime, unit) { 37664 if (!this.isValid) 37665 return false; 37666 const inputMs = otherDateTime.valueOf(); 37667 const adjustedToZone = this.setZone(otherDateTime.zone, { keepLocalTime: true }); 37668 return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit); 37669 } 37670 /** 37671 * Equality check 37672 * Two DateTimes are equal if and only if they represent the same millisecond, have the same zone and location, and are both valid. 37673 * To compare just the millisecond values, use `+dt1 === +dt2`. 37674 * @param {DateTime} other - the other DateTime 37675 * @return {boolean} 37676 */ 37677 equals(other) { 37678 return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc); 37679 } 37680 /** 37681 * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your 37682 * platform supports Intl.RelativeTimeFormat. Rounds down by default. 37683 * @param {Object} options - options that affect the output 37684 * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now. 37685 * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow" 37686 * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds" 37687 * @param {boolean} [options.round=true] - whether to round the numbers in the output. 37688 * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding. 37689 * @param {string} options.locale - override the locale of this DateTime 37690 * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this 37691 * @example DateTime.now().plus({ days: 1 }).toRelative() //=> "in 1 day" 37692 * @example DateTime.now().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 dÃa" 37693 * @example DateTime.now().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures" 37694 * @example DateTime.now().minus({ days: 2 }).toRelative() //=> "2 days ago" 37695 * @example DateTime.now().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago" 37696 * @example DateTime.now().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago" 37697 */ 37698 toRelative(options = {}) { 37699 if (!this.isValid) 37700 return null; 37701 const base2 = options.base || DateTime.fromObject({}, { zone: this.zone }), padding = options.padding ? this < base2 ? -options.padding : options.padding : 0; 37702 let units = ["years", "months", "days", "hours", "minutes", "seconds"]; 37703 let unit = options.unit; 37704 if (Array.isArray(options.unit)) { 37705 units = options.unit; 37706 unit = void 0; 37707 } 37708 return diffRelative(base2, this.plus(padding), { 37709 ...options, 37710 numeric: "always", 37711 units, 37712 unit 37713 }); 37714 } 37715 /** 37716 * Returns a string representation of this date relative to today, such as "yesterday" or "next month". 37717 * Only internationalizes on platforms that supports Intl.RelativeTimeFormat. 37718 * @param {Object} options - options that affect the output 37719 * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now. 37720 * @param {string} options.locale - override the locale of this DateTime
37721 * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days" 37722 * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this 37723 * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow" 37724 * @example DateTime.now().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana" 37725 * @example DateTime.now().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain" 37726 * @example DateTime.now().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago" 37727 */ 37728 toRelativeCalendar(options = {}) { 37729 if (!this.isValid) 37730 return null; 37731 return diffRelative(options.base || DateTime.fromObject({}, { zone: this.zone }), this, { 37732 ...options, 37733 numeric: "auto", 37734 units: ["years", "months", "days"], 37735 calendary: true 37736 }); 37737 } 37738 /** 37739 * Return the min of several date times 37740 * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum 37741 * @return {DateTime} the min DateTime, or undefined if called with no argument 37742 */ 37743 static min(...dateTimes) { 37744 if (!dateTimes.every(DateTime.isDateTime)) { 37745 throw new InvalidArgumentError("min requires all arguments be DateTimes"); 37746 } 37747 return bestBy(dateTimes, (i) => i.valueOf(), Math.min); 37748 } 37749 /** 37750 * Return the max of several date times 37751 * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum 37752 * @return {DateTime} the max DateTime, or undefined if called with no argument 37753 */ 37754 static max(...dateTimes) { 37755 if (!dateTimes.every(DateTime.isDateTime)) { 37756 throw new InvalidArgumentError("max requires all arguments be DateTimes"); 37757 } 37758 return bestBy(dateTimes, (i) => i.valueOf(), Math.max); 37759 } 37760 // MISC 37761 /** 37762 * Explain how a string would be parsed by fromFormat() 37763 * @param {string} text - the string to parse 37764 * @param {string} fmt - the format the string is expected to be in (see description) 37765 * @param {Object} options - options taken by fromFormat() 37766 * @return {Object} 37767 */ 37768 static fromFormatExplain(text, fmt, options = {}) { 37769 const { locale: locale2 = null, numberingSystem = null } = options, localeToUse = Locale.fromOpts({ 37770 locale: locale2, 37771 numberingSystem, 37772 defaultToEN: true 37773 }); 37774 return explainFromTokens(localeToUse, text, fmt); 37775 } 37776 /** 37777 * @deprecated use fromFormatExplain instead 37778 */ 37779 static fromStringExplain(text, fmt, options = {}) { 37780 return DateTime.fromFormatExplain(text, fmt, options); 37781 } 37782 // FORMAT PRESETS 37783 /** 37784 * {@link DateTime#toLocaleString} format like 10/14/1983 37785 * @type {Object} 37786 */ 37787 static get DATE_SHORT() { 37788 return DATE_SHORT; 37789 } 37790 /** 37791 * {@link DateTime#toLocaleString} format like 'Oct 14, 1983' 37792 * @type {Object} 37793 */ 37794 static get DATE_MED() { 37795 return DATE_MED; 37796 } 37797 /** 37798 * {@link DateTime#toLocaleString} format like 'Fri, Oct 14, 1983' 37799 * @type {Object} 37800 */ 37801 static get DATE_MED_WITH_WEEKDAY() { 37802 return DATE_MED_WITH_WEEKDAY; 37803 } 37804 /** 37805 * {@link DateTime#toLocaleString} format like 'October 14, 1983' 37806 * @type {Object} 37807 */ 37808 static get DATE_FULL() { 37809 return DATE_FULL; 37810 } 37811 /** 37812 * {@link DateTime#toLocaleString} format like 'Tuesday, October 14, 1983' 37813 * @type {Object} 37814 */ 37815 static get DATE_HUGE() { 37816 return DATE_HUGE; 37817 } 37818 /** 37819 * {@link DateTime#toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. 37820 * @type {Object} 37821 */ 37822 static get TIME_SIMPLE() { 37823 return TIME_SIMPLE; 37824 } 37825 /** 37826 * {@link DateTime#toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. 37827 * @type {Object} 37828 */ 37829 static get TIME_WITH_SECONDS() { 37830 return TIME_WITH_SECONDS; 37831 } 37832 /** 37833 * {@link DateTime#toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. 37834 * @type {Object} 37835 */ 37836 static get TIME_WITH_SHORT_OFFSET() { 37837 return TIME_WITH_SHORT_OFFSET; 37838 } 37839 /** 37840 * {@link DateTime#toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. 37841 * @type {Object} 37842 */ 37843 static get TIME_WITH_LONG_OFFSET() { 37844 return TIME_WITH_LONG_OFFSET; 37845 } 37846 /**
37847 * {@link DateTime#toLocaleString} format like '09:30', always 24-hour. 37848 * @type {Object} 37849 */ 37850 static get TIME_24_SIMPLE() { 37851 return TIME_24_SIMPLE; 37852 } 37853 /** 37854 * {@link DateTime#toLocaleString} format like '09:30:23', always 24-hour. 37855 * @type {Object} 37856 */ 37857 static get TIME_24_WITH_SECONDS() { 37858 return TIME_24_WITH_SECONDS; 37859 } 37860 /** 37861 * {@link DateTime#toLocaleString} format like '09:30:23 EDT', always 24-hour. 37862 * @type {Object} 37863 */ 37864 static get TIME_24_WITH_SHORT_OFFSET() { 37865 return TIME_24_WITH_SHORT_OFFSET; 37866 } 37867 /** 37868 * {@link DateTime#toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. 37869 * @type {Object} 37870 */ 37871 static get TIME_24_WITH_LONG_OFFSET() { 37872 return TIME_24_WITH_LONG_OFFSET; 37873 } 37874 /** 37875 * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. 37876 * @type {Object} 37877 */ 37878 static get DATETIME_SHORT() { 37879 return DATETIME_SHORT; 37880 } 37881 /** 37882 * {@link DateTime#toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. 37883 * @type {Object} 37884 */ 37885 static get DATETIME_SHORT_WITH_SECONDS() { 37886 return DATETIME_SHORT_WITH_SECONDS; 37887 } 37888 /** 37889 * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. 37890 * @type {Object} 37891 */ 37892 static get DATETIME_MED() { 37893 return DATETIME_MED; 37894 } 37895 /** 37896 * {@link DateTime#toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. 37897 * @type {Object} 37898 */ 37899 static get DATETIME_MED_WITH_SECONDS() { 37900 return DATETIME_MED_WITH_SECONDS; 37901 } 37902 /** 37903 * {@link DateTime#toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. 37904 * @type {Object} 37905 */ 37906 static get DATETIME_MED_WITH_WEEKDAY() { 37907 return DATETIME_MED_WITH_WEEKDAY; 37908 } 37909 /** 37910 * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. 37911 * @type {Object} 37912 */ 37913 static get DATETIME_FULL() { 37914 return DATETIME_FULL; 37915 } 37916 /** 37917 * {@link DateTime#toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. 37918 * @type {Object} 37919 */ 37920 static get DATETIME_FULL_WITH_SECONDS() { 37921 return DATETIME_FULL_WITH_SECONDS; 37922 } 37923 /** 37924 * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. 37925 * @type {Object} 37926 */ 37927 static get DATETIME_HUGE() { 37928 return DATETIME_HUGE; 37929 } 37930 /** 37931 * {@link DateTime#toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. 37932 * @type {Object} 37933 */ 37934 static get DATETIME_HUGE_WITH_SECONDS() { 37935 return DATETIME_HUGE_WITH_SECONDS; 37936 } 37937} 37938function friendlyDateTime(dateTimeish) { 37939 if (DateTime.isDateTime(dateTimeish)) { 37940 return dateTimeish; 37941 } else if (dateTimeish && dateTimeish.valueOf && isNumber$1(dateTimeish.valueOf())) { 37942 return DateTime.fromJSDate(dateTimeish); 37943 } else if (dateTimeish && typeof dateTimeish === "object") { 37944 return DateTime.fromObject(dateTimeish); 37945 } else { 37946 throw new InvalidArgumentError( 37947 `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}` 37948 ); 37949 } 37950} 37951const _hoisted_1$2 = { 37952 viewBox: "0 0 32 32", 37953 width: "1.2em", 37954 height: "1.2em" 37955}; 37956const _hoisted_2$2 = /* @__PURE__ */ createBaseVNode("path", { 37957 fill: "currentColor", 37958 d: "M22 16L12 26l-1.4-1.4l8.6-8.6l-8.6-8.6L12 6z" 37959}, null, -1); 37960const _hoisted_3$2 = [ 37961 _hoisted_2$2 37962]; 37963function render$2(_ctx, _cache) { 37964 return openBlock(), createElementBlock("svg", _hoisted_1$2, _hoisted_3$2); 37965} 37966const ICarbonChevronRight = { name: "carbon-chevron-right", render: render$2 }; 37967var _a; 37968const isClient = typeof window !== "undefined"; 37969const isFunction$1 = (val) => typeof val === "function"; 37970const isString$1 = (val) => typeof val === "string"; 37971const noop = () => { 37972}; 37973const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent); 37974function resolveUnref(r) { 37975 return typeof r === "function" ? r() : unref(r); 37976} 37977function createFilterWrapper(filter, fn) { 37978 function wrapper(...args) { 37979 return new Promise((resolve2, reject) => { 37980 Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve2).catch(reject); 37981 }); 37982 } 37983 return wrapper; 37984} 37985const bypassFilter = (invoke) => { 37986 return invoke(); 37987}; 37988function debounceFilter(ms, options = {}) { 37989 let timer; 37990 let maxTimer; 37991 let lastRejector = noop; 37992 const _clearTimeout = (timer2) => { 37993 clearTimeout(timer2); 37994 lastRejector(); 37995 lastRejector = noop; 37996 }; 37997 const filter = (invoke) => { 37998 const duration2 = resolveUnref(ms); 37999 const maxDuration = resolveUnref(options.maxWait); 38000 if (timer) 38001 _clearTimeout(timer); 38002 if (duration2 <= 0 || maxDuration !== void 0 && maxDuration <= 0) { 38003 if (maxTimer) { 38004 _clearTimeout(maxTimer); 38005 maxTimer = null; 38006 } 38007 return Promise.resolve(invoke()); 38008 } 38009 return new Promise((resolve2, reject) => { 38010 lastRejector = options.rejectOnCancel ? reject : resolve2; 38011 if (maxDuration && !maxTimer) { 38012 maxTimer = setTimeout(() => { 38013 if (timer) 38014 _clearTimeout(timer); 38015 maxTimer = null; 38016 resolve2(invoke()); 38017 }, maxDuration); 38018 } 38019 timer = setTimeout(() => { 38020 if (maxTimer) 38021 _clearTimeout(maxTimer); 38022 maxTimer = null; 38023 resolve2(invoke()); 38024 }, duration2); 38025 }); 38026 }; 38027 return filter; 38028} 38029const directiveHooks = { 38030 mounted: "mounted", 38031 updated: "updated", 38032 unmounted: "unmounted" 38033}; 38034function identity(arg) { 38035 return arg; 38036} 38037function computedWithControl(source, fn) { 38038 let v = void 0; 38039 let track2; 38040 let trigger2; 38041 const dirty = ref(true); 38042 const update = () => { 38043 dirty.value = true; 38044 trigger2(); 38045 }; 38046 watch(source, update, { flush: "sync" }); 38047 const get2 = isFunction$1(fn) ? fn : fn.get; 38048 const set2 = isFunction$1(fn) ? void 0 : fn.set; 38049 const result = customRef((_track, _trigger) => { 38050 track2 = _track; 38051 trigger2 = _trigger; 38052 return { 38053 get() {
38054 if (dirty.value) { 38055 v = get2(); 38056 dirty.value = false; 38057 } 38058 track2(); 38059 return v; 38060 }, 38061 set(v2) { 38062 set2 == null ? void 0 : set2(v2); 38063 } 38064 }; 38065 }); 38066 if (Object.isExtensible(result)) 38067 result.trigger = update; 38068 return result; 38069} 38070function tryOnScopeDispose(fn) { 38071 if (getCurrentScope()) { 38072 onScopeDispose(fn); 38073 return true; 38074 } 38075 return false; 38076} 38077function resolveRef(r) { 38078 return typeof r === "function" ? computed(r) : ref(r); 38079} 38080function tryOnMounted(fn, sync = true) { 38081 if (getCurrentInstance()) 38082 onMounted(fn); 38083 else if (sync) 38084 fn(); 38085 else 38086 nextTick(fn); 38087} 38088function useTimeoutFn(cb, interval, options = {}) { 38089 const { 38090 immediate = true 38091 } = options; 38092 const isPending = ref(false); 38093 let timer = null; 38094 function clear2() { 38095 if (timer) { 38096 clearTimeout(timer); 38097 timer = null; 38098 } 38099 } 38100 function stop2() { 38101 isPending.value = false; 38102 clear2(); 38103 } 38104 function start(...args) { 38105 clear2(); 38106 isPending.value = true; 38107 timer = setTimeout(() => { 38108 isPending.value = false; 38109 timer = null; 38110 cb(...args); 38111 }, resolveUnref(interval)); 38112 } 38113 if (immediate) { 38114 isPending.value = true; 38115 if (isClient) 38116 start(); 38117 } 38118 tryOnScopeDispose(stop2); 38119 return { 38120 isPending, 38121 start, 38122 stop: stop2 38123 }; 38124} 38125var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols; 38126var __hasOwnProp$6 = Object.prototype.hasOwnProperty; 38127var __propIsEnum$6 = Object.prototype.propertyIsEnumerable; 38128var __objRest$5 = (source, exclude) => { 38129 var target = {}; 38130 for (var prop in source) 38131 if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0) 38132 target[prop] = source[prop]; 38133 if (source != null && __getOwnPropSymbols$6) 38134 for (var prop of __getOwnPropSymbols$6(source)) { 38135 if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop)) 38136 target[prop] = source[prop]; 38137 } 38138 return target; 38139}; 38140function watchWithFilter(source, cb, options = {}) { 38141 const _a2 = options, { 38142 eventFilter = bypassFilter 38143 } = _a2, watchOptions = __objRest$5(_a2, [ 38144 "eventFilter" 38145 ]); 38146 return watch(source, createFilterWrapper(eventFilter, cb), watchOptions); 38147} 38148var __defProp$4 = Object.defineProperty; 38149var __defProps$4 = Object.defineProperties; 38150var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors; 38151var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols; 38152var __hasOwnProp$4 = Object.prototype.hasOwnProperty; 38153var __propIsEnum$4 = Object.prototype.propertyIsEnumerable; 38154var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 38155var __spreadValues$4 = (a, b) => { 38156 for (var prop in b || (b = {})) 38157 if (__hasOwnProp$4.call(b, prop)) 38158 __defNormalProp$4(a, prop, b[prop]); 38159 if (__getOwnPropSymbols$4) 38160 for (var prop of __getOwnPropSymbols$4(b)) { 38161 if (__propIsEnum$4.call(b, prop)) 38162 __defNormalProp$4(a, prop, b[prop]); 38163 } 38164 return a; 38165}; 38166var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b)); 38167var __objRest$3 = (source, exclude) => { 38168 var target = {}; 38169 for (var prop in source) 38170 if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0) 38171 target[prop] = source[prop]; 38172 if (source != null && __getOwnPropSymbols$4) 38173 for (var prop of __getOwnPropSymbols$4(source)) { 38174 if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop)) 38175 target[prop] = source[prop]; 38176 } 38177 return target; 38178}; 38179function watchDebounced(source, cb, options = {}) { 38180 const _a2 = options, { 38181 debounce = 0, 38182 maxWait = void 0 38183 } = _a2, watchOptions = __objRest$3(_a2, [ 38184 "debounce", 38185 "maxWait" 38186 ]); 38187 return watchWithFilter(source, cb, __spreadProps$4(__spreadValues$4({}, watchOptions), { 38188 eventFilter: debounceFilter(debounce, { maxWait }) 38189 })); 38190} 38191function unrefElement(elRef) { 38192 var _a2; 38193 const plain = resolveUnref(elRef); 38194 return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain; 38195} 38196const defaultWindow = isClient ? window : void 0; 38197const defaultNavigator = isClient ? window.navigator : void 0; 38198function useEventListener(...args) { 38199 let target; 38200 let events2; 38201 let listeners; 38202 let options; 38203 if (isString$1(args[0]) || Array.isArray(args[0])) { 38204 [events2, listeners, options] = args; 38205 target = defaultWindow; 38206 } else { 38207 [target, events2, listeners, options] = args; 38208 } 38209 if (!target) 38210 return noop; 38211 if (!Array.isArray(events2)) 38212 events2 = [events2]; 38213 if (!Array.isArray(listeners)) 38214 listeners = [listeners]; 38215 const cleanups = []; 38216 const cleanup = () => { 38217 cleanups.forEach((fn) => fn()); 38218 cleanups.length = 0; 38219 }; 38220 const register2 = (el, event, listener) => { 38221 el.addEventListener(event, listener, options); 38222 return () => el.removeEventListener(event, listener, options); 38223 }; 38224 const stopWatch = watch(() => unrefElement(target), (el) => { 38225 cleanup(); 38226 if (!el) 38227 return; 38228 cleanups.push(...events2.flatMap((event) => { 38229 return listeners.map((listener) => register2(el, event, listener)); 38230 })); 38231 }, { immediate: true, flush: "post" }); 38232 const stop2 = () => { 38233 stopWatch(); 38234 cleanup(); 38235 }; 38236 tryOnScopeDispose(stop2); 38237 return stop2; 38238} 38239function useActiveElement(options = {}) { 38240 var _a2; 38241 const { window: window2 = defaultWindow } = options; 38242 const document2 = (_a2 = options.document) != null ? _a2 : window2 == null ? void 0 : window2.document; 38243 const activeElement = computedWithControl(() => null, () => document2 == null ? void 0 : document2.activeElement); 38244 if (window2) { 38245 useEventListener(window2, "blur", (event) => { 38246 if (event.relatedTarget !== null) 38247 return; 38248 activeElement.trigger(); 38249 }, true); 38250 useEventListener(window2, "focus", activeElement.trigger, true); 38251 } 38252 return activeElement; 38253}
38254function useSupported(callback, sync = false) { 38255 const isSupported = ref(); 38256 const update = () => isSupported.value = Boolean(callback()); 38257 update(); 38258 tryOnMounted(update, sync); 38259 return isSupported; 38260} 38261function useClipboard(options = {}) { 38262 const { 38263 navigator: navigator2 = defaultNavigator, 38264 read = false, 38265 source, 38266 copiedDuring = 1500, 38267 legacy = false 38268 } = options; 38269 const events2 = ["copy", "cut"]; 38270 const isClipboardApiSupported = useSupported(() => navigator2 && "clipboard" in navigator2); 38271 const isSupported = computed(() => isClipboardApiSupported.value || legacy); 38272 const text = ref(""); 38273 const copied = ref(false); 38274 const timeout = useTimeoutFn(() => copied.value = false, copiedDuring); 38275 function updateText() { 38276 if (isClipboardApiSupported.value) { 38277 navigator2.clipboard.readText().then((value) => { 38278 text.value = value; 38279 }); 38280 } else { 38281 text.value = legacyRead(); 38282 } 38283 } 38284 if (isSupported.value && read) { 38285 for (const event of events2) 38286 useEventListener(event, updateText); 38287 } 38288 async function copy(value = resolveUnref(source)) { 38289 if (isSupported.value && value != null) { 38290 if (isClipboardApiSupported.value) 38291 await navigator2.clipboard.writeText(value); 38292 else 38293 legacyCopy(value); 38294 text.value = value; 38295 copied.value = true; 38296 timeout.start(); 38297 } 38298 } 38299 function legacyCopy(value) { 38300 const ta = document.createElement("textarea"); 38301 ta.value = value != null ? value : ""; 38302 ta.style.position = "absolute"; 38303 ta.style.opacity = "0"; 38304 document.body.appendChild(ta); 38305 ta.select(); 38306 document.execCommand("copy"); 38307 ta.remove(); 38308 } 38309 function legacyRead() { 38310 var _a2, _b, _c; 38311 return (_c = (_b = (_a2 = document == null ? void 0 : document.getSelection) == null ? void 0 : _a2.call(document)) == null ? void 0 : _b.toString()) != null ? _c : ""; 38312 } 38313 return { 38314 isSupported, 38315 text, 38316 copied, 38317 copy 38318 }; 38319} 38320const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; 38321const globalKey = "__vueuse_ssr_handlers__"; 38322_global[globalKey] = _global[globalKey] || {}; 38323const DefaultMagicKeysAliasMap = { 38324 ctrl: "control", 38325 command: "meta", 38326 cmd: "meta", 38327 option: "alt", 38328 up: "arrowup", 38329 down: "arrowdown", 38330 left: "arrowleft", 38331 right: "arrowright" 38332}; 38333function useMagicKeys(options = {}) { 38334 const { 38335 reactive: useReactive = false, 38336 target = defaultWindow, 38337 aliasMap = DefaultMagicKeysAliasMap, 38338 passive = true, 38339 onEventFired = noop 38340 } = options; 38341 const current = reactive(/* @__PURE__ */ new Set()); 38342 const obj = { 38343 toJSON() { 38344 return {}; 38345 }, 38346 current 38347 }; 38348 const refs = useReactive ? reactive(obj) : obj; 38349 const metaDeps = /* @__PURE__ */ new Set(); 38350 const usedKeys = /* @__PURE__ */ new Set(); 38351 function setRefs(key, value) {
38352 if (key in refs) { 38353 if (useReactive) 38354 refs[key] = value; 38355 else 38356 refs[key].value = value; 38357 } 38358 } 38359 function reset() { 38360 current.clear(); 38361 for (const key of usedKeys) 38362 setRefs(key, false); 38363 } 38364 function updateRefs(e, value) { 38365 var _a2, _b; 38366 const key = (_a2 = e.key) == null ? void 0 : _a2.toLowerCase(); 38367 const code = (_b = e.code) == null ? void 0 : _b.toLowerCase(); 38368 const values = [code, key].filter(Boolean); 38369 if (key) { 38370 if (value) 38371 current.add(key); 38372 else 38373 current.delete(key); 38374 } 38375 for (const key2 of values) { 38376 usedKeys.add(key2); 38377 setRefs(key2, value); 38378 } 38379 if (key === "meta" && !value) { 38380 metaDeps.forEach((key2) => { 38381 current.delete(key2); 38382 setRefs(key2, false); 38383 }); 38384 metaDeps.clear(); 38385 } else if (typeof e.getModifierState === "function" && e.getModifierState("Meta") && value) { 38386 [...current, ...values].forEach((key2) => metaDeps.add(key2)); 38387 } 38388 } 38389 useEventListener(target, "keydown", (e) => { 38390 updateRefs(e, true); 38391 return onEventFired(e); 38392 }, { passive }); 38393 useEventListener(target, "keyup", (e) => { 38394 updateRefs(e, false); 38395 return onEventFired(e); 38396 }, { passive }); 38397 useEventListener("blur", reset, { passive: true }); 38398 useEventListener("focus", reset, { passive: true }); 38399 const proxy = new Proxy(refs, { 38400 get(target2, prop, rec) { 38401 if (typeof prop !== "string") 38402 return Reflect.get(target2, prop, rec); 38403 prop = prop.toLowerCase(); 38404 if (prop in aliasMap) 38405 prop = aliasMap[prop]; 38406 if (!(prop in refs)) { 38407 if (/[+_-]/.test(prop)) { 38408 const keys2 = prop.split(/[+_-]/g).map((i) => i.trim()); 38409 refs[prop] = computed(() => keys2.every((key) => unref(proxy[key]))); 38410 } else { 38411 refs[prop] = ref(false); 38412 } 38413 } 38414 const r = Reflect.get(target2, prop, rec); 38415 return useReactive ? unref(r) : r; 38416 } 38417 }); 38418 return proxy; 38419} 38420var SwipeDirection; 38421(function(SwipeDirection2) { 38422 SwipeDirection2["UP"] = "UP"; 38423 SwipeDirection2["RIGHT"] = "RIGHT"; 38424 SwipeDirection2["DOWN"] = "DOWN"; 38425 SwipeDirection2["LEFT"] = "LEFT"; 38426 SwipeDirection2["NONE"] = "NONE"; 38427})(SwipeDirection || (SwipeDirection = {})); 38428const DEFAULT_UNITS = [ 38429 { max: 6e4, value: 1e3, name: "second" }, 38430 { max: 276e4, value: 6e4, name: "minute" }, 38431 { max: 72e6, value: 36e5, name: "hour" }, 38432 { max: 5184e5, value: 864e5, name: "day" }, 38433 { max: 24192e5, value: 6048e5, name: "week" }, 38434 { max: 28512e6, value: 2592e6, name: "month" }, 38435 { max: Infinity, value: 31536e6, name: "year" } 38436]; 38437const DEFAULT_MESSAGES = { 38438 justNow: "just now", 38439 past: (n2) => n2.match(/\d/) ? `${n2} ago` : n2, 38440 future: (n2) => n2.match(/\d/) ? `in ${n2}` : n2, 38441 month: (n2, past) => n2 === 1 ? past ? "last month" : "next month" : `${n2} month${n2 > 1 ? "s" : ""}`, 38442 year: (n2, past) => n2 === 1 ? past ? "last year" : "next year" : `${n2} year${n2 > 1 ? "s" : ""}`, 38443 day: (n2, past) => n2 === 1 ? past ? "yesterday" : "tomorrow" : `${n2} day${n2 > 1 ? "s" : ""}`, 38444 week: (n2, past) => n2 === 1 ? past ? "last week" : "next week" : `${n2} week${n2 > 1 ? "s" : ""}`, 38445 hour: (n2) => `${n2} hour${n2 > 1 ? "s" : ""}`, 38446 minute: (n2) => `${n2} minute${n2 > 1 ? "s" : ""}`, 38447 second: (n2) => `${n2} second${n2 > 1 ? "s" : ""}`, 38448 invalid: "" 38449}; 38450const DEFAULT_FORMATTER = (date4) => date4.toISOString().slice(0, 10); 38451function formatTimeAgo(from, options = {}, now2 = Date.now()) { 38452 var _a2; 38453 const { 38454 max, 38455 messages: messages2 = DEFAULT_MESSAGES, 38456 fullDateFormatter = DEFAULT_FORMATTER, 38457 units = DEFAULT_UNITS, 38458 showSecond = false, 38459 rounding = "round" 38460 } = options; 38461 const roundFn = typeof rounding === "number" ? (n2) => +n2.toFixed(rounding) : Math[rounding]; 38462 const diff2 = +now2 - +from; 38463 const absDiff = Math.abs(diff2); 38464 function getValue2(diff22, unit) { 38465 return roundFn(Math.abs(diff22) / unit.value); 38466 } 38467 function format2(diff22, unit) { 38468 const val = getValue2(diff22, unit); 38469 const past = diff22 > 0; 38470 const str = applyFormat(unit.name, val, past); 38471 return applyFormat(past ? "past" : "future", str, past); 38472 } 38473 function applyFormat(name, val, isPast) { 38474 const formatter = messages2[name]; 38475 if (typeof formatter === "function") 38476 return formatter(val, isPast); 38477 return formatter.replace("{0}", val.toString()); 38478 } 38479 if (absDiff < 6e4 && !showSecond) 38480 return messages2.justNow;
38481 if (typeof max === "number" && absDiff > max) 38482 return fullDateFormatter(new Date(from)); 38483 if (typeof max === "string") { 38484 const unitMax = (_a2 = units.find((i) => i.name === max)) == null ? void 0 : _a2.max; 38485 if (unitMax && absDiff > unitMax) 38486 return fullDateFormatter(new Date(from)); 38487 } 38488 for (const [idx, unit] of units.entries()) { 38489 const val = getValue2(diff2, unit); 38490 if (val <= 0 && units[idx - 1]) 38491 return format2(diff2, units[idx - 1]); 38492 if (absDiff < unit.max) 38493 return format2(diff2, unit); 38494 } 38495 return messages2.invalid; 38496} 38497var __defProp = Object.defineProperty; 38498var __getOwnPropSymbols = Object.getOwnPropertySymbols; 38499var __hasOwnProp = Object.prototype.hasOwnProperty; 38500var __propIsEnum = Object.prototype.propertyIsEnumerable; 38501var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; 38502var __spreadValues = (a, b) => { 38503 for (var prop in b || (b = {})) 38504 if (__hasOwnProp.call(b, prop)) 38505 __defNormalProp(a, prop, b[prop]); 38506 if (__getOwnPropSymbols) 38507 for (var prop of __getOwnPropSymbols(b)) { 38508 if (__propIsEnum.call(b, prop)) 38509 __defNormalProp(a, prop, b[prop]); 38510 } 38511 return a; 38512}; 38513const _TransitionPresets = { 38514 easeInSine: [0.12, 0, 0.39, 0], 38515 easeOutSine: [0.61, 1, 0.88, 1], 38516 easeInOutSine: [0.37, 0, 0.63, 1], 38517 easeInQuad: [0.11, 0, 0.5, 0], 38518 easeOutQuad: [0.5, 1, 0.89, 1], 38519 easeInOutQuad: [0.45, 0, 0.55, 1], 38520 easeInCubic: [0.32, 0, 0.67, 0], 38521 easeOutCubic: [0.33, 1, 0.68, 1], 38522 easeInOutCubic: [0.65, 0, 0.35, 1], 38523 easeInQuart: [0.5, 0, 0.75, 0], 38524 easeOutQuart: [0.25, 1, 0.5, 1], 38525 easeInOutQuart: [0.76, 0, 0.24, 1], 38526 easeInQuint: [0.64, 0, 0.78, 0], 38527 easeOutQuint: [0.22, 1, 0.36, 1], 38528 easeInOutQuint: [0.83, 0, 0.17, 1], 38529 easeInExpo: [0.7, 0, 0.84, 0], 38530 easeOutExpo: [0.16, 1, 0.3, 1], 38531 easeInOutExpo: [0.87, 0, 0.13, 1], 38532 easeInCirc: [0.55, 0, 1, 0.45], 38533 easeOutCirc: [0, 0.55, 0.45, 1], 38534 easeInOutCirc: [0.85, 0, 0.15, 1], 38535 easeInBack: [0.36, 0, 0.66, -0.56], 38536 easeOutBack: [0.34, 1.56, 0.64, 1], 38537 easeInOutBack: [0.68, -0.6, 0.32, 1.6] 38538}; 38539__spreadValues({ 38540 linear: identity 38541}, _TransitionPresets); 38542const _export_sfc = (sfc, props) => { 38543 const target = sfc.__vccOpts || sfc; 38544 for (const [key, val] of props) { 38545 target[key] = val; 38546 } 38547 return target; 38548}; 38549const _hoisted_1$1 = { 38550 viewBox: "0 0 32 32", 38551 width: "1.2em", 38552 height: "1.2em" 38553}; 38554const _hoisted_2$1 = /* @__PURE__ */ createBaseVNode("path", { 38555 fill: "currentColor", 38556 d: "m13 24l-9-9l1.414-1.414L13 21.171L26.586 7.586L28 9L13 24z" 38557}, null, -1); 38558const _hoisted_3$1 = [ 38559 _hoisted_2$1 38560]; 38561function render$1(_ctx, _cache) { 38562 return openBlock(), createElementBlock("svg", _hoisted_1$1, _hoisted_3$1); 38563} 38564const ICarbonCheckmark = { name: "carbon-checkmark", render: render$1 }; 38565const _hoisted_1 = { 38566 viewBox: "0 0 32 32", 38567 width: "1.2em", 38568 height: "1.2em" 38569}; 38570const _hoisted_2 = /* @__PURE__ */ createBaseVNode("path", { 38571 fill: "currentColor", 38572 d: "M24 9.4L22.6 8L16 14.6L9.4 8L8 9.4l6.6 6.6L8 22.6L9.4 24l6.6-6.6l6.6 6.6l1.4-1.4l-6.6-6.6L24 9.4z" 38573}, null, -1); 38574const _hoisted_3 = [ 38575 _hoisted_2 38576]; 38577function render(_ctx, _cache) { 38578 return openBlock(), createElementBlock("svg", _hoisted_1, _hoisted_3); 38579} 38580const ICarbonClose = { name: "carbon-close", render }; 38581var axios$3 = { exports: {} }; 38582var bind$2 = function bind(fn, thisArg) { 38583 return function wrap() { 38584 var args = new Array(arguments.length); 38585 for (var i = 0; i < args.length; i++) { 38586 args[i] = arguments[i]; 38587 } 38588 return fn.apply(thisArg, args); 38589 }; 38590}; 38591var bind$1 = bind$2; 38592var toString = Object.prototype.toString; 38593var kindOf = function(cache2) { 38594 return function(thing) { 38595 var str = toString.call(thing); 38596 return cache2[str] || (cache2[str] = str.slice(8, -1).toLowerCase()); 38597 }; 38598}(/* @__PURE__ */ Object.create(null)); 38599function kindOfTest(type4) { 38600 type4 = type4.toLowerCase(); 38601 return function isKindOf(thing) { 38602 return kindOf(thing) === type4; 38603 }; 38604} 38605function isArray(val) { 38606 return Array.isArray(val); 38607} 38608function isUndefined(val) { 38609 return typeof val === "undefined"; 38610} 38611function isBuffer(val) { 38612 return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === "function" && val.constructor.isBuffer(val); 38613} 38614var isArrayBuffer = kindOfTest("ArrayBuffer"); 38615function isArrayBufferView(val) { 38616 var result; 38617 if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { 38618 result = ArrayBuffer.isView(val); 38619 } else { 38620 result = val && val.buffer && isArrayBuffer(val.buffer); 38621 } 38622 return result; 38623} 38624function isString(val) { 38625 return typeof val === "string"; 38626} 38627function isNumber(val) { 38628 return typeof val === "number"; 38629} 38630function isObject(val) { 38631 return val !== null && typeof val === "object"; 38632} 38633function isPlainObject(val) { 38634 if (kindOf(val) !== "object") { 38635 return false;
38636 } 38637 var prototype2 = Object.getPrototypeOf(val); 38638 return prototype2 === null || prototype2 === Object.prototype; 38639} 38640var isDate = kindOfTest("Date"); 38641var isFile = kindOfTest("File"); 38642var isBlob = kindOfTest("Blob"); 38643var isFileList = kindOfTest("FileList"); 38644function isFunction(val) { 38645 return toString.call(val) === "[object Function]"; 38646} 38647function isStream(val) { 38648 return isObject(val) && isFunction(val.pipe); 38649} 38650function isFormData(thing) { 38651 var pattern4 = "[object FormData]"; 38652 return thing && (typeof FormData === "function" && thing instanceof FormData || toString.call(thing) === pattern4 || isFunction(thing.toString) && thing.toString() === pattern4); 38653} 38654var isURLSearchParams = kindOfTest("URLSearchParams"); 38655function trim(str) { 38656 return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ""); 38657} 38658function isStandardBrowserEnv() { 38659 if (typeof navigator !== "undefined" && (navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS")) { 38660 return false; 38661 } 38662 return typeof window !== "undefined" && typeof document !== "undefined"; 38663} 38664function forEach(obj, fn) { 38665 if (obj === null || typeof obj === "undefined") { 38666 return; 38667 } 38668 if (typeof obj !== "object") { 38669 obj = [obj]; 38670 } 38671 if (isArray(obj)) { 38672 for (var i = 0, l2 = obj.length; i < l2; i++) { 38673 fn.call(null, obj[i], i, obj); 38674 } 38675 } else { 38676 for (var key in obj) { 38677 if (Object.prototype.hasOwnProperty.call(obj, key)) { 38678 fn.call(null, obj[key], key, obj); 38679 } 38680 } 38681 } 38682} 38683function merge() { 38684 var result = {}; 38685 function assignValue2(val, key) { 38686 if (isPlainObject(result[key]) && isPlainObject(val)) { 38687 result[key] = merge(result[key], val); 38688 } else if (isPlainObject(val)) { 38689 result[key] = merge({}, val); 38690 } else if (isArray(val)) { 38691 result[key] = val.slice(); 38692 } else { 38693 result[key] = val; 38694 } 38695 } 38696 for (var i = 0, l2 = arguments.length; i < l2; i++) { 38697 forEach(arguments[i], assignValue2); 38698 } 38699 return result; 38700} 38701function extend(a, b, thisArg) { 38702 forEach(b, function assignValue2(val, key) { 38703 if (thisArg && typeof val === "function") { 38704 a[key] = bind$1(val, thisArg); 38705 } else { 38706 a[key] = val; 38707 } 38708 }); 38709 return a; 38710} 38711function stripBOM(content) { 38712 if (content.charCodeAt(0) === 65279) { 38713 content = content.slice(1); 38714 } 38715 return content; 38716} 38717function inherits(constructor, superConstructor, props, descriptors2) { 38718 constructor.prototype = Object.create(superConstructor.prototype, descriptors2); 38719 constructor.prototype.constructor = constructor; 38720 props && Object.assign(constructor.prototype, props); 38721} 38722function toFlatObject(sourceObj, destObj, filter) { 38723 var props; 38724 var i; 38725 var prop; 38726 var merged = {}; 38727 destObj = destObj || {}; 38728 do { 38729 props = Object.getOwnPropertyNames(sourceObj); 38730 i = props.length; 38731 while (i-- > 0) { 38732 prop = props[i]; 38733 if (!merged[prop]) { 38734 destObj[prop] = sourceObj[prop]; 38735 merged[prop] = true; 38736 } 38737 } 38738 sourceObj = Object.getPrototypeOf(sourceObj); 38739 } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); 38740 return destObj; 38741} 38742function endsWith(str, searchString, position) { 38743 str = String(str); 38744 if (position === void 0 || position > str.length) { 38745 position = str.length; 38746 } 38747 position -= searchString.length; 38748 var lastIndex = str.indexOf(searchString, position); 38749 return lastIndex !== -1 && lastIndex === position; 38750} 38751function toArray(thing) { 38752 if (!thing) 38753 return null; 38754 var i = thing.length; 38755 if (isUndefined(i)) 38756 return null; 38757 var arr = new Array(i); 38758 while (i-- > 0) { 38759 arr[i] = thing[i]; 38760 } 38761 return arr; 38762} 38763var isTypedArray = function(TypedArray) { 38764 return function(thing) { 38765 return TypedArray && thing instanceof TypedArray; 38766 }; 38767}(typeof Uint8Array !== "undefined" && Object.getPrototypeOf(Uint8Array)); 38768var utils$b = { 38769 isArray, 38770 isArrayBuffer, 38771 isBuffer, 38772 isFormData, 38773 isArrayBufferView, 38774 isString, 38775 isNumber, 38776 isObject, 38777 isPlainObject, 38778 isUndefined, 38779 isDate, 38780 isFile, 38781 isBlob, 38782 isFunction, 38783 isStream, 38784 isURLSearchParams, 38785 isStandardBrowserEnv, 38786 forEach, 38787 merge, 38788 extend, 38789 trim, 38790 stripBOM, 38791 inherits, 38792 toFlatObject, 38793 kindOf, 38794 kindOfTest, 38795 endsWith, 38796 toArray, 38797 isTypedArray, 38798 isFileList 38799}; 38800var utils$a = utils$b; 38801function encode$1(val) { 38802 return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); 38803} 38804var buildURL$1 = function buildURL(url2, params, paramsSerializer) { 38805 if (!params) { 38806 return url2; 38807 } 38808 var serializedParams; 38809 if (paramsSerializer) { 38810 serializedParams = paramsSerializer(params); 38811 } else if (utils$a.isURLSearchParams(params)) { 38812 serializedParams = params.toString(); 38813 } else { 38814 var parts = []; 38815 utils$a.forEach(params, function serialize(val, key) { 38816 if (val === null || typeof val === "undefined") { 38817 return; 38818 } 38819 if (utils$a.isArray(val)) { 38820 key = key + "[]"; 38821 } else { 38822 val = [val]; 38823 } 38824 utils$a.forEach(val, function parseValue(v) { 38825 if (utils$a.isDate(v)) { 38826 v = v.toISOString(); 38827 } else if (utils$a.isObject(v)) { 38828 v = JSON.stringify(v); 38829 } 38830 parts.push(encode$1(key) + "=" + encode$1(v)); 38831 }); 38832 }); 38833 serializedParams = parts.join("&"); 38834 } 38835 if (serializedParams) { 38836 var hashmarkIndex = url2.indexOf("#"); 38837 if (hashmarkIndex !== -1) { 38838 url2 = url2.slice(0, hashmarkIndex); 38839 } 38840 url2 += (url2.indexOf("?") === -1 ? "?" : "&") + serializedParams; 38841 } 38842 return url2; 38843}; 38844var utils$9 = utils$b; 38845function InterceptorManager$1() { 38846 this.handlers = []; 38847} 38848InterceptorManager$1.prototype.use = function use(fulfilled, rejected, options) { 38849 this.handlers.push({ 38850 fulfilled, 38851 rejected, 38852 synchronous: options ? options.synchronous : false, 38853 runWhen: options ? options.runWhen : null 38854 }); 38855 return this.handlers.length - 1; 38856}; 38857InterceptorManager$1.prototype.eject = function eject(id) { 38858 if (this.handlers[id]) { 38859 this.handlers[id] = null; 38860 } 38861}; 38862InterceptorManager$1.prototype.forEach = function forEach2(fn) { 38863 utils$9.forEach(this.handlers, function forEachHandler(h2) { 38864 if (h2 !== null) { 38865 fn(h2); 38866 } 38867 }); 38868}; 38869var InterceptorManager_1 = InterceptorManager$1; 38870var utils$8 = utils$b; 38871var normalizeHeaderName$1 = function normalizeHeaderName(headers, normalizedName) { 38872 utils$8.forEach(headers, function processHeader(value, name) { 38873 if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { 38874 headers[normalizedName] = value; 38875 delete headers[name]; 38876 } 38877 }); 38878}; 38879var utils$7 = utils$b; 38880function AxiosError$2(message, code, config, request2, response) { 38881 Error.call(this); 38882 this.message = message; 38883 this.name = "AxiosError"; 38884 code && (this.code = code); 38885 config && (this.config = config); 38886 request2 && (this.request = request2); 38887 response && (this.response = response); 38888}
38889utils$7.inherits(AxiosError$2, Error, { 38890 toJSON: function toJSON() { 38891 return { 38892 // Standard 38893 message: this.message, 38894 name: this.name, 38895 // Microsoft 38896 description: this.description, 38897 number: this.number, 38898 // Mozilla 38899 fileName: this.fileName, 38900 lineNumber: this.lineNumber, 38901 columnNumber: this.columnNumber, 38902 stack: this.stack, 38903 // Axios 38904 config: this.config, 38905 code: this.code, 38906 status: this.response && this.response.status ? this.response.status : null 38907 }; 38908 } 38909}); 38910var prototype = AxiosError$2.prototype; 38911var descriptors = {}; 38912[ 38913 "ERR_BAD_OPTION_VALUE", 38914 "ERR_BAD_OPTION", 38915 "ECONNABORTED", 38916 "ETIMEDOUT", 38917 "ERR_NETWORK", 38918 "ERR_FR_TOO_MANY_REDIRECTS", 38919 "ERR_DEPRECATED", 38920 "ERR_BAD_RESPONSE", 38921 "ERR_BAD_REQUEST", 38922 "ERR_CANCELED" 38923 // eslint-disable-next-line func-names 38924].forEach(function(code) { 38925 descriptors[code] = { value: code }; 38926}); 38927Object.defineProperties(AxiosError$2, descriptors); 38928Object.defineProperty(prototype, "isAxiosError", { value: true }); 38929AxiosError$2.from = function(error, code, config, request2, response, customProps) { 38930 var axiosError = Object.create(prototype); 38931 utils$7.toFlatObject(error, axiosError, function filter(obj) { 38932 return obj !== Error.prototype; 38933 }); 38934 AxiosError$2.call(axiosError, error.message, code, config, request2, response); 38935 axiosError.name = error.name; 38936 customProps && Object.assign(axiosError, customProps); 38937 return axiosError; 38938}; 38939var AxiosError_1 = AxiosError$2; 38940var transitional = { 38941 silentJSONParsing: true, 38942 forcedJSONParsing: true, 38943 clarifyTimeoutError: false 38944}; 38945var utils$6 = utils$b; 38946function toFormData$1(obj, formData) { 38947 formData = formData || new FormData(); 38948 var stack2 = []; 38949 function convertValue(value) { 38950 if (value === null) 38951 return ""; 38952 if (utils$6.isDate(value)) { 38953 return value.toISOString(); 38954 } 38955 if (utils$6.isArrayBuffer(value) || utils$6.isTypedArray(value)) { 38956 return typeof Blob === "function" ? new Blob([value]) : Buffer.from(value); 38957 } 38958 return value; 38959 } 38960 function build(data2, parentKey) { 38961 if (utils$6.isPlainObject(data2) || utils$6.isArray(data2)) { 38962 if (stack2.indexOf(data2) !== -1) { 38963 throw Error("Circular reference detected in " + parentKey); 38964 } 38965 stack2.push(data2); 38966 utils$6.forEach(data2, function each(value, key) { 38967 if (utils$6.isUndefined(value)) 38968 return; 38969 var fullKey = parentKey ? parentKey + "." + key : key; 38970 var arr; 38971 if (value && !parentKey && typeof value === "object") { 38972 if (utils$6.endsWith(key, "{}")) { 38973 value = JSON.stringify(value); 38974 } else if (utils$6.endsWith(key, "[]") && (arr = utils$6.toArray(value))) { 38975 arr.forEach(function(el) { 38976 !utils$6.isUndefined(el) && formData.append(fullKey, convertValue(el)); 38977 }); 38978 return; 38979 } 38980 } 38981 build(value, fullKey); 38982 }); 38983 stack2.pop(); 38984 } else { 38985 formData.append(parentKey, convertValue(data2)); 38986 } 38987 } 38988 build(obj); 38989 return formData; 38990} 38991var toFormData_1 = toFormData$1; 38992var settle; 38993var hasRequiredSettle; 38994function requireSettle() { 38995 if (hasRequiredSettle) 38996 return settle; 38997 hasRequiredSettle = 1; 38998 var AxiosError2 = AxiosError_1; 38999 settle = function settle2(resolve2, reject, response) { 39000 var validateStatus2 = response.config.validateStatus; 39001 if (!response.status || !validateStatus2 || validateStatus2(response.status)) { 39002 resolve2(response); 39003 } else { 39004 reject(new AxiosError2( 39005 "Request failed with status code " + response.status, 39006 [AxiosError2.ERR_BAD_REQUEST, AxiosError2.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], 39007 response.config, 39008 response.request, 39009 response 39010 )); 39011 } 39012 }; 39013 return settle; 39014} 39015var cookies; 39016var hasRequiredCookies; 39017function requireCookies() { 39018 if (hasRequiredCookies) 39019 return cookies; 39020 hasRequiredCookies = 1; 39021 var utils2 = utils$b; 39022 cookies = utils2.isStandardBrowserEnv() ? ( 39023 // Standard browser envs support document.cookie 39024 function standardBrowserEnv() { 39025 return { 39026 write: function write(name, value, expires, path, domain, secure) { 39027 var cookie = []; 39028 cookie.push(name + "=" + encodeURIComponent(value)); 39029 if (utils2.isNumber(expires)) { 39030 cookie.push("expires=" + new Date(expires).toGMTString()); 39031 } 39032 if (utils2.isString(path)) { 39033 cookie.push("path=" + path); 39034 } 39035 if (utils2.isString(domain)) { 39036 cookie.push("domain=" + domain); 39037 } 39038 if (secure === true) { 39039 cookie.push("secure"); 39040 } 39041 document.cookie = cookie.join("; "); 39042 }, 39043 read: function read(name) { 39044 var match2 = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)")); 39045 return match2 ? decodeURIComponent(match2[3]) : null; 39046 }, 39047 remove: function remove2(name) { 39048 this.write(name, "", Date.now() - 864e5); 39049 } 39050 }; 39051 }() 39052 ) : ( 39053 // Non standard browser env (web workers, react-native) lack needed support. 39054 function nonStandardBrowserEnv() { 39055 return { 39056 write: function write() { 39057 }, 39058 read: function read() { 39059 return null; 39060 }, 39061 remove: function remove2() { 39062 } 39063 }; 39064 }() 39065 ); 39066 return cookies; 39067} 39068var isAbsoluteURL$1 = function isAbsoluteURL(url2) { 39069 return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url2); 39070}; 39071var combineURLs$1 = function combineURLs(baseURL, relativeURL) { 39072 return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL; 39073}; 39074var isAbsoluteURL2 = isAbsoluteURL$1; 39075var combineURLs2 = combineURLs$1; 39076var buildFullPath$1 = function buildFullPath(baseURL, requestedURL) { 39077 if (baseURL && !isAbsoluteURL2(requestedURL)) { 39078 return combineURLs2(baseURL, requestedURL); 39079 } 39080 return requestedURL; 39081}; 39082var parseHeaders; 39083var hasRequiredParseHeaders; 39084function requireParseHeaders() { 39085 if (hasRequiredParseHeaders) 39086 return parseHeaders; 39087 hasRequiredParseHeaders = 1; 39088 var utils2 = utils$b; 39089 var ignoreDuplicateOf = [ 39090 "age", 39091 "authorization", 39092 "content-length", 39093 "content-type", 39094 "etag", 39095 "expires", 39096 "from", 39097 "host", 39098 "if-modified-since", 39099 "if-unmodified-since", 39100 "last-modified", 39101 "location", 39102 "max-forwards", 39103 "proxy-authorization", 39104 "referer", 39105 "retry-after", 39106 "user-agent" 39107 ]; 39108 parseHeaders = function parseHeaders2(headers) { 39109 var parsed = {}; 39110 var key; 39111 var val; 39112 var i; 39113 if (!headers) { 39114 return parsed; 39115 } 39116 utils2.forEach(headers.split("\n"), function parser(line) { 39117 i = line.indexOf(":");
39118 key = utils2.trim(line.substr(0, i)).toLowerCase(); 39119 val = utils2.trim(line.substr(i + 1)); 39120 if (key) { 39121 if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { 39122 return; 39123 } 39124 if (key === "set-cookie") { 39125 parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); 39126 } else { 39127 parsed[key] = parsed[key] ? parsed[key] + ", " + val : val; 39128 } 39129 } 39130 }); 39131 return parsed; 39132 }; 39133 return parseHeaders; 39134} 39135var isURLSameOrigin; 39136var hasRequiredIsURLSameOrigin; 39137function requireIsURLSameOrigin() { 39138 if (hasRequiredIsURLSameOrigin) 39139 return isURLSameOrigin; 39140 hasRequiredIsURLSameOrigin = 1; 39141 var utils2 = utils$b; 39142 isURLSameOrigin = utils2.isStandardBrowserEnv() ? ( 39143 // Standard browser envs have full support of the APIs needed to test 39144 // whether the request URL is of the same origin as current location. 39145 function standardBrowserEnv() { 39146 var msie = /(msie|trident)/i.test(navigator.userAgent); 39147 var urlParsingNode = document.createElement("a"); 39148 var originURL; 39149 function resolveURL(url2) { 39150 var href = url2; 39151 if (msie) { 39152 urlParsingNode.setAttribute("href", href); 39153 href = urlParsingNode.href; 39154 } 39155 urlParsingNode.setAttribute("href", href); 39156 return { 39157 href: urlParsingNode.href, 39158 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "", 39159 host: urlParsingNode.host, 39160 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "", 39161 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "", 39162 hostname: urlParsingNode.hostname, 39163 port: urlParsingNode.port, 39164 pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname 39165 }; 39166 } 39167 originURL = resolveURL(window.location.href); 39168 return function isURLSameOrigin2(requestURL) { 39169 var parsed = utils2.isString(requestURL) ? resolveURL(requestURL) : requestURL; 39170 return parsed.protocol === originURL.protocol && parsed.host === originURL.host; 39171 }; 39172 }() 39173 ) : ( 39174 // Non standard browser envs (web workers, react-native) lack needed support. 39175 function nonStandardBrowserEnv() { 39176 return function isURLSameOrigin2() { 39177 return true; 39178 }; 39179 }() 39180 ); 39181 return isURLSameOrigin; 39182} 39183var CanceledError_1; 39184var hasRequiredCanceledError; 39185function requireCanceledError() { 39186 if (hasRequiredCanceledError) 39187 return CanceledError_1; 39188 hasRequiredCanceledError = 1; 39189 var AxiosError2 = AxiosError_1; 39190 var utils2 = utils$b; 39191 function CanceledError2(message) { 39192 AxiosError2.call(this, message == null ? "canceled" : message, AxiosError2.ERR_CANCELED); 39193 this.name = "CanceledError"; 39194 } 39195 utils2.inherits(CanceledError2, AxiosError2, { 39196 __CANCEL__: true 39197 }); 39198 CanceledError_1 = CanceledError2; 39199 return CanceledError_1; 39200} 39201var parseProtocol; 39202var hasRequiredParseProtocol; 39203function requireParseProtocol() { 39204 if (hasRequiredParseProtocol) 39205 return parseProtocol; 39206 hasRequiredParseProtocol = 1; 39207 parseProtocol = function parseProtocol2(url2) { 39208 var match2 = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2); 39209 return match2 && match2[1] || ""; 39210 }; 39211 return parseProtocol; 39212} 39213var xhr; 39214var hasRequiredXhr; 39215function requireXhr() { 39216 if (hasRequiredXhr) 39217 return xhr; 39218 hasRequiredXhr = 1; 39219 var utils2 = utils$b; 39220 var settle2 = requireSettle(); 39221 var cookies2 = requireCookies(); 39222 var buildURL3 = buildURL$1; 39223 var buildFullPath3 = buildFullPath$1; 39224 var parseHeaders2 = requireParseHeaders(); 39225 var isURLSameOrigin2 = requireIsURLSameOrigin(); 39226 var transitionalDefaults2 = transitional; 39227 var AxiosError2 = AxiosError_1; 39228 var CanceledError2 = requireCanceledError(); 39229 var parseProtocol2 = requireParseProtocol(); 39230 xhr = function xhrAdapter(config) { 39231 return new Promise(function dispatchXhrRequest(resolve2, reject) { 39232 var requestData = config.data; 39233 var requestHeaders = config.headers; 39234 var responseType = config.responseType; 39235 var onCanceled; 39236 function done() { 39237 if (config.cancelToken) { 39238 config.cancelToken.unsubscribe(onCanceled); 39239 } 39240 if (config.signal) { 39241 config.signal.removeEventListener("abort", onCanceled); 39242 } 39243 } 39244 if (utils2.isFormData(requestData) && utils2.isStandardBrowserEnv()) { 39245 delete requestHeaders["Content-Type"]; 39246 } 39247 var request2 = new XMLHttpRequest(); 39248 if (config.auth) { 39249 var username = config.auth.username || ""; 39250 var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ""; 39251 requestHeaders.Authorization = "Basic " + btoa(username + ":" + password); 39252 } 39253 var fullPath = buildFullPath3(config.baseURL, config.url); 39254 request2.open(config.method.toUpperCase(), buildURL3(fullPath, c
39254onfig.params, config.paramsSerializer), true); 39255 request2.timeout = config.timeout; 39256 function onloadend() { 39257 if (!request2) { 39258 return; 39259 } 39260 var responseHeaders = "getAllResponseHeaders" in request2 ? parseHeaders2(request2.getAllResponseHeaders()) : null; 39261 var responseData = !responseType || responseType === "text" || responseType === "json" ? request2.responseText : request2.response; 39262 var response = { 39263 data: responseData, 39264 status: request2.status, 39265 statusText: request2.statusText, 39266 headers: responseHeaders, 39267 config, 39268 request: request2 39269 }; 39270 settle2(function _resolve(value) { 39271 resolve2(value); 39272 done(); 39273 }, function _reject(err) { 39274 reject(err); 39275 done(); 39276 }, response); 39277 request2 = null; 39278 } 39279 if ("onloadend" in request2) { 39280 request2.onloadend = onloadend; 39281 } else { 39282 request2.onreadystatechange = function handleLoad() { 39283 if (!request2 || request2.readyState !== 4) { 39284 return; 39285 } 39286 if (request2.status === 0 && !(request2.responseURL && request2.responseURL.indexOf("file:") === 0)) { 39287 return; 39288 } 39289 setTimeout(onloadend); 39290 }; 39291 } 39292 request2.onabort = function handleAbort() { 39293 if (!request2) { 39294 return; 39295 } 39296 reject(new AxiosError2("Request aborted", AxiosError2.ECONNABORTED, config, request2)); 39297 request2 = null; 39298 }; 39299 request2.onerror = function handleError2() { 39300 reject(new AxiosError2("Network Error", AxiosError2.ERR_NETWORK, config, request2, request2)); 39301 request2 = null; 39302 }; 39303 request2.ontimeout = function handleTimeout() { 39304 var timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded"; 39305 var transitional3 = config.transitional || transitionalDefaults2; 39306 if (config.timeoutErrorMessage) { 39307 timeoutErrorMessage = config.timeoutErrorMessage; 39308 } 39309 reject(new AxiosError2( 39310 timeoutErrorMessage, 39311 transitional3.clarifyTimeoutError ? AxiosError2.ETIMEDOUT : AxiosError2.ECONNABORTED, 39312 config, 39313 request2 39314 )); 39315 request2 = null; 39316 }; 39317 if (utils2.isStandardBrowserEnv()) { 39318 var xsrfValue = (config.withCredentials || isURLSameOrigin2(fullPath)) && config.xsrfCookieName ? cookies2.read(config.xsrfCookieName) : void 0; 39319 if (xsrfValue) { 39320 requestHeaders[config.xsrfHeaderName] = xsrfValue; 39321 } 39322 } 39323 if ("setRequestHeader" in request2) { 39324 utils2.forEach(requestHeaders, function setRequestHeader(val, key) { 39325 if (typeof requestData === "undefined" && key.toLowerCase() === "content-type") { 39326 delete requestHeaders[key]; 39327 } else { 39328 request2.setRequestHeader(key, val); 39329 } 39330 }); 39331 } 39332 if (!utils2.isUndefined(config.withCredentials)) { 39333 request2.withCredentials = !!config.withCredentials; 39334 } 39335 if (responseType && responseType !== "json") { 39336 request2.responseType = config.responseType; 39337 } 39338 if (typeof config.onDownloadProgress === "function") { 39339 request2.addEventListener("progress", config.onDownloadProgress); 39340 } 39341 if (typeof config.onUploadProgress === "function" && request2.upload) { 39342 request2.upload.addEventListener("progress", config.onUploadProgress); 39343 } 39344 if (config.cancelToken || config.signal) { 39345 onCanceled = function(cancel) { 39346 if (!request2) { 39347 return; 39348 } 39349 reject(!cancel || cancel && cancel.type ? new CanceledError2() : cancel); 39350 request2.abort(); 39351 request2 = null; 39352 }; 39353 config.cancelToken && config.cancelToken.subscribe(onCanceled); 39354 if (config.signal) { 39355 config.signal.aborted ? onCanceled() : config.signal.addEventListener("abort", onCanceled); 39356 } 39357 } 39358 if (!requestData) { 39359 requestData = null; 39360 } 39361 var protocol = parseProtocol2(fullPath); 39362 if (protocol && ["http", "https", "file"].indexOf(protocol) === -1) { 39363 reject(new AxiosError2("Unsupported protocol " + protocol + ":", AxiosError2.ERR_BAD_REQUEST, config)); 39364 return; 39365 } 39366 request2.send(requestData); 39367 }); 39368 }; 39369 return xhr; 39370} 39371var _null; 39372var hasRequired_null; 39373function require_null() { 39374 if (hasRequired_null) 39375 return _null; 39376 hasRequired_null = 1; 39377 _null = null; 39378 return _null; 39379} 39380var utils$5 = utils$b; 39381var normalizeHeaderName2 = normalizeHeaderName$1; 39382var AxiosError$1 = AxiosError_1; 39383var transitionalDefaults = transitional; 39384var toFormData = toFormData_1; 39385var DEFAULT_CONTENT_TYPE = { 39386 "Content-Type": "application/x-www-form-urlencoded" 39387}; 39388function setContentTypeIfUnset(headers, value) { 39389 if (!utils$5.isUndefined(headers) && utils$5.isUndefined(headers["Content-Type"])) { 39390 headers["Content-Type"] = value; 39391 } 39392} 39393function getDefaultAdapter() { 39394 var adapter; 39395 if (typeof XMLHttpRequest !== "undefined") { 39396 adapter = requireXhr(); 39397 } else if (typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]") { 39398 adapter = requireXhr(); 39399 } 39400 return adapter; 39401} 39402function stringifySafely(rawValue, parser, encoder) { 39403 if (utils$5.isString(rawValue)) { 39404 try { 39405 (parser || JSON.parse)(rawValue); 39406 return utils$5.trim(rawValue); 39407 } catch (e) { 39408 if (e.name !== "SyntaxError") { 39409 throw e; 39410 } 39411 } 39412 } 39413 return (encoder || JSON.stringify)(rawValue); 39414} 39415var defaults$3 = { 39416 transitional: transitionalDefaults, 39417 adapter: getDefaultAdapter(), 39418 transformRequest: [function transformRequest(data2, headers) { 39419 normalizeHeaderName2(headers, "Accept"); 39420 normalizeHeaderName2(headers, "Content-Type"); 39421 if (utils$5.isFormData(data2) || utils$5.isArrayBuffer(data2) || utils$5.isBuffer(data2) || utils$5.isStream(data2) || utils$5.isFile(data2) || utils$5.isBlob(data2)) { 39422 return data2; 39423 } 39424 if (utils$5.isArrayBufferView(data2)) { 39425 return data2.buffer; 39426 } 39427 if (utils$5.isURLSearchParams(data2)) { 39428 setContentTypeIfUnset(headers, "application/x-www-form-urlencoded;charset=utf-8"); 39429 return data2.toString(); 39430 } 39431 var isObjectPayload = utils$5.isObject(data2); 39432 var contentType = headers && headers["Content-Type"]; 39433 var isFileList2; 39434 if ((isFileList2 = utils$5.isFileList(data2)) || isObjectPayload && contentType === "multipart/form-data") { 39435 var _FormData = this.env && this.env.FormData; 39436 return toFormData(isFileList2 ? { "files[]": data2 } : data2, _FormData && new _FormData()); 39437 } else if (isObjectPayload || contentType === "application/json") { 39438 setContentTypeIfUnset(headers, "application/json"); 39439 return stringifySafely(data2); 39440 } 39441 return data2; 39442 }], 39443 transformResponse: [function transformResponse(data2) { 39444 var transitional3 = this.transitional || defaults$3.transitional; 39445 var silentJSONParsing = transitional3 && transitional3.silentJSONParsing; 39446 var forcedJSONParsing = transitional3 && transitional3.forcedJSONParsing; 39447 var strictJSONParsing = !silentJSONParsing && this.responseType === "json"; 39448 if (strictJSONParsing || forcedJSONParsing && utils$5.isString(data2) && data2.length) {
39449 try { 39450 return JSON.parse(data2); 39451 } catch (e) { 39452 if (strictJSONParsing) { 39453 if (e.name === "SyntaxError") { 39454 throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response); 39455 } 39456 throw e; 39457 } 39458 } 39459 } 39460 return data2; 39461 }], 39462 /** 39463 * A timeout in milliseconds to abort a request. If set to 0 (default) a 39464 * timeout is not created. 39465 */ 39466 timeout: 0, 39467 xsrfCookieName: "XSRF-TOKEN", 39468 xsrfHeaderName: "X-XSRF-TOKEN", 39469 maxContentLength: -1, 39470 maxBodyLength: -1, 39471 env: { 39472 FormData: require_null() 39473 }, 39474 validateStatus: function validateStatus(status) { 39475 return status >= 200 && status < 300; 39476 }, 39477 headers: { 39478 common: { 39479 "Accept": "application/json, text/plain, */*" 39480 } 39481 } 39482}; 39483utils$5.forEach(["delete", "get", "head"], function forEachMethodNoData(method4) { 39484 defaults$3.headers[method4] = {}; 39485}); 39486utils$5.forEach(["post", "put", "patch"], function forEachMethodWithData(method4) { 39487 defaults$3.headers[method4] = utils$5.merge(DEFAULT_CONTENT_TYPE); 39488}); 39489var defaults_1 = defaults$3; 39490var utils$4 = utils$b; 39491var defaults$2 = defaults_1; 39492var transformData$1 = function transformData(data2, headers, fns) { 39493 var context = this || defaults$2; 39494 utils$4.forEach(fns, function transform(fn) { 39495 data2 = fn.call(context, data2, headers); 39496 }); 39497 return data2; 39498}; 39499var isCancel$1; 39500var hasRequiredIsCancel; 39501function requireIsCancel() { 39502 if (hasRequiredIsCancel) 39503 return isCancel$1; 39504 hasRequiredIsCancel = 1; 39505 isCancel$1 = function isCancel2(value) { 39506 return !!(value && value.__CANCEL__); 39507 }; 39508 return isCancel$1; 39509} 39510var utils$3 = utils$b; 39511var transformData2 = transformData$1; 39512var isCancel = requireIsCancel(); 39513var defaults$1 = defaults_1; 39514var CanceledError = requireCanceledError(); 39515function throwIfCancellationRequested(config) { 39516 if (config.cancelToken) { 39517 config.cancelToken.throwIfRequested(); 39518 } 39519 if (config.signal && config.signal.aborted) { 39520 throw new CanceledError(); 39521 } 39522} 39523var dispatchRequest$1 = function dispatchRequest(config) { 39524 throwIfCancellationRequested(config); 39525 config.headers = config.headers || {}; 39526 config.data = transformData2.call( 39527 config, 39528 config.data, 39529 config.headers, 39530 config.transformRequest 39531 ); 39532 config.headers = utils$3.merge( 39533 config.headers.common || {}, 39534 config.headers[config.method] || {}, 39535 config.headers 39536 ); 39537 utils$3.forEach( 39538 ["delete", "get", "head", "post", "put", "patch", "common"], 39539 function cleanHeaderConfig(method4) { 39540 delete config.headers[method4]; 39541 } 39542 ); 39543 var adapter = config.adapter || defaults$1.adapter; 39544 return adapter(config).then(function onAdapterResolution(response) { 39545 throwIfCancellationRequested(config); 39546 response.data = transformData2.call( 39547 config, 39548 response.data, 39549 response.headers, 39550 config.transformResponse 39551 ); 39552 return response; 39553 }, function onAdapterRejection(reason) { 39554 if (!isCancel(reason)) { 39555 throwIfCancellationRequested(config); 39556 if (reason && reason.response) { 39557 reason.response.data = transformData2.call( 39558 config, 39559 reason.response.data, 39560 reason.response.headers, 39561 config.transformResponse 39562 ); 39563 } 39564 } 39565 return Promise.reject(reason); 39566 }); 39567}; 39568var utils$2 = utils$b; 39569var mergeConfig$2 = function mergeConfig(config1, config2) { 39570 config2 = config2 || {}; 39571 var config = {}; 39572 function getMergedValue(target, source) { 39573 if (utils$2.isPlainObject(target) && utils$2.isPlainObject(source)) { 39574 return utils$2.merge(target, source); 39575 } else if (utils$2.isPlainObject(source)) { 39576 return utils$2.merge({}, source); 39577 } else if (utils$2.isArray(source)) { 39578 return source.slice(); 39579 } 39580 return source; 39581 } 39582 function mergeDeepProperties(prop) { 39583 if (!utils$2.isUndefined(config2[prop])) { 39584 return getMergedValue(config1[prop], config2[prop]); 39585 } else if (!utils$2.isUndefined(config1[prop])) { 39586 return getMergedValue(void 0, config1[prop]); 39587 } 39588 } 39589 function valueFromConfig2(prop) { 39590 if (!utils$2.isUndefined(config2[prop])) { 39591 return getMergedValue(void 0, config2[prop]); 39592 } 39593 } 39594 function defaultToConfig2(prop) { 39595 if (!utils$2.isUndefined(config2[prop])) { 39596 return getMergedValue(void 0, config2[prop]); 39597 } else if (!utils$2.isUndefined(config1[prop])) { 39598 return getMergedValue(void 0, config1[prop]); 39599 } 39600 } 39601 function mergeDirectKeys(prop) { 39602 if (prop in config2) { 39603 return getMergedValue(config1[prop], config2[prop]); 39604 } else if (prop in config1) { 39605 return getMergedValue(void 0, config1[prop]); 39606 } 39607 } 39608 var mergeMap = { 39609 "url": valueFromConfig2, 39610 "method": valueFromConfig2, 39611 "data": valueFromConfig2, 39612 "baseURL": defaultToConfig2, 39613 "transformRequest": defaultToConfig2, 39614 "transformResponse": defaultToConfig2, 39615 "paramsSerializer": defaultToConfig2, 39616 "timeout": defaultToConfig2, 39617 "timeoutMessage": defaultToConfig2, 39618 "withCredentials": defaultToConfig2, 39619 "adapter": defaultToConfig2, 39620 "responseType": defaultToConfig2, 39621 "xsrfCookieName": defaultToConfig2, 39622 "xsrfHeaderName": defaultToConfig2, 39623 "onUploadProgress": defaultToConfig2, 39624 "onDownloadProgress": defaultToConfig2, 39625 "decompress": defaultToConfig2, 39626 "maxContentLength": defaultToConfig2, 39627 "maxBodyLength": defaultToConfig2, 39628 "beforeRedirect": defaultToConfig2, 39629 "transport": defaultToConfig2, 39630 "httpAgent": defaultToConfig2, 39631 "httpsAgent": defaultToConfig2, 39632 "cancelToken": defaultToConfig2,
39633 "socketPath": defaultToConfig2, 39634 "responseEncoding": defaultToConfig2, 39635 "validateStatus": mergeDirectKeys 39636 }; 39637 utils$2.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) { 39638 var merge2 = mergeMap[prop] || mergeDeepProperties; 39639 var configValue = merge2(prop); 39640 utils$2.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue); 39641 }); 39642 return config; 39643}; 39644var data; 39645var hasRequiredData; 39646function requireData() { 39647 if (hasRequiredData) 39648 return data; 39649 hasRequiredData = 1; 39650 data = { 39651 "version": "0.27.2" 39652 }; 39653 return data; 39654} 39655var VERSION$1 = requireData().version; 39656var AxiosError = AxiosError_1; 39657var validators$1 = {}; 39658["object", "boolean", "number", "function", "string", "symbol"].forEach(function(type4, i) { 39659 validators$1[type4] = function validator2(thing) { 39660 return typeof thing === type4 || "a" + (i < 1 ? "n " : " ") + type4; 39661 }; 39662}); 39663var deprecatedWarnings = {}; 39664validators$1.transitional = function transitional2(validator2, version2, message) { 39665 function formatMessage(opt, desc) { 39666 return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : ""); 39667 } 39668 return function(value, opt, opts) { 39669 if (validator2 === false) { 39670 throw new AxiosError( 39671 formatMessage(opt, " has been removed" + (version2 ? " in " + version2 : "")), 39672 AxiosError.ERR_DEPRECATED 39673 ); 39674 } 39675 if (version2 && !deprecatedWarnings[opt]) { 39676 deprecatedWarnings[opt] = true; 39677 console.warn( 39678 formatMessage( 39679 opt, 39680 " has been deprecated since v" + version2 + " and will be removed in the near future" 39681 ) 39682 ); 39683 } 39684 return validator2 ? validator2(value, opt, opts) : true; 39685 }; 39686}; 39687function assertOptions(options, schema, allowUnknown) { 39688 if (typeof options !== "object") { 39689 throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE); 39690 } 39691 var keys2 = Object.keys(options); 39692 var i = keys2.length; 39693 while (i-- > 0) { 39694 var opt = keys2[i]; 39695 var validator2 = schema[opt]; 39696 if (validator2) { 39697 var value = options[opt]; 39698 var result = value === void 0 || validator2(value, opt, options); 39699 if (result !== true) { 39700 throw new AxiosError("option " + opt + " must be " + result, AxiosError.ERR_BAD_OPTION_VALUE); 39701 } 39702 continue; 39703 } 39704 if (allowUnknown !== true) { 39705 throw new AxiosError("Unknown option " + opt, AxiosError.ERR_BAD_OPTION); 39706 } 39707 } 39708} 39709var validator$1 = { 39710 assertOptions, 39711 validators: validators$1 39712}; 39713var utils$1 = utils$b; 39714var buildURL2 = buildURL$1; 39715var InterceptorManager = InterceptorManager_1; 39716var dispatchRequest2 = dispatchRequest$1; 39717var mergeConfig$1 = mergeConfig$2; 39718var buildFullPath2 = buildFullPath$1; 39719var validator = validator$1; 39720var validators = validator.validators; 39721function Axios$1(instanceConfig) { 39722 this.defaults = instanceConfig; 39723 this.interceptors = { 39724 request: new InterceptorManager(), 39725 response: new InterceptorManager() 39726 }; 39727} 39728Axios$1.prototype.request = function request(configOrUrl, config) { 39729 if (typeof configOrUrl === "string") { 39730 config = config || {}; 39731 config.url = configOrUrl; 39732 } else { 39733 config = configOrUrl || {}; 39734 } 39735 config = mergeConfig$1(this.defaults, config); 39736 if (config.method) { 39737 config.method = config.method.toLowerCase(); 39738 } else if (this.defaults.method) { 39739 config.method = this.defaults.method.toLowerCase(); 39740 } else { 39741 config.method = "get"; 39742 } 39743 var transitional3 = config.transitional; 39744 if (transitional3 !== void 0) { 39745 validator.assertOptions(transitional3, { 39746 silentJSONParsing: validators.transitional(validators.boolean), 39747 forcedJSONParsing: validators.transitional(validators.boolean), 39748 clarifyTimeoutError: validators.transitional(validators.boolean) 39749 }, false); 39750 } 39751 var requestInterceptorChain = []; 39752 var synchronousRequestInterceptors = true; 39753 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { 39754 if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) { 39755 return; 39756 } 39757 synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; 39758 requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); 39759 }); 39760 var responseInterceptorChain = []; 39761 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { 39762 responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); 39763 }); 39764 var promise; 39765 if (!synchronousRequestInterceptors) { 39766 var chain = [dispatchRequest2, void 0]; 39767 Array.prototype.unshift.apply(chain, requestInterceptorChain); 39768 chain = chain.concat(responseInterceptorChain); 39769 promise = Promise.resolve(config); 39770 while (chain.length) { 39771 promise = promise.then(chain.shift(), chain.shift()); 39772 } 39773 return promise; 39774 } 39775 var newConfig = config; 39776 while (requestInterceptorChain.length) { 39777 var onFulfilled = requestInterceptorChain.shift(); 39778 var onRejected = requestInterceptorChain.shift(); 39779 try { 39780 newConfig = onFulfilled(newConfig); 39781 } catch (error) { 39782 onRejected(error); 39783 break; 39784 } 39785 } 39786 try { 39787 promise = dispatchRequest2(newConfig); 39788 } catch (error) { 39789 return Promise.reject(error); 39790 } 39791 while (responseInterceptorChain.length) { 39792 promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift()); 39793 } 39794 return promise; 39795}; 39796Axios$1.prototype.getUri = function getUri(config) { 39797 config = mergeConfig$1(this.defaults, config); 39798 var fullPath = buildFullPath2(config.baseURL, config.url);
39799 return buildURL2(fullPath, config.params, config.paramsSerializer); 39800}; 39801utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData2(method4) { 39802 Axios$1.prototype[method4] = function(url2, config) { 39803 return this.request(mergeConfig$1(config || {}, { 39804 method: method4, 39805 url: url2, 39806 data: (config || {}).data 39807 })); 39808 }; 39809}); 39810utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData2(method4) { 39811 function generateHTTPMethod(isForm) { 39812 return function httpMethod(url2, data2, config) { 39813 return this.request(mergeConfig$1(config || {}, { 39814 method: method4, 39815 headers: isForm ? { 39816 "Content-Type": "multipart/form-data" 39817 } : {}, 39818 url: url2, 39819 data: data2 39820 })); 39821 }; 39822 } 39823 Axios$1.prototype[method4] = generateHTTPMethod(); 39824 Axios$1.prototype[method4 + "Form"] = generateHTTPMethod(true); 39825}); 39826var Axios_1 = Axios$1; 39827var CancelToken_1; 39828var hasRequiredCancelToken; 39829function requireCancelToken() { 39830 if (hasRequiredCancelToken) 39831 return CancelToken_1; 39832 hasRequiredCancelToken = 1; 39833 var CanceledError2 = requireCanceledError(); 39834 function CancelToken(executor) { 39835 if (typeof executor !== "function") { 39836 throw new TypeError("executor must be a function."); 39837 } 39838 var resolvePromise; 39839 this.promise = new Promise(function promiseExecutor(resolve2) { 39840 resolvePromise = resolve2; 39841 }); 39842 var token = this; 39843 this.promise.then(function(cancel) { 39844 if (!token._listeners) 39845 return; 39846 var i; 39847 var l2 = token._listeners.length; 39848 for (i = 0; i < l2; i++) { 39849 token._listeners[i](cancel); 39850 } 39851 token._listeners = null; 39852 }); 39853 this.promise.then = function(onfulfilled) { 39854 var _resolve; 39855 var promise = new Promise(function(resolve2) { 39856 token.subscribe(resolve2); 39857 _resolve = resolve2; 39858 }).then(onfulfilled); 39859 promise.cancel = function reject() { 39860 token.unsubscribe(_resolve); 39861 }; 39862 return promise; 39863 }; 39864 executor(function cancel(message) { 39865 if (token.reason) { 39866 return; 39867 } 39868 token.reason = new CanceledError2(message); 39869 resolvePromise(token.reason); 39870 }); 39871 } 39872 CancelToken.prototype.throwIfRequested = function throwIfRequested() { 39873 if (this.reason) { 39874 throw this.reason; 39875 } 39876 }; 39877 CancelToken.prototype.subscribe = function subscribe(listener) { 39878 if (this.reason) { 39879 listener(this.reason); 39880 return; 39881 } 39882 if (this._listeners) { 39883 this._listeners.push(listener); 39884 } else { 39885 this._listeners = [listener]; 39886 } 39887 }; 39888 CancelToken.prototype.unsubscribe = function unsubscribe(listener) { 39889 if (!this._listeners) { 39890 return; 39891 } 39892 var index = this._listeners.indexOf(listener); 39893 if (index !== -1) { 39894 this._listeners.splice(index, 1); 39895 } 39896 }; 39897 CancelToken.source = function source() { 39898 var cancel; 39899 var token = new CancelToken(function executor(c2) { 39900 cancel = c2; 39901 }); 39902 return { 39903 token, 39904 cancel 39905 }; 39906 }; 39907 CancelToken_1 = CancelToken; 39908 return CancelToken_1; 39909} 39910var spread; 39911var hasRequiredSpread; 39912function requireSpread() { 39913 if (hasRequiredSpread) 39914 return spread; 39915 hasRequiredSpread = 1; 39916 spread = function spread2(callback) { 39917 return function wrap(arr) { 39918 return callback.apply(null, arr); 39919 }; 39920 }; 39921 return spread; 39922} 39923var isAxiosError; 39924var hasRequiredIsAxiosError; 39925function requireIsAxiosError() { 39926 if (hasRequiredIsAxiosError) 39927 return isAxiosError; 39928 hasRequiredIsAxiosError = 1; 39929 var utils2 = utils$b; 39930 isAxiosError = function isAxiosError2(payload) { 39931 return utils2.isObject(payload) && payload.isAxiosError === true; 39932 }; 39933 return isAxiosError; 39934} 39935var utils = utils$b; 39936var bind2 = bind$2; 39937var Axios = Axios_1; 39938var mergeConfig2 = mergeConfig$2; 39939var defaults = defaults_1; 39940function createInstance(defaultConfig) { 39941 var context = new Axios(defaultConfig); 39942 var instance = bind2(Axios.prototype.request, context); 39943 utils.extend(instance, Axios.prototype, context); 39944 utils.extend(instance, context); 39945 instance.create = function create(instanceConfig) { 39946 return createInstance(mergeConfig2(defaultConfig, instanceConfig)); 39947 }; 39948 return instance; 39949} 39950var axios$2 = createInstance(defaults); 39951axios$2.Axios = Axios; 39952axios$2.CanceledError = requireCanceledError(); 39953axios$2.CancelToken = requireCancelToken(); 39954axios$2.isCancel = requireIsCancel(); 39955axios$2.VERSION = requireData().version; 39956axios$2.toFormData = toFormData_1; 39957axios$2.AxiosError = AxiosError_1; 39958axios$2.Cancel = axios$2.CanceledError; 39959axios$2.all = function all(promises) { 39960 return Promise.all(promises); 39961}; 39962axios$2.spread = requireSpread(); 39963axios$2.isAxiosError = requireIsAxiosError(); 39964axios$3.exports = axios$2; 39965axios$3.exports.default = axios$2; 39966var axiosExports = axios$3.exports; 39967var axios = axiosExports; 39968const axios$1 = /* @__PURE__ */ getDefaultExportFromCjs(axios); 39969class IAuth { 39970 constructor() { 39971 this.mode = typeof window === "undefined" ? "json" : "cookie"; 39972 } 39973} 39974var Meta; 39975(function(Meta2) { 39976 Meta2["TOTAL_COUNT"] = "total_count"; 39977 Meta2["FILTER_COUNT"] = "filter_count"; 39978})(Meta || (Meta = {}));
39979class EmptyParamError extends Error { 39980 constructor(paramName) { 39981 super(`${paramName !== null && paramName !== void 0 ? paramName : "ID"} cannot be an empty string`); 39982 } 39983} 39984class ItemsHandler { 39985 constructor(collection, transport) { 39986 this.collection = collection; 39987 this.transport = transport; 39988 this.endpoint = collection.startsWith("directus_") ? `/${collection.substring(9)}` : `/items/${collection}`; 39989 } 39990 async readOne(id, query, options) { 39991 if (`${id}` === "") 39992 throw new EmptyParamError("id"); 39993 const response = await this.transport.get(`${this.endpoint}/${encodeURI(id)}`, { 39994 params: query, 39995 ...options === null || options === void 0 ? void 0 : options.requestOptions 39996 }); 39997 return response.data; 39998 } 39999 async readMany(ids, query, options) { 40000 var _a2; 40001 const collectionFields = await this.transport.get(`/fields/${this.collection}`); 40002 const primaryKeyField = (_a2 = collectionFields.data) === null || _a2 === void 0 ? void 0 : _a2.find((field) => field.schema.is_primary_key === true); 40003 const { data: data2, meta } = await this.transport.get(`${this.endpoint}`, { 40004 params: { 40005 ...query, 40006 filter: { 40007 [primaryKeyField.field]: { _in: ids }, 40008 ...query === null || query === void 0 ? void 0 : query.filter 40009 }, 40010 sort: (query === null || query === void 0 ? void 0 : query.sort) || primaryKeyField.field 40011 }, 40012 ...options === null || options === void 0 ? void 0 : options.requestOptions 40013 }); 40014 return { 40015 data: data2, 40016 ...meta && { meta } 40017 }; 40018 } 40019 async readByQuery(query, options) { 40020 const { data: data2, meta } = await this.transport.get(`${this.endpoint}`, { 40021 params: query, 40022 ...options === null || options === void 0 ? void 0 : options.requestOptions 40023 }); 40024 return { 40025 data: data2, 40026 ...meta && { meta } 40027 }; 40028 } 40029 async createOne(item, query, options) { 40030 return (await this.transport.post(`${this.endpoint}`, item, { 40031 params: query, 40032 ...options === null || options === void 0 ? void 0 : options.requestOptions 40033 })).data; 40034 } 40035 async createMany(items, query, options) { 40036 return await this.transport.post(`${this.endpoint}`, items, { 40037 params: query, 40038 ...options === null || options === void 0 ? void 0 : options.requestOptions 40039 }); 40040 } 40041 async updateOne(id, item, query, options) { 40042 if (`${id}` === "") 40043 throw new EmptyParamError("id"); 40044 return (await this.transport.patch(`${this.endpoint}/${encodeURI(id)}`, item, { 40045 params: query, 40046 ...options === null || options === void 0 ? void 0 : options.requestOptions 40047 })).data; 40048 } 40049 async updateMany(ids, data2, query, options) { 40050 return await this.transport.patch(`${this.endpoint}`, { 40051 keys: ids, 40052 data: data2 40053 }, { 40054 params: query, 40055 ...options === null || options === void 0 ? void 0 : options.requestOptions 40056 }); 40057 } 40058 async updateBatch(items, query, options) { 40059 return await this.transport.patch(`${this.endpoint}`, items, { 40060 params: query, 40061 ...options === null || options === void 0 ? void 0 : options.requestOptions 40062 }); 40063 } 40064 async updateByQuery(updateQuery, data2, query, options) { 40065 return await this.transport.patch(`${this.endpoint}`, { 40066 query: updateQuery, 40067 data: data2 40068 }, { 40069 params: query, 40070 ...options === null || options === void 0 ? void 0 : options.requestOptions 40071 }); 40072 } 40073 async deleteOne(id, options) { 40074 if (`${id}` === "") 40075 throw new EmptyParamError("id"); 40076 await this.transport.delete(`${this.endpoint}/${encodeURI(id)}`, void 0, options === null || options === void 0 ? void 0 : options.requestOptions); 40077 } 40078 async deleteMany(ids, options) { 40079 await this.transport.delete(`${this.endpoint}`, ids, options === null || options === void 0 ? void 0 : options.requestOptions); 40080 } 40081} 40082class CommentsHandler { 40083 constructor(transport) { 40084 this.transport = transport; 40085 } 40086 async create(comment) { 40087 const response = await this.transport.post("/activity/comment", comment); 40088 return response.data; 40089 } 40090 async update(comment_activity_id, comment) { 40091 if (`${comment_activity_id}` === "") 40092 throw new EmptyParamError("comment_activity_id"); 40093 const response = await this.transport.patch(`/activity/comment/${encodeURI(comment_activity_id)}`, { 40094 comment 40095 }); 40096 return response.data; 40097 } 40098 async delete(comment_activity_id) { 40099 if (`${comment_activity_id}` === "") 40100 throw new EmptyParamError("comment_activity_id"); 40101 await this.transport.delete(`/activity/comment/${encodeURI(comment_activity_id)}`); 40102 } 40103} 40104class ActivityHandler extends ItemsHandler {
40105 constructor(transport) { 40106 super("directus_activity", transport); 40107 this._comments = new CommentsHandler(this.transport); 40108 } 40109 get comments() { 40110 return this._comments; 40111 } 40112} 40113class AssetsHandler { 40114 constructor(transport) { 40115 this.transport = transport; 40116 } 40117 async readOne(id) { 40118 if (`${id}` === "") 40119 throw new EmptyParamError("id"); 40120 const response = await this.transport.get(`/assets/${id}`, { 40121 responseType: "stream" 40122 }); 40123 return response.raw; 40124 } 40125} 40126class CollectionsHandler { 40127 constructor(transport) { 40128 this.transport = transport; 40129 } 40130 async readOne(collection) { 40131 if (`${collection}` === "") 40132 throw new EmptyParamError("collection"); 40133 const response = await this.transport.get(`/collections/${collection}`); 40134 return response.data; 40135 } 40136 async readAll() { 40137 const { data: data2, meta } = await this.transport.get(`/collections`); 40138 return { 40139 data: data2, 40140 meta 40141 }; 40142 } 40143 async createOne(collection) { 40144 return (await this.transport.post(`/collections`, collection)).data; 40145 } 40146 async createMany(collections) { 40147 const { data: data2, meta } = await this.transport.post(`/collections`, collections); 40148 return { 40149 data: data2, 40150 meta 40151 }; 40152 } 40153 async updateOne(collection, item, query) { 40154 if (`${collection}` === "") 40155 throw new EmptyParamError("collection"); 40156 return (await this.transport.patch(`/collections/${collection}`, item, { 40157 params: query 40158 })).data; 40159 } 40160 async deleteOne(collection) { 40161 if (`${collection}` === "") 40162 throw new EmptyParamError("collection"); 40163 await this.transport.delete(`/collections/${collection}`); 40164 } 40165} 40166class FieldsHandler { 40167 constructor(transport) { 40168 this.transport = transport; 40169 } 40170 async readOne(collection, id) { 40171 if (`${collection}` === "") 40172 throw new EmptyParamError("collection"); 40173 if (`${id}` === "") 40174 throw new EmptyParamError("id"); 40175 const response = await this.transport.get(`/fields/${collection}/${id}`); 40176 return response.data; 40177 } 40178 async readMany(collection) { 40179 if (`${collection}` === "") 40180 throw new EmptyParamError("collection"); 40181 const response = await this.transport.get(`/fields/${collection}`); 40182 return { 40183 data: response.data, 40184 meta: void 0 40185 }; 40186 } 40187 async readAll() { 40188 const response = await this.transport.get(`/fields`); 40189 return { 40190 data: response.data, 40191 meta: void 0 40192 }; 40193 } 40194 async createOne(collection, item) { 40195 if (`${collection}` === "") 40196 throw new EmptyParamError("collection"); 40197 return (await this.transport.post(`/fields/${collection}`, item)).data; 40198 } 40199 async updateOne(collection, field, item) { 40200 if (`${collection}` === "") 40201 throw new EmptyParamError("collection"); 40202 if (`${field}` === "") 40203 throw new EmptyParamError("field"); 40204 return (await this.transport.patch(`/fields/${collection}/${field}`, item)).data; 40205 } 40206 async deleteOne(collection, field) { 40207 if (`${collection}` === "") 40208 throw new EmptyParamError("collection"); 40209 if (`${field}` === "") 40210 throw new EmptyParamError("field"); 40211 await this.transport.delete(`/fields/${collection}/${field}`); 40212 } 40213} 40214class FilesHandler extends ItemsHandler { 40215 constructor(transport) { 40216 super("directus_files", transport); 40217 } 40218 async import(body) { 40219 const response = await this.transport.post(`/files/import`, body); 40220 return response.data; 40221 } 40222} 40223class FoldersHandler extends ItemsHandler { 40224 constructor(transport) { 40225 super("directus_folders", transport); 40226 } 40227} 40228class PermissionsHandler extends ItemsHandler { 40229 constructor(transport) { 40230 super("directus_permissions", transport); 40231 } 40232} 40233class PresetsHandler extends ItemsHandler { 40234 constructor(transport) { 40235 super("directus_presets", transport); 40236 } 40237} 40238class RelationsHandler { 40239 constructor(transport) { 40240 this.transport = transport; 40241 } 40242 async readOne(collection, id) { 40243 if (`${collection}` === "") 40244 throw new EmptyParamError("collection"); 40245 if (`${id}` === "") 40246 throw new EmptyParamError("id"); 40247 const response = await this.transport.get(`/relations/${collection}/${id}`); 40248 return response.data; 40249 } 40250 async readMany(collection) { 40251 if (`${collection}` === "") 40252 throw new EmptyParamError("collection"); 40253 const response = await this.transport.get(`/relations/${collection}`); 40254 return response.data; 40255 }
40256 async readAll() { 40257 const response = await this.transport.get(`/relations`); 40258 return response.data; 40259 } 40260 async createOne(item) { 40261 return (await this.transport.post(`/relations`, item)).data; 40262 } 40263 async updateOne(collection, field, item) { 40264 if (`${collection}` === "") 40265 throw new EmptyParamError("collection"); 40266 if (`${field}` === "") 40267 throw new EmptyParamError("field"); 40268 return (await this.transport.patch(`/relations/${collection}/${field}`, item)).data; 40269 } 40270 async deleteOne(collection, field) { 40271 if (`${collection}` === "") 40272 throw new EmptyParamError("collection"); 40273 if (`${field}` === "") 40274 throw new EmptyParamError("field"); 40275 await this.transport.delete(`/relations/${collection}/${field}`); 40276 } 40277} 40278class RevisionsHandler extends ItemsHandler { 40279 constructor(transport) { 40280 super("directus_revisions", transport); 40281 } 40282} 40283class RolesHandler extends ItemsHandler { 40284 constructor(transport) { 40285 super("directus_roles", transport); 40286 } 40287} 40288class ServerHandler { 40289 constructor(transport) { 40290 this.transport = transport; 40291 } 40292 async ping() { 40293 return (await this.transport.get("/server/ping")).raw; 40294 } 40295 async info() { 40296 return (await this.transport.get("/server/info")).data; 40297 } 40298 async oas() { 40299 return (await this.transport.get("/server/specs/oas")).raw; 40300 } 40301} 40302class SingletonHandler { 40303 constructor(collection, transport) { 40304 this.collection = collection; 40305 this.transport = transport; 40306 this.endpoint = collection.startsWith("directus_") ? `/${collection.substring(9)}` : `/items/${collection}`; 40307 } 40308 async read(query) { 40309 const item = await this.transport.get(`${this.endpoint}`, { 40310 params: query 40311 }); 40312 return item.data; 40313 } 40314 async update(data2, _query) { 40315 const item = await this.transport.patch(`${this.endpoint}`, data2, { 40316 params: _query 40317 }); 40318 return item.data; 40319 } 40320} 40321class SettingsHandler extends SingletonHandler { 40322 constructor(transport) { 40323 super("directus_settings", transport); 40324 } 40325} 40326class InvitesHandler { 40327 constructor(transport) { 40328 this.transport = transport; 40329 } 40330 async send(email2, role, invite_url) { 40331 await this.transport.post("/users/invite", { 40332 email: email2, 40333 role, 40334 invite_url 40335 }); 40336 } 40337 async accept(token, password) { 40338 await this.transport.post(`/users/invite/accept`, { 40339 token, 40340 password 40341 }); 40342 } 40343} 40344class TFAHandler { 40345 constructor(transport) { 40346 this.transport = transport; 40347 } 40348 async generate(password) { 40349 const result = await this.transport.post("/users/me/tfa/generate", { password }); 40350 return result.data; 40351 } 40352 async enable(secret, otp) { 40353 await this.transport.post("/users/me/tfa/enable", { secret, otp }); 40354 } 40355 async disable(otp) { 40356 await this.transport.post("/users/me/tfa/disable", { otp }); 40357 } 40358} 40359class MeHandler { 40360 constructor(transport) { 40361 this._transport = transport; 40362 } 40363 get tfa() { 40364 return this._tfa || (this._tfa = new TFAHandler(this._transport)); 40365 } 40366 async read(query) { 40367 const response = await this._transport.get("/users/me", { 40368 params: query 40369 }); 40370 return response.data; 40371 } 40372 async update(data2, query) { 40373 const response = await this._transport.patch(`/users/me`, data2, { 40374 params: query 40375 }); 40376 return response.data; 40377 } 40378} 40379class UsersHandler extends ItemsHandler { 40380 constructor(transport) { 40381 super("directus_users", transport); 40382 } 40383 get invites() { 40384 return this._invites || (this._invites = new InvitesHandler(this.transport)); 40385 } 40386 get me() { 40387 return this._me || (this._me = new MeHandler(this.transport)); 40388 } 40389} 40390class UtilsHandler { 40391 constructor(transport) { 40392 this.random = { 40393 string: async (length = 32) => { 40394 const result = await this.transport.get("/utils/random/string", { params: { length } }); 40395 return result.data; 40396 } 40397 }; 40398 this.hash = { 40399 generate: async (string3) => { 40400 const result = await this.transport.post("/utils/hash/generate", { string: string3 }); 40401 return result.data; 40402 }, 40403 verify: async (string3, hash) => { 40404 const result = await this.transport.post("/utils/hash/verify", { string: string3, hash }); 40405 return result.data; 40406 } 40407 }; 40408 this.transport = transport; 40409 } 40410 async sort(collection, item, to) { 40411 await this.transport.post(`/utils/sort/${encodeURI(collection)}`, { item, to }); 40412 } 40413 async revert(revision) { 40414 await this.transport.post(`/utils/revert/${encodeURI(revision)}`); 40415 } 40416} 40417class IStorage { 40418} 40419class ITransport { 40420}
40421class TransportError extends Error { 40422 constructor(parent, response) { 40423 var _a2, _b; 40424 if ((_a2 = response === null || response === void 0 ? void 0 : response.errors) === null || _a2 === void 0 ? void 0 : _a2.length) { 40425 super((_b = response === null || response === void 0 ? void 0 : response.errors[0]) === null || _b === void 0 ? void 0 : _b.message); 40426 } else { 40427 super((parent === null || parent === void 0 ? void 0 : parent.message) || "Unknown transport error"); 40428 } 40429 this.parent = parent; 40430 this.response = response; 40431 this.errors = (response === null || response === void 0 ? void 0 : response.errors) || []; 40432 if (!Object.values(response || {}).some((value) => value !== void 0)) { 40433 this.response = void 0; 40434 } 40435 Object.setPrototypeOf(this, TransportError.prototype); 40436 } 40437} 40438var Keys; 40439(function(Keys2) { 40440 Keys2["AuthToken"] = "auth_token"; 40441 Keys2["RefreshToken"] = "auth_refresh_token"; 40442 Keys2["Expires"] = "auth_expires"; 40443 Keys2["ExpiresAt"] = "auth_expires_at"; 40444})(Keys || (Keys = {})); 40445class BaseStorage extends IStorage { 40446 constructor(options) { 40447 var _a2; 40448 super(); 40449 this.prefix = (_a2 = options === null || options === void 0 ? void 0 : options.prefix) !== null && _a2 !== void 0 ? _a2 : ""; 40450 } 40451 get auth_token() { 40452 return this.get(Keys.AuthToken); 40453 } 40454 set auth_token(value) { 40455 if (value === null) { 40456 this.delete(Keys.AuthToken); 40457 } else { 40458 this.set(Keys.AuthToken, value); 40459 } 40460 } 40461 get auth_expires() { 40462 const value = this.get(Keys.Expires); 40463 if (value === null) { 40464 return null; 40465 } 40466 return parseInt(value); 40467 } 40468 set auth_expires(value) { 40469 if (value === null) { 40470 this.delete(Keys.Expires); 40471 } else { 40472 this.set(Keys.Expires, value.toString()); 40473 } 40474 } 40475 get auth_expires_at() { 40476 const value = this.get(Keys.ExpiresAt); 40477 if (value === null) { 40478 return null; 40479 } 40480 return parseInt(value); 40481 } 40482 set auth_expires_at(value) { 40483 if (value === null) { 40484 this.delete(Keys.ExpiresAt); 40485 } else { 40486 this.set(Keys.ExpiresAt, value.toString()); 40487 } 40488 } 40489 get auth_refresh_token() { 40490 return this.get(Keys.RefreshToken); 40491 } 40492 set auth_refresh_token(value) { 40493 if (value === null) { 40494 this.delete(Keys.RefreshToken); 40495 } else { 40496 this.set(Keys.RefreshToken, value); 40497 } 40498 } 40499} 40500class MemoryStorage extends BaseStorage { 40501 constructor() { 40502 super(...arguments); 40503 this.values = {}; 40504 } 40505 get(key) { 40506 const k = this.key(key); 40507 if (k in this.values) { 40508 return this.values[k]; 40509 } 40510 return null; 40511 } 40512 set(key, value) { 40513 this.values[this.key(key)] = value; 40514 return value; 40515 } 40516 delete(key) { 40517 const value = this.get(key); 40518 delete this.values[this.key(key)]; 40519 return value; 40520 } 40521 key(name) { 40522 return `${this.prefix}${name}`; 40523 } 40524} 40525class LocalStorage extends BaseStorage { 40526 get(key) { 40527 const value = localStorage.getItem(this.key(key)); 40528 if (value !== null) { 40529 return value; 40530 } 40531 return null; 40532 } 40533 set(key, value) { 40534 localStorage.setItem(this.key(key), value); 40535 return value; 40536 } 40537 delete(key) { 40538 const value = this.get(key); 40539 localStorage.removeItem(this.key(key)); 40540 return value; 40541 } 40542 key(name) { 40543 return `${this.prefix}${name}`; 40544 } 40545} 40546class Transport extends ITransport { 40547 constructor(config) { 40548 var _a2; 40549 super(); 40550 this.config = config; 40551 this.axios = axios$1.create({ 40552 baseURL: this.config.url, 40553 params: this.config.params, 40554 headers: this.config.headers, 40555 onUploadProgress: this.config.onUploadProgress, 40556 maxBodyLength: this.config.maxBodyLength, 40557 maxContentLength: this.config.maxContentLength, 40558 withCredentials: true 40559 }); 40560 if ((_a2 = this.config) === null || _a2 === void 0 ? void 0 : _a2.beforeRequest) 40561 this.beforeRequest = this.config.beforeRequest; 40562 } 40563 async beforeRequest(config) { 40564 return config; 40565 } 40566 get url() { 40567 return this.config.url; 40568 } 40569 async request(method4, path, data2, options) { 40570 var _a2, _b, _c, _d, _e; 40571 try { 40572 let config = { 40573 method: method4, 40574 url: path, 40575 data: data2, 40576 params: options === null || options === void 0 ? void 0 : options.params, 40577 headers: options === null || options === void 0 ? void 0 : options.headers, 40578 responseType: options === null || options === void 0 ? void 0 : options.responseType, 40579 onUploadProgress: options === null || options === void 0 ? void 0 : options.onUploadProgress 40580 }; 40581 config = await this.beforeRequest(config); 40582 const response = await this.axios.request(config); 40583 const content = { 40584 raw: response.data, 40585 status: response.status, 40586 statusText: response.statusText, 40587 headers: response.headers, 40588 data: response.data.data, 40589 meta: response.data.meta, 40590 errors: response.data.errors 40591 }; 40592 if (response.data.errors) { 40593 throw new TransportError(null, content); 40594 } 40595 return content; 40596 } catch (err) { 40597 if (!err || err instanceof Error === false) { 40598 throw err; 40599 } 40600 if (axios$1.isAxiosError(err)) { 40601 const data3 = (_a2 = err.response) === null || _a2 === void 0 ? void 0 : _a2.data; 40602 throw new TransportError(err, { 40603 raw: (_b = err.response) === null || _b === void 0 ? void 0 : _b.data, 40604 status: (_c = err.response) === null || _c === void 0 ? void 0 : _c.status, 40605 statusText: (_d = err.response) === null || _d === void 0 ? void 0 : _d.statusText, 40606 headers: (_e = err.response) === null || _e === void 0 ? void 0 : _e.headers, 40607 data: data3 === null || data3 === void 0 ? void 0 : data3.data, 40608 meta: data3 === null || data3 === void 0 ? void 0 : data3.meta, 40609 errors: data3 === null || data3 === void 0 ? void 0 : data3.errors 40610 }); 40611 } 40612 throw new TransportError(err); 40613 } 40614 } 40615 async get(path, options) { 40616 return await this.request("get", path, void 0, options); 40617 } 40618 async head(path, options) { 40619 return await this.request("head", path, void 0, options); 40620 } 40621 async options(path, options) { 40622 return await this.request("options", path, void 0, options); 40623 } 40624 async delete(path, data2, options) { 40625 return await this.request("delete", path, data2, options); 40626 } 40627 async put(path, data2, options) { 40628 return await this.request("put", path, data2, options); 40629 } 40630 async post(path, data2, options) { 40631 return await this.request("post", path, data2, options); 40632 } 40633 async patch(path, data2, options) { 40634 return await this.request("patch", path, data2, options); 40635 } 40636} 40637class PasswordsHandler {
40638 constructor(transport) { 40639 this.transport = transport; 40640 } 40641 async request(email2, reset_url) { 40642 await this.transport.post("/auth/password/request", { email: email2, reset_url }); 40643 } 40644 async reset(token, password) { 40645 await this.transport.post("/auth/password/reset", { token, password }); 40646 } 40647} 40648class Auth extends IAuth { 40649 constructor(options) { 40650 var _a2, _b, _c; 40651 super(); 40652 this.autoRefresh = true; 40653 this.msRefreshBeforeExpires = 3e4; 40654 this.staticToken = ""; 40655 this._transport = options.transport; 40656 this._storage = options.storage; 40657 this.autoRefresh = (_a2 = options === null || options === void 0 ? void 0 : options.autoRefresh) !== null && _a2 !== void 0 ? _a2 : this.autoRefresh; 40658 this.mode = (_b = options === null || options === void 0 ? void 0 : options.mode) !== null && _b !== void 0 ? _b : this.mode; 40659 this.msRefreshBeforeExpires = (_c = options === null || options === void 0 ? void 0 : options.msRefreshBeforeExpires) !== null && _c !== void 0 ? _c : this.msRefreshBeforeExpires; 40660 if (options === null || options === void 0 ? void 0 : options.staticToken) { 40661 this.staticToken = options === null || options === void 0 ? void 0 : options.staticToken; 40662 this.updateStorage({ 40663 access_token: this.staticToken, 40664 expires: null, 40665 refresh_token: null 40666 }); 40667 } 40668 } 40669 get storage() { 40670 return this._storage; 40671 } 40672 get transport() { 40673 return this._transport; 40674 } 40675 get token() { 40676 return (async () => { 40677 if (this._refreshPromise) { 40678 try { 40679 await this._refreshPromise; 40680 } finally { 40681 this._refreshPromise = void 0; 40682 } 40683 } 40684 return this._storage.auth_token; 40685 })(); 40686 } 40687 get password() { 40688 return this.passwords = this.passwords || new PasswordsHandler(this._transport); 40689 } 40690 resetStorage() { 40691 this._storage.auth_token = null; 40692 this._storage.auth_refresh_token = null; 40693 this._storage.auth_expires = null; 40694 this._storage.auth_expires_at = null; 40695 } 40696 updateStorage(result) { 40697 var _a2, _b; 40698 const expires = (_a2 = result.expires) !== null && _a2 !== void 0 ? _a2 : null; 40699 this._storage.auth_token = result.access_token; 40700 this._storage.auth_refresh_token = (_b = result.refresh_token) !== null && _b !== void 0 ? _b : null; 40701 this._storage.auth_expires = expires; 40702 this._storage.auth_expires_at = (/* @__PURE__ */ new Date()).getTime() + (expires !== null && expires !== void 0 ? expires : 0); 40703 } 40704 async refreshIfExpired() { 40705 if (this.staticToken) 40706 return; 40707 if (!this.autoRefresh) 40708 return; 40709 if (!this._storage.auth_expires_at) { 40710 try { 40711 await this._refreshPromise; 40712 } finally { 40713 this._refreshPromise = void 0; 40714 } 40715 return; 40716 } 40717 if (this._storage.auth_expires_at < (/* @__PURE__ */ new Date()).getTime() + this.msRefreshBeforeExpires) { 40718 this.refresh(); 40719 } 40720 try { 40721 await this._refreshPromise; 40722 } finally { 40723 this._refreshPromise = void 0; 40724 } 40725 } 40726 refresh() { 40727 const refreshPromise = async () => { 40728 var _a2; 40729 const refresh_token = this._storage.auth_refresh_token; 40730 this.resetStorage(); 40731 const response = await this._transport.post("/auth/refresh", { 40732 refresh_token: this.mode === "json" ? refresh_token : void 0 40733 }); 40734 this.updateStorage(response.data); 40735 return { 40736 access_token: response.data.access_token, 40737 ...((_a2 = response.data) === null || _a2 === void 0 ? void 0 : _a2.refresh_token) && { refresh_token: response.data.refresh_token }, 40738 expires: response.data.expires 40739 }; 40740 }; 40741 return this._refreshPromise = refreshPromise(); 40742 } 40743 async login(credentials) { 40744 var _a2; 40745 this.resetStorage(); 40746 const response = await this._transport.post("/auth/login", { mode: this.mode, ...credentials }, { headers: { Authorization: null } }); 40747 this.updateStorage(response.data); 40748 return { 40749 access_token: response.data.access_token, 40750 ...((_a2 = response.data) === null || _a2 === void 0 ? void 0 : _a2.refresh_token) && { 40751 refresh_token: response.data.refresh_token 40752 }, 40753 expires: response.data.expires 40754 }; 40755 } 40756 async static(token) { 40757 if (!this.staticToken) 40758 this.staticToken = token; 40759 await this._transport.get("/users/me", { 40760 params: { access_token: token }, 40761 headers: { Authorization: null } 40762 }); 40763 this.updateStorage({ 40764 access_token: token, 40765 expires: null, 40766 refresh_token: null 40767 }); 40768 return true; 40769 } 40770 async logout() { 40771 let refresh_token; 40772 if (this.mode === "json") { 40773 refresh_token = this._storage.auth_refresh_token || void 0; 40774 } 40775 await this._transport.post("/auth/logout", { refresh_token }); 40776 this.updateStorage({ 40777 access_token: null, 40778 expires: null, 40779 refresh_token: null 40780 }); 40781 } 40782} 40783class GraphQLHandler {
40784 constructor(transport) { 40785 this.transport = transport; 40786 } 40787 async request(base2, query, variables) { 40788 return await this.transport.post(base2, { 40789 query, 40790 variables: typeof variables === "undefined" ? {} : variables 40791 }); 40792 } 40793 // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types 40794 async items(query, variables) { 40795 return await this.request("/graphql", query, variables); 40796 } 40797 // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types 40798 async system(query, variables) { 40799 return await this.request("/graphql/system", query, variables); 40800 } 40801} 40802class Directus { 40803 constructor(url2, options) { 40804 var _a2, _b, _c, _d, _e, _f, _g, _h, _j; 40805 this._url = url2; 40806 this._options = options; 40807 this._items = {}; 40808 this._singletons = {}; 40809 if (((_a2 = this._options) === null || _a2 === void 0 ? void 0 : _a2.storage) && ((_b = this._options) === null || _b === void 0 ? void 0 : _b.storage) instanceof IStorage) 40810 this._storage = this._options.storage; 40811 else { 40812 const directusStorageOptions = (_c = this._options) === null || _c === void 0 ? void 0 : _c.storage; 40813 const { mode, ...storageOptions } = directusStorageOptions !== null && directusStorageOptions !== void 0 ? directusStorageOptions : {}; 40814 if (mode === "MemoryStorage" || typeof window === "undefined") { 40815 this._storage = new MemoryStorage(storageOptions); 40816 } else { 40817 this._storage = new LocalStorage(storageOptions); 40818 } 40819 } 40820 if (((_d = this._options) === null || _d === void 0 ? void 0 : _d.transport) && ((_e = this._options) === null || _e === void 0 ? void 0 : _e.transport) instanceof ITransport) 40821 this._transport = this._options.transport; 40822 else { 40823 this._transport = new Transport({ 40824 url: this.url, 40825 ...(_f = this._options) === null || _f === void 0 ? void 0 : _f.transport, 40826 beforeRequest: async (config) => { 40827 var _a3, _b2, _c2, _d2, _e2, _f2; 40828 if (this._url.indexOf("/auth/refresh") === -1 && ((_a3 = config.method) === null || _a3 === void 0 ? void 0 : _a3.toLowerCase()) !== "post") { 40829 await this._auth.refreshIfExpired(); 40830 } 40831 const token = this.storage.auth_token; 40832 const bearer = token ? token.startsWith(`Bearer `) ? String(this.storage.auth_token) : `Bearer ${this.storage.auth_token}` : ""; 40833 const authenticatedConfig = { 40834 ...config, 40835 headers: { 40836 Authorization: bearer, 40837 ...config.headers 40838 } 40839 }; 40840 if (!(((_b2 = this._options) === null || _b2 === void 0 ? void 0 : _b2.transport) instanceof ITransport) && ((_d2 = (_c2 = this._options) === null || _c2 === void 0 ? void 0 : _c2.transport) === null || _d2 === void 0 ? void 0 : _d2.beforeRequest)) { 40841 return (_f2 = (_e2 = this._options) === null || _e2 === void 0 ? void 0 : _e2.transport) === null || _f2 === void 0 ? void 0 : _f2.beforeRequest(authenticatedConfig); 40842 } 40843 return authenticatedConfig; 40844 } 40845 }); 40846 } 40847 if (((_g = this._options) === null || _g === void 0 ? void 0 : _g.auth) && ((_h = this._options) === null || _h === void 0 ? void 0 : _h.auth) instanceof IAuth) 40848 this._auth = this._options.auth; 40849 else 40850 this._auth = new Auth({ 40851 transport: this._transport, 40852 storage: this._storage, 40853 ...(_j = this._options) === null || _j === void 0 ? void 0 : _j.auth 40854 }); 40855 } 40856 get url() { 40857 return this._url; 40858 } 40859 get auth() { 40860 return this._auth; 40861 } 40862 get storage() { 40863 return this._storage; 40864 } 40865 get transport() { 40866 return this._transport; 40867 } 40868 get assets() { 40869 return this._assets || (this._assets = new AssetsHandler(this.transport)); 40870 } 40871 get activity() { 40872 return this._activity || (this._activity = new ActivityHandler(this.transport)); 40873 } 40874 get collections() { 40875 return this._collections || (this._collections = new CollectionsHandler(this.transport)); 40876 } 40877 get fields() { 40878 return this._fields || (this._fields = new FieldsHandler(this.transport)); 40879 } 40880 get files() { 40881 return this._files || (this._files = new FilesHandler(this.transport)); 40882 } 40883 get folders() { 40884 return this._folders || (this._folders = new FoldersHandler(this.transport)); 40885 } 40886 get permissions() { 40887 return this._permissions || (this._permissions = new PermissionsHandler(this.transport)); 40888 } 40889 get presets() { 40890 return this._presets || (this._presets = new PresetsHandler(this.transport)); 40891 } 40892 get relations() { 40893 return this._relations || (this._relations = new RelationsHandler(this.transport)); 40894 } 40895 get revisions() { 40896 return this._revisions || (this._revisions = new RevisionsHandler(this.transport)); 40897 } 40898 get roles() { 40899 return this._roles || (this._roles = new RolesHandler(this.transport)); 40900 } 40901 get users() { 40902 return this._users || (this._users = new UsersHandler(this.transport)); 40903 } 40904 get settings() { 40905 return this._settings || (this._settings = new SettingsHandler(this.transport)); 40906 } 40907 get server() { 40908 return this._server || (this._server = new ServerHandler(this.transport)); 40909 } 40910 get utils() { 40911 return this._utils || (this._utils = new UtilsHandler(this.transport)); 40912 } 40913 get graphql() { 40914 return this._graphql || (this._graphql = new GraphQLHandler(this.transport)); 40915 } 40916 singleton(collection) { 40917 return this._singletons[collection] || (this._singletons[collection] = new SingletonHandler(collection, this.transport)); 40918 } 40919 items(collection) { 40920 return this._items[collection] || (this._items[collection] = new ItemsHandler(collection, this.transport)); 40921 } 40922} 40923const version = "3.7.5"; 40924const VERSION = version; 40925const _hasatob = typeof atob === "function"; 40926const _hasbtoa = typeof btoa === "function"; 40927const _hasBuffer = typeof Buffer === "function"; 40928const _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0; 40929const _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0; 40930const b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
40930+/="; 40931const b64chs = Array.prototype.slice.call(b64ch); 40932const b64tab = ((a) => { 40933 let tab = {}; 40934 a.forEach((c2, i) => tab[c2] = i); 40935 return tab; 40936})(b64chs); 40937const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/; 40938const _fromCC = String.fromCharCode.bind(String); 40939const _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it) => new Uint8Array(Array.prototype.slice.call(it, 0)); 40940const _mkUriSafe = (src) => src.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_"); 40941const _tidyB64 = (s2) => s2.replace(/[^A-Za-z0-9\+\/]/g, ""); 40942const btoaPolyfill = (bin) => { 40943 let u32, c0, c1, c2, asc = ""; 40944 const pad = bin.length % 3; 40945 for (let i = 0; i < bin.length; ) { 40946 if ((c0 = bin.charCodeAt(i++)) > 255 || (c1 = bin.charCodeAt(i++)) > 255 || (c2 = bin.charCodeAt(i++)) > 255) 40947 throw new TypeError("invalid character found"); 40948 u32 = c0 << 16 | c1 << 8 | c2; 40949 asc += b64chs[u32 >> 18 & 63] + b64chs[u32 >> 12 & 63] + b64chs[u32 >> 6 & 63] + b64chs[u32 & 63]; 40950 } 40951 return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc; 40952}; 40953const _btoa = _hasbtoa ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill; 40954const _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => { 40955 const maxargs = 4096; 40956 let strs = []; 40957 for (let i = 0, l2 = u8a.length; i < l2; i += maxargs) { 40958 strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs))); 40959 } 40960 return _btoa(strs.join("")); 40961}; 40962const fromUint8Array = (u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a); 40963const cb_utob = (c2) => { 40964 if (c2.length < 2) { 40965 var cc = c2.charCodeAt(0); 40966 return cc < 128 ? c2 : cc < 2048 ? _fromCC(192 | cc >>> 6) + _fromCC(128 | cc & 63) : _fromCC(224 | cc >>> 12 & 15) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63); 40967 } else { 40968 var cc = 65536 + (c2.charCodeAt(0) - 55296) * 1024 + (c2.charCodeAt(1) - 56320); 40969 return _fromCC(240 | cc >>> 18 & 7) + _fromCC(128 | cc >>> 12 & 63) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63); 40970 } 40971}; 40972const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g; 40973const utob = (u) => u.replace(re_utob, cb_utob); 40974const _encode = _hasBuffer ? (s2) => Buffer.from(s2, "utf8").toString("base64") : _TE ? (s2) => _fromUint8Array(_TE.encode(s2)) : (s2) => _btoa(utob(s2)); 40975const encode = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src); 40976const encodeURI$1 = (src) => encode(src, true); 40977const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g; 40978const cb_btou = (cccc) => { 40979 switch (cccc.length) { 40980 case 4: 40981 var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset2 = cp - 65536; 40982 return _fromCC((offset2 >>> 10) + 55296) + _fromCC((offset2 & 1023) + 56320); 40983 case 3: 40984 return _fromCC((15 & cccc.charCodeAt(0)) << 12 | (63 & cccc.charCodeAt(1)) << 6 | 63 & cccc.charCodeAt(2)); 40985 default: 40986 return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1)); 40987 } 40988}; 40989const btou = (b) => b.replace(re_btou, cb_btou); 40990const atobPolyfill = (asc) => { 40991 asc = asc.replace(/\s+/g, ""); 40992 if (!b64re.test(asc)) 40993 throw new TypeError("malformed base64."); 40994 asc += "==".slice(2 - (asc.length & 3)); 40995 let u24, bin = "", r1, r2; 40996 for (let i = 0; i < asc.length; ) { 40997 u24 = b64tab[asc.charAt(i++)] << 18 | b64tab[asc.charAt(i++)] << 12 | (r1 = b64tab[asc.charAt(i++)]) << 6 | (r2 = b64tab[asc.charAt(i++)]); 40998 bin += r1 === 64 ? _fromCC(u24 >> 16 & 255) : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255) : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255); 40999 } 41000 return bin; 41001}; 41002const _atob = _hasatob ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill; 41003const _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a).split("").map((c2) => c2.charCodeAt(0))); 41004const toUint8Array = (a) => _toUint8Array(_unURI(a)); 41005const _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a)); 41006const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/")); 41007const decode = (src) => _decode(_unURI(src)); 41008const isValid = (src) => { 41009 if (typeof src !== "string") 41010 return false;
41011 const s2 = src.replace(/\s+/g, "").replace(/={0,2}$/, ""); 41012 return !/[^\s0-9a-zA-Z\+/]/.test(s2) || !/[^\s0-9a-zA-Z\-_]/.test(s2); 41013}; 41014const _noEnum = (v) => { 41015 return { 41016 value: v, 41017 enumerable: false, 41018 writable: true, 41019 configurable: true 41020 }; 41021}; 41022const extendString = function() { 41023 const _add = (name, body) => Object.defineProperty(String.prototype, name, _noEnum(body)); 41024 _add("fromBase64", function() { 41025 return decode(this); 41026 }); 41027 _add("toBase64", function(urlsafe) { 41028 return encode(this, urlsafe); 41029 }); 41030 _add("toBase64URI", function() { 41031 return encode(this, true); 41032 }); 41033 _add("toBase64URL", function() { 41034 return encode(this, true); 41035 }); 41036 _add("toUint8Array", function() { 41037 return toUint8Array(this); 41038 }); 41039}; 41040const extendUint8Array = function() { 41041 const _add = (name, body) => Object.defineProperty(Uint8Array.prototype, name, _noEnum(body)); 41042 _add("toBase64", function(urlsafe) { 41043 return fromUint8Array(this, urlsafe); 41044 }); 41045 _add("toBase64URI", function() { 41046 return fromUint8Array(this, true); 41047 }); 41048 _add("toBase64URL", function() { 41049 return fromUint8Array(this, true); 41050 }); 41051}; 41052const extendBuiltins = () => { 41053 extendString(); 41054 extendUint8Array(); 41055}; 41056const gBase64 = { 41057 version, 41058 VERSION, 41059 atob: _atob, 41060 atobPolyfill, 41061 btoa: _btoa, 41062 btoaPolyfill, 41063 fromBase64: decode, 41064 toBase64: encode, 41065 encode, 41066 encodeURI: encodeURI$1, 41067 encodeURL: encodeURI$1, 41068 utob, 41069 btou, 41070 decode, 41071 isValid, 41072 fromUint8Array, 41073 toUint8Array, 41074 extendString, 41075 extendUint8Array, 41076 extendBuiltins 41077}; 41078export { 41079 cNotM as $, 41080 ref as A, 41081 inject as B, 41082 computed as C, 41083 useTheme as D, 41084 tagInjectionKey as E, 41085 createKey as F, 41086 useThemeClass as G, 41087 color2Class as H, 41088 onMounted as I, 41089 watchEffect as J, 41090 observeIntersection as K, 41091 resolveSlot as L, 41092 resolveWrappedSlot as M, 41093 isImageSupportNativeLazy as N, 41094 createTheme as O, 41095 scrollbarLight$1 as P, 41096 buttonLight$1 as Q, 41097 inputLight$1 as R, 41098 changeColor as S, 41099 getDefaultExportFromCjs as T, 41100 throwError as U, 41101 VResizeObserver as V, 41102 FocusDetector as W, 41103 NButton as X, 41104 NScrollbar as Y, 41105 cM as Z, 41106 fadeInScaleUpTransition as _, 41107 buildLocalizeFn$1 as a, 41108 NEllipsis as a$, 41109 useLocale as a0, 41110 useFormItem as a1, 41111 toRef as a2, 41112 useMergedState as a3, 41113 nextTick as a4, 41114 provide as a5, 41115 isMounted as a6, 41116 useAdjustedTo as a7, 41117 VBinder as a8, 41118 VTarget as a9, 41119 iconSwitchTransition as aA, 41120 flatten$2 as aB, 41121 getSlot$1 as aC, 41122 NIconSwitchTransition as aD, 41123 FinishedIcon as aE, 41124 ErrorIcon$1 as aF, 41125 useCompitable as aG, 41126 toRefs as aH, 41127 openBlock as aI, 41128 createElementBlock as aJ, 41129 unref as aK, 41130 Fragment as aL, 41131 createTextVNode as aM, 41132 toDisplayString as aN, 41133 DateTime as aO, 41134 renderList as aP, 41135 normalizeClass as aQ, 41136 createCommentVNode as aR, 41137 createBaseVNode as aS, 41138 createBlock as aT, 41139 withCtx as aU, 41140 createVNode as aV, 41141 NIcon as aW, 41142 ICarbonChevronRight as aX, 41143 NCollapse as aY, 41144 NCollapseItem as aZ, 41145 NModal as a_, 41146 NInput as aa, 41147 NBaseIcon as ab, 41148 VFollower as ac, 41149 Transition as ad, 41150 withDirectives as ae, 41151 clickoutside$1 as af, 41152 call as ag, 41153 markEventEffectPerformed as ah, 41154 happensIn as ai, 41155 getPreciseEventTarget as aj, 41156 XButton as ak, 41157 VVirtualList as al, 41158 renderSlot as am, 41159 warn$2 as an, 41160 formLight$1 as ao, 41161 formInjectionKey as ap, 41162 formItemInstsInjectionKey as aq, 41163 keysOf as ar, 41164 useMemo as as, 41165 useRtl as at, 41166 rgba as au, 41167 AddIcon as av, 41168 InfoIcon as aw, 41169 SuccessIcon as ax, 41170 WarningIcon as ay, 41171 ErrorIcon as az, 41172 buildFormatLongFn$1 as b, 41173 defineOptions as b$, 41174 formatTimeAgo as b0, 41175 NCard as b1, 41176 createApp as b2, 41177 NConfigProvider as b3, 41178 _export_sfc as b4, 41179 withAsyncContext as b5, 41180 NCheckbox as b6, 41181 NSelect as b7, 41182 NFormItem as b8, 41183 getCurrentInstance as b9, 41184 EffectScope as bA, 41185 KeepAlive as bB, 41186 ReactiveEffect as bC, 41187 Static as bD, 41188 Teleport as bE, 41189 Text as bF, 41190 TransitionGroup as bG, 41191 VueElement as bH, 41192 assertNumber as bI, 41193 callWithAsyncErrorHandling as bJ, 41194 callWithErrorHandling as bK, 41195 camelize as bL, 41196 capitalize as bM, 41197 cloneVNode as bN, 41198 compatUtils as bO, 41199 createHydrationRenderer as bP, 41200 createPropsRestProxy as bQ, 41201 createRenderer as bR, 41202 createSSRApp as bS, 41203 createSlots as bT, 41204 createStaticVNode as bU, 41205 customRef as bV, 41206 defineAsyncComponent as bW, 41207 defineCustomElement as bX, 41208 defineEmits as bY, 41209 defineExpose as bZ, 41210 defineModel as b_, 41211 isRef as ba, 41212 isReactive as bb, 41213 isReadonly as bc, 41214 cloneDeep as bd, 41215 watchDebounced as be, 41216 ICarbonCheckmark as bf, 41217 NTooltip as bg, 41218 pushScopeId as bh, 41219 popScopeId as bi,
41220 NSkeleton as bj, 41221 Suspense as bk, 41222 itIT$2 as bl, 41223 dateItIT$1 as bm, 41224 merge$3 as bn, 41225 ICarbonClose as bo, 41226 NPopover as bp, 41227 resolveComponent as bq, 41228 resolveDirective as br, 41229 withModifiers as bs, 41230 useClipboard as bt, 41231 NDivider as bu, 41232 Directus as bv, 41233 gBase64 as bw, 41234 BaseTransition as bx, 41235 BaseTransitionPropsValidators as by, 41236 Comment as bz, 41237 buildMatchPatternFn$1 as c, 41238 useTransitionState as c$, 41239 defineProps as c0, 41240 defineSSRCustomElement as c1, 41241 defineSlots as c2, 41242 devtools as c3, 41243 effect as c4, 41244 effectScope as c5, 41245 getCurrentScope as c6, 41246 getTransitionRawChildren as c7, 41247 guardReactiveProps as c8, 41248 handleError as c9, 41249 queuePostFlushCb as cA, 41250 registerRuntimeCompiler as cB, 41251 render$5 as cC, 41252 resolveDynamicComponent as cD, 41253 resolveFilter as cE, 41254 resolveTransitionHooks as cF, 41255 setBlockTracking as cG, 41256 setDevtoolsHook as cH, 41257 setTransitionHooks as cI, 41258 shallowReactive as cJ, 41259 shallowReadonly as cK, 41260 shallowRef as cL, 41261 ssrContextKey$1 as cM, 41262 ssrUtils as cN, 41263 stop as cO, 41264 toHandlerKey as cP, 41265 toHandlers as cQ, 41266 toRaw as cR, 41267 toValue as cS, 41268 transformVNodeArgs as cT, 41269 triggerRef as cU, 41270 useAttrs as cV, 41271 useCssModule as cW, 41272 useCssVars as cX, 41273 useModel as cY, 41274 useSSRContext as cZ, 41275 useSlots as c_, 41276 hasInjectionContext as ca, 41277 hydrate as cb, 41278 initCustomFormatter as cc, 41279 initDirectivesForSSR as cd, 41280 isMemoSame as ce, 41281 isProxy as cf, 41282 isRuntimeOnly as cg, 41283 isShallow as ch, 41284 isVNode as ci, 41285 markRaw as cj, 41286 mergeDefaults as ck, 41287 mergeModels as cl, 41288 mergeProps as cm, 41289 normalizeProps as cn, 41290 normalizeStyle as co, 41291 onActivated as cp, 41292 onBeforeUpdate as cq, 41293 onDeactivated as cr, 41294 onErrorCaptured as cs, 41295 onRenderTracked as ct, 41296 onRenderTriggered as cu, 41297 onScopeDispose as cv, 41298 onServerPrefetch as cw, 41299 onUnmounted as cx, 41300 onUpdated as cy, 41301 proxyRefs as cz, 41302 buildMatchFn$1 as d, 41303 isClient as d$, 41304 vModelCheckbox as d0, 41305 vModelDynamic as d1, 41306 vModelRadio as d2, 41307 vModelSelect as d3, 41308 vModelText as d4, 41309 vShow as d5, 41310 version$1 as d6, 41311 warn$4 as d7, 41312 watchPostEffect as d8, 41313 watchSyncEffect as d9, 41314 zindexable$1 as dA, 41315 beforeNextFrameOnce as dB, 41316 createId as dC, 41317 keep as dD, 41318 popoverBaseProps as dE, 41319 formatLength as dF, 41320 pxfy as dG, 41321 NBaseLoading as dH, 41322 depx as dI, 41323 isSlotEmpty as dJ, 41324 render$4 as dK, 41325 NBaseClose as dL, 41326 onFontsReady as dM, 41327 getMargin as dN, 41328 isBrowser$2 as dO, 41329 NFadeInExpandTransition as dP, 41330 EyeIcon as dQ, 41331 fadeInHeightExpandTransition as dR, 41332 commonjsGlobal as dS, 41333 useActiveElement as dT, 41334 useMagicKeys as dU, 41335 directiveHooks as dV, 41336 noop as dW, 41337 tryOnScopeDispose as dX, 41338 resolveUnref as dY, 41339 tryOnMounted as dZ, 41340 resolveRef as d_, 41341 withDefaults as da, 41342 withKeys as db, 41343 withMemo as dc, 41344 withScopeId as dd, 41345 murmur2$1 as de, 41346 isObjectLike$1 as df, 41347 baseGetTag$1 as dg, 41348 Symbol$4 as dh, 41349 isArray$4 as di, 41350 configProviderInjectionKey$1 as dj, 41351 merge$5 as dk, 41352 throwError$1 as dl, 41353 createInjectionKey$1 as dm, 41354 useConfig$1 as dn, 41355 useSsrAdapter as dp, 41356 cssrAnchorMetaName$1 as dq, 41357 c as dr, 41358 isSymbol as ds, 41359 isObject$1 as dt, 41360 toString$1 as du, 41361 root$1 as dv, 41362 popoverLight$1 as dw, 41363 tooltipLight$1 as dx, 41364 fadeInTransition as dy, 41365 LazyTeleport as dz, 41366 onBeforeUnmount as e, 41367 isIOS as e0, 41368 isString$1 as e1, 41369 NTag as e2, 41370 off as f, 41371 readonly as g, 41372 hasInstance as h, 41373 on as i, 41374 defaultLocale$1 as j, 41375 defineComponent as k, 41376 h as l, 41377 replaceable as m, 41378 cB as n, 41379 onBeforeMount as o, 41380 c$1 as p, 41381 cE as q, 41382 reactive as r, 41383 useStyle as s, 41384 commonLight as t, 41385 useConfig as u, 41386 composite as v, 41387 watch as w, 41388 createInjectionKey as x, 41389 insideModal as y, 41390 insidePopover as z 41391}; 41392//# sourceMappingURL=base64-db31b48c.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.