From 3b8127e21e03f32238e1935f9e18a5dd2854bfec Mon Sep 17 00:00:00 2001 From: Taromati2 Date: Sat, 12 Aug 2023 02:52:32 +0000 Subject: [PATCH] file update~ --- dist/cn/jsstp.d.ts | 164 +++++++++++++++++++++++++-------------------- dist/en/jsstp.d.ts | 163 ++++++++++++++++++++++++-------------------- dist/jp/jsstp.d.ts | 163 ++++++++++++++++++++++++-------------------- dist/jsstp.cjs | 2 +- dist/jsstp.min.js | 2 +- dist/jsstp.mjs | 2 +- 6 files changed, 276 insertions(+), 220 deletions(-) diff --git a/dist/cn/jsstp.d.ts b/dist/cn/jsstp.d.ts index 6886e6f..edfdb68 100644 --- a/dist/cn/jsstp.d.ts +++ b/dist/cn/jsstp.d.ts @@ -1,19 +1,19 @@ /** * 拓展object,提供一些简单且遍历的操作 */ -declare class info_object { +declare class info_object { /** * @description 获取所有key的数组 */ - /*@__PURE__*/get keys(): PropertyKey[]; + /*@__PURE__*/get keys(): key_T[]; /** * @description 获取所有value的数组 */ - /*@__PURE__*/get values(): any[]; + /*@__PURE__*/get values(): value_T[]; /** * @description 获取所有key-value对的数组 */ - /*@__PURE__*/get entries(): [PropertyKey, any][]; + /*@__PURE__*/get entries(): [key_T, value_T][]; /** * @description 获取成员数量 */ @@ -22,27 +22,27 @@ declare class info_object { * @description 对每个key-value对执行某个函数 * @param {(value,key?)} func 要执行的函数,若返回值不为undefined,则会替换原value */ - /*@__PURE__*/forEach(func: (value: any, key?: PropertyKey) => any|undefined): void; + /*@__PURE__*/forEach(func: (value: value_T, key?: key_T) => value_T|undefined): void; /** * @description 复制一个新的对象 * @returns {info_object} 复制的对象 */ - /*@__PURE__*/get trivial_clone(): info_object; + /*@__PURE__*/get trivial_clone(): info_object; /** * @description 遍历自身和子对象并返回一个由遍历结果构成的一维数组 * @param {(dimensions[...],value):any} func 要执行的函数,返回值将被添加到数组中 */ - /*@__PURE__*/flat_map(func: (...dimensions_with_value_in_last: [...PropertyKey[],any]) => T): T[]; + /*@__PURE__*/flat_map(func: (...dimensions_with_value_in_last: [...key_T[],value_T]) => T): T[]; /** * @description 遍历自身并返回一个由遍历结果构成的一维数组 * @param {(value,key?):any} func 要执行的函数,返回值将被添加到数组中 */ - /*@__PURE__*/map(func: (value: any, key?: PropertyKey) => T): T[]; + /*@__PURE__*/map(func: (value: value_T, key?: key_T) => T): T[]; /** * @description 对自身按照数组追加元素 - * @param {[undefined|[PropertyKey,any]]} array 要追加的数组 + * @param {[undefined|[key_T,value_T]]} array 要追加的数组 */ - /*@__PURE__*/push(array: [undefined|[PropertyKey, any]]): void; + /*@__PURE__*/push(array: [undefined|[key_T, value_T]]): void; } /** @@ -53,7 +53,7 @@ declare class info_object { * console.log(info.Option);//notranslate * @alias jsstp.base_sstp_info_t */ -declare class base_sstp_info_t extends info_object { +declare class base_sstp_info_t extends info_object { /** * 自拆分好的字符串报文或对象报文构造sstp_info_t,不建议直接使用 * @param {String} info_head 报文头 @@ -110,7 +110,7 @@ declare class base_sstp_info_t extends info_object { * console.log(info.Option);//notranslate * @alias jsstp.sstp_info_t */ -declare class sstp_info_t extends base_sstp_info_t { +declare class sstp_info_t extends base_sstp_info_t { /** * 自拆分好的字符串报文或对象报文构造sstp_info_t,不建议直接使用 * @param {String} info_head 报文头 @@ -147,45 +147,73 @@ declare class sstp_info_t extends base_sstp_info_t { /*@__PURE__*/get raw(): sstp_info_t; /** - * @description 获取所有key的数组 + * 其他报文成员 + * @type {String|undefined} */ - /*@__PURE__*/get keys(): string[]; + [key: string]: String | undefined; +} + +/** + * fmo报文类:单个fmo信息类 + * @see {@link http://ssp.shillest.net/ukadoc/manual/spec_fmo_mutex.html} + */ +declare class single_fmo_info_t extends base_sstp_info_t { /** - * @description 获取所有value的数组 + * @description 正在运行的基础软件根文件夹的完整路径 + * @example E:\ssp\ */ - /*@__PURE__*/get values(): String[]; + path: string; /** - * @description 获取所有key-value对的数组 + * @description 主窗口的窗口句柄 + * @example 918820 */ - /*@__PURE__*/get entries(): [string, String][]; + hwnd: string; /** - * @description 对每个key-value对执行某个函数 - * @param {(value,key?)} func 要执行的函数,若返回值不为undefined,则会替换原value + * @description descript.txt的sakura.name + * @example 橘花 */ - /*@__PURE__*/forEach(func: (value: String, key?: string) => String|undefined): void; + name: string; /** - * @description 遍历自身和子对象并返回一个由遍历结果构成的一维数组 - * @param {(dimensions[...],value):any} func 要执行的函数,返回值将被添加到数组中 + * @description descript.txt的kero.name + * @example 斗和 */ - /*@__PURE__*/flat_map(func: (...dimensions_with_value_in_last: [...string[],String]) => T): T[]; + keroname: string; /** - * @description 遍历自身并返回一个由遍历结果构成的一维数组 - * @param {(value,key?):any} func 要执行的函数,返回值将被添加到数组中 + * @description \0侧当前显示的surface ID + * @example 0 */ - /*@__PURE__*/map(func: (value: String, key?: string) => T): T[]; + "sakura.surface": string; /** - * @description 对自身按照数组追加元素 - * @param {[undefined|[String,any]]} array 要追加的数组 + * @description \1侧当前显示的surface ID + * @example 10 */ - /*@__PURE__*/push(array: [undefined|[string, String]]): void; - + "kero.surface": string; /** - * 其他报文成员 - * @type {String|undefined} + * @description \1侧窗口的窗口句柄 + * @example 67008 */ - [key: string]: String | undefined; + kerohwnd: string; + /** + * @description 当前使用的窗口句柄的逗号分隔列表 + * @example 918820,67008 + */ + hwndlist: string; + /** + * @description 正在运行的ghost的完整路径 + * @example E:\ssp\ghost\Taromati2\ + */ + ghostpath: string; + /** + * @description 正在运行的ghost的descript.txt的name + * @example Taromati2 + */ + fullname: string; + /** + * @description 正在运行的ghost的模块状态 + * @example shiori:running,makoto-ghost:running + */ + modulestate: string; } - /** * fmo报文类 * @example @@ -197,7 +225,7 @@ declare class sstp_info_t extends base_sstp_info_t { * @see {@link jsstp_t.get_fmo_infos} * @see {@link http://ssp.shillest.net/ukadoc/manual/spec_fmo_mutex.html} */ -declare class fmo_info_t extends base_sstp_info_t { +declare class fmo_info_t extends base_sstp_info_t { /** * 自字符串构造fmo_info_t,不建议直接使用 * @param {String} fmo_text @@ -244,45 +272,11 @@ declare class fmo_info_t extends base_sstp_info_t { * @ignore */ /*@__PURE__*/toJSON(): Object; - - /** - * @description 获取所有key的数组 - */ - /*@__PURE__*/get keys(): string[]; - /** - * @description 获取所有value的数组 - */ - /*@__PURE__*/get values(): base_sstp_info_t[]; - /** - * @description 获取所有key-value对的数组 - */ - /*@__PURE__*/get entries(): [string, base_sstp_info_t][]; - /** - * @description 对每个key-value对执行某个函数 - * @param {(value,key?)} func 要执行的函数,若返回值不为undefined,则会替换原value - */ - /*@__PURE__*/forEach(func: (value: base_sstp_info_t, key?: string) => base_sstp_info_t|undefined): void; - /** - * @description 遍历自身和子对象并返回一个由遍历结果构成的一维数组 - * @param {(dimensions[...],value):any} func 要执行的函数,返回值将被添加到数组中 - */ - /*@__PURE__*/flat_map(func: (...dimensions_with_value_in_last: [...string[],base_sstp_info_t]) => T): T[]; - /** - * @description 遍历自身并返回一个由遍历结果构成的一维数组 - * @param {(value,key?):any} func 要执行的函数,返回值将被添加到数组中 - */ - /*@__PURE__*/map(func: (value: base_sstp_info_t, key?: string) => T): T[]; - /** - * @description 对自身按照数组追加元素 - * @param {[undefined|[String,any]]} array 要追加的数组 - */ - /*@__PURE__*/push(array: [undefined|[string, base_sstp_info_t]]): void; - /** * fmo成员 - * @type {base_sstp_info_t|undefined} + * @type {single_fmo_info_t|undefined} */ - [uuid: string]: base_sstp_info_t|undefined; + [uuid: string]: single_fmo_info_t|undefined; } /** @@ -337,6 +331,9 @@ interface common_event_caller extends base_event_caller{ [key: string]: common_event_caller,//扩展事件名称 } +interface jsstp_with_ghost_info_t extends jsstp_t{ + ghost_info: single_fmo_info_t +} /** * jsstp对象 * @see {@link jsstp} @@ -447,6 +444,27 @@ declare class jsstp_t{ */ set sendername(sender_name: String); /*@__PURE__*/get sendername(): String; + + /** + * 复制一个新的jsstp对象 + * @group Clone Methods + */ + get clone(): jsstp_t; + + /** + * 复制一个新的jsstp对象对于给定的fmo_info + * @param fmo_info 目标ghost的fmo_info + * @returns {jsstp_t} 新的指向目标ghost的jsstp对象 + * @group Clone Methods + */ + by_fmo_info(fmo_info: single_fmo_info_t): jsstp_with_ghost_info_t; + + /** + * 对于所有ghost进行操作 + * @param {Function|undefined} operation 操作函数 + */ + for_all_ghosts(operation?: (jsstp: jsstp_with_ghost_info_t) => result_T): Promise>; + /** * 以文本发送报文并以文本接收返信 * @param {any} info 报文体(文本) @@ -734,7 +752,7 @@ type ghost_events_queryer_t_call_signature = { * @returns {Promise} * @example * let result = await ghost_events_queryer("On_connect"); - * @see 基于 {@link ghost_events_queryer_t.check_event} + * @see 基于 {@link ghost_events_queryer_t_class_impl.check_event} */ /*@__PURE__*/(event_name: String, security_level?: String): Promise; } diff --git a/dist/en/jsstp.d.ts b/dist/en/jsstp.d.ts index 54e1ca0..891c190 100644 --- a/dist/en/jsstp.d.ts +++ b/dist/en/jsstp.d.ts @@ -1,19 +1,19 @@ /** * Extend object to provide some simple and iterative operations. */ -declare class info_object { +declare class info_object { /** * @description Get an array of all keys */ - /*@__PURE__*/get keys(): PropertyKey[]; + /*@__PURE__*/get keys(): key_T[]; /** * @description Get an array of all values */ - /*@__PURE__*/get values(): any[]; + /*@__PURE__*/get values(): value_T[]; /** * @description Get an array of all key-value pairs. */ - /*@__PURE__*/get entries(): [PropertyKey, any][]; + /*@__PURE__*/get entries(): [key_T, value_T][]; /** * @description Get the number of members */ @@ -22,27 +22,27 @@ declare class info_object { * @description Execute a function for each key-value pair. * @param {(value,key?)} func A function to be executed that replaces value if the return value is not undefined. */ - /*@__PURE__*/forEach(func: (value: any, key?: PropertyKey) => any|undefined): void; + /*@__PURE__*/forEach(func: (value: value_T, key?: key_T) => value_T|undefined): void; /** * @description Copy a new object * @returns {info_object} Copied object */ - /*@__PURE__*/get trivial_clone(): info_object; + /*@__PURE__*/get trivial_clone(): info_object; /** * @description Traverses itself and its children and returns a one-dimensional array of traversal results. * @param {(dimensions[...] ,value):any} func Function to execute, the return value will be added to the array. */ - /*@__PURE__*/flat_map(func: (...dimensions_with_value_in_last: [...PropertyKey[],any]) => T): T[]; + /*@__PURE__*/flat_map(func: (...dimensions_with_value_in_last: [...key_T[],value_T]) => T): T[]; /** * @description Traverses itself and returns a one-dimensional array of traversal results. * @param {(value,key?):any} func Function to execute, the return value will be added to the array. */ - /*@__PURE__*/map(func: (value: any, key?: PropertyKey) => T): T[]; + /*@__PURE__*/map(func: (value: value_T, key?: key_T) => T): T[]; /** * @description Append elements to itself as an array. - * @param {[undefined|[PropertyKey,any]]} array Array to append to.s + * @param {[undefined|[key_T,value_T]]} array Array to append to. */ - /*@__PURE__*/push(array: [undefined|[PropertyKey, any]]): void; + /*@__PURE__*/push(array: [undefined|[key_T, value_T]]): void; } /** @@ -53,7 +53,7 @@ declare class info_object { * console.log(info.Option);//notranslate * @alias jsstp.base_sstp_info_t */ -declare class base_sstp_info_t extends info_object { +declare class base_sstp_info_t extends info_object { /** * Constructing sstp_info_t from split string or object messages, is not recommended. * @param {String} info_head The header of the message. @@ -110,7 +110,7 @@ declare class base_sstp_info_t extends info_object { * console.log(info.Option);//notranslate * @alias jsstp.sstp_info_t */ -declare class sstp_info_t extends base_sstp_info_t { +declare class sstp_info_t extends base_sstp_info_t { /** * Construct sstp_info_t from split string or object messages, not recommended to use directly * @param {String} info_head The header of the message. @@ -147,45 +147,73 @@ declare class sstp_info_t extends base_sstp_info_t { /*@__PURE__*/get raw(): sstp_info_t; /** - * @description Get an array of all keys + * Other message members + * @type {String|undefined} */ - /*@__PURE__*/ get keys(): string[]; + [key: string]: String | undefined; +} + +/** + * fmo message class: single fmo message class + * @see {@link http://ssp.shillest.net/ukadoc/manual/spec_fmo_mutex.html} + */ +declare class single_fmo_info_t extends base_sstp_info_t { /** - * @description Get an array of all values. + * @description Full path to the root folder of the running base software + * @example E:\ssp\ */ - /*@__PURE__*/ get values(): String[]; + path: string; /** - * @description Get an array of all key-value pairs. + * @description Window handle of the main window + * @example 918820 */ - /*@__PURE__*/get entries(): [string, String][]; + hwnd: string; /** - * @description Execute some function on each key-value pair. - * @param {(value,key?)} func The function to execute, replacing the original value if the return value is not undefined. + * @description descript.txt's sakura.name + * @example 橘花 */ - /*@__PURE__*/forEach(func: (value: String, key?: string) => String|undefined): void; + name: string; /** - * @description Iterates over itself and its children and returns a one-dimensional array of the results of the iteration. - * @param {(dimensions[...] ,value):any} func Function to be executed, the return value will be added to the array + * @description descript.txt's kero.name + * @example 斗和 */ - /*@__PURE__*/flat_map(func: (...dimensions_with_value_in_last: [...string[],String]) => T): T[]; + keroname: string; /** - * @description Traverses itself and returns a one-dimensional array consisting of the results of the traversal. - * @param {(value,key?):any} func The function to be executed, the return value will be added to the array + * @description Surface ID currently displayed on side \0 + * @example 0 */ - /*@__PURE__*/map(func: (value: String, key?: string) => T): T[]; + "sakura.surface": string; /** - * @description Append elements to itself according to array - * @param {[undefined|[String,any]]} array Array to append to. + * @description Surface ID currently displayed on the \1 side + * @example 10 */ - /*@__PURE__*/push(array: [undefined|[string, String]]): void; - + "kero.surface": string; /** - * Other message members - * @type {String|undefined} + * @description Window handle of the \1 side window + * @example 67008 */ - [key: string]: String | undefined; + kerohwnd: string; + /** + * @description Comma-separated list of currently used window handles + * @example 918820,67008 + */ + hwndlist: string; + /** + * @description Full path to the running ghost + * @example E:\ssp\ghost\Taromati2\ + */ + ghostpath: string; + /** + * @description Name in the running ghost's descript.txt + * @example Taromati2 + */ + fullname: string; + /** + * @description Module status of the running ghost + * @example shiori:running,makoto-ghost:running + */ + modulestate: string; } - /** * fmo message class * @example @@ -197,7 +225,7 @@ declare class sstp_info_t extends base_sstp_info_t { * @see {@link jsstp_t.get_fmo_infos} * @see {@link http://ssp.shillest.net/ukadoc/manual/spec_fmo_mutex.html} */ -declare class fmo_info_t extends base_sstp_info_t { +declare class fmo_info_t extends base_sstp_info_t { /** * Construct fmo_info_t from a string, not recommended for direct use * @param {String} fmo_text @@ -245,44 +273,11 @@ declare class fmo_info_t extends base_sstp_info_t { */ /*@__PURE__*/toJSON(): Object; - /** - * @description Get an array of all keys - */ - /*@__PURE__*/get keys(): string[]; - /** - * @description Get an array of all values - */ - /*@__PURE__*/get values(): base_sstp_info_t[]; - /** - * @description Get an array of all key-value pairs. - */ - /*@__PURE__*/get entries(): [string, base_sstp_info_t][]; - /** - * @description Execute a function for each key-value pair. - * @param {(value,key?)} func A function to be executed that replaces value if the return value is not undefined. - */ - /*@__PURE__*/forEach(func: (value: base_sstp_info_t, key?: string) => base_sstp_info_t|undefined): void; - /** - * @description Traverses itself and its children and returns a one-dimensional array of traversal results. - * @param {(dimensions[...] ,value):any} func Function to execute, the return value will be added to the array. - */ - /*@__PURE__*/flat_map(func: (...dimensions_with_value_in_last: [...string[],base_sstp_info_t]) => T): T[]; - /** - * @description Traverses itself and returns a one-dimensional array of traversal results. - * @param {(value,key?):any} func Function to execute, the return value will be added to the array. - */ - /*@__PURE__*/map(func: (value: base_sstp_info_t, key?: string) => T): T[]; - /** - * @description Append an array to itself. - * @param {[undefined|[String,any]]} array The array to append. - */ - /*@__PURE__*/push(array: [undefined|[string, base_sstp_info_t]]): void; - /** * fmo members - * @type {base_sstp_info_t|undefined} + * @type {single_fmo_info_t|undefined} */ - [uuid: string]: base_sstp_info_t|undefined; + [uuid: string]: single_fmo_info_t|undefined; } /** @@ -337,6 +332,9 @@ interface common_event_caller extends base_event_caller{ [key: string]: common_event_caller,//扩展事件名称 } +interface jsstp_with_ghost_info_t extends jsstp_t{ + ghost_info: single_fmo_info_t +} /** * jsstp object * @see {@link jsstp} @@ -447,6 +445,27 @@ declare class jsstp_t{ */ set sendername(sender_name: String); /*@__PURE__*/get sendername(): String; + + /** + * Copy a new jsstp object + * @group Clone Methods + */ + get clone(): jsstp_t; + + /** + * Copy a new jsstp object for the given fmo_info + * @param fmo_info fmo_info of target ghost + * @returns {jsstp_t} New jsstp object pointing to target ghost + * @group Clone Methods + */ + by_fmo_info(fmo_info: single_fmo_info_t): jsstp_with_ghost_info_t; + + /** + * For all ghost operations + * @param {Function|undefined} operation operator function + */ + for_all_ghosts(operation?: (jsstp: jsstp_with_ghost_info_t) => result_T): Promise>; + /** * Sends a message in text and receives it back in text * @param {any} info Message body (text) @@ -734,7 +753,7 @@ type ghost_events_queryer_t_call_signature = { * @returns {Promise} * @example * let result = await ghost_events_queryer("On_connect"); - * @see based on {@link ghost_events_queryer_t.check_event} + * @see based on {@link ghost_events_queryer_t_class_impl.check_event} */ /*@__PURE__*/(event_name: String, security_level?: String): Promise; } diff --git a/dist/jp/jsstp.d.ts b/dist/jp/jsstp.d.ts index f5602c7..89a6d83 100644 --- a/dist/jp/jsstp.d.ts +++ b/dist/jp/jsstp.d.ts @@ -1,19 +1,19 @@ /** * オブジェクトを拡張して、いくつかの簡単な反復操作を提供する。 */ -declare class info_object { +declare class info_object { /** * @description すべてのキーの配列を取得する */ - /*@__PURE__*/get keys(): PropertyKey[]; + /*@__PURE__*/get keys(): key_T[]; /** * @description すべての値の配列を取得する */ - /*@__PURE__*/get values(): any[]; + /*@__PURE__*/get values(): value_T[]; /** * @description すべてのキーと値のペアの配列を取得します。 */ - /*@__PURE__*/get entries(): [PropertyKey, any][]; + /*@__PURE__*/get entries(): [key_T, value_T][]; /** * @description 会員数の取得 */ @@ -22,27 +22,27 @@ declare class info_object { * @description キーと値のペアごとに関数を実行する。 * @param {(value,key?)} func 戻り値が未定義でない場合に、元の値を置き換えるために実行される関数。 */ - /*@__PURE__*/forEach(func: (value: any, key?: PropertyKey) => any|undefined): void; + /*@__PURE__*/forEach(func: (value: value_T, key?: key_T) => value_T|undefined): void; /** * @description 新しいオブジェクトをコピーします。 * @returns {info_object} コピーされたオブジェクト */ - /*@__PURE__*/get trivial_clone(): info_object; + /*@__PURE__*/get trivial_clone(): info_object; /** * @description 自分自身とその子をトラバースし、トラバース結果の1次元配列を返す。 * @param {(dimensions[...] ,value):any} func 関数を実行し、戻り値を配列に追加します。 */ - /*@__PURE__*/flat_map(func: (...dimensions_with_value_in_last: [...PropertyKey[],any]) => T): T[]; + /*@__PURE__*/flat_map(func: (...dimensions_with_value_in_last: [...key_T[],value_T]) => T): T[]; /** * @description 自分自身をトラバースし、トラバース結果の1次元配列を返す。 * @param {(value,key?):any} func 関数を実行し、戻り値を配列に追加します。 */ - /*@__PURE__*/map(func: (value: any, key?: PropertyKey) => T): T[]; + /*@__PURE__*/map(func: (value: value_T, key?: key_T) => T): T[]; /** * @description 要素を配列として自分自身に追加する。 - * @param {[undefined|[PropertyKey,any]]} array 追加する配列。 + * @param {[undefined|[key_T,value_T]]} array 追加する配列。 */ - /*@__PURE__*/push(array: [undefined|[PropertyKey, any]]): void; + /*@__PURE__*/push(array: [undefined|[key_T, value_T]]): void; } /** @@ -53,7 +53,7 @@ declare class info_object { * console.log(info.Option);//notranslate * @alias jsstp.base_sstp_info_t */ -declare class base_sstp_info_t extends info_object { +declare class base_sstp_info_t extends info_object { /** * 分割された文字列やオブジェクト・メッセージから sstp_info_t を構築することは推奨されない。 * @param {String} info_head メッセージのヘッダー。 @@ -110,7 +110,7 @@ declare class base_sstp_info_t extends info_object { * console.log(info.Option);//notranslate * @alias jsstp.sstp_info_t */ -declare class sstp_info_t extends base_sstp_info_t { +declare class sstp_info_t extends base_sstp_info_t { /** * 分割された文字列メッセージまたはオブジェクト・メッセージから sstp_info_t を構築する,直接の使用は推奨されない。 * @param {String} info_head メッセージのヘッダー。 @@ -147,45 +147,73 @@ declare class sstp_info_t extends base_sstp_info_t { /*@__PURE__*/get raw(): sstp_info_t; /** - * @description すべてのキーの配列を取得する + * その他のメッセージメンバー + * @type {String|undefined} */ - /*@__PURE__*/get keys(): string[]; + [key: string]: String | undefined; +} + +/** + * fmoメッセージクラス:単一のfmoメッセージクラス + * @see {@link http://ssp.shillest.net/ukadoc/manual/spec_fmo_mutex.html} + */ +declare class single_fmo_info_t extends base_sstp_info_t { /** - * @description すべての値の配列を取得する + * @description 実行中のベースソフトのルートフォルダへのフルパス + * @example E:\ssp\ */ - /*@__PURE__*/get values(): String[]; + path: string; /** - * @description すべてのキーと値のペアの配列を取得します。 + * @description メインウィンドウのウィンドウハンドル + * @example 918820 */ - /*@__PURE__*/get entries(): [string, String][]; + hwnd: string; /** - * @description キーと値のペアごとに関数を実行する。 - * @param {(value,key?)} func 返り値がundefinedでない場合にvalueを置き換える関数を実行する。 + * @description ディスクリプタ.txtのsakura.name + * @example 橘花 */ - /*@__PURE__*/forEach(func: (value: String, key?: string) => String|undefined): void; + name: string; /** - * @description 自分自身とその子をトラバースし、トラバース結果の1次元配列を返す。 - * @param {(dimensions[...] ,value):any} func 関数を実行し、戻り値を配列に追加します。 + * @description descript.txtのkero.name + * @example 斗和 */ - /*@__PURE__*/flat_map(func: (...dimensions_with_value_in_last: [...string[],String]) => T): T[]; + keroname: string; /** - * @description 自分自身をトラバースし、トラバース結果の1次元配列を返す。 - * @param {(value,key?):any} func 関数を実行し、戻り値を配列に追加します。 + * @description 現在サイドに表示されているサーフェスID + * @example 0 */ - /*@__PURE__*/map(func: (value: String, key?: string) => T): T[]; + "sakura.surface": string; /** - * @description 配列をそれ自身に追加する。 - * @param {[undefined|[String,any]]} array 追加する配列。 + * @description 現在表示されているサーフェスID + * @example 10 */ - /*@__PURE__*/push(array: [undefined|[string, String]]): void; - + "kero.surface": string; /** - * その他のメッセージメンバー - * @type {String|undefined} + * @description サイドウィンドウのハンドル + * @example 67008 */ - [key: string]: String | undefined; + kerohwnd: string; + /** + * @description 現在使用されているウィンドウハンドルのカンマ区切りリスト + * @example 918820,67008 + */ + hwndlist: string; + /** + * @description 実行中のゴーストへのフルパス + * @example E:\ssp\ghost\Taromati2\ + */ + ghostpath: string; + /** + * @description 実行中のゴーストのdescript.txtの名前 + * @example Taromati2 + */ + fullname: string; + /** + * @description 実行中のゴーストのモジュール状態 + * @example shiori:running,makoto-ghost:running + */ + modulestate: string; } - /** * FMOメッセージクラス * @example @@ -197,7 +225,7 @@ declare class sstp_info_t extends base_sstp_info_t { * @see {@link jsstp_t.get_fmo_infos} * @see {@link http://ssp.shillest.net/ukadoc/manual/spec_fmo_mutex.html} */ -declare class fmo_info_t extends base_sstp_info_t { +declare class fmo_info_t extends base_sstp_info_t { /** * 分割された文字列メッセージまたはオブジェクト・メッセージから fmo_info_t を構築する,直接の使用は推奨されない。 * @param {String} fmo_text @@ -245,44 +273,11 @@ declare class fmo_info_t extends base_sstp_info_t { */ /*@__PURE__*/toJSON(): Object; - /** - * @description すべてのキーの配列を取得する - */ - /*@__PURE__*/get keys(): string[]; - /** - * @description すべての値の配列を取得する - */ - /*@__PURE__*/get values(): base_sstp_info_t[]; - /** - * @description すべてのキーと値のペアの配列を取得します。 - */ - /*@__PURE__*/get entries(): [string, base_sstp_info_t][]; - /** - * @description キーと値のペアごとに関数を実行する。 - * @param {(value,key?)} func 返り値がundefinedでない場合にvalueを置き換える関数を実行する。 - */ - /*@__PURE__*/forEach(func: (value: base_sstp_info_t, key?: string) => base_sstp_info_t|undefined): void; - /** - * @description 自分自身とその子をトラバースし、トラバース結果の1次元配列を返す。 - * @param {(dimensions[...],value):any} func 実行する関数。 value):any} func 関数を実行し、戻り値を配列に追加します。 - */ - /*@__PURE__*/flat_map(func: (...dimensions_with_value_in_last: [...string[],base_sstp_info_t]) => T): T[]; - /** - * @description 自分自身をトラバースし、トラバース結果の1次元配列を返す。 - * @param {(value,key?):any} func 関数を実行し、戻り値を配列に追加します。 - */ - /*@__PURE__*/map(func: (value: base_sstp_info_t, key?: string) => T): T[]; - /** - * @description 配列をそれ自身に追加する。 - * @param {[undefined|[String,any]]} array 追加する配列。 - */ - /*@__PURE__*/push(array: [undefined|[string, base_sstp_info_t]]): void; - /** * fmoメンバー - * @type {base_sstp_info_t|undefined} + * @type {single_fmo_info_t|undefined} */ - [uuid: string]: base_sstp_info_t|undefined; + [uuid: string]: single_fmo_info_t|undefined; } /** @@ -337,6 +332,9 @@ interface common_event_caller extends base_event_caller{ [key: string]: common_event_caller,//扩展事件名称 } +interface jsstp_with_ghost_info_t extends jsstp_t{ + ghost_info: single_fmo_info_t +} /** * jsstpオブジェクト * @see {@link jsstp} @@ -447,6 +445,27 @@ declare class jsstp_t{ */ set sendername(sender_name: String); /*@__PURE__*/get sendername(): String; + + /** + * 新しいjsstpオブジェクトをコピーする + * @group Clone Methods + */ + get clone(): jsstp_t; + + /** + * 与えられたfmo_infoに対して新しいjsstpオブジェクトをコピーする。 + * @param fmo_info ターゲットゴーストのfm_info + * @returns {jsstp_t} ターゲットゴーストを指す新しいjsstpオブジェクト + * @group Clone Methods + */ + by_fmo_info(fmo_info: single_fmo_info_t): jsstp_with_ghost_info_t; + + /** + * すべてのゴースト操作に対して + * @param {Function|undefined} operation 演算子 + */ + for_all_ghosts(operation?: (jsstp: jsstp_with_ghost_info_t) => result_T): Promise>; + /** * テキストでメッセージを送信し、テキストでそれを受信する * @param {any} info メッセージ本文 (テキスト) @@ -734,7 +753,7 @@ type ghost_events_queryer_t_call_signature = { * @returns {Promise} * @example * let result = await ghost_events_queryer("On_connect"); - * @see {@link ghost_events_queryer_t.check_event} に基づく。 + * @see {@link ghost_events_queryer_t_class_impl.check_event} に基づく。 */ /*@__PURE__*/(event_name: String, security_level?: String): Promise; } diff --git a/dist/jsstp.cjs b/dist/jsstp.cjs index 688bd0c..8fd5b4d 100644 --- a/dist/jsstp.cjs +++ b/dist/jsstp.cjs @@ -1 +1 @@ -var t,r=Object,n=Proxy,i=r.assign,h="\r\n",u=t=>t.toLowerCase(),o="Get_Supported_Events",a="Has_Event",_=u(o),l=u(a),c="get_simple_caller_of_event",g="trivial_clone",f="default_info",p="default_security_level",d="sstp_version_table",w="substring",v="length",y="available",m="split",b="entries",x="costom_text_send",S="forEach",E="get_caller_of_method",O="unknown_lines",T="get_caller_of_event",k="sendername",C="proxy",N="constructor",P="then",$="prototype",q="SEND",j="get_fmo_infos",F="get_passthrough",G="flat_map",I="RequestHeader",M="check_event",R="from_string",U="",J=U[N],X=u[N],A=0[N],D="X-SSTP-PassThru-",V=(t,e)=>{var s=t.indexOf(e);return[t[w](0,s),t[w](s+e[v])]},Y=(t,e)=>r(t)instanceof e,z=(t,e,s)=>(t[e]=s,1),B=(e,s,r)=>{return new n(e,i({get:(h=s,(e,s)=>{var r;if(!h.t?.(e,s))return(r=Y(s,J)?h.i?.(e,s):h.h?.(e,s))!==t?r:h.u?h.u(e,s):Y(r=e[s],X)?r.bind(e):r}),set:z},r));var h};class K extends X{constructor(t){return r.setPrototypeOf(t,new.target[$])}}var L=t=>{throw t},Q=t=>"http://localhost:"+(t??9801),W=globalThis.window?location.origin:Q(process.env.PORT),Z=/^\w+:\/\/localhost/.test(W)?"local":"external";class tt{constructor(t){i(this,t)}get keys(){return r.keys(this)}get values(){return r.values(this)}get[b](){return r[b](this)}get[v](){return this.keys[v]}[S](t){this[b][S](([e,s])=>{this[e]=t(s,e)??s})}get[g](){return i(et(),this)}[G](t){let e=[];return this[b].map(([s,r])=>e.push(...Y(r,tt)?r[G](t.bind(t,s)):[t(s,r)])),e}map(t){return this[b].map(([e,s])=>t(s,e))}push(e){return e[S](e=>e?this[e[0]]=e[1]:t),this}every(t){return this[b].every(([e,s])=>t(s,e))}}var et=t=>new tt(t);class st extends tt{#t;#e;constructor(t,e,s={}){super(),this.#t=U+t,s[v]&&(this.#e=s),i(this,e)}get[O](){return this.#e||[]}get head(){return this.#t}toString(){return[this.#t,...this[O],...this[b].map(([t,e])=>t+": "+e),U,U].join(h)}to_string(){return U+this}toJSON(){return{head:this.#t,[O]:this.#e,body:this[g]}}get status_code(){return+this.#t[m](" ").find(t=>(t=+t)==t)}}class rt extends st{constructor(e,s,n={}){return super(e,s,n),B(this,{i:(e,s)=>D+s in e&&!r.getOwnPropertyNames(rt[$]).includes(s)?e[F](s):t})}static[R](t){let e,[s,...r]=t[m](h),n={},i=[];r[v]-=2;for(let t of r){let[s,r]=V(t,": ");/^\w[^\s]*$/.test(s)?n[e=s]=r:e?n[e]+=h+t:i.push(t)}return new rt(s,n,i)}[F](t){return this[D+t]}#s;get passthroughs(){return this.#s??=et().push(this.map((e,s)=>s.startsWith(D)?[s.slice(16),e]:t))}get raw(){return this}}class nt extends st{constructor(t){var[t,...s]=t[m](h);super(t,{});for(let t of s)if(t){let[e,s]=V(t,""),[r,n]=V(e,".");(this[r]||=et())[n]=s}}get_uuid_by(t,e){return this.uuids.find(s=>this[s][t]==e)}get_list_of(t){return this.uuids.map(e=>this[e][t])}get uuids(){return this.keys}get[y](){return!!this[v]}toString(){return[this.head,U,...this[G]((t,e,s)=>t+"."+e+""+s),U,U].join(h)}toJSON(){return{head:this.head,fmo_infos:this[g]}}}class it extends K{#r;#n;#i;#h;#o;constructor(t){super((t,e=this[p])=>this[M](t,e)),this.#r=t,this[p]=t[p]}async[M](t,e=this[p]){return this.#i?this.#h[e].includes(t):!!this.#n&&(this.#o[e][t]??=await this.#r[l](t))}get[y](){return this.#n}get fast_query_available(){return this.#i}reset(){return this.clear(),this.init()}async init(){var t=this.#r;return this.#n=await t[l](a),this.#i=this.#n&&await t[l](o),this.#i&&(this.#h=await t[_]()),this}clear(){this.#n=this.#i=!1,this.#o={[e]:{},[s]:{}}}}class ht extends tt{static#u(e,s){return e.every(([,s])=>s===t)?s:new ht(r.fromEntries(e))}constructor(t){let e=et(t);return new n(L,{get:(t,s)=>{if(s!==P)return ht.#u(e.map((t,e)=>[e,t?.[s]]),e[s])},apply:(t,s,r)=>ht.#u(e.map((t,e)=>[e,t(...r)])),set:(t,s,r)=>(e[s]=r,!0)})}}class ut{#a;constructor(e,s){return this[I]={Origin:W},this[f]={Charset:"UTF-8"},this.host=s,this[k]=e,this[d]={[q]:1.4,NOTIFY:1.1,COMMUNICATE:1.1,EXECUTE:1.2,GIVE:1.1},this[p]=Z,this[C]=B(this,{i:(e,s)=>Y(e[d][s],A)?e[E](s):/^On/.test(s)?e[c]((t=>"_"==t[2]?t[w](3):t)(s)):t})}get clone(){var t=this;return i(new ut,{[I]:t[I],[f]:t[f],[p]:t[p],[d]:t[d],host:t.host})}by_fmo_info(t){var e=this.clone;return e.ghost_info=t,e[f].ReceiverGhostHWnd=t.hwnd,e}for_all_ghosts(t){let e=new ht;return this.get_fmo_infos().then(t=>{for(var s in t)e[s]=this.by_fmo_info(t[s]);return e}).then(t||(t=>t))}set host(t){this.#a=t||Q()+"/api/sstp/v1"}get host(){return this.#a}set[k](t){this[f].Sender=t||"jsstp-client"}get[k](){return this[f].Sender}async row_send(t){return 200!=(t=await fetch(this.#a,{method:"POST",headers:this[I],body:U+t})).status&&L(t.status),t.text()}[x](t,e){return this.row_send(new rt(t,{...this[f],...e}))}costom_send(t,e){return this[x](t,e)[P](t=>rt[R](t))}[E](t){let e=t+" SSTP/"+this[d][t];return i(t=>this.costom_send(e,t),{get_raw:t=>this[x](e,t)})}#_(t,e,s,r){return new n(s,{get:(s,n)=>n in s?s[n]:this[r](t+"."+n,e)})}[T](t,e=q){return this.#_(t,e,s=>this[C][e](i({Event:t},s)),T)}[c](t,e=q){return this.#_(t,e,(...s)=>{let r=0,n={};return s[S](t=>n["Reference"+r++]=t),this[T](t,e)(n)},c)}get event(){return new n({},{get:(t,e)=>this[c](e)})}[l](t,e=this[p]){return this.event[a](t,e)[P](({Result:t})=>1==t)}[_](){return this.event[o]()[P](({[e]:t,[s]:r})=>({[e]:(t||U)[m](","),[s]:(r||U)[m](",")}))}[j](){return this[C].EXECUTE.get_raw({Command:"GetFMO"})[P](t=>new nt(t))}[y](){return this[j]()[P](t=>t[y],()=>!1)}[P](t,e){return this[y]()[P](s=>s?t?.(this[C]):(e??L)(s))}new_event_queryer(){return new it(this).init()}}i(ut[$],{type:ut,base_sstp_info_t:st,sstp_info_t:rt,fmo_info_t:nt,ghost_events_queryer_t:it}),u=new ut,i(exports,{base_sstp_info_t:st,default:u,fmo_info_t:nt,ghost_events_queryer_t:it,jsstp:u,jsstp_t:ut,sstp_info_t:rt,__esModule:!0}) +var t,r=Object,i=Proxy,n=r.assign,h="\r\n",u=t=>t.toLowerCase(),o="Get_Supported_Events",a="Has_Event",_=u(o),l=u(a),c="get_simple_caller_of_event",g="trivial_clone",f="default_info",p="default_security_level",d="sstp_version_table",v="substring",w="length",y="available",m="split",b="entries",S="costom_text_send",x="forEach",E="get_caller_of_method",O="unknown_lines",T="get_caller_of_event",k="sendername",C="proxy",N="constructor",P="then",$="prototype",q="SEND",j="get_fmo_infos",F="get_passthrough",G="flat_map",I="RequestHeader",M="check_event",R="from_string",U="",J=U[N],X=u[N],A=0[N],D="X-SSTP-PassThru-",V=(t,e)=>{var s=t.indexOf(e);return[t[v](0,s),t[v](s+e[w])]},Y=(t,e)=>r(t)instanceof e,z=(t,e,s)=>(t[e]=s,1),B=(e,s,r)=>{return new i(e,n({get:(h=s,(e,s)=>{var r;if(!h.t?.(e,s))return(r=Y(s,J)?h.i?.(e,s):h.h?.(e,s))!==t?r:h.u?h.u(e,s):Y(r=e[s],X)?r.bind(e):r}),set:z},r));var h};class K extends X{constructor(t){return r.setPrototypeOf(t,new.target[$])}}var L=t=>{throw t},Q=t=>"http://localhost:"+(t??9801),W=globalThis.window?location.origin:Q(process.env.PORT),Z=/^\w+:\/\/localhost/.test(W)?"local":"external";class tt{constructor(t){n(this,t)}get keys(){return r.keys(this)}get values(){return r.values(this)}get[b](){return r[b](this)}get[w](){return this.keys[w]}[x](t){this[b][x](([e,s])=>{this[e]=t(s,e)??s})}get[g](){return n(et(),this)}[G](t){let e=[];return this[b].map(([s,r])=>e.push(...Y(r,tt)?r[G](t.bind(t,s)):[t(s,r)])),e}map(t){return this[b].map(([e,s])=>t(s,e))}push(e){return e[x](e=>e?this[e[0]]=e[1]:t),this}every(t){return this[b].every(([e,s])=>t(s,e))}}var et=t=>new tt(t);class st extends tt{#t;#e;constructor(t,e,s={}){super(),this.#t=U+t,s[w]&&(this.#e=s),n(this,e)}get[O](){return this.#e||[]}get head(){return this.#t}toString(){return[this.#t,...this[O],...this[b].map(([t,e])=>t+": "+e),U,U].join(h)}to_string(){return U+this}toJSON(){return{head:this.#t,[O]:this.#e,body:this[g]}}get status_code(){return+this.#t[m](" ").find(t=>(t=+t)==t)}}class rt extends st{constructor(e,s,i={}){return super(e,s,i),B(this,{i:(e,s)=>D+s in e&&!r.getOwnPropertyNames(rt[$]).includes(s)?e[F](s):t})}static[R](t){let e,[s,...r]=t[m](h),i={},n=[];r[w]-=2;for(let t of r){let[s,r]=V(t,": ");/^\w[^\s]*$/.test(s)?i[e=s]=r:e?i[e]+=h+t:n.push(t)}return new rt(s,i,n)}[F](t){return this[D+t]}#s;get passthroughs(){return this.#s??=et().push(this.map((e,s)=>s.startsWith(D)?[s.slice(16),e]:t))}get raw(){return this}}class it extends st{constructor(t){var[t,...s]=t[m](h);super(t,{});for(let t of s)if(t){let[e,s]=V(t,""),[r,i]=V(e,".");(this[r]||=et())[i]=s}}get_uuid_by(t,e){return this.uuids.find(s=>this[s][t]==e)}get_list_of(t){return this.uuids.map(e=>this[e][t])}get uuids(){return this.keys}get[y](){return!!this[w]}toString(){return[this.head,U,...this[G]((t,e,s)=>t+"."+e+""+s),U,U].join(h)}toJSON(){return{head:this.head,fmo_infos:this[g]}}}class nt extends K{#r;#i;#n;#h;#o;constructor(t){super((t,e=this[p])=>this[M](t,e)),this.#r=t,this[p]=t[p]}async[M](t,e=this[p]){return this.#n?this.#h[e].includes(t):!!this.#i&&(this.#o[e][t]??=await this.#r[l](t))}get[y](){return this.#i}get fast_query_available(){return this.#n}reset(){return this.clear(),this.init()}async init(){var t=this.#r;return this.#i=await t[l](a),this.#n=this.#i&&await t[l](o),this.#n&&(this.#h=await t[_]()),this}clear(){this.#i=this.#n=!1,this.#o={[e]:{},[s]:{}}}}class ht{#u;constructor(e,s){return this[I]={Origin:W},this[f]={Charset:"UTF-8"},this.host=s,this[k]=e,this[d]={[q]:1.4,NOTIFY:1.1,COMMUNICATE:1.1,EXECUTE:1.2,GIVE:1.1},this[p]=Z,this[C]=B(this,{i:(e,s)=>Y(e[d][s],A)?e[E](s):/^On/.test(s)?e[c]((t=>"_"==t[2]?t[v](3):t)(s)):t})}get clone(){var t=this;return n(new ht,{[I]:t[I],[f]:t[f],[p]:t[p],[d]:t[d],host:t.host})}by_fmo_info(t){var e=this.clone;return e.ghost_info=t,e[f].ReceiverGhostHWnd=t.hwnd,e}for_all_ghosts(t=t=>t){let e=et();return this.get_fmo_infos().then(s=>{for(var r in s)e[r]=t?.(this.by_fmo_info(s[r]));return e})}set host(t){this.#u=t||Q()+"/api/sstp/v1"}get host(){return this.#u}set[k](t){this[f].Sender=t||"jsstp-client"}get[k](){return this[f].Sender}async row_send(t){return 200!=(t=await fetch(this.#u,{method:"POST",headers:this[I],body:U+t})).status&&L(t.status),t.text()}[S](t,e){return this.row_send(new rt(t,{...this[f],...e}))}costom_send(t,e){return this[S](t,e)[P](t=>rt[R](t))}[E](t){let e=t+" SSTP/"+this[d][t];return n(t=>this.costom_send(e,t),{get_raw:t=>this[S](e,t)})}#a(t,e,s,r){return new i(s,{get:(s,i)=>i in s?s[i]:this[r](t+"."+i,e)})}[T](t,e=q){return this.#a(t,e,s=>this[C][e](n({Event:t},s)),T)}[c](t,e=q){return this.#a(t,e,(...s)=>{let r=0,i={};return s[x](t=>i["Reference"+r++]=t),this[T](t,e)(i)},c)}get event(){return new i({},{get:(t,e)=>this[c](e)})}[l](t,e=this[p]){return this.event[a](t,e)[P](({Result:t})=>1==t)}[_](){return this.event[o]()[P](({[e]:t,[s]:r})=>({[e]:(t||U)[m](","),[s]:(r||U)[m](",")}))}[j](){return this[C].EXECUTE.get_raw({Command:"GetFMO"})[P](t=>new it(t))}[y](){return this[j]()[P](t=>t[y],()=>!1)}[P](t,e){return this[y]()[P](s=>s?t?.(this[C]):(e??L)(s))}new_event_queryer(){return new nt(this).init()}}n(ht[$],{type:ht,base_sstp_info_t:st,sstp_info_t:rt,fmo_info_t:it,ghost_events_queryer_t:nt}),u=new ht,n(exports,{base_sstp_info_t:st,default:u,fmo_info_t:it,ghost_events_queryer_t:nt,jsstp:u,jsstp_t:ht,sstp_info_t:rt,__esModule:!0}) diff --git a/dist/jsstp.min.js b/dist/jsstp.min.js index 279e7de..054dcab 100644 --- a/dist/jsstp.min.js +++ b/dist/jsstp.min.js @@ -1 +1 @@ -var jsstp=(()=>{var t,e="local",s="external",r=Object,n=Proxy,i=r.assign,h="\r\n",u=t=>t.toLowerCase(),o="Get_Supported_Events",a="Has_Event",_=u(o),l=u(a),c="get_simple_caller_of_event",g="trivial_clone",f="default_info",p="default_security_level",d="sstp_version_table",w="substring",v="length",y="available",m="split",b="entries",S="costom_text_send",x="forEach",E="get_caller_of_method",O="unknown_lines",T="get_caller_of_event",k="sendername",C="proxy",N="constructor",P="then",$="prototype",j="SEND",q="get_fmo_infos",F="get_passthrough",G="flat_map",I="RequestHeader",M="check_event",R="from_string",U="",J=U[N],X=u[N],A=0[N],D="X-SSTP-PassThru-",V=(t,e)=>{var s=t.indexOf(e);return[t[w](0,s),t[w](s+e[v])]},Y=(t,e)=>r(t)instanceof e,z=(t,e,s)=>(t[e]=s,1),B=(e,s,r)=>{return new n(e,i({get:(h=s,(e,s)=>{var r;if(!h.t?.(e,s))return(r=Y(s,J)?h.i?.(e,s):h.h?.(e,s))!==t?r:h.u?h.u(e,s):Y(r=e[s],X)?r.bind(e):r}),set:z},r));var h};class K extends X{constructor(t){return r.setPrototypeOf(t,new.target[$])}}var L=t=>{throw t},Q=t=>"http://localhost:"+(t??9801),W=globalThis.window?location.origin:Q(process.env.PORT),Z=/^\w+:\/\/localhost/.test(W)?e:s;class tt{constructor(t){i(this,t)}get keys(){return r.keys(this)}get values(){return r.values(this)}get[b](){return r[b](this)}get[v](){return this.keys[v]}[x](t){this[b][x](([e,s])=>{this[e]=t(s,e)??s})}get[g](){return i(et(),this)}[G](t){let e=[];return this[b].map(([s,r])=>e.push(...Y(r,tt)?r[G](t.bind(t,s)):[t(s,r)])),e}map(t){return this[b].map(([e,s])=>t(s,e))}push(e){return e[x](e=>e?this[e[0]]=e[1]:t),this}every(t){return this[b].every(([e,s])=>t(s,e))}}var et=t=>new tt(t);class st extends tt{#t;#e;constructor(t,e,s={}){super(),this.#t=U+t,s[v]&&(this.#e=s),i(this,e)}get[O](){return this.#e||[]}get head(){return this.#t}toString(){return[this.#t,...this[O],...this[b].map(([t,e])=>t+": "+e),U,U].join(h)}to_string(){return U+this}toJSON(){return{head:this.#t,[O]:this.#e,body:this[g]}}get status_code(){return+this.#t[m](" ").find(t=>{return(t=+t)==t})}}class rt extends st{constructor(e,s,n={}){return super(e,s,n),B(this,{i:(e,s)=>D+s in e&&!r.getOwnPropertyNames(rt[$]).includes(s)?e[F](s):t})}static[R](t){let e,[s,...r]=t[m](h),n={},i=[];r[v]-=2;for(let t of r){let[s,r]=V(t,": ");/^\w[^\s]*$/.test(s)?n[e=s]=r:e?n[e]+=h+t:i.push(t)}return new rt(s,n,i)}[F](t){return this[D+t]}#s;get passthroughs(){return this.#s??=et().push(this.map((e,s)=>s.startsWith(D)?[s.slice(16),e]:t))}get raw(){return this}}class nt extends st{constructor(t){var[t,...s]=t[m](h);super(t,{});for(let t of s)if(t){let[e,s]=V(t,""),[r,n]=V(e,".");(this[r]||=et())[n]=s}}get_uuid_by(t,e){return this.uuids.find(s=>this[s][t]==e)}get_list_of(t){return this.uuids.map(e=>this[e][t])}get uuids(){return this.keys}get[y](){return!!this[v]}toString(){return[this.head,U,...this[G]((t,e,s)=>t+"."+e+""+s),U,U].join(h)}toJSON(){return{head:this.head,fmo_infos:this[g]}}}class it extends K{#r;#n;#i;#h;#u;constructor(t){super((t,e=this[p])=>this[M](t,e)),this.#r=t,this[p]=t[p]}async[M](t,e=this[p]){return this.#i?this.#h[e].includes(t):!!this.#n&&(this.#u[e][t]??=await this.#r[l](t))}get[y](){return this.#n}get fast_query_available(){return this.#i}reset(){return this.clear(),this.init()}async init(){var t=this.#r;return this.#n=await t[l](a),this.#i=this.#n&&await t[l](o),this.#i&&(this.#h=await t[_]()),this}clear(){this.#n=this.#i=!1,this.#u={[e]:{},[s]:{}}}}class ht extends tt{static#o(e,s){return e.every(([,s])=>s===t)?s:new ht(r.fromEntries(e))}constructor(t){let e=et(t);return new n(L,{get:(t,s)=>{if(s!==P)return ht.#o(e.map((t,e)=>[e,t?.[s]]),e[s])},apply:(t,s,r)=>ht.#o(e.map((t,e)=>[e,t(...r)])),set:(t,s,r)=>(e[s]=r,!0)})}}class ut{#a;constructor(e,s){return this[I]={Origin:W},this[f]={Charset:"UTF-8"},this.host=s,this[k]=e,this[d]={[q]:1.4,NOTIFY:1.1,COMMUNICATE:1.1,EXECUTE:1.2,GIVE:1.1},this[p]=Z,this[C]=B(this,{i:(e,s)=>Y(e[d][s],A)?e[E](s):/^On/.test(s)?e[c]((t=>"_"==t[2]?t[w](3):t)(s)):t})}get clone(){var t=this;return i(new ut,{[I]:t[I],[f]:t[f],[p]:t[p],[d]:t[d],host:t.host})}by_fmo_info(t){var e=this.clone;return e.ghost_info=t,e[f].ReceiverGhostHWnd=t.hwnd,e}for_all_ghosts(t){let e=new ht;return this.get_fmo_infos().then(t=>{for(var s in t)e[s]=this.by_fmo_info(t[s]);return e}).then(t||(t=>t))}set host(t){this.#a=t||Q()+"/api/sstp/v1"}get host(){return this.#a}set[k](t){this[f].Sender=t||"jsstp-client"}get[k](){return this[f].Sender}async row_send(t){t=await fetch(this.#a,{method:"POST",headers:this[I],body:U+t});return 200!=t.status&&L(t.status),t.text()}[S](t,e){return this.row_send(new rt(t,{...this[f],...e}))}costom_send(t,e){return this[S](t,e)[P](t=>rt[R](t))}[E](t){let e=t+" SSTP/"+this[d][t];return i(t=>this.costom_send(e,t),{get_raw:t=>this[S](e,t)})}#_(t,e,s,r){return new n(s,{get:(s,n)=>n in s?s[n]:this[r](t+"."+n,e)})}[T](t,e=j){return this.#_(t,e,s=>this[C][e](i({Event:t},s)),T)}[c](t,e=j){return this.#_(t,e,(...s)=>{let r=0,n={};return s[x](t=>n["Reference"+r++]=t),this[T](t,e)(n)},c)}get event(){return new n({},{get:(t,e)=>this[c](e)})}[l](t,e=this[p]){return this.event[a](t,e)[P](({Result:t})=>1==t)}[_](){return this.event[o]()[P](({[e]:t,[s]:r})=>({[e]:(t||U)[m](","),[s]:(r||U)[m](",")}))}[q](){return this[C].EXECUTE.get_raw({Command:"GetFMO"})[P](t=>new nt(t))}[y](){return this[q]()[P](t=>t[y],()=>!1)}[P](t,e){return this[y]()[P](s=>s?t?.(this[C]):(e??L)(s))}new_event_queryer(){return new it(this).init()}}return i(ut[$],{type:ut,base_sstp_info_t:st,sstp_info_t:rt,fmo_info_t:nt,ghost_events_queryer_t:it}),new ut})() +var jsstp=(()=>{var t,e="local",s="external",r=Object,i=Proxy,n=r.assign,h="\r\n",u=t=>t.toLowerCase(),o="Get_Supported_Events",a="Has_Event",_=u(o),l=u(a),c="get_simple_caller_of_event",g="trivial_clone",f="default_info",p="default_security_level",v="sstp_version_table",d="substring",w="length",y="available",m="split",b="entries",S="costom_text_send",E="forEach",x="get_caller_of_method",O="unknown_lines",T="get_caller_of_event",k="sendername",C="proxy",N="constructor",P="then",$="prototype",j="SEND",q="get_fmo_infos",F="get_passthrough",G="flat_map",I="RequestHeader",M="check_event",R="from_string",U="",J=U[N],X=u[N],A=0[N],D="X-SSTP-PassThru-",V=(t,e)=>{var s=t.indexOf(e);return[t[d](0,s),t[d](s+e[w])]},Y=(t,e)=>r(t)instanceof e,z=(t,e,s)=>(t[e]=s,1),B=(e,s,r)=>{return new i(e,n({get:(h=s,(e,s)=>{var r;if(!h.t?.(e,s))return(r=Y(s,J)?h.i?.(e,s):h.h?.(e,s))!==t?r:h.u?h.u(e,s):Y(r=e[s],X)?r.bind(e):r}),set:z},r));var h};class K extends X{constructor(t){return r.setPrototypeOf(t,new.target[$])}}var L=t=>{throw t},Q=t=>"http://localhost:"+(t??9801),W=globalThis.window?location.origin:Q(process.env.PORT),Z=/^\w+:\/\/localhost/.test(W)?e:s;class tt{constructor(t){n(this,t)}get keys(){return r.keys(this)}get values(){return r.values(this)}get[b](){return r[b](this)}get[w](){return this.keys[w]}[E](t){this[b][E](([e,s])=>{this[e]=t(s,e)??s})}get[g](){return n(et(),this)}[G](t){let e=[];return this[b].map(([s,r])=>e.push(...Y(r,tt)?r[G](t.bind(t,s)):[t(s,r)])),e}map(t){return this[b].map(([e,s])=>t(s,e))}push(e){return e[E](e=>e?this[e[0]]=e[1]:t),this}every(t){return this[b].every(([e,s])=>t(s,e))}}var et=t=>new tt(t);class st extends tt{#t;#e;constructor(t,e,s={}){super(),this.#t=U+t,s[w]&&(this.#e=s),n(this,e)}get[O](){return this.#e||[]}get head(){return this.#t}toString(){return[this.#t,...this[O],...this[b].map(([t,e])=>t+": "+e),U,U].join(h)}to_string(){return U+this}toJSON(){return{head:this.#t,[O]:this.#e,body:this[g]}}get status_code(){return+this.#t[m](" ").find(t=>{return(t=+t)==t})}}class rt extends st{constructor(e,s,i={}){return super(e,s,i),B(this,{i:(e,s)=>D+s in e&&!r.getOwnPropertyNames(rt[$]).includes(s)?e[F](s):t})}static[R](t){let e,[s,...r]=t[m](h),i={},n=[];r[w]-=2;for(let t of r){let[s,r]=V(t,": ");/^\w[^\s]*$/.test(s)?i[e=s]=r:e?i[e]+=h+t:n.push(t)}return new rt(s,i,n)}[F](t){return this[D+t]}#s;get passthroughs(){return this.#s??=et().push(this.map((e,s)=>s.startsWith(D)?[s.slice(16),e]:t))}get raw(){return this}}class it extends st{constructor(t){var[t,...s]=t[m](h);super(t,{});for(let t of s)if(t){let[e,s]=V(t,""),[r,i]=V(e,".");(this[r]||=et())[i]=s}}get_uuid_by(t,e){return this.uuids.find(s=>this[s][t]==e)}get_list_of(t){return this.uuids.map(e=>this[e][t])}get uuids(){return this.keys}get[y](){return!!this[w]}toString(){return[this.head,U,...this[G]((t,e,s)=>t+"."+e+""+s),U,U].join(h)}toJSON(){return{head:this.head,fmo_infos:this[g]}}}class nt extends K{#r;#i;#n;#h;#u;constructor(t){super((t,e=this[p])=>this[M](t,e)),this.#r=t,this[p]=t[p]}async[M](t,e=this[p]){return this.#n?this.#h[e].includes(t):!!this.#i&&(this.#u[e][t]??=await this.#r[l](t))}get[y](){return this.#i}get fast_query_available(){return this.#n}reset(){return this.clear(),this.init()}async init(){var t=this.#r;return this.#i=await t[l](a),this.#n=this.#i&&await t[l](o),this.#n&&(this.#h=await t[_]()),this}clear(){this.#i=this.#n=!1,this.#u={[e]:{},[s]:{}}}}class ht{#o;constructor(e,s){return this[I]={Origin:W},this[f]={Charset:"UTF-8"},this.host=s,this[k]=e,this[v]={[q]:1.4,NOTIFY:1.1,COMMUNICATE:1.1,EXECUTE:1.2,GIVE:1.1},this[p]=Z,this[C]=B(this,{i:(e,s)=>Y(e[v][s],A)?e[x](s):/^On/.test(s)?e[c]((t=>"_"==t[2]?t[d](3):t)(s)):t})}get clone(){var t=this;return n(new ht,{[I]:t[I],[f]:t[f],[p]:t[p],[d]:t[v],host:t.host})}by_fmo_info(t){var e=this.clone;return e.ghost_info=t,e[f].ReceiverGhostHWnd=t.hwnd,e}for_all_ghosts(t=t=>t){let e=et();return this.get_fmo_infos().then(s=>{for(var r in s)e[r]=t?.(this.by_fmo_info(s[r]));return e})}set host(t){this.#o=t||Q()+"/api/sstp/v1"}get host(){return this.#o}set[k](t){this[f].Sender=t||"jsstp-client"}get[k](){return this[f].Sender}async row_send(t){t=await fetch(this.#o,{method:"POST",headers:this[I],body:U+t});return 200!=t.status&&L(t.status),t.text()}[S](t,e){return this.row_send(new rt(t,{...this[f],...e}))}costom_send(t,e){return this[S](t,e)[P](t=>rt[R](t))}[x](t){let e=t+" SSTP/"+this[v][t];return n(t=>this.costom_send(e,t),{get_raw:t=>this[S](e,t)})}#a(t,e,s,r){return new i(s,{get:(s,i)=>i in s?s[i]:this[r](t+"."+i,e)})}[T](t,e=j){return this.#a(t,e,s=>this[C][e](n({Event:t},s)),T)}[c](t,e=j){return this.#a(t,e,(...s)=>{let r=0,i={};return s[E](t=>i["Reference"+r++]=t),this[T](t,e)(i)},c)}get event(){return new i({},{get:(t,e)=>this[c](e)})}[l](t,e=this[p]){return this.event[a](t,e)[P](({Result:t})=>1==t)}[_](){return this.event[o]()[P](({[e]:t,[s]:r})=>({[e]:(t||U)[m](","),[s]:(r||U)[m](",")}))}[q](){return this[C].EXECUTE.get_raw({Command:"GetFMO"})[P](t=>new it(t))}[y](){return this[q]()[P](t=>t[y],()=>!1)}[P](t,e){return this[y]()[P](s=>s?t?.(this[C]):(e??L)(s))}new_event_queryer(){return new nt(this).init()}}return n(ht[$],{type:ht,base_sstp_info_t:st,sstp_info_t:rt,fmo_info_t:it,ghost_events_queryer_t:nt}),new ht})() diff --git a/dist/jsstp.mjs b/dist/jsstp.mjs index a8b86c2..ace7378 100644 --- a/dist/jsstp.mjs +++ b/dist/jsstp.mjs @@ -1 +1 @@ -var t,e="local",s="external",r=Object,n=Proxy,i=r.assign,h="\r\n",u=t=>t.toLowerCase(),o="Get_Supported_Events",a="Has_Event",_=u(o),l=u(a),c="get_simple_caller_of_event",g="trivial_clone",f="default_info",p="default_security_level",d="sstp_version_table",w="substring",v="length",y="available",m="split",b="entries",x="costom_text_send",S="forEach",E="get_caller_of_method",O="unknown_lines",T="get_caller_of_event",k="sendername",C="proxy",N="constructor",P="then",$="prototype",q="SEND",j="get_fmo_infos",F="get_passthrough",G="flat_map",I="RequestHeader",M="check_event",R="from_string",U="",J=U[N],X=u[N],A=0[N],D="X-SSTP-PassThru-",V=(t,e)=>{var s=t.indexOf(e);return[t[w](0,s),t[w](s+e[v])]},Y=(t,e)=>r(t)instanceof e,z=(t,e,s)=>(t[e]=s,1),B=(e,s,r)=>{return new n(e,i({get:(h=s,(e,s)=>{var r;if(!h.t?.(e,s))return(r=Y(s,J)?h.i?.(e,s):h.h?.(e,s))!==t?r:h.u?h.u(e,s):Y(r=e[s],X)?r.bind(e):r}),set:z},r));var h};class K extends X{constructor(t){return r.setPrototypeOf(t,new.target[$])}}var L=t=>{throw t},Q=t=>"http://localhost:"+(t??9801),W=globalThis.window?location.origin:Q(process.env.PORT),Z=/^\w+:\/\/localhost/.test(W)?e:s;class tt{constructor(t){i(this,t)}get keys(){return r.keys(this)}get values(){return r.values(this)}get[b](){return r[b](this)}get[v](){return this.keys[v]}[S](t){this[b][S](([e,s])=>{this[e]=t(s,e)??s})}get[g](){return i(et(),this)}[G](t){let e=[];return this[b].map(([s,r])=>e.push(...Y(r,tt)?r[G](t.bind(t,s)):[t(s,r)])),e}map(t){return this[b].map(([e,s])=>t(s,e))}push(e){return e[S](e=>e?this[e[0]]=e[1]:t),this}every(t){return this[b].every(([e,s])=>t(s,e))}}var et=t=>new tt(t);class st extends tt{#t;#e;constructor(t,e,s={}){super(),this.#t=U+t,s[v]&&(this.#e=s),i(this,e)}get[O](){return this.#e||[]}get head(){return this.#t}toString(){return[this.#t,...this[O],...this[b].map(([t,e])=>t+": "+e),U,U].join(h)}to_string(){return U+this}toJSON(){return{head:this.#t,[O]:this.#e,body:this[g]}}get status_code(){return+this.#t[m](" ").find(t=>{return(t=+t)==t})}}class rt extends st{constructor(e,s,n={}){return super(e,s,n),B(this,{i:(e,s)=>D+s in e&&!r.getOwnPropertyNames(rt[$]).includes(s)?e[F](s):t})}static[R](t){let e,[s,...r]=t[m](h),n={},i=[];r[v]-=2;for(let t of r){let[s,r]=V(t,": ");/^\w[^\s]*$/.test(s)?n[e=s]=r:e?n[e]+=h+t:i.push(t)}return new rt(s,n,i)}[F](t){return this[D+t]}#s;get passthroughs(){return this.#s??=et().push(this.map((e,s)=>s.startsWith(D)?[s.slice(16),e]:t))}get raw(){return this}}class nt extends st{constructor(t){var[t,...s]=t[m](h);super(t,{});for(let t of s)if(t){let[e,s]=V(t,""),[r,n]=V(e,".");(this[r]||=et())[n]=s}}get_uuid_by(t,e){return this.uuids.find(s=>this[s][t]==e)}get_list_of(t){return this.uuids.map(e=>this[e][t])}get uuids(){return this.keys}get[y](){return!!this[v]}toString(){return[this.head,U,...this[G]((t,e,s)=>t+"."+e+""+s),U,U].join(h)}toJSON(){return{head:this.head,fmo_infos:this[g]}}}class it extends K{#r;#n;#i;#h;#u;constructor(t){super((t,e=this[p])=>this[M](t,e)),this.#r=t,this[p]=t[p]}async[M](t,e=this[p]){return this.#i?this.#h[e].includes(t):!!this.#n&&(this.#u[e][t]??=await this.#r[l](t))}get[y](){return this.#n}get fast_query_available(){return this.#i}reset(){return this.clear(),this.init()}async init(){var t=this.#r;return this.#n=await t[l](a),this.#i=this.#n&&await t[l](o),this.#i&&(this.#h=await t[_]()),this}clear(){this.#n=this.#i=!1,this.#u={[e]:{},[s]:{}}}}class ht extends tt{static#o(e,s){return e.every(([,s])=>s===t)?s:new ht(r.fromEntries(e))}constructor(t){let e=et(t);return new n(L,{get:(t,s)=>{if(s!==P)return ht.#o(e.map((t,e)=>[e,t?.[s]]),e[s])},apply:(t,s,r)=>ht.#o(e.map((t,e)=>[e,t(...r)])),set:(t,s,r)=>(e[s]=r,!0)})}}class ut{#a;constructor(e,s){return this[I]={Origin:W},this[f]={Charset:"UTF-8"},this.host=s,this[k]=e,this[d]={[q]:1.4,NOTIFY:1.1,COMMUNICATE:1.1,EXECUTE:1.2,GIVE:1.1},this[p]=Z,this[C]=B(this,{i:(e,s)=>Y(e[d][s],A)?e[E](s):/^On/.test(s)?e[c]((t=>"_"==t[2]?t[w](3):t)(s)):t})}get clone(){var t=this;return i(new ut,{[I]:t[I],[f]:t[f],[p]:t[p],[d]:t[d],host:t.host})}by_fmo_info(t){var e=this.clone;return e.ghost_info=t,e[f].ReceiverGhostHWnd=t.hwnd,e}for_all_ghosts(t){let e=new ht;return this.get_fmo_infos().then(t=>{for(var s in t)e[s]=this.by_fmo_info(t[s]);return e}).then(t||(t=>t))}set host(t){this.#a=t||Q()+"/api/sstp/v1"}get host(){return this.#a}set[k](t){this[f].Sender=t||"jsstp-client"}get[k](){return this[f].Sender}async row_send(t){t=await fetch(this.#a,{method:"POST",headers:this[I],body:U+t});return 200!=t.status&&L(t.status),t.text()}[x](t,e){return this.row_send(new rt(t,{...this[f],...e}))}costom_send(t,e){return this[x](t,e)[P](t=>rt[R](t))}[E](t){let e=t+" SSTP/"+this[d][t];return i(t=>this.costom_send(e,t),{get_raw:t=>this[x](e,t)})}#_(t,e,s,r){return new n(s,{get:(s,n)=>n in s?s[n]:this[r](t+"."+n,e)})}[T](t,e=q){return this.#_(t,e,s=>this[C][e](i({Event:t},s)),T)}[c](t,e=q){return this.#_(t,e,(...s)=>{let r=0,n={};return s[S](t=>n["Reference"+r++]=t),this[T](t,e)(n)},c)}get event(){return new n({},{get:(t,e)=>this[c](e)})}[l](t,e=this[p]){return this.event[a](t,e)[P](({Result:t})=>1==t)}[_](){return this.event[o]()[P](({[e]:t,[s]:r})=>({[e]:(t||U)[m](","),[s]:(r||U)[m](",")}))}[j](){return this[C].EXECUTE.get_raw({Command:"GetFMO"})[P](t=>new nt(t))}[y](){return this[j]()[P](t=>t[y],()=>!1)}[P](t,e){return this[y]()[P](s=>s?t?.(this[C]):(e??L)(s))}new_event_queryer(){return new it(this).init()}}i(ut[$],{type:ut,base_sstp_info_t:st,sstp_info_t:rt,fmo_info_t:nt,ghost_events_queryer_t:it});u=new ut;export{st as base_sstp_info_t,u as default,nt as fmo_info_t,it as ghost_events_queryer_t,u as jsstp,ut as jsstp_t,rt as sstp_info_t} +var t,e="local",s="external",r=Object,i=Proxy,n=r.assign,h="\r\n",u=t=>t.toLowerCase(),o="Get_Supported_Events",a="Has_Event",_=u(o),l=u(a),c="get_simple_caller_of_event",g="trivial_clone",f="default_info",p="default_security_level",d="sstp_version_table",v="substring",w="length",y="available",m="split",b="entries",S="costom_text_send",x="forEach",E="get_caller_of_method",O="unknown_lines",T="get_caller_of_event",k="sendername",C="proxy",N="constructor",P="then",$="prototype",q="SEND",j="get_fmo_infos",F="get_passthrough",G="flat_map",I="RequestHeader",M="check_event",R="from_string",U="",J=U[N],X=u[N],A=0[N],D="X-SSTP-PassThru-",V=(t,e)=>{var s=t.indexOf(e);return[t[v](0,s),t[v](s+e[w])]},Y=(t,e)=>r(t)instanceof e,z=(t,e,s)=>(t[e]=s,1),B=(e,s,r)=>{return new i(e,n({get:(h=s,(e,s)=>{var r;if(!h.t?.(e,s))return(r=Y(s,J)?h.i?.(e,s):h.h?.(e,s))!==t?r:h.u?h.u(e,s):Y(r=e[s],X)?r.bind(e):r}),set:z},r));var h};class K extends X{constructor(t){return r.setPrototypeOf(t,new.target[$])}}var L=t=>{throw t},Q=t=>"http://localhost:"+(t??9801),W=globalThis.window?location.origin:Q(process.env.PORT),Z=/^\w+:\/\/localhost/.test(W)?e:s;class tt{constructor(t){n(this,t)}get keys(){return r.keys(this)}get values(){return r.values(this)}get[b](){return r[b](this)}get[w](){return this.keys[w]}[x](t){this[b][x](([e,s])=>{this[e]=t(s,e)??s})}get[g](){return n(et(),this)}[G](t){let e=[];return this[b].map(([s,r])=>e.push(...Y(r,tt)?r[G](t.bind(t,s)):[t(s,r)])),e}map(t){return this[b].map(([e,s])=>t(s,e))}push(e){return e[x](e=>e?this[e[0]]=e[1]:t),this}every(t){return this[b].every(([e,s])=>t(s,e))}}var et=t=>new tt(t);class st extends tt{#t;#e;constructor(t,e,s={}){super(),this.#t=U+t,s[w]&&(this.#e=s),n(this,e)}get[O](){return this.#e||[]}get head(){return this.#t}toString(){return[this.#t,...this[O],...this[b].map(([t,e])=>t+": "+e),U,U].join(h)}to_string(){return U+this}toJSON(){return{head:this.#t,[O]:this.#e,body:this[g]}}get status_code(){return+this.#t[m](" ").find(t=>{return(t=+t)==t})}}class rt extends st{constructor(e,s,i={}){return super(e,s,i),B(this,{i:(e,s)=>D+s in e&&!r.getOwnPropertyNames(rt[$]).includes(s)?e[F](s):t})}static[R](t){let e,[s,...r]=t[m](h),i={},n=[];r[w]-=2;for(let t of r){let[s,r]=V(t,": ");/^\w[^\s]*$/.test(s)?i[e=s]=r:e?i[e]+=h+t:n.push(t)}return new rt(s,i,n)}[F](t){return this[D+t]}#s;get passthroughs(){return this.#s??=et().push(this.map((e,s)=>s.startsWith(D)?[s.slice(16),e]:t))}get raw(){return this}}class it extends st{constructor(t){var[t,...s]=t[m](h);super(t,{});for(let t of s)if(t){let[e,s]=V(t,""),[r,i]=V(e,".");(this[r]||=et())[i]=s}}get_uuid_by(t,e){return this.uuids.find(s=>this[s][t]==e)}get_list_of(t){return this.uuids.map(e=>this[e][t])}get uuids(){return this.keys}get[y](){return!!this[w]}toString(){return[this.head,U,...this[G]((t,e,s)=>t+"."+e+""+s),U,U].join(h)}toJSON(){return{head:this.head,fmo_infos:this[g]}}}class nt extends K{#r;#i;#n;#h;#u;constructor(t){super((t,e=this[p])=>this[M](t,e)),this.#r=t,this[p]=t[p]}async[M](t,e=this[p]){return this.#n?this.#h[e].includes(t):!!this.#i&&(this.#u[e][t]??=await this.#r[l](t))}get[y](){return this.#i}get fast_query_available(){return this.#n}reset(){return this.clear(),this.init()}async init(){var t=this.#r;return this.#i=await t[l](a),this.#n=this.#i&&await t[l](o),this.#n&&(this.#h=await t[_]()),this}clear(){this.#i=this.#n=!1,this.#u={[e]:{},[s]:{}}}}class ht{#o;constructor(e,s){return this[I]={Origin:W},this[f]={Charset:"UTF-8"},this.host=s,this[k]=e,this[d]={[q]:1.4,NOTIFY:1.1,COMMUNICATE:1.1,EXECUTE:1.2,GIVE:1.1},this[p]=Z,this[C]=B(this,{i:(e,s)=>Y(e[d][s],A)?e[E](s):/^On/.test(s)?e[c]((t=>"_"==t[2]?t[v](3):t)(s)):t})}get clone(){var t=this;return n(new ht,{[I]:t[I],[f]:t[f],[p]:t[p],[d]:t[d],host:t.host})}by_fmo_info(t){var e=this.clone;return e.ghost_info=t,e[f].ReceiverGhostHWnd=t.hwnd,e}for_all_ghosts(t=t=>t){let e=et();return this.get_fmo_infos().then(s=>{for(var r in s)e[r]=t?.(this.by_fmo_info(s[r]));return e})}set host(t){this.#o=t||Q()+"/api/sstp/v1"}get host(){return this.#o}set[k](t){this[f].Sender=t||"jsstp-client"}get[k](){return this[f].Sender}async row_send(t){t=await fetch(this.#o,{method:"POST",headers:this[I],body:U+t});return 200!=t.status&&L(t.status),t.text()}[S](t,e){return this.row_send(new rt(t,{...this[f],...e}))}costom_send(t,e){return this[S](t,e)[P](t=>rt[R](t))}[E](t){let e=t+" SSTP/"+this[d][t];return n(t=>this.costom_send(e,t),{get_raw:t=>this[S](e,t)})}#a(t,e,s,r){return new i(s,{get:(s,i)=>i in s?s[i]:this[r](t+"."+i,e)})}[T](t,e=q){return this.#a(t,e,s=>this[C][e](n({Event:t},s)),T)}[c](t,e=q){return this.#a(t,e,(...s)=>{let r=0,i={};return s[x](t=>i["Reference"+r++]=t),this[T](t,e)(i)},c)}get event(){return new i({},{get:(t,e)=>this[c](e)})}[l](t,e=this[p]){return this.event[a](t,e)[P](({Result:t})=>1==t)}[_](){return this.event[o]()[P](({[e]:t,[s]:r})=>({[e]:(t||U)[m](","),[s]:(r||U)[m](",")}))}[j](){return this[C].EXECUTE.get_raw({Command:"GetFMO"})[P](t=>new it(t))}[y](){return this[j]()[P](t=>t[y],()=>!1)}[P](t,e){return this[y]()[P](s=>s?t?.(this[C]):(e??L)(s))}new_event_queryer(){return new nt(this).init()}}n(ht[$],{type:ht,base_sstp_info_t:st,sstp_info_t:rt,fmo_info_t:it,ghost_events_queryer_t:nt});u=new ht;export{st as base_sstp_info_t,u as default,it as fmo_info_t,nt as ghost_events_queryer_t,u as jsstp,ht as jsstp_t,rt as sstp_info_t}