diff --git a/package-lock.json b/package-lock.json index 5dea89f1..0250c59e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,6 +34,7 @@ "@uiw/react-codemirror": "^4.21.20", "@webcontainer/env": "1.1.1", "@wp-playground/blueprints": "0.6.13", + "@wp-playground/wordpress": "0.7.20", "classnames": "^2.3.2", "comlink": "^4.4.1", "compressible": "2.0.18", @@ -18108,6 +18109,15 @@ "resolved": "packages/interactive-code-block", "link": true }, + "node_modules/@wp-playground/wordpress": { + "version": "0.7.20", + "resolved": "https://registry.npmjs.org/@wp-playground/wordpress/-/wordpress-0.7.20.tgz", + "integrity": "sha512-wjli9hwWVP4XlWqCPP1c22eLAAbOlnqp8EjwvJjdOHwaDJ9UtSRgN2574K7gcIkKhHt1Iy7o0MUwc+USYoIVEg==", + "engines": { + "node": ">=18.18.0", + "npm": ">=8.11.0" + } + }, "node_modules/@xtuc/ieee754": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", diff --git a/package.json b/package.json index 88b6fcf5..b9e9120b 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "@uiw/react-codemirror": "^4.21.20", "@webcontainer/env": "1.1.1", "@wp-playground/blueprints": "0.6.13", + "@wp-playground/wordpress": "0.7.20", "classnames": "^2.3.2", "comlink": "^4.4.1", "compressible": "2.0.18", diff --git a/packages/edit-visually-browser-extension/.eslintrc.json b/packages/edit-visually-browser-extension/.eslintrc.json new file mode 100644 index 00000000..79fd7c1d --- /dev/null +++ b/packages/edit-visually-browser-extension/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/packages/edit-visually-browser-extension/README.md b/packages/edit-visually-browser-extension/README.md index ba010baa..c52ecf24 100644 --- a/packages/edit-visually-browser-extension/README.md +++ b/packages/edit-visually-browser-extension/README.md @@ -1,11 +1,3 @@ -## Edit Visually Browser Extension powered by WordPress Playground +# Edit Visually powered by WordPress Playground -This is an experimental browser extension that allows you to edit GitHub issues and other text formats using WordPress blocks in Playground. - -To use it, go to the extensions page in your web browser, load the extension from the `packages/editor-browser-extension` directory, and then navigate to any GitHub issue. Edit it, and you should see a new "Edit in Playground" button in the corner of the editor. Click it to edit the issue in Playground. - -Another use-case here: replying to people. It’s frustrating to keep scrolling between what someone posted and the textarea where I can type, but with this extension we could front-load what they said to the editor, package it as quotes, and it would be easy to break it up and type. - -### Implementation details - -We can't use WordPress Playground client here, because it internally evaluates JavaScript code which seems very difficult to do in browser extensions. Therefore, this extension merely embeds an iframe that handles the client connection, and communicates with Playground via the `postMessage` API. +A Web Extension for editing Markdown (and Trac) content in WordPress. diff --git a/packages/edit-visually-browser-extension/build.sh b/packages/edit-visually-browser-extension/build.sh new file mode 100644 index 00000000..35cdd444 --- /dev/null +++ b/packages/edit-visually-browser-extension/build.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -e + +bun build ./loopback-service-worker/service-worker.ts -e ./src/php_8_0.js > ./loopback-service-worker/service-worker.js +bun build ./loopback-service-worker/index.ts -e ./src/php_8_0.js > ./loopback-service-worker/index.js +bun build ./src/playground-loader.ts -e ./src/php_8_0.js > ./src/playground-loader.js +bun build ./src/sw.ts -e ./src/php_8_0.js > ./src/sw.js +bun build ./src/content-script.ts -e ./src/php_8_0.js > ./src/content-script.js +bun build ./src/wordpress-plugin/script.ts -e ./src/php_8_0.js \ + -e '../blocky-formats/*' > ./src/wordpress-plugin/script.js +cd src +rm blocky-formats.zip +zip -rq blocky-formats.zip blocky-formats +zip -rq ../extension.zip ./ + +echo "Build succesful" \ No newline at end of file diff --git a/packages/edit-visually-browser-extension/content-script.js b/packages/edit-visually-browser-extension/content-script.js deleted file mode 100644 index 31dba5b7..00000000 --- a/packages/edit-visually-browser-extension/content-script.js +++ /dev/null @@ -1,413 +0,0 @@ -function makePlaygroundBlueprint(initialValue, initialFormat) { - return { - login: true, - landingPage: '/wp-admin/post-new.php?post_type=post', - preferredVersions: { - wp: 'nightly', - php: '8.0', - }, - steps: [ - { - step: 'mkdir', - path: '/wordpress/wp-content/plugins/playground-editor', - }, - { - step: 'installPlugin', - pluginZipFile: { - resource: 'url', - url: 'https://github-proxy.com/proxy/?repo=dmsnell/blocky-formats', - }, - options: { - activate: false, - }, - }, - { - step: 'mv', - fromPath: '/wordpress/wp-content/plugins/blocky-formats-trunk', - toPath: '/wordpress/wp-content/plugins/blocky-formats', - }, - { - step: 'activatePlugin', - pluginPath: 'blocky-formats/blocky-formats.php', - }, - { - step: 'writeFile', - path: '/wordpress/wp-content/plugins/playground-editor/script.js', - data: ` - - function waitForDOMContentLoaded() { - return new Promise((resolve) => { - if ( - document.readyState === 'complete' || - document.readyState === 'interactive' - ) { - resolve(); - } else { - document.addEventListener('DOMContentLoaded', resolve); - } - }); - } - - await import('../blocky-formats/vendor/commonmark.min.js'); - const { markdownToBlocks, blocks2markdown } = await import('../blocky-formats/src/markdown.js'); - const formatConverters = { - markdown: { - toBlocks: markdownToBlocks, - fromBlocks: blocks2markdown - } - }; - - function populateEditorWithFormattedText(text, format) { - if(!(format in formatConverters)) { - throw new Error('Unsupported format'); - } - - const createBlocks = blocks => blocks.map(block => wp.blocks.createBlock(block.name, block.attributes, createBlocks(block.innerBlocks))); - const rawBlocks = formatConverters[format].toBlocks(text); - - window.wp.data - .dispatch('core/block-editor') - .resetBlocks(createBlocks(rawBlocks)) - } - - function pushEditorContentsToParent(format) { - const blocks = wp.data.select('core/block-editor').getBlocks(); - window.parent.postMessage({ - command: 'playgroundEditorTextChanged', - format: format, - text: formatConverters[format].fromBlocks(blocks), - type: 'relay' - }, '*'); - } - - // Accept commands from the parent window - window.addEventListener('message', (event) => { - if(typeof event.data !== 'object') { - return; - } - - const { command, format, text } = event.data; - lastKnownFormat = format; - - if(command === 'setEditorContent') { - populateEditorWithFormattedText(text, format); - } else if(command === 'getEditorContent') { - const blocks = wp.data.select('core/block-editor').getBlocks(); - window.parent.postMessage({ - command: 'playgroundEditorTextChanged', - format: format, - text: formatConverters[format].fromBlocks(blocks), - type: 'relay' - }, '*'); - } - }); - - // Populate the editor with the initial value - let lastKnownFormat = ${JSON.stringify(initialFormat)}; - waitForDOMContentLoaded().then(() => { - // @TODO: Don't do timeout. - // Instead, populate the editor immediately after it's ready. - setTimeout(() => { - populateEditorWithFormattedText( - ${JSON.stringify(initialValue)}, - lastKnownFormat - ); - - // const debouncedPushEditorContents = debounce(pushEditorContentsToParent, 600); - // let previousBlocks = undefined; - // let subscribeInitialized = false; - // wp.data.subscribe(() => { - // if(previousBlocks === undefined) { - // previousBlocks = wp.data.select('core/block-editor').getBlocks(); - // return; - // } - // const currentBlocks = wp.data.select('core/block-editor').getBlocks(); - // if (previousBlocks !== currentBlocks) { - // debouncedPushEditorContents(lastKnownFormat); - // previousBlocks = currentBlocks; - // } - // }); - }, 500) - - // Experiment with sending the updated value back to the parent window - // when typing. Debounce by 600ms. - function debounce(func, wait) { - let timeout; - return function(...args) { - const context = this; - clearTimeout(timeout); - timeout = setTimeout(() => func.apply(context, args), wait); - }; - } - }); - `, - }, - { - step: 'writeFile', - path: '/wordpress/wp-content/plugins/playground-editor/index.php', - data: `'.'<'.'/script>'; - } - return $tag; - }, 10, 3); - `, - }, - { - step: 'activatePlugin', - pluginPath: 'playground-editor/index.php', - }, - ], - }; -} - -class PlaygroundEditorComponent extends HTMLElement { - constructor() { - super(); - const shadow = this.attachShadow({ mode: 'open' }); - shadow.innerHTML = ``; - const iframe = shadow.querySelector('iframe'); - iframe.style.width = `100%`; - iframe.style.height = `100%`; - iframe.style.border = '1px solid #000'; - } - - static get observedAttributes() { - return ['format', 'value']; - } - - _value = ''; - get value() { - return this._value; - } - set value(newValue) { - this._value = newValue; - this.setRemoteValue(newValue); - } - setAttribute(name, value) { - super.setAttribute(name, value); - console.log('setAttribute(', name, ',', value, ')'); - } - - connectedCallback() { - const initialValue = this.getAttribute('value'); - const initialFormat = this.getAttribute('format'); - - this.shadowRoot.querySelector('iframe').src = - 'https://playground.wordpress.net/?mode=seamless#' + - JSON.stringify( - makePlaygroundBlueprint(initialValue, initialFormat) - ); - - window.addEventListener('message', (event) => { - console.log('message', event.data); - if (typeof event.data !== 'object') { - return; - } - const { command, format, text } = event.data; - if (command === 'playgroundEditorTextChanged') { - this.dispatchEvent( - new CustomEvent('change', { - detail: { - format, - text, - }, - }) - ); - } - }); - } - - async getRemoteValue() { - return new Promise((resolve) => { - this.addEventListener('change', (event) => { - resolve(event.detail); - }); - this.shadowRoot.querySelector('iframe').contentWindow.postMessage( - { - command: 'getEditorContent', - format: this.getAttribute('format'), - type: 'relay', - }, - '*' - ); - }); - } - - setRemoteValue(value) { - const message = { - command: 'playgroundEditorTextChanged', - format: this.getAttribute('format'), - text: this.value, - type: 'relay', - }; - this.shadowRoot - .querySelector('iframe') - ?.contentWindow?.postMessage(message, '*'); - } - - attributeChangedCallback(name, oldValue, newValue) { - if (name === 'value') { - this.value = newValue; - } - } -} - -customElements.define('playground-editor', PlaygroundEditorComponent); - -// Function to wait until DOM is fully loaded -function waitForDOMContentLoaded() { - return new Promise((resolve) => { - if ( - document.readyState === 'complete' || - document.readyState === 'interactive' - ) { - resolve(); - } else { - document.addEventListener('DOMContentLoaded', resolve); - } - }); -} - -function activatePlaygroundEditor(element = undefined) { - element = - element ?? - document.activeElement.closest('textarea, [contenteditable]'); - if (!element) { - return; - } - - if (element.tagName === 'TEXTAREA') { - showPlaygroundDialog({ - value: element.value, - format: 'markdown', // @TODO dynamic - onClose: ({ text, format }) => { - element.value = text; - }, - }); - } else { - showPlaygroundDialog({ - value: element.innerHTML, - format: 'markdown', // @TODO dynamic - onClose: ({ text, format }) => { - element.innerHTML = text; - }, - }); - } -} - -// Function to show the Playground modal -function showPlaygroundDialog({ - value, - format = 'markdown', - onChange = () => {}, - onClose = () => {}, -}) { - // Create modal element - const modal = document.createElement('dialog'); - modal.style.width = '80%'; - modal.style.height = '80%'; - modal.style.border = 'none'; - - const editor = new PlaygroundEditorComponent(); - editor.setAttribute('value', value); - editor.setAttribute('format', format); - editor.addEventListener('change', (event) => { - console.log({ value }); - // onChange(event.target.getRemoteValue); - }); - - // Append iframe to modal - modal.appendChild(editor); - document.body.appendChild(modal); - modal.showModal(); - - // Close modal when clicking outside of it - modal.addEventListener('click', async (event) => { - if (event.target === modal) { - const value = await Promise.race([ - editor.getRemoteValue(), - new Promise((resolve) => setTimeout(resolve, 500)), - ]); - modal.close(); - modal.remove(); - onClose(value); - } - }); -} - -document.addEventListener('keydown', (event) => { - if (event.ctrlKey && event.shiftKey && event.key === 'O') { - activatePlaygroundEditor(); - } -}); - -// ---- Add Edit in Playground button ---- - -(function () { - function createEditButton() { - const button = document.createElement('button'); - button.textContent = 'Edit in Playground'; - button.className = 'edit-btn'; - button.style.position = 'absolute'; - button.style.display = 'none'; - button.style.padding = '5px 10px'; - button.style.backgroundColor = '#007bff'; - button.style.color = 'white'; - button.style.border = 'none'; - button.style.cursor = 'pointer'; - button.addEventListener('mousedown', (event) => { - event.preventDefault(); - event.stopPropagation(); - activatePlaygroundEditor(); - }); - return button; - } - - function showButton(element, button) { - const rect = element.getBoundingClientRect(); - button.style.display = 'block'; - button.style.top = `${window.scrollY + rect.top}px`; - button.style.left = `${ - window.scrollX + rect.right - button.offsetWidth - }px`; - } - - function hideButton(button) { - button.style.display = 'none'; - } - - const button = createEditButton(); - document.body.appendChild(button); - - document.body.addEventListener('focusin', (event) => { - const element = event.target; - if (element.tagName === 'TEXTAREA' || element.isContentEditable) { - showButton(element, button); - } - }); - - document.body.addEventListener('focusout', () => { - hideButton(button); - }); -})(); diff --git a/packages/edit-visually-browser-extension/dist/edit-visually.crx b/packages/edit-visually-browser-extension/dist/edit-visually.crx new file mode 100644 index 00000000..68465577 Binary files /dev/null and b/packages/edit-visually-browser-extension/dist/edit-visually.crx differ diff --git a/packages/edit-visually-browser-extension/extension.zip b/packages/edit-visually-browser-extension/extension.zip new file mode 100644 index 00000000..6d432f63 Binary files /dev/null and b/packages/edit-visually-browser-extension/extension.zip differ diff --git a/packages/edit-visually-browser-extension/jest.config.ts b/packages/edit-visually-browser-extension/jest.config.ts new file mode 100644 index 00000000..1fb6ef56 --- /dev/null +++ b/packages/edit-visually-browser-extension/jest.config.ts @@ -0,0 +1,13 @@ +/* eslint-disable */ +export default { + displayName: 'nx-extensions', + preset: '../../../jest.preset.js', + transform: { + '^.+\\.[tj]s$': [ + 'ts-jest', + { tsconfig: '/tsconfig.spec.json' }, + ], + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../../coverage/packages/nx-extensions', +}; diff --git a/packages/edit-visually-browser-extension/loopback-service-worker/README.md b/packages/edit-visually-browser-extension/loopback-service-worker/README.md new file mode 100644 index 00000000..da44e8ab --- /dev/null +++ b/packages/edit-visually-browser-extension/loopback-service-worker/README.md @@ -0,0 +1,9 @@ +## Loopback Service Worker + +This service worker is used to handle requests in the browser extension. Every time it captures a `fetch` event, it posts a message to the parent window and awaits a response. + +This worker is hosted on a separate URL to avoid intertwining with WordPress Playground service worker: + +https://playground-editor-extension.pages.dev/service-worker.js + +This is only required because Google Chrome Manifest v3 makes it extremely difficult to serve Playground from the extension itself – there's a lot of restrictions on how the extension is allowed to interact with websites. This is a workaround that provides us an HTTP context where these restrictions are relaxed. diff --git a/packages/edit-visually-browser-extension/loopback-service-worker/index.js b/packages/edit-visually-browser-extension/loopback-service-worker/index.js new file mode 100644 index 00000000..d3628140 --- /dev/null +++ b/packages/edit-visually-browser-extension/loopback-service-worker/index.js @@ -0,0 +1,78 @@ +// ../../php-wasm/web-service-worker/src/messaging.ts +function postMessageExpectReply(target, message, ...postMessageArgs) { + const requestId = getNextRequestId(); + target.postMessage( + { + ...message, + requestId, + }, + ...postMessageArgs + ); + return requestId; +} +function getNextRequestId() { + return ++lastRequestId; +} +function awaitReply( + messageTarget, + requestId, + timeout = DEFAULT_RESPONSE_TIMEOUT +) { + return new Promise((resolve, reject) => { + const responseHandler = (event) => { + if ( + event.data.type === 'response' && + event.data.requestId === requestId + ) { + messageTarget.removeEventListener('message', responseHandler); + clearTimeout(failOntimeout); + resolve(event.data.response); + } + }; + const failOntimeout = setTimeout(() => { + reject(new Error('Request timed out')); + messageTarget.removeEventListener('message', responseHandler); + }, timeout); + messageTarget.addEventListener('message', responseHandler); + }); +} +function responseTo(requestId, response) { + return { + type: 'response', + requestId, + response, + }; +} +var DEFAULT_RESPONSE_TIMEOUT = 25000; +var lastRequestId = 0; +// loopback-service-worker/index.ts +var sw = navigator.serviceWorker; +if (!sw) { + if (window.isSecureContext) { + throw new Error('Service workers are not supported in your browser.'); + } else { + throw new Error( + 'WordPress Playground uses service workers and may only work on HTTPS and http://localhost/ sites, but the current site is neither.' + ); + } +} +var registration = await sw.register('/service-worker.js', { + updateViaCache: 'none', +}); +await registration.update(); +navigator.serviceWorker.addEventListener( + 'message', + async function onMessage(event) { + const requestId = postMessageExpectReply( + window.parent, + { + type: 'playground-extension-sw-message', + data: event.data, + }, + '*' + ); + const response = await awaitReply(window, requestId); + event.source.postMessage(responseTo(event.data.requestId, response)); + } +); +sw.startMessages(); diff --git a/packages/edit-visually-browser-extension/loopback-service-worker/index.ts b/packages/edit-visually-browser-extension/loopback-service-worker/index.ts new file mode 100644 index 00000000..e94a2d52 --- /dev/null +++ b/packages/edit-visually-browser-extension/loopback-service-worker/index.ts @@ -0,0 +1,47 @@ +import { + postMessageExpectReply, + responseTo, + awaitReply, +} from '@php-wasm/web-service-worker'; + +const sw = navigator.serviceWorker; +if (!sw) { + /** + * Service workers may only run in secure contexts. + * See https://w3c.github.io/webappsec-secure-contexts/ + */ + if (window.isSecureContext) { + throw new Error('Service workers are not supported in your browser.'); + } else { + throw new Error( + 'WordPress Playground uses service workers and may only work on HTTPS and http://localhost/ sites, but the current site is neither.' + ); + } +} + +const registration = await sw.register('/service-worker.js', { + // Always bypass HTTP cache when fetching the new Service Worker script: + updateViaCache: 'none', +}); + +// Check if there's a new service worker available and, if so, enqueue +// the update: +await registration.update(); + +// Proxy the service worker messages to the web worker: +navigator.serviceWorker.addEventListener( + 'message', + async function onMessage(event) { + const requestId = postMessageExpectReply( + window.parent, + { + type: 'playground-extension-sw-message', + data: event.data, + }, + '*' + ); + const response = await awaitReply(window, requestId); + event.source!.postMessage(responseTo(event.data.requestId, response)); + } +); +sw.startMessages(); diff --git a/packages/edit-visually-browser-extension/loopback-service-worker/register.html b/packages/edit-visually-browser-extension/loopback-service-worker/register.html new file mode 100644 index 00000000..aba1262f --- /dev/null +++ b/packages/edit-visually-browser-extension/loopback-service-worker/register.html @@ -0,0 +1,10 @@ + + + + + Loopback service worker + + + + + diff --git a/packages/edit-visually-browser-extension/loopback-service-worker/service-worker.js b/packages/edit-visually-browser-extension/loopback-service-worker/service-worker.js new file mode 100644 index 00000000..a8e42acc --- /dev/null +++ b/packages/edit-visually-browser-extension/loopback-service-worker/service-worker.js @@ -0,0 +1,168 @@ +// ../../php-wasm/web-service-worker/src/messaging.ts +function getNextRequestId() { + return ++lastRequestId; +} +function awaitReply( + messageTarget, + requestId, + timeout = DEFAULT_RESPONSE_TIMEOUT +) { + return new Promise((resolve, reject) => { + const responseHandler = (event) => { + if ( + event.data.type === 'response' && + event.data.requestId === requestId + ) { + messageTarget.removeEventListener('message', responseHandler); + clearTimeout(failOntimeout); + resolve(event.data.response); + } + }; + const failOntimeout = setTimeout(() => { + reject(new Error('Request timed out')); + messageTarget.removeEventListener('message', responseHandler); + }, timeout); + messageTarget.addEventListener('message', responseHandler); + }); +} +var DEFAULT_RESPONSE_TIMEOUT = 25000; +var lastRequestId = 0; + +// ../../php-wasm/scopes/src/index.ts +function isURLScoped(url) { + return url.pathname.startsWith(`/scope:`); +} +function getURLScope(url) { + if (isURLScoped(url)) { + return url.pathname.split('/')[1].split(':')[1]; + } + return null; +} +function setURLScope(url, scope) { + let newUrl = new URL(url); + if (isURLScoped(newUrl)) { + if (scope) { + const parts = newUrl.pathname.split('/'); + parts[1] = `scope:${scope}`; + newUrl.pathname = parts.join('/'); + } else { + newUrl = removeURLScope(newUrl); + } + } else if (scope) { + const suffix = newUrl.pathname === '/' ? '' : newUrl.pathname; + newUrl.pathname = `/scope:${scope}${suffix}`; + } + return newUrl; +} +function removeURLScope(url) { + if (!isURLScoped(url)) { + return url; + } + const newUrl = new URL(url); + const parts = newUrl.pathname.split('/'); + newUrl.pathname = '/' + parts.slice(2).join('/'); + return newUrl; +} + +// ../../php-wasm/web-service-worker/src/initialize-service-worker.ts +async function convertFetchEventToPHPRequest(event, options) { + const { requireScope = true } = options || {}; + let url = new URL(event.request.url); + if (requireScope && !isURLScoped(url)) { + try { + const referrerUrl = new URL(event.request.referrer); + url = setURLScope(url, getURLScope(referrerUrl)); + } catch (e) {} + } + const contentType = event.request.headers.get('content-type'); + const body = + event.request.method === 'POST' + ? new Uint8Array(await event.request.clone().arrayBuffer()) + : undefined; + const requestHeaders = {}; + for (const pair of event.request.headers.entries()) { + requestHeaders[pair[0]] = pair[1]; + } + let phpResponse; + try { + const message = { + method: 'request', + args: [ + { + body, + url: url.toString(), + method: event.request.method, + headers: { + ...requestHeaders, + Host: url.host, + 'User-agent': self.navigator.userAgent, + 'Content-type': contentType, + }, + }, + ], + }; + const scope = getURLScope(url); + if (requireScope && scope === null) { + throw new Error( + `The URL ${url.toString()} is not scoped. This should not happen.` + ); + } + const requestId = await broadcastMessageExpectReply(message, scope); + phpResponse = await awaitReply(self, requestId); + delete phpResponse.headers['x-frame-options']; + } catch (e) { + console.error(e, { url: url.toString() }); + throw e; + } + return new Response(phpResponse.bytes, { + headers: phpResponse.headers, + status: phpResponse.httpStatusCode, + }); +} +async function broadcastMessageExpectReply(message, scope) { + const requestId = getNextRequestId(); + for (const client of await self.clients.matchAll({ + includeUncontrolled: true, + })) { + client.postMessage({ + ...message, + scope, + requestId, + }); + } + return requestId; +} +// loopback-service-worker/service-worker.ts +var reservedFiles = [ + '/register', + '/register.html', + '/index', + '/index.js', + '/service-worker.js', + '/service-worker', +]; +self.addEventListener('fetch', (event) => { + const url = new URL(event.request.url); + if (reservedFiles.includes(url.pathname)) { + return; + } + if (url.protocol !== 'http:' && url.protocol !== 'https:') { + return; + } + event.preventDefault(); + if (url.pathname === '/test.html') { + return event.respondWith( + new Response('Service Worker is working!', { + headers: { + 'Content-Type': 'text/html', + 'Access-Control-Allow-Origin': '*', + }, + }) + ); + } + event.respondWith( + convertFetchEventToPHPRequest(event, { + requireScope: false, + }) + ); +}); diff --git a/packages/edit-visually-browser-extension/loopback-service-worker/service-worker.ts b/packages/edit-visually-browser-extension/loopback-service-worker/service-worker.ts new file mode 100644 index 00000000..4fc22157 --- /dev/null +++ b/packages/edit-visually-browser-extension/loopback-service-worker/service-worker.ts @@ -0,0 +1,41 @@ +/// + +import { convertFetchEventToPHPRequest } from '@php-wasm/web-service-worker'; + +const reservedFiles = [ + '/register', + '/register.html', + '/index', + '/index.js', + '/service-worker.js', + '/service-worker', +]; +self.addEventListener('fetch', (event) => { + const url = new URL(event.request.url); + if (reservedFiles.includes(url.pathname)) { + return; + } + + // Filter out requests to extensions assets. + if (url.protocol !== 'http:' && url.protocol !== 'https:') { + return; + } + + event.preventDefault(); + if (url.pathname === '/test.html') { + return event.respondWith( + new Response('Service Worker is working!', { + headers: { + 'Content-Type': 'text/html', + 'Access-Control-Allow-Origin': '*', + }, + }) + ); + } + + event.respondWith( + convertFetchEventToPHPRequest(event, { + requireScope: false, + }) + ); +}); diff --git a/packages/edit-visually-browser-extension/manifest.json b/packages/edit-visually-browser-extension/manifest.json deleted file mode 100644 index c60c3fd2..00000000 --- a/packages/edit-visually-browser-extension/manifest.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/manifest", - "manifest_version": 3, - "name": "Edit Visually powered by WordPress Playground", - "version": "1.1", - "description": "Installs Playground Editor in specific textareas on GitHub and WordPress Trac", - "permissions": ["activeTab", "scripting"], - "host_permissions": [ - "https://playground.wordpress.net/", - "https://github.com/", - "https://meta.trac.wordpress.org/" - ], - "content_scripts": [ - { - "matches": [ - "https://github.com/*", - "https://meta.trac.wordpress.org/*" - ], - "js": ["webcomponents-polyfill.js", "content-script.js"], - "run_at": "document_idle" - } - ] -} diff --git a/packages/edit-visually-browser-extension/package.json b/packages/edit-visually-browser-extension/package.json new file mode 100644 index 00000000..ed4d3469 --- /dev/null +++ b/packages/edit-visually-browser-extension/package.json @@ -0,0 +1,30 @@ +{ + "name": "@wp-playground/web-extension", + "version": "0.7.20", + "description": "WordPress Playground Web Extensionxtension", + "repository": { + "type": "git", + "url": "https://github.com/WordPress/wordpress-playground" + }, + "homepage": "https://developer.wordpress.org/playground", + "author": "The WordPress contributors", + "contributors": [ + { + "name": "Adam Zielinski", + "email": "adam@adamziel.com", + "url": "https://github.com/adamziel" + } + ], + "publishConfig": { + "access": "public", + "directory": "../../../dist/packages/playground/web-extension" + }, + "license": "GPL-2.0-or-later", + "type": "module", + "main": "main.js", + "bin": "wp-playground.js", + "gitHead": "2f8d8f3cea548fbd75111e8659a92f601cddc593", + "dependencies": { + "@wp-playground/wordpress": "^0.7.20" + } +} diff --git a/packages/edit-visually-browser-extension/project.json b/packages/edit-visually-browser-extension/project.json new file mode 100644 index 00000000..ba358db0 --- /dev/null +++ b/packages/edit-visually-browser-extension/project.json @@ -0,0 +1,86 @@ +{ + "name": "playground-web-extension", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/playground/web-extension/src", + "projectType": "library", + "targets": { + "build": { + "executor": "@wp-playground/nx-extensions:package-json", + "options": { + "tsConfig": "packages/playground/web-extension/tsconfig.lib.json", + "outputPath": "dist/packages/playground/web-extension", + "buildTarget": "playground-web-extension:build:bundle:production" + } + }, + "build:bundle": { + "executor": "@nx/vite:build", + "outputs": ["{options.outputPath}"], + "options": { + "main": "dist/packages/playground/web-extension/src/web-extension.js", + "outputPath": "dist/packages/playground/web-extension" + }, + "defaultConfiguration": "production", + "configurations": { + "development": { + "minify": false + }, + "production": { + "minify": true + } + } + }, + "dev": { + "executor": "nx:run-commands", + "options": { + "command": "bun --watch ./packages/playground/web-extension/src/web-extension.ts" + } + }, + "start": { + "executor": "@wp-playground/nx-extensions:built-script", + "options": { + "scriptPath": "dist/packages/playground/web-extension/wp-playground.js" + }, + "dependsOn": ["build"] + }, + "publish": { + "executor": "nx:run-commands", + "options": { + "command": "node tools/scripts/publish.mjs php-wasm-cli {args.ver} {args.tag}" + }, + "dependsOn": ["build"] + }, + "lint": { + "executor": "@nx/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": [ + "packages/playground/web-extension/**/*.ts" + ] + } + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "packages/playground/web-extension/jest.config.ts", + "passWithNoTests": true + }, + "configurations": { + "ci": { + "ci": true, + "codeCoverage": true + } + } + }, + "typecheck": { + "executor": "nx:run-commands", + "options": { + "commands": [ + "tsc -p packages/playground/web-extension/tsconfig.lib.json --noEmit", + "tsc -p packages/playground/web-extension/tsconfig.spec.json --noEmit" + ] + } + } + }, + "tags": ["scope:php-wasm-public"] +} diff --git a/packages/edit-visually-browser-extension/src/README.md b/packages/edit-visually-browser-extension/src/README.md new file mode 100644 index 00000000..ba010baa --- /dev/null +++ b/packages/edit-visually-browser-extension/src/README.md @@ -0,0 +1,11 @@ +## Edit Visually Browser Extension powered by WordPress Playground + +This is an experimental browser extension that allows you to edit GitHub issues and other text formats using WordPress blocks in Playground. + +To use it, go to the extensions page in your web browser, load the extension from the `packages/editor-browser-extension` directory, and then navigate to any GitHub issue. Edit it, and you should see a new "Edit in Playground" button in the corner of the editor. Click it to edit the issue in Playground. + +Another use-case here: replying to people. It’s frustrating to keep scrolling between what someone posted and the textarea where I can type, but with this extension we could front-load what they said to the editor, package it as quotes, and it would be easy to break it up and type. + +### Implementation details + +We can't use WordPress Playground client here, because it internally evaluates JavaScript code which seems very difficult to do in browser extensions. Therefore, this extension merely embeds an iframe that handles the client connection, and communicates with Playground via the `postMessage` API. diff --git a/packages/edit-visually-browser-extension/src/blocky-formats.zip b/packages/edit-visually-browser-extension/src/blocky-formats.zip new file mode 100644 index 00000000..c7b5a3b2 Binary files /dev/null and b/packages/edit-visually-browser-extension/src/blocky-formats.zip differ diff --git a/packages/edit-visually-browser-extension/src/blocky-formats/blocky-formats.php b/packages/edit-visually-browser-extension/src/blocky-formats/blocky-formats.php new file mode 100644 index 00000000..969be6f7 --- /dev/null +++ b/packages/edit-visually-browser-extension/src/blocky-formats/blocky-formats.php @@ -0,0 +1,28 @@ + { + wp.blocks.getBlockTypes().forEach((blockType) => { + if (!supportedBlocks.includes(blockType.name)) { + wp.blocks.unregisterBlockType(blockType.name); + } else if ( + blockType.name === 'core/list-item' || + blockType.name === 'core/quote' + ) { + // Remove restrictions on list item child blocks. + wp.blocks.unregisterBlockType(blockType.name); + const { allowedBlocks, ...newBlockType } = blockType; + wp.blocks.registerBlockType(newBlockType.name, { ...newBlockType }); + } + }); + + const TracExportSidebar = () => + wp.editPost.PluginSidebar({ + name: 'blocky-formats-sidebar', + title: 'Export Post', + icon: 'edit', + children: React.createElement( + 'ul', + {}, + [ + React.createElement( + wp.components.Button, + { + label: 'Import from Markdown', + variant: 'primary', + onClick: () => { + navigator.clipboard + .readText() + .then((markdown) => + window.loadFromMarkdown(markdown) + ); + }, + }, + 'Import from Markdown' + ), + React.createElement( + wp.components.Button, + { + label: 'Export to Markdown', + variant: 'primary', + onClick: async () => { + const markdown = await window.saveToMarkdown(); + + navigator.clipboard.writeText(markdown); + }, + }, + 'Export to Markdown' + ), + React.createElement( + wp.components.Button, + { + label: 'Export to Trac', + variant: 'primary', + onClick: async () => { + const trac = await window.saveToTrac(); + + navigator.clipboard.writeText(trac); + }, + }, + 'Export to Trac' + ), + ].map((e, i) => React.createElement('li', { key: i }, e)) + ), + }); + + wp.plugins.registerPlugin('blocky-formats-sidebar', { + render: TracExportSidebar, + }); +}; + +window.saveToTrac = async () => { + const { blocks2trac } = await import('./trac.js'); + const blocks = wp.data.select('core/block-editor').getBlocks(); + const trac = blocks2trac(blocks); + return trac; +}; + +window.saveToMarkdown = async () => { + await import('../vendor/commonmark.min.js'); + const { blocks2markdown } = await import('./markdown.js'); + const blocks = wp.data.select('core/block-editor').getBlocks(); + const markdown = blocks2markdown(blocks); + console.log(markdown); + return markdown; +}; + +window.loadFromMarkdown = async (input) => { + const { markdownToBlocks } = await import('./markdown.js'); + + const createBlocks = (blocks) => + blocks.map((block) => + wp.blocks.createBlock( + block.name, + block.attributes, + createBlocks(block.innerBlocks) + ) + ); + const blocks = markdownToBlocks(input); + + wp.data.dispatch('core/block-editor').resetBlocks(createBlocks(blocks)); +}; + +setTimeout(go, 1000); diff --git a/packages/edit-visually-browser-extension/src/blocky-formats/src/markdown.js b/packages/edit-visually-browser-extension/src/blocky-formats/src/markdown.js new file mode 100644 index 00000000..7c9d6553 --- /dev/null +++ b/packages/edit-visually-browser-extension/src/blocky-formats/src/markdown.js @@ -0,0 +1,564 @@ +/** + * Convert between Markdown and WordPress Blocks. + * + * Depends on setting the `commonmark` global, an + * exercise left up to the reader. + */ + +/** + * Matches Jekyll-style front-matter at the start of a Markdown document. + * + * @see https://github.com/jekyll/jekyll/blob/1484c6d6a41196dcaa25daca9ed1f8c32083ff10/lib/jekyll/document.rb + * + * @type {RegExp} + */ +const frontMatterPattern = /---\s*\n(.*?)\n?(?:---|\.\.\.)\s*\n/sy; + +const htmlToMarkdown = (html) => { + const node = document.createElement('div'); + node.innerHTML = html; + + node.querySelectorAll('b, strong').forEach( + (fontNode) => (fontNode.innerHTML = `**${fontNode.innerHTML}**`) + ); + + node.querySelectorAll('i, em').forEach( + (fontNode) => (fontNode.innerHTML = `*${fontNode.innerHTML}*`) + ); + + node.querySelectorAll('code').forEach( + (codeNode) => (codeNode.innerHTML = `\`${codeNode.innerHTML}\``) + ); + + node.querySelectorAll('a').forEach( + // @todo Add link title. + (linkNode) => + (linkNode.outerHTML = `[${ + linkNode.innerText + }](${linkNode.getAttribute('href')})`) + ); + + return node.innerText; +}; + +const blockToMarkdown = (state, block) => { + /** + * Convert a number to Roman Numerals. + * + * @cite https://stackoverflow.com/a/9083076/486538 + */ + const romanize = (num) => { + const digits = String(+num).split(''); + const key = [ + '', + 'C', + 'CC', + 'CCC', + 'CD', + 'D', + 'DC', + 'DCC', + 'DCCC', + 'CM', + '', + 'X', + 'XX', + 'XXX', + 'XL', + 'L', + 'LX', + 'LXX', + 'LXXX', + 'XC', + '', + 'I', + 'II', + 'III', + 'IV', + 'V', + 'VI', + 'VII', + 'VIII', + 'IX', + ]; + let roman = ''; + let i = 3; + while (i--) { + roman = (key[+digits.pop() + i * 10] || '') + roman; + } + return Array(+digits.join('') + 1).join('M') + roman; + }; + + /** + * Indents a string for the current depth. + * + * - Leaves blank lines alone. + * + * @param {string} s multi-line content to indent. + */ + const indent = (s) => { + if (0 === state.indent.length) { + return s; + } + + const indent = state.indent.join(''); + + let at = 0; + let last = 0; + let out = ''; + while (at < s.length) { + const nextAt = s.indexOf('\n', at); + + // No more newlines? Return rest of string, indented. + if (-1 === nextAt) { + out += indent + s.slice(at); + break; + } + + // Leave successive newlines without indentation. + if (nextAt === last + 1) { + out += '\n'; + at++; + last = at; + continue; + } + + out += indent + s.slice(at, nextAt + 1); + at = nextAt + 1; + last = at; + } + + return out; + }; + + switch (block.name) { + case 'core/quote': + const content = blocksToMarkdown(state, block.innerBlocks); + // @todo this probably fails on nested quotes - handle that. + return ( + content + .split('\n') + .map((l) => `> ${l}`) + .join('\n') + '\n\n' + ); + + case 'core/code': + const code = htmlToMarkdown(block.attributes.content); + const languageSpec = block.attributes.language || ''; + return `\`\`\`${languageSpec}\n${code}\n\`\`\`\n\n`; + + case 'core/image': + return `![${block.attributes.alt}](${block.attributes.url})`; + + case 'core/heading': + return ( + '#'.repeat(block.attributes.level) + + ' ' + + htmlToMarkdown(block.attributes.content) + + '\n\n' + ); + + case 'core/list': + state.listStyle.push({ + style: block.attributes.ordered + ? block.attributes.type || 'decimal' + : '-', + count: block.attributes.start || 1, + }); + const list = blocksToMarkdown(state, block.innerBlocks); + state.listStyle.pop(); + return `${list}\n\n`; + + case 'core/list-item': + if (0 === state.listStyle.length) { + return ''; + } + + const item = state.listStyle[state.listStyle.length - 1]; + const bullet = (() => { + switch (item.style) { + case '-': + return '-'; + + case 'decimal': + return `${item.count.toString()}.`; + + case 'upper-alpha': { + let count = item.count; + let bullet = ''; + while (count >= 1) { + bullet = + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[(count - 1) % 26] + + bullet; + count /= 26; + } + return `${bullet}.`; + } + + case 'lower-alpha': { + let count = item.count; + let bullet = ''; + while (count >= 1) { + bullet = + 'abcdefghijklmnopqrstuvwxyz'[(count - 1) % 26] + + bullet; + count /= 26; + } + return `${bullet}.`; + } + + case 'upper-roman': + return romanize(item.count) + '.'; + + case 'lower-roman': + return romanize(item.count).toLowerCase(); + + default: + return `${item.count.toString()}.`; + } + })(); + + item.count++; + const bulletIndent = ' '.repeat(bullet.length + 1); + + // This hits sibling items and it shouldn't. + const [firstLine, restLines] = htmlToMarkdown( + block.attributes.content + ).split('\n', 1); + if (0 === block.innerBlocks.length) { + let out = `${state.indent.join('')}${bullet} ${firstLine}`; + state.indent.push(bulletIndent); + if (restLines) { + out += indent(restLines); + } + state.indent.pop(); + return out + '\n'; + } + state.indent.push(bulletIndent); + const innerContent = indent( + `${restLines ? `${restLines}\n` : ''}${blocksToMarkdown( + state, + block.innerBlocks + )}` + ); + state.indent.pop(); + return `${state.indent.join( + '' + )}${bullet} ${firstLine}\n${innerContent}\n`; + + case 'core/paragraph': + return htmlToMarkdown(block.attributes.content) + '\n\n'; + + case 'core/separator': + return '\n---\n\n'; + + default: + console.log(block); + return ''; + } +}; + +/** + * Converts a list of blocks into a Markdown string. + * + * @param {object} state Parser state. + * @param {object[]} blocks Blocks to convert. + * @returns {string} Markdown output. + */ +const blocksToMarkdown = (state, blocks) => { + return blocks.map((block) => blockToMarkdown(state, block)).join(''); +}; + +export const blocks2markdown = (blocks) => { + const state = { + indent: [], + listStyle: [], + }; + + return blocksToMarkdown(state, blocks || []); +}; + +function WpBlocksRenderer(options) { + this.options = options; +} + +const escapeHTML = (s) => + s.replace(/[<&>'"]/g, (m) => { + switch (m[0]) { + case '<': + return '<'; + case '>': + return '>'; + case '&': + return '&'; + case '"': + return '"'; + case "'": + return '''; + } + }); + +function render(ast) { + var blocks = { + name: 'root', + attributes: {}, + innerBlocks: [], + }; + var event, lastNode; + var walker = ast.walker(); + + while ((event = walker.next())) { + lastNode = event.node; + } + + // Walk the blocks + if (lastNode.type !== 'document') { + throw new Error('Expected a document node'); + } + + nodeToBlock(blocks, lastNode.firstChild); + + return blocks.innerBlocks; +} + +const nodeToBlock = (parentBlock, node) => { + const add = (block) => { + parentBlock.innerBlocks.push(block); + }; + + const block = { + name: '', + attributes: {}, + innerBlocks: [], + }; + + let skipChildren = false; + + /** + * @see ../blocks.js + */ + switch (node.type || null) { + // Nothing to store here. It's a container. + case 'document': + // @todo Should this "break" instead? + return; + + case 'image': + // @todo If there's formatting, grab it from the children. + block.name = 'core/image'; + block.attributes.url = node._destination; + if (node._description) { + block.attributes.alt = node._description; + } + if (node._title) { + block.attributes.title = node._title; + } + break; + + case 'list': + block.name = 'core/list'; + block.attributes.ordered = node._listData.type === 'ordered'; + if (node._listData.start && node._listData.start !== 1) { + block.attributes.start = node._listData.start; + } + break; + + case 'block_quote': + block.name = 'core/quote'; + break; + + case 'item': { + // @todo WordPress' list block doesn't support inner blocks. + block.name = 'core/list-item'; + // There's a paragraph wrapping the list content. + let innerNode = node.firstChild; + while (innerNode) { + switch (innerNode.type) { + case 'paragraph': + block.attributes.content = inlineBlocksToHTML( + '', + innerNode.firstChild + ); + break; + + case 'list': + nodeToBlock(block, innerNode); + break; + + default: + console.log(innerNode); + } + + innerNode = innerNode.next; + } + skipChildren = true; + break; + } + + case 'heading': + block.name = 'core/heading'; + // Content forms nodes starting with .firstChild -> .next -> .next + block.attributes.level = node.level; + block.attributes.content = inlineBlocksToHTML('', node.firstChild); + skipChildren = true; + break; + + case 'thematic_break': + block.name = 'core/separator'; + break; + + case 'code_block': + block.name = 'core/code'; + if ('string' === typeof node.info && '' !== node.info) { + block.attributes.language = node.info.replace( + /[ \t\r\n\f].*/, + '' + ); + } + block.attributes.content = node.literal.replace(/\n/g, '
'); + break; + + case 'html_block': + block.name = 'core/html'; + block.attributes.content = node.literal; + break; + + case 'paragraph': + // @todo Handle inline HTML, which should be an HTML block. + if ( + node.firstChild && + node.firstChild.type === 'image' && + !node.firstChild.next + ) { + // @todo If there's formatting, grab it from the children. + const image = node.firstChild; + block.name = 'core/image'; + block.attributes.url = image._destination; + if (image._title && '' !== image._title) { + block.attributes.caption = image._title; + } else if (image.firstChild) { + block.attributes.caption = inlineBlocksToHTML( + '', + image.firstChild + ); + } + if (image._description && '' !== image._description) { + block.attributes.alt = image._description; + } + skipChildren = true; + break; + } + + block.name = 'core/paragraph'; + block.attributes.content = inlineBlocksToHTML('', node.firstChild); + skipChildren = true; + break; + + default: + console.log(node); + } + + add(block); + + if (!skipChildren && node.firstChild) { + nodeToBlock(block, node.firstChild); + } + + if (node.next) { + nodeToBlock(parentBlock, node.next); + } +}; + +const inlineBlocksToHTML = (html, node) => { + if (!node) { + return html; + } + + const add = (s) => (html += s); + const surround = (before, after) => + add(before + inlineBlocksToHTML('', node.firstChild) + after); + + const addTag = (tag, tagAttrs) => { + const attrs = tagAttrs + ? ' ' + + Object.entries(tagAttrs) + .filter(([, value]) => value !== null) + .map(([name, value]) => `${name}="${value}"`) + .join(' ') + : ''; + const isVoid = 'img' === tag; + surround(`<${tag}${attrs}>`, isVoid ? '' : ``); + }; + + switch (node.type) { + case 'code': + add(`${escapeHTML(node.literal)}`); + break; + + case 'emph': + addTag('em'); + break; + + case 'html_inline': + add(escapeHTML(node.literal)); + break; + + case 'image': + // @todo If there's formatting, grab it from the children. + addTag('img', { + src: node._destination, + title: node._title || null, + alt: node._description || null, + }); + break; + + case 'link': + addTag('a', { + href: node._destination, + title: node._title || null, + }); + break; + + case 'softbreak': + add('
'); + break; + + case 'strong': + addTag('strong'); + break; + + case 'text': + add(node.literal); + break; + + default: + console.log(node); + } + + if (node.next) { + return inlineBlocksToHTML(html, node.next); + } + + return html; +}; + +WpBlocksRenderer.prototype = Object.create(commonmark.Renderer.prototype); + +WpBlocksRenderer.prototype.render = render; +WpBlocksRenderer.prototype.esc = (s) => s; + +export const markdownToBlocks = (input) => { + const frontMatterMatch = frontMatterPattern.exec(input); + const foundFrontMatter = null !== frontMatterMatch; + const frontMatter = foundFrontMatter ? frontMatterMatch[1] : null; + const markdownDocument = foundFrontMatter + ? input.slice(frontMatterMatch[0].length) + : input; + frontMatterPattern.lastIndex = 0; + + const parser = new commonmark.Parser(); + const ast = parser.parse(markdownDocument); + const blockRenderer = new WpBlocksRenderer({ sourcepos: true }); + + return blockRenderer.render(ast); +}; diff --git a/packages/edit-visually-browser-extension/src/blocky-formats/src/trac.js b/packages/edit-visually-browser-extension/src/blocky-formats/src/trac.js new file mode 100644 index 00000000..9448d549 --- /dev/null +++ b/packages/edit-visually-browser-extension/src/blocky-formats/src/trac.js @@ -0,0 +1,195 @@ +const htmlToText = (html) => { + const node = document.createElement('div'); + node.innerHTML = html; + + node.querySelectorAll('b, strong').forEach( + (fontNode) => (fontNode.innerHTML = `**${fontNode.innerHTML}**`) + ); + + node.querySelectorAll('i, em').forEach( + (fontNode) => (fontNode.innerHTML = `//${fontNode.innerHTML}//`) + ); + + node.querySelectorAll('code').forEach( + (codeNode) => (codeNode.innerHTML = `\`${codeNode.innerHTML}\``) + ); + + node.querySelectorAll('a').forEach( + (linkNode) => + (linkNode.outerHTML = `[${linkNode.getAttribute('href')} ${ + linkNode.innerText + }]`) + ); + + return node.innerText; +}; + +const blockToTrac = (state, block) => { + /** + * Convert a number to Roman Numerals. + * + * @cite https://stackoverflow.com/a/9083076/486538 + */ + const romanize = (num) => { + const digits = String(+num).split(''); + const key = [ + '', + 'C', + 'CC', + 'CCC', + 'CD', + 'D', + 'DC', + 'DCC', + 'DCCC', + 'CM', + '', + 'X', + 'XX', + 'XXX', + 'XL', + 'L', + 'LX', + 'LXX', + 'LXXX', + 'XC', + '', + 'I', + 'II', + 'III', + 'IV', + 'V', + 'VI', + 'VII', + 'VIII', + 'IX', + ]; + let roman = ''; + let i = 3; + while (i--) { + roman = (key[+digits.pop() + i * 10] || '') + roman; + } + return Array(+digits.join('') + 1).join('M') + roman; + }; + + switch (block.name) { + case 'core/quote': + const content = blocksToTrac(state, block.innerBlocks); + return ( + content + .split(/\n/g) + .map((l) => `> ${l}`) + .join('\n') + '\n\n' + ); + + case 'core/code': + const code = htmlToText(block.attributes.content); + const languageSpec = code.startsWith(' { + switch (item.style) { + case '-': + return '-'; + + case 'decimal': + return `${item.count.toString()}.`; + + case 'upper-alpha': { + let count = item.count; + let bullet = ''; + while (count >= 1) { + bullet = + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[(count - 1) % 26] + + bullet; + count /= 26; + } + return `${bullet}.`; + } + + case 'lower-alpha': { + let count = item.count; + let bullet = ''; + while (count >= 1) { + bullet = + 'abcdefghijklmnopqrstuvwxyz'[(count - 1) % 26] + + bullet; + count /= 26; + } + return `${bullet}.`; + } + + case 'upper-roman': + return romanize(item.count) + '.'; + + case 'lower-roman': + return romanize(item.count).toLowerCase(); + + default: + return `${item.count.toString()}.`; + } + })(); + + item.count++; + + return `${'\t'.repeat(state.indent)}${bullet} ${htmlToText( + block.attributes.content + )}\n`; + + case 'core/paragraph': + if ('undefined' === typeof window.lastContent) { + window.lastContent = block.attributes.content; + } + console.log(window.lastContent); + return htmlToText(block.attributes.content) + '\n\n'; + + case 'core/separator': + return '\n----\n\n'; + + default: + return ''; + } +}; + +const blocksToTrac = (state, blocks) => { + return blocks + .map((block) => blockToTrac(state, block)) + .join('') + .replace(/^[\n\r]+|[\n\r]+$/g, ''); +}; + +export const blocks2trac = (blocks) => { + const state = { + indent: 0, + listStyle: [], + }; + + return blocksToTrac(state, blocks || []); +}; diff --git a/packages/edit-visually-browser-extension/src/blocky-formats/vendor/commonmark.min.js b/packages/edit-visually-browser-extension/src/blocky-formats/vendor/commonmark.min.js new file mode 100644 index 00000000..48f7e67e --- /dev/null +++ b/packages/edit-visually-browser-extension/src/blocky-formats/vendor/commonmark.min.js @@ -0,0 +1,9474 @@ +!(function (e, t) { + 'object' == typeof exports && 'undefined' != typeof module + ? t(exports) + : 'function' == typeof define && define.amd + ? define(['exports'], t) + : t(((e = e || self).commonmark = {})); +})(this, function (e) { + 'use strict'; + function j(e) { + switch (e._type) { + case 'document': + case 'block_quote': + case 'list': + case 'item': + case 'paragraph': + case 'heading': + case 'emph': + case 'strong': + case 'link': + case 'image': + case 'custom_inline': + case 'custom_block': + return !0; + default: + return !1; + } + } + function U(e, t) { + (this.current = e), (this.entering = !0 === t); + } + function M() { + var e, + t = this.current, + r = this.entering; + return null === t + ? null + : ((e = j(t)), + r && e + ? t._firstChild + ? ((this.current = t._firstChild), (this.entering = !0)) + : (this.entering = !1) + : t === this.root + ? (this.current = null) + : null === t._next + ? ((this.current = t._parent), (this.entering = !1)) + : ((this.current = t._next), (this.entering = !0)), + { entering: r, node: t }); + } + function B(e) { + return { current: e, root: e, entering: !0, next: M, resumeAt: U }; + } + var b = function (e, t) { + (this._type = e), + (this._parent = null), + (this._firstChild = null), + (this._lastChild = null), + (this._prev = null), + (this._next = null), + (this._sourcepos = t), + (this._open = !0), + (this._string_content = null), + (this._literal = null), + (this._listData = {}), + (this._info = null), + (this._destination = null), + (this._title = null), + (this._isFenced = !1), + (this._fenceChar = null), + (this._fenceLength = 0), + (this._fenceOffset = null), + (this._level = null), + (this._onEnter = null), + (this._onExit = null); + }, + t = b.prototype, + H = + (Object.defineProperty(t, 'isContainer', { + get: function () { + return j(this); + }, + }), + Object.defineProperty(t, 'type', { + get: function () { + return this._type; + }, + }), + Object.defineProperty(t, 'firstChild', { + get: function () { + return this._firstChild; + }, + }), + Object.defineProperty(t, 'lastChild', { + get: function () { + return this._lastChild; + }, + }), + Object.defineProperty(t, 'next', { + get: function () { + return this._next; + }, + }), + Object.defineProperty(t, 'prev', { + get: function () { + return this._prev; + }, + }), + Object.defineProperty(t, 'parent', { + get: function () { + return this._parent; + }, + }), + Object.defineProperty(t, 'sourcepos', { + get: function () { + return this._sourcepos; + }, + }), + Object.defineProperty(t, 'literal', { + get: function () { + return this._literal; + }, + set: function (e) { + this._literal = e; + }, + }), + Object.defineProperty(t, 'destination', { + get: function () { + return this._destination; + }, + set: function (e) { + this._destination = e; + }, + }), + Object.defineProperty(t, 'title', { + get: function () { + return this._title; + }, + set: function (e) { + this._title = e; + }, + }), + Object.defineProperty(t, 'info', { + get: function () { + return this._info; + }, + set: function (e) { + this._info = e; + }, + }), + Object.defineProperty(t, 'level', { + get: function () { + return this._level; + }, + set: function (e) { + this._level = e; + }, + }), + Object.defineProperty(t, 'listType', { + get: function () { + return this._listData.type; + }, + set: function (e) { + this._listData.type = e; + }, + }), + Object.defineProperty(t, 'listTight', { + get: function () { + return this._listData.tight; + }, + set: function (e) { + this._listData.tight = e; + }, + }), + Object.defineProperty(t, 'listStart', { + get: function () { + return this._listData.start; + }, + set: function (e) { + this._listData.start = e; + }, + }), + Object.defineProperty(t, 'listDelimiter', { + get: function () { + return this._listData.delimiter; + }, + set: function (e) { + this._listData.delimiter = e; + }, + }), + Object.defineProperty(t, 'onEnter', { + get: function () { + return this._onEnter; + }, + set: function (e) { + this._onEnter = e; + }, + }), + Object.defineProperty(t, 'onExit', { + get: function () { + return this._onExit; + }, + set: function (e) { + this._onExit = e; + }, + }), + (b.prototype.appendChild = function (e) { + e.unlink(), + (e._parent = this)._lastChild + ? ((this._lastChild._next = e)._prev = this._lastChild) + : (this._firstChild = e), + (this._lastChild = e); + }), + (b.prototype.prependChild = function (e) { + e.unlink(), + (e._parent = this)._firstChild + ? (((this._firstChild._prev = e)._next = + this._firstChild), + (this._firstChild = e)) + : ((this._firstChild = e), (this._lastChild = e)); + }), + (b.prototype.unlink = function () { + this._prev + ? (this._prev._next = this._next) + : this._parent && (this._parent._firstChild = this._next), + this._next + ? (this._next._prev = this._prev) + : this._parent && + (this._parent._lastChild = this._prev), + (this._parent = null), + (this._next = null), + (this._prev = null); + }), + (b.prototype.insertAfter = function (e) { + e.unlink(), + (e._next = this._next), + e._next && (e._next._prev = e), + (((e._prev = this)._next = e)._parent = this._parent), + e._next || (e._parent._lastChild = e); + }), + (b.prototype.insertBefore = function (e) { + e.unlink(), + (e._prev = this._prev), + e._prev && (e._prev._next = e), + (((e._next = this)._prev = e)._parent = this._parent), + e._prev || (e._parent._firstChild = e); + }), + (b.prototype.walker = function () { + return new B(this); + }), + {}); + function l(e, t, r) { + var n, + o, + i, + a, + s = ''; + for ( + 'string' != typeof t && ((r = t), (t = l.defaultChars)), + void 0 === r && (r = !0), + a = (function (e) { + var t, + r, + n = H[e]; + if (!n) { + for (n = H[e] = [], t = 0; t < 128; t++) + (r = String.fromCharCode(t)), + /^[0-9a-z]$/i.test(r) + ? n.push(r) + : n.push( + '%' + + ( + '0' + + t.toString(16).toUpperCase() + ).slice(-2) + ); + for (t = 0; t < e.length; t++) + n[e.charCodeAt(t)] = e[t]; + } + return n; + })(t), + n = 0, + o = e.length; + n < o; + n++ + ) + (i = e.charCodeAt(n)), + r && + 37 === i && + n + 2 < o && + /^[0-9a-f]{2}$/i.test(e.slice(n + 1, n + 3)) + ? ((s += e.slice(n, n + 3)), (n += 2)) + : i < 128 + ? (s += a[i]) + : 55296 <= i && i <= 57343 + ? 55296 <= i && + i <= 56319 && + n + 1 < o && + 56320 <= (i = e.charCodeAt(n + 1)) && + i <= 57343 + ? ((s += encodeURIComponent(e[n] + e[n + 1])), n++) + : (s += '%EF%BF%BD') + : (s += encodeURIComponent(e[n])); + return s; + } + (l.defaultChars = ";/?:@&=+$,-_.!~*'()#"), (l.componentChars = "-_.!~*'()"); + var I = l, + p = + 'undefined' != typeof globalThis + ? globalThis + : 'undefined' != typeof window + ? window + : 'undefined' != typeof global + ? global + : 'undefined' != typeof self + ? self + : {}; + function r(e) { + e && + e.__esModule && + Object.prototype.hasOwnProperty.call(e, 'default') && + e.default; + } + function n(e, t) { + return e((t = { exports: {} }), t.exports), t.exports; + } + function V(e) { + return (e && e.default) || e; + } + function F(e) { + return e.charCodeAt(0) === e1 ? e.charAt(1) : Q(e); + } + function G(e) { + return o1.test(e) ? e.replace(a1, F) : e; + } + function o(e) { + return s1.test(e) ? e.replace(s1, l1) : e; + } + var z, + $, + Z, + J = n(function (e, t) { + Object.defineProperty(t, '__esModule', { value: !0 }), + (t.default = new Uint16Array([ + 14866, 60, 237, 340, 721, 1312, 1562, 1654, 1838, 1957, + 2183, 2239, 2301, 2958, 3037, 3893, 4123, 4298, 4330, 4801, + 5191, 5395, 5752, 5903, 5943, 5972, 6050, 0, 0, 0, 0, 0, 0, + 6135, 6565, 7422, 8183, 8738, 9242, 9503, 9938, 10189, + 10573, 10637, 10715, 11950, 12246, 13539, 13950, 14445, + 14533, 15364, 16514, 16980, 17390, 17763, 17849, 18036, + 18125, 4096, 69, 77, 97, 98, 99, 102, 103, 108, 109, 110, + 111, 112, 114, 115, 116, 117, 92, 100, 106, 115, 122, 137, + 142, 151, 157, 163, 167, 182, 196, 204, 220, 229, 108, 105, + 103, 33024, 198, 59, 32768, 198, 80, 33024, 38, 59, 32768, + 38, 99, 117, 116, 101, 33024, 193, 59, 32768, 193, 114, 101, + 118, 101, 59, 32768, 258, 512, 105, 121, 127, 134, 114, 99, + 33024, 194, 59, 32768, 194, 59, 32768, 1040, 114, 59, 32896, + 55349, 56580, 114, 97, 118, 101, 33024, 192, 59, 32768, 192, + 112, 104, 97, 59, 32768, 913, 97, 99, 114, 59, 32768, 256, + 100, 59, 32768, 10835, 512, 103, 112, 172, 177, 111, 110, + 59, 32768, 260, 102, 59, 32896, 55349, 56632, 112, 108, 121, + 70, 117, 110, 99, 116, 105, 111, 110, 59, 32768, 8289, 105, + 110, 103, 33024, 197, 59, 32768, 197, 512, 99, 115, 209, + 214, 114, 59, 32896, 55349, 56476, 105, 103, 110, 59, 32768, + 8788, 105, 108, 100, 101, 33024, 195, 59, 32768, 195, 109, + 108, 33024, 196, 59, 32768, 196, 2048, 97, 99, 101, 102, + 111, 114, 115, 117, 253, 278, 282, 310, 315, 321, 327, 332, + 512, 99, 114, 258, 267, 107, 115, 108, 97, 115, 104, 59, + 32768, 8726, 583, 271, 274, 59, 32768, 10983, 101, 100, 59, + 32768, 8966, 121, 59, 32768, 1041, 768, 99, 114, 116, 289, + 296, 306, 97, 117, 115, 101, 59, 32768, 8757, 110, 111, 117, + 108, 108, 105, 115, 59, 32768, 8492, 97, 59, 32768, 914, + 114, 59, 32896, 55349, 56581, 112, 102, 59, 32896, 55349, + 56633, 101, 118, 101, 59, 32768, 728, 99, 114, 59, 32768, + 8492, 109, 112, 101, 113, 59, 32768, 8782, 3584, 72, 79, 97, + 99, 100, 101, 102, 104, 105, 108, 111, 114, 115, 117, 368, + 373, 380, 426, 461, 466, 487, 491, 495, 533, 593, 695, 701, + 707, 99, 121, 59, 32768, 1063, 80, 89, 33024, 169, 59, + 32768, 169, 768, 99, 112, 121, 387, 393, 419, 117, 116, 101, + 59, 32768, 262, 512, 59, 105, 398, 400, 32768, 8914, 116, + 97, 108, 68, 105, 102, 102, 101, 114, 101, 110, 116, 105, + 97, 108, 68, 59, 32768, 8517, 108, 101, 121, 115, 59, 32768, + 8493, 1024, 97, 101, 105, 111, 435, 441, 449, 454, 114, 111, + 110, 59, 32768, 268, 100, 105, 108, 33024, 199, 59, 32768, + 199, 114, 99, 59, 32768, 264, 110, 105, 110, 116, 59, 32768, + 8752, 111, 116, 59, 32768, 266, 512, 100, 110, 471, 478, + 105, 108, 108, 97, 59, 32768, 184, 116, 101, 114, 68, 111, + 116, 59, 32768, 183, 114, 59, 32768, 8493, 105, 59, 32768, + 935, 114, 99, 108, 101, 1024, 68, 77, 80, 84, 508, 513, 520, + 526, 111, 116, 59, 32768, 8857, 105, 110, 117, 115, 59, + 32768, 8854, 108, 117, 115, 59, 32768, 8853, 105, 109, 101, + 115, 59, 32768, 8855, 111, 512, 99, 115, 539, 562, 107, 119, + 105, 115, 101, 67, 111, 110, 116, 111, 117, 114, 73, 110, + 116, 101, 103, 114, 97, 108, 59, 32768, 8754, 101, 67, 117, + 114, 108, 121, 512, 68, 81, 573, 586, 111, 117, 98, 108, + 101, 81, 117, 111, 116, 101, 59, 32768, 8221, 117, 111, 116, + 101, 59, 32768, 8217, 1024, 108, 110, 112, 117, 602, 614, + 648, 664, 111, 110, 512, 59, 101, 609, 611, 32768, 8759, 59, + 32768, 10868, 768, 103, 105, 116, 621, 629, 634, 114, 117, + 101, 110, 116, 59, 32768, 8801, 110, 116, 59, 32768, 8751, + 111, 117, 114, 73, 110, 116, 101, 103, 114, 97, 108, 59, + 32768, 8750, 512, 102, 114, 653, 656, 59, 32768, 8450, 111, + 100, 117, 99, 116, 59, 32768, 8720, 110, 116, 101, 114, 67, + 108, 111, 99, 107, 119, 105, 115, 101, 67, 111, 110, 116, + 111, 117, 114, 73, 110, 116, 101, 103, 114, 97, 108, 59, + 32768, 8755, 111, 115, 115, 59, 32768, 10799, 99, 114, 59, + 32896, 55349, 56478, 112, 512, 59, 67, 713, 715, 32768, + 8915, 97, 112, 59, 32768, 8781, 2816, 68, 74, 83, 90, 97, + 99, 101, 102, 105, 111, 115, 743, 758, 763, 768, 773, 795, + 809, 821, 826, 910, 1295, 512, 59, 111, 748, 750, 32768, + 8517, 116, 114, 97, 104, 100, 59, 32768, 10513, 99, 121, 59, + 32768, 1026, 99, 121, 59, 32768, 1029, 99, 121, 59, 32768, + 1039, 768, 103, 114, 115, 780, 786, 790, 103, 101, 114, 59, + 32768, 8225, 114, 59, 32768, 8609, 104, 118, 59, 32768, + 10980, 512, 97, 121, 800, 806, 114, 111, 110, 59, 32768, + 270, 59, 32768, 1044, 108, 512, 59, 116, 815, 817, 32768, + 8711, 97, 59, 32768, 916, 114, 59, 32896, 55349, 56583, 512, + 97, 102, 831, 897, 512, 99, 109, 836, 891, 114, 105, 116, + 105, 99, 97, 108, 1024, 65, 68, 71, 84, 852, 859, 877, 884, + 99, 117, 116, 101, 59, 32768, 180, 111, 581, 864, 867, 59, + 32768, 729, 98, 108, 101, 65, 99, 117, 116, 101, 59, 32768, + 733, 114, 97, 118, 101, 59, 32768, 96, 105, 108, 100, 101, + 59, 32768, 732, 111, 110, 100, 59, 32768, 8900, 102, 101, + 114, 101, 110, 116, 105, 97, 108, 68, 59, 32768, 8518, 2113, + 920, 0, 0, 0, 925, 946, 0, 1139, 102, 59, 32896, 55349, + 56635, 768, 59, 68, 69, 931, 933, 938, 32768, 168, 111, 116, + 59, 32768, 8412, 113, 117, 97, 108, 59, 32768, 8784, 98, + 108, 101, 1536, 67, 68, 76, 82, 85, 86, 961, 978, 996, 1080, + 1101, 1125, 111, 110, 116, 111, 117, 114, 73, 110, 116, 101, + 103, 114, 97, 108, 59, 32768, 8751, 111, 1093, 985, 0, 0, + 988, 59, 32768, 168, 110, 65, 114, 114, 111, 119, 59, 32768, + 8659, 512, 101, 111, 1001, 1034, 102, 116, 768, 65, 82, 84, + 1010, 1017, 1029, 114, 114, 111, 119, 59, 32768, 8656, 105, + 103, 104, 116, 65, 114, 114, 111, 119, 59, 32768, 8660, 101, + 101, 59, 32768, 10980, 110, 103, 512, 76, 82, 1041, 1068, + 101, 102, 116, 512, 65, 82, 1049, 1056, 114, 114, 111, 119, + 59, 32768, 10232, 105, 103, 104, 116, 65, 114, 114, 111, + 119, 59, 32768, 10234, 105, 103, 104, 116, 65, 114, 114, + 111, 119, 59, 32768, 10233, 105, 103, 104, 116, 512, 65, 84, + 1089, 1096, 114, 114, 111, 119, 59, 32768, 8658, 101, 101, + 59, 32768, 8872, 112, 1042, 1108, 0, 0, 1115, 114, 114, 111, + 119, 59, 32768, 8657, 111, 119, 110, 65, 114, 114, 111, 119, + 59, 32768, 8661, 101, 114, 116, 105, 99, 97, 108, 66, 97, + 114, 59, 32768, 8741, 110, 1536, 65, 66, 76, 82, 84, 97, + 1152, 1179, 1186, 1236, 1272, 1288, 114, 114, 111, 119, 768, + 59, 66, 85, 1163, 1165, 1170, 32768, 8595, 97, 114, 59, + 32768, 10515, 112, 65, 114, 114, 111, 119, 59, 32768, 8693, + 114, 101, 118, 101, 59, 32768, 785, 101, 102, 116, 1315, + 1196, 0, 1209, 0, 1220, 105, 103, 104, 116, 86, 101, 99, + 116, 111, 114, 59, 32768, 10576, 101, 101, 86, 101, 99, 116, + 111, 114, 59, 32768, 10590, 101, 99, 116, 111, 114, 512, 59, + 66, 1229, 1231, 32768, 8637, 97, 114, 59, 32768, 10582, 105, + 103, 104, 116, 805, 1245, 0, 1256, 101, 101, 86, 101, 99, + 116, 111, 114, 59, 32768, 10591, 101, 99, 116, 111, 114, + 512, 59, 66, 1265, 1267, 32768, 8641, 97, 114, 59, 32768, + 10583, 101, 101, 512, 59, 65, 1279, 1281, 32768, 8868, 114, + 114, 111, 119, 59, 32768, 8615, 114, 114, 111, 119, 59, + 32768, 8659, 512, 99, 116, 1300, 1305, 114, 59, 32896, + 55349, 56479, 114, 111, 107, 59, 32768, 272, 4096, 78, 84, + 97, 99, 100, 102, 103, 108, 109, 111, 112, 113, 115, 116, + 117, 120, 1344, 1348, 1354, 1363, 1386, 1391, 1396, 1405, + 1413, 1460, 1475, 1483, 1514, 1527, 1531, 1538, 71, 59, + 32768, 330, 72, 33024, 208, 59, 32768, 208, 99, 117, 116, + 101, 33024, 201, 59, 32768, 201, 768, 97, 105, 121, 1370, + 1376, 1383, 114, 111, 110, 59, 32768, 282, 114, 99, 33024, + 202, 59, 32768, 202, 59, 32768, 1069, 111, 116, 59, 32768, + 278, 114, 59, 32896, 55349, 56584, 114, 97, 118, 101, 33024, + 200, 59, 32768, 200, 101, 109, 101, 110, 116, 59, 32768, + 8712, 512, 97, 112, 1418, 1423, 99, 114, 59, 32768, 274, + 116, 121, 1060, 1431, 0, 0, 1444, 109, 97, 108, 108, 83, + 113, 117, 97, 114, 101, 59, 32768, 9723, 101, 114, 121, 83, + 109, 97, 108, 108, 83, 113, 117, 97, 114, 101, 59, 32768, + 9643, 512, 103, 112, 1465, 1470, 111, 110, 59, 32768, 280, + 102, 59, 32896, 55349, 56636, 115, 105, 108, 111, 110, 59, + 32768, 917, 117, 512, 97, 105, 1489, 1504, 108, 512, 59, 84, + 1495, 1497, 32768, 10869, 105, 108, 100, 101, 59, 32768, + 8770, 108, 105, 98, 114, 105, 117, 109, 59, 32768, 8652, + 512, 99, 105, 1519, 1523, 114, 59, 32768, 8496, 109, 59, + 32768, 10867, 97, 59, 32768, 919, 109, 108, 33024, 203, 59, + 32768, 203, 512, 105, 112, 1543, 1549, 115, 116, 115, 59, + 32768, 8707, 111, 110, 101, 110, 116, 105, 97, 108, 69, 59, + 32768, 8519, 1280, 99, 102, 105, 111, 115, 1572, 1576, 1581, + 1620, 1648, 121, 59, 32768, 1060, 114, 59, 32896, 55349, + 56585, 108, 108, 101, 100, 1060, 1591, 0, 0, 1604, 109, 97, + 108, 108, 83, 113, 117, 97, 114, 101, 59, 32768, 9724, 101, + 114, 121, 83, 109, 97, 108, 108, 83, 113, 117, 97, 114, 101, + 59, 32768, 9642, 1601, 1628, 0, 1633, 0, 0, 1639, 102, 59, + 32896, 55349, 56637, 65, 108, 108, 59, 32768, 8704, 114, + 105, 101, 114, 116, 114, 102, 59, 32768, 8497, 99, 114, 59, + 32768, 8497, 3072, 74, 84, 97, 98, 99, 100, 102, 103, 111, + 114, 115, 116, 1678, 1683, 1688, 1701, 1708, 1729, 1734, + 1739, 1742, 1748, 1828, 1834, 99, 121, 59, 32768, 1027, + 33024, 62, 59, 32768, 62, 109, 109, 97, 512, 59, 100, 1696, + 1698, 32768, 915, 59, 32768, 988, 114, 101, 118, 101, 59, + 32768, 286, 768, 101, 105, 121, 1715, 1721, 1726, 100, 105, + 108, 59, 32768, 290, 114, 99, 59, 32768, 284, 59, 32768, + 1043, 111, 116, 59, 32768, 288, 114, 59, 32896, 55349, + 56586, 59, 32768, 8921, 112, 102, 59, 32896, 55349, 56638, + 101, 97, 116, 101, 114, 1536, 69, 70, 71, 76, 83, 84, 1766, + 1783, 1794, 1803, 1809, 1821, 113, 117, 97, 108, 512, 59, + 76, 1775, 1777, 32768, 8805, 101, 115, 115, 59, 32768, 8923, + 117, 108, 108, 69, 113, 117, 97, 108, 59, 32768, 8807, 114, + 101, 97, 116, 101, 114, 59, 32768, 10914, 101, 115, 115, 59, + 32768, 8823, 108, 97, 110, 116, 69, 113, 117, 97, 108, 59, + 32768, 10878, 105, 108, 100, 101, 59, 32768, 8819, 99, 114, + 59, 32896, 55349, 56482, 59, 32768, 8811, 2048, 65, 97, 99, + 102, 105, 111, 115, 117, 1854, 1861, 1874, 1880, 1884, 1897, + 1919, 1934, 82, 68, 99, 121, 59, 32768, 1066, 512, 99, 116, + 1866, 1871, 101, 107, 59, 32768, 711, 59, 32768, 94, 105, + 114, 99, 59, 32768, 292, 114, 59, 32768, 8460, 108, 98, 101, + 114, 116, 83, 112, 97, 99, 101, 59, 32768, 8459, 833, 1902, + 0, 1906, 102, 59, 32768, 8461, 105, 122, 111, 110, 116, 97, + 108, 76, 105, 110, 101, 59, 32768, 9472, 512, 99, 116, 1924, + 1928, 114, 59, 32768, 8459, 114, 111, 107, 59, 32768, 294, + 109, 112, 533, 1940, 1950, 111, 119, 110, 72, 117, 109, 112, + 59, 32768, 8782, 113, 117, 97, 108, 59, 32768, 8783, 3584, + 69, 74, 79, 97, 99, 100, 102, 103, 109, 110, 111, 115, 116, + 117, 1985, 1990, 1996, 2001, 2010, 2025, 2030, 2034, 2043, + 2077, 2134, 2155, 2160, 2167, 99, 121, 59, 32768, 1045, 108, + 105, 103, 59, 32768, 306, 99, 121, 59, 32768, 1025, 99, 117, + 116, 101, 33024, 205, 59, 32768, 205, 512, 105, 121, 2015, + 2022, 114, 99, 33024, 206, 59, 32768, 206, 59, 32768, 1048, + 111, 116, 59, 32768, 304, 114, 59, 32768, 8465, 114, 97, + 118, 101, 33024, 204, 59, 32768, 204, 768, 59, 97, 112, + 2050, 2052, 2070, 32768, 8465, 512, 99, 103, 2057, 2061, + 114, 59, 32768, 298, 105, 110, 97, 114, 121, 73, 59, 32768, + 8520, 108, 105, 101, 115, 59, 32768, 8658, 837, 2082, 0, + 2110, 512, 59, 101, 2086, 2088, 32768, 8748, 512, 103, 114, + 2093, 2099, 114, 97, 108, 59, 32768, 8747, 115, 101, 99, + 116, 105, 111, 110, 59, 32768, 8898, 105, 115, 105, 98, 108, + 101, 512, 67, 84, 2120, 2127, 111, 109, 109, 97, 59, 32768, + 8291, 105, 109, 101, 115, 59, 32768, 8290, 768, 103, 112, + 116, 2141, 2146, 2151, 111, 110, 59, 32768, 302, 102, 59, + 32896, 55349, 56640, 97, 59, 32768, 921, 99, 114, 59, 32768, + 8464, 105, 108, 100, 101, 59, 32768, 296, 828, 2172, 0, + 2177, 99, 121, 59, 32768, 1030, 108, 33024, 207, 59, 32768, + 207, 1280, 99, 102, 111, 115, 117, 2193, 2206, 2211, 2217, + 2232, 512, 105, 121, 2198, 2203, 114, 99, 59, 32768, 308, + 59, 32768, 1049, 114, 59, 32896, 55349, 56589, 112, 102, 59, + 32896, 55349, 56641, 820, 2222, 0, 2227, 114, 59, 32896, + 55349, 56485, 114, 99, 121, 59, 32768, 1032, 107, 99, 121, + 59, 32768, 1028, 1792, 72, 74, 97, 99, 102, 111, 115, 2253, + 2258, 2263, 2269, 2283, 2288, 2294, 99, 121, 59, 32768, + 1061, 99, 121, 59, 32768, 1036, 112, 112, 97, 59, 32768, + 922, 512, 101, 121, 2274, 2280, 100, 105, 108, 59, 32768, + 310, 59, 32768, 1050, 114, 59, 32896, 55349, 56590, 112, + 102, 59, 32896, 55349, 56642, 99, 114, 59, 32896, 55349, + 56486, 2816, 74, 84, 97, 99, 101, 102, 108, 109, 111, 115, + 116, 2323, 2328, 2333, 2374, 2396, 2775, 2780, 2797, 2804, + 2934, 2954, 99, 121, 59, 32768, 1033, 33024, 60, 59, 32768, + 60, 1280, 99, 109, 110, 112, 114, 2344, 2350, 2356, 2360, + 2370, 117, 116, 101, 59, 32768, 313, 98, 100, 97, 59, 32768, + 923, 103, 59, 32768, 10218, 108, 97, 99, 101, 116, 114, 102, + 59, 32768, 8466, 114, 59, 32768, 8606, 768, 97, 101, 121, + 2381, 2387, 2393, 114, 111, 110, 59, 32768, 317, 100, 105, + 108, 59, 32768, 315, 59, 32768, 1051, 512, 102, 115, 2401, + 2702, 116, 2560, 65, 67, 68, 70, 82, 84, 85, 86, 97, 114, + 2423, 2470, 2479, 2530, 2537, 2561, 2618, 2666, 2683, 2690, + 512, 110, 114, 2428, 2441, 103, 108, 101, 66, 114, 97, 99, + 107, 101, 116, 59, 32768, 10216, 114, 111, 119, 768, 59, 66, + 82, 2451, 2453, 2458, 32768, 8592, 97, 114, 59, 32768, 8676, + 105, 103, 104, 116, 65, 114, 114, 111, 119, 59, 32768, 8646, + 101, 105, 108, 105, 110, 103, 59, 32768, 8968, 111, 838, + 2485, 0, 2498, 98, 108, 101, 66, 114, 97, 99, 107, 101, 116, + 59, 32768, 10214, 110, 805, 2503, 0, 2514, 101, 101, 86, + 101, 99, 116, 111, 114, 59, 32768, 10593, 101, 99, 116, 111, + 114, 512, 59, 66, 2523, 2525, 32768, 8643, 97, 114, 59, + 32768, 10585, 108, 111, 111, 114, 59, 32768, 8970, 105, 103, + 104, 116, 512, 65, 86, 2546, 2553, 114, 114, 111, 119, 59, + 32768, 8596, 101, 99, 116, 111, 114, 59, 32768, 10574, 512, + 101, 114, 2566, 2591, 101, 768, 59, 65, 86, 2574, 2576, + 2583, 32768, 8867, 114, 114, 111, 119, 59, 32768, 8612, 101, + 99, 116, 111, 114, 59, 32768, 10586, 105, 97, 110, 103, 108, + 101, 768, 59, 66, 69, 2604, 2606, 2611, 32768, 8882, 97, + 114, 59, 32768, 10703, 113, 117, 97, 108, 59, 32768, 8884, + 112, 768, 68, 84, 86, 2626, 2638, 2649, 111, 119, 110, 86, + 101, 99, 116, 111, 114, 59, 32768, 10577, 101, 101, 86, 101, + 99, 116, 111, 114, 59, 32768, 10592, 101, 99, 116, 111, 114, + 512, 59, 66, 2659, 2661, 32768, 8639, 97, 114, 59, 32768, + 10584, 101, 99, 116, 111, 114, 512, 59, 66, 2676, 2678, + 32768, 8636, 97, 114, 59, 32768, 10578, 114, 114, 111, 119, + 59, 32768, 8656, 105, 103, 104, 116, 97, 114, 114, 111, 119, + 59, 32768, 8660, 115, 1536, 69, 70, 71, 76, 83, 84, 2716, + 2730, 2741, 2750, 2756, 2768, 113, 117, 97, 108, 71, 114, + 101, 97, 116, 101, 114, 59, 32768, 8922, 117, 108, 108, 69, + 113, 117, 97, 108, 59, 32768, 8806, 114, 101, 97, 116, 101, + 114, 59, 32768, 8822, 101, 115, 115, 59, 32768, 10913, 108, + 97, 110, 116, 69, 113, 117, 97, 108, 59, 32768, 10877, 105, + 108, 100, 101, 59, 32768, 8818, 114, 59, 32896, 55349, + 56591, 512, 59, 101, 2785, 2787, 32768, 8920, 102, 116, 97, + 114, 114, 111, 119, 59, 32768, 8666, 105, 100, 111, 116, 59, + 32768, 319, 768, 110, 112, 119, 2811, 2899, 2904, 103, 1024, + 76, 82, 108, 114, 2821, 2848, 2860, 2887, 101, 102, 116, + 512, 65, 82, 2829, 2836, 114, 114, 111, 119, 59, 32768, + 10229, 105, 103, 104, 116, 65, 114, 114, 111, 119, 59, + 32768, 10231, 105, 103, 104, 116, 65, 114, 114, 111, 119, + 59, 32768, 10230, 101, 102, 116, 512, 97, 114, 2868, 2875, + 114, 114, 111, 119, 59, 32768, 10232, 105, 103, 104, 116, + 97, 114, 114, 111, 119, 59, 32768, 10234, 105, 103, 104, + 116, 97, 114, 114, 111, 119, 59, 32768, 10233, 102, 59, + 32896, 55349, 56643, 101, 114, 512, 76, 82, 2911, 2922, 101, + 102, 116, 65, 114, 114, 111, 119, 59, 32768, 8601, 105, 103, + 104, 116, 65, 114, 114, 111, 119, 59, 32768, 8600, 768, 99, + 104, 116, 2941, 2945, 2948, 114, 59, 32768, 8466, 59, 32768, + 8624, 114, 111, 107, 59, 32768, 321, 59, 32768, 8810, 2048, + 97, 99, 101, 102, 105, 111, 115, 117, 2974, 2978, 2982, + 3007, 3012, 3022, 3028, 3033, 112, 59, 32768, 10501, 121, + 59, 32768, 1052, 512, 100, 108, 2987, 2998, 105, 117, 109, + 83, 112, 97, 99, 101, 59, 32768, 8287, 108, 105, 110, 116, + 114, 102, 59, 32768, 8499, 114, 59, 32896, 55349, 56592, + 110, 117, 115, 80, 108, 117, 115, 59, 32768, 8723, 112, 102, + 59, 32896, 55349, 56644, 99, 114, 59, 32768, 8499, 59, + 32768, 924, 2304, 74, 97, 99, 101, 102, 111, 115, 116, 117, + 3055, 3060, 3067, 3089, 3201, 3206, 3874, 3880, 3889, 99, + 121, 59, 32768, 1034, 99, 117, 116, 101, 59, 32768, 323, + 768, 97, 101, 121, 3074, 3080, 3086, 114, 111, 110, 59, + 32768, 327, 100, 105, 108, 59, 32768, 325, 59, 32768, 1053, + 768, 103, 115, 119, 3096, 3160, 3194, 97, 116, 105, 118, + 101, 768, 77, 84, 86, 3108, 3121, 3145, 101, 100, 105, 117, + 109, 83, 112, 97, 99, 101, 59, 32768, 8203, 104, 105, 512, + 99, 110, 3128, 3137, 107, 83, 112, 97, 99, 101, 59, 32768, + 8203, 83, 112, 97, 99, 101, 59, 32768, 8203, 101, 114, 121, + 84, 104, 105, 110, 83, 112, 97, 99, 101, 59, 32768, 8203, + 116, 101, 100, 512, 71, 76, 3168, 3184, 114, 101, 97, 116, + 101, 114, 71, 114, 101, 97, 116, 101, 114, 59, 32768, 8811, + 101, 115, 115, 76, 101, 115, 115, 59, 32768, 8810, 76, 105, + 110, 101, 59, 32768, 10, 114, 59, 32896, 55349, 56593, 1024, + 66, 110, 112, 116, 3215, 3222, 3238, 3242, 114, 101, 97, + 107, 59, 32768, 8288, 66, 114, 101, 97, 107, 105, 110, 103, + 83, 112, 97, 99, 101, 59, 32768, 160, 102, 59, 32768, 8469, + 3328, 59, 67, 68, 69, 71, 72, 76, 78, 80, 82, 83, 84, 86, + 3269, 3271, 3293, 3312, 3352, 3430, 3455, 3551, 3589, 3625, + 3678, 3821, 3861, 32768, 10988, 512, 111, 117, 3276, 3286, + 110, 103, 114, 117, 101, 110, 116, 59, 32768, 8802, 112, 67, + 97, 112, 59, 32768, 8813, 111, 117, 98, 108, 101, 86, 101, + 114, 116, 105, 99, 97, 108, 66, 97, 114, 59, 32768, 8742, + 768, 108, 113, 120, 3319, 3327, 3345, 101, 109, 101, 110, + 116, 59, 32768, 8713, 117, 97, 108, 512, 59, 84, 3335, 3337, + 32768, 8800, 105, 108, 100, 101, 59, 32896, 8770, 824, 105, + 115, 116, 115, 59, 32768, 8708, 114, 101, 97, 116, 101, 114, + 1792, 59, 69, 70, 71, 76, 83, 84, 3373, 3375, 3382, 3394, + 3404, 3410, 3423, 32768, 8815, 113, 117, 97, 108, 59, 32768, + 8817, 117, 108, 108, 69, 113, 117, 97, 108, 59, 32896, 8807, + 824, 114, 101, 97, 116, 101, 114, 59, 32896, 8811, 824, 101, + 115, 115, 59, 32768, 8825, 108, 97, 110, 116, 69, 113, 117, + 97, 108, 59, 32896, 10878, 824, 105, 108, 100, 101, 59, + 32768, 8821, 117, 109, 112, 533, 3437, 3448, 111, 119, 110, + 72, 117, 109, 112, 59, 32896, 8782, 824, 113, 117, 97, 108, + 59, 32896, 8783, 824, 101, 512, 102, 115, 3461, 3492, 116, + 84, 114, 105, 97, 110, 103, 108, 101, 768, 59, 66, 69, 3477, + 3479, 3485, 32768, 8938, 97, 114, 59, 32896, 10703, 824, + 113, 117, 97, 108, 59, 32768, 8940, 115, 1536, 59, 69, 71, + 76, 83, 84, 3506, 3508, 3515, 3524, 3531, 3544, 32768, 8814, + 113, 117, 97, 108, 59, 32768, 8816, 114, 101, 97, 116, 101, + 114, 59, 32768, 8824, 101, 115, 115, 59, 32896, 8810, 824, + 108, 97, 110, 116, 69, 113, 117, 97, 108, 59, 32896, 10877, + 824, 105, 108, 100, 101, 59, 32768, 8820, 101, 115, 116, + 101, 100, 512, 71, 76, 3561, 3578, 114, 101, 97, 116, 101, + 114, 71, 114, 101, 97, 116, 101, 114, 59, 32896, 10914, 824, + 101, 115, 115, 76, 101, 115, 115, 59, 32896, 10913, 824, + 114, 101, 99, 101, 100, 101, 115, 768, 59, 69, 83, 3603, + 3605, 3613, 32768, 8832, 113, 117, 97, 108, 59, 32896, + 10927, 824, 108, 97, 110, 116, 69, 113, 117, 97, 108, 59, + 32768, 8928, 512, 101, 105, 3630, 3645, 118, 101, 114, 115, + 101, 69, 108, 101, 109, 101, 110, 116, 59, 32768, 8716, 103, + 104, 116, 84, 114, 105, 97, 110, 103, 108, 101, 768, 59, 66, + 69, 3663, 3665, 3671, 32768, 8939, 97, 114, 59, 32896, + 10704, 824, 113, 117, 97, 108, 59, 32768, 8941, 512, 113, + 117, 3683, 3732, 117, 97, 114, 101, 83, 117, 512, 98, 112, + 3694, 3712, 115, 101, 116, 512, 59, 69, 3702, 3705, 32896, + 8847, 824, 113, 117, 97, 108, 59, 32768, 8930, 101, 114, + 115, 101, 116, 512, 59, 69, 3722, 3725, 32896, 8848, 824, + 113, 117, 97, 108, 59, 32768, 8931, 768, 98, 99, 112, 3739, + 3757, 3801, 115, 101, 116, 512, 59, 69, 3747, 3750, 32896, + 8834, 8402, 113, 117, 97, 108, 59, 32768, 8840, 99, 101, + 101, 100, 115, 1024, 59, 69, 83, 84, 3771, 3773, 3781, 3793, + 32768, 8833, 113, 117, 97, 108, 59, 32896, 10928, 824, 108, + 97, 110, 116, 69, 113, 117, 97, 108, 59, 32768, 8929, 105, + 108, 100, 101, 59, 32896, 8831, 824, 101, 114, 115, 101, + 116, 512, 59, 69, 3811, 3814, 32896, 8835, 8402, 113, 117, + 97, 108, 59, 32768, 8841, 105, 108, 100, 101, 1024, 59, 69, + 70, 84, 3834, 3836, 3843, 3854, 32768, 8769, 113, 117, 97, + 108, 59, 32768, 8772, 117, 108, 108, 69, 113, 117, 97, 108, + 59, 32768, 8775, 105, 108, 100, 101, 59, 32768, 8777, 101, + 114, 116, 105, 99, 97, 108, 66, 97, 114, 59, 32768, 8740, + 99, 114, 59, 32896, 55349, 56489, 105, 108, 100, 101, 33024, + 209, 59, 32768, 209, 59, 32768, 925, 3584, 69, 97, 99, 100, + 102, 103, 109, 111, 112, 114, 115, 116, 117, 118, 3921, + 3927, 3936, 3951, 3958, 3963, 3972, 3996, 4002, 4034, 4037, + 4055, 4071, 4078, 108, 105, 103, 59, 32768, 338, 99, 117, + 116, 101, 33024, 211, 59, 32768, 211, 512, 105, 121, 3941, + 3948, 114, 99, 33024, 212, 59, 32768, 212, 59, 32768, 1054, + 98, 108, 97, 99, 59, 32768, 336, 114, 59, 32896, 55349, + 56594, 114, 97, 118, 101, 33024, 210, 59, 32768, 210, 768, + 97, 101, 105, 3979, 3984, 3989, 99, 114, 59, 32768, 332, + 103, 97, 59, 32768, 937, 99, 114, 111, 110, 59, 32768, 927, + 112, 102, 59, 32896, 55349, 56646, 101, 110, 67, 117, 114, + 108, 121, 512, 68, 81, 4014, 4027, 111, 117, 98, 108, 101, + 81, 117, 111, 116, 101, 59, 32768, 8220, 117, 111, 116, 101, + 59, 32768, 8216, 59, 32768, 10836, 512, 99, 108, 4042, 4047, + 114, 59, 32896, 55349, 56490, 97, 115, 104, 33024, 216, 59, + 32768, 216, 105, 573, 4060, 4067, 100, 101, 33024, 213, 59, + 32768, 213, 101, 115, 59, 32768, 10807, 109, 108, 33024, + 214, 59, 32768, 214, 101, 114, 512, 66, 80, 4085, 4109, 512, + 97, 114, 4090, 4094, 114, 59, 32768, 8254, 97, 99, 512, 101, + 107, 4101, 4104, 59, 32768, 9182, 101, 116, 59, 32768, 9140, + 97, 114, 101, 110, 116, 104, 101, 115, 105, 115, 59, 32768, + 9180, 2304, 97, 99, 102, 104, 105, 108, 111, 114, 115, 4141, + 4150, 4154, 4159, 4163, 4166, 4176, 4198, 4284, 114, 116, + 105, 97, 108, 68, 59, 32768, 8706, 121, 59, 32768, 1055, + 114, 59, 32896, 55349, 56595, 105, 59, 32768, 934, 59, + 32768, 928, 117, 115, 77, 105, 110, 117, 115, 59, 32768, + 177, 512, 105, 112, 4181, 4194, 110, 99, 97, 114, 101, 112, + 108, 97, 110, 101, 59, 32768, 8460, 102, 59, 32768, 8473, + 1024, 59, 101, 105, 111, 4207, 4209, 4251, 4256, 32768, + 10939, 99, 101, 100, 101, 115, 1024, 59, 69, 83, 84, 4223, + 4225, 4232, 4244, 32768, 8826, 113, 117, 97, 108, 59, 32768, + 10927, 108, 97, 110, 116, 69, 113, 117, 97, 108, 59, 32768, + 8828, 105, 108, 100, 101, 59, 32768, 8830, 109, 101, 59, + 32768, 8243, 512, 100, 112, 4261, 4267, 117, 99, 116, 59, + 32768, 8719, 111, 114, 116, 105, 111, 110, 512, 59, 97, + 4278, 4280, 32768, 8759, 108, 59, 32768, 8733, 512, 99, 105, + 4289, 4294, 114, 59, 32896, 55349, 56491, 59, 32768, 936, + 1024, 85, 102, 111, 115, 4306, 4313, 4318, 4323, 79, 84, + 33024, 34, 59, 32768, 34, 114, 59, 32896, 55349, 56596, 112, + 102, 59, 32768, 8474, 99, 114, 59, 32896, 55349, 56492, + 3072, 66, 69, 97, 99, 101, 102, 104, 105, 111, 114, 115, + 117, 4354, 4360, 4366, 4395, 4417, 4473, 4477, 4481, 4743, + 4764, 4776, 4788, 97, 114, 114, 59, 32768, 10512, 71, 33024, + 174, 59, 32768, 174, 768, 99, 110, 114, 4373, 4379, 4383, + 117, 116, 101, 59, 32768, 340, 103, 59, 32768, 10219, 114, + 512, 59, 116, 4389, 4391, 32768, 8608, 108, 59, 32768, + 10518, 768, 97, 101, 121, 4402, 4408, 4414, 114, 111, 110, + 59, 32768, 344, 100, 105, 108, 59, 32768, 342, 59, 32768, + 1056, 512, 59, 118, 4422, 4424, 32768, 8476, 101, 114, 115, + 101, 512, 69, 85, 4433, 4458, 512, 108, 113, 4438, 4446, + 101, 109, 101, 110, 116, 59, 32768, 8715, 117, 105, 108, + 105, 98, 114, 105, 117, 109, 59, 32768, 8651, 112, 69, 113, + 117, 105, 108, 105, 98, 114, 105, 117, 109, 59, 32768, + 10607, 114, 59, 32768, 8476, 111, 59, 32768, 929, 103, 104, + 116, 2048, 65, 67, 68, 70, 84, 85, 86, 97, 4501, 4547, 4556, + 4607, 4614, 4671, 4719, 4736, 512, 110, 114, 4506, 4519, + 103, 108, 101, 66, 114, 97, 99, 107, 101, 116, 59, 32768, + 10217, 114, 111, 119, 768, 59, 66, 76, 4529, 4531, 4536, + 32768, 8594, 97, 114, 59, 32768, 8677, 101, 102, 116, 65, + 114, 114, 111, 119, 59, 32768, 8644, 101, 105, 108, 105, + 110, 103, 59, 32768, 8969, 111, 838, 4562, 0, 4575, 98, 108, + 101, 66, 114, 97, 99, 107, 101, 116, 59, 32768, 10215, 110, + 805, 4580, 0, 4591, 101, 101, 86, 101, 99, 116, 111, 114, + 59, 32768, 10589, 101, 99, 116, 111, 114, 512, 59, 66, 4600, + 4602, 32768, 8642, 97, 114, 59, 32768, 10581, 108, 111, 111, + 114, 59, 32768, 8971, 512, 101, 114, 4619, 4644, 101, 768, + 59, 65, 86, 4627, 4629, 4636, 32768, 8866, 114, 114, 111, + 119, 59, 32768, 8614, 101, 99, 116, 111, 114, 59, 32768, + 10587, 105, 97, 110, 103, 108, 101, 768, 59, 66, 69, 4657, + 4659, 4664, 32768, 8883, 97, 114, 59, 32768, 10704, 113, + 117, 97, 108, 59, 32768, 8885, 112, 768, 68, 84, 86, 4679, + 4691, 4702, 111, 119, 110, 86, 101, 99, 116, 111, 114, 59, + 32768, 10575, 101, 101, 86, 101, 99, 116, 111, 114, 59, + 32768, 10588, 101, 99, 116, 111, 114, 512, 59, 66, 4712, + 4714, 32768, 8638, 97, 114, 59, 32768, 10580, 101, 99, 116, + 111, 114, 512, 59, 66, 4729, 4731, 32768, 8640, 97, 114, 59, + 32768, 10579, 114, 114, 111, 119, 59, 32768, 8658, 512, 112, + 117, 4748, 4752, 102, 59, 32768, 8477, 110, 100, 73, 109, + 112, 108, 105, 101, 115, 59, 32768, 10608, 105, 103, 104, + 116, 97, 114, 114, 111, 119, 59, 32768, 8667, 512, 99, 104, + 4781, 4785, 114, 59, 32768, 8475, 59, 32768, 8625, 108, 101, + 68, 101, 108, 97, 121, 101, 100, 59, 32768, 10740, 3328, 72, + 79, 97, 99, 102, 104, 105, 109, 111, 113, 115, 116, 117, + 4827, 4842, 4849, 4856, 4889, 4894, 4949, 4955, 4967, 4973, + 5059, 5065, 5070, 512, 67, 99, 4832, 4838, 72, 99, 121, 59, + 32768, 1065, 121, 59, 32768, 1064, 70, 84, 99, 121, 59, + 32768, 1068, 99, 117, 116, 101, 59, 32768, 346, 1280, 59, + 97, 101, 105, 121, 4867, 4869, 4875, 4881, 4886, 32768, + 10940, 114, 111, 110, 59, 32768, 352, 100, 105, 108, 59, + 32768, 350, 114, 99, 59, 32768, 348, 59, 32768, 1057, 114, + 59, 32896, 55349, 56598, 111, 114, 116, 1024, 68, 76, 82, + 85, 4906, 4917, 4928, 4940, 111, 119, 110, 65, 114, 114, + 111, 119, 59, 32768, 8595, 101, 102, 116, 65, 114, 114, 111, + 119, 59, 32768, 8592, 105, 103, 104, 116, 65, 114, 114, 111, + 119, 59, 32768, 8594, 112, 65, 114, 114, 111, 119, 59, + 32768, 8593, 103, 109, 97, 59, 32768, 931, 97, 108, 108, 67, + 105, 114, 99, 108, 101, 59, 32768, 8728, 112, 102, 59, + 32896, 55349, 56650, 1091, 4979, 0, 0, 4983, 116, 59, 32768, + 8730, 97, 114, 101, 1024, 59, 73, 83, 85, 4994, 4996, 5010, + 5052, 32768, 9633, 110, 116, 101, 114, 115, 101, 99, 116, + 105, 111, 110, 59, 32768, 8851, 117, 512, 98, 112, 5016, + 5033, 115, 101, 116, 512, 59, 69, 5024, 5026, 32768, 8847, + 113, 117, 97, 108, 59, 32768, 8849, 101, 114, 115, 101, 116, + 512, 59, 69, 5043, 5045, 32768, 8848, 113, 117, 97, 108, 59, + 32768, 8850, 110, 105, 111, 110, 59, 32768, 8852, 99, 114, + 59, 32896, 55349, 56494, 97, 114, 59, 32768, 8902, 1024, 98, + 99, 109, 112, 5079, 5102, 5155, 5158, 512, 59, 115, 5084, + 5086, 32768, 8912, 101, 116, 512, 59, 69, 5093, 5095, 32768, + 8912, 113, 117, 97, 108, 59, 32768, 8838, 512, 99, 104, + 5107, 5148, 101, 101, 100, 115, 1024, 59, 69, 83, 84, 5120, + 5122, 5129, 5141, 32768, 8827, 113, 117, 97, 108, 59, 32768, + 10928, 108, 97, 110, 116, 69, 113, 117, 97, 108, 59, 32768, + 8829, 105, 108, 100, 101, 59, 32768, 8831, 84, 104, 97, 116, + 59, 32768, 8715, 59, 32768, 8721, 768, 59, 101, 115, 5165, + 5167, 5185, 32768, 8913, 114, 115, 101, 116, 512, 59, 69, + 5176, 5178, 32768, 8835, 113, 117, 97, 108, 59, 32768, 8839, + 101, 116, 59, 32768, 8913, 2816, 72, 82, 83, 97, 99, 102, + 104, 105, 111, 114, 115, 5213, 5221, 5227, 5241, 5252, 5274, + 5279, 5323, 5362, 5368, 5378, 79, 82, 78, 33024, 222, 59, + 32768, 222, 65, 68, 69, 59, 32768, 8482, 512, 72, 99, 5232, + 5237, 99, 121, 59, 32768, 1035, 121, 59, 32768, 1062, 512, + 98, 117, 5246, 5249, 59, 32768, 9, 59, 32768, 932, 768, 97, + 101, 121, 5259, 5265, 5271, 114, 111, 110, 59, 32768, 356, + 100, 105, 108, 59, 32768, 354, 59, 32768, 1058, 114, 59, + 32896, 55349, 56599, 512, 101, 105, 5284, 5300, 835, 5289, + 0, 5297, 101, 102, 111, 114, 101, 59, 32768, 8756, 97, 59, + 32768, 920, 512, 99, 110, 5305, 5315, 107, 83, 112, 97, 99, + 101, 59, 32896, 8287, 8202, 83, 112, 97, 99, 101, 59, 32768, + 8201, 108, 100, 101, 1024, 59, 69, 70, 84, 5335, 5337, 5344, + 5355, 32768, 8764, 113, 117, 97, 108, 59, 32768, 8771, 117, + 108, 108, 69, 113, 117, 97, 108, 59, 32768, 8773, 105, 108, + 100, 101, 59, 32768, 8776, 112, 102, 59, 32896, 55349, + 56651, 105, 112, 108, 101, 68, 111, 116, 59, 32768, 8411, + 512, 99, 116, 5383, 5388, 114, 59, 32896, 55349, 56495, 114, + 111, 107, 59, 32768, 358, 5426, 5417, 5444, 5458, 5473, 0, + 5480, 5485, 0, 0, 0, 0, 0, 5494, 5500, 5564, 5579, 0, 5726, + 5732, 5738, 5745, 512, 99, 114, 5421, 5429, 117, 116, 101, + 33024, 218, 59, 32768, 218, 114, 512, 59, 111, 5435, 5437, + 32768, 8607, 99, 105, 114, 59, 32768, 10569, 114, 820, 5449, + 0, 5453, 121, 59, 32768, 1038, 118, 101, 59, 32768, 364, + 512, 105, 121, 5462, 5469, 114, 99, 33024, 219, 59, 32768, + 219, 59, 32768, 1059, 98, 108, 97, 99, 59, 32768, 368, 114, + 59, 32896, 55349, 56600, 114, 97, 118, 101, 33024, 217, 59, + 32768, 217, 97, 99, 114, 59, 32768, 362, 512, 100, 105, + 5504, 5548, 101, 114, 512, 66, 80, 5511, 5535, 512, 97, 114, + 5516, 5520, 114, 59, 32768, 95, 97, 99, 512, 101, 107, 5527, + 5530, 59, 32768, 9183, 101, 116, 59, 32768, 9141, 97, 114, + 101, 110, 116, 104, 101, 115, 105, 115, 59, 32768, 9181, + 111, 110, 512, 59, 80, 5555, 5557, 32768, 8899, 108, 117, + 115, 59, 32768, 8846, 512, 103, 112, 5568, 5573, 111, 110, + 59, 32768, 370, 102, 59, 32896, 55349, 56652, 2048, 65, 68, + 69, 84, 97, 100, 112, 115, 5595, 5624, 5635, 5648, 5664, + 5671, 5682, 5712, 114, 114, 111, 119, 768, 59, 66, 68, 5606, + 5608, 5613, 32768, 8593, 97, 114, 59, 32768, 10514, 111, + 119, 110, 65, 114, 114, 111, 119, 59, 32768, 8645, 111, 119, + 110, 65, 114, 114, 111, 119, 59, 32768, 8597, 113, 117, 105, + 108, 105, 98, 114, 105, 117, 109, 59, 32768, 10606, 101, + 101, 512, 59, 65, 5655, 5657, 32768, 8869, 114, 114, 111, + 119, 59, 32768, 8613, 114, 114, 111, 119, 59, 32768, 8657, + 111, 119, 110, 97, 114, 114, 111, 119, 59, 32768, 8661, 101, + 114, 512, 76, 82, 5689, 5700, 101, 102, 116, 65, 114, 114, + 111, 119, 59, 32768, 8598, 105, 103, 104, 116, 65, 114, 114, + 111, 119, 59, 32768, 8599, 105, 512, 59, 108, 5718, 5720, + 32768, 978, 111, 110, 59, 32768, 933, 105, 110, 103, 59, + 32768, 366, 99, 114, 59, 32896, 55349, 56496, 105, 108, 100, + 101, 59, 32768, 360, 109, 108, 33024, 220, 59, 32768, 220, + 2304, 68, 98, 99, 100, 101, 102, 111, 115, 118, 5770, 5776, + 5781, 5785, 5798, 5878, 5883, 5889, 5895, 97, 115, 104, 59, + 32768, 8875, 97, 114, 59, 32768, 10987, 121, 59, 32768, + 1042, 97, 115, 104, 512, 59, 108, 5793, 5795, 32768, 8873, + 59, 32768, 10982, 512, 101, 114, 5803, 5806, 59, 32768, + 8897, 768, 98, 116, 121, 5813, 5818, 5866, 97, 114, 59, + 32768, 8214, 512, 59, 105, 5823, 5825, 32768, 8214, 99, 97, + 108, 1024, 66, 76, 83, 84, 5837, 5842, 5848, 5859, 97, 114, + 59, 32768, 8739, 105, 110, 101, 59, 32768, 124, 101, 112, + 97, 114, 97, 116, 111, 114, 59, 32768, 10072, 105, 108, 100, + 101, 59, 32768, 8768, 84, 104, 105, 110, 83, 112, 97, 99, + 101, 59, 32768, 8202, 114, 59, 32896, 55349, 56601, 112, + 102, 59, 32896, 55349, 56653, 99, 114, 59, 32896, 55349, + 56497, 100, 97, 115, 104, 59, 32768, 8874, 1280, 99, 101, + 102, 111, 115, 5913, 5919, 5925, 5930, 5936, 105, 114, 99, + 59, 32768, 372, 100, 103, 101, 59, 32768, 8896, 114, 59, + 32896, 55349, 56602, 112, 102, 59, 32896, 55349, 56654, 99, + 114, 59, 32896, 55349, 56498, 1024, 102, 105, 111, 115, + 5951, 5956, 5959, 5965, 114, 59, 32896, 55349, 56603, 59, + 32768, 926, 112, 102, 59, 32896, 55349, 56655, 99, 114, 59, + 32896, 55349, 56499, 2304, 65, 73, 85, 97, 99, 102, 111, + 115, 117, 5990, 5995, 6e3, 6005, 6014, 6027, 6032, 6038, + 6044, 99, 121, 59, 32768, 1071, 99, 121, 59, 32768, 1031, + 99, 121, 59, 32768, 1070, 99, 117, 116, 101, 33024, 221, 59, + 32768, 221, 512, 105, 121, 6019, 6024, 114, 99, 59, 32768, + 374, 59, 32768, 1067, 114, 59, 32896, 55349, 56604, 112, + 102, 59, 32896, 55349, 56656, 99, 114, 59, 32896, 55349, + 56500, 109, 108, 59, 32768, 376, 2048, 72, 97, 99, 100, 101, + 102, 111, 115, 6066, 6071, 6078, 6092, 6097, 6119, 6123, + 6128, 99, 121, 59, 32768, 1046, 99, 117, 116, 101, 59, + 32768, 377, 512, 97, 121, 6083, 6089, 114, 111, 110, 59, + 32768, 381, 59, 32768, 1047, 111, 116, 59, 32768, 379, 835, + 6102, 0, 6116, 111, 87, 105, 100, 116, 104, 83, 112, 97, 99, + 101, 59, 32768, 8203, 97, 59, 32768, 918, 114, 59, 32768, + 8488, 112, 102, 59, 32768, 8484, 99, 114, 59, 32896, 55349, + 56501, 5938, 6159, 6168, 6175, 0, 6214, 6222, 6233, 0, 0, 0, + 0, 6242, 6267, 6290, 6429, 6444, 0, 6495, 6503, 6531, 6540, + 0, 6547, 99, 117, 116, 101, 33024, 225, 59, 32768, 225, 114, + 101, 118, 101, 59, 32768, 259, 1536, 59, 69, 100, 105, 117, + 121, 6187, 6189, 6193, 6196, 6203, 6210, 32768, 8766, 59, + 32896, 8766, 819, 59, 32768, 8767, 114, 99, 33024, 226, 59, + 32768, 226, 116, 101, 33024, 180, 59, 32768, 180, 59, 32768, + 1072, 108, 105, 103, 33024, 230, 59, 32768, 230, 512, 59, + 114, 6226, 6228, 32768, 8289, 59, 32896, 55349, 56606, 114, + 97, 118, 101, 33024, 224, 59, 32768, 224, 512, 101, 112, + 6246, 6261, 512, 102, 112, 6251, 6257, 115, 121, 109, 59, + 32768, 8501, 104, 59, 32768, 8501, 104, 97, 59, 32768, 945, + 512, 97, 112, 6271, 6284, 512, 99, 108, 6276, 6280, 114, 59, + 32768, 257, 103, 59, 32768, 10815, 33024, 38, 59, 32768, 38, + 1077, 6295, 0, 0, 6326, 1280, 59, 97, 100, 115, 118, 6305, + 6307, 6312, 6315, 6322, 32768, 8743, 110, 100, 59, 32768, + 10837, 59, 32768, 10844, 108, 111, 112, 101, 59, 32768, + 10840, 59, 32768, 10842, 1792, 59, 101, 108, 109, 114, 115, + 122, 6340, 6342, 6345, 6349, 6391, 6410, 6422, 32768, 8736, + 59, 32768, 10660, 101, 59, 32768, 8736, 115, 100, 512, 59, + 97, 6356, 6358, 32768, 8737, 2098, 6368, 6371, 6374, 6377, + 6380, 6383, 6386, 6389, 59, 32768, 10664, 59, 32768, 10665, + 59, 32768, 10666, 59, 32768, 10667, 59, 32768, 10668, 59, + 32768, 10669, 59, 32768, 10670, 59, 32768, 10671, 116, 512, + 59, 118, 6397, 6399, 32768, 8735, 98, 512, 59, 100, 6405, + 6407, 32768, 8894, 59, 32768, 10653, 512, 112, 116, 6415, + 6419, 104, 59, 32768, 8738, 59, 32768, 197, 97, 114, 114, + 59, 32768, 9084, 512, 103, 112, 6433, 6438, 111, 110, 59, + 32768, 261, 102, 59, 32896, 55349, 56658, 1792, 59, 69, 97, + 101, 105, 111, 112, 6458, 6460, 6463, 6469, 6472, 6476, + 6480, 32768, 8776, 59, 32768, 10864, 99, 105, 114, 59, + 32768, 10863, 59, 32768, 8778, 100, 59, 32768, 8779, 115, + 59, 32768, 39, 114, 111, 120, 512, 59, 101, 6488, 6490, + 32768, 8776, 113, 59, 32768, 8778, 105, 110, 103, 33024, + 229, 59, 32768, 229, 768, 99, 116, 121, 6509, 6514, 6517, + 114, 59, 32896, 55349, 56502, 59, 32768, 42, 109, 112, 512, + 59, 101, 6524, 6526, 32768, 8776, 113, 59, 32768, 8781, 105, + 108, 100, 101, 33024, 227, 59, 32768, 227, 109, 108, 33024, + 228, 59, 32768, 228, 512, 99, 105, 6551, 6559, 111, 110, + 105, 110, 116, 59, 32768, 8755, 110, 116, 59, 32768, 10769, + 4096, 78, 97, 98, 99, 100, 101, 102, 105, 107, 108, 110, + 111, 112, 114, 115, 117, 6597, 6602, 6673, 6688, 6701, 6707, + 6768, 6773, 6891, 6898, 6999, 7023, 7309, 7316, 7334, 7383, + 111, 116, 59, 32768, 10989, 512, 99, 114, 6607, 6652, 107, + 1024, 99, 101, 112, 115, 6617, 6623, 6632, 6639, 111, 110, + 103, 59, 32768, 8780, 112, 115, 105, 108, 111, 110, 59, + 32768, 1014, 114, 105, 109, 101, 59, 32768, 8245, 105, 109, + 512, 59, 101, 6646, 6648, 32768, 8765, 113, 59, 32768, 8909, + 583, 6656, 6661, 101, 101, 59, 32768, 8893, 101, 100, 512, + 59, 103, 6667, 6669, 32768, 8965, 101, 59, 32768, 8965, 114, + 107, 512, 59, 116, 6680, 6682, 32768, 9141, 98, 114, 107, + 59, 32768, 9142, 512, 111, 121, 6693, 6698, 110, 103, 59, + 32768, 8780, 59, 32768, 1073, 113, 117, 111, 59, 32768, + 8222, 1280, 99, 109, 112, 114, 116, 6718, 6731, 6738, 6743, + 6749, 97, 117, 115, 512, 59, 101, 6726, 6728, 32768, 8757, + 59, 32768, 8757, 112, 116, 121, 118, 59, 32768, 10672, 115, + 105, 59, 32768, 1014, 110, 111, 117, 59, 32768, 8492, 768, + 97, 104, 119, 6756, 6759, 6762, 59, 32768, 946, 59, 32768, + 8502, 101, 101, 110, 59, 32768, 8812, 114, 59, 32896, 55349, + 56607, 103, 1792, 99, 111, 115, 116, 117, 118, 119, 6789, + 6809, 6834, 6850, 6872, 6879, 6884, 768, 97, 105, 117, 6796, + 6800, 6805, 112, 59, 32768, 8898, 114, 99, 59, 32768, 9711, + 112, 59, 32768, 8899, 768, 100, 112, 116, 6816, 6821, 6827, + 111, 116, 59, 32768, 10752, 108, 117, 115, 59, 32768, 10753, + 105, 109, 101, 115, 59, 32768, 10754, 1090, 6840, 0, 0, + 6846, 99, 117, 112, 59, 32768, 10758, 97, 114, 59, 32768, + 9733, 114, 105, 97, 110, 103, 108, 101, 512, 100, 117, 6862, + 6868, 111, 119, 110, 59, 32768, 9661, 112, 59, 32768, 9651, + 112, 108, 117, 115, 59, 32768, 10756, 101, 101, 59, 32768, + 8897, 101, 100, 103, 101, 59, 32768, 8896, 97, 114, 111, + 119, 59, 32768, 10509, 768, 97, 107, 111, 6905, 6976, 6994, + 512, 99, 110, 6910, 6972, 107, 768, 108, 115, 116, 6918, + 6927, 6935, 111, 122, 101, 110, 103, 101, 59, 32768, 10731, + 113, 117, 97, 114, 101, 59, 32768, 9642, 114, 105, 97, 110, + 103, 108, 101, 1024, 59, 100, 108, 114, 6951, 6953, 6959, + 6965, 32768, 9652, 111, 119, 110, 59, 32768, 9662, 101, 102, + 116, 59, 32768, 9666, 105, 103, 104, 116, 59, 32768, 9656, + 107, 59, 32768, 9251, 770, 6981, 0, 6991, 771, 6985, 0, + 6988, 59, 32768, 9618, 59, 32768, 9617, 52, 59, 32768, 9619, + 99, 107, 59, 32768, 9608, 512, 101, 111, 7004, 7019, 512, + 59, 113, 7009, 7012, 32896, 61, 8421, 117, 105, 118, 59, + 32896, 8801, 8421, 116, 59, 32768, 8976, 1024, 112, 116, + 119, 120, 7032, 7037, 7049, 7055, 102, 59, 32896, 55349, + 56659, 512, 59, 116, 7042, 7044, 32768, 8869, 111, 109, 59, + 32768, 8869, 116, 105, 101, 59, 32768, 8904, 3072, 68, 72, + 85, 86, 98, 100, 104, 109, 112, 116, 117, 118, 7080, 7101, + 7126, 7147, 7182, 7187, 7208, 7233, 7240, 7246, 7253, 7274, + 1024, 76, 82, 108, 114, 7089, 7092, 7095, 7098, 59, 32768, + 9559, 59, 32768, 9556, 59, 32768, 9558, 59, 32768, 9555, + 1280, 59, 68, 85, 100, 117, 7112, 7114, 7117, 7120, 7123, + 32768, 9552, 59, 32768, 9574, 59, 32768, 9577, 59, 32768, + 9572, 59, 32768, 9575, 1024, 76, 82, 108, 114, 7135, 7138, + 7141, 7144, 59, 32768, 9565, 59, 32768, 9562, 59, 32768, + 9564, 59, 32768, 9561, 1792, 59, 72, 76, 82, 104, 108, 114, + 7162, 7164, 7167, 7170, 7173, 7176, 7179, 32768, 9553, 59, + 32768, 9580, 59, 32768, 9571, 59, 32768, 9568, 59, 32768, + 9579, 59, 32768, 9570, 59, 32768, 9567, 111, 120, 59, 32768, + 10697, 1024, 76, 82, 108, 114, 7196, 7199, 7202, 7205, 59, + 32768, 9557, 59, 32768, 9554, 59, 32768, 9488, 59, 32768, + 9484, 1280, 59, 68, 85, 100, 117, 7219, 7221, 7224, 7227, + 7230, 32768, 9472, 59, 32768, 9573, 59, 32768, 9576, 59, + 32768, 9516, 59, 32768, 9524, 105, 110, 117, 115, 59, 32768, + 8863, 108, 117, 115, 59, 32768, 8862, 105, 109, 101, 115, + 59, 32768, 8864, 1024, 76, 82, 108, 114, 7262, 7265, 7268, + 7271, 59, 32768, 9563, 59, 32768, 9560, 59, 32768, 9496, 59, + 32768, 9492, 1792, 59, 72, 76, 82, 104, 108, 114, 7289, + 7291, 7294, 7297, 7300, 7303, 7306, 32768, 9474, 59, 32768, + 9578, 59, 32768, 9569, 59, 32768, 9566, 59, 32768, 9532, 59, + 32768, 9508, 59, 32768, 9500, 114, 105, 109, 101, 59, 32768, + 8245, 512, 101, 118, 7321, 7326, 118, 101, 59, 32768, 728, + 98, 97, 114, 33024, 166, 59, 32768, 166, 1024, 99, 101, 105, + 111, 7343, 7348, 7353, 7364, 114, 59, 32896, 55349, 56503, + 109, 105, 59, 32768, 8271, 109, 512, 59, 101, 7359, 7361, + 32768, 8765, 59, 32768, 8909, 108, 768, 59, 98, 104, 7372, + 7374, 7377, 32768, 92, 59, 32768, 10693, 115, 117, 98, 59, + 32768, 10184, 573, 7387, 7399, 108, 512, 59, 101, 7392, + 7394, 32768, 8226, 116, 59, 32768, 8226, 112, 768, 59, 69, + 101, 7406, 7408, 7411, 32768, 8782, 59, 32768, 10926, 512, + 59, 113, 7416, 7418, 32768, 8783, 59, 32768, 8783, 6450, + 7448, 0, 7523, 7571, 7576, 7613, 0, 7618, 7647, 0, 0, 7764, + 0, 0, 7779, 0, 0, 7899, 7914, 7949, 7955, 0, 8158, 0, 8176, + 768, 99, 112, 114, 7454, 7460, 7509, 117, 116, 101, 59, + 32768, 263, 1536, 59, 97, 98, 99, 100, 115, 7473, 7475, + 7480, 7487, 7500, 7505, 32768, 8745, 110, 100, 59, 32768, + 10820, 114, 99, 117, 112, 59, 32768, 10825, 512, 97, 117, + 7492, 7496, 112, 59, 32768, 10827, 112, 59, 32768, 10823, + 111, 116, 59, 32768, 10816, 59, 32896, 8745, 65024, 512, + 101, 111, 7514, 7518, 116, 59, 32768, 8257, 110, 59, 32768, + 711, 1024, 97, 101, 105, 117, 7531, 7544, 7552, 7557, 833, + 7536, 0, 7540, 115, 59, 32768, 10829, 111, 110, 59, 32768, + 269, 100, 105, 108, 33024, 231, 59, 32768, 231, 114, 99, 59, + 32768, 265, 112, 115, 512, 59, 115, 7564, 7566, 32768, + 10828, 109, 59, 32768, 10832, 111, 116, 59, 32768, 267, 768, + 100, 109, 110, 7582, 7589, 7596, 105, 108, 33024, 184, 59, + 32768, 184, 112, 116, 121, 118, 59, 32768, 10674, 116, + 33280, 162, 59, 101, 7603, 7605, 32768, 162, 114, 100, 111, + 116, 59, 32768, 183, 114, 59, 32896, 55349, 56608, 768, 99, + 101, 105, 7624, 7628, 7643, 121, 59, 32768, 1095, 99, 107, + 512, 59, 109, 7635, 7637, 32768, 10003, 97, 114, 107, 59, + 32768, 10003, 59, 32768, 967, 114, 1792, 59, 69, 99, 101, + 102, 109, 115, 7662, 7664, 7667, 7742, 7745, 7752, 7757, + 32768, 9675, 59, 32768, 10691, 768, 59, 101, 108, 7674, + 7676, 7680, 32768, 710, 113, 59, 32768, 8791, 101, 1074, + 7687, 0, 0, 7709, 114, 114, 111, 119, 512, 108, 114, 7695, + 7701, 101, 102, 116, 59, 32768, 8634, 105, 103, 104, 116, + 59, 32768, 8635, 1280, 82, 83, 97, 99, 100, 7719, 7722, + 7725, 7730, 7736, 59, 32768, 174, 59, 32768, 9416, 115, 116, + 59, 32768, 8859, 105, 114, 99, 59, 32768, 8858, 97, 115, + 104, 59, 32768, 8861, 59, 32768, 8791, 110, 105, 110, 116, + 59, 32768, 10768, 105, 100, 59, 32768, 10991, 99, 105, 114, + 59, 32768, 10690, 117, 98, 115, 512, 59, 117, 7771, 7773, + 32768, 9827, 105, 116, 59, 32768, 9827, 1341, 7785, 7804, + 7850, 0, 7871, 111, 110, 512, 59, 101, 7791, 7793, 32768, + 58, 512, 59, 113, 7798, 7800, 32768, 8788, 59, 32768, 8788, + 1086, 7809, 0, 0, 7820, 97, 512, 59, 116, 7814, 7816, 32768, + 44, 59, 32768, 64, 768, 59, 102, 108, 7826, 7828, 7832, + 32768, 8705, 110, 59, 32768, 8728, 101, 512, 109, 120, 7838, + 7844, 101, 110, 116, 59, 32768, 8705, 101, 115, 59, 32768, + 8450, 824, 7854, 0, 7866, 512, 59, 100, 7858, 7860, 32768, + 8773, 111, 116, 59, 32768, 10861, 110, 116, 59, 32768, 8750, + 768, 102, 114, 121, 7877, 7881, 7886, 59, 32896, 55349, + 56660, 111, 100, 59, 32768, 8720, 33280, 169, 59, 115, 7892, + 7894, 32768, 169, 114, 59, 32768, 8471, 512, 97, 111, 7903, + 7908, 114, 114, 59, 32768, 8629, 115, 115, 59, 32768, 10007, + 512, 99, 117, 7918, 7923, 114, 59, 32896, 55349, 56504, 512, + 98, 112, 7928, 7938, 512, 59, 101, 7933, 7935, 32768, 10959, + 59, 32768, 10961, 512, 59, 101, 7943, 7945, 32768, 10960, + 59, 32768, 10962, 100, 111, 116, 59, 32768, 8943, 1792, 100, + 101, 108, 112, 114, 118, 119, 7969, 7983, 7996, 8009, 8057, + 8147, 8152, 97, 114, 114, 512, 108, 114, 7977, 7980, 59, + 32768, 10552, 59, 32768, 10549, 1089, 7989, 0, 0, 7993, 114, + 59, 32768, 8926, 99, 59, 32768, 8927, 97, 114, 114, 512, 59, + 112, 8004, 8006, 32768, 8630, 59, 32768, 10557, 1536, 59, + 98, 99, 100, 111, 115, 8022, 8024, 8031, 8044, 8049, 8053, + 32768, 8746, 114, 99, 97, 112, 59, 32768, 10824, 512, 97, + 117, 8036, 8040, 112, 59, 32768, 10822, 112, 59, 32768, + 10826, 111, 116, 59, 32768, 8845, 114, 59, 32768, 10821, 59, + 32896, 8746, 65024, 1024, 97, 108, 114, 118, 8066, 8078, + 8116, 8123, 114, 114, 512, 59, 109, 8073, 8075, 32768, 8631, + 59, 32768, 10556, 121, 768, 101, 118, 119, 8086, 8104, 8109, + 113, 1089, 8093, 0, 0, 8099, 114, 101, 99, 59, 32768, 8926, + 117, 99, 99, 59, 32768, 8927, 101, 101, 59, 32768, 8910, + 101, 100, 103, 101, 59, 32768, 8911, 101, 110, 33024, 164, + 59, 32768, 164, 101, 97, 114, 114, 111, 119, 512, 108, 114, + 8134, 8140, 101, 102, 116, 59, 32768, 8630, 105, 103, 104, + 116, 59, 32768, 8631, 101, 101, 59, 32768, 8910, 101, 100, + 59, 32768, 8911, 512, 99, 105, 8162, 8170, 111, 110, 105, + 110, 116, 59, 32768, 8754, 110, 116, 59, 32768, 8753, 108, + 99, 116, 121, 59, 32768, 9005, 4864, 65, 72, 97, 98, 99, + 100, 101, 102, 104, 105, 106, 108, 111, 114, 115, 116, 117, + 119, 122, 8221, 8226, 8231, 8267, 8282, 8296, 8327, 8351, + 8366, 8379, 8466, 8471, 8487, 8621, 8647, 8676, 8697, 8712, + 8720, 114, 114, 59, 32768, 8659, 97, 114, 59, 32768, 10597, + 1024, 103, 108, 114, 115, 8240, 8246, 8252, 8256, 103, 101, + 114, 59, 32768, 8224, 101, 116, 104, 59, 32768, 8504, 114, + 59, 32768, 8595, 104, 512, 59, 118, 8262, 8264, 32768, 8208, + 59, 32768, 8867, 572, 8271, 8278, 97, 114, 111, 119, 59, + 32768, 10511, 97, 99, 59, 32768, 733, 512, 97, 121, 8287, + 8293, 114, 111, 110, 59, 32768, 271, 59, 32768, 1076, 768, + 59, 97, 111, 8303, 8305, 8320, 32768, 8518, 512, 103, 114, + 8310, 8316, 103, 101, 114, 59, 32768, 8225, 114, 59, 32768, + 8650, 116, 115, 101, 113, 59, 32768, 10871, 768, 103, 108, + 109, 8334, 8339, 8344, 33024, 176, 59, 32768, 176, 116, 97, + 59, 32768, 948, 112, 116, 121, 118, 59, 32768, 10673, 512, + 105, 114, 8356, 8362, 115, 104, 116, 59, 32768, 10623, 59, + 32896, 55349, 56609, 97, 114, 512, 108, 114, 8373, 8376, 59, + 32768, 8643, 59, 32768, 8642, 1280, 97, 101, 103, 115, 118, + 8390, 8418, 8421, 8428, 8433, 109, 768, 59, 111, 115, 8398, + 8400, 8415, 32768, 8900, 110, 100, 512, 59, 115, 8407, 8409, + 32768, 8900, 117, 105, 116, 59, 32768, 9830, 59, 32768, + 9830, 59, 32768, 168, 97, 109, 109, 97, 59, 32768, 989, 105, + 110, 59, 32768, 8946, 768, 59, 105, 111, 8440, 8442, 8461, + 32768, 247, 100, 101, 33280, 247, 59, 111, 8450, 8452, + 32768, 247, 110, 116, 105, 109, 101, 115, 59, 32768, 8903, + 110, 120, 59, 32768, 8903, 99, 121, 59, 32768, 1106, 99, + 1088, 8478, 0, 0, 8483, 114, 110, 59, 32768, 8990, 111, 112, + 59, 32768, 8973, 1280, 108, 112, 116, 117, 119, 8498, 8504, + 8509, 8556, 8570, 108, 97, 114, 59, 32768, 36, 102, 59, + 32896, 55349, 56661, 1280, 59, 101, 109, 112, 115, 8520, + 8522, 8535, 8542, 8548, 32768, 729, 113, 512, 59, 100, 8528, + 8530, 32768, 8784, 111, 116, 59, 32768, 8785, 105, 110, 117, + 115, 59, 32768, 8760, 108, 117, 115, 59, 32768, 8724, 113, + 117, 97, 114, 101, 59, 32768, 8865, 98, 108, 101, 98, 97, + 114, 119, 101, 100, 103, 101, 59, 32768, 8966, 110, 768, 97, + 100, 104, 8578, 8585, 8597, 114, 114, 111, 119, 59, 32768, + 8595, 111, 119, 110, 97, 114, 114, 111, 119, 115, 59, 32768, + 8650, 97, 114, 112, 111, 111, 110, 512, 108, 114, 8608, + 8614, 101, 102, 116, 59, 32768, 8643, 105, 103, 104, 116, + 59, 32768, 8642, 563, 8625, 8633, 107, 97, 114, 111, 119, + 59, 32768, 10512, 1088, 8638, 0, 0, 8643, 114, 110, 59, + 32768, 8991, 111, 112, 59, 32768, 8972, 768, 99, 111, 116, + 8654, 8666, 8670, 512, 114, 121, 8659, 8663, 59, 32896, + 55349, 56505, 59, 32768, 1109, 108, 59, 32768, 10742, 114, + 111, 107, 59, 32768, 273, 512, 100, 114, 8681, 8686, 111, + 116, 59, 32768, 8945, 105, 512, 59, 102, 8692, 8694, 32768, + 9663, 59, 32768, 9662, 512, 97, 104, 8702, 8707, 114, 114, + 59, 32768, 8693, 97, 114, 59, 32768, 10607, 97, 110, 103, + 108, 101, 59, 32768, 10662, 512, 99, 105, 8725, 8729, 121, + 59, 32768, 1119, 103, 114, 97, 114, 114, 59, 32768, 10239, + 4608, 68, 97, 99, 100, 101, 102, 103, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 120, 8774, 8788, 8807, 8844, + 8849, 8852, 8866, 8895, 8929, 8977, 8989, 9004, 9046, 9136, + 9151, 9171, 9184, 9199, 512, 68, 111, 8779, 8784, 111, 116, + 59, 32768, 10871, 116, 59, 32768, 8785, 512, 99, 115, 8793, + 8801, 117, 116, 101, 33024, 233, 59, 32768, 233, 116, 101, + 114, 59, 32768, 10862, 1024, 97, 105, 111, 121, 8816, 8822, + 8835, 8841, 114, 111, 110, 59, 32768, 283, 114, 512, 59, 99, + 8828, 8830, 32768, 8790, 33024, 234, 59, 32768, 234, 108, + 111, 110, 59, 32768, 8789, 59, 32768, 1101, 111, 116, 59, + 32768, 279, 59, 32768, 8519, 512, 68, 114, 8857, 8862, 111, + 116, 59, 32768, 8786, 59, 32896, 55349, 56610, 768, 59, 114, + 115, 8873, 8875, 8883, 32768, 10906, 97, 118, 101, 33024, + 232, 59, 32768, 232, 512, 59, 100, 8888, 8890, 32768, 10902, + 111, 116, 59, 32768, 10904, 1024, 59, 105, 108, 115, 8904, + 8906, 8914, 8917, 32768, 10905, 110, 116, 101, 114, 115, 59, + 32768, 9191, 59, 32768, 8467, 512, 59, 100, 8922, 8924, + 32768, 10901, 111, 116, 59, 32768, 10903, 768, 97, 112, 115, + 8936, 8941, 8960, 99, 114, 59, 32768, 275, 116, 121, 768, + 59, 115, 118, 8950, 8952, 8957, 32768, 8709, 101, 116, 59, + 32768, 8709, 59, 32768, 8709, 112, 512, 49, 59, 8966, 8975, + 516, 8970, 8973, 59, 32768, 8196, 59, 32768, 8197, 32768, + 8195, 512, 103, 115, 8982, 8985, 59, 32768, 331, 112, 59, + 32768, 8194, 512, 103, 112, 8994, 8999, 111, 110, 59, 32768, + 281, 102, 59, 32896, 55349, 56662, 768, 97, 108, 115, 9011, + 9023, 9028, 114, 512, 59, 115, 9017, 9019, 32768, 8917, 108, + 59, 32768, 10723, 117, 115, 59, 32768, 10865, 105, 768, 59, + 108, 118, 9036, 9038, 9043, 32768, 949, 111, 110, 59, 32768, + 949, 59, 32768, 1013, 1024, 99, 115, 117, 118, 9055, 9071, + 9099, 9128, 512, 105, 111, 9060, 9065, 114, 99, 59, 32768, + 8790, 108, 111, 110, 59, 32768, 8789, 1082, 9077, 0, 0, + 9081, 109, 59, 32768, 8770, 97, 110, 116, 512, 103, 108, + 9088, 9093, 116, 114, 59, 32768, 10902, 101, 115, 115, 59, + 32768, 10901, 768, 97, 101, 105, 9106, 9111, 9116, 108, 115, + 59, 32768, 61, 115, 116, 59, 32768, 8799, 118, 512, 59, 68, + 9122, 9124, 32768, 8801, 68, 59, 32768, 10872, 112, 97, 114, + 115, 108, 59, 32768, 10725, 512, 68, 97, 9141, 9146, 111, + 116, 59, 32768, 8787, 114, 114, 59, 32768, 10609, 768, 99, + 100, 105, 9158, 9162, 9167, 114, 59, 32768, 8495, 111, 116, + 59, 32768, 8784, 109, 59, 32768, 8770, 512, 97, 104, 9176, + 9179, 59, 32768, 951, 33024, 240, 59, 32768, 240, 512, 109, + 114, 9189, 9195, 108, 33024, 235, 59, 32768, 235, 111, 59, + 32768, 8364, 768, 99, 105, 112, 9206, 9210, 9215, 108, 59, + 32768, 33, 115, 116, 59, 32768, 8707, 512, 101, 111, 9220, + 9230, 99, 116, 97, 116, 105, 111, 110, 59, 32768, 8496, 110, + 101, 110, 116, 105, 97, 108, 101, 59, 32768, 8519, 4914, + 9262, 0, 9276, 0, 9280, 9287, 0, 0, 9318, 9324, 0, 9331, 0, + 9352, 9357, 9386, 0, 9395, 9497, 108, 108, 105, 110, 103, + 100, 111, 116, 115, 101, 113, 59, 32768, 8786, 121, 59, + 32768, 1092, 109, 97, 108, 101, 59, 32768, 9792, 768, 105, + 108, 114, 9293, 9299, 9313, 108, 105, 103, 59, 32768, 64259, + 1082, 9305, 0, 0, 9309, 103, 59, 32768, 64256, 105, 103, 59, + 32768, 64260, 59, 32896, 55349, 56611, 108, 105, 103, 59, + 32768, 64257, 108, 105, 103, 59, 32896, 102, 106, 768, 97, + 108, 116, 9337, 9341, 9346, 116, 59, 32768, 9837, 105, 103, + 59, 32768, 64258, 110, 115, 59, 32768, 9649, 111, 102, 59, + 32768, 402, 833, 9361, 0, 9366, 102, 59, 32896, 55349, + 56663, 512, 97, 107, 9370, 9375, 108, 108, 59, 32768, 8704, + 512, 59, 118, 9380, 9382, 32768, 8916, 59, 32768, 10969, 97, + 114, 116, 105, 110, 116, 59, 32768, 10765, 512, 97, 111, + 9399, 9491, 512, 99, 115, 9404, 9487, 1794, 9413, 9443, + 9453, 9470, 9474, 0, 9484, 1795, 9421, 9426, 9429, 9434, + 9437, 0, 9440, 33024, 189, 59, 32768, 189, 59, 32768, 8531, + 33024, 188, 59, 32768, 188, 59, 32768, 8533, 59, 32768, + 8537, 59, 32768, 8539, 772, 9447, 0, 9450, 59, 32768, 8532, + 59, 32768, 8534, 1285, 9459, 9464, 0, 0, 9467, 33024, 190, + 59, 32768, 190, 59, 32768, 8535, 59, 32768, 8540, 53, 59, + 32768, 8536, 775, 9478, 0, 9481, 59, 32768, 8538, 59, 32768, + 8541, 56, 59, 32768, 8542, 108, 59, 32768, 8260, 119, 110, + 59, 32768, 8994, 99, 114, 59, 32896, 55349, 56507, 4352, 69, + 97, 98, 99, 100, 101, 102, 103, 105, 106, 108, 110, 111, + 114, 115, 116, 118, 9537, 9547, 9575, 9582, 9595, 9600, + 9679, 9684, 9694, 9700, 9705, 9725, 9773, 9779, 9785, 9810, + 9917, 512, 59, 108, 9542, 9544, 32768, 8807, 59, 32768, + 10892, 768, 99, 109, 112, 9554, 9560, 9572, 117, 116, 101, + 59, 32768, 501, 109, 97, 512, 59, 100, 9567, 9569, 32768, + 947, 59, 32768, 989, 59, 32768, 10886, 114, 101, 118, 101, + 59, 32768, 287, 512, 105, 121, 9587, 9592, 114, 99, 59, + 32768, 285, 59, 32768, 1075, 111, 116, 59, 32768, 289, 1024, + 59, 108, 113, 115, 9609, 9611, 9614, 9633, 32768, 8805, 59, + 32768, 8923, 768, 59, 113, 115, 9621, 9623, 9626, 32768, + 8805, 59, 32768, 8807, 108, 97, 110, 116, 59, 32768, 10878, + 1024, 59, 99, 100, 108, 9642, 9644, 9648, 9667, 32768, + 10878, 99, 59, 32768, 10921, 111, 116, 512, 59, 111, 9655, + 9657, 32768, 10880, 512, 59, 108, 9662, 9664, 32768, 10882, + 59, 32768, 10884, 512, 59, 101, 9672, 9675, 32896, 8923, + 65024, 115, 59, 32768, 10900, 114, 59, 32896, 55349, 56612, + 512, 59, 103, 9689, 9691, 32768, 8811, 59, 32768, 8921, 109, + 101, 108, 59, 32768, 8503, 99, 121, 59, 32768, 1107, 1024, + 59, 69, 97, 106, 9714, 9716, 9719, 9722, 32768, 8823, 59, + 32768, 10898, 59, 32768, 10917, 59, 32768, 10916, 1024, 69, + 97, 101, 115, 9734, 9737, 9751, 9768, 59, 32768, 8809, 112, + 512, 59, 112, 9743, 9745, 32768, 10890, 114, 111, 120, 59, + 32768, 10890, 512, 59, 113, 9756, 9758, 32768, 10888, 512, + 59, 113, 9763, 9765, 32768, 10888, 59, 32768, 8809, 105, + 109, 59, 32768, 8935, 112, 102, 59, 32896, 55349, 56664, 97, + 118, 101, 59, 32768, 96, 512, 99, 105, 9790, 9794, 114, 59, + 32768, 8458, 109, 768, 59, 101, 108, 9802, 9804, 9807, + 32768, 8819, 59, 32768, 10894, 59, 32768, 10896, 34304, 62, + 59, 99, 100, 108, 113, 114, 9824, 9826, 9838, 9843, 9849, + 9856, 32768, 62, 512, 99, 105, 9831, 9834, 59, 32768, 10919, + 114, 59, 32768, 10874, 111, 116, 59, 32768, 8919, 80, 97, + 114, 59, 32768, 10645, 117, 101, 115, 116, 59, 32768, 10876, + 1280, 97, 100, 101, 108, 115, 9867, 9882, 9887, 9906, 9912, + 833, 9872, 0, 9879, 112, 114, 111, 120, 59, 32768, 10886, + 114, 59, 32768, 10616, 111, 116, 59, 32768, 8919, 113, 512, + 108, 113, 9893, 9899, 101, 115, 115, 59, 32768, 8923, 108, + 101, 115, 115, 59, 32768, 10892, 101, 115, 115, 59, 32768, + 8823, 105, 109, 59, 32768, 8819, 512, 101, 110, 9922, 9932, + 114, 116, 110, 101, 113, 113, 59, 32896, 8809, 65024, 69, + 59, 32896, 8809, 65024, 2560, 65, 97, 98, 99, 101, 102, 107, + 111, 115, 121, 9958, 9963, 10015, 10020, 10026, 10060, + 10065, 10085, 10147, 10171, 114, 114, 59, 32768, 8660, 1024, + 105, 108, 109, 114, 9972, 9978, 9982, 9988, 114, 115, 112, + 59, 32768, 8202, 102, 59, 32768, 189, 105, 108, 116, 59, + 32768, 8459, 512, 100, 114, 9993, 9998, 99, 121, 59, 32768, + 1098, 768, 59, 99, 119, 10005, 10007, 10012, 32768, 8596, + 105, 114, 59, 32768, 10568, 59, 32768, 8621, 97, 114, 59, + 32768, 8463, 105, 114, 99, 59, 32768, 293, 768, 97, 108, + 114, 10033, 10048, 10054, 114, 116, 115, 512, 59, 117, + 10041, 10043, 32768, 9829, 105, 116, 59, 32768, 9829, 108, + 105, 112, 59, 32768, 8230, 99, 111, 110, 59, 32768, 8889, + 114, 59, 32896, 55349, 56613, 115, 512, 101, 119, 10071, + 10078, 97, 114, 111, 119, 59, 32768, 10533, 97, 114, 111, + 119, 59, 32768, 10534, 1280, 97, 109, 111, 112, 114, 10096, + 10101, 10107, 10136, 10141, 114, 114, 59, 32768, 8703, 116, + 104, 116, 59, 32768, 8763, 107, 512, 108, 114, 10113, 10124, + 101, 102, 116, 97, 114, 114, 111, 119, 59, 32768, 8617, 105, + 103, 104, 116, 97, 114, 114, 111, 119, 59, 32768, 8618, 102, + 59, 32896, 55349, 56665, 98, 97, 114, 59, 32768, 8213, 768, + 99, 108, 116, 10154, 10159, 10165, 114, 59, 32896, 55349, + 56509, 97, 115, 104, 59, 32768, 8463, 114, 111, 107, 59, + 32768, 295, 512, 98, 112, 10176, 10182, 117, 108, 108, 59, + 32768, 8259, 104, 101, 110, 59, 32768, 8208, 5426, 10211, 0, + 10220, 0, 10239, 10255, 10267, 0, 10276, 10312, 0, 0, 10318, + 10371, 10458, 10485, 10491, 0, 10500, 10545, 10558, 99, 117, + 116, 101, 33024, 237, 59, 32768, 237, 768, 59, 105, 121, + 10226, 10228, 10235, 32768, 8291, 114, 99, 33024, 238, 59, + 32768, 238, 59, 32768, 1080, 512, 99, 120, 10243, 10247, + 121, 59, 32768, 1077, 99, 108, 33024, 161, 59, 32768, 161, + 512, 102, 114, 10259, 10262, 59, 32768, 8660, 59, 32896, + 55349, 56614, 114, 97, 118, 101, 33024, 236, 59, 32768, 236, + 1024, 59, 105, 110, 111, 10284, 10286, 10300, 10306, 32768, + 8520, 512, 105, 110, 10291, 10296, 110, 116, 59, 32768, + 10764, 116, 59, 32768, 8749, 102, 105, 110, 59, 32768, + 10716, 116, 97, 59, 32768, 8489, 108, 105, 103, 59, 32768, + 307, 768, 97, 111, 112, 10324, 10361, 10365, 768, 99, 103, + 116, 10331, 10335, 10357, 114, 59, 32768, 299, 768, 101, + 108, 112, 10342, 10345, 10351, 59, 32768, 8465, 105, 110, + 101, 59, 32768, 8464, 97, 114, 116, 59, 32768, 8465, 104, + 59, 32768, 305, 102, 59, 32768, 8887, 101, 100, 59, 32768, + 437, 1280, 59, 99, 102, 111, 116, 10381, 10383, 10389, + 10403, 10409, 32768, 8712, 97, 114, 101, 59, 32768, 8453, + 105, 110, 512, 59, 116, 10396, 10398, 32768, 8734, 105, 101, + 59, 32768, 10717, 100, 111, 116, 59, 32768, 305, 1280, 59, + 99, 101, 108, 112, 10420, 10422, 10427, 10444, 10451, 32768, + 8747, 97, 108, 59, 32768, 8890, 512, 103, 114, 10432, 10438, + 101, 114, 115, 59, 32768, 8484, 99, 97, 108, 59, 32768, + 8890, 97, 114, 104, 107, 59, 32768, 10775, 114, 111, 100, + 59, 32768, 10812, 1024, 99, 103, 112, 116, 10466, 10470, + 10475, 10480, 121, 59, 32768, 1105, 111, 110, 59, 32768, + 303, 102, 59, 32896, 55349, 56666, 97, 59, 32768, 953, 114, + 111, 100, 59, 32768, 10812, 117, 101, 115, 116, 33024, 191, + 59, 32768, 191, 512, 99, 105, 10504, 10509, 114, 59, 32896, + 55349, 56510, 110, 1280, 59, 69, 100, 115, 118, 10521, + 10523, 10526, 10531, 10541, 32768, 8712, 59, 32768, 8953, + 111, 116, 59, 32768, 8949, 512, 59, 118, 10536, 10538, + 32768, 8948, 59, 32768, 8947, 59, 32768, 8712, 512, 59, 105, + 10549, 10551, 32768, 8290, 108, 100, 101, 59, 32768, 297, + 828, 10562, 0, 10567, 99, 121, 59, 32768, 1110, 108, 33024, + 239, 59, 32768, 239, 1536, 99, 102, 109, 111, 115, 117, + 10585, 10598, 10603, 10609, 10615, 10630, 512, 105, 121, + 10590, 10595, 114, 99, 59, 32768, 309, 59, 32768, 1081, 114, + 59, 32896, 55349, 56615, 97, 116, 104, 59, 32768, 567, 112, + 102, 59, 32896, 55349, 56667, 820, 10620, 0, 10625, 114, 59, + 32896, 55349, 56511, 114, 99, 121, 59, 32768, 1112, 107, 99, + 121, 59, 32768, 1108, 2048, 97, 99, 102, 103, 104, 106, 111, + 115, 10653, 10666, 10680, 10685, 10692, 10697, 10702, 10708, + 112, 112, 97, 512, 59, 118, 10661, 10663, 32768, 954, 59, + 32768, 1008, 512, 101, 121, 10671, 10677, 100, 105, 108, 59, + 32768, 311, 59, 32768, 1082, 114, 59, 32896, 55349, 56616, + 114, 101, 101, 110, 59, 32768, 312, 99, 121, 59, 32768, + 1093, 99, 121, 59, 32768, 1116, 112, 102, 59, 32896, 55349, + 56668, 99, 114, 59, 32896, 55349, 56512, 5888, 65, 66, 69, + 72, 97, 98, 99, 100, 101, 102, 103, 104, 106, 108, 109, 110, + 111, 112, 114, 115, 116, 117, 118, 10761, 10783, 10789, + 10799, 10804, 10957, 11011, 11047, 11094, 11349, 11372, + 11382, 11409, 11414, 11451, 11478, 11526, 11698, 11711, + 11755, 11823, 11910, 11929, 768, 97, 114, 116, 10768, 10773, + 10777, 114, 114, 59, 32768, 8666, 114, 59, 32768, 8656, 97, + 105, 108, 59, 32768, 10523, 97, 114, 114, 59, 32768, 10510, + 512, 59, 103, 10794, 10796, 32768, 8806, 59, 32768, 10891, + 97, 114, 59, 32768, 10594, 4660, 10824, 0, 10830, 0, 10838, + 0, 0, 0, 0, 0, 10844, 10850, 0, 10867, 10870, 10877, 0, + 10933, 117, 116, 101, 59, 32768, 314, 109, 112, 116, 121, + 118, 59, 32768, 10676, 114, 97, 110, 59, 32768, 8466, 98, + 100, 97, 59, 32768, 955, 103, 768, 59, 100, 108, 10857, + 10859, 10862, 32768, 10216, 59, 32768, 10641, 101, 59, + 32768, 10216, 59, 32768, 10885, 117, 111, 33024, 171, 59, + 32768, 171, 114, 2048, 59, 98, 102, 104, 108, 112, 115, 116, + 10894, 10896, 10907, 10911, 10915, 10919, 10923, 10928, + 32768, 8592, 512, 59, 102, 10901, 10903, 32768, 8676, 115, + 59, 32768, 10527, 115, 59, 32768, 10525, 107, 59, 32768, + 8617, 112, 59, 32768, 8619, 108, 59, 32768, 10553, 105, 109, + 59, 32768, 10611, 108, 59, 32768, 8610, 768, 59, 97, 101, + 10939, 10941, 10946, 32768, 10923, 105, 108, 59, 32768, + 10521, 512, 59, 115, 10951, 10953, 32768, 10925, 59, 32896, + 10925, 65024, 768, 97, 98, 114, 10964, 10969, 10974, 114, + 114, 59, 32768, 10508, 114, 107, 59, 32768, 10098, 512, 97, + 107, 10979, 10991, 99, 512, 101, 107, 10985, 10988, 59, + 32768, 123, 59, 32768, 91, 512, 101, 115, 10996, 10999, 59, + 32768, 10635, 108, 512, 100, 117, 11005, 11008, 59, 32768, + 10639, 59, 32768, 10637, 1024, 97, 101, 117, 121, 11020, + 11026, 11040, 11044, 114, 111, 110, 59, 32768, 318, 512, + 100, 105, 11031, 11036, 105, 108, 59, 32768, 316, 108, 59, + 32768, 8968, 98, 59, 32768, 123, 59, 32768, 1083, 1024, 99, + 113, 114, 115, 11056, 11060, 11072, 11090, 97, 59, 32768, + 10550, 117, 111, 512, 59, 114, 11067, 11069, 32768, 8220, + 59, 32768, 8222, 512, 100, 117, 11077, 11083, 104, 97, 114, + 59, 32768, 10599, 115, 104, 97, 114, 59, 32768, 10571, 104, + 59, 32768, 8626, 1280, 59, 102, 103, 113, 115, 11105, 11107, + 11228, 11231, 11250, 32768, 8804, 116, 1280, 97, 104, 108, + 114, 116, 11119, 11136, 11157, 11169, 11216, 114, 114, 111, + 119, 512, 59, 116, 11128, 11130, 32768, 8592, 97, 105, 108, + 59, 32768, 8610, 97, 114, 112, 111, 111, 110, 512, 100, 117, + 11147, 11153, 111, 119, 110, 59, 32768, 8637, 112, 59, + 32768, 8636, 101, 102, 116, 97, 114, 114, 111, 119, 115, 59, + 32768, 8647, 105, 103, 104, 116, 768, 97, 104, 115, 11180, + 11194, 11204, 114, 114, 111, 119, 512, 59, 115, 11189, + 11191, 32768, 8596, 59, 32768, 8646, 97, 114, 112, 111, 111, + 110, 115, 59, 32768, 8651, 113, 117, 105, 103, 97, 114, 114, + 111, 119, 59, 32768, 8621, 104, 114, 101, 101, 116, 105, + 109, 101, 115, 59, 32768, 8907, 59, 32768, 8922, 768, 59, + 113, 115, 11238, 11240, 11243, 32768, 8804, 59, 32768, 8806, + 108, 97, 110, 116, 59, 32768, 10877, 1280, 59, 99, 100, 103, + 115, 11261, 11263, 11267, 11286, 11298, 32768, 10877, 99, + 59, 32768, 10920, 111, 116, 512, 59, 111, 11274, 11276, + 32768, 10879, 512, 59, 114, 11281, 11283, 32768, 10881, 59, + 32768, 10883, 512, 59, 101, 11291, 11294, 32896, 8922, + 65024, 115, 59, 32768, 10899, 1280, 97, 100, 101, 103, 115, + 11309, 11317, 11322, 11339, 11344, 112, 112, 114, 111, 120, + 59, 32768, 10885, 111, 116, 59, 32768, 8918, 113, 512, 103, + 113, 11328, 11333, 116, 114, 59, 32768, 8922, 103, 116, 114, + 59, 32768, 10891, 116, 114, 59, 32768, 8822, 105, 109, 59, + 32768, 8818, 768, 105, 108, 114, 11356, 11362, 11368, 115, + 104, 116, 59, 32768, 10620, 111, 111, 114, 59, 32768, 8970, + 59, 32896, 55349, 56617, 512, 59, 69, 11377, 11379, 32768, + 8822, 59, 32768, 10897, 562, 11386, 11405, 114, 512, 100, + 117, 11391, 11394, 59, 32768, 8637, 512, 59, 108, 11399, + 11401, 32768, 8636, 59, 32768, 10602, 108, 107, 59, 32768, + 9604, 99, 121, 59, 32768, 1113, 1280, 59, 97, 99, 104, 116, + 11425, 11427, 11432, 11440, 11446, 32768, 8810, 114, 114, + 59, 32768, 8647, 111, 114, 110, 101, 114, 59, 32768, 8990, + 97, 114, 100, 59, 32768, 10603, 114, 105, 59, 32768, 9722, + 512, 105, 111, 11456, 11462, 100, 111, 116, 59, 32768, 320, + 117, 115, 116, 512, 59, 97, 11470, 11472, 32768, 9136, 99, + 104, 101, 59, 32768, 9136, 1024, 69, 97, 101, 115, 11487, + 11490, 11504, 11521, 59, 32768, 8808, 112, 512, 59, 112, + 11496, 11498, 32768, 10889, 114, 111, 120, 59, 32768, 10889, + 512, 59, 113, 11509, 11511, 32768, 10887, 512, 59, 113, + 11516, 11518, 32768, 10887, 59, 32768, 8808, 105, 109, 59, + 32768, 8934, 2048, 97, 98, 110, 111, 112, 116, 119, 122, + 11543, 11556, 11561, 11616, 11640, 11660, 11667, 11680, 512, + 110, 114, 11548, 11552, 103, 59, 32768, 10220, 114, 59, + 32768, 8701, 114, 107, 59, 32768, 10214, 103, 768, 108, 109, + 114, 11569, 11596, 11604, 101, 102, 116, 512, 97, 114, + 11577, 11584, 114, 114, 111, 119, 59, 32768, 10229, 105, + 103, 104, 116, 97, 114, 114, 111, 119, 59, 32768, 10231, 97, + 112, 115, 116, 111, 59, 32768, 10236, 105, 103, 104, 116, + 97, 114, 114, 111, 119, 59, 32768, 10230, 112, 97, 114, 114, + 111, 119, 512, 108, 114, 11627, 11633, 101, 102, 116, 59, + 32768, 8619, 105, 103, 104, 116, 59, 32768, 8620, 768, 97, + 102, 108, 11647, 11651, 11655, 114, 59, 32768, 10629, 59, + 32896, 55349, 56669, 117, 115, 59, 32768, 10797, 105, 109, + 101, 115, 59, 32768, 10804, 562, 11671, 11676, 115, 116, 59, + 32768, 8727, 97, 114, 59, 32768, 95, 768, 59, 101, 102, + 11687, 11689, 11695, 32768, 9674, 110, 103, 101, 59, 32768, + 9674, 59, 32768, 10731, 97, 114, 512, 59, 108, 11705, 11707, + 32768, 40, 116, 59, 32768, 10643, 1280, 97, 99, 104, 109, + 116, 11722, 11727, 11735, 11747, 11750, 114, 114, 59, 32768, + 8646, 111, 114, 110, 101, 114, 59, 32768, 8991, 97, 114, + 512, 59, 100, 11742, 11744, 32768, 8651, 59, 32768, 10605, + 59, 32768, 8206, 114, 105, 59, 32768, 8895, 1536, 97, 99, + 104, 105, 113, 116, 11768, 11774, 11779, 11782, 11798, + 11817, 113, 117, 111, 59, 32768, 8249, 114, 59, 32896, + 55349, 56513, 59, 32768, 8624, 109, 768, 59, 101, 103, + 11790, 11792, 11795, 32768, 8818, 59, 32768, 10893, 59, + 32768, 10895, 512, 98, 117, 11803, 11806, 59, 32768, 91, + 111, 512, 59, 114, 11812, 11814, 32768, 8216, 59, 32768, + 8218, 114, 111, 107, 59, 32768, 322, 34816, 60, 59, 99, 100, + 104, 105, 108, 113, 114, 11841, 11843, 11855, 11860, 11866, + 11872, 11878, 11885, 32768, 60, 512, 99, 105, 11848, 11851, + 59, 32768, 10918, 114, 59, 32768, 10873, 111, 116, 59, + 32768, 8918, 114, 101, 101, 59, 32768, 8907, 109, 101, 115, + 59, 32768, 8905, 97, 114, 114, 59, 32768, 10614, 117, 101, + 115, 116, 59, 32768, 10875, 512, 80, 105, 11890, 11895, 97, + 114, 59, 32768, 10646, 768, 59, 101, 102, 11902, 11904, + 11907, 32768, 9667, 59, 32768, 8884, 59, 32768, 9666, 114, + 512, 100, 117, 11916, 11923, 115, 104, 97, 114, 59, 32768, + 10570, 104, 97, 114, 59, 32768, 10598, 512, 101, 110, 11934, + 11944, 114, 116, 110, 101, 113, 113, 59, 32896, 8808, 65024, + 69, 59, 32896, 8808, 65024, 3584, 68, 97, 99, 100, 101, 102, + 104, 105, 108, 110, 111, 112, 115, 117, 11978, 11984, 12061, + 12075, 12081, 12095, 12100, 12104, 12170, 12181, 12188, + 12204, 12207, 12223, 68, 111, 116, 59, 32768, 8762, 1024, + 99, 108, 112, 114, 11993, 11999, 12019, 12055, 114, 33024, + 175, 59, 32768, 175, 512, 101, 116, 12004, 12007, 59, 32768, + 9794, 512, 59, 101, 12012, 12014, 32768, 10016, 115, 101, + 59, 32768, 10016, 512, 59, 115, 12024, 12026, 32768, 8614, + 116, 111, 1024, 59, 100, 108, 117, 12037, 12039, 12045, + 12051, 32768, 8614, 111, 119, 110, 59, 32768, 8615, 101, + 102, 116, 59, 32768, 8612, 112, 59, 32768, 8613, 107, 101, + 114, 59, 32768, 9646, 512, 111, 121, 12066, 12072, 109, 109, + 97, 59, 32768, 10793, 59, 32768, 1084, 97, 115, 104, 59, + 32768, 8212, 97, 115, 117, 114, 101, 100, 97, 110, 103, 108, + 101, 59, 32768, 8737, 114, 59, 32896, 55349, 56618, 111, 59, + 32768, 8487, 768, 99, 100, 110, 12111, 12118, 12146, 114, + 111, 33024, 181, 59, 32768, 181, 1024, 59, 97, 99, 100, + 12127, 12129, 12134, 12139, 32768, 8739, 115, 116, 59, + 32768, 42, 105, 114, 59, 32768, 10992, 111, 116, 33024, 183, + 59, 32768, 183, 117, 115, 768, 59, 98, 100, 12155, 12157, + 12160, 32768, 8722, 59, 32768, 8863, 512, 59, 117, 12165, + 12167, 32768, 8760, 59, 32768, 10794, 564, 12174, 12178, + 112, 59, 32768, 10971, 114, 59, 32768, 8230, 112, 108, 117, + 115, 59, 32768, 8723, 512, 100, 112, 12193, 12199, 101, 108, + 115, 59, 32768, 8871, 102, 59, 32896, 55349, 56670, 59, + 32768, 8723, 512, 99, 116, 12212, 12217, 114, 59, 32896, + 55349, 56514, 112, 111, 115, 59, 32768, 8766, 768, 59, 108, + 109, 12230, 12232, 12240, 32768, 956, 116, 105, 109, 97, + 112, 59, 32768, 8888, 97, 112, 59, 32768, 8888, 6144, 71, + 76, 82, 86, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 108, 109, 111, 112, 114, 115, 116, 117, 118, 119, 12294, + 12315, 12364, 12376, 12393, 12472, 12496, 12547, 12553, + 12636, 12641, 12703, 12725, 12747, 12752, 12876, 12881, + 12957, 13033, 13089, 13294, 13359, 13384, 13499, 512, 103, + 116, 12299, 12303, 59, 32896, 8921, 824, 512, 59, 118, + 12308, 12311, 32896, 8811, 8402, 59, 32896, 8811, 824, 768, + 101, 108, 116, 12322, 12348, 12352, 102, 116, 512, 97, 114, + 12329, 12336, 114, 114, 111, 119, 59, 32768, 8653, 105, 103, + 104, 116, 97, 114, 114, 111, 119, 59, 32768, 8654, 59, + 32896, 8920, 824, 512, 59, 118, 12357, 12360, 32896, 8810, + 8402, 59, 32896, 8810, 824, 105, 103, 104, 116, 97, 114, + 114, 111, 119, 59, 32768, 8655, 512, 68, 100, 12381, 12387, + 97, 115, 104, 59, 32768, 8879, 97, 115, 104, 59, 32768, + 8878, 1280, 98, 99, 110, 112, 116, 12404, 12409, 12415, + 12420, 12452, 108, 97, 59, 32768, 8711, 117, 116, 101, 59, + 32768, 324, 103, 59, 32896, 8736, 8402, 1280, 59, 69, 105, + 111, 112, 12431, 12433, 12437, 12442, 12446, 32768, 8777, + 59, 32896, 10864, 824, 100, 59, 32896, 8779, 824, 115, 59, + 32768, 329, 114, 111, 120, 59, 32768, 8777, 117, 114, 512, + 59, 97, 12459, 12461, 32768, 9838, 108, 512, 59, 115, 12467, + 12469, 32768, 9838, 59, 32768, 8469, 836, 12477, 0, 12483, + 112, 33024, 160, 59, 32768, 160, 109, 112, 512, 59, 101, + 12489, 12492, 32896, 8782, 824, 59, 32896, 8783, 824, 1280, + 97, 101, 111, 117, 121, 12507, 12519, 12525, 12540, 12544, + 833, 12512, 0, 12515, 59, 32768, 10819, 111, 110, 59, 32768, + 328, 100, 105, 108, 59, 32768, 326, 110, 103, 512, 59, 100, + 12532, 12534, 32768, 8775, 111, 116, 59, 32896, 10861, 824, + 112, 59, 32768, 10818, 59, 32768, 1085, 97, 115, 104, 59, + 32768, 8211, 1792, 59, 65, 97, 100, 113, 115, 120, 12568, + 12570, 12575, 12596, 12602, 12608, 12623, 32768, 8800, 114, + 114, 59, 32768, 8663, 114, 512, 104, 114, 12581, 12585, 107, + 59, 32768, 10532, 512, 59, 111, 12590, 12592, 32768, 8599, + 119, 59, 32768, 8599, 111, 116, 59, 32896, 8784, 824, 117, + 105, 118, 59, 32768, 8802, 512, 101, 105, 12613, 12618, 97, + 114, 59, 32768, 10536, 109, 59, 32896, 8770, 824, 105, 115, + 116, 512, 59, 115, 12631, 12633, 32768, 8708, 59, 32768, + 8708, 114, 59, 32896, 55349, 56619, 1024, 69, 101, 115, 116, + 12650, 12654, 12688, 12693, 59, 32896, 8807, 824, 768, 59, + 113, 115, 12661, 12663, 12684, 32768, 8817, 768, 59, 113, + 115, 12670, 12672, 12676, 32768, 8817, 59, 32896, 8807, 824, + 108, 97, 110, 116, 59, 32896, 10878, 824, 59, 32896, 10878, + 824, 105, 109, 59, 32768, 8821, 512, 59, 114, 12698, 12700, + 32768, 8815, 59, 32768, 8815, 768, 65, 97, 112, 12710, + 12715, 12720, 114, 114, 59, 32768, 8654, 114, 114, 59, + 32768, 8622, 97, 114, 59, 32768, 10994, 768, 59, 115, 118, + 12732, 12734, 12744, 32768, 8715, 512, 59, 100, 12739, + 12741, 32768, 8956, 59, 32768, 8954, 59, 32768, 8715, 99, + 121, 59, 32768, 1114, 1792, 65, 69, 97, 100, 101, 115, 116, + 12767, 12772, 12776, 12781, 12785, 12853, 12858, 114, 114, + 59, 32768, 8653, 59, 32896, 8806, 824, 114, 114, 59, 32768, + 8602, 114, 59, 32768, 8229, 1024, 59, 102, 113, 115, 12794, + 12796, 12821, 12842, 32768, 8816, 116, 512, 97, 114, 12802, + 12809, 114, 114, 111, 119, 59, 32768, 8602, 105, 103, 104, + 116, 97, 114, 114, 111, 119, 59, 32768, 8622, 768, 59, 113, + 115, 12828, 12830, 12834, 32768, 8816, 59, 32896, 8806, 824, + 108, 97, 110, 116, 59, 32896, 10877, 824, 512, 59, 115, + 12847, 12850, 32896, 10877, 824, 59, 32768, 8814, 105, 109, + 59, 32768, 8820, 512, 59, 114, 12863, 12865, 32768, 8814, + 105, 512, 59, 101, 12871, 12873, 32768, 8938, 59, 32768, + 8940, 105, 100, 59, 32768, 8740, 512, 112, 116, 12886, + 12891, 102, 59, 32896, 55349, 56671, 33536, 172, 59, 105, + 110, 12899, 12901, 12936, 32768, 172, 110, 1024, 59, 69, + 100, 118, 12911, 12913, 12917, 12923, 32768, 8713, 59, + 32896, 8953, 824, 111, 116, 59, 32896, 8949, 824, 818, + 12928, 12931, 12934, 59, 32768, 8713, 59, 32768, 8951, 59, + 32768, 8950, 105, 512, 59, 118, 12942, 12944, 32768, 8716, + 818, 12949, 12952, 12955, 59, 32768, 8716, 59, 32768, 8958, + 59, 32768, 8957, 768, 97, 111, 114, 12964, 12992, 12999, + 114, 1024, 59, 97, 115, 116, 12974, 12976, 12983, 12988, + 32768, 8742, 108, 108, 101, 108, 59, 32768, 8742, 108, 59, + 32896, 11005, 8421, 59, 32896, 8706, 824, 108, 105, 110, + 116, 59, 32768, 10772, 768, 59, 99, 101, 13006, 13008, + 13013, 32768, 8832, 117, 101, 59, 32768, 8928, 512, 59, 99, + 13018, 13021, 32896, 10927, 824, 512, 59, 101, 13026, 13028, + 32768, 8832, 113, 59, 32896, 10927, 824, 1024, 65, 97, 105, + 116, 13042, 13047, 13066, 13077, 114, 114, 59, 32768, 8655, + 114, 114, 768, 59, 99, 119, 13056, 13058, 13062, 32768, + 8603, 59, 32896, 10547, 824, 59, 32896, 8605, 824, 103, 104, + 116, 97, 114, 114, 111, 119, 59, 32768, 8603, 114, 105, 512, + 59, 101, 13084, 13086, 32768, 8939, 59, 32768, 8941, 1792, + 99, 104, 105, 109, 112, 113, 117, 13104, 13128, 13151, + 13169, 13174, 13179, 13194, 1024, 59, 99, 101, 114, 13113, + 13115, 13120, 13124, 32768, 8833, 117, 101, 59, 32768, 8929, + 59, 32896, 10928, 824, 59, 32896, 55349, 56515, 111, 114, + 116, 1086, 13137, 0, 0, 13142, 105, 100, 59, 32768, 8740, + 97, 114, 97, 108, 108, 101, 108, 59, 32768, 8742, 109, 512, + 59, 101, 13157, 13159, 32768, 8769, 512, 59, 113, 13164, + 13166, 32768, 8772, 59, 32768, 8772, 105, 100, 59, 32768, + 8740, 97, 114, 59, 32768, 8742, 115, 117, 512, 98, 112, + 13186, 13190, 101, 59, 32768, 8930, 101, 59, 32768, 8931, + 768, 98, 99, 112, 13201, 13241, 13254, 1024, 59, 69, 101, + 115, 13210, 13212, 13216, 13219, 32768, 8836, 59, 32896, + 10949, 824, 59, 32768, 8840, 101, 116, 512, 59, 101, 13226, + 13229, 32896, 8834, 8402, 113, 512, 59, 113, 13235, 13237, + 32768, 8840, 59, 32896, 10949, 824, 99, 512, 59, 101, 13247, + 13249, 32768, 8833, 113, 59, 32896, 10928, 824, 1024, 59, + 69, 101, 115, 13263, 13265, 13269, 13272, 32768, 8837, 59, + 32896, 10950, 824, 59, 32768, 8841, 101, 116, 512, 59, 101, + 13279, 13282, 32896, 8835, 8402, 113, 512, 59, 113, 13288, + 13290, 32768, 8841, 59, 32896, 10950, 824, 1024, 103, 105, + 108, 114, 13303, 13307, 13315, 13319, 108, 59, 32768, 8825, + 108, 100, 101, 33024, 241, 59, 32768, 241, 103, 59, 32768, + 8824, 105, 97, 110, 103, 108, 101, 512, 108, 114, 13330, + 13344, 101, 102, 116, 512, 59, 101, 13338, 13340, 32768, + 8938, 113, 59, 32768, 8940, 105, 103, 104, 116, 512, 59, + 101, 13353, 13355, 32768, 8939, 113, 59, 32768, 8941, 512, + 59, 109, 13364, 13366, 32768, 957, 768, 59, 101, 115, 13373, + 13375, 13380, 32768, 35, 114, 111, 59, 32768, 8470, 112, 59, + 32768, 8199, 2304, 68, 72, 97, 100, 103, 105, 108, 114, 115, + 13403, 13409, 13415, 13420, 13426, 13439, 13446, 13476, + 13493, 97, 115, 104, 59, 32768, 8877, 97, 114, 114, 59, + 32768, 10500, 112, 59, 32896, 8781, 8402, 97, 115, 104, 59, + 32768, 8876, 512, 101, 116, 13431, 13435, 59, 32896, 8805, + 8402, 59, 32896, 62, 8402, 110, 102, 105, 110, 59, 32768, + 10718, 768, 65, 101, 116, 13453, 13458, 13462, 114, 114, 59, + 32768, 10498, 59, 32896, 8804, 8402, 512, 59, 114, 13467, + 13470, 32896, 60, 8402, 105, 101, 59, 32896, 8884, 8402, + 512, 65, 116, 13481, 13486, 114, 114, 59, 32768, 10499, 114, + 105, 101, 59, 32896, 8885, 8402, 105, 109, 59, 32896, 8764, + 8402, 768, 65, 97, 110, 13506, 13511, 13532, 114, 114, 59, + 32768, 8662, 114, 512, 104, 114, 13517, 13521, 107, 59, + 32768, 10531, 512, 59, 111, 13526, 13528, 32768, 8598, 119, + 59, 32768, 8598, 101, 97, 114, 59, 32768, 10535, 9252, + 13576, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13579, 0, + 13596, 13617, 13653, 13659, 13673, 13695, 13708, 0, 0, + 13713, 13750, 0, 13788, 13794, 0, 13815, 13890, 13913, + 13937, 13944, 59, 32768, 9416, 512, 99, 115, 13583, 13591, + 117, 116, 101, 33024, 243, 59, 32768, 243, 116, 59, 32768, + 8859, 512, 105, 121, 13600, 13613, 114, 512, 59, 99, 13606, + 13608, 32768, 8858, 33024, 244, 59, 32768, 244, 59, 32768, + 1086, 1280, 97, 98, 105, 111, 115, 13627, 13632, 13638, + 13642, 13646, 115, 104, 59, 32768, 8861, 108, 97, 99, 59, + 32768, 337, 118, 59, 32768, 10808, 116, 59, 32768, 8857, + 111, 108, 100, 59, 32768, 10684, 108, 105, 103, 59, 32768, + 339, 512, 99, 114, 13663, 13668, 105, 114, 59, 32768, 10687, + 59, 32896, 55349, 56620, 1600, 13680, 0, 0, 13684, 0, 13692, + 110, 59, 32768, 731, 97, 118, 101, 33024, 242, 59, 32768, + 242, 59, 32768, 10689, 512, 98, 109, 13699, 13704, 97, 114, + 59, 32768, 10677, 59, 32768, 937, 110, 116, 59, 32768, 8750, + 1024, 97, 99, 105, 116, 13721, 13726, 13741, 13746, 114, + 114, 59, 32768, 8634, 512, 105, 114, 13731, 13735, 114, 59, + 32768, 10686, 111, 115, 115, 59, 32768, 10683, 110, 101, 59, + 32768, 8254, 59, 32768, 10688, 768, 97, 101, 105, 13756, + 13761, 13766, 99, 114, 59, 32768, 333, 103, 97, 59, 32768, + 969, 768, 99, 100, 110, 13773, 13779, 13782, 114, 111, 110, + 59, 32768, 959, 59, 32768, 10678, 117, 115, 59, 32768, 8854, + 112, 102, 59, 32896, 55349, 56672, 768, 97, 101, 108, 13800, + 13804, 13809, 114, 59, 32768, 10679, 114, 112, 59, 32768, + 10681, 117, 115, 59, 32768, 8853, 1792, 59, 97, 100, 105, + 111, 115, 118, 13829, 13831, 13836, 13869, 13875, 13879, + 13886, 32768, 8744, 114, 114, 59, 32768, 8635, 1024, 59, + 101, 102, 109, 13845, 13847, 13859, 13864, 32768, 10845, + 114, 512, 59, 111, 13853, 13855, 32768, 8500, 102, 59, + 32768, 8500, 33024, 170, 59, 32768, 170, 33024, 186, 59, + 32768, 186, 103, 111, 102, 59, 32768, 8886, 114, 59, 32768, + 10838, 108, 111, 112, 101, 59, 32768, 10839, 59, 32768, + 10843, 768, 99, 108, 111, 13896, 13900, 13908, 114, 59, + 32768, 8500, 97, 115, 104, 33024, 248, 59, 32768, 248, 108, + 59, 32768, 8856, 105, 573, 13917, 13924, 100, 101, 33024, + 245, 59, 32768, 245, 101, 115, 512, 59, 97, 13930, 13932, + 32768, 8855, 115, 59, 32768, 10806, 109, 108, 33024, 246, + 59, 32768, 246, 98, 97, 114, 59, 32768, 9021, 5426, 13972, + 0, 14013, 0, 14017, 14053, 0, 14058, 14086, 0, 0, 14107, + 14199, 0, 14202, 0, 0, 14229, 14425, 0, 14438, 114, 1024, + 59, 97, 115, 116, 13981, 13983, 13997, 14009, 32768, 8741, + 33280, 182, 59, 108, 13989, 13991, 32768, 182, 108, 101, + 108, 59, 32768, 8741, 1082, 14003, 0, 0, 14007, 109, 59, + 32768, 10995, 59, 32768, 11005, 59, 32768, 8706, 121, 59, + 32768, 1087, 114, 1280, 99, 105, 109, 112, 116, 14028, + 14033, 14038, 14043, 14046, 110, 116, 59, 32768, 37, 111, + 100, 59, 32768, 46, 105, 108, 59, 32768, 8240, 59, 32768, + 8869, 101, 110, 107, 59, 32768, 8241, 114, 59, 32896, 55349, + 56621, 768, 105, 109, 111, 14064, 14074, 14080, 512, 59, + 118, 14069, 14071, 32768, 966, 59, 32768, 981, 109, 97, 116, + 59, 32768, 8499, 110, 101, 59, 32768, 9742, 768, 59, 116, + 118, 14092, 14094, 14103, 32768, 960, 99, 104, 102, 111, + 114, 107, 59, 32768, 8916, 59, 32768, 982, 512, 97, 117, + 14111, 14132, 110, 512, 99, 107, 14117, 14128, 107, 512, 59, + 104, 14123, 14125, 32768, 8463, 59, 32768, 8462, 118, 59, + 32768, 8463, 115, 2304, 59, 97, 98, 99, 100, 101, 109, 115, + 116, 14152, 14154, 14160, 14163, 14168, 14179, 14182, 14188, + 14193, 32768, 43, 99, 105, 114, 59, 32768, 10787, 59, 32768, + 8862, 105, 114, 59, 32768, 10786, 512, 111, 117, 14173, + 14176, 59, 32768, 8724, 59, 32768, 10789, 59, 32768, 10866, + 110, 33024, 177, 59, 32768, 177, 105, 109, 59, 32768, 10790, + 119, 111, 59, 32768, 10791, 59, 32768, 177, 768, 105, 112, + 117, 14208, 14216, 14221, 110, 116, 105, 110, 116, 59, + 32768, 10773, 102, 59, 32896, 55349, 56673, 110, 100, 33024, + 163, 59, 32768, 163, 2560, 59, 69, 97, 99, 101, 105, 110, + 111, 115, 117, 14249, 14251, 14254, 14258, 14263, 14336, + 14348, 14367, 14413, 14418, 32768, 8826, 59, 32768, 10931, + 112, 59, 32768, 10935, 117, 101, 59, 32768, 8828, 512, 59, + 99, 14268, 14270, 32768, 10927, 1536, 59, 97, 99, 101, 110, + 115, 14283, 14285, 14293, 14302, 14306, 14331, 32768, 8826, + 112, 112, 114, 111, 120, 59, 32768, 10935, 117, 114, 108, + 121, 101, 113, 59, 32768, 8828, 113, 59, 32768, 10927, 768, + 97, 101, 115, 14313, 14321, 14326, 112, 112, 114, 111, 120, + 59, 32768, 10937, 113, 113, 59, 32768, 10933, 105, 109, 59, + 32768, 8936, 105, 109, 59, 32768, 8830, 109, 101, 512, 59, + 115, 14343, 14345, 32768, 8242, 59, 32768, 8473, 768, 69, + 97, 115, 14355, 14358, 14362, 59, 32768, 10933, 112, 59, + 32768, 10937, 105, 109, 59, 32768, 8936, 768, 100, 102, 112, + 14374, 14377, 14402, 59, 32768, 8719, 768, 97, 108, 115, + 14384, 14390, 14396, 108, 97, 114, 59, 32768, 9006, 105, + 110, 101, 59, 32768, 8978, 117, 114, 102, 59, 32768, 8979, + 512, 59, 116, 14407, 14409, 32768, 8733, 111, 59, 32768, + 8733, 105, 109, 59, 32768, 8830, 114, 101, 108, 59, 32768, + 8880, 512, 99, 105, 14429, 14434, 114, 59, 32896, 55349, + 56517, 59, 32768, 968, 110, 99, 115, 112, 59, 32768, 8200, + 1536, 102, 105, 111, 112, 115, 117, 14457, 14462, 14467, + 14473, 14480, 14486, 114, 59, 32896, 55349, 56622, 110, 116, + 59, 32768, 10764, 112, 102, 59, 32896, 55349, 56674, 114, + 105, 109, 101, 59, 32768, 8279, 99, 114, 59, 32896, 55349, + 56518, 768, 97, 101, 111, 14493, 14513, 14526, 116, 512, + 101, 105, 14499, 14508, 114, 110, 105, 111, 110, 115, 59, + 32768, 8461, 110, 116, 59, 32768, 10774, 115, 116, 512, 59, + 101, 14520, 14522, 32768, 63, 113, 59, 32768, 8799, 116, + 33024, 34, 59, 32768, 34, 5376, 65, 66, 72, 97, 98, 99, 100, + 101, 102, 104, 105, 108, 109, 110, 111, 112, 114, 115, 116, + 117, 120, 14575, 14597, 14603, 14608, 14775, 14829, 14865, + 14901, 14943, 14966, 15e3, 15139, 15159, 15176, 15182, + 15236, 15261, 15267, 15309, 15352, 15360, 768, 97, 114, 116, + 14582, 14587, 14591, 114, 114, 59, 32768, 8667, 114, 59, + 32768, 8658, 97, 105, 108, 59, 32768, 10524, 97, 114, 114, + 59, 32768, 10511, 97, 114, 59, 32768, 10596, 1792, 99, 100, + 101, 110, 113, 114, 116, 14623, 14637, 14642, 14650, 14672, + 14679, 14751, 512, 101, 117, 14628, 14632, 59, 32896, 8765, + 817, 116, 101, 59, 32768, 341, 105, 99, 59, 32768, 8730, + 109, 112, 116, 121, 118, 59, 32768, 10675, 103, 1024, 59, + 100, 101, 108, 14660, 14662, 14665, 14668, 32768, 10217, 59, + 32768, 10642, 59, 32768, 10661, 101, 59, 32768, 10217, 117, + 111, 33024, 187, 59, 32768, 187, 114, 2816, 59, 97, 98, 99, + 102, 104, 108, 112, 115, 116, 119, 14703, 14705, 14709, + 14720, 14723, 14727, 14731, 14735, 14739, 14744, 14748, + 32768, 8594, 112, 59, 32768, 10613, 512, 59, 102, 14714, + 14716, 32768, 8677, 115, 59, 32768, 10528, 59, 32768, 10547, + 115, 59, 32768, 10526, 107, 59, 32768, 8618, 112, 59, 32768, + 8620, 108, 59, 32768, 10565, 105, 109, 59, 32768, 10612, + 108, 59, 32768, 8611, 59, 32768, 8605, 512, 97, 105, 14756, + 14761, 105, 108, 59, 32768, 10522, 111, 512, 59, 110, 14767, + 14769, 32768, 8758, 97, 108, 115, 59, 32768, 8474, 768, 97, + 98, 114, 14782, 14787, 14792, 114, 114, 59, 32768, 10509, + 114, 107, 59, 32768, 10099, 512, 97, 107, 14797, 14809, 99, + 512, 101, 107, 14803, 14806, 59, 32768, 125, 59, 32768, 93, + 512, 101, 115, 14814, 14817, 59, 32768, 10636, 108, 512, + 100, 117, 14823, 14826, 59, 32768, 10638, 59, 32768, 10640, + 1024, 97, 101, 117, 121, 14838, 14844, 14858, 14862, 114, + 111, 110, 59, 32768, 345, 512, 100, 105, 14849, 14854, 105, + 108, 59, 32768, 343, 108, 59, 32768, 8969, 98, 59, 32768, + 125, 59, 32768, 1088, 1024, 99, 108, 113, 115, 14874, 14878, + 14885, 14897, 97, 59, 32768, 10551, 100, 104, 97, 114, 59, + 32768, 10601, 117, 111, 512, 59, 114, 14892, 14894, 32768, + 8221, 59, 32768, 8221, 104, 59, 32768, 8627, 768, 97, 99, + 103, 14908, 14934, 14938, 108, 1024, 59, 105, 112, 115, + 14918, 14920, 14925, 14931, 32768, 8476, 110, 101, 59, + 32768, 8475, 97, 114, 116, 59, 32768, 8476, 59, 32768, 8477, + 116, 59, 32768, 9645, 33024, 174, 59, 32768, 174, 768, 105, + 108, 114, 14950, 14956, 14962, 115, 104, 116, 59, 32768, + 10621, 111, 111, 114, 59, 32768, 8971, 59, 32896, 55349, + 56623, 512, 97, 111, 14971, 14990, 114, 512, 100, 117, + 14977, 14980, 59, 32768, 8641, 512, 59, 108, 14985, 14987, + 32768, 8640, 59, 32768, 10604, 512, 59, 118, 14995, 14997, + 32768, 961, 59, 32768, 1009, 768, 103, 110, 115, 15007, + 15123, 15127, 104, 116, 1536, 97, 104, 108, 114, 115, 116, + 15022, 15039, 15060, 15086, 15099, 15111, 114, 114, 111, + 119, 512, 59, 116, 15031, 15033, 32768, 8594, 97, 105, 108, + 59, 32768, 8611, 97, 114, 112, 111, 111, 110, 512, 100, 117, + 15050, 15056, 111, 119, 110, 59, 32768, 8641, 112, 59, + 32768, 8640, 101, 102, 116, 512, 97, 104, 15068, 15076, 114, + 114, 111, 119, 115, 59, 32768, 8644, 97, 114, 112, 111, 111, + 110, 115, 59, 32768, 8652, 105, 103, 104, 116, 97, 114, 114, + 111, 119, 115, 59, 32768, 8649, 113, 117, 105, 103, 97, 114, + 114, 111, 119, 59, 32768, 8605, 104, 114, 101, 101, 116, + 105, 109, 101, 115, 59, 32768, 8908, 103, 59, 32768, 730, + 105, 110, 103, 100, 111, 116, 115, 101, 113, 59, 32768, + 8787, 768, 97, 104, 109, 15146, 15151, 15156, 114, 114, 59, + 32768, 8644, 97, 114, 59, 32768, 8652, 59, 32768, 8207, 111, + 117, 115, 116, 512, 59, 97, 15168, 15170, 32768, 9137, 99, + 104, 101, 59, 32768, 9137, 109, 105, 100, 59, 32768, 10990, + 1024, 97, 98, 112, 116, 15191, 15204, 15209, 15229, 512, + 110, 114, 15196, 15200, 103, 59, 32768, 10221, 114, 59, + 32768, 8702, 114, 107, 59, 32768, 10215, 768, 97, 102, 108, + 15216, 15220, 15224, 114, 59, 32768, 10630, 59, 32896, + 55349, 56675, 117, 115, 59, 32768, 10798, 105, 109, 101, + 115, 59, 32768, 10805, 512, 97, 112, 15241, 15253, 114, 512, + 59, 103, 15247, 15249, 32768, 41, 116, 59, 32768, 10644, + 111, 108, 105, 110, 116, 59, 32768, 10770, 97, 114, 114, 59, + 32768, 8649, 1024, 97, 99, 104, 113, 15276, 15282, 15287, + 15290, 113, 117, 111, 59, 32768, 8250, 114, 59, 32896, + 55349, 56519, 59, 32768, 8625, 512, 98, 117, 15295, 15298, + 59, 32768, 93, 111, 512, 59, 114, 15304, 15306, 32768, 8217, + 59, 32768, 8217, 768, 104, 105, 114, 15316, 15322, 15328, + 114, 101, 101, 59, 32768, 8908, 109, 101, 115, 59, 32768, + 8906, 105, 1024, 59, 101, 102, 108, 15338, 15340, 15343, + 15346, 32768, 9657, 59, 32768, 8885, 59, 32768, 9656, 116, + 114, 105, 59, 32768, 10702, 108, 117, 104, 97, 114, 59, + 32768, 10600, 59, 32768, 8478, 6706, 15391, 15398, 15404, + 15499, 15516, 15592, 0, 15606, 15660, 0, 0, 15752, 15758, 0, + 15827, 15863, 15886, 16e3, 16006, 16038, 16086, 0, 16467, 0, + 0, 16506, 99, 117, 116, 101, 59, 32768, 347, 113, 117, 111, + 59, 32768, 8218, 2560, 59, 69, 97, 99, 101, 105, 110, 112, + 115, 121, 15424, 15426, 15429, 15441, 15446, 15458, 15463, + 15482, 15490, 15495, 32768, 8827, 59, 32768, 10932, 833, + 15434, 0, 15437, 59, 32768, 10936, 111, 110, 59, 32768, 353, + 117, 101, 59, 32768, 8829, 512, 59, 100, 15451, 15453, + 32768, 10928, 105, 108, 59, 32768, 351, 114, 99, 59, 32768, + 349, 768, 69, 97, 115, 15470, 15473, 15477, 59, 32768, + 10934, 112, 59, 32768, 10938, 105, 109, 59, 32768, 8937, + 111, 108, 105, 110, 116, 59, 32768, 10771, 105, 109, 59, + 32768, 8831, 59, 32768, 1089, 111, 116, 768, 59, 98, 101, + 15507, 15509, 15512, 32768, 8901, 59, 32768, 8865, 59, + 32768, 10854, 1792, 65, 97, 99, 109, 115, 116, 120, 15530, + 15535, 15556, 15562, 15566, 15572, 15587, 114, 114, 59, + 32768, 8664, 114, 512, 104, 114, 15541, 15545, 107, 59, + 32768, 10533, 512, 59, 111, 15550, 15552, 32768, 8600, 119, + 59, 32768, 8600, 116, 33024, 167, 59, 32768, 167, 105, 59, + 32768, 59, 119, 97, 114, 59, 32768, 10537, 109, 512, 105, + 110, 15578, 15584, 110, 117, 115, 59, 32768, 8726, 59, + 32768, 8726, 116, 59, 32768, 10038, 114, 512, 59, 111, + 15597, 15600, 32896, 55349, 56624, 119, 110, 59, 32768, + 8994, 1024, 97, 99, 111, 121, 15614, 15619, 15632, 15654, + 114, 112, 59, 32768, 9839, 512, 104, 121, 15624, 15629, 99, + 121, 59, 32768, 1097, 59, 32768, 1096, 114, 116, 1086, + 15640, 0, 0, 15645, 105, 100, 59, 32768, 8739, 97, 114, 97, + 108, 108, 101, 108, 59, 32768, 8741, 33024, 173, 59, 32768, + 173, 512, 103, 109, 15664, 15681, 109, 97, 768, 59, 102, + 118, 15673, 15675, 15678, 32768, 963, 59, 32768, 962, 59, + 32768, 962, 2048, 59, 100, 101, 103, 108, 110, 112, 114, + 15698, 15700, 15705, 15715, 15725, 15735, 15739, 15745, + 32768, 8764, 111, 116, 59, 32768, 10858, 512, 59, 113, + 15710, 15712, 32768, 8771, 59, 32768, 8771, 512, 59, 69, + 15720, 15722, 32768, 10910, 59, 32768, 10912, 512, 59, 69, + 15730, 15732, 32768, 10909, 59, 32768, 10911, 101, 59, + 32768, 8774, 108, 117, 115, 59, 32768, 10788, 97, 114, 114, + 59, 32768, 10610, 97, 114, 114, 59, 32768, 8592, 1024, 97, + 101, 105, 116, 15766, 15788, 15796, 15808, 512, 108, 115, + 15771, 15783, 108, 115, 101, 116, 109, 105, 110, 117, 115, + 59, 32768, 8726, 104, 112, 59, 32768, 10803, 112, 97, 114, + 115, 108, 59, 32768, 10724, 512, 100, 108, 15801, 15804, 59, + 32768, 8739, 101, 59, 32768, 8995, 512, 59, 101, 15813, + 15815, 32768, 10922, 512, 59, 115, 15820, 15822, 32768, + 10924, 59, 32896, 10924, 65024, 768, 102, 108, 112, 15833, + 15839, 15857, 116, 99, 121, 59, 32768, 1100, 512, 59, 98, + 15844, 15846, 32768, 47, 512, 59, 97, 15851, 15853, 32768, + 10692, 114, 59, 32768, 9023, 102, 59, 32896, 55349, 56676, + 97, 512, 100, 114, 15868, 15882, 101, 115, 512, 59, 117, + 15875, 15877, 32768, 9824, 105, 116, 59, 32768, 9824, 59, + 32768, 8741, 768, 99, 115, 117, 15892, 15921, 15977, 512, + 97, 117, 15897, 15909, 112, 512, 59, 115, 15903, 15905, + 32768, 8851, 59, 32896, 8851, 65024, 112, 512, 59, 115, + 15915, 15917, 32768, 8852, 59, 32896, 8852, 65024, 117, 512, + 98, 112, 15927, 15952, 768, 59, 101, 115, 15934, 15936, + 15939, 32768, 8847, 59, 32768, 8849, 101, 116, 512, 59, 101, + 15946, 15948, 32768, 8847, 113, 59, 32768, 8849, 768, 59, + 101, 115, 15959, 15961, 15964, 32768, 8848, 59, 32768, 8850, + 101, 116, 512, 59, 101, 15971, 15973, 32768, 8848, 113, 59, + 32768, 8850, 768, 59, 97, 102, 15984, 15986, 15996, 32768, + 9633, 114, 566, 15991, 15994, 59, 32768, 9633, 59, 32768, + 9642, 59, 32768, 9642, 97, 114, 114, 59, 32768, 8594, 1024, + 99, 101, 109, 116, 16014, 16019, 16025, 16031, 114, 59, + 32896, 55349, 56520, 116, 109, 110, 59, 32768, 8726, 105, + 108, 101, 59, 32768, 8995, 97, 114, 102, 59, 32768, 8902, + 512, 97, 114, 16042, 16053, 114, 512, 59, 102, 16048, 16050, + 32768, 9734, 59, 32768, 9733, 512, 97, 110, 16058, 16081, + 105, 103, 104, 116, 512, 101, 112, 16067, 16076, 112, 115, + 105, 108, 111, 110, 59, 32768, 1013, 104, 105, 59, 32768, + 981, 115, 59, 32768, 175, 1280, 98, 99, 109, 110, 112, + 16096, 16221, 16288, 16291, 16295, 2304, 59, 69, 100, 101, + 109, 110, 112, 114, 115, 16115, 16117, 16120, 16125, 16137, + 16143, 16154, 16160, 16166, 32768, 8834, 59, 32768, 10949, + 111, 116, 59, 32768, 10941, 512, 59, 100, 16130, 16132, + 32768, 8838, 111, 116, 59, 32768, 10947, 117, 108, 116, 59, + 32768, 10945, 512, 69, 101, 16148, 16151, 59, 32768, 10955, + 59, 32768, 8842, 108, 117, 115, 59, 32768, 10943, 97, 114, + 114, 59, 32768, 10617, 768, 101, 105, 117, 16173, 16206, + 16210, 116, 768, 59, 101, 110, 16181, 16183, 16194, 32768, + 8834, 113, 512, 59, 113, 16189, 16191, 32768, 8838, 59, + 32768, 10949, 101, 113, 512, 59, 113, 16201, 16203, 32768, + 8842, 59, 32768, 10955, 109, 59, 32768, 10951, 512, 98, 112, + 16215, 16218, 59, 32768, 10965, 59, 32768, 10963, 99, 1536, + 59, 97, 99, 101, 110, 115, 16235, 16237, 16245, 16254, + 16258, 16283, 32768, 8827, 112, 112, 114, 111, 120, 59, + 32768, 10936, 117, 114, 108, 121, 101, 113, 59, 32768, 8829, + 113, 59, 32768, 10928, 768, 97, 101, 115, 16265, 16273, + 16278, 112, 112, 114, 111, 120, 59, 32768, 10938, 113, 113, + 59, 32768, 10934, 105, 109, 59, 32768, 8937, 105, 109, 59, + 32768, 8831, 59, 32768, 8721, 103, 59, 32768, 9834, 3328, + 49, 50, 51, 59, 69, 100, 101, 104, 108, 109, 110, 112, 115, + 16322, 16327, 16332, 16337, 16339, 16342, 16356, 16368, + 16382, 16388, 16394, 16405, 16411, 33024, 185, 59, 32768, + 185, 33024, 178, 59, 32768, 178, 33024, 179, 59, 32768, 179, + 32768, 8835, 59, 32768, 10950, 512, 111, 115, 16347, 16351, + 116, 59, 32768, 10942, 117, 98, 59, 32768, 10968, 512, 59, + 100, 16361, 16363, 32768, 8839, 111, 116, 59, 32768, 10948, + 115, 512, 111, 117, 16374, 16378, 108, 59, 32768, 10185, 98, + 59, 32768, 10967, 97, 114, 114, 59, 32768, 10619, 117, 108, + 116, 59, 32768, 10946, 512, 69, 101, 16399, 16402, 59, + 32768, 10956, 59, 32768, 8843, 108, 117, 115, 59, 32768, + 10944, 768, 101, 105, 117, 16418, 16451, 16455, 116, 768, + 59, 101, 110, 16426, 16428, 16439, 32768, 8835, 113, 512, + 59, 113, 16434, 16436, 32768, 8839, 59, 32768, 10950, 101, + 113, 512, 59, 113, 16446, 16448, 32768, 8843, 59, 32768, + 10956, 109, 59, 32768, 10952, 512, 98, 112, 16460, 16463, + 59, 32768, 10964, 59, 32768, 10966, 768, 65, 97, 110, 16473, + 16478, 16499, 114, 114, 59, 32768, 8665, 114, 512, 104, 114, + 16484, 16488, 107, 59, 32768, 10534, 512, 59, 111, 16493, + 16495, 32768, 8601, 119, 59, 32768, 8601, 119, 97, 114, 59, + 32768, 10538, 108, 105, 103, 33024, 223, 59, 32768, 223, + 5938, 16538, 16552, 16557, 16579, 16584, 16591, 0, 16596, + 16692, 0, 0, 0, 0, 0, 16731, 16780, 0, 16787, 16908, 0, 0, + 0, 16938, 1091, 16543, 0, 0, 16549, 103, 101, 116, 59, + 32768, 8982, 59, 32768, 964, 114, 107, 59, 32768, 9140, 768, + 97, 101, 121, 16563, 16569, 16575, 114, 111, 110, 59, 32768, + 357, 100, 105, 108, 59, 32768, 355, 59, 32768, 1090, 111, + 116, 59, 32768, 8411, 108, 114, 101, 99, 59, 32768, 8981, + 114, 59, 32896, 55349, 56625, 1024, 101, 105, 107, 111, + 16604, 16641, 16670, 16684, 835, 16609, 0, 16624, 101, 512, + 52, 102, 16614, 16617, 59, 32768, 8756, 111, 114, 101, 59, + 32768, 8756, 97, 768, 59, 115, 118, 16631, 16633, 16638, + 32768, 952, 121, 109, 59, 32768, 977, 59, 32768, 977, 512, + 99, 110, 16646, 16665, 107, 512, 97, 115, 16652, 16660, 112, + 112, 114, 111, 120, 59, 32768, 8776, 105, 109, 59, 32768, + 8764, 115, 112, 59, 32768, 8201, 512, 97, 115, 16675, 16679, + 112, 59, 32768, 8776, 105, 109, 59, 32768, 8764, 114, 110, + 33024, 254, 59, 32768, 254, 829, 16696, 16701, 16727, 100, + 101, 59, 32768, 732, 101, 115, 33536, 215, 59, 98, 100, + 16710, 16712, 16723, 32768, 215, 512, 59, 97, 16717, 16719, + 32768, 8864, 114, 59, 32768, 10801, 59, 32768, 10800, 116, + 59, 32768, 8749, 768, 101, 112, 115, 16737, 16741, 16775, + 97, 59, 32768, 10536, 1024, 59, 98, 99, 102, 16750, 16752, + 16757, 16762, 32768, 8868, 111, 116, 59, 32768, 9014, 105, + 114, 59, 32768, 10993, 512, 59, 111, 16767, 16770, 32896, + 55349, 56677, 114, 107, 59, 32768, 10970, 97, 59, 32768, + 10537, 114, 105, 109, 101, 59, 32768, 8244, 768, 97, 105, + 112, 16793, 16798, 16899, 100, 101, 59, 32768, 8482, 1792, + 97, 100, 101, 109, 112, 115, 116, 16813, 16868, 16873, + 16876, 16883, 16889, 16893, 110, 103, 108, 101, 1280, 59, + 100, 108, 113, 114, 16828, 16830, 16836, 16850, 16853, + 32768, 9653, 111, 119, 110, 59, 32768, 9663, 101, 102, 116, + 512, 59, 101, 16844, 16846, 32768, 9667, 113, 59, 32768, + 8884, 59, 32768, 8796, 105, 103, 104, 116, 512, 59, 101, + 16862, 16864, 32768, 9657, 113, 59, 32768, 8885, 111, 116, + 59, 32768, 9708, 59, 32768, 8796, 105, 110, 117, 115, 59, + 32768, 10810, 108, 117, 115, 59, 32768, 10809, 98, 59, + 32768, 10701, 105, 109, 101, 59, 32768, 10811, 101, 122, + 105, 117, 109, 59, 32768, 9186, 768, 99, 104, 116, 16914, + 16926, 16931, 512, 114, 121, 16919, 16923, 59, 32896, 55349, + 56521, 59, 32768, 1094, 99, 121, 59, 32768, 1115, 114, 111, + 107, 59, 32768, 359, 512, 105, 111, 16942, 16947, 120, 116, + 59, 32768, 8812, 104, 101, 97, 100, 512, 108, 114, 16956, + 16967, 101, 102, 116, 97, 114, 114, 111, 119, 59, 32768, + 8606, 105, 103, 104, 116, 97, 114, 114, 111, 119, 59, 32768, + 8608, 4608, 65, 72, 97, 98, 99, 100, 102, 103, 104, 108, + 109, 111, 112, 114, 115, 116, 117, 119, 17016, 17021, 17026, + 17043, 17057, 17072, 17095, 17110, 17119, 17139, 17172, + 17187, 17202, 17290, 17330, 17336, 17365, 17381, 114, 114, + 59, 32768, 8657, 97, 114, 59, 32768, 10595, 512, 99, 114, + 17031, 17039, 117, 116, 101, 33024, 250, 59, 32768, 250, + 114, 59, 32768, 8593, 114, 820, 17049, 0, 17053, 121, 59, + 32768, 1118, 118, 101, 59, 32768, 365, 512, 105, 121, 17062, + 17069, 114, 99, 33024, 251, 59, 32768, 251, 59, 32768, 1091, + 768, 97, 98, 104, 17079, 17084, 17090, 114, 114, 59, 32768, + 8645, 108, 97, 99, 59, 32768, 369, 97, 114, 59, 32768, + 10606, 512, 105, 114, 17100, 17106, 115, 104, 116, 59, + 32768, 10622, 59, 32896, 55349, 56626, 114, 97, 118, 101, + 33024, 249, 59, 32768, 249, 562, 17123, 17135, 114, 512, + 108, 114, 17128, 17131, 59, 32768, 8639, 59, 32768, 8638, + 108, 107, 59, 32768, 9600, 512, 99, 116, 17144, 17167, 1088, + 17150, 0, 0, 17163, 114, 110, 512, 59, 101, 17156, 17158, + 32768, 8988, 114, 59, 32768, 8988, 111, 112, 59, 32768, + 8975, 114, 105, 59, 32768, 9720, 512, 97, 108, 17177, 17182, + 99, 114, 59, 32768, 363, 33024, 168, 59, 32768, 168, 512, + 103, 112, 17192, 17197, 111, 110, 59, 32768, 371, 102, 59, + 32896, 55349, 56678, 1536, 97, 100, 104, 108, 115, 117, + 17215, 17222, 17233, 17257, 17262, 17280, 114, 114, 111, + 119, 59, 32768, 8593, 111, 119, 110, 97, 114, 114, 111, 119, + 59, 32768, 8597, 97, 114, 112, 111, 111, 110, 512, 108, 114, + 17244, 17250, 101, 102, 116, 59, 32768, 8639, 105, 103, 104, + 116, 59, 32768, 8638, 117, 115, 59, 32768, 8846, 105, 768, + 59, 104, 108, 17270, 17272, 17275, 32768, 965, 59, 32768, + 978, 111, 110, 59, 32768, 965, 112, 97, 114, 114, 111, 119, + 115, 59, 32768, 8648, 768, 99, 105, 116, 17297, 17320, + 17325, 1088, 17303, 0, 0, 17316, 114, 110, 512, 59, 101, + 17309, 17311, 32768, 8989, 114, 59, 32768, 8989, 111, 112, + 59, 32768, 8974, 110, 103, 59, 32768, 367, 114, 105, 59, + 32768, 9721, 99, 114, 59, 32896, 55349, 56522, 768, 100, + 105, 114, 17343, 17348, 17354, 111, 116, 59, 32768, 8944, + 108, 100, 101, 59, 32768, 361, 105, 512, 59, 102, 17360, + 17362, 32768, 9653, 59, 32768, 9652, 512, 97, 109, 17370, + 17375, 114, 114, 59, 32768, 8648, 108, 33024, 252, 59, + 32768, 252, 97, 110, 103, 108, 101, 59, 32768, 10663, 3840, + 65, 66, 68, 97, 99, 100, 101, 102, 108, 110, 111, 112, 114, + 115, 122, 17420, 17425, 17437, 17443, 17613, 17617, 17623, + 17667, 17672, 17678, 17693, 17699, 17705, 17711, 17754, 114, + 114, 59, 32768, 8661, 97, 114, 512, 59, 118, 17432, 17434, + 32768, 10984, 59, 32768, 10985, 97, 115, 104, 59, 32768, + 8872, 512, 110, 114, 17448, 17454, 103, 114, 116, 59, 32768, + 10652, 1792, 101, 107, 110, 112, 114, 115, 116, 17469, + 17478, 17485, 17494, 17515, 17526, 17578, 112, 115, 105, + 108, 111, 110, 59, 32768, 1013, 97, 112, 112, 97, 59, 32768, + 1008, 111, 116, 104, 105, 110, 103, 59, 32768, 8709, 768, + 104, 105, 114, 17501, 17505, 17508, 105, 59, 32768, 981, 59, + 32768, 982, 111, 112, 116, 111, 59, 32768, 8733, 512, 59, + 104, 17520, 17522, 32768, 8597, 111, 59, 32768, 1009, 512, + 105, 117, 17531, 17537, 103, 109, 97, 59, 32768, 962, 512, + 98, 112, 17542, 17560, 115, 101, 116, 110, 101, 113, 512, + 59, 113, 17553, 17556, 32896, 8842, 65024, 59, 32896, 10955, + 65024, 115, 101, 116, 110, 101, 113, 512, 59, 113, 17571, + 17574, 32896, 8843, 65024, 59, 32896, 10956, 65024, 512, + 104, 114, 17583, 17589, 101, 116, 97, 59, 32768, 977, 105, + 97, 110, 103, 108, 101, 512, 108, 114, 17600, 17606, 101, + 102, 116, 59, 32768, 8882, 105, 103, 104, 116, 59, 32768, + 8883, 121, 59, 32768, 1074, 97, 115, 104, 59, 32768, 8866, + 768, 101, 108, 114, 17630, 17648, 17654, 768, 59, 98, 101, + 17637, 17639, 17644, 32768, 8744, 97, 114, 59, 32768, 8891, + 113, 59, 32768, 8794, 108, 105, 112, 59, 32768, 8942, 512, + 98, 116, 17659, 17664, 97, 114, 59, 32768, 124, 59, 32768, + 124, 114, 59, 32896, 55349, 56627, 116, 114, 105, 59, 32768, + 8882, 115, 117, 512, 98, 112, 17685, 17689, 59, 32896, 8834, + 8402, 59, 32896, 8835, 8402, 112, 102, 59, 32896, 55349, + 56679, 114, 111, 112, 59, 32768, 8733, 116, 114, 105, 59, + 32768, 8883, 512, 99, 117, 17716, 17721, 114, 59, 32896, + 55349, 56523, 512, 98, 112, 17726, 17740, 110, 512, 69, 101, + 17732, 17736, 59, 32896, 10955, 65024, 59, 32896, 8842, + 65024, 110, 512, 69, 101, 17746, 17750, 59, 32896, 10956, + 65024, 59, 32896, 8843, 65024, 105, 103, 122, 97, 103, 59, + 32768, 10650, 1792, 99, 101, 102, 111, 112, 114, 115, 17777, + 17783, 17815, 17820, 17826, 17829, 17842, 105, 114, 99, 59, + 32768, 373, 512, 100, 105, 17788, 17809, 512, 98, 103, + 17793, 17798, 97, 114, 59, 32768, 10847, 101, 512, 59, 113, + 17804, 17806, 32768, 8743, 59, 32768, 8793, 101, 114, 112, + 59, 32768, 8472, 114, 59, 32896, 55349, 56628, 112, 102, 59, + 32896, 55349, 56680, 59, 32768, 8472, 512, 59, 101, 17834, + 17836, 32768, 8768, 97, 116, 104, 59, 32768, 8768, 99, 114, + 59, 32896, 55349, 56524, 5428, 17871, 17891, 0, 17897, 0, + 17902, 17917, 0, 0, 17920, 17935, 17940, 17945, 0, 0, 17977, + 17992, 0, 18008, 18024, 18029, 768, 97, 105, 117, 17877, + 17881, 17886, 112, 59, 32768, 8898, 114, 99, 59, 32768, + 9711, 112, 59, 32768, 8899, 116, 114, 105, 59, 32768, 9661, + 114, 59, 32896, 55349, 56629, 512, 65, 97, 17906, 17911, + 114, 114, 59, 32768, 10234, 114, 114, 59, 32768, 10231, 59, + 32768, 958, 512, 65, 97, 17924, 17929, 114, 114, 59, 32768, + 10232, 114, 114, 59, 32768, 10229, 97, 112, 59, 32768, + 10236, 105, 115, 59, 32768, 8955, 768, 100, 112, 116, 17951, + 17956, 17970, 111, 116, 59, 32768, 10752, 512, 102, 108, + 17961, 17965, 59, 32896, 55349, 56681, 117, 115, 59, 32768, + 10753, 105, 109, 101, 59, 32768, 10754, 512, 65, 97, 17981, + 17986, 114, 114, 59, 32768, 10233, 114, 114, 59, 32768, + 10230, 512, 99, 113, 17996, 18001, 114, 59, 32896, 55349, + 56525, 99, 117, 112, 59, 32768, 10758, 512, 112, 116, 18012, + 18018, 108, 117, 115, 59, 32768, 10756, 114, 105, 59, 32768, + 9651, 101, 101, 59, 32768, 8897, 101, 100, 103, 101, 59, + 32768, 8896, 2048, 97, 99, 101, 102, 105, 111, 115, 117, + 18052, 18068, 18081, 18087, 18092, 18097, 18103, 18109, 99, + 512, 117, 121, 18058, 18065, 116, 101, 33024, 253, 59, + 32768, 253, 59, 32768, 1103, 512, 105, 121, 18073, 18078, + 114, 99, 59, 32768, 375, 59, 32768, 1099, 110, 33024, 165, + 59, 32768, 165, 114, 59, 32896, 55349, 56630, 99, 121, 59, + 32768, 1111, 112, 102, 59, 32896, 55349, 56682, 99, 114, 59, + 32896, 55349, 56526, 512, 99, 109, 18114, 18118, 121, 59, + 32768, 1102, 108, 33024, 255, 59, 32768, 255, 2560, 97, 99, + 100, 101, 102, 104, 105, 111, 115, 119, 18145, 18152, 18166, + 18171, 18186, 18191, 18196, 18204, 18210, 18216, 99, 117, + 116, 101, 59, 32768, 378, 512, 97, 121, 18157, 18163, 114, + 111, 110, 59, 32768, 382, 59, 32768, 1079, 111, 116, 59, + 32768, 380, 512, 101, 116, 18176, 18182, 116, 114, 102, 59, + 32768, 8488, 97, 59, 32768, 950, 114, 59, 32896, 55349, + 56631, 99, 121, 59, 32768, 1078, 103, 114, 97, 114, 114, 59, + 32768, 8669, 112, 102, 59, 32896, 55349, 56683, 99, 114, 59, + 32896, 55349, 56527, 512, 106, 110, 18221, 18224, 59, 32768, + 8205, 106, 59, 32768, 8204, + ])); + }), + X = + (r(J), + n(function (e, t) { + Object.defineProperty(t, '__esModule', { value: !0 }), + (t.default = new Uint16Array([ + 1024, 97, 103, 108, 113, 9, 23, 27, 31, 1086, 15, 0, 0, + 19, 112, 59, 32768, 38, 111, 115, 59, 32768, 39, 116, + 59, 32768, 62, 116, 59, 32768, 60, 117, 111, 116, 59, + 32768, 34, + ])); + })), + Y = + (r(X), + n(function (e, t) { + Object.defineProperty(t, '__esModule', { value: !0 }); + var r = new Map([ + [0, 65533], + [128, 8364], + [130, 8218], + [131, 402], + [132, 8222], + [133, 8230], + [134, 8224], + [135, 8225], + [136, 710], + [137, 8240], + [138, 352], + [139, 8249], + [140, 338], + [142, 381], + [145, 8216], + [146, 8217], + [147, 8220], + [148, 8221], + [149, 8226], + [150, 8211], + [151, 8212], + [152, 732], + [153, 8482], + [154, 353], + [155, 8250], + [156, 339], + [158, 382], + [159, 376], + ]), + n = + String.fromCodePoint || + function (e) { + var t = ''; + return ( + 65535 < e && + ((e -= 65536), + (t += String.fromCharCode( + ((e >>> 10) & 1023) | 55296 + )), + (e = 56320 | (1023 & e))), + (t += String.fromCharCode(e)) + ); + }; + t.default = function (e) { + var t; + return (55296 <= e && e <= 57343) || 1114111 < e + ? '�' + : n(null != (t = r.get(e)) ? t : e); + }; + })), + c = + (r(Y), + n(function (e, c) { + var d, + t = + (p && p.__importDefault) || + function (e) { + return e && e.__esModule ? e : { default: e }; + }, + r = + (Object.defineProperty(c, '__esModule', { value: !0 }), + (c.decodeXML = + c.decodeHTMLStrict = + c.decodeHTML = + c.determineBranch = + c.JUMP_OFFSET_BASE = + c.BinTrieFlags = + c.xmlDecodeTree = + c.htmlDecodeTree = + void 0), + t(J)), + n = ((c.htmlDecodeTree = r.default), t(X)), + h = ((c.xmlDecodeTree = n.default), t(Y)); + function o(f) { + return function (e, t) { + for ( + var r = '', n = 0, o = 0; + 0 <= (o = e.indexOf('&', o)); + + ) + if ( + ((r += e.slice(n, o)), + (n = o), + 35 === e.charCodeAt((o += 1))) + ) { + var i, + a = o + 1, + s = 10; + for ( + 120 == (32 | e.charCodeAt(a)) && + ((s = 16), (o += 1), (a += 1)); + (48 <= (i = e.charCodeAt(++o)) && + i <= 57) || + (16 === s && + 97 <= (32 | i) && + (32 | i) <= 102); + + ); + if (a !== o) { + (a = e.substring(a, o)), + (a = parseInt(a, s)); + if (59 === e.charCodeAt(o)) o += 1; + else if (t) continue; + (r += h.default(a)), (n = o); + } + } else { + for ( + var l = null, c = 1, u = 0, p = f[u]; + o < e.length && + !( + (u = g(f, p, u + 1, e.charCodeAt(o))) < + 0 + ); + o++, c++ + ) + (p = f[u]) & d.HAS_VALUE && + (t && 59 !== e.charCodeAt(o) + ? (u += 1) + : ((l = + p & d.MULTI_BYTE + ? String.fromCharCode( + f[++u], + f[++u] + ) + : String.fromCharCode( + f[++u] + )), + (c = 0))); + null != l && ((r += l), (n = o - c + 1)); + } + return r + e.slice(n); + }; + } + function g(e, t, r, n) { + if (t <= 128) return n === t ? r : -1; + var o = (t & d.BRANCH_LENGTH) >> 8; + if (0 != o) { + if (1 == o) return n === e[r] ? r + 1 : -1; + var t = t & d.JUMP_TABLE; + if (t) + return (t = n - c.JUMP_OFFSET_BASE - t) < 0 || o < t + ? -1 + : e[r + t] - 1; + for (var i = r, a = i + o - 1; i <= a; ) { + var s = (i + a) >>> 1, + l = e[s]; + if (l < n) i = 1 + s; + else { + if (!(n < l)) return e[s + o]; + a = s - 1; + } + } + } + return -1; + } + ((t = d = c.BinTrieFlags || (c.BinTrieFlags = {}))[ + (t.HAS_VALUE = 32768) + ] = 'HAS_VALUE'), + (t[(t.BRANCH_LENGTH = 32512)] = 'BRANCH_LENGTH'), + (t[(t.MULTI_BYTE = 128)] = 'MULTI_BYTE'), + (t[(t.JUMP_TABLE = 127)] = 'JUMP_TABLE'), + (c.JUMP_OFFSET_BASE = 47), + (c.determineBranch = g); + var i = o(r.default), + a = o(n.default); + (c.decodeHTML = function (e) { + return i(e, !1); + }), + (c.decodeHTMLStrict = function (e) { + return i(e, !0); + }), + (c.decodeXML = function (e) { + return a(e, !0); + }); + })), + t = + (r(c), + c.decodeXML, + c.decodeHTMLStrict, + c.decodeHTML, + c.determineBranch, + c.JUMP_OFFSET_BASE, + c.BinTrieFlags, + c.xmlDecodeTree, + c.htmlDecodeTree, + Object.freeze({ + __proto__: null, + amp: '&', + apos: "'", + gt: '>', + lt: '<', + quot: '"', + default: { amp: '&', apos: "'", gt: '>', lt: '<', quot: '"' }, + })), + W = V( + Object.freeze({ + __proto__: null, + Aacute: 'Á', + aacute: 'á', + Abreve: 'Ă', + abreve: 'ă', + ac: '∾', + acd: '∿', + acE: '∾̳', + Acirc: 'Â', + acirc: 'â', + acute: '´', + Acy: 'А', + acy: 'а', + AElig: 'Æ', + aelig: 'æ', + af: '⁡', + Afr: '𝔄', + afr: '𝔞', + Agrave: 'À', + agrave: 'à', + alefsym: 'ℵ', + aleph: 'ℵ', + Alpha: 'Α', + alpha: 'α', + Amacr: 'Ā', + amacr: 'ā', + amalg: '⨿', + amp: '&', + AMP: '&', + andand: '⩕', + And: '⩓', + and: '∧', + andd: '⩜', + andslope: '⩘', + andv: '⩚', + ang: '∠', + ange: '⦤', + angle: '∠', + angmsdaa: '⦨', + angmsdab: '⦩', + angmsdac: '⦪', + angmsdad: '⦫', + angmsdae: '⦬', + angmsdaf: '⦭', + angmsdag: '⦮', + angmsdah: '⦯', + angmsd: '∡', + angrt: '∟', + angrtvb: '⊾', + angrtvbd: '⦝', + angsph: '∢', + angst: 'Å', + angzarr: '⍼', + Aogon: 'Ą', + aogon: 'ą', + Aopf: '𝔸', + aopf: '𝕒', + apacir: '⩯', + ap: '≈', + apE: '⩰', + ape: '≊', + apid: '≋', + apos: "'", + ApplyFunction: '⁡', + approx: '≈', + approxeq: '≊', + Aring: 'Å', + aring: 'å', + Ascr: '𝒜', + ascr: '𝒶', + Assign: '≔', + ast: '*', + asymp: '≈', + asympeq: '≍', + Atilde: 'Ã', + atilde: 'ã', + Auml: 'Ä', + auml: 'ä', + awconint: '∳', + awint: '⨑', + backcong: '≌', + backepsilon: '϶', + backprime: '‵', + backsim: '∽', + backsimeq: '⋍', + Backslash: '∖', + Barv: '⫧', + barvee: '⊽', + barwed: '⌅', + Barwed: '⌆', + barwedge: '⌅', + bbrk: '⎵', + bbrktbrk: '⎶', + bcong: '≌', + Bcy: 'Б', + bcy: 'б', + bdquo: '„', + becaus: '∵', + because: '∵', + Because: '∵', + bemptyv: '⦰', + bepsi: '϶', + bernou: 'ℬ', + Bernoullis: 'ℬ', + Beta: 'Β', + beta: 'β', + beth: 'ℶ', + between: '≬', + Bfr: '𝔅', + bfr: '𝔟', + bigcap: '⋂', + bigcirc: '◯', + bigcup: '⋃', + bigodot: '⨀', + bigoplus: '⨁', + bigotimes: '⨂', + bigsqcup: '⨆', + bigstar: '★', + bigtriangledown: '▽', + bigtriangleup: '△', + biguplus: '⨄', + bigvee: '⋁', + bigwedge: '⋀', + bkarow: '⤍', + blacklozenge: '⧫', + blacksquare: '▪', + blacktriangle: '▴', + blacktriangledown: '▾', + blacktriangleleft: '◂', + blacktriangleright: '▸', + blank: '␣', + blk12: '▒', + blk14: '░', + blk34: '▓', + block: '█', + bne: '=⃥', + bnequiv: '≡⃥', + bNot: '⫭', + bnot: '⌐', + Bopf: '𝔹', + bopf: '𝕓', + bot: '⊥', + bottom: '⊥', + bowtie: '⋈', + boxbox: '⧉', + boxdl: '┐', + boxdL: '╕', + boxDl: '╖', + boxDL: '╗', + boxdr: '┌', + boxdR: '╒', + boxDr: '╓', + boxDR: '╔', + boxh: '─', + boxH: '═', + boxhd: '┬', + boxHd: '╤', + boxhD: '╥', + boxHD: '╦', + boxhu: '┴', + boxHu: '╧', + boxhU: '╨', + boxHU: '╩', + boxminus: '⊟', + boxplus: '⊞', + boxtimes: '⊠', + boxul: '┘', + boxuL: '╛', + boxUl: '╜', + boxUL: '╝', + boxur: '└', + boxuR: '╘', + boxUr: '╙', + boxUR: '╚', + boxv: '│', + boxV: '║', + boxvh: '┼', + boxvH: '╪', + boxVh: '╫', + boxVH: '╬', + boxvl: '┤', + boxvL: '╡', + boxVl: '╢', + boxVL: '╣', + boxvr: '├', + boxvR: '╞', + boxVr: '╟', + boxVR: '╠', + bprime: '‵', + breve: '˘', + Breve: '˘', + brvbar: '¦', + bscr: '𝒷', + Bscr: 'ℬ', + bsemi: '⁏', + bsim: '∽', + bsime: '⋍', + bsolb: '⧅', + bsol: '\\', + bsolhsub: '⟈', + bull: '•', + bullet: '•', + bump: '≎', + bumpE: '⪮', + bumpe: '≏', + Bumpeq: '≎', + bumpeq: '≏', + Cacute: 'Ć', + cacute: 'ć', + capand: '⩄', + capbrcup: '⩉', + capcap: '⩋', + cap: '∩', + Cap: '⋒', + capcup: '⩇', + capdot: '⩀', + CapitalDifferentialD: 'ⅅ', + caps: '∩︀', + caret: '⁁', + caron: 'ˇ', + Cayleys: 'ℭ', + ccaps: '⩍', + Ccaron: 'Č', + ccaron: 'č', + Ccedil: 'Ç', + ccedil: 'ç', + Ccirc: 'Ĉ', + ccirc: 'ĉ', + Cconint: '∰', + ccups: '⩌', + ccupssm: '⩐', + Cdot: 'Ċ', + cdot: 'ċ', + cedil: '¸', + Cedilla: '¸', + cemptyv: '⦲', + cent: '¢', + centerdot: '·', + CenterDot: '·', + cfr: '𝔠', + Cfr: 'ℭ', + CHcy: 'Ч', + chcy: 'ч', + check: '✓', + checkmark: '✓', + Chi: 'Χ', + chi: 'χ', + circ: 'ˆ', + circeq: '≗', + circlearrowleft: '↺', + circlearrowright: '↻', + circledast: '⊛', + circledcirc: '⊚', + circleddash: '⊝', + CircleDot: '⊙', + circledR: '®', + circledS: 'Ⓢ', + CircleMinus: '⊖', + CirclePlus: '⊕', + CircleTimes: '⊗', + cir: '○', + cirE: '⧃', + cire: '≗', + cirfnint: '⨐', + cirmid: '⫯', + cirscir: '⧂', + ClockwiseContourIntegral: '∲', + CloseCurlyDoubleQuote: '”', + CloseCurlyQuote: '’', + clubs: '♣', + clubsuit: '♣', + colon: ':', + Colon: '∷', + Colone: '⩴', + colone: '≔', + coloneq: '≔', + comma: ',', + commat: '@', + comp: '∁', + compfn: '∘', + complement: '∁', + complexes: 'ℂ', + cong: '≅', + congdot: '⩭', + Congruent: '≡', + conint: '∮', + Conint: '∯', + ContourIntegral: '∮', + copf: '𝕔', + Copf: 'ℂ', + coprod: '∐', + Coproduct: '∐', + copy: '©', + COPY: '©', + copysr: '℗', + CounterClockwiseContourIntegral: '∳', + crarr: '↵', + cross: '✗', + Cross: '⨯', + Cscr: '𝒞', + cscr: '𝒸', + csub: '⫏', + csube: '⫑', + csup: '⫐', + csupe: '⫒', + ctdot: '⋯', + cudarrl: '⤸', + cudarrr: '⤵', + cuepr: '⋞', + cuesc: '⋟', + cularr: '↶', + cularrp: '⤽', + cupbrcap: '⩈', + cupcap: '⩆', + CupCap: '≍', + cup: '∪', + Cup: '⋓', + cupcup: '⩊', + cupdot: '⊍', + cupor: '⩅', + cups: '∪︀', + curarr: '↷', + curarrm: '⤼', + curlyeqprec: '⋞', + curlyeqsucc: '⋟', + curlyvee: '⋎', + curlywedge: '⋏', + curren: '¤', + curvearrowleft: '↶', + curvearrowright: '↷', + cuvee: '⋎', + cuwed: '⋏', + cwconint: '∲', + cwint: '∱', + cylcty: '⌭', + dagger: '†', + Dagger: '‡', + daleth: 'ℸ', + darr: '↓', + Darr: '↡', + dArr: '⇓', + dash: '‐', + Dashv: '⫤', + dashv: '⊣', + dbkarow: '⤏', + dblac: '˝', + Dcaron: 'Ď', + dcaron: 'ď', + Dcy: 'Д', + dcy: 'д', + ddagger: '‡', + ddarr: '⇊', + DD: 'ⅅ', + dd: 'ⅆ', + DDotrahd: '⤑', + ddotseq: '⩷', + deg: '°', + Del: '∇', + Delta: 'Δ', + delta: 'δ', + demptyv: '⦱', + dfisht: '⥿', + Dfr: '𝔇', + dfr: '𝔡', + dHar: '⥥', + dharl: '⇃', + dharr: '⇂', + DiacriticalAcute: '´', + DiacriticalDot: '˙', + DiacriticalDoubleAcute: '˝', + DiacriticalGrave: '`', + DiacriticalTilde: '˜', + diam: '⋄', + diamond: '⋄', + Diamond: '⋄', + diamondsuit: '♦', + diams: '♦', + die: '¨', + DifferentialD: 'ⅆ', + digamma: 'ϝ', + disin: '⋲', + div: '÷', + divide: '÷', + divideontimes: '⋇', + divonx: '⋇', + DJcy: 'Ђ', + djcy: 'ђ', + dlcorn: '⌞', + dlcrop: '⌍', + dollar: '$', + Dopf: '𝔻', + dopf: '𝕕', + Dot: '¨', + dot: '˙', + DotDot: '⃜', + doteq: '≐', + doteqdot: '≑', + DotEqual: '≐', + dotminus: '∸', + dotplus: '∔', + dotsquare: '⊡', + doublebarwedge: '⌆', + DoubleContourIntegral: '∯', + DoubleDot: '¨', + DoubleDownArrow: '⇓', + DoubleLeftArrow: '⇐', + DoubleLeftRightArrow: '⇔', + DoubleLeftTee: '⫤', + DoubleLongLeftArrow: '⟸', + DoubleLongLeftRightArrow: '⟺', + DoubleLongRightArrow: '⟹', + DoubleRightArrow: '⇒', + DoubleRightTee: '⊨', + DoubleUpArrow: '⇑', + DoubleUpDownArrow: '⇕', + DoubleVerticalBar: '∥', + DownArrowBar: '⤓', + downarrow: '↓', + DownArrow: '↓', + Downarrow: '⇓', + DownArrowUpArrow: '⇵', + DownBreve: '̑', + downdownarrows: '⇊', + downharpoonleft: '⇃', + downharpoonright: '⇂', + DownLeftRightVector: '⥐', + DownLeftTeeVector: '⥞', + DownLeftVectorBar: '⥖', + DownLeftVector: '↽', + DownRightTeeVector: '⥟', + DownRightVectorBar: '⥗', + DownRightVector: '⇁', + DownTeeArrow: '↧', + DownTee: '⊤', + drbkarow: '⤐', + drcorn: '⌟', + drcrop: '⌌', + Dscr: '𝒟', + dscr: '𝒹', + DScy: 'Ѕ', + dscy: 'ѕ', + dsol: '⧶', + Dstrok: 'Đ', + dstrok: 'đ', + dtdot: '⋱', + dtri: '▿', + dtrif: '▾', + duarr: '⇵', + duhar: '⥯', + dwangle: '⦦', + DZcy: 'Џ', + dzcy: 'џ', + dzigrarr: '⟿', + Eacute: 'É', + eacute: 'é', + easter: '⩮', + Ecaron: 'Ě', + ecaron: 'ě', + Ecirc: 'Ê', + ecirc: 'ê', + ecir: '≖', + ecolon: '≕', + Ecy: 'Э', + ecy: 'э', + eDDot: '⩷', + Edot: 'Ė', + edot: 'ė', + eDot: '≑', + ee: 'ⅇ', + efDot: '≒', + Efr: '𝔈', + efr: '𝔢', + eg: '⪚', + Egrave: 'È', + egrave: 'è', + egs: '⪖', + egsdot: '⪘', + el: '⪙', + Element: '∈', + elinters: '⏧', + ell: 'ℓ', + els: '⪕', + elsdot: '⪗', + Emacr: 'Ē', + emacr: 'ē', + empty: '∅', + emptyset: '∅', + EmptySmallSquare: '◻', + emptyv: '∅', + EmptyVerySmallSquare: '▫', + emsp13: ' ', + emsp14: ' ', + emsp: ' ', + ENG: 'Ŋ', + eng: 'ŋ', + ensp: ' ', + Eogon: 'Ę', + eogon: 'ę', + Eopf: '𝔼', + eopf: '𝕖', + epar: '⋕', + eparsl: '⧣', + eplus: '⩱', + epsi: 'ε', + Epsilon: 'Ε', + epsilon: 'ε', + epsiv: 'ϵ', + eqcirc: '≖', + eqcolon: '≕', + eqsim: '≂', + eqslantgtr: '⪖', + eqslantless: '⪕', + Equal: '⩵', + equals: '=', + EqualTilde: '≂', + equest: '≟', + Equilibrium: '⇌', + equiv: '≡', + equivDD: '⩸', + eqvparsl: '⧥', + erarr: '⥱', + erDot: '≓', + escr: 'ℯ', + Escr: 'ℰ', + esdot: '≐', + Esim: '⩳', + esim: '≂', + Eta: 'Η', + eta: 'η', + ETH: 'Ð', + eth: 'ð', + Euml: 'Ë', + euml: 'ë', + euro: '€', + excl: '!', + exist: '∃', + Exists: '∃', + expectation: 'ℰ', + exponentiale: 'ⅇ', + ExponentialE: 'ⅇ', + fallingdotseq: '≒', + Fcy: 'Ф', + fcy: 'ф', + female: '♀', + ffilig: 'ffi', + fflig: 'ff', + ffllig: 'ffl', + Ffr: '𝔉', + ffr: '𝔣', + filig: 'fi', + FilledSmallSquare: '◼', + FilledVerySmallSquare: '▪', + fjlig: 'fj', + flat: '♭', + fllig: 'fl', + fltns: '▱', + fnof: 'ƒ', + Fopf: '𝔽', + fopf: '𝕗', + forall: '∀', + ForAll: '∀', + fork: '⋔', + forkv: '⫙', + Fouriertrf: 'ℱ', + fpartint: '⨍', + frac12: '½', + frac13: '⅓', + frac14: '¼', + frac15: '⅕', + frac16: '⅙', + frac18: '⅛', + frac23: '⅔', + frac25: '⅖', + frac34: '¾', + frac35: '⅗', + frac38: '⅜', + frac45: '⅘', + frac56: '⅚', + frac58: '⅝', + frac78: '⅞', + frasl: '⁄', + frown: '⌢', + fscr: '𝒻', + Fscr: 'ℱ', + gacute: 'ǵ', + Gamma: 'Γ', + gamma: 'γ', + Gammad: 'Ϝ', + gammad: 'ϝ', + gap: '⪆', + Gbreve: 'Ğ', + gbreve: 'ğ', + Gcedil: 'Ģ', + Gcirc: 'Ĝ', + gcirc: 'ĝ', + Gcy: 'Г', + gcy: 'г', + Gdot: 'Ġ', + gdot: 'ġ', + ge: '≥', + gE: '≧', + gEl: '⪌', + gel: '⋛', + geq: '≥', + geqq: '≧', + geqslant: '⩾', + gescc: '⪩', + ges: '⩾', + gesdot: '⪀', + gesdoto: '⪂', + gesdotol: '⪄', + gesl: '⋛︀', + gesles: '⪔', + Gfr: '𝔊', + gfr: '𝔤', + gg: '≫', + Gg: '⋙', + ggg: '⋙', + gimel: 'ℷ', + GJcy: 'Ѓ', + gjcy: 'ѓ', + gla: '⪥', + gl: '≷', + glE: '⪒', + glj: '⪤', + gnap: '⪊', + gnapprox: '⪊', + gne: '⪈', + gnE: '≩', + gneq: '⪈', + gneqq: '≩', + gnsim: '⋧', + Gopf: '𝔾', + gopf: '𝕘', + grave: '`', + GreaterEqual: '≥', + GreaterEqualLess: '⋛', + GreaterFullEqual: '≧', + GreaterGreater: '⪢', + GreaterLess: '≷', + GreaterSlantEqual: '⩾', + GreaterTilde: '≳', + Gscr: '𝒢', + gscr: 'ℊ', + gsim: '≳', + gsime: '⪎', + gsiml: '⪐', + gtcc: '⪧', + gtcir: '⩺', + gt: '>', + GT: '>', + Gt: '≫', + gtdot: '⋗', + gtlPar: '⦕', + gtquest: '⩼', + gtrapprox: '⪆', + gtrarr: '⥸', + gtrdot: '⋗', + gtreqless: '⋛', + gtreqqless: '⪌', + gtrless: '≷', + gtrsim: '≳', + gvertneqq: '≩︀', + gvnE: '≩︀', + Hacek: 'ˇ', + hairsp: ' ', + half: '½', + hamilt: 'ℋ', + HARDcy: 'Ъ', + hardcy: 'ъ', + harrcir: '⥈', + harr: '↔', + hArr: '⇔', + harrw: '↭', + Hat: '^', + hbar: 'ℏ', + Hcirc: 'Ĥ', + hcirc: 'ĥ', + hearts: '♥', + heartsuit: '♥', + hellip: '…', + hercon: '⊹', + hfr: '𝔥', + Hfr: 'ℌ', + HilbertSpace: 'ℋ', + hksearow: '⤥', + hkswarow: '⤦', + hoarr: '⇿', + homtht: '∻', + hookleftarrow: '↩', + hookrightarrow: '↪', + hopf: '𝕙', + Hopf: 'ℍ', + horbar: '―', + HorizontalLine: '─', + hscr: '𝒽', + Hscr: 'ℋ', + hslash: 'ℏ', + Hstrok: 'Ħ', + hstrok: 'ħ', + HumpDownHump: '≎', + HumpEqual: '≏', + hybull: '⁃', + hyphen: '‐', + Iacute: 'Í', + iacute: 'í', + ic: '⁣', + Icirc: 'Î', + icirc: 'î', + Icy: 'И', + icy: 'и', + Idot: 'İ', + IEcy: 'Е', + iecy: 'е', + iexcl: '¡', + iff: '⇔', + ifr: '𝔦', + Ifr: 'ℑ', + Igrave: 'Ì', + igrave: 'ì', + ii: 'ⅈ', + iiiint: '⨌', + iiint: '∭', + iinfin: '⧜', + iiota: '℩', + IJlig: 'IJ', + ijlig: 'ij', + Imacr: 'Ī', + imacr: 'ī', + image: 'ℑ', + ImaginaryI: 'ⅈ', + imagline: 'ℐ', + imagpart: 'ℑ', + imath: 'ı', + Im: 'ℑ', + imof: '⊷', + imped: 'Ƶ', + Implies: '⇒', + incare: '℅', + infin: '∞', + infintie: '⧝', + inodot: 'ı', + intcal: '⊺', + int: '∫', + Int: '∬', + integers: 'ℤ', + Integral: '∫', + intercal: '⊺', + Intersection: '⋂', + intlarhk: '⨗', + intprod: '⨼', + InvisibleComma: '⁣', + InvisibleTimes: '⁢', + IOcy: 'Ё', + iocy: 'ё', + Iogon: 'Į', + iogon: 'į', + Iopf: '𝕀', + iopf: '𝕚', + Iota: 'Ι', + iota: 'ι', + iprod: '⨼', + iquest: '¿', + iscr: '𝒾', + Iscr: 'ℐ', + isin: '∈', + isindot: '⋵', + isinE: '⋹', + isins: '⋴', + isinsv: '⋳', + isinv: '∈', + it: '⁢', + Itilde: 'Ĩ', + itilde: 'ĩ', + Iukcy: 'І', + iukcy: 'і', + Iuml: 'Ï', + iuml: 'ï', + Jcirc: 'Ĵ', + jcirc: 'ĵ', + Jcy: 'Й', + jcy: 'й', + Jfr: '𝔍', + jfr: '𝔧', + jmath: 'ȷ', + Jopf: '𝕁', + jopf: '𝕛', + Jscr: '𝒥', + jscr: '𝒿', + Jsercy: 'Ј', + jsercy: 'ј', + Jukcy: 'Є', + jukcy: 'є', + Kappa: 'Κ', + kappa: 'κ', + kappav: 'ϰ', + Kcedil: 'Ķ', + kcedil: 'ķ', + Kcy: 'К', + kcy: 'к', + Kfr: '𝔎', + kfr: '𝔨', + kgreen: 'ĸ', + KHcy: 'Х', + khcy: 'х', + KJcy: 'Ќ', + kjcy: 'ќ', + Kopf: '𝕂', + kopf: '𝕜', + Kscr: '𝒦', + kscr: '𝓀', + lAarr: '⇚', + Lacute: 'Ĺ', + lacute: 'ĺ', + laemptyv: '⦴', + lagran: 'ℒ', + Lambda: 'Λ', + lambda: 'λ', + lang: '⟨', + Lang: '⟪', + langd: '⦑', + langle: '⟨', + lap: '⪅', + Laplacetrf: 'ℒ', + laquo: '«', + larrb: '⇤', + larrbfs: '⤟', + larr: '←', + Larr: '↞', + lArr: '⇐', + larrfs: '⤝', + larrhk: '↩', + larrlp: '↫', + larrpl: '⤹', + larrsim: '⥳', + larrtl: '↢', + latail: '⤙', + lAtail: '⤛', + lat: '⪫', + late: '⪭', + lates: '⪭︀', + lbarr: '⤌', + lBarr: '⤎', + lbbrk: '❲', + lbrace: '{', + lbrack: '[', + lbrke: '⦋', + lbrksld: '⦏', + lbrkslu: '⦍', + Lcaron: 'Ľ', + lcaron: 'ľ', + Lcedil: 'Ļ', + lcedil: 'ļ', + lceil: '⌈', + lcub: '{', + Lcy: 'Л', + lcy: 'л', + ldca: '⤶', + ldquo: '“', + ldquor: '„', + ldrdhar: '⥧', + ldrushar: '⥋', + ldsh: '↲', + le: '≤', + lE: '≦', + LeftAngleBracket: '⟨', + LeftArrowBar: '⇤', + leftarrow: '←', + LeftArrow: '←', + Leftarrow: '⇐', + LeftArrowRightArrow: '⇆', + leftarrowtail: '↢', + LeftCeiling: '⌈', + LeftDoubleBracket: '⟦', + LeftDownTeeVector: '⥡', + LeftDownVectorBar: '⥙', + LeftDownVector: '⇃', + LeftFloor: '⌊', + leftharpoondown: '↽', + leftharpoonup: '↼', + leftleftarrows: '⇇', + leftrightarrow: '↔', + LeftRightArrow: '↔', + Leftrightarrow: '⇔', + leftrightarrows: '⇆', + leftrightharpoons: '⇋', + leftrightsquigarrow: '↭', + LeftRightVector: '⥎', + LeftTeeArrow: '↤', + LeftTee: '⊣', + LeftTeeVector: '⥚', + leftthreetimes: '⋋', + LeftTriangleBar: '⧏', + LeftTriangle: '⊲', + LeftTriangleEqual: '⊴', + LeftUpDownVector: '⥑', + LeftUpTeeVector: '⥠', + LeftUpVectorBar: '⥘', + LeftUpVector: '↿', + LeftVectorBar: '⥒', + LeftVector: '↼', + lEg: '⪋', + leg: '⋚', + leq: '≤', + leqq: '≦', + leqslant: '⩽', + lescc: '⪨', + les: '⩽', + lesdot: '⩿', + lesdoto: '⪁', + lesdotor: '⪃', + lesg: '⋚︀', + lesges: '⪓', + lessapprox: '⪅', + lessdot: '⋖', + lesseqgtr: '⋚', + lesseqqgtr: '⪋', + LessEqualGreater: '⋚', + LessFullEqual: '≦', + LessGreater: '≶', + lessgtr: '≶', + LessLess: '⪡', + lesssim: '≲', + LessSlantEqual: '⩽', + LessTilde: '≲', + lfisht: '⥼', + lfloor: '⌊', + Lfr: '𝔏', + lfr: '𝔩', + lg: '≶', + lgE: '⪑', + lHar: '⥢', + lhard: '↽', + lharu: '↼', + lharul: '⥪', + lhblk: '▄', + LJcy: 'Љ', + ljcy: 'љ', + llarr: '⇇', + ll: '≪', + Ll: '⋘', + llcorner: '⌞', + Lleftarrow: '⇚', + llhard: '⥫', + lltri: '◺', + Lmidot: 'Ŀ', + lmidot: 'ŀ', + lmoustache: '⎰', + lmoust: '⎰', + lnap: '⪉', + lnapprox: '⪉', + lne: '⪇', + lnE: '≨', + lneq: '⪇', + lneqq: '≨', + lnsim: '⋦', + loang: '⟬', + loarr: '⇽', + lobrk: '⟦', + longleftarrow: '⟵', + LongLeftArrow: '⟵', + Longleftarrow: '⟸', + longleftrightarrow: '⟷', + LongLeftRightArrow: '⟷', + Longleftrightarrow: '⟺', + longmapsto: '⟼', + longrightarrow: '⟶', + LongRightArrow: '⟶', + Longrightarrow: '⟹', + looparrowleft: '↫', + looparrowright: '↬', + lopar: '⦅', + Lopf: '𝕃', + lopf: '𝕝', + loplus: '⨭', + lotimes: '⨴', + lowast: '∗', + lowbar: '_', + LowerLeftArrow: '↙', + LowerRightArrow: '↘', + loz: '◊', + lozenge: '◊', + lozf: '⧫', + lpar: '(', + lparlt: '⦓', + lrarr: '⇆', + lrcorner: '⌟', + lrhar: '⇋', + lrhard: '⥭', + lrm: '‎', + lrtri: '⊿', + lsaquo: '‹', + lscr: '𝓁', + Lscr: 'ℒ', + lsh: '↰', + Lsh: '↰', + lsim: '≲', + lsime: '⪍', + lsimg: '⪏', + lsqb: '[', + lsquo: '‘', + lsquor: '‚', + Lstrok: 'Ł', + lstrok: 'ł', + ltcc: '⪦', + ltcir: '⩹', + lt: '<', + LT: '<', + Lt: '≪', + ltdot: '⋖', + lthree: '⋋', + ltimes: '⋉', + ltlarr: '⥶', + ltquest: '⩻', + ltri: '◃', + ltrie: '⊴', + ltrif: '◂', + ltrPar: '⦖', + lurdshar: '⥊', + luruhar: '⥦', + lvertneqq: '≨︀', + lvnE: '≨︀', + macr: '¯', + male: '♂', + malt: '✠', + maltese: '✠', + map: '↦', + mapsto: '↦', + mapstodown: '↧', + mapstoleft: '↤', + mapstoup: '↥', + marker: '▮', + mcomma: '⨩', + Mcy: 'М', + mcy: 'м', + mdash: '—', + mDDot: '∺', + measuredangle: '∡', + MediumSpace: ' ', + Mellintrf: 'ℳ', + Mfr: '𝔐', + mfr: '𝔪', + mho: '℧', + micro: 'µ', + midast: '*', + midcir: '⫰', + mid: '∣', + middot: '·', + minusb: '⊟', + minus: '−', + minusd: '∸', + minusdu: '⨪', + MinusPlus: '∓', + mlcp: '⫛', + mldr: '…', + mnplus: '∓', + models: '⊧', + Mopf: '𝕄', + mopf: '𝕞', + mp: '∓', + mscr: '𝓂', + Mscr: 'ℳ', + mstpos: '∾', + Mu: 'Μ', + mu: 'μ', + multimap: '⊸', + mumap: '⊸', + nabla: '∇', + Nacute: 'Ń', + nacute: 'ń', + nang: '∠⃒', + nap: '≉', + napE: '⩰̸', + napid: '≋̸', + napos: 'ʼn', + napprox: '≉', + natural: '♮', + naturals: 'ℕ', + natur: '♮', + nbsp: ' ', + nbump: '≎̸', + nbumpe: '≏̸', + ncap: '⩃', + Ncaron: 'Ň', + ncaron: 'ň', + Ncedil: 'Ņ', + ncedil: 'ņ', + ncong: '≇', + ncongdot: '⩭̸', + ncup: '⩂', + Ncy: 'Н', + ncy: 'н', + ndash: '–', + nearhk: '⤤', + nearr: '↗', + neArr: '⇗', + nearrow: '↗', + ne: '≠', + nedot: '≐̸', + NegativeMediumSpace: '​', + NegativeThickSpace: '​', + NegativeThinSpace: '​', + NegativeVeryThinSpace: '​', + nequiv: '≢', + nesear: '⤨', + nesim: '≂̸', + NestedGreaterGreater: '≫', + NestedLessLess: '≪', + NewLine: '\n', + nexist: '∄', + nexists: '∄', + Nfr: '𝔑', + nfr: '𝔫', + ngE: '≧̸', + nge: '≱', + ngeq: '≱', + ngeqq: '≧̸', + ngeqslant: '⩾̸', + nges: '⩾̸', + nGg: '⋙̸', + ngsim: '≵', + nGt: '≫⃒', + ngt: '≯', + ngtr: '≯', + nGtv: '≫̸', + nharr: '↮', + nhArr: '⇎', + nhpar: '⫲', + ni: '∋', + nis: '⋼', + nisd: '⋺', + niv: '∋', + NJcy: 'Њ', + njcy: 'њ', + nlarr: '↚', + nlArr: '⇍', + nldr: '‥', + nlE: '≦̸', + nle: '≰', + nleftarrow: '↚', + nLeftarrow: '⇍', + nleftrightarrow: '↮', + nLeftrightarrow: '⇎', + nleq: '≰', + nleqq: '≦̸', + nleqslant: '⩽̸', + nles: '⩽̸', + nless: '≮', + nLl: '⋘̸', + nlsim: '≴', + nLt: '≪⃒', + nlt: '≮', + nltri: '⋪', + nltrie: '⋬', + nLtv: '≪̸', + nmid: '∤', + NoBreak: '⁠', + NonBreakingSpace: ' ', + nopf: '𝕟', + Nopf: 'ℕ', + Not: '⫬', + not: '¬', + NotCongruent: '≢', + NotCupCap: '≭', + NotDoubleVerticalBar: '∦', + NotElement: '∉', + NotEqual: '≠', + NotEqualTilde: '≂̸', + NotExists: '∄', + NotGreater: '≯', + NotGreaterEqual: '≱', + NotGreaterFullEqual: '≧̸', + NotGreaterGreater: '≫̸', + NotGreaterLess: '≹', + NotGreaterSlantEqual: '⩾̸', + NotGreaterTilde: '≵', + NotHumpDownHump: '≎̸', + NotHumpEqual: '≏̸', + notin: '∉', + notindot: '⋵̸', + notinE: '⋹̸', + notinva: '∉', + notinvb: '⋷', + notinvc: '⋶', + NotLeftTriangleBar: '⧏̸', + NotLeftTriangle: '⋪', + NotLeftTriangleEqual: '⋬', + NotLess: '≮', + NotLessEqual: '≰', + NotLessGreater: '≸', + NotLessLess: '≪̸', + NotLessSlantEqual: '⩽̸', + NotLessTilde: '≴', + NotNestedGreaterGreater: '⪢̸', + NotNestedLessLess: '⪡̸', + notni: '∌', + notniva: '∌', + notnivb: '⋾', + notnivc: '⋽', + NotPrecedes: '⊀', + NotPrecedesEqual: '⪯̸', + NotPrecedesSlantEqual: '⋠', + NotReverseElement: '∌', + NotRightTriangleBar: '⧐̸', + NotRightTriangle: '⋫', + NotRightTriangleEqual: '⋭', + NotSquareSubset: '⊏̸', + NotSquareSubsetEqual: '⋢', + NotSquareSuperset: '⊐̸', + NotSquareSupersetEqual: '⋣', + NotSubset: '⊂⃒', + NotSubsetEqual: '⊈', + NotSucceeds: '⊁', + NotSucceedsEqual: '⪰̸', + NotSucceedsSlantEqual: '⋡', + NotSucceedsTilde: '≿̸', + NotSuperset: '⊃⃒', + NotSupersetEqual: '⊉', + NotTilde: '≁', + NotTildeEqual: '≄', + NotTildeFullEqual: '≇', + NotTildeTilde: '≉', + NotVerticalBar: '∤', + nparallel: '∦', + npar: '∦', + nparsl: '⫽⃥', + npart: '∂̸', + npolint: '⨔', + npr: '⊀', + nprcue: '⋠', + nprec: '⊀', + npreceq: '⪯̸', + npre: '⪯̸', + nrarrc: '⤳̸', + nrarr: '↛', + nrArr: '⇏', + nrarrw: '↝̸', + nrightarrow: '↛', + nRightarrow: '⇏', + nrtri: '⋫', + nrtrie: '⋭', + nsc: '⊁', + nsccue: '⋡', + nsce: '⪰̸', + Nscr: '𝒩', + nscr: '𝓃', + nshortmid: '∤', + nshortparallel: '∦', + nsim: '≁', + nsime: '≄', + nsimeq: '≄', + nsmid: '∤', + nspar: '∦', + nsqsube: '⋢', + nsqsupe: '⋣', + nsub: '⊄', + nsubE: '⫅̸', + nsube: '⊈', + nsubset: '⊂⃒', + nsubseteq: '⊈', + nsubseteqq: '⫅̸', + nsucc: '⊁', + nsucceq: '⪰̸', + nsup: '⊅', + nsupE: '⫆̸', + nsupe: '⊉', + nsupset: '⊃⃒', + nsupseteq: '⊉', + nsupseteqq: '⫆̸', + ntgl: '≹', + Ntilde: 'Ñ', + ntilde: 'ñ', + ntlg: '≸', + ntriangleleft: '⋪', + ntrianglelefteq: '⋬', + ntriangleright: '⋫', + ntrianglerighteq: '⋭', + Nu: 'Ν', + nu: 'ν', + num: '#', + numero: '№', + numsp: ' ', + nvap: '≍⃒', + nvdash: '⊬', + nvDash: '⊭', + nVdash: '⊮', + nVDash: '⊯', + nvge: '≥⃒', + nvgt: '>⃒', + nvHarr: '⤄', + nvinfin: '⧞', + nvlArr: '⤂', + nvle: '≤⃒', + nvlt: '<⃒', + nvltrie: '⊴⃒', + nvrArr: '⤃', + nvrtrie: '⊵⃒', + nvsim: '∼⃒', + nwarhk: '⤣', + nwarr: '↖', + nwArr: '⇖', + nwarrow: '↖', + nwnear: '⤧', + Oacute: 'Ó', + oacute: 'ó', + oast: '⊛', + Ocirc: 'Ô', + ocirc: 'ô', + ocir: '⊚', + Ocy: 'О', + ocy: 'о', + odash: '⊝', + Odblac: 'Ő', + odblac: 'ő', + odiv: '⨸', + odot: '⊙', + odsold: '⦼', + OElig: 'Œ', + oelig: 'œ', + ofcir: '⦿', + Ofr: '𝔒', + ofr: '𝔬', + ogon: '˛', + Ograve: 'Ò', + ograve: 'ò', + ogt: '⧁', + ohbar: '⦵', + ohm: 'Ω', + oint: '∮', + olarr: '↺', + olcir: '⦾', + olcross: '⦻', + oline: '‾', + olt: '⧀', + Omacr: 'Ō', + omacr: 'ō', + Omega: 'Ω', + omega: 'ω', + Omicron: 'Ο', + omicron: 'ο', + omid: '⦶', + ominus: '⊖', + Oopf: '𝕆', + oopf: '𝕠', + opar: '⦷', + OpenCurlyDoubleQuote: '“', + OpenCurlyQuote: '‘', + operp: '⦹', + oplus: '⊕', + orarr: '↻', + Or: '⩔', + or: '∨', + ord: '⩝', + order: 'ℴ', + orderof: 'ℴ', + ordf: 'ª', + ordm: 'º', + origof: '⊶', + oror: '⩖', + orslope: '⩗', + orv: '⩛', + oS: 'Ⓢ', + Oscr: '𝒪', + oscr: 'ℴ', + Oslash: 'Ø', + oslash: 'ø', + osol: '⊘', + Otilde: 'Õ', + otilde: 'õ', + otimesas: '⨶', + Otimes: '⨷', + otimes: '⊗', + Ouml: 'Ö', + ouml: 'ö', + ovbar: '⌽', + OverBar: '‾', + OverBrace: '⏞', + OverBracket: '⎴', + OverParenthesis: '⏜', + para: '¶', + parallel: '∥', + par: '∥', + parsim: '⫳', + parsl: '⫽', + part: '∂', + PartialD: '∂', + Pcy: 'П', + pcy: 'п', + percnt: '%', + period: '.', + permil: '‰', + perp: '⊥', + pertenk: '‱', + Pfr: '𝔓', + pfr: '𝔭', + Phi: 'Φ', + phi: 'φ', + phiv: 'ϕ', + phmmat: 'ℳ', + phone: '☎', + Pi: 'Π', + pi: 'π', + pitchfork: '⋔', + piv: 'ϖ', + planck: 'ℏ', + planckh: 'ℎ', + plankv: 'ℏ', + plusacir: '⨣', + plusb: '⊞', + pluscir: '⨢', + plus: '+', + plusdo: '∔', + plusdu: '⨥', + pluse: '⩲', + PlusMinus: '±', + plusmn: '±', + plussim: '⨦', + plustwo: '⨧', + pm: '±', + Poincareplane: 'ℌ', + pointint: '⨕', + popf: '𝕡', + Popf: 'ℙ', + pound: '£', + prap: '⪷', + Pr: '⪻', + pr: '≺', + prcue: '≼', + precapprox: '⪷', + prec: '≺', + preccurlyeq: '≼', + Precedes: '≺', + PrecedesEqual: '⪯', + PrecedesSlantEqual: '≼', + PrecedesTilde: '≾', + preceq: '⪯', + precnapprox: '⪹', + precneqq: '⪵', + precnsim: '⋨', + pre: '⪯', + prE: '⪳', + precsim: '≾', + prime: '′', + Prime: '″', + primes: 'ℙ', + prnap: '⪹', + prnE: '⪵', + prnsim: '⋨', + prod: '∏', + Product: '∏', + profalar: '⌮', + profline: '⌒', + profsurf: '⌓', + prop: '∝', + Proportional: '∝', + Proportion: '∷', + propto: '∝', + prsim: '≾', + prurel: '⊰', + Pscr: '𝒫', + pscr: '𝓅', + Psi: 'Ψ', + psi: 'ψ', + puncsp: ' ', + Qfr: '𝔔', + qfr: '𝔮', + qint: '⨌', + qopf: '𝕢', + Qopf: 'ℚ', + qprime: '⁗', + Qscr: '𝒬', + qscr: '𝓆', + quaternions: 'ℍ', + quatint: '⨖', + quest: '?', + questeq: '≟', + quot: '"', + QUOT: '"', + rAarr: '⇛', + race: '∽̱', + Racute: 'Ŕ', + racute: 'ŕ', + radic: '√', + raemptyv: '⦳', + rang: '⟩', + Rang: '⟫', + rangd: '⦒', + range: '⦥', + rangle: '⟩', + raquo: '»', + rarrap: '⥵', + rarrb: '⇥', + rarrbfs: '⤠', + rarrc: '⤳', + rarr: '→', + Rarr: '↠', + rArr: '⇒', + rarrfs: '⤞', + rarrhk: '↪', + rarrlp: '↬', + rarrpl: '⥅', + rarrsim: '⥴', + Rarrtl: '⤖', + rarrtl: '↣', + rarrw: '↝', + ratail: '⤚', + rAtail: '⤜', + ratio: '∶', + rationals: 'ℚ', + rbarr: '⤍', + rBarr: '⤏', + RBarr: '⤐', + rbbrk: '❳', + rbrace: '}', + rbrack: ']', + rbrke: '⦌', + rbrksld: '⦎', + rbrkslu: '⦐', + Rcaron: 'Ř', + rcaron: 'ř', + Rcedil: 'Ŗ', + rcedil: 'ŗ', + rceil: '⌉', + rcub: '}', + Rcy: 'Р', + rcy: 'р', + rdca: '⤷', + rdldhar: '⥩', + rdquo: '”', + rdquor: '”', + rdsh: '↳', + real: 'ℜ', + realine: 'ℛ', + realpart: 'ℜ', + reals: 'ℝ', + Re: 'ℜ', + rect: '▭', + reg: '®', + REG: '®', + ReverseElement: '∋', + ReverseEquilibrium: '⇋', + ReverseUpEquilibrium: '⥯', + rfisht: '⥽', + rfloor: '⌋', + rfr: '𝔯', + Rfr: 'ℜ', + rHar: '⥤', + rhard: '⇁', + rharu: '⇀', + rharul: '⥬', + Rho: 'Ρ', + rho: 'ρ', + rhov: 'ϱ', + RightAngleBracket: '⟩', + RightArrowBar: '⇥', + rightarrow: '→', + RightArrow: '→', + Rightarrow: '⇒', + RightArrowLeftArrow: '⇄', + rightarrowtail: '↣', + RightCeiling: '⌉', + RightDoubleBracket: '⟧', + RightDownTeeVector: '⥝', + RightDownVectorBar: '⥕', + RightDownVector: '⇂', + RightFloor: '⌋', + rightharpoondown: '⇁', + rightharpoonup: '⇀', + rightleftarrows: '⇄', + rightleftharpoons: '⇌', + rightrightarrows: '⇉', + rightsquigarrow: '↝', + RightTeeArrow: '↦', + RightTee: '⊢', + RightTeeVector: '⥛', + rightthreetimes: '⋌', + RightTriangleBar: '⧐', + RightTriangle: '⊳', + RightTriangleEqual: '⊵', + RightUpDownVector: '⥏', + RightUpTeeVector: '⥜', + RightUpVectorBar: '⥔', + RightUpVector: '↾', + RightVectorBar: '⥓', + RightVector: '⇀', + ring: '˚', + risingdotseq: '≓', + rlarr: '⇄', + rlhar: '⇌', + rlm: '‏', + rmoustache: '⎱', + rmoust: '⎱', + rnmid: '⫮', + roang: '⟭', + roarr: '⇾', + robrk: '⟧', + ropar: '⦆', + ropf: '𝕣', + Ropf: 'ℝ', + roplus: '⨮', + rotimes: '⨵', + RoundImplies: '⥰', + rpar: ')', + rpargt: '⦔', + rppolint: '⨒', + rrarr: '⇉', + Rrightarrow: '⇛', + rsaquo: '›', + rscr: '𝓇', + Rscr: 'ℛ', + rsh: '↱', + Rsh: '↱', + rsqb: ']', + rsquo: '’', + rsquor: '’', + rthree: '⋌', + rtimes: '⋊', + rtri: '▹', + rtrie: '⊵', + rtrif: '▸', + rtriltri: '⧎', + RuleDelayed: '⧴', + ruluhar: '⥨', + rx: '℞', + Sacute: 'Ś', + sacute: 'ś', + sbquo: '‚', + scap: '⪸', + Scaron: 'Š', + scaron: 'š', + Sc: '⪼', + sc: '≻', + sccue: '≽', + sce: '⪰', + scE: '⪴', + Scedil: 'Ş', + scedil: 'ş', + Scirc: 'Ŝ', + scirc: 'ŝ', + scnap: '⪺', + scnE: '⪶', + scnsim: '⋩', + scpolint: '⨓', + scsim: '≿', + Scy: 'С', + scy: 'с', + sdotb: '⊡', + sdot: '⋅', + sdote: '⩦', + searhk: '⤥', + searr: '↘', + seArr: '⇘', + searrow: '↘', + sect: '§', + semi: ';', + seswar: '⤩', + setminus: '∖', + setmn: '∖', + sext: '✶', + Sfr: '𝔖', + sfr: '𝔰', + sfrown: '⌢', + sharp: '♯', + SHCHcy: 'Щ', + shchcy: 'щ', + SHcy: 'Ш', + shcy: 'ш', + ShortDownArrow: '↓', + ShortLeftArrow: '←', + shortmid: '∣', + shortparallel: '∥', + ShortRightArrow: '→', + ShortUpArrow: '↑', + shy: '­', + Sigma: 'Σ', + sigma: 'σ', + sigmaf: 'ς', + sigmav: 'ς', + sim: '∼', + simdot: '⩪', + sime: '≃', + simeq: '≃', + simg: '⪞', + simgE: '⪠', + siml: '⪝', + simlE: '⪟', + simne: '≆', + simplus: '⨤', + simrarr: '⥲', + slarr: '←', + SmallCircle: '∘', + smallsetminus: '∖', + smashp: '⨳', + smeparsl: '⧤', + smid: '∣', + smile: '⌣', + smt: '⪪', + smte: '⪬', + smtes: '⪬︀', + SOFTcy: 'Ь', + softcy: 'ь', + solbar: '⌿', + solb: '⧄', + sol: '/', + Sopf: '𝕊', + sopf: '𝕤', + spades: '♠', + spadesuit: '♠', + spar: '∥', + sqcap: '⊓', + sqcaps: '⊓︀', + sqcup: '⊔', + sqcups: '⊔︀', + Sqrt: '√', + sqsub: '⊏', + sqsube: '⊑', + sqsubset: '⊏', + sqsubseteq: '⊑', + sqsup: '⊐', + sqsupe: '⊒', + sqsupset: '⊐', + sqsupseteq: '⊒', + square: '□', + Square: '□', + SquareIntersection: '⊓', + SquareSubset: '⊏', + SquareSubsetEqual: '⊑', + SquareSuperset: '⊐', + SquareSupersetEqual: '⊒', + SquareUnion: '⊔', + squarf: '▪', + squ: '□', + squf: '▪', + srarr: '→', + Sscr: '𝒮', + sscr: '𝓈', + ssetmn: '∖', + ssmile: '⌣', + sstarf: '⋆', + Star: '⋆', + star: '☆', + starf: '★', + straightepsilon: 'ϵ', + straightphi: 'ϕ', + strns: '¯', + sub: '⊂', + Sub: '⋐', + subdot: '⪽', + subE: '⫅', + sube: '⊆', + subedot: '⫃', + submult: '⫁', + subnE: '⫋', + subne: '⊊', + subplus: '⪿', + subrarr: '⥹', + subset: '⊂', + Subset: '⋐', + subseteq: '⊆', + subseteqq: '⫅', + SubsetEqual: '⊆', + subsetneq: '⊊', + subsetneqq: '⫋', + subsim: '⫇', + subsub: '⫕', + subsup: '⫓', + succapprox: '⪸', + succ: '≻', + succcurlyeq: '≽', + Succeeds: '≻', + SucceedsEqual: '⪰', + SucceedsSlantEqual: '≽', + SucceedsTilde: '≿', + succeq: '⪰', + succnapprox: '⪺', + succneqq: '⪶', + succnsim: '⋩', + succsim: '≿', + SuchThat: '∋', + sum: '∑', + Sum: '∑', + sung: '♪', + sup1: '¹', + sup2: '²', + sup3: '³', + sup: '⊃', + Sup: '⋑', + supdot: '⪾', + supdsub: '⫘', + supE: '⫆', + supe: '⊇', + supedot: '⫄', + Superset: '⊃', + SupersetEqual: '⊇', + suphsol: '⟉', + suphsub: '⫗', + suplarr: '⥻', + supmult: '⫂', + supnE: '⫌', + supne: '⊋', + supplus: '⫀', + supset: '⊃', + Supset: '⋑', + supseteq: '⊇', + supseteqq: '⫆', + supsetneq: '⊋', + supsetneqq: '⫌', + supsim: '⫈', + supsub: '⫔', + supsup: '⫖', + swarhk: '⤦', + swarr: '↙', + swArr: '⇙', + swarrow: '↙', + swnwar: '⤪', + szlig: 'ß', + Tab: '\t', + target: '⌖', + Tau: 'Τ', + tau: 'τ', + tbrk: '⎴', + Tcaron: 'Ť', + tcaron: 'ť', + Tcedil: 'Ţ', + tcedil: 'ţ', + Tcy: 'Т', + tcy: 'т', + tdot: '⃛', + telrec: '⌕', + Tfr: '𝔗', + tfr: '𝔱', + there4: '∴', + therefore: '∴', + Therefore: '∴', + Theta: 'Θ', + theta: 'θ', + thetasym: 'ϑ', + thetav: 'ϑ', + thickapprox: '≈', + thicksim: '∼', + ThickSpace: '  ', + ThinSpace: ' ', + thinsp: ' ', + thkap: '≈', + thksim: '∼', + THORN: 'Þ', + thorn: 'þ', + tilde: '˜', + Tilde: '∼', + TildeEqual: '≃', + TildeFullEqual: '≅', + TildeTilde: '≈', + timesbar: '⨱', + timesb: '⊠', + times: '×', + timesd: '⨰', + tint: '∭', + toea: '⤨', + topbot: '⌶', + topcir: '⫱', + top: '⊤', + Topf: '𝕋', + topf: '𝕥', + topfork: '⫚', + tosa: '⤩', + tprime: '‴', + trade: '™', + TRADE: '™', + triangle: '▵', + triangledown: '▿', + triangleleft: '◃', + trianglelefteq: '⊴', + triangleq: '≜', + triangleright: '▹', + trianglerighteq: '⊵', + tridot: '◬', + trie: '≜', + triminus: '⨺', + TripleDot: '⃛', + triplus: '⨹', + trisb: '⧍', + tritime: '⨻', + trpezium: '⏢', + Tscr: '𝒯', + tscr: '𝓉', + TScy: 'Ц', + tscy: 'ц', + TSHcy: 'Ћ', + tshcy: 'ћ', + Tstrok: 'Ŧ', + tstrok: 'ŧ', + twixt: '≬', + twoheadleftarrow: '↞', + twoheadrightarrow: '↠', + Uacute: 'Ú', + uacute: 'ú', + uarr: '↑', + Uarr: '↟', + uArr: '⇑', + Uarrocir: '⥉', + Ubrcy: 'Ў', + ubrcy: 'ў', + Ubreve: 'Ŭ', + ubreve: 'ŭ', + Ucirc: 'Û', + ucirc: 'û', + Ucy: 'У', + ucy: 'у', + udarr: '⇅', + Udblac: 'Ű', + udblac: 'ű', + udhar: '⥮', + ufisht: '⥾', + Ufr: '𝔘', + ufr: '𝔲', + Ugrave: 'Ù', + ugrave: 'ù', + uHar: '⥣', + uharl: '↿', + uharr: '↾', + uhblk: '▀', + ulcorn: '⌜', + ulcorner: '⌜', + ulcrop: '⌏', + ultri: '◸', + Umacr: 'Ū', + umacr: 'ū', + uml: '¨', + UnderBar: '_', + UnderBrace: '⏟', + UnderBracket: '⎵', + UnderParenthesis: '⏝', + Union: '⋃', + UnionPlus: '⊎', + Uogon: 'Ų', + uogon: 'ų', + Uopf: '𝕌', + uopf: '𝕦', + UpArrowBar: '⤒', + uparrow: '↑', + UpArrow: '↑', + Uparrow: '⇑', + UpArrowDownArrow: '⇅', + updownarrow: '↕', + UpDownArrow: '↕', + Updownarrow: '⇕', + UpEquilibrium: '⥮', + upharpoonleft: '↿', + upharpoonright: '↾', + uplus: '⊎', + UpperLeftArrow: '↖', + UpperRightArrow: '↗', + upsi: 'υ', + Upsi: 'ϒ', + upsih: 'ϒ', + Upsilon: 'Υ', + upsilon: 'υ', + UpTeeArrow: '↥', + UpTee: '⊥', + upuparrows: '⇈', + urcorn: '⌝', + urcorner: '⌝', + urcrop: '⌎', + Uring: 'Ů', + uring: 'ů', + urtri: '◹', + Uscr: '𝒰', + uscr: '𝓊', + utdot: '⋰', + Utilde: 'Ũ', + utilde: 'ũ', + utri: '▵', + utrif: '▴', + uuarr: '⇈', + Uuml: 'Ü', + uuml: 'ü', + uwangle: '⦧', + vangrt: '⦜', + varepsilon: 'ϵ', + varkappa: 'ϰ', + varnothing: '∅', + varphi: 'ϕ', + varpi: 'ϖ', + varpropto: '∝', + varr: '↕', + vArr: '⇕', + varrho: 'ϱ', + varsigma: 'ς', + varsubsetneq: '⊊︀', + varsubsetneqq: '⫋︀', + varsupsetneq: '⊋︀', + varsupsetneqq: '⫌︀', + vartheta: 'ϑ', + vartriangleleft: '⊲', + vartriangleright: '⊳', + vBar: '⫨', + Vbar: '⫫', + vBarv: '⫩', + Vcy: 'В', + vcy: 'в', + vdash: '⊢', + vDash: '⊨', + Vdash: '⊩', + VDash: '⊫', + Vdashl: '⫦', + veebar: '⊻', + vee: '∨', + Vee: '⋁', + veeeq: '≚', + vellip: '⋮', + verbar: '|', + Verbar: '‖', + vert: '|', + Vert: '‖', + VerticalBar: '∣', + VerticalLine: '|', + VerticalSeparator: '❘', + VerticalTilde: '≀', + VeryThinSpace: ' ', + Vfr: '𝔙', + vfr: '𝔳', + vltri: '⊲', + vnsub: '⊂⃒', + vnsup: '⊃⃒', + Vopf: '𝕍', + vopf: '𝕧', + vprop: '∝', + vrtri: '⊳', + Vscr: '𝒱', + vscr: '𝓋', + vsubnE: '⫋︀', + vsubne: '⊊︀', + vsupnE: '⫌︀', + vsupne: '⊋︀', + Vvdash: '⊪', + vzigzag: '⦚', + Wcirc: 'Ŵ', + wcirc: 'ŵ', + wedbar: '⩟', + wedge: '∧', + Wedge: '⋀', + wedgeq: '≙', + weierp: '℘', + Wfr: '𝔚', + wfr: '𝔴', + Wopf: '𝕎', + wopf: '𝕨', + wp: '℘', + wr: '≀', + wreath: '≀', + Wscr: '𝒲', + wscr: '𝓌', + xcap: '⋂', + xcirc: '◯', + xcup: '⋃', + xdtri: '▽', + Xfr: '𝔛', + xfr: '𝔵', + xharr: '⟷', + xhArr: '⟺', + Xi: 'Ξ', + xi: 'ξ', + xlarr: '⟵', + xlArr: '⟸', + xmap: '⟼', + xnis: '⋻', + xodot: '⨀', + Xopf: '𝕏', + xopf: '𝕩', + xoplus: '⨁', + xotime: '⨂', + xrarr: '⟶', + xrArr: '⟹', + Xscr: '𝒳', + xscr: '𝓍', + xsqcup: '⨆', + xuplus: '⨄', + xutri: '△', + xvee: '⋁', + xwedge: '⋀', + Yacute: 'Ý', + yacute: 'ý', + YAcy: 'Я', + yacy: 'я', + Ycirc: 'Ŷ', + ycirc: 'ŷ', + Ycy: 'Ы', + ycy: 'ы', + yen: '¥', + Yfr: '𝔜', + yfr: '𝔶', + YIcy: 'Ї', + yicy: 'ї', + Yopf: '𝕐', + yopf: '𝕪', + Yscr: '𝒴', + yscr: '𝓎', + YUcy: 'Ю', + yucy: 'ю', + yuml: 'ÿ', + Yuml: 'Ÿ', + Zacute: 'Ź', + zacute: 'ź', + Zcaron: 'Ž', + zcaron: 'ž', + Zcy: 'З', + zcy: 'з', + Zdot: 'Ż', + zdot: 'ż', + zeetrf: 'ℨ', + ZeroWidthSpace: '​', + Zeta: 'Ζ', + zeta: 'ζ', + zfr: '𝔷', + Zfr: 'ℨ', + ZHcy: 'Ж', + zhcy: 'ж', + zigrarr: '⇝', + zopf: '𝕫', + Zopf: 'ℤ', + Zscr: '𝒵', + zscr: '𝓏', + zwj: '‍', + zwnj: '‌', + default: { + Aacute: 'Á', + aacute: 'á', + Abreve: 'Ă', + abreve: 'ă', + ac: '∾', + acd: '∿', + acE: '∾̳', + Acirc: 'Â', + acirc: 'â', + acute: '´', + Acy: 'А', + acy: 'а', + AElig: 'Æ', + aelig: 'æ', + af: '⁡', + Afr: '𝔄', + afr: '𝔞', + Agrave: 'À', + agrave: 'à', + alefsym: 'ℵ', + aleph: 'ℵ', + Alpha: 'Α', + alpha: 'α', + Amacr: 'Ā', + amacr: 'ā', + amalg: '⨿', + amp: '&', + AMP: '&', + andand: '⩕', + And: '⩓', + and: '∧', + andd: '⩜', + andslope: '⩘', + andv: '⩚', + ang: '∠', + ange: '⦤', + angle: '∠', + angmsdaa: '⦨', + angmsdab: '⦩', + angmsdac: '⦪', + angmsdad: '⦫', + angmsdae: '⦬', + angmsdaf: '⦭', + angmsdag: '⦮', + angmsdah: '⦯', + angmsd: '∡', + angrt: '∟', + angrtvb: '⊾', + angrtvbd: '⦝', + angsph: '∢', + angst: 'Å', + angzarr: '⍼', + Aogon: 'Ą', + aogon: 'ą', + Aopf: '𝔸', + aopf: '𝕒', + apacir: '⩯', + ap: '≈', + apE: '⩰', + ape: '≊', + apid: '≋', + apos: "'", + ApplyFunction: '⁡', + approx: '≈', + approxeq: '≊', + Aring: 'Å', + aring: 'å', + Ascr: '𝒜', + ascr: '𝒶', + Assign: '≔', + ast: '*', + asymp: '≈', + asympeq: '≍', + Atilde: 'Ã', + atilde: 'ã', + Auml: 'Ä', + auml: 'ä', + awconint: '∳', + awint: '⨑', + backcong: '≌', + backepsilon: '϶', + backprime: '‵', + backsim: '∽', + backsimeq: '⋍', + Backslash: '∖', + Barv: '⫧', + barvee: '⊽', + barwed: '⌅', + Barwed: '⌆', + barwedge: '⌅', + bbrk: '⎵', + bbrktbrk: '⎶', + bcong: '≌', + Bcy: 'Б', + bcy: 'б', + bdquo: '„', + becaus: '∵', + because: '∵', + Because: '∵', + bemptyv: '⦰', + bepsi: '϶', + bernou: 'ℬ', + Bernoullis: 'ℬ', + Beta: 'Β', + beta: 'β', + beth: 'ℶ', + between: '≬', + Bfr: '𝔅', + bfr: '𝔟', + bigcap: '⋂', + bigcirc: '◯', + bigcup: '⋃', + bigodot: '⨀', + bigoplus: '⨁', + bigotimes: '⨂', + bigsqcup: '⨆', + bigstar: '★', + bigtriangledown: '▽', + bigtriangleup: '△', + biguplus: '⨄', + bigvee: '⋁', + bigwedge: '⋀', + bkarow: '⤍', + blacklozenge: '⧫', + blacksquare: '▪', + blacktriangle: '▴', + blacktriangledown: '▾', + blacktriangleleft: '◂', + blacktriangleright: '▸', + blank: '␣', + blk12: '▒', + blk14: '░', + blk34: '▓', + block: '█', + bne: '=⃥', + bnequiv: '≡⃥', + bNot: '⫭', + bnot: '⌐', + Bopf: '𝔹', + bopf: '𝕓', + bot: '⊥', + bottom: '⊥', + bowtie: '⋈', + boxbox: '⧉', + boxdl: '┐', + boxdL: '╕', + boxDl: '╖', + boxDL: '╗', + boxdr: '┌', + boxdR: '╒', + boxDr: '╓', + boxDR: '╔', + boxh: '─', + boxH: '═', + boxhd: '┬', + boxHd: '╤', + boxhD: '╥', + boxHD: '╦', + boxhu: '┴', + boxHu: '╧', + boxhU: '╨', + boxHU: '╩', + boxminus: '⊟', + boxplus: '⊞', + boxtimes: '⊠', + boxul: '┘', + boxuL: '╛', + boxUl: '╜', + boxUL: '╝', + boxur: '└', + boxuR: '╘', + boxUr: '╙', + boxUR: '╚', + boxv: '│', + boxV: '║', + boxvh: '┼', + boxvH: '╪', + boxVh: '╫', + boxVH: '╬', + boxvl: '┤', + boxvL: '╡', + boxVl: '╢', + boxVL: '╣', + boxvr: '├', + boxvR: '╞', + boxVr: '╟', + boxVR: '╠', + bprime: '‵', + breve: '˘', + Breve: '˘', + brvbar: '¦', + bscr: '𝒷', + Bscr: 'ℬ', + bsemi: '⁏', + bsim: '∽', + bsime: '⋍', + bsolb: '⧅', + bsol: '\\', + bsolhsub: '⟈', + bull: '•', + bullet: '•', + bump: '≎', + bumpE: '⪮', + bumpe: '≏', + Bumpeq: '≎', + bumpeq: '≏', + Cacute: 'Ć', + cacute: 'ć', + capand: '⩄', + capbrcup: '⩉', + capcap: '⩋', + cap: '∩', + Cap: '⋒', + capcup: '⩇', + capdot: '⩀', + CapitalDifferentialD: 'ⅅ', + caps: '∩︀', + caret: '⁁', + caron: 'ˇ', + Cayleys: 'ℭ', + ccaps: '⩍', + Ccaron: 'Č', + ccaron: 'č', + Ccedil: 'Ç', + ccedil: 'ç', + Ccirc: 'Ĉ', + ccirc: 'ĉ', + Cconint: '∰', + ccups: '⩌', + ccupssm: '⩐', + Cdot: 'Ċ', + cdot: 'ċ', + cedil: '¸', + Cedilla: '¸', + cemptyv: '⦲', + cent: '¢', + centerdot: '·', + CenterDot: '·', + cfr: '𝔠', + Cfr: 'ℭ', + CHcy: 'Ч', + chcy: 'ч', + check: '✓', + checkmark: '✓', + Chi: 'Χ', + chi: 'χ', + circ: 'ˆ', + circeq: '≗', + circlearrowleft: '↺', + circlearrowright: '↻', + circledast: '⊛', + circledcirc: '⊚', + circleddash: '⊝', + CircleDot: '⊙', + circledR: '®', + circledS: 'Ⓢ', + CircleMinus: '⊖', + CirclePlus: '⊕', + CircleTimes: '⊗', + cir: '○', + cirE: '⧃', + cire: '≗', + cirfnint: '⨐', + cirmid: '⫯', + cirscir: '⧂', + ClockwiseContourIntegral: '∲', + CloseCurlyDoubleQuote: '”', + CloseCurlyQuote: '’', + clubs: '♣', + clubsuit: '♣', + colon: ':', + Colon: '∷', + Colone: '⩴', + colone: '≔', + coloneq: '≔', + comma: ',', + commat: '@', + comp: '∁', + compfn: '∘', + complement: '∁', + complexes: 'ℂ', + cong: '≅', + congdot: '⩭', + Congruent: '≡', + conint: '∮', + Conint: '∯', + ContourIntegral: '∮', + copf: '𝕔', + Copf: 'ℂ', + coprod: '∐', + Coproduct: '∐', + copy: '©', + COPY: '©', + copysr: '℗', + CounterClockwiseContourIntegral: '∳', + crarr: '↵', + cross: '✗', + Cross: '⨯', + Cscr: '𝒞', + cscr: '𝒸', + csub: '⫏', + csube: '⫑', + csup: '⫐', + csupe: '⫒', + ctdot: '⋯', + cudarrl: '⤸', + cudarrr: '⤵', + cuepr: '⋞', + cuesc: '⋟', + cularr: '↶', + cularrp: '⤽', + cupbrcap: '⩈', + cupcap: '⩆', + CupCap: '≍', + cup: '∪', + Cup: '⋓', + cupcup: '⩊', + cupdot: '⊍', + cupor: '⩅', + cups: '∪︀', + curarr: '↷', + curarrm: '⤼', + curlyeqprec: '⋞', + curlyeqsucc: '⋟', + curlyvee: '⋎', + curlywedge: '⋏', + curren: '¤', + curvearrowleft: '↶', + curvearrowright: '↷', + cuvee: '⋎', + cuwed: '⋏', + cwconint: '∲', + cwint: '∱', + cylcty: '⌭', + dagger: '†', + Dagger: '‡', + daleth: 'ℸ', + darr: '↓', + Darr: '↡', + dArr: '⇓', + dash: '‐', + Dashv: '⫤', + dashv: '⊣', + dbkarow: '⤏', + dblac: '˝', + Dcaron: 'Ď', + dcaron: 'ď', + Dcy: 'Д', + dcy: 'д', + ddagger: '‡', + ddarr: '⇊', + DD: 'ⅅ', + dd: 'ⅆ', + DDotrahd: '⤑', + ddotseq: '⩷', + deg: '°', + Del: '∇', + Delta: 'Δ', + delta: 'δ', + demptyv: '⦱', + dfisht: '⥿', + Dfr: '𝔇', + dfr: '𝔡', + dHar: '⥥', + dharl: '⇃', + dharr: '⇂', + DiacriticalAcute: '´', + DiacriticalDot: '˙', + DiacriticalDoubleAcute: '˝', + DiacriticalGrave: '`', + DiacriticalTilde: '˜', + diam: '⋄', + diamond: '⋄', + Diamond: '⋄', + diamondsuit: '♦', + diams: '♦', + die: '¨', + DifferentialD: 'ⅆ', + digamma: 'ϝ', + disin: '⋲', + div: '÷', + divide: '÷', + divideontimes: '⋇', + divonx: '⋇', + DJcy: 'Ђ', + djcy: 'ђ', + dlcorn: '⌞', + dlcrop: '⌍', + dollar: '$', + Dopf: '𝔻', + dopf: '𝕕', + Dot: '¨', + dot: '˙', + DotDot: '⃜', + doteq: '≐', + doteqdot: '≑', + DotEqual: '≐', + dotminus: '∸', + dotplus: '∔', + dotsquare: '⊡', + doublebarwedge: '⌆', + DoubleContourIntegral: '∯', + DoubleDot: '¨', + DoubleDownArrow: '⇓', + DoubleLeftArrow: '⇐', + DoubleLeftRightArrow: '⇔', + DoubleLeftTee: '⫤', + DoubleLongLeftArrow: '⟸', + DoubleLongLeftRightArrow: '⟺', + DoubleLongRightArrow: '⟹', + DoubleRightArrow: '⇒', + DoubleRightTee: '⊨', + DoubleUpArrow: '⇑', + DoubleUpDownArrow: '⇕', + DoubleVerticalBar: '∥', + DownArrowBar: '⤓', + downarrow: '↓', + DownArrow: '↓', + Downarrow: '⇓', + DownArrowUpArrow: '⇵', + DownBreve: '̑', + downdownarrows: '⇊', + downharpoonleft: '⇃', + downharpoonright: '⇂', + DownLeftRightVector: '⥐', + DownLeftTeeVector: '⥞', + DownLeftVectorBar: '⥖', + DownLeftVector: '↽', + DownRightTeeVector: '⥟', + DownRightVectorBar: '⥗', + DownRightVector: '⇁', + DownTeeArrow: '↧', + DownTee: '⊤', + drbkarow: '⤐', + drcorn: '⌟', + drcrop: '⌌', + Dscr: '𝒟', + dscr: '𝒹', + DScy: 'Ѕ', + dscy: 'ѕ', + dsol: '⧶', + Dstrok: 'Đ', + dstrok: 'đ', + dtdot: '⋱', + dtri: '▿', + dtrif: '▾', + duarr: '⇵', + duhar: '⥯', + dwangle: '⦦', + DZcy: 'Џ', + dzcy: 'џ', + dzigrarr: '⟿', + Eacute: 'É', + eacute: 'é', + easter: '⩮', + Ecaron: 'Ě', + ecaron: 'ě', + Ecirc: 'Ê', + ecirc: 'ê', + ecir: '≖', + ecolon: '≕', + Ecy: 'Э', + ecy: 'э', + eDDot: '⩷', + Edot: 'Ė', + edot: 'ė', + eDot: '≑', + ee: 'ⅇ', + efDot: '≒', + Efr: '𝔈', + efr: '𝔢', + eg: '⪚', + Egrave: 'È', + egrave: 'è', + egs: '⪖', + egsdot: '⪘', + el: '⪙', + Element: '∈', + elinters: '⏧', + ell: 'ℓ', + els: '⪕', + elsdot: '⪗', + Emacr: 'Ē', + emacr: 'ē', + empty: '∅', + emptyset: '∅', + EmptySmallSquare: '◻', + emptyv: '∅', + EmptyVerySmallSquare: '▫', + emsp13: ' ', + emsp14: ' ', + emsp: ' ', + ENG: 'Ŋ', + eng: 'ŋ', + ensp: ' ', + Eogon: 'Ę', + eogon: 'ę', + Eopf: '𝔼', + eopf: '𝕖', + epar: '⋕', + eparsl: '⧣', + eplus: '⩱', + epsi: 'ε', + Epsilon: 'Ε', + epsilon: 'ε', + epsiv: 'ϵ', + eqcirc: '≖', + eqcolon: '≕', + eqsim: '≂', + eqslantgtr: '⪖', + eqslantless: '⪕', + Equal: '⩵', + equals: '=', + EqualTilde: '≂', + equest: '≟', + Equilibrium: '⇌', + equiv: '≡', + equivDD: '⩸', + eqvparsl: '⧥', + erarr: '⥱', + erDot: '≓', + escr: 'ℯ', + Escr: 'ℰ', + esdot: '≐', + Esim: '⩳', + esim: '≂', + Eta: 'Η', + eta: 'η', + ETH: 'Ð', + eth: 'ð', + Euml: 'Ë', + euml: 'ë', + euro: '€', + excl: '!', + exist: '∃', + Exists: '∃', + expectation: 'ℰ', + exponentiale: 'ⅇ', + ExponentialE: 'ⅇ', + fallingdotseq: '≒', + Fcy: 'Ф', + fcy: 'ф', + female: '♀', + ffilig: 'ffi', + fflig: 'ff', + ffllig: 'ffl', + Ffr: '𝔉', + ffr: '𝔣', + filig: 'fi', + FilledSmallSquare: '◼', + FilledVerySmallSquare: '▪', + fjlig: 'fj', + flat: '♭', + fllig: 'fl', + fltns: '▱', + fnof: 'ƒ', + Fopf: '𝔽', + fopf: '𝕗', + forall: '∀', + ForAll: '∀', + fork: '⋔', + forkv: '⫙', + Fouriertrf: 'ℱ', + fpartint: '⨍', + frac12: '½', + frac13: '⅓', + frac14: '¼', + frac15: '⅕', + frac16: '⅙', + frac18: '⅛', + frac23: '⅔', + frac25: '⅖', + frac34: '¾', + frac35: '⅗', + frac38: '⅜', + frac45: '⅘', + frac56: '⅚', + frac58: '⅝', + frac78: '⅞', + frasl: '⁄', + frown: '⌢', + fscr: '𝒻', + Fscr: 'ℱ', + gacute: 'ǵ', + Gamma: 'Γ', + gamma: 'γ', + Gammad: 'Ϝ', + gammad: 'ϝ', + gap: '⪆', + Gbreve: 'Ğ', + gbreve: 'ğ', + Gcedil: 'Ģ', + Gcirc: 'Ĝ', + gcirc: 'ĝ', + Gcy: 'Г', + gcy: 'г', + Gdot: 'Ġ', + gdot: 'ġ', + ge: '≥', + gE: '≧', + gEl: '⪌', + gel: '⋛', + geq: '≥', + geqq: '≧', + geqslant: '⩾', + gescc: '⪩', + ges: '⩾', + gesdot: '⪀', + gesdoto: '⪂', + gesdotol: '⪄', + gesl: '⋛︀', + gesles: '⪔', + Gfr: '𝔊', + gfr: '𝔤', + gg: '≫', + Gg: '⋙', + ggg: '⋙', + gimel: 'ℷ', + GJcy: 'Ѓ', + gjcy: 'ѓ', + gla: '⪥', + gl: '≷', + glE: '⪒', + glj: '⪤', + gnap: '⪊', + gnapprox: '⪊', + gne: '⪈', + gnE: '≩', + gneq: '⪈', + gneqq: '≩', + gnsim: '⋧', + Gopf: '𝔾', + gopf: '𝕘', + grave: '`', + GreaterEqual: '≥', + GreaterEqualLess: '⋛', + GreaterFullEqual: '≧', + GreaterGreater: '⪢', + GreaterLess: '≷', + GreaterSlantEqual: '⩾', + GreaterTilde: '≳', + Gscr: '𝒢', + gscr: 'ℊ', + gsim: '≳', + gsime: '⪎', + gsiml: '⪐', + gtcc: '⪧', + gtcir: '⩺', + gt: '>', + GT: '>', + Gt: '≫', + gtdot: '⋗', + gtlPar: '⦕', + gtquest: '⩼', + gtrapprox: '⪆', + gtrarr: '⥸', + gtrdot: '⋗', + gtreqless: '⋛', + gtreqqless: '⪌', + gtrless: '≷', + gtrsim: '≳', + gvertneqq: '≩︀', + gvnE: '≩︀', + Hacek: 'ˇ', + hairsp: ' ', + half: '½', + hamilt: 'ℋ', + HARDcy: 'Ъ', + hardcy: 'ъ', + harrcir: '⥈', + harr: '↔', + hArr: '⇔', + harrw: '↭', + Hat: '^', + hbar: 'ℏ', + Hcirc: 'Ĥ', + hcirc: 'ĥ', + hearts: '♥', + heartsuit: '♥', + hellip: '…', + hercon: '⊹', + hfr: '𝔥', + Hfr: 'ℌ', + HilbertSpace: 'ℋ', + hksearow: '⤥', + hkswarow: '⤦', + hoarr: '⇿', + homtht: '∻', + hookleftarrow: '↩', + hookrightarrow: '↪', + hopf: '𝕙', + Hopf: 'ℍ', + horbar: '―', + HorizontalLine: '─', + hscr: '𝒽', + Hscr: 'ℋ', + hslash: 'ℏ', + Hstrok: 'Ħ', + hstrok: 'ħ', + HumpDownHump: '≎', + HumpEqual: '≏', + hybull: '⁃', + hyphen: '‐', + Iacute: 'Í', + iacute: 'í', + ic: '⁣', + Icirc: 'Î', + icirc: 'î', + Icy: 'И', + icy: 'и', + Idot: 'İ', + IEcy: 'Е', + iecy: 'е', + iexcl: '¡', + iff: '⇔', + ifr: '𝔦', + Ifr: 'ℑ', + Igrave: 'Ì', + igrave: 'ì', + ii: 'ⅈ', + iiiint: '⨌', + iiint: '∭', + iinfin: '⧜', + iiota: '℩', + IJlig: 'IJ', + ijlig: 'ij', + Imacr: 'Ī', + imacr: 'ī', + image: 'ℑ', + ImaginaryI: 'ⅈ', + imagline: 'ℐ', + imagpart: 'ℑ', + imath: 'ı', + Im: 'ℑ', + imof: '⊷', + imped: 'Ƶ', + Implies: '⇒', + incare: '℅', + in: '∈', + infin: '∞', + infintie: '⧝', + inodot: 'ı', + intcal: '⊺', + int: '∫', + Int: '∬', + integers: 'ℤ', + Integral: '∫', + intercal: '⊺', + Intersection: '⋂', + intlarhk: '⨗', + intprod: '⨼', + InvisibleComma: '⁣', + InvisibleTimes: '⁢', + IOcy: 'Ё', + iocy: 'ё', + Iogon: 'Į', + iogon: 'į', + Iopf: '𝕀', + iopf: '𝕚', + Iota: 'Ι', + iota: 'ι', + iprod: '⨼', + iquest: '¿', + iscr: '𝒾', + Iscr: 'ℐ', + isin: '∈', + isindot: '⋵', + isinE: '⋹', + isins: '⋴', + isinsv: '⋳', + isinv: '∈', + it: '⁢', + Itilde: 'Ĩ', + itilde: 'ĩ', + Iukcy: 'І', + iukcy: 'і', + Iuml: 'Ï', + iuml: 'ï', + Jcirc: 'Ĵ', + jcirc: 'ĵ', + Jcy: 'Й', + jcy: 'й', + Jfr: '𝔍', + jfr: '𝔧', + jmath: 'ȷ', + Jopf: '𝕁', + jopf: '𝕛', + Jscr: '𝒥', + jscr: '𝒿', + Jsercy: 'Ј', + jsercy: 'ј', + Jukcy: 'Є', + jukcy: 'є', + Kappa: 'Κ', + kappa: 'κ', + kappav: 'ϰ', + Kcedil: 'Ķ', + kcedil: 'ķ', + Kcy: 'К', + kcy: 'к', + Kfr: '𝔎', + kfr: '𝔨', + kgreen: 'ĸ', + KHcy: 'Х', + khcy: 'х', + KJcy: 'Ќ', + kjcy: 'ќ', + Kopf: '𝕂', + kopf: '𝕜', + Kscr: '𝒦', + kscr: '𝓀', + lAarr: '⇚', + Lacute: 'Ĺ', + lacute: 'ĺ', + laemptyv: '⦴', + lagran: 'ℒ', + Lambda: 'Λ', + lambda: 'λ', + lang: '⟨', + Lang: '⟪', + langd: '⦑', + langle: '⟨', + lap: '⪅', + Laplacetrf: 'ℒ', + laquo: '«', + larrb: '⇤', + larrbfs: '⤟', + larr: '←', + Larr: '↞', + lArr: '⇐', + larrfs: '⤝', + larrhk: '↩', + larrlp: '↫', + larrpl: '⤹', + larrsim: '⥳', + larrtl: '↢', + latail: '⤙', + lAtail: '⤛', + lat: '⪫', + late: '⪭', + lates: '⪭︀', + lbarr: '⤌', + lBarr: '⤎', + lbbrk: '❲', + lbrace: '{', + lbrack: '[', + lbrke: '⦋', + lbrksld: '⦏', + lbrkslu: '⦍', + Lcaron: 'Ľ', + lcaron: 'ľ', + Lcedil: 'Ļ', + lcedil: 'ļ', + lceil: '⌈', + lcub: '{', + Lcy: 'Л', + lcy: 'л', + ldca: '⤶', + ldquo: '“', + ldquor: '„', + ldrdhar: '⥧', + ldrushar: '⥋', + ldsh: '↲', + le: '≤', + lE: '≦', + LeftAngleBracket: '⟨', + LeftArrowBar: '⇤', + leftarrow: '←', + LeftArrow: '←', + Leftarrow: '⇐', + LeftArrowRightArrow: '⇆', + leftarrowtail: '↢', + LeftCeiling: '⌈', + LeftDoubleBracket: '⟦', + LeftDownTeeVector: '⥡', + LeftDownVectorBar: '⥙', + LeftDownVector: '⇃', + LeftFloor: '⌊', + leftharpoondown: '↽', + leftharpoonup: '↼', + leftleftarrows: '⇇', + leftrightarrow: '↔', + LeftRightArrow: '↔', + Leftrightarrow: '⇔', + leftrightarrows: '⇆', + leftrightharpoons: '⇋', + leftrightsquigarrow: '↭', + LeftRightVector: '⥎', + LeftTeeArrow: '↤', + LeftTee: '⊣', + LeftTeeVector: '⥚', + leftthreetimes: '⋋', + LeftTriangleBar: '⧏', + LeftTriangle: '⊲', + LeftTriangleEqual: '⊴', + LeftUpDownVector: '⥑', + LeftUpTeeVector: '⥠', + LeftUpVectorBar: '⥘', + LeftUpVector: '↿', + LeftVectorBar: '⥒', + LeftVector: '↼', + lEg: '⪋', + leg: '⋚', + leq: '≤', + leqq: '≦', + leqslant: '⩽', + lescc: '⪨', + les: '⩽', + lesdot: '⩿', + lesdoto: '⪁', + lesdotor: '⪃', + lesg: '⋚︀', + lesges: '⪓', + lessapprox: '⪅', + lessdot: '⋖', + lesseqgtr: '⋚', + lesseqqgtr: '⪋', + LessEqualGreater: '⋚', + LessFullEqual: '≦', + LessGreater: '≶', + lessgtr: '≶', + LessLess: '⪡', + lesssim: '≲', + LessSlantEqual: '⩽', + LessTilde: '≲', + lfisht: '⥼', + lfloor: '⌊', + Lfr: '𝔏', + lfr: '𝔩', + lg: '≶', + lgE: '⪑', + lHar: '⥢', + lhard: '↽', + lharu: '↼', + lharul: '⥪', + lhblk: '▄', + LJcy: 'Љ', + ljcy: 'љ', + llarr: '⇇', + ll: '≪', + Ll: '⋘', + llcorner: '⌞', + Lleftarrow: '⇚', + llhard: '⥫', + lltri: '◺', + Lmidot: 'Ŀ', + lmidot: 'ŀ', + lmoustache: '⎰', + lmoust: '⎰', + lnap: '⪉', + lnapprox: '⪉', + lne: '⪇', + lnE: '≨', + lneq: '⪇', + lneqq: '≨', + lnsim: '⋦', + loang: '⟬', + loarr: '⇽', + lobrk: '⟦', + longleftarrow: '⟵', + LongLeftArrow: '⟵', + Longleftarrow: '⟸', + longleftrightarrow: '⟷', + LongLeftRightArrow: '⟷', + Longleftrightarrow: '⟺', + longmapsto: '⟼', + longrightarrow: '⟶', + LongRightArrow: '⟶', + Longrightarrow: '⟹', + looparrowleft: '↫', + looparrowright: '↬', + lopar: '⦅', + Lopf: '𝕃', + lopf: '𝕝', + loplus: '⨭', + lotimes: '⨴', + lowast: '∗', + lowbar: '_', + LowerLeftArrow: '↙', + LowerRightArrow: '↘', + loz: '◊', + lozenge: '◊', + lozf: '⧫', + lpar: '(', + lparlt: '⦓', + lrarr: '⇆', + lrcorner: '⌟', + lrhar: '⇋', + lrhard: '⥭', + lrm: '‎', + lrtri: '⊿', + lsaquo: '‹', + lscr: '𝓁', + Lscr: 'ℒ', + lsh: '↰', + Lsh: '↰', + lsim: '≲', + lsime: '⪍', + lsimg: '⪏', + lsqb: '[', + lsquo: '‘', + lsquor: '‚', + Lstrok: 'Ł', + lstrok: 'ł', + ltcc: '⪦', + ltcir: '⩹', + lt: '<', + LT: '<', + Lt: '≪', + ltdot: '⋖', + lthree: '⋋', + ltimes: '⋉', + ltlarr: '⥶', + ltquest: '⩻', + ltri: '◃', + ltrie: '⊴', + ltrif: '◂', + ltrPar: '⦖', + lurdshar: '⥊', + luruhar: '⥦', + lvertneqq: '≨︀', + lvnE: '≨︀', + macr: '¯', + male: '♂', + malt: '✠', + maltese: '✠', + Map: '⤅', + map: '↦', + mapsto: '↦', + mapstodown: '↧', + mapstoleft: '↤', + mapstoup: '↥', + marker: '▮', + mcomma: '⨩', + Mcy: 'М', + mcy: 'м', + mdash: '—', + mDDot: '∺', + measuredangle: '∡', + MediumSpace: ' ', + Mellintrf: 'ℳ', + Mfr: '𝔐', + mfr: '𝔪', + mho: '℧', + micro: 'µ', + midast: '*', + midcir: '⫰', + mid: '∣', + middot: '·', + minusb: '⊟', + minus: '−', + minusd: '∸', + minusdu: '⨪', + MinusPlus: '∓', + mlcp: '⫛', + mldr: '…', + mnplus: '∓', + models: '⊧', + Mopf: '𝕄', + mopf: '𝕞', + mp: '∓', + mscr: '𝓂', + Mscr: 'ℳ', + mstpos: '∾', + Mu: 'Μ', + mu: 'μ', + multimap: '⊸', + mumap: '⊸', + nabla: '∇', + Nacute: 'Ń', + nacute: 'ń', + nang: '∠⃒', + nap: '≉', + napE: '⩰̸', + napid: '≋̸', + napos: 'ʼn', + napprox: '≉', + natural: '♮', + naturals: 'ℕ', + natur: '♮', + nbsp: ' ', + nbump: '≎̸', + nbumpe: '≏̸', + ncap: '⩃', + Ncaron: 'Ň', + ncaron: 'ň', + Ncedil: 'Ņ', + ncedil: 'ņ', + ncong: '≇', + ncongdot: '⩭̸', + ncup: '⩂', + Ncy: 'Н', + ncy: 'н', + ndash: '–', + nearhk: '⤤', + nearr: '↗', + neArr: '⇗', + nearrow: '↗', + ne: '≠', + nedot: '≐̸', + NegativeMediumSpace: '​', + NegativeThickSpace: '​', + NegativeThinSpace: '​', + NegativeVeryThinSpace: '​', + nequiv: '≢', + nesear: '⤨', + nesim: '≂̸', + NestedGreaterGreater: '≫', + NestedLessLess: '≪', + NewLine: '\n', + nexist: '∄', + nexists: '∄', + Nfr: '𝔑', + nfr: '𝔫', + ngE: '≧̸', + nge: '≱', + ngeq: '≱', + ngeqq: '≧̸', + ngeqslant: '⩾̸', + nges: '⩾̸', + nGg: '⋙̸', + ngsim: '≵', + nGt: '≫⃒', + ngt: '≯', + ngtr: '≯', + nGtv: '≫̸', + nharr: '↮', + nhArr: '⇎', + nhpar: '⫲', + ni: '∋', + nis: '⋼', + nisd: '⋺', + niv: '∋', + NJcy: 'Њ', + njcy: 'њ', + nlarr: '↚', + nlArr: '⇍', + nldr: '‥', + nlE: '≦̸', + nle: '≰', + nleftarrow: '↚', + nLeftarrow: '⇍', + nleftrightarrow: '↮', + nLeftrightarrow: '⇎', + nleq: '≰', + nleqq: '≦̸', + nleqslant: '⩽̸', + nles: '⩽̸', + nless: '≮', + nLl: '⋘̸', + nlsim: '≴', + nLt: '≪⃒', + nlt: '≮', + nltri: '⋪', + nltrie: '⋬', + nLtv: '≪̸', + nmid: '∤', + NoBreak: '⁠', + NonBreakingSpace: ' ', + nopf: '𝕟', + Nopf: 'ℕ', + Not: '⫬', + not: '¬', + NotCongruent: '≢', + NotCupCap: '≭', + NotDoubleVerticalBar: '∦', + NotElement: '∉', + NotEqual: '≠', + NotEqualTilde: '≂̸', + NotExists: '∄', + NotGreater: '≯', + NotGreaterEqual: '≱', + NotGreaterFullEqual: '≧̸', + NotGreaterGreater: '≫̸', + NotGreaterLess: '≹', + NotGreaterSlantEqual: '⩾̸', + NotGreaterTilde: '≵', + NotHumpDownHump: '≎̸', + NotHumpEqual: '≏̸', + notin: '∉', + notindot: '⋵̸', + notinE: '⋹̸', + notinva: '∉', + notinvb: '⋷', + notinvc: '⋶', + NotLeftTriangleBar: '⧏̸', + NotLeftTriangle: '⋪', + NotLeftTriangleEqual: '⋬', + NotLess: '≮', + NotLessEqual: '≰', + NotLessGreater: '≸', + NotLessLess: '≪̸', + NotLessSlantEqual: '⩽̸', + NotLessTilde: '≴', + NotNestedGreaterGreater: '⪢̸', + NotNestedLessLess: '⪡̸', + notni: '∌', + notniva: '∌', + notnivb: '⋾', + notnivc: '⋽', + NotPrecedes: '⊀', + NotPrecedesEqual: '⪯̸', + NotPrecedesSlantEqual: '⋠', + NotReverseElement: '∌', + NotRightTriangleBar: '⧐̸', + NotRightTriangle: '⋫', + NotRightTriangleEqual: '⋭', + NotSquareSubset: '⊏̸', + NotSquareSubsetEqual: '⋢', + NotSquareSuperset: '⊐̸', + NotSquareSupersetEqual: '⋣', + NotSubset: '⊂⃒', + NotSubsetEqual: '⊈', + NotSucceeds: '⊁', + NotSucceedsEqual: '⪰̸', + NotSucceedsSlantEqual: '⋡', + NotSucceedsTilde: '≿̸', + NotSuperset: '⊃⃒', + NotSupersetEqual: '⊉', + NotTilde: '≁', + NotTildeEqual: '≄', + NotTildeFullEqual: '≇', + NotTildeTilde: '≉', + NotVerticalBar: '∤', + nparallel: '∦', + npar: '∦', + nparsl: '⫽⃥', + npart: '∂̸', + npolint: '⨔', + npr: '⊀', + nprcue: '⋠', + nprec: '⊀', + npreceq: '⪯̸', + npre: '⪯̸', + nrarrc: '⤳̸', + nrarr: '↛', + nrArr: '⇏', + nrarrw: '↝̸', + nrightarrow: '↛', + nRightarrow: '⇏', + nrtri: '⋫', + nrtrie: '⋭', + nsc: '⊁', + nsccue: '⋡', + nsce: '⪰̸', + Nscr: '𝒩', + nscr: '𝓃', + nshortmid: '∤', + nshortparallel: '∦', + nsim: '≁', + nsime: '≄', + nsimeq: '≄', + nsmid: '∤', + nspar: '∦', + nsqsube: '⋢', + nsqsupe: '⋣', + nsub: '⊄', + nsubE: '⫅̸', + nsube: '⊈', + nsubset: '⊂⃒', + nsubseteq: '⊈', + nsubseteqq: '⫅̸', + nsucc: '⊁', + nsucceq: '⪰̸', + nsup: '⊅', + nsupE: '⫆̸', + nsupe: '⊉', + nsupset: '⊃⃒', + nsupseteq: '⊉', + nsupseteqq: '⫆̸', + ntgl: '≹', + Ntilde: 'Ñ', + ntilde: 'ñ', + ntlg: '≸', + ntriangleleft: '⋪', + ntrianglelefteq: '⋬', + ntriangleright: '⋫', + ntrianglerighteq: '⋭', + Nu: 'Ν', + nu: 'ν', + num: '#', + numero: '№', + numsp: ' ', + nvap: '≍⃒', + nvdash: '⊬', + nvDash: '⊭', + nVdash: '⊮', + nVDash: '⊯', + nvge: '≥⃒', + nvgt: '>⃒', + nvHarr: '⤄', + nvinfin: '⧞', + nvlArr: '⤂', + nvle: '≤⃒', + nvlt: '<⃒', + nvltrie: '⊴⃒', + nvrArr: '⤃', + nvrtrie: '⊵⃒', + nvsim: '∼⃒', + nwarhk: '⤣', + nwarr: '↖', + nwArr: '⇖', + nwarrow: '↖', + nwnear: '⤧', + Oacute: 'Ó', + oacute: 'ó', + oast: '⊛', + Ocirc: 'Ô', + ocirc: 'ô', + ocir: '⊚', + Ocy: 'О', + ocy: 'о', + odash: '⊝', + Odblac: 'Ő', + odblac: 'ő', + odiv: '⨸', + odot: '⊙', + odsold: '⦼', + OElig: 'Œ', + oelig: 'œ', + ofcir: '⦿', + Ofr: '𝔒', + ofr: '𝔬', + ogon: '˛', + Ograve: 'Ò', + ograve: 'ò', + ogt: '⧁', + ohbar: '⦵', + ohm: 'Ω', + oint: '∮', + olarr: '↺', + olcir: '⦾', + olcross: '⦻', + oline: '‾', + olt: '⧀', + Omacr: 'Ō', + omacr: 'ō', + Omega: 'Ω', + omega: 'ω', + Omicron: 'Ο', + omicron: 'ο', + omid: '⦶', + ominus: '⊖', + Oopf: '𝕆', + oopf: '𝕠', + opar: '⦷', + OpenCurlyDoubleQuote: '“', + OpenCurlyQuote: '‘', + operp: '⦹', + oplus: '⊕', + orarr: '↻', + Or: '⩔', + or: '∨', + ord: '⩝', + order: 'ℴ', + orderof: 'ℴ', + ordf: 'ª', + ordm: 'º', + origof: '⊶', + oror: '⩖', + orslope: '⩗', + orv: '⩛', + oS: 'Ⓢ', + Oscr: '𝒪', + oscr: 'ℴ', + Oslash: 'Ø', + oslash: 'ø', + osol: '⊘', + Otilde: 'Õ', + otilde: 'õ', + otimesas: '⨶', + Otimes: '⨷', + otimes: '⊗', + Ouml: 'Ö', + ouml: 'ö', + ovbar: '⌽', + OverBar: '‾', + OverBrace: '⏞', + OverBracket: '⎴', + OverParenthesis: '⏜', + para: '¶', + parallel: '∥', + par: '∥', + parsim: '⫳', + parsl: '⫽', + part: '∂', + PartialD: '∂', + Pcy: 'П', + pcy: 'п', + percnt: '%', + period: '.', + permil: '‰', + perp: '⊥', + pertenk: '‱', + Pfr: '𝔓', + pfr: '𝔭', + Phi: 'Φ', + phi: 'φ', + phiv: 'ϕ', + phmmat: 'ℳ', + phone: '☎', + Pi: 'Π', + pi: 'π', + pitchfork: '⋔', + piv: 'ϖ', + planck: 'ℏ', + planckh: 'ℎ', + plankv: 'ℏ', + plusacir: '⨣', + plusb: '⊞', + pluscir: '⨢', + plus: '+', + plusdo: '∔', + plusdu: '⨥', + pluse: '⩲', + PlusMinus: '±', + plusmn: '±', + plussim: '⨦', + plustwo: '⨧', + pm: '±', + Poincareplane: 'ℌ', + pointint: '⨕', + popf: '𝕡', + Popf: 'ℙ', + pound: '£', + prap: '⪷', + Pr: '⪻', + pr: '≺', + prcue: '≼', + precapprox: '⪷', + prec: '≺', + preccurlyeq: '≼', + Precedes: '≺', + PrecedesEqual: '⪯', + PrecedesSlantEqual: '≼', + PrecedesTilde: '≾', + preceq: '⪯', + precnapprox: '⪹', + precneqq: '⪵', + precnsim: '⋨', + pre: '⪯', + prE: '⪳', + precsim: '≾', + prime: '′', + Prime: '″', + primes: 'ℙ', + prnap: '⪹', + prnE: '⪵', + prnsim: '⋨', + prod: '∏', + Product: '∏', + profalar: '⌮', + profline: '⌒', + profsurf: '⌓', + prop: '∝', + Proportional: '∝', + Proportion: '∷', + propto: '∝', + prsim: '≾', + prurel: '⊰', + Pscr: '𝒫', + pscr: '𝓅', + Psi: 'Ψ', + psi: 'ψ', + puncsp: ' ', + Qfr: '𝔔', + qfr: '𝔮', + qint: '⨌', + qopf: '𝕢', + Qopf: 'ℚ', + qprime: '⁗', + Qscr: '𝒬', + qscr: '𝓆', + quaternions: 'ℍ', + quatint: '⨖', + quest: '?', + questeq: '≟', + quot: '"', + QUOT: '"', + rAarr: '⇛', + race: '∽̱', + Racute: 'Ŕ', + racute: 'ŕ', + radic: '√', + raemptyv: '⦳', + rang: '⟩', + Rang: '⟫', + rangd: '⦒', + range: '⦥', + rangle: '⟩', + raquo: '»', + rarrap: '⥵', + rarrb: '⇥', + rarrbfs: '⤠', + rarrc: '⤳', + rarr: '→', + Rarr: '↠', + rArr: '⇒', + rarrfs: '⤞', + rarrhk: '↪', + rarrlp: '↬', + rarrpl: '⥅', + rarrsim: '⥴', + Rarrtl: '⤖', + rarrtl: '↣', + rarrw: '↝', + ratail: '⤚', + rAtail: '⤜', + ratio: '∶', + rationals: 'ℚ', + rbarr: '⤍', + rBarr: '⤏', + RBarr: '⤐', + rbbrk: '❳', + rbrace: '}', + rbrack: ']', + rbrke: '⦌', + rbrksld: '⦎', + rbrkslu: '⦐', + Rcaron: 'Ř', + rcaron: 'ř', + Rcedil: 'Ŗ', + rcedil: 'ŗ', + rceil: '⌉', + rcub: '}', + Rcy: 'Р', + rcy: 'р', + rdca: '⤷', + rdldhar: '⥩', + rdquo: '”', + rdquor: '”', + rdsh: '↳', + real: 'ℜ', + realine: 'ℛ', + realpart: 'ℜ', + reals: 'ℝ', + Re: 'ℜ', + rect: '▭', + reg: '®', + REG: '®', + ReverseElement: '∋', + ReverseEquilibrium: '⇋', + ReverseUpEquilibrium: '⥯', + rfisht: '⥽', + rfloor: '⌋', + rfr: '𝔯', + Rfr: 'ℜ', + rHar: '⥤', + rhard: '⇁', + rharu: '⇀', + rharul: '⥬', + Rho: 'Ρ', + rho: 'ρ', + rhov: 'ϱ', + RightAngleBracket: '⟩', + RightArrowBar: '⇥', + rightarrow: '→', + RightArrow: '→', + Rightarrow: '⇒', + RightArrowLeftArrow: '⇄', + rightarrowtail: '↣', + RightCeiling: '⌉', + RightDoubleBracket: '⟧', + RightDownTeeVector: '⥝', + RightDownVectorBar: '⥕', + RightDownVector: '⇂', + RightFloor: '⌋', + rightharpoondown: '⇁', + rightharpoonup: '⇀', + rightleftarrows: '⇄', + rightleftharpoons: '⇌', + rightrightarrows: '⇉', + rightsquigarrow: '↝', + RightTeeArrow: '↦', + RightTee: '⊢', + RightTeeVector: '⥛', + rightthreetimes: '⋌', + RightTriangleBar: '⧐', + RightTriangle: '⊳', + RightTriangleEqual: '⊵', + RightUpDownVector: '⥏', + RightUpTeeVector: '⥜', + RightUpVectorBar: '⥔', + RightUpVector: '↾', + RightVectorBar: '⥓', + RightVector: '⇀', + ring: '˚', + risingdotseq: '≓', + rlarr: '⇄', + rlhar: '⇌', + rlm: '‏', + rmoustache: '⎱', + rmoust: '⎱', + rnmid: '⫮', + roang: '⟭', + roarr: '⇾', + robrk: '⟧', + ropar: '⦆', + ropf: '𝕣', + Ropf: 'ℝ', + roplus: '⨮', + rotimes: '⨵', + RoundImplies: '⥰', + rpar: ')', + rpargt: '⦔', + rppolint: '⨒', + rrarr: '⇉', + Rrightarrow: '⇛', + rsaquo: '›', + rscr: '𝓇', + Rscr: 'ℛ', + rsh: '↱', + Rsh: '↱', + rsqb: ']', + rsquo: '’', + rsquor: '’', + rthree: '⋌', + rtimes: '⋊', + rtri: '▹', + rtrie: '⊵', + rtrif: '▸', + rtriltri: '⧎', + RuleDelayed: '⧴', + ruluhar: '⥨', + rx: '℞', + Sacute: 'Ś', + sacute: 'ś', + sbquo: '‚', + scap: '⪸', + Scaron: 'Š', + scaron: 'š', + Sc: '⪼', + sc: '≻', + sccue: '≽', + sce: '⪰', + scE: '⪴', + Scedil: 'Ş', + scedil: 'ş', + Scirc: 'Ŝ', + scirc: 'ŝ', + scnap: '⪺', + scnE: '⪶', + scnsim: '⋩', + scpolint: '⨓', + scsim: '≿', + Scy: 'С', + scy: 'с', + sdotb: '⊡', + sdot: '⋅', + sdote: '⩦', + searhk: '⤥', + searr: '↘', + seArr: '⇘', + searrow: '↘', + sect: '§', + semi: ';', + seswar: '⤩', + setminus: '∖', + setmn: '∖', + sext: '✶', + Sfr: '𝔖', + sfr: '𝔰', + sfrown: '⌢', + sharp: '♯', + SHCHcy: 'Щ', + shchcy: 'щ', + SHcy: 'Ш', + shcy: 'ш', + ShortDownArrow: '↓', + ShortLeftArrow: '←', + shortmid: '∣', + shortparallel: '∥', + ShortRightArrow: '→', + ShortUpArrow: '↑', + shy: '­', + Sigma: 'Σ', + sigma: 'σ', + sigmaf: 'ς', + sigmav: 'ς', + sim: '∼', + simdot: '⩪', + sime: '≃', + simeq: '≃', + simg: '⪞', + simgE: '⪠', + siml: '⪝', + simlE: '⪟', + simne: '≆', + simplus: '⨤', + simrarr: '⥲', + slarr: '←', + SmallCircle: '∘', + smallsetminus: '∖', + smashp: '⨳', + smeparsl: '⧤', + smid: '∣', + smile: '⌣', + smt: '⪪', + smte: '⪬', + smtes: '⪬︀', + SOFTcy: 'Ь', + softcy: 'ь', + solbar: '⌿', + solb: '⧄', + sol: '/', + Sopf: '𝕊', + sopf: '𝕤', + spades: '♠', + spadesuit: '♠', + spar: '∥', + sqcap: '⊓', + sqcaps: '⊓︀', + sqcup: '⊔', + sqcups: '⊔︀', + Sqrt: '√', + sqsub: '⊏', + sqsube: '⊑', + sqsubset: '⊏', + sqsubseteq: '⊑', + sqsup: '⊐', + sqsupe: '⊒', + sqsupset: '⊐', + sqsupseteq: '⊒', + square: '□', + Square: '□', + SquareIntersection: '⊓', + SquareSubset: '⊏', + SquareSubsetEqual: '⊑', + SquareSuperset: '⊐', + SquareSupersetEqual: '⊒', + SquareUnion: '⊔', + squarf: '▪', + squ: '□', + squf: '▪', + srarr: '→', + Sscr: '𝒮', + sscr: '𝓈', + ssetmn: '∖', + ssmile: '⌣', + sstarf: '⋆', + Star: '⋆', + star: '☆', + starf: '★', + straightepsilon: 'ϵ', + straightphi: 'ϕ', + strns: '¯', + sub: '⊂', + Sub: '⋐', + subdot: '⪽', + subE: '⫅', + sube: '⊆', + subedot: '⫃', + submult: '⫁', + subnE: '⫋', + subne: '⊊', + subplus: '⪿', + subrarr: '⥹', + subset: '⊂', + Subset: '⋐', + subseteq: '⊆', + subseteqq: '⫅', + SubsetEqual: '⊆', + subsetneq: '⊊', + subsetneqq: '⫋', + subsim: '⫇', + subsub: '⫕', + subsup: '⫓', + succapprox: '⪸', + succ: '≻', + succcurlyeq: '≽', + Succeeds: '≻', + SucceedsEqual: '⪰', + SucceedsSlantEqual: '≽', + SucceedsTilde: '≿', + succeq: '⪰', + succnapprox: '⪺', + succneqq: '⪶', + succnsim: '⋩', + succsim: '≿', + SuchThat: '∋', + sum: '∑', + Sum: '∑', + sung: '♪', + sup1: '¹', + sup2: '²', + sup3: '³', + sup: '⊃', + Sup: '⋑', + supdot: '⪾', + supdsub: '⫘', + supE: '⫆', + supe: '⊇', + supedot: '⫄', + Superset: '⊃', + SupersetEqual: '⊇', + suphsol: '⟉', + suphsub: '⫗', + suplarr: '⥻', + supmult: '⫂', + supnE: '⫌', + supne: '⊋', + supplus: '⫀', + supset: '⊃', + Supset: '⋑', + supseteq: '⊇', + supseteqq: '⫆', + supsetneq: '⊋', + supsetneqq: '⫌', + supsim: '⫈', + supsub: '⫔', + supsup: '⫖', + swarhk: '⤦', + swarr: '↙', + swArr: '⇙', + swarrow: '↙', + swnwar: '⤪', + szlig: 'ß', + Tab: '\t', + target: '⌖', + Tau: 'Τ', + tau: 'τ', + tbrk: '⎴', + Tcaron: 'Ť', + tcaron: 'ť', + Tcedil: 'Ţ', + tcedil: 'ţ', + Tcy: 'Т', + tcy: 'т', + tdot: '⃛', + telrec: '⌕', + Tfr: '𝔗', + tfr: '𝔱', + there4: '∴', + therefore: '∴', + Therefore: '∴', + Theta: 'Θ', + theta: 'θ', + thetasym: 'ϑ', + thetav: 'ϑ', + thickapprox: '≈', + thicksim: '∼', + ThickSpace: '  ', + ThinSpace: ' ', + thinsp: ' ', + thkap: '≈', + thksim: '∼', + THORN: 'Þ', + thorn: 'þ', + tilde: '˜', + Tilde: '∼', + TildeEqual: '≃', + TildeFullEqual: '≅', + TildeTilde: '≈', + timesbar: '⨱', + timesb: '⊠', + times: '×', + timesd: '⨰', + tint: '∭', + toea: '⤨', + topbot: '⌶', + topcir: '⫱', + top: '⊤', + Topf: '𝕋', + topf: '𝕥', + topfork: '⫚', + tosa: '⤩', + tprime: '‴', + trade: '™', + TRADE: '™', + triangle: '▵', + triangledown: '▿', + triangleleft: '◃', + trianglelefteq: '⊴', + triangleq: '≜', + triangleright: '▹', + trianglerighteq: '⊵', + tridot: '◬', + trie: '≜', + triminus: '⨺', + TripleDot: '⃛', + triplus: '⨹', + trisb: '⧍', + tritime: '⨻', + trpezium: '⏢', + Tscr: '𝒯', + tscr: '𝓉', + TScy: 'Ц', + tscy: 'ц', + TSHcy: 'Ћ', + tshcy: 'ћ', + Tstrok: 'Ŧ', + tstrok: 'ŧ', + twixt: '≬', + twoheadleftarrow: '↞', + twoheadrightarrow: '↠', + Uacute: 'Ú', + uacute: 'ú', + uarr: '↑', + Uarr: '↟', + uArr: '⇑', + Uarrocir: '⥉', + Ubrcy: 'Ў', + ubrcy: 'ў', + Ubreve: 'Ŭ', + ubreve: 'ŭ', + Ucirc: 'Û', + ucirc: 'û', + Ucy: 'У', + ucy: 'у', + udarr: '⇅', + Udblac: 'Ű', + udblac: 'ű', + udhar: '⥮', + ufisht: '⥾', + Ufr: '𝔘', + ufr: '𝔲', + Ugrave: 'Ù', + ugrave: 'ù', + uHar: '⥣', + uharl: '↿', + uharr: '↾', + uhblk: '▀', + ulcorn: '⌜', + ulcorner: '⌜', + ulcrop: '⌏', + ultri: '◸', + Umacr: 'Ū', + umacr: 'ū', + uml: '¨', + UnderBar: '_', + UnderBrace: '⏟', + UnderBracket: '⎵', + UnderParenthesis: '⏝', + Union: '⋃', + UnionPlus: '⊎', + Uogon: 'Ų', + uogon: 'ų', + Uopf: '𝕌', + uopf: '𝕦', + UpArrowBar: '⤒', + uparrow: '↑', + UpArrow: '↑', + Uparrow: '⇑', + UpArrowDownArrow: '⇅', + updownarrow: '↕', + UpDownArrow: '↕', + Updownarrow: '⇕', + UpEquilibrium: '⥮', + upharpoonleft: '↿', + upharpoonright: '↾', + uplus: '⊎', + UpperLeftArrow: '↖', + UpperRightArrow: '↗', + upsi: 'υ', + Upsi: 'ϒ', + upsih: 'ϒ', + Upsilon: 'Υ', + upsilon: 'υ', + UpTeeArrow: '↥', + UpTee: '⊥', + upuparrows: '⇈', + urcorn: '⌝', + urcorner: '⌝', + urcrop: '⌎', + Uring: 'Ů', + uring: 'ů', + urtri: '◹', + Uscr: '𝒰', + uscr: '𝓊', + utdot: '⋰', + Utilde: 'Ũ', + utilde: 'ũ', + utri: '▵', + utrif: '▴', + uuarr: '⇈', + Uuml: 'Ü', + uuml: 'ü', + uwangle: '⦧', + vangrt: '⦜', + varepsilon: 'ϵ', + varkappa: 'ϰ', + varnothing: '∅', + varphi: 'ϕ', + varpi: 'ϖ', + varpropto: '∝', + varr: '↕', + vArr: '⇕', + varrho: 'ϱ', + varsigma: 'ς', + varsubsetneq: '⊊︀', + varsubsetneqq: '⫋︀', + varsupsetneq: '⊋︀', + varsupsetneqq: '⫌︀', + vartheta: 'ϑ', + vartriangleleft: '⊲', + vartriangleright: '⊳', + vBar: '⫨', + Vbar: '⫫', + vBarv: '⫩', + Vcy: 'В', + vcy: 'в', + vdash: '⊢', + vDash: '⊨', + Vdash: '⊩', + VDash: '⊫', + Vdashl: '⫦', + veebar: '⊻', + vee: '∨', + Vee: '⋁', + veeeq: '≚', + vellip: '⋮', + verbar: '|', + Verbar: '‖', + vert: '|', + Vert: '‖', + VerticalBar: '∣', + VerticalLine: '|', + VerticalSeparator: '❘', + VerticalTilde: '≀', + VeryThinSpace: ' ', + Vfr: '𝔙', + vfr: '𝔳', + vltri: '⊲', + vnsub: '⊂⃒', + vnsup: '⊃⃒', + Vopf: '𝕍', + vopf: '𝕧', + vprop: '∝', + vrtri: '⊳', + Vscr: '𝒱', + vscr: '𝓋', + vsubnE: '⫋︀', + vsubne: '⊊︀', + vsupnE: '⫌︀', + vsupne: '⊋︀', + Vvdash: '⊪', + vzigzag: '⦚', + Wcirc: 'Ŵ', + wcirc: 'ŵ', + wedbar: '⩟', + wedge: '∧', + Wedge: '⋀', + wedgeq: '≙', + weierp: '℘', + Wfr: '𝔚', + wfr: '𝔴', + Wopf: '𝕎', + wopf: '𝕨', + wp: '℘', + wr: '≀', + wreath: '≀', + Wscr: '𝒲', + wscr: '𝓌', + xcap: '⋂', + xcirc: '◯', + xcup: '⋃', + xdtri: '▽', + Xfr: '𝔛', + xfr: '𝔵', + xharr: '⟷', + xhArr: '⟺', + Xi: 'Ξ', + xi: 'ξ', + xlarr: '⟵', + xlArr: '⟸', + xmap: '⟼', + xnis: '⋻', + xodot: '⨀', + Xopf: '𝕏', + xopf: '𝕩', + xoplus: '⨁', + xotime: '⨂', + xrarr: '⟶', + xrArr: '⟹', + Xscr: '𝒳', + xscr: '𝓍', + xsqcup: '⨆', + xuplus: '⨄', + xutri: '△', + xvee: '⋁', + xwedge: '⋀', + Yacute: 'Ý', + yacute: 'ý', + YAcy: 'Я', + yacy: 'я', + Ycirc: 'Ŷ', + ycirc: 'ŷ', + Ycy: 'Ы', + ycy: 'ы', + yen: '¥', + Yfr: '𝔜', + yfr: '𝔶', + YIcy: 'Ї', + yicy: 'ї', + Yopf: '𝕐', + yopf: '𝕪', + Yscr: '𝒴', + yscr: '𝓎', + YUcy: 'Ю', + yucy: 'ю', + yuml: 'ÿ', + Yuml: 'Ÿ', + Zacute: 'Ź', + zacute: 'ź', + Zcaron: 'Ž', + zcaron: 'ž', + Zcy: 'З', + zcy: 'з', + Zdot: 'Ż', + zdot: 'ż', + zeetrf: 'ℨ', + ZeroWidthSpace: '​', + Zeta: 'Ζ', + zeta: 'ζ', + zfr: '𝔷', + Zfr: 'ℨ', + ZHcy: 'Ж', + zhcy: 'ж', + zigrarr: '⇝', + zopf: '𝕫', + Zopf: 'ℤ', + Zscr: '𝒵', + zscr: '𝓏', + zwj: '‍', + zwnj: '‌', + }, + }) + ), + u = n(function (e, l) { + var t = + (p && p.__importDefault) || + function (e) { + return e && e.__esModule ? e : { default: e }; + }, + t = + (Object.defineProperty(l, '__esModule', { value: !0 }), + (l.getTrie = l.encodeHTMLTrieRe = l.getCodePoint = void 0), + t(W)); + function c(e) { + return 55296 == (64512 & e); + } + l.getCodePoint = + null != String.prototype.codePointAt + ? function (e, t) { + return e.codePointAt(t); + } + : function (e, t) { + return c(e.charCodeAt(t)) + ? 1024 * (e.charCodeAt(t) - 55296) + + e.charCodeAt(t + 1) - + 56320 + + 65536 + : e.charCodeAt(t); + }; + var u = r(t.default); + function r(e) { + for ( + var t = new Map(), r = 0, n = Object.keys(e); + r < n.length; + r++ + ) { + for ( + var o = n[r], i = e[o], a = t, s = 0; + s < i.length - 1; + s++ + ) { + var l = i.charCodeAt(s), + c = null != (c = a.get(l)) ? c : {}; + a.set(l, c), + (a = + null != (l = c.next) + ? l + : (c.next = new Map())); + } + var u = + null != (u = a.get(i.charCodeAt(i.length - 1))) + ? u + : {}; + null != u.value || (u.value = '&' + o + ';'), + a.set(i.charCodeAt(i.length - 1), u); + } + return t; + } + (l.encodeHTMLTrieRe = function (e, t) { + for (var r = '', n = 0; null !== (o = e.exec(t)); ) { + var o = o.index, + i = t.charCodeAt(o), + a = u.get(i); + if (a) { + if (null != a.next && o + 1 < t.length) { + var s = + null == (s = a.next.get(t.charCodeAt(o + 1))) + ? void 0 + : s.value; + if (null != s) { + (r += t.substring(n, o) + s), + (e.lastIndex += 1), + (n = o + 2); + continue; + } + } + (r += t.substring(n, o) + a.value), (n = o + 1); + } else + (r += + t.substring(n, o) + + '&#x' + + l.getCodePoint(t, o).toString(16) + + ';'), + (n = e.lastIndex += Number(c(i))); + } + return r + t.substr(n); + }), + (l.getTrie = r); + }), + K = (r(u), u.getTrie, u.encodeHTMLTrieRe, u.getCodePoint, V(t)), + f = n(function (e, t) { + var r = + (p && p.__importDefault) || + function (e) { + return e && e.__esModule ? e : { default: e }; + }, + n = + (Object.defineProperty(t, '__esModule', { value: !0 }), + (t.escapeUTF8 = + t.escape = + t.encodeNonAsciiHTML = + t.encodeHTML = + t.encodeXML = + void 0), + r(K)), + o = c(r(W).default, !0), + a = c(n.default, !0), + i = c(n.default, !1), + s = new Map( + Object.keys(n.default).map(function (e) { + return [n.default[e].charCodeAt(0), '&' + e + ';']; + }) + ); + function l(e) { + for (var t = '', r = 0; null !== (n = a.exec(e)); ) + var n = n.index, + o = e.charCodeAt(n), + i = s.get(o), + r = i + ? ((t += e.substring(r, n) + i), n + 1) + : ((t += + e.substring(r, n) + + '&#x' + + u.getCodePoint(e, n).toString(16) + + ';'), + (a.lastIndex += Number(55296 == (65408 & o)))); + return t + e.substr(r); + } + function c(t, r) { + for ( + var e = Object.keys(t) + .map(function (e) { + return '\\' + t[e].charAt(0); + }) + .filter(function (e) { + return !r || e.charCodeAt(1) < 128; + }) + .sort(function (e, t) { + return e.charCodeAt(1) - t.charCodeAt(1); + }) + .filter(function (e, t, r) { + return e !== r[t + 1]; + }), + n = 0; + n < e.length - 1; + n++ + ) { + for ( + var o = n; + o < e.length - 1 && + e[o].charCodeAt(1) + 1 === e[o + 1].charCodeAt(1); + + ) + o += 1; + var i = 1 + o - n; + i < 3 || e.splice(n, i, e[n] + '-' + e[o]); + } + return new RegExp( + '[' + e.join('') + (r ? '\\x80-\\uFFFF' : '') + ']', + 'g' + ); + } + (t.encodeXML = l), + (t.encodeHTML = function (e) { + return u.encodeHTMLTrieRe(o, e); + }), + (t.encodeNonAsciiHTML = function (e) { + return u.encodeHTMLTrieRe(a, e); + }), + (t.escape = l), + (t.escapeUTF8 = function (e) { + for (var t, r = 0, n = ''; (t = i.exec(e)); ) + r !== t.index && (n += e.substring(r, t.index)), + (n += s.get(t[0].charCodeAt(0))), + (r = t.index + 1); + return n + e.substring(r); + }); + }), + t = + (r(f), + f.escapeUTF8, + f.escape, + f.encodeNonAsciiHTML, + f.encodeHTML, + f.encodeXML, + n(function (e, t) { + var r, n, o, i; + Object.defineProperty(t, '__esModule', { value: !0 }), + (t.decodeXMLStrict = + t.decodeHTML5Strict = + t.decodeHTML4Strict = + t.decodeHTML5 = + t.decodeHTML4 = + t.decodeHTMLStrict = + t.decodeHTML = + t.decodeXML = + t.encodeHTML5 = + t.encodeHTML4 = + t.escapeUTF8 = + t.escape = + t.encodeNonAsciiHTML = + t.encodeHTML = + t.encodeXML = + t.encode = + t.decodeStrict = + t.decode = + t.EncodingMode = + t.DecodingMode = + t.EntityLevel = + void 0), + ((i = r = t.EntityLevel || (t.EntityLevel = {}))[ + (i.XML = 0) + ] = 'XML'), + (i[(i.HTML = 1)] = 'HTML'), + ((i = n = t.DecodingMode || (t.DecodingMode = {}))[ + (i.Legacy = 0) + ] = 'Legacy'), + (i[(i.Strict = 1)] = 'Strict'), + ((i = o = t.EncodingMode || (t.EncodingMode = {}))[ + (i.UTF8 = 0) + ] = 'UTF8'), + (i[(i.ASCII = 1)] = 'ASCII'), + (i[(i.Extensive = 2)] = 'Extensive'), + (t.decode = function (e, t) { + return (t = + 'number' == typeof (t = void 0 === t ? r.XML : t) + ? { level: t } + : t).level === r.HTML + ? t.mode === n.Strict + ? c.decodeHTMLStrict(e) + : c.decodeHTML(e) + : c.decodeXML(e); + }), + (t.decodeStrict = function (e, t) { + return (t = + 'number' == typeof (t = void 0 === t ? r.XML : t) + ? { level: t } + : t).level === r.HTML + ? t.mode === n.Legacy + ? c.decodeHTML(e) + : c.decodeHTMLStrict(e) + : c.decodeXML(e); + }), + (t.encode = function (e, t) { + return (t = + 'number' == typeof (t = void 0 === t ? r.XML : t) + ? { level: t } + : t).mode === o.UTF8 + ? f.escapeUTF8(e) + : t.level === r.HTML + ? t.mode === o.ASCII + ? f.encodeNonAsciiHTML(e) + : f.encodeHTML(e) + : f.encodeXML(e); + }); + var a = f, + s = + (Object.defineProperty(t, 'encodeXML', { + enumerable: !0, + get: function () { + return a.encodeXML; + }, + }), + Object.defineProperty(t, 'encodeHTML', { + enumerable: !0, + get: function () { + return a.encodeHTML; + }, + }), + Object.defineProperty(t, 'encodeNonAsciiHTML', { + enumerable: !0, + get: function () { + return a.encodeNonAsciiHTML; + }, + }), + Object.defineProperty(t, 'escape', { + enumerable: !0, + get: function () { + return a.escape; + }, + }), + Object.defineProperty(t, 'escapeUTF8', { + enumerable: !0, + get: function () { + return a.escapeUTF8; + }, + }), + Object.defineProperty(t, 'encodeHTML4', { + enumerable: !0, + get: function () { + return a.encodeHTML; + }, + }), + Object.defineProperty(t, 'encodeHTML5', { + enumerable: !0, + get: function () { + return a.encodeHTML; + }, + }), + c); + Object.defineProperty(t, 'decodeXML', { + enumerable: !0, + get: function () { + return s.decodeXML; + }, + }), + Object.defineProperty(t, 'decodeHTML', { + enumerable: !0, + get: function () { + return s.decodeHTML; + }, + }), + Object.defineProperty(t, 'decodeHTMLStrict', { + enumerable: !0, + get: function () { + return s.decodeHTMLStrict; + }, + }), + Object.defineProperty(t, 'decodeHTML4', { + enumerable: !0, + get: function () { + return s.decodeHTML; + }, + }), + Object.defineProperty(t, 'decodeHTML5', { + enumerable: !0, + get: function () { + return s.decodeHTML; + }, + }), + Object.defineProperty(t, 'decodeHTML4Strict', { + enumerable: !0, + get: function () { + return s.decodeHTMLStrict; + }, + }), + Object.defineProperty(t, 'decodeHTML5Strict', { + enumerable: !0, + get: function () { + return s.decodeHTMLStrict; + }, + }), + Object.defineProperty(t, 'decodeXMLStrict', { + enumerable: !0, + get: function () { + return s.decodeXML; + }, + }); + })), + Q = + (r(t), + t.decodeXMLStrict, + t.decodeHTML5Strict, + t.decodeHTML4Strict, + t.decodeHTML5, + t.decodeHTML4, + t.decodeHTMLStrict), + e1 = + (t.decodeHTML, + t.decodeXML, + t.encodeHTML5, + t.encodeHTML4, + t.escapeUTF8, + t.escape, + t.encodeNonAsciiHTML, + t.encodeHTML, + t.encodeXML, + t.encode, + t.decodeStrict, + t.decode, + t.EncodingMode, + t.DecodingMode, + t.EntityLevel, + 92), + t = '&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});', + t1 = '[A-Za-z][A-Za-z0-9-]*', + r1 = + '<' + + t1 + + '(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"\'=<>`\\x00-\\x20]+|\'[^\']*\'|"[^"]*"))?)*\\s*/?>', + t1 = ']', + n1 = new RegExp( + '^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"\'=<>`\\x00-\\x20]+|\'[^\']*\'|"[^"]*"))?)*\\s*/?>|]|\x3c!--\x3e|\x3c!---\x3e|\x3c!--(?:[^-]|-[^-]|--[^>])*--\x3e|[<][?][\\s\\S]*?[?][>]|]*>|)' + ), + o1 = /[\\&]/, + i1 = '[!"#$%&\'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]', + a1 = new RegExp('\\\\' + i1 + '|' + t, 'gi'), + s1 = new RegExp('[&<>"]', 'g'), + l1 = function (e) { + switch (e) { + case '&': + return '&'; + case '<': + return '<'; + case '>': + return '>'; + case '"': + return '"'; + default: + return e; + } + }; + function c1(e) { + return Z(e); + } + Z = String.fromCodePoint + ? function (e) { + try { + return String.fromCodePoint(e); + } catch (e) { + if (e instanceof RangeError) + return String.fromCharCode(65533); + throw e; + } + } + : ((z = String.fromCharCode), + ($ = Math.floor), + function () { + var e = [], + t = -1, + r = arguments.length; + if (!r) return ''; + for (var n = ''; ++t < r; ) { + var o = Number(arguments[t]); + if (!isFinite(o) || o < 0 || 1114111 < o || $(o) !== o) + return String.fromCharCode(65533); + o <= 65535 + ? e.push(o) + : ((o -= 65536), + e.push(55296 + (o >> 10), (o % 1024) + 56320)), + (t + 1 === r || 16384 < e.length) && + ((n += z.apply(null, e)), (e.length = 0)); + } + return n; + }); + function u1() { + if ( + 'function' != typeof Symbol || + 'function' != typeof Object.getOwnPropertySymbols + ) + return !1; + if ('symbol' != typeof Symbol.iterator) { + var e = {}, + t = Symbol('test'), + r = Object(t); + if ('string' == typeof t) return !1; + if ('[object Symbol]' !== Object.prototype.toString.call(t)) + return !1; + if ('[object Symbol]' !== Object.prototype.toString.call(r)) + return !1; + for (t in ((e[t] = 42), e)) return !1; + if ('function' == typeof Object.keys && 0 !== Object.keys(e).length) + return !1; + if ( + 'function' == typeof Object.getOwnPropertyNames && + 0 !== Object.getOwnPropertyNames(e).length + ) + return !1; + r = Object.getOwnPropertySymbols(e); + if (1 !== r.length || r[0] !== t) return !1; + if (!Object.prototype.propertyIsEnumerable.call(e, t)) return !1; + if ('function' == typeof Object.getOwnPropertyDescriptor) { + r = Object.getOwnPropertyDescriptor(e, t); + if (42 !== r.value || !0 !== r.enumerable) return !1; + } + } + return !0; + } + function p1() { + return ( + 'function' == typeof g1 && + 'function' == typeof Symbol && + 'symbol' == typeof g1('foo') && + 'symbol' == typeof Symbol('bar') && + u1() + ); + } + function f1(e) { + try { + return m1('"use strict"; return (' + e + ').constructor;')(); + } catch (e) {} + } + var d1 = Array.prototype.slice, + h1 = Object.prototype.toString, + d = + Function.prototype.bind || + function (t) { + var r = this; + if ( + 'function' != typeof r || + '[object Function]' !== h1.call(r) + ) + throw new TypeError( + 'Function.prototype.bind called on incompatible ' + r + ); + for ( + var n, + e, + o = d1.call(arguments, 1), + i = Math.max(0, r.length - o.length), + a = [], + s = 0; + s < i; + s++ + ) + a.push('$' + s); + return ( + (n = Function( + 'binder', + 'return function (' + + a.join(',') + + '){ return binder.apply(this,arguments); }' + )(function () { + var e; + return this instanceof n + ? ((e = r.apply( + this, + o.concat(d1.call(arguments)) + )), + Object(e) === e ? e : this) + : r.apply(t, o.concat(d1.call(arguments))); + })), + r.prototype && + (((e = function () {}).prototype = r.prototype), + (n.prototype = new e()), + (e.prototype = null)), + n + ); + }, + g1 = 'undefined' != typeof Symbol && Symbol, + h = d.call(Function.call, Object.prototype.hasOwnProperty), + g = SyntaxError, + m1 = Function, + m = TypeError, + y = Object.getOwnPropertyDescriptor; + if (y) + try { + y({}, ''); + } catch (e) { + y = null; + } + function b1() { + throw new m(); + } + function v(e, t) { + if ('string' != typeof e || 0 === e.length) + throw new m('intrinsic name must be a non-empty string'); + if (1 < arguments.length && 'boolean' != typeof t) + throw new m('"allowMissing" argument must be a boolean'); + var r = (function (e) { + var t = O1(e, 0, 1), + r = O1(e, -1); + if ('%' === t && '%' !== r) + throw new g( + 'invalid intrinsic syntax, expected closing `%`' + ); + if ('%' === r && '%' !== t) + throw new g( + 'invalid intrinsic syntax, expected opening `%`' + ); + var o = []; + return ( + N1(e, P1, function (e, t, r, n) { + o[o.length] = r ? N1(n, R1, '$1') : t || e; + }), + o + ); + })(e), + n = 0 < r.length ? r[0] : '', + o = (function (e, t) { + var r, + n = e; + if ((h(T1, n) && (n = '%' + (r = T1[n])[0] + '%'), h(S, n))) { + var o = S[n]; + if (void 0 !== (o = o === x ? E1(n) : o) || t) + return { alias: r, name: n, value: o }; + throw new m( + 'intrinsic ' + + e + + ' exists, but is not available. Please file an issue!' + ); + } + throw new g('intrinsic ' + e + ' does not exist!'); + })('%' + n + '%', t), + i = (o.name, o.value), + a = !1; + (o = o.alias) && ((n = o[0]), D1(r, C1([0, 1], o))); + for (var s = 1, l = !0; s < r.length; s += 1) { + var c = r[s], + u = O1(c, 0, 1), + p = O1(c, -1); + if ( + ('"' === u || + "'" === u || + '`' === u || + '"' === p || + "'" === p || + '`' === p) && + u !== p + ) + throw new g( + 'property names with quotes must have matching quotes' + ); + if ( + (('constructor' !== c && l) || (a = !0), + h(S, (u = '%' + (n += '.' + c) + '%'))) + ) + i = S[u]; + else if (null != i) { + if (!(c in i)) { + if (t) return; + throw new m( + 'base intrinsic for ' + + e + + ' exists, but the property is not available.' + ); + } + (i = + y && s + 1 >= r.length + ? (l = !!(p = y(i, c))) && + 'get' in p && + !('originalValue' in p.get) + ? p.get + : i[c] + : ((l = h(i, c)), i[c])), + l && !a && (S[u] = i); + } + } + return i; + } + function y1(e) { + var t = U1.call(e); + return ( + '[object Arguments]' === t || + ('[object Array]' !== t && + null !== e && + 'object' == typeof e && + 'number' == typeof e.length && + 0 <= e.length && + '[object Function]' === U1.call(e.callee)) + ); + } + function v1() { + if (F1) + try { + return F1({}, 'a', { value: 1 }), !0; + } catch (e) {} + return !1; + } + function w1(e, t) { + var r = 2 < arguments.length ? arguments[2] : {}, + n = V1(t); + G1 && (n = $1.call(n, Object.getOwnPropertySymbols(t))); + for (var o, i, a, s, l = 0; l < n.length; l += 1) + (o = e), + (i = n[l]), + (a = t[n[l]]), + (s = r[n[l]]), + (i in o && (!J1(s) || !s())) || + (X1 + ? Z1(o, i, { + configurable: !0, + enumerable: !1, + value: a, + writable: !0, + }) + : (o[i] = a)); + } + function w(e) { + return null === e || ('function' != typeof e && 'object' != typeof e); + } + var q, + q1, + k1, + L1, + x1, + k, + L, + A1, + S1, + _1, + i, + t = y + ? (function () { + try { + return b1; + } catch (e) { + try { + return y(arguments, 'callee').get; + } catch (e) { + return b1; + } + } + })() + : b1, + a = p1(), + s = + Object.getPrototypeOf || + function (e) { + return e.__proto__; + }, + x = {}, + A = 'undefined' == typeof Uint8Array ? _ : s(Uint8Array), + S = { + '%AggregateError%': + 'undefined' == typeof AggregateError ? _ : AggregateError, + '%Array%': Array, + '%ArrayBuffer%': + 'undefined' == typeof ArrayBuffer ? _ : ArrayBuffer, + '%ArrayIteratorPrototype%': a ? s([][Symbol.iterator]()) : _, + '%AsyncFromSyncIteratorPrototype%': _, + '%AsyncFunction%': x, + '%AsyncGenerator%': x, + '%AsyncGeneratorFunction%': x, + '%AsyncIteratorPrototype%': x, + '%Atomics%': 'undefined' == typeof Atomics ? _ : Atomics, + '%BigInt%': 'undefined' == typeof BigInt ? _ : BigInt, + '%Boolean%': Boolean, + '%DataView%': 'undefined' == typeof DataView ? _ : DataView, + '%Date%': Date, + '%decodeURI%': decodeURI, + '%decodeURIComponent%': decodeURIComponent, + '%encodeURI%': encodeURI, + '%encodeURIComponent%': encodeURIComponent, + '%Error%': Error, + '%eval%': eval, + '%EvalError%': EvalError, + '%Float32Array%': + 'undefined' == typeof Float32Array ? _ : Float32Array, + '%Float64Array%': + 'undefined' == typeof Float64Array ? _ : Float64Array, + '%FinalizationRegistry%': + 'undefined' == typeof FinalizationRegistry + ? _ + : FinalizationRegistry, + '%Function%': m1, + '%GeneratorFunction%': x, + '%Int8Array%': 'undefined' == typeof Int8Array ? _ : Int8Array, + '%Int16Array%': 'undefined' == typeof Int16Array ? _ : Int16Array, + '%Int32Array%': 'undefined' == typeof Int32Array ? _ : Int32Array, + '%isFinite%': isFinite, + '%isNaN%': isNaN, + '%IteratorPrototype%': a ? s(s([][Symbol.iterator]())) : _, + '%JSON%': 'object' == typeof JSON ? JSON : _, + '%Map%': 'undefined' == typeof Map ? _ : Map, + '%MapIteratorPrototype%': + 'undefined' != typeof Map && a + ? s(new Map()[Symbol.iterator]()) + : _, + '%Math%': Math, + '%Number%': Number, + '%Object%': Object, + '%parseFloat%': parseFloat, + '%parseInt%': parseInt, + '%Promise%': 'undefined' == typeof Promise ? _ : Promise, + '%Proxy%': 'undefined' == typeof Proxy ? _ : Proxy, + '%RangeError%': RangeError, + '%ReferenceError%': ReferenceError, + '%Reflect%': 'undefined' == typeof Reflect ? _ : Reflect, + '%RegExp%': RegExp, + '%Set%': 'undefined' == typeof Set ? _ : Set, + '%SetIteratorPrototype%': + 'undefined' != typeof Set && a + ? s(new Set()[Symbol.iterator]()) + : _, + '%SharedArrayBuffer%': + 'undefined' == typeof SharedArrayBuffer ? _ : SharedArrayBuffer, + '%String%': String, + '%StringIteratorPrototype%': a ? s(''[Symbol.iterator]()) : _, + '%Symbol%': a ? Symbol : _, + '%SyntaxError%': g, + '%ThrowTypeError%': t, + '%TypedArray%': A, + '%TypeError%': m, + '%Uint8Array%': 'undefined' == typeof Uint8Array ? _ : Uint8Array, + '%Uint8ClampedArray%': + 'undefined' == typeof Uint8ClampedArray ? _ : Uint8ClampedArray, + '%Uint16Array%': + 'undefined' == typeof Uint16Array ? _ : Uint16Array, + '%Uint32Array%': + 'undefined' == typeof Uint32Array ? _ : Uint32Array, + '%URIError%': URIError, + '%WeakMap%': 'undefined' == typeof WeakMap ? _ : WeakMap, + '%WeakRef%': 'undefined' == typeof WeakRef ? _ : WeakRef, + '%WeakSet%': 'undefined' == typeof WeakSet ? _ : WeakSet, + }, + E1 = function e(t) { + var r, n; + return ( + '%AsyncFunction%' === t + ? (r = f1('async function () {}')) + : '%GeneratorFunction%' === t + ? (r = f1('function* () {}')) + : '%AsyncGeneratorFunction%' === t + ? (r = f1('async function* () {}')) + : '%AsyncGenerator%' === t + ? (n = e('%AsyncGeneratorFunction%')) && (r = n.prototype) + : '%AsyncIteratorPrototype%' === t && + (n = e('%AsyncGenerator%')) && + (r = s(n.prototype)), + (S[t] = r) + ); + }, + T1 = { + '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'], + '%ArrayPrototype%': ['Array', 'prototype'], + '%ArrayProto_entries%': ['Array', 'prototype', 'entries'], + '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'], + '%ArrayProto_keys%': ['Array', 'prototype', 'keys'], + '%ArrayProto_values%': ['Array', 'prototype', 'values'], + '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'], + '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'], + '%AsyncGeneratorPrototype%': [ + 'AsyncGeneratorFunction', + 'prototype', + 'prototype', + ], + '%BooleanPrototype%': ['Boolean', 'prototype'], + '%DataViewPrototype%': ['DataView', 'prototype'], + '%DatePrototype%': ['Date', 'prototype'], + '%ErrorPrototype%': ['Error', 'prototype'], + '%EvalErrorPrototype%': ['EvalError', 'prototype'], + '%Float32ArrayPrototype%': ['Float32Array', 'prototype'], + '%Float64ArrayPrototype%': ['Float64Array', 'prototype'], + '%FunctionPrototype%': ['Function', 'prototype'], + '%Generator%': ['GeneratorFunction', 'prototype'], + '%GeneratorPrototype%': [ + 'GeneratorFunction', + 'prototype', + 'prototype', + ], + '%Int8ArrayPrototype%': ['Int8Array', 'prototype'], + '%Int16ArrayPrototype%': ['Int16Array', 'prototype'], + '%Int32ArrayPrototype%': ['Int32Array', 'prototype'], + '%JSONParse%': ['JSON', 'parse'], + '%JSONStringify%': ['JSON', 'stringify'], + '%MapPrototype%': ['Map', 'prototype'], + '%NumberPrototype%': ['Number', 'prototype'], + '%ObjectPrototype%': ['Object', 'prototype'], + '%ObjProto_toString%': ['Object', 'prototype', 'toString'], + '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'], + '%PromisePrototype%': ['Promise', 'prototype'], + '%PromiseProto_then%': ['Promise', 'prototype', 'then'], + '%Promise_all%': ['Promise', 'all'], + '%Promise_reject%': ['Promise', 'reject'], + '%Promise_resolve%': ['Promise', 'resolve'], + '%RangeErrorPrototype%': ['RangeError', 'prototype'], + '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'], + '%RegExpPrototype%': ['RegExp', 'prototype'], + '%SetPrototype%': ['Set', 'prototype'], + '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'], + '%StringPrototype%': ['String', 'prototype'], + '%SymbolPrototype%': ['Symbol', 'prototype'], + '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'], + '%TypedArrayPrototype%': ['TypedArray', 'prototype'], + '%TypeErrorPrototype%': ['TypeError', 'prototype'], + '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'], + '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'], + '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'], + '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'], + '%URIErrorPrototype%': ['URIError', 'prototype'], + '%WeakMapPrototype%': ['WeakMap', 'prototype'], + '%WeakSetPrototype%': ['WeakSet', 'prototype'], + }, + C1 = d.call(Function.call, Array.prototype.concat), + D1 = d.call(Function.apply, Array.prototype.splice), + N1 = d.call(Function.call, String.prototype.replace), + O1 = d.call(Function.call, String.prototype.slice), + P1 = + /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, + R1 = /\\(\\)?/g, + j1 = n(function (e) { + var t = v('%Function.prototype.apply%'), + r = v('%Function.prototype.call%'), + n = v('%Reflect.apply%', !0) || d.call(r, t), + o = v('%Object.getOwnPropertyDescriptor%', !0), + i = v('%Object.defineProperty%', !0), + a = v('%Math.max%'); + if (i) + try { + i({}, 'a', { value: 1 }); + } catch (e) { + i = null; + } + e.exports = function (e) { + var t = n(d, r, arguments); + return ( + o && + i && + o(t, 'length').configurable && + i(t, 'length', { + value: 1 + a(0, e.length - (arguments.length - 1)), + }), + t + ); + }; + function s() { + return n(d, t, arguments); + } + i ? i(e.exports, 'apply', { value: s }) : (e.exports.apply = s); + }), + a = (j1.apply, j1), + U1 = Object.prototype.toString, + A = + (Object.keys || + ((q = Object.prototype.hasOwnProperty), + (q1 = Object.prototype.toString), + (k1 = y1), + (t = Object.prototype.propertyIsEnumerable), + (L1 = !t.call({ toString: null }, 'toString')), + (x1 = t.call(function () {}, 'prototype')), + (k = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor', + ]), + (L = function (e) { + var t = e.constructor; + return t && t.prototype === e; + }), + (A1 = { + $applicationCache: !0, + $console: !0, + $external: !0, + $frame: !0, + $frameElement: !0, + $frames: !0, + $innerHeight: !0, + $innerWidth: !0, + $onmozfullscreenchange: !0, + $onmozfullscreenerror: !0, + $outerHeight: !0, + $outerWidth: !0, + $pageXOffset: !0, + $pageYOffset: !0, + $parent: !0, + $scrollLeft: !0, + $scrollTop: !0, + $scrollX: !0, + $scrollY: !0, + $self: !0, + $webkitIndexedDB: !0, + $webkitStorageInfo: !0, + $window: !0, + }), + (S1 = (function () { + if ('undefined' != typeof window) + for (var e in window) + try { + if ( + !A1['$' + e] && + q.call(window, e) && + null !== window[e] && + 'object' == typeof window[e] + ) + try { + L(window[e]); + } catch (e) { + return !0; + } + } catch (e) { + return !0; + } + return !1; + })()), + (C = function (e) { + var t = null !== e && 'object' == typeof e, + r = '[object Function]' === q1.call(e), + n = k1(e), + o = t && '[object String]' === q1.call(e), + i = []; + if (!t && !r && !n) + throw new TypeError( + 'Object.keys called on a non-object' + ); + var a = x1 && r; + if (o && 0 < e.length && !q.call(e, 0)) + for (var s = 0; s < e.length; ++s) i.push(String(s)); + if (n && 0 < e.length) + for (var l = 0; l < e.length; ++l) i.push(String(l)); + else + for (var c in e) + (a && 'prototype' === c) || + !q.call(e, c) || + i.push(String(c)); + if (L1) + for ( + var u = (function (e) { + if ('undefined' == typeof window || !S1) + return L(e); + try { + return L(e); + } catch (e) { + return !1; + } + })(e), + p = 0; + p < k.length; + ++p + ) + (u && 'constructor' === k[p]) || + !q.call(e, k[p]) || + i.push(k[p]); + return i; + })), + C), + M1 = Array.prototype.slice, + B1 = Object.keys, + H1 = B1 + ? function (e) { + return B1(e); + } + : A, + I1 = Object.keys, + V1 = + ((H1.shim = function () { + return ( + Object.keys + ? (function () { + var e = Object.keys(arguments); + return e && e.length === arguments.length; + })(1, 2) || + (Object.keys = function (e) { + return y1(e) ? I1(M1.call(e)) : I1(e); + }) + : (Object.keys = H1), + Object.keys || H1 + ); + }), + H1), + F1 = v('%Object.defineProperty%', !0), + _ = + ((v1.hasArrayLengthDefineBug = function () { + if (!v1()) return null; + try { + return 1 !== F1([], 'length', { value: 1 }).length; + } catch (e) { + return !0; + } + }), + v1), + G1 = 'function' == typeof Symbol && 'symbol' == typeof Symbol('foo'), + z1 = Object.prototype.toString, + $1 = Array.prototype.concat, + Z1 = Object.defineProperty, + J1 = function (e) { + return 'function' == typeof e && '[object Function]' === z1.call(e); + }, + t = _(), + X1 = Z1 && t, + Y1 = ((w1.supportsDescriptors = !!X1), w1), + W1 = v('%TypeError%'), + K1 = function (e, t) { + if (null == e) throw new W1(t || 'Cannot call method on ' + e); + return e; + }, + Q1 = v('%String%'), + e9 = v('%TypeError%'), + t9 = function (e) { + if ('symbol' == typeof e) + throw new e9('Cannot convert a Symbol value to a string'); + return Q1(e); + }, + r9 = v('%Math.abs%'), + n9 = Math.floor, + o9 = Function.prototype.toString, + E = 'object' == typeof Reflect && null !== Reflect && Reflect.apply; + if ('function' == typeof E && 'function' == typeof Object.defineProperty) + try { + (_1 = Object.defineProperty({}, 'length', { + get: function () { + throw i; + }, + })), + (i = {}), + E( + function () { + throw 42; + }, + null, + _1 + ); + } catch (e) { + e !== i && (E = null); + } + else E = null; + function i9(e) { + try { + var t = o9.call(e); + return g9.test(t); + } catch (e) { + return; + } + } + function a9(e) { + var t, + e = + 'string' == typeof (e = k9((e = e), Number)) && + ((e = e.replace( + /^[ \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u0085]+|[ \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u0085]+$/g, + '' + )), + /^0[ob]|^[+-]0x/.test(e)) + ? NaN + : +e; + return L9(e) + ? 0 + : 0 !== e && A9(e) + ? (0 <= e ? 1 : -1) * ((t = r9(e)), n9(t)) + : e; + } + function s9(e, t) { + return 'function' == typeof (t = v(e, !!t)) && -1 < S9(e, '.prototype.') + ? j1(t) + : t; + } + function l9(t) { + return function (e) { + return null !== _9(t, e); + }; + } + function c9(e) { + if ('object' == typeof e && null !== e) { + if (!C9) return '[object Date]' === T9.call(e); + try { + return E9.call(e), 1; + } catch (e) { + return; + } + } + } + function u9(e) { + if (w(e)) return e; + var t = 'default'; + if ( + (1 < arguments.length && + (arguments[1] === String + ? (t = 'string') + : arguments[1] === Number && (t = 'number')), + N9 && + (Symbol.toPrimitive + ? (r = (function (e, t) { + var r = e[t]; + if (null != r) { + if (v9(r)) return r; + throw new TypeError( + r + + ' returned for property ' + + t + + ' of object ' + + e + + ' is not a function' + ); + } + })(e, Symbol.toPrimitive)) + : D9(e) && (r = Symbol.prototype.valueOf)), + void 0 !== r) + ) { + var r = r.call(e, t); + if (w(r)) return r; + throw new TypeError('unable to convert exotic object to primitive'); + } + 'default' === t && (c9(e) || D9(e)) && (t = 'string'); + var n = e, + r = 'default' === t ? 'number' : t; + if (null == n) throw new TypeError('Cannot call method on ' + n); + if ('string' != typeof r || ('number' !== r && 'string' !== r)) + throw new TypeError('hint must be "string" or "number"'); + for ( + var o, + i, + a = + 'string' === r + ? ['toString', 'valueOf'] + : ['valueOf', 'toString'], + s = 0; + s < a.length; + ++s + ) + if (((o = n[a[s]]), v9(o) && ((i = o.call(n)), w(i)))) return i; + throw new TypeError('No default value'); + } + function p9(e) { + var t = + null === (t = e) || ('function' != typeof t && 'object' != typeof t) + ? e + : (function (e) { + return 1 < arguments.length + ? u9(e, arguments[1]) + : u9(e); + })(e, P9); + if ('symbol' == typeof t) + throw new O9('Cannot convert a Symbol value to a number'); + if ('string' == typeof t) { + if (U9(t)) return p9(R9(j9(t, 2), 2)); + if (M9(t)) return p9(R9(j9(t, 2), 8)); + if (H9(t) || B9(t)) return NaN; + e = V9(t, I9, ''); + if (e !== t) return p9(e); + } + return P9(t); + } + function f9(e) { + var t = K1(this), + r = t9(t), + n = F9(e); + if (n < 0 || n == 1 / 0) + throw RangeError( + 'String.prototype.repeat argument must be greater than or equal to 0 and not be Infinity' + ); + for (var o = ''; n; ) + n % 2 == 1 && (o += r), 1 < n && (r += r), (n >>= 1); + return o; + } + function d9() { + return String.prototype.repeat || f9; + } + function T(e) { + var t = new b('text'); + return (t._literal = e), t; + } + function h9(e) { + return e + .slice(1, e.length - 1) + .trim() + .replace(/[ \t\r\n]+/g, ' ') + .toLowerCase() + .toUpperCase(); + } + var g9 = /^\s*class\b/, + m9 = Object.prototype.toString, + b9 = 'function' == typeof Symbol && !!Symbol.toStringTag, + y9 = + 'object' == typeof document && + void 0 === document.all && + void 0 !== document.all + ? document.all + : {}, + v9 = E + ? function (e) { + if (e === y9) return !0; + if (!e) return !1; + if ('function' != typeof e && 'object' != typeof e) + return !1; + if ('function' == typeof e && !e.prototype) return !0; + try { + E(e, null, _1); + } catch (e) { + if (e !== i) return !1; + } + return !i9(e); + } + : function (e) { + if (e === y9) return !0; + if (!e) return !1; + if ('function' != typeof e && 'object' != typeof e) + return !1; + if ('function' == typeof e && !e.prototype) return !0; + if (!b9) + return ( + !i9(e) && + ('[object Function]' === (t = m9.call(e)) || + '[object GeneratorFunction]' === t) + ); + var t = e; + try { + return i9(t) ? !1 : (o9.call(t), !0); + } catch (e) { + return !1; + } + }, + w9 = Object.prototype.toString, + q9 = function (e) { + var t = + 1 < arguments.length + ? arguments[1] + : '[object Date]' === w9.call(e) + ? String + : Number; + if (t !== String && t !== Number) + throw new TypeError('invalid [[DefaultValue]] hint supplied'); + for ( + var r, + n = + t === String + ? ['toString', 'valueOf'] + : ['valueOf', 'toString'], + o = 0; + o < n.length; + ++o + ) + if (v9(e[n[o]]) && ((r = e[n[o]]()), w(r))) return r; + throw new TypeError('No default value'); + }, + k9 = function (e) { + return w(e) + ? e + : 1 < arguments.length + ? q9(e, arguments[1]) + : q9(e); + }, + L9 = + Number.isNaN || + function (e) { + return e != e; + }, + x9 = + Number.isNaN || + function (e) { + return e != e; + }, + A9 = + Number.isFinite || + function (e) { + return ( + 'number' == typeof e && + !x9(e) && + e !== 1 / 0 && + e !== -1 / 0 + ); + }, + S9 = j1(v('String.prototype.indexOf')), + _9 = s9('RegExp.prototype.exec'), + E9 = Date.prototype.getDay, + T9 = Object.prototype.toString, + C9 = u1() && !!Symbol.toStringTag, + D9 = n(function (e) { + var r, + n, + o = Object.prototype.toString; + p1() + ? ((r = Symbol.prototype.toString), + (n = /^Symbol\(.*\)$/), + (e.exports = function (e) { + if ('symbol' == typeof e) return !0; + if ('[object Symbol]' !== o.call(e)) return !1; + try { + return ( + 'symbol' == typeof (t = e).valueOf() && + n.test(r.call(t)) + ); + } catch (e) { + return !1; + } + var t; + })) + : (e.exports = function (e) { + return !1; + }); + }), + N9 = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator, + O9 = v('%TypeError%'), + P9 = v('%Number%'), + C = v('%RegExp%'), + R9 = v('%parseInt%'), + j9 = s9('String.prototype.slice'), + U9 = l9(/^0b[01]+$/i), + M9 = l9(/^0o[0-7]+$/i), + B9 = l9(/^[-+]0x[0-9a-f]+$/i), + H9 = l9(new C('[' + ['…', '​', '￾'].join('') + ']', 'g')), + A = ['\t\n\v\f\r   ᠎    ', '          \u2028', '\u2029\ufeff'].join( + '' + ), + I9 = new RegExp('(^[' + A + ']+)|([' + A + ']+$)', 'g'), + V9 = s9('String.prototype.replace'), + F9 = function (e) { + e = p9(e); + return a9(e); + }, + _ = a(d9()), + G9 = + (Y1(_, { + getPolyfill: d9, + implementation: f9, + shim: function () { + var e = d9(); + return ( + String.prototype.repeat !== e && + Y1(String.prototype, { repeat: e }), + e + ); + }, + }), + function (t) { + try { + return I(t); + } catch (e) { + return t; + } + }), + z9 = G, + t = i1, + C = '\\\\' + t, + $9 = n1, + Z9 = new RegExp(/^[!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~\p{P}\p{S}]/u), + J9 = new RegExp( + '^(?:"(' + + C + + '|\\\\[^\\\\]|[^\\\\"\\x00])*"|\'(' + + C + + "|\\\\[^\\\\]|[^\\\\'\\x00])*'|\\((" + + C + + '|\\\\[^\\\\]|[^\\\\()\\x00])*\\))' + ), + X9 = /^(?:<(?:[^<>\n\\\x00]|\\.)*>)/, + Y9 = new RegExp('^' + t), + W9 = new RegExp( + '^&(?:#x[a-f0-9]{1,6}|#[0-9]{1,7}|[a-z][a-z0-9]{1,31});', + 'i' + ), + K9 = /`+/, + Q9 = /^`+/, + e8 = /\.\.\./g, + t8 = /--+/g, + r8 = + /^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/, + n8 = /^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i, + o8 = /^ *(?:\n *)?/, + i8 = /^[ \t\n\x0b\x0c\x0d]/, + a8 = /^\s/, + s8 = / *$/, + l8 = /^ */, + c8 = /^ *(?:\n|$)/, + u8 = /^\[(?:[^\\\[\]]|\\.){0,1000}\]/s, + p8 = /^[^\n`\[\]\\!<&*_'"]+/m, + f8 = function (e) { + e = e.exec(this.subject.slice(this.pos)); + return null === e + ? null + : ((this.pos += e.index + e[0].length), e[0]); + }, + d8 = function () { + return this.pos < this.subject.length + ? this.subject.charCodeAt(this.pos) + : -1; + }, + h8 = function () { + return this.match(o8), !0; + }, + g8 = function (e) { + var t = this.match(Q9); + if (null === t) return !1; + for (var r, n, o = this.pos; null !== (r = this.match(K9)); ) + if (r === t) + return ( + (r = new b('code')), + 0 < + (n = this.subject + .slice(o, this.pos - t.length) + .replace(/\n/gm, ' ')).length && + null !== n.match(/[^ ]/) && + ' ' == n[0] && + ' ' == n[n.length - 1] + ? (r._literal = n.slice(1, n.length - 1)) + : (r._literal = n), + e.appendChild(r), + !0 + ); + return (this.pos = o), e.appendChild(T(t)), !0; + }, + m8 = function (e) { + var t, + r = this.subject; + return ( + (this.pos += 1), + 10 === this.peek() + ? ((this.pos += 1), + (t = new b('linebreak')), + e.appendChild(t)) + : Y9.test(r.charAt(this.pos)) + ? (e.appendChild(T(r.charAt(this.pos))), (this.pos += 1)) + : e.appendChild(T('\\')), + !0 + ); + }, + b8 = function (e) { + var t, r, n; + return (t = this.match(r8)) + ? ((r = t.slice(1, t.length - 1)), + ((n = new b('link'))._destination = G9('mailto:' + r)), + (n._title = ''), + n.appendChild(T(r)), + e.appendChild(n), + !0) + : !!(t = this.match(n8)) && + ((r = t.slice(1, t.length - 1)), + ((n = new b('link'))._destination = G9(r)), + (n._title = ''), + n.appendChild(T(r)), + e.appendChild(n), + !0); + }, + y8 = function (e) { + var t, + r = this.match($9); + return ( + null !== r && + (((t = new b('html_inline'))._literal = r), + e.appendChild(t), + !0) + ); + }, + v8 = function (e) { + var t, + r, + n, + o, + i, + a, + s = 0, + l = this.pos; + if (39 === e || 34 === e) s++, this.pos++; + else for (; this.peek() === e; ) s++, this.pos++; + return 0 === s + ? null + : ((a = 0 === l ? '\n' : this.subject.charAt(l - 1)), + (o = -1 === (o = this.peek()) ? '\n' : c1(o)), + (n = a8.test(o)), + (o = Z9.test(o)), + (i = a8.test(a)), + (a = Z9.test(a)), + (t = !n && (!o || i || a)), + (i = !i && (!a || n || o)), + (n = + 95 === e + ? ((r = t && (!i || a)), i && (!t || o)) + : ((r = 39 === e || 34 === e ? t && !i : t), i)), + (this.pos = l), + { numdelims: s, can_open: r, can_close: n }); + }, + w8 = function (e, t) { + var r, + n, + o = this.scanDelims(e); + return ( + !!o && + ((r = o.numdelims), + (n = this.pos), + (this.pos += r), + (n = + 39 === e + ? '’' + : 34 === e + ? '“' + : this.subject.slice(n, this.pos)), + (n = T(n)), + t.appendChild(n), + (o.can_open || o.can_close) && + (this.options.smart || (39 !== e && 34 !== e)) && + ((this.delimiters = { + cc: e, + numdelims: r, + origdelims: r, + node: n, + previous: this.delimiters, + next: null, + can_open: o.can_open, + can_close: o.can_close, + }), + null !== this.delimiters.previous && + (this.delimiters.previous.next = this.delimiters)), + !0) + ); + }, + q8 = function (e) { + null !== e.previous && (e.previous.next = e.next), + null === e.next + ? (this.delimiters = e.previous) + : (e.next.previous = e.previous); + }, + k8 = function (e) { + for ( + var t, r, n, o, i, a, s, l, c, u, p, f = [], d = 0; + d < 14; + d++ + ) + f[d] = e; + for (r = this.delimiters; null !== r && r.previous !== e; ) + r = r.previous; + for (; null !== r; ) { + var h = r.cc; + if (r.can_close) { + switch (((t = r.previous), (s = !1), h)) { + case 39: + l = 0; + break; + case 34: + l = 1; + break; + case 95: + l = 2 + (r.can_open ? 3 : 0) + (r.origdelims % 3); + break; + case 42: + l = 8 + (r.can_open ? 3 : 0) + (r.origdelims % 3); + } + for (; null !== t && t !== e && t !== f[l]; ) { + if ( + ((c = + (r.can_open || t.can_close) && + r.origdelims % 3 != 0 && + (t.origdelims + r.origdelims) % 3 == 0), + t.cc === r.cc && t.can_open && !c) + ) { + s = !0; + break; + } + t = t.previous; + } + if (((n = r), 42 === h || 95 === h)) + if (s) { + (p = 2 <= r.numdelims && 2 <= t.numdelims ? 2 : 1), + (o = t.node), + (i = r.node), + (t.numdelims -= p), + (r.numdelims -= p), + (o._literal = o._literal.slice( + 0, + o._literal.length - p + )), + (i._literal = i._literal.slice( + 0, + i._literal.length - p + )); + for ( + var g = new b(1 == p ? 'emph' : 'strong'), + m = o._next; + m && m !== i; + + ) + (a = m._next), + m.unlink(), + g.appendChild(m), + (m = a); + o.insertAfter(g), + (p = r), + (u = t).next !== p && + ((u.next = p).previous = u), + 0 === t.numdelims && + (o.unlink(), this.removeDelimiter(t)), + 0 === r.numdelims && + (i.unlink(), + (p = r.next), + this.removeDelimiter(r), + (r = p)); + } else r = r.next; + else + 39 === h + ? ((r.node._literal = '’'), + s && (t.node._literal = '‘'), + (r = r.next)) + : 34 === h && + ((r.node._literal = '”'), + s && (t.node.literal = '“'), + (r = r.next)); + s || + ((f[l] = n.previous), + n.can_open || this.removeDelimiter(n)); + } else r = r.next; + } + for (; null !== this.delimiters && this.delimiters !== e; ) + this.removeDelimiter(this.delimiters); + }, + L8 = function () { + var e = this.match(J9); + return null === e ? null : z9(e.slice(1, -1)); + }, + x8 = function () { + var e = this.match(X9); + if (null !== e) return G9(z9(e.slice(1, -1))); + if (60 === this.peek()) return null; + for (var t, r = this.pos, n = 0; -1 !== (t = this.peek()); ) + if (92 === t && Y9.test(this.subject.charAt(this.pos + 1))) + (this.pos += 1), -1 !== this.peek() && (this.pos += 1); + else if (40 === t) (this.pos += 1), (n += 1); + else if (41 === t) { + if (n < 1) break; + (this.pos += 1), --n; + } else { + if (null !== i8.exec(c1(t))) break; + this.pos += 1; + } + return (this.pos === r && 41 !== t) || 0 !== n + ? null + : ((e = this.subject.slice(r, this.pos)), G9(z9(e))); + }, + A8 = function () { + var e = this.match(u8); + return null === e || 1001 < e.length ? 0 : e.length; + }, + S8 = function (e) { + var t = this.pos, + r = ((this.pos += 1), T('[')); + return e.appendChild(r), this.addBracket(r, t, !1), !0; + }, + _8 = function (e) { + var t, + r = this.pos; + return ( + (this.pos += 1), + 91 === this.peek() + ? ((this.pos += 1), + (t = T('![')), + e.appendChild(t), + this.addBracket(t, r + 1, !0)) + : e.appendChild(T('!')), + !0 + ); + }, + E8 = function (e) { + var t, + r, + n, + o, + i, + a = !1; + if (((this.pos += 1), (t = this.pos), null === (i = this.brackets))) + e.appendChild(T(']')); + else if (i.active) { + var s, + l, + c = i.image, + u = this.pos; + if ( + (40 === this.peek() && + (this.pos++, + this.spnl() && + null !== (r = this.parseLinkDestination()) && + this.spnl() && + (i8.test(this.subject.charAt(this.pos - 1)) && + (n = this.parseLinkTitle()), + 1) && + this.spnl() && + 41 === this.peek() + ? ((this.pos += 1), (a = !0)) + : (this.pos = u)), + a || + ((l = this.pos), + 2 < (s = this.parseLinkLabel()) + ? (o = this.subject.slice(l, l + s)) + : i.bracketAfter || + (o = this.subject.slice(i.index, t)), + 0 === s && (this.pos = u), + o && + (l = this.refmap[h9(o)]) && + ((r = l.destination), (n = l.title), (a = !0))), + a) + ) { + var p, + f, + d = new b(c ? 'image' : 'link'); + for ( + d._destination = r, + d._title = n || '', + p = i.node._next; + p; + + ) + (f = p._next), p.unlink(), d.appendChild(p), (p = f); + if ( + (e.appendChild(d), + this.processEmphasis(i.previousDelimiter), + this.removeBracket(), + i.node.unlink(), + !c) + ) + for (i = this.brackets; null !== i; ) + i.image || (i.active = !1), (i = i.previous); + } else + this.removeBracket(), (this.pos = t), e.appendChild(T(']')); + } else e.appendChild(T(']')), this.removeBracket(); + return !0; + }, + T8 = function (e, t, r) { + null !== this.brackets && (this.brackets.bracketAfter = !0), + (this.brackets = { + node: e, + previous: this.brackets, + previousDelimiter: this.delimiters, + index: t, + image: r, + active: !0, + }); + }, + C8 = function () { + this.brackets = this.brackets.previous; + }, + D8 = function (e) { + var t; + return !!(t = this.match(W9)) && (e.appendChild(T(Q(t))), !0); + }, + N8 = function (e) { + var t; + return ( + !!(t = this.match(p8)) && + (this.options.smart + ? e.appendChild( + T( + t.replace(e8, '…').replace(t8, function (e) { + var t = 0, + r = 0; + return ( + e.length % 3 == 0 + ? (r = e.length / 3) + : e.length % 2 == 0 + ? (t = e.length / 2) + : (r = + e.length % 3 == 2 + ? ((t = 1), + (e.length - 2) / 3) + : ((t = 2), + (e.length - 4) / 3)), + '—'.repeat(r) + '–'.repeat(t) + ); + }) + ) + ) + : e.appendChild(T(t)), + !0) + ); + }, + O8 = function (e) { + this.pos += 1; + var t, + r = e._lastChild; + return ( + r && + 'text' === r.type && + ' ' === r._literal[r._literal.length - 1] + ? ((t = ' ' === r._literal[r._literal.length - 2]), + (r._literal = r._literal.replace(s8, '')), + e.appendChild(new b(t ? 'linebreak' : 'softbreak'))) + : e.appendChild(new b('softbreak')), + this.match(l8), + !0 + ); + }, + P8 = function (e, t) { + (this.subject = e), (this.pos = 0); + var r, + n, + o, + i, + a, + e = this.pos, + s = this.parseLinkLabel(); + return 0 === s + ? 0 + : ((s = this.subject.slice(0, s)), + 58 !== this.peek() || + (this.pos++, + this.spnl(), + null === (r = this.parseLinkDestination()) || + ((o = this.pos), + this.spnl(), + null === + (n = this.pos !== o ? this.parseLinkTitle() : n) && + ((n = ''), (this.pos = o)), + (i = !0), + !(i = + null === this.match(c8) + ? '' !== n && + ((n = ''), + (this.pos = o), + null !== this.match(c8)) + : i) || '' === (a = h9(s)))) + ? ((this.pos = e), 0) + : (t[a] || (t[a] = { destination: r, title: n }), + this.pos - e)); + }, + R8 = function (e) { + var t = !1, + r = this.peek(); + if (-1 === r) return !1; + switch (r) { + case 10: + t = this.parseNewline(e); + break; + case 92: + t = this.parseBackslash(e); + break; + case 96: + t = this.parseBackticks(e); + break; + case 42: + case 95: + t = this.handleDelim(r, e); + break; + case 39: + case 34: + t = this.options.smart && this.handleDelim(r, e); + break; + case 91: + t = this.parseOpenBracket(e); + break; + case 33: + t = this.parseBang(e); + break; + case 93: + t = this.parseCloseBracket(e); + break; + case 60: + t = this.parseAutolink(e) || this.parseHtmlTag(e); + break; + case 38: + t = this.parseEntity(e); + break; + default: + t = this.parseString(e); + } + return t || ((this.pos += 1), e.appendChild(T(c1(r)))), !0; + }, + j8 = function (e) { + for ( + this.subject = e._string_content.trim(), + this.pos = 0, + this.delimiters = null, + this.brackets = null; + this.parseInline(e); + + ); + (e._string_content = null), this.processEmphasis(null); + }; + function U8(e) { + return { + subject: '', + delimiters: null, + brackets: null, + pos: 0, + refmap: {}, + match: f8, + peek: d8, + spnl: h8, + parseBackticks: g8, + parseBackslash: m8, + parseAutolink: b8, + parseHtmlTag: y8, + scanDelims: v8, + handleDelim: w8, + parseLinkTitle: L8, + parseLinkDestination: x8, + parseLinkLabel: A8, + parseOpenBracket: S8, + parseBang: _8, + parseCloseBracket: E8, + addBracket: T8, + removeBracket: C8, + parseEntity: D8, + parseString: N8, + parseNewline: O8, + parseReference: P8, + parseInline: R8, + processEmphasis: k8, + removeDelimiter: q8, + options: e || {}, + parse: j8, + }; + } + function D(e) { + return 32 === e || 9 === e; + } + function N(e, t) { + return t < e.length ? e.charCodeAt(t) : -1; + } + function M8(e) { + return e.next && e.sourcepos[1][0] !== e.next.sourcepos[0][0] - 1; + } + function B8() { + var e; + this.partiallyConsumedTab && + ((this.offset += 1), + (e = 4 - (this.column % 4)), + (this.tip._string_content += ' '.repeat(e))), + (this.tip._string_content += + this.currentLine.slice(this.offset) + '\n'); + } + function H8(e, t) { + for (; !this.blocks[this.tip.type].canContain(e); ) + this.finalize(this.tip, this.lineNumber - 1); + return ( + ((t = new b(e, [ + [this.lineNumber, t + 1], + [0, 0], + ]))._string_content = ''), + this.tip.appendChild(t), + (this.tip = t) + ); + } + function I8() { + if (!this.allClosed) { + for (; this.oldtip !== this.lastMatchedContainer; ) { + var e = this.oldtip._parent; + this.finalize(this.oldtip, this.lineNumber - 1), + (this.oldtip = e); + } + this.allClosed = !0; + } + } + function V8(e, t) { + for (var r, n, o = t.walker(), i = []; (n = o.next()); ) + if (((r = n.node), n.entering && 'paragraph' === r.type)) { + for ( + var a, s = !1; + 91 === N(r._string_content, 0) && + (a = e.inlineParser.parseReference( + r._string_content, + e.refmap + )); + + ) { + const c = r._string_content.slice(0, a); + r._string_content = r._string_content.slice(a); + var s = !0, + l = c.split('\n'); + r.sourcepos[0][0] += l.length - 1; + } + s && ((n = r._string_content), !re.test(n)) && i.push(r); + } + for (r of i) r.unlink(); + } + function F8(e, t) { + for (var r, n, o, i = this.currentLine; 0 < e && (o = i[this.offset]); ) + '\t' === o + ? ((r = 4 - (this.column % 4)), + t + ? ((this.partiallyConsumedTab = e < r), + (this.column += n = e < r ? e : r), + (this.offset += this.partiallyConsumedTab ? 0 : 1), + (e -= n)) + : ((this.partiallyConsumedTab = !1), + (this.column += r), + (this.offset += 1), + --e)) + : ((this.partiallyConsumedTab = !1), + (this.offset += 1), + (this.column += 1), + --e); + } + function G8() { + (this.offset = this.nextNonspace), + (this.column = this.nextNonspaceColumn), + (this.partiallyConsumedTab = !1); + } + function z8() { + for ( + var e, t = this.currentLine, r = this.offset, n = this.column; + '' !== (e = t.charAt(r)); + + ) + if (' ' === e) r++, n++; + else { + if ('\t' !== e) break; + r++, (n += 4 - (n % 4)); + } + (this.blank = '\n' === e || '\r' === e || '' === e), + (this.nextNonspace = r), + (this.nextNonspaceColumn = n), + (this.indent = this.nextNonspaceColumn - this.column), + (this.indented = this.indent >= Y8); + } + function $8(e) { + var t, + r, + n = !0, + o = this.doc; + for ( + this.oldtip = this.tip, + this.offset = 0, + this.column = 0, + this.blank = !1, + this.partiallyConsumedTab = !1, + this.lineNumber += 1, + -1 !== e.indexOf('\0') && (e = e.replace(/\0/g, '�')), + this.currentLine = e; + (r = o._lastChild) && r._open; + + ) { + switch ( + ((o = r), + this.findNextNonspace(), + this.blocks[o.type].continue(this, o)) + ) { + case 0: + break; + case 1: + n = !1; + break; + case 2: + return; + default: + throw 'continue returned illegal value, must be 0, 1, or 2'; + } + if (!n) { + o = o._parent; + break; + } + } + this.allClosed = o === this.oldtip; + for ( + var i = + 'paragraph' !== (this.lastMatchedContainer = o).type && + ue[o.type].acceptsLines, + a = this.blockStarts, + s = a.length; + !i; + + ) { + if ( + (this.findNextNonspace(), + !this.indented && !te.test(e.slice(this.nextNonspace))) + ) { + this.advanceNextNonspace(); + break; + } + for (var l = 0; l < s; ) { + var c = a[l](this, o); + if (1 === c) { + o = this.tip; + break; + } + if (2 === c) { + (o = this.tip), (i = !0); + break; + } + l++; + } + if (l === s) { + this.advanceNextNonspace(); + break; + } + } + this.allClosed || this.blank || 'paragraph' !== this.tip.type + ? (this.closeUnmatchedBlocks(), + (t = o.type), + this.blocks[t].acceptsLines + ? (this.addLine(), + 'html_block' === t && + 1 <= o._htmlBlockType && + o._htmlBlockType <= 5 && + Q8[o._htmlBlockType].test( + this.currentLine.slice(this.offset) + ) && + ((this.lastLineLength = e.length), + this.finalize(o, this.lineNumber))) + : this.offset < e.length && + !this.blank && + ((o = this.addChild('paragraph', this.offset)), + this.advanceNextNonspace(), + this.addLine())) + : this.addLine(), + (this.lastLineLength = e.length); + } + function Z8(e, t) { + var r = e._parent; + (e._open = !1), + (e.sourcepos[1] = [t, this.lastLineLength]), + this.blocks[e.type].finalize(this, e), + (this.tip = r); + } + function J8(e) { + var t, + r, + n, + o = e.walker(); + for ( + this.inlineParser.refmap = this.refmap, + this.inlineParser.options = this.options; + (r = o.next()); + + ) + (n = (t = r.node).type), + r.entering || + ('paragraph' !== n && 'heading' !== n) || + this.inlineParser.parse(t); + } + function X8(e) { + (this.doc = new fe()), + (this.tip = this.doc), + (this.refmap = {}), + (this.lineNumber = 0), + (this.lastLineLength = 0), + (this.offset = 0), + (this.column = 0), + (this.lastMatchedContainer = this.doc), + (this.currentLine = ''), + this.options.time && console.time('preparing input'); + var t = e.split(ce), + r = t.length; + e.charCodeAt(e.length - 1) === W8 && --r, + this.options.time && console.timeEnd('preparing input'), + this.options.time && console.time('block parsing'); + for (var n = 0; n < r; n++) this.incorporateLine(t[n]); + for (; this.tip; ) this.finalize(this.tip, r); + return ( + this.options.time && console.timeEnd('block parsing'), + this.options.time && console.time('inline parsing'), + this.processInlines(this.doc), + this.options.time && console.timeEnd('inline parsing'), + this.doc + ); + } + var Y8 = 4, + W8 = 10, + K8 = [ + /./, + /^<(?:script|pre|textarea|style)(?:\s|>|$)/i, + /^/, + /\?>/, + />/, + /\]\]>/, + ], + ee = /^(?:\*[ \t]*){3,}$|^(?:_[ \t]*){3,}$|^(?:-[ \t]*){3,}$/, + te = /^[#`~*+_=<>0-9-]/, + re = /[^ \t\f\v\r\n]/, + ne = /^[*+-]/, + oe = /^(\d{1,9})([.)])/, + ie = /^#{1,6}(?:[ \t]+|$)/, + ae = /^`{3,}(?!.*`)|^~{3,}/, + se = /^(?:`{3,}|~{3,})(?=[ \t]*$)/, + le = /^(?:=+|-+)[ \t]*$/, + ce = /\r\n|\n|\r/, + ue = { + document: { + continue: function () { + return 0; + }, + finalize: function (e, t) { + V8(e, t); + }, + canContain: function (e) { + return 'item' !== e; + }, + acceptsLines: !1, + }, + list: { + continue: function () { + return 0; + }, + finalize: function (e, t) { + for (var r = t._firstChild; r; ) { + if (r._next && M8(r)) { + t._listData.tight = !1; + break; + } + for (var n = r._firstChild; n; ) { + if (n._next && M8(n)) { + t._listData.tight = !1; + break; + } + n = n._next; + } + r = r._next; + } + t.sourcepos[1] = t._lastChild.sourcepos[1]; + }, + canContain: function (e) { + return 'item' === e; + }, + acceptsLines: !1, + }, + block_quote: { + continue: function (e) { + var t = e.currentLine; + return e.indented || 62 !== N(t, e.nextNonspace) + ? 1 + : (e.advanceNextNonspace(), + e.advanceOffset(1, !1), + D(N(t, e.offset)) && e.advanceOffset(1, !0), + 0); + }, + finalize: function () {}, + canContain: function (e) { + return 'item' !== e; + }, + acceptsLines: !1, + }, + item: { + continue: function (e, t) { + if (e.blank) { + if (null == t._firstChild) return 1; + e.advanceNextNonspace(); + } else { + if ( + !( + e.indent >= + t._listData.markerOffset + t._listData.padding + ) + ) + return 1; + e.advanceOffset( + t._listData.markerOffset + t._listData.padding, + !0 + ); + } + return 0; + }, + finalize: function (e, t) { + t._lastChild + ? (t.sourcepos[1] = t._lastChild.sourcepos[1]) + : ((t.sourcepos[1][0] = t.sourcepos[0][0]), + (t.sourcepos[1][1] = + t._listData.markerOffset + + t._listData.padding)); + }, + canContain: function (e) { + return 'item' !== e; + }, + acceptsLines: !1, + }, + heading: { + continue: function () { + return 1; + }, + finalize: function () {}, + canContain: function () { + return !1; + }, + acceptsLines: !1, + }, + thematic_break: { + continue: function () { + return 1; + }, + finalize: function () {}, + canContain: function () { + return !1; + }, + acceptsLines: !1, + }, + code_block: { + continue: function (e, t) { + var r = e.currentLine, + n = e.indent; + if (t._isFenced) { + var o = + n <= 3 && + r.charAt(e.nextNonspace) === t._fenceChar && + r.slice(e.nextNonspace).match(se); + if (o && o[0].length >= t._fenceLength) + return ( + (e.lastLineLength = e.offset + n + o[0].length), + e.finalize(t, e.lineNumber), + 2 + ); + for ( + var i = t._fenceOffset; + 0 < i && D(N(r, e.offset)); + + ) + e.advanceOffset(1, !0), i--; + } else if (Y8 <= n) e.advanceOffset(Y8, !0); + else { + if (!e.blank) return 1; + e.advanceNextNonspace(); + } + return 0; + }, + finalize: function (e, t) { + if (t._isFenced) { + var r = t._string_content, + n = r.indexOf('\n'), + o = r.slice(0, n), + r = r.slice(n + 1); + (t.info = G(o.trim())), (t._literal = r); + } else { + for ( + var i = t._string_content.split('\n'); + /^[ \t]*$/.test(i[i.length - 1]); + + ) + i.pop(); + (t._literal = i.join('\n') + '\n'), + (t.sourcepos[1][0] = + t.sourcepos[0][0] + i.length - 1), + (t.sourcepos[1][1] = + t.sourcepos[0][1] + i[i.length - 1].length - 1); + } + t._string_content = null; + }, + canContain: function () { + return !1; + }, + acceptsLines: !0, + }, + html_block: { + continue: function (e, t) { + return !e.blank || + (6 !== t._htmlBlockType && 7 !== t._htmlBlockType) + ? 0 + : 1; + }, + finalize: function (e, t) { + (t._literal = t._string_content.replace(/\n$/, '')), + (t._string_content = null); + }, + canContain: function () { + return !1; + }, + acceptsLines: !0, + }, + paragraph: { + continue: function (e) { + return e.blank ? 1 : 0; + }, + finalize: function () {}, + canContain: function () { + return !1; + }, + acceptsLines: !0, + }, + }, + pe = [ + function (e) { + return e.indented || 62 !== N(e.currentLine, e.nextNonspace) + ? 0 + : (e.advanceNextNonspace(), + e.advanceOffset(1, !1), + D(N(e.currentLine, e.offset)) && e.advanceOffset(1, !0), + e.closeUnmatchedBlocks(), + e.addChild('block_quote', e.nextNonspace), + 1); + }, + function (e) { + var t, r; + return !e.indented && + (t = e.currentLine.slice(e.nextNonspace).match(ie)) + ? (e.advanceNextNonspace(), + e.advanceOffset(t[0].length, !1), + e.closeUnmatchedBlocks(), + ((r = e.addChild('heading', e.nextNonspace)).level = + t[0].trim().length), + (r._string_content = e.currentLine + .slice(e.offset) + .replace(/^[ \t]*#+[ \t]*$/, '') + .replace(/[ \t]+#+[ \t]*$/, '')), + e.advanceOffset(e.currentLine.length - e.offset), + 2) + : 0; + }, + function (e) { + var t, r, n; + return !e.indented && + (t = e.currentLine.slice(e.nextNonspace).match(ae)) + ? ((r = t[0].length), + e.closeUnmatchedBlocks(), + ((n = e.addChild( + 'code_block', + e.nextNonspace + ))._isFenced = !0), + (n._fenceLength = r), + (n._fenceChar = t[0][0]), + (n._fenceOffset = e.indent), + e.advanceNextNonspace(), + e.advanceOffset(r, !1), + 2) + : 0; + }, + function (e, t) { + if (!e.indented && 60 === N(e.currentLine, e.nextNonspace)) + for ( + var r = e.currentLine.slice(e.nextNonspace), n = 1; + n <= 7; + n++ + ) + if ( + K8[n].test(r) && + (n < 7 || + ('paragraph' !== t.type && + (e.allClosed || + e.blank || + 'paragraph' !== e.tip.type))) + ) + return ( + e.closeUnmatchedBlocks(), + (e.addChild( + 'html_block', + e.offset + )._htmlBlockType = n), + 2 + ); + return 0; + }, + function (e, t) { + var r, n, o; + if ( + e.indented || + 'paragraph' !== t.type || + !(r = e.currentLine.slice(e.nextNonspace).match(le)) + ) + return 0; + for ( + e.closeUnmatchedBlocks(); + 91 === N(t._string_content, 0) && + (n = e.inlineParser.parseReference( + t._string_content, + e.refmap + )); + + ) + t._string_content = t._string_content.slice(n); + return 0 < t._string_content.length + ? (((o = new b('heading', t.sourcepos)).level = + '=' === r[0][0] ? 1 : 2), + (o._string_content = t._string_content), + t.insertAfter(o), + t.unlink(), + (e.tip = o), + e.advanceOffset(e.currentLine.length - e.offset, !1), + 2) + : 0; + }, + function (e) { + return !e.indented && + ee.test(e.currentLine.slice(e.nextNonspace)) + ? (e.closeUnmatchedBlocks(), + e.addChild('thematic_break', e.nextNonspace), + e.advanceOffset(e.currentLine.length - e.offset, !1), + 2) + : 0; + }, + function (e, t) { + var r, n, o; + return (e.indented && 'list' !== t.type) || + !(r = (function (e, t) { + var r, + n, + o, + i = e.currentLine.slice(e.nextNonspace), + a = { + type: null, + tight: !0, + bulletChar: null, + start: null, + delimiter: null, + padding: null, + markerOffset: e.indent, + }; + if (4 <= e.indent) return null; + if ((r = i.match(ne))) + (a.type = 'bullet'), (a.bulletChar = r[0][0]); + else { + if ( + !(r = i.match(oe)) || + ('paragraph' === t.type && 1 != r[1]) + ) + return null; + (a.type = 'ordered'), + (a.start = parseInt(r[1])), + (a.delimiter = r[2]); + } + if ( + -1 !== + (n = N( + e.currentLine, + e.nextNonspace + r[0].length + )) && + 9 !== n && + 32 !== n + ) + return null; + if ( + 'paragraph' === t.type && + !e.currentLine + .slice(e.nextNonspace + r[0].length) + .match(re) + ) + return null; + for ( + e.advanceNextNonspace(), + e.advanceOffset(r[0].length, !0), + o = e.column, + i = e.offset; + e.advanceOffset(1, !0), + (n = N(e.currentLine, e.offset)), + e.column - o < 5 && D(n); + + ); + var t = -1 === N(e.currentLine, e.offset), + s = e.column - o; + return ( + 5 <= s || s < 1 || t + ? ((a.padding = r[0].length + 1), + (e.column = o), + (e.offset = i), + D(N(e.currentLine, e.offset)) && + e.advanceOffset(1, !0)) + : (a.padding = r[0].length + s), + a + ); + })(e, t)) + ? 0 + : (e.closeUnmatchedBlocks(), + ('list' === e.tip.type && + ((n = t._listData), + (o = r), + n.type === o.type && + n.delimiter === o.delimiter && + n.bulletChar === o.bulletChar)) || + ((t = e.addChild( + 'list', + e.nextNonspace + ))._listData = r), + ((t = e.addChild('item', e.nextNonspace))._listData = r), + 1); + }, + function (e) { + return e.indented && 'paragraph' !== e.tip.type && !e.blank + ? (e.advanceOffset(Y8, !0), + e.closeUnmatchedBlocks(), + e.addChild('code_block', e.offset), + 2) + : 0; + }, + ], + fe = function () { + return new b('document', [ + [1, 1], + [0, 0], + ]); + }; + function O() {} + (O.prototype.render = function (e) { + var t, + r, + n = e.walker(); + for (this.buffer = '', this.lastOut = '\n'; (t = n.next()); ) + this[(r = t.node.type)] && this[r](t.node, t.entering); + return this.buffer; + }), + (O.prototype.out = function (e) { + this.lit(e); + }), + (O.prototype.lit = function (e) { + (this.buffer += e), (this.lastOut = e); + }), + (O.prototype.cr = function () { + '\n' !== this.lastOut && this.lit('\n'); + }), + (O.prototype.esc = function (e) { + return e; + }); + function de(e) { + return he.test(e) && !ge.test(e); + } + var he = /^javascript:|vbscript:|file:|data:/i, + ge = /^data:image\/(?:png|gif|jpeg|webp)/i; + function P(e) { + ((e = e || {}).softbreak = e.softbreak || '\n'), + (this.esc = e.esc || o), + (this.disableTags = 0), + (this.lastOut = '\n'), + (this.options = e); + } + ((P.prototype = Object.create(O.prototype)).text = function (e) { + this.out(e.literal); + }), + (P.prototype.html_inline = function (e) { + this.options.safe + ? this.lit('\x3c!-- raw HTML omitted --\x3e') + : this.lit(e.literal); + }), + (P.prototype.html_block = function (e) { + this.cr(), + this.options.safe + ? this.lit('\x3c!-- raw HTML omitted --\x3e') + : this.lit(e.literal), + this.cr(); + }), + (P.prototype.softbreak = function () { + this.lit(this.options.softbreak); + }), + (P.prototype.linebreak = function () { + this.tag('br', [], !0), this.cr(); + }), + (P.prototype.link = function (e, t) { + var r = this.attrs(e); + t + ? ((this.options.safe && de(e.destination)) || + r.push(['href', this.esc(e.destination)]), + e.title && r.push(['title', this.esc(e.title)]), + this.tag('a', r)) + : this.tag('/a'); + }), + (P.prototype.image = function (e, t) { + t + ? (0 === this.disableTags && + (this.options.safe && de(e.destination) + ? this.lit('')
+							: this.lit(
+									'<img src='))); + }), + (P.prototype.emph = function (e, t) { + this.tag(t ? 'em' : '/em'); + }), + (P.prototype.strong = function (e, t) { + this.tag(t ? 'strong' : '/strong'); + }), + (P.prototype.paragraph = function (e, t) { + var r = e.parent.parent, + e = this.attrs(e); + (null !== r && 'list' === r.type && r.listTight) || + (t + ? (this.cr(), this.tag('p', e)) + : (this.tag('/p'), this.cr())); + }), + (P.prototype.heading = function (e, t) { + var r = 'h' + e.level, + e = this.attrs(e); + t ? (this.cr(), this.tag(r, e)) : (this.tag('/' + r), this.cr()); + }), + (P.prototype.code = function (e) { + this.tag('code'), this.out(e.literal), this.tag('/code'); + }), + (P.prototype.code_block = function (e) { + var t = e.info ? e.info.split(/\s+/) : [], + r = this.attrs(e); + 0 < t.length && + 0 < t[0].length && + ((t = this.esc(t[0])), + /^language-/.exec(t) || (t = 'language-' + t), + r.push(['class', t])), + this.cr(), + this.tag('pre'), + this.tag('code', r), + this.out(e.literal), + this.tag('/code'), + this.tag('/pre'), + this.cr(); + }), + (P.prototype.thematic_break = function (e) { + (e = this.attrs(e)), this.cr(), this.tag('hr', e, !0), this.cr(); + }), + (P.prototype.block_quote = function (e, t) { + (e = this.attrs(e)), + t + ? (this.cr(), this.tag('blockquote', e)) + : (this.cr(), this.tag('/blockquote')), + this.cr(); + }), + (P.prototype.list = function (e, t) { + var r = 'bullet' === e.listType ? 'ul' : 'ol', + n = this.attrs(e); + t + ? (null !== (t = e.listStart) && + 1 !== t && + n.push(['start', t.toString()]), + this.cr(), + this.tag(r, n)) + : (this.cr(), this.tag('/' + r)), + this.cr(); + }), + (P.prototype.item = function (e, t) { + (e = this.attrs(e)), + t ? this.tag('li', e) : (this.tag('/li'), this.cr()); + }), + (P.prototype.custom_inline = function (e, t) { + t && e.onEnter + ? this.lit(e.onEnter) + : !t && e.onExit && this.lit(e.onExit); + }), + (P.prototype.custom_block = function (e, t) { + this.cr(), + t && e.onEnter + ? this.lit(e.onEnter) + : !t && e.onExit && this.lit(e.onExit), + this.cr(); + }), + (P.prototype.esc = o), + (P.prototype.out = function (e) { + this.lit(this.esc(e)); + }), + (P.prototype.tag = function (e, t, r) { + if (!(0 < this.disableTags)) { + if (((this.buffer += '<' + e), t && 0 < t.length)) + for (var n, o = 0; void 0 !== (n = t[o]); ) + (this.buffer += ' ' + n[0] + '="' + n[1] + '"'), o++; + r && (this.buffer += ' /'), + (this.buffer += '>'), + (this.lastOut = '>'); + } + }), + (P.prototype.attrs = function (e) { + var t = []; + return ( + this.options.sourcepos && + (e = e.sourcepos) && + t.push([ + 'data-sourcepos', + String(e[0][0]) + + ':' + + String(e[0][1]) + + '-' + + String(e[1][0]) + + ':' + + String(e[1][1]), + ]), + t + ); + }); + var me = /\<[^>]*\>/; + function R(e) { + (e = e || {}), + (this.disableTags = 0), + (this.lastOut = '\n'), + (this.indentLevel = 0), + (this.indent = ' '), + (this.esc = e.esc || o), + (this.options = e); + } + ((R.prototype = Object.create(O.prototype)).render = function (e) { + this.buffer = ''; + var t, + r, + n, + o, + i, + a, + s, + l = e.walker(), + c = this.options; + for ( + c.time && console.time('rendering'), + this.buffer += '\n', + this.buffer += '\n'; + (s = l.next()); + + ) + if ( + ((a = s.entering), + (s = (n = s.node).type), + (o = n.isContainer), + (i = + 'thematic_break' === s || + 'linebreak' === s || + 'softbreak' === s), + (r = s.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase()), + a) + ) { + switch (((t = []), s)) { + case 'document': + t.push(['xmlns', 'http://commonmark.org/xml/1.0']); + break; + case 'list': + null !== n.listType && + t.push(['type', n.listType.toLowerCase()]), + null !== n.listStart && + t.push(['start', String(n.listStart)]), + null !== n.listTight && + t.push([ + 'tight', + n.listTight ? 'true' : 'false', + ]); + var u = n.listDelimiter; + null !== u && + t.push([ + 'delimiter', + '.' === u ? 'period' : 'paren', + ]); + break; + case 'code_block': + n.info && t.push(['info', n.info]); + break; + case 'heading': + t.push(['level', String(n.level)]); + break; + case 'link': + case 'image': + t.push(['destination', n.destination]), + t.push(['title', n.title]); + break; + case 'custom_inline': + case 'custom_block': + t.push(['on_enter', n.onEnter]), + t.push(['on_exit', n.onExit]); + } + !c.sourcepos || + ((a = n.sourcepos) && + t.push([ + 'sourcepos', + String(a[0][0]) + + ':' + + String(a[0][1]) + + '-' + + String(a[1][0]) + + ':' + + String(a[1][1]), + ])), + this.cr(), + this.out(this.tag(r, t, i)), + o + ? (this.indentLevel += 1) + : i || + ((s = n.literal) && this.out(this.esc(s)), + this.out(this.tag('/' + r))); + } else --this.indentLevel, this.cr(), this.out(this.tag('/' + r)); + return ( + c.time && console.timeEnd('rendering'), + (this.buffer += '\n'), + this.buffer + ); + }), + (R.prototype.out = function (e) { + 0 < this.disableTags + ? (this.buffer += e.replace(me, '')) + : (this.buffer += e), + (this.lastOut = e); + }), + (R.prototype.cr = function () { + if ('\n' !== this.lastOut) { + (this.buffer += '\n'), (this.lastOut = '\n'); + for (var e = this.indentLevel; 0 < e; e--) + this.buffer += this.indent; + } + }), + (R.prototype.tag = function (e, t, r) { + var n = '<' + e; + if (t && 0 < t.length) + for (var o, i = 0; void 0 !== (o = t[i]); ) + (n += ' ' + o[0] + '="' + this.esc(o[1]) + '"'), i++; + return r && (n += ' /'), (n += '>'); + }), + (R.prototype.esc = o), + (e.HtmlRenderer = P), + (e.Node = b), + (e.Parser = function (e) { + return { + doc: new fe(), + blocks: ue, + blockStarts: pe, + tip: this.doc, + oldtip: this.doc, + currentLine: '', + lineNumber: 0, + offset: 0, + column: 0, + nextNonspace: 0, + nextNonspaceColumn: 0, + indent: 0, + indented: !1, + blank: !1, + partiallyConsumedTab: !1, + allClosed: !0, + lastMatchedContainer: this.doc, + refmap: {}, + lastLineLength: 0, + inlineParser: new U8(e), + findNextNonspace: z8, + advanceOffset: F8, + advanceNextNonspace: G8, + addLine: B8, + addChild: H8, + incorporateLine: $8, + finalize: Z8, + processInlines: J8, + closeUnmatchedBlocks: I8, + parse: X8, + options: e || {}, + }; + }), + (e.Renderer = O), + (e.XmlRenderer = R), + Object.defineProperty(e, '__esModule', { value: !0 }); +}); diff --git a/packages/edit-visually-browser-extension/src/config.ts b/packages/edit-visually-browser-extension/src/config.ts new file mode 100644 index 00000000..16707e72 --- /dev/null +++ b/packages/edit-visually-browser-extension/src/config.ts @@ -0,0 +1 @@ +export const LOOPBACK_SW_URL = 'https://playground-editor-extension.pages.dev'; diff --git a/packages/edit-visually-browser-extension/src/content-script.js b/packages/edit-visually-browser-extension/src/content-script.js new file mode 100644 index 00000000..1e85ceb9 --- /dev/null +++ b/packages/edit-visually-browser-extension/src/content-script.js @@ -0,0 +1,331 @@ +// ../../php-wasm/web-service-worker/src/messaging.ts +function postMessageExpectReply(target, message, ...postMessageArgs) { + const requestId = getNextRequestId(); + target.postMessage( + { + ...message, + requestId, + }, + ...postMessageArgs + ); + return requestId; +} +function getNextRequestId() { + return ++lastRequestId; +} +function awaitReply( + messageTarget, + requestId, + timeout = DEFAULT_RESPONSE_TIMEOUT +) { + return new Promise((resolve, reject) => { + const responseHandler = (event) => { + if ( + event.data.type === 'response' && + event.data.requestId === requestId + ) { + messageTarget.removeEventListener('message', responseHandler); + clearTimeout(failOntimeout); + resolve(event.data.response); + } + }; + const failOntimeout = setTimeout(() => { + reject(new Error('Request timed out')); + messageTarget.removeEventListener('message', responseHandler); + }, timeout); + messageTarget.addEventListener('message', responseHandler); + }); +} +function responseTo(requestId, response) { + return { + type: 'response', + requestId, + response, + }; +} +var DEFAULT_RESPONSE_TIMEOUT = 25000; +var lastRequestId = 0; +// src/config.ts +var LOOPBACK_SW_URL = 'https://playground-editor-extension.pages.dev'; + +// src/content-script.ts +var enableEditInPlaygroundButton = function () { + let currentElement = undefined; + let activeEditor = undefined; + const button = createEditButton(); + document.body.appendChild(button); + document.body.addEventListener('focusin', (event) => { + showButtonIfNeeded(event.target); + }); + showButtonIfNeeded(document.activeElement); + document.body.addEventListener('focusout', () => { + hideButton(button); + }); + function showButtonIfNeeded(element) { + const domain = window.location.hostname; + if ( + !domain.endsWith('github.com') && + domain !== 'meta.trac.wordpress.org' + ) { + return; + } + if (element.tagName !== 'TEXTAREA' && !element.isContentEditable) { + return; + } + showButton(element); + } + let buttonInterval; + function showButton(element) { + currentElement = element; + buttonInterval = setInterval(() => { + const rect = element.getBoundingClientRect(); + button.style.display = 'block'; + button.style.top = `${ + window.scrollY + rect.bottom - button.offsetHeight + }px`; + button.style.left = `${window.scrollX + rect.left}px`; + }, 100); + } + function hideButton(button2) { + currentElement = undefined; + button2.style.display = 'none'; + clearInterval(buttonInterval); + } + function createEditButton() { + const button2 = document.createElement('button'); + button2.textContent = 'Edit in Playground'; + button2.className = 'edit-btn'; + button2.style.transition = 'top 0.15s ease-in, left 0.15s ease-in'; + button2.style.position = 'absolute'; + button2.style.display = 'none'; + button2.style.padding = '5px 10px'; + button2.style.backgroundColor = '#007bff'; + button2.style.color = 'white'; + button2.style.border = 'none'; + button2.style.cursor = 'pointer'; + button2.addEventListener('mousedown', async (event) => { + event.preventDefault(); + event.stopPropagation(); + if ( + activeEditor?.editor?.windowHandle && + !activeEditor.editor.windowHandle.closed + ) { + activeEditor.editor.windowHandle.focus(); + return; + } + if ( + !activeEditor || + !activeEditor.editor.windowHandle || + activeEditor.editor.windowHandle.closed || + activeEditor.element !== currentElement + ) { + activeEditor?.editor.windowHandle?.close(); + activeEditor = { + element: currentElement, + editor: await openPlaygroundEditorForEditable( + currentElement + ), + }; + } + }); + return button2; + } +}; +async function openPlaygroundEditorForEditable(element) { + const localEditor = wrapLocalEditable(element); + const initialValue = localEditor.getValue(); + playgroundEditor = await openPlaygroundEditor({ + format: 'markdown', + initialValue, + onClose(lastValue) { + if (lastValue !== null) { + lastRemoteValue = lastValue; + localEditor.setValue(lastValue); + } + cleanup.forEach((fn) => fn()); + }, + }); + let lastRemoteValue = initialValue; + const pollInterval = setInterval(() => { + playgroundEditor.getValue().then((value) => { + if (value !== lastRemoteValue) { + lastRemoteValue = value; + localEditor.setValue(value); + } + }); + }, 1000); + const cleanup = [ + bindEventListener(element, 'change', () => { + const value = localEditor.getValue(); + playgroundEditor.setValue(value); + lastRemoteValue = value; + }), + () => { + pollInterval && clearInterval(pollInterval); + }, + ]; + return playgroundEditor; +} +var bindEventListener = function (target, type, listener) { + target.addEventListener(type, listener); + return () => target.removeEventListener(type, listener); +}; +var wrapLocalEditable = function (element) { + if (element.tagName === 'TEXTAREA') { + return { + getValue() { + return element.value; + }, + setValue(value) { + element.value = value; + }, + }; + } else if (element.isContentEditable) { + return { + getValue() { + return element.innerHTML; + }, + setValue(value) { + element.innerHTML = value; + }, + }; + } + throw new Error( + 'Unsupported element type, only Textarea and contenteditable elements are accepted.' + ); +}; +async function openPlaygroundEditor({ format, initialValue, onClose }) { + const windowHandle = window.open( + `${LOOPBACK_SW_URL}/wp-admin/post-new.php?post_type=post`, + '_blank', + 'width=850,height=600' + ); + if (windowHandle === null) { + throw new Error('Failed to open the playground editor window'); + } + await new Promise((resolve, reject) => { + const unbindRejectionListener = onWindowClosed(windowHandle, () => { + unbindBootListener(); + unbindRejectionListener(); + reject(); + }); + const unbindBootListener = bindEventListener( + window, + 'message', + (event) => { + if ( + event.source === windowHandle && + event.data.command === 'getBootParameters' + ) { + unbindBootListener(); + unbindRejectionListener(); + windowHandle.postMessage( + responseTo(event.data.requestId, { + value: initialValue, + format, + }), + '*' + ); + resolve(null); + } + } + ); + }); + let lastRemoteValue = null; + const unbindCloseListener = bindEventListener( + window, + 'message', + (event) => { + if (event.source !== windowHandle) { + return; + } + switch (event.data.command) { + case 'updateBeforeClose': + lastRemoteValue = event.data.text; + break; + } + } + ); + onWindowClosed(windowHandle, () => { + unbindCloseListener(); + onClose && onClose(lastRemoteValue || initialValue); + }); + bindEventListener(window, 'beforeunload', () => { + windowHandle.close(); + }); + return { + windowHandle, + async getValue() { + const requestId = postMessageExpectReply( + windowHandle, + { + command: 'getEditorContent', + }, + '*' + ); + const response = await awaitReply(window, requestId); + return response.value; + }, + setValue(value) { + windowHandle.postMessage( + { + command: 'setEditorContent', + value, + type: 'relay', + }, + '*' + ); + }, + addAndFocusOnEmptyParagraph() { + windowHandle.postMessage( + { + command: 'addAndFocusOnEmptyParagraph', + type: 'relay', + }, + '*' + ); + }, + }; +} +var onWindowClosed = function (windowObject, callback) { + const timer = setInterval(checkWindowClosed, 500); + function unbind() { + clearInterval(timer); + } + function checkWindowClosed() { + if (!windowObject || windowObject.closed) { + unbind(); + callback(); + } + } + return unbind; +}; +async function appendToPlaygroundEditor(text) { + if (playgroundEditor && !playgroundEditor?.windowHandle?.closed) { + playgroundEditor.windowHandle.focus(); + const value = await playgroundEditor.getValue(); + await playgroundEditor.setValue(`${value}\n\n${text} `); + } else { + playgroundEditor = await openPlaygroundEditor({ + format: 'markdown', + initialValue: text, + onClose(lastValue) { + navigator.clipboard.writeText(lastValue || ''); + }, + }); + } + await playgroundEditor.addAndFocusOnEmptyParagraph(); +} +enableEditInPlaygroundButton(); +var playgroundEditor = null; +chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { + if (request?.command === 'actionClicked') { + const selectedText = window.getSelection()?.toString() || ''; + const quotedSelectedText = + selectedText + .split('\n') + .map((line) => `> ${line}`) + .join('\n') + '\n> \n\n'; + appendToPlaygroundEditor(quotedSelectedText); + } +}); diff --git a/packages/edit-visually-browser-extension/src/content-script.ts b/packages/edit-visually-browser-extension/src/content-script.ts new file mode 100644 index 00000000..acc7b7eb --- /dev/null +++ b/packages/edit-visually-browser-extension/src/content-script.ts @@ -0,0 +1,327 @@ +import { + awaitReply, + postMessageExpectReply, + responseTo, +} from '@php-wasm/web-service-worker'; +import { LOOPBACK_SW_URL } from './config'; + +function enableEditInPlaygroundButton() { + let currentElement: any = undefined; + let activeEditor: any = undefined; + const button = createEditButton(); + + document.body.appendChild(button); + document.body.addEventListener('focusin', (event: any) => { + showButtonIfNeeded(event.target!); + }); + showButtonIfNeeded(document.activeElement); + + document.body.addEventListener('focusout', () => { + hideButton(button); + }); + + function showButtonIfNeeded(element: any) { + const domain = window.location.hostname; + if ( + !domain.endsWith('github.com') && + domain !== 'meta.trac.wordpress.org' + ) { + return; + } + if (element!.tagName !== 'TEXTAREA' && !element!.isContentEditable) { + return; + } + showButton(element); + } + + let buttonInterval: any; + function showButton(element: any) { + currentElement = element; + buttonInterval = setInterval(() => { + const rect = element.getBoundingClientRect(); + button.style.display = 'block'; + button.style.top = `${ + window.scrollY + rect.bottom - button.offsetHeight + }px`; + button.style.left = `${window.scrollX + rect.left}px`; + }, 100); + } + + function hideButton(button: HTMLButtonElement) { + currentElement = undefined; + button.style.display = 'none'; + clearInterval(buttonInterval); + } + + function createEditButton() { + const button = document.createElement('button'); + button.textContent = 'Edit in Playground'; + button.className = 'edit-btn'; + button.style.transition = 'top 0.15s ease-in, left 0.15s ease-in'; + button.style.position = 'absolute'; + button.style.display = 'none'; + button.style.padding = '5px 10px'; + button.style.backgroundColor = '#007bff'; + button.style.color = 'white'; + button.style.border = 'none'; + button.style.cursor = 'pointer'; + button.addEventListener('mousedown', async (event) => { + event.preventDefault(); + event.stopPropagation(); + if ( + activeEditor?.editor?.windowHandle && + !activeEditor.editor.windowHandle.closed + ) { + activeEditor.editor.windowHandle.focus(); + return; + } + if ( + !activeEditor || + !activeEditor.editor.windowHandle || + activeEditor.editor.windowHandle.closed || + activeEditor.element !== currentElement + ) { + activeEditor?.editor.windowHandle?.close(); + activeEditor = { + element: currentElement, + editor: await openPlaygroundEditorForEditable( + currentElement + ), + }; + } + }); + return button; + } +} + +enableEditInPlaygroundButton(); + +let playgroundEditor: any = null; +// Function to wait until DOM is fully loaded +async function openPlaygroundEditorForEditable(element: any) { + const localEditor = wrapLocalEditable(element); + const initialValue = localEditor.getValue(); + playgroundEditor = await openPlaygroundEditor({ + format: 'markdown', + initialValue, + onClose(lastValue: string | null) { + if (lastValue !== null) { + lastRemoteValue = lastValue; + localEditor.setValue(lastValue); + } + cleanup.forEach((fn) => fn()); + }, + }); + + // Update the local editor when the playground editor changes + let lastRemoteValue = initialValue; + const pollInterval = setInterval(() => { + playgroundEditor.getValue().then((value) => { + if (value !== lastRemoteValue) { + lastRemoteValue = value; + localEditor.setValue(value); + } + }); + }, 1000); + + const cleanup = [ + // When typing in the textarea, update the playground editor + bindEventListener(element, 'change', () => { + const value = localEditor.getValue(); + playgroundEditor.setValue(value); + lastRemoteValue = value; + }), + () => { + pollInterval && clearInterval(pollInterval); + }, + ]; + + return playgroundEditor; +} + +function bindEventListener(target: any, type: string, listener: any) { + target.addEventListener(type, listener); + return () => target.removeEventListener(type, listener); +} + +function wrapLocalEditable(element: any) { + if (element.tagName === 'TEXTAREA') { + return { + getValue() { + return element.value; + }, + setValue(value: string) { + element.value = value; + }, + }; + } else if (element.isContentEditable) { + return { + getValue() { + return element.innerHTML; + }, + setValue(value: string) { + element.innerHTML = value; + }, + }; + } + throw new Error( + 'Unsupported element type, only Textarea and contenteditable elements are accepted.' + ); +} + +interface PlaygroundEditorOptions { + format: 'markdown' | 'trac'; + initialValue: string; + onClose?: (value: string | null) => void; +} + +async function openPlaygroundEditor({ + format, + initialValue, + onClose, +}: PlaygroundEditorOptions) { + const windowHandle = window.open( + `${LOOPBACK_SW_URL}/wp-admin/post-new.php?post_type=post`, + '_blank', + 'width=850,height=600' + )!; + + if (null === windowHandle) { + throw new Error('Failed to open the playground editor window'); + } + + await new Promise((resolve, reject) => { + const unbindRejectionListener = onWindowClosed(windowHandle, () => { + unbindBootListener(); + unbindRejectionListener(); + reject(); + }); + + const unbindBootListener = bindEventListener( + window, + 'message', + (event: MessageEvent) => { + if ( + event.source === windowHandle && + event.data.command === 'getBootParameters' + ) { + unbindBootListener(); + unbindRejectionListener(); + windowHandle.postMessage( + responseTo(event.data.requestId, { + value: initialValue, + format: format, + }), + '*' + ); + resolve(null); + } + } + ); + }); + + let lastRemoteValue: string | null = null; + const unbindCloseListener = bindEventListener( + window, + 'message', + (event: MessageEvent) => { + if (event.source !== windowHandle) { + return; + } + switch (event.data.command) { + case 'updateBeforeClose': + lastRemoteValue = event.data.text; + break; + } + } + ); + + onWindowClosed(windowHandle, () => { + unbindCloseListener(); + onClose && onClose(lastRemoteValue || initialValue); + }); + + // Close the editor popup if the user navigates away + bindEventListener(window, 'beforeunload', () => { + windowHandle.close(); + }); + + return { + windowHandle, + async getValue() { + const requestId = postMessageExpectReply( + windowHandle, + { + command: 'getEditorContent', + }, + '*' + ); + const response = await awaitReply(window, requestId); + return response.value; + }, + setValue(value: string) { + windowHandle.postMessage( + { + command: 'setEditorContent', + value, + type: 'relay', + }, + '*' + ); + }, + addAndFocusOnEmptyParagraph() { + windowHandle.postMessage( + { + command: 'addAndFocusOnEmptyParagraph', + type: 'relay', + }, + '*' + ); + }, + }; +} + +// Function to check if the window is closed +function onWindowClosed(windowObject: any, callback: any) { + // Set an interval to periodically check if the window is closed + const timer = setInterval(checkWindowClosed, 500); + function unbind() { + clearInterval(timer); + } + function checkWindowClosed() { + if (!windowObject || windowObject.closed) { + unbind(); + callback(); + } + } + return unbind; +} + +chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { + if (request?.command === 'actionClicked') { + const selectedText = window.getSelection()?.toString() || ''; + const quotedSelectedText = + selectedText + .split('\n') + .map((line) => `> ${line}`) + .join('\n') + '\n> \n\n'; + appendToPlaygroundEditor(quotedSelectedText); + } +}); + +async function appendToPlaygroundEditor(text: string) { + if (playgroundEditor && !playgroundEditor?.windowHandle?.closed) { + playgroundEditor.windowHandle.focus(); + const value = await playgroundEditor.getValue(); + await playgroundEditor.setValue(`${value}\n\n${text} `); + } else { + playgroundEditor = await openPlaygroundEditor({ + format: 'markdown', + initialValue: text, + onClose(lastValue: string | null) { + navigator.clipboard.writeText(lastValue || ''); + }, + }); + } + await playgroundEditor.addAndFocusOnEmptyParagraph(); +} diff --git a/packages/edit-visually-browser-extension/src/manifest.json b/packages/edit-visually-browser-extension/src/manifest.json new file mode 100644 index 00000000..d9893bc6 --- /dev/null +++ b/packages/edit-visually-browser-extension/src/manifest.json @@ -0,0 +1,34 @@ +{ + "manifest_version": 3, + "name": "Edit Visually powered by WordPress Playground – EARLY ACCESS", + "version": "0.1", + "description": "Edit GitHub and WordPress Trac comments using the block editor instead of plain textarea.", + "permissions": ["tabs", "activeTab", "scripting", "offscreen"], + "background": { + "service_worker": "sw.js" + }, + "host_permissions": [ + "https://playground-editor-extension.pages.dev/", + "https://playground.wordpress.net/", + "https://github.com/", + "https://meta.trac.wordpress.org/", + "" + ], + "content_security_policy": { + "extension_pages": "script-src 'self' 'wasm-unsafe-eval'; default-src 'self' https://playground-editor-extension.pages.dev/;" + }, + "action": { + "default_title": "Edit in Playground" + }, + "content_scripts": [ + { + "matches": [ + "https://github.com/*", + "https://*/*", + "https://meta.trac.wordpress.org/*" + ], + "js": ["content-script.js"], + "run_at": "document_idle" + } + ] +} diff --git a/packages/edit-visually-browser-extension/src/php_8_0.js b/packages/edit-visually-browser-extension/src/php_8_0.js new file mode 100644 index 00000000..39973661 --- /dev/null +++ b/packages/edit-visually-browser-extension/src/php_8_0.js @@ -0,0 +1,8022 @@ +const dependencyFilename = './php_8_0.wasm'; +export { dependencyFilename }; +export const dependenciesTotalSize = 12378163; +export function init(RuntimeName, PHPLoader) { + /** + * Overrides Emscripten's default ExitStatus object which gets + * thrown on failure. Unfortunately, the default object is not + * a subclass of Error and does not provide any stack trace. + * + * This is a deliberate behavior on Emscripten's end to prevent + * memory leaks after the program exits. See: + * + * https://github.com/emscripten-core/emscripten/pull/9108 + * + * In case of WordPress Playground, the worker in which the PHP + * runs will typically exit after the PHP program finishes, so + * we don't have to worry about memory leaks. + * + * As for assigning to a previously undeclared ExitStatus variable here, + * the Emscripten module declares `ExitStatus` as `function ExitStatus` + * which means it gets hoisted to the top of the scope and can be + * reassigned here – before the actual declaration is reached. + * + * If that sounds weird, try this example: + * + * ExitStatus = () => { console.log("reassigned"); } + * function ExitStatus() {} + * ExitStatus(); + * // logs "reassigned" + */ + ExitStatus = class PHPExitStatus extends Error { + constructor(status) { + super(status); + this.name = 'ExitStatus'; + this.message = 'Program terminated with exit(' + status + ')'; + this.status = status; + } + }; + + // The rest of the code comes from the built php.js file and esm-suffix.js + var Module = typeof PHPLoader != 'undefined' ? PHPLoader : {}; + var moduleOverrides = Object.assign({}, Module); + var arguments_ = []; + var thisProgram = './this.program'; + var quit_ = (status, toThrow) => { + throw toThrow; + }; + var ENVIRONMENT_IS_WEB = RuntimeName === 'WEB'; + var ENVIRONMENT_IS_WORKER = RuntimeName === 'WORKER'; + var ENVIRONMENT_IS_NODE = RuntimeName === 'NODE'; + var scriptDirectory = ''; + function locateFile(path) { + if (Module['locateFile']) { + return Module['locateFile'](path, scriptDirectory); + } + return scriptDirectory + path; + } + var read_, readAsync, readBinary, setWindowTitle; + if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != 'undefined' && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + if (scriptDirectory.indexOf('blob:') !== 0) { + scriptDirectory = scriptDirectory.substr( + 0, + scriptDirectory.replace(/[?#].*/, '').lastIndexOf('/') + 1 + ); + } else { + scriptDirectory = ''; + } + { + read_ = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.send(null); + return xhr.responseText; + }; + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.responseType = 'arraybuffer'; + xhr.send(null); + return new Uint8Array(xhr.response); + }; + } + readAsync = (url, onload, onerror) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'arraybuffer'; + xhr.onload = () => { + if ( + xhr.status == 200 || + (xhr.status == 0 && xhr.response) + ) { + onload(xhr.response); + return; + } + onerror(); + }; + xhr.onerror = onerror; + xhr.send(null); + }; + } + setWindowTitle = (title) => (document.title = title); + } else { + } + var out = Module['print'] || console.log.bind(console); + var err = Module['printErr'] || console.error.bind(console); + Object.assign(Module, moduleOverrides); + moduleOverrides = null; + if (Module['arguments']) arguments_ = Module['arguments']; + if (Module['thisProgram']) thisProgram = Module['thisProgram']; + if (Module['quit']) quit_ = Module['quit']; + var wasmBinary; + if (Module['wasmBinary']) wasmBinary = Module['wasmBinary']; + var noExitRuntime = Module['noExitRuntime'] || false; + if (typeof WebAssembly != 'object') { + abort('no native wasm support detected'); + } + var wasmMemory; + var ABORT = false; + var EXITSTATUS; + function assert(condition, text) { + if (!condition) { + abort(text); + } + } + var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; + function updateMemoryViews() { + var b = wasmMemory.buffer; + Module['HEAP8'] = HEAP8 = new Int8Array(b); + Module['HEAP16'] = HEAP16 = new Int16Array(b); + Module['HEAP32'] = HEAP32 = new Int32Array(b); + Module['HEAPU8'] = HEAPU8 = new Uint8Array(b); + Module['HEAPU16'] = HEAPU16 = new Uint16Array(b); + Module['HEAPU32'] = HEAPU32 = new Uint32Array(b); + Module['HEAPF32'] = HEAPF32 = new Float32Array(b); + Module['HEAPF64'] = HEAPF64 = new Float64Array(b); + } + var wasmTable; + var __ATPRERUN__ = []; + var __ATINIT__ = []; + var __ATEXIT__ = []; + var __ATPOSTRUN__ = []; + var runtimeInitialized = false; + var runtimeExited = false; + var runtimeKeepaliveCounter = 0; + function keepRuntimeAlive() { + return noExitRuntime || runtimeKeepaliveCounter > 0; + } + function preRun() { + if (Module['preRun']) { + if (typeof Module['preRun'] == 'function') + Module['preRun'] = [Module['preRun']]; + while (Module['preRun'].length) { + addOnPreRun(Module['preRun'].shift()); + } + } + callRuntimeCallbacks(__ATPRERUN__); + } + function initRuntime() { + runtimeInitialized = true; + SOCKFS.root = FS.mount(SOCKFS, {}, null); + if (!Module['noFSInit'] && !FS.init.initialized) FS.init(); + FS.ignorePermissions = false; + TTY.init(); + PIPEFS.root = FS.mount(PIPEFS, {}, null); + callRuntimeCallbacks(__ATINIT__); + } + function exitRuntime() { + ___funcs_on_exit(); + callRuntimeCallbacks(__ATEXIT__); + FS.quit(); + TTY.shutdown(); + runtimeExited = true; + } + function postRun() { + if (Module['postRun']) { + if (typeof Module['postRun'] == 'function') + Module['postRun'] = [Module['postRun']]; + while (Module['postRun'].length) { + addOnPostRun(Module['postRun'].shift()); + } + } + callRuntimeCallbacks(__ATPOSTRUN__); + } + function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); + } + function addOnInit(cb) { + __ATINIT__.unshift(cb); + } + function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); + } + var runDependencies = 0; + var runDependencyWatcher = null; + var dependenciesFulfilled = null; + function getUniqueRunDependency(id) { + return id; + } + function addRunDependency(id) { + runDependencies++; + if (Module['monitorRunDependencies']) { + Module['monitorRunDependencies'](runDependencies); + } + } + function removeRunDependency(id) { + runDependencies--; + if (Module['monitorRunDependencies']) { + Module['monitorRunDependencies'](runDependencies); + } + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } + } + function abort(what) { + if (Module['onAbort']) { + Module['onAbort'](what); + } + what = 'Aborted(' + what + ')'; + err(what); + ABORT = true; + EXITSTATUS = 1; + what += '. Build with -sASSERTIONS for more info.'; + var e = new WebAssembly.RuntimeError(what); + throw e; + } + var dataURIPrefix = 'data:application/octet-stream;base64,'; + function isDataURI(filename) { + return filename.startsWith(dataURIPrefix); + } + var wasmBinaryFile; + wasmBinaryFile = dependencyFilename; + if (!isDataURI(wasmBinaryFile)) { + wasmBinaryFile = locateFile(wasmBinaryFile); + } + function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw 'both async and sync fetching of the wasm failed'; + } + function getBinaryPromise(binaryFile) { + if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) { + if (typeof fetch == 'function') { + return fetch(binaryFile, { credentials: 'same-origin' }) + .then((response) => { + if (!response['ok']) { + throw ( + "failed to load wasm binary file at '" + + binaryFile + + "'" + ); + } + return response['arrayBuffer'](); + }) + .catch(() => getBinarySync(binaryFile)); + } + } + return Promise.resolve().then(() => getBinarySync(binaryFile)); + } + function instantiateArrayBuffer(binaryFile, imports, receiver) { + return getBinaryPromise(binaryFile) + .then((binary) => WebAssembly.instantiate(binary, imports)) + .then((instance) => instance) + .then(receiver, (reason) => { + err('failed to asynchronously prepare wasm: ' + reason); + abort(reason); + }); + } + function instantiateAsync(binary, binaryFile, imports, callback) { + if ( + !binary && + typeof WebAssembly.instantiateStreaming == 'function' && + !isDataURI(binaryFile) && + typeof fetch == 'function' + ) { + return fetch(binaryFile, { credentials: 'same-origin' }).then( + (response) => { + var result = WebAssembly.instantiateStreaming( + response, + imports + ); + return result.then(callback, function (reason) { + err('wasm streaming compile failed: ' + reason); + err('falling back to ArrayBuffer instantiation'); + return instantiateArrayBuffer( + binaryFile, + imports, + callback + ); + }); + } + ); + } + return instantiateArrayBuffer(binaryFile, imports, callback); + } + function createWasm() { + var info = { a: wasmImports }; + function receiveInstance(instance, module) { + var exports = instance.exports; + exports = Asyncify.instrumentWasmExports(exports); + Module['asm'] = exports; + wasmMemory = Module['asm']['_a']; + updateMemoryViews(); + wasmTable = Module['asm']['cb']; + addOnInit(Module['asm']['$a']); + removeRunDependency('wasm-instantiate'); + return exports; + } + addRunDependency('wasm-instantiate'); + function receiveInstantiationResult(result) { + receiveInstance(result['instance']); + } + if (Module['instantiateWasm']) { + try { + return Module['instantiateWasm'](info, receiveInstance); + } catch (e) { + err('Module.instantiateWasm callback failed with error: ' + e); + return false; + } + } + instantiateAsync( + wasmBinary, + wasmBinaryFile, + info, + receiveInstantiationResult + ); + return {}; + } + var tempDouble; + var tempI64; + function ExitStatus(status) { + this.name = 'ExitStatus'; + this.message = `Program terminated with exit(${status})`; + this.status = status; + } + var callRuntimeCallbacks = (callbacks) => { + while (callbacks.length > 0) { + callbacks.shift()(Module); + } + }; + function _SharpYuvConvert() { + err('missing function: SharpYuvConvert'); + abort(-1); + } + function _SharpYuvGetConversionMatrix() { + err('missing function: SharpYuvGetConversionMatrix'); + abort(-1); + } + function _SharpYuvInit() { + err('missing function: SharpYuvInit'); + abort(-1); + } + var UTF8Decoder = + typeof TextDecoder != 'undefined' ? new TextDecoder('utf8') : undefined; + var UTF8ArrayToString = (heapOrArray, idx, maxBytesToRead) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ''; + while (idx < endPtr) { + var u0 = heapOrArray[idx++]; + if (!(u0 & 128)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 224) == 192) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 240) == 224) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + u0 = + ((u0 & 7) << 18) | + (u1 << 12) | + (u2 << 6) | + (heapOrArray[idx++] & 63); + } + if (u0 < 65536) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 65536; + str += String.fromCharCode( + 55296 | (ch >> 10), + 56320 | (ch & 1023) + ); + } + } + return str; + }; + var UTF8ToString = (ptr, maxBytesToRead) => + ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ''; + Module['UTF8ToString'] = UTF8ToString; + var ___assert_fail = (condition, filename, line, func) => { + abort( + `Assertion failed: ${UTF8ToString(condition)}, at: ` + + [ + filename ? UTF8ToString(filename) : 'unknown filename', + line, + func ? UTF8ToString(func) : 'unknown function', + ] + ); + }; + var ___call_sighandler = (fp, sig) => + ((a1) => dynCall_vi.apply(null, [fp, a1]))(sig); + var initRandomFill = () => { + if ( + typeof crypto == 'object' && + typeof crypto['getRandomValues'] == 'function' + ) { + return (view) => crypto.getRandomValues(view); + } else abort('initRandomDevice'); + }; + var randomFill = (view) => (randomFill = initRandomFill())(view); + var PATH = { + isAbs: (path) => path.charAt(0) === '/', + splitPath: (filename) => { + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift('..'); + } + } + return parts; + }, + normalize: (path) => { + var isAbsolute = PATH.isAbs(path), + trailingSlash = path.substr(-1) === '/'; + path = PATH.normalizeArray( + path.split('/').filter((p) => !!p), + !isAbsolute + ).join('/'); + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + return (isAbsolute ? '/' : '') + path; + }, + dirname: (path) => { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + return '.'; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: (path) => { + if (path === '/') return '/'; + path = PATH.normalize(path); + path = path.replace(/\/$/, ''); + var lastSlash = path.lastIndexOf('/'); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + join: function () { + var paths = Array.prototype.slice.call(arguments); + return PATH.normalize(paths.join('/')); + }, + join2: (l, r) => PATH.normalize(l + '/' + r), + }; + var PATH_FS = { + resolve: function () { + var resolvedPath = '', + resolvedAbsolute = false; + for ( + var i = arguments.length - 1; + i >= -1 && !resolvedAbsolute; + i-- + ) { + var path = i >= 0 ? arguments[i] : FS.cwd(); + if (typeof path != 'string') { + throw new TypeError( + 'Arguments to path.resolve must be strings' + ); + } else if (!path) { + return ''; + } + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + resolvedPath = PATH.normalizeArray( + resolvedPath.split('/').filter((p) => !!p), + !resolvedAbsolute + ).join('/'); + return (resolvedAbsolute ? '/' : '') + resolvedPath || '.'; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join('/'); + }, + }; + var FS_stdin_getChar_buffer = []; + var lengthBytesUTF8 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var c = str.charCodeAt(i); + if (c <= 127) { + len++; + } else if (c <= 2047) { + len += 2; + } else if (c >= 55296 && c <= 57343) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; + }; + Module['lengthBytesUTF8'] = lengthBytesUTF8; + var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + if (!(maxBytesToWrite > 0)) return 0; + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 55296 && u <= 57343) { + var u1 = str.charCodeAt(++i); + u = (65536 + ((u & 1023) << 10)) | (u1 & 1023); + } + if (u <= 127) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 2047) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 192 | (u >> 6); + heap[outIdx++] = 128 | (u & 63); + } else if (u <= 65535) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 224 | (u >> 12); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + heap[outIdx++] = 240 | (u >> 18); + heap[outIdx++] = 128 | ((u >> 12) & 63); + heap[outIdx++] = 128 | ((u >> 6) & 63); + heap[outIdx++] = 128 | (u & 63); + } + } + heap[outIdx] = 0; + return outIdx - startIdx; + }; + function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array( + stringy, + u8array, + 0, + u8array.length + ); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; + } + var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if ( + typeof window != 'undefined' && + typeof window.prompt == 'function' + ) { + result = window.prompt('Input: '); + if (result !== null) { + result += '\n'; + } + } else if (typeof readline == 'function') { + result = readline(); + if (result !== null) { + result += '\n'; + } + } + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); + }; + var TTY = { + ttys: [], + init: function () {}, + shutdown: function () {}, + register: function (dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops: ops }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open: function (stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close: function (stream) { + stream.tty.ops.fsync(stream.tty); + }, + fsync: function (stream) { + stream.tty.ops.fsync(stream.tty); + }, + read: function (stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: function (stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }, + default_tty_ops: { + get_char: function (tty) { + return FS_stdin_getChar(); + }, + put_char: function (tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync: function (tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + }, + ioctl_tcgets: function (tty) { + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ + 3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, + 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + }; + }, + ioctl_tcsets: function (tty, optional_actions, data) { + return 0; + }, + ioctl_tiocgwinsz: function (tty) { + return [24, 80]; + }, + }, + default_tty1_ops: { + put_char: function (tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync: function (tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output, 0)); + tty.output = []; + } + }, + }, + }; + var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); + return address; + }; + var alignMemory = (size, alignment) => + Math.ceil(size / alignment) * alignment; + var mmapAlloc = (size) => { + size = alignMemory(size, 65536); + var ptr = _emscripten_builtin_memalign(65536, size); + if (!ptr) return 0; + return zeroMemory(ptr, size); + }; + var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, '/', 16384 | 511, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + if (!MEMFS.ops_table) { + MEMFS.ops_table = { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink, + }, + stream: { llseek: MEMFS.stream_ops.llseek }, + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync, + }, + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink, + }, + stream: {}, + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: FS.chrdev_stream_ops, + }, + }; + } + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) + return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max( + newCapacity, + (prevCapacity * + (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125)) >>> + 0 + ); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) + node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set( + oldContents.subarray( + 0, + Math.min(newSize, node.usedBytes) + ) + ); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw FS.genericErrors[44]; + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + old_node.parent = new_dir; + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir(node) { + var entries = ['.', '..']; + for (var key in node.contents) { + if (!node.contents.hasOwnProperty(key)) { + continue; + } + entries.push(key); + } + return entries; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + }, + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + if (size > 8 && contents.subarray) { + buffer.set( + contents.subarray(position, position + size), + offset + ); + } else { + for (var i = 0; i < size; i++) + buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + if ( + buffer.subarray && + (!node.contents || node.contents.subarray) + ) { + if (canOwn) { + node.contents = buffer.subarray( + offset, + offset + length + ); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set( + buffer.subarray(offset, offset + length), + position + ); + return length; + } + } + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set( + buffer.subarray(offset, offset + length), + position + ); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max( + stream.node.usedBytes, + offset + length + ); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + if (!(flags & 2) && contents.buffer === HEAP8.buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray( + position, + position + length + ); + } else { + contents = Array.prototype.slice.call( + contents, + position, + position + length + ); + } + } + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + HEAP8.set(contents, ptr); + } + return { ptr: ptr, allocated: allocated }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write( + stream, + buffer, + 0, + length, + offset, + false + ); + return 0; + }, + }, + }; + var asyncLoad = (url, onload, onerror, noRunDep) => { + var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : ''; + readAsync( + url, + (arrayBuffer) => { + assert( + arrayBuffer, + `Loading data file "${url}" failed (no arrayBuffer).` + ); + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, + (event) => { + if (onerror) { + onerror(); + } else { + throw `Loading data file "${url}" failed.`; + } + } + ); + if (dep) addRunDependency(dep); + }; + var preloadPlugins = Module['preloadPlugins'] || []; + function FS_handledByPreloadPlugin(byteArray, fullname, finish, onerror) { + if (typeof Browser != 'undefined') Browser.init(); + var handled = false; + preloadPlugins.forEach(function (plugin) { + if (handled) return; + if (plugin['canHandle'](fullname)) { + plugin['handle'](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; + } + function FS_createPreloadedFile( + parent, + name, + url, + canRead, + canWrite, + onload, + onerror, + dontCreateFile, + canOwn, + preFinish + ) { + var fullname = name + ? PATH_FS.resolve(PATH.join2(parent, name)) + : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + function processData(byteArray) { + function finish(byteArray) { + if (preFinish) preFinish(); + if (!dontCreateFile) { + FS.createDataFile( + parent, + name, + byteArray, + canRead, + canWrite, + canOwn + ); + } + if (onload) onload(); + removeRunDependency(dep); + } + if ( + FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + if (onerror) onerror(); + removeRunDependency(dep); + }) + ) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == 'string') { + asyncLoad(url, (byteArray) => processData(byteArray), onerror); + } else { + processData(url); + } + } + function FS_modeStringToFlags(str) { + var flagModes = { + r: 0, + 'r+': 2, + w: 512 | 64 | 1, + 'w+': 512 | 64 | 2, + a: 1024 | 64 | 1, + 'a+': 1024 | 64 | 2, + }; + var flags = flagModes[str]; + if (typeof flags == 'undefined') { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; + } + function FS_getMode(canRead, canWrite) { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + } + var ERRNO_CODES = {}; + var PROXYFS = { + mount(mount) { + return PROXYFS.createNode( + null, + '/', + mount.opts.fs.lstat(mount.opts.root).mode, + 0 + ); + }, + createNode(parent, name, mode, dev) { + if (!FS.isDir(mode) && !FS.isFile(mode) && !FS.isLink(mode)) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + var node = FS.createNode(parent, name, mode); + node.node_ops = PROXYFS.node_ops; + node.stream_ops = PROXYFS.stream_ops; + return node; + }, + realPath(node) { + var parts = []; + while (node.parent !== node) { + parts.push(node.name); + node = node.parent; + } + parts.push(node.mount.opts.root); + parts.reverse(); + return PATH.join.apply(null, parts); + }, + node_ops: { + getattr(node) { + var path = PROXYFS.realPath(node); + var stat; + try { + stat = node.mount.opts.fs.lstat(path); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + return { + dev: stat.dev, + ino: stat.ino, + mode: stat.mode, + nlink: stat.nlink, + uid: stat.uid, + gid: stat.gid, + rdev: stat.rdev, + size: stat.size, + atime: stat.atime, + mtime: stat.mtime, + ctime: stat.ctime, + blksize: stat.blksize, + blocks: stat.blocks, + }; + }, + setattr(node, attr) { + var path = PROXYFS.realPath(node); + try { + if (attr.mode !== undefined) { + node.mount.opts.fs.chmod(path, attr.mode); + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + var date = new Date(attr.timestamp); + node.mount.opts.fs.utime(path, date, date); + } + if (attr.size !== undefined) { + node.mount.opts.fs.truncate(path, attr.size); + } + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + }, + lookup(parent, name) { + try { + var path = PATH.join2(PROXYFS.realPath(parent), name); + var mode = parent.mount.opts.fs.lstat(path).mode; + var node = PROXYFS.createNode(parent, name, mode); + return node; + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + }, + mknod(parent, name, mode, dev) { + var node = PROXYFS.createNode(parent, name, mode, dev); + var path = PROXYFS.realPath(node); + try { + if (FS.isDir(node.mode)) { + node.mount.opts.fs.mkdir(path, node.mode); + } else { + node.mount.opts.fs.writeFile(path, '', { + mode: node.mode, + }); + } + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + return node; + }, + rename(oldNode, newDir, newName) { + var oldPath = PROXYFS.realPath(oldNode); + var newPath = PATH.join2(PROXYFS.realPath(newDir), newName); + try { + oldNode.mount.opts.fs.rename(oldPath, newPath); + oldNode.name = newName; + oldNode.parent = newDir; + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + }, + unlink(parent, name) { + var path = PATH.join2(PROXYFS.realPath(parent), name); + try { + parent.mount.opts.fs.unlink(path); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + }, + rmdir(parent, name) { + var path = PATH.join2(PROXYFS.realPath(parent), name); + try { + parent.mount.opts.fs.rmdir(path); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + }, + readdir(node) { + var path = PROXYFS.realPath(node); + try { + return node.mount.opts.fs.readdir(path); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + }, + symlink(parent, newName, oldPath) { + var newPath = PATH.join2(PROXYFS.realPath(parent), newName); + try { + parent.mount.opts.fs.symlink(oldPath, newPath); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + }, + readlink(node) { + var path = PROXYFS.realPath(node); + try { + return node.mount.opts.fs.readlink(path); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + }, + }, + stream_ops: { + open(stream) { + var path = PROXYFS.realPath(stream.node); + try { + stream.nfd = stream.node.mount.opts.fs.open( + path, + stream.flags + ); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + }, + close(stream) { + try { + stream.node.mount.opts.fs.close(stream.nfd); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + }, + read(stream, buffer, offset, length, position) { + try { + return stream.node.mount.opts.fs.read( + stream.nfd, + buffer, + offset, + length, + position + ); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + }, + write(stream, buffer, offset, length, position) { + try { + return stream.node.mount.opts.fs.write( + stream.nfd, + buffer, + offset, + length, + position + ); + } catch (e) { + if (!e.code) throw e; + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + try { + var stat = stream.node.node_ops.getattr( + stream.node + ); + position += stat.size; + } catch (e) { + throw new FS.ErrnoError(ERRNO_CODES[e.code]); + } + } + } + if (position < 0) { + throw new FS.ErrnoError(ERRNO_CODES.EINVAL); + } + return position; + }, + }, + }; + var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: '/', + initialized: false, + ignorePermissions: true, + ErrnoError: null, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + lookupPath: (path, opts = {}) => { + path = PATH_FS.resolve(path); + if (!path) return { path: '', node: null }; + var defaults = { follow_mount: true, recurse_count: 0 }; + opts = Object.assign(defaults, opts); + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + var parts = path.split('/').filter((p) => !!p); + var current = FS.root; + var current_path = '/'; + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + if (FS.isMountpoint(current)) { + if (!islast || (islast && opts.follow_mount)) { + current = current.mounted.root; + } + } + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve( + PATH.dirname(current_path), + link + ); + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count + 1, + }); + current = lookup.node; + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + return { path: current_path, node: current }; + }, + getPath: (node) => { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== '/' + ? `${mount}/${path}` + : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName: (parentid, name) => { + var hash = 0; + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode: (node) => { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode: (node) => { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode: (parent, name) => { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode, parent); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + return FS.lookup(parent, name); + }, + createNode: (parent, name, mode, rdev) => { + var node = new FS.FSNode(parent, name, mode, rdev); + FS.hashAddNode(node); + return node; + }, + destroyNode: (node) => { + FS.hashRemoveNode(node); + }, + isRoot: (node) => node === node.parent, + isMountpoint: (node) => !!node.mounted, + isFile: (mode) => (mode & 61440) === 32768, + isDir: (mode) => (mode & 61440) === 16384, + isLink: (mode) => (mode & 61440) === 40960, + isChrdev: (mode) => (mode & 61440) === 8192, + isBlkdev: (mode) => (mode & 61440) === 24576, + isFIFO: (mode) => (mode & 61440) === 4096, + isSocket: (mode) => (mode & 49152) === 49152, + flagsToPermissionString: (flag) => { + var perms = ['r', 'w', 'rw'][flag & 3]; + if (flag & 512) { + perms += 'w'; + } + return perms; + }, + nodePermissions: (node, perms) => { + if (FS.ignorePermissions) { + return 0; + } + if (perms.includes('r') && !(node.mode & 292)) { + return 2; + } else if (perms.includes('w') && !(node.mode & 146)) { + return 2; + } else if (perms.includes('x') && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup: (dir) => { + var errCode = FS.nodePermissions(dir, 'x'); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate: (dir, name) => { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, 'wx'); + }, + mayDelete: (dir, name, isdir) => { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, 'wx'); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen: (node, flags) => { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== 'r' || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd: () => { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked: (fd) => { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: (fd) => FS.streams[fd], + createStream: (stream, fd = -1) => { + if (!FS.FSStream) { + FS.FSStream = function () { + this.shared = {}; + }; + FS.FSStream.prototype = {}; + Object.defineProperties(FS.FSStream.prototype, { + object: { + get() { + return this.node; + }, + set(val) { + this.node = val; + }, + }, + isRead: { + get() { + return (this.flags & 2097155) !== 1; + }, + }, + isWrite: { + get() { + return (this.flags & 2097155) !== 0; + }, + }, + isAppend: { + get() { + return this.flags & 1024; + }, + }, + flags: { + get() { + return this.shared.flags; + }, + set(val) { + this.shared.flags = val; + }, + }, + position: { + get() { + return this.shared.position; + }, + set(val) { + this.shared.position = val; + }, + }, + }); + } + stream = Object.assign(new FS.FSStream(), stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream: (fd) => { + FS.streams[fd] = null; + }, + chrdev_stream_ops: { + open: (stream) => { + var device = FS.getDevice(stream.node.rdev); + stream.stream_ops = device.stream_ops; + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + }, + llseek: () => { + throw new FS.ErrnoError(70); + }, + }, + major: (dev) => dev >> 8, + minor: (dev) => dev & 255, + makedev: (ma, mi) => (ma << 8) | mi, + registerDevice: (dev, ops) => { + FS.devices[dev] = { stream_ops: ops }; + }, + getDevice: (dev) => FS.devices[dev], + getMounts: (mount) => { + var mounts = []; + var check = [mount]; + while (check.length) { + var m = check.pop(); + mounts.push(m); + check.push.apply(check, m.mounts); + } + return mounts; + }, + syncfs: (populate, callback) => { + if (typeof populate == 'function') { + callback = populate; + populate = false; + } + FS.syncFSRequests++; + if (FS.syncFSRequests > 1) { + err( + `warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work` + ); + } + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + function doCallback(errCode) { + FS.syncFSRequests--; + return callback(errCode); + } + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + mounts.forEach((mount) => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount: (type, opts, mountpoint) => { + var root = mountpoint === '/'; + var pseudo = !mountpoint; + var node; + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + mountpoint = lookup.path; + node = lookup.node; + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + var mount = { + type: type, + opts: opts, + mountpoint: mountpoint, + mounts: [], + }; + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + if (node.mount) { + node.mount.mounts.push(mount); + } + } + return mountRoot; + }, + unmount: (mountpoint) => { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + Object.keys(FS.nameTable).forEach((hash) => { + var current = FS.nameTable[hash]; + while (current) { + var next = current.name_next; + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + current = next; + } + }); + node.mounted = null; + var idx = node.mount.mounts.indexOf(mount); + node.mount.mounts.splice(idx, 1); + }, + lookup: (parent, name) => parent.node_ops.lookup(parent, name), + mknod: (path, mode, dev) => { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === '.' || name === '..') { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create: (path, mode) => { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir: (path, mode) => { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree: (path, mode) => { + var dirs = path.split('/'); + var d = ''; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += '/' + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev: (path, mode, dev) => { + if (typeof dev == 'undefined') { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink: (oldpath, newpath) => { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename: (old_path, new_path) => { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + var lookup, old_dir, new_dir; + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + var old_node = FS.lookupNode(old_dir, old_name); + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(28); + } + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(55); + } + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (old_node === new_node) { + return; + } + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + errCode = new_node + ? FS.mayDelete(new_dir, new_name, isdir) + : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if ( + FS.isMountpoint(old_node) || + (new_node && FS.isMountpoint(new_node)) + ) { + throw new FS.ErrnoError(10); + } + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, 'w'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + FS.hashRemoveNode(old_node); + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir: (path) => { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir: (path) => { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink: (path) => { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink: (path) => { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve( + FS.getPath(link.parent), + link.node_ops.readlink(link) + ); + }, + stat: (path, dontFollow) => { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat: (path) => FS.stat(path, true), + chmod: (path, mode, dontFollow) => { + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: (mode & 4095) | (node.mode & ~4095), + timestamp: Date.now(), + }); + }, + lchmod: (path, mode) => { + FS.chmod(path, mode, true); + }, + fchmod: (fd, mode) => { + var stream = FS.getStreamChecked(fd); + FS.chmod(stream.node, mode); + }, + chown: (path, uid, gid, dontFollow) => { + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { timestamp: Date.now() }); + }, + lchown: (path, uid, gid) => { + FS.chown(path, uid, gid, true); + }, + fchown: (fd, uid, gid) => { + var stream = FS.getStreamChecked(fd); + FS.chown(stream.node, uid, gid); + }, + truncate: (path, len) => { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, 'w'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { size: len, timestamp: Date.now() }); + }, + ftruncate: (fd, len) => { + var stream = FS.getStreamChecked(fd); + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime: (path, atime, mtime) => { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + node.node_ops.setattr(node, { timestamp: Math.max(atime, mtime) }); + }, + open: (path, flags, mode) => { + if (path === '') { + throw new FS.ErrnoError(44); + } + flags = + typeof flags == 'string' ? FS_modeStringToFlags(flags) : flags; + mode = typeof mode == 'undefined' ? 438 : mode; + if (flags & 64) { + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == 'object') { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + }); + node = lookup.node; + } catch (e) {} + } + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + if (flags & 512 && !created) { + FS.truncate(node, 0); + } + flags &= ~(128 | 512 | 131072); + var stream = FS.createStream({ + node: node, + path: FS.getPath(node), + flags: flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + ungotten: [], + error: false, + }); + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module['logReadFiles'] && !(flags & 1)) { + if (!FS.readFiles) FS.readFiles = {}; + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close: (stream) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed: (stream) => stream.fd === null, + llseek: (stream, offset, whence) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read: (stream, buffer, offset, length, position) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != 'undefined'; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read( + stream, + buffer, + offset, + length, + position + ); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write: (stream, buffer, offset, length, position, canOwn) => { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != 'undefined'; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write( + stream, + buffer, + offset, + length, + position, + canOwn + ); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate: (stream, offset, length) => { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap: (stream, length, position, prot, flags) => { + if ( + (prot & 2) !== 0 && + (flags & 2) === 0 && + (stream.flags & 2097155) !== 2 + ) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + return stream.stream_ops.mmap( + stream, + length, + position, + prot, + flags + ); + }, + msync: (stream, buffer, offset, length, mmapFlags) => { + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync( + stream, + buffer, + offset, + length, + mmapFlags + ); + }, + munmap: (stream) => 0, + ioctl: (stream, cmd, arg) => { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile: (path, opts = {}) => { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || 'binary'; + if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === 'utf8') { + ret = UTF8ArrayToString(buf, 0); + } else if (opts.encoding === 'binary') { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile: (path, data, opts = {}) => { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == 'string') { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array( + data, + buf, + 0, + buf.length + ); + FS.write( + stream, + buf, + 0, + actualNumBytes, + undefined, + opts.canOwn + ); + } else if (ArrayBuffer.isView(data)) { + FS.write( + stream, + data, + 0, + data.byteLength, + undefined, + opts.canOwn + ); + } else { + throw new Error('Unsupported data type'); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir: (path) => { + var lookup = FS.lookupPath(path, { follow: true }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, 'x'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories: () => { + FS.mkdir('/tmp'); + FS.mkdir('/home'); + FS.mkdir('/home/web_user'); + }, + createDefaultDevices: () => { + FS.mkdir('/dev'); + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + }); + FS.mkdev('/dev/null', FS.makedev(1, 3)); + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev('/dev/tty', FS.makedev(5, 0)); + FS.mkdev('/dev/tty1', FS.makedev(6, 0)); + var randomBuffer = new Uint8Array(1024), + randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomLeft = randomFill(randomBuffer).byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice('/dev', 'random', randomByte); + FS.createDevice('/dev', 'urandom', randomByte); + FS.mkdir('/dev/shm'); + FS.mkdir('/dev/shm/tmp'); + }, + createSpecialDirectories: () => { + FS.mkdir('/proc'); + var proc_self = FS.mkdir('/proc/self'); + FS.mkdir('/proc/self/fd'); + FS.mount( + { + mount: () => { + var node = FS.createNode( + proc_self, + 'fd', + 16384 | 511, + 73 + ); + node.node_ops = { + lookup: (parent, name) => { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { mountpoint: 'fake' }, + node_ops: { readlink: () => stream.path }, + }; + ret.parent = ret; + return ret; + }, + }; + return node; + }, + }, + {}, + '/proc/self/fd' + ); + }, + createStandardStreams: () => { + if (Module['stdin']) { + FS.createDevice('/dev', 'stdin', Module['stdin']); + } else { + FS.symlink('/dev/tty', '/dev/stdin'); + } + if (Module['stdout']) { + FS.createDevice('/dev', 'stdout', null, Module['stdout']); + } else { + FS.symlink('/dev/tty', '/dev/stdout'); + } + if (Module['stderr']) { + FS.createDevice('/dev', 'stderr', null, Module['stderr']); + } else { + FS.symlink('/dev/tty1', '/dev/stderr'); + } + var stdin = FS.open('/dev/stdin', 0); + var stdout = FS.open('/dev/stdout', 1); + var stderr = FS.open('/dev/stderr', 1); + }, + ensureErrnoError: () => { + if (FS.ErrnoError) return; + FS.ErrnoError = function ErrnoError(errno, node) { + this.name = 'ErrnoError'; + this.node = node; + this.setErrno = function (errno) { + this.errno = errno; + }; + this.setErrno(errno); + this.message = 'FS error'; + }; + FS.ErrnoError.prototype = new Error(); + FS.ErrnoError.prototype.constructor = FS.ErrnoError; + [44].forEach((code) => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ''; + }); + }, + staticInit: () => { + FS.ensureErrnoError(); + FS.nameTable = new Array(4096); + FS.mount(MEMFS, {}, '/'); + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + FS.filesystems = { MEMFS: MEMFS, PROXYFS: PROXYFS }; + }, + init: (input, output, error) => { + FS.init.initialized = true; + FS.ensureErrnoError(); + Module['stdin'] = input || Module['stdin']; + Module['stdout'] = output || Module['stdout']; + Module['stderr'] = error || Module['stderr']; + FS.createStandardStreams(); + }, + quit: () => { + FS.init.initialized = false; + _fflush(0); + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject: (path, dontResolveLastLink) => { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath: (path, dontResolveLastLink) => { + try { + var lookup = FS.lookupPath(path, { + follow: !dontResolveLastLink, + }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null, + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === '/'; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath: (parent, path, canRead, canWrite) => { + parent = typeof parent == 'string' ? parent : FS.getPath(parent); + var parts = path.split('/').reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile: (parent, name, properties, canRead, canWrite) => { + var path = PATH.join2( + typeof parent == 'string' ? parent : FS.getPath(parent), + name + ); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile: (parent, name, data, canRead, canWrite, canOwn) => { + var path = name; + if (parent) { + parent = + typeof parent == 'string' ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == 'string') { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) + arr[i] = data.charCodeAt(i); + data = arr; + } + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + return node; + }, + createDevice: (parent, name, input, output) => { + var path = PATH.join2( + typeof parent == 'string' ? parent : FS.getPath(parent), + name + ); + var mode = FS_getMode(!!input, !!output); + if (!FS.createDevice.major) FS.createDevice.major = 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + FS.registerDevice(dev, { + open: (stream) => { + stream.seekable = false; + }, + close: (stream) => { + if (output && output.buffer && output.buffer.length) { + output(10); + } + }, + read: (stream, buffer, offset, length, pos) => { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write: (stream, buffer, offset, length, pos) => { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile: (obj) => { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) + return true; + if (typeof XMLHttpRequest != 'undefined') { + throw new Error( + 'Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.' + ); + } else if (read_) { + try { + obj.contents = intArrayFromString(read_(obj.url), true); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } else { + throw new Error( + 'Cannot load without read() or XMLHttpRequest.' + ); + } + }, + createLazyFile: (parent, name, url, canRead, canWrite) => { + function LazyUint8Array() { + this.lengthKnown = false; + this.chunks = []; + } + LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + }; + LazyUint8Array.prototype.setDataGetter = + function LazyUint8Array_setDataGetter(getter) { + this.getter = getter; + }; + LazyUint8Array.prototype.cacheLength = + function LazyUint8Array_cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open('HEAD', url, false); + xhr.send(null); + if ( + !( + (xhr.status >= 200 && xhr.status < 300) || + xhr.status === 304 + ) + ) + throw new Error( + "Couldn't load " + url + '. Status: ' + xhr.status + ); + var datalength = Number( + xhr.getResponseHeader('Content-length') + ); + var header; + var hasByteServing = + (header = xhr.getResponseHeader('Accept-Ranges')) && + header === 'bytes'; + var usesGzip = + (header = xhr.getResponseHeader('Content-Encoding')) && + header === 'gzip'; + var chunkSize = 1024 * 1024; + if (!hasByteServing) chunkSize = datalength; + var doXHR = (from, to) => { + if (from > to) + throw new Error( + 'invalid range (' + + from + + ', ' + + to + + ') or no bytes requested!' + ); + if (to > datalength - 1) + throw new Error( + 'only ' + + datalength + + ' bytes available! programmer error!' + ); + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + if (datalength !== chunkSize) + xhr.setRequestHeader( + 'Range', + 'bytes=' + from + '-' + to + ); + xhr.responseType = 'arraybuffer'; + if (xhr.overrideMimeType) { + xhr.overrideMimeType( + 'text/plain; charset=x-user-defined' + ); + } + xhr.send(null); + if ( + !( + (xhr.status >= 200 && xhr.status < 300) || + xhr.status === 304 + ) + ) + throw new Error( + "Couldn't load " + + url + + '. Status: ' + + xhr.status + ); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } + return intArrayFromString(xhr.responseText || '', true); + }; + var lazyArray = this; + lazyArray.setDataGetter((chunkNum) => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == 'undefined') { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == 'undefined') + throw new Error('doXHR failed!'); + return lazyArray.chunks[chunkNum]; + }); + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out( + 'LazyFiles on gzip forces download of the whole file when length is accessed' + ); + } + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + }; + if (typeof XMLHttpRequest != 'undefined') { + if (!ENVIRONMENT_IS_WORKER) + throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc'; + var lazyArray = new LazyUint8Array(); + Object.defineProperties(lazyArray, { + length: { + get: function () { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + }, + }, + chunkSize: { + get: function () { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + }, + }, + }); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url: url }; + } + var node = FS.createFile( + parent, + name, + properties, + canRead, + canWrite + ); + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + Object.defineProperties(node, { + usedBytes: { + get: function () { + return this.contents.length; + }, + }, + }); + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach((key) => { + var fn = node.stream_ops[key]; + stream_ops[key] = function forceLoadLazyFile() { + FS.forceLoadFile(node); + return fn.apply(null, arguments); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { ptr: ptr, allocated: true }; + }; + node.stream_ops = stream_ops; + return node; + }, + }; + Module['FS'] = FS; + var SOCKFS = { + mount(mount) { + Module['websocket'] = + Module['websocket'] && 'object' === typeof Module['websocket'] + ? Module['websocket'] + : {}; + Module['websocket']._callbacks = {}; + Module['websocket']['on'] = function (event, callback) { + if ('function' === typeof callback) { + this._callbacks[event] = callback; + } + return this; + }; + Module['websocket'].emit = function (event, param) { + if ('function' === typeof this._callbacks[event]) { + this._callbacks[event].call(this, param); + } + }; + return FS.createNode(null, '/', 16384 | 511, 0); + }, + createSocket(family, type, protocol) { + type &= ~526336; + var streaming = type == 1; + if (streaming && protocol && protocol != 6) { + throw new FS.ErrnoError(66); + } + var sock = { + family: family, + type: type, + protocol: protocol, + server: null, + error: null, + peers: {}, + pending: [], + recv_queue: [], + sock_ops: SOCKFS.websocket_sock_ops, + }; + var name = SOCKFS.nextname(); + var node = FS.createNode(SOCKFS.root, name, 49152, 0); + node.sock = sock; + var stream = FS.createStream({ + path: name, + node: node, + flags: 2, + seekable: false, + stream_ops: SOCKFS.stream_ops, + }); + sock.stream = stream; + return sock; + }, + getSocket(fd) { + var stream = FS.getStream(fd); + if (!stream || !FS.isSocket(stream.node.mode)) { + return null; + } + return stream.node.sock; + }, + stream_ops: { + poll(stream) { + var sock = stream.node.sock; + return sock.sock_ops.poll(sock); + }, + ioctl(stream, request, varargs) { + var sock = stream.node.sock; + return sock.sock_ops.ioctl(sock, request, varargs); + }, + read(stream, buffer, offset, length, position) { + var sock = stream.node.sock; + var msg = sock.sock_ops.recvmsg(sock, length); + if (!msg) { + return 0; + } + buffer.set(msg.buffer, offset); + return msg.buffer.length; + }, + write(stream, buffer, offset, length, position) { + var sock = stream.node.sock; + return sock.sock_ops.sendmsg(sock, buffer, offset, length); + }, + close(stream) { + var sock = stream.node.sock; + sock.sock_ops.close(sock); + }, + }, + nextname() { + if (!SOCKFS.nextname.current) { + SOCKFS.nextname.current = 0; + } + return 'socket[' + SOCKFS.nextname.current++ + ']'; + }, + websocket_sock_ops: { + createPeer(sock, addr, port) { + var ws; + if (typeof addr == 'object') { + ws = addr; + addr = null; + port = null; + } + if (ws) { + if (ws._socket) { + addr = ws._socket.remoteAddress; + port = ws._socket.remotePort; + } else { + var result = /ws[s]?:\/\/([^:]+):(\d+)/.exec(ws.url); + if (!result) { + throw new Error( + 'WebSocket URL must be in the format ws(s)://address:port' + ); + } + addr = result[1]; + port = parseInt(result[2], 10); + } + } else { + try { + var runtimeConfig = + Module['websocket'] && + 'object' === typeof Module['websocket']; + var url = 'ws:#'.replace('#', '//'); + if (runtimeConfig) { + if ( + 'function' === typeof Module['websocket']['url'] + ) { + url = Module['websocket']['url'](...arguments); + } else if ( + 'string' === typeof Module['websocket']['url'] + ) { + url = Module['websocket']['url']; + } + } + if (url === 'ws://' || url === 'wss://') { + var parts = addr.split('/'); + url = + url + + parts[0] + + ':' + + port + + '/' + + parts.slice(1).join('/'); + } + var subProtocols = 'binary'; + if (runtimeConfig) { + if ( + 'string' === + typeof Module['websocket']['subprotocol'] + ) { + subProtocols = + Module['websocket']['subprotocol']; + } + } + var opts = undefined; + if (subProtocols !== 'null') { + subProtocols = subProtocols + .replace(/^ +| +$/g, '') + .split(/ *, */); + opts = subProtocols; + } + if ( + runtimeConfig && + null === Module['websocket']['subprotocol'] + ) { + subProtocols = 'null'; + opts = undefined; + } + var WebSocketConstructor; + { + WebSocketConstructor = WebSocket; + } + if (Module['websocket']['decorator']) { + WebSocketConstructor = + Module['websocket']['decorator']( + WebSocketConstructor + ); + } + ws = new WebSocketConstructor(url, opts); + ws.binaryType = 'arraybuffer'; + } catch (e) { + throw new FS.ErrnoError(23); + } + } + var peer = { + addr: addr, + port: port, + socket: ws, + dgram_send_queue: [], + }; + SOCKFS.websocket_sock_ops.addPeer(sock, peer); + SOCKFS.websocket_sock_ops.handlePeerEvents(sock, peer); + if (sock.type === 2 && typeof sock.sport != 'undefined') { + peer.dgram_send_queue.push( + new Uint8Array([ + 255, + 255, + 255, + 255, + 'p'.charCodeAt(0), + 'o'.charCodeAt(0), + 'r'.charCodeAt(0), + 't'.charCodeAt(0), + (sock.sport & 65280) >> 8, + sock.sport & 255, + ]) + ); + } + return peer; + }, + getPeer(sock, addr, port) { + return sock.peers[addr + ':' + port]; + }, + addPeer(sock, peer) { + sock.peers[peer.addr + ':' + peer.port] = peer; + }, + removePeer(sock, peer) { + delete sock.peers[peer.addr + ':' + peer.port]; + }, + handlePeerEvents(sock, peer) { + var first = true; + var handleOpen = function () { + Module['websocket'].emit('open', sock.stream.fd); + try { + var queued = peer.dgram_send_queue.shift(); + while (queued) { + peer.socket.send(queued); + queued = peer.dgram_send_queue.shift(); + } + } catch (e) { + peer.socket.close(); + } + }; + function handleMessage(data) { + if (typeof data == 'string') { + var encoder = new TextEncoder(); + data = encoder.encode(data); + } else { + assert(data.byteLength !== undefined); + if (data.byteLength == 0) { + return; + } + data = new Uint8Array(data); + } + var wasfirst = first; + first = false; + if ( + wasfirst && + data.length === 10 && + data[0] === 255 && + data[1] === 255 && + data[2] === 255 && + data[3] === 255 && + data[4] === 'p'.charCodeAt(0) && + data[5] === 'o'.charCodeAt(0) && + data[6] === 'r'.charCodeAt(0) && + data[7] === 't'.charCodeAt(0) + ) { + var newport = (data[8] << 8) | data[9]; + SOCKFS.websocket_sock_ops.removePeer(sock, peer); + peer.port = newport; + SOCKFS.websocket_sock_ops.addPeer(sock, peer); + return; + } + sock.recv_queue.push({ + addr: peer.addr, + port: peer.port, + data: data, + }); + Module['websocket'].emit('message', sock.stream.fd); + } + if (ENVIRONMENT_IS_NODE) { + peer.socket.on('open', handleOpen); + peer.socket.on('message', function (data, isBinary) { + if (!isBinary) { + return; + } + handleMessage(new Uint8Array(data).buffer); + }); + peer.socket.on('close', function () { + Module['websocket'].emit('close', sock.stream.fd); + }); + peer.socket.on('error', function (error) { + sock.error = 14; + Module['websocket'].emit('error', [ + sock.stream.fd, + sock.error, + 'ECONNREFUSED: Connection refused', + ]); + }); + } else { + peer.socket.onopen = handleOpen; + peer.socket.onclose = function () { + Module['websocket'].emit('close', sock.stream.fd); + }; + peer.socket.onmessage = function peer_socket_onmessage( + event + ) { + handleMessage(event.data); + }; + peer.socket.onerror = function (error) { + sock.error = 14; + Module['websocket'].emit('error', [ + sock.stream.fd, + sock.error, + 'ECONNREFUSED: Connection refused', + ]); + }; + } + }, + poll(sock) { + if (sock.type === 1 && sock.server) { + return sock.pending.length ? 64 | 1 : 0; + } + var mask = 0; + var dest = + sock.type === 1 + ? SOCKFS.websocket_sock_ops.getPeer( + sock, + sock.daddr, + sock.dport + ) + : null; + if ( + sock.recv_queue.length || + !dest || + (dest && dest.socket.readyState === dest.socket.CLOSING) || + (dest && dest.socket.readyState === dest.socket.CLOSED) + ) { + mask |= 64 | 1; + } + if ( + !dest || + (dest && dest.socket.readyState === dest.socket.OPEN) + ) { + mask |= 4; + } + if ( + (dest && dest.socket.readyState === dest.socket.CLOSING) || + (dest && dest.socket.readyState === dest.socket.CLOSED) + ) { + mask |= 16; + } + return mask; + }, + ioctl(sock, request, arg) { + switch (request) { + case 21531: + var bytes = 0; + if (sock.recv_queue.length) { + bytes = sock.recv_queue[0].data.length; + } + HEAP32[arg >> 2] = bytes; + return 0; + default: + return 28; + } + }, + close(sock) { + if (sock.server) { + try { + sock.server.close(); + } catch (e) {} + sock.server = null; + } + var peers = Object.keys(sock.peers); + for (var i = 0; i < peers.length; i++) { + var peer = sock.peers[peers[i]]; + try { + peer.socket.close(); + } catch (e) {} + SOCKFS.websocket_sock_ops.removePeer(sock, peer); + } + return 0; + }, + bind(sock, addr, port) { + if ( + typeof sock.saddr != 'undefined' || + typeof sock.sport != 'undefined' + ) { + throw new FS.ErrnoError(28); + } + sock.saddr = addr; + sock.sport = port; + if (sock.type === 2) { + if (sock.server) { + sock.server.close(); + sock.server = null; + } + try { + sock.sock_ops.listen(sock, 0); + } catch (e) { + if (!(e.name === 'ErrnoError')) throw e; + if (e.errno !== 138) throw e; + } + } + }, + connect(sock, addr, port) { + if (sock.server) { + throw new FS.ErrnoError(138); + } + if ( + typeof sock.daddr != 'undefined' && + typeof sock.dport != 'undefined' + ) { + var dest = SOCKFS.websocket_sock_ops.getPeer( + sock, + sock.daddr, + sock.dport + ); + if (dest) { + if (dest.socket.readyState === dest.socket.CONNECTING) { + throw new FS.ErrnoError(7); + } else { + throw new FS.ErrnoError(30); + } + } + } + var peer = SOCKFS.websocket_sock_ops.createPeer( + sock, + addr, + port + ); + sock.daddr = peer.addr; + sock.dport = peer.port; + throw new FS.ErrnoError(26); + }, + listen(sock, backlog) { + if (!ENVIRONMENT_IS_NODE) { + throw new FS.ErrnoError(138); + } + }, + accept(listensock) { + if (!listensock.server || !listensock.pending.length) { + throw new FS.ErrnoError(28); + } + var newsock = listensock.pending.shift(); + newsock.stream.flags = listensock.stream.flags; + return newsock; + }, + getname(sock, peer) { + var addr, port; + if (peer) { + if (sock.daddr === undefined || sock.dport === undefined) { + throw new FS.ErrnoError(53); + } + addr = sock.daddr; + port = sock.dport; + } else { + addr = sock.saddr || 0; + port = sock.sport || 0; + } + return { addr: addr, port: port }; + }, + sendmsg(sock, buffer, offset, length, addr, port) { + if (sock.type === 2) { + if (addr === undefined || port === undefined) { + addr = sock.daddr; + port = sock.dport; + } + if (addr === undefined || port === undefined) { + throw new FS.ErrnoError(17); + } + } else { + addr = sock.daddr; + port = sock.dport; + } + var dest = SOCKFS.websocket_sock_ops.getPeer(sock, addr, port); + if (sock.type === 1) { + if ( + !dest || + dest.socket.readyState === dest.socket.CLOSING || + dest.socket.readyState === dest.socket.CLOSED + ) { + throw new FS.ErrnoError(53); + } else if ( + dest.socket.readyState === dest.socket.CONNECTING + ) { + throw new FS.ErrnoError(6); + } + } + if (ArrayBuffer.isView(buffer)) { + offset += buffer.byteOffset; + buffer = buffer.buffer; + } + var data; + data = buffer.slice(offset, offset + length); + if (sock.type === 2) { + if (!dest || dest.socket.readyState !== dest.socket.OPEN) { + if ( + !dest || + dest.socket.readyState === dest.socket.CLOSING || + dest.socket.readyState === dest.socket.CLOSED + ) { + dest = SOCKFS.websocket_sock_ops.createPeer( + sock, + addr, + port + ); + } + dest.dgram_send_queue.push(data); + return length; + } + } + try { + dest.socket.send(data); + return length; + } catch (e) { + throw new FS.ErrnoError(28); + } + }, + recvmsg(sock, length) { + if (sock.type === 1 && sock.server) { + throw new FS.ErrnoError(53); + } + var queued = sock.recv_queue.shift(); + if (!queued) { + if (sock.type === 1) { + var dest = SOCKFS.websocket_sock_ops.getPeer( + sock, + sock.daddr, + sock.dport + ); + if (!dest) { + throw new FS.ErrnoError(53); + } + if ( + dest.socket.readyState === dest.socket.CLOSING || + dest.socket.readyState === dest.socket.CLOSED + ) { + return null; + } + throw new FS.ErrnoError(6); + } + throw new FS.ErrnoError(6); + } + var queuedLength = queued.data.byteLength || queued.data.length; + var queuedOffset = queued.data.byteOffset || 0; + var queuedBuffer = queued.data.buffer || queued.data; + var bytesRead = Math.min(length, queuedLength); + var res = { + buffer: new Uint8Array( + queuedBuffer, + queuedOffset, + bytesRead + ), + addr: queued.addr, + port: queued.port, + }; + if (sock.type === 1 && bytesRead < queuedLength) { + var bytesRemaining = queuedLength - bytesRead; + queued.data = new Uint8Array( + queuedBuffer, + queuedOffset + bytesRead, + bytesRemaining + ); + sock.recv_queue.unshift(queued); + } + return res; + }, + }, + }; + function getSocketFromFD(fd) { + var socket = SOCKFS.getSocket(fd); + if (!socket) throw new FS.ErrnoError(8); + return socket; + } + var setErrNo = (value) => { + HEAP32[___errno_location() >> 2] = value; + return value; + }; + var inetPton4 = (str) => { + var b = str.split('.'); + for (var i = 0; i < 4; i++) { + var tmp = Number(b[i]); + if (isNaN(tmp)) return null; + b[i] = tmp; + } + return (b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24)) >>> 0; + }; + var jstoi_q = (str) => parseInt(str); + var inetPton6 = (str) => { + var words; + var w, offset, z; + var valid6regx = + /^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i; + var parts = []; + if (!valid6regx.test(str)) { + return null; + } + if (str === '::') { + return [0, 0, 0, 0, 0, 0, 0, 0]; + } + if (str.startsWith('::')) { + str = str.replace('::', 'Z:'); + } else { + str = str.replace('::', ':Z:'); + } + if (str.indexOf('.') > 0) { + str = str.replace(new RegExp('[.]', 'g'), ':'); + words = str.split(':'); + words[words.length - 4] = + jstoi_q(words[words.length - 4]) + + jstoi_q(words[words.length - 3]) * 256; + words[words.length - 3] = + jstoi_q(words[words.length - 2]) + + jstoi_q(words[words.length - 1]) * 256; + words = words.slice(0, words.length - 2); + } else { + words = str.split(':'); + } + offset = 0; + z = 0; + for (w = 0; w < words.length; w++) { + if (typeof words[w] == 'string') { + if (words[w] === 'Z') { + for (z = 0; z < 8 - words.length + 1; z++) { + parts[w + z] = 0; + } + offset = z - 1; + } else { + parts[w + offset] = _htons(parseInt(words[w], 16)); + } + } else { + parts[w + offset] = words[w]; + } + } + return [ + (parts[1] << 16) | parts[0], + (parts[3] << 16) | parts[2], + (parts[5] << 16) | parts[4], + (parts[7] << 16) | parts[6], + ]; + }; + var writeSockaddr = (sa, family, addr, port, addrlen) => { + switch (family) { + case 2: + addr = inetPton4(addr); + zeroMemory(sa, 16); + if (addrlen) { + HEAP32[addrlen >> 2] = 16; + } + HEAP16[sa >> 1] = family; + HEAP32[(sa + 4) >> 2] = addr; + HEAP16[(sa + 2) >> 1] = _htons(port); + break; + case 10: + addr = inetPton6(addr); + zeroMemory(sa, 28); + if (addrlen) { + HEAP32[addrlen >> 2] = 28; + } + HEAP32[sa >> 2] = family; + HEAP32[(sa + 8) >> 2] = addr[0]; + HEAP32[(sa + 12) >> 2] = addr[1]; + HEAP32[(sa + 16) >> 2] = addr[2]; + HEAP32[(sa + 20) >> 2] = addr[3]; + HEAP16[(sa + 2) >> 1] = _htons(port); + break; + default: + return 5; + } + return 0; + }; + var DNS = { + address_map: { id: 1, addrs: {}, names: {} }, + lookup_name: (name) => { + var res = inetPton4(name); + if (res !== null) { + return name; + } + res = inetPton6(name); + if (res !== null) { + return name; + } + var addr; + if (DNS.address_map.addrs[name]) { + addr = DNS.address_map.addrs[name]; + } else { + var id = DNS.address_map.id++; + assert(id < 65535, 'exceeded max address mappings of 65535'); + addr = '172.29.' + (id & 255) + '.' + (id & 65280); + DNS.address_map.names[addr] = name; + DNS.address_map.addrs[name] = addr; + } + return addr; + }, + lookup_addr: (addr) => { + if (DNS.address_map.names[addr]) { + return DNS.address_map.names[addr]; + } + return null; + }, + }; + var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt: function (dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat: function (func, path, buf) { + try { + var stat = func(path); + } catch (e) { + if ( + e && + e.node && + PATH.normalize(path) !== PATH.normalize(FS.getPath(e.node)) + ) { + return -54; + } + throw e; + } + HEAP32[buf >> 2] = stat.dev; + HEAP32[(buf + 4) >> 2] = stat.mode; + HEAPU32[(buf + 8) >> 2] = stat.nlink; + HEAP32[(buf + 12) >> 2] = stat.uid; + HEAP32[(buf + 16) >> 2] = stat.gid; + HEAP32[(buf + 20) >> 2] = stat.rdev; + (tempI64 = [ + stat.size >>> 0, + ((tempDouble = stat.size), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / + 4294967296 + ) >>> 0 + : 0), + ]), + (HEAP32[(buf + 24) >> 2] = tempI64[0]), + (HEAP32[(buf + 28) >> 2] = tempI64[1]); + HEAP32[(buf + 32) >> 2] = 4096; + HEAP32[(buf + 36) >> 2] = stat.blocks; + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + (tempI64 = [ + Math.floor(atime / 1e3) >>> 0, + ((tempDouble = Math.floor(atime / 1e3)), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / + 4294967296 + ) >>> 0 + : 0), + ]), + (HEAP32[(buf + 40) >> 2] = tempI64[0]), + (HEAP32[(buf + 44) >> 2] = tempI64[1]); + HEAPU32[(buf + 48) >> 2] = (atime % 1e3) * 1e3; + (tempI64 = [ + Math.floor(mtime / 1e3) >>> 0, + ((tempDouble = Math.floor(mtime / 1e3)), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / + 4294967296 + ) >>> 0 + : 0), + ]), + (HEAP32[(buf + 56) >> 2] = tempI64[0]), + (HEAP32[(buf + 60) >> 2] = tempI64[1]); + HEAPU32[(buf + 64) >> 2] = (mtime % 1e3) * 1e3; + (tempI64 = [ + Math.floor(ctime / 1e3) >>> 0, + ((tempDouble = Math.floor(ctime / 1e3)), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / + 4294967296 + ) >>> 0 + : 0), + ]), + (HEAP32[(buf + 72) >> 2] = tempI64[0]), + (HEAP32[(buf + 76) >> 2] = tempI64[1]); + HEAPU32[(buf + 80) >> 2] = (ctime % 1e3) * 1e3; + (tempI64 = [ + stat.ino >>> 0, + ((tempDouble = stat.ino), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / + 4294967296 + ) >>> 0 + : 0), + ]), + (HEAP32[(buf + 88) >> 2] = tempI64[0]), + (HEAP32[(buf + 92) >> 2] = tempI64[1]); + return 0; + }, + doMsync: function (addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + varargs: undefined, + get() { + SYSCALLS.varargs += 4; + var ret = HEAP32[(SYSCALLS.varargs - 4) >> 2]; + return ret; + }, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + getStreamFromFD: function (fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + }; + function ___syscall_accept4(fd, addr, addrlen, flags, d1, d2) { + try { + var sock = getSocketFromFD(fd); + var newsock = sock.sock_ops.accept(sock); + if (addr) { + var errno = writeSockaddr( + addr, + newsock.family, + DNS.lookup_name(newsock.daddr), + newsock.dport, + addrlen + ); + } + return newsock.stream.fd; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + var inetNtop4 = (addr) => + (addr & 255) + + '.' + + ((addr >> 8) & 255) + + '.' + + ((addr >> 16) & 255) + + '.' + + ((addr >> 24) & 255); + var inetNtop6 = (ints) => { + var str = ''; + var word = 0; + var longest = 0; + var lastzero = 0; + var zstart = 0; + var len = 0; + var i = 0; + var parts = [ + ints[0] & 65535, + ints[0] >> 16, + ints[1] & 65535, + ints[1] >> 16, + ints[2] & 65535, + ints[2] >> 16, + ints[3] & 65535, + ints[3] >> 16, + ]; + var hasipv4 = true; + var v4part = ''; + for (i = 0; i < 5; i++) { + if (parts[i] !== 0) { + hasipv4 = false; + break; + } + } + if (hasipv4) { + v4part = inetNtop4(parts[6] | (parts[7] << 16)); + if (parts[5] === -1) { + str = '::ffff:'; + str += v4part; + return str; + } + if (parts[5] === 0) { + str = '::'; + if (v4part === '0.0.0.0') v4part = ''; + if (v4part === '0.0.0.1') v4part = '1'; + str += v4part; + return str; + } + } + for (word = 0; word < 8; word++) { + if (parts[word] === 0) { + if (word - lastzero > 1) { + len = 0; + } + lastzero = word; + len++; + } + if (len > longest) { + longest = len; + zstart = word - longest + 1; + } + } + for (word = 0; word < 8; word++) { + if (longest > 1) { + if ( + parts[word] === 0 && + word >= zstart && + word < zstart + longest + ) { + if (word === zstart) { + str += ':'; + if (zstart === 0) str += ':'; + } + continue; + } + } + str += Number(_ntohs(parts[word] & 65535)).toString(16); + str += word < 7 ? ':' : ''; + } + return str; + }; + var readSockaddr = (sa, salen) => { + var family = HEAP16[sa >> 1]; + var port = _ntohs(HEAPU16[(sa + 2) >> 1]); + var addr; + switch (family) { + case 2: + if (salen !== 16) { + return { errno: 28 }; + } + addr = HEAP32[(sa + 4) >> 2]; + addr = inetNtop4(addr); + break; + case 10: + if (salen !== 28) { + return { errno: 28 }; + } + addr = [ + HEAP32[(sa + 8) >> 2], + HEAP32[(sa + 12) >> 2], + HEAP32[(sa + 16) >> 2], + HEAP32[(sa + 20) >> 2], + ]; + addr = inetNtop6(addr); + break; + default: + return { errno: 5 }; + } + return { family: family, addr: addr, port: port }; + }; + function getSocketAddress(addrp, addrlen, allowNull) { + if (allowNull && addrp === 0) return null; + var info = readSockaddr(addrp, addrlen); + if (info.errno) throw new FS.ErrnoError(info.errno); + info.addr = DNS.lookup_addr(info.addr) || info.addr; + return info; + } + function ___syscall_bind(fd, addr, addrlen, d1, d2, d3) { + try { + var sock = getSocketFromFD(fd); + var info = getSocketAddress(addr, addrlen); + sock.sock_ops.bind(sock, info.addr, info.port); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_chdir(path) { + try { + path = SYSCALLS.getStr(path); + FS.chdir(path); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_chmod(path, mode) { + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_connect(fd, addr, addrlen, d1, d2, d3) { + try { + var sock = getSocketFromFD(fd); + var info = getSocketAddress(addr, addrlen); + sock.sock_ops.connect(sock, info.addr, info.port); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_dup(fd) { + try { + var old = SYSCALLS.getStreamFromFD(fd); + return FS.createStream(old).fd; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_dup3(fd, newfd, flags) { + try { + var old = SYSCALLS.getStreamFromFD(fd); + if (old.fd === newfd) return -28; + var existing = FS.getStream(newfd); + if (existing) FS.close(existing); + return FS.createStream(old, newfd).fd; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_faccessat(dirfd, path, amode, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ''; + if (amode & 4) perms += 'r'; + if (amode & 2) perms += 'w'; + if (amode & 1) perms += 'x'; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function convertI32PairToI53Checked(lo, hi) { + return (hi + 2097152) >>> 0 < 4194305 - !!lo + ? (lo >>> 0) + hi * 4294967296 + : NaN; + } + function ___syscall_fallocate( + fd, + mode, + offset_low, + offset_high, + len_low, + len_high + ) { + var offset = convertI32PairToI53Checked(offset_low, offset_high); + var len = convertI32PairToI53Checked(len_low, len_high); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.allocate(stream, offset, len); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_fchmod(fd, mode) { + try { + FS.fchmod(fd, mode); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_fchown32(fd, owner, group) { + try { + FS.fchown(fd, owner, group); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_fchownat(dirfd, path, owner, group, flags) { + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + flags = flags & ~256; + path = SYSCALLS.calculateAt(dirfd, path); + (nofollow ? FS.lchown : FS.chown)(path, owner, group); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_fcntl64(fd, cmd, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: { + var arg = SYSCALLS.get(); + if (arg < 0) { + return -28; + } + var newStream; + newStream = FS.createStream(stream, arg); + return newStream.fd; + } + case 1: + case 2: + return 0; + case 3: + return stream.flags; + case 4: { + var arg = SYSCALLS.get(); + stream.flags |= arg; + return 0; + } + case 5: { + var arg = SYSCALLS.get(); + var offset = 0; + HEAP16[(arg + offset) >> 1] = 2; + return 0; + } + case 6: + case 7: + return 0; + case 16: + case 8: + return -28; + case 9: + setErrNo(28); + return -1; + default: { + return -28; + } + } + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_fdatasync(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_fstat64(fd, buf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_ftruncate64(fd, length_low, length_high) { + var length = convertI32PairToI53Checked(length_low, length_high); + try { + if (isNaN(length)) return 61; + FS.ftruncate(fd, length); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + var stringToUTF8 = (str, outPtr, maxBytesToWrite) => + stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); + Module['stringToUTF8'] = stringToUTF8; + function ___syscall_getcwd(buf, size) { + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; + if (size < cwdLengthInBytes) return -68; + stringToUTF8(cwd, buf, size); + return cwdLengthInBytes; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_getdents64(fd, dirp, count) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (!stream.getdents) { + stream.getdents = FS.readdir(stream.path); + } + var struct_size = 280; + var pos = 0; + var off = FS.llseek(stream, 0, 1); + var idx = Math.floor(off / struct_size); + while (idx < stream.getdents.length && pos + struct_size <= count) { + var id; + var type; + var name = stream.getdents[idx]; + if (name === '.') { + id = stream.node.id; + type = 4; + } else if (name === '..') { + var lookup = FS.lookupPath(stream.path, { parent: true }); + id = lookup.node.id; + type = 4; + } else { + var child = FS.lookupNode(stream.node, name); + id = child.id; + type = FS.isChrdev(child.mode) + ? 2 + : FS.isDir(child.mode) + ? 4 + : FS.isLink(child.mode) + ? 10 + : 8; + } + (tempI64 = [ + id >>> 0, + ((tempDouble = id), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / + 4294967296 + ) >>> 0 + : 0), + ]), + (HEAP32[(dirp + pos) >> 2] = tempI64[0]), + (HEAP32[(dirp + pos + 4) >> 2] = tempI64[1]); + (tempI64 = [ + ((idx + 1) * struct_size) >>> 0, + ((tempDouble = (idx + 1) * struct_size), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / + 4294967296 + ) >>> 0 + : 0), + ]), + (HEAP32[(dirp + pos + 8) >> 2] = tempI64[0]), + (HEAP32[(dirp + pos + 12) >> 2] = tempI64[1]); + HEAP16[(dirp + pos + 16) >> 1] = 280; + HEAP8[(dirp + pos + 18) >> 0] = type; + stringToUTF8(name, dirp + pos + 19, 256); + pos += struct_size; + idx += 1; + } + FS.llseek(stream, idx * struct_size, 0); + return pos; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_getpeername(fd, addr, addrlen, d1, d2, d3) { + try { + var sock = getSocketFromFD(fd); + if (!sock.daddr) { + return -53; + } + var errno = writeSockaddr( + addr, + sock.family, + DNS.lookup_name(sock.daddr), + sock.dport, + addrlen + ); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_getsockname(fd, addr, addrlen, d1, d2, d3) { + try { + var sock = getSocketFromFD(fd); + var errno = writeSockaddr( + addr, + sock.family, + DNS.lookup_name(sock.saddr || '0.0.0.0'), + sock.sport, + addrlen + ); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_getsockopt(fd, level, optname, optval, optlen, d1) { + try { + var sock = getSocketFromFD(fd); + if (level === 1) { + if (optname === 4) { + HEAP32[optval >> 2] = sock.error; + HEAP32[optlen >> 2] = 4; + sock.error = null; + return 0; + } + } + return -50; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_ioctl(fd, op, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: { + if (!stream.tty) return -59; + return 0; + } + case 21505: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = SYSCALLS.get(); + HEAP32[argp >> 2] = termios.c_iflag || 0; + HEAP32[(argp + 4) >> 2] = termios.c_oflag || 0; + HEAP32[(argp + 8) >> 2] = termios.c_cflag || 0; + HEAP32[(argp + 12) >> 2] = termios.c_lflag || 0; + for (var i = 0; i < 32; i++) { + HEAP8[(argp + i + 17) >> 0] = termios.c_cc[i] || 0; + } + return 0; + } + return 0; + } + case 21510: + case 21511: + case 21512: { + if (!stream.tty) return -59; + return 0; + } + case 21506: + case 21507: + case 21508: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = SYSCALLS.get(); + var c_iflag = HEAP32[argp >> 2]; + var c_oflag = HEAP32[(argp + 4) >> 2]; + var c_cflag = HEAP32[(argp + 8) >> 2]; + var c_lflag = HEAP32[(argp + 12) >> 2]; + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(HEAP8[(argp + i + 17) >> 0]); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag: c_iflag, + c_oflag: c_oflag, + c_cflag: c_cflag, + c_lflag: c_lflag, + c_cc: c_cc, + }); + } + return 0; + } + case 21519: { + if (!stream.tty) return -59; + var argp = SYSCALLS.get(); + HEAP32[argp >> 2] = 0; + return 0; + } + case 21520: { + if (!stream.tty) return -59; + return -28; + } + case 21531: { + var argp = SYSCALLS.get(); + return FS.ioctl(stream, op, argp); + } + case 21523: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz( + stream.tty + ); + var argp = SYSCALLS.get(); + HEAP16[argp >> 1] = winsize[0]; + HEAP16[(argp + 2) >> 1] = winsize[1]; + } + return 0; + } + case 21524: { + if (!stream.tty) return -59; + return 0; + } + case 21515: { + if (!stream.tty) return -59; + return 0; + } + default: + return -28; + } + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_listen(fd, backlog) { + try { + var sock = getSocketFromFD(fd); + sock.sock_ops.listen(sock, backlog); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_lstat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.lstat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_mkdirat(dirfd, path, mode) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + path = PATH.normalize(path); + if (path[path.length - 1] === '/') + path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_newfstatat(dirfd, path, buf, flags) { + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & ~6400; + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_openat(dirfd, path, flags, varargs) { + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? SYSCALLS.get() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + var PIPEFS = { + BUCKET_BUFFER_SIZE: 8192, + mount(mount) { + return FS.createNode(null, '/', 16384 | 511, 0); + }, + createPipe() { + var pipe = { buckets: [], refcnt: 2 }; + pipe.buckets.push({ + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: 0, + roffset: 0, + }); + var rName = PIPEFS.nextname(); + var wName = PIPEFS.nextname(); + var rNode = FS.createNode(PIPEFS.root, rName, 4096, 0); + var wNode = FS.createNode(PIPEFS.root, wName, 4096, 0); + rNode.pipe = pipe; + wNode.pipe = pipe; + var readableStream = FS.createStream({ + path: rName, + node: rNode, + flags: 0, + seekable: false, + stream_ops: PIPEFS.stream_ops, + }); + rNode.stream = readableStream; + var writableStream = FS.createStream({ + path: wName, + node: wNode, + flags: 1, + seekable: false, + stream_ops: PIPEFS.stream_ops, + }); + wNode.stream = writableStream; + return { + readable_fd: readableStream.fd, + writable_fd: writableStream.fd, + }; + }, + stream_ops: { + poll(stream) { + var pipe = stream.node.pipe; + if ((stream.flags & 2097155) === 1) { + return 256 | 4; + } + if (pipe.buckets.length > 0) { + for (var i = 0; i < pipe.buckets.length; i++) { + var bucket = pipe.buckets[i]; + if (bucket.offset - bucket.roffset > 0) { + return 64 | 1; + } + } + } + return 0; + }, + ioctl(stream, request, varargs) { + return 28; + }, + fsync(stream) { + return 28; + }, + read(stream, buffer, offset, length, position) { + var pipe = stream.node.pipe; + var currentLength = 0; + for (var i = 0; i < pipe.buckets.length; i++) { + var bucket = pipe.buckets[i]; + currentLength += bucket.offset - bucket.roffset; + } + assert( + buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer) + ); + var data = buffer.subarray(offset, offset + length); + if (length <= 0) { + return 0; + } + if (currentLength == 0) { + throw new FS.ErrnoError(6); + } + var toRead = Math.min(currentLength, length); + var totalRead = toRead; + var toRemove = 0; + for (var i = 0; i < pipe.buckets.length; i++) { + var currBucket = pipe.buckets[i]; + var bucketSize = currBucket.offset - currBucket.roffset; + if (toRead <= bucketSize) { + var tmpSlice = currBucket.buffer.subarray( + currBucket.roffset, + currBucket.offset + ); + if (toRead < bucketSize) { + tmpSlice = tmpSlice.subarray(0, toRead); + currBucket.roffset += toRead; + } else { + toRemove++; + } + data.set(tmpSlice); + break; + } else { + var tmpSlice = currBucket.buffer.subarray( + currBucket.roffset, + currBucket.offset + ); + data.set(tmpSlice); + data = data.subarray(tmpSlice.byteLength); + toRead -= tmpSlice.byteLength; + toRemove++; + } + } + if (toRemove && toRemove == pipe.buckets.length) { + toRemove--; + pipe.buckets[toRemove].offset = 0; + pipe.buckets[toRemove].roffset = 0; + } + pipe.buckets.splice(0, toRemove); + return totalRead; + }, + write(stream, buffer, offset, length, position) { + var pipe = stream.node.pipe; + assert( + buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer) + ); + var data = buffer.subarray(offset, offset + length); + var dataLen = data.byteLength; + if (dataLen <= 0) { + return 0; + } + var currBucket = null; + if (pipe.buckets.length == 0) { + currBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: 0, + roffset: 0, + }; + pipe.buckets.push(currBucket); + } else { + currBucket = pipe.buckets[pipe.buckets.length - 1]; + } + assert(currBucket.offset <= PIPEFS.BUCKET_BUFFER_SIZE); + var freeBytesInCurrBuffer = + PIPEFS.BUCKET_BUFFER_SIZE - currBucket.offset; + if (freeBytesInCurrBuffer >= dataLen) { + currBucket.buffer.set(data, currBucket.offset); + currBucket.offset += dataLen; + return dataLen; + } else if (freeBytesInCurrBuffer > 0) { + currBucket.buffer.set( + data.subarray(0, freeBytesInCurrBuffer), + currBucket.offset + ); + currBucket.offset += freeBytesInCurrBuffer; + data = data.subarray( + freeBytesInCurrBuffer, + data.byteLength + ); + } + var numBuckets = + (data.byteLength / PIPEFS.BUCKET_BUFFER_SIZE) | 0; + var remElements = data.byteLength % PIPEFS.BUCKET_BUFFER_SIZE; + for (var i = 0; i < numBuckets; i++) { + var newBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: PIPEFS.BUCKET_BUFFER_SIZE, + roffset: 0, + }; + pipe.buckets.push(newBucket); + newBucket.buffer.set( + data.subarray(0, PIPEFS.BUCKET_BUFFER_SIZE) + ); + data = data.subarray( + PIPEFS.BUCKET_BUFFER_SIZE, + data.byteLength + ); + } + if (remElements > 0) { + var newBucket = { + buffer: new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE), + offset: data.byteLength, + roffset: 0, + }; + pipe.buckets.push(newBucket); + newBucket.buffer.set(data); + } + return dataLen; + }, + close(stream) { + var pipe = stream.node.pipe; + pipe.refcnt--; + if (pipe.refcnt === 0) { + pipe.buckets = null; + } + }, + }, + nextname() { + if (!PIPEFS.nextname.current) { + PIPEFS.nextname.current = 0; + } + return 'pipe[' + PIPEFS.nextname.current++ + ']'; + }, + }; + function ___syscall_pipe(fdPtr) { + try { + if (fdPtr == 0) { + throw new FS.ErrnoError(21); + } + var res = PIPEFS.createPipe(); + HEAP32[fdPtr >> 2] = res.readable_fd; + HEAP32[(fdPtr + 4) >> 2] = res.writable_fd; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_poll(fds, nfds, timeout) { + try { + var nonzero = 0; + for (var i = 0; i < nfds; i++) { + var pollfd = fds + 8 * i; + var fd = HEAP32[pollfd >> 2]; + var events = HEAP16[(pollfd + 4) >> 1]; + var mask = 32; + var stream = FS.getStream(fd); + if (stream) { + mask = SYSCALLS.DEFAULT_POLLMASK; + if (stream.stream_ops?.poll) { + mask = stream.stream_ops.poll(stream, -1); + } + } + mask &= events | 8 | 16; + if (mask) nonzero++; + HEAP16[(pollfd + 6) >> 1] = mask; + } + return nonzero; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_readlinkat(dirfd, path, buf, bufsize) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = HEAP8[buf + len]; + stringToUTF8(ret, buf, bufsize + 1); + HEAP8[buf + len] = endChar; + return len; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_recvfrom(fd, buf, len, flags, addr, addrlen) { + try { + var sock = getSocketFromFD(fd); + var msg = sock.sock_ops.recvmsg(sock, len); + if (!msg) return 0; + if (addr) { + var errno = writeSockaddr( + addr, + sock.family, + DNS.lookup_name(msg.addr), + msg.port, + addrlen + ); + } + HEAPU8.set(msg.buffer, buf); + return msg.buffer.byteLength; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_renameat(olddirfd, oldpath, newdirfd, newpath) { + try { + oldpath = SYSCALLS.getStr(oldpath); + newpath = SYSCALLS.getStr(newpath); + oldpath = SYSCALLS.calculateAt(olddirfd, oldpath); + newpath = SYSCALLS.calculateAt(newdirfd, newpath); + FS.rename(oldpath, newpath); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_rmdir(path) { + try { + path = SYSCALLS.getStr(path); + FS.rmdir(path); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_sendto(fd, message, length, flags, addr, addr_len) { + try { + var sock = getSocketFromFD(fd); + var dest = getSocketAddress(addr, addr_len, true); + if (!dest) { + return FS.write(sock.stream, HEAP8, message, length); + } + return sock.sock_ops.sendmsg( + sock, + HEAP8, + message, + length, + dest.addr, + dest.port + ); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_socket(domain, type, protocol) { + try { + var sock = SOCKFS.createSocket(domain, type, protocol); + return sock.stream.fd; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_stat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.stat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_statfs64(path, size, buf) { + try { + path = SYSCALLS.getStr(path); + HEAP32[(buf + 4) >> 2] = 4096; + HEAP32[(buf + 40) >> 2] = 4096; + HEAP32[(buf + 8) >> 2] = 1e6; + HEAP32[(buf + 12) >> 2] = 5e5; + HEAP32[(buf + 16) >> 2] = 5e5; + HEAP32[(buf + 20) >> 2] = FS.nextInode; + HEAP32[(buf + 24) >> 2] = 1e6; + HEAP32[(buf + 28) >> 2] = 42; + HEAP32[(buf + 44) >> 2] = 2; + HEAP32[(buf + 36) >> 2] = 255; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_symlink(target, linkpath) { + try { + target = SYSCALLS.getStr(target); + linkpath = SYSCALLS.getStr(linkpath); + FS.symlink(target, linkpath); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function ___syscall_unlinkat(dirfd, path, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (flags === 0) { + FS.unlink(path); + } else if (flags === 512) { + FS.rmdir(path); + } else { + abort('Invalid flags passed to unlinkat'); + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function readI53FromI64(ptr) { + return HEAPU32[ptr >> 2] + HEAP32[(ptr + 4) >> 2] * 4294967296; + } + function ___syscall_utimensat(dirfd, path, times, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path, true); + if (!times) { + var atime = Date.now(); + var mtime = atime; + } else { + var seconds = readI53FromI64(times); + var nanoseconds = HEAP32[(times + 8) >> 2]; + atime = seconds * 1e3 + nanoseconds / (1e3 * 1e3); + times += 16; + seconds = readI53FromI64(times); + nanoseconds = HEAP32[(times + 8) >> 2]; + mtime = seconds * 1e3 + nanoseconds / (1e3 * 1e3); + } + FS.utime(path, atime, mtime); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + var nowIsMonotonic = true; + var __emscripten_get_now_is_monotonic = () => nowIsMonotonic; + var __emscripten_throw_longjmp = () => { + throw Infinity; + }; + function __gmtime_js(time_low, time_high, tmPtr) { + var time = convertI32PairToI53Checked(time_low, time_high); + var date = new Date(time * 1e3); + HEAP32[tmPtr >> 2] = date.getUTCSeconds(); + HEAP32[(tmPtr + 4) >> 2] = date.getUTCMinutes(); + HEAP32[(tmPtr + 8) >> 2] = date.getUTCHours(); + HEAP32[(tmPtr + 12) >> 2] = date.getUTCDate(); + HEAP32[(tmPtr + 16) >> 2] = date.getUTCMonth(); + HEAP32[(tmPtr + 20) >> 2] = date.getUTCFullYear() - 1900; + HEAP32[(tmPtr + 24) >> 2] = date.getUTCDay(); + var start = Date.UTC(date.getUTCFullYear(), 0, 1, 0, 0, 0, 0); + var yday = ((date.getTime() - start) / (1e3 * 60 * 60 * 24)) | 0; + HEAP32[(tmPtr + 28) >> 2] = yday; + } + var isLeapYear = (year) => + year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + var MONTH_DAYS_LEAP_CUMULATIVE = [ + 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, + ]; + var MONTH_DAYS_REGULAR_CUMULATIVE = [ + 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, + ]; + var ydayFromDate = (date) => { + var leap = isLeapYear(date.getFullYear()); + var monthDaysCumulative = leap + ? MONTH_DAYS_LEAP_CUMULATIVE + : MONTH_DAYS_REGULAR_CUMULATIVE; + var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; + return yday; + }; + function __localtime_js(time_low, time_high, tmPtr) { + var time = convertI32PairToI53Checked(time_low, time_high); + var date = new Date(time * 1e3); + HEAP32[tmPtr >> 2] = date.getSeconds(); + HEAP32[(tmPtr + 4) >> 2] = date.getMinutes(); + HEAP32[(tmPtr + 8) >> 2] = date.getHours(); + HEAP32[(tmPtr + 12) >> 2] = date.getDate(); + HEAP32[(tmPtr + 16) >> 2] = date.getMonth(); + HEAP32[(tmPtr + 20) >> 2] = date.getFullYear() - 1900; + HEAP32[(tmPtr + 24) >> 2] = date.getDay(); + var yday = ydayFromDate(date) | 0; + HEAP32[(tmPtr + 28) >> 2] = yday; + HEAP32[(tmPtr + 36) >> 2] = -(date.getTimezoneOffset() * 60); + var start = new Date(date.getFullYear(), 0, 1); + var summerOffset = new Date( + date.getFullYear(), + 6, + 1 + ).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = + (summerOffset != winterOffset && + date.getTimezoneOffset() == + Math.min(winterOffset, summerOffset)) | 0; + HEAP32[(tmPtr + 32) >> 2] = dst; + } + var __mktime_js = function (tmPtr) { + var ret = (() => { + var date = new Date( + HEAP32[(tmPtr + 20) >> 2] + 1900, + HEAP32[(tmPtr + 16) >> 2], + HEAP32[(tmPtr + 12) >> 2], + HEAP32[(tmPtr + 8) >> 2], + HEAP32[(tmPtr + 4) >> 2], + HEAP32[tmPtr >> 2], + 0 + ); + var dst = HEAP32[(tmPtr + 32) >> 2]; + var guessedOffset = date.getTimezoneOffset(); + var start = new Date(date.getFullYear(), 0, 1); + var summerOffset = new Date( + date.getFullYear(), + 6, + 1 + ).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dstOffset = Math.min(winterOffset, summerOffset); + if (dst < 0) { + HEAP32[(tmPtr + 32) >> 2] = Number( + summerOffset != winterOffset && dstOffset == guessedOffset + ); + } else if (dst > 0 != (dstOffset == guessedOffset)) { + var nonDstOffset = Math.max(winterOffset, summerOffset); + var trueOffset = dst > 0 ? dstOffset : nonDstOffset; + date.setTime( + date.getTime() + (trueOffset - guessedOffset) * 6e4 + ); + } + HEAP32[(tmPtr + 24) >> 2] = date.getDay(); + var yday = ydayFromDate(date) | 0; + HEAP32[(tmPtr + 28) >> 2] = yday; + HEAP32[tmPtr >> 2] = date.getSeconds(); + HEAP32[(tmPtr + 4) >> 2] = date.getMinutes(); + HEAP32[(tmPtr + 8) >> 2] = date.getHours(); + HEAP32[(tmPtr + 12) >> 2] = date.getDate(); + HEAP32[(tmPtr + 16) >> 2] = date.getMonth(); + HEAP32[(tmPtr + 20) >> 2] = date.getYear(); + return date.getTime() / 1e3; + })(); + return ( + setTempRet0( + ((tempDouble = ret), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / + 4294967296 + ) >>> 0 + : 0) + ), + ret >>> 0 + ); + }; + function __mmap_js( + len, + prot, + flags, + fd, + offset_low, + offset_high, + allocated, + addr + ) { + var offset = convertI32PairToI53Checked(offset_low, offset_high); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var res = FS.mmap(stream, len, offset, prot, flags); + var ptr = res.ptr; + HEAP32[allocated >> 2] = res.allocated; + HEAPU32[addr >> 2] = ptr; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + function __munmap_js(addr, len, prot, flags, fd, offset_low, offset_high) { + var offset = convertI32PairToI53Checked(offset_low, offset_high); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + if (prot & 2) { + SYSCALLS.doMsync(addr, stream, len, flags, offset); + } + FS.munmap(stream); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + var timers = {}; + var handleException = (e) => { + if (e instanceof ExitStatus || e == 'unwind') { + return EXITSTATUS; + } + quit_(1, e); + }; + var _proc_exit = (code) => { + EXITSTATUS = code; + if (!keepRuntimeAlive()) { + if (Module['onExit']) Module['onExit'](code); + ABORT = true; + } + quit_(code, new ExitStatus(code)); + }; + var exitJS = (status, implicit) => { + EXITSTATUS = status; + if (!keepRuntimeAlive()) { + exitRuntime(); + } + _proc_exit(status); + }; + var _exit = exitJS; + Module['_exit'] = _exit; + var maybeExit = () => { + if (runtimeExited) { + return; + } + if (!keepRuntimeAlive()) { + try { + _exit(EXITSTATUS); + } catch (e) { + handleException(e); + } + } + }; + var callUserCallback = (func) => { + if (runtimeExited || ABORT) { + return; + } + try { + func(); + maybeExit(); + } catch (e) { + handleException(e); + } + }; + var _emscripten_get_now; + _emscripten_get_now = () => performance.now(); + var __setitimer_js = (which, timeout_ms) => { + if (timers[which]) { + clearTimeout(timers[which].id); + delete timers[which]; + } + if (!timeout_ms) return 0; + var id = setTimeout(() => { + delete timers[which]; + callUserCallback(() => + __emscripten_timeout(which, _emscripten_get_now()) + ); + }, timeout_ms); + timers[which] = { id: id, timeout_ms: timeout_ms }; + return 0; + }; + var stringToNewUTF8 = (str) => { + var size = lengthBytesUTF8(str) + 1; + var ret = _malloc(size); + if (ret) stringToUTF8(str, ret, size); + return ret; + }; + var __tzset_js = (timezone, daylight, tzname) => { + var currentYear = new Date().getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + HEAPU32[timezone >> 2] = stdTimezoneOffset * 60; + HEAP32[daylight >> 2] = Number(winterOffset != summerOffset); + function extractZone(date) { + var match = date.toTimeString().match(/\(([A-Za-z ]+)\)$/); + return match ? match[1] : 'GMT'; + } + var winterName = extractZone(winter); + var summerName = extractZone(summer); + var winterNamePtr = stringToNewUTF8(winterName); + var summerNamePtr = stringToNewUTF8(summerName); + if (summerOffset < winterOffset) { + HEAPU32[tzname >> 2] = winterNamePtr; + HEAPU32[(tzname + 4) >> 2] = summerNamePtr; + } else { + HEAPU32[tzname >> 2] = summerNamePtr; + HEAPU32[(tzname + 4) >> 2] = winterNamePtr; + } + }; + var _abort = () => { + abort(''); + }; + function _emscripten_date_now() { + return Date.now(); + } + var getHeapMax = () => 2147483648; + var _emscripten_get_heap_max = () => getHeapMax(); + var _emscripten_memcpy_big = (dest, src, num) => + HEAPU8.copyWithin(dest, src, src + num); + var growMemory = (size) => { + var b = wasmMemory.buffer; + var pages = (size - b.byteLength + 65535) >>> 16; + try { + wasmMemory.grow(pages); + updateMemoryViews(); + return 1; + } catch (e) {} + }; + var _emscripten_resize_heap = (requestedSize) => { + var oldSize = HEAPU8.length; + requestedSize >>>= 0; + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + return false; + } + var alignUp = (x, multiple) => + x + ((multiple - (x % multiple)) % multiple); + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); + overGrownHeapSize = Math.min( + overGrownHeapSize, + requestedSize + 100663296 + ); + var newSize = Math.min( + maxHeapSize, + alignUp(Math.max(requestedSize, overGrownHeapSize), 65536) + ); + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + return false; + }; + var runtimeKeepalivePush = () => { + runtimeKeepaliveCounter += 1; + }; + var runtimeKeepalivePop = () => { + runtimeKeepaliveCounter -= 1; + }; + var safeSetTimeout = (func, timeout) => { + runtimeKeepalivePush(); + return setTimeout(() => { + runtimeKeepalivePop(); + callUserCallback(func); + }, timeout); + }; + var _emscripten_sleep = function (ms) { + return Asyncify.handleSleep((wakeUp) => safeSetTimeout(wakeUp, ms)); + }; + Module['_emscripten_sleep'] = _emscripten_sleep; + _emscripten_sleep.isAsync = true; + var ENV = PHPLoader.ENV || {}; + var getExecutableName = () => thisProgram || './this.program'; + var getEnvStrings = () => { + if (!getEnvStrings.strings) { + var lang = + ( + (typeof navigator == 'object' && + navigator.languages && + navigator.languages[0]) || + 'C' + ).replace('-', '_') + '.UTF-8'; + var env = { + USER: 'web_user', + LOGNAME: 'web_user', + PATH: '/', + PWD: '/', + HOME: '/home/web_user', + LANG: lang, + _: getExecutableName(), + }; + for (var x in ENV) { + if (ENV[x] === undefined) delete env[x]; + else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(`${x}=${env[x]}`); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; + }; + var stringToAscii = (str, buffer) => { + for (var i = 0; i < str.length; ++i) { + HEAP8[buffer++ >> 0] = str.charCodeAt(i); + } + HEAP8[buffer >> 0] = 0; + }; + var _environ_get = (__environ, environ_buf) => { + var bufSize = 0; + getEnvStrings().forEach(function (string, i) { + var ptr = environ_buf + bufSize; + HEAPU32[(__environ + i * 4) >> 2] = ptr; + stringToAscii(string, ptr); + bufSize += string.length + 1; + }); + return 0; + }; + var _environ_sizes_get = (penviron_count, penviron_buf_size) => { + var strings = getEnvStrings(); + HEAPU32[penviron_count >> 2] = strings.length; + var bufSize = 0; + strings.forEach(function (string) { + bufSize += string.length + 1; + }); + HEAPU32[penviron_buf_size >> 2] = bufSize; + return 0; + }; + function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + function _fd_fdstat_get(fd, pbuf) { + try { + var rightsBase = 0; + var rightsInheriting = 0; + var flags = 0; + { + var stream = SYSCALLS.getStreamFromFD(fd); + var type = stream.tty + ? 2 + : FS.isDir(stream.mode) + ? 3 + : FS.isLink(stream.mode) + ? 7 + : 4; + } + HEAP8[pbuf >> 0] = type; + HEAP16[(pbuf + 2) >> 1] = flags; + (tempI64 = [ + rightsBase >>> 0, + ((tempDouble = rightsBase), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / + 4294967296 + ) >>> 0 + : 0), + ]), + (HEAP32[(pbuf + 8) >> 2] = tempI64[0]), + (HEAP32[(pbuf + 12) >> 2] = tempI64[1]); + (tempI64 = [ + rightsInheriting >>> 0, + ((tempDouble = rightsInheriting), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / + 4294967296 + ) >>> 0 + : 0), + ]), + (HEAP32[(pbuf + 16) >> 2] = tempI64[0]), + (HEAP32[(pbuf + 20) >> 2] = tempI64[1]); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAPU32[iov >> 2]; + var len = HEAPU32[(iov + 4) >> 2]; + iov += 8; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + if (typeof offset !== 'undefined') { + offset += curr; + } + } + return ret; + }; + function _fd_read(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + function _fd_seek(fd, offset_low, offset_high, whence, newOffset) { + var offset = convertI32PairToI53Checked(offset_low, offset_high); + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + (tempI64 = [ + stream.position >>> 0, + ((tempDouble = stream.position), + +Math.abs(tempDouble) >= 1 + ? tempDouble > 0 + ? +Math.floor(tempDouble / 4294967296) >>> 0 + : ~~+Math.ceil( + (tempDouble - +(~~tempDouble >>> 0)) / + 4294967296 + ) >>> 0 + : 0), + ]), + (HEAP32[newOffset >> 2] = tempI64[0]), + (HEAP32[(newOffset + 4) >> 2] = tempI64[1]); + if (stream.getdents && offset === 0 && whence === 0) + stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAPU32[iov >> 2]; + var len = HEAPU32[(iov + 4) >> 2]; + iov += 8; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (typeof offset !== 'undefined') { + offset += curr; + } + } + return ret; + }; + function _fd_write(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + var _getaddrinfo = (node, service, hint, out) => { + var addr = 0; + var port = 0; + var flags = 0; + var family = 0; + var type = 0; + var proto = 0; + var ai; + function allocaddrinfo(family, type, proto, canon, addr, port) { + var sa, salen, ai; + var errno; + salen = family === 10 ? 28 : 16; + addr = family === 10 ? inetNtop6(addr) : inetNtop4(addr); + sa = _malloc(salen); + errno = writeSockaddr(sa, family, addr, port); + assert(!errno); + ai = _malloc(32); + HEAP32[(ai + 4) >> 2] = family; + HEAP32[(ai + 8) >> 2] = type; + HEAP32[(ai + 12) >> 2] = proto; + HEAPU32[(ai + 24) >> 2] = canon; + HEAPU32[(ai + 20) >> 2] = sa; + if (family === 10) { + HEAP32[(ai + 16) >> 2] = 28; + } else { + HEAP32[(ai + 16) >> 2] = 16; + } + HEAP32[(ai + 28) >> 2] = 0; + return ai; + } + if (hint) { + flags = HEAP32[hint >> 2]; + family = HEAP32[(hint + 4) >> 2]; + type = HEAP32[(hint + 8) >> 2]; + proto = HEAP32[(hint + 12) >> 2]; + } + if (type && !proto) { + proto = type === 2 ? 17 : 6; + } + if (!type && proto) { + type = proto === 17 ? 2 : 1; + } + if (proto === 0) { + proto = 6; + } + if (type === 0) { + type = 1; + } + if (!node && !service) { + return -2; + } + if (flags & ~(1 | 2 | 4 | 1024 | 8 | 16 | 32)) { + return -1; + } + if (hint !== 0 && HEAP32[hint >> 2] & 2 && !node) { + return -1; + } + if (flags & 32) { + return -2; + } + if (type !== 0 && type !== 1 && type !== 2) { + return -7; + } + if (family !== 0 && family !== 2 && family !== 10) { + return -6; + } + if (service) { + service = UTF8ToString(service); + port = parseInt(service, 10); + if (isNaN(port)) { + if (flags & 1024) { + return -2; + } + return -8; + } + } + if (!node) { + if (family === 0) { + family = 2; + } + if ((flags & 1) === 0) { + if (family === 2) { + addr = _htonl(2130706433); + } else { + addr = [0, 0, 0, 1]; + } + } + ai = allocaddrinfo(family, type, proto, null, addr, port); + HEAPU32[out >> 2] = ai; + return 0; + } + node = UTF8ToString(node); + addr = inetPton4(node); + if (addr !== null) { + if (family === 0 || family === 2) { + family = 2; + } else if (family === 10 && flags & 8) { + addr = [0, 0, _htonl(65535), addr]; + family = 10; + } else { + return -2; + } + } else { + addr = inetPton6(node); + if (addr !== null) { + if (family === 0 || family === 10) { + family = 10; + } else { + return -2; + } + } + } + if (addr != null) { + ai = allocaddrinfo(family, type, proto, node, addr, port); + HEAPU32[out >> 2] = ai; + return 0; + } + if (flags & 4) { + return -2; + } + node = DNS.lookup_name(node); + addr = inetPton4(node); + if (family === 0) { + family = 2; + } else if (family === 10) { + addr = [0, 0, _htonl(65535), addr]; + } + ai = allocaddrinfo(family, type, proto, null, addr, port); + HEAPU32[out >> 2] = ai; + return 0; + }; + var getHostByName = (name) => { + var ret = _malloc(20); + var nameBuf = stringToNewUTF8(name); + HEAPU32[ret >> 2] = nameBuf; + var aliasesBuf = _malloc(4); + HEAPU32[aliasesBuf >> 2] = 0; + HEAPU32[(ret + 4) >> 2] = aliasesBuf; + var afinet = 2; + HEAP32[(ret + 8) >> 2] = afinet; + HEAP32[(ret + 12) >> 2] = 4; + var addrListBuf = _malloc(12); + HEAPU32[addrListBuf >> 2] = addrListBuf + 8; + HEAPU32[(addrListBuf + 4) >> 2] = 0; + HEAP32[(addrListBuf + 8) >> 2] = inetPton4(DNS.lookup_name(name)); + HEAPU32[(ret + 16) >> 2] = addrListBuf; + return ret; + }; + var _gethostbyaddr = (addr, addrlen, type) => { + if (type !== 2) { + setErrNo(5); + return null; + } + addr = HEAP32[addr >> 2]; + var host = inetNtop4(addr); + var lookup = DNS.lookup_addr(host); + if (lookup) { + host = lookup; + } + return getHostByName(host); + }; + var _gethostbyname = (name) => getHostByName(UTF8ToString(name)); + var _gethostbyname_r = (name, ret, buf, buflen, out, err) => { + var data = _gethostbyname(name); + _memcpy(ret, data, 20); + _free(data); + HEAP32[err >> 2] = 0; + HEAPU32[out >> 2] = ret; + return 0; + }; + var _getloadavg = (loadavg, nelem) => { + var limit = Math.min(nelem, 3); + var doubleSize = 8; + for (var i = 0; i < limit; i++) { + HEAPF64[(loadavg + i * doubleSize) >> 3] = 0.1; + } + return limit; + }; + var _getnameinfo = (sa, salen, node, nodelen, serv, servlen, flags) => { + var info = readSockaddr(sa, salen); + if (info.errno) { + return -6; + } + var port = info.port; + var addr = info.addr; + var overflowed = false; + if (node && nodelen) { + var lookup; + if (flags & 1 || !(lookup = DNS.lookup_addr(addr))) { + if (flags & 8) { + return -2; + } + } else { + addr = lookup; + } + var numBytesWrittenExclNull = stringToUTF8(addr, node, nodelen); + if (numBytesWrittenExclNull + 1 >= nodelen) { + overflowed = true; + } + } + if (serv && servlen) { + port = '' + port; + var numBytesWrittenExclNull = stringToUTF8(port, serv, servlen); + if (numBytesWrittenExclNull + 1 >= servlen) { + overflowed = true; + } + } + if (overflowed) { + return -12; + } + return 0; + }; + var Protocols = { list: [], map: {} }; + var _setprotoent = (stayopen) => { + function allocprotoent(name, proto, aliases) { + var nameBuf = _malloc(name.length + 1); + stringToAscii(name, nameBuf); + var j = 0; + var length = aliases.length; + var aliasListBuf = _malloc((length + 1) * 4); + for (var i = 0; i < length; i++, j += 4) { + var alias = aliases[i]; + var aliasBuf = _malloc(alias.length + 1); + stringToAscii(alias, aliasBuf); + HEAPU32[(aliasListBuf + j) >> 2] = aliasBuf; + } + HEAPU32[(aliasListBuf + j) >> 2] = 0; + var pe = _malloc(12); + HEAPU32[pe >> 2] = nameBuf; + HEAPU32[(pe + 4) >> 2] = aliasListBuf; + HEAP32[(pe + 8) >> 2] = proto; + return pe; + } + var list = Protocols.list; + var map = Protocols.map; + if (list.length === 0) { + var entry = allocprotoent('tcp', 6, ['TCP']); + list.push(entry); + map['tcp'] = map['6'] = entry; + entry = allocprotoent('udp', 17, ['UDP']); + list.push(entry); + map['udp'] = map['17'] = entry; + } + _setprotoent.index = 0; + }; + var _getprotobyname = (name) => { + name = UTF8ToString(name); + _setprotoent(true); + var result = Protocols.map[name]; + return result; + }; + var _getprotobynumber = (number) => { + _setprotoent(true); + var result = Protocols.map[number]; + return result; + }; + var stringToUTF8OnStack = (str) => { + var size = lengthBytesUTF8(str) + 1; + var ret = stackAlloc(size); + stringToUTF8(str, ret, size); + return ret; + }; + var allocateUTF8OnStack = stringToUTF8OnStack; + var PHPWASM = { + init: function () { + FS.mkdir('/internal'); + FS.mkdir('/internal/shared'); + FS.mkdir('/internal/shared/preload'); + PHPWASM.EventEmitter = ENVIRONMENT_IS_NODE + ? require('events').EventEmitter + : class EventEmitter { + constructor() { + this.listeners = {}; + } + emit(eventName, data) { + if (this.listeners[eventName]) { + this.listeners[eventName].forEach( + (callback) => { + callback(data); + } + ); + } + } + once(eventName, callback) { + const self = this; + function removedCallback() { + callback(...arguments); + self.removeListener(eventName, removedCallback); + } + this.on(eventName, removedCallback); + } + removeAllListeners(eventName) { + if (eventName) { + delete this.listeners[eventName]; + } else { + this.listeners = {}; + } + } + removeListener(eventName, callback) { + if (this.listeners[eventName]) { + const idx = + this.listeners[eventName].indexOf(callback); + if (idx !== -1) { + this.listeners[eventName].splice(idx, 1); + } + } + } + }; + PHPWASM.child_proc_by_fd = {}; + PHPWASM.child_proc_by_pid = {}; + PHPWASM.input_devices = {}; + }, + getAllWebSockets: function (sock) { + const webSockets = new Set(); + if (sock.server) { + sock.server.clients.forEach((ws) => { + webSockets.add(ws); + }); + } + for (const peer of PHPWASM.getAllPeers(sock)) { + webSockets.add(peer.socket); + } + return Array.from(webSockets); + }, + getAllPeers: function (sock) { + const peers = new Set(); + if (sock.server) { + sock.pending + .filter((pending) => pending.peers) + .forEach((pending) => { + for (const peer of Object.values(pending.peers)) { + peers.add(peer); + } + }); + } + if (sock.peers) { + for (const peer of Object.values(sock.peers)) { + peers.add(peer); + } + } + return Array.from(peers); + }, + awaitData: function (ws) { + return PHPWASM.awaitEvent(ws, 'message'); + }, + awaitConnection: function (ws) { + if (ws.OPEN === ws.readyState) { + return [Promise.resolve(), PHPWASM.noop]; + } + return PHPWASM.awaitEvent(ws, 'open'); + }, + awaitClose: function (ws) { + if ([ws.CLOSING, ws.CLOSED].includes(ws.readyState)) { + return [Promise.resolve(), PHPWASM.noop]; + } + return PHPWASM.awaitEvent(ws, 'close'); + }, + awaitError: function (ws) { + if ([ws.CLOSING, ws.CLOSED].includes(ws.readyState)) { + return [Promise.resolve(), PHPWASM.noop]; + } + return PHPWASM.awaitEvent(ws, 'error'); + }, + awaitEvent: function (ws, event) { + let resolve; + const listener = () => { + resolve(); + }; + const promise = new Promise(function (_resolve) { + resolve = _resolve; + ws.once(event, listener); + }); + const cancel = () => { + ws.removeListener(event, listener); + setTimeout(resolve); + }; + return [promise, cancel]; + }, + noop: function () {}, + spawnProcess: function (command, args, options) { + if (Module['spawnProcess']) { + const spawnedPromise = Module['spawnProcess']( + command, + args, + options + ); + return Promise.resolve(spawnedPromise).then(function (spawned) { + if (!spawned || !spawned.on) { + throw new Error( + 'spawnProcess() must return an EventEmitter but returned a different type.' + ); + } + return spawned; + }); + } + if (ENVIRONMENT_IS_NODE) { + return require('child_process').spawn(command, args, { + ...options, + shell: true, + stdio: ['pipe', 'pipe', 'pipe'], + timeout: 100, + }); + } + const e = new Error( + 'popen(), proc_open() etc. are unsupported in the browser. Call php.setSpawnHandler() ' + + 'and provide a callback to handle spawning processes, or disable a popen(), proc_open() ' + + 'and similar functions via php.ini.' + ); + e.code = 'SPAWN_UNSUPPORTED'; + throw e; + }, + shutdownSocket: function (socketd, how) { + const sock = getSocketFromFD(socketd); + const peer = Object.values(sock.peers)[0]; + if (!peer) { + return -1; + } + try { + peer.socket.close(); + SOCKFS.websocket_sock_ops.removePeer(sock, peer); + return 0; + } catch (e) { + console.log('Socket shutdown error', e); + return -1; + } + }, + }; + function _js_create_input_device(deviceId) { + let dataBuffer = []; + let dataCallback; + const filename = 'proc_id_' + deviceId; + const device = FS.createDevice( + '/dev', + filename, + function () {}, + function (byte) { + try { + dataBuffer.push(byte); + if (dataCallback) { + dataCallback(new Uint8Array(dataBuffer)); + dataBuffer = []; + } + } catch (e) { + console.error(e); + throw e; + } + } + ); + const devicePath = '/dev/' + filename; + PHPWASM.input_devices[deviceId] = { + devicePath: devicePath, + onData: function (cb) { + dataCallback = cb; + dataBuffer.forEach(function (data) { + cb(data); + }); + dataBuffer.length = 0; + }, + }; + return allocateUTF8OnStack(devicePath); + } + function _js_fd_read(fd, iov, iovcnt, pnum) { + if (Asyncify.state === Asyncify.State.Normal) { + var returnCode; + var stream; + let num = 0; + try { + stream = SYSCALLS.getStreamFromFD(fd); + const num = doReadv(stream, iov, iovcnt); + HEAPU32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) { + throw e; + } + if ( + e.errno !== 6 || + !(stream?.fd in PHPWASM.child_proc_by_fd) + ) { + HEAPU32[pnum >> 2] = 0; + return returnCode; + } + } + } + return Asyncify.handleSleep(function (wakeUp) { + var retries = 0; + var interval = 50; + var timeout = 5e3; + var maxRetries = timeout / interval; + function poll() { + var returnCode; + var stream; + let num; + try { + stream = SYSCALLS.getStreamFromFD(fd); + num = doReadv(stream, iov, iovcnt); + returnCode = 0; + } catch (e) { + if ( + typeof FS == 'undefined' || + !(e.name === 'ErrnoError') + ) { + console.error(e); + throw e; + } + returnCode = e.errno; + } + const success = returnCode === 0; + const failure = + ++retries > maxRetries || + !(fd in PHPWASM.child_proc_by_fd) || + PHPWASM.child_proc_by_fd[fd]?.exited || + FS.isClosed(stream); + if (success) { + HEAPU32[pnum >> 2] = num; + wakeUp(0); + } else if (failure) { + HEAPU32[pnum >> 2] = 0; + wakeUp(returnCode === 6 ? 0 : returnCode); + } else { + setTimeout(poll, interval); + } + } + poll(); + }); + } + function _js_module_onMessage(data, bufPtr) { + if (typeof Asyncify === 'undefined') { + return; + } + if (Module['onMessage']) { + const dataStr = UTF8ToString(data); + return Asyncify.handleSleep((wakeUp) => { + Module['onMessage'](dataStr) + .then((response) => { + const responseBytes = + typeof response === 'string' + ? new TextEncoder().encode(response) + : response; + const responseSize = responseBytes.byteLength; + const responsePtr = _malloc(responseSize + 1); + HEAPU8.set(responseBytes, responsePtr); + HEAPU8[responsePtr + responseSize] = 0; + HEAPU8[bufPtr] = responsePtr; + HEAPU8[bufPtr + 1] = responsePtr >> 8; + HEAPU8[bufPtr + 2] = responsePtr >> 16; + HEAPU8[bufPtr + 3] = responsePtr >> 24; + wakeUp(responseSize); + }) + .catch((e) => { + console.error(e); + wakeUp(-1); + }); + }); + } + } + function _js_open_process( + command, + argsPtr, + argsLength, + descriptorsPtr, + descriptorsLength, + cwdPtr, + cwdLength, + envPtr, + envLength + ) { + if (!command) { + return 1; + } + const cmdstr = UTF8ToString(command); + if (!cmdstr.length) { + return 0; + } + let argsArray = []; + if (argsLength) { + for (var i = 0; i < argsLength; i++) { + const charPointer = argsPtr + i * 4; + argsArray.push(UTF8ToString(HEAPU32[charPointer >> 2])); + } + } + const cwdstr = cwdPtr ? UTF8ToString(cwdPtr) : null; + let envObject = null; + if (envLength) { + envObject = {}; + for (var i = 0; i < envLength; i++) { + const envPointer = envPtr + i * 4; + const envEntry = UTF8ToString(HEAPU32[envPointer >> 2]); + const splitAt = envEntry.indexOf('='); + if (splitAt === -1) { + continue; + } + const key = envEntry.substring(0, splitAt); + const value = envEntry.substring(splitAt + 1); + envObject[key] = value; + } + } + var std = {}; + for (var i = 0; i < descriptorsLength; i++) { + const descriptorPtr = HEAPU32[(descriptorsPtr + i * 4) >> 2]; + std[HEAPU32[descriptorPtr >> 2]] = { + child: HEAPU32[(descriptorPtr + 4) >> 2], + parent: HEAPU32[(descriptorPtr + 8) >> 2], + }; + } + return Asyncify.handleSleep(async (wakeUp) => { + let cp; + try { + const options = {}; + if (cwdstr !== null) { + options.cwd = cwdstr; + } + if (envObject !== null) { + options.env = envObject; + } + cp = PHPWASM.spawnProcess(cmdstr, argsArray, options); + if (cp instanceof Promise) { + cp = await cp; + } + } catch (e) { + if (e.code === 'SPAWN_UNSUPPORTED') { + wakeUp(1); + return; + } + console.error(e); + wakeUp(1); + throw e; + } + const ProcInfo = { + pid: cp.pid, + exited: false, + stdinFd: std[0]?.child, + stdinIsDevice: std[0]?.child in PHPWASM.input_devices, + stdoutChildFd: std[1]?.child, + stdoutParentFd: std[1]?.parent, + stderrChildFd: std[2]?.child, + stderrParentFd: std[2]?.parent, + stdout: new PHPWASM.EventEmitter(), + stderr: new PHPWASM.EventEmitter(), + }; + if (ProcInfo.stdoutChildFd) + PHPWASM.child_proc_by_fd[ProcInfo.stdoutChildFd] = ProcInfo; + if (ProcInfo.stderrChildFd) + PHPWASM.child_proc_by_fd[ProcInfo.stderrChildFd] = ProcInfo; + if (ProcInfo.stdoutParentFd) + PHPWASM.child_proc_by_fd[ProcInfo.stdoutParentFd] = ProcInfo; + if (ProcInfo.stderrParentFd) + PHPWASM.child_proc_by_fd[ProcInfo.stderrParentFd] = ProcInfo; + PHPWASM.child_proc_by_pid[ProcInfo.pid] = ProcInfo; + cp.on('exit', function (code) { + ProcInfo.exitCode = code; + ProcInfo.exited = true; + ProcInfo.stdout.emit('data'); + ProcInfo.stderr.emit('data'); + }); + if (ProcInfo.stdoutChildFd) { + const stdoutStream = SYSCALLS.getStreamFromFD( + ProcInfo.stdoutChildFd + ); + let stdoutAt = 0; + cp.stdout.on('data', function (data) { + ProcInfo.stdout.emit('data', data); + stdoutStream.stream_ops.write( + stdoutStream, + data, + 0, + data.length, + stdoutAt + ); + stdoutAt += data.length; + }); + } + if (ProcInfo.stderrChildFd) { + const stderrStream = SYSCALLS.getStreamFromFD( + ProcInfo.stderrChildFd + ); + let stderrAt = 0; + cp.stderr.on('data', function (data) { + ProcInfo.stderr.emit('data', data); + stderrStream.stream_ops.write( + stderrStream, + data, + 0, + data.length, + stderrAt + ); + stderrAt += data.length; + }); + } + try { + await new Promise((resolve, reject) => { + cp.on('spawn', resolve); + cp.on('error', reject); + }); + } catch (e) { + console.error(e); + wakeUp(1); + return; + } + if (ProcInfo.stdinIsDevice) { + PHPWASM.input_devices[ProcInfo.stdinFd].onData(function (data) { + if (!data) return; + const dataStr = new TextDecoder('utf-8').decode(data); + cp.stdin.write(dataStr); + }); + wakeUp(ProcInfo.pid); + return; + } + if (ProcInfo.stdinFd) { + const stdinStream = SYSCALLS.getStreamFromFD(ProcInfo.stdinFd); + if (stdinStream.node) { + const CHUNK_SIZE = 1024; + const buffer = new Uint8Array(CHUNK_SIZE); + let offset = 0; + while (true) { + const bytesRead = stdinStream.stream_ops.read( + stdinStream, + buffer, + 0, + CHUNK_SIZE, + offset + ); + if (bytesRead === null || bytesRead === 0) { + break; + } + try { + cp.stdin.write(buffer.subarray(0, bytesRead)); + } catch (e) { + console.error(e); + return 1; + } + if (bytesRead < CHUNK_SIZE) { + break; + } + offset += bytesRead; + } + wakeUp(ProcInfo.pid); + return; + } + } + wakeUp(ProcInfo.pid); + }); + } + function _js_popen_to_file(command, mode, exitCodePtr) { + if (!command) return 1; + const cmdstr = UTF8ToString(command); + if (!cmdstr.length) return 0; + const modestr = UTF8ToString(mode); + if (!modestr.length) return 0; + if (modestr === 'w') { + console.error('popen($cmd, "w") is not implemented yet'); + } + return Asyncify.handleSleep(async (wakeUp) => { + let cp; + try { + cp = PHPWASM.spawnProcess(cmdstr, []); + if (cp instanceof Promise) { + cp = await cp; + } + } catch (e) { + console.error(e); + if (e.code === 'SPAWN_UNSUPPORTED') { + return 1; + } + throw e; + } + const outByteArrays = []; + cp.stdout.on('data', function (data) { + outByteArrays.push(data); + }); + const outputPath = '/tmp/popen_output'; + cp.on('exit', function (exitCode) { + const outBytes = new Uint8Array( + outByteArrays.reduce((acc, curr) => acc + curr.length, 0) + ); + let offset = 0; + for (const byteArray of outByteArrays) { + outBytes.set(byteArray, offset); + offset += byteArray.length; + } + FS.writeFile(outputPath, outBytes); + HEAPU8[exitCodePtr] = exitCode; + wakeUp(allocateUTF8OnStack(outputPath)); + }); + }); + } + function _js_process_status(pid, exitCodePtr) { + if (!PHPWASM.child_proc_by_pid[pid]) { + return -1; + } + if (PHPWASM.child_proc_by_pid[pid].exited) { + HEAPU32[exitCodePtr >> 2] = PHPWASM.child_proc_by_pid[pid].exitCode; + return 1; + } + return 0; + } + function _js_waitpid(pid, exitCodePtr) { + if (!PHPWASM.child_proc_by_pid[pid]) { + return -1; + } + return Asyncify.handleSleep((wakeUp) => { + const poll = function () { + if (PHPWASM.child_proc_by_pid[pid]?.exited) { + HEAPU32[exitCodePtr >> 2] = + PHPWASM.child_proc_by_pid[pid].exitCode; + wakeUp(pid); + } else { + setTimeout(poll, 50); + } + }; + poll(); + }); + } + var arraySum = (array, index) => { + var sum = 0; + for (var i = 0; i <= index; sum += array[i++]) {} + return sum; + }; + var MONTH_DAYS_LEAP = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + var MONTH_DAYS_REGULAR = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + var addDays = (date, days) => { + var newDate = new Date(date.getTime()); + while (days > 0) { + var leap = isLeapYear(newDate.getFullYear()); + var currentMonth = newDate.getMonth(); + var daysInCurrentMonth = ( + leap ? MONTH_DAYS_LEAP : MONTH_DAYS_REGULAR + )[currentMonth]; + if (days > daysInCurrentMonth - newDate.getDate()) { + days -= daysInCurrentMonth - newDate.getDate() + 1; + newDate.setDate(1); + if (currentMonth < 11) { + newDate.setMonth(currentMonth + 1); + } else { + newDate.setMonth(0); + newDate.setFullYear(newDate.getFullYear() + 1); + } + } else { + newDate.setDate(newDate.getDate() + days); + return newDate; + } + } + return newDate; + }; + var writeArrayToMemory = (array, buffer) => { + HEAP8.set(array, buffer); + }; + var _strftime = (s, maxsize, format, tm) => { + var tm_zone = HEAP32[(tm + 40) >> 2]; + var date = { + tm_sec: HEAP32[tm >> 2], + tm_min: HEAP32[(tm + 4) >> 2], + tm_hour: HEAP32[(tm + 8) >> 2], + tm_mday: HEAP32[(tm + 12) >> 2], + tm_mon: HEAP32[(tm + 16) >> 2], + tm_year: HEAP32[(tm + 20) >> 2], + tm_wday: HEAP32[(tm + 24) >> 2], + tm_yday: HEAP32[(tm + 28) >> 2], + tm_isdst: HEAP32[(tm + 32) >> 2], + tm_gmtoff: HEAP32[(tm + 36) >> 2], + tm_zone: tm_zone ? UTF8ToString(tm_zone) : '', + }; + var pattern = UTF8ToString(format); + var EXPANSION_RULES_1 = { + '%c': '%a %b %d %H:%M:%S %Y', + '%D': '%m/%d/%y', + '%F': '%Y-%m-%d', + '%h': '%b', + '%r': '%I:%M:%S %p', + '%R': '%H:%M', + '%T': '%H:%M:%S', + '%x': '%m/%d/%y', + '%X': '%H:%M:%S', + '%Ec': '%c', + '%EC': '%C', + '%Ex': '%m/%d/%y', + '%EX': '%H:%M:%S', + '%Ey': '%y', + '%EY': '%Y', + '%Od': '%d', + '%Oe': '%e', + '%OH': '%H', + '%OI': '%I', + '%Om': '%m', + '%OM': '%M', + '%OS': '%S', + '%Ou': '%u', + '%OU': '%U', + '%OV': '%V', + '%Ow': '%w', + '%OW': '%W', + '%Oy': '%y', + }; + for (var rule in EXPANSION_RULES_1) { + pattern = pattern.replace( + new RegExp(rule, 'g'), + EXPANSION_RULES_1[rule] + ); + } + var WEEKDAYS = [ + 'Sunday', + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday', + 'Saturday', + ]; + var MONTHS = [ + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December', + ]; + function leadingSomething(value, digits, character) { + var str = typeof value == 'number' ? value.toString() : value || ''; + while (str.length < digits) { + str = character[0] + str; + } + return str; + } + function leadingNulls(value, digits) { + return leadingSomething(value, digits, '0'); + } + function compareByDay(date1, date2) { + function sgn(value) { + return value < 0 ? -1 : value > 0 ? 1 : 0; + } + var compare; + if ( + (compare = sgn(date1.getFullYear() - date2.getFullYear())) === 0 + ) { + if ( + (compare = sgn(date1.getMonth() - date2.getMonth())) === 0 + ) { + compare = sgn(date1.getDate() - date2.getDate()); + } + } + return compare; + } + function getFirstWeekStartDate(janFourth) { + switch (janFourth.getDay()) { + case 0: + return new Date(janFourth.getFullYear() - 1, 11, 29); + case 1: + return janFourth; + case 2: + return new Date(janFourth.getFullYear(), 0, 3); + case 3: + return new Date(janFourth.getFullYear(), 0, 2); + case 4: + return new Date(janFourth.getFullYear(), 0, 1); + case 5: + return new Date(janFourth.getFullYear() - 1, 11, 31); + case 6: + return new Date(janFourth.getFullYear() - 1, 11, 30); + } + } + function getWeekBasedYear(date) { + var thisDate = addDays( + new Date(date.tm_year + 1900, 0, 1), + date.tm_yday + ); + var janFourthThisYear = new Date(thisDate.getFullYear(), 0, 4); + var janFourthNextYear = new Date(thisDate.getFullYear() + 1, 0, 4); + var firstWeekStartThisYear = + getFirstWeekStartDate(janFourthThisYear); + var firstWeekStartNextYear = + getFirstWeekStartDate(janFourthNextYear); + if (compareByDay(firstWeekStartThisYear, thisDate) <= 0) { + if (compareByDay(firstWeekStartNextYear, thisDate) <= 0) { + return thisDate.getFullYear() + 1; + } + return thisDate.getFullYear(); + } + return thisDate.getFullYear() - 1; + } + var EXPANSION_RULES_2 = { + '%a': (date) => WEEKDAYS[date.tm_wday].substring(0, 3), + '%A': (date) => WEEKDAYS[date.tm_wday], + '%b': (date) => MONTHS[date.tm_mon].substring(0, 3), + '%B': (date) => MONTHS[date.tm_mon], + '%C': (date) => { + var year = date.tm_year + 1900; + return leadingNulls((year / 100) | 0, 2); + }, + '%d': (date) => leadingNulls(date.tm_mday, 2), + '%e': (date) => leadingSomething(date.tm_mday, 2, ' '), + '%g': (date) => getWeekBasedYear(date).toString().substring(2), + '%G': (date) => getWeekBasedYear(date), + '%H': (date) => leadingNulls(date.tm_hour, 2), + '%I': (date) => { + var twelveHour = date.tm_hour; + if (twelveHour == 0) twelveHour = 12; + else if (twelveHour > 12) twelveHour -= 12; + return leadingNulls(twelveHour, 2); + }, + '%j': (date) => + leadingNulls( + date.tm_mday + + arraySum( + isLeapYear(date.tm_year + 1900) + ? MONTH_DAYS_LEAP + : MONTH_DAYS_REGULAR, + date.tm_mon - 1 + ), + 3 + ), + '%m': (date) => leadingNulls(date.tm_mon + 1, 2), + '%M': (date) => leadingNulls(date.tm_min, 2), + '%n': () => '\n', + '%p': (date) => { + if (date.tm_hour >= 0 && date.tm_hour < 12) { + return 'AM'; + } + return 'PM'; + }, + '%S': (date) => leadingNulls(date.tm_sec, 2), + '%t': () => '\t', + '%u': (date) => date.tm_wday || 7, + '%U': (date) => { + var days = date.tm_yday + 7 - date.tm_wday; + return leadingNulls(Math.floor(days / 7), 2); + }, + '%V': (date) => { + var val = Math.floor( + (date.tm_yday + 7 - ((date.tm_wday + 6) % 7)) / 7 + ); + if ((date.tm_wday + 371 - date.tm_yday - 2) % 7 <= 2) { + val++; + } + if (!val) { + val = 52; + var dec31 = (date.tm_wday + 7 - date.tm_yday - 1) % 7; + if ( + dec31 == 4 || + (dec31 == 5 && isLeapYear((date.tm_year % 400) - 1)) + ) { + val++; + } + } else if (val == 53) { + var jan1 = (date.tm_wday + 371 - date.tm_yday) % 7; + if (jan1 != 4 && (jan1 != 3 || !isLeapYear(date.tm_year))) + val = 1; + } + return leadingNulls(val, 2); + }, + '%w': (date) => date.tm_wday, + '%W': (date) => { + var days = date.tm_yday + 7 - ((date.tm_wday + 6) % 7); + return leadingNulls(Math.floor(days / 7), 2); + }, + '%y': (date) => (date.tm_year + 1900).toString().substring(2), + '%Y': (date) => date.tm_year + 1900, + '%z': (date) => { + var off = date.tm_gmtoff; + var ahead = off >= 0; + off = Math.abs(off) / 60; + off = (off / 60) * 100 + (off % 60); + return (ahead ? '+' : '-') + String('0000' + off).slice(-4); + }, + '%Z': (date) => date.tm_zone, + '%%': () => '%', + }; + pattern = pattern.replace(/%%/g, '\0\0'); + for (var rule in EXPANSION_RULES_2) { + if (pattern.includes(rule)) { + pattern = pattern.replace( + new RegExp(rule, 'g'), + EXPANSION_RULES_2[rule](date) + ); + } + } + pattern = pattern.replace(/\0\0/g, '%'); + var bytes = intArrayFromString(pattern, false); + if (bytes.length > maxsize) { + return 0; + } + writeArrayToMemory(bytes, s); + return bytes.length - 1; + }; + var _strptime = (buf, format, tm) => { + var pattern = UTF8ToString(format); + var SPECIAL_CHARS = '\\!@#$^&*()+=-[]/{}|:<>?,.'; + for (var i = 0, ii = SPECIAL_CHARS.length; i < ii; ++i) { + pattern = pattern.replace( + new RegExp('\\' + SPECIAL_CHARS[i], 'g'), + '\\' + SPECIAL_CHARS[i] + ); + } + var EQUIVALENT_MATCHERS = { + '%A': '%a', + '%B': '%b', + '%c': '%a %b %d %H:%M:%S %Y', + '%D': '%m\\/%d\\/%y', + '%e': '%d', + '%F': '%Y-%m-%d', + '%h': '%b', + '%R': '%H\\:%M', + '%r': '%I\\:%M\\:%S\\s%p', + '%T': '%H\\:%M\\:%S', + '%x': '%m\\/%d\\/(?:%y|%Y)', + '%X': '%H\\:%M\\:%S', + }; + for (var matcher in EQUIVALENT_MATCHERS) { + pattern = pattern.replace(matcher, EQUIVALENT_MATCHERS[matcher]); + } + var DATE_PATTERNS = { + '%a': '(?:Sun(?:day)?)|(?:Mon(?:day)?)|(?:Tue(?:sday)?)|(?:Wed(?:nesday)?)|(?:Thu(?:rsday)?)|(?:Fri(?:day)?)|(?:Sat(?:urday)?)', + '%b': '(?:Jan(?:uary)?)|(?:Feb(?:ruary)?)|(?:Mar(?:ch)?)|(?:Apr(?:il)?)|May|(?:Jun(?:e)?)|(?:Jul(?:y)?)|(?:Aug(?:ust)?)|(?:Sep(?:tember)?)|(?:Oct(?:ober)?)|(?:Nov(?:ember)?)|(?:Dec(?:ember)?)', + '%C': '\\d\\d', + '%d': '0[1-9]|[1-9](?!\\d)|1\\d|2\\d|30|31', + '%H': '\\d(?!\\d)|[0,1]\\d|20|21|22|23', + '%I': '\\d(?!\\d)|0\\d|10|11|12', + '%j': '00[1-9]|0?[1-9](?!\\d)|0?[1-9]\\d(?!\\d)|[1,2]\\d\\d|3[0-6]\\d', + '%m': '0[1-9]|[1-9](?!\\d)|10|11|12', + '%M': '0\\d|\\d(?!\\d)|[1-5]\\d', + '%n': '\\s', + '%p': 'AM|am|PM|pm|A\\.M\\.|a\\.m\\.|P\\.M\\.|p\\.m\\.', + '%S': '0\\d|\\d(?!\\d)|[1-5]\\d|60', + '%U': '0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53', + '%W': '0\\d|\\d(?!\\d)|[1-4]\\d|50|51|52|53', + '%w': '[0-6]', + '%y': '\\d\\d', + '%Y': '\\d\\d\\d\\d', + '%%': '%', + '%t': '\\s', + }; + var MONTH_NUMBERS = { + JAN: 0, + FEB: 1, + MAR: 2, + APR: 3, + MAY: 4, + JUN: 5, + JUL: 6, + AUG: 7, + SEP: 8, + OCT: 9, + NOV: 10, + DEC: 11, + }; + var DAY_NUMBERS_SUN_FIRST = { + SUN: 0, + MON: 1, + TUE: 2, + WED: 3, + THU: 4, + FRI: 5, + SAT: 6, + }; + var DAY_NUMBERS_MON_FIRST = { + MON: 0, + TUE: 1, + WED: 2, + THU: 3, + FRI: 4, + SAT: 5, + SUN: 6, + }; + for (var datePattern in DATE_PATTERNS) { + pattern = pattern.replace( + datePattern, + '(' + datePattern + DATE_PATTERNS[datePattern] + ')' + ); + } + var capture = []; + for (var i = pattern.indexOf('%'); i >= 0; i = pattern.indexOf('%')) { + capture.push(pattern[i + 1]); + pattern = pattern.replace( + new RegExp('\\%' + pattern[i + 1], 'g'), + '' + ); + } + var matches = new RegExp('^' + pattern, 'i').exec(UTF8ToString(buf)); + function initDate() { + function fixup(value, min, max) { + return typeof value != 'number' || isNaN(value) + ? min + : value >= min + ? value <= max + ? value + : max + : min; + } + return { + year: fixup(HEAP32[(tm + 20) >> 2] + 1900, 1970, 9999), + month: fixup(HEAP32[(tm + 16) >> 2], 0, 11), + day: fixup(HEAP32[(tm + 12) >> 2], 1, 31), + hour: fixup(HEAP32[(tm + 8) >> 2], 0, 23), + min: fixup(HEAP32[(tm + 4) >> 2], 0, 59), + sec: fixup(HEAP32[tm >> 2], 0, 59), + }; + } + if (matches) { + var date = initDate(); + var value; + var getMatch = (symbol) => { + var pos = capture.indexOf(symbol); + if (pos >= 0) { + return matches[pos + 1]; + } + return; + }; + if ((value = getMatch('S'))) { + date.sec = jstoi_q(value); + } + if ((value = getMatch('M'))) { + date.min = jstoi_q(value); + } + if ((value = getMatch('H'))) { + date.hour = jstoi_q(value); + } else if ((value = getMatch('I'))) { + var hour = jstoi_q(value); + if ((value = getMatch('p'))) { + hour += value.toUpperCase()[0] === 'P' ? 12 : 0; + } + date.hour = hour; + } + if ((value = getMatch('Y'))) { + date.year = jstoi_q(value); + } else if ((value = getMatch('y'))) { + var year = jstoi_q(value); + if ((value = getMatch('C'))) { + year += jstoi_q(value) * 100; + } else { + year += year < 69 ? 2e3 : 1900; + } + date.year = year; + } + if ((value = getMatch('m'))) { + date.month = jstoi_q(value) - 1; + } else if ((value = getMatch('b'))) { + date.month = + MONTH_NUMBERS[value.substring(0, 3).toUpperCase()] || 0; + } + if ((value = getMatch('d'))) { + date.day = jstoi_q(value); + } else if ((value = getMatch('j'))) { + var day = jstoi_q(value); + var leapYear = isLeapYear(date.year); + for (var month = 0; month < 12; ++month) { + var daysUntilMonth = arraySum( + leapYear ? MONTH_DAYS_LEAP : MONTH_DAYS_REGULAR, + month - 1 + ); + if ( + day <= + daysUntilMonth + + (leapYear ? MONTH_DAYS_LEAP : MONTH_DAYS_REGULAR)[ + month + ] + ) { + date.day = day - daysUntilMonth; + } + } + } else if ((value = getMatch('a'))) { + var weekDay = value.substring(0, 3).toUpperCase(); + if ((value = getMatch('U'))) { + var weekDayNumber = DAY_NUMBERS_SUN_FIRST[weekDay]; + var weekNumber = jstoi_q(value); + var janFirst = new Date(date.year, 0, 1); + var endDate; + if (janFirst.getDay() === 0) { + endDate = addDays( + janFirst, + weekDayNumber + 7 * (weekNumber - 1) + ); + } else { + endDate = addDays( + janFirst, + 7 - + janFirst.getDay() + + weekDayNumber + + 7 * (weekNumber - 1) + ); + } + date.day = endDate.getDate(); + date.month = endDate.getMonth(); + } else if ((value = getMatch('W'))) { + var weekDayNumber = DAY_NUMBERS_MON_FIRST[weekDay]; + var weekNumber = jstoi_q(value); + var janFirst = new Date(date.year, 0, 1); + var endDate; + if (janFirst.getDay() === 1) { + endDate = addDays( + janFirst, + weekDayNumber + 7 * (weekNumber - 1) + ); + } else { + endDate = addDays( + janFirst, + 7 - + janFirst.getDay() + + 1 + + weekDayNumber + + 7 * (weekNumber - 1) + ); + } + date.day = endDate.getDate(); + date.month = endDate.getMonth(); + } + } + var fullDate = new Date( + date.year, + date.month, + date.day, + date.hour, + date.min, + date.sec, + 0 + ); + HEAP32[tm >> 2] = fullDate.getSeconds(); + HEAP32[(tm + 4) >> 2] = fullDate.getMinutes(); + HEAP32[(tm + 8) >> 2] = fullDate.getHours(); + HEAP32[(tm + 12) >> 2] = fullDate.getDate(); + HEAP32[(tm + 16) >> 2] = fullDate.getMonth(); + HEAP32[(tm + 20) >> 2] = fullDate.getFullYear() - 1900; + HEAP32[(tm + 24) >> 2] = fullDate.getDay(); + HEAP32[(tm + 28) >> 2] = + arraySum( + isLeapYear(fullDate.getFullYear()) + ? MONTH_DAYS_LEAP + : MONTH_DAYS_REGULAR, + fullDate.getMonth() - 1 + ) + + fullDate.getDate() - + 1; + HEAP32[(tm + 32) >> 2] = 0; + return buf + intArrayFromString(matches[0]).length - 1; + } + return 0; + }; + function _wasm_poll_socket(socketd, events, timeout) { + if (typeof Asyncify === 'undefined') { + return 0; + } + const POLLIN = 1; + const POLLPRI = 2; + const POLLOUT = 4; + const POLLERR = 8; + const POLLHUP = 16; + const POLLNVAL = 32; + return Asyncify.handleSleep((wakeUp) => { + const polls = []; + if (socketd in PHPWASM.child_proc_by_fd) { + const procInfo = PHPWASM.child_proc_by_fd[socketd]; + if (procInfo.exited) { + wakeUp(0); + return; + } + polls.push(PHPWASM.awaitEvent(procInfo.stdout, 'data')); + } else if (FS.isSocket(FS.getStream(socketd).node.mode)) { + const sock = getSocketFromFD(socketd); + if (!sock) { + wakeUp(0); + return; + } + const lookingFor = new Set(); + if (events & POLLIN || events & POLLPRI) { + if (sock.server) { + for (const client of sock.pending) { + if ((client.recv_queue || []).length > 0) { + wakeUp(1); + return; + } + } + } else if ((sock.recv_queue || []).length > 0) { + wakeUp(1); + return; + } + } + const webSockets = PHPWASM.getAllWebSockets(sock); + if (!webSockets.length) { + wakeUp(0); + return; + } + for (const ws of webSockets) { + if (events & POLLIN || events & POLLPRI) { + polls.push(PHPWASM.awaitData(ws)); + lookingFor.add('POLLIN'); + } + if (events & POLLOUT) { + polls.push(PHPWASM.awaitConnection(ws)); + lookingFor.add('POLLOUT'); + } + if (events & POLLHUP) { + polls.push(PHPWASM.awaitClose(ws)); + lookingFor.add('POLLHUP'); + } + if (events & POLLERR || events & POLLNVAL) { + polls.push(PHPWASM.awaitError(ws)); + lookingFor.add('POLLERR'); + } + } + } else { + setTimeout(function () { + wakeUp(1); + }, timeout); + return; + } + if (polls.length === 0) { + console.warn( + 'Unsupported poll event ' + + events + + ', defaulting to setTimeout().' + ); + setTimeout(function () { + wakeUp(0); + }, timeout); + return; + } + const promises = polls.map(([promise]) => promise); + const clearPolling = () => polls.forEach(([, clear]) => clear()); + let awaken = false; + let timeoutId; + Promise.race(promises).then(function (results) { + if (!awaken) { + awaken = true; + wakeUp(1); + if (timeoutId) { + clearTimeout(timeoutId); + } + clearPolling(); + } + }); + if (timeout !== -1) { + timeoutId = setTimeout(function () { + if (!awaken) { + awaken = true; + wakeUp(0); + clearPolling(); + } + }, timeout); + } + }); + } + function _wasm_setsockopt( + socketd, + level, + optionName, + optionValuePtr, + optionLen + ) { + const optionValue = HEAPU8[optionValuePtr]; + const SOL_SOCKET = 1; + const SO_KEEPALIVE = 9; + const IPPROTO_TCP = 6; + const TCP_NODELAY = 1; + const isSupported = + (level === SOL_SOCKET && optionName === SO_KEEPALIVE) || + (level === IPPROTO_TCP && optionName === TCP_NODELAY); + if (!isSupported) { + console.warn( + `Unsupported socket option: ${level}, ${optionName}, ${optionValue}` + ); + return -1; + } + const ws = PHPWASM.getAllWebSockets(socketd)[0]; + if (!ws) { + return -1; + } + ws.setSocketOpt(level, optionName, optionValuePtr); + return 0; + } + function runAndAbortIfError(func) { + try { + return func(); + } catch (e) { + abort(e); + } + } + var Asyncify = { + instrumentWasmImports: function (imports) { + var importPatterns = [ + /^_dlopen_js$/, + /^invoke_i$/, + /^invoke_ii$/, + /^invoke_iii$/, + /^invoke_iiii$/, + /^invoke_iiiii$/, + /^invoke_iiiiii$/, + /^invoke_iiiiiii$/, + /^invoke_iiiiiiii$/, + /^invoke_iiiiiiiiii$/, + /^invoke_v$/, + /^invoke_vi$/, + /^invoke_vii$/, + /^invoke_viidii$/, + /^invoke_viii$/, + /^invoke_viiii$/, + /^invoke_viiiii$/, + /^invoke_viiiiii$/, + /^invoke_viiiiiii$/, + /^invoke_viiiiiiiii$/, + /^js_open_process$/, + /^js_popen_to_file$/, + /^js_fd_read$/, + /^js_module_onMessage$/, + /^js_waitpid$/, + /^wasm_poll_socket$/, + /^wasm_shutdown$/, + /^fd_sync$/, + /^__wasi_fd_sync$/, + /^__asyncjs__.*$/, + /^emscripten_promise_await$/, + /^emscripten_idb_load$/, + /^emscripten_idb_store$/, + /^emscripten_idb_delete$/, + /^emscripten_idb_exists$/, + /^emscripten_idb_load_blob$/, + /^emscripten_idb_store_blob$/, + /^emscripten_sleep$/, + /^emscripten_wget_data$/, + /^emscripten_scan_registers$/, + /^emscripten_lazy_load_code$/, + /^_load_secondary_module$/, + /^emscripten_fiber_swap$/, + /^SDL_Delay$/, + ]; + for (var x in imports) { + (function (x) { + var original = imports[x]; + var sig = original.sig; + if (typeof original == 'function') { + var isAsyncifyImport = + original.isAsync || + importPatterns.some( + (pattern) => !!x.match(pattern) + ); + } + })(x); + } + }, + instrumentWasmExports: function (exports) { + var ret = {}; + for (var x in exports) { + (function (x) { + var original = exports[x]; + if (typeof original == 'function') { + ret[x] = function () { + Asyncify.exportCallStack.push(x); + try { + return original.apply(null, arguments); + } finally { + if (!ABORT) { + var y = Asyncify.exportCallStack.pop(); + assert(y === x); + Asyncify.maybeStopUnwind(); + } + } + }; + } else { + ret[x] = original; + } + })(x); + } + return ret; + }, + State: { Normal: 0, Unwinding: 1, Rewinding: 2, Disabled: 3 }, + state: 0, + StackSize: 4096, + currData: null, + handleSleepReturnValue: 0, + exportCallStack: [], + callStackNameToId: {}, + callStackIdToName: {}, + callStackId: 0, + asyncPromiseHandlers: null, + sleepCallbacks: [], + getCallStackId: function (funcName) { + var id = Asyncify.callStackNameToId[funcName]; + if (id === undefined) { + id = Asyncify.callStackId++; + Asyncify.callStackNameToId[funcName] = id; + Asyncify.callStackIdToName[id] = funcName; + } + return id; + }, + maybeStopUnwind: function () { + if ( + Asyncify.currData && + Asyncify.state === Asyncify.State.Unwinding && + Asyncify.exportCallStack.length === 0 + ) { + Asyncify.state = Asyncify.State.Normal; + runtimeKeepalivePush(); + runAndAbortIfError(_asyncify_stop_unwind); + if (typeof Fibers != 'undefined') { + Fibers.trampoline(); + } + } + }, + whenDone: function () { + return new Promise((resolve, reject) => { + Asyncify.asyncPromiseHandlers = { + resolve: resolve, + reject: reject, + }; + }); + }, + allocateData: function () { + var ptr = _malloc(12 + Asyncify.StackSize); + Asyncify.setDataHeader(ptr, ptr + 12, Asyncify.StackSize); + Asyncify.setDataRewindFunc(ptr); + return ptr; + }, + setDataHeader: function (ptr, stack, stackSize) { + HEAP32[ptr >> 2] = stack; + HEAP32[(ptr + 4) >> 2] = stack + stackSize; + }, + setDataRewindFunc: function (ptr) { + var bottomOfCallStack = Asyncify.exportCallStack[0]; + var rewindId = Asyncify.getCallStackId(bottomOfCallStack); + HEAP32[(ptr + 8) >> 2] = rewindId; + }, + getDataRewindFunc: function (ptr) { + var id = HEAP32[(ptr + 8) >> 2]; + var name = Asyncify.callStackIdToName[id]; + var func = Module['asm'][name]; + return func; + }, + doRewind: function (ptr) { + var start = Asyncify.getDataRewindFunc(ptr); + runtimeKeepalivePop(); + return start(); + }, + handleSleep: function (startAsync) { + if (ABORT) return; + if (Asyncify.state === Asyncify.State.Normal) { + var reachedCallback = false; + var reachedAfterCallback = false; + startAsync((handleSleepReturnValue = 0) => { + if (ABORT) return; + Asyncify.handleSleepReturnValue = handleSleepReturnValue; + reachedCallback = true; + if (!reachedAfterCallback) { + return; + } + Asyncify.state = Asyncify.State.Rewinding; + runAndAbortIfError(() => + _asyncify_start_rewind(Asyncify.currData) + ); + if ( + typeof Browser != 'undefined' && + Browser.mainLoop.func + ) { + Browser.mainLoop.resume(); + } + var asyncWasmReturnValue, + isError = false; + try { + asyncWasmReturnValue = Asyncify.doRewind( + Asyncify.currData + ); + } catch (err) { + asyncWasmReturnValue = err; + isError = true; + } + var handled = false; + if (!Asyncify.currData) { + var asyncPromiseHandlers = + Asyncify.asyncPromiseHandlers; + if (asyncPromiseHandlers) { + Asyncify.asyncPromiseHandlers = null; + (isError + ? asyncPromiseHandlers.reject + : asyncPromiseHandlers.resolve)( + asyncWasmReturnValue + ); + handled = true; + } + } + if (isError && !handled) { + throw asyncWasmReturnValue; + } + }); + reachedAfterCallback = true; + if (!reachedCallback) { + Asyncify.state = Asyncify.State.Unwinding; + Asyncify.currData = Asyncify.allocateData(); + if ( + typeof Browser != 'undefined' && + Browser.mainLoop.func + ) { + Browser.mainLoop.pause(); + } + runAndAbortIfError(() => + _asyncify_start_unwind(Asyncify.currData) + ); + } + } else if (Asyncify.state === Asyncify.State.Rewinding) { + Asyncify.state = Asyncify.State.Normal; + runAndAbortIfError(_asyncify_stop_rewind); + _free(Asyncify.currData); + Asyncify.currData = null; + Asyncify.sleepCallbacks.forEach((func) => + callUserCallback(func) + ); + } else { + abort(`invalid state: ${Asyncify.state}`); + } + return Asyncify.handleSleepReturnValue; + }, + handleAsync: function (startAsync) { + return Asyncify.handleSleep((wakeUp) => { + startAsync().then(wakeUp); + }); + }, + }; + function getCFunc(ident) { + var func = Module['_' + ident]; + return func; + } + var ccall = function (ident, returnType, argTypes, args, opts) { + var toC = { + string: (str) => { + var ret = 0; + if (str !== null && str !== undefined && str !== 0) { + ret = stringToUTF8OnStack(str); + } + return ret; + }, + array: (arr) => { + var ret = stackAlloc(arr.length); + writeArrayToMemory(arr, ret); + return ret; + }, + }; + function convertReturnValue(ret) { + if (returnType === 'string') { + return UTF8ToString(ret); + } + if (returnType === 'boolean') return Boolean(ret); + return ret; + } + var func = getCFunc(ident); + var cArgs = []; + var stack = 0; + if (args) { + for (var i = 0; i < args.length; i++) { + var converter = toC[argTypes[i]]; + if (converter) { + if (stack === 0) stack = stackSave(); + cArgs[i] = converter(args[i]); + } else { + cArgs[i] = args[i]; + } + } + } + var previousAsync = Asyncify.currData; + var ret = func.apply(null, cArgs); + function onDone(ret) { + runtimeKeepalivePop(); + if (stack !== 0) stackRestore(stack); + return convertReturnValue(ret); + } + var asyncMode = opts && opts.async; + runtimeKeepalivePush(); + if (Asyncify.currData != previousAsync) { + return Asyncify.whenDone().then(onDone); + } + ret = onDone(ret); + if (asyncMode) return Promise.resolve(ret); + return ret; + }; + var FSNode = function (parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; + }; + var readMode = 292 | 73; + var writeMode = 146; + Object.defineProperties(FSNode.prototype, { + read: { + get: function () { + return (this.mode & readMode) === readMode; + }, + set: function (val) { + val ? (this.mode |= readMode) : (this.mode &= ~readMode); + }, + }, + write: { + get: function () { + return (this.mode & writeMode) === writeMode; + }, + set: function (val) { + val ? (this.mode |= writeMode) : (this.mode &= ~writeMode); + }, + }, + isFolder: { + get: function () { + return FS.isDir(this.mode); + }, + }, + isDevice: { + get: function () { + return FS.isChrdev(this.mode); + }, + }, + }); + FS.FSNode = FSNode; + FS.createPreloadedFile = FS_createPreloadedFile; + FS.staticInit(); + Module['FS_createPath'] = FS.createPath; + Module['FS_createDataFile'] = FS.createDataFile; + Module['FS_createPreloadedFile'] = FS.createPreloadedFile; + Module['FS_unlink'] = FS.unlink; + Module['FS_createLazyFile'] = FS.createLazyFile; + Module['FS_createDevice'] = FS.createDevice; + ERRNO_CODES = { + EPERM: 63, + ENOENT: 44, + ESRCH: 71, + EINTR: 27, + EIO: 29, + ENXIO: 60, + E2BIG: 1, + ENOEXEC: 45, + EBADF: 8, + ECHILD: 12, + EAGAIN: 6, + EWOULDBLOCK: 6, + ENOMEM: 48, + EACCES: 2, + EFAULT: 21, + ENOTBLK: 105, + EBUSY: 10, + EEXIST: 20, + EXDEV: 75, + ENODEV: 43, + ENOTDIR: 54, + EISDIR: 31, + EINVAL: 28, + ENFILE: 41, + EMFILE: 33, + ENOTTY: 59, + ETXTBSY: 74, + EFBIG: 22, + ENOSPC: 51, + ESPIPE: 70, + EROFS: 69, + EMLINK: 34, + EPIPE: 64, + EDOM: 18, + ERANGE: 68, + ENOMSG: 49, + EIDRM: 24, + ECHRNG: 106, + EL2NSYNC: 156, + EL3HLT: 107, + EL3RST: 108, + ELNRNG: 109, + EUNATCH: 110, + ENOCSI: 111, + EL2HLT: 112, + EDEADLK: 16, + ENOLCK: 46, + EBADE: 113, + EBADR: 114, + EXFULL: 115, + ENOANO: 104, + EBADRQC: 103, + EBADSLT: 102, + EDEADLOCK: 16, + EBFONT: 101, + ENOSTR: 100, + ENODATA: 116, + ETIME: 117, + ENOSR: 118, + ENONET: 119, + ENOPKG: 120, + EREMOTE: 121, + ENOLINK: 47, + EADV: 122, + ESRMNT: 123, + ECOMM: 124, + EPROTO: 65, + EMULTIHOP: 36, + EDOTDOT: 125, + EBADMSG: 9, + ENOTUNIQ: 126, + EBADFD: 127, + EREMCHG: 128, + ELIBACC: 129, + ELIBBAD: 130, + ELIBSCN: 131, + ELIBMAX: 132, + ELIBEXEC: 133, + ENOSYS: 52, + ENOTEMPTY: 55, + ENAMETOOLONG: 37, + ELOOP: 32, + EOPNOTSUPP: 138, + EPFNOSUPPORT: 139, + ECONNRESET: 15, + ENOBUFS: 42, + EAFNOSUPPORT: 5, + EPROTOTYPE: 67, + ENOTSOCK: 57, + ENOPROTOOPT: 50, + ESHUTDOWN: 140, + ECONNREFUSED: 14, + EADDRINUSE: 3, + ECONNABORTED: 13, + ENETUNREACH: 40, + ENETDOWN: 38, + ETIMEDOUT: 73, + EHOSTDOWN: 142, + EHOSTUNREACH: 23, + EINPROGRESS: 26, + EALREADY: 7, + EDESTADDRREQ: 17, + EMSGSIZE: 35, + EPROTONOSUPPORT: 66, + ESOCKTNOSUPPORT: 137, + EADDRNOTAVAIL: 4, + ENETRESET: 39, + EISCONN: 30, + ENOTCONN: 53, + ETOOMANYREFS: 141, + EUSERS: 136, + EDQUOT: 19, + ESTALE: 72, + ENOTSUP: 138, + ENOMEDIUM: 148, + EILSEQ: 25, + EOVERFLOW: 61, + ECANCELED: 11, + ENOTRECOVERABLE: 56, + EOWNERDEAD: 62, + ESTRPIPE: 135, + }; + PHPWASM.init(); + var wasmImports = { + Ma: _SharpYuvConvert, + Na: _SharpYuvGetConversionMatrix, + Oa: _SharpYuvInit, + z: ___assert_fail, + la: ___call_sighandler, + aa: ___syscall_accept4, + $: ___syscall_bind, + Ba: ___syscall_chdir, + H: ___syscall_chmod, + _: ___syscall_connect, + Aa: ___syscall_dup, + za: ___syscall_dup3, + Ca: ___syscall_faccessat, + Ua: ___syscall_fallocate, + wa: ___syscall_fchmod, + va: ___syscall_fchown32, + G: ___syscall_fchownat, + m: ___syscall_fcntl64, + ua: ___syscall_fdatasync, + ta: ___syscall_fstat64, + T: ___syscall_ftruncate64, + pa: ___syscall_getcwd, + ka: ___syscall_getdents64, + Z: ___syscall_getpeername, + Y: ___syscall_getsockname, + X: ___syscall_getsockopt, + J: ___syscall_ioctl, + W: ___syscall_listen, + qa: ___syscall_lstat64, + oa: ___syscall_mkdirat, + ra: ___syscall_newfstatat, + u: ___syscall_openat, + na: ___syscall_pipe, + ma: ___syscall_poll, + ja: ___syscall_readlinkat, + V: ___syscall_recvfrom, + ia: ___syscall_renameat, + E: ___syscall_rmdir, + U: ___syscall_sendto, + C: ___syscall_socket, + sa: ___syscall_stat64, + ha: ___syscall_statfs64, + ga: ___syscall_symlink, + w: ___syscall_unlinkat, + da: ___syscall_utimensat, + xa: __emscripten_get_now_is_monotonic, + ba: __emscripten_throw_longjmp, + Xa: __gmtime_js, + Ya: __localtime_js, + Za: __mktime_js, + Va: __mmap_js, + Wa: __munmap_js, + D: __setitimer_js, + ea: __tzset_js, + f: _abort, + x: _emscripten_date_now, + fa: _emscripten_get_heap_max, + r: _emscripten_get_now, + ya: _emscripten_memcpy_big, + ca: _emscripten_resize_heap, + L: _emscripten_sleep, + Ea: _environ_get, + Fa: _environ_sizes_get, + p: _exit, + q: _fd_close, + F: _fd_fdstat_get, + I: _fd_read, + S: _fd_seek, + y: _fd_write, + Ta: _getaddrinfo, + P: _gethostbyaddr, + Q: _gethostbyname_r, + Qa: _getloadavg, + O: _getnameinfo, + Sa: _getprotobyname, + Ra: _getprotobynumber, + l: invoke_i, + c: invoke_ii, + g: invoke_iii, + e: invoke_iiii, + i: invoke_iiiii, + t: invoke_iiiiii, + v: invoke_iiiiiii, + La: invoke_iiiiiiii, + R: invoke_iiiiiiiiii, + d: invoke_v, + a: invoke_vi, + b: invoke_vii, + B: invoke_viidii, + h: invoke_viii, + j: invoke_viiii, + n: invoke_viiiii, + k: invoke_viiiiii, + A: invoke_viiiiiiiii, + N: _js_create_input_device, + Ha: _js_fd_read, + Ga: _js_module_onMessage, + M: _js_open_process, + Ia: _js_popen_to_file, + Ja: _js_process_status, + Ka: _js_waitpid, + Da: _proc_exit, + K: _strftime, + Pa: _strptime, + s: _wasm_poll_socket, + o: _wasm_setsockopt, + }; + var asm = createWasm(); + var ___wasm_call_ctors = function () { + return (___wasm_call_ctors = Module['asm']['$a']).apply( + null, + arguments + ); + }; + var _free = function () { + return (_free = Module['asm']['ab']).apply(null, arguments); + }; + var _memcpy = function () { + return (_memcpy = Module['asm']['bb']).apply(null, arguments); + }; + var _malloc = function () { + return (_malloc = Module['asm']['db']).apply(null, arguments); + }; + var setTempRet0 = function () { + return (setTempRet0 = Module['asm']['eb']).apply(null, arguments); + }; + var ___errno_location = function () { + return (___errno_location = Module['asm']['fb']).apply(null, arguments); + }; + var _wasm_read = (Module['_wasm_read'] = function () { + return (_wasm_read = Module['_wasm_read'] = Module['asm']['gb']).apply( + null, + arguments + ); + }); + var _fflush = (Module['_fflush'] = function () { + return (_fflush = Module['_fflush'] = Module['asm']['hb']).apply( + null, + arguments + ); + }); + var _wasm_popen = (Module['_wasm_popen'] = function () { + return (_wasm_popen = Module['_wasm_popen'] = + Module['asm']['ib']).apply(null, arguments); + }); + var _wasm_php_exec = (Module['_wasm_php_exec'] = function () { + return (_wasm_php_exec = Module['_wasm_php_exec'] = + Module['asm']['jb']).apply(null, arguments); + }); + var _php_pollfd_for = (Module['_php_pollfd_for'] = function () { + return (_php_pollfd_for = Module['_php_pollfd_for'] = + Module['asm']['kb']).apply(null, arguments); + }); + var _htons = function () { + return (_htons = Module['asm']['lb']).apply(null, arguments); + }; + var _ntohs = function () { + return (_ntohs = Module['asm']['mb']).apply(null, arguments); + }; + var _htonl = function () { + return (_htonl = Module['asm']['nb']).apply(null, arguments); + }; + var _wasm_sleep = (Module['_wasm_sleep'] = function () { + return (_wasm_sleep = Module['_wasm_sleep'] = + Module['asm']['ob']).apply(null, arguments); + }); + var ___wrap_select = (Module['___wrap_select'] = function () { + return (___wrap_select = Module['___wrap_select'] = + Module['asm']['pb']).apply(null, arguments); + }); + var _wasm_set_sapi_name = (Module['_wasm_set_sapi_name'] = function () { + return (_wasm_set_sapi_name = Module['_wasm_set_sapi_name'] = + Module['asm']['qb']).apply(null, arguments); + }); + var _wasm_set_phpini_path = (Module['_wasm_set_phpini_path'] = function () { + return (_wasm_set_phpini_path = Module['_wasm_set_phpini_path'] = + Module['asm']['rb']).apply(null, arguments); + }); + var _wasm_add_SERVER_entry = (Module['_wasm_add_SERVER_entry'] = + function () { + return (_wasm_add_SERVER_entry = Module['_wasm_add_SERVER_entry'] = + Module['asm']['sb']).apply(null, arguments); + }); + var _wasm_add_ENV_entry = (Module['_wasm_add_ENV_entry'] = function () { + return (_wasm_add_ENV_entry = Module['_wasm_add_ENV_entry'] = + Module['asm']['tb']).apply(null, arguments); + }); + var _wasm_set_query_string = (Module['_wasm_set_query_string'] = + function () { + return (_wasm_set_query_string = Module['_wasm_set_query_string'] = + Module['asm']['ub']).apply(null, arguments); + }); + var _wasm_set_path_translated = (Module['_wasm_set_path_translated'] = + function () { + return (_wasm_set_path_translated = Module[ + '_wasm_set_path_translated' + ] = + Module['asm']['vb']).apply(null, arguments); + }); + var _wasm_set_skip_shebang = (Module['_wasm_set_skip_shebang'] = + function () { + return (_wasm_set_skip_shebang = Module['_wasm_set_skip_shebang'] = + Module['asm']['wb']).apply(null, arguments); + }); + var _wasm_set_request_uri = (Module['_wasm_set_request_uri'] = function () { + return (_wasm_set_request_uri = Module['_wasm_set_request_uri'] = + Module['asm']['xb']).apply(null, arguments); + }); + var _wasm_set_request_method = (Module['_wasm_set_request_method'] = + function () { + return (_wasm_set_request_method = Module[ + '_wasm_set_request_method' + ] = + Module['asm']['yb']).apply(null, arguments); + }); + var _wasm_set_request_host = (Module['_wasm_set_request_host'] = + function () { + return (_wasm_set_request_host = Module['_wasm_set_request_host'] = + Module['asm']['zb']).apply(null, arguments); + }); + var _wasm_set_content_type = (Module['_wasm_set_content_type'] = + function () { + return (_wasm_set_content_type = Module['_wasm_set_content_type'] = + Module['asm']['Ab']).apply(null, arguments); + }); + var _wasm_set_request_body = (Module['_wasm_set_request_body'] = + function () { + return (_wasm_set_request_body = Module['_wasm_set_request_body'] = + Module['asm']['Bb']).apply(null, arguments); + }); + var _wasm_set_content_length = (Module['_wasm_set_content_length'] = + function () { + return (_wasm_set_content_length = Module[ + '_wasm_set_content_length' + ] = + Module['asm']['Cb']).apply(null, arguments); + }); + var _wasm_set_cookies = (Module['_wasm_set_cookies'] = function () { + return (_wasm_set_cookies = Module['_wasm_set_cookies'] = + Module['asm']['Db']).apply(null, arguments); + }); + var _wasm_set_request_port = (Module['_wasm_set_request_port'] = + function () { + return (_wasm_set_request_port = Module['_wasm_set_request_port'] = + Module['asm']['Eb']).apply(null, arguments); + }); + var _wasm_sapi_request_shutdown = (Module['_wasm_sapi_request_shutdown'] = + function () { + return (_wasm_sapi_request_shutdown = Module[ + '_wasm_sapi_request_shutdown' + ] = + Module['asm']['Fb']).apply(null, arguments); + }); + var _wasm_sapi_handle_request = (Module['_wasm_sapi_handle_request'] = + function () { + return (_wasm_sapi_handle_request = Module[ + '_wasm_sapi_handle_request' + ] = + Module['asm']['Gb']).apply(null, arguments); + }); + var _php_wasm_init = (Module['_php_wasm_init'] = function () { + return (_php_wasm_init = Module['_php_wasm_init'] = + Module['asm']['Hb']).apply(null, arguments); + }); + var ___funcs_on_exit = function () { + return (___funcs_on_exit = Module['asm']['Ib']).apply(null, arguments); + }; + var _emscripten_builtin_memalign = function () { + return (_emscripten_builtin_memalign = Module['asm']['Jb']).apply( + null, + arguments + ); + }; + var __emscripten_timeout = function () { + return (__emscripten_timeout = Module['asm']['Kb']).apply( + null, + arguments + ); + }; + var _setThrew = function () { + return (_setThrew = Module['asm']['Lb']).apply(null, arguments); + }; + var _emscripten_stack_set_limits = function () { + return (_emscripten_stack_set_limits = + Module['asm']['emscripten_stack_set_limits']).apply( + null, + arguments + ); + }; + var _emscripten_stack_get_base = function () { + return (_emscripten_stack_get_base = + Module['asm']['emscripten_stack_get_base']).apply(null, arguments); + }; + var _emscripten_stack_get_end = function () { + return (_emscripten_stack_get_end = + Module['asm']['emscripten_stack_get_end']).apply(null, arguments); + }; + var stackSave = function () { + return (stackSave = Module['asm']['Mb']).apply(null, arguments); + }; + var stackRestore = function () { + return (stackRestore = Module['asm']['Nb']).apply(null, arguments); + }; + var stackAlloc = function () { + return (stackAlloc = Module['asm']['Ob']).apply(null, arguments); + }; + var dynCall_iiii = (Module['dynCall_iiii'] = function () { + return (dynCall_iiii = Module['dynCall_iiii'] = + Module['asm']['Pb']).apply(null, arguments); + }); + var dynCall_ii = (Module['dynCall_ii'] = function () { + return (dynCall_ii = Module['dynCall_ii'] = Module['asm']['Qb']).apply( + null, + arguments + ); + }); + var dynCall_vi = (Module['dynCall_vi'] = function () { + return (dynCall_vi = Module['dynCall_vi'] = Module['asm']['Rb']).apply( + null, + arguments + ); + }); + var dynCall_viiiii = (Module['dynCall_viiiii'] = function () { + return (dynCall_viiiii = Module['dynCall_viiiii'] = + Module['asm']['Sb']).apply(null, arguments); + }); + var dynCall_iii = (Module['dynCall_iii'] = function () { + return (dynCall_iii = Module['dynCall_iii'] = + Module['asm']['Tb']).apply(null, arguments); + }); + var dynCall_iiiii = (Module['dynCall_iiiii'] = function () { + return (dynCall_iiiii = Module['dynCall_iiiii'] = + Module['asm']['Ub']).apply(null, arguments); + }); + var dynCall_iiiiiii = (Module['dynCall_iiiiiii'] = function () { + return (dynCall_iiiiiii = Module['dynCall_iiiiiii'] = + Module['asm']['Vb']).apply(null, arguments); + }); + var dynCall_iiiiii = (Module['dynCall_iiiiii'] = function () { + return (dynCall_iiiiii = Module['dynCall_iiiiii'] = + Module['asm']['Wb']).apply(null, arguments); + }); + var dynCall_i = (Module['dynCall_i'] = function () { + return (dynCall_i = Module['dynCall_i'] = Module['asm']['Xb']).apply( + null, + arguments + ); + }); + var dynCall_vii = (Module['dynCall_vii'] = function () { + return (dynCall_vii = Module['dynCall_vii'] = + Module['asm']['Yb']).apply(null, arguments); + }); + var dynCall_viii = (Module['dynCall_viii'] = function () { + return (dynCall_viii = Module['dynCall_viii'] = + Module['asm']['Zb']).apply(null, arguments); + }); + var dynCall_viiii = (Module['dynCall_viiii'] = function () { + return (dynCall_viiii = Module['dynCall_viiii'] = + Module['asm']['_b']).apply(null, arguments); + }); + var dynCall_v = (Module['dynCall_v'] = function () { + return (dynCall_v = Module['dynCall_v'] = Module['asm']['$b']).apply( + null, + arguments + ); + }); + var dynCall_viiiiiiiii = (Module['dynCall_viiiiiiiii'] = function () { + return (dynCall_viiiiiiiii = Module['dynCall_viiiiiiiii'] = + Module['asm']['ac']).apply(null, arguments); + }); + var dynCall_viiiiii = (Module['dynCall_viiiiii'] = function () { + return (dynCall_viiiiii = Module['dynCall_viiiiii'] = + Module['asm']['bc']).apply(null, arguments); + }); + var dynCall_iiiiiiii = (Module['dynCall_iiiiiiii'] = function () { + return (dynCall_iiiiiiii = Module['dynCall_iiiiiiii'] = + Module['asm']['cc']).apply(null, arguments); + }); + var dynCall_iiiiiiiiii = (Module['dynCall_iiiiiiiiii'] = function () { + return (dynCall_iiiiiiiiii = Module['dynCall_iiiiiiiiii'] = + Module['asm']['dc']).apply(null, arguments); + }); + var dynCall_viidii = (Module['dynCall_viidii'] = function () { + return (dynCall_viidii = Module['dynCall_viidii'] = + Module['asm']['ec']).apply(null, arguments); + }); + var _asyncify_start_unwind = function () { + return (_asyncify_start_unwind = Module['asm']['fc']).apply( + null, + arguments + ); + }; + var _asyncify_stop_unwind = function () { + return (_asyncify_stop_unwind = Module['asm']['gc']).apply( + null, + arguments + ); + }; + var _asyncify_start_rewind = function () { + return (_asyncify_start_rewind = Module['asm']['hc']).apply( + null, + arguments + ); + }; + var _asyncify_stop_rewind = function () { + return (_asyncify_stop_rewind = Module['asm']['ic']).apply( + null, + arguments + ); + }; + function invoke_iiiiiii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + return dynCall_iiiiiii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vi(index, a1) { + var sp = stackSave(); + try { + dynCall_vi(index, a1); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iii(index, a1, a2) { + var sp = stackSave(); + try { + return dynCall_iii(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + return dynCall_iiiii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_ii(index, a1) { + var sp = stackSave(); + try { + return dynCall_ii(index, a1); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiii(index, a1, a2, a3) { + var sp = stackSave(); + try { + return dynCall_iiii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiii(index, a1, a2, a3, a4) { + var sp = stackSave(); + try { + dynCall_viiii(index, a1, a2, a3, a4); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + return dynCall_iiiiiiiiii( + index, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9 + ); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_vii(index, a1, a2) { + var sp = stackSave(); + try { + dynCall_vii(index, a1, a2); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_i(index) { + var sp = stackSave(); + try { + return dynCall_i(index); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viii(index, a1, a2, a3) { + var sp = stackSave(); + try { + dynCall_viii(index, a1, a2, a3); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_v(index) { + var sp = stackSave(); + try { + dynCall_v(index); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiii(index, a1, a2, a3, a4, a5, a6) { + var sp = stackSave(); + try { + dynCall_viiiiii(index, a1, a2, a3, a4, a5, a6); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_viiiii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viidii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + dynCall_viidii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiii(index, a1, a2, a3, a4, a5) { + var sp = stackSave(); + try { + return dynCall_iiiiii(index, a1, a2, a3, a4, a5); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_viiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9) { + var sp = stackSave(); + try { + dynCall_viiiiiiiii(index, a1, a2, a3, a4, a5, a6, a7, a8, a9); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + function invoke_iiiiiiii(index, a1, a2, a3, a4, a5, a6, a7) { + var sp = stackSave(); + try { + return dynCall_iiiiiiii(index, a1, a2, a3, a4, a5, a6, a7); + } catch (e) { + stackRestore(sp); + if (e !== e + 0) throw e; + _setThrew(1, 0); + } + } + Module['addRunDependency'] = addRunDependency; + Module['removeRunDependency'] = removeRunDependency; + Module['FS_createPath'] = FS.createPath; + Module['FS_createDataFile'] = FS.createDataFile; + Module['FS_createLazyFile'] = FS.createLazyFile; + Module['FS_createDevice'] = FS.createDevice; + Module['FS_unlink'] = FS.unlink; + Module['ccall'] = ccall; + Module['FS_createPreloadedFile'] = FS.createPreloadedFile; + Module['PROXYFS'] = PROXYFS; + var calledRun; + dependenciesFulfilled = function runCaller() { + if (!calledRun) run(); + if (!calledRun) dependenciesFulfilled = runCaller; + }; + function run() { + if (runDependencies > 0) { + return; + } + preRun(); + if (runDependencies > 0) { + return; + } + function doRun() { + if (calledRun) return; + calledRun = true; + Module['calledRun'] = true; + if (ABORT) return; + initRuntime(); + if (Module['onRuntimeInitialized']) + Module['onRuntimeInitialized'](); + postRun(); + } + if (Module['setStatus']) { + Module['setStatus']('Running...'); + setTimeout(function () { + setTimeout(function () { + Module['setStatus'](''); + }, 1); + doRun(); + }, 1); + } else { + doRun(); + } + } + if (Module['preInit']) { + if (typeof Module['preInit'] == 'function') + Module['preInit'] = [Module['preInit']]; + while (Module['preInit'].length > 0) { + Module['preInit'].pop()(); + } + } + run(); + /** + * Emscripten resolves `localhost` to a random IP address. Let's + * make it always resolve to 127.0.0.1. + */ + DNS.address_map.addrs.localhost = '127.0.0.1'; + + /** + * Debugging Asyncify errors is tricky because the stack trace is lost when the + * error is thrown. This code saves the stack trace in a global variable + * so that it can be inspected later. + */ + PHPLoader.debug = 'debug' in PHPLoader ? PHPLoader.debug : true; + if (PHPLoader.debug && typeof Asyncify !== 'undefined') { + const originalHandleSleep = Asyncify.handleSleep; + Asyncify.handleSleep = function (startAsync) { + if (!ABORT) { + Module['lastAsyncifyStackSource'] = new Error(); + } + return originalHandleSleep(startAsync); + }; + } + + /** + * Data dependencies call removeRunDependency() when they are loaded. + * The synchronous call stack then continues to run. If an error occurs + * in PHP initialization, e.g. Out Of Memory error, it will not be + * caught by any try/catch. This override propagates the failure to + * PHPLoader.onAbort() so that it can be handled. + */ + const originalRemoveRunDependency = PHPLoader['removeRunDependency']; + PHPLoader['removeRunDependency'] = function (...args) { + try { + originalRemoveRunDependency(...args); + } catch (e) { + PHPLoader['onAbort'](e); + } + }; + + /** + * Other exports live in the Dockerfile in: + * + * * EXTRA_EXPORTED_RUNTIME_METHODS + * * EXPORTED_FUNCTIONS + * + * These exports, however, live in here because: + * + * * Listing them in EXTRA_EXPORTED_RUNTIME_METHODS doesn't actually + * export them. This could be a bug in Emscripten or a consequence of + * that option being deprecated. + * * Listing them in EXPORTED_FUNCTIONS works, but they are overridden + * on every `BasePHP.run()` call. This is a problem because we want to + * spy on these calls in some unit tests. + * + * Therefore, we export them here. + */ + PHPLoader['malloc'] = _malloc; + PHPLoader['free'] = _free; + + return PHPLoader; + + // Close the opening bracket from esm-prefix.js: +} diff --git a/packages/edit-visually-browser-extension/src/php_8_0.wasm b/packages/edit-visually-browser-extension/src/php_8_0.wasm new file mode 100755 index 00000000..c897457d Binary files /dev/null and b/packages/edit-visually-browser-extension/src/php_8_0.wasm differ diff --git a/packages/edit-visually-browser-extension/src/playground-loader.html b/packages/edit-visually-browser-extension/src/playground-loader.html new file mode 100644 index 00000000..a83cdc8c --- /dev/null +++ b/packages/edit-visually-browser-extension/src/playground-loader.html @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/edit-visually-browser-extension/src/playground-loader.js b/packages/edit-visually-browser-extension/src/playground-loader.js new file mode 100644 index 00000000..8ec7b4ed --- /dev/null +++ b/packages/edit-visually-browser-extension/src/playground-loader.js @@ -0,0 +1,13951 @@ +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getProtoOf = Object.getPrototypeOf; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __toESM = (mod, isNodeMode, target) => { + target = mod != null ? __create(__getProtoOf(mod)) : {}; + const to = + isNodeMode || !mod || !mod.__esModule + ? __defProp(target, 'default', { value: mod, enumerable: true }) + : target; + for (let key of __getOwnPropNames(mod)) + if (!__hasOwnProp.call(to, key)) + __defProp(to, key, { + get: () => mod[key], + enumerable: true, + }); + return to; +}; +var __commonJS = (cb, mod) => () => ( + mod || cb((mod = { exports: {} }).exports, mod), mod.exports +); +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { + get: all[name], + enumerable: true, + configurable: true, + set: (newValue) => (all[name] = () => newValue), + }); +}; +var __legacyDecorateClassTS = function (decorators, target, key, desc) { + var c = arguments.length, + r = + c < 3 + ? target + : desc === null + ? (desc = Object.getOwnPropertyDescriptor(target, key)) + : desc, + d; + if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function') + r = Reflect.decorate(decorators, target, key, desc); + else + for (var i = decorators.length - 1; i >= 0; i--) + if ((d = decorators[i])) + r = + (c < 3 + ? d(r) + : c > 3 + ? d(target, key, r) + : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __legacyMetadataTS = (k, v) => { + if (typeof Reflect === 'object' && typeof Reflect.metadata === 'function') + return Reflect.metadata(k, v); +}; +var __require = ((x) => + typeof require !== 'undefined' + ? require + : typeof Proxy !== 'undefined' + ? new Proxy(x, { + get: (a, b) => + (typeof require !== 'undefined' ? require : a)[b], + }) + : x)(function (x) { + if (typeof require !== 'undefined') return require.apply(this, arguments); + throw Error('Dynamic require of "' + x + '" is not supported'); +}); + +// ../../../node_modules/ini/lib/ini.js +var require_ini = __commonJS((exports, module) => { + var splitSections = function (str, separator) { + var lastMatchIndex = 0; + var lastSeparatorIndex = 0; + var nextIndex = 0; + var sections = []; + do { + nextIndex = str.indexOf(separator, lastMatchIndex); + if (nextIndex !== -1) { + lastMatchIndex = nextIndex + separator.length; + if (nextIndex > 0 && str[nextIndex - 1] === '\\') { + continue; + } + sections.push(str.slice(lastSeparatorIndex, nextIndex)); + lastSeparatorIndex = nextIndex + separator.length; + } + } while (nextIndex !== -1); + sections.push(str.slice(lastSeparatorIndex)); + return sections; + }; + var { hasOwnProperty } = Object.prototype; + var encode = (obj, opt = {}) => { + if (typeof opt === 'string') { + opt = { section: opt }; + } + opt.align = opt.align === true; + opt.newline = opt.newline === true; + opt.sort = opt.sort === true; + opt.whitespace = opt.whitespace === true || opt.align === true; + opt.platform = + opt.platform || + (typeof process !== 'undefined' && process.platform); + opt.bracketedArray = opt.bracketedArray !== false; + const eol2 = opt.platform === 'win32' ? '\r\n' : '\n'; + const separator = opt.whitespace ? ' = ' : '='; + const children = []; + const keys = opt.sort ? Object.keys(obj).sort() : Object.keys(obj); + let padToChars = 0; + if (opt.align) { + padToChars = safe( + keys + .filter( + (k) => + obj[k] === null || + Array.isArray(obj[k]) || + typeof obj[k] !== 'object' + ) + .map((k) => (Array.isArray(obj[k]) ? `${k}[]` : k)) + .concat(['']) + .reduce((a, b) => + safe(a).length >= safe(b).length ? a : b + ) + ).length; + } + let out = ''; + const arraySuffix = opt.bracketedArray ? '[]' : ''; + for (const k of keys) { + const val = obj[k]; + if (val && Array.isArray(val)) { + for (const item of val) { + out += + safe(`${k}${arraySuffix}`).padEnd(padToChars, ' ') + + separator + + safe(item) + + eol2; + } + } else if (val && typeof val === 'object') { + children.push(k); + } else { + out += + safe(k).padEnd(padToChars, ' ') + + separator + + safe(val) + + eol2; + } + } + if (opt.section && out.length) { + out = + '[' + + safe(opt.section) + + ']' + + (opt.newline ? eol2 + eol2 : eol2) + + out; + } + for (const k of children) { + const nk = splitSections(k, '.').join('\\.'); + const section = (opt.section ? opt.section + '.' : '') + nk; + const child = encode(obj[k], { + ...opt, + section, + }); + if (out.length && child.length) { + out += eol2; + } + out += child; + } + return out; + }; + var decode = (str, opt = {}) => { + opt.bracketedArray = opt.bracketedArray !== false; + const out = Object.create(null); + let p = out; + let section = null; + const re = /^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i; + const lines = str.split(/[\r\n]+/g); + const duplicates = {}; + for (const line of lines) { + if (!line || line.match(/^\s*[;#]/) || line.match(/^\s*$/)) { + continue; + } + const match = line.match(re); + if (!match) { + continue; + } + if (match[1] !== undefined) { + section = unsafe(match[1]); + if (section === '__proto__') { + p = Object.create(null); + continue; + } + p = out[section] = out[section] || Object.create(null); + continue; + } + const keyRaw = unsafe(match[2]); + let isArray; + if (opt.bracketedArray) { + isArray = keyRaw.length > 2 && keyRaw.slice(-2) === '[]'; + } else { + duplicates[keyRaw] = (duplicates?.[keyRaw] || 0) + 1; + isArray = duplicates[keyRaw] > 1; + } + const key = isArray ? keyRaw.slice(0, -2) : keyRaw; + if (key === '__proto__') { + continue; + } + const valueRaw = match[3] ? unsafe(match[4]) : true; + const value = + valueRaw === 'true' || + valueRaw === 'false' || + valueRaw === 'null' + ? JSON.parse(valueRaw) + : valueRaw; + if (isArray) { + if (!hasOwnProperty.call(p, key)) { + p[key] = []; + } else if (!Array.isArray(p[key])) { + p[key] = [p[key]]; + } + } + if (Array.isArray(p[key])) { + p[key].push(value); + } else { + p[key] = value; + } + } + const remove = []; + for (const k of Object.keys(out)) { + if ( + !hasOwnProperty.call(out, k) || + typeof out[k] !== 'object' || + Array.isArray(out[k]) + ) { + continue; + } + const parts = splitSections(k, '.'); + p = out; + const l = parts.pop(); + const nl = l.replace(/\\\./g, '.'); + for (const part of parts) { + if (part === '__proto__') { + continue; + } + if ( + !hasOwnProperty.call(p, part) || + typeof p[part] !== 'object' + ) { + p[part] = Object.create(null); + } + p = p[part]; + } + if (p === out && nl === l) { + continue; + } + p[nl] = out[k]; + remove.push(k); + } + for (const del of remove) { + delete out[del]; + } + return out; + }; + var isQuoted = (val) => { + return ( + (val.startsWith('"') && val.endsWith('"')) || + (val.startsWith("'") && val.endsWith("'")) + ); + }; + var safe = (val) => { + if ( + typeof val !== 'string' || + val.match(/[=\r\n]/) || + val.match(/^\[/) || + (val.length > 1 && isQuoted(val)) || + val !== val.trim() + ) { + return JSON.stringify(val); + } + return val.split(';').join('\\;').split('#').join('\\#'); + }; + var unsafe = (val) => { + val = (val || '').trim(); + if (isQuoted(val)) { + if (val.charAt(0) === "'") { + val = val.slice(1, -1); + } + try { + val = JSON.parse(val); + } catch {} + } else { + let esc = false; + let unesc = ''; + for (let i = 0, l = val.length; i < l; i++) { + const c = val.charAt(i); + if (esc) { + if ('\\;#'.indexOf(c) !== -1) { + unesc += c; + } else { + unesc += '\\' + c; + } + esc = false; + } else if (';#'.indexOf(c) !== -1) { + break; + } else if (c === '\\') { + esc = true; + } else { + unesc += c; + } + } + if (esc) { + unesc += '\\'; + } + return unesc.trim(); + } + return val; + }; + module.exports = { + parse: decode, + decode, + stringify: encode, + encode, + safe, + unsafe, + }; +}); + +// ../../../node_modules/ajv/dist/compile/codegen/code.js +var require_code = __commonJS((exports) => { + var _ = function (strs, ...args) { + const code = [strs[0]]; + let i = 0; + while (i < args.length) { + addCodeArg(code, args[i]); + code.push(strs[++i]); + } + return new _Code(code); + }; + var str = function (strs, ...args) { + const expr = [safeStringify(strs[0])]; + let i = 0; + while (i < args.length) { + expr.push(plus); + addCodeArg(expr, args[i]); + expr.push(plus, safeStringify(strs[++i])); + } + optimize(expr); + return new _Code(expr); + }; + var addCodeArg = function (code, arg) { + if (arg instanceof _Code) code.push(...arg._items); + else if (arg instanceof Name) code.push(arg); + else code.push(interpolate(arg)); + }; + var optimize = function (expr) { + let i = 1; + while (i < expr.length - 1) { + if (expr[i] === plus) { + const res = mergeExprItems(expr[i - 1], expr[i + 1]); + if (res !== undefined) { + expr.splice(i - 1, 3, res); + continue; + } + expr[i++] = '+'; + } + i++; + } + }; + var mergeExprItems = function (a, b) { + if (b === '""') return a; + if (a === '""') return b; + if (typeof a == 'string') { + if (b instanceof Name || a[a.length - 1] !== '"') return; + if (typeof b != 'string') return `${a.slice(0, -1)}${b}"`; + if (b[0] === '"') return a.slice(0, -1) + b.slice(1); + return; + } + if (typeof b == 'string' && b[0] === '"' && !(a instanceof Name)) + return `"${a}${b.slice(1)}`; + return; + }; + var strConcat = function (c1, c2) { + return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str`${c1}${c2}`; + }; + var interpolate = function (x) { + return typeof x == 'number' || typeof x == 'boolean' || x === null + ? x + : safeStringify(Array.isArray(x) ? x.join(',') : x); + }; + var stringify2 = function (x) { + return new _Code(safeStringify(x)); + }; + var safeStringify = function (x) { + return JSON.stringify(x) + .replace(/\u2028/g, '\\u2028') + .replace(/\u2029/g, '\\u2029'); + }; + var getProperty = function (key) { + return typeof key == 'string' && exports.IDENTIFIER.test(key) + ? new _Code(`.${key}`) + : _`[${key}]`; + }; + var getEsmExportName = function (key) { + if (typeof key == 'string' && exports.IDENTIFIER.test(key)) { + return new _Code(`${key}`); + } + throw new Error( + `CodeGen: invalid export name: ${key}, use explicit \$id name mapping` + ); + }; + var regexpCode = function (rx) { + return new _Code(rx.toString()); + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.regexpCode = + exports.getEsmExportName = + exports.getProperty = + exports.safeStringify = + exports.stringify = + exports.strConcat = + exports.addCodeArg = + exports.str = + exports._ = + exports.nil = + exports._Code = + exports.Name = + exports.IDENTIFIER = + exports._CodeOrName = + undefined; + + class _CodeOrName {} + exports._CodeOrName = _CodeOrName; + exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; + + class Name extends _CodeOrName { + constructor(s) { + super(); + if (!exports.IDENTIFIER.test(s)) + throw new Error('CodeGen: name must be a valid identifier'); + this.str = s; + } + toString() { + return this.str; + } + emptyStr() { + return false; + } + get names() { + return { [this.str]: 1 }; + } + } + exports.Name = Name; + + class _Code extends _CodeOrName { + constructor(code) { + super(); + this._items = typeof code === 'string' ? [code] : code; + } + toString() { + return this.str; + } + emptyStr() { + if (this._items.length > 1) return false; + const item = this._items[0]; + return item === '' || item === '""'; + } + get str() { + var _a; + return (_a = this._str) !== null && _a !== undefined + ? _a + : (this._str = this._items.reduce((s, c) => `${s}${c}`, '')); + } + get names() { + var _a; + return (_a = this._names) !== null && _a !== undefined + ? _a + : (this._names = this._items.reduce((names, c) => { + if (c instanceof Name) + names[c.str] = (names[c.str] || 0) + 1; + return names; + }, {})); + } + } + exports._Code = _Code; + exports.nil = new _Code(''); + exports._ = _; + var plus = new _Code('+'); + exports.str = str; + exports.addCodeArg = addCodeArg; + exports.strConcat = strConcat; + exports.stringify = stringify2; + exports.safeStringify = safeStringify; + exports.getProperty = getProperty; + exports.getEsmExportName = getEsmExportName; + exports.regexpCode = regexpCode; +}); + +// ../../../node_modules/ajv/dist/compile/codegen/scope.js +var require_scope = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + exports.ValueScope = + exports.ValueScopeName = + exports.Scope = + exports.varKinds = + exports.UsedValueState = + undefined; + var code_1 = require_code(); + + class ValueError extends Error { + constructor(name) { + super(`CodeGen: "code" for ${name} not defined`); + this.value = name.value; + } + } + var UsedValueState; + (function (UsedValueState2) { + UsedValueState2[(UsedValueState2['Started'] = 0)] = 'Started'; + UsedValueState2[(UsedValueState2['Completed'] = 1)] = 'Completed'; + })( + (UsedValueState = + exports.UsedValueState || (exports.UsedValueState = {})) + ); + exports.varKinds = { + const: new code_1.Name('const'), + let: new code_1.Name('let'), + var: new code_1.Name('var'), + }; + + class Scope { + constructor({ prefixes, parent } = {}) { + this._names = {}; + this._prefixes = prefixes; + this._parent = parent; + } + toName(nameOrPrefix) { + return nameOrPrefix instanceof code_1.Name + ? nameOrPrefix + : this.name(nameOrPrefix); + } + name(prefix) { + return new code_1.Name(this._newName(prefix)); + } + _newName(prefix) { + const ng = this._names[prefix] || this._nameGroup(prefix); + return `${prefix}${ng.index++}`; + } + _nameGroup(prefix) { + var _a, _b; + if ( + ((_b = + (_a = this._parent) === null || _a === undefined + ? undefined + : _a._prefixes) === null || _b === undefined + ? undefined + : _b.has(prefix)) || + (this._prefixes && !this._prefixes.has(prefix)) + ) { + throw new Error( + `CodeGen: prefix "${prefix}" is not allowed in this scope` + ); + } + return (this._names[prefix] = { prefix, index: 0 }); + } + } + exports.Scope = Scope; + + class ValueScopeName extends code_1.Name { + constructor(prefix, nameStr) { + super(nameStr); + this.prefix = prefix; + } + setValue(value, { property, itemIndex }) { + this.value = value; + this.scopePath = (0, code_1._)`.${new code_1.Name( + property + )}[${itemIndex}]`; + } + } + exports.ValueScopeName = ValueScopeName; + var line = (0, code_1._)`\n`; + + class ValueScope extends Scope { + constructor(opts) { + super(opts); + this._values = {}; + this._scope = opts.scope; + this.opts = { ...opts, _n: opts.lines ? line : code_1.nil }; + } + get() { + return this._scope; + } + name(prefix) { + return new ValueScopeName(prefix, this._newName(prefix)); + } + value(nameOrPrefix, value) { + var _a; + if (value.ref === undefined) + throw new Error('CodeGen: ref must be passed in value'); + const name = this.toName(nameOrPrefix); + const { prefix } = name; + const valueKey = + (_a = value.key) !== null && _a !== undefined ? _a : value.ref; + let vs = this._values[prefix]; + if (vs) { + const _name = vs.get(valueKey); + if (_name) return _name; + } else { + vs = this._values[prefix] = new Map(); + } + vs.set(valueKey, name); + const s = this._scope[prefix] || (this._scope[prefix] = []); + const itemIndex = s.length; + s[itemIndex] = value.ref; + name.setValue(value, { property: prefix, itemIndex }); + return name; + } + getValue(prefix, keyOrRef) { + const vs = this._values[prefix]; + if (!vs) return; + return vs.get(keyOrRef); + } + scopeRefs(scopeName, values = this._values) { + return this._reduceValues(values, (name) => { + if (name.scopePath === undefined) + throw new Error(`CodeGen: name "${name}" has no value`); + return (0, code_1._)`${scopeName}${name.scopePath}`; + }); + } + scopeCode(values = this._values, usedValues, getCode) { + return this._reduceValues( + values, + (name) => { + if (name.value === undefined) + throw new Error(`CodeGen: name "${name}" has no value`); + return name.value.code; + }, + usedValues, + getCode + ); + } + _reduceValues(values, valueCode, usedValues = {}, getCode) { + let code = code_1.nil; + for (const prefix in values) { + const vs = values[prefix]; + if (!vs) continue; + const nameSet = (usedValues[prefix] = + usedValues[prefix] || new Map()); + vs.forEach((name) => { + if (nameSet.has(name)) return; + nameSet.set(name, UsedValueState.Started); + let c = valueCode(name); + if (c) { + const def = this.opts.es5 + ? exports.varKinds.var + : exports.varKinds.const; + code = (0, + code_1._)`${code}${def} ${name} = ${c};${this.opts._n}`; + } else if ( + (c = + getCode === null || getCode === undefined + ? undefined + : getCode(name)) + ) { + code = (0, code_1._)`${code}${c}${this.opts._n}`; + } else { + throw new ValueError(name); + } + nameSet.set(name, UsedValueState.Completed); + }); + } + return code; + } + } + exports.ValueScope = ValueScope; +}); + +// ../../../node_modules/ajv/dist/compile/codegen/index.js +var require_codegen = __commonJS((exports) => { + var addNames = function (names, from) { + for (const n in from) names[n] = (names[n] || 0) + (from[n] || 0); + return names; + }; + var addExprNames = function (names, from) { + return from instanceof code_1._CodeOrName + ? addNames(names, from.names) + : names; + }; + var optimizeExpr = function (expr, names, constants) { + if (expr instanceof code_1.Name) return replaceName(expr); + if (!canOptimize(expr)) return expr; + return new code_1._Code( + expr._items.reduce((items, c) => { + if (c instanceof code_1.Name) c = replaceName(c); + if (c instanceof code_1._Code) items.push(...c._items); + else items.push(c); + return items; + }, []) + ); + function replaceName(n) { + const c = constants[n.str]; + if (c === undefined || names[n.str] !== 1) return n; + delete names[n.str]; + return c; + } + function canOptimize(e) { + return ( + e instanceof code_1._Code && + e._items.some( + (c) => + c instanceof code_1.Name && + names[c.str] === 1 && + constants[c.str] !== undefined + ) + ); + } + }; + var subtractNames = function (names, from) { + for (const n in from) names[n] = (names[n] || 0) - (from[n] || 0); + }; + var not = function (x) { + return typeof x == 'boolean' || typeof x == 'number' || x === null + ? !x + : (0, code_1._)`!${par(x)}`; + }; + var and = function (...args) { + return args.reduce(andCode); + }; + var or = function (...args) { + return args.reduce(orCode); + }; + var mappend = function (op) { + return (x, y) => + x === code_1.nil + ? y + : y === code_1.nil + ? x + : (0, code_1._)`${par(x)} ${op} ${par(y)}`; + }; + var par = function (x) { + return x instanceof code_1.Name ? x : (0, code_1._)`(${x})`; + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.or = + exports.and = + exports.not = + exports.CodeGen = + exports.operators = + exports.varKinds = + exports.ValueScopeName = + exports.ValueScope = + exports.Scope = + exports.Name = + exports.regexpCode = + exports.stringify = + exports.getProperty = + exports.nil = + exports.strConcat = + exports.str = + exports._ = + undefined; + var code_1 = require_code(); + var scope_1 = require_scope(); + var code_2 = require_code(); + Object.defineProperty(exports, '_', { + enumerable: true, + get: function () { + return code_2._; + }, + }); + Object.defineProperty(exports, 'str', { + enumerable: true, + get: function () { + return code_2.str; + }, + }); + Object.defineProperty(exports, 'strConcat', { + enumerable: true, + get: function () { + return code_2.strConcat; + }, + }); + Object.defineProperty(exports, 'nil', { + enumerable: true, + get: function () { + return code_2.nil; + }, + }); + Object.defineProperty(exports, 'getProperty', { + enumerable: true, + get: function () { + return code_2.getProperty; + }, + }); + Object.defineProperty(exports, 'stringify', { + enumerable: true, + get: function () { + return code_2.stringify; + }, + }); + Object.defineProperty(exports, 'regexpCode', { + enumerable: true, + get: function () { + return code_2.regexpCode; + }, + }); + Object.defineProperty(exports, 'Name', { + enumerable: true, + get: function () { + return code_2.Name; + }, + }); + var scope_2 = require_scope(); + Object.defineProperty(exports, 'Scope', { + enumerable: true, + get: function () { + return scope_2.Scope; + }, + }); + Object.defineProperty(exports, 'ValueScope', { + enumerable: true, + get: function () { + return scope_2.ValueScope; + }, + }); + Object.defineProperty(exports, 'ValueScopeName', { + enumerable: true, + get: function () { + return scope_2.ValueScopeName; + }, + }); + Object.defineProperty(exports, 'varKinds', { + enumerable: true, + get: function () { + return scope_2.varKinds; + }, + }); + exports.operators = { + GT: new code_1._Code('>'), + GTE: new code_1._Code('>='), + LT: new code_1._Code('<'), + LTE: new code_1._Code('<='), + EQ: new code_1._Code('==='), + NEQ: new code_1._Code('!=='), + NOT: new code_1._Code('!'), + OR: new code_1._Code('||'), + AND: new code_1._Code('&&'), + ADD: new code_1._Code('+'), + }; + + class Node { + optimizeNodes() { + return this; + } + optimizeNames(_names, _constants) { + return this; + } + } + + class Def extends Node { + constructor(varKind, name, rhs) { + super(); + this.varKind = varKind; + this.name = name; + this.rhs = rhs; + } + render({ es5, _n }) { + const varKind = es5 ? scope_1.varKinds.var : this.varKind; + const rhs = this.rhs === undefined ? '' : ` = ${this.rhs}`; + return `${varKind} ${this.name}${rhs};` + _n; + } + optimizeNames(names, constants) { + if (!names[this.name.str]) return; + if (this.rhs) this.rhs = optimizeExpr(this.rhs, names, constants); + return this; + } + get names() { + return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {}; + } + } + + class Assign extends Node { + constructor(lhs, rhs, sideEffects) { + super(); + this.lhs = lhs; + this.rhs = rhs; + this.sideEffects = sideEffects; + } + render({ _n }) { + return `${this.lhs} = ${this.rhs};` + _n; + } + optimizeNames(names, constants) { + if ( + this.lhs instanceof code_1.Name && + !names[this.lhs.str] && + !this.sideEffects + ) + return; + this.rhs = optimizeExpr(this.rhs, names, constants); + return this; + } + get names() { + const names = + this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names }; + return addExprNames(names, this.rhs); + } + } + + class AssignOp extends Assign { + constructor(lhs, op, rhs, sideEffects) { + super(lhs, rhs, sideEffects); + this.op = op; + } + render({ _n }) { + return `${this.lhs} ${this.op}= ${this.rhs};` + _n; + } + } + + class Label extends Node { + constructor(label) { + super(); + this.label = label; + this.names = {}; + } + render({ _n }) { + return `${this.label}:` + _n; + } + } + + class Break extends Node { + constructor(label) { + super(); + this.label = label; + this.names = {}; + } + render({ _n }) { + const label = this.label ? ` ${this.label}` : ''; + return `break${label};` + _n; + } + } + + class Throw extends Node { + constructor(error) { + super(); + this.error = error; + } + render({ _n }) { + return `throw ${this.error};` + _n; + } + get names() { + return this.error.names; + } + } + + class AnyCode extends Node { + constructor(code) { + super(); + this.code = code; + } + render({ _n }) { + return `${this.code};` + _n; + } + optimizeNodes() { + return `${this.code}` ? this : undefined; + } + optimizeNames(names, constants) { + this.code = optimizeExpr(this.code, names, constants); + return this; + } + get names() { + return this.code instanceof code_1._CodeOrName + ? this.code.names + : {}; + } + } + + class ParentNode extends Node { + constructor(nodes = []) { + super(); + this.nodes = nodes; + } + render(opts) { + return this.nodes.reduce((code, n) => code + n.render(opts), ''); + } + optimizeNodes() { + const { nodes } = this; + let i = nodes.length; + while (i--) { + const n = nodes[i].optimizeNodes(); + if (Array.isArray(n)) nodes.splice(i, 1, ...n); + else if (n) nodes[i] = n; + else nodes.splice(i, 1); + } + return nodes.length > 0 ? this : undefined; + } + optimizeNames(names, constants) { + const { nodes } = this; + let i = nodes.length; + while (i--) { + const n = nodes[i]; + if (n.optimizeNames(names, constants)) continue; + subtractNames(names, n.names); + nodes.splice(i, 1); + } + return nodes.length > 0 ? this : undefined; + } + get names() { + return this.nodes.reduce( + (names, n) => addNames(names, n.names), + {} + ); + } + } + + class BlockNode extends ParentNode { + render(opts) { + return '{' + opts._n + super.render(opts) + '}' + opts._n; + } + } + + class Root extends ParentNode {} + + class Else extends BlockNode {} + Else.kind = 'else'; + + class If extends BlockNode { + constructor(condition, nodes) { + super(nodes); + this.condition = condition; + } + render(opts) { + let code = `if(${this.condition})` + super.render(opts); + if (this.else) code += 'else ' + this.else.render(opts); + return code; + } + optimizeNodes() { + super.optimizeNodes(); + const cond = this.condition; + if (cond === true) return this.nodes; + let e = this.else; + if (e) { + const ns = e.optimizeNodes(); + e = this.else = Array.isArray(ns) ? new Else(ns) : ns; + } + if (e) { + if (cond === false) return e instanceof If ? e : e.nodes; + if (this.nodes.length) return this; + return new If(not(cond), e instanceof If ? [e] : e.nodes); + } + if (cond === false || !this.nodes.length) return; + return this; + } + optimizeNames(names, constants) { + var _a; + this.else = + (_a = this.else) === null || _a === undefined + ? undefined + : _a.optimizeNames(names, constants); + if (!(super.optimizeNames(names, constants) || this.else)) return; + this.condition = optimizeExpr(this.condition, names, constants); + return this; + } + get names() { + const names = super.names; + addExprNames(names, this.condition); + if (this.else) addNames(names, this.else.names); + return names; + } + } + If.kind = 'if'; + + class For extends BlockNode {} + For.kind = 'for'; + + class ForLoop extends For { + constructor(iteration) { + super(); + this.iteration = iteration; + } + render(opts) { + return `for(${this.iteration})` + super.render(opts); + } + optimizeNames(names, constants) { + if (!super.optimizeNames(names, constants)) return; + this.iteration = optimizeExpr(this.iteration, names, constants); + return this; + } + get names() { + return addNames(super.names, this.iteration.names); + } + } + + class ForRange extends For { + constructor(varKind, name, from, to) { + super(); + this.varKind = varKind; + this.name = name; + this.from = from; + this.to = to; + } + render(opts) { + const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind; + const { name, from, to } = this; + return ( + `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + + super.render(opts) + ); + } + get names() { + const names = addExprNames(super.names, this.from); + return addExprNames(names, this.to); + } + } + + class ForIter extends For { + constructor(loop, varKind, name, iterable) { + super(); + this.loop = loop; + this.varKind = varKind; + this.name = name; + this.iterable = iterable; + } + render(opts) { + return ( + `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + + super.render(opts) + ); + } + optimizeNames(names, constants) { + if (!super.optimizeNames(names, constants)) return; + this.iterable = optimizeExpr(this.iterable, names, constants); + return this; + } + get names() { + return addNames(super.names, this.iterable.names); + } + } + + class Func extends BlockNode { + constructor(name, args, async) { + super(); + this.name = name; + this.args = args; + this.async = async; + } + render(opts) { + const _async = this.async ? 'async ' : ''; + return ( + `${_async}function ${this.name}(${this.args})` + + super.render(opts) + ); + } + } + Func.kind = 'func'; + + class Return extends ParentNode { + render(opts) { + return 'return ' + super.render(opts); + } + } + Return.kind = 'return'; + + class Try extends BlockNode { + render(opts) { + let code = 'try' + super.render(opts); + if (this.catch) code += this.catch.render(opts); + if (this.finally) code += this.finally.render(opts); + return code; + } + optimizeNodes() { + var _a, _b; + super.optimizeNodes(); + (_a = this.catch) === null || + _a === undefined || + _a.optimizeNodes(); + (_b = this.finally) === null || + _b === undefined || + _b.optimizeNodes(); + return this; + } + optimizeNames(names, constants) { + var _a, _b; + super.optimizeNames(names, constants); + (_a = this.catch) === null || + _a === undefined || + _a.optimizeNames(names, constants); + (_b = this.finally) === null || + _b === undefined || + _b.optimizeNames(names, constants); + return this; + } + get names() { + const names = super.names; + if (this.catch) addNames(names, this.catch.names); + if (this.finally) addNames(names, this.finally.names); + return names; + } + } + + class Catch extends BlockNode { + constructor(error) { + super(); + this.error = error; + } + render(opts) { + return `catch(${this.error})` + super.render(opts); + } + } + Catch.kind = 'catch'; + + class Finally extends BlockNode { + render(opts) { + return 'finally' + super.render(opts); + } + } + Finally.kind = 'finally'; + + class CodeGen { + constructor(extScope, opts = {}) { + this._values = {}; + this._blockStarts = []; + this._constants = {}; + this.opts = { ...opts, _n: opts.lines ? '\n' : '' }; + this._extScope = extScope; + this._scope = new scope_1.Scope({ parent: extScope }); + this._nodes = [new Root()]; + } + toString() { + return this._root.render(this.opts); + } + name(prefix) { + return this._scope.name(prefix); + } + scopeName(prefix) { + return this._extScope.name(prefix); + } + scopeValue(prefixOrName, value) { + const name = this._extScope.value(prefixOrName, value); + const vs = + this._values[name.prefix] || + (this._values[name.prefix] = new Set()); + vs.add(name); + return name; + } + getScopeValue(prefix, keyOrRef) { + return this._extScope.getValue(prefix, keyOrRef); + } + scopeRefs(scopeName) { + return this._extScope.scopeRefs(scopeName, this._values); + } + scopeCode() { + return this._extScope.scopeCode(this._values); + } + _def(varKind, nameOrPrefix, rhs, constant) { + const name = this._scope.toName(nameOrPrefix); + if (rhs !== undefined && constant) this._constants[name.str] = rhs; + this._leafNode(new Def(varKind, name, rhs)); + return name; + } + const(nameOrPrefix, rhs, _constant) { + return this._def( + scope_1.varKinds.const, + nameOrPrefix, + rhs, + _constant + ); + } + let(nameOrPrefix, rhs, _constant) { + return this._def( + scope_1.varKinds.let, + nameOrPrefix, + rhs, + _constant + ); + } + var(nameOrPrefix, rhs, _constant) { + return this._def( + scope_1.varKinds.var, + nameOrPrefix, + rhs, + _constant + ); + } + assign(lhs, rhs, sideEffects) { + return this._leafNode(new Assign(lhs, rhs, sideEffects)); + } + add(lhs, rhs) { + return this._leafNode( + new AssignOp(lhs, exports.operators.ADD, rhs) + ); + } + code(c) { + if (typeof c == 'function') c(); + else if (c !== code_1.nil) this._leafNode(new AnyCode(c)); + return this; + } + object(...keyValues) { + const code = ['{']; + for (const [key, value] of keyValues) { + if (code.length > 1) code.push(','); + code.push(key); + if (key !== value || this.opts.es5) { + code.push(':'); + (0, code_1.addCodeArg)(code, value); + } + } + code.push('}'); + return new code_1._Code(code); + } + if(condition, thenBody, elseBody) { + this._blockNode(new If(condition)); + if (thenBody && elseBody) { + this.code(thenBody).else().code(elseBody).endIf(); + } else if (thenBody) { + this.code(thenBody).endIf(); + } else if (elseBody) { + throw new Error('CodeGen: "else" body without "then" body'); + } + return this; + } + elseIf(condition) { + return this._elseNode(new If(condition)); + } + else() { + return this._elseNode(new Else()); + } + endIf() { + return this._endBlockNode(If, Else); + } + _for(node, forBody) { + this._blockNode(node); + if (forBody) this.code(forBody).endFor(); + return this; + } + for(iteration, forBody) { + return this._for(new ForLoop(iteration), forBody); + } + forRange( + nameOrPrefix, + from, + to, + forBody, + varKind = this.opts.es5 + ? scope_1.varKinds.var + : scope_1.varKinds.let + ) { + const name = this._scope.toName(nameOrPrefix); + return this._for(new ForRange(varKind, name, from, to), () => + forBody(name) + ); + } + forOf( + nameOrPrefix, + iterable, + forBody, + varKind = scope_1.varKinds.const + ) { + const name = this._scope.toName(nameOrPrefix); + if (this.opts.es5) { + const arr = + iterable instanceof code_1.Name + ? iterable + : this.var('_arr', iterable); + return this.forRange( + '_i', + 0, + (0, code_1._)`${arr}.length`, + (i) => { + this.var(name, (0, code_1._)`${arr}[${i}]`); + forBody(name); + } + ); + } + return this._for(new ForIter('of', varKind, name, iterable), () => + forBody(name) + ); + } + forIn( + nameOrPrefix, + obj, + forBody, + varKind = this.opts.es5 + ? scope_1.varKinds.var + : scope_1.varKinds.const + ) { + if (this.opts.ownProperties) { + return this.forOf( + nameOrPrefix, + (0, code_1._)`Object.keys(${obj})`, + forBody + ); + } + const name = this._scope.toName(nameOrPrefix); + return this._for(new ForIter('in', varKind, name, obj), () => + forBody(name) + ); + } + endFor() { + return this._endBlockNode(For); + } + label(label) { + return this._leafNode(new Label(label)); + } + break(label) { + return this._leafNode(new Break(label)); + } + return(value) { + const node = new Return(); + this._blockNode(node); + this.code(value); + if (node.nodes.length !== 1) + throw new Error('CodeGen: "return" should have one node'); + return this._endBlockNode(Return); + } + try(tryBody, catchCode, finallyCode) { + if (!catchCode && !finallyCode) + throw new Error('CodeGen: "try" without "catch" and "finally"'); + const node = new Try(); + this._blockNode(node); + this.code(tryBody); + if (catchCode) { + const error = this.name('e'); + this._currNode = node.catch = new Catch(error); + catchCode(error); + } + if (finallyCode) { + this._currNode = node.finally = new Finally(); + this.code(finallyCode); + } + return this._endBlockNode(Catch, Finally); + } + throw(error) { + return this._leafNode(new Throw(error)); + } + block(body, nodeCount) { + this._blockStarts.push(this._nodes.length); + if (body) this.code(body).endBlock(nodeCount); + return this; + } + endBlock(nodeCount) { + const len = this._blockStarts.pop(); + if (len === undefined) + throw new Error('CodeGen: not in self-balancing block'); + const toClose = this._nodes.length - len; + if ( + toClose < 0 || + (nodeCount !== undefined && toClose !== nodeCount) + ) { + throw new Error( + `CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected` + ); + } + this._nodes.length = len; + return this; + } + func(name, args = code_1.nil, async, funcBody) { + this._blockNode(new Func(name, args, async)); + if (funcBody) this.code(funcBody).endFunc(); + return this; + } + endFunc() { + return this._endBlockNode(Func); + } + optimize(n = 1) { + while (n-- > 0) { + this._root.optimizeNodes(); + this._root.optimizeNames(this._root.names, this._constants); + } + } + _leafNode(node) { + this._currNode.nodes.push(node); + return this; + } + _blockNode(node) { + this._currNode.nodes.push(node); + this._nodes.push(node); + } + _endBlockNode(N1, N2) { + const n = this._currNode; + if (n instanceof N1 || (N2 && n instanceof N2)) { + this._nodes.pop(); + return this; + } + throw new Error( + `CodeGen: not in block "${ + N2 ? `${N1.kind}/${N2.kind}` : N1.kind + }"` + ); + } + _elseNode(node) { + const n = this._currNode; + if (!(n instanceof If)) { + throw new Error('CodeGen: "else" without "if"'); + } + this._currNode = n.else = node; + return this; + } + get _root() { + return this._nodes[0]; + } + get _currNode() { + const ns = this._nodes; + return ns[ns.length - 1]; + } + set _currNode(node) { + const ns = this._nodes; + ns[ns.length - 1] = node; + } + } + exports.CodeGen = CodeGen; + exports.not = not; + var andCode = mappend(exports.operators.AND); + exports.and = and; + var orCode = mappend(exports.operators.OR); + exports.or = or; +}); + +// ../../../node_modules/ajv/dist/compile/util.js +var require_util = __commonJS((exports) => { + var toHash = function (arr) { + const hash = {}; + for (const item of arr) hash[item] = true; + return hash; + }; + var alwaysValidSchema = function (it, schema) { + if (typeof schema == 'boolean') return schema; + if (Object.keys(schema).length === 0) return true; + checkUnknownRules(it, schema); + return !schemaHasRules(schema, it.self.RULES.all); + }; + var checkUnknownRules = function (it, schema = it.schema) { + const { opts, self: self2 } = it; + if (!opts.strictSchema) return; + if (typeof schema === 'boolean') return; + const rules = self2.RULES.keywords; + for (const key in schema) { + if (!rules[key]) checkStrictMode(it, `unknown keyword: "${key}"`); + } + }; + var schemaHasRules = function (schema, rules) { + if (typeof schema == 'boolean') return !schema; + for (const key in schema) if (rules[key]) return true; + return false; + }; + var schemaHasRulesButRef = function (schema, RULES) { + if (typeof schema == 'boolean') return !schema; + for (const key in schema) + if (key !== '$ref' && RULES.all[key]) return true; + return false; + }; + var schemaRefOrVal = function ( + { topSchemaRef, schemaPath }, + schema, + keyword, + $data + ) { + if (!$data) { + if (typeof schema == 'number' || typeof schema == 'boolean') + return schema; + if (typeof schema == 'string') return (0, codegen_1._)`${schema}`; + } + return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, + codegen_1.getProperty)(keyword)}`; + }; + var unescapeFragment = function (str) { + return unescapeJsonPointer(decodeURIComponent(str)); + }; + var escapeFragment = function (str) { + return encodeURIComponent(escapeJsonPointer(str)); + }; + var escapeJsonPointer = function (str) { + if (typeof str == 'number') return `${str}`; + return str.replace(/~/g, '~0').replace(/\//g, '~1'); + }; + var unescapeJsonPointer = function (str) { + return str.replace(/~1/g, '/').replace(/~0/g, '~'); + }; + var eachItem = function (xs, f) { + if (Array.isArray(xs)) { + for (const x of xs) f(x); + } else { + f(xs); + } + }; + var makeMergeEvaluated = function ({ + mergeNames, + mergeToName, + mergeValues, + resultToName, + }) { + return (gen, from, to, toName) => { + const res = + to === undefined + ? from + : to instanceof codegen_1.Name + ? (from instanceof codegen_1.Name + ? mergeNames(gen, from, to) + : mergeToName(gen, from, to), + to) + : from instanceof codegen_1.Name + ? (mergeToName(gen, to, from), from) + : mergeValues(from, to); + return toName === codegen_1.Name && !(res instanceof codegen_1.Name) + ? resultToName(gen, res) + : res; + }; + }; + var evaluatedPropsToName = function (gen, ps) { + if (ps === true) return gen.var('props', true); + const props = gen.var('props', (0, codegen_1._)`{}`); + if (ps !== undefined) setEvaluated(gen, props, ps); + return props; + }; + var setEvaluated = function (gen, props, ps) { + Object.keys(ps).forEach((p) => + gen.assign( + (0, codegen_1._)`${props}${(0, codegen_1.getProperty)(p)}`, + true + ) + ); + }; + var useFunc = function (gen, f) { + return gen.scopeValue('func', { + ref: f, + code: + snippets[f.code] || + (snippets[f.code] = new code_1._Code(f.code)), + }); + }; + var getErrorPath = function (dataProp, dataPropType, jsPropertySyntax) { + if (dataProp instanceof codegen_1.Name) { + const isNumber = dataPropType === Type.Num; + return jsPropertySyntax + ? isNumber + ? (0, codegen_1._)`"[" + ${dataProp} + "]"` + : (0, codegen_1._)`"['" + ${dataProp} + "']"` + : isNumber + ? (0, codegen_1._)`"/" + ${dataProp}` + : (0, + codegen_1._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`; + } + return jsPropertySyntax + ? (0, codegen_1.getProperty)(dataProp).toString() + : '/' + escapeJsonPointer(dataProp); + }; + var checkStrictMode = function (it, msg, mode = it.opts.strictSchema) { + if (!mode) return; + msg = `strict mode: ${msg}`; + if (mode === true) throw new Error(msg); + it.self.logger.warn(msg); + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.checkStrictMode = + exports.getErrorPath = + exports.Type = + exports.useFunc = + exports.setEvaluated = + exports.evaluatedPropsToName = + exports.mergeEvaluated = + exports.eachItem = + exports.unescapeJsonPointer = + exports.escapeJsonPointer = + exports.escapeFragment = + exports.unescapeFragment = + exports.schemaRefOrVal = + exports.schemaHasRulesButRef = + exports.schemaHasRules = + exports.checkUnknownRules = + exports.alwaysValidSchema = + exports.toHash = + undefined; + var codegen_1 = require_codegen(); + var code_1 = require_code(); + exports.toHash = toHash; + exports.alwaysValidSchema = alwaysValidSchema; + exports.checkUnknownRules = checkUnknownRules; + exports.schemaHasRules = schemaHasRules; + exports.schemaHasRulesButRef = schemaHasRulesButRef; + exports.schemaRefOrVal = schemaRefOrVal; + exports.unescapeFragment = unescapeFragment; + exports.escapeFragment = escapeFragment; + exports.escapeJsonPointer = escapeJsonPointer; + exports.unescapeJsonPointer = unescapeJsonPointer; + exports.eachItem = eachItem; + exports.mergeEvaluated = { + props: makeMergeEvaluated({ + mergeNames: (gen, from, to) => + gen.if( + (0, codegen_1._)`${to} !== true && ${from} !== undefined`, + () => { + gen.if( + (0, codegen_1._)`${from} === true`, + () => gen.assign(to, true), + () => + gen + .assign(to, (0, codegen_1._)`${to} || {}`) + .code( + (0, + codegen_1._)`Object.assign(${to}, ${from})` + ) + ); + } + ), + mergeToName: (gen, from, to) => + gen.if((0, codegen_1._)`${to} !== true`, () => { + if (from === true) { + gen.assign(to, true); + } else { + gen.assign(to, (0, codegen_1._)`${to} || {}`); + setEvaluated(gen, to, from); + } + }), + mergeValues: (from, to) => + from === true ? true : { ...from, ...to }, + resultToName: evaluatedPropsToName, + }), + items: makeMergeEvaluated({ + mergeNames: (gen, from, to) => + gen.if( + (0, codegen_1._)`${to} !== true && ${from} !== undefined`, + () => + gen.assign( + to, + (0, + codegen_1._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}` + ) + ), + mergeToName: (gen, from, to) => + gen.if((0, codegen_1._)`${to} !== true`, () => + gen.assign( + to, + from === true + ? true + : (0, + codegen_1._)`${to} > ${from} ? ${to} : ${from}` + ) + ), + mergeValues: (from, to) => + from === true ? true : Math.max(from, to), + resultToName: (gen, items) => gen.var('items', items), + }), + }; + exports.evaluatedPropsToName = evaluatedPropsToName; + exports.setEvaluated = setEvaluated; + var snippets = {}; + exports.useFunc = useFunc; + var Type; + (function (Type2) { + Type2[(Type2['Num'] = 0)] = 'Num'; + Type2[(Type2['Str'] = 1)] = 'Str'; + })((Type = exports.Type || (exports.Type = {}))); + exports.getErrorPath = getErrorPath; + exports.checkStrictMode = checkStrictMode; +}); + +// ../../../node_modules/ajv/dist/compile/names.js +var require_names = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var names = { + data: new codegen_1.Name('data'), + valCxt: new codegen_1.Name('valCxt'), + instancePath: new codegen_1.Name('instancePath'), + parentData: new codegen_1.Name('parentData'), + parentDataProperty: new codegen_1.Name('parentDataProperty'), + rootData: new codegen_1.Name('rootData'), + dynamicAnchors: new codegen_1.Name('dynamicAnchors'), + vErrors: new codegen_1.Name('vErrors'), + errors: new codegen_1.Name('errors'), + this: new codegen_1.Name('this'), + self: new codegen_1.Name('self'), + scope: new codegen_1.Name('scope'), + json: new codegen_1.Name('json'), + jsonPos: new codegen_1.Name('jsonPos'), + jsonLen: new codegen_1.Name('jsonLen'), + jsonPart: new codegen_1.Name('jsonPart'), + }; + exports.default = names; +}); + +// ../../../node_modules/ajv/dist/compile/errors.js +var require_errors = __commonJS((exports) => { + var reportError = function ( + cxt, + error = exports.keywordError, + errorPaths, + overrideAllErrors + ) { + const { it } = cxt; + const { gen, compositeRule, allErrors } = it; + const errObj = errorObjectCode(cxt, error, errorPaths); + if ( + overrideAllErrors !== null && overrideAllErrors !== undefined + ? overrideAllErrors + : compositeRule || allErrors + ) { + addError(gen, errObj); + } else { + returnErrors(it, (0, codegen_1._)`[${errObj}]`); + } + }; + var reportExtraError = function ( + cxt, + error = exports.keywordError, + errorPaths + ) { + const { it } = cxt; + const { gen, compositeRule, allErrors } = it; + const errObj = errorObjectCode(cxt, error, errorPaths); + addError(gen, errObj); + if (!(compositeRule || allErrors)) { + returnErrors(it, names_1.default.vErrors); + } + }; + var resetErrorsCount = function (gen, errsCount) { + gen.assign(names_1.default.errors, errsCount); + gen.if((0, codegen_1._)`${names_1.default.vErrors} !== null`, () => + gen.if( + errsCount, + () => + gen.assign( + (0, codegen_1._)`${names_1.default.vErrors}.length`, + errsCount + ), + () => gen.assign(names_1.default.vErrors, null) + ) + ); + }; + var extendErrors = function ({ + gen, + keyword, + schemaValue, + data, + errsCount, + it, + }) { + if (errsCount === undefined) + throw new Error('ajv implementation error'); + const err = gen.name('err'); + gen.forRange('i', errsCount, names_1.default.errors, (i) => { + gen.const(err, (0, codegen_1._)`${names_1.default.vErrors}[${i}]`); + gen.if((0, codegen_1._)`${err}.instancePath === undefined`, () => + gen.assign( + (0, codegen_1._)`${err}.instancePath`, + (0, codegen_1.strConcat)( + names_1.default.instancePath, + it.errorPath + ) + ) + ); + gen.assign( + (0, codegen_1._)`${err}.schemaPath`, + (0, codegen_1.str)`${it.errSchemaPath}/${keyword}` + ); + if (it.opts.verbose) { + gen.assign((0, codegen_1._)`${err}.schema`, schemaValue); + gen.assign((0, codegen_1._)`${err}.data`, data); + } + }); + }; + var addError = function (gen, errObj) { + const err = gen.const('err', errObj); + gen.if( + (0, codegen_1._)`${names_1.default.vErrors} === null`, + () => + gen.assign(names_1.default.vErrors, (0, codegen_1._)`[${err}]`), + (0, codegen_1._)`${names_1.default.vErrors}.push(${err})` + ); + gen.code((0, codegen_1._)`${names_1.default.errors}++`); + }; + var returnErrors = function (it, errs) { + const { gen, validateName, schemaEnv } = it; + if (schemaEnv.$async) { + gen.throw((0, codegen_1._)`new ${it.ValidationError}(${errs})`); + } else { + gen.assign((0, codegen_1._)`${validateName}.errors`, errs); + gen.return(false); + } + }; + var errorObjectCode = function (cxt, error, errorPaths) { + const { createErrors } = cxt.it; + if (createErrors === false) return (0, codegen_1._)`{}`; + return errorObject(cxt, error, errorPaths); + }; + var errorObject = function (cxt, error, errorPaths = {}) { + const { gen, it } = cxt; + const keyValues = [ + errorInstancePath(it, errorPaths), + errorSchemaPath(cxt, errorPaths), + ]; + extraErrorProps(cxt, error, keyValues); + return gen.object(...keyValues); + }; + var errorInstancePath = function ({ errorPath }, { instancePath }) { + const instPath = instancePath + ? (0, codegen_1.str)`${errorPath}${(0, util_1.getErrorPath)( + instancePath, + util_1.Type.Str + )}` + : errorPath; + return [ + names_1.default.instancePath, + (0, codegen_1.strConcat)(names_1.default.instancePath, instPath), + ]; + }; + var errorSchemaPath = function ( + { keyword, it: { errSchemaPath } }, + { schemaPath, parentSchema } + ) { + let schPath = parentSchema + ? errSchemaPath + : (0, codegen_1.str)`${errSchemaPath}/${keyword}`; + if (schemaPath) { + schPath = (0, codegen_1.str)`${schPath}${(0, util_1.getErrorPath)( + schemaPath, + util_1.Type.Str + )}`; + } + return [E.schemaPath, schPath]; + }; + var extraErrorProps = function (cxt, { params, message }, keyValues) { + const { keyword, data, schemaValue, it } = cxt; + const { opts, propertyName, topSchemaRef, schemaPath } = it; + keyValues.push( + [E.keyword, keyword], + [ + E.params, + typeof params == 'function' + ? params(cxt) + : params || (0, codegen_1._)`{}`, + ] + ); + if (opts.messages) { + keyValues.push([ + E.message, + typeof message == 'function' ? message(cxt) : message, + ]); + } + if (opts.verbose) { + keyValues.push( + [E.schema, schemaValue], + [ + E.parentSchema, + (0, codegen_1._)`${topSchemaRef}${schemaPath}`, + ], + [names_1.default.data, data] + ); + } + if (propertyName) keyValues.push([E.propertyName, propertyName]); + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.extendErrors = + exports.resetErrorsCount = + exports.reportExtraError = + exports.reportError = + exports.keyword$DataError = + exports.keywordError = + undefined; + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var names_1 = require_names(); + exports.keywordError = { + message: ({ keyword }) => + (0, codegen_1.str)`must pass "${keyword}" keyword validation`, + }; + exports.keyword$DataError = { + message: ({ keyword, schemaType }) => + schemaType + ? (0, + codegen_1.str)`"${keyword}" keyword must be ${schemaType} ($data)` + : (0, codegen_1.str)`"${keyword}" keyword is invalid ($data)`, + }; + exports.reportError = reportError; + exports.reportExtraError = reportExtraError; + exports.resetErrorsCount = resetErrorsCount; + exports.extendErrors = extendErrors; + var E = { + keyword: new codegen_1.Name('keyword'), + schemaPath: new codegen_1.Name('schemaPath'), + params: new codegen_1.Name('params'), + propertyName: new codegen_1.Name('propertyName'), + message: new codegen_1.Name('message'), + schema: new codegen_1.Name('schema'), + parentSchema: new codegen_1.Name('parentSchema'), + }; +}); + +// ../../../node_modules/ajv/dist/compile/validate/boolSchema.js +var require_boolSchema = __commonJS((exports) => { + var topBoolOrEmptySchema = function (it) { + const { gen, schema, validateName } = it; + if (schema === false) { + falseSchemaError(it, false); + } else if (typeof schema == 'object' && schema.$async === true) { + gen.return(names_1.default.data); + } else { + gen.assign((0, codegen_1._)`${validateName}.errors`, null); + gen.return(true); + } + }; + var boolOrEmptySchema = function (it, valid) { + const { gen, schema } = it; + if (schema === false) { + gen.var(valid, false); + falseSchemaError(it); + } else { + gen.var(valid, true); + } + }; + var falseSchemaError = function (it, overrideAllErrors) { + const { gen, data } = it; + const cxt = { + gen, + keyword: 'false schema', + data, + schema: false, + schemaCode: false, + schemaValue: false, + params: {}, + it, + }; + (0, errors_1.reportError)(cxt, boolError, undefined, overrideAllErrors); + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = undefined; + var errors_1 = require_errors(); + var codegen_1 = require_codegen(); + var names_1 = require_names(); + var boolError = { + message: 'boolean schema is false', + }; + exports.topBoolOrEmptySchema = topBoolOrEmptySchema; + exports.boolOrEmptySchema = boolOrEmptySchema; +}); + +// ../../../node_modules/ajv/dist/compile/rules.js +var require_rules = __commonJS((exports) => { + var isJSONType = function (x) { + return typeof x == 'string' && jsonTypes.has(x); + }; + var getRules = function () { + const groups = { + number: { type: 'number', rules: [] }, + string: { type: 'string', rules: [] }, + array: { type: 'array', rules: [] }, + object: { type: 'object', rules: [] }, + }; + return { + types: { ...groups, integer: true, boolean: true, null: true }, + rules: [ + { rules: [] }, + groups.number, + groups.string, + groups.array, + groups.object, + ], + post: { rules: [] }, + all: {}, + keywords: {}, + }; + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.getRules = exports.isJSONType = undefined; + var _jsonTypes = [ + 'string', + 'number', + 'integer', + 'boolean', + 'null', + 'object', + 'array', + ]; + var jsonTypes = new Set(_jsonTypes); + exports.isJSONType = isJSONType; + exports.getRules = getRules; +}); + +// ../../../node_modules/ajv/dist/compile/validate/applicability.js +var require_applicability = __commonJS((exports) => { + var schemaHasRulesForType = function ({ schema, self: self2 }, type) { + const group = self2.RULES.types[type]; + return group && group !== true && shouldUseGroup(schema, group); + }; + var shouldUseGroup = function (schema, group) { + return group.rules.some((rule) => shouldUseRule(schema, rule)); + }; + var shouldUseRule = function (schema, rule) { + var _a; + return ( + schema[rule.keyword] !== undefined || + ((_a = rule.definition.implements) === null || _a === undefined + ? undefined + : _a.some((kwd) => schema[kwd] !== undefined)) + ); + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.shouldUseRule = + exports.shouldUseGroup = + exports.schemaHasRulesForType = + undefined; + exports.schemaHasRulesForType = schemaHasRulesForType; + exports.shouldUseGroup = shouldUseGroup; + exports.shouldUseRule = shouldUseRule; +}); + +// ../../../node_modules/ajv/dist/compile/validate/dataType.js +var require_dataType = __commonJS((exports) => { + var getSchemaTypes = function (schema) { + const types5 = getJSONTypes(schema.type); + const hasNull = types5.includes('null'); + if (hasNull) { + if (schema.nullable === false) + throw new Error('type: null contradicts nullable: false'); + } else { + if (!types5.length && schema.nullable !== undefined) { + throw new Error('"nullable" cannot be used without "type"'); + } + if (schema.nullable === true) types5.push('null'); + } + return types5; + }; + var getJSONTypes = function (ts) { + const types5 = Array.isArray(ts) ? ts : ts ? [ts] : []; + if (types5.every(rules_1.isJSONType)) return types5; + throw new Error( + 'type must be JSONType or JSONType[]: ' + types5.join(',') + ); + }; + var coerceAndCheckDataType = function (it, types5) { + const { gen, data, opts } = it; + const coerceTo = coerceToTypes(types5, opts.coerceTypes); + const checkTypes = + types5.length > 0 && + !( + coerceTo.length === 0 && + types5.length === 1 && + (0, applicability_1.schemaHasRulesForType)(it, types5[0]) + ); + if (checkTypes) { + const wrongType = checkDataTypes( + types5, + data, + opts.strictNumbers, + DataType.Wrong + ); + gen.if(wrongType, () => { + if (coerceTo.length) coerceData(it, types5, coerceTo); + else reportTypeError(it); + }); + } + return checkTypes; + }; + var coerceToTypes = function (types5, coerceTypes) { + return coerceTypes + ? types5.filter( + (t) => + COERCIBLE.has(t) || + (coerceTypes === 'array' && t === 'array') + ) + : []; + }; + var coerceData = function (it, types5, coerceTo) { + const { gen, data, opts } = it; + const dataType = gen.let('dataType', (0, codegen_1._)`typeof ${data}`); + const coerced = gen.let('coerced', (0, codegen_1._)`undefined`); + if (opts.coerceTypes === 'array') { + gen.if( + (0, + codegen_1._)`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, + () => + gen + .assign(data, (0, codegen_1._)`${data}[0]`) + .assign(dataType, (0, codegen_1._)`typeof ${data}`) + .if( + checkDataTypes(types5, data, opts.strictNumbers), + () => gen.assign(coerced, data) + ) + ); + } + gen.if((0, codegen_1._)`${coerced} !== undefined`); + for (const t of coerceTo) { + if ( + COERCIBLE.has(t) || + (t === 'array' && opts.coerceTypes === 'array') + ) { + coerceSpecificType(t); + } + } + gen.else(); + reportTypeError(it); + gen.endIf(); + gen.if((0, codegen_1._)`${coerced} !== undefined`, () => { + gen.assign(data, coerced); + assignParentData(it, coerced); + }); + function coerceSpecificType(t) { + switch (t) { + case 'string': + gen.elseIf( + (0, + codegen_1._)`${dataType} == "number" || ${dataType} == "boolean"` + ) + .assign(coerced, (0, codegen_1._)`"" + ${data}`) + .elseIf((0, codegen_1._)`${data} === null`) + .assign(coerced, (0, codegen_1._)`""`); + return; + case 'number': + gen.elseIf( + (0, + codegen_1._)`${dataType} == "boolean" || ${data} === null + || (${dataType} == "string" && ${data} && ${data} == +${data})` + ).assign(coerced, (0, codegen_1._)`+${data}`); + return; + case 'integer': + gen.elseIf( + (0, + codegen_1._)`${dataType} === "boolean" || ${data} === null + || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))` + ).assign(coerced, (0, codegen_1._)`+${data}`); + return; + case 'boolean': + gen.elseIf( + (0, + codegen_1._)`${data} === "false" || ${data} === 0 || ${data} === null` + ) + .assign(coerced, false) + .elseIf( + (0, + codegen_1._)`${data} === "true" || ${data} === 1` + ) + .assign(coerced, true); + return; + case 'null': + gen.elseIf( + (0, + codegen_1._)`${data} === "" || ${data} === 0 || ${data} === false` + ); + gen.assign(coerced, null); + return; + case 'array': + gen.elseIf( + (0, + codegen_1._)`${dataType} === "string" || ${dataType} === "number" + || ${dataType} === "boolean" || ${data} === null` + ).assign(coerced, (0, codegen_1._)`[${data}]`); + } + } + }; + var assignParentData = function ( + { gen, parentData, parentDataProperty }, + expr + ) { + gen.if((0, codegen_1._)`${parentData} !== undefined`, () => + gen.assign( + (0, codegen_1._)`${parentData}[${parentDataProperty}]`, + expr + ) + ); + }; + var checkDataType = function ( + dataType, + data, + strictNums, + correct = DataType.Correct + ) { + const EQ = + correct === DataType.Correct + ? codegen_1.operators.EQ + : codegen_1.operators.NEQ; + let cond; + switch (dataType) { + case 'null': + return (0, codegen_1._)`${data} ${EQ} null`; + case 'array': + cond = (0, codegen_1._)`Array.isArray(${data})`; + break; + case 'object': + cond = (0, + codegen_1._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`; + break; + case 'integer': + cond = numCond( + (0, codegen_1._)`!(${data} % 1) && !isNaN(${data})` + ); + break; + case 'number': + cond = numCond(); + break; + default: + return (0, codegen_1._)`typeof ${data} ${EQ} ${dataType}`; + } + return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond); + function numCond(_cond = codegen_1.nil) { + return (0, codegen_1.and)( + (0, codegen_1._)`typeof ${data} == "number"`, + _cond, + strictNums ? (0, codegen_1._)`isFinite(${data})` : codegen_1.nil + ); + } + }; + var checkDataTypes = function (dataTypes, data, strictNums, correct) { + if (dataTypes.length === 1) { + return checkDataType(dataTypes[0], data, strictNums, correct); + } + let cond; + const types5 = (0, util_1.toHash)(dataTypes); + if (types5.array && types5.object) { + const notObj = (0, codegen_1._)`typeof ${data} != "object"`; + cond = types5.null + ? notObj + : (0, codegen_1._)`!${data} || ${notObj}`; + delete types5.null; + delete types5.array; + delete types5.object; + } else { + cond = codegen_1.nil; + } + if (types5.number) delete types5.integer; + for (const t in types5) + cond = (0, codegen_1.and)( + cond, + checkDataType(t, data, strictNums, correct) + ); + return cond; + }; + var reportTypeError = function (it) { + const cxt = getTypeErrorContext(it); + (0, errors_1.reportError)(cxt, typeError); + }; + var getTypeErrorContext = function (it) { + const { gen, data, schema } = it; + const schemaCode = (0, util_1.schemaRefOrVal)(it, schema, 'type'); + return { + gen, + keyword: 'type', + data, + schema: schema.type, + schemaCode, + schemaValue: schemaCode, + parentSchema: schema, + params: {}, + it, + }; + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.reportTypeError = + exports.checkDataTypes = + exports.checkDataType = + exports.coerceAndCheckDataType = + exports.getJSONTypes = + exports.getSchemaTypes = + exports.DataType = + undefined; + var rules_1 = require_rules(); + var applicability_1 = require_applicability(); + var errors_1 = require_errors(); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var DataType; + (function (DataType2) { + DataType2[(DataType2['Correct'] = 0)] = 'Correct'; + DataType2[(DataType2['Wrong'] = 1)] = 'Wrong'; + })((DataType = exports.DataType || (exports.DataType = {}))); + exports.getSchemaTypes = getSchemaTypes; + exports.getJSONTypes = getJSONTypes; + exports.coerceAndCheckDataType = coerceAndCheckDataType; + var COERCIBLE = new Set(['string', 'number', 'integer', 'boolean', 'null']); + exports.checkDataType = checkDataType; + exports.checkDataTypes = checkDataTypes; + var typeError = { + message: ({ schema }) => `must be ${schema}`, + params: ({ schema, schemaValue }) => + typeof schema == 'string' + ? (0, codegen_1._)`{type: ${schema}}` + : (0, codegen_1._)`{type: ${schemaValue}}`, + }; + exports.reportTypeError = reportTypeError; +}); + +// ../../../node_modules/ajv/dist/compile/validate/defaults.js +var require_defaults = __commonJS((exports) => { + var assignDefaults = function (it, ty) { + const { properties, items } = it.schema; + if (ty === 'object' && properties) { + for (const key in properties) { + assignDefault(it, key, properties[key].default); + } + } else if (ty === 'array' && Array.isArray(items)) { + items.forEach((sch, i) => assignDefault(it, i, sch.default)); + } + }; + var assignDefault = function (it, prop, defaultValue) { + const { gen, compositeRule, data, opts } = it; + if (defaultValue === undefined) return; + const childData = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)( + prop + )}`; + if (compositeRule) { + (0, util_1.checkStrictMode)( + it, + `default is ignored for: ${childData}` + ); + return; + } + let condition = (0, codegen_1._)`${childData} === undefined`; + if (opts.useDefaults === 'empty') { + condition = (0, + codegen_1._)`${condition} || ${childData} === null || ${childData} === ""`; + } + gen.if( + condition, + (0, codegen_1._)`${childData} = ${(0, codegen_1.stringify)( + defaultValue + )}` + ); + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.assignDefaults = undefined; + var codegen_1 = require_codegen(); + var util_1 = require_util(); + exports.assignDefaults = assignDefaults; +}); + +// ../../../node_modules/ajv/dist/vocabularies/code.js +var require_code2 = __commonJS((exports) => { + var checkReportMissingProp = function (cxt, prop) { + const { gen, data, it } = cxt; + gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => { + cxt.setParams({ missingProperty: (0, codegen_1._)`${prop}` }, true); + cxt.error(); + }); + }; + var checkMissingProp = function ( + { gen, data, it: { opts } }, + properties, + missing + ) { + return (0, codegen_1.or)( + ...properties.map((prop) => + (0, codegen_1.and)( + noPropertyInData(gen, data, prop, opts.ownProperties), + (0, codegen_1._)`${missing} = ${prop}` + ) + ) + ); + }; + var reportMissingProp = function (cxt, missing) { + cxt.setParams({ missingProperty: missing }, true); + cxt.error(); + }; + var hasPropFunc = function (gen) { + return gen.scopeValue('func', { + ref: Object.prototype.hasOwnProperty, + code: (0, codegen_1._)`Object.prototype.hasOwnProperty`, + }); + }; + var isOwnProperty = function (gen, data, property) { + return (0, codegen_1._)`${hasPropFunc(gen)}.call(${data}, ${property})`; + }; + var propertyInData = function (gen, data, property, ownProperties) { + const cond = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)( + property + )} !== undefined`; + return ownProperties + ? (0, codegen_1._)`${cond} && ${isOwnProperty(gen, data, property)}` + : cond; + }; + var noPropertyInData = function (gen, data, property, ownProperties) { + const cond = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)( + property + )} === undefined`; + return ownProperties + ? (0, codegen_1.or)( + cond, + (0, codegen_1.not)(isOwnProperty(gen, data, property)) + ) + : cond; + }; + var allSchemaProperties = function (schemaMap) { + return schemaMap + ? Object.keys(schemaMap).filter((p) => p !== '__proto__') + : []; + }; + var schemaProperties = function (it, schemaMap) { + return allSchemaProperties(schemaMap).filter( + (p) => !(0, util_1.alwaysValidSchema)(it, schemaMap[p]) + ); + }; + var callValidateCode = function ( + { + schemaCode, + data, + it: { gen, topSchemaRef, schemaPath, errorPath }, + it, + }, + func, + context, + passSchema + ) { + const dataAndSchema = passSchema + ? (0, + codegen_1._)`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` + : data; + const valCxt = [ + [ + names_1.default.instancePath, + (0, codegen_1.strConcat)( + names_1.default.instancePath, + errorPath + ), + ], + [names_1.default.parentData, it.parentData], + [names_1.default.parentDataProperty, it.parentDataProperty], + [names_1.default.rootData, names_1.default.rootData], + ]; + if (it.opts.dynamicRef) + valCxt.push([ + names_1.default.dynamicAnchors, + names_1.default.dynamicAnchors, + ]); + const args = (0, codegen_1._)`${dataAndSchema}, ${gen.object( + ...valCxt + )}`; + return context !== codegen_1.nil + ? (0, codegen_1._)`${func}.call(${context}, ${args})` + : (0, codegen_1._)`${func}(${args})`; + }; + var usePattern = function ({ gen, it: { opts } }, pattern) { + const u = opts.unicodeRegExp ? 'u' : ''; + const { regExp } = opts.code; + const rx = regExp(pattern, u); + return gen.scopeValue('pattern', { + key: rx.toString(), + ref: rx, + code: (0, codegen_1._)`${ + regExp.code === 'new RegExp' + ? newRegExp + : (0, util_2.useFunc)(gen, regExp) + }(${pattern}, ${u})`, + }); + }; + var validateArray = function (cxt) { + const { gen, data, keyword, it } = cxt; + const valid = gen.name('valid'); + if (it.allErrors) { + const validArr = gen.let('valid', true); + validateItems(() => gen.assign(validArr, false)); + return validArr; + } + gen.var(valid, true); + validateItems(() => gen.break()); + return valid; + function validateItems(notValid) { + const len = gen.const('len', (0, codegen_1._)`${data}.length`); + gen.forRange('i', 0, len, (i) => { + cxt.subschema( + { + keyword, + dataProp: i, + dataPropType: util_1.Type.Num, + }, + valid + ); + gen.if((0, codegen_1.not)(valid), notValid); + }); + } + }; + var validateUnion = function (cxt) { + const { gen, schema, keyword, it } = cxt; + if (!Array.isArray(schema)) throw new Error('ajv implementation error'); + const alwaysValid = schema.some((sch) => + (0, util_1.alwaysValidSchema)(it, sch) + ); + if (alwaysValid && !it.opts.unevaluated) return; + const valid = gen.let('valid', false); + const schValid = gen.name('_valid'); + gen.block(() => + schema.forEach((_sch, i) => { + const schCxt = cxt.subschema( + { + keyword, + schemaProp: i, + compositeRule: true, + }, + schValid + ); + gen.assign(valid, (0, codegen_1._)`${valid} || ${schValid}`); + const merged = cxt.mergeValidEvaluated(schCxt, schValid); + if (!merged) gen.if((0, codegen_1.not)(valid)); + }) + ); + cxt.result( + valid, + () => cxt.reset(), + () => cxt.error(true) + ); + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.validateUnion = + exports.validateArray = + exports.usePattern = + exports.callValidateCode = + exports.schemaProperties = + exports.allSchemaProperties = + exports.noPropertyInData = + exports.propertyInData = + exports.isOwnProperty = + exports.hasPropFunc = + exports.reportMissingProp = + exports.checkMissingProp = + exports.checkReportMissingProp = + undefined; + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var names_1 = require_names(); + var util_2 = require_util(); + exports.checkReportMissingProp = checkReportMissingProp; + exports.checkMissingProp = checkMissingProp; + exports.reportMissingProp = reportMissingProp; + exports.hasPropFunc = hasPropFunc; + exports.isOwnProperty = isOwnProperty; + exports.propertyInData = propertyInData; + exports.noPropertyInData = noPropertyInData; + exports.allSchemaProperties = allSchemaProperties; + exports.schemaProperties = schemaProperties; + exports.callValidateCode = callValidateCode; + var newRegExp = (0, codegen_1._)`new RegExp`; + exports.usePattern = usePattern; + exports.validateArray = validateArray; + exports.validateUnion = validateUnion; +}); + +// ../../../node_modules/ajv/dist/compile/validate/keyword.js +var require_keyword = __commonJS((exports) => { + var macroKeywordCode = function (cxt, def) { + const { gen, keyword, schema, parentSchema, it } = cxt; + const macroSchema = def.macro.call(it.self, schema, parentSchema, it); + const schemaRef = useKeyword(gen, keyword, macroSchema); + if (it.opts.validateSchema !== false) + it.self.validateSchema(macroSchema, true); + const valid = gen.name('valid'); + cxt.subschema( + { + schema: macroSchema, + schemaPath: codegen_1.nil, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + topSchemaRef: schemaRef, + compositeRule: true, + }, + valid + ); + cxt.pass(valid, () => cxt.error(true)); + }; + var funcKeywordCode = function (cxt, def) { + var _a; + const { gen, keyword, schema, parentSchema, $data, it } = cxt; + checkAsyncKeyword(it, def); + const validate = + !$data && def.compile + ? def.compile.call(it.self, schema, parentSchema, it) + : def.validate; + const validateRef = useKeyword(gen, keyword, validate); + const valid = gen.let('valid'); + cxt.block$data(valid, validateKeyword); + cxt.ok((_a = def.valid) !== null && _a !== undefined ? _a : valid); + function validateKeyword() { + if (def.errors === false) { + assignValid(); + if (def.modifying) modifyData(cxt); + reportErrs(() => cxt.error()); + } else { + const ruleErrs = def.async ? validateAsync() : validateSync(); + if (def.modifying) modifyData(cxt); + reportErrs(() => addErrs(cxt, ruleErrs)); + } + } + function validateAsync() { + const ruleErrs = gen.let('ruleErrs', null); + gen.try( + () => assignValid((0, codegen_1._)`await `), + (e) => + gen.assign(valid, false).if( + (0, codegen_1._)`${e} instanceof ${it.ValidationError}`, + () => + gen.assign(ruleErrs, (0, codegen_1._)`${e}.errors`), + () => gen.throw(e) + ) + ); + return ruleErrs; + } + function validateSync() { + const validateErrs = (0, codegen_1._)`${validateRef}.errors`; + gen.assign(validateErrs, null); + assignValid(codegen_1.nil); + return validateErrs; + } + function assignValid( + _await = def.async ? (0, codegen_1._)`await ` : codegen_1.nil + ) { + const passCxt = it.opts.passContext + ? names_1.default.this + : names_1.default.self; + const passSchema = !( + ('compile' in def && !$data) || + def.schema === false + ); + gen.assign( + valid, + (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)( + cxt, + validateRef, + passCxt, + passSchema + )}`, + def.modifying + ); + } + function reportErrs(errors) { + var _a2; + gen.if( + (0, codegen_1.not)( + (_a2 = def.valid) !== null && _a2 !== undefined + ? _a2 + : valid + ), + errors + ); + } + }; + var modifyData = function (cxt) { + const { gen, data, it } = cxt; + gen.if(it.parentData, () => + gen.assign( + data, + (0, codegen_1._)`${it.parentData}[${it.parentDataProperty}]` + ) + ); + }; + var addErrs = function (cxt, errs) { + const { gen } = cxt; + gen.if( + (0, codegen_1._)`Array.isArray(${errs})`, + () => { + gen.assign( + names_1.default.vErrors, + (0, + codegen_1._)`${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})` + ).assign( + names_1.default.errors, + (0, codegen_1._)`${names_1.default.vErrors}.length` + ); + (0, errors_1.extendErrors)(cxt); + }, + () => cxt.error() + ); + }; + var checkAsyncKeyword = function ({ schemaEnv }, def) { + if (def.async && !schemaEnv.$async) + throw new Error('async keyword in sync schema'); + }; + var useKeyword = function (gen, keyword, result) { + if (result === undefined) + throw new Error(`keyword "${keyword}" failed to compile`); + return gen.scopeValue( + 'keyword', + typeof result == 'function' + ? { ref: result } + : { ref: result, code: (0, codegen_1.stringify)(result) } + ); + }; + var validSchemaType = function ( + schema, + schemaType, + allowUndefined = false + ) { + return ( + !schemaType.length || + schemaType.some((st) => + st === 'array' + ? Array.isArray(schema) + : st === 'object' + ? schema && + typeof schema == 'object' && + !Array.isArray(schema) + : typeof schema == st || + (allowUndefined && typeof schema == 'undefined') + ) + ); + }; + var validateKeywordUsage = function ( + { schema, opts, self: self2, errSchemaPath }, + def, + keyword + ) { + if ( + Array.isArray(def.keyword) + ? !def.keyword.includes(keyword) + : def.keyword !== keyword + ) { + throw new Error('ajv implementation error'); + } + const deps = def.dependencies; + if ( + deps === null || deps === undefined + ? undefined + : deps.some( + (kwd) => + !Object.prototype.hasOwnProperty.call(schema, kwd) + ) + ) { + throw new Error( + `parent schema must have dependencies of ${keyword}: ${deps.join( + ',' + )}` + ); + } + if (def.validateSchema) { + const valid = def.validateSchema(schema[keyword]); + if (!valid) { + const msg = + `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + + self2.errorsText(def.validateSchema.errors); + if (opts.validateSchema === 'log') self2.logger.error(msg); + else throw new Error(msg); + } + } + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.validateKeywordUsage = + exports.validSchemaType = + exports.funcKeywordCode = + exports.macroKeywordCode = + undefined; + var codegen_1 = require_codegen(); + var names_1 = require_names(); + var code_1 = require_code2(); + var errors_1 = require_errors(); + exports.macroKeywordCode = macroKeywordCode; + exports.funcKeywordCode = funcKeywordCode; + exports.validSchemaType = validSchemaType; + exports.validateKeywordUsage = validateKeywordUsage; +}); + +// ../../../node_modules/ajv/dist/compile/validate/subschema.js +var require_subschema = __commonJS((exports) => { + var getSubschema = function ( + it, + { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef } + ) { + if (keyword !== undefined && schema !== undefined) { + throw new Error( + 'both "keyword" and "schema" passed, only one allowed' + ); + } + if (keyword !== undefined) { + const sch = it.schema[keyword]; + return schemaProp === undefined + ? { + schema: sch, + schemaPath: (0, codegen_1._)`${it.schemaPath}${(0, + codegen_1.getProperty)(keyword)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + } + : { + schema: sch[schemaProp], + schemaPath: (0, codegen_1._)`${it.schemaPath}${(0, + codegen_1.getProperty)(keyword)}${(0, + codegen_1.getProperty)(schemaProp)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, + util_1.escapeFragment)(schemaProp)}`, + }; + } + if (schema !== undefined) { + if ( + schemaPath === undefined || + errSchemaPath === undefined || + topSchemaRef === undefined + ) { + throw new Error( + '"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"' + ); + } + return { + schema, + schemaPath, + topSchemaRef, + errSchemaPath, + }; + } + throw new Error('either "keyword" or "schema" must be passed'); + }; + var extendSubschemaData = function ( + subschema, + it, + { dataProp, dataPropType: dpType, data, dataTypes, propertyName } + ) { + if (data !== undefined && dataProp !== undefined) { + throw new Error( + 'both "data" and "dataProp" passed, only one allowed' + ); + } + const { gen } = it; + if (dataProp !== undefined) { + const { errorPath, dataPathArr, opts } = it; + const nextData = gen.let( + 'data', + (0, codegen_1._)`${it.data}${(0, codegen_1.getProperty)( + dataProp + )}`, + true + ); + dataContextProps(nextData); + subschema.errorPath = (0, codegen_1.str)`${errorPath}${(0, + util_1.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`; + subschema.parentDataProperty = (0, codegen_1._)`${dataProp}`; + subschema.dataPathArr = [ + ...dataPathArr, + subschema.parentDataProperty, + ]; + } + if (data !== undefined) { + const nextData = + data instanceof codegen_1.Name + ? data + : gen.let('data', data, true); + dataContextProps(nextData); + if (propertyName !== undefined) + subschema.propertyName = propertyName; + } + if (dataTypes) subschema.dataTypes = dataTypes; + function dataContextProps(_nextData) { + subschema.data = _nextData; + subschema.dataLevel = it.dataLevel + 1; + subschema.dataTypes = []; + it.definedProperties = new Set(); + subschema.parentData = it.data; + subschema.dataNames = [...it.dataNames, _nextData]; + } + }; + var extendSubschemaMode = function ( + subschema, + { + jtdDiscriminator, + jtdMetadata, + compositeRule, + createErrors, + allErrors, + } + ) { + if (compositeRule !== undefined) + subschema.compositeRule = compositeRule; + if (createErrors !== undefined) subschema.createErrors = createErrors; + if (allErrors !== undefined) subschema.allErrors = allErrors; + subschema.jtdDiscriminator = jtdDiscriminator; + subschema.jtdMetadata = jtdMetadata; + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.extendSubschemaMode = + exports.extendSubschemaData = + exports.getSubschema = + undefined; + var codegen_1 = require_codegen(); + var util_1 = require_util(); + exports.getSubschema = getSubschema; + exports.extendSubschemaData = extendSubschemaData; + exports.extendSubschemaMode = extendSubschemaMode; +}); + +// ../../../node_modules/fast-deep-equal/index.js +var require_fast_deep_equal = __commonJS((exports, module) => { + module.exports = function equal(a, b) { + if (a === b) return true; + if (a && b && typeof a == 'object' && typeof b == 'object') { + if (a.constructor !== b.constructor) return false; + var length, i, keys; + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0; ) + if (!equal(a[i], b[i])) return false; + return true; + } + if (a.constructor === RegExp) + return a.source === b.source && a.flags === b.flags; + if (a.valueOf !== Object.prototype.valueOf) + return a.valueOf() === b.valueOf(); + if (a.toString !== Object.prototype.toString) + return a.toString() === b.toString(); + keys = Object.keys(a); + length = keys.length; + if (length !== Object.keys(b).length) return false; + for (i = length; i-- !== 0; ) + if (!Object.prototype.hasOwnProperty.call(b, keys[i])) + return false; + for (i = length; i-- !== 0; ) { + var key = keys[i]; + if (!equal(a[key], b[key])) return false; + } + return true; + } + return a !== a && b !== b; + }; +}); + +// ../../../node_modules/json-schema-traverse/index.js +var require_json_schema_traverse = __commonJS((exports, module) => { + var _traverse = function ( + opts, + pre, + post, + schema, + jsonPtr, + rootSchema, + parentJsonPtr, + parentKeyword, + parentSchema, + keyIndex + ) { + if (schema && typeof schema == 'object' && !Array.isArray(schema)) { + pre( + schema, + jsonPtr, + rootSchema, + parentJsonPtr, + parentKeyword, + parentSchema, + keyIndex + ); + for (var key in schema) { + var sch = schema[key]; + if (Array.isArray(sch)) { + if (key in traverse.arrayKeywords) { + for (var i = 0; i < sch.length; i++) + _traverse( + opts, + pre, + post, + sch[i], + jsonPtr + '/' + key + '/' + i, + rootSchema, + jsonPtr, + key, + schema, + i + ); + } + } else if (key in traverse.propsKeywords) { + if (sch && typeof sch == 'object') { + for (var prop in sch) + _traverse( + opts, + pre, + post, + sch[prop], + jsonPtr + '/' + key + '/' + escapeJsonPtr(prop), + rootSchema, + jsonPtr, + key, + schema, + prop + ); + } + } else if ( + key in traverse.keywords || + (opts.allKeys && !(key in traverse.skipKeywords)) + ) { + _traverse( + opts, + pre, + post, + sch, + jsonPtr + '/' + key, + rootSchema, + jsonPtr, + key, + schema + ); + } + } + post( + schema, + jsonPtr, + rootSchema, + parentJsonPtr, + parentKeyword, + parentSchema, + keyIndex + ); + } + }; + var escapeJsonPtr = function (str) { + return str.replace(/~/g, '~0').replace(/\//g, '~1'); + }; + var traverse = (module.exports = function (schema, opts, cb) { + if (typeof opts == 'function') { + cb = opts; + opts = {}; + } + cb = opts.cb || cb; + var pre = typeof cb == 'function' ? cb : cb.pre || function () {}; + var post = cb.post || function () {}; + _traverse(opts, pre, post, schema, '', schema); + }); + traverse.keywords = { + additionalItems: true, + items: true, + contains: true, + additionalProperties: true, + propertyNames: true, + not: true, + if: true, + then: true, + else: true, + }; + traverse.arrayKeywords = { + items: true, + allOf: true, + anyOf: true, + oneOf: true, + }; + traverse.propsKeywords = { + $defs: true, + definitions: true, + properties: true, + patternProperties: true, + dependencies: true, + }; + traverse.skipKeywords = { + default: true, + enum: true, + const: true, + required: true, + maximum: true, + minimum: true, + exclusiveMaximum: true, + exclusiveMinimum: true, + multipleOf: true, + maxLength: true, + minLength: true, + pattern: true, + format: true, + maxItems: true, + minItems: true, + uniqueItems: true, + maxProperties: true, + minProperties: true, + }; +}); + +// ../../../node_modules/ajv/dist/compile/resolve.js +var require_resolve = __commonJS((exports) => { + var inlineRef = function (schema, limit = true) { + if (typeof schema == 'boolean') return true; + if (limit === true) return !hasRef(schema); + if (!limit) return false; + return countKeys(schema) <= limit; + }; + var hasRef = function (schema) { + for (const key in schema) { + if (REF_KEYWORDS.has(key)) return true; + const sch = schema[key]; + if (Array.isArray(sch) && sch.some(hasRef)) return true; + if (typeof sch == 'object' && hasRef(sch)) return true; + } + return false; + }; + var countKeys = function (schema) { + let count = 0; + for (const key in schema) { + if (key === '$ref') return Infinity; + count++; + if (SIMPLE_INLINED.has(key)) continue; + if (typeof schema[key] == 'object') { + (0, util_1.eachItem)( + schema[key], + (sch) => (count += countKeys(sch)) + ); + } + if (count === Infinity) return Infinity; + } + return count; + }; + var getFullPath = function (resolver, id = '', normalize) { + if (normalize !== false) id = normalizeId(id); + const p = resolver.parse(id); + return _getFullPath(resolver, p); + }; + var _getFullPath = function (resolver, p) { + const serialized = resolver.serialize(p); + return serialized.split('#')[0] + '#'; + }; + var normalizeId = function (id) { + return id ? id.replace(TRAILING_SLASH_HASH, '') : ''; + }; + var resolveUrl = function (resolver, baseId, id) { + id = normalizeId(id); + return resolver.resolve(baseId, id); + }; + var getSchemaRefs = function (schema, baseId) { + if (typeof schema == 'boolean') return {}; + const { schemaId, uriResolver } = this.opts; + const schId = normalizeId(schema[schemaId] || baseId); + const baseIds = { '': schId }; + const pathPrefix = getFullPath(uriResolver, schId, false); + const localRefs = {}; + const schemaRefs = new Set(); + traverse( + schema, + { allKeys: true }, + (sch, jsonPtr, _, parentJsonPtr) => { + if (parentJsonPtr === undefined) return; + const fullPath = pathPrefix + jsonPtr; + let baseId2 = baseIds[parentJsonPtr]; + if (typeof sch[schemaId] == 'string') + baseId2 = addRef.call(this, sch[schemaId]); + addAnchor.call(this, sch.$anchor); + addAnchor.call(this, sch.$dynamicAnchor); + baseIds[jsonPtr] = baseId2; + function addRef(ref) { + const _resolve = this.opts.uriResolver.resolve; + ref = normalizeId(baseId2 ? _resolve(baseId2, ref) : ref); + if (schemaRefs.has(ref)) throw ambiguos(ref); + schemaRefs.add(ref); + let schOrRef = this.refs[ref]; + if (typeof schOrRef == 'string') + schOrRef = this.refs[schOrRef]; + if (typeof schOrRef == 'object') { + checkAmbiguosRef(sch, schOrRef.schema, ref); + } else if (ref !== normalizeId(fullPath)) { + if (ref[0] === '#') { + checkAmbiguosRef(sch, localRefs[ref], ref); + localRefs[ref] = sch; + } else { + this.refs[ref] = fullPath; + } + } + return ref; + } + function addAnchor(anchor) { + if (typeof anchor == 'string') { + if (!ANCHOR.test(anchor)) + throw new Error(`invalid anchor "${anchor}"`); + addRef.call(this, `#${anchor}`); + } + } + } + ); + return localRefs; + function checkAmbiguosRef(sch1, sch2, ref) { + if (sch2 !== undefined && !equal(sch1, sch2)) throw ambiguos(ref); + } + function ambiguos(ref) { + return new Error( + `reference "${ref}" resolves to more than one schema` + ); + } + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.getSchemaRefs = + exports.resolveUrl = + exports.normalizeId = + exports._getFullPath = + exports.getFullPath = + exports.inlineRef = + undefined; + var util_1 = require_util(); + var equal = require_fast_deep_equal(); + var traverse = require_json_schema_traverse(); + var SIMPLE_INLINED = new Set([ + 'type', + 'format', + 'pattern', + 'maxLength', + 'minLength', + 'maxProperties', + 'minProperties', + 'maxItems', + 'minItems', + 'maximum', + 'minimum', + 'uniqueItems', + 'multipleOf', + 'required', + 'enum', + 'const', + ]); + exports.inlineRef = inlineRef; + var REF_KEYWORDS = new Set([ + '$ref', + '$recursiveRef', + '$recursiveAnchor', + '$dynamicRef', + '$dynamicAnchor', + ]); + exports.getFullPath = getFullPath; + exports._getFullPath = _getFullPath; + var TRAILING_SLASH_HASH = /#\/?$/; + exports.normalizeId = normalizeId; + exports.resolveUrl = resolveUrl; + var ANCHOR = /^[a-z_][-a-z0-9._]*$/i; + exports.getSchemaRefs = getSchemaRefs; +}); + +// ../../../node_modules/ajv/dist/compile/validate/index.js +var require_validate = __commonJS((exports) => { + var validateFunctionCode = function (it) { + if (isSchemaObj(it)) { + checkKeywords(it); + if (schemaCxtHasRules(it)) { + topSchemaObjCode(it); + return; + } + } + validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it)); + }; + var validateFunction = function ( + { gen, validateName, schema, schemaEnv, opts }, + body + ) { + if (opts.code.es5) { + gen.func( + validateName, + (0, + codegen_1._)`${names_1.default.data}, ${names_1.default.valCxt}`, + schemaEnv.$async, + () => { + gen.code( + (0, codegen_1._)`"use strict"; ${funcSourceUrl( + schema, + opts + )}` + ); + destructureValCxtES5(gen, opts); + gen.code(body); + } + ); + } else { + gen.func( + validateName, + (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt( + opts + )}`, + schemaEnv.$async, + () => gen.code(funcSourceUrl(schema, opts)).code(body) + ); + } + }; + var destructureValCxt = function (opts) { + return (0, codegen_1._)`{${names_1.default.instancePath}="", ${ + names_1.default.parentData + }, ${names_1.default.parentDataProperty}, ${names_1.default.rootData}=${ + names_1.default.data + }${ + opts.dynamicRef + ? (0, codegen_1._)`, ${names_1.default.dynamicAnchors}={}` + : codegen_1.nil + }}={}`; + }; + var destructureValCxtES5 = function (gen, opts) { + gen.if( + names_1.default.valCxt, + () => { + gen.var( + names_1.default.instancePath, + (0, + codegen_1._)`${names_1.default.valCxt}.${names_1.default.instancePath}` + ); + gen.var( + names_1.default.parentData, + (0, + codegen_1._)`${names_1.default.valCxt}.${names_1.default.parentData}` + ); + gen.var( + names_1.default.parentDataProperty, + (0, + codegen_1._)`${names_1.default.valCxt}.${names_1.default.parentDataProperty}` + ); + gen.var( + names_1.default.rootData, + (0, + codegen_1._)`${names_1.default.valCxt}.${names_1.default.rootData}` + ); + if (opts.dynamicRef) + gen.var( + names_1.default.dynamicAnchors, + (0, + codegen_1._)`${names_1.default.valCxt}.${names_1.default.dynamicAnchors}` + ); + }, + () => { + gen.var(names_1.default.instancePath, (0, codegen_1._)`""`); + gen.var( + names_1.default.parentData, + (0, codegen_1._)`undefined` + ); + gen.var( + names_1.default.parentDataProperty, + (0, codegen_1._)`undefined` + ); + gen.var(names_1.default.rootData, names_1.default.data); + if (opts.dynamicRef) + gen.var( + names_1.default.dynamicAnchors, + (0, codegen_1._)`{}` + ); + } + ); + }; + var topSchemaObjCode = function (it) { + const { schema, opts, gen } = it; + validateFunction(it, () => { + if (opts.$comment && schema.$comment) commentKeyword(it); + checkNoDefault(it); + gen.let(names_1.default.vErrors, null); + gen.let(names_1.default.errors, 0); + if (opts.unevaluated) resetEvaluated(it); + typeAndKeywords(it); + returnResults(it); + }); + return; + }; + var resetEvaluated = function (it) { + const { gen, validateName } = it; + it.evaluated = gen.const( + 'evaluated', + (0, codegen_1._)`${validateName}.evaluated` + ); + gen.if((0, codegen_1._)`${it.evaluated}.dynamicProps`, () => + gen.assign( + (0, codegen_1._)`${it.evaluated}.props`, + (0, codegen_1._)`undefined` + ) + ); + gen.if((0, codegen_1._)`${it.evaluated}.dynamicItems`, () => + gen.assign( + (0, codegen_1._)`${it.evaluated}.items`, + (0, codegen_1._)`undefined` + ) + ); + }; + var funcSourceUrl = function (schema, opts) { + const schId = typeof schema == 'object' && schema[opts.schemaId]; + return schId && (opts.code.source || opts.code.process) + ? (0, codegen_1._)`/*# sourceURL=${schId} */` + : codegen_1.nil; + }; + var subschemaCode = function (it, valid) { + if (isSchemaObj(it)) { + checkKeywords(it); + if (schemaCxtHasRules(it)) { + subSchemaObjCode(it, valid); + return; + } + } + (0, boolSchema_1.boolOrEmptySchema)(it, valid); + }; + var schemaCxtHasRules = function ({ schema, self: self2 }) { + if (typeof schema == 'boolean') return !schema; + for (const key in schema) if (self2.RULES.all[key]) return true; + return false; + }; + var isSchemaObj = function (it) { + return typeof it.schema != 'boolean'; + }; + var subSchemaObjCode = function (it, valid) { + const { schema, gen, opts } = it; + if (opts.$comment && schema.$comment) commentKeyword(it); + updateContext(it); + checkAsyncSchema(it); + const errsCount = gen.const('_errs', names_1.default.errors); + typeAndKeywords(it, errsCount); + gen.var( + valid, + (0, codegen_1._)`${errsCount} === ${names_1.default.errors}` + ); + }; + var checkKeywords = function (it) { + (0, util_1.checkUnknownRules)(it); + checkRefsAndKeywords(it); + }; + var typeAndKeywords = function (it, errsCount) { + if (it.opts.jtd) return schemaKeywords(it, [], false, errsCount); + const types5 = (0, dataType_1.getSchemaTypes)(it.schema); + const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types5); + schemaKeywords(it, types5, !checkedTypes, errsCount); + }; + var checkRefsAndKeywords = function (it) { + const { schema, errSchemaPath, opts, self: self2 } = it; + if ( + schema.$ref && + opts.ignoreKeywordsWithRef && + (0, util_1.schemaHasRulesButRef)(schema, self2.RULES) + ) { + self2.logger.warn( + `\$ref: keywords ignored in schema at path "${errSchemaPath}"` + ); + } + }; + var checkNoDefault = function (it) { + const { schema, opts } = it; + if ( + schema.default !== undefined && + opts.useDefaults && + opts.strictSchema + ) { + (0, util_1.checkStrictMode)( + it, + 'default is ignored in the schema root' + ); + } + }; + var updateContext = function (it) { + const schId = it.schema[it.opts.schemaId]; + if (schId) + it.baseId = (0, resolve_1.resolveUrl)( + it.opts.uriResolver, + it.baseId, + schId + ); + }; + var checkAsyncSchema = function (it) { + if (it.schema.$async && !it.schemaEnv.$async) + throw new Error('async schema in sync schema'); + }; + var commentKeyword = function ({ + gen, + schemaEnv, + schema, + errSchemaPath, + opts, + }) { + const msg = schema.$comment; + if (opts.$comment === true) { + gen.code( + (0, codegen_1._)`${names_1.default.self}.logger.log(${msg})` + ); + } else if (typeof opts.$comment == 'function') { + const schemaPath = (0, codegen_1.str)`${errSchemaPath}/$comment`; + const rootName = gen.scopeValue('root', { ref: schemaEnv.root }); + gen.code( + (0, + codegen_1._)`${names_1.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)` + ); + } + }; + var returnResults = function (it) { + const { gen, schemaEnv, validateName, ValidationError, opts } = it; + if (schemaEnv.$async) { + gen.if( + (0, codegen_1._)`${names_1.default.errors} === 0`, + () => gen.return(names_1.default.data), + () => + gen.throw( + (0, + codegen_1._)`new ${ValidationError}(${names_1.default.vErrors})` + ) + ); + } else { + gen.assign( + (0, codegen_1._)`${validateName}.errors`, + names_1.default.vErrors + ); + if (opts.unevaluated) assignEvaluated(it); + gen.return((0, codegen_1._)`${names_1.default.errors} === 0`); + } + }; + var assignEvaluated = function ({ gen, evaluated, props, items }) { + if (props instanceof codegen_1.Name) + gen.assign((0, codegen_1._)`${evaluated}.props`, props); + if (items instanceof codegen_1.Name) + gen.assign((0, codegen_1._)`${evaluated}.items`, items); + }; + var schemaKeywords = function (it, types5, typeErrors, errsCount) { + const { gen, schema, data, allErrors, opts, self: self2 } = it; + const { RULES } = self2; + if ( + schema.$ref && + (opts.ignoreKeywordsWithRef || + !(0, util_1.schemaHasRulesButRef)(schema, RULES)) + ) { + gen.block(() => keywordCode(it, '$ref', RULES.all.$ref.definition)); + return; + } + if (!opts.jtd) checkStrictTypes(it, types5); + gen.block(() => { + for (const group of RULES.rules) groupKeywords(group); + groupKeywords(RULES.post); + }); + function groupKeywords(group) { + if (!(0, applicability_1.shouldUseGroup)(schema, group)) return; + if (group.type) { + gen.if( + (0, dataType_2.checkDataType)( + group.type, + data, + opts.strictNumbers + ) + ); + iterateKeywords(it, group); + if ( + types5.length === 1 && + types5[0] === group.type && + typeErrors + ) { + gen.else(); + (0, dataType_2.reportTypeError)(it); + } + gen.endIf(); + } else { + iterateKeywords(it, group); + } + if (!allErrors) + gen.if( + (0, codegen_1._)`${names_1.default.errors} === ${ + errsCount || 0 + }` + ); + } + }; + var iterateKeywords = function (it, group) { + const { + gen, + schema, + opts: { useDefaults }, + } = it; + if (useDefaults) (0, defaults_1.assignDefaults)(it, group.type); + gen.block(() => { + for (const rule of group.rules) { + if ((0, applicability_1.shouldUseRule)(schema, rule)) { + keywordCode(it, rule.keyword, rule.definition, group.type); + } + } + }); + }; + var checkStrictTypes = function (it, types5) { + if (it.schemaEnv.meta || !it.opts.strictTypes) return; + checkContextTypes(it, types5); + if (!it.opts.allowUnionTypes) checkMultipleTypes(it, types5); + checkKeywordTypes(it, it.dataTypes); + }; + var checkContextTypes = function (it, types5) { + if (!types5.length) return; + if (!it.dataTypes.length) { + it.dataTypes = types5; + return; + } + types5.forEach((t) => { + if (!includesType(it.dataTypes, t)) { + strictTypesError( + it, + `type "${t}" not allowed by context "${it.dataTypes.join( + ',' + )}"` + ); + } + }); + narrowSchemaTypes(it, types5); + }; + var checkMultipleTypes = function (it, ts) { + if (ts.length > 1 && !(ts.length === 2 && ts.includes('null'))) { + strictTypesError( + it, + 'use allowUnionTypes to allow union type keyword' + ); + } + }; + var checkKeywordTypes = function (it, ts) { + const rules = it.self.RULES.all; + for (const keyword in rules) { + const rule = rules[keyword]; + if ( + typeof rule == 'object' && + (0, applicability_1.shouldUseRule)(it.schema, rule) + ) { + const { type } = rule.definition; + if ( + type.length && + !type.some((t) => hasApplicableType(ts, t)) + ) { + strictTypesError( + it, + `missing type "${type.join( + ',' + )}" for keyword "${keyword}"` + ); + } + } + } + }; + var hasApplicableType = function (schTs, kwdT) { + return ( + schTs.includes(kwdT) || + (kwdT === 'number' && schTs.includes('integer')) + ); + }; + var includesType = function (ts, t) { + return ts.includes(t) || (t === 'integer' && ts.includes('number')); + }; + var narrowSchemaTypes = function (it, withTypes) { + const ts = []; + for (const t of it.dataTypes) { + if (includesType(withTypes, t)) ts.push(t); + else if (withTypes.includes('integer') && t === 'number') + ts.push('integer'); + } + it.dataTypes = ts; + }; + var strictTypesError = function (it, msg) { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath; + msg += ` at "${schemaPath}" (strictTypes)`; + (0, util_1.checkStrictMode)(it, msg, it.opts.strictTypes); + }; + var keywordCode = function (it, keyword, def, ruleType) { + const cxt = new KeywordCxt(it, def, keyword); + if ('code' in def) { + def.code(cxt, ruleType); + } else if (cxt.$data && def.validate) { + (0, keyword_1.funcKeywordCode)(cxt, def); + } else if ('macro' in def) { + (0, keyword_1.macroKeywordCode)(cxt, def); + } else if (def.compile || def.validate) { + (0, keyword_1.funcKeywordCode)(cxt, def); + } + }; + var getData = function ($data, { dataLevel, dataNames, dataPathArr }) { + let jsonPointer; + let data; + if ($data === '') return names_1.default.rootData; + if ($data[0] === '/') { + if (!JSON_POINTER.test($data)) + throw new Error(`Invalid JSON-pointer: ${$data}`); + jsonPointer = $data; + data = names_1.default.rootData; + } else { + const matches = RELATIVE_JSON_POINTER.exec($data); + if (!matches) throw new Error(`Invalid JSON-pointer: ${$data}`); + const up = +matches[1]; + jsonPointer = matches[2]; + if (jsonPointer === '#') { + if (up >= dataLevel) + throw new Error(errorMsg('property/index', up)); + return dataPathArr[dataLevel - up]; + } + if (up > dataLevel) throw new Error(errorMsg('data', up)); + data = dataNames[dataLevel - up]; + if (!jsonPointer) return data; + } + let expr = data; + const segments = jsonPointer.split('/'); + for (const segment of segments) { + if (segment) { + data = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)( + (0, util_1.unescapeJsonPointer)(segment) + )}`; + expr = (0, codegen_1._)`${expr} && ${data}`; + } + } + return expr; + function errorMsg(pointerType, up) { + return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`; + } + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.getData = + exports.KeywordCxt = + exports.validateFunctionCode = + undefined; + var boolSchema_1 = require_boolSchema(); + var dataType_1 = require_dataType(); + var applicability_1 = require_applicability(); + var dataType_2 = require_dataType(); + var defaults_1 = require_defaults(); + var keyword_1 = require_keyword(); + var subschema_1 = require_subschema(); + var codegen_1 = require_codegen(); + var names_1 = require_names(); + var resolve_1 = require_resolve(); + var util_1 = require_util(); + var errors_1 = require_errors(); + exports.validateFunctionCode = validateFunctionCode; + + class KeywordCxt { + constructor(it, def, keyword) { + (0, keyword_1.validateKeywordUsage)(it, def, keyword); + this.gen = it.gen; + this.allErrors = it.allErrors; + this.keyword = keyword; + this.data = it.data; + this.schema = it.schema[keyword]; + this.$data = + def.$data && it.opts.$data && this.schema && this.schema.$data; + this.schemaValue = (0, util_1.schemaRefOrVal)( + it, + this.schema, + keyword, + this.$data + ); + this.schemaType = def.schemaType; + this.parentSchema = it.schema; + this.params = {}; + this.it = it; + this.def = def; + if (this.$data) { + this.schemaCode = it.gen.const( + 'vSchema', + getData(this.$data, it) + ); + } else { + this.schemaCode = this.schemaValue; + if ( + !(0, keyword_1.validSchemaType)( + this.schema, + def.schemaType, + def.allowUndefined + ) + ) { + throw new Error( + `${keyword} value must be ${JSON.stringify( + def.schemaType + )}` + ); + } + } + if ('code' in def ? def.trackErrors : def.errors !== false) { + this.errsCount = it.gen.const('_errs', names_1.default.errors); + } + } + result(condition, successAction, failAction) { + this.failResult( + (0, codegen_1.not)(condition), + successAction, + failAction + ); + } + failResult(condition, successAction, failAction) { + this.gen.if(condition); + if (failAction) failAction(); + else this.error(); + if (successAction) { + this.gen.else(); + successAction(); + if (this.allErrors) this.gen.endIf(); + } else { + if (this.allErrors) this.gen.endIf(); + else this.gen.else(); + } + } + pass(condition, failAction) { + this.failResult( + (0, codegen_1.not)(condition), + undefined, + failAction + ); + } + fail(condition) { + if (condition === undefined) { + this.error(); + if (!this.allErrors) this.gen.if(false); + return; + } + this.gen.if(condition); + this.error(); + if (this.allErrors) this.gen.endIf(); + else this.gen.else(); + } + fail$data(condition) { + if (!this.$data) return this.fail(condition); + const { schemaCode } = this; + this.fail( + (0, codegen_1._)`${schemaCode} !== undefined && (${(0, + codegen_1.or)(this.invalid$data(), condition)})` + ); + } + error(append, errorParams, errorPaths) { + if (errorParams) { + this.setParams(errorParams); + this._error(append, errorPaths); + this.setParams({}); + return; + } + this._error(append, errorPaths); + } + _error(append, errorPaths) { + (append ? errors_1.reportExtraError : errors_1.reportError)( + this, + this.def.error, + errorPaths + ); + } + $dataError() { + (0, errors_1.reportError)( + this, + this.def.$dataError || errors_1.keyword$DataError + ); + } + reset() { + if (this.errsCount === undefined) + throw new Error('add "trackErrors" to keyword definition'); + (0, errors_1.resetErrorsCount)(this.gen, this.errsCount); + } + ok(cond) { + if (!this.allErrors) this.gen.if(cond); + } + setParams(obj, assign) { + if (assign) Object.assign(this.params, obj); + else this.params = obj; + } + block$data(valid, codeBlock, $dataValid = codegen_1.nil) { + this.gen.block(() => { + this.check$data(valid, $dataValid); + codeBlock(); + }); + } + check$data(valid = codegen_1.nil, $dataValid = codegen_1.nil) { + if (!this.$data) return; + const { gen, schemaCode, schemaType, def } = this; + gen.if( + (0, codegen_1.or)( + (0, codegen_1._)`${schemaCode} === undefined`, + $dataValid + ) + ); + if (valid !== codegen_1.nil) gen.assign(valid, true); + if (schemaType.length || def.validateSchema) { + gen.elseIf(this.invalid$data()); + this.$dataError(); + if (valid !== codegen_1.nil) gen.assign(valid, false); + } + gen.else(); + } + invalid$data() { + const { gen, schemaCode, schemaType, def, it } = this; + return (0, codegen_1.or)(wrong$DataType(), invalid$DataSchema()); + function wrong$DataType() { + if (schemaType.length) { + if (!(schemaCode instanceof codegen_1.Name)) + throw new Error('ajv implementation error'); + const st = Array.isArray(schemaType) + ? schemaType + : [schemaType]; + return (0, codegen_1._)`${(0, dataType_2.checkDataTypes)( + st, + schemaCode, + it.opts.strictNumbers, + dataType_2.DataType.Wrong + )}`; + } + return codegen_1.nil; + } + function invalid$DataSchema() { + if (def.validateSchema) { + const validateSchemaRef = gen.scopeValue('validate$data', { + ref: def.validateSchema, + }); + return (0, + codegen_1._)`!${validateSchemaRef}(${schemaCode})`; + } + return codegen_1.nil; + } + } + subschema(appl, valid) { + const subschema = (0, subschema_1.getSubschema)(this.it, appl); + (0, subschema_1.extendSubschemaData)(subschema, this.it, appl); + (0, subschema_1.extendSubschemaMode)(subschema, appl); + const nextContext = { + ...this.it, + ...subschema, + items: undefined, + props: undefined, + }; + subschemaCode(nextContext, valid); + return nextContext; + } + mergeEvaluated(schemaCxt, toName) { + const { it, gen } = this; + if (!it.opts.unevaluated) return; + if (it.props !== true && schemaCxt.props !== undefined) { + it.props = util_1.mergeEvaluated.props( + gen, + schemaCxt.props, + it.props, + toName + ); + } + if (it.items !== true && schemaCxt.items !== undefined) { + it.items = util_1.mergeEvaluated.items( + gen, + schemaCxt.items, + it.items, + toName + ); + } + } + mergeValidEvaluated(schemaCxt, valid) { + const { it, gen } = this; + if ( + it.opts.unevaluated && + (it.props !== true || it.items !== true) + ) { + gen.if(valid, () => + this.mergeEvaluated(schemaCxt, codegen_1.Name) + ); + return true; + } + } + } + exports.KeywordCxt = KeywordCxt; + var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/; + var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; + exports.getData = getData; +}); + +// ../../../node_modules/ajv/dist/runtime/validation_error.js +var require_validation_error = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + + class ValidationError extends Error { + constructor(errors) { + super('validation failed'); + this.errors = errors; + this.ajv = this.validation = true; + } + } + exports.default = ValidationError; +}); + +// ../../../node_modules/ajv/dist/compile/ref_error.js +var require_ref_error = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var resolve_1 = require_resolve(); + + class MissingRefError extends Error { + constructor(resolver, baseId, ref, msg) { + super(msg || `can't resolve reference ${ref} from id ${baseId}`); + this.missingRef = (0, resolve_1.resolveUrl)(resolver, baseId, ref); + this.missingSchema = (0, resolve_1.normalizeId)( + (0, resolve_1.getFullPath)(resolver, this.missingRef) + ); + } + } + exports.default = MissingRefError; +}); + +// ../../../node_modules/ajv/dist/compile/index.js +var require_compile = __commonJS((exports) => { + var compileSchema = function (sch) { + const _sch = getCompilingSchema.call(this, sch); + if (_sch) return _sch; + const rootId = (0, resolve_1.getFullPath)( + this.opts.uriResolver, + sch.root.baseId + ); + const { es5, lines } = this.opts.code; + const { ownProperties } = this.opts; + const gen = new codegen_1.CodeGen(this.scope, { + es5, + lines, + ownProperties, + }); + let _ValidationError; + if (sch.$async) { + _ValidationError = gen.scopeValue('Error', { + ref: validation_error_1.default, + code: (0, + codegen_1._)`require("ajv/dist/runtime/validation_error").default`, + }); + } + const validateName = gen.scopeName('validate'); + sch.validateName = validateName; + const schemaCxt = { + gen, + allErrors: this.opts.allErrors, + data: names_1.default.data, + parentData: names_1.default.parentData, + parentDataProperty: names_1.default.parentDataProperty, + dataNames: [names_1.default.data], + dataPathArr: [codegen_1.nil], + dataLevel: 0, + dataTypes: [], + definedProperties: new Set(), + topSchemaRef: gen.scopeValue( + 'schema', + this.opts.code.source === true + ? { + ref: sch.schema, + code: (0, codegen_1.stringify)(sch.schema), + } + : { ref: sch.schema } + ), + validateName, + ValidationError: _ValidationError, + schema: sch.schema, + schemaEnv: sch, + rootId, + baseId: sch.baseId || rootId, + schemaPath: codegen_1.nil, + errSchemaPath: sch.schemaPath || (this.opts.jtd ? '' : '#'), + errorPath: (0, codegen_1._)`""`, + opts: this.opts, + self: this, + }; + let sourceCode; + try { + this._compilations.add(sch); + (0, validate_1.validateFunctionCode)(schemaCxt); + gen.optimize(this.opts.code.optimize); + const validateCode = gen.toString(); + sourceCode = `${gen.scopeRefs( + names_1.default.scope + )}return ${validateCode}`; + if (this.opts.code.process) + sourceCode = this.opts.code.process(sourceCode, sch); + const makeValidate = new Function( + `${names_1.default.self}`, + `${names_1.default.scope}`, + sourceCode + ); + const validate = makeValidate(this, this.scope.get()); + this.scope.value(validateName, { ref: validate }); + validate.errors = null; + validate.schema = sch.schema; + validate.schemaEnv = sch; + if (sch.$async) validate.$async = true; + if (this.opts.code.source === true) { + validate.source = { + validateName, + validateCode, + scopeValues: gen._values, + }; + } + if (this.opts.unevaluated) { + const { props, items } = schemaCxt; + validate.evaluated = { + props: props instanceof codegen_1.Name ? undefined : props, + items: items instanceof codegen_1.Name ? undefined : items, + dynamicProps: props instanceof codegen_1.Name, + dynamicItems: items instanceof codegen_1.Name, + }; + if (validate.source) + validate.source.evaluated = (0, codegen_1.stringify)( + validate.evaluated + ); + } + sch.validate = validate; + return sch; + } catch (e) { + delete sch.validate; + delete sch.validateName; + if (sourceCode) + this.logger.error( + 'Error compiling schema, function code:', + sourceCode + ); + throw e; + } finally { + this._compilations.delete(sch); + } + }; + var resolveRef = function (root, baseId, ref) { + var _a; + ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref); + const schOrFunc = root.refs[ref]; + if (schOrFunc) return schOrFunc; + let _sch = resolve.call(this, root, ref); + if (_sch === undefined) { + const schema = + (_a = root.localRefs) === null || _a === undefined + ? undefined + : _a[ref]; + const { schemaId } = this.opts; + if (schema) + _sch = new SchemaEnv({ schema, schemaId, root, baseId }); + } + if (_sch === undefined) return; + return (root.refs[ref] = inlineOrCompile.call(this, _sch)); + }; + var inlineOrCompile = function (sch) { + if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs)) + return sch.schema; + return sch.validate ? sch : compileSchema.call(this, sch); + }; + var getCompilingSchema = function (schEnv) { + for (const sch of this._compilations) { + if (sameSchemaEnv(sch, schEnv)) return sch; + } + }; + var sameSchemaEnv = function (s1, s2) { + return ( + s1.schema === s2.schema && + s1.root === s2.root && + s1.baseId === s2.baseId + ); + }; + var resolve = function (root, ref) { + let sch; + while (typeof (sch = this.refs[ref]) == 'string') ref = sch; + return sch || this.schemas[ref] || resolveSchema.call(this, root, ref); + }; + var resolveSchema = function (root, ref) { + const p = this.opts.uriResolver.parse(ref); + const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p); + let baseId = (0, resolve_1.getFullPath)( + this.opts.uriResolver, + root.baseId, + undefined + ); + if (Object.keys(root.schema).length > 0 && refPath === baseId) { + return getJsonPointer.call(this, p, root); + } + const id = (0, resolve_1.normalizeId)(refPath); + const schOrRef = this.refs[id] || this.schemas[id]; + if (typeof schOrRef == 'string') { + const sch = resolveSchema.call(this, root, schOrRef); + if ( + typeof (sch === null || sch === undefined + ? undefined + : sch.schema) !== 'object' + ) + return; + return getJsonPointer.call(this, p, sch); + } + if ( + typeof (schOrRef === null || schOrRef === undefined + ? undefined + : schOrRef.schema) !== 'object' + ) + return; + if (!schOrRef.validate) compileSchema.call(this, schOrRef); + if (id === (0, resolve_1.normalizeId)(ref)) { + const { schema } = schOrRef; + const { schemaId } = this.opts; + const schId = schema[schemaId]; + if (schId) + baseId = (0, resolve_1.resolveUrl)( + this.opts.uriResolver, + baseId, + schId + ); + return new SchemaEnv({ schema, schemaId, root, baseId }); + } + return getJsonPointer.call(this, p, schOrRef); + }; + var getJsonPointer = function (parsedRef, { baseId, schema, root }) { + var _a; + if ( + ((_a = parsedRef.fragment) === null || _a === undefined + ? undefined + : _a[0]) !== '/' + ) + return; + for (const part of parsedRef.fragment.slice(1).split('/')) { + if (typeof schema === 'boolean') return; + const partSchema = schema[(0, util_1.unescapeFragment)(part)]; + if (partSchema === undefined) return; + schema = partSchema; + const schId = + typeof schema === 'object' && schema[this.opts.schemaId]; + if (!PREVENT_SCOPE_CHANGE.has(part) && schId) { + baseId = (0, resolve_1.resolveUrl)( + this.opts.uriResolver, + baseId, + schId + ); + } + } + let env; + if ( + typeof schema != 'boolean' && + schema.$ref && + !(0, util_1.schemaHasRulesButRef)(schema, this.RULES) + ) { + const $ref = (0, resolve_1.resolveUrl)( + this.opts.uriResolver, + baseId, + schema.$ref + ); + env = resolveSchema.call(this, root, $ref); + } + const { schemaId } = this.opts; + env = env || new SchemaEnv({ schema, schemaId, root, baseId }); + if (env.schema !== env.root.schema) return env; + return; + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.resolveSchema = + exports.getCompilingSchema = + exports.resolveRef = + exports.compileSchema = + exports.SchemaEnv = + undefined; + var codegen_1 = require_codegen(); + var validation_error_1 = require_validation_error(); + var names_1 = require_names(); + var resolve_1 = require_resolve(); + var util_1 = require_util(); + var validate_1 = require_validate(); + + class SchemaEnv { + constructor(env) { + var _a; + this.refs = {}; + this.dynamicAnchors = {}; + let schema; + if (typeof env.schema == 'object') schema = env.schema; + this.schema = env.schema; + this.schemaId = env.schemaId; + this.root = env.root || this; + this.baseId = + (_a = env.baseId) !== null && _a !== undefined + ? _a + : (0, resolve_1.normalizeId)( + schema === null || schema === undefined + ? undefined + : schema[env.schemaId || '$id'] + ); + this.schemaPath = env.schemaPath; + this.localRefs = env.localRefs; + this.meta = env.meta; + this.$async = + schema === null || schema === undefined + ? undefined + : schema.$async; + this.refs = {}; + } + } + exports.SchemaEnv = SchemaEnv; + exports.compileSchema = compileSchema; + exports.resolveRef = resolveRef; + exports.getCompilingSchema = getCompilingSchema; + exports.resolveSchema = resolveSchema; + var PREVENT_SCOPE_CHANGE = new Set([ + 'properties', + 'patternProperties', + 'enum', + 'dependencies', + 'definitions', + ]); +}); + +// ../../../node_modules/ajv/dist/refs/data.json +var require_data = __commonJS((exports, module) => { + module.exports = { + $id: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#', + description: + 'Meta-schema for $data reference (JSON AnySchema extension proposal)', + type: 'object', + required: ['$data'], + properties: { + $data: { + type: 'string', + anyOf: [ + { format: 'relative-json-pointer' }, + { format: 'json-pointer' }, + ], + }, + }, + additionalProperties: false, + }; +}); + +// ../../../node_modules/uri-js/dist/es5/uri.all.js +var require_uri_all = __commonJS((exports, module) => { + (function (global2, factory) { + typeof exports === 'object' && typeof module !== 'undefined' + ? factory(exports) + : typeof define === 'function' && define.amd + ? define(['exports'], factory) + : factory((global2.URI = global2.URI || {})); + })(exports, function (exports2) { + function merge() { + for ( + var _len = arguments.length, sets = Array(_len), _key = 0; + _key < _len; + _key++ + ) { + sets[_key] = arguments[_key]; + } + if (sets.length > 1) { + sets[0] = sets[0].slice(0, -1); + var xl = sets.length - 1; + for (var x = 1; x < xl; ++x) { + sets[x] = sets[x].slice(1, -1); + } + sets[xl] = sets[xl].slice(1); + return sets.join(''); + } else { + return sets[0]; + } + } + function subexp(str) { + return '(?:' + str + ')'; + } + function typeOf(o) { + return o === undefined + ? 'undefined' + : o === null + ? 'null' + : Object.prototype.toString + .call(o) + .split(' ') + .pop() + .split(']') + .shift() + .toLowerCase(); + } + function toUpperCase(str) { + return str.toUpperCase(); + } + function toArray(obj) { + return obj !== undefined && obj !== null + ? obj instanceof Array + ? obj + : typeof obj.length !== 'number' || + obj.split || + obj.setInterval || + obj.call + ? [obj] + : Array.prototype.slice.call(obj) + : []; + } + function assign(target, source) { + var obj = target; + if (source) { + for (var key in source) { + obj[key] = source[key]; + } + } + return obj; + } + function buildExps(isIRI2) { + var ALPHA$$ = '[A-Za-z]', + CR$ = '[\\x0D]', + DIGIT$$ = '[0-9]', + DQUOTE$$ = '[\\x22]', + HEXDIG$$2 = merge(DIGIT$$, '[A-Fa-f]'), + LF$$ = '[\\x0A]', + SP$$ = '[\\x20]', + PCT_ENCODED$2 = subexp( + subexp( + '%[EFef]' + + HEXDIG$$2 + + '%' + + HEXDIG$$2 + + HEXDIG$$2 + + '%' + + HEXDIG$$2 + + HEXDIG$$2 + ) + + '|' + + subexp( + '%[89A-Fa-f]' + + HEXDIG$$2 + + '%' + + HEXDIG$$2 + + HEXDIG$$2 + ) + + '|' + + subexp('%' + HEXDIG$$2 + HEXDIG$$2) + ), + GEN_DELIMS$$ = '[\\:\\/\\?\\#\\[\\]\\@]', + SUB_DELIMS$$ = "[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]", + RESERVED$$ = merge(GEN_DELIMS$$, SUB_DELIMS$$), + UCSCHAR$$ = isIRI2 + ? '[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]' + : '[]', + IPRIVATE$$ = isIRI2 ? '[\\uE000-\\uF8FF]' : '[]', + UNRESERVED$$2 = merge( + ALPHA$$, + DIGIT$$, + '[\\-\\.\\_\\~]', + UCSCHAR$$ + ), + SCHEME$ = subexp( + ALPHA$$ + merge(ALPHA$$, DIGIT$$, '[\\+\\-\\.]') + '*' + ), + USERINFO$ = subexp( + subexp( + PCT_ENCODED$2 + + '|' + + merge(UNRESERVED$$2, SUB_DELIMS$$, '[\\:]') + ) + '*' + ), + DEC_OCTET$ = subexp( + subexp('25[0-5]') + + '|' + + subexp('2[0-4]' + DIGIT$$) + + '|' + + subexp('1' + DIGIT$$ + DIGIT$$) + + '|' + + subexp('[1-9]' + DIGIT$$) + + '|' + + DIGIT$$ + ), + DEC_OCTET_RELAXED$ = subexp( + subexp('25[0-5]') + + '|' + + subexp('2[0-4]' + DIGIT$$) + + '|' + + subexp('1' + DIGIT$$ + DIGIT$$) + + '|' + + subexp('0?[1-9]' + DIGIT$$) + + '|0?0?' + + DIGIT$$ + ), + IPV4ADDRESS$ = subexp( + DEC_OCTET_RELAXED$ + + '\\.' + + DEC_OCTET_RELAXED$ + + '\\.' + + DEC_OCTET_RELAXED$ + + '\\.' + + DEC_OCTET_RELAXED$ + ), + H16$ = subexp(HEXDIG$$2 + '{1,4}'), + LS32$ = subexp( + subexp(H16$ + '\\:' + H16$) + '|' + IPV4ADDRESS$ + ), + IPV6ADDRESS1$ = subexp(subexp(H16$ + '\\:') + '{6}' + LS32$), + IPV6ADDRESS2$ = subexp( + '\\:\\:' + subexp(H16$ + '\\:') + '{5}' + LS32$ + ), + IPV6ADDRESS3$ = subexp( + subexp(H16$) + + '?\\:\\:' + + subexp(H16$ + '\\:') + + '{4}' + + LS32$ + ), + IPV6ADDRESS4$ = subexp( + subexp(subexp(H16$ + '\\:') + '{0,1}' + H16$) + + '?\\:\\:' + + subexp(H16$ + '\\:') + + '{3}' + + LS32$ + ), + IPV6ADDRESS5$ = subexp( + subexp(subexp(H16$ + '\\:') + '{0,2}' + H16$) + + '?\\:\\:' + + subexp(H16$ + '\\:') + + '{2}' + + LS32$ + ), + IPV6ADDRESS6$ = subexp( + subexp(subexp(H16$ + '\\:') + '{0,3}' + H16$) + + '?\\:\\:' + + H16$ + + '\\:' + + LS32$ + ), + IPV6ADDRESS7$ = subexp( + subexp(subexp(H16$ + '\\:') + '{0,4}' + H16$) + + '?\\:\\:' + + LS32$ + ), + IPV6ADDRESS8$ = subexp( + subexp(subexp(H16$ + '\\:') + '{0,5}' + H16$) + + '?\\:\\:' + + H16$ + ), + IPV6ADDRESS9$ = subexp( + subexp(subexp(H16$ + '\\:') + '{0,6}' + H16$) + '?\\:\\:' + ), + IPV6ADDRESS$ = subexp( + [ + IPV6ADDRESS1$, + IPV6ADDRESS2$, + IPV6ADDRESS3$, + IPV6ADDRESS4$, + IPV6ADDRESS5$, + IPV6ADDRESS6$, + IPV6ADDRESS7$, + IPV6ADDRESS8$, + IPV6ADDRESS9$, + ].join('|') + ), + ZONEID$ = subexp( + subexp(UNRESERVED$$2 + '|' + PCT_ENCODED$2) + '+' + ), + IPV6ADDRZ$ = subexp(IPV6ADDRESS$ + '\\%25' + ZONEID$), + IPV6ADDRZ_RELAXED$ = subexp( + IPV6ADDRESS$ + + subexp('\\%25|\\%(?!' + HEXDIG$$2 + '{2})') + + ZONEID$ + ), + IPVFUTURE$ = subexp( + '[vV]' + + HEXDIG$$2 + + '+\\.' + + merge(UNRESERVED$$2, SUB_DELIMS$$, '[\\:]') + + '+' + ), + IP_LITERAL$ = subexp( + '\\[' + + subexp( + IPV6ADDRZ_RELAXED$ + + '|' + + IPV6ADDRESS$ + + '|' + + IPVFUTURE$ + ) + + '\\]' + ), + REG_NAME$ = subexp( + subexp( + PCT_ENCODED$2 + '|' + merge(UNRESERVED$$2, SUB_DELIMS$$) + ) + '*' + ), + HOST$ = subexp( + IP_LITERAL$ + + '|' + + IPV4ADDRESS$ + + '(?!' + + REG_NAME$ + + ')|' + + REG_NAME$ + ), + PORT$ = subexp(DIGIT$$ + '*'), + AUTHORITY$ = subexp( + subexp(USERINFO$ + '@') + + '?' + + HOST$ + + subexp('\\:' + PORT$) + + '?' + ), + PCHAR$ = subexp( + PCT_ENCODED$2 + + '|' + + merge(UNRESERVED$$2, SUB_DELIMS$$, '[\\:\\@]') + ), + SEGMENT$ = subexp(PCHAR$ + '*'), + SEGMENT_NZ$ = subexp(PCHAR$ + '+'), + SEGMENT_NZ_NC$ = subexp( + subexp( + PCT_ENCODED$2 + + '|' + + merge(UNRESERVED$$2, SUB_DELIMS$$, '[\\@]') + ) + '+' + ), + PATH_ABEMPTY$ = subexp(subexp('\\/' + SEGMENT$) + '*'), + PATH_ABSOLUTE$ = subexp( + '\\/' + subexp(SEGMENT_NZ$ + PATH_ABEMPTY$) + '?' + ), + PATH_NOSCHEME$ = subexp(SEGMENT_NZ_NC$ + PATH_ABEMPTY$), + PATH_ROOTLESS$ = subexp(SEGMENT_NZ$ + PATH_ABEMPTY$), + PATH_EMPTY$ = '(?!' + PCHAR$ + ')', + PATH$ = subexp( + PATH_ABEMPTY$ + + '|' + + PATH_ABSOLUTE$ + + '|' + + PATH_NOSCHEME$ + + '|' + + PATH_ROOTLESS$ + + '|' + + PATH_EMPTY$ + ), + QUERY$ = subexp( + subexp(PCHAR$ + '|' + merge('[\\/\\?]', IPRIVATE$$)) + '*' + ), + FRAGMENT$ = subexp(subexp(PCHAR$ + '|[\\/\\?]') + '*'), + HIER_PART$ = subexp( + subexp('\\/\\/' + AUTHORITY$ + PATH_ABEMPTY$) + + '|' + + PATH_ABSOLUTE$ + + '|' + + PATH_ROOTLESS$ + + '|' + + PATH_EMPTY$ + ), + URI$ = subexp( + SCHEME$ + + '\\:' + + HIER_PART$ + + subexp('\\?' + QUERY$) + + '?' + + subexp('\\#' + FRAGMENT$) + + '?' + ), + RELATIVE_PART$ = subexp( + subexp('\\/\\/' + AUTHORITY$ + PATH_ABEMPTY$) + + '|' + + PATH_ABSOLUTE$ + + '|' + + PATH_NOSCHEME$ + + '|' + + PATH_EMPTY$ + ), + RELATIVE$ = subexp( + RELATIVE_PART$ + + subexp('\\?' + QUERY$) + + '?' + + subexp('\\#' + FRAGMENT$) + + '?' + ), + URI_REFERENCE$ = subexp(URI$ + '|' + RELATIVE$), + ABSOLUTE_URI$ = subexp( + SCHEME$ + '\\:' + HIER_PART$ + subexp('\\?' + QUERY$) + '?' + ), + GENERIC_REF$ = + '^(' + + SCHEME$ + + ')\\:' + + subexp( + subexp( + '\\/\\/(' + + subexp('(' + USERINFO$ + ')@') + + '?(' + + HOST$ + + ')' + + subexp('\\:(' + PORT$ + ')') + + '?)' + ) + + '?(' + + PATH_ABEMPTY$ + + '|' + + PATH_ABSOLUTE$ + + '|' + + PATH_ROOTLESS$ + + '|' + + PATH_EMPTY$ + + ')' + ) + + subexp('\\?(' + QUERY$ + ')') + + '?' + + subexp('\\#(' + FRAGMENT$ + ')') + + '?$', + RELATIVE_REF$ = + '^(){0}' + + subexp( + subexp( + '\\/\\/(' + + subexp('(' + USERINFO$ + ')@') + + '?(' + + HOST$ + + ')' + + subexp('\\:(' + PORT$ + ')') + + '?)' + ) + + '?(' + + PATH_ABEMPTY$ + + '|' + + PATH_ABSOLUTE$ + + '|' + + PATH_NOSCHEME$ + + '|' + + PATH_EMPTY$ + + ')' + ) + + subexp('\\?(' + QUERY$ + ')') + + '?' + + subexp('\\#(' + FRAGMENT$ + ')') + + '?$', + ABSOLUTE_REF$ = + '^(' + + SCHEME$ + + ')\\:' + + subexp( + subexp( + '\\/\\/(' + + subexp('(' + USERINFO$ + ')@') + + '?(' + + HOST$ + + ')' + + subexp('\\:(' + PORT$ + ')') + + '?)' + ) + + '?(' + + PATH_ABEMPTY$ + + '|' + + PATH_ABSOLUTE$ + + '|' + + PATH_ROOTLESS$ + + '|' + + PATH_EMPTY$ + + ')' + ) + + subexp('\\?(' + QUERY$ + ')') + + '?$', + SAMEDOC_REF$ = '^' + subexp('\\#(' + FRAGMENT$ + ')') + '?$', + AUTHORITY_REF$ = + '^' + + subexp('(' + USERINFO$ + ')@') + + '?(' + + HOST$ + + ')' + + subexp('\\:(' + PORT$ + ')') + + '?$'; + return { + NOT_SCHEME: new RegExp( + merge('[^]', ALPHA$$, DIGIT$$, '[\\+\\-\\.]'), + 'g' + ), + NOT_USERINFO: new RegExp( + merge('[^\\%\\:]', UNRESERVED$$2, SUB_DELIMS$$), + 'g' + ), + NOT_HOST: new RegExp( + merge('[^\\%\\[\\]\\:]', UNRESERVED$$2, SUB_DELIMS$$), + 'g' + ), + NOT_PATH: new RegExp( + merge('[^\\%\\/\\:\\@]', UNRESERVED$$2, SUB_DELIMS$$), + 'g' + ), + NOT_PATH_NOSCHEME: new RegExp( + merge('[^\\%\\/\\@]', UNRESERVED$$2, SUB_DELIMS$$), + 'g' + ), + NOT_QUERY: new RegExp( + merge( + '[^\\%]', + UNRESERVED$$2, + SUB_DELIMS$$, + '[\\:\\@\\/\\?]', + IPRIVATE$$ + ), + 'g' + ), + NOT_FRAGMENT: new RegExp( + merge( + '[^\\%]', + UNRESERVED$$2, + SUB_DELIMS$$, + '[\\:\\@\\/\\?]' + ), + 'g' + ), + ESCAPE: new RegExp( + merge('[^]', UNRESERVED$$2, SUB_DELIMS$$), + 'g' + ), + UNRESERVED: new RegExp(UNRESERVED$$2, 'g'), + OTHER_CHARS: new RegExp( + merge('[^\\%]', UNRESERVED$$2, RESERVED$$), + 'g' + ), + PCT_ENCODED: new RegExp(PCT_ENCODED$2, 'g'), + IPV4ADDRESS: new RegExp('^(' + IPV4ADDRESS$ + ')$'), + IPV6ADDRESS: new RegExp( + '^\\[?(' + + IPV6ADDRESS$ + + ')' + + subexp( + subexp('\\%25|\\%(?!' + HEXDIG$$2 + '{2})') + + '(' + + ZONEID$ + + ')' + ) + + '?\\]?$' + ), + }; + } + var URI_PROTOCOL = buildExps(false); + var IRI_PROTOCOL = buildExps(true); + var slicedToArray = (function () { + function sliceIterator(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + try { + for ( + var _i = arr[Symbol.iterator](), _s; + !(_n = (_s = _i.next()).done); + _n = true + ) { + _arr.push(_s.value); + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i['return']) _i['return'](); + } finally { + if (_d) throw _e; + } + } + return _arr; + } + return function (arr, i) { + if (Array.isArray(arr)) { + return arr; + } else if (Symbol.iterator in Object(arr)) { + return sliceIterator(arr, i); + } else { + throw new TypeError( + 'Invalid attempt to destructure non-iterable instance' + ); + } + }; + })(); + var toConsumableArray = function (arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) + arr2[i] = arr[i]; + return arr2; + } else { + return Array.from(arr); + } + }; + var maxInt = 2147483647; + var base = 36; + var tMin = 1; + var tMax = 26; + var skew = 38; + var damp = 700; + var initialBias = 72; + var initialN = 128; + var delimiter = '-'; + var regexPunycode = /^xn--/; + var regexNonASCII = /[^\0-\x7E]/; + var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; + var errors = { + overflow: 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input', + }; + var baseMinusTMin = base - tMin; + var floor = Math.floor; + var stringFromCharCode = String.fromCharCode; + function error$1(type) { + throw new RangeError(errors[type]); + } + function map(array, fn) { + var result = []; + var length = array.length; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + result = parts[0] + '@'; + string = parts[1]; + } + string = string.replace(regexSeparators, '.'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + function ucs2decode(string) { + var output = []; + var counter = 0; + var length = string.length; + while (counter < length) { + var value = string.charCodeAt(counter++); + if (value >= 55296 && value <= 56319 && counter < length) { + var extra = string.charCodeAt(counter++); + if ((extra & 64512) == 56320) { + output.push( + ((value & 1023) << 10) + (extra & 1023) + 65536 + ); + } else { + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + var ucs2encode = function ucs2encode(array) { + return String.fromCodePoint.apply(String, toConsumableArray(array)); + }; + var basicToDigit = function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + }; + var digitToBasic = function digitToBasic(digit, flag) { + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + }; + var adapt = function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (; delta > (baseMinusTMin * tMax) >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + ((baseMinusTMin + 1) * delta) / (delta + skew)); + }; + var decode = function decode(input) { + var output = []; + var inputLength = input.length; + var i = 0; + var n = initialN; + var bias = initialBias; + var basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + for (var j = 0; j < basic; ++j) { + if (input.charCodeAt(j) >= 128) { + error$1('not-basic'); + } + output.push(input.charCodeAt(j)); + } + for (var index = basic > 0 ? basic + 1 : 0; index < inputLength; ) { + var oldi = i; + for (var w = 1, k = base; ; k += base) { + if (index >= inputLength) { + error$1('invalid-input'); + } + var digit = basicToDigit(input.charCodeAt(index++)); + if (digit >= base || digit > floor((maxInt - i) / w)) { + error$1('overflow'); + } + i += digit * w; + var t = + k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; + if (digit < t) { + break; + } + var baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error$1('overflow'); + } + w *= baseMinusT; + } + var out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + if (floor(i / out) > maxInt - n) { + error$1('overflow'); + } + n += floor(i / out); + i %= out; + output.splice(i++, 0, n); + } + return String.fromCodePoint.apply(String, output); + }; + var encode = function encode(input) { + var output = []; + input = ucs2decode(input); + var inputLength = input.length; + var n = initialN; + var delta = 0; + var bias = initialBias; + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + try { + for ( + var _iterator = input[Symbol.iterator](), _step; + !(_iteratorNormalCompletion = (_step = _iterator.next()) + .done); + _iteratorNormalCompletion = true + ) { + var _currentValue2 = _step.value; + if (_currentValue2 < 128) { + output.push(stringFromCharCode(_currentValue2)); + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + var basicLength = output.length; + var handledCPCount = basicLength; + if (basicLength) { + output.push(delimiter); + } + while (handledCPCount < inputLength) { + var m = maxInt; + var _iteratorNormalCompletion2 = true; + var _didIteratorError2 = false; + var _iteratorError2 = undefined; + try { + for ( + var _iterator2 = input[Symbol.iterator](), _step2; + !(_iteratorNormalCompletion2 = (_step2 = + _iterator2.next()).done); + _iteratorNormalCompletion2 = true + ) { + var currentValue = _step2.value; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + } catch (err) { + _didIteratorError2 = true; + _iteratorError2 = err; + } finally { + try { + if (!_iteratorNormalCompletion2 && _iterator2.return) { + _iterator2.return(); + } + } finally { + if (_didIteratorError2) { + throw _iteratorError2; + } + } + } + var handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error$1('overflow'); + } + delta += (m - n) * handledCPCountPlusOne; + n = m; + var _iteratorNormalCompletion3 = true; + var _didIteratorError3 = false; + var _iteratorError3 = undefined; + try { + for ( + var _iterator3 = input[Symbol.iterator](), _step3; + !(_iteratorNormalCompletion3 = (_step3 = + _iterator3.next()).done); + _iteratorNormalCompletion3 = true + ) { + var _currentValue = _step3.value; + if (_currentValue < n && ++delta > maxInt) { + error$1('overflow'); + } + if (_currentValue == n) { + var q = delta; + for (var k = base; ; k += base) { + var t = + k <= bias + ? tMin + : k >= bias + tMax + ? tMax + : k - bias; + if (q < t) { + break; + } + var qMinusT = q - t; + var baseMinusT = base - t; + output.push( + stringFromCharCode( + digitToBasic( + t + (qMinusT % baseMinusT), + 0 + ) + ) + ); + q = floor(qMinusT / baseMinusT); + } + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt( + delta, + handledCPCountPlusOne, + handledCPCount == basicLength + ); + delta = 0; + ++handledCPCount; + } + } + } catch (err) { + _didIteratorError3 = true; + _iteratorError3 = err; + } finally { + try { + if (!_iteratorNormalCompletion3 && _iterator3.return) { + _iterator3.return(); + } + } finally { + if (_didIteratorError3) { + throw _iteratorError3; + } + } + } + ++delta; + ++n; + } + return output.join(''); + }; + var toUnicode = function toUnicode(input) { + return mapDomain(input, function (string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + }; + var toASCII = function toASCII(input) { + return mapDomain(input, function (string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + }; + var punycode = { + version: '2.1.0', + ucs2: { + decode: ucs2decode, + encode: ucs2encode, + }, + decode, + encode, + toASCII, + toUnicode, + }; + var SCHEMES = {}; + function pctEncChar(chr) { + var c = chr.charCodeAt(0); + var e = undefined; + if (c < 16) e = '%0' + c.toString(16).toUpperCase(); + else if (c < 128) e = '%' + c.toString(16).toUpperCase(); + else if (c < 2048) + e = + '%' + + ((c >> 6) | 192).toString(16).toUpperCase() + + '%' + + ((c & 63) | 128).toString(16).toUpperCase(); + else + e = + '%' + + ((c >> 12) | 224).toString(16).toUpperCase() + + '%' + + (((c >> 6) & 63) | 128).toString(16).toUpperCase() + + '%' + + ((c & 63) | 128).toString(16).toUpperCase(); + return e; + } + function pctDecChars(str) { + var newStr = ''; + var i = 0; + var il = str.length; + while (i < il) { + var c = parseInt(str.substr(i + 1, 2), 16); + if (c < 128) { + newStr += String.fromCharCode(c); + i += 3; + } else if (c >= 194 && c < 224) { + if (il - i >= 6) { + var c2 = parseInt(str.substr(i + 4, 2), 16); + newStr += String.fromCharCode( + ((c & 31) << 6) | (c2 & 63) + ); + } else { + newStr += str.substr(i, 6); + } + i += 6; + } else if (c >= 224) { + if (il - i >= 9) { + var _c = parseInt(str.substr(i + 4, 2), 16); + var c3 = parseInt(str.substr(i + 7, 2), 16); + newStr += String.fromCharCode( + ((c & 15) << 12) | ((_c & 63) << 6) | (c3 & 63) + ); + } else { + newStr += str.substr(i, 9); + } + i += 9; + } else { + newStr += str.substr(i, 3); + i += 3; + } + } + return newStr; + } + function _normalizeComponentEncoding(components, protocol) { + function decodeUnreserved2(str) { + var decStr = pctDecChars(str); + return !decStr.match(protocol.UNRESERVED) ? str : decStr; + } + if (components.scheme) + components.scheme = String(components.scheme) + .replace(protocol.PCT_ENCODED, decodeUnreserved2) + .toLowerCase() + .replace(protocol.NOT_SCHEME, ''); + if (components.userinfo !== undefined) + components.userinfo = String(components.userinfo) + .replace(protocol.PCT_ENCODED, decodeUnreserved2) + .replace(protocol.NOT_USERINFO, pctEncChar) + .replace(protocol.PCT_ENCODED, toUpperCase); + if (components.host !== undefined) + components.host = String(components.host) + .replace(protocol.PCT_ENCODED, decodeUnreserved2) + .toLowerCase() + .replace(protocol.NOT_HOST, pctEncChar) + .replace(protocol.PCT_ENCODED, toUpperCase); + if (components.path !== undefined) + components.path = String(components.path) + .replace(protocol.PCT_ENCODED, decodeUnreserved2) + .replace( + components.scheme + ? protocol.NOT_PATH + : protocol.NOT_PATH_NOSCHEME, + pctEncChar + ) + .replace(protocol.PCT_ENCODED, toUpperCase); + if (components.query !== undefined) + components.query = String(components.query) + .replace(protocol.PCT_ENCODED, decodeUnreserved2) + .replace(protocol.NOT_QUERY, pctEncChar) + .replace(protocol.PCT_ENCODED, toUpperCase); + if (components.fragment !== undefined) + components.fragment = String(components.fragment) + .replace(protocol.PCT_ENCODED, decodeUnreserved2) + .replace(protocol.NOT_FRAGMENT, pctEncChar) + .replace(protocol.PCT_ENCODED, toUpperCase); + return components; + } + function _stripLeadingZeros(str) { + return str.replace(/^0*(.*)/, '$1') || '0'; + } + function _normalizeIPv4(host, protocol) { + var matches = host.match(protocol.IPV4ADDRESS) || []; + var _matches = slicedToArray(matches, 2), + address = _matches[1]; + if (address) { + return address.split('.').map(_stripLeadingZeros).join('.'); + } else { + return host; + } + } + function _normalizeIPv6(host, protocol) { + var matches = host.match(protocol.IPV6ADDRESS) || []; + var _matches2 = slicedToArray(matches, 3), + address = _matches2[1], + zone = _matches2[2]; + if (address) { + var _address$toLowerCase$ = address + .toLowerCase() + .split('::') + .reverse(), + _address$toLowerCase$2 = slicedToArray( + _address$toLowerCase$, + 2 + ), + last = _address$toLowerCase$2[0], + first = _address$toLowerCase$2[1]; + var firstFields = first + ? first.split(':').map(_stripLeadingZeros) + : []; + var lastFields = last.split(':').map(_stripLeadingZeros); + var isLastFieldIPv4Address = protocol.IPV4ADDRESS.test( + lastFields[lastFields.length - 1] + ); + var fieldCount = isLastFieldIPv4Address ? 7 : 8; + var lastFieldsStart = lastFields.length - fieldCount; + var fields = Array(fieldCount); + for (var x = 0; x < fieldCount; ++x) { + fields[x] = + firstFields[x] || lastFields[lastFieldsStart + x] || ''; + } + if (isLastFieldIPv4Address) { + fields[fieldCount - 1] = _normalizeIPv4( + fields[fieldCount - 1], + protocol + ); + } + var allZeroFields = fields.reduce(function (acc, field, index) { + if (!field || field === '0') { + var lastLongest = acc[acc.length - 1]; + if ( + lastLongest && + lastLongest.index + lastLongest.length === index + ) { + lastLongest.length++; + } else { + acc.push({ index, length: 1 }); + } + } + return acc; + }, []); + var longestZeroFields = allZeroFields.sort(function (a, b) { + return b.length - a.length; + })[0]; + var newHost = undefined; + if (longestZeroFields && longestZeroFields.length > 1) { + var newFirst = fields.slice(0, longestZeroFields.index); + var newLast = fields.slice( + longestZeroFields.index + longestZeroFields.length + ); + newHost = newFirst.join(':') + '::' + newLast.join(':'); + } else { + newHost = fields.join(':'); + } + if (zone) { + newHost += '%' + zone; + } + return newHost; + } else { + return host; + } + } + var URI_PARSE = + /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i; + var NO_MATCH_IS_UNDEFINED = ''.match(/(){0}/)[1] === undefined; + function parse2(uriString) { + var options = + arguments.length > 1 && arguments[1] !== undefined + ? arguments[1] + : {}; + var components = {}; + var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL; + if (options.reference === 'suffix') + uriString = + (options.scheme ? options.scheme + ':' : '') + + '//' + + uriString; + var matches = uriString.match(URI_PARSE); + if (matches) { + if (NO_MATCH_IS_UNDEFINED) { + components.scheme = matches[1]; + components.userinfo = matches[3]; + components.host = matches[4]; + components.port = parseInt(matches[5], 10); + components.path = matches[6] || ''; + components.query = matches[7]; + components.fragment = matches[8]; + if (isNaN(components.port)) { + components.port = matches[5]; + } + } else { + components.scheme = matches[1] || undefined; + components.userinfo = + uriString.indexOf('@') !== -1 ? matches[3] : undefined; + components.host = + uriString.indexOf('//') !== -1 ? matches[4] : undefined; + components.port = parseInt(matches[5], 10); + components.path = matches[6] || ''; + components.query = + uriString.indexOf('?') !== -1 ? matches[7] : undefined; + components.fragment = + uriString.indexOf('#') !== -1 ? matches[8] : undefined; + if (isNaN(components.port)) { + components.port = uriString.match( + /\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/ + ) + ? matches[4] + : undefined; + } + } + if (components.host) { + components.host = _normalizeIPv6( + _normalizeIPv4(components.host, protocol), + protocol + ); + } + if ( + components.scheme === undefined && + components.userinfo === undefined && + components.host === undefined && + components.port === undefined && + !components.path && + components.query === undefined + ) { + components.reference = 'same-document'; + } else if (components.scheme === undefined) { + components.reference = 'relative'; + } else if (components.fragment === undefined) { + components.reference = 'absolute'; + } else { + components.reference = 'uri'; + } + if ( + options.reference && + options.reference !== 'suffix' && + options.reference !== components.reference + ) { + components.error = + components.error || + 'URI is not a ' + options.reference + ' reference.'; + } + var schemeHandler = + SCHEMES[ + ( + options.scheme || + components.scheme || + '' + ).toLowerCase() + ]; + if ( + !options.unicodeSupport && + (!schemeHandler || !schemeHandler.unicodeSupport) + ) { + if ( + components.host && + (options.domainHost || + (schemeHandler && schemeHandler.domainHost)) + ) { + try { + components.host = punycode.toASCII( + components.host + .replace(protocol.PCT_ENCODED, pctDecChars) + .toLowerCase() + ); + } catch (e) { + components.error = + components.error || + "Host's domain name can not be converted to ASCII via punycode: " + + e; + } + } + _normalizeComponentEncoding(components, URI_PROTOCOL); + } else { + _normalizeComponentEncoding(components, protocol); + } + if (schemeHandler && schemeHandler.parse) { + schemeHandler.parse(components, options); + } + } else { + components.error = components.error || 'URI can not be parsed.'; + } + return components; + } + function _recomposeAuthority(components, options) { + var protocol = options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL; + var uriTokens = []; + if (components.userinfo !== undefined) { + uriTokens.push(components.userinfo); + uriTokens.push('@'); + } + if (components.host !== undefined) { + uriTokens.push( + _normalizeIPv6( + _normalizeIPv4(String(components.host), protocol), + protocol + ).replace(protocol.IPV6ADDRESS, function (_, $1, $2) { + return '[' + $1 + ($2 ? '%25' + $2 : '') + ']'; + }) + ); + } + if ( + typeof components.port === 'number' || + typeof components.port === 'string' + ) { + uriTokens.push(':'); + uriTokens.push(String(components.port)); + } + return uriTokens.length ? uriTokens.join('') : undefined; + } + var RDS1 = /^\.\.?\//; + var RDS2 = /^\/\.(\/|$)/; + var RDS3 = /^\/\.\.(\/|$)/; + var RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/; + function removeDotSegments(input) { + var output = []; + while (input.length) { + if (input.match(RDS1)) { + input = input.replace(RDS1, ''); + } else if (input.match(RDS2)) { + input = input.replace(RDS2, '/'); + } else if (input.match(RDS3)) { + input = input.replace(RDS3, '/'); + output.pop(); + } else if (input === '.' || input === '..') { + input = ''; + } else { + var im = input.match(RDS5); + if (im) { + var s = im[0]; + input = input.slice(s.length); + output.push(s); + } else { + throw new Error('Unexpected dot segment condition'); + } + } + } + return output.join(''); + } + function serialize(components) { + var options = + arguments.length > 1 && arguments[1] !== undefined + ? arguments[1] + : {}; + var protocol = options.iri ? IRI_PROTOCOL : URI_PROTOCOL; + var uriTokens = []; + var schemeHandler = + SCHEMES[ + (options.scheme || components.scheme || '').toLowerCase() + ]; + if (schemeHandler && schemeHandler.serialize) + schemeHandler.serialize(components, options); + if (components.host) { + if (protocol.IPV6ADDRESS.test(components.host)) { + } else if ( + options.domainHost || + (schemeHandler && schemeHandler.domainHost) + ) { + try { + components.host = !options.iri + ? punycode.toASCII( + components.host + .replace( + protocol.PCT_ENCODED, + pctDecChars + ) + .toLowerCase() + ) + : punycode.toUnicode(components.host); + } catch (e) { + components.error = + components.error || + "Host's domain name can not be converted to " + + (!options.iri ? 'ASCII' : 'Unicode') + + ' via punycode: ' + + e; + } + } + } + _normalizeComponentEncoding(components, protocol); + if (options.reference !== 'suffix' && components.scheme) { + uriTokens.push(components.scheme); + uriTokens.push(':'); + } + var authority = _recomposeAuthority(components, options); + if (authority !== undefined) { + if (options.reference !== 'suffix') { + uriTokens.push('//'); + } + uriTokens.push(authority); + if (components.path && components.path.charAt(0) !== '/') { + uriTokens.push('/'); + } + } + if (components.path !== undefined) { + var s = components.path; + if ( + !options.absolutePath && + (!schemeHandler || !schemeHandler.absolutePath) + ) { + s = removeDotSegments(s); + } + if (authority === undefined) { + s = s.replace(/^\/\//, '/%2F'); + } + uriTokens.push(s); + } + if (components.query !== undefined) { + uriTokens.push('?'); + uriTokens.push(components.query); + } + if (components.fragment !== undefined) { + uriTokens.push('#'); + uriTokens.push(components.fragment); + } + return uriTokens.join(''); + } + function resolveComponents(base2, relative) { + var options = + arguments.length > 2 && arguments[2] !== undefined + ? arguments[2] + : {}; + var skipNormalization = arguments[3]; + var target = {}; + if (!skipNormalization) { + base2 = parse2(serialize(base2, options), options); + relative = parse2(serialize(relative, options), options); + } + options = options || {}; + if (!options.tolerant && relative.scheme) { + target.scheme = relative.scheme; + target.userinfo = relative.userinfo; + target.host = relative.host; + target.port = relative.port; + target.path = removeDotSegments(relative.path || ''); + target.query = relative.query; + } else { + if ( + relative.userinfo !== undefined || + relative.host !== undefined || + relative.port !== undefined + ) { + target.userinfo = relative.userinfo; + target.host = relative.host; + target.port = relative.port; + target.path = removeDotSegments(relative.path || ''); + target.query = relative.query; + } else { + if (!relative.path) { + target.path = base2.path; + if (relative.query !== undefined) { + target.query = relative.query; + } else { + target.query = base2.query; + } + } else { + if (relative.path.charAt(0) === '/') { + target.path = removeDotSegments(relative.path); + } else { + if ( + (base2.userinfo !== undefined || + base2.host !== undefined || + base2.port !== undefined) && + !base2.path + ) { + target.path = '/' + relative.path; + } else if (!base2.path) { + target.path = relative.path; + } else { + target.path = + base2.path.slice( + 0, + base2.path.lastIndexOf('/') + 1 + ) + relative.path; + } + target.path = removeDotSegments(target.path); + } + target.query = relative.query; + } + target.userinfo = base2.userinfo; + target.host = base2.host; + target.port = base2.port; + } + target.scheme = base2.scheme; + } + target.fragment = relative.fragment; + return target; + } + function resolve(baseURI, relativeURI, options) { + var schemelessOptions = assign({ scheme: 'null' }, options); + return serialize( + resolveComponents( + parse2(baseURI, schemelessOptions), + parse2(relativeURI, schemelessOptions), + schemelessOptions, + true + ), + schemelessOptions + ); + } + function normalize(uri, options) { + if (typeof uri === 'string') { + uri = serialize(parse2(uri, options), options); + } else if (typeOf(uri) === 'object') { + uri = parse2(serialize(uri, options), options); + } + return uri; + } + function equal(uriA, uriB, options) { + if (typeof uriA === 'string') { + uriA = serialize(parse2(uriA, options), options); + } else if (typeOf(uriA) === 'object') { + uriA = serialize(uriA, options); + } + if (typeof uriB === 'string') { + uriB = serialize(parse2(uriB, options), options); + } else if (typeOf(uriB) === 'object') { + uriB = serialize(uriB, options); + } + return uriA === uriB; + } + function escapeComponent(str, options) { + return ( + str && + str + .toString() + .replace( + !options || !options.iri + ? URI_PROTOCOL.ESCAPE + : IRI_PROTOCOL.ESCAPE, + pctEncChar + ) + ); + } + function unescapeComponent(str, options) { + return ( + str && + str + .toString() + .replace( + !options || !options.iri + ? URI_PROTOCOL.PCT_ENCODED + : IRI_PROTOCOL.PCT_ENCODED, + pctDecChars + ) + ); + } + var handler2 = { + scheme: 'http', + domainHost: true, + parse: function parse(components, options) { + if (!components.host) { + components.error = + components.error || 'HTTP URIs must have a host.'; + } + return components; + }, + serialize: function serialize(components, options) { + var secure = + String(components.scheme).toLowerCase() === 'https'; + if ( + components.port === (secure ? 443 : 80) || + components.port === '' + ) { + components.port = undefined; + } + if (!components.path) { + components.path = '/'; + } + return components; + }, + }; + var handler$1 = { + scheme: 'https', + domainHost: handler2.domainHost, + parse: handler2.parse, + serialize: handler2.serialize, + }; + function isSecure(wsComponents) { + return typeof wsComponents.secure === 'boolean' + ? wsComponents.secure + : String(wsComponents.scheme).toLowerCase() === 'wss'; + } + var handler$2 = { + scheme: 'ws', + domainHost: true, + parse: function parse(components, options) { + var wsComponents = components; + wsComponents.secure = isSecure(wsComponents); + wsComponents.resourceName = + (wsComponents.path || '/') + + (wsComponents.query ? '?' + wsComponents.query : ''); + wsComponents.path = undefined; + wsComponents.query = undefined; + return wsComponents; + }, + serialize: function serialize(wsComponents, options) { + if ( + wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || + wsComponents.port === '' + ) { + wsComponents.port = undefined; + } + if (typeof wsComponents.secure === 'boolean') { + wsComponents.scheme = wsComponents.secure ? 'wss' : 'ws'; + wsComponents.secure = undefined; + } + if (wsComponents.resourceName) { + var _wsComponents$resourc = + wsComponents.resourceName.split('?'), + _wsComponents$resourc2 = slicedToArray( + _wsComponents$resourc, + 2 + ), + path = _wsComponents$resourc2[0], + query = _wsComponents$resourc2[1]; + wsComponents.path = path && path !== '/' ? path : undefined; + wsComponents.query = query; + wsComponents.resourceName = undefined; + } + wsComponents.fragment = undefined; + return wsComponents; + }, + }; + var handler$3 = { + scheme: 'wss', + domainHost: handler$2.domainHost, + parse: handler$2.parse, + serialize: handler$2.serialize, + }; + var O = {}; + var isIRI = true; + var UNRESERVED$$ = + '[A-Za-z0-9\\-\\.\\_\\~' + + (isIRI + ? '\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF' + : '') + + ']'; + var HEXDIG$$ = '[0-9A-Fa-f]'; + var PCT_ENCODED$ = subexp( + subexp( + '%[EFef]' + + HEXDIG$$ + + '%' + + HEXDIG$$ + + HEXDIG$$ + + '%' + + HEXDIG$$ + + HEXDIG$$ + ) + + '|' + + subexp('%[89A-Fa-f]' + HEXDIG$$ + '%' + HEXDIG$$ + HEXDIG$$) + + '|' + + subexp('%' + HEXDIG$$ + HEXDIG$$) + ); + var ATEXT$$ = "[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]"; + var QTEXT$$ = + "[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]"; + var VCHAR$$ = merge(QTEXT$$, '[\\"\\\\]'); + var SOME_DELIMS$$ = "[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"; + var UNRESERVED = new RegExp(UNRESERVED$$, 'g'); + var PCT_ENCODED = new RegExp(PCT_ENCODED$, 'g'); + var NOT_LOCAL_PART = new RegExp( + merge('[^]', ATEXT$$, '[\\.]', '[\\"]', VCHAR$$), + 'g' + ); + var NOT_HFNAME = new RegExp( + merge('[^]', UNRESERVED$$, SOME_DELIMS$$), + 'g' + ); + var NOT_HFVALUE = NOT_HFNAME; + function decodeUnreserved(str) { + var decStr = pctDecChars(str); + return !decStr.match(UNRESERVED) ? str : decStr; + } + var handler$4 = { + scheme: 'mailto', + parse: function parse$$1(components, options) { + var mailtoComponents = components; + var to = (mailtoComponents.to = mailtoComponents.path + ? mailtoComponents.path.split(',') + : []); + mailtoComponents.path = undefined; + if (mailtoComponents.query) { + var unknownHeaders = false; + var headers = {}; + var hfields = mailtoComponents.query.split('&'); + for (var x = 0, xl = hfields.length; x < xl; ++x) { + var hfield = hfields[x].split('='); + switch (hfield[0]) { + case 'to': + var toAddrs = hfield[1].split(','); + for ( + var _x = 0, _xl = toAddrs.length; + _x < _xl; + ++_x + ) { + to.push(toAddrs[_x]); + } + break; + case 'subject': + mailtoComponents.subject = unescapeComponent( + hfield[1], + options + ); + break; + case 'body': + mailtoComponents.body = unescapeComponent( + hfield[1], + options + ); + break; + default: + unknownHeaders = true; + headers[unescapeComponent(hfield[0], options)] = + unescapeComponent(hfield[1], options); + break; + } + } + if (unknownHeaders) mailtoComponents.headers = headers; + } + mailtoComponents.query = undefined; + for (var _x2 = 0, _xl2 = to.length; _x2 < _xl2; ++_x2) { + var addr = to[_x2].split('@'); + addr[0] = unescapeComponent(addr[0]); + if (!options.unicodeSupport) { + try { + addr[1] = punycode.toASCII( + unescapeComponent( + addr[1], + options + ).toLowerCase() + ); + } catch (e) { + mailtoComponents.error = + mailtoComponents.error || + "Email address's domain name can not be converted to ASCII via punycode: " + + e; + } + } else { + addr[1] = unescapeComponent( + addr[1], + options + ).toLowerCase(); + } + to[_x2] = addr.join('@'); + } + return mailtoComponents; + }, + serialize: function serialize$$1(mailtoComponents, options) { + var components = mailtoComponents; + var to = toArray(mailtoComponents.to); + if (to) { + for (var x = 0, xl = to.length; x < xl; ++x) { + var toAddr = String(to[x]); + var atIdx = toAddr.lastIndexOf('@'); + var localPart = toAddr + .slice(0, atIdx) + .replace(PCT_ENCODED, decodeUnreserved) + .replace(PCT_ENCODED, toUpperCase) + .replace(NOT_LOCAL_PART, pctEncChar); + var domain = toAddr.slice(atIdx + 1); + try { + domain = !options.iri + ? punycode.toASCII( + unescapeComponent( + domain, + options + ).toLowerCase() + ) + : punycode.toUnicode(domain); + } catch (e) { + components.error = + components.error || + "Email address's domain name can not be converted to " + + (!options.iri ? 'ASCII' : 'Unicode') + + ' via punycode: ' + + e; + } + to[x] = localPart + '@' + domain; + } + components.path = to.join(','); + } + var headers = (mailtoComponents.headers = + mailtoComponents.headers || {}); + if (mailtoComponents.subject) + headers['subject'] = mailtoComponents.subject; + if (mailtoComponents.body) + headers['body'] = mailtoComponents.body; + var fields = []; + for (var name in headers) { + if (headers[name] !== O[name]) { + fields.push( + name + .replace(PCT_ENCODED, decodeUnreserved) + .replace(PCT_ENCODED, toUpperCase) + .replace(NOT_HFNAME, pctEncChar) + + '=' + + headers[name] + .replace(PCT_ENCODED, decodeUnreserved) + .replace(PCT_ENCODED, toUpperCase) + .replace(NOT_HFVALUE, pctEncChar) + ); + } + } + if (fields.length) { + components.query = fields.join('&'); + } + return components; + }, + }; + var URN_PARSE = /^([^\:]+)\:(.*)/; + var handler$5 = { + scheme: 'urn', + parse: function parse$$1(components, options) { + var matches = + components.path && components.path.match(URN_PARSE); + var urnComponents = components; + if (matches) { + var scheme = + options.scheme || urnComponents.scheme || 'urn'; + var nid = matches[1].toLowerCase(); + var nss = matches[2]; + var urnScheme = scheme + ':' + (options.nid || nid); + var schemeHandler = SCHEMES[urnScheme]; + urnComponents.nid = nid; + urnComponents.nss = nss; + urnComponents.path = undefined; + if (schemeHandler) { + urnComponents = schemeHandler.parse( + urnComponents, + options + ); + } + } else { + urnComponents.error = + urnComponents.error || 'URN can not be parsed.'; + } + return urnComponents; + }, + serialize: function serialize$$1(urnComponents, options) { + var scheme = options.scheme || urnComponents.scheme || 'urn'; + var nid = urnComponents.nid; + var urnScheme = scheme + ':' + (options.nid || nid); + var schemeHandler = SCHEMES[urnScheme]; + if (schemeHandler) { + urnComponents = schemeHandler.serialize( + urnComponents, + options + ); + } + var uriComponents = urnComponents; + var nss = urnComponents.nss; + uriComponents.path = (nid || options.nid) + ':' + nss; + return uriComponents; + }, + }; + var UUID = /^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/; + var handler$6 = { + scheme: 'urn:uuid', + parse: function parse(urnComponents, options) { + var uuidComponents = urnComponents; + uuidComponents.uuid = uuidComponents.nss; + uuidComponents.nss = undefined; + if ( + !options.tolerant && + (!uuidComponents.uuid || !uuidComponents.uuid.match(UUID)) + ) { + uuidComponents.error = + uuidComponents.error || 'UUID is not valid.'; + } + return uuidComponents; + }, + serialize: function serialize(uuidComponents, options) { + var urnComponents = uuidComponents; + urnComponents.nss = (uuidComponents.uuid || '').toLowerCase(); + return urnComponents; + }, + }; + SCHEMES[handler2.scheme] = handler2; + SCHEMES[handler$1.scheme] = handler$1; + SCHEMES[handler$2.scheme] = handler$2; + SCHEMES[handler$3.scheme] = handler$3; + SCHEMES[handler$4.scheme] = handler$4; + SCHEMES[handler$5.scheme] = handler$5; + SCHEMES[handler$6.scheme] = handler$6; + exports2.SCHEMES = SCHEMES; + exports2.pctEncChar = pctEncChar; + exports2.pctDecChars = pctDecChars; + exports2.parse = parse2; + exports2.removeDotSegments = removeDotSegments; + exports2.serialize = serialize; + exports2.resolveComponents = resolveComponents; + exports2.resolve = resolve; + exports2.normalize = normalize; + exports2.equal = equal; + exports2.escapeComponent = escapeComponent; + exports2.unescapeComponent = unescapeComponent; + Object.defineProperty(exports2, '__esModule', { value: true }); + }); +}); + +// ../../../node_modules/ajv/dist/runtime/uri.js +var require_uri = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var uri = require_uri_all(); + uri.code = 'require("ajv/dist/runtime/uri").default'; + exports.default = uri; +}); + +// ../../../node_modules/ajv/dist/core.js +var require_core = __commonJS((exports) => { + var requiredOptions = function (o) { + var _a, + _b, + _c, + _d, + _e, + _f, + _g, + _h, + _j, + _k, + _l, + _m, + _o, + _p, + _q, + _r, + _s, + _t, + _u, + _v, + _w, + _x, + _y, + _z, + _0; + const s = o.strict; + const _optz = + (_a = o.code) === null || _a === undefined + ? undefined + : _a.optimize; + const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0; + const regExp = + (_c = + (_b = o.code) === null || _b === undefined + ? undefined + : _b.regExp) !== null && _c !== undefined + ? _c + : defaultRegExp; + const uriResolver = + (_d = o.uriResolver) !== null && _d !== undefined + ? _d + : uri_1.default; + return { + strictSchema: + (_f = + (_e = o.strictSchema) !== null && _e !== undefined + ? _e + : s) !== null && _f !== undefined + ? _f + : true, + strictNumbers: + (_h = + (_g = o.strictNumbers) !== null && _g !== undefined + ? _g + : s) !== null && _h !== undefined + ? _h + : true, + strictTypes: + (_k = + (_j = o.strictTypes) !== null && _j !== undefined + ? _j + : s) !== null && _k !== undefined + ? _k + : 'log', + strictTuples: + (_m = + (_l = o.strictTuples) !== null && _l !== undefined + ? _l + : s) !== null && _m !== undefined + ? _m + : 'log', + strictRequired: + (_p = + (_o = o.strictRequired) !== null && _o !== undefined + ? _o + : s) !== null && _p !== undefined + ? _p + : false, + code: o.code + ? { ...o.code, optimize, regExp } + : { optimize, regExp }, + loopRequired: + (_q = o.loopRequired) !== null && _q !== undefined + ? _q + : MAX_EXPRESSION, + loopEnum: + (_r = o.loopEnum) !== null && _r !== undefined + ? _r + : MAX_EXPRESSION, + meta: (_s = o.meta) !== null && _s !== undefined ? _s : true, + messages: + (_t = o.messages) !== null && _t !== undefined ? _t : true, + inlineRefs: + (_u = o.inlineRefs) !== null && _u !== undefined ? _u : true, + schemaId: + (_v = o.schemaId) !== null && _v !== undefined ? _v : '$id', + addUsedSchema: + (_w = o.addUsedSchema) !== null && _w !== undefined ? _w : true, + validateSchema: + (_x = o.validateSchema) !== null && _x !== undefined + ? _x + : true, + validateFormats: + (_y = o.validateFormats) !== null && _y !== undefined + ? _y + : true, + unicodeRegExp: + (_z = o.unicodeRegExp) !== null && _z !== undefined ? _z : true, + int32range: + (_0 = o.int32range) !== null && _0 !== undefined ? _0 : true, + uriResolver, + }; + }; + var checkOptions = function (checkOpts, options, msg, log = 'error') { + for (const key in checkOpts) { + const opt = key; + if (opt in options) + this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`); + } + }; + var getSchEnv = function (keyRef) { + keyRef = (0, resolve_1.normalizeId)(keyRef); + return this.schemas[keyRef] || this.refs[keyRef]; + }; + var addInitialSchemas = function () { + const optsSchemas = this.opts.schemas; + if (!optsSchemas) return; + if (Array.isArray(optsSchemas)) this.addSchema(optsSchemas); + else + for (const key in optsSchemas) + this.addSchema(optsSchemas[key], key); + }; + var addInitialFormats = function () { + for (const name in this.opts.formats) { + const format = this.opts.formats[name]; + if (format) this.addFormat(name, format); + } + }; + var addInitialKeywords = function (defs) { + if (Array.isArray(defs)) { + this.addVocabulary(defs); + return; + } + this.logger.warn('keywords option as map is deprecated, pass array'); + for (const keyword in defs) { + const def = defs[keyword]; + if (!def.keyword) def.keyword = keyword; + this.addKeyword(def); + } + }; + var getMetaSchemaOptions = function () { + const metaOpts = { ...this.opts }; + for (const opt of META_IGNORE_OPTIONS) delete metaOpts[opt]; + return metaOpts; + }; + var getLogger = function (logger17) { + if (logger17 === false) return noLogs; + if (logger17 === undefined) return console; + if (logger17.log && logger17.warn && logger17.error) return logger17; + throw new Error('logger must implement log, warn and error methods'); + }; + var checkKeyword = function (keyword, def) { + const { RULES } = this; + (0, util_1.eachItem)(keyword, (kwd) => { + if (RULES.keywords[kwd]) + throw new Error(`Keyword ${kwd} is already defined`); + if (!KEYWORD_NAME.test(kwd)) + throw new Error(`Keyword ${kwd} has invalid name`); + }); + if (!def) return; + if (def.$data && !('code' in def || 'validate' in def)) { + throw new Error( + '$data keyword must have "code" or "validate" function' + ); + } + }; + var addRule = function (keyword, definition, dataType) { + var _a; + const post = + definition === null || definition === undefined + ? undefined + : definition.post; + if (dataType && post) + throw new Error('keyword with "post" flag cannot have "type"'); + const { RULES } = this; + let ruleGroup = post + ? RULES.post + : RULES.rules.find(({ type: t }) => t === dataType); + if (!ruleGroup) { + ruleGroup = { type: dataType, rules: [] }; + RULES.rules.push(ruleGroup); + } + RULES.keywords[keyword] = true; + if (!definition) return; + const rule = { + keyword, + definition: { + ...definition, + type: (0, dataType_1.getJSONTypes)(definition.type), + schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType), + }, + }; + if (definition.before) + addBeforeRule.call(this, ruleGroup, rule, definition.before); + else ruleGroup.rules.push(rule); + RULES.all[keyword] = rule; + (_a = definition.implements) === null || + _a === undefined || + _a.forEach((kwd) => this.addKeyword(kwd)); + }; + var addBeforeRule = function (ruleGroup, rule, before) { + const i = ruleGroup.rules.findIndex( + (_rule) => _rule.keyword === before + ); + if (i >= 0) { + ruleGroup.rules.splice(i, 0, rule); + } else { + ruleGroup.rules.push(rule); + this.logger.warn(`rule ${before} is not defined`); + } + }; + var keywordMetaschema = function (def) { + let { metaSchema } = def; + if (metaSchema === undefined) return; + if (def.$data && this.opts.$data) metaSchema = schemaOrData(metaSchema); + def.validateSchema = this.compile(metaSchema, true); + }; + var schemaOrData = function (schema) { + return { anyOf: [schema, $dataRef] }; + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.CodeGen = + exports.Name = + exports.nil = + exports.stringify = + exports.str = + exports._ = + exports.KeywordCxt = + undefined; + var validate_1 = require_validate(); + Object.defineProperty(exports, 'KeywordCxt', { + enumerable: true, + get: function () { + return validate_1.KeywordCxt; + }, + }); + var codegen_1 = require_codegen(); + Object.defineProperty(exports, '_', { + enumerable: true, + get: function () { + return codegen_1._; + }, + }); + Object.defineProperty(exports, 'str', { + enumerable: true, + get: function () { + return codegen_1.str; + }, + }); + Object.defineProperty(exports, 'stringify', { + enumerable: true, + get: function () { + return codegen_1.stringify; + }, + }); + Object.defineProperty(exports, 'nil', { + enumerable: true, + get: function () { + return codegen_1.nil; + }, + }); + Object.defineProperty(exports, 'Name', { + enumerable: true, + get: function () { + return codegen_1.Name; + }, + }); + Object.defineProperty(exports, 'CodeGen', { + enumerable: true, + get: function () { + return codegen_1.CodeGen; + }, + }); + var validation_error_1 = require_validation_error(); + var ref_error_1 = require_ref_error(); + var rules_1 = require_rules(); + var compile_1 = require_compile(); + var codegen_2 = require_codegen(); + var resolve_1 = require_resolve(); + var dataType_1 = require_dataType(); + var util_1 = require_util(); + var $dataRefSchema = require_data(); + var uri_1 = require_uri(); + var defaultRegExp = (str, flags) => new RegExp(str, flags); + defaultRegExp.code = 'new RegExp'; + var META_IGNORE_OPTIONS = [ + 'removeAdditional', + 'useDefaults', + 'coerceTypes', + ]; + var EXT_SCOPE_NAMES = new Set([ + 'validate', + 'serialize', + 'parse', + 'wrapper', + 'root', + 'schema', + 'keyword', + 'pattern', + 'formats', + 'validate$data', + 'func', + 'obj', + 'Error', + ]); + var removedOptions = { + errorDataPath: '', + format: '`validateFormats: false` can be used instead.', + nullable: '"nullable" keyword is supported by default.', + jsonPointers: 'Deprecated jsPropertySyntax can be used instead.', + extendRefs: 'Deprecated ignoreKeywordsWithRef can be used instead.', + missingRefs: + 'Pass empty schema with $id that should be ignored to ajv.addSchema.', + processCode: + 'Use option `code: {process: (code, schemaEnv: object) => string}`', + sourceCode: 'Use option `code: {source: true}`', + strictDefaults: 'It is default now, see option `strict`.', + strictKeywords: 'It is default now, see option `strict`.', + uniqueItems: '"uniqueItems" keyword is always validated.', + unknownFormats: + 'Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).', + cache: 'Map is used as cache, schema object as key.', + serialize: 'Map is used as cache, schema object as key.', + ajvErrors: 'It is default now.', + }; + var deprecatedOptions = { + ignoreKeywordsWithRef: '', + jsPropertySyntax: '', + unicode: + '"minLength"/"maxLength" account for unicode characters by default.', + }; + var MAX_EXPRESSION = 200; + + class Ajv { + constructor(opts = {}) { + this.schemas = {}; + this.refs = {}; + this.formats = {}; + this._compilations = new Set(); + this._loading = {}; + this._cache = new Map(); + opts = this.opts = { ...opts, ...requiredOptions(opts) }; + const { es5, lines } = this.opts.code; + this.scope = new codegen_2.ValueScope({ + scope: {}, + prefixes: EXT_SCOPE_NAMES, + es5, + lines, + }); + this.logger = getLogger(opts.logger); + const formatOpt = opts.validateFormats; + opts.validateFormats = false; + this.RULES = (0, rules_1.getRules)(); + checkOptions.call(this, removedOptions, opts, 'NOT SUPPORTED'); + checkOptions.call( + this, + deprecatedOptions, + opts, + 'DEPRECATED', + 'warn' + ); + this._metaOpts = getMetaSchemaOptions.call(this); + if (opts.formats) addInitialFormats.call(this); + this._addVocabularies(); + this._addDefaultMetaSchema(); + if (opts.keywords) addInitialKeywords.call(this, opts.keywords); + if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta); + addInitialSchemas.call(this); + opts.validateFormats = formatOpt; + } + _addVocabularies() { + this.addKeyword('$async'); + } + _addDefaultMetaSchema() { + const { $data, meta, schemaId } = this.opts; + let _dataRefSchema = $dataRefSchema; + if (schemaId === 'id') { + _dataRefSchema = { ...$dataRefSchema }; + _dataRefSchema.id = _dataRefSchema.$id; + delete _dataRefSchema.$id; + } + if (meta && $data) + this.addMetaSchema( + _dataRefSchema, + _dataRefSchema[schemaId], + false + ); + } + defaultMeta() { + const { meta, schemaId } = this.opts; + return (this.opts.defaultMeta = + typeof meta == 'object' ? meta[schemaId] || meta : undefined); + } + validate(schemaKeyRef, data) { + let v; + if (typeof schemaKeyRef == 'string') { + v = this.getSchema(schemaKeyRef); + if (!v) + throw new Error( + `no schema with key or ref "${schemaKeyRef}"` + ); + } else { + v = this.compile(schemaKeyRef); + } + const valid = v(data); + if (!('$async' in v)) this.errors = v.errors; + return valid; + } + compile(schema, _meta) { + const sch = this._addSchema(schema, _meta); + return sch.validate || this._compileSchemaEnv(sch); + } + compileAsync(schema, meta) { + if (typeof this.opts.loadSchema != 'function') { + throw new Error('options.loadSchema should be a function'); + } + const { loadSchema } = this.opts; + return runCompileAsync.call(this, schema, meta); + async function runCompileAsync(_schema, _meta) { + await loadMetaSchema.call(this, _schema.$schema); + const sch = this._addSchema(_schema, _meta); + return sch.validate || _compileAsync.call(this, sch); + } + async function loadMetaSchema($ref) { + if ($ref && !this.getSchema($ref)) { + await runCompileAsync.call(this, { $ref }, true); + } + } + async function _compileAsync(sch) { + try { + return this._compileSchemaEnv(sch); + } catch (e) { + if (!(e instanceof ref_error_1.default)) throw e; + checkLoaded.call(this, e); + await loadMissingSchema.call(this, e.missingSchema); + return _compileAsync.call(this, sch); + } + } + function checkLoaded({ missingSchema: ref, missingRef }) { + if (this.refs[ref]) { + throw new Error( + `AnySchema ${ref} is loaded but ${missingRef} cannot be resolved` + ); + } + } + async function loadMissingSchema(ref) { + const _schema = await _loadSchema.call(this, ref); + if (!this.refs[ref]) + await loadMetaSchema.call(this, _schema.$schema); + if (!this.refs[ref]) this.addSchema(_schema, ref, meta); + } + async function _loadSchema(ref) { + const p = this._loading[ref]; + if (p) return p; + try { + return await (this._loading[ref] = loadSchema(ref)); + } finally { + delete this._loading[ref]; + } + } + } + addSchema( + schema, + key, + _meta, + _validateSchema = this.opts.validateSchema + ) { + if (Array.isArray(schema)) { + for (const sch of schema) + this.addSchema(sch, undefined, _meta, _validateSchema); + return this; + } + let id; + if (typeof schema === 'object') { + const { schemaId } = this.opts; + id = schema[schemaId]; + if (id !== undefined && typeof id != 'string') { + throw new Error(`schema ${schemaId} must be string`); + } + } + key = (0, resolve_1.normalizeId)(key || id); + this._checkUnique(key); + this.schemas[key] = this._addSchema( + schema, + _meta, + key, + _validateSchema, + true + ); + return this; + } + addMetaSchema(schema, key, _validateSchema = this.opts.validateSchema) { + this.addSchema(schema, key, true, _validateSchema); + return this; + } + validateSchema(schema, throwOrLogError) { + if (typeof schema == 'boolean') return true; + let $schema; + $schema = schema.$schema; + if ($schema !== undefined && typeof $schema != 'string') { + throw new Error('$schema must be a string'); + } + $schema = $schema || this.opts.defaultMeta || this.defaultMeta(); + if (!$schema) { + this.logger.warn('meta-schema not available'); + this.errors = null; + return true; + } + const valid = this.validate($schema, schema); + if (!valid && throwOrLogError) { + const message = 'schema is invalid: ' + this.errorsText(); + if (this.opts.validateSchema === 'log') + this.logger.error(message); + else throw new Error(message); + } + return valid; + } + getSchema(keyRef) { + let sch; + while (typeof (sch = getSchEnv.call(this, keyRef)) == 'string') + keyRef = sch; + if (sch === undefined) { + const { schemaId } = this.opts; + const root = new compile_1.SchemaEnv({ schema: {}, schemaId }); + sch = compile_1.resolveSchema.call(this, root, keyRef); + if (!sch) return; + this.refs[keyRef] = sch; + } + return sch.validate || this._compileSchemaEnv(sch); + } + removeSchema(schemaKeyRef) { + if (schemaKeyRef instanceof RegExp) { + this._removeAllSchemas(this.schemas, schemaKeyRef); + this._removeAllSchemas(this.refs, schemaKeyRef); + return this; + } + switch (typeof schemaKeyRef) { + case 'undefined': + this._removeAllSchemas(this.schemas); + this._removeAllSchemas(this.refs); + this._cache.clear(); + return this; + case 'string': { + const sch = getSchEnv.call(this, schemaKeyRef); + if (typeof sch == 'object') this._cache.delete(sch.schema); + delete this.schemas[schemaKeyRef]; + delete this.refs[schemaKeyRef]; + return this; + } + case 'object': { + const cacheKey = schemaKeyRef; + this._cache.delete(cacheKey); + let id = schemaKeyRef[this.opts.schemaId]; + if (id) { + id = (0, resolve_1.normalizeId)(id); + delete this.schemas[id]; + delete this.refs[id]; + } + return this; + } + default: + throw new Error('ajv.removeSchema: invalid parameter'); + } + } + addVocabulary(definitions) { + for (const def of definitions) this.addKeyword(def); + return this; + } + addKeyword(kwdOrDef, def) { + let keyword; + if (typeof kwdOrDef == 'string') { + keyword = kwdOrDef; + if (typeof def == 'object') { + this.logger.warn( + 'these parameters are deprecated, see docs for addKeyword' + ); + def.keyword = keyword; + } + } else if (typeof kwdOrDef == 'object' && def === undefined) { + def = kwdOrDef; + keyword = def.keyword; + if (Array.isArray(keyword) && !keyword.length) { + throw new Error( + 'addKeywords: keyword must be string or non-empty array' + ); + } + } else { + throw new Error('invalid addKeywords parameters'); + } + checkKeyword.call(this, keyword, def); + if (!def) { + (0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd)); + return this; + } + keywordMetaschema.call(this, def); + const definition = { + ...def, + type: (0, dataType_1.getJSONTypes)(def.type), + schemaType: (0, dataType_1.getJSONTypes)(def.schemaType), + }; + (0, util_1.eachItem)( + keyword, + definition.type.length === 0 + ? (k) => addRule.call(this, k, definition) + : (k) => + definition.type.forEach((t) => + addRule.call(this, k, definition, t) + ) + ); + return this; + } + getKeyword(keyword) { + const rule = this.RULES.all[keyword]; + return typeof rule == 'object' ? rule.definition : !!rule; + } + removeKeyword(keyword) { + const { RULES } = this; + delete RULES.keywords[keyword]; + delete RULES.all[keyword]; + for (const group of RULES.rules) { + const i = group.rules.findIndex( + (rule) => rule.keyword === keyword + ); + if (i >= 0) group.rules.splice(i, 1); + } + return this; + } + addFormat(name, format) { + if (typeof format == 'string') format = new RegExp(format); + this.formats[name] = format; + return this; + } + errorsText( + errors = this.errors, + { separator = ', ', dataVar = 'data' } = {} + ) { + if (!errors || errors.length === 0) return 'No errors'; + return errors + .map((e) => `${dataVar}${e.instancePath} ${e.message}`) + .reduce((text, msg) => text + separator + msg); + } + $dataMetaSchema(metaSchema, keywordsJsonPointers) { + const rules = this.RULES.all; + metaSchema = JSON.parse(JSON.stringify(metaSchema)); + for (const jsonPointer of keywordsJsonPointers) { + const segments = jsonPointer.split('/').slice(1); + let keywords = metaSchema; + for (const seg of segments) keywords = keywords[seg]; + for (const key in rules) { + const rule = rules[key]; + if (typeof rule != 'object') continue; + const { $data } = rule.definition; + const schema = keywords[key]; + if ($data && schema) keywords[key] = schemaOrData(schema); + } + } + return metaSchema; + } + _removeAllSchemas(schemas, regex) { + for (const keyRef in schemas) { + const sch = schemas[keyRef]; + if (!regex || regex.test(keyRef)) { + if (typeof sch == 'string') { + delete schemas[keyRef]; + } else if (sch && !sch.meta) { + this._cache.delete(sch.schema); + delete schemas[keyRef]; + } + } + } + } + _addSchema( + schema, + meta, + baseId, + validateSchema = this.opts.validateSchema, + addSchema = this.opts.addUsedSchema + ) { + let id; + const { schemaId } = this.opts; + if (typeof schema == 'object') { + id = schema[schemaId]; + } else { + if (this.opts.jtd) throw new Error('schema must be object'); + else if (typeof schema != 'boolean') + throw new Error('schema must be object or boolean'); + } + let sch = this._cache.get(schema); + if (sch !== undefined) return sch; + baseId = (0, resolve_1.normalizeId)(id || baseId); + const localRefs = resolve_1.getSchemaRefs.call( + this, + schema, + baseId + ); + sch = new compile_1.SchemaEnv({ + schema, + schemaId, + meta, + baseId, + localRefs, + }); + this._cache.set(sch.schema, sch); + if (addSchema && !baseId.startsWith('#')) { + if (baseId) this._checkUnique(baseId); + this.refs[baseId] = sch; + } + if (validateSchema) this.validateSchema(schema, true); + return sch; + } + _checkUnique(id) { + if (this.schemas[id] || this.refs[id]) { + throw new Error(`schema with key or id "${id}" already exists`); + } + } + _compileSchemaEnv(sch) { + if (sch.meta) this._compileMetaSchema(sch); + else compile_1.compileSchema.call(this, sch); + if (!sch.validate) throw new Error('ajv implementation error'); + return sch.validate; + } + _compileMetaSchema(sch) { + const currentOpts = this.opts; + this.opts = this._metaOpts; + try { + compile_1.compileSchema.call(this, sch); + } finally { + this.opts = currentOpts; + } + } + } + exports.default = Ajv; + Ajv.ValidationError = validation_error_1.default; + Ajv.MissingRefError = ref_error_1.default; + var noLogs = { log() {}, warn() {}, error() {} }; + var KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i; + var $dataRef = { + $ref: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#', + }; +}); + +// ../../../node_modules/ajv/dist/vocabularies/core/id.js +var require_id = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var def = { + keyword: 'id', + code() { + throw new Error( + 'NOT SUPPORTED: keyword "id", use "$id" for schema ID' + ); + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/core/ref.js +var require_ref = __commonJS((exports) => { + var getValidate = function (cxt, sch) { + const { gen } = cxt; + return sch.validate + ? gen.scopeValue('validate', { ref: sch.validate }) + : (0, codegen_1._)`${gen.scopeValue('wrapper', { + ref: sch, + })}.validate`; + }; + var callRef = function (cxt, v, sch, $async) { + const { gen, it } = cxt; + const { allErrors, schemaEnv: env, opts } = it; + const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil; + if ($async) callAsyncRef(); + else callSyncRef(); + function callAsyncRef() { + if (!env.$async) + throw new Error('async schema referenced by sync schema'); + const valid = gen.let('valid'); + gen.try( + () => { + gen.code( + (0, codegen_1._)`await ${(0, code_1.callValidateCode)( + cxt, + v, + passCxt + )}` + ); + addEvaluatedFrom(v); + if (!allErrors) gen.assign(valid, true); + }, + (e) => { + gen.if( + (0, + codegen_1._)`!(${e} instanceof ${it.ValidationError})`, + () => gen.throw(e) + ); + addErrorsFrom(e); + if (!allErrors) gen.assign(valid, false); + } + ); + cxt.ok(valid); + } + function callSyncRef() { + cxt.result( + (0, code_1.callValidateCode)(cxt, v, passCxt), + () => addEvaluatedFrom(v), + () => addErrorsFrom(v) + ); + } + function addErrorsFrom(source) { + const errs = (0, codegen_1._)`${source}.errors`; + gen.assign( + names_1.default.vErrors, + (0, + codegen_1._)`${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})` + ); + gen.assign( + names_1.default.errors, + (0, codegen_1._)`${names_1.default.vErrors}.length` + ); + } + function addEvaluatedFrom(source) { + var _a; + if (!it.opts.unevaluated) return; + const schEvaluated = + (_a = + sch === null || sch === undefined + ? undefined + : sch.validate) === null || _a === undefined + ? undefined + : _a.evaluated; + if (it.props !== true) { + if (schEvaluated && !schEvaluated.dynamicProps) { + if (schEvaluated.props !== undefined) { + it.props = util_1.mergeEvaluated.props( + gen, + schEvaluated.props, + it.props + ); + } + } else { + const props = gen.var( + 'props', + (0, codegen_1._)`${source}.evaluated.props` + ); + it.props = util_1.mergeEvaluated.props( + gen, + props, + it.props, + codegen_1.Name + ); + } + } + if (it.items !== true) { + if (schEvaluated && !schEvaluated.dynamicItems) { + if (schEvaluated.items !== undefined) { + it.items = util_1.mergeEvaluated.items( + gen, + schEvaluated.items, + it.items + ); + } + } else { + const items = gen.var( + 'items', + (0, codegen_1._)`${source}.evaluated.items` + ); + it.items = util_1.mergeEvaluated.items( + gen, + items, + it.items, + codegen_1.Name + ); + } + } + } + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.callRef = exports.getValidate = undefined; + var ref_error_1 = require_ref_error(); + var code_1 = require_code2(); + var codegen_1 = require_codegen(); + var names_1 = require_names(); + var compile_1 = require_compile(); + var util_1 = require_util(); + var def = { + keyword: '$ref', + schemaType: 'string', + code(cxt) { + const { gen, schema: $ref, it } = cxt; + const { + baseId, + schemaEnv: env, + validateName, + opts, + self: self2, + } = it; + const { root } = env; + if (($ref === '#' || $ref === '#/') && baseId === root.baseId) + return callRootRef(); + const schOrEnv = compile_1.resolveRef.call( + self2, + root, + baseId, + $ref + ); + if (schOrEnv === undefined) + throw new ref_error_1.default( + it.opts.uriResolver, + baseId, + $ref + ); + if (schOrEnv instanceof compile_1.SchemaEnv) + return callValidate(schOrEnv); + return inlineRefSchema(schOrEnv); + function callRootRef() { + if (env === root) + return callRef(cxt, validateName, env, env.$async); + const rootName = gen.scopeValue('root', { ref: root }); + return callRef( + cxt, + (0, codegen_1._)`${rootName}.validate`, + root, + root.$async + ); + } + function callValidate(sch) { + const v = getValidate(cxt, sch); + callRef(cxt, v, sch, sch.$async); + } + function inlineRefSchema(sch) { + const schName = gen.scopeValue( + 'schema', + opts.code.source === true + ? { ref: sch, code: (0, codegen_1.stringify)(sch) } + : { ref: sch } + ); + const valid = gen.name('valid'); + const schCxt = cxt.subschema( + { + schema: sch, + dataTypes: [], + schemaPath: codegen_1.nil, + topSchemaRef: schName, + errSchemaPath: $ref, + }, + valid + ); + cxt.mergeEvaluated(schCxt); + cxt.ok(valid); + } + }, + }; + exports.getValidate = getValidate; + exports.callRef = callRef; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/core/index.js +var require_core2 = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var id_1 = require_id(); + var ref_1 = require_ref(); + var core = [ + '$schema', + '$id', + '$defs', + '$vocabulary', + { keyword: '$comment' }, + 'definitions', + id_1.default, + ref_1.default, + ]; + exports.default = core; +}); + +// ../../../node_modules/ajv/dist/vocabularies/validation/limitNumber.js +var require_limitNumber = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var ops = codegen_1.operators; + var KWDs = { + maximum: { okStr: '<=', ok: ops.LTE, fail: ops.GT }, + minimum: { okStr: '>=', ok: ops.GTE, fail: ops.LT }, + exclusiveMaximum: { okStr: '<', ok: ops.LT, fail: ops.GTE }, + exclusiveMinimum: { okStr: '>', ok: ops.GT, fail: ops.LTE }, + }; + var error = { + message: ({ keyword, schemaCode }) => + (0, codegen_1.str)`must be ${KWDs[keyword].okStr} ${schemaCode}`, + params: ({ keyword, schemaCode }) => + (0, + codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`, + }; + var def = { + keyword: Object.keys(KWDs), + type: 'number', + schemaType: 'number', + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + cxt.fail$data( + (0, + codegen_1._)`${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})` + ); + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/validation/multipleOf.js +var require_multipleOf = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var error = { + message: ({ schemaCode }) => + (0, codegen_1.str)`must be multiple of ${schemaCode}`, + params: ({ schemaCode }) => + (0, codegen_1._)`{multipleOf: ${schemaCode}}`, + }; + var def = { + keyword: 'multipleOf', + type: 'number', + schemaType: 'number', + $data: true, + error, + code(cxt) { + const { gen, data, schemaCode, it } = cxt; + const prec = it.opts.multipleOfPrecision; + const res = gen.let('res'); + const invalid = prec + ? (0, + codegen_1._)`Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` + : (0, codegen_1._)`${res} !== parseInt(${res})`; + cxt.fail$data( + (0, + codegen_1._)`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))` + ); + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/runtime/ucs2length.js +var require_ucs2length = __commonJS((exports) => { + var ucs2length = function (str) { + const len = str.length; + let length = 0; + let pos = 0; + let value; + while (pos < len) { + length++; + value = str.charCodeAt(pos++); + if (value >= 55296 && value <= 56319 && pos < len) { + value = str.charCodeAt(pos); + if ((value & 64512) === 56320) pos++; + } + } + return length; + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.default = ucs2length; + ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default'; +}); + +// ../../../node_modules/ajv/dist/vocabularies/validation/limitLength.js +var require_limitLength = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var ucs2length_1 = require_ucs2length(); + var error = { + message({ keyword, schemaCode }) { + const comp = keyword === 'maxLength' ? 'more' : 'fewer'; + return (0, + codegen_1.str)`must NOT have ${comp} than ${schemaCode} characters`; + }, + params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}`, + }; + var def = { + keyword: ['maxLength', 'minLength'], + type: 'string', + schemaType: 'number', + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode, it } = cxt; + const op = + keyword === 'maxLength' + ? codegen_1.operators.GT + : codegen_1.operators.LT; + const len = + it.opts.unicode === false + ? (0, codegen_1._)`${data}.length` + : (0, codegen_1._)`${(0, util_1.useFunc)( + cxt.gen, + ucs2length_1.default + )}(${data})`; + cxt.fail$data((0, codegen_1._)`${len} ${op} ${schemaCode}`); + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/validation/pattern.js +var require_pattern = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var code_1 = require_code2(); + var codegen_1 = require_codegen(); + var error = { + message: ({ schemaCode }) => + (0, codegen_1.str)`must match pattern "${schemaCode}"`, + params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}`, + }; + var def = { + keyword: 'pattern', + type: 'string', + schemaType: 'string', + $data: true, + error, + code(cxt) { + const { data, $data, schema, schemaCode, it } = cxt; + const u = it.opts.unicodeRegExp ? 'u' : ''; + const regExp = $data + ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` + : (0, code_1.usePattern)(cxt, schema); + cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`); + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/validation/limitProperties.js +var require_limitProperties = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var error = { + message({ keyword, schemaCode }) { + const comp = keyword === 'maxProperties' ? 'more' : 'fewer'; + return (0, + codegen_1.str)`must NOT have ${comp} than ${schemaCode} properties`; + }, + params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}`, + }; + var def = { + keyword: ['maxProperties', 'minProperties'], + type: 'object', + schemaType: 'number', + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + const op = + keyword === 'maxProperties' + ? codegen_1.operators.GT + : codegen_1.operators.LT; + cxt.fail$data( + (0, + codegen_1._)`Object.keys(${data}).length ${op} ${schemaCode}` + ); + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/validation/required.js +var require_required = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var code_1 = require_code2(); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var error = { + message: ({ params: { missingProperty } }) => + (0, + codegen_1.str)`must have required property '${missingProperty}'`, + params: ({ params: { missingProperty } }) => + (0, codegen_1._)`{missingProperty: ${missingProperty}}`, + }; + var def = { + keyword: 'required', + type: 'object', + schemaType: 'array', + $data: true, + error, + code(cxt) { + const { gen, schema, schemaCode, data, $data, it } = cxt; + const { opts } = it; + if (!$data && schema.length === 0) return; + const useLoop = schema.length >= opts.loopRequired; + if (it.allErrors) allErrorsMode(); + else exitOnErrorMode(); + if (opts.strictRequired) { + const props = cxt.parentSchema.properties; + const { definedProperties } = cxt.it; + for (const requiredKey of schema) { + if ( + (props === null || props === undefined + ? undefined + : props[requiredKey]) === undefined && + !definedProperties.has(requiredKey) + ) { + const schemaPath = + it.schemaEnv.baseId + it.errSchemaPath; + const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)`; + (0, util_1.checkStrictMode)( + it, + msg, + it.opts.strictRequired + ); + } + } + } + function allErrorsMode() { + if (useLoop || $data) { + cxt.block$data(codegen_1.nil, loopAllRequired); + } else { + for (const prop of schema) { + (0, code_1.checkReportMissingProp)(cxt, prop); + } + } + } + function exitOnErrorMode() { + const missing = gen.let('missing'); + if (useLoop || $data) { + const valid = gen.let('valid', true); + cxt.block$data(valid, () => + loopUntilMissing(missing, valid) + ); + cxt.ok(valid); + } else { + gen.if((0, code_1.checkMissingProp)(cxt, schema, missing)); + (0, code_1.reportMissingProp)(cxt, missing); + gen.else(); + } + } + function loopAllRequired() { + gen.forOf('prop', schemaCode, (prop) => { + cxt.setParams({ missingProperty: prop }); + gen.if( + (0, code_1.noPropertyInData)( + gen, + data, + prop, + opts.ownProperties + ), + () => cxt.error() + ); + }); + } + function loopUntilMissing(missing, valid) { + cxt.setParams({ missingProperty: missing }); + gen.forOf( + missing, + schemaCode, + () => { + gen.assign( + valid, + (0, code_1.propertyInData)( + gen, + data, + missing, + opts.ownProperties + ) + ); + gen.if((0, codegen_1.not)(valid), () => { + cxt.error(); + gen.break(); + }); + }, + codegen_1.nil + ); + } + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/validation/limitItems.js +var require_limitItems = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var error = { + message({ keyword, schemaCode }) { + const comp = keyword === 'maxItems' ? 'more' : 'fewer'; + return (0, + codegen_1.str)`must NOT have ${comp} than ${schemaCode} items`; + }, + params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}`, + }; + var def = { + keyword: ['maxItems', 'minItems'], + type: 'array', + schemaType: 'number', + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + const op = + keyword === 'maxItems' + ? codegen_1.operators.GT + : codegen_1.operators.LT; + cxt.fail$data((0, codegen_1._)`${data}.length ${op} ${schemaCode}`); + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/runtime/equal.js +var require_equal = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var equal = require_fast_deep_equal(); + equal.code = 'require("ajv/dist/runtime/equal").default'; + exports.default = equal; +}); + +// ../../../node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +var require_uniqueItems = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var dataType_1 = require_dataType(); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var equal_1 = require_equal(); + var error = { + message: ({ params: { i, j } }) => + (0, + codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`, + params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}`, + }; + var def = { + keyword: 'uniqueItems', + type: 'array', + schemaType: 'boolean', + $data: true, + error, + code(cxt) { + const { gen, data, $data, schema, parentSchema, schemaCode, it } = + cxt; + if (!$data && !schema) return; + const valid = gen.let('valid'); + const itemTypes = parentSchema.items + ? (0, dataType_1.getSchemaTypes)(parentSchema.items) + : []; + cxt.block$data( + valid, + validateUniqueItems, + (0, codegen_1._)`${schemaCode} === false` + ); + cxt.ok(valid); + function validateUniqueItems() { + const i = gen.let('i', (0, codegen_1._)`${data}.length`); + const j = gen.let('j'); + cxt.setParams({ i, j }); + gen.assign(valid, true); + gen.if((0, codegen_1._)`${i} > 1`, () => + (canOptimize() ? loopN : loopN2)(i, j) + ); + } + function canOptimize() { + return ( + itemTypes.length > 0 && + !itemTypes.some((t) => t === 'object' || t === 'array') + ); + } + function loopN(i, j) { + const item = gen.name('item'); + const wrongType = (0, dataType_1.checkDataTypes)( + itemTypes, + item, + it.opts.strictNumbers, + dataType_1.DataType.Wrong + ); + const indices = gen.const('indices', (0, codegen_1._)`{}`); + gen.for((0, codegen_1._)`;${i}--;`, () => { + gen.let(item, (0, codegen_1._)`${data}[${i}]`); + gen.if(wrongType, (0, codegen_1._)`continue`); + if (itemTypes.length > 1) + gen.if( + (0, codegen_1._)`typeof ${item} == "string"`, + (0, codegen_1._)`${item} += "_"` + ); + gen.if( + (0, + codegen_1._)`typeof ${indices}[${item}] == "number"`, + () => { + gen.assign( + j, + (0, codegen_1._)`${indices}[${item}]` + ); + cxt.error(); + gen.assign(valid, false).break(); + } + ).code((0, codegen_1._)`${indices}[${item}] = ${i}`); + }); + } + function loopN2(i, j) { + const eql = (0, util_1.useFunc)(gen, equal_1.default); + const outer = gen.name('outer'); + gen.label(outer).for((0, codegen_1._)`;${i}--;`, () => + gen.for((0, codegen_1._)`${j} = ${i}; ${j}--;`, () => + gen.if( + (0, + codegen_1._)`${eql}(${data}[${i}], ${data}[${j}])`, + () => { + cxt.error(); + gen.assign(valid, false).break(outer); + } + ) + ) + ); + } + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/validation/const.js +var require_const = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var equal_1 = require_equal(); + var error = { + message: 'must be equal to constant', + params: ({ schemaCode }) => + (0, codegen_1._)`{allowedValue: ${schemaCode}}`, + }; + var def = { + keyword: 'const', + $data: true, + error, + code(cxt) { + const { gen, data, $data, schemaCode, schema } = cxt; + if ($data || (schema && typeof schema == 'object')) { + cxt.fail$data( + (0, codegen_1._)`!${(0, util_1.useFunc)( + gen, + equal_1.default + )}(${data}, ${schemaCode})` + ); + } else { + cxt.fail((0, codegen_1._)`${schema} !== ${data}`); + } + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/validation/enum.js +var require_enum = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var equal_1 = require_equal(); + var error = { + message: 'must be equal to one of the allowed values', + params: ({ schemaCode }) => + (0, codegen_1._)`{allowedValues: ${schemaCode}}`, + }; + var def = { + keyword: 'enum', + schemaType: 'array', + $data: true, + error, + code(cxt) { + const { gen, data, $data, schema, schemaCode, it } = cxt; + if (!$data && schema.length === 0) + throw new Error('enum must have non-empty array'); + const useLoop = schema.length >= it.opts.loopEnum; + let eql; + const getEql = () => + eql !== null && eql !== undefined + ? eql + : (eql = (0, util_1.useFunc)(gen, equal_1.default)); + let valid; + if (useLoop || $data) { + valid = gen.let('valid'); + cxt.block$data(valid, loopEnum); + } else { + if (!Array.isArray(schema)) + throw new Error('ajv implementation error'); + const vSchema = gen.const('vSchema', schemaCode); + valid = (0, codegen_1.or)( + ...schema.map((_x, i) => equalCode(vSchema, i)) + ); + } + cxt.pass(valid); + function loopEnum() { + gen.assign(valid, false); + gen.forOf('v', schemaCode, (v) => + gen.if((0, codegen_1._)`${getEql()}(${data}, ${v})`, () => + gen.assign(valid, true).break() + ) + ); + } + function equalCode(vSchema, i) { + const sch = schema[i]; + return typeof sch === 'object' && sch !== null + ? (0, codegen_1._)`${getEql()}(${data}, ${vSchema}[${i}])` + : (0, codegen_1._)`${data} === ${sch}`; + } + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/validation/index.js +var require_validation = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var limitNumber_1 = require_limitNumber(); + var multipleOf_1 = require_multipleOf(); + var limitLength_1 = require_limitLength(); + var pattern_1 = require_pattern(); + var limitProperties_1 = require_limitProperties(); + var required_1 = require_required(); + var limitItems_1 = require_limitItems(); + var uniqueItems_1 = require_uniqueItems(); + var const_1 = require_const(); + var enum_1 = require_enum(); + var validation = [ + limitNumber_1.default, + multipleOf_1.default, + limitLength_1.default, + pattern_1.default, + limitProperties_1.default, + required_1.default, + limitItems_1.default, + uniqueItems_1.default, + { keyword: 'type', schemaType: ['string', 'array'] }, + { keyword: 'nullable', schemaType: 'boolean' }, + const_1.default, + enum_1.default, + ]; + exports.default = validation; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +var require_additionalItems = __commonJS((exports) => { + var validateAdditionalItems = function (cxt, items) { + const { gen, schema, data, keyword, it } = cxt; + it.items = true; + const len = gen.const('len', (0, codegen_1._)`${data}.length`); + if (schema === false) { + cxt.setParams({ len: items.length }); + cxt.pass((0, codegen_1._)`${len} <= ${items.length}`); + } else if ( + typeof schema == 'object' && + !(0, util_1.alwaysValidSchema)(it, schema) + ) { + const valid = gen.var( + 'valid', + (0, codegen_1._)`${len} <= ${items.length}` + ); + gen.if((0, codegen_1.not)(valid), () => validateItems(valid)); + cxt.ok(valid); + } + function validateItems(valid) { + gen.forRange('i', items.length, len, (i) => { + cxt.subschema( + { keyword, dataProp: i, dataPropType: util_1.Type.Num }, + valid + ); + if (!it.allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + }); + } + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.validateAdditionalItems = undefined; + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var error = { + message: ({ params: { len } }) => + (0, codegen_1.str)`must NOT have more than ${len} items`, + params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`, + }; + var def = { + keyword: 'additionalItems', + type: 'array', + schemaType: ['boolean', 'object'], + before: 'uniqueItems', + error, + code(cxt) { + const { parentSchema, it } = cxt; + const { items } = parentSchema; + if (!Array.isArray(items)) { + (0, util_1.checkStrictMode)( + it, + '"additionalItems" is ignored when "items" is not an array of schemas' + ); + return; + } + validateAdditionalItems(cxt, items); + }, + }; + exports.validateAdditionalItems = validateAdditionalItems; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/items.js +var require_items = __commonJS((exports) => { + var validateTuple = function (cxt, extraItems, schArr = cxt.schema) { + const { gen, parentSchema, data, keyword, it } = cxt; + checkStrictTuple(parentSchema); + if (it.opts.unevaluated && schArr.length && it.items !== true) { + it.items = util_1.mergeEvaluated.items( + gen, + schArr.length, + it.items + ); + } + const valid = gen.name('valid'); + const len = gen.const('len', (0, codegen_1._)`${data}.length`); + schArr.forEach((sch, i) => { + if ((0, util_1.alwaysValidSchema)(it, sch)) return; + gen.if((0, codegen_1._)`${len} > ${i}`, () => + cxt.subschema( + { + keyword, + schemaProp: i, + dataProp: i, + }, + valid + ) + ); + cxt.ok(valid); + }); + function checkStrictTuple(sch) { + const { opts, errSchemaPath } = it; + const l = schArr.length; + const fullTuple = + l === sch.minItems && + (l === sch.maxItems || sch[extraItems] === false); + if (opts.strictTuples && !fullTuple) { + const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"`; + (0, util_1.checkStrictMode)(it, msg, opts.strictTuples); + } + } + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.validateTuple = undefined; + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var code_1 = require_code2(); + var def = { + keyword: 'items', + type: 'array', + schemaType: ['object', 'array', 'boolean'], + before: 'uniqueItems', + code(cxt) { + const { schema, it } = cxt; + if (Array.isArray(schema)) + return validateTuple(cxt, 'additionalItems', schema); + it.items = true; + if ((0, util_1.alwaysValidSchema)(it, schema)) return; + cxt.ok((0, code_1.validateArray)(cxt)); + }, + }; + exports.validateTuple = validateTuple; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +var require_prefixItems = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var items_1 = require_items(); + var def = { + keyword: 'prefixItems', + type: 'array', + schemaType: ['array'], + before: 'uniqueItems', + code: (cxt) => (0, items_1.validateTuple)(cxt, 'items'), + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/items2020.js +var require_items2020 = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var code_1 = require_code2(); + var additionalItems_1 = require_additionalItems(); + var error = { + message: ({ params: { len } }) => + (0, codegen_1.str)`must NOT have more than ${len} items`, + params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`, + }; + var def = { + keyword: 'items', + type: 'array', + schemaType: ['object', 'boolean'], + before: 'uniqueItems', + error, + code(cxt) { + const { schema, parentSchema, it } = cxt; + const { prefixItems } = parentSchema; + it.items = true; + if ((0, util_1.alwaysValidSchema)(it, schema)) return; + if (prefixItems) + (0, additionalItems_1.validateAdditionalItems)( + cxt, + prefixItems + ); + else cxt.ok((0, code_1.validateArray)(cxt)); + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/contains.js +var require_contains = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var error = { + message: ({ params: { min, max } }) => + max === undefined + ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` + : (0, + codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`, + params: ({ params: { min, max } }) => + max === undefined + ? (0, codegen_1._)`{minContains: ${min}}` + : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`, + }; + var def = { + keyword: 'contains', + type: 'array', + schemaType: ['object', 'boolean'], + before: 'uniqueItems', + trackErrors: true, + error, + code(cxt) { + const { gen, schema, parentSchema, data, it } = cxt; + let min; + let max; + const { minContains, maxContains } = parentSchema; + if (it.opts.next) { + min = minContains === undefined ? 1 : minContains; + max = maxContains; + } else { + min = 1; + } + const len = gen.const('len', (0, codegen_1._)`${data}.length`); + cxt.setParams({ min, max }); + if (max === undefined && min === 0) { + (0, util_1.checkStrictMode)( + it, + `"minContains" == 0 without "maxContains": "contains" keyword ignored` + ); + return; + } + if (max !== undefined && min > max) { + (0, util_1.checkStrictMode)( + it, + `"minContains" > "maxContains" is always invalid` + ); + cxt.fail(); + return; + } + if ((0, util_1.alwaysValidSchema)(it, schema)) { + let cond = (0, codegen_1._)`${len} >= ${min}`; + if (max !== undefined) + cond = (0, codegen_1._)`${cond} && ${len} <= ${max}`; + cxt.pass(cond); + return; + } + it.items = true; + const valid = gen.name('valid'); + if (max === undefined && min === 1) { + validateItems(valid, () => gen.if(valid, () => gen.break())); + } else if (min === 0) { + gen.let(valid, true); + if (max !== undefined) + gen.if( + (0, codegen_1._)`${data}.length > 0`, + validateItemsWithCount + ); + } else { + gen.let(valid, false); + validateItemsWithCount(); + } + cxt.result(valid, () => cxt.reset()); + function validateItemsWithCount() { + const schValid = gen.name('_valid'); + const count = gen.let('count', 0); + validateItems(schValid, () => + gen.if(schValid, () => checkLimits(count)) + ); + } + function validateItems(_valid, block) { + gen.forRange('i', 0, len, (i) => { + cxt.subschema( + { + keyword: 'contains', + dataProp: i, + dataPropType: util_1.Type.Num, + compositeRule: true, + }, + _valid + ); + block(); + }); + } + function checkLimits(count) { + gen.code((0, codegen_1._)`${count}++`); + if (max === undefined) { + gen.if((0, codegen_1._)`${count} >= ${min}`, () => + gen.assign(valid, true).break() + ); + } else { + gen.if((0, codegen_1._)`${count} > ${max}`, () => + gen.assign(valid, false).break() + ); + if (min === 1) gen.assign(valid, true); + else + gen.if((0, codegen_1._)`${count} >= ${min}`, () => + gen.assign(valid, true) + ); + } + } + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/dependencies.js +var require_dependencies = __commonJS((exports) => { + var splitDependencies = function ({ schema }) { + const propertyDeps = {}; + const schemaDeps = {}; + for (const key in schema) { + if (key === '__proto__') continue; + const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps; + deps[key] = schema[key]; + } + return [propertyDeps, schemaDeps]; + }; + var validatePropertyDeps = function (cxt, propertyDeps = cxt.schema) { + const { gen, data, it } = cxt; + if (Object.keys(propertyDeps).length === 0) return; + const missing = gen.let('missing'); + for (const prop in propertyDeps) { + const deps = propertyDeps[prop]; + if (deps.length === 0) continue; + const hasProperty = (0, code_1.propertyInData)( + gen, + data, + prop, + it.opts.ownProperties + ); + cxt.setParams({ + property: prop, + depsCount: deps.length, + deps: deps.join(', '), + }); + if (it.allErrors) { + gen.if(hasProperty, () => { + for (const depProp of deps) { + (0, code_1.checkReportMissingProp)(cxt, depProp); + } + }); + } else { + gen.if( + (0, codegen_1._)`${hasProperty} && (${(0, + code_1.checkMissingProp)(cxt, deps, missing)})` + ); + (0, code_1.reportMissingProp)(cxt, missing); + gen.else(); + } + } + }; + var validateSchemaDeps = function (cxt, schemaDeps = cxt.schema) { + const { gen, data, keyword, it } = cxt; + const valid = gen.name('valid'); + for (const prop in schemaDeps) { + if ((0, util_1.alwaysValidSchema)(it, schemaDeps[prop])) continue; + gen.if( + (0, code_1.propertyInData)( + gen, + data, + prop, + it.opts.ownProperties + ), + () => { + const schCxt = cxt.subschema( + { keyword, schemaProp: prop }, + valid + ); + cxt.mergeValidEvaluated(schCxt, valid); + }, + () => gen.var(valid, true) + ); + cxt.ok(valid); + } + }; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.validateSchemaDeps = + exports.validatePropertyDeps = + exports.error = + undefined; + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var code_1 = require_code2(); + exports.error = { + message: ({ params: { property, depsCount, deps } }) => { + const property_ies = depsCount === 1 ? 'property' : 'properties'; + return (0, + codegen_1.str)`must have ${property_ies} ${deps} when property ${property} is present`; + }, + params: ({ + params: { property, depsCount, deps, missingProperty }, + }) => (0, codegen_1._)`{property: ${property}, + missingProperty: ${missingProperty}, + depsCount: ${depsCount}, + deps: ${deps}}`, + }; + var def = { + keyword: 'dependencies', + type: 'object', + schemaType: 'object', + error: exports.error, + code(cxt) { + const [propDeps, schDeps] = splitDependencies(cxt); + validatePropertyDeps(cxt, propDeps); + validateSchemaDeps(cxt, schDeps); + }, + }; + exports.validatePropertyDeps = validatePropertyDeps; + exports.validateSchemaDeps = validateSchemaDeps; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +var require_propertyNames = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var error = { + message: 'property name must be valid', + params: ({ params }) => + (0, codegen_1._)`{propertyName: ${params.propertyName}}`, + }; + var def = { + keyword: 'propertyNames', + type: 'object', + schemaType: ['object', 'boolean'], + error, + code(cxt) { + const { gen, schema, data, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) return; + const valid = gen.name('valid'); + gen.forIn('key', data, (key) => { + cxt.setParams({ propertyName: key }); + cxt.subschema( + { + keyword: 'propertyNames', + data: key, + dataTypes: ['string'], + propertyName: key, + compositeRule: true, + }, + valid + ); + gen.if((0, codegen_1.not)(valid), () => { + cxt.error(true); + if (!it.allErrors) gen.break(); + }); + }); + cxt.ok(valid); + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +var require_additionalProperties = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var code_1 = require_code2(); + var codegen_1 = require_codegen(); + var names_1 = require_names(); + var util_1 = require_util(); + var error = { + message: 'must NOT have additional properties', + params: ({ params }) => + (0, + codegen_1._)`{additionalProperty: ${params.additionalProperty}}`, + }; + var def = { + keyword: 'additionalProperties', + type: ['object'], + schemaType: ['boolean', 'object'], + allowUndefined: true, + trackErrors: true, + error, + code(cxt) { + const { gen, schema, parentSchema, data, errsCount, it } = cxt; + if (!errsCount) throw new Error('ajv implementation error'); + const { allErrors, opts } = it; + it.props = true; + if ( + opts.removeAdditional !== 'all' && + (0, util_1.alwaysValidSchema)(it, schema) + ) + return; + const props = (0, code_1.allSchemaProperties)( + parentSchema.properties + ); + const patProps = (0, code_1.allSchemaProperties)( + parentSchema.patternProperties + ); + checkAdditionalProperties(); + cxt.ok( + (0, codegen_1._)`${errsCount} === ${names_1.default.errors}` + ); + function checkAdditionalProperties() { + gen.forIn('key', data, (key) => { + if (!props.length && !patProps.length) + additionalPropertyCode(key); + else + gen.if(isAdditional(key), () => + additionalPropertyCode(key) + ); + }); + } + function isAdditional(key) { + let definedProp; + if (props.length > 8) { + const propsSchema = (0, util_1.schemaRefOrVal)( + it, + parentSchema.properties, + 'properties' + ); + definedProp = (0, code_1.isOwnProperty)( + gen, + propsSchema, + key + ); + } else if (props.length) { + definedProp = (0, codegen_1.or)( + ...props.map((p) => (0, codegen_1._)`${key} === ${p}`) + ); + } else { + definedProp = codegen_1.nil; + } + if (patProps.length) { + definedProp = (0, codegen_1.or)( + definedProp, + ...patProps.map( + (p) => + (0, codegen_1._)`${(0, code_1.usePattern)( + cxt, + p + )}.test(${key})` + ) + ); + } + return (0, codegen_1.not)(definedProp); + } + function deleteAdditional(key) { + gen.code((0, codegen_1._)`delete ${data}[${key}]`); + } + function additionalPropertyCode(key) { + if ( + opts.removeAdditional === 'all' || + (opts.removeAdditional && schema === false) + ) { + deleteAdditional(key); + return; + } + if (schema === false) { + cxt.setParams({ additionalProperty: key }); + cxt.error(); + if (!allErrors) gen.break(); + return; + } + if ( + typeof schema == 'object' && + !(0, util_1.alwaysValidSchema)(it, schema) + ) { + const valid = gen.name('valid'); + if (opts.removeAdditional === 'failing') { + applyAdditionalSchema(key, valid, false); + gen.if((0, codegen_1.not)(valid), () => { + cxt.reset(); + deleteAdditional(key); + }); + } else { + applyAdditionalSchema(key, valid); + if (!allErrors) + gen.if((0, codegen_1.not)(valid), () => + gen.break() + ); + } + } + } + function applyAdditionalSchema(key, valid, errors) { + const subschema = { + keyword: 'additionalProperties', + dataProp: key, + dataPropType: util_1.Type.Str, + }; + if (errors === false) { + Object.assign(subschema, { + compositeRule: true, + createErrors: false, + allErrors: false, + }); + } + cxt.subschema(subschema, valid); + } + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/properties.js +var require_properties = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var validate_1 = require_validate(); + var code_1 = require_code2(); + var util_1 = require_util(); + var additionalProperties_1 = require_additionalProperties(); + var def = { + keyword: 'properties', + type: 'object', + schemaType: 'object', + code(cxt) { + const { gen, schema, parentSchema, data, it } = cxt; + if ( + it.opts.removeAdditional === 'all' && + parentSchema.additionalProperties === undefined + ) { + additionalProperties_1.default.code( + new validate_1.KeywordCxt( + it, + additionalProperties_1.default, + 'additionalProperties' + ) + ); + } + const allProps = (0, code_1.allSchemaProperties)(schema); + for (const prop of allProps) { + it.definedProperties.add(prop); + } + if (it.opts.unevaluated && allProps.length && it.props !== true) { + it.props = util_1.mergeEvaluated.props( + gen, + (0, util_1.toHash)(allProps), + it.props + ); + } + const properties = allProps.filter( + (p) => !(0, util_1.alwaysValidSchema)(it, schema[p]) + ); + if (properties.length === 0) return; + const valid = gen.name('valid'); + for (const prop of properties) { + if (hasDefault(prop)) { + applyPropertySchema(prop); + } else { + gen.if( + (0, code_1.propertyInData)( + gen, + data, + prop, + it.opts.ownProperties + ) + ); + applyPropertySchema(prop); + if (!it.allErrors) gen.else().var(valid, true); + gen.endIf(); + } + cxt.it.definedProperties.add(prop); + cxt.ok(valid); + } + function hasDefault(prop) { + return ( + it.opts.useDefaults && + !it.compositeRule && + schema[prop].default !== undefined + ); + } + function applyPropertySchema(prop) { + cxt.subschema( + { + keyword: 'properties', + schemaProp: prop, + dataProp: prop, + }, + valid + ); + } + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +var require_patternProperties = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var code_1 = require_code2(); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var util_2 = require_util(); + var def = { + keyword: 'patternProperties', + type: 'object', + schemaType: 'object', + code(cxt) { + const { gen, schema, data, parentSchema, it } = cxt; + const { opts } = it; + const patterns = (0, code_1.allSchemaProperties)(schema); + const alwaysValidPatterns = patterns.filter((p) => + (0, util_1.alwaysValidSchema)(it, schema[p]) + ); + if ( + patterns.length === 0 || + (alwaysValidPatterns.length === patterns.length && + (!it.opts.unevaluated || it.props === true)) + ) { + return; + } + const checkProperties = + opts.strictSchema && + !opts.allowMatchingProperties && + parentSchema.properties; + const valid = gen.name('valid'); + if (it.props !== true && !(it.props instanceof codegen_1.Name)) { + it.props = (0, util_2.evaluatedPropsToName)(gen, it.props); + } + const { props } = it; + validatePatternProperties(); + function validatePatternProperties() { + for (const pat of patterns) { + if (checkProperties) checkMatchingProperties(pat); + if (it.allErrors) { + validateProperties(pat); + } else { + gen.var(valid, true); + validateProperties(pat); + gen.if(valid); + } + } + } + function checkMatchingProperties(pat) { + for (const prop in checkProperties) { + if (new RegExp(pat).test(prop)) { + (0, util_1.checkStrictMode)( + it, + `property ${prop} matches pattern ${pat} (use allowMatchingProperties)` + ); + } + } + } + function validateProperties(pat) { + gen.forIn('key', data, (key) => { + gen.if( + (0, codegen_1._)`${(0, code_1.usePattern)( + cxt, + pat + )}.test(${key})`, + () => { + const alwaysValid = + alwaysValidPatterns.includes(pat); + if (!alwaysValid) { + cxt.subschema( + { + keyword: 'patternProperties', + schemaProp: pat, + dataProp: key, + dataPropType: util_2.Type.Str, + }, + valid + ); + } + if (it.opts.unevaluated && props !== true) { + gen.assign( + (0, codegen_1._)`${props}[${key}]`, + true + ); + } else if (!alwaysValid && !it.allErrors) { + gen.if((0, codegen_1.not)(valid), () => + gen.break() + ); + } + } + ); + }); + } + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/not.js +var require_not = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var util_1 = require_util(); + var def = { + keyword: 'not', + schemaType: ['object', 'boolean'], + trackErrors: true, + code(cxt) { + const { gen, schema, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) { + cxt.fail(); + return; + } + const valid = gen.name('valid'); + cxt.subschema( + { + keyword: 'not', + compositeRule: true, + createErrors: false, + allErrors: false, + }, + valid + ); + cxt.failResult( + valid, + () => cxt.reset(), + () => cxt.error() + ); + }, + error: { message: 'must NOT be valid' }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/anyOf.js +var require_anyOf = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var code_1 = require_code2(); + var def = { + keyword: 'anyOf', + schemaType: 'array', + trackErrors: true, + code: code_1.validateUnion, + error: { message: 'must match a schema in anyOf' }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/oneOf.js +var require_oneOf = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var error = { + message: 'must match exactly one schema in oneOf', + params: ({ params }) => + (0, codegen_1._)`{passingSchemas: ${params.passing}}`, + }; + var def = { + keyword: 'oneOf', + schemaType: 'array', + trackErrors: true, + error, + code(cxt) { + const { gen, schema, parentSchema, it } = cxt; + if (!Array.isArray(schema)) + throw new Error('ajv implementation error'); + if (it.opts.discriminator && parentSchema.discriminator) return; + const schArr = schema; + const valid = gen.let('valid', false); + const passing = gen.let('passing', null); + const schValid = gen.name('_valid'); + cxt.setParams({ passing }); + gen.block(validateOneOf); + cxt.result( + valid, + () => cxt.reset(), + () => cxt.error(true) + ); + function validateOneOf() { + schArr.forEach((sch, i) => { + let schCxt; + if ((0, util_1.alwaysValidSchema)(it, sch)) { + gen.var(schValid, true); + } else { + schCxt = cxt.subschema( + { + keyword: 'oneOf', + schemaProp: i, + compositeRule: true, + }, + schValid + ); + } + if (i > 0) { + gen.if((0, codegen_1._)`${schValid} && ${valid}`) + .assign(valid, false) + .assign( + passing, + (0, codegen_1._)`[${passing}, ${i}]` + ) + .else(); + } + gen.if(schValid, () => { + gen.assign(valid, true); + gen.assign(passing, i); + if (schCxt) cxt.mergeEvaluated(schCxt, codegen_1.Name); + }); + }); + } + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/allOf.js +var require_allOf = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var util_1 = require_util(); + var def = { + keyword: 'allOf', + schemaType: 'array', + code(cxt) { + const { gen, schema, it } = cxt; + if (!Array.isArray(schema)) + throw new Error('ajv implementation error'); + const valid = gen.name('valid'); + schema.forEach((sch, i) => { + if ((0, util_1.alwaysValidSchema)(it, sch)) return; + const schCxt = cxt.subschema( + { keyword: 'allOf', schemaProp: i }, + valid + ); + cxt.ok(valid); + cxt.mergeEvaluated(schCxt); + }); + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/if.js +var require_if = __commonJS((exports) => { + var hasSchema = function (it, keyword) { + const schema = it.schema[keyword]; + return ( + schema !== undefined && !(0, util_1.alwaysValidSchema)(it, schema) + ); + }; + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var util_1 = require_util(); + var error = { + message: ({ params }) => + (0, codegen_1.str)`must match "${params.ifClause}" schema`, + params: ({ params }) => + (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`, + }; + var def = { + keyword: 'if', + schemaType: ['object', 'boolean'], + trackErrors: true, + error, + code(cxt) { + const { gen, parentSchema, it } = cxt; + if ( + parentSchema.then === undefined && + parentSchema.else === undefined + ) { + (0, util_1.checkStrictMode)( + it, + '"if" without "then" and "else" is ignored' + ); + } + const hasThen = hasSchema(it, 'then'); + const hasElse = hasSchema(it, 'else'); + if (!hasThen && !hasElse) return; + const valid = gen.let('valid', true); + const schValid = gen.name('_valid'); + validateIf(); + cxt.reset(); + if (hasThen && hasElse) { + const ifClause = gen.let('ifClause'); + cxt.setParams({ ifClause }); + gen.if( + schValid, + validateClause('then', ifClause), + validateClause('else', ifClause) + ); + } else if (hasThen) { + gen.if(schValid, validateClause('then')); + } else { + gen.if((0, codegen_1.not)(schValid), validateClause('else')); + } + cxt.pass(valid, () => cxt.error(true)); + function validateIf() { + const schCxt = cxt.subschema( + { + keyword: 'if', + compositeRule: true, + createErrors: false, + allErrors: false, + }, + schValid + ); + cxt.mergeEvaluated(schCxt); + } + function validateClause(keyword, ifClause) { + return () => { + const schCxt = cxt.subschema({ keyword }, schValid); + gen.assign(valid, schValid); + cxt.mergeValidEvaluated(schCxt, valid); + if (ifClause) + gen.assign(ifClause, (0, codegen_1._)`${keyword}`); + else cxt.setParams({ ifClause: keyword }); + }; + } + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/thenElse.js +var require_thenElse = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var util_1 = require_util(); + var def = { + keyword: ['then', 'else'], + schemaType: ['object', 'boolean'], + code({ keyword, parentSchema, it }) { + if (parentSchema.if === undefined) + (0, util_1.checkStrictMode)( + it, + `"${keyword}" without "if" is ignored` + ); + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/applicator/index.js +var require_applicator = __commonJS((exports) => { + var getApplicator = function (draft2020 = false) { + const applicator = [ + not_1.default, + anyOf_1.default, + oneOf_1.default, + allOf_1.default, + if_1.default, + thenElse_1.default, + propertyNames_1.default, + additionalProperties_1.default, + dependencies_1.default, + properties_1.default, + patternProperties_1.default, + ]; + if (draft2020) + applicator.push(prefixItems_1.default, items2020_1.default); + else applicator.push(additionalItems_1.default, items_1.default); + applicator.push(contains_1.default); + return applicator; + }; + Object.defineProperty(exports, '__esModule', { value: true }); + var additionalItems_1 = require_additionalItems(); + var prefixItems_1 = require_prefixItems(); + var items_1 = require_items(); + var items2020_1 = require_items2020(); + var contains_1 = require_contains(); + var dependencies_1 = require_dependencies(); + var propertyNames_1 = require_propertyNames(); + var additionalProperties_1 = require_additionalProperties(); + var properties_1 = require_properties(); + var patternProperties_1 = require_patternProperties(); + var not_1 = require_not(); + var anyOf_1 = require_anyOf(); + var oneOf_1 = require_oneOf(); + var allOf_1 = require_allOf(); + var if_1 = require_if(); + var thenElse_1 = require_thenElse(); + exports.default = getApplicator; +}); + +// ../../../node_modules/ajv/dist/vocabularies/format/format.js +var require_format = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var error = { + message: ({ schemaCode }) => + (0, codegen_1.str)`must match format "${schemaCode}"`, + params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}`, + }; + var def = { + keyword: 'format', + type: ['number', 'string'], + schemaType: 'string', + $data: true, + error, + code(cxt, ruleType) { + const { gen, data, $data, schema, schemaCode, it } = cxt; + const { opts, errSchemaPath, schemaEnv, self: self2 } = it; + if (!opts.validateFormats) return; + if ($data) validate$DataFormat(); + else validateFormat(); + function validate$DataFormat() { + const fmts = gen.scopeValue('formats', { + ref: self2.formats, + code: opts.code.formats, + }); + const fDef = gen.const( + 'fDef', + (0, codegen_1._)`${fmts}[${schemaCode}]` + ); + const fType = gen.let('fType'); + const format = gen.let('format'); + gen.if( + (0, + codegen_1._)`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, + () => + gen + .assign( + fType, + (0, codegen_1._)`${fDef}.type || "string"` + ) + .assign(format, (0, codegen_1._)`${fDef}.validate`), + () => + gen + .assign(fType, (0, codegen_1._)`"string"`) + .assign(format, fDef) + ); + cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt())); + function unknownFmt() { + if (opts.strictSchema === false) return codegen_1.nil; + return (0, codegen_1._)`${schemaCode} && !${format}`; + } + function invalidFmt() { + const callFormat = schemaEnv.$async + ? (0, + codegen_1._)`(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` + : (0, codegen_1._)`${format}(${data})`; + const validData = (0, + codegen_1._)`(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))`; + return (0, + codegen_1._)`${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`; + } + } + function validateFormat() { + const formatDef = self2.formats[schema]; + if (!formatDef) { + unknownFormat(); + return; + } + if (formatDef === true) return; + const [fmtType, format, fmtRef] = getFormat(formatDef); + if (fmtType === ruleType) cxt.pass(validCondition()); + function unknownFormat() { + if (opts.strictSchema === false) { + self2.logger.warn(unknownMsg()); + return; + } + throw new Error(unknownMsg()); + function unknownMsg() { + return `unknown format "${schema}" ignored in schema at path "${errSchemaPath}"`; + } + } + function getFormat(fmtDef) { + const code = + fmtDef instanceof RegExp + ? (0, codegen_1.regexpCode)(fmtDef) + : opts.code.formats + ? (0, codegen_1._)`${opts.code.formats}${(0, + codegen_1.getProperty)(schema)}` + : undefined; + const fmt = gen.scopeValue('formats', { + key: schema, + ref: fmtDef, + code, + }); + if ( + typeof fmtDef == 'object' && + !(fmtDef instanceof RegExp) + ) { + return [ + fmtDef.type || 'string', + fmtDef.validate, + (0, codegen_1._)`${fmt}.validate`, + ]; + } + return ['string', fmtDef, fmt]; + } + function validCondition() { + if ( + typeof formatDef == 'object' && + !(formatDef instanceof RegExp) && + formatDef.async + ) { + if (!schemaEnv.$async) + throw new Error('async format in sync schema'); + return (0, codegen_1._)`await ${fmtRef}(${data})`; + } + return typeof format == 'function' + ? (0, codegen_1._)`${fmtRef}(${data})` + : (0, codegen_1._)`${fmtRef}.test(${data})`; + } + } + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/vocabularies/format/index.js +var require_format2 = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var format_1 = require_format(); + var format = [format_1.default]; + exports.default = format; +}); + +// ../../../node_modules/ajv/dist/vocabularies/metadata.js +var require_metadata = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + exports.contentVocabulary = exports.metadataVocabulary = undefined; + exports.metadataVocabulary = [ + 'title', + 'description', + 'default', + 'deprecated', + 'readOnly', + 'writeOnly', + 'examples', + ]; + exports.contentVocabulary = [ + 'contentMediaType', + 'contentEncoding', + 'contentSchema', + ]; +}); + +// ../../../node_modules/ajv/dist/vocabularies/draft7.js +var require_draft7 = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var core_1 = require_core2(); + var validation_1 = require_validation(); + var applicator_1 = require_applicator(); + var format_1 = require_format2(); + var metadata_1 = require_metadata(); + var draft7Vocabularies = [ + core_1.default, + validation_1.default, + (0, applicator_1.default)(), + format_1.default, + metadata_1.metadataVocabulary, + metadata_1.contentVocabulary, + ]; + exports.default = draft7Vocabularies; +}); + +// ../../../node_modules/ajv/dist/vocabularies/discriminator/types.js +var require_types = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + exports.DiscrError = undefined; + var DiscrError; + (function (DiscrError2) { + DiscrError2['Tag'] = 'tag'; + DiscrError2['Mapping'] = 'mapping'; + })((DiscrError = exports.DiscrError || (exports.DiscrError = {}))); +}); + +// ../../../node_modules/ajv/dist/vocabularies/discriminator/index.js +var require_discriminator = __commonJS((exports) => { + Object.defineProperty(exports, '__esModule', { value: true }); + var codegen_1 = require_codegen(); + var types_1 = require_types(); + var compile_1 = require_compile(); + var util_1 = require_util(); + var error = { + message: ({ params: { discrError, tagName } }) => + discrError === types_1.DiscrError.Tag + ? `tag "${tagName}" must be string` + : `value of tag "${tagName}" must be in oneOf`, + params: ({ params: { discrError, tag, tagName } }) => + (0, + codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`, + }; + var def = { + keyword: 'discriminator', + type: 'object', + schemaType: 'object', + error, + code(cxt) { + const { gen, data, schema, parentSchema, it } = cxt; + const { oneOf } = parentSchema; + if (!it.opts.discriminator) { + throw new Error('discriminator: requires discriminator option'); + } + const tagName = schema.propertyName; + if (typeof tagName != 'string') + throw new Error('discriminator: requires propertyName'); + if (schema.mapping) + throw new Error('discriminator: mapping is not supported'); + if (!oneOf) + throw new Error('discriminator: requires oneOf keyword'); + const valid = gen.let('valid', false); + const tag = gen.const( + 'tag', + (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(tagName)}` + ); + gen.if( + (0, codegen_1._)`typeof ${tag} == "string"`, + () => validateMapping(), + () => + cxt.error(false, { + discrError: types_1.DiscrError.Tag, + tag, + tagName, + }) + ); + cxt.ok(valid); + function validateMapping() { + const mapping = getMapping(); + gen.if(false); + for (const tagValue in mapping) { + gen.elseIf((0, codegen_1._)`${tag} === ${tagValue}`); + gen.assign(valid, applyTagSchema(mapping[tagValue])); + } + gen.else(); + cxt.error(false, { + discrError: types_1.DiscrError.Mapping, + tag, + tagName, + }); + gen.endIf(); + } + function applyTagSchema(schemaProp) { + const _valid = gen.name('valid'); + const schCxt = cxt.subschema( + { keyword: 'oneOf', schemaProp }, + _valid + ); + cxt.mergeEvaluated(schCxt, codegen_1.Name); + return _valid; + } + function getMapping() { + var _a; + const oneOfMapping = {}; + const topRequired = hasRequired(parentSchema); + let tagRequired = true; + for (let i = 0; i < oneOf.length; i++) { + let sch = oneOf[i]; + if ( + (sch === null || sch === undefined + ? undefined + : sch.$ref) && + !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES) + ) { + sch = compile_1.resolveRef.call( + it.self, + it.schemaEnv.root, + it.baseId, + sch === null || sch === undefined + ? undefined + : sch.$ref + ); + if (sch instanceof compile_1.SchemaEnv) + sch = sch.schema; + } + const propSch = + (_a = + sch === null || sch === undefined + ? undefined + : sch.properties) === null || _a === undefined + ? undefined + : _a[tagName]; + if (typeof propSch != 'object') { + throw new Error( + `discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"` + ); + } + tagRequired = + tagRequired && (topRequired || hasRequired(sch)); + addMappings(propSch, i); + } + if (!tagRequired) + throw new Error( + `discriminator: "${tagName}" must be required` + ); + return oneOfMapping; + function hasRequired({ required }) { + return ( + Array.isArray(required) && required.includes(tagName) + ); + } + function addMappings(sch, i) { + if (sch.const) { + addMapping(sch.const, i); + } else if (sch.enum) { + for (const tagValue of sch.enum) { + addMapping(tagValue, i); + } + } else { + throw new Error( + `discriminator: "properties/${tagName}" must have "const" or "enum"` + ); + } + } + function addMapping(tagValue, i) { + if ( + typeof tagValue != 'string' || + tagValue in oneOfMapping + ) { + throw new Error( + `discriminator: "${tagName}" values must be unique strings` + ); + } + oneOfMapping[tagValue] = i; + } + } + }, + }; + exports.default = def; +}); + +// ../../../node_modules/ajv/dist/refs/json-schema-draft-07.json +var require_json_schema_draft_07 = __commonJS((exports, module) => { + module.exports = { + $schema: 'http://json-schema.org/draft-07/schema#', + $id: 'http://json-schema.org/draft-07/schema#', + title: 'Core schema meta-schema', + definitions: { + schemaArray: { + type: 'array', + minItems: 1, + items: { $ref: '#' }, + }, + nonNegativeInteger: { + type: 'integer', + minimum: 0, + }, + nonNegativeIntegerDefault0: { + allOf: [ + { $ref: '#/definitions/nonNegativeInteger' }, + { default: 0 }, + ], + }, + simpleTypes: { + enum: [ + 'array', + 'boolean', + 'integer', + 'null', + 'number', + 'object', + 'string', + ], + }, + stringArray: { + type: 'array', + items: { type: 'string' }, + uniqueItems: true, + default: [], + }, + }, + type: ['object', 'boolean'], + properties: { + $id: { + type: 'string', + format: 'uri-reference', + }, + $schema: { + type: 'string', + format: 'uri', + }, + $ref: { + type: 'string', + format: 'uri-reference', + }, + $comment: { + type: 'string', + }, + title: { + type: 'string', + }, + description: { + type: 'string', + }, + default: true, + readOnly: { + type: 'boolean', + default: false, + }, + examples: { + type: 'array', + items: true, + }, + multipleOf: { + type: 'number', + exclusiveMinimum: 0, + }, + maximum: { + type: 'number', + }, + exclusiveMaximum: { + type: 'number', + }, + minimum: { + type: 'number', + }, + exclusiveMinimum: { + type: 'number', + }, + maxLength: { $ref: '#/definitions/nonNegativeInteger' }, + minLength: { $ref: '#/definitions/nonNegativeIntegerDefault0' }, + pattern: { + type: 'string', + format: 'regex', + }, + additionalItems: { $ref: '#' }, + items: { + anyOf: [{ $ref: '#' }, { $ref: '#/definitions/schemaArray' }], + default: true, + }, + maxItems: { $ref: '#/definitions/nonNegativeInteger' }, + minItems: { $ref: '#/definitions/nonNegativeIntegerDefault0' }, + uniqueItems: { + type: 'boolean', + default: false, + }, + contains: { $ref: '#' }, + maxProperties: { $ref: '#/definitions/nonNegativeInteger' }, + minProperties: { $ref: '#/definitions/nonNegativeIntegerDefault0' }, + required: { $ref: '#/definitions/stringArray' }, + additionalProperties: { $ref: '#' }, + definitions: { + type: 'object', + additionalProperties: { $ref: '#' }, + default: {}, + }, + properties: { + type: 'object', + additionalProperties: { $ref: '#' }, + default: {}, + }, + patternProperties: { + type: 'object', + additionalProperties: { $ref: '#' }, + propertyNames: { format: 'regex' }, + default: {}, + }, + dependencies: { + type: 'object', + additionalProperties: { + anyOf: [ + { $ref: '#' }, + { $ref: '#/definitions/stringArray' }, + ], + }, + }, + propertyNames: { $ref: '#' }, + const: true, + enum: { + type: 'array', + items: true, + minItems: 1, + uniqueItems: true, + }, + type: { + anyOf: [ + { $ref: '#/definitions/simpleTypes' }, + { + type: 'array', + items: { $ref: '#/definitions/simpleTypes' }, + minItems: 1, + uniqueItems: true, + }, + ], + }, + format: { type: 'string' }, + contentMediaType: { type: 'string' }, + contentEncoding: { type: 'string' }, + if: { $ref: '#' }, + then: { $ref: '#' }, + else: { $ref: '#' }, + allOf: { $ref: '#/definitions/schemaArray' }, + anyOf: { $ref: '#/definitions/schemaArray' }, + oneOf: { $ref: '#/definitions/schemaArray' }, + not: { $ref: '#' }, + }, + default: true, + }; +}); + +// ../../../node_modules/ajv/dist/ajv.js +var require_ajv = __commonJS((exports, module) => { + Object.defineProperty(exports, '__esModule', { value: true }); + exports.MissingRefError = + exports.ValidationError = + exports.CodeGen = + exports.Name = + exports.nil = + exports.stringify = + exports.str = + exports._ = + exports.KeywordCxt = + undefined; + var core_1 = require_core(); + var draft7_1 = require_draft7(); + var discriminator_1 = require_discriminator(); + var draft7MetaSchema = require_json_schema_draft_07(); + var META_SUPPORT_DATA = ['/properties']; + var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema'; + + class Ajv extends core_1.default { + _addVocabularies() { + super._addVocabularies(); + draft7_1.default.forEach((v) => this.addVocabulary(v)); + if (this.opts.discriminator) + this.addKeyword(discriminator_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + if (!this.opts.meta) return; + const metaSchema = this.opts.$data + ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA) + : draft7MetaSchema; + this.addMetaSchema(metaSchema, META_SCHEMA_ID, false); + this.refs['http://json-schema.org/schema'] = META_SCHEMA_ID; + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || + (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } + } + module.exports = exports = Ajv; + Object.defineProperty(exports, '__esModule', { value: true }); + exports.default = Ajv; + var validate_1 = require_validate(); + Object.defineProperty(exports, 'KeywordCxt', { + enumerable: true, + get: function () { + return validate_1.KeywordCxt; + }, + }); + var codegen_1 = require_codegen(); + Object.defineProperty(exports, '_', { + enumerable: true, + get: function () { + return codegen_1._; + }, + }); + Object.defineProperty(exports, 'str', { + enumerable: true, + get: function () { + return codegen_1.str; + }, + }); + Object.defineProperty(exports, 'stringify', { + enumerable: true, + get: function () { + return codegen_1.stringify; + }, + }); + Object.defineProperty(exports, 'nil', { + enumerable: true, + get: function () { + return codegen_1.nil; + }, + }); + Object.defineProperty(exports, 'Name', { + enumerable: true, + get: function () { + return codegen_1.Name; + }, + }); + Object.defineProperty(exports, 'CodeGen', { + enumerable: true, + get: function () { + return codegen_1.CodeGen; + }, + }); + var validation_error_1 = require_validation_error(); + Object.defineProperty(exports, 'ValidationError', { + enumerable: true, + get: function () { + return validation_error_1.default; + }, + }); + var ref_error_1 = require_ref_error(); + Object.defineProperty(exports, 'MissingRefError', { + enumerable: true, + get: function () { + return ref_error_1.default; + }, + }); +}); + +// ../../php-wasm/node-polyfills/src/lib/current-js-runtime.ts +var currentJsRuntime = (function () { + if (typeof process !== 'undefined' && process.release?.name === 'node') { + return 'NODE'; + } else if (typeof window !== 'undefined') { + return 'WEB'; + } else if ( + typeof WorkerGlobalScope !== 'undefined' && + self instanceof WorkerGlobalScope + ) { + return 'WORKER'; + } else { + return 'NODE'; + } +})(); + +// ../../php-wasm/node-polyfills/src/lib/blob.ts +if (currentJsRuntime === 'NODE') { + let asPromise = function (obj) { + return new Promise(function (resolve, reject) { + obj.onload = obj.onerror = function (event) { + obj.onload = obj.onerror = null; + if (event.type === 'load') { + resolve(obj.result); + } else { + reject(new Error('Failed to read the blob/file')); + } + }; + }); + }, + isByobSupported = function () { + const inputBytes = new Uint8Array([1, 2, 3, 4]); + const file = new File([inputBytes], 'test'); + const stream = file.stream(); + try { + stream.getReader({ mode: 'byob' }); + return true; + } catch (e) { + return false; + } + }; + if (typeof File === 'undefined') { + class File2 extends Blob { + name; + lastModified; + lastModifiedDate; + webkitRelativePath; + constructor(sources, fileName, options) { + super(sources); + let date; + if (options?.lastModified) { + date = new Date(); + } + if (!date || isNaN(date.getFullYear())) { + date = new Date(); + } + this.lastModifiedDate = date; + this.lastModified = date.getMilliseconds(); + this.name = fileName || ''; + } + } + global.File = File2; + } + if (typeof Blob.prototype.arrayBuffer === 'undefined') { + Blob.prototype.arrayBuffer = function arrayBuffer() { + const reader = new FileReader(); + reader.readAsArrayBuffer(this); + return asPromise(reader); + }; + } + if (typeof Blob.prototype.text === 'undefined') { + Blob.prototype.text = function text() { + const reader = new FileReader(); + reader.readAsText(this); + return asPromise(reader); + }; + } + if (typeof Blob.prototype.stream === 'undefined' || !isByobSupported()) { + Blob.prototype.stream = function () { + let position = 0; + const blob = this; + return new ReadableStream({ + type: 'bytes', + autoAllocateChunkSize: 524288, + async pull(controller) { + const view = controller.byobRequest.view; + const chunk = blob.slice( + position, + position + view.byteLength + ); + const buffer = await chunk.arrayBuffer(); + const uint8array = new Uint8Array(buffer); + new Uint8Array(view.buffer).set(uint8array); + const bytesRead = uint8array.byteLength; + controller.byobRequest.respond(bytesRead); + position += bytesRead; + if (position >= blob.size) { + controller.close(); + } + }, + }); + }; + } +} + +// ../../php-wasm/node-polyfills/src/lib/custom-event.ts +if (currentJsRuntime === 'NODE' && typeof CustomEvent === 'undefined') { + class CustomEvent2 extends Event { + detail; + constructor(name, options = {}) { + super(name, options); + this.detail = options.detail; + } + initCustomEvent() {} + } + globalThis.CustomEvent = CustomEvent2; +} + +// ../blueprints/src/lib/utils/wp-content-files-excluded-from-exports.ts +var wpContentFilesExcludedFromExport = [ + 'db.php', + 'plugins/akismet', + 'plugins/hello.php', + 'plugins/wordpress-importer', + 'mu-plugins/sqlite-database-integration', + 'mu-plugins/playground-includes', + 'mu-plugins/0-playground.php', + 'themes/twentytwenty', + 'themes/twentytwentyone', + 'themes/twentytwentytwo', + 'themes/twentytwentythree', + 'themes/twentytwentyfour', + 'themes/twentytwentyfive', + 'themes/twentytwentysix', +]; +// ../blueprints/src/lib/steps/handlers.ts +var exports_handlers = {}; +__export(exports_handlers, { + zipWpContent: () => { + { + return zipWpContent; + } + }, + writeFile: () => { + { + return writeFile; + } + }, + wpCLI: () => { + { + return wpCLI; + } + }, + updateUserMeta: () => { + { + return updateUserMeta; + } + }, + unzip: () => { + { + return unzip; + } + }, + setSiteOptions: () => { + { + return setSiteOptions; + } + }, + runWpInstallationWizard: () => { + { + return runWpInstallationWizard; + } + }, + runSql: () => { + { + return runSql; + } + }, + runPHPWithOptions: () => { + { + return runPHPWithOptions; + } + }, + runPHP: () => { + { + return runPHP; + } + }, + rmdir: () => { + { + return rmdir; + } + }, + rm: () => { + { + return rm; + } + }, + resetData: () => { + { + return resetData; + } + }, + request: () => { + { + return request; + } + }, + mv: () => { + { + return mv; + } + }, + mkdir: () => { + { + return mkdir; + } + }, + login: () => { + { + return login; + } + }, + installTheme: () => { + { + return installTheme; + } + }, + installPlugin: () => { + { + return installPlugin; + } + }, + importWxr: () => { + { + return importWxr; + } + }, + importWordPressFiles: () => { + { + return importWordPressFiles; + } + }, + exportWXR: () => { + { + return exportWXR; + } + }, + enableMultisite: () => { + { + return enableMultisite; + } + }, + defineWpConfigConsts: () => { + { + return defineWpConfigConsts; + } + }, + defineSiteUrl: () => { + { + return defineSiteUrl; + } + }, + cp: () => { + { + return cp; + } + }, + activateTheme: () => { + { + return activateTheme; + } + }, + activatePlugin: () => { + { + return activatePlugin; + } + }, +}); + +// ../../php-wasm/util/src/lib/sleep.ts +function sleep(ms) { + return new Promise((resolve) => { + setTimeout(() => resolve(SleepFinished), ms); + }); +} +var SleepFinished = Symbol('SleepFinished'); + +// ../../php-wasm/util/src/lib/semaphore.ts +class AcquireTimeoutError extends Error { + constructor() { + super('Acquiring lock timed out'); + } +} + +class Semaphore { + _running = 0; + concurrency; + timeout; + queue; + constructor({ concurrency, timeout }) { + this.concurrency = concurrency; + this.timeout = timeout; + this.queue = []; + } + get remaining() { + return this.concurrency - this.running; + } + get running() { + return this._running; + } + async acquire() { + while (true) { + if (this._running >= this.concurrency) { + const acquired = new Promise((resolve) => { + this.queue.push(resolve); + }); + if (this.timeout !== undefined) { + await Promise.race([acquired, sleep(this.timeout)]).then( + (value) => { + if (value === SleepFinished) { + throw new AcquireTimeoutError(); + } + } + ); + } else { + await acquired; + } + } else { + this._running++; + let released = false; + return () => { + if (released) { + return; + } + released = true; + this._running--; + if (this.queue.length > 0) { + this.queue.shift()(); + } + }; + } + } + } + async run(fn) { + const release = await this.acquire(); + try { + return await fn(); + } finally { + release(); + } + } +} +// ../../php-wasm/util/src/lib/paths.ts +function joinPaths(...paths) { + let path = paths.join('/'); + const isAbsolute = path[0] === '/'; + const trailingSlash = path.substring(path.length - 1) === '/'; + path = normalizePath(path); + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + return path; +} +function dirname(path) { + if (path === '/') { + return '/'; + } + path = normalizePath(path); + const lastSlash = path.lastIndexOf('/'); + if (lastSlash === -1) { + return ''; + } else if (lastSlash === 0) { + return '/'; + } + return path.substr(0, lastSlash); +} +function normalizePath(path) { + const isAbsolute = path[0] === '/'; + path = normalizePathsArray( + path.split('/').filter((p) => !!p), + !isAbsolute + ).join('/'); + return (isAbsolute ? '/' : '') + path.replace(/\/$/, ''); +} +function normalizePathsArray(parts, allowAboveRoot) { + let up = 0; + for (let i = parts.length - 1; i >= 0; i--) { + const last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift('..'); + } + } + return parts; +} +// ../../php-wasm/util/src/lib/split-shell-command.ts +function splitShellCommand(command) { + const MODE_UNQUOTED = 0; + const MODE_IN_QUOTE = 1; + let mode = MODE_UNQUOTED; + let quote = ''; + const parts = []; + let currentPart = ''; + for (let i = 0; i < command.length; i++) { + const char = command[i]; + if (char === '\\') { + if (command[i + 1] === '"' || command[i + 1] === "'") { + i++; + } + currentPart += command[i]; + } else if (mode === MODE_UNQUOTED) { + if (char === '"' || char === "'") { + mode = MODE_IN_QUOTE; + quote = char; + } else if (char.match(/\s/)) { + if (currentPart.trim().length) { + parts.push(currentPart.trim()); + } + currentPart = char; + } else if (parts.length && !currentPart) { + currentPart = parts.pop() + char; + } else { + currentPart += char; + } + } else if (mode === MODE_IN_QUOTE) { + if (char === quote) { + mode = MODE_UNQUOTED; + quote = ''; + } else { + currentPart += char; + } + } + } + if (currentPart) { + parts.push(currentPart.trim()); + } + return parts; +} + +// ../../php-wasm/util/src/lib/create-spawn-handler.ts +function createSpawnHandler(program) { + return function (command, argsArray = [], options = {}) { + const childProcess = new ChildProcess(); + const processApi = new ProcessApi(childProcess); + setTimeout(async () => { + let commandArray = []; + if (argsArray.length) { + commandArray = [command, ...argsArray]; + } else if (typeof command === 'string') { + commandArray = splitShellCommand(command); + } else if (Array.isArray(command)) { + commandArray = command; + } else { + throw new Error('Invalid command ', command); + } + try { + await program(commandArray, processApi, options); + } catch (e) { + childProcess.emit('error', e); + if ( + typeof e === 'object' && + e !== null && + 'message' in e && + typeof e.message === 'string' + ) { + processApi.stderr(e.message); + } + processApi.exit(1); + } + childProcess.emit('spawn', true); + }); + return childProcess; + }; +} + +class EventEmitter { + listeners = {}; + emit(eventName, data) { + if (this.listeners[eventName]) { + this.listeners[eventName].forEach(function (listener) { + listener(data); + }); + } + } + on(eventName, listener) { + if (!this.listeners[eventName]) { + this.listeners[eventName] = []; + } + this.listeners[eventName].push(listener); + } +} + +class ProcessApi extends EventEmitter { + childProcess; + exited = false; + stdinData = []; + constructor(childProcess) { + super(); + this.childProcess = childProcess; + childProcess.on('stdin', (data) => { + if (this.stdinData) { + this.stdinData.push(data.slice()); + } else { + this.emit('stdin', data); + } + }); + } + stdout(data) { + if (typeof data === 'string') { + data = new TextEncoder().encode(data); + } + this.childProcess.stdout.emit('data', data); + } + stdoutEnd() { + this.childProcess.stdout.emit('end', {}); + } + stderr(data) { + if (typeof data === 'string') { + data = new TextEncoder().encode(data); + } + this.childProcess.stderr.emit('data', data); + } + stderrEnd() { + this.childProcess.stderr.emit('end', {}); + } + exit(code) { + if (!this.exited) { + this.exited = true; + this.childProcess.emit('exit', code); + } + } + flushStdin() { + if (this.stdinData) { + for (let i = 0; i < this.stdinData.length; i++) { + this.emit('stdin', this.stdinData[i]); + } + } + this.stdinData = null; + } +} +var lastPid = 9743; + +class ChildProcess extends EventEmitter { + pid; + stdout = new EventEmitter(); + stderr = new EventEmitter(); + stdin; + constructor(pid = lastPid++) { + super(); + this.pid = pid; + const self2 = this; + this.stdin = { + write: (data) => { + self2.emit('stdin', data); + }, + }; + } +} +// ../../php-wasm/util/src/lib/random-string.ts +function randomString(length = 36, specialChars = '!@#$%^&*()_+=-[]/.,<>?') { + const chars = + '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' + + specialChars; + let result = ''; + for (let i = length; i > 0; --i) + result += chars[Math.floor(Math.random() * chars.length)]; + return result; +} +// ../../php-wasm/util/src/lib/random-filename.ts +function randomFilename() { + return randomString(36, '-_'); +} +// ../../php-wasm/util/src/lib/php-vars.ts +function phpVar(value) { + return `json_decode(base64_decode('${stringToBase64( + JSON.stringify(value) + )}'), true)`; +} +function phpVars(vars) { + const result = {}; + for (const key in vars) { + result[key] = phpVar(vars[key]); + } + return result; +} +var stringToBase64 = function (str) { + return bytesToBase64(new TextEncoder().encode(str)); +}; +var bytesToBase64 = function (bytes) { + const binString = String.fromCodePoint(...bytes); + return btoa(binString); +}; +// ../../php-wasm/logger/src/lib/handlers/log-to-console.ts +var logToConsole = (log, ...args) => { + if (typeof log.message === 'string') { + log.message = prepareLogMessage(log.message); + } else if (log.message.message && typeof log.message.message === 'string') { + log.message.message = prepareLogMessage(log.message.message); + } + switch (log.severity) { + case 'Debug': + console.debug(log.message, ...args); + break; + case 'Info': + console.info(log.message, ...args); + break; + case 'Warn': + console.warn(log.message, ...args); + break; + case 'Error': + console.error(log.message, ...args); + break; + case 'Fatal': + console.error(log.message, ...args); + break; + default: + console.log(log.message, ...args); + } +}; +// ../../php-wasm/logger/src/lib/handlers/log-to-memory.ts +var prepareLogMessage2 = (logMessage) => { + if (logMessage instanceof Error) { + return [logMessage.message, logMessage.stack].join('\n'); + } + return JSON.stringify(logMessage, null, 2); +}; +var logs = []; +var addToLogArray = (message) => { + logs.push(message); +}; +var logToMemory = (log) => { + if (log.raw === true) { + addToLogArray(log.message); + } else { + const message = formatLogEntry( + typeof log.message === 'object' + ? prepareLogMessage2(log.message) + : log.message, + log.severity ?? 'Info', + log.prefix ?? 'JavaScript' + ); + addToLogArray(message); + } +}; +// ../../php-wasm/logger/src/lib/logger.ts +class Logger extends EventTarget { + handlers; + fatalErrorEvent = 'playground-fatal-error'; + constructor(handlers = []) { + super(); + this.handlers = handlers; + } + getLogs() { + if (!this.handlers.includes(logToMemory)) { + this + .error(`Logs aren't stored because the logToMemory handler isn't registered. + If you're using a custom logger instance, make sure to register logToMemory handler. + `); + return []; + } + return [...logs]; + } + logMessage(log, ...args) { + for (const handler2 of this.handlers) { + handler2(log, ...args); + } + } + log(message, ...args) { + this.logMessage( + { + message, + severity: undefined, + prefix: 'JavaScript', + raw: false, + }, + ...args + ); + } + debug(message, ...args) { + this.logMessage( + { + message, + severity: 'Debug', + prefix: 'JavaScript', + raw: false, + }, + ...args + ); + } + info(message, ...args) { + this.logMessage( + { + message, + severity: 'Info', + prefix: 'JavaScript', + raw: false, + }, + ...args + ); + } + warn(message, ...args) { + this.logMessage( + { + message, + severity: 'Warn', + prefix: 'JavaScript', + raw: false, + }, + ...args + ); + } + error(message, ...args) { + this.logMessage( + { + message, + severity: 'Error', + prefix: 'JavaScript', + raw: false, + }, + ...args + ); + } +} +var getDefaultHandlers = () => { + try { + if (false) { + } + } catch (e) {} + return [logToMemory, logToConsole]; +}; +var logger3 = new Logger(getDefaultHandlers()); +var prepareLogMessage = (message) => { + return message.replace(/\t/g, ''); +}; +var formatLogEntry = (message, severity, prefix) => { + const date = new Date(); + const formattedDate = new Intl.DateTimeFormat('en-GB', { + year: 'numeric', + month: 'short', + day: '2-digit', + timeZone: 'UTC', + }) + .format(date) + .replace(/ /g, '-'); + const formattedTime = new Intl.DateTimeFormat('en-GB', { + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + hour12: false, + timeZone: 'UTC', + timeZoneName: 'short', + }).format(date); + const now = formattedDate + ' ' + formattedTime; + message = prepareLogMessage(message); + return `[${now}] ${prefix} ${severity}: ${message}`; +}; +// ../blueprints/src/lib/steps/activate-plugin.ts +var activatePlugin = async ( + playground, + { pluginPath, pluginName }, + progress +) => { + progress?.tracker.setCaption(`Activating ${pluginName || pluginPath}`); + const docroot = await playground.documentRoot; + const result = await playground.run({ + code: ` 'Administrator') )[0]->ID ); + + \$plugin_path = ${phpVar(pluginPath)}; + \$response = false; + if (!is_dir(\$plugin_path)) { + \$response = activate_plugin(\$plugin_path); + } + + // Activate plugin by name if activation by path wasn't successful + if ( null !== \$response ) { + foreach ( ( glob( \$plugin_path . '/*.php' ) ?: array() ) as \$file ) { + \$info = get_plugin_data( \$file, false, false ); + if ( ! empty( \$info['Name'] ) ) { + \$response = activate_plugin( \$file ); + break; + } + } + } + + if ( null === \$response ) { + die('Plugin activated successfully'); + } else if ( is_wp_error( \$response ) ) { + throw new Exception( \$response->get_error_message() ); + } + + throw new Exception( 'Unable to activate plugin' ); + `, + }); + if (result.text !== 'Plugin activated successfully') { + logger3.debug(result); + throw new Error( + `Plugin ${pluginPath} could not be activated \u2013 WordPress exited with no error. ` + + `Sometimes, when \$_SERVER or site options are not configured correctly, WordPress exits early with a 301 redirect. Inspect the "debug" logs in the console for more details` + ); + } +}; +// ../blueprints/src/lib/steps/activate-theme.ts +var activateTheme = async (playground, { themeFolderName }, progress) => { + progress?.tracker.setCaption(`Activating ${themeFolderName}`); + const docroot = await playground.documentRoot; + const themeFolderPath = `${docroot}/wp-content/themes/${themeFolderName}`; + if (!(await playground.fileExists(themeFolderPath))) { + throw new Error(` + Couldn't activate theme ${themeFolderName}. + Theme not found at the provided theme path: ${themeFolderPath}. + Check the theme path to ensure it's correct. + If the theme is not installed, you can install it using the installTheme step. + More info can be found in the Blueprint documentation: https://wordpress.github.io/wordpress-playground/blueprints-api/steps/#ActivateThemeStep + `); + } + const result = await playground.run({ + code: ` 'Administrator') )[0]->ID ); + + switch_theme( getenv('themeFolderName') ); + + if( wp_get_theme()->get_stylesheet() !== getenv('themeFolderName') ) { + throw new Exception( 'Theme ' . getenv('themeFolderName') . ' could not be activated.' ); + } + die('Theme activated successfully'); + `, + env: { + docroot, + themeFolderName, + }, + }); + if (result.text !== 'Theme activated successfully') { + logger3.debug(result); + throw new Error( + `Theme ${themeFolderName} could not be activated \u2013 WordPress exited with no error. ` + + `Sometimes, when \$_SERVER or site options are not configured correctly, WordPress exits early with a 301 redirect. Inspect the "debug" logs in the console for more details` + ); + } +}; +// ../blueprints/src/lib/steps/run-php.ts +var runPHP = async (playground, { code }) => { + return await playground.run({ code }); +}; +// ../blueprints/src/lib/steps/run-php-with-options.ts +var runPHPWithOptions = async (playground, { options }) => { + return await playground.run(options); +}; +// ../blueprints/src/lib/steps/rm.ts +var rm = async (playground, { path }) => { + await playground.unlink(path); +}; + +// ../blueprints/src/lib/steps/run-sql.ts +var runSql = async (playground, { sql }, progress) => { + progress?.tracker.setCaption(`Executing SQL Queries`); + const sqlFilename = `/tmp/${randomFilename()}.sql`; + await playground.writeFile( + sqlFilename, + new Uint8Array(await sql.arrayBuffer()) + ); + const docroot = await playground.documentRoot; + const js = phpVars({ docroot, sqlFilename }); + const runPhp = await playground.run({ + code: `query(\$buffer); + \$buffer = ''; + } + `, + }); + await rm(playground, { path: sqlFilename }); + return runPhp; +}; +// ../blueprints/src/lib/steps/request.ts +var request = async (playground, { request: request2 }) => { + logger3.warn( + 'Deprecated: The Blueprint step "request" is deprecated and will be removed in a future release.' + ); + const response = await playground.request(request2); + if (response.httpStatusCode > 399 || response.httpStatusCode < 200) { + logger3.warn('WordPress response was', { response }); + throw new Error( + `Request failed with status ${response.httpStatusCode}` + ); + } + return response; +}; +// ../blueprints/src/lib/steps/define-wp-config-consts.ts +async function defineBeforeRun(playground, consts) { + for (const key in consts) { + await playground.defineConstant(key, consts[key]); + } +} +async function rewriteDefineCalls(playground, phpCode, consts) { + await playground.writeFile('/tmp/code.php', phpCode); + const js = phpVars({ + consts, + }); + await playground.run({ + code: `${rewriteWpConfigToDefineConstants} + \$wp_config_path = '/tmp/code.php'; + \$wp_config = file_get_contents(\$wp_config_path); + \$new_wp_config = rewrite_wp_config_to_define_constants(\$wp_config, ${js.consts}); + file_put_contents(\$wp_config_path, \$new_wp_config); + `, + }); + return await playground.readFileAsText('/tmp/code.php'); +} +var rewriteWpConfigToDefineConstants = ''; +var defineWpConfigConsts = async ( + playground, + { consts, method = 'define-before-run' } +) => { + switch (method) { + case 'define-before-run': + await defineBeforeRun(playground, consts); + break; + case 'rewrite-wp-config': { + const documentRoot = await playground.documentRoot; + const wpConfigPath = joinPaths(documentRoot, '/wp-config.php'); + const wpConfig = await playground.readFileAsText(wpConfigPath); + const updatedWpConfig = await rewriteDefineCalls( + playground, + wpConfig, + consts + ); + await playground.writeFile(wpConfigPath, updatedWpConfig); + break; + } + default: + throw new Error(`Invalid method: ${method}`); + } +}; + +// ../blueprints/src/lib/steps/login.ts +var login = async ( + playground, + { username = 'admin', password = 'password' } = {}, + progress +) => { + progress?.tracker.setCaption(progress?.initialCaption || 'Logging in'); + await playground.request({ + url: '/wp-login.php', + }); + const response = await playground.request({ + url: '/wp-login.php', + method: 'POST', + body: { + log: username, + pwd: password, + rememberme: 'forever', + }, + }); + if (!response.headers?.['location']?.[0]?.includes('/wp-admin/')) { + logger3.warn('WordPress response was', { + response, + text: response.text, + }); + throw new Error( + `Failed to log in as ${username} with password ${password}` + ); + } +}; + +// ../blueprints/src/lib/steps/site-data.ts +var setSiteOptions = async (php, { options }) => { + const docroot = await php.documentRoot; + await php.run({ + code: ` \$value) { + update_option(\$name, \$value); + } + echo "Success"; + `, + }); +}; +var updateUserMeta = async (php, { meta, userId }) => { + const docroot = await php.documentRoot; + await php.run({ + code: ` \$value) { + update_user_meta(${phpVar(userId)}, \$name, \$value); + } + `, + }); +}; + +// ../../php-wasm/scopes/src/index.ts +function isURLScoped(url) { + return url.pathname.startsWith(`/scope:`); +} +function getURLScope(url) { + if (isURLScoped(url)) { + return url.pathname.split('/')[1].split(':')[1]; + } + return null; +} + +// ../blueprints/src/lib/steps/enable-multisite.ts +var jsonToUrlEncoded = function (json) { + return Object.keys(json) + .map( + (key) => + encodeURIComponent(key) + '=' + encodeURIComponent(json[key]) + ) + .join('&'); +}; +var enableMultisite = async (playground) => { + await defineWpConfigConsts(playground, { + consts: { + WP_ALLOW_MULTISITE: 1, + }, + }); + const url = new URL(await playground.absoluteUrl); + if (url.port !== '') { + let errorMessage = `The current host is ${url.host}, but WordPress multisites do not support custom ports.`; + if (url.hostname === 'localhost') { + errorMessage += ` For development, you can set up a playground.test domain using the instructions at https://wordpress.github.io/wordpress-playground/contributing/code.`; + } + throw new Error(errorMessage); + } + const sitePath = url.pathname.replace(/\/$/, '') + '/'; + const siteUrl = `${url.protocol}//${url.hostname}${sitePath}`; + await setSiteOptions(playground, { + options: { + siteurl: siteUrl, + home: siteUrl, + }, + }); + await login(playground, {}); + const docroot = await playground.documentRoot; + const result = await playground.run({ + code: ` 'Administrator') )[0] ); + +require_once(${phpVar(docroot)} . "/wp-admin/includes/plugin.php"); +\$plugins_root = ${phpVar(docroot)} . "/wp-content/plugins"; +\$plugins = glob(\$plugins_root . "/*"); + +\$deactivated_plugins = []; +foreach(\$plugins as \$plugin_path) { + if (str_ends_with(\$plugin_path, '/index.php')) { + continue; + } + if (!is_dir(\$plugin_path)) { + \$deactivated_plugins[] = substr(\$plugin_path, strlen(\$plugins_root) + 1); + deactivate_plugins(\$plugin_path); + continue; + } + // Find plugin entry file + foreach ( ( glob( \$plugin_path . '/*.php' ) ?: array() ) as \$file ) { + \$info = get_plugin_data( \$file, false, false ); + if ( ! empty( \$info['Name'] ) ) { + deactivate_plugins( \$file ); + \$deactivated_plugins[] = substr(\$file, strlen(\$plugins_root) + 1); + break; + } + } +} +echo json_encode(\$deactivated_plugins); +`, + }); + const deactivatedPlugins = result.json; + const networkForm = await request(playground, { + request: { + url: '/wp-admin/network.php', + }, + }); + const nonce = networkForm.text.match( + /name="_wpnonce"\s+value="([^"]+)"/ + )?.[1]; + const response = await request(playground, { + request: { + url: '/wp-admin/network.php', + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + body: jsonToUrlEncoded({ + _wpnonce: nonce, + _wp_http_referer: sitePath + 'wp-admin/network.php', + sitename: 'My WordPress Website Sites', + email: 'admin@localhost.com', + submit: 'Install', + }), + }, + }); + if (response.httpStatusCode !== 200) { + logger3.warn('WordPress response was', { + response, + text: response.text, + headers: response.headers, + }); + throw new Error( + `Failed to enable multisite. Response code was ${response.httpStatusCode}` + ); + } + await defineWpConfigConsts(playground, { + consts: { + MULTISITE: true, + SUBDOMAIN_INSTALL: false, + SITE_ID_CURRENT_SITE: 1, + BLOG_ID_CURRENT_SITE: 1, + DOMAIN_CURRENT_SITE: url.hostname, + PATH_CURRENT_SITE: sitePath, + }, + }); + const playgroundUrl = new URL(await playground.absoluteUrl); + const wpInstallationFolder = isURLScoped(playgroundUrl) + ? 'scope:' + getURLScope(playgroundUrl) + : null; + await playground.writeFile( + '/internal/shared/preload/sunrise.php', + ` { + await playground.writeFile( + toPath, + await playground.readFileAsBuffer(fromPath) + ); +}; +// ../blueprints/src/lib/steps/mv.ts +var mv = async (playground, { fromPath, toPath }) => { + await playground.mv(fromPath, toPath); +}; +// ../blueprints/src/lib/steps/mkdir.ts +var mkdir = async (playground, { path }) => { + await playground.mkdir(path); +}; +// ../blueprints/src/lib/steps/rmdir.ts +var rmdir = async (playground, { path }) => { + await playground.rmdir(path); +}; +// ../blueprints/src/lib/steps/write-file.ts +var writeFile = async (playground, { path, data }) => { + if (data instanceof File) { + data = new Uint8Array(await data.arrayBuffer()); + } + if ( + path.startsWith('/wordpress/wp-content/mu-plugins') && + !(await playground.fileExists('/wordpress/wp-content/mu-plugins')) + ) { + await playground.mkdir('/wordpress/wp-content/mu-plugins'); + } + await playground.writeFile(path, data); +}; +// ../blueprints/src/lib/steps/define-site-url.ts +var defineSiteUrl = async (playground, { siteUrl }) => { + await defineWpConfigConsts(playground, { + consts: { + WP_HOME: siteUrl, + WP_SITEURL: siteUrl, + }, + }); +}; +// ../blueprints/src/lib/steps/import-wxr.ts +var importWxr = async (playground, { file }, progress) => { + progress?.tracker?.setCaption('Importing content'); + await writeFile(playground, { + path: '/tmp/import.wxr', + data: file, + }); + const docroot = await playground.documentRoot; + await playground.run({ + code: ` 'Administrator') )[0]->ID; + wp_set_current_user( \$admin_id ); + \$importer = new WXR_Importer( array( + 'fetch_attachments' => true, + 'default_author' => \$admin_id + ) ); + \$logger = new WP_Importer_Logger_CLI(); + \$importer->set_logger( \$logger ); + + // Slashes from the imported content are lost if we don't call wp_slash here. + add_action( 'wp_insert_post_data', function( \$data ) { + return wp_slash(\$data); + }); + + \$result = \$importer->import( '/tmp/import.wxr' ); + `, + }); +}; +// ../common/src/index.ts +var tmpPath = '/tmp/file.zip'; +var unzipFile = async (php, zipPath, extractToPath) => { + if (zipPath instanceof File) { + const zipFile = zipPath; + zipPath = tmpPath; + await php.writeFile( + zipPath, + new Uint8Array(await zipFile.arrayBuffer()) + ); + } + const js = phpVars({ + zipPath, + extractToPath, + }); + await php.run({ + code: `open(\$zipPath); + if (\$res === TRUE) { + \$zip->extractTo(\$extractTo); + \$zip->close(); + chmod(\$extractTo, 0777); + } else { + throw new Exception("Could not unzip file"); + } + } + unzip(${js.zipPath}, ${js.extractToPath}); + `, + }); + if (await php.fileExists(tmpPath)) { + await php.unlink(tmpPath); + } +}; + +// ../blueprints/src/lib/steps/unzip.ts +var unzip = async (playground, { zipFile, zipPath, extractToPath }) => { + if (zipPath) { + logger3.warn( + `The "zipPath" option of the unzip() Blueprint step is deprecated and will be removed. Use "zipFile" instead.` + ); + } else if (!zipFile) { + throw new Error('Either zipPath or zipFile must be provided'); + } + await unzipFile(playground, zipFile || zipPath, extractToPath); +}; + +// ../blueprints/src/lib/steps/import-wordpress-files.ts +async function removePath(playground, path) { + if (await playground.fileExists(path)) { + if (await playground.isDir(path)) { + await playground.rmdir(path); + } else { + await playground.unlink(path); + } + } +} +var importWordPressFiles = async ( + playground, + { wordPressFilesZip, pathInZip = '' } +) => { + const documentRoot = await playground.documentRoot; + let importPath = joinPaths('/tmp', 'import'); + await playground.mkdir(importPath); + await unzip(playground, { + zipFile: wordPressFilesZip, + extractToPath: importPath, + }); + importPath = joinPaths(importPath, pathInZip); + const importedWpContentPath = joinPaths(importPath, 'wp-content'); + const wpContentPath = joinPaths(documentRoot, 'wp-content'); + for (const relativePath of wpContentFilesExcludedFromExport) { + const excludedImportPath = joinPaths( + importedWpContentPath, + relativePath + ); + await removePath(playground, excludedImportPath); + const restoreFromPath = joinPaths(wpContentPath, relativePath); + if (await playground.fileExists(restoreFromPath)) { + await playground.mkdir(dirname(excludedImportPath)); + await playground.mv(restoreFromPath, excludedImportPath); + } + } + const importedDatabasePath = joinPaths( + importPath, + 'wp-content', + 'database' + ); + if (!(await playground.fileExists(importedDatabasePath))) { + await playground.mv( + joinPaths(documentRoot, 'wp-content', 'database'), + importedDatabasePath + ); + } + const importedFilenames = await playground.listFiles(importPath); + for (const fileName of importedFilenames) { + await removePath(playground, joinPaths(documentRoot, fileName)); + await playground.mv( + joinPaths(importPath, fileName), + joinPaths(documentRoot, fileName) + ); + } + await playground.rmdir(importPath); + await defineSiteUrl(playground, { + siteUrl: await playground.absoluteUrl, + }); + const upgradePhp = phpVar( + joinPaths(documentRoot, 'wp-admin', 'upgrade.php') + ); + await playground.run({ + code: ` !name.endsWith('/__MACOSX')); + const zipHasRootFolder = + files.length === 1 && (await playground.isDir(files[0])); + let assetFolderName; + let tmpAssetPath = ''; + if (zipHasRootFolder) { + tmpAssetPath = files[0]; + assetFolderName = files[0].split('/').pop(); + } else { + tmpAssetPath = tmpUnzippedFilesPath; + assetFolderName = assetNameGuess; + } + const assetFolderPath = `${targetPath}/${assetFolderName}`; + if (await playground.fileExists(assetFolderPath)) { + if (!(await playground.isDir(assetFolderPath))) { + throw new Error( + `Cannot install asset ${assetFolderName} to ${assetFolderPath} because a file with the same name already exists. Note it's a file, not a directory! Is this by mistake?` + ); + } + if (ifAlreadyInstalled === 'overwrite') { + await playground.rmdir(assetFolderPath, { + recursive: true, + }); + } else if (ifAlreadyInstalled === 'skip') { + return { + assetFolderPath, + assetFolderName, + }; + } else { + throw new Error( + `Cannot install asset ${assetFolderName} to ${targetPath} because it already exists and ` + + `the ifAlreadyInstalled option was set to ${ifAlreadyInstalled}` + ); + } + } + await playground.mv(tmpAssetPath, assetFolderPath); + return { + assetFolderPath, + assetFolderName, + }; + } finally { + await playground.rmdir(tmpDir, { + recursive: true, + }); + } +} + +// ../blueprints/src/lib/utils/zip-name-to-human-name.ts +function zipNameToHumanName(zipName) { + const mixedCaseName = zipName.split('.').shift().replace(/-/g, ' '); + return ( + mixedCaseName.charAt(0).toUpperCase() + + mixedCaseName.slice(1).toLowerCase() + ); +} + +// ../blueprints/src/lib/steps/install-plugin.ts +var installPlugin = async ( + playground, + { pluginZipFile, ifAlreadyInstalled, options = {} }, + progress +) => { + const zipFileName = pluginZipFile.name.split('/').pop() || 'plugin.zip'; + const zipNiceName = zipNameToHumanName(zipFileName); + progress?.tracker.setCaption(`Installing the ${zipNiceName} plugin`); + const { assetFolderPath } = await installAsset(playground, { + ifAlreadyInstalled, + zipFile: pluginZipFile, + targetPath: `${await playground.documentRoot}/wp-content/plugins`, + }); + const activate = 'activate' in options ? options.activate : true; + if (activate) { + await activatePlugin( + playground, + { + pluginPath: assetFolderPath, + pluginName: zipNiceName, + }, + progress + ); + } +}; +// ../blueprints/src/lib/steps/install-theme.ts +var installTheme = async ( + playground, + { themeZipFile, ifAlreadyInstalled, options = {} }, + progress +) => { + const zipNiceName = zipNameToHumanName(themeZipFile.name); + progress?.tracker.setCaption(`Installing the ${zipNiceName} theme`); + const { assetFolderName } = await installAsset(playground, { + ifAlreadyInstalled, + zipFile: themeZipFile, + targetPath: `${await playground.documentRoot}/wp-content/themes`, + }); + const activate = 'activate' in options ? options.activate : true; + if (activate) { + await activateTheme( + playground, + { + themeFolderName: assetFolderName, + }, + progress + ); + } +}; +// ../blueprints/src/lib/steps/reset-data.ts +var resetData = async (playground, _options, progress) => { + progress?.tracker?.setCaption('Resetting WordPress data'); + const docroot = await playground.documentRoot; + await playground.run({ + env: { + DOCROOT: docroot, + }, + code: `query('DELETE FROM wp_posts WHERE id > 0'); + \$GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='wp_posts'"); + + \$GLOBALS['@pdo']->query('DELETE FROM wp_postmeta WHERE post_id > 1'); + \$GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=20 WHERE NAME='wp_postmeta'"); + + \$GLOBALS['@pdo']->query('DELETE FROM wp_comments'); + \$GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='wp_comments'"); + + \$GLOBALS['@pdo']->query('DELETE FROM wp_commentmeta'); + \$GLOBALS['@pdo']->query("UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='wp_commentmeta'"); + `, + }); +}; +// ../blueprints/src/lib/steps/run-wp-installation-wizard.ts +var runWpInstallationWizard = async (playground, { options }) => { + await playground.request({ + url: '/wp-admin/install.php?step=2', + method: 'POST', + body: { + language: 'en', + prefix: 'wp_', + weblog_title: 'My WordPress Website', + user_name: options.adminPassword || 'admin', + admin_password: options.adminPassword || 'password', + admin_password2: options.adminPassword || 'password', + Submit: 'Install WordPress', + pw_weak: '1', + admin_email: 'admin@localhost.com', + }, + }); +}; +// ../blueprints/src/lib/steps/zip-wp-content.ts +async function runPhpWithZipFunctions(playground, code) { + return await playground.run({ + code: zipFunctions + code, + }); +} +var zipWpContent = async (playground, { selfContained = false } = {}) => { + const zipPath = '/tmp/wordpress-playground.zip'; + const documentRoot = await playground.documentRoot; + const wpContentPath = joinPaths(documentRoot, 'wp-content'); + let exceptPaths = wpContentFilesExcludedFromExport; + if (selfContained) { + exceptPaths = exceptPaths + .filter((path) => !path.startsWith('themes/twenty')) + .filter( + (path) => path !== 'mu-plugins/sqlite-database-integration' + ); + } + const js = phpVars({ + zipPath, + wpContentPath, + documentRoot, + exceptPaths: exceptPaths.map((path) => + joinPaths(documentRoot, 'wp-content', path) + ), + additionalPaths: selfContained + ? { + [joinPaths(documentRoot, 'wp-config.php')]: 'wp-config.php', + } + : {}, + }); + await runPhpWithZipFunctions( + playground, + `zipDir(${js.wpContentPath}, ${js.zipPath}, array( + 'exclude_paths' => ${js.exceptPaths}, + 'zip_root' => ${js.documentRoot}, + 'additional_paths' => ${js.additionalPaths} + ));` + ); + const fileBuffer = await playground.readFileAsBuffer(zipPath); + playground.unlink(zipPath); + return fileBuffer; +}; +var zipFunctions = `open(\$output, ZipArchive::CREATE); + if (\$res === TRUE) { + \$directories = array( + \$root . '/' + ); + while (sizeof(\$directories)) { + \$current_dir = array_pop(\$directories); + + if (\$handle = opendir(\$current_dir)) { + while (false !== (\$entry = readdir(\$handle))) { + if (\$entry == '.' || \$entry == '..') { + continue; + } + + \$entry = join_paths(\$current_dir, \$entry); + if (in_array(\$entry, \$excludePaths)) { + continue; + } + + if (is_dir(\$entry)) { + \$directory_path = \$entry . '/'; + array_push(\$directories, \$directory_path); + } else if (is_file(\$entry)) { + \$zip->addFile(\$entry, substr(\$entry, strlen(\$zip_root))); + } + } + closedir(\$handle); + } + } + foreach (\$additionalPaths as \$disk_path => \$zip_path) { + \$zip->addFile(\$disk_path, \$zip_path); + } + \$zip->close(); + chmod(\$output, 0777); + } +} + +function join_paths() +{ + \$paths = array(); + + foreach (func_get_args() as \$arg) { + if (\$arg !== '') { + \$paths[] = \$arg; + } + } + + return preg_replace('#/+#', '/', join('/', \$paths)); +} +`; +// ../blueprints/src/lib/steps/wp-cli.ts +function splitShellCommand2(command) { + const MODE_NORMAL = 0; + const MODE_IN_QUOTE = 1; + let mode = MODE_NORMAL; + let quote = ''; + const parts = []; + let currentPart = ''; + for (let i = 0; i < command.length; i++) { + const char = command[i]; + if (mode === MODE_NORMAL) { + if (char === '"' || char === "'") { + mode = MODE_IN_QUOTE; + quote = char; + } else if (char.match(/\s/)) { + if (currentPart) { + parts.push(currentPart); + } + currentPart = ''; + } else { + currentPart += char; + } + } else if (mode === MODE_IN_QUOTE) { + if (char === '\\') { + i++; + currentPart += command[i]; + } else if (char === quote) { + mode = MODE_NORMAL; + quote = ''; + } else { + currentPart += char; + } + } + } + if (currentPart) { + parts.push(currentPart); + } + return parts; +} +var wpCLI = async (playground, { command, wpCliPath = '/tmp/wp-cli.phar' }) => { + if (!(await playground.fileExists(wpCliPath))) { + throw new Error(`wp-cli.phar not found at ${wpCliPath}`); + } + let args; + if (typeof command === 'string') { + command = command.trim(); + args = splitShellCommand2(command); + } else { + args = command; + } + const cmd = args.shift(); + if (cmd !== 'wp') { + throw new Error(`The first argument must be "wp".`); + } + await playground.writeFile('/tmp/stdout', ''); + await playground.writeFile('/tmp/stderr', ''); + await playground.writeFile( + '/wordpress/run-cli.php', + ` total + value, 0); +}; +function cloneResponseMonitorProgress(response, onProgress) { + const contentLength = response.headers.get('content-length') || ''; + const total = parseInt(contentLength, 10) || FALLBACK_FILE_SIZE; + function notify(loaded, total2) { + onProgress( + new CustomEvent('progress', { + detail: { + loaded, + total: total2, + }, + }) + ); + } + return new Response( + new ReadableStream({ + async start(controller) { + if (!response.body) { + controller.close(); + return; + } + const reader = response.body.getReader(); + let loaded = 0; + for (;;) { + try { + const { done, value } = await reader.read(); + if (value) { + loaded += value.byteLength; + } + if (done) { + notify(loaded, loaded); + controller.close(); + break; + } else { + notify(loaded, total); + controller.enqueue(value); + } + } catch (e) { + logger3.error({ e }); + controller.error(e); + break; + } + } + }, + }), + { + status: response.status, + statusText: response.statusText, + headers: response.headers, + } + ); +} +var FALLBACK_FILE_SIZE = 5242880; + +class EmscriptenDownloadMonitor extends EventTarget { + constructor() { + super(...arguments); + } + #assetsSizes = {}; + #progress = {}; + expectAssets(assets) { + for (const [urlLike, size] of Object.entries(assets)) { + const dummyBaseUrl = 'http://example.com/'; + const pathname = new URL(urlLike, dummyBaseUrl).pathname; + const filename = pathname.split('/').pop(); + if (!(filename in this.#assetsSizes)) { + this.#assetsSizes[filename] = size; + } + if (!(filename in this.#progress)) { + this.#progress[filename] = 0; + } + } + } + async monitorFetch(fetchPromise) { + const response = await fetchPromise; + const onProgress = (event) => { + this.#notify(response.url, event.detail.loaded, event.detail.total); + }; + return cloneResponseMonitorProgress(response, onProgress); + } + #notify(file, loaded, fileSize) { + const fileName = new URL(file, 'http://example.com').pathname + .split('/') + .pop(); + if (!fileSize) { + fileSize = this.#assetsSizes[fileName]; + } else if (!(fileName in this.#assetsSizes)) { + this.#assetsSizes[fileName] = fileSize; + this.#progress[fileName] = loaded; + } + if (!(fileName in this.#progress)) { + logger3.warn( + `Registered a download #progress of an unregistered file "${fileName}". ` + + `This may cause a sudden **decrease** in the #progress percentage as the total number of bytes increases during the download.` + ); + } + this.#progress[fileName] = loaded; + this.dispatchEvent( + new CustomEvent('progress', { + detail: { + loaded: sumValues(this.#progress), + total: sumValues(this.#assetsSizes), + }, + }) + ); + } +} +// ../../php-wasm/progress/src/lib/progress-observer.ts +class ProgressObserver extends EventTarget { + constructor() { + super(...arguments); + } + #observedProgresses = {}; + #lastObserverId = 0; + progress = 0; + mode = 'REAL_TIME'; + caption = ''; + partialObserver(progressBudget, caption = '') { + const id = ++this.#lastObserverId; + this.#observedProgresses[id] = 0; + return (progress) => { + const { loaded, total } = progress?.detail || {}; + this.#observedProgresses[id] = (loaded / total) * progressBudget; + this.#onProgress(this.totalProgress, 'REAL_TIME', caption); + }; + } + slowlyIncrementBy(progress) { + const id = ++this.#lastObserverId; + this.#observedProgresses[id] = progress; + this.#onProgress(this.totalProgress, 'SLOWLY_INCREMENT'); + } + get totalProgress() { + return Object.values(this.#observedProgresses).reduce( + (total, progress) => total + progress, + 0 + ); + } + #onProgress(progress, mode, caption) { + this.dispatchEvent( + new CustomEvent('progress', { + detail: { + progress, + mode, + caption, + }, + }) + ); + } +} +// ../../php-wasm/universal/src/lib/emscripten-types.ts +var Emscripten; +(function (Emscripten) { + let FS; + (function (FS) {})((FS = Emscripten.FS || (Emscripten.FS = {}))); +})(Emscripten || (Emscripten = {})); + +// ../../php-wasm/universal/src/lib/rethrow-file-system-error.ts +function getEmscriptenFsError(e) { + const errno = typeof e === 'object' ? e?.errno : null; + if (errno in FileErrorCodes) { + return FileErrorCodes[errno]; + } +} +function rethrowFileSystemError(messagePrefix = '') { + return function catchFileSystemError(target, methodName, descriptor) { + const method = descriptor.value; + descriptor.value = function (...args) { + try { + return method.apply(this, args); + } catch (e) { + const errno = typeof e === 'object' ? e?.errno : null; + if (errno in FileErrorCodes) { + const errmsg = FileErrorCodes[errno]; + const path = typeof args[1] === 'string' ? args[1] : null; + const formattedPrefix = + path !== null + ? messagePrefix.replaceAll('{path}', path) + : messagePrefix; + throw new Error(`${formattedPrefix}: ${errmsg}`, { + cause: e, + }); + } + throw e; + } + }; + }; +} +var FileErrorCodes = { + 0: 'No error occurred. System call completed successfully.', + 1: 'Argument list too long.', + 2: 'Permission denied.', + 3: 'Address in use.', + 4: 'Address not available.', + 5: 'Address family not supported.', + 6: 'Resource unavailable, or operation would block.', + 7: 'Connection already in progress.', + 8: 'Bad file descriptor.', + 9: 'Bad message.', + 10: 'Device or resource busy.', + 11: 'Operation canceled.', + 12: 'No child processes.', + 13: 'Connection aborted.', + 14: 'Connection refused.', + 15: 'Connection reset.', + 16: 'Resource deadlock would occur.', + 17: 'Destination address required.', + 18: 'Mathematics argument out of domain of function.', + 19: 'Reserved.', + 20: 'File exists.', + 21: 'Bad address.', + 22: 'File too large.', + 23: 'Host is unreachable.', + 24: 'Identifier removed.', + 25: 'Illegal byte sequence.', + 26: 'Operation in progress.', + 27: 'Interrupted function.', + 28: 'Invalid argument.', + 29: 'I/O error.', + 30: 'Socket is connected.', + 31: 'There is a directory under that path.', + 32: 'Too many levels of symbolic links.', + 33: 'File descriptor value too large.', + 34: 'Too many links.', + 35: 'Message too large.', + 36: 'Reserved.', + 37: 'Filename too long.', + 38: 'Network is down.', + 39: 'Connection aborted by network.', + 40: 'Network unreachable.', + 41: 'Too many files open in system.', + 42: 'No buffer space available.', + 43: 'No such device.', + 44: 'There is no such file or directory OR the parent directory does not exist.', + 45: 'Executable file format error.', + 46: 'No locks available.', + 47: 'Reserved.', + 48: 'Not enough space.', + 49: 'No message of the desired type.', + 50: 'Protocol not available.', + 51: 'No space left on device.', + 52: 'Function not supported.', + 53: 'The socket is not connected.', + 54: 'Not a directory or a symbolic link to a directory.', + 55: 'Directory not empty.', + 56: 'State not recoverable.', + 57: 'Not a socket.', + 58: 'Not supported, or operation not supported on socket.', + 59: 'Inappropriate I/O control operation.', + 60: 'No such device or address.', + 61: 'Value too large to be stored in data type.', + 62: 'Previous owner died.', + 63: 'Operation not permitted.', + 64: 'Broken pipe.', + 65: 'Protocol error.', + 66: 'Protocol not supported.', + 67: 'Protocol wrong type for socket.', + 68: 'Result too large.', + 69: 'Read-only file system.', + 70: 'Invalid seek.', + 71: 'No such process.', + 72: 'Reserved.', + 73: 'Connection timed out.', + 74: 'Text file busy.', + 75: 'Cross-device link.', + 76: 'Extension: Capabilities insufficient.', +}; + +// ../../php-wasm/universal/src/lib/fs-helpers.ts +class FSHelpers { + static readFileAsText(FS, path) { + return new TextDecoder().decode(FSHelpers.readFileAsBuffer(FS, path)); + } + static readFileAsBuffer(FS, path) { + return FS.readFile(path); + } + static writeFile(FS, path, data) { + FS.writeFile(path, data); + } + static unlink(FS, path) { + FS.unlink(path); + } + static mv(FS, fromPath, toPath) { + try { + const fromMount = FS.lookupPath(fromPath).node.mount; + const toMount = FSHelpers.fileExists(FS, toPath) + ? FS.lookupPath(toPath).node.mount + : FS.lookupPath(dirname(toPath)).node.mount; + const movingBetweenFilesystems = + fromMount.mountpoint !== toMount.mountpoint; + if (movingBetweenFilesystems) { + FSHelpers.copyRecursive(FS, fromPath, toPath); + FSHelpers.rmdir(FS, fromPath, { recursive: true }); + } else { + FS.rename(fromPath, toPath); + } + } catch (e) { + const errmsg = getEmscriptenFsError(e); + if (!errmsg) { + throw e; + } + throw new Error( + `Could not move ${fromPath} to ${toPath}: ${errmsg}`, + { + cause: e, + } + ); + } + } + static rmdir(FS, path, options = { recursive: true }) { + if (options?.recursive) { + FSHelpers.listFiles(FS, path).forEach((file) => { + const filePath = `${path}/${file}`; + if (FSHelpers.isDir(FS, filePath)) { + FSHelpers.rmdir(FS, filePath, options); + } else { + FSHelpers.unlink(FS, filePath); + } + }); + } + FS.rmdir(path); + } + static listFiles(FS, path, options = { prependPath: false }) { + if (!FSHelpers.fileExists(FS, path)) { + return []; + } + try { + const files = FS.readdir(path).filter( + (name) => name !== '.' && name !== '..' + ); + if (options.prependPath) { + const prepend = path.replace(/\/$/, ''); + return files.map((name) => `${prepend}/${name}`); + } + return files; + } catch (e) { + logger3.error(e, { path }); + return []; + } + } + static isDir(FS, path) { + if (!FSHelpers.fileExists(FS, path)) { + return false; + } + return FS.isDir(FS.lookupPath(path).node.mode); + } + static fileExists(FS, path) { + try { + FS.lookupPath(path); + return true; + } catch (e) { + return false; + } + } + static mkdir(FS, path) { + FS.mkdirTree(path); + } + static copyRecursive(FS, fromPath, toPath) { + const fromNode = FS.lookupPath(fromPath).node; + if (FS.isDir(fromNode.mode)) { + FS.mkdirTree(toPath); + const filenames = FS.readdir(fromPath).filter( + (name) => name !== '.' && name !== '..' + ); + for (const filename of filenames) { + FSHelpers.copyRecursive( + FS, + joinPaths(fromPath, filename), + joinPaths(toPath, filename) + ); + } + } else { + FS.writeFile(toPath, FS.readFile(fromPath)); + } + } +} +__legacyDecorateClassTS( + [ + rethrowFileSystemError('Could not read "{path}"'), + __legacyMetadataTS('design:type', Function), + __legacyMetadataTS('design:paramtypes', [ + typeof Emscripten === 'undefined' || + typeof Emscripten.RootFS === 'undefined' + ? Object + : Emscripten.RootFS, + String, + ]), + __legacyMetadataTS('design:returntype', undefined), + ], + FSHelpers, + 'readFileAsText', + null +); +__legacyDecorateClassTS( + [ + rethrowFileSystemError('Could not read "{path}"'), + __legacyMetadataTS('design:type', Function), + __legacyMetadataTS('design:paramtypes', [ + typeof Emscripten === 'undefined' || + typeof Emscripten.RootFS === 'undefined' + ? Object + : Emscripten.RootFS, + String, + ]), + __legacyMetadataTS( + 'design:returntype', + typeof Uint8Array === 'undefined' ? Object : Uint8Array + ), + ], + FSHelpers, + 'readFileAsBuffer', + null +); +__legacyDecorateClassTS( + [ + rethrowFileSystemError('Could not write to "{path}"'), + __legacyMetadataTS('design:type', Function), + __legacyMetadataTS('design:paramtypes', [ + typeof Emscripten === 'undefined' || + typeof Emscripten.RootFS === 'undefined' + ? Object + : Emscripten.RootFS, + String, + Object, + ]), + __legacyMetadataTS('design:returntype', undefined), + ], + FSHelpers, + 'writeFile', + null +); +__legacyDecorateClassTS( + [ + rethrowFileSystemError('Could not unlink "{path}"'), + __legacyMetadataTS('design:type', Function), + __legacyMetadataTS('design:paramtypes', [ + typeof Emscripten === 'undefined' || + typeof Emscripten.RootFS === 'undefined' + ? Object + : Emscripten.RootFS, + String, + ]), + __legacyMetadataTS('design:returntype', undefined), + ], + FSHelpers, + 'unlink', + null +); +__legacyDecorateClassTS( + [ + rethrowFileSystemError('Could not remove directory "{path}"'), + __legacyMetadataTS('design:type', Function), + __legacyMetadataTS('design:paramtypes', [ + typeof Emscripten === 'undefined' || + typeof Emscripten.RootFS === 'undefined' + ? Object + : Emscripten.RootFS, + String, + typeof RmDirOptions === 'undefined' ? Object : RmDirOptions, + ]), + __legacyMetadataTS('design:returntype', undefined), + ], + FSHelpers, + 'rmdir', + null +); +__legacyDecorateClassTS( + [ + rethrowFileSystemError('Could not list files in "{path}"'), + __legacyMetadataTS('design:type', Function), + __legacyMetadataTS('design:paramtypes', [ + typeof Emscripten === 'undefined' || + typeof Emscripten.RootFS === 'undefined' + ? Object + : Emscripten.RootFS, + String, + typeof ListFilesOptions === 'undefined' ? Object : ListFilesOptions, + ]), + __legacyMetadataTS('design:returntype', Array), + ], + FSHelpers, + 'listFiles', + null +); +__legacyDecorateClassTS( + [ + rethrowFileSystemError('Could not stat "{path}"'), + __legacyMetadataTS('design:type', Function), + __legacyMetadataTS('design:paramtypes', [ + typeof Emscripten === 'undefined' || + typeof Emscripten.RootFS === 'undefined' + ? Object + : Emscripten.RootFS, + String, + ]), + __legacyMetadataTS('design:returntype', Boolean), + ], + FSHelpers, + 'isDir', + null +); +__legacyDecorateClassTS( + [ + rethrowFileSystemError('Could not stat "{path}"'), + __legacyMetadataTS('design:type', Function), + __legacyMetadataTS('design:paramtypes', [ + typeof Emscripten === 'undefined' || + typeof Emscripten.RootFS === 'undefined' + ? Object + : Emscripten.RootFS, + String, + ]), + __legacyMetadataTS('design:returntype', Boolean), + ], + FSHelpers, + 'fileExists', + null +); +__legacyDecorateClassTS( + [ + rethrowFileSystemError('Could not create directory "{path}"'), + __legacyMetadataTS('design:type', Function), + __legacyMetadataTS('design:paramtypes', [ + typeof Emscripten === 'undefined' || + typeof Emscripten.RootFS === 'undefined' + ? Object + : Emscripten.RootFS, + String, + ]), + __legacyMetadataTS('design:returntype', undefined), + ], + FSHelpers, + 'mkdir', + null +); +__legacyDecorateClassTS( + [ + rethrowFileSystemError('Could not copy files from "{path}"'), + __legacyMetadataTS('design:type', Function), + __legacyMetadataTS('design:paramtypes', [ + typeof Emscripten === 'undefined' || + typeof Emscripten.FileSystemInstance === 'undefined' + ? Object + : Emscripten.FileSystemInstance, + String, + String, + ]), + __legacyMetadataTS('design:returntype', undefined), + ], + FSHelpers, + 'copyRecursive', + null +); +// ../../php-wasm/universal/src/lib/php-worker.ts +var _private = new WeakMap(); +// ../../php-wasm/universal/src/lib/php-response.ts +var responseTexts = { + 500: 'Internal Server Error', + 502: 'Bad Gateway', + 404: 'Not Found', + 403: 'Forbidden', + 401: 'Unauthorized', + 400: 'Bad Request', + 301: 'Moved Permanently', + 302: 'Found', + 307: 'Temporary Redirect', + 308: 'Permanent Redirect', + 204: 'No Content', + 201: 'Created', + 200: 'OK', +}; + +class PHPResponse { + headers; + bytes; + errors; + exitCode; + httpStatusCode; + constructor(httpStatusCode, headers, body, errors = '', exitCode = 0) { + this.httpStatusCode = httpStatusCode; + this.headers = headers; + this.bytes = body; + this.exitCode = exitCode; + this.errors = errors; + } + static forHttpCode(httpStatusCode, text = '') { + return new PHPResponse( + httpStatusCode, + {}, + new TextEncoder().encode( + text || responseTexts[httpStatusCode] || '' + ) + ); + } + static fromRawData(data) { + return new PHPResponse( + data.httpStatusCode, + data.headers, + data.bytes, + data.errors, + data.exitCode + ); + } + toRawData() { + return { + headers: this.headers, + bytes: this.bytes, + errors: this.errors, + exitCode: this.exitCode, + httpStatusCode: this.httpStatusCode, + }; + } + get json() { + return JSON.parse(this.text); + } + get text() { + return new TextDecoder().decode(this.bytes); + } +} + +// ../../php-wasm/universal/src/lib/load-php-runtime.ts +async function loadPHPRuntime(phpLoaderModule, phpModuleArgs = {}) { + const [phpReady, resolvePHP, rejectPHP] = makePromise(); + const PHPRuntime = phpLoaderModule.init(currentJsRuntime2, { + onAbort(reason) { + rejectPHP(reason); + logger3.error(reason); + }, + ENV: {}, + locateFile: (path) => path, + ...phpModuleArgs, + noInitialRun: true, + onRuntimeInitialized() { + if (phpModuleArgs.onRuntimeInitialized) { + phpModuleArgs.onRuntimeInitialized(); + } + resolvePHP(); + }, + }); + await phpReady; + const id = ++lastRuntimeId; + PHPRuntime.id = id; + PHPRuntime.originalExit = PHPRuntime._exit; + PHPRuntime._exit = function (code) { + loadedRuntimes.delete(id); + return PHPRuntime.originalExit(code); + }; + PHPRuntime[RuntimeId] = id; + loadedRuntimes.set(id, PHPRuntime); + return id; +} +function getLoadedRuntime(id) { + return loadedRuntimes.get(id); +} +var RuntimeId = Symbol('RuntimeId'); +var loadedRuntimes = new Map(); +var lastRuntimeId = 0; +var currentJsRuntime2 = (function () { + if (typeof process !== 'undefined' && process.release?.name === 'node') { + return 'NODE'; + } else if (typeof window !== 'undefined') { + return 'WEB'; + } else if ( + typeof WorkerGlobalScope !== 'undefined' && + self instanceof WorkerGlobalScope + ) { + return 'WORKER'; + } else { + return 'NODE'; + } +})(); +var makePromise = () => { + const methods = []; + const promise = new Promise((resolve, reject) => { + methods.push(resolve, reject); + }); + methods.unshift(promise); + return methods; +}; + +// ../../php-wasm/universal/src/lib/error-event-polyfill.ts +var kError = Symbol('error'); +var kMessage = Symbol('message'); + +class ErrorEvent2 extends Event { + [kError]; + [kMessage]; + constructor(type, options = {}) { + super(type); + this[kError] = options.error === undefined ? null : options.error; + this[kMessage] = options.message === undefined ? '' : options.message; + } + get error() { + return this[kError]; + } + get message() { + return this[kMessage]; + } +} +Object.defineProperty(ErrorEvent2.prototype, 'error', { enumerable: true }); +Object.defineProperty(ErrorEvent2.prototype, 'message', { enumerable: true }); +var ErrorEvent = + typeof globalThis.ErrorEvent === 'function' + ? globalThis.ErrorEvent + : ErrorEvent2; + +// ../../php-wasm/universal/src/lib/is-exit-code-zero.ts +function isExitCodeZero(e) { + if (!(e instanceof Error)) { + return false; + } + return ( + ('exitCode' in e && e?.exitCode === 0) || + (e?.name === 'ExitStatus' && 'status' in e && e.status === 0) + ); +} + +// ../../php-wasm/universal/src/lib/wasm-error-reporting.ts +function improveWASMErrorReporting(runtime) { + const target = new UnhandledRejectionsTarget(); + for (const key in runtime.wasmExports) { + if (typeof runtime.wasmExports[key] == 'function') { + const original = runtime.wasmExports[key]; + runtime.wasmExports[key] = function (...args) { + try { + return original(...args); + } catch (e) { + if (!(e instanceof Error)) { + throw e; + } + const clearMessage = clarifyErrorMessage( + e, + runtime.lastAsyncifyStackSource?.stack + ); + if (runtime.lastAsyncifyStackSource) { + e.cause = runtime.lastAsyncifyStackSource; + } + if (target.hasListeners()) { + target.dispatchEvent( + new ErrorEvent('error', { + error: e, + message: clearMessage, + }) + ); + return; + } + if (!isExitCodeZero(e)) { + showCriticalErrorBox(clearMessage); + } + throw e; + } + }; + } + } + return target; +} +function getFunctionsMaybeMissingFromAsyncify() { + return functionsMaybeMissingFromAsyncify; +} +function clarifyErrorMessage(crypticError, asyncifyStack) { + if (crypticError.message === 'unreachable') { + let betterMessage = UNREACHABLE_ERROR; + if (!asyncifyStack) { + betterMessage += `\n\nThis stack trace is lacking. For a better one initialize \nthe PHP runtime with { debug: true }, e.g. PHPNode.load('8.1', { debug: true }).\n\n`; + } + functionsMaybeMissingFromAsyncify = extractPHPFunctionsFromStack( + asyncifyStack || crypticError.stack || '' + ); + for (const fn of functionsMaybeMissingFromAsyncify) { + betterMessage += ` * ${fn}\n`; + } + return betterMessage; + } + return crypticError.message; +} +function showCriticalErrorBox(message) { + if (logged) { + return; + } + logged = true; + if (message?.trim().startsWith('Program terminated with exit')) { + return; + } + logger3.log(`${redBg}\n${eol}\n${bold} WASM ERROR${reset}${redBg}`); + for (const line of message.split('\n')) { + logger3.log(`${eol} ${line} `); + } + logger3.log(`${reset}`); +} +var extractPHPFunctionsFromStack = function (stack) { + try { + const names = stack + .split('\n') + .slice(1) + .map((line) => { + const parts = line.trim().substring('at '.length).split(' '); + return { + fn: parts.length >= 2 ? parts[0] : '', + isWasm: line.includes('wasm://'), + }; + }) + .filter( + ({ fn, isWasm }) => + isWasm && + !fn.startsWith('dynCall_') && + !fn.startsWith('invoke_') + ) + .map(({ fn }) => fn); + return Array.from(new Set(names)); + } catch (err) { + return []; + } +}; + +class UnhandledRejectionsTarget extends EventTarget { + constructor() { + super(...arguments); + } + listenersCount = 0; + addEventListener(type, callback) { + ++this.listenersCount; + super.addEventListener(type, callback); + } + removeEventListener(type, callback) { + --this.listenersCount; + super.removeEventListener(type, callback); + } + hasListeners() { + return this.listenersCount > 0; + } +} +var functionsMaybeMissingFromAsyncify = []; +var UNREACHABLE_ERROR = ` +"unreachable" WASM instruction executed. + +The typical reason is a PHP function missing from the ASYNCIFY_ONLY +list when building PHP.wasm. + +You will need to file a new issue in the WordPress Playground repository +and paste this error message there: + +https://github.com/WordPress/wordpress-playground/issues/new + +If you're a core developer, the typical fix is to: + +* Isolate a minimal reproduction of the error +* Add a reproduction of the error to php-asyncify.spec.ts in the WordPress Playground repository +* Run 'npm run fix-asyncify' +* Commit the changes, push to the repo, release updated NPM packages + +Below is a list of all the PHP functions found in the stack trace to +help with the minimal reproduction. If they're all already listed in +the Dockerfile, you'll need to trigger this error again with long stack +traces enabled. In node.js, you can do it using the --stack-trace-limit=100 +CLI option: \n\n`; +var redBg = '\x1B[41m'; +var bold = '\x1B[1m'; +var reset = '\x1B[0m'; +var eol = '\x1B[K'; +var logged = false; + +// ../../php-wasm/universal/src/lib/php.ts +function normalizeHeaders(headers) { + const normalized = {}; + for (const key in headers) { + normalized[key.toLowerCase()] = headers[key]; + } + return normalized; +} +function copyFS(source, target, path) { + let oldNode; + try { + oldNode = source.lookupPath(path); + } catch (e) { + return; + } + if (!('contents' in oldNode.node)) { + return; + } + try { + } catch (e) {} + if (!source.isDir(oldNode.node.mode)) { + target.writeFile(path, source.readFile(path)); + return; + } + target.mkdirTree(path); + const filenames = source + .readdir(path) + .filter((name) => name !== '.' && name !== '..'); + for (const filename of filenames) { + copyFS(source, target, joinPaths(path, filename)); + } +} +var STRING = 'string'; +var NUMBER = 'number'; +var __private__dont__use = Symbol('__private__dont__use'); + +class PHPExecutionFailureError extends Error { + response; + source; + constructor(message, response, source) { + super(message); + this.response = response; + this.source = source; + } +} +var PHP_INI_PATH = '/internal/shared/php.ini'; +var AUTO_PREPEND_SCRIPT = '/internal/shared/auto_prepend_file.php'; + +class PHP { + [__private__dont__use]; + #sapiName; + #webSapiInitialized = false; + #wasmErrorsTarget = null; + #eventListeners = new Map(); + #messageListeners = []; + requestHandler; + semaphore; + constructor(PHPRuntimeId) { + this.semaphore = new Semaphore({ concurrency: 1 }); + if (PHPRuntimeId !== undefined) { + this.initializeRuntime(PHPRuntimeId); + } + } + addEventListener(eventType, listener) { + if (!this.#eventListeners.has(eventType)) { + this.#eventListeners.set(eventType, new Set()); + } + this.#eventListeners.get(eventType).add(listener); + } + removeEventListener(eventType, listener) { + this.#eventListeners.get(eventType)?.delete(listener); + } + dispatchEvent(event) { + const listeners = this.#eventListeners.get(event.type); + if (!listeners) { + return; + } + for (const listener of listeners) { + listener(event); + } + } + onMessage(listener) { + this.#messageListeners.push(listener); + } + async setSpawnHandler(handler) { + if (typeof handler === 'string') { + handler = createSpawnHandler(eval(handler)); + } + this[__private__dont__use].spawnProcess = handler; + } + get absoluteUrl() { + return this.requestHandler.absoluteUrl; + } + get documentRoot() { + return this.requestHandler.documentRoot; + } + pathToInternalUrl(path) { + return this.requestHandler.pathToInternalUrl(path); + } + internalUrlToPath(internalUrl) { + return this.requestHandler.internalUrlToPath(internalUrl); + } + initializeRuntime(runtimeId) { + if (this[__private__dont__use]) { + throw new Error('PHP runtime already initialized.'); + } + const runtime = getLoadedRuntime(runtimeId); + if (!runtime) { + throw new Error('Invalid PHP runtime id.'); + } + this[__private__dont__use] = runtime; + this[__private__dont__use].ccall( + 'wasm_set_phpini_path', + null, + ['string'], + [PHP_INI_PATH] + ); + if (!this.fileExists(PHP_INI_PATH)) { + this.writeFile( + PHP_INI_PATH, + [ + 'auto_prepend_file=' + AUTO_PREPEND_SCRIPT, + 'memory_limit=256M', + 'ignore_repeated_errors = 1', + 'error_reporting = E_ALL', + 'display_errors = 1', + 'html_errors = 1', + 'display_startup_errors = On', + 'log_errors = 1', + 'always_populate_raw_post_data = -1', + 'upload_max_filesize = 2000M', + 'post_max_size = 2000M', + 'disable_functions = curl_exec,curl_multi_exec', + 'allow_url_fopen = Off', + 'allow_url_include = Off', + 'session.save_path = /home/web_user', + 'implicit_flush = 1', + 'output_buffering = 0', + 'max_execution_time = 0', + 'max_input_time = -1', + ].join('\n') + ); + } + if (!this.fileExists(AUTO_PREPEND_SCRIPT)) { + this.writeFile( + AUTO_PREPEND_SCRIPT, + ` \$value) { + if (!defined(\$const) && is_scalar(\$value)) { + define(\$const, \$value); + } + } + } + // Preload all the files from /internal/shared/preload + foreach (glob('/internal/shared/preload/*.php') as \$file) { + require_once \$file; + } + ` + ); + } + runtime['onMessage'] = async (data) => { + for (const listener of this.#messageListeners) { + const returnData = await listener(data); + if (returnData) { + return returnData; + } + } + return ''; + }; + this.#wasmErrorsTarget = improveWASMErrorReporting(runtime); + this.dispatchEvent({ + type: 'runtime.initialized', + }); + } + async setSapiName(newName) { + const result = this[__private__dont__use].ccall( + 'wasm_set_sapi_name', + NUMBER, + [STRING], + [newName] + ); + if (result !== 0) { + throw new Error( + 'Could not set SAPI name. This can only be done before the PHP WASM module is initialized.Did you already dispatch any requests?' + ); + } + this.#sapiName = newName; + } + chdir(path) { + this[__private__dont__use].FS.chdir(path); + } + async request(request3) { + logger3.warn( + 'PHP.request() is deprecated. Please use new PHPRequestHandler() instead.' + ); + if (!this.requestHandler) { + throw new Error('No request handler available.'); + } + return this.requestHandler.request(request3); + } + async run(request3) { + console.log('PHP run', request3); + const release = await this.semaphore.acquire(); + let heapBodyPointer; + try { + if (!this.#webSapiInitialized) { + this.#initWebRuntime(); + this.#webSapiInitialized = true; + } + if (request3.scriptPath && !this.fileExists(request3.scriptPath)) { + throw new Error( + `The script path "${request3.scriptPath}" does not exist.` + ); + } + this.#setRelativeRequestUri(request3.relativeUri || ''); + this.#setRequestMethod(request3.method || 'GET'); + const headers = normalizeHeaders(request3.headers || {}); + const host = headers['host'] || 'example.com:443'; + const port = this.#inferPortFromHostAndProtocol( + host, + request3.protocol || 'http' + ); + this.#setRequestHost(host); + this.#setRequestPort(port); + this.#setRequestHeaders(headers); + if (request3.body) { + heapBodyPointer = this.#setRequestBody(request3.body); + } + if (typeof request3.code === 'string') { + this.writeFile('/internal/eval.php', request3.code); + this.#setScriptPath('/internal/eval.php'); + } else { + this.#setScriptPath(request3.scriptPath || ''); + } + const $_SERVER = this.#prepareServerEntries( + request3.$_SERVER, + headers, + port + ); + for (const key in $_SERVER) { + this.#setServerGlobalEntry(key, $_SERVER[key]); + } + const env = request3.env || {}; + for (const key in env) { + this.#setEnv(key, env[key]); + } + const response = await this.#handleRequest(); + if (response.exitCode !== 0) { + logger3.warn(`PHP.run() output was:`, response.text); + const error = new PHPExecutionFailureError( + `PHP.run() failed with exit code ${response.exitCode} and the following output: ` + + response.errors, + response, + 'request' + ); + logger3.error(error); + throw error; + } + return response; + } catch (e) { + this.dispatchEvent({ + type: 'request.error', + error: e, + source: e.source ?? 'php-wasm', + }); + throw e; + } finally { + try { + if (heapBodyPointer) { + this[__private__dont__use].free(heapBodyPointer); + } + } finally { + release(); + this.dispatchEvent({ + type: 'request.end', + }); + } + } + } + #prepareServerEntries(defaults, headers, port) { + const $_SERVER = { + ...(defaults || {}), + }; + $_SERVER['HTTPS'] = $_SERVER['HTTPS'] || port === 443 ? 'on' : 'off'; + for (const name in headers) { + let HTTP_prefix = 'HTTP_'; + if ( + ['content-type', 'content-length'].includes(name.toLowerCase()) + ) { + HTTP_prefix = ''; + } + $_SERVER[`${HTTP_prefix}${name.toUpperCase().replace(/-/g, '_')}`] = + headers[name]; + } + return $_SERVER; + } + #initWebRuntime() { + this[__private__dont__use].ccall('php_wasm_init', null, [], []); + } + #getResponseHeaders() { + const headersFilePath = '/internal/headers.json'; + if (!this.fileExists(headersFilePath)) { + throw new Error( + 'SAPI Error: Could not find response headers file.' + ); + } + const headersData = JSON.parse(this.readFileAsText(headersFilePath)); + const headers = {}; + for (const line of headersData.headers) { + if (!line.includes(': ')) { + continue; + } + const colonIndex = line.indexOf(': '); + const headerName = line.substring(0, colonIndex).toLowerCase(); + const headerValue = line.substring(colonIndex + 2); + if (!(headerName in headers)) { + headers[headerName] = []; + } + headers[headerName].push(headerValue); + } + return { + headers, + httpStatusCode: headersData.status, + }; + } + #setRelativeRequestUri(uri) { + this[__private__dont__use].ccall( + 'wasm_set_request_uri', + null, + [STRING], + [uri] + ); + if (uri.includes('?')) { + const queryString = uri.substring(uri.indexOf('?') + 1); + this[__private__dont__use].ccall( + 'wasm_set_query_string', + null, + [STRING], + [queryString] + ); + } + } + #setRequestHost(host) { + this[__private__dont__use].ccall( + 'wasm_set_request_host', + null, + [STRING], + [host] + ); + } + #setRequestPort(port) { + this[__private__dont__use].ccall( + 'wasm_set_request_port', + null, + [NUMBER], + [port] + ); + } + #inferPortFromHostAndProtocol(host, protocol) { + let port; + try { + port = parseInt(new URL(host).port, 10); + } catch (e) {} + if (!port || isNaN(port) || port === 80) { + port = protocol === 'https' ? 443 : 80; + } + return port; + } + #setRequestMethod(method) { + this[__private__dont__use].ccall( + 'wasm_set_request_method', + null, + [STRING], + [method] + ); + } + #setRequestHeaders(headers) { + if (headers['cookie']) { + this[__private__dont__use].ccall( + 'wasm_set_cookies', + null, + [STRING], + [headers['cookie']] + ); + } + if (headers['content-type']) { + this[__private__dont__use].ccall( + 'wasm_set_content_type', + null, + [STRING], + [headers['content-type']] + ); + } + if (headers['content-length']) { + this[__private__dont__use].ccall( + 'wasm_set_content_length', + null, + [NUMBER], + [parseInt(headers['content-length'], 10)] + ); + } + } + #setRequestBody(body) { + let size, contentLength; + if (typeof body === 'string') { + logger3.warn( + 'Passing a string as the request body is deprecated. Please use a Uint8Array instead. See https://github.com/WordPress/wordpress-playground/issues/997 for more details' + ); + contentLength = this[__private__dont__use].lengthBytesUTF8(body); + size = contentLength + 1; + } else { + contentLength = body.byteLength; + size = body.byteLength; + } + const heapBodyPointer = this[__private__dont__use].malloc(size); + if (!heapBodyPointer) { + throw new Error('Could not allocate memory for the request body.'); + } + if (typeof body === 'string') { + this[__private__dont__use].stringToUTF8( + body, + heapBodyPointer, + size + 1 + ); + } else { + this[__private__dont__use].HEAPU8.set(body, heapBodyPointer); + } + this[__private__dont__use].ccall( + 'wasm_set_request_body', + null, + [NUMBER], + [heapBodyPointer] + ); + this[__private__dont__use].ccall( + 'wasm_set_content_length', + null, + [NUMBER], + [contentLength] + ); + return heapBodyPointer; + } + #setScriptPath(path) { + this[__private__dont__use].ccall( + 'wasm_set_path_translated', + null, + [STRING], + [path] + ); + } + #setServerGlobalEntry(key, value) { + this[__private__dont__use].ccall( + 'wasm_add_SERVER_entry', + null, + [STRING, STRING], + [key, value] + ); + } + #setEnv(name, value) { + this[__private__dont__use].ccall( + 'wasm_add_ENV_entry', + null, + [STRING, STRING], + [name, value] + ); + } + defineConstant(key, value) { + let consts = {}; + try { + consts = JSON.parse( + this.fileExists('/internal/shared/consts.json') + ? this.readFileAsText('/internal/shared/consts.json') || + '{}' + : '{}' + ); + } catch (e) {} + this.writeFile( + '/internal/shared/consts.json', + JSON.stringify({ + ...consts, + [key]: value, + }) + ); + } + async #handleRequest() { + let exitCode; + let errorListener; + try { + exitCode = await new Promise((resolve, reject) => { + errorListener = (e) => { + logger3.error(e); + logger3.error(e.error); + const rethrown = new Error('Rethrown'); + rethrown.cause = e.error; + rethrown.betterMessage = e.message; + reject(rethrown); + }; + this.#wasmErrorsTarget?.addEventListener( + 'error', + errorListener + ); + const response = this[__private__dont__use].ccall( + 'wasm_sapi_handle_request', + NUMBER, + [], + [], + { async: true } + ); + if (response instanceof Promise) { + return response.then(resolve, reject); + } + return resolve(response); + }); + } catch (e) { + for (const name in this) { + if (typeof this[name] === 'function') { + this[name] = () => { + throw new Error( + `PHP runtime has crashed \u2013 see the earlier error for details.` + ); + }; + } + } + this.functionsMaybeMissingFromAsyncify = + getFunctionsMaybeMissingFromAsyncify(); + const err = e; + const message = + 'betterMessage' in err ? err.betterMessage : err.message; + const rethrown = new Error(message); + rethrown.cause = err; + logger3.error(rethrown); + throw rethrown; + } finally { + this.#wasmErrorsTarget?.removeEventListener('error', errorListener); + } + const { headers, httpStatusCode } = this.#getResponseHeaders(); + return new PHPResponse( + exitCode === 0 ? httpStatusCode : 500, + headers, + this.readFileAsBuffer('/internal/stdout'), + this.readFileAsText('/internal/stderr'), + exitCode + ); + } + mkdir(path) { + return FSHelpers.mkdir(this[__private__dont__use].FS, path); + } + mkdirTree(path) { + return FSHelpers.mkdir(this[__private__dont__use].FS, path); + } + readFileAsText(path) { + return FSHelpers.readFileAsText(this[__private__dont__use].FS, path); + } + readFileAsBuffer(path) { + return FSHelpers.readFileAsBuffer(this[__private__dont__use].FS, path); + } + writeFile(path, data) { + return FSHelpers.writeFile(this[__private__dont__use].FS, path, data); + } + unlink(path) { + return FSHelpers.unlink(this[__private__dont__use].FS, path); + } + mv(fromPath, toPath) { + return FSHelpers.mv(this[__private__dont__use].FS, fromPath, toPath); + } + rmdir(path, options = { recursive: true }) { + return FSHelpers.rmdir(this[__private__dont__use].FS, path, options); + } + listFiles(path, options = { prependPath: false }) { + return FSHelpers.listFiles( + this[__private__dont__use].FS, + path, + options + ); + } + isDir(path) { + return FSHelpers.isDir(this[__private__dont__use].FS, path); + } + fileExists(path) { + return FSHelpers.fileExists(this[__private__dont__use].FS, path); + } + hotSwapPHPRuntime(runtime, cwd) { + const oldFS = this[__private__dont__use].FS; + try { + this.exit(); + } catch (e) {} + this.initializeRuntime(runtime); + if (this.#sapiName) { + this.setSapiName(this.#sapiName); + } + if (cwd) { + copyFS(oldFS, this[__private__dont__use].FS, cwd); + } + } + async mount(virtualFSPath, mountHandler) { + return await mountHandler( + this, + this[__private__dont__use].FS, + virtualFSPath + ); + } + async cli(argv) { + for (const arg of argv) { + this[__private__dont__use].ccall( + 'wasm_add_cli_arg', + null, + [STRING], + [arg] + ); + } + try { + return await this[__private__dont__use].ccall( + 'run_cli', + null, + [], + [], + { + async: true, + } + ); + } catch (error) { + if (isExitCodeZero(error)) { + return 0; + } + throw error; + } + } + setSkipShebang(shouldSkip) { + this[__private__dont__use].ccall( + 'wasm_set_skip_shebang', + null, + [NUMBER], + [shouldSkip ? 1 : 0] + ); + } + exit(code = 0) { + this.dispatchEvent({ + type: 'runtime.beforedestroy', + }); + try { + this[__private__dont__use]._exit(code); + } catch (e) {} + this.#webSapiInitialized = false; + this.#wasmErrorsTarget = null; + delete this[__private__dont__use]['onMessage']; + delete this[__private__dont__use]; + } + [Symbol.dispose]() { + if (this.#webSapiInitialized) { + this.exit(0); + } + } +} + +// ../../php-wasm/universal/src/lib/ini.ts +var import_ini = __toESM(require_ini(), 1); +async function setPhpIniEntries(php2, entries) { + const ini = import_ini.parse(await php2.readFileAsText(PHP_INI_PATH)); + for (const [key, value] of Object.entries(entries)) { + if (value === undefined || value === null) { + delete ini[key]; + } else { + ini[key] = value; + } + } + await php2.writeFile(PHP_INI_PATH, import_ini.stringify(ini)); +} +async function withPHPIniValues(php2, phpIniValues, callback) { + const iniBefore = await php2.readFileAsText(PHP_INI_PATH); + try { + await setPhpIniEntries(php2, phpIniValues); + return await callback(); + } finally { + await php2.writeFile(PHP_INI_PATH, iniBefore); + } +} +// ../../php-wasm/universal/src/lib/http-cookie-store.ts +class HttpCookieStore { + cookies = {}; + rememberCookiesFromResponseHeaders(headers) { + if (!headers?.['set-cookie']) { + return; + } + for (const setCookie of headers['set-cookie']) { + try { + if (!setCookie.includes('=')) { + continue; + } + const equalsIndex = setCookie.indexOf('='); + const name = setCookie.substring(0, equalsIndex); + const value = setCookie + .substring(equalsIndex + 1) + .split(';')[0]; + this.cookies[name] = value; + } catch (e) { + logger3.error(e); + } + } + } + getCookieRequestHeader() { + const cookiesArray = []; + for (const name in this.cookies) { + cookiesArray.push(`${name}=${this.cookies[name]}`); + } + return cookiesArray.join('; '); + } +} +// ../../php-wasm/stream-compression/src/utils/iterable-stream-polyfill.ts +if (!ReadableStream.prototype[Symbol.asyncIterator]) { + ReadableStream.prototype[Symbol.asyncIterator] = async function* () { + const reader = this.getReader(); + try { + while (true) { + const { done, value } = await reader.read(); + if (done) { + return; + } + yield value; + } + } finally { + reader.releaseLock(); + } + }; + ReadableStream.prototype.iterate = + ReadableStream.prototype[Symbol.asyncIterator]; +} +// ../../php-wasm/stream-compression/src/zip/decode-remote-zip.ts +var fetchSemaphore = new Semaphore({ concurrency: 10 }); +// ../../php-wasm/universal/src/lib/php-process-manager.ts +class MaxPhpInstancesError extends Error { + constructor(limit) { + super( + `Requested more concurrent PHP instances than the limit (${limit}).` + ); + this.name = this.constructor.name; + } +} + +class PHPProcessManager { + primaryPhp; + primaryIdle = true; + nextInstance = null; + allInstances = []; + phpFactory; + maxPhpInstances; + semaphore; + constructor(options) { + this.maxPhpInstances = options?.maxPhpInstances ?? 5; + this.phpFactory = options?.phpFactory; + this.primaryPhp = options?.primaryPhp; + this.semaphore = new Semaphore({ + concurrency: this.maxPhpInstances, + timeout: options?.timeout || 5000, + }); + } + async getPrimaryPhp() { + if (!this.phpFactory && !this.primaryPhp) { + throw new Error( + 'phpFactory or primaryPhp must be set before calling getPrimaryPhp().' + ); + } else if (!this.primaryPhp) { + const spawned = await this.spawn({ isPrimary: true }); + this.primaryPhp = spawned.php; + } + return this.primaryPhp; + } + async acquirePHPInstance() { + if (this.primaryIdle) { + this.primaryIdle = false; + return { + php: await this.getPrimaryPhp(), + reap: () => (this.primaryIdle = true), + }; + } + const spawnedPhp = + this.nextInstance || this.spawn({ isPrimary: false }); + if (this.semaphore.remaining > 0) { + this.nextInstance = this.spawn({ isPrimary: false }); + } else { + this.nextInstance = null; + } + return await spawnedPhp; + } + spawn(factoryArgs) { + if (factoryArgs.isPrimary && this.allInstances.length > 0) { + throw new Error( + 'Requested spawning a primary PHP instance when another primary instance already started spawning.' + ); + } + const spawned = this.doSpawn(factoryArgs); + this.allInstances.push(spawned); + const pop = () => { + this.allInstances = this.allInstances.filter( + (instance) => instance !== spawned + ); + }; + return spawned + .catch((rejection) => { + pop(); + throw rejection; + }) + .then((result) => ({ + ...result, + reap: () => { + pop(); + result.reap(); + }, + })); + } + async doSpawn(factoryArgs) { + let release; + try { + release = await this.semaphore.acquire(); + } catch (error) { + if (error instanceof AcquireTimeoutError) { + throw new MaxPhpInstancesError(this.maxPhpInstances); + } + throw error; + } + try { + const php2 = await this.phpFactory(factoryArgs); + return { + php: php2, + reap() { + php2.exit(); + release(); + }, + }; + } catch (e) { + release(); + throw e; + } + } + async [Symbol.asyncDispose]() { + if (this.primaryPhp) { + this.primaryPhp.exit(); + } + await Promise.all( + this.allInstances.map((instance) => + instance.then(({ reap }) => reap()) + ) + ); + } +} +// ../../php-wasm/universal/src/lib/supported-php-versions.ts +var SupportedPHPVersions = [ + '8.3', + '8.2', + '8.1', + '8.0', + '7.4', + '7.3', + '7.2', + '7.1', + '7.0', +]; +var LatestSupportedPHPVersion = SupportedPHPVersions[0]; +// ../../php-wasm/universal/src/lib/urls.ts +function toRelativeUrl(url) { + return url.toString().substring(url.origin.length); +} +function removePathPrefix(path, prefix) { + if (!prefix || !path.startsWith(prefix)) { + return path; + } + return path.substring(prefix.length); +} +function ensurePathPrefix(path, prefix) { + if (!prefix || path.startsWith(prefix)) { + return path; + } + return prefix + path; +} +var DEFAULT_BASE_URL = 'http://example.com'; + +// ../../php-wasm/universal/src/lib/encode-as-multipart.ts +async function encodeAsMultipart(data) { + const boundary = `----${Math.random().toString(36).slice(2)}`; + const contentType = `multipart/form-data; boundary=${boundary}`; + const textEncoder = new TextEncoder(); + const parts = []; + for (const [name, value] of Object.entries(data)) { + parts.push(`--${boundary}\r\n`); + parts.push(`Content-Disposition: form-data; name="${name}"`); + if (value instanceof File) { + parts.push(`; filename="${value.name}"`); + } + parts.push(`\r\n`); + if (value instanceof File) { + parts.push(`Content-Type: application/octet-stream`); + parts.push(`\r\n`); + } + parts.push(`\r\n`); + if (value instanceof File) { + parts.push(await fileToUint8Array(value)); + } else { + parts.push(value); + } + parts.push(`\r\n`); + } + parts.push(`--${boundary}--\r\n`); + const length = parts.reduce((acc, part) => acc + part.length, 0); + const bytes = new Uint8Array(length); + let offset = 0; + for (const part of parts) { + bytes.set( + typeof part === 'string' ? textEncoder.encode(part) : part, + offset + ); + offset += part.length; + } + return { bytes, contentType }; +} +var fileToUint8Array = function (file) { + return new Promise((resolve) => { + const reader = new FileReader(); + reader.onload = () => { + resolve(new Uint8Array(reader.result)); + }; + reader.readAsArrayBuffer(file); + }); +}; +// ../../php-wasm/universal/src/lib/mime-types.json +var mime_types_default = { + _default: 'application/octet-stream', + '3gpp': 'video/3gpp', + '7z': 'application/x-7z-compressed', + asx: 'video/x-ms-asf', + atom: 'application/atom+xml', + avi: 'video/x-msvideo', + avif: 'image/avif', + bin: 'application/octet-stream', + bmp: 'image/x-ms-bmp', + cco: 'application/x-cocoa', + css: 'text/css', + data: 'application/octet-stream', + deb: 'application/octet-stream', + der: 'application/x-x509-ca-cert', + dmg: 'application/octet-stream', + doc: 'application/msword', + docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + eot: 'application/vnd.ms-fontobject', + flv: 'video/x-flv', + gif: 'image/gif', + gz: 'application/gzip', + hqx: 'application/mac-binhex40', + htc: 'text/x-component', + html: 'text/html', + ico: 'image/x-icon', + iso: 'application/octet-stream', + jad: 'text/vnd.sun.j2me.app-descriptor', + jar: 'application/java-archive', + jardiff: 'application/x-java-archive-diff', + jng: 'image/x-jng', + jnlp: 'application/x-java-jnlp-file', + jpg: 'image/jpeg', + jpeg: 'image/jpeg', + js: 'application/javascript', + json: 'application/json', + kml: 'application/vnd.google-earth.kml+xml', + kmz: 'application/vnd.google-earth.kmz', + m3u8: 'application/vnd.apple.mpegurl', + m4a: 'audio/x-m4a', + m4v: 'video/x-m4v', + md: 'text/plain', + mid: 'audio/midi', + mml: 'text/mathml', + mng: 'video/x-mng', + mov: 'video/quicktime', + mp3: 'audio/mpeg', + mp4: 'video/mp4', + mpeg: 'video/mpeg', + msi: 'application/octet-stream', + odg: 'application/vnd.oasis.opendocument.graphics', + odp: 'application/vnd.oasis.opendocument.presentation', + ods: 'application/vnd.oasis.opendocument.spreadsheet', + odt: 'application/vnd.oasis.opendocument.text', + ogg: 'audio/ogg', + otf: 'font/otf', + pdf: 'application/pdf', + pl: 'application/x-perl', + png: 'image/png', + ppt: 'application/vnd.ms-powerpoint', + pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + prc: 'application/x-pilot', + ps: 'application/postscript', + ra: 'audio/x-realaudio', + rar: 'application/x-rar-compressed', + rpm: 'application/x-redhat-package-manager', + rss: 'application/rss+xml', + rtf: 'application/rtf', + run: 'application/x-makeself', + sea: 'application/x-sea', + sit: 'application/x-stuffit', + svg: 'image/svg+xml', + swf: 'application/x-shockwave-flash', + tcl: 'application/x-tcl', + tar: 'application/x-tar', + tif: 'image/tiff', + ts: 'video/mp2t', + ttf: 'font/ttf', + txt: 'text/plain', + wasm: 'application/wasm', + wbmp: 'image/vnd.wap.wbmp', + webm: 'video/webm', + webp: 'image/webp', + wml: 'text/vnd.wap.wml', + wmlc: 'application/vnd.wap.wmlc', + wmv: 'video/x-ms-wmv', + woff: 'font/woff', + woff2: 'font/woff2', + xhtml: 'application/xhtml+xml', + xls: 'application/vnd.ms-excel', + xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + xml: 'text/xml', + xpi: 'application/x-xpinstall', + xspf: 'application/xspf+xml', + zip: 'application/zip', +}; + +// ../../php-wasm/universal/src/lib/php-request-handler.ts +var inferMimeType = function (path) { + const extension = path.split('.').pop(); + return mime_types_default[extension] || mime_types_default['_default']; +}; +function seemsLikeAPHPRequestHandlerPath(path) { + return seemsLikeAPHPFile(path) || seemsLikeADirectoryRoot(path); +} +var seemsLikeAPHPFile = function (path) { + return path.endsWith('.php') || path.includes('.php/'); +}; +var seemsLikeADirectoryRoot = function (path) { + const lastSegment = path.split('/').pop(); + return !lastSegment.includes('.'); +}; +function applyRewriteRules(path, rules) { + for (const rule of rules) { + if (new RegExp(rule.match).test(path)) { + return path.replace(rule.match, rule.replacement); + } + } + return path; +} + +class PHPRequestHandler { + #DOCROOT; + #PROTOCOL; + #HOSTNAME; + #PORT; + #HOST; + #PATHNAME; + #ABSOLUTE_URL; + #cookieStore; + rewriteRules; + processManager; + constructor(config) { + const { + documentRoot = '/www/', + absoluteUrl = typeof location === 'object' ? location?.href : '', + rewriteRules = [], + } = config; + if ('processManager' in config) { + this.processManager = config.processManager; + } else { + this.processManager = new PHPProcessManager({ + phpFactory: async (info) => { + const php3 = await config.phpFactory({ + ...info, + requestHandler: this, + }); + php3.requestHandler = this; + return php3; + }, + maxPhpInstances: config.maxPhpInstances, + }); + } + this.#cookieStore = new HttpCookieStore(); + this.#DOCROOT = documentRoot; + const url = new URL(absoluteUrl); + this.#HOSTNAME = url.hostname; + this.#PORT = url.port + ? Number(url.port) + : url.protocol === 'https:' + ? 443 + : 80; + this.#PROTOCOL = (url.protocol || '').replace(':', ''); + const isNonStandardPort = this.#PORT !== 443 && this.#PORT !== 80; + this.#HOST = [ + this.#HOSTNAME, + isNonStandardPort ? `:${this.#PORT}` : '', + ].join(''); + this.#PATHNAME = url.pathname.replace(/\/+$/, ''); + this.#ABSOLUTE_URL = [ + `${this.#PROTOCOL}://`, + this.#HOST, + this.#PATHNAME, + ].join(''); + this.rewriteRules = rewriteRules; + } + async getPrimaryPhp() { + return await this.processManager.getPrimaryPhp(); + } + pathToInternalUrl(path) { + return `${this.absoluteUrl}${path}`; + } + internalUrlToPath(internalUrl) { + const url = new URL(internalUrl); + if (url.pathname.startsWith(this.#PATHNAME)) { + url.pathname = url.pathname.slice(this.#PATHNAME.length); + } + return toRelativeUrl(url); + } + get absoluteUrl() { + return this.#ABSOLUTE_URL; + } + get documentRoot() { + return this.#DOCROOT; + } + async request(request3) { + const isAbsolute = + request3.url.startsWith('http://') || + request3.url.startsWith('https://'); + const requestedUrl = new URL( + request3.url.split('#')[0], + isAbsolute ? undefined : DEFAULT_BASE_URL + ); + const normalizedRequestedPath = applyRewriteRules( + removePathPrefix( + decodeURIComponent(requestedUrl.pathname), + this.#PATHNAME + ), + this.rewriteRules + ); + const fsPath = joinPaths(this.#DOCROOT, normalizedRequestedPath); + if (!seemsLikeAPHPRequestHandlerPath(fsPath)) { + return this.#serveStaticFile( + await this.processManager.getPrimaryPhp(), + fsPath + ); + } + return this.#spawnPHPAndDispatchRequest(request3, requestedUrl); + } + #serveStaticFile(php3, fsPath) { + if (!php3.fileExists(fsPath)) { + return new PHPResponse( + 404, + { + 'x-file-type': ['static'], + }, + new TextEncoder().encode('404 File not found') + ); + } + const arrayBuffer = php3.readFileAsBuffer(fsPath); + return new PHPResponse( + 200, + { + 'content-length': [`${arrayBuffer.byteLength}`], + 'content-type': [inferMimeType(fsPath)], + 'accept-ranges': ['bytes'], + 'cache-control': ['public, max-age=0'], + }, + arrayBuffer + ); + } + async #spawnPHPAndDispatchRequest(request3, requestedUrl) { + let spawnedPHP = undefined; + try { + spawnedPHP = await this.processManager.acquirePHPInstance(); + } catch (e) { + if (e instanceof MaxPhpInstancesError) { + return PHPResponse.forHttpCode(502); + } else { + return PHPResponse.forHttpCode(500); + } + } + try { + return await this.#dispatchToPHP( + spawnedPHP.php, + request3, + requestedUrl + ); + } finally { + spawnedPHP.reap(); + } + } + async #dispatchToPHP(php3, request3, requestedUrl) { + let preferredMethod = 'GET'; + const headers = { + host: this.#HOST, + ...normalizeHeaders(request3.headers || {}), + cookie: this.#cookieStore.getCookieRequestHeader(), + }; + let body = request3.body; + if (typeof body === 'object' && !(body instanceof Uint8Array)) { + preferredMethod = 'POST'; + const { bytes, contentType } = await encodeAsMultipart(body); + body = bytes; + headers['content-type'] = contentType; + } + let scriptPath; + try { + scriptPath = this.#resolvePHPFilePath( + php3, + decodeURIComponent(requestedUrl.pathname) + ); + } catch (error) { + return PHPResponse.forHttpCode(404); + } + try { + const response = await php3.run({ + relativeUri: ensurePathPrefix( + toRelativeUrl(requestedUrl), + this.#PATHNAME + ), + protocol: this.#PROTOCOL, + method: request3.method || preferredMethod, + $_SERVER: { + REMOTE_ADDR: '127.0.0.1', + DOCUMENT_ROOT: this.#DOCROOT, + HTTPS: this.#ABSOLUTE_URL.startsWith('https://') + ? 'on' + : '', + }, + body, + scriptPath, + headers, + }); + this.#cookieStore.rememberCookiesFromResponseHeaders( + response.headers + ); + return response; + } catch (error) { + const executionError = error; + if (executionError?.response) { + return executionError.response; + } + throw error; + } + } + #resolvePHPFilePath(php3, requestedPath) { + let filePath = removePathPrefix(requestedPath, this.#PATHNAME); + filePath = applyRewriteRules(filePath, this.rewriteRules); + if (filePath.includes('.php')) { + filePath = filePath.split('.php')[0] + '.php'; + } else if (php3.isDir(`${this.#DOCROOT}${filePath}`)) { + if (!filePath.endsWith('/')) { + filePath = `${filePath}/`; + } + filePath = `${filePath}index.php`; + } else { + filePath = '/index.php'; + } + let resolvedFsPath = `${this.#DOCROOT}${filePath}`; + if (!php3.fileExists(resolvedFsPath)) { + resolvedFsPath = `${this.#DOCROOT}/index.php`; + } + if (php3.fileExists(resolvedFsPath)) { + return resolvedFsPath; + } + throw new Error(`File not found: ${resolvedFsPath}`); + } +} +// ../../php-wasm/universal/src/lib/rotate-php-runtime.ts +function rotatePHPRuntime({ + php: php3, + cwd, + recreateRuntime, + maxRequests = 400, +}) { + let handledCalls = 0; + async function rotateRuntime() { + if (++handledCalls < maxRequests) { + return; + } + handledCalls = 0; + const release = await php3.semaphore.acquire(); + try { + php3.hotSwapPHPRuntime(await recreateRuntime(), cwd); + } finally { + release(); + } + } + php3.addEventListener('request.end', rotateRuntime); + return function () { + php3.removeEventListener('request.end', rotateRuntime); + }; +} +// ../../php-wasm/universal/src/lib/write-files.ts +async function writeFiles(php3, root, newFiles, { rmRoot = false } = {}) { + if (rmRoot) { + if (await php3.isDir(root)) { + await php3.rmdir(root, { recursive: true }); + } + } + for (const [relativePath, content] of Object.entries(newFiles)) { + const filePath = joinPaths(root, relativePath); + if (!(await php3.fileExists(dirname(filePath)))) { + await php3.mkdir(dirname(filePath)); + } + if (content instanceof Uint8Array || typeof content === 'string') { + await php3.writeFile(filePath, content); + } else { + await writeFiles(php3, filePath, content); + } + } +} +// ../../php-wasm/universal/src/lib/proxy-file-system.ts +function proxyFileSystem(sourceOfTruth, replica, paths) { + const __private__symbol = Object.getOwnPropertySymbols(sourceOfTruth)[0]; + for (const path of paths) { + if (!replica.fileExists(path)) { + replica.mkdir(path); + } + if (!sourceOfTruth.fileExists(path)) { + sourceOfTruth.mkdir(path); + } + replica[__private__symbol].FS.mount( + replica[__private__symbol].PROXYFS, + { + root: path, + fs: sourceOfTruth[__private__symbol].FS, + }, + path + ); + } +} +// ../blueprints/src/lib/compile.ts +var import_ajv = __toESM(require_ajv(), 1); +var { wpCLI: wpCLI2, ...otherStepHandlers } = exports_handlers; +var keyedStepHandlers = { + ...otherStepHandlers, + 'wp-cli': wpCLI2, + importFile: otherStepHandlers.importWxr, +}; +var ajv = new import_ajv.default({ discriminator: true }); +// ../wordpress/src/boot.ts +async function bootWordPress(options) { + async function createPhp(requestHandler2, isPrimary) { + const php4 = new PHP(await options.createPhpRuntime()); + if (options.sapiName) { + php4.setSapiName(options.sapiName); + } + if (requestHandler2) { + php4.requestHandler = requestHandler2; + } + if (options.phpIniEntries) { + setPhpIniEntries(php4, options.phpIniEntries); + } + if (isPrimary) { + await setupPlatformLevelMuPlugins(php4); + await writeFiles(php4, '/', options.createFiles || {}); + await preloadPhpInfoRoute( + php4, + joinPaths(new URL(options.siteUrl).pathname, 'phpinfo.php') + ); + } else { + proxyFileSystem(await requestHandler2.getPrimaryPhp(), php4, [ + '/tmp', + requestHandler2.documentRoot, + '/internal/shared', + ]); + } + if (options.spawnHandler) { + await php4.setSpawnHandler( + options.spawnHandler(requestHandler2.processManager) + ); + } + rotatePHPRuntime({ + php: php4, + cwd: requestHandler2.documentRoot, + recreateRuntime: options.createPhpRuntime, + maxRequests: 400, + }); + return php4; + } + const requestHandler = new PHPRequestHandler({ + phpFactory: async ({ isPrimary }) => + createPhp(requestHandler, isPrimary), + documentRoot: options.documentRoot || '/wordpress', + absoluteUrl: options.siteUrl, + rewriteRules: wordPressRewriteRules, + }); + const php3 = await requestHandler.getPrimaryPhp(); + if (options.hooks?.beforeWordPressFiles) { + await options.hooks.beforeWordPressFiles(php3); + } + if (options.wordPressZip) { + await unzipWordPress(php3, await options.wordPressZip); + } + if (options.constants) { + for (const key in options.constants) { + php3.defineConstant(key, options.constants[key]); + } + } + php3.defineConstant('WP_HOME', options.siteUrl); + php3.defineConstant('WP_SITEURL', options.siteUrl); + if (options.hooks?.beforeDatabaseSetup) { + await options.hooks.beforeDatabaseSetup(php3); + } + if (options.sqliteIntegrationPluginZip) { + await preloadSqliteIntegration( + php3, + await options.sqliteIntegrationPluginZip + ); + } + if (!(await isWordPressInstalled(php3))) { + await installWordPress(php3); + } + if (!(await isWordPressInstalled(php3))) { + throw new Error('WordPress installation has failed.'); + } + return requestHandler; +} +async function isWordPressInstalled(php3) { + return ( + ( + await php3.run({ + code: ` + await php3.request({ + url: '/wp-admin/install.php?step=2', + method: 'POST', + body: { + language: 'en', + prefix: 'wp_', + weblog_title: 'My WordPress Website', + user_name: 'admin', + admin_password: 'password', + admin_password2: 'password', + Submit: 'Install WordPress', + pw_weak: '1', + admin_email: 'admin@localhost.com', + }, + }) + ); +} +// ../wordpress/src/rewrite-rules.ts +var wordPressRewriteRules = [ + { + match: /^\/(.*?)(\/wp-(content|admin|includes)\/.*)/g, + replacement: '$2', + }, +]; + +// ../wordpress/src/index.ts +async function setupPlatformLevelMuPlugins(php3) { + await php3.mkdir('/internal/shared/mu-plugins'); + await php3.writeFile( + '/internal/shared/preload/env.php', + ` \$function_to_add, 'accepted_args' => \$accepted_args); + } + function playground_add_action( \$tag, \$function_to_add, \$priority = 10, \$accepted_args = 1 ) { + playground_add_filter( \$tag, \$function_to_add, \$priority, \$accepted_args ); + } + + // Load our mu-plugins after customer mu-plugins + // NOTE: this means our mu-plugins can't use the muplugins_loaded action! + playground_add_action( 'muplugins_loaded', 'playground_load_mu_plugins', 0 ); + function playground_load_mu_plugins() { + // Load all PHP files from /internal/shared/mu-plugins, sorted by filename + \$mu_plugins_dir = '/internal/shared/mu-plugins'; + if(!is_dir(\$mu_plugins_dir)){ + return; + } + \$mu_plugins = glob( \$mu_plugins_dir . '/*.php' ); + sort( \$mu_plugins ); + foreach ( \$mu_plugins as \$mu_plugin ) { + require_once \$mu_plugin; + } + } + ` + ); + await php3.writeFile( + '/internal/shared/mu-plugins/0-playground.php', + `` + ); + await php3.writeFile( + '/internal/shared/preload/error-handler.php', + ` + * Warning: strtotime(): Epoch doesn't fit in a PHP integer in + */ + if (strpos(\$message, "fit in a PHP integer") !== false) { + return; + } + /** + * Playground defines some constants upfront, and some of them may be redefined + * in wp-config.php. For example, SITE_URL or WP_DEBUG. This is expected and + * we want Playground constants to take priority without showing warnings like: + * + * Warning: Constant SITE_URL already defined in + */ + if (strpos(\$message, "already defined") !== false) { + foreach(\$playground_consts as \$const) { + if(strpos(\$message, "Constant \$const already defined") !== false) { + return; + } + } + } + /** + * Don't complain about network errors when not connected to the network. + */ + if ( + ( + ! defined('USE_FETCH_FOR_REQUESTS') || + ! USE_FETCH_FOR_REQUESTS + ) && + strpos(\$message, "WordPress could not establish a secure connection to WordPress.org") !== false) + { + return; + } + return false; + }); + })();` + ); +} +async function preloadPhpInfoRoute(php3, requestPath = '/phpinfo.php') { + await php3.writeFile( + '/internal/shared/preload/phpinfo.php', + ``; + const SQLITE_MUPLUGIN_PATH = + '/internal/shared/mu-plugins/sqlite-database-integration.php'; + await php3.writeFile(SQLITE_MUPLUGIN_PATH, stopIfDbPhpExists + dbPhp); + await php3.writeFile( + `/internal/shared/preload/0-sqlite.php`, + stopIfDbPhpExists + + `load_sqlite_integration(); + if($GLOBALS['wpdb'] === $this) { + throw new Exception('Infinite loop detected in $wpdb \u2013 SQLite integration plugin could not be loaded'); + } + return call_user_func_array( + array($GLOBALS['wpdb'], $name), + $arguments + ); + } + public function __get($name) { + $this->load_sqlite_integration(); + if($GLOBALS['wpdb'] === $this) { + throw new Exception('Infinite loop detected in $wpdb \u2013 SQLite integration plugin could not be loaded'); + } + return $GLOBALS['wpdb']->$name; + } + public function __set($name, $value) { + $this->load_sqlite_integration(); + if($GLOBALS['wpdb'] === $this) { + throw new Exception('Infinite loop detected in $wpdb \u2013 SQLite integration plugin could not be loaded'); + } + $GLOBALS['wpdb']->$name = $value; + } + protected function load_sqlite_integration() { + require_once ${phpVar(SQLITE_MUPLUGIN_PATH)}; + } +} +\$wpdb = \$GLOBALS['wpdb'] = new Playground_SQLite_Integration_Loader(); + +/** + * WordPress is capable of using a preloaded global \$wpdb. However, if + * it cannot find the drop-in db.php plugin it still checks whether + * the mysqli_connect() function exists even though it's not used. + * + * What WordPress demands, Playground shall provide. + */ +if(!function_exists('mysqli_connect')) { + function mysqli_connect() {} +} + + ` + ); + await php3.writeFile( + `/internal/shared/mu-plugins/sqlite-test.php`, + ` { + iframe.addEventListener('load', resolve); + }); + setTimeout(() => { + document.body.removeChild(iframe); + }, 1e4); +} +var emptyHtml = function () { + return new Response( + '', + { + status: 200, + headers: { + 'content-type': 'text/html', + }, + } + ); +}; +async function bootServiceWorker() { + const isServiceWorkerRegistered = ( + await fetch(`${LOOPBACK_SW_URL}/test.html`) + ).ok; + if (!isServiceWorkerRegistered) { + const iframe = document.querySelector( + '#playground-remote-service-worker' + ); + iframe.src = `${LOOPBACK_SW_URL}/register.html`; + await new Promise((resolve) => { + iframe.addEventListener('load', resolve); + }); + } +} +async function bootWorker() { + const [wordPressZip, sqliteIntegrationPluginZip] = await Promise.all([ + readFileFromCurrentExtension('wordpress-6.5.4.zip'), + readFileFromCurrentExtension('sqlite-database-integration.zip'), + ]); + const requestHandler = await bootWordPress({ + siteUrl: LOOPBACK_SW_URL, + createPhpRuntime: async () => { + const phpModule = await import('./php_8_0.js'); + return await loadPHPRuntime(phpModule, { + ...fakeWebsocket(), + }); + }, + wordPressZip, + sqliteIntegrationPluginZip, + sapiName: 'cli', + phpIniEntries: { + allow_url_fopen: '0', + disable_functions: '', + }, + }); + const url = LOOPBACK_SW_URL; + const primaryPHP = await requestHandler.getPrimaryPhp(); + primaryPHP.defineConstant('WP_HOME', url); + primaryPHP.defineConstant('WP_SITEURL', url); + primaryPHP.mkdir('/wordpress/wp-content/plugins/playground-editor'); + await installPlugin(primaryPHP, { + pluginZipFile: new File( + [await (await fetch('blocky-formats.zip')).blob()], + 'blocky-formats.zip' + ), + options: { + activate: false, + }, + }); + await login(primaryPHP, {}); + primaryPHP.writeFile( + '/wordpress/wp-content/plugins/playground-editor/script.js', + await (await fetch('wordpress-plugin/script.js')).text() + ); + primaryPHP.writeFile( + '/wordpress/wp-content/plugins/playground-editor/index.php', + await (await fetch('wordpress-plugin/index.php')).text() + ); + await activatePlugin(primaryPHP, { + pluginPath: 'playground-editor/index.php', + }); + return requestHandler; +} +async function readFileFromCurrentExtension(path) { + const response = await fetch(path); + return new File([await response.blob()], path); +} +var requestHandler = bootWorker(); +var swReady = bootServiceWorker(); +prerenderEditor(); +var cache = await caches.open('v1.1'); +var putInCache = async (request3, response) => { + await cache.put(request3, response); +}; +var iframe = document.querySelector('#playground-remote-service-worker'); +window.addEventListener('message', async (event) => { + if (event.data.type === 'playground-extension-sw-message') { + if (event.data.data.method === 'request') { + const phpRequest = event.data.data.args[0]; + const requestUrl = new URL(phpRequest.url); + requestUrl.searchParams.delete('_ajax_nonce'); + if (requestUrl.pathname.endsWith('/empty.html')) { + iframe.contentWindow.postMessage( + responseTo(event.data.requestId, { + bytes: await emptyHtml().arrayBuffer(), + headers: { + 'content-type': ['text/html'], + }, + httpStatusCode: 200, + }), + '*' + ); + return; + } + const request3 = new Request(requestUrl.toString(), { + method: event.data.data.args[0].method, + }); + const response = await cache.match(request3); + let phpResponse = undefined; + if (!response) { + phpResponse = await ( + await requestHandler + ).request(event.data.data.args[0]); + if ( + requestUrl.pathname.endsWith( + '/wp-includes/js/dist/block-editor.js' + ) || + requestUrl.pathname.endsWith( + '/wp-includes/js/dist/block-editor.min.js' + ) || + requestUrl.pathname.endsWith( + '/build/block-editor/index.js' + ) || + requestUrl.pathname.endsWith( + '/build/block-editor/index.min.js' + ) + ) { + const script = new TextDecoder().decode( + await phpResponse.bytes + ); + const newScript = `${controlledIframe} ${script.replace( + /\(\s*"iframe",/, + '(__playground_ControlledIframe,' + )}`; + phpResponse.bytes = new TextEncoder().encode(newScript); + } + if ( + requestUrl.searchParams.has('rest_route') || + requestUrl.pathname.includes('wp-includes') + ) { + putInCache( + request3, + new Response(phpResponse.bytes, { + headers: phpResponse.headers, + status: phpResponse.httpStatusCode, + }) + ); + } + } + if (response && !phpResponse) { + const phpResponseHeaders = {}; + response.headers.forEach((value, key) => { + phpResponseHeaders[key.toLowerCase()] = [value]; + }); + phpResponse = { + bytes: await response.arrayBuffer(), + headers: phpResponseHeaders, + httpStatusCode: response.status, + }; + } + iframe.contentWindow.postMessage( + responseTo(event.data.requestId, phpResponse), + '*' + ); + } + } +}); +var controlledIframe = ` +window.__playground_ControlledIframe = window.wp.element.forwardRef(function (props, ref) { + const source = window.wp.element.useMemo(function () { + /** + * A synchronous function to read a blob URL as text. + * + * @param {string} url + * @returns {string} + */ + const __playground_readBlobAsText = function (url) { + try { + let xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.overrideMimeType('text/plain;charset=utf-8'); + xhr.send(); + return xhr.responseText; + } catch(e) { + return ''; + } finally { + URL.revokeObjectURL(url); + } + }; + if (props.srcDoc) { + // WordPress <= 6.2 uses a srcDoc that only contains a doctype. + return '/wp-includes/empty.html'; + } else if (props.src && props.src.startsWith('blob:')) { + // WordPress 6.3 uses a blob URL with doctype and a list of static assets. + // Let's pass the document content to empty.html and render it there. + return '/wp-includes/empty.html#' + encodeURIComponent(__playground_readBlobAsText(props.src)); + } else { + // WordPress >= 6.4 uses a plain HTTPS URL that needs no correction. + return props.src; + } + }, [props.src]); + return ( + window.wp.element.createElement('iframe', { + ...props, + ref: ref, + src: source, + // Make sure there's no srcDoc, as it would interfere with the src. + srcDoc: undefined + }) + ) +});`; +var fakeWebsocket = () => { + return { + websocket: { + decorator: (WebSocketConstructor) => { + return class FakeWebsocketConstructor extends WebSocketConstructor { + constructor() { + try { + super(); + } catch (e) {} + } + send() { + return null; + } + }; + }, + }, + }; +}; diff --git a/packages/edit-visually-browser-extension/src/playground-loader.ts b/packages/edit-visually-browser-extension/src/playground-loader.ts new file mode 100644 index 00000000..f0d7fb85 --- /dev/null +++ b/packages/edit-visually-browser-extension/src/playground-loader.ts @@ -0,0 +1,349 @@ +import { + activatePlugin, + installPlugin, + login, +} from '@wp-playground/blueprints'; +import { bootWordPress } from '@wp-playground/wordpress'; +import { PHPRequest, loadPHPRuntime } from '@php-wasm/universal'; +import { responseTo } from '@php-wasm/web-service-worker'; +import { LOOPBACK_SW_URL } from './config'; + +const requestHandler = bootWorker(); +const swReady = bootServiceWorker(); +prerenderEditor(); + +async function prerenderEditor() { + await requestHandler; + await swReady; + const iframe = document.createElement('iframe'); + iframe.src = `${LOOPBACK_SW_URL}/wp-admin/post-new.php`; + document.body.appendChild(iframe); + + await new Promise((resolve) => { + iframe.addEventListener('load', resolve); + }); + + setTimeout(() => { + document.body.removeChild(iframe); + }, 10000); +} + +const cache = await caches.open('v1.1'); +const putInCache = async (request, response) => { + await cache.put(request, response); +}; + +const iframe = document.querySelector( + '#playground-remote-service-worker' +) as any; + +// Super naive caching, let's use actual request caches instead +window.addEventListener('message', async (event) => { + if (event.data.type === 'playground-extension-sw-message') { + if (event.data.data.method === 'request') { + const phpRequest = event.data.data.args[0] as PHPRequest; + + const requestUrl = new URL(phpRequest.url); + requestUrl.searchParams.delete('_ajax_nonce'); + + if (requestUrl.pathname.endsWith('/empty.html')) { + iframe.contentWindow.postMessage( + responseTo(event.data.requestId, { + bytes: await emptyHtml().arrayBuffer(), + headers: { + 'content-type': ['text/html'], + }, + httpStatusCode: 200, + }), + '*' + ); + return; + } + + const request = new Request(requestUrl.toString(), { + method: event.data.data.args[0].method, + // Do not use headers or body as cache keys. We + // only need basic matching here. + }); + const response = await cache.match(request); + let phpResponse = undefined; + if (!response) { + phpResponse = await ( + await requestHandler + ).request(event.data.data.args[0]); + + // Path the block-editor.js file to ensure the site editor's iframe + // inherits the service worker. + // @see controlledIframe below for more details. + if ( + // WordPress Core version of block-editor.js + requestUrl.pathname.endsWith( + '/wp-includes/js/dist/block-editor.js' + ) || + requestUrl.pathname.endsWith( + '/wp-includes/js/dist/block-editor.min.js' + ) || + // Gutenberg version of block-editor.js + requestUrl.pathname.endsWith( + '/build/block-editor/index.js' + ) || + requestUrl.pathname.endsWith( + '/build/block-editor/index.min.js' + ) + ) { + const script = new TextDecoder().decode( + await phpResponse.bytes + ); + const newScript = `${controlledIframe} ${script.replace( + /\(\s*"iframe",/, + '(__playground_ControlledIframe,' + )}`; + (phpResponse as any).bytes = new TextEncoder().encode( + newScript + ); + } + + if ( + requestUrl.searchParams.has('rest_route') || + requestUrl.pathname.includes('wp-includes') + ) { + putInCache( + request, + new Response(phpResponse.bytes, { + headers: phpResponse.headers as any, + status: phpResponse.httpStatusCode, + }) + ); + } + } + + if (response && !phpResponse) { + const phpResponseHeaders: Record = {}; + response.headers.forEach((value, key) => { + phpResponseHeaders[key.toLowerCase()] = [value]; + }); + + phpResponse = { + bytes: await response.arrayBuffer(), + headers: phpResponseHeaders, + httpStatusCode: response.status, + }; + } + + iframe.contentWindow.postMessage( + responseTo(event.data.requestId, phpResponse), + '*' + ); + } + } +}); + +/** + * Pair the site editor's nested iframe to the Service Worker. + * + * Without the patch below, the site editor initiates network requests that + * aren't routed through the service worker. That's a known browser issue: + * + * * https://bugs.chromium.org/p/chromium/issues/detail?id=880768 + * * https://bugzilla.mozilla.org/show_bug.cgi?id=1293277 + * * https://github.com/w3c/ServiceWorker/issues/765 + * + * The problem with iframes using srcDoc and src="about:blank" as they + * fail to inherit the root site's service worker. + * + * Gutenberg loads the site editor using