From e87b64884e4c2097126ebc2068142069d3349d8c Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Fri, 25 Feb 2022 17:19:12 +0800 Subject: [PATCH 001/268] chore: remove comment --- src/libs/global_env.ts | 2 -- src/source/patch.ts | 24 ------------------------ 2 files changed, 26 deletions(-) diff --git a/src/libs/global_env.ts b/src/libs/global_env.ts index d6d70ee65..2f2a35509 100644 --- a/src/libs/global_env.ts +++ b/src/libs/global_env.ts @@ -54,7 +54,6 @@ export function initGlobalEnv (): void { const rawAppend = Element.prototype.append const rawPrepend = Element.prototype.prepend const rawCloneNode = Element.prototype.cloneNode - // const rawGetBoundingClientRect = Element.prototype.getBoundingClientRect const rawCreateElement = Document.prototype.createElement const rawCreateElementNS = Document.prototype.createElementNS @@ -105,7 +104,6 @@ export function initGlobalEnv (): void { rawAppend, rawPrepend, rawCloneNode, - // rawGetBoundingClientRect, rawCreateElement, rawCreateElementNS, rawCreateDocumentFragment, diff --git a/src/source/patch.ts b/src/source/patch.ts index 4a6f4adee..88a10d25a 100644 --- a/src/source/patch.ts +++ b/src/source/patch.ts @@ -259,29 +259,6 @@ export function patchElementPrototypeMethods (): void { this.__MICRO_APP_NAME__ && (clonedNode.__MICRO_APP_NAME__ = this.__MICRO_APP_NAME__) return clonedNode } - - // patch getBoundingClientRect - // TODO: scenes test - // Element.prototype.getBoundingClientRect = function getBoundingClientRect () { - // const rawRect: DOMRect = globalEnv.rawGetBoundingClientRect.call(this) - // if (this.__MICRO_APP_NAME__) { - // const app = appInstanceMap.get(this.__MICRO_APP_NAME__) - // if (!app?.container) { - // return rawRect - // } - // const appBody = app.container.querySelector('micro-app-body') - // const appBodyRect: DOMRect = globalEnv.rawGetBoundingClientRect.call(appBody) - // const computedRect: DOMRect = new DOMRect( - // rawRect.x - appBodyRect.x, - // rawRect.y - appBodyRect.y, - // rawRect.width, - // rawRect.height, - // ) - // return computedRect - // } - - // return rawRect - // } } /** @@ -475,7 +452,6 @@ export function releasePatches (): void { Element.prototype.append = globalEnv.rawAppend Element.prototype.prepend = globalEnv.rawPrepend Element.prototype.cloneNode = globalEnv.rawCloneNode - // Element.prototype.getBoundingClientRect = globalEnv.rawGetBoundingClientRect } // Set the style of micro-app-head and micro-app-body From 269bd2dd4e585a8d2c289695ec9659ce8c4a7ae8 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Mon, 28 Feb 2022 20:18:24 +0800 Subject: [PATCH 002/268] feat: add router.ts --- dev/children/react16/src/index.js | 6 +- dev/children/react16/src/router.js | 1 + dev/main-react16/src/pages/react16/react16.js | 8 +-- docs/zh-cn/configure.md | 4 +- docs/zh-cn/static-source.md | 2 + src/constants.ts | 2 +- src/interact/lifecycles_event.ts | 4 +- src/libs/global_env.ts | 4 +- src/libs/utils.ts | 16 +++++ src/sandbox/effect.ts | 20 +----- src/sandbox/index.ts | 40 +++++++++--- src/sandbox/router.ts | 61 +++++++++++++++++++ src/{source => sandbox}/scoped_css.ts | 0 src/source/index.ts | 2 +- src/source/links.ts | 2 +- src/source/patch.ts | 2 +- typings/global.d.ts | 8 +++ 17 files changed, 142 insertions(+), 40 deletions(-) create mode 100644 src/sandbox/router.ts rename src/{source => sandbox}/scoped_css.ts (100%) diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index 716bec293..38d02f3b2 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -107,15 +107,17 @@ window.addEventListener('unmount', function () { // console.log(`子应用${window.__MICRO_APP_NAME__}的setInterval`) // }, 1000) +// ---------------------- 创建元素 --------------------- // // const dynamicScript1 = document.createElement('script') // // dynamicScript1.setAttribute('type', 'module') // // dynamicScript1.textContent = 'console.warn('inline module')' -// dynamicScript1.setAttribute('src', 'http://127.0.0.1:8080/test.js') +// dynamicScript1.setAttribute('src', '//127.0.0.1:8080/test.js') // dynamicScript1.onload = () => { // console.log('动态module加载完成了') // } -// document.body.appendChild(dynamicScript1) +// document.head.appendChild(dynamicScript1) +// ---------------------- 全局变量 --------------------- // // console.log('__micro_app_environment__', window.__micro_app_environment__) // console.log('__micro_app_name__', window.__micro_app_name__) // console.log('__full_public_path__', window.__full_public_path__) diff --git a/dev/children/react16/src/router.js b/dev/children/react16/src/router.js index f619d053b..97e0fb0a6 100644 --- a/dev/children/react16/src/router.js +++ b/dev/children/react16/src/router.js @@ -17,6 +17,7 @@ function getDefaultKey () { return 'home' } + function App () { return ( diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index 6fc360218..e197a9fe0 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -187,10 +187,10 @@ export default class App extends React.Component { onAftershow={this.handleAftershow} onAfterhidden={this.handleAfterhidden} onDataChange={this.handleDataChange} - baseRoute='/micro-app/demo/react16' - keep-alive + // baseRoute='/micro-app/demo/react16' + // keep-alive // destroy - // inline + inline // disableSandbox // disable-sandbox // disableScopecss @@ -214,7 +214,7 @@ export default class App extends React.Component { diff --git a/docs/zh-cn/configure.md b/docs/zh-cn/configure.md index c4f2c9c33..f1a2d9a7d 100644 --- a/docs/zh-cn/configure.md +++ b/docs/zh-cn/configure.md @@ -36,12 +36,12 @@ - Default: `false` - 使用方式: `` -默认情况下,子应用的js会被提取并在后台运行。 +默认情况下,子应用的js会被提取并在后台运行,这会导致调试困难。 开启inline后,被提取的js会作为script标签插入应用中运行,在开发环境中更方便调试。 > [!NOTE] -> 开启inline后会稍微损耗性能,一般在开发环境中使用。 +> 开启inline后会稍微损耗性能,建议在开发环境中使用。 ## destroy - Desc: `卸载时是否强制删除缓存资源` diff --git a/docs/zh-cn/static-source.md b/docs/zh-cn/static-source.md index ff5e4c0f7..10288e495 100644 --- a/docs/zh-cn/static-source.md +++ b/docs/zh-cn/static-source.md @@ -28,6 +28,8 @@ 这是由webpack提供的功能,会在运行时动态设置webpack.publicPath,详细配置参考webpack文档 [publicPath](https://webpack.docschina.org/guides/public-path/#on-the-fly) +*如果你已经设置了publicPath为带域名的绝对地址(如:https://xxx),则忽略此章节* + #### 设置方式 **步骤1:** 在子应用src目录下创建名称为`public-path.js`的文件,并添加如下内容 diff --git a/src/constants.ts b/src/constants.ts index 2eb4ee36d..d748c24e2 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -33,4 +33,4 @@ export enum keepAliveStates { KEEP_ALIVE_HIDDEN = 'KEEP_ALIVE_HIDDEN', } -export const globalKeyToBeCached = 'window,self,globalThis,Array,Object,String,Boolean,Math,Number,Symbol,Date,Promise,Function,Proxy,WeakMap,WeakSet,Set,Map,Reflect,Element,Node,Document,RegExp,Error,TypeError,JSON,isNaN,parseFloat,parseInt,performance,console,decodeURI,encodeURI,decodeURIComponent,encodeURIComponent,location,navigator,undefined' +export const globalKeyToBeCached = 'window,self,globalThis,Array,Object,String,Boolean,Math,Number,Symbol,Date,Promise,Function,Proxy,WeakMap,WeakSet,Set,Map,Reflect,Element,Node,Document,RegExp,Error,TypeError,JSON,isNaN,parseFloat,parseInt,performance,console,decodeURI,encodeURI,decodeURIComponent,encodeURIComponent,navigator,undefined,location,history' diff --git a/src/interact/lifecycles_event.ts b/src/interact/lifecycles_event.ts index 24e4d1cf5..8dd30c54b 100644 --- a/src/interact/lifecycles_event.ts +++ b/src/interact/lifecycles_event.ts @@ -1,5 +1,5 @@ import microApp from '../micro_app' -import { logError, isFunction, removeDomScope, getRootContainer } from '../libs/utils' +import { logError, isFunction, removeDomScope, getRootContainer, assign } from '../libs/utils' function formatEventInfo (event: CustomEvent, element: HTMLElement): void { Object.defineProperties(event, { @@ -39,7 +39,7 @@ export default function dispatchLifecyclesEvent ( // clear dom scope before dispatch lifeCycles event to base app, especially mounted & unmount removeDomScope() - const detail = Object.assign({ + const detail = assign({ name: appName, container: element, }, error && { diff --git a/src/libs/global_env.ts b/src/libs/global_env.ts index 2f2a35509..50052b06a 100644 --- a/src/libs/global_env.ts +++ b/src/libs/global_env.ts @@ -1,4 +1,4 @@ -import { isSupportModuleScript, isBrowser, getCurrentAppName } from './utils' +import { isSupportModuleScript, isBrowser, getCurrentAppName, assign } from './utils' import { rejectMicroAppStyle } from '../source/patch' import { listenUmountOfNestedApp, releaseUnmountOfNestedApp } from '../libs/additional' @@ -94,7 +94,7 @@ export function initGlobalEnv (): void { // mark current application as base application window.__MICRO_APP_BASE_APPLICATION__ = true - Object.assign(globalEnv, { + assign(globalEnv, { // source/patch rawSetAttribute, rawAppendChild, diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 98132912f..61d7ce7c7 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -44,6 +44,7 @@ export function isFunction (target: unknown): boolean { // is Array export const isArray = Array.isArray +export const assign = Object.assign // is PlainObject export function isPlainObject (target: unknown): boolean { @@ -378,3 +379,18 @@ export function trim (str: string): string { export function isFireFox (): boolean { return navigator.userAgent.indexOf('Firefox') > -1 } + +// this events should be sent to the specified app +const formatEventList = ['unmount', 'appstate-change', 'popstate'] + +/** + * Format event name + * @param eventName event name + * @param appName app name + */ +export function formatEventName (eventName: string, appName: string): string { + if (formatEventList.includes(eventName)) { + return `${eventName}-${appName}` + } + return eventName +} diff --git a/src/sandbox/effect.ts b/src/sandbox/effect.ts index c447a881f..a73f47253 100644 --- a/src/sandbox/effect.ts +++ b/src/sandbox/effect.ts @@ -6,6 +6,7 @@ import { isFunction, isBoundFunction, rawDefineProperty, + formatEventName, } from '../libs/utils' import { appInstanceMap } from '../create_app' import globalEnv from '../libs/global_env' @@ -127,21 +128,6 @@ export function releaseEffectDocumentEvent (): void { document.removeEventListener = globalEnv.rawDocumentRemoveEventListener } -// this events should be sent to the specified app -const formatEventList = ['unmount', 'appstate-change'] - -/** - * Format event name - * @param type event name - * @param microAppWindow micro window - */ -function formatEventType (type: string, microAppWindow: microAppWindowType): string { - if (formatEventList.includes(type)) { - return `${type}-${microAppWindow.__MICRO_APP_NAME__}` - } - return type -} - /** * Rewrite side-effect events * @param microAppWindow micro window @@ -169,7 +155,7 @@ export default function effect (microAppWindow: microAppWindowType): Record rawHasOwnProperty.call(microAppWindow, key) || rawHasOwnProperty.call(globalEnv.rawWindow, key) this.setMappingPropertiesWithRawDescriptor(microAppWindow) this.setHijackProperties(microAppWindow, appName) + this.setRouterApi(microAppWindow, appName, url) } // properties associated with the native window @@ -350,14 +353,16 @@ export default class SandBox implements SandBoxInterface { let modifiedEval: unknown, modifiedImage: unknown rawDefineProperties(microAppWindow, { document: { + configurable: false, + enumerable: true, get () { throttleDeferForSetAppName(appName) return globalEnv.rawDocument }, - configurable: false, - enumerable: true, }, eval: { + configurable: true, + enumerable: false, get () { throttleDeferForSetAppName(appName) return modifiedEval || eval @@ -365,10 +370,10 @@ export default class SandBox implements SandBoxInterface { set: (value) => { modifiedEval = value }, - configurable: true, - enumerable: false, }, Image: { + configurable: true, + enumerable: false, get () { throttleDeferForSetAppName(appName) return modifiedImage || globalEnv.ImageProxy @@ -376,8 +381,29 @@ export default class SandBox implements SandBoxInterface { set: (value) => { modifiedImage = value }, + }, + }) + } + + private setRouterApi (microAppWindow: microAppWindowType, appName: string, url: string): void { + const { location, history } = createMicroRouter(appName, url) + rawDefineProperties(microAppWindow, { + location: { + configurable: false, + enumerable: true, + get () { + return location + }, + set: (value) => { + globalEnv.rawWindow.location = value + }, + }, + history: { configurable: true, - enumerable: false, + enumerable: true, + get () { + return history + }, }, }) } diff --git a/src/sandbox/router.ts b/src/sandbox/router.ts new file mode 100644 index 000000000..1d6993b2e --- /dev/null +++ b/src/sandbox/router.ts @@ -0,0 +1,61 @@ +import type { MicroRouter, MicroLocation } from '@micro-app/types' +import globalEnv from '../libs/global_env' +import { assign as oAssign, formatEventName } from '../libs/utils' + +type PopStateListener = (this: Window, e: PopStateEvent) => any + +function addHistoryListener (appName: string): CallableFunction { + // Send to the child app after receiving the popstate event + const popStateHandler: PopStateListener = (e: PopStateEvent) => { + // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 + const state = e.state?.microAppState?.[appName] || null + globalEnv.rawWindow.dispatchEvent( + new PopStateEvent(formatEventName('popstate', appName), { state }) + ) + } + + globalEnv.rawWindow.addEventListener('popstate', popStateHandler) + + return () => { + globalEnv.rawWindow.removeEventListener('popstate', popStateHandler) + } +} + +export default function createMicroRouter (appName: string, url: string): MicroRouter { + const rawLocation = globalEnv.rawWindow.location + const microLocation = new URL(url) as MicroLocation + + function assign (url: string | URL): void { + rawLocation.assign(url) + } + + function replace (url: string | URL): void { + rawLocation.replace(url) + } + + function reload (forcedReload?: boolean): void { + // @ts-ignore + rawLocation.reload(forcedReload) + } + + // microLocation.replace = rawLocation.replace + // microLocation.reload = rawLocation.reload + // microLocation.assign = rawLocation.assign + + oAssign(microLocation, { + assign, + replace, + reload + }) + + microLocation.assign = assign + microLocation.replace = replace + microLocation.reload = reload + + return { + location: microLocation, + // location: rawLocation, + history: window.history, + removeHistoryListener: addHistoryListener(appName) + } +} diff --git a/src/source/scoped_css.ts b/src/sandbox/scoped_css.ts similarity index 100% rename from src/source/scoped_css.ts rename to src/sandbox/scoped_css.ts diff --git a/src/source/index.ts b/src/source/index.ts index a36c07c5d..aee4033a9 100644 --- a/src/source/index.ts +++ b/src/source/index.ts @@ -3,7 +3,7 @@ import { fetchSource } from './fetch' import { logError, CompletionPath, pureCreateElement } from '../libs/utils' import { extractLinkFromHtml, fetchLinksFromHtml } from './links' import { extractScriptElement, fetchScriptsFromHtml } from './scripts' -import scopedCSS from './scoped_css' +import scopedCSS from '../sandbox/scoped_css' /** * transform html string to dom diff --git a/src/source/links.ts b/src/source/links.ts index 4ec7b81e5..26680b330 100644 --- a/src/source/links.ts +++ b/src/source/links.ts @@ -10,7 +10,7 @@ import { defer, logError, } from '../libs/utils' -import scopedCSS from './scoped_css' +import scopedCSS from '../sandbox/scoped_css' import { dispatchOnLoadEvent, dispatchOnErrorEvent, diff --git a/src/source/patch.ts b/src/source/patch.ts index 88a10d25a..5ca3e7d50 100644 --- a/src/source/patch.ts +++ b/src/source/patch.ts @@ -11,7 +11,7 @@ import { isInvalidQuerySelectorKey, isUniqueElement, } from '../libs/utils' -import scopedCSS from './scoped_css' +import scopedCSS from '../sandbox/scoped_css' import { extractLinkFromHtml, formatDynamicLink } from './links' import { extractScriptElement, runScript, runDynamicRemoteScript } from './scripts' import microApp from '../micro_app' diff --git a/typings/global.d.ts b/typings/global.d.ts index 96c9e30a8..901bb1871 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -194,6 +194,14 @@ declare module '@micro-app/types' { // special CallableFunction for interact type CallableFunctionForInteract = CallableFunction & { __APP_NAME__?: string, __AUTO_TRIGGER__?: boolean } + + interface MicroLocation extends Location, URL {} + // interface MicroHistory extends History {} + interface MicroRouter { + location: MicroLocation + history: History + removeHistoryListener: CallableFunction + } } declare namespace JSX { From 3e3e343ba077eb686c099a46d52bf3b0afddda7d Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 2 Mar 2022 20:18:00 +0800 Subject: [PATCH 003/268] feat: update router --- src/sandbox/effect.ts | 5 ++ src/sandbox/router.ts | 109 ++++++++++++++++++++++++++++++++---------- typings/global.d.ts | 18 +++++-- 3 files changed, 105 insertions(+), 27 deletions(-) diff --git a/src/sandbox/effect.ts b/src/sandbox/effect.ts index a73f47253..8f85610c9 100644 --- a/src/sandbox/effect.ts +++ b/src/sandbox/effect.ts @@ -10,6 +10,7 @@ import { } from '../libs/utils' import { appInstanceMap } from '../create_app' import globalEnv from '../libs/global_env' +import { addHistoryListener } from './router' type MicroEventListener = EventListenerOrEventListenerObject & Record type timeInfo = { @@ -278,8 +279,12 @@ export default function effect (microAppWindow: microAppWindowType): Record { + removeHistoryListener() // Clear window binding events if (eventListenerMap.size) { eventListenerMap.forEach((listenerList, type) => { diff --git a/src/sandbox/router.ts b/src/sandbox/router.ts index 1d6993b2e..901f4901e 100644 --- a/src/sandbox/router.ts +++ b/src/sandbox/router.ts @@ -1,27 +1,65 @@ -import type { MicroRouter, MicroLocation } from '@micro-app/types' +import type { MicroRouter, MicroLocation, MicroHistory, MicroState, HistoryProxyValue } from '@micro-app/types' import globalEnv from '../libs/global_env' import { assign as oAssign, formatEventName } from '../libs/utils' -type PopStateListener = (this: Window, e: PopStateEvent) => any +type PopStateListener = (this: Window, e: PopStateEvent) => void -function addHistoryListener (appName: string): CallableFunction { - // Send to the child app after receiving the popstate event - const popStateHandler: PopStateListener = (e: PopStateEvent) => { - // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 - const state = e.state?.microAppState?.[appName] || null - globalEnv.rawWindow.dispatchEvent( - new PopStateEvent(formatEventName('popstate', appName), { state }) - ) - } +// set micro app state to origin state +function createMicroState ( + appName: string, + rawState: MicroState, + microState: MicroState, +): MicroState { + // 生成新的microAppState,因为它们在第二层 + const newMicroAppState = oAssign({}, rawState?.microAppState, { + [appName]: microState + }) + // 生成新的state对象 + return oAssign({}, rawState, { + microAppState: newMicroAppState + }) +} - globalEnv.rawWindow.addEventListener('popstate', popStateHandler) +// get micro app state form origin state +function getMicroState (appName: string, state: MicroState): MicroState { + return state?.microAppState?.[appName] || null +} - return () => { - globalEnv.rawWindow.removeEventListener('popstate', popStateHandler) +// history of micro app +function createMicroHistory (appName: string, url: string): MicroHistory { + const rawHistory = globalEnv.rawWindow.history + + // 是否需要在每次调用时都创建一个函数?这样看起来麻烦,但是是函数式编程,看起来更优雅 + // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 + function bindFunctionOfHistory (methodName: PropertyKey): CallableFunction { + return (...rests: any[]) => { + if (methodName === 'pushState' || methodName === 'replaceState') { + // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! + // 经过格式化后的,包含某个微应用state的全量state + const newState = createMicroState(appName, rawHistory.state, rests[0]) + // eslint-disable-next-line + console.log(newState, url) + } + rawHistory[methodName](...rests) + } } + + const microHistory = new Proxy(rawHistory, { + get (target: Record, key: PropertyKey): HistoryProxyValue { + if (key === 'state') { + return getMicroState(appName, rawHistory.state) + } else if (typeof Reflect.get(target, key) === 'function') { + return bindFunctionOfHistory(key) + } + return Reflect.get(target, key) + }, + }) + + return microHistory } -export default function createMicroRouter (appName: string, url: string): MicroRouter { +// location of micro app +function createMicroLocation (url: string): MicroLocation { const rawLocation = globalEnv.rawWindow.location const microLocation = new URL(url) as MicroLocation @@ -38,24 +76,47 @@ export default function createMicroRouter (appName: string, url: string): MicroR rawLocation.reload(forcedReload) } - // microLocation.replace = rawLocation.replace - // microLocation.reload = rawLocation.reload - // microLocation.assign = rawLocation.assign - oAssign(microLocation, { assign, replace, reload }) - microLocation.assign = assign - microLocation.replace = replace - microLocation.reload = reload + return microLocation +} +export default function createMicroRouter (appName: string, url: string): MicroRouter { + const microLocation = createMicroLocation(url) + // const updateLocation = (path: string) => { + // oAssign(microLocation, new URL(path, url)) + // } return { location: microLocation, + // updateLocation, // location: rawLocation, - history: window.history, - removeHistoryListener: addHistoryListener(appName) + history: createMicroHistory(appName, url), + } +} + +/** + * register & release popstate event + * @param rawWindow origin window + * @param appName app name + * @returns release callback + */ +export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { + // Send to the child app after receiving the popstate event + const popStateHandler: PopStateListener = (e: PopStateEvent): void => { + // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 + const state = getMicroState(appName, e.state) + rawWindow.dispatchEvent( + new PopStateEvent(formatEventName('popstate', appName), { state }) + ) + } + + rawWindow.addEventListener('popstate', popStateHandler) + + return () => { + rawWindow.removeEventListener('popstate', popStateHandler) } } diff --git a/typings/global.d.ts b/typings/global.d.ts index 901bb1871..d8da13e25 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -196,11 +196,23 @@ declare module '@micro-app/types' { type CallableFunctionForInteract = CallableFunction & { __APP_NAME__?: string, __AUTO_TRIGGER__?: boolean } interface MicroLocation extends Location, URL {} - // interface MicroHistory extends History {} + type MicroHistory = ProxyHandler + type MicroState = any + type HistoryProxyValue = + Pick< + History, + 'length' | + 'scrollRestoration' | + 'state' | + 'back' | + 'forward' | + 'go' | + 'pushState' | + 'replaceState' + > | CallableFunction interface MicroRouter { location: MicroLocation - history: History - removeHistoryListener: CallableFunction + history: MicroHistory } } From 017a292d812e3ba06c2eb908c6f56e420ec43978 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Tue, 8 Mar 2022 20:28:49 +0800 Subject: [PATCH 004/268] feat: update router --- .eslintignore | 1 + src/sandbox/router.ts | 164 ++++++++++++++++++++++++++++++++++++++++-- typings/global.d.ts | 10 +++ 3 files changed, 171 insertions(+), 4 deletions(-) diff --git a/.eslintignore b/.eslintignore index aa9977beb..f4d9ae8bf 100755 --- a/.eslintignore +++ b/.eslintignore @@ -6,3 +6,4 @@ node_modules /docs /plugins /src/__tests__/demos +/src/sandbox/router.ts diff --git a/src/sandbox/router.ts b/src/sandbox/router.ts index 901f4901e..021b30126 100644 --- a/src/sandbox/router.ts +++ b/src/sandbox/router.ts @@ -1,6 +1,20 @@ -import type { MicroRouter, MicroLocation, MicroHistory, MicroState, HistoryProxyValue } from '@micro-app/types' +import type { + MicroRouter, + MicroLocation, + MicroHistory, + MicroState, + HistoryProxyValue, + LocationQueryValue, + LocationQuery, + LocationQueryObject, +} from '@micro-app/types' import globalEnv from '../libs/global_env' -import { assign as oAssign, formatEventName } from '../libs/utils' +import { + assign as oAssign, + formatEventName, + isArray, + isNull, +} from '../libs/utils' type PopStateListener = (this: Window, e: PopStateEvent) => void @@ -37,8 +51,7 @@ function createMicroHistory (appName: string, url: string): MicroHistory { // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! // 经过格式化后的,包含某个微应用state的全量state const newState = createMicroState(appName, rawHistory.state, rests[0]) - // eslint-disable-next-line - console.log(newState, url) + } rawHistory[methodName](...rests) } @@ -85,11 +98,154 @@ function createMicroLocation (url: string): MicroLocation { return microLocation } +const ENC_AD_RE = /&/g // %M1 +const ENC_EQ_RE = /=/g // %M2 +const DEC_AD_RE = /%M1/g // & +const DEC_EQ_RE = /%M2/g // = + +function encodeMicroPath (path: string): string { + return encodeURIComponent(commonDecode(path).replace(ENC_AD_RE, '%M1').replace(ENC_EQ_RE, '%M2')) +} + +function decodeMicroPath (path: string): string { + return commonDecode(path).replace(DEC_AD_RE, '&').replace(DEC_EQ_RE, '=') +} + +function commonDecode (path: string): string { + try { + const decPath = decodeURIComponent(path) + if (path === decPath || DEC_AD_RE.test(decPath) || DEC_EQ_RE.test(decPath)) return decPath + return commonDecode(decPath) + } catch { + return path + } +} + +// 更新url地址有以下几种情况: +// 1、页面初始化 +// 2、子应用页面内部发生跳转 +// 3、通过micro-app api进行跳转 + +// 更新location有以下几种情况,根据url地址进行更新: +// 1、页面初始化 +// 2、子应用页面内部发生跳转 +// 3、通过micro-app api进行跳转 +// 4、popstate事件 +// const { pathname, search, hash } = location +// pathname + search + hash +// 如果有hash,则参数加在hash后面(默认为hash路由),如果没有hash,则加在query上(默认history路由) +// 特殊情况:history路由有hash,hash路由没有hash -- 不管 +function updateLocationFromURL () { + const url = globalEnv.rawWindow.location +} + +// 在初始化时,先从url上取当前子应用的路由信息 +// 如果存在则根据存在的信息更新location,如果没有,则更新url地址 +function attachRouteInfoToURL (appName: string, microLocation: MicroLocation) { + const { pathname, search, hash } = microLocation + const encodedMicroPath = encodeMicroPath(pathname + search + hash) + const fullPath = attachQueryToURL(appName, encodedMicroPath) + const rawHistory = globalEnv.rawWindow.history + globalEnv.rawWindow.history.replaceState( + createMicroState(appName, rawHistory.state, getMicroState(appName, rawHistory.state)), + null, + fullPath, + ) +} + +function attachQueryToURL (appName: string, encodedMicroPath: string): string { + let { pathname, search, hash } = globalEnv.rawWindow.location + const microQueryObject = getQueryObjectFromURL() + + if (microQueryObject.hashQuery) { + microQueryObject.hashQuery[appName] = encodedMicroPath + hash = hash.slice(0, hash.indexOf('?') + 1) + stringifyQuery(microQueryObject.hashQuery) + } else { + if (microQueryObject.searchQuery) { + microQueryObject.searchQuery[appName] = encodedMicroPath + } else { + microQueryObject.searchQuery = { + [appName]: encodedMicroPath + } + } + search = '?' + stringifyQuery(microQueryObject.searchQuery) + } + + return pathname + search + hash +} + +/** + * 根据location获取query对象 + */ +function getQueryObjectFromURL (): LocationQuery { + const { search, hash } = globalEnv.rawWindow.location + const microQueryObject: LocationQuery = {} + + if (search !== '' && search !== '?') { + microQueryObject.searchQuery = parseQuery(search.slice(1)) + } + + if (hash.includes('?')) { + microQueryObject.hashQuery = parseQuery(hash.slice(hash.indexOf('?') + 1)) + } + + return microQueryObject +} + +function parseQuery (search: string): LocationQueryObject { + const result: LocationQueryObject = {} + const queryList = search.split('&') + + // 注意我们不会对key和value进行解码,以确保替换url时前后值一致 + // 我们只对匹配到的微应用的key和value在后续进行编解码 + for (const queryItem of queryList) { + const eqPos = queryItem.indexOf('=') + const key = eqPos < 0 ? queryItem : queryItem.slice(0, eqPos) + const value = eqPos < 0 ? null : queryItem.slice(eqPos + 1) + + if (key in result) { + let currentValue = result[key] + if (!isArray(currentValue)) { + currentValue = result[key] = [currentValue] + } + currentValue.push(value) + } else { + result[key] = value + } + } + + return result +} + +// 一次只能格式化一个,所以search和hash需要分2次处理 +function stringifyQuery (queryObject: LocationQueryObject): string { + let result = '' + + for (const key in queryObject) { + const value = queryObject[key] + if (isNull(value)) { + result += (result.length ? '&' : '') + key + } else { + const valueList: LocationQueryValue[] = isArray(value) ? value : [value] + + valueList.forEach(value => { + result += (result.length ? '&' : '') + key + if (value != null) result += '=' + value + }) + } + } + + return result +} + export default function createMicroRouter (appName: string, url: string): MicroRouter { const microLocation = createMicroLocation(url) // const updateLocation = (path: string) => { // oAssign(microLocation, new URL(path, url)) // } + + // 初始化信息 + attachRouteInfoToURL(appName, microLocation) return { location: microLocation, // updateLocation, diff --git a/typings/global.d.ts b/typings/global.d.ts index d8da13e25..ba92a7c98 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -214,6 +214,16 @@ declare module '@micro-app/types' { location: MicroLocation history: MicroHistory } + type LocationQueryValue = string | null + type LocationQueryObject = Record< + string, + LocationQueryValue | LocationQueryValue[] + > + + type LocationQuery = { + hashQuery?: LocationQueryObject, + searchQuery?: LocationQueryObject + } } declare namespace JSX { From 37c2db8cff6c08db4c51b2cba81db90344a74554 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 9 Mar 2022 23:43:11 +0800 Subject: [PATCH 005/268] feat: update router at 2022.3.9 --- dev/children/react16/src/index.js | 2 + dev/children/react16/src/router.js | 16 +- dev/children/vue2/src/App.vue | 8 +- .../src/pages/multiple/multiple.js | 2 +- dev/main-react16/src/pages/vue3/vue3.js | 2 +- src/sandbox/index.ts | 36 +- src/sandbox/router.ts | 315 ++++++++++++------ 7 files changed, 258 insertions(+), 123 deletions(-) diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index 38d02f3b2..dcc80a5be 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -55,6 +55,8 @@ ReactDOM.render( // 监听卸载 window.addEventListener('unmount', function () { + console.log(888888888, document.getElementById('root')) + debugger ReactDOM.unmountComponentAtNode(document.getElementById('root')); console.log('微应用react16卸载了 -- 自定义事件unmount'); }) diff --git a/dev/children/react16/src/router.js b/dev/children/react16/src/router.js index 97e0fb0a6..02e7a28b4 100644 --- a/dev/children/react16/src/router.js +++ b/dev/children/react16/src/router.js @@ -1,4 +1,4 @@ -import React, { lazy, Suspense } from 'react' +import React, { lazy, Suspense, useState, useEffect } from 'react' import { BrowserRouter, Switch, Route, Redirect, Link, HashRouter } from 'react-router-dom' import Page1 from './pages/page1/page1' import { Menu } from 'antd'; @@ -19,12 +19,24 @@ function getDefaultKey () { function App () { + const [selectedKey, changeSelectedKey ] = useState(getDefaultKey()) + function handleSelect ({ selectedKeys }) { + changeSelectedKey(selectedKeys[0]) + } + useEffect(() => { + const handlePopstate = () => changeSelectedKey(getDefaultKey()) + window.addEventListener('popstate', handlePopstate) + return () => { + window.removeEventListener('popstate', handlePopstate) + } + }, []) return ( }> home diff --git a/dev/children/vue2/src/App.vue b/dev/children/vue2/src/App.vue index 1860834d2..9c6f7659d 100644 --- a/dev/children/vue2/src/App.vue +++ b/dev/children/vue2/src/App.vue @@ -16,11 +16,13 @@ export default { name: 'App', data () { return { - activeName: window.location.href.includes('#/page2') ? 'page2': '/', + activeName: location.href.includes('#/page2') ? 'page2': '/', } }, - created () { - + mounted () { + window.addEventListener('popstate', () => { + this.activeName =location.href.includes('#/page2') ? 'page2': '/' + }) }, components: { diff --git a/dev/main-react16/src/pages/multiple/multiple.js b/dev/main-react16/src/pages/multiple/multiple.js index ae3138027..128719957 100644 --- a/dev/main-react16/src/pages/multiple/multiple.js +++ b/dev/main-react16/src/pages/multiple/multiple.js @@ -42,7 +42,7 @@ function Vue3 () { name={reactname} url={`${config.react16}micro-app/react16`} data={data} - baseRoute='/micro-app/demo/multiple' + // baseRoute='/micro-app/demo/multiple' onMounted={() => hideLoading(false)} // destroy // inline diff --git a/dev/main-react16/src/pages/vue3/vue3.js b/dev/main-react16/src/pages/vue3/vue3.js index 2b21d5b0e..6765b3d3a 100644 --- a/dev/main-react16/src/pages/vue3/vue3.js +++ b/dev/main-react16/src/pages/vue3/vue3.js @@ -23,7 +23,7 @@ function Vue3 () { data={data} onMounted={() => hideLoading(false)} onBeforeshow={() => hideLoading(false)} - baseRoute='/micro-app/demo/vue3' + // baseRoute='/micro-app/demo/vue3' // disableScopecss // keep-alive // inline diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 011715273..0e51656e5 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -1,4 +1,4 @@ -import type { microAppWindowType, SandBoxInterface, plugins } from '@micro-app/types' +import type { microAppWindowType, SandBoxInterface, plugins, MicroLocation } from '@micro-app/types' import { EventCenterForMicroApp, rebuildDataCenterSnapshot, recordDataCenterSnapshot } from '../interact' @@ -28,11 +28,12 @@ import { patchElementPrototypeMethods, releasePatches, } from '../source/patch' -import createMicroRouter from './router' +import createMicroRouter, { initialActionForRoute, clearRouterStateFromURL } from './router' export type MicroAppWindowDataType = { __MICRO_APP_ENVIRONMENT__: boolean __MICRO_APP_NAME__: string + __MICRO_APP_URL__: string __MICRO_APP_PUBLIC_PATH__: string __MICRO_APP_BASE_URL__: string __MICRO_APP_BASE_ROUTE__: string @@ -78,7 +79,7 @@ export default class SandBox implements SandBoxInterface { private recordUmdInjectedValues?: Map // sandbox state private active = false - proxyWindow: WindowProxy // Proxy + proxyWindow: WindowProxy & MicroAppWindowDataType // Proxy microAppWindow = {} as MicroAppWindowType // Proxy target constructor (appName: string, url: string) { @@ -92,9 +93,10 @@ export default class SandBox implements SandBoxInterface { assign(this, effect(this.microAppWindow)) } - start (baseRoute: string): void { + public start (baseRoute: string): void { if (!this.active) { this.active = true + this.initRouteState() this.microAppWindow.__MICRO_APP_BASE_ROUTE__ = this.microAppWindow.__MICRO_APP_BASE_URL__ = baseRoute // BUG FIX: bable-polyfill@6.x globalEnv.rawWindow._babelPolyfill && (globalEnv.rawWindow._babelPolyfill = false) @@ -105,9 +107,8 @@ export default class SandBox implements SandBoxInterface { } } - stop (): void { + public stop (keepRouteState?: boolean): void { if (this.active) { - this.active = false this.releaseEffect() this.microAppWindow.microApp.clearDataListener() this.microAppWindow.microApp.clearGlobalDataListener() @@ -122,15 +123,17 @@ export default class SandBox implements SandBoxInterface { }) this.escapeKeys.clear() + if (!keepRouteState) this.clearRouteState() if (--SandBox.activeCount === 0) { releaseEffectDocumentEvent() releasePatches() } + this.active = false } } // record umd snapshot before the first execution of umdHookMount - recordUmdSnapshot (): void { + public recordUmdSnapshot (): void { this.microAppWindow.__MICRO_APP_UMD_MODE__ = true this.recordUmdEffect() recordDataCenterSnapshot(this.microAppWindow.microApp) @@ -142,7 +145,7 @@ export default class SandBox implements SandBoxInterface { } // rebuild umd snapshot before remount umd app - rebuildUmdSnapshot (): void { + public rebuildUmdSnapshot (): void { this.recordUmdInjectedValues!.forEach((value: unknown, key: PropertyKey) => { Reflect.set(this.proxyWindow, key, value) }) @@ -150,6 +153,22 @@ export default class SandBox implements SandBoxInterface { rebuildDataCenterSnapshot(this.microAppWindow.microApp) } + public initRouteState (): void { + initialActionForRoute( + this.proxyWindow.__MICRO_APP_NAME__, + this.proxyWindow.__MICRO_APP_URL__, + this.proxyWindow.location as MicroLocation, + ) + } + + public clearRouteState (): void { + clearRouterStateFromURL( + this.proxyWindow.__MICRO_APP_NAME__, + this.proxyWindow.__MICRO_APP_URL__, + this.proxyWindow.location as MicroLocation, + ) + } + /** * get scopeProperties and escapeProperties from plugins * @param appName app name @@ -290,6 +309,7 @@ export default class SandBox implements SandBoxInterface { private initMicroAppWindow (microAppWindow: microAppWindowType, appName: string, url: string): void { microAppWindow.__MICRO_APP_ENVIRONMENT__ = true microAppWindow.__MICRO_APP_NAME__ = appName + microAppWindow.__MICRO_APP_URL__ = url microAppWindow.__MICRO_APP_PUBLIC_PATH__ = getEffectivePath(url) microAppWindow.__MICRO_APP_WINDOW__ = microAppWindow microAppWindow.microApp = assign(new EventCenterForMicroApp(appName), { diff --git a/src/sandbox/router.ts b/src/sandbox/router.ts index 021b30126..aafe1802e 100644 --- a/src/sandbox/router.ts +++ b/src/sandbox/router.ts @@ -14,10 +14,61 @@ import { formatEventName, isArray, isNull, + isString, + isUndefined, + logError, } from '../libs/utils' +import { appInstanceMap } from '../create_app' + +// 更新url地址有以下几种情况: +// 1、页面初始化 +// 2、子应用页面内部发生跳转 +// 3、通过micro-app api进行跳转 + +// 更新location有以下几种情况,根据url地址进行更新: +// 1、页面初始化 +// 2、子应用页面内部发生跳转 +// 3、通过micro-app api进行跳转 +// 4、popstate事件 +// const { pathname, search, hash } = location +// pathname + search + hash +// 如果有hash,则参数加在hash后面(默认为hash路由),如果没有hash,则加在query上(默认history路由) +// 特殊情况:history路由有hash,hash路由没有hash -- 不管 type PopStateListener = (this: Window, e: PopStateEvent) => void +/** + * register & release popstate event + * @param rawWindow origin window + * @param appName app name + * @returns release callback + */ + export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { + // Send to the child app after receiving the popstate event + const popStateHandler: PopStateListener = (e: PopStateEvent): void => { + // 先更新location,再发送popstate事件 + const microPath = getMicroPathFromURL(appName) + const app = appInstanceMap.get(appName) + if (microPath && app) { + // @ts-ignore + updateLocation(microPath, app.url, app.sandBox.proxyWindow.location) + // @ts-ignore + console.log(333333, microPath, app.sandBox.proxyWindow.location) + } + // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 + const state = getMicroState(appName, e.state) + rawWindow.dispatchEvent( + new PopStateEvent(formatEventName('popstate', appName), { state }) + ) + } + + rawWindow.addEventListener('popstate', popStateHandler) + + return () => { + rawWindow.removeEventListener('popstate', popStateHandler) + } +} + // set micro app state to origin state function createMicroState ( appName: string, @@ -39,21 +90,45 @@ function getMicroState (appName: string, state: MicroState): MicroState { return state?.microAppState?.[appName] || null } +// delete micro app state form origin state +function deleteMicroState (appName: string, rawState: MicroState): MicroState { + if (rawState?.microAppState?.[appName]) { + delete rawState.microAppState[appName] + } + // 生成新的state对象 + return oAssign({}, rawState) +} + // history of micro app -function createMicroHistory (appName: string, url: string): MicroHistory { +function createMicroHistory (appName: string, base: string, microLocation: MicroLocation): MicroHistory { const rawHistory = globalEnv.rawWindow.history // 是否需要在每次调用时都创建一个函数?这样看起来麻烦,但是是函数式编程,看起来更优雅 // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 - function bindFunctionOfHistory (methodName: PropertyKey): CallableFunction { + function microHistoryMethod (methodName: PropertyKey): CallableFunction { return (...rests: any[]) => { - if (methodName === 'pushState' || methodName === 'replaceState') { - // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! - // 经过格式化后的,包含某个微应用state的全量state - const newState = createMicroState(appName, rawHistory.state, rests[0]) - + console.log(444444444, rests[0], rests[1], rests[2], methodName) + let targetPath = null + // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! + if ((methodName === 'pushState' || methodName === 'replaceState') && rests[2] && isString(rests[2])) { + try { + const targetLocation = new URL(rests[2], base) as MicroLocation + if (targetLocation.origin === microLocation.origin) { + targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash + // 经过格式化后的,包含某个微应用state的全量state + const newState = createMicroState(appName, rawHistory.state, rests[0]) + rests = [newState, rests[1], attachMicroQueryToURL(appName, targetLocation)] + } + } catch (e) { + logError(e, appName) + } } + rawHistory[methodName](...rests) + + if (targetPath) updateLocation(targetPath, base, microLocation) + + console.log(5555555, microLocation, base) } } @@ -62,7 +137,7 @@ function createMicroHistory (appName: string, url: string): MicroHistory { if (key === 'state') { return getMicroState(appName, rawHistory.state) } else if (typeof Reflect.get(target, key) === 'function') { - return bindFunctionOfHistory(key) + return microHistoryMethod(key) } return Reflect.get(target, key) }, @@ -71,33 +146,6 @@ function createMicroHistory (appName: string, url: string): MicroHistory { return microHistory } -// location of micro app -function createMicroLocation (url: string): MicroLocation { - const rawLocation = globalEnv.rawWindow.location - const microLocation = new URL(url) as MicroLocation - - function assign (url: string | URL): void { - rawLocation.assign(url) - } - - function replace (url: string | URL): void { - rawLocation.replace(url) - } - - function reload (forcedReload?: boolean): void { - // @ts-ignore - rawLocation.reload(forcedReload) - } - - oAssign(microLocation, { - assign, - replace, - reload - }) - - return microLocation -} - const ENC_AD_RE = /&/g // %M1 const ENC_EQ_RE = /=/g // %M2 const DEC_AD_RE = /%M1/g // & @@ -121,45 +169,36 @@ function commonDecode (path: string): string { } } -// 更新url地址有以下几种情况: -// 1、页面初始化 -// 2、子应用页面内部发生跳转 -// 3、通过micro-app api进行跳转 - -// 更新location有以下几种情况,根据url地址进行更新: -// 1、页面初始化 -// 2、子应用页面内部发生跳转 -// 3、通过micro-app api进行跳转 -// 4、popstate事件 -// const { pathname, search, hash } = location -// pathname + search + hash -// 如果有hash,则参数加在hash后面(默认为hash路由),如果没有hash,则加在query上(默认history路由) -// 特殊情况:history路由有hash,hash路由没有hash -- 不管 -function updateLocationFromURL () { - const url = globalEnv.rawWindow.location -} - -// 在初始化时,先从url上取当前子应用的路由信息 -// 如果存在则根据存在的信息更新location,如果没有,则更新url地址 -function attachRouteInfoToURL (appName: string, microLocation: MicroLocation) { - const { pathname, search, hash } = microLocation - const encodedMicroPath = encodeMicroPath(pathname + search + hash) - const fullPath = attachQueryToURL(appName, encodedMicroPath) - const rawHistory = globalEnv.rawWindow.history - globalEnv.rawWindow.history.replaceState( - createMicroState(appName, rawHistory.state, getMicroState(appName, rawHistory.state)), - null, - fullPath, - ) +// 根据浏览器url参数,获取当前子应用的fullPath +function getMicroPathFromURL (appName: string): string | null { + const rawLocation = globalEnv.rawWindow.location + const queryObject = getQueryObjectFromURL(rawLocation.search, rawLocation.hash) + const microPath = queryObject.hashQuery?.[appName] || queryObject.searchQuery?.[appName] + // 解码 + return microPath ? decodeMicroPath(microPath as string) : null } -function attachQueryToURL (appName: string, encodedMicroPath: string): string { +// 将name=encodeUrl地址插入到浏览器url上 +function attachMicroQueryToURL (appName: string, microLocation: MicroLocation): string { let { pathname, search, hash } = globalEnv.rawWindow.location - const microQueryObject = getQueryObjectFromURL() + const microQueryObject = getQueryObjectFromURL(search, hash) + const encodedMicroPath = encodeMicroPath( + microLocation.pathname + + microLocation.search + + microLocation.hash + ) - if (microQueryObject.hashQuery) { - microQueryObject.hashQuery[appName] = encodedMicroPath - hash = hash.slice(0, hash.indexOf('?') + 1) + stringifyQuery(microQueryObject.hashQuery) + // hash存在且search不存在,则认为是hash路由 + if (hash && !search) { + if (microQueryObject.hashQuery) { + microQueryObject.hashQuery[appName] = encodedMicroPath + } else { + microQueryObject.hashQuery = { + [appName]: encodedMicroPath + } + } + const baseHash = hash.includes('?') ? hash.slice(0, hash.indexOf('?') + 1) : hash + '?' + hash = baseHash + stringifyQuery(microQueryObject.hashQuery) } else { if (microQueryObject.searchQuery) { microQueryObject.searchQuery[appName] = encodedMicroPath @@ -174,24 +213,42 @@ function attachQueryToURL (appName: string, encodedMicroPath: string): string { return pathname + search + hash } +// 将name=encodeUrl的参数从浏览器url上删除 +function removeMicroQueryFromURL (appName: string): string { + let { pathname, search, hash } = globalEnv.rawWindow.location + const microQueryObject = getQueryObjectFromURL(search, hash) + + if (microQueryObject.hashQuery?.[appName]) { + delete microQueryObject.hashQuery?.[appName] + const hashQueryStr = stringifyQuery(microQueryObject.hashQuery) + hash = hash.slice(0, hash.indexOf('?') + Number(Boolean(hashQueryStr))) + hashQueryStr + } else if (microQueryObject.searchQuery?.[appName]) { + delete microQueryObject.searchQuery?.[appName] + const searchQueryStr = stringifyQuery(microQueryObject.searchQuery) + search = searchQueryStr ? '?' + searchQueryStr : '' + } + + return pathname + search + hash +} + /** * 根据location获取query对象 */ -function getQueryObjectFromURL (): LocationQuery { - const { search, hash } = globalEnv.rawWindow.location - const microQueryObject: LocationQuery = {} +function getQueryObjectFromURL (search: string, hash: string): LocationQuery { + const queryObject: LocationQuery = {} if (search !== '' && search !== '?') { - microQueryObject.searchQuery = parseQuery(search.slice(1)) + queryObject.searchQuery = parseQuery(search.slice(1)) } if (hash.includes('?')) { - microQueryObject.hashQuery = parseQuery(hash.slice(hash.indexOf('?') + 1)) + queryObject.hashQuery = parseQuery(hash.slice(hash.indexOf('?') + 1)) } - return microQueryObject + return queryObject } +// 将参数字符串转换为对象 function parseQuery (search: string): LocationQueryObject { const result: LocationQueryObject = {} const queryList = search.split('&') @@ -217,7 +274,7 @@ function parseQuery (search: string): LocationQueryObject { return result } -// 一次只能格式化一个,所以search和hash需要分2次处理 +// 将对象转换为字符串,一次只能格式化一个,所以search和hash需要分2次处理 function stringifyQuery (queryObject: LocationQueryObject): string { let result = '' @@ -229,8 +286,10 @@ function stringifyQuery (queryObject: LocationQueryObject): string { const valueList: LocationQueryValue[] = isArray(value) ? value : [value] valueList.forEach(value => { - result += (result.length ? '&' : '') + key - if (value != null) result += '=' + value + if (!isUndefined(value)) { + result += (result.length ? '&' : '') + key + if (!isNull(value)) result += '=' + value + } }) } } @@ -238,41 +297,81 @@ function stringifyQuery (queryObject: LocationQueryObject): string { return result } -export default function createMicroRouter (appName: string, url: string): MicroRouter { - const microLocation = createMicroLocation(url) - // const updateLocation = (path: string) => { - // oAssign(microLocation, new URL(path, url)) - // } +// location of micro app +// 只会在沙箱初始化时执行一次 +function createMicroLocation (url: string): MicroLocation { + const rawLocation = globalEnv.rawWindow.location + const microLocation = new URL(url) as MicroLocation - // 初始化信息 - attachRouteInfoToURL(appName, microLocation) - return { - location: microLocation, - // updateLocation, - // location: rawLocation, - history: createMicroHistory(appName, url), + function assign (url: string | URL): void { + rawLocation.assign(url) + } + + function replace (url: string | URL): void { + rawLocation.replace(url) + } + + function reload (forcedReload?: boolean): void { + // @ts-ignore + rawLocation.reload(forcedReload) } + + oAssign(microLocation, { + assign, + replace, + reload + }) + + return microLocation } -/** - * register & release popstate event - * @param rawWindow origin window - * @param appName app name - * @returns release callback - */ -export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { - // Send to the child app after receiving the popstate event - const popStateHandler: PopStateListener = (e: PopStateEvent): void => { - // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 - const state = getMicroState(appName, e.state) - rawWindow.dispatchEvent( - new PopStateEvent(formatEventName('popstate', appName), { state }) - ) +// origin is readonly, so we ignore it +const LocationKeys = ['hash', 'host', 'hostname', 'href', 'password', 'pathname', 'port', 'protocol', 'search'] +function updateLocation (path: string, base: string, microLocation: MicroLocation) { + const newLocation = new URL(path, base) + for (const key of LocationKeys) { + // @ts-ignore + microLocation[key] = newLocation[key] } +} - rawWindow.addEventListener('popstate', popStateHandler) +// 更新浏览器url +function updateBrowserURL (state: MicroState, fullPath: string): void { + globalEnv.rawWindow.history.replaceState(state, null, fullPath) +} - return () => { - rawWindow.removeEventListener('popstate', popStateHandler) +// 当沙箱执行start, 或者隐藏的keep-alive应用重新渲染时时才:根据浏览器url更新location 或者 将参数更新到url上 +export function initialActionForRoute (appName: string, url: string, microLocation: MicroLocation) { + const microPath = getMicroPathFromURL(appName) + // 如果初始化时参数有子应用的数据信息,则直接复用,如果没有则重新创建 + + if (microPath) { + updateLocation(microPath, url, microLocation) + } else { + const fullPath = attachMicroQueryToURL(appName, microLocation) + // 下面需要优化,代码太繁琐了 + const rawHistory = globalEnv.rawWindow.history + const historyState = createMicroState(appName, rawHistory.state, getMicroState(appName, rawHistory.state)) + updateBrowserURL(historyState, fullPath) + } +} + +export function clearRouterStateFromURL (appName: string, url: string, microLocation: MicroLocation) { + // 初始化location信息 + const { pathname, search, hash } = new URL(url) + updateLocation(pathname + search + hash, url, microLocation) + // 删除浏览器url上的子应用参数 + const fullPath = removeMicroQueryFromURL(appName) + const rawHistory = globalEnv.rawWindow.history + const historyState = deleteMicroState(appName, rawHistory.state) + updateBrowserURL(historyState, fullPath) +} + +export default function createMicroRouter (appName: string, url: string): MicroRouter { + const microLocation = createMicroLocation(url) + + return { + location: microLocation, + history: createMicroHistory(appName, url, microLocation), } } From e0a48cc063cc95b82b32eb0655c86f6b11bcee0a Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Thu, 10 Mar 2022 22:49:43 +0800 Subject: [PATCH 006/268] feat: update router at 2022.3.10 --- dev/children/react16/src/index.js | 2 - .../react16/src/pages/inline/inline.js | 2 +- dev/children/vue2/src/main.js | 6 +- dev/main-react16/config/config.js | 2 +- dev/main-react16/src/global.jsx | 23 +-- .../src/pages/angular11/angular11.js | 2 +- dev/main-react16/src/pages/react16/react16.js | 6 +- docs/zh-cn/changelog.md | 17 ++ src/__tests__/libs/additional.test.ts | 87 ---------- src/__tests__/sandbox/index.test.ts | 12 +- src/create_app.ts | 38 +++-- src/interact/lifecycles_event.ts | 3 +- src/libs/additional.ts | 27 ---- src/libs/global_env.ts | 31 +++- src/libs/utils.ts | 64 ++++++-- src/micro_app.ts | 21 ++- src/micro_app_element.ts | 27 +++- src/prefetch.ts | 4 +- src/sandbox/{router.ts => __save__router.ts} | 95 +++++------ src/sandbox/effect.ts | 27 +++- src/sandbox/index.ts | 102 ++++++++---- src/sandbox/router/core.ts | 148 ++++++++++++++++++ src/sandbox/router/event.ts | 42 +++++ src/sandbox/router/history.ts | 69 ++++++++ src/sandbox/router/index.ts | 59 +++++++ src/sandbox/router/location.ts | 47 ++++++ src/source/patch.ts | 4 + typings/global.d.ts | 14 +- 28 files changed, 698 insertions(+), 283 deletions(-) delete mode 100644 src/__tests__/libs/additional.test.ts delete mode 100644 src/libs/additional.ts rename src/sandbox/{router.ts => __save__router.ts} (79%) create mode 100644 src/sandbox/router/core.ts create mode 100644 src/sandbox/router/event.ts create mode 100644 src/sandbox/router/history.ts create mode 100644 src/sandbox/router/index.ts create mode 100644 src/sandbox/router/location.ts diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index dcc80a5be..38d02f3b2 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -55,8 +55,6 @@ ReactDOM.render( // 监听卸载 window.addEventListener('unmount', function () { - console.log(888888888, document.getElementById('root')) - debugger ReactDOM.unmountComponentAtNode(document.getElementById('root')); console.log('微应用react16卸载了 -- 自定义事件unmount'); }) diff --git a/dev/children/react16/src/pages/inline/inline.js b/dev/children/react16/src/pages/inline/inline.js index b66a3000f..a5817b554 100644 --- a/dev/children/react16/src/pages/inline/inline.js +++ b/dev/children/react16/src/pages/inline/inline.js @@ -32,7 +32,7 @@ function Vue2 () { // onBeforemount={() => hideLoading(false)} onMounted={() => hideLoading(false)} // shadowDOM - destory + // destory // inline // disableScopecss // disableSandbox diff --git a/dev/children/vue2/src/main.js b/dev/children/vue2/src/main.js index c3e11956a..b6eef461c 100644 --- a/dev/children/vue2/src/main.js +++ b/dev/children/vue2/src/main.js @@ -36,7 +36,7 @@ let app = null // -------------------分割线-umd模式------------------ // -export async function mount (props) { +export function mount (props) { app = new Vue({ router, render: h => h(App), @@ -45,14 +45,14 @@ export async function mount (props) { } // 卸载应用 -export async function unmount () { +export function unmount () { app.$destroy() app.$el.innerHTML = '' app = null console.log("微应用vue2卸载了 -- 来自umd-unmount") } -export async function bootstrap() { +export function bootstrap() { } diff --git a/dev/main-react16/config/config.js b/dev/main-react16/config/config.js index d6c396b36..3d45ec1d0 100644 --- a/dev/main-react16/config/config.js +++ b/dev/main-react16/config/config.js @@ -14,7 +14,7 @@ export default defineConfig({ hmr: true, }, history: { - type: 'browser', + type: 'hash', // browser }, locale: { // default zh-CN diff --git a/dev/main-react16/src/global.jsx b/dev/main-react16/src/global.jsx index d5b96fb40..2d698667b 100644 --- a/dev/main-react16/src/global.jsx +++ b/dev/main-react16/src/global.jsx @@ -63,22 +63,13 @@ microApp.start({ react16: [{ scopeProperties: ['scopeKey3', 'scopeKey4'], escapeProperties: ['escapeKey3', 'escapeKey4'], - loader(code, url) { - if (process.env.NODE_ENV === 'development' && code.indexOf('sockjs-node') > -1) { - console.log('react16插件', url) - code = code.replace('window.location.port', '3001') - } - return code - } - }], - react17: [{ - loader(code, url) { - if (process.env.NODE_ENV === 'development' && code.indexOf('sockjs-node') > -1) { - console.log('react17插件', url) - code = code.replace('window.location.port', '3002') - } - return code - } + // loader(code, url) { + // if (process.env.NODE_ENV === 'development' && code.indexOf('sockjs-node') > -1) { + // console.log('react16插件', url) + // code = code.replace('window.location.port', '3001') + // } + // return code + // } }], vue2: [{ scopeProperties: ['scopeKey5', 'scopeKey6'], diff --git a/dev/main-react16/src/pages/angular11/angular11.js b/dev/main-react16/src/pages/angular11/angular11.js index e2a2d8b19..47be30308 100644 --- a/dev/main-react16/src/pages/angular11/angular11.js +++ b/dev/main-react16/src/pages/angular11/angular11.js @@ -23,7 +23,7 @@ function Angular11 () { url={`${config.angular11}micro-app/angular11`} data={data} onMounted={() => hideLoading(false)} - baseRoute='/micro-app/demo/angular11' + // baseRoute='/micro-app/demo/angular11' // destroy // inline // disableScopecss diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index e197a9fe0..b54d89529 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -16,7 +16,7 @@ export default class App extends React.Component { name: '初始化数据' }, name: 'react#16', - url: `${config.react16}micro-app/react16?a=1`, + url: `${config.react16}micro-app/react16/?a=1`, // url: 'http://127.0.0.1:8080/micro-app/react16', showLoading: true, showMicroApp: true, @@ -187,9 +187,11 @@ export default class App extends React.Component { onAftershow={this.handleAftershow} onAfterhidden={this.handleAfterhidden} onDataChange={this.handleDataChange} - // baseRoute='/micro-app/demo/react16' + baseRoute='/micro-app/demo/react16' // keep-alive // destroy + keep-route-state + // disable-memory-router inline // disableSandbox // disable-sandbox diff --git a/docs/zh-cn/changelog.md b/docs/zh-cn/changelog.md index 9df9251a6..56c88f115 100644 --- a/docs/zh-cn/changelog.md +++ b/docs/zh-cn/changelog.md @@ -8,6 +8,23 @@ --- +### 1.0.0-beta.1 + +`2022-03-30` + +- **New** + + - 🆕 新增了独立的路由系统 - `MemoryRouter`,简化接入步骤。 + +- **Bug Fix** + + - 🐞 修复了在循环嵌套时`iconfont.js`在部分场景下报错的问题。 + +- **Update** + + - 🚀 优化了预加载相关代码和逻辑,提高并行渲染能力。 + + ### 0.8.5 `2022-02-14` diff --git a/src/__tests__/libs/additional.test.ts b/src/__tests__/libs/additional.test.ts deleted file mode 100644 index 87b571b6e..000000000 --- a/src/__tests__/libs/additional.test.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { listenUmountOfNestedApp, releaseUnmountOfNestedApp } from '../../libs/additional' -import CreateApp, { appInstanceMap } from '../../create_app' - -describe('test additional', () => { - // 卸载循环内嵌的子应用 - test('unmount app loop build-in', () => { - // test-app1模拟开启shadowRoot的未卸载孙应用 - const con1 = document.createElement('micro-app') - // @ts-ignore - con1.disconnectedCallback = jest.fn - con1.attachShadow({ mode: 'open' }) - const app1 = { - name: 'test-app1', - url: 'http://localhost:3000/', - scopecss: true, - useSandbox: true, - container: con1.shadowRoot, - } - appInstanceMap.set('test-app1', app1 as CreateApp) - - // test-app2模拟正常未卸载孙应用 - const con2 = document.createElement('micro-app') - // @ts-ignore - con2.disconnectedCallback = jest.fn - const app2 = { - name: 'test-app2', - url: 'http://localhost:3000/', - scopecss: true, - useSandbox: true, - container: con2, - } - appInstanceMap.set('test-app2', app2 as CreateApp) - - // test-app3模拟已卸载孙应用(没有container) - const app3 = { - name: 'test-app3', - url: 'http://localhost:3000/', - scopecss: true, - useSandbox: true, - } - appInstanceMap.set('test-app3', app3 as CreateApp) - - expect(appInstanceMap.size).toBe(3) - - // 模拟非嵌套循环 - releaseUnmountOfNestedApp() - listenUmountOfNestedApp() - - // 模拟嵌套循环 - window.__MICRO_APP_ENVIRONMENT__ = true - releaseUnmountOfNestedApp() - listenUmountOfNestedApp() - - // 模拟当前应用被卸载 - const event = new CustomEvent('unmount') - window.dispatchEvent(event) - - expect(appInstanceMap.size).toBe(0) - - window.__MICRO_APP_ENVIRONMENT__ = false - }) - - // 分支覆盖 - test('coverage of branch', () => { - // test-app4模已卸载孙应用 - const app1 = { - name: 'test-app4', - url: 'http://localhost:3000/', - scopecss: true, - useSandbox: true, - } - appInstanceMap.set('test-app4', app1 as CreateApp) - - // 模拟嵌套循环 - window.__MICRO_APP_ENVIRONMENT__ = true - window.__MICRO_APP_UMD_MODE__ = true // 设置为umd模式 - releaseUnmountOfNestedApp() - listenUmountOfNestedApp() - - // 模拟当前应用被卸载 - const event = new CustomEvent('unmount') - window.dispatchEvent(event) - - // umd模式不清空appInstanceMap - expect(appInstanceMap.size).toBe(1) - }) -}) diff --git a/src/__tests__/sandbox/index.test.ts b/src/__tests__/sandbox/index.test.ts index deae019ab..80bc44dc9 100644 --- a/src/__tests__/sandbox/index.test.ts +++ b/src/__tests__/sandbox/index.test.ts @@ -71,7 +71,7 @@ describe('sandbox', () => { // 一些需要返回 proxyWindow 的变量 test('which keys should return proxyWindow in sandbox', () => { - const proxyWindow = new Sandbox('test-app2', `http://127.0.0.1:${ports.sandbox}/common/`).proxyWindow + const proxyWindow = new Sandbox('test-app2', `http://127.0.0.1:${ports.sandbox}/common/`, true).proxyWindow expect(proxyWindow.window).toBe(proxyWindow) expect(proxyWindow.self).toBe(proxyWindow) // @ts-ignore @@ -90,16 +90,16 @@ describe('sandbox', () => { value: 2, } }) - const proxyWindow = new Sandbox('test-app3', `http://127.0.0.1:${ports.sandbox}/common/`).proxyWindow + const proxyWindow = new Sandbox('test-app3', `http://127.0.0.1:${ports.sandbox}/common/`, true).proxyWindow expect(proxyWindow.top).toBe(1) expect(proxyWindow.parent).toBe(2) }) // 测试强隔离属性 test('scopeProperties should prevent key in rawWidow', () => { - const sandbox = new Sandbox('test-app-scopeProperties', `http://127.0.0.1:${ports.sandbox}/common/`) + const sandbox = new Sandbox('test-app-scopeProperties', `http://127.0.0.1:${ports.sandbox}/common/`, true) - sandbox.start('') + sandbox.start('', true) const proxyWindow: any = sandbox.proxyWindow @@ -151,8 +151,8 @@ describe('sandbox', () => { // 逃离属性可以逃逸到外层真实window上&卸载时清空escapeKeys test('escapeProperties should escape from microAppWindow to rawWindow', () => { - const sandbox = new Sandbox('test-app-escapeProperties', `http://127.0.0.1:${ports.sandbox}/common/`) - sandbox.start('') + const sandbox = new Sandbox('test-app-escapeProperties', `http://127.0.0.1:${ports.sandbox}/common/`, true) + sandbox.start('', true) const proxyWindow: any = sandbox.proxyWindow Object.defineProperties(window, { diff --git a/src/create_app.ts b/src/create_app.ts index 4710dacf7..8d77bfc0f 100644 --- a/src/create_app.ts +++ b/src/create_app.ts @@ -33,8 +33,10 @@ export interface CreateAppParam { ssrUrl?: string scopecss: boolean useSandbox: boolean + useMemoryRouter: boolean inline?: boolean baseroute?: string + keepRouteState?: boolean container?: HTMLElement | ShadowRoot } @@ -56,7 +58,9 @@ export default class CreateApp implements AppInterface { inline: boolean scopecss: boolean useSandbox: boolean - baseroute = '' + useMemoryRouter: boolean + baseroute: string + keepRouteState: boolean source: sourceType sandBox: SandBoxInterface | null = null @@ -68,23 +72,27 @@ export default class CreateApp implements AppInterface { inline, scopecss, useSandbox, + useMemoryRouter, baseroute, + keepRouteState, }: CreateAppParam) { this.container = container ?? null this.inline = inline ?? false this.baseroute = baseroute ?? '' + this.keepRouteState = keepRouteState ?? false this.ssrUrl = ssrUrl ?? '' // optional during init👆 this.name = name this.url = url this.useSandbox = useSandbox this.scopecss = this.useSandbox && scopecss + this.useMemoryRouter = this.useSandbox && useMemoryRouter this.source = { links: new Map(), scripts: new Map(), } this.loadSourceCode() - this.useSandbox && (this.sandBox = new SandBox(name, url)) + this.useSandbox && (this.sandBox = new SandBox(name, url, this.useMemoryRouter)) } // Load resources @@ -132,16 +140,17 @@ export default class CreateApp implements AppInterface { * @param container app container * @param inline js runs in inline mode * @param baseroute route prefix, default is '' + * @param keepRouteState keep route state when unmount, default is false */ mount ( container?: HTMLElement | ShadowRoot, inline?: boolean, baseroute?: string, + keepRouteState?: boolean, ): void { - if (isBoolean(inline) && inline !== this.inline) { - this.inline = inline - } - + if (isBoolean(inline)) this.inline = inline + // keepRouteState effective on unmount + if (isBoolean(keepRouteState)) this.keepRouteState = keepRouteState this.container = this.container ?? container! this.baseroute = baseroute ?? this.baseroute @@ -160,7 +169,7 @@ export default class CreateApp implements AppInterface { cloneContainer(this.source.html as Element, this.container as Element, !this.umdMode) - this.sandBox?.start(this.baseroute) + this.sandBox?.start(this.baseroute, this.useMemoryRouter) let umdHookMountResult: any // result of mount function @@ -230,6 +239,7 @@ export default class CreateApp implements AppInterface { /** * unmount app + * NOTE: Do not add any params on account of unmountApp * @param destroy completely destroy, delete cache resources * @param unmountcb callback of unmount */ @@ -295,7 +305,7 @@ export default class CreateApp implements AppInterface { } // this.container maybe contains micro-app element, stop sandbox should exec after cloneContainer - this.sandBox?.stop() + this.sandBox?.stop(this.keepRouteState) if (!getActiveApps().length) { releasePatchSetAttribute() } @@ -336,12 +346,12 @@ export default class CreateApp implements AppInterface { this.keepAliveState = keepAliveStates.KEEP_ALIVE_HIDDEN // event should dispatch before clone node - // dispatch afterhidden event to micro-app + // dispatch afterHidden event to micro-app dispatchCustomEventToMicroApp('appstate-change', this.name, { appState: 'afterhidden', }) - // dispatch afterhidden event to base app + // dispatch afterHidden event to base app dispatchLifecyclesEvent( oldContainer!, this.name, @@ -351,12 +361,12 @@ export default class CreateApp implements AppInterface { // show app when connectedCallback called with keep-alive showKeepAliveApp (container: HTMLElement | ShadowRoot): void { - // dispatch beforeshow event to micro-app + // dispatch beforeShow event to micro-app dispatchCustomEventToMicroApp('appstate-change', this.name, { appState: 'beforeshow', }) - // dispatch beforeshow event to base app + // dispatch beforeShow event to base app dispatchLifecyclesEvent( container, this.name, @@ -373,12 +383,12 @@ export default class CreateApp implements AppInterface { this.keepAliveState = keepAliveStates.KEEP_ALIVE_SHOW - // dispatch aftershow event to micro-app + // dispatch afterShow event to micro-app dispatchCustomEventToMicroApp('appstate-change', this.name, { appState: 'aftershow', }) - // dispatch aftershow event to base app + // dispatch afterShow event to base app dispatchLifecyclesEvent( this.container, this.name, diff --git a/src/interact/lifecycles_event.ts b/src/interact/lifecycles_event.ts index 8dd30c54b..94084c4da 100644 --- a/src/interact/lifecycles_event.ts +++ b/src/interact/lifecycles_event.ts @@ -1,5 +1,6 @@ import microApp from '../micro_app' import { logError, isFunction, removeDomScope, getRootContainer, assign } from '../libs/utils' +import { formatEventName } from '../sandbox/effect' function formatEventInfo (event: CustomEvent, element: HTMLElement): void { Object.defineProperties(event, { @@ -72,7 +73,7 @@ export function dispatchCustomEventToMicroApp ( appName: string, detail: Record = {}, ): void { - const event = new CustomEvent(`${eventName}-${appName}`, { + const event = new CustomEvent(formatEventName(eventName, appName), { detail, }) window.dispatchEvent(event) diff --git a/src/libs/additional.ts b/src/libs/additional.ts deleted file mode 100644 index 04817a750..000000000 --- a/src/libs/additional.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { appInstanceMap } from '../create_app' -import { getRootContainer } from '../libs/utils' - -function unmountNestedApp (): void { - releaseUnmountOfNestedApp() - - appInstanceMap.forEach(app => { - // @ts-ignore - app.container && getRootContainer(app.container).disconnectedCallback() - }) - - !window.__MICRO_APP_UMD_MODE__ && appInstanceMap.clear() -} - -// if micro-app run in micro application, delete all next generation application when unmount event received -export function listenUmountOfNestedApp (): void { - if (window.__MICRO_APP_ENVIRONMENT__) { - window.addEventListener('unmount', unmountNestedApp, false) - } -} - -// release listener -export function releaseUnmountOfNestedApp (): void { - if (window.__MICRO_APP_ENVIRONMENT__) { - window.removeEventListener('unmount', unmountNestedApp, false) - } -} diff --git a/src/libs/global_env.ts b/src/libs/global_env.ts index 50052b06a..c4403ea1d 100644 --- a/src/libs/global_env.ts +++ b/src/libs/global_env.ts @@ -1,6 +1,6 @@ -import { isSupportModuleScript, isBrowser, getCurrentAppName, assign } from './utils' +import { isSupportModuleScript, isBrowser, getCurrentAppName, assign, getRootContainer } from './utils' import { rejectMicroAppStyle } from '../source/patch' -import { listenUmountOfNestedApp, releaseUnmountOfNestedApp } from '../libs/additional' +import { appInstanceMap } from '../create_app' type RequestIdleCallbackOptions = { timeout: number @@ -34,6 +34,31 @@ declare global { } } +function unmountNestedApp (): void { + appInstanceMap.forEach(app => { + // @ts-ignore + app.container && getRootContainer(app.container).disconnectedCallback() + }) + + !window.__MICRO_APP_UMD_MODE__ && appInstanceMap.clear() +} + +// if micro-app run in micro application, delete all next generation application when unmount event received +// unmount event will auto release by sandbox +export function listenUmountOfNestedApp (): void { + if (window.__MICRO_APP_ENVIRONMENT__) { + releaseUnmountOfNestedApp() + window.addEventListener('unmount', unmountNestedApp, false) + } +} + +// release listener +function releaseUnmountOfNestedApp (): void { + if (window.__MICRO_APP_ENVIRONMENT__) { + window.removeEventListener('unmount', unmountNestedApp, false) + } +} + const globalEnv: Record = {} /** @@ -133,8 +158,6 @@ export function initGlobalEnv (): void { // global effect rejectMicroAppStyle() - releaseUnmountOfNestedApp() - listenUmountOfNestedApp() } } diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 61d7ce7c7..880fe16ed 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -1,5 +1,5 @@ /* eslint-disable no-new-func, indent, @typescript-eslint/explicit-module-boundary-types */ -import type { Func } from '@micro-app/types' +import type { Func, LocationQueryObject, LocationQueryValue } from '@micro-app/types' export const version = '__MICRO_APP_VERSION__' @@ -380,17 +380,61 @@ export function isFireFox (): boolean { return navigator.userAgent.indexOf('Firefox') > -1 } -// this events should be sent to the specified app -const formatEventList = ['unmount', 'appstate-change', 'popstate'] +/** + * Transforms a queryString into object. + * @param search - search string to parse + * @returns a query object + */ +export function parseQuery (search: string): LocationQueryObject { + const result: LocationQueryObject = {} + const queryList = search.split('&') + + // 注意我们不会对key和value进行解码,以确保替换url时前后值一致 + // 我们只对匹配到的微应用的key和value在后续进行编解码 + for (const queryItem of queryList) { + const eqPos = queryItem.indexOf('=') + const key = eqPos < 0 ? queryItem : queryItem.slice(0, eqPos) + const value = eqPos < 0 ? null : queryItem.slice(eqPos + 1) + + if (key in result) { + let currentValue = result[key] + if (!isArray(currentValue)) { + currentValue = result[key] = [currentValue] + } + currentValue.push(value) + } else { + result[key] = value + } + } + + return result +} /** - * Format event name - * @param eventName event name - * @param appName app name + * Transforms an object to query string + * @param queryObject - query object to stringify + * @returns query string without the leading `?` */ -export function formatEventName (eventName: string, appName: string): string { - if (formatEventList.includes(eventName)) { - return `${eventName}-${appName}` +export function stringifyQuery (queryObject: LocationQueryObject): string { + let result = '' + + for (const key in queryObject) { + const value = queryObject[key] + if (isNull(value)) { + result += (result.length ? '&' : '') + key + } else { + const valueList: LocationQueryValue[] = isArray(value) ? value : [value] + + valueList.forEach(value => { + if (!isUndefined(value)) { + result += (result.length ? '&' : '') + key + if (!isNull(value)) result += '=' + value + } + }) + } } - return eventName + + return result } + +export const noop = () => {} diff --git a/src/micro_app.ts b/src/micro_app.ts index 12203b62b..cb173d6b9 100644 --- a/src/micro_app.ts +++ b/src/micro_app.ts @@ -1,7 +1,15 @@ import type { OptionsType, MicroAppConfigType, lifeCyclesType, plugins, fetchType, AppInterface } from '@micro-app/types' import { defineElement } from './micro_app_element' import preFetch, { getGlobalAssets } from './prefetch' -import { logError, logWarn, isFunction, isBrowser, isPlainObject, formatAppName, getRootContainer } from './libs/utils' +import { + logError, + logWarn, + isFunction, + isBrowser, + isPlainObject, + formatAppName, + getRootContainer, +} from './libs/utils' import { EventCenterForBaseApp } from './interact' import { initGlobalEnv } from './libs/global_env' import { appInstanceMap } from './create_app' @@ -35,7 +43,7 @@ export function getAllApps (): string[] { return Array.from(appInstanceMap.keys()) } -export interface unmountAppParams { +type unmountAppOptions = { destroy?: boolean // destroy app, default is false clearAliveState?: boolean // clear keep-alive app state, default is false } @@ -43,10 +51,10 @@ export interface unmountAppParams { /** * unmount app by appName * @param appName - * @param options unmountAppParams + * @param options unmountAppOptions * @returns Promise */ -export function unmountApp (appName: string, options?: unmountAppParams): Promise { +export function unmountApp (appName: string, options?: unmountAppOptions): Promise { const app = appInstanceMap.get(formatAppName(appName)) return new Promise((resolve) => { // eslint-disable-line if (app) { @@ -87,6 +95,7 @@ export function unmountApp (appName: string, options?: unmountAppParams): Promis container.setAttribute('destroy', 'true') container.parentNode!.removeChild(container) + container.removeAttribute('destroy') typeof destroyAttrValue === 'string' && container.setAttribute('destroy', destroyAttrValue) @@ -110,7 +119,7 @@ export function unmountApp (appName: string, options?: unmountAppParams): Promis } // unmount all apps in turn -export function unmountAllApps (options?: unmountAppParams): Promise { +export function unmountAllApps (options?: unmountAppOptions): Promise { return Array.from(appInstanceMap.keys()).reduce((pre, next) => pre.then(() => unmountApp(next, options)), Promise.resolve()) } @@ -121,6 +130,7 @@ export class MicroApp extends EventCenterForBaseApp implements MicroAppConfigTyp inline?: boolean disableScopecss?: boolean disableSandbox?: boolean + disableMemoryRouter?: boolean ssr?: boolean lifeCycles?: lifeCyclesType plugins?: plugins @@ -157,6 +167,7 @@ export class MicroApp extends EventCenterForBaseApp implements MicroAppConfigTyp this.inline = options.inline this.disableScopecss = options.disableScopecss this.disableSandbox = options.disableSandbox + this.disableMemoryRouter = options.disableMemoryRouter this.ssr = options.ssr isFunction(options.fetch) && (this.fetch = options.fetch) diff --git a/src/micro_app_element.ts b/src/micro_app_element.ts index bcc4c0e3f..5dec7929c 100644 --- a/src/micro_app_element.ts +++ b/src/micro_app_element.ts @@ -70,11 +70,18 @@ export function defineElement (tagName: string): void { disconnectedCallback (): void { this.hasConnected = false - // keep-alive - if (this.getKeepAliveModeResult()) { - this.handleHiddenKeepAliveApp() - } else { - this.handleUnmount(this.getDestroyCompatibleResult()) + const app = appInstanceMap.get(this.appName) + if ( + app && + app.getAppState() !== appStates.UNMOUNT && + app.getKeepAliveState() !== keepAliveStates.KEEP_ALIVE_HIDDEN + ) { + // keep-alive + if (this.getKeepAliveModeResult()) { + this.handleHiddenKeepAliveApp() + } else { + this.handleUnmount(this.getDestroyCompatibleResult()) + } } } @@ -288,6 +295,7 @@ export function defineElement (tagName: string): void { this.shadowRoot ?? this, this.getDisposeResult('inline'), this.getBaseRouteCompatible(), + this.getDisposeResult('keep-route-state'), )) } @@ -309,7 +317,9 @@ export function defineElement (tagName: string): void { inline: this.getDisposeResult('inline'), scopecss: !(this.getDisposeResult('disableScopecss') || this.getDisposeResult('shadowDOM')), useSandbox: !this.getDisposeResult('disableSandbox'), + useMemoryRouter: !this.getDisposeResult('disable-memory-router'), baseroute: this.getBaseRouteCompatible(), + keepRouteState: this.getDisposeResult('keep-route-state'), }) appInstanceMap.set(this.appName, instance) @@ -324,7 +334,12 @@ export function defineElement (tagName: string): void { if ( app && app.getAppState() !== appStates.UNMOUNT - ) app.unmount(destroy, unmountcb) + ) { + app.unmount( + destroy, + unmountcb, + ) + } } // hidden app when disconnectedCallback called with keep-alive diff --git a/src/prefetch.ts b/src/prefetch.ts index e0e0e954a..faec93ffa 100644 --- a/src/prefetch.ts +++ b/src/prefetch.ts @@ -24,12 +24,13 @@ import microApp from './micro_app' * url: string, * disableScopecss?: boolean, * disableSandbox?: boolean, + * disableMemoryRouter?: boolean, * }, * ... * ]) * Note: * 1: preFetch is asynchronous and is performed only when the browser is idle - * 2: disableScopecss, disableSandbox must be same with micro-app element, if conflict, the one who executes first shall prevail + * 2: disableScopecss, disableSandbox, disableMemoryRouter must be same with micro-app element, if conflict, the one who executes first shall prevail * @param apps micro apps */ export default function preFetch (apps: prefetchParamList): void { @@ -58,6 +59,7 @@ function preFetchInSerial (prefetchApp: prefetchParam): Promise { url: prefetchApp.url, scopecss: !(prefetchApp.disableScopecss ?? microApp.disableScopecss), useSandbox: !(prefetchApp.disableSandbox ?? microApp.disableSandbox), + useMemoryRouter: !(prefetchApp.disableMemoryRouter ?? microApp.disableMemoryRouter), }) app.isPrefetch = true diff --git a/src/sandbox/router.ts b/src/sandbox/__save__router.ts similarity index 79% rename from src/sandbox/router.ts rename to src/sandbox/__save__router.ts index aafe1802e..807fef1c2 100644 --- a/src/sandbox/router.ts +++ b/src/sandbox/__save__router.ts @@ -1,3 +1,4 @@ +/* eslint-disable */ import type { MicroRouter, MicroLocation, @@ -11,7 +12,6 @@ import type { import globalEnv from '../libs/global_env' import { assign as oAssign, - formatEventName, isArray, isNull, isString, @@ -19,21 +19,8 @@ import { logError, } from '../libs/utils' import { appInstanceMap } from '../create_app' - -// 更新url地址有以下几种情况: -// 1、页面初始化 -// 2、子应用页面内部发生跳转 -// 3、通过micro-app api进行跳转 - -// 更新location有以下几种情况,根据url地址进行更新: -// 1、页面初始化 -// 2、子应用页面内部发生跳转 -// 3、通过micro-app api进行跳转 -// 4、popstate事件 -// const { pathname, search, hash } = location -// pathname + search + hash -// 如果有hash,则参数加在hash后面(默认为hash路由),如果没有hash,则加在query上(默认history路由) -// 特殊情况:history路由有hash,hash路由没有hash -- 不管 +import { getActiveApps } from '../micro_app' +import { formatEventName } from './effect' type PopStateListener = (this: Window, e: PopStateEvent) => void @@ -43,23 +30,26 @@ type PopStateListener = (this: Window, e: PopStateEvent) => void * @param appName app name * @returns release callback */ - export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { +export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { // Send to the child app after receiving the popstate event const popStateHandler: PopStateListener = (e: PopStateEvent): void => { - // 先更新location,再发送popstate事件 - const microPath = getMicroPathFromURL(appName) - const app = appInstanceMap.get(appName) - if (microPath && app) { - // @ts-ignore - updateLocation(microPath, app.url, app.sandBox.proxyWindow.location) - // @ts-ignore - console.log(333333, microPath, app.sandBox.proxyWindow.location) + const activeApps = getActiveApps(true) + if (activeApps.includes(appName)) { + // 先更新location,再发送popstate事件 + const microPath = getMicroPathFromURL(appName) + if (microPath) { + const app = appInstanceMap.get(appName) + // @ts-ignore + updateLocation(microPath, app.url, app.sandBox.proxyWindow.location) + // @ts-ignore + console.log(333333, microPath, app.sandBox.proxyWindow.location) + } + // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 + const state = getMicroState(appName, e.state) + rawWindow.dispatchEvent( + new PopStateEvent(formatEventName('popstate', appName), { state }) + ) } - // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 - const state = getMicroState(appName, e.state) - rawWindow.dispatchEvent( - new PopStateEvent(formatEventName('popstate', appName), { state }) - ) } rawWindow.addEventListener('popstate', popStateHandler) @@ -169,11 +159,16 @@ function commonDecode (path: string): string { } } +// 格式化query参数key,防止与原有参数的冲突 +function formatQueryAppName (appName: string) { + return `app-${appName}` +} + // 根据浏览器url参数,获取当前子应用的fullPath function getMicroPathFromURL (appName: string): string | null { const rawLocation = globalEnv.rawWindow.location const queryObject = getQueryObjectFromURL(rawLocation.search, rawLocation.hash) - const microPath = queryObject.hashQuery?.[appName] || queryObject.searchQuery?.[appName] + const microPath = queryObject.hashQuery?.[formatQueryAppName(appName)] || queryObject.searchQuery?.[formatQueryAppName(appName)] // 解码 return microPath ? decodeMicroPath(microPath as string) : null } @@ -191,20 +186,20 @@ function attachMicroQueryToURL (appName: string, microLocation: MicroLocation): // hash存在且search不存在,则认为是hash路由 if (hash && !search) { if (microQueryObject.hashQuery) { - microQueryObject.hashQuery[appName] = encodedMicroPath + microQueryObject.hashQuery[formatQueryAppName(appName)] = encodedMicroPath } else { microQueryObject.hashQuery = { - [appName]: encodedMicroPath + [formatQueryAppName(appName)]: encodedMicroPath } } const baseHash = hash.includes('?') ? hash.slice(0, hash.indexOf('?') + 1) : hash + '?' hash = baseHash + stringifyQuery(microQueryObject.hashQuery) } else { if (microQueryObject.searchQuery) { - microQueryObject.searchQuery[appName] = encodedMicroPath + microQueryObject.searchQuery[formatQueryAppName(appName)] = encodedMicroPath } else { microQueryObject.searchQuery = { - [appName]: encodedMicroPath + [formatQueryAppName(appName)]: encodedMicroPath } } search = '?' + stringifyQuery(microQueryObject.searchQuery) @@ -218,12 +213,12 @@ function removeMicroQueryFromURL (appName: string): string { let { pathname, search, hash } = globalEnv.rawWindow.location const microQueryObject = getQueryObjectFromURL(search, hash) - if (microQueryObject.hashQuery?.[appName]) { - delete microQueryObject.hashQuery?.[appName] + if (microQueryObject.hashQuery?.[formatQueryAppName(appName)]) { + delete microQueryObject.hashQuery?.[formatQueryAppName(appName)] const hashQueryStr = stringifyQuery(microQueryObject.hashQuery) hash = hash.slice(0, hash.indexOf('?') + Number(Boolean(hashQueryStr))) + hashQueryStr - } else if (microQueryObject.searchQuery?.[appName]) { - delete microQueryObject.searchQuery?.[appName] + } else if (microQueryObject.searchQuery?.[formatQueryAppName(appName)]) { + delete microQueryObject.searchQuery?.[formatQueryAppName(appName)] const searchQueryStr = stringifyQuery(microQueryObject.searchQuery) search = searchQueryStr ? '?' + searchQueryStr : '' } @@ -341,37 +336,33 @@ function updateBrowserURL (state: MicroState, fullPath: string): void { } // 当沙箱执行start, 或者隐藏的keep-alive应用重新渲染时时才:根据浏览器url更新location 或者 将参数更新到url上 -export function initialActionForRoute (appName: string, url: string, microLocation: MicroLocation) { +export function initRouteStateWithURL (appName: string, url: string, microLocation: MicroLocation) { const microPath = getMicroPathFromURL(appName) // 如果初始化时参数有子应用的数据信息,则直接复用,如果没有则重新创建 if (microPath) { updateLocation(microPath, url, microLocation) } else { - const fullPath = attachMicroQueryToURL(appName, microLocation) - // 下面需要优化,代码太繁琐了 - const rawHistory = globalEnv.rawWindow.history - const historyState = createMicroState(appName, rawHistory.state, getMicroState(appName, rawHistory.state)) - updateBrowserURL(historyState, fullPath) + updateBrowserURL(globalEnv.rawWindow.history.state, attachMicroQueryToURL(appName, microLocation)) } } -export function clearRouterStateFromURL (appName: string, url: string, microLocation: MicroLocation) { +export function clearRouteStateFromURL (appName: string, url: string, microLocation: MicroLocation) { // 初始化location信息 const { pathname, search, hash } = new URL(url) updateLocation(pathname + search + hash, url, microLocation) // 删除浏览器url上的子应用参数 - const fullPath = removeMicroQueryFromURL(appName) - const rawHistory = globalEnv.rawWindow.history - const historyState = deleteMicroState(appName, rawHistory.state) - updateBrowserURL(historyState, fullPath) + updateBrowserURL( + deleteMicroState(appName, globalEnv.rawWindow.history.state), + removeMicroQueryFromURL(appName), + ) } export default function createMicroRouter (appName: string, url: string): MicroRouter { const microLocation = createMicroLocation(url) return { - location: microLocation, - history: createMicroHistory(appName, url, microLocation), + microLocation, + microHistory: createMicroHistory(appName, url, microLocation), } } diff --git a/src/sandbox/effect.ts b/src/sandbox/effect.ts index 8f85610c9..e3f79207b 100644 --- a/src/sandbox/effect.ts +++ b/src/sandbox/effect.ts @@ -6,11 +6,9 @@ import { isFunction, isBoundFunction, rawDefineProperty, - formatEventName, } from '../libs/utils' import { appInstanceMap } from '../create_app' import globalEnv from '../libs/global_env' -import { addHistoryListener } from './router' type MicroEventListener = EventListenerOrEventListenerObject & Record type timeInfo = { @@ -19,6 +17,27 @@ type timeInfo = { args: any[], } +// this events should be sent to the specified app +const formatEventList = ['unmount', 'appstate-change'] + +/** + * Format event name + * @param eventName event name + * @param appName app name + */ +export function formatEventName (eventName: string, appName: string): string { + if ( + formatEventList.includes(eventName) || + ( + eventName === 'popstate' && + appInstanceMap.get(appName)?.useMemoryRouter + ) + ) { + return `${eventName}-${appName}` + } + return eventName +} + // document.onclick binding list, the binding function of each application is unique const documentClickListMap = new Map() let hasRewriteDocumentOnClick = false @@ -279,12 +298,8 @@ export default function effect (microAppWindow: microAppWindowType): Record { - removeHistoryListener() // Clear window binding events if (eventListenerMap.size) { eventListenerMap.forEach((listenerList, type) => { diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 0e51656e5..218c7c097 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -1,8 +1,17 @@ -import type { microAppWindowType, SandBoxInterface, plugins, MicroLocation } from '@micro-app/types' +import type { + microAppWindowType, + SandBoxInterface, + plugins, + MicroLocation, +} from '@micro-app/types' import { - EventCenterForMicroApp, rebuildDataCenterSnapshot, recordDataCenterSnapshot + EventCenterForMicroApp, + rebuildDataCenterSnapshot, + recordDataCenterSnapshot, } from '../interact' -import globalEnv from '../libs/global_env' +import globalEnv, { + listenUmountOfNestedApp, +} from '../libs/global_env' import { getEffectivePath, isArray, @@ -28,7 +37,11 @@ import { patchElementPrototypeMethods, releasePatches, } from '../source/patch' -import createMicroRouter, { initialActionForRoute, clearRouterStateFromURL } from './router' +import createMicroRouter, { + initRouteStateWithURL, + clearRouteStateFromURL, + addHistoryListener, +} from './router' export type MicroAppWindowDataType = { __MICRO_APP_ENVIRONMENT__: boolean @@ -64,6 +77,7 @@ export default class SandBox implements SandBoxInterface { private recordUmdEffect!: CallableFunction private rebuildUmdEffect!: CallableFunction private releaseEffect!: CallableFunction + private removeHistoryListener!: CallableFunction /** * Scoped global Properties(Properties that can only get and set in microAppWindow, will not escape to rawWindow) * https://github.com/micro-zoe/micro-app/issues/234 @@ -82,32 +96,41 @@ export default class SandBox implements SandBoxInterface { proxyWindow: WindowProxy & MicroAppWindowDataType // Proxy microAppWindow = {} as MicroAppWindowType // Proxy target - constructor (appName: string, url: string) { + constructor (appName: string, url: string, useMemoryRouter = true) { // get scopeProperties and escapeProperties from plugins this.getSpecialProperties(appName) // create proxyWindow with Proxy(microAppWindow) this.proxyWindow = this.createProxyWindow(appName) // inject global properties - this.initMicroAppWindow(this.microAppWindow, appName, url) + this.initMicroAppWindow(this.microAppWindow, appName, url, useMemoryRouter) // Rewrite global event listener & timeout assign(this, effect(this.microAppWindow)) } - public start (baseRoute: string): void { + public start (baseRoute: string, useMemoryRouter = true): void { if (!this.active) { this.active = true - this.initRouteState() - this.microAppWindow.__MICRO_APP_BASE_ROUTE__ = this.microAppWindow.__MICRO_APP_BASE_URL__ = baseRoute - // BUG FIX: bable-polyfill@6.x - globalEnv.rawWindow._babelPolyfill && (globalEnv.rawWindow._babelPolyfill = false) + if (useMemoryRouter) { + this.initRouteState() + // unique listener of popstate event for sub app + this.removeHistoryListener = addHistoryListener( + globalEnv.rawWindow, + this.proxyWindow.__MICRO_APP_NAME__, + ) + } else { + this.microAppWindow.__MICRO_APP_BASE_ROUTE__ = this.microAppWindow.__MICRO_APP_BASE_URL__ = baseRoute + } if (++SandBox.activeCount === 1) { effectDocumentEvent() patchElementPrototypeMethods() + listenUmountOfNestedApp() } + // BUG FIX: bable-polyfill@6.x + globalEnv.rawWindow._babelPolyfill && (globalEnv.rawWindow._babelPolyfill = false) } } - public stop (keepRouteState?: boolean): void { + public stop (keepRouteState = false): void { if (this.active) { this.releaseEffect() this.microAppWindow.microApp.clearDataListener() @@ -123,7 +146,12 @@ export default class SandBox implements SandBoxInterface { }) this.escapeKeys.clear() - if (!keepRouteState) this.clearRouteState() + if (this.removeHistoryListener) { + if (!keepRouteState) this.clearRouteState() + // release listener of popstate + this.removeHistoryListener() + } + if (--SandBox.activeCount === 0) { releaseEffectDocumentEvent() releasePatches() @@ -153,22 +181,6 @@ export default class SandBox implements SandBoxInterface { rebuildDataCenterSnapshot(this.microAppWindow.microApp) } - public initRouteState (): void { - initialActionForRoute( - this.proxyWindow.__MICRO_APP_NAME__, - this.proxyWindow.__MICRO_APP_URL__, - this.proxyWindow.location as MicroLocation, - ) - } - - public clearRouteState (): void { - clearRouterStateFromURL( - this.proxyWindow.__MICRO_APP_NAME__, - this.proxyWindow.__MICRO_APP_URL__, - this.proxyWindow.location as MicroLocation, - ) - } - /** * get scopeProperties and escapeProperties from plugins * @param appName app name @@ -306,7 +318,12 @@ export default class SandBox implements SandBoxInterface { * @param appName app name * @param url app url */ - private initMicroAppWindow (microAppWindow: microAppWindowType, appName: string, url: string): void { + private initMicroAppWindow ( + microAppWindow: microAppWindowType, + appName: string, + url: string, + useMemoryRouter: boolean, + ): void { microAppWindow.__MICRO_APP_ENVIRONMENT__ = true microAppWindow.__MICRO_APP_NAME__ = appName microAppWindow.__MICRO_APP_URL__ = url @@ -321,7 +338,7 @@ export default class SandBox implements SandBoxInterface { microAppWindow.hasOwnProperty = (key: PropertyKey) => rawHasOwnProperty.call(microAppWindow, key) || rawHasOwnProperty.call(globalEnv.rawWindow, key) this.setMappingPropertiesWithRawDescriptor(microAppWindow) this.setHijackProperties(microAppWindow, appName) - this.setRouterApi(microAppWindow, appName, url) + if (useMemoryRouter) this.setRouterApi(microAppWindow, appName, url) } // properties associated with the native window @@ -405,14 +422,15 @@ export default class SandBox implements SandBoxInterface { }) } + // set location & history for memory router private setRouterApi (microAppWindow: microAppWindowType, appName: string, url: string): void { - const { location, history } = createMicroRouter(appName, url) + const { microLocation, microHistory } = createMicroRouter(appName, url) rawDefineProperties(microAppWindow, { location: { configurable: false, enumerable: true, get () { - return location + return microLocation }, set: (value) => { globalEnv.rawWindow.location = value @@ -422,9 +440,25 @@ export default class SandBox implements SandBoxInterface { configurable: true, enumerable: true, get () { - return history + return microHistory }, }, }) } + + private initRouteState (): void { + initRouteStateWithURL( + this.proxyWindow.__MICRO_APP_NAME__, + this.proxyWindow.__MICRO_APP_URL__, + this.proxyWindow.location as MicroLocation, + ) + } + + private clearRouteState (): void { + clearRouteStateFromURL( + this.proxyWindow.__MICRO_APP_NAME__, + this.proxyWindow.__MICRO_APP_URL__, + this.proxyWindow.location as MicroLocation, + ) + } } diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts new file mode 100644 index 000000000..5a8095d26 --- /dev/null +++ b/src/sandbox/router/core.ts @@ -0,0 +1,148 @@ +import type { + MicroLocation, + MicroState, + LocationQuery, +} from '@micro-app/types' +import globalEnv from '../../libs/global_env' +import { + assign, + parseQuery, + stringifyQuery, +} from '../../libs/utils' + +// set micro app state to origin state +export function createMicroState ( + appName: string, + rawState: MicroState, + microState: MicroState, +): MicroState { + // 生成新的microAppState,因为它们在第二层 + const newMicroAppState = assign({}, rawState?.microAppState, { + [appName]: microState + }) + // 生成新的state对象 + return assign({}, rawState, { + microAppState: newMicroAppState + }) +} + +// get micro app state form origin state +export function getMicroState (appName: string, state: MicroState): MicroState { + return state?.microAppState?.[appName] || null +} + +// delete micro app state form origin state +export function deleteMicroState (appName: string, rawState: MicroState): MicroState { + if (rawState?.microAppState?.[appName]) { + delete rawState.microAppState[appName] + } + // 生成新的state对象 + return assign({}, rawState) +} + +const ENC_AD_RE = /&/g // %M1 +const ENC_EQ_RE = /=/g // %M2 +const DEC_AD_RE = /%M1/g // & +const DEC_EQ_RE = /%M2/g // = + +function encodeMicroPath (path: string): string { + return encodeURIComponent(commonDecode(path).replace(ENC_AD_RE, '%M1').replace(ENC_EQ_RE, '%M2')) +} + +function decodeMicroPath (path: string): string { + return commonDecode(path).replace(DEC_AD_RE, '&').replace(DEC_EQ_RE, '=') +} + +function commonDecode (path: string): string { + try { + const decPath = decodeURIComponent(path) + if (path === decPath || DEC_AD_RE.test(decPath) || DEC_EQ_RE.test(decPath)) return decPath + return commonDecode(decPath) + } catch { + return path + } +} + +/** + * 根据location获取query对象 + */ +function getQueryObjectFromURL (search: string, hash: string): LocationQuery { + const queryObject: LocationQuery = {} + + if (search !== '' && search !== '?') { + queryObject.searchQuery = parseQuery(search.slice(1)) + } + + if (hash.includes('?')) { + queryObject.hashQuery = parseQuery(hash.slice(hash.indexOf('?') + 1)) + } + + return queryObject +} + +// 格式化query参数key,防止与原有参数的冲突 +function formatQueryAppName (appName: string) { + return `app-${appName}` +} + +// 根据浏览器url参数,获取当前子应用的path +export function getMicroPathFromURL (appName: string): string | null { + const rawLocation = globalEnv.rawWindow.location + const queryObject = getQueryObjectFromURL(rawLocation.search, rawLocation.hash) + const microPath = queryObject.hashQuery?.[formatQueryAppName(appName)] || queryObject.searchQuery?.[formatQueryAppName(appName)] + // 解码 + return microPath ? decodeMicroPath(microPath as string) : null +} + +// 将name=encodeUrl地址插入到浏览器url上 +export function setMicroPathToURL (appName: string, microLocation: MicroLocation): string { + let { pathname, search, hash } = globalEnv.rawWindow.location + const queryObject = getQueryObjectFromURL(search, hash) + const encodedMicroPath = encodeMicroPath( + microLocation.pathname + + microLocation.search + + microLocation.hash + ) + + // hash存在且search不存在,则认为是hash路由 + if (hash && !search) { + if (queryObject.hashQuery) { + queryObject.hashQuery[formatQueryAppName(appName)] = encodedMicroPath + } else { + queryObject.hashQuery = { + [formatQueryAppName(appName)]: encodedMicroPath + } + } + const baseHash = hash.includes('?') ? hash.slice(0, hash.indexOf('?') + 1) : hash + '?' + hash = baseHash + stringifyQuery(queryObject.hashQuery) + } else { + if (queryObject.searchQuery) { + queryObject.searchQuery[formatQueryAppName(appName)] = encodedMicroPath + } else { + queryObject.searchQuery = { + [formatQueryAppName(appName)]: encodedMicroPath + } + } + search = '?' + stringifyQuery(queryObject.searchQuery) + } + + return pathname + search + hash +} + +// 将name=encodeUrl的参数从浏览器url上删除 +export function removeMicroPathFromURL (appName: string): string { + let { pathname, search, hash } = globalEnv.rawWindow.location + const queryObject = getQueryObjectFromURL(search, hash) + + if (queryObject.hashQuery?.[formatQueryAppName(appName)]) { + delete queryObject.hashQuery?.[formatQueryAppName(appName)] + const hashQueryStr = stringifyQuery(queryObject.hashQuery) + hash = hash.slice(0, hash.indexOf('?') + Number(Boolean(hashQueryStr))) + hashQueryStr + } else if (queryObject.searchQuery?.[formatQueryAppName(appName)]) { + delete queryObject.searchQuery?.[formatQueryAppName(appName)] + const searchQueryStr = stringifyQuery(queryObject.searchQuery) + search = searchQueryStr ? '?' + searchQueryStr : '' + } + + return pathname + search + hash +} diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts new file mode 100644 index 000000000..967193955 --- /dev/null +++ b/src/sandbox/router/event.ts @@ -0,0 +1,42 @@ +import { appInstanceMap } from '../../create_app' +import { getActiveApps } from '../../micro_app' +import { formatEventName } from '../effect' +import { getMicroPathFromURL, getMicroState } from './core' +import { updateLocation } from './location' + +type PopStateListener = (this: Window, e: PopStateEvent) => void + +/** + * register & release popstate event + * @param rawWindow origin window + * @param appName app name + * @returns release callback + */ +export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { + // Send to the child app after receiving the popstate event + const popStateHandler: PopStateListener = (e: PopStateEvent): void => { + const activeApps = getActiveApps(true) + if (activeApps.includes(appName)) { + // 先更新location,再发送popstate事件 + const microPath = getMicroPathFromURL(appName) + if (microPath) { + const app = appInstanceMap.get(appName) + // @ts-ignore + updateLocation(microPath, app.url, app.sandBox.proxyWindow.location) + // @ts-ignore + // console.log(333333, microPath, app.sandBox.proxyWindow.location) + } + // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 + const state = getMicroState(appName, e.state) + rawWindow.dispatchEvent( + new PopStateEvent(formatEventName('popstate', appName), { state }) + ) + } + } + + rawWindow.addEventListener('popstate', popStateHandler) + + return () => { + rawWindow.removeEventListener('popstate', popStateHandler) + } +} diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts new file mode 100644 index 000000000..22f50ec80 --- /dev/null +++ b/src/sandbox/router/history.ts @@ -0,0 +1,69 @@ +import type { + MicroState, + MicroLocation, + MicroHistory, + HistoryProxyValue, +} from '@micro-app/types' +import globalEnv from '../../libs/global_env' +import { + isString, + logError, +} from '../../libs/utils' +import { updateLocation } from './location' +import { setMicroPathToURL, createMicroState, getMicroState } from './core' + +// history of micro app +export function createMicroHistory ( + appName: string, + base: string, + microLocation: MicroLocation, +): MicroHistory { + const rawHistory = globalEnv.rawWindow.history + + // 是否需要在每次调用时都创建一个函数?这样看起来麻烦,但是是函数式编程,看起来更优雅 + // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 + function microHistoryMethod (methodName: PropertyKey): CallableFunction { + return (...rests: any[]) => { + // console.log(444444444, rests[0], rests[1], rests[2], methodName) + let targetPath = null + // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! + if ((methodName === 'pushState' || methodName === 'replaceState') && rests[2] && isString(rests[2])) { + try { + const targetLocation = new URL(rests[2], base) as MicroLocation + if (targetLocation.origin === microLocation.origin) { + targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash + // 经过格式化后的,包含某个微应用state的全量state + const newState = createMicroState(appName, rawHistory.state, rests[0]) + rests = [newState, rests[1], setMicroPathToURL(appName, targetLocation)] + } + } catch (e) { + logError(e, appName) + } + } + + rawHistory[methodName](...rests) + + if (targetPath) updateLocation(targetPath, base, microLocation) + + // console.log(5555555, microLocation, base) + } + } + + const microHistory = new Proxy(rawHistory, { + get (target: Record, key: PropertyKey): HistoryProxyValue { + if (key === 'state') { + return getMicroState(appName, rawHistory.state) + } else if (typeof Reflect.get(target, key) === 'function') { + return microHistoryMethod(key) + } + return Reflect.get(target, key) + }, + }) + + return microHistory +} + +// 更新浏览器url +export function updateBrowserURL (state: MicroState, fullPath: string): void { + globalEnv.rawWindow.history.replaceState(state, null, fullPath) +} diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts new file mode 100644 index 000000000..7916fc324 --- /dev/null +++ b/src/sandbox/router/index.ts @@ -0,0 +1,59 @@ +import type { + MicroRouter, + MicroLocation, +} from '@micro-app/types' +import globalEnv from '../../libs/global_env' +import { + getMicroPathFromURL, + setMicroPathToURL, + removeMicroPathFromURL, + deleteMicroState, +} from './core' +import { + createMicroLocation, + updateLocation, +} from './location' +import { + createMicroHistory, + updateBrowserURL, +} from './history' + +export { addHistoryListener } from './event' + +// 当沙箱执行start, 或者隐藏的keep-alive应用重新渲染时时才:根据浏览器url更新location 或者 将参数更新到url上 +export function initRouteStateWithURL ( + appName: string, + url: string, + microLocation: MicroLocation, +): void { + const microPath = getMicroPathFromURL(appName) + if (microPath) { + updateLocation(microPath, url, microLocation) + } else { + updateBrowserURL(globalEnv.rawWindow.history.state, setMicroPathToURL(appName, microLocation)) + } +} + +export function clearRouteStateFromURL ( + appName: string, + url: string, + microLocation: MicroLocation, +): void { + // 初始化location信息 + const { pathname, search, hash } = new URL(url) + updateLocation(pathname + search + hash, url, microLocation) + // 删除浏览器url上的子应用参数 + updateBrowserURL( + deleteMicroState(appName, globalEnv.rawWindow.history.state), + removeMicroPathFromURL(appName), + ) +} + +export default function createMicroRouter (appName: string, url: string): MicroRouter { + const microLocation = createMicroLocation(url) + + return { + microLocation, + microHistory: createMicroHistory(appName, url, microLocation), + } +} diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts new file mode 100644 index 000000000..b9fc0797e --- /dev/null +++ b/src/sandbox/router/location.ts @@ -0,0 +1,47 @@ +import type { MicroLocation } from '@micro-app/types' +import globalEnv from '../../libs/global_env' +import { + assign as oAssign, +} from '../../libs/utils' + +// location of micro app +// 只会在沙箱初始化时执行一次 +export function createMicroLocation (url: string): MicroLocation { + const rawLocation = globalEnv.rawWindow.location + const microLocation = new URL(url) as MicroLocation + + function assign (url: string | URL): void { + rawLocation.assign(url) + } + + function replace (url: string | URL): void { + rawLocation.replace(url) + } + + function reload (forcedReload?: boolean): void { + // @ts-ignore + rawLocation.reload(forcedReload) + } + + oAssign(microLocation, { + assign, + replace, + reload + }) + + return microLocation +} + +// origin is readonly, so we ignore it +const LocationKeys = ['hash', 'host', 'hostname', 'href', 'password', 'pathname', 'port', 'protocol', 'search'] +export function updateLocation ( + path: string, + base: string, + microLocation: MicroLocation, +): void { + const newLocation = new URL(path, base) + for (const key of LocationKeys) { + // @ts-ignore + microLocation[key] = newLocation[key] + } +} diff --git a/src/source/patch.ts b/src/source/patch.ts index 5ca3e7d50..2d5ad0186 100644 --- a/src/source/patch.ts +++ b/src/source/patch.ts @@ -303,6 +303,7 @@ function patchDocument () { const appName = getCurrentAppName() if ( !appName || + !appInstanceMap.get(appName)?.container || !selectors || isUniqueElement(selectors) || // see https://github.com/micro-zoe/micro-app/issues/56 @@ -310,6 +311,7 @@ function patchDocument () { ) { return globalEnv.rawQuerySelector.call(this, selectors) } + return appInstanceMap.get(appName)?.container?.querySelector(selectors) ?? null } @@ -317,12 +319,14 @@ function patchDocument () { const appName = getCurrentAppName() if ( !appName || + !appInstanceMap.get(appName)?.container || !selectors || isUniqueElement(selectors) || rawDocument !== this ) { return globalEnv.rawQuerySelectorAll.call(this, selectors) } + return appInstanceMap.get(appName)?.container?.querySelectorAll(selectors) ?? [] } diff --git a/typings/global.d.ts b/typings/global.d.ts index ba92a7c98..39c415f40 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -8,8 +8,8 @@ declare module '@micro-app/types' { interface SandBoxInterface { proxyWindow: WindowProxy microAppWindow: Window // Proxy target - start (baseRoute: string): void - stop (): void + start (baseRoute: string, useMemoryRouter: boolean): void + stop (keepRouteState: boolean): void // record umd snapshot before the first execution of umdHookMount recordUmdSnapshot (): void // rebuild umd snapshot before remount umd app @@ -50,7 +50,9 @@ declare module '@micro-app/types' { inline: boolean // whether js runs in inline script mode, default is false scopecss: boolean // whether use css scoped, default is true useSandbox: boolean // whether use js sandbox, default is true + useMemoryRouter: boolean // whether use memoryRouter, default is true baseroute: string // route prefix, default is '' + keepRouteState: boolean // keep route state when unmount, default is false source: sourceType // sources of css, js, html sandBox: SandBoxInterface | null // sandbox umdMode: boolean // is umd mode @@ -69,6 +71,7 @@ declare module '@micro-app/types' { container?: HTMLElement | ShadowRoot, inline?: boolean, baseroute?: string, + keepRouteState?: boolean, ): void // unmount app @@ -111,6 +114,7 @@ declare module '@micro-app/types' { url: string, disableScopecss?: boolean disableSandbox?: boolean + disableMemoryRouter?: boolean shadowDOM?: boolean } @@ -168,6 +172,7 @@ declare module '@micro-app/types' { inline?: boolean disableScopecss?: boolean disableSandbox?: boolean + disableMemoryRouter?: boolean ssr?: boolean lifeCycles?: lifeCyclesType preFetchApps?: prefetchParamList @@ -184,6 +189,7 @@ declare module '@micro-app/types' { inline?: boolean disableScopecss?: boolean disableSandbox?: boolean + disableMemoryRouter?: boolean ssr?: boolean lifeCycles?: lifeCyclesType plugins?: plugins @@ -211,8 +217,8 @@ declare module '@micro-app/types' { 'replaceState' > | CallableFunction interface MicroRouter { - location: MicroLocation - history: MicroHistory + microLocation: MicroLocation + microHistory: MicroHistory } type LocationQueryValue = string | null type LocationQueryObject = Record< From be5bb391d700a68bb494ecf3519c3af69bc54f12 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 16 Mar 2022 18:01:15 +0800 Subject: [PATCH 007/268] feat: update router at 3.16 --- .eslintignore | 1 - dev/children/react16/src/index.js | 9 ++++++ docs/zh-cn/dom-scope.md | 38 +++++++++++++++++++++++-- src/libs/utils.ts | 3 +- src/sandbox/router/core.ts | 47 +++++++++++++++---------------- src/sandbox/router/history.ts | 21 +++++++------- src/sandbox/router/index.ts | 3 ++ src/sandbox/router/location.ts | 5 ++-- 8 files changed, 84 insertions(+), 43 deletions(-) diff --git a/.eslintignore b/.eslintignore index f4d9ae8bf..aa9977beb 100755 --- a/.eslintignore +++ b/.eslintignore @@ -6,4 +6,3 @@ node_modules /docs /plugins /src/__tests__/demos -/src/sandbox/router.ts diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index 38d02f3b2..40279f3fc 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -258,3 +258,12 @@ if (window.__MICRO_APP_ENVIRONMENT__) { unBoundDom2.innerHTML = 'unBoundDom2' document.body.appendChild(unBoundDom2) } + +// 注意:!!!! 无论任何使用window.xx的情况都会重新触发元素绑定 +const _window = new Function('return window')() + +setTimeout(() => { + // window.microApp.removeDomScope() + console.log(_window.document.getElementById('root')) +}, 0) + diff --git a/docs/zh-cn/dom-scope.md b/docs/zh-cn/dom-scope.md index 8af80108a..ee1711825 100644 --- a/docs/zh-cn/dom-scope.md +++ b/docs/zh-cn/dom-scope.md @@ -11,7 +11,10 @@ 这一点和ShadowDom不同,在微前端下基座拥有统筹全局的作用,所以我们没有对基座应用操作子应用元素的行为进行限制。 ### 解除元素绑定 -默认情况下,当子应用操作元素时会绑定元素作用域,而解绑过程是异步的,这可能会导致渲染出错,此时可以主动解除元素绑定来避免这个问题。 +默认情况下,当子应用操作元素时会绑定元素作用域,而解绑过程是异步的,这可能会导致操作元素异常,此时有两种方式可以解决这个问题。 + + +**方式一:执行removeDomScope** 执行`removeDomScope`方法后,元素作用域会重置为基座应用。 @@ -22,12 +25,43 @@ import { removeDomScope } from '@micro-zoe/micro-app' // 重置作用域 removeDomScope() + +// 全局获取id为root的元素 +window.document.getElementById('root') ``` #### ** 子应用 ** ```js +// 注意不要使用window.rawWindow +const _window = new Function('return window')() + // 重置作用域 -window.removeDomScope() +window.microApp.removeDomScope() + +// 全局获取id为root的元素 +_window.document.getElementById('root') ``` + +**方式二:使用setTimeout** + +#### ** 基座应用 ** +```js +// 等待解绑结束后操作元素 +setTimeout(() => { + window.document.getElementById('root') // 全局获取id为root的元素 +}, 0) +``` + +#### ** 子应用 ** +```js +// 注意不要使用window.rawWindow +const _window = new Function('return window')() + +// 等待解绑结束后操作元素 +setTimeout(() => { + _window.document.getElementById('root') // 全局获取id为root的元素 +}, 0) +``` + diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 880fe16ed..5d5ac4301 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -389,8 +389,7 @@ export function parseQuery (search: string): LocationQueryObject { const result: LocationQueryObject = {} const queryList = search.split('&') - // 注意我们不会对key和value进行解码,以确保替换url时前后值一致 - // 我们只对匹配到的微应用的key和value在后续进行编解码 + // we will not decode the key/value to ensure that the values are consistent when update URL for (const queryItem of queryList) { const eqPos = queryItem.indexOf('=') const key = eqPos < 0 ? queryItem : queryItem.slice(0, eqPos) diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts index 5a8095d26..cdef3d7b6 100644 --- a/src/sandbox/router/core.ts +++ b/src/sandbox/router/core.ts @@ -8,6 +8,7 @@ import { assign, parseQuery, stringifyQuery, + isString, } from '../../libs/utils' // set micro app state to origin state @@ -16,13 +17,12 @@ export function createMicroState ( rawState: MicroState, microState: MicroState, ): MicroState { - // 生成新的microAppState,因为它们在第二层 - const newMicroAppState = assign({}, rawState?.microAppState, { - [appName]: microState - }) // 生成新的state对象 return assign({}, rawState, { - microAppState: newMicroAppState + // 生成新的microAppState,因为它们在第二层 + microAppState: assign({}, rawState?.microAppState, { + [appName]: microState + }) }) } @@ -63,23 +63,6 @@ function commonDecode (path: string): string { } } -/** - * 根据location获取query对象 - */ -function getQueryObjectFromURL (search: string, hash: string): LocationQuery { - const queryObject: LocationQuery = {} - - if (search !== '' && search !== '?') { - queryObject.searchQuery = parseQuery(search.slice(1)) - } - - if (hash.includes('?')) { - queryObject.hashQuery = parseQuery(hash.slice(hash.indexOf('?') + 1)) - } - - return queryObject -} - // 格式化query参数key,防止与原有参数的冲突 function formatQueryAppName (appName: string) { return `app-${appName}` @@ -90,8 +73,7 @@ export function getMicroPathFromURL (appName: string): string | null { const rawLocation = globalEnv.rawWindow.location const queryObject = getQueryObjectFromURL(rawLocation.search, rawLocation.hash) const microPath = queryObject.hashQuery?.[formatQueryAppName(appName)] || queryObject.searchQuery?.[formatQueryAppName(appName)] - // 解码 - return microPath ? decodeMicroPath(microPath as string) : null + return isString(microPath) ? decodeMicroPath(microPath) : null } // 将name=encodeUrl地址插入到浏览器url上 @@ -146,3 +128,20 @@ export function removeMicroPathFromURL (appName: string): string { return pathname + search + hash } + +/** + * 根据location获取query对象 + */ +function getQueryObjectFromURL (search: string, hash: string): LocationQuery { + const queryObject: LocationQuery = {} + + if (search !== '' && search !== '?') { + queryObject.searchQuery = parseQuery(search.slice(1)) + } + + if (hash.includes('?')) { + queryObject.hashQuery = parseQuery(hash.slice(hash.indexOf('?') + 1)) + } + + return queryObject +} diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 22f50ec80..79bad39b6 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -5,10 +5,7 @@ import type { HistoryProxyValue, } from '@micro-app/types' import globalEnv from '../../libs/global_env' -import { - isString, - logError, -} from '../../libs/utils' +import { isString, logError } from '../../libs/utils' import { updateLocation } from './location' import { setMicroPathToURL, createMicroState, getMicroState } from './core' @@ -22,7 +19,7 @@ export function createMicroHistory ( // 是否需要在每次调用时都创建一个函数?这样看起来麻烦,但是是函数式编程,看起来更优雅 // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 - function microHistoryMethod (methodName: PropertyKey): CallableFunction { + function getMicroHistoryMethod (methodName: PropertyKey): CallableFunction { return (...rests: any[]) => { // console.log(444444444, rests[0], rests[1], rests[2], methodName) let targetPath = null @@ -32,16 +29,18 @@ export function createMicroHistory ( const targetLocation = new URL(rests[2], base) as MicroLocation if (targetLocation.origin === microLocation.origin) { targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash - // 经过格式化后的,包含某个微应用state的全量state - const newState = createMicroState(appName, rawHistory.state, rests[0]) - rests = [newState, rests[1], setMicroPathToURL(appName, targetLocation)] + rests = [ + createMicroState(appName, rawHistory.state, rests[0]), + rests[1], + setMicroPathToURL(appName, targetLocation), + ] } } catch (e) { logError(e, appName) } } - rawHistory[methodName](...rests) + rawHistory[methodName].apply(rawHistory, rests) if (targetPath) updateLocation(targetPath, base, microLocation) @@ -50,11 +49,11 @@ export function createMicroHistory ( } const microHistory = new Proxy(rawHistory, { - get (target: Record, key: PropertyKey): HistoryProxyValue { + get (target: History, key: PropertyKey): HistoryProxyValue { if (key === 'state') { return getMicroState(appName, rawHistory.state) } else if (typeof Reflect.get(target, key) === 'function') { - return microHistoryMethod(key) + return getMicroHistoryMethod(key) } return Reflect.get(target, key) }, diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index 7916fc324..769ad06bf 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -34,6 +34,7 @@ export function initRouteStateWithURL ( } } +// 清空路由信息,主要有2点:1、本地location更新为初始化 2、删除history.state 和 浏览器url上的参数信息 export function clearRouteStateFromURL ( appName: string, url: string, @@ -49,6 +50,8 @@ export function clearRouteStateFromURL ( ) } +// 所谓路由系统,无非两种操作:读、写 +// 读是通过location,写是通过replace/pushState export default function createMicroRouter (appName: string, url: string): MicroRouter { const microLocation = createMicroLocation(url) diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index b9fc0797e..f83a8a732 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -1,8 +1,6 @@ import type { MicroLocation } from '@micro-app/types' import globalEnv from '../../libs/global_env' -import { - assign as oAssign, -} from '../../libs/utils' +import { assign as oAssign } from '../../libs/utils' // location of micro app // 只会在沙箱初始化时执行一次 @@ -34,6 +32,7 @@ export function createMicroLocation (url: string): MicroLocation { // origin is readonly, so we ignore it const LocationKeys = ['hash', 'host', 'hostname', 'href', 'password', 'pathname', 'port', 'protocol', 'search'] +// 触发location更新的无非3种情况:1、push/replaceState 2、popState事件 3、初始化时url上有参数 export function updateLocation ( path: string, base: string, From e8de33486ed07cebe886e8d46aa2a599e68b3cad Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Tue, 22 Mar 2022 11:41:18 +0800 Subject: [PATCH 008/268] docs: update docs --- dev/children/react16/src/index.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dev/children/react16/src/index.css b/dev/children/react16/src/index.css index f21b17571..4c155dfed 100644 --- a/dev/children/react16/src/index.css +++ b/dev/children/react16/src/index.css @@ -7,6 +7,10 @@ body { -moz-osx-font-smoothing: grayscale; } +:global{ + @media (max-width: 575px){} +} + code { font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; @@ -44,3 +48,7 @@ code { float: none; } } + +:global{ + @media (max-width: 575px){} +} From 5a922f17113d5825fceebd851b5547f2ee3e5ffe Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Tue, 22 Mar 2022 21:23:13 +0800 Subject: [PATCH 009/268] feat: update location of h\ref, pathname, search, hash --- .eslintignore | 1 + dev/children/react16/src/index.js | 7 +- .../src/pages/angular11/angular11.js | 2 +- src/sandbox/router/core.ts | 14 +- src/sandbox/router/event.ts | 5 +- src/sandbox/router/history.ts | 12 +- src/sandbox/router/index.ts | 4 +- src/sandbox/router/location.ts | 216 +++++++++++++++++- typings/global.d.ts | 20 +- 9 files changed, 258 insertions(+), 23 deletions(-) diff --git a/.eslintignore b/.eslintignore index aa9977beb..b34a6aac1 100755 --- a/.eslintignore +++ b/.eslintignore @@ -6,3 +6,4 @@ node_modules /docs /plugins /src/__tests__/demos +/src/ diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index 40279f3fc..0018f5d53 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -265,5 +265,10 @@ const _window = new Function('return window')() setTimeout(() => { // window.microApp.removeDomScope() console.log(_window.document.getElementById('root')) -}, 0) +}, 0); + +// setTimeout(() => { +// window.location.href = 'http://localhost:3001/micro-app/react16/#abc' +// // console.log(111111, window.location) +// }, 5000); diff --git a/dev/main-react16/src/pages/angular11/angular11.js b/dev/main-react16/src/pages/angular11/angular11.js index 47be30308..f0a4988f1 100644 --- a/dev/main-react16/src/pages/angular11/angular11.js +++ b/dev/main-react16/src/pages/angular11/angular11.js @@ -25,7 +25,7 @@ function Angular11 () { onMounted={() => hideLoading(false)} // baseRoute='/micro-app/demo/angular11' // destroy - // inline + inline // disableScopecss > diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts index cdef3d7b6..d5227762c 100644 --- a/src/sandbox/router/core.ts +++ b/src/sandbox/router/core.ts @@ -76,8 +76,13 @@ export function getMicroPathFromURL (appName: string): string | null { return isString(microPath) ? decodeMicroPath(microPath) : null } +type setMicroPathResult = { + fullPath: string, + attach2Hash: boolean, +} + // 将name=encodeUrl地址插入到浏览器url上 -export function setMicroPathToURL (appName: string, microLocation: MicroLocation): string { +export function setMicroPathToURL (appName: string, microLocation: MicroLocation): setMicroPathResult { let { pathname, search, hash } = globalEnv.rawWindow.location const queryObject = getQueryObjectFromURL(search, hash) const encodedMicroPath = encodeMicroPath( @@ -86,8 +91,10 @@ export function setMicroPathToURL (appName: string, microLocation: MicroLocation microLocation.hash ) + let attach2Hash = false // 基座是否是hash模式,这个其实也不准,只是表示参数加到了hash上 // hash存在且search不存在,则认为是hash路由 if (hash && !search) { + attach2Hash = true if (queryObject.hashQuery) { queryObject.hashQuery[formatQueryAppName(appName)] = encodedMicroPath } else { @@ -108,7 +115,10 @@ export function setMicroPathToURL (appName: string, microLocation: MicroLocation search = '?' + stringifyQuery(queryObject.searchQuery) } - return pathname + search + hash + return { + fullPath: pathname + search + hash, + attach2Hash, + } } // 将name=encodeUrl的参数从浏览器url上删除 diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index 967193955..1d1147902 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -24,12 +24,11 @@ export function addHistoryListener (rawWindow: Window, appName: string): Callabl // @ts-ignore updateLocation(microPath, app.url, app.sandBox.proxyWindow.location) // @ts-ignore - // console.log(333333, microPath, app.sandBox.proxyWindow.location) + console.log(333333, microPath, app.sandBox.proxyWindow.location) } // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 - const state = getMicroState(appName, e.state) rawWindow.dispatchEvent( - new PopStateEvent(formatEventName('popstate', appName), { state }) + new PopStateEvent(formatEventName('popstate', appName), { state: getMicroState(appName, e.state) }) ) } } diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 79bad39b6..70ff75083 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -21,18 +21,18 @@ export function createMicroHistory ( // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 function getMicroHistoryMethod (methodName: PropertyKey): CallableFunction { return (...rests: any[]) => { - // console.log(444444444, rests[0], rests[1], rests[2], methodName) + console.log(444444444, rests[0], rests[1], rests[2], methodName) let targetPath = null // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! if ((methodName === 'pushState' || methodName === 'replaceState') && rests[2] && isString(rests[2])) { try { - const targetLocation = new URL(rests[2], base) as MicroLocation + const targetLocation = new URL('' + rests[2], base) as MicroLocation if (targetLocation.origin === microLocation.origin) { targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash rests = [ createMicroState(appName, rawHistory.state, rests[0]), rests[1], - setMicroPathToURL(appName, targetLocation), + setMicroPathToURL(appName, targetLocation).fullPath, ] } } catch (e) { @@ -44,11 +44,11 @@ export function createMicroHistory ( if (targetPath) updateLocation(targetPath, base, microLocation) - // console.log(5555555, microLocation, base) + console.log(5555555, microLocation, base) } } - const microHistory = new Proxy(rawHistory, { + return new Proxy(rawHistory, { get (target: History, key: PropertyKey): HistoryProxyValue { if (key === 'state') { return getMicroState(appName, rawHistory.state) @@ -58,8 +58,6 @@ export function createMicroHistory ( return Reflect.get(target, key) }, }) - - return microHistory } // 更新浏览器url diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index 769ad06bf..a06f24f9c 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -30,7 +30,7 @@ export function initRouteStateWithURL ( if (microPath) { updateLocation(microPath, url, microLocation) } else { - updateBrowserURL(globalEnv.rawWindow.history.state, setMicroPathToURL(appName, microLocation)) + updateBrowserURL(globalEnv.rawWindow.history.state, setMicroPathToURL(appName, microLocation).fullPath) } } @@ -53,7 +53,7 @@ export function clearRouteStateFromURL ( // 所谓路由系统,无非两种操作:读、写 // 读是通过location,写是通过replace/pushState export default function createMicroRouter (appName: string, url: string): MicroRouter { - const microLocation = createMicroLocation(url) + const microLocation = createMicroLocation(appName, url) return { microLocation, diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index f83a8a732..00ff85e12 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -1,12 +1,20 @@ -import type { MicroLocation } from '@micro-app/types' +import type { MicroLocation, LocationProxyValue } from '@micro-app/types' import globalEnv from '../../libs/global_env' -import { assign as oAssign } from '../../libs/utils' +import { assign as oAssign, rawDefineProperties } from '../../libs/utils' +import { setMicroPathToURL } from './core' // location of micro app // 只会在沙箱初始化时执行一次 -export function createMicroLocation (url: string): MicroLocation { - const rawLocation = globalEnv.rawWindow.location +export function createMicroLocation (appName: string, url: string): MicroLocation { + const rawWindow = globalEnv.rawWindow + const rawLocation = rawWindow.location const microLocation = new URL(url) as MicroLocation + const shadowLocation = { + href: microLocation.href, + pathname: microLocation.pathname, + search: microLocation.search, + hash: microLocation.hash, + } function assign (url: string | URL): void { rawLocation.assign(url) @@ -24,10 +32,197 @@ export function createMicroLocation (url: string): MicroLocation { oAssign(microLocation, { assign, replace, - reload + reload, + shadowLocation, + }) + + console.log(1111, microLocation) + + rawDefineProperties(microLocation, { + href: { + enumerable: true, + configurable: true, + get (): string { + return shadowLocation.href + }, + set (value: string): void { + const targetLocation = new URL('' + value, url) as MicroLocation + if (targetLocation.origin === microLocation.origin) { + const setMicroPathResult = setMicroPathToURL(appName, targetLocation) + /** + * change hash with location.href = xxx will not trigger the browser reload + * so we use pushState & reload to imitate href behavior + * NOTE: + * 1. if child app only change hash, it should not trigger browser reload + * 2. if address is the same and has hash, it should not add route stack + */ + if ( + targetLocation.pathname === shadowLocation.pathname && + targetLocation.search === shadowLocation.search + ) { + if (targetLocation.hash !== shadowLocation.hash) { + rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) + } + + if (targetLocation.hash) { + rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + } else { + rawLocation.reload() + } + + } else if (setMicroPathResult.attach2Hash) { + rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) + rawLocation.reload() + } + + value = setMicroPathResult.fullPath + } + + console.log(9999999999) + + rawLocation.href = value + } + }, + pathname: { + enumerable: true, + configurable: true, + get (): string { + return shadowLocation.pathname + }, + set (value: string): void { + console.log(77777777777) + const targetPath = value + shadowLocation.search + shadowLocation.hash + const targetLocation = new URL(targetPath, url) as MicroLocation + if (targetLocation.pathname === shadowLocation.pathname) { + rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + } else { + rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + rawLocation.reload() + } + } + }, + search: { + enumerable: true, + configurable: true, + get (): string { + return shadowLocation.search + }, + set (value: string): void { + const targetPath = shadowLocation.pathname + ('?' + value).replace(/^\?+/, '?') + shadowLocation.hash + const targetLocation = new URL(targetPath, url) as MicroLocation + if (targetLocation.search === shadowLocation.search) { + rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + } else { + rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + rawLocation.reload() + } + } + }, + hash: { + enumerable: true, + configurable: true, + get (): string { + return shadowLocation.hash + }, + set (value: string): void { + const targetPath = shadowLocation.pathname + shadowLocation.search + ('#' + value).replace(/^#+/, '#') + const targetLocation = new URL(targetPath, url) as MicroLocation + if (targetLocation.hash !== shadowLocation.hash) { + rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + } + } + }, }) return microLocation + + const ownKeysOfMicroLocation: PropertyKey[] = ['assign', 'replace', 'reload', 'shadowLocation'] + return new Proxy(microLocation, { + // get (target: MicroLocation, key: PropertyKey): LocationProxyValue { + // if (ownKeysOfMicroLocation.includes(key)) { + // return Reflect.get(target, key) + // } + // return Reflect.get(shadowLocation, key) + // }, + // set (target: MicroLocation, key: PropertyKey, value: unknown): boolean { + // if (key === 'href') { + // const targetLocation = new URL('' + value, url) as MicroLocation + // if (targetLocation.origin === shadowLocation.origin) { + // const setMicroPathResult = setMicroPathToURL(appName, targetLocation) + // /** + // * change hash with location.href = xxx will not trigger the browser reload + // * so we use pushState & reload to imitate href behavior + // * NOTE: + // * 1. if child app only change hash, it should not trigger browser reload + // * 2. if address is the same and has hash, it should not add route stack + // */ + // if ( + // targetLocation.pathname === shadowLocation.pathname && + // targetLocation.search === shadowLocation.search + // ) { + // if (targetLocation.hash !== shadowLocation.hash) { + // rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) + // } + + // if (targetLocation.hash) { + // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + // } else { + // rawLocation.reload() + // } + + // return true + // } else if (setMicroPathResult.attach2Hash) { + // rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) + // rawLocation.reload() + // return true + // } + + // value = setMicroPathResult.fullPath + // } + + // return Reflect.set(rawLocation, key, value) + // } else if (key === 'pathname') { + // const targetPath = value + shadowLocation.search + shadowLocation.hash + // const targetLocation = new URL(targetPath, url) as MicroLocation + // if (targetLocation.pathname === shadowLocation.pathname) { + // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + // } else { + // rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + // rawLocation.reload() + // } + // return true + // } else if (key === 'search') { + // const targetPath = shadowLocation.pathname + ('?' + value).replace(/^\?+/, '?') + shadowLocation.hash + // const targetLocation = new URL(targetPath, url) as MicroLocation + // if (targetLocation.search === shadowLocation.search) { + // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + // } else { + // rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + // rawLocation.reload() + // } + // return true + // } else if (key === 'hash') { + // const targetPath = shadowLocation.pathname + shadowLocation.search + ('#' + value).replace(/^#+/, '#') + // const targetLocation = new URL(targetPath, url) as MicroLocation + // if (targetLocation.hash !== shadowLocation.hash) { + // rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + // } + // return true + // } + + // if (ownKeysOfMicroLocation.includes(key)) { + // return Reflect.set(target, key, value) + // } + + // if (key === 'protocol') { + // return Reflect.set(rawLocation, key, value) + // } + + // return Reflect.set(shadowLocation, key, value) + // } + }) } // origin is readonly, so we ignore it @@ -39,8 +234,17 @@ export function updateLocation ( microLocation: MicroLocation, ): void { const newLocation = new URL(path, base) + console.log(888888888, newLocation) for (const key of LocationKeys) { + if (key === 'href' || key === 'pathname' || key === 'search' || key === 'hash') { + // @ts-ignore + microLocation.shadowLocation[key] = newLocation[key] + } else { + // @ts-ignore + microLocation[key] = newLocation[key] + } + // @ts-ignore - microLocation[key] = newLocation[key] + // microLocation[key] = newLocation[key] } } diff --git a/typings/global.d.ts b/typings/global.d.ts index 39c415f40..f095706e6 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -201,7 +201,9 @@ declare module '@micro-app/types' { // special CallableFunction for interact type CallableFunctionForInteract = CallableFunction & { __APP_NAME__?: string, __AUTO_TRIGGER__?: boolean } - interface MicroLocation extends Location, URL {} + interface MicroLocation extends Location, URL { + shadowLocation: URL + } type MicroHistory = ProxyHandler type MicroState = any type HistoryProxyValue = @@ -216,6 +218,22 @@ declare module '@micro-app/types' { 'pushState' | 'replaceState' > | CallableFunction + type LocationProxyValue = + Pick< + Location, + 'href' | + 'protocol' | + 'host' | + 'hostname' | + 'port' | + 'pathname' | + 'search' | + 'hash' | + 'origin' | + 'assign' | + 'reload' | + 'replace' + > | CallableFunction | URL interface MicroRouter { microLocation: MicroLocation microHistory: MicroHistory From 0a9a51904c1fec72300b9bbdfe9ea3ed06a3f859 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 23 Mar 2022 21:07:28 +0800 Subject: [PATCH 010/268] feat: complete location api & hashchange event --- .eslintignore | 1 - dev/children/react16/src/index.js | 9 +- dev/children/react17/src/index.js | 8 + .../src/pages/angular11/angular11.js | 2 +- src/sandbox/__save__router.ts | 368 ------------------ src/sandbox/effect.ts | 2 +- src/sandbox/router/event.ts | 49 ++- src/sandbox/router/history.ts | 6 +- src/sandbox/router/location.ts | 265 +++++-------- typings/global.d.ts | 16 - 10 files changed, 160 insertions(+), 566 deletions(-) delete mode 100644 src/sandbox/__save__router.ts diff --git a/.eslintignore b/.eslintignore index b34a6aac1..aa9977beb 100755 --- a/.eslintignore +++ b/.eslintignore @@ -6,4 +6,3 @@ node_modules /docs /plugins /src/__tests__/demos -/src/ diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index 0018f5d53..47ed95e32 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -269,6 +269,13 @@ setTimeout(() => { // setTimeout(() => { -// window.location.href = 'http://localhost:3001/micro-app/react16/#abc' +// // window.location.href = 'http://localhost:3001/micro-app/react16/#abc' +// window.location.pathname = '/micro-app/react16/page2#fff' +// // window.location.assign('http://localhost:3001/micro-app/react16/page2#eee') +// // window.location.replace('http://localhost:3001/micro-app/react16/page2#eee') // // console.log(111111, window.location) // }, 5000); + +window.onpopstate = (e) => { + console.log(888888888, e) +} diff --git a/dev/children/react17/src/index.js b/dev/children/react17/src/index.js index 7b04b8395..e7fc6a2e1 100644 --- a/dev/children/react17/src/index.js +++ b/dev/children/react17/src/index.js @@ -36,3 +36,11 @@ if (window.__MICRO_APP_ENVIRONMENT__) { // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals reportWebVitals(); + +window.addEventListener('popstate', (e) => { + console.log('popstate', e) +}) + +window.addEventListener('hashchange', (e) => { + console.log('hashchange', e) +}) diff --git a/dev/main-react16/src/pages/angular11/angular11.js b/dev/main-react16/src/pages/angular11/angular11.js index f0a4988f1..47be30308 100644 --- a/dev/main-react16/src/pages/angular11/angular11.js +++ b/dev/main-react16/src/pages/angular11/angular11.js @@ -25,7 +25,7 @@ function Angular11 () { onMounted={() => hideLoading(false)} // baseRoute='/micro-app/demo/angular11' // destroy - inline + // inline // disableScopecss > diff --git a/src/sandbox/__save__router.ts b/src/sandbox/__save__router.ts deleted file mode 100644 index 807fef1c2..000000000 --- a/src/sandbox/__save__router.ts +++ /dev/null @@ -1,368 +0,0 @@ -/* eslint-disable */ -import type { - MicroRouter, - MicroLocation, - MicroHistory, - MicroState, - HistoryProxyValue, - LocationQueryValue, - LocationQuery, - LocationQueryObject, -} from '@micro-app/types' -import globalEnv from '../libs/global_env' -import { - assign as oAssign, - isArray, - isNull, - isString, - isUndefined, - logError, -} from '../libs/utils' -import { appInstanceMap } from '../create_app' -import { getActiveApps } from '../micro_app' -import { formatEventName } from './effect' - -type PopStateListener = (this: Window, e: PopStateEvent) => void - -/** - * register & release popstate event - * @param rawWindow origin window - * @param appName app name - * @returns release callback - */ -export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { - // Send to the child app after receiving the popstate event - const popStateHandler: PopStateListener = (e: PopStateEvent): void => { - const activeApps = getActiveApps(true) - if (activeApps.includes(appName)) { - // 先更新location,再发送popstate事件 - const microPath = getMicroPathFromURL(appName) - if (microPath) { - const app = appInstanceMap.get(appName) - // @ts-ignore - updateLocation(microPath, app.url, app.sandBox.proxyWindow.location) - // @ts-ignore - console.log(333333, microPath, app.sandBox.proxyWindow.location) - } - // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 - const state = getMicroState(appName, e.state) - rawWindow.dispatchEvent( - new PopStateEvent(formatEventName('popstate', appName), { state }) - ) - } - } - - rawWindow.addEventListener('popstate', popStateHandler) - - return () => { - rawWindow.removeEventListener('popstate', popStateHandler) - } -} - -// set micro app state to origin state -function createMicroState ( - appName: string, - rawState: MicroState, - microState: MicroState, -): MicroState { - // 生成新的microAppState,因为它们在第二层 - const newMicroAppState = oAssign({}, rawState?.microAppState, { - [appName]: microState - }) - // 生成新的state对象 - return oAssign({}, rawState, { - microAppState: newMicroAppState - }) -} - -// get micro app state form origin state -function getMicroState (appName: string, state: MicroState): MicroState { - return state?.microAppState?.[appName] || null -} - -// delete micro app state form origin state -function deleteMicroState (appName: string, rawState: MicroState): MicroState { - if (rawState?.microAppState?.[appName]) { - delete rawState.microAppState[appName] - } - // 生成新的state对象 - return oAssign({}, rawState) -} - -// history of micro app -function createMicroHistory (appName: string, base: string, microLocation: MicroLocation): MicroHistory { - const rawHistory = globalEnv.rawWindow.history - - // 是否需要在每次调用时都创建一个函数?这样看起来麻烦,但是是函数式编程,看起来更优雅 - // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 - function microHistoryMethod (methodName: PropertyKey): CallableFunction { - return (...rests: any[]) => { - console.log(444444444, rests[0], rests[1], rests[2], methodName) - let targetPath = null - // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! - if ((methodName === 'pushState' || methodName === 'replaceState') && rests[2] && isString(rests[2])) { - try { - const targetLocation = new URL(rests[2], base) as MicroLocation - if (targetLocation.origin === microLocation.origin) { - targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash - // 经过格式化后的,包含某个微应用state的全量state - const newState = createMicroState(appName, rawHistory.state, rests[0]) - rests = [newState, rests[1], attachMicroQueryToURL(appName, targetLocation)] - } - } catch (e) { - logError(e, appName) - } - } - - rawHistory[methodName](...rests) - - if (targetPath) updateLocation(targetPath, base, microLocation) - - console.log(5555555, microLocation, base) - } - } - - const microHistory = new Proxy(rawHistory, { - get (target: Record, key: PropertyKey): HistoryProxyValue { - if (key === 'state') { - return getMicroState(appName, rawHistory.state) - } else if (typeof Reflect.get(target, key) === 'function') { - return microHistoryMethod(key) - } - return Reflect.get(target, key) - }, - }) - - return microHistory -} - -const ENC_AD_RE = /&/g // %M1 -const ENC_EQ_RE = /=/g // %M2 -const DEC_AD_RE = /%M1/g // & -const DEC_EQ_RE = /%M2/g // = - -function encodeMicroPath (path: string): string { - return encodeURIComponent(commonDecode(path).replace(ENC_AD_RE, '%M1').replace(ENC_EQ_RE, '%M2')) -} - -function decodeMicroPath (path: string): string { - return commonDecode(path).replace(DEC_AD_RE, '&').replace(DEC_EQ_RE, '=') -} - -function commonDecode (path: string): string { - try { - const decPath = decodeURIComponent(path) - if (path === decPath || DEC_AD_RE.test(decPath) || DEC_EQ_RE.test(decPath)) return decPath - return commonDecode(decPath) - } catch { - return path - } -} - -// 格式化query参数key,防止与原有参数的冲突 -function formatQueryAppName (appName: string) { - return `app-${appName}` -} - -// 根据浏览器url参数,获取当前子应用的fullPath -function getMicroPathFromURL (appName: string): string | null { - const rawLocation = globalEnv.rawWindow.location - const queryObject = getQueryObjectFromURL(rawLocation.search, rawLocation.hash) - const microPath = queryObject.hashQuery?.[formatQueryAppName(appName)] || queryObject.searchQuery?.[formatQueryAppName(appName)] - // 解码 - return microPath ? decodeMicroPath(microPath as string) : null -} - -// 将name=encodeUrl地址插入到浏览器url上 -function attachMicroQueryToURL (appName: string, microLocation: MicroLocation): string { - let { pathname, search, hash } = globalEnv.rawWindow.location - const microQueryObject = getQueryObjectFromURL(search, hash) - const encodedMicroPath = encodeMicroPath( - microLocation.pathname + - microLocation.search + - microLocation.hash - ) - - // hash存在且search不存在,则认为是hash路由 - if (hash && !search) { - if (microQueryObject.hashQuery) { - microQueryObject.hashQuery[formatQueryAppName(appName)] = encodedMicroPath - } else { - microQueryObject.hashQuery = { - [formatQueryAppName(appName)]: encodedMicroPath - } - } - const baseHash = hash.includes('?') ? hash.slice(0, hash.indexOf('?') + 1) : hash + '?' - hash = baseHash + stringifyQuery(microQueryObject.hashQuery) - } else { - if (microQueryObject.searchQuery) { - microQueryObject.searchQuery[formatQueryAppName(appName)] = encodedMicroPath - } else { - microQueryObject.searchQuery = { - [formatQueryAppName(appName)]: encodedMicroPath - } - } - search = '?' + stringifyQuery(microQueryObject.searchQuery) - } - - return pathname + search + hash -} - -// 将name=encodeUrl的参数从浏览器url上删除 -function removeMicroQueryFromURL (appName: string): string { - let { pathname, search, hash } = globalEnv.rawWindow.location - const microQueryObject = getQueryObjectFromURL(search, hash) - - if (microQueryObject.hashQuery?.[formatQueryAppName(appName)]) { - delete microQueryObject.hashQuery?.[formatQueryAppName(appName)] - const hashQueryStr = stringifyQuery(microQueryObject.hashQuery) - hash = hash.slice(0, hash.indexOf('?') + Number(Boolean(hashQueryStr))) + hashQueryStr - } else if (microQueryObject.searchQuery?.[formatQueryAppName(appName)]) { - delete microQueryObject.searchQuery?.[formatQueryAppName(appName)] - const searchQueryStr = stringifyQuery(microQueryObject.searchQuery) - search = searchQueryStr ? '?' + searchQueryStr : '' - } - - return pathname + search + hash -} - -/** - * 根据location获取query对象 - */ -function getQueryObjectFromURL (search: string, hash: string): LocationQuery { - const queryObject: LocationQuery = {} - - if (search !== '' && search !== '?') { - queryObject.searchQuery = parseQuery(search.slice(1)) - } - - if (hash.includes('?')) { - queryObject.hashQuery = parseQuery(hash.slice(hash.indexOf('?') + 1)) - } - - return queryObject -} - -// 将参数字符串转换为对象 -function parseQuery (search: string): LocationQueryObject { - const result: LocationQueryObject = {} - const queryList = search.split('&') - - // 注意我们不会对key和value进行解码,以确保替换url时前后值一致 - // 我们只对匹配到的微应用的key和value在后续进行编解码 - for (const queryItem of queryList) { - const eqPos = queryItem.indexOf('=') - const key = eqPos < 0 ? queryItem : queryItem.slice(0, eqPos) - const value = eqPos < 0 ? null : queryItem.slice(eqPos + 1) - - if (key in result) { - let currentValue = result[key] - if (!isArray(currentValue)) { - currentValue = result[key] = [currentValue] - } - currentValue.push(value) - } else { - result[key] = value - } - } - - return result -} - -// 将对象转换为字符串,一次只能格式化一个,所以search和hash需要分2次处理 -function stringifyQuery (queryObject: LocationQueryObject): string { - let result = '' - - for (const key in queryObject) { - const value = queryObject[key] - if (isNull(value)) { - result += (result.length ? '&' : '') + key - } else { - const valueList: LocationQueryValue[] = isArray(value) ? value : [value] - - valueList.forEach(value => { - if (!isUndefined(value)) { - result += (result.length ? '&' : '') + key - if (!isNull(value)) result += '=' + value - } - }) - } - } - - return result -} - -// location of micro app -// 只会在沙箱初始化时执行一次 -function createMicroLocation (url: string): MicroLocation { - const rawLocation = globalEnv.rawWindow.location - const microLocation = new URL(url) as MicroLocation - - function assign (url: string | URL): void { - rawLocation.assign(url) - } - - function replace (url: string | URL): void { - rawLocation.replace(url) - } - - function reload (forcedReload?: boolean): void { - // @ts-ignore - rawLocation.reload(forcedReload) - } - - oAssign(microLocation, { - assign, - replace, - reload - }) - - return microLocation -} - -// origin is readonly, so we ignore it -const LocationKeys = ['hash', 'host', 'hostname', 'href', 'password', 'pathname', 'port', 'protocol', 'search'] -function updateLocation (path: string, base: string, microLocation: MicroLocation) { - const newLocation = new URL(path, base) - for (const key of LocationKeys) { - // @ts-ignore - microLocation[key] = newLocation[key] - } -} - -// 更新浏览器url -function updateBrowserURL (state: MicroState, fullPath: string): void { - globalEnv.rawWindow.history.replaceState(state, null, fullPath) -} - -// 当沙箱执行start, 或者隐藏的keep-alive应用重新渲染时时才:根据浏览器url更新location 或者 将参数更新到url上 -export function initRouteStateWithURL (appName: string, url: string, microLocation: MicroLocation) { - const microPath = getMicroPathFromURL(appName) - // 如果初始化时参数有子应用的数据信息,则直接复用,如果没有则重新创建 - - if (microPath) { - updateLocation(microPath, url, microLocation) - } else { - updateBrowserURL(globalEnv.rawWindow.history.state, attachMicroQueryToURL(appName, microLocation)) - } -} - -export function clearRouteStateFromURL (appName: string, url: string, microLocation: MicroLocation) { - // 初始化location信息 - const { pathname, search, hash } = new URL(url) - updateLocation(pathname + search + hash, url, microLocation) - // 删除浏览器url上的子应用参数 - updateBrowserURL( - deleteMicroState(appName, globalEnv.rawWindow.history.state), - removeMicroQueryFromURL(appName), - ) -} - -export default function createMicroRouter (appName: string, url: string): MicroRouter { - const microLocation = createMicroLocation(url) - - return { - microLocation, - microHistory: createMicroHistory(appName, url, microLocation), - } -} diff --git a/src/sandbox/effect.ts b/src/sandbox/effect.ts index e3f79207b..676209022 100644 --- a/src/sandbox/effect.ts +++ b/src/sandbox/effect.ts @@ -29,7 +29,7 @@ export function formatEventName (eventName: string, appName: string): string { if ( formatEventList.includes(eventName) || ( - eventName === 'popstate' && + (eventName === 'popstate' || eventName === 'hashchange') && appInstanceMap.get(appName)?.useMemoryRouter ) ) { diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index 1d1147902..4913c8032 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -1,3 +1,4 @@ +import type { MicroLocation } from '@micro-app/types' import { appInstanceMap } from '../../create_app' import { getActiveApps } from '../../micro_app' import { formatEventName } from '../effect' @@ -7,29 +8,57 @@ import { updateLocation } from './location' type PopStateListener = (this: Window, e: PopStateEvent) => void /** - * register & release popstate event + * listen & release popstate event + * each child app will listen for popstate event when sandbox start + * and release it when sandbox stop * @param rawWindow origin window * @param appName app name * @returns release callback */ export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { - // Send to the child app after receiving the popstate event + // handle popstate event and distribute to child app const popStateHandler: PopStateListener = (e: PopStateEvent): void => { const activeApps = getActiveApps(true) if (activeApps.includes(appName)) { // 先更新location,再发送popstate事件 const microPath = getMicroPathFromURL(appName) + const app = appInstanceMap.get(appName)! + const proxyWindow = app.sandBox!.proxyWindow + let isHashChange = false + // for hashChangeEvent + const oldHref = proxyWindow.location.href if (microPath) { - const app = appInstanceMap.get(appName) - // @ts-ignore - updateLocation(microPath, app.url, app.sandBox.proxyWindow.location) - // @ts-ignore - console.log(333333, microPath, app.sandBox.proxyWindow.location) + const oldHash = proxyWindow.location.hash + updateLocation(microPath, app.url, proxyWindow.location as MicroLocation) + isHashChange = proxyWindow.location.hash !== oldHash } - // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 - rawWindow.dispatchEvent( - new PopStateEvent(formatEventName('popstate', appName), { state: getMicroState(appName, e.state) }) + + // console.log(333333, microPath, proxyWindow.location) + + // create PopStateEvent named popstate-appName with sub app state + const newPopStateEvent = new PopStateEvent( + formatEventName('popstate', appName), + { state: getMicroState(appName, e.state) } ) + + rawWindow.dispatchEvent(newPopStateEvent) + + typeof proxyWindow.onpopstate === 'function' && proxyWindow.onpopstate(newPopStateEvent) + + // send HashChangeEvent when hash change + if (isHashChange) { + const newHashChangeEvent = new HashChangeEvent( + formatEventName('hashchange', appName), + { + newURL: proxyWindow.location.href, + oldURL: oldHref, + } + ) + + rawWindow.dispatchEvent(newHashChangeEvent) + + typeof proxyWindow.onhashchange === 'function' && proxyWindow.onhashchange(newHashChangeEvent) + } } } diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 70ff75083..07d0127f8 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -21,7 +21,7 @@ export function createMicroHistory ( // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 function getMicroHistoryMethod (methodName: PropertyKey): CallableFunction { return (...rests: any[]) => { - console.log(444444444, rests[0], rests[1], rests[2], methodName) + // console.log(444444444, rests[0], rests[1], rests[2], methodName) let targetPath = null // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! if ((methodName === 'pushState' || methodName === 'replaceState') && rests[2] && isString(rests[2])) { @@ -44,7 +44,7 @@ export function createMicroHistory ( if (targetPath) updateLocation(targetPath, base, microLocation) - console.log(5555555, microLocation, base) + // console.log(5555555, microLocation, base) } } @@ -60,7 +60,7 @@ export function createMicroHistory ( }) } -// 更新浏览器url +// update browser url export function updateBrowserURL (state: MicroState, fullPath: string): void { globalEnv.rawWindow.history.replaceState(state, null, fullPath) } diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index 00ff85e12..b772ec423 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -1,14 +1,20 @@ -import type { MicroLocation, LocationProxyValue } from '@micro-app/types' +/* eslint-disable no-void */ +import type { MicroLocation } from '@micro-app/types' import globalEnv from '../../libs/global_env' import { assign as oAssign, rawDefineProperties } from '../../libs/utils' import { setMicroPathToURL } from './core' -// location of micro app -// 只会在沙箱初始化时执行一次 +/** + * create location for micro app + * @param appName app name + * @param url app url + */ export function createMicroLocation (appName: string, url: string): MicroLocation { const rawWindow = globalEnv.rawWindow const rawLocation = rawWindow.location + // microLocation is the location of child app, it is globally unique const microLocation = new URL(url) as MicroLocation + // shadowLocation is the host of some special keys (href, pathname, search, hash) const shadowLocation = { href: microLocation.href, pathname: microLocation.pathname, @@ -16,19 +22,61 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio hash: microLocation.hash, } - function assign (url: string | URL): void { - rawLocation.assign(url) - } + /** + * Common handler for href, assign, replace + * It is mainly used to deal with special scenes about hash + * @param value target path + * @param methodName pushState/replaceState + * @returns origin value or formatted value + */ + const commonHandle = (value: string | URL, methodName: string): string | URL | undefined => { + const targetLocation = new URL('' + value, url) as MicroLocation + if (targetLocation.origin === microLocation.origin) { + const setMicroPathResult = setMicroPathToURL(appName, targetLocation) + /** + * change hash with location.href = xxx will not trigger the browser reload + * so we use pushState & reload to imitate href behavior + * NOTE: + * 1. if child app only change hash, it should not trigger browser reload + * 2. if address is the same and has hash, it should not add route stack + */ + if ( + targetLocation.pathname === shadowLocation.pathname && + targetLocation.search === shadowLocation.search + ) { + if (targetLocation.hash !== shadowLocation.hash) { + rawWindow.history[methodName](null, null, setMicroPathResult.fullPath) + } + + if (targetLocation.hash) { + rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + } else { + rawLocation.reload() + } + return void 0 + } else if (setMicroPathResult.attach2Hash) { + rawWindow.history[methodName](null, null, setMicroPathResult.fullPath) + rawLocation.reload() + return void 0 + } - function replace (url: string | URL): void { - rawLocation.replace(url) + value = setMicroPathResult.fullPath + } + + return value } - function reload (forcedReload?: boolean): void { - // @ts-ignore - rawLocation.reload(forcedReload) + const assignOrReplace = (value: string | URL, locationMethodName: string) => { + const formattedValue = commonHandle(value, locationMethodName === 'assign' ? 'pushState' : 'replaceState') + if (formattedValue) rawLocation[locationMethodName](formattedValue) } + const assign = (value: string | URL): void => assignOrReplace(value, 'assign') + + const replace = (value: string | URL): void => assignOrReplace(value, 'replace') + + const reload = (forcedReload?: boolean): void => rawLocation.reload(forcedReload) + oAssign(microLocation, { assign, replace, @@ -36,67 +84,35 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio shadowLocation, }) - console.log(1111, microLocation) - + /** + * Special processing for four keys: href, pathname, search and hash + * They take values from shadowLocation, and require special operations when assigning values + */ rawDefineProperties(microLocation, { href: { enumerable: true, configurable: true, - get (): string { - return shadowLocation.href - }, - set (value: string): void { - const targetLocation = new URL('' + value, url) as MicroLocation - if (targetLocation.origin === microLocation.origin) { - const setMicroPathResult = setMicroPathToURL(appName, targetLocation) - /** - * change hash with location.href = xxx will not trigger the browser reload - * so we use pushState & reload to imitate href behavior - * NOTE: - * 1. if child app only change hash, it should not trigger browser reload - * 2. if address is the same and has hash, it should not add route stack - */ - if ( - targetLocation.pathname === shadowLocation.pathname && - targetLocation.search === shadowLocation.search - ) { - if (targetLocation.hash !== shadowLocation.hash) { - rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) - } - - if (targetLocation.hash) { - rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) - } else { - rawLocation.reload() - } - - } else if (setMicroPathResult.attach2Hash) { - rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) - rawLocation.reload() - } - - value = setMicroPathResult.fullPath - } - - console.log(9999999999) - - rawLocation.href = value + get: (): string => shadowLocation.href, + set: (value: string): void => { + const formattedValue = commonHandle(value, 'pushState') + if (formattedValue) rawLocation.href = formattedValue } }, pathname: { enumerable: true, configurable: true, - get (): string { - return shadowLocation.pathname - }, - set (value: string): void { - console.log(77777777777) - const targetPath = value + shadowLocation.search + shadowLocation.hash + get: (): string => shadowLocation.pathname, + set: (value: string): void => { + const targetPath = ('/' + value).replace(/^\/+/, '/') + shadowLocation.search + shadowLocation.hash const targetLocation = new URL(targetPath, url) as MicroLocation - if (targetLocation.pathname === shadowLocation.pathname) { + // When the browser url has a hash value, the same pathname will not trigger the browser refresh + if (targetLocation.pathname === shadowLocation.pathname && shadowLocation.hash) { rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) } else { - rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + // When the value is the same, no new route stack will be added + // Special scenes such as: /path ==> /path#hash, /path ==> /path?query + const methodName = targetLocation.pathname === shadowLocation.pathname ? 'replaceState' : 'pushState' + rawWindow.history[methodName](null, null, setMicroPathToURL(appName, targetLocation).fullPath) rawLocation.reload() } } @@ -104,16 +120,18 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio search: { enumerable: true, configurable: true, - get (): string { - return shadowLocation.search - }, - set (value: string): void { + get: (): string => shadowLocation.search, + set: (value: string): void => { const targetPath = shadowLocation.pathname + ('?' + value).replace(/^\?+/, '?') + shadowLocation.hash const targetLocation = new URL(targetPath, url) as MicroLocation - if (targetLocation.search === shadowLocation.search) { + // When the browser url has a hash value, the same search will not trigger the browser refresh + if (targetLocation.search === shadowLocation.search && shadowLocation.hash) { rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) } else { - rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + // When the value is the same, no new route stack will be added + // Special scenes such as: ?query ==> ?query#hash + const methodName = targetLocation.search === shadowLocation.search ? 'replaceState' : 'pushState' + rawWindow.history[methodName](null, null, setMicroPathToURL(appName, targetLocation).fullPath) rawLocation.reload() } } @@ -121,12 +139,11 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio hash: { enumerable: true, configurable: true, - get (): string { - return shadowLocation.hash - }, - set (value: string): void { + get: (): string => shadowLocation.hash, + set: (value: string): void => { const targetPath = shadowLocation.pathname + shadowLocation.search + ('#' + value).replace(/^#+/, '#') const targetLocation = new URL(targetPath, url) as MicroLocation + // The same hash will not trigger popStateEvent if (targetLocation.hash !== shadowLocation.hash) { rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) @@ -136,115 +153,33 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio }) return microLocation - - const ownKeysOfMicroLocation: PropertyKey[] = ['assign', 'replace', 'reload', 'shadowLocation'] - return new Proxy(microLocation, { - // get (target: MicroLocation, key: PropertyKey): LocationProxyValue { - // if (ownKeysOfMicroLocation.includes(key)) { - // return Reflect.get(target, key) - // } - // return Reflect.get(shadowLocation, key) - // }, - // set (target: MicroLocation, key: PropertyKey, value: unknown): boolean { - // if (key === 'href') { - // const targetLocation = new URL('' + value, url) as MicroLocation - // if (targetLocation.origin === shadowLocation.origin) { - // const setMicroPathResult = setMicroPathToURL(appName, targetLocation) - // /** - // * change hash with location.href = xxx will not trigger the browser reload - // * so we use pushState & reload to imitate href behavior - // * NOTE: - // * 1. if child app only change hash, it should not trigger browser reload - // * 2. if address is the same and has hash, it should not add route stack - // */ - // if ( - // targetLocation.pathname === shadowLocation.pathname && - // targetLocation.search === shadowLocation.search - // ) { - // if (targetLocation.hash !== shadowLocation.hash) { - // rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) - // } - - // if (targetLocation.hash) { - // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) - // } else { - // rawLocation.reload() - // } - - // return true - // } else if (setMicroPathResult.attach2Hash) { - // rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) - // rawLocation.reload() - // return true - // } - - // value = setMicroPathResult.fullPath - // } - - // return Reflect.set(rawLocation, key, value) - // } else if (key === 'pathname') { - // const targetPath = value + shadowLocation.search + shadowLocation.hash - // const targetLocation = new URL(targetPath, url) as MicroLocation - // if (targetLocation.pathname === shadowLocation.pathname) { - // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) - // } else { - // rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) - // rawLocation.reload() - // } - // return true - // } else if (key === 'search') { - // const targetPath = shadowLocation.pathname + ('?' + value).replace(/^\?+/, '?') + shadowLocation.hash - // const targetLocation = new URL(targetPath, url) as MicroLocation - // if (targetLocation.search === shadowLocation.search) { - // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) - // } else { - // rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) - // rawLocation.reload() - // } - // return true - // } else if (key === 'hash') { - // const targetPath = shadowLocation.pathname + shadowLocation.search + ('#' + value).replace(/^#+/, '#') - // const targetLocation = new URL(targetPath, url) as MicroLocation - // if (targetLocation.hash !== shadowLocation.hash) { - // rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) - // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) - // } - // return true - // } - - // if (ownKeysOfMicroLocation.includes(key)) { - // return Reflect.set(target, key, value) - // } - - // if (key === 'protocol') { - // return Reflect.set(rawLocation, key, value) - // } - - // return Reflect.set(shadowLocation, key, value) - // } - }) } // origin is readonly, so we ignore it -const LocationKeys = ['hash', 'host', 'hostname', 'href', 'password', 'pathname', 'port', 'protocol', 'search'] -// 触发location更新的无非3种情况:1、push/replaceState 2、popState事件 3、初始化时url上有参数 +const locationKeys = ['hash', 'host', 'hostname', 'href', 'password', 'pathname', 'port', 'protocol', 'search'] +const shadowLocationKeys = ['href', 'pathname', 'search', 'hash'] +/** + * There are three situations that trigger location update: + * 1. pushState/replaceState + * 2. popStateEvent + * 3. params on browser url when init sub app + * @param path target path + * @param base base url + * @param microLocation micro app location + */ export function updateLocation ( path: string, base: string, microLocation: MicroLocation, ): void { const newLocation = new URL(path, base) - console.log(888888888, newLocation) - for (const key of LocationKeys) { - if (key === 'href' || key === 'pathname' || key === 'search' || key === 'hash') { + for (const key of locationKeys) { + if (shadowLocationKeys.includes(key)) { // @ts-ignore microLocation.shadowLocation[key] = newLocation[key] } else { // @ts-ignore microLocation[key] = newLocation[key] } - - // @ts-ignore - // microLocation[key] = newLocation[key] } } diff --git a/typings/global.d.ts b/typings/global.d.ts index f095706e6..3a713ccca 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -218,22 +218,6 @@ declare module '@micro-app/types' { 'pushState' | 'replaceState' > | CallableFunction - type LocationProxyValue = - Pick< - Location, - 'href' | - 'protocol' | - 'host' | - 'hostname' | - 'port' | - 'pathname' | - 'search' | - 'hash' | - 'origin' | - 'assign' | - 'reload' | - 'replace' - > | CallableFunction | URL interface MicroRouter { microLocation: MicroLocation microHistory: MicroHistory From dc7cb1ee5e69e8112b0add90b514aab19767fe27 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Thu, 24 Mar 2022 21:04:31 +0800 Subject: [PATCH 011/268] feat: adapte to vue-router4 v1 --- dev/children/react16/src/index.js | 22 +++++++------ dev/main-vite/src/App.vue | 3 +- dev/main-vite/src/pages/react16.vue | 1 + dev/main-vite/src/router/index.ts | 3 +- src/create_app.ts | 2 +- src/sandbox/router/core.ts | 48 +++++++++++++++++++++-------- src/sandbox/router/event.ts | 2 +- src/sandbox/router/history.ts | 20 +++++++++--- src/sandbox/router/index.ts | 9 ++++-- src/sandbox/router/location.ts | 23 ++++++++------ 10 files changed, 90 insertions(+), 43 deletions(-) diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index 47ed95e32..d9986fb72 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -268,14 +268,16 @@ setTimeout(() => { }, 0); -// setTimeout(() => { -// // window.location.href = 'http://localhost:3001/micro-app/react16/#abc' -// window.location.pathname = '/micro-app/react16/page2#fff' -// // window.location.assign('http://localhost:3001/micro-app/react16/page2#eee') -// // window.location.replace('http://localhost:3001/micro-app/react16/page2#eee') -// // console.log(111111, window.location) -// }, 5000); +setTimeout(() => { + // window.location.href = 'http://localhost:3001/micro-app/react16/#abc' + // window.location.pathname = '/micro-app/react16/page2#fff' + // window.location.assign('http://localhost:3001/micro-app/react16/page2#eee') + // window.location.replace('http://localhost:3001/micro-app/react16/page2#eee') + // console.log(111111, window.location) -window.onpopstate = (e) => { - console.log(888888888, e) -} + window.history.scrollRestoration = 'manual' +}, 5000); + +// window.onpopstate = (e) => { +// console.log(888888888, e) +// } diff --git a/dev/main-vite/src/App.vue b/dev/main-vite/src/App.vue index 48497977c..4667ec409 100644 --- a/dev/main-vite/src/App.vue +++ b/dev/main-vite/src/App.vue @@ -51,7 +51,8 @@ import {useRouter} from 'vue-router' const activeIndex = ref('/react16/') const {currentRoute} = useRouter() watch(currentRoute, (newVal, oldVal) => { - activeIndex.value = currentRoute.value.fullPath + // console.log(111111, currentRoute.value) + activeIndex.value = currentRoute.value.path }) diff --git a/dev/main-vite/src/pages/react16.vue b/dev/main-vite/src/pages/react16.vue index fe4107d9c..85ebfa5ad 100644 --- a/dev/main-vite/src/pages/react16.vue +++ b/dev/main-vite/src/pages/react16.vue @@ -22,6 +22,7 @@ @datachange='handleDataChange' inline baseRoute='/react16' + keep-route-state > diff --git a/dev/main-vite/src/router/index.ts b/dev/main-vite/src/router/index.ts index 65e925572..8bffea4f3 100644 --- a/dev/main-vite/src/router/index.ts +++ b/dev/main-vite/src/router/index.ts @@ -49,7 +49,8 @@ const routes = [ ]; const router = createRouter({ - history: createWebHistory(import.meta.env.BASE_URL), routes: routes + history: createWebHistory(import.meta.env.BASE_URL), + routes: routes, }) export default router; diff --git a/src/create_app.ts b/src/create_app.ts index 8d77bfc0f..594d2becb 100644 --- a/src/create_app.ts +++ b/src/create_app.ts @@ -305,7 +305,7 @@ export default class CreateApp implements AppInterface { } // this.container maybe contains micro-app element, stop sandbox should exec after cloneContainer - this.sandBox?.stop(this.keepRouteState) + this.sandBox?.stop(this.keepRouteState && !destroy) if (!getActiveApps().length) { releasePatchSetAttribute() } diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts index d5227762c..61a49e655 100644 --- a/src/sandbox/router/core.ts +++ b/src/sandbox/router/core.ts @@ -12,32 +12,52 @@ import { } from '../../libs/utils' // set micro app state to origin state -export function createMicroState ( +export function setMicroState ( appName: string, rawState: MicroState, microState: MicroState, + base: string, + searchHash: string ): MicroState { - // 生成新的state对象 - return assign({}, rawState, { - // 生成新的microAppState,因为它们在第二层 + const additionalState: Record = { microAppState: assign({}, rawState?.microAppState, { [appName]: microState }) - }) -} + } -// get micro app state form origin state -export function getMicroState (appName: string, state: MicroState): MicroState { - return state?.microAppState?.[appName] || null + /** + * vue-router4 will execute the replace method to replace the URL base on history.state.current before push + * add the latest search & hash to history.state.current to avoid this problem + */ + if (rawState?.current) { + additionalState.current = (new URL(rawState.current, base)).pathname + searchHash + } + + // create new state object + return assign({}, rawState, additionalState) } // delete micro app state form origin state -export function deleteMicroState (appName: string, rawState: MicroState): MicroState { +export function deleteMicroState (appName: string, rawState: MicroState, url: string): MicroState { if (rawState?.microAppState?.[appName]) { delete rawState.microAppState[appName] } + + let coverState + // + if (rawState?.current) { + coverState = { + current: removeMicroPathFromURL(appName, new URL(rawState.current, url) as MicroLocation) + } + } + // 生成新的state对象 - return assign({}, rawState) + return assign({}, rawState, coverState) +} + +// get micro app state form origin state +export function getMicroState (appName: string, state: MicroState): MicroState { + return state?.microAppState?.[appName] || null } const ENC_AD_RE = /&/g // %M1 @@ -78,6 +98,7 @@ export function getMicroPathFromURL (appName: string): string | null { type setMicroPathResult = { fullPath: string, + searchHash: string, attach2Hash: boolean, } @@ -117,13 +138,14 @@ export function setMicroPathToURL (appName: string, microLocation: MicroLocation return { fullPath: pathname + search + hash, + searchHash: search + hash, attach2Hash, } } // 将name=encodeUrl的参数从浏览器url上删除 -export function removeMicroPathFromURL (appName: string): string { - let { pathname, search, hash } = globalEnv.rawWindow.location +export function removeMicroPathFromURL (appName: string, targetLocation?: MicroLocation): string { + let { pathname, search, hash } = targetLocation || globalEnv.rawWindow.location const queryObject = getQueryObjectFromURL(search, hash) if (queryObject.hashQuery?.[formatQueryAppName(appName)]) { diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index 4913c8032..49e88219f 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -20,13 +20,13 @@ export function addHistoryListener (rawWindow: Window, appName: string): Callabl const popStateHandler: PopStateListener = (e: PopStateEvent): void => { const activeApps = getActiveApps(true) if (activeApps.includes(appName)) { - // 先更新location,再发送popstate事件 const microPath = getMicroPathFromURL(appName) const app = appInstanceMap.get(appName)! const proxyWindow = app.sandBox!.proxyWindow let isHashChange = false // for hashChangeEvent const oldHref = proxyWindow.location.href + // Do not attach micro info to url when microPath is empty if (microPath) { const oldHash = proxyWindow.location.hash updateLocation(microPath, app.url, proxyWindow.location as MicroLocation) diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 07d0127f8..2f3e89ce5 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -7,7 +7,7 @@ import type { import globalEnv from '../../libs/global_env' import { isString, logError } from '../../libs/utils' import { updateLocation } from './location' -import { setMicroPathToURL, createMicroState, getMicroState } from './core' +import { setMicroPathToURL, setMicroState, getMicroState } from './core' // history of micro app export function createMicroHistory ( @@ -29,10 +29,11 @@ export function createMicroHistory ( const targetLocation = new URL('' + rests[2], base) as MicroLocation if (targetLocation.origin === microLocation.origin) { targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash + const setMicroPathResult = setMicroPathToURL(appName, targetLocation) rests = [ - createMicroState(appName, rawHistory.state, rests[0]), + setMicroState(appName, rawHistory.state, rests[0], base, setMicroPathResult.searchHash), rests[1], - setMicroPathToURL(appName, targetLocation).fullPath, + setMicroPathResult.fullPath, ] } } catch (e) { @@ -57,10 +58,21 @@ export function createMicroHistory ( } return Reflect.get(target, key) }, + set (target: History, key: PropertyKey, value: unknown): boolean { + return Reflect.set(target, key, value) + } }) } -// update browser url +// update browser url when child app mount/unmount export function updateBrowserURL (state: MicroState, fullPath: string): void { globalEnv.rawWindow.history.replaceState(state, null, fullPath) } + +/** + * dispatch pure PopStateEvent + * simulate location behavior + */ +export function dispatchPurePopStateEvent (): void { + globalEnv.rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) +} diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index a06f24f9c..7e4dc6110 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -8,6 +8,7 @@ import { setMicroPathToURL, removeMicroPathFromURL, deleteMicroState, + setMicroState, } from './core' import { createMicroLocation, @@ -30,7 +31,11 @@ export function initRouteStateWithURL ( if (microPath) { updateLocation(microPath, url, microLocation) } else { - updateBrowserURL(globalEnv.rawWindow.history.state, setMicroPathToURL(appName, microLocation).fullPath) + const setMicroPathResult = setMicroPathToURL(appName, microLocation) + updateBrowserURL( + setMicroState(appName, globalEnv.rawWindow.history.state, null, url, setMicroPathResult.searchHash), + setMicroPathResult.fullPath, + ) } } @@ -45,7 +50,7 @@ export function clearRouteStateFromURL ( updateLocation(pathname + search + hash, url, microLocation) // 删除浏览器url上的子应用参数 updateBrowserURL( - deleteMicroState(appName, globalEnv.rawWindow.history.state), + deleteMicroState(appName, globalEnv.rawWindow.history.state, url), removeMicroPathFromURL(appName), ) } diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index b772ec423..297b26ebb 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -3,6 +3,7 @@ import type { MicroLocation } from '@micro-app/types' import globalEnv from '../../libs/global_env' import { assign as oAssign, rawDefineProperties } from '../../libs/utils' import { setMicroPathToURL } from './core' +import { dispatchPurePopStateEvent } from './history' /** * create location for micro app @@ -38,7 +39,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio * so we use pushState & reload to imitate href behavior * NOTE: * 1. if child app only change hash, it should not trigger browser reload - * 2. if address is the same and has hash, it should not add route stack + * 2. if address is same and has hash, it should not add route stack */ if ( targetLocation.pathname === shadowLocation.pathname && @@ -49,7 +50,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio } if (targetLocation.hash) { - rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + dispatchPurePopStateEvent() } else { rawLocation.reload() } @@ -66,14 +67,16 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio return value } - const assignOrReplace = (value: string | URL, locationMethodName: string) => { - const formattedValue = commonHandle(value, locationMethodName === 'assign' ? 'pushState' : 'replaceState') - if (formattedValue) rawLocation[locationMethodName](formattedValue) + const createAssignOrReplace = (locationMethodName: string) => { + return (value: string | URL) => { + const formattedValue = commonHandle(value, locationMethodName === 'assign' ? 'pushState' : 'replaceState') + if (formattedValue) rawLocation[locationMethodName](formattedValue) + } } - const assign = (value: string | URL): void => assignOrReplace(value, 'assign') + const assign = createAssignOrReplace('assign') - const replace = (value: string | URL): void => assignOrReplace(value, 'replace') + const replace = createAssignOrReplace('replace') const reload = (forcedReload?: boolean): void => rawLocation.reload(forcedReload) @@ -107,7 +110,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio const targetLocation = new URL(targetPath, url) as MicroLocation // When the browser url has a hash value, the same pathname will not trigger the browser refresh if (targetLocation.pathname === shadowLocation.pathname && shadowLocation.hash) { - rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + dispatchPurePopStateEvent() } else { // When the value is the same, no new route stack will be added // Special scenes such as: /path ==> /path#hash, /path ==> /path?query @@ -126,7 +129,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio const targetLocation = new URL(targetPath, url) as MicroLocation // When the browser url has a hash value, the same search will not trigger the browser refresh if (targetLocation.search === shadowLocation.search && shadowLocation.hash) { - rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + dispatchPurePopStateEvent() } else { // When the value is the same, no new route stack will be added // Special scenes such as: ?query ==> ?query#hash @@ -146,7 +149,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio // The same hash will not trigger popStateEvent if (targetLocation.hash !== shadowLocation.hash) { rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) - rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + dispatchPurePopStateEvent() } } }, From 7c5a1556496dbca31c6d2269a0fcddc788b311dc Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Fri, 25 Feb 2022 17:19:12 +0800 Subject: [PATCH 012/268] chore: remove comment --- src/libs/global_env.ts | 2 -- src/source/patch.ts | 24 ------------------------ 2 files changed, 26 deletions(-) diff --git a/src/libs/global_env.ts b/src/libs/global_env.ts index d6d70ee65..2f2a35509 100644 --- a/src/libs/global_env.ts +++ b/src/libs/global_env.ts @@ -54,7 +54,6 @@ export function initGlobalEnv (): void { const rawAppend = Element.prototype.append const rawPrepend = Element.prototype.prepend const rawCloneNode = Element.prototype.cloneNode - // const rawGetBoundingClientRect = Element.prototype.getBoundingClientRect const rawCreateElement = Document.prototype.createElement const rawCreateElementNS = Document.prototype.createElementNS @@ -105,7 +104,6 @@ export function initGlobalEnv (): void { rawAppend, rawPrepend, rawCloneNode, - // rawGetBoundingClientRect, rawCreateElement, rawCreateElementNS, rawCreateDocumentFragment, diff --git a/src/source/patch.ts b/src/source/patch.ts index 8412d6105..0cb92b398 100644 --- a/src/source/patch.ts +++ b/src/source/patch.ts @@ -270,29 +270,6 @@ export function patchElementPrototypeMethods (): void { this.__MICRO_APP_NAME__ && (clonedNode.__MICRO_APP_NAME__ = this.__MICRO_APP_NAME__) return clonedNode } - - // patch getBoundingClientRect - // TODO: scenes test - // Element.prototype.getBoundingClientRect = function getBoundingClientRect () { - // const rawRect: DOMRect = globalEnv.rawGetBoundingClientRect.call(this) - // if (this.__MICRO_APP_NAME__) { - // const app = appInstanceMap.get(this.__MICRO_APP_NAME__) - // if (!app?.container) { - // return rawRect - // } - // const appBody = app.container.querySelector('micro-app-body') - // const appBodyRect: DOMRect = globalEnv.rawGetBoundingClientRect.call(appBody) - // const computedRect: DOMRect = new DOMRect( - // rawRect.x - appBodyRect.x, - // rawRect.y - appBodyRect.y, - // rawRect.width, - // rawRect.height, - // ) - // return computedRect - // } - - // return rawRect - // } } /** @@ -486,7 +463,6 @@ export function releasePatches (): void { Element.prototype.append = globalEnv.rawAppend Element.prototype.prepend = globalEnv.rawPrepend Element.prototype.cloneNode = globalEnv.rawCloneNode - // Element.prototype.getBoundingClientRect = globalEnv.rawGetBoundingClientRect } // Set the style of micro-app-head and micro-app-body From 015e08d14c1e0f1d825195946b05926410e8a58a Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Mon, 28 Feb 2022 20:18:24 +0800 Subject: [PATCH 013/268] feat: add router.ts --- dev/children/react16/src/index.js | 6 +- dev/children/react16/src/router.js | 1 + dev/main-react16/src/pages/react16/react16.js | 8 +-- docs/zh-cn/configure.md | 4 +- docs/zh-cn/static-source.md | 2 + src/constants.ts | 2 +- src/interact/lifecycles_event.ts | 4 +- src/libs/global_env.ts | 4 +- src/libs/utils.ts | 16 +++++ src/sandbox/effect.ts | 20 +----- src/sandbox/index.ts | 40 +++++++++--- src/sandbox/router.ts | 61 +++++++++++++++++++ src/{source => sandbox}/scoped_css.ts | 0 src/source/index.ts | 2 +- src/source/links.ts | 2 +- src/source/patch.ts | 2 +- typings/global.d.ts | 8 +++ 17 files changed, 142 insertions(+), 40 deletions(-) create mode 100644 src/sandbox/router.ts rename src/{source => sandbox}/scoped_css.ts (100%) diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index 716bec293..38d02f3b2 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -107,15 +107,17 @@ window.addEventListener('unmount', function () { // console.log(`子应用${window.__MICRO_APP_NAME__}的setInterval`) // }, 1000) +// ---------------------- 创建元素 --------------------- // // const dynamicScript1 = document.createElement('script') // // dynamicScript1.setAttribute('type', 'module') // // dynamicScript1.textContent = 'console.warn('inline module')' -// dynamicScript1.setAttribute('src', 'http://127.0.0.1:8080/test.js') +// dynamicScript1.setAttribute('src', '//127.0.0.1:8080/test.js') // dynamicScript1.onload = () => { // console.log('动态module加载完成了') // } -// document.body.appendChild(dynamicScript1) +// document.head.appendChild(dynamicScript1) +// ---------------------- 全局变量 --------------------- // // console.log('__micro_app_environment__', window.__micro_app_environment__) // console.log('__micro_app_name__', window.__micro_app_name__) // console.log('__full_public_path__', window.__full_public_path__) diff --git a/dev/children/react16/src/router.js b/dev/children/react16/src/router.js index f619d053b..97e0fb0a6 100644 --- a/dev/children/react16/src/router.js +++ b/dev/children/react16/src/router.js @@ -17,6 +17,7 @@ function getDefaultKey () { return 'home' } + function App () { return ( diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index 6fc360218..e197a9fe0 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -187,10 +187,10 @@ export default class App extends React.Component { onAftershow={this.handleAftershow} onAfterhidden={this.handleAfterhidden} onDataChange={this.handleDataChange} - baseRoute='/micro-app/demo/react16' - keep-alive + // baseRoute='/micro-app/demo/react16' + // keep-alive // destroy - // inline + inline // disableSandbox // disable-sandbox // disableScopecss @@ -214,7 +214,7 @@ export default class App extends React.Component { diff --git a/docs/zh-cn/configure.md b/docs/zh-cn/configure.md index c4f2c9c33..f1a2d9a7d 100644 --- a/docs/zh-cn/configure.md +++ b/docs/zh-cn/configure.md @@ -36,12 +36,12 @@ - Default: `false` - 使用方式: `` -默认情况下,子应用的js会被提取并在后台运行。 +默认情况下,子应用的js会被提取并在后台运行,这会导致调试困难。 开启inline后,被提取的js会作为script标签插入应用中运行,在开发环境中更方便调试。 > [!NOTE] -> 开启inline后会稍微损耗性能,一般在开发环境中使用。 +> 开启inline后会稍微损耗性能,建议在开发环境中使用。 ## destroy - Desc: `卸载时是否强制删除缓存资源` diff --git a/docs/zh-cn/static-source.md b/docs/zh-cn/static-source.md index ff5e4c0f7..10288e495 100644 --- a/docs/zh-cn/static-source.md +++ b/docs/zh-cn/static-source.md @@ -28,6 +28,8 @@ 这是由webpack提供的功能,会在运行时动态设置webpack.publicPath,详细配置参考webpack文档 [publicPath](https://webpack.docschina.org/guides/public-path/#on-the-fly) +*如果你已经设置了publicPath为带域名的绝对地址(如:https://xxx),则忽略此章节* + #### 设置方式 **步骤1:** 在子应用src目录下创建名称为`public-path.js`的文件,并添加如下内容 diff --git a/src/constants.ts b/src/constants.ts index 2eb4ee36d..d748c24e2 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -33,4 +33,4 @@ export enum keepAliveStates { KEEP_ALIVE_HIDDEN = 'KEEP_ALIVE_HIDDEN', } -export const globalKeyToBeCached = 'window,self,globalThis,Array,Object,String,Boolean,Math,Number,Symbol,Date,Promise,Function,Proxy,WeakMap,WeakSet,Set,Map,Reflect,Element,Node,Document,RegExp,Error,TypeError,JSON,isNaN,parseFloat,parseInt,performance,console,decodeURI,encodeURI,decodeURIComponent,encodeURIComponent,location,navigator,undefined' +export const globalKeyToBeCached = 'window,self,globalThis,Array,Object,String,Boolean,Math,Number,Symbol,Date,Promise,Function,Proxy,WeakMap,WeakSet,Set,Map,Reflect,Element,Node,Document,RegExp,Error,TypeError,JSON,isNaN,parseFloat,parseInt,performance,console,decodeURI,encodeURI,decodeURIComponent,encodeURIComponent,navigator,undefined,location,history' diff --git a/src/interact/lifecycles_event.ts b/src/interact/lifecycles_event.ts index 24e4d1cf5..8dd30c54b 100644 --- a/src/interact/lifecycles_event.ts +++ b/src/interact/lifecycles_event.ts @@ -1,5 +1,5 @@ import microApp from '../micro_app' -import { logError, isFunction, removeDomScope, getRootContainer } from '../libs/utils' +import { logError, isFunction, removeDomScope, getRootContainer, assign } from '../libs/utils' function formatEventInfo (event: CustomEvent, element: HTMLElement): void { Object.defineProperties(event, { @@ -39,7 +39,7 @@ export default function dispatchLifecyclesEvent ( // clear dom scope before dispatch lifeCycles event to base app, especially mounted & unmount removeDomScope() - const detail = Object.assign({ + const detail = assign({ name: appName, container: element, }, error && { diff --git a/src/libs/global_env.ts b/src/libs/global_env.ts index 2f2a35509..50052b06a 100644 --- a/src/libs/global_env.ts +++ b/src/libs/global_env.ts @@ -1,4 +1,4 @@ -import { isSupportModuleScript, isBrowser, getCurrentAppName } from './utils' +import { isSupportModuleScript, isBrowser, getCurrentAppName, assign } from './utils' import { rejectMicroAppStyle } from '../source/patch' import { listenUmountOfNestedApp, releaseUnmountOfNestedApp } from '../libs/additional' @@ -94,7 +94,7 @@ export function initGlobalEnv (): void { // mark current application as base application window.__MICRO_APP_BASE_APPLICATION__ = true - Object.assign(globalEnv, { + assign(globalEnv, { // source/patch rawSetAttribute, rawAppendChild, diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 98132912f..61d7ce7c7 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -44,6 +44,7 @@ export function isFunction (target: unknown): boolean { // is Array export const isArray = Array.isArray +export const assign = Object.assign // is PlainObject export function isPlainObject (target: unknown): boolean { @@ -378,3 +379,18 @@ export function trim (str: string): string { export function isFireFox (): boolean { return navigator.userAgent.indexOf('Firefox') > -1 } + +// this events should be sent to the specified app +const formatEventList = ['unmount', 'appstate-change', 'popstate'] + +/** + * Format event name + * @param eventName event name + * @param appName app name + */ +export function formatEventName (eventName: string, appName: string): string { + if (formatEventList.includes(eventName)) { + return `${eventName}-${appName}` + } + return eventName +} diff --git a/src/sandbox/effect.ts b/src/sandbox/effect.ts index c447a881f..a73f47253 100644 --- a/src/sandbox/effect.ts +++ b/src/sandbox/effect.ts @@ -6,6 +6,7 @@ import { isFunction, isBoundFunction, rawDefineProperty, + formatEventName, } from '../libs/utils' import { appInstanceMap } from '../create_app' import globalEnv from '../libs/global_env' @@ -127,21 +128,6 @@ export function releaseEffectDocumentEvent (): void { document.removeEventListener = globalEnv.rawDocumentRemoveEventListener } -// this events should be sent to the specified app -const formatEventList = ['unmount', 'appstate-change'] - -/** - * Format event name - * @param type event name - * @param microAppWindow micro window - */ -function formatEventType (type: string, microAppWindow: microAppWindowType): string { - if (formatEventList.includes(type)) { - return `${type}-${microAppWindow.__MICRO_APP_NAME__}` - } - return type -} - /** * Rewrite side-effect events * @param microAppWindow micro window @@ -169,7 +155,7 @@ export default function effect (microAppWindow: microAppWindowType): Record rawHasOwnProperty.call(microAppWindow, key) || rawHasOwnProperty.call(globalEnv.rawWindow, key) this.setMappingPropertiesWithRawDescriptor(microAppWindow) this.setHijackProperties(microAppWindow, appName) + this.setRouterApi(microAppWindow, appName, url) } // properties associated with the native window @@ -350,14 +353,16 @@ export default class SandBox implements SandBoxInterface { let modifiedEval: unknown, modifiedImage: unknown rawDefineProperties(microAppWindow, { document: { + configurable: false, + enumerable: true, get () { throttleDeferForSetAppName(appName) return globalEnv.rawDocument }, - configurable: false, - enumerable: true, }, eval: { + configurable: true, + enumerable: false, get () { throttleDeferForSetAppName(appName) return modifiedEval || eval @@ -365,10 +370,10 @@ export default class SandBox implements SandBoxInterface { set: (value) => { modifiedEval = value }, - configurable: true, - enumerable: false, }, Image: { + configurable: true, + enumerable: false, get () { throttleDeferForSetAppName(appName) return modifiedImage || globalEnv.ImageProxy @@ -376,8 +381,29 @@ export default class SandBox implements SandBoxInterface { set: (value) => { modifiedImage = value }, + }, + }) + } + + private setRouterApi (microAppWindow: microAppWindowType, appName: string, url: string): void { + const { location, history } = createMicroRouter(appName, url) + rawDefineProperties(microAppWindow, { + location: { + configurable: false, + enumerable: true, + get () { + return location + }, + set: (value) => { + globalEnv.rawWindow.location = value + }, + }, + history: { configurable: true, - enumerable: false, + enumerable: true, + get () { + return history + }, }, }) } diff --git a/src/sandbox/router.ts b/src/sandbox/router.ts new file mode 100644 index 000000000..1d6993b2e --- /dev/null +++ b/src/sandbox/router.ts @@ -0,0 +1,61 @@ +import type { MicroRouter, MicroLocation } from '@micro-app/types' +import globalEnv from '../libs/global_env' +import { assign as oAssign, formatEventName } from '../libs/utils' + +type PopStateListener = (this: Window, e: PopStateEvent) => any + +function addHistoryListener (appName: string): CallableFunction { + // Send to the child app after receiving the popstate event + const popStateHandler: PopStateListener = (e: PopStateEvent) => { + // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 + const state = e.state?.microAppState?.[appName] || null + globalEnv.rawWindow.dispatchEvent( + new PopStateEvent(formatEventName('popstate', appName), { state }) + ) + } + + globalEnv.rawWindow.addEventListener('popstate', popStateHandler) + + return () => { + globalEnv.rawWindow.removeEventListener('popstate', popStateHandler) + } +} + +export default function createMicroRouter (appName: string, url: string): MicroRouter { + const rawLocation = globalEnv.rawWindow.location + const microLocation = new URL(url) as MicroLocation + + function assign (url: string | URL): void { + rawLocation.assign(url) + } + + function replace (url: string | URL): void { + rawLocation.replace(url) + } + + function reload (forcedReload?: boolean): void { + // @ts-ignore + rawLocation.reload(forcedReload) + } + + // microLocation.replace = rawLocation.replace + // microLocation.reload = rawLocation.reload + // microLocation.assign = rawLocation.assign + + oAssign(microLocation, { + assign, + replace, + reload + }) + + microLocation.assign = assign + microLocation.replace = replace + microLocation.reload = reload + + return { + location: microLocation, + // location: rawLocation, + history: window.history, + removeHistoryListener: addHistoryListener(appName) + } +} diff --git a/src/source/scoped_css.ts b/src/sandbox/scoped_css.ts similarity index 100% rename from src/source/scoped_css.ts rename to src/sandbox/scoped_css.ts diff --git a/src/source/index.ts b/src/source/index.ts index a36c07c5d..aee4033a9 100644 --- a/src/source/index.ts +++ b/src/source/index.ts @@ -3,7 +3,7 @@ import { fetchSource } from './fetch' import { logError, CompletionPath, pureCreateElement } from '../libs/utils' import { extractLinkFromHtml, fetchLinksFromHtml } from './links' import { extractScriptElement, fetchScriptsFromHtml } from './scripts' -import scopedCSS from './scoped_css' +import scopedCSS from '../sandbox/scoped_css' /** * transform html string to dom diff --git a/src/source/links.ts b/src/source/links.ts index 4ec7b81e5..26680b330 100644 --- a/src/source/links.ts +++ b/src/source/links.ts @@ -10,7 +10,7 @@ import { defer, logError, } from '../libs/utils' -import scopedCSS from './scoped_css' +import scopedCSS from '../sandbox/scoped_css' import { dispatchOnLoadEvent, dispatchOnErrorEvent, diff --git a/src/source/patch.ts b/src/source/patch.ts index 0cb92b398..781198dd7 100644 --- a/src/source/patch.ts +++ b/src/source/patch.ts @@ -11,7 +11,7 @@ import { isInvalidQuerySelectorKey, isUniqueElement, } from '../libs/utils' -import scopedCSS from './scoped_css' +import scopedCSS from '../sandbox/scoped_css' import { extractLinkFromHtml, formatDynamicLink } from './links' import { extractScriptElement, runScript, runDynamicRemoteScript } from './scripts' import microApp from '../micro_app' diff --git a/typings/global.d.ts b/typings/global.d.ts index 96c9e30a8..901bb1871 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -194,6 +194,14 @@ declare module '@micro-app/types' { // special CallableFunction for interact type CallableFunctionForInteract = CallableFunction & { __APP_NAME__?: string, __AUTO_TRIGGER__?: boolean } + + interface MicroLocation extends Location, URL {} + // interface MicroHistory extends History {} + interface MicroRouter { + location: MicroLocation + history: History + removeHistoryListener: CallableFunction + } } declare namespace JSX { From 540c4afdbe4e9aaaac2060291792d5cf11b95cfa Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 2 Mar 2022 20:18:00 +0800 Subject: [PATCH 014/268] feat: update router --- src/sandbox/effect.ts | 5 ++ src/sandbox/router.ts | 109 ++++++++++++++++++++++++++++++++---------- typings/global.d.ts | 18 +++++-- 3 files changed, 105 insertions(+), 27 deletions(-) diff --git a/src/sandbox/effect.ts b/src/sandbox/effect.ts index a73f47253..8f85610c9 100644 --- a/src/sandbox/effect.ts +++ b/src/sandbox/effect.ts @@ -10,6 +10,7 @@ import { } from '../libs/utils' import { appInstanceMap } from '../create_app' import globalEnv from '../libs/global_env' +import { addHistoryListener } from './router' type MicroEventListener = EventListenerOrEventListenerObject & Record type timeInfo = { @@ -278,8 +279,12 @@ export default function effect (microAppWindow: microAppWindowType): Record { + removeHistoryListener() // Clear window binding events if (eventListenerMap.size) { eventListenerMap.forEach((listenerList, type) => { diff --git a/src/sandbox/router.ts b/src/sandbox/router.ts index 1d6993b2e..901f4901e 100644 --- a/src/sandbox/router.ts +++ b/src/sandbox/router.ts @@ -1,27 +1,65 @@ -import type { MicroRouter, MicroLocation } from '@micro-app/types' +import type { MicroRouter, MicroLocation, MicroHistory, MicroState, HistoryProxyValue } from '@micro-app/types' import globalEnv from '../libs/global_env' import { assign as oAssign, formatEventName } from '../libs/utils' -type PopStateListener = (this: Window, e: PopStateEvent) => any +type PopStateListener = (this: Window, e: PopStateEvent) => void -function addHistoryListener (appName: string): CallableFunction { - // Send to the child app after receiving the popstate event - const popStateHandler: PopStateListener = (e: PopStateEvent) => { - // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 - const state = e.state?.microAppState?.[appName] || null - globalEnv.rawWindow.dispatchEvent( - new PopStateEvent(formatEventName('popstate', appName), { state }) - ) - } +// set micro app state to origin state +function createMicroState ( + appName: string, + rawState: MicroState, + microState: MicroState, +): MicroState { + // 生成新的microAppState,因为它们在第二层 + const newMicroAppState = oAssign({}, rawState?.microAppState, { + [appName]: microState + }) + // 生成新的state对象 + return oAssign({}, rawState, { + microAppState: newMicroAppState + }) +} - globalEnv.rawWindow.addEventListener('popstate', popStateHandler) +// get micro app state form origin state +function getMicroState (appName: string, state: MicroState): MicroState { + return state?.microAppState?.[appName] || null +} - return () => { - globalEnv.rawWindow.removeEventListener('popstate', popStateHandler) +// history of micro app +function createMicroHistory (appName: string, url: string): MicroHistory { + const rawHistory = globalEnv.rawWindow.history + + // 是否需要在每次调用时都创建一个函数?这样看起来麻烦,但是是函数式编程,看起来更优雅 + // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 + function bindFunctionOfHistory (methodName: PropertyKey): CallableFunction { + return (...rests: any[]) => { + if (methodName === 'pushState' || methodName === 'replaceState') { + // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! + // 经过格式化后的,包含某个微应用state的全量state + const newState = createMicroState(appName, rawHistory.state, rests[0]) + // eslint-disable-next-line + console.log(newState, url) + } + rawHistory[methodName](...rests) + } } + + const microHistory = new Proxy(rawHistory, { + get (target: Record, key: PropertyKey): HistoryProxyValue { + if (key === 'state') { + return getMicroState(appName, rawHistory.state) + } else if (typeof Reflect.get(target, key) === 'function') { + return bindFunctionOfHistory(key) + } + return Reflect.get(target, key) + }, + }) + + return microHistory } -export default function createMicroRouter (appName: string, url: string): MicroRouter { +// location of micro app +function createMicroLocation (url: string): MicroLocation { const rawLocation = globalEnv.rawWindow.location const microLocation = new URL(url) as MicroLocation @@ -38,24 +76,47 @@ export default function createMicroRouter (appName: string, url: string): MicroR rawLocation.reload(forcedReload) } - // microLocation.replace = rawLocation.replace - // microLocation.reload = rawLocation.reload - // microLocation.assign = rawLocation.assign - oAssign(microLocation, { assign, replace, reload }) - microLocation.assign = assign - microLocation.replace = replace - microLocation.reload = reload + return microLocation +} +export default function createMicroRouter (appName: string, url: string): MicroRouter { + const microLocation = createMicroLocation(url) + // const updateLocation = (path: string) => { + // oAssign(microLocation, new URL(path, url)) + // } return { location: microLocation, + // updateLocation, // location: rawLocation, - history: window.history, - removeHistoryListener: addHistoryListener(appName) + history: createMicroHistory(appName, url), + } +} + +/** + * register & release popstate event + * @param rawWindow origin window + * @param appName app name + * @returns release callback + */ +export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { + // Send to the child app after receiving the popstate event + const popStateHandler: PopStateListener = (e: PopStateEvent): void => { + // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 + const state = getMicroState(appName, e.state) + rawWindow.dispatchEvent( + new PopStateEvent(formatEventName('popstate', appName), { state }) + ) + } + + rawWindow.addEventListener('popstate', popStateHandler) + + return () => { + rawWindow.removeEventListener('popstate', popStateHandler) } } diff --git a/typings/global.d.ts b/typings/global.d.ts index 901bb1871..d8da13e25 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -196,11 +196,23 @@ declare module '@micro-app/types' { type CallableFunctionForInteract = CallableFunction & { __APP_NAME__?: string, __AUTO_TRIGGER__?: boolean } interface MicroLocation extends Location, URL {} - // interface MicroHistory extends History {} + type MicroHistory = ProxyHandler + type MicroState = any + type HistoryProxyValue = + Pick< + History, + 'length' | + 'scrollRestoration' | + 'state' | + 'back' | + 'forward' | + 'go' | + 'pushState' | + 'replaceState' + > | CallableFunction interface MicroRouter { location: MicroLocation - history: History - removeHistoryListener: CallableFunction + history: MicroHistory } } From 9ebee84752b4dc91e5d61b38518415b9e8adb297 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Tue, 8 Mar 2022 20:28:49 +0800 Subject: [PATCH 015/268] feat: update router --- .eslintignore | 1 + src/sandbox/router.ts | 164 ++++++++++++++++++++++++++++++++++++++++-- typings/global.d.ts | 10 +++ 3 files changed, 171 insertions(+), 4 deletions(-) diff --git a/.eslintignore b/.eslintignore index aa9977beb..f4d9ae8bf 100755 --- a/.eslintignore +++ b/.eslintignore @@ -6,3 +6,4 @@ node_modules /docs /plugins /src/__tests__/demos +/src/sandbox/router.ts diff --git a/src/sandbox/router.ts b/src/sandbox/router.ts index 901f4901e..021b30126 100644 --- a/src/sandbox/router.ts +++ b/src/sandbox/router.ts @@ -1,6 +1,20 @@ -import type { MicroRouter, MicroLocation, MicroHistory, MicroState, HistoryProxyValue } from '@micro-app/types' +import type { + MicroRouter, + MicroLocation, + MicroHistory, + MicroState, + HistoryProxyValue, + LocationQueryValue, + LocationQuery, + LocationQueryObject, +} from '@micro-app/types' import globalEnv from '../libs/global_env' -import { assign as oAssign, formatEventName } from '../libs/utils' +import { + assign as oAssign, + formatEventName, + isArray, + isNull, +} from '../libs/utils' type PopStateListener = (this: Window, e: PopStateEvent) => void @@ -37,8 +51,7 @@ function createMicroHistory (appName: string, url: string): MicroHistory { // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! // 经过格式化后的,包含某个微应用state的全量state const newState = createMicroState(appName, rawHistory.state, rests[0]) - // eslint-disable-next-line - console.log(newState, url) + } rawHistory[methodName](...rests) } @@ -85,11 +98,154 @@ function createMicroLocation (url: string): MicroLocation { return microLocation } +const ENC_AD_RE = /&/g // %M1 +const ENC_EQ_RE = /=/g // %M2 +const DEC_AD_RE = /%M1/g // & +const DEC_EQ_RE = /%M2/g // = + +function encodeMicroPath (path: string): string { + return encodeURIComponent(commonDecode(path).replace(ENC_AD_RE, '%M1').replace(ENC_EQ_RE, '%M2')) +} + +function decodeMicroPath (path: string): string { + return commonDecode(path).replace(DEC_AD_RE, '&').replace(DEC_EQ_RE, '=') +} + +function commonDecode (path: string): string { + try { + const decPath = decodeURIComponent(path) + if (path === decPath || DEC_AD_RE.test(decPath) || DEC_EQ_RE.test(decPath)) return decPath + return commonDecode(decPath) + } catch { + return path + } +} + +// 更新url地址有以下几种情况: +// 1、页面初始化 +// 2、子应用页面内部发生跳转 +// 3、通过micro-app api进行跳转 + +// 更新location有以下几种情况,根据url地址进行更新: +// 1、页面初始化 +// 2、子应用页面内部发生跳转 +// 3、通过micro-app api进行跳转 +// 4、popstate事件 +// const { pathname, search, hash } = location +// pathname + search + hash +// 如果有hash,则参数加在hash后面(默认为hash路由),如果没有hash,则加在query上(默认history路由) +// 特殊情况:history路由有hash,hash路由没有hash -- 不管 +function updateLocationFromURL () { + const url = globalEnv.rawWindow.location +} + +// 在初始化时,先从url上取当前子应用的路由信息 +// 如果存在则根据存在的信息更新location,如果没有,则更新url地址 +function attachRouteInfoToURL (appName: string, microLocation: MicroLocation) { + const { pathname, search, hash } = microLocation + const encodedMicroPath = encodeMicroPath(pathname + search + hash) + const fullPath = attachQueryToURL(appName, encodedMicroPath) + const rawHistory = globalEnv.rawWindow.history + globalEnv.rawWindow.history.replaceState( + createMicroState(appName, rawHistory.state, getMicroState(appName, rawHistory.state)), + null, + fullPath, + ) +} + +function attachQueryToURL (appName: string, encodedMicroPath: string): string { + let { pathname, search, hash } = globalEnv.rawWindow.location + const microQueryObject = getQueryObjectFromURL() + + if (microQueryObject.hashQuery) { + microQueryObject.hashQuery[appName] = encodedMicroPath + hash = hash.slice(0, hash.indexOf('?') + 1) + stringifyQuery(microQueryObject.hashQuery) + } else { + if (microQueryObject.searchQuery) { + microQueryObject.searchQuery[appName] = encodedMicroPath + } else { + microQueryObject.searchQuery = { + [appName]: encodedMicroPath + } + } + search = '?' + stringifyQuery(microQueryObject.searchQuery) + } + + return pathname + search + hash +} + +/** + * 根据location获取query对象 + */ +function getQueryObjectFromURL (): LocationQuery { + const { search, hash } = globalEnv.rawWindow.location + const microQueryObject: LocationQuery = {} + + if (search !== '' && search !== '?') { + microQueryObject.searchQuery = parseQuery(search.slice(1)) + } + + if (hash.includes('?')) { + microQueryObject.hashQuery = parseQuery(hash.slice(hash.indexOf('?') + 1)) + } + + return microQueryObject +} + +function parseQuery (search: string): LocationQueryObject { + const result: LocationQueryObject = {} + const queryList = search.split('&') + + // 注意我们不会对key和value进行解码,以确保替换url时前后值一致 + // 我们只对匹配到的微应用的key和value在后续进行编解码 + for (const queryItem of queryList) { + const eqPos = queryItem.indexOf('=') + const key = eqPos < 0 ? queryItem : queryItem.slice(0, eqPos) + const value = eqPos < 0 ? null : queryItem.slice(eqPos + 1) + + if (key in result) { + let currentValue = result[key] + if (!isArray(currentValue)) { + currentValue = result[key] = [currentValue] + } + currentValue.push(value) + } else { + result[key] = value + } + } + + return result +} + +// 一次只能格式化一个,所以search和hash需要分2次处理 +function stringifyQuery (queryObject: LocationQueryObject): string { + let result = '' + + for (const key in queryObject) { + const value = queryObject[key] + if (isNull(value)) { + result += (result.length ? '&' : '') + key + } else { + const valueList: LocationQueryValue[] = isArray(value) ? value : [value] + + valueList.forEach(value => { + result += (result.length ? '&' : '') + key + if (value != null) result += '=' + value + }) + } + } + + return result +} + export default function createMicroRouter (appName: string, url: string): MicroRouter { const microLocation = createMicroLocation(url) // const updateLocation = (path: string) => { // oAssign(microLocation, new URL(path, url)) // } + + // 初始化信息 + attachRouteInfoToURL(appName, microLocation) return { location: microLocation, // updateLocation, diff --git a/typings/global.d.ts b/typings/global.d.ts index d8da13e25..ba92a7c98 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -214,6 +214,16 @@ declare module '@micro-app/types' { location: MicroLocation history: MicroHistory } + type LocationQueryValue = string | null + type LocationQueryObject = Record< + string, + LocationQueryValue | LocationQueryValue[] + > + + type LocationQuery = { + hashQuery?: LocationQueryObject, + searchQuery?: LocationQueryObject + } } declare namespace JSX { From e284e00aa5ef47992f057783dd833122b1eefb02 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 9 Mar 2022 23:43:11 +0800 Subject: [PATCH 016/268] feat: update router at 2022.3.9 --- dev/children/react16/src/index.js | 2 + dev/children/react16/src/router.js | 16 +- dev/children/vue2/src/App.vue | 8 +- .../src/pages/multiple/multiple.js | 2 +- dev/main-react16/src/pages/vue3/vue3.js | 2 +- src/sandbox/index.ts | 36 +- src/sandbox/router.ts | 315 ++++++++++++------ 7 files changed, 258 insertions(+), 123 deletions(-) diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index 38d02f3b2..dcc80a5be 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -55,6 +55,8 @@ ReactDOM.render( // 监听卸载 window.addEventListener('unmount', function () { + console.log(888888888, document.getElementById('root')) + debugger ReactDOM.unmountComponentAtNode(document.getElementById('root')); console.log('微应用react16卸载了 -- 自定义事件unmount'); }) diff --git a/dev/children/react16/src/router.js b/dev/children/react16/src/router.js index 97e0fb0a6..02e7a28b4 100644 --- a/dev/children/react16/src/router.js +++ b/dev/children/react16/src/router.js @@ -1,4 +1,4 @@ -import React, { lazy, Suspense } from 'react' +import React, { lazy, Suspense, useState, useEffect } from 'react' import { BrowserRouter, Switch, Route, Redirect, Link, HashRouter } from 'react-router-dom' import Page1 from './pages/page1/page1' import { Menu } from 'antd'; @@ -19,12 +19,24 @@ function getDefaultKey () { function App () { + const [selectedKey, changeSelectedKey ] = useState(getDefaultKey()) + function handleSelect ({ selectedKeys }) { + changeSelectedKey(selectedKeys[0]) + } + useEffect(() => { + const handlePopstate = () => changeSelectedKey(getDefaultKey()) + window.addEventListener('popstate', handlePopstate) + return () => { + window.removeEventListener('popstate', handlePopstate) + } + }, []) return ( }> home diff --git a/dev/children/vue2/src/App.vue b/dev/children/vue2/src/App.vue index 1860834d2..9c6f7659d 100644 --- a/dev/children/vue2/src/App.vue +++ b/dev/children/vue2/src/App.vue @@ -16,11 +16,13 @@ export default { name: 'App', data () { return { - activeName: window.location.href.includes('#/page2') ? 'page2': '/', + activeName: location.href.includes('#/page2') ? 'page2': '/', } }, - created () { - + mounted () { + window.addEventListener('popstate', () => { + this.activeName =location.href.includes('#/page2') ? 'page2': '/' + }) }, components: { diff --git a/dev/main-react16/src/pages/multiple/multiple.js b/dev/main-react16/src/pages/multiple/multiple.js index ae3138027..128719957 100644 --- a/dev/main-react16/src/pages/multiple/multiple.js +++ b/dev/main-react16/src/pages/multiple/multiple.js @@ -42,7 +42,7 @@ function Vue3 () { name={reactname} url={`${config.react16}micro-app/react16`} data={data} - baseRoute='/micro-app/demo/multiple' + // baseRoute='/micro-app/demo/multiple' onMounted={() => hideLoading(false)} // destroy // inline diff --git a/dev/main-react16/src/pages/vue3/vue3.js b/dev/main-react16/src/pages/vue3/vue3.js index 2b21d5b0e..6765b3d3a 100644 --- a/dev/main-react16/src/pages/vue3/vue3.js +++ b/dev/main-react16/src/pages/vue3/vue3.js @@ -23,7 +23,7 @@ function Vue3 () { data={data} onMounted={() => hideLoading(false)} onBeforeshow={() => hideLoading(false)} - baseRoute='/micro-app/demo/vue3' + // baseRoute='/micro-app/demo/vue3' // disableScopecss // keep-alive // inline diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 011715273..0e51656e5 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -1,4 +1,4 @@ -import type { microAppWindowType, SandBoxInterface, plugins } from '@micro-app/types' +import type { microAppWindowType, SandBoxInterface, plugins, MicroLocation } from '@micro-app/types' import { EventCenterForMicroApp, rebuildDataCenterSnapshot, recordDataCenterSnapshot } from '../interact' @@ -28,11 +28,12 @@ import { patchElementPrototypeMethods, releasePatches, } from '../source/patch' -import createMicroRouter from './router' +import createMicroRouter, { initialActionForRoute, clearRouterStateFromURL } from './router' export type MicroAppWindowDataType = { __MICRO_APP_ENVIRONMENT__: boolean __MICRO_APP_NAME__: string + __MICRO_APP_URL__: string __MICRO_APP_PUBLIC_PATH__: string __MICRO_APP_BASE_URL__: string __MICRO_APP_BASE_ROUTE__: string @@ -78,7 +79,7 @@ export default class SandBox implements SandBoxInterface { private recordUmdInjectedValues?: Map // sandbox state private active = false - proxyWindow: WindowProxy // Proxy + proxyWindow: WindowProxy & MicroAppWindowDataType // Proxy microAppWindow = {} as MicroAppWindowType // Proxy target constructor (appName: string, url: string) { @@ -92,9 +93,10 @@ export default class SandBox implements SandBoxInterface { assign(this, effect(this.microAppWindow)) } - start (baseRoute: string): void { + public start (baseRoute: string): void { if (!this.active) { this.active = true + this.initRouteState() this.microAppWindow.__MICRO_APP_BASE_ROUTE__ = this.microAppWindow.__MICRO_APP_BASE_URL__ = baseRoute // BUG FIX: bable-polyfill@6.x globalEnv.rawWindow._babelPolyfill && (globalEnv.rawWindow._babelPolyfill = false) @@ -105,9 +107,8 @@ export default class SandBox implements SandBoxInterface { } } - stop (): void { + public stop (keepRouteState?: boolean): void { if (this.active) { - this.active = false this.releaseEffect() this.microAppWindow.microApp.clearDataListener() this.microAppWindow.microApp.clearGlobalDataListener() @@ -122,15 +123,17 @@ export default class SandBox implements SandBoxInterface { }) this.escapeKeys.clear() + if (!keepRouteState) this.clearRouteState() if (--SandBox.activeCount === 0) { releaseEffectDocumentEvent() releasePatches() } + this.active = false } } // record umd snapshot before the first execution of umdHookMount - recordUmdSnapshot (): void { + public recordUmdSnapshot (): void { this.microAppWindow.__MICRO_APP_UMD_MODE__ = true this.recordUmdEffect() recordDataCenterSnapshot(this.microAppWindow.microApp) @@ -142,7 +145,7 @@ export default class SandBox implements SandBoxInterface { } // rebuild umd snapshot before remount umd app - rebuildUmdSnapshot (): void { + public rebuildUmdSnapshot (): void { this.recordUmdInjectedValues!.forEach((value: unknown, key: PropertyKey) => { Reflect.set(this.proxyWindow, key, value) }) @@ -150,6 +153,22 @@ export default class SandBox implements SandBoxInterface { rebuildDataCenterSnapshot(this.microAppWindow.microApp) } + public initRouteState (): void { + initialActionForRoute( + this.proxyWindow.__MICRO_APP_NAME__, + this.proxyWindow.__MICRO_APP_URL__, + this.proxyWindow.location as MicroLocation, + ) + } + + public clearRouteState (): void { + clearRouterStateFromURL( + this.proxyWindow.__MICRO_APP_NAME__, + this.proxyWindow.__MICRO_APP_URL__, + this.proxyWindow.location as MicroLocation, + ) + } + /** * get scopeProperties and escapeProperties from plugins * @param appName app name @@ -290,6 +309,7 @@ export default class SandBox implements SandBoxInterface { private initMicroAppWindow (microAppWindow: microAppWindowType, appName: string, url: string): void { microAppWindow.__MICRO_APP_ENVIRONMENT__ = true microAppWindow.__MICRO_APP_NAME__ = appName + microAppWindow.__MICRO_APP_URL__ = url microAppWindow.__MICRO_APP_PUBLIC_PATH__ = getEffectivePath(url) microAppWindow.__MICRO_APP_WINDOW__ = microAppWindow microAppWindow.microApp = assign(new EventCenterForMicroApp(appName), { diff --git a/src/sandbox/router.ts b/src/sandbox/router.ts index 021b30126..aafe1802e 100644 --- a/src/sandbox/router.ts +++ b/src/sandbox/router.ts @@ -14,10 +14,61 @@ import { formatEventName, isArray, isNull, + isString, + isUndefined, + logError, } from '../libs/utils' +import { appInstanceMap } from '../create_app' + +// 更新url地址有以下几种情况: +// 1、页面初始化 +// 2、子应用页面内部发生跳转 +// 3、通过micro-app api进行跳转 + +// 更新location有以下几种情况,根据url地址进行更新: +// 1、页面初始化 +// 2、子应用页面内部发生跳转 +// 3、通过micro-app api进行跳转 +// 4、popstate事件 +// const { pathname, search, hash } = location +// pathname + search + hash +// 如果有hash,则参数加在hash后面(默认为hash路由),如果没有hash,则加在query上(默认history路由) +// 特殊情况:history路由有hash,hash路由没有hash -- 不管 type PopStateListener = (this: Window, e: PopStateEvent) => void +/** + * register & release popstate event + * @param rawWindow origin window + * @param appName app name + * @returns release callback + */ + export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { + // Send to the child app after receiving the popstate event + const popStateHandler: PopStateListener = (e: PopStateEvent): void => { + // 先更新location,再发送popstate事件 + const microPath = getMicroPathFromURL(appName) + const app = appInstanceMap.get(appName) + if (microPath && app) { + // @ts-ignore + updateLocation(microPath, app.url, app.sandBox.proxyWindow.location) + // @ts-ignore + console.log(333333, microPath, app.sandBox.proxyWindow.location) + } + // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 + const state = getMicroState(appName, e.state) + rawWindow.dispatchEvent( + new PopStateEvent(formatEventName('popstate', appName), { state }) + ) + } + + rawWindow.addEventListener('popstate', popStateHandler) + + return () => { + rawWindow.removeEventListener('popstate', popStateHandler) + } +} + // set micro app state to origin state function createMicroState ( appName: string, @@ -39,21 +90,45 @@ function getMicroState (appName: string, state: MicroState): MicroState { return state?.microAppState?.[appName] || null } +// delete micro app state form origin state +function deleteMicroState (appName: string, rawState: MicroState): MicroState { + if (rawState?.microAppState?.[appName]) { + delete rawState.microAppState[appName] + } + // 生成新的state对象 + return oAssign({}, rawState) +} + // history of micro app -function createMicroHistory (appName: string, url: string): MicroHistory { +function createMicroHistory (appName: string, base: string, microLocation: MicroLocation): MicroHistory { const rawHistory = globalEnv.rawWindow.history // 是否需要在每次调用时都创建一个函数?这样看起来麻烦,但是是函数式编程,看起来更优雅 // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 - function bindFunctionOfHistory (methodName: PropertyKey): CallableFunction { + function microHistoryMethod (methodName: PropertyKey): CallableFunction { return (...rests: any[]) => { - if (methodName === 'pushState' || methodName === 'replaceState') { - // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! - // 经过格式化后的,包含某个微应用state的全量state - const newState = createMicroState(appName, rawHistory.state, rests[0]) - + console.log(444444444, rests[0], rests[1], rests[2], methodName) + let targetPath = null + // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! + if ((methodName === 'pushState' || methodName === 'replaceState') && rests[2] && isString(rests[2])) { + try { + const targetLocation = new URL(rests[2], base) as MicroLocation + if (targetLocation.origin === microLocation.origin) { + targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash + // 经过格式化后的,包含某个微应用state的全量state + const newState = createMicroState(appName, rawHistory.state, rests[0]) + rests = [newState, rests[1], attachMicroQueryToURL(appName, targetLocation)] + } + } catch (e) { + logError(e, appName) + } } + rawHistory[methodName](...rests) + + if (targetPath) updateLocation(targetPath, base, microLocation) + + console.log(5555555, microLocation, base) } } @@ -62,7 +137,7 @@ function createMicroHistory (appName: string, url: string): MicroHistory { if (key === 'state') { return getMicroState(appName, rawHistory.state) } else if (typeof Reflect.get(target, key) === 'function') { - return bindFunctionOfHistory(key) + return microHistoryMethod(key) } return Reflect.get(target, key) }, @@ -71,33 +146,6 @@ function createMicroHistory (appName: string, url: string): MicroHistory { return microHistory } -// location of micro app -function createMicroLocation (url: string): MicroLocation { - const rawLocation = globalEnv.rawWindow.location - const microLocation = new URL(url) as MicroLocation - - function assign (url: string | URL): void { - rawLocation.assign(url) - } - - function replace (url: string | URL): void { - rawLocation.replace(url) - } - - function reload (forcedReload?: boolean): void { - // @ts-ignore - rawLocation.reload(forcedReload) - } - - oAssign(microLocation, { - assign, - replace, - reload - }) - - return microLocation -} - const ENC_AD_RE = /&/g // %M1 const ENC_EQ_RE = /=/g // %M2 const DEC_AD_RE = /%M1/g // & @@ -121,45 +169,36 @@ function commonDecode (path: string): string { } } -// 更新url地址有以下几种情况: -// 1、页面初始化 -// 2、子应用页面内部发生跳转 -// 3、通过micro-app api进行跳转 - -// 更新location有以下几种情况,根据url地址进行更新: -// 1、页面初始化 -// 2、子应用页面内部发生跳转 -// 3、通过micro-app api进行跳转 -// 4、popstate事件 -// const { pathname, search, hash } = location -// pathname + search + hash -// 如果有hash,则参数加在hash后面(默认为hash路由),如果没有hash,则加在query上(默认history路由) -// 特殊情况:history路由有hash,hash路由没有hash -- 不管 -function updateLocationFromURL () { - const url = globalEnv.rawWindow.location -} - -// 在初始化时,先从url上取当前子应用的路由信息 -// 如果存在则根据存在的信息更新location,如果没有,则更新url地址 -function attachRouteInfoToURL (appName: string, microLocation: MicroLocation) { - const { pathname, search, hash } = microLocation - const encodedMicroPath = encodeMicroPath(pathname + search + hash) - const fullPath = attachQueryToURL(appName, encodedMicroPath) - const rawHistory = globalEnv.rawWindow.history - globalEnv.rawWindow.history.replaceState( - createMicroState(appName, rawHistory.state, getMicroState(appName, rawHistory.state)), - null, - fullPath, - ) +// 根据浏览器url参数,获取当前子应用的fullPath +function getMicroPathFromURL (appName: string): string | null { + const rawLocation = globalEnv.rawWindow.location + const queryObject = getQueryObjectFromURL(rawLocation.search, rawLocation.hash) + const microPath = queryObject.hashQuery?.[appName] || queryObject.searchQuery?.[appName] + // 解码 + return microPath ? decodeMicroPath(microPath as string) : null } -function attachQueryToURL (appName: string, encodedMicroPath: string): string { +// 将name=encodeUrl地址插入到浏览器url上 +function attachMicroQueryToURL (appName: string, microLocation: MicroLocation): string { let { pathname, search, hash } = globalEnv.rawWindow.location - const microQueryObject = getQueryObjectFromURL() + const microQueryObject = getQueryObjectFromURL(search, hash) + const encodedMicroPath = encodeMicroPath( + microLocation.pathname + + microLocation.search + + microLocation.hash + ) - if (microQueryObject.hashQuery) { - microQueryObject.hashQuery[appName] = encodedMicroPath - hash = hash.slice(0, hash.indexOf('?') + 1) + stringifyQuery(microQueryObject.hashQuery) + // hash存在且search不存在,则认为是hash路由 + if (hash && !search) { + if (microQueryObject.hashQuery) { + microQueryObject.hashQuery[appName] = encodedMicroPath + } else { + microQueryObject.hashQuery = { + [appName]: encodedMicroPath + } + } + const baseHash = hash.includes('?') ? hash.slice(0, hash.indexOf('?') + 1) : hash + '?' + hash = baseHash + stringifyQuery(microQueryObject.hashQuery) } else { if (microQueryObject.searchQuery) { microQueryObject.searchQuery[appName] = encodedMicroPath @@ -174,24 +213,42 @@ function attachQueryToURL (appName: string, encodedMicroPath: string): string { return pathname + search + hash } +// 将name=encodeUrl的参数从浏览器url上删除 +function removeMicroQueryFromURL (appName: string): string { + let { pathname, search, hash } = globalEnv.rawWindow.location + const microQueryObject = getQueryObjectFromURL(search, hash) + + if (microQueryObject.hashQuery?.[appName]) { + delete microQueryObject.hashQuery?.[appName] + const hashQueryStr = stringifyQuery(microQueryObject.hashQuery) + hash = hash.slice(0, hash.indexOf('?') + Number(Boolean(hashQueryStr))) + hashQueryStr + } else if (microQueryObject.searchQuery?.[appName]) { + delete microQueryObject.searchQuery?.[appName] + const searchQueryStr = stringifyQuery(microQueryObject.searchQuery) + search = searchQueryStr ? '?' + searchQueryStr : '' + } + + return pathname + search + hash +} + /** * 根据location获取query对象 */ -function getQueryObjectFromURL (): LocationQuery { - const { search, hash } = globalEnv.rawWindow.location - const microQueryObject: LocationQuery = {} +function getQueryObjectFromURL (search: string, hash: string): LocationQuery { + const queryObject: LocationQuery = {} if (search !== '' && search !== '?') { - microQueryObject.searchQuery = parseQuery(search.slice(1)) + queryObject.searchQuery = parseQuery(search.slice(1)) } if (hash.includes('?')) { - microQueryObject.hashQuery = parseQuery(hash.slice(hash.indexOf('?') + 1)) + queryObject.hashQuery = parseQuery(hash.slice(hash.indexOf('?') + 1)) } - return microQueryObject + return queryObject } +// 将参数字符串转换为对象 function parseQuery (search: string): LocationQueryObject { const result: LocationQueryObject = {} const queryList = search.split('&') @@ -217,7 +274,7 @@ function parseQuery (search: string): LocationQueryObject { return result } -// 一次只能格式化一个,所以search和hash需要分2次处理 +// 将对象转换为字符串,一次只能格式化一个,所以search和hash需要分2次处理 function stringifyQuery (queryObject: LocationQueryObject): string { let result = '' @@ -229,8 +286,10 @@ function stringifyQuery (queryObject: LocationQueryObject): string { const valueList: LocationQueryValue[] = isArray(value) ? value : [value] valueList.forEach(value => { - result += (result.length ? '&' : '') + key - if (value != null) result += '=' + value + if (!isUndefined(value)) { + result += (result.length ? '&' : '') + key + if (!isNull(value)) result += '=' + value + } }) } } @@ -238,41 +297,81 @@ function stringifyQuery (queryObject: LocationQueryObject): string { return result } -export default function createMicroRouter (appName: string, url: string): MicroRouter { - const microLocation = createMicroLocation(url) - // const updateLocation = (path: string) => { - // oAssign(microLocation, new URL(path, url)) - // } +// location of micro app +// 只会在沙箱初始化时执行一次 +function createMicroLocation (url: string): MicroLocation { + const rawLocation = globalEnv.rawWindow.location + const microLocation = new URL(url) as MicroLocation - // 初始化信息 - attachRouteInfoToURL(appName, microLocation) - return { - location: microLocation, - // updateLocation, - // location: rawLocation, - history: createMicroHistory(appName, url), + function assign (url: string | URL): void { + rawLocation.assign(url) + } + + function replace (url: string | URL): void { + rawLocation.replace(url) + } + + function reload (forcedReload?: boolean): void { + // @ts-ignore + rawLocation.reload(forcedReload) } + + oAssign(microLocation, { + assign, + replace, + reload + }) + + return microLocation } -/** - * register & release popstate event - * @param rawWindow origin window - * @param appName app name - * @returns release callback - */ -export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { - // Send to the child app after receiving the popstate event - const popStateHandler: PopStateListener = (e: PopStateEvent): void => { - // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 - const state = getMicroState(appName, e.state) - rawWindow.dispatchEvent( - new PopStateEvent(formatEventName('popstate', appName), { state }) - ) +// origin is readonly, so we ignore it +const LocationKeys = ['hash', 'host', 'hostname', 'href', 'password', 'pathname', 'port', 'protocol', 'search'] +function updateLocation (path: string, base: string, microLocation: MicroLocation) { + const newLocation = new URL(path, base) + for (const key of LocationKeys) { + // @ts-ignore + microLocation[key] = newLocation[key] } +} - rawWindow.addEventListener('popstate', popStateHandler) +// 更新浏览器url +function updateBrowserURL (state: MicroState, fullPath: string): void { + globalEnv.rawWindow.history.replaceState(state, null, fullPath) +} - return () => { - rawWindow.removeEventListener('popstate', popStateHandler) +// 当沙箱执行start, 或者隐藏的keep-alive应用重新渲染时时才:根据浏览器url更新location 或者 将参数更新到url上 +export function initialActionForRoute (appName: string, url: string, microLocation: MicroLocation) { + const microPath = getMicroPathFromURL(appName) + // 如果初始化时参数有子应用的数据信息,则直接复用,如果没有则重新创建 + + if (microPath) { + updateLocation(microPath, url, microLocation) + } else { + const fullPath = attachMicroQueryToURL(appName, microLocation) + // 下面需要优化,代码太繁琐了 + const rawHistory = globalEnv.rawWindow.history + const historyState = createMicroState(appName, rawHistory.state, getMicroState(appName, rawHistory.state)) + updateBrowserURL(historyState, fullPath) + } +} + +export function clearRouterStateFromURL (appName: string, url: string, microLocation: MicroLocation) { + // 初始化location信息 + const { pathname, search, hash } = new URL(url) + updateLocation(pathname + search + hash, url, microLocation) + // 删除浏览器url上的子应用参数 + const fullPath = removeMicroQueryFromURL(appName) + const rawHistory = globalEnv.rawWindow.history + const historyState = deleteMicroState(appName, rawHistory.state) + updateBrowserURL(historyState, fullPath) +} + +export default function createMicroRouter (appName: string, url: string): MicroRouter { + const microLocation = createMicroLocation(url) + + return { + location: microLocation, + history: createMicroHistory(appName, url, microLocation), } } From f5a5353ddad3e103927493568dd88aa0babcc184 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Thu, 10 Mar 2022 22:49:43 +0800 Subject: [PATCH 017/268] feat: update router at 2022.3.10 --- dev/children/react16/src/index.js | 2 - .../react16/src/pages/inline/inline.js | 2 +- dev/children/vue2/src/main.js | 6 +- dev/main-react16/config/config.js | 2 +- dev/main-react16/src/global.jsx | 23 +-- .../src/pages/angular11/angular11.js | 2 +- dev/main-react16/src/pages/react16/react16.js | 6 +- docs/zh-cn/changelog.md | 17 ++ src/__tests__/libs/additional.test.ts | 87 ---------- src/__tests__/sandbox/index.test.ts | 12 +- src/create_app.ts | 38 +++-- src/interact/lifecycles_event.ts | 3 +- src/libs/additional.ts | 27 ---- src/libs/global_env.ts | 31 +++- src/libs/utils.ts | 64 ++++++-- src/micro_app.ts | 21 ++- src/micro_app_element.ts | 27 +++- src/prefetch.ts | 4 +- src/sandbox/{router.ts => __save__router.ts} | 95 +++++------ src/sandbox/effect.ts | 27 +++- src/sandbox/index.ts | 102 ++++++++---- src/sandbox/router/core.ts | 148 ++++++++++++++++++ src/sandbox/router/event.ts | 42 +++++ src/sandbox/router/history.ts | 69 ++++++++ src/sandbox/router/index.ts | 59 +++++++ src/sandbox/router/location.ts | 47 ++++++ src/source/patch.ts | 4 + typings/global.d.ts | 14 +- 28 files changed, 698 insertions(+), 283 deletions(-) delete mode 100644 src/__tests__/libs/additional.test.ts delete mode 100644 src/libs/additional.ts rename src/sandbox/{router.ts => __save__router.ts} (79%) create mode 100644 src/sandbox/router/core.ts create mode 100644 src/sandbox/router/event.ts create mode 100644 src/sandbox/router/history.ts create mode 100644 src/sandbox/router/index.ts create mode 100644 src/sandbox/router/location.ts diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index dcc80a5be..38d02f3b2 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -55,8 +55,6 @@ ReactDOM.render( // 监听卸载 window.addEventListener('unmount', function () { - console.log(888888888, document.getElementById('root')) - debugger ReactDOM.unmountComponentAtNode(document.getElementById('root')); console.log('微应用react16卸载了 -- 自定义事件unmount'); }) diff --git a/dev/children/react16/src/pages/inline/inline.js b/dev/children/react16/src/pages/inline/inline.js index b66a3000f..a5817b554 100644 --- a/dev/children/react16/src/pages/inline/inline.js +++ b/dev/children/react16/src/pages/inline/inline.js @@ -32,7 +32,7 @@ function Vue2 () { // onBeforemount={() => hideLoading(false)} onMounted={() => hideLoading(false)} // shadowDOM - destory + // destory // inline // disableScopecss // disableSandbox diff --git a/dev/children/vue2/src/main.js b/dev/children/vue2/src/main.js index c3e11956a..b6eef461c 100644 --- a/dev/children/vue2/src/main.js +++ b/dev/children/vue2/src/main.js @@ -36,7 +36,7 @@ let app = null // -------------------分割线-umd模式------------------ // -export async function mount (props) { +export function mount (props) { app = new Vue({ router, render: h => h(App), @@ -45,14 +45,14 @@ export async function mount (props) { } // 卸载应用 -export async function unmount () { +export function unmount () { app.$destroy() app.$el.innerHTML = '' app = null console.log("微应用vue2卸载了 -- 来自umd-unmount") } -export async function bootstrap() { +export function bootstrap() { } diff --git a/dev/main-react16/config/config.js b/dev/main-react16/config/config.js index d6c396b36..3d45ec1d0 100644 --- a/dev/main-react16/config/config.js +++ b/dev/main-react16/config/config.js @@ -14,7 +14,7 @@ export default defineConfig({ hmr: true, }, history: { - type: 'browser', + type: 'hash', // browser }, locale: { // default zh-CN diff --git a/dev/main-react16/src/global.jsx b/dev/main-react16/src/global.jsx index d5b96fb40..2d698667b 100644 --- a/dev/main-react16/src/global.jsx +++ b/dev/main-react16/src/global.jsx @@ -63,22 +63,13 @@ microApp.start({ react16: [{ scopeProperties: ['scopeKey3', 'scopeKey4'], escapeProperties: ['escapeKey3', 'escapeKey4'], - loader(code, url) { - if (process.env.NODE_ENV === 'development' && code.indexOf('sockjs-node') > -1) { - console.log('react16插件', url) - code = code.replace('window.location.port', '3001') - } - return code - } - }], - react17: [{ - loader(code, url) { - if (process.env.NODE_ENV === 'development' && code.indexOf('sockjs-node') > -1) { - console.log('react17插件', url) - code = code.replace('window.location.port', '3002') - } - return code - } + // loader(code, url) { + // if (process.env.NODE_ENV === 'development' && code.indexOf('sockjs-node') > -1) { + // console.log('react16插件', url) + // code = code.replace('window.location.port', '3001') + // } + // return code + // } }], vue2: [{ scopeProperties: ['scopeKey5', 'scopeKey6'], diff --git a/dev/main-react16/src/pages/angular11/angular11.js b/dev/main-react16/src/pages/angular11/angular11.js index e2a2d8b19..47be30308 100644 --- a/dev/main-react16/src/pages/angular11/angular11.js +++ b/dev/main-react16/src/pages/angular11/angular11.js @@ -23,7 +23,7 @@ function Angular11 () { url={`${config.angular11}micro-app/angular11`} data={data} onMounted={() => hideLoading(false)} - baseRoute='/micro-app/demo/angular11' + // baseRoute='/micro-app/demo/angular11' // destroy // inline // disableScopecss diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index e197a9fe0..b54d89529 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -16,7 +16,7 @@ export default class App extends React.Component { name: '初始化数据' }, name: 'react#16', - url: `${config.react16}micro-app/react16?a=1`, + url: `${config.react16}micro-app/react16/?a=1`, // url: 'http://127.0.0.1:8080/micro-app/react16', showLoading: true, showMicroApp: true, @@ -187,9 +187,11 @@ export default class App extends React.Component { onAftershow={this.handleAftershow} onAfterhidden={this.handleAfterhidden} onDataChange={this.handleDataChange} - // baseRoute='/micro-app/demo/react16' + baseRoute='/micro-app/demo/react16' // keep-alive // destroy + keep-route-state + // disable-memory-router inline // disableSandbox // disable-sandbox diff --git a/docs/zh-cn/changelog.md b/docs/zh-cn/changelog.md index 9df9251a6..56c88f115 100644 --- a/docs/zh-cn/changelog.md +++ b/docs/zh-cn/changelog.md @@ -8,6 +8,23 @@ --- +### 1.0.0-beta.1 + +`2022-03-30` + +- **New** + + - 🆕 新增了独立的路由系统 - `MemoryRouter`,简化接入步骤。 + +- **Bug Fix** + + - 🐞 修复了在循环嵌套时`iconfont.js`在部分场景下报错的问题。 + +- **Update** + + - 🚀 优化了预加载相关代码和逻辑,提高并行渲染能力。 + + ### 0.8.5 `2022-02-14` diff --git a/src/__tests__/libs/additional.test.ts b/src/__tests__/libs/additional.test.ts deleted file mode 100644 index 87b571b6e..000000000 --- a/src/__tests__/libs/additional.test.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { listenUmountOfNestedApp, releaseUnmountOfNestedApp } from '../../libs/additional' -import CreateApp, { appInstanceMap } from '../../create_app' - -describe('test additional', () => { - // 卸载循环内嵌的子应用 - test('unmount app loop build-in', () => { - // test-app1模拟开启shadowRoot的未卸载孙应用 - const con1 = document.createElement('micro-app') - // @ts-ignore - con1.disconnectedCallback = jest.fn - con1.attachShadow({ mode: 'open' }) - const app1 = { - name: 'test-app1', - url: 'http://localhost:3000/', - scopecss: true, - useSandbox: true, - container: con1.shadowRoot, - } - appInstanceMap.set('test-app1', app1 as CreateApp) - - // test-app2模拟正常未卸载孙应用 - const con2 = document.createElement('micro-app') - // @ts-ignore - con2.disconnectedCallback = jest.fn - const app2 = { - name: 'test-app2', - url: 'http://localhost:3000/', - scopecss: true, - useSandbox: true, - container: con2, - } - appInstanceMap.set('test-app2', app2 as CreateApp) - - // test-app3模拟已卸载孙应用(没有container) - const app3 = { - name: 'test-app3', - url: 'http://localhost:3000/', - scopecss: true, - useSandbox: true, - } - appInstanceMap.set('test-app3', app3 as CreateApp) - - expect(appInstanceMap.size).toBe(3) - - // 模拟非嵌套循环 - releaseUnmountOfNestedApp() - listenUmountOfNestedApp() - - // 模拟嵌套循环 - window.__MICRO_APP_ENVIRONMENT__ = true - releaseUnmountOfNestedApp() - listenUmountOfNestedApp() - - // 模拟当前应用被卸载 - const event = new CustomEvent('unmount') - window.dispatchEvent(event) - - expect(appInstanceMap.size).toBe(0) - - window.__MICRO_APP_ENVIRONMENT__ = false - }) - - // 分支覆盖 - test('coverage of branch', () => { - // test-app4模已卸载孙应用 - const app1 = { - name: 'test-app4', - url: 'http://localhost:3000/', - scopecss: true, - useSandbox: true, - } - appInstanceMap.set('test-app4', app1 as CreateApp) - - // 模拟嵌套循环 - window.__MICRO_APP_ENVIRONMENT__ = true - window.__MICRO_APP_UMD_MODE__ = true // 设置为umd模式 - releaseUnmountOfNestedApp() - listenUmountOfNestedApp() - - // 模拟当前应用被卸载 - const event = new CustomEvent('unmount') - window.dispatchEvent(event) - - // umd模式不清空appInstanceMap - expect(appInstanceMap.size).toBe(1) - }) -}) diff --git a/src/__tests__/sandbox/index.test.ts b/src/__tests__/sandbox/index.test.ts index deae019ab..80bc44dc9 100644 --- a/src/__tests__/sandbox/index.test.ts +++ b/src/__tests__/sandbox/index.test.ts @@ -71,7 +71,7 @@ describe('sandbox', () => { // 一些需要返回 proxyWindow 的变量 test('which keys should return proxyWindow in sandbox', () => { - const proxyWindow = new Sandbox('test-app2', `http://127.0.0.1:${ports.sandbox}/common/`).proxyWindow + const proxyWindow = new Sandbox('test-app2', `http://127.0.0.1:${ports.sandbox}/common/`, true).proxyWindow expect(proxyWindow.window).toBe(proxyWindow) expect(proxyWindow.self).toBe(proxyWindow) // @ts-ignore @@ -90,16 +90,16 @@ describe('sandbox', () => { value: 2, } }) - const proxyWindow = new Sandbox('test-app3', `http://127.0.0.1:${ports.sandbox}/common/`).proxyWindow + const proxyWindow = new Sandbox('test-app3', `http://127.0.0.1:${ports.sandbox}/common/`, true).proxyWindow expect(proxyWindow.top).toBe(1) expect(proxyWindow.parent).toBe(2) }) // 测试强隔离属性 test('scopeProperties should prevent key in rawWidow', () => { - const sandbox = new Sandbox('test-app-scopeProperties', `http://127.0.0.1:${ports.sandbox}/common/`) + const sandbox = new Sandbox('test-app-scopeProperties', `http://127.0.0.1:${ports.sandbox}/common/`, true) - sandbox.start('') + sandbox.start('', true) const proxyWindow: any = sandbox.proxyWindow @@ -151,8 +151,8 @@ describe('sandbox', () => { // 逃离属性可以逃逸到外层真实window上&卸载时清空escapeKeys test('escapeProperties should escape from microAppWindow to rawWindow', () => { - const sandbox = new Sandbox('test-app-escapeProperties', `http://127.0.0.1:${ports.sandbox}/common/`) - sandbox.start('') + const sandbox = new Sandbox('test-app-escapeProperties', `http://127.0.0.1:${ports.sandbox}/common/`, true) + sandbox.start('', true) const proxyWindow: any = sandbox.proxyWindow Object.defineProperties(window, { diff --git a/src/create_app.ts b/src/create_app.ts index 4710dacf7..8d77bfc0f 100644 --- a/src/create_app.ts +++ b/src/create_app.ts @@ -33,8 +33,10 @@ export interface CreateAppParam { ssrUrl?: string scopecss: boolean useSandbox: boolean + useMemoryRouter: boolean inline?: boolean baseroute?: string + keepRouteState?: boolean container?: HTMLElement | ShadowRoot } @@ -56,7 +58,9 @@ export default class CreateApp implements AppInterface { inline: boolean scopecss: boolean useSandbox: boolean - baseroute = '' + useMemoryRouter: boolean + baseroute: string + keepRouteState: boolean source: sourceType sandBox: SandBoxInterface | null = null @@ -68,23 +72,27 @@ export default class CreateApp implements AppInterface { inline, scopecss, useSandbox, + useMemoryRouter, baseroute, + keepRouteState, }: CreateAppParam) { this.container = container ?? null this.inline = inline ?? false this.baseroute = baseroute ?? '' + this.keepRouteState = keepRouteState ?? false this.ssrUrl = ssrUrl ?? '' // optional during init👆 this.name = name this.url = url this.useSandbox = useSandbox this.scopecss = this.useSandbox && scopecss + this.useMemoryRouter = this.useSandbox && useMemoryRouter this.source = { links: new Map(), scripts: new Map(), } this.loadSourceCode() - this.useSandbox && (this.sandBox = new SandBox(name, url)) + this.useSandbox && (this.sandBox = new SandBox(name, url, this.useMemoryRouter)) } // Load resources @@ -132,16 +140,17 @@ export default class CreateApp implements AppInterface { * @param container app container * @param inline js runs in inline mode * @param baseroute route prefix, default is '' + * @param keepRouteState keep route state when unmount, default is false */ mount ( container?: HTMLElement | ShadowRoot, inline?: boolean, baseroute?: string, + keepRouteState?: boolean, ): void { - if (isBoolean(inline) && inline !== this.inline) { - this.inline = inline - } - + if (isBoolean(inline)) this.inline = inline + // keepRouteState effective on unmount + if (isBoolean(keepRouteState)) this.keepRouteState = keepRouteState this.container = this.container ?? container! this.baseroute = baseroute ?? this.baseroute @@ -160,7 +169,7 @@ export default class CreateApp implements AppInterface { cloneContainer(this.source.html as Element, this.container as Element, !this.umdMode) - this.sandBox?.start(this.baseroute) + this.sandBox?.start(this.baseroute, this.useMemoryRouter) let umdHookMountResult: any // result of mount function @@ -230,6 +239,7 @@ export default class CreateApp implements AppInterface { /** * unmount app + * NOTE: Do not add any params on account of unmountApp * @param destroy completely destroy, delete cache resources * @param unmountcb callback of unmount */ @@ -295,7 +305,7 @@ export default class CreateApp implements AppInterface { } // this.container maybe contains micro-app element, stop sandbox should exec after cloneContainer - this.sandBox?.stop() + this.sandBox?.stop(this.keepRouteState) if (!getActiveApps().length) { releasePatchSetAttribute() } @@ -336,12 +346,12 @@ export default class CreateApp implements AppInterface { this.keepAliveState = keepAliveStates.KEEP_ALIVE_HIDDEN // event should dispatch before clone node - // dispatch afterhidden event to micro-app + // dispatch afterHidden event to micro-app dispatchCustomEventToMicroApp('appstate-change', this.name, { appState: 'afterhidden', }) - // dispatch afterhidden event to base app + // dispatch afterHidden event to base app dispatchLifecyclesEvent( oldContainer!, this.name, @@ -351,12 +361,12 @@ export default class CreateApp implements AppInterface { // show app when connectedCallback called with keep-alive showKeepAliveApp (container: HTMLElement | ShadowRoot): void { - // dispatch beforeshow event to micro-app + // dispatch beforeShow event to micro-app dispatchCustomEventToMicroApp('appstate-change', this.name, { appState: 'beforeshow', }) - // dispatch beforeshow event to base app + // dispatch beforeShow event to base app dispatchLifecyclesEvent( container, this.name, @@ -373,12 +383,12 @@ export default class CreateApp implements AppInterface { this.keepAliveState = keepAliveStates.KEEP_ALIVE_SHOW - // dispatch aftershow event to micro-app + // dispatch afterShow event to micro-app dispatchCustomEventToMicroApp('appstate-change', this.name, { appState: 'aftershow', }) - // dispatch aftershow event to base app + // dispatch afterShow event to base app dispatchLifecyclesEvent( this.container, this.name, diff --git a/src/interact/lifecycles_event.ts b/src/interact/lifecycles_event.ts index 8dd30c54b..94084c4da 100644 --- a/src/interact/lifecycles_event.ts +++ b/src/interact/lifecycles_event.ts @@ -1,5 +1,6 @@ import microApp from '../micro_app' import { logError, isFunction, removeDomScope, getRootContainer, assign } from '../libs/utils' +import { formatEventName } from '../sandbox/effect' function formatEventInfo (event: CustomEvent, element: HTMLElement): void { Object.defineProperties(event, { @@ -72,7 +73,7 @@ export function dispatchCustomEventToMicroApp ( appName: string, detail: Record = {}, ): void { - const event = new CustomEvent(`${eventName}-${appName}`, { + const event = new CustomEvent(formatEventName(eventName, appName), { detail, }) window.dispatchEvent(event) diff --git a/src/libs/additional.ts b/src/libs/additional.ts deleted file mode 100644 index 04817a750..000000000 --- a/src/libs/additional.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { appInstanceMap } from '../create_app' -import { getRootContainer } from '../libs/utils' - -function unmountNestedApp (): void { - releaseUnmountOfNestedApp() - - appInstanceMap.forEach(app => { - // @ts-ignore - app.container && getRootContainer(app.container).disconnectedCallback() - }) - - !window.__MICRO_APP_UMD_MODE__ && appInstanceMap.clear() -} - -// if micro-app run in micro application, delete all next generation application when unmount event received -export function listenUmountOfNestedApp (): void { - if (window.__MICRO_APP_ENVIRONMENT__) { - window.addEventListener('unmount', unmountNestedApp, false) - } -} - -// release listener -export function releaseUnmountOfNestedApp (): void { - if (window.__MICRO_APP_ENVIRONMENT__) { - window.removeEventListener('unmount', unmountNestedApp, false) - } -} diff --git a/src/libs/global_env.ts b/src/libs/global_env.ts index 50052b06a..c4403ea1d 100644 --- a/src/libs/global_env.ts +++ b/src/libs/global_env.ts @@ -1,6 +1,6 @@ -import { isSupportModuleScript, isBrowser, getCurrentAppName, assign } from './utils' +import { isSupportModuleScript, isBrowser, getCurrentAppName, assign, getRootContainer } from './utils' import { rejectMicroAppStyle } from '../source/patch' -import { listenUmountOfNestedApp, releaseUnmountOfNestedApp } from '../libs/additional' +import { appInstanceMap } from '../create_app' type RequestIdleCallbackOptions = { timeout: number @@ -34,6 +34,31 @@ declare global { } } +function unmountNestedApp (): void { + appInstanceMap.forEach(app => { + // @ts-ignore + app.container && getRootContainer(app.container).disconnectedCallback() + }) + + !window.__MICRO_APP_UMD_MODE__ && appInstanceMap.clear() +} + +// if micro-app run in micro application, delete all next generation application when unmount event received +// unmount event will auto release by sandbox +export function listenUmountOfNestedApp (): void { + if (window.__MICRO_APP_ENVIRONMENT__) { + releaseUnmountOfNestedApp() + window.addEventListener('unmount', unmountNestedApp, false) + } +} + +// release listener +function releaseUnmountOfNestedApp (): void { + if (window.__MICRO_APP_ENVIRONMENT__) { + window.removeEventListener('unmount', unmountNestedApp, false) + } +} + const globalEnv: Record = {} /** @@ -133,8 +158,6 @@ export function initGlobalEnv (): void { // global effect rejectMicroAppStyle() - releaseUnmountOfNestedApp() - listenUmountOfNestedApp() } } diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 61d7ce7c7..880fe16ed 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -1,5 +1,5 @@ /* eslint-disable no-new-func, indent, @typescript-eslint/explicit-module-boundary-types */ -import type { Func } from '@micro-app/types' +import type { Func, LocationQueryObject, LocationQueryValue } from '@micro-app/types' export const version = '__MICRO_APP_VERSION__' @@ -380,17 +380,61 @@ export function isFireFox (): boolean { return navigator.userAgent.indexOf('Firefox') > -1 } -// this events should be sent to the specified app -const formatEventList = ['unmount', 'appstate-change', 'popstate'] +/** + * Transforms a queryString into object. + * @param search - search string to parse + * @returns a query object + */ +export function parseQuery (search: string): LocationQueryObject { + const result: LocationQueryObject = {} + const queryList = search.split('&') + + // 注意我们不会对key和value进行解码,以确保替换url时前后值一致 + // 我们只对匹配到的微应用的key和value在后续进行编解码 + for (const queryItem of queryList) { + const eqPos = queryItem.indexOf('=') + const key = eqPos < 0 ? queryItem : queryItem.slice(0, eqPos) + const value = eqPos < 0 ? null : queryItem.slice(eqPos + 1) + + if (key in result) { + let currentValue = result[key] + if (!isArray(currentValue)) { + currentValue = result[key] = [currentValue] + } + currentValue.push(value) + } else { + result[key] = value + } + } + + return result +} /** - * Format event name - * @param eventName event name - * @param appName app name + * Transforms an object to query string + * @param queryObject - query object to stringify + * @returns query string without the leading `?` */ -export function formatEventName (eventName: string, appName: string): string { - if (formatEventList.includes(eventName)) { - return `${eventName}-${appName}` +export function stringifyQuery (queryObject: LocationQueryObject): string { + let result = '' + + for (const key in queryObject) { + const value = queryObject[key] + if (isNull(value)) { + result += (result.length ? '&' : '') + key + } else { + const valueList: LocationQueryValue[] = isArray(value) ? value : [value] + + valueList.forEach(value => { + if (!isUndefined(value)) { + result += (result.length ? '&' : '') + key + if (!isNull(value)) result += '=' + value + } + }) + } } - return eventName + + return result } + +export const noop = () => {} diff --git a/src/micro_app.ts b/src/micro_app.ts index 12203b62b..cb173d6b9 100644 --- a/src/micro_app.ts +++ b/src/micro_app.ts @@ -1,7 +1,15 @@ import type { OptionsType, MicroAppConfigType, lifeCyclesType, plugins, fetchType, AppInterface } from '@micro-app/types' import { defineElement } from './micro_app_element' import preFetch, { getGlobalAssets } from './prefetch' -import { logError, logWarn, isFunction, isBrowser, isPlainObject, formatAppName, getRootContainer } from './libs/utils' +import { + logError, + logWarn, + isFunction, + isBrowser, + isPlainObject, + formatAppName, + getRootContainer, +} from './libs/utils' import { EventCenterForBaseApp } from './interact' import { initGlobalEnv } from './libs/global_env' import { appInstanceMap } from './create_app' @@ -35,7 +43,7 @@ export function getAllApps (): string[] { return Array.from(appInstanceMap.keys()) } -export interface unmountAppParams { +type unmountAppOptions = { destroy?: boolean // destroy app, default is false clearAliveState?: boolean // clear keep-alive app state, default is false } @@ -43,10 +51,10 @@ export interface unmountAppParams { /** * unmount app by appName * @param appName - * @param options unmountAppParams + * @param options unmountAppOptions * @returns Promise */ -export function unmountApp (appName: string, options?: unmountAppParams): Promise { +export function unmountApp (appName: string, options?: unmountAppOptions): Promise { const app = appInstanceMap.get(formatAppName(appName)) return new Promise((resolve) => { // eslint-disable-line if (app) { @@ -87,6 +95,7 @@ export function unmountApp (appName: string, options?: unmountAppParams): Promis container.setAttribute('destroy', 'true') container.parentNode!.removeChild(container) + container.removeAttribute('destroy') typeof destroyAttrValue === 'string' && container.setAttribute('destroy', destroyAttrValue) @@ -110,7 +119,7 @@ export function unmountApp (appName: string, options?: unmountAppParams): Promis } // unmount all apps in turn -export function unmountAllApps (options?: unmountAppParams): Promise { +export function unmountAllApps (options?: unmountAppOptions): Promise { return Array.from(appInstanceMap.keys()).reduce((pre, next) => pre.then(() => unmountApp(next, options)), Promise.resolve()) } @@ -121,6 +130,7 @@ export class MicroApp extends EventCenterForBaseApp implements MicroAppConfigTyp inline?: boolean disableScopecss?: boolean disableSandbox?: boolean + disableMemoryRouter?: boolean ssr?: boolean lifeCycles?: lifeCyclesType plugins?: plugins @@ -157,6 +167,7 @@ export class MicroApp extends EventCenterForBaseApp implements MicroAppConfigTyp this.inline = options.inline this.disableScopecss = options.disableScopecss this.disableSandbox = options.disableSandbox + this.disableMemoryRouter = options.disableMemoryRouter this.ssr = options.ssr isFunction(options.fetch) && (this.fetch = options.fetch) diff --git a/src/micro_app_element.ts b/src/micro_app_element.ts index bcc4c0e3f..5dec7929c 100644 --- a/src/micro_app_element.ts +++ b/src/micro_app_element.ts @@ -70,11 +70,18 @@ export function defineElement (tagName: string): void { disconnectedCallback (): void { this.hasConnected = false - // keep-alive - if (this.getKeepAliveModeResult()) { - this.handleHiddenKeepAliveApp() - } else { - this.handleUnmount(this.getDestroyCompatibleResult()) + const app = appInstanceMap.get(this.appName) + if ( + app && + app.getAppState() !== appStates.UNMOUNT && + app.getKeepAliveState() !== keepAliveStates.KEEP_ALIVE_HIDDEN + ) { + // keep-alive + if (this.getKeepAliveModeResult()) { + this.handleHiddenKeepAliveApp() + } else { + this.handleUnmount(this.getDestroyCompatibleResult()) + } } } @@ -288,6 +295,7 @@ export function defineElement (tagName: string): void { this.shadowRoot ?? this, this.getDisposeResult('inline'), this.getBaseRouteCompatible(), + this.getDisposeResult('keep-route-state'), )) } @@ -309,7 +317,9 @@ export function defineElement (tagName: string): void { inline: this.getDisposeResult('inline'), scopecss: !(this.getDisposeResult('disableScopecss') || this.getDisposeResult('shadowDOM')), useSandbox: !this.getDisposeResult('disableSandbox'), + useMemoryRouter: !this.getDisposeResult('disable-memory-router'), baseroute: this.getBaseRouteCompatible(), + keepRouteState: this.getDisposeResult('keep-route-state'), }) appInstanceMap.set(this.appName, instance) @@ -324,7 +334,12 @@ export function defineElement (tagName: string): void { if ( app && app.getAppState() !== appStates.UNMOUNT - ) app.unmount(destroy, unmountcb) + ) { + app.unmount( + destroy, + unmountcb, + ) + } } // hidden app when disconnectedCallback called with keep-alive diff --git a/src/prefetch.ts b/src/prefetch.ts index e0e0e954a..faec93ffa 100644 --- a/src/prefetch.ts +++ b/src/prefetch.ts @@ -24,12 +24,13 @@ import microApp from './micro_app' * url: string, * disableScopecss?: boolean, * disableSandbox?: boolean, + * disableMemoryRouter?: boolean, * }, * ... * ]) * Note: * 1: preFetch is asynchronous and is performed only when the browser is idle - * 2: disableScopecss, disableSandbox must be same with micro-app element, if conflict, the one who executes first shall prevail + * 2: disableScopecss, disableSandbox, disableMemoryRouter must be same with micro-app element, if conflict, the one who executes first shall prevail * @param apps micro apps */ export default function preFetch (apps: prefetchParamList): void { @@ -58,6 +59,7 @@ function preFetchInSerial (prefetchApp: prefetchParam): Promise { url: prefetchApp.url, scopecss: !(prefetchApp.disableScopecss ?? microApp.disableScopecss), useSandbox: !(prefetchApp.disableSandbox ?? microApp.disableSandbox), + useMemoryRouter: !(prefetchApp.disableMemoryRouter ?? microApp.disableMemoryRouter), }) app.isPrefetch = true diff --git a/src/sandbox/router.ts b/src/sandbox/__save__router.ts similarity index 79% rename from src/sandbox/router.ts rename to src/sandbox/__save__router.ts index aafe1802e..807fef1c2 100644 --- a/src/sandbox/router.ts +++ b/src/sandbox/__save__router.ts @@ -1,3 +1,4 @@ +/* eslint-disable */ import type { MicroRouter, MicroLocation, @@ -11,7 +12,6 @@ import type { import globalEnv from '../libs/global_env' import { assign as oAssign, - formatEventName, isArray, isNull, isString, @@ -19,21 +19,8 @@ import { logError, } from '../libs/utils' import { appInstanceMap } from '../create_app' - -// 更新url地址有以下几种情况: -// 1、页面初始化 -// 2、子应用页面内部发生跳转 -// 3、通过micro-app api进行跳转 - -// 更新location有以下几种情况,根据url地址进行更新: -// 1、页面初始化 -// 2、子应用页面内部发生跳转 -// 3、通过micro-app api进行跳转 -// 4、popstate事件 -// const { pathname, search, hash } = location -// pathname + search + hash -// 如果有hash,则参数加在hash后面(默认为hash路由),如果没有hash,则加在query上(默认history路由) -// 特殊情况:history路由有hash,hash路由没有hash -- 不管 +import { getActiveApps } from '../micro_app' +import { formatEventName } from './effect' type PopStateListener = (this: Window, e: PopStateEvent) => void @@ -43,23 +30,26 @@ type PopStateListener = (this: Window, e: PopStateEvent) => void * @param appName app name * @returns release callback */ - export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { +export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { // Send to the child app after receiving the popstate event const popStateHandler: PopStateListener = (e: PopStateEvent): void => { - // 先更新location,再发送popstate事件 - const microPath = getMicroPathFromURL(appName) - const app = appInstanceMap.get(appName) - if (microPath && app) { - // @ts-ignore - updateLocation(microPath, app.url, app.sandBox.proxyWindow.location) - // @ts-ignore - console.log(333333, microPath, app.sandBox.proxyWindow.location) + const activeApps = getActiveApps(true) + if (activeApps.includes(appName)) { + // 先更新location,再发送popstate事件 + const microPath = getMicroPathFromURL(appName) + if (microPath) { + const app = appInstanceMap.get(appName) + // @ts-ignore + updateLocation(microPath, app.url, app.sandBox.proxyWindow.location) + // @ts-ignore + console.log(333333, microPath, app.sandBox.proxyWindow.location) + } + // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 + const state = getMicroState(appName, e.state) + rawWindow.dispatchEvent( + new PopStateEvent(formatEventName('popstate', appName), { state }) + ) } - // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 - const state = getMicroState(appName, e.state) - rawWindow.dispatchEvent( - new PopStateEvent(formatEventName('popstate', appName), { state }) - ) } rawWindow.addEventListener('popstate', popStateHandler) @@ -169,11 +159,16 @@ function commonDecode (path: string): string { } } +// 格式化query参数key,防止与原有参数的冲突 +function formatQueryAppName (appName: string) { + return `app-${appName}` +} + // 根据浏览器url参数,获取当前子应用的fullPath function getMicroPathFromURL (appName: string): string | null { const rawLocation = globalEnv.rawWindow.location const queryObject = getQueryObjectFromURL(rawLocation.search, rawLocation.hash) - const microPath = queryObject.hashQuery?.[appName] || queryObject.searchQuery?.[appName] + const microPath = queryObject.hashQuery?.[formatQueryAppName(appName)] || queryObject.searchQuery?.[formatQueryAppName(appName)] // 解码 return microPath ? decodeMicroPath(microPath as string) : null } @@ -191,20 +186,20 @@ function attachMicroQueryToURL (appName: string, microLocation: MicroLocation): // hash存在且search不存在,则认为是hash路由 if (hash && !search) { if (microQueryObject.hashQuery) { - microQueryObject.hashQuery[appName] = encodedMicroPath + microQueryObject.hashQuery[formatQueryAppName(appName)] = encodedMicroPath } else { microQueryObject.hashQuery = { - [appName]: encodedMicroPath + [formatQueryAppName(appName)]: encodedMicroPath } } const baseHash = hash.includes('?') ? hash.slice(0, hash.indexOf('?') + 1) : hash + '?' hash = baseHash + stringifyQuery(microQueryObject.hashQuery) } else { if (microQueryObject.searchQuery) { - microQueryObject.searchQuery[appName] = encodedMicroPath + microQueryObject.searchQuery[formatQueryAppName(appName)] = encodedMicroPath } else { microQueryObject.searchQuery = { - [appName]: encodedMicroPath + [formatQueryAppName(appName)]: encodedMicroPath } } search = '?' + stringifyQuery(microQueryObject.searchQuery) @@ -218,12 +213,12 @@ function removeMicroQueryFromURL (appName: string): string { let { pathname, search, hash } = globalEnv.rawWindow.location const microQueryObject = getQueryObjectFromURL(search, hash) - if (microQueryObject.hashQuery?.[appName]) { - delete microQueryObject.hashQuery?.[appName] + if (microQueryObject.hashQuery?.[formatQueryAppName(appName)]) { + delete microQueryObject.hashQuery?.[formatQueryAppName(appName)] const hashQueryStr = stringifyQuery(microQueryObject.hashQuery) hash = hash.slice(0, hash.indexOf('?') + Number(Boolean(hashQueryStr))) + hashQueryStr - } else if (microQueryObject.searchQuery?.[appName]) { - delete microQueryObject.searchQuery?.[appName] + } else if (microQueryObject.searchQuery?.[formatQueryAppName(appName)]) { + delete microQueryObject.searchQuery?.[formatQueryAppName(appName)] const searchQueryStr = stringifyQuery(microQueryObject.searchQuery) search = searchQueryStr ? '?' + searchQueryStr : '' } @@ -341,37 +336,33 @@ function updateBrowserURL (state: MicroState, fullPath: string): void { } // 当沙箱执行start, 或者隐藏的keep-alive应用重新渲染时时才:根据浏览器url更新location 或者 将参数更新到url上 -export function initialActionForRoute (appName: string, url: string, microLocation: MicroLocation) { +export function initRouteStateWithURL (appName: string, url: string, microLocation: MicroLocation) { const microPath = getMicroPathFromURL(appName) // 如果初始化时参数有子应用的数据信息,则直接复用,如果没有则重新创建 if (microPath) { updateLocation(microPath, url, microLocation) } else { - const fullPath = attachMicroQueryToURL(appName, microLocation) - // 下面需要优化,代码太繁琐了 - const rawHistory = globalEnv.rawWindow.history - const historyState = createMicroState(appName, rawHistory.state, getMicroState(appName, rawHistory.state)) - updateBrowserURL(historyState, fullPath) + updateBrowserURL(globalEnv.rawWindow.history.state, attachMicroQueryToURL(appName, microLocation)) } } -export function clearRouterStateFromURL (appName: string, url: string, microLocation: MicroLocation) { +export function clearRouteStateFromURL (appName: string, url: string, microLocation: MicroLocation) { // 初始化location信息 const { pathname, search, hash } = new URL(url) updateLocation(pathname + search + hash, url, microLocation) // 删除浏览器url上的子应用参数 - const fullPath = removeMicroQueryFromURL(appName) - const rawHistory = globalEnv.rawWindow.history - const historyState = deleteMicroState(appName, rawHistory.state) - updateBrowserURL(historyState, fullPath) + updateBrowserURL( + deleteMicroState(appName, globalEnv.rawWindow.history.state), + removeMicroQueryFromURL(appName), + ) } export default function createMicroRouter (appName: string, url: string): MicroRouter { const microLocation = createMicroLocation(url) return { - location: microLocation, - history: createMicroHistory(appName, url, microLocation), + microLocation, + microHistory: createMicroHistory(appName, url, microLocation), } } diff --git a/src/sandbox/effect.ts b/src/sandbox/effect.ts index 8f85610c9..e3f79207b 100644 --- a/src/sandbox/effect.ts +++ b/src/sandbox/effect.ts @@ -6,11 +6,9 @@ import { isFunction, isBoundFunction, rawDefineProperty, - formatEventName, } from '../libs/utils' import { appInstanceMap } from '../create_app' import globalEnv from '../libs/global_env' -import { addHistoryListener } from './router' type MicroEventListener = EventListenerOrEventListenerObject & Record type timeInfo = { @@ -19,6 +17,27 @@ type timeInfo = { args: any[], } +// this events should be sent to the specified app +const formatEventList = ['unmount', 'appstate-change'] + +/** + * Format event name + * @param eventName event name + * @param appName app name + */ +export function formatEventName (eventName: string, appName: string): string { + if ( + formatEventList.includes(eventName) || + ( + eventName === 'popstate' && + appInstanceMap.get(appName)?.useMemoryRouter + ) + ) { + return `${eventName}-${appName}` + } + return eventName +} + // document.onclick binding list, the binding function of each application is unique const documentClickListMap = new Map() let hasRewriteDocumentOnClick = false @@ -279,12 +298,8 @@ export default function effect (microAppWindow: microAppWindowType): Record { - removeHistoryListener() // Clear window binding events if (eventListenerMap.size) { eventListenerMap.forEach((listenerList, type) => { diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 0e51656e5..218c7c097 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -1,8 +1,17 @@ -import type { microAppWindowType, SandBoxInterface, plugins, MicroLocation } from '@micro-app/types' +import type { + microAppWindowType, + SandBoxInterface, + plugins, + MicroLocation, +} from '@micro-app/types' import { - EventCenterForMicroApp, rebuildDataCenterSnapshot, recordDataCenterSnapshot + EventCenterForMicroApp, + rebuildDataCenterSnapshot, + recordDataCenterSnapshot, } from '../interact' -import globalEnv from '../libs/global_env' +import globalEnv, { + listenUmountOfNestedApp, +} from '../libs/global_env' import { getEffectivePath, isArray, @@ -28,7 +37,11 @@ import { patchElementPrototypeMethods, releasePatches, } from '../source/patch' -import createMicroRouter, { initialActionForRoute, clearRouterStateFromURL } from './router' +import createMicroRouter, { + initRouteStateWithURL, + clearRouteStateFromURL, + addHistoryListener, +} from './router' export type MicroAppWindowDataType = { __MICRO_APP_ENVIRONMENT__: boolean @@ -64,6 +77,7 @@ export default class SandBox implements SandBoxInterface { private recordUmdEffect!: CallableFunction private rebuildUmdEffect!: CallableFunction private releaseEffect!: CallableFunction + private removeHistoryListener!: CallableFunction /** * Scoped global Properties(Properties that can only get and set in microAppWindow, will not escape to rawWindow) * https://github.com/micro-zoe/micro-app/issues/234 @@ -82,32 +96,41 @@ export default class SandBox implements SandBoxInterface { proxyWindow: WindowProxy & MicroAppWindowDataType // Proxy microAppWindow = {} as MicroAppWindowType // Proxy target - constructor (appName: string, url: string) { + constructor (appName: string, url: string, useMemoryRouter = true) { // get scopeProperties and escapeProperties from plugins this.getSpecialProperties(appName) // create proxyWindow with Proxy(microAppWindow) this.proxyWindow = this.createProxyWindow(appName) // inject global properties - this.initMicroAppWindow(this.microAppWindow, appName, url) + this.initMicroAppWindow(this.microAppWindow, appName, url, useMemoryRouter) // Rewrite global event listener & timeout assign(this, effect(this.microAppWindow)) } - public start (baseRoute: string): void { + public start (baseRoute: string, useMemoryRouter = true): void { if (!this.active) { this.active = true - this.initRouteState() - this.microAppWindow.__MICRO_APP_BASE_ROUTE__ = this.microAppWindow.__MICRO_APP_BASE_URL__ = baseRoute - // BUG FIX: bable-polyfill@6.x - globalEnv.rawWindow._babelPolyfill && (globalEnv.rawWindow._babelPolyfill = false) + if (useMemoryRouter) { + this.initRouteState() + // unique listener of popstate event for sub app + this.removeHistoryListener = addHistoryListener( + globalEnv.rawWindow, + this.proxyWindow.__MICRO_APP_NAME__, + ) + } else { + this.microAppWindow.__MICRO_APP_BASE_ROUTE__ = this.microAppWindow.__MICRO_APP_BASE_URL__ = baseRoute + } if (++SandBox.activeCount === 1) { effectDocumentEvent() patchElementPrototypeMethods() + listenUmountOfNestedApp() } + // BUG FIX: bable-polyfill@6.x + globalEnv.rawWindow._babelPolyfill && (globalEnv.rawWindow._babelPolyfill = false) } } - public stop (keepRouteState?: boolean): void { + public stop (keepRouteState = false): void { if (this.active) { this.releaseEffect() this.microAppWindow.microApp.clearDataListener() @@ -123,7 +146,12 @@ export default class SandBox implements SandBoxInterface { }) this.escapeKeys.clear() - if (!keepRouteState) this.clearRouteState() + if (this.removeHistoryListener) { + if (!keepRouteState) this.clearRouteState() + // release listener of popstate + this.removeHistoryListener() + } + if (--SandBox.activeCount === 0) { releaseEffectDocumentEvent() releasePatches() @@ -153,22 +181,6 @@ export default class SandBox implements SandBoxInterface { rebuildDataCenterSnapshot(this.microAppWindow.microApp) } - public initRouteState (): void { - initialActionForRoute( - this.proxyWindow.__MICRO_APP_NAME__, - this.proxyWindow.__MICRO_APP_URL__, - this.proxyWindow.location as MicroLocation, - ) - } - - public clearRouteState (): void { - clearRouterStateFromURL( - this.proxyWindow.__MICRO_APP_NAME__, - this.proxyWindow.__MICRO_APP_URL__, - this.proxyWindow.location as MicroLocation, - ) - } - /** * get scopeProperties and escapeProperties from plugins * @param appName app name @@ -306,7 +318,12 @@ export default class SandBox implements SandBoxInterface { * @param appName app name * @param url app url */ - private initMicroAppWindow (microAppWindow: microAppWindowType, appName: string, url: string): void { + private initMicroAppWindow ( + microAppWindow: microAppWindowType, + appName: string, + url: string, + useMemoryRouter: boolean, + ): void { microAppWindow.__MICRO_APP_ENVIRONMENT__ = true microAppWindow.__MICRO_APP_NAME__ = appName microAppWindow.__MICRO_APP_URL__ = url @@ -321,7 +338,7 @@ export default class SandBox implements SandBoxInterface { microAppWindow.hasOwnProperty = (key: PropertyKey) => rawHasOwnProperty.call(microAppWindow, key) || rawHasOwnProperty.call(globalEnv.rawWindow, key) this.setMappingPropertiesWithRawDescriptor(microAppWindow) this.setHijackProperties(microAppWindow, appName) - this.setRouterApi(microAppWindow, appName, url) + if (useMemoryRouter) this.setRouterApi(microAppWindow, appName, url) } // properties associated with the native window @@ -405,14 +422,15 @@ export default class SandBox implements SandBoxInterface { }) } + // set location & history for memory router private setRouterApi (microAppWindow: microAppWindowType, appName: string, url: string): void { - const { location, history } = createMicroRouter(appName, url) + const { microLocation, microHistory } = createMicroRouter(appName, url) rawDefineProperties(microAppWindow, { location: { configurable: false, enumerable: true, get () { - return location + return microLocation }, set: (value) => { globalEnv.rawWindow.location = value @@ -422,9 +440,25 @@ export default class SandBox implements SandBoxInterface { configurable: true, enumerable: true, get () { - return history + return microHistory }, }, }) } + + private initRouteState (): void { + initRouteStateWithURL( + this.proxyWindow.__MICRO_APP_NAME__, + this.proxyWindow.__MICRO_APP_URL__, + this.proxyWindow.location as MicroLocation, + ) + } + + private clearRouteState (): void { + clearRouteStateFromURL( + this.proxyWindow.__MICRO_APP_NAME__, + this.proxyWindow.__MICRO_APP_URL__, + this.proxyWindow.location as MicroLocation, + ) + } } diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts new file mode 100644 index 000000000..5a8095d26 --- /dev/null +++ b/src/sandbox/router/core.ts @@ -0,0 +1,148 @@ +import type { + MicroLocation, + MicroState, + LocationQuery, +} from '@micro-app/types' +import globalEnv from '../../libs/global_env' +import { + assign, + parseQuery, + stringifyQuery, +} from '../../libs/utils' + +// set micro app state to origin state +export function createMicroState ( + appName: string, + rawState: MicroState, + microState: MicroState, +): MicroState { + // 生成新的microAppState,因为它们在第二层 + const newMicroAppState = assign({}, rawState?.microAppState, { + [appName]: microState + }) + // 生成新的state对象 + return assign({}, rawState, { + microAppState: newMicroAppState + }) +} + +// get micro app state form origin state +export function getMicroState (appName: string, state: MicroState): MicroState { + return state?.microAppState?.[appName] || null +} + +// delete micro app state form origin state +export function deleteMicroState (appName: string, rawState: MicroState): MicroState { + if (rawState?.microAppState?.[appName]) { + delete rawState.microAppState[appName] + } + // 生成新的state对象 + return assign({}, rawState) +} + +const ENC_AD_RE = /&/g // %M1 +const ENC_EQ_RE = /=/g // %M2 +const DEC_AD_RE = /%M1/g // & +const DEC_EQ_RE = /%M2/g // = + +function encodeMicroPath (path: string): string { + return encodeURIComponent(commonDecode(path).replace(ENC_AD_RE, '%M1').replace(ENC_EQ_RE, '%M2')) +} + +function decodeMicroPath (path: string): string { + return commonDecode(path).replace(DEC_AD_RE, '&').replace(DEC_EQ_RE, '=') +} + +function commonDecode (path: string): string { + try { + const decPath = decodeURIComponent(path) + if (path === decPath || DEC_AD_RE.test(decPath) || DEC_EQ_RE.test(decPath)) return decPath + return commonDecode(decPath) + } catch { + return path + } +} + +/** + * 根据location获取query对象 + */ +function getQueryObjectFromURL (search: string, hash: string): LocationQuery { + const queryObject: LocationQuery = {} + + if (search !== '' && search !== '?') { + queryObject.searchQuery = parseQuery(search.slice(1)) + } + + if (hash.includes('?')) { + queryObject.hashQuery = parseQuery(hash.slice(hash.indexOf('?') + 1)) + } + + return queryObject +} + +// 格式化query参数key,防止与原有参数的冲突 +function formatQueryAppName (appName: string) { + return `app-${appName}` +} + +// 根据浏览器url参数,获取当前子应用的path +export function getMicroPathFromURL (appName: string): string | null { + const rawLocation = globalEnv.rawWindow.location + const queryObject = getQueryObjectFromURL(rawLocation.search, rawLocation.hash) + const microPath = queryObject.hashQuery?.[formatQueryAppName(appName)] || queryObject.searchQuery?.[formatQueryAppName(appName)] + // 解码 + return microPath ? decodeMicroPath(microPath as string) : null +} + +// 将name=encodeUrl地址插入到浏览器url上 +export function setMicroPathToURL (appName: string, microLocation: MicroLocation): string { + let { pathname, search, hash } = globalEnv.rawWindow.location + const queryObject = getQueryObjectFromURL(search, hash) + const encodedMicroPath = encodeMicroPath( + microLocation.pathname + + microLocation.search + + microLocation.hash + ) + + // hash存在且search不存在,则认为是hash路由 + if (hash && !search) { + if (queryObject.hashQuery) { + queryObject.hashQuery[formatQueryAppName(appName)] = encodedMicroPath + } else { + queryObject.hashQuery = { + [formatQueryAppName(appName)]: encodedMicroPath + } + } + const baseHash = hash.includes('?') ? hash.slice(0, hash.indexOf('?') + 1) : hash + '?' + hash = baseHash + stringifyQuery(queryObject.hashQuery) + } else { + if (queryObject.searchQuery) { + queryObject.searchQuery[formatQueryAppName(appName)] = encodedMicroPath + } else { + queryObject.searchQuery = { + [formatQueryAppName(appName)]: encodedMicroPath + } + } + search = '?' + stringifyQuery(queryObject.searchQuery) + } + + return pathname + search + hash +} + +// 将name=encodeUrl的参数从浏览器url上删除 +export function removeMicroPathFromURL (appName: string): string { + let { pathname, search, hash } = globalEnv.rawWindow.location + const queryObject = getQueryObjectFromURL(search, hash) + + if (queryObject.hashQuery?.[formatQueryAppName(appName)]) { + delete queryObject.hashQuery?.[formatQueryAppName(appName)] + const hashQueryStr = stringifyQuery(queryObject.hashQuery) + hash = hash.slice(0, hash.indexOf('?') + Number(Boolean(hashQueryStr))) + hashQueryStr + } else if (queryObject.searchQuery?.[formatQueryAppName(appName)]) { + delete queryObject.searchQuery?.[formatQueryAppName(appName)] + const searchQueryStr = stringifyQuery(queryObject.searchQuery) + search = searchQueryStr ? '?' + searchQueryStr : '' + } + + return pathname + search + hash +} diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts new file mode 100644 index 000000000..967193955 --- /dev/null +++ b/src/sandbox/router/event.ts @@ -0,0 +1,42 @@ +import { appInstanceMap } from '../../create_app' +import { getActiveApps } from '../../micro_app' +import { formatEventName } from '../effect' +import { getMicroPathFromURL, getMicroState } from './core' +import { updateLocation } from './location' + +type PopStateListener = (this: Window, e: PopStateEvent) => void + +/** + * register & release popstate event + * @param rawWindow origin window + * @param appName app name + * @returns release callback + */ +export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { + // Send to the child app after receiving the popstate event + const popStateHandler: PopStateListener = (e: PopStateEvent): void => { + const activeApps = getActiveApps(true) + if (activeApps.includes(appName)) { + // 先更新location,再发送popstate事件 + const microPath = getMicroPathFromURL(appName) + if (microPath) { + const app = appInstanceMap.get(appName) + // @ts-ignore + updateLocation(microPath, app.url, app.sandBox.proxyWindow.location) + // @ts-ignore + // console.log(333333, microPath, app.sandBox.proxyWindow.location) + } + // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 + const state = getMicroState(appName, e.state) + rawWindow.dispatchEvent( + new PopStateEvent(formatEventName('popstate', appName), { state }) + ) + } + } + + rawWindow.addEventListener('popstate', popStateHandler) + + return () => { + rawWindow.removeEventListener('popstate', popStateHandler) + } +} diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts new file mode 100644 index 000000000..22f50ec80 --- /dev/null +++ b/src/sandbox/router/history.ts @@ -0,0 +1,69 @@ +import type { + MicroState, + MicroLocation, + MicroHistory, + HistoryProxyValue, +} from '@micro-app/types' +import globalEnv from '../../libs/global_env' +import { + isString, + logError, +} from '../../libs/utils' +import { updateLocation } from './location' +import { setMicroPathToURL, createMicroState, getMicroState } from './core' + +// history of micro app +export function createMicroHistory ( + appName: string, + base: string, + microLocation: MicroLocation, +): MicroHistory { + const rawHistory = globalEnv.rawWindow.history + + // 是否需要在每次调用时都创建一个函数?这样看起来麻烦,但是是函数式编程,看起来更优雅 + // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 + function microHistoryMethod (methodName: PropertyKey): CallableFunction { + return (...rests: any[]) => { + // console.log(444444444, rests[0], rests[1], rests[2], methodName) + let targetPath = null + // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! + if ((methodName === 'pushState' || methodName === 'replaceState') && rests[2] && isString(rests[2])) { + try { + const targetLocation = new URL(rests[2], base) as MicroLocation + if (targetLocation.origin === microLocation.origin) { + targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash + // 经过格式化后的,包含某个微应用state的全量state + const newState = createMicroState(appName, rawHistory.state, rests[0]) + rests = [newState, rests[1], setMicroPathToURL(appName, targetLocation)] + } + } catch (e) { + logError(e, appName) + } + } + + rawHistory[methodName](...rests) + + if (targetPath) updateLocation(targetPath, base, microLocation) + + // console.log(5555555, microLocation, base) + } + } + + const microHistory = new Proxy(rawHistory, { + get (target: Record, key: PropertyKey): HistoryProxyValue { + if (key === 'state') { + return getMicroState(appName, rawHistory.state) + } else if (typeof Reflect.get(target, key) === 'function') { + return microHistoryMethod(key) + } + return Reflect.get(target, key) + }, + }) + + return microHistory +} + +// 更新浏览器url +export function updateBrowserURL (state: MicroState, fullPath: string): void { + globalEnv.rawWindow.history.replaceState(state, null, fullPath) +} diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts new file mode 100644 index 000000000..7916fc324 --- /dev/null +++ b/src/sandbox/router/index.ts @@ -0,0 +1,59 @@ +import type { + MicroRouter, + MicroLocation, +} from '@micro-app/types' +import globalEnv from '../../libs/global_env' +import { + getMicroPathFromURL, + setMicroPathToURL, + removeMicroPathFromURL, + deleteMicroState, +} from './core' +import { + createMicroLocation, + updateLocation, +} from './location' +import { + createMicroHistory, + updateBrowserURL, +} from './history' + +export { addHistoryListener } from './event' + +// 当沙箱执行start, 或者隐藏的keep-alive应用重新渲染时时才:根据浏览器url更新location 或者 将参数更新到url上 +export function initRouteStateWithURL ( + appName: string, + url: string, + microLocation: MicroLocation, +): void { + const microPath = getMicroPathFromURL(appName) + if (microPath) { + updateLocation(microPath, url, microLocation) + } else { + updateBrowserURL(globalEnv.rawWindow.history.state, setMicroPathToURL(appName, microLocation)) + } +} + +export function clearRouteStateFromURL ( + appName: string, + url: string, + microLocation: MicroLocation, +): void { + // 初始化location信息 + const { pathname, search, hash } = new URL(url) + updateLocation(pathname + search + hash, url, microLocation) + // 删除浏览器url上的子应用参数 + updateBrowserURL( + deleteMicroState(appName, globalEnv.rawWindow.history.state), + removeMicroPathFromURL(appName), + ) +} + +export default function createMicroRouter (appName: string, url: string): MicroRouter { + const microLocation = createMicroLocation(url) + + return { + microLocation, + microHistory: createMicroHistory(appName, url, microLocation), + } +} diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts new file mode 100644 index 000000000..b9fc0797e --- /dev/null +++ b/src/sandbox/router/location.ts @@ -0,0 +1,47 @@ +import type { MicroLocation } from '@micro-app/types' +import globalEnv from '../../libs/global_env' +import { + assign as oAssign, +} from '../../libs/utils' + +// location of micro app +// 只会在沙箱初始化时执行一次 +export function createMicroLocation (url: string): MicroLocation { + const rawLocation = globalEnv.rawWindow.location + const microLocation = new URL(url) as MicroLocation + + function assign (url: string | URL): void { + rawLocation.assign(url) + } + + function replace (url: string | URL): void { + rawLocation.replace(url) + } + + function reload (forcedReload?: boolean): void { + // @ts-ignore + rawLocation.reload(forcedReload) + } + + oAssign(microLocation, { + assign, + replace, + reload + }) + + return microLocation +} + +// origin is readonly, so we ignore it +const LocationKeys = ['hash', 'host', 'hostname', 'href', 'password', 'pathname', 'port', 'protocol', 'search'] +export function updateLocation ( + path: string, + base: string, + microLocation: MicroLocation, +): void { + const newLocation = new URL(path, base) + for (const key of LocationKeys) { + // @ts-ignore + microLocation[key] = newLocation[key] + } +} diff --git a/src/source/patch.ts b/src/source/patch.ts index 781198dd7..f794b5ec5 100644 --- a/src/source/patch.ts +++ b/src/source/patch.ts @@ -314,6 +314,7 @@ function patchDocument () { const appName = getCurrentAppName() if ( !appName || + !appInstanceMap.get(appName)?.container || !selectors || isUniqueElement(selectors) || // see https://github.com/micro-zoe/micro-app/issues/56 @@ -321,6 +322,7 @@ function patchDocument () { ) { return globalEnv.rawQuerySelector.call(this, selectors) } + return appInstanceMap.get(appName)?.container?.querySelector(selectors) ?? null } @@ -328,12 +330,14 @@ function patchDocument () { const appName = getCurrentAppName() if ( !appName || + !appInstanceMap.get(appName)?.container || !selectors || isUniqueElement(selectors) || rawDocument !== this ) { return globalEnv.rawQuerySelectorAll.call(this, selectors) } + return appInstanceMap.get(appName)?.container?.querySelectorAll(selectors) ?? [] } diff --git a/typings/global.d.ts b/typings/global.d.ts index ba92a7c98..39c415f40 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -8,8 +8,8 @@ declare module '@micro-app/types' { interface SandBoxInterface { proxyWindow: WindowProxy microAppWindow: Window // Proxy target - start (baseRoute: string): void - stop (): void + start (baseRoute: string, useMemoryRouter: boolean): void + stop (keepRouteState: boolean): void // record umd snapshot before the first execution of umdHookMount recordUmdSnapshot (): void // rebuild umd snapshot before remount umd app @@ -50,7 +50,9 @@ declare module '@micro-app/types' { inline: boolean // whether js runs in inline script mode, default is false scopecss: boolean // whether use css scoped, default is true useSandbox: boolean // whether use js sandbox, default is true + useMemoryRouter: boolean // whether use memoryRouter, default is true baseroute: string // route prefix, default is '' + keepRouteState: boolean // keep route state when unmount, default is false source: sourceType // sources of css, js, html sandBox: SandBoxInterface | null // sandbox umdMode: boolean // is umd mode @@ -69,6 +71,7 @@ declare module '@micro-app/types' { container?: HTMLElement | ShadowRoot, inline?: boolean, baseroute?: string, + keepRouteState?: boolean, ): void // unmount app @@ -111,6 +114,7 @@ declare module '@micro-app/types' { url: string, disableScopecss?: boolean disableSandbox?: boolean + disableMemoryRouter?: boolean shadowDOM?: boolean } @@ -168,6 +172,7 @@ declare module '@micro-app/types' { inline?: boolean disableScopecss?: boolean disableSandbox?: boolean + disableMemoryRouter?: boolean ssr?: boolean lifeCycles?: lifeCyclesType preFetchApps?: prefetchParamList @@ -184,6 +189,7 @@ declare module '@micro-app/types' { inline?: boolean disableScopecss?: boolean disableSandbox?: boolean + disableMemoryRouter?: boolean ssr?: boolean lifeCycles?: lifeCyclesType plugins?: plugins @@ -211,8 +217,8 @@ declare module '@micro-app/types' { 'replaceState' > | CallableFunction interface MicroRouter { - location: MicroLocation - history: MicroHistory + microLocation: MicroLocation + microHistory: MicroHistory } type LocationQueryValue = string | null type LocationQueryObject = Record< From c54c53304ae332d3ec522c7b33e03139673de778 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 16 Mar 2022 18:01:15 +0800 Subject: [PATCH 018/268] feat: update router at 3.16 --- .eslintignore | 1 - dev/children/react16/src/index.js | 9 ++++++ docs/zh-cn/dom-scope.md | 38 +++++++++++++++++++++++-- src/libs/utils.ts | 3 +- src/sandbox/router/core.ts | 47 +++++++++++++++---------------- src/sandbox/router/history.ts | 21 +++++++------- src/sandbox/router/index.ts | 3 ++ src/sandbox/router/location.ts | 5 ++-- 8 files changed, 84 insertions(+), 43 deletions(-) diff --git a/.eslintignore b/.eslintignore index f4d9ae8bf..aa9977beb 100755 --- a/.eslintignore +++ b/.eslintignore @@ -6,4 +6,3 @@ node_modules /docs /plugins /src/__tests__/demos -/src/sandbox/router.ts diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index 38d02f3b2..40279f3fc 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -258,3 +258,12 @@ if (window.__MICRO_APP_ENVIRONMENT__) { unBoundDom2.innerHTML = 'unBoundDom2' document.body.appendChild(unBoundDom2) } + +// 注意:!!!! 无论任何使用window.xx的情况都会重新触发元素绑定 +const _window = new Function('return window')() + +setTimeout(() => { + // window.microApp.removeDomScope() + console.log(_window.document.getElementById('root')) +}, 0) + diff --git a/docs/zh-cn/dom-scope.md b/docs/zh-cn/dom-scope.md index fa34a28f8..ee1711825 100644 --- a/docs/zh-cn/dom-scope.md +++ b/docs/zh-cn/dom-scope.md @@ -11,7 +11,10 @@ 这一点和ShadowDom不同,在微前端下基座拥有统筹全局的作用,所以我们没有对基座应用操作子应用元素的行为进行限制。 ### 解除元素绑定 -默认情况下,当子应用操作元素时会绑定元素作用域,而解绑过程是异步的,这可能会导致渲染出错,此时可以主动解除元素绑定来避免这个问题。 +默认情况下,当子应用操作元素时会绑定元素作用域,而解绑过程是异步的,这可能会导致操作元素异常,此时有两种方式可以解决这个问题。 + + +**方式一:执行removeDomScope** 执行`removeDomScope`方法后,元素作用域会重置为基座应用。 @@ -22,12 +25,43 @@ import { removeDomScope } from '@micro-zoe/micro-app' // 重置作用域 removeDomScope() + +// 全局获取id为root的元素 +window.document.getElementById('root') ``` #### ** 子应用 ** ```js +// 注意不要使用window.rawWindow +const _window = new Function('return window')() + // 重置作用域 -window.microApp.removeDomScope() +window.microApp.removeDomScope() + +// 全局获取id为root的元素 +_window.document.getElementById('root') ``` + +**方式二:使用setTimeout** + +#### ** 基座应用 ** +```js +// 等待解绑结束后操作元素 +setTimeout(() => { + window.document.getElementById('root') // 全局获取id为root的元素 +}, 0) +``` + +#### ** 子应用 ** +```js +// 注意不要使用window.rawWindow +const _window = new Function('return window')() + +// 等待解绑结束后操作元素 +setTimeout(() => { + _window.document.getElementById('root') // 全局获取id为root的元素 +}, 0) +``` + diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 880fe16ed..5d5ac4301 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -389,8 +389,7 @@ export function parseQuery (search: string): LocationQueryObject { const result: LocationQueryObject = {} const queryList = search.split('&') - // 注意我们不会对key和value进行解码,以确保替换url时前后值一致 - // 我们只对匹配到的微应用的key和value在后续进行编解码 + // we will not decode the key/value to ensure that the values are consistent when update URL for (const queryItem of queryList) { const eqPos = queryItem.indexOf('=') const key = eqPos < 0 ? queryItem : queryItem.slice(0, eqPos) diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts index 5a8095d26..cdef3d7b6 100644 --- a/src/sandbox/router/core.ts +++ b/src/sandbox/router/core.ts @@ -8,6 +8,7 @@ import { assign, parseQuery, stringifyQuery, + isString, } from '../../libs/utils' // set micro app state to origin state @@ -16,13 +17,12 @@ export function createMicroState ( rawState: MicroState, microState: MicroState, ): MicroState { - // 生成新的microAppState,因为它们在第二层 - const newMicroAppState = assign({}, rawState?.microAppState, { - [appName]: microState - }) // 生成新的state对象 return assign({}, rawState, { - microAppState: newMicroAppState + // 生成新的microAppState,因为它们在第二层 + microAppState: assign({}, rawState?.microAppState, { + [appName]: microState + }) }) } @@ -63,23 +63,6 @@ function commonDecode (path: string): string { } } -/** - * 根据location获取query对象 - */ -function getQueryObjectFromURL (search: string, hash: string): LocationQuery { - const queryObject: LocationQuery = {} - - if (search !== '' && search !== '?') { - queryObject.searchQuery = parseQuery(search.slice(1)) - } - - if (hash.includes('?')) { - queryObject.hashQuery = parseQuery(hash.slice(hash.indexOf('?') + 1)) - } - - return queryObject -} - // 格式化query参数key,防止与原有参数的冲突 function formatQueryAppName (appName: string) { return `app-${appName}` @@ -90,8 +73,7 @@ export function getMicroPathFromURL (appName: string): string | null { const rawLocation = globalEnv.rawWindow.location const queryObject = getQueryObjectFromURL(rawLocation.search, rawLocation.hash) const microPath = queryObject.hashQuery?.[formatQueryAppName(appName)] || queryObject.searchQuery?.[formatQueryAppName(appName)] - // 解码 - return microPath ? decodeMicroPath(microPath as string) : null + return isString(microPath) ? decodeMicroPath(microPath) : null } // 将name=encodeUrl地址插入到浏览器url上 @@ -146,3 +128,20 @@ export function removeMicroPathFromURL (appName: string): string { return pathname + search + hash } + +/** + * 根据location获取query对象 + */ +function getQueryObjectFromURL (search: string, hash: string): LocationQuery { + const queryObject: LocationQuery = {} + + if (search !== '' && search !== '?') { + queryObject.searchQuery = parseQuery(search.slice(1)) + } + + if (hash.includes('?')) { + queryObject.hashQuery = parseQuery(hash.slice(hash.indexOf('?') + 1)) + } + + return queryObject +} diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 22f50ec80..79bad39b6 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -5,10 +5,7 @@ import type { HistoryProxyValue, } from '@micro-app/types' import globalEnv from '../../libs/global_env' -import { - isString, - logError, -} from '../../libs/utils' +import { isString, logError } from '../../libs/utils' import { updateLocation } from './location' import { setMicroPathToURL, createMicroState, getMicroState } from './core' @@ -22,7 +19,7 @@ export function createMicroHistory ( // 是否需要在每次调用时都创建一个函数?这样看起来麻烦,但是是函数式编程,看起来更优雅 // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 - function microHistoryMethod (methodName: PropertyKey): CallableFunction { + function getMicroHistoryMethod (methodName: PropertyKey): CallableFunction { return (...rests: any[]) => { // console.log(444444444, rests[0], rests[1], rests[2], methodName) let targetPath = null @@ -32,16 +29,18 @@ export function createMicroHistory ( const targetLocation = new URL(rests[2], base) as MicroLocation if (targetLocation.origin === microLocation.origin) { targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash - // 经过格式化后的,包含某个微应用state的全量state - const newState = createMicroState(appName, rawHistory.state, rests[0]) - rests = [newState, rests[1], setMicroPathToURL(appName, targetLocation)] + rests = [ + createMicroState(appName, rawHistory.state, rests[0]), + rests[1], + setMicroPathToURL(appName, targetLocation), + ] } } catch (e) { logError(e, appName) } } - rawHistory[methodName](...rests) + rawHistory[methodName].apply(rawHistory, rests) if (targetPath) updateLocation(targetPath, base, microLocation) @@ -50,11 +49,11 @@ export function createMicroHistory ( } const microHistory = new Proxy(rawHistory, { - get (target: Record, key: PropertyKey): HistoryProxyValue { + get (target: History, key: PropertyKey): HistoryProxyValue { if (key === 'state') { return getMicroState(appName, rawHistory.state) } else if (typeof Reflect.get(target, key) === 'function') { - return microHistoryMethod(key) + return getMicroHistoryMethod(key) } return Reflect.get(target, key) }, diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index 7916fc324..769ad06bf 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -34,6 +34,7 @@ export function initRouteStateWithURL ( } } +// 清空路由信息,主要有2点:1、本地location更新为初始化 2、删除history.state 和 浏览器url上的参数信息 export function clearRouteStateFromURL ( appName: string, url: string, @@ -49,6 +50,8 @@ export function clearRouteStateFromURL ( ) } +// 所谓路由系统,无非两种操作:读、写 +// 读是通过location,写是通过replace/pushState export default function createMicroRouter (appName: string, url: string): MicroRouter { const microLocation = createMicroLocation(url) diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index b9fc0797e..f83a8a732 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -1,8 +1,6 @@ import type { MicroLocation } from '@micro-app/types' import globalEnv from '../../libs/global_env' -import { - assign as oAssign, -} from '../../libs/utils' +import { assign as oAssign } from '../../libs/utils' // location of micro app // 只会在沙箱初始化时执行一次 @@ -34,6 +32,7 @@ export function createMicroLocation (url: string): MicroLocation { // origin is readonly, so we ignore it const LocationKeys = ['hash', 'host', 'hostname', 'href', 'password', 'pathname', 'port', 'protocol', 'search'] +// 触发location更新的无非3种情况:1、push/replaceState 2、popState事件 3、初始化时url上有参数 export function updateLocation ( path: string, base: string, From 2b284024715188ddfa9040f4e790586d77393d50 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Tue, 22 Mar 2022 11:41:18 +0800 Subject: [PATCH 019/268] docs: update docs --- dev/children/react16/src/index.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dev/children/react16/src/index.css b/dev/children/react16/src/index.css index f21b17571..4c155dfed 100644 --- a/dev/children/react16/src/index.css +++ b/dev/children/react16/src/index.css @@ -7,6 +7,10 @@ body { -moz-osx-font-smoothing: grayscale; } +:global{ + @media (max-width: 575px){} +} + code { font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; @@ -44,3 +48,7 @@ code { float: none; } } + +:global{ + @media (max-width: 575px){} +} From 26ae75c75ab9f1307de55e29f5ae98737e6fbd9c Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Tue, 22 Mar 2022 21:23:13 +0800 Subject: [PATCH 020/268] feat: update location of h\ref, pathname, search, hash --- .eslintignore | 1 + dev/children/react16/src/index.js | 7 +- .../src/pages/angular11/angular11.js | 2 +- src/sandbox/router/core.ts | 14 +- src/sandbox/router/event.ts | 5 +- src/sandbox/router/history.ts | 12 +- src/sandbox/router/index.ts | 4 +- src/sandbox/router/location.ts | 216 +++++++++++++++++- typings/global.d.ts | 20 +- 9 files changed, 258 insertions(+), 23 deletions(-) diff --git a/.eslintignore b/.eslintignore index aa9977beb..b34a6aac1 100755 --- a/.eslintignore +++ b/.eslintignore @@ -6,3 +6,4 @@ node_modules /docs /plugins /src/__tests__/demos +/src/ diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index 40279f3fc..0018f5d53 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -265,5 +265,10 @@ const _window = new Function('return window')() setTimeout(() => { // window.microApp.removeDomScope() console.log(_window.document.getElementById('root')) -}, 0) +}, 0); + +// setTimeout(() => { +// window.location.href = 'http://localhost:3001/micro-app/react16/#abc' +// // console.log(111111, window.location) +// }, 5000); diff --git a/dev/main-react16/src/pages/angular11/angular11.js b/dev/main-react16/src/pages/angular11/angular11.js index 47be30308..f0a4988f1 100644 --- a/dev/main-react16/src/pages/angular11/angular11.js +++ b/dev/main-react16/src/pages/angular11/angular11.js @@ -25,7 +25,7 @@ function Angular11 () { onMounted={() => hideLoading(false)} // baseRoute='/micro-app/demo/angular11' // destroy - // inline + inline // disableScopecss > diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts index cdef3d7b6..d5227762c 100644 --- a/src/sandbox/router/core.ts +++ b/src/sandbox/router/core.ts @@ -76,8 +76,13 @@ export function getMicroPathFromURL (appName: string): string | null { return isString(microPath) ? decodeMicroPath(microPath) : null } +type setMicroPathResult = { + fullPath: string, + attach2Hash: boolean, +} + // 将name=encodeUrl地址插入到浏览器url上 -export function setMicroPathToURL (appName: string, microLocation: MicroLocation): string { +export function setMicroPathToURL (appName: string, microLocation: MicroLocation): setMicroPathResult { let { pathname, search, hash } = globalEnv.rawWindow.location const queryObject = getQueryObjectFromURL(search, hash) const encodedMicroPath = encodeMicroPath( @@ -86,8 +91,10 @@ export function setMicroPathToURL (appName: string, microLocation: MicroLocation microLocation.hash ) + let attach2Hash = false // 基座是否是hash模式,这个其实也不准,只是表示参数加到了hash上 // hash存在且search不存在,则认为是hash路由 if (hash && !search) { + attach2Hash = true if (queryObject.hashQuery) { queryObject.hashQuery[formatQueryAppName(appName)] = encodedMicroPath } else { @@ -108,7 +115,10 @@ export function setMicroPathToURL (appName: string, microLocation: MicroLocation search = '?' + stringifyQuery(queryObject.searchQuery) } - return pathname + search + hash + return { + fullPath: pathname + search + hash, + attach2Hash, + } } // 将name=encodeUrl的参数从浏览器url上删除 diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index 967193955..1d1147902 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -24,12 +24,11 @@ export function addHistoryListener (rawWindow: Window, appName: string): Callabl // @ts-ignore updateLocation(microPath, app.url, app.sandBox.proxyWindow.location) // @ts-ignore - // console.log(333333, microPath, app.sandBox.proxyWindow.location) + console.log(333333, microPath, app.sandBox.proxyWindow.location) } // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 - const state = getMicroState(appName, e.state) rawWindow.dispatchEvent( - new PopStateEvent(formatEventName('popstate', appName), { state }) + new PopStateEvent(formatEventName('popstate', appName), { state: getMicroState(appName, e.state) }) ) } } diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 79bad39b6..70ff75083 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -21,18 +21,18 @@ export function createMicroHistory ( // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 function getMicroHistoryMethod (methodName: PropertyKey): CallableFunction { return (...rests: any[]) => { - // console.log(444444444, rests[0], rests[1], rests[2], methodName) + console.log(444444444, rests[0], rests[1], rests[2], methodName) let targetPath = null // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! if ((methodName === 'pushState' || methodName === 'replaceState') && rests[2] && isString(rests[2])) { try { - const targetLocation = new URL(rests[2], base) as MicroLocation + const targetLocation = new URL('' + rests[2], base) as MicroLocation if (targetLocation.origin === microLocation.origin) { targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash rests = [ createMicroState(appName, rawHistory.state, rests[0]), rests[1], - setMicroPathToURL(appName, targetLocation), + setMicroPathToURL(appName, targetLocation).fullPath, ] } } catch (e) { @@ -44,11 +44,11 @@ export function createMicroHistory ( if (targetPath) updateLocation(targetPath, base, microLocation) - // console.log(5555555, microLocation, base) + console.log(5555555, microLocation, base) } } - const microHistory = new Proxy(rawHistory, { + return new Proxy(rawHistory, { get (target: History, key: PropertyKey): HistoryProxyValue { if (key === 'state') { return getMicroState(appName, rawHistory.state) @@ -58,8 +58,6 @@ export function createMicroHistory ( return Reflect.get(target, key) }, }) - - return microHistory } // 更新浏览器url diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index 769ad06bf..a06f24f9c 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -30,7 +30,7 @@ export function initRouteStateWithURL ( if (microPath) { updateLocation(microPath, url, microLocation) } else { - updateBrowserURL(globalEnv.rawWindow.history.state, setMicroPathToURL(appName, microLocation)) + updateBrowserURL(globalEnv.rawWindow.history.state, setMicroPathToURL(appName, microLocation).fullPath) } } @@ -53,7 +53,7 @@ export function clearRouteStateFromURL ( // 所谓路由系统,无非两种操作:读、写 // 读是通过location,写是通过replace/pushState export default function createMicroRouter (appName: string, url: string): MicroRouter { - const microLocation = createMicroLocation(url) + const microLocation = createMicroLocation(appName, url) return { microLocation, diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index f83a8a732..00ff85e12 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -1,12 +1,20 @@ -import type { MicroLocation } from '@micro-app/types' +import type { MicroLocation, LocationProxyValue } from '@micro-app/types' import globalEnv from '../../libs/global_env' -import { assign as oAssign } from '../../libs/utils' +import { assign as oAssign, rawDefineProperties } from '../../libs/utils' +import { setMicroPathToURL } from './core' // location of micro app // 只会在沙箱初始化时执行一次 -export function createMicroLocation (url: string): MicroLocation { - const rawLocation = globalEnv.rawWindow.location +export function createMicroLocation (appName: string, url: string): MicroLocation { + const rawWindow = globalEnv.rawWindow + const rawLocation = rawWindow.location const microLocation = new URL(url) as MicroLocation + const shadowLocation = { + href: microLocation.href, + pathname: microLocation.pathname, + search: microLocation.search, + hash: microLocation.hash, + } function assign (url: string | URL): void { rawLocation.assign(url) @@ -24,10 +32,197 @@ export function createMicroLocation (url: string): MicroLocation { oAssign(microLocation, { assign, replace, - reload + reload, + shadowLocation, + }) + + console.log(1111, microLocation) + + rawDefineProperties(microLocation, { + href: { + enumerable: true, + configurable: true, + get (): string { + return shadowLocation.href + }, + set (value: string): void { + const targetLocation = new URL('' + value, url) as MicroLocation + if (targetLocation.origin === microLocation.origin) { + const setMicroPathResult = setMicroPathToURL(appName, targetLocation) + /** + * change hash with location.href = xxx will not trigger the browser reload + * so we use pushState & reload to imitate href behavior + * NOTE: + * 1. if child app only change hash, it should not trigger browser reload + * 2. if address is the same and has hash, it should not add route stack + */ + if ( + targetLocation.pathname === shadowLocation.pathname && + targetLocation.search === shadowLocation.search + ) { + if (targetLocation.hash !== shadowLocation.hash) { + rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) + } + + if (targetLocation.hash) { + rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + } else { + rawLocation.reload() + } + + } else if (setMicroPathResult.attach2Hash) { + rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) + rawLocation.reload() + } + + value = setMicroPathResult.fullPath + } + + console.log(9999999999) + + rawLocation.href = value + } + }, + pathname: { + enumerable: true, + configurable: true, + get (): string { + return shadowLocation.pathname + }, + set (value: string): void { + console.log(77777777777) + const targetPath = value + shadowLocation.search + shadowLocation.hash + const targetLocation = new URL(targetPath, url) as MicroLocation + if (targetLocation.pathname === shadowLocation.pathname) { + rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + } else { + rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + rawLocation.reload() + } + } + }, + search: { + enumerable: true, + configurable: true, + get (): string { + return shadowLocation.search + }, + set (value: string): void { + const targetPath = shadowLocation.pathname + ('?' + value).replace(/^\?+/, '?') + shadowLocation.hash + const targetLocation = new URL(targetPath, url) as MicroLocation + if (targetLocation.search === shadowLocation.search) { + rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + } else { + rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + rawLocation.reload() + } + } + }, + hash: { + enumerable: true, + configurable: true, + get (): string { + return shadowLocation.hash + }, + set (value: string): void { + const targetPath = shadowLocation.pathname + shadowLocation.search + ('#' + value).replace(/^#+/, '#') + const targetLocation = new URL(targetPath, url) as MicroLocation + if (targetLocation.hash !== shadowLocation.hash) { + rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + } + } + }, }) return microLocation + + const ownKeysOfMicroLocation: PropertyKey[] = ['assign', 'replace', 'reload', 'shadowLocation'] + return new Proxy(microLocation, { + // get (target: MicroLocation, key: PropertyKey): LocationProxyValue { + // if (ownKeysOfMicroLocation.includes(key)) { + // return Reflect.get(target, key) + // } + // return Reflect.get(shadowLocation, key) + // }, + // set (target: MicroLocation, key: PropertyKey, value: unknown): boolean { + // if (key === 'href') { + // const targetLocation = new URL('' + value, url) as MicroLocation + // if (targetLocation.origin === shadowLocation.origin) { + // const setMicroPathResult = setMicroPathToURL(appName, targetLocation) + // /** + // * change hash with location.href = xxx will not trigger the browser reload + // * so we use pushState & reload to imitate href behavior + // * NOTE: + // * 1. if child app only change hash, it should not trigger browser reload + // * 2. if address is the same and has hash, it should not add route stack + // */ + // if ( + // targetLocation.pathname === shadowLocation.pathname && + // targetLocation.search === shadowLocation.search + // ) { + // if (targetLocation.hash !== shadowLocation.hash) { + // rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) + // } + + // if (targetLocation.hash) { + // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + // } else { + // rawLocation.reload() + // } + + // return true + // } else if (setMicroPathResult.attach2Hash) { + // rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) + // rawLocation.reload() + // return true + // } + + // value = setMicroPathResult.fullPath + // } + + // return Reflect.set(rawLocation, key, value) + // } else if (key === 'pathname') { + // const targetPath = value + shadowLocation.search + shadowLocation.hash + // const targetLocation = new URL(targetPath, url) as MicroLocation + // if (targetLocation.pathname === shadowLocation.pathname) { + // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + // } else { + // rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + // rawLocation.reload() + // } + // return true + // } else if (key === 'search') { + // const targetPath = shadowLocation.pathname + ('?' + value).replace(/^\?+/, '?') + shadowLocation.hash + // const targetLocation = new URL(targetPath, url) as MicroLocation + // if (targetLocation.search === shadowLocation.search) { + // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + // } else { + // rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + // rawLocation.reload() + // } + // return true + // } else if (key === 'hash') { + // const targetPath = shadowLocation.pathname + shadowLocation.search + ('#' + value).replace(/^#+/, '#') + // const targetLocation = new URL(targetPath, url) as MicroLocation + // if (targetLocation.hash !== shadowLocation.hash) { + // rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + // } + // return true + // } + + // if (ownKeysOfMicroLocation.includes(key)) { + // return Reflect.set(target, key, value) + // } + + // if (key === 'protocol') { + // return Reflect.set(rawLocation, key, value) + // } + + // return Reflect.set(shadowLocation, key, value) + // } + }) } // origin is readonly, so we ignore it @@ -39,8 +234,17 @@ export function updateLocation ( microLocation: MicroLocation, ): void { const newLocation = new URL(path, base) + console.log(888888888, newLocation) for (const key of LocationKeys) { + if (key === 'href' || key === 'pathname' || key === 'search' || key === 'hash') { + // @ts-ignore + microLocation.shadowLocation[key] = newLocation[key] + } else { + // @ts-ignore + microLocation[key] = newLocation[key] + } + // @ts-ignore - microLocation[key] = newLocation[key] + // microLocation[key] = newLocation[key] } } diff --git a/typings/global.d.ts b/typings/global.d.ts index 39c415f40..f095706e6 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -201,7 +201,9 @@ declare module '@micro-app/types' { // special CallableFunction for interact type CallableFunctionForInteract = CallableFunction & { __APP_NAME__?: string, __AUTO_TRIGGER__?: boolean } - interface MicroLocation extends Location, URL {} + interface MicroLocation extends Location, URL { + shadowLocation: URL + } type MicroHistory = ProxyHandler type MicroState = any type HistoryProxyValue = @@ -216,6 +218,22 @@ declare module '@micro-app/types' { 'pushState' | 'replaceState' > | CallableFunction + type LocationProxyValue = + Pick< + Location, + 'href' | + 'protocol' | + 'host' | + 'hostname' | + 'port' | + 'pathname' | + 'search' | + 'hash' | + 'origin' | + 'assign' | + 'reload' | + 'replace' + > | CallableFunction | URL interface MicroRouter { microLocation: MicroLocation microHistory: MicroHistory From ca17183c7963d7e0e758763c92180fe53f5ab0cd Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 23 Mar 2022 21:07:28 +0800 Subject: [PATCH 021/268] feat: complete location api & hashchange event --- .eslintignore | 1 - dev/children/react16/src/index.js | 9 +- dev/children/react17/src/index.js | 8 + .../src/pages/angular11/angular11.js | 2 +- src/sandbox/__save__router.ts | 368 ------------------ src/sandbox/effect.ts | 2 +- src/sandbox/router/event.ts | 49 ++- src/sandbox/router/history.ts | 6 +- src/sandbox/router/location.ts | 265 +++++-------- typings/global.d.ts | 16 - 10 files changed, 160 insertions(+), 566 deletions(-) delete mode 100644 src/sandbox/__save__router.ts diff --git a/.eslintignore b/.eslintignore index b34a6aac1..aa9977beb 100755 --- a/.eslintignore +++ b/.eslintignore @@ -6,4 +6,3 @@ node_modules /docs /plugins /src/__tests__/demos -/src/ diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index 0018f5d53..47ed95e32 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -269,6 +269,13 @@ setTimeout(() => { // setTimeout(() => { -// window.location.href = 'http://localhost:3001/micro-app/react16/#abc' +// // window.location.href = 'http://localhost:3001/micro-app/react16/#abc' +// window.location.pathname = '/micro-app/react16/page2#fff' +// // window.location.assign('http://localhost:3001/micro-app/react16/page2#eee') +// // window.location.replace('http://localhost:3001/micro-app/react16/page2#eee') // // console.log(111111, window.location) // }, 5000); + +window.onpopstate = (e) => { + console.log(888888888, e) +} diff --git a/dev/children/react17/src/index.js b/dev/children/react17/src/index.js index 7b04b8395..e7fc6a2e1 100644 --- a/dev/children/react17/src/index.js +++ b/dev/children/react17/src/index.js @@ -36,3 +36,11 @@ if (window.__MICRO_APP_ENVIRONMENT__) { // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals reportWebVitals(); + +window.addEventListener('popstate', (e) => { + console.log('popstate', e) +}) + +window.addEventListener('hashchange', (e) => { + console.log('hashchange', e) +}) diff --git a/dev/main-react16/src/pages/angular11/angular11.js b/dev/main-react16/src/pages/angular11/angular11.js index f0a4988f1..47be30308 100644 --- a/dev/main-react16/src/pages/angular11/angular11.js +++ b/dev/main-react16/src/pages/angular11/angular11.js @@ -25,7 +25,7 @@ function Angular11 () { onMounted={() => hideLoading(false)} // baseRoute='/micro-app/demo/angular11' // destroy - inline + // inline // disableScopecss > diff --git a/src/sandbox/__save__router.ts b/src/sandbox/__save__router.ts deleted file mode 100644 index 807fef1c2..000000000 --- a/src/sandbox/__save__router.ts +++ /dev/null @@ -1,368 +0,0 @@ -/* eslint-disable */ -import type { - MicroRouter, - MicroLocation, - MicroHistory, - MicroState, - HistoryProxyValue, - LocationQueryValue, - LocationQuery, - LocationQueryObject, -} from '@micro-app/types' -import globalEnv from '../libs/global_env' -import { - assign as oAssign, - isArray, - isNull, - isString, - isUndefined, - logError, -} from '../libs/utils' -import { appInstanceMap } from '../create_app' -import { getActiveApps } from '../micro_app' -import { formatEventName } from './effect' - -type PopStateListener = (this: Window, e: PopStateEvent) => void - -/** - * register & release popstate event - * @param rawWindow origin window - * @param appName app name - * @returns release callback - */ -export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { - // Send to the child app after receiving the popstate event - const popStateHandler: PopStateListener = (e: PopStateEvent): void => { - const activeApps = getActiveApps(true) - if (activeApps.includes(appName)) { - // 先更新location,再发送popstate事件 - const microPath = getMicroPathFromURL(appName) - if (microPath) { - const app = appInstanceMap.get(appName) - // @ts-ignore - updateLocation(microPath, app.url, app.sandBox.proxyWindow.location) - // @ts-ignore - console.log(333333, microPath, app.sandBox.proxyWindow.location) - } - // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 - const state = getMicroState(appName, e.state) - rawWindow.dispatchEvent( - new PopStateEvent(formatEventName('popstate', appName), { state }) - ) - } - } - - rawWindow.addEventListener('popstate', popStateHandler) - - return () => { - rawWindow.removeEventListener('popstate', popStateHandler) - } -} - -// set micro app state to origin state -function createMicroState ( - appName: string, - rawState: MicroState, - microState: MicroState, -): MicroState { - // 生成新的microAppState,因为它们在第二层 - const newMicroAppState = oAssign({}, rawState?.microAppState, { - [appName]: microState - }) - // 生成新的state对象 - return oAssign({}, rawState, { - microAppState: newMicroAppState - }) -} - -// get micro app state form origin state -function getMicroState (appName: string, state: MicroState): MicroState { - return state?.microAppState?.[appName] || null -} - -// delete micro app state form origin state -function deleteMicroState (appName: string, rawState: MicroState): MicroState { - if (rawState?.microAppState?.[appName]) { - delete rawState.microAppState[appName] - } - // 生成新的state对象 - return oAssign({}, rawState) -} - -// history of micro app -function createMicroHistory (appName: string, base: string, microLocation: MicroLocation): MicroHistory { - const rawHistory = globalEnv.rawWindow.history - - // 是否需要在每次调用时都创建一个函数?这样看起来麻烦,但是是函数式编程,看起来更优雅 - // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 - function microHistoryMethod (methodName: PropertyKey): CallableFunction { - return (...rests: any[]) => { - console.log(444444444, rests[0], rests[1], rests[2], methodName) - let targetPath = null - // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! - if ((methodName === 'pushState' || methodName === 'replaceState') && rests[2] && isString(rests[2])) { - try { - const targetLocation = new URL(rests[2], base) as MicroLocation - if (targetLocation.origin === microLocation.origin) { - targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash - // 经过格式化后的,包含某个微应用state的全量state - const newState = createMicroState(appName, rawHistory.state, rests[0]) - rests = [newState, rests[1], attachMicroQueryToURL(appName, targetLocation)] - } - } catch (e) { - logError(e, appName) - } - } - - rawHistory[methodName](...rests) - - if (targetPath) updateLocation(targetPath, base, microLocation) - - console.log(5555555, microLocation, base) - } - } - - const microHistory = new Proxy(rawHistory, { - get (target: Record, key: PropertyKey): HistoryProxyValue { - if (key === 'state') { - return getMicroState(appName, rawHistory.state) - } else if (typeof Reflect.get(target, key) === 'function') { - return microHistoryMethod(key) - } - return Reflect.get(target, key) - }, - }) - - return microHistory -} - -const ENC_AD_RE = /&/g // %M1 -const ENC_EQ_RE = /=/g // %M2 -const DEC_AD_RE = /%M1/g // & -const DEC_EQ_RE = /%M2/g // = - -function encodeMicroPath (path: string): string { - return encodeURIComponent(commonDecode(path).replace(ENC_AD_RE, '%M1').replace(ENC_EQ_RE, '%M2')) -} - -function decodeMicroPath (path: string): string { - return commonDecode(path).replace(DEC_AD_RE, '&').replace(DEC_EQ_RE, '=') -} - -function commonDecode (path: string): string { - try { - const decPath = decodeURIComponent(path) - if (path === decPath || DEC_AD_RE.test(decPath) || DEC_EQ_RE.test(decPath)) return decPath - return commonDecode(decPath) - } catch { - return path - } -} - -// 格式化query参数key,防止与原有参数的冲突 -function formatQueryAppName (appName: string) { - return `app-${appName}` -} - -// 根据浏览器url参数,获取当前子应用的fullPath -function getMicroPathFromURL (appName: string): string | null { - const rawLocation = globalEnv.rawWindow.location - const queryObject = getQueryObjectFromURL(rawLocation.search, rawLocation.hash) - const microPath = queryObject.hashQuery?.[formatQueryAppName(appName)] || queryObject.searchQuery?.[formatQueryAppName(appName)] - // 解码 - return microPath ? decodeMicroPath(microPath as string) : null -} - -// 将name=encodeUrl地址插入到浏览器url上 -function attachMicroQueryToURL (appName: string, microLocation: MicroLocation): string { - let { pathname, search, hash } = globalEnv.rawWindow.location - const microQueryObject = getQueryObjectFromURL(search, hash) - const encodedMicroPath = encodeMicroPath( - microLocation.pathname + - microLocation.search + - microLocation.hash - ) - - // hash存在且search不存在,则认为是hash路由 - if (hash && !search) { - if (microQueryObject.hashQuery) { - microQueryObject.hashQuery[formatQueryAppName(appName)] = encodedMicroPath - } else { - microQueryObject.hashQuery = { - [formatQueryAppName(appName)]: encodedMicroPath - } - } - const baseHash = hash.includes('?') ? hash.slice(0, hash.indexOf('?') + 1) : hash + '?' - hash = baseHash + stringifyQuery(microQueryObject.hashQuery) - } else { - if (microQueryObject.searchQuery) { - microQueryObject.searchQuery[formatQueryAppName(appName)] = encodedMicroPath - } else { - microQueryObject.searchQuery = { - [formatQueryAppName(appName)]: encodedMicroPath - } - } - search = '?' + stringifyQuery(microQueryObject.searchQuery) - } - - return pathname + search + hash -} - -// 将name=encodeUrl的参数从浏览器url上删除 -function removeMicroQueryFromURL (appName: string): string { - let { pathname, search, hash } = globalEnv.rawWindow.location - const microQueryObject = getQueryObjectFromURL(search, hash) - - if (microQueryObject.hashQuery?.[formatQueryAppName(appName)]) { - delete microQueryObject.hashQuery?.[formatQueryAppName(appName)] - const hashQueryStr = stringifyQuery(microQueryObject.hashQuery) - hash = hash.slice(0, hash.indexOf('?') + Number(Boolean(hashQueryStr))) + hashQueryStr - } else if (microQueryObject.searchQuery?.[formatQueryAppName(appName)]) { - delete microQueryObject.searchQuery?.[formatQueryAppName(appName)] - const searchQueryStr = stringifyQuery(microQueryObject.searchQuery) - search = searchQueryStr ? '?' + searchQueryStr : '' - } - - return pathname + search + hash -} - -/** - * 根据location获取query对象 - */ -function getQueryObjectFromURL (search: string, hash: string): LocationQuery { - const queryObject: LocationQuery = {} - - if (search !== '' && search !== '?') { - queryObject.searchQuery = parseQuery(search.slice(1)) - } - - if (hash.includes('?')) { - queryObject.hashQuery = parseQuery(hash.slice(hash.indexOf('?') + 1)) - } - - return queryObject -} - -// 将参数字符串转换为对象 -function parseQuery (search: string): LocationQueryObject { - const result: LocationQueryObject = {} - const queryList = search.split('&') - - // 注意我们不会对key和value进行解码,以确保替换url时前后值一致 - // 我们只对匹配到的微应用的key和value在后续进行编解码 - for (const queryItem of queryList) { - const eqPos = queryItem.indexOf('=') - const key = eqPos < 0 ? queryItem : queryItem.slice(0, eqPos) - const value = eqPos < 0 ? null : queryItem.slice(eqPos + 1) - - if (key in result) { - let currentValue = result[key] - if (!isArray(currentValue)) { - currentValue = result[key] = [currentValue] - } - currentValue.push(value) - } else { - result[key] = value - } - } - - return result -} - -// 将对象转换为字符串,一次只能格式化一个,所以search和hash需要分2次处理 -function stringifyQuery (queryObject: LocationQueryObject): string { - let result = '' - - for (const key in queryObject) { - const value = queryObject[key] - if (isNull(value)) { - result += (result.length ? '&' : '') + key - } else { - const valueList: LocationQueryValue[] = isArray(value) ? value : [value] - - valueList.forEach(value => { - if (!isUndefined(value)) { - result += (result.length ? '&' : '') + key - if (!isNull(value)) result += '=' + value - } - }) - } - } - - return result -} - -// location of micro app -// 只会在沙箱初始化时执行一次 -function createMicroLocation (url: string): MicroLocation { - const rawLocation = globalEnv.rawWindow.location - const microLocation = new URL(url) as MicroLocation - - function assign (url: string | URL): void { - rawLocation.assign(url) - } - - function replace (url: string | URL): void { - rawLocation.replace(url) - } - - function reload (forcedReload?: boolean): void { - // @ts-ignore - rawLocation.reload(forcedReload) - } - - oAssign(microLocation, { - assign, - replace, - reload - }) - - return microLocation -} - -// origin is readonly, so we ignore it -const LocationKeys = ['hash', 'host', 'hostname', 'href', 'password', 'pathname', 'port', 'protocol', 'search'] -function updateLocation (path: string, base: string, microLocation: MicroLocation) { - const newLocation = new URL(path, base) - for (const key of LocationKeys) { - // @ts-ignore - microLocation[key] = newLocation[key] - } -} - -// 更新浏览器url -function updateBrowserURL (state: MicroState, fullPath: string): void { - globalEnv.rawWindow.history.replaceState(state, null, fullPath) -} - -// 当沙箱执行start, 或者隐藏的keep-alive应用重新渲染时时才:根据浏览器url更新location 或者 将参数更新到url上 -export function initRouteStateWithURL (appName: string, url: string, microLocation: MicroLocation) { - const microPath = getMicroPathFromURL(appName) - // 如果初始化时参数有子应用的数据信息,则直接复用,如果没有则重新创建 - - if (microPath) { - updateLocation(microPath, url, microLocation) - } else { - updateBrowserURL(globalEnv.rawWindow.history.state, attachMicroQueryToURL(appName, microLocation)) - } -} - -export function clearRouteStateFromURL (appName: string, url: string, microLocation: MicroLocation) { - // 初始化location信息 - const { pathname, search, hash } = new URL(url) - updateLocation(pathname + search + hash, url, microLocation) - // 删除浏览器url上的子应用参数 - updateBrowserURL( - deleteMicroState(appName, globalEnv.rawWindow.history.state), - removeMicroQueryFromURL(appName), - ) -} - -export default function createMicroRouter (appName: string, url: string): MicroRouter { - const microLocation = createMicroLocation(url) - - return { - microLocation, - microHistory: createMicroHistory(appName, url, microLocation), - } -} diff --git a/src/sandbox/effect.ts b/src/sandbox/effect.ts index e3f79207b..676209022 100644 --- a/src/sandbox/effect.ts +++ b/src/sandbox/effect.ts @@ -29,7 +29,7 @@ export function formatEventName (eventName: string, appName: string): string { if ( formatEventList.includes(eventName) || ( - eventName === 'popstate' && + (eventName === 'popstate' || eventName === 'hashchange') && appInstanceMap.get(appName)?.useMemoryRouter ) ) { diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index 1d1147902..4913c8032 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -1,3 +1,4 @@ +import type { MicroLocation } from '@micro-app/types' import { appInstanceMap } from '../../create_app' import { getActiveApps } from '../../micro_app' import { formatEventName } from '../effect' @@ -7,29 +8,57 @@ import { updateLocation } from './location' type PopStateListener = (this: Window, e: PopStateEvent) => void /** - * register & release popstate event + * listen & release popstate event + * each child app will listen for popstate event when sandbox start + * and release it when sandbox stop * @param rawWindow origin window * @param appName app name * @returns release callback */ export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { - // Send to the child app after receiving the popstate event + // handle popstate event and distribute to child app const popStateHandler: PopStateListener = (e: PopStateEvent): void => { const activeApps = getActiveApps(true) if (activeApps.includes(appName)) { // 先更新location,再发送popstate事件 const microPath = getMicroPathFromURL(appName) + const app = appInstanceMap.get(appName)! + const proxyWindow = app.sandBox!.proxyWindow + let isHashChange = false + // for hashChangeEvent + const oldHref = proxyWindow.location.href if (microPath) { - const app = appInstanceMap.get(appName) - // @ts-ignore - updateLocation(microPath, app.url, app.sandBox.proxyWindow.location) - // @ts-ignore - console.log(333333, microPath, app.sandBox.proxyWindow.location) + const oldHash = proxyWindow.location.hash + updateLocation(microPath, app.url, proxyWindow.location as MicroLocation) + isHashChange = proxyWindow.location.hash !== oldHash } - // 向当前子应用发送popstate-appname的事件,state的值需要被格式化 - rawWindow.dispatchEvent( - new PopStateEvent(formatEventName('popstate', appName), { state: getMicroState(appName, e.state) }) + + // console.log(333333, microPath, proxyWindow.location) + + // create PopStateEvent named popstate-appName with sub app state + const newPopStateEvent = new PopStateEvent( + formatEventName('popstate', appName), + { state: getMicroState(appName, e.state) } ) + + rawWindow.dispatchEvent(newPopStateEvent) + + typeof proxyWindow.onpopstate === 'function' && proxyWindow.onpopstate(newPopStateEvent) + + // send HashChangeEvent when hash change + if (isHashChange) { + const newHashChangeEvent = new HashChangeEvent( + formatEventName('hashchange', appName), + { + newURL: proxyWindow.location.href, + oldURL: oldHref, + } + ) + + rawWindow.dispatchEvent(newHashChangeEvent) + + typeof proxyWindow.onhashchange === 'function' && proxyWindow.onhashchange(newHashChangeEvent) + } } } diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 70ff75083..07d0127f8 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -21,7 +21,7 @@ export function createMicroHistory ( // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 function getMicroHistoryMethod (methodName: PropertyKey): CallableFunction { return (...rests: any[]) => { - console.log(444444444, rests[0], rests[1], rests[2], methodName) + // console.log(444444444, rests[0], rests[1], rests[2], methodName) let targetPath = null // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! if ((methodName === 'pushState' || methodName === 'replaceState') && rests[2] && isString(rests[2])) { @@ -44,7 +44,7 @@ export function createMicroHistory ( if (targetPath) updateLocation(targetPath, base, microLocation) - console.log(5555555, microLocation, base) + // console.log(5555555, microLocation, base) } } @@ -60,7 +60,7 @@ export function createMicroHistory ( }) } -// 更新浏览器url +// update browser url export function updateBrowserURL (state: MicroState, fullPath: string): void { globalEnv.rawWindow.history.replaceState(state, null, fullPath) } diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index 00ff85e12..b772ec423 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -1,14 +1,20 @@ -import type { MicroLocation, LocationProxyValue } from '@micro-app/types' +/* eslint-disable no-void */ +import type { MicroLocation } from '@micro-app/types' import globalEnv from '../../libs/global_env' import { assign as oAssign, rawDefineProperties } from '../../libs/utils' import { setMicroPathToURL } from './core' -// location of micro app -// 只会在沙箱初始化时执行一次 +/** + * create location for micro app + * @param appName app name + * @param url app url + */ export function createMicroLocation (appName: string, url: string): MicroLocation { const rawWindow = globalEnv.rawWindow const rawLocation = rawWindow.location + // microLocation is the location of child app, it is globally unique const microLocation = new URL(url) as MicroLocation + // shadowLocation is the host of some special keys (href, pathname, search, hash) const shadowLocation = { href: microLocation.href, pathname: microLocation.pathname, @@ -16,19 +22,61 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio hash: microLocation.hash, } - function assign (url: string | URL): void { - rawLocation.assign(url) - } + /** + * Common handler for href, assign, replace + * It is mainly used to deal with special scenes about hash + * @param value target path + * @param methodName pushState/replaceState + * @returns origin value or formatted value + */ + const commonHandle = (value: string | URL, methodName: string): string | URL | undefined => { + const targetLocation = new URL('' + value, url) as MicroLocation + if (targetLocation.origin === microLocation.origin) { + const setMicroPathResult = setMicroPathToURL(appName, targetLocation) + /** + * change hash with location.href = xxx will not trigger the browser reload + * so we use pushState & reload to imitate href behavior + * NOTE: + * 1. if child app only change hash, it should not trigger browser reload + * 2. if address is the same and has hash, it should not add route stack + */ + if ( + targetLocation.pathname === shadowLocation.pathname && + targetLocation.search === shadowLocation.search + ) { + if (targetLocation.hash !== shadowLocation.hash) { + rawWindow.history[methodName](null, null, setMicroPathResult.fullPath) + } + + if (targetLocation.hash) { + rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + } else { + rawLocation.reload() + } + return void 0 + } else if (setMicroPathResult.attach2Hash) { + rawWindow.history[methodName](null, null, setMicroPathResult.fullPath) + rawLocation.reload() + return void 0 + } - function replace (url: string | URL): void { - rawLocation.replace(url) + value = setMicroPathResult.fullPath + } + + return value } - function reload (forcedReload?: boolean): void { - // @ts-ignore - rawLocation.reload(forcedReload) + const assignOrReplace = (value: string | URL, locationMethodName: string) => { + const formattedValue = commonHandle(value, locationMethodName === 'assign' ? 'pushState' : 'replaceState') + if (formattedValue) rawLocation[locationMethodName](formattedValue) } + const assign = (value: string | URL): void => assignOrReplace(value, 'assign') + + const replace = (value: string | URL): void => assignOrReplace(value, 'replace') + + const reload = (forcedReload?: boolean): void => rawLocation.reload(forcedReload) + oAssign(microLocation, { assign, replace, @@ -36,67 +84,35 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio shadowLocation, }) - console.log(1111, microLocation) - + /** + * Special processing for four keys: href, pathname, search and hash + * They take values from shadowLocation, and require special operations when assigning values + */ rawDefineProperties(microLocation, { href: { enumerable: true, configurable: true, - get (): string { - return shadowLocation.href - }, - set (value: string): void { - const targetLocation = new URL('' + value, url) as MicroLocation - if (targetLocation.origin === microLocation.origin) { - const setMicroPathResult = setMicroPathToURL(appName, targetLocation) - /** - * change hash with location.href = xxx will not trigger the browser reload - * so we use pushState & reload to imitate href behavior - * NOTE: - * 1. if child app only change hash, it should not trigger browser reload - * 2. if address is the same and has hash, it should not add route stack - */ - if ( - targetLocation.pathname === shadowLocation.pathname && - targetLocation.search === shadowLocation.search - ) { - if (targetLocation.hash !== shadowLocation.hash) { - rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) - } - - if (targetLocation.hash) { - rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) - } else { - rawLocation.reload() - } - - } else if (setMicroPathResult.attach2Hash) { - rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) - rawLocation.reload() - } - - value = setMicroPathResult.fullPath - } - - console.log(9999999999) - - rawLocation.href = value + get: (): string => shadowLocation.href, + set: (value: string): void => { + const formattedValue = commonHandle(value, 'pushState') + if (formattedValue) rawLocation.href = formattedValue } }, pathname: { enumerable: true, configurable: true, - get (): string { - return shadowLocation.pathname - }, - set (value: string): void { - console.log(77777777777) - const targetPath = value + shadowLocation.search + shadowLocation.hash + get: (): string => shadowLocation.pathname, + set: (value: string): void => { + const targetPath = ('/' + value).replace(/^\/+/, '/') + shadowLocation.search + shadowLocation.hash const targetLocation = new URL(targetPath, url) as MicroLocation - if (targetLocation.pathname === shadowLocation.pathname) { + // When the browser url has a hash value, the same pathname will not trigger the browser refresh + if (targetLocation.pathname === shadowLocation.pathname && shadowLocation.hash) { rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) } else { - rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + // When the value is the same, no new route stack will be added + // Special scenes such as: /path ==> /path#hash, /path ==> /path?query + const methodName = targetLocation.pathname === shadowLocation.pathname ? 'replaceState' : 'pushState' + rawWindow.history[methodName](null, null, setMicroPathToURL(appName, targetLocation).fullPath) rawLocation.reload() } } @@ -104,16 +120,18 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio search: { enumerable: true, configurable: true, - get (): string { - return shadowLocation.search - }, - set (value: string): void { + get: (): string => shadowLocation.search, + set: (value: string): void => { const targetPath = shadowLocation.pathname + ('?' + value).replace(/^\?+/, '?') + shadowLocation.hash const targetLocation = new URL(targetPath, url) as MicroLocation - if (targetLocation.search === shadowLocation.search) { + // When the browser url has a hash value, the same search will not trigger the browser refresh + if (targetLocation.search === shadowLocation.search && shadowLocation.hash) { rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) } else { - rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + // When the value is the same, no new route stack will be added + // Special scenes such as: ?query ==> ?query#hash + const methodName = targetLocation.search === shadowLocation.search ? 'replaceState' : 'pushState' + rawWindow.history[methodName](null, null, setMicroPathToURL(appName, targetLocation).fullPath) rawLocation.reload() } } @@ -121,12 +139,11 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio hash: { enumerable: true, configurable: true, - get (): string { - return shadowLocation.hash - }, - set (value: string): void { + get: (): string => shadowLocation.hash, + set: (value: string): void => { const targetPath = shadowLocation.pathname + shadowLocation.search + ('#' + value).replace(/^#+/, '#') const targetLocation = new URL(targetPath, url) as MicroLocation + // The same hash will not trigger popStateEvent if (targetLocation.hash !== shadowLocation.hash) { rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) @@ -136,115 +153,33 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio }) return microLocation - - const ownKeysOfMicroLocation: PropertyKey[] = ['assign', 'replace', 'reload', 'shadowLocation'] - return new Proxy(microLocation, { - // get (target: MicroLocation, key: PropertyKey): LocationProxyValue { - // if (ownKeysOfMicroLocation.includes(key)) { - // return Reflect.get(target, key) - // } - // return Reflect.get(shadowLocation, key) - // }, - // set (target: MicroLocation, key: PropertyKey, value: unknown): boolean { - // if (key === 'href') { - // const targetLocation = new URL('' + value, url) as MicroLocation - // if (targetLocation.origin === shadowLocation.origin) { - // const setMicroPathResult = setMicroPathToURL(appName, targetLocation) - // /** - // * change hash with location.href = xxx will not trigger the browser reload - // * so we use pushState & reload to imitate href behavior - // * NOTE: - // * 1. if child app only change hash, it should not trigger browser reload - // * 2. if address is the same and has hash, it should not add route stack - // */ - // if ( - // targetLocation.pathname === shadowLocation.pathname && - // targetLocation.search === shadowLocation.search - // ) { - // if (targetLocation.hash !== shadowLocation.hash) { - // rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) - // } - - // if (targetLocation.hash) { - // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) - // } else { - // rawLocation.reload() - // } - - // return true - // } else if (setMicroPathResult.attach2Hash) { - // rawWindow.history.pushState(null, null, setMicroPathResult.fullPath) - // rawLocation.reload() - // return true - // } - - // value = setMicroPathResult.fullPath - // } - - // return Reflect.set(rawLocation, key, value) - // } else if (key === 'pathname') { - // const targetPath = value + shadowLocation.search + shadowLocation.hash - // const targetLocation = new URL(targetPath, url) as MicroLocation - // if (targetLocation.pathname === shadowLocation.pathname) { - // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) - // } else { - // rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) - // rawLocation.reload() - // } - // return true - // } else if (key === 'search') { - // const targetPath = shadowLocation.pathname + ('?' + value).replace(/^\?+/, '?') + shadowLocation.hash - // const targetLocation = new URL(targetPath, url) as MicroLocation - // if (targetLocation.search === shadowLocation.search) { - // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) - // } else { - // rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) - // rawLocation.reload() - // } - // return true - // } else if (key === 'hash') { - // const targetPath = shadowLocation.pathname + shadowLocation.search + ('#' + value).replace(/^#+/, '#') - // const targetLocation = new URL(targetPath, url) as MicroLocation - // if (targetLocation.hash !== shadowLocation.hash) { - // rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) - // rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) - // } - // return true - // } - - // if (ownKeysOfMicroLocation.includes(key)) { - // return Reflect.set(target, key, value) - // } - - // if (key === 'protocol') { - // return Reflect.set(rawLocation, key, value) - // } - - // return Reflect.set(shadowLocation, key, value) - // } - }) } // origin is readonly, so we ignore it -const LocationKeys = ['hash', 'host', 'hostname', 'href', 'password', 'pathname', 'port', 'protocol', 'search'] -// 触发location更新的无非3种情况:1、push/replaceState 2、popState事件 3、初始化时url上有参数 +const locationKeys = ['hash', 'host', 'hostname', 'href', 'password', 'pathname', 'port', 'protocol', 'search'] +const shadowLocationKeys = ['href', 'pathname', 'search', 'hash'] +/** + * There are three situations that trigger location update: + * 1. pushState/replaceState + * 2. popStateEvent + * 3. params on browser url when init sub app + * @param path target path + * @param base base url + * @param microLocation micro app location + */ export function updateLocation ( path: string, base: string, microLocation: MicroLocation, ): void { const newLocation = new URL(path, base) - console.log(888888888, newLocation) - for (const key of LocationKeys) { - if (key === 'href' || key === 'pathname' || key === 'search' || key === 'hash') { + for (const key of locationKeys) { + if (shadowLocationKeys.includes(key)) { // @ts-ignore microLocation.shadowLocation[key] = newLocation[key] } else { // @ts-ignore microLocation[key] = newLocation[key] } - - // @ts-ignore - // microLocation[key] = newLocation[key] } } diff --git a/typings/global.d.ts b/typings/global.d.ts index f095706e6..3a713ccca 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -218,22 +218,6 @@ declare module '@micro-app/types' { 'pushState' | 'replaceState' > | CallableFunction - type LocationProxyValue = - Pick< - Location, - 'href' | - 'protocol' | - 'host' | - 'hostname' | - 'port' | - 'pathname' | - 'search' | - 'hash' | - 'origin' | - 'assign' | - 'reload' | - 'replace' - > | CallableFunction | URL interface MicroRouter { microLocation: MicroLocation microHistory: MicroHistory From fb73109d4ba18471038dd66c3d01cb2d7f734158 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Thu, 24 Mar 2022 21:04:31 +0800 Subject: [PATCH 022/268] feat: adapte to vue-router4 v1 --- dev/children/react16/src/index.js | 22 +++++++------ dev/main-vite/src/App.vue | 3 +- dev/main-vite/src/pages/react16.vue | 1 + dev/main-vite/src/router/index.ts | 3 +- src/create_app.ts | 2 +- src/sandbox/router/core.ts | 48 +++++++++++++++++++++-------- src/sandbox/router/event.ts | 2 +- src/sandbox/router/history.ts | 20 +++++++++--- src/sandbox/router/index.ts | 9 ++++-- src/sandbox/router/location.ts | 23 ++++++++------ 10 files changed, 90 insertions(+), 43 deletions(-) diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index 47ed95e32..d9986fb72 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -268,14 +268,16 @@ setTimeout(() => { }, 0); -// setTimeout(() => { -// // window.location.href = 'http://localhost:3001/micro-app/react16/#abc' -// window.location.pathname = '/micro-app/react16/page2#fff' -// // window.location.assign('http://localhost:3001/micro-app/react16/page2#eee') -// // window.location.replace('http://localhost:3001/micro-app/react16/page2#eee') -// // console.log(111111, window.location) -// }, 5000); +setTimeout(() => { + // window.location.href = 'http://localhost:3001/micro-app/react16/#abc' + // window.location.pathname = '/micro-app/react16/page2#fff' + // window.location.assign('http://localhost:3001/micro-app/react16/page2#eee') + // window.location.replace('http://localhost:3001/micro-app/react16/page2#eee') + // console.log(111111, window.location) -window.onpopstate = (e) => { - console.log(888888888, e) -} + window.history.scrollRestoration = 'manual' +}, 5000); + +// window.onpopstate = (e) => { +// console.log(888888888, e) +// } diff --git a/dev/main-vite/src/App.vue b/dev/main-vite/src/App.vue index 48497977c..4667ec409 100644 --- a/dev/main-vite/src/App.vue +++ b/dev/main-vite/src/App.vue @@ -51,7 +51,8 @@ import {useRouter} from 'vue-router' const activeIndex = ref('/react16/') const {currentRoute} = useRouter() watch(currentRoute, (newVal, oldVal) => { - activeIndex.value = currentRoute.value.fullPath + // console.log(111111, currentRoute.value) + activeIndex.value = currentRoute.value.path }) diff --git a/dev/main-vite/src/pages/react16.vue b/dev/main-vite/src/pages/react16.vue index fe4107d9c..85ebfa5ad 100644 --- a/dev/main-vite/src/pages/react16.vue +++ b/dev/main-vite/src/pages/react16.vue @@ -22,6 +22,7 @@ @datachange='handleDataChange' inline baseRoute='/react16' + keep-route-state > diff --git a/dev/main-vite/src/router/index.ts b/dev/main-vite/src/router/index.ts index 65e925572..8bffea4f3 100644 --- a/dev/main-vite/src/router/index.ts +++ b/dev/main-vite/src/router/index.ts @@ -49,7 +49,8 @@ const routes = [ ]; const router = createRouter({ - history: createWebHistory(import.meta.env.BASE_URL), routes: routes + history: createWebHistory(import.meta.env.BASE_URL), + routes: routes, }) export default router; diff --git a/src/create_app.ts b/src/create_app.ts index 8d77bfc0f..594d2becb 100644 --- a/src/create_app.ts +++ b/src/create_app.ts @@ -305,7 +305,7 @@ export default class CreateApp implements AppInterface { } // this.container maybe contains micro-app element, stop sandbox should exec after cloneContainer - this.sandBox?.stop(this.keepRouteState) + this.sandBox?.stop(this.keepRouteState && !destroy) if (!getActiveApps().length) { releasePatchSetAttribute() } diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts index d5227762c..61a49e655 100644 --- a/src/sandbox/router/core.ts +++ b/src/sandbox/router/core.ts @@ -12,32 +12,52 @@ import { } from '../../libs/utils' // set micro app state to origin state -export function createMicroState ( +export function setMicroState ( appName: string, rawState: MicroState, microState: MicroState, + base: string, + searchHash: string ): MicroState { - // 生成新的state对象 - return assign({}, rawState, { - // 生成新的microAppState,因为它们在第二层 + const additionalState: Record = { microAppState: assign({}, rawState?.microAppState, { [appName]: microState }) - }) -} + } -// get micro app state form origin state -export function getMicroState (appName: string, state: MicroState): MicroState { - return state?.microAppState?.[appName] || null + /** + * vue-router4 will execute the replace method to replace the URL base on history.state.current before push + * add the latest search & hash to history.state.current to avoid this problem + */ + if (rawState?.current) { + additionalState.current = (new URL(rawState.current, base)).pathname + searchHash + } + + // create new state object + return assign({}, rawState, additionalState) } // delete micro app state form origin state -export function deleteMicroState (appName: string, rawState: MicroState): MicroState { +export function deleteMicroState (appName: string, rawState: MicroState, url: string): MicroState { if (rawState?.microAppState?.[appName]) { delete rawState.microAppState[appName] } + + let coverState + // + if (rawState?.current) { + coverState = { + current: removeMicroPathFromURL(appName, new URL(rawState.current, url) as MicroLocation) + } + } + // 生成新的state对象 - return assign({}, rawState) + return assign({}, rawState, coverState) +} + +// get micro app state form origin state +export function getMicroState (appName: string, state: MicroState): MicroState { + return state?.microAppState?.[appName] || null } const ENC_AD_RE = /&/g // %M1 @@ -78,6 +98,7 @@ export function getMicroPathFromURL (appName: string): string | null { type setMicroPathResult = { fullPath: string, + searchHash: string, attach2Hash: boolean, } @@ -117,13 +138,14 @@ export function setMicroPathToURL (appName: string, microLocation: MicroLocation return { fullPath: pathname + search + hash, + searchHash: search + hash, attach2Hash, } } // 将name=encodeUrl的参数从浏览器url上删除 -export function removeMicroPathFromURL (appName: string): string { - let { pathname, search, hash } = globalEnv.rawWindow.location +export function removeMicroPathFromURL (appName: string, targetLocation?: MicroLocation): string { + let { pathname, search, hash } = targetLocation || globalEnv.rawWindow.location const queryObject = getQueryObjectFromURL(search, hash) if (queryObject.hashQuery?.[formatQueryAppName(appName)]) { diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index 4913c8032..49e88219f 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -20,13 +20,13 @@ export function addHistoryListener (rawWindow: Window, appName: string): Callabl const popStateHandler: PopStateListener = (e: PopStateEvent): void => { const activeApps = getActiveApps(true) if (activeApps.includes(appName)) { - // 先更新location,再发送popstate事件 const microPath = getMicroPathFromURL(appName) const app = appInstanceMap.get(appName)! const proxyWindow = app.sandBox!.proxyWindow let isHashChange = false // for hashChangeEvent const oldHref = proxyWindow.location.href + // Do not attach micro info to url when microPath is empty if (microPath) { const oldHash = proxyWindow.location.hash updateLocation(microPath, app.url, proxyWindow.location as MicroLocation) diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 07d0127f8..2f3e89ce5 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -7,7 +7,7 @@ import type { import globalEnv from '../../libs/global_env' import { isString, logError } from '../../libs/utils' import { updateLocation } from './location' -import { setMicroPathToURL, createMicroState, getMicroState } from './core' +import { setMicroPathToURL, setMicroState, getMicroState } from './core' // history of micro app export function createMicroHistory ( @@ -29,10 +29,11 @@ export function createMicroHistory ( const targetLocation = new URL('' + rests[2], base) as MicroLocation if (targetLocation.origin === microLocation.origin) { targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash + const setMicroPathResult = setMicroPathToURL(appName, targetLocation) rests = [ - createMicroState(appName, rawHistory.state, rests[0]), + setMicroState(appName, rawHistory.state, rests[0], base, setMicroPathResult.searchHash), rests[1], - setMicroPathToURL(appName, targetLocation).fullPath, + setMicroPathResult.fullPath, ] } } catch (e) { @@ -57,10 +58,21 @@ export function createMicroHistory ( } return Reflect.get(target, key) }, + set (target: History, key: PropertyKey, value: unknown): boolean { + return Reflect.set(target, key, value) + } }) } -// update browser url +// update browser url when child app mount/unmount export function updateBrowserURL (state: MicroState, fullPath: string): void { globalEnv.rawWindow.history.replaceState(state, null, fullPath) } + +/** + * dispatch pure PopStateEvent + * simulate location behavior + */ +export function dispatchPurePopStateEvent (): void { + globalEnv.rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) +} diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index a06f24f9c..7e4dc6110 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -8,6 +8,7 @@ import { setMicroPathToURL, removeMicroPathFromURL, deleteMicroState, + setMicroState, } from './core' import { createMicroLocation, @@ -30,7 +31,11 @@ export function initRouteStateWithURL ( if (microPath) { updateLocation(microPath, url, microLocation) } else { - updateBrowserURL(globalEnv.rawWindow.history.state, setMicroPathToURL(appName, microLocation).fullPath) + const setMicroPathResult = setMicroPathToURL(appName, microLocation) + updateBrowserURL( + setMicroState(appName, globalEnv.rawWindow.history.state, null, url, setMicroPathResult.searchHash), + setMicroPathResult.fullPath, + ) } } @@ -45,7 +50,7 @@ export function clearRouteStateFromURL ( updateLocation(pathname + search + hash, url, microLocation) // 删除浏览器url上的子应用参数 updateBrowserURL( - deleteMicroState(appName, globalEnv.rawWindow.history.state), + deleteMicroState(appName, globalEnv.rawWindow.history.state, url), removeMicroPathFromURL(appName), ) } diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index b772ec423..297b26ebb 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -3,6 +3,7 @@ import type { MicroLocation } from '@micro-app/types' import globalEnv from '../../libs/global_env' import { assign as oAssign, rawDefineProperties } from '../../libs/utils' import { setMicroPathToURL } from './core' +import { dispatchPurePopStateEvent } from './history' /** * create location for micro app @@ -38,7 +39,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio * so we use pushState & reload to imitate href behavior * NOTE: * 1. if child app only change hash, it should not trigger browser reload - * 2. if address is the same and has hash, it should not add route stack + * 2. if address is same and has hash, it should not add route stack */ if ( targetLocation.pathname === shadowLocation.pathname && @@ -49,7 +50,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio } if (targetLocation.hash) { - rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + dispatchPurePopStateEvent() } else { rawLocation.reload() } @@ -66,14 +67,16 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio return value } - const assignOrReplace = (value: string | URL, locationMethodName: string) => { - const formattedValue = commonHandle(value, locationMethodName === 'assign' ? 'pushState' : 'replaceState') - if (formattedValue) rawLocation[locationMethodName](formattedValue) + const createAssignOrReplace = (locationMethodName: string) => { + return (value: string | URL) => { + const formattedValue = commonHandle(value, locationMethodName === 'assign' ? 'pushState' : 'replaceState') + if (formattedValue) rawLocation[locationMethodName](formattedValue) + } } - const assign = (value: string | URL): void => assignOrReplace(value, 'assign') + const assign = createAssignOrReplace('assign') - const replace = (value: string | URL): void => assignOrReplace(value, 'replace') + const replace = createAssignOrReplace('replace') const reload = (forcedReload?: boolean): void => rawLocation.reload(forcedReload) @@ -107,7 +110,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio const targetLocation = new URL(targetPath, url) as MicroLocation // When the browser url has a hash value, the same pathname will not trigger the browser refresh if (targetLocation.pathname === shadowLocation.pathname && shadowLocation.hash) { - rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + dispatchPurePopStateEvent() } else { // When the value is the same, no new route stack will be added // Special scenes such as: /path ==> /path#hash, /path ==> /path?query @@ -126,7 +129,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio const targetLocation = new URL(targetPath, url) as MicroLocation // When the browser url has a hash value, the same search will not trigger the browser refresh if (targetLocation.search === shadowLocation.search && shadowLocation.hash) { - rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + dispatchPurePopStateEvent() } else { // When the value is the same, no new route stack will be added // Special scenes such as: ?query ==> ?query#hash @@ -146,7 +149,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio // The same hash will not trigger popStateEvent if (targetLocation.hash !== shadowLocation.hash) { rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) - rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) + dispatchPurePopStateEvent() } } }, From 7751020bda05c3a86716077571e33b0814acb1aa Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Tue, 7 Jun 2022 11:27:42 +0800 Subject: [PATCH 023/268] docs: update docs --- docs/zh-cn/questions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh-cn/questions.md b/docs/zh-cn/questions.md index f5edf476c..c1e6ef244 100644 --- a/docs/zh-cn/questions.md +++ b/docs/zh-cn/questions.md @@ -1,7 +1,7 @@ ## 1、我需要用到微前端吗? 在此之前建议你先阅读[Why Not Iframe](https://www.yuque.com/kuitos/gky7yw/gesexv)。 -相比于iframe,微前端拥有更好的性能和用户体验,同时它也要求开发者对于前端框架和路由原理具有一定的理解。 +相比于iframe,微前端拥有更好的用户体验,同时它也要求开发者对于前端框架和路由原理具有一定的理解。 微前端的本质是将两个不相关的页面强行合并为一,这其中不可避免会出现各种冲突,虽然微前端框架解决了几乎所有的冲突,但偶尔也会有特殊情况出现,这需要开发者具有处理特殊情况的能力和心态。 From 90b4e35c391ef9f7a3fa7fd633d2f18d78b05124 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Tue, 7 Jun 2022 19:45:57 +0800 Subject: [PATCH 024/268] feat: add route adaptation to keep-alive app --- dev/children/react17/src/index.js | 1 + dev/children/react17/src/public-path.js | 4 ++ dev/main-react16/src/pages/react16/react16.js | 2 +- dev/main-react16/src/pages/vue3/vue3.js | 1 + docs/zh-cn/questions.md | 24 ++++++---- src/create_app.ts | 6 +++ src/sandbox/index.ts | 22 ++++++++- src/sandbox/router/core.ts | 16 +++++-- src/sandbox/router/history.ts | 2 - src/sandbox/router/index.ts | 48 ++++++++++++++----- src/source/patch.ts | 33 ++++++------- typings/global.d.ts | 2 + 12 files changed, 115 insertions(+), 46 deletions(-) create mode 100644 dev/children/react17/src/public-path.js diff --git a/dev/children/react17/src/index.js b/dev/children/react17/src/index.js index e7fc6a2e1..e199308ce 100644 --- a/dev/children/react17/src/index.js +++ b/dev/children/react17/src/index.js @@ -1,3 +1,4 @@ +import './public-path'; import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; diff --git a/dev/children/react17/src/public-path.js b/dev/children/react17/src/public-path.js new file mode 100644 index 000000000..8aa569609 --- /dev/null +++ b/dev/children/react17/src/public-path.js @@ -0,0 +1,4 @@ +if (window.__MICRO_APP_ENVIRONMENT__) { + // eslint-disable-next-line + __webpack_public_path__ = window.__MICRO_APP_PUBLIC_PATH__ +} diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index b54d89529..d4a456ed3 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -192,7 +192,7 @@ export default class App extends React.Component { // destroy keep-route-state // disable-memory-router - inline + // inline // disableSandbox // disable-sandbox // disableScopecss diff --git a/dev/main-react16/src/pages/vue3/vue3.js b/dev/main-react16/src/pages/vue3/vue3.js index 6765b3d3a..eb80c32d6 100644 --- a/dev/main-react16/src/pages/vue3/vue3.js +++ b/dev/main-react16/src/pages/vue3/vue3.js @@ -30,6 +30,7 @@ function Vue3 () { // destroy // disableSandbox // shadowDOM + keep-route-state > diff --git a/docs/zh-cn/questions.md b/docs/zh-cn/questions.md index c1e6ef244..6f8f656c1 100644 --- a/docs/zh-cn/questions.md +++ b/docs/zh-cn/questions.md @@ -170,26 +170,33 @@ microApp.start({ 实际情况可能更加复杂,上面只是一种解决思路。 -## 14、子应用请求接口报错 - - 1、请确保接口请求没有跨域问题,因为子应用被加载到基座渲染,所以请求接口时origin为基座应用的域名。 +## 14、子应用请求接口失败 + - 1、请确保接口请求没有跨域问题,因为子应用被加载到基座渲染,所以请求接口是从基座发送。 - 2、请求的接口为相对地址,会以基座域名进行补全,导致报错。 - 如:`fetch('/api/data')`,在请求时会自动被浏览器补全为`fetch('基座域名/api/data')` + 如:`fetch('/api/data')`,在请求时会自动被浏览器补全为`fetch(基座域名 + '/api/data')` - 为了避免这个问题,子应用需要使用完整的地址:`fetch('子应用域名/api/data')` + 为了避免这个问题,子应用需要使用完整的地址:`fetch(子应用域名 + '/api/data')` -## 15、子应用多次渲染后内存越来越大 +## 15、子应用反向代理失败 + **解决方式:**子应用使用完整的地址发送请求 + + 如:`fetch('/api/data')` 改为 `fetch(子应用域名 + '/api/data')` + + 如果还是报跨域问题,则是服务端做了限制,此时需要撤除上述操作,并将子应用的代理放到基座应用中。 + +## 16、子应用多次渲染后内存越来越大 参考[内存优化](/zh-cn/advanced?id=_3、内存优化)一章 -## 16、子应用之间如何跳转 +## 17、子应用之间如何跳转 参考[应用之间如何跳转](/zh-cn/route?id=应用之间如何跳转)一章 -## 17、jsonp请求如何处理? +## 18、jsonp请求如何处理? 参考[ignore](/zh-cn/configure?id=ignore忽略元素) -## 18、子应用通过a标签下载文件失败 +## 19、子应用通过a标签下载文件失败 **原因:**当跨域时(基座和文件在不同域名下),无法通过a标签的download属性实现下载。 **解决方式:** @@ -221,3 +228,4 @@ microApp.start({ ``` **方式2:**将文件放到基座域名下,判断微前端环境下a标签href属性设置为基座的文件地址 + diff --git a/src/create_app.ts b/src/create_app.ts index 594d2becb..7fc9211c4 100644 --- a/src/create_app.ts +++ b/src/create_app.ts @@ -357,6 +357,9 @@ export default class CreateApp implements AppInterface { this.name, lifeCycles.AFTERHIDDEN, ) + + // called after lifeCyclesEvent + this.sandBox?.removeRouteInfoForKeepAliveApp() } // show app when connectedCallback called with keep-alive @@ -383,6 +386,9 @@ export default class CreateApp implements AppInterface { this.keepAliveState = keepAliveStates.KEEP_ALIVE_SHOW + // called before lifeCyclesEvent + this.sandBox?.setRouteInfoForKeepAliveApp() + // dispatch afterShow event to micro-app dispatchCustomEventToMicroApp('appstate-change', this.name, { appState: 'aftershow', diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 218c7c097..1d8997fef 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -41,6 +41,8 @@ import createMicroRouter, { initRouteStateWithURL, clearRouteStateFromURL, addHistoryListener, + removeStateAndPathFromBrowser, + updateBrowserURLWithLocation, } from './router' export type MicroAppWindowDataType = { @@ -147,7 +149,7 @@ export default class SandBox implements SandBoxInterface { this.escapeKeys.clear() if (this.removeHistoryListener) { - if (!keepRouteState) this.clearRouteState() + this.clearRouteState(keepRouteState) // release listener of popstate this.removeHistoryListener() } @@ -454,11 +456,27 @@ export default class SandBox implements SandBoxInterface { ) } - private clearRouteState (): void { + private clearRouteState (keepRouteState: boolean): void { clearRouteStateFromURL( this.proxyWindow.__MICRO_APP_NAME__, this.proxyWindow.__MICRO_APP_URL__, this.proxyWindow.location as MicroLocation, + keepRouteState, + ) + } + + setRouteInfoForKeepAliveApp (): void { + updateBrowserURLWithLocation( + this.proxyWindow.__MICRO_APP_NAME__, + this.proxyWindow.__MICRO_APP_URL__, + this.proxyWindow.location as MicroLocation, + ) + } + + removeRouteInfoForKeepAliveApp (): void { + removeStateAndPathFromBrowser( + this.proxyWindow.__MICRO_APP_NAME__, + this.proxyWindow.__MICRO_APP_URL__, ) } } diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts index 61a49e655..b3492a9b4 100644 --- a/src/sandbox/router/core.ts +++ b/src/sandbox/router/core.ts @@ -9,6 +9,8 @@ import { parseQuery, stringifyQuery, isString, + isUndefined, + isPlainObject, } from '../../libs/utils' // set micro app state to origin state @@ -38,13 +40,17 @@ export function setMicroState ( } // delete micro app state form origin state -export function deleteMicroState (appName: string, rawState: MicroState, url: string): MicroState { - if (rawState?.microAppState?.[appName]) { - delete rawState.microAppState[appName] +export function removeMicroState (appName: string, rawState: MicroState, url: string): MicroState { + if (isPlainObject(rawState?.microAppState)) { + if (!isUndefined(rawState.microAppState[appName])) { + delete rawState.microAppState[appName] + } + if (!Object.keys(rawState.microAppState).length) { + delete rawState.microAppState + } } - let coverState - // + let coverState = null if (rawState?.current) { coverState = { current: removeMicroPathFromURL(appName, new URL(rawState.current, url) as MicroLocation) diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 2f3e89ce5..d21188b9e 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -17,8 +17,6 @@ export function createMicroHistory ( ): MicroHistory { const rawHistory = globalEnv.rawWindow.history - // 是否需要在每次调用时都创建一个函数?这样看起来麻烦,但是是函数式编程,看起来更优雅 - // 如果使用一个对象将history的方法都实现一遍,确实是不需要每次都创建函数的,但是这样太不优雅了 function getMicroHistoryMethod (methodName: PropertyKey): CallableFunction { return (...rests: any[]) => { // console.log(444444444, rests[0], rests[1], rests[2], methodName) diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index 7e4dc6110..1f011b8b1 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -7,7 +7,7 @@ import { getMicroPathFromURL, setMicroPathToURL, removeMicroPathFromURL, - deleteMicroState, + removeMicroState, setMicroState, } from './core' import { @@ -21,7 +21,7 @@ import { export { addHistoryListener } from './event' -// 当沙箱执行start, 或者隐藏的keep-alive应用重新渲染时时才:根据浏览器url更新location 或者 将参数更新到url上 +// 当沙箱执行start, 或者隐藏的keep-alive应用重新渲染时时才根据浏览器url更新location 或者 将参数更新到url上 export function initRouteStateWithURL ( appName: string, url: string, @@ -31,26 +31,50 @@ export function initRouteStateWithURL ( if (microPath) { updateLocation(microPath, url, microLocation) } else { - const setMicroPathResult = setMicroPathToURL(appName, microLocation) - updateBrowserURL( - setMicroState(appName, globalEnv.rawWindow.history.state, null, url, setMicroPathResult.searchHash), - setMicroPathResult.fullPath, - ) + updateBrowserURLWithLocation(appName, url, microLocation) } } +/** + * initialize browser information according to microLocation + * called on sandbox.start or reshow of keep-alive app + */ +export function updateBrowserURLWithLocation ( + appName: string, + url: string, + microLocation: MicroLocation, +): void { + const setMicroPathResult = setMicroPathToURL(appName, microLocation) + updateBrowserURL( + setMicroState(appName, globalEnv.rawWindow.history.state, null, url, setMicroPathResult.searchHash), + setMicroPathResult.fullPath, + ) +} + // 清空路由信息,主要有2点:1、本地location更新为初始化 2、删除history.state 和 浏览器url上的参数信息 +/** + * In any case, microPath & microState will be removed from browser, but location will be initialized only when keep-route-state is false + */ export function clearRouteStateFromURL ( appName: string, url: string, microLocation: MicroLocation, + keepRouteState: boolean, ): void { - // 初始化location信息 - const { pathname, search, hash } = new URL(url) - updateLocation(pathname + search + hash, url, microLocation) - // 删除浏览器url上的子应用参数 + if (!keepRouteState) { + const { pathname, search, hash } = new URL(url) + updateLocation(pathname + search + hash, url, microLocation) + } + removeStateAndPathFromBrowser(appName, url) +} + +/** + * remove microState from history.state and remove microPath from browserURL + * called on sandbox.stop or hidden of keep-alive app + */ +export function removeStateAndPathFromBrowser (appName: string, url: string): void { updateBrowserURL( - deleteMicroState(appName, globalEnv.rawWindow.history.state, url), + removeMicroState(appName, globalEnv.rawWindow.history.state, url), removeMicroPathFromURL(appName), ) } diff --git a/src/source/patch.ts b/src/source/patch.ts index f794b5ec5..ee68240ae 100644 --- a/src/source/patch.ts +++ b/src/source/patch.ts @@ -108,31 +108,42 @@ function invokePrototypeMethod ( targetChild: Node, passiveChild?: Node | null, ): any { - const container = getContainer(parent, app) + const hijackElement = getHijackElement(parent, app) /** * If passiveChild is not the child node, insertBefore replaceChild will have a problem, at this time, it will be degraded to appendChild * E.g: document.head.insertBefore(targetChild, document.head.childNodes[0]) */ - if (container) { + if (hijackElement) { /** * 1. If passiveChild exists, it must be insertBefore or replaceChild * 2. When removeChild, targetChild may not be in microAppHead or head */ - if (passiveChild && !container.contains(passiveChild)) { - return globalEnv.rawAppendChild.call(container, targetChild) - } else if (rawMethod === globalEnv.rawRemoveChild && !container.contains(targetChild)) { + if (passiveChild && !hijackElement.contains(passiveChild)) { + return globalEnv.rawAppendChild.call(hijackElement, targetChild) + } else if (rawMethod === globalEnv.rawRemoveChild && !hijackElement.contains(targetChild)) { if (parent.contains(targetChild)) { return rawMethod.call(parent, targetChild) } return targetChild } - return invokeRawMethod(rawMethod, container, targetChild, passiveChild) + return invokeRawMethod(rawMethod, hijackElement, targetChild, passiveChild) } return invokeRawMethod(rawMethod, parent, targetChild, passiveChild) } +// head/body map to micro-app-head/micro-app-body +function getHijackElement (node: Node, app: AppInterface) { + if (node === document.head) { + return app?.container?.querySelector('micro-app-head') + } + if (node === document.body) { + return app?.container?.querySelector('micro-app-body') + } + return null +} + function invokeRawMethod ( rawMethod: Func, parent: Node, @@ -150,16 +161,6 @@ function isPendMethod (method: CallableFunction) { return method === globalEnv.rawAppend || method === globalEnv.rawPrepend } -function getContainer (node: Node, app: AppInterface) { - if (node === document.head) { - return app?.container?.querySelector('micro-app-head') - } - if (node === document.body) { - return app?.container?.querySelector('micro-app-body') - } - return null -} - // Get the map element function getMappingNode (node: Node): Node { return dynamicElementInMicroAppMap.get(node) ?? node diff --git a/typings/global.d.ts b/typings/global.d.ts index 3a713ccca..2c121a971 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -14,6 +14,8 @@ declare module '@micro-app/types' { recordUmdSnapshot (): void // rebuild umd snapshot before remount umd app rebuildUmdSnapshot (): void + setRouteInfoForKeepAliveApp (): void + removeRouteInfoForKeepAliveApp (): void } type sourceLinkInfo = { From 12687fbf2caa0aa79d92d9d53ddd0cba89803b09 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 8 Jun 2022 21:23:55 +0800 Subject: [PATCH 025/268] feat: init router api --- src/sandbox/index.ts | 8 ++++---- src/sandbox/router/api.ts | 29 +++++++++++++++++++++++++++ src/sandbox/router/core.ts | 4 ++-- src/sandbox/router/event.ts | 9 +++++++++ src/sandbox/router/history.ts | 9 --------- src/sandbox/router/index.ts | 36 ++++++++++++++++++++++------------ src/sandbox/router/location.ts | 7 ++++--- typings/global.d.ts | 20 +++++++++++++++++++ 8 files changed, 91 insertions(+), 31 deletions(-) create mode 100644 src/sandbox/router/api.ts diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 1d8997fef..b21dac76e 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -95,8 +95,8 @@ export default class SandBox implements SandBoxInterface { private recordUmdInjectedValues?: Map // sandbox state private active = false - proxyWindow: WindowProxy & MicroAppWindowDataType // Proxy - microAppWindow = {} as MicroAppWindowType // Proxy target + public proxyWindow: WindowProxy & MicroAppWindowDataType // Proxy + public microAppWindow = {} as MicroAppWindowType // Proxy target constructor (appName: string, url: string, useMemoryRouter = true) { // get scopeProperties and escapeProperties from plugins @@ -465,7 +465,7 @@ export default class SandBox implements SandBoxInterface { ) } - setRouteInfoForKeepAliveApp (): void { + public setRouteInfoForKeepAliveApp (): void { updateBrowserURLWithLocation( this.proxyWindow.__MICRO_APP_NAME__, this.proxyWindow.__MICRO_APP_URL__, @@ -473,7 +473,7 @@ export default class SandBox implements SandBoxInterface { ) } - removeRouteInfoForKeepAliveApp (): void { + public removeRouteInfoForKeepAliveApp (): void { removeStateAndPathFromBrowser( this.proxyWindow.__MICRO_APP_NAME__, this.proxyWindow.__MICRO_APP_URL__, diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts new file mode 100644 index 000000000..3ff8af52e --- /dev/null +++ b/src/sandbox/router/api.ts @@ -0,0 +1,29 @@ +import type { Router } from '@micro-app/types' +import { + encodeMicroPath, + decodeMicroPath, +} from './core' + +// function push (to: { +// name: string, +// path: string, +// state?: unknown, +// replace?: boolean +// }) { + +// } + +// Router API for developer +export const router: Router = { + currentRoute: {}, + encode: encodeMicroPath, + decode: decodeMicroPath, + // push, + // replace: + // go: + // back: + // forward: + // beforeEach: + // afterEach: + // onError: +} diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts index b3492a9b4..348ed6641 100644 --- a/src/sandbox/router/core.ts +++ b/src/sandbox/router/core.ts @@ -71,11 +71,11 @@ const ENC_EQ_RE = /=/g // %M2 const DEC_AD_RE = /%M1/g // & const DEC_EQ_RE = /%M2/g // = -function encodeMicroPath (path: string): string { +export function encodeMicroPath (path: string): string { return encodeURIComponent(commonDecode(path).replace(ENC_AD_RE, '%M1').replace(ENC_EQ_RE, '%M2')) } -function decodeMicroPath (path: string): string { +export function decodeMicroPath (path: string): string { return commonDecode(path).replace(DEC_AD_RE, '&').replace(DEC_EQ_RE, '=') } diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index 49e88219f..db3c086ae 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -4,6 +4,7 @@ import { getActiveApps } from '../../micro_app' import { formatEventName } from '../effect' import { getMicroPathFromURL, getMicroState } from './core' import { updateLocation } from './location' +import globalEnv from '../../libs/global_env' type PopStateListener = (this: Window, e: PopStateEvent) => void @@ -68,3 +69,11 @@ export function addHistoryListener (rawWindow: Window, appName: string): Callabl rawWindow.removeEventListener('popstate', popStateHandler) } } + +/** + * dispatch pure PopStateEvent + * simulate location behavior + */ +export function dispatchPurePopStateEvent (): void { + globalEnv.rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) +} diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index d21188b9e..85ee0005d 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -16,7 +16,6 @@ export function createMicroHistory ( microLocation: MicroLocation, ): MicroHistory { const rawHistory = globalEnv.rawWindow.history - function getMicroHistoryMethod (methodName: PropertyKey): CallableFunction { return (...rests: any[]) => { // console.log(444444444, rests[0], rests[1], rests[2], methodName) @@ -66,11 +65,3 @@ export function createMicroHistory ( export function updateBrowserURL (state: MicroState, fullPath: string): void { globalEnv.rawWindow.history.replaceState(state, null, fullPath) } - -/** - * dispatch pure PopStateEvent - * simulate location behavior - */ -export function dispatchPurePopStateEvent (): void { - globalEnv.rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) -} diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index 1f011b8b1..0a699a3a6 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -18,8 +18,26 @@ import { createMicroHistory, updateBrowserURL, } from './history' - export { addHistoryListener } from './event' +export { router } from './api' + +// 所谓路由系统,无非两种操作:读、写 +// 读是通过location,写是通过replace/pushState +/** + * The router system has two operations: read and write + * Read through location and write through replaceState/pushState/location + * @param appName app name + * @param url app url + * @returns MicroRouter + */ +export default function createMicroRouter (appName: string, url: string): MicroRouter { + const microLocation = createMicroLocation(appName, url) + + return { + microLocation, + microHistory: createMicroHistory(appName, url, microLocation), + } +} // 当沙箱执行start, 或者隐藏的keep-alive应用重新渲染时时才根据浏览器url更新location 或者 将参数更新到url上 export function initRouteStateWithURL ( @@ -51,9 +69,12 @@ export function updateBrowserURLWithLocation ( ) } -// 清空路由信息,主要有2点:1、本地location更新为初始化 2、删除history.state 和 浏览器url上的参数信息 /** * In any case, microPath & microState will be removed from browser, but location will be initialized only when keep-route-state is false + * @param appName app name + * @param url app url + * @param microLocation location of microApp + * @param keepRouteState keep-route-state is only used to control whether to clear the location of microApp */ export function clearRouteStateFromURL ( appName: string, @@ -78,14 +99,3 @@ export function removeStateAndPathFromBrowser (appName: string, url: string): vo removeMicroPathFromURL(appName), ) } - -// 所谓路由系统,无非两种操作:读、写 -// 读是通过location,写是通过replace/pushState -export default function createMicroRouter (appName: string, url: string): MicroRouter { - const microLocation = createMicroLocation(appName, url) - - return { - microLocation, - microHistory: createMicroHistory(appName, url, microLocation), - } -} diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index 297b26ebb..45281a1e2 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -3,10 +3,11 @@ import type { MicroLocation } from '@micro-app/types' import globalEnv from '../../libs/global_env' import { assign as oAssign, rawDefineProperties } from '../../libs/utils' import { setMicroPathToURL } from './core' -import { dispatchPurePopStateEvent } from './history' +import { dispatchPurePopStateEvent } from './event' /** - * create location for micro app + * Create location for micro app + * Each microApp has only one location object, it is a reference type * @param appName app name * @param url app url */ @@ -15,7 +16,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio const rawLocation = rawWindow.location // microLocation is the location of child app, it is globally unique const microLocation = new URL(url) as MicroLocation - // shadowLocation is the host of some special keys (href, pathname, search, hash) + // shadowLocation is the current location information (href, pathname, search, hash) const shadowLocation = { href: microLocation.href, pathname: microLocation.pathname, diff --git a/typings/global.d.ts b/typings/global.d.ts index 2c121a971..158eca2c1 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -204,6 +204,7 @@ declare module '@micro-app/types' { type CallableFunctionForInteract = CallableFunction & { __APP_NAME__?: string, __AUTO_TRIGGER__?: boolean } interface MicroLocation extends Location, URL { + // shadowLocation is the current location information (href, pathname, search, hash) shadowLocation: URL } type MicroHistory = ProxyHandler @@ -234,6 +235,25 @@ declare module '@micro-app/types' { hashQuery?: LocationQueryObject, searchQuery?: LocationQueryObject } + + interface CurrentRoute { + [appName: string]: MicroLocation, + } + + // Router API for developer + interface Router { + readonly currentRoute?: CurrentRoute + /** + * encodeURI of microApp path + * @param path url path + */ + encode(path: string): string + /** + * decodeURI of microApp path + * @param path url path + */ + decode(path: string): ReturnType + } } declare namespace JSX { From ca6650c437fabd3438ccf1fc708d994f805e2918 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Fri, 10 Jun 2022 20:02:36 +0800 Subject: [PATCH 026/268] feat: add push/replace method for router api --- .../angular11/src/app/app.component.ts | 14 +++- dev/main-react16/config/config.js | 2 +- dev/main-react16/src/global.less | 14 ++-- .../src/pages/angular11/angular11.js | 8 ++- .../src/pages/multiple/multiple.js | 46 +++++++++--- dev/main-react16/src/pages/react16/react16.js | 19 ++++- .../src/pages/react16/react16.less | 9 --- dev/main-react16/src/pages/vite/vite.js | 24 ++++--- dev/main-react16/src/pages/vue2/vue2.js | 34 ++++++--- dev/main-react16/src/pages/vue3/vue3.js | 15 +++- src/libs/utils.ts | 10 ++- src/micro_app.ts | 12 +++- src/sandbox/index.ts | 4 +- src/sandbox/router/api.ts | 53 +++++++++++--- src/sandbox/router/core.ts | 7 +- src/sandbox/router/event.ts | 71 +++++++++++-------- src/sandbox/router/history.ts | 4 +- src/sandbox/router/index.ts | 3 +- src/sandbox/router/location.ts | 32 ++++----- typings/global.d.ts | 23 ++++++ 20 files changed, 294 insertions(+), 110 deletions(-) diff --git a/dev/children/angular11/src/app/app.component.ts b/dev/children/angular11/src/app/app.component.ts index c12968a34..f37cf2edb 100644 --- a/dev/children/angular11/src/app/app.component.ts +++ b/dev/children/angular11/src/app/app.component.ts @@ -1,4 +1,5 @@ -import { Component } from '@angular/core'; +import { Component, NgZone } from '@angular/core'; +import { Router } from '@angular/router'; @Component({ selector: 'app-root', @@ -6,5 +7,16 @@ import { Component } from '@angular/core'; styleUrls: ['./app.component.less'] }) export class AppComponent { + constructor(private router: Router, private ngZone: NgZone) { + // 解决点击浏览器前进、返回按钮,上一个页面不卸载的问题 + if (window.__MICRO_APP_ENVIRONMENT__) { + window.addEventListener('popstate', () => { + const path = location.pathname.replace('/micro-app/angular11', '') + location.search + location.hash + this.ngZone.run(() => { + this.router.navigateByUrl(path) + }) + }) + } + } title = 'child-angular11'; } diff --git a/dev/main-react16/config/config.js b/dev/main-react16/config/config.js index 3d45ec1d0..512d77c6a 100644 --- a/dev/main-react16/config/config.js +++ b/dev/main-react16/config/config.js @@ -14,7 +14,7 @@ export default defineConfig({ hmr: true, }, history: { - type: 'hash', // browser + type: 'browser', // browser hash }, locale: { // default zh-CN diff --git a/dev/main-react16/src/global.less b/dev/main-react16/src/global.less index 23ed2eee3..4ea647a86 100644 --- a/dev/main-react16/src/global.less +++ b/dev/main-react16/src/global.less @@ -53,10 +53,16 @@ ol { } } -.btn-con { - margin-bottom: 10px; -} - micro-app, micro-app-body{ width: 100%; } + +.btn-con { + display: flex; + flex-direction: column; + margin-bottom: 5px; + + button { + margin: 2px; + } +} diff --git a/dev/main-react16/src/pages/angular11/angular11.js b/dev/main-react16/src/pages/angular11/angular11.js index 47be30308..50e0b716b 100644 --- a/dev/main-react16/src/pages/angular11/angular11.js +++ b/dev/main-react16/src/pages/angular11/angular11.js @@ -3,9 +3,10 @@ import jsxCustomEvent from '@micro-zoe/micro-app/polyfill/jsx-custom-event' import 'zone.js' import { useState } from 'react' -import { Spin } from 'antd' +import { Spin, Button } from 'antd' import { LoadingOutlined } from '@ant-design/icons' import config from '../../config' +import microApp from '@micro-zoe/micro-app' const antIcon = @@ -13,8 +14,13 @@ function Angular11 () { const [showLoading, hideLoading] = useState(true) const [data, changeData] = useState({frotm: '来自基座的初始化数据'}) + function jumpToPage2ByBase () { + microApp.router.push({name: 'angular11', path: '/micro-app/angular11/page2'}) + } + return (
+ { showLoading && } diff --git a/dev/main-react16/src/pages/multiple/multiple.js b/dev/main-react16/src/pages/multiple/multiple.js index 128719957..f9bc9a261 100644 --- a/dev/main-react16/src/pages/multiple/multiple.js +++ b/dev/main-react16/src/pages/multiple/multiple.js @@ -2,24 +2,51 @@ /** @jsx jsxCustomEvent */ import jsxCustomEvent from '@micro-zoe/micro-app/polyfill/jsx-custom-event' import { useState, useEffect } from 'react' -import { Button, Spin } from 'antd' +import { Button, Spin, Col } from 'antd' import { LoadingOutlined } from '@ant-design/icons' import config from '../../config' import './multiple.less' +import microApp from '@micro-zoe/micro-app' const antIcon = function Vue3 () { const [data, changeData] = useState({from: '来自基座的初始化数据'}) - const [reactname, changename] = useState('react162') + const [reactChildName, changename] = useState('react162') const [showLoading, hideLoading] = useState(true) useEffect(() => { console.time('react16') }, []) + + function jumpToReactHome () { + microApp.router.push({name: reactChildName, path: '/micro-app/react16/'}) + } + + function jumpToReactPage2 () { + microApp.router.push({name: reactChildName, path: '/micro-app/react16/page2'}) + } + + function jumpToReactInline () { + microApp.router.push({name: reactChildName, path: '/micro-app/react16/inline'}) + } + + function jumpToVueHome () { + microApp.router.push({name: 'vue22', path: '/micro-app/vue2/#/'}) + } + + function jumpToVuePage2 () { + microApp.router.push({name: 'vue22', path: '/micro-app/vue2/#/page2'}) + } + + function jumpToVueTable () { + microApp.router.push({name: 'vue22', path: '/micro-app/vue2/#/table'}) + } + return (
+ - + + + + + + + +
{ showLoading && @@ -39,7 +69,7 @@ function Vue3 () {
{ + microApp.router.push({name: this.state.name, path: '/micro-app/react16/'}) + } + + jumpToPage2 = () => { + microApp.router.push({name: this.state.name, path: '/micro-app/react16/page2'}) + } + + jumpToInline = () => { + microApp.router.push({name: this.state.name, path: '/micro-app/react16/inline'}) + } + handleGlobalDataForBaseApp = (data) => { console.log(`这是全局数据--基座应用-${this.state.name}`, data) } @@ -167,6 +179,9 @@ export default class App extends React.Component { + + + @@ -188,9 +203,9 @@ export default class App extends React.Component { onAfterhidden={this.handleAfterhidden} onDataChange={this.handleDataChange} baseRoute='/micro-app/demo/react16' - // keep-alive + keep-alive // destroy - keep-route-state + // keep-route-state // disable-memory-router // inline // disableSandbox diff --git a/dev/main-react16/src/pages/react16/react16.less b/dev/main-react16/src/pages/react16/react16.less index 4ab93d454..cce9171f6 100644 --- a/dev/main-react16/src/pages/react16/react16.less +++ b/dev/main-react16/src/pages/react16/react16.less @@ -1,13 +1,4 @@ -.btn-con { - display: flex; - flex-direction: column; - - button { - margin: 5px; - } -} - .app-con-react16 { display: flex; flex-direction: column; diff --git a/dev/main-react16/src/pages/vite/vite.js b/dev/main-react16/src/pages/vite/vite.js index ec9c8cffe..1da0a54b1 100644 --- a/dev/main-react16/src/pages/vite/vite.js +++ b/dev/main-react16/src/pages/vite/vite.js @@ -2,11 +2,12 @@ /** @jsx jsxCustomEvent */ import jsxCustomEvent from '@micro-zoe/micro-app/polyfill/jsx-custom-event' import { useState } from 'react' -import { Button, Spin } from 'antd' +import { Button, Spin, Col } from 'antd' import { LoadingOutlined } from '@ant-design/icons' import { EventCenterForMicroApp } from '@micro-zoe/micro-app' import config from '../../config' import './vite.less' +import microApp from '@micro-zoe/micro-app' // 注册子应用vite的数据通信对象 window.eventCenterForVite = new EventCenterForMicroApp('vite') @@ -26,16 +27,23 @@ function vite () { console.log('来自 vite 子应用的数据', e.detail.data) } + function jumpToPage2 () { + microApp.router.push({name: 'vite', path: '/micro-app/vite/#/page2'}) + } + return (
- + + + +
{ showLoading && diff --git a/dev/main-react16/src/pages/vue2/vue2.js b/dev/main-react16/src/pages/vue2/vue2.js index 4cd2ab92b..25d611b53 100644 --- a/dev/main-react16/src/pages/vue2/vue2.js +++ b/dev/main-react16/src/pages/vue2/vue2.js @@ -2,10 +2,11 @@ /** @jsx jsxCustomEvent */ import jsxCustomEvent from '@micro-zoe/micro-app/polyfill/jsx-custom-event' import { useState, useEffect } from 'react' -import { Button, Spin } from 'antd' +import { Button, Spin, Col } from 'antd' import { LoadingOutlined } from '@ant-design/icons' import config from '../../config' import './vue2.less' +import microApp from '@micro-zoe/micro-app' const antIcon = @@ -23,6 +24,18 @@ function Vue2 () { console.log('生命周期:unmount -- vue2') } + function jumpToHome () { + microApp.router.push({name: 'vue2', path: '/micro-app/vue2/#/'}) + } + + function jumpToPage2 () { + microApp.router.push({name: 'vue2', path: 'http://localhost:4001/micro-app/vue2/#/page2'}) + } + + function jumpToTable () { + microApp.router.push({name: 'vue2', path: '/micro-app/vue2/#/table'}) + } + useEffect(() => { console.time('vue2') console.time('mounted-vue2') @@ -30,13 +43,18 @@ function Vue2 () { return (
- + + + + + +
{ showLoading && diff --git a/dev/main-react16/src/pages/vue3/vue3.js b/dev/main-react16/src/pages/vue3/vue3.js index eb80c32d6..325dcc475 100644 --- a/dev/main-react16/src/pages/vue3/vue3.js +++ b/dev/main-react16/src/pages/vue3/vue3.js @@ -2,9 +2,10 @@ /** @jsx jsxCustomEvent */ import jsxCustomEvent from '@micro-zoe/micro-app/polyfill/jsx-custom-event' import { useState } from 'react' -import { Spin } from 'antd' +import { Spin, Button, Col } from 'antd' import { LoadingOutlined } from '@ant-design/icons' import config from '../../config' +import microApp from '@micro-zoe/micro-app' const antIcon = @@ -12,8 +13,20 @@ function Vue3 () { const [showLoading, hideLoading] = useState(true) const [data, changeData] = useState({from: '来自基座的初始化数据'}) + function jumpToHome () { + microApp.router.push({name: 'vue3', path: '/micro-app/vue3/'}) + } + + function jumpToPage2 () { + microApp.router.push({name: 'vue3', path: '/micro-app/vue3/page2'}) + } + return (
+ + + + { showLoading && } diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 5d5ac4301..eeaf5babd 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -116,6 +116,9 @@ export function defer (fn: Func, ...args: any[]): void { Promise.resolve().then(fn.bind(null, ...args)) } +export function createURL (path: string | URL, base?: string): URL { + return base ? new URL('' + path, base) : new URL('' + path) +} /** * Add address protocol * @param url address @@ -134,7 +137,7 @@ export function formatAppURL (url: string | null, appName: string | null = null) if (!isString(url) || !url) return '' try { - const { origin, pathname, search } = new URL(addProtocol(url)) + const { origin, pathname, search } = createURL(addProtocol(url)) // If it ends with .html/.node/.php/.net/.etc, don’t need to add / if (/\.(\w+)$/.test(pathname)) { return `${origin}${pathname}${search}` @@ -155,6 +158,7 @@ export function formatAppURL (url: string | null, appName: string | null = null) * 3. event_center -> EventCenterForBaseApp -> all methods * 4. preFetch * 5. plugins + * 6. router api (push, replace) */ export function formatAppName (name: string | null): string { if (!isString(name) || !name) return '' @@ -166,7 +170,7 @@ export function formatAppName (name: string | null): string { * @param url app.url */ export function getEffectivePath (url: string): string { - const { origin, pathname } = new URL(url) + const { origin, pathname } = createURL(url) if (/\.(\w+)$/.test(pathname)) { const fullPath = `${origin}${pathname}` const pathArr = fullPath.split('/') @@ -189,7 +193,7 @@ export function CompletionPath (path: string, baseURI: string): string { /^(data|blob):/.test(path) ) return path - return new URL(path, getEffectivePath(addProtocol(baseURI))).toString() + return createURL(path, getEffectivePath(addProtocol(baseURI))).toString() } /** diff --git a/src/micro_app.ts b/src/micro_app.ts index cb173d6b9..7e44b54ac 100644 --- a/src/micro_app.ts +++ b/src/micro_app.ts @@ -1,4 +1,12 @@ -import type { OptionsType, MicroAppConfigType, lifeCyclesType, plugins, fetchType, AppInterface } from '@micro-app/types' +import type { + OptionsType, + MicroAppConfigType, + lifeCyclesType, + plugins, + fetchType, + AppInterface, + Router, +} from '@micro-app/types' import { defineElement } from './micro_app_element' import preFetch, { getGlobalAssets } from './prefetch' import { @@ -14,6 +22,7 @@ import { EventCenterForBaseApp } from './interact' import { initGlobalEnv } from './libs/global_env' import { appInstanceMap } from './create_app' import { appStates, keepAliveStates } from './constants' +import { router } from './sandbox/router' /** * if app not prefetch & not unmount, then app is active @@ -136,6 +145,7 @@ export class MicroApp extends EventCenterForBaseApp implements MicroAppConfigTyp plugins?: plugins fetch?: fetchType preFetch = preFetch + router: Router = router start (options?: OptionsType): void { if (!isBrowser || !window.customElements) { return logError('micro-app is not supported in this environment') diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index b21dac76e..b8209b628 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -60,6 +60,7 @@ export type MicroAppWindowDataType = { } export type MicroAppWindowType = Window & MicroAppWindowDataType +export type proxyWindow = WindowProxy & MicroAppWindowDataType // Variables that can escape to rawWindow const staticEscapeProperties: PropertyKey[] = [ @@ -95,7 +96,7 @@ export default class SandBox implements SandBoxInterface { private recordUmdInjectedValues?: Map // sandbox state private active = false - public proxyWindow: WindowProxy & MicroAppWindowDataType // Proxy + public proxyWindow: proxyWindow // Proxy public microAppWindow = {} as MicroAppWindowType // Proxy target constructor (appName: string, url: string, useMemoryRouter = true) { @@ -116,7 +117,6 @@ export default class SandBox implements SandBoxInterface { this.initRouteState() // unique listener of popstate event for sub app this.removeHistoryListener = addHistoryListener( - globalEnv.rawWindow, this.proxyWindow.__MICRO_APP_NAME__, ) } else { diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index 3ff8af52e..c28fd6add 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -1,25 +1,56 @@ -import type { Router } from '@micro-app/types' +import type { + Router, + RouterTarget, + navigationMethod, +} from '@micro-app/types' import { encodeMicroPath, decodeMicroPath, } from './core' +import { + logError, + formatAppName, + createURL, +} from '../../libs/utils' +import { appInstanceMap } from '../../create_app' +import { getActiveApps } from '../../micro_app' +import { dispatchPopStateEventToMicroApp } from './event' -// function push (to: { -// name: string, -// path: string, -// state?: unknown, -// replace?: boolean -// }) { - -// } +/** + * path需要注意的是两点:1、子应用的base也要加上 2、对于hash路由,要带上hash,如果开发者不知道具体地址如何写,那么单独运行子应用,跳转到对应的页面,复制浏览器地址到path + * path 为子应用除域名外的全量地址(可以带上域名) + * 相同的地址是否需要继续跳转??? + */ +function createNavigationMethod (replace: boolean): navigationMethod { + return function (to: RouterTarget): void { + if (typeof to?.name === 'string' && typeof to.path === 'string') { + const app = appInstanceMap.get(to.name = formatAppName(to.name)) + if (!app) return logError(`navigation failed, the app named ${to.name} not exist`) + if (!app.sandBox) return logError(`navigation failed, the sandBox of app ${to.name} is closed`) + if (!getActiveApps().includes(to.name)) return logError(`navigation failed, the app named ${to.name} has been unmounted`) + const proxyWindow = app.sandBox.proxyWindow + const microLocation = proxyWindow.location + const currentFullPath = microLocation.pathname + microLocation.search + microLocation.hash + const targetLocation = createURL(to.path, app.url) + // Only get path data, even if the origin is different from microApp + const targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash + if (currentFullPath !== targetPath) { + proxyWindow.history[replace || to.replace ? 'replaceState' : 'pushState'](to.state ?? null, '', targetPath) + dispatchPopStateEventToMicroApp(to.name, proxyWindow, null) + } + } else { + logError('navigation failed, name & path are required') + } + } +} // Router API for developer export const router: Router = { currentRoute: {}, encode: encodeMicroPath, decode: decodeMicroPath, - // push, - // replace: + push: createNavigationMethod(false), + replace: createNavigationMethod(true), // go: // back: // forward: diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts index 348ed6641..6a21ce81f 100644 --- a/src/sandbox/router/core.ts +++ b/src/sandbox/router/core.ts @@ -11,6 +11,7 @@ import { isString, isUndefined, isPlainObject, + createURL, } from '../../libs/utils' // set micro app state to origin state @@ -28,11 +29,11 @@ export function setMicroState ( } /** - * vue-router4 will execute the replace method to replace the URL base on history.state.current before push + * vue-router4 will call replace method to replace the URL base on history.state.current before push * add the latest search & hash to history.state.current to avoid this problem */ if (rawState?.current) { - additionalState.current = (new URL(rawState.current, base)).pathname + searchHash + additionalState.current = (createURL(rawState.current, base)).pathname + searchHash } // create new state object @@ -53,7 +54,7 @@ export function removeMicroState (appName: string, rawState: MicroState, url: st let coverState = null if (rawState?.current) { coverState = { - current: removeMicroPathFromURL(appName, new URL(rawState.current, url) as MicroLocation) + current: removeMicroPathFromURL(appName, createURL(rawState.current, url) as MicroLocation) } } diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index db3c086ae..5f0f86b40 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -12,15 +12,14 @@ type PopStateListener = (this: Window, e: PopStateEvent) => void * listen & release popstate event * each child app will listen for popstate event when sandbox start * and release it when sandbox stop - * @param rawWindow origin window * @param appName app name * @returns release callback */ -export function addHistoryListener (rawWindow: Window, appName: string): CallableFunction { +export function addHistoryListener (appName: string): CallableFunction { // handle popstate event and distribute to child app const popStateHandler: PopStateListener = (e: PopStateEvent): void => { - const activeApps = getActiveApps(true) - if (activeApps.includes(appName)) { + // exclude hidden keep-alive app + if (getActiveApps(true).includes(appName)) { const microPath = getMicroPathFromURL(appName) const app = appInstanceMap.get(appName)! const proxyWindow = app.sandBox!.proxyWindow @@ -36,40 +35,56 @@ export function addHistoryListener (rawWindow: Window, appName: string): Callabl // console.log(333333, microPath, proxyWindow.location) - // create PopStateEvent named popstate-appName with sub app state - const newPopStateEvent = new PopStateEvent( - formatEventName('popstate', appName), - { state: getMicroState(appName, e.state) } - ) - - rawWindow.dispatchEvent(newPopStateEvent) - - typeof proxyWindow.onpopstate === 'function' && proxyWindow.onpopstate(newPopStateEvent) + dispatchPopStateEventToMicroApp(appName, proxyWindow, e.state) // send HashChangeEvent when hash change - if (isHashChange) { - const newHashChangeEvent = new HashChangeEvent( - formatEventName('hashchange', appName), - { - newURL: proxyWindow.location.href, - oldURL: oldHref, - } - ) - - rawWindow.dispatchEvent(newHashChangeEvent) - - typeof proxyWindow.onhashchange === 'function' && proxyWindow.onhashchange(newHashChangeEvent) - } + if (isHashChange) dispatchHashChangeEventToMicroApp(appName, proxyWindow, oldHref) } } - rawWindow.addEventListener('popstate', popStateHandler) + globalEnv.rawWindow.addEventListener('popstate', popStateHandler) return () => { - rawWindow.removeEventListener('popstate', popStateHandler) + globalEnv.rawWindow.removeEventListener('popstate', popStateHandler) } } +export function dispatchPopStateEventToMicroApp ( + appName: string, + proxyWindow: WindowProxy, + eventState: unknown, +): void { + // create PopStateEvent named popstate-appName with sub app state + const newPopStateEvent = new PopStateEvent( + formatEventName('popstate', appName), + { state: getMicroState(appName, eventState) } + ) + + globalEnv.rawWindow.dispatchEvent(newPopStateEvent) + + // call function window.onpopstate if it exists + typeof proxyWindow.onpopstate === 'function' && proxyWindow.onpopstate(newPopStateEvent) +} + +export function dispatchHashChangeEventToMicroApp ( + appName: string, + proxyWindow: WindowProxy, + oldHref: string, +): void { + const newHashChangeEvent = new HashChangeEvent( + formatEventName('hashchange', appName), + { + newURL: proxyWindow.location.href, + oldURL: oldHref, + } + ) + + globalEnv.rawWindow.dispatchEvent(newHashChangeEvent) + + // call function window.onhashchange if it exists + typeof proxyWindow.onhashchange === 'function' && proxyWindow.onhashchange(newHashChangeEvent) +} + /** * dispatch pure PopStateEvent * simulate location behavior diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 85ee0005d..65fb1f1c5 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -5,7 +5,7 @@ import type { HistoryProxyValue, } from '@micro-app/types' import globalEnv from '../../libs/global_env' -import { isString, logError } from '../../libs/utils' +import { isString, logError, createURL } from '../../libs/utils' import { updateLocation } from './location' import { setMicroPathToURL, setMicroState, getMicroState } from './core' @@ -23,7 +23,7 @@ export function createMicroHistory ( // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! if ((methodName === 'pushState' || methodName === 'replaceState') && rests[2] && isString(rests[2])) { try { - const targetLocation = new URL('' + rests[2], base) as MicroLocation + const targetLocation = createURL(rests[2], base) as MicroLocation if (targetLocation.origin === microLocation.origin) { targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash const setMicroPathResult = setMicroPathToURL(appName, targetLocation) diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index 0a699a3a6..ce282f445 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -18,6 +18,7 @@ import { createMicroHistory, updateBrowserURL, } from './history' +import { createURL } from '../../libs/utils' export { addHistoryListener } from './event' export { router } from './api' @@ -83,7 +84,7 @@ export function clearRouteStateFromURL ( keepRouteState: boolean, ): void { if (!keepRouteState) { - const { pathname, search, hash } = new URL(url) + const { pathname, search, hash } = createURL(url) updateLocation(pathname + search + hash, url, microLocation) } removeStateAndPathFromBrowser(appName, url) diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index 45281a1e2..035d39861 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -1,7 +1,7 @@ /* eslint-disable no-void */ import type { MicroLocation } from '@micro-app/types' import globalEnv from '../../libs/global_env' -import { assign as oAssign, rawDefineProperties } from '../../libs/utils' +import { assign as oAssign, rawDefineProperties, createURL } from '../../libs/utils' import { setMicroPathToURL } from './core' import { dispatchPurePopStateEvent } from './event' @@ -15,7 +15,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio const rawWindow = globalEnv.rawWindow const rawLocation = rawWindow.location // microLocation is the location of child app, it is globally unique - const microLocation = new URL(url) as MicroLocation + const microLocation = createURL(url) as MicroLocation // shadowLocation is the current location information (href, pathname, search, hash) const shadowLocation = { href: microLocation.href, @@ -32,7 +32,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio * @returns origin value or formatted value */ const commonHandle = (value: string | URL, methodName: string): string | URL | undefined => { - const targetLocation = new URL('' + value, url) as MicroLocation + const targetLocation = createURL(value, url) as MicroLocation if (targetLocation.origin === microLocation.origin) { const setMicroPathResult = setMicroPathToURL(appName, targetLocation) /** @@ -47,7 +47,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio targetLocation.search === shadowLocation.search ) { if (targetLocation.hash !== shadowLocation.hash) { - rawWindow.history[methodName](null, null, setMicroPathResult.fullPath) + rawWindow.history[methodName](null, '', setMicroPathResult.fullPath) } if (targetLocation.hash) { @@ -57,7 +57,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio } return void 0 } else if (setMicroPathResult.attach2Hash) { - rawWindow.history[methodName](null, null, setMicroPathResult.fullPath) + rawWindow.history[methodName](null, '', setMicroPathResult.fullPath) rawLocation.reload() return void 0 } @@ -68,16 +68,16 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio return value } - const createAssignOrReplace = (locationMethodName: string) => { - return (value: string | URL) => { + const createLocationMethod = (locationMethodName: string) => { + return function (value: string | URL) { const formattedValue = commonHandle(value, locationMethodName === 'assign' ? 'pushState' : 'replaceState') if (formattedValue) rawLocation[locationMethodName](formattedValue) } } - const assign = createAssignOrReplace('assign') + const assign = createLocationMethod('assign') - const replace = createAssignOrReplace('replace') + const replace = createLocationMethod('replace') const reload = (forcedReload?: boolean): void => rawLocation.reload(forcedReload) @@ -108,7 +108,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio get: (): string => shadowLocation.pathname, set: (value: string): void => { const targetPath = ('/' + value).replace(/^\/+/, '/') + shadowLocation.search + shadowLocation.hash - const targetLocation = new URL(targetPath, url) as MicroLocation + const targetLocation = createURL(targetPath, url) as MicroLocation // When the browser url has a hash value, the same pathname will not trigger the browser refresh if (targetLocation.pathname === shadowLocation.pathname && shadowLocation.hash) { dispatchPurePopStateEvent() @@ -116,7 +116,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio // When the value is the same, no new route stack will be added // Special scenes such as: /path ==> /path#hash, /path ==> /path?query const methodName = targetLocation.pathname === shadowLocation.pathname ? 'replaceState' : 'pushState' - rawWindow.history[methodName](null, null, setMicroPathToURL(appName, targetLocation).fullPath) + rawWindow.history[methodName](null, '', setMicroPathToURL(appName, targetLocation).fullPath) rawLocation.reload() } } @@ -127,7 +127,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio get: (): string => shadowLocation.search, set: (value: string): void => { const targetPath = shadowLocation.pathname + ('?' + value).replace(/^\?+/, '?') + shadowLocation.hash - const targetLocation = new URL(targetPath, url) as MicroLocation + const targetLocation = createURL(targetPath, url) as MicroLocation // When the browser url has a hash value, the same search will not trigger the browser refresh if (targetLocation.search === shadowLocation.search && shadowLocation.hash) { dispatchPurePopStateEvent() @@ -135,7 +135,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio // When the value is the same, no new route stack will be added // Special scenes such as: ?query ==> ?query#hash const methodName = targetLocation.search === shadowLocation.search ? 'replaceState' : 'pushState' - rawWindow.history[methodName](null, null, setMicroPathToURL(appName, targetLocation).fullPath) + rawWindow.history[methodName](null, '', setMicroPathToURL(appName, targetLocation).fullPath) rawLocation.reload() } } @@ -146,10 +146,10 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio get: (): string => shadowLocation.hash, set: (value: string): void => { const targetPath = shadowLocation.pathname + shadowLocation.search + ('#' + value).replace(/^#+/, '#') - const targetLocation = new URL(targetPath, url) as MicroLocation + const targetLocation = createURL(targetPath, url) as MicroLocation // The same hash will not trigger popStateEvent if (targetLocation.hash !== shadowLocation.hash) { - rawWindow.history.pushState(null, null, setMicroPathToURL(appName, targetLocation).fullPath) + rawWindow.history.pushState(null, '', setMicroPathToURL(appName, targetLocation).fullPath) dispatchPurePopStateEvent() } } @@ -176,7 +176,7 @@ export function updateLocation ( base: string, microLocation: MicroLocation, ): void { - const newLocation = new URL(path, base) + const newLocation = createURL(path, base) for (const key of locationKeys) { if (shadowLocationKeys.includes(key)) { // @ts-ignore diff --git a/typings/global.d.ts b/typings/global.d.ts index 158eca2c1..27ae484d0 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -197,6 +197,7 @@ declare module '@micro-app/types' { plugins?: plugins fetch?: fetchType preFetch(apps: prefetchParamList): void + router: Router // eslint-disable-line start(options?: OptionsType): void } @@ -240,6 +241,15 @@ declare module '@micro-app/types' { [appName: string]: MicroLocation, } + interface RouterTarget { + name: string + path: string + state?: unknown + replace?: boolean + } + + type navigationMethod = (to: RouterTarget) => void + // Router API for developer interface Router { readonly currentRoute?: CurrentRoute @@ -253,6 +263,19 @@ declare module '@micro-app/types' { * @param path url path */ decode(path: string): ReturnType + /** + * Navigate to a new URL by pushing an entry in the history + * stack. + * @param to - Route location to navigate to + */ + push: navigationMethod + /** + * Navigate to a new URL by replacing the current entry in + * the history stack. + * + * @param to - Route location to navigate to + */ + replace: navigationMethod } } From 7dd08f3e8963c242a2f9cf567975bf07dc09867d Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Tue, 14 Jun 2022 21:46:23 +0800 Subject: [PATCH 027/268] feat: add beforeEach&afterEach hook for router --- dev/main-react16/src/global.less | 1 + dev/main-react16/src/pages/react16/react16.js | 38 +++++++- src/libs/utils.ts | 6 +- src/sandbox/router/api.ts | 56 +++++++++-- src/sandbox/router/core.ts | 2 +- src/sandbox/router/event.ts | 2 +- src/sandbox/router/history.ts | 4 +- src/sandbox/router/index.ts | 4 +- src/sandbox/router/location.ts | 93 ++++++++++++------- typings/global.d.ts | 40 +++++++- 10 files changed, 190 insertions(+), 56 deletions(-) diff --git a/dev/main-react16/src/global.less b/dev/main-react16/src/global.less index 4ea647a86..fb80d19d2 100644 --- a/dev/main-react16/src/global.less +++ b/dev/main-react16/src/global.less @@ -61,6 +61,7 @@ micro-app, micro-app-body{ display: flex; flex-direction: column; margin-bottom: 5px; + padding-right: 5px; button { margin: 2px; diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index 3048ebca3..5f825372b 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -101,8 +101,8 @@ export default class App extends React.Component { changeNameUrl = () => { this.setState({ - name: 'vue2', - url: `${config.vue2}micro-app/vue2`, + name: 'react16', + url: `${config.react16}micro-app/react16/?a=2`, }) } @@ -147,6 +147,26 @@ export default class App extends React.Component { microApp.router.push({name: this.state.name, path: '/micro-app/react16/inline'}) } + useRouterGo = () => { + microApp.router.go(-1) + } + + useRouterBack = () => { + microApp.router.back() + } + + useRouterForward = () => { + microApp.router.forward() + } + + useCurrentRoute = () => { + console.log('router.current', microApp.router.current.get('react16')) + + // setTimeout(() => { + // microApp.router.current.get('react16').assign('?b=222') + // }, 3000); + } + handleGlobalDataForBaseApp = (data) => { console.log(`这是全局数据--基座应用-${this.state.name}`, data) } @@ -160,6 +180,16 @@ export default class App extends React.Component { }) microApp.addGlobalDataListener(this.handleGlobalDataForBaseApp) + + microApp.router.beforeEach((to, from, appName) => { + + }) + + microApp.router.beforeEach({ + appName (to, from) { + + } + }) } componentWillUnmount () { @@ -182,6 +212,10 @@ export default class App extends React.Component { + + + + diff --git a/src/libs/utils.ts b/src/libs/utils.ts index eeaf5babd..509d747be 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -1,5 +1,5 @@ /* eslint-disable no-new-func, indent, @typescript-eslint/explicit-module-boundary-types */ -import type { Func, LocationQueryObject, LocationQueryValue } from '@micro-app/types' +import type { Func, LocationQueryObject, LocationQueryValue, MicroLocation } from '@micro-app/types' export const version = '__MICRO_APP_VERSION__' @@ -116,8 +116,8 @@ export function defer (fn: Func, ...args: any[]): void { Promise.resolve().then(fn.bind(null, ...args)) } -export function createURL (path: string | URL, base?: string): URL { - return base ? new URL('' + path, base) : new URL('' + path) +export function createURL (path: string | URL, base?: string): MicroLocation { + return (base ? new URL('' + path, base) : new URL('' + path)) as MicroLocation } /** * Add address protocol diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index c28fd6add..a4eb7fc4f 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -1,7 +1,11 @@ import type { + Func, Router, RouterTarget, navigationMethod, + MicroLocation, + routerGuard, + GuardLocation, } from '@micro-app/types' import { encodeMicroPath, @@ -11,13 +15,16 @@ import { logError, formatAppName, createURL, + isFunction, + isPlainObject, } from '../../libs/utils' import { appInstanceMap } from '../../create_app' import { getActiveApps } from '../../micro_app' import { dispatchPopStateEventToMicroApp } from './event' +import globalEnv from '../../libs/global_env' /** - * path需要注意的是两点:1、子应用的base也要加上 2、对于hash路由,要带上hash,如果开发者不知道具体地址如何写,那么单独运行子应用,跳转到对应的页面,复制浏览器地址到path + * path需要注意的是两点:1、子应用的base也要加上 2、对于hash路由,要带上hash,如果开发者不知道具体地址如何写,那么单独运行子应用,跳转到对应的页面,复制浏览器地址 * path 为子应用除域名外的全量地址(可以带上域名) * 相同的地址是否需要继续跳转??? */ @@ -44,17 +51,50 @@ function createNavigationMethod (replace: boolean): navigationMethod { } } +function createRawHistoryMethod (methodName: string): Func { + return function (...rests: unknown[]): void { + return globalEnv.rawWindow.history[methodName](...rests) + } +} + +/** + * global hook for router + * update router information base on microLocation + * @param appName app name + * @param microLocation location of microApp + */ +export function executeNavigationGuard ( + appName: string, + to: GuardLocation, + from?: GuardLocation, +): void { + router.current.set(appName, to) + + if (from) { + alert(from) + } +} + +function registerNavigationGuard (guardName: string) { + return function (guard: routerGuard) { + if (isFunction(guard)) { + alert(guardName) + } else if (isPlainObject(guard)) { + alert(guardName) + } + } +} + // Router API for developer export const router: Router = { - currentRoute: {}, + current: new Map(), encode: encodeMicroPath, decode: decodeMicroPath, push: createNavigationMethod(false), replace: createNavigationMethod(true), - // go: - // back: - // forward: - // beforeEach: - // afterEach: - // onError: + go: createRawHistoryMethod('go'), + back: createRawHistoryMethod('back'), + forward: createRawHistoryMethod('forward'), + beforeEach: registerNavigationGuard('beforeEach'), + afterEach: registerNavigationGuard('afterEach'), } diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts index 6a21ce81f..9bdfdf9a1 100644 --- a/src/sandbox/router/core.ts +++ b/src/sandbox/router/core.ts @@ -54,7 +54,7 @@ export function removeMicroState (appName: string, rawState: MicroState, url: st let coverState = null if (rawState?.current) { coverState = { - current: removeMicroPathFromURL(appName, createURL(rawState.current, url) as MicroLocation) + current: removeMicroPathFromURL(appName, createURL(rawState.current, url)) } } diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index 5f0f86b40..ca631ffee 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -29,7 +29,7 @@ export function addHistoryListener (appName: string): CallableFunction { // Do not attach micro info to url when microPath is empty if (microPath) { const oldHash = proxyWindow.location.hash - updateLocation(microPath, app.url, proxyWindow.location as MicroLocation) + updateLocation(appName, microPath, app.url, proxyWindow.location as MicroLocation) isHashChange = proxyWindow.location.hash !== oldHash } diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 65fb1f1c5..8f5b743be 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -23,7 +23,7 @@ export function createMicroHistory ( // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! if ((methodName === 'pushState' || methodName === 'replaceState') && rests[2] && isString(rests[2])) { try { - const targetLocation = createURL(rests[2], base) as MicroLocation + const targetLocation = createURL(rests[2], base) if (targetLocation.origin === microLocation.origin) { targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash const setMicroPathResult = setMicroPathToURL(appName, targetLocation) @@ -40,7 +40,7 @@ export function createMicroHistory ( rawHistory[methodName].apply(rawHistory, rests) - if (targetPath) updateLocation(targetPath, base, microLocation) + if (targetPath) updateLocation(appName, targetPath, base, microLocation) // console.log(5555555, microLocation, base) } diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index ce282f445..a6a5d4388 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -48,7 +48,7 @@ export function initRouteStateWithURL ( ): void { const microPath = getMicroPathFromURL(appName) if (microPath) { - updateLocation(microPath, url, microLocation) + updateLocation(appName, microPath, url, microLocation) } else { updateBrowserURLWithLocation(appName, url, microLocation) } @@ -85,7 +85,7 @@ export function clearRouteStateFromURL ( ): void { if (!keepRouteState) { const { pathname, search, hash } = createURL(url) - updateLocation(pathname + search + hash, url, microLocation) + updateLocation(appName, pathname + search + hash, url, microLocation) } removeStateAndPathFromBrowser(appName, url) } diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index 035d39861..66e1735c5 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -1,9 +1,10 @@ /* eslint-disable no-void */ -import type { MicroLocation } from '@micro-app/types' +import type { MicroLocation, GuardLocation, ShadowLocation } from '@micro-app/types' import globalEnv from '../../libs/global_env' import { assign as oAssign, rawDefineProperties, createURL } from '../../libs/utils' import { setMicroPathToURL } from './core' import { dispatchPurePopStateEvent } from './event' +import { executeNavigationGuard } from './api' /** * Create location for micro app @@ -15,9 +16,9 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio const rawWindow = globalEnv.rawWindow const rawLocation = rawWindow.location // microLocation is the location of child app, it is globally unique - const microLocation = createURL(url) as MicroLocation + const microLocation = createURL(url) // shadowLocation is the current location information (href, pathname, search, hash) - const shadowLocation = { + const shadowLocation: ShadowLocation = { href: microLocation.href, pathname: microLocation.pathname, search: microLocation.search, @@ -32,7 +33,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio * @returns origin value or formatted value */ const commonHandle = (value: string | URL, methodName: string): string | URL | undefined => { - const targetLocation = createURL(value, url) as MicroLocation + const targetLocation = createURL(value, url) if (targetLocation.origin === microLocation.origin) { const setMicroPathResult = setMicroPathToURL(appName, targetLocation) /** @@ -68,26 +69,6 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio return value } - const createLocationMethod = (locationMethodName: string) => { - return function (value: string | URL) { - const formattedValue = commonHandle(value, locationMethodName === 'assign' ? 'pushState' : 'replaceState') - if (formattedValue) rawLocation[locationMethodName](formattedValue) - } - } - - const assign = createLocationMethod('assign') - - const replace = createLocationMethod('replace') - - const reload = (forcedReload?: boolean): void => rawLocation.reload(forcedReload) - - oAssign(microLocation, { - assign, - replace, - reload, - shadowLocation, - }) - /** * Special processing for four keys: href, pathname, search and hash * They take values from shadowLocation, and require special operations when assigning values @@ -108,7 +89,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio get: (): string => shadowLocation.pathname, set: (value: string): void => { const targetPath = ('/' + value).replace(/^\/+/, '/') + shadowLocation.search + shadowLocation.hash - const targetLocation = createURL(targetPath, url) as MicroLocation + const targetLocation = createURL(targetPath, url) // When the browser url has a hash value, the same pathname will not trigger the browser refresh if (targetLocation.pathname === shadowLocation.pathname && shadowLocation.hash) { dispatchPurePopStateEvent() @@ -127,7 +108,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio get: (): string => shadowLocation.search, set: (value: string): void => { const targetPath = shadowLocation.pathname + ('?' + value).replace(/^\?+/, '?') + shadowLocation.hash - const targetLocation = createURL(targetPath, url) as MicroLocation + const targetLocation = createURL(targetPath, url) // When the browser url has a hash value, the same search will not trigger the browser refresh if (targetLocation.search === shadowLocation.search && shadowLocation.hash) { dispatchPurePopStateEvent() @@ -146,7 +127,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio get: (): string => shadowLocation.hash, set: (value: string): void => { const targetPath = shadowLocation.pathname + shadowLocation.search + ('#' + value).replace(/^#+/, '#') - const targetLocation = createURL(targetPath, url) as MicroLocation + const targetLocation = createURL(targetPath, url) // The same hash will not trigger popStateEvent if (targetLocation.hash !== shadowLocation.hash) { rawWindow.history.pushState(null, '', setMicroPathToURL(appName, targetLocation).fullPath) @@ -156,34 +137,82 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio }, }) + const createLocationMethod = (locationMethodName: string) => { + return function (value: string | URL) { + const formattedValue = commonHandle(value, locationMethodName === 'assign' ? 'pushState' : 'replaceState') + if (formattedValue) rawLocation[locationMethodName](formattedValue) + } + } + + const assign = createLocationMethod('assign') + + const replace = createLocationMethod('replace') + + const reload = (forcedReload?: boolean): void => rawLocation.reload(forcedReload) + + oAssign(microLocation, { + assign, + replace, + reload, + shadowLocation, + }) + + executeNavigationGuard(appName, createGuardLocation(appName, microLocation)) + return microLocation } // origin is readonly, so we ignore it -const locationKeys = ['hash', 'host', 'hostname', 'href', 'password', 'pathname', 'port', 'protocol', 'search'] -const shadowLocationKeys = ['href', 'pathname', 'search', 'hash'] +const locationKeys: ReadonlyArray = ['href', 'pathname', 'search', 'hash', 'host', 'hostname', 'port', 'protocol', 'search'] +const shadowLocationKeys: ReadonlyArray = ['href', 'pathname', 'search', 'hash'] + +/** + * create guardLocation by microLocation, used for router guard + */ +function createGuardLocation (appName: string, microLocation: MicroLocation): GuardLocation { + const guardLocation = oAssign({ name: appName }, microLocation) as GuardLocation + // The prototype values on the URL needs to be manually transferred + for (const key of locationKeys) guardLocation[key] = microLocation[key] + return guardLocation +} + /** * There are three situations that trigger location update: * 1. pushState/replaceState * 2. popStateEvent * 3. params on browser url when init sub app + * @param appName app name * @param path target path * @param base base url * @param microLocation micro app location */ export function updateLocation ( + appName: string, path: string, base: string, microLocation: MicroLocation, ): void { const newLocation = createURL(path, base) + // record old values of microLocation to `from` + const from = createGuardLocation(appName, microLocation) + const oldFullPath = from.pathname + from.search + from.hash for (const key of locationKeys) { if (shadowLocationKeys.includes(key)) { - // @ts-ignore - microLocation.shadowLocation[key] = newLocation[key] + // reference of shadowLocation + microLocation.shadowLocation[key] = newLocation[key] as string } else { - // @ts-ignore + // @ts-ignore reference of microLocation microLocation[key] = newLocation[key] } } + // update latest values of microLocation to `to` + const to = createGuardLocation(appName, microLocation) + const newFullPath = to.pathname + to.search + to.hash + + // console.log(22222, oldFullPath, newFullPath) + // The hook called only when the url changes + if (oldFullPath !== newFullPath) { + // console.log(333333, to, from) + executeNavigationGuard(appName, to) + } } diff --git a/typings/global.d.ts b/typings/global.d.ts index 27ae484d0..80e763f6e 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -204,9 +204,14 @@ declare module '@micro-app/types' { // special CallableFunction for interact type CallableFunctionForInteract = CallableFunction & { __APP_NAME__?: string, __AUTO_TRIGGER__?: boolean } + interface ShadowLocation { + [k: string]: string + } + interface MicroLocation extends Location, URL { // shadowLocation is the current location information (href, pathname, search, hash) - shadowLocation: URL + shadowLocation: ShadowLocation + [key: string]: any } type MicroHistory = ProxyHandler type MicroState = any @@ -237,9 +242,9 @@ declare module '@micro-app/types' { searchQuery?: LocationQueryObject } - interface CurrentRoute { - [appName: string]: MicroLocation, - } + type GuardLocation = Record + + type CurrentRoute = Map interface RouterTarget { name: string @@ -250,9 +255,16 @@ declare module '@micro-app/types' { type navigationMethod = (to: RouterTarget) => void + interface accurateGuard { + [appName: string]: (to: MicroLocation, from: MicroLocation) => void + } + + type routerGuard = (to: GuardLocation, from: GuardLocation, appName: string) => void | accurateGuard + // Router API for developer interface Router { - readonly currentRoute?: CurrentRoute + // current route of all apps + readonly current: CurrentRoute /** * encodeURI of microApp path * @param path url path @@ -276,6 +288,24 @@ declare module '@micro-app/types' { * @param to - Route location to navigate to */ replace: navigationMethod + /** + * Move forward or backward through the history. calling `history.go()`. + * + * @param delta - The position in the history to which you want to move, + * relative to the current page + */ + go: Func + // Go back in history if possible by calling `history.back()`. + back: Func + // Go forward in history if possible by calling `history.forward()`. + forward: Func + /** + * Add a navigation guard that executes before any navigation + * @param guard global hook for + */ + beforeEach(guard: routerGuard): void + + afterEach(guard: routerGuard): void } } From 78f867f345945dec53a5a30a656e6bf05d1fb564 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 15 Jun 2022 20:11:37 +0800 Subject: [PATCH 028/268] feat: compelete router hook --- dev/children/react16/src/pages/page2/page2.js | 6 +- dev/main-react16/src/pages/react16/react16.js | 24 ++- src/libs/global_env.ts | 30 +--- src/libs/nest_app.ts | 27 +++ src/libs/utils.ts | 20 +++ src/sandbox/index.ts | 5 +- src/sandbox/router/api.ts | 161 +++++++++++------- src/sandbox/router/event.ts | 2 +- src/sandbox/router/index.ts | 14 +- src/sandbox/router/location.ts | 41 +++-- typings/global.d.ts | 12 +- 11 files changed, 211 insertions(+), 131 deletions(-) create mode 100644 src/libs/nest_app.ts diff --git a/dev/children/react16/src/pages/page2/page2.js b/dev/children/react16/src/pages/page2/page2.js index 2b2014d51..5be64590c 100644 --- a/dev/children/react16/src/pages/page2/page2.js +++ b/dev/children/react16/src/pages/page2/page2.js @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useEffect } from 'react' import { Form, Select, @@ -57,6 +57,10 @@ const Page2 = () => { console.log(444444444) } + useEffect(() => { + console.log('react16 page2 useEffect') + }, []) + return (
diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index 5f825372b..86304da2a 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -181,13 +181,23 @@ export default class App extends React.Component { microApp.addGlobalDataListener(this.handleGlobalDataForBaseApp) - microApp.router.beforeEach((to, from, appName) => { + this.releaseBeforeEach1 = microApp.router.beforeEach((to, from, appName) => { + console.log('全局 beforeEach: ', to, from, appName) + }) + this.releaseBeforeEach2 = microApp.router.beforeEach({ + react16 (to, from) { + console.log('指定 beforeEach: ', to, from) + } }) - microApp.router.beforeEach({ - appName (to, from) { + this.releaseAfterEach1 = microApp.router.afterEach((to, from, appName) => { + console.log('全局 afterEach: ', to, from, appName) + }) + this.releaseAfterEach2 = microApp.router.afterEach({ + react16 (to, from) { + console.log('指定 afterEach: ', to, from) } }) } @@ -195,6 +205,10 @@ export default class App extends React.Component { componentWillUnmount () { microApp.clearDataListener(this.state.name) microApp.removeGlobalDataListener(this.handleGlobalDataForBaseApp) + this.releaseBeforeEach1() + this.releaseBeforeEach2() + this.releaseAfterEach1() + this.releaseAfterEach2() } render () { @@ -237,9 +251,9 @@ export default class App extends React.Component { onAfterhidden={this.handleAfterhidden} onDataChange={this.handleDataChange} baseRoute='/micro-app/demo/react16' - keep-alive + // keep-alive // destroy - // keep-route-state + keep-route-state // disable-memory-router // inline // disableSandbox diff --git a/src/libs/global_env.ts b/src/libs/global_env.ts index c4403ea1d..072e3b8ac 100644 --- a/src/libs/global_env.ts +++ b/src/libs/global_env.ts @@ -1,6 +1,5 @@ -import { isSupportModuleScript, isBrowser, getCurrentAppName, assign, getRootContainer } from './utils' +import { isSupportModuleScript, isBrowser, getCurrentAppName, assign } from './utils' import { rejectMicroAppStyle } from '../source/patch' -import { appInstanceMap } from '../create_app' type RequestIdleCallbackOptions = { timeout: number @@ -25,7 +24,7 @@ declare global { interface Node { __MICRO_APP_NAME__?: string | null - data?: any + data?: unknown } interface HTMLStyleElement { @@ -34,31 +33,6 @@ declare global { } } -function unmountNestedApp (): void { - appInstanceMap.forEach(app => { - // @ts-ignore - app.container && getRootContainer(app.container).disconnectedCallback() - }) - - !window.__MICRO_APP_UMD_MODE__ && appInstanceMap.clear() -} - -// if micro-app run in micro application, delete all next generation application when unmount event received -// unmount event will auto release by sandbox -export function listenUmountOfNestedApp (): void { - if (window.__MICRO_APP_ENVIRONMENT__) { - releaseUnmountOfNestedApp() - window.addEventListener('unmount', unmountNestedApp, false) - } -} - -// release listener -function releaseUnmountOfNestedApp (): void { - if (window.__MICRO_APP_ENVIRONMENT__) { - window.removeEventListener('unmount', unmountNestedApp, false) - } -} - const globalEnv: Record = {} /** diff --git a/src/libs/nest_app.ts b/src/libs/nest_app.ts new file mode 100644 index 000000000..cbc3c1885 --- /dev/null +++ b/src/libs/nest_app.ts @@ -0,0 +1,27 @@ +import { appInstanceMap } from '../create_app' +import { getRootContainer } from './utils' + +function unmountNestedApp (): void { + appInstanceMap.forEach(app => { + // @ts-ignore + app.container && getRootContainer(app.container).disconnectedCallback() + }) + + !window.__MICRO_APP_UMD_MODE__ && appInstanceMap.clear() +} + +// release listener +function releaseUnmountOfNestedApp (): void { + if (window.__MICRO_APP_ENVIRONMENT__) { + window.removeEventListener('unmount', unmountNestedApp, false) + } +} + +// if micro-app run in micro application, delete all next generation application when unmount event received +// unmount event will auto release by sandbox +export function listenUmountOfNestedApp (): void { + if (window.__MICRO_APP_ENVIRONMENT__) { + releaseUnmountOfNestedApp() + window.addEventListener('unmount', unmountNestedApp, false) + } +} diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 509d747be..fc34ce1e2 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -441,3 +441,23 @@ export function stringifyQuery (queryObject: LocationQueryObject): string { } export const noop = () => {} + +/** + * Create a list of callbacks that can be reset. + * Used to create before and after navigation guards list + */ +export function useCallbacks () { + const handlers: Set = new Set() + + function add (handler: T): () => void { + handlers.add(handler) + return () => { + if (handlers.has(handler)) handlers.delete(handler) + } + } + + return { + add, + list: () => handlers, + } +} diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index b8209b628..7e666c2de 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -9,9 +9,10 @@ import { rebuildDataCenterSnapshot, recordDataCenterSnapshot, } from '../interact' -import globalEnv, { +import globalEnv from '../libs/global_env' +import { listenUmountOfNestedApp, -} from '../libs/global_env' +} from '../libs/nest_app' import { getEffectivePath, isArray, diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index a4eb7fc4f..f40c4a3ec 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -4,8 +4,10 @@ import type { RouterTarget, navigationMethod, MicroLocation, - routerGuard, + RouterGuard, GuardLocation, + AccurateGuard, + GlobalNormalGuard, } from '@micro-app/types' import { encodeMicroPath, @@ -17,84 +19,115 @@ import { createURL, isFunction, isPlainObject, + useCallbacks, + requestIdleCallback, } from '../../libs/utils' import { appInstanceMap } from '../../create_app' import { getActiveApps } from '../../micro_app' import { dispatchPopStateEventToMicroApp } from './event' import globalEnv from '../../libs/global_env' -/** - * path需要注意的是两点:1、子应用的base也要加上 2、对于hash路由,要带上hash,如果开发者不知道具体地址如何写,那么单独运行子应用,跳转到对应的页面,复制浏览器地址 - * path 为子应用除域名外的全量地址(可以带上域名) - * 相同的地址是否需要继续跳转??? - */ -function createNavigationMethod (replace: boolean): navigationMethod { - return function (to: RouterTarget): void { - if (typeof to?.name === 'string' && typeof to.path === 'string') { - const app = appInstanceMap.get(to.name = formatAppName(to.name)) - if (!app) return logError(`navigation failed, the app named ${to.name} not exist`) - if (!app.sandBox) return logError(`navigation failed, the sandBox of app ${to.name} is closed`) - if (!getActiveApps().includes(to.name)) return logError(`navigation failed, the app named ${to.name} has been unmounted`) - const proxyWindow = app.sandBox.proxyWindow - const microLocation = proxyWindow.location - const currentFullPath = microLocation.pathname + microLocation.search + microLocation.hash - const targetLocation = createURL(to.path, app.url) - // Only get path data, even if the origin is different from microApp - const targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash - if (currentFullPath !== targetPath) { - proxyWindow.history[replace || to.replace ? 'replaceState' : 'pushState'](to.state ?? null, '', targetPath) - dispatchPopStateEventToMicroApp(to.name, proxyWindow, null) +export interface RouterApi { + router: Router, + executeNavigationGuard: (appName: string, to: GuardLocation, from: GuardLocation) => void +} + +function createRouterApi (): RouterApi { + /** + * path需要注意的是两点:1、子应用的base也要加上 2、对于hash路由,要带上hash,如果开发者不知道具体地址如何写,那么单独运行子应用,跳转到对应的页面,复制浏览器地址 + * path 为子应用除域名外的全量地址(可以带上域名) + * 相同的地址是否需要继续跳转??? + */ + function createNavigationMethod (replace: boolean): navigationMethod { + return function (to: RouterTarget): void { + if (typeof to?.name === 'string' && typeof to.path === 'string') { + const app = appInstanceMap.get(to.name = formatAppName(to.name)) + if (!app) return logError(`navigation failed, the app named ${to.name} not exist`) + if (!app.sandBox) return logError(`navigation failed, the sandBox of app ${to.name} is closed`) + if (!getActiveApps().includes(to.name)) return logError(`navigation failed, the app named ${to.name} has been unmounted`) + const proxyWindow = app.sandBox.proxyWindow + const microLocation = proxyWindow.location + const currentFullPath = microLocation.pathname + microLocation.search + microLocation.hash + const targetLocation = createURL(to.path, app.url) + // Only get path data, even if the origin is different from microApp + const targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash + if (currentFullPath !== targetPath) { + proxyWindow.history[replace || to.replace ? 'replaceState' : 'pushState'](to.state ?? null, '', targetPath) + dispatchPopStateEventToMicroApp(to.name, proxyWindow, null) + } + } else { + logError('navigation failed, name & path are required') } - } else { - logError('navigation failed, name & path are required') } } -} -function createRawHistoryMethod (methodName: string): Func { - return function (...rests: unknown[]): void { - return globalEnv.rawWindow.history[methodName](...rests) + // create method of history.go/back/forward + function createRawHistoryMethod (methodName: string): Func { + return function (...rests: unknown[]): void { + return globalEnv.rawWindow.history[methodName](...rests) + } } -} -/** - * global hook for router - * update router information base on microLocation - * @param appName app name - * @param microLocation location of microApp - */ -export function executeNavigationGuard ( - appName: string, - to: GuardLocation, - from?: GuardLocation, -): void { - router.current.set(appName, to) + const beforeGuards = useCallbacks() + const afterGuards = useCallbacks() - if (from) { - alert(from) + /** + * run all of beforeEach/afterEach guards + * @param appName app name + * @param to target location + * @param from old location + * @param guards guards list + */ + function runGuards ( + appName: string, + to: GuardLocation, + from: GuardLocation, + guards: Set, + ) { + for (const guard of guards) { + if (isFunction(guard)) { + (guard as GlobalNormalGuard)(appName, to, from) + } else if (isPlainObject(guard) && isFunction((guard as AccurateGuard)[appName])) { + (guard as AccurateGuard)[appName](to, from) + } + } } -} -function registerNavigationGuard (guardName: string) { - return function (guard: routerGuard) { - if (isFunction(guard)) { - alert(guardName) - } else if (isPlainObject(guard)) { - alert(guardName) - } + /** + * global hook for router + * update router information base on microLocation + * @param appName app name + * @param microLocation location of microApp + */ + function executeNavigationGuard ( + appName: string, + to: GuardLocation, + from: GuardLocation, + ): void { + router.current.set(appName, to) + + runGuards(appName, to, from, beforeGuards.list()) + + requestIdleCallback(() => { + runGuards(appName, to, from, afterGuards.list()) + }) } -} -// Router API for developer -export const router: Router = { - current: new Map(), - encode: encodeMicroPath, - decode: decodeMicroPath, - push: createNavigationMethod(false), - replace: createNavigationMethod(true), - go: createRawHistoryMethod('go'), - back: createRawHistoryMethod('back'), - forward: createRawHistoryMethod('forward'), - beforeEach: registerNavigationGuard('beforeEach'), - afterEach: registerNavigationGuard('afterEach'), + // Router API for developer + const router: Router = { + current: new Map(), + encode: encodeMicroPath, + decode: decodeMicroPath, + push: createNavigationMethod(false), + replace: createNavigationMethod(true), + go: createRawHistoryMethod('go'), + back: createRawHistoryMethod('back'), + forward: createRawHistoryMethod('forward'), + beforeEach: beforeGuards.add, + afterEach: afterGuards.add, + } + + return { router, executeNavigationGuard } } + +export const { router, executeNavigationGuard } = createRouterApi() diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index ca631ffee..84e8c511b 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -26,7 +26,7 @@ export function addHistoryListener (appName: string): CallableFunction { let isHashChange = false // for hashChangeEvent const oldHref = proxyWindow.location.href - // Do not attach micro info to url when microPath is empty + // Do not attach micro state to url when microPath is empty if (microPath) { const oldHash = proxyWindow.location.hash updateLocation(appName, microPath, app.url, proxyWindow.location as MicroLocation) diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index a6a5d4388..79dbd5050 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -13,6 +13,7 @@ import { import { createMicroLocation, updateLocation, + autoTriggerNavigationGuard, } from './location' import { createMicroHistory, @@ -48,7 +49,7 @@ export function initRouteStateWithURL ( ): void { const microPath = getMicroPathFromURL(appName) if (microPath) { - updateLocation(appName, microPath, url, microLocation) + updateLocation(appName, microPath, url, microLocation, 'init') } else { updateBrowserURLWithLocation(appName, url, microLocation) } @@ -65,9 +66,16 @@ export function updateBrowserURLWithLocation ( ): void { const setMicroPathResult = setMicroPathToURL(appName, microLocation) updateBrowserURL( - setMicroState(appName, globalEnv.rawWindow.history.state, null, url, setMicroPathResult.searchHash), + setMicroState( + appName, + globalEnv.rawWindow.history.state, + null, + url, + setMicroPathResult.searchHash, + ), setMicroPathResult.fullPath, ) + autoTriggerNavigationGuard(appName, microLocation) } /** @@ -85,7 +93,7 @@ export function clearRouteStateFromURL ( ): void { if (!keepRouteState) { const { pathname, search, hash } = createURL(url) - updateLocation(appName, pathname + search + hash, url, microLocation) + updateLocation(appName, pathname + search + hash, url, microLocation, 'clear') } removeStateAndPathFromBrowser(appName, url) } diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index 66e1735c5..96db818eb 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -144,27 +144,19 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio } } - const assign = createLocationMethod('assign') - - const replace = createLocationMethod('replace') - - const reload = (forcedReload?: boolean): void => rawLocation.reload(forcedReload) - - oAssign(microLocation, { - assign, - replace, - reload, + return oAssign(microLocation, { + assign: createLocationMethod('assign'), + replace: createLocationMethod('replace'), + reload: (forcedReload?: boolean): void => rawLocation.reload(forcedReload), shadowLocation, }) - - executeNavigationGuard(appName, createGuardLocation(appName, microLocation)) - - return microLocation } -// origin is readonly, so we ignore it -const locationKeys: ReadonlyArray = ['href', 'pathname', 'search', 'hash', 'host', 'hostname', 'port', 'protocol', 'search'] const shadowLocationKeys: ReadonlyArray = ['href', 'pathname', 'search', 'hash'] +// origin is readonly, so we ignore when updateLocation +const locationKeys: ReadonlyArray = [...shadowLocationKeys, 'host', 'hostname', 'port', 'protocol', 'search'] +// origin is necessary for guardLocation +const guardLocationKeys: ReadonlyArray = [...locationKeys, 'origin'] /** * create guardLocation by microLocation, used for router guard @@ -172,10 +164,15 @@ const shadowLocationKeys: ReadonlyArray = ['href', 'pathname', 'searc function createGuardLocation (appName: string, microLocation: MicroLocation): GuardLocation { const guardLocation = oAssign({ name: appName }, microLocation) as GuardLocation // The prototype values on the URL needs to be manually transferred - for (const key of locationKeys) guardLocation[key] = microLocation[key] + for (const key of guardLocationKeys) guardLocation[key] = microLocation[key] return guardLocation } +// for updateBrowserURLWithLocation when initial +export function autoTriggerNavigationGuard (appName: string, microLocation: MicroLocation): void { + executeNavigationGuard(appName, createGuardLocation(appName, microLocation), createGuardLocation(appName, microLocation)) +} + /** * There are three situations that trigger location update: * 1. pushState/replaceState @@ -185,12 +182,14 @@ function createGuardLocation (appName: string, microLocation: MicroLocation): Gu * @param path target path * @param base base url * @param microLocation micro app location + * @param type init clear normal */ export function updateLocation ( appName: string, path: string, base: string, microLocation: MicroLocation, + type?: string, ): void { const newLocation = createURL(path, base) // record old values of microLocation to `from` @@ -209,10 +208,8 @@ export function updateLocation ( const to = createGuardLocation(appName, microLocation) const newFullPath = to.pathname + to.search + to.hash - // console.log(22222, oldFullPath, newFullPath) - // The hook called only when the url changes - if (oldFullPath !== newFullPath) { - // console.log(333333, to, from) - executeNavigationGuard(appName, to) + // The hook called only when fullPath changed + if (type === 'init' || (oldFullPath !== newFullPath && type !== 'clear')) { + executeNavigationGuard(appName, to, from) } } diff --git a/typings/global.d.ts b/typings/global.d.ts index 80e763f6e..6a296634f 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -255,11 +255,13 @@ declare module '@micro-app/types' { type navigationMethod = (to: RouterTarget) => void - interface accurateGuard { - [appName: string]: (to: MicroLocation, from: MicroLocation) => void + interface AccurateGuard { + [appName: string]: (to: GuardLocation, from: GuardLocation) => void } - type routerGuard = (to: GuardLocation, from: GuardLocation, appName: string) => void | accurateGuard + type GlobalNormalGuard = ((appName: string, to: GuardLocation, from: GuardLocation) => void) + + type RouterGuard = AccurateGuard | GlobalNormalGuard // Router API for developer interface Router { @@ -303,9 +305,9 @@ declare module '@micro-app/types' { * Add a navigation guard that executes before any navigation * @param guard global hook for */ - beforeEach(guard: routerGuard): void + beforeEach(guard: RouterGuard): void - afterEach(guard: routerGuard): void + afterEach(guard: RouterGuard): void } } From 4bfbe2e0939f67f13984c674f0fb6566aabb2fc6 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Thu, 16 Jun 2022 19:49:53 +0800 Subject: [PATCH 029/268] feat: add router api to child --- dev/children/react16/config/webpack.config.js | 3 +- dev/children/react16/src/pages/page1/page1.js | 14 +- dev/main-react16/src/global.jsx | 8 +- dev/main-react16/src/pages/react16/react16.js | 10 +- dev/main-vue2/src/pages/react17.vue | 2 +- package.json | 2 +- src/__tests__/main.test.ts | 2 +- src/libs/utils.ts | 3 +- src/sandbox/index.ts | 2 + src/sandbox/router/api.ts | 11 +- src/sandbox/router/core.ts | 8 +- src/sandbox/router/event.ts | 21 +- src/sandbox/router/history.ts | 21 +- src/sandbox/router/index.ts | 6 +- src/sandbox/router/location.ts | 267 +++++++++--------- 15 files changed, 213 insertions(+), 167 deletions(-) diff --git a/dev/children/react16/config/webpack.config.js b/dev/children/react16/config/webpack.config.js index a5a6d3aad..3755f448d 100644 --- a/dev/children/react16/config/webpack.config.js +++ b/dev/children/react16/config/webpack.config.js @@ -233,7 +233,8 @@ module.exports = function (webpackEnv) { globalObject: 'window', // library: 'react', // 请求确保每个子应用该值都不相同,否则可能出现 webpack chunk 互相影响的可能 - jsonpFunction: 'vue-app-jsonpFunction', // webpack 5 不用配置该参数, webpack 5 将会直接使用 package.json name 作为唯一值,请确保应用间的 name 各不相同 + // jsonpFunction: 'vue-app-jsonpFunction', // webpack 5 不用配置该参数, webpack 5 将会直接使用 + jsonpFunction: `webpackJsonp-${appPackageJson.name}`, // package.json name 作为唯一值,请确保应用间的 name 各不相同 // 保证子应用的资源路径变为绝对路径,避免子应用的相对资源在变为主应用上的相对资源,因为子应用和主应用在同一个文档流,相对路径是相对于主应用而言的 // publicPath: 'http://localhost:3001', diff --git a/dev/children/react16/src/pages/page1/page1.js b/dev/children/react16/src/pages/page1/page1.js index 6a03bc9ba..0bd246b11 100644 --- a/dev/children/react16/src/pages/page1/page1.js +++ b/dev/children/react16/src/pages/page1/page1.js @@ -48,6 +48,10 @@ function download (e) { } } +function controlVue22Nav (path) { + window.microApp.router.push({name: 'vue22', path}) +} + function Page1() { return ( @@ -91,7 +95,15 @@ function Page1() {

styled-component👇

按钮
- 下载 +
+ 下载 +
+
+ 控制子应用vue22跳转home +
+
+ 控制子应用vue22跳转page2 +
); } diff --git a/dev/main-react16/src/global.jsx b/dev/main-react16/src/global.jsx index 2d698667b..e134b17c3 100644 --- a/dev/main-react16/src/global.jsx +++ b/dev/main-react16/src/global.jsx @@ -49,10 +49,10 @@ microApp.start({ { loader (code) { code = ` - window.__micro_app_environment__ = window.__MICRO_APP_ENVIRONMENT__ - window.__micro_app_name__ = window.__MICRO_APP_NAME__ - window.__full_public_path__ = window.__MICRO_APP_PUBLIC_PATH__ - window.baseurl = window.__MICRO_APP_BASE_ROUTE__ + window.__micro_app_environment__ = window.__MICRO_APP_ENVIRONMENT__; + window.__micro_app_name__ = window.__MICRO_APP_NAME__; + window.__full_public_path__ = window.__MICRO_APP_PUBLIC_PATH__; + window.baseurl = window.__MICRO_APP_BASE_ROUTE__; ;${code} ` return code diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index 86304da2a..88c7aa9a8 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -205,10 +205,10 @@ export default class App extends React.Component { componentWillUnmount () { microApp.clearDataListener(this.state.name) microApp.removeGlobalDataListener(this.handleGlobalDataForBaseApp) - this.releaseBeforeEach1() - this.releaseBeforeEach2() - this.releaseAfterEach1() - this.releaseAfterEach2() + this.releaseBeforeEach1?.() + this.releaseBeforeEach2?.() + this.releaseAfterEach1?.() + this.releaseAfterEach2?.() } render () { @@ -255,7 +255,7 @@ export default class App extends React.Component { // destroy keep-route-state // disable-memory-router - // inline + inline // disableSandbox // disable-sandbox // disableScopecss diff --git a/dev/main-vue2/src/pages/react17.vue b/dev/main-vue2/src/pages/react17.vue index bb84c92a7..5bfc47238 100644 --- a/dev/main-vue2/src/pages/react17.vue +++ b/dev/main-vue2/src/pages/react17.vue @@ -2,7 +2,7 @@
diff --git a/package.json b/package.json index 59981f13a..602653350 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@micro-zoe/micro-app", - "version": "0.8.5", + "version": "1.0.0-beta.0", "description": "A lightweight, efficient and powerful micro front-end framework", "private": false, "main": "lib/index.min.js", diff --git a/src/__tests__/main.test.ts b/src/__tests__/main.test.ts index a751473cb..154e75d66 100644 --- a/src/__tests__/main.test.ts +++ b/src/__tests__/main.test.ts @@ -177,7 +177,7 @@ describe('main process', () => { * ] */ test('render an unstable app with special attribute', async () => { - const microAppElement3 = document.createElement('micro-app') + const microAppElement3 = document.createElement('micro-app') as any expect(microAppElement3.data).toBeNull() // @ts-ignore microAppElement3.setAttribute('data', { count: 'count-1' }) diff --git a/src/libs/utils.ts b/src/libs/utils.ts index fc34ce1e2..7dc0c0cf6 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -443,8 +443,7 @@ export function stringifyQuery (queryObject: LocationQueryObject): string { export const noop = () => {} /** - * Create a list of callbacks that can be reset. - * Used to create before and after navigation guards list + * Register or unregister callback functions */ export function useCallbacks () { const handlers: Set = new Set() diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 7e666c2de..2c841e933 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -44,6 +44,7 @@ import createMicroRouter, { addHistoryListener, removeStateAndPathFromBrowser, updateBrowserURLWithLocation, + router, } from './router' export type MicroAppWindowDataType = { @@ -335,6 +336,7 @@ export default class SandBox implements SandBoxInterface { microAppWindow.microApp = assign(new EventCenterForMicroApp(appName), { removeDomScope, pureCreateElement, + router, }) microAppWindow.rawWindow = globalEnv.rawWindow microAppWindow.rawDocument = globalEnv.rawDocument diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index f40c4a3ec..c02583846 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -34,9 +34,12 @@ export interface RouterApi { function createRouterApi (): RouterApi { /** - * path需要注意的是两点:1、子应用的base也要加上 2、对于hash路由,要带上hash,如果开发者不知道具体地址如何写,那么单独运行子应用,跳转到对应的页面,复制浏览器地址 - * path 为子应用除域名外的全量地址(可以带上域名) - * 相同的地址是否需要继续跳转??? + * create method of router.push/replace + * NOTE: + * 1. The same fullPath will be blocked + * 2. name & path is required + * 3. path is fullPath except for the domain (the domain can be taken, but not valid) + * @param replace use router.replace? */ function createNavigationMethod (replace: boolean): navigationMethod { return function (to: RouterTarget): void { @@ -61,7 +64,7 @@ function createRouterApi (): RouterApi { } } - // create method of history.go/back/forward + // create method of router.go/back/forward function createRawHistoryMethod (methodName: string): Func { return function (...rests: unknown[]): void { return globalEnv.rawWindow.history[methodName](...rests) diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts index 9bdfdf9a1..ee6798aad 100644 --- a/src/sandbox/router/core.ts +++ b/src/sandbox/router/core.ts @@ -106,7 +106,7 @@ export function getMicroPathFromURL (appName: string): string | null { type setMicroPathResult = { fullPath: string, searchHash: string, - attach2Hash: boolean, + isAttach2Hash: boolean, } // 将name=encodeUrl地址插入到浏览器url上 @@ -119,10 +119,10 @@ export function setMicroPathToURL (appName: string, microLocation: MicroLocation microLocation.hash ) - let attach2Hash = false // 基座是否是hash模式,这个其实也不准,只是表示参数加到了hash上 + let isAttach2Hash = false // 基座是否是hash模式,这个其实也不准,只是表示参数加到了hash上 // hash存在且search不存在,则认为是hash路由 if (hash && !search) { - attach2Hash = true + isAttach2Hash = true if (queryObject.hashQuery) { queryObject.hashQuery[formatQueryAppName(appName)] = encodedMicroPath } else { @@ -146,7 +146,7 @@ export function setMicroPathToURL (appName: string, microLocation: MicroLocation return { fullPath: pathname + search + hash, searchHash: search + hash, - attach2Hash, + isAttach2Hash, } } diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index 84e8c511b..00509cfac 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -3,7 +3,7 @@ import { appInstanceMap } from '../../create_app' import { getActiveApps } from '../../micro_app' import { formatEventName } from '../effect' import { getMicroPathFromURL, getMicroState } from './core' -import { updateLocation } from './location' +import { updateMicroLocation } from './location' import globalEnv from '../../libs/global_env' type PopStateListener = (this: Window, e: PopStateEvent) => void @@ -29,7 +29,7 @@ export function addHistoryListener (appName: string): CallableFunction { // Do not attach micro state to url when microPath is empty if (microPath) { const oldHash = proxyWindow.location.hash - updateLocation(appName, microPath, app.url, proxyWindow.location as MicroLocation) + updateMicroLocation(appName, microPath, app.url, proxyWindow.location as MicroLocation) isHashChange = proxyWindow.location.hash !== oldHash } @@ -49,6 +49,12 @@ export function addHistoryListener (appName: string): CallableFunction { } } +/** + * dispatch formatted popstate event to microApp + * @param appName app name + * @param proxyWindow sandbox window + * @param eventState history.state + */ export function dispatchPopStateEventToMicroApp ( appName: string, proxyWindow: WindowProxy, @@ -66,6 +72,12 @@ export function dispatchPopStateEventToMicroApp ( typeof proxyWindow.onpopstate === 'function' && proxyWindow.onpopstate(newPopStateEvent) } +/** + * dispatch formatted hashchange event to microApp + * @param appName app name + * @param proxyWindow sandbox window + * @param oldHref old href + */ export function dispatchHashChangeEventToMicroApp ( appName: string, proxyWindow: WindowProxy, @@ -86,9 +98,8 @@ export function dispatchHashChangeEventToMicroApp ( } /** - * dispatch pure PopStateEvent - * simulate location behavior + * dispatch native PopStateEvent, simulate location behavior */ -export function dispatchPurePopStateEvent (): void { +export function dispatchNativePopStateEvent (): void { globalEnv.rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) } diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 8f5b743be..557a95955 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -6,7 +6,7 @@ import type { } from '@micro-app/types' import globalEnv from '../../libs/global_env' import { isString, logError, createURL } from '../../libs/utils' -import { updateLocation } from './location' +import { updateMicroLocation } from './location' import { setMicroPathToURL, setMicroState, getMicroState } from './core' // history of micro app @@ -40,7 +40,7 @@ export function createMicroHistory ( rawHistory[methodName].apply(rawHistory, rests) - if (targetPath) updateLocation(appName, targetPath, base, microLocation) + if (targetPath) updateMicroLocation(appName, targetPath, base, microLocation) // console.log(5555555, microLocation, base) } @@ -61,7 +61,20 @@ export function createMicroHistory ( }) } -// update browser url when child app mount/unmount +/** + * update browser url base on child location + * @param state history.state + * @param fullPath full path + */ export function updateBrowserURL (state: MicroState, fullPath: string): void { - globalEnv.rawWindow.history.replaceState(state, null, fullPath) + globalEnv.rawWindow.history.replaceState(state, '', fullPath) +} + +/** + * navigate to new path base on native method of history + * @param methodName pushState/replaceState + * @param fullPath full path + */ +export function nativeHistoryNavigate (methodName: string, fullPath: string): void { + globalEnv.rawWindow.history[methodName](null, '', fullPath) } diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index 79dbd5050..a08d641e5 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -12,7 +12,7 @@ import { } from './core' import { createMicroLocation, - updateLocation, + updateMicroLocation, autoTriggerNavigationGuard, } from './location' import { @@ -49,7 +49,7 @@ export function initRouteStateWithURL ( ): void { const microPath = getMicroPathFromURL(appName) if (microPath) { - updateLocation(appName, microPath, url, microLocation, 'init') + updateMicroLocation(appName, microPath, url, microLocation, 'init') } else { updateBrowserURLWithLocation(appName, url, microLocation) } @@ -93,7 +93,7 @@ export function clearRouteStateFromURL ( ): void { if (!keepRouteState) { const { pathname, search, hash } = createURL(url) - updateLocation(appName, pathname + search + hash, url, microLocation, 'clear') + updateMicroLocation(appName, pathname + search + hash, url, microLocation, 'clear') } removeStateAndPathFromBrowser(appName, url) } diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index 96db818eb..37e43baca 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -3,8 +3,71 @@ import type { MicroLocation, GuardLocation, ShadowLocation } from '@micro-app/ty import globalEnv from '../../libs/global_env' import { assign as oAssign, rawDefineProperties, createURL } from '../../libs/utils' import { setMicroPathToURL } from './core' -import { dispatchPurePopStateEvent } from './event' +import { dispatchNativePopStateEvent } from './event' import { executeNavigationGuard } from './api' +import { nativeHistoryNavigate } from './history' + +const shadowLocationKeys: ReadonlyArray = ['href', 'pathname', 'search', 'hash'] +// origin is readonly, so we ignore when updateMicroLocation +const locationKeys: ReadonlyArray = [...shadowLocationKeys, 'host', 'hostname', 'port', 'protocol', 'search'] +// origin is necessary for guardLocation +const guardLocationKeys: ReadonlyArray = [...locationKeys, 'origin'] + +/** + * create guardLocation by microLocation, used for router guard + */ +function createGuardLocation (appName: string, microLocation: MicroLocation): GuardLocation { + const guardLocation = oAssign({ name: appName }, microLocation) as GuardLocation + // The prototype values on the URL needs to be manually transferred + for (const key of guardLocationKeys) guardLocation[key] = microLocation[key] + return guardLocation +} + +// for updateBrowserURLWithLocation when initial +export function autoTriggerNavigationGuard (appName: string, microLocation: MicroLocation): void { + executeNavigationGuard(appName, createGuardLocation(appName, microLocation), createGuardLocation(appName, microLocation)) +} + +/** + * There are three situations that trigger location update: + * 1. pushState/replaceState + * 2. popStateEvent + * 3. params on browser url when init sub app + * @param appName app name + * @param path target path + * @param base base url + * @param microLocation micro app location + * @param type init clear normal + */ +export function updateMicroLocation ( + appName: string, + path: string, + base: string, + microLocation: MicroLocation, + type?: string, +): void { + const newLocation = createURL(path, base) + // record old values of microLocation to `from` + const from = createGuardLocation(appName, microLocation) + const oldFullPath = from.pathname + from.search + from.hash + for (const key of locationKeys) { + if (shadowLocationKeys.includes(key)) { + // reference of shadowLocation + microLocation.shadowLocation[key] = newLocation[key] as string + } else { + // @ts-ignore reference of microLocation + microLocation[key] = newLocation[key] + } + } + // update latest values of microLocation to `to` + const to = createGuardLocation(appName, microLocation) + const newFullPath = to.pathname + to.search + to.hash + + // The hook called only when fullPath changed + if (type === 'init' || (oldFullPath !== newFullPath && type !== 'clear')) { + executeNavigationGuard(appName, to, from) + } +} /** * Create location for micro app @@ -32,12 +95,13 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio * @param methodName pushState/replaceState * @returns origin value or formatted value */ - const commonHandle = (value: string | URL, methodName: string): string | URL | undefined => { + const commonHandler = (value: string | URL, methodName: string): string | URL | undefined => { const targetLocation = createURL(value, url) + // Even if the origin is the same, developers still have the possibility of want to jump to a new page if (targetLocation.origin === microLocation.origin) { const setMicroPathResult = setMicroPathToURL(appName, targetLocation) /** - * change hash with location.href = xxx will not trigger the browser reload + * change hash with location.href will not trigger the browser reload * so we use pushState & reload to imitate href behavior * NOTE: * 1. if child app only change hash, it should not trigger browser reload @@ -48,17 +112,21 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio targetLocation.search === shadowLocation.search ) { if (targetLocation.hash !== shadowLocation.hash) { - rawWindow.history[methodName](null, '', setMicroPathResult.fullPath) + nativeHistoryNavigate(methodName, setMicroPathResult.fullPath) } if (targetLocation.hash) { - dispatchPurePopStateEvent() + dispatchNativePopStateEvent() } else { rawLocation.reload() } return void 0 - } else if (setMicroPathResult.attach2Hash) { - rawWindow.history[methodName](null, '', setMicroPathResult.fullPath) + /** + * when baseApp is hash router, address change of child can not reload browser + * so we imitate behavior of browser (reload) + */ + } else if (setMicroPathResult.isAttach2Hash) { + nativeHistoryNavigate(methodName, setMicroPathResult.fullPath) rawLocation.reload() return void 0 } @@ -69,78 +137,77 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio return value } + /** + * create location PropertyDescriptor (href, pathname, search, hash) + * @param key property name + * @param setter setter of location property + */ + function createPropertyDescriptor (key: string, setter: (v: string) => void): PropertyDescriptor { + return { + enumerable: true, + configurable: true, + get: (): string => shadowLocation[key], + set: setter, + } + } + + /** + * common handler for location.pathname & location.search + * @param targetPath target fullPath + * @param key pathname/search + */ + function handleForPathNameAndSearch (targetPath: string, key: string) { + const targetLocation = createURL(targetPath, url) + // When the browser url has a hash value, the same pathname/search will not refresh browser + if (targetLocation[key] === shadowLocation[key] && shadowLocation.hash) { + dispatchNativePopStateEvent() + } else { + /** + * When the value is the same, no new route stack will be added + * Special scenes such as: + * pathname: /path ==> /path#hash, /path ==> /path?query + * search: ?query ==> ?query#hash + */ + nativeHistoryNavigate( + targetLocation[key] === shadowLocation[key] ? 'replaceState' : 'pushState', + setMicroPathToURL(appName, targetLocation).fullPath, + ) + rawLocation.reload() + } + } + /** * Special processing for four keys: href, pathname, search and hash * They take values from shadowLocation, and require special operations when assigning values */ rawDefineProperties(microLocation, { - href: { - enumerable: true, - configurable: true, - get: (): string => shadowLocation.href, - set: (value: string): void => { - const formattedValue = commonHandle(value, 'pushState') - if (formattedValue) rawLocation.href = formattedValue - } - }, - pathname: { - enumerable: true, - configurable: true, - get: (): string => shadowLocation.pathname, - set: (value: string): void => { - const targetPath = ('/' + value).replace(/^\/+/, '/') + shadowLocation.search + shadowLocation.hash - const targetLocation = createURL(targetPath, url) - // When the browser url has a hash value, the same pathname will not trigger the browser refresh - if (targetLocation.pathname === shadowLocation.pathname && shadowLocation.hash) { - dispatchPurePopStateEvent() - } else { - // When the value is the same, no new route stack will be added - // Special scenes such as: /path ==> /path#hash, /path ==> /path?query - const methodName = targetLocation.pathname === shadowLocation.pathname ? 'replaceState' : 'pushState' - rawWindow.history[methodName](null, '', setMicroPathToURL(appName, targetLocation).fullPath) - rawLocation.reload() - } - } - }, - search: { - enumerable: true, - configurable: true, - get: (): string => shadowLocation.search, - set: (value: string): void => { - const targetPath = shadowLocation.pathname + ('?' + value).replace(/^\?+/, '?') + shadowLocation.hash - const targetLocation = createURL(targetPath, url) - // When the browser url has a hash value, the same search will not trigger the browser refresh - if (targetLocation.search === shadowLocation.search && shadowLocation.hash) { - dispatchPurePopStateEvent() - } else { - // When the value is the same, no new route stack will be added - // Special scenes such as: ?query ==> ?query#hash - const methodName = targetLocation.search === shadowLocation.search ? 'replaceState' : 'pushState' - rawWindow.history[methodName](null, '', setMicroPathToURL(appName, targetLocation).fullPath) - rawLocation.reload() - } - } - }, - hash: { - enumerable: true, - configurable: true, - get: (): string => shadowLocation.hash, - set: (value: string): void => { - const targetPath = shadowLocation.pathname + shadowLocation.search + ('#' + value).replace(/^#+/, '#') - const targetLocation = createURL(targetPath, url) - // The same hash will not trigger popStateEvent - if (targetLocation.hash !== shadowLocation.hash) { - rawWindow.history.pushState(null, '', setMicroPathToURL(appName, targetLocation).fullPath) - dispatchPurePopStateEvent() - } + href: createPropertyDescriptor('href', (value: string): void => { + const targetPath = commonHandler(value, 'pushState') + if (targetPath) rawLocation.href = targetPath + }), + pathname: createPropertyDescriptor('pathname', (value: string): void => { + const targetPath = ('/' + value).replace(/^\/+/, '/') + shadowLocation.search + shadowLocation.hash + handleForPathNameAndSearch(targetPath, 'pathname') + }), + search: createPropertyDescriptor('search', (value: string): void => { + const targetPath = shadowLocation.pathname + ('?' + value).replace(/^\?+/, '?') + shadowLocation.hash + handleForPathNameAndSearch(targetPath, 'search') + }), + hash: createPropertyDescriptor('hash', (value: string): void => { + const targetPath = shadowLocation.pathname + shadowLocation.search + ('#' + value).replace(/^#+/, '#') + const targetLocation = createURL(targetPath, url) + // The same hash will not trigger popStateEvent + if (targetLocation.hash !== shadowLocation.hash) { + nativeHistoryNavigate('pushState', setMicroPathToURL(appName, targetLocation).fullPath) + dispatchNativePopStateEvent() } - }, + }), }) const createLocationMethod = (locationMethodName: string) => { return function (value: string | URL) { - const formattedValue = commonHandle(value, locationMethodName === 'assign' ? 'pushState' : 'replaceState') - if (formattedValue) rawLocation[locationMethodName](formattedValue) + const targetPath = commonHandler(value, locationMethodName === 'assign' ? 'pushState' : 'replaceState') + if (targetPath) rawLocation[locationMethodName](targetPath) } } @@ -151,65 +218,3 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio shadowLocation, }) } - -const shadowLocationKeys: ReadonlyArray = ['href', 'pathname', 'search', 'hash'] -// origin is readonly, so we ignore when updateLocation -const locationKeys: ReadonlyArray = [...shadowLocationKeys, 'host', 'hostname', 'port', 'protocol', 'search'] -// origin is necessary for guardLocation -const guardLocationKeys: ReadonlyArray = [...locationKeys, 'origin'] - -/** - * create guardLocation by microLocation, used for router guard - */ -function createGuardLocation (appName: string, microLocation: MicroLocation): GuardLocation { - const guardLocation = oAssign({ name: appName }, microLocation) as GuardLocation - // The prototype values on the URL needs to be manually transferred - for (const key of guardLocationKeys) guardLocation[key] = microLocation[key] - return guardLocation -} - -// for updateBrowserURLWithLocation when initial -export function autoTriggerNavigationGuard (appName: string, microLocation: MicroLocation): void { - executeNavigationGuard(appName, createGuardLocation(appName, microLocation), createGuardLocation(appName, microLocation)) -} - -/** - * There are three situations that trigger location update: - * 1. pushState/replaceState - * 2. popStateEvent - * 3. params on browser url when init sub app - * @param appName app name - * @param path target path - * @param base base url - * @param microLocation micro app location - * @param type init clear normal - */ -export function updateLocation ( - appName: string, - path: string, - base: string, - microLocation: MicroLocation, - type?: string, -): void { - const newLocation = createURL(path, base) - // record old values of microLocation to `from` - const from = createGuardLocation(appName, microLocation) - const oldFullPath = from.pathname + from.search + from.hash - for (const key of locationKeys) { - if (shadowLocationKeys.includes(key)) { - // reference of shadowLocation - microLocation.shadowLocation[key] = newLocation[key] as string - } else { - // @ts-ignore reference of microLocation - microLocation[key] = newLocation[key] - } - } - // update latest values of microLocation to `to` - const to = createGuardLocation(appName, microLocation) - const newFullPath = to.pathname + to.search + to.hash - - // The hook called only when fullPath changed - if (type === 'init' || (oldFullPath !== newFullPath && type !== 'clear')) { - executeNavigationGuard(appName, to, from) - } -} From 4db512243db41ce79ed8d7d124bf5ca175d765a3 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Fri, 17 Jun 2022 20:57:32 +0800 Subject: [PATCH 030/268] fix: fix bug of ssr in memory-router --- README.md | 6 +- README.zh-cn.md | 7 +- dev/main-react16/src/pages/react16/react16.js | 2 +- src/interact/event_center.ts | 2 +- src/libs/utils.ts | 35 ++++----- src/micro_app.ts | 2 +- src/micro_app_element.ts | 34 +++++---- src/prefetch.ts | 2 +- src/sandbox/index.ts | 9 ++- src/sandbox/router/api.ts | 76 ++++++++++++++----- src/sandbox/router/core.ts | 10 +++ src/sandbox/router/history.ts | 16 ++-- src/sandbox/router/index.ts | 9 ++- src/source/patch.ts | 11 ++- src/source/scripts.ts | 4 +- typings/global.d.ts | 2 + 16 files changed, 144 insertions(+), 83 deletions(-) diff --git a/README.md b/README.md index 1877b55c5..54326b80f 100644 --- a/README.md +++ b/README.md @@ -152,9 +152,9 @@ For more commands, see [DEVELOP](https://github.com/micro-zoe/micro-app/blob/mas # Contributors - - - + + + # License [MIT License](https://github.com/micro-zoe/micro-app/blob/master/LICENSE) diff --git a/README.zh-cn.md b/README.zh-cn.md index 55910593e..6eb5e7647 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -153,9 +153,10 @@ yarn start # 访问 http://localhost:3000 # 贡献者们 - - - + + + + # License [MIT License](https://github.com/micro-zoe/micro-app/blob/master/LICENSE) diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index 88c7aa9a8..96970ebb9 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -253,7 +253,7 @@ export default class App extends React.Component { baseRoute='/micro-app/demo/react16' // keep-alive // destroy - keep-route-state + keep-router-state // disable-memory-router inline // disableSandbox diff --git a/src/interact/event_center.ts b/src/interact/event_center.ts index d5b163405..87e0b1e42 100755 --- a/src/interact/event_center.ts +++ b/src/interact/event_center.ts @@ -51,7 +51,7 @@ export default class EventCenter { const eventInfo = this.eventList.get(name) if (eventInfo) { if (isFunction(f)) { - eventInfo.callbacks.delete(f!) + eventInfo.callbacks.delete(f) } else { eventInfo.callbacks.clear() } diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 7dc0c0cf6..a2debc871 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -17,6 +17,16 @@ export const globalThis = (typeof global !== 'undefined') ) ) +// Array.isArray +export const isArray = Array.isArray +// Object.assign +export const assign = Object.assign + +// Object prototype methods +export const rawDefineProperty = Object.defineProperty +export const rawDefineProperties = Object.defineProperties +export const rawHasOwnProperty = Object.prototype.hasOwnProperty + // is Undefined export function isUndefined (target: unknown): target is undefined { return target === undefined @@ -38,39 +48,30 @@ export function isBoolean (target: unknown): target is boolean { } // is function -export function isFunction (target: unknown): boolean { +export function isFunction (target: unknown): target is Function { return typeof target === 'function' } -// is Array -export const isArray = Array.isArray -export const assign = Object.assign - // is PlainObject -export function isPlainObject (target: unknown): boolean { +export function isPlainObject (target: unknown): target is Record { return toString.call(target) === '[object Object]' } // is Promise -export function isPromise (target: unknown): boolean { +export function isPromise (target: unknown): target is Promise { return toString.call(target) === '[object Promise]' } // is bind function -export function isBoundFunction (target: any): boolean { +export function isBoundFunction (target: unknown): target is Function { return isFunction(target) && target.name.indexOf('bound ') === 0 && !target.hasOwnProperty('prototype') } // is ShadowRoot -export function isShadowRoot (target: unknown): boolean { +export function isShadowRoot (target: unknown): target is ShadowRoot { return typeof ShadowRoot !== 'undefined' && target instanceof ShadowRoot } -export const rawDefineProperty = Object.defineProperty - -export const rawDefineProperties = Object.defineProperties -export const rawHasOwnProperty = Object.prototype.hasOwnProperty - /** * format error log * @param msg message @@ -79,7 +80,7 @@ export const rawHasOwnProperty = Object.prototype.hasOwnProperty export function logError ( msg: unknown, appName: string | null = null, - ...rest: any[] + ...rest: unknown[] ): void { const appNameTip = appName && isString(appName) ? ` app ${appName}:` : '' if (isString(msg)) { @@ -97,7 +98,7 @@ export function logError ( export function logWarn ( msg: unknown, appName: string | null = null, - ...rest: any[] + ...rest: unknown[] ): void { const appNameTip = appName && isString(appName) ? ` app ${appName}:` : '' if (isString(msg)) { @@ -112,7 +113,7 @@ export function logWarn ( * @param fn callback * @param args params */ -export function defer (fn: Func, ...args: any[]): void { +export function defer (fn: Func, ...args: unknown[]): void { Promise.resolve().then(fn.bind(null, ...args)) } diff --git a/src/micro_app.ts b/src/micro_app.ts index 7e44b54ac..31e1752ea 100644 --- a/src/micro_app.ts +++ b/src/micro_app.ts @@ -190,7 +190,7 @@ export class MicroApp extends EventCenterForBaseApp implements MicroAppConfigTyp options.globalAssets && getGlobalAssets(options.globalAssets) if (isPlainObject(options.plugins)) { - const modules = options.plugins!.modules + const modules = options.plugins.modules if (isPlainObject(modules)) { for (const appName in modules) { const formattedAppName = formatAppName(appName) diff --git a/src/micro_app_element.ts b/src/micro_app_element.ts index 5dec7929c..1693d728f 100644 --- a/src/micro_app_element.ts +++ b/src/micro_app_element.ts @@ -21,6 +21,7 @@ import { patchSetAttribute } from './source/patch' import microApp from './micro_app' import dispatchLifecyclesEvent from './interact/lifecycles_event' import globalEnv from './libs/global_env' +import { getNoHashMicroPathFromURL } from './sandbox' /** * define element @@ -136,11 +137,7 @@ export function defineElement (tagName: string): void { this.attachShadow({ mode: 'open' }) } - if (this.getDisposeResult('ssr')) { - this.ssrUrl = CompletionPath(globalEnv.rawWindow.location.pathname, this.appUrl) - } else if (this.ssrUrl) { - this.ssrUrl = '' - } + this.updateSsrUrl(this.appUrl) if (appInstanceMap.has(this.appName)) { const app = appInstanceMap.get(this.appName)! @@ -224,14 +221,9 @@ export function defineElement (tagName: string): void { existApp: AppInterface | undefined, ): void { /** - * change ssrUrl in ssr mode * do not add judgment of formatAttrUrl === this.appUrl */ - if (this.getDisposeResult('ssr')) { - this.ssrUrl = CompletionPath(globalEnv.rawWindow.location.pathname, formatAttrUrl) - } else if (this.ssrUrl) { - this.ssrUrl = '' - } + this.updateSsrUrl(formatAttrUrl) this.appName = formatAttrName this.appUrl = formatAttrUrl @@ -295,7 +287,7 @@ export function defineElement (tagName: string): void { this.shadowRoot ?? this, this.getDisposeResult('inline'), this.getBaseRouteCompatible(), - this.getDisposeResult('keep-route-state'), + this.getDisposeResult('keep-router-state'), )) } @@ -319,7 +311,7 @@ export function defineElement (tagName: string): void { useSandbox: !this.getDisposeResult('disableSandbox'), useMemoryRouter: !this.getDisposeResult('disable-memory-router'), baseroute: this.getBaseRouteCompatible(), - keepRouteState: this.getDisposeResult('keep-route-state'), + keepRouteState: this.getDisposeResult('keep-router-state'), }) appInstanceMap.set(this.appName, instance) @@ -409,6 +401,22 @@ export function defineElement (tagName: string): void { return this.getDisposeResult('keep-alive') && !this.getDestroyCompatibleResult() } + /** + * change ssrUrl in ssr mode + */ + private updateSsrUrl (baseUrl: string): void { + if (this.getDisposeResult('ssr')) { + if (this.getDisposeResult('disable-memory-router')) { + const rawLocation = globalEnv.rawWindow.location + this.ssrUrl = CompletionPath(rawLocation.pathname + rawLocation.search, baseUrl) + } else { + this.ssrUrl = getNoHashMicroPathFromURL(this.appName, baseUrl) + } + } else if (this.ssrUrl) { + this.ssrUrl = '' + } + } + /** * Data from the base application */ diff --git a/src/prefetch.ts b/src/prefetch.ts index faec93ffa..3bbce3cd0 100644 --- a/src/prefetch.ts +++ b/src/prefetch.ts @@ -38,7 +38,7 @@ export default function preFetch (apps: prefetchParamList): void { return logError('preFetch is only supported in browser environment') } requestIdleCallback(() => { - isFunction(apps) && (apps = (apps as Function)()) + isFunction(apps) && (apps = apps()) if (isArray(apps)) { apps.reduce((pre, next) => pre.then(() => preFetchInSerial(next)), Promise.resolve()) diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 2c841e933..fa7440c34 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -46,6 +46,7 @@ import createMicroRouter, { updateBrowserURLWithLocation, router, } from './router' +export { getNoHashMicroPathFromURL } from './router' export type MicroAppWindowDataType = { __MICRO_APP_ENVIRONMENT__: boolean @@ -192,8 +193,8 @@ export default class SandBox implements SandBoxInterface { private getSpecialProperties (appName: string): void { if (!isPlainObject(microApp.plugins)) return - this.commonActionForSpecialProperties(microApp.plugins!.global) - this.commonActionForSpecialProperties(microApp.plugins!.modules?.[appName]) + this.commonActionForSpecialProperties(microApp.plugins.global) + this.commonActionForSpecialProperties(microApp.plugins.modules?.[appName]) } // common action for global plugins and module plugins @@ -202,10 +203,10 @@ export default class SandBox implements SandBoxInterface { for (const plugin of plugins) { if (isPlainObject(plugin)) { if (isArray(plugin.scopeProperties)) { - this.scopeProperties = this.scopeProperties.concat(plugin.scopeProperties!) + this.scopeProperties = this.scopeProperties.concat(plugin.scopeProperties) } if (isArray(plugin.escapeProperties)) { - this.escapeProperties = this.escapeProperties.concat(plugin.escapeProperties!) + this.escapeProperties = this.escapeProperties.concat(plugin.escapeProperties) } } } diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index c02583846..3d4a2cf55 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -7,11 +7,11 @@ import type { RouterGuard, GuardLocation, AccurateGuard, - GlobalNormalGuard, } from '@micro-app/types' import { encodeMicroPath, decodeMicroPath, + setMicroPathToURL, setMicroState, getMicroPathFromURL } from './core' import { logError, @@ -21,15 +21,19 @@ import { isPlainObject, useCallbacks, requestIdleCallback, + isString, } from '../../libs/utils' import { appInstanceMap } from '../../create_app' import { getActiveApps } from '../../micro_app' import { dispatchPopStateEventToMicroApp } from './event' import globalEnv from '../../libs/global_env' +import { nativeHistoryNavigate } from './history' + export interface RouterApi { router: Router, executeNavigationGuard: (appName: string, to: GuardLocation, from: GuardLocation) => void + clearCurrentWhenUnmount: (appName: string) => void } function createRouterApi (): RouterApi { @@ -43,23 +47,48 @@ function createRouterApi (): RouterApi { */ function createNavigationMethod (replace: boolean): navigationMethod { return function (to: RouterTarget): void { - if (typeof to?.name === 'string' && typeof to.path === 'string') { - const app = appInstanceMap.get(to.name = formatAppName(to.name)) - if (!app) return logError(`navigation failed, the app named ${to.name} not exist`) - if (!app.sandBox) return logError(`navigation failed, the sandBox of app ${to.name} is closed`) - if (!getActiveApps().includes(to.name)) return logError(`navigation failed, the app named ${to.name} has been unmounted`) - const proxyWindow = app.sandBox.proxyWindow - const microLocation = proxyWindow.location - const currentFullPath = microLocation.pathname + microLocation.search + microLocation.hash - const targetLocation = createURL(to.path, app.url) - // Only get path data, even if the origin is different from microApp - const targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash - if (currentFullPath !== targetPath) { - proxyWindow.history[replace || to.replace ? 'replaceState' : 'pushState'](to.state ?? null, '', targetPath) - dispatchPopStateEventToMicroApp(to.name, proxyWindow, null) + const appName = formatAppName(to.name) + if (appName && isString(to.path)) { + const app = appInstanceMap.get(appName) + if (app && !app.sandBox) return logError(`navigation failed, sandBox of app ${appName} is closed`) + // active apps, include hidden keep-alive + if (getActiveApps().includes(appName)) { + const proxyWindow = app!.sandBox!.proxyWindow + const microLocation = proxyWindow.location + const currentFullPath = microLocation.pathname + microLocation.search + microLocation.hash + const targetLocation = createURL(to.path, app!.url) + // Only get path data, even if the origin is different from microApp + const targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash + if (currentFullPath !== targetPath) { + const methodName = (replace && to.replace !== false) || to.replace === true ? 'replaceState' : 'pushState' + proxyWindow.history[methodName](to.state ?? null, '', targetPath) + dispatchPopStateEventToMicroApp(appName, proxyWindow, null) + } + } else { + /** + * app not exit or unmounted, update browser URL with replaceState + * + * use base app location.origin as baseURL + */ + const targetLocation = createURL(to.path, location.origin) + const targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash + if (getMicroPathFromURL(appName) !== targetPath) { + const setMicroPathResult = setMicroPathToURL(appName, targetLocation) + nativeHistoryNavigate( + to.replace === false ? 'pushState' : 'replaceState', + setMicroPathResult.fullPath, + setMicroState( + appName, + globalEnv.rawWindow.history.state, + to.state ?? null, + location.origin, + setMicroPathResult.searchHash, + ), + ) + } } } else { - logError('navigation failed, name & path are required') + logError(`navigation failed, name & path are required when use router.${replace ? 'replace' : 'push'}`) } } } @@ -89,9 +118,9 @@ function createRouterApi (): RouterApi { ) { for (const guard of guards) { if (isFunction(guard)) { - (guard as GlobalNormalGuard)(appName, to, from) + guard(appName, to, from) } else if (isPlainObject(guard) && isFunction((guard as AccurateGuard)[appName])) { - (guard as AccurateGuard)[appName](to, from) + guard[appName](to, from) } } } @@ -116,6 +145,10 @@ function createRouterApi (): RouterApi { }) } + function clearCurrentWhenUnmount (appName: string): void { + router.current.delete(appName) + } + // Router API for developer const router: Router = { current: new Map(), @@ -128,9 +161,12 @@ function createRouterApi (): RouterApi { forward: createRawHistoryMethod('forward'), beforeEach: beforeGuards.add, afterEach: afterGuards.add, + // attachToURL: 将指定的子应用路由信息添加到浏览器地址上 + // attachAllToURL: 将所有正在运行的子应用路由信息添加到浏览器地址上 + // defaultPage / defaultPath defaultPage吧,更鲜明,defaultPath感觉和之前的baseRoute差不多 } - return { router, executeNavigationGuard } + return { router, executeNavigationGuard, clearCurrentWhenUnmount } } -export const { router, executeNavigationGuard } = createRouterApi() +export const { router, executeNavigationGuard, clearCurrentWhenUnmount } = createRouterApi() diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts index ee6798aad..1db32ab87 100644 --- a/src/sandbox/router/core.ts +++ b/src/sandbox/router/core.ts @@ -184,3 +184,13 @@ function getQueryObjectFromURL (search: string, hash: string): LocationQuery { return queryObject } + +/** + * get microApp path from browser URL without hash + */ +export function getNoHashMicroPathFromURL (appName: string, baseUrl: string): string { + const microPath = getMicroPathFromURL(appName) + if (!microPath) return '' + const formatLocation = createURL(microPath, baseUrl) + return formatLocation.origin + formatLocation.pathname + formatLocation.search +} diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 557a95955..eb8cc825b 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -62,19 +62,19 @@ export function createMicroHistory ( } /** - * update browser url base on child location - * @param state history.state + * navigate to new path base on native method of history + * @param methodName pushState/replaceState * @param fullPath full path */ -export function updateBrowserURL (state: MicroState, fullPath: string): void { - globalEnv.rawWindow.history.replaceState(state, '', fullPath) +export function nativeHistoryNavigate (methodName: string, fullPath: string, state: unknown = null): void { + globalEnv.rawWindow.history[methodName](state, '', fullPath) } /** - * navigate to new path base on native method of history - * @param methodName pushState/replaceState + * update browser url base on child location + * @param state history.state * @param fullPath full path */ -export function nativeHistoryNavigate (methodName: string, fullPath: string): void { - globalEnv.rawWindow.history[methodName](null, '', fullPath) +export function updateBrowserURL (state: MicroState, fullPath: string): void { + nativeHistoryNavigate('replaceState', fullPath, state) } diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index a08d641e5..93267bfce 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -20,8 +20,10 @@ import { updateBrowserURL, } from './history' import { createURL } from '../../libs/utils' -export { addHistoryListener } from './event' +import { clearCurrentWhenUnmount } from './api' export { router } from './api' +export { addHistoryListener } from './event' +export { getNoHashMicroPathFromURL } from './core' // 所谓路由系统,无非两种操作:读、写 // 读是通过location,写是通过replace/pushState @@ -79,11 +81,11 @@ export function updateBrowserURLWithLocation ( } /** - * In any case, microPath & microState will be removed from browser, but location will be initialized only when keep-route-state is false + * In any case, microPath & microState will be removed from browser, but location will be initialized only when keep-router-state is false * @param appName app name * @param url app url * @param microLocation location of microApp - * @param keepRouteState keep-route-state is only used to control whether to clear the location of microApp + * @param keepRouteState keep-router-state is only used to control whether to clear the location of microApp */ export function clearRouteStateFromURL ( appName: string, @@ -96,6 +98,7 @@ export function clearRouteStateFromURL ( updateMicroLocation(appName, pathname + search + hash, url, microLocation, 'clear') } removeStateAndPathFromBrowser(appName, url) + clearCurrentWhenUnmount(appName) } /** diff --git a/src/source/patch.ts b/src/source/patch.ts index ee68240ae..d1a433b21 100644 --- a/src/source/patch.ts +++ b/src/source/patch.ts @@ -1,4 +1,4 @@ -import type { Func, AppInterface } from '@micro-app/types' +import type { Func, AppInterface, NormalKey } from '@micro-app/types' import { appInstanceMap } from '../create_app' import { CompletionPath, @@ -412,11 +412,10 @@ export function patchSetAttribute (): void { Element.prototype.setAttribute = function setAttribute (key: string, value: string): void { if (/^micro-app(-\S+)?/i.test(this.tagName) && key === 'data') { if (isPlainObject(value)) { - const cloneValue: Record = {} - Object.getOwnPropertyNames(value).forEach((propertyKey: PropertyKey) => { - if (!(isString(propertyKey) && propertyKey.indexOf('__') === 0)) { - // @ts-ignore - cloneValue[propertyKey] = value[propertyKey] + const cloneValue: Record = {} + Object.getOwnPropertyNames(value).forEach((key: NormalKey) => { + if (!(isString(key) && key.indexOf('__') === 0)) { + cloneValue[key] = value[key] } }) this.data = cloneValue diff --git a/src/source/scripts.ts b/src/source/scripts.ts index bf8cda2b0..b79afeb83 100644 --- a/src/source/scripts.ts +++ b/src/source/scripts.ts @@ -369,7 +369,7 @@ function bindScope ( info: sourceScriptInfo, ): string { if (isPlainObject(microApp.plugins)) { - code = usePlugins(url, code, app.name, microApp.plugins!, info) + code = usePlugins(url, code, app.name, microApp.plugins, info) } if (app.sandBox && !info.module) { @@ -401,7 +401,7 @@ function processCode (configs: plugins['global'], code: string, url: string, inf return configs.reduce((preCode, config) => { if (isPlainObject(config) && isFunction(config.loader)) { - return config.loader!(preCode, url, config.options, info) + return config.loader(preCode, url, config.options, info) } return preCode diff --git a/typings/global.d.ts b/typings/global.d.ts index 6a296634f..f8b64e379 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -1,6 +1,8 @@ declare module '@micro-app/types' { type AttrType = string | null + type NormalKey = string | number + type Func = (...rest: any[]) => void type microAppWindowType = Window & any From 4b27a8f26fbff494fef8393f385fe3240de30329 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Mon, 20 Jun 2022 19:38:29 +0800 Subject: [PATCH 031/268] fix: fix bug of router.push/replace when child is hash router --- src/libs/utils.ts | 26 ++++++++++++-- src/sandbox/router/api.ts | 70 +++++++++++++++++++++++++------------ src/sandbox/router/event.ts | 4 +-- src/source/fetch.ts | 2 +- 4 files changed, 74 insertions(+), 28 deletions(-) diff --git a/src/libs/utils.ts b/src/libs/utils.ts index a2debc871..2da964ff0 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -444,9 +444,9 @@ export function stringifyQuery (queryObject: LocationQueryObject): string { export const noop = () => {} /** - * Register or unregister callback functions + * Register or unregister callback/guard with Set */ -export function useCallbacks () { +export function useSetRecord () { const handlers: Set = new Set() function add (handler: T): () => void { @@ -461,3 +461,25 @@ export function useCallbacks () { list: () => handlers, } } + +/** + * record data with Map + */ +export function useMapRecord () { + const data: Map = new Map() + + function add (key: PropertyKey, target: T): () => void { + data.set(key, target) + return () => { + if (data.has(key)) data.delete(key) + } + } + + return { + add, + get: (key: PropertyKey) => data.get(key), + delete: (key: PropertyKey) => { + if (data.has(key)) data.delete(key) + } + } +} diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index 3d4a2cf55..137ee2b05 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -19,13 +19,13 @@ import { createURL, isFunction, isPlainObject, - useCallbacks, + useSetRecord, requestIdleCallback, isString, } from '../../libs/utils' import { appInstanceMap } from '../../create_app' import { getActiveApps } from '../../micro_app' -import { dispatchPopStateEventToMicroApp } from './event' +import { dispatchNativePopStateEvent } from './event' import globalEnv from '../../libs/global_env' import { nativeHistoryNavigate } from './history' @@ -37,6 +37,35 @@ export interface RouterApi { } function createRouterApi (): RouterApi { + /** + * common handler for router.push/router.replace method + * @param appName app name + * @param methodName replaceState/pushState + * @param baseURL base url + * @param targetLocation target location + * @param state to.state + */ + function navigateWithRawHistory ( + appName: string, + methodName: string, + baseURL: string, + targetLocation: MicroLocation, + state: unknown, + ): void { + const setMicroPathResult = setMicroPathToURL(appName, targetLocation) + nativeHistoryNavigate( + methodName, + setMicroPathResult.fullPath, + setMicroState( + appName, + globalEnv.rawWindow.history.state, + state ?? null, + baseURL, + setMicroPathResult.searchHash, + ), + ) + dispatchNativePopStateEvent(globalEnv.rawWindow.history.state) + } /** * create method of router.push/replace * NOTE: @@ -48,21 +77,20 @@ function createRouterApi (): RouterApi { function createNavigationMethod (replace: boolean): navigationMethod { return function (to: RouterTarget): void { const appName = formatAppName(to.name) + // console.log(3333333, appInstanceMap.get(appName)) if (appName && isString(to.path)) { const app = appInstanceMap.get(appName) if (app && !app.sandBox) return logError(`navigation failed, sandBox of app ${appName} is closed`) // active apps, include hidden keep-alive if (getActiveApps().includes(appName)) { - const proxyWindow = app!.sandBox!.proxyWindow - const microLocation = proxyWindow.location + const microLocation = app!.sandBox!.proxyWindow.location const currentFullPath = microLocation.pathname + microLocation.search + microLocation.hash const targetLocation = createURL(to.path, app!.url) // Only get path data, even if the origin is different from microApp - const targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash - if (currentFullPath !== targetPath) { + const targetFullPath = targetLocation.pathname + targetLocation.search + targetLocation.hash + if (currentFullPath !== targetFullPath) { const methodName = (replace && to.replace !== false) || to.replace === true ? 'replaceState' : 'pushState' - proxyWindow.history[methodName](to.state ?? null, '', targetPath) - dispatchPopStateEventToMicroApp(appName, proxyWindow, null) + navigateWithRawHistory(appName, methodName, microLocation.origin, targetLocation, to.state) } } else { /** @@ -71,19 +99,14 @@ function createRouterApi (): RouterApi { * use base app location.origin as baseURL */ const targetLocation = createURL(to.path, location.origin) - const targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash - if (getMicroPathFromURL(appName) !== targetPath) { - const setMicroPathResult = setMicroPathToURL(appName, targetLocation) - nativeHistoryNavigate( + const targetFullPath = targetLocation.pathname + targetLocation.search + targetLocation.hash + if (getMicroPathFromURL(appName) !== targetFullPath) { + navigateWithRawHistory( + appName, to.replace === false ? 'pushState' : 'replaceState', - setMicroPathResult.fullPath, - setMicroState( - appName, - globalEnv.rawWindow.history.state, - to.state ?? null, - location.origin, - setMicroPathResult.searchHash, - ), + location.origin, + targetLocation, + to.state, ) } } @@ -100,8 +123,8 @@ function createRouterApi (): RouterApi { } } - const beforeGuards = useCallbacks() - const afterGuards = useCallbacks() + const beforeGuards = useSetRecord() + const afterGuards = useSetRecord() /** * run all of beforeEach/afterEach guards @@ -163,7 +186,8 @@ function createRouterApi (): RouterApi { afterEach: afterGuards.add, // attachToURL: 将指定的子应用路由信息添加到浏览器地址上 // attachAllToURL: 将所有正在运行的子应用路由信息添加到浏览器地址上 - // defaultPage / defaultPath defaultPage吧,更鲜明,defaultPath感觉和之前的baseRoute差不多 + // setDefaultPage: + // removeDefaultPage } return { router, executeNavigationGuard, clearCurrentWhenUnmount } diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index 00509cfac..1aa9c8c1e 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -100,6 +100,6 @@ export function dispatchHashChangeEventToMicroApp ( /** * dispatch native PopStateEvent, simulate location behavior */ -export function dispatchNativePopStateEvent (): void { - globalEnv.rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) +export function dispatchNativePopStateEvent (state: unknown = null): void { + globalEnv.rawWindow.dispatchEvent(new PopStateEvent('popstate', { state })) } diff --git a/src/source/fetch.ts b/src/source/fetch.ts index 61268dbd1..32813ca0d 100644 --- a/src/source/fetch.ts +++ b/src/source/fetch.ts @@ -5,7 +5,7 @@ import microApp from '../micro_app' * fetch source of html, js, css * @param url source path * @param appName app name - * @param config config of fetch + * @param config fetch options */ export function fetchSource (url: string, appName: string | null = null, options = {}): Promise { if (isFunction(microApp.fetch)) { From cf22ae0ff9d621d2f5d18cbe3a6e0546f895fb27 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Tue, 21 Jun 2022 20:44:01 +0800 Subject: [PATCH 032/268] feat: add setDefaultPage removeDefaultPage getDefaultPage of router --- README.zh-cn.md | 17 ++----- package.json | 2 +- src/create_app.ts | 9 +++- src/libs/utils.ts | 26 ++++++----- src/micro_app.ts | 2 +- src/micro_app_element.ts | 28 ++++++++++-- src/sandbox/index.ts | 13 ++++-- src/sandbox/router/api.ts | 46 ++++++++++++++++--- src/sandbox/router/index.ts | 12 +++-- src/sandbox/router/location.ts | 84 +++++++++++++++++++++------------- typings/global.d.ts | 30 +++++++++--- 11 files changed, 187 insertions(+), 82 deletions(-) diff --git a/README.zh-cn.md b/README.zh-cn.md index 6eb5e7647..fd55baf33 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -33,11 +33,7 @@ micro-app是京东零售推出的一款微前端框架,它基于类WebComponen micro-app与技术栈无关,对前端框架没有限制,任何框架都可以作为基座应用嵌入任何类型的子应用。 # 如何使用 -微前端分为基座应用(也可以叫做主应用)和子应用。 - -这里以一种比较常见的情况举例:基座应用使用vue框架,采用history路由,子应用使用react框架,采用hash路由,我们分别列出基座应用和子应用需要进行的修改,具体介绍micro-app的使用方式。 - -## 基座应用 +## 主应用 **1、安装依赖** ```bash @@ -54,11 +50,8 @@ microApp.start() **3、在页面中嵌入微前端应用** ```html - - + + ``` ## 子应用 @@ -72,14 +65,14 @@ devServer: { }, ``` -以上微前端基本渲染完成,效果如下: +以上即完成微前端的嵌入,效果如下: result 更多详细配置可以查看[官网文档](https://micro-zoe.github.io/micro-app/docs.html#/zh-cn/start) # 🤝 参与共建 -如果您对这个项目感兴趣,欢迎提 pull request,也欢迎 "Star" 支持一下 ^_^ +如果您对这个项目感兴趣,欢迎参与贡献,也欢迎 "Star" 支持一下 ^_^ ### 本地运行 1、克隆项目 diff --git a/package.json b/package.json index 602653350..92ad46269 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@micro-zoe/micro-app", - "version": "1.0.0-beta.0", + "version": "1.0.0-alpha.0", "description": "A lightweight, efficient and powerful micro front-end framework", "private": false, "main": "lib/index.min.js", diff --git a/src/create_app.ts b/src/create_app.ts index 7fc9211c4..992dae70b 100644 --- a/src/create_app.ts +++ b/src/create_app.ts @@ -38,6 +38,7 @@ export interface CreateAppParam { baseroute?: string keepRouteState?: boolean container?: HTMLElement | ShadowRoot + defaultPage?: string } export default class CreateApp implements AppInterface { @@ -63,6 +64,7 @@ export default class CreateApp implements AppInterface { keepRouteState: boolean source: sourceType sandBox: SandBoxInterface | null = null + defaultPage: string constructor ({ name, @@ -75,6 +77,7 @@ export default class CreateApp implements AppInterface { useMemoryRouter, baseroute, keepRouteState, + defaultPage, }: CreateAppParam) { this.container = container ?? null this.inline = inline ?? false @@ -87,6 +90,8 @@ export default class CreateApp implements AppInterface { this.useSandbox = useSandbox this.scopecss = this.useSandbox && scopecss this.useMemoryRouter = this.useSandbox && useMemoryRouter + this.defaultPage = defaultPage ?? '' + this.source = { links: new Map(), scripts: new Map(), @@ -147,12 +152,14 @@ export default class CreateApp implements AppInterface { inline?: boolean, baseroute?: string, keepRouteState?: boolean, + defaultPage?: string, ): void { if (isBoolean(inline)) this.inline = inline // keepRouteState effective on unmount if (isBoolean(keepRouteState)) this.keepRouteState = keepRouteState this.container = this.container ?? container! this.baseroute = baseroute ?? this.baseroute + this.defaultPage = defaultPage ?? this.defaultPage if (this.loadSourceLevel !== 2) { this.state = appStates.LOADING_SOURCE_CODE @@ -169,7 +176,7 @@ export default class CreateApp implements AppInterface { cloneContainer(this.source.html as Element, this.container as Element, !this.umdMode) - this.sandBox?.start(this.baseroute, this.useMemoryRouter) + this.sandBox?.start(this.baseroute, this.useMemoryRouter, this.defaultPage) let umdHookMountResult: any // result of mount function diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 2da964ff0..497b720d8 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -17,6 +17,9 @@ export const globalThis = (typeof global !== 'undefined') ) ) +export const noop = () => {} +export const noopFalse = () => false + // Array.isArray export const isArray = Array.isArray // Object.assign @@ -441,18 +444,17 @@ export function stringifyQuery (queryObject: LocationQueryObject): string { return result } -export const noop = () => {} - /** * Register or unregister callback/guard with Set */ export function useSetRecord () { const handlers: Set = new Set() - function add (handler: T): () => void { + function add (handler: T): () => boolean { handlers.add(handler) - return () => { - if (handlers.has(handler)) handlers.delete(handler) + return (): boolean => { + if (handlers.has(handler)) return handlers.delete(handler) + return false } } @@ -468,18 +470,20 @@ export function useSetRecord () { export function useMapRecord () { const data: Map = new Map() - function add (key: PropertyKey, target: T): () => void { - data.set(key, target) - return () => { - if (data.has(key)) data.delete(key) + function add (key: PropertyKey, value: T): () => boolean { + data.set(key, value) + return (): boolean => { + if (data.has(key)) return data.delete(key) + return false } } return { add, get: (key: PropertyKey) => data.get(key), - delete: (key: PropertyKey) => { - if (data.has(key)) data.delete(key) + delete: (key: PropertyKey): boolean => { + if (data.has(key)) return data.delete(key) + return false } } } diff --git a/src/micro_app.ts b/src/micro_app.ts index 31e1752ea..df510af54 100644 --- a/src/micro_app.ts +++ b/src/micro_app.ts @@ -22,7 +22,7 @@ import { EventCenterForBaseApp } from './interact' import { initGlobalEnv } from './libs/global_env' import { appInstanceMap } from './create_app' import { appStates, keepAliveStates } from './constants' -import { router } from './sandbox/router' +import { router } from './sandbox' /** * if app not prefetch & not unmount, then app is active diff --git a/src/micro_app_element.ts b/src/micro_app_element.ts index 1693d728f..c9ff23216 100644 --- a/src/micro_app_element.ts +++ b/src/micro_app_element.ts @@ -9,6 +9,7 @@ import { isString, isFunction, CompletionPath, + createURL, } from './libs/utils' import { ObservedAttrName, @@ -21,7 +22,7 @@ import { patchSetAttribute } from './source/patch' import microApp from './micro_app' import dispatchLifecyclesEvent from './interact/lifecycles_event' import globalEnv from './libs/global_env' -import { getNoHashMicroPathFromURL } from './sandbox' +import { getNoHashMicroPathFromURL, router } from './sandbox' /** * define element @@ -288,6 +289,7 @@ export function defineElement (tagName: string): void { this.getDisposeResult('inline'), this.getBaseRouteCompatible(), this.getDisposeResult('keep-router-state'), + this.getDefaultPageValue(), )) } @@ -312,6 +314,7 @@ export function defineElement (tagName: string): void { useMemoryRouter: !this.getDisposeResult('disable-memory-router'), baseroute: this.getBaseRouteCompatible(), keepRouteState: this.getDisposeResult('keep-router-state'), + defaultPage: this.getDefaultPageValue(), }) appInstanceMap.set(this.appName, instance) @@ -335,7 +338,7 @@ export function defineElement (tagName: string): void { } // hidden app when disconnectedCallback called with keep-alive - private handleHiddenKeepAliveApp () { + private handleHiddenKeepAliveApp (): void { const app = appInstanceMap.get(this.appName) if ( app && @@ -345,7 +348,7 @@ export function defineElement (tagName: string): void { } // show app when connectedCallback called with keep-alive - private handleShowKeepAliveApp (app: AppInterface) { + private handleShowKeepAliveApp (app: AppInterface): void { // must be async defer(() => app.showKeepAliveApp(this.shadowRoot ?? this)) } @@ -410,13 +413,30 @@ export function defineElement (tagName: string): void { const rawLocation = globalEnv.rawWindow.location this.ssrUrl = CompletionPath(rawLocation.pathname + rawLocation.search, baseUrl) } else { - this.ssrUrl = getNoHashMicroPathFromURL(this.appName, baseUrl) + // get path from browser URL + let targetPath = getNoHashMicroPathFromURL(this.appName, baseUrl) + const defaultPagePath = this.getDefaultPageValue() + if (!targetPath && defaultPagePath) { + const targetLocation = createURL(defaultPagePath, baseUrl) + targetPath = targetLocation.origin + targetLocation.pathname + targetLocation.search + } + this.ssrUrl = targetPath } } else if (this.ssrUrl) { this.ssrUrl = '' } } + /** + * get config of default page + */ + private getDefaultPageValue (): string { + return router.getDefaultPage(this.appName) ?? + this.getAttribute('default-page') ?? + this.getAttribute('defaultPage') ?? + '' + } + /** * Data from the base application */ diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index fa7440c34..565247259 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -46,7 +46,7 @@ import createMicroRouter, { updateBrowserURLWithLocation, router, } from './router' -export { getNoHashMicroPathFromURL } from './router' +export { router, getNoHashMicroPathFromURL } from './router' export type MicroAppWindowDataType = { __MICRO_APP_ENVIRONMENT__: boolean @@ -113,11 +113,15 @@ export default class SandBox implements SandBoxInterface { assign(this, effect(this.microAppWindow)) } - public start (baseRoute: string, useMemoryRouter = true): void { + public start ( + baseRoute: string, + useMemoryRouter = true, + defaultPage = '', + ): void { if (!this.active) { this.active = true if (useMemoryRouter) { - this.initRouteState() + this.initRouteState(defaultPage) // unique listener of popstate event for sub app this.removeHistoryListener = addHistoryListener( this.proxyWindow.__MICRO_APP_NAME__, @@ -452,11 +456,12 @@ export default class SandBox implements SandBoxInterface { }) } - private initRouteState (): void { + private initRouteState (defaultPage: string): void { initRouteStateWithURL( this.proxyWindow.__MICRO_APP_NAME__, this.proxyWindow.__MICRO_APP_URL__, this.proxyWindow.location as MicroLocation, + defaultPage, ) } diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index 137ee2b05..1a31ac635 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -20,8 +20,10 @@ import { isFunction, isPlainObject, useSetRecord, + useMapRecord, requestIdleCallback, isString, + noopFalse, } from '../../libs/utils' import { appInstanceMap } from '../../create_app' import { getActiveApps } from '../../micro_app' @@ -83,12 +85,11 @@ function createRouterApi (): RouterApi { if (app && !app.sandBox) return logError(`navigation failed, sandBox of app ${appName} is closed`) // active apps, include hidden keep-alive if (getActiveApps().includes(appName)) { - const microLocation = app!.sandBox!.proxyWindow.location - const currentFullPath = microLocation.pathname + microLocation.search + microLocation.hash + const microLocation = app!.sandBox!.proxyWindow.location as MicroLocation const targetLocation = createURL(to.path, app!.url) // Only get path data, even if the origin is different from microApp const targetFullPath = targetLocation.pathname + targetLocation.search + targetLocation.hash - if (currentFullPath !== targetFullPath) { + if (microLocation.fullPath !== targetFullPath || getMicroPathFromURL(appName) !== targetFullPath) { const methodName = (replace && to.replace !== false) || to.replace === true ? 'replaceState' : 'pushState' navigateWithRawHistory(appName, methodName, microLocation.origin, targetLocation, to.state) } @@ -172,6 +173,28 @@ function createRouterApi (): RouterApi { router.current.delete(appName) } + // defaultPage data + const defaultPageRecord = useMapRecord() + + /** + * defaultPage只在子应用初始化时生效,且优先级比浏览器上的子应用路由地址低 + * @param appName app name + * @param path page path + */ + function setDefaultPage (appName: string, path: string): () => boolean { + appName = formatAppName(appName) + if (!appName) return noopFalse + + return defaultPageRecord.add(appName, path) + } + + function removeDefaultPage (appName: string): boolean { + appName = formatAppName(appName) + if (!appName) return false + + return defaultPageRecord.delete(appName) + } + // Router API for developer const router: Router = { current: new Map(), @@ -186,11 +209,20 @@ function createRouterApi (): RouterApi { afterEach: afterGuards.add, // attachToURL: 将指定的子应用路由信息添加到浏览器地址上 // attachAllToURL: 将所有正在运行的子应用路由信息添加到浏览器地址上 - // setDefaultPage: - // removeDefaultPage + setDefaultPage, + removeDefaultPage, + getDefaultPage: defaultPageRecord.get, } - return { router, executeNavigationGuard, clearCurrentWhenUnmount } + return { + router, + executeNavigationGuard, + clearCurrentWhenUnmount, + } } -export const { router, executeNavigationGuard, clearCurrentWhenUnmount } = createRouterApi() +export const { + router, + executeNavigationGuard, + clearCurrentWhenUnmount, +} = createRouterApi() diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index 93267bfce..2dbe22cd4 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -48,12 +48,13 @@ export function initRouteStateWithURL ( appName: string, url: string, microLocation: MicroLocation, + defaultPage?: string, ): void { const microPath = getMicroPathFromURL(appName) if (microPath) { - updateMicroLocation(appName, microPath, url, microLocation, 'init') + updateMicroLocation(appName, microPath, url, microLocation, 'auto') } else { - updateBrowserURLWithLocation(appName, url, microLocation) + updateBrowserURLWithLocation(appName, url, microLocation, defaultPage) } } @@ -65,7 +66,11 @@ export function updateBrowserURLWithLocation ( appName: string, url: string, microLocation: MicroLocation, + defaultPage?: string, ): void { + if (defaultPage) { + updateMicroLocation(appName, defaultPage, url, microLocation, 'prevent') + } const setMicroPathResult = setMicroPathToURL(appName, microLocation) updateBrowserURL( setMicroState( @@ -77,6 +82,7 @@ export function updateBrowserURLWithLocation ( ), setMicroPathResult.fullPath, ) + // trigger guards after change browser URL autoTriggerNavigationGuard(appName, microLocation) } @@ -95,7 +101,7 @@ export function clearRouteStateFromURL ( ): void { if (!keepRouteState) { const { pathname, search, hash } = createURL(url) - updateMicroLocation(appName, pathname + search + hash, url, microLocation, 'clear') + updateMicroLocation(appName, pathname + search + hash, url, microLocation, 'prevent') } removeStateAndPathFromBrowser(appName, url) clearCurrentWhenUnmount(appName) diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index 37e43baca..44a66da99 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -1,17 +1,17 @@ /* eslint-disable no-void */ import type { MicroLocation, GuardLocation, ShadowLocation } from '@micro-app/types' import globalEnv from '../../libs/global_env' -import { assign as oAssign, rawDefineProperties, createURL } from '../../libs/utils' +import { assign as oAssign, rawDefineProperties, createURL, noop } from '../../libs/utils' import { setMicroPathToURL } from './core' import { dispatchNativePopStateEvent } from './event' import { executeNavigationGuard } from './api' import { nativeHistoryNavigate } from './history' -const shadowLocationKeys: ReadonlyArray = ['href', 'pathname', 'search', 'hash'] +const shadowLocationKeys: ReadonlyArray = ['href', 'pathname', 'search', 'hash'] // origin is readonly, so we ignore when updateMicroLocation -const locationKeys: ReadonlyArray = [...shadowLocationKeys, 'host', 'hostname', 'port', 'protocol', 'search'] -// origin is necessary for guardLocation -const guardLocationKeys: ReadonlyArray = [...locationKeys, 'origin'] +const locationKeys: ReadonlyArray = [...shadowLocationKeys, 'host', 'hostname', 'port', 'protocol', 'search'] +// origin, fullPath is necessary for guardLocation +const guardLocationKeys: ReadonlyArray = [...locationKeys, 'origin', 'fullPath'] /** * create guardLocation by microLocation, used for router guard @@ -32,12 +32,15 @@ export function autoTriggerNavigationGuard (appName: string, microLocation: Micr * There are three situations that trigger location update: * 1. pushState/replaceState * 2. popStateEvent - * 3. params on browser url when init sub app + * 3. query on browser url when init sub app + * 4. set defaultPage when when init sub app + * NOTE: + * 1. update browser URL, and then update microLocation * @param appName app name * @param path target path * @param base base url * @param microLocation micro app location - * @param type init clear normal + * @param type auto prevent */ export function updateMicroLocation ( appName: string, @@ -49,7 +52,6 @@ export function updateMicroLocation ( const newLocation = createURL(path, base) // record old values of microLocation to `from` const from = createGuardLocation(appName, microLocation) - const oldFullPath = from.pathname + from.search + from.hash for (const key of locationKeys) { if (shadowLocationKeys.includes(key)) { // reference of shadowLocation @@ -61,10 +63,9 @@ export function updateMicroLocation ( } // update latest values of microLocation to `to` const to = createGuardLocation(appName, microLocation) - const newFullPath = to.pathname + to.search + to.hash // The hook called only when fullPath changed - if (type === 'init' || (oldFullPath !== newFullPath && type !== 'clear')) { + if (type === 'auto' || (from.fullPath !== to.fullPath && type !== 'prevent')) { executeNavigationGuard(appName, to, from) } } @@ -142,11 +143,14 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio * @param key property name * @param setter setter of location property */ - function createPropertyDescriptor (key: string, setter: (v: string) => void): PropertyDescriptor { + function createPropertyDescriptor ( + getter: () => string, + setter: (v: string) => void, + ): PropertyDescriptor { return { enumerable: true, configurable: true, - get: (): string => shadowLocation[key], + get: getter, set: setter, } } @@ -181,27 +185,43 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio * They take values from shadowLocation, and require special operations when assigning values */ rawDefineProperties(microLocation, { - href: createPropertyDescriptor('href', (value: string): void => { - const targetPath = commonHandler(value, 'pushState') - if (targetPath) rawLocation.href = targetPath - }), - pathname: createPropertyDescriptor('pathname', (value: string): void => { - const targetPath = ('/' + value).replace(/^\/+/, '/') + shadowLocation.search + shadowLocation.hash - handleForPathNameAndSearch(targetPath, 'pathname') - }), - search: createPropertyDescriptor('search', (value: string): void => { - const targetPath = shadowLocation.pathname + ('?' + value).replace(/^\?+/, '?') + shadowLocation.hash - handleForPathNameAndSearch(targetPath, 'search') - }), - hash: createPropertyDescriptor('hash', (value: string): void => { - const targetPath = shadowLocation.pathname + shadowLocation.search + ('#' + value).replace(/^#+/, '#') - const targetLocation = createURL(targetPath, url) - // The same hash will not trigger popStateEvent - if (targetLocation.hash !== shadowLocation.hash) { - nativeHistoryNavigate('pushState', setMicroPathToURL(appName, targetLocation).fullPath) - dispatchNativePopStateEvent() + href: createPropertyDescriptor( + (): string => shadowLocation.href, + (value: string): void => { + const targetPath = commonHandler(value, 'pushState') + if (targetPath) rawLocation.href = targetPath } - }), + ), + pathname: createPropertyDescriptor( + (): string => shadowLocation.pathname, + (value: string): void => { + const targetPath = ('/' + value).replace(/^\/+/, '/') + shadowLocation.search + shadowLocation.hash + handleForPathNameAndSearch(targetPath, 'pathname') + } + ), + search: createPropertyDescriptor( + (): string => shadowLocation.search, + (value: string): void => { + const targetPath = shadowLocation.pathname + ('?' + value).replace(/^\?+/, '?') + shadowLocation.hash + handleForPathNameAndSearch(targetPath, 'search') + } + ), + hash: createPropertyDescriptor( + (): string => shadowLocation.hash, + (value: string): void => { + const targetPath = shadowLocation.pathname + shadowLocation.search + ('#' + value).replace(/^#+/, '#') + const targetLocation = createURL(targetPath, url) + // The same hash will not trigger popStateEvent + if (targetLocation.hash !== shadowLocation.hash) { + nativeHistoryNavigate('pushState', setMicroPathToURL(appName, targetLocation).fullPath) + dispatchNativePopStateEvent() + } + } + ), + fullPath: createPropertyDescriptor( + (): string => shadowLocation.pathname + shadowLocation.search + shadowLocation.hash, + noop, + ), }) const createLocationMethod = (locationMethodName: string) => { diff --git a/typings/global.d.ts b/typings/global.d.ts index f8b64e379..1b8761b56 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -10,7 +10,11 @@ declare module '@micro-app/types' { interface SandBoxInterface { proxyWindow: WindowProxy microAppWindow: Window // Proxy target - start (baseRoute: string, useMemoryRouter: boolean): void + start ( + baseRoute: string, + useMemoryRouter: boolean, + defaultPage: string, + ): void stop (keepRouteState: boolean): void // record umd snapshot before the first execution of umdHookMount recordUmdSnapshot (): void @@ -60,6 +64,7 @@ declare module '@micro-app/types' { source: sourceType // sources of css, js, html sandBox: SandBoxInterface | null // sandbox umdMode: boolean // is umd mode + defaultPage: string // default page when mount // Load resources loadSourceCode (): void @@ -76,6 +81,7 @@ declare module '@micro-app/types' { inline?: boolean, baseroute?: string, keepRouteState?: boolean, + defaultPage?: string, ): void // unmount app @@ -213,6 +219,7 @@ declare module '@micro-app/types' { interface MicroLocation extends Location, URL { // shadowLocation is the current location information (href, pathname, search, hash) shadowLocation: ShadowLocation + fullPath: string [key: string]: any } type MicroHistory = ProxyHandler @@ -244,7 +251,7 @@ declare module '@micro-app/types' { searchQuery?: LocationQueryObject } - type GuardLocation = Record + type GuardLocation = Record type CurrentRoute = Map @@ -299,17 +306,28 @@ declare module '@micro-app/types' { * relative to the current page */ go: Func - // Go back in history if possible by calling `history.back()`. + /** + * Go back in history if possible by calling `history.back()`. + */ back: Func - // Go forward in history if possible by calling `history.forward()`. + /** + * Go forward in history if possible by calling `history.forward()`. + */ forward: Func /** * Add a navigation guard that executes before any navigation * @param guard global hook for */ - beforeEach(guard: RouterGuard): void + beforeEach(guard: RouterGuard): () => boolean + /** + * Add a navigation guard that executes after any navigation + * @param guard global hook for + */ + afterEach(guard: RouterGuard): () => boolean - afterEach(guard: RouterGuard): void + setDefaultPage(appName: string, path: string): () => boolean + removeDefaultPage(appName: string): boolean + getDefaultPage(key: PropertyKey): string | undefined } } From 3a591efc091af029305880a7582f405740fa327e Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 22 Jun 2022 20:46:37 +0800 Subject: [PATCH 033/268] feat: update router funcitons --- src/sandbox/router/api.ts | 8 ++++---- src/sandbox/router/event.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index 1a31ac635..3e434a54f 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -83,7 +83,7 @@ function createRouterApi (): RouterApi { if (appName && isString(to.path)) { const app = appInstanceMap.get(appName) if (app && !app.sandBox) return logError(`navigation failed, sandBox of app ${appName} is closed`) - // active apps, include hidden keep-alive + // active apps, include hidden keep-alive app if (getActiveApps().includes(appName)) { const microLocation = app!.sandBox!.proxyWindow.location as MicroLocation const targetLocation = createURL(to.path, app!.url) @@ -96,16 +96,16 @@ function createRouterApi (): RouterApi { } else { /** * app not exit or unmounted, update browser URL with replaceState - * * use base app location.origin as baseURL */ - const targetLocation = createURL(to.path, location.origin) + const rawLocation = globalEnv.rawWindow.location + const targetLocation = createURL(to.path, rawLocation.origin) const targetFullPath = targetLocation.pathname + targetLocation.search + targetLocation.hash if (getMicroPathFromURL(appName) !== targetFullPath) { navigateWithRawHistory( appName, to.replace === false ? 'pushState' : 'replaceState', - location.origin, + rawLocation.origin, targetLocation, to.state, ) diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index 1aa9c8c1e..c7ce524fa 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -9,7 +9,7 @@ import globalEnv from '../../libs/global_env' type PopStateListener = (this: Window, e: PopStateEvent) => void /** - * listen & release popstate event + * dispatch PopStateEvent & HashChangeEvent to child app * each child app will listen for popstate event when sandbox start * and release it when sandbox stop * @param appName app name From 5f246e0aba4d1515ebfe5f32c40424dc7edfaace Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Sat, 25 Jun 2022 19:46:01 +0800 Subject: [PATCH 034/268] feat: dispacth popstate event when naivete to new url --- docs/zh-cn/advanced.md | 4 +- src/libs/utils.ts | 4 ++ src/sandbox/index.ts | 3 -- src/sandbox/router/api.ts | 16 ++----- src/sandbox/router/core.ts | 21 +------- src/sandbox/router/event.ts | 15 +++--- src/sandbox/router/history.ts | 88 +++++++++++++++++++++++++++++----- src/sandbox/router/index.ts | 23 ++++----- src/sandbox/router/location.ts | 10 ++-- 9 files changed, 109 insertions(+), 75 deletions(-) diff --git a/docs/zh-cn/advanced.md b/docs/zh-cn/advanced.md index 7d1b9d79d..a3cca76b0 100644 --- a/docs/zh-cn/advanced.md +++ b/docs/zh-cn/advanced.md @@ -40,9 +40,7 @@ microApp.start({ `micro-app`支持两种渲染微前端的模式,默认模式和umd模式。 - **默认模式:**子应用在初次渲染和后续渲染时会顺序执行所有js,以保证多次渲染的一致性。 -- **umd模式:**子应用暴露出`mount`、`unmount`方法,此时只在初次渲染时执行所有js,后续渲染时只会执行这两个方法。 - -正常情况下默认模式已经可以满足绝大部分项目,但umd模式得益于实现方式,在多次渲染时具有更好的性能和内存表现。 +- **umd模式:**子应用暴露出`mount`、`unmount`方法,此时只在初次渲染时执行所有js,后续渲染只会执行这两个方法,在多次渲染时具有更好的性能和内存表现。 **我的项目是否需要切换为umd模式?** diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 497b720d8..64fee89a5 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -75,6 +75,10 @@ export function isShadowRoot (target: unknown): target is ShadowRoot { return typeof ShadowRoot !== 'undefined' && target instanceof ShadowRoot } +export function isURL (target: unknown): target is URL { + return target instanceof URL +} + /** * format error log * @param msg message diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 565247259..07806812e 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -459,7 +459,6 @@ export default class SandBox implements SandBoxInterface { private initRouteState (defaultPage: string): void { initRouteStateWithURL( this.proxyWindow.__MICRO_APP_NAME__, - this.proxyWindow.__MICRO_APP_URL__, this.proxyWindow.location as MicroLocation, defaultPage, ) @@ -477,7 +476,6 @@ export default class SandBox implements SandBoxInterface { public setRouteInfoForKeepAliveApp (): void { updateBrowserURLWithLocation( this.proxyWindow.__MICRO_APP_NAME__, - this.proxyWindow.__MICRO_APP_URL__, this.proxyWindow.location as MicroLocation, ) } @@ -485,7 +483,6 @@ export default class SandBox implements SandBoxInterface { public removeRouteInfoForKeepAliveApp (): void { removeStateAndPathFromBrowser( this.proxyWindow.__MICRO_APP_NAME__, - this.proxyWindow.__MICRO_APP_URL__, ) } } diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index 3e434a54f..0cf24fb82 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -27,10 +27,8 @@ import { } from '../../libs/utils' import { appInstanceMap } from '../../create_app' import { getActiveApps } from '../../micro_app' -import { dispatchNativePopStateEvent } from './event' import globalEnv from '../../libs/global_env' - -import { nativeHistoryNavigate } from './history' +import { navigateWithPopStateEvent } from './history' export interface RouterApi { router: Router, @@ -43,30 +41,25 @@ function createRouterApi (): RouterApi { * common handler for router.push/router.replace method * @param appName app name * @param methodName replaceState/pushState - * @param baseURL base url * @param targetLocation target location * @param state to.state */ function navigateWithRawHistory ( appName: string, methodName: string, - baseURL: string, targetLocation: MicroLocation, state: unknown, ): void { const setMicroPathResult = setMicroPathToURL(appName, targetLocation) - nativeHistoryNavigate( + navigateWithPopStateEvent( methodName, setMicroPathResult.fullPath, setMicroState( appName, globalEnv.rawWindow.history.state, state ?? null, - baseURL, - setMicroPathResult.searchHash, ), ) - dispatchNativePopStateEvent(globalEnv.rawWindow.history.state) } /** * create method of router.push/replace @@ -86,12 +79,12 @@ function createRouterApi (): RouterApi { // active apps, include hidden keep-alive app if (getActiveApps().includes(appName)) { const microLocation = app!.sandBox!.proxyWindow.location as MicroLocation - const targetLocation = createURL(to.path, app!.url) + const targetLocation = createURL(to.path, microLocation.href) // Only get path data, even if the origin is different from microApp const targetFullPath = targetLocation.pathname + targetLocation.search + targetLocation.hash if (microLocation.fullPath !== targetFullPath || getMicroPathFromURL(appName) !== targetFullPath) { const methodName = (replace && to.replace !== false) || to.replace === true ? 'replaceState' : 'pushState' - navigateWithRawHistory(appName, methodName, microLocation.origin, targetLocation, to.state) + navigateWithRawHistory(appName, methodName, targetLocation, to.state) } } else { /** @@ -105,7 +98,6 @@ function createRouterApi (): RouterApi { navigateWithRawHistory( appName, to.replace === false ? 'pushState' : 'replaceState', - rawLocation.origin, targetLocation, to.state, ) diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts index 1db32ab87..3351497a8 100644 --- a/src/sandbox/router/core.ts +++ b/src/sandbox/router/core.ts @@ -19,8 +19,6 @@ export function setMicroState ( appName: string, rawState: MicroState, microState: MicroState, - base: string, - searchHash: string ): MicroState { const additionalState: Record = { microAppState: assign({}, rawState?.microAppState, { @@ -28,20 +26,12 @@ export function setMicroState ( }) } - /** - * vue-router4 will call replace method to replace the URL base on history.state.current before push - * add the latest search & hash to history.state.current to avoid this problem - */ - if (rawState?.current) { - additionalState.current = (createURL(rawState.current, base)).pathname + searchHash - } - // create new state object return assign({}, rawState, additionalState) } // delete micro app state form origin state -export function removeMicroState (appName: string, rawState: MicroState, url: string): MicroState { +export function removeMicroState (appName: string, rawState: MicroState): MicroState { if (isPlainObject(rawState?.microAppState)) { if (!isUndefined(rawState.microAppState[appName])) { delete rawState.microAppState[appName] @@ -51,15 +41,8 @@ export function removeMicroState (appName: string, rawState: MicroState, url: st } } - let coverState = null - if (rawState?.current) { - coverState = { - current: removeMicroPathFromURL(appName, createURL(rawState.current, url)) - } - } - // 生成新的state对象 - return assign({}, rawState, coverState) + return assign({}, rawState) } // get micro app state form origin state diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index c7ce524fa..9c4693e87 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -16,8 +16,9 @@ type PopStateListener = (this: Window, e: PopStateEvent) => void * @returns release callback */ export function addHistoryListener (appName: string): CallableFunction { + const rawWindow = globalEnv.rawWindow // handle popstate event and distribute to child app - const popStateHandler: PopStateListener = (e: PopStateEvent): void => { + const popStateHandler: PopStateListener = (): void => { // exclude hidden keep-alive app if (getActiveApps(true).includes(appName)) { const microPath = getMicroPathFromURL(appName) @@ -29,23 +30,23 @@ export function addHistoryListener (appName: string): CallableFunction { // Do not attach micro state to url when microPath is empty if (microPath) { const oldHash = proxyWindow.location.hash - updateMicroLocation(appName, microPath, app.url, proxyWindow.location as MicroLocation) + updateMicroLocation(appName, microPath, proxyWindow.location as MicroLocation) isHashChange = proxyWindow.location.hash !== oldHash } // console.log(333333, microPath, proxyWindow.location) - dispatchPopStateEventToMicroApp(appName, proxyWindow, e.state) + dispatchPopStateEventToMicroApp(appName, proxyWindow, rawWindow.history.state) // send HashChangeEvent when hash change if (isHashChange) dispatchHashChangeEventToMicroApp(appName, proxyWindow, oldHref) } } - globalEnv.rawWindow.addEventListener('popstate', popStateHandler) + rawWindow.addEventListener('popstate', popStateHandler) return () => { - globalEnv.rawWindow.removeEventListener('popstate', popStateHandler) + rawWindow.removeEventListener('popstate', popStateHandler) } } @@ -100,6 +101,6 @@ export function dispatchHashChangeEventToMicroApp ( /** * dispatch native PopStateEvent, simulate location behavior */ -export function dispatchNativePopStateEvent (state: unknown = null): void { - globalEnv.rawWindow.dispatchEvent(new PopStateEvent('popstate', { state })) +export function dispatchNativePopStateEvent (): void { + globalEnv.rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) } diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index eb8cc825b..7ad3db541 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -5,30 +5,30 @@ import type { HistoryProxyValue, } from '@micro-app/types' import globalEnv from '../../libs/global_env' -import { isString, logError, createURL } from '../../libs/utils' +import { isString, logError, createURL, isPlainObject, isURL, assign } from '../../libs/utils' import { updateMicroLocation } from './location' import { setMicroPathToURL, setMicroState, getMicroState } from './core' +import { dispatchNativePopStateEvent } from './event' // history of micro app -export function createMicroHistory ( - appName: string, - base: string, - microLocation: MicroLocation, -): MicroHistory { +export function createMicroHistory (appName: string, microLocation: MicroLocation): MicroHistory { const rawHistory = globalEnv.rawWindow.history function getMicroHistoryMethod (methodName: PropertyKey): CallableFunction { - return (...rests: any[]) => { + return (...rests: unknown[]) => { // console.log(444444444, rests[0], rests[1], rests[2], methodName) let targetPath = null // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! - if ((methodName === 'pushState' || methodName === 'replaceState') && rests[2] && isString(rests[2])) { + if ( + (methodName === 'pushState' || methodName === 'replaceState') && + (isString(rests[2]) || isURL(rests[2])) + ) { try { - const targetLocation = createURL(rests[2], base) + const targetLocation = createURL(rests[2], microLocation.href) if (targetLocation.origin === microLocation.origin) { targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash const setMicroPathResult = setMicroPathToURL(appName, targetLocation) rests = [ - setMicroState(appName, rawHistory.state, rests[0], base, setMicroPathResult.searchHash), + setMicroState(appName, rawHistory.state, rests[0]), rests[1], setMicroPathResult.fullPath, ] @@ -40,7 +40,14 @@ export function createMicroHistory ( rawHistory[methodName].apply(rawHistory, rests) - if (targetPath) updateMicroLocation(appName, targetPath, base, microLocation) + if (targetPath && targetPath !== microLocation.fullPath) { + /** + * microRoute query may be lost from browserURL after the main app handles the popstate event + * so we manually trigger the microLocation update + */ + updateMicroLocation(appName, targetPath, microLocation) + dispatchNativePopStateEvent() + } // console.log(5555555, microLocation, base) } @@ -65,16 +72,73 @@ export function createMicroHistory ( * navigate to new path base on native method of history * @param methodName pushState/replaceState * @param fullPath full path + * @param state history.state */ export function nativeHistoryNavigate (methodName: string, fullPath: string, state: unknown = null): void { globalEnv.rawWindow.history[methodName](state, '', fullPath) } +/** + * navigate to new path, and dispatch pure popstate event to browser + * used to trigger base app router update + * @param methodName pushState/replaceState + * @param fullPath full path + * @param state history.state + */ +export function navigateWithPopStateEvent (methodName: string, fullPath: string, state: unknown = null): void { + nativeHistoryNavigate(methodName, fullPath, state) + dispatchNativePopStateEvent() +} + /** * update browser url base on child location * @param state history.state * @param fullPath full path */ export function updateBrowserURL (state: MicroState, fullPath: string): void { - nativeHistoryNavigate('replaceState', fullPath, state) + navigateWithPopStateEvent('replaceState', fullPath, state) +} + +/** + * When the old and new path are the same, keep the microAppState in history.state + * @param method history.pushState/replaceState + */ +function patchHistoryState (method: History['pushState' | 'replaceState']): CallableFunction { + const rawWindow = globalEnv.rawWindow + return function (...rests: [data: any, unused: string, url?: string]): void { + if ( + rawWindow.history.state?.microAppState && + (!isPlainObject(rests[0]) || !rests[0].microAppState) && + (isString(rests[2]) || isURL(rests[2])) + ) { + const currentHref = rawWindow.location.href + const targetLocation = createURL(rests[2], currentHref) + if (targetLocation.href === currentHref) { + rests[0] = assign({}, rests[0], { + microAppState: rawWindow.history.state.microAppState, + }) + } + } + method.apply(rawWindow.history, rests) + } +} + +let isReWriteHistoryState = false +/** + * rewrite history.pushState/replaceState + * used to fix the problem that the microAppState maybe missing when mainApp navigate to same path + * e.g: when nextjs, angular receive popstate event, they will use history.replaceState to update browser url with a new state object + */ +export function rewriteHistoryState (): void { + // filter nest app + if (!isReWriteHistoryState && !window.__MICRO_APP_ENVIRONMENT__) { + isReWriteHistoryState = true + const rawWindow = globalEnv.rawWindow + rawWindow.history.pushState = patchHistoryState( + rawWindow.history.pushState, + ) + rawWindow.history.replaceState = patchHistoryState( + rawWindow.history.replaceState, + ) + } } diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index 2dbe22cd4..8b4197319 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -18,6 +18,7 @@ import { import { createMicroHistory, updateBrowserURL, + rewriteHistoryState, } from './history' import { createURL } from '../../libs/utils' import { clearCurrentWhenUnmount } from './api' @@ -35,26 +36,25 @@ export { getNoHashMicroPathFromURL } from './core' * @returns MicroRouter */ export default function createMicroRouter (appName: string, url: string): MicroRouter { + rewriteHistoryState() const microLocation = createMicroLocation(appName, url) - return { microLocation, - microHistory: createMicroHistory(appName, url, microLocation), + microHistory: createMicroHistory(appName, microLocation), } } // 当沙箱执行start, 或者隐藏的keep-alive应用重新渲染时时才根据浏览器url更新location 或者 将参数更新到url上 export function initRouteStateWithURL ( appName: string, - url: string, microLocation: MicroLocation, defaultPage?: string, ): void { const microPath = getMicroPathFromURL(appName) if (microPath) { - updateMicroLocation(appName, microPath, url, microLocation, 'auto') + updateMicroLocation(appName, microPath, microLocation, 'auto') } else { - updateBrowserURLWithLocation(appName, url, microLocation, defaultPage) + updateBrowserURLWithLocation(appName, microLocation, defaultPage) } } @@ -64,12 +64,11 @@ export function initRouteStateWithURL ( */ export function updateBrowserURLWithLocation ( appName: string, - url: string, microLocation: MicroLocation, defaultPage?: string, ): void { if (defaultPage) { - updateMicroLocation(appName, defaultPage, url, microLocation, 'prevent') + updateMicroLocation(appName, defaultPage, microLocation, 'prevent') } const setMicroPathResult = setMicroPathToURL(appName, microLocation) updateBrowserURL( @@ -77,8 +76,6 @@ export function updateBrowserURLWithLocation ( appName, globalEnv.rawWindow.history.state, null, - url, - setMicroPathResult.searchHash, ), setMicroPathResult.fullPath, ) @@ -101,9 +98,9 @@ export function clearRouteStateFromURL ( ): void { if (!keepRouteState) { const { pathname, search, hash } = createURL(url) - updateMicroLocation(appName, pathname + search + hash, url, microLocation, 'prevent') + updateMicroLocation(appName, pathname + search + hash, microLocation, 'prevent') } - removeStateAndPathFromBrowser(appName, url) + removeStateAndPathFromBrowser(appName) clearCurrentWhenUnmount(appName) } @@ -111,9 +108,9 @@ export function clearRouteStateFromURL ( * remove microState from history.state and remove microPath from browserURL * called on sandbox.stop or hidden of keep-alive app */ -export function removeStateAndPathFromBrowser (appName: string, url: string): void { +export function removeStateAndPathFromBrowser (appName: string): void { updateBrowserURL( - removeMicroState(appName, globalEnv.rawWindow.history.state, url), + removeMicroState(appName, globalEnv.rawWindow.history.state), removeMicroPathFromURL(appName), ) } diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index 44a66da99..27fc59c9f 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -5,7 +5,7 @@ import { assign as oAssign, rawDefineProperties, createURL, noop } from '../../l import { setMicroPathToURL } from './core' import { dispatchNativePopStateEvent } from './event' import { executeNavigationGuard } from './api' -import { nativeHistoryNavigate } from './history' +import { nativeHistoryNavigate, navigateWithPopStateEvent } from './history' const shadowLocationKeys: ReadonlyArray = ['href', 'pathname', 'search', 'hash'] // origin is readonly, so we ignore when updateMicroLocation @@ -45,11 +45,10 @@ export function autoTriggerNavigationGuard (appName: string, microLocation: Micr export function updateMicroLocation ( appName: string, path: string, - base: string, microLocation: MicroLocation, type?: string, ): void { - const newLocation = createURL(path, base) + const newLocation = createURL(path, microLocation.href) // record old values of microLocation to `from` const from = createGuardLocation(appName, microLocation) for (const key of locationKeys) { @@ -97,7 +96,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio * @returns origin value or formatted value */ const commonHandler = (value: string | URL, methodName: string): string | URL | undefined => { - const targetLocation = createURL(value, url) + const targetLocation = createURL(value, microLocation.href) // Even if the origin is the same, developers still have the possibility of want to jump to a new page if (targetLocation.origin === microLocation.origin) { const setMicroPathResult = setMicroPathToURL(appName, targetLocation) @@ -213,8 +212,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio const targetLocation = createURL(targetPath, url) // The same hash will not trigger popStateEvent if (targetLocation.hash !== shadowLocation.hash) { - nativeHistoryNavigate('pushState', setMicroPathToURL(appName, targetLocation).fullPath) - dispatchNativePopStateEvent() + navigateWithPopStateEvent('pushState', setMicroPathToURL(appName, targetLocation).fullPath) } } ), From c0feb1d478197f727ba1e7317a4ac40ee40cc015 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Mon, 27 Jun 2022 20:36:53 +0800 Subject: [PATCH 035/268] feat: dispatch popstate event & hashchange event to browser when child naivgate --- dev/children/react16/src/index.js | 26 ++--- dev/main-react16/src/global.jsx | 8 ++ dev/main-react16/src/pages/react16/react16.js | 1 + src/libs/utils.ts | 6 ++ src/sandbox/index.ts | 4 +- src/sandbox/router/api.ts | 7 +- src/sandbox/router/core.ts | 19 ++-- src/sandbox/router/event.ts | 34 ++++++- src/sandbox/router/history.ts | 99 ++++++++++--------- src/sandbox/router/index.ts | 11 +-- src/sandbox/router/location.ts | 16 ++- typings/global.d.ts | 7 ++ 12 files changed, 150 insertions(+), 88 deletions(-) diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index d9986fb72..f7982329d 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -268,16 +268,20 @@ setTimeout(() => { }, 0); -setTimeout(() => { - // window.location.href = 'http://localhost:3001/micro-app/react16/#abc' - // window.location.pathname = '/micro-app/react16/page2#fff' - // window.location.assign('http://localhost:3001/micro-app/react16/page2#eee') - // window.location.replace('http://localhost:3001/micro-app/react16/page2#eee') - // console.log(111111, window.location) +// setTimeout(() => { +// // window.location.href = 'http://localhost:3001/micro-app/react16/#abc' +// // window.location.pathname = '/micro-app/react16/page2#fff' +// // window.location.assign('http://localhost:3001/micro-app/react16/page2#eee') +// // window.location.replace('http://localhost:3001/micro-app/react16/page2#eee') +// console.log(111111, window.location) - window.history.scrollRestoration = 'manual' -}, 5000); +// // window.history.scrollRestoration = 'manual' +// }, 5000); -// window.onpopstate = (e) => { -// console.log(888888888, e) -// } +window.addEventListener('popstate', (e) => { + console.log('子应用 popstate', e) +}) + +window.addEventListener('hashchange', (e) => { + console.log('子应用 hashchange', e, e.newURL, e.oldURL) +}) diff --git a/dev/main-react16/src/global.jsx b/dev/main-react16/src/global.jsx index e134b17c3..d7f7c9332 100644 --- a/dev/main-react16/src/global.jsx +++ b/dev/main-react16/src/global.jsx @@ -128,3 +128,11 @@ microApp.start({ // console.log('unmountAllApps方法 -- 主动卸载所有应用成功') // }) // }, 10000) + +window.addEventListener('popstate', (e) => { + console.log('popstate', e) +}) + +window.addEventListener('hashchange', (e) => { + console.log('hashchange', e, e.newURL, e.oldURL) +}) diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index 96970ebb9..f79ec51ce 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -133,6 +133,7 @@ export default class App extends React.Component { this.setState({ testNum: this.state.testNum + 1, }) + console.log(33333, this.props.history) } jumpToHome = () => { diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 64fee89a5..2539d4b54 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -124,6 +124,12 @@ export function defer (fn: Func, ...args: unknown[]): void { Promise.resolve().then(fn.bind(null, ...args)) } +// export const createURL = (function (): (p: string | URL, b?: string) => MicroLocation { +// class Location extends URL {} +// return (path: string | URL, base?: string): MicroLocation => { +// return (base ? new Location('' + path, base) : new Location('' + path)) as MicroLocation +// } +// })() export function createURL (path: string | URL, base?: string): MicroLocation { return (base ? new URL('' + path, base) : new URL('' + path)) as MicroLocation } diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 07806812e..6e12012bb 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -481,8 +481,6 @@ export default class SandBox implements SandBoxInterface { } public removeRouteInfoForKeepAliveApp (): void { - removeStateAndPathFromBrowser( - this.proxyWindow.__MICRO_APP_NAME__, - ) + removeStateAndPathFromBrowser(this.proxyWindow.__MICRO_APP_NAME__) } } diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index 0cf24fb82..fa4f9a5b9 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -28,7 +28,7 @@ import { import { appInstanceMap } from '../../create_app' import { getActiveApps } from '../../micro_app' import globalEnv from '../../libs/global_env' -import { navigateWithPopStateEvent } from './history' +import { navigateWithNativeEvent } from './history' export interface RouterApi { router: Router, @@ -50,10 +50,9 @@ function createRouterApi (): RouterApi { targetLocation: MicroLocation, state: unknown, ): void { - const setMicroPathResult = setMicroPathToURL(appName, targetLocation) - navigateWithPopStateEvent( + navigateWithNativeEvent( methodName, - setMicroPathResult.fullPath, + setMicroPathToURL(appName, targetLocation), setMicroState( appName, globalEnv.rawWindow.history.state, diff --git a/src/sandbox/router/core.ts b/src/sandbox/router/core.ts index 3351497a8..d17be888c 100644 --- a/src/sandbox/router/core.ts +++ b/src/sandbox/router/core.ts @@ -2,6 +2,7 @@ import type { MicroLocation, MicroState, LocationQuery, + HandleMicroPathResult, } from '@micro-app/types' import globalEnv from '../../libs/global_env' import { @@ -86,14 +87,8 @@ export function getMicroPathFromURL (appName: string): string | null { return isString(microPath) ? decodeMicroPath(microPath) : null } -type setMicroPathResult = { - fullPath: string, - searchHash: string, - isAttach2Hash: boolean, -} - // 将name=encodeUrl地址插入到浏览器url上 -export function setMicroPathToURL (appName: string, microLocation: MicroLocation): setMicroPathResult { +export function setMicroPathToURL (appName: string, microLocation: MicroLocation): HandleMicroPathResult { let { pathname, search, hash } = globalEnv.rawWindow.location const queryObject = getQueryObjectFromURL(search, hash) const encodedMicroPath = encodeMicroPath( @@ -128,17 +123,18 @@ export function setMicroPathToURL (appName: string, microLocation: MicroLocation return { fullPath: pathname + search + hash, - searchHash: search + hash, isAttach2Hash, } } // 将name=encodeUrl的参数从浏览器url上删除 -export function removeMicroPathFromURL (appName: string, targetLocation?: MicroLocation): string { +export function removeMicroPathFromURL (appName: string, targetLocation?: MicroLocation): HandleMicroPathResult { let { pathname, search, hash } = targetLocation || globalEnv.rawWindow.location const queryObject = getQueryObjectFromURL(search, hash) + let isAttach2Hash = false if (queryObject.hashQuery?.[formatQueryAppName(appName)]) { + isAttach2Hash = true delete queryObject.hashQuery?.[formatQueryAppName(appName)] const hashQueryStr = stringifyQuery(queryObject.hashQuery) hash = hash.slice(0, hash.indexOf('?') + Number(Boolean(hashQueryStr))) + hashQueryStr @@ -148,7 +144,10 @@ export function removeMicroPathFromURL (appName: string, targetLocation?: MicroL search = searchQueryStr ? '?' + searchQueryStr : '' } - return pathname + search + hash + return { + fullPath: pathname + search + hash, + isAttach2Hash, + } } /** diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index 9c4693e87..7de6df15f 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -7,6 +7,7 @@ import { updateMicroLocation } from './location' import globalEnv from '../../libs/global_env' type PopStateListener = (this: Window, e: PopStateEvent) => void +type MicroPopStateEvent = PopStateEvent & { onlyForParent?: boolean } /** * dispatch PopStateEvent & HashChangeEvent to child app @@ -18,9 +19,9 @@ type PopStateListener = (this: Window, e: PopStateEvent) => void export function addHistoryListener (appName: string): CallableFunction { const rawWindow = globalEnv.rawWindow // handle popstate event and distribute to child app - const popStateHandler: PopStateListener = (): void => { + const popStateHandler: PopStateListener = (e: MicroPopStateEvent): void => { // exclude hidden keep-alive app - if (getActiveApps(true).includes(appName)) { + if (getActiveApps(true).includes(appName) && !e.onlyForParent) { const microPath = getMicroPathFromURL(appName) const app = appInstanceMap.get(appName)! const proxyWindow = app.sandBox!.proxyWindow @@ -101,6 +102,33 @@ export function dispatchHashChangeEventToMicroApp ( /** * dispatch native PopStateEvent, simulate location behavior */ -export function dispatchNativePopStateEvent (): void { +function dispatchNativePopStateEvent (): void { globalEnv.rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) } + +/** + * dispatch hashchange event to browser + * @param oldHref old href of rawWindow.location + */ +function dispatchNativeHashChangeEvent (oldHref: string): void { + const newHashChangeEvent = new HashChangeEvent( + 'hashchange', + { + newURL: globalEnv.rawWindow.location.href, + oldURL: oldHref, + } + ) + + globalEnv.rawWindow.dispatchEvent(newHashChangeEvent) +} + +/** + * dispatch popstate & hashchange event to browser + * @param oldHref old href of rawWindow.location + */ +export function dispatchNativeEvent (oldHref?: string): void { + dispatchNativePopStateEvent() + if (oldHref) { + dispatchNativeHashChangeEvent(oldHref) + } +} diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 7ad3db541..ba9668580 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -3,53 +3,39 @@ import type { MicroLocation, MicroHistory, HistoryProxyValue, + HandleMicroPathResult, } from '@micro-app/types' import globalEnv from '../../libs/global_env' -import { isString, logError, createURL, isPlainObject, isURL, assign } from '../../libs/utils' -import { updateMicroLocation } from './location' +import { isString, createURL, isPlainObject, isURL, assign, isFunction } from '../../libs/utils' import { setMicroPathToURL, setMicroState, getMicroState } from './core' -import { dispatchNativePopStateEvent } from './event' +import { dispatchNativeEvent } from './event' // history of micro app export function createMicroHistory (appName: string, microLocation: MicroLocation): MicroHistory { - const rawHistory = globalEnv.rawWindow.history + const rawWindow = globalEnv.rawWindow + const rawHistory = rawWindow.history function getMicroHistoryMethod (methodName: PropertyKey): CallableFunction { - return (...rests: unknown[]) => { + return function (...rests: unknown[]): void { // console.log(444444444, rests[0], rests[1], rests[2], methodName) - let targetPath = null // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! if ( (methodName === 'pushState' || methodName === 'replaceState') && (isString(rests[2]) || isURL(rests[2])) ) { - try { - const targetLocation = createURL(rests[2], microLocation.href) - if (targetLocation.origin === microLocation.origin) { - targetPath = targetLocation.pathname + targetLocation.search + targetLocation.hash - const setMicroPathResult = setMicroPathToURL(appName, targetLocation) - rests = [ - setMicroState(appName, rawHistory.state, rests[0]), - rests[1], - setMicroPathResult.fullPath, - ] - } - } catch (e) { - logError(e, appName) + const targetLocation = createURL(rests[2], microLocation.href) + if (targetLocation.origin === microLocation.origin) { + navigateWithNativeEvent( + methodName, + setMicroPathToURL(appName, targetLocation), + setMicroState(appName, rawHistory.state, rests[0]), + rests[1] as string, + ) + } else { + rawHistory[methodName].apply(rawHistory, rests) } + } else { + rawHistory[methodName].apply(rawHistory, rests) } - - rawHistory[methodName].apply(rawHistory, rests) - - if (targetPath && targetPath !== microLocation.fullPath) { - /** - * microRoute query may be lost from browserURL after the main app handles the popstate event - * so we manually trigger the microLocation update - */ - updateMicroLocation(appName, targetPath, microLocation) - dispatchNativePopStateEvent() - } - - // console.log(5555555, microLocation, base) } } @@ -57,7 +43,7 @@ export function createMicroHistory (appName: string, microLocation: MicroLocatio get (target: History, key: PropertyKey): HistoryProxyValue { if (key === 'state') { return getMicroState(appName, rawHistory.state) - } else if (typeof Reflect.get(target, key) === 'function') { + } else if (isFunction(Reflect.get(target, key))) { return getMicroHistoryMethod(key) } return Reflect.get(target, key) @@ -72,35 +58,56 @@ export function createMicroHistory (appName: string, microLocation: MicroLocatio * navigate to new path base on native method of history * @param methodName pushState/replaceState * @param fullPath full path - * @param state history.state + * @param state history.state, default is null + * @param title history.title, default is '' */ -export function nativeHistoryNavigate (methodName: string, fullPath: string, state: unknown = null): void { - globalEnv.rawWindow.history[methodName](state, '', fullPath) +export function nativeHistoryNavigate ( + methodName: string, + fullPath: string, + state: unknown = null, + title = '', +): void { + globalEnv.rawWindow.history[methodName](state, title, fullPath) } /** * navigate to new path, and dispatch pure popstate event to browser * used to trigger base app router update * @param methodName pushState/replaceState - * @param fullPath full path - * @param state history.state + * @param result result of add/remove microApp path on browser url + * @param state history.state, not required + * @param title history.title, not required */ -export function navigateWithPopStateEvent (methodName: string, fullPath: string, state: unknown = null): void { - nativeHistoryNavigate(methodName, fullPath, state) - dispatchNativePopStateEvent() +export function navigateWithNativeEvent ( + methodName: string, + result: HandleMicroPathResult, + state?: unknown, + title?: string, +): void { + const rawLocation = globalEnv.rawWindow.location + const oldFullPath = rawLocation.pathname + rawLocation.search + rawLocation.hash + const oldHref = result.isAttach2Hash && oldFullPath !== result.fullPath ? rawLocation.href : null + // console.log(4444444, oldFullPath, result.fullPath, window.__MICRO_APP_ENVIRONMENT__) + // navigate + nativeHistoryNavigate(methodName, result.fullPath, state, title) + if (oldFullPath !== result.fullPath) dispatchNativeEvent(oldHref) } /** - * update browser url base on child location + * update browser url when mount/unmount/hidden/show + * @param result result of add/remove microApp path on browser url * @param state history.state - * @param fullPath full path */ -export function updateBrowserURL (state: MicroState, fullPath: string): void { - navigateWithPopStateEvent('replaceState', fullPath, state) +export function updateBrowserURL ( + result: HandleMicroPathResult, + state: MicroState, +): void { + navigateWithNativeEvent('replaceState', result, state) } /** - * When the old and new path are the same, keep the microAppState in history.state + * When path is same, keep the microAppState in history.state + * Fix bug of missing microAppState in next.js & angular * @param method history.pushState/replaceState */ function patchHistoryState (method: History['pushState' | 'replaceState']): CallableFunction { diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index 8b4197319..7674ea070 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -67,17 +67,16 @@ export function updateBrowserURLWithLocation ( microLocation: MicroLocation, defaultPage?: string, ): void { - if (defaultPage) { - updateMicroLocation(appName, defaultPage, microLocation, 'prevent') - } - const setMicroPathResult = setMicroPathToURL(appName, microLocation) + // update microLocation with defaultPage + if (defaultPage) updateMicroLocation(appName, defaultPage, microLocation, 'prevent') + // attach microApp route info to browser URL updateBrowserURL( + setMicroPathToURL(appName, microLocation), setMicroState( appName, globalEnv.rawWindow.history.state, null, ), - setMicroPathResult.fullPath, ) // trigger guards after change browser URL autoTriggerNavigationGuard(appName, microLocation) @@ -110,7 +109,7 @@ export function clearRouteStateFromURL ( */ export function removeStateAndPathFromBrowser (appName: string): void { updateBrowserURL( - removeMicroState(appName, globalEnv.rawWindow.history.state), removeMicroPathFromURL(appName), + removeMicroState(appName, globalEnv.rawWindow.history.state), ) } diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index 27fc59c9f..6b1222037 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -3,9 +3,9 @@ import type { MicroLocation, GuardLocation, ShadowLocation } from '@micro-app/ty import globalEnv from '../../libs/global_env' import { assign as oAssign, rawDefineProperties, createURL, noop } from '../../libs/utils' import { setMicroPathToURL } from './core' -import { dispatchNativePopStateEvent } from './event' +import { dispatchNativeEvent } from './event' import { executeNavigationGuard } from './api' -import { nativeHistoryNavigate, navigateWithPopStateEvent } from './history' +import { nativeHistoryNavigate, navigateWithNativeEvent } from './history' const shadowLocationKeys: ReadonlyArray = ['href', 'pathname', 'search', 'hash'] // origin is readonly, so we ignore when updateMicroLocation @@ -111,12 +111,14 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio targetLocation.pathname === shadowLocation.pathname && targetLocation.search === shadowLocation.search ) { + let oldHref = null if (targetLocation.hash !== shadowLocation.hash) { + if (setMicroPathResult.isAttach2Hash) oldHref = rawLocation.href nativeHistoryNavigate(methodName, setMicroPathResult.fullPath) } if (targetLocation.hash) { - dispatchNativePopStateEvent() + dispatchNativeEvent(oldHref) } else { rawLocation.reload() } @@ -163,7 +165,8 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio const targetLocation = createURL(targetPath, url) // When the browser url has a hash value, the same pathname/search will not refresh browser if (targetLocation[key] === shadowLocation[key] && shadowLocation.hash) { - dispatchNativePopStateEvent() + // The href has not changed, not need to dispatch hashchange event + dispatchNativeEvent() } else { /** * When the value is the same, no new route stack will be added @@ -212,7 +215,10 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio const targetLocation = createURL(targetPath, url) // The same hash will not trigger popStateEvent if (targetLocation.hash !== shadowLocation.hash) { - navigateWithPopStateEvent('pushState', setMicroPathToURL(appName, targetLocation).fullPath) + navigateWithNativeEvent( + 'pushState', + setMicroPathToURL(appName, targetLocation), + ) } } ), diff --git a/typings/global.d.ts b/typings/global.d.ts index 1b8761b56..aae5483b8 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -222,6 +222,7 @@ declare module '@micro-app/types' { fullPath: string [key: string]: any } + type MicroHistory = ProxyHandler type MicroState = any type HistoryProxyValue = @@ -329,6 +330,12 @@ declare module '@micro-app/types' { removeDefaultPage(appName: string): boolean getDefaultPage(key: PropertyKey): string | undefined } + + // result of add/remove microApp path on browser url + type HandleMicroPathResult = { + fullPath: string, + isAttach2Hash: boolean, + } } declare namespace JSX { From 12815fb2428b594c33ca247e3cc773d3621bbd8a Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Tue, 28 Jun 2022 20:05:10 +0800 Subject: [PATCH 036/268] fix: fixed bug of dispatch popStateEvent when use proxyHistory.pushState/replaceState --- dev/children/react16/src/index.js | 18 +++++----- dev/children/vue2/src/main.js | 17 +++++++++ dev/children/vue2/src/pages/page2.vue | 6 ++++ dev/main-react16/config/config.js | 2 +- dev/main-react16/src/global.jsx | 8 ++++- dev/main-react16/src/pages/react16/react16.js | 5 ++- dev/main-react16/src/pages/vue2/vue2.js | 11 ++++++ docs/zh-cn/questions.md | 4 +-- src/libs/utils.ts | 19 +++++----- src/sandbox/router/api.ts | 10 ++++++ src/sandbox/router/event.ts | 27 +++++++++----- src/sandbox/router/history.ts | 35 +++++++++++++------ src/sandbox/router/index.ts | 4 +-- src/sandbox/router/location.ts | 14 ++++---- 14 files changed, 128 insertions(+), 52 deletions(-) diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index f7982329d..c304f5d82 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -268,15 +268,15 @@ setTimeout(() => { }, 0); -// setTimeout(() => { -// // window.location.href = 'http://localhost:3001/micro-app/react16/#abc' -// // window.location.pathname = '/micro-app/react16/page2#fff' -// // window.location.assign('http://localhost:3001/micro-app/react16/page2#eee') -// // window.location.replace('http://localhost:3001/micro-app/react16/page2#eee') -// console.log(111111, window.location) - -// // window.history.scrollRestoration = 'manual' -// }, 5000); +setTimeout(() => { + // window.location.href = 'http://localhost:3001/micro-app/react16/#abc' + // window.location.pathname = '/micro-app/react16/page2#fff' + // window.location.assign('http://localhost:3001/micro-app/react16/page2#eee') + // window.location.replace('http://localhost:3001/micro-app/react16/page2#eee') + console.log(111111, window.location) + + // window.history.scrollRestoration = 'manual' +}, 5000); window.addEventListener('popstate', (e) => { console.log('子应用 popstate', e) diff --git a/dev/children/vue2/src/main.js b/dev/children/vue2/src/main.js index b6eef461c..99ede4432 100644 --- a/dev/children/vue2/src/main.js +++ b/dev/children/vue2/src/main.js @@ -18,6 +18,15 @@ const router = new VueRouter({ routes, }) +router.beforeEach((to, from, next) => { + console.log('vue2 路由钩子 beforeEach', to, from, location.href) + next() +}) + +router.afterEach((to, from) => { + console.log('vue2 路由钩子 afterEach', to, from, location.href) +}) + let app = null // -------------------分割线-默认模式------------------ // @@ -63,3 +72,11 @@ if (window.__MICRO_APP_ENVIRONMENT__) { // 非微前端环境直接渲染 mount() } + +window.addEventListener('popstate', (e) => { + console.log('子应用vue2 popstate', e) +}) + +window.addEventListener('hashchange', (e) => { + console.log('子应用vue2 hashchange', e, e.newURL, e.oldURL) +}) diff --git a/dev/children/vue2/src/pages/page2.vue b/dev/children/vue2/src/pages/page2.vue index 3049ad87f..32a885fbd 100644 --- a/dev/children/vue2/src/pages/page2.vue +++ b/dev/children/vue2/src/pages/page2.vue @@ -105,6 +105,12 @@ export default { } }; }, + created () { + console.log('vue2 page2 created') + }, + mounted () { + console.log('vue2 page2 mounted') + }, methods: { submitForm(formName) { this.$refs[formName].validate((valid) => { diff --git a/dev/main-react16/config/config.js b/dev/main-react16/config/config.js index 512d77c6a..9b57db9dd 100644 --- a/dev/main-react16/config/config.js +++ b/dev/main-react16/config/config.js @@ -14,7 +14,7 @@ export default defineConfig({ hmr: true, }, history: { - type: 'browser', // browser hash + type: 'hash', // browser hash }, locale: { // default zh-CN diff --git a/dev/main-react16/src/global.jsx b/dev/main-react16/src/global.jsx index d7f7c9332..377985560 100644 --- a/dev/main-react16/src/global.jsx +++ b/dev/main-react16/src/global.jsx @@ -130,9 +130,15 @@ microApp.start({ // }, 10000) window.addEventListener('popstate', (e) => { - console.log('popstate', e) + // const a = document.createElement('div') + // a.innerHTML = '55555555' + // document.body.appendChild(a) + console.log('popstate', e, window.location.href) }) window.addEventListener('hashchange', (e) => { + // const a = document.createElement('div') + // a.innerHTML = '666666666' + // document.body.appendChild(a) console.log('hashchange', e, e.newURL, e.oldURL) }) diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index f79ec51ce..f198dfac8 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -133,7 +133,7 @@ export default class App extends React.Component { this.setState({ testNum: this.state.testNum + 1, }) - console.log(33333, this.props.history) + // console.log(33333, this.props.history) } jumpToHome = () => { @@ -183,6 +183,9 @@ export default class App extends React.Component { microApp.addGlobalDataListener(this.handleGlobalDataForBaseApp) this.releaseBeforeEach1 = microApp.router.beforeEach((to, from, appName) => { + // const a = document.createElement('div') + // a.innerHTML = '44444444' + // document.body.appendChild(a) console.log('全局 beforeEach: ', to, from, appName) }) diff --git a/dev/main-react16/src/pages/vue2/vue2.js b/dev/main-react16/src/pages/vue2/vue2.js index 25d611b53..db4abdbf5 100644 --- a/dev/main-react16/src/pages/vue2/vue2.js +++ b/dev/main-react16/src/pages/vue2/vue2.js @@ -39,6 +39,17 @@ function Vue2 () { useEffect(() => { console.time('vue2') console.time('mounted-vue2') + const releaseBeforeEach1 = microApp.router.beforeEach((to, from, appName) => { + console.log('micro-app 全局 beforeEach: ', to, from, appName, window.location.hash) + }) + + const releaseAfterEach1 = microApp.router.afterEach((to, from, appName) => { + console.log('micro-app 全局 afterEach: ', to, from, appName, window.location.hash) + }) + return () => { + releaseBeforeEach1() + releaseAfterEach1() + } }, []) return (
diff --git a/docs/zh-cn/questions.md b/docs/zh-cn/questions.md index 6f8f656c1..698636cbf 100644 --- a/docs/zh-cn/questions.md +++ b/docs/zh-cn/questions.md @@ -5,9 +5,9 @@ 微前端的本质是将两个不相关的页面强行合并为一,这其中不可避免会出现各种冲突,虽然微前端框架解决了几乎所有的冲突,但偶尔也会有特殊情况出现,这需要开发者具有处理特殊情况的能力和心态。 -微前端框架不是万能的,它的实现原理注定永远无法达到iframe一样的稳定。 +微前端不是万能的,它的实现原理注定无法像iframe一样简单稳定。 -所以如果你不知道自己是否需要用微前端,就是不需要。 +如果你不知道自己是否需要用微前端,那么大概率是不需要。 ## 2、子应用一定要支持跨域吗? 是的! diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 2539d4b54..3f33f9a67 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -124,15 +124,16 @@ export function defer (fn: Func, ...args: unknown[]): void { Promise.resolve().then(fn.bind(null, ...args)) } -// export const createURL = (function (): (p: string | URL, b?: string) => MicroLocation { -// class Location extends URL {} -// return (path: string | URL, base?: string): MicroLocation => { -// return (base ? new Location('' + path, base) : new Location('' + path)) as MicroLocation -// } -// })() -export function createURL (path: string | URL, base?: string): MicroLocation { - return (base ? new URL('' + path, base) : new URL('' + path)) as MicroLocation -} +/** + * create URL as MicroLocation + */ +export const createURL = (function (): (p: string | URL, b?: string) => MicroLocation { + class Location extends URL {} + return (path: string | URL, base?: string): MicroLocation => { + return (base ? new Location('' + path, base) : new Location('' + path)) as MicroLocation + } +})() + /** * Add address protocol * @param url address diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index fa4f9a5b9..4da11a015 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -24,6 +24,7 @@ import { requestIdleCallback, isString, noopFalse, + removeDomScope, } from '../../libs/utils' import { appInstanceMap } from '../../create_app' import { getActiveApps } from '../../micro_app' @@ -53,12 +54,15 @@ function createRouterApi (): RouterApi { navigateWithNativeEvent( methodName, setMicroPathToURL(appName, targetLocation), + false, setMicroState( appName, globalEnv.rawWindow.history.state, state ?? null, ), ) + // clear element scope after navigate + removeDomScope() } /** * create method of router.push/replace @@ -120,6 +124,10 @@ function createRouterApi (): RouterApi { /** * run all of beforeEach/afterEach guards + * NOTE: + * 1. Modify browser url first, and then run guards, + * consistent with the browser forward & back button + * 2. Note the element binding * @param appName app name * @param to target location * @param from old location @@ -131,6 +139,8 @@ function createRouterApi (): RouterApi { from: GuardLocation, guards: Set, ) { + // clear element scope before execute function of parent + removeDomScope() for (const guard of guards) { if (isFunction(guard)) { guard(appName, to, from) diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index 7de6df15f..2692205e3 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -5,9 +5,10 @@ import { formatEventName } from '../effect' import { getMicroPathFromURL, getMicroState } from './core' import { updateMicroLocation } from './location' import globalEnv from '../../libs/global_env' +import { removeDomScope } from '../../libs/utils' type PopStateListener = (this: Window, e: PopStateEvent) => void -type MicroPopStateEvent = PopStateEvent & { onlyForParent?: boolean } +type MicroPopStateEvent = PopStateEvent & { onlyForBrowser?: boolean } /** * dispatch PopStateEvent & HashChangeEvent to child app @@ -21,7 +22,7 @@ export function addHistoryListener (appName: string): CallableFunction { // handle popstate event and distribute to child app const popStateHandler: PopStateListener = (e: MicroPopStateEvent): void => { // exclude hidden keep-alive app - if (getActiveApps(true).includes(appName) && !e.onlyForParent) { + if (getActiveApps(true).includes(appName) && !e.onlyForBrowser) { const microPath = getMicroPathFromURL(appName) const app = appInstanceMap.get(appName)! const proxyWindow = app.sandBox!.proxyWindow @@ -35,12 +36,14 @@ export function addHistoryListener (appName: string): CallableFunction { isHashChange = proxyWindow.location.hash !== oldHash } - // console.log(333333, microPath, proxyWindow.location) - + // dispatch formatted popStateEvent to child dispatchPopStateEventToMicroApp(appName, proxyWindow, rawWindow.history.state) - // send HashChangeEvent when hash change + // dispatch formatted hashChangeEvent to child when hash change if (isHashChange) dispatchHashChangeEventToMicroApp(appName, proxyWindow, oldHref) + + // clear element scope before trigger event of next app + removeDomScope() } } @@ -101,9 +104,12 @@ export function dispatchHashChangeEventToMicroApp ( /** * dispatch native PopStateEvent, simulate location behavior + * @param onlyForBrowser only dispatch PopStateEvent to browser */ -function dispatchNativePopStateEvent (): void { - globalEnv.rawWindow.dispatchEvent(new PopStateEvent('popstate', { state: null })) +function dispatchNativePopStateEvent (onlyForBrowser: boolean): void { + const event = new PopStateEvent('popstate', { state: null }) as MicroPopStateEvent + if (onlyForBrowser) event.onlyForBrowser = true + globalEnv.rawWindow.dispatchEvent(event) } /** @@ -124,10 +130,13 @@ function dispatchNativeHashChangeEvent (oldHref: string): void { /** * dispatch popstate & hashchange event to browser + * @param onlyForBrowser only dispatch event to browser * @param oldHref old href of rawWindow.location */ -export function dispatchNativeEvent (oldHref?: string): void { - dispatchNativePopStateEvent() +export function dispatchNativeEvent (onlyForBrowser: boolean, oldHref?: string): void { + // clear element scope before dispatch global event + removeDomScope() + dispatchNativePopStateEvent(onlyForBrowser) if (oldHref) { dispatchNativeHashChangeEvent(oldHref) } diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index ba9668580..5e7cbbda5 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -9,15 +9,18 @@ import globalEnv from '../../libs/global_env' import { isString, createURL, isPlainObject, isURL, assign, isFunction } from '../../libs/utils' import { setMicroPathToURL, setMicroState, getMicroState } from './core' import { dispatchNativeEvent } from './event' +import { updateMicroLocation } from './location' -// history of micro app +/** + * create proxyHistory for microApp + * MDN https://developer.mozilla.org/en-US/docs/Web/API/History + * @param appName app name + * @param microLocation microApp location + */ export function createMicroHistory (appName: string, microLocation: MicroLocation): MicroHistory { - const rawWindow = globalEnv.rawWindow - const rawHistory = rawWindow.history + const rawHistory = globalEnv.rawWindow.history function getMicroHistoryMethod (methodName: PropertyKey): CallableFunction { return function (...rests: unknown[]): void { - // console.log(444444444, rests[0], rests[1], rests[2], methodName) - // 对pushState/replaceState的state和path进行格式化,这里最关键的一步!! if ( (methodName === 'pushState' || methodName === 'replaceState') && (isString(rests[2]) || isURL(rests[2])) @@ -27,9 +30,14 @@ export function createMicroHistory (appName: string, microLocation: MicroLocatio navigateWithNativeEvent( methodName, setMicroPathToURL(appName, targetLocation), + true, setMicroState(appName, rawHistory.state, rests[0]), rests[1] as string, ) + const targetFullPath = targetLocation.pathname + targetLocation.search + targetLocation.hash + if (targetFullPath !== microLocation.fullPath) { + updateMicroLocation(appName, targetFullPath, microLocation) + } } else { rawHistory[methodName].apply(rawHistory, rests) } @@ -71,26 +79,31 @@ export function nativeHistoryNavigate ( } /** - * navigate to new path, and dispatch pure popstate event to browser - * used to trigger base app router update + * Navigate to new path, and dispatch native popStateEvent/hashChangeEvent to browser + * Use scenes: + * 1. mount/unmount through updateBrowserURL with limited popstateEvent + * 2. proxyHistory.pushState/replaceState with limited popstateEvent + * 3. api microApp.router.push/replace + * 4. proxyLocation.hash = xxx * @param methodName pushState/replaceState * @param result result of add/remove microApp path on browser url + * @param onlyForBrowser only dispatch event to browser * @param state history.state, not required * @param title history.title, not required */ export function navigateWithNativeEvent ( methodName: string, result: HandleMicroPathResult, + onlyForBrowser: boolean, state?: unknown, title?: string, ): void { const rawLocation = globalEnv.rawWindow.location const oldFullPath = rawLocation.pathname + rawLocation.search + rawLocation.hash const oldHref = result.isAttach2Hash && oldFullPath !== result.fullPath ? rawLocation.href : null - // console.log(4444444, oldFullPath, result.fullPath, window.__MICRO_APP_ENVIRONMENT__) - // navigate + // navigate with native history method nativeHistoryNavigate(methodName, result.fullPath, state, title) - if (oldFullPath !== result.fullPath) dispatchNativeEvent(oldHref) + if (oldFullPath !== result.fullPath) dispatchNativeEvent(onlyForBrowser, oldHref) } /** @@ -102,7 +115,7 @@ export function updateBrowserURL ( result: HandleMicroPathResult, state: MicroState, ): void { - navigateWithNativeEvent('replaceState', result, state) + navigateWithNativeEvent('replaceState', result, true, state) } /** diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index 7674ea070..061b9b95e 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -26,11 +26,9 @@ export { router } from './api' export { addHistoryListener } from './event' export { getNoHashMicroPathFromURL } from './core' -// 所谓路由系统,无非两种操作:读、写 -// 读是通过location,写是通过replace/pushState /** * The router system has two operations: read and write - * Read through location and write through replaceState/pushState/location + * Read through location and write through history & location * @param appName app name * @param url app url * @returns MicroRouter diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index 6b1222037..6becaf64a 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -29,13 +29,14 @@ export function autoTriggerNavigationGuard (appName: string, microLocation: Micr } /** - * There are three situations that trigger location update: + * The following scenes will trigger location update: * 1. pushState/replaceState * 2. popStateEvent * 3. query on browser url when init sub app * 4. set defaultPage when when init sub app * NOTE: - * 1. update browser URL, and then update microLocation + * 1. update browser URL first, and then update microLocation + * 2. the same fullPath will not trigger router guards * @param appName app name * @param path target path * @param base base url @@ -70,8 +71,8 @@ export function updateMicroLocation ( } /** - * Create location for micro app - * Each microApp has only one location object, it is a reference type + * Create location for microApp, each microApp has only one location object, it is a reference type + * MDN https://developer.mozilla.org/en-US/docs/Web/API/Location * @param appName app name * @param url app url */ @@ -118,7 +119,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio } if (targetLocation.hash) { - dispatchNativeEvent(oldHref) + dispatchNativeEvent(false, oldHref) } else { rawLocation.reload() } @@ -166,7 +167,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio // When the browser url has a hash value, the same pathname/search will not refresh browser if (targetLocation[key] === shadowLocation[key] && shadowLocation.hash) { // The href has not changed, not need to dispatch hashchange event - dispatchNativeEvent() + dispatchNativeEvent(false) } else { /** * When the value is the same, no new route stack will be added @@ -218,6 +219,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio navigateWithNativeEvent( 'pushState', setMicroPathToURL(appName, targetLocation), + false, ) } } From d6c4396af5c15a93af132cad8a13c6ebca933627 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 29 Jun 2022 20:45:10 +0800 Subject: [PATCH 037/268] feat: add request hajiack demo --- dev/children/angular11/package.json | 4 +- dev/children/react16/config/webpack.config.js | 8 +- .../react16/config/webpackDevServer.config.js | 4 +- dev/children/react16/package.json | 10 +- dev/children/react16/src/index.js | 14 +- dev/children/react16/src/router.js | 2 +- dev/children/react16/yarn.lock | 3724 +++++++++-------- dev/main-vue2/vue.config.js | 2 +- src/__tests__/create_app.test.ts | 4 +- src/create_app.ts | 14 +- src/{ => libs}/constants.ts | 20 +- src/micro_app.ts | 2 +- src/micro_app_element.ts | 8 +- src/sandbox/index.ts | 57 +- src/sandbox/router/api.ts | 8 +- src/sandbox/router/index.ts | 4 +- src/source/scripts.ts | 2 +- 17 files changed, 2063 insertions(+), 1824 deletions(-) rename src/{ => libs}/constants.ts (67%) diff --git a/dev/children/angular11/package.json b/dev/children/angular11/package.json index ce7613458..e28b2bfbc 100644 --- a/dev/children/angular11/package.json +++ b/dev/children/angular11/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "scripts": { "ng": "ng", - "start": "ng serve --port 6001 --live-reload false", + "start": "ng serve --port 6001", "build": "ng build", "test": "ng test", "lint": "ng lint", @@ -44,4 +44,4 @@ "tslint": "~6.1.0", "typescript": "~4.1.2" } -} \ No newline at end of file +} diff --git a/dev/children/react16/config/webpack.config.js b/dev/children/react16/config/webpack.config.js index 3755f448d..7a031fdd6 100644 --- a/dev/children/react16/config/webpack.config.js +++ b/dev/children/react16/config/webpack.config.js @@ -92,8 +92,8 @@ module.exports = function (webpackEnv) { // Get environment variables to inject into our app. const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1)); - // TODO: 热更新问题 - const shouldUseReactRefresh = env.raw.FAST_REFRESH && false + // 热更新 + const shouldUseReactRefresh = env.raw.FAST_REFRESH; // common function to get style loaders const getStyleLoaders = (cssOptions, preProcessor) => { @@ -617,8 +617,8 @@ module.exports = function (webpackEnv) { // Otherwise React will be compiled in the very slow development mode. new webpack.DefinePlugin(env.stringified), // This is necessary to emit hot updates (CSS and Fast Refresh): - // TODO: 热更新问题 - // isEnvDevelopment && new webpack.HotModuleReplacementPlugin(), + // 热更新 + isEnvDevelopment && new webpack.HotModuleReplacementPlugin(), // Experimental hot reloading for React . // https://github.com/facebook/react/tree/master/packages/react-refresh isEnvDevelopment && diff --git a/dev/children/react16/config/webpackDevServer.config.js b/dev/children/react16/config/webpackDevServer.config.js index ba45ddeed..30858dff6 100644 --- a/dev/children/react16/config/webpackDevServer.config.js +++ b/dev/children/react16/config/webpackDevServer.config.js @@ -62,8 +62,8 @@ module.exports = function (proxy, allowedHost) { // updated. The WebpackDevServer client is included as an entry point // in the webpack development configuration. Note that only changes // to CSS are currently hot reloaded. JS changes will refresh the browser. - // TODO: 热更新问题 - // hot: true, + // 热更新 + hot: true, // Use 'ws' instead of 'sockjs-node' on server since we're using native // websockets in `webpackHotDevClient`. transportMode: 'ws', diff --git a/dev/children/react16/package.json b/dev/children/react16/package.json index eb3b0f577..75e87c358 100644 --- a/dev/children/react16/package.json +++ b/dev/children/react16/package.json @@ -86,7 +86,7 @@ "@ant-design/icons": "~4.6.2", "@babel/core": "7.12.3", "@babel/polyfill": "~7.12.1", - "@pmmmwh/react-refresh-webpack-plugin": "0.4.2", + "@pmmmwh/react-refresh-webpack-plugin": "0.5.7", "@svgr/webpack": "5.4.0", "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", @@ -140,7 +140,7 @@ "react-dev-utils": "^11.0.1", "react-dom": "16.13.0", "react-inlinesvg": "~2.3.0", - "react-refresh": "^0.8.3", + "react-refresh": "^0.14.0", "react-router-dom": "5.2.0", "resolve": "1.18.1", "resolve-url-loader": "^3.1.2", @@ -162,5 +162,11 @@ "webpack-cli": "~4.5.0", "webpack-dev-server": "~3.11.2", "webpack-manifest-plugin": "2.2.0" + }, + "resolutions": { + "react-error-overlay": "6.0.9" + }, + "overrides": { + "react-error-overlay": "6.0.9" } } diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index c304f5d82..518202335 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -222,7 +222,7 @@ window.addEventListener('unmount', function () { // ----------------------分割线--接口相关--------------------- // // 测试proxy代理 -fetch('http://localhost:3001/sugrec').then((res) => { +fetch('/sugrec').then((res) => { return res.json() }).then((data) => { console.log('proxy代理 https://www.baidu.com/sugrec 返回数据', data) @@ -259,13 +259,13 @@ if (window.__MICRO_APP_ENVIRONMENT__) { document.body.appendChild(unBoundDom2) } -// 注意:!!!! 无论任何使用window.xx的情况都会重新触发元素绑定 -const _window = new Function('return window')() +// // 注意:!!!! 无论任何使用window.xx的情况都会重新触发元素绑定 +// const _window = new Function('return window')() -setTimeout(() => { - // window.microApp.removeDomScope() - console.log(_window.document.getElementById('root')) -}, 0); +// setTimeout(() => { +// // window.microApp.removeDomScope() +// console.log(_window.document.getElementById('root')) +// }, 0); setTimeout(() => { diff --git a/dev/children/react16/src/router.js b/dev/children/react16/src/router.js index 02e7a28b4..d2cfc4a0d 100644 --- a/dev/children/react16/src/router.js +++ b/dev/children/react16/src/router.js @@ -1,5 +1,5 @@ import React, { lazy, Suspense, useState, useEffect } from 'react' -import { BrowserRouter, Switch, Route, Redirect, Link, HashRouter } from 'react-router-dom' +import { BrowserRouter, Switch, Route, Redirect, Link } from 'react-router-dom' import Page1 from './pages/page1/page1' import { Menu } from 'antd'; import { MailOutlined, AppstoreOutlined } from '@ant-design/icons'; diff --git a/dev/children/react16/yarn.lock b/dev/children/react16/yarn.lock index ada3e9196..0f85dc87d 100644 --- a/dev/children/react16/yarn.lock +++ b/dev/children/react16/yarn.lock @@ -2,6 +2,14 @@ # yarn lockfile v1 +"@ampproject/remapping@^2.1.0": + version "2.2.0" + resolved "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d" + integrity sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w== + dependencies: + "@jridgewell/gen-mapping" "^0.1.0" + "@jridgewell/trace-mapping" "^0.3.9" + "@ant-design/colors@^6.0.0": version "6.0.0" resolved "https://registry.npmjs.org/@ant-design/colors/-/colors-6.0.0.tgz#9b9366257cffcc47db42b9d0203bb592c13c0298" @@ -61,17 +69,17 @@ dependencies: "@babel/highlight" "^7.10.4" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.5.5": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" - integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.18.6", "@babel/code-frame@^7.5.5": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" + integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q== dependencies: - "@babel/highlight" "^7.16.7" + "@babel/highlight" "^7.18.6" -"@babel/compat-data@^7.13.11", "@babel/compat-data@^7.16.4": - version "7.16.4" - resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.4.tgz#081d6bbc336ec5c2435c6346b2ae1fb98b5ac68e" - integrity sha512-1o/jo7D+kC9ZjHX5v+EHrdjl3PhxMrLSOTGsOdHJ+KL8HCaEK6ehrVL2RS6oHDZp+L7xLirLrPmQtEng769J/Q== +"@babel/compat-data@^7.13.11", "@babel/compat-data@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.18.6.tgz#8b37d24e88e8e21c499d4328db80577d8882fa53" + integrity sha512-tzulrgDT0QD6U7BJ4TKVk2SDDg7wlP39P9yAx1RfLy7vP/7rsDRlWVfbWxElslu56+r7QOhB2NSDsabYYruoZQ== "@babel/core@7.12.3": version "7.12.3" @@ -96,85 +104,85 @@ source-map "^0.5.0" "@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.16.0", "@babel/core@^7.7.5", "@babel/core@^7.8.4", "@babel/core@^7.9.0": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/core/-/core-7.16.7.tgz#db990f931f6d40cb9b87a0dc7d2adc749f1dcbcf" - integrity sha512-aeLaqcqThRNZYmbMqtulsetOQZ/5gbR/dWruUCJcpas4Qoyy+QeagfDsPdMrqwsPRDNxJvBlRiZxxX7THO7qtA== - dependencies: - "@babel/code-frame" "^7.16.7" - "@babel/generator" "^7.16.7" - "@babel/helper-compilation-targets" "^7.16.7" - "@babel/helper-module-transforms" "^7.16.7" - "@babel/helpers" "^7.16.7" - "@babel/parser" "^7.16.7" - "@babel/template" "^7.16.7" - "@babel/traverse" "^7.16.7" - "@babel/types" "^7.16.7" + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/core/-/core-7.18.6.tgz#54a107a3c298aee3fe5e1947a6464b9b6faca03d" + integrity sha512-cQbWBpxcbbs/IUredIPkHiAGULLV8iwgNRMFzvbhEXISp4f3rUUXE5+TIw6KwUWUR3DwyI6gmBRnmAtYaWehwQ== + dependencies: + "@ampproject/remapping" "^2.1.0" + "@babel/code-frame" "^7.18.6" + "@babel/generator" "^7.18.6" + "@babel/helper-compilation-targets" "^7.18.6" + "@babel/helper-module-transforms" "^7.18.6" + "@babel/helpers" "^7.18.6" + "@babel/parser" "^7.18.6" + "@babel/template" "^7.18.6" + "@babel/traverse" "^7.18.6" + "@babel/types" "^7.18.6" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" - json5 "^2.1.2" + json5 "^2.2.1" semver "^6.3.0" - source-map "^0.5.0" -"@babel/generator@^7.12.1", "@babel/generator@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.16.7.tgz#b42bf46a3079fa65e1544135f32e7958f048adbb" - integrity sha512-/ST3Sg8MLGY5HVYmrjOgL60ENux/HfO/CsUh7y4MalThufhE/Ff/6EibFDHi4jiDCaWfJKoqbE6oTh21c5hrRg== +"@babel/generator@^7.12.1", "@babel/generator@^7.18.6": + version "7.18.7" + resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.18.7.tgz#2aa78da3c05aadfc82dbac16c99552fc802284bd" + integrity sha512-shck+7VLlY72a2w9c3zYWuE1pwOKEiQHV7GTUbSnhyl5eu3i04t30tBY82ZRWrDfo3gkakCFtevExnxbkf2a3A== dependencies: - "@babel/types" "^7.16.7" + "@babel/types" "^7.18.7" + "@jridgewell/gen-mapping" "^0.3.2" jsesc "^2.5.1" - source-map "^0.5.0" -"@babel/helper-annotate-as-pure@^7.16.0", "@babel/helper-annotate-as-pure@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz#bb2339a7534a9c128e3102024c60760a3a7f3862" - integrity sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw== +"@babel/helper-annotate-as-pure@^7.16.0", "@babel/helper-annotate-as-pure@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz#eaa49f6f80d5a33f9a5dd2276e6d6e451be0a6bb" + integrity sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA== dependencies: - "@babel/types" "^7.16.7" + "@babel/types" "^7.18.6" -"@babel/helper-builder-binary-assignment-operator-visitor@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.16.7.tgz#38d138561ea207f0f69eb1626a418e4f7e6a580b" - integrity sha512-C6FdbRaxYjwVu/geKW4ZeQ0Q31AftgRcdSnZ5/jsH6BzCJbtvXvhpfkbkThYSuutZA7nCXpPR6AD9zd1dprMkA== +"@babel/helper-builder-binary-assignment-operator-visitor@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.18.6.tgz#f14d640ed1ee9246fb33b8255f08353acfe70e6a" + integrity sha512-KT10c1oWEpmrIRYnthbzHgoOf6B+Xd6a5yhdbNtdhtG7aO1or5HViuf1TQR36xY/QprXA5nvxO6nAjhJ4y38jw== dependencies: - "@babel/helper-explode-assignable-expression" "^7.16.7" - "@babel/types" "^7.16.7" + "@babel/helper-explode-assignable-expression" "^7.18.6" + "@babel/types" "^7.18.6" -"@babel/helper-compilation-targets@^7.13.0", "@babel/helper-compilation-targets@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz#06e66c5f299601e6c7da350049315e83209d551b" - integrity sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA== +"@babel/helper-compilation-targets@^7.13.0", "@babel/helper-compilation-targets@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.6.tgz#18d35bfb9f83b1293c22c55b3d576c1315b6ed96" + integrity sha512-vFjbfhNCzqdeAtZflUFrG5YIFqGTqsctrtkZ1D/NB0mDW9TwW3GmmUepYY4G9wCET5rY5ugz4OGTcLd614IzQg== dependencies: - "@babel/compat-data" "^7.16.4" - "@babel/helper-validator-option" "^7.16.7" - browserslist "^4.17.5" + "@babel/compat-data" "^7.18.6" + "@babel/helper-validator-option" "^7.18.6" + browserslist "^4.20.2" semver "^6.3.0" -"@babel/helper-create-class-features-plugin@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.7.tgz#9c5b34b53a01f2097daf10678d65135c1b9f84ba" - integrity sha512-kIFozAvVfK05DM4EVQYKK+zteWvY85BFdGBRQBytRyY3y+6PX0DkDOn/CZ3lEuczCfrCxEzwt0YtP/87YPTWSw== +"@babel/helper-create-class-features-plugin@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.18.6.tgz#6f15f8459f3b523b39e00a99982e2c040871ed72" + integrity sha512-YfDzdnoxHGV8CzqHGyCbFvXg5QESPFkXlHtvdCkesLjjVMT2Adxe4FGUR5ChIb3DxSaXO12iIOCWoXdsUVwnqw== dependencies: - "@babel/helper-annotate-as-pure" "^7.16.7" - "@babel/helper-environment-visitor" "^7.16.7" - "@babel/helper-function-name" "^7.16.7" - "@babel/helper-member-expression-to-functions" "^7.16.7" - "@babel/helper-optimise-call-expression" "^7.16.7" - "@babel/helper-replace-supers" "^7.16.7" - "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/helper-annotate-as-pure" "^7.18.6" + "@babel/helper-environment-visitor" "^7.18.6" + "@babel/helper-function-name" "^7.18.6" + "@babel/helper-member-expression-to-functions" "^7.18.6" + "@babel/helper-optimise-call-expression" "^7.18.6" + "@babel/helper-replace-supers" "^7.18.6" + "@babel/helper-split-export-declaration" "^7.18.6" -"@babel/helper-create-regexp-features-plugin@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.16.7.tgz#0cb82b9bac358eb73bfbd73985a776bfa6b14d48" - integrity sha512-fk5A6ymfp+O5+p2yCkXAu5Kyj6v0xh0RBeNcAkYUMDvvAAoxvSKXn+Jb37t/yWFiQVDFK1ELpUTD8/aLhCPu+g== +"@babel/helper-create-regexp-features-plugin@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.18.6.tgz#3e35f4e04acbbf25f1b3534a657610a000543d3c" + integrity sha512-7LcpH1wnQLGrI+4v+nPp+zUvIkF9x0ddv1Hkdue10tg3gmRnLy97DXh4STiOf1qeIInyD69Qv5kKSZzKD8B/7A== dependencies: - "@babel/helper-annotate-as-pure" "^7.16.7" - regexpu-core "^4.7.1" + "@babel/helper-annotate-as-pure" "^7.18.6" + regexpu-core "^5.1.0" -"@babel/helper-define-polyfill-provider@^0.3.0": - version "0.3.0" - resolved "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.0.tgz#c5b10cf4b324ff840140bb07e05b8564af2ae971" - integrity sha512-7hfT8lUljl/tM3h+izTX/pO3W3frz2ok6Pk+gzys8iJqDfZrZy2pXjRTZAvG2YmfHun1X4q8/UZRLatMfqc5Tg== +"@babel/helper-define-polyfill-provider@^0.3.1": + version "0.3.1" + resolved "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.1.tgz#52411b445bdb2e676869e5a74960d2d3826d2665" + integrity sha512-J9hGMpJQmtWmj46B3kBHmL38UhJGhYX7eqkcq+2gsstyYt341HmPeWspihX43yVRA0mS+8GGk2Gckc7bY/HCmA== dependencies: "@babel/helper-compilation-targets" "^7.13.0" "@babel/helper-module-imports" "^7.12.13" @@ -185,319 +193,313 @@ resolve "^1.14.2" semver "^6.1.2" -"@babel/helper-environment-visitor@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz#ff484094a839bde9d89cd63cba017d7aae80ecd7" - integrity sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag== - dependencies: - "@babel/types" "^7.16.7" - -"@babel/helper-explode-assignable-expression@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.16.7.tgz#12a6d8522fdd834f194e868af6354e8650242b7a" - integrity sha512-KyUenhWMC8VrxzkGP0Jizjo4/Zx+1nNZhgocs+gLzyZyB8SHidhoq9KK/8Ato4anhwsivfkBLftky7gvzbZMtQ== - dependencies: - "@babel/types" "^7.16.7" - -"@babel/helper-function-name@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz#f1ec51551fb1c8956bc8dd95f38523b6cf375f8f" - integrity sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA== - dependencies: - "@babel/helper-get-function-arity" "^7.16.7" - "@babel/template" "^7.16.7" - "@babel/types" "^7.16.7" - -"@babel/helper-get-function-arity@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz#ea08ac753117a669f1508ba06ebcc49156387419" - integrity sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw== +"@babel/helper-environment-visitor@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.6.tgz#b7eee2b5b9d70602e59d1a6cad7dd24de7ca6cd7" + integrity sha512-8n6gSfn2baOY+qlp+VSzsosjCVGFqWKmDF0cCWOybh52Dw3SEyoWR1KrhMJASjLwIEkkAufZ0xvr+SxLHSpy2Q== + +"@babel/helper-explode-assignable-expression@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.18.6.tgz#41f8228ef0a6f1a036b8dfdfec7ce94f9a6bc096" + integrity sha512-eyAYAsQmB80jNfg4baAtLeWAQHfHFiR483rzFK+BhETlGZaQC9bsfrugfXDCbRHLQbIA7U5NxhhOxN7p/dWIcg== dependencies: - "@babel/types" "^7.16.7" - -"@babel/helper-hoist-variables@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz#86bcb19a77a509c7b77d0e22323ef588fa58c246" - integrity sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg== - dependencies: - "@babel/types" "^7.16.7" - -"@babel/helper-member-expression-to-functions@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.7.tgz#42b9ca4b2b200123c3b7e726b0ae5153924905b0" - integrity sha512-VtJ/65tYiU/6AbMTDwyoXGPKHgTsfRarivm+YbB5uAzKUyuPjgZSgAFeG87FCigc7KNHu2Pegh1XIT3lXjvz3Q== - dependencies: - "@babel/types" "^7.16.7" - -"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.16.0", "@babel/helper-module-imports@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz#25612a8091a999704461c8a222d0efec5d091437" - integrity sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg== - dependencies: - "@babel/types" "^7.16.7" - -"@babel/helper-module-transforms@^7.12.1", "@babel/helper-module-transforms@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz#7665faeb721a01ca5327ddc6bba15a5cb34b6a41" - integrity sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng== - dependencies: - "@babel/helper-environment-visitor" "^7.16.7" - "@babel/helper-module-imports" "^7.16.7" - "@babel/helper-simple-access" "^7.16.7" - "@babel/helper-split-export-declaration" "^7.16.7" - "@babel/helper-validator-identifier" "^7.16.7" - "@babel/template" "^7.16.7" - "@babel/traverse" "^7.16.7" - "@babel/types" "^7.16.7" - -"@babel/helper-optimise-call-expression@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.7.tgz#a34e3560605abbd31a18546bd2aad3e6d9a174f2" - integrity sha512-EtgBhg7rd/JcnpZFXpBy0ze1YRfdm7BnBX4uKMBd3ixa3RGAE002JZB66FJyNH7g0F38U05pXmA5P8cBh7z+1w== - dependencies: - "@babel/types" "^7.16.7" - -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.13.0", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz#aa3a8ab4c3cceff8e65eb9e73d87dc4ff320b2f5" - integrity sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA== - -"@babel/helper-remap-async-to-generator@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.16.7.tgz#5ce2416990d55eb6e099128338848ae8ffa58a9a" - integrity sha512-C3o117GnP/j/N2OWo+oepeWbFEKRfNaay+F1Eo5Mj3A1SRjyx+qaFhm23nlipub7Cjv2azdUUiDH+VlpdwUFRg== - dependencies: - "@babel/helper-annotate-as-pure" "^7.16.7" - "@babel/helper-wrap-function" "^7.16.7" - "@babel/types" "^7.16.7" - -"@babel/helper-replace-supers@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.16.7.tgz#e9f5f5f32ac90429c1a4bdec0f231ef0c2838ab1" - integrity sha512-y9vsWilTNaVnVh6xiJfABzsNpgDPKev9HnAgz6Gb1p6UUwf9NepdlsV7VXGCftJM+jqD5f7JIEubcpLjZj5dBw== - dependencies: - "@babel/helper-environment-visitor" "^7.16.7" - "@babel/helper-member-expression-to-functions" "^7.16.7" - "@babel/helper-optimise-call-expression" "^7.16.7" - "@babel/traverse" "^7.16.7" - "@babel/types" "^7.16.7" - -"@babel/helper-simple-access@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz#d656654b9ea08dbb9659b69d61063ccd343ff0f7" - integrity sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g== - dependencies: - "@babel/types" "^7.16.7" - -"@babel/helper-skip-transparent-expression-wrappers@^7.16.0": - version "7.16.0" - resolved "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.16.0.tgz#0ee3388070147c3ae051e487eca3ebb0e2e8bb09" - integrity sha512-+il1gTy0oHwUsBQZyJvukbB4vPMdcYBrFHa0Uc4AizLxbq6BOYC51Rv4tWocX9BLBDLZ4kc6qUFpQ6HRgL+3zw== - dependencies: - "@babel/types" "^7.16.0" - -"@babel/helper-split-export-declaration@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz#0b648c0c42da9d3920d85ad585f2778620b8726b" - integrity sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw== - dependencies: - "@babel/types" "^7.16.7" - -"@babel/helper-validator-identifier@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad" - integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== - -"@babel/helper-validator-option@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz#b203ce62ce5fe153899b617c08957de860de4d23" - integrity sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ== - -"@babel/helper-wrap-function@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.16.7.tgz#8ddf9eaa770ed43de4bc3687f3f3b0d6d5ecf014" - integrity sha512-7a9sABeVwcunnztZZ7WTgSw6jVYLzM1wua0Z4HIXm9S3/HC96WKQTkFgGEaj5W06SHHihPJ6Le6HzS5cGOQMNw== - dependencies: - "@babel/helper-function-name" "^7.16.7" - "@babel/template" "^7.16.7" - "@babel/traverse" "^7.16.7" - "@babel/types" "^7.16.7" - -"@babel/helpers@^7.12.1", "@babel/helpers@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.7.tgz#7e3504d708d50344112767c3542fc5e357fffefc" - integrity sha512-9ZDoqtfY7AuEOt3cxchfii6C7GDyyMBffktR5B2jvWv8u2+efwvpnVKXMWzNehqy68tKgAfSwfdw/lWpthS2bw== - dependencies: - "@babel/template" "^7.16.7" - "@babel/traverse" "^7.16.7" - "@babel/types" "^7.16.7" - -"@babel/highlight@^7.10.4", "@babel/highlight@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.7.tgz#81a01d7d675046f0d96f82450d9d9578bdfd6b0b" - integrity sha512-aKpPMfLvGO3Q97V0qhw/V2SWNWlwfJknuwAunU7wZLSfrM4xTBvg7E5opUVi1kJTBKihE38CPg4nBiqX83PWYw== - dependencies: - "@babel/helper-validator-identifier" "^7.16.7" + "@babel/types" "^7.18.6" + +"@babel/helper-function-name@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.18.6.tgz#8334fecb0afba66e6d87a7e8c6bb7fed79926b83" + integrity sha512-0mWMxV1aC97dhjCah5U5Ua7668r5ZmSC2DLfH2EZnf9c3/dHZKiFa5pRLMH5tjSl471tY6496ZWk/kjNONBxhw== + dependencies: + "@babel/template" "^7.18.6" + "@babel/types" "^7.18.6" + +"@babel/helper-hoist-variables@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" + integrity sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-member-expression-to-functions@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.18.6.tgz#44802d7d602c285e1692db0bad9396d007be2afc" + integrity sha512-CeHxqwwipekotzPDUuJOfIMtcIHBuc7WAzLmTYWctVigqS5RktNMQ5bEwQSuGewzYnCtTWa3BARXeiLxDTv+Ng== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.16.0", "@babel/helper-module-imports@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz#1e3ebdbbd08aad1437b428c50204db13c5a3ca6e" + integrity sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-module-transforms@^7.12.1", "@babel/helper-module-transforms@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.18.6.tgz#57e3ca669e273d55c3cda55e6ebf552f37f483c8" + integrity sha512-L//phhB4al5uucwzlimruukHB3jRd5JGClwRMD/ROrVjXfLqovYnvQrK/JK36WYyVwGGO7OD3kMyVTjx+WVPhw== + dependencies: + "@babel/helper-environment-visitor" "^7.18.6" + "@babel/helper-module-imports" "^7.18.6" + "@babel/helper-simple-access" "^7.18.6" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/helper-validator-identifier" "^7.18.6" + "@babel/template" "^7.18.6" + "@babel/traverse" "^7.18.6" + "@babel/types" "^7.18.6" + +"@babel/helper-optimise-call-expression@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.18.6.tgz#9369aa943ee7da47edab2cb4e838acf09d290ffe" + integrity sha512-HP59oD9/fEHQkdcbgFCnbmgH5vIQTJbxh2yf+CdM89/glUNnuzr87Q8GIjGEnOktTROemO0Pe0iPAYbqZuOUiA== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.13.0", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.18.6.tgz#9448974dd4fb1d80fefe72e8a0af37809cd30d6d" + integrity sha512-gvZnm1YAAxh13eJdkb9EWHBnF3eAub3XTLCZEehHT2kWxiKVRL64+ae5Y6Ivne0mVHmMYKT+xWgZO+gQhuLUBg== + +"@babel/helper-remap-async-to-generator@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.18.6.tgz#fa1f81acd19daee9d73de297c0308783cd3cfc23" + integrity sha512-z5wbmV55TveUPZlCLZvxWHtrjuJd+8inFhk7DG0WW87/oJuGDcjDiu7HIvGcpf5464L6xKCg3vNkmlVVz9hwyQ== + dependencies: + "@babel/helper-annotate-as-pure" "^7.18.6" + "@babel/helper-environment-visitor" "^7.18.6" + "@babel/helper-wrap-function" "^7.18.6" + "@babel/types" "^7.18.6" + +"@babel/helper-replace-supers@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.18.6.tgz#efedf51cfccea7b7b8c0f00002ab317e7abfe420" + integrity sha512-fTf7zoXnUGl9gF25fXCWE26t7Tvtyn6H4hkLSYhATwJvw2uYxd3aoXplMSe0g9XbwK7bmxNes7+FGO0rB/xC0g== + dependencies: + "@babel/helper-environment-visitor" "^7.18.6" + "@babel/helper-member-expression-to-functions" "^7.18.6" + "@babel/helper-optimise-call-expression" "^7.18.6" + "@babel/traverse" "^7.18.6" + "@babel/types" "^7.18.6" + +"@babel/helper-simple-access@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz#d6d8f51f4ac2978068df934b569f08f29788c7ea" + integrity sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-skip-transparent-expression-wrappers@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.18.6.tgz#7dff00a5320ca4cf63270e5a0eca4b268b7380d9" + integrity sha512-4KoLhwGS9vGethZpAhYnMejWkX64wsnHPDwvOsKWU6Fg4+AlK2Jz3TyjQLMEPvz+1zemi/WBdkYxCD0bAfIkiw== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-split-export-declaration@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz#7367949bc75b20c6d5a5d4a97bba2824ae8ef075" + integrity sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA== + dependencies: + "@babel/types" "^7.18.6" + +"@babel/helper-validator-identifier@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz#9c97e30d31b2b8c72a1d08984f2ca9b574d7a076" + integrity sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g== + +"@babel/helper-validator-option@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz#bf0d2b5a509b1f336099e4ff36e1a63aa5db4db8" + integrity sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw== + +"@babel/helper-wrap-function@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.18.6.tgz#ec44ea4ad9d8988b90c3e465ba2382f4de81a073" + integrity sha512-I5/LZfozwMNbwr/b1vhhuYD+J/mU+gfGAj5td7l5Rv9WYmH6i3Om69WGKNmlIpsVW/mF6O5bvTKbvDQZVgjqOw== + dependencies: + "@babel/helper-function-name" "^7.18.6" + "@babel/template" "^7.18.6" + "@babel/traverse" "^7.18.6" + "@babel/types" "^7.18.6" + +"@babel/helpers@^7.12.1", "@babel/helpers@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.18.6.tgz#4c966140eaa1fcaa3d5a8c09d7db61077d4debfd" + integrity sha512-vzSiiqbQOghPngUYt/zWGvK3LAsPhz55vc9XNN0xAl2gV4ieShI2OQli5duxWHD+72PZPTKAcfcZDE1Cwc5zsQ== + dependencies: + "@babel/template" "^7.18.6" + "@babel/traverse" "^7.18.6" + "@babel/types" "^7.18.6" + +"@babel/highlight@^7.10.4", "@babel/highlight@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" + integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== + dependencies: + "@babel/helper-validator-identifier" "^7.18.6" chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.12.3", "@babel/parser@^7.14.7", "@babel/parser@^7.16.7", "@babel/parser@^7.7.0": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.16.7.tgz#d372dda9c89fcec340a82630a9f533f2fe15877e" - integrity sha512-sR4eaSrnM7BV7QPzGfEX5paG/6wrZM3I0HDzfIAK06ESvo9oy3xBuVBxE3MbQaKNhvg8g/ixjMWo2CGpzpHsDA== +"@babel/parser@^7.1.0", "@babel/parser@^7.12.3", "@babel/parser@^7.14.7", "@babel/parser@^7.18.6", "@babel/parser@^7.7.0": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.18.6.tgz#845338edecad65ebffef058d3be851f1d28a63bc" + integrity sha512-uQVSa9jJUe/G/304lXspfWVpKpK4euFLgGiMQFOCpM/bgcAdeoHwi/OQz23O9GK2osz26ZiXRRV9aV+Yl1O8tw== -"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.16.7.tgz#4eda6d6c2a0aa79c70fa7b6da67763dfe2141050" - integrity sha512-anv/DObl7waiGEnC24O9zqL0pSuI9hljihqiDuFHC8d7/bjr/4RLGPWuc8rYOff/QPzbEPSkzG8wGG9aDuhHRg== +"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz#da5b8f9a580acdfbe53494dba45ea389fb09a4d2" + integrity sha512-Dgxsyg54Fx1d4Nge8UnvTrED63vrwOdPmyvPzlNN/boaliRP54pm3pGzZD1SJUwrBA+Cs/xdG8kXX6Mn/RfISQ== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.16.7.tgz#cc001234dfc139ac45f6bcf801866198c8c72ff9" - integrity sha512-di8vUHRdf+4aJ7ltXhaDbPoszdkh59AQtJM5soLsuHpQJdFQZOA4uGj0V2u/CZ8bJ/u8ULDL5yq6FO/bCXnKHw== +"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.18.6.tgz#b4e4dbc2cd1acd0133479918f7c6412961c9adb8" + integrity sha512-Udgu8ZRgrBrttVz6A0EVL0SJ1z+RLbIeqsu632SA1hf0awEppD6TvdznoH+orIF8wtFFAV/Enmw9Y+9oV8TQcw== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" - "@babel/plugin-proposal-optional-chaining" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-skip-transparent-expression-wrappers" "^7.18.6" + "@babel/plugin-proposal-optional-chaining" "^7.18.6" -"@babel/plugin-proposal-async-generator-functions@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.16.7.tgz#739adc1212a9e4892de440cd7dfffb06172df78d" - integrity sha512-TTXBT3A5c11eqRzaC6beO6rlFT3Mo9C2e8eB44tTr52ESXSK2CIc2fOp1ynpAwQA8HhBMho+WXhMHWlAe3xkpw== +"@babel/plugin-proposal-async-generator-functions@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.18.6.tgz#aedac81e6fc12bb643374656dd5f2605bf743d17" + integrity sha512-WAz4R9bvozx4qwf74M+sfqPMKfSqwM0phxPTR6iJIi8robgzXwkEgmeJG1gEKhm6sDqT/U9aV3lfcqybIpev8w== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/helper-remap-async-to-generator" "^7.16.7" + "@babel/helper-environment-visitor" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-remap-async-to-generator" "^7.18.6" "@babel/plugin-syntax-async-generators" "^7.8.4" -"@babel/plugin-proposal-class-properties@^7.16.0", "@babel/plugin-proposal-class-properties@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.7.tgz#925cad7b3b1a2fcea7e59ecc8eb5954f961f91b0" - integrity sha512-IobU0Xme31ewjYOShSIqd/ZGM/r/cuOz2z0MDbNrhF5FW+ZVgi0f2lyeoj9KFPDOAqsYxmLWZte1WOwlvY9aww== +"@babel/plugin-proposal-class-properties@^7.16.0", "@babel/plugin-proposal-class-properties@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz#b110f59741895f7ec21a6fff696ec46265c446a3" + integrity sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ== dependencies: - "@babel/helper-create-class-features-plugin" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-create-class-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-proposal-class-static-block@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.16.7.tgz#712357570b612106ef5426d13dc433ce0f200c2a" - integrity sha512-dgqJJrcZoG/4CkMopzhPJjGxsIe9A8RlkQLnL/Vhhx8AA9ZuaRwGSlscSh42hazc7WSrya/IK7mTeoF0DP9tEw== +"@babel/plugin-proposal-class-static-block@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.18.6.tgz#8aa81d403ab72d3962fc06c26e222dacfc9b9020" + integrity sha512-+I3oIiNxrCpup3Gi8n5IGMwj0gOCAjcJUSQEcotNnCCPMEnixawOQ+KeJPlgfjzx+FKQ1QSyZOWe7wmoJp7vhw== dependencies: - "@babel/helper-create-class-features-plugin" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-create-class-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-class-static-block" "^7.14.5" "@babel/plugin-proposal-decorators@^7.16.4": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.16.7.tgz#922907d2e3e327f5b07d2246bcfc0bd438f360d2" - integrity sha512-DoEpnuXK14XV9btI1k8tzNGCutMclpj4yru8aXKoHlVmbO1s+2A+g2+h4JhcjrxkFJqzbymnLG6j/niOf3iFXQ== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/plugin-syntax-decorators" "^7.16.7" - -"@babel/plugin-proposal-dynamic-import@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.16.7.tgz#c19c897eaa46b27634a00fee9fb7d829158704b2" - integrity sha512-I8SW9Ho3/8DRSdmDdH3gORdyUuYnk1m4cMxUAdu5oy4n3OfN8flDEH+d60iG7dUfi0KkYwSvoalHzzdRzpWHTg== - dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.18.6.tgz#68e9fd0f022b944f84a8824bb28bfaee724d2595" + integrity sha512-gAdhsjaYmiZVxx5vTMiRfj31nB7LhwBJFMSLzeDxc7X4tKLixup0+k9ughn0RcpBrv9E3PBaXJW7jF5TCihAOg== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-replace-supers" "^7.18.6" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/plugin-syntax-decorators" "^7.18.6" + +"@babel/plugin-proposal-dynamic-import@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.18.6.tgz#72bcf8d408799f547d759298c3c27c7e7faa4d94" + integrity sha512-1auuwmK+Rz13SJj36R+jqFPMJWyKEDd7lLSdOj4oJK0UTgGueSAtkrCvz9ewmgyU/P941Rv2fQwZJN8s6QruXw== + dependencies: + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-dynamic-import" "^7.8.3" -"@babel/plugin-proposal-export-namespace-from@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.16.7.tgz#09de09df18445a5786a305681423ae63507a6163" - integrity sha512-ZxdtqDXLRGBL64ocZcs7ovt71L3jhC1RGSyR996svrCi3PYqHNkb3SwPJCs8RIzD86s+WPpt2S73+EHCGO+NUA== +"@babel/plugin-proposal-export-namespace-from@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.18.6.tgz#1016f0aa5ab383bbf8b3a85a2dcaedf6c8ee7491" + integrity sha512-zr/QcUlUo7GPo6+X1wC98NJADqmy5QTFWWhqeQWiki4XHafJtLl/YMGkmRB2szDD2IYJCCdBTd4ElwhId9T7Xw== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-export-namespace-from" "^7.8.3" -"@babel/plugin-proposal-json-strings@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.16.7.tgz#9732cb1d17d9a2626a08c5be25186c195b6fa6e8" - integrity sha512-lNZ3EEggsGY78JavgbHsK9u5P3pQaW7k4axlgFLYkMd7UBsiNahCITShLjNQschPyjtO6dADrL24757IdhBrsQ== +"@babel/plugin-proposal-json-strings@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.18.6.tgz#7e8788c1811c393aff762817e7dbf1ebd0c05f0b" + integrity sha512-lr1peyn9kOdbYc0xr0OdHTZ5FMqS6Di+H0Fz2I/JwMzGmzJETNeOFq2pBySw6X/KFL5EWDjlJuMsUGRFb8fQgQ== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-json-strings" "^7.8.3" -"@babel/plugin-proposal-logical-assignment-operators@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.16.7.tgz#be23c0ba74deec1922e639832904be0bea73cdea" - integrity sha512-K3XzyZJGQCr00+EtYtrDjmwX7o7PLK6U9bi1nCwkQioRFVUv6dJoxbQjtWVtP+bCPy82bONBKG8NPyQ4+i6yjg== +"@babel/plugin-proposal-logical-assignment-operators@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.18.6.tgz#3b9cac6f1ffc2aa459d111df80c12020dfc6b665" + integrity sha512-zMo66azZth/0tVd7gmkxOkOjs2rpHyhpcFo565PUP37hSp6hSd9uUKIfTDFMz58BwqgQKhJ9YxtM5XddjXVn+Q== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" -"@babel/plugin-proposal-nullish-coalescing-operator@^7.16.0", "@babel/plugin-proposal-nullish-coalescing-operator@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.16.7.tgz#141fc20b6857e59459d430c850a0011e36561d99" - integrity sha512-aUOrYU3EVtjf62jQrCj63pYZ7k6vns2h/DQvHPWGmsJRYzWXZ6/AsfgpiRy6XiuIDADhJzP2Q9MwSMKauBQ+UQ== +"@babel/plugin-proposal-nullish-coalescing-operator@^7.16.0", "@babel/plugin-proposal-nullish-coalescing-operator@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.18.6.tgz#fdd940a99a740e577d6c753ab6fbb43fdb9467e1" + integrity sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" -"@babel/plugin-proposal-numeric-separator@^7.16.0", "@babel/plugin-proposal-numeric-separator@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.16.7.tgz#d6b69f4af63fb38b6ca2558442a7fb191236eba9" - integrity sha512-vQgPMknOIgiuVqbokToyXbkY/OmmjAzr/0lhSIbG/KmnzXPGwW/AdhdKpi+O4X/VkWiWjnkKOBiqJrTaC98VKw== +"@babel/plugin-proposal-numeric-separator@^7.16.0", "@babel/plugin-proposal-numeric-separator@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.18.6.tgz#899b14fbafe87f053d2c5ff05b36029c62e13c75" + integrity sha512-ozlZFogPqoLm8WBr5Z8UckIoE4YQ5KESVcNudyXOR8uqIkliTEgJ3RoketfG6pmzLdeZF0H/wjE9/cCEitBl7Q== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-numeric-separator" "^7.10.4" -"@babel/plugin-proposal-object-rest-spread@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.16.7.tgz#94593ef1ddf37021a25bdcb5754c4a8d534b01d8" - integrity sha512-3O0Y4+dw94HA86qSg9IHfyPktgR7q3gpNVAeiKQd+8jBKFaU5NQS1Yatgo4wY+UFNuLjvxcSmzcsHqrhgTyBUA== +"@babel/plugin-proposal-object-rest-spread@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.18.6.tgz#ec93bba06bfb3e15ebd7da73e953d84b094d5daf" + integrity sha512-9yuM6wr4rIsKa1wlUAbZEazkCrgw2sMPEXCr4Rnwetu7cEW1NydkCWytLuYletbf8vFxdJxFhwEZqMpOx2eZyw== dependencies: - "@babel/compat-data" "^7.16.4" - "@babel/helper-compilation-targets" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/compat-data" "^7.18.6" + "@babel/helper-compilation-targets" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-transform-parameters" "^7.16.7" + "@babel/plugin-transform-parameters" "^7.18.6" -"@babel/plugin-proposal-optional-catch-binding@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.16.7.tgz#c623a430674ffc4ab732fd0a0ae7722b67cb74cf" - integrity sha512-eMOH/L4OvWSZAE1VkHbr1vckLG1WUcHGJSLqqQwl2GaUqG6QjddvrOaTUMNYiv77H5IKPMZ9U9P7EaHwvAShfA== +"@babel/plugin-proposal-optional-catch-binding@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.18.6.tgz#f9400d0e6a3ea93ba9ef70b09e72dd6da638a2cb" + integrity sha512-Q40HEhs9DJQyaZfUjjn6vE8Cv4GmMHCYuMGIWUnlxH6400VGxOuwWsPt4FxXxJkC/5eOzgn0z21M9gMT4MOhbw== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" -"@babel/plugin-proposal-optional-chaining@^7.16.0", "@babel/plugin-proposal-optional-chaining@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.16.7.tgz#7cd629564724816c0e8a969535551f943c64c39a" - integrity sha512-eC3xy+ZrUcBtP7x+sq62Q/HYd674pPTb/77XZMb5wbDPGWIdUbSr4Agr052+zaUPSb+gGRnjxXfKFvx5iMJ+DA== +"@babel/plugin-proposal-optional-chaining@^7.16.0", "@babel/plugin-proposal-optional-chaining@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.18.6.tgz#46d4f2ffc20e87fad1d98bc4fa5d466366f6aa0b" + integrity sha512-PatI6elL5eMzoypFAiYDpYQyMtXTn+iMhuxxQt5mAXD4fEmKorpSI3PHd+i3JXBJN3xyA6MvJv7at23HffFHwA== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-skip-transparent-expression-wrappers" "^7.18.6" "@babel/plugin-syntax-optional-chaining" "^7.8.3" -"@babel/plugin-proposal-private-methods@^7.16.0", "@babel/plugin-proposal-private-methods@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.7.tgz#e418e3aa6f86edd6d327ce84eff188e479f571e0" - integrity sha512-7twV3pzhrRxSwHeIvFE6coPgvo+exNDOiGUMg39o2LiLo1Y+4aKpfkcLGcg1UHonzorCt7SNXnoMyCnnIOA8Sw== +"@babel/plugin-proposal-private-methods@^7.16.0", "@babel/plugin-proposal-private-methods@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.18.6.tgz#5209de7d213457548a98436fa2882f52f4be6bea" + integrity sha512-nutsvktDItsNn4rpGItSNV2sz1XwS+nfU0Rg8aCx3W3NOKVzdMjJRu0O5OkgDp3ZGICSTbgRpxZoWsxoKRvbeA== dependencies: - "@babel/helper-create-class-features-plugin" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-create-class-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-proposal-private-property-in-object@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.16.7.tgz#b0b8cef543c2c3d57e59e2c611994861d46a3fce" - integrity sha512-rMQkjcOFbm+ufe3bTZLyOfsOUOxyvLXZJCTARhJr+8UMSoZmqTe1K1BgkFcrW37rAchWg57yI69ORxiWvUINuQ== +"@babel/plugin-proposal-private-property-in-object@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.18.6.tgz#a64137b232f0aca3733a67eb1a144c192389c503" + integrity sha512-9Rysx7FOctvT5ouj5JODjAFAkgGoudQuLPamZb0v1TGLpapdNaftzifU8NTWQm0IRjqoYypdrSmyWgkocDQ8Dw== dependencies: - "@babel/helper-annotate-as-pure" "^7.16.7" - "@babel/helper-create-class-features-plugin" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-annotate-as-pure" "^7.18.6" + "@babel/helper-create-class-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-private-property-in-object" "^7.14.5" -"@babel/plugin-proposal-unicode-property-regex@^7.16.7", "@babel/plugin-proposal-unicode-property-regex@^7.4.4": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.16.7.tgz#635d18eb10c6214210ffc5ff4932552de08188a2" - integrity sha512-QRK0YI/40VLhNVGIjRNAAQkEHws0cswSdFFjpFyt943YmJIU1da9uW63Iu6NFV6CxTZW5eTDCrwZUstBWgp/Rg== +"@babel/plugin-proposal-unicode-property-regex@^7.18.6", "@babel/plugin-proposal-unicode-property-regex@^7.4.4": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.18.6.tgz#af613d2cd5e643643b65cded64207b15c85cb78e" + integrity sha512-2BShG/d5yoZyXZfVePH91urL5wTG6ASZU9M4o03lKK8u8UW1y08OMttBSOADTcJrnPMpvDXRG3G8fyLh4ovs8w== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-create-regexp-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -527,12 +529,12 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" -"@babel/plugin-syntax-decorators@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.16.7.tgz#f66a0199f16de7c1ef5192160ccf5d069739e3d3" - integrity sha512-vQ+PxL+srA7g6Rx6I1e15m55gftknl2X8GCUW1JTlkTaXZLJOS0UcaY0eK9jYT7IYf4awn6qwyghVHLDz1WyMw== +"@babel/plugin-syntax-decorators@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.18.6.tgz#2e45af22835d0b0f8665da2bfd4463649ce5dbc1" + integrity sha512-fqyLgjcxf/1yhyZ6A+yo1u9gJ7eleFQod2lkaUsF9DQ7sbbY3Ligym3L0+I2c0WmqNKDpoD9UTb1AKP3qRMOAQ== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-dynamic-import@^7.8.3": version "7.8.3" @@ -548,12 +550,19 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-flow@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.16.7.tgz#202b147e5892b8452bbb0bb269c7ed2539ab8832" - integrity sha512-UDo3YGQO0jH6ytzVwgSLv9i/CzMcUjbKenL67dTrAZPPv6GFAtDhe6jqnvmoKzC/7htNTohhos+onPtDMqJwaQ== +"@babel/plugin-syntax-flow@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.18.6.tgz#774d825256f2379d06139be0c723c4dd444f3ca1" + integrity sha512-LUbR+KNTBWCUAqRG9ex5Gnzu2IOkt8jRJbHHXFT9q+L9zm7M/QQbEqXyw1n1pohYvOyWC8CjeyjrSaIwiYjK7A== + dependencies: + "@babel/helper-plugin-utils" "^7.18.6" + +"@babel/plugin-syntax-import-assertions@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.18.6.tgz#cd6190500a4fa2fe31990a963ffab4b63e4505e4" + integrity sha512-/DU3RXad9+bZwrgWJQKbr39gYbJpLJHezqEzRzi/BHRlJ9zsQb4CK2CA/5apllXNomwA1qHwzvHl+AdEmC5krQ== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-import-meta@^7.8.3": version "7.10.4" @@ -576,12 +585,12 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-syntax-jsx@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.16.7.tgz#50b6571d13f764266a113d77c82b4a6508bbe665" - integrity sha512-Esxmk7YjA8QysKeT3VhTXvF6y77f/a91SIs4pWb4H2eWGQkCKFgQaG6hdoEVZtGsrAcb2K5BW66XsOErD4WU3Q== +"@babel/plugin-syntax-jsx@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz#a8feef63b010150abd97f1649ec296e849943ca0" + integrity sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-logical-assignment-operators@^7.10.4", "@babel/plugin-syntax-logical-assignment-operators@^7.8.3": version "7.10.4" @@ -639,331 +648,333 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" -"@babel/plugin-syntax-typescript@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.16.7.tgz#39c9b55ee153151990fb038651d58d3fd03f98f8" - integrity sha512-YhUIJHHGkqPgEcMYkPCKTyGUdoGKWtopIycQyjJH8OjvRgOYsXsaKehLVPScKJWAULPxMa4N1vCe6szREFlZ7A== +"@babel/plugin-syntax-typescript@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.18.6.tgz#1c09cd25795c7c2b8a4ba9ae49394576d4133285" + integrity sha512-mAWAuq4rvOepWCBid55JuRNvpTNf2UGVgoz4JV0fXEKolsVZDzsa4NqCef758WZJj/GDu0gVGItjKFiClTAmZA== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-arrow-functions@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.16.7.tgz#44125e653d94b98db76369de9c396dc14bef4154" - integrity sha512-9ffkFFMbvzTvv+7dTp/66xvZAWASuPD5Tl9LK3Z9vhOmANo6j94rik+5YMBt4CwHVMWLWpMsriIc2zsa3WW3xQ== +"@babel/plugin-transform-arrow-functions@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.18.6.tgz#19063fcf8771ec7b31d742339dac62433d0611fe" + integrity sha512-9S9X9RUefzrsHZmKMbDXxweEH+YlE8JJEuat9FdvW9Qh1cw7W64jELCtWNkPBPX5En45uy28KGvA/AySqUh8CQ== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-async-to-generator@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.16.7.tgz#646e1262ac341b587ff5449844d4492dbb10ac4b" - integrity sha512-pFEfjnK4DfXCfAlA5I98BYdDJD8NltMzx19gt6DAmfE+2lXRfPUoa0/5SUjT4+TDE1W/rcxU/1lgN55vpAjjdg== +"@babel/plugin-transform-async-to-generator@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.18.6.tgz#ccda3d1ab9d5ced5265fdb13f1882d5476c71615" + integrity sha512-ARE5wZLKnTgPW7/1ftQmSi1CmkqqHo2DNmtztFhvgtOWSDfq0Cq9/9L+KnZNYSNrydBekhW3rwShduf59RoXag== dependencies: - "@babel/helper-module-imports" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/helper-remap-async-to-generator" "^7.16.7" + "@babel/helper-module-imports" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-remap-async-to-generator" "^7.18.6" -"@babel/plugin-transform-block-scoped-functions@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.16.7.tgz#4d0d57d9632ef6062cdf354bb717102ee042a620" - integrity sha512-JUuzlzmF40Z9cXyytcbZEZKckgrQzChbQJw/5PuEHYeqzCsvebDx0K0jWnIIVcmmDOAVctCgnYs0pMcrYj2zJg== +"@babel/plugin-transform-block-scoped-functions@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.18.6.tgz#9187bf4ba302635b9d70d986ad70f038726216a8" + integrity sha512-ExUcOqpPWnliRcPqves5HJcJOvHvIIWfuS4sroBUenPuMdmW+SMHDakmtS7qOo13sVppmUijqeTv7qqGsvURpQ== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-block-scoping@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.16.7.tgz#f50664ab99ddeaee5bc681b8f3a6ea9d72ab4f87" - integrity sha512-ObZev2nxVAYA4bhyusELdo9hb3H+A56bxH3FZMbEImZFiEDYVHXQSJ1hQKFlDnlt8G9bBrCZ5ZpURZUrV4G5qQ== +"@babel/plugin-transform-block-scoping@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.18.6.tgz#b5f78318914615397d86a731ef2cc668796a726c" + integrity sha512-pRqwb91C42vs1ahSAWJkxOxU1RHWDn16XAa6ggQ72wjLlWyYeAcLvTtE0aM8ph3KNydy9CQF2nLYcjq1WysgxQ== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-classes@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.16.7.tgz#8f4b9562850cd973de3b498f1218796eb181ce00" - integrity sha512-WY7og38SFAGYRe64BrjKf8OrE6ulEHtr5jEYaZMwox9KebgqPi67Zqz8K53EKk1fFEJgm96r32rkKZ3qA2nCWQ== +"@babel/plugin-transform-classes@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.18.6.tgz#3501a8f3f4c7d5697c27a3eedbee71d68312669f" + integrity sha512-XTg8XW/mKpzAF3actL554Jl/dOYoJtv3l8fxaEczpgz84IeeVf+T1u2CSvPHuZbt0w3JkIx4rdn/MRQI7mo0HQ== dependencies: - "@babel/helper-annotate-as-pure" "^7.16.7" - "@babel/helper-environment-visitor" "^7.16.7" - "@babel/helper-function-name" "^7.16.7" - "@babel/helper-optimise-call-expression" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/helper-replace-supers" "^7.16.7" - "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/helper-annotate-as-pure" "^7.18.6" + "@babel/helper-environment-visitor" "^7.18.6" + "@babel/helper-function-name" "^7.18.6" + "@babel/helper-optimise-call-expression" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-replace-supers" "^7.18.6" + "@babel/helper-split-export-declaration" "^7.18.6" globals "^11.1.0" -"@babel/plugin-transform-computed-properties@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.16.7.tgz#66dee12e46f61d2aae7a73710f591eb3df616470" - integrity sha512-gN72G9bcmenVILj//sv1zLNaPyYcOzUho2lIJBMh/iakJ9ygCo/hEF9cpGb61SCMEDxbbyBoVQxrt+bWKu5KGw== +"@babel/plugin-transform-computed-properties@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.18.6.tgz#5d15eb90e22e69604f3348344c91165c5395d032" + integrity sha512-9repI4BhNrR0KenoR9vm3/cIc1tSBIo+u1WVjKCAynahj25O8zfbiE6JtAtHPGQSs4yZ+bA8mRasRP+qc+2R5A== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-destructuring@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.16.7.tgz#ca9588ae2d63978a4c29d3f33282d8603f618e23" - integrity sha512-VqAwhTHBnu5xBVDCvrvqJbtLUa++qZaWC0Fgr2mqokBlulZARGyIvZDoqbPlPaKImQ9dKAcCzbv+ul//uqu70A== +"@babel/plugin-transform-destructuring@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.18.6.tgz#a98b0e42c7ffbf5eefcbcf33280430f230895c6f" + integrity sha512-tgy3u6lRp17ilY8r1kP4i2+HDUwxlVqq3RTc943eAWSzGgpU1qhiKpqZ5CMyHReIYPHdo3Kg8v8edKtDqSVEyQ== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-dotall-regex@^7.16.7", "@babel/plugin-transform-dotall-regex@^7.4.4": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.16.7.tgz#6b2d67686fab15fb6a7fd4bd895d5982cfc81241" - integrity sha512-Lyttaao2SjZF6Pf4vk1dVKv8YypMpomAbygW+mU5cYP3S5cWTfCJjG8xV6CFdzGFlfWK81IjL9viiTvpb6G7gQ== +"@babel/plugin-transform-dotall-regex@^7.18.6", "@babel/plugin-transform-dotall-regex@^7.4.4": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.18.6.tgz#b286b3e7aae6c7b861e45bed0a2fafd6b1a4fef8" + integrity sha512-6S3jpun1eEbAxq7TdjLotAsl4WpQI9DxfkycRcKrjhQYzU87qpXdknpBg/e+TdcMehqGnLFi7tnFUBR02Vq6wg== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-create-regexp-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-duplicate-keys@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.16.7.tgz#2207e9ca8f82a0d36a5a67b6536e7ef8b08823c9" - integrity sha512-03DvpbRfvWIXyK0/6QiR1KMTWeT6OcQ7tbhjrXyFS02kjuX/mu5Bvnh5SDSWHxyawit2g5aWhKwI86EE7GUnTw== +"@babel/plugin-transform-duplicate-keys@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.18.6.tgz#e6c94e8cd3c9dd8a88144f7b78ae22975a7ff473" + integrity sha512-NJU26U/208+sxYszf82nmGYqVF9QN8py2HFTblPT9hbawi8+1C5a9JubODLTGFuT0qlkqVinmkwOD13s0sZktg== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-exponentiation-operator@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.16.7.tgz#efa9862ef97e9e9e5f653f6ddc7b665e8536fe9b" - integrity sha512-8UYLSlyLgRixQvlYH3J2ekXFHDFLQutdy7FfFAMm3CPZ6q9wHCwnUyiXpQCe3gVVnQlHc5nsuiEVziteRNTXEA== +"@babel/plugin-transform-exponentiation-operator@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.18.6.tgz#421c705f4521888c65e91fdd1af951bfefd4dacd" + integrity sha512-wzEtc0+2c88FVR34aQmiz56dxEkxr2g8DQb/KfaFa1JYXOFVsbhvAonFN6PwVWj++fKmku8NP80plJ5Et4wqHw== dependencies: - "@babel/helper-builder-binary-assignment-operator-visitor" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-builder-binary-assignment-operator-visitor" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-flow-strip-types@^7.16.0": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.16.7.tgz#291fb140c78dabbf87f2427e7c7c332b126964b8" - integrity sha512-mzmCq3cNsDpZZu9FADYYyfZJIOrSONmHcop2XEKPdBNMa4PDC4eEvcOvzZaCNcjKu72v0XQlA5y1g58aLRXdYg== + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.18.6.tgz#6d3dd9f9c0fe13349428569fef00b31310bb3f9f" + integrity sha512-wE0xtA7csz+hw4fKPwxmu5jnzAsXPIO57XnRwzXP3T19jWh1BODnPGoG9xKYwvAwusP7iUktHayRFbMPGtODaQ== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/plugin-syntax-flow" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/plugin-syntax-flow" "^7.18.6" -"@babel/plugin-transform-for-of@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.16.7.tgz#649d639d4617dff502a9a158c479b3b556728d8c" - integrity sha512-/QZm9W92Ptpw7sjI9Nx1mbcsWz33+l8kuMIQnDwgQBG5s3fAfQvkRjQ7NqXhtNcKOnPkdICmUHyCaWW06HCsqg== +"@babel/plugin-transform-for-of@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.18.6.tgz#e0fdb813be908e91ccc9ec87b30cc2eabf046f7c" + integrity sha512-WAjoMf4wIiSsy88KmG7tgj2nFdEK7E46tArVtcgED7Bkj6Fg/tG5SbvNIOKxbFS2VFgNh6+iaPswBeQZm4ox8w== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-function-name@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.16.7.tgz#5ab34375c64d61d083d7d2f05c38d90b97ec65cf" - integrity sha512-SU/C68YVwTRxqWj5kgsbKINakGag0KTgq9f2iZEXdStoAbOzLHEBRYzImmA6yFo8YZhJVflvXmIHUO7GWHmxxA== +"@babel/plugin-transform-function-name@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.18.6.tgz#6a7e4ae2893d336fd1b8f64c9f92276391d0f1b4" + integrity sha512-kJha/Gbs5RjzIu0CxZwf5e3aTTSlhZnHMT8zPWnJMjNpLOUgqevg+PN5oMH68nMCXnfiMo4Bhgxqj59KHTlAnA== dependencies: - "@babel/helper-compilation-targets" "^7.16.7" - "@babel/helper-function-name" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-compilation-targets" "^7.18.6" + "@babel/helper-function-name" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-literals@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.16.7.tgz#254c9618c5ff749e87cb0c0cef1a0a050c0bdab1" - integrity sha512-6tH8RTpTWI0s2sV6uq3e/C9wPo4PTqqZps4uF0kzQ9/xPLFQtipynvmT1g/dOfEJ+0EQsHhkQ/zyRId8J2b8zQ== +"@babel/plugin-transform-literals@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.18.6.tgz#9d6af353b5209df72960baf4492722d56f39a205" + integrity sha512-x3HEw0cJZVDoENXOp20HlypIHfl0zMIhMVZEBVTfmqbObIpsMxMbmU5nOEO8R7LYT+z5RORKPlTI5Hj4OsO9/Q== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-member-expression-literals@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.16.7.tgz#6e5dcf906ef8a098e630149d14c867dd28f92384" - integrity sha512-mBruRMbktKQwbxaJof32LT9KLy2f3gH+27a5XSuXo6h7R3vqltl0PgZ80C8ZMKw98Bf8bqt6BEVi3svOh2PzMw== +"@babel/plugin-transform-member-expression-literals@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.18.6.tgz#ac9fdc1a118620ac49b7e7a5d2dc177a1bfee88e" + integrity sha512-qSF1ihLGO3q+/g48k85tUjD033C29TNTVB2paCwZPVmOsjn9pClvYYrM2VeJpBY2bcNkuny0YUyTNRyRxJ54KA== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-modules-amd@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.16.7.tgz#b28d323016a7daaae8609781d1f8c9da42b13186" - integrity sha512-KaaEtgBL7FKYwjJ/teH63oAmE3lP34N3kshz8mm4VMAw7U3PxjVwwUmxEFksbgsNUaO3wId9R2AVQYSEGRa2+g== +"@babel/plugin-transform-modules-amd@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.18.6.tgz#8c91f8c5115d2202f277549848874027d7172d21" + integrity sha512-Pra5aXsmTsOnjM3IajS8rTaLCy++nGM4v3YR4esk5PCsyg9z8NA5oQLwxzMUtDBd8F+UmVza3VxoAaWCbzH1rg== dependencies: - "@babel/helper-module-transforms" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-module-transforms" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-commonjs@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.16.7.tgz#fd119e6a433c527d368425b45df361e1e95d3c1a" - integrity sha512-h2RP2kE7He1ZWKyAlanMZrAbdv+Acw1pA8dQZhE025WJZE2z0xzFADAinXA9fxd5bn7JnM+SdOGcndGx1ARs9w== +"@babel/plugin-transform-modules-commonjs@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.6.tgz#afd243afba166cca69892e24a8fd8c9f2ca87883" + integrity sha512-Qfv2ZOWikpvmedXQJDSbxNqy7Xr/j2Y8/KfijM0iJyKkBTmWuvCA1yeH1yDM7NJhBW/2aXxeucLj6i80/LAJ/Q== dependencies: - "@babel/helper-module-transforms" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/helper-simple-access" "^7.16.7" + "@babel/helper-module-transforms" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-simple-access" "^7.18.6" babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-systemjs@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.16.7.tgz#887cefaef88e684d29558c2b13ee0563e287c2d7" - integrity sha512-DuK5E3k+QQmnOqBR9UkusByy5WZWGRxfzV529s9nPra1GE7olmxfqO2FHobEOYSPIjPBTr4p66YDcjQnt8cBmw== +"@babel/plugin-transform-modules-systemjs@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.18.6.tgz#026511b7657d63bf5d4cf2fd4aeb963139914a54" + integrity sha512-UbPYpXxLjTw6w6yXX2BYNxF3p6QY225wcTkfQCy3OMnSlS/C3xGtwUjEzGkldb/sy6PWLiCQ3NbYfjWUTI3t4g== dependencies: - "@babel/helper-hoist-variables" "^7.16.7" - "@babel/helper-module-transforms" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/helper-validator-identifier" "^7.16.7" + "@babel/helper-hoist-variables" "^7.18.6" + "@babel/helper-module-transforms" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-validator-identifier" "^7.18.6" babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-umd@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.16.7.tgz#23dad479fa585283dbd22215bff12719171e7618" - integrity sha512-EMh7uolsC8O4xhudF2F6wedbSHm1HHZ0C6aJ7K67zcDNidMzVcxWdGr+htW9n21klm+bOn+Rx4CBsAntZd3rEQ== +"@babel/plugin-transform-modules-umd@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.18.6.tgz#81d3832d6034b75b54e62821ba58f28ed0aab4b9" + integrity sha512-dcegErExVeXcRqNtkRU/z8WlBLnvD4MRnHgNs3MytRO1Mn1sHRyhbcpYbVMGclAqOjdW+9cfkdZno9dFdfKLfQ== dependencies: - "@babel/helper-module-transforms" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-module-transforms" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-named-capturing-groups-regex@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.16.7.tgz#749d90d94e73cf62c60a0cc8d6b94d29305a81f2" - integrity sha512-kFy35VwmwIQwCjwrAQhl3+c/kr292i4KdLPKp5lPH03Ltc51qnFlIADoyPxc/6Naz3ok3WdYKg+KK6AH+D4utg== +"@babel/plugin-transform-named-capturing-groups-regex@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.18.6.tgz#c89bfbc7cc6805d692f3a49bc5fc1b630007246d" + integrity sha512-UmEOGF8XgaIqD74bC8g7iV3RYj8lMf0Bw7NJzvnS9qQhM4mg+1WHKotUIdjxgD2RGrgFLZZPCFPFj3P/kVDYhg== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.16.7" + "@babel/helper-create-regexp-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-new-target@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.16.7.tgz#9967d89a5c243818e0800fdad89db22c5f514244" - integrity sha512-xiLDzWNMfKoGOpc6t3U+etCE2yRnn3SM09BXqWPIZOBpL2gvVrBWUKnsJx0K/ADi5F5YC5f8APFfWrz25TdlGg== +"@babel/plugin-transform-new-target@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.18.6.tgz#d128f376ae200477f37c4ddfcc722a8a1b3246a8" + integrity sha512-DjwFA/9Iu3Z+vrAn+8pBUGcjhxKguSMlsFqeCKbhb9BAV756v0krzVK04CRDi/4aqmk8BsHb4a/gFcaA5joXRw== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-object-super@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.16.7.tgz#ac359cf8d32cf4354d27a46867999490b6c32a94" - integrity sha512-14J1feiQVWaGvRxj2WjyMuXS2jsBkgB3MdSN5HuC2G5nRspa5RK9COcs82Pwy5BuGcjb+fYaUj94mYcOj7rCvw== +"@babel/plugin-transform-object-super@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.18.6.tgz#fb3c6ccdd15939b6ff7939944b51971ddc35912c" + integrity sha512-uvGz6zk+pZoS1aTZrOvrbj6Pp/kK2mp45t2B+bTDre2UgsZZ8EZLSJtUg7m/no0zOJUWgFONpB7Zv9W2tSaFlA== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/helper-replace-supers" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-replace-supers" "^7.18.6" -"@babel/plugin-transform-parameters@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.16.7.tgz#a1721f55b99b736511cb7e0152f61f17688f331f" - integrity sha512-AT3MufQ7zZEhU2hwOA11axBnExW0Lszu4RL/tAlUJBuNoRak+wehQW8h6KcXOcgjY42fHtDxswuMhMjFEuv/aw== +"@babel/plugin-transform-parameters@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.18.6.tgz#cbe03d5a4c6385dd756034ac1baa63c04beab8dc" + integrity sha512-FjdqgMv37yVl/gwvzkcB+wfjRI8HQmc5EgOG9iGNvUY1ok+TjsoaMP7IqCDZBhkFcM5f3OPVMs6Dmp03C5k4/A== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-property-literals@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.16.7.tgz#2dadac85155436f22c696c4827730e0fe1057a55" - integrity sha512-z4FGr9NMGdoIl1RqavCqGG+ZuYjfZ/hkCIeuH6Do7tXmSm0ls11nYVSJqFEUOSJbDab5wC6lRE/w6YjVcr6Hqw== +"@babel/plugin-transform-property-literals@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.18.6.tgz#e22498903a483448e94e032e9bbb9c5ccbfc93a3" + integrity sha512-cYcs6qlgafTud3PAzrrRNbQtfpQ8+y/+M5tKmksS9+M1ckbH6kzY8MrexEM9mcA6JDsukE19iIRvAyYl463sMg== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-react-constant-elements@^7.9.0": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-react-constant-elements/-/plugin-transform-react-constant-elements-7.16.7.tgz#19e9e4c2df2f6c3e6b3aea11778297d81db8df62" - integrity sha512-lF+cfsyTgwWkcw715J88JhMYJ5GpysYNLhLP1PkvkhTRN7B3e74R/1KsDxFxhRpSn0UUD3IWM4GvdBR2PEbbQQ== + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-react-constant-elements/-/plugin-transform-react-constant-elements-7.18.6.tgz#e477693aad3e2aafe86b6db03748a30aef417a5e" + integrity sha512-4g5H1bonF1dqgMe+wQ2fvDlRZ/mN/KwArk13teDv+xxn+pUDEiiDluQd6D2B30MJcL1u3qr0WZpfq0mw9/zSqA== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-react-display-name@^7.16.0", "@babel/plugin-transform-react-display-name@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.16.7.tgz#7b6d40d232f4c0f550ea348593db3b21e2404340" - integrity sha512-qgIg8BcZgd0G/Cz916D5+9kqX0c7nPZyXaP8R2tLNN5tkyIZdG5fEwBrxwplzSnjC1jvQmyMNVwUCZPcbGY7Pg== +"@babel/plugin-transform-react-display-name@^7.16.0", "@babel/plugin-transform-react-display-name@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.18.6.tgz#8b1125f919ef36ebdfff061d664e266c666b9415" + integrity sha512-TV4sQ+T013n61uMoygyMRm+xf04Bd5oqFpv2jAEQwSZ8NwQA7zeRPg1LMVg2PWi3zWBz+CLKD+v5bcpZ/BS0aA== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-react-jsx-development@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.16.7.tgz#43a00724a3ed2557ed3f276a01a929e6686ac7b8" - integrity sha512-RMvQWvpla+xy6MlBpPlrKZCMRs2AGiHOGHY3xRwl0pEeim348dDyxeH4xBsMPbIMhujeq7ihE702eM2Ew0Wo+A== +"@babel/plugin-transform-react-jsx-development@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.18.6.tgz#dbe5c972811e49c7405b630e4d0d2e1380c0ddc5" + integrity sha512-SA6HEjwYFKF7WDjWcMcMGUimmw/nhNRDWxr+KaLSCrkD/LMDBvWRmHAYgE1HDeF8KUuI8OAu+RT6EOtKxSW2qA== dependencies: - "@babel/plugin-transform-react-jsx" "^7.16.7" + "@babel/plugin-transform-react-jsx" "^7.18.6" -"@babel/plugin-transform-react-jsx@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.16.7.tgz#86a6a220552afd0e4e1f0388a68a372be7add0d4" - integrity sha512-8D16ye66fxiE8m890w0BpPpngG9o9OVBBy0gH2E+2AR7qMR2ZpTYJEqLxAsoroenMId0p/wMW+Blc0meDgu0Ag== +"@babel/plugin-transform-react-jsx@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.18.6.tgz#2721e96d31df96e3b7ad48ff446995d26bc028ff" + integrity sha512-Mz7xMPxoy9kPS/JScj6fJs03TZ/fZ1dJPlMjRAgTaxaS0fUBk8FV/A2rRgfPsVCZqALNwMexD+0Uaf5zlcKPpw== dependencies: - "@babel/helper-annotate-as-pure" "^7.16.7" - "@babel/helper-module-imports" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/plugin-syntax-jsx" "^7.16.7" - "@babel/types" "^7.16.7" + "@babel/helper-annotate-as-pure" "^7.18.6" + "@babel/helper-module-imports" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/plugin-syntax-jsx" "^7.18.6" + "@babel/types" "^7.18.6" -"@babel/plugin-transform-react-pure-annotations@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.16.7.tgz#232bfd2f12eb551d6d7d01d13fe3f86b45eb9c67" - integrity sha512-hs71ToC97k3QWxswh2ElzMFABXHvGiJ01IB1TbYQDGeWRKWz/MPUTh5jGExdHvosYKpnJW5Pm3S4+TA3FyX+GA== +"@babel/plugin-transform-react-pure-annotations@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.18.6.tgz#561af267f19f3e5d59291f9950fd7b9663d0d844" + integrity sha512-I8VfEPg9r2TRDdvnHgPepTKvuRomzA8+u+nhY7qSI1fR2hRNebasZEETLyM5mAUr0Ku56OkXJ0I7NHJnO6cJiQ== dependencies: - "@babel/helper-annotate-as-pure" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-annotate-as-pure" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-regenerator@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.16.7.tgz#9e7576dc476cb89ccc5096fff7af659243b4adeb" - integrity sha512-mF7jOgGYCkSJagJ6XCujSQg+6xC1M77/03K2oBmVJWoFGNUtnVJO4WHKJk3dnPC8HCcj4xBQP1Egm8DWh3Pb3Q== +"@babel/plugin-transform-regenerator@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.18.6.tgz#585c66cb84d4b4bf72519a34cfce761b8676ca73" + integrity sha512-poqRI2+qiSdeldcz4wTSTXBRryoq3Gc70ye7m7UD5Ww0nE29IXqMl6r7Nd15WBgRd74vloEMlShtH6CKxVzfmQ== dependencies: - regenerator-transform "^0.14.2" + "@babel/helper-plugin-utils" "^7.18.6" + regenerator-transform "^0.15.0" -"@babel/plugin-transform-reserved-words@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.16.7.tgz#1d798e078f7c5958eec952059c460b220a63f586" - integrity sha512-KQzzDnZ9hWQBjwi5lpY5v9shmm6IVG0U9pB18zvMu2i4H90xpT4gmqwPYsn8rObiadYe2M0gmgsiOIF5A/2rtg== +"@babel/plugin-transform-reserved-words@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.18.6.tgz#b1abd8ebf8edaa5f7fe6bbb8d2133d23b6a6f76a" + integrity sha512-oX/4MyMoypzHjFrT1CdivfKZ+XvIPMFXwwxHp/r0Ddy2Vuomt4HDFGmft1TAY2yiTKiNSsh3kjBAzcM8kSdsjA== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-runtime@^7.16.4": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.16.7.tgz#1da184cb83a2287a01956c10c60e66dd503c18aa" - integrity sha512-2FoHiSAWkdq4L06uaDN3rS43i6x28desUVxq+zAFuE6kbWYQeiLPJI5IC7Sg9xKYVcrBKSQkVUfH6aeQYbl9QA== - dependencies: - "@babel/helper-module-imports" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" - babel-plugin-polyfill-corejs2 "^0.3.0" - babel-plugin-polyfill-corejs3 "^0.4.0" - babel-plugin-polyfill-regenerator "^0.3.0" + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.18.6.tgz#77b14416015ea93367ca06979710f5000ff34ccb" + integrity sha512-8uRHk9ZmRSnWqUgyae249EJZ94b0yAGLBIqzZzl+0iEdbno55Pmlt/32JZsHwXD9k/uZj18Aqqk35wBX4CBTXA== + dependencies: + "@babel/helper-module-imports" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" + babel-plugin-polyfill-corejs2 "^0.3.1" + babel-plugin-polyfill-corejs3 "^0.5.2" + babel-plugin-polyfill-regenerator "^0.3.1" semver "^6.3.0" -"@babel/plugin-transform-shorthand-properties@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.16.7.tgz#e8549ae4afcf8382f711794c0c7b6b934c5fbd2a" - integrity sha512-hah2+FEnoRoATdIb05IOXf+4GzXYTq75TVhIn1PewihbpyrNWUt2JbudKQOETWw6QpLe+AIUpJ5MVLYTQbeeUg== +"@babel/plugin-transform-shorthand-properties@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.18.6.tgz#6d6df7983d67b195289be24909e3f12a8f664dc9" + integrity sha512-eCLXXJqv8okzg86ywZJbRn19YJHU4XUa55oz2wbHhaQVn/MM+XhukiT7SYqp/7o00dg52Rj51Ny+Ecw4oyoygw== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-spread@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.16.7.tgz#a303e2122f9f12e0105daeedd0f30fb197d8ff44" - integrity sha512-+pjJpgAngb53L0iaA5gU/1MLXJIfXcYepLgXB3esVRf4fqmj8f2cxM3/FKaHsZms08hFQJkFccEWuIpm429TXg== +"@babel/plugin-transform-spread@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.18.6.tgz#82b080241965f1689f0a60ecc6f1f6575dbdb9d6" + integrity sha512-ayT53rT/ENF8WWexIRg9AiV9h0aIteyWn5ptfZTZQrjk/+f3WdrJGCY4c9wcgl2+MKkKPhzbYp97FTsquZpDCw== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-skip-transparent-expression-wrappers" "^7.18.6" -"@babel/plugin-transform-sticky-regex@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.16.7.tgz#c84741d4f4a38072b9a1e2e3fd56d359552e8660" - integrity sha512-NJa0Bd/87QV5NZZzTuZG5BPJjLYadeSZ9fO6oOUoL4iQx+9EEuw/eEM92SrsT19Yc2jgB1u1hsjqDtH02c3Drw== +"@babel/plugin-transform-sticky-regex@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.18.6.tgz#c6706eb2b1524028e317720339583ad0f444adcc" + integrity sha512-kfiDrDQ+PBsQDO85yj1icueWMfGfJFKN1KCkndygtu/C9+XUfydLC8Iv5UYJqRwy4zk8EcplRxEOeLyjq1gm6Q== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-template-literals@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.16.7.tgz#f3d1c45d28967c8e80f53666fc9c3e50618217ab" - integrity sha512-VwbkDDUeenlIjmfNeDX/V0aWrQH2QiVyJtwymVQSzItFDTpxfyJh3EVaQiS0rIN/CqbLGr0VcGmuwyTdZtdIsA== +"@babel/plugin-transform-template-literals@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.18.6.tgz#b763f4dc9d11a7cce58cf9a490d82e80547db9c2" + integrity sha512-UuqlRrQmT2SWRvahW46cGSany0uTlcj8NYOS5sRGYi8FxPYPoLd5DDmMd32ZXEj2Jq+06uGVQKHxa/hJx2EzKw== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-typeof-symbol@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.16.7.tgz#9cdbe622582c21368bd482b660ba87d5545d4f7e" - integrity sha512-p2rOixCKRJzpg9JB4gjnG4gjWkWa89ZoYUnl9snJ1cWIcTH/hvxZqfO+WjG6T8DRBpctEol5jw1O5rA8gkCokQ== +"@babel/plugin-transform-typeof-symbol@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.18.6.tgz#486bb39d5a18047358e0d04dc0d2f322f0b92e92" + integrity sha512-7m71iS/QhsPk85xSjFPovHPcH3H9qeyzsujhTc+vcdnsXavoWYJ74zx0lP5RhpC5+iDnVLO+PPMHzC11qels1g== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-typescript@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.16.7.tgz#33f8c2c890fbfdc4ef82446e9abb8de8211a3ff3" - integrity sha512-Hzx1lvBtOCWuCEwMmYOfpQpO7joFeXLgoPuzZZBtTxXqSqUGUubvFGZv2ygo1tB5Bp9q6PXV3H0E/kf7KM0RLA== +"@babel/plugin-transform-typescript@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.18.6.tgz#8f4ade1a9cf253e5cf7c7c20173082c2c08a50a7" + integrity sha512-ijHNhzIrLj5lQCnI6aaNVRtGVuUZhOXFLRVFs7lLrkXTHip4FKty5oAuQdk4tywG0/WjXmjTfQCWmuzrvFer1w== dependencies: - "@babel/helper-create-class-features-plugin" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/plugin-syntax-typescript" "^7.16.7" + "@babel/helper-create-class-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/plugin-syntax-typescript" "^7.18.6" -"@babel/plugin-transform-unicode-escapes@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.16.7.tgz#da8717de7b3287a2c6d659750c964f302b31ece3" - integrity sha512-TAV5IGahIz3yZ9/Hfv35TV2xEm+kaBDaZQCn2S/hG9/CZ0DktxJv9eKfPc7yYCvOYR4JGx1h8C+jcSOvgaaI/Q== +"@babel/plugin-transform-unicode-escapes@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.18.6.tgz#0d01fb7fb2243ae1c033f65f6e3b4be78db75f27" + integrity sha512-XNRwQUXYMP7VLuy54cr/KS/WeL3AZeORhrmeZ7iewgu+X2eBqmpaLI/hzqr9ZxCeUoq0ASK4GUzSM0BDhZkLFw== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-unicode-regex@^7.16.7": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.16.7.tgz#0f7aa4a501198976e25e82702574c34cfebe9ef2" - integrity sha512-oC5tYYKw56HO75KZVLQ+R/Nl3Hro9kf8iG0hXoaHP7tjAyCpvqBiSNe6vGrZni1Z6MggmUOC6A7VP7AVmw225Q== +"@babel/plugin-transform-unicode-regex@^7.18.6": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.18.6.tgz#194317225d8c201bbae103364ffe9e2cea36cdca" + integrity sha512-gE7A6Lt7YLnNOL3Pb9BNeZvi+d8l7tcRrG4+pwJjK9hD2xX4mEvjlQW60G9EEmfXVYRPv9VRQcyegIVHCql/AA== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-create-regexp-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/polyfill@~7.12.1": version "7.12.1" @@ -974,36 +985,37 @@ regenerator-runtime "^0.13.4" "@babel/preset-env@^7.16.4", "@babel/preset-env@^7.8.4", "@babel/preset-env@^7.9.5": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.16.7.tgz#c491088856d0b3177822a2bf06cb74d76327aa56" - integrity sha512-urX3Cee4aOZbRWOSa3mKPk0aqDikfILuo+C7qq7HY0InylGNZ1fekq9jmlr3pLWwZHF4yD7heQooc2Pow2KMyQ== - dependencies: - "@babel/compat-data" "^7.16.4" - "@babel/helper-compilation-targets" "^7.16.7" - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/helper-validator-option" "^7.16.7" - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.16.7" - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.16.7" - "@babel/plugin-proposal-async-generator-functions" "^7.16.7" - "@babel/plugin-proposal-class-properties" "^7.16.7" - "@babel/plugin-proposal-class-static-block" "^7.16.7" - "@babel/plugin-proposal-dynamic-import" "^7.16.7" - "@babel/plugin-proposal-export-namespace-from" "^7.16.7" - "@babel/plugin-proposal-json-strings" "^7.16.7" - "@babel/plugin-proposal-logical-assignment-operators" "^7.16.7" - "@babel/plugin-proposal-nullish-coalescing-operator" "^7.16.7" - "@babel/plugin-proposal-numeric-separator" "^7.16.7" - "@babel/plugin-proposal-object-rest-spread" "^7.16.7" - "@babel/plugin-proposal-optional-catch-binding" "^7.16.7" - "@babel/plugin-proposal-optional-chaining" "^7.16.7" - "@babel/plugin-proposal-private-methods" "^7.16.7" - "@babel/plugin-proposal-private-property-in-object" "^7.16.7" - "@babel/plugin-proposal-unicode-property-regex" "^7.16.7" + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.18.6.tgz#953422e98a5f66bc56cd0b9074eaea127ec86ace" + integrity sha512-WrthhuIIYKrEFAwttYzgRNQ5hULGmwTj+D6l7Zdfsv5M7IWV/OZbUfbeL++Qrzx1nVJwWROIFhCHRYQV4xbPNw== + dependencies: + "@babel/compat-data" "^7.18.6" + "@babel/helper-compilation-targets" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-validator-option" "^7.18.6" + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.18.6" + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.18.6" + "@babel/plugin-proposal-async-generator-functions" "^7.18.6" + "@babel/plugin-proposal-class-properties" "^7.18.6" + "@babel/plugin-proposal-class-static-block" "^7.18.6" + "@babel/plugin-proposal-dynamic-import" "^7.18.6" + "@babel/plugin-proposal-export-namespace-from" "^7.18.6" + "@babel/plugin-proposal-json-strings" "^7.18.6" + "@babel/plugin-proposal-logical-assignment-operators" "^7.18.6" + "@babel/plugin-proposal-nullish-coalescing-operator" "^7.18.6" + "@babel/plugin-proposal-numeric-separator" "^7.18.6" + "@babel/plugin-proposal-object-rest-spread" "^7.18.6" + "@babel/plugin-proposal-optional-catch-binding" "^7.18.6" + "@babel/plugin-proposal-optional-chaining" "^7.18.6" + "@babel/plugin-proposal-private-methods" "^7.18.6" + "@babel/plugin-proposal-private-property-in-object" "^7.18.6" + "@babel/plugin-proposal-unicode-property-regex" "^7.18.6" "@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-syntax-class-properties" "^7.12.13" "@babel/plugin-syntax-class-static-block" "^7.14.5" "@babel/plugin-syntax-dynamic-import" "^7.8.3" "@babel/plugin-syntax-export-namespace-from" "^7.8.3" + "@babel/plugin-syntax-import-assertions" "^7.18.6" "@babel/plugin-syntax-json-strings" "^7.8.3" "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" @@ -1013,44 +1025,44 @@ "@babel/plugin-syntax-optional-chaining" "^7.8.3" "@babel/plugin-syntax-private-property-in-object" "^7.14.5" "@babel/plugin-syntax-top-level-await" "^7.14.5" - "@babel/plugin-transform-arrow-functions" "^7.16.7" - "@babel/plugin-transform-async-to-generator" "^7.16.7" - "@babel/plugin-transform-block-scoped-functions" "^7.16.7" - "@babel/plugin-transform-block-scoping" "^7.16.7" - "@babel/plugin-transform-classes" "^7.16.7" - "@babel/plugin-transform-computed-properties" "^7.16.7" - "@babel/plugin-transform-destructuring" "^7.16.7" - "@babel/plugin-transform-dotall-regex" "^7.16.7" - "@babel/plugin-transform-duplicate-keys" "^7.16.7" - "@babel/plugin-transform-exponentiation-operator" "^7.16.7" - "@babel/plugin-transform-for-of" "^7.16.7" - "@babel/plugin-transform-function-name" "^7.16.7" - "@babel/plugin-transform-literals" "^7.16.7" - "@babel/plugin-transform-member-expression-literals" "^7.16.7" - "@babel/plugin-transform-modules-amd" "^7.16.7" - "@babel/plugin-transform-modules-commonjs" "^7.16.7" - "@babel/plugin-transform-modules-systemjs" "^7.16.7" - "@babel/plugin-transform-modules-umd" "^7.16.7" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.16.7" - "@babel/plugin-transform-new-target" "^7.16.7" - "@babel/plugin-transform-object-super" "^7.16.7" - "@babel/plugin-transform-parameters" "^7.16.7" - "@babel/plugin-transform-property-literals" "^7.16.7" - "@babel/plugin-transform-regenerator" "^7.16.7" - "@babel/plugin-transform-reserved-words" "^7.16.7" - "@babel/plugin-transform-shorthand-properties" "^7.16.7" - "@babel/plugin-transform-spread" "^7.16.7" - "@babel/plugin-transform-sticky-regex" "^7.16.7" - "@babel/plugin-transform-template-literals" "^7.16.7" - "@babel/plugin-transform-typeof-symbol" "^7.16.7" - "@babel/plugin-transform-unicode-escapes" "^7.16.7" - "@babel/plugin-transform-unicode-regex" "^7.16.7" + "@babel/plugin-transform-arrow-functions" "^7.18.6" + "@babel/plugin-transform-async-to-generator" "^7.18.6" + "@babel/plugin-transform-block-scoped-functions" "^7.18.6" + "@babel/plugin-transform-block-scoping" "^7.18.6" + "@babel/plugin-transform-classes" "^7.18.6" + "@babel/plugin-transform-computed-properties" "^7.18.6" + "@babel/plugin-transform-destructuring" "^7.18.6" + "@babel/plugin-transform-dotall-regex" "^7.18.6" + "@babel/plugin-transform-duplicate-keys" "^7.18.6" + "@babel/plugin-transform-exponentiation-operator" "^7.18.6" + "@babel/plugin-transform-for-of" "^7.18.6" + "@babel/plugin-transform-function-name" "^7.18.6" + "@babel/plugin-transform-literals" "^7.18.6" + "@babel/plugin-transform-member-expression-literals" "^7.18.6" + "@babel/plugin-transform-modules-amd" "^7.18.6" + "@babel/plugin-transform-modules-commonjs" "^7.18.6" + "@babel/plugin-transform-modules-systemjs" "^7.18.6" + "@babel/plugin-transform-modules-umd" "^7.18.6" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.18.6" + "@babel/plugin-transform-new-target" "^7.18.6" + "@babel/plugin-transform-object-super" "^7.18.6" + "@babel/plugin-transform-parameters" "^7.18.6" + "@babel/plugin-transform-property-literals" "^7.18.6" + "@babel/plugin-transform-regenerator" "^7.18.6" + "@babel/plugin-transform-reserved-words" "^7.18.6" + "@babel/plugin-transform-shorthand-properties" "^7.18.6" + "@babel/plugin-transform-spread" "^7.18.6" + "@babel/plugin-transform-sticky-regex" "^7.18.6" + "@babel/plugin-transform-template-literals" "^7.18.6" + "@babel/plugin-transform-typeof-symbol" "^7.18.6" + "@babel/plugin-transform-unicode-escapes" "^7.18.6" + "@babel/plugin-transform-unicode-regex" "^7.18.6" "@babel/preset-modules" "^0.1.5" - "@babel/types" "^7.16.7" - babel-plugin-polyfill-corejs2 "^0.3.0" - babel-plugin-polyfill-corejs3 "^0.4.0" - babel-plugin-polyfill-regenerator "^0.3.0" - core-js-compat "^3.19.1" + "@babel/types" "^7.18.6" + babel-plugin-polyfill-corejs2 "^0.3.1" + babel-plugin-polyfill-corejs3 "^0.5.2" + babel-plugin-polyfill-regenerator "^0.3.1" + core-js-compat "^3.22.1" semver "^6.3.0" "@babel/preset-modules@^0.1.5": @@ -1065,72 +1077,72 @@ esutils "^2.0.2" "@babel/preset-react@^7.16.0", "@babel/preset-react@^7.9.4": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.16.7.tgz#4c18150491edc69c183ff818f9f2aecbe5d93852" - integrity sha512-fWpyI8UM/HE6DfPBzD8LnhQ/OcH8AgTaqcqP2nGOXEUV+VKBR5JRN9hCk9ai+zQQ57vtm9oWeXguBCPNUjytgA== + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.18.6.tgz#979f76d6277048dc19094c217b507f3ad517dd2d" + integrity sha512-zXr6atUmyYdiWRVLOZahakYmOBHtWc2WGCkP8PYTgZi0iJXDY2CN180TdrIW4OGOAdLc7TifzDIvtx6izaRIzg== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/helper-validator-option" "^7.16.7" - "@babel/plugin-transform-react-display-name" "^7.16.7" - "@babel/plugin-transform-react-jsx" "^7.16.7" - "@babel/plugin-transform-react-jsx-development" "^7.16.7" - "@babel/plugin-transform-react-pure-annotations" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-validator-option" "^7.18.6" + "@babel/plugin-transform-react-display-name" "^7.18.6" + "@babel/plugin-transform-react-jsx" "^7.18.6" + "@babel/plugin-transform-react-jsx-development" "^7.18.6" + "@babel/plugin-transform-react-pure-annotations" "^7.18.6" "@babel/preset-typescript@^7.16.0": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.16.7.tgz#ab114d68bb2020afc069cd51b37ff98a046a70b9" - integrity sha512-WbVEmgXdIyvzB77AQjGBEyYPZx+8tTsO50XtfozQrkW8QB2rLJpH2lgx0TRw5EJrBxOZQ+wCcyPVQvS8tjEHpQ== + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.18.6.tgz#ce64be3e63eddc44240c6358daefac17b3186399" + integrity sha512-s9ik86kXBAnD760aybBucdpnLsAt0jK1xqJn2juOn9lkOvSHV60os5hxoVJsPzMQxvnUJFAlkont2DvvaYEBtQ== dependencies: - "@babel/helper-plugin-utils" "^7.16.7" - "@babel/helper-validator-option" "^7.16.7" - "@babel/plugin-transform-typescript" "^7.16.7" + "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-validator-option" "^7.18.6" + "@babel/plugin-transform-typescript" "^7.18.6" "@babel/runtime-corejs3@^7.10.2": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.16.7.tgz#a762745fe8b4d61a26444a9151e6586d36044dde" - integrity sha512-MiYR1yk8+TW/CpOD0CyX7ve9ffWTKqLk/L6pk8TPl0R8pNi+1pFY8fH9yET55KlvukQ4PAWfXsGr2YHVjcI4Pw== + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.18.6.tgz#6f02c5536911f4b445946a2179554b95c8838635" + integrity sha512-cOu5wH2JFBgMjje+a+fz2JNIWU4GzYpl05oSob3UDvBEh6EuIn+TXFHMmBbhSb+k/4HMzgKCQfEEDArAWNF9Cw== dependencies: - core-js-pure "^3.19.0" + core-js-pure "^3.20.2" regenerator-runtime "^0.13.4" -"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.4", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.16.3", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz#03ff99f64106588c9c403c6ecb8c3bafbbdff1fa" - integrity sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ== +"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.4", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.16.3", "@babel/runtime@^7.18.3", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.18.6.tgz#6a1ef59f838debd670421f8c7f2cbb8da9751580" + integrity sha512-t9wi7/AW6XtKahAe20Yw0/mMljKq0B1r2fPdvaAdV/KPDZewFXdaaa6K7lxmZBZ8FBNpCiAT6iHPmd6QO9bKfQ== dependencies: regenerator-runtime "^0.13.4" -"@babel/template@^7.10.4", "@babel/template@^7.16.7", "@babel/template@^7.3.3": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz#8d126c8701fde4d66b264b3eba3d96f07666d155" - integrity sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w== - dependencies: - "@babel/code-frame" "^7.16.7" - "@babel/parser" "^7.16.7" - "@babel/types" "^7.16.7" - -"@babel/traverse@^7.1.0", "@babel/traverse@^7.12.1", "@babel/traverse@^7.13.0", "@babel/traverse@^7.16.7", "@babel/traverse@^7.4.5", "@babel/traverse@^7.7.0": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.7.tgz#dac01236a72c2560073658dd1a285fe4e0865d76" - integrity sha512-8KWJPIb8c2VvY8AJrydh6+fVRo2ODx1wYBU2398xJVq0JomuLBZmVQzLPBblJgHIGYG4znCpUZUZ0Pt2vdmVYQ== - dependencies: - "@babel/code-frame" "^7.16.7" - "@babel/generator" "^7.16.7" - "@babel/helper-environment-visitor" "^7.16.7" - "@babel/helper-function-name" "^7.16.7" - "@babel/helper-hoist-variables" "^7.16.7" - "@babel/helper-split-export-declaration" "^7.16.7" - "@babel/parser" "^7.16.7" - "@babel/types" "^7.16.7" +"@babel/template@^7.10.4", "@babel/template@^7.18.6", "@babel/template@^7.3.3": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/template/-/template-7.18.6.tgz#1283f4993e00b929d6e2d3c72fdc9168a2977a31" + integrity sha512-JoDWzPe+wgBsTTgdnIma3iHNFC7YVJoPssVBDjiHfNlyt4YcunDtcDOUmfVDfCK5MfdsaIoX9PkijPhjH3nYUw== + dependencies: + "@babel/code-frame" "^7.18.6" + "@babel/parser" "^7.18.6" + "@babel/types" "^7.18.6" + +"@babel/traverse@^7.1.0", "@babel/traverse@^7.12.1", "@babel/traverse@^7.13.0", "@babel/traverse@^7.18.6", "@babel/traverse@^7.4.5", "@babel/traverse@^7.7.0": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.18.6.tgz#a228562d2f46e89258efa4ddd0416942e2fd671d" + integrity sha512-zS/OKyqmD7lslOtFqbscH6gMLFYOfG1YPqCKfAW5KrTeolKqvB8UelR49Fpr6y93kYkW2Ik00mT1LOGiAGvizw== + dependencies: + "@babel/code-frame" "^7.18.6" + "@babel/generator" "^7.18.6" + "@babel/helper-environment-visitor" "^7.18.6" + "@babel/helper-function-name" "^7.18.6" + "@babel/helper-hoist-variables" "^7.18.6" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/parser" "^7.18.6" + "@babel/types" "^7.18.6" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.12.1", "@babel/types@^7.12.6", "@babel/types@^7.16.0", "@babel/types@^7.16.7", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0": - version "7.16.7" - resolved "https://registry.npmjs.org/@babel/types/-/types-7.16.7.tgz#4ed19d51f840ed4bd5645be6ce40775fecf03159" - integrity sha512-E8HuV7FO9qLpx6OtoGfUQ2cjIYnbFwvZWYBS+87EwtdMvmUPJSwykpovFB+8insbpF0uJcpr8KMUi64XZntZcg== +"@babel/types@^7.0.0", "@babel/types@^7.12.1", "@babel/types@^7.12.6", "@babel/types@^7.18.6", "@babel/types@^7.18.7", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4", "@babel/types@^7.7.0": + version "7.18.7" + resolved "https://registry.npmjs.org/@babel/types/-/types-7.18.7.tgz#a4a2c910c15040ea52cdd1ddb1614a65c8041726" + integrity sha512-QG3yxTcTIBoAcQmkCs+wAPYZhu7Dk9rXKacINfNbdJDNERTbLQbHGyVG8q/YGMPeCJRIhSY0+fTc5+xuh6WPSQ== dependencies: - "@babel/helper-validator-identifier" "^7.16.7" + "@babel/helper-validator-identifier" "^7.18.6" to-fast-properties "^2.0.0" "@bcoe/v8-coverage@^0.2.3": @@ -1157,26 +1169,26 @@ integrity sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg== "@ctrl/tinycolor@^3.4.0": - version "3.4.0" - resolved "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-3.4.0.tgz#c3c5ae543c897caa9c2a68630bed355be5f9990f" - integrity sha512-JZButFdZ1+/xAfpguQHoabIXkcqRRKpMrWKBkpEZZyxfY9C1DpADFB8PEqGSTeFr135SaTRfKqGKx5xSCLI7ZQ== + version "3.4.1" + resolved "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-3.4.1.tgz#75b4c27948c81e88ccd3a8902047bcd797f38d32" + integrity sha512-ej5oVy6lykXsvieQtqZxCOaLT+xD4+QNarq78cIYISHmZXshCvROLudpQN3lfL8G0NL7plMSSK+zlyvCaIJ4Iw== "@discoveryjs/json-ext@^0.5.0": - version "0.5.6" - resolved "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.6.tgz#d5e0706cf8c6acd8c6032f8d54070af261bbbb2f" - integrity sha512-ws57AidsDvREKrZKYffXddNkyaF14iHNHm8VQnZH6t99E8gczjNN0GpvcGny0imC80yQ0tHz1xVUKk/KFQSUyA== + version "0.5.7" + resolved "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70" + integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw== -"@emotion/is-prop-valid@^0.8.8": - version "0.8.8" - resolved "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz#db28b1c4368a259b60a97311d6a952d4fd01ac1a" - integrity sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA== +"@emotion/is-prop-valid@^1.1.0": + version "1.1.3" + resolved "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.1.3.tgz#f0907a416368cf8df9e410117068e20fe87c0a3a" + integrity sha512-RFg04p6C+1uO19uG8N+vqanzKqiM9eeV1LDOG3bmkYmuOj7NbKNlFC/4EZq5gnwAIlcC/jOT24f8Td0iax2SXA== dependencies: - "@emotion/memoize" "0.7.4" + "@emotion/memoize" "^0.7.4" -"@emotion/memoize@0.7.4": - version "0.7.4" - resolved "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz#19bf0f5af19149111c40d98bb0cf82119f5d9eeb" - integrity sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw== +"@emotion/memoize@^0.7.4": + version "0.7.5" + resolved "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.5.tgz#2c40f81449a4e554e9fc6396910ed4843ec2be50" + integrity sha512-igX9a37DR2ZPGYtV6suZ6whr8pTFtyHL3K/oLUotxpSVO2ASaprmAe2Dkq7tBo7CRY7MMDrAa9nuQP9/YG8FxQ== "@emotion/stylis@^0.8.4": version "0.8.5" @@ -1204,9 +1216,9 @@ strip-json-comments "^3.1.1" "@gar/promisify@^1.0.1": - version "1.1.2" - resolved "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.2.tgz#30aa825f11d438671d585bd44e7fd564535fc210" - integrity sha512-82cpyJyKRoQoRi+14ibCeGPu0CwypgtBAdBhq1WfvagpCZNKqwXbKwXllYSMG91DhmG4jt9gN8eP6lGOtozuaw== + version "1.1.3" + resolved "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" + integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw== "@hapi/address@2.x.x": version "2.1.4" @@ -1379,6 +1391,13 @@ optionalDependencies: node-notifier "^8.0.0" +"@jest/schemas@^28.0.2": + version "28.0.2" + resolved "https://registry.npmjs.org/@jest/schemas/-/schemas-28.0.2.tgz#08c30df6a8d07eafea0aef9fb222c5e26d72e613" + integrity sha512-YVDJZjd4izeTDkij00vHHAymNXQ6WWsdChFRK86qck6Jpr3DCL5W3Is3vslviRlP+bLuMYRLbdp98amMvqudhA== + dependencies: + "@sinclair/typebox" "^0.23.3" + "@jest/source-map@^26.6.2": version "26.6.2" resolved "https://registry.npmjs.org/@jest/source-map/-/source-map-26.6.2.tgz#29af5e1e2e324cafccc936f218309f54ab69d535" @@ -1441,16 +1460,53 @@ "@types/yargs" "^15.0.0" chalk "^4.0.0" -"@jest/types@^27.4.2": - version "27.4.2" - resolved "https://registry.npmjs.org/@jest/types/-/types-27.4.2.tgz#96536ebd34da6392c2b7c7737d693885b5dd44a5" - integrity sha512-j35yw0PMTPpZsUoOBiuHzr1zTYoad1cVIE0ajEjcrJONxxrko/IRGKkXx3os0Nsi4Hu3+5VmDbVfq5WhG/pWAg== +"@jridgewell/gen-mapping@^0.1.0": + version "0.1.1" + resolved "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz#e5d2e450306a9491e3bd77e323e38d7aff315996" + integrity sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w== dependencies: - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^3.0.0" - "@types/node" "*" - "@types/yargs" "^16.0.0" - chalk "^4.0.0" + "@jridgewell/set-array" "^1.0.0" + "@jridgewell/sourcemap-codec" "^1.4.10" + +"@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": + version "0.3.2" + resolved "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" + integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A== + dependencies: + "@jridgewell/set-array" "^1.0.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/resolve-uri@^3.0.3": + version "3.0.8" + resolved "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.8.tgz#687cc2bbf243f4e9a868ecf2262318e2658873a1" + integrity sha512-YK5G9LaddzGbcucK4c8h5tWFmMPBvRZ/uyWmN1/SbBdIvqGUdWGkJ5BAaccgs6XbzVLsqbPJrBSFwKv3kT9i7w== + +"@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1": + version "1.1.2" + resolved "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" + integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== + +"@jridgewell/source-map@^0.3.2": + version "0.3.2" + resolved "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz#f45351aaed4527a298512ec72f81040c998580fb" + integrity sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw== + dependencies: + "@jridgewell/gen-mapping" "^0.3.0" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/sourcemap-codec@^1.4.10": + version "1.4.14" + resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" + integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== + +"@jridgewell/trace-mapping@^0.3.9": + version "0.3.14" + resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz#b231a081d8f66796e475ad588a1ef473112701ed" + integrity sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -1474,9 +1530,9 @@ fastq "^1.6.0" "@npmcli/fs@^1.0.0": - version "1.1.0" - resolved "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.0.tgz#bec1d1b89c170d40e1b73ad6c943b0b75e7d2951" - integrity sha512-VhP1qZLXcrXRIaPoqb4YA55JQxLNF3jNR4T55IdOJa3+IFJKNYHtPvtXx8slmeMavj37vCzCfrqQM1vWLsYKLA== + version "1.1.1" + resolved "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz#72f719fe935e687c56a4faecf3c03d06ba593257" + integrity sha512-8KG5RD0GVP4ydEzRn/I4BNDuxDtqVbOdm8675T49OIG/NGhaK0pjPX7ZcDlvKYbA+ulvVK3ztfcF4uBdOxuJbQ== dependencies: "@gar/promisify" "^1.0.1" semver "^7.3.5" @@ -1489,16 +1545,19 @@ mkdirp "^1.0.4" rimraf "^3.0.2" -"@pmmmwh/react-refresh-webpack-plugin@0.4.2": - version "0.4.2" - resolved "https://registry.npmjs.org/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.4.2.tgz#1f9741e0bde9790a0e13272082ed7272a083620d" - integrity sha512-Loc4UDGutcZ+Bd56hBInkm6JyjyCwWy4t2wcDXzN8EDPANgVRj0VP8Nxn0Zq2pc+WKauZwEivQgbDGg4xZO20A== +"@pmmmwh/react-refresh-webpack-plugin@0.5.7": + version "0.5.7" + resolved "https://registry.npmjs.org/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.5.7.tgz#58f8217ba70069cc6a73f5d7e05e85b458c150e2" + integrity sha512-bcKCAzF0DV2IIROp9ZHkRJa6O4jy7NlnHdWL3GmcUxYWNjLXkK5kfELELwEfSP5hXPfVL/qOGMAROuMQb9GG8Q== dependencies: - ansi-html "^0.0.7" + ansi-html-community "^0.0.8" + common-path-prefix "^3.0.0" + core-js-pure "^3.8.1" error-stack-parser "^2.0.6" - html-entities "^1.2.1" - native-url "^0.2.6" - schema-utils "^2.6.5" + find-up "^5.0.0" + html-entities "^2.1.0" + loader-utils "^2.0.0" + schema-utils "^3.0.0" source-map "^0.7.3" "@rollup/plugin-node-resolve@^7.1.1": @@ -1529,6 +1588,11 @@ estree-walker "^1.0.1" picomatch "^2.2.2" +"@sinclair/typebox@^0.23.3": + version "0.23.5" + resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.23.5.tgz#93f7b9f4e3285a7a9ade7557d9a8d36809cbc47d" + integrity sha512-AFBVi/iT4g20DHoujvMH1aEDn8fGJh4xsRGCP6d8RpLPMqsNPvW01Jcn0QysXTsg++/xj25NmJsGyH9xug/wKg== + "@sinonjs/commons@^1.7.0": version "1.8.3" resolved "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d" @@ -1669,9 +1733,9 @@ pretty-format "^26.6.2" "@testing-library/jest-dom@^5.11.4": - version "5.16.1" - resolved "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.16.1.tgz#3db7df5ae97596264a7da9696fe14695ba02e51f" - integrity sha512-ajUJdfDIuTCadB79ukO+0l8O+QwN0LiSxDaYUTI4LndbbUsGi6rWU1SCexXzBA2NSjlVB9/vbkasQIL3tmPBjw== + version "5.16.4" + resolved "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.16.4.tgz#938302d7b8b483963a3ae821f1c0808f872245cd" + integrity sha512-Gy+IoFutbMQcky0k+bqqumXZ1cTGswLsFqmNLzNdSKkU9KGV2u9oXhukCbbJ9/LRPKiqwxEE8VpV/+YZlfkPUA== dependencies: "@babel/runtime" "^7.9.2" "@types/testing-library__jest-dom" "^5.9.1" @@ -1709,9 +1773,9 @@ integrity sha512-HnYpAE1Y6kRyKM/XkEuiRQhTHvkzMBurTHnpFLYLBGPIylZNPs9jJcuOOYWxPLJCSEtmZT0Y8rHDokKN7rRTig== "@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7": - version "7.1.18" - resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.18.tgz#1a29abcc411a9c05e2094c98f9a1b7da6cdf49f8" - integrity sha512-S7unDjm/C7z2A2R9NzfKCK1I+BAALDtxEmsJBwlB3EzNfb929ykjL++1CK9LO++EIp2fQrC8O+BwjKvz6UeDyQ== + version "7.1.19" + resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz#7b497495b7d1b4812bdb9d02804d0576f43ee460" + integrity sha512-WEOTgRsbYkvA/KCsDwVEGkd7WAr1e3g31VHQ8zy5gul/V1qKullU/BU5I68X5v7V3GnB9eotmom4v5a5gjxorw== dependencies: "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" @@ -1735,13 +1799,13 @@ "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.4", "@types/babel__traverse@^7.0.6": - version "7.14.2" - resolved "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.14.2.tgz#ffcd470bbb3f8bf30481678fb5502278ca833a43" - integrity sha512-K2waXdXBi2302XUdcHcR1jCeU0LL4TD9HRs/gk0N2Xvrht+G/BfJa4QObBQZfhMdxiCpV3COl5Nfq4uKTeTnJA== + version "7.17.1" + resolved "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.17.1.tgz#1a0e73e8c28c7e832656db372b779bfd2ef37314" + integrity sha512-kVzjari1s2YVi77D3w1yuvohV2idweYXMCDzqBiVNN63TcDWrIlTVOYpqVrvbbyOE/IyzBoTKF0fdnLPEORFxA== dependencies: "@babel/types" "^7.3.0" -"@types/eslint@^7.28.2": +"@types/eslint@^7.29.0": version "7.29.0" resolved "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz#e56ddc8e542815272720bb0b4ccc2aff9c3e1c78" integrity sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng== @@ -1750,9 +1814,9 @@ "@types/json-schema" "*" "@types/estree@*": - version "0.0.50" - resolved "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz#1e0caa9364d3fccd2931c3ed96fdbeaa5d4cca83" - integrity sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw== + version "0.0.52" + resolved "https://registry.npmjs.org/@types/estree/-/estree-0.0.52.tgz#7f1f57ad5b741f3d5b210d3b1f145640d89bf8fe" + integrity sha512-BZWrtCU0bMVAIliIV+HJO1f1PR41M7NKjfxrFJwwhKI1KwhwOxYw1SXg9ao+CIMt774nFuGiG6eU+udtbEI9oQ== "@types/estree@0.0.39": version "0.0.39" @@ -1799,22 +1863,22 @@ "@types/istanbul-lib-report" "*" "@types/jest@*": - version "27.4.0" - resolved "https://registry.npmjs.org/@types/jest/-/jest-27.4.0.tgz#037ab8b872067cae842a320841693080f9cb84ed" - integrity sha512-gHl8XuC1RZ8H2j5sHv/JqsaxXkDDM9iDOgu0Wp8sjs4u/snb2PVehyWXJPr+ORA0RPpgw231mnutWI1+0hgjIQ== + version "28.1.3" + resolved "https://registry.npmjs.org/@types/jest/-/jest-28.1.3.tgz#52f3f3e50ce59191ff5fbb1084896cc0cf30c9ce" + integrity sha512-Tsbjk8Y2hkBaY/gJsataeb4q9Mubw9EOz7+4RjPkzD5KjTvHHs7cpws22InaoXxAVAhF5HfFbzJjo6oKWqSZLw== dependencies: - jest-diff "^27.0.0" - pretty-format "^27.0.0" + jest-matcher-utils "^28.0.0" + pretty-format "^28.0.0" "@types/json-schema@*", "@types/json-schema@^7.0.3", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.7", "@types/json-schema@^7.0.8": - version "7.0.9" - resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" - integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== + version "7.0.11" + resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" + integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" - integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= + integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== "@types/minimatch@*": version "3.0.5" @@ -1822,9 +1886,9 @@ integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== "@types/node@*": - version "17.0.6" - resolved "https://registry.npmjs.org/@types/node/-/node-17.0.6.tgz#cc1589c9ee853b389e67e8fb4384e0f250a139b9" - integrity sha512-+XBAjfZmmivILUzO0HwBJoYkAyyySSLg5KCGBDFLomJo0sV6szvVLAf4ANZZ0pfWzgEds5KmGLG9D5hfEqOhaA== + version "18.0.0" + resolved "https://registry.npmjs.org/@types/node/-/node-18.0.0.tgz#67c7b724e1bcdd7a8821ce0d5ee184d3b4dd525a" + integrity sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA== "@types/normalize-package-data@^2.4.0": version "2.4.1" @@ -1837,9 +1901,9 @@ integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== "@types/prettier@^2.0.0": - version "2.4.2" - resolved "https://registry.npmjs.org/@types/prettier/-/prettier-2.4.2.tgz#4c62fae93eb479660c3bd93f9d24d561597a8281" - integrity sha512-ekoj4qOQYp7CvjX8ZDBgN86w3MqQhLE1hczEJbEIjgFEumDy+na/4AJAbLXfgEWFNB2pKadM5rPFtuSGMWK7xA== + version "2.6.3" + resolved "https://registry.npmjs.org/@types/prettier/-/prettier-2.6.3.tgz#68ada76827b0010d0db071f739314fa429943d0a" + integrity sha512-ymZk3LEC/fsut+/Q5qejp6R9O1rMxz3XaRHDV6kX8MrGAhOSPqVARbDi+EZvInBpw+BnCX3TD240byVkOfQsHg== "@types/q@^1.5.1": version "1.5.5" @@ -1869,16 +1933,16 @@ integrity sha512-ipixuVrh2OdNmauvtT51o3d8z12p6LtFW9in7U79der/kwejjdNchQC5UMn5u/KxNoM7VHHOs/l8KS8uHxhODQ== "@types/testing-library__jest-dom@^5.9.1": - version "5.14.2" - resolved "https://registry.npmjs.org/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.2.tgz#564fb2b2dc827147e937a75b639a05d17ce18b44" - integrity sha512-vehbtyHUShPxIa9SioxDwCvgxukDMH//icJG90sXQBUm5lJOHLT5kNeU9tnivhnA/TkOFMzGIXN2cTc4hY8/kg== + version "5.14.5" + resolved "https://registry.npmjs.org/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.5.tgz#d113709c90b3c75fdb127ec338dad7d5f86c974f" + integrity sha512-SBwbxYoyPIvxHbeHxTZX2Pe/74F/tX2/D3mMvzabdeJ25bBojfW0TyB8BHrbq/9zaaKICJZjLP+8r6AeZMFCuQ== dependencies: "@types/jest" "*" "@types/uglify-js@*": - version "3.13.1" - resolved "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.13.1.tgz#5e889e9e81e94245c75b6450600e1c5ea2878aea" - integrity sha512-O3MmRAk6ZuAKa9CHgg0Pr0+lUOqoMLpc9AS4R8ano2auvsg7IE8syF3Xh/NPr26TWklxYcqoEEFdzLLs1fV9PQ== + version "3.16.0" + resolved "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.16.0.tgz#2cf74a0e6ebb6cd54c0d48e509d5bd91160a9602" + integrity sha512-0yeUr92L3r0GLRnBOvtYK1v2SjqMIqQDHMl7GLb+l2L8+6LSFWEEWEIgVsPdMn5ImLM8qzWT8xFPtQYpp8co0g== dependencies: source-map "^0.6.1" @@ -1904,9 +1968,9 @@ source-map "^0.6.0" "@types/yargs-parser@*": - version "20.2.1" - resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-20.2.1.tgz#3b9ce2489919d9e4fea439b76916abc34b2df129" - integrity sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw== + version "21.0.0" + resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" + integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== "@types/yargs@^15.0.0": version "15.0.14" @@ -1915,13 +1979,6 @@ dependencies: "@types/yargs-parser" "*" -"@types/yargs@^16.0.0": - version "16.0.4" - resolved "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.4.tgz#26aad98dd2c2a38e421086ea9ad42b9e51642977" - integrity sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw== - dependencies: - "@types/yargs-parser" "*" - "@typescript-eslint/eslint-plugin@^4.5.0": version "4.33.0" resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.33.0.tgz#c24dc7c8069c7706bc40d99f6fa87edcb2005276" @@ -2175,21 +2232,21 @@ "@xtuc/long" "4.2.2" "@webpack-cli/configtest@^1.0.1": - version "1.1.0" - resolved "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.1.0.tgz#8342bef0badfb7dfd3b576f2574ab80c725be043" - integrity sha512-ttOkEkoalEHa7RaFYpM0ErK1xc4twg3Am9hfHhL7MVqlHebnkYd2wuI/ZqTDj0cVzZho6PdinY0phFZV3O0Mzg== + version "1.2.0" + resolved "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz#7b20ce1c12533912c3b217ea68262365fa29a6f5" + integrity sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg== "@webpack-cli/info@^1.2.2": - version "1.4.0" - resolved "https://registry.npmjs.org/@webpack-cli/info/-/info-1.4.0.tgz#b9179c3227ab09cbbb149aa733475fcf99430223" - integrity sha512-F6b+Man0rwE4n0409FyAJHStYA5OIZERxmnUfLVwv0mc0V1wLad3V7jqRlMkgKBeAq07jUvglacNaa6g9lOpuw== + version "1.5.0" + resolved "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz#6c78c13c5874852d6e2dd17f08a41f3fe4c261b1" + integrity sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ== dependencies: envinfo "^7.7.3" "@webpack-cli/serve@^1.3.0": - version "1.6.0" - resolved "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.6.0.tgz#2c275aa05c895eccebbfc34cfb223c6e8bd591a2" - integrity sha512-ZkVeqEmRpBV2GHvjjUZqEai2PpUbuq8Bqd//vEYsp63J8WyexI8ppCqVS3Zs0QADf6aWuPdU+0XsPI647PVlQA== + version "1.7.0" + resolved "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz#e1993689ac42d2b16e9194376cfb6753f6254db1" + integrity sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q== "@xtuc/ieee754@^1.2.0": version "1.2.0" @@ -2202,17 +2259,17 @@ integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ== abab@^2.0.3, abab@^2.0.5: - version "2.0.5" - resolved "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a" - integrity sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q== + version "2.0.6" + resolved "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" + integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== -accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7: - version "1.3.7" - resolved "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz#531bc726517a3b2b41f850021c6cc15eaab507cd" - integrity sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA== +accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: + version "1.3.8" + resolved "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" + integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw== dependencies: - mime-types "~2.1.24" - negotiator "0.6.2" + mime-types "~2.1.34" + negotiator "0.6.3" acorn-globals@^6.0.0: version "6.0.0" @@ -2242,16 +2299,21 @@ acorn@^7.1.0, acorn@^7.1.1, acorn@^7.4.0: resolved "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -acorn@^8.2.4: - version "8.7.0" - resolved "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz#90951fde0f8f09df93549481e5fc141445b791cf" - integrity sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ== +acorn@^8.2.4, acorn@^8.5.0: + version "8.7.1" + resolved "https://registry.npmjs.org/acorn/-/acorn-8.7.1.tgz#0197122c843d1bf6d0a5e83220a788f278f63c30" + integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A== -address@1.1.2, address@^1.0.1: +address@1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/address/-/address-1.1.2.tgz#bf1116c9c758c51b7a933d296b72c221ed9428b6" integrity sha512-aT6camzM4xEA54YVJYSqxz1kv4IHnQZRtThJJHhUMRExaU5spC7jX5ugSwTaTgJliIgs4VhZOk7htClvQ/LmRA== +address@^1.0.1: + version "1.2.0" + resolved "https://registry.npmjs.org/address/-/address-1.2.0.tgz#d352a62c92fee90f89a693eccd2a8b2139ab02d9" + integrity sha512-tNEZYz5G/zYunxFm7sfhAxkXEuLj3K6BKwv6ZURlsF6yiUQ65z0Q2wZW9L5cPUl9ocofGvXOdFYbFHp0+6MOig== + adjust-sourcemap-loader@3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/adjust-sourcemap-loader/-/adjust-sourcemap-loader-3.0.0.tgz#5ae12fb5b7b1c585e80bbb5a63ec163a1a45e61e" @@ -2296,9 +2358,9 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.12.4, ajv@^6.12.5: uri-js "^4.2.2" ajv@^8.0.1: - version "8.8.2" - resolved "https://registry.npmjs.org/ajv/-/ajv-8.8.2.tgz#01b4fef2007a28bf75f0b7fc009f62679de4abbb" - integrity sha512-x9VuX+R/jcFj1DHo/fCp99esgGDWiHENrKxaCENuCxpoMCmAt/COCGVDwA7kleEpEzJjDnvh3yGoOuLu0Dtllw== + version "8.11.0" + resolved "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz#977e91dd96ca669f54a11e23e378e33b884a565f" + integrity sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg== dependencies: fast-deep-equal "^3.1.1" json-schema-traverse "^1.0.0" @@ -2308,7 +2370,7 @@ ajv@^8.0.1: alphanum-sort@^1.0.0: version "1.0.2" resolved "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3" - integrity sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM= + integrity sha512-0FcBfdcmaumGPQ0qPn7Q5qTgz/ooXgIyp1rf8ik5bGX8mpE2YHjC0P/eyQvxu1GURYQgq9ozf2mteQ5ZD9YiyQ== ansi-colors@^3.0.0: version "3.2.4" @@ -2316,9 +2378,9 @@ ansi-colors@^3.0.0: integrity sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA== ansi-colors@^4.1.1: - version "4.1.1" - resolved "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" - integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== + version "4.1.3" + resolved "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" + integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== ansi-escapes@^4.2.1, ansi-escapes@^4.3.1: version "4.3.2" @@ -2327,25 +2389,20 @@ ansi-escapes@^4.2.1, ansi-escapes@^4.3.1: dependencies: type-fest "^0.21.3" -ansi-html-community@0.0.8: +ansi-html-community@0.0.8, ansi-html-community@^0.0.8: version "0.0.8" resolved "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz#69fbc4d6ccbe383f9736934ae34c3f8290f1bf41" integrity sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw== -ansi-html@^0.0.7: - version "0.0.7" - resolved "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz#813584021962a9e9e6fd039f940d12f56ca7859e" - integrity sha1-gTWEAhliqenm/QOflA0S9WynhZ4= - ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + integrity sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA== ansi-regex@^4.1.0: - version "4.1.0" - resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" - integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + version "4.1.1" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz#164daac87ab2d6f6db3a29875e2d1766582dabed" + integrity sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g== ansi-regex@^5.0.0, ansi-regex@^5.0.1: version "5.0.1" @@ -2463,12 +2520,12 @@ aria-query@^5.0.0: arity-n@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/arity-n/-/arity-n-1.0.4.tgz#d9e76b11733e08569c0847ae7b39b2860b30b745" - integrity sha1-2edrEXM+CFacCEeuezmyhgswt0U= + integrity sha512-fExL2kFDC1Q2DUOx3whE/9KoN66IzkY4b4zUHUBFM1ojEYjZZYDcUW3bek/ufGionX9giIKDC5redH2IlGqcQQ== arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" - integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= + integrity sha512-YVIQ82gZPGBebQV/a8dar4AitzCQs0jjXwMPZllpXMaGjXPYVUawSxQrRsjhjupyVxEvbHgUmIhKVlND+j02kA== arr-flatten@^1.1.0: version "1.1.0" @@ -2478,26 +2535,26 @@ arr-flatten@^1.1.0: arr-union@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" - integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= + integrity sha512-sKpyeERZ02v1FeCZT8lrfJq5u6goHCtpTAzPwJYe7c8SPFOboNjNg1vz2L4VTn9T4PQxEx13TbXLmYUcS6Ug7Q== array-flatten@1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" - integrity sha1-ml9pkFGx5wczKPKgCJaLZOopVdI= + integrity sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg== array-flatten@^2.1.0: version "2.1.2" resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz#24ef80a28c1a893617e2149b0c6d0d788293b099" integrity sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ== -array-includes@^3.1.3, array-includes@^3.1.4: - version "3.1.4" - resolved "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz#f5b493162c760f3539631f005ba2bb46acb45ba9" - integrity sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw== +array-includes@^3.1.4, array-includes@^3.1.5: + version "3.1.5" + resolved "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz#2c320010db8d31031fd2a5f6b3bbd4b1aad31bdb" + integrity sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.1" + define-properties "^1.1.4" + es-abstract "^1.19.5" get-intrinsic "^1.1.1" is-string "^1.0.7" @@ -2509,7 +2566,7 @@ array-tree-filter@^2.1.0: array-union@^1.0.1: version "1.0.2" resolved "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" - integrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk= + integrity sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng== dependencies: array-uniq "^1.0.1" @@ -2521,30 +2578,43 @@ array-union@^2.1.0: array-uniq@^1.0.1: version "1.0.3" resolved "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" - integrity sha1-r2rId6Jcx/dOBYiUdThY39sk/bY= + integrity sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q== array-unique@^0.3.2: version "0.3.2" resolved "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" - integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= + integrity sha512-SleRWjh9JUud2wH1hPs9rZBZ33H6T9HOiL0uwGnGx9FpE6wKGyfWugmbkEOIs6qWrZhg0LWeLziLrEwQJhs5mQ== array.prototype.flat@^1.2.5: - version "1.2.5" - resolved "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz#07e0975d84bbc7c48cd1879d609e682598d33e13" - integrity sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg== + version "1.3.0" + resolved "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz#0b0c1567bf57b38b56b4c97b8aa72ab45e4adc7b" + integrity sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw== dependencies: call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.19.0" + es-abstract "^1.19.2" + es-shim-unscopables "^1.0.0" -array.prototype.flatmap@^1.2.5: - version "1.2.5" - resolved "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.2.5.tgz#908dc82d8a406930fdf38598d51e7411d18d4446" - integrity sha512-08u6rVyi1Lj7oqWbS9nUxliETrtIROT4XGTA4D/LWGten6E3ocm7cy9SIrmNHOL5XVbVuckUp3X6Xyg8/zpvHA== +array.prototype.flatmap@^1.3.0: + version "1.3.0" + resolved "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.0.tgz#a7e8ed4225f4788a70cd910abcf0791e76a5534f" + integrity sha512-PZC9/8TKAIxcWKdyeb77EzULHPrIX/tIZebLJUQOMR1OwYosT8yggdfWScfTBCDj5utONvOuPQQumYsU2ULbkg== dependencies: - call-bind "^1.0.0" + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.19.0" + es-abstract "^1.19.2" + es-shim-unscopables "^1.0.0" + +array.prototype.reduce@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/array.prototype.reduce/-/array.prototype.reduce-1.0.4.tgz#8167e80089f78bff70a99e20bd4201d4663b0a6f" + integrity sha512-WnM+AjG/DvLRLo4DDl+r+SvCzYtD2Jd9oeBYMcEaI7t3fFrHY9M53/wdLcTvmZNQ70IU6Htj0emFkZ5TS+lrdw== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.2" + es-array-method-boxes-properly "^1.0.0" + is-string "^1.0.7" arrify@^2.0.1: version "2.0.1" @@ -2554,7 +2624,7 @@ arrify@^2.0.1: asap@~2.0.6: version "2.0.6" resolved "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" - integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= + integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== asn1.js@^5.2.0: version "5.4.1" @@ -2577,12 +2647,12 @@ assert@^1.1.1: assign-symbols@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" - integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= + integrity sha512-Q+JC7Whu8HhmTdBph/Tq59IoRtoy6KAm5zzPv00WdujX82lbAL8K7WVjne7vdCsAmbF4AYaDOPyO3k0kl8qIrw== ast-types-flow@^0.0.7: version "0.0.7" resolved "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" - integrity sha1-9wtzXGvKGlycItmCw+Oef+ujva0= + integrity sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag== astral-regex@^2.0.0: version "2.0.0" @@ -2605,16 +2675,16 @@ async-validator@^3.0.3: integrity sha512-8eLCg00W9pIRZSB781UUX/H6Oskmm8xloZfr09lz5bikRpBVDlJ3hRVuxxP1SxcwsEYfJ4IU8Q19Y8/893r3rQ== async@^2.6.2: - version "2.6.3" - resolved "https://registry.npmjs.org/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" - integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg== + version "2.6.4" + resolved "https://registry.npmjs.org/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221" + integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA== dependencies: lodash "^4.17.14" asynckit@^0.4.0: version "0.4.0" resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== at-least-node@^1.0.0: version "1.0.0" @@ -2639,10 +2709,10 @@ autoprefixer@^9.6.1: postcss "^7.0.32" postcss-value-parser "^4.1.0" -axe-core@^4.3.5: - version "4.3.5" - resolved "https://registry.npmjs.org/axe-core/-/axe-core-4.3.5.tgz#78d6911ba317a8262bfee292aeafcc1e04b49cc5" - integrity sha512-WKTW1+xAzhMS5dJsxWkliixlO/PqC4VhmO9T4juNYcaTg9jzWiJsou6m5pxWYGfigWbwzJWeFY6z47a+4neRXA== +axe-core@^4.4.2: + version "4.4.2" + resolved "https://registry.npmjs.org/axe-core/-/axe-core-4.4.2.tgz#dcf7fb6dea866166c3eab33d68208afe4d5f670c" + integrity sha512-LVAaGp/wkkgYJcjmHsoKx4juT1aQvJyPcW09MLCjVTh3V2cc6PnyempiLMNH5iMdfIX/zdbjUx2KDjMLCTdPeA== axobject-query@^2.2.0: version "2.2.0" @@ -2735,54 +2805,55 @@ babel-plugin-named-asset-import@^0.3.7: resolved "https://registry.npmjs.org/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.8.tgz#6b7fa43c59229685368683c28bc9734f24524cc2" integrity sha512-WXiAc++qo7XcJ1ZnTYGtLxmBCVbddAml3CEXgWaBzNzLNoxtQ8AiGEFDMOhot9XjTCQbvP5E77Fj9Gk924f00Q== -babel-plugin-polyfill-corejs2@^0.3.0: - version "0.3.0" - resolved "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.0.tgz#407082d0d355ba565af24126fb6cb8e9115251fd" - integrity sha512-wMDoBJ6uG4u4PNFh72Ty6t3EgfA91puCuAwKIazbQlci+ENb/UU9A3xG5lutjUIiXCIn1CY5L15r9LimiJyrSA== +babel-plugin-polyfill-corejs2@^0.3.1: + version "0.3.1" + resolved "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.1.tgz#440f1b70ccfaabc6b676d196239b138f8a2cfba5" + integrity sha512-v7/T6EQcNfVLfcN2X8Lulb7DjprieyLWJK/zOWH5DUYcAgex9sP3h25Q+DLsX9TloXe3y1O8l2q2Jv9q8UVB9w== dependencies: "@babel/compat-data" "^7.13.11" - "@babel/helper-define-polyfill-provider" "^0.3.0" + "@babel/helper-define-polyfill-provider" "^0.3.1" semver "^6.1.1" -babel-plugin-polyfill-corejs3@^0.4.0: - version "0.4.0" - resolved "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.4.0.tgz#0b571f4cf3d67f911512f5c04842a7b8e8263087" - integrity sha512-YxFreYwUfglYKdLUGvIF2nJEsGwj+RhWSX/ije3D2vQPOXuyMLMtg/cCGMDpOA7Nd+MwlNdnGODbd2EwUZPlsw== +babel-plugin-polyfill-corejs3@^0.5.2: + version "0.5.2" + resolved "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.5.2.tgz#aabe4b2fa04a6e038b688c5e55d44e78cd3a5f72" + integrity sha512-G3uJih0XWiID451fpeFaYGVuxHEjzKTHtc9uGFEjR6hHrvNzeS/PX+LLLcetJcytsB5m4j+K3o/EpXJNb/5IEQ== dependencies: - "@babel/helper-define-polyfill-provider" "^0.3.0" - core-js-compat "^3.18.0" + "@babel/helper-define-polyfill-provider" "^0.3.1" + core-js-compat "^3.21.0" -babel-plugin-polyfill-regenerator@^0.3.0: - version "0.3.0" - resolved "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.3.0.tgz#9ebbcd7186e1a33e21c5e20cae4e7983949533be" - integrity sha512-dhAPTDLGoMW5/84wkgwiLRwMnio2i1fUe53EuvtKMv0pn2p3S8OCoV1xAzfJPl0KOX7IB89s2ib85vbYiea3jg== +babel-plugin-polyfill-regenerator@^0.3.1: + version "0.3.1" + resolved "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.3.1.tgz#2c0678ea47c75c8cc2fbb1852278d8fb68233990" + integrity sha512-Y2B06tvgHYt1x0yz17jGkGeeMr5FeKUu+ASJ+N6nB5lQ8Dapfg42i0OVrf8PNGJ3zKL4A23snMi1IRwrqqND7A== dependencies: - "@babel/helper-define-polyfill-provider" "^0.3.0" + "@babel/helper-define-polyfill-provider" "^0.3.1" "babel-plugin-styled-components@>= 1.12.0": - version "2.0.2" - resolved "https://registry.npmjs.org/babel-plugin-styled-components/-/babel-plugin-styled-components-2.0.2.tgz#0fac11402dc9db73698b55847ab1dc73f5197c54" - integrity sha512-7eG5NE8rChnNTDxa6LQfynwgHTVOYYaHJbUYSlOhk8QBXIQiMBKq4gyfHBBKPrxUcVBXVJL61ihduCpCQbuNbw== + version "2.0.7" + resolved "https://registry.npmjs.org/babel-plugin-styled-components/-/babel-plugin-styled-components-2.0.7.tgz#c81ef34b713f9da2b7d3f5550df0d1e19e798086" + integrity sha512-i7YhvPgVqRKfoQ66toiZ06jPNA3p6ierpfUuEWxNF+fV27Uv5gxBkf8KZLHUCc1nFA9j6+80pYoIpqCeyW3/bA== dependencies: "@babel/helper-annotate-as-pure" "^7.16.0" "@babel/helper-module-imports" "^7.16.0" babel-plugin-syntax-jsx "^6.18.0" lodash "^4.17.11" + picomatch "^2.3.0" babel-plugin-syntax-jsx@^6.18.0: version "6.18.0" resolved "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz#0af32a9a6e13ca7a3fd5069e62d7b0f58d0d8946" - integrity sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY= + integrity sha512-qrPaCSo9c8RHNRHIotaufGbuOBN8rtdC4QrrFFc43vyWCCz7Kl7GL1PGaXtMGQZUXrkCjNEgxDfmAuAabr/rlw== babel-plugin-syntax-object-rest-spread@^6.8.0: version "6.13.0" resolved "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5" - integrity sha1-/WU28rzhODb/o6VFjEkDpZe7O/U= + integrity sha512-C4Aq+GaAj83pRQ0EFgTvw5YO6T3Qz2KGrNRwIj9mSoNHVvdZY4KO2uA6HNtNXCw993iSZnckY1aLW8nOi8i4+w== babel-plugin-transform-object-rest-spread@^6.26.0: version "6.26.0" resolved "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06" - integrity sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY= + integrity sha512-ocgA9VJvyxwt+qJB0ncxV8kb/CjfTcECUY4tQ5VT7nP6Aohzobm8CDFaQ5FHdvZQzLmf0sgDxB8iRXZXxwZcyA== dependencies: babel-plugin-syntax-object-rest-spread "^6.8.0" babel-runtime "^6.26.0" @@ -2795,7 +2866,7 @@ babel-plugin-transform-react-remove-prop-types@^0.4.24: babel-polyfill@~6.26.0: version "6.26.0" resolved "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153" - integrity sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM= + integrity sha512-F2rZGQnAdaHWQ8YAoeRbukc7HS9QgdgeyJ0rQDd485v9opwuPvjpPFcOOT/WmkKTdgy9ESgSPXDcTNpzrGr6iQ== dependencies: babel-runtime "^6.26.0" core-js "^2.5.0" @@ -2852,7 +2923,7 @@ babel-preset-react-app@^10.0.0: babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" - integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= + integrity sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g== dependencies: core-js "^2.4.0" regenerator-runtime "^0.11.0" @@ -2888,7 +2959,7 @@ base@^0.11.1: batch@0.6.1: version "0.6.1" resolved "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" - integrity sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY= + integrity sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw== bfj@^7.0.2: version "7.0.2" @@ -2933,30 +3004,32 @@ bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9: integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== bn.js@^5.0.0, bn.js@^5.1.1: - version "5.2.0" - resolved "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002" - integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw== + version "5.2.1" + resolved "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" + integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== -body-parser@1.19.1: - version "1.19.1" - resolved "https://registry.npmjs.org/body-parser/-/body-parser-1.19.1.tgz#1499abbaa9274af3ecc9f6f10396c995943e31d4" - integrity sha512-8ljfQi5eBk8EJfECMrgqNGWPEY5jWP+1IzkzkGdFFEwFQZZyaZ21UqdaHktgiMlH0xLHqIFtE/u2OYE5dOtViA== +body-parser@1.20.0: + version "1.20.0" + resolved "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz#3de69bd89011c11573d7bfee6a64f11b6bd27cc5" + integrity sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg== dependencies: - bytes "3.1.1" + bytes "3.1.2" content-type "~1.0.4" debug "2.6.9" - depd "~1.1.2" - http-errors "1.8.1" + depd "2.0.0" + destroy "1.2.0" + http-errors "2.0.0" iconv-lite "0.4.24" - on-finished "~2.3.0" - qs "6.9.6" - raw-body "2.4.2" + on-finished "2.4.1" + qs "6.10.3" + raw-body "2.5.1" type-is "~1.6.18" + unpipe "1.0.0" bonjour@^3.5.0: version "3.5.0" resolved "https://registry.npmjs.org/bonjour/-/bonjour-3.5.0.tgz#8e890a183d8ee9a2393b3844c691a42bcf7bc9f5" - integrity sha1-jokKGD2O6aI5OzhExpGkK897yfU= + integrity sha512-RaVTblr+OnEli0r/ud8InrU7D+G0y6aJhlxaLa6Pwty4+xoxboF1BsUI45tujvRpbj9dQVoglChqonGAsjEBYg== dependencies: array-flatten "^2.1.0" deep-equal "^1.0.1" @@ -2968,7 +3041,7 @@ bonjour@^3.5.0: boolbase@^1.0.0, boolbase@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" - integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= + integrity sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww== brace-expansion@^1.1.7: version "1.1.11" @@ -2994,7 +3067,7 @@ braces@^2.3.1, braces@^2.3.2: split-string "^3.0.2" to-regex "^3.0.1" -braces@^3.0.1, braces@~3.0.2: +braces@^3.0.2, braces@~3.0.2: version "3.0.2" resolved "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== @@ -3004,7 +3077,7 @@ braces@^3.0.1, braces@~3.0.2: brorand@^1.0.1, brorand@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" - integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= + integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== browser-process-hrtime@^1.0.0: version "1.0.0" @@ -3082,16 +3155,15 @@ browserslist@4.14.2: escalade "^3.0.2" node-releases "^1.1.61" -browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.17.5, browserslist@^4.19.1, browserslist@^4.6.2, browserslist@^4.6.4: - version "4.19.1" - resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz#4ac0435b35ab655896c31d53018b6dd5e9e4c9a3" - integrity sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A== +browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.20.2, browserslist@^4.21.0, browserslist@^4.6.2, browserslist@^4.6.4: + version "4.21.1" + resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.21.1.tgz#c9b9b0a54c7607e8dc3e01a0d311727188011a00" + integrity sha512-Nq8MFCSrnJXSc88yliwlzQe3qNe3VntIjhsArW9IJOEPSHNx23FalwApUVbzAWABLhYJJ7y8AynWI/XM8OdfjQ== dependencies: - caniuse-lite "^1.0.30001286" - electron-to-chromium "^1.4.17" - escalade "^3.1.1" - node-releases "^2.0.1" - picocolors "^1.0.0" + caniuse-lite "^1.0.30001359" + electron-to-chromium "^1.4.172" + node-releases "^2.0.5" + update-browserslist-db "^1.0.4" bser@2.1.1: version "2.1.1" @@ -3113,7 +3185,7 @@ buffer-indexof@^1.0.0: buffer-xor@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" - integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= + integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ== buffer@^4.3.0: version "4.9.2" @@ -3125,24 +3197,24 @@ buffer@^4.3.0: isarray "^1.0.0" builtin-modules@^3.1.0: - version "3.2.0" - resolved "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz#45d5db99e7ee5e6bc4f362e008bf917ab5049887" - integrity sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA== + version "3.3.0" + resolved "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6" + integrity sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw== builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" - integrity sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= + integrity sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ== bytes@3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" - integrity sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg= + integrity sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw== -bytes@3.1.1: - version "3.1.1" - resolved "https://registry.npmjs.org/bytes/-/bytes-3.1.1.tgz#3f018291cb4cbad9accb6e6970bca9c8889e879a" - integrity sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg== +bytes@3.1.2: + version "3.1.2" + resolved "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" + integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== cacache@^12.0.2: version "12.0.4" @@ -3215,21 +3287,21 @@ call-bind@^1.0.0, call-bind@^1.0.2: caller-callsite@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz#847e0fce0a223750a9a027c54b33731ad3154134" - integrity sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ= + integrity sha512-JuG3qI4QOftFsZyOn1qq87fq5grLIyk1JYd5lJmdA+fG7aQ9pA/i3JIJGcO3q0MrRcHlOt1U+ZeHW8Dq9axALQ== dependencies: callsites "^2.0.0" caller-path@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz#468f83044e369ab2010fac5f06ceee15bb2cb1f4" - integrity sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ= + integrity sha512-MCL3sf6nCSXOwCTzvPKhN18TU7AHTvdtam8DAogxcrJ8Rjfbbg7Lgng64H9Iy+vUV6VGFClN/TyxBkAebLRR4A== dependencies: caller-callsite "^2.0.0" callsites@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz#06eb84f00eea413da86affefacbffb36093b3c50" - integrity sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA= + integrity sha512-ksWePWBloaWPxJYQ8TL0JHvtci6G5QTKwQ95RcWAa/lzoAKuAOflGdAK92hpHXjkwb8zLxoLNUoNYZgVsaJzvQ== callsites@^3.0.0: version "3.1.0" @@ -3257,7 +3329,7 @@ camelcase@^6.0.0, camelcase@^6.1.0, camelcase@^6.2.0: camelize@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b" - integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs= + integrity sha512-W2lPwkBkMZwFlPCXhIlYgxu+7gC/NUlCtdK652DAJ1JdgV0sTrvuPFshNPrFa1TY2JOkLhgdeEBplB4ezEa+xg== caniuse-api@^3.0.0: version "3.0.0" @@ -3269,10 +3341,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001125, caniuse-lite@^1.0.30001286: - version "1.0.30001295" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001295.tgz#68a60f8f0664f342b2835c5d8898b4faea7b3d51" - integrity sha512-lSP16vcyC0FEy0R4ECc9duSPoKoZy+YkpGkue9G4D81OfPnliopaZrU10+qtPdT8PbGXad/PNx43TIQrOmJZSQ== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001125, caniuse-lite@^1.0.30001359: + version "1.0.30001361" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001361.tgz#ba2adb2527566fb96f3ac7c67698ae7fc495a28d" + integrity sha512-ybhCrjNtkFji1/Wto6SSJKkWk6kZgVQsDq5QI83SafsF6FXv2JB4df9eEdH6g8sdGgqTXrFLjAxqBGgYoU3azQ== capture-exit@^2.0.0: version "2.0.0" @@ -3341,9 +3413,9 @@ chokidar@^2.1.8: fsevents "^1.2.7" chokidar@^3.4.1: - version "3.5.2" - resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz#dba3976fcadb016f66fd365021d91600d01c1e75" - integrity sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ== + version "3.5.3" + resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" + integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== dependencies: anymatch "~3.1.2" braces "~3.0.2" @@ -3445,7 +3517,7 @@ clone-deep@^4.0.1: co@^4.6.0: version "4.6.0" resolved "https://registry.npmjs.org/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= + integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== coa@^2.0.2: version "2.0.2" @@ -3464,7 +3536,7 @@ collect-v8-coverage@^1.0.0: collection-visit@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" - integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= + integrity sha512-lNkKvzEeMBBjUGHZ+q6z9pSJla0KWAQPvtzhEV9+iGyQYG+pBpl7xKDhxoNSOZH2hhv0v5k0y2yAM4o4SjoSkw== dependencies: map-visit "^1.0.0" object-visit "^1.0.0" @@ -3486,7 +3558,7 @@ color-convert@^2.0.1: color-name@1.1.3: version "1.1.3" resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== color-name@^1.0.0, color-name@~1.1.4: version "1.1.4" @@ -3494,9 +3566,9 @@ color-name@^1.0.0, color-name@~1.1.4: integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== color-string@^1.6.0: - version "1.9.0" - resolved "https://registry.npmjs.org/color-string/-/color-string-1.9.0.tgz#63b6ebd1bec11999d1df3a79a7569451ac2be8aa" - integrity sha512-9Mrz2AQLefkH1UvASKj6v6hj/7eWgjnT/cVsR8CumieLoT+g900exWeNogqtweI8dxloXN9BDQTYro1oWu/5CQ== + version "1.9.1" + resolved "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz#4467f9146f036f855b764dfb5bf8582bf342c7a4" + integrity sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg== dependencies: color-name "^1.0.0" simple-swizzle "^0.2.2" @@ -3536,6 +3608,11 @@ commander@^7.0.0: resolved "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== +common-path-prefix@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz#7d007a7e07c58c4b4d5f433131a19141b29f11e0" + integrity sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w== + common-tags@^1.8.0: version "1.8.2" resolved "https://registry.npmjs.org/common-tags/-/common-tags-1.8.2.tgz#94ebb3c076d26032745fd54face7f688ef5ac9c6" @@ -3544,7 +3621,7 @@ common-tags@^1.8.0: commondir@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" - integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= + integrity sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg== component-emitter@^1.2.1: version "1.3.0" @@ -3554,7 +3631,7 @@ component-emitter@^1.2.1: compose-function@3.0.3: version "3.0.3" resolved "https://registry.npmjs.org/compose-function/-/compose-function-3.0.3.tgz#9ed675f13cc54501d30950a486ff6a7ba3ab185f" - integrity sha1-ntZ18TzFRQHTCVCkhv9qe6OrGF8= + integrity sha512-xzhzTJ5eC+gmIzvZq+C3kCJHsp9os6tJkrigDRZclyGtOKINbZtE8n1Tzmeh32jW+BUDPbvZpibwvJHBLGMVwg== dependencies: arity-n "^1.0.4" @@ -3586,7 +3663,7 @@ compute-scroll-into-view@^1.0.17: concat-map@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== concat-stream@^1.5.0: version "1.6.2" @@ -3616,7 +3693,7 @@ console-browserify@^1.1.0: constants-browserify@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" - integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= + integrity sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ== content-disposition@0.5.4: version "0.5.4" @@ -3640,7 +3717,7 @@ convert-source-map@1.7.0: convert-source-map@^0.3.3: version "0.3.5" resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-0.3.5.tgz#f1d802950af7dd2631a1febe0596550c86ab3190" - integrity sha1-8dgClQr33SYxof6+BZZVDIarMZA= + integrity sha512-+4nRk0k3oEpwUB7/CalD7xE2z4VmtEnnq0GO2IPTkrooTrAhEsWvuLF5iWP1dXrwluki/azwXV1ve7gtYuPldg== convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: version "1.8.0" @@ -3652,19 +3729,19 @@ convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: cookie-signature@1.0.6: version "1.0.6" resolved "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" - integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= + integrity sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ== -cookie@0.4.1: - version "0.4.1" - resolved "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz#afd713fe26ebd21ba95ceb61f9a8116e50a537d1" - integrity sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA== +cookie@0.5.0: + version "0.5.0" + resolved "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b" + integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw== copy-anything@^2.0.1: - version "2.0.3" - resolved "https://registry.npmjs.org/copy-anything/-/copy-anything-2.0.3.tgz#842407ba02466b0df844819bbe3baebbe5d45d87" - integrity sha512-GK6QUtisv4fNS+XcI7shX0Gx9ORg7QqIznyfho79JTnX1XhLiyZHfftvGiziqzRiEi/Bjhgpi+D2o7HxJFPnDQ== + version "2.0.6" + resolved "https://registry.npmjs.org/copy-anything/-/copy-anything-2.0.6.tgz#092454ea9584a7b7ad5573062b2a87f5900fc480" + integrity sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw== dependencies: - is-what "^3.12.0" + is-what "^3.14.1" copy-concurrently@^1.0.0: version "1.0.5" @@ -3681,7 +3758,7 @@ copy-concurrently@^1.0.0: copy-descriptor@^0.1.0: version "0.1.1" resolved "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" - integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= + integrity sha512-XgZ0pFcakEUlbwQEVNg3+QAis1FyTL3Qel9FYy8pSkQqoG3PNoT0bOCQtOXcOkur21r2Eq2kI+IE+gsmAEVlYw== copy-to-clipboard@^3.2.0: version "3.3.1" @@ -3690,18 +3767,18 @@ copy-to-clipboard@^3.2.0: dependencies: toggle-selection "^1.0.6" -core-js-compat@^3.18.0, core-js-compat@^3.19.1: - version "3.20.2" - resolved "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.20.2.tgz#d1ff6936c7330959b46b2e08b122a8b14e26140b" - integrity sha512-qZEzVQ+5Qh6cROaTPFLNS4lkvQ6mBzE3R6A6EEpssj7Zr2egMHgsy4XapdifqJDGC9CBiNv7s+ejI96rLNQFdg== +core-js-compat@^3.21.0, core-js-compat@^3.22.1: + version "3.23.3" + resolved "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.23.3.tgz#7d8503185be76bb6d8d592c291a4457a8e440aa9" + integrity sha512-WSzUs2h2vvmKsacLHNTdpyOC9k43AEhcGoFlVgCY4L7aw98oSBKtPL6vD0/TqZjRWRQYdDSLkzZIni4Crbbiqw== dependencies: - browserslist "^4.19.1" + browserslist "^4.21.0" semver "7.0.0" -core-js-pure@^3.19.0: - version "3.20.2" - resolved "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.20.2.tgz#5d263565f0e34ceeeccdc4422fae3e84ca6b8c0f" - integrity sha512-CmWHvSKn2vNL6p6StNp1EmMIfVY/pqn3JLAjfZQ8WZGPOlGoO92EkX9/Mk81i6GxvoPXjUqEQnpM3rJ5QxxIOg== +core-js-pure@^3.20.2, core-js-pure@^3.8.1: + version "3.23.3" + resolved "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.23.3.tgz#bcd02d3d8ec68ad871ef50d5ccbb248ddb54f401" + integrity sha512-XpoouuqIj4P+GWtdyV8ZO3/u4KftkeDVMfvp+308eGMhCrA3lVDSmAxO0c6GGOcmgVlaKDrgWVMo49h2ab/TDA== core-js@^2.4.0, core-js@^2.5.0, core-js@^2.6.5: version "2.6.12" @@ -3709,9 +3786,9 @@ core-js@^2.4.0, core-js@^2.5.0, core-js@^2.6.5: integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== core-js@^3.6.5: - version "3.20.2" - resolved "https://registry.npmjs.org/core-js/-/core-js-3.20.2.tgz#46468d8601eafc8b266bd2dd6bf9dee622779581" - integrity sha512-nuqhq11DcOAbFBV4zCbKeGbKQsUDRqTX0oqx7AttUBuqe3h20ixsE039QHelbL6P4h+9kytVqyEtyZ6gsiwEYw== + version "3.23.3" + resolved "https://registry.npmjs.org/core-js/-/core-js-3.23.3.tgz#3b977612b15da6da0c9cc4aec487e8d24f371112" + integrity sha512-oAKwkj9xcWNBAvGbT//WiCdOMpb9XQG92/Fe3ABFM/R16BsHgePG00mFOgKf7IsCtfj8tA1kHtf/VwErhriz5Q== core-util-is@~1.0.0: version "1.0.3" @@ -3810,7 +3887,7 @@ crypto-browserify@^3.11.0: crypto-random-string@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" - integrity sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4= + integrity sha512-GsVpkFPlycH7/fRR7Dhcmnoii54gV1nz7y4CWyeFS14N+JVBBhY+r8amRHE4BwSYal7BPTDp8isvAlCxyFt3Hg== css-blank-pseudo@^0.1.4: version "0.1.4" @@ -3822,12 +3899,12 @@ css-blank-pseudo@^0.1.4: css-color-keywords@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz#fea2616dc676b2962686b3af8dbdbe180b244e05" - integrity sha1-/qJhbcZ2spYmhrOvjb2+GAskTgU= + integrity sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg== css-color-names@0.0.4, css-color-names@^0.0.4: version "0.0.4" resolved "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0" - integrity sha1-gIrcLnnPhHOAabZGyyDsJ762KeA= + integrity sha512-zj5D7X1U2h2zsXOAM8EyUREBnnts6H+Jm+d1M2DbiQQcUtnqgQsMrdo8JW9R80YFUmIdBZeMu5wvYM7hcgWP/Q== css-declaration-sorter@^4.0.1: version "4.0.1" @@ -3886,13 +3963,13 @@ css-select@^2.0.0: nth-check "^1.0.2" css-select@^4.1.3: - version "4.2.1" - resolved "https://registry.npmjs.org/css-select/-/css-select-4.2.1.tgz#9e665d6ae4c7f9d65dbe69d0316e3221fb274cdd" - integrity sha512-/aUslKhzkTNCQUB2qTX84lVmfia9NyjP3WpDGtj/WxhwBzWBYUV3DgUpurHTme8UTPcPlAD1DJ+b0nN/t50zDQ== + version "4.3.0" + resolved "https://registry.npmjs.org/css-select/-/css-select-4.3.0.tgz#db7129b2846662fd8628cfc496abb2b59e41529b" + integrity sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ== dependencies: boolbase "^1.0.0" - css-what "^5.1.0" - domhandler "^4.3.0" + css-what "^6.0.1" + domhandler "^4.3.1" domutils "^2.8.0" nth-check "^2.0.1" @@ -3926,15 +4003,15 @@ css-what@^3.2.1: resolved "https://registry.npmjs.org/css-what/-/css-what-3.4.2.tgz#ea7026fcb01777edbde52124e21f327e7ae950e4" integrity sha512-ACUm3L0/jiZTqfzRM3Hi9Q8eZqd6IK37mMWPLz9PJxkLWllYeRf+EHUSHYEtFop2Eqytaq1FizFVh7XfBnXCDQ== -css-what@^5.1.0: - version "5.1.0" - resolved "https://registry.npmjs.org/css-what/-/css-what-5.1.0.tgz#3f7b707aadf633baf62c2ceb8579b545bb40f7fe" - integrity sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw== +css-what@^6.0.1: + version "6.1.0" + resolved "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz#fb5effcf76f1ddea2c81bdfaa4de44e79bac70f4" + integrity sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw== css.escape@^1.5.1: version "1.5.1" resolved "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz#42e27d4fa04ae32f931a4b4d4191fa9cddee97cb" - integrity sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s= + integrity sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg== css@^2.0.0: version "2.2.4" @@ -4009,12 +4086,12 @@ cssnano-preset-default@^4.0.8: cssnano-util-get-arguments@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/cssnano-util-get-arguments/-/cssnano-util-get-arguments-4.0.0.tgz#ed3a08299f21d75741b20f3b81f194ed49cc150f" - integrity sha1-7ToIKZ8h11dBsg87gfGU7UnMFQ8= + integrity sha512-6RIcwmV3/cBMG8Aj5gucQRsJb4vv4I4rn6YjPbVWd5+Pn/fuG+YseGvXGk00XLkoZkaj31QOD7vMUpNPC4FIuw== cssnano-util-get-match@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/cssnano-util-get-match/-/cssnano-util-get-match-4.0.0.tgz#c0e4ca07f5386bb17ec5e52250b4f5961365156d" - integrity sha1-wOTKB/U4a7F+xeUiULT1lhNlFW0= + integrity sha512-JPMZ1TSMRUPVIqEalIBNoBtAYbi8okvcFns4O0YIhcdGebeYZK7dMyHJiQ6GqNBA9kE0Hym4Aqym5rPdsV/4Cw== cssnano-util-raw-cache@^4.0.1: version "4.0.1" @@ -4065,7 +4142,7 @@ cssstyle@^2.3.0: cyclist@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz#596e9698fd0c80e12038c2b82d6eb1b35b6224d9" - integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk= + integrity sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A== d@1, d@^1.0.1: version "1.0.1" @@ -4075,10 +4152,10 @@ d@1, d@^1.0.1: es5-ext "^0.10.50" type "^1.0.1" -damerau-levenshtein@^1.0.7: - version "1.0.7" - resolved "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.7.tgz#64368003512a1a6992593741a09a9d31a836f55d" - integrity sha512-VvdQIPGdWP0SqFXghj79Wf/5LArmreyMsGLa6FG6iC4t3j7j5s71TrwWmT/4akbDQIqjfACkLZmjXhA7g2oUZw== +damerau-levenshtein@^1.0.8: + version "1.0.8" + resolved "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz#b43d286ccbd36bc5b2f7ed41caf2d0aba1f8a6e7" + integrity sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA== data-urls@^2.0.0: version "2.0.0" @@ -4095,9 +4172,9 @@ date-fns@2.x: integrity sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw== dayjs@1.x: - version "1.10.7" - resolved "https://registry.npmjs.org/dayjs/-/dayjs-1.10.7.tgz#2cf5f91add28116748440866a0a1d26f3a6ce468" - integrity sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig== + version "1.11.3" + resolved "https://registry.npmjs.org/dayjs/-/dayjs-1.11.3.tgz#4754eb694a624057b9ad2224b67b15d552589258" + integrity sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A== debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9: version "2.6.9" @@ -4107,9 +4184,9 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9: ms "2.0.0" debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: - version "4.3.3" - resolved "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" - integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== + version "4.3.4" + resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: ms "2.1.2" @@ -4123,7 +4200,7 @@ debug@^3.1.1, debug@^3.2.6, debug@^3.2.7: decamelize@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= + integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== decimal.js@^10.2.1: version "10.3.1" @@ -4133,12 +4210,12 @@ decimal.js@^10.2.1: decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" - integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= + integrity sha512-hjf+xovcEn31w/EUYdTXQh/8smFL/dzYjohQGEIgjyNavaJfBY2p5F527Bo1VPATxv0VYTUC2bOcXvqFwk78Og== dedent@^0.7.0: version "0.7.0" resolved "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" - integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= + integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== deep-equal@^1.0.1: version "1.1.1" @@ -4170,24 +4247,25 @@ default-gateway@^4.2.0: execa "^1.0.0" ip-regex "^2.1.0" -define-properties@^1.1.2, define-properties@^1.1.3: - version "1.1.3" - resolved "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" - integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== +define-properties@^1.1.2, define-properties@^1.1.3, define-properties@^1.1.4: + version "1.1.4" + resolved "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz#0b14d7bd7fbeb2f3572c3a7eda80ea5d57fb05b1" + integrity sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA== dependencies: - object-keys "^1.0.12" + has-property-descriptors "^1.0.0" + object-keys "^1.1.1" define-property@^0.2.5: version "0.2.5" resolved "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" - integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= + integrity sha512-Rr7ADjQZenceVOAKop6ALkkRAmH1A4Gx9hV/7ZujPUN2rkATqFO0JZLZInbAjpZYoJ1gUx8MRMQVkYemcbMSTA== dependencies: is-descriptor "^0.1.0" define-property@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" - integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= + integrity sha512-cZTYKFWspt9jZsMscWo8sc/5lbPC9Q0N5nBLgb+Yd915iL3udB1uFgS3B8YCx66UVHq018DAVFoee7x+gxggeA== dependencies: is-descriptor "^1.0.0" @@ -4215,12 +4293,17 @@ del@^4.1.1: delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + +depd@2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" + integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== depd@~1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" - integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= + integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== des.js@^1.0.0: version "1.0.1" @@ -4230,10 +4313,10 @@ des.js@^1.0.0: inherits "^2.0.1" minimalistic-assert "^1.0.0" -destroy@~1.0.4: - version "1.0.4" - resolved "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80" - integrity sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA= +destroy@1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" + integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== detect-newline@^3.0.0: version "3.1.0" @@ -4258,10 +4341,10 @@ diff-sequences@^26.6.2: resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz#48ba99157de1923412eed41db6b6d4aa9ca7c0b1" integrity sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q== -diff-sequences@^27.4.0: - version "27.4.0" - resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.4.0.tgz#d783920ad8d06ec718a060d00196dfef25b132a5" - integrity sha512-YqiQzkrsmHMH5uuh8OdQFU9/ZpADnwzml8z0O5HvRNda+5UZsaX/xN+AAxfR2hWq1Y7HZnAzO9J5lJXOuDz2Ww== +diff-sequences@^28.1.1: + version "28.1.1" + resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-28.1.1.tgz#9989dc731266dc2903457a70e996f3a041913ac6" + integrity sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw== diffie-hellman@^5.0.0: version "5.0.3" @@ -4282,7 +4365,7 @@ dir-glob@^3.0.1: dns-equal@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d" - integrity sha1-s55/HabrCnW6nBcySzR1PEfgZU0= + integrity sha512-z+paD6YUQsk+AbGCEM4PrOXSss5gd66QfcVBFTKR/HpFL9jCqikS94HYwKww6fQyO7IxrIIyUu+g0Ka9tUS2Cg== dns-packet@^1.3.1: version "1.3.4" @@ -4295,7 +4378,7 @@ dns-packet@^1.3.1: dns-txt@^2.0.2: version "2.0.2" resolved "https://registry.npmjs.org/dns-txt/-/dns-txt-2.0.2.tgz#b91d806f5d27188e4ab3e7d107d881a1cc4642b6" - integrity sha1-uR2Ab10nGI5Ks+fRB9iBocxGQrY= + integrity sha512-Ix5PrWjphuSoUXV/Zv5gaFHjnaJtb02F2+Si3Ht9dyJ87+Z/lMmy+dpNHtTGraNK958ndXq2i+GLkWsWHcKaBQ== dependencies: buffer-indexof "^1.0.0" @@ -4314,14 +4397,14 @@ doctrine@^3.0.0: esutils "^2.0.2" dom-accessibility-api@^0.5.6: - version "0.5.10" - resolved "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.10.tgz#caa6d08f60388d0bb4539dd75fe458a9a1d0014c" - integrity sha512-Xu9mD0UjrJisTmv7lmVSDMagQcU9R5hwAbxsaAE/35XPnPLJobbuREfV/rraiSaEj/UOvgrzQs66zyTWTlyd+g== + version "0.5.14" + resolved "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.14.tgz#56082f71b1dc7aac69d83c4285eef39c15d93f56" + integrity sha512-NMt+m9zFMPZe0JcY9gN224Qvk6qLIdqex29clBvc/y75ZBX9YA9wNK3frsYvu2DI1xcCIwxwnX+TlsJ2DSOADg== dom-align@^1.7.0: - version "1.12.2" - resolved "https://registry.npmjs.org/dom-align/-/dom-align-1.12.2.tgz#0f8164ebd0c9c21b0c790310493cd855892acd4b" - integrity sha512-pHuazgqrsTFrGU2WLDdXxCFabkdQDx72ddkraZNih1KsMcN5qsRSTR9O4VJRlwTPCPb5COYg3LOfiMHHcPInHg== + version "1.12.3" + resolved "https://registry.npmjs.org/dom-align/-/dom-align-1.12.3.tgz#a36d02531dae0eefa2abb0c4db6595250526f103" + integrity sha512-Gj9hZN3a07cbR6zviMUBOMPdWxYhbMI+x+WS0NAIu2zFZmbK8ys9R79g+iG9qLnlCwpFoaB+fKy8Pdv470GsPA== dom-converter@^0.2.0: version "0.2.0" @@ -4339,9 +4422,9 @@ dom-serializer@0: entities "^2.0.0" dom-serializer@^1.0.1: - version "1.3.2" - resolved "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz#6206437d32ceefaec7161803230c7a20bc1b4d91" - integrity sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig== + version "1.4.1" + resolved "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz#de5d41b1aea290215dc45a6dae8adcf1d32e2d30" + integrity sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag== dependencies: domelementtype "^2.0.1" domhandler "^4.2.0" @@ -4358,9 +4441,9 @@ domelementtype@1: integrity sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w== domelementtype@^2.0.1, domelementtype@^2.2.0: - version "2.2.0" - resolved "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz#9a0b6c2782ed6a1c7323d42267183df9bd8b1d57" - integrity sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A== + version "2.3.0" + resolved "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz#5c45e8e869952626331d7aab326d01daf65d589d" + integrity sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw== domexception@^2.0.1: version "2.0.1" @@ -4369,10 +4452,10 @@ domexception@^2.0.1: dependencies: webidl-conversions "^5.0.0" -domhandler@^4.0.0, domhandler@^4.2.0, domhandler@^4.3.0: - version "4.3.0" - resolved "https://registry.npmjs.org/domhandler/-/domhandler-4.3.0.tgz#16c658c626cf966967e306f966b431f77d4a5626" - integrity sha512-fC0aXNQXqKSFTr2wDNZDhsEYjCiYsDWl3D01kwt25hm1YIPyDGHvvi3rw+PLqHAl/m71MaiF7d5zvBr0p5UB2g== +domhandler@^4.0.0, domhandler@^4.2.0, domhandler@^4.3.1: + version "4.3.1" + resolved "https://registry.npmjs.org/domhandler/-/domhandler-4.3.1.tgz#8d792033416f59d68bc03a5aa7b018c1ca89279c" + integrity sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ== dependencies: domelementtype "^2.2.0" @@ -4436,17 +4519,17 @@ duplexify@^3.4.2, duplexify@^3.6.0: ee-first@1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" - integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= + integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== ejs@^2.6.1: version "2.7.4" resolved "https://registry.npmjs.org/ejs/-/ejs-2.7.4.tgz#48661287573dcc53e366c7a1ae52c3a120eec9ba" integrity sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA== -electron-to-chromium@^1.3.564, electron-to-chromium@^1.4.17: - version "1.4.31" - resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.31.tgz#8d5ccc3f8253cd142b07afaa84f200fd33a7f2a6" - integrity sha512-t3XVQtk+Frkv6aTD4RRk0OqosU+VLe1dQFW83MDer78ZD6a52frgXuYOIsLYTQiH2Lm+JB2OKYcn7zrX+YGAiQ== +electron-to-chromium@^1.3.564, electron-to-chromium@^1.4.172: + version "1.4.172" + resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.172.tgz#87335795a3dc19e7b6dd5af291038477d81dc6b1" + integrity sha512-yDoFfTJnqBAB6hSiPvzmsBJSrjOXJtHSJoqJdI/zSIh7DYupYnIOHt/bbPw/WE31BJjNTybDdNAs21gCMnTh0Q== elliptic@^6.5.3: version "6.5.4" @@ -4484,7 +4567,7 @@ emoji-regex@^9.2.2: emojis-list@^2.0.0: version "2.1.0" resolved "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" - integrity sha1-TapNnbAPmBmIDHn6RXrlsJof04k= + integrity sha512-knHEZMgs8BB+MInokmNTg/OyPlAddghe1YBgNwJBc5zsJi/uyIcXoSDsL/W9ymOsBoBGdPIHXYJ9+qKFwRwDng== emojis-list@^3.0.0: version "3.0.0" @@ -4494,7 +4577,7 @@ emojis-list@^3.0.0: encodeurl@~1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" - integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k= + integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== end-of-stream@^1.0.0, end-of-stream@^1.1.0: version "1.4.4" @@ -4544,37 +4627,52 @@ error-ex@^1.3.1: is-arrayish "^0.2.1" error-stack-parser@^2.0.6: - version "2.0.6" - resolved "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.0.6.tgz#5a99a707bd7a4c58a797902d48d82803ede6aad8" - integrity sha512-d51brTeqC+BHlwF0BhPtcYgF5nlzf9ZZ0ZIUQNZpc9ZB9qw5IJ2diTrBY9jlCJkTLITYPjmiX6OWCwH+fuyNgQ== + version "2.1.4" + resolved "https://registry.npmjs.org/error-stack-parser/-/error-stack-parser-2.1.4.tgz#229cb01cdbfa84440bfa91876285b94680188286" + integrity sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ== dependencies: - stackframe "^1.1.1" + stackframe "^1.3.4" -es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.19.1: - version "1.19.1" - resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz#d4885796876916959de78edaa0df456627115ec3" - integrity sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w== +es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.19.1, es-abstract@^1.19.2, es-abstract@^1.19.5, es-abstract@^1.20.1: + version "1.20.1" + resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.1.tgz#027292cd6ef44bd12b1913b828116f54787d1814" + integrity sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA== dependencies: call-bind "^1.0.2" es-to-primitive "^1.2.1" function-bind "^1.1.1" + function.prototype.name "^1.1.5" get-intrinsic "^1.1.1" get-symbol-description "^1.0.0" has "^1.0.3" - has-symbols "^1.0.2" + has-property-descriptors "^1.0.0" + has-symbols "^1.0.3" internal-slot "^1.0.3" is-callable "^1.2.4" - is-negative-zero "^2.0.1" + is-negative-zero "^2.0.2" is-regex "^1.1.4" - is-shared-array-buffer "^1.0.1" + is-shared-array-buffer "^1.0.2" is-string "^1.0.7" - is-weakref "^1.0.1" - object-inspect "^1.11.0" + is-weakref "^1.0.2" + object-inspect "^1.12.0" object-keys "^1.1.1" object.assign "^4.1.2" - string.prototype.trimend "^1.0.4" - string.prototype.trimstart "^1.0.4" - unbox-primitive "^1.0.1" + regexp.prototype.flags "^1.4.3" + string.prototype.trimend "^1.0.5" + string.prototype.trimstart "^1.0.5" + unbox-primitive "^1.0.2" + +es-array-method-boxes-properly@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz#873f3e84418de4ee19c5be752990b2e44718d09e" + integrity sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA== + +es-shim-unscopables@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz#702e632193201e3edf8713635d083d378e510241" + integrity sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w== + dependencies: + has "^1.0.3" es-to-primitive@^1.2.1: version "1.2.1" @@ -4586,24 +4684,24 @@ es-to-primitive@^1.2.1: is-symbol "^1.0.2" es5-ext@^0.10.35, es5-ext@^0.10.50: - version "0.10.53" - resolved "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz#93c5a3acfdbef275220ad72644ad02ee18368de1" - integrity sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q== + version "0.10.61" + resolved "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.61.tgz#311de37949ef86b6b0dcea894d1ffedb909d3269" + integrity sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA== dependencies: - es6-iterator "~2.0.3" - es6-symbol "~3.1.3" - next-tick "~1.0.0" + es6-iterator "^2.0.3" + es6-symbol "^3.1.3" + next-tick "^1.1.0" -es6-iterator@2.0.3, es6-iterator@~2.0.3: +es6-iterator@2.0.3, es6-iterator@^2.0.3: version "2.0.3" resolved "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" - integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= + integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== dependencies: d "1" es5-ext "^0.10.35" es6-symbol "^3.1.1" -es6-symbol@^3.1.1, es6-symbol@~3.1.3: +es6-symbol@^3.1.1, es6-symbol@^3.1.3: version "3.1.3" resolved "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== @@ -4619,7 +4717,7 @@ escalade@^3.0.2, escalade@^3.1.1: escape-html@~1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= + integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== escape-string-regexp@2.0.0, escape-string-regexp@^2.0.0: version "2.0.0" @@ -4629,7 +4727,7 @@ escape-string-regexp@2.0.0, escape-string-regexp@^2.0.0: escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== escape-string-regexp@^4.0.0: version "4.0.0" @@ -4663,14 +4761,13 @@ eslint-import-resolver-node@^0.3.6: debug "^3.2.7" resolve "^1.20.0" -eslint-module-utils@^2.7.1: - version "2.7.1" - resolved "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.1.tgz#b435001c9f8dd4ab7f6d0efcae4b9696d4c24b7c" - integrity sha512-fjoetBXQZq2tSTWZ9yWVl2KuFrTZZH3V+9iD1V1RfpDgxzJR+mPd/KZmMiA8gbPqdBzpNiEHOuT7IYEWxrH0zQ== +eslint-module-utils@^2.7.3: + version "2.7.3" + resolved "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz#ad7e3a10552fdd0642e1e55292781bd6e34876ee" + integrity sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ== dependencies: debug "^3.2.7" find-up "^2.1.0" - pkg-dir "^2.0.0" eslint-plugin-flowtype@^5.2.0: version "5.10.0" @@ -4681,23 +4778,23 @@ eslint-plugin-flowtype@^5.2.0: string-natural-compare "^3.0.1" eslint-plugin-import@^2.22.1: - version "2.25.3" - resolved "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.25.3.tgz#a554b5f66e08fb4f6dc99221866e57cfff824766" - integrity sha512-RzAVbby+72IB3iOEL8clzPLzL3wpDrlwjsTBAQXgyp5SeTqqY+0bFubwuo+y/HLhNZcXV4XqTBO4LGsfyHIDXg== + version "2.26.0" + resolved "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz#f812dc47be4f2b72b478a021605a59fc6fe8b88b" + integrity sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA== dependencies: array-includes "^3.1.4" array.prototype.flat "^1.2.5" debug "^2.6.9" doctrine "^2.1.0" eslint-import-resolver-node "^0.3.6" - eslint-module-utils "^2.7.1" + eslint-module-utils "^2.7.3" has "^1.0.3" - is-core-module "^2.8.0" + is-core-module "^2.8.1" is-glob "^4.0.3" - minimatch "^3.0.4" + minimatch "^3.1.2" object.values "^1.1.5" - resolve "^1.20.0" - tsconfig-paths "^3.11.0" + resolve "^1.22.0" + tsconfig-paths "^3.14.1" eslint-plugin-jest@^24.1.0: version "24.7.0" @@ -4707,47 +4804,48 @@ eslint-plugin-jest@^24.1.0: "@typescript-eslint/experimental-utils" "^4.0.1" eslint-plugin-jsx-a11y@^6.3.1: - version "6.5.1" - resolved "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.5.1.tgz#cdbf2df901040ca140b6ec14715c988889c2a6d8" - integrity sha512-sVCFKX9fllURnXT2JwLN5Qgo24Ug5NF6dxhkmxsMEUZhXRcGg+X3e1JbJ84YePQKBl5E0ZjAH5Q4rkdcGY99+g== + version "6.6.0" + resolved "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.6.0.tgz#2c5ac12e013eb98337b9aa261c3b355275cc6415" + integrity sha512-kTeLuIzpNhXL2CwLlc8AHI0aFRwWHcg483yepO9VQiHzM9bZwJdzTkzBszbuPrbgGmq2rlX/FaT2fJQsjUSHsw== dependencies: - "@babel/runtime" "^7.16.3" + "@babel/runtime" "^7.18.3" aria-query "^4.2.2" - array-includes "^3.1.4" + array-includes "^3.1.5" ast-types-flow "^0.0.7" - axe-core "^4.3.5" + axe-core "^4.4.2" axobject-query "^2.2.0" - damerau-levenshtein "^1.0.7" + damerau-levenshtein "^1.0.8" emoji-regex "^9.2.2" has "^1.0.3" - jsx-ast-utils "^3.2.1" + jsx-ast-utils "^3.3.1" language-tags "^1.0.5" - minimatch "^3.0.4" + minimatch "^3.1.2" + semver "^6.3.0" eslint-plugin-react-hooks@^4.2.0: - version "4.3.0" - resolved "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.3.0.tgz#318dbf312e06fab1c835a4abef00121751ac1172" - integrity sha512-XslZy0LnMn+84NEG9jSGR6eGqaZB3133L8xewQo3fQagbQuGt7a63gf+P1NGKZavEYEC3UXaWEAA/AqDkuN6xA== + version "4.6.0" + resolved "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3" + integrity sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g== eslint-plugin-react@^7.21.5: - version "7.28.0" - resolved "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.28.0.tgz#8f3ff450677571a659ce76efc6d80b6a525adbdf" - integrity sha512-IOlFIRHzWfEQQKcAD4iyYDndHwTQiCMcJVJjxempf203jnNLUnW34AXLrV33+nEXoifJE2ZEGmcjKPL8957eSw== + version "7.30.1" + resolved "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.30.1.tgz#2be4ab23ce09b5949c6631413ba64b2810fd3e22" + integrity sha512-NbEvI9jtqO46yJA3wcRF9Mo0lF9T/jhdHqhCHXiXtD+Zcb98812wvokjWpU7Q4QH5edo6dmqrukxVvWWXHlsUg== dependencies: - array-includes "^3.1.4" - array.prototype.flatmap "^1.2.5" + array-includes "^3.1.5" + array.prototype.flatmap "^1.3.0" doctrine "^2.1.0" estraverse "^5.3.0" jsx-ast-utils "^2.4.1 || ^3.0.0" - minimatch "^3.0.4" + minimatch "^3.1.2" object.entries "^1.1.5" object.fromentries "^2.0.5" - object.hasown "^1.1.0" + object.hasown "^1.1.1" object.values "^1.1.5" - prop-types "^15.7.2" + prop-types "^15.8.1" resolve "^2.0.0-next.3" semver "^6.3.0" - string.prototype.matchall "^4.0.6" + string.prototype.matchall "^4.0.7" eslint-plugin-testing-library@^3.9.2: version "3.10.2" @@ -4797,14 +4895,14 @@ eslint-visitor-keys@^2.0.0: integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== eslint-webpack-plugin@^2.1.0: - version "2.6.0" - resolved "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-2.6.0.tgz#3bd4ada4e539cb1f6687d2f619073dbb509361cd" - integrity sha512-V+LPY/T3kur5QO3u+1s34VDTcRxjXWPUGM4hlmTb5DwVD0OQz631yGTxJZf4SpAqAjdbBVe978S8BJeHpAdOhQ== + version "2.7.0" + resolved "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-2.7.0.tgz#0525793a4f8c652c1c6d863995ce1e0f2dcbd143" + integrity sha512-bNaVVUvU4srexGhVcayn/F4pJAz19CWBkKoMx7aSQ4wtTbZQCnG5O9LHCE42mM+JSKOUp7n6vd5CIwzj7lOVGA== dependencies: - "@types/eslint" "^7.28.2" + "@types/eslint" "^7.29.0" arrify "^2.0.1" - jest-worker "^27.3.1" - micromatch "^4.0.4" + jest-worker "^27.5.1" + micromatch "^4.0.5" normalize-path "^3.0.0" schema-utils "^3.1.1" @@ -4910,7 +5008,7 @@ esutils@^2.0.2: etag@~1.8.1: version "1.8.1" resolved "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" - integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= + integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== eventemitter3@^4.0.0: version "4.0.7" @@ -4922,12 +5020,10 @@ events@^3.0.0: resolved "https://registry.npmjs.org/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== -eventsource@^1.0.7: - version "1.1.0" - resolved "https://registry.npmjs.org/eventsource/-/eventsource-1.1.0.tgz#00e8ca7c92109e94b0ddf32dac677d841028cfaf" - integrity sha512-VSJjT5oCNrFvCS6igjzPAt5hBzQ2qPBFIbJ03zLI9SE0mxwZpMw6BfJrbFHm1a141AavMEB8JHmBhWAd66PfCg== - dependencies: - original "^1.0.0" +eventsource@^2.0.2: + version "2.0.2" + resolved "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz#76dfcc02930fb2ff339520b6d290da573a9e8508" + integrity sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA== evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: version "1.0.3" @@ -4988,17 +5084,17 @@ execa@^5.0.0: exenv@^1.2.2: version "1.2.2" resolved "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz#2ae78e85d9894158670b03d47bec1f03bd91bb9d" - integrity sha1-KueOhdmJQVhnCwPUe+wfA72Ru50= + integrity sha512-Z+ktTxTwv9ILfgKCk32OX3n/doe+OcLTRtqK9pcL+JsP3J1/VW8Uvl4ZjLlKqeW4rzK4oesDOGMEMRIZqtP4Iw== exit@^0.1.2: version "0.1.2" resolved "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" - integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= + integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== expand-brackets@^2.1.4: version "2.1.4" resolved "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" - integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= + integrity sha512-w/ozOKR9Obk3qoWeY/WDi6MFta9AoMR+zud60mdnbniMcBxRuFJyDt2LdX/14A1UABeqk+Uk+LDfUpvoGKppZA== dependencies: debug "^2.3.3" define-property "^0.2.5" @@ -5021,37 +5117,38 @@ expect@^26.6.0, expect@^26.6.2: jest-regex-util "^26.0.0" express@^4.17.1: - version "4.17.2" - resolved "https://registry.npmjs.org/express/-/express-4.17.2.tgz#c18369f265297319beed4e5558753cc8c1364cb3" - integrity sha512-oxlxJxcQlYwqPWKVJJtvQiwHgosH/LrLSPA+H4UxpyvSS6jC5aH+5MoHFM+KABgTOt0APue4w66Ha8jCUo9QGg== + version "4.18.1" + resolved "https://registry.npmjs.org/express/-/express-4.18.1.tgz#7797de8b9c72c857b9cd0e14a5eea80666267caf" + integrity sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q== dependencies: - accepts "~1.3.7" + accepts "~1.3.8" array-flatten "1.1.1" - body-parser "1.19.1" + body-parser "1.20.0" content-disposition "0.5.4" content-type "~1.0.4" - cookie "0.4.1" + cookie "0.5.0" cookie-signature "1.0.6" debug "2.6.9" - depd "~1.1.2" + depd "2.0.0" encodeurl "~1.0.2" escape-html "~1.0.3" etag "~1.8.1" - finalhandler "~1.1.2" + finalhandler "1.2.0" fresh "0.5.2" + http-errors "2.0.0" merge-descriptors "1.0.1" methods "~1.1.2" - on-finished "~2.3.0" + on-finished "2.4.1" parseurl "~1.3.3" path-to-regexp "0.1.7" proxy-addr "~2.0.7" - qs "6.9.6" + qs "6.10.3" range-parser "~1.2.1" safe-buffer "5.2.1" - send "0.17.2" - serve-static "1.14.2" + send "0.18.0" + serve-static "1.15.0" setprototypeof "1.2.0" - statuses "~1.5.0" + statuses "2.0.1" type-is "~1.6.18" utils-merge "1.0.1" vary "~1.1.2" @@ -5066,14 +5163,14 @@ ext@^1.1.2: extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" - integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= + integrity sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug== dependencies: is-extendable "^0.1.0" extend-shallow@^3.0.0, extend-shallow@^3.0.2: version "3.0.2" resolved "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" - integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= + integrity sha512-BwY5b5Ql4+qZoefgMj2NUmx+tehVTH/Kf4k1ZEtOHNFcm2wSxMRo992l6X3TIgni2eZVTZ85xMOjF31fwZAj6Q== dependencies: assign-symbols "^1.0.0" is-extendable "^1.0.1" @@ -5097,10 +5194,10 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-glob@^3.1.1: - version "3.2.7" - resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" - integrity sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q== +fast-glob@^3.1.1, fast-glob@^3.2.9: + version "3.2.11" + resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9" + integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew== dependencies: "@nodelib/fs.stat" "^2.0.2" "@nodelib/fs.walk" "^1.2.3" @@ -5116,7 +5213,7 @@ fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" - integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= + integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== fastest-levenshtein@^1.0.12: version "1.0.12" @@ -5130,7 +5227,7 @@ fastq@^1.6.0: dependencies: reusify "^1.0.4" -faye-websocket@^0.11.3: +faye-websocket@^0.11.3, faye-websocket@^0.11.4: version "0.11.4" resolved "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz#7f0d9275cfdd86a1c963dc8b65fcc451edcbb1da" integrity sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g== @@ -5177,7 +5274,7 @@ filesize@6.1.0: fill-range@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" - integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= + integrity sha512-VcpLTWqWDiTerugjj8e3+esbg+skS3M9e54UuR3iCeIDMXCLTsAH8hTSzDQU/X6/6t3eYkOKoZSef2PlU6U1XQ== dependencies: extend-shallow "^2.0.1" is-number "^3.0.0" @@ -5191,17 +5288,17 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -finalhandler@~1.1.2: - version "1.1.2" - resolved "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d" - integrity sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA== +finalhandler@1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz#7d23fe5731b207b4640e4fcd00aec1f9207a7b32" + integrity sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg== dependencies: debug "2.6.9" encodeurl "~1.0.2" escape-html "~1.0.3" - on-finished "~2.3.0" + on-finished "2.4.1" parseurl "~1.3.3" - statuses "~1.5.0" + statuses "2.0.1" unpipe "~1.0.0" find-cache-dir@^2.1.0: @@ -5233,7 +5330,7 @@ find-up@4.1.0, find-up@^4.0.0, find-up@^4.1.0: find-up@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" - integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= + integrity sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ== dependencies: locate-path "^2.0.0" @@ -5244,6 +5341,14 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + flat-cache@^3.0.4: version "3.0.4" resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" @@ -5253,9 +5358,9 @@ flat-cache@^3.0.4: rimraf "^3.0.2" flatted@^3.1.0: - version "3.2.4" - resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.4.tgz#28d9969ea90661b5134259f312ab6aa7929ac5e2" - integrity sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw== + version "3.2.6" + resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.6.tgz#022e9218c637f9f3fc9c35ab9c9193f05add60b2" + integrity sha512-0sQoMh9s0BYsm+12Huy/rkKxVu4R1+r96YX5cG44rHV0pQ6iC3Q+mkoMFaGWObMFYQxCVT+ssG1ksneA2MI9KQ== flatten@^1.0.2: version "1.0.3" @@ -5271,14 +5376,14 @@ flush-write-stream@^1.0.0: readable-stream "^2.3.6" follow-redirects@^1.0.0: - version "1.14.6" - resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz#8cfb281bbc035b3c067d6cd975b0f6ade6e855cd" - integrity sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A== + version "1.15.1" + resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz#0ca6a452306c9b276e4d3127483e29575e207ad5" + integrity sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA== for-in@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" - integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= + integrity sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ== fork-ts-checker-webpack-plugin@4.1.6: version "4.1.6" @@ -5310,19 +5415,19 @@ forwarded@0.2.0: fragment-cache@^0.2.1: version "0.2.1" resolved "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" - integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= + integrity sha512-GMBAbW9antB8iZRHLoGw0b3HANt57diZYFO/HL1JGIC1MjKrdmhxvrJbupnVvpys0zsz7yBApXdQyfepKly2kA== dependencies: map-cache "^0.2.2" fresh@0.5.2: version "0.5.2" resolved "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7" - integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac= + integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== from2@^2.1.0: version "2.3.0" resolved "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz#8bfb5502bde4a4d36cfdeea007fcca21d7e382af" - integrity sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8= + integrity sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g== dependencies: inherits "^2.0.1" readable-stream "^2.0.0" @@ -5365,7 +5470,7 @@ fs-minipass@^2.0.0: fs-write-stream-atomic@^1.0.8: version "1.0.10" resolved "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" - integrity sha1-tH31NJPvkR33VzHnCp3tAYnbQMk= + integrity sha512-gehEzmPn2nAwr39eay+x3X34Ra+M2QlVUTLhkXPjWdeO8RF9kszk116avgBJM3ZyNHgHXBNx+VmPaFC36k0PzA== dependencies: graceful-fs "^4.1.2" iferr "^0.1.5" @@ -5375,7 +5480,7 @@ fs-write-stream-atomic@^1.0.8: fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== fsevents@^1.2.7: version "1.2.13" @@ -5395,10 +5500,25 @@ function-bind@^1.1.1: resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function.prototype.name@^1.1.5: + version "1.1.5" + resolved "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz#cce0505fe1ffb80503e6f9e46cc64e46a12a9621" + integrity sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.0" + functions-have-names "^1.2.2" + functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" - integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= + integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g== + +functions-have-names@^1.2.2: + version "1.2.3" + resolved "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" + integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== gensync@^1.0.0-beta.1, gensync@^1.0.0-beta.2: version "1.0.0-beta.2" @@ -5411,13 +5531,13 @@ get-caller-file@^2.0.1: integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: - version "1.1.1" - resolved "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" - integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== + version "1.1.2" + resolved "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz#336975123e05ad0b7ba41f152ee4aadbea6cf598" + integrity sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA== dependencies: function-bind "^1.1.1" has "^1.0.3" - has-symbols "^1.0.1" + has-symbols "^1.0.3" get-own-enumerable-property-symbols@^3.0.0: version "3.0.2" @@ -5459,12 +5579,12 @@ get-symbol-description@^1.0.0: get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" - integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= + integrity sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA== glob-parent@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae" - integrity sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4= + integrity sha512-E8Ak/2+dZY6fnzlR7+ueWvhsH1SjHr4jjss4YS/h4py44jY9MhK/VFdaZJAWDz6BbL21KeteKxFSFpq8OS5gVA== dependencies: is-glob "^3.1.0" path-dirname "^1.0.0" @@ -5477,14 +5597,14 @@ glob-parent@^5.1.2, glob-parent@~5.1.2: is-glob "^4.0.1" glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: - version "7.2.0" - resolved "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" - integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== + version "7.2.3" + resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" - minimatch "^3.0.4" + minimatch "^3.1.1" once "^1.3.0" path-is-absolute "^1.0.0" @@ -5510,9 +5630,9 @@ globals@^11.1.0: integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== globals@^13.6.0, globals@^13.9.0: - version "13.12.0" - resolved "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz#4d733760304230a0082ed96e21e5c565f898089e" - integrity sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg== + version "13.15.0" + resolved "https://registry.npmjs.org/globals/-/globals-13.15.0.tgz#38113218c907d2f7e98658af246cef8b77e90bac" + integrity sha512-bpzcOlgDhMG070Av0Vy5Owklpv1I6+j96GhUI7Rh7IzDCKLzboflLrrfqMu8NquDbiR4EOQk7XzJwqVJxicxog== dependencies: type-fest "^0.20.2" @@ -5529,21 +5649,21 @@ globby@11.0.1: slash "^3.0.0" globby@^11.0.3: - version "11.0.4" - resolved "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5" - integrity sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg== + version "11.1.0" + resolved "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== dependencies: array-union "^2.1.0" dir-glob "^3.0.1" - fast-glob "^3.1.1" - ignore "^5.1.4" - merge2 "^1.3.0" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" slash "^3.0.0" globby@^6.1.0: version "6.1.0" resolved "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" - integrity sha1-9abXDoOV4hyFj7BInWTfAkJNUGw= + integrity sha512-KVbFv2TQtbzCoxAnfD6JcHZTYCzyliEaaeM/gH8qQdkKr5s0OP9scEgvdcngyk7AVdY6YVW/TJHd+lQ/Df3Daw== dependencies: array-union "^1.0.1" glob "^7.0.3" @@ -5552,14 +5672,14 @@ globby@^6.1.0: pinkie-promise "^2.0.0" graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4: - version "4.2.8" - resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a" - integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg== + version "4.2.10" + resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" + integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== growly@^1.3.0: version "1.3.0" resolved "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" - integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= + integrity sha512-+xGQY0YyAWCnqy7Cd++hc2JqMYzlm0dG30Jd0beaA64sROr8C4nt8Yc9V5Ro3avlSUDTN0ulqP/VBKi1/lLygw== gzip-size@5.1.1: version "5.1.1" @@ -5579,25 +5699,32 @@ harmony-reflect@^1.4.6: resolved "https://registry.npmjs.org/harmony-reflect/-/harmony-reflect-1.6.2.tgz#31ecbd32e648a34d030d86adb67d4d47547fe710" integrity sha512-HIp/n38R9kQjDEziXyDTuW3vvoxxyxjxFzXLrBr18uB47GnSt+G9D29fqrpM5ZkspMcPICud3XsBJQ4Y2URg8g== -has-bigints@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113" - integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== +has-bigints@^1.0.1, has-bigints@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" + integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== has-flag@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= + integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== has-flag@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -has-symbols@^1.0.1, has-symbols@^1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" - integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== +has-property-descriptors@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz#610708600606d36961ed04c196193b6a607fa861" + integrity sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ== + dependencies: + get-intrinsic "^1.1.1" + +has-symbols@^1.0.1, has-symbols@^1.0.2, has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== has-tostringtag@^1.0.0: version "1.0.0" @@ -5609,7 +5736,7 @@ has-tostringtag@^1.0.0: has-value@^0.3.1: version "0.3.1" resolved "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" - integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= + integrity sha512-gpG936j8/MzaeID5Yif+577c17TxaDmhuyVgSwtnL/q8UUTySg8Mecb+8Cf1otgLoD7DDH75axp86ER7LFsf3Q== dependencies: get-value "^2.0.3" has-values "^0.1.4" @@ -5618,7 +5745,7 @@ has-value@^0.3.1: has-value@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" - integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= + integrity sha512-IBXk4GTsLYdQ7Rvt+GRBrFSVEkmuOUy4re0Xjd9kJSUQpnTrWR4/y9RpfexN9vkAPMFuQoeWKwqzPozRTlasGw== dependencies: get-value "^2.0.6" has-values "^1.0.0" @@ -5627,12 +5754,12 @@ has-value@^1.0.0: has-values@^0.1.4: version "0.1.4" resolved "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" - integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= + integrity sha512-J8S0cEdWuQbqD9//tlZxiMuMNmxB8PlEwvYwuxsTmR1G5RXUePEX/SJn7aD0GMLieuZYSwNH0cQuJGwnYunXRQ== has-values@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" - integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= + integrity sha512-ODYZC64uqzmtfGMEAX/FvZiRyWLpAC3vYnNunURUnkGVTS+mI0smVsWaPydRBsE3g+ok7h960jChO8mFcWlHaQ== dependencies: is-number "^3.0.0" kind-of "^4.0.0" @@ -5686,7 +5813,7 @@ history@^4.9.0: hmac-drbg@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" - integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= + integrity sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg== dependencies: hash.js "^1.0.3" minimalistic-assert "^1.0.0" @@ -5712,7 +5839,7 @@ hosted-git-info@^2.1.4: hpack.js@^2.1.6: version "2.1.6" resolved "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz#87774c0949e513f42e84575b3c45681fade2a0b2" - integrity sha1-h3dMCUnlE/QuhFdbPEVoH63ioLI= + integrity sha512-zJxVehUdMGIKsRaNt7apO2Gqp0BdqW5yaiGHXXmbpvxgBYVZnAql+BJb4RO5ad2MgpbZKn5G6nMnegrH1FcNYQ== dependencies: inherits "^2.0.1" obuf "^1.0.0" @@ -5722,12 +5849,12 @@ hpack.js@^2.1.6: hsl-regex@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/hsl-regex/-/hsl-regex-1.0.0.tgz#d49330c789ed819e276a4c0d272dffa30b18fe6e" - integrity sha1-1JMwx4ntgZ4nakwNJy3/owsY/m4= + integrity sha512-M5ezZw4LzXbBKMruP+BNANf0k+19hDQMgpzBIYnya//Al+fjNct9Wf3b1WedLqdEs2hKBvxq/jh+DsHJLj0F9A== hsla-regex@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/hsla-regex/-/hsla-regex-1.0.0.tgz#c1ce7a3168c8c6614033a4b5f7877f3b225f9c38" - integrity sha1-wc56MWjIxmFAM6S194d/OyJfnDg= + integrity sha512-7Wn5GMLuHBjZCb2bTmnDOycho0p/7UVaAeqXZGbHrBCl6Yd/xDhQJAXe6Ga9AXJH2I5zY1dEdYw2u1UptnSBJA== html-encoding-sniffer@^2.0.1: version "2.0.1" @@ -5736,11 +5863,16 @@ html-encoding-sniffer@^2.0.1: dependencies: whatwg-encoding "^1.0.5" -html-entities@^1.2.1, html-entities@^1.3.1: +html-entities@^1.3.1: version "1.4.0" resolved "https://registry.npmjs.org/html-entities/-/html-entities-1.4.0.tgz#cfbd1b01d2afaf9adca1b10ae7dffab98c71d2dc" integrity sha512-8nxjcBcd8wovbeKx7h3wTji4e6+rhaVuPNpMqwWgnHh+N9ToqsCs6XztWRBPQ+UtzsoMAdKZtUENoVzU/EMtZA== +html-entities@^2.1.0: + version "2.3.3" + resolved "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz#117d7626bece327fc8baace8868fa6f5ef856e46" + integrity sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA== + html-escaper@^2.0.0: version "2.0.2" resolved "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" @@ -5787,23 +5919,23 @@ htmlparser2@^6.1.0: http-deceiver@^1.2.7: version "1.2.7" resolved "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz#fa7168944ab9a519d337cb0bec7284dc3e723d87" - integrity sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc= + integrity sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw== -http-errors@1.8.1: - version "1.8.1" - resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz#7c3f28577cbc8a207388455dbd62295ed07bd68c" - integrity sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g== +http-errors@2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" + integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== dependencies: - depd "~1.1.2" + depd "2.0.0" inherits "2.0.4" setprototypeof "1.2.0" - statuses ">= 1.5.0 < 2" + statuses "2.0.1" toidentifier "1.0.1" http-errors@~1.6.2: version "1.6.3" resolved "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" - integrity sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0= + integrity sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A== dependencies: depd "~1.1.2" inherits "2.0.3" @@ -5811,9 +5943,9 @@ http-errors@~1.6.2: statuses ">= 1.4.0 < 2" http-parser-js@>=0.5.1: - version "0.5.5" - resolved "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.5.tgz#d7c30d5d3c90d865b4a2e870181f9d6f22ac7ac5" - integrity sha512-x+JVEkO2PoM8qqpbPbOL3cqHPwerep7OwzK7Ay+sMQjKzaKCqWvjoXm5tqMP9tXWWTnTzAjIhXg+J99XYuPhPA== + version "0.5.8" + resolved "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.8.tgz#af23090d9ac4e24573de6f6aecc9d84a48bf20e3" + integrity sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q== http-proxy-agent@^4.0.1: version "4.0.1" @@ -5846,12 +5978,12 @@ http-proxy@^1.17.0: https-browserify@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" - integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= + integrity sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg== https-proxy-agent@^5.0.0: - version "5.0.0" - resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2" - integrity sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA== + version "5.0.1" + resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" + integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== dependencies: agent-base "6" debug "4" @@ -5866,13 +5998,20 @@ human-signals@^2.1.0: resolved "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== -iconv-lite@0.4.24, iconv-lite@^0.4.4: +iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== dependencies: safer-buffer ">= 2.1.2 < 3" +iconv-lite@^0.6.3: + version "0.6.3" + resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== + dependencies: + safer-buffer ">= 2.1.2 < 3.0.0" + icss-utils@^4.0.0, icss-utils@^4.1.1: version "4.1.1" resolved "https://registry.npmjs.org/icss-utils/-/icss-utils-4.1.1.tgz#21170b53789ee27447c2f47dd683081403f9a467" @@ -5883,7 +6022,7 @@ icss-utils@^4.0.0, icss-utils@^4.1.1: identity-obj-proxy@3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz#94d2bda96084453ef36fbc5aaec37e0f79f1fc14" - integrity sha1-lNK9qWCERT7zb7xarsN+D3nx/BQ= + integrity sha512-00n6YnVHKrinT9t0d9+5yZC6UBNJANpYEQvL2LlX6Ab9lnmxzIRcEmTPuyGScvl1+jKuCICX1Z0Ab1pPKKdikA== dependencies: harmony-reflect "^1.4.6" @@ -5895,14 +6034,14 @@ ieee754@^1.1.4: iferr@^0.1.5: version "0.1.5" resolved "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" - integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE= + integrity sha512-DUNFN5j7Tln0D+TxzloUjKB+CtVu6myn0JEFak6dG18mNt9YkQ6lzGCdafwofISZ1lLF3xRHJ98VKy9ynkcFaA== ignore@^4.0.6: version "4.0.6" resolved "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== -ignore@^5.1.4, ignore@^5.1.8: +ignore@^5.1.4, ignore@^5.1.8, ignore@^5.2.0: version "5.2.0" resolved "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== @@ -5910,7 +6049,7 @@ ignore@^5.1.4, ignore@^5.1.8: image-size@~0.5.0: version "0.5.5" resolved "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c" - integrity sha1-Cd/Uq50g4p6xw+gLiZA3jfnjy5w= + integrity sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ== immer@8.0.1: version "8.0.1" @@ -5920,14 +6059,14 @@ immer@8.0.1: import-cwd@^2.0.0: version "2.1.0" resolved "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz#aa6cf36e722761285cb371ec6519f53e2435b0a9" - integrity sha1-qmzzbnInYShcs3HsZRn1PiQ1sKk= + integrity sha512-Ew5AZzJQFqrOV5BTW3EIoHAnoie1LojZLXKcCQ/yTRyVZosBhK1x1ViYjHGf5pAFOq8ZyChZp6m/fSN7pJyZtg== dependencies: import-from "^2.1.0" import-fresh@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" - integrity sha1-2BNVwVYS04bGH53dOSLUMEgipUY= + integrity sha512-eZ5H8rcgYazHbKC3PG4ClHNykCSxtAhxSSEM+2mb+7evD2CKF5V7c0dNum7AdpDh0ZdICwZY9sRSn8f+KH96sg== dependencies: caller-path "^2.0.0" resolve-from "^3.0.0" @@ -5943,7 +6082,7 @@ import-fresh@^3.0.0, import-fresh@^3.2.1: import-from@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/import-from/-/import-from-2.1.0.tgz#335db7f2a7affd53aaa471d4b8021dee36b7f3b1" - integrity sha1-M1238qev/VOqpHHUuAId7ja387E= + integrity sha512-0vdnLL2wSGnhlRmzHJAg5JHjt1l2vYhzJ7tNLGbeVg0fse56tpGaH0uzH+r9Slej+BSXXEHvBKDEnVSLLE9/+w== dependencies: resolve-from "^3.0.0" @@ -5956,9 +6095,9 @@ import-local@^2.0.0: resolve-cwd "^2.0.0" import-local@^3.0.2: - version "3.0.3" - resolved "https://registry.npmjs.org/import-local/-/import-local-3.0.3.tgz#4d51c2c495ca9393da259ec66b62e022920211e0" - integrity sha512-bE9iaUY3CXH8Cwfan/abDKAxe1KGT9kyGsBPqf6DMK/z0a2OzAsrukeYNgIH6cH5Xr452jb1TUL8rSfCLjZ9uA== + version "3.1.0" + resolved "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" + integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== dependencies: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" @@ -5966,7 +6105,7 @@ import-local@^3.0.2: imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= + integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== indent-string@^4.0.0: version "4.0.0" @@ -5976,7 +6115,7 @@ indent-string@^4.0.0: indexes-of@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" - integrity sha1-8w9xbI4r00bHtn0985FVZqfAVgc= + integrity sha512-bup+4tap3Hympa+JBJUG7XuOsdNQ6fxt0MHyXMKuLBKn0OqsTfvUxkUrroEX1+B2VsSHvCjiIcZVxRtYa4nllA== infer-owner@^1.0.3, infer-owner@^1.0.4: version "1.0.4" @@ -5986,7 +6125,7 @@ infer-owner@^1.0.3, infer-owner@^1.0.4: inflight@^1.0.4: version "1.0.6" resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== dependencies: once "^1.3.0" wrappy "1" @@ -5999,12 +6138,12 @@ inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, i inherits@2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" - integrity sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE= + integrity sha512-8nWq2nLTAwd02jTqJExUYFSD/fKq6VH9Y/oG2accc/kdI0V98Bag8d5a4gi3XHz73rDWa2PvTtvcWYquKqSENA== inherits@2.0.3: version "2.0.3" resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= + integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw== ini@^1.3.5: version "1.3.8" @@ -6036,12 +6175,12 @@ interpret@^2.2.0: ip-regex@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" - integrity sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk= + integrity sha512-58yWmlHpp7VYfcdTwMTvwMmqx/Elfxjd9RXTDyMsbL7lLWmhMylLEqiYVLKuLzOZqVgiWXD9MfR62Vv89VRxkw== ip@^1.1.0, ip@^1.1.5: - version "1.1.5" - resolved "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" - integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo= + version "1.1.8" + resolved "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz#ae05948f6b075435ed3307acce04629da8cdbf48" + integrity sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg== ipaddr.js@1.9.1, ipaddr.js@^1.9.0: version "1.9.1" @@ -6051,7 +6190,7 @@ ipaddr.js@1.9.1, ipaddr.js@^1.9.0: is-absolute-url@^2.0.0: version "2.1.0" resolved "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz#50530dfb84fcc9aa7dbe7852e83a37b93b9f2aa6" - integrity sha1-UFMN+4T8yap9vnhS6Do3uTufKqY= + integrity sha512-vOx7VprsKyllwjSkLV79NIhpyLfr3jAp7VaTCMXOJHu4m0Ew1CZ2fcjASwmV1jI3BWuWHB013M48eyeldk9gYg== is-absolute-url@^3.0.3: version "3.0.3" @@ -6061,7 +6200,7 @@ is-absolute-url@^3.0.3: is-accessor-descriptor@^0.1.6: version "0.1.6" resolved "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" - integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= + integrity sha512-e1BM1qnDbMRG3ll2U9dSK0UMHuWOs3pY3AtcFsmvwPtKL3MML/Q86i+GilLfvqEs4GW+ExB91tQ3Ig9noDIZ+A== dependencies: kind-of "^3.0.2" @@ -6083,7 +6222,7 @@ is-arguments@^1.0.4: is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= + integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== is-arrayish@^0.3.1: version "0.3.2" @@ -6100,7 +6239,7 @@ is-bigint@^1.0.1: is-binary-path@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" - integrity sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg= + integrity sha512-9fRVlXc0uCxEDj1nQzaWONSpbTfx0FmJfzHF7pwlI8DkWGoHBBea4Pg5Ky0ojwwxQmnSifgbKkI06Qv0Ljgj+Q== dependencies: binary-extensions "^1.0.0" @@ -6139,7 +6278,7 @@ is-ci@^2.0.0: is-color-stop@^1.0.0: version "1.1.0" resolved "https://registry.npmjs.org/is-color-stop/-/is-color-stop-1.1.0.tgz#cfff471aee4dd5c9e158598fbe12967b5cdad345" - integrity sha1-z/9HGu5N1cnhWFmPvhKWe1za00U= + integrity sha512-H1U8Vz0cfXNujrJzEcvvwMDW9Ra+biSYA3ThdQvAnMLJkEHQXn6bWzLkxHtVYJ+Sdbx0b6finn3jZiaVe7MAHA== dependencies: css-color-names "^0.0.4" hex-color-regex "^1.1.0" @@ -6148,17 +6287,17 @@ is-color-stop@^1.0.0: rgb-regex "^1.0.1" rgba-regex "^1.0.0" -is-core-module@^2.0.0, is-core-module@^2.2.0, is-core-module@^2.8.0: - version "2.8.0" - resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz#0321336c3d0925e497fd97f5d95cb114a5ccd548" - integrity sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw== +is-core-module@^2.0.0, is-core-module@^2.8.1, is-core-module@^2.9.0: + version "2.9.0" + resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz#e1c34429cd51c6dd9e09e0799e396e27b19a9c69" + integrity sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A== dependencies: has "^1.0.3" is-data-descriptor@^0.1.4: version "0.1.4" resolved "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" - integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= + integrity sha512-+w9D5ulSoBNlmw9OHn3U2v51SyoCd0he+bB3xMl62oijhrspxowjU+AIcDY0N3iEJbUEkB15IlMASQsxYigvXg== dependencies: kind-of "^3.0.2" @@ -6197,7 +6336,7 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2: is-directory@^0.3.1: version "0.3.1" resolved "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" - integrity sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE= + integrity sha512-yVChGzahRFvbkscn2MlwGismPO12i9+znNruC5gVEntG3qu0xQMzsGg/JFbrsqDOHtHFPci+V5aP5T9I+yeKqw== is-docker@^2.0.0: version "2.2.1" @@ -6207,7 +6346,7 @@ is-docker@^2.0.0: is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" - integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= + integrity sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw== is-extendable@^1.0.1: version "1.0.1" @@ -6219,12 +6358,12 @@ is-extendable@^1.0.1: is-extglob@^2.1.0, is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + integrity sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w== is-fullwidth-code-point@^3.0.0: version "3.0.0" @@ -6239,7 +6378,7 @@ is-generator-fn@^2.0.0: is-glob@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" - integrity sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo= + integrity sha512-UFpDDrPgM6qpnFNI+rh/p3bUaq9hKLZN8bMUWzxmcnZVS3omf4IPK+BrewlnWjO1WmUsMYuSjKh4UJuV4+Lqmw== dependencies: is-extglob "^2.1.0" @@ -6253,24 +6392,24 @@ is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: is-module@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" - integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE= + integrity sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g== -is-negative-zero@^2.0.1: +is-negative-zero@^2.0.2: version "2.0.2" resolved "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150" integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== is-number-object@^1.0.4: - version "1.0.6" - resolved "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz#6a7aaf838c7f0686a50b4553f7e54a96494e89f0" - integrity sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g== + version "1.0.7" + resolved "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz#59d50ada4c45251784e9904f5246c742f07a42fc" + integrity sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ== dependencies: has-tostringtag "^1.0.0" is-number@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" - integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= + integrity sha512-4cboCqIpliH+mAvFNegjZQ4kgKc3ZUhQVr3HvWbSh5q3WH2v82ct+T2Y1hdU5Gdtorx/cLifQjqCbL7bpznLTg== dependencies: kind-of "^3.0.2" @@ -6282,7 +6421,7 @@ is-number@^7.0.0: is-obj@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" - integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8= + integrity sha512-l4RyHgRqGN4Y3+9JHVrNqO+tN0rV5My76uW5/nuO4K1b6vw5G8d/cmFjP9tRfEsdhZNt0IFdZuK/c2Vr4Nb+Qg== is-obj@^2.0.0: version "2.0.0" @@ -6311,7 +6450,7 @@ is-path-inside@^2.1.0: is-plain-obj@^1.0.0: version "1.1.0" resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" - integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= + integrity sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg== is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" @@ -6336,7 +6475,7 @@ is-regex@^1.0.4, is-regex@^1.1.4: is-regexp@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" - integrity sha1-/S2INUXEa6xaYz57mgnof6LLUGk= + integrity sha512-7zjFAPO4/gwyQAAgRRmqeEeyIICSdmCqa3tsVHMdBzaXXRiqopZL4Cyghg/XulGWrtABTpbnYYzzIRffLkP4oA== is-resolvable@^1.0.0: version "1.1.0" @@ -6348,15 +6487,17 @@ is-root@2.1.0: resolved "https://registry.npmjs.org/is-root/-/is-root-2.1.0.tgz#809e18129cf1129644302a4f8544035d51984a9c" integrity sha512-AGOriNp96vNBd3HtU+RzFEc75FfR5ymiYv8E553I71SCeXBiMsVDUtdio1OEFvrPyLIQ9tVR5RxXIFe5PUFjMg== -is-shared-array-buffer@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz#97b0c85fbdacb59c9c446fe653b82cf2b5b7cfe6" - integrity sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA== +is-shared-array-buffer@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz#8f259c573b60b6a32d4058a1a07430c0a7344c79" + integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA== + dependencies: + call-bind "^1.0.2" is-stream@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" - integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= + integrity sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ== is-stream@^2.0.0: version "2.0.1" @@ -6380,16 +6521,16 @@ is-symbol@^1.0.2, is-symbol@^1.0.3: is-typedarray@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= + integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== -is-weakref@^1.0.1: +is-weakref@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz#9529f383a9338205e89765e0392efc2f100f06f2" integrity sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ== dependencies: call-bind "^1.0.2" -is-what@^3.12.0: +is-what@^3.14.1: version "3.14.1" resolved "https://registry.npmjs.org/is-what/-/is-what-3.14.1.tgz#e1222f46ddda85dead0fd1c9df131760e77755c1" integrity sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA== @@ -6402,7 +6543,7 @@ is-windows@^1.0.2: is-wsl@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" - integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= + integrity sha512-gfygJYZ2gLTDlmbWMI0CE2MwnFzSN/2SZfkMlItC4K/JBlsWVDB0bO6XhqcY13YXE7iMcAJnzTCJjPiTeJJ0Mw== is-wsl@^2.1.1, is-wsl@^2.2.0: version "2.2.0" @@ -6414,29 +6555,29 @@ is-wsl@^2.1.1, is-wsl@^2.2.0: isarray@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" - integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= + integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ== isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== isexe@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== isobject@^2.0.0: version "2.1.0" resolved "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" - integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= + integrity sha512-+OUdGJlgjOBZDfxnDjYYG6zp487z0JGNQq3cYQYg5f5hKR+syHMsaztzGeml/4kGG55CSpKSpWTY+jYGgsHLgA== dependencies: isarray "1.0.0" isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" resolved "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" - integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= + integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.0" @@ -6454,9 +6595,9 @@ istanbul-lib-instrument@^4.0.3: semver "^6.3.0" istanbul-lib-instrument@^5.0.4: - version "5.1.0" - resolved "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.1.0.tgz#7b49198b657b27a730b8e9cb601f1e1bff24c59a" - integrity sha512-czwUz525rkOFDJxfKK6mYfIs9zBKILyrZQxjz3ABhjQXhbhFsSbo1HW/BFcsDnfJYJWA6thRR5/TUY2qs5W99Q== + version "5.2.0" + resolved "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.0.tgz#31d18bdd127f825dd02ea7bfdfd906f8ab840e9f" + integrity sha512-6Lthe1hqXHBNsqvgDzGO6l03XNeu3CrG4RqQ1KM9+l5+jNGpEJfIELx1NS3SEHmJQA8np/u+E4EPRKRiu6m19A== dependencies: "@babel/core" "^7.12.3" "@babel/parser" "^7.14.7" @@ -6483,9 +6624,9 @@ istanbul-lib-source-maps@^4.0.0: source-map "^0.6.1" istanbul-reports@^3.0.2: - version "3.1.3" - resolved "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.3.tgz#4bcae3103b94518117930d51283690960b50d3c2" - integrity sha512-x9LtDVtfm/t1GFiLl3NffC7hz+I1ragvgX1P/Lg1NlIagifZDKUkuuaAxH/qpwj2IuEfD8G2Bs/UKp+sZ/pKkg== + version "3.1.4" + resolved "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.4.tgz#1b6f068ecbc6c331040aab5741991273e609e40c" + integrity sha512-r1/DshN4KSE7xWEknZLLLLDn5CJybV3nw01VTkp6D5jzLuELlcbudfj/eSQFvrKsJuTVCGnePO7ho82Nw9zzfw== dependencies: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" @@ -6579,15 +6720,15 @@ jest-diff@^26.6.2: jest-get-type "^26.3.0" pretty-format "^26.6.2" -jest-diff@^27.0.0: - version "27.4.2" - resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-27.4.2.tgz#786b2a5211d854f848e2dcc1e324448e9481f36f" - integrity sha512-ujc9ToyUZDh9KcqvQDkk/gkbf6zSaeEg9AiBxtttXW59H/AcqEYp1ciXAtJp+jXWva5nAf/ePtSsgWwE5mqp4Q== +jest-diff@^28.1.1: + version "28.1.1" + resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-28.1.1.tgz#1a3eedfd81ae79810931c63a1d0f201b9120106c" + integrity sha512-/MUUxeR2fHbqHoMMiffe/Afm+U8U4olFRJ0hiVG2lZatPJcnGxx292ustVu7bULhjV65IYMxRdploAKLbcrsyg== dependencies: chalk "^4.0.0" - diff-sequences "^27.4.0" - jest-get-type "^27.4.0" - pretty-format "^27.4.2" + diff-sequences "^28.1.1" + jest-get-type "^28.0.2" + pretty-format "^28.1.1" jest-docblock@^26.0.0: version "26.0.0" @@ -6637,10 +6778,10 @@ jest-get-type@^26.3.0: resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz#e97dc3c3f53c2b406ca7afaed4493b1d099199e0" integrity sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig== -jest-get-type@^27.4.0: - version "27.4.0" - resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.4.0.tgz#7503d2663fffa431638337b3998d39c5e928e9b5" - integrity sha512-tk9o+ld5TWq41DkK14L4wox4s2D9MtTpKaAVzXfr5CUKm5ZK2ExcaFE0qls2W71zE/6R2TxxrK9w2r6svAFDBQ== +jest-get-type@^28.0.2: + version "28.0.2" + resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz#34622e628e4fdcd793d46db8a242227901fcf203" + integrity sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA== jest-haste-map@^26.6.2: version "26.6.2" @@ -6705,6 +6846,16 @@ jest-matcher-utils@^26.6.0, jest-matcher-utils@^26.6.2: jest-get-type "^26.3.0" pretty-format "^26.6.2" +jest-matcher-utils@^28.0.0: + version "28.1.1" + resolved "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-28.1.1.tgz#a7c4653c2b782ec96796eb3088060720f1e29304" + integrity sha512-NPJPRWrbmR2nAJ+1nmnfcKKzSwgfaciCCrYZzVnNoxVoyusYWIjkBMNvu0RHJe7dNj4hH3uZOPZsQA+xAYWqsw== + dependencies: + chalk "^4.0.0" + jest-diff "^28.1.1" + jest-get-type "^28.0.2" + pretty-format "^28.1.1" + jest-message-util@^26.6.0, jest-message-util@^26.6.2: version "26.6.2" resolved "https://registry.npmjs.org/jest-message-util/-/jest-message-util-26.6.2.tgz#58173744ad6fc0506b5d21150b9be56ef001ca07" @@ -6931,10 +7082,10 @@ jest-worker@^26.5.0, jest-worker@^26.6.2: merge-stream "^2.0.0" supports-color "^7.0.0" -jest-worker@^27.3.1: - version "27.4.5" - resolved "https://registry.npmjs.org/jest-worker/-/jest-worker-27.4.5.tgz#d696e3e46ae0f24cff3fa7195ffba22889262242" - integrity sha512-f2s8kEdy15cv9r7q4KkzGXvlY0JTcmCbMHZBfSQDwW77REr45IDWwd0lksDFeVHH2jJ5pqb90T77XscrjeGzzg== +jest-worker@^27.5.1: + version "27.5.1" + resolved "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" + integrity sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg== dependencies: "@types/node" "*" merge-stream "^2.0.0" @@ -7003,7 +7154,7 @@ jsesc@^2.5.1: jsesc@~0.5.0: version "0.5.0" resolved "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" - integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= + integrity sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA== json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2: version "1.0.2" @@ -7028,20 +7179,15 @@ json-schema-traverse@^1.0.0: json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" - integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= + integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== json2mq@^0.2.0: version "0.2.0" resolved "https://registry.npmjs.org/json2mq/-/json2mq-0.2.0.tgz#b637bd3ba9eabe122c83e9720483aeb10d2c904a" - integrity sha1-tje9O6nqvhIsg+lyBIOusQ0skEo= + integrity sha512-SzoRg7ux5DWTII9J2qkrZrqV1gt+rTaoufMxEzXbS26Uid0NwaJd123HcoB80TgubEppxxIGdNxCx50fEoEWQA== dependencies: string-convert "^0.2.0" -json3@^3.3.3: - version "3.3.3" - resolved "https://registry.npmjs.org/json3/-/json3-3.3.3.tgz#7fc10e375fc5ae42c4705a5cc0aa6f62be305b81" - integrity sha512-c7/8mbUsKigAbLkD5B010BK4D9LZm7A1pNItkEwiUZRpIN66exu/e7YQWysGun+TRKaJp8MhemM+VkfWv42aCA== - json5@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" @@ -7049,17 +7195,15 @@ json5@^1.0.1: dependencies: minimist "^1.2.0" -json5@^2.1.2: - version "2.2.0" - resolved "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3" - integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA== - dependencies: - minimist "^1.2.5" +json5@^2.1.2, json5@^2.2.1: + version "2.2.1" + resolved "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" + integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" - integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= + integrity sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg== optionalDependencies: graceful-fs "^4.1.6" @@ -7072,12 +7216,12 @@ jsonfile@^6.0.1: optionalDependencies: graceful-fs "^4.1.6" -"jsx-ast-utils@^2.4.1 || ^3.0.0", jsx-ast-utils@^3.2.1: - version "3.2.1" - resolved "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.2.1.tgz#720b97bfe7d901b927d87c3773637ae8ea48781b" - integrity sha512-uP5vu8xfy2F9A6LGC22KO7e2/vGTS1MhP+18f++ZNlf0Ohaxbc9nIEwHAsejlJKyzfZzU5UIhe5ItYkitcZnZA== +"jsx-ast-utils@^2.4.1 || ^3.0.0", jsx-ast-utils@^3.3.1: + version "3.3.1" + resolved "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.1.tgz#a3e0f1cb7e230954eab4dcbce9f6288a78f8ba44" + integrity sha512-pxrjmNpeRw5wwVeWyEAk7QJu2GnBO3uzPFmHCKJJFPKK2Cy0cWL23krGtLdnMmbIi6/FjlrQpPyfQI19ByPOhQ== dependencies: - array-includes "^3.1.3" + array-includes "^3.1.5" object.assign "^4.1.2" killable@^1.0.1: @@ -7088,14 +7232,14 @@ killable@^1.0.1: kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" resolved "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" - integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= + integrity sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ== dependencies: is-buffer "^1.1.5" kind-of@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" - integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= + integrity sha512-24XsCxmEbRwEDbz/qz3stgin8TTzZ1ESR56OMCN0ujYg+vRutNSiOj9bHH9u85DKgXguraugV5sFuvbD4FW/hw== dependencies: is-buffer "^1.1.5" @@ -7127,7 +7271,7 @@ language-subtag-registry@~0.3.2: language-tags@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/language-tags/-/language-tags-1.0.5.tgz#d321dbc4da30ba8bf3024e040fa5c14661f9193a" - integrity sha1-0yHbxNowuovzAk4ED6XBRmH5GTo= + integrity sha512-qJhlO9cGXi6hBGKoxEG/sKZDAHD5Hnu9Hs4WbOY3pCWXDhw0N8x1NenNzm2EnNLkLkk7J2SdxAkDSbb6ftT+UQ== dependencies: language-subtag-registry "~0.3.2" @@ -7147,9 +7291,9 @@ less-loader@~8.0.0: klona "^2.0.4" less@~4.1.1: - version "4.1.2" - resolved "https://registry.npmjs.org/less/-/less-4.1.2.tgz#6099ee584999750c2624b65f80145f8674e4b4b0" - integrity sha512-EoQp/Et7OSOVu0aJknJOtlXZsnr8XE8KwuzTHOLeVSEx8pVWUICc8Q0VYRHgzyjX78nMEyC/oztWFbgyhtNfDA== + version "4.1.3" + resolved "https://registry.npmjs.org/less/-/less-4.1.3.tgz#175be9ddcbf9b250173e0a00b4d6920a5b770246" + integrity sha512-w16Xk/Ta9Hhyei0Gpz9m7VS8F28nieJaL/VyShID7cYvP6IL5oHeL6p4TXSDJqZE/lNv0oJ2pGVjJsRkfwm5FA== dependencies: copy-anything "^2.0.1" parse-node-version "^1.0.1" @@ -7160,7 +7304,7 @@ less@~4.1.1: image-size "~0.5.0" make-dir "^2.1.0" mime "^1.4.1" - needle "^2.5.2" + needle "^3.1.0" source-map "~0.6.0" leven@^3.1.0: @@ -7179,7 +7323,7 @@ levn@^0.4.1: levn@~0.3.0: version "0.3.0" resolved "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= + integrity sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA== dependencies: prelude-ls "~1.1.2" type-check "~0.3.2" @@ -7233,7 +7377,7 @@ loader-utils@^2.0.0: locate-path@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" - integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= + integrity sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA== dependencies: p-locate "^2.0.0" path-exists "^3.0.0" @@ -7253,20 +7397,27 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + lodash._reinterpolate@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" - integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= + integrity sha512-xYHt68QRoYGjeeM/XOE1uJtvXQAgvszfBhjV4yvsQH0u2i9I6cI6c6/eG4Hh3UAOVn0y/xAXwmTzEay49Q//HA== lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" - integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= + integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" - integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= + integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== lodash.merge@^4.6.2: version "4.6.2" @@ -7291,12 +7442,12 @@ lodash.templatesettings@^4.0.0: lodash.truncate@^4.4.2: version "4.4.2" resolved "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" - integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= + integrity sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw== lodash.uniq@^4.5.0: version "4.5.0" resolved "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" - integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= + integrity sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ== "lodash@>=3.5 <5", lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.5, lodash@^4.7.0: version "4.17.21" @@ -7339,14 +7490,14 @@ lru-cache@^6.0.0: lz-string@^1.4.4: version "1.4.4" resolved "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26" - integrity sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY= + integrity sha512-0ckx7ZHRPqb0oUm8zNr+90mtf9DQB60H1wMCjBtfi62Kl3a7JbHob6gA2bC+xRvZoOL+1hzUK8jeuEIQE8svEQ== magic-string@^0.25.0, magic-string@^0.25.7: - version "0.25.7" - resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" - integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA== + version "0.25.9" + resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz#de7f9faf91ef8a1c91d02c2e5314c8277dbcdd1c" + integrity sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ== dependencies: - sourcemap-codec "^1.4.4" + sourcemap-codec "^1.4.8" make-dir@^2.0.0, make-dir@^2.1.0: version "2.1.0" @@ -7373,12 +7524,12 @@ makeerror@1.0.12: map-cache@^0.2.2: version "0.2.2" resolved "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" - integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= + integrity sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg== map-visit@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" - integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= + integrity sha512-4y7uGv8bd2WdM9vpQsiQNo41Ln1NvhvDRuVt0k2JZQ+ezN2uaQes7lZeZ+QQUHOLQAtDaBJ+7wCbi+ab/KFs+w== dependencies: object-visit "^1.0.0" @@ -7404,12 +7555,12 @@ mdn-data@2.0.4: media-typer@0.3.0: version "0.3.0" resolved "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" - integrity sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g= + integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== memory-fs@^0.4.1: version "0.4.1" resolved "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" - integrity sha1-OpoguEYlI+RHz7x+i7gO1me/xVI= + integrity sha512-cda4JKCxReDXFXRqOHPQscuIYg1PvxbE2S2GP45rnwfEK+vZaXC8C1OFvdHIbgw0DLzowXGVoxLaAmlgRy14GQ== dependencies: errno "^0.1.3" readable-stream "^2.0.1" @@ -7425,14 +7576,14 @@ memory-fs@^0.5.0: merge-descriptors@1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" - integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= + integrity sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w== merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -merge2@^1.3.0: +merge2@^1.3.0, merge2@^1.4.1: version "1.4.1" resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== @@ -7440,7 +7591,7 @@ merge2@^1.3.0: methods@~1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= + integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== microevent.ts@~0.1.1: version "0.1.1" @@ -7466,13 +7617,13 @@ micromatch@^3.1.10, micromatch@^3.1.4: snapdragon "^0.8.1" to-regex "^3.0.2" -micromatch@^4.0.2, micromatch@^4.0.4: - version "4.0.4" - resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" - integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== +micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5: + version "4.0.5" + resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== dependencies: - braces "^3.0.1" - picomatch "^2.2.3" + braces "^3.0.2" + picomatch "^2.3.1" miller-rabin@^4.0.0: version "4.0.1" @@ -7482,17 +7633,17 @@ miller-rabin@^4.0.0: bn.js "^4.0.0" brorand "^1.0.1" -mime-db@1.51.0, "mime-db@>= 1.43.0 < 2": - version "1.51.0" - resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c" - integrity sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g== +mime-db@1.52.0, "mime-db@>= 1.43.0 < 2": + version "1.52.0" + resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12, mime-types@^2.1.27, mime-types@~2.1.17, mime-types@~2.1.24: - version "2.1.34" - resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz#5a712f9ec1503511a945803640fafe09d3793c24" - integrity sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A== +mime-types@^2.1.12, mime-types@^2.1.27, mime-types@~2.1.17, mime-types@~2.1.24, mime-types@~2.1.34: + version "2.1.35" + resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== dependencies: - mime-db "1.51.0" + mime-db "1.52.0" mime@1.6.0, mime@^1.4.1: version "1.6.0" @@ -7548,19 +7699,26 @@ minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: minimalistic-crypto-utils@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" - integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= + integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== -minimatch@3.0.4, minimatch@^3.0.4: +minimatch@3.0.4: version "3.0.4" resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== dependencies: brace-expansion "^1.1.7" -minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5: - version "1.2.5" - resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== +minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.6: + version "1.2.6" + resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" + integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== minipass-collect@^1.0.2: version "1.0.2" @@ -7584,9 +7742,9 @@ minipass-pipeline@^1.2.2: minipass "^3.0.0" minipass@^3.0.0, minipass@^3.1.1: - version "3.1.6" - resolved "https://registry.npmjs.org/minipass/-/minipass-3.1.6.tgz#3b8150aa688a711a1521af5e8779c1d3bb4f45ee" - integrity sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ== + version "3.3.4" + resolved "https://registry.npmjs.org/minipass/-/minipass-3.3.4.tgz#ca99f95dd77c43c7a76bf51e6d200025eee0ffae" + integrity sha512-I9WPbWHCGu8W+6k1ZiGpPu0GkoKBeorkfKNuAFBNS1HNFJvke82sxvI5bzcCNpWPorkOO5QQ+zomzzwRxejXiw== dependencies: yallist "^4.0.0" @@ -7623,11 +7781,11 @@ mixin-deep@^1.2.0: is-extendable "^1.0.1" mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.5, mkdirp@~0.5.1: - version "0.5.5" - resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" - integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== + version "0.5.6" + resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" + integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== dependencies: - minimist "^1.2.5" + minimist "^1.2.6" mkdirp@^1.0.3, mkdirp@^1.0.4: version "1.0.4" @@ -7640,19 +7798,19 @@ mobx-react-lite@~3.2.0: integrity sha512-7exWp1FV0M9dP08H9PIeHlJqDw4IdkQVRMfLYaZFMmlbzSS6ZU6p/kx392KN+rVf81hH3IQYewvRGQ70oiwmbw== mobx@~6.3.2: - version "6.3.10" - resolved "https://registry.npmjs.org/mobx/-/mobx-6.3.10.tgz#c3bc715c8f03717b9a2329f9697d42b7998d42e0" - integrity sha512-lfuIN5TGXBNy/5s3ggr1L+IbD+LvfZVlj5q1ZuqyV9AfMtunYQvE8G0WfewS9tgIR3I1q8HJEEbcAOsxEgLwRw== + version "6.3.13" + resolved "https://registry.npmjs.org/mobx/-/mobx-6.3.13.tgz#93e56a57ee72369f850cf3d6398fd36ee8ef062e" + integrity sha512-zDDKDhYUk9QCHQUdLG+wb4Jv/nXutSLt/P8kkwHyjdbrJO4OZS6QTEsrOnrKM39puqXSrJZHdB6+yRys2NBFFA== moment@^2.24.0, moment@^2.25.3: - version "2.29.1" - resolved "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3" - integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ== + version "2.29.3" + resolved "https://registry.npmjs.org/moment/-/moment-2.29.3.tgz#edd47411c322413999f7a5940d526de183c031f3" + integrity sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw== move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" - integrity sha1-viwAX9oy4LKa8fBdfEszIUxwH5I= + integrity sha512-hdrFxZOycD/g6A6SoI2bB5NA/5NEqD0569+S47WZhPvm46sD50ZHdYaFmnua5lndde9rCHGjmfK7Z8BuCt/PcQ== dependencies: aproba "^1.1.1" copy-concurrently "^1.0.0" @@ -7664,7 +7822,7 @@ move-concurrently@^1.0.1: ms@2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + integrity sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A== ms@2.1.2: version "2.1.2" @@ -7679,7 +7837,7 @@ ms@2.1.3, ms@^2.1.1: multicast-dns-service-types@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz#899f11d9686e5e05cb91b35d5f0e63b773cfc901" - integrity sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE= + integrity sha512-cnAsSVxIDsYt0v7HmC0hWZFwwXSh+E6PgCrREDuN/EsjgLwA5XRmlMHhSiDPrt6HxY1gTivEa/Zh7GtODoLevQ== multicast-dns@^6.0.1: version "6.2.3" @@ -7690,14 +7848,14 @@ multicast-dns@^6.0.1: thunky "^1.0.2" nan@^2.12.1: - version "2.15.0" - resolved "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz#3f34a473ff18e15c1b5626b62903b5ad6e665fee" - integrity sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ== + version "2.16.0" + resolved "https://registry.npmjs.org/nan/-/nan-2.16.0.tgz#664f43e45460fb98faf00edca0bb0d7b8dce7916" + integrity sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA== -nanoid@^3.1.30: - version "3.1.30" - resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz#63f93cc548d2a113dc5dfbc63bfa09e2b9b64362" - integrity sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ== +nanoid@^3.3.4: + version "3.3.4" + resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" + integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== nanomatch@^1.2.9: version "1.2.13" @@ -7716,41 +7874,34 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" -native-url@^0.2.6: - version "0.2.6" - resolved "https://registry.npmjs.org/native-url/-/native-url-0.2.6.tgz#ca1258f5ace169c716ff44eccbddb674e10399ae" - integrity sha512-k4bDC87WtgrdD362gZz6zoiXQrl40kYlBmpfmSjwRO1VU0V5ccwJTlxuE72F6m3V0vc1xOf6n3UCP9QyerRqmA== - dependencies: - querystring "^0.2.0" - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -needle@^2.5.2: - version "2.9.1" - resolved "https://registry.npmjs.org/needle/-/needle-2.9.1.tgz#22d1dffbe3490c2b83e301f7709b6736cd8f2684" - integrity sha512-6R9fqJ5Zcmf+uYaFgdIHmLwNldn5HbK8L5ybn7Uz+ylX/rnOsSp1AHcvQSrCaFN+qNM1wpymHqD7mVasEOlHGQ== +needle@^3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/needle/-/needle-3.1.0.tgz#3bf5cd090c28eb15644181ab6699e027bd6c53c9" + integrity sha512-gCE9weDhjVGCRqS8dwDR/D3GTAeyXLXuqp7I8EzH6DllZGXSUyxuqqLh+YX9rMAWaaTFyVAg6rHGL25dqvczKw== dependencies: debug "^3.2.6" - iconv-lite "^0.4.4" + iconv-lite "^0.6.3" sax "^1.2.4" -negotiator@0.6.2: - version "0.6.2" - resolved "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" - integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== +negotiator@0.6.3: + version "0.6.3" + resolved "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" + integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== neo-async@^2.5.0, neo-async@^2.6.1: version "2.6.2" resolved "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -next-tick@~1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" - integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= +next-tick@^1.1.0: + version "1.1.0" + resolved "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" + integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== nice-try@^1.0.4: version "1.0.5" @@ -7773,7 +7924,7 @@ node-forge@^0.10.0: node-int64@^0.4.0: version "0.4.0" resolved "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" - integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= + integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== node-libs-browser@^2.2.1: version "2.2.1" @@ -7821,10 +7972,10 @@ node-releases@^1.1.61: resolved "https://registry.npmjs.org/node-releases/-/node-releases-1.1.77.tgz#50b0cfede855dd374e7585bf228ff34e57c1c32e" integrity sha512-rB1DUFUNAN4Gn9keO2K1efO35IDK7yKHCdCaIMvFO7yUYmmZYeDjnGKle26G4rwj+LKRQpjyUUvMkPglwGCYNQ== -node-releases@^2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz#3d1d395f204f1f2f29a54358b9fb678765ad2fc5" - integrity sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA== +node-releases@^2.0.5: + version "2.0.5" + resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.5.tgz#280ed5bc3eba0d96ce44897d8aee478bfb3d9666" + integrity sha512-U9h1NLROZTq9uE1SNffn6WuPDg8icmi3ns4rEl/oTfIle4iLjTliCzgTsbaIFMq/Xn078/lfY/BL0GWZ+psK4Q== normalize-package-data@^2.5.0: version "2.5.0" @@ -7839,7 +7990,7 @@ normalize-package-data@^2.5.0: normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" - integrity sha1-GrKLVW4Zg2Oowab35vogE3/mrtk= + integrity sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w== dependencies: remove-trailing-separator "^1.0.1" @@ -7851,12 +8002,12 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: normalize-range@^0.1.2: version "0.1.2" resolved "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942" - integrity sha1-LRDAa9/TEuqXd2laTShDlFa3WUI= + integrity sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA== normalize-url@1.9.1: version "1.9.1" resolved "https://registry.npmjs.org/normalize-url/-/normalize-url-1.9.1.tgz#2cc0d66b31ea23036458436e3620d85954c66c3c" - integrity sha1-LMDWazHqIwNkWENuNiDYWVTGbDw= + integrity sha512-A48My/mtCklowHBlI8Fq2jFWK4tX4lJ5E6ytFsSOq1fzpvT0SQSgKhSg7lN5c2uYFOrUAOQp6zhhJnpp1eMloQ== dependencies: object-assign "^4.0.1" prepend-http "^1.0.0" @@ -7871,7 +8022,7 @@ normalize-url@^3.0.0: npm-run-path@^2.0.0: version "2.0.2" resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" - integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= + integrity sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw== dependencies: path-key "^2.0.0" @@ -7890,40 +8041,40 @@ nth-check@^1.0.2: boolbase "~1.0.0" nth-check@^2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz#2efe162f5c3da06a28959fbd3db75dbeea9f0fc2" - integrity sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w== + version "2.1.1" + resolved "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz#c9eab428effce36cd6b92c924bdb000ef1f1ed1d" + integrity sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w== dependencies: boolbase "^1.0.0" num2fraction@^1.2.2: version "1.2.2" resolved "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede" - integrity sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4= + integrity sha512-Y1wZESM7VUThYY+4W+X4ySH2maqcA+p7UR+w8VWNWVAd6lwuXXWz/w/Cz43J/dI2I+PS6wD5N+bJUF+gjWvIqg== nwsapi@^2.2.0: - version "2.2.0" - resolved "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" - integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ== + version "2.2.1" + resolved "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.1.tgz#10a9f268fbf4c461249ebcfe38e359aa36e2577c" + integrity sha512-JYOWTeFoS0Z93587vRJgASD5Ut11fYl5NyihP3KrYBvMe1FRRs6RN7m20SA/16GM4P6hTnZjT+UmDOt38UeXNg== object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== object-copy@^0.1.0: version "0.1.0" resolved "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" - integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= + integrity sha512-79LYn6VAb63zgtmAteVOWo9Vdj71ZVBy3Pbse+VqxDpEP83XuujMrGqHIwAXJ5I/aM0zU7dIyIAhifVTPrNItQ== dependencies: copy-descriptor "^0.1.0" define-property "^0.2.5" kind-of "^3.0.3" -object-inspect@^1.11.0, object-inspect@^1.9.0: - version "1.12.0" - resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz#6e2c120e868fd1fd18cb4f18c31741d0d6e776f0" - integrity sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g== +object-inspect@^1.12.0, object-inspect@^1.9.0: + version "1.12.2" + resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea" + integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ== object-is@^1.0.1: version "1.1.5" @@ -7933,7 +8084,7 @@ object-is@^1.0.1: call-bind "^1.0.2" define-properties "^1.1.3" -object-keys@^1.0.12, object-keys@^1.1.1: +object-keys@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== @@ -7941,7 +8092,7 @@ object-keys@^1.0.12, object-keys@^1.1.1: object-visit@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" - integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= + integrity sha512-GBaMwwAVK9qbQN3Scdo0OyvgPW7l3lnaVMj84uTOZlswkX0KpF6fyDBJhtTthf7pymztoN36/KEr1DyhF96zEA== dependencies: isobject "^3.0.0" @@ -7974,26 +8125,27 @@ object.fromentries@^2.0.5: es-abstract "^1.19.1" object.getownpropertydescriptors@^2.0.3, object.getownpropertydescriptors@^2.1.0: - version "2.1.3" - resolved "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.3.tgz#b223cf38e17fefb97a63c10c91df72ccb386df9e" - integrity sha512-VdDoCwvJI4QdC6ndjpqFmoL3/+HxffFBbcJzKi5hwLLqqx3mdbedRpfZDdK0SrOSauj8X4GzBvnDZl4vTN7dOw== + version "2.1.4" + resolved "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.4.tgz#7965e6437a57278b587383831a9b829455a4bc37" + integrity sha512-sccv3L/pMModT6dJAYF3fzGMVcb38ysQ0tEE6ixv2yXJDtEIPph268OlAdJj5/qZMZDq2g/jqvwppt36uS/uQQ== dependencies: + array.prototype.reduce "^1.0.4" call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.1" + define-properties "^1.1.4" + es-abstract "^1.20.1" -object.hasown@^1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.0.tgz#7232ed266f34d197d15cac5880232f7a4790afe5" - integrity sha512-MhjYRfj3GBlhSkDHo6QmvgjRLXQ2zndabdf3nX0yTyZK9rPfxb6uRpAac8HXNLy1GpqWtZ81Qh4v3uOls2sRAg== +object.hasown@^1.1.1: + version "1.1.1" + resolved "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.1.tgz#ad1eecc60d03f49460600430d97f23882cf592a3" + integrity sha512-LYLe4tivNQzq4JdaWW6WO3HMZZJWzkkH8fnI6EebWl0VZth2wL2Lovm74ep2/gZzlaTdV62JZHEqHQ2yVn8Q/A== dependencies: - define-properties "^1.1.3" - es-abstract "^1.19.1" + define-properties "^1.1.4" + es-abstract "^1.19.5" object.pick@^1.3.0: version "1.3.0" resolved "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" - integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= + integrity sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ== dependencies: isobject "^3.0.1" @@ -8011,10 +8163,10 @@ obuf@^1.0.0, obuf@^1.1.2: resolved "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" integrity sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg== -on-finished@~2.3.0: - version "2.3.0" - resolved "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" - integrity sha1-IPEzZIGwg811M3mSoWlxqi2QaUc= +on-finished@2.4.1: + version "2.4.1" + resolved "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" + integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== dependencies: ee-first "1.1.1" @@ -8026,7 +8178,7 @@ on-headers@~1.0.2: once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== dependencies: wrappy "1" @@ -8084,17 +8236,10 @@ optionator@^0.9.1: type-check "^0.4.0" word-wrap "^1.2.3" -original@^1.0.0: - version "1.0.2" - resolved "https://registry.npmjs.org/original/-/original-1.0.2.tgz#e442a61cffe1c5fd20a65f3261c26663b303f25f" - integrity sha512-hyBVl6iqqUOJ8FqRe+l/gS8H+kKYjrEndd5Pm1MfBtsEKA038HkkdbAl/72EAXGyonD/PFsvmVG+EvcIpliMBg== - dependencies: - url-parse "^1.4.3" - os-browserify@^0.3.0: version "0.3.0" resolved "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" - integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= + integrity sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A== p-each-series@^2.1.0: version "2.2.0" @@ -8104,7 +8249,7 @@ p-each-series@^2.1.0: p-finally@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" - integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= + integrity sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow== p-limit@^1.1.0: version "1.3.0" @@ -8130,7 +8275,7 @@ p-limit@^3.0.2: p-locate@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" - integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= + integrity sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg== dependencies: p-limit "^1.1.0" @@ -8148,6 +8293,13 @@ p-locate@^4.1.0: dependencies: p-limit "^2.2.0" +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + p-map@^2.0.0: version "2.1.0" resolved "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" @@ -8170,7 +8322,7 @@ p-retry@^3.0.1: p-try@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" - integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= + integrity sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww== p-try@^2.0.0: version "2.2.0" @@ -8220,7 +8372,7 @@ parse-asn1@^5.0.0, parse-asn1@^5.1.5: parse-json@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" - integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= + integrity sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw== dependencies: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" @@ -8261,7 +8413,7 @@ pascal-case@^3.1.2: pascalcase@^0.1.1: version "0.1.1" resolved "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" - integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= + integrity sha512-XHXfu/yOQRy9vYOtUDVMN60OEJjW013GoObG1o+xwQTpB9eYJX/BjXMsdW13ZDPruFhYYn0AG22w0xgQMwl3Nw== path-browserify@0.0.1: version "0.0.1" @@ -8271,12 +8423,12 @@ path-browserify@0.0.1: path-dirname@^1.0.0: version "1.0.2" resolved "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0" - integrity sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA= + integrity sha512-ALzNPpyNq9AqXMBjeymIjFDAkAFH06mHJH/cSBHAgU0s4vfpBn6b2nf8tiRLvagKD8RbTpq2FKTBg7cl9l3c7Q== path-exists@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" - integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= + integrity sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ== path-exists@^4.0.0: version "4.0.0" @@ -8286,24 +8438,24 @@ path-exists@^4.0.0: path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== path-is-inside@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" - integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= + integrity sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w== path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= + integrity sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw== path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" resolved "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.6: +path-parse@^1.0.6, path-parse@^1.0.7: version "1.0.7" resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== @@ -8311,7 +8463,7 @@ path-parse@^1.0.6: path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" - integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= + integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ== path-to-regexp@^1.7.0: version "1.8.0" @@ -8339,7 +8491,7 @@ pbkdf2@^3.0.3: performance-now@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= + integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== picocolors@^0.2.1: version "0.2.1" @@ -8351,15 +8503,15 @@ picocolors@^1.0.0: resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== -picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.2.3: - version "2.3.0" - resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" - integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.3.0, picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== pify@^2.0.0: version "2.3.0" resolved "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" - integrity sha1-7RQaasBDqEnqWISY59yosVMw6Qw= + integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== pify@^4.0.1: version "4.0.1" @@ -8369,26 +8521,19 @@ pify@^4.0.1: pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" - integrity sha1-ITXW36ejWMBprJsXh3YogihFD/o= + integrity sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw== dependencies: pinkie "^2.0.0" pinkie@^2.0.0: version "2.0.4" resolved "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" - integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= + integrity sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg== pirates@^4.0.1: - version "4.0.4" - resolved "https://registry.npmjs.org/pirates/-/pirates-4.0.4.tgz#07df81e61028e402735cdd49db701e4885b4e6e6" - integrity sha512-ZIrVPH+A52Dw84R0L3/VS9Op04PuQ2SEoJL6bkshmiTic/HldyW9Tf7oH5mhJZBK7NmDx27vSMrYEXPXclpDKw== - -pkg-dir@^2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" - integrity sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s= - dependencies: - find-up "^2.1.0" + version "4.0.5" + resolved "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b" + integrity sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ== pkg-dir@^3.0.0: version "3.0.0" @@ -8430,7 +8575,7 @@ portfinder@^1.0.26: posix-character-classes@^0.1.0: version "0.1.1" resolved "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" - integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= + integrity sha512-xTgYBc3fuo7Yt7JbiuFxSYGToMoz8fLoE6TC9Wx1P/u+LfeThMOAqmuyECnlBaaJb+u1m9hHiXUEtwW4OzfUJg== postcss-attribute-case-insensitive@^4.0.1: version "4.0.2" @@ -9028,9 +9173,9 @@ postcss-selector-parser@^5.0.0-rc.3, postcss-selector-parser@^5.0.0-rc.4: uniq "^1.0.1" postcss-selector-parser@^6.0.0, postcss-selector-parser@^6.0.2: - version "6.0.8" - resolved "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.8.tgz#f023ed7a9ea736cd7ef70342996e8e78645a7914" - integrity sha512-D5PG53d209Z1Uhcc0qAZ5U3t5HagH3cxu+WLZ22jt3gLUpXM4eXXfiO14jiDWST3NNooX/E8wISfOhZ9eIjGTQ== + version "6.0.10" + resolved "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz#79b61e2c0d1bfc2602d549e11d0876256f8df88d" + integrity sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w== dependencies: cssesc "^3.0.0" util-deprecate "^1.0.2" @@ -9090,13 +9235,13 @@ postcss@^7, postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.17, po source-map "^0.6.1" postcss@^8.1.0: - version "8.4.5" - resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.5.tgz#bae665764dfd4c6fcc24dc0fdf7e7aa00cc77f95" - integrity sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg== + version "8.4.14" + resolved "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz#ee9274d5622b4858c1007a74d76e42e56fd21caf" + integrity sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig== dependencies: - nanoid "^3.1.30" + nanoid "^3.3.4" picocolors "^1.0.0" - source-map-js "^1.0.1" + source-map-js "^1.0.2" prelude-ls@^1.2.1: version "1.2.1" @@ -9106,12 +9251,12 @@ prelude-ls@^1.2.1: prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= + integrity sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w== prepend-http@^1.0.0: version "1.0.4" resolved "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" - integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= + integrity sha512-PhmXi5XmoyKw1Un4E+opM2KcsJInDvKyuOumcjjw3waw86ZNjHwVUOOWLc4bCzLdcKNaWBH9e99sbWzDQsVaYg== pretty-bytes@^5.3.0: version "5.6.0" @@ -9136,15 +9281,15 @@ pretty-format@^26.6.0, pretty-format@^26.6.2: ansi-styles "^4.0.0" react-is "^17.0.1" -pretty-format@^27.0.0, pretty-format@^27.4.2: - version "27.4.2" - resolved "https://registry.npmjs.org/pretty-format/-/pretty-format-27.4.2.tgz#e4ce92ad66c3888423d332b40477c87d1dac1fb8" - integrity sha512-p0wNtJ9oLuvgOQDEIZ9zQjZffK7KtyR6Si0jnXULIDwrlNF8Cuir3AZP0hHv0jmKuNN/edOnbMjnzd4uTcmWiw== +pretty-format@^28.0.0, pretty-format@^28.1.1: + version "28.1.1" + resolved "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.1.tgz#f731530394e0f7fcd95aba6b43c50e02d86b95cb" + integrity sha512-wwJbVTGFHeucr5Jw2bQ9P+VYHyLdAqedFLEkdQUVaBF/eiidDwH5OpilINq4mEfhbCjLnirt6HTTDhv1HaTIQw== dependencies: - "@jest/types" "^27.4.2" + "@jest/schemas" "^28.0.2" ansi-regex "^5.0.1" ansi-styles "^5.0.0" - react-is "^17.0.1" + react-is "^18.0.0" process-nextick-args@~2.0.0: version "2.0.1" @@ -9154,7 +9299,7 @@ process-nextick-args@~2.0.0: process@^0.11.10: version "0.11.10" resolved "https://registry.npmjs.org/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" - integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= + integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== progress@^2.0.0: version "2.0.3" @@ -9164,7 +9309,7 @@ progress@^2.0.0: promise-inflight@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" - integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM= + integrity sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g== promise@^8.1.0: version "8.1.0" @@ -9189,10 +9334,10 @@ prompts@^2.0.1: kleur "^3.0.3" sisteransi "^1.0.5" -prop-types@^15.6.2, prop-types@^15.7.2: - version "15.8.0" - resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.8.0.tgz#d237e624c45a9846e469f5f31117f970017ff588" - integrity sha512-fDGekdaHh65eI3lMi5OnErU6a8Ighg2KjcjQxO7m8VHyWjcPyj5kiOgV1LQDOOOgVy3+5FgjXvdSSX7B8/5/4g== +prop-types@^15.6.2, prop-types@^15.8.1: + version "15.8.1" + resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" + integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== dependencies: loose-envify "^1.4.0" object-assign "^4.1.1" @@ -9209,7 +9354,7 @@ proxy-addr@~2.0.7: prr@~1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" - integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= + integrity sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw== psl@^1.1.33: version "1.8.0" @@ -9256,12 +9401,12 @@ pumpify@^1.3.3: punycode@1.3.2: version "1.3.2" resolved "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" - integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= + integrity sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw== punycode@^1.2.4: version "1.4.1" resolved "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= + integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" @@ -9271,17 +9416,19 @@ punycode@^2.1.0, punycode@^2.1.1: q@^1.1.2: version "1.5.1" resolved "https://registry.npmjs.org/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" - integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc= + integrity sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw== -qs@6.9.6: - version "6.9.6" - resolved "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz#26ed3c8243a431b2924aca84cc90471f35d5a0ee" - integrity sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ== +qs@6.10.3: + version "6.10.3" + resolved "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz#d6cde1b2ffca87b5aa57889816c5f81535e22e8e" + integrity sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ== + dependencies: + side-channel "^1.0.4" query-string@^4.1.0: version "4.3.4" resolved "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz#bbb693b9ca915c232515b228b1a02b609043dbeb" - integrity sha1-u7aTucqRXCMlFbIosaArYJBD2+s= + integrity sha512-O2XLNDBIg1DnTOa+2XrIwSiXEV8h2KImXUnjhhn2+UsvZ+Es2uyd5CCRTNQlDGbzUQOW3aYCBx9rVA6dzsiY7Q== dependencies: object-assign "^4.1.0" strict-uri-encode "^1.0.0" @@ -9289,17 +9436,12 @@ query-string@^4.1.0: querystring-es3@^0.2.0: version "0.2.1" resolved "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" - integrity sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM= + integrity sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA== querystring@0.2.0: version "0.2.0" resolved "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" - integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= - -querystring@^0.2.0: - version "0.2.1" - resolved "https://registry.npmjs.org/querystring/-/querystring-0.2.1.tgz#40d77615bb09d16902a85c3e38aa8b5ed761c2dd" - integrity sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg== + integrity sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g== querystringify@^2.1.1: version "2.2.0" @@ -9338,20 +9480,20 @@ range-parser@^1.2.1, range-parser@~1.2.1: resolved "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== -raw-body@2.4.2: - version "2.4.2" - resolved "https://registry.npmjs.org/raw-body/-/raw-body-2.4.2.tgz#baf3e9c21eebced59dd6533ac872b71f7b61cb32" - integrity sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ== +raw-body@2.5.1: + version "2.5.1" + resolved "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857" + integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig== dependencies: - bytes "3.1.1" - http-errors "1.8.1" + bytes "3.1.2" + http-errors "2.0.0" iconv-lite "0.4.24" unpipe "1.0.0" rc-align@^4.0.0: - version "4.0.11" - resolved "https://registry.npmjs.org/rc-align/-/rc-align-4.0.11.tgz#8198c62db266bc1b8ef05e56c13275bf72628a5e" - integrity sha512-n9mQfIYQbbNTbefyQnRHZPWuTEwG1rY4a9yKlIWHSTbgwI+XUMGRYd0uJ5pE2UbrNX0WvnMBA1zJ3Lrecpra/A== + version "4.0.12" + resolved "https://registry.npmjs.org/rc-align/-/rc-align-4.0.12.tgz#065b5c68a1cc92a00800c9239320d9fdf5f16207" + integrity sha512-3DuwSJp8iC/dgHzwreOQl52soj40LchlfUHtgACOUtwGuoFIOVh6n/sCpfqCU8kO5+iz6qR0YKvjgB8iPdE3aQ== dependencies: "@babel/runtime" "^7.10.1" classnames "2.x" @@ -9380,9 +9522,9 @@ rc-checkbox@~2.3.0: classnames "^2.2.1" rc-collapse@~3.1.0: - version "3.1.2" - resolved "https://registry.npmjs.org/rc-collapse/-/rc-collapse-3.1.2.tgz#76028a811b845d03d9460ccc409c7ea8ad09db14" - integrity sha512-HujcKq7mghk/gVKeI6EjzTbb8e19XUZpakrYazu1MblEZ3Hu3WBMSN4A3QmvbF6n1g7x6lUlZvsHZ5shABWYOQ== + version "3.1.4" + resolved "https://registry.npmjs.org/rc-collapse/-/rc-collapse-3.1.4.tgz#063e33fcc427a378e63da757898cd1fba6269679" + integrity sha512-WayrhswKMwuJab9xbqFxXTgV0m6X8uOPEO6zm/GJ5YJiJ/wIh/Dd2VtWeI06HYUEnTFv0HNcYv+zWbB+p6OD2A== dependencies: "@babel/runtime" "^7.10.1" classnames "2.x" @@ -9419,10 +9561,20 @@ rc-drawer@~4.3.0: classnames "^2.2.6" rc-util "^5.7.0" -rc-dropdown@^3.1.3, rc-dropdown@~3.2.0: - version "3.2.0" - resolved "https://registry.npmjs.org/rc-dropdown/-/rc-dropdown-3.2.0.tgz#da6c2ada403842baee3a9e909a0b1a91ba3e1090" - integrity sha512-j1HSw+/QqlhxyTEF6BArVZnTmezw2LnSmRk6I9W7BCqNCKaRwleRmMMs1PHbuaG8dKHVqP6e21RQ7vPBLVnnNw== +rc-dropdown@^3.1.3: + version "3.6.2" + resolved "https://registry.npmjs.org/rc-dropdown/-/rc-dropdown-3.6.2.tgz#d23b8b2762941ac39e665673946f67ca9c39118f" + integrity sha512-Wsw7GkVbUXADEs8FPL0v8gd+3mWQiydPFXBlr2imMScQaf8hh79pG9KrBc1DwK+nqHmYOpQfK2gn6jG2AQw9Pw== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.6" + rc-trigger "^5.0.4" + rc-util "^5.17.0" + +rc-dropdown@~3.2.0: + version "3.2.5" + resolved "https://registry.npmjs.org/rc-dropdown/-/rc-dropdown-3.2.5.tgz#c211e571d29d15e7f725b5a75fc8c7f371fc3348" + integrity sha512-dVO2eulOSbEf+F4OyhCY5iGiMVhUYY/qeXxL7Ex2jDBt/xc89jU07mNoowV6aWxwVOc70pxEINff0oM2ogjluA== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.2.6" @@ -9483,13 +9635,13 @@ rc-menu@^8.0.1, rc-menu@^8.6.1, rc-menu@~8.10.0: shallowequal "^1.1.0" rc-motion@^2.0.0, rc-motion@^2.0.1, rc-motion@^2.2.0, rc-motion@^2.3.0, rc-motion@^2.3.4, rc-motion@^2.4.0: - version "2.4.4" - resolved "https://registry.npmjs.org/rc-motion/-/rc-motion-2.4.4.tgz#e995d5fa24fc93065c24f714857cf2677d655bb0" - integrity sha512-ms7n1+/TZQBS0Ydd2Q5P4+wJTSOrhIrwNxLXCZpR7Fa3/oac7Yi803HDALc2hLAKaCTQtw9LmQeB58zcwOsqlQ== + version "2.6.0" + resolved "https://registry.npmjs.org/rc-motion/-/rc-motion-2.6.0.tgz#c60c3e7f15257f55a8cd7794a539f0e2cc751399" + integrity sha512-1MDWA9+i174CZ0SIDenSYm2Wb9YbRkrexjZWR0CUFu7D6f23E8Y0KsTgk9NGOLJsGak5ELZK/Y5lOlf5wQdzbw== dependencies: "@babel/runtime" "^7.11.1" classnames "^2.2.1" - rc-util "^5.2.1" + rc-util "^5.21.0" rc-notification@~4.5.2: version "4.5.7" @@ -9502,19 +9654,19 @@ rc-notification@~4.5.2: rc-util "^5.0.1" rc-overflow@^1.0.0: - version "1.2.2" - resolved "https://registry.npmjs.org/rc-overflow/-/rc-overflow-1.2.2.tgz#95b0222016c0cdbdc0db85f569c262e7706a5f22" - integrity sha512-X5kj9LDU1ue5wHkqvCprJWLKC+ZLs3p4He/oxjZ1Q4NKaqKBaYf5OdSzRSgh3WH8kSdrfU8LjvlbWnHgJOEkNQ== + version "1.2.6" + resolved "https://registry.npmjs.org/rc-overflow/-/rc-overflow-1.2.6.tgz#e99fabea04ce4fb13f0dd8835aef4e4cdd4c15a2" + integrity sha512-YqbocgzuQxfq2wZy72vdAgrgzzEuM/5d4gF9TBEodCpXPbUeXGrUXNm1J6G1MSkCU2N0ePIgCEu5qD/0Ldi63Q== dependencies: "@babel/runtime" "^7.11.1" classnames "^2.2.1" rc-resize-observer "^1.0.0" - rc-util "^5.5.1" + rc-util "^5.19.2" rc-pagination@~3.1.6: - version "3.1.15" - resolved "https://registry.npmjs.org/rc-pagination/-/rc-pagination-3.1.15.tgz#e05eddf4c15717a5858290bed0857e27e2f957ff" - integrity sha512-4L3fot8g4E+PjWEgoVGX0noFCg+8ZFZmeLH4vsnZpB3O2T2zThtakjNxG+YvSaYtyMVT4B+GLayjKrKbXQpdAg== + version "3.1.17" + resolved "https://registry.npmjs.org/rc-pagination/-/rc-pagination-3.1.17.tgz#91e690aa894806e344cea88ea4a16d244194a1bd" + integrity sha512-/BQ5UxcBnW28vFAcP2hfh+Xg15W0QZn8TWYwdCApchMH1H0CxiaUUcULP8uXcFM1TygcdKWdt3JqsL9cTAfdkQ== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.2.1" @@ -9542,18 +9694,18 @@ rc-progress@~3.1.0: classnames "^2.2.6" rc-rate@~2.9.0: - version "2.9.1" - resolved "https://registry.npmjs.org/rc-rate/-/rc-rate-2.9.1.tgz#e43cb95c4eb90a2c1e0b16ec6614d8c43530a731" - integrity sha512-MmIU7FT8W4LYRRHJD1sgG366qKtSaKb67D0/vVvJYR0lrCuRrCiVQ5qhfT5ghVO4wuVIORGpZs7ZKaYu+KMUzA== + version "2.9.2" + resolved "https://registry.npmjs.org/rc-rate/-/rc-rate-2.9.2.tgz#4a58965d1ecf91896ebae01d458b59056df0b4ea" + integrity sha512-SaiZFyN8pe0Fgphv8t3+kidlej+cq/EALkAJAc3A0w0XcPaH2L1aggM8bhe1u6GAGuQNAoFvTLjw4qLPGRKV5g== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.2.5" rc-util "^5.0.1" rc-resize-observer@^1.0.0: - version "1.1.2" - resolved "https://registry.npmjs.org/rc-resize-observer/-/rc-resize-observer-1.1.2.tgz#214bc5d0de19e0a5fcd7d8352d9c1560dd7531b7" - integrity sha512-Qp+1x6D88FxyWBFRYP95IV9A1o0xlkC6qhiTX3YakE+o86QH9IzC7UVnltwmm4Q8uYH+E3F/HRmEiuxXJECdSw== + version "1.2.0" + resolved "https://registry.npmjs.org/rc-resize-observer/-/rc-resize-observer-1.2.0.tgz#9f46052f81cdf03498be35144cb7c53fd282c4c7" + integrity sha512-6W+UzT3PyDM0wVCEHfoW3qTHPTvbdSgiA43buiy8PzmeMnfgnDeb9NjdimMXMl3/TcrvvWl5RRVdp+NqcR47pQ== dependencies: "@babel/runtime" "^7.10.1" classnames "^2.2.1" @@ -9678,42 +9830,42 @@ rc-tree@~4.1.0: rc-virtual-list "^3.0.1" rc-trigger@^5.0.0, rc-trigger@^5.0.4, rc-trigger@^5.1.2, rc-trigger@^5.2.1: - version "5.2.10" - resolved "https://registry.npmjs.org/rc-trigger/-/rc-trigger-5.2.10.tgz#8a0057a940b1b9027eaa33beec8a6ecd85cce2b1" - integrity sha512-FkUf4H9BOFDaIwu42fvRycXMAvkttph9AlbCZXssZDVzz2L+QZ0ERvfB/4nX3ZFPh1Zd+uVGr1DEDeXxq4J1TA== + version "5.3.1" + resolved "https://registry.npmjs.org/rc-trigger/-/rc-trigger-5.3.1.tgz#acafadf3eaf384e7f466c303bfa0f34c8137d7b8" + integrity sha512-5gaFbDkYSefZ14j2AdzucXzlWgU2ri5uEjkHvsf1ynRhdJbKxNOnw4PBZ9+FVULNGFiDzzlVF8RJnR9P/xrnKQ== dependencies: - "@babel/runtime" "^7.11.2" + "@babel/runtime" "^7.18.3" classnames "^2.2.6" rc-align "^4.0.0" rc-motion "^2.0.0" - rc-util "^5.5.0" + rc-util "^5.19.2" rc-upload@~4.3.0: - version "4.3.3" - resolved "https://registry.npmjs.org/rc-upload/-/rc-upload-4.3.3.tgz#e237aa525e5313fa16f4d04d27f53c2f0e157bb8" - integrity sha512-YoJ0phCRenMj1nzwalXzciKZ9/FAaCrFu84dS5pphwucTC8GUWClcDID/WWNGsLFcM97NqIboDqrV82rVRhW/w== + version "4.3.4" + resolved "https://registry.npmjs.org/rc-upload/-/rc-upload-4.3.4.tgz#83ff7d3867631c37adbfd72ea3d1fd7e97ca84af" + integrity sha512-uVbtHFGNjHG/RyAfm9fluXB6pvArAGyAx8z7XzXXyorEgVIWj6mOlriuDm0XowDHYz4ycNK0nE0oP3cbFnzxiQ== dependencies: - "@babel/runtime" "^7.10.1" + "@babel/runtime" "^7.18.3" classnames "^2.2.5" rc-util "^5.2.0" -rc-util@^5.0.0, rc-util@^5.0.1, rc-util@^5.0.5, rc-util@^5.0.6, rc-util@^5.0.7, rc-util@^5.15.0, rc-util@^5.16.1, rc-util@^5.2.0, rc-util@^5.2.1, rc-util@^5.3.0, rc-util@^5.4.0, rc-util@^5.5.0, rc-util@^5.5.1, rc-util@^5.6.1, rc-util@^5.7.0, rc-util@^5.8.0, rc-util@^5.9.4, rc-util@^5.9.8: - version "5.16.1" - resolved "https://registry.npmjs.org/rc-util/-/rc-util-5.16.1.tgz#374db7cb735512f05165ddc3d6b2c61c21b8b4e3" - integrity sha512-kSCyytvdb3aRxQacS/71ta6c+kBWvM1v8/2h9d/HaNWauc3qB8pLnF20PJ8NajkNN8gb+rR1l0eWO+D4Pz+LLQ== +rc-util@^5.0.0, rc-util@^5.0.1, rc-util@^5.0.5, rc-util@^5.0.6, rc-util@^5.15.0, rc-util@^5.16.1, rc-util@^5.17.0, rc-util@^5.19.2, rc-util@^5.2.0, rc-util@^5.2.1, rc-util@^5.21.0, rc-util@^5.3.0, rc-util@^5.4.0, rc-util@^5.5.0, rc-util@^5.6.1, rc-util@^5.7.0, rc-util@^5.8.0, rc-util@^5.9.4, rc-util@^5.9.8: + version "5.22.5" + resolved "https://registry.npmjs.org/rc-util/-/rc-util-5.22.5.tgz#d4d6d886c5ecb6a2a51dde1840d780a2b70f5179" + integrity sha512-awD2TGMGU97OZftT2R3JwrHWjR8k/xIwqjwcivPskciweUdgXE7QsyXkBKVSBHXS+c17AWWMDWuKWsJSheQy8g== dependencies: - "@babel/runtime" "^7.12.5" + "@babel/runtime" "^7.18.3" react-is "^16.12.0" shallowequal "^1.1.0" rc-virtual-list@^3.0.1, rc-virtual-list@^3.2.0: - version "3.4.2" - resolved "https://registry.npmjs.org/rc-virtual-list/-/rc-virtual-list-3.4.2.tgz#1078327aa7230b5e456d679ed2ce99f3c036ebd1" - integrity sha512-OyVrrPvvFcHvV0ssz5EDZ+7Rf5qLat/+mmujjchNw5FfbJWNDwkpQ99EcVE6+FtNRmX9wFa1LGNpZLUTvp/4GQ== + version "3.4.8" + resolved "https://registry.npmjs.org/rc-virtual-list/-/rc-virtual-list-3.4.8.tgz#c24c10c6940546b7e2a5e9809402c6716adfd26c" + integrity sha512-qSN+Rv4i/E7RCTvTMr1uZo7f3crJJg/5DekoCagydo9zsXrxj07zsFSxqizqW+ldGA16lwa8So/bIbV9Ofjddg== dependencies: classnames "^2.2.6" rc-resize-observer "^1.0.0" - rc-util "^5.0.7" + rc-util "^5.15.0" react-app-polyfill@^2.0.0: version "2.0.0" @@ -9767,15 +9919,15 @@ react-dom@16.13.0: prop-types "^15.6.2" scheduler "^0.19.0" -react-error-overlay@^6.0.9: - version "6.0.10" - resolved "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.10.tgz#0fe26db4fa85d9dbb8624729580e90e7159a59a6" - integrity sha512-mKR90fX7Pm5seCOfz8q9F+66VCc1PGsWSBxKbITjfKVQHMNF2zudxHnMdJiB1fRCb+XsbQV9sO9DCkgsMQgBIA== +react-error-overlay@6.0.9, react-error-overlay@^6.0.9: + version "6.0.9" + resolved "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz#3c743010c9359608c375ecd6bc76f35d93995b0a" + integrity sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew== react-from-dom@^0.6.0: - version "0.6.1" - resolved "https://registry.npmjs.org/react-from-dom/-/react-from-dom-0.6.1.tgz#6740f5a3d79e0c354703e5c096b8fdfe0db71b0f" - integrity sha512-7aAZx7LhRnmR51W5XtmTBYHGFl2n1AdEk1uoXLuzHa1OoGXrxOW/iwLcudvgp6BGX/l4Yh1rtMrIzvhlvbVddg== + version "0.6.2" + resolved "https://registry.npmjs.org/react-from-dom/-/react-from-dom-0.6.2.tgz#9da903a508c91c013b55afcd59348b8b0a39bdb4" + integrity sha512-qvWWTL/4xw4k/Dywd41RBpLQUSq97csuv15qrxN+izNeLYlD9wn5W8LspbfYe5CWbaSdkZ72BsaYBPQf2x4VbQ== react-inlinesvg@~2.3.0: version "2.3.0" @@ -9795,10 +9947,15 @@ react-is@^17.0.1: resolved "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== -react-refresh@^0.8.3: - version "0.8.3" - resolved "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz#721d4657672d400c5e3c75d063c4a85fb2d5d68f" - integrity sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg== +react-is@^18.0.0: + version "18.2.0" + resolved "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" + integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== + +react-refresh@^0.14.0: + version "0.14.0" + resolved "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.0.tgz#4e02825378a5f227079554d4284889354e5f553e" + integrity sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ== react-router-dom@5.2.0: version "5.2.0" @@ -9917,10 +10074,10 @@ redent@^3.0.0: indent-string "^4.0.0" strip-indent "^3.0.0" -regenerate-unicode-properties@^9.0.0: - version "9.0.0" - resolved "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-9.0.0.tgz#54d09c7115e1f53dc2314a974b32c1c344efe326" - integrity sha512-3E12UeNSPfjrgwjkR81m5J7Aw/T55Tu7nUyZVQYCKEOs+2dkxEY+DpPtZzO4YruuiPb7NkYLVcyJC4+zCbk5pA== +regenerate-unicode-properties@^10.0.1: + version "10.0.1" + resolved "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.0.1.tgz#7f442732aa7934a3740c779bb9b3340dccc1fb56" + integrity sha512-vn5DU6yg6h8hP/2OkQo3K7uVILvY4iu0oI4t3HFa81UPkhGJwkRwM10JEc3upjdhHjs/k8GJY1sRBhk5sr69Bw== dependencies: regenerate "^1.4.2" @@ -9932,7 +10089,7 @@ regenerate@^1.4.2: regenerator-runtime@^0.10.5: version "0.10.5" resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" - integrity sha1-M2w+/BIgrc7dosn6tntaeVWjNlg= + integrity sha512-02YopEIhAgiBHWeoTiA8aitHDt8z6w+rQqNuIftlM+ZtvSl/brTouaU7DW6GO/cHtvxJvS4Hwv2ibKdxIRi24w== regenerator-runtime@^0.11.0: version "0.11.1" @@ -9944,10 +10101,10 @@ regenerator-runtime@^0.13.4, regenerator-runtime@^0.13.7: resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== -regenerator-transform@^0.14.2: - version "0.14.5" - resolved "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.5.tgz#c98da154683671c9c4dcb16ece736517e1b7feb4" - integrity sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw== +regenerator-transform@^0.15.0: + version "0.15.0" + resolved "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.0.tgz#cbd9ead5d77fae1a48d957cf889ad0586adb6537" + integrity sha512-LsrGtPmbYg19bcPHwdtmXwbW+TqNvtY4riE3P83foeHRroMbH6/2ddFBfab3t7kbzc7v7p4wbkIecHImqt0QNg== dependencies: "@babel/runtime" "^7.8.4" @@ -9964,52 +10121,53 @@ regex-parser@^2.2.11: resolved "https://registry.npmjs.org/regex-parser/-/regex-parser-2.2.11.tgz#3b37ec9049e19479806e878cabe7c1ca83ccfe58" integrity sha512-jbD/FT0+9MBU2XAZluI7w2OBs1RBi6p9M83nkoZayQXXU9e8Robt69FcZc7wU4eJD/YFTjn1JdCk3rbMJajz8Q== -regexp.prototype.flags@^1.2.0, regexp.prototype.flags@^1.3.1: - version "1.3.1" - resolved "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.1.tgz#7ef352ae8d159e758c0eadca6f8fcb4eef07be26" - integrity sha512-JiBdRBq91WlY7uRJ0ds7R+dU02i6LKi8r3BuQhNXn+kmeLN+EfHhfjqMRis1zJxnlu88hq/4dx0P2OP3APRTOA== +regexp.prototype.flags@^1.2.0, regexp.prototype.flags@^1.4.1, regexp.prototype.flags@^1.4.3: + version "1.4.3" + resolved "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz#87cab30f80f66660181a3bb7bf5981a872b367ac" + integrity sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA== dependencies: call-bind "^1.0.2" define-properties "^1.1.3" + functions-have-names "^1.2.2" regexpp@^3.1.0: version "3.2.0" resolved "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== -regexpu-core@^4.7.1: - version "4.8.0" - resolved "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.8.0.tgz#e5605ba361b67b1718478501327502f4479a98f0" - integrity sha512-1F6bYsoYiz6is+oz70NWur2Vlh9KWtswuRuzJOfeYUrfPX2o8n74AnUVaOGDbUqVGO9fNHu48/pjJO4sNVwsOg== +regexpu-core@^5.1.0: + version "5.1.0" + resolved "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.1.0.tgz#2f8504c3fd0ebe11215783a41541e21c79942c6d" + integrity sha512-bb6hk+xWd2PEOkj5It46A16zFMs2mv86Iwpdu94la4S3sJ7C973h2dHpYKwIBGaWSO7cIRJ+UX0IeMaWcO4qwA== dependencies: regenerate "^1.4.2" - regenerate-unicode-properties "^9.0.0" - regjsgen "^0.5.2" - regjsparser "^0.7.0" + regenerate-unicode-properties "^10.0.1" + regjsgen "^0.6.0" + regjsparser "^0.8.2" unicode-match-property-ecmascript "^2.0.0" unicode-match-property-value-ecmascript "^2.0.0" -regjsgen@^0.5.2: - version "0.5.2" - resolved "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz#92ff295fb1deecbf6ecdab2543d207e91aa33733" - integrity sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A== +regjsgen@^0.6.0: + version "0.6.0" + resolved "https://registry.npmjs.org/regjsgen/-/regjsgen-0.6.0.tgz#83414c5354afd7d6627b16af5f10f41c4e71808d" + integrity sha512-ozE883Uigtqj3bx7OhL1KNbCzGyW2NQZPl6Hs09WTvCuZD5sTI4JY58bkbQWa/Y9hxIsvJ3M8Nbf7j54IqeZbA== -regjsparser@^0.7.0: - version "0.7.0" - resolved "https://registry.npmjs.org/regjsparser/-/regjsparser-0.7.0.tgz#a6b667b54c885e18b52554cb4960ef71187e9968" - integrity sha512-A4pcaORqmNMDVwUjWoTzuhwMGpP+NykpfqAsEgI1FSH/EzC7lrN5TMd+kN8YCovX+jMpu8eaqXgXPCa0g8FQNQ== +regjsparser@^0.8.2: + version "0.8.4" + resolved "https://registry.npmjs.org/regjsparser/-/regjsparser-0.8.4.tgz#8a14285ffcc5de78c5b95d62bbf413b6bc132d5f" + integrity sha512-J3LABycON/VNEu3abOviqGHuB/LOtOQj8SKmfP9anY5GfAVw/SPjwzSjxGjbZXIxbGfqTHtJw58C2Li/WkStmA== dependencies: jsesc "~0.5.0" relateurl@^0.2.7: version "0.2.7" resolved "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" - integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk= + integrity sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog== remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" - integrity sha1-wkvOKig62tW8P1jg1IJJuSN52O8= + integrity sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw== renderkid@^2.0.4: version "2.0.7" @@ -10030,12 +10188,12 @@ repeat-element@^1.1.2: repeat-string@^1.6.1: version "1.6.1" resolved "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" - integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= + integrity sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w== require-directory@^2.1.1: version "2.1.1" resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== require-from-string@^2.0.2: version "2.0.2" @@ -10050,7 +10208,7 @@ require-main-filename@^2.0.0: requires-port@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= + integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== resize-observer-polyfill@^1.5.0, resize-observer-polyfill@^1.5.1: version "1.5.1" @@ -10060,7 +10218,7 @@ resize-observer-polyfill@^1.5.0, resize-observer-polyfill@^1.5.1: resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" - integrity sha1-AKn3OHVW4nA46uIyyqNypqWbZlo= + integrity sha512-ccu8zQTrzVr954472aUVPLEcB3YpKSYR3cg/3lo1okzobPBM+1INXBbBZlDbnI/hbEocnf8j0QVo43hQKrbchg== dependencies: resolve-from "^3.0.0" @@ -10074,7 +10232,7 @@ resolve-cwd@^3.0.0: resolve-from@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" - integrity sha1-six699nWiBvItuZTM17rywoYh0g= + integrity sha512-GnlH6vxLymXJNMBo7XP1fJIzBFbdYt49CuTwmB/6N53t+kMPRMFKz783LlQ4tv28XoQfMWinAJX6WCGf2IlaIw== resolve-from@^4.0.0: version "4.0.0" @@ -10110,7 +10268,7 @@ resolve-url-loader@^3.1.2: resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" - integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= + integrity sha512-ZuF55hVUQaaczgOIwqWzkEcEidmlD/xl44x1UZnhOXcYuFN2S6+rcxpG+C1N3So0wvNI3DmJICUFfu2SxhBmvg== resolve@1.18.1: version "1.18.1" @@ -10120,21 +10278,23 @@ resolve@1.18.1: is-core-module "^2.0.0" path-parse "^1.0.6" -resolve@^1.10.0, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.19.0, resolve@^1.20.0, resolve@^1.3.2, resolve@^1.9.0: - version "1.20.0" - resolved "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" - integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== +resolve@^1.10.0, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.19.0, resolve@^1.20.0, resolve@^1.22.0, resolve@^1.3.2, resolve@^1.9.0: + version "1.22.1" + resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" + integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== dependencies: - is-core-module "^2.2.0" - path-parse "^1.0.6" + is-core-module "^2.9.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" resolve@^2.0.0-next.3: - version "2.0.0-next.3" - resolved "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.3.tgz#d41016293d4a8586a39ca5d9b5f15cbea1f55e46" - integrity sha512-W8LucSynKUIDu9ylraa7ueVZ7hc0uAgJBxVsQSKOXOyle8a93qXhcz+XAXZ8bIq2d6i4Ehddn6Evt+0/UwKk6Q== + version "2.0.0-next.4" + resolved "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz#3d37a113d6429f496ec4752d2a2e58efb1fd4660" + integrity sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ== dependencies: - is-core-module "^2.2.0" - path-parse "^1.0.6" + is-core-module "^2.9.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" ret@~0.1.10: version "0.1.15" @@ -10144,7 +10304,7 @@ ret@~0.1.10: retry@^0.12.0: version "0.12.0" resolved "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" - integrity sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs= + integrity sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow== reusify@^1.0.4: version "1.0.4" @@ -10154,12 +10314,12 @@ reusify@^1.0.4: rework-visit@1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/rework-visit/-/rework-visit-1.0.0.tgz#9945b2803f219e2f7aca00adb8bc9f640f842c9a" - integrity sha1-mUWygD8hni96ygCtuLyfZA+ELJo= + integrity sha512-W6V2fix7nCLUYX1v6eGPrBOZlc03/faqzP4sUxMAJMBMOPYhfV/RyLegTufn5gJKaOITyi+gvf0LXDZ9NzkHnQ== rework@1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/rework/-/rework-1.0.1.tgz#30806a841342b54510aa4110850cd48534144aa7" - integrity sha1-MIBqhBNCtUUQqkEQhQzUhTQUSqc= + integrity sha512-eEjL8FdkdsxApd0yWVZgBGzfCQiT8yqSc2H1p4jpZpQdtz7ohETiDMoje5PlM8I9WgkqkreVxFUKYOiJdVWDXw== dependencies: convert-source-map "^0.3.3" css "^2.0.0" @@ -10167,12 +10327,12 @@ rework@1.0.1: rgb-regex@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/rgb-regex/-/rgb-regex-1.0.1.tgz#c0e0d6882df0e23be254a475e8edd41915feaeb1" - integrity sha1-wODWiC3w4jviVKR16O3UGRX+rrE= + integrity sha512-gDK5mkALDFER2YLqH6imYvK6g02gpNGM4ILDZ472EwWfXZnC2ZEpoB2ECXTyOVUKuk/bPJZMzwQPBYICzP+D3w== rgba-regex@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/rgba-regex/-/rgba-regex-1.0.0.tgz#43374e2e2ca0968b0ef1523460b7d730ff22eeb3" - integrity sha1-QzdOLiyglosO8VI0YLfXMP8i7rM= + integrity sha512-zgn5OjNQXLUTdq8m17KdaicF6w89TZs8ZU8y0AYENIU6wG8GG6LLm0yLSiPY8DmaYmHdgRW8rnApjoT0fQRfMg== rimraf@^2.5.4, rimraf@^2.6.3: version "2.7.1" @@ -10246,7 +10406,7 @@ run-parallel@^1.1.9: run-queue@^1.0.0, run-queue@^1.0.3: version "1.0.3" resolved "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" - integrity sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec= + integrity sha512-ntymy489o0/QQplUDnpYAYUsO50K9SBrIVaKCWDOJzYJts0f9WH9RFJkyagebkw5+y1oi00R7ynNW/d12GBumg== dependencies: aproba "^1.1.1" @@ -10263,11 +10423,11 @@ safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" - integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= + integrity sha512-aJXcif4xnaNUzvUuC5gcb46oTS7zvg4jpMTnuqtrEPlR3vFr4pxtdTwaF1Qs3Enjn9HK+ZlwQui+a7z0SywIzg== dependencies: ret "~0.1.10" -"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.1.0: +"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.1.0: version "2.1.2" resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -10351,21 +10511,21 @@ schema-utils@^3.0.0, schema-utils@^3.1.1: ajv-keywords "^3.5.2" scroll-into-view-if-needed@^2.2.25: - version "2.2.28" - resolved "https://registry.npmjs.org/scroll-into-view-if-needed/-/scroll-into-view-if-needed-2.2.28.tgz#5a15b2f58a52642c88c8eca584644e01703d645a" - integrity sha512-8LuxJSuFVc92+0AdNv4QOxRL4Abeo1DgLnGNkn1XlaujPH/3cCFz3QI60r2VNu4obJJROzgnIUw5TKQkZvZI1w== + version "2.2.29" + resolved "https://registry.npmjs.org/scroll-into-view-if-needed/-/scroll-into-view-if-needed-2.2.29.tgz#551791a84b7e2287706511f8c68161e4990ab885" + integrity sha512-hxpAR6AN+Gh53AdAimHM6C8oTN1ppwVZITihix+WqalywBeFcQ6LdQP5ABNl26nX8GTEL7VT+b8lKpdqq65wXg== dependencies: compute-scroll-into-view "^1.0.17" select-hose@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" - integrity sha1-Yl2GWPhlr0Psliv8N2o3NZpJlMo= + integrity sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg== selfsigned@^1.10.8: - version "1.10.11" - resolved "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.11.tgz#24929cd906fe0f44b6d01fb23999a739537acbe9" - integrity sha512-aVmbPOfViZqOZPgRBT0+3u4yZFHpmnIghLMlAcb5/xhp5ZtB/RVnKhz5vl2M32CLXAqR4kha9zfhNg0Lf/sxKA== + version "1.10.14" + resolved "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.14.tgz#ee51d84d9dcecc61e07e4aba34f229ab525c1574" + integrity sha512-lkjaiAye+wBZDCBsu5BGi0XiLRxeUlsGod5ZP924CRSEoGuZAw/f7y9RKu28rwTfiHVhdavhB0qH0INV6P1lEA== dependencies: node-forge "^0.10.0" @@ -10390,30 +10550,30 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0: integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== semver@^7.2.1, semver@^7.3.2, semver@^7.3.5: - version "7.3.5" - resolved "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" - integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== + version "7.3.7" + resolved "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz#12c5b649afdbf9049707796e22a4028814ce523f" + integrity sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g== dependencies: lru-cache "^6.0.0" -send@0.17.2: - version "0.17.2" - resolved "https://registry.npmjs.org/send/-/send-0.17.2.tgz#926622f76601c41808012c8bf1688fe3906f7820" - integrity sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww== +send@0.18.0: + version "0.18.0" + resolved "https://registry.npmjs.org/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" + integrity sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg== dependencies: debug "2.6.9" - depd "~1.1.2" - destroy "~1.0.4" + depd "2.0.0" + destroy "1.2.0" encodeurl "~1.0.2" escape-html "~1.0.3" etag "~1.8.1" fresh "0.5.2" - http-errors "1.8.1" + http-errors "2.0.0" mime "1.6.0" ms "2.1.3" - on-finished "~2.3.0" + on-finished "2.4.1" range-parser "~1.2.1" - statuses "~1.5.0" + statuses "2.0.1" serialize-javascript@^4.0.0: version "4.0.0" @@ -10432,7 +10592,7 @@ serialize-javascript@^5.0.1: serve-index@^1.9.1: version "1.9.1" resolved "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239" - integrity sha1-03aNabHn2C5c4FD/9bRTvqEqkjk= + integrity sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw== dependencies: accepts "~1.3.4" batch "0.6.1" @@ -10442,20 +10602,20 @@ serve-index@^1.9.1: mime-types "~2.1.17" parseurl "~1.3.2" -serve-static@1.14.2: - version "1.14.2" - resolved "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz#722d6294b1d62626d41b43a013ece4598d292bfa" - integrity sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ== +serve-static@1.15.0: + version "1.15.0" + resolved "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz#faaef08cffe0a1a62f60cad0c4e513cff0ac9540" + integrity sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g== dependencies: encodeurl "~1.0.2" escape-html "~1.0.3" parseurl "~1.3.3" - send "0.17.2" + send "0.18.0" set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= + integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== set-value@^2.0.0, set-value@^2.0.1: version "2.0.1" @@ -10470,7 +10630,7 @@ set-value@^2.0.0, set-value@^2.0.1: setimmediate@^1.0.4: version "1.0.5" resolved "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" - integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= + integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA== setprototypeof@1.1.0: version "1.1.0" @@ -10505,7 +10665,7 @@ shallowequal@^1.0.2, shallowequal@^1.1.0: shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" - integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= + integrity sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg== dependencies: shebang-regex "^1.0.0" @@ -10519,7 +10679,7 @@ shebang-command@^2.0.0: shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" - integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= + integrity sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ== shebang-regex@^3.0.0: version "3.0.0" @@ -10546,14 +10706,14 @@ side-channel@^1.0.4: object-inspect "^1.9.0" signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3: - version "3.0.6" - resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz#24e630c4b0f03fea446a2bd299e62b4a6ca8d0af" - integrity sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ== + version "3.0.7" + resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== simple-swizzle@^0.2.2: version "0.2.2" resolved "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" - integrity sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo= + integrity sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg== dependencies: is-arrayish "^0.3.1" @@ -10607,16 +10767,15 @@ snapdragon@^0.8.1: use "^3.1.0" sockjs-client@^1.5.0: - version "1.5.2" - resolved "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.5.2.tgz#4bc48c2da9ce4769f19dc723396b50f5c12330a3" - integrity sha512-ZzRxPBISQE7RpzlH4tKJMQbHM9pabHluk0WBaxAQ+wm/UieeBVBou0p4wVnSQGN9QmpAZygQ0cDIypWuqOFmFQ== + version "1.6.1" + resolved "https://registry.npmjs.org/sockjs-client/-/sockjs-client-1.6.1.tgz#350b8eda42d6d52ddc030c39943364c11dcad806" + integrity sha512-2g0tjOR+fRs0amxENLi/q5TiJTqY+WXFOzb5UwXndlK6TO3U/mirZznpx6w34HVMoc3g7cY24yC/ZMIYnDlfkw== dependencies: - debug "^3.2.6" - eventsource "^1.0.7" - faye-websocket "^0.11.3" + debug "^3.2.7" + eventsource "^2.0.2" + faye-websocket "^0.11.4" inherits "^2.0.4" - json3 "^3.3.3" - url-parse "^1.5.3" + url-parse "^1.5.10" sockjs@^0.3.21: version "0.3.24" @@ -10630,7 +10789,7 @@ sockjs@^0.3.21: sort-keys@^1.0.0: version "1.1.2" resolved "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz#441b6d4d346798f1b4e49e8920adfba0e543f9ad" - integrity sha1-RBttTTRnmPG05J6JIK37oOVD+a0= + integrity sha512-vzn8aSqKgytVik0iwdBEi+zevbTYZogewTUM6dtpmGwEcdzbub/TX4bCzRhebDCRC3QzXgJsLRKB2V/Oof7HXg== dependencies: is-plain-obj "^1.0.0" @@ -10639,10 +10798,10 @@ source-list-map@^2.0.0: resolved "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw== -source-map-js@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.1.tgz#a1741c131e3c77d048252adfa24e23b908670caf" - integrity sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA== +source-map-js@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" + integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== source-map-resolve@^0.5.0, source-map-resolve@^0.5.2: version "0.5.3" @@ -10684,14 +10843,14 @@ source-map@0.6.1, source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, sourc source-map@^0.5.0, source-map@^0.5.6: version "0.5.7" resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" - integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= + integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ== -source-map@^0.7.3, source-map@~0.7.2: - version "0.7.3" - resolved "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" - integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== +source-map@^0.7.3: + version "0.7.4" + resolved "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" + integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== -sourcemap-codec@^1.4.4: +sourcemap-codec@^1.4.8: version "1.4.8" resolved "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== @@ -10755,7 +10914,7 @@ split-string@^3.0.1, split-string@^3.0.2: sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== ssri@^6.0.1: version "6.0.2" @@ -10783,23 +10942,28 @@ stack-utils@^2.0.2: dependencies: escape-string-regexp "^2.0.0" -stackframe@^1.1.1: - version "1.2.0" - resolved "https://registry.npmjs.org/stackframe/-/stackframe-1.2.0.tgz#52429492d63c62eb989804c11552e3d22e779303" - integrity sha512-GrdeshiRmS1YLMYgzF16olf2jJ/IzxXY9lhKOskuVziubpTYcYqyOwYeJKzQkwy7uN0fYSsbsC4RQaXf9LCrYA== +stackframe@^1.3.4: + version "1.3.4" + resolved "https://registry.npmjs.org/stackframe/-/stackframe-1.3.4.tgz#b881a004c8c149a5e8efef37d51b16e412943310" + integrity sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw== static-extend@^0.1.1: version "0.1.2" resolved "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" - integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= + integrity sha512-72E9+uLc27Mt718pMHt9VMNiAL4LMsmDbBva8mxWUCkT07fSzEGMYUCk0XWY6lp0j6RBAG4cJ3mWuZv2OE3s0g== dependencies: define-property "^0.2.5" object-copy "^0.1.0" -"statuses@>= 1.4.0 < 2", "statuses@>= 1.5.0 < 2", statuses@~1.5.0: +statuses@2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" + integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== + +"statuses@>= 1.4.0 < 2": version "1.5.0" resolved "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" - integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow= + integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== stream-browserify@^2.0.1: version "2.0.2" @@ -10836,12 +11000,12 @@ stream-shift@^1.0.0: strict-uri-encode@^1.0.0: version "1.1.0" resolved "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" - integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= + integrity sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ== string-convert@^0.2.0: version "0.2.1" resolved "https://registry.npmjs.org/string-convert/-/string-convert-0.2.1.tgz#6982cc3049fbb4cd85f8b24568b9d9bf39eeff97" - integrity sha1-aYLMMEn7tM2F+LJFaLnZvznu/5c= + integrity sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A== string-length@^4.0.1: version "4.0.2" @@ -10874,35 +11038,37 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string.prototype.matchall@^4.0.6: - version "4.0.6" - resolved "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.6.tgz#5abb5dabc94c7b0ea2380f65ba610b3a544b15fa" - integrity sha512-6WgDX8HmQqvEd7J+G6VtAahhsQIssiZ8zl7zKh1VDMFyL3hRTJP4FTNA3RbIp2TOQ9AYNDcc7e3fH0Qbup+DBg== +string.prototype.matchall@^4.0.7: + version "4.0.7" + resolved "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.7.tgz#8e6ecb0d8a1fb1fda470d81acecb2dba057a481d" + integrity sha512-f48okCX7JiwVi1NXCVWcFnZgADDC/n2vePlQ/KUCNqCikLLilQvwjMO8+BHVKvgzH0JB0J9LEPgxOGT02RoETg== dependencies: call-bind "^1.0.2" define-properties "^1.1.3" es-abstract "^1.19.1" get-intrinsic "^1.1.1" - has-symbols "^1.0.2" + has-symbols "^1.0.3" internal-slot "^1.0.3" - regexp.prototype.flags "^1.3.1" + regexp.prototype.flags "^1.4.1" side-channel "^1.0.4" -string.prototype.trimend@^1.0.4: - version "1.0.4" - resolved "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80" - integrity sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A== +string.prototype.trimend@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz#914a65baaab25fbdd4ee291ca7dde57e869cb8d0" + integrity sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" + define-properties "^1.1.4" + es-abstract "^1.19.5" -string.prototype.trimstart@^1.0.4: - version "1.0.4" - resolved "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz#b36399af4ab2999b4c9c648bd7a3fb2bb26feeed" - integrity sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw== +string.prototype.trimstart@^1.0.5: + version "1.0.5" + resolved "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz#5466d93ba58cfa2134839f81d7f42437e8c01fef" + integrity sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" + define-properties "^1.1.4" + es-abstract "^1.19.5" string_decoder@^1.0.0, string_decoder@^1.1.1: version "1.3.0" @@ -10937,7 +11103,7 @@ strip-ansi@6.0.0: strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + integrity sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg== dependencies: ansi-regex "^2.0.0" @@ -10958,7 +11124,7 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" - integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= + integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== strip-bom@^4.0.0: version "4.0.0" @@ -10976,7 +11142,7 @@ strip-comments@^1.0.2: strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" - integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= + integrity sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q== strip-final-newline@^2.0.0: version "2.0.0" @@ -11004,13 +11170,13 @@ style-loader@1.3.0: schema-utils "^2.7.0" styled-components@~5.3.0: - version "5.3.3" - resolved "https://registry.npmjs.org/styled-components/-/styled-components-5.3.3.tgz#312a3d9a549f4708f0fb0edc829eb34bde032743" - integrity sha512-++4iHwBM7ZN+x6DtPPWkCI4vdtwumQ+inA/DdAsqYd4SVgUKJie5vXyzotA00ttcFdQkCng7zc6grwlfIfw+lw== + version "5.3.5" + resolved "https://registry.npmjs.org/styled-components/-/styled-components-5.3.5.tgz#a750a398d01f1ca73af16a241dec3da6deae5ec4" + integrity sha512-ndETJ9RKaaL6q41B69WudeqLzOpY1A/ET/glXkNZ2T7dPjPqpPCXXQjDFYZWwNnE5co0wX+gTCqx9mfxTmSIPg== dependencies: "@babel/helper-module-imports" "^7.0.0" "@babel/traverse" "^7.4.5" - "@emotion/is-prop-valid" "^0.8.8" + "@emotion/is-prop-valid" "^1.1.0" "@emotion/stylis" "^0.8.4" "@emotion/unitless" "^0.7.4" babel-plugin-styled-components ">= 1.12.0" @@ -11064,6 +11230,11 @@ supports-hyperlinks@^2.0.0: has-flag "^4.0.0" supports-color "^7.0.0" +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + svg-parser@^2.0.2: version "2.0.4" resolved "https://registry.npmjs.org/svg-parser/-/svg-parser-2.0.4.tgz#fdc2e29e13951736140b76cb122c8ee6630eb6b5" @@ -11094,9 +11265,9 @@ symbol-tree@^3.2.4: integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== table@^6.0.9: - version "6.7.5" - resolved "https://registry.npmjs.org/table/-/table-6.7.5.tgz#f04478c351ef3d8c7904f0e8be90a1b62417d238" - integrity sha512-LFNeryOqiQHqCVKzhkymKwt6ozeRhlm8IL1mE8rNUurkir4heF6PzMyRgaTa4tlyPTGGgXuvVOF/OLWiH09Lqw== + version "6.8.0" + resolved "https://registry.npmjs.org/table/-/table-6.8.0.tgz#87e28f14fa4321c3377ba286f07b79b281a3b3ca" + integrity sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA== dependencies: ajv "^8.0.1" lodash.truncate "^4.4.2" @@ -11124,7 +11295,7 @@ tar@^6.0.2: temp-dir@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz#0a7c0ea26d3a39afa7e0ebea9c1fc0bc4daa011d" - integrity sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0= + integrity sha512-xZFXEGbG7SNC3itwBzI3RYjq/cEhBkx2hJuKGIUOcEULmkQExXiHat2z/qkISYsuR+IKumhEfKKbV5qXmhICFQ== tempy@^0.3.0: version "0.3.0" @@ -11183,12 +11354,13 @@ terser@^4.1.2, terser@^4.6.2, terser@^4.6.3: source-map-support "~0.5.12" terser@^5.3.4: - version "5.10.0" - resolved "https://registry.npmjs.org/terser/-/terser-5.10.0.tgz#b86390809c0389105eb0a0b62397563096ddafcc" - integrity sha512-AMmF99DMfEDiRJfxfY5jj5wNH/bYO09cniSqhfoyxc8sFoYIgkJy86G04UoZU5VjlpnplVu0K6Tx6E9b5+DlHA== + version "5.14.1" + resolved "https://registry.npmjs.org/terser/-/terser-5.14.1.tgz#7c95eec36436cb11cf1902cc79ac564741d19eca" + integrity sha512-+ahUAE+iheqBTDxXhTisdA8hgvbEG1hHOQ9xmNjeUJSoi6DU/gMrKNcfZjHkyY6Alnuyc+ikYJaxxfHkT3+WuQ== dependencies: + "@jridgewell/source-map" "^0.3.2" + acorn "^8.5.0" commander "^2.20.0" - source-map "~0.7.2" source-map-support "~0.5.20" test-exclude@^6.0.0: @@ -11203,7 +11375,7 @@ test-exclude@^6.0.0: text-table@0.2.0, text-table@^0.2.0: version "0.2.0" resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" - integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== throat@^5.0.0: version "5.0.0" @@ -11233,7 +11405,7 @@ timers-browserify@^2.0.4: timsort@^0.3.0: version "0.3.0" resolved "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" - integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q= + integrity sha512-qsdtZH+vMoCARQtyod4imc2nIJwg9Cc7lPRrw9CzF8ZKR0khdr8+2nX80PBhET3tcyTtJDxAffGh2rXH4tyU8A== tiny-invariant@^1.0.2: version "1.2.0" @@ -11253,24 +11425,24 @@ tmpl@1.0.5: to-arraybuffer@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" - integrity sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M= + integrity sha512-okFlQcoGTi4LQBG/PgSYblw9VOyptsz2KJZqc6qtgGdes8VktzUQkj4BI2blit072iS8VODNcMA+tvnS9dnuMA== to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= + integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== to-object-path@^0.3.0: version "0.3.0" resolved "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" - integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= + integrity sha512-9mWHdnGRuh3onocaHzukyvCZhzvr6tiflAy/JRFXcJX0TjgfWA9pk9t8CMbzmBE4Jfw58pXbkngtBtqYxzNEyg== dependencies: kind-of "^3.0.2" to-regex-range@^2.1.0: version "2.1.1" resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" - integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= + integrity sha512-ZZWNfCjUokXXDGXFpZehJIkZqq91BcULFq/Pi7M5i4JnxXdhMKAK682z8bCW3o8Hj1wuuzoKcW3DfVzaP6VuNg== dependencies: is-number "^3.0.0" repeat-string "^1.6.1" @@ -11295,7 +11467,7 @@ to-regex@^3.0.1, to-regex@^3.0.2: toggle-selection@^1.0.6: version "1.0.6" resolved "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32" - integrity sha1-bkWxJj8gF/oKzH2J14sVuL932jI= + integrity sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ== toidentifier@1.0.1: version "1.0.1" @@ -11328,14 +11500,14 @@ ts-pnp@1.2.0, ts-pnp@^1.1.6: resolved "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92" integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw== -tsconfig-paths@^3.11.0: - version "3.12.0" - resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.12.0.tgz#19769aca6ee8f6a1a341e38c8fa45dd9fb18899b" - integrity sha512-e5adrnOYT6zqVnWqZu7i/BQ3BnhzvGbjEjejFXO20lKIKpwTaupkCPgEfv4GZK1IBciJUEhYs3J3p75FdaTFVg== +tsconfig-paths@^3.14.1: + version "3.14.1" + resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz#ba0734599e8ea36c862798e920bcf163277b137a" + integrity sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ== dependencies: "@types/json5" "^0.0.29" json5 "^1.0.1" - minimist "^1.2.0" + minimist "^1.2.6" strip-bom "^3.0.0" tslib@^1.8.1: @@ -11344,9 +11516,9 @@ tslib@^1.8.1: integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== tslib@^2.0.3, tslib@^2.3.0: - version "2.3.1" - resolved "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" - integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== + version "2.4.0" + resolved "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== tsutils@^3.17.1, tsutils@^3.21.0: version "3.21.0" @@ -11358,7 +11530,7 @@ tsutils@^3.17.1, tsutils@^3.21.0: tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" - integrity sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY= + integrity sha512-JVa5ijo+j/sOoHGjw0sxw734b1LhBkQ3bvUGNdxnVXDCX81Yx7TFgnZygxrIIWn23hbfTaMYLwRmAxFyDuFmIw== type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" @@ -11370,7 +11542,7 @@ type-check@^0.4.0, type-check@~0.4.0: type-check@~0.3.2: version "0.3.2" resolved "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= + integrity sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg== dependencies: prelude-ls "~1.1.2" @@ -11418,9 +11590,9 @@ type@^1.0.1: integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== type@^2.5.0: - version "2.5.0" - resolved "https://registry.npmjs.org/type/-/type-2.5.0.tgz#0a2e78c2e77907b252abe5f298c1b01c63f0db3d" - integrity sha512-180WMDQaIMm3+7hGXWf12GtdniDEy7nYcyFMKJn/eZz/6tSLXrUN9V0wKSbMjej0I1WHWbpREDEKHtqPQa9NNw== + version "2.6.0" + resolved "https://registry.npmjs.org/type/-/type-2.6.0.tgz#3ca6099af5981d36ca86b78442973694278a219f" + integrity sha512-eiDBDOmkih5pMbo9OqsqPRGMljLodLcwd5XD5JbtNB0o89xZAwynY9EdCDsJU7LtcVCClu9DvM7/0Ep1hYX3EQ== typedarray-to-buffer@^3.1.5: version "3.1.5" @@ -11432,16 +11604,16 @@ typedarray-to-buffer@^3.1.5: typedarray@^0.0.6: version "0.0.6" resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= + integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== -unbox-primitive@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471" - integrity sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw== +unbox-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" + integrity sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw== dependencies: - function-bind "^1.1.1" - has-bigints "^1.0.1" - has-symbols "^1.0.2" + call-bind "^1.0.2" + has-bigints "^1.0.2" + has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" unicode-canonical-property-names-ecmascript@^2.0.0: @@ -11480,12 +11652,12 @@ union-value@^1.0.0: uniq@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" - integrity sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8= + integrity sha512-Gw+zz50YNKPDKXs+9d+aKAjVwpjNwqzvNpLigIruT4HA9lMZNdMqs9x07kKHB/L9WRzqp4+DlTU5s4wG2esdoA== uniqs@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/uniqs/-/uniqs-2.0.0.tgz#ffede4b36b25290696e6e165d4a59edb998e6b02" - integrity sha1-/+3ks2slKQaW5uFl1KWe25mOawI= + integrity sha512-mZdDpf3vBV5Efh29kMw5tXoup/buMgxLzOt/XKFKcVmi+15ManNQWr6HfZ2aiZTYlYixbdNJ0KFmIZIv52tHSQ== unique-filename@^1.1.1: version "1.1.1" @@ -11504,7 +11676,7 @@ unique-slug@^2.0.0: unique-string@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz#9e1057cca851abb93398f8b33ae187b99caec11a" - integrity sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo= + integrity sha512-ODgiYu03y5g76A1I9Gt0/chLCzQjvzDy7DsZGsLOE/1MrF6wriEskSncj1+/C58Xk/kPZDppSctDybCwOSaGAg== dependencies: crypto-random-string "^1.0.0" @@ -11521,17 +11693,17 @@ universalify@^2.0.0: unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" - integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= + integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== unquote@~1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz#8fded7324ec6e88a0ff8b905e7c098cdc086d544" - integrity sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ= + integrity sha512-vRCqFv6UhXpWxZPyGDh/F3ZpNv8/qo7w6iufLpQg9aKnQ71qM4B5KiI7Mia9COcjEhrO9LueHpMYjYzsWH3OIg== unset-value@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" - integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= + integrity sha512-PcA2tsuGSF9cnySLHTLSh2qrQiJ70mn+r+Glzxv2TWZblxsxCC52BDlZoPCsz7STd9pN7EZetkWZBAvk4cgZdQ== dependencies: has-value "^0.3.1" isobject "^3.0.0" @@ -11541,6 +11713,14 @@ upath@^1.1.1, upath@^1.1.2, upath@^1.2.0: resolved "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== +update-browserslist-db@^1.0.4: + version "1.0.4" + resolved "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.4.tgz#dbfc5a789caa26b1db8990796c2c8ebbce304824" + integrity sha512-jnmO2BEGUjsMOe/Fg9u0oczOe/ppIDZPebzccl1yDWGLFP16Pa1/RM5wEoKYPG2zstNcDuAStejyxsOuKINdGA== + dependencies: + escalade "^3.1.1" + picocolors "^1.0.0" + uri-js@^4.2.2: version "4.4.1" resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" @@ -11551,7 +11731,7 @@ uri-js@^4.2.2: urix@^0.1.0: version "0.1.0" resolved "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" - integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= + integrity sha512-Am1ousAhSLBeB9cG/7k7r2R0zj50uDRlZHPGbazid5s9rlF1F/QKYObEKSIunSjIOkJZqwRRLpvewjEkM7pSqg== url-loader@4.1.1: version "4.1.1" @@ -11562,10 +11742,10 @@ url-loader@4.1.1: mime-types "^2.1.27" schema-utils "^3.0.0" -url-parse@^1.4.3, url-parse@^1.5.3: - version "1.5.4" - resolved "https://registry.npmjs.org/url-parse/-/url-parse-1.5.4.tgz#e4f645a7e2a0852cc8a66b14b292a3e9a11a97fd" - integrity sha512-ITeAByWWoqutFClc/lRZnFplgXgEZr3WJ6XngMM/N9DMIm4K8zXPCZ1Jdu0rERwO84w1WC5wkle2ubwTA4NTBg== +url-parse@^1.5.10: + version "1.5.10" + resolved "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" + integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== dependencies: querystringify "^2.1.1" requires-port "^1.0.0" @@ -11573,7 +11753,7 @@ url-parse@^1.4.3, url-parse@^1.5.3: url@^0.11.0: version "0.11.0" resolved "https://registry.npmjs.org/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" - integrity sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= + integrity sha512-kbailJa29QrtXnxgq+DdCEGlbTeYM2eJUxsz6vjZavrCYPMIFHMKQmSKYAIuUK2i7hgPm28a8piX5NTUtM/LKQ== dependencies: punycode "1.3.2" querystring "0.2.0" @@ -11586,7 +11766,7 @@ use@^3.1.0: util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== util.promisify@1.0.0: version "1.0.0" @@ -11609,7 +11789,7 @@ util.promisify@~1.0.0: util@0.10.3: version "0.10.3" resolved "https://registry.npmjs.org/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" - integrity sha1-evsa/lCAUkZInj23/g7TeTNqwPk= + integrity sha512-5KiHfsmkqacuKjkRkdV7SsfDJ2EGiPsK92s2MhNSY0craxjTdKTtqKsJaCWp4LW33ZZ0OPUv1WO/TFvNQRiQxQ== dependencies: inherits "2.0.1" @@ -11623,12 +11803,12 @@ util@^0.11.0: utila@~0.4: version "0.4.0" resolved "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz#8a16a05d445657a3aea5eecc5b12a4fa5379772c" - integrity sha1-ihagXURWV6Oupe7MWxKk+lN5dyw= + integrity sha512-Z0DbgELS9/L/75wZbro8xAnT50pBVFQZ+hUEueGDU5FN51YSCYM+jdxsfCiHjwNP/4LCDD0i/graKpeBnOXKRA== utils-merge@1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" - integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= + integrity sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA== uuid@^3.3.2: version "3.4.0" @@ -11670,7 +11850,7 @@ value-equal@^1.0.1: vary@~1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw= + integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== vendors@^1.0.0: version "1.0.4" @@ -11937,7 +12117,7 @@ which-boxed-primitive@^1.0.2: which-module@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" - integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= + integrity sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q== which@^1.2.9, which@^1.3.1: version "1.3.1" @@ -12151,7 +12331,7 @@ wrap-ansi@^6.2.0: wrappy@1: version "1.0.2" resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== write-file-atomic@^3.0.0: version "3.0.3" @@ -12171,9 +12351,9 @@ ws@^6.2.1: async-limiter "~1.0.0" ws@^7.4.6: - version "7.5.6" - resolved "https://registry.npmjs.org/ws/-/ws-7.5.6.tgz#e59fc509fb15ddfb65487ee9765c5a51dec5fe7b" - integrity sha512-6GLgCqo2cy2A2rjCNFlxQS6ZljG/coZfZXclldI8FB/1G3CCI36Zd8xy2HrFVACi8tfk5XrgLQEk+P0Tnz9UcA== + version "7.5.8" + resolved "https://registry.npmjs.org/ws/-/ws-7.5.8.tgz#ac2729881ab9e7cbaf8787fe3469a48c5c7f636a" + integrity sha512-ri1Id1WinAX5Jqn9HejiGb8crfRio0Qgu8+MtL36rlTA6RLsMdWt1Az/19A2Qij6uSHUMphEFaTKa4WG+UNHNw== xml-name-validator@^3.0.0: version "3.0.0" diff --git a/dev/main-vue2/vue.config.js b/dev/main-vue2/vue.config.js index 507cd9b4c..c87404f61 100644 --- a/dev/main-vue2/vue.config.js +++ b/dev/main-vue2/vue.config.js @@ -2,7 +2,7 @@ const path = require('path'); module.exports = { devServer: { - hot: false, + hot: true, disableHostCheck: true, port: 4000, open: true, diff --git a/src/__tests__/create_app.test.ts b/src/__tests__/create_app.test.ts index 50435c4ce..5c537ea14 100644 --- a/src/__tests__/create_app.test.ts +++ b/src/__tests__/create_app.test.ts @@ -1,7 +1,7 @@ /* eslint-disable promise/param-names */ import { commonStartEffect, releaseAllEffect, ports } from './common/initial' import { appInstanceMap } from '../create_app' -import { appStates, keepAliveStates } from '../constants' +import { appStates, keepAliveStates } from '../libs/constants' import microApp, { unmountApp, unmountAllApps, getActiveApps } from '..' describe('create_app', () => { @@ -30,7 +30,7 @@ describe('create_app', () => { createCount++ expect(appInstanceMap.size).toBe(1) if (createCount === 1) { - expect(appInstanceMap.get('test-app1')!.getAppState()).toBe(appStates.LOADING_SOURCE_CODE) + expect(appInstanceMap.get('test-app1')!.getAppState()).toBe(appStates.LOADING) } else { // 二次渲染时会异步执行mount,所以此时仍然是UNMOUNT expect(appInstanceMap.get('test-app1')!.getAppState()).toBe(appStates.UNMOUNT) diff --git a/src/create_app.ts b/src/create_app.ts index 992dae70b..6edd44bd2 100644 --- a/src/create_app.ts +++ b/src/create_app.ts @@ -8,7 +8,7 @@ import type { } from '@micro-app/types' import extractHtml from './source' import { execScripts } from './source/scripts' -import { appStates, lifeCycles, keepAliveStates } from './constants' +import { appStates, lifeCycles, keepAliveStates } from './libs/constants' import SandBox from './sandbox' import { isFunction, @@ -42,7 +42,7 @@ export interface CreateAppParam { } export default class CreateApp implements AppInterface { - private state: string = appStates.NOT_LOADED + private state: string = appStates.CREATED private keepAliveState: string | null = null private keepAliveContainer: HTMLElement | null = null private loadSourceLevel: -1|0|1|2 = 0 @@ -102,7 +102,7 @@ export default class CreateApp implements AppInterface { // Load resources loadSourceCode (): void { - this.state = appStates.LOADING_SOURCE_CODE + this.state = appStates.LOADING extractHtml(this) } @@ -117,7 +117,7 @@ export default class CreateApp implements AppInterface { this.prefetchResolve?.() this.prefetchResolve = null } else if (appStates.UNMOUNT !== this.state) { - this.state = appStates.LOAD_SOURCE_FINISHED + this.state = appStates.LOADED this.mount() } } @@ -136,7 +136,7 @@ export default class CreateApp implements AppInterface { if (appStates.UNMOUNT !== this.state) { this.onerror(e) - this.state = appStates.LOAD_SOURCE_ERROR + this.state = appStates.LOAD_FAILED } } @@ -162,7 +162,7 @@ export default class CreateApp implements AppInterface { this.defaultPage = defaultPage ?? this.defaultPage if (this.loadSourceLevel !== 2) { - this.state = appStates.LOADING_SOURCE_CODE + this.state = appStates.LOADING return } @@ -251,7 +251,7 @@ export default class CreateApp implements AppInterface { * @param unmountcb callback of unmount */ unmount (destroy: boolean, unmountcb?: CallableFunction): void { - if (this.state === appStates.LOAD_SOURCE_ERROR) { + if (this.state === appStates.LOAD_FAILED) { destroy = true } diff --git a/src/constants.ts b/src/libs/constants.ts similarity index 67% rename from src/constants.ts rename to src/libs/constants.ts index d748c24e2..1619e34df 100644 --- a/src/constants.ts +++ b/src/libs/constants.ts @@ -5,13 +5,13 @@ export enum ObservedAttrName { // app status export enum appStates { - NOT_LOADED = 'NOT_LOADED', - LOADING_SOURCE_CODE = 'LOADING_SOURCE_CODE', - LOAD_SOURCE_FINISHED = 'LOAD_SOURCE_FINISHED', - LOAD_SOURCE_ERROR = 'LOAD_SOURCE_ERROR', - MOUNTING = 'MOUNTING', - MOUNTED = 'MOUNTED', - UNMOUNT = 'UNMOUNT', + CREATED = 'created', + LOADING = 'loading', + LOADED = 'loaded', + LOAD_FAILED = 'load_failed', + MOUNTING = 'mounting', + MOUNTED = 'mounted', + UNMOUNT = 'unmount', } // lifecycles @@ -29,8 +29,8 @@ export enum lifeCycles { // keep-alive status export enum keepAliveStates { - KEEP_ALIVE_SHOW = 'KEEP_ALIVE_SHOW', - KEEP_ALIVE_HIDDEN = 'KEEP_ALIVE_HIDDEN', + KEEP_ALIVE_SHOW = 'keep_alive_show', + KEEP_ALIVE_HIDDEN = 'keep_alive_hidden', } -export const globalKeyToBeCached = 'window,self,globalThis,Array,Object,String,Boolean,Math,Number,Symbol,Date,Promise,Function,Proxy,WeakMap,WeakSet,Set,Map,Reflect,Element,Node,Document,RegExp,Error,TypeError,JSON,isNaN,parseFloat,parseInt,performance,console,decodeURI,encodeURI,decodeURIComponent,encodeURIComponent,navigator,undefined,location,history' +export const globalKeyToBeCached = 'window,self,globalThis,Array,Object,String,Boolean,Math,Number,Symbol,Date,Promise,Function,Proxy,WeakMap,WeakSet,Set,Map,Reflect,Element,Node,Document,RegExp,Error,TypeError,JSON,isNaN,parseFloat,parseInt,performance,console,decodeURI,encodeURI,decodeURIComponent,encodeURIComponent,navigator,undefined,location,history,EventSource,fetch,XMLHttpRequest' diff --git a/src/micro_app.ts b/src/micro_app.ts index df510af54..43d20a024 100644 --- a/src/micro_app.ts +++ b/src/micro_app.ts @@ -21,7 +21,7 @@ import { import { EventCenterForBaseApp } from './interact' import { initGlobalEnv } from './libs/global_env' import { appInstanceMap } from './create_app' -import { appStates, keepAliveStates } from './constants' +import { appStates, keepAliveStates } from './libs/constants' import { router } from './sandbox' /** diff --git a/src/micro_app_element.ts b/src/micro_app_element.ts index c9ff23216..77a48c340 100644 --- a/src/micro_app_element.ts +++ b/src/micro_app_element.ts @@ -16,7 +16,7 @@ import { appStates, lifeCycles, keepAliveStates, -} from './constants' +} from './libs/constants' import CreateApp, { appInstanceMap } from './create_app' import { patchSetAttribute } from './source/patch' import microApp from './micro_app' @@ -296,7 +296,7 @@ export function defineElement (tagName: string): void { // create app instance private handleCreateApp (): void { /** - * actions for destory old app + * actions for destroy old app * fix of unmounted umd app with disableSandbox */ if (appInstanceMap.has(this.appName)) { @@ -324,7 +324,7 @@ export function defineElement (tagName: string): void { * unmount app * @param destroy delete cache resources when unmount */ - private handleUnmount (destroy: boolean, unmountcb?: CallableFunction): void { + private handleUnmount (destroy: boolean, unmountCb?: CallableFunction): void { const app = appInstanceMap.get(this.appName) if ( app && @@ -332,7 +332,7 @@ export function defineElement (tagName: string): void { ) { app.unmount( destroy, - unmountcb, + unmountCb, ) } } diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 6e12012bb..175dfdd79 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -67,6 +67,7 @@ export type proxyWindow = WindowProxy & MicroAppWindowDataType // Variables that can escape to rawWindow const staticEscapeProperties: PropertyKey[] = [ + '__REACT_ERROR_OVERLAY_GLOBAL_HOOK__', // child react in non-react parent 'System', '__cjsWrapper', ] @@ -347,7 +348,7 @@ export default class SandBox implements SandBoxInterface { microAppWindow.rawDocument = globalEnv.rawDocument microAppWindow.hasOwnProperty = (key: PropertyKey) => rawHasOwnProperty.call(microAppWindow, key) || rawHasOwnProperty.call(globalEnv.rawWindow, key) this.setMappingPropertiesWithRawDescriptor(microAppWindow) - this.setHijackProperties(microAppWindow, appName) + this.setHijackProperties(microAppWindow, appName, url) if (useMemoryRouter) this.setRouterApi(microAppWindow, appName, url) } @@ -396,8 +397,30 @@ export default class SandBox implements SandBoxInterface { } // set hijack Properties to microAppWindow - private setHijackProperties (microAppWindow: microAppWindowType, appName: string): void { + private setHijackProperties (microAppWindow: microAppWindowType, appName: string, url: string): void { let modifiedEval: unknown, modifiedImage: unknown + function EventSource (...rests: any[]) { + // console.log('EventSource', rests) + if (typeof rests[0] === 'string') { + rests[0] = (new URL(rests[0], url)).toString() + } + return new globalEnv.rawWindow.EventSource(rests) + } + function fetch (...rests: any[]) { + // console.log('fetch', rests) + if (typeof rests[0] === 'string') { + rests[0] = (new URL(rests[0], url)).toString() + } + return globalEnv.rawWindow.fetch(rests) + } + const rawXMLHttpRequest = globalEnv.rawWindow.XMLHttpRequest + class XMLHttpRequest extends rawXMLHttpRequest { + open (method: string, reqUrl: string) { + // console.log('XMLHttpRequest', method, reqUrl) + reqUrl = (new URL(reqUrl, url)).toString() + super.open(method, reqUrl) + } + } rawDefineProperties(microAppWindow, { document: { configurable: false, @@ -429,6 +452,36 @@ export default class SandBox implements SandBoxInterface { modifiedImage = value }, }, + EventSource: { + configurable: true, + enumerable: false, + get () { + return EventSource + }, + set: (value) => { + modifiedImage = value + }, + }, + fetch: { + configurable: true, + enumerable: false, + get () { + return fetch + }, + set: (value) => { + modifiedImage = value + }, + }, + XMLHttpRequest: { + configurable: true, + enumerable: false, + get () { + return XMLHttpRequest + }, + set: (value) => { + modifiedImage = value + }, + }, }) } diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index 4da11a015..9afd8aca4 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -34,7 +34,7 @@ import { navigateWithNativeEvent } from './history' export interface RouterApi { router: Router, executeNavigationGuard: (appName: string, to: GuardLocation, from: GuardLocation) => void - clearCurrentWhenUnmount: (appName: string) => void + clearRouterWhenUnmount: (appName: string) => void } function createRouterApi (): RouterApi { @@ -170,7 +170,7 @@ function createRouterApi (): RouterApi { }) } - function clearCurrentWhenUnmount (appName: string): void { + function clearRouterWhenUnmount (appName: string): void { router.current.delete(appName) } @@ -218,12 +218,12 @@ function createRouterApi (): RouterApi { return { router, executeNavigationGuard, - clearCurrentWhenUnmount, + clearRouterWhenUnmount, } } export const { router, executeNavigationGuard, - clearCurrentWhenUnmount, + clearRouterWhenUnmount, } = createRouterApi() diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index 061b9b95e..a2d37f059 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -21,7 +21,7 @@ import { rewriteHistoryState, } from './history' import { createURL } from '../../libs/utils' -import { clearCurrentWhenUnmount } from './api' +import { clearRouterWhenUnmount } from './api' export { router } from './api' export { addHistoryListener } from './event' export { getNoHashMicroPathFromURL } from './core' @@ -98,7 +98,7 @@ export function clearRouteStateFromURL ( updateMicroLocation(appName, pathname + search + hash, microLocation, 'prevent') } removeStateAndPathFromBrowser(appName) - clearCurrentWhenUnmount(appName) + clearRouterWhenUnmount(appName) } /** diff --git a/src/source/scripts.ts b/src/source/scripts.ts index b79afeb83..2fc9380aa 100644 --- a/src/source/scripts.ts +++ b/src/source/scripts.ts @@ -24,7 +24,7 @@ import { } from './load_event' import microApp from '../micro_app' import globalEnv from '../libs/global_env' -import { globalKeyToBeCached } from '../constants' +import { globalKeyToBeCached } from '../libs/constants' type moduleCallBack = Func & { moduleCount?: number, errorCount?: number } From 0a47d8dddd1affc5fdd477697185214e5fc60b93 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Thu, 30 Jun 2022 16:12:15 +0800 Subject: [PATCH 038/268] style: remove test code --- dev/children/react17/src/App.js | 2 +- docs/zh-cn/scopecss.md | 18 ++--- src/sandbox/index.ts | 117 +++++++++++++++++--------------- 3 files changed, 72 insertions(+), 65 deletions(-) diff --git a/dev/children/react17/src/App.js b/dev/children/react17/src/App.js index 07411bfc2..782e5de52 100644 --- a/dev/children/react17/src/App.js +++ b/dev/children/react17/src/App.js @@ -4,7 +4,7 @@ import './App.css'; function App() { const testClick = () => { - console.log(444444444) + console.log('react17: test click') } return (
diff --git a/docs/zh-cn/scopecss.md b/docs/zh-cn/scopecss.md index 28499970a..497bed9d4 100644 --- a/docs/zh-cn/scopecss.md +++ b/docs/zh-cn/scopecss.md @@ -45,16 +45,16 @@ microApp.start({ #### 3、在某一个文件中禁用 可以在你的css文件中使用以下格式的注释来禁用样式隔离: ```css -/* ! scopecss-disable */ +/*! scopecss-disable */ .test1 { color: red; } -/* ! scopecss-enable */ +/*! scopecss-enable */ ``` 你也可以对指定的选择器禁用样式隔离: ```css -/* ! scopecss-disable .test1, .test2 */ +/*! scopecss-disable .test1, .test2 */ .test1 { color: red; } @@ -64,31 +64,31 @@ microApp.start({ .test3 { color: green; } -/* ! scopecss-enable */ +/*! scopecss-enable */ ``` -如果想在整个文件范围内禁用样式隔离,将 `/* ! scopecss-disable */` 注释放在文件顶部: +如果想在整个文件范围内禁用样式隔离,将 `/*! scopecss-disable */` 注释放在文件顶部: ```css -/* ! scopecss-disable */ +/*! scopecss-disable */ ... ``` #### 4、在某一行中禁用 在文件中使用以下格式的注释在某一特定的行上禁用样式隔离: ```css -/* ! scopecss-disable-next-line */ +/*! scopecss-disable-next-line */ .test1 { color: red; } .test2 { - /* ! scopecss-disable-next-line */ + /*! scopecss-disable-next-line */ background: url(/test.png); } ``` > [!NOTE] -> 上述注释规则中都以叹号开头(/* ! */),这是因为在build时大部分项目会将css中的注释删除以压缩体积,叹号开头是[cssnano](https://cssnano.co/)的一种规则,可以防止在build后注释被删除[discardcomments](https://cssnano.co/docs/optimisations/discardcomments/)。 +> 上述注释规则都以叹号开头(d/*! */),这是因为在build时大部分项目会将css中的注释删除以压缩体积,叹号开头是[cssnano](https://cssnano.co/)的一种规则,可以防止在build时注释被删除[discardcomments](https://cssnano.co/docs/optimisations/discardcomments/)。 > > 我们以cssnano为例,是因为它是PostCSS中使用最广泛的压缩插件,如果你使用了另外的压缩工具,请根据实际情况调整,防止build后的注释被删除。 diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 175dfdd79..70ecf8cb4 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -67,7 +67,7 @@ export type proxyWindow = WindowProxy & MicroAppWindowDataType // Variables that can escape to rawWindow const staticEscapeProperties: PropertyKey[] = [ - '__REACT_ERROR_OVERLAY_GLOBAL_HOOK__', // child react in non-react parent + '__REACT_ERROR_OVERLAY_GLOBAL_HOOK__', // react child in non-react env 'System', '__cjsWrapper', ] @@ -348,7 +348,8 @@ export default class SandBox implements SandBoxInterface { microAppWindow.rawDocument = globalEnv.rawDocument microAppWindow.hasOwnProperty = (key: PropertyKey) => rawHasOwnProperty.call(microAppWindow, key) || rawHasOwnProperty.call(globalEnv.rawWindow, key) this.setMappingPropertiesWithRawDescriptor(microAppWindow) - this.setHijackProperties(microAppWindow, appName, url) + this.setHijackProperties(microAppWindow, appName) + // this.patchHijackRequest(microAppWindow, appName, url) if (useMemoryRouter) this.setRouterApi(microAppWindow, appName, url) } @@ -397,30 +398,8 @@ export default class SandBox implements SandBoxInterface { } // set hijack Properties to microAppWindow - private setHijackProperties (microAppWindow: microAppWindowType, appName: string, url: string): void { + private setHijackProperties (microAppWindow: microAppWindowType, appName: string): void { let modifiedEval: unknown, modifiedImage: unknown - function EventSource (...rests: any[]) { - // console.log('EventSource', rests) - if (typeof rests[0] === 'string') { - rests[0] = (new URL(rests[0], url)).toString() - } - return new globalEnv.rawWindow.EventSource(rests) - } - function fetch (...rests: any[]) { - // console.log('fetch', rests) - if (typeof rests[0] === 'string') { - rests[0] = (new URL(rests[0], url)).toString() - } - return globalEnv.rawWindow.fetch(rests) - } - const rawXMLHttpRequest = globalEnv.rawWindow.XMLHttpRequest - class XMLHttpRequest extends rawXMLHttpRequest { - open (method: string, reqUrl: string) { - // console.log('XMLHttpRequest', method, reqUrl) - reqUrl = (new URL(reqUrl, url)).toString() - super.open(method, reqUrl) - } - } rawDefineProperties(microAppWindow, { document: { configurable: false, @@ -452,39 +431,67 @@ export default class SandBox implements SandBoxInterface { modifiedImage = value }, }, - EventSource: { - configurable: true, - enumerable: false, - get () { - return EventSource - }, - set: (value) => { - modifiedImage = value - }, - }, - fetch: { - configurable: true, - enumerable: false, - get () { - return fetch - }, - set: (value) => { - modifiedImage = value - }, - }, - XMLHttpRequest: { - configurable: true, - enumerable: false, - get () { - return XMLHttpRequest - }, - set: (value) => { - modifiedImage = value - }, - }, }) } + // private patchHijackRequest (microAppWindow: microAppWindowType, appName: string, url: string) { + // let modifiedImage: unknown + // function EventSource (...rests: any[]) { + // console.log(appName + ' EventSource', rests) + // if (typeof rests[0] === 'string') { + // rests[0] = (new URL(rests[0], url)).toString() + // } + // return new globalEnv.rawWindow.EventSource(...rests) + // } + // function patchFetch (...rests: any[]) { + // console.log(appName + ' fetch', rests) + // if (typeof rests[0] === 'string') { + // rests[0] = (new URL(rests[0], url)).toString() + // } + // return globalEnv.rawWindow.fetch(...rests) + // } + // const rawXMLHttpRequest = globalEnv.rawWindow.XMLHttpRequest + // class XMLHttpRequest extends rawXMLHttpRequest { + // open (method: string, reqUrl: string) { + // console.log(appName + ' XMLHttpRequest', method, reqUrl) + // reqUrl = (new URL(reqUrl, url)).toString() + // super.open(method, reqUrl) + // } + // } + // rawDefineProperties(microAppWindow, { + // EventSource: { + // configurable: true, + // enumerable: true, + // get () { + // return EventSource + // }, + // set: (value) => { + // modifiedImage = value + // }, + // }, + // fetch: { + // configurable: true, + // enumerable: true, + // get () { + // return patchFetch + // }, + // set: (value) => { + // modifiedImage = value + // }, + // }, + // XMLHttpRequest: { + // configurable: true, + // enumerable: true, + // get () { + // return XMLHttpRequest + // }, + // set: (value) => { + // modifiedImage = value + // }, + // }, + // }) + // } + // set location & history for memory router private setRouterApi (microAppWindow: microAppWindowType, appName: string, url: string): void { const { microLocation, microHistory } = createMicroRouter(appName, url) From 59eefa2e05dbc68cde268c61b0fc0779c39546b3 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Fri, 1 Jul 2022 18:39:15 +0800 Subject: [PATCH 039/268] feat: fix error of hot reload in create-react-app --- dev/children/react16/src/index.js | 18 ++-- dev/main-react16/config/config.js | 2 +- src/sandbox/adapter.ts | 60 ++++++++++++ src/sandbox/index.ts | 154 +++++++++++++++--------------- src/source/patch.ts | 10 ++ typings/global.d.ts | 14 +++ 6 files changed, 169 insertions(+), 89 deletions(-) create mode 100644 src/sandbox/adapter.ts diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index 518202335..87cc708af 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -268,15 +268,15 @@ if (window.__MICRO_APP_ENVIRONMENT__) { // }, 0); -setTimeout(() => { - // window.location.href = 'http://localhost:3001/micro-app/react16/#abc' - // window.location.pathname = '/micro-app/react16/page2#fff' - // window.location.assign('http://localhost:3001/micro-app/react16/page2#eee') - // window.location.replace('http://localhost:3001/micro-app/react16/page2#eee') - console.log(111111, window.location) - - // window.history.scrollRestoration = 'manual' -}, 5000); +// setTimeout(() => { +// // window.location.href = 'http://localhost:3001/micro-app/react16/#abc' +// // window.location.pathname = '/micro-app/react16/page2#fff' +// // window.location.assign('http://localhost:3001/micro-app/react16/page2#eee') +// // window.location.replace('http://localhost:3001/micro-app/react16/page2#eee') +// console.log(111111, window.location) + +// // window.history.scrollRestoration = 'manual' +// }, 5000); window.addEventListener('popstate', (e) => { console.log('子应用 popstate', e) diff --git a/dev/main-react16/config/config.js b/dev/main-react16/config/config.js index 9b57db9dd..512d77c6a 100644 --- a/dev/main-react16/config/config.js +++ b/dev/main-react16/config/config.js @@ -14,7 +14,7 @@ export default defineConfig({ hmr: true, }, history: { - type: 'hash', // browser hash + type: 'browser', // browser hash }, locale: { // default zh-CN diff --git a/src/sandbox/adapter.ts b/src/sandbox/adapter.ts new file mode 100644 index 000000000..535bea4f3 --- /dev/null +++ b/src/sandbox/adapter.ts @@ -0,0 +1,60 @@ +import type { SandBoxAdapter, AppInterface } from '@micro-app/types' +import globalEnv from '../libs/global_env' +import { defer } from '../libs/utils' + +export default class Adapter implements SandBoxAdapter { + constructor () { + this.injectReactHRMProperty() + } + + // keys that can only assigned to rawWindow + public escapeSetterKeyList: PropertyKey[] = [ + 'location', + ] + + // keys that can escape to rawWindow + public staticEscapeProperties: PropertyKey[] = [ + 'System', + '__cjsWrapper', + ] + + // keys that scoped in child app + public staticScopeProperties: PropertyKey[] = [ + 'webpackJsonp', + 'webpackHotUpdate', + 'Vue', + ] + + // TODO: __DEV__ process.env.NODE_ENV !== 'production' + // adapter for react + private injectReactHRMProperty (): void { + if (process.env.NODE_ENV !== 'production') { + // react child in non-react env + this.staticEscapeProperties.push('__REACT_ERROR_OVERLAY_GLOBAL_HOOK__') + // in react parent + if (globalEnv.rawWindow.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__) { + this.staticScopeProperties = this.staticScopeProperties.concat([ + '__REACT_ERROR_OVERLAY_GLOBAL_HOOK__', + '__reactRefreshInjected', + ]) + } + } + } +} + +/** + * Fix error of hot reload when parent&child created by create-react-app in development environment + * Issue: https://github.com/micro-zoe/micro-app/issues/382 + */ +export function fixReactHMRConflict (app: AppInterface): void { + if (process.env.NODE_ENV !== 'production') { + const rawReactErrorHook = globalEnv.rawWindow.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__ + const childReactErrorHook = app.sandBox?.proxyWindow.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__ + if (rawReactErrorHook && childReactErrorHook) { + globalEnv.rawWindow.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__ = childReactErrorHook + defer(() => { + globalEnv.rawWindow.__REACT_ERROR_OVERLAY_GLOBAL_HOOK__ = rawReactErrorHook + }) + } + } +} diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 70ecf8cb4..b4c33534a 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -3,6 +3,7 @@ import type { SandBoxInterface, plugins, MicroLocation, + SandBoxAdapter, } from '@micro-app/types' import { EventCenterForMicroApp, @@ -46,6 +47,7 @@ import createMicroRouter, { updateBrowserURLWithLocation, router, } from './router' +import Adapter from './adapter' export { router, getNoHashMicroPathFromURL } from './router' export type MicroAppWindowDataType = { @@ -65,18 +67,6 @@ export type MicroAppWindowDataType = { export type MicroAppWindowType = Window & MicroAppWindowDataType export type proxyWindow = WindowProxy & MicroAppWindowDataType -// Variables that can escape to rawWindow -const staticEscapeProperties: PropertyKey[] = [ - '__REACT_ERROR_OVERLAY_GLOBAL_HOOK__', // react child in non-react env - 'System', - '__cjsWrapper', -] - -// Variables that can only assigned to rawWindow -const escapeSetterKeyList: PropertyKey[] = [ - 'location', -] - const globalPropertyList: Array = ['window', 'self', 'globalThis'] export default class SandBox implements SandBoxInterface { @@ -85,11 +75,12 @@ export default class SandBox implements SandBoxInterface { private rebuildUmdEffect!: CallableFunction private releaseEffect!: CallableFunction private removeHistoryListener!: CallableFunction + private adapter: SandBoxAdapter /** * Scoped global Properties(Properties that can only get and set in microAppWindow, will not escape to rawWindow) - * https://github.com/micro-zoe/micro-app/issues/234 + * Fix https://github.com/micro-zoe/micro-app/issues/234 */ - private scopeProperties: PropertyKey[] = ['webpackJsonp', 'Vue'] + private scopeProperties: PropertyKey[] = [] // Properties that can be escape to rawWindow private escapeProperties: PropertyKey[] = [] // Properties newly added to microAppWindow @@ -104,6 +95,7 @@ export default class SandBox implements SandBoxInterface { public microAppWindow = {} as MicroAppWindowType // Proxy target constructor (appName: string, url: string, useMemoryRouter = true) { + this.adapter = new Adapter() // get scopeProperties and escapeProperties from plugins this.getSpecialProperties(appName) // create proxyWindow with Proxy(microAppWindow) @@ -192,14 +184,15 @@ export default class SandBox implements SandBoxInterface { } /** - * get scopeProperties and escapeProperties from plugins + * get scopeProperties and escapeProperties from plugins & adapter * @param appName app name */ private getSpecialProperties (appName: string): void { - if (!isPlainObject(microApp.plugins)) return - - this.commonActionForSpecialProperties(microApp.plugins.global) - this.commonActionForSpecialProperties(microApp.plugins.modules?.[appName]) + this.scopeProperties = this.scopeProperties.concat(this.adapter.staticScopeProperties) + if (isPlainObject(microApp.plugins)) { + this.commonActionForSpecialProperties(microApp.plugins.global) + this.commonActionForSpecialProperties(microApp.plugins.modules?.[appName]) + } } // common action for global plugins and module plugins @@ -239,7 +232,7 @@ export default class SandBox implements SandBoxInterface { }, set: (target: microAppWindowType, key: PropertyKey, value: unknown): boolean => { if (this.active) { - if (escapeSetterKeyList.includes(key)) { + if (this.adapter.escapeSetterKeyList.includes(key)) { Reflect.set(rawWindow, key, value) } else if ( // target.hasOwnProperty has been rewritten @@ -266,7 +259,10 @@ export default class SandBox implements SandBoxInterface { if ( ( this.escapeProperties.includes(key) || - (staticEscapeProperties.includes(key) && !Reflect.has(rawWindow, key)) + ( + this.adapter.staticEscapeProperties.includes(key) && + !Reflect.has(rawWindow, key) + ) ) && !this.scopeProperties.includes(key) ) { @@ -349,7 +345,7 @@ export default class SandBox implements SandBoxInterface { microAppWindow.hasOwnProperty = (key: PropertyKey) => rawHasOwnProperty.call(microAppWindow, key) || rawHasOwnProperty.call(globalEnv.rawWindow, key) this.setMappingPropertiesWithRawDescriptor(microAppWindow) this.setHijackProperties(microAppWindow, appName) - // this.patchHijackRequest(microAppWindow, appName, url) + this.patchHijackRequest(microAppWindow, appName, url) if (useMemoryRouter) this.setRouterApi(microAppWindow, appName, url) } @@ -434,63 +430,63 @@ export default class SandBox implements SandBoxInterface { }) } - // private patchHijackRequest (microAppWindow: microAppWindowType, appName: string, url: string) { - // let modifiedImage: unknown - // function EventSource (...rests: any[]) { - // console.log(appName + ' EventSource', rests) - // if (typeof rests[0] === 'string') { - // rests[0] = (new URL(rests[0], url)).toString() - // } - // return new globalEnv.rawWindow.EventSource(...rests) - // } - // function patchFetch (...rests: any[]) { - // console.log(appName + ' fetch', rests) - // if (typeof rests[0] === 'string') { - // rests[0] = (new URL(rests[0], url)).toString() - // } - // return globalEnv.rawWindow.fetch(...rests) - // } - // const rawXMLHttpRequest = globalEnv.rawWindow.XMLHttpRequest - // class XMLHttpRequest extends rawXMLHttpRequest { - // open (method: string, reqUrl: string) { - // console.log(appName + ' XMLHttpRequest', method, reqUrl) - // reqUrl = (new URL(reqUrl, url)).toString() - // super.open(method, reqUrl) - // } - // } - // rawDefineProperties(microAppWindow, { - // EventSource: { - // configurable: true, - // enumerable: true, - // get () { - // return EventSource - // }, - // set: (value) => { - // modifiedImage = value - // }, - // }, - // fetch: { - // configurable: true, - // enumerable: true, - // get () { - // return patchFetch - // }, - // set: (value) => { - // modifiedImage = value - // }, - // }, - // XMLHttpRequest: { - // configurable: true, - // enumerable: true, - // get () { - // return XMLHttpRequest - // }, - // set: (value) => { - // modifiedImage = value - // }, - // }, - // }) - // } + private patchHijackRequest (microAppWindow: microAppWindowType, url: string): void { + let modifiedImage: unknown + function EventSource (...rests: any[]) { + // console.log(111, appName + ' EventSource', rests) + if (typeof rests[0] === 'string') { + rests[0] = (new URL(rests[0], url)).toString() + } + return new globalEnv.rawWindow.EventSource(...rests) + } + function patchFetch (...rests: any[]) { + // console.log(222, appName + ' fetch', rests) + if (typeof rests[0] === 'string') { + rests[0] = (new URL(rests[0], url)).toString() + } + return globalEnv.rawWindow.fetch(...rests) + } + const rawXMLHttpRequest = globalEnv.rawWindow.XMLHttpRequest + class XMLHttpRequest extends rawXMLHttpRequest { + open (method: string, reqUrl: string) { + // console.log(333, appName + ' XMLHttpRequest', method, reqUrl) + reqUrl = (new URL(reqUrl, url)).toString() + super.open(method, reqUrl) + } + } + rawDefineProperties(microAppWindow, { + EventSource: { + configurable: true, + enumerable: true, + get () { + return modifiedImage || EventSource + }, + set: (value) => { + modifiedImage = value + }, + }, + fetch: { + configurable: true, + enumerable: true, + get () { + return patchFetch + }, + set: (value) => { + modifiedImage = value + }, + }, + XMLHttpRequest: { + configurable: true, + enumerable: true, + get () { + return XMLHttpRequest + }, + set: (value) => { + modifiedImage = value + }, + }, + }) + } // set location & history for memory router private setRouterApi (microAppWindow: microAppWindowType, appName: string, url: string): void { diff --git a/src/source/patch.ts b/src/source/patch.ts index d1a433b21..165aabe7f 100644 --- a/src/source/patch.ts +++ b/src/source/patch.ts @@ -16,6 +16,7 @@ import { extractLinkFromHtml, formatDynamicLink } from './links' import { extractScriptElement, runScript, runDynamicRemoteScript } from './scripts' import microApp from '../micro_app' import globalEnv from '../libs/global_env' +import { fixReactHMRConflict } from '../sandbox/adapter' // Record element and map element const dynamicElementInMicroAppMap = new WeakMap() @@ -127,6 +128,15 @@ function invokePrototypeMethod ( return targetChild } + // TODO: __DEV__ + if ( + process.env.NODE_ENV !== 'production' && + targetChild instanceof HTMLIFrameElement && + rawMethod === globalEnv.rawAppendChild + ) { + fixReactHMRConflict(app) + } + return invokeRawMethod(rawMethod, hijackElement, targetChild, passiveChild) } diff --git a/typings/global.d.ts b/typings/global.d.ts index aae5483b8..a3d3c0133 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -24,6 +24,20 @@ declare module '@micro-app/types' { removeRouteInfoForKeepAliveApp (): void } + interface SandBoxAdapter { + // Variables that can only assigned to rawWindow + escapeSetterKeyList: PropertyKey[] + + // Variables that can escape to rawWindow + staticEscapeProperties: PropertyKey[] + + // Variables that scoped in child app + staticScopeProperties: PropertyKey[] + + // adapter for react + // injectReactHRMProperty (): void + } + type sourceLinkInfo = { code: string // code placeholder?: Comment | null // placeholder comment From 7f0858926b2135a44d0e8c529b8430cb574bdfba Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Tue, 5 Jul 2022 19:59:53 +0800 Subject: [PATCH 040/268] feat: add proxyRequest for sandbox --- src/create_app.ts | 12 +++- src/libs/constants.ts | 10 ++- src/libs/utils.ts | 19 ++---- src/sandbox/adapter.ts | 5 ++ src/sandbox/effect.ts | 3 +- src/sandbox/index.ts | 151 ++++++++++++++++++++++------------------- src/sandbox/request.ts | 119 ++++++++++++++++++++++++++++++++ typings/global.d.ts | 2 +- 8 files changed, 233 insertions(+), 88 deletions(-) create mode 100644 src/sandbox/request.ts diff --git a/src/create_app.ts b/src/create_app.ts index 6edd44bd2..86960257f 100644 --- a/src/create_app.ts +++ b/src/create_app.ts @@ -311,8 +311,16 @@ export default class CreateApp implements AppInterface { cloneContainer(this.container as Element, this.source.html as Element, false) } - // this.container maybe contains micro-app element, stop sandbox should exec after cloneContainer - this.sandBox?.stop(this.keepRouteState && !destroy) + /** + * this.container maybe contains micro-app element, stop sandbox should exec after cloneContainer + * NOTE: + * 1. if destroy is true, clear route state + * 2. umd mode and keep-alive will not clear EventSource + */ + this.sandBox?.stop( + this.keepRouteState && !destroy, + !this.umdMode || destroy, + ) if (!getActiveApps().length) { releasePatchSetAttribute() } diff --git a/src/libs/constants.ts b/src/libs/constants.ts index 1619e34df..6eb25f7c3 100644 --- a/src/libs/constants.ts +++ b/src/libs/constants.ts @@ -33,4 +33,12 @@ export enum keepAliveStates { KEEP_ALIVE_HIDDEN = 'keep_alive_hidden', } -export const globalKeyToBeCached = 'window,self,globalThis,Array,Object,String,Boolean,Math,Number,Symbol,Date,Promise,Function,Proxy,WeakMap,WeakSet,Set,Map,Reflect,Element,Node,Document,RegExp,Error,TypeError,JSON,isNaN,parseFloat,parseInt,performance,console,decodeURI,encodeURI,decodeURIComponent,encodeURIComponent,navigator,undefined,location,history,EventSource,fetch,XMLHttpRequest' +/** + * global key must be static key, they can not rewrite + * e.g. + * window.Promise = newValue + * new Promise ==> still get old value, not newValue, because they are cached by top function + * NOTE: + * 1. Do not add fetch, XMLHttpRequest, EventSource + */ +export const globalKeyToBeCached = 'window,self,globalThis,Array,Object,String,Boolean,Math,Number,Symbol,Date,Function,Proxy,WeakMap,WeakSet,Set,Map,Reflect,Element,Node,Document,RegExp,Error,TypeError,JSON,isNaN,parseFloat,parseInt,performance,console,decodeURI,encodeURI,decodeURIComponent,encodeURIComponent,navigator,undefined,location,history' diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 3f33f9a67..0d7abee7a 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -127,7 +127,7 @@ export function defer (fn: Func, ...args: unknown[]): void { /** * create URL as MicroLocation */ -export const createURL = (function (): (p: string | URL, b?: string) => MicroLocation { +export const createURL = (function (): (path: string | URL, base?: string) => MicroLocation { class Location extends URL {} return (path: string | URL, base?: string): MicroLocation => { return (base ? new Location('' + path, base) : new Location('' + path)) as MicroLocation @@ -139,7 +139,7 @@ export const createURL = (function (): (p: string | URL, b?: string) => MicroLoc * @param url address */ export function addProtocol (url: string): string { - return url.startsWith('//') ? `${location.protocol}${url}` : url + return url.startsWith('//') ? `${globalThis.location.protocol}${url}` : url } /** @@ -244,23 +244,14 @@ export function promiseStream ( promiseList.forEach((p, i) => { if (isPromise(p)) { (p as Promise).then((res: T) => { - successCb({ - data: res, - index: i, - }) + successCb({ data: res, index: i }) isFinished() }).catch((err: Error) => { - errorCb({ - error: err, - index: i, - }) + errorCb({ error: err, index: i }) isFinished() }) } else { - successCb({ - data: p, - index: i, - }) + successCb({ data: p, index: i }) isFinished() } }) diff --git a/src/sandbox/adapter.ts b/src/sandbox/adapter.ts index 535bea4f3..7ee99684d 100644 --- a/src/sandbox/adapter.ts +++ b/src/sandbox/adapter.ts @@ -42,6 +42,11 @@ export default class Adapter implements SandBoxAdapter { } } +// Fix conflict of babel-polyfill@6.x +export function fixBabelPolyfill6 (): void { + if (globalEnv.rawWindow._babelPolyfill) globalEnv.rawWindow._babelPolyfill = false +} + /** * Fix error of hot reload when parent&child created by create-react-app in development environment * Issue: https://github.com/micro-zoe/micro-app/issues/382 diff --git a/src/sandbox/effect.ts b/src/sandbox/effect.ts index 676209022..a1bc8e4ed 100644 --- a/src/sandbox/effect.ts +++ b/src/sandbox/effect.ts @@ -152,8 +152,7 @@ export function releaseEffectDocumentEvent (): void { * Rewrite side-effect events * @param microAppWindow micro window */ -export default function effect (microAppWindow: microAppWindowType): Record { - const appName = microAppWindow.__MICRO_APP_NAME__ +export default function effect (appName: string, microAppWindow: microAppWindowType): Record { const eventListenerMap = new Map>() const intervalIdMap = new Map() const timeoutIdMap = new Map() diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index b4c33534a..198f09ed7 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -47,26 +47,27 @@ import createMicroRouter, { updateBrowserURLWithLocation, router, } from './router' -import Adapter from './adapter' +import Adapter, { fixBabelPolyfill6 } from './adapter' +import { createMicroFetch, useMicroEventSource, createMicroXMLHttpRequest } from './request' export { router, getNoHashMicroPathFromURL } from './router' export type MicroAppWindowDataType = { - __MICRO_APP_ENVIRONMENT__: boolean - __MICRO_APP_NAME__: string - __MICRO_APP_URL__: string - __MICRO_APP_PUBLIC_PATH__: string - __MICRO_APP_BASE_URL__: string - __MICRO_APP_BASE_ROUTE__: string - __MICRO_APP_UMD_MODE__: boolean - microApp: EventCenterForMicroApp - rawWindow: Window - rawDocument: Document - removeDomScope: () => void + __MICRO_APP_ENVIRONMENT__: boolean, + __MICRO_APP_NAME__: string, + __MICRO_APP_URL__: string, + __MICRO_APP_PUBLIC_PATH__: string, + __MICRO_APP_BASE_URL__: string, + __MICRO_APP_BASE_ROUTE__: string, + __MICRO_APP_UMD_MODE__: boolean, + microApp: EventCenterForMicroApp, + rawWindow: Window, + rawDocument: Document, + removeDomScope: () => void, } - export type MicroAppWindowType = Window & MicroAppWindowDataType export type proxyWindow = WindowProxy & MicroAppWindowDataType +const { createMicroEventSource, clearMicroEventSource } = useMicroEventSource() const globalPropertyList: Array = ['window', 'self', 'globalThis'] export default class SandBox implements SandBoxInterface { @@ -100,10 +101,10 @@ export default class SandBox implements SandBoxInterface { this.getSpecialProperties(appName) // create proxyWindow with Proxy(microAppWindow) this.proxyWindow = this.createProxyWindow(appName) - // inject global properties - this.initMicroAppWindow(this.microAppWindow, appName, url, useMemoryRouter) // Rewrite global event listener & timeout - assign(this, effect(this.microAppWindow)) + assign(this, effect(appName, this.microAppWindow)) + // inject global properties + this.initStaticGlobalKeys(this.microAppWindow, appName, url, useMemoryRouter) } public start ( @@ -122,22 +123,45 @@ export default class SandBox implements SandBoxInterface { } else { this.microAppWindow.__MICRO_APP_BASE_ROUTE__ = this.microAppWindow.__MICRO_APP_BASE_URL__ = baseRoute } + + // prevent the key deleted during sandBox.stop after rewrite + this.initGlobalKeysWhenStart( + this.microAppWindow, + this.proxyWindow.__MICRO_APP_NAME__, + this.proxyWindow.__MICRO_APP_URL__ + ) + if (++SandBox.activeCount === 1) { effectDocumentEvent() patchElementPrototypeMethods() listenUmountOfNestedApp() } - // BUG FIX: bable-polyfill@6.x - globalEnv.rawWindow._babelPolyfill && (globalEnv.rawWindow._babelPolyfill = false) + + fixBabelPolyfill6() } } - public stop (keepRouteState = false): void { + public stop (keepRouteState: boolean, clearEventSource: boolean): void { if (this.active) { this.releaseEffect() this.microAppWindow.microApp.clearDataListener() this.microAppWindow.microApp.clearGlobalDataListener() + if (this.removeHistoryListener) { + this.clearRouteState(keepRouteState) + // release listener of popstate + this.removeHistoryListener() + } + + if (clearEventSource) { + clearMicroEventSource(this.proxyWindow.__MICRO_APP_NAME__) + } + + /** + * NOTE: + * 1. injectedKeys and escapeKeys must be placed at the back + * 2. if key in initial microAppWindow, and then rewrite, this key will be delete from microAppWindow when stop, and lost when restart + */ this.injectedKeys.forEach((key: PropertyKey) => { Reflect.deleteProperty(this.microAppWindow, key) }) @@ -148,16 +172,11 @@ export default class SandBox implements SandBoxInterface { }) this.escapeKeys.clear() - if (this.removeHistoryListener) { - this.clearRouteState(keepRouteState) - // release listener of popstate - this.removeHistoryListener() - } - if (--SandBox.activeCount === 0) { releaseEffectDocumentEvent() releasePatches() } + this.active = false } } @@ -323,8 +342,9 @@ export default class SandBox implements SandBoxInterface { * @param microAppWindow micro window * @param appName app name * @param url app url + * @param useMemoryRouter whether use memory router */ - private initMicroAppWindow ( + private initStaticGlobalKeys ( microAppWindow: microAppWindowType, appName: string, url: string, @@ -335,18 +355,31 @@ export default class SandBox implements SandBoxInterface { microAppWindow.__MICRO_APP_URL__ = url microAppWindow.__MICRO_APP_PUBLIC_PATH__ = getEffectivePath(url) microAppWindow.__MICRO_APP_WINDOW__ = microAppWindow + microAppWindow.rawWindow = globalEnv.rawWindow + microAppWindow.rawDocument = globalEnv.rawDocument microAppWindow.microApp = assign(new EventCenterForMicroApp(appName), { removeDomScope, pureCreateElement, router, }) - microAppWindow.rawWindow = globalEnv.rawWindow - microAppWindow.rawDocument = globalEnv.rawDocument - microAppWindow.hasOwnProperty = (key: PropertyKey) => rawHasOwnProperty.call(microAppWindow, key) || rawHasOwnProperty.call(globalEnv.rawWindow, key) this.setMappingPropertiesWithRawDescriptor(microAppWindow) + if (useMemoryRouter) this.setMicroAppRouter(microAppWindow, appName, url) + } + + /** + * init global properties of microAppWindow when exec sandBox.start + * @param microAppWindow micro window + * @param appName app name + * @param url app url + */ + private initGlobalKeysWhenStart ( + microAppWindow: microAppWindowType, + appName: string, + url: string, + ): void { + microAppWindow.hasOwnProperty = (key: PropertyKey) => rawHasOwnProperty.call(microAppWindow, key) || rawHasOwnProperty.call(globalEnv.rawWindow, key) this.setHijackProperties(microAppWindow, appName) this.patchHijackRequest(microAppWindow, appName, url) - if (useMemoryRouter) this.setRouterApi(microAppWindow, appName, url) } // properties associated with the native window @@ -398,7 +431,7 @@ export default class SandBox implements SandBoxInterface { let modifiedEval: unknown, modifiedImage: unknown rawDefineProperties(microAppWindow, { document: { - configurable: false, + configurable: true, enumerable: true, get () { throttleDeferForSetAppName(appName) @@ -430,66 +463,48 @@ export default class SandBox implements SandBoxInterface { }) } - private patchHijackRequest (microAppWindow: microAppWindowType, url: string): void { - let modifiedImage: unknown - function EventSource (...rests: any[]) { - // console.log(111, appName + ' EventSource', rests) - if (typeof rests[0] === 'string') { - rests[0] = (new URL(rests[0], url)).toString() - } - return new globalEnv.rawWindow.EventSource(...rests) - } - function patchFetch (...rests: any[]) { - // console.log(222, appName + ' fetch', rests) - if (typeof rests[0] === 'string') { - rests[0] = (new URL(rests[0], url)).toString() - } - return globalEnv.rawWindow.fetch(...rests) - } - const rawXMLHttpRequest = globalEnv.rawWindow.XMLHttpRequest - class XMLHttpRequest extends rawXMLHttpRequest { - open (method: string, reqUrl: string) { - // console.log(333, appName + ' XMLHttpRequest', method, reqUrl) - reqUrl = (new URL(reqUrl, url)).toString() - super.open(method, reqUrl) - } - } + // rewrite fetch, XMLHttpRequest, EventSource + private patchHijackRequest (microAppWindow: microAppWindowType, appName: string, url: string): void { + let microFetch = createMicroFetch(url) + let microXMLHttpRequest = createMicroXMLHttpRequest(url) + let microEventSource = createMicroEventSource(appName, url) + rawDefineProperties(microAppWindow, { - EventSource: { + fetch: { configurable: true, enumerable: true, get () { - return modifiedImage || EventSource + return microFetch }, - set: (value) => { - modifiedImage = value + set (value) { + microFetch = createMicroFetch(url, value) }, }, - fetch: { + XMLHttpRequest: { configurable: true, enumerable: true, get () { - return patchFetch + return microXMLHttpRequest }, - set: (value) => { - modifiedImage = value + set (value) { + microXMLHttpRequest = createMicroXMLHttpRequest(url, value) }, }, - XMLHttpRequest: { + EventSource: { configurable: true, enumerable: true, get () { - return XMLHttpRequest + return microEventSource }, - set: (value) => { - modifiedImage = value + set (value) { + microEventSource = createMicroEventSource(appName, url, value) }, }, }) } // set location & history for memory router - private setRouterApi (microAppWindow: microAppWindowType, appName: string, url: string): void { + private setMicroAppRouter (microAppWindow: microAppWindowType, appName: string, url: string): void { const { microLocation, microHistory } = createMicroRouter(appName, url) rawDefineProperties(microAppWindow, { location: { diff --git a/src/sandbox/request.ts b/src/sandbox/request.ts new file mode 100644 index 000000000..96b2171e7 --- /dev/null +++ b/src/sandbox/request.ts @@ -0,0 +1,119 @@ +import globalEnv from '../libs/global_env' +import { + isFunction, + isUndefined, + isString, + createURL, + isURL, +} from '../libs/utils' + +/** + * https://developer.mozilla.org/en-US/docs/Web/API/fetch + * Promise fetch(input[, init]) + * input: string/Request + * init?: object + * @param url app url + * @param target proxy target + */ +export function createMicroFetch (url: string, target?: Window['fetch']): Window['fetch'] { + if (!isUndefined(target) && !isFunction(target)) return target + const rawFetch = target || globalEnv.rawWindow.fetch + return function microFetch ( + input: RequestInfo | URL | string, + init?: RequestInit, + ...rests: unknown[] + ): Promise { + if (isString(input) || isURL(input)) { + input = createURL(input, url).toString() + } + return rawFetch.call(globalEnv.rawWindow, input, init, ...rests) + } +} + +/** + * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest + * https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest + * @param url app url + * @param target proxy target + */ +export function createMicroXMLHttpRequest (url: string, target?: XMLHttpRequest): any { + if (!isUndefined(target) && !isFunction(target)) return target + const rawXMLHttpRequest = target || globalEnv.rawWindow.XMLHttpRequest + return class MicroXMLHttpRequest extends rawXMLHttpRequest { + open (method: string, reqUrl: string, ...rests: unknown[]): void { + if ((isString(reqUrl) && !/^f(ile|tp):\/\//.test(reqUrl)) || isURL(reqUrl)) { + reqUrl = createURL(reqUrl, url).toString() + } + super.open(method, reqUrl, ...rests) + } + } +} + +export interface EventSourceInstance { + close(): void; +} + +export interface EventSourceApi { + createMicroEventSource(appName: string, url: string, target?: EventSource): any + clearMicroEventSource (appName: string): void +} + +export function useMicroEventSource (): EventSourceApi { + let eventSourceMap: Map> + + /** + * https://developer.mozilla.org/en-US/docs/Web/API/EventSource + * pc = new EventSource(url[, configuration]) + * url: string/Request + * configuration?: object + * @param url app url + * @param target proxy target + */ + function createMicroEventSource (appName: string, url: string, target?: EventSource): any { + if (!isUndefined(target) && !isFunction(target)) return target + const rawEventSource = target || globalEnv.rawWindow.EventSource + return class MicroEventSource extends rawEventSource { + constructor ( + eventSourceUrl: string | URL, + eventSourceInitDict?: EventSourceInit, + ...rests: unknown[] + ) { + if (isString(eventSourceUrl) || isURL(eventSourceUrl)) { + eventSourceUrl = createURL(eventSourceUrl, url).toString() + } + super(eventSourceUrl, eventSourceInitDict, ...rests) + + if (eventSourceMap) { + const eventSourceList = eventSourceMap.get(appName) + if (eventSourceList) { + eventSourceList.add(this) + } else { + eventSourceMap.set(appName, new Set([this])) + } + } else { + eventSourceMap = new Map([[appName, new Set([this])]]) + } + } + + close (): void { + super.close() + eventSourceMap.get(appName)?.delete(this) + } + } + } + + function clearMicroEventSource (appName: string): void { + const eventSourceList = eventSourceMap?.get(appName) + if (eventSourceList?.size) { + eventSourceList.forEach(item => { + item.close() + }) + eventSourceList.clear() + } + } + + return { + createMicroEventSource, + clearMicroEventSource, + } +} diff --git a/typings/global.d.ts b/typings/global.d.ts index a3d3c0133..c0521fb33 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -15,7 +15,7 @@ declare module '@micro-app/types' { useMemoryRouter: boolean, defaultPage: string, ): void - stop (keepRouteState: boolean): void + stop (keepRouteState: boolean, clearEventSource: boolean): void // record umd snapshot before the first execution of umdHookMount recordUmdSnapshot (): void // rebuild umd snapshot before remount umd app From f35be47d7a5420e68d7e663500b5c67f999c0a39 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 6 Jul 2022 10:57:56 +0800 Subject: [PATCH 041/268] chore: change version --- package.json | 2 +- src/__tests__/sandbox/index.test.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 92ad46269..8bd538a9e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@micro-zoe/micro-app", - "version": "1.0.0-alpha.0", + "version": "1.0.0-alpha.1", "description": "A lightweight, efficient and powerful micro front-end framework", "private": false, "main": "lib/index.min.js", diff --git a/src/__tests__/sandbox/index.test.ts b/src/__tests__/sandbox/index.test.ts index 80bc44dc9..d2422b46c 100644 --- a/src/__tests__/sandbox/index.test.ts +++ b/src/__tests__/sandbox/index.test.ts @@ -185,7 +185,7 @@ describe('sandbox', () => { expect(sandbox.escapeKeys.size).toBe(3) // @ts-ignore expect(sandbox.active).toBeTruthy() - sandbox.stop() + sandbox.stop(false, true) // @ts-ignore expect(sandbox.escapeKeys.size).toBe(0) // @ts-ignore @@ -322,8 +322,8 @@ describe('sandbox', () => { proxyWindow.notExecute = 'notExecute-value' expect(proxyWindow.notExecute).toBe('notExecute-value') - sandbox.stop() - sandbox.stop() // 多次执行start无效 + sandbox.stop(false, true) + sandbox.stop(false, true) // 多次执行start无效 }) // proxyWindow没有此变量而rawWindow有,则优先使用rawWindow的descriptor From 48422835f8de98582e67076841766d4e6664a68e Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 6 Jul 2022 14:34:52 +0800 Subject: [PATCH 042/268] docs: update change log --- docs/zh-cn/changelog.md | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/docs/zh-cn/changelog.md b/docs/zh-cn/changelog.md index 56c88f115..4e46daf98 100644 --- a/docs/zh-cn/changelog.md +++ b/docs/zh-cn/changelog.md @@ -8,13 +8,46 @@ --- -### 1.0.0-beta.1 +### 1.0.0-alpha.1 -`2022-03-30` +`2022-07-06` - **New** - - 🆕 新增了独立的路由系统 - `MemoryRouter`,简化接入步骤。 + - 🆕 新增了`proxyRequest`,用于拦截fetch、XMLHttpRequest、EventSource请求并进行处理。 + +- **Bug Fix** + + - 🐞 修复了通过`create-react-app`创建的react应用热更新时报错的问题。 + - 🐞 修复了子应用执行`pushState/replaceState`时`popStateEvent`事件异常触发的问题。 + +- **Update** + + - 🚀 优化了资源加载相关代码和逻辑。 + + +### 0.8.6 + +`2022-06-30` + +- **New** + + - 🆕 在 plugin 中增加 excludeChecker 和 ignoreChecker 用于主应用主动忽略子应用部分 script 和 link。 + - 🆕 新增了`processHtml`,用于在插件中处理html。 + +- **Update** + + - 🚀 优化了资源加载相关代码和逻辑。 + - 🚀 优化了单元测试相关代码。 + + +### 1.0.0-alpha.0 + +`2022-06-30` + +- **New** + + - 🆕 新增了独立的路由系统 - `MemoryRouter`,完善JS沙箱。 - **Bug Fix** From 5cd57f9350345dd0333bb5c94d7e9dc223ab1504 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 6 Jul 2022 19:48:52 +0800 Subject: [PATCH 043/268] docs: update docs --- docs/zh-cn/framework/vite.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/zh-cn/framework/vite.md b/docs/zh-cn/framework/vite.md index cc823e118..b2f881cb9 100644 --- a/docs/zh-cn/framework/vite.md +++ b/docs/zh-cn/framework/vite.md @@ -1,3 +1,8 @@ +> [!ATTENTION] +> vite作为子应用时需要关闭沙箱,这会导致很多问题,暂时不建议使用。 +> +> 我们正在规划为vite打造一套独立的沙箱方案,以便更好的接入。 + 本篇介绍了`vite 2`的接入方式,vite1暂不支持。 ## 作为基座应用 From 64519e346a7b25d0e40b6e26cda47ec25252cd0e Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Thu, 7 Jul 2022 20:15:23 +0800 Subject: [PATCH 044/268] feat: add router api attachToURL,attachAllToURL,setBaseAppRouter,getBaseAppRouter --- dev/children/react16/src/pages/page1/page1.js | 11 ++-- dev/main-react16/src/pages/react16/react16.js | 14 +++- src/libs/nest_app.ts | 2 +- src/micro_app.ts | 7 +- src/micro_app_element.ts | 2 +- src/sandbox/index.ts | 6 +- src/sandbox/router/api.ts | 64 +++++++++++++++++-- src/sandbox/router/history.ts | 7 +- src/sandbox/router/index.ts | 6 +- typings/global.d.ts | 32 +++++++++- 10 files changed, 121 insertions(+), 30 deletions(-) diff --git a/dev/children/react16/src/pages/page1/page1.js b/dev/children/react16/src/pages/page1/page1.js index 0bd246b11..1841c4b77 100644 --- a/dev/children/react16/src/pages/page1/page1.js +++ b/dev/children/react16/src/pages/page1/page1.js @@ -48,8 +48,8 @@ function download (e) { } } -function controlVue22Nav (path) { - window.microApp.router.push({name: 'vue22', path}) +function controlBase () { + window.microApp.router.getBaseAppRouter()?.push('/vue2') } @@ -98,11 +98,8 @@ function Page1() { -
- 控制子应用vue22跳转home -
-
- 控制子应用vue22跳转page2 +
+ 控制基座跳转到/vue2
); diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index f198dfac8..7bd8bb67c 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -133,7 +133,7 @@ export default class App extends React.Component { this.setState({ testNum: this.state.testNum + 1, }) - // console.log(33333, this.props.history) + console.log(33333, this.props.history) } jumpToHome = () => { @@ -168,6 +168,14 @@ export default class App extends React.Component { // }, 3000); } + useRouterAttachToURL = () => { + microApp.router.attachToURL(this.state.name) + } + + useRouterAttachAllToURL = () => { + microApp.router.attachAllToURL() + } + handleGlobalDataForBaseApp = (data) => { console.log(`这是全局数据--基座应用-${this.state.name}`, data) } @@ -204,6 +212,8 @@ export default class App extends React.Component { console.log('指定 afterEach: ', to, from) } }) + + microApp.router.setBaseAppRouter(this.props.history) } componentWillUnmount () { @@ -234,6 +244,8 @@ export default class App extends React.Component { + + diff --git a/src/libs/nest_app.ts b/src/libs/nest_app.ts index cbc3c1885..f4c1b73ce 100644 --- a/src/libs/nest_app.ts +++ b/src/libs/nest_app.ts @@ -19,7 +19,7 @@ function releaseUnmountOfNestedApp (): void { // if micro-app run in micro application, delete all next generation application when unmount event received // unmount event will auto release by sandbox -export function listenUmountOfNestedApp (): void { +export function initEnvOfNestedApp (): void { if (window.__MICRO_APP_ENVIRONMENT__) { releaseUnmountOfNestedApp() window.addEventListener('unmount', unmountNestedApp, false) diff --git a/src/micro_app.ts b/src/micro_app.ts index 43d20a024..35b519db9 100644 --- a/src/micro_app.ts +++ b/src/micro_app.ts @@ -6,6 +6,7 @@ import type { fetchType, AppInterface, Router, + appName, } from '@micro-app/types' import { defineElement } from './micro_app_element' import preFetch, { getGlobalAssets } from './prefetch' @@ -29,9 +30,9 @@ import { router } from './sandbox' * @param excludeHiddenApp exclude hidden keep-alive app, default is false * @returns active apps */ -export function getActiveApps (excludeHiddenApp?: boolean): string[] { - const activeApps: string[] = [] - appInstanceMap.forEach((app: AppInterface, appName: string) => { +export function getActiveApps (excludeHiddenApp?: boolean): appName[] { + const activeApps: appName[] = [] + appInstanceMap.forEach((app: AppInterface, appName: appName) => { if ( appStates.UNMOUNT !== app.getAppState() && !app.isPrefetch && diff --git a/src/micro_app_element.ts b/src/micro_app_element.ts index 77a48c340..f8cce25b5 100644 --- a/src/micro_app_element.ts +++ b/src/micro_app_element.ts @@ -409,7 +409,7 @@ export function defineElement (tagName: string): void { */ private updateSsrUrl (baseUrl: string): void { if (this.getDisposeResult('ssr')) { - if (this.getDisposeResult('disable-memory-router')) { + if (this.getDisposeResult('disable-memory-router') || this.getDisposeResult('disableSandbox')) { const rawLocation = globalEnv.rawWindow.location this.ssrUrl = CompletionPath(rawLocation.pathname + rawLocation.search, baseUrl) } else { diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 198f09ed7..40c5cf878 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -11,9 +11,7 @@ import { recordDataCenterSnapshot, } from '../interact' import globalEnv from '../libs/global_env' -import { - listenUmountOfNestedApp, -} from '../libs/nest_app' +import { initEnvOfNestedApp } from '../libs/nest_app' import { getEffectivePath, isArray, @@ -134,7 +132,7 @@ export default class SandBox implements SandBoxInterface { if (++SandBox.activeCount === 1) { effectDocumentEvent() patchElementPrototypeMethods() - listenUmountOfNestedApp() + initEnvOfNestedApp() } fixBabelPolyfill6() diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index 9afd8aca4..806bc257f 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -29,7 +29,7 @@ import { import { appInstanceMap } from '../../create_app' import { getActiveApps } from '../../micro_app' import globalEnv from '../../libs/global_env' -import { navigateWithNativeEvent } from './history' +import { navigateWithNativeEvent, attachRouteToBrowserURL } from './history' export interface RouterApi { router: Router, @@ -75,10 +75,11 @@ function createRouterApi (): RouterApi { function createNavigationMethod (replace: boolean): navigationMethod { return function (to: RouterTarget): void { const appName = formatAppName(to.name) - // console.log(3333333, appInstanceMap.get(appName)) if (appName && isString(to.path)) { const app = appInstanceMap.get(appName) - if (app && !app.sandBox) return logError(`navigation failed, sandBox of app ${appName} is closed`) + if (app && (!app.sandBox || !app.useMemoryRouter)) { + return logError(`navigation failed, memory router of app ${appName} is closed`) + } // active apps, include hidden keep-alive app if (getActiveApps().includes(appName)) { const microLocation = app!.sandBox!.proxyWindow.location as MicroLocation @@ -178,7 +179,7 @@ function createRouterApi (): RouterApi { const defaultPageRecord = useMapRecord() /** - * defaultPage只在子应用初始化时生效,且优先级比浏览器上的子应用路由地址低 + * defaultPage only effect when mount, and has lower priority than query on browser url * @param appName app name * @param path page path */ @@ -196,6 +197,55 @@ function createRouterApi (): RouterApi { return defaultPageRecord.delete(appName) } + /** + * NOTE: + * 1. sandbox not open + * 2. useMemoryRouter is false + */ + function commonHandlerForAttachToURL (appName: string): void { + const app = appInstanceMap.get(appName)! + if (app.sandBox && app.useMemoryRouter) { + attachRouteToBrowserURL( + setMicroPathToURL(appName, app.sandBox.proxyWindow.location as MicroLocation), + setMicroState( + appName, + globalEnv.rawWindow.history.state, + null, + ), + ) + } + } + + /** + * Attach specified active app router info to browser url + * @param appName app name + */ + function attachToURL (appName: string): void { + appName = formatAppName(appName) + if (appName && getActiveApps().includes(appName)) { + commonHandlerForAttachToURL(appName) + } + } + + /** + * Attach all active app router info to browser url + */ + function attachAllToURL (): void { + getActiveApps().forEach(appName => commonHandlerForAttachToURL(appName)) + } + + /** + * Record base app router, let child app control base app navigation + */ + let baseRouterInstance: unknown = null + function setBaseAppRouter (baseRouter: unknown): void { + baseRouterInstance = baseRouter + } + + function getBaseAppRouter (): unknown { + return baseRouterInstance + } + // Router API for developer const router: Router = { current: new Map(), @@ -208,11 +258,13 @@ function createRouterApi (): RouterApi { forward: createRawHistoryMethod('forward'), beforeEach: beforeGuards.add, afterEach: afterGuards.add, - // attachToURL: 将指定的子应用路由信息添加到浏览器地址上 - // attachAllToURL: 将所有正在运行的子应用路由信息添加到浏览器地址上 setDefaultPage, removeDefaultPage, getDefaultPage: defaultPageRecord.get, + attachToURL, + attachAllToURL, + setBaseAppRouter, + getBaseAppRouter, } return { diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 5e7cbbda5..871cd5d7d 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -81,7 +81,7 @@ export function nativeHistoryNavigate ( /** * Navigate to new path, and dispatch native popStateEvent/hashChangeEvent to browser * Use scenes: - * 1. mount/unmount through updateBrowserURL with limited popstateEvent + * 1. mount/unmount through attachRouteToBrowserURL with limited popstateEvent * 2. proxyHistory.pushState/replaceState with limited popstateEvent * 3. api microApp.router.push/replace * 4. proxyLocation.hash = xxx @@ -107,11 +107,12 @@ export function navigateWithNativeEvent ( } /** - * update browser url when mount/unmount/hidden/show + * update browser url when mount/unmount/hidden/show/attachToURL/attachAllToURL + * just attach microRoute info to browser, dispatch event to base app(exclude child) * @param result result of add/remove microApp path on browser url * @param state history.state */ -export function updateBrowserURL ( +export function attachRouteToBrowserURL ( result: HandleMicroPathResult, state: MicroState, ): void { diff --git a/src/sandbox/router/index.ts b/src/sandbox/router/index.ts index a2d37f059..bac5af4ed 100644 --- a/src/sandbox/router/index.ts +++ b/src/sandbox/router/index.ts @@ -17,7 +17,7 @@ import { } from './location' import { createMicroHistory, - updateBrowserURL, + attachRouteToBrowserURL, rewriteHistoryState, } from './history' import { createURL } from '../../libs/utils' @@ -68,7 +68,7 @@ export function updateBrowserURLWithLocation ( // update microLocation with defaultPage if (defaultPage) updateMicroLocation(appName, defaultPage, microLocation, 'prevent') // attach microApp route info to browser URL - updateBrowserURL( + attachRouteToBrowserURL( setMicroPathToURL(appName, microLocation), setMicroState( appName, @@ -106,7 +106,7 @@ export function clearRouteStateFromURL ( * called on sandbox.stop or hidden of keep-alive app */ export function removeStateAndPathFromBrowser (appName: string): void { - updateBrowserURL( + attachRouteToBrowserURL( removeMicroPathFromURL(appName), removeMicroState(appName, globalEnv.rawWindow.history.state), ) diff --git a/typings/global.d.ts b/typings/global.d.ts index c0521fb33..7825e436b 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -7,6 +7,8 @@ declare module '@micro-app/types' { type microAppWindowType = Window & any + type appName = string + interface SandBoxInterface { proxyWindow: WindowProxy microAppWindow: Window // Proxy target @@ -339,10 +341,38 @@ declare module '@micro-app/types' { * @param guard global hook for */ afterEach(guard: RouterGuard): () => boolean - + /** + * Add defaultPage to control the first rendered page + * @param appName app name + * @param path default page path + */ setDefaultPage(appName: string, path: string): () => boolean + /** + * Clear data of defaultPage that set by setDefaultPage + */ removeDefaultPage(appName: string): boolean + /** + * Get defaultPage that set by setDefaultPage + */ getDefaultPage(key: PropertyKey): string | undefined + /** + * Attach specified active app router info to browser url + */ + attachToURL(appName: string): void + /** + * Attach all active app router info to browser url + */ + attachAllToURL(): void + /** + * Record base app router, let child app control base app navigation + * It is global data + * @param baseRouter router instance of base app + */ + setBaseAppRouter(baseRouter: unknown): void + /** + * get baseRouter from cache + */ + getBaseAppRouter(): unknown } // result of add/remove microApp path on browser url From ddd0ad55b1a291db18b4c0338d22efa729d111c9 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Fri, 8 Jul 2022 20:06:48 +0800 Subject: [PATCH 045/268] feat: test proxyDocument --- dev/children/vite/package.json | 1 + dev/children/vite/yarn.lock | 5 ++++ dev/children/vue2/public/layui/layui.js | 10 ++++---- src/sandbox/bind_function.ts | 13 +++++----- src/sandbox/index.ts | 32 +++++++++++++++++++++---- src/source/patch.ts | 7 ++++-- 6 files changed, 51 insertions(+), 17 deletions(-) diff --git a/dev/children/vite/package.json b/dev/children/vite/package.json index 89cf85140..848c32714 100644 --- a/dev/children/vite/package.json +++ b/dev/children/vite/package.json @@ -7,6 +7,7 @@ "serve": "vite preview" }, "dependencies": { + "esbuild-darwin-arm64": "^0.14.48", "vue": "^3.1.4", "vue-router": "^4.0.10" }, diff --git a/dev/children/vite/yarn.lock b/dev/children/vite/yarn.lock index d3e6d6aae..2d3ede769 100644 --- a/dev/children/vite/yarn.lock +++ b/dev/children/vite/yarn.lock @@ -148,6 +148,11 @@ esbuild-darwin-arm64@0.13.15: resolved "https://registry.npmmirror.com/esbuild-darwin-arm64/download/esbuild-darwin-arm64-0.13.15.tgz#1b07f893b632114f805e188ddfca41b2b778229a" integrity sha512-i1FZssTVxUqNlJ6cBTj5YQj4imWy3m49RZRnHhLpefFIh0To05ow9DTrXROTE1urGTQCloFUXTX8QfGJy1P8dQ== +esbuild-darwin-arm64@^0.14.48: + version "0.14.48" + resolved "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.48.tgz#4e5eaab54df66cc319b76a2ac0e8af4e6f0d9c2f" + integrity sha512-bFjnNEXjhZT+IZ8RvRGNJthLWNHV5JkCtuOFOnjvo5pC0sk2/QVk0Qc06g2PV3J0TcU6kaPC3RN9yy9w2PSLEA== + esbuild-freebsd-64@0.13.15: version "0.13.15" resolved "https://registry.npmmirror.com/esbuild-freebsd-64/download/esbuild-freebsd-64-0.13.15.tgz#0b8b7eca1690c8ec94c75680c38c07269c1f4a85" diff --git a/dev/children/vue2/public/layui/layui.js b/dev/children/vue2/public/layui/layui.js index 9bd087a34..00187fc9d 100755 --- a/dev/children/vue2/public/layui/layui.js +++ b/dev/children/vue2/public/layui/layui.js @@ -1,5 +1,5 @@ -/*! MIT Licensed */;!function(t){"use strict";var e=t.document,n={modules:{},status:{},timeout:10,event:{}},r=function(){this.v="2.6.8"},o=t.LAYUI_GLOBAL||{},a=function(){var t=e.currentScript?e.currentScript.src:function(){for(var t,n=e.scripts,r=n.length-1,o=r;o>0;o--)if("interactive"===n[o].readyState){t=n[o].src;break}return t||n[r].src}();return n.dir=o.dir||t.substring(0,t.lastIndexOf("/")+1)}(),i=function(e,n){n=n||"log",t.console&&console[n]&&console[n]("layui error hint: "+e)},u="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),l=n.builtin={lay:"lay",layer:"layer",laydate:"laydate",laypage:"laypage",laytpl:"laytpl",layedit:"layedit",form:"form",upload:"upload",dropdown:"dropdown",transfer:"transfer",tree:"tree",table:"table",element:"element",rate:"rate",colorpicker:"colorpicker",slider:"slider",carousel:"carousel",flow:"flow",util:"util",code:"code",jquery:"jquery",all:"all","layui.all":"layui.all"};r.prototype.cache=n,r.prototype.define=function(t,e){var r=this,o="function"==typeof t,a=function(){var t=function(t,e){layui[t]=e,n.status[t]=!0};return"function"==typeof e&&e(function(r,o){t(r,o),n.callback[r]=function(){e(t)}}),this};return o&&(e=t,t=[]),r.use(t,a,null,"define"),r},r.prototype.use=function(r,o,c,s){function p(t,e){var r="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===t.type||r.test((t.currentTarget||t.srcElement).readyState))&&(n.modules[h]=e,v.removeChild(b),function o(){return++m>1e3*n.timeout/4?i(h+" is not a valid module","error"):void(n.status[h]?f():setTimeout(o,4))}())}function f(){c.push(layui[h]),r.length>1?y.use(r.slice(1),o,c,s):"function"==typeof o&&function(){return layui.jquery&&"function"==typeof layui.jquery&&"define"!==s?layui.jquery(function(){o.apply(layui,c)}):void o.apply(layui,c)}()}var y=this,d=n.dir=n.dir?n.dir:a,v=e.getElementsByTagName("head")[0];r=function(){return"string"==typeof r?[r]:"function"==typeof r?(o=r,["all"]):r}(),t.jQuery&&jQuery.fn.on&&(y.each(r,function(t,e){"jquery"===e&&r.splice(t,1)}),layui.jquery=layui.$=jQuery);var h=r[0],m=0;if(c=c||[],n.host=n.host||(d.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===r.length||layui["layui.all"]&&l[h])return f(),y;var g=(l[h]?d+"modules/":/^\{\/\}/.test(y.modules[h])?"":n.base||"")+(y.modules[h]||h)+".js";if(g=g.replace(/^\{\/\}/,""),!n.modules[h]&&layui[h]&&(n.modules[h]=g),n.modules[h])!function S(){return++m>1e3*n.timeout/4?i(h+" is not a valid module","error"):void("string"==typeof n.modules[h]&&n.status[h]?f():setTimeout(S,4))}();else{var b=e.createElement("script");b.async=!0,b.charset="utf-8",b.src=g+function(){var t=n.version===!0?n.v||(new Date).getTime():n.version||"";return t?"?v="+t:""}(),v.appendChild(b),!b.attachEvent||b.attachEvent.toString&&b.attachEvent.toString().indexOf("[native code")<0||u?b.addEventListener("load",function(t){p(t,g)},!1):b.attachEvent("onreadystatechange",function(t){p(t,g)}),n.modules[h]=g}return y},r.prototype.getStyle=function(e,n){var r=e.currentStyle?e.currentStyle:t.getComputedStyle(e,null);return r[r.getPropertyValue?"getPropertyValue":"getAttribute"](n)},r.prototype.link=function(t,r,o){var a=this,u=e.getElementsByTagName("head")[0],l=e.createElement("link");"string"==typeof r&&(o=r);var c=(o||t).replace(/\.|\//g,""),s=l.id="layuicss-"+c,p="creating",f=0;return l.rel="stylesheet",l.href=t+(n.debug?"?v="+(new Date).getTime():""),l.media="all",e.getElementById(s)||u.appendChild(l),"function"!=typeof r?a:(function y(o){var u=100,l=e.getElementById(s);return++f>1e3*n.timeout/u?i(t+" timeout"):void(1989===parseInt(a.getStyle(l,"width"))?(o===p&&l.removeAttribute("lay-status"),l.getAttribute("lay-status")===p?setTimeout(y,u):r()):(l.setAttribute("lay-status",p),setTimeout(function(){y(p)},u)))}(),a)},r.prototype.addcss=function(t,e,r){return layui.link(n.dir+"css/"+t,e,r)},n.callback={},r.prototype.factory=function(t){if(layui[t])return"function"==typeof n.callback[t]?n.callback[t]:null},r.prototype.img=function(t,e,n){var r=new Image;return r.src=t,r.complete?e(r):(r.onload=function(){r.onload=null,"function"==typeof e&&e(r)},void(r.onerror=function(t){r.onerror=null,"function"==typeof n&&n(t)}))},r.prototype.config=function(t){t=t||{};for(var e in t)n[e]=t[e];return this},r.prototype.modules=function(){var t={};for(var e in l)t[e]=l[e];return t}(),r.prototype.extend=function(t){var e=this;t=t||{};for(var n in t)e[n]||e.modules[n]?i(n+" Module already exists","error"):e.modules[n]=t[n];return e},r.prototype.router=function(t){var e=this,t=t||location.hash,n={path:[],search:{},hash:(t.match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(t)?(t=t.replace(/^#\//,""),n.href="/"+t,t=t.replace(/([^#])(#.*$)/,"$1").split("/")||[],e.each(t,function(t,e){/^\w+=/.test(e)?function(){e=e.split("="),n.search[e[0]]=e[1]}():n.path.push(e)}),n):n},r.prototype.url=function(t){var e=this,n={pathname:function(){var e=t?function(){var e=(t.match(/\.[^.]+?\/.+/)||[])[0]||"";return e.replace(/^[^\/]+/,"").replace(/\?.+/,"")}():location.pathname;return e.replace(/^\//,"").split("/")}(),search:function(){var n={},r=(t?function(){var e=(t.match(/\?.+/)||[])[0]||"";return e.replace(/\#.+/,"")}():location.search).replace(/^\?+/,"").split("&");return e.each(r,function(t,e){var r=e.indexOf("="),o=function(){return r<0?e.substr(0,e.length):0!==r&&e.substr(0,r)}();o&&(n[o]=r>0?e.substr(r+1):null)}),n}(),hash:e.router(function(){return t?(t.match(/#.+/)||[])[0]||"/":location.hash}())};return n},r.prototype.data=function(e,n,r){if(e=e||"layui",r=r||localStorage,t.JSON&&t.JSON.parse){if(null===n)return delete r[e];n="object"==typeof n?n:{key:n};try{var o=JSON.parse(r[e])}catch(a){var o={}}return"value"in n&&(o[n.key]=n.value),n.remove&&delete o[n.key],r[e]=JSON.stringify(o),n.key?o[n.key]:o}},r.prototype.sessionData=function(t,e){return this.data(t,e,sessionStorage)},r.prototype.device=function(e){var n=navigator.userAgent.toLowerCase(),r=function(t){var e=new RegExp(t+"/([^\\s\\_\\-]+)");return t=(n.match(e)||[])[1],t||!1},o={os:function(){return/windows/.test(n)?"windows":/linux/.test(n)?"linux":/iphone|ipod|ipad|ios/.test(n)?"ios":/mac/.test(n)?"mac":void 0}(),ie:function(){return!!(t.ActiveXObject||"ActiveXObject"in t)&&((n.match(/msie\s(\d+)/)||[])[1]||"11")}(),weixin:r("micromessenger")};return e&&!o[e]&&(o[e]=r(e)),o.android=/android/.test(n),o.ios="ios"===o.os,o.mobile=!(!o.android&&!o.ios),o},r.prototype.hint=function(){return{error:i}},r.prototype._typeof=function(t){return null===t?String(t):"object"==typeof t||"function"==typeof t?function(){var e=Object.prototype.toString.call(t).match(/\s(.+)\]$/)||[],n="Function|Array|Date|RegExp|Object|Error|Symbol";return e=e[1]||"Object",new RegExp("\\b("+n+")\\b").test(e)?e.toLowerCase():"object"}():typeof t},r.prototype._isArray=function(e){var n,r=this,o=r._typeof(e);return!(!e||"object"!=typeof e||e===t)&&(n="length"in e&&e.length,"array"===o||0===n||"number"==typeof n&&n>0&&n-1 in e)},r.prototype.each=function(t,e){var n,r=this,o=function(t,n){return e.call(n[t],t,n[t])};if("function"!=typeof e)return r;if(t=t||[],r._isArray(t))for(n=0;no?1:r(t.innerHeight||n.documentElement.clientHeight)},r.position=function(e,o,i){if(o){i=i||{},e!==n&&e!==r("body")[0]||(i.clickType="right");var c="right"===i.clickType?function(){var e=i.e||t.event||{};return{left:e.clientX,top:e.clientY,right:e.clientX,bottom:e.clientY}}():e.getBoundingClientRect(),u=o.offsetWidth,a=o.offsetHeight,f=function(t){return t=t?"scrollLeft":"scrollTop",n.body[t]|n.documentElement[t]},s=function(t){return n.documentElement[t?"clientWidth":"clientHeight"]},l=5,h=c.left,p=c.bottom;"center"===i.align?h-=(u-e.offsetWidth)/2:"right"===i.align&&(h=h-u+e.offsetWidth),h+u+l>s("width")&&(h=s("width")-u-l),hs()&&(c.top>a+l?p=c.top-a-2*l:"right"===i.clickType&&(p=s()-a-2*l,p<0&&(p=0)));var y=i.position;if(y&&(o.style.position=y),o.style.left=h+("fixed"===y?0:f(1))+"px",o.style.top=p+("fixed"===y?0:f())+"px",!r.hasScrollbar()){var d=o.getBoundingClientRect();!i.SYSTEM_RELOAD&&d.bottom+l>s()&&(i.SYSTEM_RELOAD=!0,setTimeout(function(){r.position(e,o,i)},50))}}},r.options=function(t,e){var n=r(t),o=e||"lay-options";try{return new Function("return "+(n.attr(o)||"{}"))()}catch(i){return hint.error("parseerror\uff1a"+i,"error"),{}}},r.isTopElem=function(t){var e=[n,r("body")[0]],o=!1;return r.each(e,function(e,n){if(n===t)return o=!0}),o},o.addStr=function(t,e){return t=t.replace(/\s+/," "),e=e.replace(/\s+/," ").split(" "),r.each(e,function(e,n){new RegExp("\\b"+n+"\\b").test(t)||(t=t+" "+n)}),t.replace(/^\s|\s$/,"")},o.removeStr=function(t,e){return t=t.replace(/\s+/," "),e=e.replace(/\s+/," ").split(" "),r.each(e,function(e,n){var r=new RegExp("\\b"+n+"\\b");r.test(t)&&(t=t.replace(r,""))}),t.replace(/\s+/," ").replace(/^\s|\s$/,"")},o.prototype.find=function(t){var e=this,n=0,o=[],i="object"==typeof t;return this.each(function(r,c){for(var u=i?c.contains(t):c.querySelectorAll(t||null);n0)return n[0].style[t]}():n.each(function(n,i){"object"==typeof t?r.each(t,function(t,e){i.style[t]=o(e)}):i.style[t]=o(e)})},o.prototype.width=function(t){var e=this;return void 0===t?function(){if(e.length>0)return e[0].offsetWidth}():e.each(function(n,r){e.css("width",t)})},o.prototype.height=function(t){var e=this;return void 0===t?function(){if(e.length>0)return e[0].offsetHeight}():e.each(function(n,r){e.css("height",t)})},o.prototype.attr=function(t,e){var n=this;return void 0===e?function(){if(n.length>0)return n[0].getAttribute(t)}():n.each(function(n,r){r.setAttribute(t,e)})},o.prototype.removeAttr=function(t){return this.each(function(e,n){n.removeAttribute(t)})},o.prototype.html=function(t){var e=this;return void 0===t?function(){if(e.length>0)return e[0].innerHTML}():this.each(function(e,n){n.innerHTML=t})},o.prototype.val=function(t){var e=this;return void 0===t?function(){if(e.length>0)return e[0].value}():this.each(function(e,n){n.value=t})},o.prototype.append=function(t){return this.each(function(e,n){"object"==typeof t?n.appendChild(t):n.innerHTML=n.innerHTML+t})},o.prototype.remove=function(t){return this.each(function(e,n){t?n.removeChild(t):n.parentNode.removeChild(n)})},o.prototype.on=function(t,e){return this.each(function(n,r){r.attachEvent?r.attachEvent("on"+t,function(t){t.target=t.srcElement,e.call(r,t)}):r.addEventListener(t,e,!1)})},o.prototype.off=function(t,e){return this.each(function(n,r){r.detachEvent?r.detachEvent("on"+t,e):r.removeEventListener(t,e,!1)})},t.lay=r,t.layui&&layui.define&&layui.define(function(t){t(e,r)})}(window,window.document);layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error: ";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\(.)/g,"$1")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\(.)/g,"$1")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)});layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?''+a.prev+"":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push(''+(a.first||1)+"");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r2&&e.push('');r<=u;r++)r===a.curr?e.push('"+r+""):e.push(''+r+"");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1…'),0!==t&&e.push(''+(a.last||a.pages)+"")),e.join("")}(),next:function(){return a.next?''+a.next+"":""}(),count:'\u5171 '+a.count+" \u6761",limit:function(){var e=['"}(),refresh:['','',""].join(""),skip:function(){return['到第','','页',""].join("")}()};return['
',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"
"].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;oi.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)});!function(e,t){"use strict";var a=e.layui&&layui.define,n={getPath:e.lay&&lay.getPath?lay.getPath:"",link:function(t,a,n){l.path&&e.lay&&lay.layui&&lay.layui.link(l.path+t,a,n)}},i=e.LAYUI_GLOBAL||{},l={v:"5.3.1",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:i.laydate_dir||n.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var t="laydate",i="",r=(a?"modules/laydate/":"theme/")+"default/laydate.css?v="+l.v+i;return a?layui.addcss(r,e,t):n.link(r,e,t),this}},r=function(){var e=this,t=e.config,a=t.id;return r.that[a]=e,{hint:function(t){e.hint.call(e,t)},config:e.config}},o="laydate",s=".layui-laydate",y="layui-this",d="laydate-disabled",m=[100,2e5],c="layui-laydate-static",u="layui-laydate-list",h="layui-laydate-hint",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v="laydate-btns-time",T="layui-laydate-preview",D=function(e){var t=this;t.index=++l.index,t.config=lay.extend({},t.config,l.config,e),e=t.config,e.id="id"in e?e.id:t.index,l.ready(function(){t.init()})},w="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s";r.formatArr=function(e){return(e||"").match(new RegExp(w+"|.","g"))||[]},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"click",show:!1,showBottom:!0,isPreview:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,a={cn:{weeks:["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"],time:["\u65f6","\u5206","\u79d2"],timeTips:"\u9009\u62e9\u65f6\u95f4",startTime:"\u5f00\u59cb\u65f6\u95f4",endTime:"\u7ed3\u675f\u65f6\u95f4",dateTips:"\u8fd4\u56de\u65e5\u671f",month:["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"],tools:{confirm:"\u786e\u5b9a",clear:"\u6e05\u7a7a",now:"\u73b0\u5728"},timeout:"\u7ed3\u675f\u65f6\u95f4\u4e0d\u80fd\u65e9\u4e8e\u5f00\u59cb\u65f6\u95f4
\u8bf7\u91cd\u65b0\u9009\u62e9",invalidDate:"\u4e0d\u5728\u6709\u6548\u65e5\u671f\u6216\u65f6\u95f4\u8303\u56f4\u5185",formatError:["\u65e5\u671f\u683c\u5f0f\u4e0d\u5408\u6cd5
\u5fc5\u987b\u9075\u5faa\u4e0b\u8ff0\u683c\u5f0f\uff1a
","
\u5df2\u4e3a\u4f60\u91cd\u7f6e"],preview:"\u5f53\u524d\u9009\u4e2d\u7684\u7ed3\u679c"},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"},timeout:"End time cannot be less than start Time
Please re-select",invalidDate:"Invalid date",formatError:["The date format error
Must be followed\uff1a
","
It has been reset"],preview:"The selected result"}};return a[t.lang]||a.cn},D.prototype.init=function(){var t=this,a=t.config,n="static"===a.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};a.elem=lay(a.elem),a.eventElem=lay(a.eventElem),a.elem[0]&&(t.rangeStr=a.range?"string"==typeof a.range?a.range:"-":"","array"===layui._typeof(a.range)&&(t.rangeElem=[lay(a.range[0]),lay(a.range[1])]),i[a.type]||(e.console&&console.error&&console.error("laydate type error:'"+a.type+"' is not supported"),a.type="date"),a.format===i.date&&(a.format=i[a.type]||i.date),t.format=r.formatArr(a.format),t.EXP_IF="",t.EXP_SPLIT="",lay.each(t.format,function(e,a){var n=new RegExp(w).test(a)?"\\d{"+function(){return new RegExp(w).test(t.format[0===e?e+1:e-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;t.EXP_IF=t.EXP_IF+n,t.EXP_SPLIT=t.EXP_SPLIT+"("+n+")"}),t.EXP_IF_ONE=new RegExp("^"+t.EXP_IF+"$"),t.EXP_IF=new RegExp("^"+(a.range?t.EXP_IF+"\\s\\"+t.rangeStr+"\\s"+t.EXP_IF:t.EXP_IF)+"$"),t.EXP_SPLIT=new RegExp("^"+t.EXP_SPLIT+"$",""),t.isInput(a.elem[0])||"focus"===a.trigger&&(a.trigger="click"),a.elem.attr("lay-key")||(a.elem.attr("lay-key",t.index),a.eventElem.attr("lay-key",t.index)),a.mark=lay.extend({},a.calendar&&"cn"===a.lang?{"0-1-1":"\u5143\u65e6","0-2-14":"\u60c5\u4eba","0-3-8":"\u5987\u5973","0-3-12":"\u690d\u6811","0-4-1":"\u611a\u4eba","0-5-1":"\u52b3\u52a8","0-5-4":"\u9752\u5e74","0-6-1":"\u513f\u7ae5","0-9-10":"\u6559\u5e08","0-9-18":"\u56fd\u803b","0-10-1":"\u56fd\u5e86","0-12-25":"\u5723\u8bde"}:{},a.mark),lay.each(["min","max"],function(e,t){var n=[],i=[];if("number"==typeof a[t]){var l=a[t],r=(new Date).getTime(),o=864e5,s=new Date(l?l0)return!0;var t=lay.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),a=lay.elem("span");return e.appendChild(t),e.appendChild(a),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],l=lay.elem("div",{"class":"layui-laydate-content"}),r=lay.elem("table"),m=lay.elem("thead"),c=lay.elem("tr");lay.each(i,function(e,a){t.appendChild(a)}),m.appendChild(c),lay.each(new Array(6),function(e){var t=r.insertRow(0);lay.each(new Array(7),function(a){if(0===e){var i=lay.elem("th");i.innerHTML=n.weeks[a],c.appendChild(i)}t.insertCell(a)})}),r.insertBefore(m,r.children[0]),l.appendChild(r),o[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),o[e].appendChild(t),o[e].appendChild(l),s.push(i),y.push(l),d.push(r)}),lay(m).html(function(){var e=[],t=[];return"datetime"===a.type&&e.push(''+n.timeTips+""),(a.range||"datetime"!==a.type)&&e.push(''),lay.each(a.btns,function(e,l){var r=n.tools[l]||"btn";a.range&&"now"===l||(i&&"clear"===l&&(r="cn"===a.lang?"\u91cd\u7f6e":"Reset"),t.push(''+r+""))}),e.push('"),e.join("")}()),lay.each(o,function(e,t){r.appendChild(t)}),a.showBottom&&r.appendChild(m),/^#/.test(a.theme)){var u=lay.elem("style"),h=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,a.theme);"styleSheet"in u?(u.setAttribute("type","text/css"),u.styleSheet.cssText=h):u.innerHTML=h,lay(r).addClass("laydate-theme-molv"),r.appendChild(u)}l.thisId=a.id,e.remove(D.thisElemDate),i?a.elem.append(r):(t.body.appendChild(r),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),D.thisElemDate=e.elemID,"function"==typeof a.ready&&a.ready(lay.extend({},a.dateTime,{month:a.dateTime.month+1})),e.preview()},D.prototype.remove=function(e){var t=this,a=(t.config,lay("#"+(e||t.elemID)));return a[0]?(a.hasClass(c)||t.checkDate(function(){a.remove()}),t):t},D.prototype.position=function(){var e=this,t=e.config;return lay.position(e.bindElem||t.elem[0],e.elem,{position:t.position}),e},D.prototype.hint=function(e){var t=this,a=(t.config,lay.elem("div",{"class":h}));t.elem&&(a.innerHTML=e||"",lay(t.elem).find("."+h).remove(),t.elem.appendChild(a),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+h).remove()},3e3))},D.prototype.getAsYM=function(e,t,a){return a?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,n=this,i=(new Date,n.config),r=n.lang(),o=i.dateTime=i.dateTime||n.systemDate(),s=n.bindElem||i.elem[0],y=(n.isInput(s)?"val":"html",function(){if(n.rangeElem){var e=[n.rangeElem[0].val(),n.rangeElem[1].val()];if(e[0]&&e[1])return e.join(" "+n.rangeStr+" ")}return n.isInput(s)?s.value:"static"===i.position?"":lay(s).attr("lay-date")}()),d=function(e){e.year>m[1]&&(e.year=m[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=l.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},c=function(e,t,l){var r=["startTime","endTime"];t=(t.match(n.EXP_SPLIT)||[]).slice(1),l=l||0,i.range&&(n[r[l]]=n[r[l]]||{}),lay.each(n.format,function(o,s){var y=parseFloat(t[o]);t[o].lengthh(i.max)||h(o)h(i.max))&&(n.endDate=lay.extend({},i.max)),e&&e(),n},D.prototype.mark=function(e,t){var a,n=this,i=n.config;return lay.each(i.mark,function(e,n){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(a=n||t[2])}),a&&e.html(''+a+""),n},D.prototype.limit=function(e,t,a,n){var i,l=this,r=l.config,o={},s=r[a>41?"endDate":"dateTime"],y=lay.extend({},s,t||{});return lay.each({now:y,min:r.min,max:r.max},function(e,t){o[e]=l.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(n,function(a,n){e[n]=t[n]}),e}())).getTime()}),i=o.nowo.max,e&&e[i?"addClass":"removeClass"](d),i},D.prototype.thisDateTime=function(e){var t=this,a=t.config;return e?t.endDate:a.dateTime},D.prototype.calendar=function(e,t,a){var n,i,r,o=this,s=o.config,t=t?1:0,d=e||o.thisDateTime(t),c=new Date,u=o.lang(),h="date"!==s.type&&"datetime"!==s.type,f=lay(o.table[t]).find("td"),g=lay(o.elemHeader[t][2]).find("span");return d.yearm[1]&&(d.year=m[1],o.hint(u.invalidDate)),o.firstDate||(o.firstDate=lay.extend({},d)),c.setFullYear(d.year,d.month,1),n=c.getDay(),i=l.getEndDate(d.month||12,d.year),r=l.getEndDate(d.month+1,d.year),lay.each(f,function(e,t){var a=[d.year,d.month],l=0;t=lay(t),t.removeAttr("class"),e=n&&e=a.firstDate.year&&(l.month=n.max.month,l.date=n.max.date),a.limit(lay(i),l,t),M++}),lay(m[f?0:1]).attr("lay-ym",M-8+"-"+D[1]).html(E+T+" - "+(M-1+T))}else if("month"===e)lay.each(new Array(12),function(e){var i=lay.elem("li",{"lay-ym":e}),r={year:D[0],month:e};e+1==D[1]&&lay(i).addClass(y),i.innerHTML=l.month[e]+(f?"\u6708":""),o.appendChild(i),D[0]=a.firstDate.year&&(r.date=n.max.date),a.limit(lay(i),r,t)}),lay(m[f?0:1]).attr("lay-ym",D[0]+"-"+D[1]).html(D[0]+T);else if("time"===e){var C=function(){lay(o).find("ol").each(function(e,n){lay(n).find("li").each(function(n,i){a.limit(lay(i),[{hours:n},{hours:a[x].hours,minutes:n},{hours:a[x].hours,minutes:a[x].minutes,seconds:n}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),n.range||a.limit(lay(a.footer).find(p),a[x],0,["hours","minutes","seconds"])};n.range?a[x]||(a[x]="startTime"===x?i:a.endDate):a[x]=i,lay.each([24,60,60],function(e,t){var n=lay.elem("li"),i=["

"+l.time[e]+"

    "];lay.each(new Array(t),function(t){i.push(""+lay.digit(t,2)+"")}),n.innerHTML=i.join("")+"
",o.appendChild(n)}),C()}if(h&&c.removeChild(h),c.appendChild(o),"year"===e||"month"===e)lay(a.elemMain[t]).addClass("laydate-ym-show"),lay(o).find("li").on("click",function(){var l=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(d)){0===t?(i[e]=l,a.limit(lay(a.footer).find(p),null,0)):a.endDate[e]=l;var s="year"===n.type||"month"===n.type;s?(lay(o).find("."+y).removeClass(y),lay(this).addClass(y),"month"===n.type&&"year"===e&&(a.listYM[t][0]=l,r&&((t?a.endDate:i).year=l),a.list("month",t))):(a.checkDate("limit").calendar(null,t),a.closeList()),a.setBtnStatus(),n.range||("month"===n.type&&"month"===e||"year"===n.type&&"year"===e)&&a.setValue(a.parse()).remove().done(),a.done(null,"change"),lay(a.footer).find("."+v).removeClass(d)}});else{var I=lay.elem("span",{"class":g}),k=function(){lay(o).find("ol").each(function(e){var t=this,n=lay(t).find("li");t.scrollTop=30*(a[x][w[e]]-2),t.scrollTop<=0&&n.each(function(e,a){if(!lay(this).hasClass(d))return t.scrollTop=30*(e-2),!0})})},b=lay(s[2]).find("."+g);k(),I.innerHTML=n.range?[l.startTime,l.endTime][t]:l.timeTips,lay(a.elemMain[t]).addClass("laydate-time-show"),b[0]&&b.remove(),s[2].appendChild(I),lay(o).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var l=0|this.innerHTML;lay(this).hasClass(d)||(n.range?a[x][w[e]]=l:i[w[e]]=l,lay(t).find("."+y).removeClass(y),lay(this).addClass(y),C(),k(),(a.endDate||"time"===n.type)&&a.done(null,"change"),a.setBtnStatus())})})}return a},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,a){lay(this).find("."+u).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,a){var n,i=this,l=i.config,r=i.lang(),o=lay(i.footer).find(p);l.range&&"time"!==l.type&&(t=t||l.dateTime,a=a||i.endDate,n=i.newDate(t).getTime()>i.newDate(a).getTime(),i.limit(null,t)||i.limit(null,a)?o.addClass(d):o[n?"addClass":"removeClass"](d),e&&n&&i.hint("string"==typeof e?r.timeout.replace(/\u65e5\u671f/g,e):r.timeout))},D.prototype.parse=function(e,t){var a=this,n=a.config,i=t||("end"==e?lay.extend({},a.endDate,a.endTime):n.range?lay.extend({},n.dateTime,a.startTime):n.dateTime),r=l.parse(i,a.format,1);return n.range&&void 0===e?r+" "+a.rangeStr+" "+a.parse("end"):r},D.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,a=t.config,n=t.bindElem||a.elem[0];return"static"===a.position?t:(e=e||"",t.isInput(n)?lay(n).val(e):t.rangeElem?(t.rangeElem[0].val(e?t.parse("start"):""),t.rangeElem[1].val(e?t.parse("end"):"")):(0===lay(n).find("*").length&&lay(n).html(e),lay(n).attr("lay-date",e)),t)},D.prototype.preview=function(){var e=this,t=e.config;if(t.isPreview){var a=lay(e.elem).find("."+T),n=t.range?e.endDate?e.parse():"":e.parse();a.html(n).css({color:"#5FB878"}),setTimeout(function(){a.css({color:"#666"})},300)}},D.prototype.done=function(e,t){var a=this,n=a.config,i=lay.extend({},lay.extend(n.dateTime,a.startTime)),l=lay.extend({},lay.extend(a.endDate,a.endTime));return lay.each([i,l],function(e,t){"month"in t&&lay.extend(t,{month:t.month+1})}),a.preview(),e=e||[a.parse(),i,l],"function"==typeof n[t||"done"]&&n[t||"done"].apply(n,e),a},D.prototype.choose=function(e,t){var a=this,n=a.config,i=a.thisDateTime(t),l=(lay(a.elem).find("td"),e.attr("lay-ymd").split("-"));l={year:0|l[0],month:(0|l[1])-1,date:0|l[2]},e.hasClass(d)||(lay.extend(i,l),n.range?(lay.each(["startTime","endTime"],function(e,t){a[t]=a[t]||{hours:0,minutes:0,seconds:0}}),a.calendar(null,t).done(null,"change")):"static"===n.position?a.calendar().done().done(null,"change"):"date"===n.type?a.setValue(a.parse()).remove().done():"datetime"===n.type&&a.calendar().done(null,"change"))},D.prototype.tool=function(e,t){var a=this,n=a.config,i=a.lang(),l=n.dateTime,r="static"===n.position,o={datetime:function(){lay(e).hasClass(d)||(a.list("time",0),n.range&&a.list("time",1),lay(e).attr("lay-type","date").html(a.lang().dateTips))},date:function(){a.closeList(),lay(e).attr("lay-type","datetime").html(a.lang().timeTips)},clear:function(){r&&(lay.extend(l,a.firstDate),a.calendar()),n.range&&(delete n.dateTime,delete a.endDate,delete a.startTime,delete a.endTime),a.setValue("").remove(),a.done(["",{},{}])},now:function(){var e=new Date;lay.extend(l,a.systemDate(),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}),a.setValue(a.parse()).remove(),r&&a.calendar(),a.done()},confirm:function(){if(n.range){if(lay(e).hasClass(d))return a.hint("time"===n.type?i.timeout.replace(/\u65e5\u671f/g,"\u65f6\u95f4"):i.timeout)}else if(lay(e).hasClass(d))return a.hint(i.invalidDate);a.done(),a.setValue(a.parse()).remove()}};o[t]&&o[t]()},D.prototype.change=function(e){var t=this,a=t.config,n=t.thisDateTime(e),i=a.range&&("year"===a.type||"month"===a.type),l=t.elemCont[e||0],r=t.listYM[e],o=function(o){var s=lay(l).find(".laydate-year-list")[0],y=lay(l).find(".laydate-month-list")[0];return s&&(r[0]=o?r[0]-15:r[0]+15,t.list("year",e)),y&&(o?r[0]--:r[0]++,t.list("month",e)),(s||y)&&(lay.extend(n,{year:r[0]}),i&&(n.year=r[0]),a.range||t.done(null,"change"),a.range||t.limit(lay(t.footer).find(p),{year:r[0]})),t.setBtnStatus(),s||y};return{prevYear:function(){o("sub")||(n.year--,t.checkDate("limit").calendar(null,e),t.done(null,"change"))},prevMonth:function(){var a=t.getAsYM(n.year,n.month,"sub");lay.extend(n,{year:a[0],month:a[1]}),t.checkDate("limit").calendar(null,e),t.done(null,"change")},nextMonth:function(){var a=t.getAsYM(n.year,n.month);lay.extend(n,{year:a[0],month:a[1]}),t.checkDate("limit").calendar(null,e),t.done(null,"change")},nextYear:function(){o()||(n.year++,t.checkDate("limit").calendar(null,e),t.done(null,"change"))}}},D.prototype.changeEvent=function(){var e=this;e.config;lay(e.elem).on("click",function(e){lay.stope(e)}).on("mousedown",function(e){lay.stope(e)}),lay.each(e.elemHeader,function(t,a){lay(a[0]).on("click",function(a){e.change(t).prevYear()}),lay(a[1]).on("click",function(a){e.change(t).prevMonth()}),lay(a[2]).find("span").on("click",function(a){var n=lay(this),i=n.attr("lay-ym"),l=n.attr("lay-type");i&&(i=i.split("-"),e.listYM[t]=[0|i[0],0|i[1]],e.list(l,t),lay(e.footer).find("."+v).addClass(d))}),lay(a[3]).on("click",function(a){e.change(t).nextMonth()}),lay(a[4]).on("click",function(a){e.change(t).nextYear()})}),lay.each(e.table,function(t,a){var n=lay(a).find("td");n.on("click",function(){e.choose(lay(this),t)})}),lay(e.footer).find("span").on("click",function(){var t=lay(this).attr("lay-type");e.tool(this,t)})},D.prototype.isInput=function(e){return/input|textarea/.test(e.tagName.toLocaleLowerCase())},D.prototype.events=function(){var e=this,t=e.config,a=function(a,n){a.on(t.trigger,function(){n&&(e.bindElem=this),e.render()})};t.elem[0]&&!t.elem[0].eventHandler&&(a(t.elem,"bind"),a(t.eventElem),t.elem[0].eventHandler=!0)},r.that={},r.getThis=function(e){var t=r.that[e];return!t&&a&&layui.hint().error(e?o+" instance with ID '"+e+"' not found":"ID argument required"),t},n.run=function(a){a(t).on("mousedown",function(e){if(l.thisId){var t=r.getThis(l.thisId);if(t){var n=t.config;e.target!==n.elem[0]&&e.target!==n.eventElem[0]&&e.target!==a(n.closeStop)[0]&&t.remove()}}}).on("keydown",function(e){if(l.thisId){var t=r.getThis(l.thisId);t&&13===e.keyCode&&a("#"+t.elemID)[0]&&t.elemID===D.thisElemDate&&(e.preventDefault(),a(t.footer).find(p)[0].click())}}),a(e).on("resize",function(){if(l.thisId){var e=r.getThis(l.thisId);if(e)return!(!e.elem||!a(s)[0])&&void e.position()}})},l.render=function(e){var t=new D(e);return r.call(t)},l.parse=function(e,t,a){return e=e||{},"string"==typeof t&&(t=r.formatArr(t)),t=(t||[]).concat(),lay.each(t,function(n,i){/yyyy|y/.test(i)?t[n]=lay.digit(e.year,i.length):/MM|M/.test(i)?t[n]=lay.digit(e.month+(a||0),i.length):/dd|d/.test(i)?t[n]=lay.digit(e.date,i.length):/HH|H/.test(i)?t[n]=lay.digit(e.hours,i.length):/mm|m/.test(i)?t[n]=lay.digit(e.minutes,i.length):/ss|s/.test(i)&&(t[n]=lay.digit(e.seconds,i.length))}),t.join("")},l.getEndDate=function(e,t){var a=new Date;return a.setFullYear(t||a.getFullYear(),e||a.getMonth()+1,1),new Date(a.getTime()-864e5).getDate()},a?(l.ready(),layui.define("lay",function(e){l.path=layui.cache.dir,n.run(lay),e(o,l)})):"function"==typeof define&&define.amd?define(function(){return n.run(lay),l}):function(){l.ready(),n.run(e.lay),e.laydate=l}()}(window,window.document);!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t=!!e&&"length"in e&&e.length,n=pe.type(e);return"function"!==n&&!pe.isWindow(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function r(e,t,n){if(pe.isFunction(t))return pe.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return pe.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(Ce.test(t))return pe.filter(t,e,n);t=pe.filter(t,e)}return pe.grep(e,function(e){return pe.inArray(e,t)>-1!==n})}function i(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function o(e){var t={};return pe.each(e.match(De)||[],function(e,n){t[n]=!0}),t}function a(){re.addEventListener?(re.removeEventListener("DOMContentLoaded",s),e.removeEventListener("load",s)):(re.detachEvent("onreadystatechange",s),e.detachEvent("onload",s))}function s(){(re.addEventListener||"load"===e.event.type||"complete"===re.readyState)&&(a(),pe.ready())}function u(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(_e,"-$1").toLowerCase();if(n=e.getAttribute(r),"string"==typeof n){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:qe.test(n)?pe.parseJSON(n):n)}catch(i){}pe.data(e,t,n)}else n=void 0}return n}function l(e){var t;for(t in e)if(("data"!==t||!pe.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function c(e,t,n,r){if(He(e)){var i,o,a=pe.expando,s=e.nodeType,u=s?pe.cache:e,l=s?e[a]:e[a]&&a;if(l&&u[l]&&(r||u[l].data)||void 0!==n||"string"!=typeof t)return l||(l=s?e[a]=ne.pop()||pe.guid++:a),u[l]||(u[l]=s?{}:{toJSON:pe.noop}),"object"!=typeof t&&"function"!=typeof t||(r?u[l]=pe.extend(u[l],t):u[l].data=pe.extend(u[l].data,t)),o=u[l],r||(o.data||(o.data={}),o=o.data),void 0!==n&&(o[pe.camelCase(t)]=n),"string"==typeof t?(i=o[t],null==i&&(i=o[pe.camelCase(t)])):i=o,i}}function f(e,t,n){if(He(e)){var r,i,o=e.nodeType,a=o?pe.cache:e,s=o?e[pe.expando]:pe.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){pe.isArray(t)?t=t.concat(pe.map(t,pe.camelCase)):t in r?t=[t]:(t=pe.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;for(;i--;)delete r[t[i]];if(n?!l(r):!pe.isEmptyObject(r))return}(n||(delete a[s].data,l(a[s])))&&(o?pe.cleanData([e],!0):fe.deleteExpando||a!=a.window?delete a[s]:a[s]=void 0)}}}function d(e,t,n,r){var i,o=1,a=20,s=r?function(){return r.cur()}:function(){return pe.css(e,t,"")},u=s(),l=n&&n[3]||(pe.cssNumber[t]?"":"px"),c=(pe.cssNumber[t]||"px"!==l&&+u)&&Me.exec(pe.css(e,t));if(c&&c[3]!==l){l=l||c[3],n=n||[],c=+u||1;do o=o||".5",c/=o,pe.style(e,t,c+l);while(o!==(o=s()/u)&&1!==o&&--a)}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}function p(e){var t=ze.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function h(e,t){var n,r,i=0,o="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(r=n[i]);i++)!t||pe.nodeName(r,t)?o.push(r):pe.merge(o,h(r,t));return void 0===t||t&&pe.nodeName(e,t)?pe.merge([e],o):o}function g(e,t){for(var n,r=0;null!=(n=e[r]);r++)pe._data(n,"globalEval",!t||pe._data(t[r],"globalEval"))}function m(e){Be.test(e.type)&&(e.defaultChecked=e.checked)}function y(e,t,n,r,i){for(var o,a,s,u,l,c,f,d=e.length,y=p(t),v=[],x=0;x"!==f[1]||Ve.test(a)?0:u:u.firstChild,o=a&&a.childNodes.length;o--;)pe.nodeName(c=a.childNodes[o],"tbody")&&!c.childNodes.length&&a.removeChild(c);for(pe.merge(v,u.childNodes),u.textContent="";u.firstChild;)u.removeChild(u.firstChild);u=y.lastChild}else v.push(t.createTextNode(a));for(u&&y.removeChild(u),fe.appendChecked||pe.grep(h(v,"input"),m),x=0;a=v[x++];)if(r&&pe.inArray(a,r)>-1)i&&i.push(a);else if(s=pe.contains(a.ownerDocument,a),u=h(y.appendChild(a),"script"),s&&g(u),n)for(o=0;a=u[o++];)Ie.test(a.type||"")&&n.push(a);return u=null,y}function v(){return!0}function x(){return!1}function b(){try{return re.activeElement}catch(e){}}function w(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)w(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),i===!1)i=x;else if(!i)return e;return 1===o&&(a=i,i=function(e){return pe().off(e),a.apply(this,arguments)},i.guid=a.guid||(a.guid=pe.guid++)),e.each(function(){pe.event.add(this,t,i,r,n)})}function T(e,t){return pe.nodeName(e,"table")&&pe.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function C(e){return e.type=(null!==pe.find.attr(e,"type"))+"/"+e.type,e}function E(e){var t=it.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function N(e,t){if(1===t.nodeType&&pe.hasData(e)){var n,r,i,o=pe._data(e),a=pe._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;r1&&"string"==typeof p&&!fe.checkClone&&rt.test(p))return e.each(function(i){var o=e.eq(i);g&&(t[0]=p.call(this,i,o.html())),S(o,t,n,r)});if(f&&(l=y(t,e[0].ownerDocument,!1,e,r),i=l.firstChild,1===l.childNodes.length&&(l=i),i||r)){for(s=pe.map(h(l,"script"),C),a=s.length;c")).appendTo(t.documentElement),t=(ut[0].contentWindow||ut[0].contentDocument).document,t.write(),t.close(),n=D(e,t),ut.detach()),lt[e]=n),n}function L(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function H(e){if(e in Et)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=Ct.length;n--;)if(e=Ct[n]+t,e in Et)return e}function q(e,t){for(var n,r,i,o=[],a=0,s=e.length;a=0&&n=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==pe.type(e)||e.nodeType||pe.isWindow(e))return!1;try{if(e.constructor&&!ce.call(e,"constructor")&&!ce.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}if(!fe.ownFirst)for(t in e)return ce.call(e,t);for(t in e);return void 0===t||ce.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?ue[le.call(e)]||"object":typeof e},globalEval:function(t){t&&pe.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(ge,"ms-").replace(me,ye)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var r,i=0;if(n(e))for(r=e.length;iT.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[P]=!0,e}function i(e){var t=H.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=n.length;r--;)T.attrHandle[n[r]]=t}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||V)-(~e.sourceIndex||V);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function u(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function l(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function c(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function f(){}function d(e){for(var t=0,n=e.length,r="";t1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function g(e,n,r){for(var i=0,o=n.length;i-1&&(r[l]=!(a[l]=f))}}else x=m(x===a?x.splice(h,x.length):x),o?o(null,a,x,u):Q.apply(a,x)})}function v(e){for(var t,n,r,i=e.length,o=T.relative[e[0].type],a=o||T.relative[" "],s=o?1:0,u=p(function(e){return e===t},a,!0),l=p(function(e){return ee(t,e)>-1},a,!0),c=[function(e,n,r){var i=!o&&(r||n!==A)||((t=n).nodeType?u(e,n,r):l(e,n,r));return t=null,i}];s1&&h(c),s>1&&d(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(se,"$1"),n,s0,o=e.length>0,a=function(r,a,s,u,l){var c,f,d,p=0,h="0",g=r&&[],y=[],v=A,x=r||o&&T.find.TAG("*",l),b=W+=null==v?1:Math.random()||.1,w=x.length;for(l&&(A=a===H||a||l);h!==w&&null!=(c=x[h]);h++){if(o&&c){for(f=0,a||c.ownerDocument===H||(L(c),s=!_);d=e[f++];)if(d(c,a||H,s)){u.push(c);break}l&&(W=b)}i&&((c=!d&&c)&&p--,r&&g.push(c))}if(p+=h,i&&h!==p){for(f=0;d=n[f++];)d(g,y,a,s);if(r){if(p>0)for(;h--;)g[h]||y[h]||(y[h]=G.call(u));y=m(y)}Q.apply(u,y),l&&!r&&y.length>0&&p+n.length>1&&t.uniqueSort(u)}return l&&(W=b,A=v),g};return i?r(a):a}var b,w,T,C,E,N,k,S,A,D,j,L,H,q,_,F,M,O,R,P="sizzle"+1*new Date,B=e.document,W=0,I=0,$=n(),z=n(),X=n(),U=function(e,t){return e===t&&(j=!0),0},V=1<<31,Y={}.hasOwnProperty,J=[],G=J.pop,K=J.push,Q=J.push,Z=J.slice,ee=function(e,t){for(var n=0,r=e.length;n+~]|"+ne+")"+ne+"*"),ce=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),fe=new RegExp(oe),de=new RegExp("^"+re+"$"),pe={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re+"|[*])"),ATTR:new RegExp("^"+ie),PSEUDO:new RegExp("^"+oe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},he=/^(?:input|select|textarea|button)$/i,ge=/^h\d$/i,me=/^[^{]+\{\s*\[native \w/,ye=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ve=/[+~]/,xe=/'|\\/g,be=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),we=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},Te=function(){L()};try{Q.apply(J=Z.call(B.childNodes),B.childNodes),J[B.childNodes.length].nodeType}catch(Ce){Q={apply:J.length?function(e,t){K.apply(e,Z.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}w=t.support={},E=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},L=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:B;return r!==H&&9===r.nodeType&&r.documentElement?(H=r,q=H.documentElement,_=!E(H),(n=H.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Te,!1):n.attachEvent&&n.attachEvent("onunload",Te)),w.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),w.getElementsByTagName=i(function(e){return e.appendChild(H.createComment("")),!e.getElementsByTagName("*").length}),w.getElementsByClassName=me.test(H.getElementsByClassName),w.getById=i(function(e){return q.appendChild(e).id=P,!H.getElementsByName||!H.getElementsByName(P).length}),w.getById?(T.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&_){var n=t.getElementById(e);return n?[n]:[]}},T.filter.ID=function(e){var t=e.replace(be,we);return function(e){return e.getAttribute("id")===t}}):(delete T.find.ID,T.filter.ID=function(e){var t=e.replace(be,we);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),T.find.TAG=w.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):w.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},T.find.CLASS=w.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&_)return t.getElementsByClassName(e)},M=[],F=[],(w.qsa=me.test(H.querySelectorAll))&&(i(function(e){q.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&F.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||F.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+P+"-]").length||F.push("~="),e.querySelectorAll(":checked").length||F.push(":checked"),e.querySelectorAll("a#"+P+"+*").length||F.push(".#.+[+~]")}),i(function(e){var t=H.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&F.push("name"+ne+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||F.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),F.push(",.*:")})),(w.matchesSelector=me.test(O=q.matches||q.webkitMatchesSelector||q.mozMatchesSelector||q.oMatchesSelector||q.msMatchesSelector))&&i(function(e){w.disconnectedMatch=O.call(e,"div"),O.call(e,"[s!='']:x"),M.push("!=",oe)}),F=F.length&&new RegExp(F.join("|")),M=M.length&&new RegExp(M.join("|")),t=me.test(q.compareDocumentPosition),R=t||me.test(q.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},U=t?function(e,t){if(e===t)return j=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!w.sortDetached&&t.compareDocumentPosition(e)===n?e===H||e.ownerDocument===B&&R(B,e)?-1:t===H||t.ownerDocument===B&&R(B,t)?1:D?ee(D,e)-ee(D,t):0:4&n?-1:1)}:function(e,t){if(e===t)return j=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],u=[t];if(!i||!o)return e===H?-1:t===H?1:i?-1:o?1:D?ee(D,e)-ee(D,t):0;if(i===o)return a(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;s[r]===u[r];)r++;return r?a(s[r],u[r]):s[r]===B?-1:u[r]===B?1:0},H):H},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==H&&L(e),n=n.replace(ce,"='$1']"),w.matchesSelector&&_&&!X[n+" "]&&(!M||!M.test(n))&&(!F||!F.test(n)))try{var r=O.call(e,n);if(r||w.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return t(n,H,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==H&&L(e),R(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==H&&L(e);var n=T.attrHandle[t.toLowerCase()],r=n&&Y.call(T.attrHandle,t.toLowerCase())?n(e,t,!_):void 0;return void 0!==r?r:w.attributes||!_?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(j=!w.detectDuplicates,D=!w.sortStable&&e.slice(0),e.sort(U),j){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return D=null,e},C=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=C(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=C(t);return n},T=t.selectors={cacheLength:50,createPseudo:r,match:pe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(be,we),e[3]=(e[3]||e[4]||e[5]||"").replace(be,we),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return pe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&fe.test(n)&&(t=N(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(be,we).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=$[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&$(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(i){var o=t.attr(i,e);return null==o?"!="===n:!n||(o+="","="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o.replace(ae," ")+" ").indexOf(r)>-1:"|="===n&&(o===r||o.slice(0,r.length+1)===r+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,d,p,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s,x=!1;if(m){if(o){for(;g;){for(d=t;d=d[g];)if(s?d.nodeName.toLowerCase()===y:1===d.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){for(d=m,f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),l=c[e]||[],p=l[0]===W&&l[1],x=p&&l[2], -d=p&&m.childNodes[p];d=++p&&d&&d[g]||(x=p=0)||h.pop();)if(1===d.nodeType&&++x&&d===t){c[e]=[W,p,x];break}}else if(v&&(d=t,f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),l=c[e]||[],p=l[0]===W&&l[1],x=p),x===!1)for(;(d=++p&&d&&d[g]||(x=p=0)||h.pop())&&((s?d.nodeName.toLowerCase()!==y:1!==d.nodeType)||!++x||(v&&(f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),c[e]=[W,x]),d!==t)););return x-=i,x===r||x%r===0&&x/r>=0}}},PSEUDO:function(e,n){var i,o=T.pseudos[e]||T.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[P]?o(n):o.length>1?(i=[e,e,"",n],T.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,i=o(e,n),a=i.length;a--;)r=ee(e,i[a]),e[r]=!(t[r]=i[a])}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=k(e.replace(se,"$1"));return i[P]?r(function(e,t,n,r){for(var o,a=i(e,null,r,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,r,o){return t[0]=e,i(t,null,o,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(be,we),function(t){return(t.textContent||t.innerText||C(t)).indexOf(e)>-1}}),lang:r(function(e){return de.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(be,we).toLowerCase(),function(t){var n;do if(n=_?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===q},focus:function(e){return e===H.activeElement&&(!H.hasFocus||H.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!T.pseudos.empty(e)},header:function(e){return ge.test(e.nodeName)},input:function(e){return he.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:l(function(){return[0]}),last:l(function(e,t){return[t-1]}),eq:l(function(e,t,n){return[n<0?n+t:n]}),even:l(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:l(function(e,t,n){for(var r=n<0?n+t:n;++r2&&"ID"===(a=o[0]).type&&w.getById&&9===t.nodeType&&_&&T.relative[o[1].type]){if(t=(T.find.ID(a.matches[0].replace(be,we),t)||[])[0],!t)return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=pe.needsContext.test(e)?0:o.length;i--&&(a=o[i],!T.relative[s=a.type]);)if((u=T.find[s])&&(r=u(a.matches[0].replace(be,we),ve.test(o[0].type)&&c(t.parentNode)||t))){if(o.splice(i,1),e=r.length&&d(o),!e)return Q.apply(n,r),n;break}}return(l||k(e,f))(r,t,!_,n,!t||ve.test(e)&&c(t.parentNode)||t),n},w.sortStable=P.split("").sort(U).join("")===P,w.detectDuplicates=!!j,L(),w.sortDetached=i(function(e){return 1&e.compareDocumentPosition(H.createElement("div"))}),i(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),w.attributes&&i(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(te,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(e);pe.find=ve,pe.expr=ve.selectors,pe.expr[":"]=pe.expr.pseudos,pe.uniqueSort=pe.unique=ve.uniqueSort,pe.text=ve.getText,pe.isXMLDoc=ve.isXML,pe.contains=ve.contains;var xe=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&pe(e).is(n))break;r.push(e)}return r},be=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},we=pe.expr.match.needsContext,Te=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,Ce=/^.[^:#\[\.,]*$/;pe.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?pe.find.matchesSelector(r,e)?[r]:[]:pe.find.matches(e,pe.grep(t,function(e){return 1===e.nodeType}))},pe.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(pe(e).filter(function(){for(t=0;t1?pe.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},filter:function(e){return this.pushStack(r(this,e||[],!1))},not:function(e){return this.pushStack(r(this,e||[],!0))},is:function(e){return!!r(this,"string"==typeof e&&we.test(e)?pe(e):e||[],!1).length}});var Ee,Ne=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ke=pe.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||Ee,"string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:Ne.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof pe?t[0]:t,pe.merge(this,pe.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:re,!0)),Te.test(r[1])&&pe.isPlainObject(t))for(r in t)pe.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}if(i=re.getElementById(r[2]),i&&i.parentNode){if(i.id!==r[2])return Ee.find(e);this.length=1,this[0]=i}return this.context=re,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):pe.isFunction(e)?"undefined"!=typeof n.ready?n.ready(e):e(pe):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),pe.makeArray(e,this))};ke.prototype=pe.fn,Ee=pe(re);var Se=/^(?:parents|prev(?:Until|All))/,Ae={children:!0,contents:!0,next:!0,prev:!0};pe.fn.extend({has:function(e){var t,n=pe(e,this),r=n.length;return this.filter(function(){for(t=0;t-1:1===n.nodeType&&pe.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?pe.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?pe.inArray(this[0],pe(e)):pe.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(pe.uniqueSort(pe.merge(this.get(),pe(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),pe.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return xe(e,"parentNode")},parentsUntil:function(e,t,n){return xe(e,"parentNode",n)},next:function(e){return i(e,"nextSibling")},prev:function(e){return i(e,"previousSibling")},nextAll:function(e){return xe(e,"nextSibling")},prevAll:function(e){return xe(e,"previousSibling")},nextUntil:function(e,t,n){return xe(e,"nextSibling",n)},prevUntil:function(e,t,n){return xe(e,"previousSibling",n)},siblings:function(e){return be((e.parentNode||{}).firstChild,e)},children:function(e){return be(e.firstChild)},contents:function(e){return pe.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:pe.merge([],e.childNodes)}},function(e,t){pe.fn[e]=function(n,r){var i=pe.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=pe.filter(r,i)),this.length>1&&(Ae[e]||(i=pe.uniqueSort(i)),Se.test(e)&&(i=i.reverse())),this.pushStack(i)}});var De=/\S+/g;pe.Callbacks=function(e){e="string"==typeof e?o(e):pe.extend({},e);var t,n,r,i,a=[],s=[],u=-1,l=function(){for(i=e.once,r=t=!0;s.length;u=-1)for(n=s.shift();++u-1;)a.splice(n,1),n<=u&&u--}),this},has:function(e){return e?pe.inArray(e,a)>-1:a.length>0},empty:function(){return a&&(a=[]),this},disable:function(){return i=s=[],a=n="",this},disabled:function(){return!a},lock:function(){return i=!0,n||c.disable(),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=n||[],n=[e,n.slice?n.slice():n],s.push(n),t||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},pe.extend({Deferred:function(e){var t=[["resolve","done",pe.Callbacks("once memory"),"resolved"],["reject","fail",pe.Callbacks("once memory"),"rejected"],["notify","progress",pe.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return pe.Deferred(function(n){pe.each(t,function(t,o){var a=pe.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&pe.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[o[0]+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?pe.extend(e,r):r}},i={};return r.pipe=r.then,pe.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,i=0,o=ie.call(arguments),a=o.length,s=1!==a||e&&pe.isFunction(e.promise)?a:0,u=1===s?e:pe.Deferred(),l=function(e,n,r){return function(i){n[e]=this,r[e]=arguments.length>1?ie.call(arguments):i,r===t?u.notifyWith(n,r):--s||u.resolveWith(n,r)}};if(a>1)for(t=new Array(a),n=new Array(a),r=new Array(a);i0||(je.resolveWith(re,[pe]),pe.fn.triggerHandler&&(pe(re).triggerHandler("ready"),pe(re).off("ready"))))}}),pe.ready.promise=function(t){if(!je)if(je=pe.Deferred(),"complete"===re.readyState||"loading"!==re.readyState&&!re.documentElement.doScroll)e.setTimeout(pe.ready);else if(re.addEventListener)re.addEventListener("DOMContentLoaded",s),e.addEventListener("load",s);else{re.attachEvent("onreadystatechange",s),e.attachEvent("onload",s);var n=!1;try{n=null==e.frameElement&&re.documentElement}catch(r){}n&&n.doScroll&&!function i(){if(!pe.isReady){try{n.doScroll("left")}catch(t){return e.setTimeout(i,50)}a(),pe.ready()}}()}return je.promise(t)},pe.ready.promise();var Le;for(Le in pe(fe))break;fe.ownFirst="0"===Le,fe.inlineBlockNeedsLayout=!1,pe(function(){var e,t,n,r;n=re.getElementsByTagName("body")[0],n&&n.style&&(t=re.createElement("div"),r=re.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),"undefined"!=typeof t.style.zoom&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",fe.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(r))}),function(){var e=re.createElement("div");fe.deleteExpando=!0;try{delete e.test}catch(t){fe.deleteExpando=!1}e=null}();var He=function(e){var t=pe.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return(1===n||9===n)&&(!t||t!==!0&&e.getAttribute("classid")===t)},qe=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,_e=/([A-Z])/g;pe.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?pe.cache[e[pe.expando]]:e[pe.expando],!!e&&!l(e)},data:function(e,t,n){return c(e,t,n)},removeData:function(e,t){return f(e,t)},_data:function(e,t,n){return c(e,t,n,!0)},_removeData:function(e,t){return f(e,t,!0)}}),pe.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=pe.data(o),1===o.nodeType&&!pe._data(o,"parsedAttrs"))){for(n=a.length;n--;)a[n]&&(r=a[n].name,0===r.indexOf("data-")&&(r=pe.camelCase(r.slice(5)),u(o,r,i[r])));pe._data(o,"parsedAttrs",!0)}return i}return"object"==typeof e?this.each(function(){pe.data(this,e)}):arguments.length>1?this.each(function(){pe.data(this,e,t)}):o?u(o,e,pe.data(o,e)):void 0},removeData:function(e){return this.each(function(){pe.removeData(this,e)})}}),pe.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=pe._data(e,t),n&&(!r||pe.isArray(n)?r=pe._data(e,t,pe.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=pe.queue(e,t),r=n.length,i=n.shift(),o=pe._queueHooks(e,t),a=function(){pe.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return pe._data(e,n)||pe._data(e,n,{empty:pe.Callbacks("once memory").add(function(){pe._removeData(e,t+"queue"),pe._removeData(e,n)})})}}),pe.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length
a",fe.leadingWhitespace=3===e.firstChild.nodeType,fe.tbody=!e.getElementsByTagName("tbody").length,fe.htmlSerialize=!!e.getElementsByTagName("link").length,fe.html5Clone="<:nav>"!==re.createElement("nav").cloneNode(!0).outerHTML,n.type="checkbox",n.checked=!0,t.appendChild(n),fe.appendChecked=n.checked,e.innerHTML="",fe.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue,t.appendChild(e),n=re.createElement("input"),n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),e.appendChild(n),fe.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,fe.noCloneEvent=!!e.addEventListener,e[pe.expando]=1,fe.attributes=!e.getAttribute(pe.expando)}();var Xe={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:fe.htmlSerialize?[0,"",""]:[1,"X
","
"]};Xe.optgroup=Xe.option,Xe.tbody=Xe.tfoot=Xe.colgroup=Xe.caption=Xe.thead,Xe.th=Xe.td;var Ue=/<|&#?\w+;/,Ve=/-1&&(h=p.split("."),p=h.shift(),h.sort()),a=p.indexOf(":")<0&&"on"+p,t=t[pe.expando]?t:new pe.Event(p,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=h.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:pe.makeArray(n,[t]),l=pe.event.special[p]||{},i||!l.trigger||l.trigger.apply(r,n)!==!1)){if(!i&&!l.noBubble&&!pe.isWindow(r)){for(u=l.delegateType||p,Ke.test(u+p)||(s=s.parentNode);s;s=s.parentNode)d.push(s),c=s;c===(r.ownerDocument||re)&&d.push(c.defaultView||c.parentWindow||e)}for(f=0;(s=d[f++])&&!t.isPropagationStopped();)t.type=f>1?u:l.bindType||p,o=(pe._data(s,"events")||{})[t.type]&&pe._data(s,"handle"),o&&o.apply(s,n),o=a&&s[a],o&&o.apply&&He(s)&&(t.result=o.apply(s,n),t.result===!1&&t.preventDefault());if(t.type=p,!i&&!t.isDefaultPrevented()&&(!l._default||l._default.apply(d.pop(),n)===!1)&&He(r)&&a&&r[p]&&!pe.isWindow(r)){c=r[a],c&&(r[a]=null),pe.event.triggered=p;try{r[p]()}catch(g){}pe.event.triggered=void 0,c&&(r[a]=c)}return t.result}},dispatch:function(e){e=pe.event.fix(e);var t,n,r,i,o,a=[],s=ie.call(arguments),u=(pe._data(this,"events")||{})[e.type]||[],l=pe.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){for(a=pe.event.handlers.call(this,e,u),t=0;(i=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=i.elem,n=0;(o=i.handlers[n++])&&!e.isImmediatePropagationStopped();)e.rnamespace&&!e.rnamespace.test(o.namespace)||(e.handleObj=o,e.data=o.data,r=((pe.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s),void 0!==r&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()));return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,a=[],s=t.delegateCount,u=e.target;if(s&&u.nodeType&&("click"!==e.type||isNaN(e.button)||e.button<1))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(r=[],n=0;n-1:pe.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&a.push({elem:u,handlers:r})}return s]","i"),tt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,nt=/\s*$/g,at=p(re),st=at.appendChild(re.createElement("div"));pe.extend({htmlPrefilter:function(e){return e.replace(tt,"<$1>")},clone:function(e,t,n){var r,i,o,a,s,u=pe.contains(e.ownerDocument,e);if(fe.html5Clone||pe.isXMLDoc(e)||!et.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(st.innerHTML=e.outerHTML,st.removeChild(o=st.firstChild)),!(fe.noCloneEvent&&fe.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||pe.isXMLDoc(e)))for(r=h(o),s=h(e),a=0;null!=(i=s[a]);++a)r[a]&&k(i,r[a]);if(t)if(n)for(s=s||h(e),r=r||h(o),a=0;null!=(i=s[a]);a++)N(i,r[a]);else N(e,o);return r=h(o,"script"),r.length>0&&g(r,!u&&h(e,"script")),r=s=i=null,o},cleanData:function(e,t){for(var n,r,i,o,a=0,s=pe.expando,u=pe.cache,l=fe.attributes,c=pe.event.special;null!=(n=e[a]);a++)if((t||He(n))&&(i=n[s],o=i&&u[i])){if(o.events)for(r in o.events)c[r]?pe.event.remove(n,r):pe.removeEvent(n,r,o.handle);u[i]&&(delete u[i],l||"undefined"==typeof n.removeAttribute?n[s]=void 0:n.removeAttribute(s),ne.push(i))}}}),pe.fn.extend({domManip:S,detach:function(e){return A(this,e,!0)},remove:function(e){return A(this,e)},text:function(e){return Pe(this,function(e){return void 0===e?pe.text(this):this.empty().append((this[0]&&this[0].ownerDocument||re).createTextNode(e))},null,e,arguments.length)},append:function(){return S(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=T(this,e);t.appendChild(e)}})},prepend:function(){return S(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=T(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return S(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return S(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&pe.cleanData(h(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&pe.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return pe.clone(this,e,t)})},html:function(e){return Pe(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e)return 1===t.nodeType?t.innerHTML.replace(Ze,""):void 0;if("string"==typeof e&&!nt.test(e)&&(fe.htmlSerialize||!et.test(e))&&(fe.leadingWhitespace||!$e.test(e))&&!Xe[(We.exec(e)||["",""])[1].toLowerCase()]){e=pe.htmlPrefilter(e);try{for(;nt",l.childNodes[0].style.borderCollapse="separate",t=l.getElementsByTagName("td"),t[0].style.cssText="margin:0;border:0;padding:0;display:none",o=0===t[0].offsetHeight,o&&(t[0].style.display="",t[1].style.display="none",o=0===t[0].offsetHeight)),f.removeChild(u)}var n,r,i,o,a,s,u=re.createElement("div"),l=re.createElement("div");l.style&&(l.style.cssText="float:left;opacity:.5",fe.opacity="0.5"===l.style.opacity,fe.cssFloat=!!l.style.cssFloat,l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",fe.clearCloneStyle="content-box"===l.style.backgroundClip,u=re.createElement("div"),u.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",l.innerHTML="",u.appendChild(l),fe.boxSizing=""===l.style.boxSizing||""===l.style.MozBoxSizing||""===l.style.WebkitBoxSizing,pe.extend(fe,{reliableHiddenOffsets:function(){return null==n&&t(),o},boxSizingReliable:function(){return null==n&&t(),i},pixelMarginRight:function(){return null==n&&t(),r},pixelPosition:function(){return null==n&&t(),n},reliableMarginRight:function(){return null==n&&t(),a},reliableMarginLeft:function(){return null==n&&t(),s}}))}();var ht,gt,mt=/^(top|right|bottom|left)$/;e.getComputedStyle?(ht=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},gt=function(e,t,n){var r,i,o,a,s=e.style;return n=n||ht(e),a=n?n.getPropertyValue(t)||n[t]:void 0,""!==a&&void 0!==a||pe.contains(e.ownerDocument,e)||(a=pe.style(e,t)),n&&!fe.pixelMarginRight()&&ft.test(a)&&ct.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o),void 0===a?a:a+""}):pt.currentStyle&&(ht=function(e){return e.currentStyle},gt=function(e,t,n){var r,i,o,a,s=e.style;return n=n||ht(e),a=n?n[t]:void 0,null==a&&s&&s[t]&&(a=s[t]),ft.test(a)&&!mt.test(t)&&(r=s.left,i=e.runtimeStyle,o=i&&i.left,o&&(i.left=e.currentStyle.left),s.left="fontSize"===t?"1em":a,a=s.pixelLeft+"px",s.left=r,o&&(i.left=o)),void 0===a?a:a+""||"auto"});var yt=/alpha\([^)]*\)/i,vt=/opacity\s*=\s*([^)]*)/i,xt=/^(none|table(?!-c[ea]).+)/,bt=new RegExp("^("+Fe+")(.*)$","i"),wt={position:"absolute",visibility:"hidden",display:"block"},Tt={letterSpacing:"0",fontWeight:"400"},Ct=["Webkit","O","Moz","ms"],Et=re.createElement("div").style;pe.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=gt(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":fe.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=pe.camelCase(t),u=e.style;if(t=pe.cssProps[s]||(pe.cssProps[s]=H(s)||s),a=pe.cssHooks[t]||pe.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:u[t];if(o=typeof n,"string"===o&&(i=Me.exec(n))&&i[1]&&(n=d(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(pe.cssNumber[s]?"":"px")),fe.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),!(a&&"set"in a&&void 0===(n=a.set(e,n,r)))))try{u[t]=n}catch(l){}}},css:function(e,t,n,r){var i,o,a,s=pe.camelCase(t);return t=pe.cssProps[s]||(pe.cssProps[s]=H(s)||s),a=pe.cssHooks[t]||pe.cssHooks[s],a&&"get"in a&&(o=a.get(e,!0,n)),void 0===o&&(o=gt(e,t,r)),"normal"===o&&t in Tt&&(o=Tt[t]),""===n||n?(i=parseFloat(o),n===!0||isFinite(i)?i||0:o):o}}),pe.each(["height","width"],function(e,t){pe.cssHooks[t]={get:function(e,n,r){if(n)return xt.test(pe.css(e,"display"))&&0===e.offsetWidth?dt(e,wt,function(){return M(e,t,r)}):M(e,t,r)},set:function(e,n,r){var i=r&&ht(e);return _(e,n,r?F(e,t,r,fe.boxSizing&&"border-box"===pe.css(e,"boxSizing",!1,i),i):0)}}}),fe.opacity||(pe.cssHooks.opacity={get:function(e,t){return vt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=pe.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===pe.trim(o.replace(yt,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=yt.test(o)?o.replace(yt,i):o+" "+i)}}),pe.cssHooks.marginRight=L(fe.reliableMarginRight,function(e,t){if(t)return dt(e,{display:"inline-block"},gt,[e,"marginRight"])}),pe.cssHooks.marginLeft=L(fe.reliableMarginLeft,function(e,t){if(t)return(parseFloat(gt(e,"marginLeft"))||(pe.contains(e.ownerDocument,e)?e.getBoundingClientRect().left-dt(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}):0))+"px"}),pe.each({margin:"",padding:"",border:"Width"},function(e,t){pe.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+Oe[r]+t]=o[r]||o[r-2]||o[0];return i}},ct.test(e)||(pe.cssHooks[e+t].set=_)}),pe.fn.extend({css:function(e,t){return Pe(this,function(e,t,n){var r,i,o={},a=0;if(pe.isArray(t)){for(r=ht(e),i=t.length;a1)},show:function(){return q(this,!0)},hide:function(){return q(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Re(this)?pe(this).show():pe(this).hide()})}}),pe.Tween=O,O.prototype={constructor:O,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||pe.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(pe.cssNumber[n]?"":"px")},cur:function(){var e=O.propHooks[this.prop];return e&&e.get?e.get(this):O.propHooks._default.get(this)},run:function(e){var t,n=O.propHooks[this.prop];return this.options.duration?this.pos=t=pe.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):O.propHooks._default.set(this),this}},O.prototype.init.prototype=O.prototype,O.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=pe.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){pe.fx.step[e.prop]?pe.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[pe.cssProps[e.prop]]&&!pe.cssHooks[e.prop]?e.elem[e.prop]=e.now:pe.style(e.elem,e.prop,e.now+e.unit)}}},O.propHooks.scrollTop=O.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},pe.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},pe.fx=O.prototype.init,pe.fx.step={};var Nt,kt,St=/^(?:toggle|show|hide)$/,At=/queueHooks$/;pe.Animation=pe.extend($,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return d(n.elem,e,Me.exec(t),n),n}]},tweener:function(e,t){pe.isFunction(e)?(t=e,e=["*"]):e=e.match(De);for(var n,r=0,i=e.length;r
a",e=n.getElementsByTagName("a")[0],t.setAttribute("type","checkbox"),n.appendChild(t),e=n.getElementsByTagName("a")[0],e.style.cssText="top:1px",fe.getSetAttribute="t"!==n.className,fe.style=/top/.test(e.getAttribute("style")),fe.hrefNormalized="/a"===e.getAttribute("href"),fe.checkOn=!!t.value,fe.optSelected=i.selected,fe.enctype=!!re.createElement("form").enctype,r.disabled=!0,fe.optDisabled=!i.disabled,t=re.createElement("input"),t.setAttribute("value",""),fe.input=""===t.getAttribute("value"),t.value="t",t.setAttribute("type","radio"),fe.radioValue="t"===t.value}();var Dt=/\r/g,jt=/[\x20\t\r\n\f]+/g;pe.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=pe.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,pe(this).val()):e,null==i?i="":"number"==typeof i?i+="":pe.isArray(i)&&(i=pe.map(i,function(e){return null==e?"":e+""})),t=pe.valHooks[this.type]||pe.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return t=pe.valHooks[i.type]||pe.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(Dt,""):null==n?"":n)}}}),pe.extend({valHooks:{option:{get:function(e){var t=pe.find.attr(e,"value");return null!=t?t:pe.trim(pe.text(e)).replace(jt," ")}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||i<0,a=o?null:[],s=o?i+1:r.length,u=i<0?s:o?i:0;u-1)try{r.selected=n=!0}catch(s){r.scrollHeight}else r.selected=!1;return n||(e.selectedIndex=-1),i}}}}),pe.each(["radio","checkbox"],function(){pe.valHooks[this]={set:function(e,t){if(pe.isArray(t))return e.checked=pe.inArray(pe(e).val(),t)>-1}},fe.checkOn||(pe.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Lt,Ht,qt=pe.expr.attrHandle,_t=/^(?:checked|selected)$/i,Ft=fe.getSetAttribute,Mt=fe.input;pe.fn.extend({attr:function(e,t){return Pe(this,pe.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){pe.removeAttr(this,e)})}}),pe.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?pe.prop(e,t,n):(1===o&&pe.isXMLDoc(e)||(t=t.toLowerCase(),i=pe.attrHooks[t]||(pe.expr.match.bool.test(t)?Ht:Lt)),void 0!==n?null===n?void pe.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:(r=pe.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!fe.radioValue&&"radio"===t&&pe.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(De);if(o&&1===e.nodeType)for(;n=o[i++];)r=pe.propFix[n]||n,pe.expr.match.bool.test(n)?Mt&&Ft||!_t.test(n)?e[r]=!1:e[pe.camelCase("default-"+n)]=e[r]=!1:pe.attr(e,n,""),e.removeAttribute(Ft?n:r)}}),Ht={set:function(e,t,n){return t===!1?pe.removeAttr(e,n):Mt&&Ft||!_t.test(n)?e.setAttribute(!Ft&&pe.propFix[n]||n,n):e[pe.camelCase("default-"+n)]=e[n]=!0,n}},pe.each(pe.expr.match.bool.source.match(/\w+/g),function(e,t){var n=qt[t]||pe.find.attr;Mt&&Ft||!_t.test(t)?qt[t]=function(e,t,r){var i,o;return r||(o=qt[t],qt[t]=i,i=null!=n(e,t,r)?t.toLowerCase():null,qt[t]=o),i}:qt[t]=function(e,t,n){if(!n)return e[pe.camelCase("default-"+t)]?t.toLowerCase():null}}),Mt&&Ft||(pe.attrHooks.value={set:function(e,t,n){return pe.nodeName(e,"input")?void(e.defaultValue=t):Lt&&Lt.set(e,t,n)}}),Ft||(Lt={set:function(e,t,n){var r=e.getAttributeNode(n);if(r||e.setAttributeNode(r=e.ownerDocument.createAttribute(n)),r.value=t+="","value"===n||t===e.getAttribute(n))return t}},qt.id=qt.name=qt.coords=function(e,t,n){var r;if(!n)return(r=e.getAttributeNode(t))&&""!==r.value?r.value:null},pe.valHooks.button={get:function(e,t){var n=e.getAttributeNode(t);if(n&&n.specified)return n.value},set:Lt.set},pe.attrHooks.contenteditable={set:function(e,t,n){Lt.set(e,""!==t&&t,n)}},pe.each(["width","height"],function(e,t){pe.attrHooks[t]={set:function(e,n){if(""===n)return e.setAttribute(t,"auto"),n}}})),fe.style||(pe.attrHooks.style={get:function(e){return e.style.cssText||void 0},set:function(e,t){return e.style.cssText=t+""}});var Ot=/^(?:input|select|textarea|button|object)$/i,Rt=/^(?:a|area)$/i;pe.fn.extend({prop:function(e,t){return Pe(this,pe.prop,e,t,arguments.length>1)},removeProp:function(e){return e=pe.propFix[e]||e,this.each(function(){try{this[e]=void 0,delete this[e]}catch(t){}})}}),pe.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&pe.isXMLDoc(e)||(t=pe.propFix[t]||t,i=pe.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=pe.find.attr(e,"tabindex");return t?parseInt(t,10):Ot.test(e.nodeName)||Rt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),fe.hrefNormalized||pe.each(["href","src"],function(e,t){pe.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),fe.optSelected||(pe.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),pe.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){pe.propFix[this.toLowerCase()]=this}),fe.enctype||(pe.propFix.enctype="encoding");var Pt=/[\t\r\n\f]/g;pe.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(pe.isFunction(e))return this.each(function(t){pe(this).addClass(e.call(this,t,z(this)))});if("string"==typeof e&&e)for(t=e.match(De)||[];n=this[u++];)if(i=z(n),r=1===n.nodeType&&(" "+i+" ").replace(Pt," ")){for(a=0;o=t[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");s=pe.trim(r),i!==s&&pe.attr(n,"class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(pe.isFunction(e))return this.each(function(t){pe(this).removeClass(e.call(this,t,z(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(De)||[];n=this[u++];)if(i=z(n),r=1===n.nodeType&&(" "+i+" ").replace(Pt," ")){for(a=0;o=t[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");s=pe.trim(r),i!==s&&pe.attr(n,"class",s)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):pe.isFunction(e)?this.each(function(n){pe(this).toggleClass(e.call(this,n,z(this),t),t)}):this.each(function(){var t,r,i,o;if("string"===n)for(r=0,i=pe(this),o=e.match(De)||[];t=o[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else void 0!==e&&"boolean"!==n||(t=z(this),t&&pe._data(this,"__className__",t),pe.attr(this,"class",t||e===!1?"":pe._data(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+z(n)+" ").replace(Pt," ").indexOf(t)>-1)return!0;return!1}}),pe.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){pe.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),pe.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}});var Bt=e.location,Wt=pe.now(),It=/\?/,$t=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;pe.parseJSON=function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t+"");var n,r=null,i=pe.trim(t+"");return i&&!pe.trim(i.replace($t,function(e,t,i,o){return n&&t&&(r=0),0===r?e:(n=i||t,r+=!o-!i,"")}))?Function("return "+i)():pe.error("Invalid JSON: "+t)},pe.parseXML=function(t){var n,r;if(!t||"string"!=typeof t)return null;try{e.DOMParser?(r=new e.DOMParser,n=r.parseFromString(t,"text/xml")):(n=new e.ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(t))}catch(i){n=void 0}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||pe.error("Invalid XML: "+t),n};var zt=/#.*$/,Xt=/([?&])_=[^&]*/,Ut=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Vt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Yt=/^(?:GET|HEAD)$/,Jt=/^\/\//,Gt=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Kt={},Qt={},Zt="*/".concat("*"),en=Bt.href,tn=Gt.exec(en.toLowerCase())||[];pe.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:en,type:"GET",isLocal:Vt.test(tn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Zt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":pe.parseJSON,"text xml":pe.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?V(V(e,pe.ajaxSettings),t):V(pe.ajaxSettings,e)},ajaxPrefilter:X(Kt),ajaxTransport:X(Qt),ajax:function(t,n){function r(t,n,r,i){var o,f,v,x,w,C=n;2!==b&&(b=2,u&&e.clearTimeout(u),c=void 0,s=i||"",T.readyState=t>0?4:0,o=t>=200&&t<300||304===t,r&&(x=Y(d,T,r)),x=J(d,x,T,o),o?(d.ifModified&&(w=T.getResponseHeader("Last-Modified"),w&&(pe.lastModified[a]=w),w=T.getResponseHeader("etag"),w&&(pe.etag[a]=w)),204===t||"HEAD"===d.type?C="nocontent":304===t?C="notmodified":(C=x.state,f=x.data,v=x.error,o=!v)):(v=C,!t&&C||(C="error",t<0&&(t=0))),T.status=t,T.statusText=(n||C)+"",o?g.resolveWith(p,[f,C,T]):g.rejectWith(p,[T,C,v]),T.statusCode(y),y=void 0,l&&h.trigger(o?"ajaxSuccess":"ajaxError",[T,d,o?f:v]),m.fireWith(p,[T,C]),l&&(h.trigger("ajaxComplete",[T,d]),--pe.active||pe.event.trigger("ajaxStop")))}"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,d=pe.ajaxSetup({},n),p=d.context||d,h=d.context&&(p.nodeType||p.jquery)?pe(p):pe.event,g=pe.Deferred(),m=pe.Callbacks("once memory"),y=d.statusCode||{},v={},x={},b=0,w="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!f)for(f={};t=Ut.exec(s);)f[t[1].toLowerCase()]=t[2];t=f[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?s:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=x[n]=x[n]||e,v[e]=t),this},overrideMimeType:function(e){return b||(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(b<2)for(t in e)y[t]=[y[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||w;return c&&c.abort(t),r(0,t),this}};if(g.promise(T).complete=m.add,T.success=T.done,T.error=T.fail,d.url=((t||d.url||en)+"").replace(zt,"").replace(Jt,tn[1]+"//"),d.type=n.method||n.type||d.method||d.type,d.dataTypes=pe.trim(d.dataType||"*").toLowerCase().match(De)||[""],null==d.crossDomain&&(i=Gt.exec(d.url.toLowerCase()),d.crossDomain=!(!i||i[1]===tn[1]&&i[2]===tn[2]&&(i[3]||("http:"===i[1]?"80":"443"))===(tn[3]||("http:"===tn[1]?"80":"443")))),d.data&&d.processData&&"string"!=typeof d.data&&(d.data=pe.param(d.data,d.traditional)),U(Kt,d,n,T),2===b)return T;l=pe.event&&d.global,l&&0===pe.active++&&pe.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Yt.test(d.type),a=d.url,d.hasContent||(d.data&&(a=d.url+=(It.test(a)?"&":"?")+d.data,delete d.data),d.cache===!1&&(d.url=Xt.test(a)?a.replace(Xt,"$1_="+Wt++):a+(It.test(a)?"&":"?")+"_="+Wt++)),d.ifModified&&(pe.lastModified[a]&&T.setRequestHeader("If-Modified-Since",pe.lastModified[a]),pe.etag[a]&&T.setRequestHeader("If-None-Match",pe.etag[a])),(d.data&&d.hasContent&&d.contentType!==!1||n.contentType)&&T.setRequestHeader("Content-Type",d.contentType),T.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Zt+"; q=0.01":""):d.accepts["*"]);for(o in d.headers)T.setRequestHeader(o,d.headers[o]);if(d.beforeSend&&(d.beforeSend.call(p,T,d)===!1||2===b))return T.abort();w="abort";for(o in{success:1,error:1,complete:1})T[o](d[o]);if(c=U(Qt,d,n,T)){if(T.readyState=1,l&&h.trigger("ajaxSend",[T,d]),2===b)return T;d.async&&d.timeout>0&&(u=e.setTimeout(function(){T.abort("timeout")},d.timeout));try{b=1,c.send(v,r)}catch(C){if(!(b<2))throw C;r(-1,C)}}else r(-1,"No Transport");return T},getJSON:function(e,t,n){return pe.get(e,t,n,"json")},getScript:function(e,t){return pe.get(e,void 0,t,"script")}}),pe.each(["get","post"],function(e,t){pe[t]=function(e,n,r,i){return pe.isFunction(n)&&(i=i||r,r=n,n=void 0),pe.ajax(pe.extend({url:e,type:t,dataType:i,data:n,success:r},pe.isPlainObject(e)&&e))}}),pe._evalUrl=function(e){return pe.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},pe.fn.extend({wrapAll:function(e){if(pe.isFunction(e))return this.each(function(t){pe(this).wrapAll(e.call(this,t))});if(this[0]){var t=pe(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return pe.isFunction(e)?this.each(function(t){pe(this).wrapInner(e.call(this,t))}):this.each(function(){var t=pe(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=pe.isFunction(e);return this.each(function(n){pe(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){pe.nodeName(this,"body")||pe(this).replaceWith(this.childNodes)}).end()}}),pe.expr.filters.hidden=function(e){return fe.reliableHiddenOffsets()?e.offsetWidth<=0&&e.offsetHeight<=0&&!e.getClientRects().length:K(e)},pe.expr.filters.visible=function(e){return!pe.expr.filters.hidden(e)};var nn=/%20/g,rn=/\[\]$/,on=/\r?\n/g,an=/^(?:submit|button|image|reset|file)$/i,sn=/^(?:input|select|textarea|keygen)/i;pe.param=function(e,t){var n,r=[],i=function(e,t){t=pe.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=pe.ajaxSettings&&pe.ajaxSettings.traditional),pe.isArray(e)||e.jquery&&!pe.isPlainObject(e))pe.each(e,function(){i(this.name,this.value)});else for(n in e)Q(n,e[n],t,i);return r.join("&").replace(nn,"+")},pe.fn.extend({serialize:function(){return pe.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=pe.prop(this,"elements");return e?pe.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!pe(this).is(":disabled")&&sn.test(this.nodeName)&&!an.test(e)&&(this.checked||!Be.test(e))}).map(function(e,t){var n=pe(this).val();return null==n?null:pe.isArray(n)?pe.map(n,function(e){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),pe.ajaxSettings.xhr=void 0!==e.ActiveXObject?function(){return this.isLocal?ee():re.documentMode>8?Z():/^(get|post|head|put|delete|options)$/i.test(this.type)&&Z()||ee()}:Z;var un=0,ln={},cn=pe.ajaxSettings.xhr();e.attachEvent&&e.attachEvent("onunload",function(){for(var e in ln)ln[e](void 0,!0)}),fe.cors=!!cn&&"withCredentials"in cn,cn=fe.ajax=!!cn,cn&&pe.ajaxTransport(function(t){if(!t.crossDomain||fe.cors){var n;return{send:function(r,i){var o,a=t.xhr(),s=++un;if(a.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(o in t.xhrFields)a[o]=t.xhrFields[o];t.mimeType&&a.overrideMimeType&&a.overrideMimeType(t.mimeType),t.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest");for(o in r)void 0!==r[o]&&a.setRequestHeader(o,r[o]+"");a.send(t.hasContent&&t.data||null),n=function(e,r){var o,u,l;if(n&&(r||4===a.readyState))if(delete ln[s],n=void 0,a.onreadystatechange=pe.noop,r)4!==a.readyState&&a.abort();else{l={},o=a.status,"string"==typeof a.responseText&&(l.text=a.responseText);try{u=a.statusText}catch(c){u=""}o||!t.isLocal||t.crossDomain?1223===o&&(o=204):o=l.text?200:404}l&&i(o,u,l,a.getAllResponseHeaders())},t.async?4===a.readyState?e.setTimeout(n):a.onreadystatechange=ln[s]=n:n()},abort:function(){n&&n(void 0,!0)}}}}),pe.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return pe.globalEval(e),e}}}),pe.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),pe.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=re.head||pe("head")[0]||re.documentElement;return{send:function(r,i){t=re.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||i(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var fn=[],dn=/(=)\?(?=&|$)|\?\?/;pe.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=fn.pop()||pe.expando+"_"+Wt++;return this[e]=!0,e}}),pe.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=t.jsonp!==!1&&(dn.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&dn.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=pe.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(dn,"$1"+i):t.jsonp!==!1&&(t.url+=(It.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||pe.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?pe(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,fn.push(i)),a&&pe.isFunction(o)&&o(a[0]),a=o=void 0}),"script"}),pe.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||re;var r=Te.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=y([e],t,i),i&&i.length&&pe(i).remove(),pe.merge([],r.childNodes))};var pn=pe.fn.load;return pe.fn.load=function(e,t,n){if("string"!=typeof e&&pn)return pn.apply(this,arguments);var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=pe.trim(e.slice(s,e.length)),e=e.slice(0,s)),pe.isFunction(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&pe.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?pe("
").append(pe.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},pe.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){pe.fn[t]=function(e){return this.on(t,e)}}),pe.expr.filters.animated=function(e){return pe.grep(pe.timers,function(t){return e===t.elem}).length},pe.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=pe.css(e,"position"),f=pe(e),d={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=pe.css(e,"top"),u=pe.css(e,"left"),l=("absolute"===c||"fixed"===c)&&pe.inArray("auto",[o,u])>-1,l?(r=f.position(),a=r.top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),pe.isFunction(t)&&(t=t.call(e,n,pe.extend({},s))),null!=t.top&&(d.top=t.top-s.top+a),null!=t.left&&(d.left=t.left-s.left+i),"using"in t?t.using.call(e,d):f.css(d)}},pe.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){pe.offset.setOffset(this,e,t)});var t,n,r={top:0,left:0},i=this[0],o=i&&i.ownerDocument;if(o)return t=o.documentElement,pe.contains(t,i)?("undefined"!=typeof i.getBoundingClientRect&&(r=i.getBoundingClientRect()),n=te(o),{top:r.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:r.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):r},position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===pe.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),pe.nodeName(e[0],"html")||(n=e.offset()),n.top+=pe.css(e[0],"borderTopWidth",!0),n.left+=pe.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-pe.css(r,"marginTop",!0),left:t.left-n.left-pe.css(r,"marginLeft",!0)}}},offsetParent:function(){ -return this.map(function(){for(var e=this.offsetParent;e&&!pe.nodeName(e,"html")&&"static"===pe.css(e,"position");)e=e.offsetParent;return e||pt})}}),pe.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n=/Y/.test(t);pe.fn[e]=function(r){return Pe(this,function(e,r,i){var o=te(e);return void 0===i?o?t in o?o[t]:o.document.documentElement[r]:e[r]:void(o?o.scrollTo(n?pe(o).scrollLeft():i,n?i:pe(o).scrollTop()):e[r]=i)},e,r,arguments.length,null)}}),pe.each(["top","left"],function(e,t){pe.cssHooks[t]=L(fe.pixelPosition,function(e,n){if(n)return n=gt(e,t),ft.test(n)?pe(e).position()[t]+"px":n})}),pe.each({Height:"height",Width:"width"},function(e,t){pe.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){pe.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),a=n||(r===!0||i===!0?"margin":"border");return Pe(this,function(t,n,r){var i;return pe.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):void 0===r?pe.css(t,n,a):pe.style(t,n,r,a)},t,o?r:void 0,o,null)}})}),pe.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),pe.fn.size=function(){return this.length},pe.fn.andSelf=pe.fn.addBack,layui.define(function(e){layui.$=pe,e("jquery",pe)}),pe});!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var t=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}(),i=e.LAYUI_GLOBAL||{};return i.layer_dir||t.substring(0,t.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c="creating",u=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function d(t){var n=100,a=document.getElementById(f);return++u>1e4/n?e.console&&console.error(l+".css: Invalid"):void(1989===parseInt(o.getStyle(a,"width"))?(t===c&&a.removeAttribute("lay-status"),a.getAttribute("lay-status")===c?setTimeout(d,n):i()):(a.setAttribute("lay-status",c),setTimeout(function(){d(c)},n)))}()}}},r={v:"3.5.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:260},n))}},s=function(e){var t=this,a=function(){t.creat()};t.index=++r.index,t.config.maxWidth=i(n).width()-30,t.config=i.extend({},t.config,o.config,e),document.body?a():setTimeout(function(){a()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],l.SHADE="layui-layer-shade",l.MOVE="layui-layer-move",s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,minStack:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'
'+(f?r.title[0]:r.title)+"
":"";return r.zIndex=s,t([r.shade?'
':"",'
'+(e&&2!=r.type?"":u)+'
'+(0==r.type&&r.icon!==-1?'':"")+(1==r.type&&e?"":r.content||"")+'
'+function(){var e=c?'':"";return r.closeBtn&&(e+=''),e}()+""+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t'+r.btn[t]+"";return'
'+e+"
"}():"")+(r.resize?'':"")+"
"],u,i('
')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"","auto"];t.content='';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i("#"+l.MOVE)[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),e.shadeo=i("#"+l.SHADE+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),e.shadeo.css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():function(){e.offset(),parseInt(o.getStyle(document.getElementById(l.MOVE),"z-index"))||function(){e.layero.css("visibility","hidden"),r.ready(function(){e.offset(),e.layero.css("visibility","visible")})}()}(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;af&&(a=f),ou&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index,t)}):a.success(n,t.index,t)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&t.shadeo.on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n,t.index);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n,t.index)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n,t.index)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){t=t||{};var a=i("#"+l[0]+e),s=i("#"+l.SHADE+e),f=a.find(l[1]).outerHeight()||0,c=a.attr("minLeft")||181*o.minIndex+"px",u=a.css("position"),d={width:180,height:f,position:"fixed",overflow:"hidden"};o.record(a),o.minLeft[0]&&(c=o.minLeft[0],o.minLeft.shift()),t.minStack&&(d.left=c,d.top=n.height()-f,a.attr("minLeft")||o.minIndex++,a.attr("minLeft",c)),a.attr("position",u),r.style(e,d,!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),s.hide()},r.restore=function(e){var t=i("#"+l[0]+e),n=i("#"+l.SHADE+e),a=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(a[0]),height:parseFloat(a[1]),top:parseFloat(a[2]),left:parseFloat(a[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e),n.show()},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e,t){var n=i("#"+l[0]+e),a=n.attr("type"),s="layer-anim-close";if(n[0]){var f="layui-layer-wrap",c=function(){if(a===o.type[1]&&"object"===n.attr("conType")){n.children(":not(."+l[5]+")").remove();for(var r=n.find("."+f),s=0;s<2;s++)r.unwrap();r.css("display",r.data("display")).removeClass(f)}else{if(a===o.type[2])try{var c=i("#"+l[4]+e)[0];c.contentWindow.document.write(""),c.contentWindow.close(),n.find("."+l[5])[0].removeChild(c)}catch(u){}n[0].innerHTML="",n.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e],"function"==typeof t&&t()};n.data("isOutAnim")&&n.addClass("layer-anim "+s),i("#layui-layer-moves, #"+l.SHADE+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),n.attr("minLeft")&&(o.minIndex--,o.minLeft.push(n.attr("minLeft"))),r.ie&&r.ie<10||!n.data("isOutAnim")?c():setTimeout(function(){c()},200)}},r.closeAll=function(e,t){"function"==typeof e&&(t=e,e=null);var n=i("."+l[0]);i.each(n,function(a){var o=i(this),s=e?o.attr("type")===e:1;s&&r.close(o.attr("times"),a===n.length-1?t:null),s=null}),0===n.length&&"function"==typeof t&&t()};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a=''+t[0].title+"";i"+t[i].title+"";return a}(),content:'
    '+function(){var e=t.length,i=1,a="";if(e>0)for(a='
  • '+(t[0].content||"no content")+"
  • ";i'+(t[i].content||"no content")+"";return a}()+"
",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=!("string"==typeof t.photos||t.photos instanceof i),f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){h();var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0)}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev(!0)}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext(!0)}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),a&&(t.anim=-1),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]'+(u[d].alt||'+function(){return u.length>1?'
'+(u[d].alt||"")+""+s.imgIndex+" / "+u.length+"
":""}()+"
",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){r.ready(),o.run(e.jQuery)}()}(window);layui.define("jquery",function(e){"use strict";var t=layui.$,i=layui.hint(),n={fixbar:function(e){var i,n,r="layui-fixbar",a="layui-fixbar-top",o=t(document),l=t("body");e=t.extend({showHeight:200},e),e.bar1=e.bar1===!0?"":e.bar1,e.bar2=e.bar2===!0?"":e.bar2,e.bgcolor=e.bgcolor?"background-color:"+e.bgcolor:"";var c=[e.bar1,e.bar2,""],g=t(['
    ',e.bar1?'
  • '+c[0]+"
  • ":"",e.bar2?'
  • '+c[1]+"
  • ":"",'
  • '+c[2]+"
  • ","
"].join("")),u=g.find("."+a),s=function(){var t=o.scrollTop();t>=e.showHeight?i||(u.show(),i=1):i&&(u.hide(),i=0)};t("."+r)[0]||("object"==typeof e.css&&g.css(e.css),l.append(g),s(),g.find("li").on("click",function(){var i=t(this),n=i.attr("lay-type");"top"===n&&t("html,body").animate({scrollTop:0},200),e.click&&e.click.call(this,n)}),o.on("scroll",function(){clearTimeout(n),n=setTimeout(function(){s()},100)}))},countdown:function(e,t,i){var n=this,r="function"==typeof t,a=new Date(e).getTime(),o=new Date(!t||r?(new Date).getTime():t).getTime(),l=a-o,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];r&&(i=t);var g=setTimeout(function(){n.countdown(e,o+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],t,g),l<=0&&clearTimeout(g),g},timeAgo:function(e,t){var i=this,n=[[],[]],r=(new Date).getTime()-new Date(e).getTime();return r>26784e5?(r=new Date(e),n[0][0]=i.digit(r.getFullYear(),4),n[0][1]=i.digit(r.getMonth()+1),n[0][2]=i.digit(r.getDate()),t||(n[1][0]=i.digit(r.getHours()),n[1][1]=i.digit(r.getMinutes()),n[1][2]=i.digit(r.getSeconds())),n[0].join("-")+" "+n[1].join(":")):r>=864e5?(r/1e3/60/60/24|0)+"\u5929\u524d":r>=36e5?(r/1e3/60/60|0)+"\u5c0f\u65f6\u524d":r>=18e4?(r/1e3/60|0)+"\u5206\u949f\u524d":r<0?"\u672a\u6765":"\u521a\u521a"},digit:function(e,t){var i="";e=String(e),t=t||2;for(var n=e.length;n/g,">").replace(/'/g,"'").replace(/"/g,""")},unescape:function(e){return String(e||"").replace(/\&/g,"&").replace(/\</g,"<").replace(/\>/g,">").replace(/\'/,"'").replace(/\"/,'"')},toVisibleArea:function(e){if(e=t.extend({margin:160,duration:200,type:"y"},e),e.scrollElem[0]&&e.thisElem[0]){var i=e.scrollElem,n=e.thisElem,r="y"===e.type,a=r?"scrollTop":"scrollLeft",o=r?"top":"left",l=i[a](),c=i[r?"height":"width"](),g=i.offset()[o],u=n.offset()[o]-g,s={};(u>c-e.margin||u0&&t.unshift(""),t.join(" ")}()+">"+(a.title||"unnaming")+"";return s[0]?s.before(r):n.append(r),o.append('
'+(a.content||"")+"
"),b.hideTabMore(!0),b.tabAuto(),this},s.prototype.tabDelete=function(t,a){var e=".layui-tab-title",l=i(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+a+'"]');return b.tabDelete(null,s),this},s.prototype.tabChange=function(t,a){var e=".layui-tab-title",l=i(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+a+'"]');return b.tabClick.call(s[0],null,null,s),this},s.prototype.tab=function(t){t=t||{},m.on("click",t.headerElem,function(a){var e=i(this).index();b.tabClick.call(this,a,e,null,t)})},s.prototype.progress=function(t,a){var e="layui-progress",l=i("."+e+"[lay-filter="+t+"]"),n=l.find("."+e+"-bar"),s=n.find("."+e+"-text");return n.css("width",a).attr("lay-percent",a),s.text(a),this};var o=".layui-nav",r="layui-nav-item",c="layui-nav-bar",u="layui-nav-tree",y="layui-nav-child",d="layui-nav-child-c",f="layui-nav-more",h="layui-icon-down",p="layui-anim layui-anim-upbit",b={tabClick:function(t,a,s,o){o=o||{};var r=s||i(this),a=a||r.parent().children("li").index(r),c=o.headerElem?r.parent():r.parents(".layui-tab").eq(0),u=o.bodyElem?i(o.bodyElem):c.children(".layui-tab-content").children(".layui-tab-item"),y=r.find("a"),d="javascript:;"!==y.attr("href")&&"_blank"===y.attr("target"),f="string"==typeof r.attr("lay-unselect"),h=c.attr("lay-filter");d||f||(r.addClass(l).siblings().removeClass(l),u.eq(a).addClass(n).siblings().removeClass(n)),layui.event.call(this,e,"tab("+h+")",{elem:c,index:a})},tabDelete:function(t,a){var n=a||i(this).parent(),s=n.index(),o=n.parents(".layui-tab").eq(0),r=o.children(".layui-tab-content").children(".layui-tab-item"),c=o.attr("lay-filter");n.hasClass(l)&&(n.next()[0]?b.tabClick.call(n.next()[0],null,s+1):n.prev()[0]&&b.tabClick.call(n.prev()[0],null,s-1)),n.remove(),r.eq(s).remove(),setTimeout(function(){b.tabAuto()},50),layui.event.call(this,e,"tabDelete("+c+")",{elem:o,index:s})},tabAuto:function(){var t="layui-tab-more",e="layui-tab-bar",l="layui-tab-close",n=this;i(".layui-tab").each(function(){var s=i(this),o=s.children(".layui-tab-title"),r=(s.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),c=i('');if(n===window&&8!=a.ie&&b.hideTabMore(!0),s.attr("lay-allowClose")&&o.find("li").each(function(){var t=i(this);if(!t.find("."+l)[0]){var a=i('');a.on("click",b.tabDelete),t.append(a)}}),"string"!=typeof s.attr("lay-unauto"))if(o.prop("scrollWidth")>o.outerWidth()+1){if(o.find("."+e)[0])return;o.append(c),s.attr("overflow",""),c.on("click",function(i){o[this.title?"removeClass":"addClass"](t),this.title=this.title?"":"\u6536\u7f29"})}else o.find("."+e).remove(),s.removeAttr("overflow")})},hideTabMore:function(t){var a=i(".layui-tab-title");t!==!0&&"tabmore"===i(t.target).attr("lay-stope")||(a.removeClass("layui-tab-more"),a.find(".layui-tab-bar").attr("title",""))},clickThis:function(){var t=i(this),a=t.parents(o),n=a.attr("lay-filter"),s=t.parent(),c=t.siblings("."+y),d="string"==typeof s.attr("lay-unselect");"javascript:;"!==t.attr("href")&&"_blank"===t.attr("target")||d||c[0]||(a.find("."+l).removeClass(l),s.addClass(l)),a.hasClass(u)&&(c.removeClass(p),c[0]&&(s["none"===c.css("display")?"addClass":"removeClass"](r+"ed"),"all"===a.attr("lay-shrink")&&s.siblings().removeClass(r+"ed"))),layui.event.call(this,e,"nav("+n+")",t)},collapse:function(){var t=i(this),a=t.find(".layui-colla-icon"),l=t.siblings(".layui-colla-content"),s=t.parents(".layui-collapse").eq(0),o=s.attr("lay-filter"),r="none"===l.css("display");if("string"==typeof s.attr("lay-accordion")){var c=s.children(".layui-colla-item").children("."+n);c.siblings(".layui-colla-title").children(".layui-colla-icon").html(""),c.removeClass(n)}l[r?"addClass":"removeClass"](n),a.html(r?"":""),layui.event.call(this,e,"collapse("+o+")",{title:t,content:l,show:r})}};s.prototype.init=function(t,e){var l=function(){return e?'[lay-filter="'+e+'"]':""}(),s={tab:function(){b.tabAuto.call({})},nav:function(){var t=200,e={},s={},v={},m="layui-nav-title",C=function(l,o,r){var c=i(this),h=c.find("."+y);if(o.hasClass(u)){if(!h[0]){var b=c.children("."+m);l.css({top:c.offset().top-o.offset().top,height:(b[0]?b:c).outerHeight(),opacity:1})}}else h.addClass(p),h.hasClass(d)&&h.css({left:-(h.outerWidth()-c.width())/2}),h[0]?l.css({left:l.position().left+l.width()/2,width:0,opacity:0}):l.css({left:c.position().left+parseFloat(c.css("marginLeft")),top:c.position().top+c.height()-l.height()}),e[r]=setTimeout(function(){l.css({width:h[0]?0:c.width(),opacity:h[0]?0:1})},a.ie&&a.ie<10?0:t),clearTimeout(v[r]),"block"===h.css("display")&&clearTimeout(s[r]),s[r]=setTimeout(function(){h.addClass(n),c.find("."+f).addClass(f+"d")},300)};i(o+l).each(function(a){var l=i(this),o=i(''),d=l.find("."+r);l.find("."+c)[0]||(l.append(o),(l.hasClass(u)?d.find("dd,>."+m):d).on("mouseenter",function(){C.call(this,o,l,a)}).on("mouseleave",function(){l.hasClass(u)?o.css({height:0,opacity:0}):(clearTimeout(s[a]),s[a]=setTimeout(function(){l.find("."+y).removeClass(n),l.find("."+f).removeClass(f+"d")},300))}),l.on("mouseleave",function(){clearTimeout(e[a]),v[a]=setTimeout(function(){l.hasClass(u)||o.css({width:0,left:o.position().left+o.width()/2,opacity:0})},t)})),d.find("a").each(function(){var t=i(this),a=(t.parent(),t.siblings("."+y));a[0]&&!t.children("."+f)[0]&&t.append(''),t.off("click",b.clickThis).on("click",b.clickThis)})})},breadcrumb:function(){var t=".layui-breadcrumb";i(t+l).each(function(){var t=i(this),a="lay-separator",e=t.attr(a)||"/",l=t.find("a");l.next("span["+a+"]")[0]||(l.each(function(t){t!==l.length-1&&i(this).after(""+e+"")}),t.css("visibility","visible"))})},progress:function(){var t="layui-progress";i("."+t+l).each(function(){var a=i(this),e=a.find(".layui-progress-bar"),l=e.attr("lay-percent");e.css("width",function(){return/^.+\/.+$/.test(l)?100*new Function("return "+l)()+"%":l}()),a.attr("lay-showPercent")&&setTimeout(function(){e.html(''+l+"")},350)})},collapse:function(){var t="layui-collapse";i("."+t+l).each(function(){var t=i(this).find(".layui-colla-item");t.each(function(){var t=i(this),a=t.find(".layui-colla-title"),e=t.find(".layui-colla-content"),l="none"===e.css("display");a.find(".layui-colla-icon").remove(),a.append(''+(l?"":"")+""),a.off("click",b.collapse).on("click",b.collapse)})})}};return s[t]?s[t]():layui.each(s,function(t,i){i()})},s.prototype.render=s.prototype.init;var v=new s,m=i(document);i(function(){v.render()});var C=".layui-tab-title li";m.on("click",C,b.tabClick),m.on("click",b.hideTabMore),i(window).on("resize",b.tabAuto),t(e,v)});layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,n=layui.hint(),o=layui.device(),a={config:{},set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,r,e,t)}},l=function(){var e=this;return{upload:function(t){e.upload.call(e,t)},reload:function(t){e.reload.call(e,t)},config:e.config}},r="upload",u="layui-upload-file",c="layui-upload-form",f="layui-upload-iframe",s="layui-upload-choose",p=function(e){var i=this;i.config=t.extend({},i.config,a.config,e),i.render()};p.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",field:"file",acceptMime:"",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1},p.prototype.render=function(e){var i=this,e=i.config;e.elem=t(e.elem),e.bindAction=t(e.bindAction),i.file(),i.events()},p.prototype.file=function(){var e=this,i=e.config,n=e.elemFile=t(['"].join("")),a=i.elem.next();(a.hasClass(u)||a.hasClass(c))&&a.remove(),o.ie&&o.ie<10&&i.elem.wrap('
'),e.isFile()?(e.elemFile=i.elem,i.field=i.elem[0].name):i.elem.after(n),o.ie&&o.ie<10&&e.initIE()},p.prototype.initIE=function(){var e=this,i=e.config,n=t(''),o=t(['
',"
"].join(""));t("#"+f)[0]||t("body").append(n),i.elem.next().hasClass(c)||(e.elemFile.wrap(o),i.elem.next("."+c).append(function(){var e=[];return layui.each(i.data,function(t,i){i="function"==typeof i?i():i,e.push('')}),e.join("")}()))},p.prototype.msg=function(e){return i.msg(e,{icon:2,shift:6})},p.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},p.prototype.preview=function(e){var t=this;window.FileReader&&layui.each(t.chooseFiles,function(t,i){var n=new FileReader;n.readAsDataURL(i),n.onload=function(){e&&e(t,i,this.result)}})},p.prototype.upload=function(e,i){var n,a=this,l=a.config,r=a.elemFile[0],u=function(){var i=0,n=0,o=e||a.files||a.chooseFiles||r.files,u=function(){l.multiple&&i+n===a.fileLength&&"function"==typeof l.allDone&&l.allDone({total:a.fileLength,successful:i,aborted:n})};layui.each(o,function(e,o){var r=new FormData;r.append(l.field,o),layui.each(l.data,function(e,t){t="function"==typeof t?t():t,r.append(e,t)});var c={url:l.url,type:"post",data:r,contentType:!1,processData:!1,dataType:"json",headers:l.headers||{},success:function(t){i++,d(e,t),u()},error:function(){n++,a.msg("\u8bf7\u6c42\u4e0a\u4f20\u63a5\u53e3\u51fa\u73b0\u5f02\u5e38"),m(e),u()}};"function"==typeof l.progress&&(c.xhr=function(){var i=t.ajaxSettings.xhr();return i.upload.addEventListener("progress",function(t){if(t.lengthComputable){var i=Math.floor(t.loaded/t.total*100);l.progress(i,l.item?l.item[0]:l.elem[0],t,e)}}),i}),t.ajax(c)})},c=function(){var e=t("#"+f);a.elemFile.parent().submit(),clearInterval(p.timer),p.timer=setInterval(function(){var t,i=e.contents().find("body");try{t=i.text()}catch(n){a.msg("\u83b7\u53d6\u4e0a\u4f20\u540e\u7684\u54cd\u5e94\u4fe1\u606f\u51fa\u73b0\u5f02\u5e38"),clearInterval(p.timer),m()}t&&(clearInterval(p.timer),i.html(""),d(0,t))},30)},d=function(e,t){if(a.elemFile.next("."+s).remove(),r.value="","object"!=typeof t)try{t=JSON.parse(t)}catch(i){return t={},a.msg("\u8bf7\u5bf9\u4e0a\u4f20\u63a5\u53e3\u8fd4\u56de\u6709\u6548JSON")}"function"==typeof l.done&&l.done(t,e||0,function(e){a.upload(e)})},m=function(e){l.auto&&(r.value=""),"function"==typeof l.error&&l.error(e||0,function(e){a.upload(e)})},h=l.exts,v=function(){var t=[];return layui.each(e||a.chooseFiles,function(e,i){t.push(i.name)}),t}(),g={preview:function(e){a.preview(e)},upload:function(e,t){var i={};i[e]=t,a.upload(i)},pushFile:function(){return a.files=a.files||{},layui.each(a.chooseFiles,function(e,t){a.files[e]=t}),a.files},resetFile:function(e,t,i){var n=new File([t],i);a.files=a.files||{},a.files[e]=n}},y=function(){if(!(("choose"===i||l.auto)&&(l.choose&&l.choose(g),"choose"===i)||l.before&&l.before(g)===!1))return o.ie?o.ie>9?u():c():void u()};if(v=0===v.length?r.value.match(/[^\/\\]+\..+/g)||[]||"":v,0!==v.length){switch(l.accept){case"file":if(h&&!RegExp("\\w\\.("+h+")$","i").test(escape(v)))return a.msg("\u9009\u62e9\u7684\u6587\u4ef6\u4e2d\u5305\u542b\u4e0d\u652f\u6301\u7684\u683c\u5f0f"),r.value="";break;case"video":if(!RegExp("\\w\\.("+(h||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(v)))return a.msg("\u9009\u62e9\u7684\u89c6\u9891\u4e2d\u5305\u542b\u4e0d\u652f\u6301\u7684\u683c\u5f0f"),r.value="";break;case"audio":if(!RegExp("\\w\\.("+(h||"mp3|wav|mid")+")$","i").test(escape(v)))return a.msg("\u9009\u62e9\u7684\u97f3\u9891\u4e2d\u5305\u542b\u4e0d\u652f\u6301\u7684\u683c\u5f0f"),r.value="";break;default:if(layui.each(v,function(e,t){RegExp("\\w\\.("+(h||"jpg|png|gif|bmp|jpeg$")+")","i").test(escape(t))||(n=!0)}),n)return a.msg("\u9009\u62e9\u7684\u56fe\u7247\u4e2d\u5305\u542b\u4e0d\u652f\u6301\u7684\u683c\u5f0f"),r.value=""}if(a.fileLength=function(){var t=0,i=e||a.files||a.chooseFiles||r.files;return layui.each(i,function(){t++}),t}(),l.number&&a.fileLength>l.number)return a.msg("\u540c\u65f6\u6700\u591a\u53ea\u80fd\u4e0a\u4f20\u7684\u6570\u91cf\u4e3a\uff1a"+l.number);if(l.size>0&&!(o.ie&&o.ie<10)){var F;if(layui.each(a.chooseFiles,function(e,t){if(t.size>1024*l.size){var i=l.size/1024;i=i>=1?i.toFixed(2)+"MB":l.size+"KB",r.value="",F=i}}),F)return a.msg("\u6587\u4ef6\u4e0d\u80fd\u8d85\u8fc7"+F)}y()}},p.prototype.reload=function(e){e=e||{},delete e.elem,delete e.bindAction;var i=this,e=i.config=t.extend({},i.config,a.config,e),n=e.elem.next();n.attr({name:e.name,accept:e.acceptMime,multiple:e.multiple})},p.prototype.events=function(){var e=this,i=e.config,a=function(t){e.chooseFiles={},layui.each(t,function(t,i){var n=(new Date).getTime();e.chooseFiles[n+"-"+t]=i})},l=function(t,n){var o=e.elemFile,a=(i.item?i.item:i.elem,t.length>1?t.length+"\u4e2a\u6587\u4ef6":(t[0]||{}).name||o[0].value.match(/[^\/\\]+\..+/g)||[]||"");o.next().hasClass(s)&&o.next().remove(),e.upload(null,"choose"),e.isFile()||i.choose||o.after(''+a+"")};i.elem.off("upload.start").on("upload.start",function(){var o=t(this),a=o.attr("lay-data");if(a)try{a=new Function("return "+a)(),e.config=t.extend({},i,a)}catch(l){n.error("Upload element property lay-data configuration item has a syntax error: "+a)}e.config.item=o,e.elemFile[0].click()}),o.ie&&o.ie<10||i.elem.off("upload.over").on("upload.over",function(){var e=t(this);e.attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){var e=t(this);e.removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(n,o){var r=t(this),u=o.originalEvent.dataTransfer.files||[];r.removeAttr("lay-over"),a(u),i.auto?e.upload(u):l(u)}),e.elemFile.off("upload.change").on("upload.change",function(){var t=this.files||[];a(t),i.auto?e.upload():l(t)}),i.bindAction.off("upload.action").on("upload.action",function(){e.upload()}),i.elem.data("haveEvents")||(e.elemFile.on("change",function(){t(this).trigger("upload.change")}),i.elem.on("click",function(){e.isFile()||t(this).trigger("upload.start")}),i.drag&&i.elem.on("dragover",function(e){e.preventDefault(),t(this).trigger("upload.over")}).on("dragleave",function(e){t(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),t(this).trigger("upload.drop",e)}),i.bindAction.on("click",function(){t(this).trigger("upload.action")}),i.elem.data("haveEvents",!0))},a.render=function(e){var t=new p(e);return l.call(t)},e(r,a)});layui.define(["jquery","laytpl","lay"],function(e){"use strict";var i=layui.$,n=layui.laytpl,t=layui.hint(),a=layui.device(),l=a.mobile?"click":"mousedown",r="dropdown",o="layui_"+r+"_index",u={config:{},index:layui[r]?layui[r].index+1e4:0,set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,r,e,i)}},d=function(){var e=this,i=e.config,n=i.id;return d.that[n]=e,{config:i,reload:function(i){e.reload.call(e,i)}}},s="layui-dropdown",m="layui-menu-item-up",c="layui-menu-item-down",p="layui-menu-body-title",y="layui-menu-item-group",f="layui-menu-item-parent",v="layui-menu-item-divider",g="layui-menu-item-checked",h="layui-menu-item-checked2",w="layui-menu-body-panel",C="layui-menu-body-panel-left",V="."+y+">."+p,k=function(e){var n=this;n.index=++u.index,n.config=i.extend({},n.config,u.config,e),n.init()};k.prototype.config={trigger:"click",content:"",className:"",style:"",show:!1,isAllowSpread:!0,isSpreadItem:!0,data:[],delay:300},k.prototype.reload=function(e){var n=this;n.config=i.extend({},n.config,e),n.init(!0)},k.prototype.init=function(e){var n=this,t=n.config,a=t.elem=i(t.elem);if(a.length>1)return layui.each(a,function(){u.render(i.extend({},t,{elem:this}))}),n;if(!e&&a[0]&&a.data(o)){var l=d.getThis(a.data(o));if(!l)return;return l.reload(t)}t.id="id"in t?t.id:n.index,t.show&&n.render(e),n.events()},k.prototype.render=function(e){var t=this,a=t.config,r=i("body"),s=function(){var e=i('
    ');return a.data.length>0?m(e,a.data):e.html('
  • no menu
  • '),e},m=function(e,t){return layui.each(t,function(t,l){var r=l.child&&l.child.length>0,o="isSpreadItem"in l?l.isSpreadItem:a.isSpreadItem,u=l.templet?n(l.templet).render(l):a.templet?n(a.templet).render(l):l.title,d=function(){return r&&(l.type=l.type||"parent"),l.type?{group:"group",parent:"parent","-":"-"}[l.type]||"parent":""}();if("-"===d||l.title||l.id||r){var s=i(["",function(){var e="href"in l?''+u+"":u;return r?'
    '+e+function(){return"parent"===d?'':"group"===d&&a.isAllowSpread?'':""}()+"
    ":'
    '+e+"
    "}(),""].join(""));if(s.data("item",l),r){var c=i('
    '),y=i("
      ");"parent"===d?(c.append(m(y,l.child)),s.append(c)):s.append(m(y,l.child))}e.append(s)}}),e},c=['
      ',"
      "].join("");("contextmenu"===a.trigger||lay.isTopElem(a.elem[0]))&&(e=!0),!e&&a.elem.data(o+"_opened")||(t.elemView=i(c),t.elemView.append(a.content||s()),a.className&&t.elemView.addClass(a.className),a.style&&t.elemView.attr("style",a.style),u.thisId=a.id,t.remove(),r.append(t.elemView),a.elem.data(o+"_opened",!0),t.position(),d.prevElem=t.elemView,d.prevElem.data("prevElem",a.elem),t.elemView.find(".layui-menu").on(l,function(e){layui.stope(e)}),t.elemView.find(".layui-menu li").on("click",function(e){var n=i(this),l=n.data("item")||{},r=l.child&&l.child.length>0;r||"-"===l.type||(t.remove(),"function"==typeof a.click&&a.click(l,n))}),t.elemView.find(V).on("click",function(e){var n=i(this),t=n.parent(),l=t.data("item")||{};"group"===l.type&&a.isAllowSpread&&d.spread(t)}),"mouseenter"===a.trigger&&t.elemView.on("mouseenter",function(){clearTimeout(d.timer)}).on("mouseleave",function(){t.delayRemove()}))},k.prototype.position=function(e){var i=this,n=i.config;lay.position(n.elem[0],i.elemView[0],{position:n.position,e:i.e,clickType:"contextmenu"===n.trigger?"right":null,align:n.align||null})},k.prototype.remove=function(){var e=this,i=(e.config,d.prevElem);i&&(i.data("prevElem")&&i.data("prevElem").data(o+"_opened",!1),i.remove())},k.prototype.delayRemove=function(){var e=this,i=e.config;clearTimeout(d.timer),d.timer=setTimeout(function(){e.remove()},i.delay)},k.prototype.events=function(){var e=this,i=e.config;"hover"===i.trigger&&(i.trigger="mouseenter"),e.prevElem&&e.prevElem.off(i.trigger,e.prevElemCallback),e.prevElem=i.elem,e.prevElemCallback=function(n){clearTimeout(d.timer),e.e=n,e.render(),n.preventDefault(),"function"==typeof i.ready&&i.ready(e.elemView,i.elem,e.e.target)},i.elem.on(i.trigger,e.prevElemCallback),"mouseenter"===i.trigger&&i.elem.on("mouseleave",function(){e.delayRemove()})},d.that={},d.getThis=function(e){var i=d.that[e];return i||t.error(e?r+" instance with ID '"+e+"' not found":"ID argument required"),i},d.spread=function(e){var i=e.children("."+p).find(".layui-icon");e.hasClass(m)?(e.removeClass(m).addClass(c),i.removeClass("layui-icon-down").addClass("layui-icon-up")):(e.removeClass(c).addClass(m),i.removeClass("layui-icon-up").addClass("layui-icon-down"))},!function(){var e=i(window),n=i(document);e.on("resize",function(){if(u.thisId){var e=d.getThis(u.thisId);if(e){if(!e.elemView[0]||!i("."+s)[0])return!1;var n=e.config;"contextmenu"===n.trigger?e.remove():e.position()}}}),n.on(l,function(e){if(u.thisId){var i=d.getThis(u.thisId);if(i){var n=i.config;!lay.isTopElem(n.elem[0])&&"contextmenu"!==n.trigger&&(e.target===n.elem[0]||n.elem.find(e.target)[0]||e.target===i.elemView[0]||i.elemView&&i.elemView.find(e.target)[0])||i.remove()}}});var t=".layui-menu:not(.layui-dropdown-menu) li";n.on("click",t,function(e){var n=i(this),t=n.parents(".layui-menu").eq(0),a=n.hasClass(y)||n.hasClass(f),l=t.attr("lay-filter")||t.attr("id"),o=lay.options(this);n.hasClass(v)||a||(t.find("."+g).removeClass(g),t.find("."+h).removeClass(h),n.addClass(g),n.parents("."+f).addClass(h),layui.event.call(this,r,"click("+l+")",o))}),n.on("click",t+V,function(e){var n=i(this),t=n.parents("."+y+":eq(0)"),a=lay.options(t[0]);"isAllowSpread"in a&&!a.isAllowSpread||d.spread(t)});var a=".layui-menu ."+f;n.on("mouseenter",a,function(n){var t=i(this),a=t.find("."+w);if(a[0]){var l=a[0].getBoundingClientRect();l.right>e.width()&&(a.addClass(C),l=a[0].getBoundingClientRect(),l.left<0&&a.removeClass(C)),l.bottom>e.height()&&a.eq(0).css("margin-top",-(l.bottom-e.height()))}}).on("mouseleave",a,function(e){var n=i(this),t=n.children("."+w);t.removeClass(C),t.css("margin-top",0)})}(),u.reload=function(e,i){var n=d.getThis(e);return n?(n.reload(i),d.call(n)):this},u.render=function(e){var i=new k(e);return d.call(i)},e(r,u)});layui.define("jquery",function(e){"use strict";var i=layui.jquery,t={config:{},index:layui.slider?layui.slider.index+1e4:0,set:function(e){var t=this;return t.config=i.extend({},t.config,e),t},on:function(e,i){return layui.onevent.call(this,n,e,i)}},a=function(){var e=this,i=e.config;return{setValue:function(t,a){return i.value=t,e.slide("set",t,a||0)},config:i}},n="slider",l="layui-disabled",s="layui-slider",r="layui-slider-bar",o="layui-slider-wrap",u="layui-slider-wrap-btn",d="layui-slider-tips",v="layui-slider-input",c="layui-slider-input-txt",p="layui-slider-input-btn",m="layui-slider-hover",f=function(e){var a=this;a.index=++t.index,a.config=i.extend({},a.config,t.config,e),a.render()};f.prototype.config={type:"default",min:0,max:100,value:0,step:1,showstep:!1,tips:!0,input:!1,range:!1,height:200,disabled:!1,theme:"#009688"},f.prototype.render=function(){var e=this,t=e.config;if(t.step<1&&(t.step=1),t.maxt.min?a:t.min,t.value[1]=n>t.min?n:t.min,t.value[0]=t.value[0]>t.max?t.max:t.value[0],t.value[1]=t.value[1]>t.max?t.max:t.value[1];var r=Math.floor((t.value[0]-t.min)/(t.max-t.min)*100),v=Math.floor((t.value[1]-t.min)/(t.max-t.min)*100),p=v-r+"%";r+="%",v+="%"}else{"object"==typeof t.value&&(t.value=Math.min.apply(null,t.value)),t.valuet.max&&(t.value=t.max);var p=Math.floor((t.value-t.min)/(t.max-t.min)*100)+"%"}var m=t.disabled?"#c2c2c2":t.theme,f='
      '+(t.tips?'
      ':"")+'
      '+(t.range?'
      ':"")+"
      ",h=i(t.elem),y=h.next("."+s);if(y[0]&&y.remove(),e.elemTemp=i(f),t.range?(e.elemTemp.find("."+o).eq(0).data("value",t.value[0]),e.elemTemp.find("."+o).eq(1).data("value",t.value[1])):e.elemTemp.find("."+o).data("value",t.value),h.html(e.elemTemp),"vertical"===t.type&&e.elemTemp.height(t.height+"px"),t.showstep){for(var g=(t.max-t.min)/t.step,b="",x=1;x
      ')}e.elemTemp.append(b)}if(t.input&&!t.range){var w=i('
      ');h.css("position","relative"),h.append(w),h.find("."+c).children("input").val(t.value),"vertical"===t.type?w.css({left:0,top:-48}):e.elemTemp.css("margin-right",w.outerWidth()+15)}t.disabled?(e.elemTemp.addClass(l),e.elemTemp.find("."+u).addClass(l)):e.slide(),e.elemTemp.find("."+u).on("mouseover",function(){var a="vertical"===t.type?t.height:e.elemTemp[0].offsetWidth,n=e.elemTemp.find("."+o),l="vertical"===t.type?a-i(this).parent()[0].offsetTop-n.height():i(this).parent()[0].offsetLeft,s=l/a*100,r=i(this).parent().data("value"),u=t.setTips?t.setTips(r):r;e.elemTemp.find("."+d).html(u),"vertical"===t.type?e.elemTemp.find("."+d).css({bottom:s+"%","margin-bottom":"20px",display:"inline-block"}):e.elemTemp.find("."+d).css({left:s+"%",display:"inline-block"})}).on("mouseout",function(){e.elemTemp.find("."+d).css("display","none")})},f.prototype.slide=function(e,t,a){var n=this,l=n.config,s=n.elemTemp,f=function(){return"vertical"===l.type?l.height:s[0].offsetWidth},h=s.find("."+o),y=s.next("."+v),g=y.children("."+c).children("input").val(),b=100/((l.max-l.min)/Math.ceil(l.step)),x=function(e,i){e=Math.ceil(e)*b>100?Math.ceil(e)*b:Math.round(e)*b,e=e>100?100:e,h.eq(i).css("vertical"===l.type?"bottom":"left",e+"%");var t=T(h[0].offsetLeft),a=l.range?T(h[1].offsetLeft):0;"vertical"===l.type?(s.find("."+d).css({bottom:e+"%","margin-bottom":"20px"}),t=T(f()-h[0].offsetTop-h.height()),a=l.range?T(f()-h[1].offsetTop-h.height()):0):s.find("."+d).css("left",e+"%"),t=t>100?100:t,a=a>100?100:a;var n=Math.min(t,a),o=Math.abs(t-a);"vertical"===l.type?s.find("."+r).css({height:o+"%",bottom:n+"%"}):s.find("."+r).css({width:o+"%",left:n+"%"});var u=l.min+Math.round((l.max-l.min)*e/100);if(g=u,y.children("."+c).children("input").val(g),h.eq(i).data("value",u),s.find("."+d).html(l.setTips?l.setTips(u):u),l.range){var v=[h.eq(0).data("value"),h.eq(1).data("value")];v[0]>v[1]&&v.reverse()}l.change&&l.change(l.range?v:u)},T=function(e){var i=e/f()*100/b,t=Math.round(i)*b;return e==f()&&(t=Math.ceil(i)*b),t},w=i(['
      f()&&(r=f());var o=r/f()*100/b;x(o,e),t.addClass(m),s.find("."+d).show(),i.preventDefault()},o=function(){t.removeClass(m),s.find("."+d).hide()};M(r,o)})}),s.on("click",function(e){var t=i("."+u);if(!t.is(event.target)&&0===t.has(event.target).length&&t.length){var a,n="vertical"===l.type?f()-e.clientY+i(this).offset().top:e.clientX-i(this).offset().left;n<0&&(n=0),n>f()&&(n=f());var s=n/f()*100/b;a=l.range?"vertical"===l.type?Math.abs(n-parseInt(i(h[0]).css("bottom")))>Math.abs(n-parseInt(i(h[1]).css("bottom")))?1:0:Math.abs(n-h[0].offsetLeft)>Math.abs(n-h[1].offsetLeft)?1:0:0,x(s,a),e.preventDefault()}}),y.children("."+p).children("i").each(function(e){i(this).on("click",function(){g=y.children("."+c).children("input").val(),g=1==e?g-l.stepl.max?l.max:Number(g)+l.step;var i=(g-l.min)/(l.max-l.min)*100/b;x(i,0)})});var q=function(){var e=this.value;e=isNaN(e)?0:e,e=el.max?l.max:e,this.value=e;var i=(e-l.min)/(l.max-l.min)*100/b;x(i,0)};y.children("."+c).children("input").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),q.call(this))}).on("change",q)},f.prototype.events=function(){var e=this;e.config},t.render=function(e){var i=new f(e);return a.call(i)},e(n,t)});layui.define(["jquery","lay"],function(e){"use strict";var i=layui.jquery,r=layui.lay,o=layui.device(),n=o.mobile?"click":"mousedown",l={config:{},index:layui.colorpicker?layui.colorpicker.index+1e4:0,set:function(e){var r=this;return r.config=i.extend({},r.config,e),r},on:function(e,i){return layui.onevent.call(this,"colorpicker",e,i)}},t=function(){var e=this,i=e.config;return{config:i}},c="colorpicker",a="layui-show",s="layui-colorpicker",f=".layui-colorpicker-main",d="layui-icon-down",u="layui-icon-close",p="layui-colorpicker-trigger-span",g="layui-colorpicker-trigger-i",v="layui-colorpicker-side",h="layui-colorpicker-side-slider",b="layui-colorpicker-basis",k="layui-colorpicker-alpha-bgcolor",y="layui-colorpicker-alpha-slider",m="layui-colorpicker-basis-cursor",x="layui-colorpicker-main-input",P=function(e){var i={h:0,s:0,b:0},r=Math.min(e.r,e.g,e.b),o=Math.max(e.r,e.g,e.b),n=o-r;return i.b=o,i.s=0!=o?255*n/o:0,0!=i.s?e.r==o?i.h=(e.g-e.b)/n:e.g==o?i.h=2+(e.b-e.r)/n:i.h=4+(e.r-e.g)/n:i.h=-1,o==r&&(i.h=0),i.h*=60,i.h<0&&(i.h+=360),i.s*=100/255,i.b*=100/255,i},C=function(e){var e=e.indexOf("#")>-1?e.substring(1):e;if(3==e.length){var i=e.split("");e=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]}e=parseInt(e,16);var r={r:e>>16,g:(65280&e)>>8,b:255&e};return P(r)},B=function(e){var i={},r=e.h,o=255*e.s/100,n=255*e.b/100;if(0==o)i.r=i.g=i.b=n;else{var l=n,t=(255-o)*n/255,c=(l-t)*(r%60)/60;360==r&&(r=0),r<60?(i.r=l,i.b=t,i.g=t+c):r<120?(i.g=l,i.b=t,i.r=l-c):r<180?(i.g=l,i.r=t,i.b=t+c):r<240?(i.b=l,i.r=t,i.g=l-c):r<300?(i.b=l,i.g=t,i.r=t+c):r<360?(i.r=l,i.g=t,i.b=l-c):(i.r=0,i.g=0,i.b=0)}return{r:Math.round(i.r),g:Math.round(i.g),b:Math.round(i.b)}},w=function(e){var r=B(e),o=[r.r.toString(16),r.g.toString(16),r.b.toString(16)];return i.each(o,function(e,i){1==i.length&&(o[e]="0"+i)}),o.join("")},D=function(e){var i=/[0-9]{1,3}/g,r=e.match(i)||[];return{r:r[0],g:r[1],b:r[2]}},j=i(window),E=i(document),F=function(e){var r=this;r.index=++l.index,r.config=i.extend({},r.config,l.config,e),r.render()};F.prototype.config={color:"",size:null,alpha:!1,format:"hex",predefine:!1,colors:["#009688","#5FB878","#1E9FFF","#FF5722","#FFB800","#01AAED","#999","#c00","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgb(0, 186, 189)","rgb(255, 120, 0)","rgb(250, 212, 0)","#393D49","rgba(0,0,0,.5)","rgba(255, 69, 0, 0.68)","rgba(144, 240, 144, 0.5)","rgba(31, 147, 255, 0.73)"]},F.prototype.render=function(){var e=this,r=e.config,o=i(['
      ',"",'3&&(r.alpha&&"rgb"==r.format||(e="#"+w(P(D(r.color))))),"background: "+e):e}()+'">','',"","","
      "].join("")),n=i(r.elem);r.size&&o.addClass("layui-colorpicker-"+r.size),n.addClass("layui-inline").html(e.elemColorBox=o),e.color=e.elemColorBox.find("."+p)[0].style.background,e.events()},F.prototype.renderPicker=function(){var e=this,r=e.config,o=e.elemColorBox[0],n=e.elemPicker=i(['
      ','
      ','
      ','
      ','
      ','
      ',"
      ",'
      ','
      ',"
      ","
      ",'
      ','
      ','
      ',"
      ","
      ",function(){if(r.predefine){var e=['
      '];return layui.each(r.colors,function(i,r){e.push(['
      ','
      ',"
      "].join(""))}),e.push("
      "),e.join("")}return""}(),'
      ','
      ','',"
      ",'
      ','','',"","
      "].join(""));e.elemColorBox.find("."+p)[0];i(f)[0]&&i(f).data("index")==e.index?e.removePicker(F.thisElemInd):(e.removePicker(F.thisElemInd),i("body").append(n)),F.thisElemInd=e.index,F.thisColor=o.style.background,e.position(),e.pickerEvents()},F.prototype.removePicker=function(e){var r=this;r.config;return i("#layui-colorpicker"+(e||r.index)).remove(),r},F.prototype.position=function(){var e=this,i=e.config;return r.position(e.bindElem||e.elemColorBox[0],e.elemPicker[0],{position:i.position,align:"center"}),e},F.prototype.val=function(){var e=this,i=(e.config,e.elemColorBox.find("."+p)),r=e.elemPicker.find("."+x),o=i[0],n=o.style.backgroundColor;if(n){var l=P(D(n)),t=i.attr("lay-type");if(e.select(l.h,l.s,l.b),"torgb"===t&&r.find("input").val(n),"rgba"===t){var c=D(n);if(3==(n.match(/[0-9]{1,3}/g)||[]).length)r.find("input").val("rgba("+c.r+", "+c.g+", "+c.b+", 1)"),e.elemPicker.find("."+y).css("left",280);else{r.find("input").val(n);var a=280*n.slice(n.lastIndexOf(",")+1,n.length-1);e.elemPicker.find("."+y).css("left",a)}e.elemPicker.find("."+k)[0].style.background="linear-gradient(to right, rgba("+c.r+", "+c.g+", "+c.b+", 0), rgb("+c.r+", "+c.g+", "+c.b+"))"}}else e.select(0,100,100),r.find("input").val(""),e.elemPicker.find("."+k)[0].style.background="",e.elemPicker.find("."+y).css("left",280)},F.prototype.side=function(){var e=this,r=e.config,o=e.elemColorBox.find("."+p),n=o.attr("lay-type"),l=e.elemPicker.find("."+v),t=e.elemPicker.find("."+h),c=e.elemPicker.find("."+b),a=e.elemPicker.find("."+m),s=e.elemPicker.find("."+k),f=e.elemPicker.find("."+y),C=t[0].offsetTop/180*360,w=100-(a[0].offsetTop+3)/180*100,E=(a[0].offsetLeft+3)/260*100,F=Math.round(f[0].offsetLeft/280*100)/100,H=e.elemColorBox.find("."+g),M=e.elemPicker.find(".layui-colorpicker-pre").children("div"),Y=function(i,l,t,c){e.select(i,l,t);var a=B({h:i,s:l,b:t});if(H.addClass(d).removeClass(u),o[0].style.background="rgb("+a.r+", "+a.g+", "+a.b+")","torgb"===n&&e.elemPicker.find("."+x).find("input").val("rgb("+a.r+", "+a.g+", "+a.b+")"),"rgba"===n){var p=0;p=280*c,f.css("left",p),e.elemPicker.find("."+x).find("input").val("rgba("+a.r+", "+a.g+", "+a.b+", "+c+")"),o[0].style.background="rgba("+a.r+", "+a.g+", "+a.b+", "+c+")",s[0].style.background="linear-gradient(to right, rgba("+a.r+", "+a.g+", "+a.b+", 0), rgb("+a.r+", "+a.g+", "+a.b+"))"}r.change&&r.change(e.elemPicker.find("."+x).find("input").val())},I=i(['
      '].join("")),L=function(e){i("#LAY-colorpicker-moving")[0]||i("body").append(I),I.on("mousemove",e),I.on("mouseup",function(){I.remove()}).on("mouseleave",function(){I.remove()})};t.on("mousedown",function(e){var i=this.offsetTop,r=e.clientY,o=function(e){var o=i+(e.clientY-r),n=l[0].offsetHeight;o<0&&(o=0),o>n&&(o=n);var t=o/180*360;C=t,Y(t,E,w,F),e.preventDefault()};L(o),e.preventDefault()}),l.on("click",function(e){var r=e.clientY-i(this).offset().top;r<0&&(r=0),r>this.offsetHeight&&(r=this.offsetHeight);var o=r/180*360;C=o,Y(o,E,w,F),e.preventDefault()}),a.on("mousedown",function(e){var i=this.offsetTop,r=this.offsetLeft,o=e.clientY,n=e.clientX,l=function(e){var l=i+(e.clientY-o),t=r+(e.clientX-n),a=c[0].offsetHeight-3,s=c[0].offsetWidth-3;l<-3&&(l=-3),l>a&&(l=a),t<-3&&(t=-3),t>s&&(t=s);var f=(t+3)/260*100,d=100-(l+3)/180*100;w=d,E=f,Y(C,f,d,F),e.preventDefault()};layui.stope(e),L(l),e.preventDefault()}),c.on("mousedown",function(e){var r=e.clientY-i(this).offset().top-3+j.scrollTop(),o=e.clientX-i(this).offset().left-3+j.scrollLeft();r<-3&&(r=-3),r>this.offsetHeight-3&&(r=this.offsetHeight-3),o<-3&&(o=-3),o>this.offsetWidth-3&&(o=this.offsetWidth-3);var n=(o+3)/260*100,l=100-(r+3)/180*100;w=l,E=n,Y(C,n,l,F),layui.stope(e),e.preventDefault(),a.trigger(e,"mousedown")}),f.on("mousedown",function(e){var i=this.offsetLeft,r=e.clientX,o=function(e){var o=i+(e.clientX-r),n=s[0].offsetWidth;o<0&&(o=0),o>n&&(o=n);var l=Math.round(o/280*100)/100;F=l,Y(C,E,w,l),e.preventDefault()};L(o),e.preventDefault()}),s.on("click",function(e){var r=e.clientX-i(this).offset().left;r<0&&(r=0),r>this.offsetWidth&&(r=this.offsetWidth);var o=Math.round(r/280*100)/100;F=o,Y(C,E,w,o),e.preventDefault()}),M.each(function(){i(this).on("click",function(){i(this).parent(".layui-colorpicker-pre").addClass("selected").siblings().removeClass("selected");var e,r=this.style.backgroundColor,o=P(D(r)),n=r.slice(r.lastIndexOf(",")+1,r.length-1);C=o.h,E=o.s,w=o.b,3==(r.match(/[0-9]{1,3}/g)||[]).length&&(n=1),F=n,e=280*n,Y(o.h,o.s,o.b,n)})})},F.prototype.select=function(e,i,r,o){var n=this,l=(n.config,w({h:e,s:100,b:100})),t=w({h:e,s:i,b:r}),c=e/360*180,a=180-r/100*180-3,s=i/100*260-3;n.elemPicker.find("."+h).css("top",c),n.elemPicker.find("."+b)[0].style.background="#"+l,n.elemPicker.find("."+m).css({top:a,left:s}),"change"!==o&&n.elemPicker.find("."+x).find("input").val("#"+t)},F.prototype.pickerEvents=function(){var e=this,r=e.config,o=e.elemColorBox.find("."+p),n=e.elemPicker.find("."+x+" input"),l={clear:function(i){o[0].style.background="",e.elemColorBox.find("."+g).removeClass(d).addClass(u),e.color="",r.done&&r.done(""),e.removePicker()},confirm:function(i,l){var t=n.val(),c=t,a={};if(t.indexOf(",")>-1){if(a=P(D(t)),e.select(a.h,a.s,a.b),o[0].style.background=c="#"+w(a),(t.match(/[0-9]{1,3}/g)||[]).length>3&&"rgba"===o.attr("lay-type")){var s=280*t.slice(t.lastIndexOf(",")+1,t.length-1);e.elemPicker.find("."+y).css("left",s),o[0].style.background=t,c=t}}else a=C(t),o[0].style.background=c="#"+w(a),e.elemColorBox.find("."+g).removeClass(u).addClass(d);return"change"===l?(e.select(a.h,a.s,a.b,l),void(r.change&&r.change(c))):(e.color=t,r.done&&r.done(t),void e.removePicker())}};e.elemPicker.on("click","*[colorpicker-events]",function(){var e=i(this),r=e.attr("colorpicker-events");l[r]&&l[r].call(this,e)}),n.on("keyup",function(e){var r=i(this);l.confirm.call(this,r,13===e.keyCode?null:"change")})},F.prototype.events=function(){var e=this,r=e.config,o=e.elemColorBox.find("."+p);e.elemColorBox.on("click",function(){e.renderPicker(),i(f)[0]&&(e.val(),e.side())}),r.elem[0]&&!e.elemColorBox[0].eventHandler&&(E.on(n,function(r){if(!i(r.target).hasClass(s)&&!i(r.target).parents("."+s)[0]&&!i(r.target).hasClass(f.replace(/\./g,""))&&!i(r.target).parents(f)[0]&&e.elemPicker){if(e.color){var n=P(D(e.color));e.select(n.h,n.s,n.b)}else e.elemColorBox.find("."+g).removeClass(d).addClass(u);o[0].style.background=e.color||"",e.removePicker()}}),j.on("resize",function(){return!(!e.elemPicker||!i(f)[0])&&void e.position()}),e.elemColorBox[0].eventHandler=!0)},l.render=function(e){var i=new F(e);return t.call(i)},e(c,l)});layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,a=layui.hint(),n=layui.device(),l="form",r=".layui-form",o="layui-this",s="layui-hide",c="layui-disabled",u=function(){this.config={verify:{required:[/[\S]+/,"\u5fc5\u586b\u9879\u4e0d\u80fd\u4e3a\u7a7a"],phone:[/^1\d{10}$/,"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u624b\u673a\u53f7"],email:[/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,"\u90ae\u7bb1\u683c\u5f0f\u4e0d\u6b63\u786e"],url:[/^(#|(http(s?)):\/\/|\/\/)[^\s]+\.[^\s]+$/,"\u94fe\u63a5\u683c\u5f0f\u4e0d\u6b63\u786e"],number:function(e){if(!e||isNaN(e))return"\u53ea\u80fd\u586b\u5199\u6570\u5b57"},date:[/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,"\u65e5\u671f\u683c\u5f0f\u4e0d\u6b63\u786e"],identity:[/(^\d{15}$)|(^\d{17}(x|X|\d)$)/,"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u8eab\u4efd\u8bc1\u53f7"]},autocomplete:null}};u.prototype.set=function(e){var i=this;return t.extend(!0,i.config,e),i},u.prototype.verify=function(e){var i=this;return t.extend(!0,i.config.verify,e),i},u.prototype.on=function(e,t){return layui.onevent.call(this,l,e,t)},u.prototype.val=function(e,i){var a=this,n=t(r+'[lay-filter="'+e+'"]');return n.each(function(e,a){var n=t(this);layui.each(i,function(e,t){var i,a=n.find('[name="'+e+'"]');a[0]&&(i=a[0].type,"checkbox"===i?a[0].checked=t:"radio"===i?a.each(function(){this.value==t&&(this.checked=!0)}):a.val(t))})}),f.render(null,e),a.getValue(e)},u.prototype.getValue=function(e,i){i=i||t(r+'[lay-filter="'+e+'"]').eq(0);var a={},n={},l=i.find("input,select,textarea");return layui.each(l,function(e,i){var l;t(this);if(i.name=(i.name||"").replace(/^\s*|\s*&/,""),i.name){if(/^.*\[\]$/.test(i.name)){var r=i.name.match(/^(.*)\[\]$/g)[0];a[r]=0|a[r],l=i.name.replace(/^(.*)\[\]$/,"$1["+a[r]++ +"]")}/^checkbox|radio$/.test(i.type)&&!i.checked||(n[l||i.name]=i.value)}}),n},u.prototype.render=function(e,i){var n=this,u=n.config,d=t(r+function(){return i?'[lay-filter="'+i+'"]':""}()),f={input:function(){var e=d.find("input,textarea");u.autocomplete&&e.attr("autocomplete",u.autocomplete)},select:function(){var e,i="\u8bf7\u9009\u62e9",a="layui-form-select",n="layui-select-title",r="layui-select-none",u="",f=d.find("select"),v=function(i,l){t(i.target).parent().hasClass(n)&&!l||(t("."+a).removeClass(a+"ed "+a+"up"),e&&u&&e.val(u)),e=null},y=function(i,d,f){var y,p=t(this),m=i.find("."+n),g=m.find("input"),k=i.find("dl"),x=k.children("dd"),b=this.selectedIndex;if(!d){var C=function(){var e=i.offset().top+i.outerHeight()+5-h.scrollTop(),t=k.outerHeight();b=p[0].selectedIndex,i.addClass(a+"ed"),x.removeClass(s),y=null,x.eq(b).addClass(o).siblings().removeClass(o),e+t>h.height()&&e>=t&&i.addClass(a+"up"),T()},w=function(e){i.removeClass(a+"ed "+a+"up"),g.blur(),y=null,e||$(g.val(),function(e){var i=p[0].selectedIndex;e&&(u=t(p[0].options[i]).html(),0===i&&u===g.attr("placeholder")&&(u=""),g.val(u||""))})},T=function(){var e=k.children("dd."+o);if(e[0]){var t=e.position().top,i=k.height(),a=e.height();t>i&&k.scrollTop(t+k.scrollTop()-i+a-5),t<0&&k.scrollTop(t+k.scrollTop()-5)}};m.on("click",function(e){i.hasClass(a+"ed")?w():(v(e,!0),C()),k.find("."+r).remove()}),m.find(".layui-edge").on("click",function(){g.focus()}),g.on("keyup",function(e){var t=e.keyCode;9===t&&C()}).on("keydown",function(e){var t=e.keyCode;9===t&&w();var i=function(t,a){var n,l;e.preventDefault();var r=function(){var e=k.children("dd."+o);if(k.children("dd."+s)[0]&&"next"===t){var i=k.children("dd:not(."+s+",."+c+")"),n=i.eq(0).index();if(n>=0&&n\u65e0\u5339\u914d\u9879

      '):k.find("."+r).remove()},"keyup"),""===t&&k.find("."+r).remove(),void T())};f&&g.on("keyup",q).on("blur",function(i){var a=p[0].selectedIndex;e=g,u=t(p[0].options[a]).html(),0===a&&u===g.attr("placeholder")&&(u=""),setTimeout(function(){$(g.val(),function(e){u||g.val("")},"blur")},200)}),x.on("click",function(){var e=t(this),a=e.attr("lay-value"),n=p.attr("lay-filter");return!e.hasClass(c)&&(e.hasClass("layui-select-tips")?g.val(""):(g.val(e.text()),e.addClass(o)),e.siblings().removeClass(o),p.val(a).removeClass("layui-form-danger"),layui.event.call(this,l,"select("+n+")",{elem:p[0],value:a,othis:i}),w(!0),!1)}),i.find("dl>dt").on("click",function(e){return!1}),t(document).off("click",v).on("click",v)}};f.each(function(e,l){var r=t(this),s=r.next("."+a),u=this.disabled,d=l.value,f=t(l.options[l.selectedIndex]),v=l.options[0];if("string"==typeof r.attr("lay-ignore"))return r.show();var h="string"==typeof r.attr("lay-search"),p=v?v.value?i:v.innerHTML||i:i,m=t(['
      ','
      ','','
      ','
      ',function(e){var a=[];return layui.each(e,function(e,n){0!==e||n.value?"optgroup"===n.tagName.toLowerCase()?a.push("
      "+n.label+"
      "):a.push('
      '+t.trim(n.innerHTML)+"
      "):a.push('
      '+t.trim(n.innerHTML||i)+"
      ")}),0===a.length&&a.push('
      \u6ca1\u6709\u9009\u9879
      '),a.join("")}(r.find("*"))+"
      ","
      "].join(""));s[0]&&s.remove(),r.after(m),y.call(this,m,u,h)})},checkbox:function(){var e={checkbox:["layui-form-checkbox","layui-form-checked","checkbox"],_switch:["layui-form-switch","layui-form-onswitch","switch"]},i=d.find("input[type=checkbox]"),a=function(e,i){var a=t(this);e.on("click",function(){var t=a.attr("lay-filter"),n=(a.attr("lay-text")||"").split("|");a[0].disabled||(a[0].checked?(a[0].checked=!1,e.removeClass(i[1]).find("em").text(n[1])):(a[0].checked=!0,e.addClass(i[1]).find("em").text(n[0])),layui.event.call(a[0],l,i[2]+"("+t+")",{elem:a[0],value:a[0].value,othis:e}))})};i.each(function(i,n){var l=t(this),r=l.attr("lay-skin"),o=(l.attr("lay-text")||"").split("|"),s=this.disabled;"switch"===r&&(r="_"+r);var u=e[r]||e.checkbox;if("string"==typeof l.attr("lay-ignore"))return l.show();var d=l.next("."+u[0]),f=t(['
      ",function(){var e=n.title.replace(/\s/g,""),t={checkbox:[e?""+n.title+"":"",''].join(""),_switch:""+((n.checked?o[0]:o[1])||"")+""};return t[r]||t.checkbox}(),"
      "].join(""));d[0]&&d.remove(),l.after(f),a.call(this,f,u)})},radio:function(){var e="layui-form-radio",i=["",""],a=d.find("input[type=radio]"),n=function(a){var n=t(this),o="layui-anim-scaleSpring";a.on("click",function(){var s=n[0].name,c=n.parents(r),u=n.attr("lay-filter"),d=c.find("input[name="+s.replace(/(\.|#|\[|\])/g,"\\$1")+"]");n[0].disabled||(layui.each(d,function(){var a=t(this).next("."+e);this.checked=!1,a.removeClass(e+"ed"),a.find(".layui-icon").removeClass(o).html(i[1])}),n[0].checked=!0,a.addClass(e+"ed"),a.find(".layui-icon").addClass(o).html(i[0]),layui.event.call(n[0],l,"radio("+u+")",{elem:n[0],value:n[0].value,othis:a}))})};a.each(function(a,l){var r=t(this),o=r.next("."+e),s=this.disabled;if("string"==typeof r.attr("lay-ignore"))return r.show();o[0]&&o.remove();var u=t(['
      ',''+i[l.checked?0:1]+"","
      "+function(){var e=l.title||"";return"string"==typeof r.next().attr("lay-radio")&&(e=r.next().html()),e}()+"
      ","
      "].join(""));r.after(u),n.call(this,u)})}};return e?f[e]?f[e]():a.error('\u4e0d\u652f\u6301\u7684 "'+e+'" \u8868\u5355\u6e32\u67d3'):layui.each(f,function(e,t){t()}),n};var d=function(){var e=null,a=f.config.verify,o="layui-form-danger",s={},c=t(this),u=c.parents(r).eq(0),d=u.find("*[lay-verify]"),h=c.parents("form")[0],y=c.attr("lay-filter");return layui.each(d,function(l,r){var s=t(this),c=s.attr("lay-verify").split("|"),u=s.attr("lay-verType"),d=s.val();if(s.removeClass(o),layui.each(c,function(t,l){var c,f="",h="function"==typeof a[l];if(a[l]){var c=h?f=a[l](d,r):!a[l][0].test(d),y="select"===r.tagName.toLowerCase()||/^checkbox|radio$/.test(r.type);if(f=f||a[l][1],"required"===l&&(f=s.attr("lay-reqText")||f),c)return"tips"===u?i.tips(f,function(){return"string"!=typeof s.attr("lay-ignore")&&y?s.next():s}(),{tips:1}):"alert"===u?i.alert(f,{title:"\u63d0\u793a",shadeClose:!0}):/\bstring|number\b/.test(typeof f)&&i.msg(f,{icon:5,shift:6}),n.mobile?v.scrollTop(function(){try{return(y?s.next():s).offset().top-15}catch(e){return 0}}()):setTimeout(function(){(y?s.next().find("input"):r).focus()},7),s.addClass(o),e=!0}}),e)return e}),!e&&(s=f.getValue(null,u),layui.event.call(this,l,"submit("+y+")",{elem:this,form:h,field:s}))},f=new u,v=t(document),h=t(window);t(function(){f.render()}),v.on("reset",r,function(){var e=t(this).attr("lay-filter");setTimeout(function(){f.render(null,e)},50)}),v.on("submit",r,d).on("click","*[lay-submit]",d),e(l,f)});layui.define("form",function(e){"use strict";var i=layui.$,a=layui.form,n=layui.layer,t="tree",r={config:{},index:layui[t]?layui[t].index+1e4:0,set:function(e){var a=this;return a.config=i.extend({},a.config,e),a},on:function(e,i){return layui.onevent.call(this,t,e,i)}},l=function(){var e=this,i=e.config,a=i.id||e.index;return l.that[a]=e,l.config[a]=i,{config:i,reload:function(i){e.reload.call(e,i)},getChecked:function(){return e.getChecked.call(e)},setChecked:function(i){return e.setChecked.call(e,i)}}},c="layui-hide",d="layui-disabled",s="layui-tree-set",o="layui-tree-iconClick",h="layui-icon-addition",u="layui-icon-subtraction",p="layui-tree-entry",f="layui-tree-main",y="layui-tree-txt",v="layui-tree-pack",C="layui-tree-spread",k="layui-tree-setLineShort",m="layui-tree-showLine",x="layui-tree-lineExtend",b=function(e){var a=this;a.index=++r.index,a.config=i.extend({},a.config,r.config,e),a.render()};b.prototype.config={data:[],showCheckbox:!1,showLine:!0,accordion:!1,onlyIconControl:!1,isJump:!1,edit:!1,text:{defaultNodeName:"\u672a\u547d\u540d",none:"\u65e0\u6570\u636e"}},b.prototype.reload=function(e){var a=this;layui.each(e,function(e,i){"array"===layui._typeof(i)&&delete a.config[e]}),a.config=i.extend(!0,{},a.config,e),a.render()},b.prototype.render=function(){var e=this,a=e.config;e.checkids=[];var n=i('
      ');e.tree(n);var t=a.elem=i(a.elem);if(t[0]){if(e.key=a.id||e.index,e.elem=n,e.elemNone=i('
      '+a.text.none+"
      "),t.html(e.elem),0==e.elem.find(".layui-tree-set").length)return e.elem.append(e.elemNone);a.showCheckbox&&e.renderForm("checkbox"),e.elem.find(".layui-tree-set").each(function(){var e=i(this);e.parent(".layui-tree-pack")[0]||e.addClass("layui-tree-setHide"),!e.next()[0]&&e.parents(".layui-tree-pack").eq(1).hasClass("layui-tree-lineExtend")&&e.addClass(k),e.next()[0]||e.parents(".layui-tree-set").eq(0).next()[0]||e.addClass(k)}),e.events()}},b.prototype.renderForm=function(e){a.render(e,"LAY-tree-"+this.index)},b.prototype.tree=function(e,a){var n=this,t=n.config,r=a||t.data;layui.each(r,function(a,r){var l=r.children&&r.children.length>0,o=i('
      "),h=i(['
      ','
      ','
      ',function(){return t.showLine?l?'':'':''}(),function(){return t.showCheckbox?'':""}(),function(){return t.isJump&&r.href?''+(r.title||r.label||t.text.defaultNodeName)+"":''+(r.title||r.label||t.text.defaultNodeName)+""}(),"
      ",function(){if(!t.edit)return"";var e={add:'',update:'',del:''},i=['
      '];return t.edit===!0&&(t.edit=["update","del"]),"object"==typeof t.edit?(layui.each(t.edit,function(a,n){i.push(e[n]||"")}),i.join("")+"
      "):void 0}(),"
      "].join(""));l&&(h.append(o),n.tree(o,r.children)),e.append(h),h.prev("."+s)[0]&&h.prev().children(".layui-tree-pack").addClass("layui-tree-showLine"),l||h.parent(".layui-tree-pack").addClass("layui-tree-lineExtend"),n.spread(h,r),t.showCheckbox&&(r.checked&&n.checkids.push(r.id),n.checkClick(h,r)),t.edit&&n.operate(h,r)})},b.prototype.spread=function(e,a){var n=this,t=n.config,r=e.children("."+p),l=r.children("."+f),c=r.find("."+o),k=r.find("."+y),m=t.onlyIconControl?c:l,x="";m.on("click",function(i){var a=e.children("."+v),n=m.children(".layui-icon")[0]?m.children(".layui-icon"):m.find(".layui-tree-icon").children(".layui-icon");if(a[0]){if(e.hasClass(C))e.removeClass(C),a.slideUp(200),n.removeClass(u).addClass(h);else if(e.addClass(C),a.slideDown(200),n.addClass(u).removeClass(h),t.accordion){var r=e.siblings("."+s);r.removeClass(C),r.children("."+v).slideUp(200),r.find(".layui-tree-icon").children(".layui-icon").removeClass(u).addClass(h)}}else x="normal"}),k.on("click",function(){var n=i(this);n.hasClass(d)||(x=e.hasClass(C)?t.onlyIconControl?"open":"close":t.onlyIconControl?"close":"open",t.click&&t.click({elem:e,state:x,data:a}))})},b.prototype.setCheckbox=function(e,i,a){var n=this,t=(n.config,a.prop("checked"));if(!a.prop("disabled")){if("object"==typeof i.children||e.find("."+v)[0]){var r=e.find("."+v).find('input[same="layuiTreeCheck"]');r.each(function(){this.disabled||(this.checked=t)})}var l=function(e){if(e.parents("."+s)[0]){var i,a=e.parent("."+v),n=a.parent(),r=a.prev().find('input[same="layuiTreeCheck"]');t?r.prop("checked",t):(a.find('input[same="layuiTreeCheck"]').each(function(){this.checked&&(i=!0)}),i||r.prop("checked",!1)),l(n)}};l(e),n.renderForm("checkbox")}},b.prototype.checkClick=function(e,a){var n=this,t=n.config,r=e.children("."+p),l=r.children("."+f);l.on("click",'input[same="layuiTreeCheck"]+',function(r){layui.stope(r);var l=i(this).prev(),c=l.prop("checked");l.prop("disabled")||(n.setCheckbox(e,a,l),t.oncheck&&t.oncheck({elem:e,checked:c,data:a}))})},b.prototype.operate=function(e,a){var t=this,r=t.config,l=e.children("."+p),d=l.children("."+f);l.children(".layui-tree-btnGroup").on("click",".layui-icon",function(l){layui.stope(l);var f=i(this).data("type"),b=e.children("."+v),g={data:a,type:f,elem:e};if("add"==f){b[0]||(r.showLine?(d.find("."+o).addClass("layui-tree-icon"),d.find("."+o).children(".layui-icon").addClass(h).removeClass("layui-icon-file")):d.find(".layui-tree-iconArrow").removeClass(c),e.append('
      '));var w=r.operate&&r.operate(g),N={};if(N.title=r.text.defaultNodeName,N.id=w,t.tree(e.children("."+v),[N]),r.showLine)if(b[0])b.hasClass(x)||b.addClass(x),e.find("."+v).each(function(){i(this).children("."+s).last().addClass(k)}),b.children("."+s).last().prev().hasClass(k)?b.children("."+s).last().prev().removeClass(k):b.children("."+s).last().removeClass(k),!e.parent("."+v)[0]&&e.next()[0]&&b.children("."+s).last().removeClass(k);else{var T=e.siblings("."+s),L=1,I=e.parent("."+v);layui.each(T,function(e,a){i(a).children("."+v)[0]||(L=0)}),1==L?(T.children("."+v).addClass(m),T.children("."+v).children("."+s).removeClass(k),e.children("."+v).addClass(m),I.removeClass(x),I.children("."+s).last().children("."+v).children("."+s).last().addClass(k)):e.children("."+v).children("."+s).addClass(k)}if(!r.showCheckbox)return;if(d.find('input[same="layuiTreeCheck"]')[0].checked){var A=e.children("."+v).children("."+s).last();A.find('input[same="layuiTreeCheck"]')[0].checked=!0}t.renderForm("checkbox")}else if("update"==f){var F=d.children("."+y).html();d.children("."+y).html(""),d.append(''),d.children(".layui-tree-editInput").val(F).focus();var j=function(e){var i=e.val().trim();i=i?i:r.text.defaultNodeName,e.remove(),d.children("."+y).html(i),g.data.title=i,r.operate&&r.operate(g)};d.children(".layui-tree-editInput").blur(function(){j(i(this))}),d.children(".layui-tree-editInput").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),j(i(this)))})}else n.confirm('\u786e\u8ba4\u5220\u9664\u8be5\u8282\u70b9 "'+(a.title||"")+'" \u5417\uff1f',function(a){if(r.operate&&r.operate(g),g.status="remove",n.close(a),!e.prev("."+s)[0]&&!e.next("."+s)[0]&&!e.parent("."+v)[0])return e.remove(),void t.elem.append(t.elemNone);if(e.siblings("."+s).children("."+p)[0]){if(r.showCheckbox){var l=function(e){if(e.parents("."+s)[0]){var a=e.siblings("."+s).children("."+p),n=e.parent("."+v).prev(),r=n.find('input[same="layuiTreeCheck"]')[0],c=1,d=0;0==r.checked&&(a.each(function(e,a){var n=i(a).find('input[same="layuiTreeCheck"]')[0];0!=n.checked||n.disabled||(c=0),n.disabled||(d=1)}),1==c&&1==d&&(r.checked=!0,t.renderForm("checkbox"),l(n.parent("."+s))))}};l(e)}if(r.showLine){var d=e.siblings("."+s),h=1,f=e.parent("."+v);layui.each(d,function(e,a){i(a).children("."+v)[0]||(h=0)}),1==h?(b[0]||(f.removeClass(x),d.children("."+v).addClass(m),d.children("."+v).children("."+s).removeClass(k)),e.next()[0]?f.children("."+s).last().children("."+v).children("."+s).last().addClass(k):e.prev().children("."+v).children("."+s).last().addClass(k),e.next()[0]||e.parents("."+s)[1]||e.parents("."+s).eq(0).next()[0]||e.prev("."+s).addClass(k)):!e.next()[0]&&e.hasClass(k)&&e.prev().addClass(k)}}else{var y=e.parent("."+v).prev();if(r.showLine){y.find("."+o).removeClass("layui-tree-icon"),y.find("."+o).children(".layui-icon").removeClass(u).addClass("layui-icon-file");var w=y.parents("."+v).eq(0);w.addClass(x),w.children("."+s).each(function(){i(this).children("."+v).children("."+s).last().addClass(k)})}else y.find(".layui-tree-iconArrow").addClass(c);e.parents("."+s).eq(0).removeClass(C),e.parent("."+v).remove()}e.remove()})})},b.prototype.events=function(){var e=this,a=e.config;e.elem.find(".layui-tree-checkedFirst");e.setChecked(e.checkids),e.elem.find(".layui-tree-search").on("keyup",function(){var n=i(this),t=n.val(),r=n.nextAll(),l=[];r.find("."+y).each(function(){var e=i(this).parents("."+p);if(i(this).html().indexOf(t)!=-1){l.push(i(this).parent());var a=function(e){e.addClass("layui-tree-searchShow"),e.parent("."+v)[0]&&a(e.parent("."+v).parent("."+s))};a(e.parent("."+s))}}),r.find("."+p).each(function(){var e=i(this).parent("."+s);e.hasClass("layui-tree-searchShow")||e.addClass(c)}),0==r.find(".layui-tree-searchShow").length&&e.elem.append(e.elemNone),a.onsearch&&a.onsearch({elem:l})}),e.elem.find(".layui-tree-search").on("keydown",function(){i(this).nextAll().find("."+p).each(function(){var e=i(this).parent("."+s);e.removeClass("layui-tree-searchShow "+c)}),i(".layui-tree-emptyText")[0]&&i(".layui-tree-emptyText").remove()})},b.prototype.getChecked=function(){var e=this,a=e.config,n=[],t=[];e.elem.find(".layui-form-checked").each(function(){n.push(i(this).prev()[0].value)});var r=function(e,a){layui.each(e,function(e,t){layui.each(n,function(e,n){if(t.id==n){var l=i.extend({},t);return delete l.children,a.push(l),t.children&&(l.children=[],r(t.children,l.children)),!0}})})};return r(i.extend({},a.data),t),t},b.prototype.setChecked=function(e){var a=this;a.config;a.elem.find("."+s).each(function(a,n){var t=i(this).data("id"),r=i(n).children("."+p).find('input[same="layuiTreeCheck"]'),l=r.next();if("number"==typeof e){if(t==e)return r[0].checked||l.click(),!1}else"object"==typeof e&&layui.each(e,function(e,i){if(i==t&&!r[0].checked)return l.click(),!0})})},l.that={},l.config={},r.reload=function(e,i){var a=l.that[e];return a.reload(i),l.call(a)},r.getChecked=function(e){var i=l.that[e];return i.getChecked()},r.setChecked=function(e,i){var a=l.that[e];return a.setChecked(i)},r.render=function(e){var i=new b(e);return l.call(i)},e(t,r)});layui.define(["laytpl","form"],function(e){"use strict";var a=layui.$,t=layui.laytpl,i=layui.form,n="transfer",l={config:{},index:layui[n]?layui[n].index+1e4:0,set:function(e){var t=this;return t.config=a.extend({},t.config,e),t},on:function(e,a){return layui.onevent.call(this,n,e,a)}},r=function(){var e=this,a=e.config,t=a.id||e.index;return r.that[t]=e,r.config[t]=a,{config:a,reload:function(a){e.reload.call(e,a)},getData:function(){return e.getData.call(e)}}},c="layui-hide",o="layui-btn-disabled",d="layui-none",s="layui-transfer-box",u="layui-transfer-header",h="layui-transfer-search",f="layui-transfer-active",y="layui-transfer-data",p=function(e){return e=e||{},['
      ','
      ','","
      ","{{# if(d.data.showSearch){ }}",'","{{# } }}",'
        ',"
        "].join("")},v=['
        ',p({index:0,checkAllName:"layTransferLeftCheckAll"}),'
        ','",'","
        ",p({index:1,checkAllName:"layTransferRightCheckAll"}),"
        "].join(""),x=function(e){var t=this;t.index=++l.index,t.config=a.extend({},t.config,l.config,e),t.render()};x.prototype.config={title:["\u5217\u8868\u4e00","\u5217\u8868\u4e8c"],width:200,height:360,data:[],value:[],showSearch:!1,id:"",text:{none:"\u65e0\u6570\u636e",searchNone:"\u65e0\u5339\u914d\u6570\u636e"}},x.prototype.reload=function(e){var t=this;t.config=a.extend({},t.config,e),t.render()},x.prototype.render=function(){var e=this,i=e.config,n=e.elem=a(t(v).render({data:i,index:e.index})),l=i.elem=a(i.elem);l[0]&&(i.data=i.data||[],i.value=i.value||[],e.key=i.id||e.index,l.html(e.elem),e.layBox=e.elem.find("."+s),e.layHeader=e.elem.find("."+u),e.laySearch=e.elem.find("."+h),e.layData=n.find("."+y),e.layBtn=n.find("."+f+" .layui-btn"),e.layBox.css({width:i.width,height:i.height}),e.layData.css({height:function(){return i.height-e.layHeader.outerHeight()-e.laySearch.outerHeight()-2}()}),e.renderData(),e.events())},x.prototype.renderData=function(){var e=this,a=(e.config,[{checkName:"layTransferLeftCheck",views:[]},{checkName:"layTransferRightCheck",views:[]}]);e.parseData(function(e){var t=e.selected?1:0,i=["
      • ",'',"
      • "].join("");a[t].views.push(i),delete e.selected}),e.layData.eq(0).html(a[0].views.join("")),e.layData.eq(1).html(a[1].views.join("")),e.renderCheckBtn()},x.prototype.renderForm=function(e){i.render(e,"LAY-transfer-"+this.index)},x.prototype.renderCheckBtn=function(e){var t=this,i=t.config;e=e||{},t.layBox.each(function(n){var l=a(this),r=l.find("."+y),d=l.find("."+u).find('input[type="checkbox"]'),s=r.find('input[type="checkbox"]'),h=0,f=!1;if(s.each(function(){var e=a(this).data("hide");(this.checked||this.disabled||e)&&h++,this.checked&&!e&&(f=!0)}),d.prop("checked",f&&h===s.length),t.layBtn.eq(n)[f?"removeClass":"addClass"](o),!e.stopNone){var p=r.children("li:not(."+c+")").length;t.noneView(r,p?"":i.text.none)}}),t.renderForm("checkbox")},x.prototype.noneView=function(e,t){var i=a('

        '+(t||"")+"

        ");e.find("."+d)[0]&&e.find("."+d).remove(),t.replace(/\s/g,"")&&e.append(i)},x.prototype.setValue=function(){var e=this,t=e.config,i=[];return e.layBox.eq(1).find("."+y+' input[type="checkbox"]').each(function(){var e=a(this).data("hide");e||i.push(this.value)}),t.value=i,e},x.prototype.parseData=function(e){var t=this,i=t.config,n=[];return layui.each(i.data,function(t,l){l=("function"==typeof i.parseData?i.parseData(l):l)||l,n.push(l=a.extend({},l)),layui.each(i.value,function(e,a){a==l.value&&(l.selected=!0)}),e&&e(l)}),i.data=n,t},x.prototype.getData=function(e){var a=this,t=a.config,i=[];return a.setValue(),layui.each(e||t.value,function(e,a){layui.each(t.data,function(e,t){delete t.selected,a==t.value&&i.push(t)})}),i},x.prototype.events=function(){var e=this,t=e.config;e.elem.on("click",'input[lay-filter="layTransferCheckbox"]+',function(){var t=a(this).prev(),i=t[0].checked,n=t.parents("."+s).eq(0).find("."+y);t[0].disabled||("all"===t.attr("lay-type")&&n.find('input[type="checkbox"]').each(function(){this.disabled||(this.checked=i)}),e.renderCheckBtn({stopNone:!0}))}),e.layBtn.on("click",function(){var i=a(this),n=i.data("index"),l=e.layBox.eq(n),r=[];if(!i.hasClass(o)){e.layBox.eq(n).each(function(t){var i=a(this),n=i.find("."+y);n.children("li").each(function(){var t=a(this),i=t.find('input[type="checkbox"]'),n=i.data("hide");i[0].checked&&!n&&(i[0].checked=!1,l.siblings("."+s).find("."+y).append(t.clone()),t.remove(),r.push(i[0].value)),e.setValue()})}),e.renderCheckBtn();var c=l.siblings("."+s).find("."+h+" input");""===c.val()||c.trigger("keyup"),t.onchange&&t.onchange(e.getData(r),n)}}),e.laySearch.find("input").on("keyup",function(){var i=this.value,n=a(this).parents("."+h).eq(0).siblings("."+y),l=n.children("li");l.each(function(){var e=a(this),t=e.find('input[type="checkbox"]'),n=t[0].title.indexOf(i)!==-1;e[n?"removeClass":"addClass"](c),t.data("hide",!n)}),e.renderCheckBtn();var r=l.length===n.children("li."+c).length;e.noneView(n,r?t.text.searchNone:"")})},r.that={},r.config={},l.reload=function(e,a){var t=r.that[e];return t.reload(a),r.call(t)},l.getData=function(e){var a=r.that[e];return a.getData()},l.render=function(e){var a=new x(e);return r.call(a)},e(n,l)});layui.define(["laytpl","laypage","layer","form","util"],function(e){"use strict";var t=layui.$,i=layui.laytpl,a=layui.laypage,l=layui.layer,n=layui.form,o=layui.util,r=layui.hint(),c=layui.device(),d={config:{checkName:"LAY_CHECKED",indexName:"LAY_TABLE_INDEX"},cache:{},index:layui.table?layui.table.index+1e4:0,set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,h,e,t)}},s=function(){var e=this,t=e.config,i=t.id||t.index;return i&&(s.that[i]=e,s.config[i]=t),{config:t,reload:function(t,i){e.reload.call(e,t,i)},setColsWidth:function(){e.setColsWidth.call(e)},resize:function(){e.resize.call(e)}}},u=function(e){var t=s.config[e];return t||r.error(e?"The table instance with ID '"+e+"' not found":"ID argument required"),t||null},y=function(e,a,l,n){var r=this.config||{};r.escape&&(a=o.escape(a));var c=e.templet?function(){return"function"==typeof e.templet?e.templet(l):i(t(e.templet).html()||String(a)).render(l)}():a;return n?t("
        "+c+"
        ").text():c},h="table",f=".layui-table",p="layui-hide",v="layui-none",m="layui-table-view",g=".layui-table-tool",b=".layui-table-box",x=".layui-table-init",k=".layui-table-header",C=".layui-table-body",w=".layui-table-main",T=".layui-table-fixed",N=".layui-table-fixed-l",L=".layui-table-fixed-r",_=".layui-table-total",S=".layui-table-page",A=".layui-table-sort",R="layui-table-edit",W="layui-table-hover",z=function(e){var t='{{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}}';return e=e||{},['',"","{{# layui.each(d.data.cols, function(i1, item1){ }}","","{{# layui.each(item1, function(i2, item2){ }}",'{{# if(item2.fixed && item2.fixed !== "right"){ left = true; } }}','{{# if(item2.fixed === "right"){ right = true; } }}',function(){return e.fixed&&"right"!==e.fixed?'{{# if(item2.fixed && item2.fixed !== "right"){ }}':"right"===e.fixed?'{{# if(item2.fixed === "right"){ }}':""}(),"{{# var isSort = !(item2.colGroup) && item2.sort; }}",'",e.fixed?"{{# }; }}":"","{{# }); }}","","{{# }); }}","","
        ','
        ','{{# if(item2.type === "checkbox"){ }}','',"{{# } else { }}",'{{item2.title||""}}',"{{# if(isSort){ }}",'',"{{# } }}","{{# } }}","
        ","
        "].join("")},E=['',"","
        "].join(""),j=['
        ',"{{# if(d.data.toolbar){ }}",'
        ','
        ','
        ',"
        ","{{# } }}",'
        ',"{{# if(d.data.loading){ }}",'
        ','',"
        ","{{# } }}","{{# var left, right; }}",'
        ',z(),"
        ",'
        ',E,"
        ","{{# if(left){ }}",'
        ','
        ',z({fixed:!0}),"
        ",'
        ',E,"
        ","
        ","{{# }; }}","{{# if(right){ }}",'
        ','
        ',z({fixed:"right"}),'
        ',"
        ",'
        ',E,"
        ","
        ","{{# }; }}","
        ","{{# if(d.data.totalRow){ }}",'
        ','','',"
        ","
        ","{{# } }}","{{# if(d.data.page){ }}",'
        ','
        ',"
        ","{{# } }}","","
        "].join(""),F=t(window),I=t(document),H=function(e){var i=this;i.index=++d.index,i.config=t.extend({},i.config,d.config,e),i.render()};H.prototype.config={limit:10,loading:!0,cellMinWidth:60,defaultToolbar:["filter","exports","print"],autoSort:!0,text:{none:"\u65e0\u6570\u636e"}},H.prototype.render=function(){var e=this,a=e.config;if(a.elem=t(a.elem),a.where=a.where||{},a.id=a.id||a.elem.attr("id")||e.index,a.request=t.extend({pageName:"page",limitName:"limit"},a.request),a.response=t.extend({statusName:"code",statusCode:0,msgName:"msg",dataName:"data",totalRowName:"totalRow",countName:"count"},a.response),"object"==typeof a.page&&(a.limit=a.page.limit||a.limit,a.limits=a.page.limits||a.limits,e.page=a.page.curr=a.page.curr||1,delete a.page.elem,delete a.page.jump),!a.elem[0])return e;a.height&&/^full-\d+$/.test(a.height)&&(e.fullHeightGap=a.height.split("-")[1],a.height=F.height()-e.fullHeightGap),e.setInit();var l=a.elem,n=l.next("."+m),o=e.elem=t(i(j).render({VIEW_CLASS:m,data:a,index:e.index}));if(a.index=e.index,e.key=a.id||a.index,n[0]&&n.remove(),l.after(o),e.layTool=o.find(g),e.layBox=o.find(b),e.layHeader=o.find(k),e.layMain=o.find(w),e.layBody=o.find(C),e.layFixed=o.find(T),e.layFixLeft=o.find(N),e.layFixRight=o.find(L),e.layTotal=o.find(_),e.layPage=o.find(S),e.renderToolbar(),e.fullSize(),a.cols.length>1){var r=e.layFixed.find(k).find("th");r.height(e.layHeader.height()-1-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom")))}e.pullData(e.page),e.events()},H.prototype.initOpts=function(e){var t=this,i=(t.config,{checkbox:48,radio:48,space:15,numbers:40});e.checkbox&&(e.type="checkbox"),e.space&&(e.type="space"),e.type||(e.type="normal"),"normal"!==e.type&&(e.unresize=!0,e.width=e.width||i[e.type])},H.prototype.setInit=function(e){var t=this,i=t.config;return i.clientWidth=i.width||function(){var e=function(t){var a,l;t=t||i.elem.parent(),a=t.width();try{l="none"===t.css("display")}catch(n){}return!t[0]||a&&!l?a:e(t.parent())};return e()}(),"width"===e?i.clientWidth:void layui.each(i.cols,function(e,a){layui.each(a,function(l,n){if(!n)return void a.splice(l,1);if(n.key=e+"-"+l,n.hide=n.hide||!1,n.colGroup||n.colspan>1){var o=0;layui.each(i.cols[e+1],function(t,i){i.HAS_PARENT||o>1&&o==n.colspan||(i.HAS_PARENT=!0,i.parentKey=e+"-"+l,o+=parseInt(i.colspan>1?i.colspan:1))}),n.colGroup=!0}t.initOpts(n)})})},H.prototype.renderToolbar=function(){var e=this,a=e.config,l=['
        ','
        ','
        '].join(""),n=e.layTool.find(".layui-table-tool-temp");if("default"===a.toolbar)n.html(l);else if("string"==typeof a.toolbar){var o=t(a.toolbar).html()||"";o&&n.html(i(o).render(a))}var r={filter:{title:"\u7b5b\u9009\u5217",layEvent:"LAYTABLE_COLS",icon:"layui-icon-cols"},exports:{title:"\u5bfc\u51fa",layEvent:"LAYTABLE_EXPORT",icon:"layui-icon-export"},print:{title:"\u6253\u5370",layEvent:"LAYTABLE_PRINT",icon:"layui-icon-print"}},c=[];"object"==typeof a.defaultToolbar&&layui.each(a.defaultToolbar,function(e,t){var i="string"==typeof t?r[t]:t;i&&c.push('
        ')}),e.layTool.find(".layui-table-tool-self").html(c.join(""))},H.prototype.setParentCol=function(e,t){var i=this,a=i.config,l=i.layHeader.find('th[data-key="'+a.index+"-"+t+'"]'),n=parseInt(l.attr("colspan"))||0;if(l[0]){var o=t.split("-"),r=a.cols[o[0]][o[1]];e?n--:n++,l.attr("colspan",n),l[n<1?"addClass":"removeClass"](p),r.colspan=n,r.hide=n<1;var c=l.data("parentkey");c&&i.setParentCol(e,c)}},H.prototype.setColsPatch=function(){var e=this,t=e.config;layui.each(t.cols,function(t,i){layui.each(i,function(t,i){i.hide&&e.setParentCol(i.hide,i.parentKey)})})},H.prototype.setColsWidth=function(){var e=this,t=e.config,i=0,a=0,l=0,n=0,o=e.setInit("width");e.eachCols(function(e,t){t.hide||i++}),o=o-function(){return"line"===t.skin||"nob"===t.skin?2:i+1}()-e.getScrollWidth(e.layMain[0])-1;var r=function(e){layui.each(t.cols,function(i,r){layui.each(r,function(i,c){var d=0,s=c.minWidth||t.cellMinWidth;return c?void(c.colGroup||c.hide||(e?l&&ln&&a&&(l=(o-n)/a)};r(),r(!0),e.autoColNums=a,e.eachCols(function(i,a){var n=a.minWidth||t.cellMinWidth;a.colGroup||a.hide||(0===a.width?e.getCssRule(t.index+"-"+a.key,function(e){e.style.width=Math.floor(l>=n?l:n)+"px"}):/\d+%$/.test(a.width)&&e.getCssRule(t.index+"-"+a.key,function(e){e.style.width=Math.floor(parseFloat(a.width)/100*o)+"px"}))});var c=e.layMain.width()-e.getScrollWidth(e.layMain[0])-e.layMain.children("table").outerWidth();if(e.autoColNums&&c>=-i&&c<=i){var d=function(t){var i;return t=t||e.layHeader.eq(0).find("thead th:last-child"),i=t.data("field"),!i&&t.prev()[0]?d(t.prev()):t},s=d(),u=s.data("key");e.getCssRule(u,function(t){var i=t.style.width||s.outerWidth();t.style.width=parseFloat(i)+c+"px",e.layMain.height()-e.layMain.prop("clientHeight")>0&&(t.style.width=parseFloat(t.style.width)-1+"px")})}e.loading(!0)},H.prototype.resize=function(){var e=this;e.fullSize(),e.setColsWidth(),e.scrollPatch()},H.prototype.reload=function(e,i){var a=this;e=e||{},delete a.haveInit,layui.each(e,function(e,t){"array"===layui._typeof(t)&&delete a.config[e]}),a.config=t.extend(i,{},a.config,e),a.render()},H.prototype.errorView=function(e){var i=this,a=i.layMain.find("."+v),l=t('
        '+(e||"Error")+"
        ");a[0]&&(i.layNone.remove(),a.remove()),i.layFixed.addClass(p),i.layMain.find("tbody").html(""),i.layMain.append(i.layNone=l),d.cache[i.key]=[]},H.prototype.page=1,H.prototype.pullData=function(e){var i=this,a=i.config,l=a.request,n=a.response,o=function(){"object"==typeof a.initSort&&i.sort(a.initSort.field,a.initSort.type)};if(i.startTime=(new Date).getTime(),a.url){var r={};r[l.pageName]=e,r[l.limitName]=a.limit;var c=t.extend(r,a.where);a.contentType&&0==a.contentType.indexOf("application/json")&&(c=JSON.stringify(c)),i.loading(),t.ajax({type:a.method||"get",url:a.url,contentType:a.contentType,data:c,dataType:"json",headers:a.headers||{},success:function(t){"function"==typeof a.parseData&&(t=a.parseData(t)||t),t[n.statusName]!=n.statusCode?(i.renderForm(),i.errorView(t[n.msgName]||'\u8fd4\u56de\u7684\u6570\u636e\u4e0d\u7b26\u5408\u89c4\u8303\uff0c\u6b63\u786e\u7684\u6210\u529f\u72b6\u6001\u7801\u5e94\u4e3a\uff1a"'+n.statusName+'": '+n.statusCode)):(i.renderData(t,e,t[n.countName]),o(),a.time=(new Date).getTime()-i.startTime+" ms"),i.setColsWidth(),"function"==typeof a.done&&a.done(t,e,t[n.countName])},error:function(e,t){i.errorView("\u8bf7\u6c42\u5f02\u5e38\uff0c\u9519\u8bef\u63d0\u793a\uff1a"+t),i.renderForm(),i.setColsWidth(),"function"==typeof a.error&&a.error(e,t)}})}else if("array"===layui._typeof(a.data)){var d={},s=e*a.limit-a.limit;d[n.dataName]=a.data.concat().splice(s,a.limit),d[n.countName]=a.data.length,"object"==typeof a.totalRow&&(d[n.totalRowName]=t.extend({},a.totalRow)),i.renderData(d,e,d[n.countName]),o(),i.setColsWidth(),"function"==typeof a.done&&a.done(d,e,d[n.countName])}},H.prototype.eachCols=function(e){var t=this;return d.eachCols(null,e,t.config.cols),t},H.prototype.renderData=function(e,n,o,r){var c=this,s=c.config,u=e[s.response.dataName]||[],h=e[s.response.totalRowName],f=[],m=[],g=[],b=function(){var e;return!r&&c.sortKey?c.sort(c.sortKey.field,c.sortKey.sort,!0):(layui.each(u,function(a,l){var o=[],u=[],h=[],v=a+s.limit*(n-1)+1;"array"===layui._typeof(l)&&0===l.length||(r||(l[d.config.indexName]=a),c.eachCols(function(n,r){var f=r.field||n,m=s.index+"-"+r.key,g=l[f];if(void 0!==g&&null!==g||(g=""),!r.colGroup){var b=['','
        '+function(){var n=t.extend(!0,{LAY_INDEX:v,LAY_COL:r},l),o=d.config.checkName;switch(r.type){case"checkbox":return'";case"radio":return n[o]&&(e=a),'';case"numbers":return v}return r.toolbar?i(t(r.toolbar).html()||"").render(n):y.call(c,r,g,n)}(),"
        "].join("");o.push(b),r.fixed&&"right"!==r.fixed&&u.push(b),"right"===r.fixed&&h.push(b)}}),f.push(''+o.join("")+""),m.push(''+u.join("")+""),g.push(''+h.join("")+""))}),c.layBody.scrollTop(0),c.layMain.find("."+v).remove(),c.layMain.find("tbody").html(f.join("")),c.layFixLeft.find("tbody").html(m.join("")),c.layFixRight.find("tbody").html(g.join("")),c.renderForm(),"number"==typeof e&&c.setThisRowChecked(e),c.syncCheckAll(),c.haveInit?c.scrollPatch():setTimeout(function(){c.scrollPatch()},50),c.haveInit=!0,l.close(c.tipsIndex),s.HAS_SET_COLS_PATCH||c.setColsPatch(),void(s.HAS_SET_COLS_PATCH=!0))};return d.cache[c.key]=u,c.layPage[0==o||0===u.length&&1==n?"addClass":"removeClass"](p),0===u.length?(c.renderForm(),c.errorView(s.text.none)):(c.layFixed.removeClass(p),r?b():(b(),c.renderTotal(u,h),void(s.page&&(s.page=t.extend({elem:"layui-table-page"+s.index,count:o,limit:s.limit,limits:s.limits||[10,20,30,40,50,60,70,80,90],groups:3,layout:["prev","page","next","skip","count","limit"],prev:'',next:'',jump:function(e,t){t||(c.page=e.curr,s.limit=e.limit,c.pullData(e.curr))}},s.page),s.page.count=o,a.render(s.page)))))},H.prototype.renderTotal=function(e,a){var l=this,n=l.config,o={};if(n.totalRow){layui.each(e,function(e,t){"array"===layui._typeof(t)&&0===t.length||l.eachCols(function(e,i){var a=i.field||e,l=t[a];i.totalRow&&(o[a]=(o[a]||0)+(parseFloat(l)||0))})}),l.dataTotal={};var r=[];l.eachCols(function(e,c){var d=c.field||e,s=function(){var e,t=c.totalRowText||"",i=parseFloat(o[d]).toFixed(2),n={};return n[d]=i,e=c.totalRow?y.call(l,c,i,n)||t:t,a?a[c.field]||e:e}(),u=['','
        '+function(){var e=c.totalRow||n.totalRow;return"string"==typeof e?i(e).render(t.extend({TOTAL_NUMS:s},c)):s}(),"
        "].join("");c.field&&(l.dataTotal[d]=s),r.push(u)}),l.layTotal.find("tbody").html(""+r.join("")+"")}},H.prototype.getColElem=function(e,t){var i=this,a=i.config;return e.eq(0).find(".laytable-cell-"+(a.index+"-"+t)+":eq(0)")},H.prototype.renderForm=function(e){n.render(e,"LAY-table-"+this.index)},H.prototype.setThisRowChecked=function(e){var t=this,i=(t.config,"layui-table-click"),a=t.layBody.find('tr[data-index="'+e+'"]');a.addClass(i).siblings("tr").removeClass(i)},H.prototype.sort=function(e,i,a,l){var n,o,c=this,s={},u=c.config,y=u.elem.attr("lay-filter"),f=d.cache[c.key];"string"==typeof e&&(n=e,c.layHeader.find("th").each(function(i,a){var l=t(this),o=l.data("field");if(o===e)return e=l,n=o,!1}));try{var n=n||e.data("field"),p=e.data("key");if(c.sortKey&&!a&&n===c.sortKey.field&&i===c.sortKey.sort)return;var v=c.layHeader.find("th .laytable-cell-"+p).find(A);c.layHeader.find("th").find(A).removeAttr("lay-sort"),v.attr("lay-sort",i||null),c.layFixed.find("th")}catch(m){r.error("Table modules: sort field '"+n+"' not matched")}c.sortKey={field:n,sort:i},u.autoSort&&("asc"===i?o=layui.sort(f,n):"desc"===i?o=layui.sort(f,n,!0):(o=layui.sort(f,d.config.indexName),delete c.sortKey)),s[u.response.dataName]=o||f,c.renderData(s,c.page,c.count,!0),l&&layui.event.call(e,h,"sort("+y+")",{field:n,type:i})},H.prototype.loading=function(e){var i=this,a=i.config;a.loading&&(e?(i.layInit&&i.layInit.remove(),delete i.layInit,i.layBox.find(x).remove()):(i.layInit=t(['
        ','',"
        "].join("")),i.layBox.append(i.layInit)))},H.prototype.setCheckData=function(e,t){var i=this,a=i.config,l=d.cache[i.key];l[e]&&"array"!==layui._typeof(l[e])&&(l[e][a.checkName]=t)},H.prototype.syncCheckAll=function(){var e=this,t=e.config,i=e.layHeader.find('input[name="layTableCheckbox"]'),a=function(i){return e.eachCols(function(e,a){"checkbox"===a.type&&(a[t.checkName]=i)}),i};i[0]&&(d.checkStatus(e.key).isAll?(i[0].checked||(i.prop("checked",!0),e.renderForm("checkbox")),a(!0)):(i[0].checked&&(i.prop("checked",!1),e.renderForm("checkbox")),a(!1)))},H.prototype.getCssRule=function(e,t){var i=this,a=i.elem.find("style")[0],l=a.sheet||a.styleSheet||{},n=l.cssRules||l.rules;layui.each(n,function(i,a){if(a.selectorText===".laytable-cell-"+e)return t(a),!0})},H.prototype.fullSize=function(){var e,t=this,i=t.config,a=i.height;t.fullHeightGap&&(a=F.height()-t.fullHeightGap,a<135&&(a=135),t.elem.css("height",a)),a&&(e=parseFloat(a)-(t.layHeader.outerHeight()||38),i.toolbar&&(e-=t.layTool.outerHeight()||50),i.totalRow&&(e-=t.layTotal.outerHeight()||40),i.page&&(e-=t.layPage.outerHeight()||41),t.layMain.css("height",e-2))},H.prototype.getScrollWidth=function(e){var t=0;return e?t=e.offsetWidth-e.clientWidth:(e=document.createElement("div"),e.style.width="100px",e.style.height="100px",e.style.overflowY="scroll",document.body.appendChild(e),t=e.offsetWidth-e.clientWidth,document.body.removeChild(e)),t},H.prototype.scrollPatch=function(){var e=this,i=e.layMain.children("table"),a=e.layMain.width()-e.layMain.prop("clientWidth"),l=e.layMain.height()-e.layMain.prop("clientHeight"),n=(e.getScrollWidth(e.layMain[0]),i.outerWidth()-e.layMain.width()),o=function(e){if(a&&l){if(e=e.eq(0),!e.find(".layui-table-patch")[0]){var i=t('
        ');i.find("div").css({width:a}),e.find("tr").append(i)}}else e.find(".layui-table-patch").remove()};o(e.layHeader),o(e.layTotal);var r=e.layMain.height(),c=r-l;e.layFixed.find(C).css("height",i.height()>=c?c:"auto"),e.layFixRight[n>0?"removeClass":"addClass"](p),e.layFixRight.css("right",a-1)},H.prototype.events=function(){var e,i=this,a=i.config,o=t("body"),r={},s=i.layHeader.find("th"),u=".layui-table-cell",f=a.elem.attr("lay-filter");i.layTool.on("click","*[lay-event]",function(e){var o=t(this),r=o.attr("lay-event"),s=function(e){var l=t(e.list),n=t('
          ');n.html(l),a.height&&n.css("max-height",a.height-(i.layTool.outerHeight()||50)),o.find(".layui-table-tool-panel")[0]||o.append(n),i.renderForm(),n.on("click",function(e){layui.stope(e)}),e.done&&e.done(n,l)};switch(layui.stope(e),I.trigger("table.tool.panel.remove"),l.close(i.tipsIndex),r){case"LAYTABLE_COLS":s({list:function(){var e=[];return i.eachCols(function(t,i){i.field&&"normal"==i.type&&e.push('
        • ')}),e.join("")}(),done:function(){n.on("checkbox(LAY_TABLE_TOOL_COLS)",function(e){var l=t(e.elem),n=this.checked,o=l.data("key"),r=l.data("parentkey");layui.each(a.cols,function(e,t){layui.each(t,function(t,l){if(e+"-"+t===o){var c=l.hide;l.hide=!n,i.elem.find('*[data-key="'+a.index+"-"+o+'"]')[n?"removeClass":"addClass"](p),c!=l.hide&&i.setParentCol(!n,r),i.resize()}})})})}});break;case"LAYTABLE_EXPORT":c.ie?l.tips("\u5bfc\u51fa\u529f\u80fd\u4e0d\u652f\u6301 IE\uff0c\u8bf7\u7528 Chrome \u7b49\u9ad8\u7ea7\u6d4f\u89c8\u5668\u5bfc\u51fa",this,{tips:3}):s({list:function(){return['
        • \u5bfc\u51fa\u5230 Csv \u6587\u4ef6
        • ','
        • \u5bfc\u51fa\u5230 Excel \u6587\u4ef6
        • '].join("")}(),done:function(e,l){l.on("click",function(){var e=t(this).data("type");d.exportFile.call(i,a.id,null,e)})}});break;case"LAYTABLE_PRINT":var u=window.open("\u6253\u5370\u7a97\u53e3","_blank"),y=[""].join(""),v=t(i.layHeader.html());v.append(i.layMain.find("table").html()),v.append(i.layTotal.find("table").html()),v.find("th.layui-table-patch").remove(),v.find(".layui-table-col-special").remove(),u.document.write(y+v.prop("outerHTML")),u.document.close(),u.print(),u.close()}layui.event.call(this,h,"toolbar("+f+")",t.extend({event:r,config:a},{}))}),s.on("mousemove",function(e){var i=t(this),a=i.offset().left,l=e.clientX-a;i.data("unresize")||r.resizeStart||(r.allowResize=i.width()-l<=10,o.css("cursor",r.allowResize?"col-resize":""))}).on("mouseleave",function(){t(this);r.resizeStart||o.css("cursor","")}).on("mousedown",function(e){var l=t(this);if(r.allowResize){var n=l.data("key");e.preventDefault(),r.resizeStart=!0,r.offset=[e.clientX,e.clientY],i.getCssRule(n,function(e){var t=e.style.width||l.outerWidth();r.rule=e,r.ruleWidth=parseFloat(t),r.minWidth=l.data("minwidth")||a.cellMinWidth})}}),I.on("mousemove",function(t){if(r.resizeStart){if(t.preventDefault(),r.rule){var a=r.ruleWidth+t.clientX-r.offset[0];a');return n[0].value=i.data("content")||l.text(),i.find("."+R)[0]||i.append(n),n.focus(),void layui.stope(e)}}).on("mouseenter","td",function(){b.call(this)}).on("mouseleave","td",function(){b.call(this,"hide")});var g="layui-table-grid-down",b=function(e){var i=t(this),a=i.children(u);if(!i.data("off"))if(e)i.find(".layui-table-grid-down").remove();else if(a.prop("scrollWidth")>a.outerWidth()){if(a.find("."+g)[0])return;i.append('
          ')}};i.layBody.on("click","."+g,function(e){var n=t(this),o=n.parent(),r=o.children(u);i.tipsIndex=l.tips(['
          ',r.html(),"
          ",''].join(""),r[0],{tips:[3,""],time:-1,anim:-1,maxWidth:c.ios||c.android?300:i.elem.width()/2,isOutAnim:!1,skin:"layui-table-tips",success:function(e,t){e.find(".layui-table-tips-c").on("click",function(){l.close(t)})}}),layui.stope(e)}),i.layBody.on("click","*[lay-event]",function(){var e=t(this),a=e.parents("tr").eq(0).data("index");layui.event.call(this,h,"tool("+f+")",v.call(this,{event:e.attr("lay-event")})),i.setThisRowChecked(a)}),i.layMain.on("scroll",function(){var e=t(this),a=e.scrollLeft(),n=e.scrollTop();i.layHeader.scrollLeft(a),i.layTotal.scrollLeft(a),i.layFixed.find(C).scrollTop(n),l.close(i.tipsIndex)}),F.on("resize",function(){i.resize()})},function(){I.on("click",function(){I.trigger("table.remove.tool.panel")}),I.on("table.remove.tool.panel",function(){t(".layui-table-tool-panel").remove()})}(),d.init=function(e,i){i=i||{};var a=this,l=t(e?'table[lay-filter="'+e+'"]':f+"[lay-data]"),n="Table element property lay-data configuration item has a syntax error: ";return l.each(function(){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(o){r.error(n+l,"error")}var c=[],s=t.extend({elem:this,cols:[],data:[],skin:a.attr("lay-skin"),size:a.attr("lay-size"),even:"string"==typeof a.attr("lay-even")},d.config,i,l);e&&a.hide(),a.find("thead>tr").each(function(e){s.cols[e]=[],t(this).children().each(function(i){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(o){return r.error(n+l)}var d=t.extend({title:a.text(),colspan:a.attr("colspan")||0,rowspan:a.attr("rowspan")||0},l);d.colspan<2&&c.push(d),s.cols[e].push(d)})}),a.find("tbody>tr").each(function(e){var i=t(this),a={};i.children("td").each(function(e,i){var l=t(this),n=l.data("field");if(n)return a[n]=l.html()}),layui.each(c,function(e,t){var l=i.children("td").eq(e);a[t.field]=l.html()}),s.data[e]=a}),d.render(s)}),a},s.that={},s.config={},d.eachCols=function(e,i,a){var l=s.config[e]||{},n=[],o=0;a=t.extend(!0,[],a||l.cols),layui.each(a,function(e,t){layui.each(t,function(t,i){if(i.colGroup){var l=0;o++,i.CHILD_COLS=[],layui.each(a[e+1],function(e,t){t.PARENT_COL_INDEX||l>1&&l==i.colspan||(t.PARENT_COL_INDEX=o,i.CHILD_COLS.push(t),l+=parseInt(t.colspan>1?t.colspan:1))})}i.PARENT_COL_INDEX||n.push(i)})});var r=function(e){layui.each(e||n,function(e,t){return t.CHILD_COLS?r(t.CHILD_COLS):void("function"==typeof i&&i(e,t))})};r()},d.checkStatus=function(e){var t=0,i=0,a=[],l=d.cache[e]||[];return layui.each(l,function(e,l){return"array"===layui._typeof(l)?void i++:void(l[d.config.checkName]&&(t++,a.push(d.clearCacheKey(l))))}),{data:a,isAll:!!l.length&&t===l.length-i}},d.getData=function(e){var t=[],i=d.cache[e]||[];return layui.each(i,function(e,i){"array"!==layui._typeof(i)&&t.push(d.clearCacheKey(i))}),t},d.exportFile=function(e,t,i){var a=this;t=t||d.clearCacheKey(d.cache[e]),i=i||"csv";var l=s.that[e],n=s.config[e]||{},o={csv:"text/csv",xls:"application/vnd.ms-excel"}[i],u=document.createElement("a");return c.ie?r.error("IE_NOT_SUPPORT_EXPORTS"):(u.href="data:"+o+";charset=utf-8,\ufeff"+encodeURIComponent(function(){var i=[],n=[],o=[];return layui.each(t,function(t,a){var o=[];"object"==typeof e?(layui.each(e,function(e,a){0==t&&i.push(a||"")}),layui.each(d.clearCacheKey(a),function(e,t){o.push('"'+(t||"")+'"')})):d.eachCols(e,function(e,n){if(n.field&&"normal"==n.type&&!n.hide){var r=a[n.field];void 0!==r&&null!==r||(r=""),0==t&&i.push(n.title||""),o.push('"'+y.call(l,n,r,a,"text")+'"')}}),n.push(o.join(","))}),layui.each(a.dataTotal,function(e,t){o.push(t)}),i.join(",")+"\r\n"+n.join("\r\n")+"\r\n"+o.join(",")}()),u.download=(n.title||"table_"+(n.index||""))+"."+i,document.body.appendChild(u),u.click(),void document.body.removeChild(u))},d.resize=function(e){if(e){var t=u(e);if(!t)return;s.that[e].resize()}else layui.each(s.that,function(){ -this.resize()})},d.reload=function(e,t,i){var a=u(e);if(a){var l=s.that[e];return l.reload(t,i),s.call(l)}},d.render=function(e){var t=new H(e);return s.call(t)},d.clearCacheKey=function(e){return e=t.extend({},e),delete e[d.config.checkName],delete e[d.config.indexName],e},t(function(){d.init()}),e(h,d)});layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(clearInterval(e.timer),e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['",'"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['
            ',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("")}),i.join("")}(),"
          "].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):al.length&&(l.value=l.length),parseInt(l.value)!==l.value&&(l.half||(l.value=Math.ceil(l.value)-l.value<.5?Math.ceil(l.value):Math.floor(l.value)));for(var n='
            ",s=1;s<=l.length;s++){var r='
          • ";l.half&&parseInt(l.value)!==l.value&&s==Math.ceil(l.value)?n=n+'
          • ":n+=r}n+="
          "+(l.text?''+l.value+"\u661f":"")+"";var c=l.elem,f=c.next("."+t);f[0]&&f.remove(),e.elemTemp=a(n),l.span=e.elemTemp.next("span"),l.setText&&l.setText(l.value),c.html(e.elemTemp),c.addClass("layui-inline"),l.readonly||e.action()},v.prototype.setvalue=function(e){var a=this,l=a.config;l.value=e,a.render()},v.prototype.action=function(){var e=this,l=e.config,i=e.elemTemp,n=i.find("i").width();i.children("li").each(function(e){var t=e+1,v=a(this);v.on("click",function(e){if(l.value=t,l.half){var o=e.pageX-a(this).offset().left;o<=n/2&&(l.value=l.value-.5)}l.text&&i.next("span").text(l.value+"\u661f"),l.choose&&l.choose(l.value),l.setText&&l.setText(l.value)}),v.on("mousemove",function(e){if(i.find("i").each(function(){a(this).addClass(o).removeClass(r)}),i.find("i:lt("+t+")").each(function(){a(this).addClass(u).removeClass(f)}),l.half){var c=e.pageX-a(this).offset().left;c<=n/2&&v.children("i").addClass(s).removeClass(u)}}),v.on("mouseleave",function(){i.find("i").each(function(){a(this).addClass(o).removeClass(r)}),i.find("i:lt("+Math.floor(l.value)+")").each(function(){a(this).addClass(u).removeClass(f)}),l.half&&parseInt(l.value)!==l.value&&i.children("li:eq("+Math.floor(l.value)+")").children("i").addClass(s).removeClass(c)})})},v.prototype.events=function(){var e=this;e.config},l.render=function(e){var a=new v(e);return i.call(a)},e(n,l)});layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var m=l(e.elem);if(m[0]){var f=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,y=e.end||"\u6ca1\u6709\u66f4\u591a\u4e86",v=e.scrollElem&&e.scrollElem!==document,d="\u52a0\u8f7d\u66f4\u591a",h=l('");m.find(".layui-flow-more")[0]||m.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(y):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(f.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),!i&&m.width()&&(r=setTimeout(function(){var i=v?e.height():l(window).height(),n=v?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&e.attr("lay-src")){var f=e.attr("lay-src");layui.img(f,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",f).removeAttr("lay-src"),l[0]&&m(l),i++},function(){t.lazyimg.elem.eq(i);e.removeAttr("lay-src")})}},m=function(e,o){var m=a?(o||n).height():l(window).height(),f=n.scrollTop(),u=f+m;if(t.lazyimg.elem=l(r),e)c(e,m);else for(var s=0;su)break}};if(m(),!o){var f;n.on("scroll",function(){var e=l(this);f&&clearTimeout(f),f=setTimeout(function(){m(null,e)},50)}),o=!0}return m},e("flow",new o)});layui.define(["layer","form"],function(t){"use strict";var e=layui.$,i=layui.layer,a=layui.form,l=(layui.hint(),layui.device()),n="layedit",o="layui-show",r="layui-disabled",c=function(){var t=this;t.index=0,t.config={tool:["strong","italic","underline","del","|","left","center","right","|","link","unlink","face","image"],hideTool:[],height:280}};c.prototype.set=function(t){var i=this;return e.extend(!0,i.config,t),i},c.prototype.on=function(t,e){return layui.onevent(n,t,e)},c.prototype.build=function(t,i){i=i||{};var a=this,n=a.config,r="layui-layedit",c=e("string"==typeof t?"#"+t:t),u="LAY_layedit_"+ ++a.index,d=c.next("."+r),y=e.extend({},n,i),f=function(){var t=[],e={};return layui.each(y.hideTool,function(t,i){e[i]=!0}),layui.each(y.tool,function(i,a){C[a]&&!e[a]&&t.push(C[a])}),t.join("")}(),m=e(['
          ','
          '+f+"
          ",'
          ','',"
          ","
          "].join(""));return l.ie&&l.ie<8?c.removeClass("layui-hide").addClass(o):(d[0]&&d.remove(),s.call(a,m,c[0],y),c.addClass("layui-hide").after(m),a.index)},c.prototype.getContent=function(t){var e=u(t);if(e[0])return d(e[0].document.body.innerHTML)},c.prototype.getText=function(t){var i=u(t);if(i[0])return e(i[0].document.body).text()},c.prototype.setContent=function(t,i,a){var l=u(t);l[0]&&(a?e(l[0].document.body).append(i):e(l[0].document.body).html(i),layedit.sync(t))},c.prototype.sync=function(t){var i=u(t);if(i[0]){var a=e("#"+i[1].attr("textarea"));a.val(d(i[0].document.body.innerHTML))}},c.prototype.getSelection=function(t){var e=u(t);if(e[0]){var i=m(e[0].document);return document.selection?i.text:i.toString()}};var s=function(t,i,a){var l=this,n=t.find("iframe");n.css({height:a.height}).on("load",function(){var o=n.contents(),r=n.prop("contentWindow"),c=o.find("head"),s=e([""].join("")),u=o.find("body");c.append(s),u.attr("contenteditable","true").css({"min-height":a.height}).html(i.value||""),y.apply(l,[r,n,i,a]),g.call(l,r,t,a)})},u=function(t){var i=e("#LAY_layedit_"+t),a=i.prop("contentWindow");return[a,i]},d=function(t){return 8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),t},y=function(t,a,n,o){var r=t.document,c=e(r.body);c.on("keydown",function(t){var e=t.keyCode;if(13===e){var a=m(r),l=p(a),n=l.parentNode;if("pre"===n.tagName.toLowerCase()){if(t.shiftKey)return;return i.msg("\u8bf7\u6682\u65f6\u7528shift+enter"),!1}r.execCommand("formatBlock",!1,"

          ")}}),e(n).parents("form").on("submit",function(){var t=c.html();8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),n.value=t}),c.on("paste",function(e){r.execCommand("formatBlock",!1,"

          "),setTimeout(function(){f.call(t,c),n.value=c.html()},100)})},f=function(t){var i=this;i.document;t.find("*[style]").each(function(){var t=this.style.textAlign;this.removeAttribute("style"),e(this).css({"text-align":t||""})}),t.find("table").addClass("layui-table"),t.find("script,link").remove()},m=function(t){return t.selection?t.selection.createRange():t.getSelection().getRangeAt(0)},p=function(t){return t.endContainer||t.parentElement().childNodes[0]},v=function(t,i,a){var l=this.document,n=document.createElement(t);for(var o in i)n.setAttribute(o,i[o]);if(n.removeAttribute("text"),l.selection){var r=a.text||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.pasteHTML(e(n).prop("outerHTML")),a.select()}else{var r=a.toString()||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.deleteContents(),a.insertNode(n)}},h=function(t,i){var a=this.document,l="layedit-tool-active",n=p(m(a)),o=function(e){return t.find(".layedit-tool-"+e)};i&&i[i.hasClass(l)?"removeClass":"addClass"](l),t.find(">i").removeClass(l),o("unlink").addClass(r),e(n).parents().each(function(){var t=this.tagName.toLowerCase(),e=this.style.textAlign;"b"!==t&&"strong"!==t||o("b").addClass(l),"i"!==t&&"em"!==t||o("i").addClass(l),"u"===t&&o("u").addClass(l),"strike"===t&&o("d").addClass(l),"p"===t&&("center"===e?o("center").addClass(l):"right"===e?o("right").addClass(l):o("left").addClass(l)),"a"===t&&(o("link").addClass(l),o("unlink").removeClass(r))})},g=function(t,a,l){var n=t.document,o=e(n.body),c={link:function(i){var a=p(i),l=e(a).parent();b.call(o,{href:l.attr("href"),target:l.attr("target")},function(e){var a=l[0];"A"===a.tagName?a.href=e.url:v.call(t,"a",{target:e.target,href:e.url,text:e.url},i)})},unlink:function(t){n.execCommand("unlink")},face:function(e){x.call(this,function(i){v.call(t,"img",{src:i.src,alt:i.alt},e)})},image:function(a){var n=this;layui.use("upload",function(o){var r=l.uploadImage||{};o.render({url:r.url,method:r.type,elem:e(n).find("input")[0],done:function(e){0==e.code?(e.data=e.data||{},v.call(t,"img",{src:e.data.src,alt:e.data.title},a)):i.msg(e.msg||"\u4e0a\u4f20\u5931\u8d25")}})})},code:function(e){k.call(o,function(i){v.call(t,"pre",{text:i.code,"lay-lang":i.lang},e)})},help:function(){i.open({type:2,title:"\u5e2e\u52a9",area:["600px","380px"],shadeClose:!0,shade:.1,skin:"layui-layer-msg",content:["","no"]})}},s=a.find(".layui-layedit-tool"),u=function(){var i=e(this),a=i.attr("layedit-event"),l=i.attr("lay-command");if(!i.hasClass(r)){o.focus();var u=m(n);u.commonAncestorContainer;l?(n.execCommand(l),/justifyLeft|justifyCenter|justifyRight/.test(l)&&n.execCommand("formatBlock",!1,"

          "),setTimeout(function(){o.focus()},10)):c[a]&&c[a].call(this,u),h.call(t,s,i)}},d=/image/;s.find(">i").on("mousedown",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)||u.call(this)}).on("click",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)&&u.call(this)}),o.on("click",function(){h.call(t,s),i.close(x.index)})},b=function(t,e){var l=this,n=i.open({type:1,id:"LAY_layedit_link",area:"350px",shade:.05,shadeClose:!0,moveType:1,title:"\u8d85\u94fe\u63a5",skin:"layui-layer-msg",content:['

            ','
          • ','','
            ','',"
            ","
          • ",'
          • ','','
            ','",'","
            ","
          • ",'
          • ','','',"
          • ","
          "].join(""),success:function(t,n){var o="submit(layedit-link-yes)";a.render("radio"),t.find(".layui-btn-primary").on("click",function(){i.close(n),l.focus()}),a.on(o,function(t){i.close(b.index),e&&e(t.field)})}});b.index=n},x=function(t){var a=function(){var t=["[\u5fae\u7b11]","[\u563b\u563b]","[\u54c8\u54c8]","[\u53ef\u7231]","[\u53ef\u601c]","[\u6316\u9f3b]","[\u5403\u60ca]","[\u5bb3\u7f9e]","[\u6324\u773c]","[\u95ed\u5634]","[\u9119\u89c6]","[\u7231\u4f60]","[\u6cea]","[\u5077\u7b11]","[\u4eb2\u4eb2]","[\u751f\u75c5]","[\u592a\u5f00\u5fc3]","[\u767d\u773c]","[\u53f3\u54fc\u54fc]","[\u5de6\u54fc\u54fc]","[\u5618]","[\u8870]","[\u59d4\u5c48]","[\u5410]","[\u54c8\u6b20]","[\u62b1\u62b1]","[\u6012]","[\u7591\u95ee]","[\u998b\u5634]","[\u62dc\u62dc]","[\u601d\u8003]","[\u6c57]","[\u56f0]","[\u7761]","[\u94b1]","[\u5931\u671b]","[\u9177]","[\u8272]","[\u54fc]","[\u9f13\u638c]","[\u6655]","[\u60b2\u4f24]","[\u6293\u72c2]","[\u9ed1\u7ebf]","[\u9634\u9669]","[\u6012\u9a82]","[\u4e92\u7c89]","[\u5fc3]","[\u4f24\u5fc3]","[\u732a\u5934]","[\u718a\u732b]","[\u5154\u5b50]","[ok]","[\u8036]","[good]","[NO]","[\u8d5e]","[\u6765]","[\u5f31]","[\u8349\u6ce5\u9a6c]","[\u795e\u9a6c]","[\u56e7]","[\u6d6e\u4e91]","[\u7ed9\u529b]","[\u56f4\u89c2]","[\u5a01\u6b66]","[\u5965\u7279\u66fc]","[\u793c\u7269]","[\u949f]","[\u8bdd\u7b52]","[\u8721\u70db]","[\u86cb\u7cd5]"],e={};return layui.each(t,function(t,i){e[i]=layui.cache.dir+"images/face/"+t+".gif"}),e}();return x.hide=x.hide||function(t){"face"!==e(t.target).attr("layedit-event")&&i.close(x.index)},x.index=i.tips(function(){var t=[];return layui.each(a,function(e,i){t.push('
        • '+e+'
        • ')}),'
            '+t.join("")+"
          "}(),this,{tips:1,time:0,skin:"layui-box layui-util-face",maxWidth:500,success:function(l,n){l.css({marginTop:-4,marginLeft:-10}).find(".layui-clear>li").on("click",function(){t&&t({src:a[this.title],alt:this.title}),i.close(n)}),e(document).off("click",x.hide).on("click",x.hide)}})},k=function(t){var e=this,l=i.open({type:1,id:"LAY_layedit_code",area:"550px",shade:.05,shadeClose:!0,moveType:1,title:"\u63d2\u5165\u4ee3\u7801",skin:"layui-layer-msg",content:['
            ','
          • ','','
            ','","
            ","
          • ",'
          • ','','
            ','',"
            ","
          • ",'
          • ','','',"
          • ","
          "].join(""),success:function(l,n){var o="submit(layedit-code-yes)";a.render("select"),l.find(".layui-btn-primary").on("click",function(){i.close(n),e.focus()}),a.on(o,function(e){i.close(k.index),t&&t(e.field)})}});k.index=l},C={html:'',strong:'',italic:'',underline:'',del:'',"|":'',left:'',center:'',right:'',link:'',unlink:'',face:'',image:'',code:'',help:''},L=new c;t(n,L)});layui.define("jquery",function(a){"use strict";var e=layui.$;a("code",function(a){var l=[];a=a||{},a.elem=e(a.elem||".layui-code"),a.lang="lang"in a?a.lang:"code",a.elem.each(function(){l.push(this)}),layui.each(l.reverse(),function(l,i){var t=e(i),c=t.html();(t.attr("lay-encode")||a.encode)&&(c=c.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")),t.html('
          1. '+c.replace(/[\r\t\n]+/g,"
          2. ")+"
          "),t.find(">.layui-code-h3")[0]||t.prepend('

          '+(t.attr("lay-title")||a.title||"</>")+''+(t.attr("lay-lang")||a.lang||"")+"

          ");var n=t.find(">.layui-code-ol");t.addClass("layui-box layui-code-view"),(t.attr("lay-skin")||a.skin)&&t.addClass("layui-code-"+(t.attr("lay-skin")||a.skin)),(n.find("li").length/100|0)>0&&n.css("margin-left",(n.find("li").length/100|0)+"px"),(t.attr("lay-height")||a.height)&&n.css("max-height",t.attr("lay-height")||a.height)})})}).addcss("modules/code.css?v=2","skincodecss"); \ No newline at end of file +/*! MIT Licensed */;!function(t){"use strict";var e=t.document,n={modules:{},status:{},timeout:10,event:{}},r=function(){this.v="2.6.8"},o=t.LAYUI_GLOBAL||{},a=function(){var t=e.currentScript?e.currentScript.src:function(){for(var t,n=e.scripts,r=n.length-1,o=r;o>0;o--)if("interactive"===n[o].readyState){t=n[o].src;break}return t||n[r].src}();return n.dir=o.dir||t.substring(0,t.lastIndexOf("/")+1)}(),i=function(e,n){n=n||"log",t.console&&console[n]&&console[n]("layui error hint: "+e)},u="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),l=n.builtin={lay:"lay",layer:"layer",laydate:"laydate",laypage:"laypage",laytpl:"laytpl",layedit:"layedit",form:"form",upload:"upload",dropdown:"dropdown",transfer:"transfer",tree:"tree",table:"table",element:"element",rate:"rate",colorpicker:"colorpicker",slider:"slider",carousel:"carousel",flow:"flow",util:"util",code:"code",jquery:"jquery",all:"all","layui.all":"layui.all"};r.prototype.cache=n,r.prototype.define=function(t,e){var r=this,o="function"==typeof t,a=function(){var t=function(t,e){layui[t]=e,n.status[t]=!0};return"function"==typeof e&&e(function(r,o){t(r,o),n.callback[r]=function(){e(t)}}),this};return o&&(e=t,t=[]),r.use(t,a,null,"define"),r},r.prototype.use=function(r,o,c,s){function p(t,e){var r="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===t.type||r.test((t.currentTarget||t.srcElement).readyState))&&(n.modules[h]=e,v.removeChild(b),function o(){return++m>1e3*n.timeout/4?i(h+" is not a valid module","error"):void(n.status[h]?f():setTimeout(o,4))}())}function f(){c.push(layui[h]),r.length>1?y.use(r.slice(1),o,c,s):"function"==typeof o&&function(){return layui.jquery&&"function"==typeof layui.jquery&&"define"!==s?layui.jquery(function(){o.apply(layui,c)}):void o.apply(layui,c)}()}var y=this,d=n.dir=n.dir?n.dir:a,v=e.getElementsByTagName("head")[0];r=function(){return"string"==typeof r?[r]:"function"==typeof r?(o=r,["all"]):r}(),t.jQuery&&jQuery.fn.on&&(y.each(r,function(t,e){"jquery"===e&&r.splice(t,1)}),layui.jquery=layui.$=jQuery);var h=r[0],m=0;if(c=c||[],n.host=n.host||(d.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===r.length||layui["layui.all"]&&l[h])return f(),y;var g=(l[h]?d+"modules/":/^\{\/\}/.test(y.modules[h])?"":n.base||"")+(y.modules[h]||h)+".js";if(g=g.replace(/^\{\/\}/,""),!n.modules[h]&&layui[h]&&(n.modules[h]=g),n.modules[h])!function S(){return++m>1e3*n.timeout/4?i(h+" is not a valid module","error"):void("string"==typeof n.modules[h]&&n.status[h]?f():setTimeout(S,4))}();else{var b=e.createElement("script");b.async=!0,b.charset="utf-8",b.src=g+function(){var t=n.version===!0?n.v||(new Date).getTime():n.version||"";return t?"?v="+t:""}(),v.appendChild(b),!b.attachEvent||b.attachEvent.toString&&b.attachEvent.toString().indexOf("[native code")<0||u?b.addEventListener("load",function(t){p(t,g)},!1):b.attachEvent("onreadystatechange",function(t){p(t,g)}),n.modules[h]=g}return y},r.prototype.getStyle=function(e,n){var r=e.currentStyle?e.currentStyle:t.getComputedStyle(e,null);return r[r.getPropertyValue?"getPropertyValue":"getAttribute"](n)},r.prototype.link=function(t,r,o){var a=this,u=e.getElementsByTagName("head")[0],l=e.createElement("link");"string"==typeof r&&(o=r);var c=(o||t).replace(/\.|\//g,""),s=l.id="layuicss-"+c,p="creating",f=0;return l.rel="stylesheet",l.href=t+(n.debug?"?v="+(new Date).getTime():""),l.media="all",e.getElementById(s)||u.appendChild(l),"function"!=typeof r?a:(function y(o){var u=100,l=e.getElementById(s);return++f>1e3*n.timeout/u?i(t+" timeout"):void(1989===parseInt(a.getStyle(l,"width"))?(o===p&&l.removeAttribute("lay-status"),l.getAttribute("lay-status")===p?setTimeout(y,u):r()):(l.setAttribute("lay-status",p),setTimeout(function(){y(p)},u)))}(),a)},r.prototype.addcss=function(t,e,r){return layui.link(n.dir+"css/"+t,e,r)},n.callback={},r.prototype.factory=function(t){if(layui[t])return"function"==typeof n.callback[t]?n.callback[t]:null},r.prototype.img=function(t,e,n){var r=new Image;return r.src=t,r.complete?e(r):(r.onload=function(){r.onload=null,"function"==typeof e&&e(r)},void(r.onerror=function(t){r.onerror=null,"function"==typeof n&&n(t)}))},r.prototype.config=function(t){t=t||{};for(var e in t)n[e]=t[e];return this},r.prototype.modules=function(){var t={};for(var e in l)t[e]=l[e];return t}(),r.prototype.extend=function(t){var e=this;t=t||{};for(var n in t)e[n]||e.modules[n]?i(n+" Module already exists","error"):e.modules[n]=t[n];return e},r.prototype.router=function(t){var e=this,t=t||location.hash,n={path:[],search:{},hash:(t.match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(t)?(t=t.replace(/^#\//,""),n.href="/"+t,t=t.replace(/([^#])(#.*$)/,"$1").split("/")||[],e.each(t,function(t,e){/^\w+=/.test(e)?function(){e=e.split("="),n.search[e[0]]=e[1]}():n.path.push(e)}),n):n},r.prototype.url=function(t){var e=this,n={pathname:function(){var e=t?function(){var e=(t.match(/\.[^.]+?\/.+/)||[])[0]||"";return e.replace(/^[^\/]+/,"").replace(/\?.+/,"")}():location.pathname;return e.replace(/^\//,"").split("/")}(),search:function(){var n={},r=(t?function(){var e=(t.match(/\?.+/)||[])[0]||"";return e.replace(/\#.+/,"")}():location.search).replace(/^\?+/,"").split("&");return e.each(r,function(t,e){var r=e.indexOf("="),o=function(){return r<0?e.substr(0,e.length):0!==r&&e.substr(0,r)}();o&&(n[o]=r>0?e.substr(r+1):null)}),n}(),hash:e.router(function(){return t?(t.match(/#.+/)||[])[0]||"/":location.hash}())};return n},r.prototype.data=function(e,n,r){if(e=e||"layui",r=r||localStorage,t.JSON&&t.JSON.parse){if(null===n)return delete r[e];n="object"==typeof n?n:{key:n};try{var o=JSON.parse(r[e])}catch(a){var o={}}return"value"in n&&(o[n.key]=n.value),n.remove&&delete o[n.key],r[e]=JSON.stringify(o),n.key?o[n.key]:o}},r.prototype.sessionData=function(t,e){return this.data(t,e,sessionStorage)},r.prototype.device=function(e){var n=navigator.userAgent.toLowerCase(),r=function(t){var e=new RegExp(t+"/([^\\s\\_\\-]+)");return t=(n.match(e)||[])[1],t||!1},o={os:function(){return/windows/.test(n)?"windows":/linux/.test(n)?"linux":/iphone|ipod|ipad|ios/.test(n)?"ios":/mac/.test(n)?"mac":void 0}(),ie:function(){return!!(t.ActiveXObject||"ActiveXObject"in t)&&((n.match(/msie\s(\d+)/)||[])[1]||"11")}(),weixin:r("micromessenger")};return e&&!o[e]&&(o[e]=r(e)),o.android=/android/.test(n),o.ios="ios"===o.os,o.mobile=!(!o.android&&!o.ios),o},r.prototype.hint=function(){return{error:i}},r.prototype._typeof=function(t){return null===t?String(t):"object"==typeof t||"function"==typeof t?function(){var e=Object.prototype.toString.call(t).match(/\s(.+)\]$/)||[],n="Function|Array|Date|RegExp|Object|Error|Symbol";return e=e[1]||"Object",new RegExp("\\b("+n+")\\b").test(e)?e.toLowerCase():"object"}():typeof t},r.prototype._isArray=function(e){var n,r=this,o=r._typeof(e);return!(!e||"object"!=typeof e||e===t)&&(n="length"in e&&e.length,"array"===o||0===n||"number"==typeof n&&n>0&&n-1 in e)},r.prototype.each=function(t,e){var n,r=this,o=function(t,n){return e.call(n[t],t,n[t])};if("function"!=typeof e)return r;if(t=t||[],r._isArray(t))for(n=0;no?1:r(t.innerHeight||n.documentElement.clientHeight)},r.position=function(e,o,i){if(o){i=i||{},e!==n&&e!==r("body")[0]||(i.clickType="right");var c="right"===i.clickType?function(){var e=i.e||t.event||{};return{left:e.clientX,top:e.clientY,right:e.clientX,bottom:e.clientY}}():e.getBoundingClientRect(),u=o.offsetWidth,a=o.offsetHeight,f=function(t){return t=t?"scrollLeft":"scrollTop",n.body[t]|n.documentElement[t]},s=function(t){return n.documentElement[t?"clientWidth":"clientHeight"]},l=5,h=c.left,p=c.bottom;"center"===i.align?h-=(u-e.offsetWidth)/2:"right"===i.align&&(h=h-u+e.offsetWidth),h+u+l>s("width")&&(h=s("width")-u-l),hs()&&(c.top>a+l?p=c.top-a-2*l:"right"===i.clickType&&(p=s()-a-2*l,p<0&&(p=0)));var y=i.position;if(y&&(o.style.position=y),o.style.left=h+("fixed"===y?0:f(1))+"px",o.style.top=p+("fixed"===y?0:f())+"px",!r.hasScrollbar()){var d=o.getBoundingClientRect();!i.SYSTEM_RELOAD&&d.bottom+l>s()&&(i.SYSTEM_RELOAD=!0,setTimeout(function(){r.position(e,o,i)},50))}}},r.options=function(t,e){var n=r(t),o=e||"lay-options";try{return new Function("return "+(n.attr(o)||"{}"))()}catch(i){return hint.error("parseerror\uff1a"+i,"error"),{}}},r.isTopElem=function(t){var e=[n,r("body")[0]],o=!1;return r.each(e,function(e,n){if(n===t)return o=!0}),o},o.addStr=function(t,e){return t=t.replace(/\s+/," "),e=e.replace(/\s+/," ").split(" "),r.each(e,function(e,n){new RegExp("\\b"+n+"\\b").test(t)||(t=t+" "+n)}),t.replace(/^\s|\s$/,"")},o.removeStr=function(t,e){return t=t.replace(/\s+/," "),e=e.replace(/\s+/," ").split(" "),r.each(e,function(e,n){var r=new RegExp("\\b"+n+"\\b");r.test(t)&&(t=t.replace(r,""))}),t.replace(/\s+/," ").replace(/^\s|\s$/,"")},o.prototype.find=function(t){var e=this,n=0,o=[],i="object"==typeof t;return this.each(function(r,c){for(var u=i?c.contains(t):c.querySelectorAll(t||null);n0)return n[0].style[t]}():n.each(function(n,i){"object"==typeof t?r.each(t,function(t,e){i.style[t]=o(e)}):i.style[t]=o(e)})},o.prototype.width=function(t){var e=this;return void 0===t?function(){if(e.length>0)return e[0].offsetWidth}():e.each(function(n,r){e.css("width",t)})},o.prototype.height=function(t){var e=this;return void 0===t?function(){if(e.length>0)return e[0].offsetHeight}():e.each(function(n,r){e.css("height",t)})},o.prototype.attr=function(t,e){var n=this;return void 0===e?function(){if(n.length>0)return n[0].getAttribute(t)}():n.each(function(n,r){r.setAttribute(t,e)})},o.prototype.removeAttr=function(t){return this.each(function(e,n){n.removeAttribute(t)})},o.prototype.html=function(t){var e=this;return void 0===t?function(){if(e.length>0)return e[0].innerHTML}():this.each(function(e,n){n.innerHTML=t})},o.prototype.val=function(t){var e=this;return void 0===t?function(){if(e.length>0)return e[0].value}():this.each(function(e,n){n.value=t})},o.prototype.append=function(t){return this.each(function(e,n){"object"==typeof t?n.appendChild(t):n.innerHTML=n.innerHTML+t})},o.prototype.remove=function(t){return this.each(function(e,n){t?n.removeChild(t):n.parentNode.removeChild(n)})},o.prototype.on=function(t,e){return this.each(function(n,r){r.attachEvent?r.attachEvent("on"+t,function(t){t.target=t.srcElement,e.call(r,t)}):r.addEventListener(t,e,!1)})},o.prototype.off=function(t,e){return this.each(function(n,r){r.detachEvent?r.detachEvent("on"+t,e):r.removeEventListener(t,e,!1)})},t.lay=r,t.layui&&layui.define&&layui.define(function(t){t(e,r)})}(window,window.document);layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error: ";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\(.)/g,"$1")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\(.)/g,"$1")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)});layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?''+a.prev+"":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push(''+(a.first||1)+"");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r2&&e.push('');r<=u;r++)r===a.curr?e.push('"+r+""):e.push(''+r+"");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1…'),0!==t&&e.push(''+(a.last||a.pages)+"")),e.join("")}(),next:function(){return a.next?''+a.next+"":""}(),count:'\u5171 '+a.count+" \u6761",limit:function(){var e=['"}(),refresh:['','',""].join(""),skip:function(){return['到第','','页',""].join("")}()};return['
          ',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"
          "].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;oi.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)});!function(e,t){"use strict";var a=e.layui&&layui.define,n={getPath:e.lay&&lay.getPath?lay.getPath:"",link:function(t,a,n){l.path&&e.lay&&lay.layui&&lay.layui.link(l.path+t,a,n)}},i=e.LAYUI_GLOBAL||{},l={v:"5.3.1",config:{},index:e.laydate&&e.laydate.v?1e5:0,path:i.laydate_dir||n.getPath,set:function(e){var t=this;return t.config=lay.extend({},t.config,e),t},ready:function(e){var t="laydate",i="",r=(a?"modules/laydate/":"theme/")+"default/laydate.css?v="+l.v+i;return a?layui.addcss(r,e,t):n.link(r,e,t),this}},r=function(){var e=this,t=e.config,a=t.id;return r.that[a]=e,{hint:function(t){e.hint.call(e,t)},config:e.config}},o="laydate",s=".layui-laydate",y="layui-this",d="laydate-disabled",m=[100,2e5],c="layui-laydate-static",u="layui-laydate-list",h="layui-laydate-hint",f="layui-laydate-footer",p=".laydate-btns-confirm",g="laydate-time-text",v="laydate-btns-time",T="layui-laydate-preview",D=function(e){var t=this;t.index=++l.index,t.config=lay.extend({},t.config,l.config,e),e=t.config,e.id="id"in e?e.id:t.index,l.ready(function(){t.init()})},w="yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s";r.formatArr=function(e){return(e||"").match(new RegExp(w+"|.","g"))||[]},D.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},D.prototype.config={type:"date",range:!1,format:"yyyy-MM-dd",value:null,isInitValue:!0,min:"1900-1-1",max:"2099-12-31",trigger:"click",show:!1,showBottom:!0,isPreview:!0,btns:["clear","now","confirm"],lang:"cn",theme:"default",position:null,calendar:!1,mark:{},zIndex:null,done:null,change:null},D.prototype.lang=function(){var e=this,t=e.config,a={cn:{weeks:["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d"],time:["\u65f6","\u5206","\u79d2"],timeTips:"\u9009\u62e9\u65f6\u95f4",startTime:"\u5f00\u59cb\u65f6\u95f4",endTime:"\u7ed3\u675f\u65f6\u95f4",dateTips:"\u8fd4\u56de\u65e5\u671f",month:["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"],tools:{confirm:"\u786e\u5b9a",clear:"\u6e05\u7a7a",now:"\u73b0\u5728"},timeout:"\u7ed3\u675f\u65f6\u95f4\u4e0d\u80fd\u65e9\u4e8e\u5f00\u59cb\u65f6\u95f4
          \u8bf7\u91cd\u65b0\u9009\u62e9",invalidDate:"\u4e0d\u5728\u6709\u6548\u65e5\u671f\u6216\u65f6\u95f4\u8303\u56f4\u5185",formatError:["\u65e5\u671f\u683c\u5f0f\u4e0d\u5408\u6cd5
          \u5fc5\u987b\u9075\u5faa\u4e0b\u8ff0\u683c\u5f0f\uff1a
          ","
          \u5df2\u4e3a\u4f60\u91cd\u7f6e"],preview:"\u5f53\u524d\u9009\u4e2d\u7684\u7ed3\u679c"},en:{weeks:["Su","Mo","Tu","We","Th","Fr","Sa"],time:["Hours","Minutes","Seconds"],timeTips:"Select Time",startTime:"Start Time",endTime:"End Time",dateTips:"Select Date",month:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],tools:{confirm:"Confirm",clear:"Clear",now:"Now"},timeout:"End time cannot be less than start Time
          Please re-select",invalidDate:"Invalid date",formatError:["The date format error
          Must be followed\uff1a
          ","
          It has been reset"],preview:"The selected result"}};return a[t.lang]||a.cn},D.prototype.init=function(){var t=this,a=t.config,n="static"===a.position,i={year:"yyyy",month:"yyyy-MM",date:"yyyy-MM-dd",time:"HH:mm:ss",datetime:"yyyy-MM-dd HH:mm:ss"};a.elem=lay(a.elem),a.eventElem=lay(a.eventElem),a.elem[0]&&(t.rangeStr=a.range?"string"==typeof a.range?a.range:"-":"","array"===layui._typeof(a.range)&&(t.rangeElem=[lay(a.range[0]),lay(a.range[1])]),i[a.type]||(e.console&&console.error&&console.error("laydate type error:'"+a.type+"' is not supported"),a.type="date"),a.format===i.date&&(a.format=i[a.type]||i.date),t.format=r.formatArr(a.format),t.EXP_IF="",t.EXP_SPLIT="",lay.each(t.format,function(e,a){var n=new RegExp(w).test(a)?"\\d{"+function(){return new RegExp(w).test(t.format[0===e?e+1:e-1]||"")?/^yyyy|y$/.test(a)?4:a.length:/^yyyy$/.test(a)?"1,4":/^y$/.test(a)?"1,308":"1,2"}()+"}":"\\"+a;t.EXP_IF=t.EXP_IF+n,t.EXP_SPLIT=t.EXP_SPLIT+"("+n+")"}),t.EXP_IF_ONE=new RegExp("^"+t.EXP_IF+"$"),t.EXP_IF=new RegExp("^"+(a.range?t.EXP_IF+"\\s\\"+t.rangeStr+"\\s"+t.EXP_IF:t.EXP_IF)+"$"),t.EXP_SPLIT=new RegExp("^"+t.EXP_SPLIT+"$",""),t.isInput(a.elem[0])||"focus"===a.trigger&&(a.trigger="click"),a.elem.attr("lay-key")||(a.elem.attr("lay-key",t.index),a.eventElem.attr("lay-key",t.index)),a.mark=lay.extend({},a.calendar&&"cn"===a.lang?{"0-1-1":"\u5143\u65e6","0-2-14":"\u60c5\u4eba","0-3-8":"\u5987\u5973","0-3-12":"\u690d\u6811","0-4-1":"\u611a\u4eba","0-5-1":"\u52b3\u52a8","0-5-4":"\u9752\u5e74","0-6-1":"\u513f\u7ae5","0-9-10":"\u6559\u5e08","0-9-18":"\u56fd\u803b","0-10-1":"\u56fd\u5e86","0-12-25":"\u5723\u8bde"}:{},a.mark),lay.each(["min","max"],function(e,t){var n=[],i=[];if("number"==typeof a[t]){var l=a[t],r=(new Date).getTime(),o=864e5,s=new Date(l?l0)return!0;var t=lay.elem("div",{"class":"layui-laydate-header"}),i=[function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-y"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-prev-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("div",{"class":"laydate-set-ym"}),t=lay.elem("span"),a=lay.elem("span");return e.appendChild(t),e.appendChild(a),e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-m"});return e.innerHTML="",e}(),function(){var e=lay.elem("i",{"class":"layui-icon laydate-icon laydate-next-y"});return e.innerHTML="",e}()],l=lay.elem("div",{"class":"layui-laydate-content"}),r=lay.elem("table"),m=lay.elem("thead"),c=lay.elem("tr");lay.each(i,function(e,a){t.appendChild(a)}),m.appendChild(c),lay.each(new Array(6),function(e){var t=r.insertRow(0);lay.each(new Array(7),function(a){if(0===e){var i=lay.elem("th");i.innerHTML=n.weeks[a],c.appendChild(i)}t.insertCell(a)})}),r.insertBefore(m,r.children[0]),l.appendChild(r),o[e]=lay.elem("div",{"class":"layui-laydate-main laydate-main-list-"+e}),o[e].appendChild(t),o[e].appendChild(l),s.push(i),y.push(l),d.push(r)}),lay(m).html(function(){var e=[],t=[];return"datetime"===a.type&&e.push(''+n.timeTips+""),(a.range||"datetime"!==a.type)&&e.push(''),lay.each(a.btns,function(e,l){var r=n.tools[l]||"btn";a.range&&"now"===l||(i&&"clear"===l&&(r="cn"===a.lang?"\u91cd\u7f6e":"Reset"),t.push(''+r+""))}),e.push('"),e.join("")}()),lay.each(o,function(e,t){r.appendChild(t)}),a.showBottom&&r.appendChild(m),/^#/.test(a.theme)){var u=lay.elem("style"),h=["#{{id}} .layui-laydate-header{background-color:{{theme}};}","#{{id}} .layui-this{background-color:{{theme}} !important;}"].join("").replace(/{{id}}/g,e.elemID).replace(/{{theme}}/g,a.theme);"styleSheet"in u?(u.setAttribute("type","text/css"),u.styleSheet.cssText=h):u.innerHTML=h,lay(r).addClass("laydate-theme-molv"),r.appendChild(u)}l.thisId=a.id,e.remove(D.thisElemDate),i?a.elem.append(r):(t.body.appendChild(r),e.position()),e.checkDate().calendar(null,0,"init"),e.changeEvent(),D.thisElemDate=e.elemID,"function"==typeof a.ready&&a.ready(lay.extend({},a.dateTime,{month:a.dateTime.month+1})),e.preview()},D.prototype.remove=function(e){var t=this,a=(t.config,lay("#"+(e||t.elemID)));return a[0]?(a.hasClass(c)||t.checkDate(function(){a.remove()}),t):t},D.prototype.position=function(){var e=this,t=e.config;return lay.position(e.bindElem||t.elem[0],e.elem,{position:t.position}),e},D.prototype.hint=function(e){var t=this,a=(t.config,lay.elem("div",{"class":h}));t.elem&&(a.innerHTML=e||"",lay(t.elem).find("."+h).remove(),t.elem.appendChild(a),clearTimeout(t.hinTimer),t.hinTimer=setTimeout(function(){lay(t.elem).find("."+h).remove()},3e3))},D.prototype.getAsYM=function(e,t,a){return a?t--:t++,t<0&&(t=11,e--),t>11&&(t=0,e++),[e,t]},D.prototype.systemDate=function(e){var t=e||new Date;return{year:t.getFullYear(),month:t.getMonth(),date:t.getDate(),hours:e?e.getHours():0,minutes:e?e.getMinutes():0,seconds:e?e.getSeconds():0}},D.prototype.checkDate=function(e){var t,a,n=this,i=(new Date,n.config),r=n.lang(),o=i.dateTime=i.dateTime||n.systemDate(),s=n.bindElem||i.elem[0],y=(n.isInput(s)?"val":"html",function(){if(n.rangeElem){var e=[n.rangeElem[0].val(),n.rangeElem[1].val()];if(e[0]&&e[1])return e.join(" "+n.rangeStr+" ")}return n.isInput(s)?s.value:"static"===i.position?"":lay(s).attr("lay-date")}()),d=function(e){e.year>m[1]&&(e.year=m[1],a=!0),e.month>11&&(e.month=11,a=!0),e.hours>23&&(e.hours=0,a=!0),e.minutes>59&&(e.minutes=0,e.hours++,a=!0),e.seconds>59&&(e.seconds=0,e.minutes++,a=!0),t=l.getEndDate(e.month+1,e.year),e.date>t&&(e.date=t,a=!0)},c=function(e,t,l){var r=["startTime","endTime"];t=(t.match(n.EXP_SPLIT)||[]).slice(1),l=l||0,i.range&&(n[r[l]]=n[r[l]]||{}),lay.each(n.format,function(o,s){var y=parseFloat(t[o]);t[o].lengthh(i.max)||h(o)h(i.max))&&(n.endDate=lay.extend({},i.max)),e&&e(),n},D.prototype.mark=function(e,t){var a,n=this,i=n.config;return lay.each(i.mark,function(e,n){var i=e.split("-");i[0]!=t[0]&&0!=i[0]||i[1]!=t[1]&&0!=i[1]||i[2]!=t[2]||(a=n||t[2])}),a&&e.html(''+a+""),n},D.prototype.limit=function(e,t,a,n){var i,l=this,r=l.config,o={},s=r[a>41?"endDate":"dateTime"],y=lay.extend({},s,t||{});return lay.each({now:y,min:r.min,max:r.max},function(e,t){o[e]=l.newDate(lay.extend({year:t.year,month:t.month,date:t.date},function(){var e={};return lay.each(n,function(a,n){e[n]=t[n]}),e}())).getTime()}),i=o.nowo.max,e&&e[i?"addClass":"removeClass"](d),i},D.prototype.thisDateTime=function(e){var t=this,a=t.config;return e?t.endDate:a.dateTime},D.prototype.calendar=function(e,t,a){var n,i,r,o=this,s=o.config,t=t?1:0,d=e||o.thisDateTime(t),c=new Date,u=o.lang(),h="date"!==s.type&&"datetime"!==s.type,f=lay(o.table[t]).find("td"),g=lay(o.elemHeader[t][2]).find("span");return d.yearm[1]&&(d.year=m[1],o.hint(u.invalidDate)),o.firstDate||(o.firstDate=lay.extend({},d)),c.setFullYear(d.year,d.month,1),n=c.getDay(),i=l.getEndDate(d.month||12,d.year),r=l.getEndDate(d.month+1,d.year),lay.each(f,function(e,t){var a=[d.year,d.month],l=0;t=lay(t),t.removeAttr("class"),e=n&&e=a.firstDate.year&&(l.month=n.max.month,l.date=n.max.date),a.limit(lay(i),l,t),M++}),lay(m[f?0:1]).attr("lay-ym",M-8+"-"+D[1]).html(E+T+" - "+(M-1+T))}else if("month"===e)lay.each(new Array(12),function(e){var i=lay.elem("li",{"lay-ym":e}),r={year:D[0],month:e};e+1==D[1]&&lay(i).addClass(y),i.innerHTML=l.month[e]+(f?"\u6708":""),o.appendChild(i),D[0]=a.firstDate.year&&(r.date=n.max.date),a.limit(lay(i),r,t)}),lay(m[f?0:1]).attr("lay-ym",D[0]+"-"+D[1]).html(D[0]+T);else if("time"===e){var C=function(){lay(o).find("ol").each(function(e,n){lay(n).find("li").each(function(n,i){a.limit(lay(i),[{hours:n},{hours:a[x].hours,minutes:n},{hours:a[x].hours,minutes:a[x].minutes,seconds:n}][e],t,[["hours"],["hours","minutes"],["hours","minutes","seconds"]][e])})}),n.range||a.limit(lay(a.footer).find(p),a[x],0,["hours","minutes","seconds"])};n.range?a[x]||(a[x]="startTime"===x?i:a.endDate):a[x]=i,lay.each([24,60,60],function(e,t){var n=lay.elem("li"),i=["

          "+l.time[e]+"

            "];lay.each(new Array(t),function(t){i.push(""+lay.digit(t,2)+"")}),n.innerHTML=i.join("")+"
          ",o.appendChild(n)}),C()}if(h&&c.removeChild(h),c.appendChild(o),"year"===e||"month"===e)lay(a.elemMain[t]).addClass("laydate-ym-show"),lay(o).find("li").on("click",function(){var l=0|lay(this).attr("lay-ym");if(!lay(this).hasClass(d)){0===t?(i[e]=l,a.limit(lay(a.footer).find(p),null,0)):a.endDate[e]=l;var s="year"===n.type||"month"===n.type;s?(lay(o).find("."+y).removeClass(y),lay(this).addClass(y),"month"===n.type&&"year"===e&&(a.listYM[t][0]=l,r&&((t?a.endDate:i).year=l),a.list("month",t))):(a.checkDate("limit").calendar(null,t),a.closeList()),a.setBtnStatus(),n.range||("month"===n.type&&"month"===e||"year"===n.type&&"year"===e)&&a.setValue(a.parse()).remove().done(),a.done(null,"change"),lay(a.footer).find("."+v).removeClass(d)}});else{var I=lay.elem("span",{"class":g}),k=function(){lay(o).find("ol").each(function(e){var t=this,n=lay(t).find("li");t.scrollTop=30*(a[x][w[e]]-2),t.scrollTop<=0&&n.each(function(e,a){if(!lay(this).hasClass(d))return t.scrollTop=30*(e-2),!0})})},b=lay(s[2]).find("."+g);k(),I.innerHTML=n.range?[l.startTime,l.endTime][t]:l.timeTips,lay(a.elemMain[t]).addClass("laydate-time-show"),b[0]&&b.remove(),s[2].appendChild(I),lay(o).find("ol").each(function(e){var t=this;lay(t).find("li").on("click",function(){var l=0|this.innerHTML;lay(this).hasClass(d)||(n.range?a[x][w[e]]=l:i[w[e]]=l,lay(t).find("."+y).removeClass(y),lay(this).addClass(y),C(),k(),(a.endDate||"time"===n.type)&&a.done(null,"change"),a.setBtnStatus())})})}return a},D.prototype.listYM=[],D.prototype.closeList=function(){var e=this;e.config;lay.each(e.elemCont,function(t,a){lay(this).find("."+u).remove(),lay(e.elemMain[t]).removeClass("laydate-ym-show laydate-time-show")}),lay(e.elem).find("."+g).remove()},D.prototype.setBtnStatus=function(e,t,a){var n,i=this,l=i.config,r=i.lang(),o=lay(i.footer).find(p);l.range&&"time"!==l.type&&(t=t||l.dateTime,a=a||i.endDate,n=i.newDate(t).getTime()>i.newDate(a).getTime(),i.limit(null,t)||i.limit(null,a)?o.addClass(d):o[n?"addClass":"removeClass"](d),e&&n&&i.hint("string"==typeof e?r.timeout.replace(/\u65e5\u671f/g,e):r.timeout))},D.prototype.parse=function(e,t){var a=this,n=a.config,i=t||("end"==e?lay.extend({},a.endDate,a.endTime):n.range?lay.extend({},n.dateTime,a.startTime):n.dateTime),r=l.parse(i,a.format,1);return n.range&&void 0===e?r+" "+a.rangeStr+" "+a.parse("end"):r},D.prototype.newDate=function(e){return e=e||{},new Date(e.year||1,e.month||0,e.date||1,e.hours||0,e.minutes||0,e.seconds||0)},D.prototype.setValue=function(e){var t=this,a=t.config,n=t.bindElem||a.elem[0];return"static"===a.position?t:(e=e||"",t.isInput(n)?lay(n).val(e):t.rangeElem?(t.rangeElem[0].val(e?t.parse("start"):""),t.rangeElem[1].val(e?t.parse("end"):"")):(0===lay(n).find("*").length&&lay(n).html(e),lay(n).attr("lay-date",e)),t)},D.prototype.preview=function(){var e=this,t=e.config;if(t.isPreview){var a=lay(e.elem).find("."+T),n=t.range?e.endDate?e.parse():"":e.parse();a.html(n).css({color:"#5FB878"}),setTimeout(function(){a.css({color:"#666"})},300)}},D.prototype.done=function(e,t){var a=this,n=a.config,i=lay.extend({},lay.extend(n.dateTime,a.startTime)),l=lay.extend({},lay.extend(a.endDate,a.endTime));return lay.each([i,l],function(e,t){"month"in t&&lay.extend(t,{month:t.month+1})}),a.preview(),e=e||[a.parse(),i,l],"function"==typeof n[t||"done"]&&n[t||"done"].apply(n,e),a},D.prototype.choose=function(e,t){var a=this,n=a.config,i=a.thisDateTime(t),l=(lay(a.elem).find("td"),e.attr("lay-ymd").split("-"));l={year:0|l[0],month:(0|l[1])-1,date:0|l[2]},e.hasClass(d)||(lay.extend(i,l),n.range?(lay.each(["startTime","endTime"],function(e,t){a[t]=a[t]||{hours:0,minutes:0,seconds:0}}),a.calendar(null,t).done(null,"change")):"static"===n.position?a.calendar().done().done(null,"change"):"date"===n.type?a.setValue(a.parse()).remove().done():"datetime"===n.type&&a.calendar().done(null,"change"))},D.prototype.tool=function(e,t){var a=this,n=a.config,i=a.lang(),l=n.dateTime,r="static"===n.position,o={datetime:function(){lay(e).hasClass(d)||(a.list("time",0),n.range&&a.list("time",1),lay(e).attr("lay-type","date").html(a.lang().dateTips))},date:function(){a.closeList(),lay(e).attr("lay-type","datetime").html(a.lang().timeTips)},clear:function(){r&&(lay.extend(l,a.firstDate),a.calendar()),n.range&&(delete n.dateTime,delete a.endDate,delete a.startTime,delete a.endTime),a.setValue("").remove(),a.done(["",{},{}])},now:function(){var e=new Date;lay.extend(l,a.systemDate(),{hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds()}),a.setValue(a.parse()).remove(),r&&a.calendar(),a.done()},confirm:function(){if(n.range){if(lay(e).hasClass(d))return a.hint("time"===n.type?i.timeout.replace(/\u65e5\u671f/g,"\u65f6\u95f4"):i.timeout)}else if(lay(e).hasClass(d))return a.hint(i.invalidDate);a.done(),a.setValue(a.parse()).remove()}};o[t]&&o[t]()},D.prototype.change=function(e){var t=this,a=t.config,n=t.thisDateTime(e),i=a.range&&("year"===a.type||"month"===a.type),l=t.elemCont[e||0],r=t.listYM[e],o=function(o){var s=lay(l).find(".laydate-year-list")[0],y=lay(l).find(".laydate-month-list")[0];return s&&(r[0]=o?r[0]-15:r[0]+15,t.list("year",e)),y&&(o?r[0]--:r[0]++,t.list("month",e)),(s||y)&&(lay.extend(n,{year:r[0]}),i&&(n.year=r[0]),a.range||t.done(null,"change"),a.range||t.limit(lay(t.footer).find(p),{year:r[0]})),t.setBtnStatus(),s||y};return{prevYear:function(){o("sub")||(n.year--,t.checkDate("limit").calendar(null,e),t.done(null,"change"))},prevMonth:function(){var a=t.getAsYM(n.year,n.month,"sub");lay.extend(n,{year:a[0],month:a[1]}),t.checkDate("limit").calendar(null,e),t.done(null,"change")},nextMonth:function(){var a=t.getAsYM(n.year,n.month);lay.extend(n,{year:a[0],month:a[1]}),t.checkDate("limit").calendar(null,e),t.done(null,"change")},nextYear:function(){o()||(n.year++,t.checkDate("limit").calendar(null,e),t.done(null,"change"))}}},D.prototype.changeEvent=function(){var e=this;e.config;lay(e.elem).on("click",function(e){lay.stope(e)}).on("mousedown",function(e){lay.stope(e)}),lay.each(e.elemHeader,function(t,a){lay(a[0]).on("click",function(a){e.change(t).prevYear()}),lay(a[1]).on("click",function(a){e.change(t).prevMonth()}),lay(a[2]).find("span").on("click",function(a){var n=lay(this),i=n.attr("lay-ym"),l=n.attr("lay-type");i&&(i=i.split("-"),e.listYM[t]=[0|i[0],0|i[1]],e.list(l,t),lay(e.footer).find("."+v).addClass(d))}),lay(a[3]).on("click",function(a){e.change(t).nextMonth()}),lay(a[4]).on("click",function(a){e.change(t).nextYear()})}),lay.each(e.table,function(t,a){var n=lay(a).find("td");n.on("click",function(){e.choose(lay(this),t)})}),lay(e.footer).find("span").on("click",function(){var t=lay(this).attr("lay-type");e.tool(this,t)})},D.prototype.isInput=function(e){return/input|textarea/.test(e.tagName.toLocaleLowerCase())},D.prototype.events=function(){var e=this,t=e.config,a=function(a,n){a.on(t.trigger,function(){n&&(e.bindElem=this),e.render()})};t.elem[0]&&!t.elem[0].eventHandler&&(a(t.elem,"bind"),a(t.eventElem),t.elem[0].eventHandler=!0)},r.that={},r.getThis=function(e){var t=r.that[e];return!t&&a&&layui.hint().error(e?o+" instance with ID '"+e+"' not found":"ID argument required"),t},n.run=function(a){a(t).on("mousedown",function(e){if(l.thisId){var t=r.getThis(l.thisId);if(t){var n=t.config;e.target!==n.elem[0]&&e.target!==n.eventElem[0]&&e.target!==a(n.closeStop)[0]&&t.remove()}}}).on("keydown",function(e){if(l.thisId){var t=r.getThis(l.thisId);t&&13===e.keyCode&&a("#"+t.elemID)[0]&&t.elemID===D.thisElemDate&&(e.preventDefault(),a(t.footer).find(p)[0].click())}}),a(e).on("resize",function(){if(l.thisId){var e=r.getThis(l.thisId);if(e)return!(!e.elem||!a(s)[0])&&void e.position()}})},l.render=function(e){var t=new D(e);return r.call(t)},l.parse=function(e,t,a){return e=e||{},"string"==typeof t&&(t=r.formatArr(t)),t=(t||[]).concat(),lay.each(t,function(n,i){/yyyy|y/.test(i)?t[n]=lay.digit(e.year,i.length):/MM|M/.test(i)?t[n]=lay.digit(e.month+(a||0),i.length):/dd|d/.test(i)?t[n]=lay.digit(e.date,i.length):/HH|H/.test(i)?t[n]=lay.digit(e.hours,i.length):/mm|m/.test(i)?t[n]=lay.digit(e.minutes,i.length):/ss|s/.test(i)&&(t[n]=lay.digit(e.seconds,i.length))}),t.join("")},l.getEndDate=function(e,t){var a=new Date;return a.setFullYear(t||a.getFullYear(),e||a.getMonth()+1,1),new Date(a.getTime()-864e5).getDate()},a?(l.ready(),layui.define("lay",function(e){l.path=layui.cache.dir,n.run(lay),e(o,l)})):"function"==typeof define&&define.amd?define(function(){return n.run(lay),l}):function(){l.ready(),n.run(e.lay),e.laydate=l}()}(window,window.document);!function(e,t){"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t=!!e&&"length"in e&&e.length,n=pe.type(e);return"function"!==n&&!pe.isWindow(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function r(e,t,n){if(pe.isFunction(t))return pe.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return pe.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(Ce.test(t))return pe.filter(t,e,n);t=pe.filter(t,e)}return pe.grep(e,function(e){return pe.inArray(e,t)>-1!==n})}function i(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function o(e){var t={};return pe.each(e.match(De)||[],function(e,n){t[n]=!0}),t}function a(){re.addEventListener?(re.removeEventListener("DOMContentLoaded",s),e.removeEventListener("load",s)):(re.detachEvent("onreadystatechange",s),e.detachEvent("onload",s))}function s(){(re.addEventListener||"load"===e.event.type||"complete"===re.readyState)&&(a(),pe.ready())}function u(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(_e,"-$1").toLowerCase();if(n=e.getAttribute(r),"string"==typeof n){try{n="true"===n||"false"!==n&&("null"===n?null:+n+""===n?+n:qe.test(n)?pe.parseJSON(n):n)}catch(i){}pe.data(e,t,n)}else n=void 0}return n}function l(e){var t;for(t in e)if(("data"!==t||!pe.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function c(e,t,n,r){if(He(e)){var i,o,a=pe.expando,s=e.nodeType,u=s?pe.cache:e,l=s?e[a]:e[a]&&a;if(l&&u[l]&&(r||u[l].data)||void 0!==n||"string"!=typeof t)return l||(l=s?e[a]=ne.pop()||pe.guid++:a),u[l]||(u[l]=s?{}:{toJSON:pe.noop}),"object"!=typeof t&&"function"!=typeof t||(r?u[l]=pe.extend(u[l],t):u[l].data=pe.extend(u[l].data,t)),o=u[l],r||(o.data||(o.data={}),o=o.data),void 0!==n&&(o[pe.camelCase(t)]=n),"string"==typeof t?(i=o[t],null==i&&(i=o[pe.camelCase(t)])):i=o,i}}function f(e,t,n){if(He(e)){var r,i,o=e.nodeType,a=o?pe.cache:e,s=o?e[pe.expando]:pe.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){pe.isArray(t)?t=t.concat(pe.map(t,pe.camelCase)):t in r?t=[t]:(t=pe.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;for(;i--;)delete r[t[i]];if(n?!l(r):!pe.isEmptyObject(r))return}(n||(delete a[s].data,l(a[s])))&&(o?pe.cleanData([e],!0):fe.deleteExpando||a!=a.window?delete a[s]:a[s]=void 0)}}}function d(e,t,n,r){var i,o=1,a=20,s=r?function(){return r.cur()}:function(){return pe.css(e,t,"")},u=s(),l=n&&n[3]||(pe.cssNumber[t]?"":"px"),c=(pe.cssNumber[t]||"px"!==l&&+u)&&Me.exec(pe.css(e,t));if(c&&c[3]!==l){l=l||c[3],n=n||[],c=+u||1;do o=o||".5",c/=o,pe.style(e,t,c+l);while(o!==(o=s()/u)&&1!==o&&--a)}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}function p(e){var t=ze.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function h(e,t){var n,r,i=0,o="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(r=n[i]);i++)!t||pe.nodeName(r,t)?o.push(r):pe.merge(o,h(r,t));return void 0===t||t&&pe.nodeName(e,t)?pe.merge([e],o):o}function g(e,t){for(var n,r=0;null!=(n=e[r]);r++)pe._data(n,"globalEval",!t||pe._data(t[r],"globalEval"))}function m(e){Be.test(e.type)&&(e.defaultChecked=e.checked)}function y(e,t,n,r,i){for(var o,a,s,u,l,c,f,d=e.length,y=p(t),v=[],x=0;x"!==f[1]||Ve.test(a)?0:u:u.firstChild,o=a&&a.childNodes.length;o--;)pe.nodeName(c=a.childNodes[o],"tbody")&&!c.childNodes.length&&a.removeChild(c);for(pe.merge(v,u.childNodes),u.textContent="";u.firstChild;)u.removeChild(u.firstChild);u=y.lastChild}else v.push(t.createTextNode(a));for(u&&y.removeChild(u),fe.appendChecked||pe.grep(h(v,"input"),m),x=0;a=v[x++];)if(r&&pe.inArray(a,r)>-1)i&&i.push(a);else if(s=pe.contains(a.ownerDocument,a),u=h(y.appendChild(a),"script"),s&&g(u),n)for(o=0;a=u[o++];)Ie.test(a.type||"")&&n.push(a);return u=null,y}function v(){return!0}function x(){return!1}function b(){try{return re.activeElement}catch(e){}}function w(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)w(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),i===!1)i=x;else if(!i)return e;return 1===o&&(a=i,i=function(e){return pe().off(e),a.apply(this,arguments)},i.guid=a.guid||(a.guid=pe.guid++)),e.each(function(){pe.event.add(this,t,i,r,n)})}function T(e,t){return pe.nodeName(e,"table")&&pe.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function C(e){return e.type=(null!==pe.find.attr(e,"type"))+"/"+e.type,e}function E(e){var t=it.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function N(e,t){if(1===t.nodeType&&pe.hasData(e)){var n,r,i,o=pe._data(e),a=pe._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;r1&&"string"==typeof p&&!fe.checkClone&&rt.test(p))return e.each(function(i){var o=e.eq(i);g&&(t[0]=p.call(this,i,o.html())),S(o,t,n,r)});if(f&&(l=y(t,e[0].ownerDocument,!1,e,r),i=l.firstChild,1===l.childNodes.length&&(l=i),i||r)){for(s=pe.map(h(l,"script"),C),a=s.length;c")).appendTo(t.documentElement),t=(ut[0].contentWindow||ut[0].contentDocument).document,t.write(),t.close(),n=D(e,t),ut.detach()),lt[e]=n),n}function L(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function H(e){if(e in Et)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=Ct.length;n--;)if(e=Ct[n]+t,e in Et)return e}function q(e,t){for(var n,r,i,o=[],a=0,s=e.length;a=0&&n=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==pe.type(e)||e.nodeType||pe.isWindow(e))return!1;try{if(e.constructor&&!ce.call(e,"constructor")&&!ce.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}if(!fe.ownFirst)for(t in e)return ce.call(e,t);for(t in e);return void 0===t||ce.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?ue[le.call(e)]||"object":typeof e},globalEval:function(t){t&&pe.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(ge,"ms-").replace(me,ye)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var r,i=0;if(n(e))for(r=e.length;iT.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[P]=!0,e}function i(e){var t=H.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=n.length;r--;)T.attrHandle[n[r]]=t}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||V)-(~e.sourceIndex||V);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function u(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function l(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function c(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function f(){}function d(e){for(var t=0,n=e.length,r="";t1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function g(e,n,r){for(var i=0,o=n.length;i-1&&(r[l]=!(a[l]=f))}}else x=m(x===a?x.splice(h,x.length):x),o?o(null,a,x,u):Q.apply(a,x)})}function v(e){for(var t,n,r,i=e.length,o=T.relative[e[0].type],a=o||T.relative[" "],s=o?1:0,u=p(function(e){return e===t},a,!0),l=p(function(e){return ee(t,e)>-1},a,!0),c=[function(e,n,r){var i=!o&&(r||n!==A)||((t=n).nodeType?u(e,n,r):l(e,n,r));return t=null,i}];s1&&h(c),s>1&&d(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(se,"$1"),n,s0,o=e.length>0,a=function(r,a,s,u,l){var c,f,d,p=0,h="0",g=r&&[],y=[],v=A,x=r||o&&T.find.TAG("*",l),b=W+=null==v?1:Math.random()||.1,w=x.length;for(l&&(A=a===H||a||l);h!==w&&null!=(c=x[h]);h++){if(o&&c){for(f=0,a||c.ownerDocument===H||(L(c),s=!_);d=e[f++];)if(d(c,a||H,s)){u.push(c);break}l&&(W=b)}i&&((c=!d&&c)&&p--,r&&g.push(c))}if(p+=h,i&&h!==p){for(f=0;d=n[f++];)d(g,y,a,s);if(r){if(p>0)for(;h--;)g[h]||y[h]||(y[h]=G.call(u));y=m(y)}Q.apply(u,y),l&&!r&&y.length>0&&p+n.length>1&&t.uniqueSort(u)}return l&&(W=b,A=v),g};return i?r(a):a}var b,w,T,C,E,N,k,S,A,D,j,L,H,q,_,F,M,O,R,P="sizzle"+1*new Date,B=e.document,W=0,I=0,$=n(),z=n(),X=n(),U=function(e,t){return e===t&&(j=!0),0},V=1<<31,Y={}.hasOwnProperty,J=[],G=J.pop,K=J.push,Q=J.push,Z=J.slice,ee=function(e,t){for(var n=0,r=e.length;n+~]|"+ne+")"+ne+"*"),ce=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),fe=new RegExp(oe),de=new RegExp("^"+re+"$"),pe={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re+"|[*])"),ATTR:new RegExp("^"+ie),PSEUDO:new RegExp("^"+oe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},he=/^(?:input|select|textarea|button)$/i,ge=/^h\d$/i,me=/^[^{]+\{\s*\[native \w/,ye=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ve=/[+~]/,xe=/'|\\/g,be=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),we=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},Te=function(){L()};try{Q.apply(J=Z.call(B.childNodes),B.childNodes),J[B.childNodes.length].nodeType}catch(Ce){Q={apply:J.length?function(e,t){K.apply(e,Z.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}w=t.support={},E=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},L=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:B;return r!==H&&9===r.nodeType&&r.documentElement?(H=r,q=H.documentElement,_=!E(H),(n=H.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Te,!1):n.attachEvent&&n.attachEvent("onunload",Te)),w.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),w.getElementsByTagName=i(function(e){return e.appendChild(H.createComment("")),!e.getElementsByTagName("*").length}),w.getElementsByClassName=me.test(H.getElementsByClassName),w.getById=i(function(e){return q.appendChild(e).id=P,!H.getElementsByName||!H.getElementsByName(P).length}),w.getById?(T.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&_){var n=t.getElementById(e);return n?[n]:[]}},T.filter.ID=function(e){var t=e.replace(be,we);return function(e){return e.getAttribute("id")===t}}):(delete T.find.ID,T.filter.ID=function(e){var t=e.replace(be,we);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),T.find.TAG=w.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):w.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},T.find.CLASS=w.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&_)return t.getElementsByClassName(e)},M=[],F=[],(w.qsa=me.test(H.querySelectorAll))&&(i(function(e){q.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&F.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||F.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+P+"-]").length||F.push("~="),e.querySelectorAll(":checked").length||F.push(":checked"),e.querySelectorAll("a#"+P+"+*").length||F.push(".#.+[+~]")}),i(function(e){var t=H.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&F.push("name"+ne+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||F.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),F.push(",.*:")})),(w.matchesSelector=me.test(O=q.matches||q.webkitMatchesSelector||q.mozMatchesSelector||q.oMatchesSelector||q.msMatchesSelector))&&i(function(e){w.disconnectedMatch=O.call(e,"div"),O.call(e,"[s!='']:x"),M.push("!=",oe)}),F=F.length&&new RegExp(F.join("|")),M=M.length&&new RegExp(M.join("|")),t=me.test(q.compareDocumentPosition),R=t||me.test(q.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},U=t?function(e,t){if(e===t)return j=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!w.sortDetached&&t.compareDocumentPosition(e)===n?e===H||e.ownerDocument===B&&R(B,e)?-1:t===H||t.ownerDocument===B&&R(B,t)?1:D?ee(D,e)-ee(D,t):0:4&n?-1:1)}:function(e,t){if(e===t)return j=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],u=[t];if(!i||!o)return e===H?-1:t===H?1:i?-1:o?1:D?ee(D,e)-ee(D,t):0;if(i===o)return a(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;s[r]===u[r];)r++;return r?a(s[r],u[r]):s[r]===B?-1:u[r]===B?1:0},H):H},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==H&&L(e),n=n.replace(ce,"='$1']"),w.matchesSelector&&_&&!X[n+" "]&&(!M||!M.test(n))&&(!F||!F.test(n)))try{var r=O.call(e,n);if(r||w.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return t(n,H,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==H&&L(e),R(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==H&&L(e);var n=T.attrHandle[t.toLowerCase()],r=n&&Y.call(T.attrHandle,t.toLowerCase())?n(e,t,!_):void 0;return void 0!==r?r:w.attributes||!_?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(j=!w.detectDuplicates,D=!w.sortStable&&e.slice(0),e.sort(U),j){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return D=null,e},C=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=C(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=C(t);return n},T=t.selectors={cacheLength:50,createPseudo:r,match:pe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(be,we),e[3]=(e[3]||e[4]||e[5]||"").replace(be,we),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return pe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&fe.test(n)&&(t=N(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(be,we).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=$[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&$(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(i){var o=t.attr(i,e);return null==o?"!="===n:!n||(o+="","="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o.replace(ae," ")+" ").indexOf(r)>-1:"|="===n&&(o===r||o.slice(0,r.length+1)===r+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,d,p,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s,x=!1;if(m){if(o){for(;g;){for(d=t;d=d[g];)if(s?d.nodeName.toLowerCase()===y:1===d.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){for(d=m,f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),l=c[e]||[],p=l[0]===W&&l[1],x=p&&l[2], +d=p&&m.childNodes[p];d=++p&&d&&d[g]||(x=p=0)||h.pop();)if(1===d.nodeType&&++x&&d===t){c[e]=[W,p,x];break}}else if(v&&(d=t,f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),l=c[e]||[],p=l[0]===W&&l[1],x=p),x===!1)for(;(d=++p&&d&&d[g]||(x=p=0)||h.pop())&&((s?d.nodeName.toLowerCase()!==y:1!==d.nodeType)||!++x||(v&&(f=d[P]||(d[P]={}),c=f[d.uniqueID]||(f[d.uniqueID]={}),c[e]=[W,x]),d!==t)););return x-=i,x===r||x%r===0&&x/r>=0}}},PSEUDO:function(e,n){var i,o=T.pseudos[e]||T.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[P]?o(n):o.length>1?(i=[e,e,"",n],T.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,i=o(e,n),a=i.length;a--;)r=ee(e,i[a]),e[r]=!(t[r]=i[a])}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=k(e.replace(se,"$1"));return i[P]?r(function(e,t,n,r){for(var o,a=i(e,null,r,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,r,o){return t[0]=e,i(t,null,o,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(be,we),function(t){return(t.textContent||t.innerText||C(t)).indexOf(e)>-1}}),lang:r(function(e){return de.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(be,we).toLowerCase(),function(t){var n;do if(n=_?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===q},focus:function(e){return e===H.activeElement&&(!H.hasFocus||H.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!T.pseudos.empty(e)},header:function(e){return ge.test(e.nodeName)},input:function(e){return he.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:l(function(){return[0]}),last:l(function(e,t){return[t-1]}),eq:l(function(e,t,n){return[n<0?n+t:n]}),even:l(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:l(function(e,t,n){for(var r=n<0?n+t:n;++r2&&"ID"===(a=o[0]).type&&w.getById&&9===t.nodeType&&_&&T.relative[o[1].type]){if(t=(T.find.ID(a.matches[0].replace(be,we),t)||[])[0],!t)return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=pe.needsContext.test(e)?0:o.length;i--&&(a=o[i],!T.relative[s=a.type]);)if((u=T.find[s])&&(r=u(a.matches[0].replace(be,we),ve.test(o[0].type)&&c(t.parentNode)||t))){if(o.splice(i,1),e=r.length&&d(o),!e)return Q.apply(n,r),n;break}}return(l||k(e,f))(r,t,!_,n,!t||ve.test(e)&&c(t.parentNode)||t),n},w.sortStable=P.split("").sort(U).join("")===P,w.detectDuplicates=!!j,L(),w.sortDetached=i(function(e){return 1&e.compareDocumentPosition(H.createElement("div"))}),i(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),w.attributes&&i(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(te,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(e);pe.find=ve,pe.expr=ve.selectors,pe.expr[":"]=pe.expr.pseudos,pe.uniqueSort=pe.unique=ve.uniqueSort,pe.text=ve.getText,pe.isXMLDoc=ve.isXML,pe.contains=ve.contains;var xe=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&pe(e).is(n))break;r.push(e)}return r},be=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},we=pe.expr.match.needsContext,Te=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,Ce=/^.[^:#\[\.,]*$/;pe.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?pe.find.matchesSelector(r,e)?[r]:[]:pe.find.matches(e,pe.grep(t,function(e){return 1===e.nodeType}))},pe.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(pe(e).filter(function(){for(t=0;t1?pe.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},filter:function(e){return this.pushStack(r(this,e||[],!1))},not:function(e){return this.pushStack(r(this,e||[],!0))},is:function(e){return!!r(this,"string"==typeof e&&we.test(e)?pe(e):e||[],!1).length}});var Ee,Ne=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,ke=pe.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||Ee,"string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:Ne.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof pe?t[0]:t,pe.merge(this,pe.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:re,!0)),Te.test(r[1])&&pe.isPlainObject(t))for(r in t)pe.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}if(i=re.getElementById(r[2]),i&&i.parentNode){if(i.id!==r[2])return Ee.find(e);this.length=1,this[0]=i}return this.context=re,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):pe.isFunction(e)?"undefined"!=typeof n.ready?n.ready(e):e(pe):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),pe.makeArray(e,this))};ke.prototype=pe.fn,Ee=pe(re);var Se=/^(?:parents|prev(?:Until|All))/,Ae={children:!0,contents:!0,next:!0,prev:!0};pe.fn.extend({has:function(e){var t,n=pe(e,this),r=n.length;return this.filter(function(){for(t=0;t-1:1===n.nodeType&&pe.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?pe.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?pe.inArray(this[0],pe(e)):pe.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(pe.uniqueSort(pe.merge(this.get(),pe(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),pe.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return xe(e,"parentNode")},parentsUntil:function(e,t,n){return xe(e,"parentNode",n)},next:function(e){return i(e,"nextSibling")},prev:function(e){return i(e,"previousSibling")},nextAll:function(e){return xe(e,"nextSibling")},prevAll:function(e){return xe(e,"previousSibling")},nextUntil:function(e,t,n){return xe(e,"nextSibling",n)},prevUntil:function(e,t,n){return xe(e,"previousSibling",n)},siblings:function(e){return be((e.parentNode||{}).firstChild,e)},children:function(e){return be(e.firstChild)},contents:function(e){return pe.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:pe.merge([],e.childNodes)}},function(e,t){pe.fn[e]=function(n,r){var i=pe.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=pe.filter(r,i)),this.length>1&&(Ae[e]||(i=pe.uniqueSort(i)),Se.test(e)&&(i=i.reverse())),this.pushStack(i)}});var De=/\S+/g;pe.Callbacks=function(e){e="string"==typeof e?o(e):pe.extend({},e);var t,n,r,i,a=[],s=[],u=-1,l=function(){for(i=e.once,r=t=!0;s.length;u=-1)for(n=s.shift();++u-1;)a.splice(n,1),n<=u&&u--}),this},has:function(e){return e?pe.inArray(e,a)>-1:a.length>0},empty:function(){return a&&(a=[]),this},disable:function(){return i=s=[],a=n="",this},disabled:function(){return!a},lock:function(){return i=!0,n||c.disable(),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=n||[],n=[e,n.slice?n.slice():n],s.push(n),t||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},pe.extend({Deferred:function(e){var t=[["resolve","done",pe.Callbacks("once memory"),"resolved"],["reject","fail",pe.Callbacks("once memory"),"rejected"],["notify","progress",pe.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return pe.Deferred(function(n){pe.each(t,function(t,o){var a=pe.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&pe.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[o[0]+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?pe.extend(e,r):r}},i={};return r.pipe=r.then,pe.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,i=0,o=ie.call(arguments),a=o.length,s=1!==a||e&&pe.isFunction(e.promise)?a:0,u=1===s?e:pe.Deferred(),l=function(e,n,r){return function(i){n[e]=this,r[e]=arguments.length>1?ie.call(arguments):i,r===t?u.notifyWith(n,r):--s||u.resolveWith(n,r)}};if(a>1)for(t=new Array(a),n=new Array(a),r=new Array(a);i0||(je.resolveWith(re,[pe]),pe.fn.triggerHandler&&(pe(re).triggerHandler("ready"),pe(re).off("ready"))))}}),pe.ready.promise=function(t){if(!je)if(je=pe.Deferred(),"complete"===re.readyState||"loading"!==re.readyState&&!re.documentElement.doScroll)e.setTimeout(pe.ready);else if(re.addEventListener)re.addEventListener("DOMContentLoaded",s),e.addEventListener("load",s);else{re.attachEvent("onreadystatechange",s),e.attachEvent("onload",s);var n=!1;try{n=null==e.frameElement&&re.documentElement}catch(r){}n&&n.doScroll&&!function i(){if(!pe.isReady){try{n.doScroll("left")}catch(t){return e.setTimeout(i,50)}a(),pe.ready()}}()}return je.promise(t)},pe.ready.promise();var Le;for(Le in pe(fe))break;fe.ownFirst="0"===Le,fe.inlineBlockNeedsLayout=!1,pe(function(){var e,t,n,r;n=re.getElementsByTagName("body")[0],n&&n.style&&(t=re.createElement("div"),r=re.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),"undefined"!=typeof t.style.zoom&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",fe.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(r))}),function(){var e=re.createElement("div");fe.deleteExpando=!0;try{delete e.test}catch(t){fe.deleteExpando=!1}e=null}();var He=function(e){var t=pe.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return(1===n||9===n)&&(!t||t!==!0&&e.getAttribute("classid")===t)},qe=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,_e=/([A-Z])/g;pe.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?pe.cache[e[pe.expando]]:e[pe.expando],!!e&&!l(e)},data:function(e,t,n){return c(e,t,n)},removeData:function(e,t){return f(e,t)},_data:function(e,t,n){return c(e,t,n,!0)},_removeData:function(e,t){return f(e,t,!0)}}),pe.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=pe.data(o),1===o.nodeType&&!pe._data(o,"parsedAttrs"))){for(n=a.length;n--;)a[n]&&(r=a[n].name,0===r.indexOf("data-")&&(r=pe.camelCase(r.slice(5)),u(o,r,i[r])));pe._data(o,"parsedAttrs",!0)}return i}return"object"==typeof e?this.each(function(){pe.data(this,e)}):arguments.length>1?this.each(function(){pe.data(this,e,t)}):o?u(o,e,pe.data(o,e)):void 0},removeData:function(e){return this.each(function(){pe.removeData(this,e)})}}),pe.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=pe._data(e,t),n&&(!r||pe.isArray(n)?r=pe._data(e,t,pe.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=pe.queue(e,t),r=n.length,i=n.shift(),o=pe._queueHooks(e,t),a=function(){pe.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return pe._data(e,n)||pe._data(e,n,{empty:pe.Callbacks("once memory").add(function(){pe._removeData(e,t+"queue"),pe._removeData(e,n)})})}}),pe.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length
          a",fe.leadingWhitespace=3===e.firstChild.nodeType,fe.tbody=!e.getElementsByTagName("tbody").length,fe.htmlSerialize=!!e.getElementsByTagName("link").length,fe.html5Clone="<:nav>"!==re.createElement("nav").cloneNode(!0).outerHTML,n.type="checkbox",n.checked=!0,t.appendChild(n),fe.appendChecked=n.checked,e.innerHTML="",fe.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue,t.appendChild(e),n=re.createElement("input"),n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),e.appendChild(n),fe.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,fe.noCloneEvent=!!e.addEventListener,e[pe.expando]=1,fe.attributes=!e.getAttribute(pe.expando)}();var Xe={option:[1,""],legend:[1,"
          ","
          "],area:[1,"",""],param:[1,"",""],thead:[1,"","
          "],tr:[2,"","
          "],col:[2,"","
          "],td:[3,"","
          "],_default:fe.htmlSerialize?[0,"",""]:[1,"X
          ","
          "]};Xe.optgroup=Xe.option,Xe.tbody=Xe.tfoot=Xe.colgroup=Xe.caption=Xe.thead,Xe.th=Xe.td;var Ue=/<|&#?\w+;/,Ve=/-1&&(h=p.split("."),p=h.shift(),h.sort()),a=p.indexOf(":")<0&&"on"+p,t=t[pe.expando]?t:new pe.Event(p,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=h.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:pe.makeArray(n,[t]),l=pe.event.special[p]||{},i||!l.trigger||l.trigger.apply(r,n)!==!1)){if(!i&&!l.noBubble&&!pe.isWindow(r)){for(u=l.delegateType||p,Ke.test(u+p)||(s=s.parentNode);s;s=s.parentNode)d.push(s),c=s;c===(r.ownerDocument||re)&&d.push(c.defaultView||c.parentWindow||e)}for(f=0;(s=d[f++])&&!t.isPropagationStopped();)t.type=f>1?u:l.bindType||p,o=(pe._data(s,"events")||{})[t.type]&&pe._data(s,"handle"),o&&o.apply(s,n),o=a&&s[a],o&&o.apply&&He(s)&&(t.result=o.apply(s,n),t.result===!1&&t.preventDefault());if(t.type=p,!i&&!t.isDefaultPrevented()&&(!l._default||l._default.apply(d.pop(),n)===!1)&&He(r)&&a&&r[p]&&!pe.isWindow(r)){c=r[a],c&&(r[a]=null),pe.event.triggered=p;try{r[p]()}catch(g){}pe.event.triggered=void 0,c&&(r[a]=c)}return t.result}},dispatch:function(e){e=pe.event.fix(e);var t,n,r,i,o,a=[],s=ie.call(arguments),u=(pe._data(this,"events")||{})[e.type]||[],l=pe.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,e)!==!1){for(a=pe.event.handlers.call(this,e,u),t=0;(i=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=i.elem,n=0;(o=i.handlers[n++])&&!e.isImmediatePropagationStopped();)e.rnamespace&&!e.rnamespace.test(o.namespace)||(e.handleObj=o,e.data=o.data,r=((pe.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s),void 0!==r&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()));return l.postDispatch&&l.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,a=[],s=t.delegateCount,u=e.target;if(s&&u.nodeType&&("click"!==e.type||isNaN(e.button)||e.button<1))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(r=[],n=0;n-1:pe.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&a.push({elem:u,handlers:r})}return s]","i"),tt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,nt=/\s*$/g,at=p(re),st=at.appendChild(re.createElement("div"));pe.extend({htmlPrefilter:function(e){return e.replace(tt,"<$1>")},clone:function(e,t,n){var r,i,o,a,s,u=pe.contains(e.ownerDocument,e);if(fe.html5Clone||pe.isXMLDoc(e)||!et.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(st.innerHTML=e.outerHTML,st.removeChild(o=st.firstChild)),!(fe.noCloneEvent&&fe.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||pe.isXMLDoc(e)))for(r=h(o),s=h(e),a=0;null!=(i=s[a]);++a)r[a]&&k(i,r[a]);if(t)if(n)for(s=s||h(e),r=r||h(o),a=0;null!=(i=s[a]);a++)N(i,r[a]);else N(e,o);return r=h(o,"script"),r.length>0&&g(r,!u&&h(e,"script")),r=s=i=null,o},cleanData:function(e,t){for(var n,r,i,o,a=0,s=pe.expando,u=pe.cache,l=fe.attributes,c=pe.event.special;null!=(n=e[a]);a++)if((t||He(n))&&(i=n[s],o=i&&u[i])){if(o.events)for(r in o.events)c[r]?pe.event.remove(n,r):pe.removeEvent(n,r,o.handle);u[i]&&(delete u[i],l||"undefined"==typeof n.removeAttribute?n[s]=void 0:n.removeAttribute(s),ne.push(i))}}}),pe.fn.extend({domManip:S,detach:function(e){return A(this,e,!0)},remove:function(e){return A(this,e)},text:function(e){return Pe(this,function(e){return void 0===e?pe.text(this):this.empty().append((this[0]&&this[0].ownerDocument||re).createTextNode(e))},null,e,arguments.length)},append:function(){return S(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=T(this,e);t.appendChild(e)}})},prepend:function(){return S(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=T(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return S(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return S(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&pe.cleanData(h(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&pe.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return pe.clone(this,e,t)})},html:function(e){return Pe(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e)return 1===t.nodeType?t.innerHTML.replace(Ze,""):void 0;if("string"==typeof e&&!nt.test(e)&&(fe.htmlSerialize||!et.test(e))&&(fe.leadingWhitespace||!$e.test(e))&&!Xe[(We.exec(e)||["",""])[1].toLowerCase()]){e=pe.htmlPrefilter(e);try{for(;nt",l.childNodes[0].style.borderCollapse="separate",t=l.getElementsByTagName("td"),t[0].style.cssText="margin:0;border:0;padding:0;display:none",o=0===t[0].offsetHeight,o&&(t[0].style.display="",t[1].style.display="none",o=0===t[0].offsetHeight)),f.removeChild(u)}var n,r,i,o,a,s,u=re.createElement("div"),l=re.createElement("div");l.style&&(l.style.cssText="float:left;opacity:.5",fe.opacity="0.5"===l.style.opacity,fe.cssFloat=!!l.style.cssFloat,l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",fe.clearCloneStyle="content-box"===l.style.backgroundClip,u=re.createElement("div"),u.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",l.innerHTML="",u.appendChild(l),fe.boxSizing=""===l.style.boxSizing||""===l.style.MozBoxSizing||""===l.style.WebkitBoxSizing,pe.extend(fe,{reliableHiddenOffsets:function(){return null==n&&t(),o},boxSizingReliable:function(){return null==n&&t(),i},pixelMarginRight:function(){return null==n&&t(),r},pixelPosition:function(){return null==n&&t(),n},reliableMarginRight:function(){return null==n&&t(),a},reliableMarginLeft:function(){return null==n&&t(),s}}))}();var ht,gt,mt=/^(top|right|bottom|left)$/;e.getComputedStyle?(ht=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)},gt=function(e,t,n){var r,i,o,a,s=e.style;return n=n||ht(e),a=n?n.getPropertyValue(t)||n[t]:void 0,""!==a&&void 0!==a||pe.contains(e.ownerDocument,e)||(a=pe.style(e,t)),n&&!fe.pixelMarginRight()&&ft.test(a)&&ct.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o),void 0===a?a:a+""}):pt.currentStyle&&(ht=function(e){return e.currentStyle},gt=function(e,t,n){var r,i,o,a,s=e.style;return n=n||ht(e),a=n?n[t]:void 0,null==a&&s&&s[t]&&(a=s[t]),ft.test(a)&&!mt.test(t)&&(r=s.left,i=e.runtimeStyle,o=i&&i.left,o&&(i.left=e.currentStyle.left),s.left="fontSize"===t?"1em":a,a=s.pixelLeft+"px",s.left=r,o&&(i.left=o)),void 0===a?a:a+""||"auto"});var yt=/alpha\([^)]*\)/i,vt=/opacity\s*=\s*([^)]*)/i,xt=/^(none|table(?!-c[ea]).+)/,bt=new RegExp("^("+Fe+")(.*)$","i"),wt={position:"absolute",visibility:"hidden",display:"block"},Tt={letterSpacing:"0",fontWeight:"400"},Ct=["Webkit","O","Moz","ms"],Et=re.createElement("div").style;pe.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=gt(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":fe.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=pe.camelCase(t),u=e.style;if(t=pe.cssProps[s]||(pe.cssProps[s]=H(s)||s),a=pe.cssHooks[t]||pe.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:u[t];if(o=typeof n,"string"===o&&(i=Me.exec(n))&&i[1]&&(n=d(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(pe.cssNumber[s]?"":"px")),fe.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),!(a&&"set"in a&&void 0===(n=a.set(e,n,r)))))try{u[t]=n}catch(l){}}},css:function(e,t,n,r){var i,o,a,s=pe.camelCase(t);return t=pe.cssProps[s]||(pe.cssProps[s]=H(s)||s),a=pe.cssHooks[t]||pe.cssHooks[s],a&&"get"in a&&(o=a.get(e,!0,n)),void 0===o&&(o=gt(e,t,r)),"normal"===o&&t in Tt&&(o=Tt[t]),""===n||n?(i=parseFloat(o),n===!0||isFinite(i)?i||0:o):o}}),pe.each(["height","width"],function(e,t){pe.cssHooks[t]={get:function(e,n,r){if(n)return xt.test(pe.css(e,"display"))&&0===e.offsetWidth?dt(e,wt,function(){return M(e,t,r)}):M(e,t,r)},set:function(e,n,r){var i=r&&ht(e);return _(e,n,r?F(e,t,r,fe.boxSizing&&"border-box"===pe.css(e,"boxSizing",!1,i),i):0)}}}),fe.opacity||(pe.cssHooks.opacity={get:function(e,t){return vt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=pe.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===pe.trim(o.replace(yt,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=yt.test(o)?o.replace(yt,i):o+" "+i)}}),pe.cssHooks.marginRight=L(fe.reliableMarginRight,function(e,t){if(t)return dt(e,{display:"inline-block"},gt,[e,"marginRight"])}),pe.cssHooks.marginLeft=L(fe.reliableMarginLeft,function(e,t){if(t)return(parseFloat(gt(e,"marginLeft"))||(pe.contains(e.ownerDocument,e)?e.getBoundingClientRect().left-dt(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}):0))+"px"}),pe.each({margin:"",padding:"",border:"Width"},function(e,t){pe.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+Oe[r]+t]=o[r]||o[r-2]||o[0];return i}},ct.test(e)||(pe.cssHooks[e+t].set=_)}),pe.fn.extend({css:function(e,t){return Pe(this,function(e,t,n){var r,i,o={},a=0;if(pe.isArray(t)){for(r=ht(e),i=t.length;a1)},show:function(){return q(this,!0)},hide:function(){return q(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Re(this)?pe(this).show():pe(this).hide()})}}),pe.Tween=O,O.prototype={constructor:O,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||pe.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(pe.cssNumber[n]?"":"px")},cur:function(){var e=O.propHooks[this.prop];return e&&e.get?e.get(this):O.propHooks._default.get(this)},run:function(e){var t,n=O.propHooks[this.prop];return this.options.duration?this.pos=t=pe.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):O.propHooks._default.set(this),this}},O.prototype.init.prototype=O.prototype,O.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=pe.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){pe.fx.step[e.prop]?pe.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[pe.cssProps[e.prop]]&&!pe.cssHooks[e.prop]?e.elem[e.prop]=e.now:pe.style(e.elem,e.prop,e.now+e.unit)}}},O.propHooks.scrollTop=O.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},pe.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},pe.fx=O.prototype.init,pe.fx.step={};var Nt,kt,St=/^(?:toggle|show|hide)$/,At=/queueHooks$/;pe.Animation=pe.extend($,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return d(n.elem,e,Me.exec(t),n),n}]},tweener:function(e,t){pe.isFunction(e)?(t=e,e=["*"]):e=e.match(De);for(var n,r=0,i=e.length;r
          a",e=n.getElementsByTagName("a")[0],t.setAttribute("type","checkbox"),n.appendChild(t),e=n.getElementsByTagName("a")[0],e.style.cssText="top:1px",fe.getSetAttribute="t"!==n.className,fe.style=/top/.test(e.getAttribute("style")),fe.hrefNormalized="/a"===e.getAttribute("href"),fe.checkOn=!!t.value,fe.optSelected=i.selected,fe.enctype=!!re.createElement("form").enctype,r.disabled=!0,fe.optDisabled=!i.disabled,t=re.createElement("input"),t.setAttribute("value",""),fe.input=""===t.getAttribute("value"),t.value="t",t.setAttribute("type","radio"),fe.radioValue="t"===t.value}();var Dt=/\r/g,jt=/[\x20\t\r\n\f]+/g;pe.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=pe.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,pe(this).val()):e,null==i?i="":"number"==typeof i?i+="":pe.isArray(i)&&(i=pe.map(i,function(e){return null==e?"":e+""})),t=pe.valHooks[this.type]||pe.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return t=pe.valHooks[i.type]||pe.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(Dt,""):null==n?"":n)}}}),pe.extend({valHooks:{option:{get:function(e){var t=pe.find.attr(e,"value");return null!=t?t:pe.trim(pe.text(e)).replace(jt," ")}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||i<0,a=o?null:[],s=o?i+1:r.length,u=i<0?s:o?i:0;u-1)try{r.selected=n=!0}catch(s){r.scrollHeight}else r.selected=!1;return n||(e.selectedIndex=-1),i}}}}),pe.each(["radio","checkbox"],function(){pe.valHooks[this]={set:function(e,t){if(pe.isArray(t))return e.checked=pe.inArray(pe(e).val(),t)>-1}},fe.checkOn||(pe.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Lt,Ht,qt=pe.expr.attrHandle,_t=/^(?:checked|selected)$/i,Ft=fe.getSetAttribute,Mt=fe.input;pe.fn.extend({attr:function(e,t){return Pe(this,pe.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){pe.removeAttr(this,e)})}}),pe.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?pe.prop(e,t,n):(1===o&&pe.isXMLDoc(e)||(t=t.toLowerCase(),i=pe.attrHooks[t]||(pe.expr.match.bool.test(t)?Ht:Lt)),void 0!==n?null===n?void pe.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:(r=pe.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!fe.radioValue&&"radio"===t&&pe.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(De);if(o&&1===e.nodeType)for(;n=o[i++];)r=pe.propFix[n]||n,pe.expr.match.bool.test(n)?Mt&&Ft||!_t.test(n)?e[r]=!1:e[pe.camelCase("default-"+n)]=e[r]=!1:pe.attr(e,n,""),e.removeAttribute(Ft?n:r)}}),Ht={set:function(e,t,n){return t===!1?pe.removeAttr(e,n):Mt&&Ft||!_t.test(n)?e.setAttribute(!Ft&&pe.propFix[n]||n,n):e[pe.camelCase("default-"+n)]=e[n]=!0,n}},pe.each(pe.expr.match.bool.source.match(/\w+/g),function(e,t){var n=qt[t]||pe.find.attr;Mt&&Ft||!_t.test(t)?qt[t]=function(e,t,r){var i,o;return r||(o=qt[t],qt[t]=i,i=null!=n(e,t,r)?t.toLowerCase():null,qt[t]=o),i}:qt[t]=function(e,t,n){if(!n)return e[pe.camelCase("default-"+t)]?t.toLowerCase():null}}),Mt&&Ft||(pe.attrHooks.value={set:function(e,t,n){return pe.nodeName(e,"input")?void(e.defaultValue=t):Lt&&Lt.set(e,t,n)}}),Ft||(Lt={set:function(e,t,n){var r=e.getAttributeNode(n);if(r||e.setAttributeNode(r=e.ownerDocument.createAttribute(n)),r.value=t+="","value"===n||t===e.getAttribute(n))return t}},qt.id=qt.name=qt.coords=function(e,t,n){var r;if(!n)return(r=e.getAttributeNode(t))&&""!==r.value?r.value:null},pe.valHooks.button={get:function(e,t){var n=e.getAttributeNode(t);if(n&&n.specified)return n.value},set:Lt.set},pe.attrHooks.contenteditable={set:function(e,t,n){Lt.set(e,""!==t&&t,n)}},pe.each(["width","height"],function(e,t){pe.attrHooks[t]={set:function(e,n){if(""===n)return e.setAttribute(t,"auto"),n}}})),fe.style||(pe.attrHooks.style={get:function(e){return e.style.cssText||void 0},set:function(e,t){return e.style.cssText=t+""}});var Ot=/^(?:input|select|textarea|button|object)$/i,Rt=/^(?:a|area)$/i;pe.fn.extend({prop:function(e,t){return Pe(this,pe.prop,e,t,arguments.length>1)},removeProp:function(e){return e=pe.propFix[e]||e,this.each(function(){try{this[e]=void 0,delete this[e]}catch(t){}})}}),pe.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&pe.isXMLDoc(e)||(t=pe.propFix[t]||t,i=pe.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=pe.find.attr(e,"tabindex");return t?parseInt(t,10):Ot.test(e.nodeName)||Rt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),fe.hrefNormalized||pe.each(["href","src"],function(e,t){pe.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),fe.optSelected||(pe.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),pe.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){pe.propFix[this.toLowerCase()]=this}),fe.enctype||(pe.propFix.enctype="encoding");var Pt=/[\t\r\n\f]/g;pe.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(pe.isFunction(e))return this.each(function(t){pe(this).addClass(e.call(this,t,z(this)))});if("string"==typeof e&&e)for(t=e.match(De)||[];n=this[u++];)if(i=z(n),r=1===n.nodeType&&(" "+i+" ").replace(Pt," ")){for(a=0;o=t[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");s=pe.trim(r),i!==s&&pe.attr(n,"class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(pe.isFunction(e))return this.each(function(t){pe(this).removeClass(e.call(this,t,z(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(De)||[];n=this[u++];)if(i=z(n),r=1===n.nodeType&&(" "+i+" ").replace(Pt," ")){for(a=0;o=t[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");s=pe.trim(r),i!==s&&pe.attr(n,"class",s)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):pe.isFunction(e)?this.each(function(n){pe(this).toggleClass(e.call(this,n,z(this),t),t)}):this.each(function(){var t,r,i,o;if("string"===n)for(r=0,i=pe(this),o=e.match(De)||[];t=o[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else void 0!==e&&"boolean"!==n||(t=z(this),t&&pe._data(this,"__className__",t),pe.attr(this,"class",t||e===!1?"":pe._data(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+z(n)+" ").replace(Pt," ").indexOf(t)>-1)return!0;return!1}}),pe.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){pe.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),pe.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}});var Bt=e.location,Wt=pe.now(),It=/\?/,$t=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;pe.parseJSON=function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t+"");var n,r=null,i=pe.trim(t+"");return i&&!pe.trim(i.replace($t,function(e,t,i,o){return n&&t&&(r=0),0===r?e:(n=i||t,r+=!o-!i,"")}))?Function("return "+i)():pe.error("Invalid JSON: "+t)},pe.parseXML=function(t){var n,r;if(!t||"string"!=typeof t)return null;try{e.DOMParser?(r=new e.DOMParser,n=r.parseFromString(t,"text/xml")):(n=new e.ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(t))}catch(i){n=void 0}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||pe.error("Invalid XML: "+t),n};var zt=/#.*$/,Xt=/([?&])_=[^&]*/,Ut=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Vt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Yt=/^(?:GET|HEAD)$/,Jt=/^\/\//,Gt=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Kt={},Qt={},Zt="*/".concat("*"),en=Bt.href,tn=Gt.exec(en.toLowerCase())||[];pe.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:en,type:"GET",isLocal:Vt.test(tn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Zt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":pe.parseJSON,"text xml":pe.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?V(V(e,pe.ajaxSettings),t):V(pe.ajaxSettings,e)},ajaxPrefilter:X(Kt),ajaxTransport:X(Qt),ajax:function(t,n){function r(t,n,r,i){var o,f,v,x,w,C=n;2!==b&&(b=2,u&&e.clearTimeout(u),c=void 0,s=i||"",T.readyState=t>0?4:0,o=t>=200&&t<300||304===t,r&&(x=Y(d,T,r)),x=J(d,x,T,o),o?(d.ifModified&&(w=T.getResponseHeader("Last-Modified"),w&&(pe.lastModified[a]=w),w=T.getResponseHeader("etag"),w&&(pe.etag[a]=w)),204===t||"HEAD"===d.type?C="nocontent":304===t?C="notmodified":(C=x.state,f=x.data,v=x.error,o=!v)):(v=C,!t&&C||(C="error",t<0&&(t=0))),T.status=t,T.statusText=(n||C)+"",o?g.resolveWith(p,[f,C,T]):g.rejectWith(p,[T,C,v]),T.statusCode(y),y=void 0,l&&h.trigger(o?"ajaxSuccess":"ajaxError",[T,d,o?f:v]),m.fireWith(p,[T,C]),l&&(h.trigger("ajaxComplete",[T,d]),--pe.active||pe.event.trigger("ajaxStop")))}"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,d=pe.ajaxSetup({},n),p=d.context||d,h=d.context&&(p.nodeType||p.jquery)?pe(p):pe.event,g=pe.Deferred(),m=pe.Callbacks("once memory"),y=d.statusCode||{},v={},x={},b=0,w="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!f)for(f={};t=Ut.exec(s);)f[t[1].toLowerCase()]=t[2];t=f[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?s:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=x[n]=x[n]||e,v[e]=t),this},overrideMimeType:function(e){return b||(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(b<2)for(t in e)y[t]=[y[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||w;return c&&c.abort(t),r(0,t),this}};if(g.promise(T).complete=m.add,T.success=T.done,T.error=T.fail,d.url=((t||d.url||en)+"").replace(zt,"").replace(Jt,tn[1]+"//"),d.type=n.method||n.type||d.method||d.type,d.dataTypes=pe.trim(d.dataType||"*").toLowerCase().match(De)||[""],null==d.crossDomain&&(i=Gt.exec(d.url.toLowerCase()),d.crossDomain=!(!i||i[1]===tn[1]&&i[2]===tn[2]&&(i[3]||("http:"===i[1]?"80":"443"))===(tn[3]||("http:"===tn[1]?"80":"443")))),d.data&&d.processData&&"string"!=typeof d.data&&(d.data=pe.param(d.data,d.traditional)),U(Kt,d,n,T),2===b)return T;l=pe.event&&d.global,l&&0===pe.active++&&pe.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Yt.test(d.type),a=d.url,d.hasContent||(d.data&&(a=d.url+=(It.test(a)?"&":"?")+d.data,delete d.data),d.cache===!1&&(d.url=Xt.test(a)?a.replace(Xt,"$1_="+Wt++):a+(It.test(a)?"&":"?")+"_="+Wt++)),d.ifModified&&(pe.lastModified[a]&&T.setRequestHeader("If-Modified-Since",pe.lastModified[a]),pe.etag[a]&&T.setRequestHeader("If-None-Match",pe.etag[a])),(d.data&&d.hasContent&&d.contentType!==!1||n.contentType)&&T.setRequestHeader("Content-Type",d.contentType),T.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Zt+"; q=0.01":""):d.accepts["*"]);for(o in d.headers)T.setRequestHeader(o,d.headers[o]);if(d.beforeSend&&(d.beforeSend.call(p,T,d)===!1||2===b))return T.abort();w="abort";for(o in{success:1,error:1,complete:1})T[o](d[o]);if(c=U(Qt,d,n,T)){if(T.readyState=1,l&&h.trigger("ajaxSend",[T,d]),2===b)return T;d.async&&d.timeout>0&&(u=e.setTimeout(function(){T.abort("timeout")},d.timeout));try{b=1,c.send(v,r)}catch(C){if(!(b<2))throw C;r(-1,C)}}else r(-1,"No Transport");return T},getJSON:function(e,t,n){return pe.get(e,t,n,"json")},getScript:function(e,t){return pe.get(e,void 0,t,"script")}}),pe.each(["get","post"],function(e,t){pe[t]=function(e,n,r,i){return pe.isFunction(n)&&(i=i||r,r=n,n=void 0),pe.ajax(pe.extend({url:e,type:t,dataType:i,data:n,success:r},pe.isPlainObject(e)&&e))}}),pe._evalUrl=function(e){return pe.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},pe.fn.extend({wrapAll:function(e){if(pe.isFunction(e))return this.each(function(t){pe(this).wrapAll(e.call(this,t))});if(this[0]){var t=pe(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return pe.isFunction(e)?this.each(function(t){pe(this).wrapInner(e.call(this,t))}):this.each(function(){var t=pe(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=pe.isFunction(e);return this.each(function(n){pe(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){pe.nodeName(this,"body")||pe(this).replaceWith(this.childNodes)}).end()}}),pe.expr.filters.hidden=function(e){return fe.reliableHiddenOffsets()?e.offsetWidth<=0&&e.offsetHeight<=0&&!e.getClientRects().length:K(e)},pe.expr.filters.visible=function(e){return!pe.expr.filters.hidden(e)};var nn=/%20/g,rn=/\[\]$/,on=/\r?\n/g,an=/^(?:submit|button|image|reset|file)$/i,sn=/^(?:input|select|textarea|keygen)/i;pe.param=function(e,t){var n,r=[],i=function(e,t){t=pe.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=pe.ajaxSettings&&pe.ajaxSettings.traditional),pe.isArray(e)||e.jquery&&!pe.isPlainObject(e))pe.each(e,function(){i(this.name,this.value)});else for(n in e)Q(n,e[n],t,i);return r.join("&").replace(nn,"+")},pe.fn.extend({serialize:function(){return pe.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=pe.prop(this,"elements");return e?pe.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!pe(this).is(":disabled")&&sn.test(this.nodeName)&&!an.test(e)&&(this.checked||!Be.test(e))}).map(function(e,t){var n=pe(this).val();return null==n?null:pe.isArray(n)?pe.map(n,function(e){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),pe.ajaxSettings.xhr=void 0!==e.ActiveXObject?function(){return this.isLocal?ee():re.documentMode>8?Z():/^(get|post|head|put|delete|options)$/i.test(this.type)&&Z()||ee()}:Z;var un=0,ln={},cn=pe.ajaxSettings.xhr();e.attachEvent&&e.attachEvent("onunload",function(){for(var e in ln)ln[e](void 0,!0)}),fe.cors=!!cn&&"withCredentials"in cn,cn=fe.ajax=!!cn,cn&&pe.ajaxTransport(function(t){if(!t.crossDomain||fe.cors){var n;return{send:function(r,i){var o,a=t.xhr(),s=++un;if(a.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(o in t.xhrFields)a[o]=t.xhrFields[o];t.mimeType&&a.overrideMimeType&&a.overrideMimeType(t.mimeType),t.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest");for(o in r)void 0!==r[o]&&a.setRequestHeader(o,r[o]+"");a.send(t.hasContent&&t.data||null),n=function(e,r){var o,u,l;if(n&&(r||4===a.readyState))if(delete ln[s],n=void 0,a.onreadystatechange=pe.noop,r)4!==a.readyState&&a.abort();else{l={},o=a.status,"string"==typeof a.responseText&&(l.text=a.responseText);try{u=a.statusText}catch(c){u=""}o||!t.isLocal||t.crossDomain?1223===o&&(o=204):o=l.text?200:404}l&&i(o,u,l,a.getAllResponseHeaders())},t.async?4===a.readyState?e.setTimeout(n):a.onreadystatechange=ln[s]=n:n()},abort:function(){n&&n(void 0,!0)}}}}),pe.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return pe.globalEval(e),e}}}),pe.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),pe.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=re.head||pe("head")[0]||re.documentElement;return{send:function(r,i){t=re.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||i(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var fn=[],dn=/(=)\?(?=&|$)|\?\?/;pe.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=fn.pop()||pe.expando+"_"+Wt++;return this[e]=!0,e}}),pe.ajaxPrefilter("json jsonp",function(t,n,r){var i,o,a,s=t.jsonp!==!1&&(dn.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&dn.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return i=t.jsonpCallback=pe.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(dn,"$1"+i):t.jsonp!==!1&&(t.url+=(It.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||pe.error(i+" was not called"),a[0]},t.dataTypes[0]="json",o=e[i],e[i]=function(){a=arguments},r.always(function(){void 0===o?pe(e).removeProp(i):e[i]=o,t[i]&&(t.jsonpCallback=n.jsonpCallback,fn.push(i)),a&&pe.isFunction(o)&&o(a[0]),a=o=void 0}),"script"}),pe.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||re;var r=Te.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=y([e],t,i),i&&i.length&&pe(i).remove(),pe.merge([],r.childNodes))};var pn=pe.fn.load;return pe.fn.load=function(e,t,n){if("string"!=typeof e&&pn)return pn.apply(this,arguments);var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=pe.trim(e.slice(s,e.length)),e=e.slice(0,s)),pe.isFunction(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&pe.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?pe("
          ").append(pe.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},pe.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){pe.fn[t]=function(e){return this.on(t,e)}}),pe.expr.filters.animated=function(e){return pe.grep(pe.timers,function(t){return e===t.elem}).length},pe.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=pe.css(e,"position"),f=pe(e),d={};"static"===c&&(e.style.position="relative"),s=f.offset(),o=pe.css(e,"top"),u=pe.css(e,"left"),l=("absolute"===c||"fixed"===c)&&pe.inArray("auto",[o,u])>-1,l?(r=f.position(),a=r.top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),pe.isFunction(t)&&(t=t.call(e,n,pe.extend({},s))),null!=t.top&&(d.top=t.top-s.top+a),null!=t.left&&(d.left=t.left-s.left+i),"using"in t?t.using.call(e,d):f.css(d)}},pe.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){pe.offset.setOffset(this,e,t)});var t,n,r={top:0,left:0},i=this[0],o=i&&i.ownerDocument;if(o)return t=o.documentElement,pe.contains(t,i)?("undefined"!=typeof i.getBoundingClientRect&&(r=i.getBoundingClientRect()),n=te(o),{top:r.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:r.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):r},position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===pe.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),pe.nodeName(e[0],"html")||(n=e.offset()),n.top+=pe.css(e[0],"borderTopWidth",!0),n.left+=pe.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-pe.css(r,"marginTop",!0),left:t.left-n.left-pe.css(r,"marginLeft",!0)}}},offsetParent:function(){ +return this.map(function(){for(var e=this.offsetParent;e&&!pe.nodeName(e,"html")&&"static"===pe.css(e,"position");)e=e.offsetParent;return e||pt})}}),pe.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n=/Y/.test(t);pe.fn[e]=function(r){return Pe(this,function(e,r,i){var o=te(e);return void 0===i?o?t in o?o[t]:o.document.documentElement[r]:e[r]:void(o?o.scrollTo(n?pe(o).scrollLeft():i,n?i:pe(o).scrollTop()):e[r]=i)},e,r,arguments.length,null)}}),pe.each(["top","left"],function(e,t){pe.cssHooks[t]=L(fe.pixelPosition,function(e,n){if(n)return n=gt(e,t),ft.test(n)?pe(e).position()[t]+"px":n})}),pe.each({Height:"height",Width:"width"},function(e,t){pe.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){pe.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),a=n||(r===!0||i===!0?"margin":"border");return Pe(this,function(t,n,r){var i;return pe.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):void 0===r?pe.css(t,n,a):pe.style(t,n,r,a)},t,o?r:void 0,o,null)}})}),pe.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),pe.fn.size=function(){return this.length},pe.fn.andSelf=pe.fn.addBack,layui.define(function(e){layui.$=pe,e("jquery",pe)}),pe});!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var t=document.currentScript?document.currentScript.src:function(){for(var e,t=document.scripts,i=t.length-1,n=i;n>0;n--)if("interactive"===t[n].readyState){e=t[n].src;break}return e||t[i].src}(),i=e.LAYUI_GLOBAL||{};return i.layer_dir||t.substring(0,t.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"],getStyle:function(t,i){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](i)},link:function(t,i,n){if(r.path){var a=document.getElementsByTagName("head")[0],s=document.createElement("link");"string"==typeof i&&(n=i);var l=(n||t).replace(/\.|\//g,""),f="layuicss-"+l,c="creating",u=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,document.getElementById(f)||a.appendChild(s),"function"==typeof i&&!function d(t){var n=100,a=document.getElementById(f);return++u>1e4/n?e.console&&console.error(l+".css: Invalid"):void(1989===parseInt(o.getStyle(a,"width"))?(t===c&&a.removeAttribute("lay-status"),a.getAttribute("lay-status")===c?setTimeout(d,n):i()):(a.setAttribute("lay-status",c),setTimeout(function(){d(c)},n)))}()}}},r={v:"3.5.1",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):o.link("theme/"+e.extend),this):this},ready:function(e){var t="layer",i="",n=(a?"modules/layer/":"theme/")+"default/layer.css?v="+r.v+i;return a?layui.addcss(n,e,t):o.link(n,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:260},n))}},s=function(e){var t=this,a=function(){t.creat()};t.index=++r.index,t.config.maxWidth=i(n).width()-30,t.config=i.extend({},t.config,o.config,e),document.body?a():setTimeout(function(){a()},30)};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim-00","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],l.SHADE="layui-layer-shade",l.MOVE="layui-layer-move",s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,isOutAnim:!0,minStack:!0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'
          '+(f?r.title[0]:r.title)+"
          ":"";return r.zIndex=s,t([r.shade?'
          ':"",'
          '+(e&&2!=r.type?"":u)+'
          '+(0==r.type&&r.icon!==-1?'':"")+(1==r.type&&e?"":r.content||"")+'
          '+function(){var e=c?'':"";return r.closeBtn&&(e+=''),e}()+""+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t'+r.btn[t]+"";return'
          '+e+"
          "}():"")+(r.resize?'':"")+"
          "],u,i('
          ')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"","auto"];t.content='';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}if(e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i("#"+l.MOVE)[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),e.shadeo=i("#"+l.SHADE+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),e.shadeo.css({"background-color":t.shade[1]||"#000",opacity:t.shade[0]||t.shade}),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():function(){e.offset(),parseInt(o.getStyle(document.getElementById(l.MOVE),"z-index"))||function(){e.layero.css("visibility","hidden"),r.ready(function(){e.offset(),e.layero.css("visibility","visible")})}()}(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]){var u="layer-anim "+l.anim[t.anim];e.layero.addClass(u).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){i(this).removeClass(u)})}t.isOutAnim&&e.layero.data("isOutAnim",!0)}},s.pt.auto=function(e){var t=this,a=t.config,o=i("#"+l[0]+e);""===a.area[0]&&a.maxWidth>0&&(r.ie&&r.ie<8&&a.btn&&o.width(o.innerWidth()),o.outerWidth()>a.maxWidth&&o.width(a.maxWidth));var s=[o.innerWidth(),o.innerHeight()],f=o.find(l[1]).outerHeight()||0,c=o.find("."+l[6]).outerHeight()||0,u=function(e){e=o.find(e),e.height(s[1]-f-c-2*(0|parseFloat(e.css("padding-top"))))};switch(a.type){case 2:u("iframe");break;default:""===a.area[1]?a.maxHeight>0&&o.outerHeight()>a.maxHeight?(s[1]=a.maxHeight,u("."+l[5])):a.fixed&&s[1]>=n.height()&&(s[1]=n.height(),u("."+l[5])):u("."+l[5])}return t},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;af&&(a=f),ou&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index,t)}):a.success(n,t.index,t)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&t.shadeo.on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n,t.index);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n,t.index)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n,t.index)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){t=t||{};var a=i("#"+l[0]+e),s=i("#"+l.SHADE+e),f=a.find(l[1]).outerHeight()||0,c=a.attr("minLeft")||181*o.minIndex+"px",u=a.css("position"),d={width:180,height:f,position:"fixed",overflow:"hidden"};o.record(a),o.minLeft[0]&&(c=o.minLeft[0],o.minLeft.shift()),t.minStack&&(d.left=c,d.top=n.height()-f,a.attr("minLeft")||o.minIndex++,a.attr("minLeft",c)),a.attr("position",u),r.style(e,d,!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),s.hide()},r.restore=function(e){var t=i("#"+l[0]+e),n=i("#"+l.SHADE+e),a=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(a[0]),height:parseFloat(a[1]),top:parseFloat(a[2]),left:parseFloat(a[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e),n.show()},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e,t){var n=i("#"+l[0]+e),a=n.attr("type"),s="layer-anim-close";if(n[0]){var f="layui-layer-wrap",c=function(){if(a===o.type[1]&&"object"===n.attr("conType")){n.children(":not(."+l[5]+")").remove();for(var r=n.find("."+f),s=0;s<2;s++)r.unwrap();r.css("display",r.data("display")).removeClass(f)}else{if(a===o.type[2])try{var c=i("#"+l[4]+e)[0];c.contentWindow.document.write(""),c.contentWindow.close(),n.find("."+l[5])[0].removeChild(c)}catch(u){}n[0].innerHTML="",n.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e],"function"==typeof t&&t()};n.data("isOutAnim")&&n.addClass("layer-anim "+s),i("#layui-layer-moves, #"+l.SHADE+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),n.attr("minLeft")&&(o.minIndex--,o.minLeft.push(n.attr("minLeft"))),r.ie&&r.ie<10||!n.data("isOutAnim")?c():setTimeout(function(){c()},200)}},r.closeAll=function(e,t){"function"==typeof e&&(t=e,e=null);var n=i("."+l[0]);i.each(n,function(a){var o=i(this),s=e?o.attr("type")===e:1;s&&r.close(o.attr("times"),a===n.length-1?t:null),s=null}),0===n.length&&"function"==typeof t&&t()};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(t){s=t.find(".layui-layer-input"),s.val(e.value||"").focus(),"function"==typeof f&&f(t)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n="layui-this",a=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,a="";if(e>0)for(a=''+t[0].title+"";i"+t[i].title+"";return a}(),content:'
            '+function(){var e=t.length,i=1,a="";if(e>0)for(a='
          • '+(t[0].content||"no content")+"
          • ";i'+(t[i].content||"no content")+"";return a}()+"
          ",success:function(t){var o=t.find(".layui-layer-title").children(),r=t.find(".layui-layer-tabmain").children();o.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var a=i(this),o=a.index();a.addClass(n).siblings().removeClass(n),r.eq(o).show().siblings().hide(),"function"==typeof e.change&&e.change(o)}),"function"==typeof a&&a(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=!("string"==typeof t.photos||t.photos instanceof i),f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){h();var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0)}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){if(!(u.length<=1))return f.start=s.imgIndex-1,r.close(s.index),r.photos(t,!0,e)},s.event=function(){s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev(!0)}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext(!0)}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),a&&(t.anim=-1),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]'+(u[d].alt||'+function(){return u.length>1?'
          '+(u[d].alt||"")+""+s.imgIndex+" / "+u.length+"
          ":""}()+"
          ",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
          是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.$),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){r.ready(),o.run(e.jQuery)}()}(window);layui.define("jquery",function(e){"use strict";var t=layui.$,i=layui.hint(),n={fixbar:function(e){var i,n,r="layui-fixbar",a="layui-fixbar-top",o=t(document),l=t("body");e=t.extend({showHeight:200},e),e.bar1=e.bar1===!0?"":e.bar1,e.bar2=e.bar2===!0?"":e.bar2,e.bgcolor=e.bgcolor?"background-color:"+e.bgcolor:"";var c=[e.bar1,e.bar2,""],g=t(['
            ',e.bar1?'
          • '+c[0]+"
          • ":"",e.bar2?'
          • '+c[1]+"
          • ":"",'
          • '+c[2]+"
          • ","
          "].join("")),u=g.find("."+a),s=function(){var t=o.scrollTop();t>=e.showHeight?i||(u.show(),i=1):i&&(u.hide(),i=0)};t("."+r)[0]||("object"==typeof e.css&&g.css(e.css),l.append(g),s(),g.find("li").on("click",function(){var i=t(this),n=i.attr("lay-type");"top"===n&&t("html,body").animate({scrollTop:0},200),e.click&&e.click.call(this,n)}),o.on("scroll",function(){clearTimeout(n),n=setTimeout(function(){s()},100)}))},countdown:function(e,t,i){var n=this,r="function"==typeof t,a=new Date(e).getTime(),o=new Date(!t||r?(new Date).getTime():t).getTime(),l=a-o,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];r&&(i=t);var g=setTimeout(function(){n.countdown(e,o+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],t,g),l<=0&&clearTimeout(g),g},timeAgo:function(e,t){var i=this,n=[[],[]],r=(new Date).getTime()-new Date(e).getTime();return r>26784e5?(r=new Date(e),n[0][0]=i.digit(r.getFullYear(),4),n[0][1]=i.digit(r.getMonth()+1),n[0][2]=i.digit(r.getDate()),t||(n[1][0]=i.digit(r.getHours()),n[1][1]=i.digit(r.getMinutes()),n[1][2]=i.digit(r.getSeconds())),n[0].join("-")+" "+n[1].join(":")):r>=864e5?(r/1e3/60/60/24|0)+"\u5929\u524d":r>=36e5?(r/1e3/60/60|0)+"\u5c0f\u65f6\u524d":r>=18e4?(r/1e3/60|0)+"\u5206\u949f\u524d":r<0?"\u672a\u6765":"\u521a\u521a"},digit:function(e,t){var i="";e=String(e),t=t||2;for(var n=e.length;n/g,">").replace(/'/g,"'").replace(/"/g,""")},unescape:function(e){return String(e||"").replace(/\&/g,"&").replace(/\</g,"<").replace(/\>/g,">").replace(/\'/,"'").replace(/\"/,'"')},toVisibleArea:function(e){if(e=t.extend({margin:160,duration:200,type:"y"},e),e.scrollElem[0]&&e.thisElem[0]){var i=e.scrollElem,n=e.thisElem,r="y"===e.type,a=r?"scrollTop":"scrollLeft",o=r?"top":"left",l=i[a](),c=i[r?"height":"width"](),g=i.offset()[o],u=n.offset()[o]-g,s={};(u>c-e.margin||u0&&t.unshift(""),t.join(" ")}()+">"+(a.title||"unnaming")+"";return s[0]?s.before(r):n.append(r),o.append('
          '+(a.content||"")+"
          "),b.hideTabMore(!0),b.tabAuto(),this},s.prototype.tabDelete=function(t,a){var e=".layui-tab-title",l=i(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+a+'"]');return b.tabDelete(null,s),this},s.prototype.tabChange=function(t,a){var e=".layui-tab-title",l=i(".layui-tab[lay-filter="+t+"]"),n=l.children(e),s=n.find('>li[lay-id="'+a+'"]');return b.tabClick.call(s[0],null,null,s),this},s.prototype.tab=function(t){t=t||{},m.on("click",t.headerElem,function(a){var e=i(this).index();b.tabClick.call(this,a,e,null,t)})},s.prototype.progress=function(t,a){var e="layui-progress",l=i("."+e+"[lay-filter="+t+"]"),n=l.find("."+e+"-bar"),s=n.find("."+e+"-text");return n.css("width",a).attr("lay-percent",a),s.text(a),this};var o=".layui-nav",r="layui-nav-item",c="layui-nav-bar",u="layui-nav-tree",y="layui-nav-child",d="layui-nav-child-c",f="layui-nav-more",h="layui-icon-down",p="layui-anim layui-anim-upbit",b={tabClick:function(t,a,s,o){o=o||{};var r=s||i(this),a=a||r.parent().children("li").index(r),c=o.headerElem?r.parent():r.parents(".layui-tab").eq(0),u=o.bodyElem?i(o.bodyElem):c.children(".layui-tab-content").children(".layui-tab-item"),y=r.find("a"),d="javascript:;"!==y.attr("href")&&"_blank"===y.attr("target"),f="string"==typeof r.attr("lay-unselect"),h=c.attr("lay-filter");d||f||(r.addClass(l).siblings().removeClass(l),u.eq(a).addClass(n).siblings().removeClass(n)),layui.event.call(this,e,"tab("+h+")",{elem:c,index:a})},tabDelete:function(t,a){var n=a||i(this).parent(),s=n.index(),o=n.parents(".layui-tab").eq(0),r=o.children(".layui-tab-content").children(".layui-tab-item"),c=o.attr("lay-filter");n.hasClass(l)&&(n.next()[0]?b.tabClick.call(n.next()[0],null,s+1):n.prev()[0]&&b.tabClick.call(n.prev()[0],null,s-1)),n.remove(),r.eq(s).remove(),setTimeout(function(){b.tabAuto()},50),layui.event.call(this,e,"tabDelete("+c+")",{elem:o,index:s})},tabAuto:function(){var t="layui-tab-more",e="layui-tab-bar",l="layui-tab-close",n=this;i(".layui-tab").each(function(){var s=i(this),o=s.children(".layui-tab-title"),r=(s.children(".layui-tab-content").children(".layui-tab-item"),'lay-stope="tabmore"'),c=i('');if(n===window&&8!=a.ie&&b.hideTabMore(!0),s.attr("lay-allowClose")&&o.find("li").each(function(){var t=i(this);if(!t.find("."+l)[0]){var a=i('');a.on("click",b.tabDelete),t.append(a)}}),"string"!=typeof s.attr("lay-unauto"))if(o.prop("scrollWidth")>o.outerWidth()+1){if(o.find("."+e)[0])return;o.append(c),s.attr("overflow",""),c.on("click",function(i){o[this.title?"removeClass":"addClass"](t),this.title=this.title?"":"\u6536\u7f29"})}else o.find("."+e).remove(),s.removeAttr("overflow")})},hideTabMore:function(t){var a=i(".layui-tab-title");t!==!0&&"tabmore"===i(t.target).attr("lay-stope")||(a.removeClass("layui-tab-more"),a.find(".layui-tab-bar").attr("title",""))},clickThis:function(){var t=i(this),a=t.parents(o),n=a.attr("lay-filter"),s=t.parent(),c=t.siblings("."+y),d="string"==typeof s.attr("lay-unselect");"javascript:;"!==t.attr("href")&&"_blank"===t.attr("target")||d||c[0]||(a.find("."+l).removeClass(l),s.addClass(l)),a.hasClass(u)&&(c.removeClass(p),c[0]&&(s["none"===c.css("display")?"addClass":"removeClass"](r+"ed"),"all"===a.attr("lay-shrink")&&s.siblings().removeClass(r+"ed"))),layui.event.call(this,e,"nav("+n+")",t)},collapse:function(){var t=i(this),a=t.find(".layui-colla-icon"),l=t.siblings(".layui-colla-content"),s=t.parents(".layui-collapse").eq(0),o=s.attr("lay-filter"),r="none"===l.css("display");if("string"==typeof s.attr("lay-accordion")){var c=s.children(".layui-colla-item").children("."+n);c.siblings(".layui-colla-title").children(".layui-colla-icon").html(""),c.removeClass(n)}l[r?"addClass":"removeClass"](n),a.html(r?"":""),layui.event.call(this,e,"collapse("+o+")",{title:t,content:l,show:r})}};s.prototype.init=function(t,e){var l=function(){return e?'[lay-filter="'+e+'"]':""}(),s={tab:function(){b.tabAuto.call({})},nav:function(){var t=200,e={},s={},v={},m="layui-nav-title",C=function(l,o,r){var c=i(this),h=c.find("."+y);if(o.hasClass(u)){if(!h[0]){var b=c.children("."+m);l.css({top:c.offset().top-o.offset().top,height:(b[0]?b:c).outerHeight(),opacity:1})}}else h.addClass(p),h.hasClass(d)&&h.css({left:-(h.outerWidth()-c.width())/2}),h[0]?l.css({left:l.position().left+l.width()/2,width:0,opacity:0}):l.css({left:c.position().left+parseFloat(c.css("marginLeft")),top:c.position().top+c.height()-l.height()}),e[r]=setTimeout(function(){l.css({width:h[0]?0:c.width(),opacity:h[0]?0:1})},a.ie&&a.ie<10?0:t),clearTimeout(v[r]),"block"===h.css("display")&&clearTimeout(s[r]),s[r]=setTimeout(function(){h.addClass(n),c.find("."+f).addClass(f+"d")},300)};i(o+l).each(function(a){var l=i(this),o=i(''),d=l.find("."+r);l.find("."+c)[0]||(l.append(o),(l.hasClass(u)?d.find("dd,>."+m):d).on("mouseenter",function(){C.call(this,o,l,a)}).on("mouseleave",function(){l.hasClass(u)?o.css({height:0,opacity:0}):(clearTimeout(s[a]),s[a]=setTimeout(function(){l.find("."+y).removeClass(n),l.find("."+f).removeClass(f+"d")},300))}),l.on("mouseleave",function(){clearTimeout(e[a]),v[a]=setTimeout(function(){l.hasClass(u)||o.css({width:0,left:o.position().left+o.width()/2,opacity:0})},t)})),d.find("a").each(function(){var t=i(this),a=(t.parent(),t.siblings("."+y));a[0]&&!t.children("."+f)[0]&&t.append(''),t.off("click",b.clickThis).on("click",b.clickThis)})})},breadcrumb:function(){var t=".layui-breadcrumb";i(t+l).each(function(){var t=i(this),a="lay-separator",e=t.attr(a)||"/",l=t.find("a");l.next("span["+a+"]")[0]||(l.each(function(t){t!==l.length-1&&i(this).after(""+e+"")}),t.css("visibility","visible"))})},progress:function(){var t="layui-progress";i("."+t+l).each(function(){var a=i(this),e=a.find(".layui-progress-bar"),l=e.attr("lay-percent");e.css("width",function(){return/^.+\/.+$/.test(l)?100*new Function("return "+l)()+"%":l}()),a.attr("lay-showPercent")&&setTimeout(function(){e.html(''+l+"")},350)})},collapse:function(){var t="layui-collapse";i("."+t+l).each(function(){var t=i(this).find(".layui-colla-item");t.each(function(){var t=i(this),a=t.find(".layui-colla-title"),e=t.find(".layui-colla-content"),l="none"===e.css("display");a.find(".layui-colla-icon").remove(),a.append(''+(l?"":"")+""),a.off("click",b.collapse).on("click",b.collapse)})})}};return s[t]?s[t]():layui.each(s,function(t,i){i()})},s.prototype.render=s.prototype.init;var v=new s,m=i(document);i(function(){v.render()});var C=".layui-tab-title li";m.on("click",C,b.tabClick),m.on("click",b.hideTabMore),i(window).on("resize",b.tabAuto),t(e,v)});layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,n=layui.hint(),o=layui.device(),a={config:{},set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,r,e,t)}},l=function(){var e=this;return{upload:function(t){e.upload.call(e,t)},reload:function(t){e.reload.call(e,t)},config:e.config}},r="upload",u="layui-upload-file",c="layui-upload-form",f="layui-upload-iframe",s="layui-upload-choose",p=function(e){var i=this;i.config=t.extend({},i.config,a.config,e),i.render()};p.prototype.config={accept:"images",exts:"",auto:!0,bindAction:"",url:"",field:"file",acceptMime:"",method:"post",data:{},drag:!0,size:0,number:0,multiple:!1},p.prototype.render=function(e){var i=this,e=i.config;e.elem=t(e.elem),e.bindAction=t(e.bindAction),i.file(),i.events()},p.prototype.file=function(){var e=this,i=e.config,n=e.elemFile=t(['"].join("")),a=i.elem.next();(a.hasClass(u)||a.hasClass(c))&&a.remove(),o.ie&&o.ie<10&&i.elem.wrap('
          '),e.isFile()?(e.elemFile=i.elem,i.field=i.elem[0].name):i.elem.after(n),o.ie&&o.ie<10&&e.initIE()},p.prototype.initIE=function(){var e=this,i=e.config,n=t(''),o=t(['
          ',"
          "].join(""));t("#"+f)[0]||t("body").append(n),i.elem.next().hasClass(c)||(e.elemFile.wrap(o),i.elem.next("."+c).append(function(){var e=[];return layui.each(i.data,function(t,i){i="function"==typeof i?i():i,e.push('')}),e.join("")}()))},p.prototype.msg=function(e){return i.msg(e,{icon:2,shift:6})},p.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},p.prototype.preview=function(e){var t=this;window.FileReader&&layui.each(t.chooseFiles,function(t,i){var n=new FileReader;n.readAsDataURL(i),n.onload=function(){e&&e(t,i,this.result)}})},p.prototype.upload=function(e,i){var n,a=this,l=a.config,r=a.elemFile[0],u=function(){var i=0,n=0,o=e||a.files||a.chooseFiles||r.files,u=function(){l.multiple&&i+n===a.fileLength&&"function"==typeof l.allDone&&l.allDone({total:a.fileLength,successful:i,aborted:n})};layui.each(o,function(e,o){var r=new FormData;r.append(l.field,o),layui.each(l.data,function(e,t){t="function"==typeof t?t():t,r.append(e,t)});var c={url:l.url,type:"post",data:r,contentType:!1,processData:!1,dataType:"json",headers:l.headers||{},success:function(t){i++,d(e,t),u()},error:function(){n++,a.msg("\u8bf7\u6c42\u4e0a\u4f20\u63a5\u53e3\u51fa\u73b0\u5f02\u5e38"),m(e),u()}};"function"==typeof l.progress&&(c.xhr=function(){var i=t.ajaxSettings.xhr();return i.upload.addEventListener("progress",function(t){if(t.lengthComputable){var i=Math.floor(t.loaded/t.total*100);l.progress(i,l.item?l.item[0]:l.elem[0],t,e)}}),i}),t.ajax(c)})},c=function(){var e=t("#"+f);a.elemFile.parent().submit(),clearInterval(p.timer),p.timer=setInterval(function(){var t,i=e.contents().find("body");try{t=i.text()}catch(n){a.msg("\u83b7\u53d6\u4e0a\u4f20\u540e\u7684\u54cd\u5e94\u4fe1\u606f\u51fa\u73b0\u5f02\u5e38"),clearInterval(p.timer),m()}t&&(clearInterval(p.timer),i.html(""),d(0,t))},30)},d=function(e,t){if(a.elemFile.next("."+s).remove(),r.value="","object"!=typeof t)try{t=JSON.parse(t)}catch(i){return t={},a.msg("\u8bf7\u5bf9\u4e0a\u4f20\u63a5\u53e3\u8fd4\u56de\u6709\u6548JSON")}"function"==typeof l.done&&l.done(t,e||0,function(e){a.upload(e)})},m=function(e){l.auto&&(r.value=""),"function"==typeof l.error&&l.error(e||0,function(e){a.upload(e)})},h=l.exts,v=function(){var t=[];return layui.each(e||a.chooseFiles,function(e,i){t.push(i.name)}),t}(),g={preview:function(e){a.preview(e)},upload:function(e,t){var i={};i[e]=t,a.upload(i)},pushFile:function(){return a.files=a.files||{},layui.each(a.chooseFiles,function(e,t){a.files[e]=t}),a.files},resetFile:function(e,t,i){var n=new File([t],i);a.files=a.files||{},a.files[e]=n}},y=function(){if(!(("choose"===i||l.auto)&&(l.choose&&l.choose(g),"choose"===i)||l.before&&l.before(g)===!1))return o.ie?o.ie>9?u():c():void u()};if(v=0===v.length?r.value.match(/[^\/\\]+\..+/g)||[]||"":v,0!==v.length){switch(l.accept){case"file":if(h&&!RegExp("\\w\\.("+h+")$","i").test(escape(v)))return a.msg("\u9009\u62e9\u7684\u6587\u4ef6\u4e2d\u5305\u542b\u4e0d\u652f\u6301\u7684\u683c\u5f0f"),r.value="";break;case"video":if(!RegExp("\\w\\.("+(h||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(v)))return a.msg("\u9009\u62e9\u7684\u89c6\u9891\u4e2d\u5305\u542b\u4e0d\u652f\u6301\u7684\u683c\u5f0f"),r.value="";break;case"audio":if(!RegExp("\\w\\.("+(h||"mp3|wav|mid")+")$","i").test(escape(v)))return a.msg("\u9009\u62e9\u7684\u97f3\u9891\u4e2d\u5305\u542b\u4e0d\u652f\u6301\u7684\u683c\u5f0f"),r.value="";break;default:if(layui.each(v,function(e,t){RegExp("\\w\\.("+(h||"jpg|png|gif|bmp|jpeg$")+")","i").test(escape(t))||(n=!0)}),n)return a.msg("\u9009\u62e9\u7684\u56fe\u7247\u4e2d\u5305\u542b\u4e0d\u652f\u6301\u7684\u683c\u5f0f"),r.value=""}if(a.fileLength=function(){var t=0,i=e||a.files||a.chooseFiles||r.files;return layui.each(i,function(){t++}),t}(),l.number&&a.fileLength>l.number)return a.msg("\u540c\u65f6\u6700\u591a\u53ea\u80fd\u4e0a\u4f20\u7684\u6570\u91cf\u4e3a\uff1a"+l.number);if(l.size>0&&!(o.ie&&o.ie<10)){var F;if(layui.each(a.chooseFiles,function(e,t){if(t.size>1024*l.size){var i=l.size/1024;i=i>=1?i.toFixed(2)+"MB":l.size+"KB",r.value="",F=i}}),F)return a.msg("\u6587\u4ef6\u4e0d\u80fd\u8d85\u8fc7"+F)}y()}},p.prototype.reload=function(e){e=e||{},delete e.elem,delete e.bindAction;var i=this,e=i.config=t.extend({},i.config,a.config,e),n=e.elem.next();n.attr({name:e.name,accept:e.acceptMime,multiple:e.multiple})},p.prototype.events=function(){var e=this,i=e.config,a=function(t){e.chooseFiles={},layui.each(t,function(t,i){var n=(new Date).getTime();e.chooseFiles[n+"-"+t]=i})},l=function(t,n){var o=e.elemFile,a=(i.item?i.item:i.elem,t.length>1?t.length+"\u4e2a\u6587\u4ef6":(t[0]||{}).name||o[0].value.match(/[^\/\\]+\..+/g)||[]||"");o.next().hasClass(s)&&o.next().remove(),e.upload(null,"choose"),e.isFile()||i.choose||o.after(''+a+"")};i.elem.off("upload.start").on("upload.start",function(){var o=t(this),a=o.attr("lay-data");if(a)try{a=new Function("return "+a)(),e.config=t.extend({},i,a)}catch(l){n.error("Upload element property lay-data configuration item has a syntax error: "+a)}e.config.item=o,e.elemFile[0].click()}),o.ie&&o.ie<10||i.elem.off("upload.over").on("upload.over",function(){var e=t(this);e.attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){var e=t(this);e.removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(n,o){var r=t(this),u=o.originalEvent.dataTransfer.files||[];r.removeAttr("lay-over"),a(u),i.auto?e.upload(u):l(u)}),e.elemFile.off("upload.change").on("upload.change",function(){var t=this.files||[];a(t),i.auto?e.upload():l(t)}),i.bindAction.off("upload.action").on("upload.action",function(){e.upload()}),i.elem.data("haveEvents")||(e.elemFile.on("change",function(){t(this).trigger("upload.change")}),i.elem.on("click",function(){e.isFile()||t(this).trigger("upload.start")}),i.drag&&i.elem.on("dragover",function(e){e.preventDefault(),t(this).trigger("upload.over")}).on("dragleave",function(e){t(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),t(this).trigger("upload.drop",e)}),i.bindAction.on("click",function(){t(this).trigger("upload.action")}),i.elem.data("haveEvents",!0))},a.render=function(e){var t=new p(e);return l.call(t)},e(r,a)});layui.define(["jquery","laytpl","lay"],function(e){"use strict";var i=layui.$,n=layui.laytpl,t=layui.hint(),a=layui.device(),l=a.mobile?"click":"mousedown",r="dropdown",o="layui_"+r+"_index",u={config:{},index:layui[r]?layui[r].index+1e4:0,set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,r,e,i)}},d=function(){var e=this,i=e.config,n=i.id;return d.that[n]=e,{config:i,reload:function(i){e.reload.call(e,i)}}},s="layui-dropdown",m="layui-menu-item-up",c="layui-menu-item-down",p="layui-menu-body-title",y="layui-menu-item-group",f="layui-menu-item-parent",v="layui-menu-item-divider",g="layui-menu-item-checked",h="layui-menu-item-checked2",w="layui-menu-body-panel",C="layui-menu-body-panel-left",V="."+y+">."+p,k=function(e){var n=this;n.index=++u.index,n.config=i.extend({},n.config,u.config,e),n.init()};k.prototype.config={trigger:"click",content:"",className:"",style:"",show:!1,isAllowSpread:!0,isSpreadItem:!0,data:[],delay:300},k.prototype.reload=function(e){var n=this;n.config=i.extend({},n.config,e),n.init(!0)},k.prototype.init=function(e){var n=this,t=n.config,a=t.elem=i(t.elem);if(a.length>1)return layui.each(a,function(){u.render(i.extend({},t,{elem:this}))}),n;if(!e&&a[0]&&a.data(o)){var l=d.getThis(a.data(o));if(!l)return;return l.reload(t)}t.id="id"in t?t.id:n.index,t.show&&n.render(e),n.events()},k.prototype.render=function(e){var t=this,a=t.config,r=i("body"),s=function(){var e=i('
            ');return a.data.length>0?m(e,a.data):e.html('
          • no menu
          • '),e},m=function(e,t){return layui.each(t,function(t,l){var r=l.child&&l.child.length>0,o="isSpreadItem"in l?l.isSpreadItem:a.isSpreadItem,u=l.templet?n(l.templet).render(l):a.templet?n(a.templet).render(l):l.title,d=function(){return r&&(l.type=l.type||"parent"),l.type?{group:"group",parent:"parent","-":"-"}[l.type]||"parent":""}();if("-"===d||l.title||l.id||r){var s=i(["",function(){var e="href"in l?''+u+"":u;return r?'
            '+e+function(){return"parent"===d?'':"group"===d&&a.isAllowSpread?'':""}()+"
            ":'
            '+e+"
            "}(),""].join(""));if(s.data("item",l),r){var c=i('
            '),y=i("
              ");"parent"===d?(c.append(m(y,l.child)),s.append(c)):s.append(m(y,l.child))}e.append(s)}}),e},c=['
              ',"
              "].join("");("contextmenu"===a.trigger||lay.isTopElem(a.elem[0]))&&(e=!0),!e&&a.elem.data(o+"_opened")||(t.elemView=i(c),t.elemView.append(a.content||s()),a.className&&t.elemView.addClass(a.className),a.style&&t.elemView.attr("style",a.style),u.thisId=a.id,t.remove(),r.append(t.elemView),a.elem.data(o+"_opened",!0),t.position(),d.prevElem=t.elemView,d.prevElem.data("prevElem",a.elem),t.elemView.find(".layui-menu").on(l,function(e){layui.stope(e)}),t.elemView.find(".layui-menu li").on("click",function(e){var n=i(this),l=n.data("item")||{},r=l.child&&l.child.length>0;r||"-"===l.type||(t.remove(),"function"==typeof a.click&&a.click(l,n))}),t.elemView.find(V).on("click",function(e){var n=i(this),t=n.parent(),l=t.data("item")||{};"group"===l.type&&a.isAllowSpread&&d.spread(t)}),"mouseenter"===a.trigger&&t.elemView.on("mouseenter",function(){clearTimeout(d.timer)}).on("mouseleave",function(){t.delayRemove()}))},k.prototype.position=function(e){var i=this,n=i.config;lay.position(n.elem[0],i.elemView[0],{position:n.position,e:i.e,clickType:"contextmenu"===n.trigger?"right":null,align:n.align||null})},k.prototype.remove=function(){var e=this,i=(e.config,d.prevElem);i&&(i.data("prevElem")&&i.data("prevElem").data(o+"_opened",!1),i.remove())},k.prototype.delayRemove=function(){var e=this,i=e.config;clearTimeout(d.timer),d.timer=setTimeout(function(){e.remove()},i.delay)},k.prototype.events=function(){var e=this,i=e.config;"hover"===i.trigger&&(i.trigger="mouseenter"),e.prevElem&&e.prevElem.off(i.trigger,e.prevElemCallback),e.prevElem=i.elem,e.prevElemCallback=function(n){clearTimeout(d.timer),e.e=n,e.render(),n.preventDefault(),"function"==typeof i.ready&&i.ready(e.elemView,i.elem,e.e.target)},i.elem.on(i.trigger,e.prevElemCallback),"mouseenter"===i.trigger&&i.elem.on("mouseleave",function(){e.delayRemove()})},d.that={},d.getThis=function(e){var i=d.that[e];return i||t.error(e?r+" instance with ID '"+e+"' not found":"ID argument required"),i},d.spread=function(e){var i=e.children("."+p).find(".layui-icon");e.hasClass(m)?(e.removeClass(m).addClass(c),i.removeClass("layui-icon-down").addClass("layui-icon-up")):(e.removeClass(c).addClass(m),i.removeClass("layui-icon-up").addClass("layui-icon-down"))},!function(){var e=i(window),n=i(document);e.on("resize",function(){if(u.thisId){var e=d.getThis(u.thisId);if(e){if(!e.elemView[0]||!i("."+s)[0])return!1;var n=e.config;"contextmenu"===n.trigger?e.remove():e.position()}}}),n.on(l,function(e){if(u.thisId){var i=d.getThis(u.thisId);if(i){var n=i.config;!lay.isTopElem(n.elem[0])&&"contextmenu"!==n.trigger&&(e.target===n.elem[0]||n.elem.find(e.target)[0]||e.target===i.elemView[0]||i.elemView&&i.elemView.find(e.target)[0])||i.remove()}}});var t=".layui-menu:not(.layui-dropdown-menu) li";n.on("click",t,function(e){var n=i(this),t=n.parents(".layui-menu").eq(0),a=n.hasClass(y)||n.hasClass(f),l=t.attr("lay-filter")||t.attr("id"),o=lay.options(this);n.hasClass(v)||a||(t.find("."+g).removeClass(g),t.find("."+h).removeClass(h),n.addClass(g),n.parents("."+f).addClass(h),layui.event.call(this,r,"click("+l+")",o))}),n.on("click",t+V,function(e){var n=i(this),t=n.parents("."+y+":eq(0)"),a=lay.options(t[0]);"isAllowSpread"in a&&!a.isAllowSpread||d.spread(t)});var a=".layui-menu ."+f;n.on("mouseenter",a,function(n){var t=i(this),a=t.find("."+w);if(a[0]){var l=a[0].getBoundingClientRect();l.right>e.width()&&(a.addClass(C),l=a[0].getBoundingClientRect(),l.left<0&&a.removeClass(C)),l.bottom>e.height()&&a.eq(0).css("margin-top",-(l.bottom-e.height()))}}).on("mouseleave",a,function(e){var n=i(this),t=n.children("."+w);t.removeClass(C),t.css("margin-top",0)})}(),u.reload=function(e,i){var n=d.getThis(e);return n?(n.reload(i),d.call(n)):this},u.render=function(e){var i=new k(e);return d.call(i)},e(r,u)});layui.define("jquery",function(e){"use strict";var i=layui.jquery,t={config:{},index:layui.slider?layui.slider.index+1e4:0,set:function(e){var t=this;return t.config=i.extend({},t.config,e),t},on:function(e,i){return layui.onevent.call(this,n,e,i)}},a=function(){var e=this,i=e.config;return{setValue:function(t,a){return i.value=t,e.slide("set",t,a||0)},config:i}},n="slider",l="layui-disabled",s="layui-slider",r="layui-slider-bar",o="layui-slider-wrap",u="layui-slider-wrap-btn",d="layui-slider-tips",v="layui-slider-input",c="layui-slider-input-txt",p="layui-slider-input-btn",m="layui-slider-hover",f=function(e){var a=this;a.index=++t.index,a.config=i.extend({},a.config,t.config,e),a.render()};f.prototype.config={type:"default",min:0,max:100,value:0,step:1,showstep:!1,tips:!0,input:!1,range:!1,height:200,disabled:!1,theme:"#009688"},f.prototype.render=function(){var e=this,t=e.config;if(t.step<1&&(t.step=1),t.maxt.min?a:t.min,t.value[1]=n>t.min?n:t.min,t.value[0]=t.value[0]>t.max?t.max:t.value[0],t.value[1]=t.value[1]>t.max?t.max:t.value[1];var r=Math.floor((t.value[0]-t.min)/(t.max-t.min)*100),v=Math.floor((t.value[1]-t.min)/(t.max-t.min)*100),p=v-r+"%";r+="%",v+="%"}else{"object"==typeof t.value&&(t.value=Math.min.apply(null,t.value)),t.valuet.max&&(t.value=t.max);var p=Math.floor((t.value-t.min)/(t.max-t.min)*100)+"%"}var m=t.disabled?"#c2c2c2":t.theme,f='
              '+(t.tips?'
              ':"")+'
              '+(t.range?'
              ':"")+"
              ",h=i(t.elem),y=h.next("."+s);if(y[0]&&y.remove(),e.elemTemp=i(f),t.range?(e.elemTemp.find("."+o).eq(0).data("value",t.value[0]),e.elemTemp.find("."+o).eq(1).data("value",t.value[1])):e.elemTemp.find("."+o).data("value",t.value),h.html(e.elemTemp),"vertical"===t.type&&e.elemTemp.height(t.height+"px"),t.showstep){for(var g=(t.max-t.min)/t.step,b="",x=1;x
              ')}e.elemTemp.append(b)}if(t.input&&!t.range){var w=i('
              ');h.css("position","relative"),h.append(w),h.find("."+c).children("input").val(t.value),"vertical"===t.type?w.css({left:0,top:-48}):e.elemTemp.css("margin-right",w.outerWidth()+15)}t.disabled?(e.elemTemp.addClass(l),e.elemTemp.find("."+u).addClass(l)):e.slide(),e.elemTemp.find("."+u).on("mouseover",function(){var a="vertical"===t.type?t.height:e.elemTemp[0].offsetWidth,n=e.elemTemp.find("."+o),l="vertical"===t.type?a-i(this).parent()[0].offsetTop-n.height():i(this).parent()[0].offsetLeft,s=l/a*100,r=i(this).parent().data("value"),u=t.setTips?t.setTips(r):r;e.elemTemp.find("."+d).html(u),"vertical"===t.type?e.elemTemp.find("."+d).css({bottom:s+"%","margin-bottom":"20px",display:"inline-block"}):e.elemTemp.find("."+d).css({left:s+"%",display:"inline-block"})}).on("mouseout",function(){e.elemTemp.find("."+d).css("display","none")})},f.prototype.slide=function(e,t,a){var n=this,l=n.config,s=n.elemTemp,f=function(){return"vertical"===l.type?l.height:s[0].offsetWidth},h=s.find("."+o),y=s.next("."+v),g=y.children("."+c).children("input").val(),b=100/((l.max-l.min)/Math.ceil(l.step)),x=function(e,i){e=Math.ceil(e)*b>100?Math.ceil(e)*b:Math.round(e)*b,e=e>100?100:e,h.eq(i).css("vertical"===l.type?"bottom":"left",e+"%");var t=T(h[0].offsetLeft),a=l.range?T(h[1].offsetLeft):0;"vertical"===l.type?(s.find("."+d).css({bottom:e+"%","margin-bottom":"20px"}),t=T(f()-h[0].offsetTop-h.height()),a=l.range?T(f()-h[1].offsetTop-h.height()):0):s.find("."+d).css("left",e+"%"),t=t>100?100:t,a=a>100?100:a;var n=Math.min(t,a),o=Math.abs(t-a);"vertical"===l.type?s.find("."+r).css({height:o+"%",bottom:n+"%"}):s.find("."+r).css({width:o+"%",left:n+"%"});var u=l.min+Math.round((l.max-l.min)*e/100);if(g=u,y.children("."+c).children("input").val(g),h.eq(i).data("value",u),s.find("."+d).html(l.setTips?l.setTips(u):u),l.range){var v=[h.eq(0).data("value"),h.eq(1).data("value")];v[0]>v[1]&&v.reverse()}l.change&&l.change(l.range?v:u)},T=function(e){var i=e/f()*100/b,t=Math.round(i)*b;return e==f()&&(t=Math.ceil(i)*b),t},w=i(['
              f()&&(r=f());var o=r/f()*100/b;x(o,e),t.addClass(m),s.find("."+d).show(),i.preventDefault()},o=function(){t.removeClass(m),s.find("."+d).hide()};M(r,o)})}),s.on("click",function(e){var t=i("."+u);if(!t.is(event.target)&&0===t.has(event.target).length&&t.length){var a,n="vertical"===l.type?f()-e.clientY+i(this).offset().top:e.clientX-i(this).offset().left;n<0&&(n=0),n>f()&&(n=f());var s=n/f()*100/b;a=l.range?"vertical"===l.type?Math.abs(n-parseInt(i(h[0]).css("bottom")))>Math.abs(n-parseInt(i(h[1]).css("bottom")))?1:0:Math.abs(n-h[0].offsetLeft)>Math.abs(n-h[1].offsetLeft)?1:0:0,x(s,a),e.preventDefault()}}),y.children("."+p).children("i").each(function(e){i(this).on("click",function(){g=y.children("."+c).children("input").val(),g=1==e?g-l.stepl.max?l.max:Number(g)+l.step;var i=(g-l.min)/(l.max-l.min)*100/b;x(i,0)})});var q=function(){var e=this.value;e=isNaN(e)?0:e,e=el.max?l.max:e,this.value=e;var i=(e-l.min)/(l.max-l.min)*100/b;x(i,0)};y.children("."+c).children("input").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),q.call(this))}).on("change",q)},f.prototype.events=function(){var e=this;e.config},t.render=function(e){var i=new f(e);return a.call(i)},e(n,t)});layui.define(["jquery","lay"],function(e){"use strict";var i=layui.jquery,r=layui.lay,o=layui.device(),n=o.mobile?"click":"mousedown",l={config:{},index:layui.colorpicker?layui.colorpicker.index+1e4:0,set:function(e){var r=this;return r.config=i.extend({},r.config,e),r},on:function(e,i){return layui.onevent.call(this,"colorpicker",e,i)}},t=function(){var e=this,i=e.config;return{config:i}},c="colorpicker",a="layui-show",s="layui-colorpicker",f=".layui-colorpicker-main",d="layui-icon-down",u="layui-icon-close",p="layui-colorpicker-trigger-span",g="layui-colorpicker-trigger-i",v="layui-colorpicker-side",h="layui-colorpicker-side-slider",b="layui-colorpicker-basis",k="layui-colorpicker-alpha-bgcolor",y="layui-colorpicker-alpha-slider",m="layui-colorpicker-basis-cursor",x="layui-colorpicker-main-input",P=function(e){var i={h:0,s:0,b:0},r=Math.min(e.r,e.g,e.b),o=Math.max(e.r,e.g,e.b),n=o-r;return i.b=o,i.s=0!=o?255*n/o:0,0!=i.s?e.r==o?i.h=(e.g-e.b)/n:e.g==o?i.h=2+(e.b-e.r)/n:i.h=4+(e.r-e.g)/n:i.h=-1,o==r&&(i.h=0),i.h*=60,i.h<0&&(i.h+=360),i.s*=100/255,i.b*=100/255,i},C=function(e){var e=e.indexOf("#")>-1?e.substring(1):e;if(3==e.length){var i=e.split("");e=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]}e=parseInt(e,16);var r={r:e>>16,g:(65280&e)>>8,b:255&e};return P(r)},B=function(e){var i={},r=e.h,o=255*e.s/100,n=255*e.b/100;if(0==o)i.r=i.g=i.b=n;else{var l=n,t=(255-o)*n/255,c=(l-t)*(r%60)/60;360==r&&(r=0),r<60?(i.r=l,i.b=t,i.g=t+c):r<120?(i.g=l,i.b=t,i.r=l-c):r<180?(i.g=l,i.r=t,i.b=t+c):r<240?(i.b=l,i.r=t,i.g=l-c):r<300?(i.b=l,i.g=t,i.r=t+c):r<360?(i.r=l,i.g=t,i.b=l-c):(i.r=0,i.g=0,i.b=0)}return{r:Math.round(i.r),g:Math.round(i.g),b:Math.round(i.b)}},w=function(e){var r=B(e),o=[r.r.toString(16),r.g.toString(16),r.b.toString(16)];return i.each(o,function(e,i){1==i.length&&(o[e]="0"+i)}),o.join("")},D=function(e){var i=/[0-9]{1,3}/g,r=e.match(i)||[];return{r:r[0],g:r[1],b:r[2]}},j=i(window),E=i(document),F=function(e){var r=this;r.index=++l.index,r.config=i.extend({},r.config,l.config,e),r.render()};F.prototype.config={color:"",size:null,alpha:!1,format:"hex",predefine:!1,colors:["#009688","#5FB878","#1E9FFF","#FF5722","#FFB800","#01AAED","#999","#c00","#ff8c00","#ffd700","#90ee90","#00ced1","#1e90ff","#c71585","rgb(0, 186, 189)","rgb(255, 120, 0)","rgb(250, 212, 0)","#393D49","rgba(0,0,0,.5)","rgba(255, 69, 0, 0.68)","rgba(144, 240, 144, 0.5)","rgba(31, 147, 255, 0.73)"]},F.prototype.render=function(){var e=this,r=e.config,o=i(['
              ',"",'3&&(r.alpha&&"rgb"==r.format||(e="#"+w(P(D(r.color))))),"background: "+e):e}()+'">','',"","","
              "].join("")),n=i(r.elem);r.size&&o.addClass("layui-colorpicker-"+r.size),n.addClass("layui-inline").html(e.elemColorBox=o),e.color=e.elemColorBox.find("."+p)[0].style.background,e.events()},F.prototype.renderPicker=function(){var e=this,r=e.config,o=e.elemColorBox[0],n=e.elemPicker=i(['
              ','
              ','
              ','
              ','
              ','
              ',"
              ",'
              ','
              ',"
              ","
              ",'
              ','
              ','
              ',"
              ","
              ",function(){if(r.predefine){var e=['
              '];return layui.each(r.colors,function(i,r){e.push(['
              ','
              ',"
              "].join(""))}),e.push("
              "),e.join("")}return""}(),'
              ','
              ','',"
              ",'
              ','','',"","
              "].join(""));e.elemColorBox.find("."+p)[0];i(f)[0]&&i(f).data("index")==e.index?e.removePicker(F.thisElemInd):(e.removePicker(F.thisElemInd),i("body").append(n)),F.thisElemInd=e.index,F.thisColor=o.style.background,e.position(),e.pickerEvents()},F.prototype.removePicker=function(e){var r=this;r.config;return i("#layui-colorpicker"+(e||r.index)).remove(),r},F.prototype.position=function(){var e=this,i=e.config;return r.position(e.bindElem||e.elemColorBox[0],e.elemPicker[0],{position:i.position,align:"center"}),e},F.prototype.val=function(){var e=this,i=(e.config,e.elemColorBox.find("."+p)),r=e.elemPicker.find("."+x),o=i[0],n=o.style.backgroundColor;if(n){var l=P(D(n)),t=i.attr("lay-type");if(e.select(l.h,l.s,l.b),"torgb"===t&&r.find("input").val(n),"rgba"===t){var c=D(n);if(3==(n.match(/[0-9]{1,3}/g)||[]).length)r.find("input").val("rgba("+c.r+", "+c.g+", "+c.b+", 1)"),e.elemPicker.find("."+y).css("left",280);else{r.find("input").val(n);var a=280*n.slice(n.lastIndexOf(",")+1,n.length-1);e.elemPicker.find("."+y).css("left",a)}e.elemPicker.find("."+k)[0].style.background="linear-gradient(to right, rgba("+c.r+", "+c.g+", "+c.b+", 0), rgb("+c.r+", "+c.g+", "+c.b+"))"}}else e.select(0,100,100),r.find("input").val(""),e.elemPicker.find("."+k)[0].style.background="",e.elemPicker.find("."+y).css("left",280)},F.prototype.side=function(){var e=this,r=e.config,o=e.elemColorBox.find("."+p),n=o.attr("lay-type"),l=e.elemPicker.find("."+v),t=e.elemPicker.find("."+h),c=e.elemPicker.find("."+b),a=e.elemPicker.find("."+m),s=e.elemPicker.find("."+k),f=e.elemPicker.find("."+y),C=t[0].offsetTop/180*360,w=100-(a[0].offsetTop+3)/180*100,E=(a[0].offsetLeft+3)/260*100,F=Math.round(f[0].offsetLeft/280*100)/100,H=e.elemColorBox.find("."+g),M=e.elemPicker.find(".layui-colorpicker-pre").children("div"),Y=function(i,l,t,c){e.select(i,l,t);var a=B({h:i,s:l,b:t});if(H.addClass(d).removeClass(u),o[0].style.background="rgb("+a.r+", "+a.g+", "+a.b+")","torgb"===n&&e.elemPicker.find("."+x).find("input").val("rgb("+a.r+", "+a.g+", "+a.b+")"),"rgba"===n){var p=0;p=280*c,f.css("left",p),e.elemPicker.find("."+x).find("input").val("rgba("+a.r+", "+a.g+", "+a.b+", "+c+")"),o[0].style.background="rgba("+a.r+", "+a.g+", "+a.b+", "+c+")",s[0].style.background="linear-gradient(to right, rgba("+a.r+", "+a.g+", "+a.b+", 0), rgb("+a.r+", "+a.g+", "+a.b+"))"}r.change&&r.change(e.elemPicker.find("."+x).find("input").val())},I=i(['
              '].join("")),L=function(e){i("#LAY-colorpicker-moving")[0]||i("body").append(I),I.on("mousemove",e),I.on("mouseup",function(){I.remove()}).on("mouseleave",function(){I.remove()})};t.on("mousedown",function(e){var i=this.offsetTop,r=e.clientY,o=function(e){var o=i+(e.clientY-r),n=l[0].offsetHeight;o<0&&(o=0),o>n&&(o=n);var t=o/180*360;C=t,Y(t,E,w,F),e.preventDefault()};L(o),e.preventDefault()}),l.on("click",function(e){var r=e.clientY-i(this).offset().top;r<0&&(r=0),r>this.offsetHeight&&(r=this.offsetHeight);var o=r/180*360;C=o,Y(o,E,w,F),e.preventDefault()}),a.on("mousedown",function(e){var i=this.offsetTop,r=this.offsetLeft,o=e.clientY,n=e.clientX,l=function(e){var l=i+(e.clientY-o),t=r+(e.clientX-n),a=c[0].offsetHeight-3,s=c[0].offsetWidth-3;l<-3&&(l=-3),l>a&&(l=a),t<-3&&(t=-3),t>s&&(t=s);var f=(t+3)/260*100,d=100-(l+3)/180*100;w=d,E=f,Y(C,f,d,F),e.preventDefault()};layui.stope(e),L(l),e.preventDefault()}),c.on("mousedown",function(e){var r=e.clientY-i(this).offset().top-3+j.scrollTop(),o=e.clientX-i(this).offset().left-3+j.scrollLeft();r<-3&&(r=-3),r>this.offsetHeight-3&&(r=this.offsetHeight-3),o<-3&&(o=-3),o>this.offsetWidth-3&&(o=this.offsetWidth-3);var n=(o+3)/260*100,l=100-(r+3)/180*100;w=l,E=n,Y(C,n,l,F),layui.stope(e),e.preventDefault(),a.trigger(e,"mousedown")}),f.on("mousedown",function(e){var i=this.offsetLeft,r=e.clientX,o=function(e){var o=i+(e.clientX-r),n=s[0].offsetWidth;o<0&&(o=0),o>n&&(o=n);var l=Math.round(o/280*100)/100;F=l,Y(C,E,w,l),e.preventDefault()};L(o),e.preventDefault()}),s.on("click",function(e){var r=e.clientX-i(this).offset().left;r<0&&(r=0),r>this.offsetWidth&&(r=this.offsetWidth);var o=Math.round(r/280*100)/100;F=o,Y(C,E,w,o),e.preventDefault()}),M.each(function(){i(this).on("click",function(){i(this).parent(".layui-colorpicker-pre").addClass("selected").siblings().removeClass("selected");var e,r=this.style.backgroundColor,o=P(D(r)),n=r.slice(r.lastIndexOf(",")+1,r.length-1);C=o.h,E=o.s,w=o.b,3==(r.match(/[0-9]{1,3}/g)||[]).length&&(n=1),F=n,e=280*n,Y(o.h,o.s,o.b,n)})})},F.prototype.select=function(e,i,r,o){var n=this,l=(n.config,w({h:e,s:100,b:100})),t=w({h:e,s:i,b:r}),c=e/360*180,a=180-r/100*180-3,s=i/100*260-3;n.elemPicker.find("."+h).css("top",c),n.elemPicker.find("."+b)[0].style.background="#"+l,n.elemPicker.find("."+m).css({top:a,left:s}),"change"!==o&&n.elemPicker.find("."+x).find("input").val("#"+t)},F.prototype.pickerEvents=function(){var e=this,r=e.config,o=e.elemColorBox.find("."+p),n=e.elemPicker.find("."+x+" input"),l={clear:function(i){o[0].style.background="",e.elemColorBox.find("."+g).removeClass(d).addClass(u),e.color="",r.done&&r.done(""),e.removePicker()},confirm:function(i,l){var t=n.val(),c=t,a={};if(t.indexOf(",")>-1){if(a=P(D(t)),e.select(a.h,a.s,a.b),o[0].style.background=c="#"+w(a),(t.match(/[0-9]{1,3}/g)||[]).length>3&&"rgba"===o.attr("lay-type")){var s=280*t.slice(t.lastIndexOf(",")+1,t.length-1);e.elemPicker.find("."+y).css("left",s),o[0].style.background=t,c=t}}else a=C(t),o[0].style.background=c="#"+w(a),e.elemColorBox.find("."+g).removeClass(u).addClass(d);return"change"===l?(e.select(a.h,a.s,a.b,l),void(r.change&&r.change(c))):(e.color=t,r.done&&r.done(t),void e.removePicker())}};e.elemPicker.on("click","*[colorpicker-events]",function(){var e=i(this),r=e.attr("colorpicker-events");l[r]&&l[r].call(this,e)}),n.on("keyup",function(e){var r=i(this);l.confirm.call(this,r,13===e.keyCode?null:"change")})},F.prototype.events=function(){var e=this,r=e.config,o=e.elemColorBox.find("."+p);e.elemColorBox.on("click",function(){e.renderPicker(),i(f)[0]&&(e.val(),e.side())}),r.elem[0]&&!e.elemColorBox[0].eventHandler&&(E.on(n,function(r){if(!i(r.target).hasClass(s)&&!i(r.target).parents("."+s)[0]&&!i(r.target).hasClass(f.replace(/\./g,""))&&!i(r.target).parents(f)[0]&&e.elemPicker){if(e.color){var n=P(D(e.color));e.select(n.h,n.s,n.b)}else e.elemColorBox.find("."+g).removeClass(d).addClass(u);o[0].style.background=e.color||"",e.removePicker()}}),j.on("resize",function(){return!(!e.elemPicker||!i(f)[0])&&void e.position()}),e.elemColorBox[0].eventHandler=!0)},l.render=function(e){var i=new F(e);return t.call(i)},e(c,l)});layui.define("layer",function(e){"use strict";var t=layui.$,i=layui.layer,a=layui.hint(),n=layui.device(),l="form",r=".layui-form",o="layui-this",s="layui-hide",c="layui-disabled",u=function(){this.config={verify:{required:[/[\S]+/,"\u5fc5\u586b\u9879\u4e0d\u80fd\u4e3a\u7a7a"],phone:[/^1\d{10}$/,"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u624b\u673a\u53f7"],email:[/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,"\u90ae\u7bb1\u683c\u5f0f\u4e0d\u6b63\u786e"],url:[/^(#|(http(s?)):\/\/|\/\/)[^\s]+\.[^\s]+$/,"\u94fe\u63a5\u683c\u5f0f\u4e0d\u6b63\u786e"],number:function(e){if(!e||isNaN(e))return"\u53ea\u80fd\u586b\u5199\u6570\u5b57"},date:[/^(\d{4})[-\/](\d{1}|0\d{1}|1[0-2])([-\/](\d{1}|0\d{1}|[1-2][0-9]|3[0-1]))*$/,"\u65e5\u671f\u683c\u5f0f\u4e0d\u6b63\u786e"],identity:[/(^\d{15}$)|(^\d{17}(x|X|\d)$)/,"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u8eab\u4efd\u8bc1\u53f7"]},autocomplete:null}};u.prototype.set=function(e){var i=this;return t.extend(!0,i.config,e),i},u.prototype.verify=function(e){var i=this;return t.extend(!0,i.config.verify,e),i},u.prototype.on=function(e,t){return layui.onevent.call(this,l,e,t)},u.prototype.val=function(e,i){var a=this,n=t(r+'[lay-filter="'+e+'"]');return n.each(function(e,a){var n=t(this);layui.each(i,function(e,t){var i,a=n.find('[name="'+e+'"]');a[0]&&(i=a[0].type,"checkbox"===i?a[0].checked=t:"radio"===i?a.each(function(){this.value==t&&(this.checked=!0)}):a.val(t))})}),f.render(null,e),a.getValue(e)},u.prototype.getValue=function(e,i){i=i||t(r+'[lay-filter="'+e+'"]').eq(0);var a={},n={},l=i.find("input,select,textarea");return layui.each(l,function(e,i){var l;t(this);if(i.name=(i.name||"").replace(/^\s*|\s*&/,""),i.name){if(/^.*\[\]$/.test(i.name)){var r=i.name.match(/^(.*)\[\]$/g)[0];a[r]=0|a[r],l=i.name.replace(/^(.*)\[\]$/,"$1["+a[r]++ +"]")}/^checkbox|radio$/.test(i.type)&&!i.checked||(n[l||i.name]=i.value)}}),n},u.prototype.render=function(e,i){var n=this,u=n.config,d=t(r+function(){return i?'[lay-filter="'+i+'"]':""}()),f={input:function(){var e=d.find("input,textarea");u.autocomplete&&e.attr("autocomplete",u.autocomplete)},select:function(){var e,i="\u8bf7\u9009\u62e9",a="layui-form-select",n="layui-select-title",r="layui-select-none",u="",f=d.find("select"),v=function(i,l){t(i.target).parent().hasClass(n)&&!l||(t("."+a).removeClass(a+"ed "+a+"up"),e&&u&&e.val(u)),e=null},y=function(i,d,f){var y,p=t(this),m=i.find("."+n),g=m.find("input"),k=i.find("dl"),x=k.children("dd"),b=this.selectedIndex;if(!d){var C=function(){var e=i.offset().top+i.outerHeight()+5-h.scrollTop(),t=k.outerHeight();b=p[0].selectedIndex,i.addClass(a+"ed"),x.removeClass(s),y=null,x.eq(b).addClass(o).siblings().removeClass(o),e+t>h.height()&&e>=t&&i.addClass(a+"up"),T()},w=function(e){i.removeClass(a+"ed "+a+"up"),g.blur(),y=null,e||$(g.val(),function(e){var i=p[0].selectedIndex;e&&(u=t(p[0].options[i]).html(),0===i&&u===g.attr("placeholder")&&(u=""),g.val(u||""))})},T=function(){var e=k.children("dd."+o);if(e[0]){var t=e.position().top,i=k.height(),a=e.height();t>i&&k.scrollTop(t+k.scrollTop()-i+a-5),t<0&&k.scrollTop(t+k.scrollTop()-5)}};m.on("click",function(e){i.hasClass(a+"ed")?w():(v(e,!0),C()),k.find("."+r).remove()}),m.find(".layui-edge").on("click",function(){g.focus()}),g.on("keyup",function(e){var t=e.keyCode;9===t&&C()}).on("keydown",function(e){var t=e.keyCode;9===t&&w();var i=function(t,a){var n,l;e.preventDefault();var r=function(){var e=k.children("dd."+o);if(k.children("dd."+s)[0]&&"next"===t){var i=k.children("dd:not(."+s+",."+c+")"),n=i.eq(0).index();if(n>=0&&n\u65e0\u5339\u914d\u9879

              '):k.find("."+r).remove()},"keyup"),""===t&&k.find("."+r).remove(),void T())};f&&g.on("keyup",q).on("blur",function(i){var a=p[0].selectedIndex;e=g,u=t(p[0].options[a]).html(),0===a&&u===g.attr("placeholder")&&(u=""),setTimeout(function(){$(g.val(),function(e){u||g.val("")},"blur")},200)}),x.on("click",function(){var e=t(this),a=e.attr("lay-value"),n=p.attr("lay-filter");return!e.hasClass(c)&&(e.hasClass("layui-select-tips")?g.val(""):(g.val(e.text()),e.addClass(o)),e.siblings().removeClass(o),p.val(a).removeClass("layui-form-danger"),layui.event.call(this,l,"select("+n+")",{elem:p[0],value:a,othis:i}),w(!0),!1)}),i.find("dl>dt").on("click",function(e){return!1}),t(document).off("click",v).on("click",v)}};f.each(function(e,l){var r=t(this),s=r.next("."+a),u=this.disabled,d=l.value,f=t(l.options[l.selectedIndex]),v=l.options[0];if("string"==typeof r.attr("lay-ignore"))return r.show();var h="string"==typeof r.attr("lay-search"),p=v?v.value?i:v.innerHTML||i:i,m=t(['
              ','
              ','','
              ','
              ',function(e){var a=[];return layui.each(e,function(e,n){0!==e||n.value?"optgroup"===n.tagName.toLowerCase()?a.push("
              "+n.label+"
              "):a.push('
              '+t.trim(n.innerHTML)+"
              "):a.push('
              '+t.trim(n.innerHTML||i)+"
              ")}),0===a.length&&a.push('
              \u6ca1\u6709\u9009\u9879
              '),a.join("")}(r.find("*"))+"
              ","
              "].join(""));s[0]&&s.remove(),r.after(m),y.call(this,m,u,h)})},checkbox:function(){var e={checkbox:["layui-form-checkbox","layui-form-checked","checkbox"],_switch:["layui-form-switch","layui-form-onswitch","switch"]},i=d.find("input[type=checkbox]"),a=function(e,i){var a=t(this);e.on("click",function(){var t=a.attr("lay-filter"),n=(a.attr("lay-text")||"").split("|");a[0].disabled||(a[0].checked?(a[0].checked=!1,e.removeClass(i[1]).find("em").text(n[1])):(a[0].checked=!0,e.addClass(i[1]).find("em").text(n[0])),layui.event.call(a[0],l,i[2]+"("+t+")",{elem:a[0],value:a[0].value,othis:e}))})};i.each(function(i,n){var l=t(this),r=l.attr("lay-skin"),o=(l.attr("lay-text")||"").split("|"),s=this.disabled;"switch"===r&&(r="_"+r);var u=e[r]||e.checkbox;if("string"==typeof l.attr("lay-ignore"))return l.show();var d=l.next("."+u[0]),f=t(['
              ",function(){var e=n.title.replace(/\s/g,""),t={checkbox:[e?""+n.title+"":"",''].join(""),_switch:""+((n.checked?o[0]:o[1])||"")+""};return t[r]||t.checkbox}(),"
              "].join(""));d[0]&&d.remove(),l.after(f),a.call(this,f,u)})},radio:function(){var e="layui-form-radio",i=["",""],a=d.find("input[type=radio]"),n=function(a){var n=t(this),o="layui-anim-scaleSpring";a.on("click",function(){var s=n[0].name,c=n.parents(r),u=n.attr("lay-filter"),d=c.find("input[name="+s.replace(/(\.|#|\[|\])/g,"\\$1")+"]");n[0].disabled||(layui.each(d,function(){var a=t(this).next("."+e);this.checked=!1,a.removeClass(e+"ed"),a.find(".layui-icon").removeClass(o).html(i[1])}),n[0].checked=!0,a.addClass(e+"ed"),a.find(".layui-icon").addClass(o).html(i[0]),layui.event.call(n[0],l,"radio("+u+")",{elem:n[0],value:n[0].value,othis:a}))})};a.each(function(a,l){var r=t(this),o=r.next("."+e),s=this.disabled;if("string"==typeof r.attr("lay-ignore"))return r.show();o[0]&&o.remove();var u=t(['
              ',''+i[l.checked?0:1]+"","
              "+function(){var e=l.title||"";return"string"==typeof r.next().attr("lay-radio")&&(e=r.next().html()),e}()+"
              ","
              "].join(""));r.after(u),n.call(this,u)})}};return e?f[e]?f[e]():a.error('\u4e0d\u652f\u6301\u7684 "'+e+'" \u8868\u5355\u6e32\u67d3'):layui.each(f,function(e,t){t()}),n};var d=function(){var e=null,a=f.config.verify,o="layui-form-danger",s={},c=t(this),u=c.parents(r).eq(0),d=u.find("*[lay-verify]"),h=c.parents("form")[0],y=c.attr("lay-filter");return layui.each(d,function(l,r){var s=t(this),c=s.attr("lay-verify").split("|"),u=s.attr("lay-verType"),d=s.val();if(s.removeClass(o),layui.each(c,function(t,l){var c,f="",h="function"==typeof a[l];if(a[l]){var c=h?f=a[l](d,r):!a[l][0].test(d),y="select"===r.tagName.toLowerCase()||/^checkbox|radio$/.test(r.type);if(f=f||a[l][1],"required"===l&&(f=s.attr("lay-reqText")||f),c)return"tips"===u?i.tips(f,function(){return"string"!=typeof s.attr("lay-ignore")&&y?s.next():s}(),{tips:1}):"alert"===u?i.alert(f,{title:"\u63d0\u793a",shadeClose:!0}):/\bstring|number\b/.test(typeof f)&&i.msg(f,{icon:5,shift:6}),n.mobile?v.scrollTop(function(){try{return(y?s.next():s).offset().top-15}catch(e){return 0}}()):setTimeout(function(){(y?s.next().find("input"):r).focus()},7),s.addClass(o),e=!0}}),e)return e}),!e&&(s=f.getValue(null,u),layui.event.call(this,l,"submit("+y+")",{elem:this,form:h,field:s}))},f=new u,v=t(document),h=t(window);t(function(){f.render()}),v.on("reset",r,function(){var e=t(this).attr("lay-filter");setTimeout(function(){f.render(null,e)},50)}),v.on("submit",r,d).on("click","*[lay-submit]",d),e(l,f)});layui.define("form",function(e){"use strict";var i=layui.$,a=layui.form,n=layui.layer,t="tree",r={config:{},index:layui[t]?layui[t].index+1e4:0,set:function(e){var a=this;return a.config=i.extend({},a.config,e),a},on:function(e,i){return layui.onevent.call(this,t,e,i)}},l=function(){var e=this,i=e.config,a=i.id||e.index;return l.that[a]=e,l.config[a]=i,{config:i,reload:function(i){e.reload.call(e,i)},getChecked:function(){return e.getChecked.call(e)},setChecked:function(i){return e.setChecked.call(e,i)}}},c="layui-hide",d="layui-disabled",s="layui-tree-set",o="layui-tree-iconClick",h="layui-icon-addition",u="layui-icon-subtraction",p="layui-tree-entry",f="layui-tree-main",y="layui-tree-txt",v="layui-tree-pack",C="layui-tree-spread",k="layui-tree-setLineShort",m="layui-tree-showLine",x="layui-tree-lineExtend",b=function(e){var a=this;a.index=++r.index,a.config=i.extend({},a.config,r.config,e),a.render()};b.prototype.config={data:[],showCheckbox:!1,showLine:!0,accordion:!1,onlyIconControl:!1,isJump:!1,edit:!1,text:{defaultNodeName:"\u672a\u547d\u540d",none:"\u65e0\u6570\u636e"}},b.prototype.reload=function(e){var a=this;layui.each(e,function(e,i){"array"===layui._typeof(i)&&delete a.config[e]}),a.config=i.extend(!0,{},a.config,e),a.render()},b.prototype.render=function(){var e=this,a=e.config;e.checkids=[];var n=i('
              ');e.tree(n);var t=a.elem=i(a.elem);if(t[0]){if(e.key=a.id||e.index,e.elem=n,e.elemNone=i('
              '+a.text.none+"
              "),t.html(e.elem),0==e.elem.find(".layui-tree-set").length)return e.elem.append(e.elemNone);a.showCheckbox&&e.renderForm("checkbox"),e.elem.find(".layui-tree-set").each(function(){var e=i(this);e.parent(".layui-tree-pack")[0]||e.addClass("layui-tree-setHide"),!e.next()[0]&&e.parents(".layui-tree-pack").eq(1).hasClass("layui-tree-lineExtend")&&e.addClass(k),e.next()[0]||e.parents(".layui-tree-set").eq(0).next()[0]||e.addClass(k)}),e.events()}},b.prototype.renderForm=function(e){a.render(e,"LAY-tree-"+this.index)},b.prototype.tree=function(e,a){var n=this,t=n.config,r=a||t.data;layui.each(r,function(a,r){var l=r.children&&r.children.length>0,o=i('
              "),h=i(['
              ','
              ','
              ',function(){return t.showLine?l?'':'':''}(),function(){return t.showCheckbox?'':""}(),function(){return t.isJump&&r.href?''+(r.title||r.label||t.text.defaultNodeName)+"":''+(r.title||r.label||t.text.defaultNodeName)+""}(),"
              ",function(){if(!t.edit)return"";var e={add:'',update:'',del:''},i=['
              '];return t.edit===!0&&(t.edit=["update","del"]),"object"==typeof t.edit?(layui.each(t.edit,function(a,n){i.push(e[n]||"")}),i.join("")+"
              "):void 0}(),"
              "].join(""));l&&(h.append(o),n.tree(o,r.children)),e.append(h),h.prev("."+s)[0]&&h.prev().children(".layui-tree-pack").addClass("layui-tree-showLine"),l||h.parent(".layui-tree-pack").addClass("layui-tree-lineExtend"),n.spread(h,r),t.showCheckbox&&(r.checked&&n.checkids.push(r.id),n.checkClick(h,r)),t.edit&&n.operate(h,r)})},b.prototype.spread=function(e,a){var n=this,t=n.config,r=e.children("."+p),l=r.children("."+f),c=r.find("."+o),k=r.find("."+y),m=t.onlyIconControl?c:l,x="";m.on("click",function(i){var a=e.children("."+v),n=m.children(".layui-icon")[0]?m.children(".layui-icon"):m.find(".layui-tree-icon").children(".layui-icon");if(a[0]){if(e.hasClass(C))e.removeClass(C),a.slideUp(200),n.removeClass(u).addClass(h);else if(e.addClass(C),a.slideDown(200),n.addClass(u).removeClass(h),t.accordion){var r=e.siblings("."+s);r.removeClass(C),r.children("."+v).slideUp(200),r.find(".layui-tree-icon").children(".layui-icon").removeClass(u).addClass(h)}}else x="normal"}),k.on("click",function(){var n=i(this);n.hasClass(d)||(x=e.hasClass(C)?t.onlyIconControl?"open":"close":t.onlyIconControl?"close":"open",t.click&&t.click({elem:e,state:x,data:a}))})},b.prototype.setCheckbox=function(e,i,a){var n=this,t=(n.config,a.prop("checked"));if(!a.prop("disabled")){if("object"==typeof i.children||e.find("."+v)[0]){var r=e.find("."+v).find('input[same="layuiTreeCheck"]');r.each(function(){this.disabled||(this.checked=t)})}var l=function(e){if(e.parents("."+s)[0]){var i,a=e.parent("."+v),n=a.parent(),r=a.prev().find('input[same="layuiTreeCheck"]');t?r.prop("checked",t):(a.find('input[same="layuiTreeCheck"]').each(function(){this.checked&&(i=!0)}),i||r.prop("checked",!1)),l(n)}};l(e),n.renderForm("checkbox")}},b.prototype.checkClick=function(e,a){var n=this,t=n.config,r=e.children("."+p),l=r.children("."+f);l.on("click",'input[same="layuiTreeCheck"]+',function(r){layui.stope(r);var l=i(this).prev(),c=l.prop("checked");l.prop("disabled")||(n.setCheckbox(e,a,l),t.oncheck&&t.oncheck({elem:e,checked:c,data:a}))})},b.prototype.operate=function(e,a){var t=this,r=t.config,l=e.children("."+p),d=l.children("."+f);l.children(".layui-tree-btnGroup").on("click",".layui-icon",function(l){layui.stope(l);var f=i(this).data("type"),b=e.children("."+v),g={data:a,type:f,elem:e};if("add"==f){b[0]||(r.showLine?(d.find("."+o).addClass("layui-tree-icon"),d.find("."+o).children(".layui-icon").addClass(h).removeClass("layui-icon-file")):d.find(".layui-tree-iconArrow").removeClass(c),e.append('
              '));var w=r.operate&&r.operate(g),N={};if(N.title=r.text.defaultNodeName,N.id=w,t.tree(e.children("."+v),[N]),r.showLine)if(b[0])b.hasClass(x)||b.addClass(x),e.find("."+v).each(function(){i(this).children("."+s).last().addClass(k)}),b.children("."+s).last().prev().hasClass(k)?b.children("."+s).last().prev().removeClass(k):b.children("."+s).last().removeClass(k),!e.parent("."+v)[0]&&e.next()[0]&&b.children("."+s).last().removeClass(k);else{var T=e.siblings("."+s),L=1,I=e.parent("."+v);layui.each(T,function(e,a){i(a).children("."+v)[0]||(L=0)}),1==L?(T.children("."+v).addClass(m),T.children("."+v).children("."+s).removeClass(k),e.children("."+v).addClass(m),I.removeClass(x),I.children("."+s).last().children("."+v).children("."+s).last().addClass(k)):e.children("."+v).children("."+s).addClass(k)}if(!r.showCheckbox)return;if(d.find('input[same="layuiTreeCheck"]')[0].checked){var A=e.children("."+v).children("."+s).last();A.find('input[same="layuiTreeCheck"]')[0].checked=!0}t.renderForm("checkbox")}else if("update"==f){var F=d.children("."+y).html();d.children("."+y).html(""),d.append(''),d.children(".layui-tree-editInput").val(F).focus();var j=function(e){var i=e.val().trim();i=i?i:r.text.defaultNodeName,e.remove(),d.children("."+y).html(i),g.data.title=i,r.operate&&r.operate(g)};d.children(".layui-tree-editInput").blur(function(){j(i(this))}),d.children(".layui-tree-editInput").on("keydown",function(e){13===e.keyCode&&(e.preventDefault(),j(i(this)))})}else n.confirm('\u786e\u8ba4\u5220\u9664\u8be5\u8282\u70b9 "'+(a.title||"")+'" \u5417\uff1f',function(a){if(r.operate&&r.operate(g),g.status="remove",n.close(a),!e.prev("."+s)[0]&&!e.next("."+s)[0]&&!e.parent("."+v)[0])return e.remove(),void t.elem.append(t.elemNone);if(e.siblings("."+s).children("."+p)[0]){if(r.showCheckbox){var l=function(e){if(e.parents("."+s)[0]){var a=e.siblings("."+s).children("."+p),n=e.parent("."+v).prev(),r=n.find('input[same="layuiTreeCheck"]')[0],c=1,d=0;0==r.checked&&(a.each(function(e,a){var n=i(a).find('input[same="layuiTreeCheck"]')[0];0!=n.checked||n.disabled||(c=0),n.disabled||(d=1)}),1==c&&1==d&&(r.checked=!0,t.renderForm("checkbox"),l(n.parent("."+s))))}};l(e)}if(r.showLine){var d=e.siblings("."+s),h=1,f=e.parent("."+v);layui.each(d,function(e,a){i(a).children("."+v)[0]||(h=0)}),1==h?(b[0]||(f.removeClass(x),d.children("."+v).addClass(m),d.children("."+v).children("."+s).removeClass(k)),e.next()[0]?f.children("."+s).last().children("."+v).children("."+s).last().addClass(k):e.prev().children("."+v).children("."+s).last().addClass(k),e.next()[0]||e.parents("."+s)[1]||e.parents("."+s).eq(0).next()[0]||e.prev("."+s).addClass(k)):!e.next()[0]&&e.hasClass(k)&&e.prev().addClass(k)}}else{var y=e.parent("."+v).prev();if(r.showLine){y.find("."+o).removeClass("layui-tree-icon"),y.find("."+o).children(".layui-icon").removeClass(u).addClass("layui-icon-file");var w=y.parents("."+v).eq(0);w.addClass(x),w.children("."+s).each(function(){i(this).children("."+v).children("."+s).last().addClass(k)})}else y.find(".layui-tree-iconArrow").addClass(c);e.parents("."+s).eq(0).removeClass(C),e.parent("."+v).remove()}e.remove()})})},b.prototype.events=function(){var e=this,a=e.config;e.elem.find(".layui-tree-checkedFirst");e.setChecked(e.checkids),e.elem.find(".layui-tree-search").on("keyup",function(){var n=i(this),t=n.val(),r=n.nextAll(),l=[];r.find("."+y).each(function(){var e=i(this).parents("."+p);if(i(this).html().indexOf(t)!=-1){l.push(i(this).parent());var a=function(e){e.addClass("layui-tree-searchShow"),e.parent("."+v)[0]&&a(e.parent("."+v).parent("."+s))};a(e.parent("."+s))}}),r.find("."+p).each(function(){var e=i(this).parent("."+s);e.hasClass("layui-tree-searchShow")||e.addClass(c)}),0==r.find(".layui-tree-searchShow").length&&e.elem.append(e.elemNone),a.onsearch&&a.onsearch({elem:l})}),e.elem.find(".layui-tree-search").on("keydown",function(){i(this).nextAll().find("."+p).each(function(){var e=i(this).parent("."+s);e.removeClass("layui-tree-searchShow "+c)}),i(".layui-tree-emptyText")[0]&&i(".layui-tree-emptyText").remove()})},b.prototype.getChecked=function(){var e=this,a=e.config,n=[],t=[];e.elem.find(".layui-form-checked").each(function(){n.push(i(this).prev()[0].value)});var r=function(e,a){layui.each(e,function(e,t){layui.each(n,function(e,n){if(t.id==n){var l=i.extend({},t);return delete l.children,a.push(l),t.children&&(l.children=[],r(t.children,l.children)),!0}})})};return r(i.extend({},a.data),t),t},b.prototype.setChecked=function(e){var a=this;a.config;a.elem.find("."+s).each(function(a,n){var t=i(this).data("id"),r=i(n).children("."+p).find('input[same="layuiTreeCheck"]'),l=r.next();if("number"==typeof e){if(t==e)return r[0].checked||l.click(),!1}else"object"==typeof e&&layui.each(e,function(e,i){if(i==t&&!r[0].checked)return l.click(),!0})})},l.that={},l.config={},r.reload=function(e,i){var a=l.that[e];return a.reload(i),l.call(a)},r.getChecked=function(e){var i=l.that[e];return i.getChecked()},r.setChecked=function(e,i){var a=l.that[e];return a.setChecked(i)},r.render=function(e){var i=new b(e);return l.call(i)},e(t,r)});layui.define(["laytpl","form"],function(e){"use strict";var a=layui.$,t=layui.laytpl,i=layui.form,n="transfer",l={config:{},index:layui[n]?layui[n].index+1e4:0,set:function(e){var t=this;return t.config=a.extend({},t.config,e),t},on:function(e,a){return layui.onevent.call(this,n,e,a)}},r=function(){var e=this,a=e.config,t=a.id||e.index;return r.that[t]=e,r.config[t]=a,{config:a,reload:function(a){e.reload.call(e,a)},getData:function(){return e.getData.call(e)}}},c="layui-hide",o="layui-btn-disabled",d="layui-none",s="layui-transfer-box",u="layui-transfer-header",h="layui-transfer-search",f="layui-transfer-active",y="layui-transfer-data",p=function(e){return e=e||{},['
              ','
              ','","
              ","{{# if(d.data.showSearch){ }}",'","{{# } }}",'
                ',"
                "].join("")},v=['
                ',p({index:0,checkAllName:"layTransferLeftCheckAll"}),'
                ','",'","
                ",p({index:1,checkAllName:"layTransferRightCheckAll"}),"
                "].join(""),x=function(e){var t=this;t.index=++l.index,t.config=a.extend({},t.config,l.config,e),t.render()};x.prototype.config={title:["\u5217\u8868\u4e00","\u5217\u8868\u4e8c"],width:200,height:360,data:[],value:[],showSearch:!1,id:"",text:{none:"\u65e0\u6570\u636e",searchNone:"\u65e0\u5339\u914d\u6570\u636e"}},x.prototype.reload=function(e){var t=this;t.config=a.extend({},t.config,e),t.render()},x.prototype.render=function(){var e=this,i=e.config,n=e.elem=a(t(v).render({data:i,index:e.index})),l=i.elem=a(i.elem);l[0]&&(i.data=i.data||[],i.value=i.value||[],e.key=i.id||e.index,l.html(e.elem),e.layBox=e.elem.find("."+s),e.layHeader=e.elem.find("."+u),e.laySearch=e.elem.find("."+h),e.layData=n.find("."+y),e.layBtn=n.find("."+f+" .layui-btn"),e.layBox.css({width:i.width,height:i.height}),e.layData.css({height:function(){return i.height-e.layHeader.outerHeight()-e.laySearch.outerHeight()-2}()}),e.renderData(),e.events())},x.prototype.renderData=function(){var e=this,a=(e.config,[{checkName:"layTransferLeftCheck",views:[]},{checkName:"layTransferRightCheck",views:[]}]);e.parseData(function(e){var t=e.selected?1:0,i=["
              • ",'',"
              • "].join("");a[t].views.push(i),delete e.selected}),e.layData.eq(0).html(a[0].views.join("")),e.layData.eq(1).html(a[1].views.join("")),e.renderCheckBtn()},x.prototype.renderForm=function(e){i.render(e,"LAY-transfer-"+this.index)},x.prototype.renderCheckBtn=function(e){var t=this,i=t.config;e=e||{},t.layBox.each(function(n){var l=a(this),r=l.find("."+y),d=l.find("."+u).find('input[type="checkbox"]'),s=r.find('input[type="checkbox"]'),h=0,f=!1;if(s.each(function(){var e=a(this).data("hide");(this.checked||this.disabled||e)&&h++,this.checked&&!e&&(f=!0)}),d.prop("checked",f&&h===s.length),t.layBtn.eq(n)[f?"removeClass":"addClass"](o),!e.stopNone){var p=r.children("li:not(."+c+")").length;t.noneView(r,p?"":i.text.none)}}),t.renderForm("checkbox")},x.prototype.noneView=function(e,t){var i=a('

                '+(t||"")+"

                ");e.find("."+d)[0]&&e.find("."+d).remove(),t.replace(/\s/g,"")&&e.append(i)},x.prototype.setValue=function(){var e=this,t=e.config,i=[];return e.layBox.eq(1).find("."+y+' input[type="checkbox"]').each(function(){var e=a(this).data("hide");e||i.push(this.value)}),t.value=i,e},x.prototype.parseData=function(e){var t=this,i=t.config,n=[];return layui.each(i.data,function(t,l){l=("function"==typeof i.parseData?i.parseData(l):l)||l,n.push(l=a.extend({},l)),layui.each(i.value,function(e,a){a==l.value&&(l.selected=!0)}),e&&e(l)}),i.data=n,t},x.prototype.getData=function(e){var a=this,t=a.config,i=[];return a.setValue(),layui.each(e||t.value,function(e,a){layui.each(t.data,function(e,t){delete t.selected,a==t.value&&i.push(t)})}),i},x.prototype.events=function(){var e=this,t=e.config;e.elem.on("click",'input[lay-filter="layTransferCheckbox"]+',function(){var t=a(this).prev(),i=t[0].checked,n=t.parents("."+s).eq(0).find("."+y);t[0].disabled||("all"===t.attr("lay-type")&&n.find('input[type="checkbox"]').each(function(){this.disabled||(this.checked=i)}),e.renderCheckBtn({stopNone:!0}))}),e.layBtn.on("click",function(){var i=a(this),n=i.data("index"),l=e.layBox.eq(n),r=[];if(!i.hasClass(o)){e.layBox.eq(n).each(function(t){var i=a(this),n=i.find("."+y);n.children("li").each(function(){var t=a(this),i=t.find('input[type="checkbox"]'),n=i.data("hide");i[0].checked&&!n&&(i[0].checked=!1,l.siblings("."+s).find("."+y).append(t.clone()),t.remove(),r.push(i[0].value)),e.setValue()})}),e.renderCheckBtn();var c=l.siblings("."+s).find("."+h+" input");""===c.val()||c.trigger("keyup"),t.onchange&&t.onchange(e.getData(r),n)}}),e.laySearch.find("input").on("keyup",function(){var i=this.value,n=a(this).parents("."+h).eq(0).siblings("."+y),l=n.children("li");l.each(function(){var e=a(this),t=e.find('input[type="checkbox"]'),n=t[0].title.indexOf(i)!==-1;e[n?"removeClass":"addClass"](c),t.data("hide",!n)}),e.renderCheckBtn();var r=l.length===n.children("li."+c).length;e.noneView(n,r?t.text.searchNone:"")})},r.that={},r.config={},l.reload=function(e,a){var t=r.that[e];return t.reload(a),r.call(t)},l.getData=function(e){var a=r.that[e];return a.getData()},l.render=function(e){var a=new x(e);return r.call(a)},e(n,l)});layui.define(["laytpl","laypage","layer","form","util"],function(e){"use strict";var t=layui.$,i=layui.laytpl,a=layui.laypage,l=layui.layer,n=layui.form,o=layui.util,r=layui.hint(),c=layui.device(),d={config:{checkName:"LAY_CHECKED",indexName:"LAY_TABLE_INDEX"},cache:{},index:layui.table?layui.table.index+1e4:0,set:function(e){var i=this;return i.config=t.extend({},i.config,e),i},on:function(e,t){return layui.onevent.call(this,h,e,t)}},s=function(){var e=this,t=e.config,i=t.id||t.index;return i&&(s.that[i]=e,s.config[i]=t),{config:t,reload:function(t,i){e.reload.call(e,t,i)},setColsWidth:function(){e.setColsWidth.call(e)},resize:function(){e.resize.call(e)}}},u=function(e){var t=s.config[e];return t||r.error(e?"The table instance with ID '"+e+"' not found":"ID argument required"),t||null},y=function(e,a,l,n){var r=this.config||{};r.escape&&(a=o.escape(a));var c=e.templet?function(){return"function"==typeof e.templet?e.templet(l):i(t(e.templet).html()||String(a)).render(l)}():a;return n?t("
                "+c+"
                ").text():c},h="table",f=".layui-table",p="layui-hide",v="layui-none",m="layui-table-view",g=".layui-table-tool",b=".layui-table-box",x=".layui-table-init",k=".layui-table-header",C=".layui-table-body",w=".layui-table-main",T=".layui-table-fixed",N=".layui-table-fixed-l",L=".layui-table-fixed-r",_=".layui-table-total",S=".layui-table-page",A=".layui-table-sort",R="layui-table-edit",W="layui-table-hover",z=function(e){var t='{{#if(item2.colspan){}} colspan="{{item2.colspan}}"{{#} if(item2.rowspan){}} rowspan="{{item2.rowspan}}"{{#}}}';return e=e||{},['',"","{{# layui.each(d.data.cols, function(i1, item1){ }}","","{{# layui.each(item1, function(i2, item2){ }}",'{{# if(item2.fixed && item2.fixed !== "right"){ left = true; } }}','{{# if(item2.fixed === "right"){ right = true; } }}',function(){return e.fixed&&"right"!==e.fixed?'{{# if(item2.fixed && item2.fixed !== "right"){ }}':"right"===e.fixed?'{{# if(item2.fixed === "right"){ }}':""}(),"{{# var isSort = !(item2.colGroup) && item2.sort; }}",'",e.fixed?"{{# }; }}":"","{{# }); }}","","{{# }); }}","","
                ','
                ','{{# if(item2.type === "checkbox"){ }}','',"{{# } else { }}",'{{item2.title||""}}',"{{# if(isSort){ }}",'',"{{# } }}","{{# } }}","
                ","
                "].join("")},E=['',"","
                "].join(""),j=['
                ',"{{# if(d.data.toolbar){ }}",'
                ','
                ','
                ',"
                ","{{# } }}",'
                ',"{{# if(d.data.loading){ }}",'
                ','',"
                ","{{# } }}","{{# var left, right; }}",'
                ',z(),"
                ",'
                ',E,"
                ","{{# if(left){ }}",'
                ','
                ',z({fixed:!0}),"
                ",'
                ',E,"
                ","
                ","{{# }; }}","{{# if(right){ }}",'
                ','
                ',z({fixed:"right"}),'
                ',"
                ",'
                ',E,"
                ","
                ","{{# }; }}","
                ","{{# if(d.data.totalRow){ }}",'
                ','','',"
                ","
                ","{{# } }}","{{# if(d.data.page){ }}",'
                ','
                ',"
                ","{{# } }}","","
                "].join(""),F=t(window),I=t(document),H=function(e){var i=this;i.index=++d.index,i.config=t.extend({},i.config,d.config,e),i.render()};H.prototype.config={limit:10,loading:!0,cellMinWidth:60,defaultToolbar:["filter","exports","print"],autoSort:!0,text:{none:"\u65e0\u6570\u636e"}},H.prototype.render=function(){var e=this,a=e.config;if(a.elem=t(a.elem),a.where=a.where||{},a.id=a.id||a.elem.attr("id")||e.index,a.request=t.extend({pageName:"page",limitName:"limit"},a.request),a.response=t.extend({statusName:"code",statusCode:0,msgName:"msg",dataName:"data",totalRowName:"totalRow",countName:"count"},a.response),"object"==typeof a.page&&(a.limit=a.page.limit||a.limit,a.limits=a.page.limits||a.limits,e.page=a.page.curr=a.page.curr||1,delete a.page.elem,delete a.page.jump),!a.elem[0])return e;a.height&&/^full-\d+$/.test(a.height)&&(e.fullHeightGap=a.height.split("-")[1],a.height=F.height()-e.fullHeightGap),e.setInit();var l=a.elem,n=l.next("."+m),o=e.elem=t(i(j).render({VIEW_CLASS:m,data:a,index:e.index}));if(a.index=e.index,e.key=a.id||a.index,n[0]&&n.remove(),l.after(o),e.layTool=o.find(g),e.layBox=o.find(b),e.layHeader=o.find(k),e.layMain=o.find(w),e.layBody=o.find(C),e.layFixed=o.find(T),e.layFixLeft=o.find(N),e.layFixRight=o.find(L),e.layTotal=o.find(_),e.layPage=o.find(S),e.renderToolbar(),e.fullSize(),a.cols.length>1){var r=e.layFixed.find(k).find("th");r.height(e.layHeader.height()-1-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom")))}e.pullData(e.page),e.events()},H.prototype.initOpts=function(e){var t=this,i=(t.config,{checkbox:48,radio:48,space:15,numbers:40});e.checkbox&&(e.type="checkbox"),e.space&&(e.type="space"),e.type||(e.type="normal"),"normal"!==e.type&&(e.unresize=!0,e.width=e.width||i[e.type])},H.prototype.setInit=function(e){var t=this,i=t.config;return i.clientWidth=i.width||function(){var e=function(t){var a,l;t=t||i.elem.parent(),a=t.width();try{l="none"===t.css("display")}catch(n){}return!t[0]||a&&!l?a:e(t.parent())};return e()}(),"width"===e?i.clientWidth:void layui.each(i.cols,function(e,a){layui.each(a,function(l,n){if(!n)return void a.splice(l,1);if(n.key=e+"-"+l,n.hide=n.hide||!1,n.colGroup||n.colspan>1){var o=0;layui.each(i.cols[e+1],function(t,i){i.HAS_PARENT||o>1&&o==n.colspan||(i.HAS_PARENT=!0,i.parentKey=e+"-"+l,o+=parseInt(i.colspan>1?i.colspan:1))}),n.colGroup=!0}t.initOpts(n)})})},H.prototype.renderToolbar=function(){var e=this,a=e.config,l=['
                ','
                ','
                '].join(""),n=e.layTool.find(".layui-table-tool-temp");if("default"===a.toolbar)n.html(l);else if("string"==typeof a.toolbar){var o=t(a.toolbar).html()||"";o&&n.html(i(o).render(a))}var r={filter:{title:"\u7b5b\u9009\u5217",layEvent:"LAYTABLE_COLS",icon:"layui-icon-cols"},exports:{title:"\u5bfc\u51fa",layEvent:"LAYTABLE_EXPORT",icon:"layui-icon-export"},print:{title:"\u6253\u5370",layEvent:"LAYTABLE_PRINT",icon:"layui-icon-print"}},c=[];"object"==typeof a.defaultToolbar&&layui.each(a.defaultToolbar,function(e,t){var i="string"==typeof t?r[t]:t;i&&c.push('
                ')}),e.layTool.find(".layui-table-tool-self").html(c.join(""))},H.prototype.setParentCol=function(e,t){var i=this,a=i.config,l=i.layHeader.find('th[data-key="'+a.index+"-"+t+'"]'),n=parseInt(l.attr("colspan"))||0;if(l[0]){var o=t.split("-"),r=a.cols[o[0]][o[1]];e?n--:n++,l.attr("colspan",n),l[n<1?"addClass":"removeClass"](p),r.colspan=n,r.hide=n<1;var c=l.data("parentkey");c&&i.setParentCol(e,c)}},H.prototype.setColsPatch=function(){var e=this,t=e.config;layui.each(t.cols,function(t,i){layui.each(i,function(t,i){i.hide&&e.setParentCol(i.hide,i.parentKey)})})},H.prototype.setColsWidth=function(){var e=this,t=e.config,i=0,a=0,l=0,n=0,o=e.setInit("width");e.eachCols(function(e,t){t.hide||i++}),o=o-function(){return"line"===t.skin||"nob"===t.skin?2:i+1}()-e.getScrollWidth(e.layMain[0])-1;var r=function(e){layui.each(t.cols,function(i,r){layui.each(r,function(i,c){var d=0,s=c.minWidth||t.cellMinWidth;return c?void(c.colGroup||c.hide||(e?l&&ln&&a&&(l=(o-n)/a)};r(),r(!0),e.autoColNums=a,e.eachCols(function(i,a){var n=a.minWidth||t.cellMinWidth;a.colGroup||a.hide||(0===a.width?e.getCssRule(t.index+"-"+a.key,function(e){e.style.width=Math.floor(l>=n?l:n)+"px"}):/\d+%$/.test(a.width)&&e.getCssRule(t.index+"-"+a.key,function(e){e.style.width=Math.floor(parseFloat(a.width)/100*o)+"px"}))});var c=e.layMain.width()-e.getScrollWidth(e.layMain[0])-e.layMain.children("table").outerWidth();if(e.autoColNums&&c>=-i&&c<=i){var d=function(t){var i;return t=t||e.layHeader.eq(0).find("thead th:last-child"),i=t.data("field"),!i&&t.prev()[0]?d(t.prev()):t},s=d(),u=s.data("key");e.getCssRule(u,function(t){var i=t.style.width||s.outerWidth();t.style.width=parseFloat(i)+c+"px",e.layMain.height()-e.layMain.prop("clientHeight")>0&&(t.style.width=parseFloat(t.style.width)-1+"px")})}e.loading(!0)},H.prototype.resize=function(){var e=this;e.fullSize(),e.setColsWidth(),e.scrollPatch()},H.prototype.reload=function(e,i){var a=this;e=e||{},delete a.haveInit,layui.each(e,function(e,t){"array"===layui._typeof(t)&&delete a.config[e]}),a.config=t.extend(i,{},a.config,e),a.render()},H.prototype.errorView=function(e){var i=this,a=i.layMain.find("."+v),l=t('
                '+(e||"Error")+"
                ");a[0]&&(i.layNone.remove(),a.remove()),i.layFixed.addClass(p),i.layMain.find("tbody").html(""),i.layMain.append(i.layNone=l),d.cache[i.key]=[]},H.prototype.page=1,H.prototype.pullData=function(e){var i=this,a=i.config,l=a.request,n=a.response,o=function(){"object"==typeof a.initSort&&i.sort(a.initSort.field,a.initSort.type)};if(i.startTime=(new Date).getTime(),a.url){var r={};r[l.pageName]=e,r[l.limitName]=a.limit;var c=t.extend(r,a.where);a.contentType&&0==a.contentType.indexOf("application/json")&&(c=JSON.stringify(c)),i.loading(),t.ajax({type:a.method||"get",url:a.url,contentType:a.contentType,data:c,dataType:"json",headers:a.headers||{},success:function(t){"function"==typeof a.parseData&&(t=a.parseData(t)||t),t[n.statusName]!=n.statusCode?(i.renderForm(),i.errorView(t[n.msgName]||'\u8fd4\u56de\u7684\u6570\u636e\u4e0d\u7b26\u5408\u89c4\u8303\uff0c\u6b63\u786e\u7684\u6210\u529f\u72b6\u6001\u7801\u5e94\u4e3a\uff1a"'+n.statusName+'": '+n.statusCode)):(i.renderData(t,e,t[n.countName]),o(),a.time=(new Date).getTime()-i.startTime+" ms"),i.setColsWidth(),"function"==typeof a.done&&a.done(t,e,t[n.countName])},error:function(e,t){i.errorView("\u8bf7\u6c42\u5f02\u5e38\uff0c\u9519\u8bef\u63d0\u793a\uff1a"+t),i.renderForm(),i.setColsWidth(),"function"==typeof a.error&&a.error(e,t)}})}else if("array"===layui._typeof(a.data)){var d={},s=e*a.limit-a.limit;d[n.dataName]=a.data.concat().splice(s,a.limit),d[n.countName]=a.data.length,"object"==typeof a.totalRow&&(d[n.totalRowName]=t.extend({},a.totalRow)),i.renderData(d,e,d[n.countName]),o(),i.setColsWidth(),"function"==typeof a.done&&a.done(d,e,d[n.countName])}},H.prototype.eachCols=function(e){var t=this;return d.eachCols(null,e,t.config.cols),t},H.prototype.renderData=function(e,n,o,r){var c=this,s=c.config,u=e[s.response.dataName]||[],h=e[s.response.totalRowName],f=[],m=[],g=[],b=function(){var e;return!r&&c.sortKey?c.sort(c.sortKey.field,c.sortKey.sort,!0):(layui.each(u,function(a,l){var o=[],u=[],h=[],v=a+s.limit*(n-1)+1;"array"===layui._typeof(l)&&0===l.length||(r||(l[d.config.indexName]=a),c.eachCols(function(n,r){var f=r.field||n,m=s.index+"-"+r.key,g=l[f];if(void 0!==g&&null!==g||(g=""),!r.colGroup){var b=['','
                '+function(){var n=t.extend(!0,{LAY_INDEX:v,LAY_COL:r},l),o=d.config.checkName;switch(r.type){case"checkbox":return'";case"radio":return n[o]&&(e=a),'';case"numbers":return v}return r.toolbar?i(t(r.toolbar).html()||"").render(n):y.call(c,r,g,n)}(),"
                "].join("");o.push(b),r.fixed&&"right"!==r.fixed&&u.push(b),"right"===r.fixed&&h.push(b)}}),f.push(''+o.join("")+""),m.push(''+u.join("")+""),g.push(''+h.join("")+""))}),c.layBody.scrollTop(0),c.layMain.find("."+v).remove(),c.layMain.find("tbody").html(f.join("")),c.layFixLeft.find("tbody").html(m.join("")),c.layFixRight.find("tbody").html(g.join("")),c.renderForm(),"number"==typeof e&&c.setThisRowChecked(e),c.syncCheckAll(),c.haveInit?c.scrollPatch():setTimeout(function(){c.scrollPatch()},50),c.haveInit=!0,l.close(c.tipsIndex),s.HAS_SET_COLS_PATCH||c.setColsPatch(),void(s.HAS_SET_COLS_PATCH=!0))};return d.cache[c.key]=u,c.layPage[0==o||0===u.length&&1==n?"addClass":"removeClass"](p),0===u.length?(c.renderForm(),c.errorView(s.text.none)):(c.layFixed.removeClass(p),r?b():(b(),c.renderTotal(u,h),void(s.page&&(s.page=t.extend({elem:"layui-table-page"+s.index,count:o,limit:s.limit,limits:s.limits||[10,20,30,40,50,60,70,80,90],groups:3,layout:["prev","page","next","skip","count","limit"],prev:'',next:'',jump:function(e,t){t||(c.page=e.curr,s.limit=e.limit,c.pullData(e.curr))}},s.page),s.page.count=o,a.render(s.page)))))},H.prototype.renderTotal=function(e,a){var l=this,n=l.config,o={};if(n.totalRow){layui.each(e,function(e,t){"array"===layui._typeof(t)&&0===t.length||l.eachCols(function(e,i){var a=i.field||e,l=t[a];i.totalRow&&(o[a]=(o[a]||0)+(parseFloat(l)||0))})}),l.dataTotal={};var r=[];l.eachCols(function(e,c){var d=c.field||e,s=function(){var e,t=c.totalRowText||"",i=parseFloat(o[d]).toFixed(2),n={};return n[d]=i,e=c.totalRow?y.call(l,c,i,n)||t:t,a?a[c.field]||e:e}(),u=['','
                '+function(){var e=c.totalRow||n.totalRow;return"string"==typeof e?i(e).render(t.extend({TOTAL_NUMS:s},c)):s}(),"
                "].join("");c.field&&(l.dataTotal[d]=s),r.push(u)}),l.layTotal.find("tbody").html(""+r.join("")+"")}},H.prototype.getColElem=function(e,t){var i=this,a=i.config;return e.eq(0).find(".laytable-cell-"+(a.index+"-"+t)+":eq(0)")},H.prototype.renderForm=function(e){n.render(e,"LAY-table-"+this.index)},H.prototype.setThisRowChecked=function(e){var t=this,i=(t.config,"layui-table-click"),a=t.layBody.find('tr[data-index="'+e+'"]');a.addClass(i).siblings("tr").removeClass(i)},H.prototype.sort=function(e,i,a,l){var n,o,c=this,s={},u=c.config,y=u.elem.attr("lay-filter"),f=d.cache[c.key];"string"==typeof e&&(n=e,c.layHeader.find("th").each(function(i,a){var l=t(this),o=l.data("field");if(o===e)return e=l,n=o,!1}));try{var n=n||e.data("field"),p=e.data("key");if(c.sortKey&&!a&&n===c.sortKey.field&&i===c.sortKey.sort)return;var v=c.layHeader.find("th .laytable-cell-"+p).find(A);c.layHeader.find("th").find(A).removeAttr("lay-sort"),v.attr("lay-sort",i||null),c.layFixed.find("th")}catch(m){r.error("Table modules: sort field '"+n+"' not matched")}c.sortKey={field:n,sort:i},u.autoSort&&("asc"===i?o=layui.sort(f,n):"desc"===i?o=layui.sort(f,n,!0):(o=layui.sort(f,d.config.indexName),delete c.sortKey)),s[u.response.dataName]=o||f,c.renderData(s,c.page,c.count,!0),l&&layui.event.call(e,h,"sort("+y+")",{field:n,type:i})},H.prototype.loading=function(e){var i=this,a=i.config;a.loading&&(e?(i.layInit&&i.layInit.remove(),delete i.layInit,i.layBox.find(x).remove()):(i.layInit=t(['
                ','',"
                "].join("")),i.layBox.append(i.layInit)))},H.prototype.setCheckData=function(e,t){var i=this,a=i.config,l=d.cache[i.key];l[e]&&"array"!==layui._typeof(l[e])&&(l[e][a.checkName]=t)},H.prototype.syncCheckAll=function(){var e=this,t=e.config,i=e.layHeader.find('input[name="layTableCheckbox"]'),a=function(i){return e.eachCols(function(e,a){"checkbox"===a.type&&(a[t.checkName]=i)}),i};i[0]&&(d.checkStatus(e.key).isAll?(i[0].checked||(i.prop("checked",!0),e.renderForm("checkbox")),a(!0)):(i[0].checked&&(i.prop("checked",!1),e.renderForm("checkbox")),a(!1)))},H.prototype.getCssRule=function(e,t){var i=this,a=i.elem.find("style")[0],l=a.sheet||a.styleSheet||{},n=l.cssRules||l.rules;layui.each(n,function(i,a){if(a.selectorText===".laytable-cell-"+e)return t(a),!0})},H.prototype.fullSize=function(){var e,t=this,i=t.config,a=i.height;t.fullHeightGap&&(a=F.height()-t.fullHeightGap,a<135&&(a=135),t.elem.css("height",a)),a&&(e=parseFloat(a)-(t.layHeader.outerHeight()||38),i.toolbar&&(e-=t.layTool.outerHeight()||50),i.totalRow&&(e-=t.layTotal.outerHeight()||40),i.page&&(e-=t.layPage.outerHeight()||41),t.layMain.css("height",e-2))},H.prototype.getScrollWidth=function(e){var t=0;return e?t=e.offsetWidth-e.clientWidth:(e=document.createElement("div"),e.style.width="100px",e.style.height="100px",e.style.overflowY="scroll",document.body.appendChild(e),t=e.offsetWidth-e.clientWidth,document.body.removeChild(e)),t},H.prototype.scrollPatch=function(){var e=this,i=e.layMain.children("table"),a=e.layMain.width()-e.layMain.prop("clientWidth"),l=e.layMain.height()-e.layMain.prop("clientHeight"),n=(e.getScrollWidth(e.layMain[0]),i.outerWidth()-e.layMain.width()),o=function(e){if(a&&l){if(e=e.eq(0),!e.find(".layui-table-patch")[0]){var i=t('
                ');i.find("div").css({width:a}),e.find("tr").append(i)}}else e.find(".layui-table-patch").remove()};o(e.layHeader),o(e.layTotal);var r=e.layMain.height(),c=r-l;e.layFixed.find(C).css("height",i.height()>=c?c:"auto"),e.layFixRight[n>0?"removeClass":"addClass"](p),e.layFixRight.css("right",a-1)},H.prototype.events=function(){var e,i=this,a=i.config,o=t("body"),r={},s=i.layHeader.find("th"),u=".layui-table-cell",f=a.elem.attr("lay-filter");i.layTool.on("click","*[lay-event]",function(e){var o=t(this),r=o.attr("lay-event"),s=function(e){var l=t(e.list),n=t('
                  ');n.html(l),a.height&&n.css("max-height",a.height-(i.layTool.outerHeight()||50)),o.find(".layui-table-tool-panel")[0]||o.append(n),i.renderForm(),n.on("click",function(e){layui.stope(e)}),e.done&&e.done(n,l)};switch(layui.stope(e),I.trigger("table.tool.panel.remove"),l.close(i.tipsIndex),r){case"LAYTABLE_COLS":s({list:function(){var e=[];return i.eachCols(function(t,i){i.field&&"normal"==i.type&&e.push('
                • ')}),e.join("")}(),done:function(){n.on("checkbox(LAY_TABLE_TOOL_COLS)",function(e){var l=t(e.elem),n=this.checked,o=l.data("key"),r=l.data("parentkey");layui.each(a.cols,function(e,t){layui.each(t,function(t,l){if(e+"-"+t===o){var c=l.hide;l.hide=!n,i.elem.find('*[data-key="'+a.index+"-"+o+'"]')[n?"removeClass":"addClass"](p),c!=l.hide&&i.setParentCol(!n,r),i.resize()}})})})}});break;case"LAYTABLE_EXPORT":c.ie?l.tips("\u5bfc\u51fa\u529f\u80fd\u4e0d\u652f\u6301 IE\uff0c\u8bf7\u7528 Chrome \u7b49\u9ad8\u7ea7\u6d4f\u89c8\u5668\u5bfc\u51fa",this,{tips:3}):s({list:function(){return['
                • \u5bfc\u51fa\u5230 Csv \u6587\u4ef6
                • ','
                • \u5bfc\u51fa\u5230 Excel \u6587\u4ef6
                • '].join("")}(),done:function(e,l){l.on("click",function(){var e=t(this).data("type");d.exportFile.call(i,a.id,null,e)})}});break;case"LAYTABLE_PRINT":var u=window.open("\u6253\u5370\u7a97\u53e3","_blank"),y=[""].join(""),v=t(i.layHeader.html());v.append(i.layMain.find("table").html()),v.append(i.layTotal.find("table").html()),v.find("th.layui-table-patch").remove(),v.find(".layui-table-col-special").remove(),u.document.write(y+v.prop("outerHTML")),u.document.close(),u.print(),u.close()}layui.event.call(this,h,"toolbar("+f+")",t.extend({event:r,config:a},{}))}),s.on("mousemove",function(e){var i=t(this),a=i.offset().left,l=e.clientX-a;i.data("unresize")||r.resizeStart||(r.allowResize=i.width()-l<=10,o.css("cursor",r.allowResize?"col-resize":""))}).on("mouseleave",function(){t(this);r.resizeStart||o.css("cursor","")}).on("mousedown",function(e){var l=t(this);if(r.allowResize){var n=l.data("key");e.preventDefault(),r.resizeStart=!0,r.offset=[e.clientX,e.clientY],i.getCssRule(n,function(e){var t=e.style.width||l.outerWidth();r.rule=e,r.ruleWidth=parseFloat(t),r.minWidth=l.data("minwidth")||a.cellMinWidth})}}),I.on("mousemove",function(t){if(r.resizeStart){if(t.preventDefault(),r.rule){var a=r.ruleWidth+t.clientX-r.offset[0];a');return n[0].value=i.data("content")||l.text(),i.find("."+R)[0]||i.append(n),n.focus(),void layui.stope(e)}}).on("mouseenter","td",function(){b.call(this)}).on("mouseleave","td",function(){b.call(this,"hide")});var g="layui-table-grid-down",b=function(e){var i=t(this),a=i.children(u);if(!i.data("off"))if(e)i.find(".layui-table-grid-down").remove();else if(a.prop("scrollWidth")>a.outerWidth()){if(a.find("."+g)[0])return;i.append('
                  ')}};i.layBody.on("click","."+g,function(e){var n=t(this),o=n.parent(),r=o.children(u);i.tipsIndex=l.tips(['
                  ',r.html(),"
                  ",''].join(""),r[0],{tips:[3,""],time:-1,anim:-1,maxWidth:c.ios||c.android?300:i.elem.width()/2,isOutAnim:!1,skin:"layui-table-tips",success:function(e,t){e.find(".layui-table-tips-c").on("click",function(){l.close(t)})}}),layui.stope(e)}),i.layBody.on("click","*[lay-event]",function(){var e=t(this),a=e.parents("tr").eq(0).data("index");layui.event.call(this,h,"tool("+f+")",v.call(this,{event:e.attr("lay-event")})),i.setThisRowChecked(a)}),i.layMain.on("scroll",function(){var e=t(this),a=e.scrollLeft(),n=e.scrollTop();i.layHeader.scrollLeft(a),i.layTotal.scrollLeft(a),i.layFixed.find(C).scrollTop(n),l.close(i.tipsIndex)}),F.on("resize",function(){i.resize()})},function(){I.on("click",function(){I.trigger("table.remove.tool.panel")}),I.on("table.remove.tool.panel",function(){t(".layui-table-tool-panel").remove()})}(),d.init=function(e,i){i=i||{};var a=this,l=t(e?'table[lay-filter="'+e+'"]':f+"[lay-data]"),n="Table element property lay-data configuration item has a syntax error: ";return l.each(function(){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(o){r.error(n+l,"error")}var c=[],s=t.extend({elem:this,cols:[],data:[],skin:a.attr("lay-skin"),size:a.attr("lay-size"),even:"string"==typeof a.attr("lay-even")},d.config,i,l);e&&a.hide(),a.find("thead>tr").each(function(e){s.cols[e]=[],t(this).children().each(function(i){var a=t(this),l=a.attr("lay-data");try{l=new Function("return "+l)()}catch(o){return r.error(n+l)}var d=t.extend({title:a.text(),colspan:a.attr("colspan")||0,rowspan:a.attr("rowspan")||0},l);d.colspan<2&&c.push(d),s.cols[e].push(d)})}),a.find("tbody>tr").each(function(e){var i=t(this),a={};i.children("td").each(function(e,i){var l=t(this),n=l.data("field");if(n)return a[n]=l.html()}),layui.each(c,function(e,t){var l=i.children("td").eq(e);a[t.field]=l.html()}),s.data[e]=a}),d.render(s)}),a},s.that={},s.config={},d.eachCols=function(e,i,a){var l=s.config[e]||{},n=[],o=0;a=t.extend(!0,[],a||l.cols),layui.each(a,function(e,t){layui.each(t,function(t,i){if(i.colGroup){var l=0;o++,i.CHILD_COLS=[],layui.each(a[e+1],function(e,t){t.PARENT_COL_INDEX||l>1&&l==i.colspan||(t.PARENT_COL_INDEX=o,i.CHILD_COLS.push(t),l+=parseInt(t.colspan>1?t.colspan:1))})}i.PARENT_COL_INDEX||n.push(i)})});var r=function(e){layui.each(e||n,function(e,t){return t.CHILD_COLS?r(t.CHILD_COLS):void("function"==typeof i&&i(e,t))})};r()},d.checkStatus=function(e){var t=0,i=0,a=[],l=d.cache[e]||[];return layui.each(l,function(e,l){return"array"===layui._typeof(l)?void i++:void(l[d.config.checkName]&&(t++,a.push(d.clearCacheKey(l))))}),{data:a,isAll:!!l.length&&t===l.length-i}},d.getData=function(e){var t=[],i=d.cache[e]||[];return layui.each(i,function(e,i){"array"!==layui._typeof(i)&&t.push(d.clearCacheKey(i))}),t},d.exportFile=function(e,t,i){var a=this;t=t||d.clearCacheKey(d.cache[e]),i=i||"csv";var l=s.that[e],n=s.config[e]||{},o={csv:"text/csv",xls:"application/vnd.ms-excel"}[i],u=document.createElement("a");return c.ie?r.error("IE_NOT_SUPPORT_EXPORTS"):(u.href="data:"+o+";charset=utf-8,\ufeff"+encodeURIComponent(function(){var i=[],n=[],o=[];return layui.each(t,function(t,a){var o=[];"object"==typeof e?(layui.each(e,function(e,a){0==t&&i.push(a||"")}),layui.each(d.clearCacheKey(a),function(e,t){o.push('"'+(t||"")+'"')})):d.eachCols(e,function(e,n){if(n.field&&"normal"==n.type&&!n.hide){var r=a[n.field];void 0!==r&&null!==r||(r=""),0==t&&i.push(n.title||""),o.push('"'+y.call(l,n,r,a,"text")+'"')}}),n.push(o.join(","))}),layui.each(a.dataTotal,function(e,t){o.push(t)}),i.join(",")+"\r\n"+n.join("\r\n")+"\r\n"+o.join(",")}()),u.download=(n.title||"table_"+(n.index||""))+"."+i,document.body.appendChild(u),u.click(),void document.body.removeChild(u))},d.resize=function(e){if(e){var t=u(e);if(!t)return;s.that[e].resize()}else layui.each(s.that,function(){ +this.resize()})},d.reload=function(e,t,i){var a=u(e);if(a){var l=s.that[e];return l.reload(t,i),s.call(l)}},d.render=function(e){var t=new H(e);return s.call(t)},d.clearCacheKey=function(e){return e=t.extend({},e),delete e[d.config.checkName],delete e[d.config.indexName],e},t(function(){d.init()}),e(h,d)});layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(clearInterval(e.timer),e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['",'"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['
                    ',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("")}),i.join("")}(),"
                  "].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):al.length&&(l.value=l.length),parseInt(l.value)!==l.value&&(l.half||(l.value=Math.ceil(l.value)-l.value<.5?Math.ceil(l.value):Math.floor(l.value)));for(var n='
                    ",s=1;s<=l.length;s++){var r='
                  • ";l.half&&parseInt(l.value)!==l.value&&s==Math.ceil(l.value)?n=n+'
                  • ":n+=r}n+="
                  "+(l.text?''+l.value+"\u661f":"")+"";var c=l.elem,f=c.next("."+t);f[0]&&f.remove(),e.elemTemp=a(n),l.span=e.elemTemp.next("span"),l.setText&&l.setText(l.value),c.html(e.elemTemp),c.addClass("layui-inline"),l.readonly||e.action()},v.prototype.setvalue=function(e){var a=this,l=a.config;l.value=e,a.render()},v.prototype.action=function(){var e=this,l=e.config,i=e.elemTemp,n=i.find("i").width();i.children("li").each(function(e){var t=e+1,v=a(this);v.on("click",function(e){if(l.value=t,l.half){var o=e.pageX-a(this).offset().left;o<=n/2&&(l.value=l.value-.5)}l.text&&i.next("span").text(l.value+"\u661f"),l.choose&&l.choose(l.value),l.setText&&l.setText(l.value)}),v.on("mousemove",function(e){if(i.find("i").each(function(){a(this).addClass(o).removeClass(r)}),i.find("i:lt("+t+")").each(function(){a(this).addClass(u).removeClass(f)}),l.half){var c=e.pageX-a(this).offset().left;c<=n/2&&v.children("i").addClass(s).removeClass(u)}}),v.on("mouseleave",function(){i.find("i").each(function(){a(this).addClass(o).removeClass(r)}),i.find("i:lt("+Math.floor(l.value)+")").each(function(){a(this).addClass(u).removeClass(f)}),l.half&&parseInt(l.value)!==l.value&&i.children("li:eq("+Math.floor(l.value)+")").children("i").addClass(s).removeClass(c)})})},v.prototype.events=function(){var e=this;e.config},l.render=function(e){var a=new v(e);return i.call(a)},e(n,l)});layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var m=l(e.elem);if(m[0]){var f=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,y=e.end||"\u6ca1\u6709\u66f4\u591a\u4e86",v=e.scrollElem&&e.scrollElem!==document,d="\u52a0\u8f7d\u66f4\u591a",h=l('");m.find(".layui-flow-more")[0]||m.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(y):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(f.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),!i&&m.width()&&(r=setTimeout(function(){var i=v?e.height():l(window).height(),n=v?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&e.attr("lay-src")){var f=e.attr("lay-src");layui.img(f,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",f).removeAttr("lay-src"),l[0]&&m(l),i++},function(){t.lazyimg.elem.eq(i);e.removeAttr("lay-src")})}},m=function(e,o){var m=a?(o||n).height():l(window).height(),f=n.scrollTop(),u=f+m;if(t.lazyimg.elem=l(r),e)c(e,m);else for(var s=0;su)break}};if(m(),!o){var f;n.on("scroll",function(){var e=l(this);f&&clearTimeout(f),f=setTimeout(function(){m(null,e)},50)}),o=!0}return m},e("flow",new o)});layui.define(["layer","form"],function(t){"use strict";var e=layui.$,i=layui.layer,a=layui.form,l=(layui.hint(),layui.device()),n="layedit",o="layui-show",r="layui-disabled",c=function(){var t=this;t.index=0,t.config={tool:["strong","italic","underline","del","|","left","center","right","|","link","unlink","face","image"],hideTool:[],height:280}};c.prototype.set=function(t){var i=this;return e.extend(!0,i.config,t),i},c.prototype.on=function(t,e){return layui.onevent(n,t,e)},c.prototype.build=function(t,i){i=i||{};var a=this,n=a.config,r="layui-layedit",c=e("string"==typeof t?"#"+t:t),u="LAY_layedit_"+ ++a.index,d=c.next("."+r),y=e.extend({},n,i),f=function(){var t=[],e={};return layui.each(y.hideTool,function(t,i){e[i]=!0}),layui.each(y.tool,function(i,a){C[a]&&!e[a]&&t.push(C[a])}),t.join("")}(),m=e(['
                  ','
                  '+f+"
                  ",'
                  ','',"
                  ","
                  "].join(""));return l.ie&&l.ie<8?c.removeClass("layui-hide").addClass(o):(d[0]&&d.remove(),s.call(a,m,c[0],y),c.addClass("layui-hide").after(m),a.index)},c.prototype.getContent=function(t){var e=u(t);if(e[0])return d(e[0].document.body.innerHTML)},c.prototype.getText=function(t){var i=u(t);if(i[0])return e(i[0].document.body).text()},c.prototype.setContent=function(t,i,a){var l=u(t);l[0]&&(a?e(l[0].document.body).append(i):e(l[0].document.body).html(i),layedit.sync(t))},c.prototype.sync=function(t){var i=u(t);if(i[0]){var a=e("#"+i[1].attr("textarea"));a.val(d(i[0].document.body.innerHTML))}},c.prototype.getSelection=function(t){var e=u(t);if(e[0]){var i=m(e[0].document);return document.selection?i.text:i.toString()}};var s=function(t,i,a){var l=this,n=t.find("iframe");n.css({height:a.height}).on("load",function(){var o=n.contents(),r=n.prop("contentWindow"),c=o.find("head"),s=e([""].join("")),u=o.find("body");c.append(s),u.attr("contenteditable","true").css({"min-height":a.height}).html(i.value||""),y.apply(l,[r,n,i,a]),g.call(l,r,t,a)})},u=function(t){var i=e("#LAY_layedit_"+t),a=i.prop("contentWindow");return[a,i]},d=function(t){return 8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),t},y=function(t,a,n,o){var r=t.document,c=e(r.body);c.on("keydown",function(t){var e=t.keyCode;if(13===e){var a=m(r),l=p(a),n=l.parentNode;if("pre"===n.tagName.toLowerCase()){if(t.shiftKey)return;return i.msg("\u8bf7\u6682\u65f6\u7528shift+enter"),!1}r.execCommand("formatBlock",!1,"

                  ")}}),e(n).parents("form").on("submit",function(){var t=c.html();8==l.ie&&(t=t.replace(/<.+>/g,function(t){return t.toLowerCase()})),n.value=t}),c.on("paste",function(e){r.execCommand("formatBlock",!1,"

                  "),setTimeout(function(){f.call(t,c),n.value=c.html()},100)})},f=function(t){var i=this;i.document;t.find("*[style]").each(function(){var t=this.style.textAlign;this.removeAttribute("style"),e(this).css({"text-align":t||""})}),t.find("table").addClass("layui-table"),t.find("script,link").remove()},m=function(t){return t.selection?t.selection.createRange():t.getSelection().getRangeAt(0)},p=function(t){return t.endContainer||t.parentElement().childNodes[0]},v=function(t,i,a){var l=this.document,n=document.createElement(t);for(var o in i)n.setAttribute(o,i[o]);if(n.removeAttribute("text"),l.selection){var r=a.text||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.pasteHTML(e(n).prop("outerHTML")),a.select()}else{var r=a.toString()||i.text;if("a"===t&&!r)return;r&&(n.innerHTML=r),a.deleteContents(),a.insertNode(n)}},h=function(t,i){var a=this.document,l="layedit-tool-active",n=p(m(a)),o=function(e){return t.find(".layedit-tool-"+e)};i&&i[i.hasClass(l)?"removeClass":"addClass"](l),t.find(">i").removeClass(l),o("unlink").addClass(r),e(n).parents().each(function(){var t=this.tagName.toLowerCase(),e=this.style.textAlign;"b"!==t&&"strong"!==t||o("b").addClass(l),"i"!==t&&"em"!==t||o("i").addClass(l),"u"===t&&o("u").addClass(l),"strike"===t&&o("d").addClass(l),"p"===t&&("center"===e?o("center").addClass(l):"right"===e?o("right").addClass(l):o("left").addClass(l)),"a"===t&&(o("link").addClass(l),o("unlink").removeClass(r))})},g=function(t,a,l){var n=t.document,o=e(n.body),c={link:function(i){var a=p(i),l=e(a).parent();b.call(o,{href:l.attr("href"),target:l.attr("target")},function(e){var a=l[0];"A"===a.tagName?a.href=e.url:v.call(t,"a",{target:e.target,href:e.url,text:e.url},i)})},unlink:function(t){n.execCommand("unlink")},face:function(e){x.call(this,function(i){v.call(t,"img",{src:i.src,alt:i.alt},e)})},image:function(a){var n=this;layui.use("upload",function(o){var r=l.uploadImage||{};o.render({url:r.url,method:r.type,elem:e(n).find("input")[0],done:function(e){0==e.code?(e.data=e.data||{},v.call(t,"img",{src:e.data.src,alt:e.data.title},a)):i.msg(e.msg||"\u4e0a\u4f20\u5931\u8d25")}})})},code:function(e){k.call(o,function(i){v.call(t,"pre",{text:i.code,"lay-lang":i.lang},e)})},help:function(){i.open({type:2,title:"\u5e2e\u52a9",area:["600px","380px"],shadeClose:!0,shade:.1,skin:"layui-layer-msg",content:["","no"]})}},s=a.find(".layui-layedit-tool"),u=function(){var i=e(this),a=i.attr("layedit-event"),l=i.attr("lay-command");if(!i.hasClass(r)){o.focus();var u=m(n);u.commonAncestorContainer;l?(n.execCommand(l),/justifyLeft|justifyCenter|justifyRight/.test(l)&&n.execCommand("formatBlock",!1,"

                  "),setTimeout(function(){o.focus()},10)):c[a]&&c[a].call(this,u),h.call(t,s,i)}},d=/image/;s.find(">i").on("mousedown",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)||u.call(this)}).on("click",function(){var t=e(this),i=t.attr("layedit-event");d.test(i)&&u.call(this)}),o.on("click",function(){h.call(t,s),i.close(x.index)})},b=function(t,e){var l=this,n=i.open({type:1,id:"LAY_layedit_link",area:"350px",shade:.05,shadeClose:!0,moveType:1,title:"\u8d85\u94fe\u63a5",skin:"layui-layer-msg",content:['

                    ','
                  • ','','
                    ','',"
                    ","
                  • ",'
                  • ','','
                    ','",'","
                    ","
                  • ",'
                  • ','','',"
                  • ","
                  "].join(""),success:function(t,n){var o="submit(layedit-link-yes)";a.render("radio"),t.find(".layui-btn-primary").on("click",function(){i.close(n),l.focus()}),a.on(o,function(t){i.close(b.index),e&&e(t.field)})}});b.index=n},x=function(t){var a=function(){var t=["[\u5fae\u7b11]","[\u563b\u563b]","[\u54c8\u54c8]","[\u53ef\u7231]","[\u53ef\u601c]","[\u6316\u9f3b]","[\u5403\u60ca]","[\u5bb3\u7f9e]","[\u6324\u773c]","[\u95ed\u5634]","[\u9119\u89c6]","[\u7231\u4f60]","[\u6cea]","[\u5077\u7b11]","[\u4eb2\u4eb2]","[\u751f\u75c5]","[\u592a\u5f00\u5fc3]","[\u767d\u773c]","[\u53f3\u54fc\u54fc]","[\u5de6\u54fc\u54fc]","[\u5618]","[\u8870]","[\u59d4\u5c48]","[\u5410]","[\u54c8\u6b20]","[\u62b1\u62b1]","[\u6012]","[\u7591\u95ee]","[\u998b\u5634]","[\u62dc\u62dc]","[\u601d\u8003]","[\u6c57]","[\u56f0]","[\u7761]","[\u94b1]","[\u5931\u671b]","[\u9177]","[\u8272]","[\u54fc]","[\u9f13\u638c]","[\u6655]","[\u60b2\u4f24]","[\u6293\u72c2]","[\u9ed1\u7ebf]","[\u9634\u9669]","[\u6012\u9a82]","[\u4e92\u7c89]","[\u5fc3]","[\u4f24\u5fc3]","[\u732a\u5934]","[\u718a\u732b]","[\u5154\u5b50]","[ok]","[\u8036]","[good]","[NO]","[\u8d5e]","[\u6765]","[\u5f31]","[\u8349\u6ce5\u9a6c]","[\u795e\u9a6c]","[\u56e7]","[\u6d6e\u4e91]","[\u7ed9\u529b]","[\u56f4\u89c2]","[\u5a01\u6b66]","[\u5965\u7279\u66fc]","[\u793c\u7269]","[\u949f]","[\u8bdd\u7b52]","[\u8721\u70db]","[\u86cb\u7cd5]"],e={};return layui.each(t,function(t,i){e[i]=layui.cache.dir+"images/face/"+t+".gif"}),e}();return x.hide=x.hide||function(t){"face"!==e(t.target).attr("layedit-event")&&i.close(x.index)},x.index=i.tips(function(){var t=[];return layui.each(a,function(e,i){t.push('
                • '+e+'
                • ')}),'
                    '+t.join("")+"
                  "}(),this,{tips:1,time:0,skin:"layui-box layui-util-face",maxWidth:500,success:function(l,n){l.css({marginTop:-4,marginLeft:-10}).find(".layui-clear>li").on("click",function(){t&&t({src:a[this.title],alt:this.title}),i.close(n)}),e(document).off("click",x.hide).on("click",x.hide)}})},k=function(t){var e=this,l=i.open({type:1,id:"LAY_layedit_code",area:"550px",shade:.05,shadeClose:!0,moveType:1,title:"\u63d2\u5165\u4ee3\u7801",skin:"layui-layer-msg",content:['
                    ','
                  • ','','
                    ','","
                    ","
                  • ",'
                  • ','','
                    ','',"
                    ","
                  • ",'
                  • ','','',"
                  • ","
                  "].join(""),success:function(l,n){var o="submit(layedit-code-yes)";a.render("select"),l.find(".layui-btn-primary").on("click",function(){i.close(n),e.focus()}),a.on(o,function(e){i.close(k.index),t&&t(e.field)})}});k.index=l},C={html:'',strong:'',italic:'',underline:'',del:'',"|":'',left:'',center:'',right:'',link:'',unlink:'',face:'',image:'',code:'',help:''},L=new c;t(n,L)});layui.define("jquery",function(a){"use strict";var e=layui.$;a("code",function(a){var l=[];a=a||{},a.elem=e(a.elem||".layui-code"),a.lang="lang"in a?a.lang:"code",a.elem.each(function(){l.push(this)}),layui.each(l.reverse(),function(l,i){var t=e(i),c=t.html();(t.attr("lay-encode")||a.encode)&&(c=c.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")),t.html('
                  1. '+c.replace(/[\r\t\n]+/g,"
                  2. ")+"
                  "),t.find(">.layui-code-h3")[0]||t.prepend('

                  '+(t.attr("lay-title")||a.title||"</>")+''+(t.attr("lay-lang")||a.lang||"")+"

                  ");var n=t.find(">.layui-code-ol");t.addClass("layui-box layui-code-view"),(t.attr("lay-skin")||a.skin)&&t.addClass("layui-code-"+(t.attr("lay-skin")||a.skin)),(n.find("li").length/100|0)>0&&n.css("margin-left",(n.find("li").length/100|0)+"px"),(t.attr("lay-height")||a.height)&&n.css("max-height",t.attr("lay-height")||a.height)})})}).addcss("modules/code.css?v=2","skincodecss"); diff --git a/src/sandbox/bind_function.ts b/src/sandbox/bind_function.ts index 15716f58c..047ba01dd 100644 --- a/src/sandbox/bind_function.ts +++ b/src/sandbox/bind_function.ts @@ -22,18 +22,19 @@ function isConstructor (value: FunctionConstructor & {__MICRO_APP_IS_CONSTRUCTOR } // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -export default function bindFunctionToRawWindow (rawWindow: Window, value: any): unknown { - if (value.__MICRO_APP_BOUND_WINDOW_FUNCTION__) return value.__MICRO_APP_BOUND_WINDOW_FUNCTION__ +export default function bindFunctionToRawObject (rawObject: T, value: any, key = 'WINDOW'): unknown { + const cacheKey = `__MICRO_APP_BOUND_${key}_FUNCTION__` + if (value[cacheKey]) return value[cacheKey] if (!isConstructor(value) && !isBoundedFunction(value)) { - const bindRawWindowValue = value.bind(rawWindow) + const bindRawObjectValue = value.bind(rawObject) for (const key in value) { - bindRawWindowValue[key] = value[key] + bindRawObjectValue[key] = value[key] } if (value.hasOwnProperty('prototype')) { - rawDefineProperty(bindRawWindowValue, 'prototype', { + rawDefineProperty(bindRawObjectValue, 'prototype', { value: value.prototype, configurable: true, enumerable: false, @@ -41,7 +42,7 @@ export default function bindFunctionToRawWindow (rawWindow: Window, value: any): }) } - return value.__MICRO_APP_BOUND_WINDOW_FUNCTION__ = bindRawWindowValue + return value[cacheKey] = bindRawObjectValue } return value diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 40c5cf878..4714cd2c2 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -28,7 +28,7 @@ import { assign, } from '../libs/utils' import microApp from '../micro_app' -import bindFunctionToRawWindow from './bind_function' +import bindFunctionToRawObject from './bind_function' import effect, { effectDocumentEvent, releaseEffectDocumentEvent, @@ -126,7 +126,7 @@ export default class SandBox implements SandBoxInterface { this.initGlobalKeysWhenStart( this.microAppWindow, this.proxyWindow.__MICRO_APP_NAME__, - this.proxyWindow.__MICRO_APP_URL__ + this.proxyWindow.__MICRO_APP_URL__, ) if (++SandBox.activeCount === 1) { @@ -245,7 +245,7 @@ export default class SandBox implements SandBoxInterface { const rawValue = Reflect.get(rawWindow, key) - return isFunction(rawValue) ? bindFunctionToRawWindow(rawWindow, rawValue) : rawValue + return isFunction(rawValue) ? bindFunctionToRawObject(rawWindow, rawValue) : rawValue }, set: (target: microAppWindowType, key: PropertyKey, value: unknown): boolean => { if (this.active) { @@ -427,13 +427,15 @@ export default class SandBox implements SandBoxInterface { // set hijack Properties to microAppWindow private setHijackProperties (microAppWindow: microAppWindowType, appName: string): void { let modifiedEval: unknown, modifiedImage: unknown + const proxyDocument = this.createProxyDocument(appName) rawDefineProperties(microAppWindow, { document: { configurable: true, enumerable: true, get () { throttleDeferForSetAppName(appName) - return globalEnv.rawDocument + // return globalEnv.rawDocument + return proxyDocument }, }, eval: { @@ -552,4 +554,26 @@ export default class SandBox implements SandBoxInterface { public removeRouteInfoForKeepAliveApp (): void { removeStateAndPathFromBrowser(this.proxyWindow.__MICRO_APP_NAME__) } + + private createProxyDocument (appName: string) { + const rawDocument = globalEnv.rawDocument + const createElement = function (tagName: string, options?: ElementCreationOptions): HTMLElement { + const element = globalEnv.rawCreateElement.call(rawDocument, tagName, options) + element.__MICRO_APP_NAME__ = appName + return element + } + + // @ts-ignore + const proxyDocument = new Proxy(rawDocument, { + get (_target: Document, p: string | symbol): unknown { + if (p === 'createElement') { + return createElement + } + const rawValue = Reflect.get(rawDocument, p) + return isFunction(rawValue) ? bindFunctionToRawObject(rawDocument, rawValue, 'DOCUMENT') : rawValue + }, + }) + + return proxyDocument + } } diff --git a/src/source/patch.ts b/src/source/patch.ts index 165aabe7f..b9a84eb12 100644 --- a/src/source/patch.ts +++ b/src/source/patch.ts @@ -202,7 +202,6 @@ function commonElementHandler ( } else if (rawMethod === globalEnv.rawAppend || rawMethod === globalEnv.rawPrepend) { return rawMethod.call(parent, newChild) } - return rawMethod.call(parent, newChild, passiveChild) } else if (rawMethod === globalEnv.rawAppend || rawMethod === globalEnv.rawPrepend) { const appName = getCurrentAppName() if (!(newChild instanceof Node) && appName) { @@ -269,7 +268,11 @@ export function patchElementPrototypeMethods (): void { getMappingNode(oldChild), ) } - return globalEnv.rawRemoveChild.call(this, oldChild) as T + try { + return globalEnv.rawRemoveChild.call(this, oldChild) as T + } catch { + return oldChild?.parentNode?.removeChild(oldChild) as T + } } return globalEnv.rawRemoveChild.call(this, oldChild) as T From 71369fe423657f27bd4693caf6cf232fdf8be82c Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Sat, 9 Jul 2022 18:50:16 +0800 Subject: [PATCH 046/268] feat: add ProxyDocument & update ProxyHistory --- dev/children/vue3/package.json | 1 + dev/children/vue3/src/main.js | 4 + .../vue3/src/pages/ant-design-vue.vue | 335 ++++++++++++++++++ .../src/pages/{page2.vue => element-plus.vue} | 0 .../vue3/src/pages/{page1.vue => home.vue} | 5 +- dev/children/vue3/src/router.js | 13 +- dev/children/vue3/yarn.lock | 148 +++++++- dev/main-react16/src/pages/react16/react16.js | 1 + dev/main-react16/src/pages/vue3/vue3.js | 12 +- src/libs/global_env.ts | 1 + src/libs/utils.ts | 1 + src/sandbox/adapter.ts | 23 ++ src/sandbox/index.ts | 103 +++--- src/sandbox/router/history.ts | 23 +- src/source/patch.ts | 11 +- 15 files changed, 613 insertions(+), 68 deletions(-) create mode 100644 dev/children/vue3/src/pages/ant-design-vue.vue rename dev/children/vue3/src/pages/{page2.vue => element-plus.vue} (100%) rename dev/children/vue3/src/pages/{page1.vue => home.vue} (90%) diff --git a/dev/children/vue3/package.json b/dev/children/vue3/package.json index 0669f943f..ac4156948 100644 --- a/dev/children/vue3/package.json +++ b/dev/children/vue3/package.json @@ -8,6 +8,7 @@ "lint": "vue-cli-service lint" }, "dependencies": { + "ant-design-vue": "^3.2.10", "core-js": "^3.6.5", "element-plus": "^1.3.0-beta.7", "vue": "^3.2.26", diff --git a/dev/children/vue3/src/main.js b/dev/children/vue3/src/main.js index c15980b34..e0929f1ab 100644 --- a/dev/children/vue3/src/main.js +++ b/dev/children/vue3/src/main.js @@ -2,12 +2,15 @@ import './public-path' import { createApp } from 'vue' import { createRouter, createWebHistory } from 'vue-router' import ElementPlus from 'element-plus' +import Antd from 'ant-design-vue'; import 'element-plus/dist/index.css' +import 'ant-design-vue/dist/antd.css'; import routes from './router' import App from './App.vue' // const app = createApp(App) // app.use(ElementPlus) +// app.use(Antd) // app.use(router) // app.mount('#app') @@ -33,6 +36,7 @@ function mount () { app = createApp(App) app.use(ElementPlus) + app.use(Antd) app.use(router) app.mount('#app') diff --git a/dev/children/vue3/src/pages/ant-design-vue.vue b/dev/children/vue3/src/pages/ant-design-vue.vue new file mode 100644 index 000000000..0707139d3 --- /dev/null +++ b/dev/children/vue3/src/pages/ant-design-vue.vue @@ -0,0 +1,335 @@ + + + + diff --git a/dev/children/vue3/src/pages/page2.vue b/dev/children/vue3/src/pages/element-plus.vue similarity index 100% rename from dev/children/vue3/src/pages/page2.vue rename to dev/children/vue3/src/pages/element-plus.vue diff --git a/dev/children/vue3/src/pages/page1.vue b/dev/children/vue3/src/pages/home.vue similarity index 90% rename from dev/children/vue3/src/pages/page1.vue rename to dev/children/vue3/src/pages/home.vue index 9050623b2..8a543d66b 100644 --- a/dev/children/vue3/src/pages/page1.vue +++ b/dev/children/vue3/src/pages/home.vue @@ -4,8 +4,11 @@
                  {{microDataStr}}
                  - + 跳转element-plus +   + + 跳转ant-design-vue
                  diff --git a/dev/children/vue3/src/router.js b/dev/children/vue3/src/router.js index 4d69944f6..c0e1751b7 100644 --- a/dev/children/vue3/src/router.js +++ b/dev/children/vue3/src/router.js @@ -1,4 +1,4 @@ -import Home from './pages/page1.vue' +import Home from './pages/home.vue' const routes = [ { @@ -7,9 +7,14 @@ const routes = [ component: Home, }, { - path: '/page2', - name: 'page2', - component: () => import(/* webpackChunkName: "page2" */ './pages/page2.vue'), + path: '/element-plus', + name: 'element-plus', + component: () => import(/* webpackChunkName: "element-plus" */ './pages/element-plus.vue'), + }, + { + path: '/ant-design-vue', + name: 'ant-design-vue', + component: () => import(/* webpackChunkName: "ant-design-vue" */ './pages/ant-design-vue.vue'), }, ] diff --git a/dev/children/vue3/yarn.lock b/dev/children/vue3/yarn.lock index a3aab7a84..2c971e35c 100644 --- a/dev/children/vue3/yarn.lock +++ b/dev/children/vue3/yarn.lock @@ -2,6 +2,26 @@ # yarn lockfile v1 +"@ant-design/colors@^6.0.0": + version "6.0.0" + resolved "https://registry.npmjs.org/@ant-design/colors/-/colors-6.0.0.tgz#9b9366257cffcc47db42b9d0203bb592c13c0298" + integrity sha512-qAZRvPzfdWHtfameEGP2Qvuf838NhergR35o+EuVyB5XvSA98xod5r4utvi4TJ3ywmevm290g9nsCG5MryrdWQ== + dependencies: + "@ctrl/tinycolor" "^3.4.0" + +"@ant-design/icons-svg@^4.2.1": + version "4.2.1" + resolved "https://registry.npmjs.org/@ant-design/icons-svg/-/icons-svg-4.2.1.tgz#8630da8eb4471a4aabdaed7d1ff6a97dcb2cf05a" + integrity sha512-EB0iwlKDGpG93hW8f85CTJTs4SvMX7tt5ceupvhALp1IF44SeUFOMhKUOYqpsoYWQKAOuTRDMqn75rEaKDp0Xw== + +"@ant-design/icons-vue@^6.1.0": + version "6.1.0" + resolved "https://registry.npmjs.org/@ant-design/icons-vue/-/icons-vue-6.1.0.tgz#f9324fdc0eb4cea943cf626d2bf3db9a4ff4c074" + integrity sha512-EX6bYm56V+ZrKN7+3MT/ubDkvJ5rK/O2t380WFRflDcVFgsvl3NLH7Wxeau6R8DbrO5jWR6DSTC3B6gYFp77AA== + dependencies: + "@ant-design/colors" "^6.0.0" + "@ant-design/icons-svg" "^4.2.1" + "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.16.7": version "7.16.7" resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" @@ -883,6 +903,13 @@ "@babel/types" "^7.4.4" esutils "^2.0.2" +"@babel/runtime@^7.10.5": + version "7.18.6" + resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.18.6.tgz#6a1ef59f838debd670421f8c7f2cbb8da9751580" + integrity sha512-t9wi7/AW6XtKahAe20Yw0/mMljKq0B1r2fPdvaAdV/KPDZewFXdaaa6K7lxmZBZ8FBNpCiAT6iHPmd6QO9bKfQ== + dependencies: + regenerator-runtime "^0.13.4" + "@babel/runtime@^7.11.0", "@babel/runtime@^7.8.4": version "7.16.7" resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz#03ff99f64106588c9c403c6ecb8c3bafbbdff1fa" @@ -992,6 +1019,14 @@ resolved "https://registry.npmjs.org/@popperjs/core/-/core-2.11.2.tgz#830beaec4b4091a9e9398ac50f865ddea52186b9" integrity sha512-92FRmppjjqz29VMJ2dn+xdyXZBrMlE42AV6Kq6BwjWV7CNUW1hs2FtxSNLQE+gJhaZ6AAmYuO9y8dshhcBl7vA== +"@simonwep/pickr@~1.8.0": + version "1.8.2" + resolved "https://registry.npmjs.org/@simonwep/pickr/-/pickr-1.8.2.tgz#96dc86675940d7cad63d69c22083dd1cbb9797cb" + integrity sha512-/l5w8BIkrpP6n1xsetx9MWPWlU6OblN5YgZZphxan0Tq4BByTCETL6lyIeY8lagalS2Nbt4F2W034KHLIiunKA== + dependencies: + core-js "^3.15.1" + nanopop "^2.1.0" + "@soda/friendly-errors-webpack-plugin@^1.7.1": version "1.8.1" resolved "https://registry.npmjs.org/@soda/friendly-errors-webpack-plugin/-/friendly-errors-webpack-plugin-1.8.1.tgz#4d4fbb1108993aaa362116247c3d18188a2c6c85" @@ -1806,6 +1841,29 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" +ant-design-vue@^3.2.10: + version "3.2.10" + resolved "https://registry.npmjs.org/ant-design-vue/-/ant-design-vue-3.2.10.tgz#938260177126cf7ab0dc476dd9e3e9d06ab17bae" + integrity sha512-aqa0kjJzVQ74MfVw5w7rTOdJQL2JN9V/O6Ro+VQQMq/tY7q91JiomhI9TRKAK3tFdBDXJpUoBCVOsosbbxMzRw== + dependencies: + "@ant-design/colors" "^6.0.0" + "@ant-design/icons-vue" "^6.1.0" + "@babel/runtime" "^7.10.5" + "@ctrl/tinycolor" "^3.4.0" + "@simonwep/pickr" "~1.8.0" + array-tree-filter "^2.1.0" + async-validator "^4.0.0" + dayjs "^1.10.5" + dom-align "^1.12.1" + dom-scroll-into-view "^2.0.0" + lodash "^4.17.21" + lodash-es "^4.17.15" + resize-observer-polyfill "^1.5.1" + scroll-into-view-if-needed "^2.2.25" + shallow-equal "^1.0.0" + vue-types "^3.0.0" + warning "^4.0.0" + any-promise@^1.0.0: version "1.3.0" resolved "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" @@ -1869,6 +1927,11 @@ array-flatten@^2.1.0: resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz#24ef80a28c1a893617e2149b0c6d0d788293b099" integrity sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ== +array-tree-filter@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/array-tree-filter/-/array-tree-filter-2.1.0.tgz#873ac00fec83749f255ac8dd083814b4f6329190" + integrity sha512-4ROwICNlNw/Hqa9v+rk5h22KjmzB1JGTMVKP2AKJBOCgb0yL0ASf0+YvCcLNNwquOHNX48jkeZIJ3a+oOQqKcw== + array-union@^1.0.1, array-union@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" @@ -1936,6 +1999,11 @@ async-limiter@~1.0.0: resolved "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== +async-validator@^4.0.0: + version "4.2.5" + resolved "https://registry.npmjs.org/async-validator/-/async-validator-4.2.5.tgz#c96ea3332a521699d0afaaceed510a54656c6339" + integrity sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg== + async-validator@^4.0.7: version "4.0.7" resolved "https://registry.npmjs.org/async-validator/-/async-validator-4.0.7.tgz#034a0fd2103a6b2ebf010da75183bec299247afe" @@ -2729,6 +2797,11 @@ compression@^1.7.4: safe-buffer "5.1.2" vary "~1.1.2" +compute-scroll-into-view@^1.0.17: + version "1.0.17" + resolved "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-1.0.17.tgz#6a88f18acd9d42e9cf4baa6bec7e0522607ab7ab" + integrity sha512-j4dx+Fb0URmzbwwMUrhqWM2BEWHdFGx+qZ9qqASHRPqvTYdqvWnHg0H1hIbcyLnvgnoNAVMlwkepyqM3DaIFUg== + concat-map@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -2838,6 +2911,11 @@ core-js-compat@^3.18.0, core-js-compat@^3.19.1, core-js-compat@^3.6.5: browserslist "^4.19.1" semver "7.0.0" +core-js@^3.15.1: + version "3.23.3" + resolved "https://registry.npmjs.org/core-js/-/core-js-3.23.3.tgz#3b977612b15da6da0c9cc4aec487e8d24f371112" + integrity sha512-oAKwkj9xcWNBAvGbT//WiCdOMpb9XQG92/Fe3ABFM/R16BsHgePG00mFOgKf7IsCtfj8tA1kHtf/VwErhriz5Q== + core-js@^3.6.5: version "3.20.2" resolved "https://registry.npmjs.org/core-js/-/core-js-3.20.2.tgz#46468d8601eafc8b266bd2dd6bf9dee622779581" @@ -3121,6 +3199,11 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +dayjs@^1.10.5: + version "1.11.3" + resolved "https://registry.npmjs.org/dayjs/-/dayjs-1.11.3.tgz#4754eb694a624057b9ad2224b67b15d552589258" + integrity sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A== + dayjs@^1.10.7: version "1.10.7" resolved "https://registry.npmjs.org/dayjs/-/dayjs-1.10.7.tgz#2cf5f91add28116748440866a0a1d26f3a6ce468" @@ -3314,6 +3397,11 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" +dom-align@^1.12.1: + version "1.12.3" + resolved "https://registry.npmjs.org/dom-align/-/dom-align-1.12.3.tgz#a36d02531dae0eefa2abb0c4db6595250526f103" + integrity sha512-Gj9hZN3a07cbR6zviMUBOMPdWxYhbMI+x+WS0NAIu2zFZmbK8ys9R79g+iG9qLnlCwpFoaB+fKy8Pdv470GsPA== + dom-converter@^0.2.0: version "0.2.0" resolved "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz#6721a9daee2e293682955b6afe416771627bb768" @@ -3321,6 +3409,11 @@ dom-converter@^0.2.0: dependencies: utila "~0.4" +dom-scroll-into-view@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/dom-scroll-into-view/-/dom-scroll-into-view-2.0.1.tgz#0decc8522801fd8d3f1c6ba355a74d382c5f989b" + integrity sha512-bvVTQe1lfaUr1oFzZX80ce9KLDlZ3iU+XGNE/bz9HnGdklTieqsbmsLHe+rT2XWqopvL0PckkYqN7ksmm5pe3w== + dom-serializer@0: version "0.2.2" resolved "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz#1afb81f533717175d478655debc5e332d9f9bb51" @@ -5040,6 +5133,11 @@ is-plain-obj@^3.0.0: resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz#af6f2ea14ac5a646183a5bbdb5baabbc156ad9d7" integrity sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA== +is-plain-object@3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.1.tgz#662d92d24c0aa4302407b0d45d21f2251c85f85b" + integrity sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g== + is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" resolved "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" @@ -5162,7 +5260,7 @@ js-queue@2.0.2: dependencies: easy-stack "^1.0.1" -js-tokens@^4.0.0: +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== @@ -5374,6 +5472,11 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +lodash-es@^4.17.15: + version "4.17.21" + resolved "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" + integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== + lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" @@ -5426,6 +5529,13 @@ loglevel@^1.6.8: resolved "https://registry.npmjs.org/loglevel/-/loglevel-1.8.0.tgz#e7ec73a57e1e7b419cb6c6ac06bf050b67356114" integrity sha512-G6A/nJLRgWOuuwdNuA6koovfEV1YpqqAG4pRUlFaz3jj2QNZ8M4vBqnVA+HBTmU/AMNUtlOsMmSpF6NyOjztbA== +loose-envify@^1.0.0: + version "1.4.0" + resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + lower-case@^1.1.1: version "1.1.4" resolved "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" @@ -5770,6 +5880,11 @@ nanomatch@^1.2.9: snapdragon "^0.8.1" to-regex "^3.0.1" +nanopop@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/nanopop/-/nanopop-2.1.0.tgz#23476513cee2405888afd2e8a4b54066b70b9e60" + integrity sha512-jGTwpFRexSH+fxappnGQtN9dspgE2ipa1aOjtR24igG0pv6JCxImIAmrLRHX+zUF5+1wtsFVbKyfP51kIGAVNw== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -7124,6 +7239,11 @@ requires-port@^1.0.0: resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= +resize-observer-polyfill@^1.5.1: + version "1.5.1" + resolved "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464" + integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg== + resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" @@ -7277,6 +7397,13 @@ schema-utils@^2.0.0, schema-utils@^2.5.0, schema-utils@^2.6.5, schema-utils@^2.7 ajv "^6.12.4" ajv-keywords "^3.5.2" +scroll-into-view-if-needed@^2.2.25: + version "2.2.29" + resolved "https://registry.npmjs.org/scroll-into-view-if-needed/-/scroll-into-view-if-needed-2.2.29.tgz#551791a84b7e2287706511f8c68161e4990ab885" + integrity sha512-hxpAR6AN+Gh53AdAimHM6C8oTN1ppwVZITihix+WqalywBeFcQ6LdQP5ABNl26nX8GTEL7VT+b8lKpdqq65wXg== + dependencies: + compute-scroll-into-view "^1.0.17" + select-hose@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" @@ -7391,6 +7518,11 @@ sha.js@^2.4.0, sha.js@^2.4.8: inherits "^2.0.1" safe-buffer "^5.0.1" +shallow-equal@^1.0.0: + version "1.2.1" + resolved "https://registry.npmjs.org/shallow-equal/-/shallow-equal-1.2.1.tgz#4c16abfa56043aa20d050324efa68940b0da79da" + integrity sha512-S4vJDjHHMBaiZuT9NPb616CSmLf618jawtv3sufLl6ivK8WocjAo58cXwbRV1cgqxH0Qbv+iUt6m05eqEa2IRA== + shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" @@ -8408,6 +8540,13 @@ vue-template-es2015-compiler@^1.9.0: resolved "https://registry.npmjs.org/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.9.1.tgz#1ee3bc9a16ecbf5118be334bb15f9c46f82f5825" integrity sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw== +vue-types@^3.0.0: + version "3.0.2" + resolved "https://registry.npmjs.org/vue-types/-/vue-types-3.0.2.tgz#ec16e05d412c038262fc1efa4ceb9647e7fb601d" + integrity sha512-IwUC0Aq2zwaXqy74h4WCvFCUtoV0iSWr0snWnE9TnU18S66GAQyqQbRf2qfJtUuiFsBf6qp0MEwdonlwznlcrw== + dependencies: + is-plain-object "3.0.1" + vue@^3.2.26: version "3.2.26" resolved "https://registry.npmjs.org/vue/-/vue-3.2.26.tgz#5db575583ecae495c7caa5c12fd590dffcbb763e" @@ -8419,6 +8558,13 @@ vue@^3.2.26: "@vue/server-renderer" "3.2.26" "@vue/shared" "3.2.26" +warning@^4.0.0: + version "4.0.3" + resolved "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3" + integrity sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w== + dependencies: + loose-envify "^1.0.0" + watchpack-chokidar2@^2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz#38500072ee6ece66f3769936950ea1771be1c957" diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index 7bd8bb67c..d5d8a8f9d 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -277,6 +277,7 @@ export default class App extends React.Component { // disableScopecss // disable-scopecss // macro + // shadowDOM > ) diff --git a/dev/main-react16/src/pages/vue3/vue3.js b/dev/main-react16/src/pages/vue3/vue3.js index 325dcc475..55450769d 100644 --- a/dev/main-react16/src/pages/vue3/vue3.js +++ b/dev/main-react16/src/pages/vue3/vue3.js @@ -17,15 +17,19 @@ function Vue3 () { microApp.router.push({name: 'vue3', path: '/micro-app/vue3/'}) } - function jumpToPage2 () { - microApp.router.push({name: 'vue3', path: '/micro-app/vue3/page2'}) + function jumpToElementPlus () { + microApp.router.push({name: 'vue3', path: '/micro-app/vue3/element-plus'}) + } + function jumpToAntDesignVue () { + microApp.router.push({name: 'vue3', path: '/micro-app/vue3/ant-design-vue'}) } return (
                  - + - + + { showLoading && diff --git a/src/libs/global_env.ts b/src/libs/global_env.ts index 072e3b8ac..69acb1244 100644 --- a/src/libs/global_env.ts +++ b/src/libs/global_env.ts @@ -24,6 +24,7 @@ declare global { interface Node { __MICRO_APP_NAME__?: string | null + __PURE_ELEMENT__?: boolean data?: unknown } diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 0d7abee7a..d8b274fa8 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -327,6 +327,7 @@ export function isSafari (): boolean { export function pureCreateElement (tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K] { const element = document.createElement(tagName, options) if (element.__MICRO_APP_NAME__) delete element.__MICRO_APP_NAME__ + element.__PURE_ELEMENT__ = true return element } diff --git a/src/sandbox/adapter.ts b/src/sandbox/adapter.ts index 7ee99684d..f524fd4b5 100644 --- a/src/sandbox/adapter.ts +++ b/src/sandbox/adapter.ts @@ -63,3 +63,26 @@ export function fixReactHMRConflict (app: AppInterface): void { } } } + +/** + * reDefine parentNode of html + * Scenes: + * 1. element-ui popover.js + * if (html.parentNode === document) ... + */ +export function throttleDeferForParentNode (proxyDocument: Document): void { + const html = globalEnv.rawDocument.firstElementChild + if (html && html.parentNode !== proxyDocument) { + setRootParentNode(html, proxyDocument) + defer(() => { + setRootParentNode(html, globalEnv.rawDocument) + }) + } +} + +export function setRootParentNode (root: Element, value: Document): void { + Object.defineProperty(root, 'parentNode', { + value, + configurable: true, + }) +} diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 4714cd2c2..97d56749f 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -45,9 +45,19 @@ import createMicroRouter, { updateBrowserURLWithLocation, router, } from './router' -import Adapter, { fixBabelPolyfill6 } from './adapter' -import { createMicroFetch, useMicroEventSource, createMicroXMLHttpRequest } from './request' -export { router, getNoHashMicroPathFromURL } from './router' +import Adapter, { + fixBabelPolyfill6, + throttleDeferForParentNode, +} from './adapter' +import { + createMicroFetch, + useMicroEventSource, + createMicroXMLHttpRequest, +} from './request' +export { + router, + getNoHashMicroPathFromURL, +} from './router' export type MicroAppWindowDataType = { __MICRO_APP_ENVIRONMENT__: boolean, @@ -236,7 +246,6 @@ export default class SandBox implements SandBoxInterface { return new Proxy(this.microAppWindow, { get: (target: microAppWindowType, key: PropertyKey): unknown => { throttleDeferForSetAppName(appName) - if ( Reflect.has(target, key) || (isString(key) && /^__MICRO_APP_/.test(key)) || @@ -360,24 +369,22 @@ export default class SandBox implements SandBoxInterface { pureCreateElement, router, }) + this.setProxyDocument(microAppWindow, appName) this.setMappingPropertiesWithRawDescriptor(microAppWindow) if (useMemoryRouter) this.setMicroAppRouter(microAppWindow, appName, url) } - /** - * init global properties of microAppWindow when exec sandBox.start - * @param microAppWindow micro window - * @param appName app name - * @param url app url - */ - private initGlobalKeysWhenStart ( - microAppWindow: microAppWindowType, - appName: string, - url: string, - ): void { - microAppWindow.hasOwnProperty = (key: PropertyKey) => rawHasOwnProperty.call(microAppWindow, key) || rawHasOwnProperty.call(globalEnv.rawWindow, key) - this.setHijackProperties(microAppWindow, appName) - this.patchHijackRequest(microAppWindow, appName, url) + private setProxyDocument (microAppWindow: microAppWindowType, appName: string): void { + const proxyDocument = this.createProxyDocument(appName) + rawDefineProperty(microAppWindow, 'document', { + configurable: false, + enumerable: true, + get () { + throttleDeferForSetAppName(appName) + // return globalEnv.rawDocument + return proxyDocument + }, + }) } // properties associated with the native window @@ -424,20 +431,26 @@ export default class SandBox implements SandBoxInterface { return descriptor } + /** + * init global properties of microAppWindow when exec sandBox.start + * @param microAppWindow micro window + * @param appName app name + * @param url app url + */ + private initGlobalKeysWhenStart ( + microAppWindow: microAppWindowType, + appName: string, + url: string, + ): void { + microAppWindow.hasOwnProperty = (key: PropertyKey) => rawHasOwnProperty.call(microAppWindow, key) || rawHasOwnProperty.call(globalEnv.rawWindow, key) + this.setHijackProperty(microAppWindow, appName) + this.patchRequestApi(microAppWindow, appName, url) + } + // set hijack Properties to microAppWindow - private setHijackProperties (microAppWindow: microAppWindowType, appName: string): void { + private setHijackProperty (microAppWindow: microAppWindowType, appName: string): void { let modifiedEval: unknown, modifiedImage: unknown - const proxyDocument = this.createProxyDocument(appName) rawDefineProperties(microAppWindow, { - document: { - configurable: true, - enumerable: true, - get () { - throttleDeferForSetAppName(appName) - // return globalEnv.rawDocument - return proxyDocument - }, - }, eval: { configurable: true, enumerable: false, @@ -464,7 +477,7 @@ export default class SandBox implements SandBoxInterface { } // rewrite fetch, XMLHttpRequest, EventSource - private patchHijackRequest (microAppWindow: microAppWindowType, appName: string, url: string): void { + private patchRequestApi (microAppWindow: microAppWindowType, appName: string, url: string): void { let microFetch = createMicroFetch(url) let microXMLHttpRequest = createMicroXMLHttpRequest(url) let microEventSource = createMicroEventSource(appName, url) @@ -555,22 +568,22 @@ export default class SandBox implements SandBoxInterface { removeStateAndPathFromBrowser(this.proxyWindow.__MICRO_APP_NAME__) } - private createProxyDocument (appName: string) { - const rawDocument = globalEnv.rawDocument - const createElement = function (tagName: string, options?: ElementCreationOptions): HTMLElement { - const element = globalEnv.rawCreateElement.call(rawDocument, tagName, options) - element.__MICRO_APP_NAME__ = appName - return element - } + private createProxyDocument (appName: string): Document { + // const createElement = function (tagName: string, options?: ElementCreationOptions): HTMLElement { + // const element = globalEnv.rawCreateElement.call(globalEnv.rawDocument, tagName, options) + // element.__MICRO_APP_NAME__ = appName + // return element + // } - // @ts-ignore - const proxyDocument = new Proxy(rawDocument, { - get (_target: Document, p: string | symbol): unknown { - if (p === 'createElement') { - return createElement - } - const rawValue = Reflect.get(rawDocument, p) - return isFunction(rawValue) ? bindFunctionToRawObject(rawDocument, rawValue, 'DOCUMENT') : rawValue + const proxyDocument = new Proxy(globalEnv.rawDocument, { + get (target: Document, key: PropertyKey): unknown { + throttleDeferForSetAppName(appName) + throttleDeferForParentNode(proxyDocument) + // if (key === 'createElement') { + // return createElement + // } + const rawValue = Reflect.get(target, key) + return isFunction(rawValue) ? bindFunctionToRawObject(target, rawValue, 'DOCUMENT') : rawValue }, }) diff --git a/src/sandbox/router/history.ts b/src/sandbox/router/history.ts index 871cd5d7d..1b5a4572d 100644 --- a/src/sandbox/router/history.ts +++ b/src/sandbox/router/history.ts @@ -10,6 +10,7 @@ import { isString, createURL, isPlainObject, isURL, assign, isFunction } from '. import { setMicroPathToURL, setMicroState, getMicroState } from './core' import { dispatchNativeEvent } from './event' import { updateMicroLocation } from './location' +import bindFunctionToRawObject from '../bind_function' /** * create proxyHistory for microApp @@ -19,12 +20,9 @@ import { updateMicroLocation } from './location' */ export function createMicroHistory (appName: string, microLocation: MicroLocation): MicroHistory { const rawHistory = globalEnv.rawWindow.history - function getMicroHistoryMethod (methodName: PropertyKey): CallableFunction { + function getMicroHistoryMethod (methodName: string): CallableFunction { return function (...rests: unknown[]): void { - if ( - (methodName === 'pushState' || methodName === 'replaceState') && - (isString(rests[2]) || isURL(rests[2])) - ) { + if (isString(rests[2]) || isURL(rests[2])) { const targetLocation = createURL(rests[2], microLocation.href) if (targetLocation.origin === microLocation.origin) { navigateWithNativeEvent( @@ -47,17 +45,20 @@ export function createMicroHistory (appName: string, microLocation: MicroLocatio } } + const pushState = getMicroHistoryMethod('pushState') + const replaceState = getMicroHistoryMethod('replaceState') + return new Proxy(rawHistory, { get (target: History, key: PropertyKey): HistoryProxyValue { if (key === 'state') { return getMicroState(appName, rawHistory.state) - } else if (isFunction(Reflect.get(target, key))) { - return getMicroHistoryMethod(key) + } else if (key === 'pushState') { + return pushState + } else if (key === 'replaceState') { + return replaceState } - return Reflect.get(target, key) - }, - set (target: History, key: PropertyKey, value: unknown): boolean { - return Reflect.set(target, key, value) + const rawValue = Reflect.get(target, key) + return isFunction(rawValue) ? bindFunctionToRawObject(target, rawValue, 'HISTORY') : rawValue } }) } diff --git a/src/source/patch.ts b/src/source/patch.ts index b9a84eb12..2fad3a910 100644 --- a/src/source/patch.ts +++ b/src/source/patch.ts @@ -189,7 +189,15 @@ function commonElementHandler ( passiveChild: Node | null, rawMethod: Func, ) { - if (newChild?.__MICRO_APP_NAME__) { + const appName = getCurrentAppName() + if ( + newChild instanceof Node && + ( + newChild.__MICRO_APP_NAME__ || + (appName && !newChild.__PURE_ELEMENT__) + ) + ) { + newChild.__MICRO_APP_NAME__ = newChild.__MICRO_APP_NAME__ || appName! const app = appInstanceMap.get(newChild.__MICRO_APP_NAME__) if (app?.container) { return invokePrototypeMethod( @@ -203,7 +211,6 @@ function commonElementHandler ( return rawMethod.call(parent, newChild) } } else if (rawMethod === globalEnv.rawAppend || rawMethod === globalEnv.rawPrepend) { - const appName = getCurrentAppName() if (!(newChild instanceof Node) && appName) { const app = appInstanceMap.get(appName) if (app?.container) { From 26151c329bbaf48d82f4d162745b3f28c9ae5941 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Mon, 11 Jul 2022 17:38:39 +0800 Subject: [PATCH 047/268] fix(sandbox): fix bug of domScope not release when exec rawWindow.fetch --- dev/main-react16/src/pages/document.ejs | 1 + src/libs/utils.ts | 15 ++++++++++++++- src/sandbox/bind_function.ts | 18 ++++-------------- src/sandbox/request.ts | 24 ++++++++++++++++++------ src/source/fetch.ts | 12 ++++++++++-- 5 files changed, 47 insertions(+), 23 deletions(-) diff --git a/dev/main-react16/src/pages/document.ejs b/dev/main-react16/src/pages/document.ejs index f2578304e..4a29b9b53 100644 --- a/dev/main-react16/src/pages/document.ejs +++ b/dev/main-react16/src/pages/document.ejs @@ -23,6 +23,7 @@ /> Micro App + diff --git a/src/libs/utils.ts b/src/libs/utils.ts index d8b274fa8..ca7e00cd7 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -66,10 +66,23 @@ export function isPromise (target: unknown): target is Promise { } // is bind function -export function isBoundFunction (target: unknown): target is Function { +export function isBoundFunction (target: unknown): boolean { return isFunction(target) && target.name.indexOf('bound ') === 0 && !target.hasOwnProperty('prototype') } +export function isConstructor (target: unknown): boolean { + if (isFunction(target)) { + const targetStr = target.toString() + return ( + target.prototype?.constructor === target && + Object.getOwnPropertyNames(target.prototype).length > 1 + ) || + /^function\s+[A-Z]/.test(targetStr) || + /^class\s+/.test(targetStr) + } + return false +} + // is ShadowRoot export function isShadowRoot (target: unknown): target is ShadowRoot { return typeof ShadowRoot !== 'undefined' && target instanceof ShadowRoot diff --git a/src/sandbox/bind_function.ts b/src/sandbox/bind_function.ts index 047ba01dd..7a8d5659b 100644 --- a/src/sandbox/bind_function.ts +++ b/src/sandbox/bind_function.ts @@ -1,24 +1,14 @@ /* eslint-disable no-return-assign */ -import { isBoundFunction, rawDefineProperty, isBoolean } from '../libs/utils' +import { isBoundFunction, isConstructor, rawDefineProperty, isBoolean } from '../libs/utils' function isBoundedFunction (value: CallableFunction & {__MICRO_APP_IS_BOUND_FUNCTION__: boolean}): boolean { if (isBoolean(value.__MICRO_APP_IS_BOUND_FUNCTION__)) return value.__MICRO_APP_IS_BOUND_FUNCTION__ return value.__MICRO_APP_IS_BOUND_FUNCTION__ = isBoundFunction(value) } -function isConstructor (value: FunctionConstructor & {__MICRO_APP_IS_CONSTRUCTOR__: boolean}) { +function isConstructorFunction (value: FunctionConstructor & {__MICRO_APP_IS_CONSTRUCTOR__: boolean}) { if (isBoolean(value.__MICRO_APP_IS_CONSTRUCTOR__)) return value.__MICRO_APP_IS_CONSTRUCTOR__ - - const valueStr = value.toString() - - const result = ( - value.prototype?.constructor === value && - Object.getOwnPropertyNames(value.prototype).length > 1 - ) || - /^function\s+[A-Z]/.test(valueStr) || - /^class\s+/.test(valueStr) - - return value.__MICRO_APP_IS_CONSTRUCTOR__ = result + return value.__MICRO_APP_IS_CONSTRUCTOR__ = isConstructor(value) } // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types @@ -26,7 +16,7 @@ export default function bindFunctionToRawObject (rawObject: T, value const cacheKey = `__MICRO_APP_BOUND_${key}_FUNCTION__` if (value[cacheKey]) return value[cacheKey] - if (!isConstructor(value) && !isBoundedFunction(value)) { + if (!isConstructorFunction(value) && !isBoundedFunction(value)) { const bindRawObjectValue = value.bind(rawObject) for (const key in value) { diff --git a/src/sandbox/request.ts b/src/sandbox/request.ts index 96b2171e7..61b51b0ba 100644 --- a/src/sandbox/request.ts +++ b/src/sandbox/request.ts @@ -5,6 +5,8 @@ import { isString, createURL, isURL, + removeDomScope, + isConstructor, } from '../libs/utils' /** @@ -16,8 +18,8 @@ import { * @param target proxy target */ export function createMicroFetch (url: string, target?: Window['fetch']): Window['fetch'] { - if (!isUndefined(target) && !isFunction(target)) return target - const rawFetch = target || globalEnv.rawWindow.fetch + const rawFetch = !isUndefined(target) ? target : globalEnv.rawWindow.fetch + if (!isFunction(rawFetch)) return rawFetch return function microFetch ( input: RequestInfo | URL | string, init?: RequestInit, @@ -26,6 +28,14 @@ export function createMicroFetch (url: string, target?: Window['fetch']): Window if (isString(input) || isURL(input)) { input = createURL(input, url).toString() } + /** + * When fetch rewrite by baseApp, domScope still active when exec rawWindow.fetch + * If baseApp operate dom in fetch, it will cause error + * The same for XMLHttpRequest, EventSource + * e.g. + * baseApp: + */ + removeDomScope() return rawFetch.call(globalEnv.rawWindow, input, init, ...rests) } } @@ -37,13 +47,14 @@ export function createMicroFetch (url: string, target?: Window['fetch']): Window * @param target proxy target */ export function createMicroXMLHttpRequest (url: string, target?: XMLHttpRequest): any { - if (!isUndefined(target) && !isFunction(target)) return target - const rawXMLHttpRequest = target || globalEnv.rawWindow.XMLHttpRequest + const rawXMLHttpRequest = !isUndefined(target) ? target : globalEnv.rawWindow.XMLHttpRequest + if (!isConstructor(rawXMLHttpRequest)) return rawXMLHttpRequest return class MicroXMLHttpRequest extends rawXMLHttpRequest { open (method: string, reqUrl: string, ...rests: unknown[]): void { if ((isString(reqUrl) && !/^f(ile|tp):\/\//.test(reqUrl)) || isURL(reqUrl)) { reqUrl = createURL(reqUrl, url).toString() } + removeDomScope() super.open(method, reqUrl, ...rests) } } @@ -70,8 +81,8 @@ export function useMicroEventSource (): EventSourceApi { * @param target proxy target */ function createMicroEventSource (appName: string, url: string, target?: EventSource): any { - if (!isUndefined(target) && !isFunction(target)) return target - const rawEventSource = target || globalEnv.rawWindow.EventSource + const rawEventSource = !isUndefined(target) ? target : globalEnv.rawWindow.EventSource + if (!isConstructor(rawEventSource)) return rawEventSource return class MicroEventSource extends rawEventSource { constructor ( eventSourceUrl: string | URL, @@ -81,6 +92,7 @@ export function useMicroEventSource (): EventSourceApi { if (isString(eventSourceUrl) || isURL(eventSourceUrl)) { eventSourceUrl = createURL(eventSourceUrl, url).toString() } + removeDomScope() super(eventSourceUrl, eventSourceInitDict, ...rests) if (eventSourceMap) { diff --git a/src/source/fetch.ts b/src/source/fetch.ts index 32813ca0d..13932ad75 100644 --- a/src/source/fetch.ts +++ b/src/source/fetch.ts @@ -1,5 +1,6 @@ -import { isFunction } from '../libs/utils' +import { isFunction, removeDomScope } from '../libs/utils' import microApp from '../micro_app' +import globalEnv from '../libs/global_env' /** * fetch source of html, js, css @@ -8,10 +9,17 @@ import microApp from '../micro_app' * @param config fetch options */ export function fetchSource (url: string, appName: string | null = null, options = {}): Promise { + /** + * When child navigate to new async page, click event will scope dom to child and then fetch new source + * this may cause error when fetch rewrite by baseApp + * e.g. + * baseApp: + */ + removeDomScope() if (isFunction(microApp.fetch)) { return microApp.fetch!(url, options, appName) } - return fetch(url, options).then((res) => { + return globalEnv.rawWindow.fetch(url, options).then((res: Response) => { return res.text() }) } From 7a8bb16c5dc5a003314d74452255b7c73a68d0a1 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Mon, 11 Jul 2022 18:13:48 +0800 Subject: [PATCH 048/268] feat: patch proxyDocument of createElement --- dev/main-react16/src/pages/document.ejs | 2 +- src/libs/utils.ts | 1 + src/sandbox/index.ts | 14 ++++++-------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/dev/main-react16/src/pages/document.ejs b/dev/main-react16/src/pages/document.ejs index 4a29b9b53..b27a0b2c9 100644 --- a/dev/main-react16/src/pages/document.ejs +++ b/dev/main-react16/src/pages/document.ejs @@ -23,7 +23,7 @@ /> Micro App - + diff --git a/src/libs/utils.ts b/src/libs/utils.ts index ca7e00cd7..cdadee2b0 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -70,6 +70,7 @@ export function isBoundFunction (target: unknown): boolean { return isFunction(target) && target.name.indexOf('bound ') === 0 && !target.hasOwnProperty('prototype') } +// is constructor function export function isConstructor (target: unknown): boolean { if (isFunction(target)) { const targetStr = target.toString() diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 97d56749f..6393cc48f 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -569,19 +569,17 @@ export default class SandBox implements SandBoxInterface { } private createProxyDocument (appName: string): Document { - // const createElement = function (tagName: string, options?: ElementCreationOptions): HTMLElement { - // const element = globalEnv.rawCreateElement.call(globalEnv.rawDocument, tagName, options) - // element.__MICRO_APP_NAME__ = appName - // return element - // } + const createElement = function (tagName: string, options?: ElementCreationOptions): HTMLElement { + const element = globalEnv.rawCreateElement.call(globalEnv.rawDocument, tagName, options) + element.__MICRO_APP_NAME__ = appName + return element + } const proxyDocument = new Proxy(globalEnv.rawDocument, { get (target: Document, key: PropertyKey): unknown { throttleDeferForSetAppName(appName) throttleDeferForParentNode(proxyDocument) - // if (key === 'createElement') { - // return createElement - // } + if (key === 'createElement') return createElement const rawValue = Reflect.get(target, key) return isFunction(rawValue) ? bindFunctionToRawObject(target, rawValue, 'DOCUMENT') : rawValue }, From d55eb9936ea218f1640ce8df089061c12161f301 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Mon, 11 Jul 2022 20:58:11 +0800 Subject: [PATCH 049/268] chore: update dev/demo --- .../vue2/src/pages/{page1.vue => home.vue} | 0 dev/children/vue2/src/pages/root.vue | 12 - dev/children/vue2/src/router.js | 37 +- dev/children/vue3/src/App.vue | 9 +- .../vue3/src/pages/ant-design-vue.vue | 196 ++++---- dev/children/vue3/src/pages/element-plus.vue | 461 +++++++++++++++++- dev/children/vue3/src/pages/home.vue | 9 +- dev/main-react16/src/pages/document.ejs | 2 +- dev/main-react16/src/pages/vue3/vue3.js | 1 + src/source/fetch.ts | 6 +- 10 files changed, 577 insertions(+), 156 deletions(-) rename dev/children/vue2/src/pages/{page1.vue => home.vue} (100%) delete mode 100644 dev/children/vue2/src/pages/root.vue diff --git a/dev/children/vue2/src/pages/page1.vue b/dev/children/vue2/src/pages/home.vue similarity index 100% rename from dev/children/vue2/src/pages/page1.vue rename to dev/children/vue2/src/pages/home.vue diff --git a/dev/children/vue2/src/pages/root.vue b/dev/children/vue2/src/pages/root.vue deleted file mode 100644 index 6fef8edbe..000000000 --- a/dev/children/vue2/src/pages/root.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/dev/children/vue2/src/router.js b/dev/children/vue2/src/router.js index 014ea2e87..06da1e511 100644 --- a/dev/children/vue2/src/router.js +++ b/dev/children/vue2/src/router.js @@ -1,35 +1,24 @@ import Vue from 'vue'; import VueRouter from 'vue-router'; -import Root from './pages/root.vue'; -import Home from './pages/page1.vue'; -import Table from './pages/table.vue'; +import Home from './pages/home.vue'; Vue.use(VueRouter); const routes = [ { - // 因为vue-router在hash模式下无法设置base,如果基座和子应用都是hash路由,需要创建一个空的路由页面作为根页面,用于设置路由前缀 - // 如果基座应用是history模式则不需要使用root组件包裹 - // path: window.__MICRO_APP_BASE_ROUTE__ || '/', path: '/', - component: Root, - children: [ - { - path: '/', - name: 'home', - component: Home, - }, - { - path: '/page2', - name: 'page2', - component: () => import(/* webpackChunkName: "page2" */ './pages/page2.vue'), - }, - { - path: '/table', - name: 'table', - component: Table, - }, - ], + name: 'home', + component: Home, + }, + { + path: '/page2', + name: 'page2', + component: () => import(/* webpackChunkName: "page2" */ './pages/page2.vue'), + }, + { + path: '/table', + name: 'table', + component: () => import(/* webpackChunkName: "table" */ './pages/table.vue'), }, ]; diff --git a/dev/children/vue3/src/App.vue b/dev/children/vue3/src/App.vue index 47f0bfd3d..134809121 100644 --- a/dev/children/vue3/src/App.vue +++ b/dev/children/vue3/src/App.vue @@ -18,11 +18,16 @@ export default { diff --git a/dev/children/vue3/src/pages/ant-design-vue.vue b/dev/children/vue3/src/pages/ant-design-vue.vue index 0707139d3..8716a944a 100644 --- a/dev/children/vue3/src/pages/ant-design-vue.vue +++ b/dev/children/vue3/src/pages/ant-design-vue.vue @@ -1,67 +1,66 @@ diff --git a/dev/children/vue3/src/pages/home.vue b/dev/children/vue3/src/pages/home.vue index 8a543d66b..bbe24cbfe 100644 --- a/dev/children/vue3/src/pages/home.vue +++ b/dev/children/vue3/src/pages/home.vue @@ -2,7 +2,6 @@
                  -
                  {{microDataStr}}
                  跳转element-plus @@ -12,14 +11,8 @@
                  - - 展示Dialog - - It should be noted that the content will not be aligned in center by - default + {{microDataStr}} @@ -400,6 +440,7 @@ const popoverVisible = ref(false) const router = useRouter() const onClickTest = () => { router.push('/') + // console.log(router) } const formSize = ref('') @@ -591,6 +632,41 @@ const activeMenuIndex = ref('1') const handleMenuSelect = (key, keyPath) => { console.log(key, keyPath) } + +// const getTreeV2Key = (prefix, id) => { +// return `${prefix}-${id}` +// } + +// const createTreeV2Data = ( +// maxDeep, +// maxChildren, +// minNodesNumber, +// deep = 1, +// key = 'node' +// ) => { +// let id = 0 +// return Array.from({ length: minNodesNumber }) +// .fill(deep) +// .map(() => { +// const childrenNumber = +// deep === maxDeep ? 0 : Math.round(Math.random() * maxChildren) +// const nodeKey = getTreeV2Key(key, ++id) +// return { +// id: nodeKey, +// label: nodeKey, +// children: childrenNumber +// ? createTreeV2Data(maxDeep, maxChildren, childrenNumber, deep + 1, nodeKey) +// : undefined, +// } +// }) +// } + +// const treeV2Data = createTreeV2Data(4, 30, 40) + +const infiniteScrollCount = ref(0) +const infiniteScrollload = () => { + infiniteScrollCount.value += 2 +} diff --git a/dev/main-react16/src/pages/angular11/angular11.js b/dev/main-react16/src/pages/angular11/angular11.js index 50e0b716b..cb68aa257 100644 --- a/dev/main-react16/src/pages/angular11/angular11.js +++ b/dev/main-react16/src/pages/angular11/angular11.js @@ -33,6 +33,7 @@ function Angular11 () { // destroy // inline // disableScopecss + // keep-alive >
                  diff --git a/docs/zh-cn/changelog.md b/docs/zh-cn/changelog.md index 4e46daf98..778ad6510 100644 --- a/docs/zh-cn/changelog.md +++ b/docs/zh-cn/changelog.md @@ -8,6 +8,28 @@ --- +### 1.0.0-alpha.2 + +`2022-07-06` + +- **New** + + - 🆕 新增了`attachToURL`、`attachAllToURL`方法,用于将子应用的路由信息同步到浏览器地址。 + - 🆕 新增了`setBaseRouter`、`getBaseRouter`方法,用于注册和使用基座路由。 + - 🆕 新增了`ProxyDocument`,为子应用创建一个虚拟的document对象。 + +- **Bug Fix** + + - 🐞 修复了`ant-design-vue`的弹窗类组件及其它特殊情况下,子应用元素逃逸到原生body上的问题。 + - 🐞 修复了在未设置`public_path`时,子应用的资源地址补全失败的问题。 + - 🐞 修复了子应用在调用fetch等API时,元素绑定没有解除的问题。 + +- **Update** + + - 🚀 优化了路由相关代码和逻辑。 + - 🚀 更新了案例。 + + ### 1.0.0-alpha.1 `2022-07-06` diff --git a/package.json b/package.json index 8bd538a9e..8ca88c869 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@micro-zoe/micro-app", - "version": "1.0.0-alpha.1", + "version": "1.0.0-alpha.2", "description": "A lightweight, efficient and powerful micro front-end framework", "private": false, "main": "lib/index.min.js", diff --git a/src/libs/utils.ts b/src/libs/utils.ts index cdadee2b0..bdb8a1fa5 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -60,6 +60,11 @@ export function isPlainObject (target: unknown): target is Record { return toString.call(target) === '[object Promise]' diff --git a/src/sandbox/bind_function.ts b/src/sandbox/bind_function.ts index 7a8d5659b..97a44b726 100644 --- a/src/sandbox/bind_function.ts +++ b/src/sandbox/bind_function.ts @@ -1,5 +1,10 @@ /* eslint-disable no-return-assign */ -import { isBoundFunction, isConstructor, rawDefineProperty, isBoolean } from '../libs/utils' +import { + isBoundFunction, + isConstructor, + rawDefineProperty, + isBoolean, +} from '../libs/utils' function isBoundedFunction (value: CallableFunction & {__MICRO_APP_IS_BOUND_FUNCTION__: boolean}): boolean { if (isBoolean(value.__MICRO_APP_IS_BOUND_FUNCTION__)) return value.__MICRO_APP_IS_BOUND_FUNCTION__ diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index 806bc257f..79ce71590 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -15,6 +15,7 @@ import { } from './core' import { logError, + logWarn, formatAppName, createURL, isFunction, @@ -25,11 +26,13 @@ import { isString, noopFalse, removeDomScope, + isObject, } from '../../libs/utils' import { appInstanceMap } from '../../create_app' import { getActiveApps } from '../../micro_app' import globalEnv from '../../libs/global_env' import { navigateWithNativeEvent, attachRouteToBrowserURL } from './history' +import bindFunctionToRawObject from '../bind_function' export interface RouterApi { router: Router, @@ -37,6 +40,17 @@ export interface RouterApi { clearRouterWhenUnmount: (appName: string) => void } +export interface CreteBaseRouter { + setBaseAppRouter (baseRouter: unknown): void + getBaseAppRouter(): unknown +} + +export interface CreateDefaultPage { + setDefaultPage(appName: string, path: string): () => boolean + removeDefaultPage(appName: string): boolean + getDefaultPage(key: PropertyKey): string | undefined +} + function createRouterApi (): RouterApi { /** * common handler for router.push/router.replace method @@ -175,28 +189,6 @@ function createRouterApi (): RouterApi { router.current.delete(appName) } - // defaultPage data - const defaultPageRecord = useMapRecord() - - /** - * defaultPage only effect when mount, and has lower priority than query on browser url - * @param appName app name - * @param path page path - */ - function setDefaultPage (appName: string, path: string): () => boolean { - appName = formatAppName(appName) - if (!appName) return noopFalse - - return defaultPageRecord.add(appName, path) - } - - function removeDefaultPage (appName: string): boolean { - appName = formatAppName(appName) - if (!appName) return false - - return defaultPageRecord.delete(appName) - } - /** * NOTE: * 1. sandbox not open @@ -234,16 +226,68 @@ function createRouterApi (): RouterApi { getActiveApps().forEach(appName => commonHandlerForAttachToURL(appName)) } - /** - * Record base app router, let child app control base app navigation - */ - let baseRouterInstance: unknown = null - function setBaseAppRouter (baseRouter: unknown): void { - baseRouterInstance = baseRouter + function createDefaultPageApi (): CreateDefaultPage { + // defaultPage data + const defaultPageRecord = useMapRecord() + + /** + * defaultPage only effect when mount, and has lower priority than query on browser url + * @param appName app name + * @param path page path + */ + function setDefaultPage (appName: string, path: string): () => boolean { + appName = formatAppName(appName) + if (!appName || !path) { + if (process.env.NODE_ENV !== 'production') { + if (!appName) { + logWarn(`setDefaultPage: invalid appName "${appName}"`) + } else { + logWarn('setDefaultPage: path is required') + } + } + return noopFalse + } + + return defaultPageRecord.add(appName, path) + } + + function removeDefaultPage (appName: string): boolean { + appName = formatAppName(appName) + if (!appName) return false + + return defaultPageRecord.delete(appName) + } + + return { + setDefaultPage, + removeDefaultPage, + getDefaultPage: defaultPageRecord.get, + } } - function getBaseAppRouter (): unknown { - return baseRouterInstance + function createBaseRouterApi (): CreteBaseRouter { + /** + * Record base app router, let child app control base app navigation + */ + let baseRouterProxy: unknown = null + function setBaseAppRouter (baseRouter: unknown): void { + if (isObject(baseRouter)) { + baseRouterProxy = new Proxy(baseRouter, { + get (target: History, key: PropertyKey): unknown { + removeDomScope() + const rawValue = Reflect.get(target, key) + return isFunction(rawValue) ? bindFunctionToRawObject(target, rawValue, 'BASEROUTER') : rawValue + } + }) + } else if (process.env.NODE_ENV !== 'production') { + logWarn('setBaseAppRouter: Invalid base router') + } + } + + return { + setBaseAppRouter, + getBaseAppRouter: () => baseRouterProxy, + } } // Router API for developer @@ -258,13 +302,10 @@ function createRouterApi (): RouterApi { forward: createRawHistoryMethod('forward'), beforeEach: beforeGuards.add, afterEach: afterGuards.add, - setDefaultPage, - removeDefaultPage, - getDefaultPage: defaultPageRecord.get, attachToURL, attachAllToURL, - setBaseAppRouter, - getBaseAppRouter, + ...createDefaultPageApi(), + ...createBaseRouterApi(), } return { diff --git a/src/sandbox/router/event.ts b/src/sandbox/router/event.ts index 2692205e3..74895a790 100644 --- a/src/sandbox/router/event.ts +++ b/src/sandbox/router/event.ts @@ -21,7 +21,10 @@ export function addHistoryListener (appName: string): CallableFunction { const rawWindow = globalEnv.rawWindow // handle popstate event and distribute to child app const popStateHandler: PopStateListener = (e: MicroPopStateEvent): void => { - // exclude hidden keep-alive app + /** + * 1. unmount app & hidden keep-alive app will not receive popstate event + * 2. filter out onlyForBrowser + */ if (getActiveApps(true).includes(appName) && !e.onlyForBrowser) { const microPath = getMicroPathFromURL(appName) const app = appInstanceMap.get(appName)! diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index 6becaf64a..69d5187bf 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -13,63 +13,6 @@ const locationKeys: ReadonlyArray = [...shadowLocationKeys, // origin, fullPath is necessary for guardLocation const guardLocationKeys: ReadonlyArray = [...locationKeys, 'origin', 'fullPath'] -/** - * create guardLocation by microLocation, used for router guard - */ -function createGuardLocation (appName: string, microLocation: MicroLocation): GuardLocation { - const guardLocation = oAssign({ name: appName }, microLocation) as GuardLocation - // The prototype values on the URL needs to be manually transferred - for (const key of guardLocationKeys) guardLocation[key] = microLocation[key] - return guardLocation -} - -// for updateBrowserURLWithLocation when initial -export function autoTriggerNavigationGuard (appName: string, microLocation: MicroLocation): void { - executeNavigationGuard(appName, createGuardLocation(appName, microLocation), createGuardLocation(appName, microLocation)) -} - -/** - * The following scenes will trigger location update: - * 1. pushState/replaceState - * 2. popStateEvent - * 3. query on browser url when init sub app - * 4. set defaultPage when when init sub app - * NOTE: - * 1. update browser URL first, and then update microLocation - * 2. the same fullPath will not trigger router guards - * @param appName app name - * @param path target path - * @param base base url - * @param microLocation micro app location - * @param type auto prevent - */ -export function updateMicroLocation ( - appName: string, - path: string, - microLocation: MicroLocation, - type?: string, -): void { - const newLocation = createURL(path, microLocation.href) - // record old values of microLocation to `from` - const from = createGuardLocation(appName, microLocation) - for (const key of locationKeys) { - if (shadowLocationKeys.includes(key)) { - // reference of shadowLocation - microLocation.shadowLocation[key] = newLocation[key] as string - } else { - // @ts-ignore reference of microLocation - microLocation[key] = newLocation[key] - } - } - // update latest values of microLocation to `to` - const to = createGuardLocation(appName, microLocation) - - // The hook called only when fullPath changed - if (type === 'auto' || (from.fullPath !== to.fullPath && type !== 'prevent')) { - executeNavigationGuard(appName, to, from) - } -} - /** * Create location for microApp, each microApp has only one location object, it is a reference type * MDN https://developer.mozilla.org/en-US/docs/Web/API/Location @@ -244,3 +187,60 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio shadowLocation, }) } + +/** + * create guardLocation by microLocation, used for router guard + */ +function createGuardLocation (appName: string, microLocation: MicroLocation): GuardLocation { + const guardLocation = oAssign({ name: appName }, microLocation) as GuardLocation + // The prototype values on the URL needs to be manually transferred + for (const key of guardLocationKeys) guardLocation[key] = microLocation[key] + return guardLocation +} + +// for updateBrowserURLWithLocation when initial +export function autoTriggerNavigationGuard (appName: string, microLocation: MicroLocation): void { + executeNavigationGuard(appName, createGuardLocation(appName, microLocation), createGuardLocation(appName, microLocation)) +} + +/** + * The following scenes will trigger location update: + * 1. pushState/replaceState + * 2. popStateEvent + * 3. query on browser url when init sub app + * 4. set defaultPage when when init sub app + * NOTE: + * 1. update browser URL first, and then update microLocation + * 2. the same fullPath will not trigger router guards + * @param appName app name + * @param path target path + * @param base base url + * @param microLocation micro app location + * @param type auto prevent + */ +export function updateMicroLocation ( + appName: string, + path: string, + microLocation: MicroLocation, + type?: string, +): void { + const newLocation = createURL(path, microLocation.href) + // record old values of microLocation to `from` + const from = createGuardLocation(appName, microLocation) + for (const key of locationKeys) { + if (shadowLocationKeys.includes(key)) { + // reference of shadowLocation + microLocation.shadowLocation[key] = newLocation[key] as string + } else { + // @ts-ignore reference of microLocation + microLocation[key] = newLocation[key] + } + } + // update latest values of microLocation to `to` + const to = createGuardLocation(appName, microLocation) + + // The hook called only when fullPath changed + if (type === 'auto' || (from.fullPath !== to.fullPath && type !== 'prevent')) { + executeNavigationGuard(appName, to, from) + } +} diff --git a/src/sandbox/scoped_css.ts b/src/sandbox/scoped_css.ts index 0ccb9317b..5bb526e08 100644 --- a/src/sandbox/scoped_css.ts +++ b/src/sandbox/scoped_css.ts @@ -381,7 +381,7 @@ class CSSParser { // splice string private recordResult (strFragment: string): void { - // Firefox is slow when string contain special characters, see https://github.com/micro-zoe/micro-app/issues/256 + // Firefox performance degradation when string contain special characters, see https://github.com/micro-zoe/micro-app/issues/256 if (isFireFox()) { this.result += encodeURIComponent(strFragment) } else { diff --git a/src/source/patch.ts b/src/source/patch.ts index 2fad3a910..d44bdb417 100644 --- a/src/source/patch.ts +++ b/src/source/patch.ts @@ -189,17 +189,30 @@ function commonElementHandler ( passiveChild: Node | null, rawMethod: Func, ) { - const appName = getCurrentAppName() + const currentAppName = getCurrentAppName() if ( newChild instanceof Node && ( newChild.__MICRO_APP_NAME__ || - (appName && !newChild.__PURE_ELEMENT__) + (currentAppName && !newChild.__PURE_ELEMENT__) ) ) { - newChild.__MICRO_APP_NAME__ = newChild.__MICRO_APP_NAME__ || appName! + newChild.__MICRO_APP_NAME__ = newChild.__MICRO_APP_NAME__ || currentAppName! const app = appInstanceMap.get(newChild.__MICRO_APP_NAME__) if (app?.container) { + if (newChild instanceof Element) { + if (/^(img|script)$/i.test(newChild.tagName)) { + if (newChild.hasAttribute('src')) { + globalEnv.rawSetAttribute.call(newChild, 'src', CompletionPath(newChild.getAttribute('src')!, app.url)) + } + if (newChild.hasAttribute('srcset')) { + globalEnv.rawSetAttribute.call(newChild, 'srcset', CompletionPath(newChild.getAttribute('srcset')!, app.url)) + } + } else if (/^link$/i.test(newChild.tagName) && newChild.hasAttribute('href')) { + globalEnv.rawSetAttribute.call(newChild, 'href', CompletionPath(newChild.getAttribute('href')!, app.url)) + } + } + return invokePrototypeMethod( app, rawMethod, @@ -211,8 +224,8 @@ function commonElementHandler ( return rawMethod.call(parent, newChild) } } else if (rawMethod === globalEnv.rawAppend || rawMethod === globalEnv.rawPrepend) { - if (!(newChild instanceof Node) && appName) { - const app = appInstanceMap.get(appName) + if (!(newChild instanceof Node) && currentAppName) { + const app = appInstanceMap.get(currentAppName) if (app?.container) { if (parent === document.head) { return rawMethod.call(app.container.querySelector('micro-app-head'), newChild) @@ -298,8 +311,8 @@ export function patchElementPrototypeMethods (): void { * @param element new element */ function markElement (element: T): T { - const appName = getCurrentAppName() - if (appName) element.__MICRO_APP_NAME__ = appName + const currentAppName = getCurrentAppName() + if (currentAppName) element.__MICRO_APP_NAME__ = currentAppName return element } @@ -332,10 +345,10 @@ function patchDocument () { // query element👇 function querySelector (this: Document, selectors: string): any { - const appName = getCurrentAppName() + const currentAppName = getCurrentAppName() if ( - !appName || - !appInstanceMap.get(appName)?.container || + !currentAppName || + !appInstanceMap.get(currentAppName)?.container || !selectors || isUniqueElement(selectors) || // see https://github.com/micro-zoe/micro-app/issues/56 @@ -344,14 +357,14 @@ function patchDocument () { return globalEnv.rawQuerySelector.call(this, selectors) } - return appInstanceMap.get(appName)?.container?.querySelector(selectors) ?? null + return appInstanceMap.get(currentAppName)?.container?.querySelector(selectors) ?? null } function querySelectorAll (this: Document, selectors: string): any { - const appName = getCurrentAppName() + const currentAppName = getCurrentAppName() if ( - !appName || - !appInstanceMap.get(appName)?.container || + !currentAppName || + !appInstanceMap.get(currentAppName)?.container || !selectors || isUniqueElement(selectors) || rawDocument !== this @@ -359,7 +372,7 @@ function patchDocument () { return globalEnv.rawQuerySelectorAll.call(this, selectors) } - return appInstanceMap.get(appName)?.container?.querySelectorAll(selectors) ?? [] + return appInstanceMap.get(currentAppName)?.container?.querySelectorAll(selectors) ?? [] } Document.prototype.querySelector = querySelector @@ -390,12 +403,12 @@ function patchDocument () { } Document.prototype.getElementsByTagName = function getElementsByTagName (key: string): HTMLCollectionOf { - const appName = getCurrentAppName() + const currentAppName = getCurrentAppName() if ( - !appName || + !currentAppName || isUniqueElement(key) || isInvalidQuerySelectorKey(key) || - (!appInstanceMap.get(appName)?.inline && /^script$/i.test(key)) + (!appInstanceMap.get(currentAppName)?.inline && /^script$/i.test(key)) ) { return globalEnv.rawGetElementsByTagName.call(this, key) } @@ -429,30 +442,33 @@ let hasRewriteSetAttribute = false export function patchSetAttribute (): void { if (hasRewriteSetAttribute) return hasRewriteSetAttribute = true - Element.prototype.setAttribute = function setAttribute (key: string, value: string): void { + Element.prototype.setAttribute = function setAttribute (key: string, value: any): void { if (/^micro-app(-\S+)?/i.test(this.tagName) && key === 'data') { if (isPlainObject(value)) { const cloneValue: Record = {} - Object.getOwnPropertyNames(value).forEach((key: NormalKey) => { - if (!(isString(key) && key.indexOf('__') === 0)) { - cloneValue[key] = value[key] + Object.getOwnPropertyNames(value).forEach((ownKey: NormalKey) => { + if (!(isString(ownKey) && ownKey.indexOf('__') === 0)) { + cloneValue[ownKey] = value[ownKey] } }) this.data = cloneValue } else if (value !== '[object Object]') { logWarn('property data must be an object', this.getAttribute('name')) } - } else if ( - ( - ((key === 'src' || key === 'srcset') && /^(img|script)$/i.test(this.tagName)) || - (key === 'href' && /^link$/i.test(this.tagName)) - ) && - this.__MICRO_APP_NAME__ && - appInstanceMap.has(this.__MICRO_APP_NAME__) - ) { - const app = appInstanceMap.get(this.__MICRO_APP_NAME__) - globalEnv.rawSetAttribute.call(this, key, CompletionPath(value, app!.url)) } else { + const appName = this.__MICRO_APP_NAME__ || getCurrentAppName() + if ( + appName && + appInstanceMap.has(appName) && + ( + ((key === 'src' || key === 'srcset') && /^(img|script)$/i.test(this.tagName)) || + (key === 'href' && /^link$/i.test(this.tagName)) + ) + ) { + const app = appInstanceMap.get(appName) + value = CompletionPath(value, app!.url) + } + globalEnv.rawSetAttribute.call(this, key, value) } } From 83292ca56ee11a221f3fcf745ff425ca75baf6df Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Fri, 15 Jul 2022 20:06:28 +0800 Subject: [PATCH 051/268] fix(scopecss): Fixed bug of scopescss when @keyframes name has special characters --- dev/children/react16/public/index.html | 9 +++++++-- docs/zh-cn/changelog.md | 1 + src/sandbox/scoped_css.ts | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dev/children/react16/public/index.html b/dev/children/react16/public/index.html index 208c7587b..aecce6791 100644 --- a/dev/children/react16/public/index.html +++ b/dev/children/react16/public/index.html @@ -28,8 +28,13 @@ console.log(6666666, this) --> - diff --git a/docs/zh-cn/changelog.md b/docs/zh-cn/changelog.md index 778ad6510..29441cf16 100644 --- a/docs/zh-cn/changelog.md +++ b/docs/zh-cn/changelog.md @@ -23,6 +23,7 @@ - 🐞 修复了`ant-design-vue`的弹窗类组件及其它特殊情况下,子应用元素逃逸到原生body上的问题。 - 🐞 修复了在未设置`public_path`时,子应用的资源地址补全失败的问题。 - 🐞 修复了子应用在调用fetch等API时,元素绑定没有解除的问题。 + - 🐞 修复了在`@keyframes`名称带有特殊字符时样式隔离失败的问题。 - **Update** diff --git a/src/sandbox/scoped_css.ts b/src/sandbox/scoped_css.ts index 5bb526e08..84ef7a970 100644 --- a/src/sandbox/scoped_css.ts +++ b/src/sandbox/scoped_css.ts @@ -89,7 +89,7 @@ class CSSParser { } private formatSelector (skip: boolean): false | string { - const m = this.commonMatch(/^([^{]+)/, skip) + const m = this.commonMatch(/^[^{]+/, skip) if (!m) return false return m[0].replace(/(^|,[\n\s]*)([^,]+)/g, (_, separator, selector) => { @@ -188,7 +188,7 @@ class CSSParser { private keyframesRule (): boolean | void { if (!this.commonMatch(/^@([-\w]+)?keyframes\s*/)) return false - if (!this.commonMatch(/^([-\w]+)\s*/)) return parseError('@keyframes missing name', this.linkPath) + if (!this.commonMatch(/^[^{]+/)) return parseError('@keyframes missing name', this.linkPath) this.matchComments() From b56a9a6509f386b10db86bc0fb5e83eddb7677eb Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Fri, 15 Jul 2022 20:23:48 +0800 Subject: [PATCH 052/268] docs: change docs --- docs/zh-cn/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh-cn/changelog.md b/docs/zh-cn/changelog.md index 29441cf16..003ce7545 100644 --- a/docs/zh-cn/changelog.md +++ b/docs/zh-cn/changelog.md @@ -10,7 +10,7 @@ ### 1.0.0-alpha.2 -`2022-07-06` +`2022-07-15` - **New** From 70ceb3bcc8f40286c1b89b3b1350706d0937ed07 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Tue, 19 Jul 2022 19:00:49 +0800 Subject: [PATCH 053/268] feat: rewrite pushState/replaceState of base app --- dev/children/react16/public/index.html | 4 +- .../vue2/src/assets/micro-app-logo.jpeg | Bin 0 -> 7294 bytes dev/children/vue2/src/pages/home.vue | 18 +++-- dev/children/vue2/src/pages/page2.vue | 1 + .../vue3/src/assets/micro-app-logo.jpeg | Bin 0 -> 7294 bytes dev/children/vue3/src/pages/element-plus.vue | 1 + dev/main-react16/src/global.jsx | 9 ++- dev/main-react16/src/pages/react16/react16.js | 3 +- src/__tests__/main.test.ts | 2 +- src/create_app.ts | 24 +++--- src/libs/global_env.ts | 4 + src/micro_app.ts | 21 +++-- src/micro_app_element.ts | 25 +++--- src/prefetch.ts | 6 +- src/sandbox/index.ts | 6 +- src/sandbox/router/api.ts | 22 ++--- src/sandbox/router/core.ts | 6 +- src/sandbox/router/event.ts | 5 +- src/sandbox/router/history.ts | 76 ++++++++++++------ src/sandbox/router/index.ts | 4 +- src/source/patch.ts | 20 ++--- src/source/scripts.ts | 7 ++ typings/global.d.ts | 26 ++++-- 23 files changed, 187 insertions(+), 103 deletions(-) create mode 100644 dev/children/vue2/src/assets/micro-app-logo.jpeg create mode 100644 dev/children/vue3/src/assets/micro-app-logo.jpeg diff --git a/dev/children/react16/public/index.html b/dev/children/react16/public/index.html index aecce6791..883eff103 100644 --- a/dev/children/react16/public/index.html +++ b/dev/children/react16/public/index.html @@ -17,9 +17,9 @@ color: red; } - + diff --git a/dev/children/vue2/src/assets/micro-app-logo.jpeg b/dev/children/vue2/src/assets/micro-app-logo.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..97219d373356f6cd61aa36b27fe544362fbdf56c GIT binary patch literal 7294 zcmbt(2|SeTyZ>X~vTq@V5R$Z5BAH4|2%(ZClTuJeb4!ybAJEd`FzfD&*#2p=2`B!zSs4gYkSzk>?uIZ%EHnD;NSoN z4)6uA#{e^clVf-6uAIArn`?LF;pXPz=H=n#{cG|G@bmHs@bU8U3-JpG?hf$N9wEU! zyI*!U`TJH*9xg5(K|Wr-zb^S7E$jwBoFDiKeC6WU4{(ZeaEWuUTL1_sC(mEvfx`Yh zI5@eud3gCiF@(SiD#bwYxwt@~c|eK5tHZ$a0Jk`ggv!w~ypr}FeEa>SjzuJY;8#6c z+9>VNLsmO}BOp>hP)2sIoV@x04Na|sdin;2Cyb2E&Y4@l&RbeJUb=k6>8i8KP0w4m zz3zDX1U?9Q7#tG%=t)%c)0o(}_>|O_Y3Z+Czj>RLos*lFUr_k5th}PKs`~Snnx^KK z);7Y|_Kx1Z{(-@v;gM0&^vvwfUvu*diK;!5IurE^%%im7}~8XYBbr{3Z7vi{O_!oBW})Q9$*$16le;K#!n|njT4=vJ34m zWdA*2k^d`X{}0%|;~E9_aB+af;}Qp;0F#jwuL=C$=e7b%kcSQMykjOouPYcapwmzZ z-Dh=v_(Mv3vWisApmGBL|8X9!D^>Q>lH&nX5zRpIc zwPlU_e6oe}nx2#4roguQFPDWpx8D|-q1jSwF& zf2>zPYKq`m={ke83)d^^M&4Ux#Plb#fktoiRBk(^pMhipPjiOavOIYz%wM8!hMw69 zg^V!9mK(VI%`_bG{uA&|P_msb%}ACS$jnl(qurxBjgB!4DG%r#NmoPn&c9mAU<2RG zQt#OENu<1C1L<#65ZequB=QxPQAwPKx0OL@JXU)Veai*)!K3JEYvDq0vYV^j-V}kU z7st-$cpg!WmLLZY_9;>qYZz4*xF1DtU}=0g|J(C=s7#sPD>Iy|1jo1i zLl~E+g7T0b$6X+9J?7F89_CUPIsWOC?qb-|u;jj}>PTOl8q$?AnMSJTvx#jFD?%6+ z`f{J<^mG2oo#B@a+U+ecul*H|z>eipJ(w{j5=ei#1=6mpC*|CMW-Hjb?oIAyLQb!G7Y zsJ_cC4bnPkE5F`_%6!P5u;eCNm6_?;Ud|3uF5)!e7UMq^TTqbG`#569j16#afRGc} zfH!pHxi&NgQt`8x*s{vo96McKQ^N-0CZev3ak?3`c04zA#@#=nW)H6-mcdt==|@>( zll)4?%nY2?)g^z6Y`WQn+iTcQduM)TPT)eerwk0LL2n(QE5*ZEry&; zFm{TqusN%uo|m5uS8qAS#p=!EpT9Kq)E9MMmR7_w;w;hnYsxLO~}TpG3|bCbo3K z`|vBb=n|~&=qh4FQUvr4{;7dWzkQLAu%%N6?#~nui(l5Ai9lj;n zk9q3I%=6>=-2gB^|x|E2A8`f{Q#>4 zT@GEgn+hW9F0YWQn$4nnP!k2*>$<+f9P8t52JVh+ezpTFF+S-f>6wAqxh(@d2hW$6 z9&FwvBaZcbuCO=f64cBJ7o64WN`&qS!pphQxU4B@32%!(>_)fPdXyKC2!e@W3QX4pL<+bO)5H*bj&gQ-f-{~X>svuLF=+A-He8Im3%ndk`i zFBBGbbQ<21z$L-IGS4U)|B9ytPC2cxff-$%*Bj9ILWA0T%_jE}(;-=U%aoPr=ljNQ zch~@l*ox*xI&{xa_#!vweeaD6Pr4#|47aX5DtauRaphWU(~^47grXa?O-@6?jG3OB zSN){d`sYAs9%C6f06IWUknOrC0=jy$m=Mc=k?^#0NIwc2$fgmSue2*R;{r_kWCb49 zeB}p30PYzy_RsXp3qJmL$cc zohRJlFMM!?dCmx9+4xeDu5=| zXm9ng1o_wi?Obe3X>x*7rJJ>&UV`Noy8UizFT2_s7f$KGhS-O4{A|?(fa> zNMC;G*_+?}JM_rOshT{mT)>yDF8kB1P$QEk;W3!I2r(shF1T^hj>-`~)G{eYCNR|94WrGVi42&arHL*ZutfxW=P z9KlcFhRQ=3s6IAOIkdb&S3sUZ$Du2nT9_xB-};Ljn*Q=CsFM*}n{cJO#5424&7Y_J zlQTpR5kD@g7bICKD+z~I$AMlDI^xxcmfygR5L%%S6WyCL@4eIXhAy;~+`HeBP$lf`pZ$X_YM1Bn(v#u>pm;qdJ`{W3S$ND>zkq1wT|P)ky91-Dff< ztC6MS#wwZrgY0h}u;)=#h@PY7A0;=eG_xWjY9P5NSB4K8NclG1yflqiW&^}6Z2!}F zRNA&brHEy%5zhvey>M)xXU(bGZ;Rf-6m4bPVFSswvJBrfBZoiMUEC!pm}e$@MF*-$ zIuCy}{W_kkUY8rV4D(+`7{~AA@9i+S!+MzOP@?p)$inuRtKKqeBP^N>GDIQQXRVQh zNl4FXB8~a@P`_T-^Vs+FaXHg$?JjfaO_8*sg_@rUk1~@VOSjf_$ZLHF>uBy5ho{CQ zS8SXz4~FpL@7Tq`d32*Dg$FZ6OPQ>9A;@7h$nQ)?>}BPln8bFi{<`^j`U9vZ$yd5` z?|Fjo+meuCsllazplwKAT08PCO`IG|O`@TL$>lSc=3?!Z9i9c=dxlpkCI0Z=@^lD= zIeraNiI_JJB{ukuxss||Lr6VA^oVSP%^EZ1x81~d;zlRs3Fdc(Qo}w^Ix;{&R(a_A zrF^)kV|vcru8FnfF5OOY2Tmj_16l1}z_p8>1^Jx1CuK z#E?&Qvhs!Mk;AS+P}SI7}f3TAi@ctLele&+ggTwRioV zvrqXl_swrUv}4`1r{%M@^`&4)hq(_;qk*MIOPzkF%f&Dumt+?&87DL;2($>C6*{>Mhn%X~gH2Ga)J^GS zG}$%nn>NtzzW&j`<^eO-3pPPV}$qpv{djR&Md4Jxj(nQj{ zyC6jgBR1_3-rAgAZa3+AQoG*xekr!U;yEC#U}jhfvvuW*gXVNr~_^XA>tjaP!m_E9udW zh!PtJ!F-?*5+Q2`o7g}i3#JQ_bWkU0PWkW7idJ!h_7aq)PS_zTuz_(yHgJDwwqvJ{ zCE&}d2B~QC*O87N&~eCSKb1bvjO_#LGbodsE(l- zCx&7xE1!yH1CLwb^cZX+7_jSAcfK>cPIHE9c}xC|ccErZN!gnNyHl0f=iUjHn{#a7 zWfVhz4U~N&`7%$sIwjyI^p}ZbTlDsMy9NyX5Ke{-^i@{c*hTDcFmHklfvIp%qa5ns z2G-}@2rZC&9SS|LX17$#hB0(ulWb}f58yStG_AL?Z4Zm_z#>a#56F4MVGX8 z_quqxF&E3-{T$rqdkVO8^Yg`TTT@>$!&i}xSR&&b&Hf{S`fX%#ddsp-<%;Fr+1Inn z))Ic>o}1E}*XeC9!$b6O3ev7Zj&I+YfT233?1x%on5%+Nao-{)i0S%e+iV&xgkXse z9_U8el#*Ofr_R+>!3b)>t0WR+$>_wkMOe|IpHZv)V6=@KW3`1PdwWDf9|>9Y z4%L06-S^QQK8xHkHw{s*dQ&`?P?Rm!(fq-07p6$Fr&;SR3EeG-x@O zY5sh#$Js8`)bNjdYAL6IAZ#y`rh#QBMAI!$z2sq}C9}}?H%pFY>{mv}x4fV4)~~8O zm7|+h=}722LhRbf9xN|(kjf4{0ySkxA(d#k6e7U@y$2^uE|r zu#@?pk##XfDuI=OYvCubu8O>;P7b|?OD!J0I-e-12Kudp|G>K4UW!(+{GW|di<%-a zFOmMtWRx_+Ct~&R1}V>H_@ut8dP~$y;>?K`e#Yzb7Kjhd*t_kx@;y-W^8Kf{Y=Ji(6rc7HDm3$R zYD76sJ~i!5VBdn~A}-A7`yApwQw^jZ=xQ64f)fcJ>W2<{cz}hjzx4CWx}S4jkZL|h$7k69|J{9$9Uj(R54{!!r*ohi z_pt%Q>KJuRIJhZO&QzN0eEl{BA9v65`QW)#s%OLFyk!IA8`68krX5QFjHSHOs2|Ys zm+4SRywAH@-#DCZjOU*VWn)r3dfR6-enz(~l{akXafm<%IFG|~s$>l0Z4!*#Q*R0v z7uQ)Uf(>;K2|fGpkJ;hivkUFW5~IdZ?zP>*6hpSa53f?WBga}YCCONZ8cRR!OlliW zJ?_?*I6CvK$=ymti;KRhMQ?XVFuBboMt#$jz+D_5{BZ&(EUjpr=qbd#l0d?G8|e zBGo8aG(uDGj;pm!f?rtG_#bK6bX#T=xxv>Rwl97s1N`x%8y{3Ii3B!a&*pi#mq_vw46R0K7m+!#S(eMe1pEDJ9-cj@r-&72#NfVuV1_w#T zi{#4<@jX-S=HmU<=54c*|2G4p;1lh)ze%Rp1W83-j#YcG;B=+ls%!G5Rm-#Y*}*O@ Ynx8EGEx`X@-qGxlK2-Cq-3MI%0#vhHyZ`_I literal 0 HcmV?d00001 diff --git a/dev/children/vue2/src/pages/home.vue b/dev/children/vue2/src/pages/home.vue index 4e4ad4c35..c8cc500eb 100644 --- a/dev/children/vue2/src/pages/home.vue +++ b/dev/children/vue2/src/pages/home.vue @@ -12,11 +12,15 @@
                  +
                  + +
                  +
                    -
                  • {{ item }}
                  • +
                  • {{ item }}
                  - +
                  @@ -32,7 +36,7 @@ export default { version: Vue.version, centerDialogVisible: false, microDataStr: '', - aaa: 1, + liList: 0, } }, created () { @@ -51,11 +55,11 @@ export default { this.centerDialogVisible = true this.microDataStr = JSON.stringify(data) }, - test() { + renderNode() { console.time("run loop", 10000); for (let index = 2; index < 1 * 10000; index++) { - this.aaa = index; + this.liList = index; } console.timeLog("run loop", 10000); @@ -64,6 +68,10 @@ export default { console.timeEnd("run loop", 10000); }); }, + jumpWithLocation () { + // 通过location跳转page2 + location.href = '/micro-app/vue2/#/page2' + } } } diff --git a/dev/children/vue2/src/pages/page2.vue b/dev/children/vue2/src/pages/page2.vue index 32a885fbd..21a6e3f3d 100644 --- a/dev/children/vue2/src/pages/page2.vue +++ b/dev/children/vue2/src/pages/page2.vue @@ -1,5 +1,6 @@ @@ -17,6 +18,7 @@ export default { data () { return { activeName: location.href.includes('#/page2') ? 'page2': '/', + showView: true, } }, mounted () { @@ -30,6 +32,12 @@ export default { methods: { handleClick(tab) { this.$router.push(tab.name) + }, + reload () { + this.showView = false + this.$nextTick(() => { + this.showView = true + }) } } } diff --git a/dev/children/vue2/src/pages/page2.vue b/dev/children/vue2/src/pages/page2.vue index 1cf8ddc60..2780ff697 100644 --- a/dev/children/vue2/src/pages/page2.vue +++ b/dev/children/vue2/src/pages/page2.vue @@ -60,6 +60,33 @@ 确 定 +
                  +
                  +

                  选择器

                  + + + + +
                  +
                  +

                  下拉菜单

                  + + + 下拉菜单 + + + 黄金糕 + 狮子头 + 螺蛳粉 + 双皮奶 + 蚵仔煎 + + +
                  @@ -105,7 +132,24 @@ export default { desc: [ { required: true, message: '请填写活动形式', trigger: 'blur' } ] - } + }, + selectOptions: [{ + value: '选项1', + label: '黄金糕' + }, { + value: '选项2', + label: '双皮奶' + }, { + value: '选项3', + label: '蚵仔煎' + }, { + value: '选项4', + label: '龙须面' + }, { + value: '选项5', + label: '北京烤鸭' + }], + selectValue: '' }; }, created () { @@ -116,6 +160,12 @@ export default { if (!window.umdGlobalKey) { alert('umdGlobalKey missing') } + + + }, + beforeDestroy () { + // BUG:页面跳转和router-view更新时不会自动收起,且会移动到浏览器左上角 + this.$refs.dropdown.popperElm.parentNode.removeChild(this.$refs.dropdown.popperElm) }, methods: { submitForm(formName) { diff --git a/dev/children/vue2/yarn.lock b/dev/children/vue2/yarn.lock index 2509d8c65..81ab8118d 100644 --- a/dev/children/vue2/yarn.lock +++ b/dev/children/vue2/yarn.lock @@ -3314,10 +3314,10 @@ electron-to-chromium@^1.3.723: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.774.tgz#4d6661a23119e35151646c9543b346bb3beca423" integrity sha512-Fggh17Q1yyv1uMzq8Qn1Ci58P50qcRXMXd2MBcB9sxo6rJxjUutWcNw8uCm3gFWMdcblBO6mDT5HzX/RVRRECA== -element-ui@~2.15.1: - version "2.15.3" - resolved "https://registry.yarnpkg.com/element-ui/-/element-ui-2.15.3.tgz#55108ab82a3bcc646e7b0570871c48ba96300652" - integrity sha512-yGcK0AspuC827Nq7GUHct83cywAKIDo+kpp/rtov5ptmK1hZ8FMlt2SKbcozmSabmpdBNroMgqxqXl6IT1zy1A== +element-ui@2.15.8: + version "2.15.8" + resolved "https://registry.npmjs.org/element-ui/-/element-ui-2.15.8.tgz#2f505a3de33c52df1fc69be739844c1b774cfcdc" + integrity sha512-N54zxosRFqpYax3APY3GeRmtOZwIls6Z756WM0kdPZ5Q92PIeKHnZgF1StlamIg9bLxP1k+qdhTZvIeQlim09A== dependencies: async-validator "~1.8.1" babel-helper-vue-jsx-merge-props "^2.0.0" diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index 04ca82ea6..ecf9c9259 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -277,7 +277,7 @@ export default class App extends React.Component { // shadowDOM // disable-memory-router keep-router-state - default-page='/micro-app/react16/page2' + // default-page='/micro-app/react16/page2' // hidden-router // disable-patch-request > diff --git a/docs/1.x/zh-cn/configure.md b/docs/1.x/zh-cn/configure.md index 41e9101aa..68f92f022 100644 --- a/docs/1.x/zh-cn/configure.md +++ b/docs/1.x/zh-cn/configure.md @@ -134,7 +134,7 @@ keep-alive的优先级小于[destroy](/zh-cn/configure?id=destroy),当两者 2. 当设置了`default-page`时`keep-router-state`将失效,因为它的优先级小于`default-page` ## disable-patch-request -- Desc: `是否` +- Desc: `是否关闭子应用请求的自动补全功能` - Type: `string(boolean)` - Default: `false` - 使用方式: `` diff --git a/docs/1.x/zh-cn/jump.md b/docs/1.x/zh-cn/jump.md index 96670ae69..147b3848c 100644 --- a/docs/1.x/zh-cn/jump.md +++ b/docs/1.x/zh-cn/jump.md @@ -66,12 +66,13 @@ microApp.setData('子应用name', { path: '/new-path/' }) ```js import { useEffect } from 'react' import { useHistory } from 'react-router-dom' -import microApp from '@micro-zoe/micro-app' +import microApp, { removeDomScope } from '@micro-zoe/micro-app' export default () => { const history = useHistory() function pushState (path) { + removeDomScope() history.push(path) } @@ -100,11 +101,14 @@ export default () => { + + + + + diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index e4f7c1b48..58f6e90cb 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -293,24 +293,25 @@ window.addEventListener('hashchange', (e) => { /* ---------------------- 选择器 -- Document原型方法绑定ProxyDocument --------------------- */ -console.log('querySelectorAll: ', Document.prototype.querySelectorAll.call(document, 'span')) -console.log('querySelectorAll head: ', Document.prototype.querySelectorAll.call(document, 'head')) -console.log('querySelector: ', Document.prototype.querySelector.call(document, 'div')) -console.log('querySelector head: ', Document.prototype.querySelector.call(document, 'head')) -console.log('createElement: ', Document.prototype.createElement.call(document, 'div')) -console.log('createElementNS: ', Document.prototype.createElementNS.call(document, 'http://www.w3.org/2000/svg', 'svg')) -console.log('createDocumentFragment: ', Document.prototype.createDocumentFragment.call(document)) -console.log('getElementById: ', Document.prototype.getElementById.call(document, '1abc')) -console.log('getElementsByClassName: ', Document.prototype.getElementsByClassName.call(document, '1abc')) -console.log('getElementsByTagName: ', Document.prototype.getElementsByTagName.call(document, '1abc')) -console.log('getElementsByName: ', Document.prototype.getElementsByName.call(document, '1abc')) - -console.log('Document.prototype.createAttribute: ', Document.prototype.createAttribute.call(document, 'abc')) -console.log('document.createAttribute: ', document.createAttribute.call(document, 'abc')) -console.log('document instanceof Document', document instanceof Document) -console.log('new Document() ', new Document()) -console.log('document.defaultView ', document.defaultView) - +// console.log('querySelectorAll: ', Document.prototype.querySelectorAll.call(document, 'span')) +// console.log('querySelectorAll head: ', Document.prototype.querySelectorAll.call(document, 'head')) +// console.log('querySelector: ', Document.prototype.querySelector.call(document, 'div')) +// console.log('querySelector head: ', Document.prototype.querySelector.call(document, 'head')) +// console.log('createElement: ', Document.prototype.createElement.call(document, 'div')) +// console.log('createElementNS: ', Document.prototype.createElementNS.call(document, 'http://www.w3.org/2000/svg', 'svg')) +// console.log('createDocumentFragment: ', Document.prototype.createDocumentFragment.call(document)) +// console.log('getElementById: ', Document.prototype.getElementById.call(document, '1abc')) +// console.log('getElementsByClassName: ', Document.prototype.getElementsByClassName.call(document, '1abc')) +// console.log('getElementsByTagName: ', Document.prototype.getElementsByTagName.call(document, '1abc')) +// console.log('getElementsByName: ', Document.prototype.getElementsByName.call(document, '1abc')) + +// console.log('Document.prototype.createAttribute: ', Document.prototype.createAttribute.call(document, 'abc')) +// console.log('document.createAttribute: ', document.createAttribute.call(document, 'abc')) +// console.log('document instanceof Document', document instanceof Document) +// console.log('new Document() ', new Document()) +// console.log('document.defaultView ', document.defaultView) + +/* ---------------------- eval作用域 --------------------- */ // TODO: window.eval 作用域 -window.eval('console.log("window.eval -- ", window)') // window -eval('console.log("eval -- ", window)') // proxyWindow +// window.eval('console.log("window.eval -- ", window)') // window +// eval('console.log("eval -- ", window)') // proxyWindow diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index 457a1c433..95f51ccc9 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -280,6 +280,8 @@ export default class App extends React.Component { // default-page='/micro-app/react16/page2' // hidden-router // disable-patch-request + // esmodule + fiber > ) diff --git a/src/app_manager.ts b/src/app_manager.ts index bbb77d42e..44ff78868 100644 --- a/src/app_manager.ts +++ b/src/app_manager.ts @@ -2,7 +2,7 @@ import { appInstanceMap } from './create_app' import { AppInterface } from '@micro-app/types' export interface IAppManager { - get(appName: string): AppInterface | undefined + get(appName: string): AppInterface | void set(appName: string, app: AppInterface): void getAll(): AppInterface[] clear(): void @@ -21,7 +21,7 @@ export class AppManager implements IAppManager { return this.instance } - public get (appName: string): AppInterface | undefined { + public get (appName: string): AppInterface | void { return this.appInstanceMap.get(appName) } diff --git a/src/libs/utils.ts b/src/libs/utils.ts index afdc004a2..34e3b36c7 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -547,6 +547,14 @@ export function getAttributes (element: Element): AttrsType { * serial exec fiber task of link, style, script * @param tasks task array or null */ -export function serialExecFiberTasks (tasks: fiberTasks) { +export function serialExecFiberTasks (tasks: fiberTasks): Promise | void { return tasks?.reduce((pre, next) => pre.then(next), Promise.resolve()) } + +/** + * inline script start with inline-xxx + * @param address source address + */ +export function isInlineScript (address: string): boolean { + return address.startsWith('inline-') +} diff --git a/src/micro_app_element.ts b/src/micro_app_element.ts index 44006961f..e36f53096 100644 --- a/src/micro_app_element.ts +++ b/src/micro_app_element.ts @@ -65,7 +65,7 @@ export function defineElement (tagName: string): void { const cacheCount = ++this.connectCount this.connectStateMap.set(cacheCount, true) /** - * In some special scenarios, such as vue's keep-alive, the micro-app will be inserted and deleted twice in an instant + * In some special scenes, such as vue's keep-alive, the micro-app will be inserted and deleted twice in an instant * So we execute the mount method async and record connectState to prevent repeated rendering */ defer(() => { @@ -230,7 +230,7 @@ export function defineElement (tagName: string): void { private actionsForAttributeChange ( formatAttrName: string, formatAttrUrl: string, - existApp: AppInterface | undefined, + existApp: AppInterface | void, ): void { /** * do not add judgment of formatAttrUrl === this.appUrl diff --git a/src/prefetch.ts b/src/prefetch.ts index 83f9773fb..a9e5b0bc6 100644 --- a/src/prefetch.ts +++ b/src/prefetch.ts @@ -102,7 +102,7 @@ export function getGlobalAssets (assets: globalAssetsType): void { } // TODO: requestIdleCallback for every file -function fetchGlobalResources (resources: string[] | undefined, suffix: string, sourceHandler: SourceCenterType['link'] | SourceCenterType['script']) { +function fetchGlobalResources (resources: string[] | void, suffix: string, sourceHandler: SourceCenterType['link'] | SourceCenterType['script']) { if (isArray(resources)) { const effectiveResource = resources!.filter((path) => isString(path) && path.includes(`.${suffix}`) && !sourceHandler.hasInfo(path)) diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index 8e115b90d..d856457fc 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -52,7 +52,7 @@ export interface CreteBaseRouter { export interface CreateDefaultPage { setDefaultPage(options: SetDefaultPageOptions): () => boolean removeDefaultPage(appName: string): boolean - getDefaultPage(key: PropertyKey): string | undefined + getDefaultPage(key: PropertyKey): string | void } function createRouterApi (): RouterApi { diff --git a/src/sandbox/router/location.ts b/src/sandbox/router/location.ts index 69d5187bf..adf369110 100644 --- a/src/sandbox/router/location.ts +++ b/src/sandbox/router/location.ts @@ -39,7 +39,7 @@ export function createMicroLocation (appName: string, url: string): MicroLocatio * @param methodName pushState/replaceState * @returns origin value or formatted value */ - const commonHandler = (value: string | URL, methodName: string): string | URL | undefined => { + const commonHandler = (value: string | URL, methodName: string): string | URL | void => { const targetLocation = createURL(value, microLocation.href) // Even if the origin is the same, developers still have the possibility of want to jump to a new page if (targetLocation.origin === microLocation.origin) { diff --git a/src/source/links.ts b/src/source/links.ts index 017f508c5..221415ba9 100644 --- a/src/source/links.ts +++ b/src/source/links.ts @@ -92,7 +92,7 @@ export function fetchLinksFromHtml ( wrapElement: HTMLElement, app: AppInterface, microAppHead: Element, - fiberStyleResult: Promise | undefined, + fiberStyleResult: Promise | void, ): void { const styleList: Array = Array.from(app.source.links) const fetchLinkPromise: Array | string> = styleList.map((address) => { diff --git a/src/source/loader/html.ts b/src/source/loader/html.ts index 8a49ffc1d..7423fc48f 100644 --- a/src/source/loader/html.ts +++ b/src/source/loader/html.ts @@ -54,7 +54,7 @@ export class HTMLLoader implements IHTMLLoader { }) } - private processHtml (url: string, code: string, appName: string, plugins: plugins | undefined): string { + private processHtml (url: string, code: string, appName: string, plugins: plugins | void): string { if (!plugins) return code const mergedPlugins: NonNullable = [] diff --git a/src/source/scripts.ts b/src/source/scripts.ts index ef2f62891..1313942fe 100644 --- a/src/source/scripts.ts +++ b/src/source/scripts.ts @@ -22,6 +22,7 @@ import { getAttributes, promiseRequestIdle, serialExecFiberTasks, + isInlineScript, } from '../libs/utils' import { dispatchOnLoadEvent, @@ -40,10 +41,10 @@ function isTypeModule (app: AppInterface, scriptInfo: ScriptSourceInfo): boolean function isSpecialScript (app: AppInterface, scriptInfo: ScriptSourceInfo): boolean { const attrs = scriptInfo.appSpace[app.name].attrs - return attrs.has('id') || attrs.has('class') + return attrs.has('id') } -function isInlineScript (app: AppInterface, scriptInfo: ScriptSourceInfo): boolean { +function isInlineMode (app: AppInterface, scriptInfo: ScriptSourceInfo): boolean { return ( app.inline || scriptInfo.appSpace[app.name].inline || @@ -119,6 +120,7 @@ export function extractScriptElement ( defer: script.defer || script.type === 'module', module: script.type === 'module', inline: script.hasAttribute('inline'), + pure: script.hasAttribute('pure'), attrs: getAttributes(script), } if (!scriptInfo) { @@ -159,6 +161,7 @@ export function extractScriptElement ( defer: script.type === 'module', module: script.type === 'module', inline: script.hasAttribute('inline'), + pure: script.hasAttribute('pure'), attrs: getAttributes(script), } } @@ -307,7 +310,7 @@ export function fetchScriptSuccess ( if (app.isPrefetch) { const appSpaceData = scriptInfo.appSpace[app.name] appSpaceData.parsedCode = bindScope(address, app, code, scriptInfo) - if (!isInlineScript(app, scriptInfo)) { + if (!isInlineMode(app, scriptInfo)) { appSpaceData.parsedFunction = getExistParseResult(scriptInfo, appSpaceData.parsedCode) || code2Function(appSpaceData.parsedCode) } } @@ -325,6 +328,7 @@ export function execScripts ( const scriptList: Array = Array.from(app.source.scripts) const deferScriptPromise: Array|string> = [] const deferScriptInfo: Array<[string, ScriptSourceInfo]> = [] + const fiberScriptTasks: fiberTasks = app.fiber ? [] : null for (const address of scriptList) { const scriptInfo = sourceCenter.script.getInfo(address)! const appSpaceData = scriptInfo.appSpace[app.name] @@ -339,8 +343,16 @@ export function execScripts ( isTypeModule(app, scriptInfo) && (initHook.moduleCount = initHook.moduleCount ? ++initHook.moduleCount : 1) } else { - runScript(address, app, scriptInfo, false) - initHook(false) + if (fiberScriptTasks) { + fiberScriptTasks.push(() => promiseRequestIdle((resolve: PromiseConstructor['resolve']) => { + runScript(address, app, scriptInfo, false) + initHook(false) + resolve() + })) + } else { + runScript(address, app, scriptInfo, false) + initHook(false) + } } } @@ -354,17 +366,39 @@ export function execScripts ( }, () => { deferScriptInfo.forEach(([address, scriptInfo]) => { if (scriptInfo.code) { - runScript(address, app, scriptInfo, false, initHook) - !isTypeModule(app, scriptInfo) && initHook(false) + if (fiberScriptTasks) { + fiberScriptTasks.push(() => promiseRequestIdle((resolve: PromiseConstructor['resolve']) => { + runScript(address, app, scriptInfo, false, initHook) + !isTypeModule(app, scriptInfo) && initHook(false) + resolve() + })) + } else { + runScript(address, app, scriptInfo, false, initHook) + !isTypeModule(app, scriptInfo) && initHook(false) + } } }) - initHook( - isUndefined(initHook.moduleCount) || - initHook.errorCount === deferScriptPromise.length - ) + + if (fiberScriptTasks) { + fiberScriptTasks.push(() => Promise.resolve(initHook( + isUndefined(initHook.moduleCount) || + initHook.errorCount === deferScriptPromise.length + ))) + serialExecFiberTasks(fiberScriptTasks) + } else { + initHook( + isUndefined(initHook.moduleCount) || + initHook.errorCount === deferScriptPromise.length + ) + } }) } else { - initHook(true) + if (fiberScriptTasks) { + fiberScriptTasks.push(() => Promise.resolve(initHook(true))) + serialExecFiberTasks(fiberScriptTasks) + } else { + initHook(true) + } } } @@ -396,7 +430,7 @@ export function runScript ( appSpaceData.parsedCode = bindScope(address, app, scriptInfo.code, scriptInfo) } - if (isInlineScript(app, scriptInfo)) { + if (isInlineMode(app, scriptInfo)) { const scriptElement = pureCreateElement('script') runCode2InlineScript( address, @@ -447,7 +481,7 @@ export function runDynamicRemoteScript ( } let replaceElement: Comment | HTMLScriptElement - if (isInlineScript(app, scriptInfo)) { + if (isInlineMode(app, scriptInfo)) { replaceElement = pureCreateElement('script') } else { replaceElement = document.createComment(`dynamic script with src='${address}' extract by micro-app`) @@ -460,7 +494,7 @@ export function runDynamicRemoteScript ( try { preActionForExecScript(app) appSpaceData.parsedCode = bindScope(address, app, code, scriptInfo) - if (isInlineScript(app, scriptInfo)) { + if (isInlineMode(app, scriptInfo)) { runCode2InlineScript( address, appSpaceData.parsedCode, @@ -502,9 +536,12 @@ function runCode2InlineScript ( ): void { if (module) { // module script is async, transform it to a blob for subsequent operations - // const blob = new Blob([code], { type: 'text/javascript' }) - // scriptElement.src = URL.createObjectURL(blob) - scriptElement.src = address + if (isInlineScript(address)) { + const blob = new Blob([code], { type: 'text/javascript' }) + scriptElement.src = URL.createObjectURL(blob) + } else { + scriptElement.src = address + } scriptElement.setAttribute('type', 'module') if (callback) { callback.moduleCount && callback.moduleCount-- @@ -544,7 +581,7 @@ function bindScope ( } if (app.sandBox && !isTypeModule(app, scriptInfo)) { - return `;(function(proxyWindow){with(proxyWindow.__MICRO_APP_WINDOW__){(function(${globalKeyToBeCached}){;${code}\n${address.startsWith('inline-') ? '' : `//# sourceURL=${address}\n`}}).call(proxyWindow,${globalKeyToBeCached})}})(window.__MICRO_APP_PROXY_WINDOW__);` + return `;(function(proxyWindow){with(proxyWindow.__MICRO_APP_WINDOW__){(function(${globalKeyToBeCached}){;${code}\n${isInlineScript(address) ? '' : `//# sourceURL=${address}\n`}}).call(proxyWindow,${globalKeyToBeCached})}})(window.__MICRO_APP_PROXY_WINDOW__);` } return code diff --git a/src/source/source_center.ts b/src/source/source_center.ts index ba101a78c..5818dfe96 100644 --- a/src/source/source_center.ts +++ b/src/source/source_center.ts @@ -1,4 +1,5 @@ import type { LinkSourceInfo, ScriptSourceInfo, SourceAddress } from '@micro-app/types' +import { isInlineScript } from '../libs/utils' export interface SourceCenter { link: { @@ -54,7 +55,7 @@ function createSourceCenter (): SourceCenter { ...createSourceHandler(scriptList), deleteInlineInfo (addressList: SourceAddress[]): void { addressList.forEach((address) => { - if (address.startsWith('inline-')) { + if (isInlineScript(address)) { scriptList.delete(address) } }) diff --git a/typings/global.d.ts b/typings/global.d.ts index c96001308..6e32c6a9a 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -73,6 +73,7 @@ declare module '@micro-app/types' { defer: boolean, // defer script module: boolean, // module type script inline: boolean, // run js with inline script + pure: boolean, // pure script attrs: Map, // element attributes parsedCode?: string, // bind code parsedFunction?: Function | null, // code to function @@ -413,7 +414,7 @@ declare module '@micro-app/types' { /** * Get defaultPage that set by setDefaultPage */ - getDefaultPage(key: PropertyKey): string | undefined + getDefaultPage(key: PropertyKey): string | void /** * Attach specified active app router info to browser url */ From fb90ad52d5b0cb0450d6b0ddce3d716e730bb657 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Sun, 14 Aug 2022 19:06:55 +0800 Subject: [PATCH 079/268] chore: update demo --- dev/children/react16/public/index.html | 6 +-- dev/children/react16/src/index.js | 22 ++++----- dev/main-react16/src/pages/react16/react16.js | 46 +++++++++---------- src/source/scripts.ts | 2 +- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/dev/children/react16/public/index.html b/dev/children/react16/public/index.html index 1ed33c208..5ab2d7bb4 100644 --- a/dev/children/react16/public/index.html +++ b/dev/children/react16/public/index.html @@ -26,12 +26,12 @@ - + @@ -51,6 +51,6 @@
                  diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index 58f6e90cb..fb2fee317 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -108,18 +108,18 @@ console.timeEnd('react#16'); /* ---------------------- 创建元素 --------------------- */ -// const dynamicScript1 = document.createElement('script') -// // dynamicScript1.setAttribute('type', 'module') -// // dynamicScript1.textContent = 'console.warn('inline module')' -// dynamicScript1.setAttribute('src', '//127.0.0.1:8080/test.js') -// dynamicScript1.onload = () => { -// console.log('动态module加载完成了') -// } -// document.head.appendChild(dynamicScript1) +const dynamicScript1 = document.createElement('script') +// dynamicScript1.setAttribute('type', 'module') +// dynamicScript1.textContent = 'console.warn('inline module')' +dynamicScript1.setAttribute('src', '//127.0.0.1:8080/js/test.js') +dynamicScript1.onload = () => { + console.log('动态module加载完成了') +} +document.head.appendChild(dynamicScript1) -// const dynamicStyle = document.createElement('style') -// document.head.appendChild(dynamicStyle) -// dynamicStyle.textContent = '.test-class { color: red } ' +const dynamicStyle = document.createElement('style') +document.head.appendChild(dynamicStyle) +dynamicStyle.textContent = '.test-class { color: red } ' diff --git a/dev/main-react16/src/pages/react16/react16.js b/dev/main-react16/src/pages/react16/react16.js index 95f51ccc9..d9b4a294c 100644 --- a/dev/main-react16/src/pages/react16/react16.js +++ b/dev/main-react16/src/pages/react16/react16.js @@ -190,28 +190,28 @@ export default class App extends React.Component { microApp.addGlobalDataListener(this.handleGlobalDataForBaseApp) - this.releaseBeforeEach1 = microApp.router.beforeEach((to, from, appName) => { - // const a = document.createElement('div') - // a.innerHTML = '44444444' - // document.body.appendChild(a) - console.log('全局 beforeEach: ', to, from, appName) - }) - - this.releaseBeforeEach2 = microApp.router.beforeEach({ - react16 (to, from) { - console.log('指定 beforeEach: ', to, from) - } - }) - - this.releaseAfterEach1 = microApp.router.afterEach((to, from, appName) => { - console.log('全局 afterEach: ', to, from, appName) - }) - - this.releaseAfterEach2 = microApp.router.afterEach({ - react16 (to, from) { - console.log('指定 afterEach: ', to, from) - } - }) + // this.releaseBeforeEach1 = microApp.router.beforeEach((to, from, appName) => { + // // const a = document.createElement('div') + // // a.innerHTML = '44444444' + // // document.body.appendChild(a) + // console.log('全局 beforeEach: ', to, from, appName) + // }) + + // this.releaseBeforeEach2 = microApp.router.beforeEach({ + // react16 (to, from) { + // console.log('指定 beforeEach: ', to, from) + // } + // }) + + // this.releaseAfterEach1 = microApp.router.afterEach((to, from, appName) => { + // console.log('全局 afterEach: ', to, from, appName) + // }) + + // this.releaseAfterEach2 = microApp.router.afterEach({ + // react16 (to, from) { + // console.log('指定 afterEach: ', to, from) + // } + // }) microApp.router.setBaseAppRouter(this.props.history) } @@ -281,7 +281,7 @@ export default class App extends React.Component { // hidden-router // disable-patch-request // esmodule - fiber + // fiber > ) diff --git a/src/source/scripts.ts b/src/source/scripts.ts index 1313942fe..3d6c3b6a9 100644 --- a/src/source/scripts.ts +++ b/src/source/scripts.ts @@ -325,10 +325,10 @@ export function execScripts ( app: AppInterface, initHook: moduleCallBack, ): void { + const fiberScriptTasks: fiberTasks = app.fiber ? [] : null const scriptList: Array = Array.from(app.source.scripts) const deferScriptPromise: Array|string> = [] const deferScriptInfo: Array<[string, ScriptSourceInfo]> = [] - const fiberScriptTasks: fiberTasks = app.fiber ? [] : null for (const address of scriptList) { const scriptInfo = sourceCenter.script.getInfo(address)! const appSpaceData = scriptInfo.appSpace[app.name] From d96a050775c27f42f7dbf4dc624a3d39193db0ed Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Mon, 15 Aug 2022 17:45:17 +0800 Subject: [PATCH 080/268] fix: Fixed the issue of dynamic script execution order --- dev/children/react16/public/index.html | 12 +- src/libs/utils.ts | 4 +- src/micro_app_element.ts | 11 +- src/source/links.ts | 77 +++++----- src/source/patch.ts | 18 +-- src/source/scripts.ts | 204 +++++++++++++++---------- src/source/source_center.ts | 4 + 7 files changed, 181 insertions(+), 149 deletions(-) diff --git a/dev/children/react16/public/index.html b/dev/children/react16/public/index.html index 5ab2d7bb4..2795d36d2 100644 --- a/dev/children/react16/public/index.html +++ b/dev/children/react16/public/index.html @@ -23,15 +23,15 @@ - - + @@ -51,6 +51,6 @@
                  diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 34e3b36c7..b3179ddd4 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -547,8 +547,8 @@ export function getAttributes (element: Element): AttrsType { * serial exec fiber task of link, style, script * @param tasks task array or null */ -export function serialExecFiberTasks (tasks: fiberTasks): Promise | void { - return tasks?.reduce((pre, next) => pre.then(next), Promise.resolve()) +export function serialExecFiberTasks (tasks: fiberTasks): Promise | null { + return tasks?.reduce((pre, next) => pre.then(next), Promise.resolve()) || null } /** diff --git a/src/micro_app_element.ts b/src/micro_app_element.ts index e36f53096..ba74639db 100644 --- a/src/micro_app_element.ts +++ b/src/micro_app_element.ts @@ -318,7 +318,6 @@ export function defineElement (tagName: string): void { appInstanceMap.get(this.appName)!.actionsForCompletelyDestroy() } - // new CreateApp({ name: this.appName, url: this.appUrl, @@ -449,10 +448,12 @@ export function defineElement (tagName: string): void { * get config of default page */ private getDefaultPageValue (): string { - return router.getDefaultPage(this.appName) ?? - this.getAttribute('default-page') ?? - this.getAttribute('defaultPage') ?? - '' + return ( + router.getDefaultPage(this.appName) || + this.getAttribute('default-page') || + this.getAttribute('defaultPage') || + '' + ) } /** diff --git a/src/source/links.ts b/src/source/links.ts index 221415ba9..c15ba8039 100644 --- a/src/source/links.ts +++ b/src/source/links.ts @@ -55,9 +55,11 @@ export function extractLinkFromHtml ( } else { linkInfo.appSpace[app.name] = appSpaceData } + + sourceCenter.link.setInfo(href, linkInfo) + if (!isDynamic) { app.source.links.add(href) - sourceCenter.link.setInfo(href, linkInfo) replaceComment = document.createComment(`link element with href=${href} move to micro-app-head as style element`) linkInfo.appSpace[app.name].placeholder = replaceComment } else { @@ -92,7 +94,7 @@ export function fetchLinksFromHtml ( wrapElement: HTMLElement, app: AppInterface, microAppHead: Element, - fiberStyleResult: Promise | void, + fiberStyleResult: Promise | null, ): void { const styleList: Array = Array.from(app.source.links) const fetchLinkPromise: Array | string> = styleList.map((address) => { @@ -103,17 +105,7 @@ export function fetchLinksFromHtml ( const fiberLinkTasks: fiberTasks = app.isPrefetch || app.fiber ? [] : null promiseStream(fetchLinkPromise, (res: { data: string, index: number }) => { - if (fiberLinkTasks) { - fiberLinkTasks.push(() => promiseRequestIdle((resolve: PromiseConstructor['resolve']) => { - fetchLinkSuccess( - styleList[res.index], - res.data, - microAppHead, - app, - ) - resolve() - })) - } else { + const handleStreamResult = () => { fetchLinkSuccess( styleList[res.index], res.data, @@ -121,6 +113,14 @@ export function fetchLinksFromHtml ( app, ) } + if (fiberLinkTasks) { + fiberLinkTasks.push(() => promiseRequestIdle((resolve: PromiseConstructor['resolve']) => { + handleStreamResult() + resolve() + })) + } else { + handleStreamResult() + } }, (err: {error: Error, index: number}) => { logError(err, app.name) }, () => { @@ -168,7 +168,7 @@ export function fetchLinkSuccess ( const placeholder = linkInfo.appSpace[app.name].placeholder! const convertStyle = pureCreateElement('style') - handlerConvertStyle( + handleConvertStyle( app, address, convertStyle, @@ -194,7 +194,7 @@ export function fetchLinkSuccess ( * @param linkInfo linkInfo in sourceCenter * @param attrs attrs of link */ -export function handlerConvertStyle ( +export function handleConvertStyle ( app: AppInterface, address: string, convertStyle: HTMLStyleElement, @@ -237,45 +237,40 @@ function setConvertStyleAttr (convertStyle: HTMLStyleElement, attrs: AttrsType): /** * get css from dynamic link * @param address link address - * @param linkInfo linkInfo * @param app app + * @param linkInfo linkInfo * @param originLink origin link element - * @param convertStyle style element which replaced origin link */ export function formatDynamicLink ( address: string, - linkInfo: LinkSourceInfo, app: AppInterface, + linkInfo: LinkSourceInfo, originLink: HTMLLinkElement, - convertStyle: HTMLStyleElement, -): void { - if (linkInfo.code) { - handlerConvertStyle( +): HTMLStyleElement { + const convertStyle = pureCreateElement('style') + + const handleDynamicLink = () => { + handleConvertStyle( app, address, convertStyle, linkInfo, linkInfo.appSpace[app.name].attrs, ) - defer(() => dispatchOnLoadEvent(originLink)) - return + dispatchOnLoadEvent(originLink) } - fetchSource(address, app.name).then((data: string) => { - linkInfo.code = data - convertStyle.textContent = data - if (app.scopecss) { - scopedCSS(convertStyle, app) - linkInfo.parseResult = { - prefix: createPrefix(app.name), - parsedCode: convertStyle.textContent, - } - } - setConvertStyleAttr(convertStyle, linkInfo.appSpace[app.name].attrs) - sourceCenter.link.setInfo(address, linkInfo) - dispatchOnLoadEvent(originLink) - }).catch((err) => { - logError(err, app.name) - dispatchOnErrorEvent(originLink) - }) + if (linkInfo.code) { + defer(handleDynamicLink) + } else { + fetchSource(address, app.name).then((data: string) => { + linkInfo.code = data + handleDynamicLink() + }).catch((err) => { + logError(err, app.name) + dispatchOnErrorEvent(originLink) + }) + } + + return convertStyle } diff --git a/src/source/patch.ts b/src/source/patch.ts index 513196be4..3c3db2459 100644 --- a/src/source/patch.ts +++ b/src/source/patch.ts @@ -14,7 +14,7 @@ import { } from '../libs/utils' import scopedCSS from '../sandbox/scoped_css' import { extractLinkFromHtml, formatDynamicLink } from './links' -import { extractScriptElement, runScript, runDynamicRemoteScript, checkExcludeUrl, checkIgnoreUrl } from './scripts' +import { extractScriptElement, runDynamicInlineScript, runDynamicRemoteScript, checkExcludeUrl, checkIgnoreUrl } from './scripts' import microApp from '../micro_app' import globalEnv from '../libs/global_env' import { fixReactHMRConflict } from '../sandbox/adapter' @@ -55,8 +55,7 @@ function handleNewNode (parent: Node, child: Node, app: AppInterface): Node { ) if (address && linkInfo) { - const replaceStyle = pureCreateElement('style') - formatDynamicLink(address, linkInfo, app, child, replaceStyle) + const replaceStyle = formatDynamicLink(address, app, linkInfo, child) dynamicElementInMicroAppMap.set(child, replaceStyle) return replaceStyle } else if (replaceComment) { @@ -74,15 +73,10 @@ function handleNewNode (parent: Node, child: Node, app: AppInterface): Node { ) || {} if (address && scriptInfo) { - if (!scriptInfo.isExternal) { // inline script - const replaceElement = runScript(address, app, scriptInfo, true) - dynamicElementInMicroAppMap.set(child, replaceElement) - return replaceElement - } else { // remote script - const replaceElement = runDynamicRemoteScript(address, scriptInfo, app, child) - dynamicElementInMicroAppMap.set(child, replaceElement) - return replaceElement - } + // remote script or inline script + const replaceElement: HTMLScriptElement | Comment = scriptInfo.isExternal ? runDynamicRemoteScript(address, app, scriptInfo, child) : runDynamicInlineScript(address, app, scriptInfo) + dynamicElementInMicroAppMap.set(child, replaceElement) + return replaceElement } else if (replaceComment) { dynamicElementInMicroAppMap.set(child, replaceComment) return replaceComment diff --git a/src/source/scripts.ts b/src/source/scripts.ts index 3d6c3b6a9..6225ac96a 100644 --- a/src/source/scripts.ts +++ b/src/source/scripts.ts @@ -1,4 +1,4 @@ -/* eslint-disable node/no-callback-literal */ +/* eslint-disable node/no-callback-literal, no-void */ import type { AppInterface, ScriptSourceInfo, @@ -35,15 +35,27 @@ import sourceCenter from './source_center' export type moduleCallBack = Func & { moduleCount?: number, errorCount?: number } +const scriptTypes = ['text/javascript', 'text/ecmascript', 'application/javascript', 'application/ecmascript', 'module', 'systemjs-module', 'systemjs-importmap'] + +// whether use type='module' script function isTypeModule (app: AppInterface, scriptInfo: ScriptSourceInfo): boolean { return scriptInfo.appSpace[app.name].module && (!app.useSandbox || app.esmodule) } +// special script element function isSpecialScript (app: AppInterface, scriptInfo: ScriptSourceInfo): boolean { const attrs = scriptInfo.appSpace[app.name].attrs return attrs.has('id') } +/** + * whether to run js in inline mode + * scene: + * 1. inline config for app + * 2. inline attr in script element + * 3. module script + * 4. script with special attr + */ function isInlineMode (app: AppInterface, scriptInfo: ScriptSourceInfo): boolean { return ( app.inline || @@ -53,16 +65,29 @@ function isInlineMode (app: AppInterface, scriptInfo: ScriptSourceInfo): boolean ) } -function getExistParseResult (scriptInfo: ScriptSourceInfo, currentCode: string): Function | void { +/** + * If the appSpace of the current js address has other app, try to reuse parsedFunction of other app + * @param appName app.name + * @param scriptInfo scriptInfo of current address + * @param currentCode pure code of current address + */ +function getExistParseResult ( + appName: string, + scriptInfo: ScriptSourceInfo, + currentCode: string, +): Function | void { const appSpace = scriptInfo.appSpace - for (const appName in scriptInfo.appSpace) { - const appSpaceData = appSpace[appName] - if (appSpaceData.parsedCode === currentCode && appSpaceData.parsedFunction) { - return appSpaceData.parsedFunction + for (const item in appSpace) { + if (item !== appName) { + const appSpaceData = appSpace[item] + if (appSpaceData.parsedCode === currentCode && appSpaceData.parsedFunction) { + return appSpaceData.parsedFunction + } } } } +// Prevent randomly created strings from repeating function getUniqueNonceSrc (): string { const nonceStr: string = createNonceSrc() if (sourceCenter.script.hasInfo(nonceStr)) { @@ -71,6 +96,7 @@ function getUniqueNonceSrc (): string { return nonceStr } +// Convert string code to function function code2Function (code: string): Function { return new Function(code) } @@ -103,8 +129,12 @@ export function extractScriptElement ( if (script.hasAttribute('exclude') || checkExcludeUrl(src, app.name)) { replaceComment = document.createComment('script element with exclude attribute removed by micro-app') } else if ( - (script.type && !['text/javascript', 'text/ecmascript', 'application/javascript', 'application/ecmascript', 'module', 'systemjs-module', 'systemjs-importmap'].includes(script.type)) || - script.hasAttribute('ignore') || checkIgnoreUrl(src, app.name) + ( + script.type && + !scriptTypes.includes(script.type) + ) || + script.hasAttribute('ignore') || + checkIgnoreUrl(src, app.name) ) { return null } else if ( @@ -132,11 +162,19 @@ export function extractScriptElement ( } } } else { + /** + * Reuse when appSpace exists + * NOTE: + * 1. The same static script, appSpace must be the same (in fact, it may be different when url change) + * 2. The same dynamic script, appSpace may be the same, but we still reuse appSpace, which should pay attention + */ scriptInfo.appSpace[app.name] = scriptInfo.appSpace[app.name] || appSpaceData } + + sourceCenter.script.setInfo(src, scriptInfo) + if (!isDynamic) { app.source.scripts.add(src) - sourceCenter.script.setInfo(src, scriptInfo) replaceComment = document.createComment(`script with src='${src}' extract by micro-app`) } else { return { address: src, scriptInfo } @@ -171,6 +209,7 @@ export function extractScriptElement ( sourceCenter.script.setInfo(nonceStr, scriptInfo) replaceComment = document.createComment('inline script extract by micro-app') } else { + // Because each dynamic script is unique, it is not put into sourceCenter return { address: nonceStr, scriptInfo } } } else if (!isDynamic) { @@ -252,17 +291,7 @@ export function fetchScriptsFromHtml ( if (fetchScriptPromise.length) { promiseStream(fetchScriptPromise, (res: {data: string, index: number}) => { - if (fiberScriptTasks) { - fiberScriptTasks.push(() => promiseRequestIdle((resolve: PromiseConstructor['resolve']) => { - fetchScriptSuccess( - fetchScriptPromiseInfo[res.index][0], - fetchScriptPromiseInfo[res.index][1], - res.data, - app, - ) - resolve() - })) - } else { + const handleStreamResult = () => { fetchScriptSuccess( fetchScriptPromiseInfo[res.index][0], fetchScriptPromiseInfo[res.index][1], @@ -270,6 +299,14 @@ export function fetchScriptsFromHtml ( app, ) } + if (fiberScriptTasks) { + fiberScriptTasks.push(() => promiseRequestIdle((resolve: PromiseConstructor['resolve']) => { + handleStreamResult() + resolve() + })) + } else { + handleStreamResult() + } }, (err: {error: Error, index: number}) => { logError(err, app.name) }, () => { @@ -311,7 +348,7 @@ export function fetchScriptSuccess ( const appSpaceData = scriptInfo.appSpace[app.name] appSpaceData.parsedCode = bindScope(address, app, code, scriptInfo) if (!isInlineMode(app, scriptInfo)) { - appSpaceData.parsedFunction = getExistParseResult(scriptInfo, appSpaceData.parsedCode) || code2Function(appSpaceData.parsedCode) + appSpaceData.parsedFunction = getExistParseResult(app.name, scriptInfo, appSpaceData.parsedCode) || code2Function(appSpaceData.parsedCode) } } } @@ -345,12 +382,12 @@ export function execScripts ( } else { if (fiberScriptTasks) { fiberScriptTasks.push(() => promiseRequestIdle((resolve: PromiseConstructor['resolve']) => { - runScript(address, app, scriptInfo, false) + runScript(address, app, scriptInfo) initHook(false) resolve() })) } else { - runScript(address, app, scriptInfo, false) + runScript(address, app, scriptInfo) initHook(false) } } @@ -366,19 +403,29 @@ export function execScripts ( }, () => { deferScriptInfo.forEach(([address, scriptInfo]) => { if (scriptInfo.code) { + const runDeferScript = () => { + runScript(address, app, scriptInfo, initHook) + !isTypeModule(app, scriptInfo) && initHook(false) + } if (fiberScriptTasks) { fiberScriptTasks.push(() => promiseRequestIdle((resolve: PromiseConstructor['resolve']) => { - runScript(address, app, scriptInfo, false, initHook) - !isTypeModule(app, scriptInfo) && initHook(false) + runDeferScript() resolve() })) } else { - runScript(address, app, scriptInfo, false, initHook) - !isTypeModule(app, scriptInfo) && initHook(false) + runDeferScript() } } }) + /** + * Fiber wraps js in requestIdleCallback and executes it in sequence + * NOTE: + * 1. In order to ensure the execution order, wait for all js loaded and then execute + * 2. If js create a dynamic script, it may be errors in the execution order, because the subsequent js is wrapped in requestIdleCallback, even putting dynamic script in requestIdleCallback doesn't solve it + * + * BUG: NOTE.2 - execution order problem + */ if (fiberScriptTasks) { fiberScriptTasks.push(() => Promise.resolve(initHook( isUndefined(initHook.moduleCount) || @@ -407,21 +454,20 @@ export function execScripts ( * @param address script address * @param app app * @param scriptInfo script info - * @param isDynamic dynamically created script * @param callback callback of module script */ export function runScript ( address: string, app: AppInterface, scriptInfo: ScriptSourceInfo, - isDynamic: boolean, callback?: moduleCallBack, -): any { + replaceElement?: HTMLScriptElement, +): void { try { preActionForExecScript(app) const appSpaceData = scriptInfo.appSpace[app.name] /** - * TIP: + * NOTE: * 1. plugins and wrapCode will only be executed once * 2. if parsedCode not exist, parsedFunction is not exist * 3. if parsedCode exist, parsedFunction does not necessarily exist @@ -431,7 +477,7 @@ export function runScript ( } if (isInlineMode(app, scriptInfo)) { - const scriptElement = pureCreateElement('script') + const scriptElement = replaceElement || pureCreateElement('script') runCode2InlineScript( address, appSpaceData.parsedCode, @@ -440,80 +486,71 @@ export function runScript ( appSpaceData.attrs, callback, ) - if (isDynamic) return scriptElement - // TEST IGNORE - app.container?.querySelector('micro-app-body')!.appendChild(scriptElement) + + if (!replaceElement) { + // TEST IGNORE + app.container?.querySelector('micro-app-body')!.appendChild(scriptElement) + } } else { runParsedFunction(app, scriptInfo) - if (isDynamic) return document.createComment('dynamic script extract by micro-app') } } catch (e) { - console.error(`[micro-app from runScript] app ${app.name}: `, e) + console.error(`[micro-app from ${replaceElement ? 'runDynamicScript' : 'runScript'}] app ${app.name}: `, e, address) } } /** * Get dynamically created remote script * @param address script address + * @param app app instance * @param scriptInfo scriptInfo - * @param app app * @param originScript origin script element */ export function runDynamicRemoteScript ( address: string, - scriptInfo: ScriptSourceInfo, app: AppInterface, + scriptInfo: ScriptSourceInfo, originScript: HTMLScriptElement, ): HTMLScriptElement | Comment { + const replaceElement = isInlineMode(app, scriptInfo) ? pureCreateElement('script') : document.createComment('dynamic script extract by micro-app') + const dispatchScriptOnLoadEvent = () => dispatchOnLoadEvent(originScript) - if (scriptInfo.code) { - !isTypeModule(app, scriptInfo) && defer(dispatchScriptOnLoadEvent) - /** - * TODO: 这里要改,当script初始化时动态创建远程script时,初次渲染和二次渲染的顺序不一致,会导致错误 - * 1、url不存在缓存,初始化的时候肯定是要异步请求,那么执行顺序就会靠后,至少落后于html自带的script - * 2、url存在缓存,那么二次渲染的时候这里会同步执行,就会先于html自带的script执行 - * 3、测试一下,初次渲染和二次渲染时,onload的执行时机,是在js执行完成,还是执行之前 - * 4、将上述问题做成注释,方便后续阅读和理解 - * 5、这里只有远程js - */ - return runScript(address, app, scriptInfo, true, dispatchScriptOnLoadEvent) + const runDynamicScript = () => { + runScript(address, app, scriptInfo, dispatchScriptOnLoadEvent, replaceElement as HTMLScriptElement) + + !isTypeModule(app, scriptInfo) && dispatchScriptOnLoadEvent() } - let replaceElement: Comment | HTMLScriptElement - if (isInlineMode(app, scriptInfo)) { - replaceElement = pureCreateElement('script') + if (scriptInfo.code) { + defer(runDynamicScript) } else { - replaceElement = document.createComment(`dynamic script with src='${address}' extract by micro-app`) + fetchSource(address, app.name).then((code: string) => { + scriptInfo.code = code + runDynamicScript() + }).catch((err) => { + logError(err, app.name) + dispatchOnErrorEvent(originScript) + }) } - fetchSource(address, app.name).then((code: string) => { - scriptInfo.code = code - sourceCenter.script.setInfo(address, scriptInfo) - const appSpaceData = scriptInfo.appSpace[app.name] - try { - preActionForExecScript(app) - appSpaceData.parsedCode = bindScope(address, app, code, scriptInfo) - if (isInlineMode(app, scriptInfo)) { - runCode2InlineScript( - address, - appSpaceData.parsedCode, - isTypeModule(app, scriptInfo), - replaceElement as HTMLScriptElement, - appSpaceData.attrs, - dispatchScriptOnLoadEvent, - ) - } else { - runParsedFunction(app, scriptInfo) - } - } catch (e) { - console.error(`[micro-app from runDynamicScript] app ${app.name}: `, e, address) - } - !isTypeModule(app, scriptInfo) && dispatchScriptOnLoadEvent() - }).catch((err) => { - logError(err, app.name) - dispatchOnErrorEvent(originScript) - }) + return replaceElement +} + +/** + * Get dynamically created inline script + * @param address script address + * @param app app instance + * @param scriptInfo scriptInfo + */ +export function runDynamicInlineScript ( + address: string, + app: AppInterface, + scriptInfo: ScriptSourceInfo, +): HTMLScriptElement | Comment { + const replaceElement = isInlineMode(app, scriptInfo) ? pureCreateElement('script') : document.createComment('dynamic script extract by micro-app') + + runScript(address, app, scriptInfo, void 0, replaceElement as HTMLScriptElement) return replaceElement } @@ -524,6 +561,7 @@ export function runDynamicRemoteScript ( * @param code bound code * @param module type='module' of script * @param scriptElement target script element + * @param attrs attributes of script element * @param callback callback of module script */ function runCode2InlineScript ( @@ -558,7 +596,7 @@ function runCode2InlineScript ( function runParsedFunction (app: AppInterface, scriptInfo: ScriptSourceInfo) { const appSpaceData = scriptInfo.appSpace[app.name] if (!appSpaceData.parsedFunction) { - appSpaceData.parsedFunction = getExistParseResult(scriptInfo, appSpaceData.parsedCode!) || code2Function(appSpaceData.parsedCode!) + appSpaceData.parsedFunction = getExistParseResult(app.name, scriptInfo, appSpaceData.parsedCode!) || code2Function(appSpaceData.parsedCode!) } appSpaceData.parsedFunction.call(window) } @@ -575,7 +613,7 @@ function bindScope ( code: string, scriptInfo: ScriptSourceInfo, ): string { - // TODO: 增加缓存机制 + // TODO: cache config if (isPlainObject(microApp.plugins)) { code = usePlugins(address, code, app.name, microApp.plugins) } diff --git a/src/source/source_center.ts b/src/source/source_center.ts index 5818dfe96..6ef986888 100644 --- a/src/source/source_center.ts +++ b/src/source/source_center.ts @@ -32,6 +32,10 @@ function createSourceCenter (): SourceCenter { const linkList: LinkListType = new Map() const scriptList: ScriptListType = new Map() + // setInterval(() => { + // console.log(linkList, scriptList) + // }, 10000); + function createSourceHandler > (targetList: T): SourceCenter

                  ['link'] | SourceCenter['script'] { return { setInfo (address: SourceAddress, info: P): void { From 4d8978f32b648420c4cb22a97286c89e5ae44326 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Mon, 15 Aug 2022 20:26:44 +0800 Subject: [PATCH 081/268] feat: Optimized source/link code --- dev/children/react16/public/index.html | 1 + src/libs/global_env.ts | 1 - src/sandbox/scoped_css.ts | 5 +- src/source/links.ts | 82 +++++++++++++++++--------- src/source/scripts.ts | 2 - typings/global.d.ts | 9 +-- 6 files changed, 60 insertions(+), 40 deletions(-) diff --git a/dev/children/react16/public/index.html b/dev/children/react16/public/index.html index 2795d36d2..0cace4ea1 100644 --- a/dev/children/react16/public/index.html +++ b/dev/children/react16/public/index.html @@ -26,6 +26,7 @@ + diff --git a/src/libs/global_env.ts b/src/libs/global_env.ts index 40b7f36cb..aa86aa1af 100644 --- a/src/libs/global_env.ts +++ b/src/libs/global_env.ts @@ -33,7 +33,6 @@ declare global { } interface HTMLStyleElement { - __MICRO_APP_LINK_PATH__?: string __MICRO_APP_HAS_SCOPED__?: boolean } } diff --git a/src/sandbox/scoped_css.ts b/src/sandbox/scoped_css.ts index b3596677a..f2dd21558 100644 --- a/src/sandbox/scoped_css.ts +++ b/src/sandbox/scoped_css.ts @@ -429,6 +429,7 @@ let parser: CSSParser export default function scopedCSS ( styleElement: HTMLStyleElement, app: AppInterface, + linkPath?: string, ): HTMLStyleElement { if (app.scopecss) { const prefix = createPrefix(app.name) @@ -441,7 +442,7 @@ export default function scopedCSS ( app.name, prefix, app.url, - styleElement.__MICRO_APP_LINK_PATH__, + linkPath, ) } else { const observer = new MutationObserver(function () { @@ -453,7 +454,7 @@ export default function scopedCSS ( app.name, prefix, app.url, - styleElement.__MICRO_APP_LINK_PATH__, + linkPath, ) } }) diff --git a/src/source/links.ts b/src/source/links.ts index c15ba8039..b7e968180 100644 --- a/src/source/links.ts +++ b/src/source/links.ts @@ -22,6 +22,36 @@ import { } from './load_event' import sourceCenter from './source_center' +/** + * + * @param appName app.name + * @param linkInfo linkInfo of current address + */ +function getExistParseCode ( + appName: string, + prefix: string, + linkInfo: LinkSourceInfo, +): string | void { + const appSpace = linkInfo.appSpace + for (const item in appSpace) { + if (item !== appName) { + const appSpaceData = appSpace[item] + if (appSpaceData.parsedCode) { + return appSpaceData.parsedCode.replaceAll(new RegExp(createPrefix(item, true), 'g'), prefix) + } + } + } +} + +// transfer the attributes on the link to convertStyle +function setConvertStyleAttr (convertStyle: HTMLStyleElement, attrs: AttrsType): void { + attrs.forEach((value, key) => { + if (key === 'rel') return + if (key === 'href') key = 'data-origin-href' + convertStyle.setAttribute(key, value) + }) +} + /** * Extract link elements * @param link link element @@ -53,7 +83,7 @@ export function extractLinkFromHtml ( } } } else { - linkInfo.appSpace[app.name] = appSpaceData + linkInfo.appSpace[app.name] = linkInfo.appSpace[app.name] || appSpaceData } sourceCenter.link.setInfo(href, linkInfo) @@ -147,7 +177,7 @@ export function fetchLinksFromHtml ( * 2. Only handler html link element, not dynamic link or style * 3. The same prefix can reuse parsedCode * 4. Async exec with requestIdleCallback in prefetch or fiber - * 5. appSpace[app.name].placeholder/.attrs must exist + * 5. appSpace[app.name].placeholder/attrs must exist * @param address resource address * @param code link source code * @param microAppHead micro-app-head @@ -165,7 +195,8 @@ export function fetchLinkSuccess ( */ const linkInfo = sourceCenter.link.getInfo(address)! linkInfo.code = code - const placeholder = linkInfo.appSpace[app.name].placeholder! + const appSpaceData = linkInfo.appSpace[app.name] + const placeholder = appSpaceData.placeholder! const convertStyle = pureCreateElement('style') handleConvertStyle( @@ -173,7 +204,7 @@ export function fetchLinkSuccess ( address, convertStyle, linkInfo, - linkInfo.appSpace[app.name].attrs, + appSpaceData.attrs, ) if (placeholder.parentNode) { @@ -183,11 +214,15 @@ export function fetchLinkSuccess ( } // clear placeholder - linkInfo.appSpace[app.name].placeholder = null + appSpaceData.placeholder = null } /** - * update convertStyle, linkInfo.parseResult + * Get parsedCode, update convertStyle + * Actions: + * 1. get scope css (through scopedCSS or oldData) + * 2. record parsedCode + * 3. set parsedCode to convertStyle if need * @param app app instance * @param address resource address * @param convertStyle converted style @@ -202,22 +237,19 @@ export function handleConvertStyle ( attrs: AttrsType, ): void { if (app.scopecss) { - const prefix = createPrefix(app.name) - // set __MICRO_APP_LINK_PATH__ before scopedCSS - convertStyle.__MICRO_APP_LINK_PATH__ = address - if (!linkInfo.parseResult) { - convertStyle.textContent = linkInfo.code - scopedCSS(convertStyle, app) - linkInfo.parseResult = { - prefix, - parsedCode: convertStyle.textContent, + const appSpaceData = linkInfo.appSpace[app.name] + appSpaceData.prefix = appSpaceData.prefix || createPrefix(app.name) + if (!appSpaceData.parsedCode) { + const existParsedCode = getExistParseCode(app.name, appSpaceData.prefix, linkInfo) + if (!existParsedCode) { + convertStyle.textContent = linkInfo.code + scopedCSS(convertStyle, app, address) + } else { + convertStyle.textContent = existParsedCode } - } else if (linkInfo.parseResult.prefix === prefix) { - convertStyle.textContent = linkInfo.parseResult.parsedCode + appSpaceData.parsedCode = convertStyle.textContent } else { - // Attention background, url() - convertStyle.textContent = linkInfo.parseResult.parsedCode.replaceAll(new RegExp(createPrefix(app.name, true), 'g'), prefix) - // scopedCSS(convertStyle, app) + convertStyle.textContent = appSpaceData.parsedCode } } else { convertStyle.textContent = linkInfo.code @@ -226,16 +258,8 @@ export function handleConvertStyle ( setConvertStyleAttr(convertStyle, attrs) } -// transfer the attributes on the link to convertStyle -function setConvertStyleAttr (convertStyle: HTMLStyleElement, attrs: AttrsType): void { - attrs.forEach((value, key) => { - if (key === 'href') key = 'data-origin-href' - convertStyle.setAttribute(key, value) - }) -} - /** - * get css from dynamic link + * Handle css of dynamic link * @param address link address * @param app app * @param linkInfo linkInfo diff --git a/src/source/scripts.ts b/src/source/scripts.ts index 6225ac96a..47d61df98 100644 --- a/src/source/scripts.ts +++ b/src/source/scripts.ts @@ -145,7 +145,6 @@ export function extractScriptElement ( } else if (src) { // remote script let scriptInfo = sourceCenter.script.getInfo(src) const appSpaceData = { - isDynamic: isDynamic, async: script.hasAttribute('async'), defer: script.defer || script.type === 'module', module: script.type === 'module', @@ -194,7 +193,6 @@ export function extractScriptElement ( isExternal: false, appSpace: { [app.name]: { - isDynamic: isDynamic, async: false, defer: script.type === 'module', module: script.type === 'module', diff --git a/typings/global.d.ts b/typings/global.d.ts index 6e32c6a9a..75b11a7d6 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -57,18 +57,15 @@ declare module '@micro-app/types' { appSpace: Record, // active element.attributes placeholder?: Comment | null, // placeholder comment - }>, - parseResult?: { - prefix: string, // micro-app[name=appName] - parsedCode: string, // parsed code - }, + parsedCode?: string, // parsed code + prefix?: string, // micro-app[name=appName] + }> } type ScriptSourceInfo = { code: string, // source code isExternal: boolean, // external script appSpace: Record Date: Wed, 17 Aug 2022 11:23:08 +0800 Subject: [PATCH 082/268] fix: Fixed inconsistency between router global guard parameters and documentation --- dev/children/angular14/.gitignore | 3 ++- dev/children/react16/src/index.js | 14 ++++++++------ src/sandbox/router/api.ts | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/dev/children/angular14/.gitignore b/dev/children/angular14/.gitignore index 0711527ef..5607f3f34 100644 --- a/dev/children/angular14/.gitignore +++ b/dev/children/angular14/.gitignore @@ -5,6 +5,7 @@ /tmp /out-tsc /bazel-out +/angular14 # Node /node_modules @@ -29,7 +30,7 @@ yarn-error.log .history/* # Miscellaneous -/.angular/cache +/.angular .sass-cache/ /connect.lock /coverage diff --git a/dev/children/react16/src/index.js b/dev/children/react16/src/index.js index fb2fee317..de5b84188 100644 --- a/dev/children/react16/src/index.js +++ b/dev/children/react16/src/index.js @@ -221,12 +221,14 @@ dynamicStyle.textContent = '.test-class { color: red } ' * 子应用:/sugrec,默认补全为 http://localhost:3001/sugrec * 主应用:http://localhost:3000/sugrec */ -fetch('/sugrec').then((res) => { - res.headers.forEach(function(val, key) { console.log('response.headers: ', key + ': ' + val) }) - return res.json() -}).then((data) => { - console.log('proxy代理 https://www.baidu.com/sugrec 返回数据', data) -}) +if (process.env.NODE_ENV !== 'production') { + fetch('/sugrec').then((res) => { + res.headers.forEach(function(val, key) { console.log('response.headers: ', key + ': ' + val) }) + return res.json() + }).then((data) => { + console.log('proxy代理 https://www.baidu.com/sugrec 返回数据', data) + }) +} /* ---------------------- 插件相关 --------------------- */ diff --git a/src/sandbox/router/api.ts b/src/sandbox/router/api.ts index d856457fc..3003f626f 100644 --- a/src/sandbox/router/api.ts +++ b/src/sandbox/router/api.ts @@ -164,7 +164,7 @@ function createRouterApi (): RouterApi { removeDomScope() for (const guard of guards) { if (isFunction(guard)) { - guard(appName, to, from) + guard(to, from, appName) } else if (isPlainObject(guard) && isFunction((guard as AccurateGuard)[appName])) { guard[appName](to, from) } From 955cd099571900bd791c12f167d6c77fb8183503 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Wed, 17 Aug 2022 18:59:07 +0800 Subject: [PATCH 083/268] feat: Fixed the error when prefetch app was replaced --- dev/children/react16/public/index.html | 1 - dev/main-react16/src/global.jsx | 41 ++++++++++--- dev/main-react16/src/pages/vue2/module.less | 3 + dev/main-react16/src/pages/vue2/vue2.js | 4 +- docs/zh-cn/changelog.md | 28 +++++++++ src/prefetch.ts | 44 ++++++++------ src/source/links.ts | 39 ++++++++----- src/source/scripts.ts | 64 ++++++++++++++++----- typings/global.d.ts | 3 + 9 files changed, 169 insertions(+), 58 deletions(-) create mode 100644 dev/main-react16/src/pages/vue2/module.less diff --git a/dev/children/react16/public/index.html b/dev/children/react16/public/index.html index 0cace4ea1..7b17e1254 100644 --- a/dev/children/react16/public/index.html +++ b/dev/children/react16/public/index.html @@ -24,7 +24,6 @@ console.log('测试script带有id时的处理逻辑') - diff --git a/dev/main-react16/src/global.jsx b/dev/main-react16/src/global.jsx index 1a762ea11..9b232f230 100644 --- a/dev/main-react16/src/global.jsx +++ b/dev/main-react16/src/global.jsx @@ -2,14 +2,39 @@ import 'babel-polyfill' import microApp, { unmountApp, unmountAllApps } from '@micro-zoe/micro-app' import config from './config' -// microApp.preFetch([ -// {name: 'vite', url: `${config.vite}micro-app/vite`}, -// {name: 'vue2', url: `${config.vue2}micro-app/vue2`}, -// {name: 'react16', url: `${config.react16}micro-app/react16`}, -// {name: 'react17', url: `${config.react17}micro-app/react17`}, -// {name: 'vue3', url: `${config.vue3}micro-app/vue3`}, -// {name: 'angular11', url: `${config.angular11}micro-app/angular11`}, -// ]) +microApp.preFetch([ + { + name: 'vite', + url: `${config.vite}micro-app/vite`, + esmodule: true, + // inline: true, + // 'disable-sandbox': true, + }, + { + name: 'vue2', + url: `${config.vue2}micro-app/vue2`, + }, + { + name: 'react16', + url: `${config.react16}micro-app/react16`, + }, + { + name: 'react17', + url: `${config.react17}micro-app/react17`, + }, + { + name: 'vue3', + url: `${config.vue3}micro-app/vue3`, + }, + { + name: 'angular11', + url: `${config.angular11}micro-app/angular11`, + }, + { + name: 'angular14', + url: `${config.angular14}micro-app/angular14`, + }, +]) microApp.start({ // shadowDOM: true, diff --git a/dev/main-react16/src/pages/vue2/module.less b/dev/main-react16/src/pages/vue2/module.less new file mode 100644 index 000000000..1bcfe1949 --- /dev/null +++ b/dev/main-react16/src/pages/vue2/module.less @@ -0,0 +1,3 @@ +.testModule { + color: red; +} diff --git a/dev/main-react16/src/pages/vue2/vue2.js b/dev/main-react16/src/pages/vue2/vue2.js index db4abdbf5..54ca2fec9 100644 --- a/dev/main-react16/src/pages/vue2/vue2.js +++ b/dev/main-react16/src/pages/vue2/vue2.js @@ -4,9 +4,10 @@ import jsxCustomEvent from '@micro-zoe/micro-app/polyfill/jsx-custom-event' import { useState, useEffect } from 'react' import { Button, Spin, Col } from 'antd' import { LoadingOutlined } from '@ant-design/icons' +import microApp from '@micro-zoe/micro-app' import config from '../../config' import './vue2.less' -import microApp from '@micro-zoe/micro-app' +import lessStyles from './module.less' const antIcon = @@ -53,6 +54,7 @@ function Vue2 () { }, []) return (

                  +
                  test-cssModule
                  diff --git a/dev/main-react16/src/pages/vue2/vue2.js b/dev/main-react16/src/pages/vue2/vue2.js index 54ca2fec9..695822267 100644 --- a/dev/main-react16/src/pages/vue2/vue2.js +++ b/dev/main-react16/src/pages/vue2/vue2.js @@ -84,7 +84,7 @@ function Vue2 () { // shadowDOM // destroy // inline - // disableScopecss + // disable-scopecss // disableSandbox > diff --git a/docs/1.x/zh-cn/api.md b/docs/1.x/zh-cn/api.md index 0574cf04b..a0e832637 100644 --- a/docs/1.x/zh-cn/api.md +++ b/docs/1.x/zh-cn/api.md @@ -1,6 +1,6 @@ -# ** 基座应用API ** +# ** 主应用API ** ## start **描述:**micro-app注册函数,全局执行一次 @@ -40,7 +40,7 @@ start (options?: { plugins?: { // 全局插件,作用于所有子应用的js文件 global?: Array<{ - // 可选,强隔离的全局变量(默认情况下子应用无法找到的全局变量会兜底到基座应用中,scopeProperties可以禁止这种情况) + // 可选,强隔离的全局变量(默认情况下子应用无法找到的全局变量会兜底到主应用中,scopeProperties可以禁止这种情况) scopeProperties?: string[], // 可选,可以逃逸到外部的全局变量(escapeProperties中的变量会同时赋值到子应用和外部真实的window上) escapeProperties?: string[], @@ -60,7 +60,7 @@ start (options?: { modules?: { // appName为应用的名称,这些插件只会作用于指定的应用 [name: string]: Array<{ - // 可选,强隔离的全局变量(默认情况下子应用无法找到的全局变量会兜底到基座应用中,scopeProperties可以禁止这种情况) + // 可选,强隔离的全局变量(默认情况下子应用无法找到的全局变量会兜底到主应用中,scopeProperties可以禁止这种情况) scopeProperties?: string[], // 可选,可以逃逸到外部的全局变量(escapeProperties中的变量会同时赋值到子应用和外部真实的window上) escapeProperties?: string[], @@ -195,7 +195,7 @@ document.body.appendChild(pureDiv) ## removeDomScope -**描述:**解除元素绑定,通常用于受子应用元素绑定影响,导致基座元素错误绑定到子应用的情况 +**描述:**解除元素绑定,通常用于受子应用元素绑定影响,导致主应用元素错误绑定到子应用的情况 **使用方式:** ```js @@ -361,7 +361,7 @@ microApp.addDataListener('my-app', dataListener) ``` ## removeDataListener -**描述:**解除基座绑定的指定子应用的数据监听函数 +**描述:**解除主应用的数据监听函数 **使用方式:** @@ -377,7 +377,7 @@ microApp.removeDataListener('my-app', dataListener) ``` ## clearDataListener -**描述:**清空基座绑定的指定子应用的所有数据监听函数 +**描述:**清空主应用的所有数据监听函数 **使用方式:** @@ -441,7 +441,7 @@ microApp.removeGlobalDataListener(dataListener) ``` ## clearGlobalDataListener -**描述:**清空基座应用绑定的所有全局数据监听函数 +**描述:**清空主应用绑定的所有全局数据监听函数 **使用方式:** @@ -486,7 +486,7 @@ document.body.appendChild(pureDiv) ## removeDomScope -**描述:**解除元素绑定,通常用于受子应用元素绑定影响,导致基座元素错误绑定到子应用的情况 +**描述:**解除元素绑定,通常用于受子应用元素绑定影响,导致主应用元素错误绑定到子应用的情况 **版本限制:** 0.8.2及以上版本 @@ -514,11 +514,11 @@ window.rawDocument ## getData -**描述:**获取基座下发的data数据 +**描述:**获取主应用下发的data数据 **使用方式:** ```js -const data = window.microApp.getData() // 返回基座下发的data数据 +const data = window.microApp.getData() // 返回主应用下发的data数据 ``` ## addDataListener @@ -530,8 +530,8 @@ const data = window.microApp.getData() // 返回基座下发的data数据 * 绑定监听函数,监听函数只有在数据变化时才会触发 * dataListener: 绑定函数 * autoTrigger: 在初次绑定监听函数时如果有缓存数据,是否需要主动触发一次,默认为false - * !!!重要说明: 因为子应用是异步渲染的,而基座发送数据是同步的, - * 如果在子应用渲染结束前基座应用发送数据,则在绑定监听函数前数据已经发送,在初始化后不会触发绑定函数, + * !!!重要说明: 因为子应用是异步渲染的,而主应用发送数据是同步的, + * 如果在子应用渲染结束前主应用发送数据,则在绑定监听函数前数据已经发送,在初始化后不会触发绑定函数, * 但这个数据会放入缓存中,此时可以设置autoTrigger为true主动触发一次监听函数来获取数据。 */ window.microApp.addDataListener(dataListener: Function, autoTrigger?: boolean) @@ -540,7 +540,7 @@ window.microApp.addDataListener(dataListener: Function, autoTrigger?: boolean) **使用方式:** ```js function dataListener (data) { - console.log('来自基座应用的数据', data) + console.log('来自主应用的数据', data) } window.microApp.addDataListener(dataListener) @@ -553,7 +553,7 @@ window.microApp.addDataListener(dataListener) ```js function dataListener (data) { - console.log('来自基座应用的数据', data) + console.log('来自主应用的数据', data) } window.microApp.removeDataListener(dataListener) @@ -569,7 +569,7 @@ window.microApp.clearDataListener() ``` ## dispatch -**描述:**向基座应用发送数据 +**描述:**向主应用发送数据 **使用方式:** diff --git a/docs/1.x/zh-cn/browser-router.md b/docs/1.x/zh-cn/browser-router.md index f9fab8642..caca8fa0f 100644 --- a/docs/1.x/zh-cn/browser-router.md +++ b/docs/1.x/zh-cn/browser-router.md @@ -1,20 +1,20 @@ 关闭虚拟路由后,没有了路由隔离后的处理方式会复杂很多,子应用将基于浏览器地址进行渲染,此时需要设置子应用的基础路由。 #### 路由类型约束 -- 1、基座是hash路由,子应用也必须是hash路由 -- 2、基座是history路由,子应用可以是hash或history路由 +- 1、主应用是hash路由,子应用也必须是hash路由 +- 2、主应用是history路由,子应用可以是hash或history路由 #### 基础路由 **作用:** -通常基座应用和子应用各有一套路由系统,为了防止冲突,基座需要分配一个路由给子应用,称之为基础路由,子应用可以在这个路由下渲染,但不能超出这个路由的范围,这就是基础路由的作用。 +通常主应用和子应用各有一套路由系统,为了防止冲突,主应用需要分配一个路由给子应用,称之为基础路由,子应用可以在这个路由下渲染,但不能超出这个路由的范围,这就是基础路由的作用。 **使用方式** -基座应用中通过设置 ``的`baseroute`属性下发,子应用通过`window.__MICRO_APP_BASE_ROUTE__`获取此值并设置基础路由。 +主应用中通过设置 ``的`baseroute`属性下发,子应用通过`window.__MICRO_APP_BASE_ROUTE__`获取此值并设置基础路由。 **注意点:** -- 1、如果基座是history路由,子应用是hash路由,不需要设置基础路由baseroute +- 1、如果主应用是history路由,子应用是hash路由,不需要设置基础路由baseroute - 2、如果子应用只有一个页面,没有使用`react-router`,`vue-router`之类,也不需要设置基础路由baseroute - 3、vue-router在hash模式下无法通过base设置基础路由,需要创建一个空的路由页面,将其它路由作为它的children,具体设置如下: @@ -46,7 +46,7 @@ const routes = [ -#### ** 基座 ** +#### ** 主应用 ** ```js // router.js @@ -84,7 +84,7 @@ import { BrowserRouter, Switch, Route } from 'react-router-dom' export default function AppRoute () { return ( - // 👇 设置基础路由,子应用可以通过window.__MICRO_APP_BASE_ROUTE__获取基座下发的baseroute,如果没有设置baseroute属性,则此值默认为空字符串 + // 👇 设置基础路由,子应用可以通过window.__MICRO_APP_BASE_ROUTE__获取主应用下发的baseroute,如果没有设置baseroute属性,则此值默认为空字符串 ... @@ -97,7 +97,7 @@ export default function AppRoute () { -#### ** 基座 ** +#### ** 主应用 ** ```js // router.js @@ -134,7 +134,7 @@ import VueRouter from 'vue-router' import routes from './router' const router = new VueRouter({ - // 👇 设置基础路由,子应用可以通过window.__MICRO_APP_BASE_ROUTE__获取基座下发的baseroute,如果没有设置baseroute属性,则此值默认为空字符串 + // 👇 设置基础路由,子应用可以通过window.__MICRO_APP_BASE_ROUTE__获取主应用下发的baseroute,如果没有设置baseroute属性,则此值默认为空字符串 base: window.__MICRO_APP_BASE_ROUTE__ || '/', routes, }) @@ -164,7 +164,7 @@ micro-app的url属性只是html的地址,它的作用就是加载html资源。 浏览器地址为:`http://localhost:3000/page1/`,此时路由地址为`page1`。 -基座应用会匹配`page1`并渲染对应的组件,子应用也是一样,浏览器地址会同时影响到基座应用和子应用,因为每个应用都有一套自己的路由系统,它们是可以共存的,不会冲突。 +主应用会匹配`page1`并渲染对应的组件,子应用也是一样,浏览器地址会同时影响到主应用和子应用,因为每个应用都有一套自己的路由系统,它们是可以共存的,不会冲突。 此时我们要渲染子应用`http://www.xxx.com/`的`page1`页面,那么micro-app的url属性填写的是`http://www.xxx.com/`,而不是`http://www.xxx.com/page1/`。 @@ -188,11 +188,11 @@ micro-app的url属性只是html的地址,它的作用就是加载html资源。 **栗子3 🌰 :** -基座应用是history路由,子应用是hash路由,我们要跳转基座应用的`my-app`页面,页面中嵌入子应用,我们要展现子应用的`page1`页面。 +主应用是history路由,子应用是hash路由,我们要跳转主应用的`my-app`页面,页面中嵌入子应用,我们要展现子应用的`page1`页面。 -那么浏览器地址应该为:`域名/my-page#/page1`,我们在基座中跳转`my-app`页面的参数为:`router.push('/my-page#/page1')` +那么浏览器地址应该为:`域名/my-page#/page1`,我们在主应用中跳转`my-app`页面的参数为:`router.push('/my-page#/page1')` -此时流程为:基座应用匹配到`/my-page`路径并渲染`my-app`页面,因为`my-app`页面中嵌入了子应用,此时子应用开始加载并渲染,子应用在渲染时会匹配到`#/page1`并渲染`page1`页面。 +此时流程为:主应用匹配到`/my-page`路径并渲染`my-app`页面,因为`my-app`页面中嵌入了子应用,此时子应用开始加载并渲染,子应用在渲染时会匹配到`#/page1`并渲染`page1`页面。 micro-app配置如下: ```html @@ -202,11 +202,11 @@ micro-app配置如下: **栗子4 🌰 :** -基座应用是history路由,子应用也是history路由,我们要跳转基座应用的`my-app`页面,`my-app`页面中嵌入子应用,我们要展现子应用的`page1`页面。 +主应用是history路由,子应用也是history路由,我们要跳转主应用的`my-app`页面,`my-app`页面中嵌入子应用,我们要展现子应用的`page1`页面。 -那么浏览器地址应该为:`域名/my-page/page1`,我们在基座中跳转的参数为:`router.push('/my-page/page1')` +那么浏览器地址应该为:`域名/my-page/page1`,我们在主应用中跳转的参数为:`router.push('/my-page/page1')` -此时流程为:基座应用匹配到`/my-page`路径并渲染`my-app`页面,因为`my-app`页面中嵌入了子应用,此时子应用开始加载并渲染,子应用在渲染时会匹配到`/my-page/page1`并渲染`page1`页面。 +此时流程为:主应用匹配到`/my-page`路径并渲染`my-app`页面,因为`my-app`页面中嵌入了子应用,此时子应用开始加载并渲染,子应用在渲染时会匹配到`/my-page/page1`并渲染`page1`页面。 micro-app配置如下: @@ -217,4 +217,4 @@ micro-app配置如下: ``` > [!TIP] -> 如果你看到这里还是无法正确设置路由,那么将基座应用设置为history路由,子应用设置为hash路由,可以一劳永逸解决所有问题,此时不需要设置baseroute,也不需要修改基座和子应用的任何路由设置。 +> 如果你看到这里还是无法正确设置路由,那么将主应用设置为history路由,子应用设置为hash路由,可以一劳永逸解决所有问题,此时不需要设置baseroute,也不需要修改主应用和子应用的任何路由设置。 diff --git a/docs/1.x/zh-cn/changelog.md b/docs/1.x/zh-cn/changelog.md index 41d77dcb0..ecd806b4c 100644 --- a/docs/1.x/zh-cn/changelog.md +++ b/docs/1.x/zh-cn/changelog.md @@ -47,7 +47,7 @@ - **New** - - 🆕 重写了基座的`pushState`、`replaceState`方法,自动将子应用的路由信息同步到浏览器地址。 + - 🆕 重写了主应用的`pushState`、`replaceState`方法,自动将子应用的路由信息同步到浏览器地址。 - 🆕 重写了子应用的`Document`对象,每个子应用拥有单独的Document实例。 - **Bug Fix** @@ -67,7 +67,7 @@ - **New** - 🆕 新增了`attachToURL`、`attachAllToURL`方法,用于将子应用的路由信息同步到浏览器地址。 - - 🆕 新增了`setBaseRouter`、`getBaseRouter`方法,用于注册和使用基座路由。 + - 🆕 新增了`setBaseRouter`、`getBaseRouter`方法,用于注册和使用主应用路由。 - 🆕 新增了`ProxyDocument`,为子应用创建一个虚拟的document对象。 - **Bug Fix** @@ -175,11 +175,11 @@ - **Bug Fix** - - 🐞 修复了基座通过远程连接引入Vue,加载vue子应用报错的问题,issue [#234](https://github.com/micro-zoe/micro-app/issues/234)。 + - 🐞 修复了主应用通过远程连接引入Vue,加载vue子应用报错的问题,issue [#234](https://github.com/micro-zoe/micro-app/issues/234)。 - **Update** - - 🚀 优化了预加载相关代码和逻辑,减小对基座项目的影响。 + - 🚀 优化了预加载相关代码和逻辑,减小对主应用项目的影响。 ### 0.8.1 @@ -397,7 +397,7 @@ - **New** - 🆕 新增了ignore属性,用于忽略部分部分元素 - - 🆕 新增了全局变量 `__MICRO_APP_BASE_APPLICATION__` 用于标记当前应用为基座应用 + - 🆕 新增了全局变量 `__MICRO_APP_BASE_APPLICATION__` 用于标记当前应用为主应用 - **Bug Fix** @@ -463,7 +463,7 @@ - **Update** - 🚀 优化了修改name&url属性切换应用的操作,部分场景下被替换的应用可以计入缓存 - - 🚀 更新了全局数据通信卸载机制,基座应用和子应用只能卸载自身的全局监听函数 + - 🚀 更新了全局数据通信卸载机制,主应用和子应用只能卸载自身的全局监听函数 ### 0.2.5 @@ -472,7 +472,7 @@ - **New** - - 🆕 新增了`main-vue3-vite`基座应用案例 + - 🆕 新增了`main-vue3-vite`主应用案例 - **Bug Fix** diff --git a/docs/1.x/zh-cn/configure.md b/docs/1.x/zh-cn/configure.md index 68f92f022..44e74d546 100644 --- a/docs/1.x/zh-cn/configure.md +++ b/docs/1.x/zh-cn/configure.md @@ -98,7 +98,7 @@ keep-alive的优先级小于[destroy](/zh-cn/configure?id=destroy),当两者 - Default: `false` - 使用方式: `` -默认情况下,子应用将运行在虚拟路由系统中,和基座应用的路由系统进行隔离,避免相互影响。 +默认情况下,子应用将运行在虚拟路由系统中,和主应用的路由系统进行隔离,避免相互影响。 子应用的路由信息会作为query参数同步到浏览器地址上,如下: @@ -143,9 +143,9 @@ keep-alive的优先级小于[destroy](/zh-cn/configure?id=destroy),当两者 如:`fetch('/api/data')` 补全为 `fetch(子应用域名 + '/api/data')` -如果不需要这样的补全,可以配置`disable-patch-request`进行关闭,此时相对地址会兜底到基座域名。 +如果不需要这样的补全,可以配置`disable-patch-request`进行关闭,此时相对地址会兜底到主应用域名。 -如:`fetch('/api/data')` 兜底为 `fetch(基座域名 + '/api/data')` +如:`fetch('/api/data')` 兜底为 `fetch(主应用域名 + '/api/data')` ## baseroute - Desc: `子应用的基础路由` diff --git a/docs/1.x/zh-cn/data.md b/docs/1.x/zh-cn/data.md index fd5a5797d..42f5b1db4 100644 --- a/docs/1.x/zh-cn/data.md +++ b/docs/1.x/zh-cn/data.md @@ -1,32 +1,32 @@ -`micro-app`提供了一套灵活的数据通信机制,方便基座应用和子应用之间的数据传输。 +`micro-app`提供了一套灵活的数据通信机制,方便主应用和子应用之间的数据传输。 -正常情况下,基座应用和子应用之间的通信是绑定的,基座应用只能向指定的子应用发送数据,子应用只能向基座发送数据,这种方式可以有效的避免数据污染,防止多个子应用之间相互影响。 +正常情况下,主应用和子应用之间的通信是绑定的,主应用只能向指定的子应用发送数据,子应用只能向主应用发送数据,这种方式可以有效的避免数据污染,防止多个子应用之间相互影响。 同时我们也提供了全局通信,方便跨应用之间的数据通信。 -## 一、子应用获取来自基座应用的数据 -`micro-app`会向子应用注入名称为`microApp`的全局对象,子应用通过这个对象和基座应用进行数据交互。 +## 一、子应用获取来自主应用的数据 +`micro-app`会向子应用注入名称为`microApp`的全局对象,子应用通过这个对象和主应用进行数据交互。 -有两种方式获取来自基座应用的数据: +有两种方式获取来自主应用的数据: #### 方式1:直接获取数据 ```js -const data = window.microApp.getData() // 返回基座下发的data数据 +const data = window.microApp.getData() // 返回主应用下发的data数据 ``` #### 方式2:绑定监听函数 ```js function dataListener (data) { - console.log('来自基座应用的数据', data) + console.log('来自主应用的数据', data) } /** * 绑定监听函数,监听函数只有在数据变化时才会触发 * dataListener: 绑定函数 * autoTrigger: 在初次绑定监听函数时如果有缓存数据,是否需要主动触发一次,默认为false - * !!!重要说明: 因为子应用是异步渲染的,而基座发送数据是同步的, - * 如果在子应用渲染结束前基座应用发送数据,则在绑定监听函数前数据已经发送,在初始化后不会触发绑定函数, + * !!!重要说明: 因为子应用是异步渲染的,而主应用发送数据是同步的, + * 如果在子应用渲染结束前主应用发送数据,则在绑定监听函数前数据已经发送,在初始化后不会触发绑定函数, * 但这个数据会放入缓存中,此时可以设置autoTrigger为true主动触发一次监听函数来获取数据。 */ window.microApp.addDataListener(dataListener: Function, autoTrigger?: boolean) @@ -39,14 +39,14 @@ window.microApp.clearDataListener() ``` -## 二、子应用向基座应用发送数据 +## 二、子应用向主应用发送数据 ```js // dispatch只接受对象作为参数 window.microApp.dispatch({type: '子应用发送的数据'}) ``` -## 三、基座应用向子应用发送数据 -基座应用向子应用发送数据有两种方式: +## 三、主应用向子应用发送数据 +主应用向子应用发送数据有两种方式: #### 方式1: 通过data属性发送数据 @@ -104,8 +104,8 @@ import microApp from '@micro-zoe/micro-app' microApp.setData('my-app', {type: '新的数据'}) ``` -## 四、基座应用获取来自子应用的数据 -基座应用获取来自子应用的数据有三种方式: +## 四、主应用获取来自子应用的数据 +主应用获取来自子应用的数据有三种方式: #### 方式1:直接获取数据 ```js @@ -189,13 +189,13 @@ microApp.clearDataListener(appName: string) ## 全局数据通信 -全局数据通信会向基座应用和所有子应用发送数据,在跨应用通信的场景中适用。 +全局数据通信会向主应用和所有子应用发送数据,在跨应用通信的场景中适用。 #### 发送全局数据 -#### ** 基座应用 ** +#### ** 主应用 ** ```js import microApp from '@micro-zoe/micro-app' @@ -216,7 +216,7 @@ window.microApp.setGlobalData({type: '全局数据'}) -#### ** 基座应用 ** +#### ** 主应用 ** ```js import microApp from '@micro-zoe/micro-app' @@ -237,7 +237,7 @@ microApp.addGlobalDataListener(dataListener: Function, autoTrigger?: boolean) // 解绑监听函数 microApp.removeGlobalDataListener(dataListener: Function) -// 清空基座应用绑定的所有全局数据监听函数 +// 清空主应用绑定的所有全局数据监听函数 microApp.clearGlobalDataListener() ``` @@ -270,7 +270,7 @@ window.microApp.clearGlobalDataListener() ## 关闭沙箱后的通信方式 沙箱关闭后,子应用默认的通信功能失效,此时可以通过手动注册通信对象实现一致的功能。 -**注册方式:在基座应用中为子应用初始化通信对象** +**注册方式:在主应用中为子应用初始化通信对象** ```js import { EventCenterForMicroApp } from '@micro-zoe/micro-app' @@ -279,7 +279,7 @@ import { EventCenterForMicroApp } from '@micro-zoe/micro-app' window.eventCenterForAppxx = new EventCenterForMicroApp(appName) ``` -子应用就可以通过注册的`eventCenterForAppxx`对象进行通信,其api和`window.microApp`一致,*基座通信方式没有任何变化。* +子应用就可以通过注册的`eventCenterForAppxx`对象进行通信,其api和`window.microApp`一致,*主应用通信方式没有任何变化。* **子应用通信方式:** ```js @@ -287,7 +287,7 @@ window.eventCenterForAppxx = new EventCenterForMicroApp(appName) const data = window.eventCenterForAppxx.getData() // 返回data数据 function dataListener (data) { - console.log('来自基座应用的数据', data) + console.log('来自主应用的数据', data) } /** @@ -303,7 +303,7 @@ window.eventCenterForAppxx.removeDataListener(dataListener: Function) // 清空当前子应用的所有绑定函数(全局数据函数除外) window.eventCenterForAppxx.clearDataListener() -// 子应用向基座应用发送数据,只接受对象作为参数 +// 子应用向主应用发送数据,只接受对象作为参数 window.eventCenterForAppxx.dispatch({type: '子应用发送的数据'}) ``` @@ -314,4 +314,4 @@ window.eventCenterForAppxx.dispatch({type: '子应用发送的数据'}) > > 2、数据变化时会进行严格对比(===),相同的data对象不会触发更新。 > -> 3、在子应用卸载时,子应用中所有的数据绑定函数会自动解绑,基座应用中的数据解绑需要开发者手动处理。 +> 3、在子应用卸载时,子应用中所有的数据绑定函数会自动解绑,主应用中的数据解绑需要开发者手动处理。 diff --git a/docs/1.x/zh-cn/deploy.md b/docs/1.x/zh-cn/deploy.md index 0a19ebd41..55d9a0a5a 100644 --- a/docs/1.x/zh-cn/deploy.md +++ b/docs/1.x/zh-cn/deploy.md @@ -1,6 +1,6 @@ ## 前言 -我们强烈建议你保持开发环境和线上环境路径(*即webpack的publicPath*)的一致性,以避免在部署后出现问题,无论是基座应用还是子应用。 +我们强烈建议你保持开发环境和线上环境路径(*即webpack的publicPath*)的一致性,以避免在部署后出现问题,无论是主应用还是子应用。 比如一个应用,在部署时作为文件夹 `my-app` 放入服务器根目录,那么配置如下: @@ -73,8 +73,8 @@ root(服务器根目录) │   ├── vite // 子应用 vite │   ├── vue2 // 子应用 vue2 │   ├── vue3 // 子应用 vue3 -│   ├── nextjs11 // 子应用 nextjs11,为每个基座应用单独打包,端口号:5001~5009 -│   └── nuxtjs2 // 子应用 nuxtjs2,为每个基座应用单独打包,端口号:6001~6009 +│   ├── nextjs11 // 子应用 nextjs11,为每个主应用单独打包,端口号:5001~5009 +│   └── nuxtjs2 // 子应用 nuxtjs2,为每个主应用单独打包,端口号:6001~6009 │  ├── main-angular11 // 主应用 angular11 ├── main-react16 // 主应用 react16 diff --git a/docs/1.x/zh-cn/dom-scope.md b/docs/1.x/zh-cn/dom-scope.md index ee1711825..b7320e824 100644 --- a/docs/1.x/zh-cn/dom-scope.md +++ b/docs/1.x/zh-cn/dom-scope.md @@ -2,13 +2,13 @@ **举个栗子🌰 :** -基座应用和子应用都有一个元素`
                  `,此时子应用通过`document.querySelector('#root')`获取到的是自己内部的`#root`元素,而不是基座应用的。 +主应用和子应用都有一个元素`
                  `,此时子应用通过`document.querySelector('#root')`获取到的是自己内部的`#root`元素,而不是主应用的。 -**基座应用可以获取子应用的元素吗?** +**主应用可以获取子应用的元素吗?** 可以的! -这一点和ShadowDom不同,在微前端下基座拥有统筹全局的作用,所以我们没有对基座应用操作子应用元素的行为进行限制。 +这一点和ShadowDom不同,在微前端下主应用拥有统筹全局的作用,所以我们没有对主应用操作子应用元素的行为进行限制。 ### 解除元素绑定 默认情况下,当子应用操作元素时会绑定元素作用域,而解绑过程是异步的,这可能会导致操作元素异常,此时有两种方式可以解决这个问题。 @@ -16,10 +16,10 @@ **方式一:执行removeDomScope** -执行`removeDomScope`方法后,元素作用域会重置为基座应用。 +执行`removeDomScope`方法后,元素作用域会重置为主应用。 -#### ** 基座应用 ** +#### ** 主应用 ** ```js import { removeDomScope } from '@micro-zoe/micro-app' @@ -46,7 +46,7 @@ _window.document.getElementById('root') **方式二:使用setTimeout** -#### ** 基座应用 ** +#### ** 主应用 ** ```js // 等待解绑结束后操作元素 setTimeout(() => { diff --git a/docs/1.x/zh-cn/env.md b/docs/1.x/zh-cn/env.md index 2d0c4e9fc..bfe6dd290 100644 --- a/docs/1.x/zh-cn/env.md +++ b/docs/1.x/zh-cn/env.md @@ -29,7 +29,7 @@ if (window.__MICRO_APP_ENVIRONMENT__) { } ``` -**步骤2:** 在子应用的入口文件的`最顶部`引入`public-path.js` +**步骤2:** 在子应用的入口文件的**最顶部**引入`public-path.js` ```js import './public-path' ``` @@ -42,12 +42,12 @@ import './public-path' ### `__MICRO_APP_BASE_APPLICATION__` -**描述:判断应用是否是基座应用** +**描述:判断应用是否是主应用** 在执行`microApp.start()`后此值才会生效 ```js if (window.__MICRO_APP_BASE_APPLICATION__) { - console.log('我是基座应用') + console.log('我是主应用') } ``` diff --git a/docs/1.x/zh-cn/framework/angular.md b/docs/1.x/zh-cn/framework/angular.md index 72d363126..2f0112fd3 100644 --- a/docs/1.x/zh-cn/framework/angular.md +++ b/docs/1.x/zh-cn/framework/angular.md @@ -1,6 +1,6 @@ 本篇以`angular 11`作为案例介绍angular的接入方式,其它版本angular接入方式会在后续补充,如果你在使用时出现问题,请在github上提issue告知我们。 -## 作为基座应用 +## 作为主应用 #### 1、安装依赖 ```bash @@ -46,15 +46,15 @@ import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; ## 作为子应用 -#### 1、在基座应用中引入`zone.js` -如果基座应用非angular,那么基座应用需要引入`zone.js`才能正确加载angular子应用。 +#### 1、在主应用中引入`zone.js` +如果主应用非angular,那么主应用需要引入`zone.js`才能正确加载angular子应用。 步骤1、安装依赖 ``` npm i zone.js --save ``` -步骤2、在基座应用中引入zone.js +步骤2、在主应用中引入zone.js ```js import 'zone.js' ``` @@ -148,7 +148,7 @@ if (!window.__MICRO_APP_ENVIRONMENT__) { 如果子应用资源加载混乱导致渲染失败,可以尝试设置`jsonpFunction`来解决,因为相同的`jsonpFunction`名称会导致资源污染。 -这种情况常见于基座和子应用都是通过`create-react-app`等脚手架创建的react项目,vue项目中并不常见。 +这种情况常见于主应用和子应用都是通过`create-react-app`等脚手架创建的react项目,vue项目中并不常见。 **解决方式:修改子应用的webpack配置** @@ -193,7 +193,7 @@ if (window.__MICRO_APP_ENVIRONMENT__) { } ``` -**步骤2:** 在子应用入口文件的`最顶部`引入`public-path.ts` +**步骤2:** 在子应用入口文件的**最顶部**引入`public-path.ts` ```js // entry import './public-path' @@ -203,11 +203,11 @@ import './public-path' ## 常见问题 #### 1、通过micro-app数据通信修改angular组件数据后视图不更新 -**原因:**因为在angular区域外调用了内部的代码(基座和子应用属于不同的angular区域),angular无法知道状态发生了变化。 +**原因:**因为在angular区域外调用了内部的代码(主应用和子应用属于不同的angular区域),angular无法知道状态发生了变化。 **解决方式:**通过`ngZone.run()`触发更改检测,具体方式如下: ![angular-question3](../../../static/images/angular-1.png ':size=800') -#### 2、基座是react、nextjs应用,引入zone.js后导致micro-app元素生命周期异常 +#### 2、主应用是react、nextjs应用,引入zone.js后导致micro-app元素生命周期异常 目前无法解决,请暂停使用生命周期函数。 diff --git a/docs/1.x/zh-cn/framework/introduce.md b/docs/1.x/zh-cn/framework/introduce.md index f3aa45ea0..5f8592c63 100644 --- a/docs/1.x/zh-cn/framework/introduce.md +++ b/docs/1.x/zh-cn/framework/introduce.md @@ -1,6 +1,6 @@ 上面的文档中,我们从功能的角度介绍如何接入微前端,这导致整体的逻辑不连贯。 -在手把手系列中,*我们会侧重于前端框架本身*,详细介绍它们作为基座应用和子应用如何接入微前端。 +在手把手系列中,*我们会侧重于前端框架本身*,详细介绍它们作为主应用和子应用如何接入微前端。 我们列举比较流行的前端框架,指出各框架的注意事项,规避各种可能出现的问题。 @@ -13,6 +13,6 @@ - nuxtjs (version 2) > [!TIP] -> 以上框架可以任意组合,换句话说任何一个框架都可以作为基座嵌入其它类型的子应用,任何一个框架也可以作为子应用被其它框架嵌入,包括上面没有列举出的其它库,如 svelte、umi ... +> 以上框架可以任意组合,换句话说任何一个框架都可以作为主应用嵌入其它类型的子应用,任何一个框架也可以作为子应用被其它框架嵌入,包括上面没有列举出的其它库,如 svelte、umi ... > > 我们只列举了部分框架,如果有其它框架需求,请在github上提issue告知我们。 diff --git a/docs/1.x/zh-cn/framework/nextjs.md b/docs/1.x/zh-cn/framework/nextjs.md index 713122e6d..ff0e4083d 100644 --- a/docs/1.x/zh-cn/framework/nextjs.md +++ b/docs/1.x/zh-cn/framework/nextjs.md @@ -1,6 +1,6 @@ 本篇以`nextjs 11`作为案例介绍nextjs的接入方式,其它版本nextjs接入方式会在后续补充,如果你在使用时出现问题,请在github上提issue告知我们。 -## 作为基座应用 +## 作为主应用 #### 1、安装依赖 ```bash @@ -63,8 +63,8 @@ export default MyPage ## 作为子应用 -#### 1、在基座应用中添加ssr配置 -当子应用是ssr应用时,基座需要在micro-app元素上添加ssr属性,此时micro-app会根据ssr模式加载子应用。 +#### 1、在主应用中添加ssr配置 +当子应用是ssr应用时,主应用需要在micro-app元素上添加ssr属性,此时micro-app会根据ssr模式加载子应用。 ```html @@ -181,12 +181,12 @@ window.addEventListener('unmount', function () { #### 3、控制台报错`Cannot read properties of null (reading 'tagName')` -**原因:**当基座和子应用都是nextjs应用时,`next/head`组件冲突。 +**原因:**当主应用和子应用都是nextjs应用时,`next/head`组件冲突。 **解决方式:**去掉子应用中`next/head`组件。 #### 4、webpack.jsonpFunction冲突,导致加载子应用失败 -**原因:**当基座和子应用都是官方脚手架创建的项目,容易造成webpack.jsonpFunction冲突。 +**原因:**当主应用和子应用都是官方脚手架创建的项目,容易造成webpack.jsonpFunction冲突。 **解决方式:**修改子应用的webpack配置。 diff --git a/docs/1.x/zh-cn/framework/nuxtjs.md b/docs/1.x/zh-cn/framework/nuxtjs.md index 821ec75c9..825bcf014 100644 --- a/docs/1.x/zh-cn/framework/nuxtjs.md +++ b/docs/1.x/zh-cn/framework/nuxtjs.md @@ -1,6 +1,6 @@ 本篇以`nuxtjs 2`作为案例介绍nuxtjs的接入方式,其它版本nuxtjs接入方式会在后续补充,如果你在使用时出现问题,请在github上提issue告知我们。 -## 作为基座应用 +## 作为主应用 #### 1、安装依赖 ```bash @@ -59,8 +59,8 @@ export default { ## 作为子应用 -#### 1、在基座应用中添加ssr配置 -当子应用是ssr应用时,基座需要在micro-app元素上添加ssr属性,此时micro-app会根据ssr模式加载子应用。 +#### 1、在主应用中添加ssr配置 +当子应用是ssr应用时,主应用需要在micro-app元素上添加ssr属性,此时micro-app会根据ssr模式加载子应用。 ```html diff --git a/docs/1.x/zh-cn/framework/react.md b/docs/1.x/zh-cn/framework/react.md index 6b9926e25..264053e84 100644 --- a/docs/1.x/zh-cn/framework/react.md +++ b/docs/1.x/zh-cn/framework/react.md @@ -1,6 +1,6 @@ 本篇以`React 16、17`作为案例介绍react的接入方式,其它版本react的接入方式以此类推。我们默认开发者掌握了各版本react的开发技巧,如示例中useEffect,在不支持hooks的版本中转换为componentDidMount。 -## 作为基座应用 +## 作为主应用 #### 1、安装依赖 ```bash @@ -98,7 +98,7 @@ if (!window.__MICRO_APP_ENVIRONMENT__) { 如果子应用资源加载混乱导致渲染失败,可以尝试设置`jsonpFunction`来解决,因为相同的`jsonpFunction`名称会导致资源污染。 -这种情况常见于基座和子应用都是通过`create-react-app`等脚手架创建的项目。 +这种情况常见于主应用和子应用都是通过`create-react-app`等脚手架创建的项目。 **解决方式:修改子应用的webpack配置** @@ -143,7 +143,7 @@ if (window.__MICRO_APP_ENVIRONMENT__) { } ``` -**步骤2:** 在子应用入口文件的`最顶部`引入`public-path.js` +**步骤2:** 在子应用入口文件的**最顶部**引入`public-path.js` ```js // entry import './public-path' diff --git a/docs/1.x/zh-cn/framework/vite.md b/docs/1.x/zh-cn/framework/vite.md index f2596a31a..c71ae3d34 100644 --- a/docs/1.x/zh-cn/framework/vite.md +++ b/docs/1.x/zh-cn/framework/vite.md @@ -5,8 +5,8 @@ 本篇介绍了`vite 2`的接入方式,vite1暂不支持。 -## 作为基座应用 -vite作为基座应用时没有特殊之处,具体方式参考各框架接入文档。 +## 作为主应用 +vite作为主应用时没有特殊之处,具体方式参考各框架接入文档。 ## 作为子应用 @@ -79,7 +79,7 @@ createApp(App).mount('#my-vite-app') **3、路由** -推荐基座使用history路由,vite子应用使用hash路由,避免一些可能出现的问题。 +推荐主应用使用history路由,vite子应用使用hash路由,避免一些可能出现的问题。 子应用如果是vue3,在初始化时路由时,createWebHashHistory不要传入参数,如下: @@ -96,8 +96,8 @@ const router = createRouter({ 图片等静态资源需要使用绝对地址,可以使用 `new URL('../assets/logo.png', import.meta.url).href` 等方式获取资源的全链接地址。 -### 👇 基座应用的修改 -注意这里的基座应用是指嵌入了vite子应用的基座,它可以是任何框架,和上面`作为基座应用`一节无关。 +### 👇 主应用的修改 +注意这里的主应用是指嵌入了vite子应用的主应用,它可以是任何框架,和上面`作为主应用`一节无关。 **1、关闭沙箱并使用内联script模式** ```js @@ -140,7 +140,7 @@ microApp.start({ ### 👇 数据通信 沙箱关闭后,子应用默认的通信功能失效,此时可以通过手动注册通信对象实现一致的功能。 -**注册方式:在基座应用中为子应用初始化通信对象** +**注册方式:在主应用中为子应用初始化通信对象** ```js import { EventCenterForMicroApp } from '@micro-zoe/micro-app' @@ -149,7 +149,7 @@ import { EventCenterForMicroApp } from '@micro-zoe/micro-app' window.eventCenterForViteApp1 = new EventCenterForMicroApp(appName) ``` -vite子应用就可以通过注册的`eventCenterForViteApp1`对象进行通信,其api和`window.microApp`一致,*基座通信方式没有任何变化。* +vite子应用就可以通过注册的`eventCenterForViteApp1`对象进行通信,其api和`window.microApp`一致,*主应用通信方式没有任何变化。* **子应用通信方式:** ```js @@ -169,7 +169,7 @@ window.eventCenterForViteApp1.clearDataListener() // 主动获取数据 window.eventCenterForViteApp1.getData() -// 子应用向基座应用发送数据 +// 子应用向主应用发送数据 window.eventCenterForViteApp1.dispatch({type: '子应用发送的数据'}) ``` @@ -180,6 +180,6 @@ window.eventCenterForViteApp1.dispatch({type: '子应用发送的数据'}) ## 实战案例 -以上介绍了vite如何接入微前端,但在实际使用中会涉及更多功能,如数据通信、路由跳转、打包部署,为此我们提供了一套案例,用于展示vite作为基座嵌入(或作为子应用被嵌入) react、vue、angular、vite、nextjs、nuxtjs等框架,在案例中我们使用尽可能少的代码实现尽可能多的功能。 +以上介绍了vite如何接入微前端,但在实际使用中会涉及更多功能,如数据通信、路由跳转、打包部署,为此我们提供了一套案例,用于展示vite作为主应用嵌入(或作为子应用被嵌入) react、vue、angular、vite、nextjs、nuxtjs等框架,在案例中我们使用尽可能少的代码实现尽可能多的功能。 案例地址:https://github.com/micro-zoe/micro-app-demo diff --git a/docs/1.x/zh-cn/framework/vue.md b/docs/1.x/zh-cn/framework/vue.md index 9f716b241..06ff3fc26 100644 --- a/docs/1.x/zh-cn/framework/vue.md +++ b/docs/1.x/zh-cn/framework/vue.md @@ -1,6 +1,6 @@ 本篇以`Vue 2、3`作为案例介绍vue的接入方式。 -## 作为基座应用 +## 作为主应用 #### 1、安装依赖 ```bash @@ -167,7 +167,7 @@ if (!window.__MICRO_APP_ENVIRONMENT__) { 如果子应用资源加载混乱导致渲染失败,可以尝试设置`jsonpFunction`来解决,因为相同的`jsonpFunction`名称会导致资源污染。 -这种情况常见于基座和子应用都是通过`create-react-app`脚手架创建的react项目,vue项目中并不常见。 +这种情况常见于主应用和子应用都是通过`create-react-app`脚手架创建的react项目,vue项目中并不常见。 **解决方式:修改子应用的webpack配置** @@ -226,7 +226,7 @@ if (window.__MICRO_APP_ENVIRONMENT__) { } ``` -**步骤2:** 在子应用入口文件的`最顶部`引入`public-path.js` +**步骤2:** 在子应用入口文件的**最顶部**引入`public-path.js` ```js // entry import './public-path' @@ -234,7 +234,7 @@ import './public-path' ## 常见问题 -#### 1、基座应用中抛出警告,micro-app未定义 +#### 1、主应用中抛出警告,micro-app未定义 **报错信息:** - vue2: `[Vue warn]: Unknown custom element: ` @@ -242,7 +242,7 @@ import './public-path' **参考issue:**[vue-next@1414](https://github.com/vuejs/vue-next/issues/1414) -**解决方式:** 在基座应用中添加如下配置 +**解决方式:** 在主应用中添加如下配置 #### ** Vue2 ** diff --git a/docs/1.x/zh-cn/jump.md b/docs/1.x/zh-cn/jump.md index 147b3848c..a89adfcb8 100644 --- a/docs/1.x/zh-cn/jump.md +++ b/docs/1.x/zh-cn/jump.md @@ -1,7 +1,7 @@ -每个应用的路由实例都是不同的,应用的路由实例只能控制自身,无法影响其它应用,包括基座应用无法通过控制自身路由影响到子应用。 +每个应用的路由实例都是不同的,应用的路由实例只能控制自身,无法影响其它应用,包括主应用无法通过控制自身路由影响到子应用。 -> 常见的问题如:开发者想通过基座应用的侧边栏跳转,从而控制子应用的页面,这其实是做不到的,只有子应用的路由实例可以控制自身的页面。 +> 常见的问题如:开发者想通过主应用的侧边栏跳转,从而控制子应用的页面,这其实是做不到的,只有子应用的路由实例可以控制自身的页面。 **要实现应用之间的跳转有两种方式:** @@ -33,21 +33,21 @@ window.dispatchEvent(new PopStateEvent('popstate', { state: history.state })) ## 方式二、通过数据通信控制跳转 -*适用场景: 基座控制子应用跳转* +*适用场景: 主应用控制子应用跳转* **子应用中监听数据变化** ```js -// 监听基座下发的数据变化 +// 监听主应用下发的数据变化 window.microApp.addDataListener((data) => { - // 当基座下发跳转指令时进行跳转 + // 当主应用下发跳转指令时进行跳转 if (data.path) { router.push(data.path) } }) ``` -**基座下发跳转指令** +**主应用下发跳转指令** ```js import microApp from '@micro-zoe/micro-app' @@ -57,9 +57,9 @@ microApp.setData('子应用name', { path: '/new-path/' }) ## 方式三、传递路由实例方法 -*适用场景: 子应用控制基座跳转* +*适用场景: 子应用控制主应用跳转* -**基座下发pushState函数:** +**主应用下发pushState函数:** #### ** React ** @@ -77,7 +77,7 @@ export default () => { } useEffect(() => { - // 👇 基座向子应用下发一个名为pushState的方法 + // 👇 主应用向子应用下发一个名为pushState的方法 microApp.setData(子应用名称, { pushState }) }, []) @@ -119,7 +119,7 @@ export default { ``` -**子应用使用pushState控制基座跳转:** +**子应用使用pushState控制主应用跳转:** ```js window.microApp.getData().pushState(path) diff --git a/docs/1.x/zh-cn/keep-alive.md b/docs/1.x/zh-cn/keep-alive.md index 49ae27409..c9e0259fc 100644 --- a/docs/1.x/zh-cn/keep-alive.md +++ b/docs/1.x/zh-cn/keep-alive.md @@ -10,9 +10,9 @@ ## 生命周期 keep-alive模式与普通模式最大的不同是生命周期,因为它不会被真正的卸载,也就不会触发 `unmount` 事件。 -在基座和子应用中的生命周期如下: +生命周期如下: -### 基座应用 +### 主应用 #### 1. created ``标签初始化后,加载资源前触发。 diff --git a/docs/1.x/zh-cn/plugins.md b/docs/1.x/zh-cn/plugins.md index 0fa70d4d8..d4512aad6 100644 --- a/docs/1.x/zh-cn/plugins.md +++ b/docs/1.x/zh-cn/plugins.md @@ -13,7 +13,7 @@ microApp.start({ plugins: { // 全局插件,作用于所有子应用的js文件 global?: Array<{ - // 可选,强隔离的全局变量(默认情况下子应用无法找到的全局变量会兜底到基座应用中,scopeProperties可以禁止这种情况) + // 可选,强隔离的全局变量(默认情况下子应用无法找到的全局变量会兜底到主应用中,scopeProperties可以禁止这种情况) scopeProperties?: string[], // 可选,可以逃逸到外部的全局变量(escapeProperties中的变量会同时赋值到子应用和外部真实的window上) escapeProperties?: string[], @@ -33,7 +33,7 @@ microApp.start({ modules?: { // appName为应用的名称,这些插件只会作用于指定的应用 [appName: string]: Array<{ - // 可选,强隔离的全局变量(默认情况下子应用无法找到的全局变量会兜底到基座应用中,scopeProperties可以禁止这种情况) + // 可选,强隔离的全局变量(默认情况下子应用无法找到的全局变量会兜底到主应用中,scopeProperties可以禁止这种情况) scopeProperties?: string[], // 可选,可以逃逸到外部的全局变量(escapeProperties中的变量会同时赋值到子应用和外部真实的window上) escapeProperties?: string[], diff --git a/docs/1.x/zh-cn/prefetch.md b/docs/1.x/zh-cn/prefetch.md index 30ce0897c..f8d6d6d35 100644 --- a/docs/1.x/zh-cn/prefetch.md +++ b/docs/1.x/zh-cn/prefetch.md @@ -1,46 +1,82 @@ -预加载是指在应用尚未渲染时提前加载资源并缓存,从而提升首屏渲染速度。 +预加载是指在应用尚未渲染时提前加载`html、js、css`等资源并解析,从而提升子应用的渲染速度。 -预加载并不是同步执行的,它会在浏览器空闲时间,依照开发者传入的顺序,依次加载每个应用的静态资源,以确保不会影响基座应用的性能。 +预加载会在浏览器空闲时间,依次加载和解析每个子应用的静态资源,以确保不会影响主应用的性能。 -### microApp.preFetch(Array\ | Function => Array\) -preFetch接受app数组或一个返回app数组的函数,app的值如下: +### microApp.preFetch(Array\ | () => Array\) +preFetch接受一个数组或一个返回数组的函数,数组的配置如下: ```js -app: { +Array<{ name: string, // 应用名称,必传 url: string, // 应用地址,必传 - disableScopecss?: boolean // 是否关闭样式隔离,非必传 - disableSandbox?: boolean // 是否关闭沙盒,非必传 -} + esmodule: string, // 是否支持esmodule,vite应用必传,其它应用可选 + inline: string, // 是否使用内联模式运行js,可选 + 'disable-scopecss': boolean // 是否关闭样式隔离,可选 + 'disable-sandbox': boolean // 是否关闭沙盒,可选 +}> ``` ### 使用方式 ```js import microApp from '@micro-zoe/micro-app' -// 方式一 +// 方式一:设置数组 microApp.preFetch([ - { name: 'my-app', url: 'xxx' } + { name: 'my-app1', url: 'xxx' }, + { name: 'my-app2', url: 'xxx' }, ]) -// 方式二 +// 方式二:设置一个返回数组的函数 microApp.preFetch(() => [ - { name: 'my-app', url: 'xxx' } + { name: 'my-app1', url: 'xxx' }, + { name: 'my-app2', url: 'xxx' }, ]) -// 方式三 +// 方式三:在start中设置预加载数组 microApp.start({ preFetchApps: [ - { name: 'my-app', url: 'xxx' } + { name: 'my-app1', url: 'xxx' }, + { name: 'my-app2', url: 'xxx' }, + ], +}) + +// 方式四:在start中设置一个返回预加载数组的函数 +microApp.start({ + preFetchApps: () => [ + { name: 'my-app1', url: 'xxx' } + { name: 'my-app2', url: 'xxx' } ], - // 函数类型 - // preFetchApps: () => [ - // { name: 'my-app', url: 'xxx' } - // ], }) ``` -> [!NOTE] -> 1、预加载入参:`disableScopecss`、`disableSandbox` 必须和 ``[配置项](/zh-cn/configure)保持一致。如果产生冲突,以先执行的一方为准。 -> -> 2、如果子应用开启了shadowDOM,则预加载中的`disableScopecss`需要设置为true +### vite应用 +当子应用是vite时,除了name和url外,还要设置第三个参数`esmodule`为true。 + +例如: +```js +// 预加载vite子应用 +microApp.preFetch([ + { name: 'my-vite-app', url: 'xxx', esmodule: true }, +]) +``` + +### 补充说明1 +正常情况下,预加载只需要设置name和url,其它参数不需要设置。 + +但我们还是建议预加载的配置和``元素上的配置保持一致,虽然这不是必须的。 + +例如:``元素设置了`disable-scopecss`,那么预加载也最好保持一致 + +```html + +``` +```js +microApp.preFetch([ + { name: 'my-app', url: 'xxx', 'disable-scopecss': true }, +]) +``` + +### 补充说明2 + +预加载参数`inline、esmodule、disable-scopecss、disable-sandbox`都是可选的,它们只表示在预加载时该如何处理资源,不会对应用的实际渲染产生任何影响,应用的渲染行为最终由``元素决定。 + diff --git a/docs/1.x/zh-cn/questions.md b/docs/1.x/zh-cn/questions.md index b870cdc6a..db17ec35c 100644 --- a/docs/1.x/zh-cn/questions.md +++ b/docs/1.x/zh-cn/questions.md @@ -40,8 +40,8 @@ micro-app依赖于CustomElements和Proxy两个较新的API。 ## 4、micro-app 报错 an app named xx already exists 这是`name`名称冲突导致的,请确保每个子应用的`name`值是唯一的。 -## 5、基座应用的样式影响到子应用 -虽然我们将子应用的样式进行隔离,但基座应用的样式依然会影响到子应用,如果发生冲突,推荐通过约定前缀或CSS Modules方式解决。 +## 5、主应用的样式影响到子应用 +虽然我们将子应用的样式进行隔离,但主应用的样式依然会影响到子应用,如果发生冲突,推荐通过约定前缀或CSS Modules方式解决。 如果你使用的是`ant-design`等组件库,一般会提供添加前缀进行样式隔离的功能。 @@ -97,7 +97,7 @@ microApp.start({ ## 9、子应用通过a标签下载文件失败 - **原因:**当跨域时(基座和文件在不同域名下),无法通过a标签的download属性实现下载。 + **原因:**当跨域时(主应用和文件在不同域名下),无法通过a标签的download属性实现下载。 **解决方式:** @@ -127,5 +127,5 @@ microApp.start({ } ``` - **方式2:**将文件放到基座域名下,判断微前端环境下a标签href属性设置为基座的文件地址 + **方式2:**将文件放到主应用域名下,判断微前端环境下a标签href属性设置为主应用的文件地址 diff --git a/docs/1.x/zh-cn/router.md b/docs/1.x/zh-cn/router.md index 9ddda8d23..4eed6141f 100644 --- a/docs/1.x/zh-cn/router.md +++ b/docs/1.x/zh-cn/router.md @@ -1,4 +1,4 @@ -MicroApp通过自定义location和history,实现了一套虚拟路由系统,子应用运行在这套虚拟路由系统中,和基座应用的路由进行隔离,避免相互影响。 +MicroApp通过自定义location和history,实现了一套虚拟路由系统,子应用运行在这套虚拟路由系统中,和主应用的路由进行隔离,避免相互影响。 子应用的路由信息会作为query参数同步到浏览器地址上,如下: @@ -9,14 +9,14 @@ MicroApp通过自定义location和history,实现了一套虚拟路由系统, ## 导航 通过虚拟路由系统,我们可以方便的进行跨应用的跳转,如: -1. 基座控制子应用跳转 -2. 子应用控制基座跳转 +1. 主应用控制子应用跳转 +2. 子应用控制主应用跳转 3. 子应用控制其它子应用跳转 由于nextjs的路由系统非常特殊,当子应用是nextjs时无法直接控制跳转,参考[通过数据通信控制跳转](/zh-cn/jump?id=方式二、通过数据通信控制跳转) -#### ** 基座 ** +#### ** 主应用 ** ### router.push @@ -135,25 +135,25 @@ microApp.router.forward() #### ** 子应用 ** -子应用的路由API和基座保持一致,不同点是`microApp`挂载在window上。 +子应用的路由API和主应用保持一致,不同点是`microApp`挂载在window上。 -### 子应用控制基座跳转 -默认情况下,子应用无法直接控制基座的跳转,为此我们提供了一个API,将基座的路由对象传递给子应用。 +### 子应用控制主应用跳转 +默认情况下,子应用无法直接控制主应用的跳转,为此我们提供了一个API,将主应用的路由对象传递给子应用。 -**基座** +**主应用** ```js import microApp from '@micro-zoe/micro-app' -// 注册基座路由 -microApp.router.setBaseAppRouter(基座的路由对象) +// 注册主应用路由 +microApp.router.setBaseAppRouter(主应用的路由对象) ``` **子应用** ```js -// 获取基座路由 +// 获取主应用路由 const baseRouter = window.microApp.router.getBaseAppRouter() -// 控制基座跳转 -baseRouter.基座路由的方法(...) +// 控制主应用跳转 +baseRouter.主应用路由的方法(...) ``` ### 控制其他子应用跳转 @@ -270,7 +270,7 @@ window.microApp.router.forward() #### 全局前置守卫 **介绍:**监听所有或某个子应用的路由变化,在子应用页面渲染前执行。 -**使用范围:**基座应用 +**使用范围:**主应用 ```js /** * @param {object} to 即将要进入的路由 @@ -313,7 +313,7 @@ cancelCallback() #### 全局后置守卫 **介绍:**监听所有或某个子应用的路由变化,在子应用页面渲染后执行。 -**使用范围:**基座应用 +**使用范围:**主应用 ```js /** * @param {object} to 已经进入的路由 @@ -437,7 +437,7 @@ router.current.get(name) **示例:** -#### ** 基座 ** +#### ** 主应用 ** ```js import microApp from '@micro-zoe/micro-app' @@ -477,7 +477,7 @@ router.decode(path: string) **示例:** -#### ** 基座 ** +#### ** 主应用 ** ```js import microApp from '@micro-zoe/micro-app' @@ -501,11 +501,11 @@ const encodeResult = window.microApp.router.decode('%2Fpage1%2F') ## 同步路由信息 -在一些特殊情况下,基座的跳转会导致浏览器地址上子应用信息丢失,此时可以主动调用方法,将子应用的路由信息同步到浏览器地址上。 +在一些特殊情况下,主应用的跳转会导致浏览器地址上子应用信息丢失,此时可以主动调用方法,将子应用的路由信息同步到浏览器地址上。 **介绍:**主动将子应用的路由信息同步到浏览器地址上 -**使用范围:**基座应用 +**使用范围:**主应用 ```js /** * 将指定子应用的路由信息同步到浏览器地址上 diff --git a/docs/1.x/zh-cn/scopecss.md b/docs/1.x/zh-cn/scopecss.md index 497bed9d4..a32574244 100644 --- a/docs/1.x/zh-cn/scopecss.md +++ b/docs/1.x/zh-cn/scopecss.md @@ -13,7 +13,7 @@ micro-app[name=xxx] .test { } ``` -但基座应用的样式依然会对子应用产生影响,如果发生样式污染,推荐通过约定前缀或CSS Modules方式解决。 +但主应用的样式依然会对子应用产生影响,如果发生样式污染,推荐通过约定前缀或CSS Modules方式解决。 ## 二、禁用样式隔离 禁用样式隔离分四个层次: diff --git a/docs/1.x/zh-cn/start.md b/docs/1.x/zh-cn/start.md index 9c5e68713..a8b1002e0 100755 --- a/docs/1.x/zh-cn/start.md +++ b/docs/1.x/zh-cn/start.md @@ -1,6 +1,6 @@ -我们分别列出基座应用和子应用需要进行的修改,具体介绍`micro-app`的使用方式。 +我们分别列出主应用和子应用需要进行的修改,具体介绍`micro-app`的使用方式。 -### 基座应用 +### 主应用 1、安装依赖 ```bash diff --git a/docs/1.x/zh-cn/static-source.md b/docs/1.x/zh-cn/static-source.md index 10288e495..9fc1680d4 100644 --- a/docs/1.x/zh-cn/static-source.md +++ b/docs/1.x/zh-cn/static-source.md @@ -41,7 +41,7 @@ if (window.__MICRO_APP_ENVIRONMENT__) { } ``` -**步骤2:** 在子应用入口文件的`最顶部`引入`public-path.js` +**步骤2:** 在子应用入口文件的**最顶部**引入`public-path.js` ```js // entry import './public-path' diff --git a/docs/zh-cn/framework/angular.md b/docs/zh-cn/framework/angular.md index 928c613d4..e145e0aba 100644 --- a/docs/zh-cn/framework/angular.md +++ b/docs/zh-cn/framework/angular.md @@ -144,7 +144,7 @@ if (window.__MICRO_APP_ENVIRONMENT__) { } ``` -**步骤2:** 在子应用入口文件的`最顶部`引入`public-path.js` +**步骤2:** 在子应用入口文件的**最顶部**引入`public-path.js` ```js // entry import './public-path' diff --git a/docs/zh-cn/framework/react.md b/docs/zh-cn/framework/react.md index 692479d89..3129dc86f 100644 --- a/docs/zh-cn/framework/react.md +++ b/docs/zh-cn/framework/react.md @@ -102,7 +102,7 @@ if (window.__MICRO_APP_ENVIRONMENT__) { } ``` -**步骤2:** 在子应用入口文件的`最顶部`引入`public-path.js` +**步骤2:** 在子应用入口文件的**最顶部**引入`public-path.js` ```js // entry import './public-path' diff --git a/docs/zh-cn/framework/vue.md b/docs/zh-cn/framework/vue.md index c4d151158..173b53789 100644 --- a/docs/zh-cn/framework/vue.md +++ b/docs/zh-cn/framework/vue.md @@ -151,7 +151,7 @@ if (window.__MICRO_APP_ENVIRONMENT__) { } ``` -**步骤2:** 在子应用入口文件的`最顶部`引入`public-path.js` +**步骤2:** 在子应用入口文件的**最顶部**引入`public-path.js` ```js // entry import './public-path' diff --git a/docs/zh-cn/life-cycles.md b/docs/zh-cn/life-cycles.md index 2af120785..3ff85815f 100644 --- a/docs/zh-cn/life-cycles.md +++ b/docs/zh-cn/life-cycles.md @@ -63,19 +63,19 @@ vue中监听方式和普通事件一致。 export default { methods: { created () { - console.log('micro-app元素被创建'), + console.log('micro-app元素被创建') }, beforemount () { - console.log('即将被渲染'), + console.log('即将被渲染') }, mounted () { - console.log('已经渲染完成'), + console.log('已经渲染完成') }, unmount () { - console.log('已经卸载'), + console.log('已经卸载') }, error () { - console.log('渲染出错'), + console.log('渲染出错') } } } diff --git a/src/create_app.ts b/src/create_app.ts index cb0f9abe0..ac13bc183 100644 --- a/src/create_app.ts +++ b/src/create_app.ts @@ -1,8 +1,9 @@ import type { + Func, AppInterface, sourceType, SandBoxInterface, - Func, + MountParam, } from '@micro-app/types' import { HTMLLoader } from './source/loader/html' import { extractSourceDom } from './source/index' @@ -29,20 +30,13 @@ export const appInstanceMap = new Map() export interface CreateAppParam { name: string url: string - ssrUrl?: string scopecss: boolean useSandbox: boolean - useMemoryRouter: boolean inline?: boolean - baseroute?: string - keepRouteState?: boolean - hiddenRouter?: boolean, + esmodule?: boolean container?: HTMLElement | ShadowRoot - defaultPage?: string - disablePatchRequest?: boolean - fiber?: boolean + ssrUrl?: string isPrefetch?: boolean - esmodule?: boolean } export default class CreateApp implements AppInterface { @@ -53,72 +47,56 @@ export default class CreateApp implements AppInterface { private umdHookMount: Func | null = null private umdHookUnmount: Func | null = null private libraryName: string | null = null - umdMode = false - isPrefetch = false - prefetchResolve: (() => void) | null = null - name: string - url: string - ssrUrl: string - container: HTMLElement | ShadowRoot | null = null - inline: boolean - scopecss: boolean - useSandbox: boolean - useMemoryRouter: boolean - baseroute: string - keepRouteState: boolean - hiddenRouter: boolean - source: sourceType - sandBox: SandBoxInterface | null = null - defaultPage: string - disablePatchRequest: boolean - fiber: boolean - esmodule: boolean + public umdMode = false + public source: sourceType + public sandBox: SandBoxInterface | null = null + public name: string + public url: string + public container: HTMLElement | ShadowRoot | null + public scopecss: boolean + public useSandbox: boolean + public inline: boolean + public esmodule: boolean + public ssrUrl: string + public isPrefetch + public keepRouteState = false + public fiber = false + public useMemoryRouter = true constructor ({ name, url, - ssrUrl, container, - inline, scopecss, useSandbox, - useMemoryRouter, - baseroute, - keepRouteState, - hiddenRouter, - defaultPage, - disablePatchRequest, - fiber, - isPrefetch, + inline, esmodule, + ssrUrl, + isPrefetch, }: CreateAppParam) { this.name = name this.url = url this.useSandbox = useSandbox this.scopecss = this.useSandbox && scopecss - this.useMemoryRouter = this.useSandbox && useMemoryRouter - // optional during init base on prefetch 👇 - this.container = container ?? null - this.ssrUrl = ssrUrl ?? '' this.inline = inline ?? false - this.baseroute = baseroute ?? '' - this.keepRouteState = keepRouteState ?? false - this.hiddenRouter = hiddenRouter ?? false - this.defaultPage = defaultPage ?? '' - this.disablePatchRequest = disablePatchRequest ?? false - this.fiber = fiber ?? false this.esmodule = esmodule ?? false + // not exist when prefetch 👇 + this.container = container ?? null + this.ssrUrl = ssrUrl ?? '' + + // not exist when normal 👇 this.isPrefetch = isPrefetch ?? false + // init actions + appInstanceMap.set(this.name, this) this.source = { html: null, links: new Set(), scripts: new Set() } this.loadSourceCode() - this.useSandbox && (this.sandBox = new SandBox(name, url, this.useMemoryRouter)) - appInstanceMap.set(this.name, this) + this.useSandbox && (this.sandBox = new SandBox(name, url)) } // Load resources - loadSourceCode (): void { + public loadSourceCode (): void { this.state = appStates.LOADING HTMLLoader.getInstance().run(this, extractSourceDom) } @@ -126,16 +104,14 @@ export default class CreateApp implements AppInterface { /** * When resource is loaded, mount app if it is not prefetch or unmount */ - onLoad (html: HTMLElement): void { + public onLoad (html: HTMLElement): void { if (++this.loadSourceLevel === 2) { this.source.html = html + this.state = appStates.LOADED - if (this.isPrefetch) { - this.prefetchResolve?.() - this.prefetchResolve = null - } else if (appStates.UNMOUNT !== this.state) { - this.state = appStates.LOADED - this.mount() + if (!this.isPrefetch && appStates.UNMOUNT !== this.state) { + // @ts-ignore + getRootContainer(this.container!).mount(this) } } } @@ -144,12 +120,8 @@ export default class CreateApp implements AppInterface { * Error loading HTML * @param e Error */ - onLoadError (e: Error): void { + public onLoadError (e: Error): void { this.loadSourceLevel = -1 - if (this.prefetchResolve) { - this.prefetchResolve() - this.prefetchResolve = null - } if (appStates.UNMOUNT !== this.state) { this.onerror(e) @@ -165,26 +137,26 @@ export default class CreateApp implements AppInterface { * @param keepRouteState keep route state when unmount, default is false * @param disablePatchRequest prevent rewrite request method of child app */ - mount ( - container?: HTMLElement | ShadowRoot, - inline?: boolean, - baseroute?: string, - keepRouteState?: boolean, - defaultPage?: string, - hiddenRouter?: boolean, - disablePatchRequest?: boolean, - fiber?: boolean, - esmodule?: boolean - ): void { - this.inline = inline ?? this.inline - this.keepRouteState = keepRouteState ?? this.keepRouteState - this.container = this.container ?? container! - this.baseroute = baseroute ?? this.baseroute - this.defaultPage = defaultPage ?? this.defaultPage - this.hiddenRouter = hiddenRouter ?? this.hiddenRouter - this.disablePatchRequest = disablePatchRequest ?? this.disablePatchRequest - this.fiber = fiber ?? this.fiber - this.esmodule = esmodule ?? this.esmodule + public mount ({ + container, + inline, + esmodule, + useMemoryRouter, + baseroute, + keepRouteState, + defaultPage, + disablePatchRequest, + fiber, + // hiddenRouter, + }: MountParam): void { + this.container = container + this.inline = inline + this.esmodule = esmodule + this.keepRouteState = keepRouteState + this.fiber = fiber + // use in sandbox/effect + this.useMemoryRouter = useMemoryRouter + // this.hiddenRouter = hiddenRouter ?? this.hiddenRouter if (this.loadSourceLevel !== 2) { this.state = appStates.LOADING @@ -201,13 +173,13 @@ export default class CreateApp implements AppInterface { cloneContainer(this.source.html as Element, this.container as Element, !this.umdMode) - this.sandBox?.start( - this.umdMode, - this.baseroute, - this.useMemoryRouter, - this.defaultPage, - this.disablePatchRequest, - ) + this.sandBox?.start({ + umdMode: this.umdMode, + baseroute, + useMemoryRouter, + defaultPage, + disablePatchRequest, + }) let umdHookMountResult: any // result of mount function @@ -286,7 +258,7 @@ export default class CreateApp implements AppInterface { * @param destroy completely destroy, delete cache resources * @param unmountcb callback of unmount */ - unmount (destroy: boolean, unmountcb?: CallableFunction): void { + public unmount (destroy: boolean, unmountcb?: CallableFunction): void { if (this.state === appStates.LOAD_FAILED) { destroy = true } @@ -356,11 +328,11 @@ export default class CreateApp implements AppInterface { * 1. if destroy is true, clear route state * 2. umd mode and keep-alive will not clear EventSource */ - this.sandBox?.stop( - this.umdMode, - this.keepRouteState && !destroy, - !this.umdMode || destroy, - ) + this.sandBox?.stop({ + umdMode: this.umdMode, + keepRouteState: this.keepRouteState && !destroy, + clearEventSource: !this.umdMode || destroy, + }) if (!getActiveApps().length) { releasePatchSetAttribute() } @@ -379,7 +351,7 @@ export default class CreateApp implements AppInterface { } // actions for completely destroy - actionsForCompletelyDestroy (): void { + public actionsForCompletelyDestroy (): void { if (!this.useSandbox && this.umdMode) { delete window[this.libraryName as any] } @@ -387,7 +359,7 @@ export default class CreateApp implements AppInterface { } // hidden app when disconnectedCallback called with keep-alive - hiddenKeepAliveApp (): void { + public hiddenKeepAliveApp (): void { const oldContainer = this.container cloneContainer( @@ -418,7 +390,7 @@ export default class CreateApp implements AppInterface { } // show app when connectedCallback called with keep-alive - showKeepAliveApp (container: HTMLElement | ShadowRoot): void { + public showKeepAliveApp (container: HTMLElement | ShadowRoot): void { // dispatch beforeShow event to micro-app dispatchCustomEventToMicroApp('appstate-change', this.name, { appState: 'beforeshow', @@ -461,7 +433,7 @@ export default class CreateApp implements AppInterface { * app rendering error * @param e Error */ - onerror (e: Error): void { + public onerror (e: Error): void { dispatchLifecyclesEvent( this.container!, this.name, @@ -471,12 +443,12 @@ export default class CreateApp implements AppInterface { } // get app state - getAppState (): string { + public getAppState (): string { return this.state } // get keep-alive state - getKeepAliveState (): string | null { + public getKeepAliveState (): string | null { return this.keepAliveState } diff --git a/src/micro_app_element.ts b/src/micro_app_element.ts index ba74639db..a8304beb3 100644 --- a/src/micro_app_element.ts +++ b/src/micro_app_element.ts @@ -153,29 +153,44 @@ export function defineElement (tagName: string): void { if (appInstanceMap.has(this.appName)) { const app = appInstanceMap.get(this.appName)! const existAppUrl = app.ssrUrl || app.url - const activeAppUrl = this.ssrUrl || this.appUrl - // keep-alive don't care about ssrUrl - // Even if the keep-alive app is pushed into the background, it is still active and cannot be replaced. Otherwise, it is difficult for developers to troubleshoot in case of conflict and will leave developers at a loss + const targetAppUrl = this.ssrUrl || this.appUrl + /** + * NOTE: + * 1. keep-alive don't care about ssrUrl + * 2. Even if the keep-alive app is pushed into the background, it is still active and cannot be replaced. Otherwise, it is difficult for developers to troubleshoot in case of conflict and will leave developers at a loss + * 3. When scopecss, useSandbox of prefetch app different from target app, delete prefetch app and create new one + */ if ( app.getKeepAliveState() === keepAliveStates.KEEP_ALIVE_HIDDEN && app.url === this.appUrl ) { this.handleShowKeepAliveApp(app) } else if ( - existAppUrl === activeAppUrl && ( - app.isPrefetch || - app.getAppState() === appStates.UNMOUNT + existAppUrl === targetAppUrl && ( + app.getAppState() === appStates.UNMOUNT || + ( + app.isPrefetch && ( + app.scopecss === this.isScopecss() && + app.useSandbox === this.isSandbox() + ) + ) ) ) { this.handleAppMount(app) } else if (app.isPrefetch || app.getAppState() === appStates.UNMOUNT) { - /** - * url is different & old app is unmounted or prefetch, create new app to replace old one - */ - logWarn(`the ${app.isPrefetch ? 'prefetch' : 'unmounted'} app with url: ${existAppUrl} is replaced by a new app`, this.appName) + if ( + process.env.NODE_ENV !== 'production' && + app.scopecss === this.isScopecss() && + app.useSandbox === this.isSandbox() + ) { + /** + * url is different & old app is unmounted or prefetch, create new app to replace old one + */ + logWarn(`the ${app.isPrefetch ? 'prefetch' : 'unmounted'} app with url: ${existAppUrl} replaced by a new app with url: ${targetAppUrl}`, this.appName) + } this.handleCreateApp() } else { - logError(`app name conflict, an app named ${this.appName} is running`, this.appName) + logError(`app name conflict, an app named: ${this.appName} with url: ${existAppUrl} is running`, this.appName) } } else { this.handleCreateApp() @@ -295,17 +310,25 @@ export function defineElement (tagName: string): void { */ private handleAppMount (app: AppInterface): void { app.isPrefetch = false - defer(() => app.mount( - this.shadowRoot ?? this, - this.getDisposeResult('inline'), - this.getBaseRouteCompatible(), - this.getDisposeResult('keep-router-state'), - this.getDefaultPageValue(), - this.getDisposeResult('hidden-router'), - this.getDisposeResult('disable-patch-request'), - this.getDisposeResult('fiber'), - this.getDisposeResult('esmodule'), - )) + defer(() => this.mount(app)) + } + + /** + * public mount action for micro_app_element & create_app + */ + public mount (app: AppInterface) { + app.mount({ + container: this.shadowRoot ?? this, + inline: this.getDisposeResult('inline'), + esmodule: this.getDisposeResult('esmodule'), + useMemoryRouter: !this.getDisposeResult('disable-memory-router'), + baseroute: this.getBaseRouteCompatible(), + keepRouteState: this.getDisposeResult('keep-router-state'), + defaultPage: this.getDefaultPageValue(), + hiddenRouter: this.getDisposeResult('hidden-router'), + disablePatchRequest: this.getDisposeResult('disable-patch-request'), + fiber: this.getDisposeResult('fiber'), + }) } // create app instance @@ -321,19 +344,12 @@ export function defineElement (tagName: string): void { new CreateApp({ name: this.appName, url: this.appUrl, - ssrUrl: this.ssrUrl, - container: this.shadowRoot ?? this, + scopecss: this.isScopecss(), + useSandbox: this.isSandbox(), inline: this.getDisposeResult('inline'), - scopecss: !(this.getDisposeResult('disable-scopecss') || this.getDisposeResult('shadowDOM')), - useSandbox: !this.getDisposeResult('disable-sandbox'), - useMemoryRouter: !this.getDisposeResult('disable-memory-router'), - baseroute: this.getBaseRouteCompatible(), - keepRouteState: this.getDisposeResult('keep-router-state'), - defaultPage: this.getDefaultPageValue(), - hiddenRouter: this.getDisposeResult('hidden-router'), - disablePatchRequest: this.getDisposeResult('disable-patch-request'), - fiber: this.getDisposeResult('fiber'), esmodule: this.getDisposeResult('esmodule'), + container: this.shadowRoot ?? this, + ssrUrl: this.ssrUrl, }) } @@ -400,6 +416,14 @@ export function defineElement (tagName: string): void { return this.getAttribute(name) !== 'false' } + private isScopecss (): boolean { + return !(this.getDisposeResult('disable-scopecss') || this.getDisposeResult('shadowDOM')) + } + + private isSandbox (): boolean { + return !this.getDisposeResult('disable-sandbox') + } + /** * 2021-09-08 * get baseRoute diff --git a/src/prefetch.ts b/src/prefetch.ts index d8f205385..439c4156f 100644 --- a/src/prefetch.ts +++ b/src/prefetch.ts @@ -54,37 +54,27 @@ function preFetchInSerial (options: prefetchParam): Promise { options.name = formatAppName(options.name) options.url = formatAppURL(options.url, options.name) if (options.name && options.url && !appInstanceMap.has(options.name)) { - /** - * 思考: 如果预加载参数独立 - * 1、html自带的style在预加载时进行样式隔离,micro-app元素设置关闭,如何处理这个style,正则匹配? - * 这里还涉及到body和micro-app-body的转换问题 - * - * 2、js沙箱也有同样的问题 - * - * - * 有一种解决方案:当子应用渲染时判断当前配置和预加载的配置是否一致,如果不一致,则destroy应用重新渲染,这样会重新请求html,从头解析和执行,而预加载的缓存是可以复用的 - * - * 文档提示: - * 1、预加载的配置建议和元素上的配置保持一致,且后者拥有更高的优先级,当两者产生冲突时,以元素上的配置为准 - * 稍等:预加载参数和全局参数哪一个优先级高?? - * 全局配置更高!! - * -- 预加载只是加载和处理资源,它的参数只是表示该怎么处理预加载的资源,它不应该对应用产生任何影响,只是做了一层缓存 - * 提示各种案例 - * - * 补充1: vite应用必须在预加载时设置esmodule配置,否则报错 Cannot use import statement outside a module - */ const app = new CreateApp({ name: options.name, url: options.url, scopecss: !(options['disable-scopecss'] ?? options.disableScopecss ?? microApp['disable-scopecss']), useSandbox: !(options['disable-sandbox'] ?? options.disableSandbox ?? microApp['disable-sandbox']), - useMemoryRouter: !(options['disable-memory-router'] ?? microApp['disable-memory-router']), - isPrefetch: true, inline: options.inline ?? microApp.inline, esmodule: options.esmodule ?? microApp.esmodule, + isPrefetch: true, }) - app.prefetchResolve = resolve + const oldOnload = app.onLoad + const oldOnLoadError = app.onLoadError + app.onLoad = (html: HTMLElement): void => { + resolve() + oldOnload.call(app, html) + } + + app.onLoadError = (e: Error): void => { + resolve() + oldOnLoadError.call(app, e) + } } else { resolve() } diff --git a/src/sandbox/index.ts b/src/sandbox/index.ts index 9c7b643ac..80c41ff39 100644 --- a/src/sandbox/index.ts +++ b/src/sandbox/index.ts @@ -5,6 +5,8 @@ import type { plugins, MicroLocation, SandBoxAdapter, + SandBoxStartParams, + SandBoxStopParams, } from '@micro-app/types' import { EventCenterForMicroApp, @@ -18,6 +20,7 @@ import { isArray, isPlainObject, isString, + isUndefined, removeDomScope, unique, throttleDeferForSetAppName, @@ -106,7 +109,7 @@ export default class SandBox implements SandBoxInterface { public proxyWindow: proxyWindow // Proxy public microAppWindow = {} as MicroAppWindowType // Proxy target - constructor (appName: string, url: string, useMemoryRouter = true) { + constructor (appName: string, url: string) { this.adapter = new Adapter() // get scopeProperties and escapeProperties from plugins this.getSpecialProperties(appName) @@ -115,27 +118,41 @@ export default class SandBox implements SandBoxInterface { // Rewrite global event listener & timeout assign(this, effect(appName, this.microAppWindow)) // inject global properties - this.initStaticGlobalKeys(this.microAppWindow, appName, url, useMemoryRouter) + this.initStaticGlobalKeys(this.microAppWindow, appName, url) } - // TODO: 重构 - public start ( - umdMode = false, - baseRoute = '', - useMemoryRouter = true, - defaultPage = '', - disablePatchRequest = false, - ): void { + /** + * open sandbox and perform some initial actions + * @param umdMode is umd mode + * @param baseroute base route for child + * @param useMemoryRouter use virtual router + * @param defaultPage default page when mount child base on virtual router + * @param disablePatchRequest prevent patchRequestApi + */ + public start ({ + umdMode, + baseroute, + useMemoryRouter, + defaultPage, + disablePatchRequest, + }: SandBoxStartParams): void { if (!this.active) { this.active = true if (useMemoryRouter) { + if (isUndefined(this.microAppWindow.location)) { + this.setMicroAppRouter( + this.microAppWindow, + this.microAppWindow.__MICRO_APP_NAME__, + this.microAppWindow.__MICRO_APP_URL__, + ) + } this.initRouteState(defaultPage) // unique listener of popstate event for sub app this.removeHistoryListener = addHistoryListener( - this.proxyWindow.__MICRO_APP_NAME__, + this.microAppWindow.__MICRO_APP_NAME__, ) } else { - this.microAppWindow.__MICRO_APP_BASE_ROUTE__ = this.microAppWindow.__MICRO_APP_BASE_URL__ = baseRoute + this.microAppWindow.__MICRO_APP_BASE_ROUTE__ = this.microAppWindow.__MICRO_APP_BASE_URL__ = baseroute } /** @@ -145,8 +162,8 @@ export default class SandBox implements SandBoxInterface { if (!umdMode) { this.initGlobalKeysWhenStart( this.microAppWindow, - this.proxyWindow.__MICRO_APP_NAME__, - this.proxyWindow.__MICRO_APP_URL__, + this.microAppWindow.__MICRO_APP_NAME__, + this.microAppWindow.__MICRO_APP_URL__, disablePatchRequest, ) } @@ -162,11 +179,17 @@ export default class SandBox implements SandBoxInterface { } } - public stop ( - umdMode: boolean, - keepRouteState: boolean, - clearEventSource: boolean, - ): void { + /** + * close sandbox and perform some clean up actions + * @param umdMode is umd mode + * @param keepRouteState prevent reset route + * @param clearEventSource clear MicroEventSource when destroy + */ + public stop ({ + umdMode, + keepRouteState, + clearEventSource, + }: SandBoxStopParams): void { if (this.active) { this.releaseEffect() this.microAppWindow.microApp.clearDataListener() @@ -179,7 +202,7 @@ export default class SandBox implements SandBoxInterface { } if (clearEventSource) { - clearMicroEventSource(this.proxyWindow.__MICRO_APP_NAME__) + clearMicroEventSource(this.microAppWindow.__MICRO_APP_NAME__) } /** @@ -376,7 +399,6 @@ export default class SandBox implements SandBoxInterface { microAppWindow: microAppWindowType, appName: string, url: string, - useMemoryRouter: boolean, ): void { microAppWindow.__MICRO_APP_ENVIRONMENT__ = true microAppWindow.__MICRO_APP_NAME__ = appName @@ -392,7 +414,6 @@ export default class SandBox implements SandBoxInterface { }) this.setProxyDocument(microAppWindow, appName) this.setMappingPropertiesWithRawDescriptor(microAppWindow) - if (useMemoryRouter) this.setMicroAppRouter(microAppWindow, appName, url) } private setProxyDocument (microAppWindow: microAppWindowType, appName: string): void { diff --git a/src/source/scripts.ts b/src/source/scripts.ts index 9a7b1ab61..1eba312d0 100644 --- a/src/source/scripts.ts +++ b/src/source/scripts.ts @@ -123,7 +123,8 @@ function setConvertScriptAttr (convertScript: HTMLScriptElement, attrs: AttrsTyp }) } -function isSandBoxEnv (app: AppInterface, scriptInfo: ScriptSourceInfo): boolean { +// wrap code in sandbox +function isWrapInSandBox (app: AppInterface, scriptInfo: ScriptSourceInfo): boolean { return app.useSandbox && !isTypeModule(app, scriptInfo) } @@ -370,7 +371,7 @@ export function fetchScriptSuccess ( */ if (!appSpaceData.parsedCode) { appSpaceData.parsedCode = bindScope(address, app, code, scriptInfo) - appSpaceData.useSandbox = app.useSandbox + appSpaceData.wrapInSandBox = isWrapInSandBox(app, scriptInfo) if (!isInlineMode(app, scriptInfo)) { try { appSpaceData.parsedFunction = getParsedFunction(app, scriptInfo, appSpaceData.parsedCode) @@ -495,15 +496,16 @@ export function runScript ( try { actionsBeforeRunScript(app) const appSpaceData = scriptInfo.appSpace[app.name] + const wrapInSandBox = isWrapInSandBox(app, scriptInfo) /** * NOTE: * 1. plugins and wrapCode will only be executed once * 2. if parsedCode not exist, parsedFunction is not exist * 3. if parsedCode exist, parsedFunction does not necessarily exist */ - if (!appSpaceData.parsedCode || appSpaceData.useSandbox !== app.useSandbox) { + if (!appSpaceData.parsedCode || appSpaceData.wrapInSandBox !== wrapInSandBox) { appSpaceData.parsedCode = bindScope(address, app, scriptInfo.code, scriptInfo) - appSpaceData.useSandbox = app.useSandbox + appSpaceData.wrapInSandBox = wrapInSandBox appSpaceData.parsedFunction = null } @@ -649,7 +651,7 @@ function bindScope ( code = usePlugins(address, code, app.name, microApp.plugins) } - if (isSandBoxEnv(app, scriptInfo)) { + if (isWrapInSandBox(app, scriptInfo)) { return `;(function(proxyWindow){with(proxyWindow.__MICRO_APP_WINDOW__){(function(${globalKeyToBeCached}){;${code}\n${isInlineScript(address) ? '' : `//# sourceURL=${address}\n`}}).call(proxyWindow,${globalKeyToBeCached})}})(window.__MICRO_APP_PROXY_WINDOW__);` } @@ -663,6 +665,9 @@ function actionsBeforeRunScript (app: AppInterface): void { setActiveProxyWindow(app) } +/** + * set active sandBox.proxyWindow to window.__MICRO_APP_PROXY_WINDOW__ + */ function setActiveProxyWindow (app: AppInterface): void { if (app.sandBox) { globalEnv.rawWindow.__MICRO_APP_PROXY_WINDOW__ = app.sandBox.proxyWindow diff --git a/typings/global.d.ts b/typings/global.d.ts index ab816e781..98f547ad3 100644 --- a/typings/global.d.ts +++ b/typings/global.d.ts @@ -15,21 +15,25 @@ declare module '@micro-app/types' { type fiberTasks = Array<() => Promise> | null + interface SandBoxStartParams { + umdMode: boolean + baseroute: string + useMemoryRouter: boolean + defaultPage: string + disablePatchRequest: boolean + } + + interface SandBoxStopParams { + umdMode: boolean + keepRouteState: boolean + clearEventSource: boolean + } + interface SandBoxInterface { proxyWindow: WindowProxy microAppWindow: Window // Proxy target - start ( - umdMode: boolean, - baseRoute: string, - useMemoryRouter: boolean, - defaultPage: string, - disablePatchRequest: boolean, - ): void - stop ( - umdMode: boolean, - keepRouteState: boolean, - clearEventSource: boolean, - ): void + start (startParams: SandBoxStartParams): void + stop (stopParams: SandBoxStopParams): void // record umd snapshot before the first execution of umdHookMount recordUmdSnapshot (): void // rebuild umd snapshot before remount umd app @@ -74,7 +78,7 @@ declare module '@micro-app/types' { attrs: Map, // element attributes parsedCode?: string, // bind code parsedFunction?: Function | null, // code to function - useSandbox?: boolean // use sandbox + wrapInSandBox?: boolean // use sandbox }> } @@ -84,27 +88,39 @@ declare module '@micro-app/types' { scripts: Set, // script address list } + interface MountParam { + container: HTMLElement | ShadowRoot + inline: boolean + useMemoryRouter: boolean + baseroute: string + keepRouteState: boolean + defaultPage: string + hiddenRouter: boolean + disablePatchRequest: boolean + fiber: boolean + esmodule: boolean + } + // app instance interface AppInterface { - isPrefetch: boolean // whether prefetch app, default is false - prefetchResolve: (() => void) | null // prefetch callback + source: sourceType // source list + sandBox: SandBoxInterface | null // sandbox name: string // app name url: string // app url - ssrUrl: string // html path in ssr mode - container: HTMLElement | ShadowRoot | null // container maybe null, micro-app, shadowRoot, DIV(keep-alive) - inline: boolean // whether js runs in inline script mode, default is false scopecss: boolean // whether use css scoped, default is true useSandbox: boolean // whether use js sandbox, default is true - useMemoryRouter: boolean // whether use memoryRouter, default is true - baseroute: string // route prefix, default is '' + inline: boolean // whether js runs in inline script mode, default is false + esmodule: boolean // support esmodule in script + ssrUrl: string // html path in ssr mode + isPrefetch: boolean // whether prefetch app, default is false + container: HTMLElement | ShadowRoot | null // container maybe null, micro-app, shadowRoot, div(keep-alive) keepRouteState: boolean // keep route state when unmount, default is false - hiddenRouter: boolean // hide router info of child from browser url - sandBox: SandBoxInterface | null // sandbox umdMode: boolean // is umd mode - defaultPage: string // default page when mount - source: sourceType // source list fiber: boolean // fiber mode - esmodule: boolean + useMemoryRouter: boolean // use virtual router + // defaultPage: string // default page when mount + // baseroute: string // route prefix, default is '' + // hiddenRouter: boolean // hide router info of child from browser url // Load resources loadSourceCode (): void @@ -116,17 +132,7 @@ declare module '@micro-app/types' { onLoadError (e: Error): void // mount app - mount ( - container?: HTMLElement | ShadowRoot, - inline?: boolean, - baseroute?: string, - keepRouteState?: boolean, - defaultPage?: string, - hiddenRouter?: boolean, - disablePatchRequest?: boolean, - fiber?: boolean, - esmodule?: boolean - ): void + mount (mountParams: MountParam): void // unmount app unmount (destroy: boolean, unmountcb?: CallableFunction): void @@ -172,7 +178,6 @@ declare module '@micro-app/types' { // old config 👆 'disable-scopecss'?: boolean 'disable-sandbox'?: boolean - 'disable-memory-router'?: boolean inline?: boolean esmodule?: boolean } @@ -341,7 +346,7 @@ declare module '@micro-app/types' { [appName: string]: (to: GuardLocation, from: GuardLocation) => void } - type GlobalNormalGuard = ((appName: string, to: GuardLocation, from: GuardLocation) => void) + type GlobalNormalGuard = ((to: GuardLocation, from: GuardLocation, appName: string) => void) type RouterGuard = AccurateGuard | GlobalNormalGuard From 750813770b5fe73d583f76957595816518f887fc Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Thu, 18 Aug 2022 20:11:45 +0800 Subject: [PATCH 085/268] docs: update docs --- docs/1.x/zh-cn/life-cycles.md | 10 +++++----- docs/1.x/zh-cn/prefetch.md | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/1.x/zh-cn/life-cycles.md b/docs/1.x/zh-cn/life-cycles.md index 2af120785..3ff85815f 100644 --- a/docs/1.x/zh-cn/life-cycles.md +++ b/docs/1.x/zh-cn/life-cycles.md @@ -63,19 +63,19 @@ vue中监听方式和普通事件一致。 export default { methods: { created () { - console.log('micro-app元素被创建'), + console.log('micro-app元素被创建') }, beforemount () { - console.log('即将被渲染'), + console.log('即将被渲染') }, mounted () { - console.log('已经渲染完成'), + console.log('已经渲染完成') }, unmount () { - console.log('已经卸载'), + console.log('已经卸载') }, error () { - console.log('渲染出错'), + console.log('渲染出错') } } } diff --git a/docs/1.x/zh-cn/prefetch.md b/docs/1.x/zh-cn/prefetch.md index f8d6d6d35..39d83e6a0 100644 --- a/docs/1.x/zh-cn/prefetch.md +++ b/docs/1.x/zh-cn/prefetch.md @@ -9,8 +9,8 @@ preFetch接受一个数组或一个返回数组的函数,数组的配置如下 Array<{ name: string, // 应用名称,必传 url: string, // 应用地址,必传 - esmodule: string, // 是否支持esmodule,vite应用必传,其它应用可选 - inline: string, // 是否使用内联模式运行js,可选 + esmodule: boolean, // 是否支持esmodule,vite应用必传,其它应用可选 + inline: boolean, // 是否使用内联模式运行js,可选 'disable-scopecss': boolean // 是否关闭样式隔离,可选 'disable-sandbox': boolean // 是否关闭沙盒,可选 }> From f597687cfe961bde4cb85e91ff19e039e0c07375 Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Thu, 18 Aug 2022 20:17:41 +0800 Subject: [PATCH 086/268] docs: update docs --- docs/1.x/zh-cn/prefetch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/1.x/zh-cn/prefetch.md b/docs/1.x/zh-cn/prefetch.md index 39d83e6a0..8c7ca244f 100644 --- a/docs/1.x/zh-cn/prefetch.md +++ b/docs/1.x/zh-cn/prefetch.md @@ -65,7 +65,7 @@ microApp.preFetch([ 但我们还是建议预加载的配置和``元素上的配置保持一致,虽然这不是必须的。 -例如:``元素设置了`disable-scopecss`,那么预加载也最好保持一致 +例如:``元素设置了`disable-scopecss`关闭样式隔离,那么预加载也最好保持一致 ```html From 46285e93fa0c179b9c6000000cd9dc91a2ab86ff Mon Sep 17 00:00:00 2001 From: bailicangdu <1264889788@qq.com> Date: Fri, 19 Aug 2022 14:14:13 +0800 Subject: [PATCH 087/268] fix: fix bug of document.currentScript --- dev/children/react16/package.json | 1 + dev/children/react16/public/index.html | 1 - dev/children/react16/src/index.js | 10 ++-- dev/children/react16/src/pages/page1/page1.js | 24 ++++++++- dev/children/react16/yarn.lock | 5 ++ dev/main-react16/src/global.jsx | 2 +- src/libs/utils.ts | 17 ++++++ src/micro_app_element.ts | 10 ++-- src/sandbox/adapter.ts | 11 ++-- src/source/index.ts | 11 +--- src/source/links.ts | 24 +++------ src/source/scripts.ts | 54 +++++++------------ 12 files changed, 92 insertions(+), 78 deletions(-) diff --git a/dev/children/react16/package.json b/dev/children/react16/package.json index 75e87c358..9fa23af27 100644 --- a/dev/children/react16/package.json +++ b/dev/children/react16/package.json @@ -116,6 +116,7 @@ "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-testing-library": "^3.9.2", "eslint-webpack-plugin": "^2.1.0", + "esri-loader": "^3.6.0", "file-loader": "6.1.1", "fs-extra": "^9.0.1", "html-webpack-plugin": "4.5.0", diff --git a/dev/children/react16/public/index.html b/dev/children/react16/public/index.html index 7b17e1254..7a7b6cb5d 100644 --- a/dev/children/react16/public/index.html +++ b/dev/children/react16/public/index.html @@ -35,7 +35,6 @@ - ', + X = { + disc: { + elmId: "leader-line-disc", + noRotate: !0, + bBox: { + left: -5, + top: -5, + width: 10, + height: 10, + right: 5, + bottom: 5 + }, + widthR: 2.5, + heightR: 2.5, + bCircle: 5, + sideLen: 5, + backLen: 5, + overhead: 0, + outlineBase: 1, + outlineMax: 4 + }, + square: { + elmId: "leader-line-square", + noRotate: !0, + bBox: { + left: -5, + top: -5, + width: 10, + height: 10, + right: 5, + bottom: 5 + }, + widthR: 2.5, + heightR: 2.5, + bCircle: 5, + sideLen: 5, + backLen: 5, + overhead: 0, + outlineBase: 1, + outlineMax: 4 + }, + arrow1: { + elmId: "leader-line-arrow1", + bBox: { + left: -8, + top: -8, + width: 16, + height: 16, + right: 8, + bottom: 8 + }, + widthR: 4, + heightR: 4, + bCircle: 8, + sideLen: 8, + backLen: 8, + overhead: 8, + outlineBase: 2, + outlineMax: 1.5 + }, + arrow2: { + elmId: "leader-line-arrow2", + bBox: { + left: -7, + top: -8, + width: 11, + height: 16, + right: 4, + bottom: 8 + }, + widthR: 2.75, + heightR: 4, + bCircle: 8, + sideLen: 8, + backLen: 7, + overhead: 4, + outlineBase: 1, + outlineMax: 1.75 + }, + arrow3: { + elmId: "leader-line-arrow3", + bBox: { + left: -4, + top: -5, + width: 12, + height: 10, + right: 8, + bottom: 5 + }, + widthR: 3, + heightR: 2.5, + bCircle: 8, + sideLen: 5, + backLen: 4, + overhead: 8, + outlineBase: 1, + outlineMax: 2.5 + }, + hand: { + elmId: "leader-line-hand", + bBox: { + left: -3, + top: -12, + width: 40, + height: 24, + right: 37, + bottom: 12 + }, + widthR: 10, + heightR: 6, + bCircle: 37, + sideLen: 12, + backLen: 3, + overhead: 37 + }, + crosshair: { + elmId: "leader-line-crosshair", + noRotate: !0, + bBox: { + left: -96, + top: -96, + width: 192, + height: 192, + right: 96, + bottom: 96 + }, + widthR: 48, + heightR: 48, + bCircle: 96, + sideLen: 96, + backLen: 96, + overhead: 0 + } + }, + F = { + behind: Y, + disc: "disc", + square: "square", + arrow1: "arrow1", + arrow2: "arrow2", + arrow3: "arrow3", + hand: "hand", + crosshair: "crosshair" + }, + q = { + disc: "disc", + square: "square", + arrow1: "arrow1", + arrow2: "arrow2", + arrow3: "arrow3", + hand: "hand", + crosshair: "crosshair" + }, + G = [b, k, L, A], + D = "auto", + Q = { + x: "left", + y: "top", + width: "width", + height: "height" + }, + z = 80, + j = 4, + H = 5, + U = 120, + K = 8, + J = 3.75, + $ = 10, + ee = 30, + te = .5522847, + ne = .25 * Math.PI, + m = /^\s*(\-?[\d\.]+)\s*(\%)?\s*$/, + ae = "http://www.w3.org/2000/svg", + S = "-ms-scroll-limit" in document.documentElement.style && "-ms-ime-align" in document.documentElement.style && !window.navigator.msPointerEnabled, + ie = !S && !!document.uniqueID, + oe = "MozAppearance" in document.documentElement.style, + le = !(S || oe || !window.chrome || !window.CSS), + re = !S && !ie && !oe && !le && !window.chrome && "WebkitAppearance" in document.documentElement.style, + se = ie || S ? .2 : .1, + ue = { + path: T, + lineColor: "coral", + lineSize: 4, + plugSE: [Y, "arrow1"], + plugSizeSE: [1, 1], + lineOutlineEnabled: !1, + lineOutlineColor: "indianred", + lineOutlineSize: .25, + plugOutlineEnabledSE: [!1, !1], + plugOutlineSizeSE: [1, 1] + }, + he = (p = {}.toString, c = {}.hasOwnProperty.toString, d = c.call(Object), + function(e) { + return e && "[object Object]" === p.call(e) && (!(e = Object.getPrototypeOf(e)) || (e = e.hasOwnProperty("constructor") && e.constructor) && "function" == typeof e && c.call(e) === d) + }), + pe = Number.isFinite || + function(e) { + return "number" == typeof e && window.isFinite(e) + }, + g = (_ = { + ease: [.25, .1, .25, 1], + linear: [0, 0, 1, 1], + "ease-in": [.42, 0, 1, 1], + "ease-out": [0, 0, .58, 1], + "ease-in-out": [.42, 0, .58, 1] + }, + v = 1e3 / 60 / 2, l = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || + function(e) { + setTimeout(e, v) + }, + r = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame || + function(e) { + clearTimeout(e) + }, + i = Number.isFinite || + function(e) { + return "number" == typeof e && window.isFinite(e) + }, + E = [], x = 0, { + add: function(n, e, t, a, i, o, l) { + var r, s, u, h, p, c, d, f, y, m, S = ++x; + function g(e, t) { + return { + value: n(t), + timeRatio: e, + outputRatio: t + } + } + if ("string" == typeof i && (i = _[i]), n = n || + function() {}, + t < v) r = [g(0, 0), g(1, 1)]; + else { + if (s = v / t, r = [g(0, 0)], 0 === i[0] && 0 === i[1] && 1 === i[2] && 1 === i[3]) for (h = s; h <= 1; h += s) r.push(g(h, h)); + else for (p = u = (h = s) / 10; p <= 1; p += u) d = p, + m = y = f = void 0, + f = (m = p * p) * p, + m *= 3 * (y = 1 - p), + h <= (c = { + x: (d = 3 * (y * y) * p) * i[0] + m * i[2] + f, + y: d * i[1] + m * i[3] + f + }).x && (r.push(g(c.x, c.y)), h += s); + r.push(g(1, 1)) + } + return E.push(o = { + animId: S, + frameCallback: e, + duration: t, + count: a, + frames: r, + reverse: !!o + }), + !1 !== l && be(o, l), + S + }, + remove: function(n) { + var a; + E.some(function(e, t) { + return e.animId === n && (a = t, !(e.framesStart = null)) + }) && E.splice(a, 1) + }, + start: function(t, n, a) { + E.some(function(e) { + return e.animId === t && (e.reverse = !!n, be(e, a), !0) + }) + }, + stop: function(t, n) { + var a; + return E.some(function(e) { + return e.animId === t && (n ? null != e.lastFrame && (a = e.frames[e.lastFrame].timeRatio) : (a = (Date.now() - e.framesStart) / e.duration, (a = e.reverse ? 1 - a: a) < 0 ? a = 0 : 1 < a && (a = 1)), !(e.framesStart = null)) + }), + a + }, + validTiming: function(t) { + return "string" == typeof t ? _[t] : Array.isArray(t) && [0, 1, 2, 3].every(function(e) { + return i(t[e]) && 0 <= t[e] && t[e] <= 1 + }) ? [t[0], t[1], t[2], t[3]] : null + } + }), + ce = function(e) { + e.SVGPathElement.prototype.getPathData && e.SVGPathElement.prototype.setPathData || + function() { + function i(e) { + this._string = e, + this._currentIndex = 0, + this._endIndex = this._string.length, + this._prevCommand = null, + this._skipOptionalSpaces() + } + var a = { + Z: "Z", + M: "M", + L: "L", + C: "C", + Q: "Q", + A: "A", + H: "H", + V: "V", + S: "S", + T: "T", + z: "Z", + m: "m", + l: "l", + c: "c", + q: "q", + a: "a", + h: "h", + v: "v", + s: "s", + t: "t" + }, + o = -1 !== e.navigator.userAgent.indexOf("MSIE "); + i.prototype = { + parseSegment: function() { + var e = this._string[this._currentIndex], + t = a[e] || null; + if (null === t) { + if (null === this._prevCommand) return null; + if (null === (t = ("+" === e || "-" === e || "." === e || "0" <= e && e <= "9") && "Z" !== this._prevCommand ? "M" === this._prevCommand ? "L": "m" === this._prevCommand ? "l": this._prevCommand: null)) return null + } else this._currentIndex += 1; + var n = null, + e = (this._prevCommand = t).toUpperCase(); + return "H" === e || "V" === e ? n = [this._parseNumber()] : "M" === e || "L" === e || "T" === e ? n = [this._parseNumber(), this._parseNumber()] : "S" === e || "Q" === e ? n = [this._parseNumber(), this._parseNumber(), this._parseNumber(), this._parseNumber()] : "C" === e ? n = [this._parseNumber(), this._parseNumber(), this._parseNumber(), this._parseNumber(), this._parseNumber(), this._parseNumber()] : "A" === e ? n = [this._parseNumber(), this._parseNumber(), this._parseNumber(), this._parseArcFlag(), this._parseArcFlag(), this._parseNumber(), this._parseNumber()] : "Z" === e && (this._skipOptionalSpaces(), n = []), + null === n || 0 <= n.indexOf(null) ? null: { + type: t, + values: n + } + }, + hasMoreData: function() { + return this._currentIndex < this._endIndex + }, + peekSegmentType: function() { + var e = this._string[this._currentIndex]; + return a[e] || null + }, + initialCommandIsMoveTo: function() { + if (!this.hasMoreData()) return ! 0; + var e = this.peekSegmentType(); + return "M" === e || "m" === e + }, + _isCurrentSpace: function() { + var e = this._string[this._currentIndex]; + return e <= " " && (" " === e || "\n" === e || "\t" === e || "\r" === e || "\f" === e) + }, + _skipOptionalSpaces: function() { + for (; this._currentIndex < this._endIndex && this._isCurrentSpace();) this._currentIndex += 1; + return this._currentIndex < this._endIndex + }, + _skipOptionalSpacesOrDelimiter: function() { + return ! (this._currentIndex < this._endIndex && !this._isCurrentSpace() && "," !== this._string[this._currentIndex]) && (this._skipOptionalSpaces() && this._currentIndex < this._endIndex && "," === this._string[this._currentIndex] && (this._currentIndex += 1, this._skipOptionalSpaces()), this._currentIndex < this._endIndex) + }, + _parseNumber: function() { + var e = 0, + t = 0, + n = 1, + a = 0, + i = 1, + o = 1, + l = this._currentIndex; + if (this._skipOptionalSpaces(), this._currentIndex < this._endIndex && "+" === this._string[this._currentIndex] ? this._currentIndex += 1 : this._currentIndex < this._endIndex && "-" === this._string[this._currentIndex] && (this._currentIndex += 1, i = -1), this._currentIndex === this._endIndex || (this._string[this._currentIndex] < "0" || "9" < this._string[this._currentIndex]) && "." !== this._string[this._currentIndex]) return null; + for (var r = this._currentIndex; this._currentIndex < this._endIndex && "0" <= this._string[this._currentIndex] && this._string[this._currentIndex] <= "9";) this._currentIndex += 1; + if (this._currentIndex !== r) for (var s = this._currentIndex - 1, + u = 1; r <= s;) t += u * (this._string[s] - "0"), + --s, + u *= 10; + if (this._currentIndex < this._endIndex && "." === this._string[this._currentIndex]) { + if (this._currentIndex += 1, this._currentIndex >= this._endIndex || this._string[this._currentIndex] < "0" || "9" < this._string[this._currentIndex]) return null; + for (; this._currentIndex < this._endIndex && "0" <= this._string[this._currentIndex] && this._string[this._currentIndex] <= "9";) n *= 10, + a += (this._string.charAt(this._currentIndex) - "0") / n, + this._currentIndex += 1 + } + if (this._currentIndex !== l && this._currentIndex + 1 < this._endIndex && ("e" === this._string[this._currentIndex] || "E" === this._string[this._currentIndex]) && "x" !== this._string[this._currentIndex + 1] && "m" !== this._string[this._currentIndex + 1]) { + if (this._currentIndex += 1, "+" === this._string[this._currentIndex] ? this._currentIndex += 1 : "-" === this._string[this._currentIndex] && (this._currentIndex += 1, o = -1), this._currentIndex >= this._endIndex || this._string[this._currentIndex] < "0" || "9" < this._string[this._currentIndex]) return null; + for (; this._currentIndex < this._endIndex && "0" <= this._string[this._currentIndex] && this._string[this._currentIndex] <= "9";) e *= 10, + e += this._string[this._currentIndex] - "0", + this._currentIndex += 1 + } + var h = t + a; + return h *= i, + e && (h *= Math.pow(10, o * e)), + l === this._currentIndex ? null: (this._skipOptionalSpacesOrDelimiter(), h) + }, + _parseArcFlag: function() { + if (this._currentIndex >= this._endIndex) return null; + var e = null, + t = this._string[this._currentIndex]; + if (this._currentIndex += 1, "0" === t) e = 0; + else { + if ("1" !== t) return null; + e = 1 + } + return this._skipOptionalSpacesOrDelimiter(), + e + } + }; + function n(e) { + if (!e || 0 === e.length) return []; + var t = new i(e), + n = []; + if (t.initialCommandIsMoveTo()) for (; t.hasMoreData();) { + var a = t.parseSegment(); + if (null === a) break; + n.push(a) + } + return n + } + function l(e) { + return e.map(function(e) { + return { + type: e.type, + values: Array.prototype.slice.call(e.values) + } + }) + } + function r(e) { + var u = [], + h = null, + p = null, + c = null, + d = null, + f = null, + y = null, + m = null; + return e.forEach(function(e) { + var t, n, a, i, o, l, r, s; + "M" === e.type ? (r = e.values[0], s = e.values[1], u.push({ + type: "M", + values: [r, s] + }), d = y = r, f = m = s) : "C" === e.type ? (o = e.values[0], l = e.values[1], t = e.values[2], n = e.values[3], r = e.values[4], s = e.values[5], u.push({ + type: "C", + values: [o, l, t, n, r, s] + }), p = t, c = n, d = r, f = s) : "L" === e.type ? (r = e.values[0], s = e.values[1], u.push({ + type: "L", + values: [r, s] + }), d = r, f = s) : "H" === e.type ? (r = e.values[0], u.push({ + type: "L", + values: [r, f] + }), d = r) : "V" === e.type ? (s = e.values[0], u.push({ + type: "L", + values: [d, s] + }), f = s) : "S" === e.type ? (t = e.values[0], n = e.values[1], r = e.values[2], s = e.values[3], i = "C" === h || "S" === h ? (a = d + (d - p), f + (f - c)) : (a = d, f), u.push({ + type: "C", + values: [a, i, t, n, r, s] + }), p = t, c = n, d = r, f = s) : "T" === e.type ? (r = e.values[0], s = e.values[1], l = "Q" === h || "T" === h ? (o = d + (d - p), f + (f - c)) : (o = d, f), u.push({ + type: "C", + values: [a = d + 2 * (o - d) / 3, i = f + 2 * (l - f) / 3, r + 2 * (o - r) / 3, s + 2 * (l - s) / 3, r, s] + }), p = o, c = l, d = r, f = s) : "Q" === e.type ? (o = e.values[0], l = e.values[1], r = e.values[2], s = e.values[3], u.push({ + type: "C", + values: [a = d + 2 * (o - d) / 3, i = f + 2 * (l - f) / 3, r + 2 * (o - r) / 3, s + 2 * (l - s) / 3, r, s] + }), p = o, c = l, d = r, f = s) : "A" === e.type ? (n = e.values[0], a = e.values[1], i = e.values[2], o = e.values[3], l = e.values[4], r = e.values[5], s = e.values[6], 0 === n || 0 === a ? (u.push({ + type: "C", + values: [d, f, r, s, r, s] + }), d = r, f = s) : d === r && f === s || b(d, f, r, s, n, a, i, o, l).forEach(function(e) { + u.push({ + type: "C", + values: e + }), + d = r, + f = s + })) : "Z" === e.type && (u.push(e), d = y, f = m), + h = e.type + }), + u + } + var s = e.SVGPathElement.prototype.setAttribute, + u = e.SVGPathElement.prototype.removeAttribute, + d = e.Symbol ? e.Symbol() : "__cachedPathData", + f = e.Symbol ? e.Symbol() : "__cachedNormalizedPathData", + b = function(e, t, n, a, i, o, l, r, s, u) { + function h(e, t, n) { + return { + x: e * Math.cos(n) - t * Math.sin(n), + y: e * Math.sin(n) + t * Math.cos(n) + } + } + var p = Math.PI * l / 180, + c = []; + u ? (_ = u[0], v = u[1], S = u[2], g = u[3]) : (e = (m = h(e, t, -p)).x, t = m.y, 1 < (m = (y = (e - (n = (f = h(n, a, -p)).x)) / 2) * y / (i * i) + (d = (t - (a = f.y)) / 2) * d / (o * o)) && (i *= m = Math.sqrt(m), o *= m), f = i * i, m = o * o, S = (f = (r === s ? -1 : 1) * Math.sqrt(Math.abs((f * m - f * d * d - m * y * y) / (f * d * d + m * y * y)))) * i * d / o + (e + n) / 2, g = f * -o * y / i + (t + a) / 2, _ = Math.asin(parseFloat(((t - g) / o).toFixed(9))), v = Math.asin(parseFloat(((a - g) / o).toFixed(9))), e < S && (_ = Math.PI - _), n < S && (v = Math.PI - v), _ < 0 && (_ = 2 * Math.PI + _), v < 0 && (v = 2 * Math.PI + v), s && v < _ && (_ -= 2 * Math.PI), !s && _ < v && (v -= 2 * Math.PI)); + var d, f, y, m = v - _; + Math.abs(m) > 120 * Math.PI / 180 && (d = v, f = n, y = a, v = s && _ < v ? _ + 120 * Math.PI / 180 * 1 : _ + 120 * Math.PI / 180 * -1, n = S + i * Math.cos(v), a = g + o * Math.sin(v), c = b(n, a, f, y, i, o, l, 0, s, [v, d, S, g])); + var m = v - _, + S = Math.cos(_), + g = Math.sin(_), + _ = Math.cos(v), + v = Math.sin(v), + m = Math.tan(m / 4), + i = 4 / 3 * i * m, + o = 4 / 3 * o * m, + m = [e, t], + S = [e + i * g, t - o * S], + _ = [n + i * v, a - o * _], + a = [n, a]; + if (S[0] = 2 * m[0] - S[0], S[1] = 2 * m[1] - S[1], u) return [S, _, a].concat(c); + var c = [S, _, a].concat(c).join().split(","), + E = [], + x = []; + return c.forEach(function(e, t) { + t % 2 ? x.push(h(c[t - 1], c[t], p).y) : x.push(h(c[t], c[t + 1], p).x), + 6 === x.length && (E.push(x), x = []) + }), + E + }; + e.SVGPathElement.prototype.setAttribute = function(e, t) { + "d" === e && (this[d] = null, this[f] = null), + s.call(this, e, t) + }, + e.SVGPathElement.prototype.removeAttribute = function(e, t) { + "d" === e && (this[d] = null, this[f] = null), + u.call(this, e) + }, + e.SVGPathElement.prototype.getPathData = function(e) { + if (e && e.normalize) { + if (this[f]) return l(this[f]); + this[d] ? t = l(this[d]) : (t = n(this.getAttribute("d") || ""), this[d] = l(t)); + e = r((s = [], c = p = h = u = null, t.forEach(function(e) { + var t, n, a, i, o, l, r = e.type; + "M" === r ? (o = e.values[0], l = e.values[1], s.push({ + type: "M", + values: [o, l] + }), u = p = o, h = c = l) : "m" === r ? (o = u + e.values[0], l = h + e.values[1], s.push({ + type: "M", + values: [o, l] + }), u = p = o, h = c = l) : "L" === r ? (o = e.values[0], l = e.values[1], s.push({ + type: "L", + values: [o, l] + }), u = o, h = l) : "l" === r ? (o = u + e.values[0], l = h + e.values[1], s.push({ + type: "L", + values: [o, l] + }), u = o, h = l) : "C" === r ? (t = e.values[0], n = e.values[1], a = e.values[2], i = e.values[3], o = e.values[4], l = e.values[5], s.push({ + type: "C", + values: [t, n, a, i, o, l] + }), u = o, h = l) : "c" === r ? (t = u + e.values[0], n = h + e.values[1], a = u + e.values[2], i = h + e.values[3], o = u + e.values[4], l = h + e.values[5], s.push({ + type: "C", + values: [t, n, a, i, o, l] + }), u = o, h = l) : "Q" === r ? (t = e.values[0], n = e.values[1], o = e.values[2], l = e.values[3], s.push({ + type: "Q", + values: [t, n, o, l] + }), u = o, h = l) : "q" === r ? (t = u + e.values[0], n = h + e.values[1], o = u + e.values[2], l = h + e.values[3], s.push({ + type: "Q", + values: [t, n, o, l] + }), u = o, h = l) : "A" === r ? (o = e.values[5], l = e.values[6], s.push({ + type: "A", + values: [e.values[0], e.values[1], e.values[2], e.values[3], e.values[4], o, l] + }), u = o, h = l) : "a" === r ? (o = u + e.values[5], l = h + e.values[6], s.push({ + type: "A", + values: [e.values[0], e.values[1], e.values[2], e.values[3], e.values[4], o, l] + }), u = o, h = l) : "H" === r ? (o = e.values[0], s.push({ + type: "H", + values: [o] + }), u = o) : "h" === r ? (o = u + e.values[0], s.push({ + type: "H", + values: [o] + }), u = o) : "V" === r ? (l = e.values[0], s.push({ + type: "V", + values: [l] + }), h = l) : "v" === r ? (l = h + e.values[0], s.push({ + type: "V", + values: [l] + }), h = l) : "S" === r ? (a = e.values[0], i = e.values[1], o = e.values[2], l = e.values[3], s.push({ + type: "S", + values: [a, i, o, l] + }), u = o, h = l) : "s" === r ? (a = u + e.values[0], i = h + e.values[1], o = u + e.values[2], l = h + e.values[3], s.push({ + type: "S", + values: [a, i, o, l] + }), u = o, h = l) : "T" === r ? (o = e.values[0], l = e.values[1], s.push({ + type: "T", + values: [o, l] + }), u = o, h = l) : "t" === r ? (o = u + e.values[0], l = h + e.values[1], s.push({ + type: "T", + values: [o, l] + }), u = o, h = l) : "Z" !== r && "z" !== r || (s.push({ + type: "Z", + values: [] + }), u = p, h = c) + }), s)); + return this[f] = l(e), + e + } + if (this[d]) return l(this[d]); + var s, u, h, p, c, t = n(this.getAttribute("d") || ""); + return this[d] = l(t), + t + }, + e.SVGPathElement.prototype.setPathData = function(e) { + if (0 === e.length) o ? this.setAttribute("d", "") : this.removeAttribute("d"); + else { + for (var t = "", + n = 0, + a = e.length; n < a; n += 1) { + var i = e[n]; + 0 < n && (t += " "), + t += i.type, + i.values && 0 < i.values.length && (t += " " + i.values.join(" ")) + } + this.setAttribute("d", t) + } + }, + e.SVGRectElement.prototype.getPathData = function(e) { + var t = this.x.baseVal.value, + n = this.y.baseVal.value, + a = this.width.baseVal.value, + i = this.height.baseVal.value, + o = (this.hasAttribute("rx") ? this.rx: this.ry).baseVal.value, + l = (this.hasAttribute("ry") ? this.ry: this.rx).baseVal.value, + n = (n = [{ + type: "M", + values: [t + (o = a / 2 < o ? a / 2 : o), n] + }, + { + type: "H", + values: [t + a - o] + }, + { + type: "A", + values: [o, l = i / 2 < l ? i / 2 : l, 0, 0, 1, t + a, n + l] + }, + { + type: "V", + values: [n + i - l] + }, + { + type: "A", + values: [o, l, 0, 0, 1, t + a - o, n + i] + }, + { + type: "H", + values: [t + o] + }, + { + type: "A", + values: [o, l, 0, 0, 1, t, n + i - l] + }, + { + type: "V", + values: [n + l] + }, + { + type: "A", + values: [o, l, 0, 0, 1, t + o, n] + }, + { + type: "Z", + values: [] + }]).filter(function(e) { + return "A" !== e.type || 0 !== e.values[0] && 0 !== e.values[1] + }); + return n = e && !0 === e.normalize ? r(n) : n + }, + e.SVGCircleElement.prototype.getPathData = function(e) { + var t = this.cx.baseVal.value, + n = this.cy.baseVal.value, + a = this.r.baseVal.value, + n = [{ + type: "M", + values: [t + a, n] + }, + { + type: "A", + values: [a, a, 0, 0, 1, t, n + a] + }, + { + type: "A", + values: [a, a, 0, 0, 1, t - a, n] + }, + { + type: "A", + values: [a, a, 0, 0, 1, t, n - a] + }, + { + type: "A", + values: [a, a, 0, 0, 1, t + a, n] + }, + { + type: "Z", + values: [] + }]; + return n = e && !0 === e.normalize ? r(n) : n + }, + e.SVGEllipseElement.prototype.getPathData = function(e) { + var t = this.cx.baseVal.value, + n = this.cy.baseVal.value, + a = this.rx.baseVal.value, + i = this.ry.baseVal.value, + n = [{ + type: "M", + values: [t + a, n] + }, + { + type: "A", + values: [a, i, 0, 0, 1, t, n + i] + }, + { + type: "A", + values: [a, i, 0, 0, 1, t - a, n] + }, + { + type: "A", + values: [a, i, 0, 0, 1, t, n - i] + }, + { + type: "A", + values: [a, i, 0, 0, 1, t + a, n] + }, + { + type: "Z", + values: [] + }]; + return n = e && !0 === e.normalize ? r(n) : n + }, + e.SVGLineElement.prototype.getPathData = function() { + return [{ + type: "M", + values: [this.x1.baseVal.value, this.y1.baseVal.value] + }, + { + type: "L", + values: [this.x2.baseVal.value, this.y2.baseVal.value] + }] + }, + e.SVGPolylineElement.prototype.getPathData = function() { + for (var e = [], t = 0; t < this.points.numberOfItems; t += 1) { + var n = this.points.getItem(t); + e.push({ + type: 0 === t ? "M": "L", + values: [n.x, n.y] + }) + } + return e + }, + e.SVGPolygonElement.prototype.getPathData = function() { + for (var e = [], t = 0; t < this.points.numberOfItems; t += 1) { + var n = this.points.getItem(t); + e.push({ + type: 0 === t ? "M": "L", + values: [n.x, n.y] + }) + } + return e.push({ + type: "Z", + values: [] + }), + e + } + } () + }, + S = (a = {}, + Ee.m = n = [function(e, t, n) { + n.r(t); + var a = 500, + i = [], + o = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || + function(e) { + return setTimeout(e, 1e3 / 60) + }, + l = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame || + function(e) { + return clearTimeout(e) + }, + r = Date.now(), + s = void 0; + function u() { + var n = void 0, + e = void 0; + s && (l.call(window, s), s = null), + i.forEach(function(e) { + var t; (t = e.event) && (e.event = null, e.listener(t), n = !0) + }), + n ? (r = Date.now(), e = !0) : Date.now() - r < a && (e = !0), + e && (s = o.call(window, u)) + } + function h(n) { + var a = -1; + return i.some(function(e, t) { + return e.listener === n && (a = t, !0) + }), + a + } + t. + default = { + add: function(e) { + var t = void 0; + return - 1 === h(e) ? (i.push(t = { + listener: e + }), + function(e) { + t.event = e, + s || u() + }) : null + }, + remove: function(e) { - 1 < (e = h(e)) && (i.splice(e, 1), !i.length && s && (l.call(window, s), s = null)) + } + } + }], Ee.c = a, Ee.d = function(e, t, n) { + Ee.o(e, t) || Object.defineProperty(e, t, { + enumerable: !0, + get: n + }) + }, + Ee.r = function(e) { + "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { + value: "Module" + }), + Object.defineProperty(e, "__esModule", { + value: !0 + }) + }, + Ee.t = function(t, e) { + if (1 & e && (t = Ee(t)), 8 & e) return t; + if (4 & e && "object" == typeof t && t && t.__esModule) return t; + var n = Object.create(null); + if (Ee.r(n), Object.defineProperty(n, "default", { + enumerable: !0, + value: t + }), 2 & e && "string" != typeof t) for (var a in t) Ee.d(n, a, + function(e) { + return t[e] + }.bind(null, a)); + return n + }, + Ee.n = function(e) { + var t = e && e.__esModule ? + function() { + return e. + default + }: + function() { + return e + }; + return Ee.d(t, "a", t), + t + }, + Ee.o = function(e, t) { + return Object.prototype.hasOwnProperty.call(e, t) + }, + Ee.p = "", Ee(Ee.s = 0). +default), + de = { + line_altColor: { + iniValue: !1 + }, + line_color: {}, + line_colorTra: { + iniValue: !1 + }, + line_strokeWidth: {}, + plug_enabled: { + iniValue: !1 + }, + plug_enabledSE: { + hasSE: !0, + iniValue: !1 + }, + plug_plugSE: { + hasSE: !0, + iniValue: Y + }, + plug_colorSE: { + hasSE: !0 + }, + plug_colorTraSE: { + hasSE: !0, + iniValue: !1 + }, + plug_markerWidthSE: { + hasSE: !0 + }, + plug_markerHeightSE: { + hasSE: !0 + }, + lineOutline_enabled: { + iniValue: !1 + }, + lineOutline_color: {}, + lineOutline_colorTra: { + iniValue: !1 + }, + lineOutline_strokeWidth: {}, + lineOutline_inStrokeWidth: {}, + plugOutline_enabledSE: { + hasSE: !0, + iniValue: !1 + }, + plugOutline_plugSE: { + hasSE: !0, + iniValue: Y + }, + plugOutline_colorSE: { + hasSE: !0 + }, + plugOutline_colorTraSE: { + hasSE: !0, + iniValue: !1 + }, + plugOutline_strokeWidthSE: { + hasSE: !0 + }, + plugOutline_inStrokeWidthSE: { + hasSE: !0 + }, + position_socketXYSE: { + hasSE: !0, + hasProps: !0 + }, + position_plugOverheadSE: { + hasSE: !0 + }, + position_path: {}, + position_lineStrokeWidth: {}, + position_socketGravitySE: { + hasSE: !0 + }, + path_pathData: {}, + path_edge: { + hasProps: !0 + }, + viewBox_bBox: { + hasProps: !0 + }, + viewBox_plugBCircleSE: { + hasSE: !0 + }, + lineMask_enabled: { + iniValue: !1 + }, + lineMask_outlineMode: { + iniValue: !1 + }, + lineMask_x: {}, + lineMask_y: {}, + lineOutlineMask_x: {}, + lineOutlineMask_y: {}, + maskBGRect_x: {}, + maskBGRect_y: {}, + capsMaskAnchor_enabledSE: { + hasSE: !0, + iniValue: !1 + }, + capsMaskAnchor_pathDataSE: { + hasSE: !0 + }, + capsMaskAnchor_strokeWidthSE: { + hasSE: !0 + }, + capsMaskMarker_enabled: { + iniValue: !1 + }, + capsMaskMarker_enabledSE: { + hasSE: !0, + iniValue: !1 + }, + capsMaskMarker_plugSE: { + hasSE: !0, + iniValue: Y + }, + capsMaskMarker_markerWidthSE: { + hasSE: !0 + }, + capsMaskMarker_markerHeightSE: { + hasSE: !0 + }, + caps_enabled: { + iniValue: !1 + }, + attach_plugSideLenSE: { + hasSE: !0 + }, + attach_plugBackLenSE: { + hasSE: !0 + } + }, + fe = { + show_on: {}, + show_effect: {}, + show_animOptions: {}, + show_animId: {}, + show_inAnim: {} + }, + ye = "fade", + me = [], + Se = {}, + ge = 0, + _e = {}, + ve = 0; + function Ee(e) { + if (a[e]) return a[e].exports; + var t = a[e] = { + i: e, + l: !1, + exports: {} + }; + return n[e].call(t.exports, t, t.exports, Ee), + t.l = !0, + t.exports + } + function xe() { + var i = Date.now(), + o = !1; + e && (r.call(window, e), e = null), + E.forEach(function(e) { + var t, n, a; + if (e.framesStart) { + if ((t = i - e.framesStart) >= e.duration && e.count && e.loopsLeft <= 1) return a = e.frames[e.lastFrame = e.reverse ? 0 : e.frames.length - 1], + e.frameCallback(a.value, !0, a.timeRatio, a.outputRatio), + void(e.framesStart = null); + if (t > e.duration) { + if (n = Math.floor(t / e.duration), e.count) { + if (n >= e.loopsLeft) return a = e.frames[e.lastFrame = e.reverse ? 0 : e.frames.length - 1], + e.frameCallback(a.value, !0, a.timeRatio, a.outputRatio), + void(e.framesStart = null); + e.loopsLeft -= n + } + e.framesStart += e.duration * n, + t = i - e.framesStart + } + e.reverse && (t = e.duration - t), + a = e.frames[e.lastFrame = Math.round(t / v)], + !1 !== e.frameCallback(a.value, !1, a.timeRatio, a.outputRatio) ? o = !0 : e.framesStart = null + } + }), + o && (e = l.call(window, xe)) + } + function be(e, t) { + e.framesStart = Date.now(), + null != t && (e.framesStart -= e.duration * (e.reverse ? 1 - t: t)), + e.loopsLeft = e.count, + e.lastFrame = null, + xe() + } + function ke(t, n) { + var e, a; + return typeof t != typeof n || (e = he(t) ? "obj": Array.isArray(t) ? "array": "") != (he(n) ? "obj": Array.isArray(n) ? "array": "") || ("obj" === e ? ke(a = Object.keys(t).sort(), Object.keys(n).sort()) || a.some(function(e) { + return ke(t[e], n[e]) + }) : "array" === e ? t.length !== n.length || t.some(function(e, t) { + return ke(e, n[t]) + }) : t !== n) + } + function we(n) { + return n && (he(n) ? Object.keys(n).reduce(function(e, t) { + return e[t] = we(n[t]), + e + }, + {}) : Array.isArray(n) ? n.map(we) : n) + } + function Oe(e) { + var t, n, a, i = 1, + o = e = (e + "").trim(); + function l(e) { + var t = 1, + e = m.exec(e); + return e && (t = parseFloat(e[1]), e[2] ? t = 0 <= t && t <= 100 ? t / 100 : 1 : (t < 0 || 1 < t) && (t = 1)), + t + } + return (t = /^(rgba|hsla|hwb|gray|device\-cmyk)\s*\(([\s\S]+)\)$/i.exec(e)) ? (n = t[1].toLowerCase(), a = t[2].trim().split(/\s*,\s*/), "rgba" === n && 4 === a.length ? (i = l(a[3]), o = "rgb(" + a.slice(0, 3).join(", ") + ")") : "hsla" === n && 4 === a.length ? (i = l(a[3]), o = "hsl(" + a.slice(0, 3).join(", ") + ")") : "hwb" === n && 4 === a.length ? (i = l(a[3]), o = "hwb(" + a.slice(0, 3).join(", ") + ")") : "gray" === n && 2 === a.length ? (i = l(a[1]), o = "gray(" + a[0] + ")") : "device-cmyk" === n && 5 <= a.length && (i = l(a[4]), o = "device-cmyk(" + a.slice(0, 4).join(", ") + ")")) : (t = /^\#(?:([\da-f]{6})([\da-f]{2})|([\da-f]{3})([\da-f]))$/i.exec(e)) ? o = t[1] ? (i = parseInt(t[2], 16) / 255, "#" + t[1]) : (i = parseInt(t[4] + t[4], 16) / 255, "#" + t[3]) : "transparent" === e.toLocaleLowerCase() && (i = 0), + [i, o] + } + function Me(e) { + return ! (!e || e.nodeType !== Node.ELEMENT_NODE || "function" != typeof e.getBoundingClientRect) + } + function Ie(e, t) { + var n, a, i, o = {}; + if (! (i = e.ownerDocument)) return console.error("Cannot get document that contains the element."), + null; + if (e.compareDocumentPosition(i) & Node.DOCUMENT_POSITION_DISCONNECTED) return console.error("A disconnected element was passed."), + null; + for (a in n = e.getBoundingClientRect()) o[a] = n[a]; + if (!t) { + if (! (i = i.defaultView)) return console.error("Cannot get window that contains the element."), + null; + o.left += i.pageXOffset, + o.right += i.pageXOffset, + o.top += i.pageYOffset, + o.bottom += i.pageYOffset + } + return o + } + function Ce(e, t) { + var n, a = [], + i = e; + for (t = t || window;;) { + if (! (n = document)) return console.error("Cannot get document that contains the element."), + null; + if (! (n = n.defaultView)) return console.error("Cannot get window that contains the element."), + null; + if (n === t) break; + if (! (i = n.frameElement)) return console.error("`baseWindow` was not found."), + null; + a.unshift(i) + } + return a + } + function Le(e, t) { + var a = 0, + i = 0; + return (t = Ce(e, t = t || window)) ? t.length ? (t.forEach(function(e, t) { + var n = Ie(e, 0 < t); + a += n.left, + i += n.top, + e = (t = e).ownerDocument.defaultView.getComputedStyle(t, ""), + n = { + left: t.clientLeft + parseFloat(e.paddingLeft), + top: t.clientTop + parseFloat(e.paddingTop) + }, + a += n.left, + i += n.top + }), (t = Ie(e, !0)).left += a, t.right += a, t.top += i, t.bottom += i, t) : Ie(e) : null + } + function Ae(e, t) { + var n = e.x - t.x, + t = e.y - t.y; + return Math.sqrt(n * n + t * t) + } + function Ve(e, t, n) { + var a = t.x - e.x, + t = t.y - e.y; + return { + x: e.x + a * n, + y: e.y + t * n, + angle: Math.atan2(t, a) / (Math.PI / 180) + } + } + function Pe(e, t, n) { + e = Math.atan2(e.y - t.y, t.x - e.x); + return { + x: t.x + Math.cos(e) * n, + y: t.y + Math.sin(e) * n * -1 + } + } + function Ne(e, t, n, a, i) { + var o = i * i, + l = o * i, + r = 1 - i, + s = r * r, + u = s * r, + h = u * e.x + 3 * s * i * t.x + 3 * r * o * n.x + l * a.x, + p = u * e.y + 3 * s * i * t.y + 3 * r * o * n.y + l * a.y, + c = e.x + 2 * i * (t.x - e.x) + o * (n.x - 2 * t.x + e.x), + u = e.y + 2 * i * (t.y - e.y) + o * (n.y - 2 * t.y + e.y), + s = t.x + 2 * i * (n.x - t.x) + o * (a.x - 2 * n.x + t.x), + l = t.y + 2 * i * (n.y - t.y) + o * (a.y - 2 * n.y + t.y), + o = r * e.x + i * t.x, + e = r * e.y + i * t.y, + t = r * n.x + i * a.x, + i = r * n.y + i * a.y, + a = 90 - 180 * Math.atan2(c - s, u - l) / Math.PI; + return { + x: h, + y: p, + fromP2: { + x: c, + y: u + }, + toP1: { + x: s, + y: l + }, + fromP1: { + x: o, + y: e + }, + toP2: { + x: t, + y: i + }, + angle: a += 180 < a ? -180 : 180 + } + } + function Te(n, a, i, o, e) { + function l(e, t, n, a, i) { + return e * (e * ( - 3 * t + 9 * n - 9 * a + 3 * i) + 6 * t - 12 * n + 6 * a) - 3 * t + 3 * n + } + var r, s, u = [.2491, .2491, .2335, .2335, .2032, .2032, .1601, .1601, .1069, .1069, .0472, .0472], + h = 0, + p = (e = null == e || 1 < e ? 1 : e < 0 ? 0 : e) / 2; + return [ - .1252, .1252, -.3678, .3678, -.5873, .5873, -.7699, .7699, -.9041, .9041, -.9816, .9816].forEach(function(e, t) { + r = l(s = p * e + p, n.x, a.x, i.x, o.x), + s = l(s, n.y, a.y, i.y, o.y), + s = r * r + s * s, + h += u[t] * Math.sqrt(s) + }), + p * h + } + function We(e, t, n, a, i) { + for (var o, l = .5, + r = 1 - l; o = Te(e, t, n, a, r), !(Math.abs(o - i) <= .01);) r += (o < i ? 1 : -1) * (l /= 2); + return r + } + function Be(e, t) { + var n; + return e.forEach(function(e) { + e = t ? e.map(function(e) { + e = { + x: e.x, + y: e.y + }; + return t(e), + e + }) : e; (n = n || [{ + type: "M", + values: [e[0].x, e[0].y] + }]).push(e.length ? 2 === e.length ? { + type: "L", + values: [e[1].x, e[1].y] + }: { + type: "C", + values: [e[1].x, e[1].y, e[2].x, e[2].y, e[3].x, e[3].y] + }: { + type: "Z", + values: [] + }) + }), + n + } + function Re(e) { + var t = [], + n = 0; + return e.forEach(function(e) { + e = (2 === e.length ? Ae: Te).apply(null, e); + t.push(e), + n += e + }), + { + segsLen: t, + lenAll: n + } + } + function Fe(e, a) { + return null == e || null == a || e.length !== a.length || e.some(function(e, t) { + var n = a[t]; + return e.type !== n.type || e.values.some(function(e, t) { + return e !== n.values[t] + }) + }) + } + function Ge(e, t, n) { + e.events[t] ? e.events[t].indexOf(n) < 0 && e.events[t].push(n) : e.events[t] = [n] + } + function De(e, t, n) { + var a; + e.events[t] && -1 < (a = e.events[t].indexOf(n)) && e.events[t].splice(a, 1) + } + function ze(e) { + t && clearTimeout(t), + me.push(e), + t = setTimeout(function() { + me.forEach(function(e) { + e() + }), + me = [] + }, + 0) + } + function je(e, t) { + e.reflowTargets.indexOf(t) < 0 && e.reflowTargets.push(t) + } + function He(e) { + e.reflowTargets.forEach(function(e) { + var n; + n = e, + setTimeout(function() { + var e = n.parentNode, + t = n.nextSibling; + e.insertBefore(e.removeChild(n), t) + }, + 0) + }), + e.reflowTargets = [] + } + function Ue(e, t, n, a, i, o, l) { + var r; + "auto-start-reverse" === n ? ("boolean" != typeof s && (t.setAttribute("orient", "auto-start-reverse"), s = t.orientType.baseVal === SVGMarkerElement.SVG_MARKER_ORIENT_UNKNOWN), s ? t.setAttribute("orient", n) : ((r = i.createSVGTransform()).setRotate(180, 0, 0), o.transform.baseVal.appendItem(r), t.setAttribute("orient", "auto"), r = !0)) : (t.setAttribute("orient", n), !1 === s && o.transform.baseVal.clear()), + t = t.viewBox.baseVal, + r ? (t.x = -a.right, t.y = -a.bottom) : (t.x = a.left, t.y = a.top), + t.width = a.width, + t.height = a.height, + ie && je(e, l) + } + function Ze(e, t) { + return { + prop: e ? "markerEnd": "markerStart", + orient: t ? t.noRotate ? "0": e ? "auto": "auto-start-reverse": null + } + } + function Ye(n, a) { + Object.keys(a).forEach(function(e) { + var t = a[e]; + n[e] = null != t.iniValue ? t.hasSE ? [t.iniValue, t.iniValue] : t.iniValue: t.hasSE ? t.hasProps ? [{}, + {}] : [] : t.hasProps ? {}: null + }) + } + function Xe(t, e, n, a, i) { + return a !== e[n] && (e[n] = a, i && i.forEach(function(e) { + e(t, a, n) + }), !0) + } + function qe(e) { + function t(e, t) { + return e + parseFloat(t) + } + var n = e.document, + a = e.getComputedStyle(n.documentElement, ""), + e = e.getComputedStyle(n.body, ""), + n = { + x: 0, + y: 0 + }; + return "static" !== e.position ? (n.x -= [a.marginLeft, a.borderLeftWidth, a.paddingLeft, e.marginLeft, e.borderLeftWidth].reduce(t, 0), n.y -= [a.marginTop, a.borderTopWidth, a.paddingTop, e.marginTop, e.borderTopWidth].reduce(t, 0)) : "static" !== a.position && (n.x -= [a.marginLeft, a.borderLeftWidth].reduce(t, 0), n.y -= [a.marginTop, a.borderTopWidth].reduce(t, 0)), + n + } + function Qe(e) { + var t, n = e.document; + n.getElementById(f) || (t = (new e.DOMParser).parseFromString(y, "image/svg+xml"), n.body.appendChild(t.documentElement), ce(e)) + } + function Ke(l) { + var g, c, _, e, n, a, i, d, o, r, s, t, u, h, p = l.options, + f = l.curStats, + y = l.aplStats, + v = f.position_socketXYSE, + m = !1; + function S(e, t) { + e = t === b ? { + x: e.left + e.width / 2, + y: e.top + }: t === k ? { + x: e.right, + y: e.top + e.height / 2 + }: t === L ? { + x: e.left + e.width / 2, + y: e.bottom + }: { + x: e.left, + y: e.top + e.height / 2 + }; + return e.socketId = t, + e + } + function E(e) { + return { + x: e.x, + y: e.y + } + } + if (f.position_path = p.path, f.position_lineStrokeWidth = f.line_strokeWidth, f.position_socketGravitySE = g = we(p.socketGravitySE), c = [0, 1].map(function(e) { + var t = p.anchorSE[e], + n = l.optionIsAttach.anchorSE[e], + a = !1 !== n ? _e[t._id] : null, + i = !1 !== n && a.conf.getStrokeWidth ? a.conf.getStrokeWidth(a, l) : 0, + o = !1 !== n && a.conf.getBBoxNest ? a.conf.getBBoxNest(a, l, i) : Le(t, l.baseWindow); + return f.capsMaskAnchor_pathDataSE[e] = !1 !== n && a.conf.getPathData ? a.conf.getPathData(a, l, i) : (n = null != (t = o).right ? t.right: t.left + t.width, a = null != t.bottom ? t.bottom: t.top + t.height, [{ + type: "M", + values: [t.left, t.top] + }, + { + type: "L", + values: [n, t.top] + }, + { + type: "L", + values: [n, a] + }, + { + type: "L", + values: [t.left, a] + }, + { + type: "Z", + values: [] + }]), + f.capsMaskAnchor_strokeWidthSE[e] = i, + o + }), i = -1, p.socketSE[0] && p.socketSE[1] ? (v[0] = S(c[0], p.socketSE[0]), v[1] = S(c[1], p.socketSE[1])) : (p.socketSE[0] || p.socketSE[1] ? (a = p.socketSE[0] ? (n = 0, 1) : (n = 1, 0), v[n] = S(c[n], p.socketSE[n]), (e = G.map(function(e) { + return S(c[a], e) + })).forEach(function(e) { + var t = Ae(e, v[n]); (t < i || -1 === i) && (v[a] = e, i = t) + })) : (e = G.map(function(e) { + return S(c[1], e) + }), G.map(function(e) { + return S(c[0], e) + }).forEach(function(n) { + e.forEach(function(e) { + var t = Ae(n, e); (t < i || -1 === i) && (v[0] = n, v[1] = e, i = t) + }) + })), [0, 1].forEach(function(e) { + var t, n; + p.socketSE[e] || (c[e].width || c[e].height ? c[e].width || v[e].socketId !== A && v[e].socketId !== k ? c[e].height || v[e].socketId !== b && v[e].socketId !== L || (v[e].socketId = 0 <= v[e ? 0 : 1].y - c[e].top ? L: b) : v[e].socketId = 0 <= v[e ? 0 : 1].x - c[e].left ? k: A: (t = v[e ? 0 : 1].x - c[e].left, n = v[e ? 0 : 1].y - c[e].top, v[e].socketId = Math.abs(t) >= Math.abs(n) ? 0 <= t ? k: A: 0 <= n ? L: b)) + })), f.position_path !== y.position_path || f.position_lineStrokeWidth !== y.position_lineStrokeWidth || [0, 1].some(function(e) { + return f.position_plugOverheadSE[e] !== y.position_plugOverheadSE[e] || (t = v[e], n = y.position_socketXYSE[e], t.x !== n.x || t.y !== n.y || t.socketId !== n.socketId) || (t = g[e], n = y.position_socketGravitySE[e], (e = null == t ? "auto": Array.isArray(t) ? "array": "number") != (null == n ? "auto": Array.isArray(n) ? "array": "number") || ("array" == e ? t[0] !== n[0] || t[1] !== n[1] : t !== n)); + var t, n + })) { + switch (l.pathList.baseVal = _ = [], l.pathList.animVal = null, f.position_path) { + case P: + _.push([E(v[0]), E(v[1])]); + break; + case N: + t = "number" == typeof g[0] && 0 < g[0] || "number" == typeof g[1] && 0 < g[1], + u = ne * (t ? -1 : 1), + h = Math.atan2(v[1].y - v[0].y, v[1].x - v[0].x), + t = u - h, + h = Math.PI - h - u, + u = Ae(v[0], v[1]) / Math.sqrt(2) * te, + t = { + x: v[0].x + Math.cos(t) * u, + y: v[0].y + Math.sin(t) * u * -1 + }, + u = { + x: v[1].x + Math.cos(h) * u, + y: v[1].y + Math.sin(h) * u * -1 + }, + _.push([E(v[0]), t, u, E(v[1])]); + break; + case T: + case W: + o = [g[0], f.position_path === W ? 0 : g[1]], + r = [], + s = [], + v.forEach(function(e, t) { + var n, a = o[t], + i = Array.isArray(a) ? { + x: a[0], + y: a[1] + }: "number" == typeof a ? e.socketId === b ? { + x: 0, + y: -a + }: e.socketId === k ? { + x: a, + y: 0 + }: e.socketId === L ? { + x: 0, + y: a + }: { + x: -a, + y: 0 + }: (n = v[t ? 0 : 1], a = 0 < (a = f.position_plugOverheadSE[t]) ? U + (K < a ? (a - K) * J: 0) : z + (f.position_lineStrokeWidth > j ? (f.position_lineStrokeWidth - j) * H: 0), e.socketId === b ? { + x: 0, + y: -(i = (i = (e.y - n.y) / 2) < a ? a: i) + }: e.socketId === k ? { + x: i = (i = (n.x - e.x) / 2) < a ? a: i, + y: 0 + }: e.socketId === L ? { + x: 0, + y: i = (i = (n.y - e.y) / 2) < a ? a: i + }: { + x: -(i = (i = (e.x - n.x) / 2) < a ? a: i), + y: 0 + }); + r[t] = e.x + i.x, + s[t] = e.y + i.y + }), + _.push([E(v[0]), { + x: r[0], + y: s[0] + }, + { + x: r[1], + y: s[1] + }, + E(v[1])]); + break; + case B: + ! + function() { + var n, i = 1, + l = 2, + r = 3, + o = 4, + s = [[], []], + u = []; + function h(e) { + return e === i ? r: e === l ? o: e === r ? i: l + } + function p(e) { + return e === l || e === o ? "x": "y" + } + function c(e, t, n) { + var a = { + x: e.x, + y: e.y + }; + if (n) { + if (n === h(e.dirId)) throw new Error("Invalid dirId: " + n); + a.dirId = n + } else a.dirId = e.dirId; + return a.dirId === i ? a.y -= t: a.dirId === l ? a.x += t: a.dirId === r ? a.y += t: a.x -= t, + a + } + function d(e, t) { + return t.dirId === i ? e.y <= t.y: t.dirId === l ? e.x >= t.x: t.dirId === r ? e.y >= t.y: e.x <= t.x + } + function f(e, t) { + return t.dirId === i || t.dirId === r ? e.x === t.x: e.y === t.y + } + function y(e) { + return e[0] ? { + contain: 0, + notContain: 1 + }: { + contain: 1, + notContain: 0 + } + } + function m(e, t, n) { + return Math.abs(t[n] - e[n]) + } + function S(e, t, n) { + return "x" === n ? e.x < t.x ? l: o: e.y < t.y ? r: i + } + for (v.forEach(function(e, t) { + var n = E(e), + a = g[t]; + e = Array.isArray(a) ? a[0] < 0 ? [o, -a[0]] : 0 < a[0] ? [l, a[0]] : a[1] < 0 ? [i, -a[1]] : 0 < a[1] ? [r, a[1]] : [e.socketId, 0] : "number" != typeof a ? [e.socketId, ee] : 0 <= a ? [e.socketId, a] : [h(e.socketId), -a], + n.dirId = e[0], + a = e[1], + s[t].push(n), + u[t] = c(n, a) + }); + function() { + var e, t, a, i, n = [d(u[1], u[0]), d(u[0], u[1])], + o = [p(u[0].dirId), p(u[1].dirId)]; + if (o[0] === o[1]) { + if (n[0] && n[1]) return void(f(u[1], u[0]) || (u[0][o[0]] === u[1][o[1]] ? (s[0].push(u[0]), s[1].push(u[1])) : (e = u[0][o[0]] + (u[1][o[1]] - u[0][o[0]]) / 2, s[0].push(c(u[0], Math.abs(e - u[0][o[0]]))), s[1].push(c(u[1], Math.abs(e - u[1][o[1]])))))); + n[0] !== n[1] ? (t = y(n), (a = m(u[t.notContain], u[t.contain], o[t.notContain])) < ee && (u[t.notContain] = c(u[t.notContain], ee - a)), s[t.notContain].push(u[t.notContain]), u[t.notContain] = c(u[t.notContain], ee, f(u[t.contain], u[t.notContain]) ? "x" === o[t.notContain] ? r: l: S(u[t.notContain], u[t.contain], "x" === o[t.notContain] ? "y": "x"))) : (a = m(u[0], u[1], "x" === o[0] ? "y": "x"), s.forEach(function(e, t) { + var n = 0 === t ? 1 : 0; + e.push(u[t]), + u[t] = c(u[t], ee, 2 * ee <= a ? S(u[t], u[n], "x" === o[t] ? "y": "x") : "x" === o[t] ? r: l) + })) + } else { + if (n[0] && n[1]) return void(f(u[1], u[0]) ? s[1].push(u[1]) : f(u[0], u[1]) ? s[0].push(u[0]) : s[0].push("x" === o[0] ? { + x: u[1].x, + y: u[0].y + }: { + x: u[0].x, + y: u[1].y + })); + n[0] !== n[1] ? (t = y(n), s[t.notContain].push(u[t.notContain]), u[t.notContain] = c(u[t.notContain], ee, m(u[t.notContain], u[t.contain], o[t.contain]) >= ee ? S(u[t.notContain], u[t.contain], o[t.contain]) : u[t.contain].dirId)) : (i = [{ + x: u[0].x, + y: u[0].y + }, + { + x: u[1].x, + y: u[1].y + }], s.forEach(function(e, t) { + var n = 0 === t ? 1 : 0, + a = m(i[t], i[n], o[t]); + a < ee && (u[t] = c(u[t], ee - a)), + e.push(u[t]), + u[t] = c(u[t], ee, S(u[t], u[n], o[n])) + })) + } + return 1 + } ();); + s[1].reverse(), + s[0].concat(s[1]).forEach(function(e, t) { + e = { + x: e.x, + y: e.y + }; + 0 < t && _.push([n, e]), + n = e + }) + } () + } + d = [], + f.position_plugOverheadSE.forEach(function(e, t) { + var n, a, i, o, l, r, s, u, h, p = !t; + 0 < e ? 2 === (n = _[a = p ? 0 : _.length - 1]).length ? (d[a] = d[a] || Ae.apply(null, n), d[a] > $ && (d[a] - e < $ && (e = d[a] - $), s = Ve(n[0], n[1], (p ? e: d[a] - e) / d[a]), _[a] = p ? [s, n[1]] : [n[0], s], d[a] -= e)) : (d[a] = d[a] || Te.apply(null, n), d[a] > $ && (d[a] - e < $ && (e = d[a] - $), s = Ne(n[0], n[1], n[2], n[3], We(n[0], n[1], n[2], n[3], p ? e: d[a] - e)), o = p ? (i = n[0], s.toP1) : (i = n[3], s.fromP2), l = Math.atan2(i.y - s.y, s.x - i.x), r = Ae(s, o), s.x = i.x + Math.cos(l) * e, s.y = i.y + Math.sin(l) * e * -1, o.x = s.x + Math.cos(l) * r, o.y = s.y + Math.sin(l) * r * -1, _[a] = p ? [s, s.toP1, s.toP2, n[3]] : [n[0], s.fromP1, s.fromP2, s], d[a] = null)) : e < 0 && (n = _[a = p ? 0 : _.length - 1], s = v[t].socketId, t = -c[t]["x" == (u = s === A || s === k ? "x": "y") ? "width": "height"], h = (e = e < t ? t: e) * (s === A || s === b ? -1 : 1), 2 === n.length ? n[p ? 0 : n.length - 1][u] += h: (p ? [0, 1] : [n.length - 2, n.length - 1]).forEach(function(e) { + n[e][u] += h + }), d[a] = null) + }), + y.position_socketXYSE = we(v), + y.position_plugOverheadSE = we(f.position_plugOverheadSE), + y.position_path = f.position_path, + y.position_lineStrokeWidth = f.position_lineStrokeWidth, + y.position_socketGravitySE = we(g), + m = !0, + l.events.apl_position && l.events.apl_position.forEach(function(e) { + e(l, _) + }) + } + return m + } + function Je(t, n) { + n !== t.isShown && ( !! n != !!t.isShown && (t.svg.style.visibility = n ? "": "hidden"), t.isShown = n, t.events && t.events.svgShow && t.events.svgShow.forEach(function(e) { + e(t, n) + })) + } + function $e(e, t) { + var n, a, h, p, c, d, f, i, o, l, r, s, u, y, m, S, g, _, v, E, x, b, k, w, O, M, I, C, L, A, V, P, N, T, W, B, R, F, G, D, z, j, H, U = {}; + t.line && (U.line = (i = (n = e).options, a = n.curStats, o = n.events, l = !1, l = Xe(n, a, "line_color", i.lineColor, o.cur_line_color) || l, l = Xe(n, a, "line_colorTra", Oe(a.line_color)[0] < 1) || l, l = Xe(n, a, "line_strokeWidth", i.lineSize, o.cur_line_strokeWidth) || l)), + (t.plug || U.line) && (U.plug = (p = (h = e).options, c = h.curStats, d = h.events, f = !1, [0, 1].forEach(function(e) { + var t, n, a, i, o, l, r, s, u = p.plugSE[e]; + f = Xe(h, c.plug_enabledSE, e, u !== Y) || f, + f = Xe(h, c.plug_plugSE, e, u) || f, + f = Xe(h, c.plug_colorSE, e, s = p.plugColorSE[e] || c.line_color, d.cur_plug_colorSE) || f, + f = Xe(h, c.plug_colorTraSE, e, Oe(s)[0] < 1) || f, + u !== Y && (i = n = (t = X[q[u]]).widthR * p.plugSizeSE[e], o = a = t.heightR * p.plugSizeSE[e], re && (i *= c.line_strokeWidth, o *= c.line_strokeWidth), f = Xe(h, c.plug_markerWidthSE, e, i) || f, f = Xe(h, c.plug_markerHeightSE, e, o) || f, c.capsMaskMarker_markerWidthSE[e] = n, c.capsMaskMarker_markerHeightSE[e] = a), + c.plugOutline_plugSE[e] = c.capsMaskMarker_plugSE[e] = u, + c.plug_enabledSE[e] ? (s = c.line_strokeWidth / ue.lineSize * p.plugSizeSE[e], c.position_plugOverheadSE[e] = t.overhead * s, c.viewBox_plugBCircleSE[e] = t.bCircle * s, l = t.sideLen * s, r = t.backLen * s) : (c.position_plugOverheadSE[e] = -c.line_strokeWidth / 2, c.viewBox_plugBCircleSE[e] = l = r = 0), + Xe(h, c.attach_plugSideLenSE, e, l, d.cur_attach_plugSideLenSE), + Xe(h, c.attach_plugBackLenSE, e, r, d.cur_attach_plugBackLenSE), + c.capsMaskAnchor_enabledSE[e] = !c.plug_enabledSE[e] + }), f = Xe(h, c, "plug_enabled", c.plug_enabledSE[0] || c.plug_enabledSE[1]) || f)), + (t.lineOutline || U.line) && (U.lineOutline = (o = (i = e).options, l = i.curStats, k = !1, k = Xe(i, l, "lineOutline_enabled", o.lineOutlineEnabled) || k, k = Xe(i, l, "lineOutline_color", o.lineOutlineColor) || k, k = Xe(i, l, "lineOutline_colorTra", Oe(l.lineOutline_color)[0] < 1) || k, o = l.line_strokeWidth * o.lineOutlineSize, k = Xe(i, l, "lineOutline_strokeWidth", l.line_strokeWidth - 2 * o) || k, k = Xe(i, l, "lineOutline_inStrokeWidth", l.lineOutline_colorTra ? l.lineOutline_strokeWidth + 2 * se: l.line_strokeWidth - o) || k)), + (t.plugOutline || U.line || U.plug || U.lineOutline) && (U.plugOutline = (s = (r = e).options, u = r.curStats, y = !1, [0, 1].forEach(function(e) { + var t = u.plugOutline_plugSE[e], + n = t !== Y ? X[q[t]] : null; + y = Xe(r, u.plugOutline_enabledSE, e, s.plugOutlineEnabledSE[e] && u.plug_enabled && u.plug_enabledSE[e] && !!n && !!n.outlineBase) || y, + y = Xe(r, u.plugOutline_colorSE, e, t = s.plugOutlineColorSE[e] || u.lineOutline_color) || y, + y = Xe(r, u.plugOutline_colorTraSE, e, Oe(t)[0] < 1) || y, + n && n.outlineBase && ((t = s.plugOutlineSizeSE[e]) > n.outlineMax && (t = n.outlineMax), t *= 2 * n.outlineBase, y = Xe(r, u.plugOutline_strokeWidthSE, e, t) || y, y = Xe(r, u.plugOutline_inStrokeWidthSE, e, u.plugOutline_colorTraSE[e] ? t - se / (u.line_strokeWidth / ue.lineSize) / s.plugSizeSE[e] * 2 : t / 2) || y) + }), y)), + (t.faces || U.line || U.plug || U.lineOutline || U.plugOutline) && (U.faces = (g = (m = e).curStats, _ = m.aplStats, v = m.events, E = !1, !g.line_altColor && Xe(m, _, "line_color", S = g.line_color, v.apl_line_color) && (m.lineFace.style.stroke = S, E = !0), Xe(m, _, "line_strokeWidth", S = g.line_strokeWidth, v.apl_line_strokeWidth) && (m.lineShape.style.strokeWidth = S + "px", E = !0, (oe || ie) && (je(m, m.lineShape), ie && (je(m, m.lineFace), je(m, m.lineMaskCaps)))), Xe(m, _, "lineOutline_enabled", S = g.lineOutline_enabled, v.apl_lineOutline_enabled) && (m.lineOutlineFace.style.display = S ? "inline": "none", E = !0), g.lineOutline_enabled && (Xe(m, _, "lineOutline_color", S = g.lineOutline_color, v.apl_lineOutline_color) && (m.lineOutlineFace.style.stroke = S, E = !0), Xe(m, _, "lineOutline_strokeWidth", S = g.lineOutline_strokeWidth, v.apl_lineOutline_strokeWidth) && (m.lineOutlineMaskShape.style.strokeWidth = S + "px", E = !0, ie && (je(m, m.lineOutlineMaskCaps), je(m, m.lineOutlineFace))), Xe(m, _, "lineOutline_inStrokeWidth", S = g.lineOutline_inStrokeWidth, v.apl_lineOutline_inStrokeWidth) && (m.lineMaskShape.style.strokeWidth = S + "px", E = !0, ie && (je(m, m.lineOutlineMaskCaps), je(m, m.lineOutlineFace)))), Xe(m, _, "plug_enabled", S = g.plug_enabled, v.apl_plug_enabled) && (m.plugsFace.style.display = S ? "inline": "none", E = !0), g.plug_enabled && [0, 1].forEach(function(n) { + var e = g.plug_plugSE[n], + t = e !== Y ? X[q[e]] : null, + a = Ze(n, t); + Xe(m, _.plug_enabledSE, n, S = g.plug_enabledSE[n], v.apl_plug_enabledSE) && (m.plugsFace.style[a.prop] = S ? "url(#" + m.plugMarkerIdSE[n] + ")": "none", E = !0), + g.plug_enabledSE[n] && (Xe(m, _.plug_plugSE, n, e, v.apl_plug_plugSE) && (m.plugFaceSE[n].href.baseVal = "#" + t.elmId, Ue(m, m.plugMarkerSE[n], a.orient, t.bBox, m.svg, m.plugMarkerShapeSE[n], m.plugsFace), E = !0, oe && je(m, m.plugsFace)), Xe(m, _.plug_colorSE, n, S = g.plug_colorSE[n], v.apl_plug_colorSE) && (m.plugFaceSE[n].style.fill = S, E = !0, (le || re || ie) && !g.line_colorTra && je(m, ie ? m.lineMaskCaps: m.capsMaskLine)), ["markerWidth", "markerHeight"].forEach(function(e) { + var t = "plug_" + e + "SE"; + Xe(m, _[t], n, S = g[t][n], v["apl_" + t]) && (m.plugMarkerSE[n][e].baseVal.value = S, E = !0) + }), Xe(m, _.plugOutline_enabledSE, n, S = g.plugOutline_enabledSE[n], v.apl_plugOutline_enabledSE) && (S ? (m.plugFaceSE[n].style.mask = "url(#" + m.plugMaskIdSE[n] + ")", m.plugOutlineFaceSE[n].style.display = "inline") : (m.plugFaceSE[n].style.mask = "none", m.plugOutlineFaceSE[n].style.display = "none"), E = !0), g.plugOutline_enabledSE[n] && (Xe(m, _.plugOutline_plugSE, n, e, v.apl_plugOutline_plugSE) && (m.plugOutlineFaceSE[n].href.baseVal = m.plugMaskShapeSE[n].href.baseVal = m.plugOutlineMaskShapeSE[n].href.baseVal = "#" + t.elmId, [m.plugMaskSE[n], m.plugOutlineMaskSE[n]].forEach(function(e) { + e.x.baseVal.value = t.bBox.left, + e.y.baseVal.value = t.bBox.top, + e.width.baseVal.value = t.bBox.width, + e.height.baseVal.value = t.bBox.height + }), E = !0), Xe(m, _.plugOutline_colorSE, n, S = g.plugOutline_colorSE[n], v.apl_plugOutline_colorSE) && (m.plugOutlineFaceSE[n].style.fill = S, E = !0, ie && (je(m, m.lineMaskCaps), je(m, m.lineOutlineMaskCaps))), Xe(m, _.plugOutline_strokeWidthSE, n, S = g.plugOutline_strokeWidthSE[n], v.apl_plugOutline_strokeWidthSE) && (m.plugOutlineMaskShapeSE[n].style.strokeWidth = S + "px", E = !0), Xe(m, _.plugOutline_inStrokeWidthSE, n, S = g.plugOutline_inStrokeWidthSE[n], v.apl_plugOutline_inStrokeWidthSE) && (m.plugMaskShapeSE[n].style.strokeWidth = S + "px", E = !0))) + }), E)), + (t.position || U.line || U.plug) && (U.position = Ke(e)), + (t.path || U.position) && (U.path = (k = (x = e).curStats, I = x.aplStats, M = x.pathList.animVal || x.pathList.baseVal, w = k.path_edge, C = !1, M && (w.x1 = w.x2 = M[0][0].x, w.y1 = w.y2 = M[0][0].y, k.path_pathData = b = Be(M, + function(e) { + e.x < w.x1 && (w.x1 = e.x), + e.y < w.y1 && (w.y1 = e.y), + e.x > w.x2 && (w.x2 = e.x), + e.y > w.y2 && (w.y2 = e.y) + }), Fe(b, I.path_pathData) && (x.linePath.setPathData(b), I.path_pathData = b, C = !0, ie ? (je(x, x.plugsFace), je(x, x.lineMaskCaps)) : oe && je(x, x.linePath), x.events.apl_path && x.events.apl_path.forEach(function(e) { + e(x, b) + }))), C)), + U.viewBox = (M = (O = e).curStats, I = O.aplStats, C = M.path_edge, L = M.viewBox_bBox, A = I.viewBox_bBox, V = O.svg.viewBox.baseVal, P = O.svg.style, N = !1, I = Math.max(M.line_strokeWidth / 2, M.viewBox_plugBCircleSE[0] || 0, M.viewBox_plugBCircleSE[1] || 0), T = { + x1: C.x1 - I, + y1: C.y1 - I, + x2: C.x2 + I, + y2: C.y2 + I + }, + O.events.new_edge4viewBox && O.events.new_edge4viewBox.forEach(function(e) { + e(O, T) + }), L.x = M.lineMask_x = M.lineOutlineMask_x = M.maskBGRect_x = T.x1, L.y = M.lineMask_y = M.lineOutlineMask_y = M.maskBGRect_y = T.y1, L.width = T.x2 - T.x1, L.height = T.y2 - T.y1, ["x", "y", "width", "height"].forEach(function(e) { + // console.log(2222222, e) + var t; (t = L[e]) !== A[e] && (V[e] = A[e] = t, P[Q[e]] = t + ("x" === e || "y" === e ? O.bodyOffset[e] : 0) + "px", N = !0) + console.log(333333, t, L, C) + }), N), + U.mask = (R = (W = e).curStats, F = W.aplStats, G = !1, R.plug_enabled ? [0, 1].forEach(function(e) { + R.capsMaskMarker_enabledSE[e] = R.plug_enabledSE[e] && R.plug_colorTraSE[e] || R.plugOutline_enabledSE[e] && R.plugOutline_colorTraSE[e] + }) : R.capsMaskMarker_enabledSE[0] = R.capsMaskMarker_enabledSE[1] = !1, R.capsMaskMarker_enabled = R.capsMaskMarker_enabledSE[0] || R.capsMaskMarker_enabledSE[1], R.lineMask_outlineMode = R.lineOutline_enabled, R.caps_enabled = R.capsMaskMarker_enabled || R.capsMaskAnchor_enabledSE[0] || R.capsMaskAnchor_enabledSE[1], R.lineMask_enabled = R.caps_enabled || R.lineMask_outlineMode, (R.lineMask_enabled && !R.lineMask_outlineMode || R.lineOutline_enabled) && ["x", "y"].forEach(function(e) { + var t = "maskBGRect_" + e; + Xe(W, F, t, B = R[t]) && (W.maskBGRect[e].baseVal.value = B, G = !0) + }), Xe(W, F, "lineMask_enabled", B = R.lineMask_enabled) && (W.lineFace.style.mask = B ? "url(#" + W.lineMaskId + ")": "none", G = !0, re && je(W, W.lineMask)), R.lineMask_enabled && (Xe(W, F, "lineMask_outlineMode", B = R.lineMask_outlineMode) && (B ? (W.lineMaskBG.style.display = "none", W.lineMaskShape.style.display = "inline") : (W.lineMaskBG.style.display = "inline", W.lineMaskShape.style.display = "none"), G = !0), ["x", "y"].forEach(function(e) { + var t = "lineMask_" + e; + Xe(W, F, t, B = R[t]) && (W.lineMask[e].baseVal.value = B, G = !0) + }), Xe(W, F, "caps_enabled", B = R.caps_enabled) && (W.lineMaskCaps.style.display = W.lineOutlineMaskCaps.style.display = B ? "inline": "none", G = !0, re && je(W, W.capsMaskLine)), R.caps_enabled && ([0, 1].forEach(function(e) { + var t; + Xe(W, F.capsMaskAnchor_enabledSE, e, B = R.capsMaskAnchor_enabledSE[e]) && (W.capsMaskAnchorSE[e].style.display = B ? "inline": "none", G = !0, re && je(W, W.lineMask)), + R.capsMaskAnchor_enabledSE[e] && (Fe(t = R.capsMaskAnchor_pathDataSE[e], F.capsMaskAnchor_pathDataSE[e]) && (W.capsMaskAnchorSE[e].setPathData(t), F.capsMaskAnchor_pathDataSE[e] = t, G = !0), Xe(W, F.capsMaskAnchor_strokeWidthSE, e, B = R.capsMaskAnchor_strokeWidthSE[e]) && (W.capsMaskAnchorSE[e].style.strokeWidth = B + "px", G = !0)) + }), Xe(W, F, "capsMaskMarker_enabled", B = R.capsMaskMarker_enabled) && (W.capsMaskLine.style.display = B ? "inline": "none", G = !0), R.capsMaskMarker_enabled && [0, 1].forEach(function(n) { + var e = R.capsMaskMarker_plugSE[n], + t = e !== Y ? X[q[e]] : null, + a = Ze(n, t); + Xe(W, F.capsMaskMarker_enabledSE, n, B = R.capsMaskMarker_enabledSE[n]) && (W.capsMaskLine.style[a.prop] = B ? "url(#" + W.lineMaskMarkerIdSE[n] + ")": "none", G = !0), + R.capsMaskMarker_enabledSE[n] && (Xe(W, F.capsMaskMarker_plugSE, n, e) && (W.capsMaskMarkerShapeSE[n].href.baseVal = "#" + t.elmId, Ue(W, W.capsMaskMarkerSE[n], a.orient, t.bBox, W.svg, W.capsMaskMarkerShapeSE[n], W.capsMaskLine), G = !0, oe && (je(W, W.capsMaskLine), je(W, W.lineFace))), ["markerWidth", "markerHeight"].forEach(function(e) { + var t = "capsMaskMarker_" + e + "SE"; + Xe(W, F[t], n, B = R[t][n]) && (W.capsMaskMarkerSE[n][e].baseVal.value = B, G = !0) + })) + }))), R.lineOutline_enabled && ["x", "y"].forEach(function(e) { + var t = "lineOutlineMask_" + e; + Xe(W, F, t, B = R[t]) && (W.lineOutlineMask[e].baseVal.value = B, G = !0) + }), G), + t.effect && (j = (D = e).curStats, H = D.aplStats, Object.keys(Z).forEach(function(e) { + var t = Z[e], + n = e + "_enabled", + a = e + "_options", + e = j[a]; + Xe(D, H, n, z = j[n]) ? (z && (H[a] = we(e)), t[z ? "init": "remove"](D)) : z && ke(e, H[a]) && (t.remove(D), H[n] = !0, H[a] = we(e), t.init(D)) + })), + (le || re) && U.line && !U.path && je(e, e.lineShape), + le && U.plug && !U.line && je(e, e.plugsFace), + He(e) + } + function et(e, t) { + return { + duration: (pe(e.duration) && 0 < e.duration ? e: t).duration, + timing: g.validTiming(e.timing) ? e.timing: we(t.timing) + } + } + function tt(e, t, n, a) { + var i = e.curStats, + o = e.aplStats, + l = {}; + function r() { ["show_on", "show_effect", "show_animOptions"].forEach(function(e) { + o[e] = i[e] + }) + } + i.show_on = t, + n && w[n] && (i.show_effect = n, i.show_animOptions = et(he(a) ? a: {}, + w[n].defaultAnimOptions)), + l.show_on = i.show_on !== o.show_on, + l.show_effect = i.show_effect !== o.show_effect, + l.show_animOptions = ke(i.show_animOptions, o.show_animOptions), + l.show_effect || l.show_animOptions ? i.show_inAnim ? (n = l.show_effect ? w[o.show_effect].stop(e, !0, !0) : w[o.show_effect].stop(e), r(), w[o.show_effect].init(e, n)) : l.show_on && (o.show_effect && l.show_effect && w[o.show_effect].stop(e, !0, !0), r(), w[o.show_effect].init(e)) : l.show_on && (r(), w[o.show_effect].start(e)) + } + function nt(e, t, n) { + n = { + props: e, + optionName: n + }; + return e.attachments.indexOf(t) < 0 && (!t.conf.bind || t.conf.bind(t, n)) && (e.attachments.push(t), t.boundTargets.push(n), 1) + } + function at(n, a, e) { + var i = n.attachments.indexOf(a); - 1 < i && n.attachments.splice(i, 1), + a.boundTargets.some(function(e, t) { + return e.props === n && (a.conf.unbind && a.conf.unbind(a, e), i = t, !0) + }) && (a.boundTargets.splice(i, 1), e || ze(function() { + a.boundTargets.length || o(a) + })) + } + function it(s, u) { + var i, n, e, t, a, o, l, r, h, p, c, d, f, y, m, S = s.options, + g = {}; + function _(e, t, n, a, i) { + var o = {}; + return n ? null != a ? (o.container = e[n], o.key = a) : (o.container = e, o.key = n) : (o.container = e, o.key = t), + o. + default = i, + o.acceptsAuto = null == o. + default, + o + } + function v(e, t, n, a, i, o, l) { + var r, s, u, l = _(e, n, i, o, l); + return null != t[n] && (s = (t[n] + "").toLowerCase()) && (l.acceptsAuto && s === D || (u = a[s])) && u !== l.container[l.key] && (l.container[l.key] = u, r = !0), + null != l.container[l.key] || l.acceptsAuto || (l.container[l.key] = l. + default, r = !0), + r + } + function E(e, t, n, a, i, o, l, r, s) { + var u, h, p, c, l = _(e, n, i, o, l); + if (!a) { + if (null == l. + default) throw new Error("Invalid `type`: " + n); + a = typeof l. + default + } + return null != t[n] && (l.acceptsAuto && (t[n] + "").toLowerCase() === D || (p = h = t[n], ("number" === (c = a) ? pe(p) : typeof p === c) && (h = s && "string" === a && h ? h.trim() : h, 1) && (!r || r(h)))) && h !== l.container[l.key] && (l.container[l.key] = h, u = !0), + null != l.container[l.key] || l.acceptsAuto || (l.container[l.key] = l. + default, u = !0), + u + } + if (u = u || {}, + ["start", "end"].forEach(function(e, t) { + var n = u[e], + a = !1; + if (n && (Me(n) || (a = I(n, "anchor"))) && n !== S.anchorSE[t]) { + if (!1 !== s.optionIsAttach.anchorSE[t] && at(s, _e[S.anchorSE[t]._id]), a && !nt(s, _e[n._id], e)) throw new Error("Can't bind attachment"); + S.anchorSE[t] = n, + s.optionIsAttach.anchorSE[t] = a, + i = g.position = !0 + } + }), !S.anchorSE[0] || !S.anchorSE[1] || S.anchorSE[0] === S.anchorSE[1]) throw new Error("`start` and `end` are required."); + function x(e) { + var t = a.appendChild(y.createElementNS(ae, "mask")); + return t.id = e, + t.maskUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE, + [t.x, t.y, t.width, t.height].forEach(function(e) { + e.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0) + }), + t + } + function b(e) { + var t = a.appendChild(y.createElementNS(ae, "marker")); + return t.id = e, + t.markerUnits.baseVal = SVGMarkerElement.SVG_MARKERUNITS_STROKEWIDTH, + t.viewBox.baseVal || t.setAttribute("viewBox", "0 0 0 0"), + t + } + function k(e) { + return [e.width, e.height].forEach(function(e) { + e.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 100) + }), + e + } + i && (c = function(e, t) { + var n, a; + if (! (e = Ce(e)) || !(n = Ce(t))) throw new Error("Cannot get frames."); + return e.length && n.length && (e.reverse(), n.reverse(), e.some(function(t) { + return n.some(function(e) { + return e === t && (a = e.contentWindow, !0) + }) + })), + a || window + } (!1 !== s.optionIsAttach.anchorSE[0] ? _e[S.anchorSE[0]._id].element: S.anchorSE[0], !1 !== s.optionIsAttach.anchorSE[1] ? _e[S.anchorSE[1]._id].element: S.anchorSE[1])) !== s.baseWindow && (e = c, f = (n = s).aplStats, y = e.document, m = C + "-" + n._id, n.pathList = {}, + Ye(f, de), Object.keys(Z).forEach(function(e) { + var t = e + "_enabled"; + f[t] && (Z[e].remove(n), f[t] = !1) + }), n.baseWindow && n.svg && n.baseWindow.document.body.removeChild(n.svg), Qe(n.baseWindow = e), n.bodyOffset = qe(e), n.svg = t = y.createElementNS(ae, "svg"), t.className.baseVal = C, t.viewBox.baseVal || t.setAttribute("viewBox", "0 0 0 0"), n.defs = a = t.appendChild(y.createElementNS(ae, "defs")), n.linePath = l = a.appendChild(y.createElementNS(ae, "path")), l.id = r = m + "-line-path", l.className.baseVal = C + "-line-path", re && (l.style.fill = "none"), n.lineShape = l = a.appendChild(y.createElementNS(ae, "use")), l.id = h = m + "-line-shape", l.href.baseVal = "#" + r, (o = a.appendChild(y.createElementNS(ae, "g"))).id = p = m + "-caps", n.capsMaskAnchorSE = [0, 1].map(function() { + var e = o.appendChild(y.createElementNS(ae, "path")); + return e.className.baseVal = C + "-caps-mask-anchor", + e + }), n.lineMaskMarkerIdSE = [m + "-caps-mask-marker-0", m + "-caps-mask-marker-1"], n.capsMaskMarkerSE = [0, 1].map(function(e) { + return b(n.lineMaskMarkerIdSE[e]) + }), n.capsMaskMarkerShapeSE = [0, 1].map(function(e) { + e = n.capsMaskMarkerSE[e].appendChild(y.createElementNS(ae, "use")); + return e.className.baseVal = C + "-caps-mask-marker-shape", + e + }), n.capsMaskLine = l = o.appendChild(y.createElementNS(ae, "use")), l.className.baseVal = C + "-caps-mask-line", l.href.baseVal = "#" + h, n.maskBGRect = l = k(a.appendChild(y.createElementNS(ae, "rect"))), l.id = c = m + "-mask-bg-rect", l.className.baseVal = C + "-mask-bg-rect", re && (l.style.fill = "white"), n.lineMask = k(x(n.lineMaskId = m + "-line-mask")), n.lineMaskBG = l = n.lineMask.appendChild(y.createElementNS(ae, "use")), l.href.baseVal = "#" + c, n.lineMaskShape = l = n.lineMask.appendChild(y.createElementNS(ae, "use")), l.className.baseVal = C + "-line-mask-shape", l.href.baseVal = "#" + r, l.style.display = "none", n.lineMaskCaps = l = n.lineMask.appendChild(y.createElementNS(ae, "use")), l.href.baseVal = "#" + p, n.lineOutlineMask = k(x(e = m + "-line-outline-mask")), (l = n.lineOutlineMask.appendChild(y.createElementNS(ae, "use"))).href.baseVal = "#" + c, n.lineOutlineMaskShape = l = n.lineOutlineMask.appendChild(y.createElementNS(ae, "use")), l.className.baseVal = C + "-line-outline-mask-shape", l.href.baseVal = "#" + r, n.lineOutlineMaskCaps = l = n.lineOutlineMask.appendChild(y.createElementNS(ae, "use")), l.href.baseVal = "#" + p, n.face = t.appendChild(y.createElementNS(ae, "g")), n.lineFace = l = n.face.appendChild(y.createElementNS(ae, "use")), l.href.baseVal = "#" + h, n.lineOutlineFace = l = n.face.appendChild(y.createElementNS(ae, "use")), l.href.baseVal = "#" + h, l.style.mask = "url(#" + e + ")", l.style.display = "none", n.plugMaskIdSE = [m + "-plug-mask-0", m + "-plug-mask-1"], n.plugMaskSE = [0, 1].map(function(e) { + return x(n.plugMaskIdSE[e]) + }), n.plugMaskShapeSE = [0, 1].map(function(e) { + e = n.plugMaskSE[e].appendChild(y.createElementNS(ae, "use")); + return e.className.baseVal = C + "-plug-mask-shape", + e + }), d = [], n.plugOutlineMaskSE = [0, 1].map(function(e) { + return x(d[e] = m + "-plug-outline-mask-" + e) + }), n.plugOutlineMaskShapeSE = [0, 1].map(function(e) { + e = n.plugOutlineMaskSE[e].appendChild(y.createElementNS(ae, "use")); + return e.className.baseVal = C + "-plug-outline-mask-shape", + e + }), n.plugMarkerIdSE = [m + "-plug-marker-0", m + "-plug-marker-1"], n.plugMarkerSE = [0, 1].map(function(e) { + e = b(n.plugMarkerIdSE[e]); + return re && (e.markerUnits.baseVal = SVGMarkerElement.SVG_MARKERUNITS_USERSPACEONUSE), + e + }), n.plugMarkerShapeSE = [0, 1].map(function(e) { + return n.plugMarkerSE[e].appendChild(y.createElementNS(ae, "g")) + }), n.plugFaceSE = [0, 1].map(function(e) { + return n.plugMarkerShapeSE[e].appendChild(y.createElementNS(ae, "use")) + }), n.plugOutlineFaceSE = [0, 1].map(function(e) { + var t = n.plugMarkerShapeSE[e].appendChild(y.createElementNS(ae, "use")); + return t.style.mask = "url(#" + d[e] + ")", + t.style.display = "none", + t + }), n.plugsFace = l = n.face.appendChild(y.createElementNS(ae, "use")), l.className.baseVal = C + "-plugs-face", l.href.baseVal = "#" + h, l.style.display = "none", n.curStats.show_inAnim ? (n.isShown = 1, w[f.show_effect].stop(n, !0)) : n.isShown || (t.style.visibility = "hidden"), y.body.appendChild(t), [0, 1, 2].forEach(function(e) { + var t, e = n.options.labelSEM[e]; + e && I(e, "label") && (t = _e[e._id]).conf.initSvg && t.conf.initSvg(t, n) + }), g.line = g.plug = g.lineOutline = g.plugOutline = g.faces = g.effect = !0), + g.position = v(S, u, "path", R, null, null, ue.path) || g.position, + g.position = v(S, u, "startSocket", V, "socketSE", 0) || g.position, + g.position = v(S, u, "endSocket", V, "socketSE", 1) || g.position, + [u.startSocketGravity, u.endSocketGravity].forEach(function(e, t) { + var n, a, i = !1; + null != e && (Array.isArray(e) ? pe(e[0]) && pe(e[1]) && (i = [e[0], e[1]], Array.isArray(S.socketGravitySE[t]) && (n = i, a = S.socketGravitySE[t], n.length === a.length && n.every(function(e, t) { + return e === a[t] + })) && (i = !1)) : ((e + "").toLowerCase() === D ? i = null: pe(e) && 0 <= e && (i = e), i === S.socketGravitySE[t] && (i = !1)), !1 !== i && (S.socketGravitySE[t] = i, g.position = !0)) + }), + g.line = E(S, u, "color", null, "lineColor", null, ue.lineColor, null, !0) || g.line, + g.line = E(S, u, "size", null, "lineSize", null, ue.lineSize, + function(e) { + return 0 < e + }) || g.line, + ["startPlug", "endPlug"].forEach(function(e, t) { + g.plug = v(S, u, e, F, "plugSE", t, ue.plugSE[t]) || g.plug, + g.plug = E(S, u, e + "Color", "string", "plugColorSE", t, null, null, !0) || g.plug, + g.plug = E(S, u, e + "Size", null, "plugSizeSE", t, ue.plugSizeSE[t], + function(e) { + return 0 < e + }) || g.plug + }), + g.lineOutline = E(S, u, "outline", null, "lineOutlineEnabled", null, ue.lineOutlineEnabled) || g.lineOutline, + g.lineOutline = E(S, u, "outlineColor", null, "lineOutlineColor", null, ue.lineOutlineColor, null, !0) || g.lineOutline, + g.lineOutline = E(S, u, "outlineSize", null, "lineOutlineSize", null, ue.lineOutlineSize, + function(e) { + return 0 < e && e <= .48 + }) || g.lineOutline, + ["startPlugOutline", "endPlugOutline"].forEach(function(e, t) { + g.plugOutline = E(S, u, e, null, "plugOutlineEnabledSE", t, ue.plugOutlineEnabledSE[t]) || g.plugOutline, + g.plugOutline = E(S, u, e + "Color", "string", "plugOutlineColorSE", t, null, null, !0) || g.plugOutline, + g.plugOutline = E(S, u, e + "Size", null, "plugOutlineSizeSE", t, ue.plugOutlineSizeSE[t], + function(e) { + return 1 <= e + }) || g.plugOutline + }), + ["startLabel", "endLabel", "middleLabel"].forEach(function(e, t) { + var n, a, i, o = u[e], + l = S.labelSEM[t] && !s.optionIsAttach.labelSEM[t] ? _e[S.labelSEM[t]._id].text: S.labelSEM[t], + r = !1; + if ((n = "string" == typeof o) && (o = o.trim()), (n || o && (r = I(o, "label"))) && o !== l) { + if (S.labelSEM[t] && (at(s, _e[S.labelSEM[t]._id]), S.labelSEM[t] = ""), o) { + if (r ? (a = _e[(i = o)._id]).boundTargets.slice().forEach(function(e) { + a.conf.removeOption(a, e) + }) : i = new M(O.captionLabel, [o]), !nt(s, _e[i._id], e)) throw new Error("Can't bind attachment"); + S.labelSEM[t] = i + } + s.optionIsAttach.labelSEM[t] = r + } + }), + Object.keys(Z).forEach(function(a) { + var e, t, o = Z[a], + n = a + "_enabled", + i = a + "_options"; + function l(a) { + var i = {}; + return o.optionsConf.forEach(function(e) { + var t = e[0], + n = e[3]; + null == e[4] || i[n] || (i[n] = []), + ("function" == typeof t ? t: "id" === t ? v: E).apply(null, [i, a].concat(e.slice(1))) + }), + i + } + function r(e) { + var t, n = a + "_animOptions"; + return e.hasOwnProperty("animation") ? he(e.animation) ? t = s.curStats[n] = et(e.animation, o.defaultAnimOptions) : (t = !!e.animation, s.curStats[n] = t ? et({}, + o.defaultAnimOptions) : null) : (t = !!o.defaultEnabled, s.curStats[n] = t ? et({}, + o.defaultAnimOptions) : null), + t + } + u.hasOwnProperty(a) && (e = u[a], he(e) ? (s.curStats[n] = !0, t = s.curStats[i] = l(e), o.anim && (s.curStats[i].animation = r(e))) : (t = s.curStats[n] = !!e) && (s.curStats[i] = l({}), o.anim && (s.curStats[i].animation = r({}))), ke(t, S[a]) && (S[a] = t, g.effect = !0)) + }), + $e(s, g) + } + function ot(e, t, n) { + var a = { + options: { + anchorSE: [], + socketSE: [], + socketGravitySE: [], + plugSE: [], + plugColorSE: [], + plugSizeSE: [], + plugOutlineEnabledSE: [], + plugOutlineColorSE: [], + plugOutlineSizeSE: [], + labelSEM: ["", "", ""] + }, + optionIsAttach: { + anchorSE: [!1, !1], + labelSEM: [!1, !1, !1] + }, + curStats: {}, + aplStats: {}, + attachments: [], + events: {}, + reflowTargets: [] + }; + Ye(a.curStats, de), + Ye(a.aplStats, de), + Object.keys(Z).forEach(function(e) { + var t = Z[e].stats; + Ye(a.curStats, t), + Ye(a.aplStats, t), + a.options[e] = !1 + }), + Ye(a.curStats, fe), + Ye(a.aplStats, fe), + a.curStats.show_effect = ye, + a.curStats.show_animOptions = we(w[ye].defaultAnimOptions), + Object.defineProperty(this, "_id", { + value: ++ge + }), + a._id = this._id, + Se[this._id] = a, + 1 === arguments.length && (n = e, e = null), + n = n || {}, + (e || t) && (n = we(n), e && (n.start = e), t && (n.end = t)), + a.isShown = a.aplStats.show_on = !n.hide, + this.setOptions(n) + } + function lt(n) { + return function(e) { + var t = {}; + t[n] = e, + this.setOptions(t) + } + } + function rt(e, t) { + var n, a = { + conf: e, + curStats: {}, + aplStats: {}, + boundTargets: [] + }, + i = {}; + e.argOptions.every(function(e) { + return ! (!t.length || ("string" == typeof e.type ? typeof t[0] !== e.type: "function" != typeof e.type || !e.type(t[0]))) && (i[e.optionName] = t.shift(), !0) + }), + n = t.length && he(t[0]) ? we(t[0]) : {}, + Object.keys(i).forEach(function(e) { + n[e] = i[e] + }), + e.stats && (Ye(a.curStats, e.stats), Ye(a.aplStats, e.stats)), + Object.defineProperty(this, "_id", { + value: ++ve + }), + Object.defineProperty(this, "isRemoved", { + get: function() { + return ! _e[this._id] + } + }), + a._id = this._id, + e.init && !e.init(a, n) || (_e[this._id] = a) + } + return Z = { + dash: { + stats: { + dash_len: {}, + dash_gap: {}, + dash_maxOffset: {} + }, + anim: !0, + defaultAnimOptions: { + duration: 1e3, + timing: "linear" + }, + optionsConf: [["type", "len", "number", null, null, null, + function(e) { + return 0 < e + }], ["type", "gap", "number", null, null, null, + function(e) { + return 0 < e + }]], + init: function(e) { + Ge(e, "apl_line_strokeWidth", Z.dash.update), + e.lineFace.style.strokeDashoffset = 0, + Z.dash.update(e) + }, + remove: function(e) { + var t = e.curStats; + De(e, "apl_line_strokeWidth", Z.dash.update), + t.dash_animId && (g.remove(t.dash_animId), t.dash_animId = null), + e.lineFace.style.strokeDasharray = "none", + e.lineFace.style.strokeDashoffset = 0, + Ye(e.aplStats, Z.dash.stats) + }, + update: function(t) { + var e, n = t.curStats, + a = t.aplStats, + i = a.dash_options, + o = !1; + n.dash_len = i.len || 2 * a.line_strokeWidth, + n.dash_gap = i.gap || a.line_strokeWidth, + n.dash_maxOffset = n.dash_len + n.dash_gap, + o = Xe(t, a, "dash_len", n.dash_len) || o, + (o = Xe(t, a, "dash_gap", n.dash_gap) || o) && (t.lineFace.style.strokeDasharray = a.dash_len + "," + a.dash_gap), + n.dash_animOptions ? (o = Xe(t, a, "dash_maxOffset", n.dash_maxOffset), a.dash_animOptions && (o || ke(n.dash_animOptions, a.dash_animOptions)) && (n.dash_animId && (e = g.stop(n.dash_animId), g.remove(n.dash_animId)), a.dash_animOptions = null), a.dash_animOptions || (n.dash_animId = g.add(function(e) { + return (1 - e) * a.dash_maxOffset + "px" + }, + function(e) { + t.lineFace.style.strokeDashoffset = e + }, + n.dash_animOptions.duration, 0, n.dash_animOptions.timing, !1, e), a.dash_animOptions = we(n.dash_animOptions))) : a.dash_animOptions && (n.dash_animId && (g.remove(n.dash_animId), n.dash_animId = null), t.lineFace.style.strokeDashoffset = 0, a.dash_animOptions = null) + } + }, + gradient: { + stats: { + gradient_colorSE: { + hasSE: !0 + }, + gradient_pointSE: { + hasSE: !0, + hasProps: !0 + } + }, + optionsConf: [["type", "startColor", "string", "colorSE", 0, null, null, !0], ["type", "endColor", "string", "colorSE", 1, null, null, !0]], + init: function(e) { + var a = e.baseWindow.document, + t = e.defs, + n = C + "-" + e._id + "-gradient"; + e.efc_gradient_gradient = t = t.appendChild(a.createElementNS(ae, "linearGradient")), + t.id = n, + t.gradientUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE, + [t.x1, t.y1, t.x2, t.y2].forEach(function(e) { + e.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0) + }), + e.efc_gradient_stopSE = [0, 1].map(function(t) { + var n = e.efc_gradient_gradient.appendChild(a.createElementNS(ae, "stop")); + try { + n.offset.baseVal = t + } catch(e) { + if (e.code !== DOMException.NO_MODIFICATION_ALLOWED_ERR) throw e; + n.setAttribute("offset", t) + } + return n + }), + Ge(e, "cur_plug_colorSE", Z.gradient.update), + Ge(e, "apl_path", Z.gradient.update), + e.curStats.line_altColor = !0, + e.lineFace.style.stroke = "url(#" + n + ")", + Z.gradient.update(e) + }, + remove: function(e) { + e.efc_gradient_gradient && (e.defs.removeChild(e.efc_gradient_gradient), e.efc_gradient_gradient = e.efc_gradient_stopSE = null), + De(e, "cur_plug_colorSE", Z.gradient.update), + De(e, "apl_path", Z.gradient.update), + e.curStats.line_altColor = !1, + e.lineFace.style.stroke = e.curStats.line_color, + Ye(e.aplStats, Z.gradient.stats) + }, + update: function(a) { + var e, i = a.curStats, + o = a.aplStats, + t = o.gradient_options, + n = a.pathList.animVal || a.pathList.baseVal; [0, 1].forEach(function(e) { + i.gradient_colorSE[e] = t.colorSE[e] || i.plug_colorSE[e] + }), + e = n[0][0], + i.gradient_pointSE[0] = { + x: e.x, + y: e.y + }, + e = (n = n[n.length - 1])[n.length - 1], + i.gradient_pointSE[1] = { + x: e.x, + y: e.y + }, + [0, 1].forEach(function(t) { + var n; + Xe(a, o.gradient_colorSE, t, n = i.gradient_colorSE[t]) && (re ? (n = Oe(n), a.efc_gradient_stopSE[t].style.stopColor = n[1], a.efc_gradient_stopSE[t].style.stopOpacity = n[0]) : a.efc_gradient_stopSE[t].style.stopColor = n), + ["x", "y"].forEach(function(e) { (n = i.gradient_pointSE[t][e]) !== o.gradient_pointSE[t][e] && (a.efc_gradient_gradient[e + (t + 1)].baseVal.value = o.gradient_pointSE[t][e] = n) + }) + }) + } + }, + dropShadow: { + stats: { + dropShadow_dx: {}, + dropShadow_dy: {}, + dropShadow_blur: {}, + dropShadow_color: {}, + dropShadow_opacity: {}, + dropShadow_x: {}, + dropShadow_y: {} + }, + optionsConf: [["type", "dx", null, null, null, 2], ["type", "dy", null, null, null, 4], ["type", "blur", null, null, null, 3, + function(e) { + return 0 <= e + }], ["type", "color", null, null, null, "#000", null, !0], ["type", "opacity", null, null, null, .8, + function(e) { + return 0 <= e && e <= 1 + }]], + init: function(t) { + var e, n, a, i, o = t.baseWindow.document, + l = t.defs, + r = C + "-" + t._id + "-dropShadow", + s = (e = o, n = r, i = {}, + "boolean" != typeof u && (u = !!window.SVGFEDropShadowElement && !re), i.elmsAppend = [i.elmFilter = o = e.createElementNS(ae, "filter")], o.filterUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE, o.x.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0), o.y.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0), o.width.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 100), o.height.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 100), o.id = n, u ? (i.elmOffset = i.elmBlur = a = o.appendChild(e.createElementNS(ae, "feDropShadow")), i.styleFlood = a.style) : (i.elmBlur = o.appendChild(e.createElementNS(ae, "feGaussianBlur")), i.elmOffset = a = o.appendChild(e.createElementNS(ae, "feOffset")), a.result.baseVal = "offsetblur", a = o.appendChild(e.createElementNS(ae, "feFlood")), i.styleFlood = a.style, (a = o.appendChild(e.createElementNS(ae, "feComposite"))).in2.baseVal = "offsetblur", a.operator.baseVal = SVGFECompositeElement.SVG_FECOMPOSITE_OPERATOR_IN, (a = o.appendChild(e.createElementNS(ae, "feMerge"))).appendChild(e.createElementNS(ae, "feMergeNode")), a.appendChild(e.createElementNS(ae, "feMergeNode")).in1.baseVal = "SourceGraphic"), i); ["elmFilter", "elmOffset", "elmBlur", "styleFlood", "elmsAppend"].forEach(function(e) { + t["efc_dropShadow_" + e] = s[e] + }), + s.elmsAppend.forEach(function(e) { + l.appendChild(e) + }), + t.face.setAttribute("filter", "url(#" + r + ")"), + Ge(t, "new_edge4viewBox", Z.dropShadow.adjustEdge), + Z.dropShadow.update(t) + }, + remove: function(e) { + var t = e.defs; + e.efc_dropShadow_elmsAppend && (e.efc_dropShadow_elmsAppend.forEach(function(e) { + t.removeChild(e) + }), e.efc_dropShadow_elmFilter = e.efc_dropShadow_elmOffset = e.efc_dropShadow_elmBlur = e.efc_dropShadow_styleFlood = e.efc_dropShadow_elmsAppend = null), + De(e, "new_edge4viewBox", Z.dropShadow.adjustEdge), + $e(e, {}), + e.face.removeAttribute("filter"), + Ye(e.aplStats, Z.dropShadow.stats) + }, + update: function(e) { + var t, n, a = e.curStats, + i = e.aplStats, + o = i.dropShadow_options; + a.dropShadow_dx = t = o.dx, + Xe(e, i, "dropShadow_dx", t) && (e.efc_dropShadow_elmOffset.dx.baseVal = t, n = !0), + a.dropShadow_dy = t = o.dy, + Xe(e, i, "dropShadow_dy", t) && (e.efc_dropShadow_elmOffset.dy.baseVal = t, n = !0), + a.dropShadow_blur = t = o.blur, + Xe(e, i, "dropShadow_blur", t) && (e.efc_dropShadow_elmBlur.setStdDeviation(t, t), n = !0), + n && $e(e, {}), + a.dropShadow_color = t = o.color, + Xe(e, i, "dropShadow_color", t) && (e.efc_dropShadow_styleFlood.floodColor = t), + a.dropShadow_opacity = t = o.opacity, + Xe(e, i, "dropShadow_opacity", t) && (e.efc_dropShadow_styleFlood.floodOpacity = t) + }, + adjustEdge: function(a, i) { + var e, o = a.curStats, + l = a.aplStats; + null != o.dropShadow_dx && (e = 3 * o.dropShadow_blur, (e = { + x1: i.x1 - e + o.dropShadow_dx, + y1: i.y1 - e + o.dropShadow_dy, + x2: i.x2 + e + o.dropShadow_dx, + y2: i.y2 + e + o.dropShadow_dy + }).x1 < i.x1 && (i.x1 = e.x1), e.y1 < i.y1 && (i.y1 = e.y1), e.x2 > i.x2 && (i.x2 = e.x2), e.y2 > i.y2 && (i.y2 = e.y2), ["x", "y"].forEach(function(e) { + var t, n = "dropShadow_" + e; + o[n] = t = i[e + "1"], + Xe(a, l, n, t) && (a.efc_dropShadow_elmFilter[e].baseVal.value = t) + })) + } + } + }, + Object.keys(Z).forEach(function(e) { + var t = Z[e], + n = t.stats; + n[e + "_enabled"] = { + iniValue: !1 + }, + n[e + "_options"] = { + hasProps: !0 + }, + t.anim && (n[e + "_animOptions"] = {}, + n[e + "_animId"] = {}) + }), + w = { + none: { + defaultAnimOptions: {}, + init: function(e, t) { + var n = e.curStats; + n.show_animId && (g.remove(n.show_animId), n.show_animId = null), + w.none.start(e, t) + }, + start: function(e, t) { + w.none.stop(e, !0) + }, + stop: function(e, t, n) { + var a = e.curStats; + return n = null != n ? n: e.aplStats.show_on, + a.show_inAnim = !1, + t && Je(e, n), + n ? 1 : 0 + } + }, + fade: { + defaultAnimOptions: { + duration: 300, + timing: "linear" + }, + init: function(n, e) { + var t = n.curStats, + a = n.aplStats; + t.show_animId && g.remove(t.show_animId), + t.show_animId = g.add(function(e) { + return e + }, + function(e, t) { + t ? w.fade.stop(n, !0) : (n.svg.style.opacity = e + "", ie && (je(n, n.svg), He(n))) + }, + a.show_animOptions.duration, 1, a.show_animOptions.timing, null, !1), + w.fade.start(n, e) + }, + start: function(e, t) { + var n, a = e.curStats; + a.show_inAnim && (n = g.stop(a.show_animId)), + Je(e, 1), + a.show_inAnim = !0, + g.start(a.show_animId, !e.aplStats.show_on, null != t ? t: n) + }, + stop: function(e, t, n) { + var a, i = e.curStats; + return n = null != n ? n: e.aplStats.show_on, + a = i.show_inAnim ? g.stop(i.show_animId) : n ? 1 : 0, + i.show_inAnim = !1, + t && (e.svg.style.opacity = n ? "": "0", Je(e, n)), + a + } + }, + draw: { + defaultAnimOptions: { + duration: 500, + timing: [.58, 0, .42, 1] + }, + init: function(n, e) { + var t = n.curStats, + a = n.aplStats, + o = n.pathList.baseVal, + i = Re(o), + l = i.segsLen, + r = i.lenAll; + t.show_animId && g.remove(t.show_animId), + t.show_animId = g.add(function(e) { + var t, n, a, i = -1; + if (0 === e) n = [[o[0][0], o[0][0]]]; + else if (1 === e) n = o; + else { + for (t = r * e, n = []; t >= l[++i];) n.push(o[i]), + t -= l[i]; + t && (2 === (a = o[i]).length ? n.push([a[0], Ve(a[0], a[1], t / l[i])]) : (e = Ne(a[0], a[1], a[2], a[3], We(a[0], a[1], a[2], a[3], t)), n.push([a[0], e.fromP1, e.fromP2, e]))) + } + return n + }, + function(e, t) { + t ? w.draw.stop(n, !0) : (n.pathList.animVal = e, $e(n, { + path: !0 + })) + }, + a.show_animOptions.duration, 1, a.show_animOptions.timing, null, !1), + w.draw.start(n, e) + }, + start: function(e, t) { + var n, a = e.curStats; + a.show_inAnim && (n = g.stop(a.show_animId)), + Je(e, 1), + a.show_inAnim = !0, + Ge(e, "apl_position", w.draw.update), + g.start(a.show_animId, !e.aplStats.show_on, null != t ? t: n) + }, + stop: function(e, t, n) { + var a, i = e.curStats; + return n = null != n ? n: e.aplStats.show_on, + a = i.show_inAnim ? g.stop(i.show_animId) : n ? 1 : 0, + i.show_inAnim = !1, + t && (e.pathList.animVal = n ? null: [[e.pathList.baseVal[0][0], e.pathList.baseVal[0][0]]], $e(e, { + path: !0 + }), Je(e, n)), + a + }, + update: function(e) { + De(e, "apl_position", w.draw.update), + e.curStats.show_inAnim ? w.draw.init(e, w.draw.stop(e)) : e.aplStats.show_animOptions = {} + } + } + }, + [["start", "anchorSE", 0], ["end", "anchorSE", 1], ["color", "lineColor"], ["size", "lineSize"], ["startSocketGravity", "socketGravitySE", 0], ["endSocketGravity", "socketGravitySE", 1], ["startPlugColor", "plugColorSE", 0], ["endPlugColor", "plugColorSE", 1], ["startPlugSize", "plugSizeSE", 0], ["endPlugSize", "plugSizeSE", 1], ["outline", "lineOutlineEnabled"], ["outlineColor", "lineOutlineColor"], ["outlineSize", "lineOutlineSize"], ["startPlugOutline", "plugOutlineEnabledSE", 0], ["endPlugOutline", "plugOutlineEnabledSE", 1], ["startPlugOutlineColor", "plugOutlineColorSE", 0], ["endPlugOutlineColor", "plugOutlineColorSE", 1], ["startPlugOutlineSize", "plugOutlineSizeSE", 0], ["endPlugOutlineSize", "plugOutlineSizeSE", 1]].forEach(function(e) { + var t = e[0], + n = e[1], + a = e[2]; + Object.defineProperty(ot.prototype, t, { + get: function() { + var e = null != a ? Se[this._id].options[n][a] : n ? Se[this._id].options[n] : Se[this._id].options[t]; + return null == e ? D: we(e) + }, + set: lt(t), + enumerable: !0 + }) + }), + [["path", R], ["startSocket", V, "socketSE", 0], ["endSocket", V, "socketSE", 1], ["startPlug", F, "plugSE", 0], ["endPlug", F, "plugSE", 1]].forEach(function(e) { + var a = e[0], + i = e[1], + o = e[2], + l = e[3]; + Object.defineProperty(ot.prototype, a, { + get: function() { + var t, n = null != l ? Se[this._id].options[o][l] : o ? Se[this._id].options[o] : Se[this._id].options[a]; + return n ? Object.keys(i).some(function(e) { + return i[e] === n && (t = e, !0) + }) ? t: new Error("It's broken") : D + }, + set: lt(a), + enumerable: !0 + }) + }), + Object.keys(Z).forEach(function(n) { + var a = Z[n]; + Object.defineProperty(ot.prototype, n, { + get: function() { + var s, e, t = Se[this._id].options[n]; + return he(t) ? (s = t, e = a.optionsConf.reduce(function(e, t) { + var n, a = t[0], + i = t[1], + o = t[2], + l = t[3], + t = t[4], + r = null != t ? s[l][t] : l ? s[l] : s[i]; + return e[i] = "id" === a ? r ? Object.keys(o).some(function(e) { + return o[e] === r && (n = e, !0) + }) ? n: new Error("It's broken") : D: null == r ? D: we(r), + e + }, + {}), a.anim && (e.animation = we(s.animation)), e) : t + }, + set: lt(n), + enumerable: !0 + }) + }), + ["startLabel", "endLabel", "middleLabel"].forEach(function(e, n) { + Object.defineProperty(ot.prototype, e, { + get: function() { + var e = Se[this._id], + t = e.options; + return t.labelSEM[n] && !e.optionIsAttach.labelSEM[n] ? _e[t.labelSEM[n]._id].text: t.labelSEM[n] || "" + }, + set: lt(e), + enumerable: !0 + }) + }), + ot.prototype.setOptions = function(e) { + return it(Se[this._id], e), + this + }, + ot.prototype.position = function() { + return $e(Se[this._id], { + position: !0 + }), + this + }, + ot.prototype.remove = function() { + var t = Se[this._id], + n = t.curStats; + Object.keys(Z).forEach(function(e) { + e += "_animId"; + n[e] && g.remove(n[e]) + }), + n.show_animId && g.remove(n.show_animId), + t.attachments.slice().forEach(function(e) { + at(t, e) + }), + t.baseWindow && t.svg && t.baseWindow.document.body.removeChild(t.svg), + delete Se[this._id] + }, + ot.prototype.show = function(e, t) { + return tt(Se[this._id], !0, e, t), + this + }, + ot.prototype.hide = function(e, t) { + return tt(Se[this._id], !1, e, t), + this + }, + o = function(t) { + t && _e[t._id] && (t.boundTargets.slice().forEach(function(e) { + at(e.props, t, !0) + }), t.conf.remove && t.conf.remove(t), delete _e[t._id]) + }, + rt.prototype.remove = function() { + var t = this, + n = _e[t._id]; + n && (n.boundTargets.slice().forEach(function(e) { + n.conf.removeOption(n, e) + }), ze(function() { + var e = _e[t._id]; + e && (console.error("LeaderLineAttachment was not removed by removeOption"), o(e)) + })) + }, + M = rt, + window.LeaderLineAttachment = M, + I = function(e, t) { + return e instanceof M && (!(e.isRemoved || t && _e[e._id].conf.type !== t) || null) + }, + O = { + pointAnchor: { + type: "anchor", + argOptions: [{ + optionName: "element", + type: Me + }], + init: function(e, t) { + return e.element = O.pointAnchor.checkElement(t.element), + e.x = O.pointAnchor.parsePercent(t.x, !0) || [.5, !0], + e.y = O.pointAnchor.parsePercent(t.y, !0) || [.5, !0], + !0 + }, + removeOption: function(e, t) { + var n = t.props, + a = {}, + i = e.element, + e = n.options.anchorSE["start" === t.optionName ? 1 : 0]; + i === e && (i = e === document.body ? new M(O.pointAnchor, [i]) : document.body), + a[t.optionName] = i, + it(n, a) + }, + getBBoxNest: function(e, t) { + var n = Le(e.element, t.baseWindow), + a = n.width, + t = n.height; + return n.width = n.height = 0, + n.left = n.right = n.left + e.x[0] * (e.x[1] ? a: 1), + n.top = n.bottom = n.top + e.y[0] * (e.y[1] ? t: 1), + n + }, + parsePercent: function(e, t) { + var n, a, i = !1; + return pe(e) ? a = e: "string" == typeof e && (n = m.exec(e)) && n[2] && (i = 0 !== (a = parseFloat(n[1]) / 100)), + null != a && (t || 0 <= a) ? [a, i] : null + }, + checkElement: function(e) { + if (null == e) e = document.body; + else if (!Me(e)) throw new Error("`element` must be Element"); + return e + } + }, + areaAnchor: { + type: "anchor", + argOptions: [{ + optionName: "element", + type: Me + }, + { + optionName: "shape", + type: "string" + }], + stats: { + color: {}, + strokeWidth: {}, + elementWidth: {}, + elementHeight: {}, + elementLeft: {}, + elementTop: {}, + pathListRel: {}, + bBoxRel: {}, + pathData: {}, + viewBoxBBox: { + hasProps: !0 + }, + dashLen: {}, + dashGap: {} + }, + init: function(a, e) { + var t, n = []; + return a.element = O.pointAnchor.checkElement(e.element), + "string" == typeof e.color && (a.color = e.color.trim()), + "string" == typeof e.fillColor && (a.fill = e.fillColor.trim()), + pe(e.size) && 0 <= e.size && (a.size = e.size), + e.dash && (a.dash = !0, pe(e.dash.len) && 0 < e.dash.len && (a.dashLen = e.dash.len), pe(e.dash.gap) && 0 < e.dash.gap && (a.dashGap = e.dash.gap)), + "circle" === e.shape ? a.shape = e.shape: "polygon" === e.shape && Array.isArray(e.points) && 3 <= e.points.length && e.points.every(function(e) { + var t = {}; + return ! (! (t.x = O.pointAnchor.parsePercent(e[0], !0)) || !(t.y = O.pointAnchor.parsePercent(e[1], !0))) && (n.push(t), (t.x[1] || t.y[1]) && (a.hasRatio = !0), !0) + }) ? (a.shape = e.shape, a.points = n) : (a.shape = "rect", a.radius = pe(e.radius) && 0 <= e.radius ? e.radius: 0), + "rect" !== a.shape && "circle" !== a.shape || (a.x = O.pointAnchor.parsePercent(e.x, !0) || [ - .05, !0], a.y = O.pointAnchor.parsePercent(e.y, !0) || [ - .05, !0], a.width = O.pointAnchor.parsePercent(e.width) || [1.1, !0], a.height = O.pointAnchor.parsePercent(e.height) || [1.1, !0], (a.x[1] || a.y[1] || a.width[1] || a.height[1]) && (a.hasRatio = !0)), + t = a.element.ownerDocument, + a.svg = e = t.createElementNS(ae, "svg"), + e.className.baseVal = C + "-areaAnchor", + e.viewBox.baseVal || e.setAttribute("viewBox", "0 0 0 0"), + a.path = e.appendChild(t.createElementNS(ae, "path")), + a.path.style.fill = a.fill || "none", + a.isShown = !1, + e.style.visibility = "hidden", + t.body.appendChild(e), + Qe(t = t.defaultView), + a.bodyOffset = qe(t), + a.updateColor = function() { + var e = a.curStats, + t = a.aplStats, + n = a.boundTargets.length ? a.boundTargets[0].props.curStats: null; + e.color = n = a.color || (n ? n.line_color: ue.lineColor), + Xe(a, t, "color", n) && (a.path.style.stroke = n) + }, + a.updateShow = function() { + Je(a, a.boundTargets.some(function(e) { + return ! 0 === e.props.isShown + })) + }, + !0 + }, + bind: function(e, t) { + t = t.props; + return e.color || Ge(t, "cur_line_color", e.updateColor), + Ge(t, "svgShow", e.updateShow), + ze(function() { + e.updateColor(), + e.updateShow() + }), + !0 + }, + unbind: function(e, t) { + t = t.props; + e.color || De(t, "cur_line_color", e.updateColor), + De(t, "svgShow", e.updateShow), + 1 < e.boundTargets.length && ze(function() { + e.updateColor(), + e.updateShow(), + O.areaAnchor.update(e) && e.boundTargets.forEach(function(e) { + $e(e.props, { + position: !0 + }) + }) + }) + }, + removeOption: function(e, t) { + O.pointAnchor.removeOption(e, t) + }, + remove: function(t) { + t.boundTargets.length && (console.error("LeaderLineAttachment was not unbound by remove"), t.boundTargets.forEach(function(e) { + O.areaAnchor.unbind(t, e) + })), + t.svg.parentNode.removeChild(t.svg) + }, + getStrokeWidth: function(e, t) { + return O.areaAnchor.update(e) && 1 < e.boundTargets.length && ze(function() { + e.boundTargets.forEach(function(e) { + e.props !== t && $e(e.props, { + position: !0 + }) + }) + }), + e.curStats.strokeWidth + }, + getPathData: function(e, t) { + var n = Le(e.element, t.baseWindow); + return Be(e.curStats.pathListRel, + function(e) { + e.x += n.left, + e.y += n.top + }) + }, + getBBoxNest: function(e, t) { + t = Le(e.element, t.baseWindow), + e = e.curStats.bBoxRel; + return { + left: e.left + t.left, + top: e.top + t.top, + right: e.right + t.left, + bottom: e.bottom + t.top, + width: e.width, + height: e.height + } + }, + update: function(t) { + var n, a, i, o, e, l, r, s, u, h, p, c, d, f, y, m, S = t.curStats, + g = t.aplStats, + _ = t.boundTargets.length ? t.boundTargets[0].props.curStats: null, + v = {}; + if (v.strokeWidth = Xe(t, S, "strokeWidth", null != t.size ? t.size: _ ? _.line_strokeWidth: ue.lineSize), n = Ie(t.element), v.elementWidth = Xe(t, S, "elementWidth", n.width), v.elementHeight = Xe(t, S, "elementHeight", n.height), v.elementLeft = Xe(t, S, "elementLeft", n.left), v.elementTop = Xe(t, S, "elementTop", n.top), v.strokeWidth || t.hasRatio && (v.elementWidth || v.elementHeight)) { + switch (t.shape) { + case "rect": + (c = { + left: t.x[0] * (t.x[1] ? n.width: 1), + top: t.y[0] * (t.y[1] ? n.height: 1), + width: t.width[0] * (t.width[1] ? n.width: 1), + height: t.height[0] * (t.height[1] ? n.height: 1) + }).right = c.left + c.width, + c.bottom = c.top + c.height, + p = S.strokeWidth / 2, + s = (r = Math.min(c.width, c.height)) ? r / 2 * Math.SQRT2 + p: 0, + h = (r = t.radius ? t.radius <= s ? t.radius: s: 0) ? (s = (r - p) / Math.SQRT2, h = [{ + x: c.left - (u = r - s), + y: c.top + s + }, + { + x: c.left + s, + y: c.top - u + }, + { + x: c.right - s, + y: c.top - u + }, + { + x: c.right + u, + y: c.top + s + }, + { + x: c.right + u, + y: c.bottom - s + }, + { + x: c.right - s, + y: c.bottom + u + }, + { + x: c.left + s, + y: c.bottom + u + }, + { + x: c.left - u, + y: c.bottom - s + }], S.pathListRel = [[h[0], { + x: h[0].x, + y: h[0].y - (p = r * te) + }, + { + x: h[1].x - p, + y: h[1].y + }, + h[1]]], h[1].x !== h[2].x && S.pathListRel.push([h[1], h[2]]), S.pathListRel.push([h[2], { + x: h[2].x + p, + y: h[2].y + }, + { + x: h[3].x, + y: h[3].y - p + }, + h[3]]), h[3].y !== h[4].y && S.pathListRel.push([h[3], h[4]]), S.pathListRel.push([h[4], { + x: h[4].x, + y: h[4].y + p + }, + { + x: h[5].x + p, + y: h[5].y + }, + h[5]]), h[5].x !== h[6].x && S.pathListRel.push([h[5], h[6]]), S.pathListRel.push([h[6], { + x: h[6].x - p, + y: h[6].y + }, + { + x: h[7].x, + y: h[7].y + p + }, + h[7]]), h[7].y !== h[0].y && S.pathListRel.push([h[7], h[0]]), S.pathListRel.push([]), u = r - s + S.strokeWidth / 2, [{ + x: c.left - u, + y: c.top - u + }, + { + x: c.right + u, + y: c.bottom + u + }]) : (u = S.strokeWidth / 2, h = [{ + x: c.left - u, + y: c.top - u + }, + { + x: c.right + u, + y: c.bottom + u + }], S.pathListRel = [[h[0], { + x: h[1].x, + y: h[0].y + }], [{ + x: h[1].x, + y: h[0].y + }, + h[1]], [h[1], { + x: h[0].x, + y: h[1].y + }], []], [{ + x: c.left - S.strokeWidth, + y: c.top - S.strokeWidth + }, + { + x: c.right + S.strokeWidth, + y: c.bottom + S.strokeWidth + }]), + S.bBoxRel = { + left: h[0].x, + top: h[0].y, + right: h[1].x, + bottom: h[1].y, + width: h[1].x - h[0].x, + height: h[1].y - h[0].y + }; + break; + case "circle": + (l = { + left: t.x[0] * (t.x[1] ? n.width: 1), + top: t.y[0] * (t.y[1] ? n.height: 1), + width: t.width[0] * (t.width[1] ? n.width: 1), + height: t.height[0] * (t.height[1] ? n.height: 1) + }).width || l.height || (l.width = l.height = 10), + l.width || (l.width = l.height), + l.height || (l.height = l.width), + l.right = l.left + l.width, + l.bottom = l.top + l.height, + p = l.left + l.width / 2, + r = l.top + l.height / 2, + e = S.strokeWidth / 2, + s = l.width / 2, + u = l.height / 2, + c = s * Math.SQRT2 + e, + h = u * Math.SQRT2 + e, + S.pathListRel = [[(e = [{ + x: p - c, + y: r + }, + { + x: p, + y: r - h + }, + { + x: p + c, + y: r + }, + { + x: p, + y: r + h + }])[0], { + x: e[0].x, + y: e[0].y - (p = h * te) + }, + { + x: e[1].x - (r = c * te), + y: e[1].y + }, + e[1]], [e[1], { + x: e[1].x + r, + y: e[1].y + }, + { + x: e[2].x, + y: e[2].y - p + }, + e[2]], [e[2], { + x: e[2].x, + y: e[2].y + p + }, + { + x: e[3].x + r, + y: e[3].y + }, + e[3]], [e[3], { + x: e[3].x - r, + y: e[3].y + }, + { + x: e[0].x, + y: e[0].y + p + }, + e[0]], []], + s = c - s + S.strokeWidth / 2, + u = h - u + S.strokeWidth / 2, + e = [{ + x: l.left - s, + y: l.top - u + }, + { + x: l.right + s, + y: l.bottom + u + }], + S.bBoxRel = { + left: e[0].x, + top: e[0].y, + right: e[1].x, + bottom: e[1].y, + width: e[1].x - e[0].x, + height: e[1].y - e[0].y + }; + break; + case "polygon": + t.points.forEach(function(e) { + var t = e.x[0] * (e.x[1] ? n.width: 1), + e = e.y[0] * (e.y[1] ? n.height: 1); + i ? (t < i.left && (i.left = t), t > i.right && (i.right = t), e < i.top && (i.top = e), e > i.bottom && (i.bottom = e)) : i = { + left: t, + right: t, + top: e, + bottom: e + }, + o ? S.pathListRel.push([o, { + x: t, + y: e + }]) : S.pathListRel = [], + o = { + x: t, + y: e + } + }), + S.pathListRel.push([]), + e = S.strokeWidth / 2, + e = [{ + x: i.left - e, + y: i.top - e + }, + { + x: i.right + e, + y: i.bottom + e + }], + S.bBoxRel = { + left: e[0].x, + top: e[0].y, + right: e[1].x, + bottom: e[1].y, + width: e[1].x - e[0].x, + height: e[1].y - e[0].y + } + } + v.pathListRel = v.bBoxRel = !0 + } + return (v.pathListRel || v.elementLeft || v.elementTop) && (S.pathData = Be(S.pathListRel, + function(e) { + e.x += n.left, + e.y += n.top + })), + Xe(t, g, "strokeWidth", a = S.strokeWidth) && (t.path.style.strokeWidth = a + "px"), + Fe(a = S.pathData, g.pathData) && (t.path.setPathData(a), g.pathData = a, v.pathData = !0), + t.dash && (!v.pathData && (!v.strokeWidth || t.dashLen && t.dashGap) || (S.dashLen = t.dashLen || 2 * S.strokeWidth, S.dashGap = t.dashGap || S.strokeWidth), v.dash = Xe(t, g, "dashLen", S.dashLen) || v.dash, v.dash = Xe(t, g, "dashGap", S.dashGap) || v.dash, v.dash && (t.path.style.strokeDasharray = g.dashLen + "," + g.dashGap)), + d = S.viewBoxBBox, + f = g.viewBoxBBox, + y = t.svg.viewBox.baseVal, + m = t.svg.style, + d.x = S.bBoxRel.left + n.left, + d.y = S.bBoxRel.top + n.top, + d.width = S.bBoxRel.width, + d.height = S.bBoxRel.height, + ["x", "y", "width", "height"].forEach(function(e) { (a = d[e]) !== f[e] && (y[e] = f[e] = a, m[Q[e]] = a + ("x" === e || "y" === e ? t.bodyOffset[e] : 0) + "px") + }), + v.strokeWidth || v.pathListRel || v.bBoxRel + } + }, + mouseHoverAnchor: { + type: "anchor", + argOptions: [{ + optionName: "element", + type: Me + }, + { + optionName: "showEffectName", + type: "string" + }], + style: { + backgroundImage: "url('data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cG9seWdvbiBwb2ludHM9IjI0LDAgMCw4IDgsMTEgMCwxOSA1LDI0IDEzLDE2IDE2LDI0IiBmaWxsPSJjb3JhbCIvPjwvc3ZnPg==')", + backgroundSize: "", + backgroundRepeat: "no-repeat", + backgroundColor: "#f8f881", + cursor: "default" + }, + hoverStyle: { + backgroundImage: "none", + backgroundColor: "#fadf8f" + }, + padding: { + top: 1, + right: 15, + bottom: 1, + left: 2 + }, + minHeight: 15, + backgroundPosition: { + right: 2, + top: 2 + }, + backgroundSize: { + width: 12, + height: 12 + }, + dirKeys: [["top", "Top"], ["right", "Right"], ["bottom", "Bottom"], ["left", "Left"]], + init: function(a, i) { + var n, t, e, o, l, r, s, u, h, p = O.mouseHoverAnchor, + c = {}; + if (a.element = O.pointAnchor.checkElement(i.element), s = a.element, !((u = s.ownerDocument) && (h = u.defaultView) && h.HTMLElement && s instanceof h.HTMLElement)) throw new Error("`element` must be HTML element"); + return p.style.backgroundSize = p.backgroundSize.width + "px " + p.backgroundSize.height + "px", + ["style", "hoverStyle"].forEach(function(e) { + var n = p[e]; + a[e] = Object.keys(n).reduce(function(e, t) { + return e[t] = n[t], + e + }, + {}) + }), + "inline" === (n = a.element.ownerDocument.defaultView.getComputedStyle(a.element, "")).display ? a.style.display = "inline-block": "none" === n.display && (a.style.display = "block"), + O.mouseHoverAnchor.dirKeys.forEach(function(e) { + var t = e[0], + e = "padding" + e[1]; + parseFloat(n[e]) < p.padding[t] && (a.style[e] = p.padding[t] + "px") + }), + a.style.display && (e = a.element.style.display, a.element.style.display = a.style.display), + O.mouseHoverAnchor.dirKeys.forEach(function(e) { + e = "padding" + e[1]; + a.style[e] && (c[e] = a.element.style[e], a.element.style[e] = a.style[e]) + }), + (s = a.element.getBoundingClientRect()).height < p.minHeight && (ie ? (h = p.minHeight, "content-box" === n.boxSizing ? h -= parseFloat(n.borderTopWidth) + parseFloat(n.borderBottomWidth) + parseFloat(n.paddingTop) + parseFloat(n.paddingBottom) : "padding-box" === n.boxSizing && (h -= parseFloat(n.borderTopWidth) + parseFloat(n.borderBottomWidth)), a.style.height = h + "px") : a.style.height = parseFloat(n.height) + (p.minHeight - s.height) + "px"), + a.style.backgroundPosition = re ? s.width - p.backgroundSize.width - p.backgroundPosition.right + "px " + p.backgroundPosition.top + "px": "right " + p.backgroundPosition.right + "px top " + p.backgroundPosition.top + "px", + a.style.display && (a.element.style.display = e), + O.mouseHoverAnchor.dirKeys.forEach(function(e) { + e = "padding" + e[1]; + a.style[e] && (a.element.style[e] = c[e]) + }), + ["style", "hoverStyle"].forEach(function(e) { + var t = a[e], + n = i[e]; + he(n) && Object.keys(n).forEach(function(e) { + "string" == typeof n[e] || pe(n[e]) ? t[e] = n[e] : null == n[e] && delete t[e] + }) + }), + "function" == typeof i.onSwitch && (r = i.onSwitch), + i.showEffectName && w[i.showEffectName] && (a.showEffectName = o = i.showEffectName), + l = i.animOptions, + a.elmStyle = t = a.element.style, + a.mouseenter = function(e) { + a.hoverStyleSave = p.getStyles(t, Object.keys(a.hoverStyle)), + p.setStyles(t, a.hoverStyle), + a.boundTargets.forEach(function(e) { + tt(e.props, !0, o, l) + }), + r && r(e) + }, + a.mouseleave = function(e) { + p.setStyles(t, a.hoverStyleSave), + a.boundTargets.forEach(function(e) { + tt(e.props, !1, o, l) + }), + r && r(e) + }, + !0 + }, + bind: function(e, t) { + var n, a, i, o, l; + return t.props.svg ? O.mouseHoverAnchor.llShow(t.props, !1, e.showEffectName) : ze(function() { + O.mouseHoverAnchor.llShow(t.props, !1, e.showEffectName) + }), + e.enabled || (e.styleSave = O.mouseHoverAnchor.getStyles(e.elmStyle, Object.keys(e.style)), O.mouseHoverAnchor.setStyles(e.elmStyle, e.style), e.removeEventListener = (n = e.element, a = e.mouseenter, i = e.mouseleave, "onmouseenter" in n && "onmouseleave" in n ? (n.addEventListener("mouseenter", a, !1), n.addEventListener("mouseleave", i, !1), + function() { + n.removeEventListener("mouseenter", a, !1), + n.removeEventListener("mouseleave", i, !1) + }) : (console.warn("mouseenter and mouseleave events polyfill is enabled."), n.addEventListener("mouseover", o = function(e) { + e.relatedTarget && (e.relatedTarget === this || this.compareDocumentPosition(e.relatedTarget) & Node.DOCUMENT_POSITION_CONTAINED_BY) || a.apply(this, arguments) + }), n.addEventListener("mouseout", l = function(e) { + e.relatedTarget && (e.relatedTarget === this || this.compareDocumentPosition(e.relatedTarget) & Node.DOCUMENT_POSITION_CONTAINED_BY) || i.apply(this, arguments) + }), + function() { + n.removeEventListener("mouseover", o, !1), + n.removeEventListener("mouseout", l, !1) + })), e.enabled = !0), + !0 + }, + unbind: function(e, t) { + e.enabled && e.boundTargets.length <= 1 && (e.removeEventListener(), O.mouseHoverAnchor.setStyles(e.elmStyle, e.styleSave), e.enabled = !1), + O.mouseHoverAnchor.llShow(t.props, !0, e.showEffectName) + }, + removeOption: function(e, t) { + O.pointAnchor.removeOption(e, t) + }, + remove: function(t) { + t.boundTargets.length && (console.error("LeaderLineAttachment was not unbound by remove"), t.boundTargets.forEach(function(e) { + O.mouseHoverAnchor.unbind(t, e) + })) + }, + getBBoxNest: function(e, t) { + return Le(e.element, t.baseWindow) + }, + llShow: function(e, t, n) { + w[n || e.curStats.show_effect].stop(e, !0, t), + e.aplStats.show_on = t + }, + getStyles: function(n, e) { + return e.reduce(function(e, t) { + return e[t] = n[t], + e + }, + {}) + }, + setStyles: function(t, n) { + Object.keys(n).forEach(function(e) { + t[e] = n[e] + }) + } + }, + captionLabel: { + type: "label", + argOptions: [{ + optionName: "text", + type: "string" + }], + stats: { + color: {}, + x: {}, + y: {} + }, + textStyleProps: ["fontFamily", "fontStyle", "fontVariant", "fontWeight", "fontStretch", "fontSize", "fontSizeAdjust", "kerning", "letterSpacing", "wordSpacing", "textDecoration"], + init: function(l, t) { + return "string" == typeof t.text && (l.text = t.text.trim()), + !!l.text && ("string" == typeof t.color && (l.color = t.color.trim()), l.outlineColor = "string" == typeof t.outlineColor ? t.outlineColor.trim() : "#fff", Array.isArray(t.offset) && pe(t.offset[0]) && pe(t.offset[1]) && (l.offset = { + x: t.offset[0], + y: t.offset[1] + }), pe(t.lineOffset) && (l.lineOffset = t.lineOffset), O.captionLabel.textStyleProps.forEach(function(e) { + null != t[e] && (l[e] = t[e]) + }), l.updateColor = function(e) { + O.captionLabel.updateColor(l, e) + }, + l.updateSocketXY = function(e) { + var t, n = l.curStats, + a = l.aplStats, + i = e.curStats, + o = i.position_socketXYSE[l.socketIndex]; + null != o.x && (l.offset ? (n.x = o.x + l.offset.x, n.y = o.y + l.offset.y) : (t = l.height / 2, e = Math.max(i.attach_plugSideLenSE[l.socketIndex] || 0, i.line_strokeWidth / 2), i = i.position_socketXYSE[l.socketIndex ? 0 : 1], o.socketId === A || o.socketId === k ? (n.x = o.socketId === A ? o.x - t - l.width: o.x + t, n.y = i.y < o.y ? o.y + e + t: o.y - e - t - l.height) : (n.x = i.x < o.x ? o.x + e + t: o.x - e - t - l.width, n.y = o.socketId === b ? o.y - t - l.height: o.y + t)), Xe(l, a, "x", t = n.x) && (l.elmPosition.x.baseVal.getItem(0).value = t), Xe(l, a, "y", t = n.y) && (l.elmPosition.y.baseVal.getItem(0).value = t + l.height)) + }, + l.updatePath = function(e) { + var t = l.curStats, + n = l.aplStats, + e = e.pathList.animVal || e.pathList.baseVal; + e && (e = O.captionLabel.getMidPoint(e, l.lineOffset), t.x = e.x - l.width / 2, t.y = e.y - l.height / 2, Xe(l, n, "x", e = t.x) && (l.elmPosition.x.baseVal.getItem(0).value = e), Xe(l, n, "y", e = t.y) && (l.elmPosition.y.baseVal.getItem(0).value = e + l.height)) + }, + l.updateShow = function(e) { + O.captionLabel.updateShow(l, e) + }, + re && (l.adjustEdge = function(e, t) { + var n = l.curStats; + null != n.x && O.captionLabel.adjustEdge(t, { + x: n.x, + y: n.y, + width: l.width, + height: l.height + }, + l.strokeWidth / 2) + }), !0) + }, + updateColor: function(e, t) { + var n = e.curStats, + a = e.aplStats, + t = t.curStats; + n.color = t = e.color || t.line_color, + Xe(e, a, "color", t) && (e.styleFill.fill = t) + }, + updateShow: function(e, t) { + t = !0 === t.isShown; + t !== e.isShown && (e.styleShow.visibility = t ? "": "hidden", e.isShown = t) + }, + adjustEdge: function(e, t, n) { + n = { + x1: t.x - n, + y1: t.y - n, + x2: t.x + t.width + n, + y2: t.y + t.height + n + }; + n.x1 < e.x1 && (e.x1 = n.x1), + n.y1 < e.y1 && (e.y1 = n.y1), + n.x2 > e.x2 && (e.x2 = n.x2), + n.y2 > e.y2 && (e.y2 = n.y2) + }, + newText: function(e, t, n, a, i) { + var o, l, r = t.createElementNS(ae, "text"); + return r.textContent = e, + [r.x, r.y].forEach(function(e) { + var t = n.createSVGLength(); + t.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0), + e.baseVal.initialize(t) + }), + "boolean" != typeof h && (h = "paintOrder" in r.style), + i && !h ? (o = t.createElementNS(ae, "defs"), r.id = a, o.appendChild(r), (l = (e = t.createElementNS(ae, "g")).appendChild(t.createElementNS(ae, "use"))).href.baseVal = "#" + a, (t = e.appendChild(t.createElementNS(ae, "use"))).href.baseVal = "#" + a, (l = l.style).strokeLinejoin = "round", { + elmPosition: r, + styleText: r.style, + styleFill: t.style, + styleStroke: l, + styleShow: e.style, + elmsAppend: [o, e] + }) : (l = r.style, i && (l.strokeLinejoin = "round", l.paintOrder = "stroke"), { + elmPosition: r, + styleText: l, + styleFill: l, + styleStroke: i ? l: null, + styleShow: l, + elmsAppend: [r] + }) + }, + getMidPoint: function(e, t) { + var n, a, i = Re(e), + o = i.segsLen, + i = i.lenAll, + l = -1, + r = i / 2 + (t || 0); + if (r <= 0) return 2 === (n = e[0]).length ? Ve(n[0], n[1], 0) : Ne(n[0], n[1], n[2], n[3], 0); + if (i <= r) return 2 === (n = e[e.length - 1]).length ? Ve(n[0], n[1], 1) : Ne(n[0], n[1], n[2], n[3], 1); + for (a = []; r > o[++l];) a.push(e[l]), + r -= o[l]; + return 2 === (n = e[l]).length ? Ve(n[0], n[1], r / o[l]) : Ne(n[0], n[1], n[2], n[3], We(n[0], n[1], n[2], n[3], r)) + }, + initSvg: function(t, n) { + var e, a, i = O.captionLabel.newText(t.text, n.baseWindow.document, n.svg, C + "-captionLabel-" + t._id, t.outlineColor); ["elmPosition", "styleFill", "styleShow", "elmsAppend"].forEach(function(e) { + t[e] = i[e] + }), + t.isShown = !1, + t.styleShow.visibility = "hidden", + O.captionLabel.textStyleProps.forEach(function(e) { + null != t[e] && (i.styleText[e] = t[e]) + }), + i.elmsAppend.forEach(function(e) { + n.svg.appendChild(e) + }), + e = i.elmPosition.getBBox(), + t.width = e.width, + t.height = e.height, + t.outlineColor && (a = e.height / 9, i.styleStroke.strokeWidth = (a = 10 < a ? 10 : a < 2 ? 2 : a) + "px", i.styleStroke.stroke = t.outlineColor), + t.strokeWidth = a || 0, + Ye(t.aplStats, O.captionLabel.stats), + t.updateColor(n), + t.refSocketXY ? t.updateSocketXY(n) : t.updatePath(n), + re && $e(n, {}), + t.updateShow(n) + }, + bind: function(e, t) { + var n = t.props; + return e.color || Ge(n, "cur_line_color", e.updateColor), + (e.refSocketXY = "startLabel" === t.optionName || "endLabel" === t.optionName) ? (e.socketIndex = "startLabel" === t.optionName ? 0 : 1, Ge(n, "apl_position", e.updateSocketXY), e.offset || (Ge(n, "cur_attach_plugSideLenSE", e.updateSocketXY), Ge(n, "cur_line_strokeWidth", e.updateSocketXY))) : Ge(n, "apl_path", e.updatePath), + Ge(n, "svgShow", e.updateShow), + re && Ge(n, "new_edge4viewBox", e.adjustEdge), + O.captionLabel.initSvg(e, n), + !0 + }, + unbind: function(e, t) { + var n = t.props; + e.elmsAppend && (e.elmsAppend.forEach(function(e) { + n.svg.removeChild(e) + }), e.elmPosition = e.styleFill = e.styleShow = e.elmsAppend = null), + Ye(e.curStats, O.captionLabel.stats), + Ye(e.aplStats, O.captionLabel.stats), + e.color || De(n, "cur_line_color", e.updateColor), + e.refSocketXY ? (De(n, "apl_position", e.updateSocketXY), e.offset || (De(n, "cur_attach_plugSideLenSE", e.updateSocketXY), De(n, "cur_line_strokeWidth", e.updateSocketXY))) : De(n, "apl_path", e.updatePath), + De(n, "svgShow", e.updateShow), + re && (De(n, "new_edge4viewBox", e.adjustEdge), $e(n, {})) + }, + removeOption: function(e, t) { + var n = t.props, + a = {}; + a[t.optionName] = "", + it(n, a) + }, + remove: function(t) { + t.boundTargets.length && (console.error("LeaderLineAttachment was not unbound by remove"), t.boundTargets.forEach(function(e) { + O.captionLabel.unbind(t, e) + })) + } + }, + pathLabel: { + type: "label", + argOptions: [{ + optionName: "text", + type: "string" + }], + stats: { + color: {}, + startOffset: {}, + pathData: {} + }, + init: function(l, t) { + return "string" == typeof t.text && (l.text = t.text.trim()), + !!l.text && ("string" == typeof t.color && (l.color = t.color.trim()), l.outlineColor = "string" == typeof t.outlineColor ? t.outlineColor.trim() : "#fff", pe(t.lineOffset) && (l.lineOffset = t.lineOffset), O.captionLabel.textStyleProps.forEach(function(e) { + null != t[e] && (l[e] = t[e]) + }), l.updateColor = function(e) { + O.captionLabel.updateColor(l, e) + }, + l.updatePath = function(e) { + var t = l.curStats, + n = l.aplStats, + a = e.curStats, + i = e.pathList.animVal || e.pathList.baseVal; + i && (t.pathData = a = O.pathLabel.getOffsetPathData(i, a.line_strokeWidth / 2 + l.strokeWidth / 2 + l.height / 4, 1.25 * l.height), Fe(a, n.pathData) && (l.elmPath.setPathData(a), n.pathData = a, l.bBox = l.elmPosition.getBBox(), l.updateStartOffset(e))) + }, + l.updateStartOffset = function(e) { + var i, t, n = l.curStats, + a = l.aplStats, + o = e.curStats; + n.pathData && (2 === l.semIndex && !l.lineOffset || (t = n.pathData.reduce(function(e, t) { + var n, a = t.values; + switch (t.type) { + case "M": + i = { + x: a[0], + y: a[1] + }; + break; + case "L": + n = { + x: a[0], + y: a[1] + }, + i && (e += Ae(i, n)), + i = n; + break; + case "C": + n = { + x: a[4], + y: a[5] + }, + i && (e += Te(i, { + x: a[0], + y: a[1] + }, + { + x: a[2], + y: a[3] + }, + n)), + i = n + } + return e + }, + 0), e = 0 === l.semIndex ? 0 : 1 === l.semIndex ? t: t / 2, 2 !== l.semIndex && (o = Math.max(o.attach_plugBackLenSE[l.semIndex] || 0, o.line_strokeWidth / 2) + l.strokeWidth / 2 + l.height / 4, e = (e += 0 === l.semIndex ? o: -o) < 0 ? 0 : t < e ? t: e), l.lineOffset && (e = (e += l.lineOffset) < 0 ? 0 : t < e ? t: e), n.startOffset = e, Xe(l, a, "startOffset", e) && (l.elmOffset.startOffset.baseVal.value = e))) + }, + l.updateShow = function(e) { + O.captionLabel.updateShow(l, e) + }, + re && (l.adjustEdge = function(e, t) { + l.bBox && O.captionLabel.adjustEdge(t, l.bBox, l.strokeWidth / 2) + }), !0) + }, + getOffsetPathData: function(e, c, n) { + var d, a, f = []; + function y(e, t) { + return Math.abs(e.x - t.x) < 3 && Math.abs(e.y - t.y) < 3 + } + return e.forEach(function(e) { + var t, n, a, i, o, l, r, s, u, h, p; + 2 === e.length ? (s = e[0], u = e[1], h = c, p = Math.atan2(s.y - u.y, u.x - s.x) + .5 * Math.PI, t = [{ + x: s.x + Math.cos(p) * h, + y: s.y + Math.sin(p) * h * -1 + }, + { + x: u.x + Math.cos(p) * h, + y: u.y + Math.sin(p) * h * -1 + }], d ? (a = d.points, 0 <= (r = Math.atan2(a[1].y - a[0].y, a[0].x - a[1].x) - Math.atan2(e[0].y - e[1].y, e[1].x - e[0].x)) && r <= Math.PI ? n = { + type: "line", + points: t, + inside: !0 + }: (o = Pe(a[0], a[1], c), i = Pe(t[1], t[0], c), l = a[0], s = t[1], p = (u = o).x - l.x, h = u.y - l.y, r = s.x - i.x, u = s.y - i.y, s = ( - h * (l.x - i.x) + p * (l.y - i.y)) / ( - r * h + p * u), u = (r * (l.y - i.y) - u * (l.x - i.x)) / ( - r * h + p * u), n = (h = 0 <= s && s <= 1 && 0 <= u && u <= 1 ? { + x: l.x + u * p, + y: l.y + u * h + }: null) ? { + type: "line", + points: [a[1] = h, t[1]] + }: (a[1] = y(i, o) ? i: o, { + type: "line", + points: [i, t[1]] + }), d.len = Ae(a[0], a[1]))) : n = { + type: "line", + points: t + }, + n.len = Ae(n.points[0], n.points[1]), f.push(d = n)) : (f.push({ + type: "cubic", + points: function(e, t, n, a, i, o) { + for (var l, r, s = Te(e, t, n, a) / o, u = 1 / (o < i ? i / o * s: s), h = [], p = 0; r = (90 - (l = Ne(e, t, n, a, p)).angle) * (Math.PI / 180), h.push({ + x: l.x + Math.cos(r) * i, + y: l.y + Math.sin(r) * i * -1 + }), !(1 <= p);) 1 < (p += u) && (p = 1); + return h + } (e[0], e[1], e[2], e[3], c, 16) + }), d = null) + }), + d = null, + f.forEach(function(e) { + var t; + d = "line" === e.type ? (e.inside && (d.len > c ? ((t = d.points)[1] = Pe(t[0], t[1], -c), d.len = Ae(t[0], t[1])) : (d.points = null, d.len = 0), e.len > c + n ? ((t = e.points)[0] = Pe(t[1], t[0], -(c + n)), e.len = Ae(t[0], t[1])) : (e.points = null, e.len = 0)), e) : null + }), + f.reduce(function(t, e) { + var n = e.points; + return n && (a && y(n[0], a) || t.push({ + type: "M", + values: [n[0].x, n[0].y] + }), "line" === e.type ? t.push({ + type: "L", + values: [n[1].x, n[1].y] + }) : (n.shift(), n.forEach(function(e) { + t.push({ + type: "L", + values: [e.x, e.y] + }) + })), a = n[n.length - 1]), + t + }, + []) + }, + newText: function(e, t, n, a) { + var i, o, l, r, s = t.createElementNS(ae, "defs"), + u = s.appendChild(t.createElementNS(ae, "path")); + return u.id = i = n + "-path", + (l = (o = t.createElementNS(ae, "text")).appendChild(t.createElementNS(ae, "textPath"))).href.baseVal = "#" + i, + l.startOffset.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0), + l.textContent = e, + "boolean" != typeof h && (h = "paintOrder" in o.style), + a && !h ? (o.id = e = n + "-text", s.appendChild(o), (r = (n = t.createElementNS(ae, "g")).appendChild(t.createElementNS(ae, "use"))).href.baseVal = "#" + e, (t = n.appendChild(t.createElementNS(ae, "use"))).href.baseVal = "#" + e, (r = r.style).strokeLinejoin = "round", { + elmPosition: o, + elmPath: u, + elmOffset: l, + styleText: o.style, + styleFill: t.style, + styleStroke: r, + styleShow: n.style, + elmsAppend: [s, n] + }) : (r = o.style, a && (r.strokeLinejoin = "round", r.paintOrder = "stroke"), { + elmPosition: o, + elmPath: u, + elmOffset: l, + styleText: r, + styleFill: r, + styleStroke: a ? r: null, + styleShow: r, + elmsAppend: [s, o] + }) + }, + initSvg: function(t, n) { + var e, a, i, o = O.pathLabel.newText(t.text, n.baseWindow.document, C + "-pathLabel-" + t._id, t.outlineColor); ["elmPosition", "elmPath", "elmOffset", "styleFill", "styleShow", "elmsAppend"].forEach(function(e) { + t[e] = o[e] + }), + t.isShown = !1, + t.styleShow.visibility = "hidden", + O.captionLabel.textStyleProps.forEach(function(e) { + null != t[e] && (o.styleText[e] = t[e]) + }), + o.elmsAppend.forEach(function(e) { + n.svg.appendChild(e) + }), + o.elmPath.setPathData([{ + type: "M", + values: [0, 100] + }, + { + type: "h", + values: [100] + }]), + le && (i = o.elmOffset.href.baseVal, o.elmOffset.href.baseVal = ""), + e = o.elmPosition.getBBox(), + le && (o.elmOffset.href.baseVal = i), + o.styleText.textAnchor = ["start", "end", "middle"][t.semIndex], + 2 !== t.semIndex || t.lineOffset || o.elmOffset.startOffset.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 50), + t.height = e.height, + t.outlineColor && (a = e.height / 9, o.styleStroke.strokeWidth = (a = 10 < a ? 10 : a < 2 ? 2 : a) + "px", o.styleStroke.stroke = t.outlineColor), + t.strokeWidth = a || 0, + Ye(t.aplStats, O.pathLabel.stats), + t.updateColor(n), + t.updatePath(n), + t.updateStartOffset(n), + re && $e(n, {}), + t.updateShow(n) + }, + bind: function(e, t) { + var n = t.props; + return e.color || Ge(n, "cur_line_color", e.updateColor), + Ge(n, "cur_line_strokeWidth", e.updatePath), + Ge(n, "apl_path", e.updatePath), + e.semIndex = "startLabel" === t.optionName ? 0 : "endLabel" === t.optionName ? 1 : 2, + 2 === e.semIndex && !e.lineOffset || Ge(n, "cur_attach_plugBackLenSE", e.updateStartOffset), + Ge(n, "svgShow", e.updateShow), + re && Ge(n, "new_edge4viewBox", e.adjustEdge), + O.pathLabel.initSvg(e, n), + !0 + }, + unbind: function(e, t) { + var n = t.props; + e.elmsAppend && (e.elmsAppend.forEach(function(e) { + n.svg.removeChild(e) + }), e.elmPosition = e.elmPath = e.elmOffset = e.styleFill = e.styleShow = e.elmsAppend = null), + Ye(e.curStats, O.pathLabel.stats), + Ye(e.aplStats, O.pathLabel.stats), + e.color || De(n, "cur_line_color", e.updateColor), + De(n, "cur_line_strokeWidth", e.updatePath), + De(n, "apl_path", e.updatePath), + 2 === e.semIndex && !e.lineOffset || De(n, "cur_attach_plugBackLenSE", e.updateStartOffset), + De(n, "svgShow", e.updateShow), + re && (De(n, "new_edge4viewBox", e.adjustEdge), $e(n, {})) + }, + removeOption: function(e, t) { + var n = t.props, + a = {}; + a[t.optionName] = "", + it(n, a) + }, + remove: function(t) { + t.boundTargets.length && (console.error("LeaderLineAttachment was not unbound by remove"), t.boundTargets.forEach(function(e) { + O.pathLabel.unbind(t, e) + })) + } + } + }, + Object.keys(O).forEach(function(e) { + ot[e] = function() { + return new M(O[e], Array.prototype.slice.call(arguments)) + } + }), + ot.positionByWindowResize = !0, + window.addEventListener("resize", S.add(function() { + ot.positionByWindowResize && Object.keys(Se).forEach(function(e) { + console.log(111111111, Se[e]) + $e(Se[e], { + position: !0 + }) + }) + }), !1), + ot +} (); +export +default LeaderLine diff --git a/dev/children/react16/src/pages/page1/page1.js b/dev/children/react16/src/pages/page1/page1.js index c8c19618a..fcd36bef8 100644 --- a/dev/children/react16/src/pages/page1/page1.js +++ b/dev/children/react16/src/pages/page1/page1.js @@ -6,8 +6,7 @@ import logo from '../../assets/logo.svg'; import './page1.css'; // import { loadModules, loadCss } from "esri-loader"; // loadCss(); - - +// import LeaderLine from './leader-line.js' const StyledButton = styled.button` background: transparent; @@ -73,6 +72,7 @@ function Page1() { }) } + useEffect(() => { // loadModules(["esri/Map", "esri/views/MapView"]) // .then(([Map, MapView]) => { @@ -90,6 +90,12 @@ function Page1() { // .catch((err) => { // console.error(err); // }); + + // new LeaderLine( + // document.getElementById('start'), + // document.getElementById('end') + // ); + }, []) return (
                  @@ -132,7 +138,9 @@ function Page1() { -
                  + {/*
                  */} + {/*
                  start
                  +
                  end
                  */}
                  ); } diff --git a/dev/children/react16/src/pages/page1/save.js b/dev/children/react16/src/pages/page1/save.js new file mode 100644 index 000000000..659a2c55f --- /dev/null +++ b/dev/children/react16/src/pages/page1/save.js @@ -0,0 +1,5763 @@ +'use strict'; +var LeaderLine = function() { + /** + * @param {number} i + * @return {?} + */ + function t(i) { + if (n[i]) { + return n[i].exports; + } + var module = n[i] = { + i : i, + l : false, + exports : {} + }; + return filters[i].call(module.exports, module, module.exports, t), module.l = true, module.exports; + } + /** + * @return {undefined} + */ + function tick() { + /** @type {number} */ + var x = Date.now(); + /** @type {boolean} */ + var o = false; + if (result) { + r.call(window, result); + /** @type {null} */ + result = null; + } + results.forEach(function(config) { + var width; + var i; + var r; + if (config.framesStart) { + if ((width = x - config.framesStart) >= config.duration && config.count && config.loopsLeft <= 1) { + return r = config.frames[config.lastFrame = config.reverse ? 0 : config.frames.length - 1], config.frameCallback(r.value, true, r.timeRatio, r.outputRatio), void(config.framesStart = null); + } + if (width > config.duration) { + if (i = Math.floor(width / config.duration), config.count) { + if (i >= config.loopsLeft) { + return r = config.frames[config.lastFrame = config.reverse ? 0 : config.frames.length - 1], config.frameCallback(r.value, true, r.timeRatio, r.outputRatio), void(config.framesStart = null); + } + config.loopsLeft -= i; + } + config.framesStart += config.duration * i; + /** @type {number} */ + width = x - config.framesStart; + } + if (config.reverse) { + /** @type {number} */ + width = config.duration - width; + } + r = config.frames[config.lastFrame = Math.round(width / len)]; + if (false !== config.frameCallback(r.value, false, r.timeRatio, r.outputRatio)) { + /** @type {boolean} */ + o = true; + } else { + /** @type {null} */ + config.framesStart = null; + } + } + }); + if (o) { + result = scope.call(window, tick); + } + } + /** + * @param {!Object} data + * @param {number} i + * @return {undefined} + */ + function getValue(data, i) { + /** @type {number} */ + data.framesStart = Date.now(); + if (null != i) { + data.framesStart -= data.duration * (data.reverse ? 1 - i : i); + } + data.loopsLeft = data.count; + /** @type {null} */ + data.lastFrame = null; + tick(); + } + /** + * @param {!Object} data + * @param {!Object} obj + * @return {?} + */ + function extend(data, obj) { + var undefined; + var style; + return typeof data != typeof obj || (undefined = isArray(data) ? "obj" : Array.isArray(data) ? "array" : "") != (isArray(obj) ? "obj" : Array.isArray(obj) ? "array" : "") || ("obj" === undefined ? extend(style = Object.keys(data).sort(), Object.keys(obj).sort()) || style.some(function(k) { + return extend(data[k], obj[k]); + }) : "array" === undefined ? data.length !== obj.length || data.some(function(args, key) { + return extend(args, obj[key]); + }) : data !== obj); + } + /** + * @param {!Object} data + * @return {?} + */ + function normalize(data) { + return data && (isArray(data) ? Object.keys(data).reduce(function(options, i) { + return options[i] = normalize(data[i]), options; + }, {}) : Array.isArray(data) ? data.map(normalize) : data); + } + /** + * @param {string} value + * @return {?} + */ + function parse(value) { + /** + * @param {!Function} e + * @return {?} + */ + function validate(e) { + /** @type {number} */ + var t = 1; + /** @type {(Array|null)} */ + e = m.exec(e); + return e && (t = parseFloat(e[1]), e[2] ? t = 0 <= t && t <= 100 ? t / 100 : 1 : (t < 0 || 1 < t) && (t = 1)), t; + } + var parts; + var okval; + var func; + /** @type {number} */ + var a = 1; + /** @type {string} */ + var b = value = (value + "").trim(); + return (parts = /^(rgba|hsla|hwb|gray|device\-cmyk)\s*\(([\s\S]+)\)$/i.exec(value)) ? (okval = parts[1].toLowerCase(), func = parts[2].trim().split(/\s*,\s*/), "rgba" === okval && 4 === func.length ? (a = validate(func[3]), b = "rgb(" + func.slice(0, 3).join(", ") + ")") : "hsla" === okval && 4 === func.length ? (a = validate(func[3]), b = "hsl(" + func.slice(0, 3).join(", ") + ")") : "hwb" === okval && 4 === func.length ? (a = validate(func[3]), b = "hwb(" + func.slice(0, 3).join(", ") + ")") : + "gray" === okval && 2 === func.length ? (a = validate(func[1]), b = "gray(" + func[0] + ")") : "device-cmyk" === okval && 5 <= func.length && (a = validate(func[4]), b = "device-cmyk(" + func.slice(0, 4).join(", ") + ")")) : (parts = /^#(?:([\da-f]{6})([\da-f]{2})|([\da-f]{3})([\da-f]))$/i.exec(value)) ? b = parts[1] ? (a = parseInt(parts[2], 16) / 255, "#" + parts[1]) : (a = parseInt(parts[4] + parts[4], 16) / 255, "#" + parts[3]) : "transparent" === value.toLocaleLowerCase() && (a = 0), [a, + b]; + } + /** + * @param {!Object} elem + * @return {?} + */ + function handler(elem) { + return !(!elem || elem.nodeType !== Node.ELEMENT_NODE || "function" != typeof elem.getBoundingClientRect); + } + /** + * @param {!Object} el + * @param {boolean} selectAll + * @return {?} + */ + function $(el, selectAll) { + var myAt; + var i; + var node; + var offset = {}; + if (!(node = el.ownerDocument)) { + return console.error("Cannot get document that contains the element."), null; + } + if (el.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_DISCONNECTED) { + return console.error("A disconnected element was passed."), null; + } + for (i in myAt = el.getBoundingClientRect()) { + offset[i] = myAt[i]; + } + if (!selectAll) { + if (!(node = node.defaultView)) { + return console.error("Cannot get window that contains the element."), null; + } + offset.left += node.pageXOffset; + offset.right += node.pageXOffset; + offset.top += node.pageYOffset; + offset.bottom += node.pageYOffset; + } + return offset; + } + /** + * @param {!Node} view + * @param {!Object} el + * @return {?} + */ + function process(view, el) { + var parent; + /** @type {!Array} */ + var code = []; + /** @type {!Node} */ + var node = view; + el = el || window; + for (;;) { + if (!(parent = document)) { + return console.error("Cannot get document that contains the element."), null; + } + if (!(parent = parent.defaultView)) { + return console.error("Cannot get window that contains the element."), null; + } + if (parent === el) { + break; + } + if (!(node = parent.frameElement)) { + return console.error("`baseWindow` was not found."), null; + } + code.unshift(node); + } + return code; + } + /** + * @param {undefined} id + * @param {!Object} container + * @return {?} + */ + function create(id, container) { + /** @type {number} */ + var x = 0; + /** @type {number} */ + var offset = 0; + return (container = process(id, container = container || window)) ? container.length ? (container.forEach(function(options, input) { + var b = $(options, 0 < input); + x = x + b.left; + offset = offset + b.top; + options = (input = options).ownerDocument.defaultView.getComputedStyle(input, ""); + b = { + left : input.clientLeft + parseFloat(options.paddingLeft), + top : input.clientTop + parseFloat(options.paddingTop) + }; + x = x + b.left; + offset = offset + b.top; + }), (container = $(id, true)).left += x, container.right += x, container.top += offset, container.bottom += offset, container) : $(id) : null; + } + /** + * @param {!Object} obj + * @param {number} arg + * @return {?} + */ + function func(obj, arg) { + /** @type {number} */ + var argR = obj.x - arg.x; + /** @type {number} */ + arg = obj.y - arg.y; + return Math.sqrt(argR * argR + arg * arg); + } + /** + * @param {!Object} s + * @param {number} r + * @param {number} a + * @return {?} + */ + function transform(s, r, a) { + /** @type {number} */ + var d = r.x - s.x; + /** @type {number} */ + r = r.y - s.y; + return { + x : s.x + d * a, + y : s.y + r * a, + angle : Math.atan2(r, d) / (Math.PI / 180) + }; + } + /** + * @param {number} t + * @param {!Object} s + * @param {number} v + * @return {?} + */ + function filter(t, s, v) { + /** @type {number} */ + t = Math.atan2(t.y - s.y, s.x - t.x); + return { + x : s.x + Math.cos(t) * v, + y : s.y + Math.sin(t) * v * -1 + }; + } + /** + * @param {number} s + * @param {number} p + * @param {!Object} q + * @param {number} data + * @param {number} i + * @return {?} + */ + function f(s, p, q, data, i) { + /** @type {number} */ + var k = i * i; + /** @type {number} */ + var pos = k * i; + /** @type {number} */ + var r = 1 - i; + /** @type {number} */ + var d = r * r; + /** @type {number} */ + var y = d * r; + /** @type {number} */ + var audioOffsetX = y * s.x + 3 * d * i * p.x + 3 * r * k * q.x + pos * data.x; + /** @type {number} */ + var languageOffsetY = y * s.y + 3 * d * i * p.y + 3 * r * k * q.y + pos * data.y; + var x = s.x + 2 * i * (p.x - s.x) + k * (q.x - 2 * p.x + s.x); + y = s.y + 2 * i * (p.y - s.y) + k * (q.y - 2 * p.y + s.y); + d = p.x + 2 * i * (q.x - p.x) + k * (data.x - 2 * q.x + p.x); + pos = p.y + 2 * i * (q.y - p.y) + k * (data.y - 2 * q.y + p.y); + /** @type {number} */ + k = r * s.x + i * p.x; + /** @type {number} */ + s = r * s.y + i * p.y; + /** @type {number} */ + p = r * q.x + i * data.x; + /** @type {number} */ + i = r * q.y + i * data.y; + /** @type {number} */ + data = 90 - 180 * Math.atan2(x - d, y - pos) / Math.PI; + return { + x : audioOffsetX, + y : languageOffsetY, + fromP2 : { + x : x, + y : y + }, + toP1 : { + x : d, + y : pos + }, + fromP1 : { + x : k, + y : s + }, + toP2 : { + x : p, + y : i + }, + angle : data = data + (180 < data ? -180 : 180) + }; + } + /** + * @param {!Object} p + * @param {!Object} data + * @param {!Object} obj + * @param {!Object} user + * @param {number} count + * @return {?} + */ + function add(p, data, obj, user, count) { + /** + * @param {number} e + * @param {number} f + * @param {number} d + * @param {number} a + * @param {number} fx + * @return {?} + */ + function callback(e, f, d, a, fx) { + return e * (e * (-3 * f + 9 * d - 9 * a + 3 * fx) + 6 * f - 12 * d + 6 * a) - 3 * f + 3 * d; + } + var argR; + var arg; + /** @type {!Array} */ + var subwikiListsCache = [.2491, .2491, .2335, .2335, .2032, .2032, .1601, .1601, .1069, .1069, .0472, .0472]; + /** @type {number} */ + var dmp = 0; + /** @type {number} */ + var k = (count = null == count || 1 < count ? 1 : count < 0 ? 0 : count) / 2; + return [-.1252, .1252, -.3678, .3678, -.5873, .5873, -.7699, .7699, -.9041, .9041, -.9816, .9816].forEach(function(filterWidth, wikiId) { + argR = callback(arg = k * filterWidth + k, p.x, data.x, obj.x, user.x); + arg = callback(arg, p.y, data.y, obj.y, user.y); + /** @type {number} */ + arg = argR * argR + arg * arg; + dmp = dmp + subwikiListsCache[wikiId] * Math.sqrt(arg); + }), k * dmp; + } + /** + * @param {!Object} v + * @param {undefined} x + * @param {!Object} f + * @param {!Object} n + * @param {number} i + * @return {?} + */ + function set(v, x, f, n, i) { + var y; + /** @type {number} */ + var startPos = .5; + /** @type {number} */ + var delta = 1 - startPos; + for (; y = add(v, x, f, n, delta), !(Math.abs(y - i) <= .01);) { + /** @type {number} */ + delta = delta + (y < i ? 1 : -1) * (startPos = startPos / 2); + } + return delta; + } + /** + * @param {!Object} fn + * @param {!Function} callback + * @return {?} + */ + function draw(fn, callback) { + var toSplice; + return fn.forEach(function(elements) { + elements = callback ? elements.map(function(value) { + value = { + x : value.x, + y : value.y + }; + return callback(value), value; + }) : elements; + (toSplice = toSplice || [{ + type : "M", + values : [elements[0].x, elements[0].y] + }]).push(elements.length ? 2 === elements.length ? { + type : "L", + values : [elements[1].x, elements[1].y] + } : { + type : "C", + values : [elements[1].x, elements[1].y, elements[2].x, elements[2].y, elements[3].x, elements[3].y] + } : { + type : "Z", + values : [] + }); + }), toSplice; + } + /** + * @param {?} q + * @return {?} + */ + function prompt(q) { + /** @type {!Array} */ + var onSelectionCalls = []; + /** @type {number} */ + var sChars = 0; + return q.forEach(function(e) { + e = (2 === e.length ? func : add).apply(null, e); + onSelectionCalls.push(e); + sChars = sChars + e; + }), { + segsLen : onSelectionCalls, + lenAll : sChars + }; + } + /** + * @param {!Object} val + * @param {string} txt + * @return {?} + */ + function log(val, txt) { + return null == val || null == txt || val.length !== txt.length || val.some(function(options, n) { + var line = txt[n]; + return options.type !== line.type || options.values.some(function(node_part, i) { + return node_part !== line.values[i]; + }); + }); + } + /** + * @param {!Object} obj + * @param {string} i + * @param {?} name + * @return {undefined} + */ + function get(obj, i, name) { + if (obj.events[i]) { + if (obj.events[i].indexOf(name) < 0) { + obj.events[i].push(name); + } + } else { + /** @type {!Array} */ + obj.events[i] = [name]; + } + } + /** + * @param {!Object} o + * @param {string} name + * @param {?} value + * @return {undefined} + */ + function remove(o, name, value) { + var stylePosition; + if (o.events[name] && -1 < (stylePosition = o.events[name].indexOf(value))) { + o.events[name].splice(stylePosition, 1); + } + } + /** + * @param {!Function} key + * @return {undefined} + */ + function execute(key) { + if (_takingTooLongTimeout) { + clearTimeout(_takingTooLongTimeout); + } + notesToRemove.push(key); + /** @type {number} */ + _takingTooLongTimeout = setTimeout(function() { + notesToRemove.forEach(function(saveNotifs) { + saveNotifs(); + }); + /** @type {!Array} */ + notesToRemove = []; + }, 0); + } + /** + * @param {!Object} o + * @param {?} condition + * @return {undefined} + */ + function debug(o, condition) { + if (o.reflowTargets.indexOf(condition) < 0) { + o.reflowTargets.push(condition); + } + } + /** + * @param {!Object} name + * @return {undefined} + */ + function fireComponentHook(name) { + name.reflowTargets.forEach(function(maxB) { + var b; + /** @type {number} */ + b = maxB; + setTimeout(function() { + var e = b.parentNode; + var d = b.nextSibling; + e.insertBefore(e.removeChild(b), d); + }, 0); + }); + /** @type {!Array} */ + name.reflowTargets = []; + } + /** + * @param {!Object} e + * @param {!Object} me + * @param {string} val + * @param {!Object} state + * @param {?} sep + * @param {!Object} node + * @param {?} l + * @return {undefined} + */ + function fn(e, me, val, state, sep, node, l) { + var clearLogOnReloadUIString; + if ("auto-start-reverse" === val) { + if ("boolean" != typeof isShallow) { + me.setAttribute("orient", "auto-start-reverse"); + /** @type {boolean} */ + isShallow = me.orientType.baseVal === SVGMarkerElement.SVG_MARKER_ORIENT_UNKNOWN; + } + if (isShallow) { + me.setAttribute("orient", val); + } else { + (clearLogOnReloadUIString = sep.createSVGTransform()).setRotate(180, 0, 0); + node.transform.baseVal.appendItem(clearLogOnReloadUIString); + me.setAttribute("orient", "auto"); + /** @type {boolean} */ + clearLogOnReloadUIString = true; + } + } else { + me.setAttribute("orient", val); + if (false === isShallow) { + node.transform.baseVal.clear(); + } + } + me = me.viewBox.baseVal; + if (clearLogOnReloadUIString) { + /** @type {number} */ + me.x = -state.right; + /** @type {number} */ + me.y = -state.bottom; + } else { + me.x = state.left; + me.y = state.top; + } + me.width = state.width; + me.height = state.height; + if (err) { + debug(e, l); + } + } + /** + * @param {boolean} e + * @param {boolean} window + * @return {?} + */ + function touchstart(e, window) { + return { + prop : e ? "markerEnd" : "markerStart", + orient : window ? window.noRotate ? "0" : e ? "auto" : "auto-start-reverse" : null + }; + } + /** + * @param {!Object} dst + * @param {!Object} a + * @return {undefined} + */ + function resolve(dst, a) { + Object.keys(a).forEach(function(i) { + var win = a[i]; + dst[i] = null != win.iniValue ? win.hasSE ? [win.iniValue, win.iniValue] : win.iniValue : win.hasSE ? win.hasProps ? [{}, {}] : [] : win.hasProps ? {} : null; + }); + } + /** + * @param {!Object} obj + * @param {!Object} arr + * @param {string} num + * @param {?} x + * @param {!Object} success + * @return {?} + */ + function callback(obj, arr, num, x, success) { + return x !== arr[num] && (arr[num] = x, success && success.forEach(function(fn) { + fn(obj, x, num); + }), true); + } + /** + * @param {!Object} node + * @return {?} + */ + function getSize(node) { + /** + * @param {number} n + * @param {?} d + * @return {?} + */ + function n(n, d) { + return n + parseFloat(d); + } + var data = node.document; + var cs = node.getComputedStyle(data.documentElement, ""); + node = node.getComputedStyle(data.body, ""); + data = { + x : 0, + y : 0 + }; + return "static" !== node.position ? (data.x -= [cs.marginLeft, cs.borderLeftWidth, cs.paddingLeft, node.marginLeft, node.borderLeftWidth].reduce(n, 0), data.y -= [cs.marginTop, cs.borderTopWidth, cs.paddingTop, node.marginTop, node.borderTopWidth].reduce(n, 0)) : "static" !== cs.position && (data.x -= [cs.marginLeft, cs.borderLeftWidth].reduce(n, 0), data.y -= [cs.marginTop, cs.borderTopWidth].reduce(n, 0)), data; + } + /** + * @param {!Window} win + * @return {undefined} + */ + function onLoad(win) { + var container; + var doc = win.document; + if (!doc.getElementById(selectId)) { + container = (new win.DOMParser).parseFromString(template, "image/svg+xml"); + doc.body.appendChild(container.documentElement); + dateFormatProperties(win); + } + } + /** + * @param {?} context + * @return {?} + */ + function render(context) { + /** + * @param {!Object} data + * @param {number} location + * @return {?} + */ + function draw(data, location) { + /** @type {({x: ?, y: ?})} */ + data = location === top ? { + x : data.left + data.width / 2, + y : data.top + } : location === undefined ? { + x : data.right, + y : data.top + data.height / 2 + } : location === el ? { + x : data.left + data.width / 2, + y : data.bottom + } : { + x : data.left, + y : data.top + data.height / 2 + }; + return data.socketId = location, data; + } + /** + * @param {!Object} opts + * @return {?} + */ + function traverse(opts) { + return { + x : opts.x, + y : opts.y + }; + } + var data; + var result; + var array; + var paneNodes; + var i; + var idx; + var start; + var _targetScrollPosition; + var known_x; + var xaList; + var btnY; + var f; + var u; + var d; + var options = context.options; + var node = context.curStats; + var opts = context.aplStats; + var args = node.position_socketXYSE; + /** @type {boolean} */ + var output = false; + if (node.position_path = options.path, node.position_lineStrokeWidth = node.line_strokeWidth, node.position_socketGravitySE = data = normalize(options.socketGravitySE), result = [0, 1].map(function(x) { + var i = options.anchorSE[x]; + var o = context.optionIsAttach.anchorSE[x]; + var r = false !== o ? items[i._id] : null; + var numberProperty = false !== o && r.conf.getStrokeWidth ? r.conf.getStrokeWidth(r, context) : 0; + var current = false !== o && r.conf.getBBoxNest ? r.conf.getBBoxNest(r, context, numberProperty) : create(i, context.baseWindow); + return node.capsMaskAnchor_pathDataSE[x] = false !== o && r.conf.getPathData ? r.conf.getPathData(r, context, numberProperty) : (o = null != (i = current).right ? i.right : i.left + i.width, r = null != i.bottom ? i.bottom : i.top + i.height, [{ + type : "M", + values : [i.left, i.top] + }, { + type : "L", + values : [o, i.top] + }, { + type : "L", + values : [o, r] + }, { + type : "L", + values : [i.left, r] + }, { + type : "Z", + values : [] + }]), node.capsMaskAnchor_strokeWidthSE[x] = numberProperty, current; + }), start = -1, options.socketSE[0] && options.socketSE[1] ? (args[0] = draw(result[0], options.socketSE[0]), args[1] = draw(result[1], options.socketSE[1])) : (options.socketSE[0] || options.socketSE[1] ? (idx = options.socketSE[0] ? (i = 0, 1) : (i = 1, 0), args[i] = draw(result[i], options.socketSE[i]), (paneNodes = margin.map(function(hash) { + return draw(result[idx], hash); + })).forEach(function(value) { + var pos = func(value, args[i]); + if (pos < start || -1 === start) { + /** @type {!Object} */ + args[idx] = value; + start = pos; + } + })) : (paneNodes = margin.map(function(hash) { + return draw(result[1], hash); + }), margin.map(function(hash) { + return draw(result[0], hash); + }).forEach(function(el) { + paneNodes.forEach(function(e) { + var pos = func(el, e); + if (pos < start || -1 === start) { + /** @type {!Object} */ + args[0] = el; + args[1] = e; + start = pos; + } + }); + })), [0, 1].forEach(function(i) { + var _deltaX; + var _deltaY; + if (!options.socketSE[i]) { + if (result[i].width || result[i].height) { + if (result[i].width || args[i].socketId !== left && args[i].socketId !== undefined) { + if (!(result[i].height || args[i].socketId !== top && args[i].socketId !== el)) { + /** @type {number} */ + args[i].socketId = 0 <= args[i ? 0 : 1].y - result[i].top ? el : top; + } + } else { + /** @type {number} */ + args[i].socketId = 0 <= args[i ? 0 : 1].x - result[i].left ? undefined : left; + } + } else { + /** @type {number} */ + _deltaX = args[i ? 0 : 1].x - result[i].left; + /** @type {number} */ + _deltaY = args[i ? 0 : 1].y - result[i].top; + /** @type {number} */ + args[i].socketId = Math.abs(_deltaX) >= Math.abs(_deltaY) ? 0 <= _deltaX ? undefined : left : 0 <= _deltaY ? el : top; + } + } + })), node.position_path !== opts.position_path || node.position_lineStrokeWidth !== opts.position_lineStrokeWidth || [0, 1].some(function(i) { + return node.position_plugOverheadSE[i] !== opts.position_plugOverheadSE[i] || (a = args[i], b = opts.position_socketXYSE[i], a.x !== b.x || a.y !== b.y || a.socketId !== b.socketId) || (a = data[i], b = opts.position_socketGravitySE[i], (i = null == a ? "auto" : Array.isArray(a) ? "array" : "number") != (null == b ? "auto" : Array.isArray(b) ? "array" : "number") || ("array" == i ? a[0] !== b[0] || a[1] !== b[1] : a !== b)); + var a; + var b; + })) { + switch(context.pathList.baseVal = array = [], context.pathList.animVal = null, node.position_path) { + case straight: + array.push([traverse(args[0]), traverse(args[1])]); + break; + case angle: + /** @type {boolean} */ + f = "number" == typeof data[0] && 0 < data[0] || "number" == typeof data[1] && 0 < data[1]; + /** @type {number} */ + u = cx1 * (f ? -1 : 1); + /** @type {number} */ + d = Math.atan2(args[1].y - args[0].y, args[1].x - args[0].x); + /** @type {number} */ + f = u - d; + /** @type {number} */ + d = Math.PI - d - u; + /** @type {number} */ + u = func(args[0], args[1]) / Math.sqrt(2) * step; + f = { + x : args[0].x + Math.cos(f) * u, + y : args[0].y + Math.sin(f) * u * -1 + }; + u = { + x : args[1].x + Math.cos(d) * u, + y : args[1].y + Math.sin(d) * u * -1 + }; + array.push([traverse(args[0]), f, u, traverse(args[1])]); + break; + case apexRestPath: + case object: + /** @type {!Array} */ + known_x = [data[0], node.position_path === object ? 0 : data[1]]; + /** @type {!Array} */ + xaList = []; + /** @type {!Array} */ + btnY = []; + args.forEach(function(e, i) { + var that; + var x = known_x[i]; + /** @type {({x: ?, y: ?}|{x: number, y: number})} */ + var offset = Array.isArray(x) ? { + x : x[0], + y : x[1] + } : "number" == typeof x ? e.socketId === top ? { + x : 0, + y : -x + } : e.socketId === undefined ? { + x : x, + y : 0 + } : e.socketId === el ? { + x : 0, + y : x + } : { + x : -x, + y : 0 + } : (that = args[i ? 0 : 1], x = 0 < (x = node.position_plugOverheadSE[i]) ? U + (y < x ? (x - y) * k : 0) : z + (node.position_lineStrokeWidth > lastLine ? (node.position_lineStrokeWidth - lastLine) * curZoom : 0), e.socketId === top ? { + x : 0, + y : -(offset = (offset = (e.y - that.y) / 2) < x ? x : offset) + } : e.socketId === undefined ? { + x : offset = (offset = (that.x - e.x) / 2) < x ? x : offset, + y : 0 + } : e.socketId === el ? { + x : 0, + y : offset = (offset = (that.y - e.y) / 2) < x ? x : offset + } : { + x : -(offset = (offset = (e.x - that.x) / 2) < x ? x : offset), + y : 0 + }); + xaList[i] = e.x + offset.x; + btnY[i] = e.y + offset.y; + }); + array.push([traverse(args[0]), { + x : xaList[0], + y : btnY[0] + }, { + x : xaList[1], + y : btnY[1] + }, traverse(args[1])]); + break; + case v: + !function() { + /** + * @param {number} mode + * @return {?} + */ + function connect(mode) { + return mode === i ? undefined : mode === remove ? _START_TO_END : mode === undefined ? i : remove; + } + /** + * @param {number} how + * @return {?} + */ + function drawLineChart(how) { + return how === remove || how === _START_TO_END ? "x" : "y"; + } + /** + * @param {!Object} data + * @param {number} s + * @param {string} name + * @return {?} + */ + function f(data, s, name) { + var options = { + x : data.x, + y : data.y + }; + if (name) { + if (name === connect(data.dirId)) { + throw new Error("Invalid dirId: " + name); + } + /** @type {string} */ + options.dirId = name; + } else { + options.dirId = data.dirId; + } + return options.dirId === i ? options.y -= s : options.dirId === remove ? options.x += s : options.dirId === undefined ? options.y += s : options.x -= s, options; + } + /** + * @param {!Object} rect + * @param {!Object} data + * @return {?} + */ + function fn(rect, data) { + return data.dirId === i ? rect.y <= data.y : data.dirId === remove ? rect.x >= data.x : data.dirId === undefined ? rect.y >= data.y : rect.x <= data.x; + } + /** + * @param {!Object} p + * @param {!Object} point + * @return {?} + */ + function scale(p, point) { + return point.dirId === i || point.dirId === undefined ? p.x === point.x : p.y === point.y; + } + /** + * @param {!Object} page + * @return {?} + */ + function createSubCommand(page) { + return page[0] ? { + contain : 0, + notContain : 1 + } : { + contain : 1, + notContain : 0 + }; + } + /** + * @param {!Object} x + * @param {!Object} y + * @param {string} i + * @return {?} + */ + function callback(x, y, i) { + return Math.abs(y[i] - x[i]); + } + /** + * @param {!Object} source + * @param {!Object} target + * @param {string} id + * @return {?} + */ + function process(source, target, id) { + return "x" === id ? source.x < target.x ? remove : _START_TO_END : source.y < target.y ? undefined : i; + } + var start; + /** @type {number} */ + var i = 1; + /** @type {number} */ + var remove = 2; + /** @type {number} */ + var undefined = 3; + /** @type {number} */ + var _START_TO_END = 4; + /** @type {!Array} */ + var result = [[], []]; + /** @type {!Array} */ + var o = []; + args.forEach(function(options, k) { + var el = traverse(options); + var v = data[k]; + /** @type {!Array} */ + options = Array.isArray(v) ? v[0] < 0 ? [_START_TO_END, -v[0]] : 0 < v[0] ? [remove, v[0]] : v[1] < 0 ? [i, -v[1]] : 0 < v[1] ? [undefined, v[1]] : [options.socketId, 0] : "number" != typeof v ? [options.socketId, b] : 0 <= v ? [options.socketId, v] : [connect(options.socketId), -v]; + el.dirId = options[0]; + v = options[1]; + result[k].push(el); + o[k] = f(el, v); + }); + for (; function() { + var auth0_time; + var item; + var a; + var annotations; + /** @type {!Array} */ + var page = [fn(o[1], o[0]), fn(o[0], o[1])]; + /** @type {!Array} */ + var arr = [drawLineChart(o[0].dirId), drawLineChart(o[1].dirId)]; + if (arr[0] === arr[1]) { + if (page[0] && page[1]) { + return void(scale(o[1], o[0]) || (o[0][arr[0]] === o[1][arr[1]] ? (result[0].push(o[0]), result[1].push(o[1])) : (auth0_time = o[0][arr[0]] + (o[1][arr[1]] - o[0][arr[0]]) / 2, result[0].push(f(o[0], Math.abs(auth0_time - o[0][arr[0]]))), result[1].push(f(o[1], Math.abs(auth0_time - o[1][arr[1]])))))); + } + if (page[0] !== page[1]) { + item = createSubCommand(page); + if ((a = callback(o[item.notContain], o[item.contain], arr[item.notContain])) < b) { + o[item.notContain] = f(o[item.notContain], b - a); + } + result[item.notContain].push(o[item.notContain]); + o[item.notContain] = f(o[item.notContain], b, scale(o[item.contain], o[item.notContain]) ? "x" === arr[item.notContain] ? undefined : remove : process(o[item.notContain], o[item.contain], "x" === arr[item.notContain] ? "y" : "x")); + } else { + a = callback(o[0], o[1], "x" === arr[0] ? "y" : "x"); + result.forEach(function(result, i) { + /** @type {number} */ + var k = 0 === i ? 1 : 0; + result.push(o[i]); + o[i] = f(o[i], b, 2 * b <= a ? process(o[i], o[k], "x" === arr[i] ? "y" : "x") : "x" === arr[i] ? undefined : remove); + }); + } + } else { + if (page[0] && page[1]) { + return void(scale(o[1], o[0]) ? result[1].push(o[1]) : scale(o[0], o[1]) ? result[0].push(o[0]) : result[0].push("x" === arr[0] ? { + x : o[1].x, + y : o[0].y + } : { + x : o[0].x, + y : o[1].y + })); + } + if (page[0] !== page[1]) { + item = createSubCommand(page); + result[item.notContain].push(o[item.notContain]); + o[item.notContain] = f(o[item.notContain], b, callback(o[item.notContain], o[item.contain], arr[item.contain]) >= b ? process(o[item.notContain], o[item.contain], arr[item.contain]) : o[item.contain].dirId); + } else { + /** @type {!Array} */ + annotations = [{ + x : o[0].x, + y : o[0].y + }, { + x : o[1].x, + y : o[1].y + }]; + result.forEach(function(result, i) { + /** @type {number} */ + var key = 0 === i ? 1 : 0; + var value = callback(annotations[i], annotations[key], arr[i]); + if (value < b) { + o[i] = f(o[i], b - value); + } + result.push(o[i]); + o[i] = f(o[i], b, process(o[i], o[key], arr[key])); + }); + } + } + return 1; + }();) { + } + result[1].reverse(); + result[0].concat(result[1]).forEach(function(end, canCreateDiscussions) { + end = { + x : end.x, + y : end.y + }; + if (0 < canCreateDiscussions) { + array.push([start, end]); + } + /** @type {number} */ + start = end; + }); + }(); + } + /** @type {!Array} */ + _targetScrollPosition = []; + node.position_plugOverheadSE.forEach(function(i, j) { + var obj; + var axis; + var r; + var text; + var angle; + var t; + var p; + var y; + var k; + /** @type {boolean} */ + var littleEndian = !j; + if (0 < i) { + if (2 === (obj = array[axis = littleEndian ? 0 : array.length - 1]).length) { + _targetScrollPosition[axis] = _targetScrollPosition[axis] || func.apply(null, obj); + if (_targetScrollPosition[axis] > upperBound) { + if (_targetScrollPosition[axis] - i < upperBound) { + /** @type {number} */ + i = _targetScrollPosition[axis] - upperBound; + } + p = transform(obj[0], obj[1], (littleEndian ? i : _targetScrollPosition[axis] - i) / _targetScrollPosition[axis]); + /** @type {!Array} */ + array[axis] = littleEndian ? [p, obj[1]] : [obj[0], p]; + _targetScrollPosition[axis] -= i; + } + } else { + _targetScrollPosition[axis] = _targetScrollPosition[axis] || add.apply(null, obj); + if (_targetScrollPosition[axis] > upperBound) { + if (_targetScrollPosition[axis] - i < upperBound) { + /** @type {number} */ + i = _targetScrollPosition[axis] - upperBound; + } + p = f(obj[0], obj[1], obj[2], obj[3], set(obj[0], obj[1], obj[2], obj[3], littleEndian ? i : _targetScrollPosition[axis] - i)); + text = littleEndian ? (r = obj[0], p.toP1) : (r = obj[3], p.fromP2); + /** @type {number} */ + angle = Math.atan2(r.y - p.y, p.x - r.x); + t = func(p, text); + /** @type {string} */ + p.x = r.x + Math.cos(angle) * i; + /** @type {string} */ + p.y = r.y + Math.sin(angle) * i * -1; + /** @type {string} */ + text.x = p.x + Math.cos(angle) * t; + /** @type {string} */ + text.y = p.y + Math.sin(angle) * t * -1; + /** @type {!Array} */ + array[axis] = littleEndian ? [p, p.toP1, p.toP2, obj[3]] : [obj[0], p.fromP1, p.fromP2, p]; + /** @type {null} */ + _targetScrollPosition[axis] = null; + } + } + } else { + if (i < 0) { + obj = array[axis = littleEndian ? 0 : array.length - 1]; + p = args[j].socketId; + /** @type {number} */ + j = -result[j]["x" == (y = p === left || p === undefined ? "x" : "y") ? "width" : "height"]; + /** @type {number} */ + k = (i = i < j ? j : i) * (p === left || p === top ? -1 : 1); + if (2 === obj.length) { + obj[littleEndian ? 0 : obj.length - 1][y] += k; + } else { + (littleEndian ? [0, 1] : [obj.length - 2, obj.length - 1]).forEach(function(x) { + obj[x][y] += k; + }); + } + /** @type {null} */ + _targetScrollPosition[axis] = null; + } + } + }); + opts.position_socketXYSE = normalize(args); + opts.position_plugOverheadSE = normalize(node.position_plugOverheadSE); + opts.position_path = node.position_path; + opts.position_lineStrokeWidth = node.position_lineStrokeWidth; + opts.position_socketGravitySE = normalize(data); + /** @type {boolean} */ + output = true; + if (context.events.apl_position) { + context.events.apl_position.forEach(function(View) { + View(context, array); + }); + } + } + return output; + } + /** + * @param {!Object} item + * @param {string} state + * @return {undefined} + */ + function cb(item, state) { + if (state !== item.isShown) { + if (!!state != !!item.isShown) { + /** @type {string} */ + item.svg.style.visibility = state ? "" : "hidden"; + } + /** @type {string} */ + item.isShown = state; + if (item.events && item.events.svgShow) { + item.events.svgShow.forEach(function(render) { + render(item, state); + }); + } + } + } + /** + * @param {!Object} e + * @param {!Object} params + * @return {undefined} + */ + function update(e, params) { + var self; + var opts; + var node; + var __vue_options__; + var p; + var _ref1; + var def; + var options; + var config; + var data; + var r; + var optionData; + var b; + var off; + var res; + var value; + var item; + var commits; + var user; + var E; + var el; + var pathData; + var _childPassed; + var graphRect; + var element; + var d; + var offset; + var containerRect; + var o; + var object; + var viewBox; + var indexedRows; + var N; + var t; + var response; + var height; + var props; + var partitions; + var G; + var x; + var state; + var states; + var result; + var me = {}; + if (params.line) { + me.line = (options = (self = e).options, opts = self.curStats, config = self.events, data = false, data = callback(self, opts, "line_color", options.lineColor, config.cur_line_color) || data, data = callback(self, opts, "line_colorTra", parse(opts.line_color)[0] < 1) || data, data = callback(self, opts, "line_strokeWidth", options.lineSize, config.cur_line_strokeWidth) || data); + } + if (params.plug || me.line) { + me.plug = (__vue_options__ = (node = e).options, p = node.curStats, _ref1 = node.events, def = false, [0, 1].forEach(function(name) { + var isoPos; + var extra; + var compare; + var base; + var x; + var y; + var w; + var scale; + var v = __vue_options__.plugSE[name]; + def = callback(node, p.plug_enabledSE, name, v !== v_res) || def; + def = callback(node, p.plug_plugSE, name, v) || def; + def = callback(node, p.plug_colorSE, name, scale = __vue_options__.plugColorSE[name] || p.line_color, _ref1.cur_plug_colorSE) || def; + def = callback(node, p.plug_colorTraSE, name, parse(scale)[0] < 1) || def; + if (v !== v_res) { + /** @type {number} */ + base = extra = (isoPos = weights[keys[v]]).widthR * __vue_options__.plugSizeSE[name]; + /** @type {number} */ + x = compare = isoPos.heightR * __vue_options__.plugSizeSE[name]; + if (model) { + /** @type {number} */ + base = base * p.line_strokeWidth; + /** @type {number} */ + x = x * p.line_strokeWidth; + } + def = callback(node, p.plug_markerWidthSE, name, base) || def; + def = callback(node, p.plug_markerHeightSE, name, x) || def; + /** @type {number} */ + p.capsMaskMarker_markerWidthSE[name] = extra; + /** @type {number} */ + p.capsMaskMarker_markerHeightSE[name] = compare; + } + p.plugOutline_plugSE[name] = p.capsMaskMarker_plugSE[name] = v; + if (p.plug_enabledSE[name]) { + /** @type {number} */ + scale = p.line_strokeWidth / cfg.lineSize * __vue_options__.plugSizeSE[name]; + /** @type {number} */ + p.position_plugOverheadSE[name] = isoPos.overhead * scale; + /** @type {number} */ + p.viewBox_plugBCircleSE[name] = isoPos.bCircle * scale; + /** @type {number} */ + y = isoPos.sideLen * scale; + /** @type {number} */ + w = isoPos.backLen * scale; + } else { + /** @type {number} */ + p.position_plugOverheadSE[name] = -p.line_strokeWidth / 2; + /** @type {number} */ + p.viewBox_plugBCircleSE[name] = y = w = 0; + } + callback(node, p.attach_plugSideLenSE, name, y, _ref1.cur_attach_plugSideLenSE); + callback(node, p.attach_plugBackLenSE, name, w, _ref1.cur_attach_plugBackLenSE); + /** @type {boolean} */ + p.capsMaskAnchor_enabledSE[name] = !p.plug_enabledSE[name]; + }), def = callback(node, p, "plug_enabled", p.plug_enabledSE[0] || p.plug_enabledSE[1]) || def); + } + if (params.lineOutline || me.line) { + me.lineOutline = (config = (options = e).options, data = options.curStats, _childPassed = false, _childPassed = callback(options, data, "lineOutline_enabled", config.lineOutlineEnabled) || _childPassed, _childPassed = callback(options, data, "lineOutline_color", config.lineOutlineColor) || _childPassed, _childPassed = callback(options, data, "lineOutline_colorTra", parse(data.lineOutline_color)[0] < 1) || _childPassed, config = data.line_strokeWidth * config.lineOutlineSize, _childPassed = + callback(options, data, "lineOutline_strokeWidth", data.line_strokeWidth - 2 * config) || _childPassed, _childPassed = callback(options, data, "lineOutline_inStrokeWidth", data.lineOutline_colorTra ? data.lineOutline_strokeWidth + 2 * ratio : data.line_strokeWidth - config) || _childPassed); + } + if (params.plugOutline || me.line || me.plug || me.lineOutline) { + me.plugOutline = (optionData = (r = e).options, b = r.curStats, off = false, [0, 1].forEach(function(i) { + var v = b.plugOutline_plugSE[i]; + var expr = v !== v_res ? weights[keys[v]] : null; + off = callback(r, b.plugOutline_enabledSE, i, optionData.plugOutlineEnabledSE[i] && b.plug_enabled && b.plug_enabledSE[i] && !!expr && !!expr.outlineBase) || off; + off = callback(r, b.plugOutline_colorSE, i, v = optionData.plugOutlineColorSE[i] || b.lineOutline_color) || off; + off = callback(r, b.plugOutline_colorTraSE, i, parse(v)[0] < 1) || off; + if (expr && expr.outlineBase) { + if ((v = optionData.plugOutlineSizeSE[i]) > expr.outlineMax) { + v = expr.outlineMax; + } + /** @type {number} */ + v = v * (2 * expr.outlineBase); + off = callback(r, b.plugOutline_strokeWidthSE, i, v) || off; + off = callback(r, b.plugOutline_inStrokeWidthSE, i, b.plugOutline_colorTraSE[i] ? v - ratio / (b.line_strokeWidth / cfg.lineSize) / optionData.plugSizeSE[i] * 2 : v / 2) || off; + } + }), off); + } + if (params.faces || me.line || me.plug || me.lineOutline || me.plugOutline) { + me.faces = (item = (res = e).curStats, commits = res.aplStats, user = res.events, E = false, !item.line_altColor && callback(res, commits, "line_color", value = item.line_color, user.apl_line_color) && (res.lineFace.style.stroke = value, E = true), callback(res, commits, "line_strokeWidth", value = item.line_strokeWidth, user.apl_line_strokeWidth) && (res.lineShape.style.strokeWidth = value + "px", E = true, (matchesSelector || err) && (debug(res, res.lineShape), err && (debug(res, res.lineFace), + debug(res, res.lineMaskCaps)))), callback(res, commits, "lineOutline_enabled", value = item.lineOutline_enabled, user.apl_lineOutline_enabled) && (res.lineOutlineFace.style.display = value ? "inline" : "none", E = true), item.lineOutline_enabled && (callback(res, commits, "lineOutline_color", value = item.lineOutline_color, user.apl_lineOutline_color) && (res.lineOutlineFace.style.stroke = value, E = true), callback(res, commits, "lineOutline_strokeWidth", value = item.lineOutline_strokeWidth, + user.apl_lineOutline_strokeWidth) && (res.lineOutlineMaskShape.style.strokeWidth = value + "px", E = true, err && (debug(res, res.lineOutlineMaskCaps), debug(res, res.lineOutlineFace))), callback(res, commits, "lineOutline_inStrokeWidth", value = item.lineOutline_inStrokeWidth, user.apl_lineOutline_inStrokeWidth) && (res.lineMaskShape.style.strokeWidth = value + "px", E = true, err && (debug(res, res.lineOutlineMaskCaps), debug(res, res.lineOutlineFace)))), callback(res, commits, "plug_enabled", + value = item.plug_enabled, user.apl_plug_enabled) && (res.plugsFace.style.display = value ? "inline" : "none", E = true), item.plug_enabled && [0, 1].forEach(function(i) { + var v = item.plug_plugSE[i]; + var self = v !== v_res ? weights[keys[v]] : null; + var data = touchstart(i, self); + if (callback(res, commits.plug_enabledSE, i, value = item.plug_enabledSE[i], user.apl_plug_enabledSE)) { + /** @type {string} */ + res.plugsFace.style[data.prop] = value ? "url(#" + res.plugMarkerIdSE[i] + ")" : "none"; + /** @type {boolean} */ + E = true; + } + if (item.plug_enabledSE[i]) { + if (callback(res, commits.plug_plugSE, i, v, user.apl_plug_plugSE)) { + /** @type {string} */ + res.plugFaceSE[i].href.baseVal = "#" + self.elmId; + fn(res, res.plugMarkerSE[i], data.orient, self.bBox, res.svg, res.plugMarkerShapeSE[i], res.plugsFace); + /** @type {boolean} */ + E = true; + if (matchesSelector) { + debug(res, res.plugsFace); + } + } + if (callback(res, commits.plug_colorSE, i, value = item.plug_colorSE[i], user.apl_plug_colorSE)) { + res.plugFaceSE[i].style.fill = value; + /** @type {boolean} */ + E = true; + if ((ariaRole || model || err) && !item.line_colorTra) { + debug(res, err ? res.lineMaskCaps : res.capsMaskLine); + } + } + ["markerWidth", "markerHeight"].forEach(function(name) { + /** @type {string} */ + var id = "plug_" + name + "SE"; + if (callback(res, commits[id], i, value = item[id][i], user["apl_" + id])) { + res.plugMarkerSE[i][name].baseVal.value = value; + /** @type {boolean} */ + E = true; + } + }); + if (callback(res, commits.plugOutline_enabledSE, i, value = item.plugOutline_enabledSE[i], user.apl_plugOutline_enabledSE)) { + if (value) { + /** @type {string} */ + res.plugFaceSE[i].style.mask = "url(#" + res.plugMaskIdSE[i] + ")"; + /** @type {string} */ + res.plugOutlineFaceSE[i].style.display = "inline"; + } else { + /** @type {string} */ + res.plugFaceSE[i].style.mask = "none"; + /** @type {string} */ + res.plugOutlineFaceSE[i].style.display = "none"; + } + /** @type {boolean} */ + E = true; + } + if (item.plugOutline_enabledSE[i]) { + if (callback(res, commits.plugOutline_plugSE, i, v, user.apl_plugOutline_plugSE)) { + /** @type {string} */ + res.plugOutlineFaceSE[i].href.baseVal = res.plugMaskShapeSE[i].href.baseVal = res.plugOutlineMaskShapeSE[i].href.baseVal = "#" + self.elmId; + [res.plugMaskSE[i], res.plugOutlineMaskSE[i]].forEach(function(rect) { + rect.x.baseVal.value = self.bBox.left; + rect.y.baseVal.value = self.bBox.top; + rect.width.baseVal.value = self.bBox.width; + rect.height.baseVal.value = self.bBox.height; + }); + /** @type {boolean} */ + E = true; + } + if (callback(res, commits.plugOutline_colorSE, i, value = item.plugOutline_colorSE[i], user.apl_plugOutline_colorSE)) { + res.plugOutlineFaceSE[i].style.fill = value; + /** @type {boolean} */ + E = true; + if (err) { + debug(res, res.lineMaskCaps); + debug(res, res.lineOutlineMaskCaps); + } + } + if (callback(res, commits.plugOutline_strokeWidthSE, i, value = item.plugOutline_strokeWidthSE[i], user.apl_plugOutline_strokeWidthSE)) { + /** @type {string} */ + res.plugOutlineMaskShapeSE[i].style.strokeWidth = value + "px"; + /** @type {boolean} */ + E = true; + } + if (callback(res, commits.plugOutline_inStrokeWidthSE, i, value = item.plugOutline_inStrokeWidthSE[i], user.apl_plugOutline_inStrokeWidthSE)) { + /** @type {string} */ + res.plugMaskShapeSE[i].style.strokeWidth = value + "px"; + /** @type {boolean} */ + E = true; + } + } + } + }), E); + } + if (params.position || me.line || me.plug) { + me.position = render(e); + } + if (params.path || me.position) { + /** @type {boolean} */ + me.path = (_childPassed = (el = e).curStats, offset = el.aplStats, d = el.pathList.animVal || el.pathList.baseVal, graphRect = _childPassed.path_edge, containerRect = false, d && (graphRect.x1 = graphRect.x2 = d[0][0].x, graphRect.y1 = graphRect.y2 = d[0][0].y, _childPassed.path_pathData = pathData = draw(d, function(position) { + if (position.x < graphRect.x1) { + graphRect.x1 = position.x; + } + if (position.y < graphRect.y1) { + graphRect.y1 = position.y; + } + if (position.x > graphRect.x2) { + graphRect.x2 = position.x; + } + if (position.y > graphRect.y2) { + graphRect.y2 = position.y; + } + }), log(pathData, offset.path_pathData) && (el.linePath.setPathData(pathData), offset.path_pathData = pathData, containerRect = true, err ? (debug(el, el.plugsFace), debug(el, el.lineMaskCaps)) : matchesSelector && debug(el, el.linePath), el.events.apl_path && el.events.apl_path.forEach(function(updateCalback) { + updateCalback(el, pathData); + }))), containerRect); + } + me.viewBox = (d = (element = e).curStats, offset = element.aplStats, containerRect = d.path_edge, o = d.viewBox_bBox, object = offset.viewBox_bBox, viewBox = element.svg.viewBox.baseVal, indexedRows = element.svg.style, N = false, offset = Math.max(d.line_strokeWidth / 2, d.viewBox_plugBCircleSE[0] || 0, d.viewBox_plugBCircleSE[1] || 0), t = { + x1 : containerRect.x1 - offset, + y1 : containerRect.y1 - offset, + x2 : containerRect.x2 + offset, + y2 : containerRect.y2 + offset + }, element.events.new_edge4viewBox && element.events.new_edge4viewBox.forEach(function(render) { + render(element, t); + }), o.x = d.lineMask_x = d.lineOutlineMask_x = d.maskBGRect_x = t.x1, o.y = d.lineMask_y = d.lineOutlineMask_y = d.maskBGRect_y = t.y1, o.width = t.x2 - t.x1, o.height = t.y2 - t.y1, ["x", "y", "width", "height"].forEach(function(index) { + var item; + if ((item = o[index]) !== object[index]) { + viewBox[index] = object[index] = item; + /** @type {string} */ + indexedRows[row[index]] = item + ("x" === index || "y" === index ? element.bodyOffset[index] : 0) + "px"; + /** @type {boolean} */ + N = true; + } + console.log(333333, item, o); + }), N); + me.mask = (props = (response = e).curStats, partitions = response.aplStats, G = false, props.plug_enabled ? [0, 1].forEach(function(language) { + props.capsMaskMarker_enabledSE[language] = props.plug_enabledSE[language] && props.plug_colorTraSE[language] || props.plugOutline_enabledSE[language] && props.plugOutline_colorTraSE[language]; + }) : props.capsMaskMarker_enabledSE[0] = props.capsMaskMarker_enabledSE[1] = false, props.capsMaskMarker_enabled = props.capsMaskMarker_enabledSE[0] || props.capsMaskMarker_enabledSE[1], props.lineMask_outlineMode = props.lineOutline_enabled, props.caps_enabled = props.capsMaskMarker_enabled || props.capsMaskAnchor_enabledSE[0] || props.capsMaskAnchor_enabledSE[1], props.lineMask_enabled = props.caps_enabled || props.lineMask_outlineMode, (props.lineMask_enabled && !props.lineMask_outlineMode || + props.lineOutline_enabled) && ["x", "y"].forEach(function(name) { + /** @type {string} */ + var i = "maskBGRect_" + name; + if (callback(response, partitions, i, height = props[i])) { + response.maskBGRect[name].baseVal.value = height; + /** @type {boolean} */ + G = true; + } + }), callback(response, partitions, "lineMask_enabled", height = props.lineMask_enabled) && (response.lineFace.style.mask = height ? "url(#" + response.lineMaskId + ")" : "none", G = true, model && debug(response, response.lineMask)), props.lineMask_enabled && (callback(response, partitions, "lineMask_outlineMode", height = props.lineMask_outlineMode) && (height ? (response.lineMaskBG.style.display = "none", response.lineMaskShape.style.display = "inline") : (response.lineMaskBG.style.display = + "inline", response.lineMaskShape.style.display = "none"), G = true), ["x", "y"].forEach(function(name) { + /** @type {string} */ + var i = "lineMask_" + name; + if (callback(response, partitions, i, height = props[i])) { + response.lineMask[name].baseVal.value = height; + /** @type {boolean} */ + G = true; + } + }), callback(response, partitions, "caps_enabled", height = props.caps_enabled) && (response.lineMaskCaps.style.display = response.lineOutlineMaskCaps.style.display = height ? "inline" : "none", G = true, model && debug(response, response.capsMaskLine)), props.caps_enabled && ([0, 1].forEach(function(i) { + var t; + if (callback(response, partitions.capsMaskAnchor_enabledSE, i, height = props.capsMaskAnchor_enabledSE[i])) { + /** @type {string} */ + response.capsMaskAnchorSE[i].style.display = height ? "inline" : "none"; + /** @type {boolean} */ + G = true; + if (model) { + debug(response, response.lineMask); + } + } + if (props.capsMaskAnchor_enabledSE[i]) { + if (log(t = props.capsMaskAnchor_pathDataSE[i], partitions.capsMaskAnchor_pathDataSE[i])) { + response.capsMaskAnchorSE[i].setPathData(t); + partitions.capsMaskAnchor_pathDataSE[i] = t; + /** @type {boolean} */ + G = true; + } + if (callback(response, partitions.capsMaskAnchor_strokeWidthSE, i, height = props.capsMaskAnchor_strokeWidthSE[i])) { + /** @type {string} */ + response.capsMaskAnchorSE[i].style.strokeWidth = height + "px"; + /** @type {boolean} */ + G = true; + } + } + }), callback(response, partitions, "capsMaskMarker_enabled", height = props.capsMaskMarker_enabled) && (response.capsMaskLine.style.display = height ? "inline" : "none", G = true), props.capsMaskMarker_enabled && [0, 1].forEach(function(i) { + var v = props.capsMaskMarker_plugSE[i]; + var self = v !== v_res ? weights[keys[v]] : null; + var item = touchstart(i, self); + if (callback(response, partitions.capsMaskMarker_enabledSE, i, height = props.capsMaskMarker_enabledSE[i])) { + /** @type {string} */ + response.capsMaskLine.style[item.prop] = height ? "url(#" + response.lineMaskMarkerIdSE[i] + ")" : "none"; + /** @type {boolean} */ + G = true; + } + if (props.capsMaskMarker_enabledSE[i]) { + if (callback(response, partitions.capsMaskMarker_plugSE, i, v)) { + /** @type {string} */ + response.capsMaskMarkerShapeSE[i].href.baseVal = "#" + self.elmId; + fn(response, response.capsMaskMarkerSE[i], item.orient, self.bBox, response.svg, response.capsMaskMarkerShapeSE[i], response.capsMaskLine); + /** @type {boolean} */ + G = true; + if (matchesSelector) { + debug(response, response.capsMaskLine); + debug(response, response.lineFace); + } + } + ["markerWidth", "markerHeight"].forEach(function(name) { + /** @type {string} */ + var j = "capsMaskMarker_" + name + "SE"; + if (callback(response, partitions[j], i, height = props[j][i])) { + response.capsMaskMarkerSE[i][name].baseVal.value = height; + /** @type {boolean} */ + G = true; + } + }); + } + }))), props.lineOutline_enabled && ["x", "y"].forEach(function(name) { + /** @type {string} */ + var i = "lineOutlineMask_" + name; + if (callback(response, partitions, i, height = props[i])) { + response.lineOutlineMask[name].baseVal.value = height; + /** @type {boolean} */ + G = true; + } + }), G); + if (params.effect) { + states = (x = e).curStats; + result = x.aplStats; + Object.keys(params).forEach(function(key) { + var node = params[key]; + /** @type {string} */ + var i = key + "_enabled"; + /** @type {string} */ + var k = key + "_options"; + key = states[k]; + if (callback(x, result, i, state = states[i])) { + if (state) { + result[k] = normalize(key); + } + node[state ? "init" : "remove"](x); + } else { + if (state && extend(key, result[k])) { + node.remove(x); + /** @type {boolean} */ + result[i] = true; + result[k] = normalize(key); + node.init(x); + } + } + }); + } + if ((ariaRole || model) && me.line && !me.path) { + debug(e, e.lineShape); + } + if (ariaRole && me.plug && !me.line) { + debug(e, e.plugsFace); + } + fireComponentHook(e); + } + /** + * @param {!Object} request + * @param {!Object} event + * @return {?} + */ + function load(request, event) { + return { + duration : (expect(request.duration) && 0 < request.duration ? request : event).duration, + timing : player.validTiming(request.timing) ? request.timing : normalize(event.timing) + }; + } + /** + * @param {!Object} self + * @param {string} parentId + * @param {!Object} x + * @param {!Function} obj + * @return {undefined} + */ + function select(self, parentId, x, obj) { + /** + * @return {undefined} + */ + function goNext() { + ["show_on", "show_effect", "show_animOptions"].forEach(function(i) { + opts[i] = data[i]; + }); + } + var data = self.curStats; + var opts = self.aplStats; + var settings = {}; + /** @type {string} */ + data.show_on = parentId; + if (x && state[x]) { + /** @type {!Object} */ + data.show_effect = x; + data.show_animOptions = load(isArray(obj) ? obj : {}, state[x].defaultAnimOptions); + } + /** @type {boolean} */ + settings.show_on = data.show_on !== opts.show_on; + /** @type {boolean} */ + settings.show_effect = data.show_effect !== opts.show_effect; + settings.show_animOptions = extend(data.show_animOptions, opts.show_animOptions); + if (settings.show_effect || settings.show_animOptions) { + if (data.show_inAnim) { + x = settings.show_effect ? state[opts.show_effect].stop(self, true, true) : state[opts.show_effect].stop(self); + goNext(); + state[opts.show_effect].init(self, x); + } else { + if (settings.show_on) { + if (opts.show_effect && settings.show_effect) { + state[opts.show_effect].stop(self, true, true); + } + goNext(); + state[opts.show_effect].init(self); + } + } + } else { + if (settings.show_on) { + goNext(); + state[opts.show_effect].start(self); + } + } + } + /** + * @param {!Object} data + * @param {!Object} i + * @param {string} e + * @return {?} + */ + function done(data, i, e) { + e = { + props : data, + optionName : e + }; + return data.attachments.indexOf(i) < 0 && (!i.conf.bind || i.conf.bind(i, e)) && (data.attachments.push(i), i.boundTargets.push(e), 1); + } + /** + * @param {!Object} msg + * @param {!Object} t + * @param {boolean} err + * @return {undefined} + */ + function run(msg, t, err) { + var i = msg.attachments.indexOf(t); + if (-1 < i) { + msg.attachments.splice(i, 1); + } + if (t.boundTargets.some(function(event, maxAtomIndex) { + return event.props === msg && (t.conf.unbind && t.conf.unbind(t, event), i = maxAtomIndex, true); + })) { + t.boundTargets.splice(i, 1); + if (!err) { + execute(function() { + if (!t.boundTargets.length) { + setup(t); + } + }); + } + } + } + /** + * @param {!Object} obj + * @param {string} parent + * @return {undefined} + */ + function init(obj, parent) { + /** + * @param {!Object} element + * @param {string} name + * @param {string} id + * @param {!Object} key + * @param {string} fn + * @return {?} + */ + function parse(element, name, id, key, fn) { + var item = {}; + return id ? null != key ? (item.container = element[id], item.key = key) : (item.container = element, item.key = id) : (item.container = element, item.key = name), item.default = fn, item.acceptsAuto = null == item.default, item; + } + /** + * @param {!Object} elem + * @param {string} container + * @param {string} propertyName + * @param {string} obj + * @param {string} key + * @param {?} options + * @param {!Object} value + * @return {?} + */ + function get(elem, container, propertyName, obj, key, options, value) { + var nptmask; + var type; + var fn; + value = parse(elem, propertyName, key, options, value); + return null != container[propertyName] && (type = (container[propertyName] + "").toLowerCase()) && (value.acceptsAuto && type === on || (fn = obj[type])) && fn !== value.container[value.key] && (value.container[value.key] = fn, nptmask = true), null != value.container[value.key] || value.acceptsAuto || (value.container[value.key] = value.default, nptmask = true), nptmask; + } + /** + * @param {!Object} type + * @param {string} data + * @param {string} name + * @param {string} str + * @param {string} key + * @param {?} options + * @param {!Object} value + * @param {!Function} _ + * @param {string} s + * @return {?} + */ + function callback(type, data, name, str, key, options, value, _, s) { + var __WEBPACK_AMD_DEFINE_RESULT__; + var obj; + var err; + var article; + value = parse(type, name, key, options, value); + if (!str) { + if (null == value.default) { + throw new Error("Invalid `type`: " + name); + } + /** @type {string} */ + str = typeof value.default; + } + return null != data[name] && (value.acceptsAuto && (data[name] + "").toLowerCase() === on || (err = obj = data[name], ("number" === (article = str) ? expect(err) : typeof err === article) && (obj = s && "string" === str && obj ? obj.trim() : obj, 1) && (!_ || _(obj)))) && obj !== value.container[value.key] && (value.container[value.key] = obj, __WEBPACK_AMD_DEFINE_RESULT__ = true), null != value.container[value.key] || value.acceptsAuto || (value.container[value.key] = value.default, __WEBPACK_AMD_DEFINE_RESULT__ = + true), __WEBPACK_AMD_DEFINE_RESULT__; + } + /** + * @param {string} height + * @return {?} + */ + function done(height) { + var rect = v.appendChild(doc.createElementNS(i, "mask")); + return rect.id = height, rect.maskUnits.baseVal = SVGUnitTypes.SVG_UNIT_TYPE_USERSPACEONUSE, [rect.x, rect.y, rect.width, rect.height].forEach(function(klass) { + klass.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX, 0); + }), rect; + } + /** + * @param {string} height + * @return {?} + */ + function render(height) { + var el = v.appendChild(doc.createElementNS(i, "marker")); + return el.id = height, el.markerUnits.baseVal = SVGMarkerElement.SVG_MARKERUNITS_STROKEWIDTH, el.viewBox.baseVal || el.setAttribute("viewBox", "0 0 0 0"), el; + } + /** + * @param {?} cascade + * @return {?} + */ + function fn(cascade) { + return [cascade.width, cascade.height].forEach(function(klass) { + klass.baseVal.newValueSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 100); + }), cascade; + } + var prop; + var self; + var element; + var svg; + var v; + var list; + var target; + var stepId; + var elementId; + var iframeID; + var id; + var map; + var e; + var doc; + var node_; + var item = obj.options; + var args = {}; + if (parent = parent || {}, ["start", "end"].forEach(function(i, name) { + var value = parent[i]; + /** @type {boolean} */ + var text = false; + if (value && (handler(value) || (text = format(value, "anchor"))) && value !== item.anchorSE[name]) { + if (false !== obj.optionIsAttach.anchorSE[name] && run(obj, items[item.anchorSE[name]._id]), text && !done(obj, items[value._id], i)) { + throw new Error("Can't bind attachment"); + } + item.anchorSE[name] = value; + obj.optionIsAttach.anchorSE[name] = text; + /** @type {boolean} */ + prop = args.position = true; + } + }), !item.anchorSE[0] || !item.anchorSE[1] || item.anchorSE[0] === item.anchorSE[1]) { + throw new Error("`start` and `end` are required."); + } + if (prop && (id = function(body, name) { + var data; + var win; + if (!(body = process(body)) || !(data = process(name))) { + throw new Error("Cannot get frames."); + } + return body.length && data.length && (body.reverse(), data.reverse(), body.some(function(namespaces) { + return data.some(function(fn) { + return fn === namespaces && (win = fn.contentWindow, true); + }); + })), win || window; + }(false !== obj.optionIsAttach.anchorSE[0] ? items[item.anchorSE[0]._id].element : item.anchorSE[0], false !== obj.optionIsAttach.anchorSE[1] ? items[item.anchorSE[1]._id].element : item.anchorSE[1])) !== obj.baseWindow) { + element = id; + e = (self = obj).aplStats; + doc = element.document; + /** @type {string} */ + node_ = name + "-" + self._id; + self.pathList = {}; + resolve(e, NS); + Object.keys(params).forEach(function(name) { + /** @type {string} */ + var state = name + "_enabled"; + if (e[state]) { + params[name].remove(self); + /** @type {boolean} */ + e[state] = false; + } + }); + if (self.baseWindow && self.svg) { + self.baseWindow.document.body.removeChild(self.svg); + } + onLoad(self.baseWindow = element); + self.bodyOffset = getSize(element); + self.svg = svg = doc.createElementNS(i, "svg"); + /** @type {string} */ + svg.className.baseVal = name; + if (!svg.viewBox.baseVal) { + svg.setAttribute("viewBox", "0 0 0 0"); + } + self.defs = v = svg.appendChild(doc.createElementNS(i, "defs")); + self.linePath = target = v.appendChild(doc.createElementNS(i, "path")); + /** @type {string} */ + target.id = stepId = node_ + "-line-path"; + /** @type {string} */ + target.className.baseVal = name + "-line-path"; + if (model) { + /** @type {string} */ + target.style.fill = "none"; + } + self.lineShape = target = v.appendChild(doc.createElementNS(i, "use")); + /** @type {string} */ + target.id = elementId = node_ + "-line-shape"; + /** @type {string} */ + target.href.baseVal = "#" + stepId; + /** @type {string} */ + (list = v.appendChild(doc.createElementNS(i, "g"))).id = iframeID = node_ + "-caps"; + /** @type {!Array} */ + self.capsMaskAnchorSE = [0, 1].map(function() { + var elem = list.appendChild(doc.createElementNS(i, "path")); + return elem.className.baseVal = name + "-caps-mask-anchor", elem; + }); + /** @type {!Array} */ + self.lineMaskMarkerIdSE = [node_ + "-caps-mask-marker-0", node_ + "-caps-mask-marker-1"]; + /** @type {!Array} */ + self.capsMaskMarkerSE = [0, 1].map(function(name) { + return render(self.lineMaskMarkerIdSE[name]); + }); + /** @type {!Array} */ + self.capsMaskMarkerShapeSE = [0, 1].map(function(n) { + n = self.capsMaskMarkerSE[n].appendChild(doc.createElementNS(i, "use")); + return n.className.baseVal = name + "-caps-mask-marker-shape", n; + }); + self.capsMaskLine = target = list.appendChild(doc.createElementNS(i, "use")); + /** @type {string} */ + target.className.baseVal = name + "-caps-mask-line"; + /** @type {string} */ + target.href.baseVal = "#" + elementId; + self.maskBGRect = target = fn(v.appendChild(doc.createElementNS(i, "rect"))); + /** @type {string} */ + target.id = id = node_ + "-mask-bg-rect"; + /** @type {string} */ + target.className.baseVal = name + "-mask-bg-rect"; + if (model) { + /** @type {string} */ + target.style.fill = "white"; + } + self.lineMask = fn(done(self.lineMaskId = node_ + "-line-mask")); + self.lineMaskBG = target = self.lineMask.appendChild(doc.createElementNS(i, "use")); + /** @type {string} */ + target.href.baseVal = "#" + id; + self.lineMaskShape = target = self.lineMask.appendChild(doc.createElementNS(i, "use")); + /** @type {string} */ + target.className.baseVal = name + "-line-mask-shape"; + /** @type {string} */ + target.href.baseVal = "#" + stepId; + /** @type {string} */ + target.style.display = "none"; + self.lineMaskCaps = target = self.lineMask.appendChild(doc.createElementNS(i, "use")); + /** @type {string} */ + target.href.baseVal = "#" + iframeID; + self.lineOutlineMask = fn(done(element = node_ + "-line-outline-mask")); + /** @type {string} */ + (target = self.lineOutlineMask.appendChild(doc.createElementNS(i, "use"))).href.baseVal = "#" + id; + self.lineOutlineMaskShape = target = self.lineOutlineMask.appendChild(doc.createElementNS(i, "use")); + /** @type {string} */ + target.className.baseVal = name + "-line-outline-mask-shape"; + /** @type {string} */ + target.href.baseVal = "#" + stepId; + self.lineOutlineMaskCaps = target = self.lineOutlineMask.appendChild(doc.createElementNS(i, "use")); + /** @type {string} */ + target.href.baseVal = "#" + iframeID; + self.face = svg.appendChild(doc.createElementNS(i, "g")); + self.lineFace = target = self.face.appendChild(doc.createElementNS(i, "use")); + /** @type {string} */ + target.href.baseVal = "#" + elementId; + self.lineOutlineFace = target = self.face.appendChild(doc.createElementNS(i, "use")); + /** @type {string} */ + target.href.baseVal = "#" + elementId; + /** @type {string} */ + target.style.mask = "url(#" + element + ")"; + /** @type {string} */ + target.style.display = "none"; + /** @type {!Array} */ + self.plugMaskIdSE = [node_ + "-plug-mask-0", node_ + "-plug-mask-1"]; + /** @type {!Array} */ + self.plugMaskSE = [0, 1].map(function(name) { + return done(self.plugMaskIdSE[name]); + }); + /** @type {!Array} */ + self.plugMaskShapeSE = [0, 1].map(function(n) { + n = self.plugMaskSE[n].appendChild(doc.createElementNS(i, "use")); + return n.className.baseVal = name + "-plug-mask-shape", n; + }); + /** @type {!Array} */ + map = []; + /** @type {!Array} */ + self.plugOutlineMaskSE = [0, 1].map(function(pkgName) { + return done(map[pkgName] = node_ + "-plug-outline-mask-" + pkgName); + }); + /** @type {!Array} */ + self.plugOutlineMaskShapeSE = [0, 1].map(function(n) { + n = self.plugOutlineMaskSE[n].appendChild(doc.createElementNS(i, "use")); + return n.className.baseVal = name + "-plug-outline-mask-shape", n; + }); + /** @type {!Array} */ + self.plugMarkerIdSE = [node_ + "-plug-marker-0", node_ + "-plug-marker-1"]; + /** @type {!Array} */ + self.plugMarkerSE = [0, 1].map(function(element) { + element = render(self.plugMarkerIdSE[element]); + return model && (element.markerUnits.baseVal = SVGMarkerElement.SVG_MARKERUNITS_USERSPACEONUSE), element; + }); + /** @type {!Array} */ + self.plugMarkerShapeSE = [0, 1].map(function(parentId) { + return self.plugMarkerSE[parentId].appendChild(doc.createElementNS(i, "g")); + }); + /** @type {!Array} */ + self.plugFaceSE = [0, 1].map(function(parentId) { + return self.plugMarkerShapeSE[parentId].appendChild(doc.createElementNS(i, "use")); + }); + /** @type {!Array} */ + self.plugOutlineFaceSE = [0, 1].map(function(n) { + var elem = self.plugMarkerShapeSE[n].appendChild(doc.createElementNS(i, "use")); + return elem.style.mask = "url(#" + map[n] + ")", elem.style.display = "none", elem; + }); + self.plugsFace = target = self.face.appendChild(doc.createElementNS(i, "use")); + /** @type {string} */ + target.className.baseVal = name + "-plugs-face"; + /** @type {string} */ + target.href.baseVal = "#" + elementId; + /** @type {string} */ + target.style.display = "none"; + if (self.curStats.show_inAnim) { + /** @type {number} */ + self.isShown = 1; + state[e.show_effect].stop(self, true); + } else { + if (!self.isShown) { + /** @type {string} */ + svg.style.visibility = "hidden"; + } + } + doc.body.appendChild(svg); + [0, 1, 2].forEach(function(o) { + var group; + o = self.options.labelSEM[o]; + if (o && format(o, "label") && (group = items[o._id]).conf.initSvg) { + group.conf.initSvg(group, self); + } + }); + /** @type {boolean} */ + args.line = args.plug = args.lineOutline = args.plugOutline = args.faces = args.effect = true; + } + args.position = get(item, parent, "path", data, null, null, cfg.path) || args.position; + args.position = get(item, parent, "startSocket", offset, "socketSE", 0) || args.position; + args.position = get(item, parent, "endSocket", offset, "socketSE", 1) || args.position; + [parent.startSocketGravity, parent.endSocketGravity].forEach(function(data, key) { + var b; + var a; + /** @type {boolean} */ + var value = false; + if (null != data) { + if (Array.isArray(data)) { + if (expect(data[0]) && expect(data[1])) { + /** @type {!Array} */ + value = [data[0], data[1]]; + if (Array.isArray(item.socketGravitySE[key]) && (b = value, a = item.socketGravitySE[key], b.length === a.length && b.every(function(s, i) { + return s === a[i]; + }))) { + /** @type {boolean} */ + value = false; + } + } + } else { + if ((data + "").toLowerCase() === on) { + /** @type {null} */ + value = null; + } else { + if (expect(data) && 0 <= data) { + /** @type {number} */ + value = data; + } + } + if (value === item.socketGravitySE[key]) { + /** @type {boolean} */ + value = false; + } + } + if (false !== value) { + /** @type {boolean} */ + item.socketGravitySE[key] = value; + /** @type {boolean} */ + args.position = true; + } + } + }); + args.line = callback(item, parent, "color", null, "lineColor", null, cfg.lineColor, null, true) || args.line; + args.line = callback(item, parent, "size", null, "lineSize", null, cfg.lineSize, function(canCreateDiscussions) { + return 0 < canCreateDiscussions; + }) || args.line; + ["startPlug", "endPlug"].forEach(function(name, path) { + args.plug = get(item, parent, name, day, "plugSE", path, cfg.plugSE[path]) || args.plug; + args.plug = callback(item, parent, name + "Color", "string", "plugColorSE", path, null, null, true) || args.plug; + args.plug = callback(item, parent, name + "Size", null, "plugSizeSE", path, cfg.plugSizeSE[path], function(canCreateDiscussions) { + return 0 < canCreateDiscussions; + }) || args.plug; + }); + args.lineOutline = callback(item, parent, "outline", null, "lineOutlineEnabled", null, cfg.lineOutlineEnabled) || args.lineOutline; + args.lineOutline = callback(item, parent, "outlineColor", null, "lineOutlineColor", null, cfg.lineOutlineColor, null, true) || args.lineOutline; + args.lineOutline = callback(item, parent, "outlineSize", null, "lineOutlineSize", null, cfg.lineOutlineSize, function(canCreateDiscussions) { + return 0 < canCreateDiscussions && canCreateDiscussions <= .48; + }) || args.lineOutline; + ["startPlugOutline", "endPlugOutline"].forEach(function(k, path) { + args.plugOutline = callback(item, parent, k, null, "plugOutlineEnabledSE", path, cfg.plugOutlineEnabledSE[path]) || args.plugOutline; + args.plugOutline = callback(item, parent, k + "Color", "string", "plugOutlineColorSE", path, null, null, true) || args.plugOutline; + args.plugOutline = callback(item, parent, k + "Size", null, "plugOutlineSizeSE", path, cfg.plugOutlineSizeSE[path], function(canCreateDiscussions) { + return 1 <= canCreateDiscussions; + }) || args.plugOutline; + }); + ["startLabel", "endLabel", "middleLabel"].forEach(function(i, fieldName) { + var sid; + var test; + var o; + var val = parent[i]; + var undefined = item.labelSEM[fieldName] && !obj.optionIsAttach.labelSEM[fieldName] ? items[item.labelSEM[fieldName]._id].text : item.labelSEM[fieldName]; + /** @type {boolean} */ + var msg = false; + if ((sid = "string" == typeof val) && (val = val.trim()), (sid || val && (msg = format(val, "label"))) && val !== undefined) { + if (item.labelSEM[fieldName] && (run(obj, items[item.labelSEM[fieldName]._id]), item.labelSEM[fieldName] = ""), val) { + if (msg ? (test = items[(o = val)._id]).boundTargets.slice().forEach(function(index) { + test.conf.removeOption(test, index); + }) : o = new Error(args.captionLabel, [val]), !done(obj, items[o._id], i)) { + throw new Error("Can't bind attachment"); + } + item.labelSEM[fieldName] = o; + } + obj.optionIsAttach.labelSEM[fieldName] = msg; + } + }); + Object.keys(params).forEach(function(key) { + /** + * @param {!Object} requestId + * @return {?} + */ + function factory(requestId) { + var f = {}; + return config.optionsConf.forEach(function(match) { + var last = match[0]; + var version = match[3]; + if (!(null == match[4] || f[version])) { + /** @type {!Array} */ + f[version] = []; + } + ("function" == typeof last ? last : "id" === last ? get : callback).apply(null, [f, requestId].concat(match.slice(1))); + }), f; + } + /** + * @param {!Object} data + * @return {?} + */ + function render(data) { + var formatter; + /** @type {string} */ + var name = key + "_animOptions"; + return data.hasOwnProperty("animation") ? isArray(data.animation) ? formatter = obj.curStats[name] = load(data.animation, config.defaultAnimOptions) : (formatter = !!data.animation, obj.curStats[name] = formatter ? load({}, config.defaultAnimOptions) : null) : (formatter = !!config.defaultEnabled, obj.curStats[name] = formatter ? load({}, config.defaultAnimOptions) : null), formatter; + } + var data; + var result; + var config = params[key]; + /** @type {string} */ + var type = key + "_enabled"; + /** @type {string} */ + var i = key + "_options"; + if (parent.hasOwnProperty(key)) { + data = parent[key]; + if (isArray(data)) { + /** @type {boolean} */ + obj.curStats[type] = true; + result = obj.curStats[i] = factory(data); + if (config.anim) { + obj.curStats[i].animation = render(data); + } + } else { + if (result = obj.curStats[type] = !!data) { + obj.curStats[i] = factory({}); + if (config.anim) { + obj.curStats[i].animation = render({}); + } + } + } + if (extend(result, item[key])) { + item[key] = result; + /** @type {boolean} */ + args.effect = true; + } + } + }); + update(obj, args); + } + /** + * @param {!Object} date + * @param {!Object} value + * @param {!Object} options + * @return {undefined} + */ + function list(date, value, options) { + var data = { + options : { + anchorSE : [], + socketSE : [], + socketGravitySE : [], + plugSE : [], + plugColorSE : [], + plugSizeSE : [], + plugOutlineEnabledSE : [], + plugOutlineColorSE : [], + plugOutlineSizeSE : [], + labelSEM : ["", "", ""] + }, + optionIsAttach : { + anchorSE : [false, false], + labelSEM : [false, false, false] + }, + curStats : {}, + aplStats : {}, + attachments : [], + events : {}, + reflowTargets : [] + }; + resolve(data.curStats, NS); + resolve(data.aplStats, NS); + Object.keys(params).forEach(function(i) { + var src = params[i].stats; + resolve(data.curStats, src); + resolve(data.aplStats, src); + /** @type {boolean} */ + data.options[i] = false; + }); + resolve(data.curStats, u); + resolve(data.aplStats, u); + /** @type {string} */ + data.curStats.show_effect = reducerMountPoint; + data.curStats.show_animOptions = normalize(state[reducerMountPoint].defaultAnimOptions); + Object.defineProperty(this, "_id", { + value : ++uniqueId + }); + data._id = this._id; + elements[this._id] = data; + if (1 === arguments.length) { + /** @type {!Object} */ + options = date; + /** @type {null} */ + date = null; + } + options = options || {}; + if (date || value) { + options = normalize(options); + if (date) { + /** @type {!Object} */ + options.start = date; + } + if (value) { + /** @type {!Object} */ + options.end = value; + } + } + /** @type {boolean} */ + data.isShown = data.aplStats.show_on = !options.hide; + this.setOptions(options); + } + /** + * @param {string} v + * @return {?} + */ + function refresh(v) { + return function(name) { + var options = {}; + options[v] = name; + this.setOptions(options); + }; + } + /** + * @param {!Object} res + * @param {string} args + * @return {undefined} + */ + function validate(res, args) { + var result; + var self = { + conf : res, + curStats : {}, + aplStats : {}, + boundTargets : [] + }; + var data = {}; + res.argOptions.every(function(component) { + return !(!args.length || ("string" == typeof component.type ? typeof args[0] !== component.type : "function" != typeof component.type || !component.type(args[0]))) && (data[component.optionName] = args.shift(), true); + }); + result = args.length && isArray(args[0]) ? normalize(args[0]) : {}; + Object.keys(data).forEach(function(i) { + result[i] = data[i]; + }); + if (res.stats) { + resolve(self.curStats, res.stats); + resolve(self.aplStats, res.stats); + } + Object.defineProperty(this, "_id", { + value : ++nextid + }); + Object.defineProperty(this, "isRemoved", { + get : function() { + return !items[this._id]; + } + }); + self._id = this._id; + if (!(res.init && !res.init(self, result))) { + items[this._id] = self; + } + } + var params; + var state; + var args; + var Error; + var format; + var setup; + var _takingTooLongTimeout; + var isShallow; + var values; + var isSorted; + var filters; + var n; + var result; + var s; + var len; + var scope; + var r; + var valueByIndex; + var results; + var callId; + var toString; + var toStr; + var Version; + /** @type {string} */ + var name = "leader-line"; + /** @type {number} */ + var top = 1; + /** @type {number} */ + var undefined = 2; + /** @type {number} */ + var el = 3; + /** @type {number} */ + var left = 4; + var offset = { + top : top, + right : undefined, + bottom : el, + left : left + }; + /** @type {number} */ + var straight = 1; + /** @type {number} */ + var angle = 2; + /** @type {number} */ + var apexRestPath = 3; + /** @type {number} */ + var object = 4; + /** @type {number} */ + var v = 5; + var data = { + straight : straight, + arc : angle, + fluid : apexRestPath, + magnet : object, + grid : v + }; + /** @type {string} */ + var v_res = "behind"; + /** @type {string} */ + var selectId = name + "-defs"; + /** @type {string} */ + var template = '