diff --git a/UwBridge(uWS)/index.js b/UwBridge(uWS)/index.js deleted file mode 100644 index 4568bc15..00000000 --- a/UwBridge(uWS)/index.js +++ /dev/null @@ -1,43 +0,0 @@ -// npm install uNetworking/uWebSockets.js#v16.2.0 -const uWS = require('./uWebSockets.js.js'); -// uWebSockets.js is binary by default -const { StringDecoder } = require('string_decoder'); -const decoder = new StringDecoder('utf8'); -// an "app" is much like Express.js apps with URL routes, -// here we handle WebSocket traffic on the wildcard "/*" route -const app = uWS.App().ws('/*', { - // handle messages from client - message: (socket, message, isBinary) => { - // parse JSON and perform the action - if (isBinary) { - console.log('isBinary'); - } - const json = JSON.parse(decoder.write(Buffer.from(message))); - switch (json.action) { - case 'join': { - // subscribe to messages in said drawing room - socket.subscribe(json.room); - break; - } - case 'draw': { - // draw something in drawing room - app.publish(json.room, json.message); - break; - } - case 'leave': { - // unsubscribe from the said drawing room - socket.unsubscribe(json.room); - break; - } - default: { - console.log('NONE MATCHING WEBSOCKET'); - } - } - } -}); -// finally listen using the app on port 3000 -app.listen(3000, (listenSocket) => { - if (listenSocket) { - console.log('Listening to port 3000'); - } -}); diff --git a/UwBridge(uWS)/uWebSockets/LICENSE b/UwBridge(uWS)/uWebSockets/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/UwBridge(uWS)/uWebSockets/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/UwBridge(uWS)/uWebSockets/README.md b/UwBridge(uWS)/uWebSockets/README.md deleted file mode 100644 index f6f6499d..00000000 --- a/UwBridge(uWS)/uWebSockets/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# uWebSockets.js precompiled binaries -Automatically built from source by GitHub Actions. - -## Clarification of license - -Files in this "binaries" branch are all licensed under Apache License 2.0, despite some of them lacking a notice as per "APPENDIX: How to apply the Apache License to your work" of the Apache License 2.0. diff --git a/UwBridge(uWS)/uWebSockets/index.d.ts b/UwBridge(uWS)/uWebSockets/index.d.ts deleted file mode 100644 index fc3f3938..00000000 --- a/UwBridge(uWS)/uWebSockets/index.d.ts +++ /dev/null @@ -1,362 +0,0 @@ -/* - * Authored by Alex Hultman, 2018-2021. - * Intellectual property of third-party. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** Native type representing a raw uSockets struct us_listen_socket_t. - * Careful with this one, it is entirely unchecked and native so invalid usage will blow up. - */ -export interface us_listen_socket { - -} - -/** Native type representing a raw uSockets struct us_socket_t. - * Careful with this one, it is entirely unchecked and native so invalid usage will blow up. - */ -export interface us_socket { - -} - -/** Native type representing a raw uSockets struct us_socket_context_t. - * Used while upgrading a WebSocket manually. */ -export interface us_socket_context_t { - -} - -/** Recognized string types, things C++ can read and understand as strings. - * "String" does not have to mean "text", it can also be "binary". - * - * Ironically, JavaScript strings are the least performant of all options, to pass or receive to/from C++. - * This because we expect UTF-8, which is packed in 8-byte chars. JavaScript strings are UTF-16 internally meaning extra copies and reinterpretation are required. - * - * That's why all events pass data by ArrayBuffer and not JavaScript strings, as they allow zero-copy data passing. - * - * You can always do Buffer.from(arrayBuffer).toString(), but keeping things binary and as ArrayBuffer is preferred. - */ -export type RecognizedString = string | ArrayBuffer | Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array | Float64Array; - -/** A WebSocket connection that is valid from open to close event. - * Read more about this in the user manual. - */ -export interface WebSocket { - /** Sends a message. Make sure to check getBufferedAmount() before sending. Returns true for success, false for built up backpressure that will drain when time is given. - * Returning false does not mean nothing was sent, it only means backpressure was built up. This you can check by calling getBufferedAmount() afterwards. - * - * Make sure you properly understand the concept of backpressure. Check the backpressure example file. - */ - send(message: RecognizedString, isBinary?: boolean, compress?: boolean) : boolean; - - /** Returns the bytes buffered in backpressure. This is similar to the bufferedAmount property in the browser counterpart. - * Check backpressure example. - */ - getBufferedAmount() : number; - - /** Gracefully closes this WebSocket. Immediately calls the close handler. - * A WebSocket close message is sent with code and shortMessage. - */ - end(code?: number, shortMessage?: RecognizedString) : WebSocket; - - /** Forcefully closes this WebSocket. Immediately calls the close handler. - * No WebSocket close message is sent. - */ - close() : WebSocket; - - /** Sends a ping control message. Returns true on success in similar ways as WebSocket.send does (regarding backpressure). This helper function correlates to WebSocket::send(message, uWS::OpCode::PING, ...) in C++. */ - ping(message?: RecognizedString) : boolean; - - /** Subscribe to a topic in MQTT syntax. - * - * MQTT syntax includes things like "root/child/+/grandchild" where "+" is a - * wildcard and "root/#" where "#" is a terminating wildcard. - * - * Read more about MQTT. - */ - subscribe(topic: RecognizedString) : boolean; - - /** Unsubscribe from a topic. Returns true on success, if the WebSocket was subscribed. */ - unsubscribe(topic: RecognizedString) : boolean; - - /** Returns whether this websocket is subscribed to topic. */ - isSubscribed(topic: RecognizedString) : boolean; - - /** Returns a list of topics this websocket is subscribed to. */ - getTopics() : string[]; - - /** Publish a message to a topic in MQTT syntax. You cannot publish using wildcards, only fully specified topics. Just like with MQTT. - * - * "parent/child" kind of tree is allowed, but not "parent/#" kind of wildcard publishing. - * - * The pub/sub system does not guarantee order between what you manually send using WebSocket.send - * and what you publish using WebSocket.publish. WebSocket messages are perfectly atomic, but the order in which they appear can get scrambled if you mix the two sending functions on the same socket. - * This shouldn't matter in most applications. Order is guaranteed relative to other calls to WebSocket.publish. - * - * Also keep in mind that backpressure will be automatically managed with pub/sub, meaning some outgoing messages may be dropped if backpressure is greater than specified maxBackpressure. - */ - publish(topic: RecognizedString, message: RecognizedString, isBinary?: boolean, compress?: boolean) : boolean; - - /** See HttpResponse.cork. Takes a function in which the socket is corked (packing many sends into one single syscall/SSL block) */ - cork(cb: () => void) : void; - - /** Returns the remote IP address. Note that the returned IP is binary, not text. - * - * IPv4 is 4 byte long and can be converted to text by printing every byte as a digit between 0 and 255. - * IPv6 is 16 byte long and can be converted to text in similar ways, but you typically print digits in HEX. - * - * See getRemoteAddressAsText() for a text version. - */ - getRemoteAddress() : ArrayBuffer; - - /** Returns the remote IP address as text. See RecognizedString. */ - getRemoteAddressAsText() : ArrayBuffer; - - /** Arbitrary user data may be attached to this object. In C++ this is done by using getUserData(). */ - [key: string]: any; -} - -/** An HttpResponse is valid until either onAborted callback or any of the .end/.tryEnd calls succeed. You may attach user data to this object. */ -export interface HttpResponse { - /** Writes the HTTP status message such as "200 OK". - * This has to be called first in any response, otherwise - * it will be called automatically with "200 OK". - * - * If you want to send custom headers in a WebSocket - * upgrade response, you have to call writeStatus with - * "101 Switching Protocols" before you call writeHeader, - * otherwise your first call to writeHeader will call - * writeStatus with "200 OK" and the upgrade will fail. - * - * As you can imagine, we format outgoing responses in a linear - * buffer, not in a hash table. You can read about this in - * the user manual under "corking". - */ - writeStatus(status: RecognizedString) : HttpResponse; - /** Writes key and value to HTTP response. - * See writeStatus and corking. - */ - writeHeader(key: RecognizedString, value: RecognizedString) : HttpResponse; - /** Enters or continues chunked encoding mode. Writes part of the response. End with zero length write. */ - write(chunk: RecognizedString) : HttpResponse; - /** Ends this response by copying the contents of body. */ - end(body?: RecognizedString) : HttpResponse; - /** Ends this response, or tries to, by streaming appropriately sized chunks of body. Use in conjunction with onWritable. Returns tuple [ok, hasResponded].*/ - tryEnd(fullBodyOrChunk: RecognizedString, totalSize: number) : [boolean, boolean]; - - /** Immediately force closes the connection. Any onAborted callback will run. */ - close() : HttpResponse; - - /** Returns the global byte write offset for this response. Use with onWritable. */ - getWriteOffset() : number; - - /** Registers a handler for writable events. Continue failed write attempts in here. - * You MUST return true for success, false for failure. - * Writing nothing is always success, so by default you must return true. - */ - onWritable(handler: (offset: number) => boolean) : HttpResponse; - - /** Every HttpResponse MUST have an attached abort handler IF you do not respond - * to it immediately inside of the callback. Returning from an Http request handler - * without attaching (by calling onAborted) an abort handler is ill-use and will termiante. - * When this event emits, the response has been aborted and may not be used. */ - onAborted(handler: () => void) : HttpResponse; - - /** Handler for reading data from POST and such requests. You MUST copy the data of chunk if isLast is not true. We Neuter ArrayBuffers on return, making it zero length.*/ - onData(handler: (chunk: ArrayBuffer, isLast: boolean) => void) : HttpResponse; - - /** Returns the remote IP address in binary format (4 or 16 bytes). */ - getRemoteAddress() : ArrayBuffer; - - /** Returns the remote IP address as text. */ - getRemoteAddressAsText() : ArrayBuffer; - - /** Returns the remote IP address in binary format (4 or 16 bytes), as reported by the PROXY Protocol v2 compatible proxy. */ - getProxiedRemoteAddress() : ArrayBuffer; - - /** Returns the remote IP address as text, as reported by the PROXY Protocol v2 compatible proxy. */ - getProxiedRemoteAddressAsText() : ArrayBuffer; - - /** Corking a response is a performance improvement in both CPU and network, as you ready the IO system for writing multiple chunks at once. - * By default, you're corked in the immediately executing top portion of the route handler. In all other cases, such as when returning from - * await, or when being called back from an async database request or anything that isn't directly executing in the route handler, you'll want - * to cork before calling writeStatus, writeHeader or just write. Corking takes a callback in which you execute the writeHeader, writeStatus and - * such calls, in one atomic IO operation. This is important, not only for TCP but definitely for TLS where each write would otherwise result - * in one TLS block being sent off, each with one send syscall. - * - * Example usage: - * - * res.cork(() => { - * res.writeStatus("200 OK").writeHeader("Some", "Value").write("Hello world!"); - * }); - */ - cork(cb: () => void) : void; - - /** Upgrades a HttpResponse to a WebSocket. See UpgradeAsync, UpgradeSync example files. */ - upgrade(userData : T, secWebSocketKey: RecognizedString, secWebSocketProtocol: RecognizedString, secWebSocketExtensions: RecognizedString, context: us_socket_context_t) : void; - - /** Arbitrary user data may be attached to this object */ - [key: string]: any; -} - -/** An HttpRequest is stack allocated and only accessible during the callback invocation. */ -export interface HttpRequest { - /** Returns the lowercased header value or empty string. */ - getHeader(lowerCaseKey: RecognizedString) : string; - /** Returns the parsed parameter at index. Corresponds to route. */ - getParameter(index: number) : string; - /** Returns the URL including initial /slash */ - getUrl() : string; - /** Returns the HTTP method, useful for "any" routes. */ - getMethod() : string; - /** Returns the raw querystring (the part of URL after ? sign) or empty string. */ - getQuery() : string; - /** Returns a decoded query parameter value or empty string. */ - getQuery(key: string) : string; - /** Loops over all headers. */ - forEach(cb: (key: string, value: string) => void) : void; - /** Setting yield to true is to say that this route handler did not handle the route, causing the router to continue looking for a matching route handler, or fail. */ - setYield(yield: boolean) : HttpRequest; -} - -/** A structure holding settings and handlers for a WebSocket URL route handler. */ -export interface WebSocketBehavior { - /** Maximum length of received message. If a client tries to send you a message larger than this, the connection is immediately closed. Defaults to 16 * 1024. */ - maxPayloadLength?: number; - /** Maximum amount of seconds that may pass without sending or getting a message. Connection is closed if this timeout passes. Resolution (granularity) for timeouts are typically 4 seconds, rounded to closest. - * Disable by using 0. Defaults to 120. - */ - idleTimeout?: number; - /** What permessage-deflate compression to use. uWS.DISABLED, uWS.SHARED_COMPRESSOR or any of the uWS.DEDICATED_COMPRESSOR_xxxKB. Defaults to uWS.DISABLED. */ - compression?: CompressOptions; - /** Maximum length of allowed backpressure per socket when publishing or sending messages. Slow receivers with too high backpressure will be skipped until they catch up or timeout. Defaults to 1024 * 1024. */ - maxBackpressure?: number; - /** Upgrade handler used to intercept HTTP upgrade requests and potentially upgrade to WebSocket. - * See UpgradeAsync and UpgradeSync example files. - */ - upgrade?: (res: HttpResponse, req: HttpRequest, context: us_socket_context_t) => void; - /** Handler for new WebSocket connection. WebSocket is valid from open to close, no errors. */ - open?: (ws: WebSocket) => void; - /** Handler for a WebSocket message. Messages are given as ArrayBuffer no matter if they are binary or not. Given ArrayBuffer is valid during the lifetime of this callback (until first await or return) and will be neutered. */ - message?: (ws: WebSocket, message: ArrayBuffer, isBinary: boolean) => void; - /** Handler for when WebSocket backpressure drains. Check ws.getBufferedAmount(). Use this to guide / drive your backpressure throttling. */ - drain?: (ws: WebSocket) => void; - /** Handler for close event, no matter if error, timeout or graceful close. You may not use WebSocket after this event. Do not send on this WebSocket from within here, it is closed. */ - close?: (ws: WebSocket, code: number, message: ArrayBuffer) => void; - /** Handler for received ping control message. You do not need to handle this, pong messages are automatically sent as per the standard. */ - ping?: (ws: WebSocket, message: ArrayBuffer) => void; - /** Handler for received pong control message. */ - pong?: (ws: WebSocket, message: ArrayBuffer) => void; -} - -/** Options used when constructing an app. Especially for SSLApp. - * These are options passed directly to uSockets, C layer. - */ -export interface AppOptions { - key_file_name?: RecognizedString; - cert_file_name?: RecognizedString; - passphrase?: RecognizedString; - dh_params_file_name?: RecognizedString; - /** This translates to SSL_MODE_RELEASE_BUFFERS */ - ssl_prefer_low_memory_usage?: boolean; -} - -export enum ListenOptions { - LIBUS_LISTEN_DEFAULT = 0, - LIBUS_LISTEN_EXCLUSIVE_PORT = 1 -} - -/** TemplatedApp is either an SSL or non-SSL app. See App for more info, read user manual. */ -export interface TemplatedApp { - /** Listens to hostname & port. Callback hands either false or a listen socket. */ - listen(host: RecognizedString, port: number, cb: (listenSocket: us_listen_socket) => void): TemplatedApp; - /** Listens to port. Callback hands either false or a listen socket. */ - listen(port: number, cb: (listenSocket: any) => void): TemplatedApp; - /** Listens to port and sets Listen Options. Callback hands either false or a listen socket. */ - listen(port: number, options: ListenOptions, cb: (listenSocket: us_listen_socket | false) => void): TemplatedApp; - /** Registers an HTTP GET handler matching specified URL pattern. */ - get(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp; - /** Registers an HTTP POST handler matching specified URL pattern. */ - post(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp; - /** Registers an HTTP OPTIONS handler matching specified URL pattern. */ - options(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp; - /** Registers an HTTP DELETE handler matching specified URL pattern. */ - del(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp; - /** Registers an HTTP PATCH handler matching specified URL pattern. */ - patch(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp; - /** Registers an HTTP PUT handler matching specified URL pattern. */ - put(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp; - /** Registers an HTTP HEAD handler matching specified URL pattern. */ - head(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp; - /** Registers an HTTP CONNECT handler matching specified URL pattern. */ - connect(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp; - /** Registers an HTTP TRACE handler matching specified URL pattern. */ - trace(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp; - /** Registers an HTTP handler matching specified URL pattern on any HTTP method. */ - any(pattern: RecognizedString, handler: (res: HttpResponse, req: HttpRequest) => void) : TemplatedApp; - /** Registers a handler matching specified URL pattern where WebSocket upgrade requests are caught. */ - ws(pattern: RecognizedString, behavior: WebSocketBehavior) : TemplatedApp; - /** Publishes a message under topic, for all WebSockets under this app. See WebSocket.publish. */ - publish(topic: RecognizedString, message: RecognizedString, isBinary?: boolean, compress?: boolean) : boolean; - /** Returns number of subscribers for this topic. */ - numSubscribers(topic: RecognizedString) : number; - /** Adds a server name. */ - addServerName(hostname: string, options: AppOptions): TemplatedApp; - /** Removes a server name. */ - removeServerName(hostname: string): TemplatedApp; - /** Registers a synchronous callback on missing server names. See /examples/ServerName.js. */ - missingServerName(cb: (hostname: string) => void): TemplatedApp; -} - -/** Constructs a non-SSL app. An app is your starting point where you attach behavior to URL routes. - * This is also where you listen and run your app, set any SSL options (in case of SSLApp) and the like. - */ -export function App(options?: AppOptions): TemplatedApp; - -/** Constructs an SSL app. See App. */ -export function SSLApp(options: AppOptions): TemplatedApp; - -/** Closes a uSockets listen socket. */ -export function us_listen_socket_close(listenSocket: us_listen_socket): void; - -/** Gets local port of socket (or listenSocket) or -1. */ -export function us_socket_local_port(socket: us_socket): number; - -export interface MultipartField { - data: ArrayBuffer; - name: string; - type?: string; - filename?: string; -} - -/** Takes a POSTed body and contentType, and returns an array of parts if the request is a multipart request */ -export function getParts(body: RecognizedString, contentType: RecognizedString): MultipartField[] | undefined; - -/** WebSocket compression options */ -export type CompressOptions = number; -/** No compression (always a good idea if you operate using an efficient binary protocol) */ -export var DISABLED: CompressOptions; -/** Zero memory overhead compression (recommended for pub/sub where same message is sent to many receivers) */ -export var SHARED_COMPRESSOR: CompressOptions; -/** Sliding dedicated compress window, requires 3KB of memory per socket */ -export var DEDICATED_COMPRESSOR_3KB: CompressOptions; -/** Sliding dedicated compress window, requires 4KB of memory per socket */ -export var DEDICATED_COMPRESSOR_4KB: CompressOptions; -/** Sliding dedicated compress window, requires 8KB of memory per socket */ -export var DEDICATED_COMPRESSOR_8KB: CompressOptions; -/** Sliding dedicated compress window, requires 16KB of memory per socket */ -export var DEDICATED_COMPRESSOR_16KB: CompressOptions; -/** Sliding dedicated compress window, requires 32KB of memory per socket */ -export var DEDICATED_COMPRESSOR_32KB: CompressOptions; -/** Sliding dedicated compress window, requires 64KB of memory per socket */ -export var DEDICATED_COMPRESSOR_64KB: CompressOptions; -/** Sliding dedicated compress window, requires 128KB of memory per socket */ -export var DEDICATED_COMPRESSOR_128KB: CompressOptions; -/** Sliding dedicated compress window, requires 256KB of memory per socket */ -export var DEDICATED_COMPRESSOR_256KB: CompressOptions; diff --git a/UwBridge(uWS)/uWebSockets/package.json b/UwBridge(uWS)/uWebSockets/package.json deleted file mode 100644 index 85f2d361..00000000 --- a/UwBridge(uWS)/uWebSockets/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "uWebSockets.js", - "version": "19.3.0", - "main": "uws.js", - "types": "./index.d.ts" -} diff --git a/UwBridge(uWS)/uWebSockets/source_commit b/UwBridge(uWS)/uWebSockets/source_commit deleted file mode 100644 index 9ee60539..00000000 --- a/UwBridge(uWS)/uWebSockets/source_commit +++ /dev/null @@ -1 +0,0 @@ -0f921211456243ef75a9989f8c73dc40bf305d76 diff --git a/UwBridge(uWS)/uWebSockets/uws.js b/UwBridge(uWS)/uWebSockets/uws.js deleted file mode 100644 index f7658c82..00000000 --- a/UwBridge(uWS)/uWebSockets/uws.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Authored by Alex Hultman, 2018-2021. - * Intellectual property of third-party. - - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - - * http://www.apache.org/licenses/LICENSE-2.0 - - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -module.exports = (() => { - try { - return require('./uws_' + process.platform + '_' + process.arch + '_' + process.versions.modules + '.node'); - } catch (e) { - throw new Error('This version of µWS is not compatible with your Node.js build:\n\n' + e.toString()); - } -})(); diff --git a/UwBridge(uWS)/uWebSockets/uws_darwin_arm64_72.node b/UwBridge(uWS)/uWebSockets/uws_darwin_arm64_72.node deleted file mode 100644 index 247d6e73..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_darwin_arm64_72.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_darwin_arm64_83.node b/UwBridge(uWS)/uWebSockets/uws_darwin_arm64_83.node deleted file mode 100644 index aa3766c6..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_darwin_arm64_83.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_darwin_arm64_88.node b/UwBridge(uWS)/uWebSockets/uws_darwin_arm64_88.node deleted file mode 100644 index fe815a0f..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_darwin_arm64_88.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_darwin_arm64_93.node b/UwBridge(uWS)/uWebSockets/uws_darwin_arm64_93.node deleted file mode 100644 index da2348de..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_darwin_arm64_93.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_darwin_x64_72.node b/UwBridge(uWS)/uWebSockets/uws_darwin_x64_72.node deleted file mode 100644 index 688490e9..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_darwin_x64_72.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_darwin_x64_83.node b/UwBridge(uWS)/uWebSockets/uws_darwin_x64_83.node deleted file mode 100644 index 094e2d68..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_darwin_x64_83.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_darwin_x64_88.node b/UwBridge(uWS)/uWebSockets/uws_darwin_x64_88.node deleted file mode 100644 index ef517dad..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_darwin_x64_88.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_darwin_x64_93.node b/UwBridge(uWS)/uWebSockets/uws_darwin_x64_93.node deleted file mode 100644 index b360a516..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_darwin_x64_93.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_linux_arm64_72.node b/UwBridge(uWS)/uWebSockets/uws_linux_arm64_72.node deleted file mode 100644 index 75d92090..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_linux_arm64_72.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_linux_arm64_83.node b/UwBridge(uWS)/uWebSockets/uws_linux_arm64_83.node deleted file mode 100644 index 039a9ab5..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_linux_arm64_83.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_linux_arm64_88.node b/UwBridge(uWS)/uWebSockets/uws_linux_arm64_88.node deleted file mode 100644 index 014a92f2..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_linux_arm64_88.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_linux_arm64_93.node b/UwBridge(uWS)/uWebSockets/uws_linux_arm64_93.node deleted file mode 100644 index 9c2a9f28..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_linux_arm64_93.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_linux_x64_72.node b/UwBridge(uWS)/uWebSockets/uws_linux_x64_72.node deleted file mode 100644 index 89e4ab5b..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_linux_x64_72.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_linux_x64_83.node b/UwBridge(uWS)/uWebSockets/uws_linux_x64_83.node deleted file mode 100644 index 1fbc9613..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_linux_x64_83.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_linux_x64_88.node b/UwBridge(uWS)/uWebSockets/uws_linux_x64_88.node deleted file mode 100644 index 75f9139d..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_linux_x64_88.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_linux_x64_93.node b/UwBridge(uWS)/uWebSockets/uws_linux_x64_93.node deleted file mode 100644 index d3071bc0..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_linux_x64_93.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_win32_x64_72.node b/UwBridge(uWS)/uWebSockets/uws_win32_x64_72.node deleted file mode 100644 index 57f49efe..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_win32_x64_72.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_win32_x64_83.node b/UwBridge(uWS)/uWebSockets/uws_win32_x64_83.node deleted file mode 100644 index 37a365b9..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_win32_x64_83.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_win32_x64_88.node b/UwBridge(uWS)/uWebSockets/uws_win32_x64_88.node deleted file mode 100644 index 976f0d8b..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_win32_x64_88.node and /dev/null differ diff --git a/UwBridge(uWS)/uWebSockets/uws_win32_x64_93.node b/UwBridge(uWS)/uWebSockets/uws_win32_x64_93.node deleted file mode 100644 index dd707a31..00000000 Binary files a/UwBridge(uWS)/uWebSockets/uws_win32_x64_93.node and /dev/null differ diff --git a/package-lock.json b/package-lock.json index fdc9554e..2995dc10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,12 +9,12 @@ "version": "1.3.2", "license": "ISC", "dependencies": { - "Acid": "^3.0.0", + "Acid": "^3.0.3", "base64-img": "^1.0.4", "compression": "^1.7.4", "docredux": "^3.0.0", "figlet": "^1.5.2", - "hyper-express": "^5.8.5", + "hyper-express": "^5.8.6", "image-size": "^1.0.1", "is-valid-path": "^0.1.1", "live-directory": "^2.3.2", @@ -23,7 +23,7 @@ "node-dir": "^0.1.17", "node-watch": "^0.7.3", "qrcode": "^1.5.0", - "sharp": "^0.30.2", + "sharp": "^0.30.3", "sodium-native": "^3.3.0", "string_decoder": "^1.3.0", "textlint": "^12.1.1", @@ -34,7 +34,7 @@ "zip-a-folder": "^1.1.3" }, "devDependencies": { - "@babel/core": "^7.17.5", + "@babel/core": "^7.17.7", "@babel/eslint-parser": "^7.17.0", "@babel/preset-env": "^7.16.11", "@septdirworkshop/ukfontawesome": "^5.15.1", @@ -45,10 +45,10 @@ "eslint": "^8.11.0", "eslint-plugin-json": "^3.1.0", "ractive": "^1.4.0", - "rollup": "^2.70.0", + "rollup": "^2.70.1", "rollup-plugin-terser": "^7.0.2", "testatron": "^2.1.0", - "uikit": "^3.11.1" + "uikit": "^3.12.2" }, "engines": { "node": ">=12.9.1" @@ -92,27 +92,27 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.17.0.tgz", - "integrity": "sha512-392byTlpGWXMv4FbyWw3sAZ/FrW/DrwqLGXpy0mbyNe9Taqv1mg9yON5/o0cnr8XYCkFTZbC1eV+c+LAROgrng==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.17.7.tgz", + "integrity": "sha512-p8pdE6j0a29TNGebNm7NzYZWB3xVZJBZ7XGs42uAKzQo8VQ3F0By/cQCtUEABwIqw5zo6WA4NbmxsfzADzMKnQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.17.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.5.tgz", - "integrity": "sha512-/BBMw4EvjmyquN5O+t5eh0+YqB3XXJkYD2cjKpYtWOfFy4lQ4UozNSmxAcWT8r2XtZs0ewG+zrfsqeR15i1ajA==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.7.tgz", + "integrity": "sha512-djHlEfFHnSnTAcPb7dATbiM5HxGOP98+3JLBZtjRb5I7RXrw7kFRoG2dXM8cm3H+o11A8IFH/uprmJpwFynRNQ==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.17.3", - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helpers": "^7.17.2", - "@babel/parser": "^7.17.3", + "@babel/generator": "^7.17.7", + "@babel/helper-compilation-targets": "^7.17.7", + "@babel/helper-module-transforms": "^7.17.7", + "@babel/helpers": "^7.17.7", + "@babel/parser": "^7.17.7", "@babel/template": "^7.16.7", "@babel/traverse": "^7.17.3", "@babel/types": "^7.17.0", @@ -149,9 +149,9 @@ } }, "node_modules/@babel/generator": { - "version": "7.17.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.3.tgz", - "integrity": "sha512-+R6Dctil/MgUsZsZAkYgK+ADNSZzJRRy0TvY65T71z/CR854xHQ1EweBYXdfT+HNeN7w0cSJJEzgxZMv40pxsg==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.7.tgz", + "integrity": "sha512-oLcVCTeIFadUoArDTwpluncplrYBmTCCZZgXCbgNGvOBBiSDDK3eWO4b/+eOTli5tKv1lg+a5/NAXg+nTcei1w==", "dev": true, "dependencies": { "@babel/types": "^7.17.0", @@ -188,12 +188,12 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz", - "integrity": "sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.17.7.tgz", + "integrity": "sha512-UFzlz2jjd8kroj0hmCFV5zr+tQPi1dpC2cRsDV/3IEW8bJfCPrPpmcSN6ZS8RqIq4LXcmpipCQFPddyFA5Yc7w==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.16.4", + "@babel/compat-data": "^7.17.7", "@babel/helper-validator-option": "^7.16.7", "browserslist": "^4.17.5", "semver": "^6.3.0" @@ -348,14 +348,14 @@ } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.17.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.17.6.tgz", - "integrity": "sha512-2ULmRdqoOMpdvkbT8jONrZML/XALfzxlb052bldftkicAUy8AxSCkD5trDPQcwHNmolcl7wP6ehNqMlyUw6AaA==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.17.7.tgz", + "integrity": "sha512-VmZD99F3gNTYB7fJRDTi+u6l/zxY0BE6OIxPSU7a50s6ZUQkHwSDmV92FfM+oCG0pZRVojGYhkR8I0OGeCVREw==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.16.7", "@babel/helper-module-imports": "^7.16.7", - "@babel/helper-simple-access": "^7.16.7", + "@babel/helper-simple-access": "^7.17.7", "@babel/helper-split-export-declaration": "^7.16.7", "@babel/helper-validator-identifier": "^7.16.7", "@babel/template": "^7.16.7", @@ -418,12 +418,12 @@ } }, "node_modules/@babel/helper-simple-access": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz", - "integrity": "sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.17.7.tgz", + "integrity": "sha512-txyMCGroZ96i+Pxr3Je3lzEJjqwaRC9buMUgtomcrLe5Nd0+fk1h0LLA+ixUF5OW7AhHuQ7Es1WcQJZmZsz2XA==", "dev": true, "dependencies": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.17.0" }, "engines": { "node": ">=6.9.0" @@ -486,13 +486,13 @@ } }, "node_modules/@babel/helpers": { - "version": "7.17.2", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.2.tgz", - "integrity": "sha512-0Qu7RLR1dILozr/6M0xgj+DFPmi6Bnulgm9M8BVa9ZCWxDqlSnqt3cf8IDPB5m45sVXUZ0kuQAgUrdSFFH79fQ==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.7.tgz", + "integrity": "sha512-TKsj9NkjJfTBxM7Phfy7kv6yYc4ZcOo+AaWGqQOKTPDOmcGkIFb5xNA746eKisQkm4yavUYh4InYM9S+VnO01w==", "dev": true, "dependencies": { "@babel/template": "^7.16.7", - "@babel/traverse": "^7.17.0", + "@babel/traverse": "^7.17.3", "@babel/types": "^7.17.0" }, "engines": { @@ -513,9 +513,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.17.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.3.tgz", - "integrity": "sha512-7yJPvPV+ESz2IUTPbOL+YkIGyCqOyNIzdguKQuJGnH7bg1WTIifuM21YqokFt/THWh1AkCRn9IgoykTRCBVpzA==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.7.tgz", + "integrity": "sha512-bm3AQf45vR4gKggRfvJdYJ0gFLoCbsPxiFLSH6hTVYABptNHY6l9NrhnucVjQ/X+SPtLANT9lc0fFhikj+VBRA==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -2594,9 +2594,9 @@ } }, "node_modules/Acid": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/Acid/-/Acid-3.0.0.tgz", - "integrity": "sha512-FtS0enPM1aA6alHYaKiY29X2K6ZECPo6tA6Hp0RvB8erSh1BUizJ7/TV/kH8UHIwbF2zZbPGPSUR4lV79S8UYA==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/Acid/-/Acid-3.0.3.tgz", + "integrity": "sha512-hcfMN650+lnH8KTQPxL6VzWXIqF8bVmZtFGAt9h2zU4J8fqSjQxfStTBfFaj2hU6k2roIWLTgrvgR/Ate0HLnw==", "bin": { "Acid": "index.js" } @@ -6836,9 +6836,9 @@ } }, "node_modules/hyper-express": { - "version": "5.8.5", - "resolved": "https://registry.npmjs.org/hyper-express/-/hyper-express-5.8.5.tgz", - "integrity": "sha512-bMUrAAneJfzA9TRYpOcn9a0y3XIheq+tUGA3imnWzvYtS/nGHS+miJstylTebr3bGRaNijxphBdk2aCo7yU/IA==", + "version": "5.8.6", + "resolved": "https://registry.npmjs.org/hyper-express/-/hyper-express-5.8.6.tgz", + "integrity": "sha512-JELT9UMWiDkHihmRUy/Twv2PepnzaGW/K3Jgc6tN7x7IumX1zVf34woJQ8n0TUsgnzJTx4ukWrcJGhQitSf0mw==", "dependencies": { "@types/busboy": "^0.3.1", "@types/express": "^4.17.13", @@ -10840,9 +10840,9 @@ "dev": true }, "node_modules/rollup": { - "version": "2.70.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.70.0.tgz", - "integrity": "sha512-iEzYw+syFxQ0X9RefVwhr8BA2TNJsTaX8L8dhyeyMECDbmiba+8UQzcu+xZdji0+JQ+s7kouQnw+9Oz5M19XKA==", + "version": "2.70.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.70.1.tgz", + "integrity": "sha512-CRYsI5EuzLbXdxC6RnYhOuRdtz4bhejPMSWjsFLfVM/7w/85n2szZv6yExqUXsBdz5KT8eoubeyDUDjhLHEslA==", "dev": true, "bin": { "rollup": "dist/bin/rollup" @@ -11064,9 +11064,9 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "node_modules/sharp": { - "version": "0.30.2", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.30.2.tgz", - "integrity": "sha512-mrMeKI5ECTdYhslPlA2TbBtU3nZXMEBcQwI6qYXjPlu1LpW4HBZLFm6xshMI1HpIdEEJ3UcYp5AKifLT/fEHZQ==", + "version": "0.30.3", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.30.3.tgz", + "integrity": "sha512-rjpfJFK58ZOFSG8sxYSo3/JQb4ej095HjXp9X7gVu7gEn1aqSG8TCW29h/Rr31+PXrFADo1H/vKfw0uhMQWFtg==", "hasInstallScript": true, "dependencies": { "color": "^4.2.1", @@ -12970,9 +12970,9 @@ } }, "node_modules/uikit": { - "version": "3.11.1", - "resolved": "https://registry.npmjs.org/uikit/-/uikit-3.11.1.tgz", - "integrity": "sha512-nUUtvE/wZe+oFF+8WLGlvsdHg1KI75SHHEhf5FcSVFG1AHEJkqOKhPhgU6FQLporAiPTsapzURN/bP765gI2bA==", + "version": "3.12.2", + "resolved": "https://registry.npmjs.org/uikit/-/uikit-3.12.2.tgz", + "integrity": "sha512-YfKozhmHysSZM2f50CR81QsBeWWBdbo1DfpGwJ/n5Q+OPQIY/YteImb+z+HDby+GFKP1crZYxew1EB/x8uvLqw==", "dev": true }, "node_modules/uint64be": { @@ -14044,24 +14044,24 @@ } }, "@babel/compat-data": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.17.0.tgz", - "integrity": "sha512-392byTlpGWXMv4FbyWw3sAZ/FrW/DrwqLGXpy0mbyNe9Taqv1mg9yON5/o0cnr8XYCkFTZbC1eV+c+LAROgrng==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.17.7.tgz", + "integrity": "sha512-p8pdE6j0a29TNGebNm7NzYZWB3xVZJBZ7XGs42uAKzQo8VQ3F0By/cQCtUEABwIqw5zo6WA4NbmxsfzADzMKnQ==", "dev": true }, "@babel/core": { - "version": "7.17.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.5.tgz", - "integrity": "sha512-/BBMw4EvjmyquN5O+t5eh0+YqB3XXJkYD2cjKpYtWOfFy4lQ4UozNSmxAcWT8r2XtZs0ewG+zrfsqeR15i1ajA==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.17.7.tgz", + "integrity": "sha512-djHlEfFHnSnTAcPb7dATbiM5HxGOP98+3JLBZtjRb5I7RXrw7kFRoG2dXM8cm3H+o11A8IFH/uprmJpwFynRNQ==", "dev": true, "requires": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.17.3", - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helpers": "^7.17.2", - "@babel/parser": "^7.17.3", + "@babel/generator": "^7.17.7", + "@babel/helper-compilation-targets": "^7.17.7", + "@babel/helper-module-transforms": "^7.17.7", + "@babel/helpers": "^7.17.7", + "@babel/parser": "^7.17.7", "@babel/template": "^7.16.7", "@babel/traverse": "^7.17.3", "@babel/types": "^7.17.0", @@ -14084,9 +14084,9 @@ } }, "@babel/generator": { - "version": "7.17.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.3.tgz", - "integrity": "sha512-+R6Dctil/MgUsZsZAkYgK+ADNSZzJRRy0TvY65T71z/CR854xHQ1EweBYXdfT+HNeN7w0cSJJEzgxZMv40pxsg==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.7.tgz", + "integrity": "sha512-oLcVCTeIFadUoArDTwpluncplrYBmTCCZZgXCbgNGvOBBiSDDK3eWO4b/+eOTli5tKv1lg+a5/NAXg+nTcei1w==", "dev": true, "requires": { "@babel/types": "^7.17.0", @@ -14114,12 +14114,12 @@ } }, "@babel/helper-compilation-targets": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz", - "integrity": "sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.17.7.tgz", + "integrity": "sha512-UFzlz2jjd8kroj0hmCFV5zr+tQPi1dpC2cRsDV/3IEW8bJfCPrPpmcSN6ZS8RqIq4LXcmpipCQFPddyFA5Yc7w==", "dev": true, "requires": { - "@babel/compat-data": "^7.16.4", + "@babel/compat-data": "^7.17.7", "@babel/helper-validator-option": "^7.16.7", "browserslist": "^4.17.5", "semver": "^6.3.0" @@ -14232,14 +14232,14 @@ } }, "@babel/helper-module-transforms": { - "version": "7.17.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.17.6.tgz", - "integrity": "sha512-2ULmRdqoOMpdvkbT8jONrZML/XALfzxlb052bldftkicAUy8AxSCkD5trDPQcwHNmolcl7wP6ehNqMlyUw6AaA==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.17.7.tgz", + "integrity": "sha512-VmZD99F3gNTYB7fJRDTi+u6l/zxY0BE6OIxPSU7a50s6ZUQkHwSDmV92FfM+oCG0pZRVojGYhkR8I0OGeCVREw==", "dev": true, "requires": { "@babel/helper-environment-visitor": "^7.16.7", "@babel/helper-module-imports": "^7.16.7", - "@babel/helper-simple-access": "^7.16.7", + "@babel/helper-simple-access": "^7.17.7", "@babel/helper-split-export-declaration": "^7.16.7", "@babel/helper-validator-identifier": "^7.16.7", "@babel/template": "^7.16.7", @@ -14287,12 +14287,12 @@ } }, "@babel/helper-simple-access": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz", - "integrity": "sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.17.7.tgz", + "integrity": "sha512-txyMCGroZ96i+Pxr3Je3lzEJjqwaRC9buMUgtomcrLe5Nd0+fk1h0LLA+ixUF5OW7AhHuQ7Es1WcQJZmZsz2XA==", "dev": true, "requires": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.17.0" } }, "@babel/helper-skip-transparent-expression-wrappers": { @@ -14337,13 +14337,13 @@ } }, "@babel/helpers": { - "version": "7.17.2", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.2.tgz", - "integrity": "sha512-0Qu7RLR1dILozr/6M0xgj+DFPmi6Bnulgm9M8BVa9ZCWxDqlSnqt3cf8IDPB5m45sVXUZ0kuQAgUrdSFFH79fQ==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.17.7.tgz", + "integrity": "sha512-TKsj9NkjJfTBxM7Phfy7kv6yYc4ZcOo+AaWGqQOKTPDOmcGkIFb5xNA746eKisQkm4yavUYh4InYM9S+VnO01w==", "dev": true, "requires": { "@babel/template": "^7.16.7", - "@babel/traverse": "^7.17.0", + "@babel/traverse": "^7.17.3", "@babel/types": "^7.17.0" } }, @@ -14358,9 +14358,9 @@ } }, "@babel/parser": { - "version": "7.17.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.3.tgz", - "integrity": "sha512-7yJPvPV+ESz2IUTPbOL+YkIGyCqOyNIzdguKQuJGnH7bg1WTIifuM21YqokFt/THWh1AkCRn9IgoykTRCBVpzA==", + "version": "7.17.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.7.tgz", + "integrity": "sha512-bm3AQf45vR4gKggRfvJdYJ0gFLoCbsPxiFLSH6hTVYABptNHY6l9NrhnucVjQ/X+SPtLANT9lc0fFhikj+VBRA==", "dev": true }, "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { @@ -15899,9 +15899,9 @@ } }, "Acid": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/Acid/-/Acid-3.0.0.tgz", - "integrity": "sha512-FtS0enPM1aA6alHYaKiY29X2K6ZECPo6tA6Hp0RvB8erSh1BUizJ7/TV/kH8UHIwbF2zZbPGPSUR4lV79S8UYA==" + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/Acid/-/Acid-3.0.3.tgz", + "integrity": "sha512-hcfMN650+lnH8KTQPxL6VzWXIqF8bVmZtFGAt9h2zU4J8fqSjQxfStTBfFaj2hU6k2roIWLTgrvgR/Ate0HLnw==" }, "acorn": { "version": "8.7.0", @@ -19077,9 +19077,9 @@ } }, "hyper-express": { - "version": "5.8.5", - "resolved": "https://registry.npmjs.org/hyper-express/-/hyper-express-5.8.5.tgz", - "integrity": "sha512-bMUrAAneJfzA9TRYpOcn9a0y3XIheq+tUGA3imnWzvYtS/nGHS+miJstylTebr3bGRaNijxphBdk2aCo7yU/IA==", + "version": "5.8.6", + "resolved": "https://registry.npmjs.org/hyper-express/-/hyper-express-5.8.6.tgz", + "integrity": "sha512-JELT9UMWiDkHihmRUy/Twv2PepnzaGW/K3Jgc6tN7x7IumX1zVf34woJQ8n0TUsgnzJTx4ukWrcJGhQitSf0mw==", "requires": { "@types/busboy": "^0.3.1", "@types/express": "^4.17.13", @@ -22075,9 +22075,9 @@ } }, "rollup": { - "version": "2.70.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.70.0.tgz", - "integrity": "sha512-iEzYw+syFxQ0X9RefVwhr8BA2TNJsTaX8L8dhyeyMECDbmiba+8UQzcu+xZdji0+JQ+s7kouQnw+9Oz5M19XKA==", + "version": "2.70.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.70.1.tgz", + "integrity": "sha512-CRYsI5EuzLbXdxC6RnYhOuRdtz4bhejPMSWjsFLfVM/7w/85n2szZv6yExqUXsBdz5KT8eoubeyDUDjhLHEslA==", "dev": true, "requires": { "fsevents": "~2.3.2" @@ -22227,9 +22227,9 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "sharp": { - "version": "0.30.2", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.30.2.tgz", - "integrity": "sha512-mrMeKI5ECTdYhslPlA2TbBtU3nZXMEBcQwI6qYXjPlu1LpW4HBZLFm6xshMI1HpIdEEJ3UcYp5AKifLT/fEHZQ==", + "version": "0.30.3", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.30.3.tgz", + "integrity": "sha512-rjpfJFK58ZOFSG8sxYSo3/JQb4ej095HjXp9X7gVu7gEn1aqSG8TCW29h/Rr31+PXrFADo1H/vKfw0uhMQWFtg==", "requires": { "color": "^4.2.1", "detect-libc": "^2.0.1", @@ -23616,9 +23616,9 @@ } }, "uikit": { - "version": "3.11.1", - "resolved": "https://registry.npmjs.org/uikit/-/uikit-3.11.1.tgz", - "integrity": "sha512-nUUtvE/wZe+oFF+8WLGlvsdHg1KI75SHHEhf5FcSVFG1AHEJkqOKhPhgU6FQLporAiPTsapzURN/bP765gI2bA==", + "version": "3.12.2", + "resolved": "https://registry.npmjs.org/uikit/-/uikit-3.12.2.tgz", + "integrity": "sha512-YfKozhmHysSZM2f50CR81QsBeWWBdbo1DfpGwJ/n5Q+OPQIY/YteImb+z+HDby+GFKP1crZYxew1EB/x8uvLqw==", "dev": true }, "uint64be": { diff --git a/package.json b/package.json index bc2ac529..b2c29975 100644 --- a/package.json +++ b/package.json @@ -12,12 +12,12 @@ }, "company": "Universal Web, Inc", "dependencies": { - "Acid": "^3.0.0", + "Acid": "^3.0.3", "base64-img": "^1.0.4", "compression": "^1.7.4", "docredux": "^3.0.0", "figlet": "^1.5.2", - "hyper-express": "^5.8.5", + "hyper-express": "^5.8.6", "image-size": "^1.0.1", "is-valid-path": "^0.1.1", "live-directory": "^2.3.2", @@ -26,7 +26,7 @@ "node-dir": "^0.1.17", "node-watch": "^0.7.3", "qrcode": "^1.5.0", - "sharp": "^0.30.2", + "sharp": "^0.30.3", "sodium-native": "^3.3.0", "string_decoder": "^1.3.0", "textlint": "^12.1.1", @@ -38,7 +38,7 @@ }, "description": "Sentivate Network Client, Server Module, UDSP, Universal Web Socket, & certificate generation. This serves as a service & browser prototype.", "devDependencies": { - "@babel/core": "^7.17.5", + "@babel/core": "^7.17.7", "@babel/eslint-parser": "^7.17.0", "@babel/preset-env": "^7.16.11", "@septdirworkshop/ukfontawesome": "^5.15.1", @@ -49,10 +49,10 @@ "eslint": "^8.11.0", "eslint-plugin-json": "^3.1.0", "ractive": "^1.4.0", - "rollup": "^2.70.0", + "rollup": "^2.70.1", "rollup-plugin-terser": "^7.0.2", "testatron": "^2.1.0", - "uikit": "^3.11.1" + "uikit": "^3.12.2" }, "engines": { "node": ">=12.9.1" diff --git a/uwBridge/index.js b/uwBridge/index.js index d476aebb..7320e59d 100644 --- a/uwBridge/index.js +++ b/uwBridge/index.js @@ -16,6 +16,7 @@ const { each, ifInvoke, right, + stringify, } = utility; const root = __dirname; const systemDirectory = resolve(root, './system/'); @@ -24,6 +25,7 @@ const fileUtility = require('../utilities/file'); const consoleUtility = require('../utilities/console'); const certificateUtility = require('../utilities/certificate'); const certificatesUtility = require('../utilities/certificates'); +const assetsRegex = RegExp('/assets/'); class uwBridge { constructor(config) { return promise(async (accept) => { @@ -53,19 +55,16 @@ class uwBridge { scheme = {}; system = {}; serverCreator = serverCreator; - push(channel = 'api', message, is_binary, compress) { - return this.server.publish(channel, message, is_binary, compress); + push(body, channel = 'all', is_binary, compress) { + const message = { + body + }; + const messageCompiled = stringify(message); + return this.server.publish(channel, messageCompiled, is_binary, compress); } - send(channel = 'api', data, is_binary, compress) { - let message; - if (data.body) { - message = data; - } else { - message = { - body: message, - }; - } - return this.server.publish(channel, message, is_binary, compress); + send(message, channel = 'all', is_binary, compress) { + const messageCompiled = stringify(message); + return this.server.publish(channel, messageCompiled, is_binary, compress); } service = { http: {}, @@ -87,7 +86,17 @@ class uwBridge { } return thisBind.events[eventNames].push(callback); } - httpCreate() { + addIndexRoutes(indexPage) { + const routes = this.config.http?.routes; + if (routes) { + each(routes, (routeObject) => { + this.router.get(routeObject.route, (request, response) => { + response.type('html').send(indexPage); + }); + }); + } + } + async httpCreate() { const { config } = this; @@ -97,9 +106,7 @@ class uwBridge { console.log(config.http.indexLocation); const indexPage = fs.readFileSync(config.http.indexLocation); console.log(indexPage); - this.server.get('/', (request, response) => { - response.type('html').send(indexPage); - }); + // this.addIndexRoutes(indexPage); const liveAssets = new LiveDirectory({ path: config.publicDir, keep: { @@ -109,23 +116,26 @@ class uwBridge { return path.startsWith('.'); } }); + await liveAssets.ready(); this.LiveAssets = liveAssets; - // liveAssets.on('file_reload', (file) => { - // console.log(file.content.toString('utf8')); - // }); - // Create static serve route to serve frontend assets - this.server.get('/assets/*', (request, response) => { - // Strip away '/assets' from the request path to get asset relative path - // Lookup LiveFile instance from our LiveDirectory instance. - const path = request.path; - const file = liveAssets.get(path); - console.log(path, file); - // Return a 404 if no asset/file exists on the derived path - if (file === undefined) { - return response.status(404).send(); + this.server.get('/*', (request, response) => { + console.log(request.path); + const requestPath = request.path; + if (requestPath === '/') { + return response.type('html').send(indexPage); + } + if (assetsRegex.test(requestPath)) { + const file = liveAssets.get(requestPath); + console.log(requestPath, file); + // Return a 404 if no asset/file exists on the derived path + if (file === undefined) { + return response.status(404).send(); + } + // Set appropriate mime-type and serve file buffer as response body + return response.type(file.extension).send(file.buffer); + } else { + return response.type('html').send(indexPage); } - // Set appropriate mime-type and serve file buffer as response body - return response.type(file.extension).send(file.buffer); }); console.log('http service'); } @@ -181,6 +191,7 @@ class uwBridge { this.serverListen = serverListen; console.log(`server Listening on ${port}`); this.setupWebSocketServer(); + this.server.use('/', this.router); console.log(`Websocket server Listening on ${port}`); } catch (errorMessage) { console.log('Server Failed to start'); @@ -195,7 +206,6 @@ class uwBridge { console.log(`user ${clientSocket.context} has connected to consume news events`); client(clientSocket, this); }); - this.server.use('/', this.router); } } module.exports = async function(config) { diff --git a/uwBridge/nodemon.json b/uwBridge/nodemon.json index 7e960d60..c76ab28e 100644 --- a/uwBridge/nodemon.json +++ b/uwBridge/nodemon.json @@ -1,7 +1,7 @@ { - "ignore": ["node_modules/", "./apps/**/filesystem/**", "./system/compile/**", "**.json", "**.css", "**.html"], - "watch": ["./apps/**/api/**", "./system/filesystem/**","./system/setup/**", "./index.js", "./system/plugin/**/*.js", "./system/client/*.js"], - "ext": "js, json, ts, proto", + "ignore": ["node_modules/", "./apps/**/filesystem/**", "./system/compile/**", "**.json", "**.css", "**.html"], + "watch": ["./api/**", "../system/filesystem/**","../system/setup/**", "./index.js", "../system/plugin/**/*.js", "../system/client/*.js"], + "ext": "js, json, ts", "verbose": true, "delay": 500, "execMap": { diff --git a/uwBridge/system/client/index.js b/uwBridge/system/client/index.js index 7d391ac6..aa9a79c0 100644 --- a/uwBridge/system/client/index.js +++ b/uwBridge/system/client/index.js @@ -18,7 +18,7 @@ class ClientRequest { constructor(socket, requested) { this.socket = socket; this.body = requested.body; - this.request = requested.request; + this.task = requested.task; this.response = { body: {}, }; @@ -61,10 +61,10 @@ class Client { } } = this; const { - request + task } = clientRequest; - if (hasDot(request)) { - const rootProperty = request.substring(zeroInt, request.indexOf('.')); + if (hasDot(task)) { + const rootProperty = task.substring(zeroInt, task.indexOf('.')); if (apply(hasProperty, client, [rootProperty])) { const security = client[rootProperty]; if (isFunction(security)) { @@ -82,8 +82,8 @@ class Client { } } } - if (apply(hasProperty, client, [request])) { - const requestFunction = client[request]; + if (apply(hasProperty, client, [task])) { + const requestFunction = client[task]; if (isFunction(requestFunction)) { const requestFunctionSecurity = requestFunction.security; if (isFunction(requestFunctionSecurity)) { @@ -107,13 +107,15 @@ class Client { return; } } else { - console.log(`Invalid property entered. Attack made. ${request}`, this.socket.id); + console.log(`Invalid property entered. Attack made. ${task}`, this.socket.id); return false; } } } onClose() { console.log(`use ${this.socket.context} is no longer listening for news events.`); + this.socket.unsubscribe('all'); + this.app.clients.delete(this.id); return console.log(`${this.socket.ip} has now disconnected!`); } constructor(socket, app) { @@ -127,6 +129,8 @@ class Client { socket.on('close', () => { this.onClose(); }); + socket.subscribe('all'); + app.clients.set(this.id, this); } send(message, is_binary, compress) { const { diff --git a/uwBridge/system/compile/build/front/bundle.js b/uwBridge/system/compile/build/front/bundle.js index 4c862e28..23cb49dc 100644 --- a/uwBridge/system/compile/build/front/bundle.js +++ b/uwBridge/system/compile/build/front/bundle.js @@ -9,7 +9,7 @@ this.owner=e.owner||e.up.owner||e.element||Un(e.up),this.element=e.element||(this.owner.attributeByName?this.owner:Un(e.up)),this.up=this.element.up,this.ractive=this.up.ractive,this.element.attributeByName[this.name]=this,this.value=e.template.f;}t&&(e.__proto__=t);var n=e.prototype=Object.create(t&&t.prototype);return n.constructor=e,n.bind=function(){var t=this.template.f,e=this.element.instance.viewmodel;if(0===t)e.joinKey(this.name).set(!0);else if(l(t)){var n=Cs(t);e.joinKey(this.name).set(n?n.value:t);}else Qa(t)&&Os(this);},n.rebound=function(t){if(this.boundFragment&&this.boundFragment.rebound(t),this.link){this.model=Es(this.up,this.template.f[0]);var e=this.element.instance.viewmodel.joinAll(A(this.name));e.link(this.model,this.name,{mapping:!0});}},n.render=function(){},n.unbind=function(t){this.model&&this.model.unregister(this),this.boundFragment&&this.boundFragment.unbind(t),this.element.bound&&this.link.target===this.model&&this.link.owner.unlink();},n.unrender=function(){},n.update=function(){this.dirty&&(this.dirty=!1,this.boundFragment&&this.boundFragment.update());},e}(Cf),np=function(t){function e(e){var n=e.template;n.a||(n.a={}),!f(n.a.value)||"disabled"in n.a||(n.a.value=n.f||""),t.call(this,e),this.select=Un(this.parent||this.up,!1,"select");}t&&(e.__proto__=t);var n=e.prototype=Object.create(t&&t.prototype);return n.constructor=e,n.bind=function(){if(!this.select)return void t.prototype.bind.call(this);var e=this.attributeByName.selected;if(e&&void 0!==this.select.getAttribute("value")){var n=this.attributes.indexOf(e);this.attributes.splice(n,1),delete this.attributeByName.selected;}t.prototype.bind.call(this),this.select.options.push(this);},n.bubble=function(){var e=this.getAttribute("value");this.node&&this.node.value!==e&&(this.node._ractive.value=e),t.prototype.bubble.call(this);},n.getAttribute=function(t){var e=this.attributeByName[t];return e?e.getValue():"value"===t&&this.fragment?this.fragment.valueOf():void 0},n.isSelected=function(){var t=this,e=this.getAttribute("value");if(f(e)||!this.select)return !1;var n=this.select.getAttribute("value");if(this.select.compare(n,e))return !0;if(this.select.getAttribute("multiple")&&Qa(n))for(var i=n.length;i--;)if(t.select.compare(n[i],e))return !0},n.render=function(e,n){t.prototype.render.call(this,e,n),this.attributeByName.value||(this.node._ractive.value=this.getAttribute("value"));},n.unbind=function(e){t.prototype.unbind.call(this,e),this.select&&P(this.select.options,this);},e}(Ed),ip=Ms.prototype=qa(Ss.prototype);$a(ip,{constructor:Ms,bind:function(){var t=this.template;if(this.yielder){if(this.container=this.up.ractive,this.component=this.container.component,this.containerFragment=this.up,!this.component)return this.fragment=new Qp({owner:this,template:[]}),void this.fragment.bind();this.up=this.component.up,t.r||t.x||t.rx||(this.refName="content");}this.macro?this.fn=this.macro:(this.refName||(this.refName=t.r),this.refName&&Bs(this,this.refName),this.partial||this.fn||(Ss.prototype.bind.call(this),this.model&&Bs(this,this.model.get()))),this.partial||this.fn||w("Could not find template for partial '"+this.name+"'"),Is(this,this.partial||[]),this.fn&&Ds(this),this.fragment.bind();},bubble:function(){this.dirty||(this.dirty=!0,this.yielder?this.containerFragment.bubble():this.up.bubble());},findNextNode:function(){return (this.containerFragment||this.up).findNextNode(this)},handleChange:function(){this.dirtyTemplate=!0,this.externalChange=!0,this.bubble();},rebound:function(t){var e=this;this._attrs&&Wa(this._attrs).forEach(function(n){return e._attrs[n].rebound(t)}),Ss.prototype.rebound.call(this,t);},refreshAttrs:function(){var t=this;Wa(this._attrs).forEach(function(e){t.handle.attributes[e]=!t._attrs[e].items.length||t._attrs[e].valueOf();});},resetTemplate:function(){var t=this;if(this.fn&&this.proxy){if(this.last=0,!this.externalChange)return this.partial=this.fnTemplate,!0;h(this.proxy.teardown)&&this.proxy.teardown(),this.fn=this.proxy=null;}if(this.partial=null,this.refName&&(this.partial=Ns(this.ractive,this.refName,this.up)),!this.partial&&this.model&&Bs(this,this.model.get()),!this.fn){if(this.last&&this.partial===this.last)return !1;this.partial&&(this.last=this.partial,Rs(this));}return this.unbindAttrs(),this.fn?(Ds(this),h(this.proxy.render)&&jl.scheduleTask(function(){return t.proxy.render()})):this.partial||w("Could not find template for partial '"+this.name+"'"),!0},render:function(t,e){this.fn&&this.fn._cssDef&&!this.fn._cssDef.applied&&Ci(),this.fragment.render(t,e),this.proxy&&h(this.proxy.render)&&this.proxy.render();},unbind:function(t){this.fragment.unbind(t),this.unbindAttrs(t),Ss.prototype.unbind.call(this,t);},unbindAttrs:function(t){var e=this;this._attrs&&Wa(this._attrs).forEach(function(n){e._attrs[n].unbind(t);});},unrender:function(t){this.proxy&&h(this.proxy.teardown)&&this.proxy.teardown(),this.fragment.unrender(t);},update:function(){var t=this,e=this.proxy;this.updating=1,this.dirtyAttrs&&(this.dirtyAttrs=!1,Wa(this._attrs).forEach(function(e){return t._attrs[e].update()}),this.refreshAttrs(),h(e.update)&&e.update(this.handle.attributes)),this.dirtyTemplate&&(this.dirtyTemplate=!1,this.resetTemplate()&&this.fragment.resetTemplate(this.partial||[])),this.dirty&&(this.dirty=!1,e&&h(e.invalidate)&&e.invalidate(),this.fragment.update()),this.externalChange=!1,this.updating=0;}});var rp="extra-attributes",sp=function(t,e,n){this.value=this.key=t,this.context=e,this.isReadonly=this.isKey=!0,this.deps=[],this.links=[],this.children=[],this.instance=n;},ap=sp.prototype;ap.applyValue=function(t){t!==this.value&&(this.value=this.key=t,this.deps.forEach(Y),this.links.forEach(Y),this.children.forEach(function(t){t.applyValue(t.context.getKeypath(t.instance));}));},ap.destroyed=function(){this.upstream&&this.upstream.unregisterChild(this);},ap.get=function(t){return t&&Z(this),C(this.value)},ap.getKeypath=function(){return C(this.value)},ap.has=function(){return !1},ap.rebind=function(t,e){for(var n=this,i=this.deps.length;i--;)n.deps[i].rebind(t,e,!1);for(i=this.links.length;i--;)n.links[i].relinking(t,!1);},ap.register=function(t){this.deps.push(t);},ap.registerChild=function(t){O(this.children,t),t.upstream=this;},ap.registerLink=function(t){O(this.links,t);},ap.unregister=function(t){P(this.deps,t);},ap.unregisterChild=function(t){P(this.children,t);},ap.unregisterLink=function(t){P(this.links,t);},sp.prototype.reference=d,sp.prototype.unreference=d;var op=/^"(\\"|[^"])+"$/,up=function(t){this.parent=t.owner.up,this.up=this,this.owner=t.owner,this.ractive=this.parent.ractive,this.delegate=this.ractive.delegate!==!1&&(this.parent.delegate||zs(this.parent)),this.delegate&&this.delegate.delegate===!1&&(this.delegate=!1),this.delegate&&(this.delegate.delegate=this.delegate),this.cssIds="cssIds"in t?t.cssIds:this.parent?this.parent.cssIds:null,this.context=null,this.rendered=!1,this.iterations=[],this.template=t.template,this.indexRef=t.indexRef,this.keyRef=t.keyRef,this.pendingNewIndices=null,this.previousIterations=null,this.isArray=!1;},hp=up.prototype;hp.bind=function(t){var e=this;this.context=t,this.bound=!0;var n=t.get(),i=this.aliases=this.owner.template.z&&this.owner.template.z.slice(),r=i&&i.find(function(t){return "shuffle"===t.n});r&&r.x&&r.x.x&&("true"===r.x.x.s?this.shuffler=!0:op.test(r.x.x.s)&&(this.shuffler=A(r.x.x.s.slice(1,-1)))),this.shuffler&&(this.values=$s(this,this.shuffler)),this.source&&this.source.model.unbind(this.source);var a=t.isComputed&&i&&i.find(function(t){return "source"===t.n});if(a&&a.x&&a.x.r){var o=Es(this,a.x);this.source={handleChange:function(){},rebind:function(t){this.model.unregister(this),this.model=t,t.register(this);}},this.source.model=o,o.register(this.source);}if(this.isArray=Qa(n)){this.iterations=[];for(var u=this.length=n.length,h=0;u>h;h+=1)e.iterations[h]=e.createIteration(h,h);}else if(s(n)){if(this.isArray=!1,this.indexRef){var l=this.indexRef.split(",");this.keyRef=l[0],this.indexRef=l[1];}var c=Wa(n);this.length=c.length,this.iterations=c.map(function(t,n){return e.createIteration(t,n)});}return this},hp.bubble=function(t){this.bubbled||(this.bubbled=[]),this.bubbled.push(t),this.rebounding||this.owner.bubble();},hp.createIteration=function(t,e){var n=new Qp({owner:this,template:this.template});return n.isIteration=!0,n.delegate=this.delegate,this.aliases&&(n.aliases={}),Us(this,n,t,e),n.bind(n.context)},hp.destroyed=function(){for(var t=this,e=this.iterations.length,n=0;e>n;n++)t.iterations[n].destroyed();this.pathModel&&this.pathModel.destroyed(),this.rootModel&&this.rootModel.destroyed();},hp.detach=function(){var t=ri();return this.iterations.forEach(function(e){return t.appendChild(e.detach())}),t},hp.find=function(t,e){return R(this.iterations,function(n){return n.find(t,e)})},hp.findAll=function(t,e){return this.iterations.forEach(function(n){return n.findAll(t,e)})},hp.findAllComponents=function(t,e){return this.iterations.forEach(function(n){return n.findAllComponents(t,e)})},hp.findComponent=function(t,e){return R(this.iterations,function(n){return n.findComponent(t,e)})},hp.findContext=function(){return this.context},hp.findNextNode=function(t){var e=this;if(t.indexr;r++)n[r].render(t,e);this.rendered=!0;},hp.shuffle=function(t,e){var n=this;this.pendingNewIndices||(this.previousIterations=this.iterations.slice()),this.pendingNewIndices||(this.pendingNewIndices=[]),this.pendingNewIndices.push(t);var i=[];t.forEach(function(t,r){if(-1!==t){var s=n.iterations[r];i[t]=s,t!==r&&s&&(s.dirty=!0,e&&(s.shouldRebind=1));}}),this.iterations=i,e||this.bubble();},hp.shuffled=function(){this.iterations.forEach(it);},hp.toString=function(t){return this.iterations?this.iterations.map(t?ht:ut).join(""):""},hp.unbind=function(t){this.bound=!1,this.source&&this.source.model.unregister(this.source);for(var e=this.pendingNewIndices?this.previousIterations:this.iterations,n=e.length,i=0;n>i;i++)e[i].unbind(t);return this},hp.unrender=function(t){for(var e=this,n=this.iterations.length,i=0;n>i;i++)e.iterations[i].unrender(t);if(this.pendingNewIndices&&this.previousIterations){n=this.previousIterations.length;for(var r=0;n>r;r++)e.previousIterations[r].unrender(t);}this.rendered=!1;},hp.update=function(){var t=this;if(this.pendingNewIndices)return this.bubbled.length=0,void this.updatePostShuffle();if(!this.updating){if(this.updating=!0,this.shuffler){var e=$s(this,this.shuffler),n=B(this.values,e);n.same?this.iterations.forEach(ot):(this.shuffle(n,!0),this.updatePostShuffle());}else {for(var i=this.iterations.length,r=0;i>r;r++){var a=t.iterations[r];a&&a.idxModel&&a.idxModel.applyValue(r);}var o,u,h,l=this.context.get(),c=this.isArray,f=!0;if(this.isArray=Qa(l)){if(this.source){this.rebounding=1;var d=this.source.model.get();this.iterations.forEach(function(e,n){nl.length&&(o=this.iterations.splice(l.length)));}else if(s(l)&&!c)for(f=!1,o=[],u={},h=this.iterations.length;h--;){var p=t.iterations[h];p.key in l?u[p.key]=!0:(t.iterations.splice(h,1),o.push(p));}var m=Qa(l)?l.length:s(l)?Wa(l).length:0;if(this.length=m,this.updateLast(),f&&(o=this.iterations,this.iterations=[]),o){i=o.length;for(var v=0;i>v;v++)o[v].unbind().unrender(!0);}if(!f&&this.isArray&&this.bubbled&&this.bubbled.length){var g=this.bubbled;this.bubbled=[],i=g.length;for(var y=0;i>y;y++)t.iterations[g[y]]&&t.iterations[g[y]].update();}else {i=this.iterations.length;for(var b=0;i>b;b++)t.iterations[b].update();}var w,x;if(m>this.iterations.length){if(w=this.rendered?ri():null,h=this.iterations.length,Qa(l))for(;hs;)f(y[s])?(h=m[s]=t.createIteration(s,s),n&&(l=p[o],l=l&&n&&l.firstNode()||i,h.render(r),n.insertBefore(r,l)),s++):(a=e[o],-1===a?(p[o]&&p[o].unbind().unrender(!0),p[o++]=0):a>s?(g[a]=p[o],p[o++]=null):(m[s]=h=m[s]||g[s]||t.createIteration(s,s),(g[s]||o!==s)&&(c=t.source&&h.lastValue!==v[s],Us(t,h,s,s)),!n||!g[s]&&p[o]||(l=p[o+1],l=l&&n&&l.firstNode()||i,g[s]?n.insertBefore(h.detach(),l):(h.render(r),n.insertBefore(r,l))),p[o++]=0,s++),h&&u(h)&&((h.shouldRebind||c)&&(h.rebound(c),h.shouldRebind=0),h.update(),h.shuffled()));for(var b=p.length,w=0;b>w;w++)p[w]&&p[w].unbind().unrender(!0);this.shuffler&&(this.values=$s(this,this.shuffler)),this.pendingNewIndices=null,this.previousIterations=null;},up.prototype.getContext=sn,up.prototype.getKeypath=ha;var lp=function(t){function e(e){t.call(this,e),this.isAlias=e.template.t===hu,this.sectionType=e.template.n||this.isAlias&&ju||null,this.templateSectionType=this.sectionType,this.subordinate=1===e.template.l,this.fragment=null;}t&&(e.__proto__=t);var n=e.prototype=Object.create(t&&t.prototype);return n.constructor=e,n.bind=function(){t.prototype.bind.call(this),this.subordinate&&(this.sibling=this.up.items[this.up.items.indexOf(this)-1],this.sibling.nextSibling=this),this.model||this.isAlias?(this.dirty=!0,this.update()):!this.sectionType||this.sectionType!==Ou||this.sibling&&this.sibling.isTruthy()||(this.fragment=new Qp({owner:this,template:this.template.f}).bind());},n.bubble=function(){!this.dirty&&this["yield"]?(this.dirty=!0,this.containerFragment.bubble()):t.prototype.bubble.call(this);},n.detach=function(){var e=this.fragment||this.detached;return e?e.detach():t.prototype.detach.call(this)},n.findNextNode=function(){return (this.containerFragment||this.up).findNextNode(this)},n.isTruthy=function(){if(this.subordinate&&this.sibling.isTruthy())return !0;var t=this.model?this.model.isRoot?this.model.value:this.model.get():void 0;return !(!t||this.templateSectionType!==Tu&&Hs(t))},n.rebind=function(e,n,i){t.prototype.rebind.call(this,e,n,i)&&this.fragment&&this.sectionType!==Cu&&this.sectionType!==Ou&&this.fragment.rebind(e);},n.rebound=function(e){this.model&&(this.model.rebound?this.model.rebound(e):(t.prototype.unbind.call(this),t.prototype.bind.call(this),(this.sectionType===ju||this.sectionType===Tu||this.sectionType===Nu)&&this.fragment&&this.fragment.rebind(this.model),e&&this.bubble())),this.fragment&&this.fragment.rebound(e);},n.render=function(t,e){this.rendered=!0,this.fragment&&this.fragment.render(t,e);},n.shuffle=function(t){this.fragment&&this.sectionType===Nu&&this.fragment.shuffle(t);},n.unbind=function(e){t.prototype.unbind.call(this,e),this.fragment&&this.fragment.unbind(e);},n.unrender=function(t){this.rendered&&this.fragment&&this.fragment.unrender(t),this.rendered=!1;},n.update=function(){var t=this;if(this.dirty&&(this.fragment&&this.sectionType!==Cu&&this.sectionType!==Ou&&(this.fragment.context=this.model),this.model||this.sectionType===Ou||this.isAlias)){this.dirty=!1;var e=this.model?this.model.isRoot?this.model.value:this.model.get():void 0,n=!this.subordinate||!this.sibling.isTruthy(),i=this.sectionType;this["yield"]&&this["yield"]!==e?(this.up=this.containerFragment,this.container=null,this["yield"]=null,this.rendered&&this.fragment.unbind().unrender(!0),this.fragment=null):this.rendered&&!this["yield"]&&e instanceof dc&&(this.rendered&&this.fragment&&this.fragment.unbind().unrender(!0),this.fragment=null),(null===this.sectionType||null===this.templateSectionType)&&(this.sectionType=Zs(e,this.template.i)),i&&i!==this.sectionType&&this.fragment&&(this.rendered&&this.fragment.unbind().unrender(!0),this.fragment=null);var r,s=this.sectionType===Nu||this.sectionType===ju||n&&(this.sectionType===Ou?!this.isTruthy():this.isTruthy())||this.isAlias;if(s)if(this.fragment||(this.fragment=this.detached),this.fragment)this.detached&&(Ws(this,this.fragment),this.detached=!1,this.rendered=!0),this.fragment.bound||this.fragment.bind(this.model),this.fragment.update();else if(this.sectionType===Nu)r=new up({owner:this,template:this.template.f,indexRef:this.template.i}).bind(this.model);else {var a=this.sectionType!==Cu&&this.sectionType!==Ou?this.model:null;e instanceof dc&&(this["yield"]=e,this.containerFragment=this.up,this.up=e.fragment,this.container=e.ractive,a=void 0),r=new Qp({owner:this,template:this.template.f}).bind(a);}else this.fragment&&this.rendered?ql!==!0?this.fragment.unbind().unrender(!0):(this.unrender(!1),this.detached=this.fragment,jl.promise().then(function(){t.detached&&t.detach();})):this.fragment&&this.fragment.unbind(),this.fragment=null;r&&(this.rendered&&Ws(this,r),this.fragment=r),this.nextSibling&&(this.nextSibling.dirty=!0,this.nextSibling.update());}},e}(Ss),cp=function(t){function e(e){t.call(this,e),this.options=[];}t&&(e.__proto__=t);var n=e.prototype=Object.create(t&&t.prototype);return n.constructor=e,n.foundNode=function(t){if(this.binding){var e=ss(t);e.length>0&&(this.selectedOptions=e);}},n.render=function(e,n){t.prototype.render.call(this,e,n),this.sync();for(var i=this.node,r=i.options.length;r--;)i.options[r].defaultSelected=i.options[r].selected;this.rendered=!0;},n.sync=function(){var t=this,e=this.node;if(e){var n=I(e.options);if(this.selectedOptions)return n.forEach(function(e){t.selectedOptions.indexOf(e)>=0?e.selected=!0:e.selected=!1;}),this.binding.setFromNode(e),void delete this.selectedOptions;var i=this.getAttribute("value"),r=this.getAttribute("multiple"),s=r&&Qa(i);if(void 0!==i){var a;n.forEach(function(e){var n=e._ractive?e._ractive.value:e.value,o=r?s&&t.valueContains(i,n):t.compare(i,n);o&&(a=!0),e.selected=o;}),a||r||this.binding&&this.binding.forceUpdate();}else this.binding&&this.binding.forceUpdate&&this.binding.forceUpdate();}},n.valueContains=function(t,e){for(var n=this,i=t.length;i--;)if(n.compare(e,t[i]))return !0},n.compare=function(t,e){var n=this.getAttribute("value-comparator");if(n){if(h(n))return n(e,t);if(e&&t)return e[n]==t[n]}return e==t},n.update=function(){var e=this.dirty;t.prototype.update.call(this),e&&this.sync();},e}(Ed),fp=function(t){function e(e){var n=e.template;e.deferContent=!0,t.call(this,e),this.attributeByName.value||(n.f&&us({template:n})?(this.attributes||(this.attributes=[])).push(aa({owner:this,template:{t:iu,f:n.f,n:"value"},up:this.up})):this.fragment=new Qp({owner:this,cssIds:null,template:n.f}));}t&&(e.__proto__=t);var n=e.prototype=Object.create(t&&t.prototype);return n.constructor=e,n.bubble=function(){var t=this;this.dirty||(this.dirty=!0,this.rendered&&!this.binding&&this.fragment&&jl.scheduleTask(function(){t.dirty=!1,t.node.value=t.fragment.toString();}),this.up.bubble());},e}(Zd),dp=function(t){function e(e){t.call(this,e),this.type=Ho;}t&&(e.__proto__=t);var n=e.prototype=Object.create(t&&t.prototype);return n.constructor=e,n.detach=function(){return ai(this.node)},n.firstNode=function(){return this.node},n.render=function(t,e){Or()||(this.rendered=!0,xs(this,t,e,this.template));},n.toString=function(t){return t?wt(this.template):this.template},n.unrender=function(t){this.rendered&&t&&this.detach(),this.rendered=!1;},n.valueOf=function(){return this.template},e}(Cf),pp=dp.prototype;pp.bind=pp.unbind=pp.update=d;var mp,vp="hidden";if(Xa){var gp;if(vp in Xa)gp="";else for(var yp=ro.length;yp--;){var bp=ro[yp];if(vp=bp+"Hidden",vp in Xa){gp=bp;break}}void 0!==gp?(Xa.addEventListener(gp+"visibilitychange",Gs),Gs()):("onfocusout"in Xa?(Xa.addEventListener("focusout",Qs),Xa.addEventListener("focusin",Ys)):(Ja.addEventListener("pagehide",Qs),Ja.addEventListener("blur",Qs),Ja.addEventListener("pageshow",Ys),Ja.addEventListener("focus",Ys)),mp=!0);}var wp;if(to){var xp={},kp=vc("div").style;wp=function(t){if(!xp[t]){var e=Ee(t);if(void 0!==kp[t])xp[t]=e;else for(var n=ro.length;n--;){var i="-"+ro[n]+"-"+e;if(void 0!==kp[i]){xp[t]=i;break}}}return xp[t]};}else wp=null;var _p,Ep=wp,Sp=new RegExp("^(?:"+ro.join("|")+")([A-Z])");if(to){var Ap,Cp,Op,Np,jp,Tp,Vp=vc("div").style,Pp=function(t){return t},Mp={},Ip={};void 0!==Vp.transition?(Ap="transition",Cp="transitionend",Op=!0):void 0!==Vp.webkitTransition?(Ap="webkitTransition",Cp="webkitTransitionEnd",Op=!0):Op=!1,Ap&&(Np=Ap+"Duration",jp=Ap+"Property",Tp=Ap+"TimingFunction"),_p=function(t,e,n,i,r){setTimeout(function(){function s(){clearTimeout(d);}function a(){c&&f&&(t.unregisterCompleteHandler(s),t.ractive.fire(t.name+":end",t.node,t.isIntro),r());}function o(e){if(e.target===t.node){var n=i.indexOf(e.propertyName);-1!==n&&i.splice(n,1),i.length||(clearTimeout(d),u());}}function u(){m[jp]=v.property,m[Tp]=v.duration,m[Np]=v.timing,t.node.removeEventListener(Cp,o,!1),f=!0,a();}var c,f,d,p=(t.node.namespaceURI||"")+t.node.tagName,m=t.node.style,v={property:m[jp],timing:m[Tp],duration:m[Np]};t.node.addEventListener(Cp,o,!1),d=setTimeout(function(){i=[],u();},n.duration+(n.delay||0)+50),t.registerCompleteHandler(s),m[jp]=i.join(",");var g=Js(n.easing||"linear");m[Tp]=g;var y=m[Tp]===g;m[Np]=n.duration/1e3+"s",setTimeout(function(){for(var r,s,u,d,v,g=i.length,x=null,k=[];g--;){if(u=i[g],r=p+u,y&&Op&&!Ip[r]){var E=m[u];m[u]=e[u],r in Mp||(x=t.getStyle(u),Mp[r]=t.getStyle(u)!=e[u],Ip[r]=!Mp[r],Ip[r]&&(m[u]=E));}y&&Op&&!Ip[r]||(null===x&&(x=t.getStyle(u)),s=i.indexOf(u),-1===s?b("Something very strange happened with transitions. Please raise an issue at https://github.com/ractivejs/ractive/issues - thanks!",{node:t.node}):i.splice(s,1),d=/[^\d]*$/.exec(x)[0],v=_(parseFloat(x),parseFloat(e[u])),v?k.push({name:u,interpolator:v,suffix:d}):m[u]=e[u],x=null);}if(k.length){var S;l(n.easing)?(S=t.ractive.easing[n.easing],S||(w(Eo(n.easing,"easing")),S=Pp)):S=h(n.easing)?n.easing:Pp,new Pl({duration:n.duration,easing:S,step:function(t){for(var e=k.length;e--;){var n=k[e];m[n.name]=n.interpolator(t)+n.suffix;}},complete:function(){c=!0,a();}});}else c=!0;i.length?m[jp]=i.join(","):(m[jp]="none",t.node.removeEventListener(Cp,o,!1),f=!0,a());},0);},n.delay||0);};}else _p=null;var Rp=_p,Bp=Ja&&Ja.getComputedStyle,Kp=Promise.resolve(),Lp={t0:"intro-outro",t1:"intro",t2:"outro"},Dp=function(t){this.owner=t.owner||t.up.owner||Un(t.up),this.element=this.owner.attributeByName?this.owner:Un(t.up),this.ractive=this.owner.ractive,this.template=t.template,this.up=t.up,this.options=t,this.onComplete=[];},Fp=Dp.prototype;Fp.animateStyle=function(t,e,n){var i=this;if(4===arguments.length)throw new Error("t.animateStyle() returns a promise - use .then() instead of passing a callback");if(!mp)return this.setStyle(t,e),Kp;var r;return l(t)?(r={},r[t]=e):(r=t,n=e),new Promise(function(t){if(!n.duration)return i.setStyle(r),void t();for(var e=Wa(r),s=[],a=Bp(i.node),o=e.length;o--;){var u=e[o],h=Ep(u),l=a[Ep(u)],c=i.node.style[h];h in i.originals||(i.originals[h]=i.node.style[h]),i.node.style[h]=r[u],i.targets[h]=i.node.style[h],i.node.style[h]=c,l!=r[u]&&(s.push(h),r[h]=r[u],i.node.style[h]=l);}return s.length?void Rp(i,r,n,s,t):void t()})},Fp.bind=function(){var t=this.options,e=t.template&&t.template.v;e&&(("t0"===e||"t1"===e)&&(this.element.intro=this),("t0"===e||"t2"===e)&&(this.element.outro=this),this.eventName=Lp[e]);var n=this.owner.ractive;this.name=t.name||t.template.n,t.params&&(this.params=t.params),h(this.name)?(this._fn=this.name,this.name=this._fn.name):this._fn=x("transitions",n,this.name),this._fn||w(Eo(this.name,"transition"),{ractive:n}),Yr(this,t.template);},Fp.getParams=function(){if(this.params)return this.params;if(this.fn){var t=Jr(this,this.template,this.up).map(function(t){return t?t.get():void 0});return this.fn.apply(this.ractive,t)}},Fp.getStyle=function(t){var e=Bp(this.node);if(l(t))return e[Ep(t)];if(!Qa(t))throw new Error("Transition$getStyle must be passed a string, or an array of strings representing CSS properties");for(var n={},i=t.length;i--;){var r=t[i],s=e[Ep(r)];"0px"===s&&(s=0),n[r]=s;}return n},Fp.processParams=function(t,e){return c(t)?t={duration:t}:l(t)?t="slow"===t?{duration:600}:"fast"===t?{duration:200}:{duration:400}:t||(t={}),$a({},e,t)},Fp.registerCompleteHandler=function(t){O(this.onComplete,t);},Fp.setStyle=function(e,n){var i=this;if(l(e)){var r=Ep(e);t(this.originals,r)||(this.originals[r]=this.node.style[r]),this.node.style[r]=n,this.targets[r]=this.node.style[r];}else {var s;for(s in e)t(e,s)&&i.setStyle(s,e[s]);}return this},Fp.shouldFire=function(t){if(!this.ractive.transitionsEnabled)return !1;if("intro"===t&&this.ractive.rendering&&Xs("noIntro",this.ractive,!0))return !1;if("outro"===t&&this.ractive.unrendering&&Xs("noOutro",this.ractive,!1))return !1;var e=this.getParams();if(!this.element.parent)return !0;if(e&&e[0]&&s(e[0])&&"nested"in e[0]){if(e[0].nested!==!1)return !0}else if(Xs("nestedTransitions",this.ractive)!==!1)return !0;for(var n=this.element.parent;n;){if(n[t]&&n[t].starting)return !1;n=n.parent;}return !0},Fp.start=function(){var t,e=this,n=this.node=this.element.node,i=this.originals={},r=this.targets={},s=this.getParams();if(this.complete=function(s){if(e.starting=!1,!t){if(e.onComplete.forEach(function(t){return t()}),!s&&e.isIntro)for(var a in r)n.style[a]===r[a]&&(n.style[a]=i[a]);e._manager.remove(e),t=!0;}},!this._fn)return void this.complete();var a=this._fn.apply(this.ractive,[this].concat(s));a&&a.then(this.complete);},Fp.toString=function(){return ""},Fp.unbind=function(){if(!this.element.attributes||!this.element.attributes.unbinding){var t=this.options&&this.options.template&&this.options.template.v;("t0"===t||"t1"===t)&&(this.element.intro=null),("t0"===t||"t2"===t)&&(this.element.outro=null);}},Fp.unregisterCompleteHandler=function(t){P(this.onComplete,t);};var zp=Dp.prototype;zp.destroyed=zp.firstNode=zp.rebound=zp.render=zp.unrender=zp.update=d;var Up,$p,qp={};try{vc("table").innerHTML="foo";}catch(Hp){Up=!0,$p={TABLE:['',"
"],THEAD:['',"
"],TBODY:['',"
"],TR:['',"
"],SELECT:['"]};}var Zp=function(t){function e(e){t.call(this,e);}t&&(e.__proto__=t);var n=e.prototype=Object.create(t&&t.prototype);return n.constructor=e,n.detach=function(){var t=ri();return this.nodes&&this.nodes.forEach(function(e){return t.appendChild(e)}),t},n.find=function(t){var e,n=this,i=this.nodes.length;for(e=0;i>e;e+=1){var r=n.nodes[e];if(1===r.nodeType){if(gc(r,t))return r;var s=r.querySelector(t);if(s)return s}}return null},n.findAll=function(t,e){var n,i=this,r=e.result,s=this.nodes.length;for(n=0;s>n;n+=1){var a=i.nodes[n];if(1===a.nodeType){gc(a,t)&&r.push(a);var o=a.querySelectorAll(t);o&&r.push.apply(r,o);}}},n.findComponent=function(){return null},n.firstNode=function(){return this.rendered&&this.nodes[0]},n.render=function(t,e,n){var i=this;if(!this.nodes){var r=this.model?this.model.get():"";this.nodes=ta(r,t);}var s=this.nodes;if(e){for(var a,o=-1;e.length&&(a=this.nodes[o+1]);)for(var u=void 0;u=e.shift();){var h=u.nodeType;if(h===a.nodeType&&(1===h&&u.outerHTML===a.outerHTML||(3===h||8===h)&&u.nodeValue===a.nodeValue)){i.nodes.splice(++o,1,u);break}t.removeChild(u);}o>=0&&(s=this.nodes.slice(o)),e.length&&(n=e[0]);}if(s.length){var l=ri();s.forEach(function(t){return l.appendChild(t)}),n?t.insertBefore(l,n):t.appendChild(l);}this.rendered=!0;},n.toString=function(){var t=this.model&&this.model.get();return t=null!=t?""+t:"",Vr()?bt(t):t},n.unrender=function(){this.nodes&&this.nodes.forEach(function(t){jl.detachWhenReady({node:t,detach:function(){ai(t);}});}),this.rendered=!1,this.nodes=null;},n.update=function(){this.rendered&&this.dirty?(this.dirty=!1,this.unrender(),this.render(this.up.findParentNode(),null,this.up.findNextNode(this))):this.dirty=!1;},e}($d),Wp={};Wp[hu]=lp,Wp[nu]=Zf,Wp[lu]=sa,Wp[uu]=sd,Wp[Zo]=Hd,Wp[Xo]=Ms,Wp[Go]=lp,Wp[Wo]=Zp,Wp[au]=Ms,Wp[iu]=Kf,Wp[Lu]=Lf,Wp[Bu]=id,Wp[Ru]=Kd,Wp[Ku]=Dp,Wp[tu]=Mr;var Gp={doctype:sd,form:Nd,input:Zd,option:np,select:cp,textarea:fp},Qp=function(t){this.owner=t.owner,this.isRoot=!t.owner.up,this.parent=this.isRoot?null:this.owner.up,this.ractive=t.ractive||(this.isRoot?t.owner:this.parent.ractive),this.componentParent=this.isRoot&&this.ractive.component?this.ractive.component.up:this.owner.containerFragment||null,!this.isRoot||this.ractive.delegate?this.delegate=this.owner.containerFragment?this.owner.containerFragment&&this.owner.containerFragment.delegate:this.componentParent&&this.componentParent.delegate||this.parent&&this.parent.delegate:this.delegate=!1,this.context=null,this.rendered=!1,"cssIds"in t?this.cssIds=t.cssIds&&t.cssIds.length&&t.cssIds:this.cssIds=this.parent?this.parent.cssIds:null,this.dirty=!1,this.dirtyValue=!0,this.template=t.template||[],this.createItems();},Yp=Qp.prototype;Yp.bind=function(t){var e=this;this.context=t,this.owner.template.z&&(this.aliases=ua(this.owner.template.z,this.owner.containerFragment||this.parent));for(var n=this.items.length,i=0;n>i;i++)e.items[i].bind();return this.bound=!0,this.dirty&&this.update(),this},Yp.bubble=function(){this.dirtyValue=!0,this.dirty||(this.dirty=!0,this.isRoot?this.ractive.component?this.ractive.component.bubble():this.bound&&jl.addFragment(this):this.owner.bubble(this.index));},Yp.createItems=function(){var t=this,e=this.template.length;this.items=[];for(var n=0;e>n;n++)t.items[n]=aa({up:t,template:t.template[n],index:n});},Yp.destroyed=function(){for(var t=this,e=this.items.length,n=0;e>n;n++)t.items[n].destroyed();this.pathModel&&this.pathModel.destroyed(),this.rootModel&&this.rootModel.destroyed();},Yp.detach=function(){for(var t=ri(),e=this.items,n=e.length,i=0;n>i;i++)t.appendChild(e[i].detach());return t},Yp.find=function(t,e){return R(this.items,function(n){return n.find(t,e)})},Yp.findAll=function(t,e){this.items&&this.items.forEach(function(n){return n.findAll&&n.findAll(t,e)});},Yp.findComponent=function(t,e){return R(this.items,function(n){return n.findComponent(t,e)})},Yp.findAllComponents=function(t,e){this.items&&this.items.forEach(function(n){return n.findAllComponents&&n.findAllComponents(t,e)});},Yp.findContext=function(){var t=an(this);return t&&t.context?t.context:this.ractive.viewmodel},Yp.findNextNode=function(t){var e=this;if(t)for(var n,i=t.index+1;ir;r++)n[r].render(t,e);},Yp.resetTemplate=function(t){var e=this.bound,n=this.rendered;if(e&&(n&&this.unrender(!0),this.unbind()),this.template=t,this.createItems(),e&&(this.bind(this.context),n)){var i=this.findParentNode(),r=this.findNextNode();if(r){var s=ri();this.render(s),i.insertBefore(s,r);}else this.render(i);}},Yp.shuffled=function(){this.items.forEach(it),this.rootModel&&this.rootModel.applyValue(this.context.getKeypath(this.ractive.root)),this.pathModel&&this.pathModel.applyValue(this.context.getKeypath());},Yp.toString=function(t){return this.items.map(t?ht:ut).join("")},Yp.unbind=function(t){var e=this;if(this.owner.template.z&&!this.owner.yielder){for(var n in e.aliases)e.aliases[n].unreference();this.aliases={};}this.context=null;for(var i=this.items.length,r=0;i>r;r++)e.items[r].unbind(t);return this.bound=!1,this},Yp.unrender=function(t){for(var e=this,n=this.items.length,i=0;n>i;i++)e.items[i].unrender(t);this.rendered=!1;},Yp.update=function(){var t=this;if(this.dirty)if(this.updating)this.isRoot&&jl.addFragmentToRoot(this);else {this.dirty=!1,this.updating=!0;for(var e=this.items.length,n=0;e>n;n++)t.items[n].update();this.updating=!1;}},Yp.valueOf=function(){if(1===this.items.length)return this.items[0].valueOf();if(this.dirtyValue){var t={},e=oa(this.items,t,this.ractive._guid),n=Cs(e,t);this.value=n?n.value:this.toString(),this.dirtyValue=!1;}return this.value},Qp.prototype.getContext=sn,Qp.prototype.getKeypath=ha;var Jp=["template","partials","components","decorators","events"],Xp=Hn("reverse").path,tm=Hn("shift").path,em=Hn("sort").path,nm=Hn("splice").path,im=Hn("unshift").path,rm={add:dn,animate:gn,attachChild:jn,compute:Mn,detach:In,detachChild:Rn,find:Bn,findAll:Kn,findAllComponents:Ln,findComponent:Dn,findContainer:Fn,findParent:zn,fire:Jn,get:Xn,getLocalContext:ti,getContext:ni,insert:hi,link:ci,observe:yi,observeOnce:wi,off:xi,on:ki,once:_i,pop:$c,push:qc,readLink:Ei,render:da,reset:pa,resetPartial:va,resetTemplate:ga,reverse:Xp,set:ya,shift:tm,sort:em,splice:nm,subtract:ba,teardown:Ir,toggle:wa,toCSS:xa,toCss:xa,toHTML:ka,toHtml:ka,toText:_a,transition:Ea,unlink:Sa,unrender:Aa,unshift:im,update:Wn,updateModel:Ca,use:Oa},sm=[],am=/super\s*\(|\.call\s*\(\s*this/;if(Za(za,{sharedGet:{value:Ia},sharedSet:{value:Ma},styleGet:{configurable:!0,value:ja.bind(za)},styleSet:{configurable:!0,value:Li.bind(za)},addCSS:{configurable:!1,value:Ta.bind(za)},hasCSS:{configurable:!1,value:Pa.bind(za)}}),Ja&&!Ja.Ractive){var om="",um=document.currentScript||document.querySelector("script[data-ractive-options]");um&&(om=um.getAttribute("data-ractive-options")||""),~om.indexOf("ForceGlobal")&&(Ja.Ractive=za);}else Ja&&g("Ractive already appears to be loaded while loading 1.4.0.");return $a(za.prototype,rm,go),za.prototype.constructor=za,za.defaults=za.prototype,pl.defaults=za.defaults,pl.Ractive=za,Za(za,{DEBUG:{writable:!0,value:!0},DEBUG_PROMISES:{writable:!0,value:!0},extend:{value:Ba},extendWith:{value:Ka},escapeKey:{value:E},evalObjectString:{value:Cs},findPlugin:{value:Fa},getContext:{value:ei},getCSS:{value:Oi},isInstance:{value:Na},joinKeys:{value:pi},macro:{value:Da},normaliseKeypath:{value:S},parse:{value:Re},splitKeypath:{value:mi},unescapeKey:{value:C},use:{value:Ra},enhance:{writable:!0,value:!1},svg:{value:io},tick:{get:function(){return Nl&&Nl.promise}},VERSION:{value:"1.4.0"},adaptors:{writable:!0,value:{}},components:{writable:!0,value:{}},decorators:{writable:!0,value:{}},easing:{writable:!0,value:yo},events:{writable:!0,value:{}},extensions:{value:[]},helpers:{writable:!0,value:go.helpers},interpolators:{writable:!0,value:So},partials:{writable:!0,value:{}},transitions:{writable:!0,value:{}},cssData:{configurable:!0,value:{}},perComponentStyleElements:{get:Si,set:Si},sharedData:{value:Kl},Ractive:{value:za},Context:{value:zl.Context.prototype}}),Ha(za,"_cssModel",{configurable:!0,value:new lf(za)}),Ha(za.prototype,"rendered",{get:function(){return this.fragment&&this.fragment.rendered}}),za}); - !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).$={});}(window,(function(t){const e=Array.from,n=Reflect.apply,r=Object,o=r.keys,s=r.is,i=r.assign,c=r.getOwnPropertyDescriptor,a=r.defineProperty,l=r.getOwnPropertyNames,u=t=>o(t).length;function h(t){return void 0===t}function p(t){return null===t}function f(t){return !h(t)&&!p(t)}function g(t){return e=>!!f(e)&&e.constructor===t}const d=/\.|\+/,m=Array.isArray,y=g(String),b=g(Number),w=t=>!!f(t)&&"Object("===t.constructor.toString().trim().slice(9,16),A=t=>!!f(t)&&t instanceof Function,v=t=>Boolean(t.length),S=t=>e=>!!f(e)&&t.test(e),C=S(/\.css$/),j=S(/\.json$/),I=S(/\.js$/),O=S(/\.html$/),x=S(/\./),L=/\.([0-9a-z]+)/,E=t=>"Boolean"===t.constructor.name,F=t=>!!t&&t instanceof Promise,k=t=>!!t&&"AsyncFunction"===t.constructor?.name;const M=t=>m(t)&&t||f(t)&&[t]||[],R=t=>t.flat(1/0),T=t=>(t.length=0,t),N=Math,$=N.floor,B=N.random,D=(t,e=0)=>$(B()*(t-e))+e,U=(t,n=t.length)=>{if(t.length<=1)return e(t);const r=e(t);let o,s,i=0;for(;i=0;o--)e(t[o],o,t,r,n);return t}function q(t,e,n){const r=t.length;for(let o=0;o{!0===e(t,o,n,s,i,r)&&n.push(t);})),n}function H(t,e,n=[],r){return _(t,((t,o,s,i)=>{n[o]=e(t,o,n,s,i,r);})),n}function K(t,e,n=[],r){return _(t,((t,o,s,i)=>{const c=e(t,o,n,s,i,r);f(c)&&n.push(c);})),n}const Z=(t,e,n=t.length)=>t.splice(e,n),J=(t,e)=>t.length===e.length&&q(t,((t,n)=>e[n]===t)),V=Math.max,G=async(t,e)=>{const n=t.length;for(let r=0;r{const n=t.length;for(let r=n-1;r>=0;r--)await e(t[r],r,t,n);return t},X=async(t,e)=>{const n=[];return await G(t,(async(t,r,o)=>{n[r]=await e(t,r,o);})),n},Y=(t,e,n)=>n.indexOf(t)===e,tt=(t,e,n)=>t!==n[e-1],et=(t,e)=>e?t.filter(tt):t.filter(Y),nt=(t,e)=>t-e,rt=(t,e)=>e-t,ot=(t,e,n)=>{const r=n?t:0,o=n?e:t,s=n||e;for(let t=r;t(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?-1:0:1:-1)),it=(t,e="id",n=!0)=>(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?1:0:-1:1)),ct=(t,e)=>H(e,(e=>t[e])),at=(t,e,n,r,o)=>{if(t[o]===r)return !0},lt=(t,e)=>{_(o(t),((n,r,o,s)=>{e(t[n],n,t,s,o);}));},ut=(t,e)=>q(o(t),((n,r,o,s)=>e(t[n],n,t,s,o))),ht=(t,e,n={})=>(lt(t,((t,r,o,s,i)=>{!0===e(t,r,n,o,s,i)&&(n[r]=t);})),n),pt=(t,e,n={})=>(lt(t,((t,r,o,s,i)=>{n[r]=e(t,r,n,o,s,i);})),n),ft=(t,e,n={})=>(lt(t,((t,r,o,s,i)=>{const c=e(t,r,n,o,s,i);f(c)&&(n[r]=c);})),n),gt=(t,e)=>t.forEach(e),dt=(t,e)=>(n,r,o)=>{let s;if(f(n))return s=m(n)?t:w(n)||A(n)?e:n.forEach?gt:e,s(n,r,o)},mt=dt(q,ut),yt=dt(_,lt),bt=dt(W,ht),wt=dt(H,pt),At=dt(K,ft),vt=mt,St=(t,e)=>setTimeout(t,e),Ct=(t,e)=>setInterval(t,e),jt=(t,e)=>()=>{ot(0,t((()=>{}),0),(t=>{e(t);}));},It=jt(St,clearTimeout),Ot=jt(Ct,clearInterval),xt=(t,e)=>{const n=o(t);return q(e,(t=>n.includes(t)))},Lt=(t,e)=>{const n={};return _(t,((t,r)=>{n[t]=e[r];})),n},Et=async(t,e)=>{const n=o(t);return await G(n,((r,o,s,i)=>e(t[r],r,t,i,n))),t},Ft=/[-_]/g,kt=/ (.)/g,Mt=(t,e=1)=>t.substr(e),Rt=/%(?![\da-f]{2})/gi,Tt=/&/g,Nt=//g,Bt=/"/g,Dt=t=>decodeURIComponent(t.replace(Rt,(()=>"%25"))),Ut=t=>t.replace(Tt,"&").replace(Nt,"<").replace($t,">").replace(Bt,"""),Pt=/\S+/g,_t=/\w+/g,zt=/ (.)/g,qt=t=>t[0].toUpperCase(),Wt=t=>qt(t)+Mt(t).toLowerCase(),Ht=Reflect.construct;const Kt=Object.create,Zt=(t,e,n=!1,r,s,i)=>{if(t){if(i){const o=i.pop();if(o){const r=e[o];t[o]=Zt(t[o],r,n);}else if(!s)return t;if(s){let o=r||0;if(o++,oglobalThis.structuredClone(t):t=>w(t)?Zt({},t):m(t)?Zt([],t):Kt(t);const Vt=Function.prototype;const Gt=(t,e)=>{if(t===e)return !0;if(t.toString()===e.toString())if(w(t)){const n=o(t);if(xt(e,n))return q(n,(n=>Gt(t[n],e[n])))}else if(m(t)&&t.length===e.length)return q(t,((t,n)=>Gt(t,e[n])));return !1},Qt=/\.|\[/,Xt=/]/g,Yt=t=>t.replace(Xt,"").split(Qt);let te=0;const ee=[],ne={};function re(){let t=ee.shift(ee);return f(t)||(t=te,ne[t]=!0,te++),t}re.free=t=>{ne[t]=null,ee.push(t);};const oe=(t,e)=>{let n=e;return q(Yt(t),(t=>(n=n[t],f(n)))),n},se=JSON,ie=se.parse,ce=se.stringify,ae=(t,e)=>(f(e)&&(ae[t]=e),oe(t,ae)),le=t=>new Promise(t),ue=t=>(...e)=>n=>{let r=n;return t(e,(t=>{r=t(r);})),r},he=ue(_),pe=ue(z),fe=t=>(...e)=>async n=>{let r=n;return await t(e,(async t=>{r=await t(r);})),r},ge=fe(G),de=fe(Q),me=t=>t?me[t]:o(me),ye=globalThis.navigator?.userAgentData;if(ye)lt(ye,((t,e)=>{E(t)&&t&&(me[e]=t);})),_(ye.brands,(t=>{me[t.brand]=t.version;}));else if(navigator.userAgent){let t=navigator.userAgent.toLowerCase();t=t.replace(/_/g,"."),t=t.replace(/[#_,;()]/g,"");_(t.split(/ |\//),(t=>{me[t]=!0;}));}const be=(t,...e)=>(t.addEventListener(...e),t),we=document.createDocumentFragment.bind(document),Ae=(t,e)=>(t.appendChild(e),e),ve=(t,e)=>m(e)?Lt(e,H(e,(e=>t.getAttribute(e)))):(lt(e,((e,n)=>{t.setAttribute(n,e);})),t),Se=/^.[\w_-]+$/,Ce=/^[A-Za-z]+$/,je=/\s/,Ie=document.getElementsByClassName.bind(document),Oe=document.getElementsByTagName.bind(document),xe=document.getElementById.bind(document),Le=document.querySelector.bind(document),Ee=document.querySelectorAll.bind(document),Fe=document.createElement.bind(document),ke=t=>{const e=x(t)&&t||`${t}.js`;return (t=>le((e=>{be(t,"load",e,!0),be(t,"error",e,!0),Ae(Le("head"),t);})))(ve(Fe("script"),{async:"",src:e}))},Me=t=>{const e=document.readyState;return "interactive"===e||"completed"===e||"complete"===e?!t||t():(t&&be(document,"DOMContentLoaded",t),!1)};Me((()=>{const t=xe("AcidLib"),e=t&&t.getAttribute("data-index")||"/index";ke(e);}));const Re=location.protocol,Te="http:"===Re?"ws":"wss",Ne=location.hostname,$e={hardware:{cores:navigator.hardwareConcurrency},host:{name:Ne,protocol:Re,protocolSocket:Te}},Be=()=>{i($e,{bodyHeight:document.body.offsetHeight,bodyWidth:document.body.offsetWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth});},De=()=>{Be();};Me(De),be(window,"load",De,!0),be(window,"resize",De,!0);class Ue{constructor(t={}){this.items=t;}getItem(t){return this.items[t]}setItem(t,e){this.items[t]=e;}clear(){this.items={};}removeItem(t){this.items[t]=null;}}function Pe(){return new Ue}t.hasLocal=void 0,function(e){try{e().removeItem("TESTING"),t.hasLocal=!0;}catch(e){t.hasLocal=!1;}}((()=>localStorage));class _e{constructor(t){this.hasLocal&&(this.local=localStorage),this.storage=Pe();}hasLocal=t.hasLocal;setItem(t,e){return this.hasLocal&&this.local.setItem(t,y(e)?e:ce(e)),this.storage.setItem(t,e)}getItem(t){const e=this.storage.getItem(t);return f(e)?e:!f(e)&&this.hasLocal?this.local.getItem(t):void 0}clear(){this.hasLocal&&this.local.clear(),this.storage.clear();}removeItem(t){this.hasLocal&&this.local.removeItem(t),this.storage.removeItem(t);}}const ze=(t,e)=>`color:${t};background:${e};`,qe={alert:ze("#fff","#f44336"),important:ze("#fff","#E91E63"),notify:ze("#fff","#651FFF"),warning:ze("#000","#FFEA00")};t.Crate=_e,t.VirtualStorage=Ue,t.add=(t,e)=>t+e,t.after=(t,e)=>{let n,r=t;return (...t)=>(null!==r&&r--,r<=0&&(n=e(...t),r=null),n)},t.append=Ae,t.apply=n,t.arrayToObject=(t,e)=>{const n={};return _(t,((t,r)=>{n[e[r]]=t;})),n},t.ary=(t,e)=>(...n)=>t(...n.splice(0,e)),t.assign=i,t.assignDeep=Zt,t.asyncEach=async(t,e)=>{const n=t.length;for(let r=0;r{let n,r=t;return (...t)=>(null!==r&&r--,r>=1?n=e(...t):r=null,n)},t.bindAll=(t,e)=>wt(t,(t=>A(t)?t.bind(e):t)),t.cacheNativeMethod=function(t){return Vt.call.bind(t)},t.camelCase=t=>t.toLowerCase().replace(kt,(t=>t.toUpperCase().replace(/ /g,""))),t.chain=t=>{const e=t=>(e.value=t,e.methods);return i(e,{add:t=>((t,e)=>(yt(e,((e,n)=>{t.methods[n]=(...n)=>(e(t.value,...n),t.methods);})),t))(e,t),done(){const t=e.value;return e.value=null,t},methods:{}}),e.add(t),e},t.chunk=(t,e=1)=>{const n=[];let r=0;return t.forEach(((t,o)=>{o%e||(n.push([]),o&&r++),n[r].push(t);})),n},t.chunkString=(t,e)=>t.match(new RegExp(`(.|[\r\n]){1,${e}}`,"g")),t.clear=T,t.clearIntervals=Ot,t.clearTimers=It,t.cloneArray=t=>t.slice(),t.cnsl=(t,e)=>{const n=y(t)?t:ce(t);if("alert"===e||"warning"===e)return console.trace(`%c${n}`,`${qe[e]}font-size:13px;padding:2px 5px;border-radius:2px;`);console.log(`%c${n}`,`${qe[e]}font-size:13px;padding:2px 5px;border-radius:2px;`);},t.cnslTheme=(t,e,n)=>{qe[t]=ze(e,n);},t.compact=t=>t.filter((t=>!(y(t)&&!t.length)&&t)),t.compactKeys=t=>{const e=[];return lt(t,((t,n)=>{t&&e.push(n);})),e},t.compactMap=At,t.compactMapArray=K,t.compactMapAsync=async(t,e)=>{const n=[];let r;return await G(t,(async(t,o,s)=>{r=await e(t,o,n,s),f(r)&&n.push(r);})),n},t.compactMapObject=ft,t.compactMapObjectAsync=async(t,e,n={})=>(await Et(t,(async(t,r,o,s,i)=>{const c=await e(t,r,n,s,i);f(c)&&(n[r]=c);})),n),t.construct=function(t,e=[],n){return n?Ht(t,e,n):Ht(t,e)},t.countBy=(t,e)=>{const n={};let r;return _(t,(t=>{r=e(t),n[r]||(n[r]=0),n[r]++;})),n},t.countKey=(t,e)=>{let n=0;return _(t,(t=>{t[e]&&n++;})),n},t.countWithoutKey=(t,e)=>{let n=0;return _(t,(t=>{t[e]||n++;})),n},t.crate=function(t){return new _e(t)},t.createFragment=we,t.curry=(t,e=t.length)=>{const n=[],r=(...o)=>{if(n.push(...o),n.length===e){const e=t(...n);return T(n),e}return r};return r},t.curryRight=(t,e=t.length)=>{const n=[],r=(...o)=>{if(n.unshift(...o),n.length===e){const e=t(...n);return T(n),e}return r};return r},t.debounce=(t,e)=>{let n=!1;const r=(...r)=>{!1!==n&&clearTimeout(n),n=St((()=>{t(...r),n=!1;}),e);};return r.clear=()=>{n&&(clearTimeout(n),n=!1);},r},t.decimalCheck=d,t.deduct=t=>t-1,t.defineProperty=a,t.difference=(t,...e)=>{const n=R(e);return K(t,(t=>{if(!n.includes(t))return t}))},t.divide=(t,e)=>t/e,t.drop=Z,t.dropRight=(t,e,n=t.length)=>Z(t,0,n-e),t.each=yt,t.eachArray=_,t.eachArrayRight=z,t.eachAsync=G,t.eachAsyncRight=Q,t.eachObject=lt,t.eachObjectAsync=Et,t.eachWhile=mt,t.ensureArray=M,t.eventAdd=be,t.eventRemove=(t,...e)=>(t.removeEventListener(...e),t),t.every=vt,t.filter=bt,t.filterArray=W,t.filterObject=ht,t.findIndex=(t,e,n="id")=>{const r=t.findIndex(((t,r)=>at(t,0,0,e,n)));return -1!==r&&r},t.findItem=(t,e,n="id")=>{const r=t.find(((t,r)=>at(t,0,0,e,n)));return -1!==r&&r},t.first=(t,e)=>e?t.slice(0,e):t[0],t.flatten=(t,e=1)=>{let n=t;for(let t=0;tt.concat(M(e))),[]);return n},t.flattenDeep=R,t.flow=he,t.flowAsync=ge,t.flowAsyncRight=de,t.flowRight=pe,t.get=oe,t.getByClass=Ie,t.getById=xe,t.getByTag=Oe,t.getExtensionRegex=L,t.getFileExtension=t=>{const e=t.match(L);if(e)return e[1]},t.getNewest=(t,e)=>st(t,e,!1)[0],t.getOldest=(t,e="id")=>it(t,e)[0],t.getOwnPropertyDescriptor=c,t.getOwnPropertyNames=l,t.groupBy=(t,e)=>{const n={};return _(t,(t=>{const r=e(t);n[r]||(n[r]=[]),n[r].push(t);})),n},t.has=(t,...e)=>t.includes(...e),t.hasAnyKeys=(t,e)=>{const n=o(t);return Boolean(e.find((t=>n.includes(t))))},t.hasDot=x,t.hasKeys=xt,t.hasLength=v,t.hasValue=f,t.htmlEntities=Ut,t.ifInvoke=(t,...e)=>{if(A(t))return t(...e)},t.ifNotEqual=(t,e,n)=>(e&&!f(t[e])&&(t[e]=n),t),t.importjs=ke,t.inAsync=async(t,e)=>G(t,(async t=>{await t(e);})),t.inSync=(t,e)=>yt(t,(t=>{t(e);})),t.increment=t=>t+1,t.indexBy=(t,e="id")=>{const n={};return _(t,(t=>{n[t[e]]=t;})),n},t.info=$e,t.initial=t=>t.slice(0,t.length-1),t.initialString=(t,e=1)=>t.slice(0,-1*e),t.insertInRange=(t,e,n)=>t.slice(0,e)+n+t.slice(e,t.length),t.intersect=(t,...e)=>K(t,(t=>{if(q(e,(e=>e.includes(t))))return t})),t.interval=Ct,t.invert=(t,e={})=>(lt(t,((t,n)=>{e[t]=n;})),e),t.invoke=(t,e,n)=>H(t,((t,r)=>t[e](n,r))),t.invokeAsync=(t,e,n)=>X(t,(async(t,r)=>t[e](n,r))),t.is=s,t.isAgent=me,t.isArguments=function(t){return !!f(t)&&"[object Arguments]"===t.toString()},t.isArray=m,t.isAsync=k,t.isBoolean=E,t.isBuffer=function(t){return !!f(t)&&"ArrayBuffer"===t.constructor?.name},t.isConstructor=g,t.isDate=t=>t instanceof Date,t.isDecimal=t=>d.test(t.toString()),t.isDocumentReady=Me,t.isDom=t=>t&&9!==t.nodeType,t.isEmpty=t=>y(t)||m(t)?!v(t):w(t)?!u(t):!f(t),t.isEnter=t=>13===t.keyCode,t.isEqual=Gt,t.isFileCSS=C,t.isFileHTML=O,t.isFileJS=I,t.isFileJSON=j,t.isFloat32=function(t){return !!f(t)&&"Float32Array"===t.constructor?.name},t.isFloat64=function(t){return !!f(t)&&"Float64Array"===t.constructor?.name},t.isFunction=A,t.isHTMLCollection=function(t){return !!f(t)&&"[object HTMLCollection]"===t.toString()},t.isInt16=function(t){return !!f(t)&&"Int16Array"===t.constructor?.name},t.isInt32=function(t){return !!f(t)&&"Int32Array"===t.constructor?.name},t.isInt8=function(t){return !!f(t)&&"Int8Array"===t.constructor?.name},t.isKindAsync=t=>!!t&&(F(t)||k(t)),t.isMap=function(t){return !!f(t)&&"[object Map]"===t.toString()},t.isMatchArray=J,t.isMatchObject=(t,e)=>{const n=o(t);return !!J(n,o(e))&&q(n,(n=>t[n]===e[n]))},t.isNodeList=function(t){return !!f(t)&&"[object NodeList]"===t.toString()},t.isNull=p,t.isNumber=b,t.isNumberEqual=(t,e)=>t===e,t.isNumberInRange=(t,e,n)=>t>e&&t"__proto__"!==t&&"constructor"!==t&&"prototype"!==t,t.isPromise=F,t.isRegExp=t=>t instanceof RegExp,t.isSet=function(t){return !!f(t)&&"[object Set]"===t.toString()},t.isString=y,t.isUint16=function(t){return !!f(t)&&"Uint16Array"===t.constructor?.name},t.isUint32=function(t){return !!f(t)&&"Uint32Array"===t.constructor?.name},t.isUint8=function(t){return !!f(t)&&"Uint8Array"===t.constructor?.name},t.isUint8Clamped=function(t){return !!f(t)&&"Uint8ClampedArray"===t.constructor?.name},t.isUndefined=h,t.isWeakMap=function(t){return !!f(t)&&"[object WeakMap]"===t.toString()},t.isZero=t=>0===t,t.jsonParse=ie,t.kebabCase=t=>t.replace(Ft," ").trim().toLowerCase().replace(kt,"-$1"),t.keys=o,t.largest=t=>V(...t),t.last=(t,e)=>{const n=t.length;return e?t.slice(n-e,n):t[n-1]},t.map=wt,t.mapArray=H,t.mapArrayRight=function(t,e,n=[],r){let o=0;const s=t.length;for(let i=s-1;i>=0;i--)n[o]=e(t[i],i,t,s,r),o++;return n},t.mapAsync=X,t.mapObject=pt,t.mapObjectAsync=async(t,e,n={})=>(await Et(t,(async(t,r,o,s,i)=>{n[r]=await e(t,r,n,o,s,i);})),n),t.mapWhile=function(t,e,n=[],r){const o=t.length;for(let s=0;st-e,t.model=ae,t.multiply=(t,e)=>t*e,t.negate=t=>(...e)=>!t(...e),t.nodeAttribute=ve,t.noop=()=>{},t.nthArg=(t=0)=>(...e)=>e[t],t.numSort=t=>t.sort(nt),t.numericalCompare=nt,t.numericalCompareReverse=rt,t.objectCreate=Kt,t.objectSize=u,t.omit=(t,e)=>ht(t,((t,n)=>!e.includes(n))),t.once=t=>{let e;return (...n)=>(f(e)||(e=t(...n)),e)},t.over=t=>(...e)=>wt(t,(t=>t(...e))),t.overEvery=t=>(...e)=>mt(t,(t=>t(...e))),t.partition=(t,e)=>{const n=[];return [K(t,(t=>{if(e(t))return t;n.push(t);})),n]},t.pick=(t,e,n={})=>(_(e,(e=>{n[e]=t[e];})),n),t.pluck=(t,e)=>H(t,(t=>t[e])),t.pluckObject=ct,t.pluckValues=(t,e)=>H(t,(t=>ct(t,e))),t.promise=le,t.propertyMatch=(t,e,n=o(t))=>q(n,(n=>Gt(t[n],e[n]))),t.querySelector=Le,t.querySelectorAll=Ee,t.rNumSort=t=>t.sort(rt),t.randomArbitrary=(t,e=0)=>B()*(t-e)+e,t.randomInt=D,t.range=(t,e,n=1)=>t{const r=[];let o=t;for(;o{const r=n<0?-1*n:n,o=[];let s=t;for(;s>e;)o.push(s),s-=r;return o})(t,e,n),t.rawURLDecode=Dt,t.reArg=(t,e)=>(...n)=>t(...e.map((t=>n[t]))),t.regexGenerator=S,t.remainder=(t,e)=>t%e,t.remove=(t,e)=>{let n=t.length;for(let r=0;r{let n=t.length;for(let r=0;rt.replace(new RegExp(`\\b${e.join("|")}\\b`,"gi"),n),t.rest=t=>t.slice(1,t.length),t.restString=Mt,t.right=(t,e)=>t[t.length-1-e],t.rightString=(t,e=1)=>t[t.length-e],t.sample=(t,e=1)=>{if(!t)return !1;const n=t.length;if(n===e||e>n)return U(t);if(1===e)return [t[D(n-1,0)]];const r=[],o={};let s,i=0;for(;iUt(Dt(t)),t.saveDimensions=Be,t.selector=t=>{switch(t[0]){case"#":if(!je.test(t))return xe(Mt(t));break;case".":if(Se.test(t))return Ie(Mt(t));break;default:if(Ce.test(t))return Oe(t)}return Ee(t)},t.shuffle=U,t.smallest=t=>P(...t),t.snakeCase=t=>t.replace(Ft," ").trim().toLowerCase().replace(kt,"_$1"),t.sortAlphabetical=(t,e)=>t.sort(((t,n)=>{const r=t[e],o=n[e];return ro?1:0})),t.sortNewest=st,t.sortOldest=it,t.sortedIndex=(t,e)=>{let n=0;return q(t,((t,r)=>(n=r,e>t))),n},t.stringify=ce,t.stubArray=()=>[],t.stubFalse=()=>!1,t.stubObject=()=>({}),t.stubString=()=>"",t.stubTrue=()=>!0,t.sum=t=>t.reduce(((t,e)=>t+e),0),t.take=(t,e=1)=>t.slice(0,e),t.takeRight=(t,e=1)=>{const n=t.length;return t.slice(n-e,n)},t.themes=qe,t.throttle=(t,e)=>{let n,r=!1;const o=(...o)=>{r?n=!0:(t(...o),r=St((()=>{n&&t(...o),r=!1;}),e));};return o.clear=()=>{clearTimeout(r),r=!1;},o},t.timer=St,t.times=ot,t.timesMap=(t,e,n,r=[])=>{const o=n?t:0,s=n?e:t,i=n||e;let c;return ot(o,s,(t=>{c=i(t,o,s,r),f(c)&&r.push(c);})),r},t.toArray=e,t.toPath=Yt,t.toggle=(t,e=!0,n=!1)=>Gt(e,t)?n:e,t.tokenize=t=>t.match(Pt)||[],t.truncate=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),o=r.length;let s,i=n-e;for(;i=0&&(s=r[i]," "!==s);i--);return t.slice(0,i).trim()})(t,e,n):t},t.truncateRight=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),o=r.length;let s,i=e;for(;i0&&(s=r[i]," "!==s);i++);return t.substr(i,n).trim()})(t,e,n):t},t.uid=re,t.unZip=t=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.unZipObject=t=>{const e=[],n=[];return lt(t,((t,r)=>{e.push(r),n.push(t);})),[e,n]},t.union=(...t)=>et(R(t)),t.unique=et,t.updateDimensions=De,t.upperCase=t=>t.replace(Ft," ").trim().toUpperCase(),t.upperFirst=t=>qt(t)+Mt(t),t.upperFirstAll=t=>t.replace(zt,(t=>t.toUpperCase())),t.upperFirstLetter=qt,t.upperFirstOnly=Wt,t.upperFirstOnlyAll=t=>Wt(t.toLowerCase()).replace(zt,(t=>t.toUpperCase())),t.virtualStorage=Pe,t.whileArray=q,t.whileCompactMap=function(t,e,n=[],r){let o=0;for(;ot.filter((t=>!e.includes(t))),t.words=t=>t.match(_t)||[],t.wrap=(t,e)=>(...n)=>e(t,...n),t.xor=(...t)=>{const e=[];return _(t,(t=>{_(et(t),(t=>{e.includes(t)?e.splice(e.indexOf(t),1):e.push(t);}));})),e},t.zip=(...t)=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.zipObject=Lt,Object.defineProperty(t,"__esModule",{value:!0});})); + !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).$={});}(window,(function(t){const e=Array.from,n=Reflect.apply,r=Object,o=r.keys,s=r.is,i=r.assign,c=r.getOwnPropertyDescriptor,a=r.defineProperty,l=r.getOwnPropertyNames,u=t=>o(t).length;function h(t){return void 0===t}function f(t){return null===t}function p(t){return !h(t)&&!f(t)}function d(t){return e=>!!p(e)&&e.constructor===t}const g=/\.|\+/,m=Array.isArray,y=d(String),b=d(Number),w=t=>!!p(t)&&"Object("===t.constructor.toString().trim().slice(9,16),A=t=>!!p(t)&&t instanceof Function,v=t=>Boolean(t.length),S=t=>e=>!!p(e)&&t.test(e),C=S(/\.css$/),j=S(/\.json$/),I=S(/\.js$/),O=S(/\.html$/),x=S(/\./),L=/\.([0-9a-z]+)/,E=t=>"Boolean"===t.constructor.name,F=t=>!!t&&t instanceof Promise,k=t=>!!t&&"AsyncFunction"===t.constructor?.name;const M=t=>m(t)&&t||p(t)&&[t]||[],R=t=>t.flat(1/0),T=t=>(t.length=0,t),N=Math,$=N.floor,B=N.random,D=(t,e=0)=>$(B()*(t-e))+e,U=(t,n=t.length)=>{if(t.length<=1)return e(t);const r=e(t);let o,s,i=0;for(;i=0;o--)e(t[o],o,t,r,n);return t}function W(t,e,n){const r=t.length;for(let o=0;o{!0===e(t,o,n,s,i,r)&&n.push(t);})),n}function _(t,e,n=[],r){return z(t,((t,o,s,i)=>{n[o]=e(t,o,n,s,i,r);})),n}function K(t,e,n=[],r){return z(t,((t,o,s,i)=>{const c=e(t,o,n,s,i,r);p(c)&&n.push(c);})),n}const Z=(t,e,n=t.length)=>t.splice(e,n),J=(t,e)=>t.length===e.length&&W(t,((t,n)=>e[n]===t)),V=Math.max,G=async(t,e)=>{const n=t.length;for(let r=0;r{const n=t.length;for(let r=n-1;r>=0;r--)await e(t[r],r,t,n);return t},X=async(t,e)=>{const n=[];return await G(t,(async(t,r,o)=>{n[r]=await e(t,r,o);})),n},Y=(t,e,n)=>n.indexOf(t)===e,tt=(t,e,n)=>t!==n[e-1],et=(t,e)=>e?t.filter(tt):t.filter(Y),nt=(t,e)=>t-e,rt=(t,e)=>e-t,ot=(t,e,n)=>{const r=n?t:0,o=n?e:t,s=n||e;for(let t=r;t(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?-1:0:1:-1)),it=(t,e="id",n=!0)=>(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?1:0:-1:1)),ct=(t,e)=>_(e,(e=>t[e])),at=(t,e,n,r,o)=>{if(t[o]===r)return !0},lt=(t,e)=>{z(o(t),((n,r,o,s)=>{e(t[n],n,t,s,o);}));},ut=(t,e)=>W(o(t),((n,r,o,s)=>e(t[n],n,t,s,o))),ht=(t,e,n={})=>(lt(t,((t,r,o,s,i)=>{!0===e(t,r,n,o,s,i)&&(n[r]=t);})),n),ft=(t,e,n={})=>(lt(t,((t,r,o,s,i)=>{n[r]=e(t,r,n,o,s,i);})),n),pt=(t,e,n={})=>(lt(t,((t,r,o,s,i)=>{const c=e(t,r,n,o,s,i);p(c)&&(n[r]=c);})),n),dt=(t,e)=>t.forEach(e),gt=(t,e)=>(n,r,o)=>{let s;if(p(n))return s=m(n)?t:w(n)||A(n)?e:n.forEach?dt:e,s(n,r,o)},mt=gt(W,ut),yt=gt(z,lt),bt=gt(H,ht),wt=gt(_,ft),At=gt(K,pt),vt=mt,St=(t,e)=>setTimeout(t,e),Ct=(t,e)=>setInterval(t,e),jt=(t,e)=>()=>{ot(0,t((()=>{}),0),(t=>{e(t);}));},It=jt(St,clearTimeout),Ot=jt(Ct,clearInterval),xt=(t,e)=>{const n=o(t);return W(e,(t=>n.includes(t)))},Lt=(t,e)=>{const n={};return z(t,((t,r)=>{n[t]=e[r];})),n},Et=async(t,e)=>{const n=o(t);return await G(n,((r,o,s,i)=>e(t[r],r,t,i,n))),t},Ft=/[-_]/g,kt=/ (.)/g,Mt=(t,e=1)=>t.substr(e),Rt=/%(?![\da-f]{2})/gi,Tt=/&/g,Nt=//g,Bt=/"/g,Dt=t=>decodeURIComponent(t.replace(Rt,(()=>"%25"))),Ut=t=>t.replace(Tt,"&").replace(Nt,"<").replace($t,">").replace(Bt,"""),Pt=/\S+/g,zt=/\w+/g,qt=/ (.)/g,Wt=t=>t[0].toUpperCase(),Ht=t=>Wt(t)+Mt(t).toLowerCase(),_t=Reflect.construct;function Kt(t,e=[],n){return n?_t(t,e,n):_t(t,e)}const Zt=Object.create,Jt=(t,e,n=!1,r,s,i)=>{if(t){if(i){const o=i.pop();if(o){const r=e[o];t[o]=Jt(t[o],r,n);}else if(!s)return t;if(s){let o=r||0;if(o++,oglobalThis.structuredClone(t):t=>w(t)?Jt({},t):m(t)?Jt([],t):Zt(t);const Gt=Function.prototype;const Qt=(t,e)=>{if(t===e)return !0;if(t.toString()===e.toString())if(w(t)){const n=o(t);if(xt(e,n))return W(n,(n=>Qt(t[n],e[n])))}else if(m(t)&&t.length===e.length)return W(t,((t,n)=>Qt(t,e[n])));return !1},Xt=/\.|\[/,Yt=/]/g,te=t=>t.replace(Yt,"").split(Xt);let ee=0;const ne=[],re={};function oe(){let t=ne.shift(ne);return p(t)||(t=ee,re[t]=!0,ee++),t}oe.free=t=>{re[t]=null,ne.push(t);};const se=(t,e)=>{let n=e;return W(te(t),(t=>(n=n[t],p(n)))),n},ie=JSON,ce=ie.parse,ae=ie.stringify;class le{static models={};constructor(t,e){p(e)?(i(this,e),this.modelName=t,le.models.set(t,e)):i(this,t);}}const ue=t=>new Promise(t),he=t=>(...e)=>n=>{let r=n;return t(e,(t=>{r=t(r);})),r},fe=he(z),pe=he(q),de=t=>(...e)=>async n=>{let r=n;return await t(e,(async t=>{r=await t(r);})),r},ge=de(G),me=de(Q);class ye{constructor(t={}){this.items=t;}getItem(t){return this.items[t]}setItem(t,e){this.items[t]=e;}clear(){this.items={};}removeItem(t){this.items[t]=null;}}function be(){return new ye}const we=t=>t?we[t]:o(we),Ae=globalThis.navigator?.userAgentData;if(Ae)lt(Ae,((t,e)=>{E(t)&&t&&(we[e]=t);})),z(Ae.brands,(t=>{we[t.brand]=t.version;}));else if(navigator.userAgent){let t=navigator.userAgent.toLowerCase();t=t.replace(/_/g,"."),t=t.replace(/[#_,;()]/g,"");z(t.split(/ |\//),(t=>{we[t]=!0;}));}const ve=(t,...e)=>(t.addEventListener(...e),t),Se=document.createDocumentFragment.bind(document),Ce=(t,e)=>(t.appendChild(e),e),je=(t,e)=>m(e)?Lt(e,_(e,(e=>t.getAttribute(e)))):(lt(e,((e,n)=>{t.setAttribute(n,e);})),t),Ie=/^.[\w_-]+$/,Oe=/^[A-Za-z]+$/,xe=/\s/,Le=document.getElementsByClassName.bind(document),Ee=document.getElementsByTagName.bind(document),Fe=document.getElementById.bind(document),ke=document.querySelector.bind(document),Me=document.querySelectorAll.bind(document),Re=document.createElement.bind(document),Te=t=>{const e=x(t)&&t||`${t}.js`;return (t=>ue((e=>{ve(t,"load",e,!0),ve(t,"error",e,!0),Ce(ke("head"),t);})))(je(Re("script"),{async:"",src:e}))},Ne=t=>{const e=document.readyState;return "interactive"===e||"completed"===e||"complete"===e?!t||t():(t&&ve(document,"DOMContentLoaded",t),!1)};Ne((()=>{const t=Fe("AcidLib"),e=t&&t.getAttribute("data-index")||"/index";Te(e);}));const $e=location.protocol,Be="http:"===$e?"ws":"wss",De=location.hostname,Ue={hardware:{cores:navigator.hardwareConcurrency},host:{name:De,protocol:$e,protocolSocket:Be}},Pe=()=>{i(Ue,{bodyHeight:document.body.offsetHeight,bodyWidth:document.body.offsetWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth});},ze=()=>{Pe();};Ne(ze),ve(window,"load",ze,!0),ve(window,"resize",ze,!0),t.hasLocal=void 0,function(e){try{e().removeItem("TESTING"),t.hasLocal=!0;}catch(e){t.hasLocal=!1;}}((()=>localStorage));class qe{constructor(t){this.hasLocal&&(this.local=localStorage),this.storage=be();}hasLocal=t.hasLocal;setItem(t,e){return this.hasLocal&&this.local.setItem(t,y(e)?e:ae(e)),this.storage.setItem(t,e)}getItem(t){const e=this.storage.getItem(t);return p(e)?e:!p(e)&&this.hasLocal?this.local.getItem(t):void 0}clear(){this.hasLocal&&this.local.clear(),this.storage.clear();}removeItem(t){this.hasLocal&&this.local.removeItem(t),this.storage.removeItem(t);}}const We=(t,e)=>`color:${t};background:${e};`,He={alert:We("#fff","#f44336"),important:We("#fff","#E91E63"),notify:We("#fff","#651FFF"),warning:We("#000","#FFEA00")};t.Crate=qe,t.Model=le,t.VirtualStorage=ye,t.add=(t,e)=>t+e,t.after=(t,e)=>{let n,r=t;return (...t)=>(null!==r&&r--,r<=0&&(n=e(...t),r=null),n)},t.append=Ce,t.apply=n,t.arrayToObject=(t,e)=>{const n={};return z(t,((t,r)=>{n[e[r]]=t;})),n},t.ary=(t,e)=>(...n)=>t(...n.splice(0,e)),t.assign=i,t.assignDeep=Jt,t.asyncEach=async(t,e)=>{const n=t.length;for(let r=0;r{let n,r=t;return (...t)=>(null!==r&&r--,r>=1?n=e(...t):r=null,n)},t.bindAll=(t,e)=>wt(t,(t=>A(t)?t.bind(e):t)),t.cacheNativeMethod=function(t){return Gt.call.bind(t)},t.camelCase=t=>t.toLowerCase().replace(kt,(t=>t.toUpperCase().replace(/ /g,""))),t.chain=t=>{const e=t=>(e.value=t,e.methods);return i(e,{add:t=>((t,e)=>(yt(e,((e,n)=>{t.methods[n]=(...n)=>(e(t.value,...n),t.methods);})),t))(e,t),done(){const t=e.value;return e.value=null,t},methods:{}}),e.add(t),e},t.chunk=(t,e=1)=>{const n=[];let r=0;return t.forEach(((t,o)=>{o%e||(n.push([]),o&&r++),n[r].push(t);})),n},t.chunkString=(t,e)=>t.match(new RegExp(`(.|[\r\n]){1,${e}}`,"g")),t.clear=T,t.clearIntervals=Ot,t.clearTimers=It,t.cloneArray=t=>t.slice(),t.cnsl=(t,e)=>{const n=y(t)?t:ae(t);if("alert"===e||"warning"===e)return console.trace(`%c${n}`,`${He[e]}font-size:13px;padding:2px 5px;border-radius:2px;`);console.log(`%c${n}`,`${He[e]}font-size:13px;padding:2px 5px;border-radius:2px;`);},t.cnslTheme=(t,e,n)=>{He[t]=We(e,n);},t.compact=t=>t.filter((t=>!(y(t)&&!t.length)&&t)),t.compactKeys=t=>{const e=[];return lt(t,((t,n)=>{t&&e.push(n);})),e},t.compactMap=At,t.compactMapArray=K,t.compactMapAsync=async(t,e)=>{const n=[];let r;return await G(t,(async(t,o,s)=>{r=await e(t,o,n,s),p(r)&&n.push(r);})),n},t.compactMapObject=pt,t.compactMapObjectAsync=async(t,e,n={})=>(await Et(t,(async(t,r,o,s,i)=>{const c=await e(t,r,n,s,i);p(c)&&(n[r]=c);})),n),t.construct=Kt,t.countBy=(t,e)=>{const n={};let r;return z(t,(t=>{r=e(t),n[r]||(n[r]=0),n[r]++;})),n},t.countKey=(t,e)=>{let n=0;return z(t,(t=>{t[e]&&n++;})),n},t.countWithoutKey=(t,e)=>{let n=0;return z(t,(t=>{t[e]||n++;})),n},t.crate=function(t){return new qe(t)},t.createFragment=Se,t.curry=(t,e=t.length)=>{const n=[],r=(...o)=>{if(n.push(...o),n.length===e){const e=t(...n);return T(n),e}return r};return r},t.curryRight=(t,e=t.length)=>{const n=[],r=(...o)=>{if(n.unshift(...o),n.length===e){const e=t(...n);return T(n),e}return r};return r},t.debounce=(t,e)=>{let n=!1;const r=(...r)=>{!1!==n&&clearTimeout(n),n=St((()=>{t(...r),n=!1;}),e);};return r.clear=()=>{n&&(clearTimeout(n),n=!1);},r},t.decimalCheck=g,t.deduct=t=>t-1,t.defineProperty=a,t.difference=(t,...e)=>{const n=R(e);return K(t,(t=>{if(!n.includes(t))return t}))},t.divide=(t,e)=>t/e,t.drop=Z,t.dropRight=(t,e,n=t.length)=>Z(t,0,n-e),t.each=yt,t.eachArray=z,t.eachArrayRight=q,t.eachAsync=G,t.eachAsyncRight=Q,t.eachObject=lt,t.eachObjectAsync=Et,t.eachWhile=mt,t.ensureArray=M,t.eventAdd=ve,t.eventRemove=(t,...e)=>(t.removeEventListener(...e),t),t.every=vt,t.filter=bt,t.filterArray=H,t.filterObject=ht,t.findIndex=(t,e,n="id")=>{const r=t.findIndex(((t,r)=>at(t,0,0,e,n)));return -1!==r&&r},t.findItem=(t,e,n="id")=>{const r=t.find(((t,r)=>at(t,0,0,e,n)));return -1!==r&&r},t.first=(t,e)=>e?t.slice(0,e):t[0],t.flatten=(t,e=1)=>{let n=t;for(let t=0;tt.concat(M(e))),[]);return n},t.flattenDeep=R,t.flow=fe,t.flowAsync=ge,t.flowAsyncRight=me,t.flowRight=pe,t.get=se,t.getByClass=Le,t.getById=Fe,t.getByTag=Ee,t.getExtensionRegex=L,t.getFileExtension=t=>{const e=t.match(L);if(e)return e[1]},t.getNewest=(t,e)=>st(t,e,!1)[0],t.getOldest=(t,e="id")=>it(t,e)[0],t.getOwnPropertyDescriptor=c,t.getOwnPropertyNames=l,t.groupBy=(t,e)=>{const n={};return z(t,(t=>{const r=e(t);n[r]||(n[r]=[]),n[r].push(t);})),n},t.has=(t,...e)=>t.includes(...e),t.hasAnyKeys=(t,e)=>{const n=o(t);return Boolean(e.find((t=>n.includes(t))))},t.hasDot=x,t.hasKeys=xt,t.hasLength=v,t.hasValue=p,t.htmlEntities=Ut,t.ifInvoke=(t,...e)=>{if(A(t))return t(...e)},t.ifNotEqual=(t,e,n)=>(e&&!p(t[e])&&(t[e]=n),t),t.importjs=Te,t.inAsync=async(t,e)=>G(t,(async t=>{await t(e);})),t.inSync=(t,e)=>yt(t,(t=>{t(e);})),t.increment=t=>t+1,t.indexBy=(t,e="id")=>{const n={};return z(t,(t=>{n[t[e]]=t;})),n},t.info=Ue,t.initial=t=>t.slice(0,t.length-1),t.initialString=(t,e=1)=>t.slice(0,-1*e),t.insertInRange=(t,e,n)=>t.slice(0,e)+n+t.slice(e,t.length),t.intersect=(t,...e)=>K(t,(t=>{if(W(e,(e=>e.includes(t))))return t})),t.interval=Ct,t.invert=(t,e={})=>(lt(t,((t,n)=>{e[t]=n;})),e),t.invoke=(t,e,n)=>_(t,((t,r)=>t[e](n,r))),t.invokeAsync=(t,e,n)=>X(t,(async(t,r)=>t[e](n,r))),t.is=s,t.isAgent=we,t.isArguments=function(t){return !!p(t)&&"[object Arguments]"===t.toString()},t.isArray=m,t.isAsync=k,t.isBoolean=E,t.isBuffer=function(t){return !!p(t)&&"ArrayBuffer"===t.constructor?.name},t.isConstructor=d,t.isDate=t=>t instanceof Date,t.isDecimal=t=>g.test(t.toString()),t.isDocumentReady=Ne,t.isDom=t=>t&&9!==t.nodeType,t.isEmpty=t=>y(t)||m(t)?!v(t):w(t)?!u(t):!p(t),t.isEnter=t=>13===t.keyCode,t.isEqual=Qt,t.isFileCSS=C,t.isFileHTML=O,t.isFileJS=I,t.isFileJSON=j,t.isFloat32=function(t){return !!p(t)&&"Float32Array"===t.constructor?.name},t.isFloat64=function(t){return !!p(t)&&"Float64Array"===t.constructor?.name},t.isFunction=A,t.isHTMLCollection=function(t){return !!p(t)&&"[object HTMLCollection]"===t.toString()},t.isInt16=function(t){return !!p(t)&&"Int16Array"===t.constructor?.name},t.isInt32=function(t){return !!p(t)&&"Int32Array"===t.constructor?.name},t.isInt8=function(t){return !!p(t)&&"Int8Array"===t.constructor?.name},t.isKindAsync=t=>!!t&&(F(t)||k(t)),t.isMap=function(t){return !!p(t)&&"[object Map]"===t.toString()},t.isMatchArray=J,t.isMatchObject=(t,e)=>{const n=o(t);return !!J(n,o(e))&&W(n,(n=>t[n]===e[n]))},t.isNodeList=function(t){return !!p(t)&&"[object NodeList]"===t.toString()},t.isNull=f,t.isNumber=b,t.isNumberEqual=(t,e)=>t===e,t.isNumberInRange=(t,e,n)=>t>e&&t{const e=typeof t;return null==t||"object"!==e&&"function"!==e},t.isPromise=F,t.isRegExp=t=>t instanceof RegExp,t.isSet=function(t){return !!p(t)&&"[object Set]"===t.toString()},t.isString=y,t.isUint16=function(t){return !!p(t)&&"Uint16Array"===t.constructor?.name},t.isUint32=function(t){return !!p(t)&&"Uint32Array"===t.constructor?.name},t.isUint8=function(t){return !!p(t)&&"Uint8Array"===t.constructor?.name},t.isUint8Clamped=function(t){return !!p(t)&&"Uint8ClampedArray"===t.constructor?.name},t.isUndefined=h,t.isWeakMap=function(t){return !!p(t)&&"[object WeakMap]"===t.toString()},t.isZero=t=>0===t,t.jsonParse=ce,t.kebabCase=t=>t.replace(Ft," ").trim().toLowerCase().replace(kt,"-$1"),t.keys=o,t.largest=t=>V(...t),t.last=(t,e)=>{const n=t.length;return e?t.slice(n-e,n):t[n-1]},t.map=wt,t.mapArray=_,t.mapArrayRight=function(t,e,n=[],r){let o=0;const s=t.length;for(let i=s-1;i>=0;i--)n[o]=e(t[i],i,t,s,r),o++;return n},t.mapAsync=X,t.mapObject=ft,t.mapObjectAsync=async(t,e,n={})=>(await Et(t,(async(t,r,o,s,i)=>{n[r]=await e(t,r,n,o,s,i);})),n),t.mapWhile=function(t,e,n=[],r){const o=t.length;for(let s=0;st-e,t.model=function(t,e){return p(e)?Kt(le,[t,e]):se(t,le.models)},t.multiply=(t,e)=>t*e,t.negate=t=>(...e)=>!t(...e),t.nodeAttribute=je,t.noop=()=>{},t.nthArg=(t=0)=>(...e)=>e[t],t.numSort=t=>t.sort(nt),t.numericalCompare=nt,t.numericalCompareReverse=rt,t.objectCreate=Zt,t.objectSize=u,t.omit=(t,e)=>ht(t,((t,n)=>!e.includes(n))),t.once=t=>{let e;return (...n)=>(p(e)||(e=t(...n)),e)},t.over=t=>(...e)=>wt(t,(t=>t(...e))),t.overEvery=t=>(...e)=>mt(t,(t=>t(...e))),t.partition=(t,e)=>{const n=[];return [K(t,(t=>{if(e(t))return t;n.push(t);})),n]},t.pick=(t,e,n={})=>(z(e,(e=>{n[e]=t[e];})),n),t.pluck=(t,e)=>_(t,(t=>t[e])),t.pluckObject=ct,t.pluckValues=(t,e)=>_(t,(t=>ct(t,e))),t.promise=ue,t.propertyMatch=(t,e,n=o(t))=>W(n,(n=>Qt(t[n],e[n]))),t.querySelector=ke,t.querySelectorAll=Me,t.rNumSort=t=>t.sort(rt),t.randomArbitrary=(t,e=0)=>B()*(t-e)+e,t.randomInt=D,t.range=(t,e,n=1)=>t{const r=[];let o=t;for(;o{const r=n<0?-1*n:n,o=[];let s=t;for(;s>e;)o.push(s),s-=r;return o})(t,e,n),t.rawURLDecode=Dt,t.reArg=(t,e)=>(...n)=>t(...e.map((t=>n[t]))),t.regexGenerator=S,t.remainder=(t,e)=>t%e,t.remove=(t,e)=>{let n=t.length;for(let r=0;r{let n=t.length;for(let r=0;rt.replace(new RegExp(`\\b${e.join("|")}\\b`,"gi"),n),t.rest=t=>t.slice(1,t.length),t.restString=Mt,t.right=(t,e)=>t[t.length-1-e],t.rightString=(t,e=1)=>t[t.length-e],t.sample=(t,e=1)=>{if(!t)return !1;const n=t.length;if(n===e||e>n)return U(t);if(1===e)return [t[D(n-1,0)]];const r=[],o={};let s,i=0;for(;iUt(Dt(t)),t.saveDimensions=Pe,t.selector=t=>{switch(t[0]){case"#":if(!xe.test(t))return Fe(Mt(t));break;case".":if(Ie.test(t))return Le(Mt(t));break;default:if(Oe.test(t))return Ee(t)}return Me(t)},t.shuffle=U,t.smallest=t=>P(...t),t.snakeCase=t=>t.replace(Ft," ").trim().toLowerCase().replace(kt,"_$1"),t.sortAlphabetical=(t,e)=>t.sort(((t,n)=>{const r=t[e],o=n[e];return ro?1:0})),t.sortNewest=st,t.sortOldest=it,t.sortedIndex=(t,e)=>{let n=0;return W(t,((t,r)=>(n=r,e>t))),n},t.stringify=ae,t.stubArray=()=>[],t.stubFalse=()=>!1,t.stubObject=()=>({}),t.stubString=()=>"",t.stubTrue=()=>!0,t.sum=t=>t.reduce(((t,e)=>t+e),0),t.take=(t,e=1)=>t.slice(0,e),t.takeRight=(t,e=1)=>{const n=t.length;return t.slice(n-e,n)},t.themes=He,t.throttle=(t,e)=>{let n,r=!1;const o=(...o)=>{r?n=!0:(t(...o),r=St((()=>{n&&t(...o),r=!1;}),e));};return o.clear=()=>{clearTimeout(r),r=!1;},o},t.timer=St,t.times=ot,t.timesMap=(t,e,n,r=[])=>{const o=n?t:0,s=n?e:t,i=n||e;let c;return ot(o,s,(t=>{c=i(t,o,s,r),p(c)&&r.push(c);})),r},t.toArray=e,t.toPath=te,t.toggle=(t,e=!0,n=!1)=>Qt(e,t)?n:e,t.tokenize=t=>t.match(Pt)||[],t.truncate=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),o=r.length;let s,i=n-e;for(;i=0&&(s=r[i]," "!==s);i--);return t.slice(0,i).trim()})(t,e,n):t},t.truncateRight=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),o=r.length;let s,i=e;for(;i0&&(s=r[i]," "!==s);i++);return t.substr(i,n).trim()})(t,e,n):t},t.uid=oe,t.unZip=t=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.unZipObject=t=>{const e=[],n=[];return lt(t,((t,r)=>{e.push(r),n.push(t);})),[e,n]},t.union=(...t)=>et(R(t)),t.unique=et,t.updateDimensions=ze,t.upperCase=t=>t.replace(Ft," ").trim().toUpperCase(),t.upperFirst=t=>Wt(t)+Mt(t),t.upperFirstAll=t=>t.replace(qt,(t=>t.toUpperCase())),t.upperFirstLetter=Wt,t.upperFirstOnly=Ht,t.upperFirstOnlyAll=t=>Ht(t.toLowerCase()).replace(qt,(t=>t.toUpperCase())),t.virtualStorage=be,t.whileArray=W,t.whileCompactMap=function(t,e,n=[],r){let o=0;for(;ot.filter((t=>!e.includes(t))),t.words=t=>t.match(zt)||[],t.wrap=(t,e)=>(...n)=>e(t,...n),t.xor=(...t)=>{const e=[];return z(t,(t=>{z(et(t),(t=>{e.includes(t)?e.splice(e.indexOf(t),1):e.push(t);}));})),e},t.zip=(...t)=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.zipObject=Lt,Object.defineProperty(t,"__esModule",{value:!0});})); (function() { const { @@ -86,22 +86,22 @@ } } = app; const mainWorker = new Worker('/assets/worker.js'); - const workerRequest = async (requestName, dataArg) => { - console.log(requestName, dataArg); + const workerRequest = async (task, dataArg) => { + console.log(task, dataArg); let compiledRequest; let callbackOptional; if (dataArg) { compiledRequest = { data: dataArg, - request: requestName + task }; } else { - compiledRequest = requestName; - callbackOptional = requestName.callback; + compiledRequest = task; + callbackOptional = task.callback; } const requestObject = { data: compiledRequest.data, - request: compiledRequest.request + task: compiledRequest.task }; if (requestObject.data.id) { return mainWorker.postMessage(requestObject); @@ -273,25 +273,25 @@ files: configData } }, - request: 'socket.get' + task: 'socket.get' }); }; assign$7(app, { fetchFile }); const { assign: assign$6 } = app.utility; - const request = async (requestName, body) => { + const request = async (task, body) => { const requestPackage = body ? { body, - request: requestName + task } : - requestName; + task; const workerPackage = { data: { data: requestPackage }, - request: 'socket.request' + task: 'socket.request' }; if (requestPackage.id) { workerPackage.data.id = requestPackage.id; @@ -323,23 +323,24 @@ static stop() { Watcher.status = false; } - static async update(json) { - console.log(json); - if (!Watcher.status || !json) { + static async update(pushUpdate) { + console.log(pushUpdate); + const { body } = pushUpdate; + if (!Watcher.status || !body) { return; } const { type, path - } = json; + } = body; const levelObject = Watcher.containerPrimary[type] || Watcher.containerPrimary[path]; await eachAsync$2(Watcher.containerRegex, async (watcher) => { if (watcher.eventName.test(type) || watcher.eventName.test(path)) { - return watcher.eventAction(json); + return watcher.eventAction(body); } }); if (levelObject) { await eachAsync$2(levelObject, async (watcher) => { - return watcher.eventAction(json); + return watcher.eventAction(body); }); } } @@ -392,8 +393,8 @@ }); }; assign$5(app.events, { - _(json) { - return Watcher.update(json.body); + _(pushUpdate) { + return Watcher.update(pushUpdate); } }); assign$5(app, { @@ -413,7 +414,9 @@ each: each$6, cnsl: cnsl$2, initialString, - getFileExtension: getFileExtension$1 + getFileExtension: getFileExtension$1, + isArray: isArray$2, + isNumber }, imported, crate: crate$2 @@ -445,6 +448,9 @@ }); } } + if (item[0] !== '/') { + item = `/${item}`; + } return item; }; const singleDemand = (items) => { @@ -452,6 +458,9 @@ }; const objectDemand = (items, arrayToObjectMap) => { return map$1(arrayToObjectMap, (item) => { + if (isPlainObject$2(item)) { + return item; + } return items[item]; }); }; @@ -473,49 +482,84 @@ ); }); }; - const demand$4 = async (filesArg, options) => { - const assets = []; + const demand$4 = async (files, options) => { + const remoteImport = []; + const localImport = []; + const compiledImports = []; + let results; let demandType; let arrayToObjectMap; - let files = filesArg; if (isPlainObject$2(files)) { demandType = objectDemand; arrayToObjectMap = {}; - let index = 0; each$6(files, (item, key) => { - arrayToObjectMap[key] = index; - index++; - assets.push(buildFilePath$1(item)); + if (isPlainObject$2(item)) { + arrayToObjectMap[key] = item; + } else { + arrayToObjectMap[key] = remoteImport.push(buildFilePath$1(item)) - 1; + } }); - } else { - files = isString$4(files) ? files.split(commaString) : files; - demandType = files.length < 2 ? singleDemand : multiDemand; + } else if (isString$4(files)) { + demandType = singleDemand; + if (isPlainObject$2(files)) { + localImport.push(files); + } else { + localImport.push(remoteImport.push(buildFilePath$1(files)) - 1); + } + } else if (isArray$2(files)) { + demandType = multiDemand; each$6(files, (item) => { - assets.push(buildFilePath$1(item)); + if (isPlainObject$2(item)) { + localImport.push(item); + } else { + localImport.push(remoteImport.push(buildFilePath$1(item)) - 1); + } + }); + } + if (remoteImport.length) { + results = await streamAssets(remoteImport, options); + } + cnsl$2('importing', 'notify'); + if (!arrayToObjectMap) { + each$6(localImport, (item, index) => { + if (isNumber(item)) { + compiledImports[index] = results[item]; + } else { + compiledImports[index] = item; + } }); } - const results = await streamAssets(assets, options); - // app.log(results); - return demandType(results, arrayToObjectMap); + console.log(results, demandType, compiledImports, localImport, remoteImport); + return demandType(compiledImports, arrayToObjectMap); }; const demandTypeMethod = (type, optionsFunction) => { return function(filesArg, options) { let files = filesArg; - if (isString$4(files)) { - files = files.split(commaString); - } if (optionsFunction) { optionsFunction(options); } - files = map$1(files, (item) => { - if (imported[item]) { - return item; + if (isString$4(files)) { + if (imported[files]) { + return imported[files]; } - const itemExt = getFileExtension$1(item); - const compiledFileName = itemExt ? item : `${item}${(last$1(item) === '/' && 'index') || ''}.${type}`; - app.log('Demand Type', type, compiledFileName); - return compiledFileName; - }); + files = hasDot(files) ? files : `${files}${(last$1(files) === '/' && 'index') || ''}.${type}`; + if (imported[files]) { + return imported[files]; + } + } else { + files = map$1(files, (item) => { + if (imported[item]) { + return imported[item]; + } + const itemHasExt = hasDot(item); + const compiledFileName = itemHasExt ? item : `${item}${(last$1(item) === '/' && 'index') || ''}.${type}`; + if (imported[compiledFileName]) { + return imported[compiledFileName]; + } + app.log('Demand Type', type, compiledFileName); + return compiledFileName; + }); + } return demand$4(files, options); }; }; @@ -535,7 +579,7 @@ cnsl$2('Worker is Ready', 'notify'); app.systemLanguage = data.language; try { - await demand$4('app/'); + await demand$4('app/index.js'); } catch (error) { console.log(error); crate$2.clear(); diff --git a/uwBridge/system/compile/build/front/coreBundle.js b/uwBridge/system/compile/build/front/coreBundle.js index 85040271..8b23fd0c 100644 --- a/uwBridge/system/compile/build/front/coreBundle.js +++ b/uwBridge/system/compile/build/front/coreBundle.js @@ -73,22 +73,22 @@ } } = app; const mainWorker = new Worker('/assets/worker.js'); - const workerRequest = async (requestName, dataArg) => { - console.log(requestName, dataArg); + const workerRequest = async (task, dataArg) => { + console.log(task, dataArg); let compiledRequest; let callbackOptional; if (dataArg) { compiledRequest = { data: dataArg, - request: requestName + task }; } else { - compiledRequest = requestName; - callbackOptional = requestName.callback; + compiledRequest = task; + callbackOptional = task.callback; } const requestObject = { data: compiledRequest.data, - request: compiledRequest.request + task: compiledRequest.task }; if (requestObject.data.id) { return mainWorker.postMessage(requestObject); @@ -260,25 +260,25 @@ files: configData } }, - request: 'socket.get' + task: 'socket.get' }); }; assign$7(app, { fetchFile }); const { assign: assign$6 } = app.utility; - const request = async (requestName, body) => { + const request = async (task, body) => { const requestPackage = body ? { body, - request: requestName + task } : - requestName; + task; const workerPackage = { data: { data: requestPackage }, - request: 'socket.request' + task: 'socket.request' }; if (requestPackage.id) { workerPackage.data.id = requestPackage.id; @@ -310,23 +310,24 @@ static stop() { Watcher.status = false; } - static async update(json) { - console.log(json); - if (!Watcher.status || !json) { + static async update(pushUpdate) { + console.log(pushUpdate); + const { body } = pushUpdate; + if (!Watcher.status || !body) { return; } const { type, path - } = json; + } = body; const levelObject = Watcher.containerPrimary[type] || Watcher.containerPrimary[path]; await eachAsync$2(Watcher.containerRegex, async (watcher) => { if (watcher.eventName.test(type) || watcher.eventName.test(path)) { - return watcher.eventAction(json); + return watcher.eventAction(body); } }); if (levelObject) { await eachAsync$2(levelObject, async (watcher) => { - return watcher.eventAction(json); + return watcher.eventAction(body); }); } } @@ -379,8 +380,8 @@ }); }; assign$5(app.events, { - _(json) { - return Watcher.update(json.body); + _(pushUpdate) { + return Watcher.update(pushUpdate); } }); assign$5(app, { @@ -400,7 +401,9 @@ each: each$6, cnsl: cnsl$2, initialString, - getFileExtension: getFileExtension$1 + getFileExtension: getFileExtension$1, + isArray: isArray$2, + isNumber }, imported, crate: crate$2 @@ -432,6 +435,9 @@ }); } } + if (item[0] !== '/') { + item = `/${item}`; + } return item; }; const singleDemand = (items) => { @@ -439,6 +445,9 @@ }; const objectDemand = (items, arrayToObjectMap) => { return map$1(arrayToObjectMap, (item) => { + if (isPlainObject$2(item)) { + return item; + } return items[item]; }); }; @@ -460,49 +469,84 @@ ); }); }; - const demand$4 = async (filesArg, options) => { - const assets = []; + const demand$4 = async (files, options) => { + const remoteImport = []; + const localImport = []; + const compiledImports = []; + let results; let demandType; let arrayToObjectMap; - let files = filesArg; if (isPlainObject$2(files)) { demandType = objectDemand; arrayToObjectMap = {}; - let index = 0; each$6(files, (item, key) => { - arrayToObjectMap[key] = index; - index++; - assets.push(buildFilePath$1(item)); + if (isPlainObject$2(item)) { + arrayToObjectMap[key] = item; + } else { + arrayToObjectMap[key] = remoteImport.push(buildFilePath$1(item)) - 1; + } }); - } else { - files = isString$4(files) ? files.split(commaString) : files; - demandType = files.length < 2 ? singleDemand : multiDemand; + } else if (isString$4(files)) { + demandType = singleDemand; + if (isPlainObject$2(files)) { + localImport.push(files); + } else { + localImport.push(remoteImport.push(buildFilePath$1(files)) - 1); + } + } else if (isArray$2(files)) { + demandType = multiDemand; each$6(files, (item) => { - assets.push(buildFilePath$1(item)); + if (isPlainObject$2(item)) { + localImport.push(item); + } else { + localImport.push(remoteImport.push(buildFilePath$1(item)) - 1); + } + }); + } + if (remoteImport.length) { + results = await streamAssets(remoteImport, options); + } + cnsl$2('importing', 'notify'); + if (!arrayToObjectMap) { + each$6(localImport, (item, index) => { + if (isNumber(item)) { + compiledImports[index] = results[item]; + } else { + compiledImports[index] = item; + } }); } - const results = await streamAssets(assets, options); - // app.log(results); - return demandType(results, arrayToObjectMap); + console.log(results, demandType, compiledImports, localImport, remoteImport); + return demandType(compiledImports, arrayToObjectMap); }; const demandTypeMethod = (type, optionsFunction) => { return function(filesArg, options) { let files = filesArg; - if (isString$4(files)) { - files = files.split(commaString); - } if (optionsFunction) { optionsFunction(options); } - files = map$1(files, (item) => { - if (imported[item]) { - return item; + if (isString$4(files)) { + if (imported[files]) { + return imported[files]; } - const itemExt = getFileExtension$1(item); - const compiledFileName = itemExt ? item : `${item}${(last$1(item) === '/' && 'index') || ''}.${type}`; - app.log('Demand Type', type, compiledFileName); - return compiledFileName; - }); + files = hasDot(files) ? files : `${files}${(last$1(files) === '/' && 'index') || ''}.${type}`; + if (imported[files]) { + return imported[files]; + } + } else { + files = map$1(files, (item) => { + if (imported[item]) { + return imported[item]; + } + const itemHasExt = hasDot(item); + const compiledFileName = itemHasExt ? item : `${item}${(last$1(item) === '/' && 'index') || ''}.${type}`; + if (imported[compiledFileName]) { + return imported[compiledFileName]; + } + app.log('Demand Type', type, compiledFileName); + return compiledFileName; + }); + } return demand$4(files, options); }; }; @@ -522,7 +566,7 @@ cnsl$2('Worker is Ready', 'notify'); app.systemLanguage = data.language; try { - await demand$4('app/'); + await demand$4('app/index.js'); } catch (error) { console.log(error); crate$2.clear(); diff --git a/uwBridge/system/compile/build/worker/bundle.js b/uwBridge/system/compile/build/worker/bundle.js index caf96477..d897b7e8 100644 --- a/uwBridge/system/compile/build/worker/bundle.js +++ b/uwBridge/system/compile/build/worker/bundle.js @@ -1,298 +1,312 @@ (function () { - self.window = self; + self.window = self; - !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).$={});}(window,(function(t){const e=Array.from,n=Reflect.apply,r=Object,s=r.keys,i=r.is,c=r.assign,o=r.getOwnPropertyDescriptor,a=r.defineProperty,u=r.getOwnPropertyNames,l=t=>s(t).length;function p(t){return void 0===t}function f(t){return null===t}function h(t){return !p(t)&&!f(t)}function g(t){return e=>!!h(e)&&e.constructor===t}const m=/\.|\+/,y=Array.isArray,d=g(String),b=g(Number),A=t=>!!h(t)&&"Object("===t.constructor.toString().trim().slice(9,16),w=t=>!!h(t)&&t instanceof Function,O=t=>Boolean(t.length),j=t=>e=>!!h(e)&&t.test(e),S=j(/\.css$/),C=j(/\.json$/),v=j(/\.js$/),M=j(/\.html$/),R=j(/\./),k=/\.([0-9a-z]+)/,x=t=>!!t&&t instanceof Promise,F=t=>!!t&&"AsyncFunction"===t.constructor?.name;const I=t=>y(t)&&t||h(t)&&[t]||[],E=t=>t.flat(1/0),U=t=>(t.length=0,t),N=Math,P=N.floor,T=N.random,B=(t,e=0)=>P(T()*(t-e))+e,L=(t,n=t.length)=>{if(t.length<=1)return e(t);const r=e(t);let s,i,c=0;for(;c=0;s--)e(t[s],s,t,r,n);return t}function z(t,e,n){const r=t.length;for(let s=0;s{!0===e(t,s,n,i,c,r)&&n.push(t);})),n}function q(t,e,n=[],r){return $(t,((t,s,i,c)=>{n[s]=e(t,s,n,i,c,r);})),n}function W(t,e,n=[],r){return $(t,((t,s,i,c)=>{const o=e(t,s,n,i,c,r);h(o)&&n.push(o);})),n}const J=(t,e,n=t.length)=>t.splice(e,n),Z=(t,e)=>t.length===e.length&&z(t,((t,n)=>e[n]===t)),V=Math.max,G=async(t,e)=>{const n=t.length;for(let r=0;r{const n=t.length;for(let r=n-1;r>=0;r--)await e(t[r],r,t,n);return t},Q=async(t,e)=>{const n=[];return await G(t,(async(t,r,s)=>{n[r]=await e(t,r,s);})),n},X=(t,e,n)=>n.indexOf(t)===e,Y=(t,e,n)=>t!==n[e-1],tt=(t,e)=>e?t.filter(Y):t.filter(X),et=(t,e)=>t-e,nt=(t,e)=>e-t,rt=(t,e,n)=>{const r=n?t:0,s=n?e:t,i=n||e;for(let t=r;t(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?-1:0:1:-1)),it=(t,e="id",n=!0)=>(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?1:0:-1:1)),ct=(t,e)=>q(e,(e=>t[e])),ot=(t,e,n,r,s)=>{if(t[s]===r)return !0},at=(t,e)=>{$(s(t),((n,r,s,i)=>{e(t[n],n,t,i,s);}));},ut=(t,e)=>z(s(t),((n,r,s,i)=>e(t[n],n,t,i,s))),lt=(t,e,n={})=>(at(t,((t,r,s,i,c)=>{!0===e(t,r,n,s,i,c)&&(n[r]=t);})),n),pt=(t,e,n={})=>(at(t,((t,r,s,i,c)=>{n[r]=e(t,r,n,s,i,c);})),n),ft=(t,e,n={})=>(at(t,((t,r,s,i,c)=>{const o=e(t,r,n,s,i,c);h(o)&&(n[r]=o);})),n),ht=(t,e)=>t.forEach(e),gt=(t,e)=>(n,r,s)=>{let i;if(h(n))return i=y(n)?t:A(n)||w(n)?e:n.forEach?ht:e,i(n,r,s)},mt=gt(z,ut),yt=gt($,at),dt=gt(K,lt),bt=gt(q,pt),At=gt(W,ft),wt=mt,Ot=(t,e)=>setTimeout(t,e),jt=(t,e)=>setInterval(t,e),St=(t,e)=>()=>{rt(0,t((()=>{}),0),(t=>{e(t);}));},Ct=St(Ot,clearTimeout),vt=St(jt,clearInterval),Mt=(t,e)=>{const n=s(t);return z(e,(t=>n.includes(t)))},Rt=async(t,e)=>{const n=s(t);return await G(n,((r,s,i,c)=>e(t[r],r,t,c,n))),t},kt=/[-_]/g,xt=/ (.)/g,Ft=(t,e=1)=>t.substr(e),It=/%(?![\da-f]{2})/gi,Et=/&/g,Ut=//g,Pt=/"/g,Tt=t=>decodeURIComponent(t.replace(It,(()=>"%25"))),Bt=t=>t.replace(Et,"&").replace(Ut,"<").replace(Nt,">").replace(Pt,"""),Lt=/\S+/g,Dt=/\w+/g,$t=/ (.)/g,_t=t=>t[0].toUpperCase(),zt=t=>_t(t)+Ft(t).toLowerCase(),Kt=Reflect.construct;const qt=Object.create,Wt=(t,e,n=!1,r,i,c)=>{if(t){if(c){const s=c.pop();if(s){const r=e[s];t[s]=Wt(t[s],r,n);}else if(!i)return t;if(i){let s=r||0;if(s++,sglobalThis.structuredClone(t):t=>A(t)?Wt({},t):y(t)?Wt([],t):qt(t);const Zt=Function.prototype;const Vt=(t,e)=>{if(t===e)return !0;if(t.toString()===e.toString())if(A(t)){const n=s(t);if(Mt(e,n))return z(n,(n=>Vt(t[n],e[n])))}else if(y(t)&&t.length===e.length)return z(t,((t,n)=>Vt(t,e[n])));return !1},Gt=/\.|\[/,Ht=/]/g,Qt=t=>t.replace(Ht,"").split(Gt);let Xt=0;const Yt=[],te={};function ee(){let t=Yt.shift(Yt);return h(t)||(t=Xt,te[t]=!0,Xt++),t}ee.free=t=>{te[t]=null,Yt.push(t);};const ne=(t,e)=>{let n=e;return z(Qt(t),(t=>(n=n[t],h(n)))),n},re=JSON,se=re.parse,ie=re.stringify,ce=(t,e)=>(h(e)&&(ce[t]=e),ne(t,ce)),oe=t=>(...e)=>n=>{let r=n;return t(e,(t=>{r=t(r);})),r},ae=oe($),ue=oe(_),le=t=>(...e)=>async n=>{let r=n;return await t(e,(async t=>{r=await t(r);})),r},pe=le(G),fe=le(H);t.add=(t,e)=>t+e,t.after=(t,e)=>{let n,r=t;return (...t)=>(null!==r&&r--,r<=0&&(n=e(...t),r=null),n)},t.apply=n,t.arrayToObject=(t,e)=>{const n={};return $(t,((t,r)=>{n[e[r]]=t;})),n},t.ary=(t,e)=>(...n)=>t(...n.splice(0,e)),t.assign=c,t.assignDeep=Wt,t.asyncEach=async(t,e)=>{const n=t.length;for(let r=0;r{let n,r=t;return (...t)=>(null!==r&&r--,r>=1?n=e(...t):r=null,n)},t.bindAll=(t,e)=>bt(t,(t=>w(t)?t.bind(e):t)),t.cacheNativeMethod=function(t){return Zt.call.bind(t)},t.camelCase=t=>t.toLowerCase().replace(xt,(t=>t.toUpperCase().replace(/ /g,""))),t.chain=t=>{const e=t=>(e.value=t,e.methods);return c(e,{add:t=>((t,e)=>(yt(e,((e,n)=>{t.methods[n]=(...n)=>(e(t.value,...n),t.methods);})),t))(e,t),done(){const t=e.value;return e.value=null,t},methods:{}}),e.add(t),e},t.chunk=(t,e=1)=>{const n=[];let r=0;return t.forEach(((t,s)=>{s%e||(n.push([]),s&&r++),n[r].push(t);})),n},t.chunkString=(t,e)=>t.match(new RegExp(`(.|[\r\n]){1,${e}}`,"g")),t.clear=U,t.clearIntervals=vt,t.clearTimers=Ct,t.cloneArray=t=>t.slice(),t.compact=t=>t.filter((t=>!(d(t)&&!t.length)&&t)),t.compactKeys=t=>{const e=[];return at(t,((t,n)=>{t&&e.push(n);})),e},t.compactMap=At,t.compactMapArray=W,t.compactMapAsync=async(t,e)=>{const n=[];let r;return await G(t,(async(t,s,i)=>{r=await e(t,s,n,i),h(r)&&n.push(r);})),n},t.compactMapObject=ft,t.compactMapObjectAsync=async(t,e,n={})=>(await Rt(t,(async(t,r,s,i,c)=>{const o=await e(t,r,n,i,c);h(o)&&(n[r]=o);})),n),t.construct=function(t,e=[],n){return n?Kt(t,e,n):Kt(t,e)},t.countBy=(t,e)=>{const n={};let r;return $(t,(t=>{r=e(t),n[r]||(n[r]=0),n[r]++;})),n},t.countKey=(t,e)=>{let n=0;return $(t,(t=>{t[e]&&n++;})),n},t.countWithoutKey=(t,e)=>{let n=0;return $(t,(t=>{t[e]||n++;})),n},t.curry=(t,e=t.length)=>{const n=[],r=(...s)=>{if(n.push(...s),n.length===e){const e=t(...n);return U(n),e}return r};return r},t.curryRight=(t,e=t.length)=>{const n=[],r=(...s)=>{if(n.unshift(...s),n.length===e){const e=t(...n);return U(n),e}return r};return r},t.debounce=(t,e)=>{let n=!1;const r=(...r)=>{!1!==n&&clearTimeout(n),n=Ot((()=>{t(...r),n=!1;}),e);};return r.clear=()=>{n&&(clearTimeout(n),n=!1);},r},t.decimalCheck=m,t.deduct=t=>t-1,t.defineProperty=a,t.difference=(t,...e)=>{const n=E(e);return W(t,(t=>{if(!n.includes(t))return t}))},t.divide=(t,e)=>t/e,t.drop=J,t.dropRight=(t,e,n=t.length)=>J(t,0,n-e),t.each=yt,t.eachArray=$,t.eachArrayRight=_,t.eachAsync=G,t.eachAsyncRight=H,t.eachObject=at,t.eachObjectAsync=Rt,t.eachWhile=mt,t.ensureArray=I,t.every=wt,t.filter=dt,t.filterArray=K,t.filterObject=lt,t.findIndex=(t,e,n="id")=>{const r=t.findIndex(((t,r)=>ot(t,0,0,e,n)));return -1!==r&&r},t.findItem=(t,e,n="id")=>{const r=t.find(((t,r)=>ot(t,0,0,e,n)));return -1!==r&&r},t.first=(t,e)=>e?t.slice(0,e):t[0],t.flatten=(t,e=1)=>{let n=t;for(let t=0;tt.concat(I(e))),[]);return n},t.flattenDeep=E,t.flow=ae,t.flowAsync=pe,t.flowAsyncRight=fe,t.flowRight=ue,t.get=ne,t.getExtensionRegex=k,t.getFileExtension=t=>{const e=t.match(k);if(e)return e[1]},t.getNewest=(t,e)=>st(t,e,!1)[0],t.getOldest=(t,e="id")=>it(t,e)[0],t.getOwnPropertyDescriptor=o,t.getOwnPropertyNames=u,t.groupBy=(t,e)=>{const n={};return $(t,(t=>{const r=e(t);n[r]||(n[r]=[]),n[r].push(t);})),n},t.has=(t,...e)=>t.includes(...e),t.hasAnyKeys=(t,e)=>{const n=s(t);return Boolean(e.find((t=>n.includes(t))))},t.hasDot=R,t.hasKeys=Mt,t.hasLength=O,t.hasValue=h,t.htmlEntities=Bt,t.ifInvoke=(t,...e)=>{if(w(t))return t(...e)},t.ifNotEqual=(t,e,n)=>(e&&!h(t[e])&&(t[e]=n),t),t.inAsync=async(t,e)=>G(t,(async t=>{await t(e);})),t.inSync=(t,e)=>yt(t,(t=>{t(e);})),t.increment=t=>t+1,t.indexBy=(t,e="id")=>{const n={};return $(t,(t=>{n[t[e]]=t;})),n},t.initial=t=>t.slice(0,t.length-1),t.initialString=(t,e=1)=>t.slice(0,-1*e),t.insertInRange=(t,e,n)=>t.slice(0,e)+n+t.slice(e,t.length),t.intersect=(t,...e)=>W(t,(t=>{if(z(e,(e=>e.includes(t))))return t})),t.interval=jt,t.invert=(t,e={})=>(at(t,((t,n)=>{e[t]=n;})),e),t.invoke=(t,e,n)=>q(t,((t,r)=>t[e](n,r))),t.invokeAsync=(t,e,n)=>Q(t,(async(t,r)=>t[e](n,r))),t.is=i,t.isArguments=function(t){return !!h(t)&&"[object Arguments]"===t.toString()},t.isArray=y,t.isAsync=F,t.isBoolean=t=>"Boolean"===t.constructor.name,t.isBuffer=function(t){return !!h(t)&&"ArrayBuffer"===t.constructor?.name},t.isConstructor=g,t.isDate=t=>t instanceof Date,t.isDecimal=t=>m.test(t.toString()),t.isEmpty=t=>d(t)||y(t)?!O(t):A(t)?!l(t):!h(t),t.isEqual=Vt,t.isFileCSS=S,t.isFileHTML=M,t.isFileJS=v,t.isFileJSON=C,t.isFloat32=function(t){return !!h(t)&&"Float32Array"===t.constructor?.name},t.isFloat64=function(t){return !!h(t)&&"Float64Array"===t.constructor?.name},t.isFunction=w,t.isInt16=function(t){return !!h(t)&&"Int16Array"===t.constructor?.name},t.isInt32=function(t){return !!h(t)&&"Int32Array"===t.constructor?.name},t.isInt8=function(t){return !!h(t)&&"Int8Array"===t.constructor?.name},t.isKindAsync=t=>!!t&&(x(t)||F(t)),t.isMap=function(t){return !!h(t)&&"[object Map]"===t.toString()},t.isMatchArray=Z,t.isMatchObject=(t,e)=>{const n=s(t);return !!Z(n,s(e))&&z(n,(n=>t[n]===e[n]))},t.isNull=f,t.isNumber=b,t.isNumberEqual=(t,e)=>t===e,t.isNumberInRange=(t,e,n)=>t>e&&t"__proto__"!==t&&"constructor"!==t&&"prototype"!==t,t.isPromise=x,t.isRegExp=t=>t instanceof RegExp,t.isSet=function(t){return !!h(t)&&"[object Set]"===t.toString()},t.isString=d,t.isUint16=function(t){return !!h(t)&&"Uint16Array"===t.constructor?.name},t.isUint32=function(t){return !!h(t)&&"Uint32Array"===t.constructor?.name},t.isUint8=function(t){return !!h(t)&&"Uint8Array"===t.constructor?.name},t.isUint8Clamped=function(t){return !!h(t)&&"Uint8ClampedArray"===t.constructor?.name},t.isUndefined=p,t.isWeakMap=function(t){return !!h(t)&&"[object WeakMap]"===t.toString()},t.isZero=t=>0===t,t.jsonParse=se,t.kebabCase=t=>t.replace(kt," ").trim().toLowerCase().replace(xt,"-$1"),t.keys=s,t.largest=t=>V(...t),t.last=(t,e)=>{const n=t.length;return e?t.slice(n-e,n):t[n-1]},t.map=bt,t.mapArray=q,t.mapArrayRight=function(t,e,n=[],r){let s=0;const i=t.length;for(let c=i-1;c>=0;c--)n[s]=e(t[c],c,t,i,r),s++;return n},t.mapAsync=Q,t.mapObject=pt,t.mapObjectAsync=async(t,e,n={})=>(await Rt(t,(async(t,r,s,i,c)=>{n[r]=await e(t,r,n,s,i,c);})),n),t.mapWhile=function(t,e,n=[],r){const s=t.length;for(let i=0;it-e,t.model=ce,t.multiply=(t,e)=>t*e,t.negate=t=>(...e)=>!t(...e),t.noop=()=>{},t.nthArg=(t=0)=>(...e)=>e[t],t.numSort=t=>t.sort(et),t.numericalCompare=et,t.numericalCompareReverse=nt,t.objectCreate=qt,t.objectSize=l,t.omit=(t,e)=>lt(t,((t,n)=>!e.includes(n))),t.once=t=>{let e;return (...n)=>(h(e)||(e=t(...n)),e)},t.over=t=>(...e)=>bt(t,(t=>t(...e))),t.overEvery=t=>(...e)=>mt(t,(t=>t(...e))),t.partition=(t,e)=>{const n=[];return [W(t,(t=>{if(e(t))return t;n.push(t);})),n]},t.pick=(t,e,n={})=>($(e,(e=>{n[e]=t[e];})),n),t.pluck=(t,e)=>q(t,(t=>t[e])),t.pluckObject=ct,t.pluckValues=(t,e)=>q(t,(t=>ct(t,e))),t.promise=t=>new Promise(t),t.propertyMatch=(t,e,n=s(t))=>z(n,(n=>Vt(t[n],e[n]))),t.rNumSort=t=>t.sort(nt),t.randomArbitrary=(t,e=0)=>T()*(t-e)+e,t.randomInt=B,t.range=(t,e,n=1)=>t{const r=[];let s=t;for(;s{const r=n<0?-1*n:n,s=[];let i=t;for(;i>e;)s.push(i),i-=r;return s})(t,e,n),t.rawURLDecode=Tt,t.reArg=(t,e)=>(...n)=>t(...e.map((t=>n[t]))),t.regexGenerator=j,t.remainder=(t,e)=>t%e,t.remove=(t,e)=>{let n=t.length;for(let r=0;r{let n=t.length;for(let r=0;rt.replace(new RegExp(`\\b${e.join("|")}\\b`,"gi"),n),t.rest=t=>t.slice(1,t.length),t.restString=Ft,t.right=(t,e)=>t[t.length-1-e],t.rightString=(t,e=1)=>t[t.length-e],t.sample=(t,e=1)=>{if(!t)return !1;const n=t.length;if(n===e||e>n)return L(t);if(1===e)return [t[B(n-1,0)]];const r=[],s={};let i,c=0;for(;cBt(Tt(t)),t.shuffle=L,t.smallest=t=>D(...t),t.snakeCase=t=>t.replace(kt," ").trim().toLowerCase().replace(xt,"_$1"),t.sortAlphabetical=(t,e)=>t.sort(((t,n)=>{const r=t[e],s=n[e];return rs?1:0})),t.sortNewest=st,t.sortOldest=it,t.sortedIndex=(t,e)=>{let n=0;return z(t,((t,r)=>(n=r,e>t))),n},t.stringify=ie,t.stubArray=()=>[],t.stubFalse=()=>!1,t.stubObject=()=>({}),t.stubString=()=>"",t.stubTrue=()=>!0,t.sum=t=>t.reduce(((t,e)=>t+e),0),t.take=(t,e=1)=>t.slice(0,e),t.takeRight=(t,e=1)=>{const n=t.length;return t.slice(n-e,n)},t.throttle=(t,e)=>{let n,r=!1;const s=(...s)=>{r?n=!0:(t(...s),r=Ot((()=>{n&&t(...s),r=!1;}),e));};return s.clear=()=>{clearTimeout(r),r=!1;},s},t.timer=Ot,t.times=rt,t.timesMap=(t,e,n,r=[])=>{const s=n?t:0,i=n?e:t,c=n||e;let o;return rt(s,i,(t=>{o=c(t,s,i,r),h(o)&&r.push(o);})),r},t.toArray=e,t.toPath=Qt,t.toggle=(t,e=!0,n=!1)=>Vt(e,t)?n:e,t.tokenize=t=>t.match(Lt)||[],t.truncate=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),s=r.length;let i,c=n-e;for(;c=0&&(i=r[c]," "!==i);c--);return t.slice(0,c).trim()})(t,e,n):t},t.truncateRight=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),s=r.length;let i,c=e;for(;c0&&(i=r[c]," "!==i);c++);return t.substr(c,n).trim()})(t,e,n):t},t.uid=ee,t.unZip=t=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.unZipObject=t=>{const e=[],n=[];return at(t,((t,r)=>{e.push(r),n.push(t);})),[e,n]},t.union=(...t)=>tt(E(t)),t.unique=tt,t.upperCase=t=>t.replace(kt," ").trim().toUpperCase(),t.upperFirst=t=>_t(t)+Ft(t),t.upperFirstAll=t=>t.replace($t,(t=>t.toUpperCase())),t.upperFirstLetter=_t,t.upperFirstOnly=zt,t.upperFirstOnlyAll=t=>zt(t.toLowerCase()).replace($t,(t=>t.toUpperCase())),t.whileArray=z,t.whileCompactMap=function(t,e,n=[],r){let s=0;for(;st.filter((t=>!e.includes(t))),t.words=t=>t.match(Dt)||[],t.wrap=(t,e)=>(...n)=>e(t,...n),t.xor=(...t)=>{const e=[];return $(t,(t=>{$(tt(t),(t=>{e.includes(t)?e.splice(e.indexOf(t),1):e.push(t);}));})),e},t.zip=(...t)=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.zipObject=(t,e)=>{const n={};return $(t,((t,r)=>{n[t]=e[r];})),n},Object.defineProperty(t,"__esModule",{value:!0});})); + !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).$={});}(window,(function(t){const e=Array.from,n=Reflect.apply,r=Object,s=r.keys,i=r.is,o=r.assign,c=r.getOwnPropertyDescriptor,u=r.defineProperty,a=r.getOwnPropertyNames,l=t=>s(t).length;function f(t){return void 0===t}function p(t){return null===t}function h(t){return !f(t)&&!p(t)}function g(t){return e=>!!h(e)&&e.constructor===t}const m=/\.|\+/,y=Array.isArray,d=g(String),b=g(Number),A=t=>!!h(t)&&"Object("===t.constructor.toString().trim().slice(9,16),w=t=>!!h(t)&&t instanceof Function,j=t=>Boolean(t.length),O=t=>e=>!!h(e)&&t.test(e),S=O(/\.css$/),v=O(/\.json$/),C=O(/\.js$/),M=O(/\.html$/),I=O(/\./),R=/\.([0-9a-z]+)/,k=t=>!!t&&t instanceof Promise,x=t=>!!t&&"AsyncFunction"===t.constructor?.name;const F=t=>y(t)&&t||h(t)&&[t]||[],E=t=>t.flat(1/0),U=t=>(t.length=0,t),N=Math,P=N.floor,T=N.random,B=(t,e=0)=>P(T()*(t-e))+e,L=(t,n=t.length)=>{if(t.length<=1)return e(t);const r=e(t);let s,i,o=0;for(;o=0;s--)e(t[s],s,t,r,n);return t}function K(t,e,n){const r=t.length;for(let s=0;s{!0===e(t,s,n,i,o,r)&&n.push(t);})),n}function W(t,e,n=[],r){return $(t,((t,s,i,o)=>{n[s]=e(t,s,n,i,o,r);})),n}function _(t,e,n=[],r){return $(t,((t,s,i,o)=>{const c=e(t,s,n,i,o,r);h(c)&&n.push(c);})),n}const J=(t,e,n=t.length)=>t.splice(e,n),V=(t,e)=>t.length===e.length&&K(t,((t,n)=>e[n]===t)),Z=Math.max,G=async(t,e)=>{const n=t.length;for(let r=0;r{const n=t.length;for(let r=n-1;r>=0;r--)await e(t[r],r,t,n);return t},Q=async(t,e)=>{const n=[];return await G(t,(async(t,r,s)=>{n[r]=await e(t,r,s);})),n},X=(t,e,n)=>n.indexOf(t)===e,Y=(t,e,n)=>t!==n[e-1],tt=(t,e)=>e?t.filter(Y):t.filter(X),et=(t,e)=>t-e,nt=(t,e)=>e-t,rt=(t,e,n)=>{const r=n?t:0,s=n?e:t,i=n||e;for(let t=r;t(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?-1:0:1:-1)),it=(t,e="id",n=!0)=>(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?1:0:-1:1)),ot=(t,e)=>W(e,(e=>t[e])),ct=(t,e,n,r,s)=>{if(t[s]===r)return !0},ut=(t,e)=>{$(s(t),((n,r,s,i)=>{e(t[n],n,t,i,s);}));},at=(t,e)=>K(s(t),((n,r,s,i)=>e(t[n],n,t,i,s))),lt=(t,e,n={})=>(ut(t,((t,r,s,i,o)=>{!0===e(t,r,n,s,i,o)&&(n[r]=t);})),n),ft=(t,e,n={})=>(ut(t,((t,r,s,i,o)=>{n[r]=e(t,r,n,s,i,o);})),n),pt=(t,e,n={})=>(ut(t,((t,r,s,i,o)=>{const c=e(t,r,n,s,i,o);h(c)&&(n[r]=c);})),n),ht=(t,e)=>t.forEach(e),gt=(t,e)=>(n,r,s)=>{let i;if(h(n))return i=y(n)?t:A(n)||w(n)?e:n.forEach?ht:e,i(n,r,s)},mt=gt(K,at),yt=gt($,ut),dt=gt(q,lt),bt=gt(W,ft),At=gt(_,pt),wt=mt,jt=(t,e)=>setTimeout(t,e),Ot=(t,e)=>setInterval(t,e),St=(t,e)=>()=>{rt(0,t((()=>{}),0),(t=>{e(t);}));},vt=St(jt,clearTimeout),Ct=St(Ot,clearInterval),Mt=(t,e)=>{const n=s(t);return K(e,(t=>n.includes(t)))},It=async(t,e)=>{const n=s(t);return await G(n,((r,s,i,o)=>e(t[r],r,t,o,n))),t},Rt=/[-_]/g,kt=/ (.)/g,xt=(t,e=1)=>t.substr(e),Ft=/%(?![\da-f]{2})/gi,Et=/&/g,Ut=//g,Pt=/"/g,Tt=t=>decodeURIComponent(t.replace(Ft,(()=>"%25"))),Bt=t=>t.replace(Et,"&").replace(Ut,"<").replace(Nt,">").replace(Pt,"""),Lt=/\S+/g,Dt=/\w+/g,$t=/ (.)/g,zt=t=>t[0].toUpperCase(),Kt=t=>zt(t)+xt(t).toLowerCase(),qt=Reflect.construct;function Wt(t,e=[],n){return n?qt(t,e,n):qt(t,e)}const _t=Object.create,Jt=(t,e,n=!1,r,i,o)=>{if(t){if(o){const s=o.pop();if(s){const r=e[s];t[s]=Jt(t[s],r,n);}else if(!i)return t;if(i){let s=r||0;if(s++,sglobalThis.structuredClone(t):t=>A(t)?Jt({},t):y(t)?Jt([],t):_t(t);const Zt=Function.prototype;const Gt=(t,e)=>{if(t===e)return !0;if(t.toString()===e.toString())if(A(t)){const n=s(t);if(Mt(e,n))return K(n,(n=>Gt(t[n],e[n])))}else if(y(t)&&t.length===e.length)return K(t,((t,n)=>Gt(t,e[n])));return !1},Ht=/\.|\[/,Qt=/]/g,Xt=t=>t.replace(Qt,"").split(Ht);let Yt=0;const te=[],ee={};function ne(){let t=te.shift(te);return h(t)||(t=Yt,ee[t]=!0,Yt++),t}ne.free=t=>{ee[t]=null,te.push(t);};const re=(t,e)=>{let n=e;return K(Xt(t),(t=>(n=n[t],h(n)))),n},se=JSON,ie=se.parse,oe=se.stringify;class ce{static models={};constructor(t,e){h(e)?(o(this,e),this.modelName=t,ce.models.set(t,e)):o(this,t);}}const ue=t=>(...e)=>n=>{let r=n;return t(e,(t=>{r=t(r);})),r},ae=ue($),le=ue(z),fe=t=>(...e)=>async n=>{let r=n;return await t(e,(async t=>{r=await t(r);})),r},pe=fe(G),he=fe(H);class ge{constructor(t={}){this.items=t;}getItem(t){return this.items[t]}setItem(t,e){this.items[t]=e;}clear(){this.items={};}removeItem(t){this.items[t]=null;}}t.Model=ce,t.VirtualStorage=ge,t.add=(t,e)=>t+e,t.after=(t,e)=>{let n,r=t;return (...t)=>(null!==r&&r--,r<=0&&(n=e(...t),r=null),n)},t.apply=n,t.arrayToObject=(t,e)=>{const n={};return $(t,((t,r)=>{n[e[r]]=t;})),n},t.ary=(t,e)=>(...n)=>t(...n.splice(0,e)),t.assign=o,t.assignDeep=Jt,t.asyncEach=async(t,e)=>{const n=t.length;for(let r=0;r{let n,r=t;return (...t)=>(null!==r&&r--,r>=1?n=e(...t):r=null,n)},t.bindAll=(t,e)=>bt(t,(t=>w(t)?t.bind(e):t)),t.cacheNativeMethod=function(t){return Zt.call.bind(t)},t.camelCase=t=>t.toLowerCase().replace(kt,(t=>t.toUpperCase().replace(/ /g,""))),t.chain=t=>{const e=t=>(e.value=t,e.methods);return o(e,{add:t=>((t,e)=>(yt(e,((e,n)=>{t.methods[n]=(...n)=>(e(t.value,...n),t.methods);})),t))(e,t),done(){const t=e.value;return e.value=null,t},methods:{}}),e.add(t),e},t.chunk=(t,e=1)=>{const n=[];let r=0;return t.forEach(((t,s)=>{s%e||(n.push([]),s&&r++),n[r].push(t);})),n},t.chunkString=(t,e)=>t.match(new RegExp(`(.|[\r\n]){1,${e}}`,"g")),t.clear=U,t.clearIntervals=Ct,t.clearTimers=vt,t.cloneArray=t=>t.slice(),t.compact=t=>t.filter((t=>!(d(t)&&!t.length)&&t)),t.compactKeys=t=>{const e=[];return ut(t,((t,n)=>{t&&e.push(n);})),e},t.compactMap=At,t.compactMapArray=_,t.compactMapAsync=async(t,e)=>{const n=[];let r;return await G(t,(async(t,s,i)=>{r=await e(t,s,n,i),h(r)&&n.push(r);})),n},t.compactMapObject=pt,t.compactMapObjectAsync=async(t,e,n={})=>(await It(t,(async(t,r,s,i,o)=>{const c=await e(t,r,n,i,o);h(c)&&(n[r]=c);})),n),t.construct=Wt,t.countBy=(t,e)=>{const n={};let r;return $(t,(t=>{r=e(t),n[r]||(n[r]=0),n[r]++;})),n},t.countKey=(t,e)=>{let n=0;return $(t,(t=>{t[e]&&n++;})),n},t.countWithoutKey=(t,e)=>{let n=0;return $(t,(t=>{t[e]||n++;})),n},t.curry=(t,e=t.length)=>{const n=[],r=(...s)=>{if(n.push(...s),n.length===e){const e=t(...n);return U(n),e}return r};return r},t.curryRight=(t,e=t.length)=>{const n=[],r=(...s)=>{if(n.unshift(...s),n.length===e){const e=t(...n);return U(n),e}return r};return r},t.debounce=(t,e)=>{let n=!1;const r=(...r)=>{!1!==n&&clearTimeout(n),n=jt((()=>{t(...r),n=!1;}),e);};return r.clear=()=>{n&&(clearTimeout(n),n=!1);},r},t.decimalCheck=m,t.deduct=t=>t-1,t.defineProperty=u,t.difference=(t,...e)=>{const n=E(e);return _(t,(t=>{if(!n.includes(t))return t}))},t.divide=(t,e)=>t/e,t.drop=J,t.dropRight=(t,e,n=t.length)=>J(t,0,n-e),t.each=yt,t.eachArray=$,t.eachArrayRight=z,t.eachAsync=G,t.eachAsyncRight=H,t.eachObject=ut,t.eachObjectAsync=It,t.eachWhile=mt,t.ensureArray=F,t.every=wt,t.filter=dt,t.filterArray=q,t.filterObject=lt,t.findIndex=(t,e,n="id")=>{const r=t.findIndex(((t,r)=>ct(t,0,0,e,n)));return -1!==r&&r},t.findItem=(t,e,n="id")=>{const r=t.find(((t,r)=>ct(t,0,0,e,n)));return -1!==r&&r},t.first=(t,e)=>e?t.slice(0,e):t[0],t.flatten=(t,e=1)=>{let n=t;for(let t=0;tt.concat(F(e))),[]);return n},t.flattenDeep=E,t.flow=ae,t.flowAsync=pe,t.flowAsyncRight=he,t.flowRight=le,t.get=re,t.getExtensionRegex=R,t.getFileExtension=t=>{const e=t.match(R);if(e)return e[1]},t.getNewest=(t,e)=>st(t,e,!1)[0],t.getOldest=(t,e="id")=>it(t,e)[0],t.getOwnPropertyDescriptor=c,t.getOwnPropertyNames=a,t.groupBy=(t,e)=>{const n={};return $(t,(t=>{const r=e(t);n[r]||(n[r]=[]),n[r].push(t);})),n},t.has=(t,...e)=>t.includes(...e),t.hasAnyKeys=(t,e)=>{const n=s(t);return Boolean(e.find((t=>n.includes(t))))},t.hasDot=I,t.hasKeys=Mt,t.hasLength=j,t.hasValue=h,t.htmlEntities=Bt,t.ifInvoke=(t,...e)=>{if(w(t))return t(...e)},t.ifNotEqual=(t,e,n)=>(e&&!h(t[e])&&(t[e]=n),t),t.inAsync=async(t,e)=>G(t,(async t=>{await t(e);})),t.inSync=(t,e)=>yt(t,(t=>{t(e);})),t.increment=t=>t+1,t.indexBy=(t,e="id")=>{const n={};return $(t,(t=>{n[t[e]]=t;})),n},t.initial=t=>t.slice(0,t.length-1),t.initialString=(t,e=1)=>t.slice(0,-1*e),t.insertInRange=(t,e,n)=>t.slice(0,e)+n+t.slice(e,t.length),t.intersect=(t,...e)=>_(t,(t=>{if(K(e,(e=>e.includes(t))))return t})),t.interval=Ot,t.invert=(t,e={})=>(ut(t,((t,n)=>{e[t]=n;})),e),t.invoke=(t,e,n)=>W(t,((t,r)=>t[e](n,r))),t.invokeAsync=(t,e,n)=>Q(t,(async(t,r)=>t[e](n,r))),t.is=i,t.isArguments=function(t){return !!h(t)&&"[object Arguments]"===t.toString()},t.isArray=y,t.isAsync=x,t.isBoolean=t=>"Boolean"===t.constructor.name,t.isBuffer=function(t){return !!h(t)&&"ArrayBuffer"===t.constructor?.name},t.isConstructor=g,t.isDate=t=>t instanceof Date,t.isDecimal=t=>m.test(t.toString()),t.isEmpty=t=>d(t)||y(t)?!j(t):A(t)?!l(t):!h(t),t.isEqual=Gt,t.isFileCSS=S,t.isFileHTML=M,t.isFileJS=C,t.isFileJSON=v,t.isFloat32=function(t){return !!h(t)&&"Float32Array"===t.constructor?.name},t.isFloat64=function(t){return !!h(t)&&"Float64Array"===t.constructor?.name},t.isFunction=w,t.isInt16=function(t){return !!h(t)&&"Int16Array"===t.constructor?.name},t.isInt32=function(t){return !!h(t)&&"Int32Array"===t.constructor?.name},t.isInt8=function(t){return !!h(t)&&"Int8Array"===t.constructor?.name},t.isKindAsync=t=>!!t&&(k(t)||x(t)),t.isMap=function(t){return !!h(t)&&"[object Map]"===t.toString()},t.isMatchArray=V,t.isMatchObject=(t,e)=>{const n=s(t);return !!V(n,s(e))&&K(n,(n=>t[n]===e[n]))},t.isNull=p,t.isNumber=b,t.isNumberEqual=(t,e)=>t===e,t.isNumberInRange=(t,e,n)=>t>e&&t{const e=typeof t;return null==t||"object"!==e&&"function"!==e},t.isPromise=k,t.isRegExp=t=>t instanceof RegExp,t.isSet=function(t){return !!h(t)&&"[object Set]"===t.toString()},t.isString=d,t.isUint16=function(t){return !!h(t)&&"Uint16Array"===t.constructor?.name},t.isUint32=function(t){return !!h(t)&&"Uint32Array"===t.constructor?.name},t.isUint8=function(t){return !!h(t)&&"Uint8Array"===t.constructor?.name},t.isUint8Clamped=function(t){return !!h(t)&&"Uint8ClampedArray"===t.constructor?.name},t.isUndefined=f,t.isWeakMap=function(t){return !!h(t)&&"[object WeakMap]"===t.toString()},t.isZero=t=>0===t,t.jsonParse=ie,t.kebabCase=t=>t.replace(Rt," ").trim().toLowerCase().replace(kt,"-$1"),t.keys=s,t.largest=t=>Z(...t),t.last=(t,e)=>{const n=t.length;return e?t.slice(n-e,n):t[n-1]},t.map=bt,t.mapArray=W,t.mapArrayRight=function(t,e,n=[],r){let s=0;const i=t.length;for(let o=i-1;o>=0;o--)n[s]=e(t[o],o,t,i,r),s++;return n},t.mapAsync=Q,t.mapObject=ft,t.mapObjectAsync=async(t,e,n={})=>(await It(t,(async(t,r,s,i,o)=>{n[r]=await e(t,r,n,s,i,o);})),n),t.mapWhile=function(t,e,n=[],r){const s=t.length;for(let i=0;it-e,t.model=function(t,e){return h(e)?Wt(ce,[t,e]):re(t,ce.models)},t.multiply=(t,e)=>t*e,t.negate=t=>(...e)=>!t(...e),t.noop=()=>{},t.nthArg=(t=0)=>(...e)=>e[t],t.numSort=t=>t.sort(et),t.numericalCompare=et,t.numericalCompareReverse=nt,t.objectCreate=_t,t.objectSize=l,t.omit=(t,e)=>lt(t,((t,n)=>!e.includes(n))),t.once=t=>{let e;return (...n)=>(h(e)||(e=t(...n)),e)},t.over=t=>(...e)=>bt(t,(t=>t(...e))),t.overEvery=t=>(...e)=>mt(t,(t=>t(...e))),t.partition=(t,e)=>{const n=[];return [_(t,(t=>{if(e(t))return t;n.push(t);})),n]},t.pick=(t,e,n={})=>($(e,(e=>{n[e]=t[e];})),n),t.pluck=(t,e)=>W(t,(t=>t[e])),t.pluckObject=ot,t.pluckValues=(t,e)=>W(t,(t=>ot(t,e))),t.promise=t=>new Promise(t),t.propertyMatch=(t,e,n=s(t))=>K(n,(n=>Gt(t[n],e[n]))),t.rNumSort=t=>t.sort(nt),t.randomArbitrary=(t,e=0)=>T()*(t-e)+e,t.randomInt=B,t.range=(t,e,n=1)=>t{const r=[];let s=t;for(;s{const r=n<0?-1*n:n,s=[];let i=t;for(;i>e;)s.push(i),i-=r;return s})(t,e,n),t.rawURLDecode=Tt,t.reArg=(t,e)=>(...n)=>t(...e.map((t=>n[t]))),t.regexGenerator=O,t.remainder=(t,e)=>t%e,t.remove=(t,e)=>{let n=t.length;for(let r=0;r{let n=t.length;for(let r=0;rt.replace(new RegExp(`\\b${e.join("|")}\\b`,"gi"),n),t.rest=t=>t.slice(1,t.length),t.restString=xt,t.right=(t,e)=>t[t.length-1-e],t.rightString=(t,e=1)=>t[t.length-e],t.sample=(t,e=1)=>{if(!t)return !1;const n=t.length;if(n===e||e>n)return L(t);if(1===e)return [t[B(n-1,0)]];const r=[],s={};let i,o=0;for(;oBt(Tt(t)),t.shuffle=L,t.smallest=t=>D(...t),t.snakeCase=t=>t.replace(Rt," ").trim().toLowerCase().replace(kt,"_$1"),t.sortAlphabetical=(t,e)=>t.sort(((t,n)=>{const r=t[e],s=n[e];return rs?1:0})),t.sortNewest=st,t.sortOldest=it,t.sortedIndex=(t,e)=>{let n=0;return K(t,((t,r)=>(n=r,e>t))),n},t.stringify=oe,t.stubArray=()=>[],t.stubFalse=()=>!1,t.stubObject=()=>({}),t.stubString=()=>"",t.stubTrue=()=>!0,t.sum=t=>t.reduce(((t,e)=>t+e),0),t.take=(t,e=1)=>t.slice(0,e),t.takeRight=(t,e=1)=>{const n=t.length;return t.slice(n-e,n)},t.throttle=(t,e)=>{let n,r=!1;const s=(...s)=>{r?n=!0:(t(...s),r=jt((()=>{n&&t(...s),r=!1;}),e));};return s.clear=()=>{clearTimeout(r),r=!1;},s},t.timer=jt,t.times=rt,t.timesMap=(t,e,n,r=[])=>{const s=n?t:0,i=n?e:t,o=n||e;let c;return rt(s,i,(t=>{c=o(t,s,i,r),h(c)&&r.push(c);})),r},t.toArray=e,t.toPath=Xt,t.toggle=(t,e=!0,n=!1)=>Gt(e,t)?n:e,t.tokenize=t=>t.match(Lt)||[],t.truncate=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),s=r.length;let i,o=n-e;for(;o=0&&(i=r[o]," "!==i);o--);return t.slice(0,o).trim()})(t,e,n):t},t.truncateRight=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),s=r.length;let i,o=e;for(;o0&&(i=r[o]," "!==i);o++);return t.substr(o,n).trim()})(t,e,n):t},t.uid=ne,t.unZip=t=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.unZipObject=t=>{const e=[],n=[];return ut(t,((t,r)=>{e.push(r),n.push(t);})),[e,n]},t.union=(...t)=>tt(E(t)),t.unique=tt,t.upperCase=t=>t.replace(Rt," ").trim().toUpperCase(),t.upperFirst=t=>zt(t)+xt(t),t.upperFirstAll=t=>t.replace($t,(t=>t.toUpperCase())),t.upperFirstLetter=zt,t.upperFirstOnly=Kt,t.upperFirstOnlyAll=t=>Kt(t.toLowerCase()).replace($t,(t=>t.toUpperCase())),t.virtualStorage=function(){return new ge},t.whileArray=K,t.whileCompactMap=function(t,e,n=[],r){let s=0;for(;st.filter((t=>!e.includes(t))),t.words=t=>t.match(Dt)||[],t.wrap=(t,e)=>(...n)=>e(t,...n),t.xor=(...t)=>{const e=[];return $(t,(t=>{$(tt(t),(t=>{e.includes(t)?e.splice(e.indexOf(t),1):e.push(t);}));})),e},t.zip=(...t)=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.zipObject=(t,e)=>{const n={};return $(t,((t,r)=>{n[t]=e[r];})),n},Object.defineProperty(t,"__esModule",{value:!0});})); - (function() { - const { assign: assign$1 } = self.$; - const app = { - config: {}, - utility: self.$, - events: { - appStatus: { - state: 0 - }, - post(id, data, options) { - const responseData = { - data, - id - }; - assign$1(responseData, options); - postMessage(responseData); - }, - socket: {} - } - }; - console.log(app.$); - const { - config, - utility: { - assign, uid, isFileJS, isFileJSON, isFileCSS, initial, map, promise, construct, isPlainObject, isString, stringify, jsonParse - }, - events: { post: post$1 } - } = app; - const shouldNotUpgrade = /(^js\/lib\/)|(\.min\.js)/; - const importRegexGlobal = /\bimport\b([^:;=]*?){([^;]*?)}(\s\bfrom\b).*(('|"|`).*('|"|`));$/gm; - const importSingleRegexGlobal = /\bimport\b([^:;={}]*?)([^;{}]*?)(\s\bfrom\b).*(('|"|`).*('|"|`));$/gm; - const importEntire = /\bimport\b\s(('|"|`).*('|"|`));$/gm; - const importDynamic = /{([^;]*?)}\s=\simport\((('|"|`).*('|"|`))\);$/gm; - const slashString = '/'; - const replaceImports = function(file) { - let compiled = file; - compiled = compiled.replace(importRegexGlobal, 'const {$2} = await appGlobal.demandJs($4);'); - compiled = compiled.replace(importSingleRegexGlobal, 'const $2 = await appGlobal.demandJs($4);'); - compiled = compiled.replace(importEntire, 'await appGlobal.demandJs($1);'); - compiled = compiled.replace(importDynamic, '{$1} = await appGlobal.demandJs($2);'); - return compiled; - }; - const getCallback = async function(response, configObj, workerInfo) { - const { body } = response; - const item = body.file; - const checksum = body.cs; - const cacheCheck = body.cache; - const key = body.key; - const fileList = configObj.fileList; - const filename = fileList.files[key]; - const completedFiles = configObj.completedFiles; - const checksums = configObj.checksum; - const isLib = shouldNotUpgrade.test(filename); - const isJs = isFileJS(filename); - const isJson = isFileJSON(filename); - const isCss = isFileCSS(filename); - const dirname = initial(filename.split(slashString)).join(slashString); - let sendNow; - /* - During an active stream data is compiled. - Based on Key coming in. - */ - if (item) { - completedFiles[key] += item; - } else if (item === false) { - checksums[key] = false; - completedFiles[key] = false; - configObj.filesLoaded += 1; - sendNow = true; - } else if (cacheCheck) { - completedFiles[key] = true; - configObj.filesLoaded += 1; - sendNow = true; - } else { - configObj.filesLoaded += 1; - checksums[key] = checksum; - sendNow = true; - } - if (sendNow) { - let completedFile = completedFiles[key]; - if (completedFile !== true && isJs && !isLib && completedFile !== false) { - completedFile = replaceImports(completedFile); - } - post$1( - workerInfo.id, - { - cs: checksums[key], - dirname, - file: completedFile, - isCss, - isJs, - isJson, - isLib, - key - }, - { - keep: true - } - ); - } - if (configObj.filesLoaded === configObj.fileListLength) { - const returned = { - loaded: configObj.filesLoaded - }; - return returned; - } - return false; - }; - class client { - update(json) { - post$1('_', json); - } - callbacks = { - update(json) { - return this.update(json); - } - }; - status = 0; - ready() { - console.log('Socket Is Ready'); - if (this.status) { - this.update({ - data: { - type: 'connection', - status: 'reconnected' - } - }); - } else { - post$1('ready', { - type: 'connection', - status: 'connected' - }); - this.status = 1; - console.log('connected'); - } - } - process(response) { - const compiledResponse = jsonParse(response); - console.log(compiledResponse); - if (!compiledResponse.id) { - return this.update(compiledResponse); - } - const callback = this.callbacks[compiledResponse.id]; - if (callback) { - return callback(compiledResponse); - } - } - connect() { - this.socket = construct(WebSocket, [this.hostDomain]); - this.socket.addEventListener('open', () => { - this.ready(); - }); - // Listen for messages - this.socket.addEventListener('message', (socketEvent) => { - console.log('Message from server ', socketEvent.data); - this.process(socketEvent.data); - }); - this.socket.addEventListener('disconnect', (reason) => { - console.log('disconnected'); - if (reason === 'io server disconnect') { - this.connect(); - } - this.update({ - data: { - type: 'connection', - status: 'disconnected' - } - }); - }); - this.socket.addEventListener('close', (reason) => { - console.log('disconnected'); - if (reason === 'io server disconnect') { - this.socket.connect(); - } - this.update({ - data: { - type: 'connection', - status: 'closed' - } - }); - }); - } - send(data) { - if (isPlainObject(data)) { - this.socket.send(stringify(data)); - } else if (isString(data)) { - this.socket.send(data); - } else { - this.socket.send(data); - } - } - async request(configObj) { - const results = await promise((accept) => { - const { - data, callback - } = configObj; - if (data.id) { - data.id = null; - } else { - const uuid = uid().toString(); - data.id = uuid; - this.callbacks[uuid] = async (requestData) => { - if (callback) { - const returned = await callback(requestData); - if (returned) { - this.callbacks[uuid] = null; - uid.free(uuid); - accept(returned); - } - } else { - accept(requestData.data); - } - }; - } - this.send(data); - }); - return results; - } - constructor() { - console.log('Worker Socket Module', 'notify'); - this.hostDomain = `${app.config.socketHostname || location.hostname}`; - if (app.config.port) { - this.hostDomain = `${this.hostDomain}:${app.config.port}`; - } - console.log(this.hostDomain); - this.connect(); - } - } - let socketObject; - assign(app.events.socket, { - async get(options, workerInfo) { - const { body } = options; - const fileList = body.files; - const configObj = { - checksum: [], - completedFiles: map(fileList, () => { - return ''; - }), - fileList: body, - fileListLength: fileList.length, - filesLoaded: 0, - progress: options.progress - }; - const requestConfig = { - async callback(json) { - return getCallback(json, configObj, workerInfo); - }, - data: { - request: 'file.get', - body - } - }; - const results = await socketObject.request(requestConfig); - post$1(workerInfo.id, results); - }, - request(data) { - socketObject.request(data); - } - }); - app.events.configure = (data) => { - assign(config, data); - console.log('STARTING'); - socketObject = construct(client, []); - }; - const { - utility: { get }, - events, - events: { post } - } = app; - self.onmessage = async (workerEvent) => { - const { - request, id, data - } = workerEvent.data; - const eventCallback = get(request, events); - console.log(request, data); - if (eventCallback) { - const results = await eventCallback(data, { - id - }); - if (results) { - post(id, results); - } - if (app.debug) { - console.log(`Worker api.${request}`); - } - } else { - console.log(`FAILED Worker api.${request}`); - } - }; - })(); + (function() { + const { + isFileJS, isFileJSON, isFileCSS, initial + } = self.$; + const shouldNotUpgrade = /(^js\/lib\/)|(\.min\.js)/; + const importRegexGlobal = /\bimport\b([^:;=]*?){([^;]*?)}(\s\bfrom\b).*(('|"|`).*('|"|`));$/gm; + const importSingleRegexGlobal = /\bimport\b([^:;={}]*?)([^;{}]*?)(\s\bfrom\b).*(('|"|`).*('|"|`));$/gm; + const importEntire = /\bimport\b\s(('|"|`).*('|"|`));$/gm; + const importDynamic = /{([^;]*?)}\s=\simport\((('|"|`).*('|"|`))\);$/gm; + const slashString = '/'; + const replaceImports = function(file) { + let compiled = file; + compiled = compiled.replace(importRegexGlobal, 'const {$2} = await appGlobal.demandJs($4);'); + compiled = compiled.replace(importSingleRegexGlobal, 'const $2 = await appGlobal.demandJs($4);'); + compiled = compiled.replace(importEntire, 'await appGlobal.demandJs($1);'); + compiled = compiled.replace(importDynamic, '{$1} = await appGlobal.demandJs($2);'); + return compiled; + }; + const keepObject = { + keep: true + }; + const processScriptRequest = async function(contex, response, configObj, workerInfo) { + const { body } = response; + const { + file, cs, cache + } = body; + const key = body.key; + const fileList = configObj.fileList; + const filename = fileList.files[key]; + const completedFiles = configObj.completedFiles; + const checksums = configObj.checksum; + const isLib = shouldNotUpgrade.test(filename); + // Remove this can just get ext on other end and check if needed + const isJs = isFileJS(filename); + const isJson = isFileJSON(filename); + const isCss = isFileCSS(filename); + const dirname = initial(filename.split(slashString)).join(slashString); + /* + During an active stream data is compiled. + Based on Key coming in. + */ + if (file) { + completedFiles[key] = file; + checksums[key] = cs; + configObj.filesLoaded += 1; + } else if (file === false) { + checksums[key] = false; + completedFiles[key] = false; + configObj.filesLoaded += 1; + } else if (cache) { + completedFiles[key] = true; + configObj.filesLoaded += 1; + } + let completedFile = completedFiles[key]; + if (completedFile !== true && isJs && !isLib && completedFile !== false) { + completedFile = replaceImports(completedFile); + } + const message = { + dirname, + isCss, + isJs, + isJson, + isLib, + key + }; + if (cs) { + message.cs = cs; + } + if (completedFile) { + message.file = completedFile; + } + contex.post(workerInfo.id, message, keepObject); + if (configObj.filesLoaded === configObj.fileListLength) { + const returned = { + loaded: configObj.filesLoaded + }; + return returned; + } + return false; + }; + const { + uid, promise, construct: construct$2, isPlainObject, isString, stringify, jsonParse, hasValue + } = self.$; + class ClientSocket { + constructor(app) { + this.app = app; + console.log('Worker Socket Module', 'notify'); + this.hostDomain = `${app.config.socketHostname || location.hostname}`; + if (app.config.port) { + this.hostDomain = `${this.hostDomain}:${app.config.port}`; + } + console.log(this.hostDomain); + this.connect(); + clearInterval(); + } + callbacks = {}; + status = 0; + ready() { + console.log('Socket Is Ready'); + if (this.status) { + this.app.update({ + type: 'connection', + status: 'reconnected' + }); + } else { + this.app.post('ready', { + type: 'connection', + status: 'connected' + }); + this.status = 1; + console.log('connected'); + } + } + process(response) { + const compiledResponse = jsonParse(response); + console.log(compiledResponse); + if (!compiledResponse.id) { + return this.app.update(compiledResponse); + } + const callback = this.callbacks[compiledResponse.id]; + if (callback) { + return callback(compiledResponse); + } + } + reconnect() { + const thisContext = this; + if (!hasValue(thisContext.connectInterval)) { + thisContext.connectInterval = setInterval(() => { + thisContext.connect(); + }, 2000); + } + } + connect() { + const thisContext = this; + thisContext.socket = construct$2(WebSocket, [thisContext.hostDomain]); + thisContext.socket.addEventListener('open', () => { + if (hasValue(thisContext.connectInterval)) { + clearInterval(thisContext.connectInterval); + } + this.ready(); + }); + // Listen for messages + thisContext.socket.addEventListener('message', (socketEvent) => { + console.log('Message from server ', socketEvent.data); + thisContext.process(socketEvent.data); + }); + thisContext.socket.addEventListener('disconnect', () => { + console.log('disconnected'); + if (!hasValue(thisContext.connectInterval)) { + thisContext.app.update({ + type: 'connection', + status: 'disconnected' + }); + } + thisContext.reconnect(); + }); + thisContext.socket.addEventListener('close', () => { + console.log('close'); + if (!hasValue(thisContext.connectInterval)) { + thisContext.app.update({ + type: 'connection', + status: 'closed' + }); + } + thisContext.reconnect(); + }); + } + send(data) { + if (isPlainObject(data)) { + this.socket.send(stringify(data)); + } else if (isString(data)) { + this.socket.send(data); + } else { + this.socket.send(data); + } + } + async request(configObj) { + const results = await promise((accept) => { + const { + data, callback + } = configObj; + if (data.id) { + data.id = null; + } else { + const uuid = uid().toString(); + data.id = uuid; + this.callbacks[uuid] = async (requestData) => { + if (callback) { + const returned = await callback(requestData); + if (returned) { + this.callbacks[uuid] = null; + uid.free(uuid); + accept(returned); + } + } else { + accept(requestData.data); + } + }; + } + this.send(data); + }); + return results; + } + } + const { + assign, construct: construct$1, get, map, apply + } = self.$; + class AppWorker { + constructor() { + self.onmessage = async (workerEvent) => { + this.onmessage(workerEvent); + }; + } + async onmessage(workerEvent) { + console.log(workerEvent.data); + const { + task, id, data + } = workerEvent.data; + const eventCallback = get(task, this.tasks); + console.log(task, data); + if (eventCallback) { + const results = await apply(eventCallback, this, [ + data, + { + id + } + ]); + if (results) { + this.post(id, results); + } + if (this.debug) { + console.log(`Worker api.${task}`); + } + } else { + console.log(`FAILED Worker api.${task}`); + } + } + update(body) { + console.log(body); + this.post('_', { + body + }); + } + post(id, data, options) { + const responseData = { + data, + id + }; + assign(responseData, options); + postMessage(responseData); + } + state = 1; + config = {}; + tasks = { + configure(data) { + assign(this.config, data); + console.log('STARTING'); + this.socket = construct$1(ClientSocket, [this]); + }, + post(id, data, options) { + const responseData = { + data, + id + }; + assign(responseData, options); + postMessage(responseData); + }, + socket: { + async get(options, workerInfo) { + const context = this; + const { body } = options; + const fileList = body.files; + const configObj = { + checksum: [], + completedFiles: map(fileList, () => { + return ''; + }), + fileList: body, + fileListLength: fileList.length, + filesLoaded: 0, + progress: options.progress + }; + const requestConfig = { + async callback(json) { + return processScriptRequest(context, json, configObj, workerInfo); + }, + data: { + task: 'file.get', + body + } + }; + const results = await this.socket.request(requestConfig); + this.post(workerInfo.id, results); + }, + request(data) { + this.socket.request(data); + } + } + }; + utility = self.$; + } + const { construct } = self.$; + construct(AppWorker, []); + })(); })(); diff --git a/uwBridge/system/compile/build/worker/coreBundle.js b/uwBridge/system/compile/build/worker/coreBundle.js index 173bf244..38f23c4d 100644 --- a/uwBridge/system/compile/build/worker/coreBundle.js +++ b/uwBridge/system/compile/build/worker/coreBundle.js @@ -1,31 +1,7 @@ (function() { - const { assign: assign$1 } = self.$; - const app = { - config: {}, - utility: self.$, - events: { - appStatus: { - state: 0 - }, - post(id, data, options) { - const responseData = { - data, - id - }; - assign$1(responseData, options); - postMessage(responseData); - }, - socket: {} - } - }; - console.log(app.$); const { - config, - utility: { - assign, uid, isFileJS, isFileJSON, isFileCSS, initial, map, promise, construct, isPlainObject, isString, stringify, jsonParse - }, - events: { post: post$1 } - } = app; + isFileJS, isFileJSON, isFileCSS, initial + } = self.$; const shouldNotUpgrade = /(^js\/lib\/)|(\.min\.js)/; const importRegexGlobal = /\bimport\b([^:;=]*?){([^;]*?)}(\s\bfrom\b).*(('|"|`).*('|"|`));$/gm; const importSingleRegexGlobal = /\bimport\b([^:;={}]*?)([^;{}]*?)(\s\bfrom\b).*(('|"|`).*('|"|`));$/gm; @@ -40,64 +16,60 @@ compiled = compiled.replace(importDynamic, '{$1} = await appGlobal.demandJs($2);'); return compiled; }; - const getCallback = async function(response, configObj, workerInfo) { + const keepObject = { + keep: true + }; + const processScriptRequest = async function(contex, response, configObj, workerInfo) { const { body } = response; - const item = body.file; - const checksum = body.cs; - const cacheCheck = body.cache; + const { + file, cs, cache + } = body; const key = body.key; const fileList = configObj.fileList; const filename = fileList.files[key]; const completedFiles = configObj.completedFiles; const checksums = configObj.checksum; const isLib = shouldNotUpgrade.test(filename); + // Remove this can just get ext on other end and check if needed const isJs = isFileJS(filename); const isJson = isFileJSON(filename); const isCss = isFileCSS(filename); const dirname = initial(filename.split(slashString)).join(slashString); - let sendNow; /* During an active stream data is compiled. Based on Key coming in. */ - if (item) { - completedFiles[key] += item; - } else if (item === false) { + if (file) { + completedFiles[key] = file; + checksums[key] = cs; + configObj.filesLoaded += 1; + } else if (file === false) { checksums[key] = false; completedFiles[key] = false; configObj.filesLoaded += 1; - sendNow = true; - } else if (cacheCheck) { + } else if (cache) { completedFiles[key] = true; configObj.filesLoaded += 1; - sendNow = true; - } else { - configObj.filesLoaded += 1; - checksums[key] = checksum; - sendNow = true; } - if (sendNow) { - let completedFile = completedFiles[key]; - if (completedFile !== true && isJs && !isLib && completedFile !== false) { - completedFile = replaceImports(completedFile); - } - post$1( - workerInfo.id, - { - cs: checksums[key], - dirname, - file: completedFile, - isCss, - isJs, - isJson, - isLib, - key - }, - { - keep: true - } - ); + let completedFile = completedFiles[key]; + if (completedFile !== true && isJs && !isLib && completedFile !== false) { + completedFile = replaceImports(completedFile); + } + const message = { + dirname, + isCss, + isJs, + isJson, + isLib, + key + }; + if (cs) { + message.cs = cs; } + if (completedFile) { + message.file = completedFile; + } + contex.post(workerInfo.id, message, keepObject); if (configObj.filesLoaded === configObj.fileListLength) { const returned = { loaded: configObj.filesLoaded @@ -106,27 +78,32 @@ } return false; }; - class client { - update(json) { - post$1('_', json); + const { + uid, promise, construct: construct$2, isPlainObject, isString, stringify, jsonParse, hasValue + } = self.$; + class ClientSocket { + constructor(app) { + this.app = app; + console.log('Worker Socket Module', 'notify'); + this.hostDomain = `${app.config.socketHostname || location.hostname}`; + if (app.config.port) { + this.hostDomain = `${this.hostDomain}:${app.config.port}`; + } + console.log(this.hostDomain); + this.connect(); + clearInterval(); } - callbacks = { - update(json) { - return this.update(json); - } - }; + callbacks = {}; status = 0; ready() { console.log('Socket Is Ready'); if (this.status) { - this.update({ - data: { - type: 'connection', - status: 'reconnected' - } + this.app.update({ + type: 'connection', + status: 'reconnected' }); } else { - post$1('ready', { + this.app.post('ready', { type: 'connection', status: 'connected' }); @@ -138,46 +115,54 @@ const compiledResponse = jsonParse(response); console.log(compiledResponse); if (!compiledResponse.id) { - return this.update(compiledResponse); + return this.app.update(compiledResponse); } const callback = this.callbacks[compiledResponse.id]; if (callback) { return callback(compiledResponse); } } + reconnect() { + const thisContext = this; + if (!hasValue(thisContext.connectInterval)) { + thisContext.connectInterval = setInterval(() => { + thisContext.connect(); + }, 2000); + } + } connect() { - this.socket = construct(WebSocket, [this.hostDomain]); - this.socket.addEventListener('open', () => { + const thisContext = this; + thisContext.socket = construct$2(WebSocket, [thisContext.hostDomain]); + thisContext.socket.addEventListener('open', () => { + if (hasValue(thisContext.connectInterval)) { + clearInterval(thisContext.connectInterval); + } this.ready(); }); // Listen for messages - this.socket.addEventListener('message', (socketEvent) => { + thisContext.socket.addEventListener('message', (socketEvent) => { console.log('Message from server ', socketEvent.data); - this.process(socketEvent.data); + thisContext.process(socketEvent.data); }); - this.socket.addEventListener('disconnect', (reason) => { + thisContext.socket.addEventListener('disconnect', () => { console.log('disconnected'); - if (reason === 'io server disconnect') { - this.connect(); - } - this.update({ - data: { + if (!hasValue(thisContext.connectInterval)) { + thisContext.app.update({ type: 'connection', status: 'disconnected' - } - }); - }); - this.socket.addEventListener('close', (reason) => { - console.log('disconnected'); - if (reason === 'io server disconnect') { - this.socket.connect(); + }); } - this.update({ - data: { + thisContext.reconnect(); + }); + thisContext.socket.addEventListener('close', () => { + console.log('close'); + if (!hasValue(thisContext.connectInterval)) { + thisContext.app.update({ type: 'connection', status: 'closed' - } - }); + }); + } + thisContext.reconnect(); }); } send(data) { @@ -215,76 +200,105 @@ this.send(data); }); return results; - } - constructor() { - console.log('Worker Socket Module', 'notify'); - this.hostDomain = `${app.config.socketHostname || location.hostname}`; - if (app.config.port) { - this.hostDomain = `${this.hostDomain}:${app.config.port}`; - } - console.log(this.hostDomain); - this.connect(); } } - let socketObject; - assign(app.events.socket, { - async get(options, workerInfo) { - const { body } = options; - const fileList = body.files; - const configObj = { - checksum: [], - completedFiles: map(fileList, () => { - return ''; - }), - fileList: body, - fileListLength: fileList.length, - filesLoaded: 0, - progress: options.progress + const { + assign, construct: construct$1, get, map, apply + } = self.$; + class AppWorker { + constructor() { + self.onmessage = async (workerEvent) => { + this.onmessage(workerEvent); }; - const requestConfig = { - async callback(json) { - return getCallback(json, configObj, workerInfo); - }, - data: { - request: 'file.get', - body + } + async onmessage(workerEvent) { + console.log(workerEvent.data); + const { + task, id, data + } = workerEvent.data; + const eventCallback = get(task, this.tasks); + console.log(task, data); + if (eventCallback) { + const results = await apply(eventCallback, this, [ + data, + { + id + } + ]); + if (results) { + this.post(id, results); } - }; - const results = await socketObject.request(requestConfig); - post$1(workerInfo.id, results); - }, - request(data) { - socketObject.request(data); + if (this.debug) { + console.log(`Worker api.${task}`); + } + } else { + console.log(`FAILED Worker api.${task}`); + } } - }); - app.events.configure = (data) => { - assign(config, data); - console.log('STARTING'); - socketObject = construct(client, []); - }; - const { - utility: { get }, - events, - events: { post } - } = app; - self.onmessage = async (workerEvent) => { - const { - request, id, data - } = workerEvent.data; - const eventCallback = get(request, events); - console.log(request, data); - if (eventCallback) { - const results = await eventCallback(data, { - id + update(body) { + console.log(body); + this.post('_', { + body }); - if (results) { - post(id, results); - } - if (app.debug) { - console.log(`Worker api.${request}`); - } - } else { - console.log(`FAILED Worker api.${request}`); } - }; + post(id, data, options) { + const responseData = { + data, + id + }; + assign(responseData, options); + postMessage(responseData); + } + state = 1; + config = {}; + tasks = { + configure(data) { + assign(this.config, data); + console.log('STARTING'); + this.socket = construct$1(ClientSocket, [this]); + }, + post(id, data, options) { + const responseData = { + data, + id + }; + assign(responseData, options); + postMessage(responseData); + }, + socket: { + async get(options, workerInfo) { + const context = this; + const { body } = options; + const fileList = body.files; + const configObj = { + checksum: [], + completedFiles: map(fileList, () => { + return ''; + }), + fileList: body, + fileListLength: fileList.length, + filesLoaded: 0, + progress: options.progress + }; + const requestConfig = { + async callback(json) { + return processScriptRequest(context, json, configObj, workerInfo); + }, + data: { + task: 'file.get', + body + } + }; + const results = await this.socket.request(requestConfig); + this.post(workerInfo.id, results); + }, + request(data) { + this.socket.request(data); + } + } + }; + utility = self.$; + } + const { construct } = self.$; + construct(AppWorker, []); })(); diff --git a/uwBridge/system/compile/source/front/core/demand.js b/uwBridge/system/compile/source/front/core/demand.js index 2733e4b6..68ddb840 100644 --- a/uwBridge/system/compile/source/front/core/demand.js +++ b/uwBridge/system/compile/source/front/core/demand.js @@ -14,7 +14,9 @@ const { each, cnsl, initialString, - getFileExtension + getFileExtension, + isArray, + isNumber }, imported, crate @@ -46,6 +48,9 @@ const buildFilePath = (itemArg) => { }); } } + if (item[0] !== '/') { + item = `/${item}`; + } return item; }; const singleDemand = (items) => { @@ -53,6 +58,9 @@ const singleDemand = (items) => { }; const objectDemand = (items, arrayToObjectMap) => { return map(arrayToObjectMap, (item) => { + if (isPlainObject(item)) { + return item; + } return items[item]; }); }; @@ -69,49 +77,84 @@ const streamAssets = (data, options) => { }, options)); }); }; -export const demand = async (filesArg, options) => { - const assets = []; +export const demand = async (files, options) => { + const remoteImport = []; + const localImport = []; + const compiledImports = []; + let results; let demandType; let arrayToObjectMap; - let files = filesArg; if (isPlainObject(files)) { demandType = objectDemand; arrayToObjectMap = {}; - let index = 0; each(files, (item, key) => { - arrayToObjectMap[key] = index; - index++; - assets.push(buildFilePath(item)); + if (isPlainObject(item)) { + arrayToObjectMap[key] = item; + } else { + arrayToObjectMap[key] = remoteImport.push(buildFilePath(item)) - 1; + } }); - } else { - files = (isString(files)) ? files.split(commaString) : files; - demandType = (files.length < 2) ? singleDemand : multiDemand; + } else if (isString(files)) { + demandType = singleDemand; + if (isPlainObject(files)) { + localImport.push(files); + } else { + localImport.push(remoteImport.push(buildFilePath(files)) - 1); + } + } else if (isArray(files)) { + demandType = multiDemand; each(files, (item) => { - assets.push(buildFilePath(item)); + if (isPlainObject(item)) { + localImport.push(item); + } else { + localImport.push(remoteImport.push(buildFilePath(item)) - 1); + } + }); + } + if (remoteImport.length) { + results = await streamAssets(remoteImport, options); + } + cnsl('importing', 'notify'); + if (!arrayToObjectMap) { + each(localImport, (item, index) => { + if (isNumber(item)) { + compiledImports[index] = results[item]; + } else { + compiledImports[index] = item; + } }); } - const results = await streamAssets(assets, options); - // app.log(results); - return demandType(results, arrayToObjectMap); + console.log(results, demandType, compiledImports, localImport, remoteImport); + return demandType(compiledImports, arrayToObjectMap); }; const demandTypeMethod = (type, optionsFunction) => { return function(filesArg, options) { let files = filesArg; - if (isString(files)) { - files = files.split(commaString); - } if (optionsFunction) { optionsFunction(options); } - files = map(files, (item) => { - if (imported[item]) { - return item; + if (isString(files)) { + if (imported[files]) { + return imported[files]; } - const itemExt = getFileExtension(item); - const compiledFileName = (itemExt) ? item : `${item}${last(item) === '/' && 'index' || ''}.${type}`; - app.log('Demand Type', type, compiledFileName); - return compiledFileName; - }); + files = (hasDot(files)) ? files : `${files}${last(files) === '/' && 'index' || ''}.${type}`; + if (imported[files]) { + return imported[files]; + } + } else { + files = map(files, (item) => { + if (imported[item]) { + return imported[item]; + } + const itemHasExt = hasDot(item); + const compiledFileName = (itemHasExt) ? item : `${item}${last(item) === '/' && 'index' || ''}.${type}`; + if (imported[compiledFileName]) { + return imported[compiledFileName]; + } + app.log('Demand Type', type, compiledFileName); + return compiledFileName; + }); + } return demand(files, options); }; }; @@ -131,7 +174,7 @@ assign(app.events, { cnsl('Worker is Ready', 'notify'); app.systemLanguage = data.language; try { - await demand('app/'); + await demand('app/index.js'); } catch (error) { console.log(error); crate.clear(); diff --git a/uwBridge/system/compile/source/front/core/fetchFile.js b/uwBridge/system/compile/source/front/core/fetchFile.js index 251193c7..91fc2b1c 100644 --- a/uwBridge/system/compile/source/front/core/fetchFile.js +++ b/uwBridge/system/compile/source/front/core/fetchFile.js @@ -143,7 +143,7 @@ export const fetchFile = async (config) => { files: configData, }, }, - request: 'socket.get', + task: 'socket.get', }); }; assign(app, { diff --git a/uwBridge/system/compile/source/front/core/request.js b/uwBridge/system/compile/source/front/core/request.js index f7860aea..3acb48c7 100644 --- a/uwBridge/system/compile/source/front/core/request.js +++ b/uwBridge/system/compile/source/front/core/request.js @@ -1,16 +1,16 @@ import app from './app.js'; import { workerRequest } from './worker'; const { assign } = app.utility; -export const request = async (requestName, body) => { +export const request = async (task, body) => { const requestPackage = (body) ? { body, - request: requestName - } : requestName; + task + } : task; const workerPackage = { data: { data: requestPackage, }, - request: 'socket.request' + task: 'socket.request' }; if (requestPackage.id) { workerPackage.data.id = requestPackage.id; diff --git a/uwBridge/system/compile/source/front/core/watchers.js b/uwBridge/system/compile/source/front/core/watchers.js index db1d0776..8e523814 100644 --- a/uwBridge/system/compile/source/front/core/watchers.js +++ b/uwBridge/system/compile/source/front/core/watchers.js @@ -22,24 +22,25 @@ export class Watcher { static stop() { Watcher.status = false; } - static async update(json) { - console.log(json); - if (!Watcher.status || !json) { + static async update(pushUpdate) { + console.log(pushUpdate); + const { body } = pushUpdate; + if (!Watcher.status || !body) { return; } const { type, path - } = json; + } = body; const levelObject = Watcher.containerPrimary[type] || Watcher.containerPrimary[path]; await eachAsync(Watcher.containerRegex, async (watcher) => { if (watcher.eventName.test(type) || watcher.eventName.test(path)) { - return watcher.eventAction(json); + return watcher.eventAction(body); } }); if (levelObject) { await eachAsync(levelObject, async (watcher) => { - return watcher.eventAction(json); + return watcher.eventAction(body); }); } } @@ -92,8 +93,8 @@ export const push = (requestName, body) => { }); }; assign(app.events, { - _(json) { - return Watcher.update(json.body); + _(pushUpdate) { + return Watcher.update(pushUpdate); } }); assign(app, { diff --git a/uwBridge/system/compile/source/front/core/worker.js b/uwBridge/system/compile/source/front/core/worker.js index 7e27db64..4b6ed1b9 100644 --- a/uwBridge/system/compile/source/front/core/worker.js +++ b/uwBridge/system/compile/source/front/core/worker.js @@ -8,22 +8,22 @@ const { } } = app; export const mainWorker = new Worker('/assets/worker.js'); -export const workerRequest = async (requestName, dataArg) => { - console.log(requestName, dataArg); +export const workerRequest = async (task, dataArg) => { + console.log(task, dataArg); let compiledRequest; let callbackOptional; if (dataArg) { compiledRequest = { data: dataArg, - request: requestName, + task, }; } else { - compiledRequest = requestName; - callbackOptional = requestName.callback; + compiledRequest = task; + callbackOptional = task.callback; } const requestObject = { data: compiledRequest.data, - request: compiledRequest.request, + task: compiledRequest.task, }; if (requestObject.data.id) { return mainWorker.postMessage(requestObject); diff --git a/uwBridge/system/compile/source/front/libs/Acid.js b/uwBridge/system/compile/source/front/libs/Acid.js index 5ba430b4..5207a905 100644 --- a/uwBridge/system/compile/source/front/libs/Acid.js +++ b/uwBridge/system/compile/source/front/libs/Acid.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).$={})}(this,(function(t){"use strict";const e=Array.from,n=Reflect.apply,r=Object,o=r.keys,s=r.is,i=r.assign,c=r.getOwnPropertyDescriptor,a=r.defineProperty,l=r.getOwnPropertyNames,u=t=>o(t).length;function h(t){return void 0===t}function p(t){return null===t}function f(t){return!h(t)&&!p(t)}function g(t){return e=>!!f(e)&&e.constructor===t}const d=/\.|\+/,m=Array.isArray,y=g(String),b=g(Number),w=t=>!!f(t)&&"Object("===t.constructor.toString().trim().slice(9,16),A=t=>!!f(t)&&t instanceof Function,v=t=>Boolean(t.length),S=t=>e=>!!f(e)&&t.test(e),C=S(/\.css$/),j=S(/\.json$/),I=S(/\.js$/),O=S(/\.html$/),x=S(/\./),L=/\.([0-9a-z]+)/,E=t=>"Boolean"===t.constructor.name,F=t=>!!t&&t instanceof Promise,k=t=>!!t&&"AsyncFunction"===t.constructor?.name;const M=t=>m(t)&&t||f(t)&&[t]||[],R=t=>t.flat(1/0),T=t=>(t.length=0,t),N=Math,$=N.floor,B=N.random,D=(t,e=0)=>$(B()*(t-e))+e,U=(t,n=t.length)=>{if(t.length<=1)return e(t);const r=e(t);let o,s,i=0;for(;i=0;o--)e(t[o],o,t,r,n);return t}function q(t,e,n){const r=t.length;for(let o=0;o{!0===e(t,o,n,s,i,r)&&n.push(t)})),n}function H(t,e,n=[],r){return _(t,((t,o,s,i)=>{n[o]=e(t,o,n,s,i,r)})),n}function K(t,e,n=[],r){return _(t,((t,o,s,i)=>{const c=e(t,o,n,s,i,r);f(c)&&n.push(c)})),n}const Z=(t,e,n=t.length)=>t.splice(e,n),J=(t,e)=>t.length===e.length&&q(t,((t,n)=>e[n]===t)),V=Math.max,G=async(t,e)=>{const n=t.length;for(let r=0;r{const n=t.length;for(let r=n-1;r>=0;r--)await e(t[r],r,t,n);return t},X=async(t,e)=>{const n=[];return await G(t,(async(t,r,o)=>{n[r]=await e(t,r,o)})),n},Y=(t,e,n)=>n.indexOf(t)===e,tt=(t,e,n)=>t!==n[e-1],et=(t,e)=>e?t.filter(tt):t.filter(Y),nt=(t,e)=>t-e,rt=(t,e)=>e-t,ot=(t,e,n)=>{const r=n?t:0,o=n?e:t,s=n||e;for(let t=r;t(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?-1:0:1:-1)),it=(t,e="id",n=!0)=>(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?1:0:-1:1)),ct=(t,e)=>H(e,(e=>t[e])),at=(t,e,n,r,o)=>{if(t[o]===r)return!0},lt=(t,e)=>{_(o(t),((n,r,o,s)=>{e(t[n],n,t,s,o)}))},ut=(t,e)=>q(o(t),((n,r,o,s)=>e(t[n],n,t,s,o))),ht=(t,e,n={})=>(lt(t,((t,r,o,s,i)=>{!0===e(t,r,n,o,s,i)&&(n[r]=t)})),n),pt=(t,e,n={})=>(lt(t,((t,r,o,s,i)=>{n[r]=e(t,r,n,o,s,i)})),n),ft=(t,e,n={})=>(lt(t,((t,r,o,s,i)=>{const c=e(t,r,n,o,s,i);f(c)&&(n[r]=c)})),n),gt=(t,e)=>t.forEach(e),dt=(t,e)=>(n,r,o)=>{let s;if(f(n))return s=m(n)?t:w(n)||A(n)?e:n.forEach?gt:e,s(n,r,o)},mt=dt(q,ut),yt=dt(_,lt),bt=dt(W,ht),wt=dt(H,pt),At=dt(K,ft),vt=mt,St=(t,e)=>setTimeout(t,e),Ct=(t,e)=>setInterval(t,e),jt=(t,e)=>()=>{ot(0,t((()=>{}),0),(t=>{e(t)}))},It=jt(St,clearTimeout),Ot=jt(Ct,clearInterval),xt=(t,e)=>{const n=o(t);return q(e,(t=>n.includes(t)))},Lt=(t,e)=>{const n={};return _(t,((t,r)=>{n[t]=e[r]})),n},Et=async(t,e)=>{const n=o(t);return await G(n,((r,o,s,i)=>e(t[r],r,t,i,n))),t},Ft=/[-_]/g,kt=/ (.)/g,Mt=(t,e=1)=>t.substr(e),Rt=/%(?![\da-f]{2})/gi,Tt=/&/g,Nt=//g,Bt=/"/g,Dt=t=>decodeURIComponent(t.replace(Rt,(()=>"%25"))),Ut=t=>t.replace(Tt,"&").replace(Nt,"<").replace($t,">").replace(Bt,"""),Pt=/\S+/g,_t=/\w+/g,zt=/ (.)/g,qt=t=>t[0].toUpperCase(),Wt=t=>qt(t)+Mt(t).toLowerCase(),Ht=Reflect.construct;const Kt=Object.create,Zt=(t,e,n=!1,r,s,i)=>{if(t){if(i){const o=i.pop();if(o){const r=e[o];t[o]=Zt(t[o],r,n)}else if(!s)return t;if(s){let o=r||0;if(o++,oglobalThis.structuredClone(t):t=>w(t)?Zt({},t):m(t)?Zt([],t):Kt(t);const Vt=Function.prototype;const Gt=(t,e)=>{if(t===e)return!0;if(t.toString()===e.toString())if(w(t)){const n=o(t);if(xt(e,n))return q(n,(n=>Gt(t[n],e[n])))}else if(m(t)&&t.length===e.length)return q(t,((t,n)=>Gt(t,e[n])));return!1},Qt=/\.|\[/,Xt=/]/g,Yt=t=>t.replace(Xt,"").split(Qt);let te=0;const ee=[],ne={};function re(){let t=ee.shift(ee);return f(t)||(t=te,ne[t]=!0,te++),t}re.free=t=>{ne[t]=null,ee.push(t)};const oe=(t,e)=>{let n=e;return q(Yt(t),(t=>(n=n[t],f(n)))),n},se=JSON,ie=se.parse,ce=se.stringify,ae=(t,e)=>(f(e)&&(ae[t]=e),oe(t,ae)),le=t=>new Promise(t),ue=t=>(...e)=>n=>{let r=n;return t(e,(t=>{r=t(r)})),r},he=ue(_),pe=ue(z),fe=t=>(...e)=>async n=>{let r=n;return await t(e,(async t=>{r=await t(r)})),r},ge=fe(G),de=fe(Q),me=t=>t?me[t]:o(me),ye=globalThis.navigator?.userAgentData;if(ye)lt(ye,((t,e)=>{E(t)&&t&&(me[e]=t)})),_(ye.brands,(t=>{me[t.brand]=t.version}));else if(navigator.userAgent){let t=navigator.userAgent.toLowerCase();t=t.replace(/_/g,"."),t=t.replace(/[#_,;()]/g,"");_(t.split(/ |\//),(t=>{me[t]=!0}))}const be=(t,...e)=>(t.addEventListener(...e),t),we=document.createDocumentFragment.bind(document),Ae=(t,e)=>(t.appendChild(e),e),ve=(t,e)=>m(e)?Lt(e,H(e,(e=>t.getAttribute(e)))):(lt(e,((e,n)=>{t.setAttribute(n,e)})),t),Se=/^.[\w_-]+$/,Ce=/^[A-Za-z]+$/,je=/\s/,Ie=document.getElementsByClassName.bind(document),Oe=document.getElementsByTagName.bind(document),xe=document.getElementById.bind(document),Le=document.querySelector.bind(document),Ee=document.querySelectorAll.bind(document),Fe=document.createElement.bind(document),ke=t=>{const e=x(t)&&t||`${t}.js`;return(t=>le((e=>{be(t,"load",e,!0),be(t,"error",e,!0),Ae(Le("head"),t)})))(ve(Fe("script"),{async:"",src:e}))},Me=t=>{const e=document.readyState;return"interactive"===e||"completed"===e||"complete"===e?!t||t():(t&&be(document,"DOMContentLoaded",t),!1)};Me((()=>{const t=xe("AcidLib"),e=t&&t.getAttribute("data-index")||"/index";ke(e)}));const Re=location.protocol,Te="http:"===Re?"ws":"wss",Ne=location.hostname,$e={hardware:{cores:navigator.hardwareConcurrency},host:{name:Ne,protocol:Re,protocolSocket:Te}},Be=()=>{i($e,{bodyHeight:document.body.offsetHeight,bodyWidth:document.body.offsetWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})},De=()=>{Be()};Me(De),be(window,"load",De,!0),be(window,"resize",De,!0);class Ue{constructor(t={}){this.items=t}getItem(t){return this.items[t]}setItem(t,e){this.items[t]=e}clear(){this.items={}}removeItem(t){this.items[t]=null}}function Pe(){return new Ue}t.hasLocal=void 0,function(e){try{e().removeItem("TESTING"),t.hasLocal=!0}catch(e){t.hasLocal=!1}}((()=>localStorage));class _e{constructor(t){this.hasLocal&&(this.local=localStorage),this.storage=Pe()}hasLocal=t.hasLocal;setItem(t,e){return this.hasLocal&&this.local.setItem(t,y(e)?e:ce(e)),this.storage.setItem(t,e)}getItem(t){const e=this.storage.getItem(t);return f(e)?e:!f(e)&&this.hasLocal?this.local.getItem(t):void 0}clear(){this.hasLocal&&this.local.clear(),this.storage.clear()}removeItem(t){this.hasLocal&&this.local.removeItem(t),this.storage.removeItem(t)}}const ze=(t,e)=>`color:${t};background:${e};`,qe={alert:ze("#fff","#f44336"),important:ze("#fff","#E91E63"),notify:ze("#fff","#651FFF"),warning:ze("#000","#FFEA00")};t.Crate=_e,t.VirtualStorage=Ue,t.add=(t,e)=>t+e,t.after=(t,e)=>{let n,r=t;return(...t)=>(null!==r&&r--,r<=0&&(n=e(...t),r=null),n)},t.append=Ae,t.apply=n,t.arrayToObject=(t,e)=>{const n={};return _(t,((t,r)=>{n[e[r]]=t})),n},t.ary=(t,e)=>(...n)=>t(...n.splice(0,e)),t.assign=i,t.assignDeep=Zt,t.asyncEach=async(t,e)=>{const n=t.length;for(let r=0;r{let n,r=t;return(...t)=>(null!==r&&r--,r>=1?n=e(...t):r=null,n)},t.bindAll=(t,e)=>wt(t,(t=>A(t)?t.bind(e):t)),t.cacheNativeMethod=function(t){return Vt.call.bind(t)},t.camelCase=t=>t.toLowerCase().replace(kt,(t=>t.toUpperCase().replace(/ /g,""))),t.chain=t=>{const e=t=>(e.value=t,e.methods);return i(e,{add:t=>((t,e)=>(yt(e,((e,n)=>{t.methods[n]=(...n)=>(e(t.value,...n),t.methods)})),t))(e,t),done(){const t=e.value;return e.value=null,t},methods:{}}),e.add(t),e},t.chunk=(t,e=1)=>{const n=[];let r=0;return t.forEach(((t,o)=>{o%e||(n.push([]),o&&r++),n[r].push(t)})),n},t.chunkString=(t,e)=>t.match(new RegExp(`(.|[\r\n]){1,${e}}`,"g")),t.clear=T,t.clearIntervals=Ot,t.clearTimers=It,t.cloneArray=t=>t.slice(),t.cnsl=(t,e)=>{const n=y(t)?t:ce(t);if("alert"===e||"warning"===e)return console.trace(`%c${n}`,`${qe[e]}font-size:13px;padding:2px 5px;border-radius:2px;`);console.log(`%c${n}`,`${qe[e]}font-size:13px;padding:2px 5px;border-radius:2px;`)},t.cnslTheme=(t,e,n)=>{qe[t]=ze(e,n)},t.compact=t=>t.filter((t=>!(y(t)&&!t.length)&&t)),t.compactKeys=t=>{const e=[];return lt(t,((t,n)=>{t&&e.push(n)})),e},t.compactMap=At,t.compactMapArray=K,t.compactMapAsync=async(t,e)=>{const n=[];let r;return await G(t,(async(t,o,s)=>{r=await e(t,o,n,s),f(r)&&n.push(r)})),n},t.compactMapObject=ft,t.compactMapObjectAsync=async(t,e,n={})=>(await Et(t,(async(t,r,o,s,i)=>{const c=await e(t,r,n,s,i);f(c)&&(n[r]=c)})),n),t.construct=function(t,e=[],n){return n?Ht(t,e,n):Ht(t,e)},t.countBy=(t,e)=>{const n={};let r;return _(t,(t=>{r=e(t),n[r]||(n[r]=0),n[r]++})),n},t.countKey=(t,e)=>{let n=0;return _(t,(t=>{t[e]&&n++})),n},t.countWithoutKey=(t,e)=>{let n=0;return _(t,(t=>{t[e]||n++})),n},t.crate=function(t){return new _e(t)},t.createFragment=we,t.curry=(t,e=t.length)=>{const n=[],r=(...o)=>{if(n.push(...o),n.length===e){const e=t(...n);return T(n),e}return r};return r},t.curryRight=(t,e=t.length)=>{const n=[],r=(...o)=>{if(n.unshift(...o),n.length===e){const e=t(...n);return T(n),e}return r};return r},t.debounce=(t,e)=>{let n=!1;const r=(...r)=>{!1!==n&&clearTimeout(n),n=St((()=>{t(...r),n=!1}),e)};return r.clear=()=>{n&&(clearTimeout(n),n=!1)},r},t.decimalCheck=d,t.deduct=t=>t-1,t.defineProperty=a,t.difference=(t,...e)=>{const n=R(e);return K(t,(t=>{if(!n.includes(t))return t}))},t.divide=(t,e)=>t/e,t.drop=Z,t.dropRight=(t,e,n=t.length)=>Z(t,0,n-e),t.each=yt,t.eachArray=_,t.eachArrayRight=z,t.eachAsync=G,t.eachAsyncRight=Q,t.eachObject=lt,t.eachObjectAsync=Et,t.eachWhile=mt,t.ensureArray=M,t.eventAdd=be,t.eventRemove=(t,...e)=>(t.removeEventListener(...e),t),t.every=vt,t.filter=bt,t.filterArray=W,t.filterObject=ht,t.findIndex=(t,e,n="id")=>{const r=t.findIndex(((t,r)=>at(t,0,0,e,n)));return-1!==r&&r},t.findItem=(t,e,n="id")=>{const r=t.find(((t,r)=>at(t,0,0,e,n)));return-1!==r&&r},t.first=(t,e)=>e?t.slice(0,e):t[0],t.flatten=(t,e=1)=>{let n=t;for(let t=0;tt.concat(M(e))),[]);return n},t.flattenDeep=R,t.flow=he,t.flowAsync=ge,t.flowAsyncRight=de,t.flowRight=pe,t.get=oe,t.getByClass=Ie,t.getById=xe,t.getByTag=Oe,t.getExtensionRegex=L,t.getFileExtension=t=>{const e=t.match(L);if(e)return e[1]},t.getNewest=(t,e)=>st(t,e,!1)[0],t.getOldest=(t,e="id")=>it(t,e)[0],t.getOwnPropertyDescriptor=c,t.getOwnPropertyNames=l,t.groupBy=(t,e)=>{const n={};return _(t,(t=>{const r=e(t);n[r]||(n[r]=[]),n[r].push(t)})),n},t.has=(t,...e)=>t.includes(...e),t.hasAnyKeys=(t,e)=>{const n=o(t);return Boolean(e.find((t=>n.includes(t))))},t.hasDot=x,t.hasKeys=xt,t.hasLength=v,t.hasValue=f,t.htmlEntities=Ut,t.ifInvoke=(t,...e)=>{if(A(t))return t(...e)},t.ifNotEqual=(t,e,n)=>(e&&!f(t[e])&&(t[e]=n),t),t.importjs=ke,t.inAsync=async(t,e)=>G(t,(async t=>{await t(e)})),t.inSync=(t,e)=>yt(t,(t=>{t(e)})),t.increment=t=>t+1,t.indexBy=(t,e="id")=>{const n={};return _(t,(t=>{n[t[e]]=t})),n},t.info=$e,t.initial=t=>t.slice(0,t.length-1),t.initialString=(t,e=1)=>t.slice(0,-1*e),t.insertInRange=(t,e,n)=>t.slice(0,e)+n+t.slice(e,t.length),t.intersect=(t,...e)=>K(t,(t=>{if(q(e,(e=>e.includes(t))))return t})),t.interval=Ct,t.invert=(t,e={})=>(lt(t,((t,n)=>{e[t]=n})),e),t.invoke=(t,e,n)=>H(t,((t,r)=>t[e](n,r))),t.invokeAsync=(t,e,n)=>X(t,(async(t,r)=>t[e](n,r))),t.is=s,t.isAgent=me,t.isArguments=function(t){return!!f(t)&&"[object Arguments]"===t.toString()},t.isArray=m,t.isAsync=k,t.isBoolean=E,t.isBuffer=function(t){return!!f(t)&&"ArrayBuffer"===t.constructor?.name},t.isConstructor=g,t.isDate=t=>t instanceof Date,t.isDecimal=t=>d.test(t.toString()),t.isDocumentReady=Me,t.isDom=t=>t&&9!==t.nodeType,t.isEmpty=t=>y(t)||m(t)?!v(t):w(t)?!u(t):!f(t),t.isEnter=t=>13===t.keyCode,t.isEqual=Gt,t.isFileCSS=C,t.isFileHTML=O,t.isFileJS=I,t.isFileJSON=j,t.isFloat32=function(t){return!!f(t)&&"Float32Array"===t.constructor?.name},t.isFloat64=function(t){return!!f(t)&&"Float64Array"===t.constructor?.name},t.isFunction=A,t.isHTMLCollection=function(t){return!!f(t)&&"[object HTMLCollection]"===t.toString()},t.isInt16=function(t){return!!f(t)&&"Int16Array"===t.constructor?.name},t.isInt32=function(t){return!!f(t)&&"Int32Array"===t.constructor?.name},t.isInt8=function(t){return!!f(t)&&"Int8Array"===t.constructor?.name},t.isKindAsync=t=>!!t&&(F(t)||k(t)),t.isMap=function(t){return!!f(t)&&"[object Map]"===t.toString()},t.isMatchArray=J,t.isMatchObject=(t,e)=>{const n=o(t);return!!J(n,o(e))&&q(n,(n=>t[n]===e[n]))},t.isNodeList=function(t){return!!f(t)&&"[object NodeList]"===t.toString()},t.isNull=p,t.isNumber=b,t.isNumberEqual=(t,e)=>t===e,t.isNumberInRange=(t,e,n)=>t>e&&t"__proto__"!==t&&"constructor"!==t&&"prototype"!==t,t.isPromise=F,t.isRegExp=t=>t instanceof RegExp,t.isSet=function(t){return!!f(t)&&"[object Set]"===t.toString()},t.isString=y,t.isUint16=function(t){return!!f(t)&&"Uint16Array"===t.constructor?.name},t.isUint32=function(t){return!!f(t)&&"Uint32Array"===t.constructor?.name},t.isUint8=function(t){return!!f(t)&&"Uint8Array"===t.constructor?.name},t.isUint8Clamped=function(t){return!!f(t)&&"Uint8ClampedArray"===t.constructor?.name},t.isUndefined=h,t.isWeakMap=function(t){return!!f(t)&&"[object WeakMap]"===t.toString()},t.isZero=t=>0===t,t.jsonParse=ie,t.kebabCase=t=>t.replace(Ft," ").trim().toLowerCase().replace(kt,"-$1"),t.keys=o,t.largest=t=>V(...t),t.last=(t,e)=>{const n=t.length;return e?t.slice(n-e,n):t[n-1]},t.map=wt,t.mapArray=H,t.mapArrayRight=function(t,e,n=[],r){let o=0;const s=t.length;for(let i=s-1;i>=0;i--)n[o]=e(t[i],i,t,s,r),o++;return n},t.mapAsync=X,t.mapObject=pt,t.mapObjectAsync=async(t,e,n={})=>(await Et(t,(async(t,r,o,s,i)=>{n[r]=await e(t,r,n,o,s,i)})),n),t.mapWhile=function(t,e,n=[],r){const o=t.length;for(let s=0;st-e,t.model=ae,t.multiply=(t,e)=>t*e,t.negate=t=>(...e)=>!t(...e),t.nodeAttribute=ve,t.noop=()=>{},t.nthArg=(t=0)=>(...e)=>e[t],t.numSort=t=>t.sort(nt),t.numericalCompare=nt,t.numericalCompareReverse=rt,t.objectCreate=Kt,t.objectSize=u,t.omit=(t,e)=>ht(t,((t,n)=>!e.includes(n))),t.once=t=>{let e;return(...n)=>(f(e)||(e=t(...n)),e)},t.over=t=>(...e)=>wt(t,(t=>t(...e))),t.overEvery=t=>(...e)=>mt(t,(t=>t(...e))),t.partition=(t,e)=>{const n=[];return[K(t,(t=>{if(e(t))return t;n.push(t)})),n]},t.pick=(t,e,n={})=>(_(e,(e=>{n[e]=t[e]})),n),t.pluck=(t,e)=>H(t,(t=>t[e])),t.pluckObject=ct,t.pluckValues=(t,e)=>H(t,(t=>ct(t,e))),t.promise=le,t.propertyMatch=(t,e,n=o(t))=>q(n,(n=>Gt(t[n],e[n]))),t.querySelector=Le,t.querySelectorAll=Ee,t.rNumSort=t=>t.sort(rt),t.randomArbitrary=(t,e=0)=>B()*(t-e)+e,t.randomInt=D,t.range=(t,e,n=1)=>t{const r=[];let o=t;for(;o{const r=n<0?-1*n:n,o=[];let s=t;for(;s>e;)o.push(s),s-=r;return o})(t,e,n),t.rawURLDecode=Dt,t.reArg=(t,e)=>(...n)=>t(...e.map((t=>n[t]))),t.regexGenerator=S,t.remainder=(t,e)=>t%e,t.remove=(t,e)=>{let n=t.length;for(let r=0;r{let n=t.length;for(let r=0;rt.replace(new RegExp(`\\b${e.join("|")}\\b`,"gi"),n),t.rest=t=>t.slice(1,t.length),t.restString=Mt,t.right=(t,e)=>t[t.length-1-e],t.rightString=(t,e=1)=>t[t.length-e],t.sample=(t,e=1)=>{if(!t)return!1;const n=t.length;if(n===e||e>n)return U(t);if(1===e)return[t[D(n-1,0)]];const r=[],o={};let s,i=0;for(;iUt(Dt(t)),t.saveDimensions=Be,t.selector=t=>{switch(t[0]){case"#":if(!je.test(t))return xe(Mt(t));break;case".":if(Se.test(t))return Ie(Mt(t));break;default:if(Ce.test(t))return Oe(t)}return Ee(t)},t.shuffle=U,t.smallest=t=>P(...t),t.snakeCase=t=>t.replace(Ft," ").trim().toLowerCase().replace(kt,"_$1"),t.sortAlphabetical=(t,e)=>t.sort(((t,n)=>{const r=t[e],o=n[e];return ro?1:0})),t.sortNewest=st,t.sortOldest=it,t.sortedIndex=(t,e)=>{let n=0;return q(t,((t,r)=>(n=r,e>t))),n},t.stringify=ce,t.stubArray=()=>[],t.stubFalse=()=>!1,t.stubObject=()=>({}),t.stubString=()=>"",t.stubTrue=()=>!0,t.sum=t=>t.reduce(((t,e)=>t+e),0),t.take=(t,e=1)=>t.slice(0,e),t.takeRight=(t,e=1)=>{const n=t.length;return t.slice(n-e,n)},t.themes=qe,t.throttle=(t,e)=>{let n,r=!1;const o=(...o)=>{r?n=!0:(t(...o),r=St((()=>{n&&t(...o),r=!1}),e))};return o.clear=()=>{clearTimeout(r),r=!1},o},t.timer=St,t.times=ot,t.timesMap=(t,e,n,r=[])=>{const o=n?t:0,s=n?e:t,i=n||e;let c;return ot(o,s,(t=>{c=i(t,o,s,r),f(c)&&r.push(c)})),r},t.toArray=e,t.toPath=Yt,t.toggle=(t,e=!0,n=!1)=>Gt(e,t)?n:e,t.tokenize=t=>t.match(Pt)||[],t.truncate=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),o=r.length;let s,i=n-e;for(;i=0&&(s=r[i]," "!==s);i--);return t.slice(0,i).trim()})(t,e,n):t},t.truncateRight=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),o=r.length;let s,i=e;for(;i0&&(s=r[i]," "!==s);i++);return t.substr(i,n).trim()})(t,e,n):t},t.uid=re,t.unZip=t=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.unZipObject=t=>{const e=[],n=[];return lt(t,((t,r)=>{e.push(r),n.push(t)})),[e,n]},t.union=(...t)=>et(R(t)),t.unique=et,t.updateDimensions=De,t.upperCase=t=>t.replace(Ft," ").trim().toUpperCase(),t.upperFirst=t=>qt(t)+Mt(t),t.upperFirstAll=t=>t.replace(zt,(t=>t.toUpperCase())),t.upperFirstLetter=qt,t.upperFirstOnly=Wt,t.upperFirstOnlyAll=t=>Wt(t.toLowerCase()).replace(zt,(t=>t.toUpperCase())),t.virtualStorage=Pe,t.whileArray=q,t.whileCompactMap=function(t,e,n=[],r){let o=0;for(;ot.filter((t=>!e.includes(t))),t.words=t=>t.match(_t)||[],t.wrap=(t,e)=>(...n)=>e(t,...n),t.xor=(...t)=>{const e=[];return _(t,(t=>{_(et(t),(t=>{e.includes(t)?e.splice(e.indexOf(t),1):e.push(t)}))})),e},t.zip=(...t)=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.zipObject=Lt,Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).$={})}(this,(function(t){"use strict";const e=Array.from,n=Reflect.apply,r=Object,o=r.keys,s=r.is,i=r.assign,c=r.getOwnPropertyDescriptor,a=r.defineProperty,l=r.getOwnPropertyNames,u=t=>o(t).length;function h(t){return void 0===t}function f(t){return null===t}function p(t){return!h(t)&&!f(t)}function d(t){return e=>!!p(e)&&e.constructor===t}const g=/\.|\+/,m=Array.isArray,y=d(String),b=d(Number),w=t=>!!p(t)&&"Object("===t.constructor.toString().trim().slice(9,16),A=t=>!!p(t)&&t instanceof Function,v=t=>Boolean(t.length),S=t=>e=>!!p(e)&&t.test(e),C=S(/\.css$/),j=S(/\.json$/),I=S(/\.js$/),O=S(/\.html$/),x=S(/\./),L=/\.([0-9a-z]+)/,E=t=>"Boolean"===t.constructor.name,F=t=>!!t&&t instanceof Promise,k=t=>!!t&&"AsyncFunction"===t.constructor?.name;const M=t=>m(t)&&t||p(t)&&[t]||[],R=t=>t.flat(1/0),T=t=>(t.length=0,t),N=Math,$=N.floor,B=N.random,D=(t,e=0)=>$(B()*(t-e))+e,U=(t,n=t.length)=>{if(t.length<=1)return e(t);const r=e(t);let o,s,i=0;for(;i=0;o--)e(t[o],o,t,r,n);return t}function W(t,e,n){const r=t.length;for(let o=0;o{!0===e(t,o,n,s,i,r)&&n.push(t)})),n}function _(t,e,n=[],r){return z(t,((t,o,s,i)=>{n[o]=e(t,o,n,s,i,r)})),n}function K(t,e,n=[],r){return z(t,((t,o,s,i)=>{const c=e(t,o,n,s,i,r);p(c)&&n.push(c)})),n}const Z=(t,e,n=t.length)=>t.splice(e,n),J=(t,e)=>t.length===e.length&&W(t,((t,n)=>e[n]===t)),V=Math.max,G=async(t,e)=>{const n=t.length;for(let r=0;r{const n=t.length;for(let r=n-1;r>=0;r--)await e(t[r],r,t,n);return t},X=async(t,e)=>{const n=[];return await G(t,(async(t,r,o)=>{n[r]=await e(t,r,o)})),n},Y=(t,e,n)=>n.indexOf(t)===e,tt=(t,e,n)=>t!==n[e-1],et=(t,e)=>e?t.filter(tt):t.filter(Y),nt=(t,e)=>t-e,rt=(t,e)=>e-t,ot=(t,e,n)=>{const r=n?t:0,o=n?e:t,s=n||e;for(let t=r;t(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?-1:0:1:-1)),it=(t,e="id",n=!0)=>(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?1:0:-1:1)),ct=(t,e)=>_(e,(e=>t[e])),at=(t,e,n,r,o)=>{if(t[o]===r)return!0},lt=(t,e)=>{z(o(t),((n,r,o,s)=>{e(t[n],n,t,s,o)}))},ut=(t,e)=>W(o(t),((n,r,o,s)=>e(t[n],n,t,s,o))),ht=(t,e,n={})=>(lt(t,((t,r,o,s,i)=>{!0===e(t,r,n,o,s,i)&&(n[r]=t)})),n),ft=(t,e,n={})=>(lt(t,((t,r,o,s,i)=>{n[r]=e(t,r,n,o,s,i)})),n),pt=(t,e,n={})=>(lt(t,((t,r,o,s,i)=>{const c=e(t,r,n,o,s,i);p(c)&&(n[r]=c)})),n),dt=(t,e)=>t.forEach(e),gt=(t,e)=>(n,r,o)=>{let s;if(p(n))return s=m(n)?t:w(n)||A(n)?e:n.forEach?dt:e,s(n,r,o)},mt=gt(W,ut),yt=gt(z,lt),bt=gt(H,ht),wt=gt(_,ft),At=gt(K,pt),vt=mt,St=(t,e)=>setTimeout(t,e),Ct=(t,e)=>setInterval(t,e),jt=(t,e)=>()=>{ot(0,t((()=>{}),0),(t=>{e(t)}))},It=jt(St,clearTimeout),Ot=jt(Ct,clearInterval),xt=(t,e)=>{const n=o(t);return W(e,(t=>n.includes(t)))},Lt=(t,e)=>{const n={};return z(t,((t,r)=>{n[t]=e[r]})),n},Et=async(t,e)=>{const n=o(t);return await G(n,((r,o,s,i)=>e(t[r],r,t,i,n))),t},Ft=/[-_]/g,kt=/ (.)/g,Mt=(t,e=1)=>t.substr(e),Rt=/%(?![\da-f]{2})/gi,Tt=/&/g,Nt=//g,Bt=/"/g,Dt=t=>decodeURIComponent(t.replace(Rt,(()=>"%25"))),Ut=t=>t.replace(Tt,"&").replace(Nt,"<").replace($t,">").replace(Bt,"""),Pt=/\S+/g,zt=/\w+/g,qt=/ (.)/g,Wt=t=>t[0].toUpperCase(),Ht=t=>Wt(t)+Mt(t).toLowerCase(),_t=Reflect.construct;function Kt(t,e=[],n){return n?_t(t,e,n):_t(t,e)}const Zt=Object.create,Jt=(t,e,n=!1,r,s,i)=>{if(t){if(i){const o=i.pop();if(o){const r=e[o];t[o]=Jt(t[o],r,n)}else if(!s)return t;if(s){let o=r||0;if(o++,oglobalThis.structuredClone(t):t=>w(t)?Jt({},t):m(t)?Jt([],t):Zt(t);const Gt=Function.prototype;const Qt=(t,e)=>{if(t===e)return!0;if(t.toString()===e.toString())if(w(t)){const n=o(t);if(xt(e,n))return W(n,(n=>Qt(t[n],e[n])))}else if(m(t)&&t.length===e.length)return W(t,((t,n)=>Qt(t,e[n])));return!1},Xt=/\.|\[/,Yt=/]/g,te=t=>t.replace(Yt,"").split(Xt);let ee=0;const ne=[],re={};function oe(){let t=ne.shift(ne);return p(t)||(t=ee,re[t]=!0,ee++),t}oe.free=t=>{re[t]=null,ne.push(t)};const se=(t,e)=>{let n=e;return W(te(t),(t=>(n=n[t],p(n)))),n},ie=JSON,ce=ie.parse,ae=ie.stringify;class le{static models={};constructor(t,e){p(e)?(i(this,e),this.modelName=t,le.models.set(t,e)):i(this,t)}}const ue=t=>new Promise(t),he=t=>(...e)=>n=>{let r=n;return t(e,(t=>{r=t(r)})),r},fe=he(z),pe=he(q),de=t=>(...e)=>async n=>{let r=n;return await t(e,(async t=>{r=await t(r)})),r},ge=de(G),me=de(Q);class ye{constructor(t={}){this.items=t}getItem(t){return this.items[t]}setItem(t,e){this.items[t]=e}clear(){this.items={}}removeItem(t){this.items[t]=null}}function be(){return new ye}const we=t=>t?we[t]:o(we),Ae=globalThis.navigator?.userAgentData;if(Ae)lt(Ae,((t,e)=>{E(t)&&t&&(we[e]=t)})),z(Ae.brands,(t=>{we[t.brand]=t.version}));else if(navigator.userAgent){let t=navigator.userAgent.toLowerCase();t=t.replace(/_/g,"."),t=t.replace(/[#_,;()]/g,"");z(t.split(/ |\//),(t=>{we[t]=!0}))}const ve=(t,...e)=>(t.addEventListener(...e),t),Se=document.createDocumentFragment.bind(document),Ce=(t,e)=>(t.appendChild(e),e),je=(t,e)=>m(e)?Lt(e,_(e,(e=>t.getAttribute(e)))):(lt(e,((e,n)=>{t.setAttribute(n,e)})),t),Ie=/^.[\w_-]+$/,Oe=/^[A-Za-z]+$/,xe=/\s/,Le=document.getElementsByClassName.bind(document),Ee=document.getElementsByTagName.bind(document),Fe=document.getElementById.bind(document),ke=document.querySelector.bind(document),Me=document.querySelectorAll.bind(document),Re=document.createElement.bind(document),Te=t=>{const e=x(t)&&t||`${t}.js`;return(t=>ue((e=>{ve(t,"load",e,!0),ve(t,"error",e,!0),Ce(ke("head"),t)})))(je(Re("script"),{async:"",src:e}))},Ne=t=>{const e=document.readyState;return"interactive"===e||"completed"===e||"complete"===e?!t||t():(t&&ve(document,"DOMContentLoaded",t),!1)};Ne((()=>{const t=Fe("AcidLib"),e=t&&t.getAttribute("data-index")||"/index";Te(e)}));const $e=location.protocol,Be="http:"===$e?"ws":"wss",De=location.hostname,Ue={hardware:{cores:navigator.hardwareConcurrency},host:{name:De,protocol:$e,protocolSocket:Be}},Pe=()=>{i(Ue,{bodyHeight:document.body.offsetHeight,bodyWidth:document.body.offsetWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})},ze=()=>{Pe()};Ne(ze),ve(window,"load",ze,!0),ve(window,"resize",ze,!0),t.hasLocal=void 0,function(e){try{e().removeItem("TESTING"),t.hasLocal=!0}catch(e){t.hasLocal=!1}}((()=>localStorage));class qe{constructor(t){this.hasLocal&&(this.local=localStorage),this.storage=be()}hasLocal=t.hasLocal;setItem(t,e){return this.hasLocal&&this.local.setItem(t,y(e)?e:ae(e)),this.storage.setItem(t,e)}getItem(t){const e=this.storage.getItem(t);return p(e)?e:!p(e)&&this.hasLocal?this.local.getItem(t):void 0}clear(){this.hasLocal&&this.local.clear(),this.storage.clear()}removeItem(t){this.hasLocal&&this.local.removeItem(t),this.storage.removeItem(t)}}const We=(t,e)=>`color:${t};background:${e};`,He={alert:We("#fff","#f44336"),important:We("#fff","#E91E63"),notify:We("#fff","#651FFF"),warning:We("#000","#FFEA00")};t.Crate=qe,t.Model=le,t.VirtualStorage=ye,t.add=(t,e)=>t+e,t.after=(t,e)=>{let n,r=t;return(...t)=>(null!==r&&r--,r<=0&&(n=e(...t),r=null),n)},t.append=Ce,t.apply=n,t.arrayToObject=(t,e)=>{const n={};return z(t,((t,r)=>{n[e[r]]=t})),n},t.ary=(t,e)=>(...n)=>t(...n.splice(0,e)),t.assign=i,t.assignDeep=Jt,t.asyncEach=async(t,e)=>{const n=t.length;for(let r=0;r{let n,r=t;return(...t)=>(null!==r&&r--,r>=1?n=e(...t):r=null,n)},t.bindAll=(t,e)=>wt(t,(t=>A(t)?t.bind(e):t)),t.cacheNativeMethod=function(t){return Gt.call.bind(t)},t.camelCase=t=>t.toLowerCase().replace(kt,(t=>t.toUpperCase().replace(/ /g,""))),t.chain=t=>{const e=t=>(e.value=t,e.methods);return i(e,{add:t=>((t,e)=>(yt(e,((e,n)=>{t.methods[n]=(...n)=>(e(t.value,...n),t.methods)})),t))(e,t),done(){const t=e.value;return e.value=null,t},methods:{}}),e.add(t),e},t.chunk=(t,e=1)=>{const n=[];let r=0;return t.forEach(((t,o)=>{o%e||(n.push([]),o&&r++),n[r].push(t)})),n},t.chunkString=(t,e)=>t.match(new RegExp(`(.|[\r\n]){1,${e}}`,"g")),t.clear=T,t.clearIntervals=Ot,t.clearTimers=It,t.cloneArray=t=>t.slice(),t.cnsl=(t,e)=>{const n=y(t)?t:ae(t);if("alert"===e||"warning"===e)return console.trace(`%c${n}`,`${He[e]}font-size:13px;padding:2px 5px;border-radius:2px;`);console.log(`%c${n}`,`${He[e]}font-size:13px;padding:2px 5px;border-radius:2px;`)},t.cnslTheme=(t,e,n)=>{He[t]=We(e,n)},t.compact=t=>t.filter((t=>!(y(t)&&!t.length)&&t)),t.compactKeys=t=>{const e=[];return lt(t,((t,n)=>{t&&e.push(n)})),e},t.compactMap=At,t.compactMapArray=K,t.compactMapAsync=async(t,e)=>{const n=[];let r;return await G(t,(async(t,o,s)=>{r=await e(t,o,n,s),p(r)&&n.push(r)})),n},t.compactMapObject=pt,t.compactMapObjectAsync=async(t,e,n={})=>(await Et(t,(async(t,r,o,s,i)=>{const c=await e(t,r,n,s,i);p(c)&&(n[r]=c)})),n),t.construct=Kt,t.countBy=(t,e)=>{const n={};let r;return z(t,(t=>{r=e(t),n[r]||(n[r]=0),n[r]++})),n},t.countKey=(t,e)=>{let n=0;return z(t,(t=>{t[e]&&n++})),n},t.countWithoutKey=(t,e)=>{let n=0;return z(t,(t=>{t[e]||n++})),n},t.crate=function(t){return new qe(t)},t.createFragment=Se,t.curry=(t,e=t.length)=>{const n=[],r=(...o)=>{if(n.push(...o),n.length===e){const e=t(...n);return T(n),e}return r};return r},t.curryRight=(t,e=t.length)=>{const n=[],r=(...o)=>{if(n.unshift(...o),n.length===e){const e=t(...n);return T(n),e}return r};return r},t.debounce=(t,e)=>{let n=!1;const r=(...r)=>{!1!==n&&clearTimeout(n),n=St((()=>{t(...r),n=!1}),e)};return r.clear=()=>{n&&(clearTimeout(n),n=!1)},r},t.decimalCheck=g,t.deduct=t=>t-1,t.defineProperty=a,t.difference=(t,...e)=>{const n=R(e);return K(t,(t=>{if(!n.includes(t))return t}))},t.divide=(t,e)=>t/e,t.drop=Z,t.dropRight=(t,e,n=t.length)=>Z(t,0,n-e),t.each=yt,t.eachArray=z,t.eachArrayRight=q,t.eachAsync=G,t.eachAsyncRight=Q,t.eachObject=lt,t.eachObjectAsync=Et,t.eachWhile=mt,t.ensureArray=M,t.eventAdd=ve,t.eventRemove=(t,...e)=>(t.removeEventListener(...e),t),t.every=vt,t.filter=bt,t.filterArray=H,t.filterObject=ht,t.findIndex=(t,e,n="id")=>{const r=t.findIndex(((t,r)=>at(t,0,0,e,n)));return-1!==r&&r},t.findItem=(t,e,n="id")=>{const r=t.find(((t,r)=>at(t,0,0,e,n)));return-1!==r&&r},t.first=(t,e)=>e?t.slice(0,e):t[0],t.flatten=(t,e=1)=>{let n=t;for(let t=0;tt.concat(M(e))),[]);return n},t.flattenDeep=R,t.flow=fe,t.flowAsync=ge,t.flowAsyncRight=me,t.flowRight=pe,t.get=se,t.getByClass=Le,t.getById=Fe,t.getByTag=Ee,t.getExtensionRegex=L,t.getFileExtension=t=>{const e=t.match(L);if(e)return e[1]},t.getNewest=(t,e)=>st(t,e,!1)[0],t.getOldest=(t,e="id")=>it(t,e)[0],t.getOwnPropertyDescriptor=c,t.getOwnPropertyNames=l,t.groupBy=(t,e)=>{const n={};return z(t,(t=>{const r=e(t);n[r]||(n[r]=[]),n[r].push(t)})),n},t.has=(t,...e)=>t.includes(...e),t.hasAnyKeys=(t,e)=>{const n=o(t);return Boolean(e.find((t=>n.includes(t))))},t.hasDot=x,t.hasKeys=xt,t.hasLength=v,t.hasValue=p,t.htmlEntities=Ut,t.ifInvoke=(t,...e)=>{if(A(t))return t(...e)},t.ifNotEqual=(t,e,n)=>(e&&!p(t[e])&&(t[e]=n),t),t.importjs=Te,t.inAsync=async(t,e)=>G(t,(async t=>{await t(e)})),t.inSync=(t,e)=>yt(t,(t=>{t(e)})),t.increment=t=>t+1,t.indexBy=(t,e="id")=>{const n={};return z(t,(t=>{n[t[e]]=t})),n},t.info=Ue,t.initial=t=>t.slice(0,t.length-1),t.initialString=(t,e=1)=>t.slice(0,-1*e),t.insertInRange=(t,e,n)=>t.slice(0,e)+n+t.slice(e,t.length),t.intersect=(t,...e)=>K(t,(t=>{if(W(e,(e=>e.includes(t))))return t})),t.interval=Ct,t.invert=(t,e={})=>(lt(t,((t,n)=>{e[t]=n})),e),t.invoke=(t,e,n)=>_(t,((t,r)=>t[e](n,r))),t.invokeAsync=(t,e,n)=>X(t,(async(t,r)=>t[e](n,r))),t.is=s,t.isAgent=we,t.isArguments=function(t){return!!p(t)&&"[object Arguments]"===t.toString()},t.isArray=m,t.isAsync=k,t.isBoolean=E,t.isBuffer=function(t){return!!p(t)&&"ArrayBuffer"===t.constructor?.name},t.isConstructor=d,t.isDate=t=>t instanceof Date,t.isDecimal=t=>g.test(t.toString()),t.isDocumentReady=Ne,t.isDom=t=>t&&9!==t.nodeType,t.isEmpty=t=>y(t)||m(t)?!v(t):w(t)?!u(t):!p(t),t.isEnter=t=>13===t.keyCode,t.isEqual=Qt,t.isFileCSS=C,t.isFileHTML=O,t.isFileJS=I,t.isFileJSON=j,t.isFloat32=function(t){return!!p(t)&&"Float32Array"===t.constructor?.name},t.isFloat64=function(t){return!!p(t)&&"Float64Array"===t.constructor?.name},t.isFunction=A,t.isHTMLCollection=function(t){return!!p(t)&&"[object HTMLCollection]"===t.toString()},t.isInt16=function(t){return!!p(t)&&"Int16Array"===t.constructor?.name},t.isInt32=function(t){return!!p(t)&&"Int32Array"===t.constructor?.name},t.isInt8=function(t){return!!p(t)&&"Int8Array"===t.constructor?.name},t.isKindAsync=t=>!!t&&(F(t)||k(t)),t.isMap=function(t){return!!p(t)&&"[object Map]"===t.toString()},t.isMatchArray=J,t.isMatchObject=(t,e)=>{const n=o(t);return!!J(n,o(e))&&W(n,(n=>t[n]===e[n]))},t.isNodeList=function(t){return!!p(t)&&"[object NodeList]"===t.toString()},t.isNull=f,t.isNumber=b,t.isNumberEqual=(t,e)=>t===e,t.isNumberInRange=(t,e,n)=>t>e&&t{const e=typeof t;return null==t||"object"!==e&&"function"!==e},t.isPromise=F,t.isRegExp=t=>t instanceof RegExp,t.isSet=function(t){return!!p(t)&&"[object Set]"===t.toString()},t.isString=y,t.isUint16=function(t){return!!p(t)&&"Uint16Array"===t.constructor?.name},t.isUint32=function(t){return!!p(t)&&"Uint32Array"===t.constructor?.name},t.isUint8=function(t){return!!p(t)&&"Uint8Array"===t.constructor?.name},t.isUint8Clamped=function(t){return!!p(t)&&"Uint8ClampedArray"===t.constructor?.name},t.isUndefined=h,t.isWeakMap=function(t){return!!p(t)&&"[object WeakMap]"===t.toString()},t.isZero=t=>0===t,t.jsonParse=ce,t.kebabCase=t=>t.replace(Ft," ").trim().toLowerCase().replace(kt,"-$1"),t.keys=o,t.largest=t=>V(...t),t.last=(t,e)=>{const n=t.length;return e?t.slice(n-e,n):t[n-1]},t.map=wt,t.mapArray=_,t.mapArrayRight=function(t,e,n=[],r){let o=0;const s=t.length;for(let i=s-1;i>=0;i--)n[o]=e(t[i],i,t,s,r),o++;return n},t.mapAsync=X,t.mapObject=ft,t.mapObjectAsync=async(t,e,n={})=>(await Et(t,(async(t,r,o,s,i)=>{n[r]=await e(t,r,n,o,s,i)})),n),t.mapWhile=function(t,e,n=[],r){const o=t.length;for(let s=0;st-e,t.model=function(t,e){return p(e)?Kt(le,[t,e]):se(t,le.models)},t.multiply=(t,e)=>t*e,t.negate=t=>(...e)=>!t(...e),t.nodeAttribute=je,t.noop=()=>{},t.nthArg=(t=0)=>(...e)=>e[t],t.numSort=t=>t.sort(nt),t.numericalCompare=nt,t.numericalCompareReverse=rt,t.objectCreate=Zt,t.objectSize=u,t.omit=(t,e)=>ht(t,((t,n)=>!e.includes(n))),t.once=t=>{let e;return(...n)=>(p(e)||(e=t(...n)),e)},t.over=t=>(...e)=>wt(t,(t=>t(...e))),t.overEvery=t=>(...e)=>mt(t,(t=>t(...e))),t.partition=(t,e)=>{const n=[];return[K(t,(t=>{if(e(t))return t;n.push(t)})),n]},t.pick=(t,e,n={})=>(z(e,(e=>{n[e]=t[e]})),n),t.pluck=(t,e)=>_(t,(t=>t[e])),t.pluckObject=ct,t.pluckValues=(t,e)=>_(t,(t=>ct(t,e))),t.promise=ue,t.propertyMatch=(t,e,n=o(t))=>W(n,(n=>Qt(t[n],e[n]))),t.querySelector=ke,t.querySelectorAll=Me,t.rNumSort=t=>t.sort(rt),t.randomArbitrary=(t,e=0)=>B()*(t-e)+e,t.randomInt=D,t.range=(t,e,n=1)=>t{const r=[];let o=t;for(;o{const r=n<0?-1*n:n,o=[];let s=t;for(;s>e;)o.push(s),s-=r;return o})(t,e,n),t.rawURLDecode=Dt,t.reArg=(t,e)=>(...n)=>t(...e.map((t=>n[t]))),t.regexGenerator=S,t.remainder=(t,e)=>t%e,t.remove=(t,e)=>{let n=t.length;for(let r=0;r{let n=t.length;for(let r=0;rt.replace(new RegExp(`\\b${e.join("|")}\\b`,"gi"),n),t.rest=t=>t.slice(1,t.length),t.restString=Mt,t.right=(t,e)=>t[t.length-1-e],t.rightString=(t,e=1)=>t[t.length-e],t.sample=(t,e=1)=>{if(!t)return!1;const n=t.length;if(n===e||e>n)return U(t);if(1===e)return[t[D(n-1,0)]];const r=[],o={};let s,i=0;for(;iUt(Dt(t)),t.saveDimensions=Pe,t.selector=t=>{switch(t[0]){case"#":if(!xe.test(t))return Fe(Mt(t));break;case".":if(Ie.test(t))return Le(Mt(t));break;default:if(Oe.test(t))return Ee(t)}return Me(t)},t.shuffle=U,t.smallest=t=>P(...t),t.snakeCase=t=>t.replace(Ft," ").trim().toLowerCase().replace(kt,"_$1"),t.sortAlphabetical=(t,e)=>t.sort(((t,n)=>{const r=t[e],o=n[e];return ro?1:0})),t.sortNewest=st,t.sortOldest=it,t.sortedIndex=(t,e)=>{let n=0;return W(t,((t,r)=>(n=r,e>t))),n},t.stringify=ae,t.stubArray=()=>[],t.stubFalse=()=>!1,t.stubObject=()=>({}),t.stubString=()=>"",t.stubTrue=()=>!0,t.sum=t=>t.reduce(((t,e)=>t+e),0),t.take=(t,e=1)=>t.slice(0,e),t.takeRight=(t,e=1)=>{const n=t.length;return t.slice(n-e,n)},t.themes=He,t.throttle=(t,e)=>{let n,r=!1;const o=(...o)=>{r?n=!0:(t(...o),r=St((()=>{n&&t(...o),r=!1}),e))};return o.clear=()=>{clearTimeout(r),r=!1},o},t.timer=St,t.times=ot,t.timesMap=(t,e,n,r=[])=>{const o=n?t:0,s=n?e:t,i=n||e;let c;return ot(o,s,(t=>{c=i(t,o,s,r),p(c)&&r.push(c)})),r},t.toArray=e,t.toPath=te,t.toggle=(t,e=!0,n=!1)=>Qt(e,t)?n:e,t.tokenize=t=>t.match(Pt)||[],t.truncate=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),o=r.length;let s,i=n-e;for(;i=0&&(s=r[i]," "!==s);i--);return t.slice(0,i).trim()})(t,e,n):t},t.truncateRight=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),o=r.length;let s,i=e;for(;i0&&(s=r[i]," "!==s);i++);return t.substr(i,n).trim()})(t,e,n):t},t.uid=oe,t.unZip=t=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.unZipObject=t=>{const e=[],n=[];return lt(t,((t,r)=>{e.push(r),n.push(t)})),[e,n]},t.union=(...t)=>et(R(t)),t.unique=et,t.updateDimensions=ze,t.upperCase=t=>t.replace(Ft," ").trim().toUpperCase(),t.upperFirst=t=>Wt(t)+Mt(t),t.upperFirstAll=t=>t.replace(qt,(t=>t.toUpperCase())),t.upperFirstLetter=Wt,t.upperFirstOnly=Ht,t.upperFirstOnlyAll=t=>Ht(t.toLowerCase()).replace(qt,(t=>t.toUpperCase())),t.virtualStorage=be,t.whileArray=W,t.whileCompactMap=function(t,e,n=[],r){let o=0;for(;ot.filter((t=>!e.includes(t))),t.words=t=>t.match(zt)||[],t.wrap=(t,e)=>(...n)=>e(t,...n),t.xor=(...t)=>{const e=[];return z(t,(t=>{z(et(t),(t=>{e.includes(t)?e.splice(e.indexOf(t),1):e.push(t)}))})),e},t.zip=(...t)=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.zipObject=Lt,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=browser.js.map diff --git a/uwBridge/system/compile/source/worker/core/ClientSocket.js b/uwBridge/system/compile/source/worker/core/ClientSocket.js new file mode 100644 index 00000000..1b2da14b --- /dev/null +++ b/uwBridge/system/compile/source/worker/core/ClientSocket.js @@ -0,0 +1,132 @@ +const { + uid, + promise, + construct, + isPlainObject, + isString, + stringify, + jsonParse, + hasValue +} = self.$; +export class ClientSocket { + constructor(app) { + this.app = app; + console.log('Worker Socket Module', 'notify'); + this.hostDomain = `${(app.config.socketHostname || location.hostname)}`; + if (app.config.port) { + this.hostDomain = `${this.hostDomain}:${app.config.port}`; + } + console.log(this.hostDomain); + this.connect(); + clearInterval(); + } + callbacks = {}; + status = 0; + ready() { + console.log('Socket Is Ready'); + if (this.status) { + this.app.update({ + type: 'connection', + status: 'reconnected' + }); + } else { + this.app.post('ready', { + type: 'connection', + status: 'connected' + }); + this.status = 1; + console.log('connected'); + } + } + process(response) { + const compiledResponse = jsonParse(response); + console.log(compiledResponse); + if (!compiledResponse.id) { + return this.app.update(compiledResponse); + } + const callback = this.callbacks[compiledResponse.id]; + if (callback) { + return callback(compiledResponse); + } + } + reconnect() { + const thisContext = this; + if (!hasValue(thisContext.connectInterval)) { + thisContext.connectInterval = setInterval(() => { + thisContext.connect(); + }, 2000); + } + } + connect() { + const thisContext = this; + thisContext.socket = construct(WebSocket, [thisContext.hostDomain]); + thisContext.socket.addEventListener('open', () => { + if (hasValue(thisContext.connectInterval)) { + clearInterval(thisContext.connectInterval); + } + this.ready(); + }); + // Listen for messages + thisContext.socket.addEventListener('message', (socketEvent) => { + console.log('Message from server ', socketEvent.data); + thisContext.process(socketEvent.data); + }); + thisContext.socket.addEventListener('disconnect', () => { + console.log('disconnected'); + if (!hasValue(thisContext.connectInterval)) { + thisContext.app.update({ + type: 'connection', + status: 'disconnected' + }); + } + thisContext.reconnect(); + }); + thisContext.socket.addEventListener('close', () => { + console.log('close'); + if (!hasValue(thisContext.connectInterval)) { + thisContext.app.update({ + type: 'connection', + status: 'closed' + }); + } + thisContext.reconnect(); + }); + } + send(data) { + if (isPlainObject(data)) { + this.socket.send(stringify(data)); + } else if (isString(data)) { + this.socket.send(data); + } else { + this.socket.send(data); + } + } + async request(configObj) { + const results = await promise((accept) => { + const { + data, + callback, + } = configObj; + if (data.id) { + data.id = null; + } else { + const uuid = uid().toString(); + data.id = uuid; + this.callbacks[uuid] = async (requestData) => { + if (callback) { + const returned = await callback(requestData); + if (returned) { + this.callbacks[uuid] = null; + uid.free(uuid); + accept(returned); + } + } else { + accept(requestData.data); + } + }; + } + this.send(data); + }); + return results; + } +} diff --git a/uwBridge/system/compile/source/worker/core/app.js b/uwBridge/system/compile/source/worker/core/app.js index 6f951a39..86b656ed 100644 --- a/uwBridge/system/compile/source/worker/core/app.js +++ b/uwBridge/system/compile/source/worker/core/app.js @@ -1,10 +1,62 @@ -const { assign } = self.$; -const app = { - config: {}, - utility: self.$, - events: { - appStatus: { - state: 0 +const { + assign, + construct, + get, + map, + apply +} = self.$; +import { processScriptRequest } from './scriptCompile'; +import { ClientSocket } from './ClientSocket'; +export class AppWorker { + constructor() { + self.onmessage = async (workerEvent) => { + this.onmessage(workerEvent); + }; + } + async onmessage(workerEvent) { + console.log(workerEvent.data); + const { + task, + id, + data + } = workerEvent.data; + const eventCallback = get(task, this.tasks); + console.log(task, data); + if (eventCallback) { + const results = await apply(eventCallback, this, [data, { + id + }]); + if (results) { + this.post(id, results); + } + if (this.debug) { + console.log(`Worker api.${task}`); + } + } else { + console.log(`FAILED Worker api.${task}`); + } + } + update(body) { + console.log(body); + this.post('_', { + body + }); + } + post(id, data, options) { + const responseData = { + data, + id + }; + assign(responseData, options); + postMessage(responseData); + } + state = 1; + config = {}; + tasks = { + configure(data) { + assign(this.config, data); + console.log('STARTING'); + this.socket = construct(ClientSocket, [this]); }, post(id, data, options) { const responseData = { @@ -14,8 +66,37 @@ const app = { assign(responseData, options); postMessage(responseData); }, - socket: {} - } -}; -console.log(app.$); -export default app; + socket: { + async get(options, workerInfo) { + const context = this; + const { body } = options; + const fileList = body.files; + const configObj = { + checksum: [], + completedFiles: map(fileList, () => { + return ''; + }), + fileList: body, + fileListLength: fileList.length, + filesLoaded: 0, + progress: options.progress, + }; + const requestConfig = { + async callback(json) { + return processScriptRequest(context, json, configObj, workerInfo); + }, + data: { + task: 'file.get', + body + }, + }; + const results = await this.socket.request(requestConfig); + this.post(workerInfo.id, results); + }, + request(data) { + this.socket.request(data); + }, + } + }; + utility = self.$; +} diff --git a/uwBridge/system/compile/source/worker/core/events.js b/uwBridge/system/compile/source/worker/core/events.js deleted file mode 100644 index e69de29b..00000000 diff --git a/uwBridge/system/compile/source/worker/core/index.js b/uwBridge/system/compile/source/worker/core/index.js index 7d1a1ff2..48bc3198 100644 --- a/uwBridge/system/compile/source/worker/core/index.js +++ b/uwBridge/system/compile/source/worker/core/index.js @@ -1,3 +1,3 @@ -import './app'; -import './socket'; -import './onMessage'; +const { construct } = self.$; +import { AppWorker } from './app'; +construct(AppWorker, []); diff --git a/uwBridge/system/compile/source/worker/core/onMessage.js b/uwBridge/system/compile/source/worker/core/onMessage.js deleted file mode 100644 index 3f1ec2e3..00000000 --- a/uwBridge/system/compile/source/worker/core/onMessage.js +++ /dev/null @@ -1,28 +0,0 @@ -import app from './app'; -const { - utility: { get }, - events, - events: { post } -} = app; -self.onmessage = async (workerEvent) => { - const { - request, - id, - data - } = workerEvent.data; - const eventCallback = get(request, events); - console.log(request, data); - if (eventCallback) { - const results = await eventCallback(data, { - id - }); - if (results) { - post(id, results); - } - if (app.debug) { - console.log(`Worker api.${request}`); - } - } else { - console.log(`FAILED Worker api.${request}`); - } -}; diff --git a/uwBridge/system/compile/source/worker/core/scriptCompile.js b/uwBridge/system/compile/source/worker/core/scriptCompile.js new file mode 100644 index 00000000..e19519b6 --- /dev/null +++ b/uwBridge/system/compile/source/worker/core/scriptCompile.js @@ -0,0 +1,85 @@ +const { + isFileJS, + isFileJSON, + isFileCSS, + initial, +} = self.$; +const shouldNotUpgrade = /(^js\/lib\/)|(\.min\.js)/; +const importRegexGlobal = /\bimport\b([^:;=]*?){([^;]*?)}(\s\bfrom\b).*(('|"|`).*('|"|`));$/gm; +const importSingleRegexGlobal = /\bimport\b([^:;={}]*?)([^;{}]*?)(\s\bfrom\b).*(('|"|`).*('|"|`));$/gm; +const importEntire = /\bimport\b\s(('|"|`).*('|"|`));$/gm; +const importDynamic = /{([^;]*?)}\s=\simport\((('|"|`).*('|"|`))\);$/gm; +const slashString = '/'; +const replaceImports = function(file) { + let compiled = file; + compiled = compiled.replace(importRegexGlobal, 'const {$2} = await appGlobal.demandJs($4);'); + compiled = compiled.replace(importSingleRegexGlobal, 'const $2 = await appGlobal.demandJs($4);'); + compiled = compiled.replace(importEntire, 'await appGlobal.demandJs($1);'); + compiled = compiled.replace(importDynamic, '{$1} = await appGlobal.demandJs($2);'); + return compiled; +}; +const keepObject = { + keep: true, +}; +export const processScriptRequest = async function(contex, response, configObj, workerInfo) { + const { body } = response; + const { + file, + cs, + cache + } = body; + const key = body.key; + const fileList = configObj.fileList; + const filename = fileList.files[key]; + const completedFiles = configObj.completedFiles; + const checksums = configObj.checksum; + const isLib = shouldNotUpgrade.test(filename); + // Remove this can just get ext on other end and check if needed + const isJs = isFileJS(filename); + const isJson = isFileJSON(filename); + const isCss = isFileCSS(filename); + const dirname = initial(filename.split(slashString)) + .join(slashString); + /* + During an active stream data is compiled. + Based on Key coming in. + */ + if (file) { + completedFiles[key] = file; + checksums[key] = cs; + configObj.filesLoaded += 1; + } else if (file === false) { + checksums[key] = false; + completedFiles[key] = false; + configObj.filesLoaded += 1; + } else if (cache) { + completedFiles[key] = true; + configObj.filesLoaded += 1; + } + let completedFile = completedFiles[key]; + if (completedFile !== true && isJs && !isLib && completedFile !== false) { + completedFile = replaceImports(completedFile); + } + const message = { + dirname, + isCss, + isJs, + isJson, + isLib, + key, + }; + if (cs) { + message.cs = cs; + } + if (completedFile) { + message.file = completedFile; + } + contex.post(workerInfo.id, message, keepObject); + if (configObj.filesLoaded === configObj.fileListLength) { + const returned = { + loaded: configObj.filesLoaded + }; + return returned; + } + return false; +}; diff --git a/uwBridge/system/compile/source/worker/core/socket.js b/uwBridge/system/compile/source/worker/core/socket.js deleted file mode 100644 index 297da95c..00000000 --- a/uwBridge/system/compile/source/worker/core/socket.js +++ /dev/null @@ -1,254 +0,0 @@ -import app from './app'; -const { - config, - utility: { - assign, - uid, - isFileJS, - isFileJSON, - isFileCSS, - initial, - map, - promise, - construct, - isPlainObject, - isString, - stringify, - jsonParse - }, - events: { post } -} = app; -const shouldNotUpgrade = /(^js\/lib\/)|(\.min\.js)/; -const importRegexGlobal = /\bimport\b([^:;=]*?){([^;]*?)}(\s\bfrom\b).*(('|"|`).*('|"|`));$/gm; -const importSingleRegexGlobal = /\bimport\b([^:;={}]*?)([^;{}]*?)(\s\bfrom\b).*(('|"|`).*('|"|`));$/gm; -const importEntire = /\bimport\b\s(('|"|`).*('|"|`));$/gm; -const importDynamic = /{([^;]*?)}\s=\simport\((('|"|`).*('|"|`))\);$/gm; -const slashString = '/'; -const replaceImports = function(file) { - let compiled = file; - compiled = compiled.replace(importRegexGlobal, 'const {$2} = await appGlobal.demandJs($4);'); - compiled = compiled.replace(importSingleRegexGlobal, 'const $2 = await appGlobal.demandJs($4);'); - compiled = compiled.replace(importEntire, 'await appGlobal.demandJs($1);'); - compiled = compiled.replace(importDynamic, '{$1} = await appGlobal.demandJs($2);'); - return compiled; -}; -const getCallback = async function(response, configObj, workerInfo) { - const { body } = response; - const item = body.file; - const checksum = body.cs; - const cacheCheck = body.cache; - const key = body.key; - const fileList = configObj.fileList; - const filename = fileList.files[key]; - const completedFiles = configObj.completedFiles; - const checksums = configObj.checksum; - const isLib = shouldNotUpgrade.test(filename); - const isJs = isFileJS(filename); - const isJson = isFileJSON(filename); - const isCss = isFileCSS(filename); - const dirname = initial(filename.split(slashString)) - .join(slashString); - let sendNow; - /* - During an active stream data is compiled. - Based on Key coming in. - */ - if (item) { - completedFiles[key] += item; - } else if (item === false) { - checksums[key] = false; - completedFiles[key] = false; - configObj.filesLoaded += 1; - sendNow = true; - } else if (cacheCheck) { - completedFiles[key] = true; - configObj.filesLoaded += 1; - sendNow = true; - } else { - configObj.filesLoaded += 1; - checksums[key] = checksum; - sendNow = true; - } - if (sendNow) { - let completedFile = completedFiles[key]; - if (completedFile !== true && isJs && !isLib && completedFile !== false) { - completedFile = replaceImports(completedFile); - } - post(workerInfo.id, { - cs: checksums[key], - dirname, - file: completedFile, - isCss, - isJs, - isJson, - isLib, - key, - }, { - keep: true, - }); - } - if (configObj.filesLoaded === configObj.fileListLength) { - const returned = { - loaded: configObj.filesLoaded - }; - return returned; - } - return false; -}; -class client { - update(json) { - post('_', json); - } - callbacks = { - update(json) { - return this.update(json); - }, - }; - status = 0; - ready() { - console.log('Socket Is Ready'); - if (this.status) { - this.update({ - data: { - type: 'connection', - status: 'reconnected' - } - }); - } else { - post('ready', { - type: 'connection', - status: 'connected' - }); - this.status = 1; - console.log('connected'); - } - } - process(response) { - const compiledResponse = jsonParse(response); - console.log(compiledResponse); - if (!compiledResponse.id) { - return this.update(compiledResponse); - } - const callback = this.callbacks[compiledResponse.id]; - if (callback) { - return callback(compiledResponse); - } - } - connect() { - this.socket = construct(WebSocket, [this.hostDomain]); - this.socket.addEventListener('open', () => { - this.ready(); - }); - // Listen for messages - this.socket.addEventListener('message', (socketEvent) => { - console.log('Message from server ', socketEvent.data); - this.process(socketEvent.data); - }); - this.socket.addEventListener('disconnect', (reason) => { - console.log('disconnected'); - if (reason === 'io server disconnect') { - this.connect(); - } - this.update({ - data: { - type: 'connection', - status: 'disconnected' - } - }); - }); - this.socket.addEventListener('close', (reason) => { - console.log('disconnected'); - if (reason === 'io server disconnect') { - this.socket.connect(); - } - this.update({ - data: { - type: 'connection', - status: 'closed' - } - }); - }); - } - send(data) { - if (isPlainObject(data)) { - this.socket.send(stringify(data)); - } else if (isString(data)) { - this.socket.send(data); - } else { - this.socket.send(data); - } - } - async request(configObj) { - const results = await promise((accept) => { - const { - data, - callback, - } = configObj; - if (data.id) { - data.id = null; - } else { - const uuid = uid().toString(); - data.id = uuid; - this.callbacks[uuid] = async (requestData) => { - if (callback) { - const returned = await callback(requestData); - if (returned) { - this.callbacks[uuid] = null; - uid.free(uuid); - accept(returned); - } - } else { - accept(requestData.data); - } - }; - } - this.send(data); - }); - return results; - } - constructor() { - console.log('Worker Socket Module', 'notify'); - this.hostDomain = `${(app.config.socketHostname || location.hostname)}`; - if (app.config.port) { - this.hostDomain = `${this.hostDomain}:${app.config.port}`; - } - console.log(this.hostDomain); - this.connect(); - } -} -let socketObject; -assign(app.events.socket, { - async get(options, workerInfo) { - const { body } = options; - const fileList = body.files; - const configObj = { - checksum: [], - completedFiles: map(fileList, () => { - return ''; - }), - fileList: body, - fileListLength: fileList.length, - filesLoaded: 0, - progress: options.progress, - }; - const requestConfig = { - async callback(json) { - return getCallback(json, configObj, workerInfo); - }, - data: { - request: 'file.get', - body - }, - }; - const results = await socketObject.request(requestConfig); - post(workerInfo.id, results); - }, - request(data) { - socketObject.request(data); - }, -}); -app.events.configure = (data) => { - assign(config, data); - console.log('STARTING'); - socketObject = construct(client, []); -}; diff --git a/uwBridge/system/compile/source/worker/libs/Acid.js b/uwBridge/system/compile/source/worker/libs/Acid.js index 1f01bd79..33a77efd 100644 --- a/uwBridge/system/compile/source/worker/libs/Acid.js +++ b/uwBridge/system/compile/source/worker/libs/Acid.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).$={})}(this,(function(t){"use strict";const e=Array.from,n=Reflect.apply,r=Object,s=r.keys,i=r.is,c=r.assign,o=r.getOwnPropertyDescriptor,a=r.defineProperty,u=r.getOwnPropertyNames,l=t=>s(t).length;function p(t){return void 0===t}function f(t){return null===t}function h(t){return!p(t)&&!f(t)}function g(t){return e=>!!h(e)&&e.constructor===t}const m=/\.|\+/,y=Array.isArray,d=g(String),b=g(Number),A=t=>!!h(t)&&"Object("===t.constructor.toString().trim().slice(9,16),w=t=>!!h(t)&&t instanceof Function,O=t=>Boolean(t.length),j=t=>e=>!!h(e)&&t.test(e),S=j(/\.css$/),C=j(/\.json$/),v=j(/\.js$/),M=j(/\.html$/),R=j(/\./),k=/\.([0-9a-z]+)/,x=t=>!!t&&t instanceof Promise,F=t=>!!t&&"AsyncFunction"===t.constructor?.name;const I=t=>y(t)&&t||h(t)&&[t]||[],E=t=>t.flat(1/0),U=t=>(t.length=0,t),N=Math,P=N.floor,T=N.random,B=(t,e=0)=>P(T()*(t-e))+e,L=(t,n=t.length)=>{if(t.length<=1)return e(t);const r=e(t);let s,i,c=0;for(;c=0;s--)e(t[s],s,t,r,n);return t}function z(t,e,n){const r=t.length;for(let s=0;s{!0===e(t,s,n,i,c,r)&&n.push(t)})),n}function q(t,e,n=[],r){return $(t,((t,s,i,c)=>{n[s]=e(t,s,n,i,c,r)})),n}function W(t,e,n=[],r){return $(t,((t,s,i,c)=>{const o=e(t,s,n,i,c,r);h(o)&&n.push(o)})),n}const J=(t,e,n=t.length)=>t.splice(e,n),Z=(t,e)=>t.length===e.length&&z(t,((t,n)=>e[n]===t)),V=Math.max,G=async(t,e)=>{const n=t.length;for(let r=0;r{const n=t.length;for(let r=n-1;r>=0;r--)await e(t[r],r,t,n);return t},Q=async(t,e)=>{const n=[];return await G(t,(async(t,r,s)=>{n[r]=await e(t,r,s)})),n},X=(t,e,n)=>n.indexOf(t)===e,Y=(t,e,n)=>t!==n[e-1],tt=(t,e)=>e?t.filter(Y):t.filter(X),et=(t,e)=>t-e,nt=(t,e)=>e-t,rt=(t,e,n)=>{const r=n?t:0,s=n?e:t,i=n||e;for(let t=r;t(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?-1:0:1:-1)),it=(t,e="id",n=!0)=>(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?1:0:-1:1)),ct=(t,e)=>q(e,(e=>t[e])),ot=(t,e,n,r,s)=>{if(t[s]===r)return!0},at=(t,e)=>{$(s(t),((n,r,s,i)=>{e(t[n],n,t,i,s)}))},ut=(t,e)=>z(s(t),((n,r,s,i)=>e(t[n],n,t,i,s))),lt=(t,e,n={})=>(at(t,((t,r,s,i,c)=>{!0===e(t,r,n,s,i,c)&&(n[r]=t)})),n),pt=(t,e,n={})=>(at(t,((t,r,s,i,c)=>{n[r]=e(t,r,n,s,i,c)})),n),ft=(t,e,n={})=>(at(t,((t,r,s,i,c)=>{const o=e(t,r,n,s,i,c);h(o)&&(n[r]=o)})),n),ht=(t,e)=>t.forEach(e),gt=(t,e)=>(n,r,s)=>{let i;if(h(n))return i=y(n)?t:A(n)||w(n)?e:n.forEach?ht:e,i(n,r,s)},mt=gt(z,ut),yt=gt($,at),dt=gt(K,lt),bt=gt(q,pt),At=gt(W,ft),wt=mt,Ot=(t,e)=>setTimeout(t,e),jt=(t,e)=>setInterval(t,e),St=(t,e)=>()=>{rt(0,t((()=>{}),0),(t=>{e(t)}))},Ct=St(Ot,clearTimeout),vt=St(jt,clearInterval),Mt=(t,e)=>{const n=s(t);return z(e,(t=>n.includes(t)))},Rt=async(t,e)=>{const n=s(t);return await G(n,((r,s,i,c)=>e(t[r],r,t,c,n))),t},kt=/[-_]/g,xt=/ (.)/g,Ft=(t,e=1)=>t.substr(e),It=/%(?![\da-f]{2})/gi,Et=/&/g,Ut=//g,Pt=/"/g,Tt=t=>decodeURIComponent(t.replace(It,(()=>"%25"))),Bt=t=>t.replace(Et,"&").replace(Ut,"<").replace(Nt,">").replace(Pt,"""),Lt=/\S+/g,Dt=/\w+/g,$t=/ (.)/g,_t=t=>t[0].toUpperCase(),zt=t=>_t(t)+Ft(t).toLowerCase(),Kt=Reflect.construct;const qt=Object.create,Wt=(t,e,n=!1,r,i,c)=>{if(t){if(c){const s=c.pop();if(s){const r=e[s];t[s]=Wt(t[s],r,n)}else if(!i)return t;if(i){let s=r||0;if(s++,sglobalThis.structuredClone(t):t=>A(t)?Wt({},t):y(t)?Wt([],t):qt(t);const Zt=Function.prototype;const Vt=(t,e)=>{if(t===e)return!0;if(t.toString()===e.toString())if(A(t)){const n=s(t);if(Mt(e,n))return z(n,(n=>Vt(t[n],e[n])))}else if(y(t)&&t.length===e.length)return z(t,((t,n)=>Vt(t,e[n])));return!1},Gt=/\.|\[/,Ht=/]/g,Qt=t=>t.replace(Ht,"").split(Gt);let Xt=0;const Yt=[],te={};function ee(){let t=Yt.shift(Yt);return h(t)||(t=Xt,te[t]=!0,Xt++),t}ee.free=t=>{te[t]=null,Yt.push(t)};const ne=(t,e)=>{let n=e;return z(Qt(t),(t=>(n=n[t],h(n)))),n},re=JSON,se=re.parse,ie=re.stringify,ce=(t,e)=>(h(e)&&(ce[t]=e),ne(t,ce)),oe=t=>(...e)=>n=>{let r=n;return t(e,(t=>{r=t(r)})),r},ae=oe($),ue=oe(_),le=t=>(...e)=>async n=>{let r=n;return await t(e,(async t=>{r=await t(r)})),r},pe=le(G),fe=le(H);t.add=(t,e)=>t+e,t.after=(t,e)=>{let n,r=t;return(...t)=>(null!==r&&r--,r<=0&&(n=e(...t),r=null),n)},t.apply=n,t.arrayToObject=(t,e)=>{const n={};return $(t,((t,r)=>{n[e[r]]=t})),n},t.ary=(t,e)=>(...n)=>t(...n.splice(0,e)),t.assign=c,t.assignDeep=Wt,t.asyncEach=async(t,e)=>{const n=t.length;for(let r=0;r{let n,r=t;return(...t)=>(null!==r&&r--,r>=1?n=e(...t):r=null,n)},t.bindAll=(t,e)=>bt(t,(t=>w(t)?t.bind(e):t)),t.cacheNativeMethod=function(t){return Zt.call.bind(t)},t.camelCase=t=>t.toLowerCase().replace(xt,(t=>t.toUpperCase().replace(/ /g,""))),t.chain=t=>{const e=t=>(e.value=t,e.methods);return c(e,{add:t=>((t,e)=>(yt(e,((e,n)=>{t.methods[n]=(...n)=>(e(t.value,...n),t.methods)})),t))(e,t),done(){const t=e.value;return e.value=null,t},methods:{}}),e.add(t),e},t.chunk=(t,e=1)=>{const n=[];let r=0;return t.forEach(((t,s)=>{s%e||(n.push([]),s&&r++),n[r].push(t)})),n},t.chunkString=(t,e)=>t.match(new RegExp(`(.|[\r\n]){1,${e}}`,"g")),t.clear=U,t.clearIntervals=vt,t.clearTimers=Ct,t.cloneArray=t=>t.slice(),t.compact=t=>t.filter((t=>!(d(t)&&!t.length)&&t)),t.compactKeys=t=>{const e=[];return at(t,((t,n)=>{t&&e.push(n)})),e},t.compactMap=At,t.compactMapArray=W,t.compactMapAsync=async(t,e)=>{const n=[];let r;return await G(t,(async(t,s,i)=>{r=await e(t,s,n,i),h(r)&&n.push(r)})),n},t.compactMapObject=ft,t.compactMapObjectAsync=async(t,e,n={})=>(await Rt(t,(async(t,r,s,i,c)=>{const o=await e(t,r,n,i,c);h(o)&&(n[r]=o)})),n),t.construct=function(t,e=[],n){return n?Kt(t,e,n):Kt(t,e)},t.countBy=(t,e)=>{const n={};let r;return $(t,(t=>{r=e(t),n[r]||(n[r]=0),n[r]++})),n},t.countKey=(t,e)=>{let n=0;return $(t,(t=>{t[e]&&n++})),n},t.countWithoutKey=(t,e)=>{let n=0;return $(t,(t=>{t[e]||n++})),n},t.curry=(t,e=t.length)=>{const n=[],r=(...s)=>{if(n.push(...s),n.length===e){const e=t(...n);return U(n),e}return r};return r},t.curryRight=(t,e=t.length)=>{const n=[],r=(...s)=>{if(n.unshift(...s),n.length===e){const e=t(...n);return U(n),e}return r};return r},t.debounce=(t,e)=>{let n=!1;const r=(...r)=>{!1!==n&&clearTimeout(n),n=Ot((()=>{t(...r),n=!1}),e)};return r.clear=()=>{n&&(clearTimeout(n),n=!1)},r},t.decimalCheck=m,t.deduct=t=>t-1,t.defineProperty=a,t.difference=(t,...e)=>{const n=E(e);return W(t,(t=>{if(!n.includes(t))return t}))},t.divide=(t,e)=>t/e,t.drop=J,t.dropRight=(t,e,n=t.length)=>J(t,0,n-e),t.each=yt,t.eachArray=$,t.eachArrayRight=_,t.eachAsync=G,t.eachAsyncRight=H,t.eachObject=at,t.eachObjectAsync=Rt,t.eachWhile=mt,t.ensureArray=I,t.every=wt,t.filter=dt,t.filterArray=K,t.filterObject=lt,t.findIndex=(t,e,n="id")=>{const r=t.findIndex(((t,r)=>ot(t,0,0,e,n)));return-1!==r&&r},t.findItem=(t,e,n="id")=>{const r=t.find(((t,r)=>ot(t,0,0,e,n)));return-1!==r&&r},t.first=(t,e)=>e?t.slice(0,e):t[0],t.flatten=(t,e=1)=>{let n=t;for(let t=0;tt.concat(I(e))),[]);return n},t.flattenDeep=E,t.flow=ae,t.flowAsync=pe,t.flowAsyncRight=fe,t.flowRight=ue,t.get=ne,t.getExtensionRegex=k,t.getFileExtension=t=>{const e=t.match(k);if(e)return e[1]},t.getNewest=(t,e)=>st(t,e,!1)[0],t.getOldest=(t,e="id")=>it(t,e)[0],t.getOwnPropertyDescriptor=o,t.getOwnPropertyNames=u,t.groupBy=(t,e)=>{const n={};return $(t,(t=>{const r=e(t);n[r]||(n[r]=[]),n[r].push(t)})),n},t.has=(t,...e)=>t.includes(...e),t.hasAnyKeys=(t,e)=>{const n=s(t);return Boolean(e.find((t=>n.includes(t))))},t.hasDot=R,t.hasKeys=Mt,t.hasLength=O,t.hasValue=h,t.htmlEntities=Bt,t.ifInvoke=(t,...e)=>{if(w(t))return t(...e)},t.ifNotEqual=(t,e,n)=>(e&&!h(t[e])&&(t[e]=n),t),t.inAsync=async(t,e)=>G(t,(async t=>{await t(e)})),t.inSync=(t,e)=>yt(t,(t=>{t(e)})),t.increment=t=>t+1,t.indexBy=(t,e="id")=>{const n={};return $(t,(t=>{n[t[e]]=t})),n},t.initial=t=>t.slice(0,t.length-1),t.initialString=(t,e=1)=>t.slice(0,-1*e),t.insertInRange=(t,e,n)=>t.slice(0,e)+n+t.slice(e,t.length),t.intersect=(t,...e)=>W(t,(t=>{if(z(e,(e=>e.includes(t))))return t})),t.interval=jt,t.invert=(t,e={})=>(at(t,((t,n)=>{e[t]=n})),e),t.invoke=(t,e,n)=>q(t,((t,r)=>t[e](n,r))),t.invokeAsync=(t,e,n)=>Q(t,(async(t,r)=>t[e](n,r))),t.is=i,t.isArguments=function(t){return!!h(t)&&"[object Arguments]"===t.toString()},t.isArray=y,t.isAsync=F,t.isBoolean=t=>"Boolean"===t.constructor.name,t.isBuffer=function(t){return!!h(t)&&"ArrayBuffer"===t.constructor?.name},t.isConstructor=g,t.isDate=t=>t instanceof Date,t.isDecimal=t=>m.test(t.toString()),t.isEmpty=t=>d(t)||y(t)?!O(t):A(t)?!l(t):!h(t),t.isEqual=Vt,t.isFileCSS=S,t.isFileHTML=M,t.isFileJS=v,t.isFileJSON=C,t.isFloat32=function(t){return!!h(t)&&"Float32Array"===t.constructor?.name},t.isFloat64=function(t){return!!h(t)&&"Float64Array"===t.constructor?.name},t.isFunction=w,t.isInt16=function(t){return!!h(t)&&"Int16Array"===t.constructor?.name},t.isInt32=function(t){return!!h(t)&&"Int32Array"===t.constructor?.name},t.isInt8=function(t){return!!h(t)&&"Int8Array"===t.constructor?.name},t.isKindAsync=t=>!!t&&(x(t)||F(t)),t.isMap=function(t){return!!h(t)&&"[object Map]"===t.toString()},t.isMatchArray=Z,t.isMatchObject=(t,e)=>{const n=s(t);return!!Z(n,s(e))&&z(n,(n=>t[n]===e[n]))},t.isNull=f,t.isNumber=b,t.isNumberEqual=(t,e)=>t===e,t.isNumberInRange=(t,e,n)=>t>e&&t"__proto__"!==t&&"constructor"!==t&&"prototype"!==t,t.isPromise=x,t.isRegExp=t=>t instanceof RegExp,t.isSet=function(t){return!!h(t)&&"[object Set]"===t.toString()},t.isString=d,t.isUint16=function(t){return!!h(t)&&"Uint16Array"===t.constructor?.name},t.isUint32=function(t){return!!h(t)&&"Uint32Array"===t.constructor?.name},t.isUint8=function(t){return!!h(t)&&"Uint8Array"===t.constructor?.name},t.isUint8Clamped=function(t){return!!h(t)&&"Uint8ClampedArray"===t.constructor?.name},t.isUndefined=p,t.isWeakMap=function(t){return!!h(t)&&"[object WeakMap]"===t.toString()},t.isZero=t=>0===t,t.jsonParse=se,t.kebabCase=t=>t.replace(kt," ").trim().toLowerCase().replace(xt,"-$1"),t.keys=s,t.largest=t=>V(...t),t.last=(t,e)=>{const n=t.length;return e?t.slice(n-e,n):t[n-1]},t.map=bt,t.mapArray=q,t.mapArrayRight=function(t,e,n=[],r){let s=0;const i=t.length;for(let c=i-1;c>=0;c--)n[s]=e(t[c],c,t,i,r),s++;return n},t.mapAsync=Q,t.mapObject=pt,t.mapObjectAsync=async(t,e,n={})=>(await Rt(t,(async(t,r,s,i,c)=>{n[r]=await e(t,r,n,s,i,c)})),n),t.mapWhile=function(t,e,n=[],r){const s=t.length;for(let i=0;it-e,t.model=ce,t.multiply=(t,e)=>t*e,t.negate=t=>(...e)=>!t(...e),t.noop=()=>{},t.nthArg=(t=0)=>(...e)=>e[t],t.numSort=t=>t.sort(et),t.numericalCompare=et,t.numericalCompareReverse=nt,t.objectCreate=qt,t.objectSize=l,t.omit=(t,e)=>lt(t,((t,n)=>!e.includes(n))),t.once=t=>{let e;return(...n)=>(h(e)||(e=t(...n)),e)},t.over=t=>(...e)=>bt(t,(t=>t(...e))),t.overEvery=t=>(...e)=>mt(t,(t=>t(...e))),t.partition=(t,e)=>{const n=[];return[W(t,(t=>{if(e(t))return t;n.push(t)})),n]},t.pick=(t,e,n={})=>($(e,(e=>{n[e]=t[e]})),n),t.pluck=(t,e)=>q(t,(t=>t[e])),t.pluckObject=ct,t.pluckValues=(t,e)=>q(t,(t=>ct(t,e))),t.promise=t=>new Promise(t),t.propertyMatch=(t,e,n=s(t))=>z(n,(n=>Vt(t[n],e[n]))),t.rNumSort=t=>t.sort(nt),t.randomArbitrary=(t,e=0)=>T()*(t-e)+e,t.randomInt=B,t.range=(t,e,n=1)=>t{const r=[];let s=t;for(;s{const r=n<0?-1*n:n,s=[];let i=t;for(;i>e;)s.push(i),i-=r;return s})(t,e,n),t.rawURLDecode=Tt,t.reArg=(t,e)=>(...n)=>t(...e.map((t=>n[t]))),t.regexGenerator=j,t.remainder=(t,e)=>t%e,t.remove=(t,e)=>{let n=t.length;for(let r=0;r{let n=t.length;for(let r=0;rt.replace(new RegExp(`\\b${e.join("|")}\\b`,"gi"),n),t.rest=t=>t.slice(1,t.length),t.restString=Ft,t.right=(t,e)=>t[t.length-1-e],t.rightString=(t,e=1)=>t[t.length-e],t.sample=(t,e=1)=>{if(!t)return!1;const n=t.length;if(n===e||e>n)return L(t);if(1===e)return[t[B(n-1,0)]];const r=[],s={};let i,c=0;for(;cBt(Tt(t)),t.shuffle=L,t.smallest=t=>D(...t),t.snakeCase=t=>t.replace(kt," ").trim().toLowerCase().replace(xt,"_$1"),t.sortAlphabetical=(t,e)=>t.sort(((t,n)=>{const r=t[e],s=n[e];return rs?1:0})),t.sortNewest=st,t.sortOldest=it,t.sortedIndex=(t,e)=>{let n=0;return z(t,((t,r)=>(n=r,e>t))),n},t.stringify=ie,t.stubArray=()=>[],t.stubFalse=()=>!1,t.stubObject=()=>({}),t.stubString=()=>"",t.stubTrue=()=>!0,t.sum=t=>t.reduce(((t,e)=>t+e),0),t.take=(t,e=1)=>t.slice(0,e),t.takeRight=(t,e=1)=>{const n=t.length;return t.slice(n-e,n)},t.throttle=(t,e)=>{let n,r=!1;const s=(...s)=>{r?n=!0:(t(...s),r=Ot((()=>{n&&t(...s),r=!1}),e))};return s.clear=()=>{clearTimeout(r),r=!1},s},t.timer=Ot,t.times=rt,t.timesMap=(t,e,n,r=[])=>{const s=n?t:0,i=n?e:t,c=n||e;let o;return rt(s,i,(t=>{o=c(t,s,i,r),h(o)&&r.push(o)})),r},t.toArray=e,t.toPath=Qt,t.toggle=(t,e=!0,n=!1)=>Vt(e,t)?n:e,t.tokenize=t=>t.match(Lt)||[],t.truncate=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),s=r.length;let i,c=n-e;for(;c=0&&(i=r[c]," "!==i);c--);return t.slice(0,c).trim()})(t,e,n):t},t.truncateRight=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),s=r.length;let i,c=e;for(;c0&&(i=r[c]," "!==i);c++);return t.substr(c,n).trim()})(t,e,n):t},t.uid=ee,t.unZip=t=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.unZipObject=t=>{const e=[],n=[];return at(t,((t,r)=>{e.push(r),n.push(t)})),[e,n]},t.union=(...t)=>tt(E(t)),t.unique=tt,t.upperCase=t=>t.replace(kt," ").trim().toUpperCase(),t.upperFirst=t=>_t(t)+Ft(t),t.upperFirstAll=t=>t.replace($t,(t=>t.toUpperCase())),t.upperFirstLetter=_t,t.upperFirstOnly=zt,t.upperFirstOnlyAll=t=>zt(t.toLowerCase()).replace($t,(t=>t.toUpperCase())),t.whileArray=z,t.whileCompactMap=function(t,e,n=[],r){let s=0;for(;st.filter((t=>!e.includes(t))),t.words=t=>t.match(Dt)||[],t.wrap=(t,e)=>(...n)=>e(t,...n),t.xor=(...t)=>{const e=[];return $(t,(t=>{$(tt(t),(t=>{e.includes(t)?e.splice(e.indexOf(t),1):e.push(t)}))})),e},t.zip=(...t)=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.zipObject=(t,e)=>{const n={};return $(t,((t,r)=>{n[t]=e[r]})),n},Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).$={})}(this,(function(t){"use strict";const e=Array.from,n=Reflect.apply,r=Object,s=r.keys,i=r.is,o=r.assign,c=r.getOwnPropertyDescriptor,u=r.defineProperty,a=r.getOwnPropertyNames,l=t=>s(t).length;function f(t){return void 0===t}function p(t){return null===t}function h(t){return!f(t)&&!p(t)}function g(t){return e=>!!h(e)&&e.constructor===t}const m=/\.|\+/,y=Array.isArray,d=g(String),b=g(Number),A=t=>!!h(t)&&"Object("===t.constructor.toString().trim().slice(9,16),w=t=>!!h(t)&&t instanceof Function,j=t=>Boolean(t.length),O=t=>e=>!!h(e)&&t.test(e),S=O(/\.css$/),v=O(/\.json$/),C=O(/\.js$/),M=O(/\.html$/),I=O(/\./),R=/\.([0-9a-z]+)/,k=t=>!!t&&t instanceof Promise,x=t=>!!t&&"AsyncFunction"===t.constructor?.name;const F=t=>y(t)&&t||h(t)&&[t]||[],E=t=>t.flat(1/0),U=t=>(t.length=0,t),N=Math,P=N.floor,T=N.random,B=(t,e=0)=>P(T()*(t-e))+e,L=(t,n=t.length)=>{if(t.length<=1)return e(t);const r=e(t);let s,i,o=0;for(;o=0;s--)e(t[s],s,t,r,n);return t}function K(t,e,n){const r=t.length;for(let s=0;s{!0===e(t,s,n,i,o,r)&&n.push(t)})),n}function W(t,e,n=[],r){return $(t,((t,s,i,o)=>{n[s]=e(t,s,n,i,o,r)})),n}function _(t,e,n=[],r){return $(t,((t,s,i,o)=>{const c=e(t,s,n,i,o,r);h(c)&&n.push(c)})),n}const J=(t,e,n=t.length)=>t.splice(e,n),V=(t,e)=>t.length===e.length&&K(t,((t,n)=>e[n]===t)),Z=Math.max,G=async(t,e)=>{const n=t.length;for(let r=0;r{const n=t.length;for(let r=n-1;r>=0;r--)await e(t[r],r,t,n);return t},Q=async(t,e)=>{const n=[];return await G(t,(async(t,r,s)=>{n[r]=await e(t,r,s)})),n},X=(t,e,n)=>n.indexOf(t)===e,Y=(t,e,n)=>t!==n[e-1],tt=(t,e)=>e?t.filter(Y):t.filter(X),et=(t,e)=>t-e,nt=(t,e)=>e-t,rt=(t,e,n)=>{const r=n?t:0,s=n?e:t,i=n||e;for(let t=r;t(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?-1:0:1:-1)),it=(t,e="id",n=!0)=>(n?t:[...t]).sort(((t,n)=>n[e]?t[e]?t[e]n[e]?1:0:-1:1)),ot=(t,e)=>W(e,(e=>t[e])),ct=(t,e,n,r,s)=>{if(t[s]===r)return!0},ut=(t,e)=>{$(s(t),((n,r,s,i)=>{e(t[n],n,t,i,s)}))},at=(t,e)=>K(s(t),((n,r,s,i)=>e(t[n],n,t,i,s))),lt=(t,e,n={})=>(ut(t,((t,r,s,i,o)=>{!0===e(t,r,n,s,i,o)&&(n[r]=t)})),n),ft=(t,e,n={})=>(ut(t,((t,r,s,i,o)=>{n[r]=e(t,r,n,s,i,o)})),n),pt=(t,e,n={})=>(ut(t,((t,r,s,i,o)=>{const c=e(t,r,n,s,i,o);h(c)&&(n[r]=c)})),n),ht=(t,e)=>t.forEach(e),gt=(t,e)=>(n,r,s)=>{let i;if(h(n))return i=y(n)?t:A(n)||w(n)?e:n.forEach?ht:e,i(n,r,s)},mt=gt(K,at),yt=gt($,ut),dt=gt(q,lt),bt=gt(W,ft),At=gt(_,pt),wt=mt,jt=(t,e)=>setTimeout(t,e),Ot=(t,e)=>setInterval(t,e),St=(t,e)=>()=>{rt(0,t((()=>{}),0),(t=>{e(t)}))},vt=St(jt,clearTimeout),Ct=St(Ot,clearInterval),Mt=(t,e)=>{const n=s(t);return K(e,(t=>n.includes(t)))},It=async(t,e)=>{const n=s(t);return await G(n,((r,s,i,o)=>e(t[r],r,t,o,n))),t},Rt=/[-_]/g,kt=/ (.)/g,xt=(t,e=1)=>t.substr(e),Ft=/%(?![\da-f]{2})/gi,Et=/&/g,Ut=//g,Pt=/"/g,Tt=t=>decodeURIComponent(t.replace(Ft,(()=>"%25"))),Bt=t=>t.replace(Et,"&").replace(Ut,"<").replace(Nt,">").replace(Pt,"""),Lt=/\S+/g,Dt=/\w+/g,$t=/ (.)/g,zt=t=>t[0].toUpperCase(),Kt=t=>zt(t)+xt(t).toLowerCase(),qt=Reflect.construct;function Wt(t,e=[],n){return n?qt(t,e,n):qt(t,e)}const _t=Object.create,Jt=(t,e,n=!1,r,i,o)=>{if(t){if(o){const s=o.pop();if(s){const r=e[s];t[s]=Jt(t[s],r,n)}else if(!i)return t;if(i){let s=r||0;if(s++,sglobalThis.structuredClone(t):t=>A(t)?Jt({},t):y(t)?Jt([],t):_t(t);const Zt=Function.prototype;const Gt=(t,e)=>{if(t===e)return!0;if(t.toString()===e.toString())if(A(t)){const n=s(t);if(Mt(e,n))return K(n,(n=>Gt(t[n],e[n])))}else if(y(t)&&t.length===e.length)return K(t,((t,n)=>Gt(t,e[n])));return!1},Ht=/\.|\[/,Qt=/]/g,Xt=t=>t.replace(Qt,"").split(Ht);let Yt=0;const te=[],ee={};function ne(){let t=te.shift(te);return h(t)||(t=Yt,ee[t]=!0,Yt++),t}ne.free=t=>{ee[t]=null,te.push(t)};const re=(t,e)=>{let n=e;return K(Xt(t),(t=>(n=n[t],h(n)))),n},se=JSON,ie=se.parse,oe=se.stringify;class ce{static models={};constructor(t,e){h(e)?(o(this,e),this.modelName=t,ce.models.set(t,e)):o(this,t)}}const ue=t=>(...e)=>n=>{let r=n;return t(e,(t=>{r=t(r)})),r},ae=ue($),le=ue(z),fe=t=>(...e)=>async n=>{let r=n;return await t(e,(async t=>{r=await t(r)})),r},pe=fe(G),he=fe(H);class ge{constructor(t={}){this.items=t}getItem(t){return this.items[t]}setItem(t,e){this.items[t]=e}clear(){this.items={}}removeItem(t){this.items[t]=null}}t.Model=ce,t.VirtualStorage=ge,t.add=(t,e)=>t+e,t.after=(t,e)=>{let n,r=t;return(...t)=>(null!==r&&r--,r<=0&&(n=e(...t),r=null),n)},t.apply=n,t.arrayToObject=(t,e)=>{const n={};return $(t,((t,r)=>{n[e[r]]=t})),n},t.ary=(t,e)=>(...n)=>t(...n.splice(0,e)),t.assign=o,t.assignDeep=Jt,t.asyncEach=async(t,e)=>{const n=t.length;for(let r=0;r{let n,r=t;return(...t)=>(null!==r&&r--,r>=1?n=e(...t):r=null,n)},t.bindAll=(t,e)=>bt(t,(t=>w(t)?t.bind(e):t)),t.cacheNativeMethod=function(t){return Zt.call.bind(t)},t.camelCase=t=>t.toLowerCase().replace(kt,(t=>t.toUpperCase().replace(/ /g,""))),t.chain=t=>{const e=t=>(e.value=t,e.methods);return o(e,{add:t=>((t,e)=>(yt(e,((e,n)=>{t.methods[n]=(...n)=>(e(t.value,...n),t.methods)})),t))(e,t),done(){const t=e.value;return e.value=null,t},methods:{}}),e.add(t),e},t.chunk=(t,e=1)=>{const n=[];let r=0;return t.forEach(((t,s)=>{s%e||(n.push([]),s&&r++),n[r].push(t)})),n},t.chunkString=(t,e)=>t.match(new RegExp(`(.|[\r\n]){1,${e}}`,"g")),t.clear=U,t.clearIntervals=Ct,t.clearTimers=vt,t.cloneArray=t=>t.slice(),t.compact=t=>t.filter((t=>!(d(t)&&!t.length)&&t)),t.compactKeys=t=>{const e=[];return ut(t,((t,n)=>{t&&e.push(n)})),e},t.compactMap=At,t.compactMapArray=_,t.compactMapAsync=async(t,e)=>{const n=[];let r;return await G(t,(async(t,s,i)=>{r=await e(t,s,n,i),h(r)&&n.push(r)})),n},t.compactMapObject=pt,t.compactMapObjectAsync=async(t,e,n={})=>(await It(t,(async(t,r,s,i,o)=>{const c=await e(t,r,n,i,o);h(c)&&(n[r]=c)})),n),t.construct=Wt,t.countBy=(t,e)=>{const n={};let r;return $(t,(t=>{r=e(t),n[r]||(n[r]=0),n[r]++})),n},t.countKey=(t,e)=>{let n=0;return $(t,(t=>{t[e]&&n++})),n},t.countWithoutKey=(t,e)=>{let n=0;return $(t,(t=>{t[e]||n++})),n},t.curry=(t,e=t.length)=>{const n=[],r=(...s)=>{if(n.push(...s),n.length===e){const e=t(...n);return U(n),e}return r};return r},t.curryRight=(t,e=t.length)=>{const n=[],r=(...s)=>{if(n.unshift(...s),n.length===e){const e=t(...n);return U(n),e}return r};return r},t.debounce=(t,e)=>{let n=!1;const r=(...r)=>{!1!==n&&clearTimeout(n),n=jt((()=>{t(...r),n=!1}),e)};return r.clear=()=>{n&&(clearTimeout(n),n=!1)},r},t.decimalCheck=m,t.deduct=t=>t-1,t.defineProperty=u,t.difference=(t,...e)=>{const n=E(e);return _(t,(t=>{if(!n.includes(t))return t}))},t.divide=(t,e)=>t/e,t.drop=J,t.dropRight=(t,e,n=t.length)=>J(t,0,n-e),t.each=yt,t.eachArray=$,t.eachArrayRight=z,t.eachAsync=G,t.eachAsyncRight=H,t.eachObject=ut,t.eachObjectAsync=It,t.eachWhile=mt,t.ensureArray=F,t.every=wt,t.filter=dt,t.filterArray=q,t.filterObject=lt,t.findIndex=(t,e,n="id")=>{const r=t.findIndex(((t,r)=>ct(t,0,0,e,n)));return-1!==r&&r},t.findItem=(t,e,n="id")=>{const r=t.find(((t,r)=>ct(t,0,0,e,n)));return-1!==r&&r},t.first=(t,e)=>e?t.slice(0,e):t[0],t.flatten=(t,e=1)=>{let n=t;for(let t=0;tt.concat(F(e))),[]);return n},t.flattenDeep=E,t.flow=ae,t.flowAsync=pe,t.flowAsyncRight=he,t.flowRight=le,t.get=re,t.getExtensionRegex=R,t.getFileExtension=t=>{const e=t.match(R);if(e)return e[1]},t.getNewest=(t,e)=>st(t,e,!1)[0],t.getOldest=(t,e="id")=>it(t,e)[0],t.getOwnPropertyDescriptor=c,t.getOwnPropertyNames=a,t.groupBy=(t,e)=>{const n={};return $(t,(t=>{const r=e(t);n[r]||(n[r]=[]),n[r].push(t)})),n},t.has=(t,...e)=>t.includes(...e),t.hasAnyKeys=(t,e)=>{const n=s(t);return Boolean(e.find((t=>n.includes(t))))},t.hasDot=I,t.hasKeys=Mt,t.hasLength=j,t.hasValue=h,t.htmlEntities=Bt,t.ifInvoke=(t,...e)=>{if(w(t))return t(...e)},t.ifNotEqual=(t,e,n)=>(e&&!h(t[e])&&(t[e]=n),t),t.inAsync=async(t,e)=>G(t,(async t=>{await t(e)})),t.inSync=(t,e)=>yt(t,(t=>{t(e)})),t.increment=t=>t+1,t.indexBy=(t,e="id")=>{const n={};return $(t,(t=>{n[t[e]]=t})),n},t.initial=t=>t.slice(0,t.length-1),t.initialString=(t,e=1)=>t.slice(0,-1*e),t.insertInRange=(t,e,n)=>t.slice(0,e)+n+t.slice(e,t.length),t.intersect=(t,...e)=>_(t,(t=>{if(K(e,(e=>e.includes(t))))return t})),t.interval=Ot,t.invert=(t,e={})=>(ut(t,((t,n)=>{e[t]=n})),e),t.invoke=(t,e,n)=>W(t,((t,r)=>t[e](n,r))),t.invokeAsync=(t,e,n)=>Q(t,(async(t,r)=>t[e](n,r))),t.is=i,t.isArguments=function(t){return!!h(t)&&"[object Arguments]"===t.toString()},t.isArray=y,t.isAsync=x,t.isBoolean=t=>"Boolean"===t.constructor.name,t.isBuffer=function(t){return!!h(t)&&"ArrayBuffer"===t.constructor?.name},t.isConstructor=g,t.isDate=t=>t instanceof Date,t.isDecimal=t=>m.test(t.toString()),t.isEmpty=t=>d(t)||y(t)?!j(t):A(t)?!l(t):!h(t),t.isEqual=Gt,t.isFileCSS=S,t.isFileHTML=M,t.isFileJS=C,t.isFileJSON=v,t.isFloat32=function(t){return!!h(t)&&"Float32Array"===t.constructor?.name},t.isFloat64=function(t){return!!h(t)&&"Float64Array"===t.constructor?.name},t.isFunction=w,t.isInt16=function(t){return!!h(t)&&"Int16Array"===t.constructor?.name},t.isInt32=function(t){return!!h(t)&&"Int32Array"===t.constructor?.name},t.isInt8=function(t){return!!h(t)&&"Int8Array"===t.constructor?.name},t.isKindAsync=t=>!!t&&(k(t)||x(t)),t.isMap=function(t){return!!h(t)&&"[object Map]"===t.toString()},t.isMatchArray=V,t.isMatchObject=(t,e)=>{const n=s(t);return!!V(n,s(e))&&K(n,(n=>t[n]===e[n]))},t.isNull=p,t.isNumber=b,t.isNumberEqual=(t,e)=>t===e,t.isNumberInRange=(t,e,n)=>t>e&&t{const e=typeof t;return null==t||"object"!==e&&"function"!==e},t.isPromise=k,t.isRegExp=t=>t instanceof RegExp,t.isSet=function(t){return!!h(t)&&"[object Set]"===t.toString()},t.isString=d,t.isUint16=function(t){return!!h(t)&&"Uint16Array"===t.constructor?.name},t.isUint32=function(t){return!!h(t)&&"Uint32Array"===t.constructor?.name},t.isUint8=function(t){return!!h(t)&&"Uint8Array"===t.constructor?.name},t.isUint8Clamped=function(t){return!!h(t)&&"Uint8ClampedArray"===t.constructor?.name},t.isUndefined=f,t.isWeakMap=function(t){return!!h(t)&&"[object WeakMap]"===t.toString()},t.isZero=t=>0===t,t.jsonParse=ie,t.kebabCase=t=>t.replace(Rt," ").trim().toLowerCase().replace(kt,"-$1"),t.keys=s,t.largest=t=>Z(...t),t.last=(t,e)=>{const n=t.length;return e?t.slice(n-e,n):t[n-1]},t.map=bt,t.mapArray=W,t.mapArrayRight=function(t,e,n=[],r){let s=0;const i=t.length;for(let o=i-1;o>=0;o--)n[s]=e(t[o],o,t,i,r),s++;return n},t.mapAsync=Q,t.mapObject=ft,t.mapObjectAsync=async(t,e,n={})=>(await It(t,(async(t,r,s,i,o)=>{n[r]=await e(t,r,n,s,i,o)})),n),t.mapWhile=function(t,e,n=[],r){const s=t.length;for(let i=0;it-e,t.model=function(t,e){return h(e)?Wt(ce,[t,e]):re(t,ce.models)},t.multiply=(t,e)=>t*e,t.negate=t=>(...e)=>!t(...e),t.noop=()=>{},t.nthArg=(t=0)=>(...e)=>e[t],t.numSort=t=>t.sort(et),t.numericalCompare=et,t.numericalCompareReverse=nt,t.objectCreate=_t,t.objectSize=l,t.omit=(t,e)=>lt(t,((t,n)=>!e.includes(n))),t.once=t=>{let e;return(...n)=>(h(e)||(e=t(...n)),e)},t.over=t=>(...e)=>bt(t,(t=>t(...e))),t.overEvery=t=>(...e)=>mt(t,(t=>t(...e))),t.partition=(t,e)=>{const n=[];return[_(t,(t=>{if(e(t))return t;n.push(t)})),n]},t.pick=(t,e,n={})=>($(e,(e=>{n[e]=t[e]})),n),t.pluck=(t,e)=>W(t,(t=>t[e])),t.pluckObject=ot,t.pluckValues=(t,e)=>W(t,(t=>ot(t,e))),t.promise=t=>new Promise(t),t.propertyMatch=(t,e,n=s(t))=>K(n,(n=>Gt(t[n],e[n]))),t.rNumSort=t=>t.sort(nt),t.randomArbitrary=(t,e=0)=>T()*(t-e)+e,t.randomInt=B,t.range=(t,e,n=1)=>t{const r=[];let s=t;for(;s{const r=n<0?-1*n:n,s=[];let i=t;for(;i>e;)s.push(i),i-=r;return s})(t,e,n),t.rawURLDecode=Tt,t.reArg=(t,e)=>(...n)=>t(...e.map((t=>n[t]))),t.regexGenerator=O,t.remainder=(t,e)=>t%e,t.remove=(t,e)=>{let n=t.length;for(let r=0;r{let n=t.length;for(let r=0;rt.replace(new RegExp(`\\b${e.join("|")}\\b`,"gi"),n),t.rest=t=>t.slice(1,t.length),t.restString=xt,t.right=(t,e)=>t[t.length-1-e],t.rightString=(t,e=1)=>t[t.length-e],t.sample=(t,e=1)=>{if(!t)return!1;const n=t.length;if(n===e||e>n)return L(t);if(1===e)return[t[B(n-1,0)]];const r=[],s={};let i,o=0;for(;oBt(Tt(t)),t.shuffle=L,t.smallest=t=>D(...t),t.snakeCase=t=>t.replace(Rt," ").trim().toLowerCase().replace(kt,"_$1"),t.sortAlphabetical=(t,e)=>t.sort(((t,n)=>{const r=t[e],s=n[e];return rs?1:0})),t.sortNewest=st,t.sortOldest=it,t.sortedIndex=(t,e)=>{let n=0;return K(t,((t,r)=>(n=r,e>t))),n},t.stringify=oe,t.stubArray=()=>[],t.stubFalse=()=>!1,t.stubObject=()=>({}),t.stubString=()=>"",t.stubTrue=()=>!0,t.sum=t=>t.reduce(((t,e)=>t+e),0),t.take=(t,e=1)=>t.slice(0,e),t.takeRight=(t,e=1)=>{const n=t.length;return t.slice(n-e,n)},t.throttle=(t,e)=>{let n,r=!1;const s=(...s)=>{r?n=!0:(t(...s),r=jt((()=>{n&&t(...s),r=!1}),e))};return s.clear=()=>{clearTimeout(r),r=!1},s},t.timer=jt,t.times=rt,t.timesMap=(t,e,n,r=[])=>{const s=n?t:0,i=n?e:t,o=n||e;let c;return rt(s,i,(t=>{c=o(t,s,i,r),h(c)&&r.push(c)})),r},t.toArray=e,t.toPath=Xt,t.toggle=(t,e=!0,n=!1)=>Gt(e,t)?n:e,t.tokenize=t=>t.match(Lt)||[],t.truncate=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),s=r.length;let i,o=n-e;for(;o=0&&(i=r[o]," "!==i);o--);return t.slice(0,o).trim()})(t,e,n):t},t.truncateRight=(t,e)=>{const n=t.length;return n>e?((t,e,n)=>{const r=t.split(""),s=r.length;let i,o=e;for(;o0&&(i=r[o]," "!==i);o++);return t.substr(o,n).trim()})(t,e,n):t},t.uid=ne,t.unZip=t=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.unZipObject=t=>{const e=[],n=[];return ut(t,((t,r)=>{e.push(r),n.push(t)})),[e,n]},t.union=(...t)=>tt(E(t)),t.unique=tt,t.upperCase=t=>t.replace(Rt," ").trim().toUpperCase(),t.upperFirst=t=>zt(t)+xt(t),t.upperFirstAll=t=>t.replace($t,(t=>t.toUpperCase())),t.upperFirstLetter=zt,t.upperFirstOnly=Kt,t.upperFirstOnlyAll=t=>Kt(t.toLowerCase()).replace($t,(t=>t.toUpperCase())),t.virtualStorage=function(){return new ge},t.whileArray=K,t.whileCompactMap=function(t,e,n=[],r){let s=0;for(;st.filter((t=>!e.includes(t))),t.words=t=>t.match(Dt)||[],t.wrap=(t,e)=>(...n)=>e(t,...n),t.xor=(...t)=>{const e=[];return $(t,(t=>{$(tt(t),(t=>{e.includes(t)?e.splice(e.indexOf(t),1):e.push(t)}))})),e},t.zip=(...t)=>t[0].map(((e,n)=>t.map((t=>t[n])))),t.zipObject=(t,e)=>{const n={};return $(t,((t,r)=>{n[t]=e[r]})),n},Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=index.js.map diff --git a/uwBridge/system/filesystem/client/resource/index.js b/uwBridge/system/filesystem/client/resource/index.js index 612d98d6..b11bb14f 100644 --- a/uwBridge/system/filesystem/client/resource/index.js +++ b/uwBridge/system/filesystem/client/resource/index.js @@ -4,80 +4,12 @@ module.exports = (app) => { eachArray, isString, hasDot, + isArray }, api, - config, - config: { - resourceDir, - }, - system: { - cache, - }, + serverCache } = app; const isValid = require('is-valid-path'); - const fs = require('fs'); - const { - join: pathJoin, - resolve, - normalize - } = require('path'); - const truncate = require('truncate-utf8-bytes'); - const cacheSet = cache.set; - const cacheGet = cache.get; - const defaultStreamSettings = { - autoClose: true, - encoding: 'utf-8', - }; - const sendChunks = (socket, response, cached, index) => { - eachArray(cached, async (item) => { - response.body = { - file: item, - key: index, - }; - socket.send(response); - }); - }; - const streamOnEnd = (socket, response, index, checksum, cached) => { - if (cached) { - sendChunks(socket, response, cached, index); - } - response.body = { - cs: checksum, - key: index, - }; - socket.send(response); - }; - const onEndCallback = (socket, response, index, filePath, cacheFile, checksumArg) => { - let cached; - let checksum; - if (cacheFile) { - if (cacheFile.item) { - if (config.debug) { - console.log('Loading cache file', filePath); - } - cached = cacheFile; - } else { - cached = cacheSet(filePath, cacheFile, checksumArg); - } - checksum = cached.checksum; - cached = cached.item; - } else { - checksum = cacheGet(filePath) - .checksum; - } - streamOnEnd(socket, response, index, checksum, cached); - }; - const createStream = (socket, response, filePath, index, checksum) => { - const readableStream = fs.createReadStream(filePath, defaultStreamSettings); - const cacheFile = []; - readableStream.setEncoding('utf8'); - readableStream.on('data', (chunk) => { - cacheFile.push(chunk); - }); - readableStream.on('end', () => { - onEndCallback(socket, response, index, filePath, cacheFile, checksum); - }); - }; const sendFalse = (socket, response, index) => { response.body = { file: false, @@ -85,53 +17,37 @@ module.exports = (app) => { }; socket.send(response); }; - const fsStat = (socket, response, filePath, index, err, stats) => { - if (err) { - sendFalse(socket, response, index); - } else { - createStream(socket, response, filePath, index, stats.ctime.toString()); - } - }; - const sendValidChecksum = async (socket, response, index) => { - response.body = { - cache: true, - key: index, - }; - socket.send(response); - }; - const illegalRe = /[?<>\\:*|":]/g; - const controlRe = /[\x00-\x1f\x80-\x9f]/g; - const reservedRe = /^\.+$/; - const windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i; - const normalizeFilePatch = (filepath) => { - return truncate(normalize(resolve(pathJoin(resourceDir, filepath))) - .replace(illegalRe, '') - .replace(controlRe, '') - .replace(reservedRe, '') - .replace(windowsReservedRe, ''), 255); - }; - const checkIfFileExists = (socket, response, item, index, checksums) => { - const filePath = normalizeFilePatch(item); - const cacheItem = cacheGet(filePath); - const cacheChecksum = cacheItem.checksum; - if (cacheChecksum) { - const checksum = checksums[index]; - // console.log(checksum, cacheChecksum, checksum === cacheChecksum, filePath); + const sendFile = (socket, response, filePath, key, checksum) => { + const cacheItem = serverCache.get(filePath); + console.log(filePath); + if (cacheItem) { + const cacheChecksum = cacheItem.checksum; if (checksum === cacheChecksum) { - sendValidChecksum(socket, response, index); + response.body = { + cache: true, + key, + }; } else { - onEndCallback(socket, response, index, filePath, cacheItem); + response.body = { + file: cacheItem.item, + cs: cacheItem.checksum, + key, + }; } } else { - if (config.debug) { - console.log('Loading fresh file', filePath); - } - fs.stat(filePath, (err, stats) => { - fsStat(socket, response, filePath, index, err, stats); - }); + response.body = { + file: false, + key, + }; } + socket.send(response); }; - const authRegex = /auth\//; + function processFile(socket, response, file, index, hasChecksums, cs) { + if (!isString(file) || !file.length || !hasDot(file) || !isValid(file)) { + return sendFalse(socket, response, index); + } + sendFile(socket, response, file, index, hasChecksums && cs[index]); + } const getFiles = (request) => { const { body, @@ -142,18 +58,9 @@ module.exports = (app) => { files, cs, } = body; - const loginStatus = socket.credit; + const hasChecksums = isArray(cs); eachArray(files, async (file, index) => { - if (authRegex.test(file)) { - if (!loginStatus || !socket.account || !socket.account.auth || !socket.account.auth.file.test(file)) { - console.log(`Auth Access ${file} ${socket.id}`); - return sendFalse(socket, response, index); - } - } - if (!isString(file) || !file.length || !hasDot(file) || !isValid(file)) { - return sendFalse(socket, response, index); - } - checkIfFileExists(socket, response, file, index, cs); + processFile(socket, response, file, index, hasChecksums, cs); }); }; api.extend({ diff --git a/uwBridge/system/filesystem/system/cache/assets/index.js b/uwBridge/system/filesystem/system/cache/assets/index.js new file mode 100644 index 00000000..164ccf62 --- /dev/null +++ b/uwBridge/system/filesystem/system/cache/assets/index.js @@ -0,0 +1,45 @@ +module.exports = async (uwApp) => { + const { + config: { + resourceDir + }, + utility: { + hasDot, + eachObject + }, + serverCache + } = uwApp; + const LiveDirectory = require('live-directory'); + const resourceFolder = `${resourceDir}`; + const websocketAssets = new LiveDirectory({ + path: resourceDir, + keep: { + extensions: ['.css', '.html', '.js', '.json'] + }, + ignore: (path) => { + if (hasDot(path) && path.includes('.eslintrc.js')) { + return true; + } + return path.startsWith('.'); + } + }); + await websocketAssets.ready(); + const assetUpdate = (file) => { + const filePath = file.path.replace(resourceFolder, ''); + const cached = serverCache.set(filePath, file.content); + uwApp.push({ + type: 'file', + path: assetUpdate, + cs: cached.checksum + }); + }; + websocketAssets.on('file_reload', (file) => { + assetUpdate(file); + }); + console.log(websocketAssets.files); + eachObject(websocketAssets.files, (file) => { + const filePath = file.path.replace(resourceFolder, ''); + const cached = serverCache.set(filePath, file.content); + console.log(filePath, cached.checksum); + }); +}; diff --git a/uwBridge/system/filesystem/system/cache/index.js b/uwBridge/system/filesystem/system/cache/index.js index 875ae41e..f34e6663 100644 --- a/uwBridge/system/filesystem/system/cache/index.js +++ b/uwBridge/system/filesystem/system/cache/index.js @@ -1,135 +1,36 @@ module.exports = async (uwApp) => { - const fs = require('fs'); - const cryptoRequire = require('crypto'); - const liveReload = require('./liveReload')(uwApp); const { - config, - system, - client, - watch, utility: { - isArray, - isString, - ifInvoke, - assign, - eachArray, - last, - } + VirtualStorage + }, } = uwApp; - const hashObject = {}; - const defaultStreamSettings = { - autoClose: true, - encoding: 'utf-8', - }; - const resourceDir = config.resourceDir; - const generateChecksum = (str) => { - return cryptoRequire.createHash('md5') - .update(str, 'utf8') - .digest('hex'); - }; - const cacheGet = (key) => { - return { - checksum: hashObject[`cs-${key}`], - item: hashObject[key], - }; - }; - const cacheSet = (key, dataArg, chunksumArg) => { - const fileName = last(key.split('/')); - if (fileName[0] === '.') { - return; - } - let chunksum = chunksumArg; - let dataAsString; - const data = dataArg; - if (isArray(data)) { - if (!chunksum) { - chunksum = generateChecksum(dataAsString); - } - } else if (isString(data)) { - if (!chunksum) { - chunksum = generateChecksum(data); + class ServerCache extends VirtualStorage { + checksum(contents) { + const contentsLength = contents.length; + let hash = 0; + if (contentsLength.length === 0) { + return hash; } - } else if (!chunksum) { - chunksum = generateChecksum(data.toString()); - } - if (hashObject[`cs-${key}`] === chunksum) { - return cacheGet(key); - } - hashObject[`cs-${key}`] = chunksum; - hashObject[key] = data; - return { - chunksum, - item: data, - }; - }; - const cache = (key, callbackOrData) => { - let data; - if (!key) { - data = hashObject; - } else if (callbackOrData) { - data = cacheSet(key, callbackOrData); - } else { - data = cacheGet(key, callbackOrData); - } - return data; - }; - const sendClientUpdate = (filepath) => { - if (client.cache) { - if (uwApp.debug) { - console.log('SEND NEW VERSION OF FILE'); + for (let i = 0; i < contentsLength; i++) { + const char = contents.charCodeAt(i); + hash = (hash ^ ((char + hash) << char)); } - ifInvoke(client.cache.update, filepath); - } - liveReload(filepath); - }; - const createStream = (filepath, cs, updateMode) => { - const readableStream = fs.createReadStream(filepath, defaultStreamSettings); - const cacheFile = []; - readableStream.setEncoding('utf8'); - readableStream.on('data', (item) => { - cacheFile.push(item); - }); - readableStream.on('end', () => { - // console.log('FILE READ COMPLETE LOAD INTO CACHE'); - cacheSet(filepath, cacheFile, cs); - if (updateMode) { - sendClientUpdate(filepath); - } - }); - }; - const checkIfFileExists = (filepath, updateMode) => { - if (filepath.includes('.DS_Store')) { - return; - } - if (filepath && filepath.includes(resourceDir)) { - // console.log('Resource Found'); - fs.stat(filepath, (err, stats) => { - if (err) { - console.log(err); - return; - } - if (uwApp.debug) { - console.log(stats.ctimeMs, filepath, '\nFile found create stream \n\n'); - } - createStream(filepath, stats.ctimeMs.toString(), updateMode); - }); - } - }; - watch(config.resourceDir, (filepath) => { - if (uwApp.debug) { - console.log(filepath); - } - checkIfFileExists(filepath, true); - }); - assign(cache, { - collection: hashObject, - get: cacheGet, - loadFile: checkIfFileExists, - set: cacheSet, - }); - const files = await require('./preLoadAssets')(uwApp); - eachArray(files, (item) => { - checkIfFileExists(item, false); - }); - system.cache = cache; + return hash; + } + set(cacheName, item, checksum) { + const computedChecksum = checksum || this.checksum(item); + const cacheObject = { + checksum: computedChecksum, + item + }; + this.setItem(cacheName, cacheObject); + return cacheObject; + } + get(cacheName) { + return this.getItem(cacheName); + } + } + const serverCache = new ServerCache(); + uwApp.serverCache = serverCache; + await require('./assets')(uwApp); }; diff --git a/uwBridge/system/filesystem/system/cache/liveReload/index.js b/uwBridge/system/filesystem/system/cache/liveReload/index.js deleted file mode 100644 index de65f179..00000000 --- a/uwBridge/system/filesystem/system/cache/liveReload/index.js +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = (uwApp) => { - const { - send, - config: { - resourceDir - } - } = uwApp; - const regexReplace = /\//g; - const assetUpdate = (filepath) => { - send({ - name: filepath.replace(resourceDir, ''), - type: filepath.replace(resourceDir, '') - .replace(regexReplace, '.'), - }); - }; - const liveReload = async (filepath) => { - if (filepath.includes(resourceDir)) { - assetUpdate(filepath); - } - }; - return liveReload; -}; diff --git a/uwBridge/system/filesystem/system/cache/preLoadAssets/index.js b/uwBridge/system/filesystem/system/cache/preLoadAssets/index.js deleted file mode 100644 index 6f21f2b7..00000000 --- a/uwBridge/system/filesystem/system/cache/preLoadAssets/index.js +++ /dev/null @@ -1,29 +0,0 @@ -module.exports = async (uwApp) => { - const { - config, - utility: { - promise, - initialString - } - } = uwApp; - const resourceDir = `${initialString(config.resourceDir)}`; - const walk = require('walk'); - const { - resolve - } = require('path'); - const files = []; - await promise((accept) => { - const walker = walk.walk(resourceDir, { - followLinks: false - }); - walker.on('file', (rootPath, stat, next) => { - files.push(resolve(rootPath, `/${stat.name}`)); - console.log(resolve(rootPath, `/${stat.name}`)); - return next(); - }); - walker.on('end', () => { - return accept(); - }); - }); - return files; -}; diff --git a/uwBridge/system/filesystem/system/index.js b/uwBridge/system/filesystem/system/index.js index aa346ce5..c1ad11cd 100644 --- a/uwBridge/system/filesystem/system/index.js +++ b/uwBridge/system/filesystem/system/index.js @@ -3,6 +3,4 @@ module.exports = async (app) => { console.log('cache loaded'); await require('./security')(app); console.log('security loaded'); - await require('./network')(app); - console.log('network loaded'); }; diff --git a/uwBridge/system/filesystem/system/network/http/index.js b/uwBridge/system/filesystem/system/network/http/index.js deleted file mode 100644 index a704f0cb..00000000 --- a/uwBridge/system/filesystem/system/network/http/index.js +++ /dev/null @@ -1,118 +0,0 @@ -module.exports = async (uwApp) => { - const express = uwApp.express; - const path = require('path'); - const fs = require('fs'); - const watch = require('node-watch'); - const compression = require('compression'); - const contentLength = require('express-content-length-validator'); - const toobusy = require('express-toobusy'); - const rateLimit = require('express-rate-limit'); - const { - shallowRequire, - config, - utility: { - mapObject, - eachAsync - } - } = uwApp; - let indexFileCached; - const indexLocation = config.http.indexLocation; - const indexPage = function(req, res) { - if (indexFileCached) { - res.send(indexFileCached); - } else { - res.sendFile(indexLocation); - } - }; - // const serverApp = uwApp.virtualApp = express(); - // Server configuration methods used to apply settings to express - const configureServerMethods = {}; - const buildRoutes = () => { - mapObject(config.http.routes.get, (item) => { - const callback = item.callback || indexPage; - uwApp.serverApp.get(item.route, callback); - }); - }; - const setupHTTP = () => { - /* - DDOS + Flooding + Overall CPU lag - for various types of protection. - */ - /* - CPU lag time - */ - if (config.http.maxLagTime) { - uwApp.serverApp.use(toobusy(config.http.maxLagTime)); - } - /* - Rate Limit Function - */ - if (config.http.rateLimt) { - uwApp.serverApp.use(rateLimit(config.http.rateLimt)); - } - /* - Security Plugins must be of higher order - if issues arise kill request before processing. - */ - mapObject(config.http.plugins, (item, key) => { - if (item) { - const funct = configureServerMethods[key]; - if (funct) { - uwApp.serverApp.use(funct); - } - } - }); - /* - Max size accepted for the content-length - */ - if (config.http.maxContentLength) { - uwApp.serverApp.use(contentLength.validateMax({ - max: config.http.maxContentLength, - message: 'Service is Busy', - status: 200, - })); - } - /* - Compression functions - Minify JS - Gzip - { - threshold: 0 - } - */ - uwApp.serverApp.use(compression({ - threshold: 0 - })); - // remove headers security fix - uwApp.serverApp.disable('x-powered-by'); - // Setup Routing - buildRoutes(); - // set static folder - uwApp.serverApp.use(express.static(path.join(config.siteDir, 'public'), { - dotfiles: 'allow' - })); - }; - const updateIndexCache = () => { - fs.readFile(indexLocation, { - encoding: 'utf8' - }, (err, data) => { - if (err) { - return console.log(err); - } - indexFileCached = data; - }); - }; - if (indexLocation) { - updateIndexCache(); - watch(indexLocation.replace('index.html', ''), (evt, filename) => { - if (evt === 'update' && filename === indexLocation) { - updateIndexCache(); - } - }); - } - const items = await shallowRequire(`${__dirname}/plugin`); - await eachAsync(items, async (item) => { - await item(uwApp, configureServerMethods); - }); - setupHTTP(); -}; diff --git a/uwBridge/system/filesystem/system/network/http/plugin/allowHeaderContentType/index.js b/uwBridge/system/filesystem/system/network/http/plugin/allowHeaderContentType/index.js deleted file mode 100644 index 79d957bb..00000000 --- a/uwBridge/system/filesystem/system/network/http/plugin/allowHeaderContentType/index.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = async (app, extend) => { - const allowHeaderContentType = (req, res, next) => { - res.header('Access-Control-Allow-Headers', 'Content-Type'); - next(); - }; - extend.allowHeaderContentType = allowHeaderContentType; -}; diff --git a/uwBridge/system/filesystem/system/network/http/plugin/allowedCORSDomains/index.js b/uwBridge/system/filesystem/system/network/http/plugin/allowedCORSDomains/index.js deleted file mode 100644 index f7ee7b2b..00000000 --- a/uwBridge/system/filesystem/system/network/http/plugin/allowedCORSDomains/index.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = async (uwApp, extend) => { - const { - config, - } = uwApp; - const allowedCORSDomainsCache = config.http.plugins.allowedCORSDomains; - const allowedCORSDomains = (req, res, next) => { - res.header('Access-Control-Allow-Origin', allowedCORSDomainsCache); - next(); - }; - extend.allowedCORSDomains = allowedCORSDomains; -}; diff --git a/uwBridge/system/filesystem/system/network/http/plugin/allowedDomains/index.js b/uwBridge/system/filesystem/system/network/http/plugin/allowedDomains/index.js deleted file mode 100644 index 7a71ff3a..00000000 --- a/uwBridge/system/filesystem/system/network/http/plugin/allowedDomains/index.js +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = async (uwApp, extend) => { - const { - config, - utility: { - has - } - } = uwApp; - const allowedDomainsCache = config.http.plugins.allowedDomains; - const allowedDomains = (req, res, next) => { - if (has(allowedDomainsCache, req.headers.host)) { - return next(); - } else { - console.log(req.headers.host, allowedDomainsCache); - res.sendStatus(403); - } - }; - extend.allowedDomains = allowedDomains; -}; diff --git a/uwBridge/system/filesystem/system/network/http/plugin/allowedRequestTypes/index.js b/uwBridge/system/filesystem/system/network/http/plugin/allowedRequestTypes/index.js deleted file mode 100644 index d96e5101..00000000 --- a/uwBridge/system/filesystem/system/network/http/plugin/allowedRequestTypes/index.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = async (uwApp, extend) => { - const { - config, - } = uwApp; - const allowedRequestTypesCache = config.http.plugins.allowedRequestTypes; - const allowedRequestTypes = (req, res, next) => { - res.header('Access-Control-Allow-Methods', allowedRequestTypesCache); - next(); - }; - extend.allowedRequestTypes = allowedRequestTypes; -}; diff --git a/uwBridge/system/filesystem/system/network/http/plugin/contentSecurityPolicy/index.js b/uwBridge/system/filesystem/system/network/http/plugin/contentSecurityPolicy/index.js deleted file mode 100644 index 69d4e00a..00000000 --- a/uwBridge/system/filesystem/system/network/http/plugin/contentSecurityPolicy/index.js +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = async (uwApp, extend) => { - const { - config, - utility: { - isFunction - } - } = uwApp; - const contentSecurityPolicyCache = config.http.plugins.contentSecurityPolicy; - const isFunct = isFunction(contentSecurityPolicyCache); - const contentSecurityPolicy = (req, res, next) => { - const host = req.headers.host; - if (isFunct) { - res.header('content-security-policy', contentSecurityPolicyCache({ - host - })); - } else { - res.header('content-security-policy', req.headers.host); - } - return next(); - }; - extend.contentSecurityPolicy = contentSecurityPolicy; -}; diff --git a/uwBridge/system/filesystem/system/network/http/plugin/denyFrame/index.js b/uwBridge/system/filesystem/system/network/http/plugin/denyFrame/index.js deleted file mode 100644 index f0c50e1b..00000000 --- a/uwBridge/system/filesystem/system/network/http/plugin/denyFrame/index.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = async (uwApp, extend) => { - const sameOrigin = (req, res, next) => { - res.header('x-frame-options', 'SAMEORIGIN'); - return next(); - }; - extend.sameOrigin = sameOrigin; -}; diff --git a/uwBridge/system/filesystem/system/network/http/plugin/noSniff/index.js b/uwBridge/system/filesystem/system/network/http/plugin/noSniff/index.js deleted file mode 100644 index 7fd87e5b..00000000 --- a/uwBridge/system/filesystem/system/network/http/plugin/noSniff/index.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = async (uwApp, extend) => { - const noSniff = (req, res, next) => { - res.header('x-content-type-options', 'nosniff'); - return next(); - }; - extend.noSniff = noSniff; -}; diff --git a/uwBridge/system/filesystem/system/network/http/plugin/sameOrigin/index.js b/uwBridge/system/filesystem/system/network/http/plugin/sameOrigin/index.js deleted file mode 100644 index 907d373f..00000000 --- a/uwBridge/system/filesystem/system/network/http/plugin/sameOrigin/index.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = async (uwApp, extend) => { - const denyFrame = (req, res, next) => { - res.header('x-frame-options', 'DENY'); - return next(); - }; - extend.denyFrame = denyFrame; -}; diff --git a/uwBridge/system/filesystem/system/network/http/plugin/xssProtection/index.js b/uwBridge/system/filesystem/system/network/http/plugin/xssProtection/index.js deleted file mode 100644 index 87087646..00000000 --- a/uwBridge/system/filesystem/system/network/http/plugin/xssProtection/index.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = async (uwApp, extend) => { - const xssProtection = (req, res, next) => { - res.header('x-xss-protection', '1; mode=block'); - return next(); - }; - extend.xssProtection = xssProtection; -}; diff --git a/uwBridge/system/filesystem/system/network/index.js b/uwBridge/system/filesystem/system/network/index.js deleted file mode 100644 index 8aaa523a..00000000 --- a/uwBridge/system/filesystem/system/network/index.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = async (app) => { -/* A way to create a new object in the `app.system` object. */ - // app.system.network = {}; - // console.log('Network started'); - // await require('./http')(app); - // return console.log('HTTP Online'); -};