diff --git a/packages/nc-gui/app.vue b/packages/nc-gui/app.vue index 4c57910a95..b291c1d8e7 100644 --- a/packages/nc-gui/app.vue +++ b/packages/nc-gui/app.vue @@ -1,14 +1,20 @@ diff --git a/packages/nc-gui/assets/css/typesense-docsearch.css b/packages/nc-gui/assets/css/typesense-docsearch.css new file mode 100644 index 0000000000..e09324508a --- /dev/null +++ b/packages/nc-gui/assets/css/typesense-docsearch.css @@ -0,0 +1,2 @@ +/*! typesense-docsearch-css 0.4.1 (UNRELEASED 1db4c40) | MIT License | © Algolia, Inc. and contributors | https://typesense.org/docs/latest/guide/docsearch.html */ +:root{--docsearch-primary-color:#1035bc;--docsearch-text-color:#1c1e21;--docsearch-spacing:12px;--docsearch-icon-stroke-width:1.4;--docsearch-highlight-color:var(--docsearch-primary-color);--docsearch-muted-color:#969faf;--docsearch-container-background:rgba(101,108,133,0.8);--docsearch-logo-color:#1035bc;--docsearch-modal-width:650px;--docsearch-modal-height:600px;--docsearch-modal-background:#f5f6f7;--docsearch-modal-shadow:inset 1px 1px 0 0 hsla(0,0%,100%,0.5),0 3px 8px 0 #555a64;--docsearch-searchbox-height:56px;--docsearch-searchbox-background:#ebedf0;--docsearch-searchbox-focus-background:#fff;--docsearch-searchbox-shadow:inset 0 0 0 2px var(--docsearch-primary-color);--docsearch-hit-height:56px;--docsearch-hit-color:#444950;--docsearch-hit-active-color:#fff;--docsearch-hit-background:#fff;--docsearch-hit-shadow:0 1px 3px 0 #d4d9e1;--docsearch-key-gradient:linear-gradient(-225deg,#d5dbe4,#f8f8f8);--docsearch-key-shadow:inset 0 -2px 0 0 #cdcde6,inset 0 0 1px 1px #fff,0 1px 2px 1px rgba(30,35,90,0.4);--docsearch-footer-height:44px;--docsearch-footer-background:#fff;--docsearch-footer-shadow:0 -1px 0 0 #e0e3e8,0 -3px 6px 0 rgba(69,98,155,0.12)}html[data-theme=dark]{--docsearch-text-color:#f5f6f7;--docsearch-container-background:rgba(9,10,17,0.8);--docsearch-modal-background:#15172a;--docsearch-modal-shadow:inset 1px 1px 0 0 #2c2e40,0 3px 8px 0 #000309;--docsearch-searchbox-background:#090a11;--docsearch-searchbox-focus-background:#000;--docsearch-hit-color:#bec3c9;--docsearch-hit-shadow:none;--docsearch-hit-background:#090a11;--docsearch-key-gradient:linear-gradient(-26.5deg,#565872,#31355b);--docsearch-key-shadow:inset 0 -2px 0 0 #282d55,inset 0 0 1px 1px #51577d,0 2px 2px 0 rgba(3,4,9,0.3);--docsearch-footer-background:#1e2136;--docsearch-footer-shadow:inset 0 1px 0 0 rgba(73,76,106,0.5),0 -4px 8px 0 rgba(0,0,0,0.2);--docsearch-logo-color:#fff;--docsearch-muted-color:#7f8497}.DocSearch-Button{align-items:center;background:var(--docsearch-searchbox-background);border:0;border-radius:40px;color:var(--docsearch-muted-color);cursor:pointer;display:flex;font-weight:500;height:36px;justify-content:space-between;margin:0 0 0 16px;padding:0 8px;user-select:none}.DocSearch-Button:active,.DocSearch-Button:focus,.DocSearch-Button:hover{background:var(--docsearch-searchbox-focus-background);box-shadow:var(--docsearch-searchbox-shadow);color:var(--docsearch-text-color);outline:none}.DocSearch-Button-Container{align-items:center;display:flex}.DocSearch-Search-Icon{stroke-width:1.6}.DocSearch-Button .DocSearch-Search-Icon{color:var(--docsearch-text-color)}.DocSearch-Button-Placeholder{font-size:1rem;padding:0 12px 0 6px}.DocSearch-Button-Keys{display:flex;min-width:calc(40px + .8em)}.DocSearch-Button-Key{align-items:center;background:var(--docsearch-key-gradient);border-radius:3px;box-shadow:var(--docsearch-key-shadow);color:var(--docsearch-muted-color);display:flex;height:18px;justify-content:center;margin-right:.4em;position:relative;padding:0 0 2px;border:0;top:-1px;width:20px}@media (max-width:768px){.DocSearch-Button-Keys,.DocSearch-Button-Placeholder{display:none}}.DocSearch--active{overflow:hidden!important}.DocSearch-Container,.DocSearch-Container *{box-sizing:border-box}.DocSearch-Container{background-color:hsla(0,0%,100%,.5);height:100vh;left:0;position:fixed;top:0;width:100vw;z-index:9999}.DocSearch-Container a{text-decoration:none}.DocSearch-Link{appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;font:inherit;margin:0;padding:0}.DocSearch-Modal{background:#fff;border-radius:8px;box-shadow:0 16px 70px rgb(0 0 0/50%);flex-direction:column;max-width:640px;height:25.24rem;position:relative;top:20%;inset-inline:0;margin:0 auto}.DocSearch-SearchBar{display:flex}.DocSearch-Form{align-items:center;display:flex;height:var(--docsearch-searchbox-height);border-bottom:1px solid #e6e6e6;margin:0;padding:0;position:relative;width:100%}.DocSearch-Input{appearance:none;background:transparent;border:0;color:var(--docsearch-text-color);flex:1;font:inherit;font-size:1.2em;height:100%;outline:none;padding-inline:1.25em;width:80%}.DocSearch-Input:focus{@apply !border-none !outline-none !ring-0;border:none;outline:none}.DocSearch-Input::placeholder{color:var(--docsearch-muted-color);opacity:1}.DocSearch-Input::-webkit-search-cancel-button,.DocSearch-Input::-webkit-search-decoration,.DocSearch-Input::-webkit-search-results-button,.DocSearch-Input::-webkit-search-results-decoration{display:none}.DocSearch-LoadingIndicator,.DocSearch-MagnifierLabel,.DocSearch-Reset{margin:0;padding:0}.DocSearch-MagnifierLabel,.DocSearch-Reset{align-items:center;color:var(--docsearch-highlight-color);display:flex;justify-content:center}.DocSearch-Container--Stalled .DocSearch-MagnifierLabel,.DocSearch-LoadingIndicator{display:none}.DocSearch-Container--Stalled .DocSearch-LoadingIndicator{align-items:center;color:var(--docsearch-highlight-color);display:flex;justify-content:center}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Reset{animation:none;appearance:none;background:none;border:0;border-radius:50%;color:var(--docsearch-icon-color);cursor:pointer;right:0;stroke-width:var(--docsearch-icon-stroke-width)}}.DocSearch-Reset{animation:fade-in .1s ease-in forwards;appearance:none;background:none;border:0;border-radius:50%;color:var(--docsearch-icon-color);cursor:pointer;padding:2px;right:0;stroke-width:var(--docsearch-icon-stroke-width)}.DocSearch-Reset[hidden]{display:none}.DocSearch-Reset:hover{color:var(--docsearch-highlight-color)}.DocSearch-LoadingIndicator svg,.DocSearch-MagnifierLabel svg{height:24px;width:24px}.DocSearch-Cancel{display:none}.DocSearch-Dropdown{max-height:20rem;min-height:var(--docsearch-spacing);overflow-y:auto;overflow-y:scroll;padding:0 var(--docsearch-spacing)}.nc-scrollbar-md{overflow-y:scroll;overflow-x:hidden}.nc-scrollbar-md::-webkit-scrollbar{width:4px;height:4px}.nc-scrollbar-md::-webkit-scrollbar-track-piece{width:0}.nc-scrollbar-md::-webkit-scrollbar{background:transparent}.nc-scrollbar-md::-webkit-scrollbar-thumb{width:4px;background:#d5d5d9}.nc-scrollbar-md::-webkit-scrollbar-thumb:hover{background:#9aa2af}.DocSearch-Dropdown ul{list-style:none;margin:0;padding:0}.DocSearch-Label{font-size:.75em;line-height:1.6em}.DocSearch-Help,.DocSearch-Label{color:var(--docsearch-muted-color)}.DocSearch-Help{font-size:.9em;margin:0;user-select:none}.DocSearch-Title{font-size:1.2em}.DocSearch-Logo a{display:flex}.DocSearch-Logo svg{color:var(--docsearch-logo-color);margin-left:8px}.DocSearch-Hits:last-of-type{margin-bottom:24px}.DocSearch-Hits mark{background:none;color:var(--docsearch-highlight-color)}.DocSearch-HitsFooter{color:var(--docsearch-muted-color);display:flex;font-size:.85em;justify-content:center;margin-bottom:var(--docsearch-spacing);padding:var(--docsearch-spacing)}.DocSearch-HitsFooter a{border-bottom:1px solid;color:inherit}.DocSearch-Hit{border-radius:4px;display:flex;padding-bottom:4px;position:relative}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Hit--deleting{transition:none}}.DocSearch-Hit--deleting{opacity:0;transition:all .25s linear}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Hit--favoriting{transition:none}}.DocSearch-Hit--favoriting{transform:scale(0);transform-origin:top center;transition:all .25s linear;transition-delay:.25s}.DocSearch-Hit a{background:#fff;border-left:4px solid #fff;display:block;padding-left:var(--docsearch-spacing);width:100%}.DocSearch-Hit-source{background:#fff;color:var(--docsearch-highlight-color);font-size:.85em;font-weight:600;line-height:32px;margin:0 -4px;padding:8px 4px 0;position:sticky;top:0;z-index:10}.DocSearch-Hit-Tree{color:var(--docsearch-muted-color);height:var(--docsearch-hit-height);opacity:.5;stroke-width:var(--docsearch-icon-stroke-width);width:24px}.DocSearch-Hit[aria-selected=true] a{background-color:#f4f4f5;border-left:4px solid #36f}.DocSearch-Hit[aria-selected=true] mark{text-decoration:none}.DocSearch-Hit-Container{align-items:center;color:var(--docsearch-hit-color);display:flex;flex-direction:row;height:var(--docsearch-hit-height);padding:0 var(--docsearch-spacing) 0 0}.DocSearch-Hit-icon{height:20px;width:20px}.DocSearch-Hit-action,.DocSearch-Hit-icon{color:var(--docsearch-muted-color);stroke-width:var(--docsearch-icon-stroke-width)}.DocSearch-Hit-action{align-items:center;display:flex;height:22px;width:22px}.DocSearch-Hit-action svg{display:block;height:18px;width:18px}.DocSearch-Hit-action+.DocSearch-Hit-action{margin-left:6px}.DocSearch-Hit-action-button{appearance:none;background:none;border:0;border-radius:50%;color:inherit;cursor:pointer;padding:2px}svg.DocSearch-Hit-Select-Icon{display:none}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Select-Icon{display:block}.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:rgba(0,0,0,.2);transition:background-color .1s ease-in}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{transition:none}}.DocSearch-Hit-action-button:focus path,.DocSearch-Hit-action-button:hover path{fill:#fff}.DocSearch-Hit-content-wrapper{display:flex;flex:1 1 auto;flex-direction:column;font-weight:500;justify-content:center;line-height:1.2em;margin:0 8px;overflow-x:hidden;position:relative;text-overflow:ellipsis;white-space:nowrap;width:80%}.DocSearch-Hit-title{font-size:14px;font-weight:500;color:#1f293a}.DocSearch-Hit-path{color:var(--docsearch-muted-color);font-size:.75em}.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-action,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-icon,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-path,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-text,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-title,.DocSearch-Hit[aria-selected=true] .DocSearch-Hit-Tree,.DocSearch-Hit[aria-selected=true] mark{color:#1f293a}@media screen and (prefers-reduced-motion:reduce){.DocSearch-Hit-action-button:focus,.DocSearch-Hit-action-button:hover{background:rgba(0,0,0,.2);transition:none}}.DocSearch-ErrorScreen,.DocSearch-NoResults,.DocSearch-StartScreen{font-size:.9em;margin:0 auto;padding:36px 0;text-align:center;width:80%}.DocSearch-Screen-Icon{color:var(--docsearch-muted-color);padding-bottom:12px}.DocSearch-NoResults-Prefill-List{display:inline-block;padding-bottom:24px;text-align:left}.DocSearch-NoResults-Prefill-List ul{display:inline-block;padding:8px 0 0}.DocSearch-NoResults-Prefill-List li{list-style-position:inside;list-style-type:"» "}.DocSearch-Prefill{appearance:none;background:none;border:0;border-radius:1em;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;font-size:1em;font-weight:700;padding:0}.DocSearch-Prefill:focus,.DocSearch-Prefill:hover{outline:none;text-decoration:none}.DocSearch-Footer{align-items:center;background:var(--docsearch-footer-background);border-radius:0 0 8px 8px;border-top:1px solid #e6e6e6;display:flex;flex-direction:row;flex-grow:1;padding:0;position:absolute;bottom:0;user-select:none;width:100%;z-index:300}.doc-container{padding-block:.75rem;padding-inline:.5rem}.doc-container,.doc-footer-item{display:flex;justify-content:center;width:100%}.doc-footer-item{gap:.5rem;align-items:center;color:#65696f;font-size:.875rem;line-height:1.25rem}.doc-icon{width:1rem;height:1rem}.doc-shortcut{padding-inline:.25rem;border-radius:.375rem;border:1px solid #d5d5d9;background-color:#f3f4f6}.doc-shortcut-active{color:#36f}.doc-icon-active{color:#fff;background-color:#36f;border:1px solid #36f}.DocSearch-Commands{color:var(--docsearch-muted-color);display:flex;list-style:none;margin:0;padding:0}.DocSearch-Commands li{align-items:center;display:flex}.DocSearch-Commands li:not(:last-of-type){margin-right:.8em}.DocSearch-Commands-Key{align-items:center;background:var(--docsearch-key-gradient);border-radius:2px;box-shadow:var(--docsearch-key-shadow);display:flex;height:18px;justify-content:center;margin-right:.4em;padding:0 0 1px;color:var(--docsearch-muted-color);border:0;width:20px}@media (max-width:768px){:root{--docsearch-spacing:10px;--docsearch-footer-height:40px}.DocSearch-Dropdown{height:100%}.DocSearch-Container{height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh, 1vh)*100);position:absolute}.DocSearch-Footer{padding:0;border-radius:0;bottom:0;position:absolute}.DocSearch-Hit-content-wrapper{display:flex;position:relative;width:80%}.DocSearch-Modal{border-radius:0;box-shadow:none;height:100vh;height:-webkit-fill-available;height:calc(var(--docsearch-vh, 1vh)*100);margin:0;max-width:100%;width:100%}.DocSearch-Dropdown{max-height:calc(var(--docsearch-vh, 1vh)*100 - var(--docsearch-searchbox-height) - var(--docsearch-spacing) - var(--docsearch-footer-height))}.DocSearch-Cancel{appearance:none;background:none;border:0;color:var(--docsearch-highlight-color);cursor:pointer;display:inline-block;flex:none;font:inherit;font-size:1em;font-weight:500;margin-left:var(--docsearch-spacing);outline:none;overflow:hidden;padding:0;user-select:none;white-space:nowrap}.DocSearch-Commands,.DocSearch-Hit-Tree{display:none}}@keyframes fade-in{0%{opacity:0}to{opacity:1}} diff --git a/packages/nc-gui/components/cmd-footer/index.vue b/packages/nc-gui/components/cmd-footer/index.vue new file mode 100644 index 0000000000..72a594da40 --- /dev/null +++ b/packages/nc-gui/components/cmd-footer/index.vue @@ -0,0 +1,61 @@ + + + diff --git a/packages/nc-gui/components/cmd-j/index.vue b/packages/nc-gui/components/cmd-j/index.vue new file mode 100644 index 0000000000..86138c63ce --- /dev/null +++ b/packages/nc-gui/components/cmd-j/index.vue @@ -0,0 +1,34 @@ + + + + + diff --git a/packages/nc-gui/components/cmd-k/command-score.ts b/packages/nc-gui/components/cmd-k/command-score.ts new file mode 100644 index 0000000000..e36637ef41 --- /dev/null +++ b/packages/nc-gui/components/cmd-k/command-score.ts @@ -0,0 +1,162 @@ +// this is derived from https://github.com/pacocoursey/cmdk + +// The scores are arranged so that a continuous match of characters will +// result in a total score of 1. +// +// The best case, this character is a match, and either this is the start +// of the string, or the previous character was also a match. +const SCORE_CONTINUE_MATCH = 1.9 +// A new match at the start of a word scores better than a new match +// elsewhere as it's more likely that the user will type the starts +// of fragments. +// NOTE: We score word jumps between spaces slightly higher than slashes, brackets +// hyphens, etc. +const SCORE_SPACE_WORD_JUMP = 1.0 +const SCORE_NON_SPACE_WORD_JUMP = 0.8 +// Any other match isn't ideal, but we include it for completeness. +const SCORE_CHARACTER_JUMP = 0.2 +// If the user transposed two letters, it should be significantly penalized. +// +// i.e. "ouch" is more likely than "curtain" when "uc" is typed. +const SCORE_TRANSPOSITION = 0.3 +// The goodness of a match should decay slightly with each missing +// character. +// +// i.e. "bad" is more likely than "bard" when "bd" is typed. +// +// This will not change the order of suggestions based on SCORE_* until +// 100 characters are inserted between matches. +const PENALTY_SKIPPED = 0.999 +// The goodness of an exact-case match should be higher than a +// case-insensitive match by a small amount. +// +// i.e. "HTML" is more likely than "haml" when "HM" is typed. +// +// This will not change the order of suggestions based on SCORE_* until +// 1000 characters are inserted between matches. +const PENALTY_CASE_MISMATCH = 0.999999 +// Match higher for letters closer to the beginning of the word +// const PENALTY_DISTANCE_FROM_START = 0.9 +// If the word has more characters than the user typed, it should +// be penalised slightly. +// +// i.e. "html" is more likely than "html5" if I type "html". +// +// However, it may well be the case that there's a sensible secondary +// ordering (like alphabetical) that it makes sense to rely on when +// there are many prefix matches, so we don't make the penalty increase +// with the number of tokens. +const PENALTY_NOT_COMPLETE = 0.98 + +const IS_GAP_REGEXP = /[\\\/_+.#"@\[\(\{&]/ +const COUNT_GAPS_REGEXP = /[\\\/_+.#"@\[\(\{&]/g +const IS_SPACE_REGEXP = /[\s-]/ +const COUNT_SPACE_REGEXP = /[\s-]/g + +function commandScoreInner( + string: string, + abbreviation: string, + lowerString: string, + lowerAbbreviation: string, + stringIndex: number, + abbreviationIndex: number, + memoizedResults: { [x: string]: number }, +) { + if (abbreviationIndex === abbreviation.length) { + if (stringIndex === string.length) { + return SCORE_CONTINUE_MATCH + } + return PENALTY_NOT_COMPLETE + } + + const memoizeKey = `${stringIndex},${abbreviationIndex}` + if (memoizedResults[memoizeKey] !== undefined) { + return memoizedResults[memoizeKey] + } + + const abbreviationChar = lowerAbbreviation.charAt(abbreviationIndex) + let index = lowerString.indexOf(abbreviationChar, stringIndex) + let highScore = 0 + + let score, transposedScore, wordBreaks, spaceBreaks + + while (index >= 0) { + score = commandScoreInner( + string, + abbreviation, + lowerString, + lowerAbbreviation, + index + 1, + abbreviationIndex + 1, + memoizedResults, + ) + if (score > highScore) { + if (index === stringIndex) { + score *= SCORE_CONTINUE_MATCH + } else if (IS_GAP_REGEXP.test(string.charAt(index - 1))) { + score *= SCORE_NON_SPACE_WORD_JUMP + wordBreaks = string.slice(stringIndex, index - 1).match(COUNT_GAPS_REGEXP) + if (wordBreaks && stringIndex > 0) { + score *= PENALTY_SKIPPED ** wordBreaks.length + } + } else if (IS_SPACE_REGEXP.test(string.charAt(index - 1))) { + score *= SCORE_SPACE_WORD_JUMP + spaceBreaks = string.slice(stringIndex, index - 1).match(COUNT_SPACE_REGEXP) + if (spaceBreaks && stringIndex > 0) { + score *= PENALTY_SKIPPED ** spaceBreaks.length + } + } else { + score *= SCORE_CHARACTER_JUMP + if (stringIndex > 0) { + score *= PENALTY_SKIPPED ** (index - stringIndex) + } + } + + if (string.charAt(index) !== abbreviation.charAt(abbreviationIndex)) { + score *= PENALTY_CASE_MISMATCH + } + } + + if ( + (score < SCORE_TRANSPOSITION && lowerString.charAt(index - 1) === lowerAbbreviation.charAt(abbreviationIndex + 1)) || + (lowerAbbreviation.charAt(abbreviationIndex + 1) === lowerAbbreviation.charAt(abbreviationIndex) && // allow duplicate letters. Ref #7428 + lowerString.charAt(index - 1) !== lowerAbbreviation.charAt(abbreviationIndex)) + ) { + transposedScore = commandScoreInner( + string, + abbreviation, + lowerString, + lowerAbbreviation, + index + 1, + abbreviationIndex + 2, + memoizedResults, + ) + + if (transposedScore * SCORE_TRANSPOSITION > score) { + score = transposedScore * SCORE_TRANSPOSITION + } + } + + if (score > highScore) { + highScore = score + } + + index = lowerString.indexOf(abbreviationChar, index + 1) + } + + memoizedResults[memoizeKey] = highScore + return highScore +} + +function formatInput(string: string) { + // convert all valid space characters to space so they match each other + return string.toLowerCase().replace(COUNT_SPACE_REGEXP, ' ') +} + +export function commandScore(string: string, abbreviation: string): number { + /* NOTE: + * in the original, we used to do the lower-casing on each recursive call, but this meant that toLowerCase() + * was the dominating cost in the algorithm, passing both is a little ugly, but considerably faster. + */ + return commandScoreInner(string, abbreviation, formatInput(string), formatInput(abbreviation), 0, 0, {}) +} diff --git a/packages/nc-gui/components/cmd-k/index.vue b/packages/nc-gui/components/cmd-k/index.vue index 04d85e1bdb..a78001545f 100644 --- a/packages/nc-gui/components/cmd-k/index.vue +++ b/packages/nc-gui/components/cmd-k/index.vue @@ -1,3 +1,623 @@ + + + + diff --git a/packages/nc-gui/components/cmd-l/index.vue b/packages/nc-gui/components/cmd-l/index.vue new file mode 100644 index 0000000000..57e99cd02c --- /dev/null +++ b/packages/nc-gui/components/cmd-l/index.vue @@ -0,0 +1,307 @@ + + + + + diff --git a/packages/nc-gui/components/dashboard/Sidebar/TopSection/Header.vue b/packages/nc-gui/components/dashboard/Sidebar/TopSection/Header.vue index 34bc188cf7..4f128affa0 100644 --- a/packages/nc-gui/components/dashboard/Sidebar/TopSection/Header.vue +++ b/packages/nc-gui/components/dashboard/Sidebar/TopSection/Header.vue @@ -1 +1,26 @@ - + + + diff --git a/packages/nc-gui/components/workspace/CreateProjectDlg.vue b/packages/nc-gui/components/workspace/CreateProjectDlg.vue index 1f49e1b6c6..7c4212203c 100644 --- a/packages/nc-gui/components/workspace/CreateProjectDlg.vue +++ b/packages/nc-gui/components/workspace/CreateProjectDlg.vue @@ -19,10 +19,13 @@ const dialogShow = useVModel(props, 'modelValue', emit) const baseType = computed(() => props.type ?? NcProjectType.DB) const basesStore = useBases() + const { createProject: _createProject } = basesStore const { navigateToProject } = useGlobal() +const { refreshCommandPalette } = useCommandPalette() + const nameValidationRules = [ { required: true, @@ -59,6 +62,7 @@ const createProject = async () => { setTimeout(() => { creating.value = false }, 500) + refreshCommandPalette() } } diff --git a/packages/nc-gui/composables/useCommandPalette/commands.ts b/packages/nc-gui/composables/useCommandPalette/commands.ts new file mode 100644 index 0000000000..407a2bf86f --- /dev/null +++ b/packages/nc-gui/composables/useCommandPalette/commands.ts @@ -0,0 +1,77 @@ +import { navigateTo } from '#imports' + +export const homeCommands = [ + { + id: 'user', + title: 'Account', + icon: 'account', + section: 'Accounts', + }, + { + id: 'user_account-settings', + title: 'Account Settings', + icon: 'settings', + parent: 'user', + section: 'Account', + handler: () => { + navigateTo('/account/profile') + }, + }, + { + id: 'user_account-logout', + title: 'Logout', + icon: 'signout', + parent: 'user', + section: 'Account', + handler: () => {}, + }, + { + id: 'user_account-discord', + title: 'Discord', + icon: 'discord', + parent: 'user', + section: 'Community', + handler: () => { + navigateTo('https://discord.gg/8jX2GQn', { external: true }) + }, + }, + { + id: 'user_account-twitter', + title: '(formerly Twitter)', + icon: 'twitter', + parent: 'user', + section: 'Community', + handler: () => { + navigateTo('https://twitter.com/NocoDB', { external: true }) + }, + }, + { + id: 'user_account-reddit', + title: 'Reddit', + icon: 'reddit', + parent: 'user', + section: 'Community', + handler: () => { + navigateTo('https://www.reddit.com/r/NocoDB/', { external: true }) + }, + }, +] + +/* + Here is a list of all the available commands defined throughout the app. + Commands prefixed with a '-' are static commands that are always available. + Commands prefixed with a '+' are dynamic commands that are only available when the user is in a specific context. + Commands prefixed with a '*' are scopes + + Commands: + * home (Navigate Home) + + workspaces (Workspaces - EE) + + bases (Projects) + * workspace (Workspace - EE) + + tables (Tables) + + views (Views) + * account_settings (Account Settings) + * account_settings-users (Users) + - account_settings-users-reset_password (Reset Password) + - account_settings-tokens (Tokens) +*/ diff --git a/packages/nc-gui/composables/useCommandPalette/index.ts b/packages/nc-gui/composables/useCommandPalette/index.ts index bf5271af2e..5aaf46e144 100644 --- a/packages/nc-gui/composables/useCommandPalette/index.ts +++ b/packages/nc-gui/composables/useCommandPalette/index.ts @@ -1,20 +1,197 @@ +import type { Ref } from 'vue' +import { homeCommands } from './commands' + +interface CmdAction { + id: string + title: string + hotkey?: string + parent?: string + handler?: Function + icon?: VNode | string + keywords?: string[] + projectName?: string + section?: string +} + export const useCommandPalette = createSharedComposable(() => { + const { $api } = useNuxtApp() + + const router = useRouter() + + const route = router.currentRoute + const commandPalette = ref() const refreshCommandPalette = createEventHook() - const cmdPlaceholder = ref('Quick actions') + const activeScope: Ref<{ scope: string; data: any }> = ref({ scope: 'disabled', data: {} }) + + const cmdLoading = ref(false) + + const cmdPlaceholder = ref('Search...') + + const { token, user, signOut } = useGlobal() + + const commands = ref({ + homeCommands, + baseCommands: [], + } as Record) + + const staticData = computed(() => { + const staticCmd = commands.value.homeCommands + + // Static Commands + staticCmd.map((cmd) => { + if (cmd.id === 'user') { + if (user.value && user.value.display_name && user.value.email) { + cmd.title = user.value.display_name ?? user.value.email.split('@')[0] ?? 'User' + } + } else if (cmd.id === 'user_account-logout') { + cmd.handler = async () => { + await signOut() + window.location.reload() + } + } + return cmd + }) + + if (activeScope.value.scope === 'root') return staticCmd + + staticCmd.push(...commands.value.baseCommands) + + return staticCmd + }) + + const dynamicData = ref([]) + + const tempData = ref([]) + + const loadedTemporaryScopes = ref([]) + + const cmdData = computed(() => { + if (cmdLoading.value) { + return [{ id: 'loading', title: 'Loading...' }, ...staticData.value] + } else { + return [...dynamicData.value, ...staticData.value, ...tempData.value] + } + }) + + function processHandler(handler: { type: string; payload: string }) { + switch (handler.type) { + case 'navigate': + return () => navigateTo(handler.payload) + default: + break + } + } + + async function loadTemporaryScope(scope: { scope: string; data: any }) { + if (loadedTemporaryScopes.value.find((s: any) => s.scope === scope.scope)) return + + if ( + activeScope.value.scope === scope.scope && + Object.keys(scope.data).every((k) => activeScope.value.data[k] && scope.data[k] === activeScope.value.data[k]) + ) + return + $api.utils.commandPalette(scope).then((res) => { + const fetchData = res.map((item: any) => { + if (item.handler) item.handler = processHandler(item.handler) + return item + }) + for (const d of fetchData) { + const fnd = tempData.value.find((t: any) => t.id === d.id) + if (fnd) { + Object.assign(fnd, d) + } else { + tempData.value.push(d) + } + } + loadedTemporaryScopes.value.push(scope) + }) + } + + async function loadScope() { + if (activeScope.value.scope === 'disabled') { + activeScope.value = { scope: activeScope.value.scope, data: activeScope.value.data } + return + } + dynamicData.value = [] + tempData.value = [] + loadedTemporaryScopes.value = [] + cmdLoading.value = true + $api.utils + .commandPalette(activeScope.value) + .then((res) => { + dynamicData.value = res.map((item: any) => { + if (item.handler) item.handler = processHandler(item.handler) + return item + }) + cmdLoading.value = false + }) + .catch((e) => { + cmdLoading.value = false + console.log(e) + }) + } + + refreshCommandPalette.on(() => { + loadScope() + }) + + watch( + () => route.value.params, + () => { + // if user is not authenticated, don't load scope + if (!token.value) return + + if (route.value.params.typeOrId && typeof route.value.params.typeOrId === 'string') { + if (route.value.params.typeOrId === 'base') { + if (activeScope.value.scope === 'disabled') return + + activeScope.value = { scope: 'disabled', data: {} } + + loadScope() + } else if (route.value.params.typeOrId.startsWith('w')) { + if (activeScope.value.data?.workspace_id === route.value.params.typeOrId) return + + activeScope.value = { + scope: `ws-${route.value.params.typeOrId}`, + data: { workspace_id: route.value.params.typeOrId }, + } + + loadScope() + } else if (route.value.params.typeOrId === 'nc') { + if (activeScope.value.data.base_id === route.value.params.baseId) return + + activeScope.value = { + scope: `p-${route.value.params.baseId}`, + data: { base_id: route.value.params.baseId }, + } + } + } else { + if (route.value.path.startsWith('/account')) { + if (activeScope.value.scope === 'account_settings') return + + activeScope.value = { scope: 'account_settings', data: {} } - const cmdData = computed(() => {}) + loadScope() + } else { + if (activeScope.value.scope === 'root') return - const activeScope = computed(() => ({} as any)) + activeScope.value = { scope: 'root', data: {} } - const loadTemporaryScope = (..._args: any) => {} + loadScope() + } + } + }, + { immediate: true, deep: true }, + ) return { commandPalette, cmdData, activeScope, + loadScope, cmdPlaceholder, refreshCommandPalette: refreshCommandPalette.trigger, loadTemporaryScope, diff --git a/packages/nc-gui/lib/types.ts b/packages/nc-gui/lib/types.ts index eb653eb374..41eb09f2ad 100644 --- a/packages/nc-gui/lib/types.ts +++ b/packages/nc-gui/lib/types.ts @@ -182,6 +182,8 @@ interface UsersSortType { direction?: 'asc' | 'desc' } +type CommandPaletteType = 'cmd-k' | 'cmd-j' | 'cmd-l' + export type { User, ProjectMetaInfo, @@ -208,4 +210,5 @@ export type { NcButtonSize, SidebarTableNode, UsersSortType, + CommandPaletteType, } diff --git a/packages/nc-gui/nuxt.config.ts b/packages/nc-gui/nuxt.config.ts index 46f92228c6..2c98e7ed63 100644 --- a/packages/nc-gui/nuxt.config.ts +++ b/packages/nc-gui/nuxt.config.ts @@ -101,6 +101,11 @@ export default defineNuxtConfig({ content: './link-preview.webp', }, ], + script: [ + { + src: '/js/typesense-docsearch.js', + }, + ], }, }, @@ -110,6 +115,7 @@ export default defineNuxtConfig({ 'virtual:windi-devtools', '~/assets/css/global.css', '~/assets/style.scss', + '~/assets/css/typesense-docsearch.css', ], runtimeConfig: { diff --git a/packages/nc-gui/plugins/tele.ts b/packages/nc-gui/plugins/tele.ts index 87d17e95dd..62c14a65e5 100644 --- a/packages/nc-gui/plugins/tele.ts +++ b/packages/nc-gui/plugins/tele.ts @@ -95,4 +95,57 @@ export default defineNuxtPlugin(async (nuxtApp) => { nuxtApp.provide('tele', tele) nuxtApp.provide('e', (e: string, data?: Record) => tele.emit(e, { data })) } + + document.body.removeEventListener('click', clickListener, true) + document.body.addEventListener('click', clickListener, true) + + document.body.removeEventListener('keydown', keydownListener, true) + document.body.addEventListener('keydown', keydownListener, true) }) + +function clickListener(e) { + if (e.nc_handled) return + e.nc_handled = true + let target = e.target + + while (target && !target.classList.contains('DocSearch-Hit')) { + target = target.parentElement + } + if (target) { + const searchInput = document.querySelector('.DocSearch-Input') + const selectedElement = target.querySelector('a') + const url = new URL(selectedElement.href) + + e.preventDefault() + e.stopPropagation() + url.searchParams.append('search', searchInput.value) + url.searchParams.append('origin', location.hostname) + + window.open(url.toString(), '_blank', 'noopener,noreferrer') + } +} + +function keydownListener(e) { + if (e.nc_handled || e.which !== 13) return + e.nc_handled = true + let target = e.target + + while (target && !target.classList.contains('DocSearch-Input')) { + target = target.parentElement + } + + if (target) { + const selectedElement = document.querySelector('.DocSearch-Hit[aria-selected=true] a') + + if (selectedElement) { + const url = new URL(selectedElement.href) + + url.searchParams.append('search', target.value) + url.searchParams.append('origin', location.hostname) + e.preventDefault() + e.stopPropagation() + + window.open(url.toString(), '_blank', 'noopener,noreferrer') + } + } +} diff --git a/packages/nc-gui/public/js/typesense-docsearch.js b/packages/nc-gui/public/js/typesense-docsearch.js new file mode 100644 index 0000000000..02eccd7dc0 --- /dev/null +++ b/packages/nc-gui/public/js/typesense-docsearch.js @@ -0,0 +1,7 @@ +/*! typesense-docsearch.js 3.4.1 (UNRELEASED 1db4c40) | MIT License | © Algolia, Inc. and contributors | https://typesense.org/docs/latest/guide/docsearch.html */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).docsearch=t()}(this,(function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return n(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n3)for(n=[n],i=3;i0?d(y.type,y.props,y.key,null,y.__v):y)){if(y.__=n,y.__b=n.__b+1,null===(m=E[h])||m&&y.key==m.key&&y.type===m.type)E[h]=void 0;else for(p=0;p3)for(n=[n],i=3;i=n.__.length&&n.__.push({}),n.__[e]}function G(e,t,n){var r=Y(U++,2);return r.t=e,r.__c||(r.__=[n?n(t):oe(void 0,t),function(e){var t=r.t(r.__[0],e);r.__[0]!==t&&(r.__=[t,r.__[1]],r.__c.setState({}))}],r.__c=F),r.__}function J(e,t){var n=Y(U++,3);!r.__s&&re(n.__H,t)&&(n.__=e,n.__H=t,F.__H.__h.push(n))}function $(e,t){var n=Y(U++,4);!r.__s&&re(n.__H,t)&&(n.__=e,n.__H=t,F.__h.push(n))}function X(e,t){var n=Y(U++,7);return re(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Q(){B.forEach((function(e){if(e.__P)try{e.__H.__h.forEach(te),e.__H.__h.forEach(ne),e.__H.__h=[]}catch(t){e.__H.__h=[],r.__e(t,e.__v)}})),B=[]}r.__b=function(e){F=null,z&&z(e)},r.__r=function(e){Z&&Z(e),U=0;var t=(F=e.__c).__H;t&&(t.__h.forEach(te),t.__h.forEach(ne),t.__h=[])},r.diffed=function(e){V&&V(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(1!==B.push(t)&&H===r.requestAnimationFrame||((H=r.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),ee&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ee&&(t=requestAnimationFrame(n))})(Q)),F=void 0},r.__c=function(e,t){t.some((function(e){try{e.__h.forEach(te),e.__h=e.__h.filter((function(e){return!e.__||ne(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],r.__e(n,e.__v)}})),W&&W(e,t)},r.unmount=function(e){K&&K(e);var t=e.__c;if(t&&t.__H)try{t.__H.__.forEach(te)}catch(e){r.__e(e,t.__v)}};var ee="function"==typeof requestAnimationFrame;function te(e){var t=F;"function"==typeof e.__c&&e.__c(),F=t}function ne(e){var t=F;e.__c=e.__(),F=t}function re(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function oe(e,t){return"function"==typeof t?t(e):t}function ie(e,t){for(var n in t)e[n]=t[n];return e}function ae(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function se(e){this.props=e}(se.prototype=new m).isPureReactComponent=!0,se.prototype.shouldComponentUpdate=function(e,t){return ae(this.props,e)||ae(this.state,t)};var ue=r.__b;r.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),ue&&ue(e)};var ce="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var le=function(e,t){return null==e?null:E(E(e).map(t))},fe={map:le,forEach:le,count:function(e){return e?E(e).length:0},only:function(e){var t=E(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:E},he=r.__e;function pe(){this.__u=0,this.t=null,this.__b=null}function de(e){var t=e.__.__c;return t&&t.__e&&t.__e(e)}function ve(){this.u=null,this.o=null}r.__e=function(e,t,n){if(e.then)for(var r,o=t;o=o.__;)if((r=o.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t);he(e,t,n)},(pe.prototype=new m).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var o=de(r.__v),i=!1,a=function(){i||(i=!0,n.componentWillUnmount=n.__c,o?o(s):s())};n.__c=n.componentWillUnmount,n.componentWillUnmount=function(){a(),n.__c&&n.__c()};var s=function(){if(!--r.__u){if(r.state.__e){var e=r.state.__e;r.__v.__k[0]=function e(t,n,r){return t&&(t.__v=null,t.__k=t.__k&&t.__k.map((function(t){return e(t,n,r)})),t.__c&&t.__c.__P===n&&(t.__e&&r.insertBefore(t.__e,t.__d),t.__c.__e=!0,t.__c.__P=r)),t}(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__e:r.__b=null});t=r.t.pop();)t.forceUpdate()}},u=!0===t.__h;r.__u++||u||r.setState({__e:r.__b=r.__v.__k[0]}),e.then(a,a)},pe.prototype.componentWillUnmount=function(){this.t=[]},pe.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=function e(t,n,r){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),t.__c.__H=null),null!=(t=ie({},t)).__c&&(t.__c.__P===r&&(t.__c.__P=n),t.__c=null),t.__k=t.__k&&t.__k.map((function(t){return e(t,n,r)}))),t}(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__e&&p(v,null,e.fallback);return o&&(o.__h=null),[p(v,null,t.__e?null:e.children),o]};var me=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]>>1,1),t.i.removeChild(e)}}),N(p(_e,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function ge(e,t){return p(ye,{__v:e,i:t})}(ve.prototype=new m).__e=function(e){var t=this,n=de(t.__v),r=t.o.get(e);return r[0]++,function(o){var i=function(){t.props.revealOrder?(r.push(o),me(t,e,r)):o()};n?n(i):i()}},ve.prototype.render=function(e){this.u=null,this.o=new Map;var t=E(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},ve.prototype.componentDidUpdate=ve.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){me(e,n,t)}))};var be="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,we=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Oe=function(t){return("undefined"!=typeof Symbol&&"symbol"==e(Symbol())?/fil|che|rad/i:/fil|che|ra/i).test(t)};function Ee(e,t,n){return null==t.__k&&(t.textContent=""),N(e,t),"function"==typeof n&&n(),e?e.__c:null}m.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(m.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var Se=r.event;function xe(){}function ke(){return this.cancelBubble}function Ce(){return this.defaultPrevented}r.event=function(e){return Se&&(e=Se(e)),e.persist=xe,e.isPropagationStopped=ke,e.isDefaultPrevented=Ce,e.nativeEvent=e};var Re,Pe={configurable:!0,get:function(){return this.class}},je=r.vnode;r.vnode=function(e){var t=e.type,n=e.props,r=n;if("string"==typeof t){for(var o in r={},n){var i=n[o];"value"===o&&"defaultValue"in n&&null==i||("defaultValue"===o&&"value"in n&&null==n.value?o="value":"download"===o&&!0===i?i="":/ondoubleclick/i.test(o)?o="ondblclick":/^onchange(textarea|input)/i.test(o+t)&&!Oe(n.type)?o="oninput":/^on(Ani|Tra|Tou|BeforeInp)/.test(o)?o=o.toLowerCase():we.test(o)?o=o.replace(/[A-Z0-9]/,"-$&").toLowerCase():null===i&&(i=void 0),r[o]=i)}"select"==t&&r.multiple&&Array.isArray(r.value)&&(r.value=E(n.children).forEach((function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)}))),"select"==t&&null!=r.defaultValue&&(r.value=E(n.children).forEach((function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value}))),e.props=r}t&&n.class!=n.className&&(Pe.enumerable="className"in n,null!=n.className&&(r.class=n.className),Object.defineProperty(r,"className",Pe)),e.$$typeof=be,je&&je(e)};var Ae=r.__r;r.__r=function(e){Ae&&Ae(e),Re=e.__c};var Te={ReactCurrentDispatcher:{current:{readContext:function(e){return Re.__n[e.__c].props.value}}}};"object"==("undefined"==typeof performance?"undefined":e(performance))&&"function"==typeof performance.now&&performance.now.bind(performance);function Ie(e){return!!e&&e.$$typeof===be}var Le={useState:function(e){return q=1,G(oe,e)},useReducer:G,useEffect:J,useLayoutEffect:$,useRef:function(e){return q=5,X((function(){return{current:e}}),[])},useImperativeHandle:function(e,t,n){q=6,$((function(){"function"==typeof e?e(t()):e&&(e.current=t())}),null==n?n:n.concat(e))},useMemo:X,useCallback:function(e,t){return q=8,X((function(){return e}),t)},useContext:function(e){var t=F.context[e.__c],n=Y(U++,9);return n.__c=e,t?(null==n.__&&(n.__=!0,t.sub(F)),t.props.value):e.__},useDebugValue:function(e,t){r.useDebugValue&&r.useDebugValue(t?t(e):e)},version:"16.8.0",Children:fe,render:Ee,hydrate:function(e,t,n){return D(e,t),"function"==typeof n&&n(),e?e.__c:null},unmountComponentAtNode:function(e){return!!e.__k&&(N(null,e),!0)},createPortal:ge,createElement:p,createContext:function(e,t){var n={__c:t="__cC"+s++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some(g)},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n},createFactory:function(e){return p.bind(null,e)},cloneElement:function(e){return Ie(e)?M.apply(null,arguments):e},createRef:function(){return{current:null}},Fragment:v,isValidElement:Ie,findDOMNode:function(e){return e&&(e.base||1===e.nodeType&&e)||null},Component:m,PureComponent:se,memo:function(e,t){function n(e){var n=this.props.ref,r=n==e.ref;return!r&&n&&(n.call?n(null):n.current=null),t?!t(this.props,e)||!r:ae(this.props,e)}function r(t){return this.shouldComponentUpdate=n,p(e,t)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r},forwardRef:function(t){function n(n,r){var o=ie({},n);return delete o.ref,t(o,(r=n.ref||r)&&("object"!=e(r)||"current"in r)?r:null)}return n.$$typeof=ce,n.render=n,n.prototype.isReactComponent=n.__f=!0,n.displayName="ForwardRef("+(t.displayName||t.name)+")",n},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:v,Suspense:pe,SuspenseList:ve,lazy:function(e){var t,n,r;function o(o){if(t||(t=e()).then((function(e){n=e.default||e}),(function(e){r=e})),r)throw r;if(!n)throw t;return p(n,o)}return o.displayName="Lazy",o.__f=!0,o},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Te},Ne="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function De(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Me(e,t){return e(t={exports:{}},t.exports),t.exports}var Ue=Me((function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(o[n]=e[n]);return o},e.exports.__esModule=!0,e.exports.default=e.exports}));De(Xe);var Qe=Me((function(e){e.exports=function(e,t){if(null==e)return{};var n,r,o=Xe(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o},e.exports.__esModule=!0,e.exports.default=e.exports})),et=De(Qe);function tt(e){return e.reduce((function(e,t){return e.concat(t)}),[])}var nt=0;function rt(e){return 0===e.collections.length?0:e.collections.reduce((function(e,t){return e+t.items.length}),0)}var ot=function(){},it=[{segment:"autocomplete-core",version:"1.8.2"}];function at(e,t){var n=t;return{then:function(t,r){return at(e.then(ut(t,n,e),ut(r,n,e)),n)},catch:function(t){return at(e.catch(ut(t,n,e)),n)},finally:function(t){return t&&n.onCancelList.push(t),at(e.finally(ut(t&&function(){return n.onCancelList=[],t()},n,e)),n)},cancel:function(){n.isCanceled=!0;var e=n.onCancelList;n.onCancelList=[],e.forEach((function(e){e()}))},isCanceled:function(){return!0===n.isCanceled}}}function st(e){return at(e,{isCanceled:!1,onCancelList:[]})}function ut(e,t,n){return e?function(n){return t.isCanceled?n:e(n)}:n}function ct(e,t,n,r){if(!n)return null;if(e<0&&(null===t||null!==r&&0===t))return n+e;var o=(null===t?-1:t)+e;return o<=-1||o>=n?null===r?null:0:o}function lt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ft(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0},reshape:function(e){return e.sources}},e),{},{id:null!==(n=e.id)&&void 0!==n?n:"autocomplete-".concat(nt++),plugins:o,initialState:Ct({activeItemId:null,query:"",completion:null,collections:[],isOpen:!1,status:"idle",context:{}},e.initialState),onStateChange:function(t){var n;null===(n=e.onStateChange)||void 0===n||n.call(e,t),o.forEach((function(e){var n;return null===(n=e.onStateChange)||void 0===n?void 0:n.call(e,t)}))},onSubmit:function(t){var n;null===(n=e.onSubmit)||void 0===n||n.call(e,t),o.forEach((function(e){var n;return null===(n=e.onSubmit)||void 0===n?void 0:n.call(e,t)}))},onReset:function(t){var n;null===(n=e.onReset)||void 0===n||n.call(e,t),o.forEach((function(e){var n;return null===(n=e.onReset)||void 0===n?void 0:n.call(e,t)}))},getSources:function(n){return Promise.all([].concat(St(o.map((function(e){return e.getSources}))),[e.getSources]).filter(Boolean).map((function(e){return function(e,t){var n=[];return Promise.resolve(e(t)).then((function(e){return Promise.all(e.filter((function(e){return Boolean(e)})).map((function(e){if(e.sourceId,n.includes(e.sourceId))throw new Error("[Autocomplete] The `sourceId` ".concat(JSON.stringify(e.sourceId)," is not unique."));n.push(e.sourceId);var t={getItemInputValue:function(e){return e.state.query},getItemUrl:function(){},onSelect:function(e){(0,e.setIsOpen)(!1)},onActive:ot,onResolve:ot};Object.keys(t).forEach((function(e){t[e].__default=!0}));var r=ft(ft({},t),e);return Promise.resolve(r)})))}))}(e,n)}))).then((function(e){return tt(e)})).then((function(e){return e.map((function(e){return Ct(Ct({},e),{},{onSelect:function(n){e.onSelect(n),t.forEach((function(e){var t;return null===(t=e.onSelect)||void 0===t?void 0:t.call(e,n)}))},onActive:function(n){e.onActive(n),t.forEach((function(e){var t;return null===(t=e.onActive)||void 0===t?void 0:t.call(e,n)}))},onResolve:function(n){e.onResolve(n),t.forEach((function(e){var t;return null===(t=e.onResolve)||void 0===t?void 0:t.call(e,n)}))}})}))}))},navigator:Ct({navigate:function(e){var t=e.itemUrl;r.location.assign(t)},navigateNewTab:function(e){var t=e.itemUrl,n=r.open(t,"_blank","noopener");null==n||n.focus()},navigateNewWindow:function(e){var t=e.itemUrl;r.open(t,"_blank","noopener")}},e.navigator)})}function jt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function At(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var Kt,Yt,Gt,Jt=null,$t=(Kt=-1,Yt=-1,Gt=void 0,function(e){var t=++Kt;return Promise.resolve(e).then((function(e){return Gt&&t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var on=["props","refresh","store"],an=["inputElement","formElement","panelElement"],sn=["inputElement"],un=["inputElement","maxLength"],cn=["sourceIndex"],ln=["sourceIndex"],fn=["item","source","sourceIndex"];function hn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pn(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function mn(e){var t=e.props,n=e.refresh,r=e.store,o=vn(e,on),i=function(e,t){return void 0!==t?"".concat(e,"-").concat(t):e};return{getEnvironmentProps:function(e){var n=e.inputElement,o=e.formElement,i=e.panelElement;function a(e){!r.getState().isOpen&&r.pendingRequests.isEmpty()||e.target===n||!1===[o,i].some((function(t){return n=t,r=e.target,n===r||n.contains(r);var n,r}))&&(r.dispatch("blur",null),t.debug||r.pendingRequests.cancelAll())}return pn({onTouchStart:a,onMouseDown:a,onTouchMove:function(e){!1!==r.getState().isOpen&&n===t.environment.document.activeElement&&e.target!==n&&n.blur()}},vn(e,an))},getRootProps:function(e){return pn({role:"combobox","aria-expanded":r.getState().isOpen,"aria-haspopup":"listbox","aria-owns":r.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label")},e)},getFormProps:function(e){e.inputElement;return pn({action:"",noValidate:!0,role:"search",onSubmit:function(i){var a;i.preventDefault(),t.onSubmit(pn({event:i,refresh:n,state:r.getState()},o)),r.dispatch("submit",null),null===(a=e.inputElement)||void 0===a||a.blur()},onReset:function(i){var a;i.preventDefault(),t.onReset(pn({event:i,refresh:n,state:r.getState()},o)),r.dispatch("reset",null),null===(a=e.inputElement)||void 0===a||a.focus()}},vn(e,sn))},getLabelProps:function(e){var n=e||{},r=n.sourceIndex,o=vn(n,cn);return pn({htmlFor:"".concat(i(t.id,r),"-input"),id:"".concat(i(t.id,r),"-label")},o)},getInputProps:function(e){var i;function a(e){(t.openOnFocus||Boolean(r.getState().query))&&Xt(pn({event:e,props:t,query:r.getState().completion||r.getState().query,refresh:n,store:r},o)),r.dispatch("focus",null)}var s=e||{},u=(s.inputElement,s.maxLength),c=void 0===u?512:u,l=vn(s,un),f=pt(r.getState()),h=function(e){return Boolean(e&&e.match(dt))}((null===(i=t.environment.navigator)||void 0===i?void 0:i.userAgent)||""),p=null!=f&&f.itemUrl&&!h?"go":"search";return pn({"aria-autocomplete":"both","aria-activedescendant":r.getState().isOpen&&null!==r.getState().activeItemId?"".concat(t.id,"-item-").concat(r.getState().activeItemId):void 0,"aria-controls":r.getState().isOpen?"".concat(t.id,"-list"):void 0,"aria-labelledby":"".concat(t.id,"-label"),value:r.getState().completion||r.getState().query,id:"".concat(t.id,"-input"),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",enterKeyHint:p,spellCheck:"false",autoFocus:t.autoFocus,placeholder:t.placeholder,maxLength:c,type:"search",onChange:function(e){Xt(pn({event:e,props:t,query:e.currentTarget.value.slice(0,c),refresh:n,store:r},o))},onKeyDown:function(e){!function(e){var t=e.event,n=e.props,r=e.refresh,o=e.store,i=rn(e,Qt);if("ArrowUp"===t.key||"ArrowDown"===t.key){var a=function(){var e=n.environment.document.getElementById("".concat(n.id,"-item-").concat(o.getState().activeItemId));e&&(e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!1):e.scrollIntoView(!1))},s=function(){var e=pt(o.getState());if(null!==o.getState().activeItemId&&e){var n=e.item,a=e.itemInputValue,s=e.itemUrl,u=e.source;u.onActive(tn({event:t,item:n,itemInputValue:a,itemUrl:s,refresh:r,source:u,state:o.getState()},i))}};t.preventDefault(),!1===o.getState().isOpen&&(n.openOnFocus||Boolean(o.getState().query))?Xt(tn({event:t,props:n,query:o.getState().query,refresh:r,store:o},i)).then((function(){o.dispatch(t.key,{nextActiveItemId:n.defaultActiveItemId}),s(),setTimeout(a,0)})):(o.dispatch(t.key,{}),s(),a())}else if("Escape"===t.key)t.preventDefault(),o.dispatch(t.key,null),o.pendingRequests.cancelAll();else if("Tab"===t.key)o.dispatch("blur",null),o.pendingRequests.cancelAll();else if("Enter"===t.key){if(null===o.getState().activeItemId||o.getState().collections.every((function(e){return 0===e.items.length})))return void(n.debug||o.pendingRequests.cancelAll());t.preventDefault();var u=pt(o.getState()),c=u.item,l=u.itemInputValue,f=u.itemUrl,h=u.source;if(t.metaKey||t.ctrlKey)void 0!==f&&(h.onSelect(tn({event:t,item:c,itemInputValue:l,itemUrl:f,refresh:r,source:h,state:o.getState()},i)),n.navigator.navigateNewTab({itemUrl:f,item:c,state:o.getState()}));else if(t.shiftKey)void 0!==f&&(h.onSelect(tn({event:t,item:c,itemInputValue:l,itemUrl:f,refresh:r,source:h,state:o.getState()},i)),n.navigator.navigateNewWindow({itemUrl:f,item:c,state:o.getState()}));else if(t.altKey);else{if(void 0!==f)return h.onSelect(tn({event:t,item:c,itemInputValue:l,itemUrl:f,refresh:r,source:h,state:o.getState()},i)),void n.navigator.navigate({itemUrl:f,item:c,state:o.getState()});Xt(tn({event:t,nextState:{isOpen:!1},props:n,query:l,refresh:r,store:o},i)).then((function(){h.onSelect(tn({event:t,item:c,itemInputValue:l,itemUrl:f,refresh:r,source:h,state:o.getState()},i))}))}}}(pn({event:e,props:t,refresh:n,store:r},o))},onFocus:a,onBlur:ot,onClick:function(n){e.inputElement!==t.environment.document.activeElement||r.getState().isOpen||a(n)}},l)},getPanelProps:function(e){return pn({onMouseDown:function(e){e.preventDefault()},onMouseLeave:function(){r.dispatch("mouseleave",null)}},e)},getListProps:function(e){var n=e||{},r=n.sourceIndex,o=vn(n,ln);return pn({role:"listbox","aria-labelledby":"".concat(i(t.id,r),"-label"),id:"".concat(i(t.id,r),"-list")},o)},getItemProps:function(e){var a=e.item,s=e.source,u=e.sourceIndex,c=vn(e,fn);return pn({id:"".concat(i(t.id,u),"-item-").concat(a.__autocomplete_id),role:"option","aria-selected":r.getState().activeItemId===a.__autocomplete_id,onMouseMove:function(e){if(a.__autocomplete_id!==r.getState().activeItemId){r.dispatch("mousemove",a.__autocomplete_id);var t=pt(r.getState());if(null!==r.getState().activeItemId&&t){var i=t.item,s=t.itemInputValue,u=t.itemUrl,c=t.source;c.onActive(pn({event:e,item:i,itemInputValue:s,itemUrl:u,refresh:n,source:c,state:r.getState()},o))}}},onMouseDown:function(e){e.preventDefault()},onClick:function(e){var i=s.getItemInputValue({item:a,state:r.getState()}),u=s.getItemUrl({item:a,state:r.getState()});(u?Promise.resolve():Xt(pn({event:e,nextState:{isOpen:!1},props:t,query:i,refresh:n,store:r},o))).then((function(){s.onSelect(pn({event:e,item:a,itemInputValue:i,itemUrl:u,refresh:n,source:s,state:r.getState()},o))}))}},c)}}}function _n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function yn(e){for(var t=1;t0&&Le.createElement("div",{className:"DocSearch-NoResults-Prefill-List"},Le.createElement("p",{className:"DocSearch-Help"},s,":"),Le.createElement("ul",null,h.slice(0,3).reduce((function(e,t){return[].concat(Yn(e),[Le.createElement("li",{key:t},Le.createElement("button",{className:"DocSearch-Prefill",key:t,type:"button",onClick:function(){r.setQuery(t.toLowerCase()+" "),r.refresh(),r.inputRef.current.focus()}},t))])}),[]))),r.getMissingResultsUrl&&Le.createElement("p",{className:"DocSearch-Help"},"".concat(c," "),Le.createElement("a",{href:r.getMissingResultsUrl({query:r.state.query}),target:"_blank",rel:"noopener noreferrer"},f)))}var $n=["hit","attribute","tagName"];function Xn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Qn(e){for(var t=1;t|<\/mark>)/g,sr=RegExp(ar.source);function ur(e){var t,n,r,o=e;if(!o.__docsearch_parent&&!e._highlightResult)return e["hierarchy.lvl0"];var i=((o.__docsearch_parent?null===(t=o.__docsearch_parent)||void 0===t||null===(n=t._highlightResult)||void 0===n?void 0:n["hierarchy.lvl0"]:null===(r=e._highlightResult)||void 0===r?void 0:r["hierarchy.lvl0"])||{}).value;return i&&sr.test(i)?i.replace(ar,""):i}function cr(e){return Le.createElement("div",{className:"DocSearch-Dropdown-Container"},e.state.collections.map((function(t){if(0===t.items.length)return null;var n=ur(t.items[0]);return Le.createElement(tr,Fe({},e,{key:t.source.sourceId,title:n,collection:t,renderIcon:function(e){var n,r=e.item,o=e.index;return Le.createElement(Le.Fragment,null,r.__docsearch_parent&&Le.createElement("svg",{className:"DocSearch-Hit-Tree",viewBox:"0 0 24 54"},Le.createElement("g",{stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},r.__docsearch_parent!==(null===(n=t.items[o+1])||void 0===n?void 0:n.__docsearch_parent)?Le.createElement("path",{d:"M8 6v21M20 27H8.3"}):Le.createElement("path",{d:"M8 6v42M20 27H8.3"}))),Le.createElement("div",{className:"DocSearch-Hit-icon"},Le.createElement(Mn,{type:r.type})))},renderAction:function(){return Le.createElement("div",{className:"DocSearch-Hit-action"},Le.createElement(Nn,null))}}))})),e.resultsFooterComponent&&Le.createElement("section",{className:"DocSearch-HitsFooter"},Le.createElement(e.resultsFooterComponent,{state:e.state})))}var lr=["translations"];function fr(e){var t=e.translations,n=void 0===t?{}:t,r=et(e,lr),o=n.recentSearchesTitle,i=void 0===o?"Recent":o,a=n.noRecentSearchesText,s=void 0===a?"No recent searches":a,u=n.saveRecentSearchButtonTitle,c=void 0===u?"Save this search":u,l=n.removeRecentSearchButtonTitle,f=void 0===l?"Remove this search from history":l,h=n.favoriteSearchesTitle,p=void 0===h?"Favorite":h,d=n.removeFavoriteSearchButtonTitle,v=void 0===d?"Remove this search from favorites":d;return"idle"===r.state.status&&!1===r.hasCollections?r.disableUserPersonalization?null:Le.createElement("div",{className:"DocSearch-StartScreen"},Le.createElement("p",{className:"DocSearch-Help"},s)):!1===r.hasCollections?null:Le.createElement("div",{className:"DocSearch-Dropdown-Container"},Le.createElement(tr,Fe({},r,{title:i,collection:r.state.collections[0],renderIcon:function(){return Le.createElement("div",{className:"DocSearch-Hit-icon"},Le.createElement(In,null))},renderAction:function(e){var t=e.item,n=e.runFavoriteTransition,o=e.runDeleteTransition;return Le.createElement(Le.Fragment,null,Le.createElement("div",{className:"DocSearch-Hit-action"},Le.createElement("button",{className:"DocSearch-Hit-action-button",title:c,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),n((function(){r.favoriteSearches.add(t),r.recentSearches.remove(t),r.refresh()}))}},Le.createElement(Hn,null))),Le.createElement("div",{className:"DocSearch-Hit-action"},Le.createElement("button",{className:"DocSearch-Hit-action-button",title:f,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),o((function(){r.recentSearches.remove(t),r.refresh()}))}},Le.createElement(Ln,null))))}})),Le.createElement(tr,Fe({},r,{title:p,collection:r.state.collections[1],renderIcon:function(){return Le.createElement("div",{className:"DocSearch-Hit-icon"},Le.createElement(Hn,null))},renderAction:function(e){var t=e.item,n=e.runDeleteTransition;return Le.createElement("div",{className:"DocSearch-Hit-action"},Le.createElement("button",{className:"DocSearch-Hit-action-button",title:v,type:"submit",onClick:function(e){e.preventDefault(),e.stopPropagation(),n((function(){r.favoriteSearches.remove(t),r.refresh()}))}},Le.createElement(Ln,null)))}})))}var hr=["translations"],pr=Le.memo((function(e){var t=e.translations,n=void 0===t?{}:t,r=et(e,hr);if("error"===r.state.status)return Le.createElement(zn,{translations:null==n?void 0:n.errorScreen});var o=r.state.collections.some((function(e){return e.items.length>0}));return r.state.query?!1===o?Le.createElement(Jn,Fe({},r,{translations:null==n?void 0:n.noResultsScreen})):Le.createElement(cr,r):Le.createElement(fr,Fe({},r,{hasCollections:o,translations:null==n?void 0:n.startScreen}))}),(function(e,t){return"loading"===t.state.status||"stalled"===t.state.status})),dr=De(Me((function(e){e.exports=function(e){if(null==e)throw new TypeError("Cannot destructure "+e)},e.exports.__esModule=!0,e.exports.default=e.exports})));function vr(e){var t=Fe({},(dr(e),e)),n=t.getFormProps({inputElement:t.inputRef.current}).onReset;return Le.useEffect((function(){t.autoFocus&&t.inputRef.current&&t.inputRef.current.focus()}),[t.autoFocus,t.inputRef]),Le.useEffect((function(){t.isFromSelection&&t.inputRef.current&&t.inputRef.current.select()}),[t.isFromSelection,t.inputRef]),Le.createElement(Le.Fragment,null,Le.createElement("form",{className:"DocSearch-Form",onSubmit:function(e){e.preventDefault()},onReset:n},Le.createElement("input",Fe({className:"DocSearch-Input",ref:t.inputRef},t.getInputProps({inputElement:t.inputRef.current,autoFocus:t.autoFocus,maxLength:64})))))}var mr=["_highlightResult","_snippetResult"];function _r(e){return!1===function(){var e="__TEST_KEY__";try{return localStorage.setItem(e,""),localStorage.removeItem(e),!0}catch(e){return!1}}()?{setItem:function(){},getItem:function(){return[]}}:{setItem:function(t){return window.localStorage.setItem(e,JSON.stringify(t))},getItem:function(){var t=window.localStorage.getItem(e);return t?JSON.parse(t):[]}}}function yr(e){var t=e.key,n=e.limit,r=void 0===n?5:n,o=_r(t),i=o.getItem().slice(0,r);return{add:function(e){var t=e,n=(t._highlightResult,t._snippetResult,et(t,mr)),a=i.findIndex((function(e){return e.objectID===n.objectID}));a>-1&&i.splice(a,1),i.unshift(n),i=i.slice(0,r),o.setItem(i)},remove:function(e){i=i.filter((function(t){return t.objectID!==e.objectID})),o.setItem(i)},getAll:function(){return i}}}var gr=Me((function(e){function t(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,o)}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(o,i){var a=e.apply(n,r);function s(e){t(a,o,i,s,u,"next",e)}function u(e){t(a,o,i,s,u,"throw",e)}s(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports})),br=De(gr),wr=Me((function(e){var t=Ke.default;function n(){ + /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ + e.exports=n=function(){return r},e.exports.__esModule=!0,e.exports.default=e.exports;var r={},o=Object.prototype,i=o.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function f(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,n){return e[t]=n}}function h(e,t,n,r){var o=t&&t.prototype instanceof v?t:v,i=Object.create(o.prototype),s=new R(r||[]);return a(i,"_invoke",{value:S(e,n,s)}),i}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}r.wrap=h;var d={};function v(){}function m(){}function _(){}var y={};f(y,u,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(P([])));b&&b!==o&&i.call(b,u)&&(y=b);var w=_.prototype=v.prototype=Object.create(y);function O(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,n){function r(o,a,s,u){var c=p(e[o],e,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==t(f)&&i.call(f,"__await")?n.resolve(f.__await).then((function(e){r("next",e,s,u)}),(function(e){r("throw",e,s,u)})):n.resolve(f).then((function(e){l.value=e,s(l)}),(function(e){return r("throw",e,s,u)}))}u(c.arg)}var o;a(this,"_invoke",{value:function(e,t){function i(){return new n((function(n,o){r(e,t,n,o)}))}return o=o?o.then(i,i):i()}})}function S(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return j()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=x(a,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=p(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function x(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var o=p(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,d;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function P(e){if(e){var t=e[u];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n=0;--r){var o=this.tryEntries[r],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=i.call(o,"catchLoc"),u=i.call(o,"finallyLoc");if(s&&u){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),C(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:P(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}));De(wr);var Or=wr(),Er=Or;try{regeneratorRuntime=Or}catch(t){"object"===("undefined"==typeof globalThis?"undefined":e(globalThis))?globalThis.regeneratorRuntime=Or:Function("r","regeneratorRuntime = r")(Or)}var Sr=Me((function(t){var n,r;n=Ne,r=function(){var t=function(){},n="undefined",r=("undefined"==typeof window?"undefined":e(window))!==n&&e(window.navigator)!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"];function i(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function a(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function s(o){return"debug"===o&&(o="log"),("undefined"==typeof console?"undefined":e(console))!==n&&("trace"===o&&r?a:void 0!==console[o]?i(console,o):void 0!==console.log?i(console,"log"):t)}function u(e,n){for(var r=0;r=0&&r<=s.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(a=r,!1!==i&&function(t){var r=(o[t]||"silent").toUpperCase();if(("undefined"==typeof window?"undefined":e(window))!==n&&c){try{return void(window.localStorage[c]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(c)+"="+r+";"}catch(e){}}}(r),u.call(s,r,t),("undefined"==typeof console?"undefined":e(console))===n&&r0;n--){var r=Math.floor(Math.random()*(n+1));t=[e[r],e[n]],e[n]=t[0],e[r]=t[1]}},e}();t.default=s}));De(Dr);var Mr=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r1)for(var n=1;n=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o}(u.getAllResponseHeaders()):null,o={data:a&&"text"!==a&&"json"!==a?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:r,config:e,request:u};Ro((function(e){t(e),s()}),(function(e){n(e),s()}),o),u=null}}if(u.open(e.method.toUpperCase(),Yr(f,e.params,e.paramsSerializer),!0),u.timeout=e.timeout,"onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(h)},u.onabort=function(){u&&(n(Co("Request aborted",e,"ECONNABORTED",u)),u=null)},u.onerror=function(){n(Co("Network Error",e,null,u)),u=null},u.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",r=e.transitional||ko;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(Co(t,e,r.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",u)),u=null},Wr.isStandardBrowserEnv()){var p=(e.withCredentials||To(f))&&e.xsrfCookieName?Po.read(e.xsrfCookieName):void 0;p&&(i[e.xsrfHeaderName]=p)}"setRequestHeader"in u&&Wr.forEach(i,(function(e,t){void 0===o&&"content-type"===t.toLowerCase()?delete i[t]:u.setRequestHeader(t,e)})),Wr.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),a&&"json"!==a&&(u.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&u.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(r=function(e){u&&(n(!e||e&&e.type?new Lo("canceled"):e),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(r),e.signal&&(e.signal.aborted?r():e.signal.addEventListener("abort",r))),o||(o=null),u.send(o)}))},Do=[],Mo=[],Uo="undefined"!=typeof Uint8Array?Uint8Array:Array,Fo=!1;function Ho(){Fo=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,n=e.length;t>18&63]+Do[o>>12&63]+Do[o>>6&63]+Do[63&o]);return i.join("")}function Bo(e){var t;Fo||Ho();for(var n=e.length,r=n%3,o="",i=[],a=16383,s=0,u=n-r;su?u:s+a));return 1===r?(t=e[n-1],o+=Do[t>>2],o+=Do[t<<4&63],o+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],o+=Do[t>>10],o+=Do[t>>4&63],o+=Do[t<<2&63],o+="="),i.push(o),i.join("")}function zo(e,t,n,r,o){var i,a,s=8*o-r-1,u=(1<>1,l=-7,f=n?o-1:0,h=n?-1:1,p=e[t+f];for(f+=h,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+e[t+f],f+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+f],f+=h,l-=8);if(0===i)i=1-c;else{if(i===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=c}return(p?-1:1)*a*Math.pow(2,i-r)}function Zo(e,t,n,r,o,i){var a,s,u,c=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,d=r?1:-1,v=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(t*u-1)*Math.pow(2,o),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&s,p+=d,s/=256,o-=8);for(a=a<0;e[n+p]=255&a,p+=d,a/=256,c-=8);e[n+p-d]|=128*v}var Vo={}.toString,Wo=Array.isArray||function(e){return"[object Array]"==Vo.call(e)};function Ko(){return Go.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Yo(e,t){if(Ko()=Ko())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ko().toString(16)+" bytes");return 0|e}function ti(e){return!(null==e||!e._isBuffer)}function ni(e,t){if(ti(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Pi(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ji(e).length;default:if(r)return Pi(e).length;t=(""+t).toLowerCase(),r=!0}}function ri(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return yi(this,t,n);case"utf8":case"utf-8":return di(this,t,n);case"ascii":return mi(this,t,n);case"latin1":case"binary":return _i(this,t,n);case"base64":return pi(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gi(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function oi(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function ii(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=Go.from(t,r)),ti(t))return 0===t.length?-1:ai(e,t,n,r,o);if("number"==typeof t)return t&=255,Go.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):ai(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function ai(e,t,n,r,o){var i,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var l=-1;for(i=n;is&&(n=s-u),i=n;i>=0;i--){for(var f=!0,h=0;ho&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function pi(e,t,n){return 0===t&&n===e.length?Bo(e):Bo(e.slice(t,n))}function di(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:c>223?3:c>191?2:1;if(o+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(i=e[o+1]))&&(u=(31&c)<<6|63&i)>127&&(l=u);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(u=(15&c)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=f}return function(e){var t=e.length;if(t<=vi)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},Go.prototype.compare=function(e,t,n,r,o){if(!ti(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(r,o),c=e.slice(t,n),l=0;lo)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return si(this,e,t,n);case"utf8":case"utf-8":return ui(this,e,t,n);case"ascii":return ci(this,e,t,n);case"latin1":case"binary":return li(this,e,t,n);case"base64":return fi(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return hi(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},Go.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var vi=4096;function mi(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function wi(e,t,n,r,o,i){if(!ti(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function Oi(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function Ei(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function Si(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function xi(e,t,n,r,o){return o||Si(e,0,n,4),Zo(e,t,n,r,23,4),n+4}function ki(e,t,n,r,o){return o||Si(e,0,n,8),Zo(e,t,n,r,52,8),n+8}Go.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},Go.prototype.readUInt8=function(e,t){return t||bi(e,1,this.length),this[e]},Go.prototype.readUInt16LE=function(e,t){return t||bi(e,2,this.length),this[e]|this[e+1]<<8},Go.prototype.readUInt16BE=function(e,t){return t||bi(e,2,this.length),this[e]<<8|this[e+1]},Go.prototype.readUInt32LE=function(e,t){return t||bi(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Go.prototype.readUInt32BE=function(e,t){return t||bi(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Go.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||bi(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},Go.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||bi(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},Go.prototype.readInt8=function(e,t){return t||bi(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Go.prototype.readInt16LE=function(e,t){t||bi(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},Go.prototype.readInt16BE=function(e,t){t||bi(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},Go.prototype.readInt32LE=function(e,t){return t||bi(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Go.prototype.readInt32BE=function(e,t){return t||bi(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Go.prototype.readFloatLE=function(e,t){return t||bi(e,4,this.length),zo(this,e,!0,23,4)},Go.prototype.readFloatBE=function(e,t){return t||bi(e,4,this.length),zo(this,e,!1,23,4)},Go.prototype.readDoubleLE=function(e,t){return t||bi(e,8,this.length),zo(this,e,!0,52,8)},Go.prototype.readDoubleBE=function(e,t){return t||bi(e,8,this.length),zo(this,e,!1,52,8)},Go.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||wi(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},Go.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||wi(this,e,t,1,255,0),Go.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Go.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||wi(this,e,t,2,65535,0),Go.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Oi(this,e,t,!0),t+2},Go.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||wi(this,e,t,2,65535,0),Go.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Oi(this,e,t,!1),t+2},Go.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||wi(this,e,t,4,4294967295,0),Go.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Ei(this,e,t,!0),t+4},Go.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||wi(this,e,t,4,4294967295,0),Go.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Ei(this,e,t,!1),t+4},Go.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);wi(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},Go.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);wi(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},Go.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||wi(this,e,t,1,127,-128),Go.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Go.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||wi(this,e,t,2,32767,-32768),Go.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Oi(this,e,t,!0),t+2},Go.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||wi(this,e,t,2,32767,-32768),Go.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Oi(this,e,t,!1),t+2},Go.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||wi(this,e,t,4,2147483647,-2147483648),Go.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Ei(this,e,t,!0),t+4},Go.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||wi(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Go.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Ei(this,e,t,!1),t+4},Go.prototype.writeFloatLE=function(e,t,n){return xi(this,e,t,!0,n)},Go.prototype.writeFloatBE=function(e,t,n){return xi(this,e,t,!1,n)},Go.prototype.writeDoubleLE=function(e,t,n){return ki(this,e,t,!0,n)},Go.prototype.writeDoubleBE=function(e,t,n){return ki(this,e,t,!1,n)},Go.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!Go.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function ji(e){return function(e){var t,n,r,o,i,a;Fo||Ho();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===e[s-2]?2:"="===e[s-1]?1:0,a=new Uo(3*s/4-i),r=i>0?s-4:s;var u=0;for(t=0,n=0;t>16&255,a[u++]=o>>8&255,a[u++]=255&o;return 2===i?(o=Mo[e.charCodeAt(t)]<<2|Mo[e.charCodeAt(t+1)]>>4,a[u++]=255&o):1===i&&(o=Mo[e.charCodeAt(t)]<<10|Mo[e.charCodeAt(t+1)]<<4|Mo[e.charCodeAt(t+2)]>>2,a[u++]=o>>8&255,a[u++]=255&o),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Ci,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Ai(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function Ti(e){return null!=e&&(!!e._isBuffer||Ii(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Ii(e.slice(0,0))}(e))}function Ii(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Li,Ni,Di=Vi($r.fetch)&&Vi($r.ReadableStream);function Mi(e){Ni||(Ni=new $r.XMLHttpRequest).open("GET",$r.location.host?"/":"https://example.com");try{return Ni.responseType=e,Ni.responseType===e}catch(e){return!1}}var Ui=void 0!==$r.ArrayBuffer,Fi=Ui&&Vi($r.ArrayBuffer.prototype.slice),Hi=Ui&&Mi("arraybuffer"),qi=!Di&&Fi&&Mi("ms-stream"),Bi=!Di&&Ui&&Mi("moz-chunked-arraybuffer"),zi=Vi(Ni.overrideMimeType),Zi=Vi($r.VBArray);function Vi(e){return"function"==typeof e}Ni=null;var Wi="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e},Ki=/%[sdj%]/g;function Yi(e){if(!la(e)){for(var t=[],n=0;n=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),a=r[n];n=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),aa(t)?n.showHidden=t:t&&Oa(n,t),fa(n.showHidden)&&(n.showHidden=!1),fa(n.depth)&&(n.depth=2),fa(n.colors)&&(n.colors=!1),fa(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=ea),na(n,e,n.depth)}function ea(e,t){var n=Qi.styles[t];return n?"["+Qi.colors[n][0]+"m"+e+"["+Qi.colors[n][1]+"m":e}function ta(e,t){return e}function na(e,t,n){if(e.customInspect&&t&&ma(t.inspect)&&t.inspect!==Qi&&(!t.constructor||t.constructor.prototype!==t)){var r=t.inspect(n,e);return la(r)||(r=na(e,r,n)),r}var o=function(e,t){if(fa(t))return e.stylize("undefined","undefined");if(la(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(ca(t))return e.stylize(""+t,"number");if(aa(t))return e.stylize(""+t,"boolean");if(sa(t))return e.stylize("null","null")}(e,t);if(o)return o;var i=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(i);if(e.showHidden&&(i=Object.getOwnPropertyNames(t)),va(t)&&(i.indexOf("message")>=0||i.indexOf("description")>=0))return ra(t);if(0===i.length){if(ma(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(ha(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(da(t))return e.stylize(Date.prototype.toString.call(t),"date");if(va(t))return ra(t)}var u,c="",l=!1,f=["{","}"];(ia(t)&&(l=!0,f=["[","]"]),ma(t))&&(c=" [Function"+(t.name?": "+t.name:"")+"]");return ha(t)&&(c=" "+RegExp.prototype.toString.call(t)),da(t)&&(c=" "+Date.prototype.toUTCString.call(t)),va(t)&&(c=" "+ra(t)),0!==i.length||l&&0!=t.length?n<0?ha(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),u=l?function(e,t,n,r,o){for(var i=[],a=0,s=t.length;a60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(u,c,f)):f[0]+c+f[1]}function ra(e){return"["+Error.prototype.toString.call(e)+"]"}function oa(e,t,n,r,o,i){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),Ea(r,o)||(a="["+o+"]"),s||(e.seen.indexOf(u.value)<0?(s=sa(n)?na(e,u.value,null):na(e,u.value,n-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),fa(a)){if(i&&o.match(/^\d+$/))return s;(a=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function ia(e){return Array.isArray(e)}function aa(e){return"boolean"==typeof e}function sa(e){return null===e}function ua(e){return null==e}function ca(e){return"number"==typeof e}function la(e){return"string"==typeof e}function fa(e){return void 0===e}function ha(e){return pa(e)&&"[object RegExp]"===ya(e)}function pa(t){return"object"===e(t)&&null!==t}function da(e){return pa(e)&&"[object Date]"===ya(e)}function va(e){return pa(e)&&("[object Error]"===ya(e)||e instanceof Error)}function ma(e){return"function"==typeof e}function _a(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"===e(t)||void 0===t}function ya(e){return Object.prototype.toString.call(e)}function ga(e){return e<10?"0"+e.toString(10):e.toString(10)}Qi.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Qi.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var ba=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function wa(){var e=new Date,t=[ga(e.getHours()),ga(e.getMinutes()),ga(e.getSeconds())].join(":");return[e.getDate(),ba[e.getMonth()],t].join(" ")}function Oa(e,t){if(!t||!pa(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}function Ea(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Sa={inherits:Wi,_extend:Oa,log:function(){console.log("%s - %s",wa(),Yi.apply(null,arguments))},isBuffer:function(e){return Ti(e)},isPrimitive:_a,isFunction:ma,isError:va,isDate:da,isObject:pa,isRegExp:ha,isUndefined:fa,isSymbol:function(t){return"symbol"===e(t)},isString:la,isNumber:ca,isNullOrUndefined:ua,isNull:sa,isBoolean:aa,isArray:ia,inspect:Qi,deprecate:Gi,format:Yi,debuglog:Xi};function xa(){}function ka(){ka.init.call(this)}function Ca(e){return void 0===e._maxListeners?ka.defaultMaxListeners:e._maxListeners}function Ra(e,t,n){if(t)e.call(n);else for(var r=e.length,o=Da(e,r),i=0;i0&&a.length>o){a.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=a.length,function(e){"function"==typeof console.warn?console.warn(e):console.log(e)}(s)}}else a=i[t]=n,++e._eventsCount;return e}function La(e,t,n){var r=!1;function o(){e.removeListener(t,o),r||(r=!0,n.apply(e,arguments))}return o.listener=n,o}function Na(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function Da(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}function Ma(){this.head=null,this.tail=null,this.length=0}xa.prototype=Object.create(null),ka.EventEmitter=ka,ka.usingDomains=!1,ka.prototype.domain=void 0,ka.prototype._events=void 0,ka.prototype._maxListeners=void 0,ka.defaultMaxListeners=10,ka.init=function(){this.domain=null,ka.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new xa,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ka.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},ka.prototype.getMaxListeners=function(){return Ca(this)},ka.prototype.emit=function(e){var t,n,r,o,i,a,s,u="error"===e;if(a=this._events)u=u&&null==a.error;else if(!u)return!1;if(s=this.domain,u){if(t=arguments[1],!s){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(n=a[e]))return!1;var l="function"==typeof n;switch(r=arguments.length){case 1:Ra(n,l,this);break;case 2:Pa(n,l,this,arguments[1]);break;case 3:ja(n,l,this,arguments[1],arguments[2]);break;case 4:Aa(n,l,this,arguments[1],arguments[2],arguments[3]);break;default:for(o=new Array(r-1),i=1;i0;)if(n[i]===t||n[i].listener&&n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new xa,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,o=e.length;r0?Reflect.ownKeys(this._events):[]},Ma.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},Ma.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},Ma.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},Ma.prototype.clear=function(){this.head=this.tail=null,this.length=0},Ma.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},Ma.prototype.concat=function(e){if(0===this.length)return Go.alloc(0);if(1===this.length)return this.head.data;for(var t=Go.allocUnsafe(e>>>0),n=this.head,r=0;n;)n.data.copy(t,r),r+=n.data.length,n=n.next;return t};var Ua=Go.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function Fa(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!Ua(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=qa;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=Ba;break;default:return void(this.write=Ha)}this.charBuffer=new Go(6),this.charReceived=0,this.charLength=0}function Ha(e){return e.toString(this.encoding)}function qa(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function Ba(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}Fa.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived=55296&&o<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived);var o;r=(t+=e.toString(this.encoding,0,r)).length-1;if((o=t.charCodeAt(r))>=55296&&o<=56319){var i=this.surrogateSize;return this.charLength+=i,this.charReceived+=i,this.charBuffer.copy(this.charBuffer,i,0,i),e.copy(this.charBuffer,0,0,i),t.substring(0,r)}return t},Fa.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t},Fa.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,o=this.encoding;t+=r.slice(0,n).toString(o)}return t},Va.ReadableState=Za;var za=Xi("stream");function Za(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof gs&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,r=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r,this.highWaterMark=~~this.highWaterMark,this.buffer=new Ma,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new Fa(e.encoding),this.encoding=e.encoding)}function Va(e){if(!(this instanceof Va))return new Va(e);this._readableState=new Za(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),ka.call(this)}function Wa(e,t,n,r,o){var i=function(e,t){var n=null;Ti(t)||"string"==typeof t||null==t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));return n}(t,n);if(i)e.emit("error",i);else if(null===n)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,Ga(e)}(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!o){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&o){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var u;!t.decoder||o||r||(n=t.decoder.write(n),u=!t.objectMode&&0===n.length),o||(t.reading=!1),u||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,o?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&Ga(e))),function(e,t){t.readingMore||(t.readingMore=!0,co($a,e,t))}(e,t)}else o||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=Ka?e=Ka:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Ga(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(za("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?co(Ja,e):Ja(e))}function Ja(e){za("emit readable"),e.emit("readable"),es(e)}function $a(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ei.length?i.length:e;if(a===i.length?o+=i:o+=i.slice(0,e),0===(e-=a)){a===i.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(a));break}++r}return t.length-=r,o}(e,t):function(e,t){var n=Go.allocUnsafe(e),r=t.head,o=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var i=r.data,a=e>i.length?i.length:e;if(i.copy(n,n.length-e,0,a),0===(e-=a)){a===i.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(a));break}++o}return t.length-=o,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function ns(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,co(rs,t,e))}function rs(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function os(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return za("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?ns(this):Ga(this),null;if(0===(e=Ya(e,t))&&t.ended)return 0===t.length&&ns(this),null;var r,o=t.needReadable;return za("need readable",o),(0===t.length||t.length-e0?ts(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&ns(this)),null!==r&&this.emit("data",r),r},Va.prototype._read=function(e){this.emit("error",new Error("not implemented"))},Va.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,za("pipe count=%d opts=%j",r.pipesCount,t);var o=!t||!1!==t.end?a:c;function i(e){za("onunpipe"),e===n&&c()}function a(){za("onend"),e.end()}r.endEmitted?co(o):n.once("end",o),e.on("unpipe",i);var s=function(e){return function(){var t=e._readableState;za("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,es(e))}}(n);e.on("drain",s);var u=!1;function c(){za("cleanup"),e.removeListener("close",p),e.removeListener("finish",d),e.removeListener("drain",s),e.removeListener("error",h),e.removeListener("unpipe",i),n.removeListener("end",a),n.removeListener("end",c),n.removeListener("data",f),u=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var l=!1;function f(t){za("ondata"),l=!1,!1!==e.write(t)||l||((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==os(r.pipes,e))&&!u&&(za("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,l=!0),n.pause())}function h(t){za("onerror",t),v(),e.removeListener("error",h),0===function(e,t){return e.listeners(t).length}(e,"error")&&e.emit("error",t)}function p(){e.removeListener("finish",d),v()}function d(){za("onfinish"),e.removeListener("close",p),v()}function v(){za("unpipe"),n.unpipe(e)}return n.on("data",f),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",h),e.once("close",p),e.once("finish",d),e.emit("pipe",n),r.flowing||(za("pipe resume"),n.resume()),e},Va.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},us.prototype._write=function(e,t,n){n(new Error("not implemented"))},us.prototype._writev=null,us.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,ds(e,t),n&&(t.finished?co(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Wi(gs,Va);for(var ms=Object.keys(us.prototype),_s=0;_se._pos){var r=n.substr(e._pos);if("x-user-defined"===e._charset){for(var o=new Go(r.length),i=0;ie._pos&&(e.push(new Go(new Uint8Array(a.result.slice(e._pos)))),e._pos=a.result.byteLength)},a.onload=function(){e.push(null)},a.readAsArrayBuffer(n)}e._xhr.readyState===Rs&&"ms-stream"!==e._mode&&e.push(null)},Wi(js,us);var As=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];js.prototype.setHeader=function(e,t){var n=e.toLowerCase();-1===As.indexOf(n)&&(this._headers[n]={name:e,value:t})},js.prototype.getHeader=function(e){return this._headers[e.toLowerCase()].value},js.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},js.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t,n=e._opts,r=e._headers;if("POST"!==n.method&&"PUT"!==n.method&&"PATCH"!==n.method||(t=function(){if(void 0!==Li)return Li;try{new $r.Blob([new ArrayBuffer(1)]),Li=!0}catch(e){Li=!1}return Li}()?new $r.Blob(e._body.map((function(e){return function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(Ti(e)){for(var t=new Uint8Array(e.length),n=e.length,r=0;r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Ds=Math.floor,Ms=String.fromCharCode;function Us(e){throw new RangeError(Ns[e])}function Fs(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function Hs(e,t,n){var r=0;for(e=n?Ds(e/700):e>>1,e+=Ds(e/t);e>455;r+=36)e=Ds(e/35);return Ds(r+36*e/(e+38))}function qs(e){return function(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]);var o=function(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}((e=e.replace(Ls,".")).split("."),t).join(".");return r+o}(e,(function(e){return Is.test(e)?"xn--"+function(e){var t,n,r,o,i,a,s,u,c,l,f,h,p,d,v,m=[];for(e=function(e){for(var t,n,r=[],o=0,i=e.length;o=55296&&t<=56319&&o=t&&fDs((Ts-n)/(p=r+1))&&Us("overflow"),n+=(s-t)*p,t=s,a=0;aTs&&Us("overflow"),f==t){for(u=n,c=36;!(u<(l=c<=i?1:c>=i+26?26:c-i));c+=36)v=u-l,d=36-l,m.push(Ms(Fs(l+v%d,0))),u=Ds(v/d);m.push(Ms(Fs(u,0))),i=Hs(n,p,r==o),n=0,++r}++n,++t}return m.join("")}(e):e}))}function Bs(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var zs=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function Zs(t){switch(e(t)){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}}function Vs(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r0&&s>a&&(s=a);for(var u=0;u=0?(c=p.substr(0,d),l=p.substr(d+1)):(c=p,l=""),f=decodeURIComponent(c),h=decodeURIComponent(l),Bs(o,f)?zs(o[f])?o[f].push(h):o[f]=[o[f],h]:o[f]=h}return o}var Ys={parse:uu,resolve:function(e,t){return uu(e,!1,!0).resolve(t)},resolveObject:function(e,t){return e?uu(e,!1,!0).resolveObject(t):t},format:function(e){la(e)&&(e=cu({},e));return lu(e)},Url:Gs};function Gs(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Js=/^([a-z0-9.+-]+:)/i,$s=/:[0-9]*$/,Xs=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Qs=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),eu=["'"].concat(Qs),tu=["%","/","?",";","#"].concat(eu),nu=["/","?","#"],ru=/^[+a-z0-9A-Z_-]{0,63}$/,ou=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,iu={javascript:!0,"javascript:":!0},au={javascript:!0,"javascript:":!0},su={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function uu(e,t,n){if(e&&pa(e)&&e instanceof Gs)return e;var r=new Gs;return r.parse(e,t,n),r}function cu(t,n,r,o){if(!la(n))throw new TypeError("Parameter 'url' must be a string, not "+e(n));var i=n.indexOf("?"),a=-1!==i&&i127?E+="x":E+=O[S];if(!E.match(ru)){var k=w.slice(0,l),C=w.slice(l+1),R=O.match(ou);R&&(k.push(R[1]),C.unshift(R[2])),C.length&&(u="/"+C.join(".")+u),t.hostname=k.join(".");break}}}}t.hostname.length>255?t.hostname="":t.hostname=t.hostname.toLowerCase(),b||(t.hostname=qs(t.hostname)),p=t.port?":"+t.port:"";var P=t.hostname||"";t.host=P+p,t.href+=t.host,b&&(t.hostname=t.hostname.substr(1,t.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!iu[v])for(l=0,h=eu.length;l0)&&r.host.split("@"))&&(r.auth=v.shift(),r.host=r.hostname=v.shift())),r.search=e.search,r.query=e.query,sa(r.pathname)&&sa(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!b.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var O=b.slice(-1)[0],E=(r.host||e.host||b.length>1)&&("."===O||".."===O)||""===O,S=0,x=b.length;x>=0;x--)"."===(O=b[x])?b.splice(x,1):".."===O?(b.splice(x,1),S++):S&&(b.splice(x,1),S--);if(!y&&!g)for(;S--;S)b.unshift("..");!y||""===b[0]||b[0]&&"/"===b[0].charAt(0)||b.unshift(""),E&&"/"!==b.join("/").substr(-1)&&b.push("");var k=""===b[0]||b[0]&&"/"===b[0].charAt(0);return w&&(r.hostname=r.host=k?"":b.length?b.shift():"",(v=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=v.shift(),r.host=r.hostname=v.shift())),(y=y||r.host&&b.length)&&!k&&b.unshift(""),b.length?r.pathname=b.join("/"):(r.pathname=null,r.path=null),sa(r.pathname)&&sa(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},Gs.prototype.parseHost=function(){return fu(this)},pu.defaultMaxSockets=4;var du={request:hu,get:function(e,t){var n=hu(e,t);return n.end(),n},Agent:pu,METHODS:["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],STATUS_CODES:{100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}};function vu(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o=0){var a=r.indexOf("\n",i+1);r=r.substring(a+1)}this.stack=r}}}function Cu(e,t){return"string"==typeof e?e.length=0;s--)if(u[s]!==c[s])return!1;for(s=u.length-1;s>=0;s--)if(!Au(e[a=u[s]],t[a],n,r))return!1;return!0}(t,n,r,o))}return r?t===n:t==n}function Tu(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function Iu(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function Lu(e,t,n,r){var o;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),o=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!o&&Pu(o,n,"Missing expected exception"+r);var i="string"==typeof r,a=!e&&o&&!n;if((!e&&va(o)&&i&&Iu(o,n)||a)&&Pu(o,n,"Got unwanted exception"+r),e&&o&&n&&!Iu(o,n)||!e&&o)throw o}Eu.AssertionError=ku,Wi(ku,Error),Eu.fail=Pu,Eu.ok=ju,Eu.equal=function e(t,n,r){t!=n&&Pu(t,n,r,"==",e)},Eu.notEqual=function e(t,n,r){t==n&&Pu(t,n,r,"!=",e)},Eu.deepEqual=function e(t,n,r){Au(t,n,!1)||Pu(t,n,r,"deepEqual",e)},Eu.deepStrictEqual=function e(t,n,r){Au(t,n,!0)||Pu(t,n,r,"deepStrictEqual",e)},Eu.notDeepEqual=function e(t,n,r){Au(t,n,!1)&&Pu(t,n,r,"notDeepEqual",e)},Eu.notDeepStrictEqual=function e(t,n,r){Au(t,n,!0)&&Pu(t,n,r,"notDeepStrictEqual",e)},Eu.strictEqual=function e(t,n,r){t!==n&&Pu(t,n,r,"===",e)},Eu.notStrictEqual=function e(t,n,r){t===n&&Pu(t,n,r,"!==",e)},Eu.throws=function(e,t,n){Lu(!0,e,t,n)},Eu.doesNotThrow=function(e,t,n){Lu(!1,e,t,n)},Eu.ifError=function(e){if(e)throw e};var Nu=1e3,Du=6e4,Mu=60*Du,Uu=24*Mu,Fu=7*Uu,Hu=365.25*Uu,qu=function(t,n){n=n||{};var r=e(t);if("string"===r&&t.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*Hu;case"weeks":case"week":case"w":return n*Fu;case"days":case"day":case"d":return n*Uu;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Mu;case"minutes":case"minute":case"mins":case"min":case"m":return n*Du;case"seconds":case"second":case"secs":case"sec":case"s":return n*Nu;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(t);if("number"===r&&isFinite(t))return n.long?function(e){var t=Math.abs(e);if(t>=Uu)return Bu(e,t,Uu,"day");if(t>=Mu)return Bu(e,t,Mu,"hour");if(t>=Du)return Bu(e,t,Du,"minute");if(t>=Nu)return Bu(e,t,Nu,"second");return e+" ms"}(t):function(e){var t=Math.abs(e);if(t>=Uu)return Math.round(e/Uu)+"d";if(t>=Mu)return Math.round(e/Mu)+"h";if(t>=Du)return Math.round(e/Du)+"m";if(t>=Nu)return Math.round(e/Nu)+"s";return e+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Bu(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}var zu=function(e){function n(e){var t,o=null;function i(){for(var e=arguments.length,r=new Array(e),o=0;o=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(n=!1,function(){n||(n=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||function(){},e.exports=zu(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}));Zu.formatArgs,Zu.save,Zu.load,Zu.useColors,Zu.storage,Zu.destroy,Zu.colors,Zu.log;var Vu,Wu={isatty:function(){return!1},ReadStream:function(){throw new Error("tty.ReadStream is not implemented")},WriteStream:function(){throw new Error("tty.ReadStream is not implemented")}};function Ku(){return"/tmp"}var Yu,Gu={EOL:"\n",tmpdir:Ku,tmpDir:Ku,networkInterfaces:function(){},getNetworkInterfaces:function(){},release:function(){return void 0!==$r.navigator?$r.navigator.appVersion:""},type:function(){return"Browser"},cpus:function(){return[]},totalmem:function(){return Number.MAX_VALUE},freemem:function(){return Number.MAX_VALUE},uptime:function(){return 0},loadavg:function(){return[]},hostname:function(){return void 0!==$r.location?$r.location.hostname:""},endianness:function(){if(void 0===Vu){var e=new ArrayBuffer(2),t=new Uint8Array(e),n=new Uint16Array(e);if(t[0]=1,t[1]=2,258===n[0])Vu="BE";else{if(513!==n[0])throw new Error("unable to figure out endianess");Vu="LE"}}return Vu}},Ju=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Eo.argv,n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),o=t.indexOf("--");return-1!==r&&(-1===o||r=2,has16m:e>=3}}function Qu(e,t){if(0===Yu)return 0;if(Ju("color=16m")||Ju("color=full")||Ju("color=truecolor"))return 3;if(Ju("color=256"))return 2;if(e&&!t&&void 0===Yu)return 0;var n=Yu||0;if("dumb"===$u.TERM)return n;if("win32"===Eo.platform){var r=Gu.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in $u)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((function(e){return e in $u}))||"codeship"===$u.CI_NAME?1:n;if("TEAMCITY_VERSION"in $u)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test($u.TEAMCITY_VERSION)?1:0;if("truecolor"===$u.COLORTERM)return 3;if("TERM_PROGRAM"in $u){var o=parseInt(($u.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch($u.TERM_PROGRAM){case"iTerm.app":return o>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test($u.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test($u.TERM)||"COLORTERM"in $u?1:n}Ju("no-color")||Ju("no-colors")||Ju("color=false")||Ju("color=never")?Yu=0:(Ju("color")||Ju("colors")||Ju("color=true")||Ju("color=always"))&&(Yu=1),"FORCE_COLOR"in $u&&(Yu="true"===$u.FORCE_COLOR?1:"false"===$u.FORCE_COLOR?0:0===$u.FORCE_COLOR.length?1:Math.min(parseInt($u.FORCE_COLOR,10),3));var ec,tc={supportsColor:function(e){return Xu(Qu(e,e&&e.isTTY))},stdout:Xu(Qu(!0,Wu.isatty(1))),stderr:Xu(Qu(!0,Wu.isatty(2)))},nc=Me((function(e,t){t.init=function(e){e.inspectOpts={};for(var n=Object.keys(t.inspectOpts),r=0;r=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(Eo.env).filter((function(e){return/^debug_/i.test(e)})).reduce((function(e,t){var n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(function(e,t){return t.toUpperCase()})),r=Eo.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=zu(t);var n=e.exports.formatters;n.o=function(e){return this.inspectOpts.colors=this.useColors,Sa.inspect(e,this.inspectOpts).split("\n").map((function(e){return e.trim()})).join(" ")},n.O=function(e){return this.inspectOpts.colors=this.useColors,Sa.inspect(e,this.inspectOpts)}})),rc=(nc.init,nc.log,nc.formatArgs,nc.save,nc.load,nc.useColors,nc.destroy,nc.colors,nc.inspectOpts,Me((function(e){void 0===Eo||Eo.type,e.exports=Zu}))),oc=function(){if(!ec){try{ec=rc("follow-redirects")}catch(e){}"function"!=typeof ec&&(ec=function(){})}ec.apply(null,arguments)},ic=Ys.URL,ac=ks.Writable,sc=["abort","aborted","connect","error","socket","timeout"],uc=Object.create(null);sc.forEach((function(e){uc[e]=function(t,n,r){this._redirectable.emit(e,t,n,r)}}));var cc=yc("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),lc=yc("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),fc=yc("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),hc=yc("ERR_STREAM_WRITE_AFTER_END","write after end");function pc(e,t){ac.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var n=this;this._onNativeResponse=function(e){n._processResponse(e)},this._performRequest()}function dc(e){var t={maxRedirects:21,maxBodyLength:10485760},n={};return Object.keys(e).forEach((function(r){var o=r+":",i=n[o]=e[r],a=t[r]=Object.create(i);Object.defineProperties(a,{request:{value:function(e,r,i){if("string"==typeof e){var a=e;try{e=mc(new ic(a))}catch(t){e=Ys.parse(a)}}else ic&&e instanceof ic?e=mc(e):(i=r,r=e,e={protocol:o});return"function"==typeof r&&(i=r,r=null),(r=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,r)).nativeProtocols=n,Eu.equal(r.protocol,o,"protocol mismatch"),oc("options",r),new pc(r,i)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,n){var r=a.request(e,t,n);return r.end(),r},configurable:!0,enumerable:!0,writable:!0}})})),t}function vc(){}function mc(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};return""!==e.port&&(t.port=Number(e.port)),t}function _c(e,t){var n;for(var r in t)e.test(r)&&(n=t[r],delete t[r]);return null==n?void 0:String(n).trim()}function yc(e,t){function n(e){Error.captureStackTrace(this,this.constructor),e?(this.message=t+": "+e.message,this.cause=e):this.message=t}return n.prototype=new Error,n.prototype.constructor=n,n.prototype.name="Error ["+e+"]",n.prototype.code=e,n}function gc(e){for(var t=0,n=sc;t=400)return e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),void(this._requestBodyBuffers=[]);if(gc(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)this.emit("error",new lc);else{var r,o=this._options.beforeRedirect;o&&(r=Object.assign({Host:e.req.getHeader("host")},this._options.headers));var i=this._options.method;((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],_c(/^content-/i,this._options.headers));var a,s=_c(/^host$/i,this._options.headers),u=Ys.parse(this._currentUrl),c=s||u.host,l=/^\w+:/.test(n)?this._currentUrl:Ys.format(Object.assign(u,{host:c}));try{a=Ys.resolve(l,n)}catch(e){return void this.emit("error",new cc(e))}oc("redirecting to",a),this._isRedirect=!0;var f=Ys.parse(a);if(Object.assign(this._options,f),(f.protocol!==u.protocol&&"https:"!==f.protocol||f.host!==c&&!function(e,t){var n=e.length-t.length-1;return n>0&&"."===e[n]&&e.endsWith(t)}(f.host,c))&&_c(/^(?:authorization|cookie)$/i,this._options.headers),"function"==typeof o){var h={headers:e.headers,statusCode:t},p={url:l,method:i,headers:r};try{o(this._options,h,p)}catch(e){return void this.emit("error",e)}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){this.emit("error",new cc(e))}}};var bc=dc({http:du,https:du}),wc=dc;bc.wrap=wc;var Oc={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function Ec(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function Sc(e,t,n,r,o){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),o);else for(var i=0;i=0;)e[t]=0}var Pc=256,jc=286,Ac=30,Tc=15,Ic=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Lc=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Nc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Dc=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Mc=new Array(576);Rc(Mc);var Uc=new Array(60);Rc(Uc);var Fc=new Array(512);Rc(Fc);var Hc=new Array(256);Rc(Hc);var qc=new Array(29);Rc(qc);var Bc,zc,Zc,Vc=new Array(Ac);function Wc(e,t,n,r,o){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=o,this.has_stree=e&&e.length}function Kc(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Yc(e){return e<256?Fc[e]:Fc[256+(e>>>7)]}function Gc(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function Jc(e,t,n){e.bi_valid>16-n?(e.bi_buf|=t<>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<>>=1,n<<=1}while(--t>0);return n>>>1}function Qc(e,t,n){var r,o,i=new Array(16),a=0;for(r=1;r<=Tc;r++)i[r]=a=a+n[r-1]<<1;for(o=0;o<=t;o++){var s=e[2*o+1];0!==s&&(e[2*o]=Xc(i[s]++,s))}}function el(e){var t;for(t=0;t8?Gc(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function nl(e,t,n,r){var o=2*t,i=2*n;return e[o]>1;n>=1;n--)rl(e,i,n);o=u;do{n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],rl(e,i,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,i[2*o]=i[2*n]+i[2*r],e.depth[o]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,i[2*n+1]=i[2*r+1]=o,e.heap[1]=o++,rl(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,o,i,a,s,u=t.dyn_tree,c=t.max_code,l=t.stat_desc.static_tree,f=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,d=t.stat_desc.max_length,v=0;for(i=0;i<=Tc;i++)e.bl_count[i]=0;for(u[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<573;n++)(i=u[2*u[2*(r=e.heap[n])+1]+1]+1)>d&&(i=d,v++),u[2*r+1]=i,r>c||(e.bl_count[i]++,a=0,r>=p&&(a=h[r-p]),s=u[2*r],e.opt_len+=s*(i+a),f&&(e.static_len+=s*(l[2*r+1]+a)));if(0!==v){do{for(i=d-1;0===e.bl_count[i];)i--;e.bl_count[i]--,e.bl_count[i+1]+=2,e.bl_count[d]--,v-=2}while(v>0);for(i=d;0!==i;i--)for(r=e.bl_count[i];0!==r;)(o=e.heap[--n])>c||(u[2*o+1]!==i&&(e.opt_len+=(i-u[2*o+1])*u[2*o],u[2*o+1]=i),r--)}}(e,t),Qc(i,c,e.bl_count)}function al(e,t,n){var r,o,i=-1,a=t[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)o=a,a=t[2*(r+1)+1],++s>=7;r=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}function hl(e,t,n,r){var o,i,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t=3&&0===e.bl_tree[2*Dc[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),o=e.opt_len+3+7>>>3,(i=e.static_len+3+7>>>3)<=o&&(o=i)):o=i=n+5,n+4<=o&&-1!==t?ll(e,t,n,r):4===e.strategy||i===o?(Jc(e,2+(r?1:0),3),ol(e,Mc,Uc)):(Jc(e,4+(r?1:0),3),function(e,t,n,r){var o;for(Jc(e,t-257,5),Jc(e,n-1,5),Jc(e,r-4,4),o=0;o>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(Hc[n]+Pc+1)]++,e.dyn_dtree[2*Yc(t)]++),e.last_lit===e.lit_bufsize-1}function dl(e,t,n,r){for(var o=65535&e|0,i=e>>>16&65535|0,a=0;0!==n;){n-=a=n>2e3?2e3:n;do{i=i+(o=o+t[r++]|0)|0}while(--a);o%=65521,i%=65521}return o|i<<16|0}var vl=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();function ml(e,t,n,r){var o=vl,i=r+n;e^=-1;for(var a=r;a>>8^o[255&(e^t[a])];return-1^e}var _l,yl=-2,gl=258,bl=262,wl=103,Ol=113,El=666;function Sl(e,t){return e.msg=Oc[t],t}function xl(e){return(e<<1)-(e>4?9:0)}function kl(e){for(var t=e.length;--t>=0;)e[t]=0}function Cl(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(Sc(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function Rl(e,t){hl(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Cl(e.strm)}function Pl(e,t){e.pending_buf[e.pending++]=t}function jl(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function Al(e,t){var n,r,o=e.max_chain_length,i=e.strstart,a=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-bl?e.strstart-(e.w_size-bl):0,c=e.window,l=e.w_mask,f=e.prev,h=e.strstart+gl,p=c[i+a-1],d=c[i+a];e.prev_length>=e.good_match&&(o>>=2),s>e.lookahead&&(s=e.lookahead);do{if(c[(n=t)+a]===d&&c[n+a-1]===p&&c[n]===c[i]&&c[++n]===c[i+1]){i+=2,n++;do{}while(c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&ia){if(e.match_start=t,a=r,r>=s)break;p=c[i+a-1],d=c[i+a]}}}while((t=f[t&l])>u&&0!=--o);return a<=e.lookahead?a:e.lookahead}function Tl(e){var t,n,r,o,i,a,s,u,c,l,f=e.w_size;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=f+(f-bl)){Sc(e.window,e.window,f,f,0),e.match_start-=f,e.strstart-=f,e.block_start-=f,t=n=e.hash_size;do{r=e.head[--t],e.head[t]=r>=f?r-f:0}while(--n);t=n=f;do{r=e.prev[--t],e.prev[t]=r>=f?r-f:0}while(--n);o+=f}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,u=e.strstart+e.lookahead,c=o,l=void 0,(l=a.avail_in)>c&&(l=c),n=0===l?0:(a.avail_in-=l,Sc(s,a.input,a.next_in,l,u),1===a.state.wrap?a.adler=dl(a.adler,s,l,u):2===a.state.wrap&&(a.adler=ml(a.adler,s,l,u)),a.next_in+=l,a.total_in+=l,l),e.lookahead+=n,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<=3)if(r=pl(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=3&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){o=e.strstart+e.lookahead-3,r=pl(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=o&&(e.ins_h=(e.ins_h<5||t<0)return e?Sl(e,yl):yl;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||r.status===El&&4!==t)return Sl(e,0===e.avail_out?-5:yl);if(r.strm=e,n=r.last_flush,r.last_flush=t,42===r.status)if(2===r.wrap)e.adler=0,Pl(r,31),Pl(r,139),Pl(r,8),r.gzhead?(Pl(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Pl(r,255&r.gzhead.time),Pl(r,r.gzhead.time>>8&255),Pl(r,r.gzhead.time>>16&255),Pl(r,r.gzhead.time>>24&255),Pl(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Pl(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Pl(r,255&r.gzhead.extra.length),Pl(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=ml(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(Pl(r,0),Pl(r,0),Pl(r,0),Pl(r,0),Pl(r,0),Pl(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Pl(r,3),r.status=Ol);else{var a=8+(r.w_bits-8<<4)<<8;a|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(a|=32),a+=31-a%31,r.status=Ol,jl(r,a),0!==r.strstart&&(jl(r,e.adler>>>16),jl(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(o=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>o&&(e.adler=ml(e.adler,r.pending_buf,r.pending-o,o)),Cl(e),o=r.pending,r.pending!==r.pending_buf_size));)Pl(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>o&&(e.adler=ml(e.adler,r.pending_buf,r.pending-o,o)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){o=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>o&&(e.adler=ml(e.adler,r.pending_buf,r.pending-o,o)),Cl(e),o=r.pending,r.pending===r.pending_buf_size)){i=1;break}i=r.gzindexo&&(e.adler=ml(e.adler,r.pending_buf,r.pending-o,o)),0===i&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){o=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>o&&(e.adler=ml(e.adler,r.pending_buf,r.pending-o,o)),Cl(e),o=r.pending,r.pending===r.pending_buf_size)){i=1;break}i=r.gzindexo&&(e.adler=ml(e.adler,r.pending_buf,r.pending-o,o)),0===i&&(r.status=wl)}else r.status=wl;if(r.status===wl&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&Cl(e),r.pending+2<=r.pending_buf_size&&(Pl(r,255&e.adler),Pl(r,e.adler>>8&255),e.adler=0,r.status=Ol)):r.status=Ol),0!==r.pending){if(Cl(e),0===e.avail_out)return r.last_flush=-1,0}else if(0===e.avail_in&&xl(t)<=xl(n)&&4!==t)return Sl(e,-5);if(r.status===El&&0!==e.avail_in)return Sl(e,-5);if(0!==e.avail_in||0!==r.lookahead||0!==t&&r.status!==El){var s=2===r.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(Tl(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,n=pl(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(Rl(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Rl(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Rl(e,!1),0===e.strm.avail_out)?1:2}(r,t):3===r.strategy?function(e,t){for(var n,r,o,i,a=e.window;;){if(e.lookahead<=gl){if(Tl(e),e.lookahead<=gl&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=a[o=e.strstart-1])===a[++o]&&r===a[++o]&&r===a[++o]){i=e.strstart+gl;do{}while(r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&r===a[++o]&&oe.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=pl(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=pl(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(Rl(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Rl(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Rl(e,!1),0===e.strm.avail_out)?1:2}(r,t):_l[r.level].func(r,t);if(3!==s&&4!==s||(r.status=El),1===s||3===s)return 0===e.avail_out&&(r.last_flush=-1),0;if(2===s&&(1===t?fl(r):5!==t&&(ll(r,0,0,!1),3===t&&(kl(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),Cl(e),0===e.avail_out))return r.last_flush=-1,0}return 4!==t?0:r.wrap<=0?1:(2===r.wrap?(Pl(r,255&e.adler),Pl(r,e.adler>>8&255),Pl(r,e.adler>>16&255),Pl(r,e.adler>>24&255),Pl(r,255&e.total_in),Pl(r,e.total_in>>8&255),Pl(r,e.total_in>>16&255),Pl(r,e.total_in>>24&255)):(jl(r,e.adler>>>16),jl(r,65535&e.adler)),Cl(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?0:1)}_l=[new Nl(0,0,0,0,(function(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Tl(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,Rl(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-bl&&(Rl(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Rl(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(Rl(e,!1),e.strm.avail_out),1)})),new Nl(4,4,8,4,Il),new Nl(4,5,16,8,Il),new Nl(4,6,32,32,Il),new Nl(4,4,16,16,Ll),new Nl(8,16,32,32,Ll),new Nl(8,16,128,128,Ll),new Nl(8,32,128,256,Ll),new Nl(32,128,258,1024,Ll),new Nl(32,258,258,4096,Ll)];function Fl(e,t){var n,r,o,i,a,s,u,c,l,f,h,p,d,v,m,_,y,g,b,w,O,E,S,x,k;n=e.state,r=e.next_in,x=e.input,o=r+(e.avail_in-5),i=e.next_out,k=e.output,a=i-(t-e.avail_out),s=i+(e.avail_out-257),u=n.dmax,c=n.wsize,l=n.whave,f=n.wnext,h=n.window,p=n.hold,d=n.bits,v=n.lencode,m=n.distcode,_=(1<>>=b=g>>>24,d-=b,0===(b=g>>>16&255))k[i++]=65535&g;else{if(!(16&b)){if(0==(64&b)){g=v[(65535&g)+(p&(1<>>=b,d-=b),d<15&&(p+=x[r++]<>>=b=g>>>24,d-=b,!(16&(b=g>>>16&255))){if(0==(64&b)){g=m[(65535&g)+(p&(1<u){e.msg="invalid distance too far back",n.mode=30;break e}if(p>>>=b,d-=b,O>(b=i-a)){if((b=O-b)>l&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(E=0,S=h,0===f){if(E+=c-b,b2;)k[i++]=S[E++],k[i++]=S[E++],k[i++]=S[E++],w-=3;w&&(k[i++]=S[E++],w>1&&(k[i++]=S[E++]))}else{E=i-O;do{k[i++]=k[E++],k[i++]=k[E++],k[i++]=k[E++],w-=3}while(w>2);w&&(k[i++]=k[E++],w>1&&(k[i++]=k[E++]))}break}}break}}while(r>3,p&=(1<<(d-=w<<3))-1,e.next_in=r,e.next_out=i,e.avail_in=r=1&&0===j[w];w--);if(O>w&&(O=w),0===w)return o[i++]=20971520,o[i++]=20971520,s.bits=1,0;for(b=1;b0&&(0===e||1!==w))return-1;for(A[1]=0,y=1;y852||2===e&&k>592)return 1;for(;;){d=y-S,a[g]p?(v=T[I+a[g]],m=R[P+a[g]]):(v=96,m=0),u=1<>S)+(c-=u)]=d<<24|v<<16|m|0}while(0!==c);for(u=1<>=1;if(0!==u?(C&=u-1,C+=u):C=0,g++,0==--j[y]){if(y===w)break;y=t[n+a[g]]}if(y>O&&(C&f)!==l){for(0===S&&(S=O),h+=b,x=1<<(E=y-S);E+S852||2===e&&k>592)return 1;o[l=C&f]=O<<24|E<<16|h-i|0}}return 0!==C&&(o[h+C]=y-S<<24|64<<16|0),s.bits=O,0}var Wl=-2,Kl=12,Yl=30;function Gl(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function Jl(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new kc(320),this.work=new kc(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function $l(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,function(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Cc(852),t.distcode=t.distdyn=new Cc(592),t.sane=1,t.back=-1,0):Wl}(e)):Wl}function Xl(e,t){var n,r;return e?(r=new Jl,e.state=r,r.window=null,n=function(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Wl:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,$l(e))):Wl}(e,t),0!==n&&(e.state=null),n):Wl}var Ql,ef,tf=!0;function nf(e){if(tf){var t;for(Ql=new Cc(512),ef=new Cc(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Vl(1,e.lens,0,288,Ql,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Vl(2,e.lens,0,32,ef,0,e.work,{bits:5}),tf=!1}e.lencode=Ql,e.lenbits=9,e.distcode=ef,e.distbits=5}function rf(e,t){var n,r,o,i,a,s,u,c,l,f,h,p,d,v,m,_,y,g,b,w,O,E,S,x,k=0,C=new xc(4),R=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return Wl;(n=e.state).mode===Kl&&(n.mode=13),a=e.next_out,o=e.output,u=e.avail_out,i=e.next_in,r=e.input,s=e.avail_in,c=n.hold,l=n.bits,f=s,h=u,E=0;e:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;l<16;){if(0===s)break e;s--,c+=r[i++]<>>8&255,n.check=ml(n.check,C,2,0),c=0,l=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",n.mode=Yl;break}if(8!=(15&c)){e.msg="unknown compression method",n.mode=Yl;break}if(l-=4,O=8+(15&(c>>>=4)),0===n.wbits)n.wbits=O;else if(O>n.wbits){e.msg="invalid window size",n.mode=Yl;break}n.dmax=1<>8&1),512&n.flags&&(C[0]=255&c,C[1]=c>>>8&255,n.check=ml(n.check,C,2,0)),c=0,l=0,n.mode=3;case 3:for(;l<32;){if(0===s)break e;s--,c+=r[i++]<>>8&255,C[2]=c>>>16&255,C[3]=c>>>24&255,n.check=ml(n.check,C,4,0)),c=0,l=0,n.mode=4;case 4:for(;l<16;){if(0===s)break e;s--,c+=r[i++]<>8),512&n.flags&&(C[0]=255&c,C[1]=c>>>8&255,n.check=ml(n.check,C,2,0)),c=0,l=0,n.mode=5;case 5:if(1024&n.flags){for(;l<16;){if(0===s)break e;s--,c+=r[i++]<>>8&255,n.check=ml(n.check,C,2,0)),c=0,l=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((p=n.length)>s&&(p=s),p&&(n.head&&(O=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Sc(n.head.extra,r,i,p,O)),512&n.flags&&(n.check=ml(n.check,r,p,i)),s-=p,i+=p,n.length-=p),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===s)break e;p=0;do{O=r[i+p++],n.head&&O&&n.length<65536&&(n.head.name+=String.fromCharCode(O))}while(O&&p>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=Kl;break;case 10:for(;l<32;){if(0===s)break e;s--,c+=r[i++]<>>=7&l,l-=7&l,n.mode=27;break}for(;l<3;){if(0===s)break e;s--,c+=r[i++]<>>=1)){case 0:n.mode=14;break;case 1:if(nf(n),n.mode=20,6===t){c>>>=2,l-=2;break e}break;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=Yl}c>>>=2,l-=2;break;case 14:for(c>>>=7&l,l-=7&l;l<32;){if(0===s)break e;s--,c+=r[i++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=Yl;break}if(n.length=65535&c,c=0,l=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(p=n.length){if(p>s&&(p=s),p>u&&(p=u),0===p)break e;Sc(o,r,i,p,a),s-=p,i+=p,u-=p,a+=p,n.length-=p;break}n.mode=Kl;break;case 17:for(;l<14;){if(0===s)break e;s--,c+=r[i++]<>>=5,l-=5,n.ndist=1+(31&c),c>>>=5,l-=5,n.ncode=4+(15&c),c>>>=4,l-=4,n.nlen>286||n.ndist>30){e.msg="too many length or distance symbols",n.mode=Yl;break}n.have=0,n.mode=18;case 18:for(;n.have>>=3,l-=3}for(;n.have<19;)n.lens[R[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,S={bits:n.lenbits},E=Vl(0,n.lens,0,19,n.lencode,0,n.work,S),n.lenbits=S.bits,E){e.msg="invalid code lengths set",n.mode=Yl;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,y=65535&k,!((m=k>>>24)<=l);){if(0===s)break e;s--,c+=r[i++]<>>=m,l-=m,n.lens[n.have++]=y;else{if(16===y){for(x=m+2;l>>=m,l-=m,0===n.have){e.msg="invalid bit length repeat",n.mode=Yl;break}O=n.lens[n.have-1],p=3+(3&c),c>>>=2,l-=2}else if(17===y){for(x=m+3;l>>=m)),c>>>=3,l-=3}else{for(x=m+7;l>>=m)),c>>>=7,l-=7}if(n.have+p>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=Yl;break}for(;p--;)n.lens[n.have++]=O}}if(n.mode===Yl)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=Yl;break}if(n.lenbits=9,S={bits:n.lenbits},E=Vl(1,n.lens,0,n.nlen,n.lencode,0,n.work,S),n.lenbits=S.bits,E){e.msg="invalid literal/lengths set",n.mode=Yl;break}if(n.distbits=6,n.distcode=n.distdyn,S={bits:n.distbits},E=Vl(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,S),n.distbits=S.bits,E){e.msg="invalid distances set",n.mode=Yl;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(s>=6&&u>=258){e.next_out=a,e.avail_out=u,e.next_in=i,e.avail_in=s,n.hold=c,n.bits=l,Fl(e,h),a=e.next_out,o=e.output,u=e.avail_out,i=e.next_in,r=e.input,s=e.avail_in,c=n.hold,l=n.bits,n.mode===Kl&&(n.back=-1);break}for(n.back=0;_=(k=n.lencode[c&(1<>>16&255,y=65535&k,!((m=k>>>24)<=l);){if(0===s)break e;s--,c+=r[i++]<>g)])>>>16&255,y=65535&k,!(g+(m=k>>>24)<=l);){if(0===s)break e;s--,c+=r[i++]<>>=g,l-=g,n.back+=g}if(c>>>=m,l-=m,n.back+=m,n.length=y,0===_){n.mode=26;break}if(32&_){n.back=-1,n.mode=Kl;break}if(64&_){e.msg="invalid literal/length code",n.mode=Yl;break}n.extra=15&_,n.mode=22;case 22:if(n.extra){for(x=n.extra;l>>=n.extra,l-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;_=(k=n.distcode[c&(1<>>16&255,y=65535&k,!((m=k>>>24)<=l);){if(0===s)break e;s--,c+=r[i++]<>g)])>>>16&255,y=65535&k,!(g+(m=k>>>24)<=l);){if(0===s)break e;s--,c+=r[i++]<>>=g,l-=g,n.back+=g}if(c>>>=m,l-=m,n.back+=m,64&_){e.msg="invalid distance code",n.mode=Yl;break}n.offset=y,n.extra=15&_,n.mode=24;case 24:if(n.extra){for(x=n.extra;l>>=n.extra,l-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=Yl;break}n.mode=25;case 25:if(0===u)break e;if(p=h-u,n.offset>p){if((p=n.offset-p)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=Yl;break}p>n.wnext?(p-=n.wnext,d=n.wsize-p):d=n.wnext-p,p>n.length&&(p=n.length),v=n.window}else v=o,d=a-n.offset,p=n.length;p>u&&(p=u),u-=p,n.length-=p;do{o[a++]=v[d++]}while(--p);0===n.length&&(n.mode=21);break;case 26:if(0===u)break e;o[a++]=n.length,u--,n.mode=21;break;case 27:if(n.wrap){for(;l<32;){if(0===s)break e;s--,c|=r[i++]<=i.wsize?(Sc(i.window,t,n-i.wsize,i.wsize,0),i.wnext=0,i.whave=i.wsize):((o=i.wsize-i.wnext)>r&&(o=r),Sc(i.window,t,n-r,o,i.wnext),(r-=o)?(Sc(i.window,t,n-r,r,0),i.wnext=r,i.whave=i.wsize):(i.wnext+=o,i.wnext===i.wsize&&(i.wnext=0),i.whave7)throw new TypeError("Bad argument");this.mode=e,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function sf(e,t){for(var n=0;n15&&(a=2,r-=16),o<1||o>9||8!==n||r<8||r>15||t<0||t>9||i<0||i>4)return Sl(e,yl);8===r&&(r=9);var s=new Dl;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<cf.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitscf.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelcf.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelcf.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=cf.Z_FILTERED&&e.strategy!=cf.Z_HUFFMAN_ONLY&&e.strategy!=cf.Z_RLE&&e.strategy!=cf.Z_FIXED&&e.strategy!=cf.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!Ti(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new cf.Zlib(t);var n=this;this._hadError=!1,this._binding.onerror=function(e,t){n._binding=null,n._hadError=!0;var r=new Error(e);r.errno=t,r.code=cf.codes[t],n.emit("error",r)};var r=cf.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(r=e.level);var o=cf.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(o=e.strategy),this._binding.init(e.windowBits||cf.Z_DEFAULT_WINDOWBITS,r,e.memLevel||cf.Z_DEFAULT_MEMLEVEL,o,e.dictionary),this._buffer=new Go(this._chunkSize),this._offset=0,this._closed=!1,this._level=r,this._strategy=o,this.once("end",this.close)}Object.keys(lf).forEach((function(e){lf[lf[e]]=e})),Wi(bf,Es),bf.prototype.params=function(e,t,n){if(ecf.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=cf.Z_FILTERED&&t!=cf.Z_HUFFMAN_ONLY&&t!=cf.Z_RLE&&t!=cf.Z_FIXED&&t!=cf.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);if(this._level!==e||this._strategy!==t){var r=this;this.flush(cf.Z_SYNC_FLUSH,(function(){r._binding.params(e,t),r._hadError||(r._level=e,r._strategy=t,n&&n())}))}else co(n)},bf.prototype.reset=function(){return this._binding.reset()},bf.prototype._flush=function(e){this._transform(new Go(0),"",e)},bf.prototype.flush=function(e,t){var n=this._writableState;if(("function"==typeof e||void 0===e&&!t)&&(t=e,e=cf.Z_FULL_FLUSH),n.ended)t&&co(t);else if(n.ending)t&&this.once("end",t);else if(n.needDrain){var r=this;this.once("drain",(function(){r.flush(t)}))}else this._flushFlag=e,this.write(new Go(0),"",t)},bf.prototype.close=function(e){if(e&&co(e),!this._closed){this._closed=!0,this._binding.close();var t=this;co((function(){t.emit("close")}))}},bf.prototype._transform=function(e,t,n){var r,o=this._writableState,i=(o.ending||o.ended)&&(!e||o.length===e.length);if(null===!e&&!Ti(e))return n(new Error("invalid input"));i?r=cf.Z_FINISH:(r=this._flushFlag,e.length>=o.length&&(this._flushFlag=this._opts.flush||cf.Z_NO_FLUSH)),this._processChunk(e,r,n)},bf.prototype._processChunk=function(e,t,n){var r=e&&e.length,o=this._chunkSize-this._offset,i=0,a=this,s="function"==typeof n;if(!s){var u,c=[],l=0;this.on("error",(function(e){u=e}));do{var f=this._binding.writeSync(t,e,i,r,this._buffer,this._offset,o)}while(!this._hadError&&d(f[0],f[1]));if(this._hadError)throw u;var h=Go.concat(c,l);return this.close(),h}var p=this._binding.write(t,e,i,r,this._buffer,this._offset,o);function d(u,f){if(!a._hadError){var h=o-f;if(function(e,t){if(!e)throw new Error(t)}(h>=0,"have should not go down"),h>0){var p=a._buffer.slice(a._offset,a._offset+h);a._offset+=h,s?a.push(p):(c.push(p),l+=p.length)}if((0===f||a._offset>=a._chunkSize)&&(o=a._chunkSize,a._offset=0,a._buffer=new Go(a._chunkSize)),0===f){if(i+=r-u,r=u,!s)return!0;var v=a._binding.write(t,e,i,r,a._buffer,a._offset,a._chunkSize);return v.callback=d,void(v.buffer=e)}if(!s)return!1;n()}}p.buffer=e,p.callback=d},Wi(pf,bf),Wi(df,bf),Wi(vf,bf),Wi(mf,bf),Wi(_f,bf),Wi(yf,bf),Wi(gf,bf);var wf={codes:lf,createDeflate:function(e){return new pf(e)},createInflate:function(e){return new df(e)},createDeflateRaw:function(e){return new _f(e)},createInflateRaw:function(e){return new yf(e)},createGzip:function(e){return new vf(e)},createGunzip:function(e){return new mf(e)},createUnzip:function(e){return new gf(e)},deflate:function(e,t,n){return"function"==typeof t&&(n=t,t={}),ff(new pf(t),e,n)},deflateSync:function(e,t){return hf(new pf(t),e)},gzip:function(e,t,n){return"function"==typeof t&&(n=t,t={}),ff(new vf(t),e,n)},gzipSync:function(e,t){return hf(new vf(t),e)},deflateRaw:function(e,t,n){return"function"==typeof t&&(n=t,t={}),ff(new _f(t),e,n)},deflateRawSync:function(e,t){return hf(new _f(t),e)},unzip:function(e,t,n){return"function"==typeof t&&(n=t,t={}),ff(new gf(t),e,n)},unzipSync:function(e,t){return hf(new gf(t),e)},inflate:function(e,t,n){return"function"==typeof t&&(n=t,t={}),ff(new df(t),e,n)},inflateSync:function(e,t){return hf(new df(t),e)},gunzip:function(e,t,n){return"function"==typeof t&&(n=t,t={}),ff(new mf(t),e,n)},gunzipSync:function(e,t){return hf(new mf(t),e)},inflateRaw:function(e,t,n){return"function"==typeof t&&(n=t,t={}),ff(new yf(t),e,n)},inflateRawSync:function(e,t){return hf(new yf(t),e)},Deflate:pf,Inflate:df,Gzip:vf,Gunzip:mf,DeflateRaw:_f,InflateRaw:yf,Unzip:gf,Zlib:bf},Of="0.26.1",Ef=bc.http,Sf=bc.https,xf=Of,kf=/https:?/;function Cf(e,t,n){if(e.hostname=t.host,e.host=t.host,e.port=t.port,e.path=n,t.auth){var r=Go.from(t.auth.username+":"+t.auth.password,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+r}e.beforeRedirect=function(e){e.headers.host=e.host,Cf(e,t,e.href)}}var Rf=function(e){return new Promise((function(t,n){var r;function o(){e.cancelToken&&e.cancelToken.unsubscribe(r),e.signal&&e.signal.removeEventListener("abort",r)}var i=function(e){o(),t(e)},a=!1,s=function(e){o(),a=!0,n(e)},u=e.data,c=e.headers,l={};if(Object.keys(c).forEach((function(e){l[e.toLowerCase()]=e})),"user-agent"in l?c[l["user-agent"]]||delete c[l["user-agent"]]:c["User-Agent"]="axios/"+xf,u&&!Wr.isStream(u)){if(Ti(u));else if(Wr.isArrayBuffer(u))u=Go.from(new Uint8Array(u));else{if(!Wr.isString(u))return s(Co("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",e));u=Go.from(u,"utf-8")}if(e.maxBodyLength>-1&&u.length>e.maxBodyLength)return s(Co("Request body larger than maxBodyLength limit",e));l["content-length"]||(c["Content-Length"]=u.length)}var f=void 0;e.auth&&(f=(e.auth.username||"")+":"+(e.auth.password||""));var h=jo(e.baseURL,e.url),p=Ys.parse(h),d=p.protocol||"http:";if(!f&&p.auth){var v=p.auth.split(":");f=(v[0]||"")+":"+(v[1]||"")}f&&l.authorization&&delete c[l.authorization];var m=kf.test(d),_=m?e.httpsAgent:e.httpAgent;try{Yr(p.path,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){var y=new Error(t.message);y.config=e,y.url=e.url,y.exists=!0,s(y)}var g={path:Yr(p.path,e.params,e.paramsSerializer).replace(/^\?/,""),method:e.method.toUpperCase(),headers:c,agent:_,agents:{http:e.httpAgent,https:e.httpsAgent},auth:f};e.socketPath?g.socketPath=e.socketPath:(g.hostname=p.hostname,g.port=p.port);var b,w=e.proxy;if(!w&&!1!==w){var O=d.slice(0,-1)+"_proxy",E=Eo.env[O]||Eo.env[O.toUpperCase()];if(E){var S=Ys.parse(E),x=Eo.env.no_proxy||Eo.env.NO_PROXY,k=!0;if(x){var C=x.split(",").map((function(e){return e.trim()}));k=!C.some((function(e){return!!e&&("*"===e||("."===e[0]&&p.hostname.substr(p.hostname.length-e.length)===e||p.hostname===e))}))}if(k&&(w={host:S.hostname,port:S.port,protocol:S.protocol},S.auth)){var R=S.auth.split(":");w.auth={username:R[0],password:R[1]}}}}w&&(g.headers.host=p.hostname+(p.port?":"+p.port:""),Cf(g,w,d+"//"+p.hostname+(p.port?":"+p.port:"")+g.path));var P=m&&(!w||kf.test(w.protocol));e.transport?b=e.transport:0===e.maxRedirects?b=du:(e.maxRedirects&&(g.maxRedirects=e.maxRedirects),b=P?Sf:Ef),e.maxBodyLength>-1&&(g.maxBodyLength=e.maxBodyLength),e.insecureHTTPParser&&(g.insecureHTTPParser=e.insecureHTTPParser);var j=b.request(g,(function(t){if(!j.aborted){var n=t,r=t.req||j;if(204!==t.statusCode&&"HEAD"!==r.method&&!1!==e.decompress)switch(t.headers["content-encoding"]){case"gzip":case"compress":case"deflate":n=n.pipe(wf.createUnzip()),delete t.headers["content-encoding"]}var o={status:t.statusCode,statusText:t.statusMessage,headers:t.headers,config:e,request:r};if("stream"===e.responseType)o.data=n,Ro(i,s,o);else{var u=[],c=0;n.on("data",(function(t){u.push(t),c+=t.length,e.maxContentLength>-1&&c>e.maxContentLength&&(a=!0,n.destroy(),s(Co("maxContentLength size of "+e.maxContentLength+" exceeded",e,null,r)))})),n.on("aborted",(function(){a||(n.destroy(),s(Co("error request aborted",e,"ERR_REQUEST_ABORTED",r)))})),n.on("error",(function(t){j.aborted||s(xo(t,e,null,r))})),n.on("end",(function(){try{var t=1===u.length?u[0]:Go.concat(u);"arraybuffer"!==e.responseType&&(t=t.toString(e.responseEncoding),e.responseEncoding&&"utf8"!==e.responseEncoding||(t=Wr.stripBOM(t))),o.data=t}catch(t){s(xo(t,e,t.code,o.request,o))}Ro(i,s,o)}))}}}));if(j.on("error",(function(t){j.aborted&&"ERR_FR_TOO_MANY_REDIRECTS"!==t.code||s(xo(t,e,null,j))})),j.on("socket",(function(e){e.setKeepAlive(!0,6e4)})),e.timeout){var A=parseInt(e.timeout,10);if(isNaN(A))return void s(Co("error trying to parse `config.timeout` to int",e,"ERR_PARSE_TIMEOUT",j));j.setTimeout(A,(function(){j.abort();var t="";t=e.timeoutErrorMessage?e.timeoutErrorMessage:"timeout of "+e.timeout+"ms exceeded";var n=e.transitional||ko;s(Co(t,e,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",j))}))}(e.cancelToken||e.signal)&&(r=function(e){j.aborted||(j.abort(),s(!e||e&&e.type?new Lo("canceled"):e))},e.cancelToken&&e.cancelToken.subscribe(r),e.signal&&(e.signal.aborted?r():e.signal.addEventListener("abort",r))),Wr.isStream(u)?u.on("error",(function(t){s(xo(t,e,null,j))})).pipe(j):j.end(u)}))},Pf={"Content-Type":"application/x-www-form-urlencoded"};function jf(e,t){!Wr.isUndefined(e)&&Wr.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var Af,Tf={transitional:ko,adapter:("undefined"!=typeof XMLHttpRequest?Af=No:void 0!==Eo&&"[object process]"===Object.prototype.toString.call(Eo)&&(Af=Rf),Af),transformRequest:[function(e,t){return So(t,"Accept"),So(t,"Content-Type"),Wr.isFormData(e)||Wr.isArrayBuffer(e)||Wr.isBuffer(e)||Wr.isStream(e)||Wr.isFile(e)||Wr.isBlob(e)?e:Wr.isArrayBufferView(e)?e.buffer:Wr.isURLSearchParams(e)?(jf(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Wr.isObject(e)||t&&"application/json"===t["Content-Type"]?(jf(t,"application/json"),function(e,t,n){if(Wr.isString(e))try{return(t||JSON.parse)(e),Wr.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||Tf.transitional,n=t&&t.silentJSONParsing,r=t&&t.forcedJSONParsing,o=!n&&"json"===this.responseType;if(o||r&&Wr.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw xo(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Wr.forEach(["delete","get","head"],(function(e){Tf.headers[e]={}})),Wr.forEach(["post","put","patch"],(function(e){Tf.headers[e]=Wr.merge(Pf)}));var If=Tf,Lf=function(e,t,n){var r=this||If;return Wr.forEach(n,(function(n){e=n.call(r,e,t)})),e},Nf=function(e){return!(!e||!e.__CANCEL__)};function Df(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Lo("canceled")}var Mf=function(e){return Df(e),e.headers=e.headers||{},e.data=Lf.call(e,e.data,e.headers,e.transformRequest),e.headers=Wr.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Wr.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||If.adapter)(e).then((function(t){return Df(e),t.data=Lf.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return Nf(t)||(Df(e),t&&t.response&&(t.response.data=Lf.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Uf=function(e,t){t=t||{};var n={};function r(e,t){return Wr.isPlainObject(e)&&Wr.isPlainObject(t)?Wr.merge(e,t):Wr.isPlainObject(t)?Wr.merge({},t):Wr.isArray(t)?t.slice():t}function o(n){return Wr.isUndefined(t[n])?Wr.isUndefined(e[n])?void 0:r(void 0,e[n]):r(e[n],t[n])}function i(e){if(!Wr.isUndefined(t[e]))return r(void 0,t[e])}function a(n){return Wr.isUndefined(t[n])?Wr.isUndefined(e[n])?void 0:r(void 0,e[n]):r(void 0,t[n])}function s(n){return n in t?r(e[n],t[n]):n in e?r(void 0,e[n]):void 0}var u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s};return Wr.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||o,r=t(e);Wr.isUndefined(r)&&t!==s||(n[e]=r)})),n},Ff=Of,Hf={};["object","boolean","number","function","string","symbol"].forEach((function(t,n){Hf[t]=function(r){return e(r)===t||"a"+(n<1?"n ":" ")+t}}));var qf={};Hf.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Ff+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,o,i){if(!1===e)throw new Error(r(o," has been removed"+(t?" in "+t:"")));return t&&!qf[o]&&(qf[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};var Bf={assertOptions:function(t,n,r){if("object"!==e(t))throw new TypeError("options must be an object");for(var o=Object.keys(t),i=o.length;i-- >0;){var a=o[i],s=n[a];if(s){var u=t[a],c=void 0===u||s(u,a,t);if(!0!==c)throw new TypeError("option "+a+" must be "+c)}else if(!0!==r)throw Error("Unknown option "+a)}},validators:Hf},zf=Bf.validators;function Zf(e){this.defaults=e,this.interceptors={request:new Jr,response:new Jr}}Zf.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=Uf(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var n=t.transitional;void 0!==n&&Bf.assertOptions(n,{silentJSONParsing:zf.transitional(zf.boolean),forcedJSONParsing:zf.transitional(zf.boolean),clarifyTimeoutError:zf.transitional(zf.boolean)},!1);var r=[],o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));var i,a=[];if(this.interceptors.response.forEach((function(e){a.push(e.fulfilled,e.rejected)})),!o){var s=[Mf,void 0];for(Array.prototype.unshift.apply(s,r),s=s.concat(a),i=Promise.resolve(t);s.length;)i=i.then(s.shift(),s.shift());return i}for(var u=t;r.length;){var c=r.shift(),l=r.shift();try{u=c(u)}catch(e){l(e);break}}try{i=Mf(u)}catch(e){return Promise.reject(e)}for(;a.length;)i=i.then(a.shift(),a.shift());return i},Zf.prototype.getUri=function(e){return e=Uf(this.defaults,e),Yr(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Wr.forEach(["delete","get","head","options"],(function(e){Zf.prototype[e]=function(t,n){return this.request(Uf(n||{},{method:e,url:t,data:(n||{}).data}))}})),Wr.forEach(["post","put","patch"],(function(e){Zf.prototype[e]=function(t,n,r){return this.request(Uf(r||{},{method:e,url:t,data:n}))}}));var Vf=Zf;function Wf(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0},transformResponse:[function(e,t){var n=e;return void 0!==t&&"string"==typeof e&&t["content-type"]&&t["content-type"].startsWith("application/json")&&(n=JSON.parse(e)),n}]},!0!==O&&(g.timeout=1e3*p.connectionTimeoutSeconds),h&&0!==Object.keys(h).length&&(g.params=h),p.sendApiKeyAsQueryParam&&(g.params=g.params||{},g.params["x-typesense-api-key"]=p.apiKey),d&&("string"==typeof d&&0!==d.length||"object"===e(d)&&0!==Object.keys(d).length)&&(g.data=d),y&&(w=a.default.CancelToken,E=w.source(),_=function(){return E.cancel()},y.addEventListener("abort",_),g.cancelToken=E.token),[4,(0,a.default)(g)];case 2:if((S=o.sent()).status>=1&&S.status<=499&&p.setNodeHealthcheck(v,u),p.logger.debug("Request #".concat(r,": Request to Node ").concat(v.index," was made. Response Code was ").concat(S.status,".")),S.status>=200&&S.status<300)return[2,{value:Promise.resolve(S.data)}];if(S.status<500)return[2,{value:Promise.reject(p.customErrorForResponse(S,null===(s=S.data)||void 0===s?void 0:s.message))}];throw p.customErrorForResponse(S,null===(c=S.data)||void 0===c?void 0:c.message);case 3:return x=o.sent(),p.setNodeHealthcheck(v,false),i=x,p.logger.warn("Request #".concat(r,": Request to Node ").concat(v.index,' failed due to "').concat(x.code," ").concat(x.message).concat(null==x.response?"":" - "+JSON.stringify(null===(l=x.response)||void 0===l?void 0:l.data),'"')),p.logger.warn("Request #".concat(r,": Sleeping for ").concat(p.retryIntervalSeconds,"s and then retrying request...")),[4,p.timer(p.retryIntervalSeconds)];case 4:return o.sent(),[3,6];case 5:return y&&_&&y.removeEventListener("abort",_),[7];case 6:return[2]}}))},p=this,v=1,g.label=1;case 1:return v<=this.numRetriesPerRequest+1?[5,f(v)]:[3,4];case 2:if("object"===e(_=g.sent()))return[2,_.value];g.label=3;case 3:return v++,[3,1];case 4:return this.logger.debug("Request #".concat(r,": No retries left. Raising last error")),[2,Promise.reject(i)]}}))}))},t.prototype.getNextNode=function(e){if(void 0===e&&(e=0),null!=this.nearestNode){if(this.logger.debug("Request #".concat(e,": Nodes Health: Node ").concat(this.nearestNode.index," is ").concat(!0===this.nearestNode.isHealthy?"Healthy":"Unhealthy")),!0===this.nearestNode.isHealthy||this.nodeDueForHealthcheck(this.nearestNode,e))return this.logger.debug("Request #".concat(e,": Updated current node to Node ").concat(this.nearestNode.index)),this.nearestNode;this.logger.debug("Request #".concat(e,": Falling back to individual nodes"))}this.logger.debug("Request #".concat(e,": Nodes Health: ").concat(this.nodes.map((function(e){return"Node ".concat(e.index," is ").concat(!0===e.isHealthy?"Healthy":"Unhealthy")})).join(" || ")));for(var t=this.nodes[0],n=0;n<=this.nodes.length;n++)if(this.currentNodeIndex=(this.currentNodeIndex+1)%this.nodes.length,!0===(t=this.nodes[this.currentNodeIndex]).isHealthy||this.nodeDueForHealthcheck(t,e))return this.logger.debug("Request #".concat(e,": Updated current node to Node ").concat(t.index)),t;return this.logger.debug("Request #".concat(e,": No healthy nodes were found. Returning the next node, Node ").concat(t.index)),t},t.prototype.nodeDueForHealthcheck=function(e,t){void 0===t&&(t=0);var n=Date.now()-e.lastAccessTimestamp>1e3*this.healthcheckIntervalSeconds;return n&&this.logger.debug("Request #".concat(t,": Node ").concat(e.index," has exceeded healtcheckIntervalSeconds of ").concat(this.healthcheckIntervalSeconds,". Adding it back into rotation.")),n},t.prototype.initializeMetadataForNodes=function(){var e=this;null!=this.nearestNode&&(this.nearestNode.index="nearestNode",this.setNodeHealthcheck(this.nearestNode,u)),this.nodes.forEach((function(t,n){t.index=n,e.setNodeHealthcheck(t,u)}))},t.prototype.setNodeHealthcheck=function(e,t){e.isHealthy=t,e.lastAccessTimestamp=Date.now()},t.prototype.uriFor=function(e,t){return null!=t.url?"".concat(t.url).concat(e):"".concat(t.protocol,"://").concat(t.host,":").concat(t.port).concat(t.path).concat(e)},t.prototype.defaultHeaders=function(){var e={};return this.sendApiKeyAsQueryParam||(e["X-TYPESENSE-API-KEY"]=this.apiKey),e["Content-Type"]="application/json",e},t.prototype.timer=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,new Promise((function(t){return setTimeout(t,1e3*e)}))]}))}))},t.prototype.customErrorForResponse=function(e,t){var n="Request failed with HTTP code ".concat(e.status);"string"==typeof t&&""!==t.trim()&&(n+=" | Server said: ".concat(t));var r=new s.default(n);return(r=400===e.status?new Nr.RequestMalformed(n):401===e.status?new Nr.RequestUnauthorized(n):404===e.status?new Nr.ObjectNotFound(n):409===e.status?new Nr.ObjectAlreadyExists(n):422===e.status?new Nr.ObjectUnprocessable(n):e.status>=500&&e.status<=599?new Nr.ServerError(n):new Nr.HTTPError(n)).httpStatus=e.status,r},t}();n.default=c}));De(Xf);var Qf=Me((function(e,t){var n=Ne&&Ne.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},r=Ne&&Ne.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]c&&(m=this.responseCache.keys().next().value,this.responseCache.delete(m)),this.responsePromiseCache.size>c&&(m=this.responsePromiseCache.keys().next().value,this.responsePromiseCache.delete(m)),[2,v]}}))}))},e}();t.default=i}));De(eh);var th=Me((function(e,t){var n=Ne&&Ne.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},r=Ne&&Ne.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)throw new Nr.ImportError("".concat(o.length-a.length," documents imported successfully, ").concat(a.length," documents failed during import. Use `error.importResults` from the raised exception to get a detailed error reason for each document."),o);return[2,o]}return[2,r]}}))}))},t.prototype.export=function(e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this.apiCall.get(this.endpointPath("export"),e)]}))}))},t.prototype.exportStream=function(e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this.apiCall.get(this.endpointPath("export"),e,{responseType:"stream"})]}))}))},t}(th.SearchOnlyDocuments);t.default=a}));De(nh);var rh=Me((function(e,t){var n=Ne&&Ne.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},r=Ne&&Ne.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]2e3&&(console.warn("[typesense] API Key is longer than 2000 characters which is over the allowed limit, so disabling sending it as a query parameter."),e.sendApiKeyAsQueryParam=!1),this.configuration=new r.default(e),this.apiCall=new o.default(this.configuration),this.multiSearch=new i.default(this.apiCall,this.configuration,!0),this.individualCollections={}}return e.prototype.clearCache=function(){this.multiSearch.clearCache(),Object.entries(this.individualCollections).forEach((function(e){e[0];e[1].documents().clearCache()}))},e.prototype.collections=function(e){if(e)return void 0===this.individualCollections[e]&&(this.individualCollections[e]=new xh.SearchOnlyCollection(e,this.apiCall,this.configuration)),this.individualCollections[e];throw new Error("Typesense.SearchClient only supports search operations, so the collectionName that needs to be searched must be specified. Use Typesense.Client if you need to access the collection object.")},e}();t.default=a}));De(kh);var Ch=Me((function(e,t){var n=Ne&&Ne.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=Ne&&Ne.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=Ne&&Ne.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&n(t,e,o);return r(t,e),t},i=Ne&&Ne.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Errors=t.SearchClient=t.Client=void 0;var a=i(Sh);t.Client=a.default;var s=i(kh);t.SearchClient=s.default;var u=o(Nr);t.Errors=u,t.default={Client:a.default,SearchClient:s.default,Errors:u}}));De(Ch);Ch.Errors;var Rh=Ch.SearchClient,Ph=(Ch.Client,Me((function(e){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports})));De(Ph);var jh=Me((function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports}));De(jh);var Ah=Me((function(e){function t(e,t){for(var n=0;n","g"),t||"").replace(new RegExp("","g"),n||"")},_adaptNumberOfPages:function(){var e=this.typesenseResponse.found/this.typesenseResponse.request_params.per_page;return Number.isFinite(e)?Math.ceil(e):1}};t.utils=n}));De(Th);Th.utils;var Ih=Me((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.SearchResponseAdapter=void 0;var n=Ph(Ke),r=Ph(Ve),o=Ph(Kn),i=Ph(Je),a=Ph(jh),s=Ph(Ah);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:[];(0,a.default)(this,e),this.typesenseResponse=t,this.instantsearchRequest=n,this.configuration=r,this.allTypesenseResponses=o}return(0,s.default)(e,[{key:"_adaptGroupedHits",value:function(e){var t=this,n=[];return n=e.map((function(e){var n=t._adaptHits(e.hits);return n.forEach((function(t){t.group_key=t._group_key=e.group_key,e.found&&(t._group_found=e.found)})),n})),n=this.configuration.flattenGroupedHits?n.flat():n.map((function(e){return c(c({},e[0]),{},{_grouped_hits:e})}))}},{key:"_adaptHits",value:function(e){var t=this;return e.map((function(e){var n=c({},e.document);n.objectID=e.document.id,n._snippetResult=t._adaptHighlightResult(e,"snippet"),n._highlightResult=t._adaptHighlightResult(e,"value"),n._rawTypesenseHit=e,["text_match","geo_distance_meters","curated","text_match_info","hybrid_search_info","vector_distance"].forEach((function(t){Object.keys(e).includes(t)&&!Object.keys(n).includes(t)&&(n[t]=e[t])}));var r=n[t.configuration.geoLocationField];return r&&(n._geoloc={lat:r[0],lng:r[1]}),n}))}},{key:"_adaptHighlightResult",value:function(e,t){var n={};return null!=e.highlight&&this.isHighlightPost0240RCN32Format(e.highlight)?this.adaptHighlightObject(e,n,t):this.adaptHighlightsArray(e,n,t),n}},{key:"isHighlightPost0240RCN32Format",value:function(e){return null==e.full&&null==e.snippet}},{key:"adaptHighlightsArray",value:function(e,t,a){var s=this;Object.assign.apply(Object,[t].concat((0,o.default)(Object.entries(e.document).map((function(e){var t=(0,r.default)(e,2),n=t[0],o=t[1];return(0,i.default)({},n,{value:o,matchLevel:"none",matchedWords:[]})}))))),e.highlights.forEach((function(e){t[e.field]={value:e[a]||e["".concat(a,"s")],matchLevel:"full",matchedWords:e.matched_tokens},e.indices&&(t[e.field].matchedIndices=e.indices)})),Object.entries(t).forEach((function(o){var i=(0,r.default)(o,2),u=i[0],c=i[1],l=u,f=c.value,h=c.matchLevel,p=c.matchedWords,d=c.matchedIndices;null==f?t[l]=s._adaptHighlightNullValue():Array.isArray(f)?(t[l]=[],e.document[l].forEach((function(e,r){d&&d.includes(r)?t[l].push({value:s._adaptHighlightTag("".concat(f[d.indexOf(r)]),s.instantsearchRequest.params.highlightPreTag,s.instantsearchRequest.params.highlightPostTag),matchLevel:h,matchedWords:p[r]}):"object"===(0,n.default)(e)?t[l].push(s._adaptHighlightInObjectValue(e,{},a)):t[l].push({value:"".concat(e),matchLevel:"none",matchedWords:[]})}))):"object"===(0,n.default)(f)?t[l]=s._adaptHighlightInObjectValue(f,{},a):t[l].value=s._adaptHighlightTag("".concat(f),s.instantsearchRequest.params.highlightPreTag,s.instantsearchRequest.params.highlightPostTag)}))}},{key:"adaptHighlightObject",value:function(e,t,n){Object.assign(t,this._adaptHighlightInObjectValue(e.document,e.highlight,n))}},{key:"_adaptHighlightInObjectValue",value:function(e,t,a){var s=this;return Object.assign.apply(Object,[{}].concat((0,o.default)(Object.entries(e).map((function(e){var o,u=(0,r.default)(e,2),c=u[0],l=u[1];if(null==l)o=s._adaptHighlightNullValue();else if(Array.isArray(l)){var f;o=s._adaptHighlightInArrayValue(l,null!==(f=null==t?void 0:t[c])&&void 0!==f?f:[],a)}else if("object"===(0,n.default)(l)){var h;o=s._adaptHighlightInObjectValue(l,null!==(h=null==t?void 0:t[c])&&void 0!==h?h:{},a)}else o=s._adaptHighlightInPrimitiveValue(l,null==t?void 0:t[c],a);return(0,i.default)({},c,o)})))))}},{key:"_adaptHighlightInArrayValue",value:function(e,t,r){var o=this;return e.map((function(e,i){var a;if(null==e)a=o._adaptHighlightNullValue();else if(Array.isArray(e)){var s;a=o._adaptHighlightInArrayValue(e,null!==(s=null==t?void 0:t[i])&&void 0!==s?s:[],r)}else if("object"===(0,n.default)(e)){var u;a=o._adaptHighlightInObjectValue(e,null!==(u=null==t?void 0:t[i])&&void 0!==u?u:{},r)}else a=o._adaptHighlightInPrimitiveValue(e,null==t?void 0:t[i],r);return a}))}},{key:"_adaptHighlightInPrimitiveValue",value:function(e,t,n){var r,o;return null!=t?{value:this._adaptHighlightTag("".concat(null!==(r=null!==(o=t[n])&&void 0!==o?o:t.highlight)&&void 0!==r?r:t.snippet),this.instantsearchRequest.params.highlightPreTag,this.instantsearchRequest.params.highlightPostTag),matchLevel:(t.matched_tokens||[]).length>0?"full":"none",matchedWords:t.matched_tokens||[]}:{value:this._adaptHighlightTag("".concat(e),this.instantsearchRequest.params.highlightPreTag,this.instantsearchRequest.params.highlightPostTag),matchLevel:"none",matchedWords:[]}}},{key:"_adaptHighlightNullValue",value:function(){return{value:"",matchLevel:"none",matchedWords:[]}}},{key:"_adaptFacets",value:function(e){var t={};return e.forEach((function(e){Object.assign(t,(0,i.default)({},e.field_name,Object.assign.apply(Object,[{}].concat((0,o.default)(e.counts.map((function(e){return(0,i.default)({},e.value,e.count)})))))))})),t}},{key:"_adaptFacetStats",value:function(e){var t={};return e.forEach((function(e){Object.keys(e.stats).length>0&&Object.assign(t,(0,i.default)({},e.field_name,e.stats))})),t}},{key:"_adaptRenderingContent",value:function(e){var t,n=Object.assign({},this.configuration.renderingContent);return null==(null===(t=n.facetOrdering)||void 0===t||null===(t=t.facets)||void 0===t?void 0:t.order)&&(n.facetOrdering=n.facetOrdering||{},n.facetOrdering.facets=n.facetOrdering.facets||{},n.facetOrdering.facets.order=(0,o.default)(new Set(e.map((function(e){return e.field_name})).concat(this.allTypesenseResponses.map((function(e){return e.facet_counts||[]})).flat().map((function(e){return e.field_name})).filter((function(e){return e})))))),n}},{key:"adapt",value:function(){var e=this._adaptRenderingContent(this.typesenseResponse.facet_counts||[]);return c({hits:this.typesenseResponse.grouped_hits?this._adaptGroupedHits(this.typesenseResponse.grouped_hits):this._adaptHits(this.typesenseResponse.hits),nbHits:this.typesenseResponse.found,page:this.typesenseResponse.page-1,nbPages:this._adaptNumberOfPages(),hitsPerPage:this.typesenseResponse.request_params.per_page,facets:this._adaptFacets(this.typesenseResponse.facet_counts||[]),facets_stats:this._adaptFacetStats(this.typesenseResponse.facet_counts||{}),query:this.typesenseResponse.request_params.q,processingTimeMS:this.typesenseResponse.search_time_ms},Object.keys(e).length>0?{renderingContent:e}:null)}}]),e}();t.SearchResponseAdapter=l,Object.assign(l.prototype,Th.utils)}));De(Ih);var Lh=Ih.SearchResponseAdapter;function Nh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Dh(e){for(var t=1;t",highlightPostTag:""})},{geoLocationField:""}),e.abrupt("return",{results:[a.adapt()]});case 6:case"end":return e.stop()}}),e)}))),function(e){return n.apply(this,arguments)})};return t(o)}),[t,e])}(n,y),B=Le.useRef(yr({key:"__DOCSEARCH_FAVORITE_SEARCHES__".concat(T),limit:10})).current,z=Le.useRef(yr({key:"__DOCSEARCH_RECENT_SEARCHES__".concat(T),limit:4})).current,Z=Le.useCallback((function(e){if(!b){var t="content"===e.type?e.__docsearch_parent:e;t&&-1===B.getAll().findIndex((function(e){return e.objectID===t.objectID}))&&z.add(t)}}),[B,z,b]),V=Le.useMemo((function(){return Pn({id:"docsearch",defaultActiveItemId:0,placeholder:i,openOnFocus:!0,initialState:{query:H,context:{searchSuggestions:[]}},navigator:d,onStateChange:function(e){A(e.state)},getSources:function(e){var n=e.query,o=e.state,i=e.setContext,a=e.setStatus;return n?q.search([Fh({collection:t,q:n,query_by:"hierarchy.lvl0,hierarchy.lvl1,hierarchy.lvl2,hierarchy.lvl3,hierarchy.lvl4,hierarchy.lvl5,hierarchy.lvl6,content",include_fields:"hierarchy.lvl0,hierarchy.lvl1,hierarchy.lvl2,hierarchy.lvl3,hierarchy.lvl4,hierarchy.lvl5,hierarchy.lvl6,content,anchor,url,type,id",highlight_full_fields:"hierarchy.lvl0,hierarchy.lvl1,hierarchy.lvl2,hierarchy.lvl3,hierarchy.lvl4,hierarchy.lvl5,hierarchy.lvl6,content",group_by:"url",group_limit:3,sort_by:"item_priority:desc",snippet_threshold:8,highlight_affix_num_tokens:4},r)]).catch((function(e){throw"RetryError"===e.name&&a("error"),e})).then((function(e){var t=e.results[0],n=t.hits,r=t.nbHits,a=rr(n,(function(e){return ur(e)}));return o.context.searchSuggestions.length0&&(Y(),M.current&&M.current.focus())}),[H,Y]),Le.useEffect((function(){function e(){if(L.current){var e=.01*window.innerHeight;L.current.style.setProperty("--docsearch-vh","".concat(e,"px"))}}return e(),window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),Le.createElement("div",Fe({ref:I},K({"aria-expanded":!0}),{className:["DocSearch","DocSearch-Container","stalled"===j.status&&"DocSearch-Container--Stalled","error"===j.status&&"DocSearch-Container--Errored"].filter(Boolean).join(" "),role:"button",tabIndex:0,onMouseDown:function(e){e.target===e.currentTarget&&s()}}),Le.createElement("div",{className:"DocSearch-Modal",ref:L},Le.createElement("header",{className:"DocSearch-SearchBar",ref:N},Le.createElement(vr,Fe({},V,{state:j,autoFocus:0===H.length,inputRef:M,isFromSelection:Boolean(H)&&H===F,translations:k,onClose:s}))),Le.createElement("div",{className:"DocSearch-Dropdown nc-scrollbar-md",ref:D},Le.createElement(pr,Fe({},V,{indexName:T,state:j,hitComponent:f,resultsFooterComponent:p,disableUserPersonalization:b,recentSearches:z,favoriteSearches:B,inputRef:M,translations:C,getMissingResultsUrl:x,onItemClick:function(e){Z(e),s()}}))),Le.createElement("footer",{className:"DocSearch-Footer"},Le.createElement(An,null))))}function qh(e){var t,n=Le.useState(!1),r=We(n,2),o=r[0],i=r[1],a=Le.useCallback((function(){var e;null!==(e=window)&&void 0!==e&&e.doc_enabled&&i(!0)}),[i]),s=Le.useCallback((function(){i(!1)}),[i]);return J((function(){var e=function(e){var t,n,r;o&&"Escape"===e.key?s():"k"===(null===(t=e.key)||void 0===t?void 0:t.toLocaleLowerCase())&&(e.metaKey||e.ctrlKey)&&o||"l"===(null===(n=e.key)||void 0===n?void 0:n.toLocaleLowerCase())&&(e.metaKey||e.ctrlKey)&&o?(e.preventDefault(),s()):"j"!==(null===(r=e.key)||void 0===r?void 0:r.toLowerCase())||!e.metaKey&&!e.ctrlKey||o||(e.preventDefault(),a())};return document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[o,s,a]),Le.createElement(Le.Fragment,null,o&&ge(Le.createElement(Hh,Fe({},e,{initialScrollY:window.scrollY,placeholder:"Search through our docs",initialQuery:e.initialQuery,translations:null==e||null===(t=e.translations)||void 0===t?void 0:t.modal,onClose:s})),document.body))}return function(e){Ee(Le.createElement(qh,e),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;return"string"==typeof e?t.document.querySelector(e):e}(e.container,e.environment))}})); +//# sourceMappingURL=index.js.map diff --git a/packages/nocodb/src/controllers/command-palette.controller.spec.ts b/packages/nocodb/src/controllers/command-palette.controller.spec.ts new file mode 100644 index 0000000000..9ffdcc8854 --- /dev/null +++ b/packages/nocodb/src/controllers/command-palette.controller.spec.ts @@ -0,0 +1,19 @@ +import { Test } from '@nestjs/testing'; +import { CommandPaletteController } from './command-palette.controller'; +import type { TestingModule } from '@nestjs/testing'; + +describe('CommandPaletteController', () => { + let controller: CommandPaletteController; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + controllers: [CommandPaletteController], + }).compile(); + + controller = module.get(CommandPaletteController); + }); + + it('should be defined', () => { + expect(controller).toBeDefined(); + }); +}); diff --git a/packages/nocodb/src/controllers/command-palette.controller.ts b/packages/nocodb/src/controllers/command-palette.controller.ts new file mode 100644 index 0000000000..85e41faae6 --- /dev/null +++ b/packages/nocodb/src/controllers/command-palette.controller.ts @@ -0,0 +1,27 @@ +import { Controller, HttpCode, Post, Req, UseGuards } from '@nestjs/common'; +import { Request } from 'express'; +import type { UserType } from 'nocodb-sdk'; +import { GlobalGuard } from '~/guards/global/global.guard'; +import { CommandPaletteService } from '~/services/command-palette.service'; +import { Acl } from '~/middlewares/extract-ids/extract-ids.middleware'; +import { MetaApiLimiterGuard } from '~/guards/meta-api-limiter.guard'; + +@Controller() +@UseGuards(MetaApiLimiterGuard, GlobalGuard) +export class CommandPaletteController { + constructor(private commandPaletteService: CommandPaletteService) {} + + @Post('/api/v1/command_palette') + @Acl('commandPalette', { + scope: 'org', + }) + @HttpCode(200) + async commandPalette(@Req() req: Request) { + const data = this.commandPaletteService.commandPalette({ + user: req?.user as UserType, + body: req.body, + }); + + return data; + } +} diff --git a/packages/nocodb/src/modules/metas/metas.module.ts b/packages/nocodb/src/modules/metas/metas.module.ts index d11e812fea..ed12b16860 100644 --- a/packages/nocodb/src/modules/metas/metas.module.ts +++ b/packages/nocodb/src/modules/metas/metas.module.ts @@ -73,6 +73,8 @@ import { BaseUsersService } from '~/services/base-users/base-users.service'; import { NotificationsService } from '~/services/notifications.service'; import { NotificationsController } from '~/controllers/notifications.controller'; import { NotificationsGateway } from '~/gateways/notifications/notifications.gateway'; +import { CommandPaletteService } from '~/services/command-palette.service'; +import { CommandPaletteController } from '~/controllers/command-palette.controller'; export const metaModuleMetadata = { imports: [ @@ -122,6 +124,7 @@ export const metaModuleMetadata = { SortsController, SharedBasesController, NotificationsController, + CommandPaletteController, ] : []), ], @@ -163,6 +166,7 @@ export const metaModuleMetadata = { BulkDataAliasService, NotificationsService, NotificationsGateway, + CommandPaletteService, ], exports: [ TablesService, diff --git a/packages/nocodb/src/schema/swagger.json b/packages/nocodb/src/schema/swagger.json index 6881c617e3..40dfff3831 100644 --- a/packages/nocodb/src/schema/swagger.json +++ b/packages/nocodb/src/schema/swagger.json @@ -16329,6 +16329,32 @@ ] } }, + "/api/v1/command_palette": { + "parameters": [], + "post": { + "summary": "Get command palette suggestions", + "operationId": "utils-command-palette", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": {} + } + } + } + }, + "tags": [ + "Utils" + ], + "requestBody": { + "content": { + "application/json": {} + } + }, + "description": "Get dynamic command palette suggestions based on scope" + } + }, "/jobs/listen": { "post": { "summary": "Jobs Listen", diff --git a/packages/nocodb/src/services/command-palette.service.spec.ts b/packages/nocodb/src/services/command-palette.service.spec.ts new file mode 100644 index 0000000000..4bce5c3054 --- /dev/null +++ b/packages/nocodb/src/services/command-palette.service.spec.ts @@ -0,0 +1,19 @@ +import { Test } from '@nestjs/testing'; +import { CommandPaletteService } from './command-palette.service'; +import type { TestingModule } from '@nestjs/testing'; + +describe('CommandPaletteService', () => { + let service: CommandPaletteService; + + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [CommandPaletteService], + }).compile(); + + service = module.get(CommandPaletteService); + }); + + it('should be defined', () => { + expect(service).toBeDefined(); + }); +}); diff --git a/packages/nocodb/src/services/command-palette.service.ts b/packages/nocodb/src/services/command-palette.service.ts new file mode 100644 index 0000000000..7bf3ac2585 --- /dev/null +++ b/packages/nocodb/src/services/command-palette.service.ts @@ -0,0 +1,114 @@ +import { Injectable } from '@nestjs/common'; +import { type UserType, ViewTypes } from 'nocodb-sdk'; +import { Base } from '~/models'; +import { TablesService } from '~/services/tables.service'; + +const viewTypeAlias: Record = { + [ViewTypes.GRID]: 'grid', + [ViewTypes.FORM]: 'form', + [ViewTypes.GALLERY]: 'gallery', + [ViewTypes.KANBAN]: 'kanban', + [ViewTypes.MAP]: 'map', +}; + +@Injectable() +export class CommandPaletteService { + constructor(private tablesService: TablesService) {} + + async commandPalette(param: { body: any; user: UserType }) { + const cmdData = []; + try { + const { scope } = param.body; + + if (scope === 'root') { + const bases = await Base.list({ user: param.user }); + + for (const base of bases) { + cmdData.push({ + id: `p-${base.id}`, + title: base.title, + icon: 'project', + section: 'Bases', + scopePayload: { + scope: `p-${base.id}`, + data: { + base_id: base.id, + }, + }, + }); + } + } else if (scope.startsWith('p-')) { + const allBases = []; + + const bases = await Base.list({ user: param.user }); + + allBases.push(...bases); + + const viewList = []; + + for (const base of bases) { + viewList.push( + ...( + (await this.tablesService.xcVisibilityMetaGet( + base.id, + null, + false, + )) as any[] + ).filter((v) => { + return Object.keys(param.user.roles).some( + (role) => param.user.roles[role] && !v.disabled[role], + ); + }), + ); + } + + const tableList = []; + const vwList = []; + + for (const b of allBases) { + cmdData.push({ + id: `p-${b.id}`, + title: b.title, + icon: 'project', + section: 'Bases', + }); + } + + for (const v of viewList) { + if (!tableList.find((el) => el.id === `tbl-${v.fk_model_id}`)) { + tableList.push({ + id: `tbl-${v.fk_model_id}`, + title: v._ptn, + parent: `p-${v.base_id}`, + icon: v?.table_meta?.icon || v.ptype, + projectName: bases.find((el) => el.id === v.base_id)?.title, + section: 'Tables', + }); + } + vwList.push({ + id: `vw-${v.id}`, + title: `${v.title}`, + parent: `tbl-${v.fk_model_id}`, + icon: v?.meta?.icon || viewTypeAlias[v.type] || 'table', + projectName: bases.find((el) => el.id === v.base_id)?.title, + section: 'Views', + is_default: v?.is_default, + handler: { + type: 'navigate', + payload: `/nc/${v.base_id}/${v.fk_model_id}/${encodeURIComponent( + v.id, + )}`, + }, + }); + } + + cmdData.push(...tableList); + cmdData.push(...vwList); + } + } catch (e) { + console.log(e); + return []; + } + return cmdData; + } +}