{"version":3,"file":"hooks-D4gUJQDD.cjs","names":["option","options","value","labels","values","isBytes","abytes","aexists","clean","hexes","bytesToHex","utf8ToBytes","bytesToUtf8","toBytes","concatBytes","Hash","randomBytes","_0n","_1n","abool","isBytes_","hexToNumber","bytesToHex_","hexToBytes_","numberToVarBytesBE","equalBytes","copyBytes","asciiToBytes","bitGet","bitSet","concatBytes_","isHash","notImplemented","abytes","u.abytes","anumber","u.anumber","bytesToHex","u.bytesToHex","u.bytesToUtf8","u.concatBytes","hexToBytes","u.hexToBytes","isBytes","u.isBytes","randomBytes","u.randomBytes","utf8ToBytes","u.utf8ToBytes","u.abool","numberToHexUnpadded","u.numberToHexUnpadded","u.hexToNumber","bytesToNumberBE","u.bytesToNumberBE","bytesToNumberLE","u.bytesToNumberLE","numberToBytesBE","u.numberToBytesBE","numberToBytesLE","u.numberToBytesLE","u.numberToVarBytesBE","ensureBytes","u.ensureBytes","u.equalBytes","copyBytes","u.copyBytes","u.asciiToBytes","inRange","u.inRange","aInRange","u.aInRange","bitLen","u.bitLen","u.bitGet","u.bitSet","bitMask","u.bitMask","createHmacDrbg","u.createHmacDrbg","u.notImplemented","memoized","u.memoized","validateObject","u.validateObject","u.isHash","HMAC","Hash","toBytes","hmac","_0n","_1n","_2n","_3n","_4n","field","_0n","_1n","window","field","wbits","concatBytes","abytes","endo","bytesToHex","randomBytesWeb","getSharedSecret","randomBytes","hmac","nobleHmac","r","s","isBytes","toBytes","toBytes","utils.hexToNumber","createView","setBigUint64","utils2.numberToBytesBE","utils2.bytesToHex","utils2.hexToNumber","utils3.concatBytes","utils4.hexToNumber","utils4.numberToHexUnpadded","utils4.concatBytes","utils5.concatBytes","utils5.hexToNumber","utils5.numberToHexUnpadded","utils5.bytesToHex","createView2","sm2","sm3","sm4"],"sources":["../hooks/network.js","../hooks/utils.js","../hooks/form.js","../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/crypto.js","../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js","../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/utils.js","../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/utils.js","../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/hmac.js","../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/modular.js","../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/curve.js","../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/weierstrass.js","../node_modules/.pnpm/@noble+ciphers@1.3.0/node_modules/@noble/ciphers/esm/utils.js","../node_modules/.pnpm/@noble+ciphers@1.3.0/node_modules/@noble/ciphers/esm/_polyval.js","../node_modules/.pnpm/sm-crypto-v2@1.15.1/node_modules/sm-crypto-v2/dist/index.mjs","../hooks/cipher.js","../hooks/datetime.js","../hooks/regex.js"],"sourcesContent":["import axios from \"axios\"\nimport { allowMultipleToast, closeToast, showLoadingToast } from \"vant\"\nimport { isObject, isString } from \"lodash-es\"\n\n/**\n * 请求返回状态码\n * @type {{STATE_CODE_NOT_FOUND: string, STATE_CODE_SUCCESS: string, STATE_CODE_FAIL: string, STATE_CODE_INFO_NOT_COMPLETE: string, STATE_CODE_NOT_ALLOWED: string}}\n */\nexport const STATUS = {\n\tSTATE_CODE_SUCCESS: \"SUCCESS\", // 成功\n\tSTATE_CODE_FAIL: \"FAIL\", // 失败\n\tSTATE_CODE_NOT_FOUND: \"NOT_FOUND\", // 找不到资源\n\tSTATE_CODE_INFO_NOT_COMPLETE: \"INCOMPLETE\", // 信息不完整\n\tSTATE_CODE_NOT_ALLOWED: \"NOT_ALLOWED\", //没有权限\n}\n\n/**\n * STATUS 适配器，内部使用\n * @param status\n * @private\n */\nexport function _configStatus(status) {\n\tObject.keys(status).forEach((key) => {\n\t\tSTATUS[key] = status[key]\n\t})\n}\n\n/**\n * 通用 AJAX 请求\n * @param {Object} [fetcher] - 用于存储请求状态的对象\n * @returns {{post(*=, *=, *=): Promise<unknown>, get(*=, *=): Promise<unknown>}}\n */\nexport function useFetch(fetcher) {\n\t// 记录当前 Fetcher 是否处于 Loading 状态\n\tlet globalLoading = null\n\n\tif (!fetcher) {\n\t\tfetcher = {}\n\t}\n\tfetcher.loading = true\n\n\treturn {\n\t\t/**\n\t\t * get请求\n\t\t * @param url\n\t\t * @param {Object} [config] - axios config\n\t\t * @returns {Promise<unknown>}\n\t\t */\n\t\tget(url, config) {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\taxios\n\t\t\t\t\t.get(url, config)\n\t\t\t\t\t.then((res) => {\n\t\t\t\t\t\tresolve(res)\n\t\t\t\t\t})\n\t\t\t\t\t.catch((err) => {\n\t\t\t\t\t\treject(err)\n\t\t\t\t\t})\n\t\t\t\t\t.finally(() => {\n\t\t\t\t\t\tif (globalLoading) {\n\t\t\t\t\t\t\tallowMultipleToast(false)\n\t\t\t\t\t\t\tglobalLoading.close()\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfetcher.loading = false\n\t\t\t\t\t})\n\t\t\t})\n\t\t},\n\t\t/**\n\t\t * post请求\n\t\t * @param {string} url\n\t\t * @param {Object} data\n\t\t * @param {Object} [config] - axios config\n\t\t * @returns {Promise<unknown>}\n\t\t */\n\t\tpost(url, data, config) {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\taxios\n\t\t\t\t\t.post(url, data, config)\n\t\t\t\t\t.then((res) => {\n\t\t\t\t\t\tresolve(res)\n\t\t\t\t\t})\n\t\t\t\t\t.catch((err) => {\n\t\t\t\t\t\treject(err)\n\t\t\t\t\t})\n\t\t\t\t\t.finally(() => {\n\t\t\t\t\t\tif (globalLoading) {\n\t\t\t\t\t\t\tallowMultipleToast(false)\n\t\t\t\t\t\t\tglobalLoading.close()\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfetcher.loading = false\n\t\t\t\t\t})\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * 参数为\n\t\t * @param {String|Object} [message] Toast 的 Message 或者是 Toast 的配置\n\t\t * @return {*}\n\t\t */\n\t\tloading(message) {\n\t\t\tcloseToast(true)\n\t\t\tallowMultipleToast()\n\t\t\tif (isString(message)) {\n\t\t\t\tglobalLoading = showLoadingToast({\n\t\t\t\t\tmessage: message || \"加载中...\",\n\t\t\t\t\tduration: 0,\n\t\t\t\t\tforbidClick: true,\n\t\t\t\t})\n\t\t\t} else if (isObject(message)) {\n\t\t\t\tglobalLoading = showLoadingToast({ duration: 0, ...message })\n\t\t\t} else {\n\t\t\t\tglobalLoading = showLoadingToast({\n\t\t\t\t\tmessage: \"加载中...\",\n\t\t\t\t\tduration: 0,\n\t\t\t\t\tforbidClick: true,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\treturn this\n\t\t},\n\t}\n}\n","import { find, flatMapDeep, isNull, isUndefined, reduce } from \"lodash-es\"\n\n/**\n * 从 options 中根据 value 获取 text\n * @param value\n * @param options\n * * @param {Object} [adapter={value: \"value\",label: \"label\",children: \"children\"}] - 选项适配器\n * @param adapter\n * @return {*|string|string}\n */\nexport function useTextFromOptionsValue(value, options, adapter) {\n\tif (!options) {\n\t\treturn \"\"\n\t}\n\tadapter = adapter || {\n\t\tvalue: \"value\",\n\t\tlabel: \"text\",\n\t}\n\tconst option = options.find((option) => option[adapter.value] === value)\n\treturn option ? option[adapter.label] : \"\"\n}\n\n/**\n * 从嵌套的 options 中根据 value 获取 text, 如 [1, 3] => [\"东\", \"南\"]\n *\n * @param {Array} options - 嵌套的选项\n * @param {Array} values - 需要查找的值\n * @param {Object} [adapter={value: \"value\",label: \"label\",children: \"children\"}] - 选项适配器\n * @return Array\n */\nexport function useFindTextsInValues(options, values, adapter) {\n\tadapter = adapter || {\n\t\tvalue: \"value\",\n\t\tlabel: \"text\",\n\t\tchildren: \"children\",\n\t}\n\n\tconst labels = []\n\n\tfunction recursiveSearch(node) {\n\t\tif (values.includes(node[adapter.value])) {\n\t\t\tlabels.push(node[adapter.label])\n\t\t}\n\n\t\tif (node[adapter.children]?.length) {\n\t\t\tnode[adapter.children].forEach((child) => {\n\t\t\t\trecursiveSearch(child)\n\t\t\t})\n\t\t}\n\t}\n\n\toptions.forEach((item) => {\n\t\trecursiveSearch(item)\n\t})\n\n\treturn labels\n}\n\n/**\n * 从嵌套的 options 中根据 value 获取 label, 如地区路径:  [440000, 440100, 440113] => ['广东省', '广州市', '番禺区']\n * @param {Array} options\n * @param {Array} path\n * @param {Object} [adapter]\n * @return Array\n */\nexport function useFindLabelsFromPath(options, path, adapter) {\n\tadapter = adapter || {\n\t\tvalue: \"value\",\n\t\tlabel: \"text\",\n\t\tchildren: \"children\",\n\t}\n\n\tlet labels = []\n\treduce(\n\t\tpath,\n\t\t(acc, value) => {\n\t\t\tconst item = find(acc, { [adapter.value]: value })\n\t\t\tif (item) {\n\t\t\t\tlabels.push(item[adapter.label])\n\t\t\t\treturn item[adapter.children]\n\t\t\t}\n\t\t},\n\t\toptions,\n\t)\n\treturn labels\n}\n\n/**\n * 从 options 为 [{text: \"\", value: \"\", children: []] 样式的多层数组中，根据所给的 value 递归找出该 option\n * @param {Array} options\n * @param {Number|String} value\n * @param {Object} [adapter]\n * @return {Object|null}\n */\nexport function useFindOptionByValue(options, value, adapter) {\n\tadapter = adapter || {\n\t\tvalue: \"value\",\n\t\tlabel: \"text\",\n\t\tchildren: \"children\",\n\t}\n\n\t// 遍历 options 数组\n\tfor (let option of options) {\n\t\t// 如果当前 option 的 value 匹配目标值，则返回当前 option\n\t\tif (option[adapter.value] === value) {\n\t\t\treturn option\n\t\t}\n\t\t// 如果当前 option 有子选项\n\t\tif (option[adapter.children] && option[adapter.children].length) {\n\t\t\t// 递归搜索子选项数组\n\t\t\tconst foundOption = useFindOptionByValue(option[adapter.children], value, adapter)\n\t\t\t// 如果找到了匹配的子选项，则返回\n\t\t\tif (foundOption) {\n\t\t\t\treturn foundOption\n\t\t\t}\n\t\t}\n\t}\n\t// 如果未找到匹配的选项，则返回 null\n\treturn null\n}\n\n/**\n * [移动端适配]\n * 从嵌套的 options 中根据 value 获取 text\n * @param {Array} options\n * @param {Array} path\n * @param {Object} [adapter]\n * @return Array\n */\nexport function useFindTextsFromPath(options, path, adapter) {\n\tadapter = adapter || {\n\t\tvalue: \"value\",\n\t\tlabel: \"text\",\n\t\tchildren: \"children\",\n\t}\n\treturn useFindLabelsFromPath(options, path, adapter)\n}\n\n/**\n * let obj = {\n *     \"name\": \"西学楼1号\",\n *     \"parent\": {\n *         \"name\": \"学生宿舍\",\n *         \"parent\": {\n *             \"name\": \"宿舍区域\",\n *         }\n *     }\n * }\n * useFindPropertyRecursive(obj, 'name', 'parent') // [\"西学楼1号\", \"学生宿舍\", \"宿舍区域\"]\n *\n * 从嵌套的对象中递归获取某个属性\n * @param {Object} item 获取对象\n * @param {String} propertyKey 想获取的属性名称\n * @param {String} nestedKey 嵌套的属性\n * @return Array\n */\nexport function useFindPropertyRecursive(item, propertyKey, nestedKey) {\n\treturn flatMapDeep(item, (value, key) => {\n\t\tif (key === propertyKey) {\n\t\t\treturn value\n\t\t}\n\t\tif (key === nestedKey) {\n\t\t\treturn useFindPropertyRecursive(value, propertyKey, nestedKey)\n\t\t}\n\t\treturn []\n\t})\n}\n\n/**\n * 从嵌套的 options 中根据 value 获取 text 路径, 如地区路径: 440113 => [\"广东省\", \"广州市\", \" 番禺区\"]\n * @param options\n * @param value\n * @param adapter\n * @return {*}\n */\nexport function useFindParentLabels(options, value, adapter) {\n\tadapter = adapter || {\n\t\tvalue: \"value\",\n\t\tlabel: \"text\",\n\t\tchildren: \"children\",\n\t}\n\n\tconst labels = []\n\n\tfunction findParentLabels(options, value, labels) {\n\t\tfor (const option of options) {\n\t\t\tif (option[adapter.value] === value) {\n\t\t\t\tlabels.unshift(option[adapter.label])\n\t\t\t\tbreak\n\t\t\t} else if (option[adapter.children]) {\n\t\t\t\tconst childResult = findParentLabels(option[adapter.children], value, labels)\n\t\t\t\tif (childResult.length > 0) {\n\t\t\t\t\tlabels.unshift(option[adapter.label])\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn labels\n\t}\n\n\treturn findParentLabels(options, value, labels)\n}\n\n/**\n * 从嵌套的 options 中根据 value 获取整个 values 路径, 如地区路径: 440113 => [440000, 440100, 440113]\n * @param options\n * @param value\n * @param adapter\n * @return Array\n */\nexport function useFindParentValues(options, value, adapter) {\n\tadapter = adapter || {\n\t\tvalue: \"value\",\n\t\tlabel: \"text\",\n\t\tchildren: \"children\",\n\t}\n\n\tconst values = []\n\n\tfunction findParentValues(options, value, values) {\n\t\tfor (const option of options) {\n\t\t\tif (option[adapter.value] === value) {\n\t\t\t\tvalues.unshift(option[adapter.value])\n\t\t\t\tbreak\n\t\t\t} else if (option[adapter.children]) {\n\t\t\t\tconst childResult = findParentValues(option[adapter.children], value, values)\n\t\t\t\tif (childResult.length > 0) {\n\t\t\t\t\tvalues.unshift(option[adapter.value])\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn values\n\t}\n\n\treturn findParentValues(options, value, values)\n}\n\nconst localCacheSession = {}\nconst localSession = {\n\tsetItem(key, value) {\n\t\tlocalCacheSession[key] = value\n\t},\n\tgetItem(key) {\n\t\treturn localCacheSession[key]\n\t},\n\tremoveItem(key) {\n\t\tdelete localCacheSession[key]\n\t},\n}\n\nwindow._printCache = () => {\n\tconsole.log(JSON.parse(JSON.stringify(localCacheSession, null, 2)))\n}\n\n/**\n * 用于储存缓存的值\n * @param {*} key 缓存的 key\n * @param {*} [sessionType] 缓存的类型，默认为内存缓存\n * @returns get(默认值) 获取缓存的值，set(键, 值) 设置缓存的值\n */\nexport function useCache(key, sessionType) {\n\tconst cacheSession = sessionType || localSession\n\tconst shouldTransform = !!sessionType // 如果是 localStorage 之类的，则需要转换一下\n\treturn {\n\t\tget(defaultValue) {\n\t\t\tconst value = cacheSession.getItem(key)\n\t\t\tif (isNull(value) || isUndefined(value)) {\n\t\t\t\treturn defaultValue\n\t\t\t}\n\t\t\treturn shouldTransform ? JSON.parse(value) : value\n\t\t},\n\t\tset(value) {\n\t\t\tcacheSession.setItem(key, shouldTransform ? JSON.stringify(value) : value)\n\t\t},\n\t\tremove() {\n\t\t\tcacheSession.removeItem(key)\n\t\t},\n\t}\n}\n","import { cloneDeep, isArray, isBoolean, isDate, isFunction, isObject, isString, isUndefined } from \"lodash-es\"\nimport { STATUS } from \"./network\"\nimport { showFailToast, showSuccessToast } from \"vant\"\nimport dayjs from \"dayjs\"\n\n/**\n * 创建一个隐藏的表单\n *\n * @param {Object} options\n * @param {string} options.url\n * @param {Object} options.data\n * @param {string} [options.method]\n * @param {string} options.csrfToken\n * @returns {HTMLFormElement}\n */\nexport function useHiddenForm(options) {\n\tconst { url, data, csrfToken } = options\n\tlet { method } = options\n\n\tmethod = method || \"post\"\n\n\tconst form = document.createElement(\"form\")\n\tform.action = url\n\tform.method = method\n\tform.target = \"_blank\"\n\tform.style.display = \"none\"\n\n\tObject.keys(data).forEach((key) => {\n\t\tconst input = document.createElement(\"input\")\n\t\tinput.type = \"hidden\"\n\t\tinput.name = key\n\t\tinput.value = data[key]\n\t\tform.appendChild(input)\n\t})\n\n\tif (!csrfToken) {\n\t\tconst input = document.createElement(\"input\")\n\t\tinput.type = \"hidden\"\n\t\tinput.name = \"_token\"\n\t\tinput.value = document.querySelector('meta[name=\"csrf-token\"]').getAttribute(\"content\")\n\t\tform.appendChild(input)\n\t}\n\n\tdocument.body.appendChild(form)\n\n\treturn form\n}\n\n/**\n * 处理请求结果\n *\n * @param {object} res 请求结果\n * @param {string|number} res.status 请求结果状态\n * @param {*} res.result 请求结果信息\n * @param {Object.<string, string|function>} ops 状态的处理对象\n */\nexport function useProcessStatus(res, ops) {\n\tconst { status } = res\n\tconst msg = res.result\n\tconst predefined = {}\n\tpredefined.default = \"请求失败, 请检查数据并重试\"\n\tpredefined[STATUS.STATE_CODE_FAIL] = \"系统错误，请稍候再试\"\n\tpredefined[STATUS.STATE_CODE_NOT_FOUND] = \"请求的内容不存在\"\n\tpredefined[STATUS.STATE_CODE_INFO_NOT_COMPLETE] = \"信息不完整\"\n\tpredefined[STATUS.STATE_CODE_NOT_ALLOWED] = \"没有权限\"\n\n\t// 有几个常用的自定义名称\n\tconst special = {\n\t\t[STATUS.STATE_CODE_SUCCESS]: \"success\",\n\t}\n\n\tconst op = ops[status] || ops[special[status]] || predefined[status] || predefined.default\n\n\tif (isString(op)) {\n\t\tif (status === STATUS.STATE_CODE_SUCCESS) {\n\t\t\tshowSuccessToast(op)\n\t\t} else {\n\t\t\tshowFailToast(msg || op)\n\t\t}\n\t} else if (isFunction(op)) {\n\t\top()\n\t}\n}\n\n/**\n * 处理正确请求结果\n *\n * @param {object} res 请求结果\n * @param {string} res.status 请求结果状态\n * @param {*} res.result 请求结果信息\n * @param {string|function} success 状态的处理对象\n */\nexport function useProcessStatusSuccess(res, success) {\n\tuseProcessStatus(res, { success })\n}\n\n/**\n * 处理表单提交失败\n * @param {*} e\n */\nexport function useFormFail(e) {\n\tif (e && e.errorFields) {\n\t\te.errorFields.forEach((item) => {\n\t\t\tshowFailToast(item.errors.join(\" \"))\n\t\t})\n\t} else if (!(e && e.response)) {\n\t\tshowFailToast(\"请检查填写项\")\n\t} else {\n\t\tshowFailToast(\"网络异常\")\n\t}\n}\n\n/**\n * 处理表单数据\n * @param {Object} form\n * @param {Object} [format] 需要处理的类型\n * @param {boolean|string|Function} [format.date] `true`: 转成时间戳，`string`: 为 Format 格式, 如 `\"YYYY-MM-DD\"`, `function`: 自定义处理函数, 参数为 dayjs 对象\n * @param {boolean} [format.boolean] 布尔值处理, 如果开启则 `true` 转成 1, `false` 转成 0\n * @param {string|Function} [format.attachment] `string`: 附件字段名, `function`: 自定义处理函数, 参数为附件对象\n * @return {Object}\n */\nexport function useFormFormat(form, format) {\n\t//必须先 Copy form, 否则会改变 vm model 里的引用值而导致出错\n\tconst newForm = cloneDeep(form)\n\tformat = format || {}\n\tconst formatter = (obj) => {\n\t\tfor (let key in obj) {\n\t\t\t//日期处理\n\n\t\t\tlet date\n\t\t\tif (dayjs.isDayjs(obj[key])) {\n\t\t\t\tdate = obj[key]\n\t\t\t} else if (isDate(obj[key])) {\n\t\t\t\tdate = dayjs(obj[key])\n\t\t\t}\n\n\t\t\tif (date && format.date) {\n\t\t\t\tif (isString(format.date)) {\n\t\t\t\t\tobj[key] = date.format(format.date)\n\t\t\t\t} else if (isFunction(format.date)) {\n\t\t\t\t\tobj[key] = format.date(date)\n\t\t\t\t} else {\n\t\t\t\t\tobj[key] = date.unix()\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t//布尔值处理\n\t\t\tif (isBoolean(obj[key]) && format.boolean) {\n\t\t\t\tif (format.boolean === true) {\n\t\t\t\t\tobj[key] = obj[key] ? 1 : 0\n\t\t\t\t} else if (Array.isArray(format.boolean)) {\n\t\t\t\t\tobj[key] = obj[key] ? format.boolean?.[0] || 1 : format.boolean?.[1] || 0\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t//附件处理\n\t\t\tif (format.attachment) {\n\t\t\t\tconst checker = format.attachment\n\t\t\t\tif (isObject(obj[key]) && obj[key]._type === \"file\" && isString(checker) && !isUndefined(obj[key][checker])) {\n\t\t\t\t\tobj[key] = obj[key][checker]\n\t\t\t\t\tcontinue\n\t\t\t\t} else if (isObject(obj[key]) && isFunction(checker) && obj[key]._type === \"file\") {\n\t\t\t\t\tobj[key] = checker(obj[key])\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//数组处理\n\t\t\tif (isArray(obj[key])) {\n\t\t\t\tobj[key] = formatter(obj[key])\n\t\t\t}\n\t\t}\n\n\t\treturn obj\n\t}\n\n\treturn formatter(newForm)\n}\n\nexport default {\n\tuseHiddenForm,\n\tuseProcessStatus,\n\tuseProcessStatusSuccess,\n\tuseFormFail,\n\tuseFormFormat,\n}\n","export const crypto = typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;\n//# sourceMappingURL=crypto.js.map","/**\n * Utilities for hex, bytes, CSPRNG.\n * @module\n */\n/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\n/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */\nexport function isBytes(a) {\n    return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');\n}\n/** Asserts something is positive integer. */\nexport function anumber(n) {\n    if (!Number.isSafeInteger(n) || n < 0)\n        throw new Error('positive integer expected, got ' + n);\n}\n/** Asserts something is Uint8Array. */\nexport function abytes(b, ...lengths) {\n    if (!isBytes(b))\n        throw new Error('Uint8Array expected');\n    if (lengths.length > 0 && !lengths.includes(b.length))\n        throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);\n}\n/** Asserts something is hash */\nexport function ahash(h) {\n    if (typeof h !== 'function' || typeof h.create !== 'function')\n        throw new Error('Hash should be wrapped by utils.createHasher');\n    anumber(h.outputLen);\n    anumber(h.blockLen);\n}\n/** Asserts a hash instance has not been destroyed / finished */\nexport function aexists(instance, checkFinished = true) {\n    if (instance.destroyed)\n        throw new Error('Hash instance has been destroyed');\n    if (checkFinished && instance.finished)\n        throw new Error('Hash#digest() has already been called');\n}\n/** Asserts output is properly-sized byte array */\nexport function aoutput(out, instance) {\n    abytes(out);\n    const min = instance.outputLen;\n    if (out.length < min) {\n        throw new Error('digestInto() expects output buffer of length at least ' + min);\n    }\n}\n/** Cast u8 / u16 / u32 to u8. */\nexport function u8(arr) {\n    return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/** Cast u8 / u16 / u32 to u32. */\nexport function u32(arr) {\n    return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n}\n/** Zeroize a byte array. Warning: JS provides no guarantees. */\nexport function clean(...arrays) {\n    for (let i = 0; i < arrays.length; i++) {\n        arrays[i].fill(0);\n    }\n}\n/** Create DataView of an array for easy byte-level manipulation. */\nexport function createView(arr) {\n    return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/** The rotate right (circular right shift) operation for uint32 */\nexport function rotr(word, shift) {\n    return (word << (32 - shift)) | (word >>> shift);\n}\n/** The rotate left (circular left shift) operation for uint32 */\nexport function rotl(word, shift) {\n    return (word << shift) | ((word >>> (32 - shift)) >>> 0);\n}\n/** Is current platform little-endian? Most are. Big-Endian platform: IBM */\nexport const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();\n/** The byte swap operation for uint32 */\nexport function byteSwap(word) {\n    return (((word << 24) & 0xff000000) |\n        ((word << 8) & 0xff0000) |\n        ((word >>> 8) & 0xff00) |\n        ((word >>> 24) & 0xff));\n}\n/** Conditionally byte swap if on a big-endian platform */\nexport const swap8IfBE = isLE\n    ? (n) => n\n    : (n) => byteSwap(n);\n/** @deprecated */\nexport const byteSwapIfBE = swap8IfBE;\n/** In place byte swap for Uint32Array */\nexport function byteSwap32(arr) {\n    for (let i = 0; i < arr.length; i++) {\n        arr[i] = byteSwap(arr[i]);\n    }\n    return arr;\n}\nexport const swap32IfBE = isLE\n    ? (u) => u\n    : byteSwap32;\n// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex\nconst hasHexBuiltin = /* @__PURE__ */ (() => \n// @ts-ignore\ntypeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * Convert byte array to hex string. Uses built-in function, when available.\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n    abytes(bytes);\n    // @ts-ignore\n    if (hasHexBuiltin)\n        return bytes.toHex();\n    // pre-caching improves the speed 6x\n    let hex = '';\n    for (let i = 0; i < bytes.length; i++) {\n        hex += hexes[bytes[i]];\n    }\n    return hex;\n}\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };\nfunction asciiToBase16(ch) {\n    if (ch >= asciis._0 && ch <= asciis._9)\n        return ch - asciis._0; // '2' => 50-48\n    if (ch >= asciis.A && ch <= asciis.F)\n        return ch - (asciis.A - 10); // 'B' => 66-(65-10)\n    if (ch >= asciis.a && ch <= asciis.f)\n        return ch - (asciis.a - 10); // 'b' => 98-(97-10)\n    return;\n}\n/**\n * Convert hex string to byte array. Uses built-in function, when available.\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n    if (typeof hex !== 'string')\n        throw new Error('hex string expected, got ' + typeof hex);\n    // @ts-ignore\n    if (hasHexBuiltin)\n        return Uint8Array.fromHex(hex);\n    const hl = hex.length;\n    const al = hl / 2;\n    if (hl % 2)\n        throw new Error('hex string expected, got unpadded hex of length ' + hl);\n    const array = new Uint8Array(al);\n    for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n        const n1 = asciiToBase16(hex.charCodeAt(hi));\n        const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n        if (n1 === undefined || n2 === undefined) {\n            const char = hex[hi] + hex[hi + 1];\n            throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n        }\n        array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163\n    }\n    return array;\n}\n/**\n * There is no setImmediate in browser and setTimeout is slow.\n * Call of async fn will return Promise, which will be fullfiled only on\n * next scheduler queue processing step and this is exactly what we need.\n */\nexport const nextTick = async () => { };\n/** Returns control to thread each 'tick' ms to avoid blocking. */\nexport async function asyncLoop(iters, tick, cb) {\n    let ts = Date.now();\n    for (let i = 0; i < iters; i++) {\n        cb(i);\n        // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n        const diff = Date.now() - ts;\n        if (diff >= 0 && diff < tick)\n            continue;\n        await nextTick();\n        ts += diff;\n    }\n}\n/**\n * Converts string to bytes using UTF8 encoding.\n * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n    if (typeof str !== 'string')\n        throw new Error('string expected');\n    return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Converts bytes to string using UTF8 encoding.\n * @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'\n */\nexport function bytesToUtf8(bytes) {\n    return new TextDecoder().decode(bytes);\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data) {\n    if (typeof data === 'string')\n        data = utf8ToBytes(data);\n    abytes(data);\n    return data;\n}\n/**\n * Helper for KDFs: consumes uint8array or string.\n * When string is passed, does utf8 decoding, using TextDecoder.\n */\nexport function kdfInputToBytes(data) {\n    if (typeof data === 'string')\n        data = utf8ToBytes(data);\n    abytes(data);\n    return data;\n}\n/** Copies several Uint8Arrays into one. */\nexport function concatBytes(...arrays) {\n    let sum = 0;\n    for (let i = 0; i < arrays.length; i++) {\n        const a = arrays[i];\n        abytes(a);\n        sum += a.length;\n    }\n    const res = new Uint8Array(sum);\n    for (let i = 0, pad = 0; i < arrays.length; i++) {\n        const a = arrays[i];\n        res.set(a, pad);\n        pad += a.length;\n    }\n    return res;\n}\nexport function checkOpts(defaults, opts) {\n    if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')\n        throw new Error('options should be object or undefined');\n    const merged = Object.assign(defaults, opts);\n    return merged;\n}\n/** For runtime check if class implements interface */\nexport class Hash {\n}\n/** Wraps hash function, creating an interface on top of it */\nexport function createHasher(hashCons) {\n    const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n    const tmp = hashCons();\n    hashC.outputLen = tmp.outputLen;\n    hashC.blockLen = tmp.blockLen;\n    hashC.create = () => hashCons();\n    return hashC;\n}\nexport function createOptHasher(hashCons) {\n    const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n    const tmp = hashCons({});\n    hashC.outputLen = tmp.outputLen;\n    hashC.blockLen = tmp.blockLen;\n    hashC.create = (opts) => hashCons(opts);\n    return hashC;\n}\nexport function createXOFer(hashCons) {\n    const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n    const tmp = hashCons({});\n    hashC.outputLen = tmp.outputLen;\n    hashC.blockLen = tmp.blockLen;\n    hashC.create = (opts) => hashCons(opts);\n    return hashC;\n}\nexport const wrapConstructor = createHasher;\nexport const wrapConstructorWithOpts = createOptHasher;\nexport const wrapXOFConstructorWithOpts = createXOFer;\n/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */\nexport function randomBytes(bytesLength = 32) {\n    if (crypto && typeof crypto.getRandomValues === 'function') {\n        return crypto.getRandomValues(new Uint8Array(bytesLength));\n    }\n    // Legacy Node.js compatibility\n    if (crypto && typeof crypto.randomBytes === 'function') {\n        return Uint8Array.from(crypto.randomBytes(bytesLength));\n    }\n    throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map","/**\n * Hex, bytes and number utilities.\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { abytes as abytes_, bytesToHex as bytesToHex_, concatBytes as concatBytes_, hexToBytes as hexToBytes_, isBytes as isBytes_, } from '@noble/hashes/utils.js';\nexport { abytes, anumber, bytesToHex, bytesToUtf8, concatBytes, hexToBytes, isBytes, randomBytes, utf8ToBytes, } from '@noble/hashes/utils.js';\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nexport function abool(title, value) {\n    if (typeof value !== 'boolean')\n        throw new Error(title + ' boolean expected, got ' + value);\n}\n// tmp name until v2\nexport function _abool2(value, title = '') {\n    if (typeof value !== 'boolean') {\n        const prefix = title && `\"${title}\"`;\n        throw new Error(prefix + 'expected boolean, got type=' + typeof value);\n    }\n    return value;\n}\n// tmp name until v2\n/** Asserts something is Uint8Array. */\nexport function _abytes2(value, length, title = '') {\n    const bytes = isBytes_(value);\n    const len = value?.length;\n    const needsLen = length !== undefined;\n    if (!bytes || (needsLen && len !== length)) {\n        const prefix = title && `\"${title}\" `;\n        const ofLen = needsLen ? ` of length ${length}` : '';\n        const got = bytes ? `length=${len}` : `type=${typeof value}`;\n        throw new Error(prefix + 'expected Uint8Array' + ofLen + ', got ' + got);\n    }\n    return value;\n}\n// Used in weierstrass, der\nexport function numberToHexUnpadded(num) {\n    const hex = num.toString(16);\n    return hex.length & 1 ? '0' + hex : hex;\n}\nexport function hexToNumber(hex) {\n    if (typeof hex !== 'string')\n        throw new Error('hex string expected, got ' + typeof hex);\n    return hex === '' ? _0n : BigInt('0x' + hex); // Big Endian\n}\n// BE: Big Endian, LE: Little Endian\nexport function bytesToNumberBE(bytes) {\n    return hexToNumber(bytesToHex_(bytes));\n}\nexport function bytesToNumberLE(bytes) {\n    abytes_(bytes);\n    return hexToNumber(bytesToHex_(Uint8Array.from(bytes).reverse()));\n}\nexport function numberToBytesBE(n, len) {\n    return hexToBytes_(n.toString(16).padStart(len * 2, '0'));\n}\nexport function numberToBytesLE(n, len) {\n    return numberToBytesBE(n, len).reverse();\n}\n// Unpadded, rarely used\nexport function numberToVarBytesBE(n) {\n    return hexToBytes_(numberToHexUnpadded(n));\n}\n/**\n * Takes hex string or Uint8Array, converts to Uint8Array.\n * Validates output length.\n * Will throw error for other types.\n * @param title descriptive title for an error e.g. 'secret key'\n * @param hex hex string or Uint8Array\n * @param expectedLength optional, will compare to result array's length\n * @returns\n */\nexport function ensureBytes(title, hex, expectedLength) {\n    let res;\n    if (typeof hex === 'string') {\n        try {\n            res = hexToBytes_(hex);\n        }\n        catch (e) {\n            throw new Error(title + ' must be hex string or Uint8Array, cause: ' + e);\n        }\n    }\n    else if (isBytes_(hex)) {\n        // Uint8Array.from() instead of hash.slice() because node.js Buffer\n        // is instance of Uint8Array, and its slice() creates **mutable** copy\n        res = Uint8Array.from(hex);\n    }\n    else {\n        throw new Error(title + ' must be hex string or Uint8Array');\n    }\n    const len = res.length;\n    if (typeof expectedLength === 'number' && len !== expectedLength)\n        throw new Error(title + ' of length ' + expectedLength + ' expected, got ' + len);\n    return res;\n}\n// Compares 2 u8a-s in kinda constant time\nexport function equalBytes(a, b) {\n    if (a.length !== b.length)\n        return false;\n    let diff = 0;\n    for (let i = 0; i < a.length; i++)\n        diff |= a[i] ^ b[i];\n    return diff === 0;\n}\n/**\n * Copies Uint8Array. We can't use u8a.slice(), because u8a can be Buffer,\n * and Buffer#slice creates mutable copy. Never use Buffers!\n */\nexport function copyBytes(bytes) {\n    return Uint8Array.from(bytes);\n}\n/**\n * Decodes 7-bit ASCII string to Uint8Array, throws on non-ascii symbols\n * Should be safe to use for things expected to be ASCII.\n * Returns exact same result as utf8ToBytes for ASCII or throws.\n */\nexport function asciiToBytes(ascii) {\n    return Uint8Array.from(ascii, (c, i) => {\n        const charCode = c.charCodeAt(0);\n        if (c.length !== 1 || charCode > 127) {\n            throw new Error(`string contains non-ASCII character \"${ascii[i]}\" with code ${charCode} at position ${i}`);\n        }\n        return charCode;\n    });\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\n// export const utf8ToBytes: typeof utf8ToBytes_ = utf8ToBytes_;\n/**\n * Converts bytes to string using UTF8 encoding.\n * @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'\n */\n// export const bytesToUtf8: typeof bytesToUtf8_ = bytesToUtf8_;\n// Is positive bigint\nconst isPosBig = (n) => typeof n === 'bigint' && _0n <= n;\nexport function inRange(n, min, max) {\n    return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;\n}\n/**\n * Asserts min <= n < max. NOTE: It's < max and not <= max.\n * @example\n * aInRange('x', x, 1n, 256n); // would assume x is in (1n..255n)\n */\nexport function aInRange(title, n, min, max) {\n    // Why min <= n < max and not a (min < n < max) OR b (min <= n <= max)?\n    // consider P=256n, min=0n, max=P\n    // - a for min=0 would require -1:          `inRange('x', x, -1n, P)`\n    // - b would commonly require subtraction:  `inRange('x', x, 0n, P - 1n)`\n    // - our way is the cleanest:               `inRange('x', x, 0n, P)\n    if (!inRange(n, min, max))\n        throw new Error('expected valid ' + title + ': ' + min + ' <= n < ' + max + ', got ' + n);\n}\n// Bit operations\n/**\n * Calculates amount of bits in a bigint.\n * Same as `n.toString(2).length`\n * TODO: merge with nLength in modular\n */\nexport function bitLen(n) {\n    let len;\n    for (len = 0; n > _0n; n >>= _1n, len += 1)\n        ;\n    return len;\n}\n/**\n * Gets single bit at position.\n * NOTE: first bit position is 0 (same as arrays)\n * Same as `!!+Array.from(n.toString(2)).reverse()[pos]`\n */\nexport function bitGet(n, pos) {\n    return (n >> BigInt(pos)) & _1n;\n}\n/**\n * Sets single bit at position.\n */\nexport function bitSet(n, pos, value) {\n    return n | ((value ? _1n : _0n) << BigInt(pos));\n}\n/**\n * Calculate mask for N bits. Not using ** operator with bigints because of old engines.\n * Same as BigInt(`0b${Array(i).fill('1').join('')}`)\n */\nexport const bitMask = (n) => (_1n << BigInt(n)) - _1n;\n/**\n * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n * @returns function that will call DRBG until 2nd arg returns something meaningful\n * @example\n *   const drbg = createHmacDRBG<Key>(32, 32, hmac);\n *   drbg(seed, bytesToKey); // bytesToKey must return Key or undefined\n */\nexport function createHmacDrbg(hashLen, qByteLen, hmacFn) {\n    if (typeof hashLen !== 'number' || hashLen < 2)\n        throw new Error('hashLen must be a number');\n    if (typeof qByteLen !== 'number' || qByteLen < 2)\n        throw new Error('qByteLen must be a number');\n    if (typeof hmacFn !== 'function')\n        throw new Error('hmacFn must be a function');\n    // Step B, Step C: set hashLen to 8*ceil(hlen/8)\n    const u8n = (len) => new Uint8Array(len); // creates Uint8Array\n    const u8of = (byte) => Uint8Array.of(byte); // another shortcut\n    let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n    let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same\n    let i = 0; // Iterations counter, will throw when over 1000\n    const reset = () => {\n        v.fill(1);\n        k.fill(0);\n        i = 0;\n    };\n    const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values)\n    const reseed = (seed = u8n(0)) => {\n        // HMAC-DRBG reseed() function. Steps D-G\n        k = h(u8of(0x00), seed); // k = hmac(k || v || 0x00 || seed)\n        v = h(); // v = hmac(k || v)\n        if (seed.length === 0)\n            return;\n        k = h(u8of(0x01), seed); // k = hmac(k || v || 0x01 || seed)\n        v = h(); // v = hmac(k || v)\n    };\n    const gen = () => {\n        // HMAC-DRBG generate() function\n        if (i++ >= 1000)\n            throw new Error('drbg: tried 1000 values');\n        let len = 0;\n        const out = [];\n        while (len < qByteLen) {\n            v = h();\n            const sl = v.slice();\n            out.push(sl);\n            len += v.length;\n        }\n        return concatBytes_(...out);\n    };\n    const genUntil = (seed, pred) => {\n        reset();\n        reseed(seed); // Steps D-G\n        let res = undefined; // Step H: grind until k is in [1..n-1]\n        while (!(res = pred(gen())))\n            reseed();\n        reset();\n        return res;\n    };\n    return genUntil;\n}\n// Validating curves and fields\nconst validatorFns = {\n    bigint: (val) => typeof val === 'bigint',\n    function: (val) => typeof val === 'function',\n    boolean: (val) => typeof val === 'boolean',\n    string: (val) => typeof val === 'string',\n    stringOrUint8Array: (val) => typeof val === 'string' || isBytes_(val),\n    isSafeInteger: (val) => Number.isSafeInteger(val),\n    array: (val) => Array.isArray(val),\n    field: (val, object) => object.Fp.isValid(val),\n    hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen),\n};\n// type Record<K extends string | number | symbol, T> = { [P in K]: T; }\nexport function validateObject(object, validators, optValidators = {}) {\n    const checkField = (fieldName, type, isOptional) => {\n        const checkVal = validatorFns[type];\n        if (typeof checkVal !== 'function')\n            throw new Error('invalid validator function');\n        const val = object[fieldName];\n        if (isOptional && val === undefined)\n            return;\n        if (!checkVal(val, object)) {\n            throw new Error('param ' + String(fieldName) + ' is invalid. Expected ' + type + ', got ' + val);\n        }\n    };\n    for (const [fieldName, type] of Object.entries(validators))\n        checkField(fieldName, type, false);\n    for (const [fieldName, type] of Object.entries(optValidators))\n        checkField(fieldName, type, true);\n    return object;\n}\n// validate type tests\n// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 };\n// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok!\n// // Should fail type-check\n// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' });\n// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' });\n// const z3 = validateObject(o, { test: 'boolean', z: 'bug' });\n// const z4 = validateObject(o, { a: 'boolean', z: 'bug' });\nexport function isHash(val) {\n    return typeof val === 'function' && Number.isSafeInteger(val.outputLen);\n}\nexport function _validateObject(object, fields, optFields = {}) {\n    if (!object || typeof object !== 'object')\n        throw new Error('expected valid options object');\n    function checkField(fieldName, expectedType, isOpt) {\n        const val = object[fieldName];\n        if (isOpt && val === undefined)\n            return;\n        const current = typeof val;\n        if (current !== expectedType || val === null)\n            throw new Error(`param \"${fieldName}\" is invalid: expected ${expectedType}, got ${current}`);\n    }\n    Object.entries(fields).forEach(([k, v]) => checkField(k, v, false));\n    Object.entries(optFields).forEach(([k, v]) => checkField(k, v, true));\n}\n/**\n * throws not implemented error\n */\nexport const notImplemented = () => {\n    throw new Error('not implemented');\n};\n/**\n * Memoizes (caches) computation result.\n * Uses WeakMap: the value is going auto-cleaned by GC after last reference is removed.\n */\nexport function memoized(fn) {\n    const map = new WeakMap();\n    return (arg, ...args) => {\n        const val = map.get(arg);\n        if (val !== undefined)\n            return val;\n        const computed = fn(arg, ...args);\n        map.set(arg, computed);\n        return computed;\n    };\n}\n//# sourceMappingURL=utils.js.map","/**\n * Deprecated module: moved from curves/abstract/utils.js to curves/utils.js\n * @module\n */\nimport * as u from \"../utils.js\";\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const abytes = u.abytes;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const anumber = u.anumber;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const bytesToHex = u.bytesToHex;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const bytesToUtf8 = u.bytesToUtf8;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const concatBytes = u.concatBytes;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const hexToBytes = u.hexToBytes;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const isBytes = u.isBytes;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const randomBytes = u.randomBytes;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const utf8ToBytes = u.utf8ToBytes;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const abool = u.abool;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const numberToHexUnpadded = u.numberToHexUnpadded;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const hexToNumber = u.hexToNumber;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const bytesToNumberBE = u.bytesToNumberBE;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const bytesToNumberLE = u.bytesToNumberLE;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const numberToBytesBE = u.numberToBytesBE;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const numberToBytesLE = u.numberToBytesLE;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const numberToVarBytesBE = u.numberToVarBytesBE;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const ensureBytes = u.ensureBytes;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const equalBytes = u.equalBytes;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const copyBytes = u.copyBytes;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const asciiToBytes = u.asciiToBytes;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const inRange = u.inRange;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const aInRange = u.aInRange;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const bitLen = u.bitLen;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const bitGet = u.bitGet;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const bitSet = u.bitSet;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const bitMask = u.bitMask;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const createHmacDrbg = u.createHmacDrbg;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const notImplemented = u.notImplemented;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const memoized = u.memoized;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const validateObject = u.validateObject;\n/** @deprecated moved to `@noble/curves/utils.js` */\nexport const isHash = u.isHash;\n//# sourceMappingURL=utils.js.map","/**\n * HMAC: RFC2104 message authentication code.\n * @module\n */\nimport { abytes, aexists, ahash, clean, Hash, toBytes } from \"./utils.js\";\nexport class HMAC extends Hash {\n    constructor(hash, _key) {\n        super();\n        this.finished = false;\n        this.destroyed = false;\n        ahash(hash);\n        const key = toBytes(_key);\n        this.iHash = hash.create();\n        if (typeof this.iHash.update !== 'function')\n            throw new Error('Expected instance of class which extends utils.Hash');\n        this.blockLen = this.iHash.blockLen;\n        this.outputLen = this.iHash.outputLen;\n        const blockLen = this.blockLen;\n        const pad = new Uint8Array(blockLen);\n        // blockLen can be bigger than outputLen\n        pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);\n        for (let i = 0; i < pad.length; i++)\n            pad[i] ^= 0x36;\n        this.iHash.update(pad);\n        // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone\n        this.oHash = hash.create();\n        // Undo internal XOR && apply outer XOR\n        for (let i = 0; i < pad.length; i++)\n            pad[i] ^= 0x36 ^ 0x5c;\n        this.oHash.update(pad);\n        clean(pad);\n    }\n    update(buf) {\n        aexists(this);\n        this.iHash.update(buf);\n        return this;\n    }\n    digestInto(out) {\n        aexists(this);\n        abytes(out, this.outputLen);\n        this.finished = true;\n        this.iHash.digestInto(out);\n        this.oHash.update(out);\n        this.oHash.digestInto(out);\n        this.destroy();\n    }\n    digest() {\n        const out = new Uint8Array(this.oHash.outputLen);\n        this.digestInto(out);\n        return out;\n    }\n    _cloneInto(to) {\n        // Create new instance without calling constructor since key already in state and we don't know it.\n        to || (to = Object.create(Object.getPrototypeOf(this), {}));\n        const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;\n        to = to;\n        to.finished = finished;\n        to.destroyed = destroyed;\n        to.blockLen = blockLen;\n        to.outputLen = outputLen;\n        to.oHash = oHash._cloneInto(to.oHash);\n        to.iHash = iHash._cloneInto(to.iHash);\n        return to;\n    }\n    clone() {\n        return this._cloneInto();\n    }\n    destroy() {\n        this.destroyed = true;\n        this.oHash.destroy();\n        this.iHash.destroy();\n    }\n}\n/**\n * HMAC: RFC2104 message authentication code.\n * @param hash - function that would be used e.g. sha256\n * @param key - message key\n * @param message - message data\n * @example\n * import { hmac } from '@noble/hashes/hmac';\n * import { sha256 } from '@noble/hashes/sha2';\n * const mac1 = hmac(sha256, 'key', 'message');\n */\nexport const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();\nhmac.create = (hash, key) => new HMAC(hash, key);\n//# sourceMappingURL=hmac.js.map","/**\n * Utils for modular division and fields.\n * Field over 11 is a finite (Galois) field is integer number operations `mod 11`.\n * There is no division: it is replaced by modular multiplicative inverse.\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { _validateObject, anumber, bitMask, bytesToNumberBE, bytesToNumberLE, ensureBytes, numberToBytesBE, numberToBytesLE, } from \"../utils.js\";\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _3n = /* @__PURE__ */ BigInt(3);\n// prettier-ignore\nconst _4n = /* @__PURE__ */ BigInt(4), _5n = /* @__PURE__ */ BigInt(5), _7n = /* @__PURE__ */ BigInt(7);\n// prettier-ignore\nconst _8n = /* @__PURE__ */ BigInt(8), _9n = /* @__PURE__ */ BigInt(9), _16n = /* @__PURE__ */ BigInt(16);\n// Calculates a modulo b\nexport function mod(a, b) {\n    const result = a % b;\n    return result >= _0n ? result : b + result;\n}\n/**\n * Efficiently raise num to power and do modular division.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n * @example\n * pow(2n, 6n, 11n) // 64n % 11n == 9n\n */\nexport function pow(num, power, modulo) {\n    return FpPow(Field(modulo), num, power);\n}\n/** Does `x^(2^power)` mod p. `pow2(30, 4)` == `30^(2^4)` */\nexport function pow2(x, power, modulo) {\n    let res = x;\n    while (power-- > _0n) {\n        res *= res;\n        res %= modulo;\n    }\n    return res;\n}\n/**\n * Inverses number over modulo.\n * Implemented using [Euclidean GCD](https://brilliant.org/wiki/extended-euclidean-algorithm/).\n */\nexport function invert(number, modulo) {\n    if (number === _0n)\n        throw new Error('invert: expected non-zero number');\n    if (modulo <= _0n)\n        throw new Error('invert: expected positive modulus, got ' + modulo);\n    // Fermat's little theorem \"CT-like\" version inv(n) = n^(m-2) mod m is 30x slower.\n    let a = mod(number, modulo);\n    let b = modulo;\n    // prettier-ignore\n    let x = _0n, y = _1n, u = _1n, v = _0n;\n    while (a !== _0n) {\n        // JIT applies optimization if those two lines follow each other\n        const q = b / a;\n        const r = b % a;\n        const m = x - u * q;\n        const n = y - v * q;\n        // prettier-ignore\n        b = a, a = r, x = u, y = v, u = m, v = n;\n    }\n    const gcd = b;\n    if (gcd !== _1n)\n        throw new Error('invert: does not exist');\n    return mod(x, modulo);\n}\nfunction assertIsSquare(Fp, root, n) {\n    if (!Fp.eql(Fp.sqr(root), n))\n        throw new Error('Cannot find square root');\n}\n// Not all roots are possible! Example which will throw:\n// const NUM =\n// n = 72057594037927816n;\n// Fp = Field(BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab'));\nfunction sqrt3mod4(Fp, n) {\n    const p1div4 = (Fp.ORDER + _1n) / _4n;\n    const root = Fp.pow(n, p1div4);\n    assertIsSquare(Fp, root, n);\n    return root;\n}\nfunction sqrt5mod8(Fp, n) {\n    const p5div8 = (Fp.ORDER - _5n) / _8n;\n    const n2 = Fp.mul(n, _2n);\n    const v = Fp.pow(n2, p5div8);\n    const nv = Fp.mul(n, v);\n    const i = Fp.mul(Fp.mul(nv, _2n), v);\n    const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));\n    assertIsSquare(Fp, root, n);\n    return root;\n}\n// Based on RFC9380, Kong algorithm\n// prettier-ignore\nfunction sqrt9mod16(P) {\n    const Fp_ = Field(P);\n    const tn = tonelliShanks(P);\n    const c1 = tn(Fp_, Fp_.neg(Fp_.ONE)); //  1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F\n    const c2 = tn(Fp_, c1); //  2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F\n    const c3 = tn(Fp_, Fp_.neg(c1)); //  3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F\n    const c4 = (P + _7n) / _16n; //  4. c4 = (q + 7) / 16        # Integer arithmetic\n    return (Fp, n) => {\n        let tv1 = Fp.pow(n, c4); //  1. tv1 = x^c4\n        let tv2 = Fp.mul(tv1, c1); //  2. tv2 = c1 * tv1\n        const tv3 = Fp.mul(tv1, c2); //  3. tv3 = c2 * tv1\n        const tv4 = Fp.mul(tv1, c3); //  4. tv4 = c3 * tv1\n        const e1 = Fp.eql(Fp.sqr(tv2), n); //  5.  e1 = (tv2^2) == x\n        const e2 = Fp.eql(Fp.sqr(tv3), n); //  6.  e2 = (tv3^2) == x\n        tv1 = Fp.cmov(tv1, tv2, e1); //  7. tv1 = CMOV(tv1, tv2, e1)  # Select tv2 if (tv2^2) == x\n        tv2 = Fp.cmov(tv4, tv3, e2); //  8. tv2 = CMOV(tv4, tv3, e2)  # Select tv3 if (tv3^2) == x\n        const e3 = Fp.eql(Fp.sqr(tv2), n); //  9.  e3 = (tv2^2) == x\n        const root = Fp.cmov(tv1, tv2, e3); // 10.  z = CMOV(tv1, tv2, e3)   # Select sqrt from tv1 & tv2\n        assertIsSquare(Fp, root, n);\n        return root;\n    };\n}\n/**\n * Tonelli-Shanks square root search algorithm.\n * 1. https://eprint.iacr.org/2012/685.pdf (page 12)\n * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks\n * @param P field order\n * @returns function that takes field Fp (created from P) and number n\n */\nexport function tonelliShanks(P) {\n    // Initialization (precomputation).\n    // Caching initialization could boost perf by 7%.\n    if (P < _3n)\n        throw new Error('sqrt is not defined for small field');\n    // Factor P - 1 = Q * 2^S, where Q is odd\n    let Q = P - _1n;\n    let S = 0;\n    while (Q % _2n === _0n) {\n        Q /= _2n;\n        S++;\n    }\n    // Find the first quadratic non-residue Z >= 2\n    let Z = _2n;\n    const _Fp = Field(P);\n    while (FpLegendre(_Fp, Z) === 1) {\n        // Basic primality test for P. After x iterations, chance of\n        // not finding quadratic non-residue is 2^x, so 2^1000.\n        if (Z++ > 1000)\n            throw new Error('Cannot find square root: probably non-prime P');\n    }\n    // Fast-path; usually done before Z, but we do \"primality test\".\n    if (S === 1)\n        return sqrt3mod4;\n    // Slow-path\n    // TODO: test on Fp2 and others\n    let cc = _Fp.pow(Z, Q); // c = z^Q\n    const Q1div2 = (Q + _1n) / _2n;\n    return function tonelliSlow(Fp, n) {\n        if (Fp.is0(n))\n            return n;\n        // Check if n is a quadratic residue using Legendre symbol\n        if (FpLegendre(Fp, n) !== 1)\n            throw new Error('Cannot find square root');\n        // Initialize variables for the main loop\n        let M = S;\n        let c = Fp.mul(Fp.ONE, cc); // c = z^Q, move cc from field _Fp into field Fp\n        let t = Fp.pow(n, Q); // t = n^Q, first guess at the fudge factor\n        let R = Fp.pow(n, Q1div2); // R = n^((Q+1)/2), first guess at the square root\n        // Main loop\n        // while t != 1\n        while (!Fp.eql(t, Fp.ONE)) {\n            if (Fp.is0(t))\n                return Fp.ZERO; // if t=0 return R=0\n            let i = 1;\n            // Find the smallest i >= 1 such that t^(2^i) ≡ 1 (mod P)\n            let t_tmp = Fp.sqr(t); // t^(2^1)\n            while (!Fp.eql(t_tmp, Fp.ONE)) {\n                i++;\n                t_tmp = Fp.sqr(t_tmp); // t^(2^2)...\n                if (i === M)\n                    throw new Error('Cannot find square root');\n            }\n            // Calculate the exponent for b: 2^(M - i - 1)\n            const exponent = _1n << BigInt(M - i - 1); // bigint is important\n            const b = Fp.pow(c, exponent); // b = 2^(M - i - 1)\n            // Update variables\n            M = i;\n            c = Fp.sqr(b); // c = b^2\n            t = Fp.mul(t, c); // t = (t * b^2)\n            R = Fp.mul(R, b); // R = R*b\n        }\n        return R;\n    };\n}\n/**\n * Square root for a finite field. Will try optimized versions first:\n *\n * 1. P ≡ 3 (mod 4)\n * 2. P ≡ 5 (mod 8)\n * 3. P ≡ 9 (mod 16)\n * 4. Tonelli-Shanks algorithm\n *\n * Different algorithms can give different roots, it is up to user to decide which one they want.\n * For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve).\n */\nexport function FpSqrt(P) {\n    // P ≡ 3 (mod 4) => √n = n^((P+1)/4)\n    if (P % _4n === _3n)\n        return sqrt3mod4;\n    // P ≡ 5 (mod 8) => Atkin algorithm, page 10 of https://eprint.iacr.org/2012/685.pdf\n    if (P % _8n === _5n)\n        return sqrt5mod8;\n    // P ≡ 9 (mod 16) => Kong algorithm, page 11 of https://eprint.iacr.org/2012/685.pdf (algorithm 4)\n    if (P % _16n === _9n)\n        return sqrt9mod16(P);\n    // Tonelli-Shanks algorithm\n    return tonelliShanks(P);\n}\n// Little-endian check for first LE bit (last BE bit);\nexport const isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n;\n// prettier-ignore\nconst FIELD_FIELDS = [\n    'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr',\n    'eql', 'add', 'sub', 'mul', 'pow', 'div',\n    'addN', 'subN', 'mulN', 'sqrN'\n];\nexport function validateField(field) {\n    const initial = {\n        ORDER: 'bigint',\n        MASK: 'bigint',\n        BYTES: 'number',\n        BITS: 'number',\n    };\n    const opts = FIELD_FIELDS.reduce((map, val) => {\n        map[val] = 'function';\n        return map;\n    }, initial);\n    _validateObject(field, opts);\n    // const max = 16384;\n    // if (field.BYTES < 1 || field.BYTES > max) throw new Error('invalid field');\n    // if (field.BITS < 1 || field.BITS > 8 * max) throw new Error('invalid field');\n    return field;\n}\n// Generic field functions\n/**\n * Same as `pow` but for Fp: non-constant-time.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n */\nexport function FpPow(Fp, num, power) {\n    if (power < _0n)\n        throw new Error('invalid exponent, negatives unsupported');\n    if (power === _0n)\n        return Fp.ONE;\n    if (power === _1n)\n        return num;\n    let p = Fp.ONE;\n    let d = num;\n    while (power > _0n) {\n        if (power & _1n)\n            p = Fp.mul(p, d);\n        d = Fp.sqr(d);\n        power >>= _1n;\n    }\n    return p;\n}\n/**\n * Efficiently invert an array of Field elements.\n * Exception-free. Will return `undefined` for 0 elements.\n * @param passZero map 0 to 0 (instead of undefined)\n */\nexport function FpInvertBatch(Fp, nums, passZero = false) {\n    const inverted = new Array(nums.length).fill(passZero ? Fp.ZERO : undefined);\n    // Walk from first to last, multiply them by each other MOD p\n    const multipliedAcc = nums.reduce((acc, num, i) => {\n        if (Fp.is0(num))\n            return acc;\n        inverted[i] = acc;\n        return Fp.mul(acc, num);\n    }, Fp.ONE);\n    // Invert last element\n    const invertedAcc = Fp.inv(multipliedAcc);\n    // Walk from last to first, multiply them by inverted each other MOD p\n    nums.reduceRight((acc, num, i) => {\n        if (Fp.is0(num))\n            return acc;\n        inverted[i] = Fp.mul(acc, inverted[i]);\n        return Fp.mul(acc, num);\n    }, invertedAcc);\n    return inverted;\n}\n// TODO: remove\nexport function FpDiv(Fp, lhs, rhs) {\n    return Fp.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, Fp.ORDER) : Fp.inv(rhs));\n}\n/**\n * Legendre symbol.\n * Legendre constant is used to calculate Legendre symbol (a | p)\n * which denotes the value of a^((p-1)/2) (mod p).\n *\n * * (a | p) ≡ 1    if a is a square (mod p), quadratic residue\n * * (a | p) ≡ -1   if a is not a square (mod p), quadratic non residue\n * * (a | p) ≡ 0    if a ≡ 0 (mod p)\n */\nexport function FpLegendre(Fp, n) {\n    // We can use 3rd argument as optional cache of this value\n    // but seems unneeded for now. The operation is very fast.\n    const p1mod2 = (Fp.ORDER - _1n) / _2n;\n    const powered = Fp.pow(n, p1mod2);\n    const yes = Fp.eql(powered, Fp.ONE);\n    const zero = Fp.eql(powered, Fp.ZERO);\n    const no = Fp.eql(powered, Fp.neg(Fp.ONE));\n    if (!yes && !zero && !no)\n        throw new Error('invalid Legendre symbol result');\n    return yes ? 1 : zero ? 0 : -1;\n}\n// This function returns True whenever the value x is a square in the field F.\nexport function FpIsSquare(Fp, n) {\n    const l = FpLegendre(Fp, n);\n    return l === 1;\n}\n// CURVE.n lengths\nexport function nLength(n, nBitLength) {\n    // Bit size, byte size of CURVE.n\n    if (nBitLength !== undefined)\n        anumber(nBitLength);\n    const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length;\n    const nByteLength = Math.ceil(_nBitLength / 8);\n    return { nBitLength: _nBitLength, nByteLength };\n}\n/**\n * Creates a finite field. Major performance optimizations:\n * * 1. Denormalized operations like mulN instead of mul.\n * * 2. Identical object shape: never add or remove keys.\n * * 3. `Object.freeze`.\n * Fragile: always run a benchmark on a change.\n * Security note: operations don't check 'isValid' for all elements for performance reasons,\n * it is caller responsibility to check this.\n * This is low-level code, please make sure you know what you're doing.\n *\n * Note about field properties:\n * * CHARACTERISTIC p = prime number, number of elements in main subgroup.\n * * ORDER q = similar to cofactor in curves, may be composite `q = p^m`.\n *\n * @param ORDER field order, probably prime, or could be composite\n * @param bitLen how many bits the field consumes\n * @param isLE (default: false) if encoding / decoding should be in little-endian\n * @param redef optional faster redefinitions of sqrt and other methods\n */\nexport function Field(ORDER, bitLenOrOpts, // TODO: use opts only in v2?\nisLE = false, opts = {}) {\n    if (ORDER <= _0n)\n        throw new Error('invalid field: expected ORDER > 0, got ' + ORDER);\n    let _nbitLength = undefined;\n    let _sqrt = undefined;\n    let modFromBytes = false;\n    let allowedLengths = undefined;\n    if (typeof bitLenOrOpts === 'object' && bitLenOrOpts != null) {\n        if (opts.sqrt || isLE)\n            throw new Error('cannot specify opts in two arguments');\n        const _opts = bitLenOrOpts;\n        if (_opts.BITS)\n            _nbitLength = _opts.BITS;\n        if (_opts.sqrt)\n            _sqrt = _opts.sqrt;\n        if (typeof _opts.isLE === 'boolean')\n            isLE = _opts.isLE;\n        if (typeof _opts.modFromBytes === 'boolean')\n            modFromBytes = _opts.modFromBytes;\n        allowedLengths = _opts.allowedLengths;\n    }\n    else {\n        if (typeof bitLenOrOpts === 'number')\n            _nbitLength = bitLenOrOpts;\n        if (opts.sqrt)\n            _sqrt = opts.sqrt;\n    }\n    const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, _nbitLength);\n    if (BYTES > 2048)\n        throw new Error('invalid field: expected ORDER of <= 2048 bytes');\n    let sqrtP; // cached sqrtP\n    const f = Object.freeze({\n        ORDER,\n        isLE,\n        BITS,\n        BYTES,\n        MASK: bitMask(BITS),\n        ZERO: _0n,\n        ONE: _1n,\n        allowedLengths: allowedLengths,\n        create: (num) => mod(num, ORDER),\n        isValid: (num) => {\n            if (typeof num !== 'bigint')\n                throw new Error('invalid field element: expected bigint, got ' + typeof num);\n            return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible\n        },\n        is0: (num) => num === _0n,\n        // is valid and invertible\n        isValidNot0: (num) => !f.is0(num) && f.isValid(num),\n        isOdd: (num) => (num & _1n) === _1n,\n        neg: (num) => mod(-num, ORDER),\n        eql: (lhs, rhs) => lhs === rhs,\n        sqr: (num) => mod(num * num, ORDER),\n        add: (lhs, rhs) => mod(lhs + rhs, ORDER),\n        sub: (lhs, rhs) => mod(lhs - rhs, ORDER),\n        mul: (lhs, rhs) => mod(lhs * rhs, ORDER),\n        pow: (num, power) => FpPow(f, num, power),\n        div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER),\n        // Same as above, but doesn't normalize\n        sqrN: (num) => num * num,\n        addN: (lhs, rhs) => lhs + rhs,\n        subN: (lhs, rhs) => lhs - rhs,\n        mulN: (lhs, rhs) => lhs * rhs,\n        inv: (num) => invert(num, ORDER),\n        sqrt: _sqrt ||\n            ((n) => {\n                if (!sqrtP)\n                    sqrtP = FpSqrt(ORDER);\n                return sqrtP(f, n);\n            }),\n        toBytes: (num) => (isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)),\n        fromBytes: (bytes, skipValidation = true) => {\n            if (allowedLengths) {\n                if (!allowedLengths.includes(bytes.length) || bytes.length > BYTES) {\n                    throw new Error('Field.fromBytes: expected ' + allowedLengths + ' bytes, got ' + bytes.length);\n                }\n                const padded = new Uint8Array(BYTES);\n                // isLE add 0 to right, !isLE to the left.\n                padded.set(bytes, isLE ? 0 : padded.length - bytes.length);\n                bytes = padded;\n            }\n            if (bytes.length !== BYTES)\n                throw new Error('Field.fromBytes: expected ' + BYTES + ' bytes, got ' + bytes.length);\n            let scalar = isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes);\n            if (modFromBytes)\n                scalar = mod(scalar, ORDER);\n            if (!skipValidation)\n                if (!f.isValid(scalar))\n                    throw new Error('invalid field element: outside of range 0..ORDER');\n            // NOTE: we don't validate scalar here, please use isValid. This done such way because some\n            // protocol may allow non-reduced scalar that reduced later or changed some other way.\n            return scalar;\n        },\n        // TODO: we don't need it here, move out to separate fn\n        invertBatch: (lst) => FpInvertBatch(f, lst),\n        // We can't move this out because Fp6, Fp12 implement it\n        // and it's unclear what to return in there.\n        cmov: (a, b, c) => (c ? b : a),\n    });\n    return Object.freeze(f);\n}\n// Generic random scalar, we can do same for other fields if via Fp2.mul(Fp2.ONE, Fp2.random)?\n// This allows unsafe methods like ignore bias or zero. These unsafe, but often used in different protocols (if deterministic RNG).\n// which mean we cannot force this via opts.\n// Not sure what to do with randomBytes, we can accept it inside opts if wanted.\n// Probably need to export getMinHashLength somewhere?\n// random(bytes?: Uint8Array, unsafeAllowZero = false, unsafeAllowBias = false) {\n//   const LEN = !unsafeAllowBias ? getMinHashLength(ORDER) : BYTES;\n//   if (bytes === undefined) bytes = randomBytes(LEN); // _opts.randomBytes?\n//   const num = isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes);\n//   // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0\n//   const reduced = unsafeAllowZero ? mod(num, ORDER) : mod(num, ORDER - _1n) + _1n;\n//   return reduced;\n// },\nexport function FpSqrtOdd(Fp, elm) {\n    if (!Fp.isOdd)\n        throw new Error(\"Field doesn't have isOdd\");\n    const root = Fp.sqrt(elm);\n    return Fp.isOdd(root) ? root : Fp.neg(root);\n}\nexport function FpSqrtEven(Fp, elm) {\n    if (!Fp.isOdd)\n        throw new Error(\"Field doesn't have isOdd\");\n    const root = Fp.sqrt(elm);\n    return Fp.isOdd(root) ? Fp.neg(root) : root;\n}\n/**\n * \"Constant-time\" private key generation utility.\n * Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field).\n * Which makes it slightly more biased, less secure.\n * @deprecated use `mapKeyToField` instead\n */\nexport function hashToPrivateScalar(hash, groupOrder, isLE = false) {\n    hash = ensureBytes('privateHash', hash);\n    const hashLen = hash.length;\n    const minLen = nLength(groupOrder).nByteLength + 8;\n    if (minLen < 24 || hashLen < minLen || hashLen > 1024)\n        throw new Error('hashToPrivateScalar: expected ' + minLen + '-1024 bytes of input, got ' + hashLen);\n    const num = isLE ? bytesToNumberLE(hash) : bytesToNumberBE(hash);\n    return mod(num, groupOrder - _1n) + _1n;\n}\n/**\n * Returns total number of bytes consumed by the field element.\n * For example, 32 bytes for usual 256-bit weierstrass curve.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of field\n */\nexport function getFieldBytesLength(fieldOrder) {\n    if (typeof fieldOrder !== 'bigint')\n        throw new Error('field order must be bigint');\n    const bitLength = fieldOrder.toString(2).length;\n    return Math.ceil(bitLength / 8);\n}\n/**\n * Returns minimal amount of bytes that can be safely reduced\n * by field order.\n * Should be 2^-128 for 128-bit curve such as P256.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of target hash\n */\nexport function getMinHashLength(fieldOrder) {\n    const length = getFieldBytesLength(fieldOrder);\n    return length + Math.ceil(length / 2);\n}\n/**\n * \"Constant-time\" private key generation utility.\n * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF\n * and convert them into private scalar, with the modulo bias being negligible.\n * Needs at least 48 bytes of input for 32-byte private key.\n * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/\n * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final\n * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5\n * @param hash hash output from SHA3 or a similar function\n * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n)\n * @param isLE interpret hash bytes as LE num\n * @returns valid private scalar\n */\nexport function mapHashToField(key, fieldOrder, isLE = false) {\n    const len = key.length;\n    const fieldLen = getFieldBytesLength(fieldOrder);\n    const minLen = getMinHashLength(fieldOrder);\n    // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings.\n    if (len < 16 || len < minLen || len > 1024)\n        throw new Error('expected ' + minLen + '-1024 bytes of input, got ' + len);\n    const num = isLE ? bytesToNumberLE(key) : bytesToNumberBE(key);\n    // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0\n    const reduced = mod(num, fieldOrder - _1n) + _1n;\n    return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);\n}\n//# sourceMappingURL=modular.js.map","/**\n * Methods for elliptic curve multiplication by scalars.\n * Contains wNAF, pippenger.\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { bitLen, bitMask, validateObject } from \"../utils.js\";\nimport { Field, FpInvertBatch, nLength, validateField } from \"./modular.js\";\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nexport function negateCt(condition, item) {\n    const neg = item.negate();\n    return condition ? neg : item;\n}\n/**\n * Takes a bunch of Projective Points but executes only one\n * inversion on all of them. Inversion is very slow operation,\n * so this improves performance massively.\n * Optimization: converts a list of projective points to a list of identical points with Z=1.\n */\nexport function normalizeZ(c, points) {\n    const invertedZs = FpInvertBatch(c.Fp, points.map((p) => p.Z));\n    return points.map((p, i) => c.fromAffine(p.toAffine(invertedZs[i])));\n}\nfunction validateW(W, bits) {\n    if (!Number.isSafeInteger(W) || W <= 0 || W > bits)\n        throw new Error('invalid window size, expected [1..' + bits + '], got W=' + W);\n}\nfunction calcWOpts(W, scalarBits) {\n    validateW(W, scalarBits);\n    const windows = Math.ceil(scalarBits / W) + 1; // W=8 33. Not 32, because we skip zero\n    const windowSize = 2 ** (W - 1); // W=8 128. Not 256, because we skip zero\n    const maxNumber = 2 ** W; // W=8 256\n    const mask = bitMask(W); // W=8 255 == mask 0b11111111\n    const shiftBy = BigInt(W); // W=8 8\n    return { windows, windowSize, mask, maxNumber, shiftBy };\n}\nfunction calcOffsets(n, window, wOpts) {\n    const { windowSize, mask, maxNumber, shiftBy } = wOpts;\n    let wbits = Number(n & mask); // extract W bits.\n    let nextN = n >> shiftBy; // shift number by W bits.\n    // What actually happens here:\n    // const highestBit = Number(mask ^ (mask >> 1n));\n    // let wbits2 = wbits - 1; // skip zero\n    // if (wbits2 & highestBit) { wbits2 ^= Number(mask); // (~);\n    // split if bits > max: +224 => 256-32\n    if (wbits > windowSize) {\n        // we skip zero, which means instead of `>= size-1`, we do `> size`\n        wbits -= maxNumber; // -32, can be maxNumber - wbits, but then we need to set isNeg here.\n        nextN += _1n; // +256 (carry)\n    }\n    const offsetStart = window * windowSize;\n    const offset = offsetStart + Math.abs(wbits) - 1; // -1 because we skip zero\n    const isZero = wbits === 0; // is current window slice a 0?\n    const isNeg = wbits < 0; // is current window slice negative?\n    const isNegF = window % 2 !== 0; // fake random statement for noise\n    const offsetF = offsetStart; // fake offset for noise\n    return { nextN, offset, isZero, isNeg, isNegF, offsetF };\n}\nfunction validateMSMPoints(points, c) {\n    if (!Array.isArray(points))\n        throw new Error('array expected');\n    points.forEach((p, i) => {\n        if (!(p instanceof c))\n            throw new Error('invalid point at index ' + i);\n    });\n}\nfunction validateMSMScalars(scalars, field) {\n    if (!Array.isArray(scalars))\n        throw new Error('array of scalars expected');\n    scalars.forEach((s, i) => {\n        if (!field.isValid(s))\n            throw new Error('invalid scalar at index ' + i);\n    });\n}\n// Since points in different groups cannot be equal (different object constructor),\n// we can have single place to store precomputes.\n// Allows to make points frozen / immutable.\nconst pointPrecomputes = new WeakMap();\nconst pointWindowSizes = new WeakMap();\nfunction getW(P) {\n    // To disable precomputes:\n    // return 1;\n    return pointWindowSizes.get(P) || 1;\n}\nfunction assert0(n) {\n    if (n !== _0n)\n        throw new Error('invalid wNAF');\n}\n/**\n * Elliptic curve multiplication of Point by scalar. Fragile.\n * Table generation takes **30MB of ram and 10ms on high-end CPU**,\n * but may take much longer on slow devices. Actual generation will happen on\n * first call of `multiply()`. By default, `BASE` point is precomputed.\n *\n * Scalars should always be less than curve order: this should be checked inside of a curve itself.\n * Creates precomputation tables for fast multiplication:\n * - private scalar is split by fixed size windows of W bits\n * - every window point is collected from window's table & added to accumulator\n * - since windows are different, same point inside tables won't be accessed more than once per calc\n * - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar)\n * - +1 window is neccessary for wNAF\n * - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication\n *\n * @todo Research returning 2d JS array of windows, instead of a single window.\n * This would allow windows to be in different memory locations\n */\nexport class wNAF {\n    // Parametrized with a given Point class (not individual point)\n    constructor(Point, bits) {\n        this.BASE = Point.BASE;\n        this.ZERO = Point.ZERO;\n        this.Fn = Point.Fn;\n        this.bits = bits;\n    }\n    // non-const time multiplication ladder\n    _unsafeLadder(elm, n, p = this.ZERO) {\n        let d = elm;\n        while (n > _0n) {\n            if (n & _1n)\n                p = p.add(d);\n            d = d.double();\n            n >>= _1n;\n        }\n        return p;\n    }\n    /**\n     * Creates a wNAF precomputation window. Used for caching.\n     * Default window size is set by `utils.precompute()` and is equal to 8.\n     * Number of precomputed points depends on the curve size:\n     * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:\n     * - 𝑊 is the window size\n     * - 𝑛 is the bitlength of the curve order.\n     * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.\n     * @param point Point instance\n     * @param W window size\n     * @returns precomputed point tables flattened to a single array\n     */\n    precomputeWindow(point, W) {\n        const { windows, windowSize } = calcWOpts(W, this.bits);\n        const points = [];\n        let p = point;\n        let base = p;\n        for (let window = 0; window < windows; window++) {\n            base = p;\n            points.push(base);\n            // i=1, bc we skip 0\n            for (let i = 1; i < windowSize; i++) {\n                base = base.add(p);\n                points.push(base);\n            }\n            p = base.double();\n        }\n        return points;\n    }\n    /**\n     * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.\n     * More compact implementation:\n     * https://github.com/paulmillr/noble-secp256k1/blob/47cb1669b6e506ad66b35fe7d76132ae97465da2/index.ts#L502-L541\n     * @returns real and fake (for const-time) points\n     */\n    wNAF(W, precomputes, n) {\n        // Scalar should be smaller than field order\n        if (!this.Fn.isValid(n))\n            throw new Error('invalid scalar');\n        // Accumulators\n        let p = this.ZERO;\n        let f = this.BASE;\n        // This code was first written with assumption that 'f' and 'p' will never be infinity point:\n        // since each addition is multiplied by 2 ** W, it cannot cancel each other. However,\n        // there is negate now: it is possible that negated element from low value\n        // would be the same as high element, which will create carry into next window.\n        // It's not obvious how this can fail, but still worth investigating later.\n        const wo = calcWOpts(W, this.bits);\n        for (let window = 0; window < wo.windows; window++) {\n            // (n === _0n) is handled and not early-exited. isEven and offsetF are used for noise\n            const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window, wo);\n            n = nextN;\n            if (isZero) {\n                // bits are 0: add garbage to fake point\n                // Important part for const-time getPublicKey: add random \"noise\" point to f.\n                f = f.add(negateCt(isNegF, precomputes[offsetF]));\n            }\n            else {\n                // bits are 1: add to result point\n                p = p.add(negateCt(isNeg, precomputes[offset]));\n            }\n        }\n        assert0(n);\n        // Return both real and fake points: JIT won't eliminate f.\n        // At this point there is a way to F be infinity-point even if p is not,\n        // which makes it less const-time: around 1 bigint multiply.\n        return { p, f };\n    }\n    /**\n     * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.\n     * @param acc accumulator point to add result of multiplication\n     * @returns point\n     */\n    wNAFUnsafe(W, precomputes, n, acc = this.ZERO) {\n        const wo = calcWOpts(W, this.bits);\n        for (let window = 0; window < wo.windows; window++) {\n            if (n === _0n)\n                break; // Early-exit, skip 0 value\n            const { nextN, offset, isZero, isNeg } = calcOffsets(n, window, wo);\n            n = nextN;\n            if (isZero) {\n                // Window bits are 0: skip processing.\n                // Move to next window.\n                continue;\n            }\n            else {\n                const item = precomputes[offset];\n                acc = acc.add(isNeg ? item.negate() : item); // Re-using acc allows to save adds in MSM\n            }\n        }\n        assert0(n);\n        return acc;\n    }\n    getPrecomputes(W, point, transform) {\n        // Calculate precomputes on a first run, reuse them after\n        let comp = pointPrecomputes.get(point);\n        if (!comp) {\n            comp = this.precomputeWindow(point, W);\n            if (W !== 1) {\n                // Doing transform outside of if brings 15% perf hit\n                if (typeof transform === 'function')\n                    comp = transform(comp);\n                pointPrecomputes.set(point, comp);\n            }\n        }\n        return comp;\n    }\n    cached(point, scalar, transform) {\n        const W = getW(point);\n        return this.wNAF(W, this.getPrecomputes(W, point, transform), scalar);\n    }\n    unsafe(point, scalar, transform, prev) {\n        const W = getW(point);\n        if (W === 1)\n            return this._unsafeLadder(point, scalar, prev); // For W=1 ladder is ~x2 faster\n        return this.wNAFUnsafe(W, this.getPrecomputes(W, point, transform), scalar, prev);\n    }\n    // We calculate precomputes for elliptic curve point multiplication\n    // using windowed method. This specifies window size and\n    // stores precomputed values. Usually only base point would be precomputed.\n    createCache(P, W) {\n        validateW(W, this.bits);\n        pointWindowSizes.set(P, W);\n        pointPrecomputes.delete(P);\n    }\n    hasCache(elm) {\n        return getW(elm) !== 1;\n    }\n}\n/**\n * Endomorphism-specific multiplication for Koblitz curves.\n * Cost: 128 dbl, 0-256 adds.\n */\nexport function mulEndoUnsafe(Point, point, k1, k2) {\n    let acc = point;\n    let p1 = Point.ZERO;\n    let p2 = Point.ZERO;\n    while (k1 > _0n || k2 > _0n) {\n        if (k1 & _1n)\n            p1 = p1.add(acc);\n        if (k2 & _1n)\n            p2 = p2.add(acc);\n        acc = acc.double();\n        k1 >>= _1n;\n        k2 >>= _1n;\n    }\n    return { p1, p2 };\n}\n/**\n * Pippenger algorithm for multi-scalar multiplication (MSM, Pa + Qb + Rc + ...).\n * 30x faster vs naive addition on L=4096, 10x faster than precomputes.\n * For N=254bit, L=1, it does: 1024 ADD + 254 DBL. For L=5: 1536 ADD + 254 DBL.\n * Algorithmically constant-time (for same L), even when 1 point + scalar, or when scalar = 0.\n * @param c Curve Point constructor\n * @param fieldN field over CURVE.N - important that it's not over CURVE.P\n * @param points array of L curve points\n * @param scalars array of L scalars (aka secret keys / bigints)\n */\nexport function pippenger(c, fieldN, points, scalars) {\n    // If we split scalars by some window (let's say 8 bits), every chunk will only\n    // take 256 buckets even if there are 4096 scalars, also re-uses double.\n    // TODO:\n    // - https://eprint.iacr.org/2024/750.pdf\n    // - https://tches.iacr.org/index.php/TCHES/article/view/10287\n    // 0 is accepted in scalars\n    validateMSMPoints(points, c);\n    validateMSMScalars(scalars, fieldN);\n    const plength = points.length;\n    const slength = scalars.length;\n    if (plength !== slength)\n        throw new Error('arrays of points and scalars must have equal length');\n    // if (plength === 0) throw new Error('array must be of length >= 2');\n    const zero = c.ZERO;\n    const wbits = bitLen(BigInt(plength));\n    let windowSize = 1; // bits\n    if (wbits > 12)\n        windowSize = wbits - 3;\n    else if (wbits > 4)\n        windowSize = wbits - 2;\n    else if (wbits > 0)\n        windowSize = 2;\n    const MASK = bitMask(windowSize);\n    const buckets = new Array(Number(MASK) + 1).fill(zero); // +1 for zero array\n    const lastBits = Math.floor((fieldN.BITS - 1) / windowSize) * windowSize;\n    let sum = zero;\n    for (let i = lastBits; i >= 0; i -= windowSize) {\n        buckets.fill(zero);\n        for (let j = 0; j < slength; j++) {\n            const scalar = scalars[j];\n            const wbits = Number((scalar >> BigInt(i)) & MASK);\n            buckets[wbits] = buckets[wbits].add(points[j]);\n        }\n        let resI = zero; // not using this will do small speed-up, but will lose ct\n        // Skip first bucket, because it is zero\n        for (let j = buckets.length - 1, sumI = zero; j > 0; j--) {\n            sumI = sumI.add(buckets[j]);\n            resI = resI.add(sumI);\n        }\n        sum = sum.add(resI);\n        if (i !== 0)\n            for (let j = 0; j < windowSize; j++)\n                sum = sum.double();\n    }\n    return sum;\n}\n/**\n * Precomputed multi-scalar multiplication (MSM, Pa + Qb + Rc + ...).\n * @param c Curve Point constructor\n * @param fieldN field over CURVE.N - important that it's not over CURVE.P\n * @param points array of L curve points\n * @returns function which multiplies points with scaars\n */\nexport function precomputeMSMUnsafe(c, fieldN, points, windowSize) {\n    /**\n     * Performance Analysis of Window-based Precomputation\n     *\n     * Base Case (256-bit scalar, 8-bit window):\n     * - Standard precomputation requires:\n     *   - 31 additions per scalar × 256 scalars = 7,936 ops\n     *   - Plus 255 summary additions = 8,191 total ops\n     *   Note: Summary additions can be optimized via accumulator\n     *\n     * Chunked Precomputation Analysis:\n     * - Using 32 chunks requires:\n     *   - 255 additions per chunk\n     *   - 256 doublings\n     *   - Total: (255 × 32) + 256 = 8,416 ops\n     *\n     * Memory Usage Comparison:\n     * Window Size | Standard Points | Chunked Points\n     * ------------|-----------------|---------------\n     *     4-bit   |     520         |      15\n     *     8-bit   |    4,224        |     255\n     *    10-bit   |   13,824        |   1,023\n     *    16-bit   |  557,056        |  65,535\n     *\n     * Key Advantages:\n     * 1. Enables larger window sizes due to reduced memory overhead\n     * 2. More efficient for smaller scalar counts:\n     *    - 16 chunks: (16 × 255) + 256 = 4,336 ops\n     *    - ~2x faster than standard 8,191 ops\n     *\n     * Limitations:\n     * - Not suitable for plain precomputes (requires 256 constant doublings)\n     * - Performance degrades with larger scalar counts:\n     *   - Optimal for ~256 scalars\n     *   - Less efficient for 4096+ scalars (Pippenger preferred)\n     */\n    validateW(windowSize, fieldN.BITS);\n    validateMSMPoints(points, c);\n    const zero = c.ZERO;\n    const tableSize = 2 ** windowSize - 1; // table size (without zero)\n    const chunks = Math.ceil(fieldN.BITS / windowSize); // chunks of item\n    const MASK = bitMask(windowSize);\n    const tables = points.map((p) => {\n        const res = [];\n        for (let i = 0, acc = p; i < tableSize; i++) {\n            res.push(acc);\n            acc = acc.add(p);\n        }\n        return res;\n    });\n    return (scalars) => {\n        validateMSMScalars(scalars, fieldN);\n        if (scalars.length > points.length)\n            throw new Error('array of scalars must be smaller than array of points');\n        let res = zero;\n        for (let i = 0; i < chunks; i++) {\n            // No need to double if accumulator is still zero.\n            if (res !== zero)\n                for (let j = 0; j < windowSize; j++)\n                    res = res.double();\n            const shiftBy = BigInt(chunks * windowSize - (i + 1) * windowSize);\n            for (let j = 0; j < scalars.length; j++) {\n                const n = scalars[j];\n                const curr = Number((n >> shiftBy) & MASK);\n                if (!curr)\n                    continue; // skip zero scalars chunks\n                res = res.add(tables[j][curr - 1]);\n            }\n        }\n        return res;\n    };\n}\n// TODO: remove\n/** @deprecated */\nexport function validateBasic(curve) {\n    validateField(curve.Fp);\n    validateObject(curve, {\n        n: 'bigint',\n        h: 'bigint',\n        Gx: 'field',\n        Gy: 'field',\n    }, {\n        nBitLength: 'isSafeInteger',\n        nByteLength: 'isSafeInteger',\n    });\n    // Set defaults\n    return Object.freeze({\n        ...nLength(curve.n, curve.nBitLength),\n        ...curve,\n        ...{ p: curve.Fp.ORDER },\n    });\n}\nfunction createField(order, field, isLE) {\n    if (field) {\n        if (field.ORDER !== order)\n            throw new Error('Field.ORDER must match order: Fp == p, Fn == n');\n        validateField(field);\n        return field;\n    }\n    else {\n        return Field(order, { isLE });\n    }\n}\n/** Validates CURVE opts and creates fields */\nexport function _createCurveFields(type, CURVE, curveOpts = {}, FpFnLE) {\n    if (FpFnLE === undefined)\n        FpFnLE = type === 'edwards';\n    if (!CURVE || typeof CURVE !== 'object')\n        throw new Error(`expected valid ${type} CURVE object`);\n    for (const p of ['p', 'n', 'h']) {\n        const val = CURVE[p];\n        if (!(typeof val === 'bigint' && val > _0n))\n            throw new Error(`CURVE.${p} must be positive bigint`);\n    }\n    const Fp = createField(CURVE.p, curveOpts.Fp, FpFnLE);\n    const Fn = createField(CURVE.n, curveOpts.Fn, FpFnLE);\n    const _b = type === 'weierstrass' ? 'b' : 'd';\n    const params = ['Gx', 'Gy', 'a', _b];\n    for (const p of params) {\n        // @ts-ignore\n        if (!Fp.isValid(CURVE[p]))\n            throw new Error(`CURVE.${p} must be valid field element of CURVE.Fp`);\n    }\n    CURVE = Object.freeze(Object.assign({}, CURVE));\n    return { CURVE, Fp, Fn };\n}\n//# sourceMappingURL=curve.js.map","/**\n * Short Weierstrass curve methods. The formula is: y² = x³ + ax + b.\n *\n * ### Design rationale for types\n *\n * * Interaction between classes from different curves should fail:\n *   `k256.Point.BASE.add(p256.Point.BASE)`\n * * For this purpose we want to use `instanceof` operator, which is fast and works during runtime\n * * Different calls of `curve()` would return different classes -\n *   `curve(params) !== curve(params)`: if somebody decided to monkey-patch their curve,\n *   it won't affect others\n *\n * TypeScript can't infer types for classes created inside a function. Classes is one instance\n * of nominative types in TypeScript and interfaces only check for shape, so it's hard to create\n * unique type for every function call.\n *\n * We can use generic types via some param, like curve opts, but that would:\n *     1. Enable interaction between `curve(params)` and `curve(params)` (curves of same params)\n *     which is hard to debug.\n *     2. Params can be generic and we can't enforce them to be constant value:\n *     if somebody creates curve from non-constant params,\n *     it would be allowed to interact with other curves with non-constant params\n *\n * @todo https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { hmac as nobleHmac } from '@noble/hashes/hmac.js';\nimport { ahash } from '@noble/hashes/utils';\nimport { _validateObject, _abool2 as abool, _abytes2 as abytes, aInRange, bitLen, bitMask, bytesToHex, bytesToNumberBE, concatBytes, createHmacDrbg, ensureBytes, hexToBytes, inRange, isBytes, memoized, numberToHexUnpadded, randomBytes as randomBytesWeb, } from \"../utils.js\";\nimport { _createCurveFields, mulEndoUnsafe, negateCt, normalizeZ, pippenger, wNAF, } from \"./curve.js\";\nimport { Field, FpInvertBatch, getMinHashLength, mapHashToField, nLength, validateField, } from \"./modular.js\";\n// We construct basis in such way that den is always positive and equals n, but num sign depends on basis (not on secret value)\nconst divNearest = (num, den) => (num + (num >= 0 ? den : -den) / _2n) / den;\n/**\n * Splits scalar for GLV endomorphism.\n */\nexport function _splitEndoScalar(k, basis, n) {\n    // Split scalar into two such that part is ~half bits: `abs(part) < sqrt(N)`\n    // Since part can be negative, we need to do this on point.\n    // TODO: verifyScalar function which consumes lambda\n    const [[a1, b1], [a2, b2]] = basis;\n    const c1 = divNearest(b2 * k, n);\n    const c2 = divNearest(-b1 * k, n);\n    // |k1|/|k2| is < sqrt(N), but can be negative.\n    // If we do `k1 mod N`, we'll get big scalar (`> sqrt(N)`): so, we do cheaper negation instead.\n    let k1 = k - c1 * a1 - c2 * a2;\n    let k2 = -c1 * b1 - c2 * b2;\n    const k1neg = k1 < _0n;\n    const k2neg = k2 < _0n;\n    if (k1neg)\n        k1 = -k1;\n    if (k2neg)\n        k2 = -k2;\n    // Double check that resulting scalar less than half bits of N: otherwise wNAF will fail.\n    // This should only happen on wrong basises. Also, math inside is too complex and I don't trust it.\n    const MAX_NUM = bitMask(Math.ceil(bitLen(n) / 2)) + _1n; // Half bits of N\n    if (k1 < _0n || k1 >= MAX_NUM || k2 < _0n || k2 >= MAX_NUM) {\n        throw new Error('splitScalar (endomorphism): failed, k=' + k);\n    }\n    return { k1neg, k1, k2neg, k2 };\n}\nfunction validateSigFormat(format) {\n    if (!['compact', 'recovered', 'der'].includes(format))\n        throw new Error('Signature format must be \"compact\", \"recovered\", or \"der\"');\n    return format;\n}\nfunction validateSigOpts(opts, def) {\n    const optsn = {};\n    for (let optName of Object.keys(def)) {\n        // @ts-ignore\n        optsn[optName] = opts[optName] === undefined ? def[optName] : opts[optName];\n    }\n    abool(optsn.lowS, 'lowS');\n    abool(optsn.prehash, 'prehash');\n    if (optsn.format !== undefined)\n        validateSigFormat(optsn.format);\n    return optsn;\n}\nexport class DERErr extends Error {\n    constructor(m = '') {\n        super(m);\n    }\n}\n/**\n * ASN.1 DER encoding utilities. ASN is very complex & fragile. Format:\n *\n *     [0x30 (SEQUENCE), bytelength, 0x02 (INTEGER), intLength, R, 0x02 (INTEGER), intLength, S]\n *\n * Docs: https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/, https://luca.ntop.org/Teaching/Appunti/asn1.html\n */\nexport const DER = {\n    // asn.1 DER encoding utils\n    Err: DERErr,\n    // Basic building block is TLV (Tag-Length-Value)\n    _tlv: {\n        encode: (tag, data) => {\n            const { Err: E } = DER;\n            if (tag < 0 || tag > 256)\n                throw new E('tlv.encode: wrong tag');\n            if (data.length & 1)\n                throw new E('tlv.encode: unpadded data');\n            const dataLen = data.length / 2;\n            const len = numberToHexUnpadded(dataLen);\n            if ((len.length / 2) & 128)\n                throw new E('tlv.encode: long form length too big');\n            // length of length with long form flag\n            const lenLen = dataLen > 127 ? numberToHexUnpadded((len.length / 2) | 128) : '';\n            const t = numberToHexUnpadded(tag);\n            return t + lenLen + len + data;\n        },\n        // v - value, l - left bytes (unparsed)\n        decode(tag, data) {\n            const { Err: E } = DER;\n            let pos = 0;\n            if (tag < 0 || tag > 256)\n                throw new E('tlv.encode: wrong tag');\n            if (data.length < 2 || data[pos++] !== tag)\n                throw new E('tlv.decode: wrong tlv');\n            const first = data[pos++];\n            const isLong = !!(first & 128); // First bit of first length byte is flag for short/long form\n            let length = 0;\n            if (!isLong)\n                length = first;\n            else {\n                // Long form: [longFlag(1bit), lengthLength(7bit), length (BE)]\n                const lenLen = first & 127;\n                if (!lenLen)\n                    throw new E('tlv.decode(long): indefinite length not supported');\n                if (lenLen > 4)\n                    throw new E('tlv.decode(long): byte length is too big'); // this will overflow u32 in js\n                const lengthBytes = data.subarray(pos, pos + lenLen);\n                if (lengthBytes.length !== lenLen)\n                    throw new E('tlv.decode: length bytes not complete');\n                if (lengthBytes[0] === 0)\n                    throw new E('tlv.decode(long): zero leftmost byte');\n                for (const b of lengthBytes)\n                    length = (length << 8) | b;\n                pos += lenLen;\n                if (length < 128)\n                    throw new E('tlv.decode(long): not minimal encoding');\n            }\n            const v = data.subarray(pos, pos + length);\n            if (v.length !== length)\n                throw new E('tlv.decode: wrong value length');\n            return { v, l: data.subarray(pos + length) };\n        },\n    },\n    // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,\n    // since we always use positive integers here. It must always be empty:\n    // - add zero byte if exists\n    // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)\n    _int: {\n        encode(num) {\n            const { Err: E } = DER;\n            if (num < _0n)\n                throw new E('integer: negative integers are not allowed');\n            let hex = numberToHexUnpadded(num);\n            // Pad with zero byte if negative flag is present\n            if (Number.parseInt(hex[0], 16) & 0b1000)\n                hex = '00' + hex;\n            if (hex.length & 1)\n                throw new E('unexpected DER parsing assertion: unpadded hex');\n            return hex;\n        },\n        decode(data) {\n            const { Err: E } = DER;\n            if (data[0] & 128)\n                throw new E('invalid signature integer: negative');\n            if (data[0] === 0x00 && !(data[1] & 128))\n                throw new E('invalid signature integer: unnecessary leading zero');\n            return bytesToNumberBE(data);\n        },\n    },\n    toSig(hex) {\n        // parse DER signature\n        const { Err: E, _int: int, _tlv: tlv } = DER;\n        const data = ensureBytes('signature', hex);\n        const { v: seqBytes, l: seqLeftBytes } = tlv.decode(0x30, data);\n        if (seqLeftBytes.length)\n            throw new E('invalid signature: left bytes after parsing');\n        const { v: rBytes, l: rLeftBytes } = tlv.decode(0x02, seqBytes);\n        const { v: sBytes, l: sLeftBytes } = tlv.decode(0x02, rLeftBytes);\n        if (sLeftBytes.length)\n            throw new E('invalid signature: left bytes after parsing');\n        return { r: int.decode(rBytes), s: int.decode(sBytes) };\n    },\n    hexFromSig(sig) {\n        const { _tlv: tlv, _int: int } = DER;\n        const rs = tlv.encode(0x02, int.encode(sig.r));\n        const ss = tlv.encode(0x02, int.encode(sig.s));\n        const seq = rs + ss;\n        return tlv.encode(0x30, seq);\n    },\n};\n// Be friendly to bad ECMAScript parsers by not using bigint literals\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4);\nexport function _normFnElement(Fn, key) {\n    const { BYTES: expected } = Fn;\n    let num;\n    if (typeof key === 'bigint') {\n        num = key;\n    }\n    else {\n        let bytes = ensureBytes('private key', key);\n        try {\n            num = Fn.fromBytes(bytes);\n        }\n        catch (error) {\n            throw new Error(`invalid private key: expected ui8a of size ${expected}, got ${typeof key}`);\n        }\n    }\n    if (!Fn.isValidNot0(num))\n        throw new Error('invalid private key: out of range [1..N-1]');\n    return num;\n}\n/**\n * Creates weierstrass Point constructor, based on specified curve options.\n *\n * @example\n```js\nconst opts = {\n  p: BigInt('0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff'),\n  n: BigInt('0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551'),\n  h: BigInt(1),\n  a: BigInt('0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc'),\n  b: BigInt('0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b'),\n  Gx: BigInt('0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296'),\n  Gy: BigInt('0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5'),\n};\nconst p256_Point = weierstrass(opts);\n```\n */\nexport function weierstrassN(params, extraOpts = {}) {\n    const validated = _createCurveFields('weierstrass', params, extraOpts);\n    const { Fp, Fn } = validated;\n    let CURVE = validated.CURVE;\n    const { h: cofactor, n: CURVE_ORDER } = CURVE;\n    _validateObject(extraOpts, {}, {\n        allowInfinityPoint: 'boolean',\n        clearCofactor: 'function',\n        isTorsionFree: 'function',\n        fromBytes: 'function',\n        toBytes: 'function',\n        endo: 'object',\n        wrapPrivateKey: 'boolean',\n    });\n    const { endo } = extraOpts;\n    if (endo) {\n        // validateObject(endo, { beta: 'bigint', splitScalar: 'function' });\n        if (!Fp.is0(CURVE.a) || typeof endo.beta !== 'bigint' || !Array.isArray(endo.basises)) {\n            throw new Error('invalid endo: expected \"beta\": bigint and \"basises\": array');\n        }\n    }\n    const lengths = getWLengths(Fp, Fn);\n    function assertCompressionIsSupported() {\n        if (!Fp.isOdd)\n            throw new Error('compression is not supported: Field does not have .isOdd()');\n    }\n    // Implements IEEE P1363 point encoding\n    function pointToBytes(_c, point, isCompressed) {\n        const { x, y } = point.toAffine();\n        const bx = Fp.toBytes(x);\n        abool(isCompressed, 'isCompressed');\n        if (isCompressed) {\n            assertCompressionIsSupported();\n            const hasEvenY = !Fp.isOdd(y);\n            return concatBytes(pprefix(hasEvenY), bx);\n        }\n        else {\n            return concatBytes(Uint8Array.of(0x04), bx, Fp.toBytes(y));\n        }\n    }\n    function pointFromBytes(bytes) {\n        abytes(bytes, undefined, 'Point');\n        const { publicKey: comp, publicKeyUncompressed: uncomp } = lengths; // e.g. for 32-byte: 33, 65\n        const length = bytes.length;\n        const head = bytes[0];\n        const tail = bytes.subarray(1);\n        // No actual validation is done here: use .assertValidity()\n        if (length === comp && (head === 0x02 || head === 0x03)) {\n            const x = Fp.fromBytes(tail);\n            if (!Fp.isValid(x))\n                throw new Error('bad point: is not on curve, wrong x');\n            const y2 = weierstrassEquation(x); // y² = x³ + ax + b\n            let y;\n            try {\n                y = Fp.sqrt(y2); // y = y² ^ (p+1)/4\n            }\n            catch (sqrtError) {\n                const err = sqrtError instanceof Error ? ': ' + sqrtError.message : '';\n                throw new Error('bad point: is not on curve, sqrt error' + err);\n            }\n            assertCompressionIsSupported();\n            const isYOdd = Fp.isOdd(y); // (y & _1n) === _1n;\n            const isHeadOdd = (head & 1) === 1; // ECDSA-specific\n            if (isHeadOdd !== isYOdd)\n                y = Fp.neg(y);\n            return { x, y };\n        }\n        else if (length === uncomp && head === 0x04) {\n            // TODO: more checks\n            const L = Fp.BYTES;\n            const x = Fp.fromBytes(tail.subarray(0, L));\n            const y = Fp.fromBytes(tail.subarray(L, L * 2));\n            if (!isValidXY(x, y))\n                throw new Error('bad point: is not on curve');\n            return { x, y };\n        }\n        else {\n            throw new Error(`bad point: got length ${length}, expected compressed=${comp} or uncompressed=${uncomp}`);\n        }\n    }\n    const encodePoint = extraOpts.toBytes || pointToBytes;\n    const decodePoint = extraOpts.fromBytes || pointFromBytes;\n    function weierstrassEquation(x) {\n        const x2 = Fp.sqr(x); // x * x\n        const x3 = Fp.mul(x2, x); // x² * x\n        return Fp.add(Fp.add(x3, Fp.mul(x, CURVE.a)), CURVE.b); // x³ + a * x + b\n    }\n    // TODO: move top-level\n    /** Checks whether equation holds for given x, y: y² == x³ + ax + b */\n    function isValidXY(x, y) {\n        const left = Fp.sqr(y); // y²\n        const right = weierstrassEquation(x); // x³ + ax + b\n        return Fp.eql(left, right);\n    }\n    // Validate whether the passed curve params are valid.\n    // Test 1: equation y² = x³ + ax + b should work for generator point.\n    if (!isValidXY(CURVE.Gx, CURVE.Gy))\n        throw new Error('bad curve params: generator point');\n    // Test 2: discriminant Δ part should be non-zero: 4a³ + 27b² != 0.\n    // Guarantees curve is genus-1, smooth (non-singular).\n    const _4a3 = Fp.mul(Fp.pow(CURVE.a, _3n), _4n);\n    const _27b2 = Fp.mul(Fp.sqr(CURVE.b), BigInt(27));\n    if (Fp.is0(Fp.add(_4a3, _27b2)))\n        throw new Error('bad curve params: a or b');\n    /** Asserts coordinate is valid: 0 <= n < Fp.ORDER. */\n    function acoord(title, n, banZero = false) {\n        if (!Fp.isValid(n) || (banZero && Fp.is0(n)))\n            throw new Error(`bad point coordinate ${title}`);\n        return n;\n    }\n    function aprjpoint(other) {\n        if (!(other instanceof Point))\n            throw new Error('ProjectivePoint expected');\n    }\n    function splitEndoScalarN(k) {\n        if (!endo || !endo.basises)\n            throw new Error('no endo');\n        return _splitEndoScalar(k, endo.basises, Fn.ORDER);\n    }\n    // Memoized toAffine / validity check. They are heavy. Points are immutable.\n    // Converts Projective point to affine (x, y) coordinates.\n    // Can accept precomputed Z^-1 - for example, from invertBatch.\n    // (X, Y, Z) ∋ (x=X/Z, y=Y/Z)\n    const toAffineMemo = memoized((p, iz) => {\n        const { X, Y, Z } = p;\n        // Fast-path for normalized points\n        if (Fp.eql(Z, Fp.ONE))\n            return { x: X, y: Y };\n        const is0 = p.is0();\n        // If invZ was 0, we return zero point. However we still want to execute\n        // all operations, so we replace invZ with a random number, 1.\n        if (iz == null)\n            iz = is0 ? Fp.ONE : Fp.inv(Z);\n        const x = Fp.mul(X, iz);\n        const y = Fp.mul(Y, iz);\n        const zz = Fp.mul(Z, iz);\n        if (is0)\n            return { x: Fp.ZERO, y: Fp.ZERO };\n        if (!Fp.eql(zz, Fp.ONE))\n            throw new Error('invZ was invalid');\n        return { x, y };\n    });\n    // NOTE: on exception this will crash 'cached' and no value will be set.\n    // Otherwise true will be return\n    const assertValidMemo = memoized((p) => {\n        if (p.is0()) {\n            // (0, 1, 0) aka ZERO is invalid in most contexts.\n            // In BLS, ZERO can be serialized, so we allow it.\n            // (0, 0, 0) is invalid representation of ZERO.\n            if (extraOpts.allowInfinityPoint && !Fp.is0(p.Y))\n                return;\n            throw new Error('bad point: ZERO');\n        }\n        // Some 3rd-party test vectors require different wording between here & `fromCompressedHex`\n        const { x, y } = p.toAffine();\n        if (!Fp.isValid(x) || !Fp.isValid(y))\n            throw new Error('bad point: x or y not field elements');\n        if (!isValidXY(x, y))\n            throw new Error('bad point: equation left != right');\n        if (!p.isTorsionFree())\n            throw new Error('bad point: not in prime-order subgroup');\n        return true;\n    });\n    function finishEndo(endoBeta, k1p, k2p, k1neg, k2neg) {\n        k2p = new Point(Fp.mul(k2p.X, endoBeta), k2p.Y, k2p.Z);\n        k1p = negateCt(k1neg, k1p);\n        k2p = negateCt(k2neg, k2p);\n        return k1p.add(k2p);\n    }\n    /**\n     * Projective Point works in 3d / projective (homogeneous) coordinates:(X, Y, Z) ∋ (x=X/Z, y=Y/Z).\n     * Default Point works in 2d / affine coordinates: (x, y).\n     * We're doing calculations in projective, because its operations don't require costly inversion.\n     */\n    class Point {\n        /** Does NOT validate if the point is valid. Use `.assertValidity()`. */\n        constructor(X, Y, Z) {\n            this.X = acoord('x', X);\n            this.Y = acoord('y', Y, true);\n            this.Z = acoord('z', Z);\n            Object.freeze(this);\n        }\n        static CURVE() {\n            return CURVE;\n        }\n        /** Does NOT validate if the point is valid. Use `.assertValidity()`. */\n        static fromAffine(p) {\n            const { x, y } = p || {};\n            if (!p || !Fp.isValid(x) || !Fp.isValid(y))\n                throw new Error('invalid affine point');\n            if (p instanceof Point)\n                throw new Error('projective point not allowed');\n            // (0, 0) would've produced (0, 0, 1) - instead, we need (0, 1, 0)\n            if (Fp.is0(x) && Fp.is0(y))\n                return Point.ZERO;\n            return new Point(x, y, Fp.ONE);\n        }\n        static fromBytes(bytes) {\n            const P = Point.fromAffine(decodePoint(abytes(bytes, undefined, 'point')));\n            P.assertValidity();\n            return P;\n        }\n        static fromHex(hex) {\n            return Point.fromBytes(ensureBytes('pointHex', hex));\n        }\n        get x() {\n            return this.toAffine().x;\n        }\n        get y() {\n            return this.toAffine().y;\n        }\n        /**\n         *\n         * @param windowSize\n         * @param isLazy true will defer table computation until the first multiplication\n         * @returns\n         */\n        precompute(windowSize = 8, isLazy = true) {\n            wnaf.createCache(this, windowSize);\n            if (!isLazy)\n                this.multiply(_3n); // random number\n            return this;\n        }\n        // TODO: return `this`\n        /** A point on curve is valid if it conforms to equation. */\n        assertValidity() {\n            assertValidMemo(this);\n        }\n        hasEvenY() {\n            const { y } = this.toAffine();\n            if (!Fp.isOdd)\n                throw new Error(\"Field doesn't support isOdd\");\n            return !Fp.isOdd(y);\n        }\n        /** Compare one point to another. */\n        equals(other) {\n            aprjpoint(other);\n            const { X: X1, Y: Y1, Z: Z1 } = this;\n            const { X: X2, Y: Y2, Z: Z2 } = other;\n            const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1));\n            const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1));\n            return U1 && U2;\n        }\n        /** Flips point to one corresponding to (x, -y) in Affine coordinates. */\n        negate() {\n            return new Point(this.X, Fp.neg(this.Y), this.Z);\n        }\n        // Renes-Costello-Batina exception-free doubling formula.\n        // There is 30% faster Jacobian formula, but it is not complete.\n        // https://eprint.iacr.org/2015/1060, algorithm 3\n        // Cost: 8M + 3S + 3*a + 2*b3 + 15add.\n        double() {\n            const { a, b } = CURVE;\n            const b3 = Fp.mul(b, _3n);\n            const { X: X1, Y: Y1, Z: Z1 } = this;\n            let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n            let t0 = Fp.mul(X1, X1); // step 1\n            let t1 = Fp.mul(Y1, Y1);\n            let t2 = Fp.mul(Z1, Z1);\n            let t3 = Fp.mul(X1, Y1);\n            t3 = Fp.add(t3, t3); // step 5\n            Z3 = Fp.mul(X1, Z1);\n            Z3 = Fp.add(Z3, Z3);\n            X3 = Fp.mul(a, Z3);\n            Y3 = Fp.mul(b3, t2);\n            Y3 = Fp.add(X3, Y3); // step 10\n            X3 = Fp.sub(t1, Y3);\n            Y3 = Fp.add(t1, Y3);\n            Y3 = Fp.mul(X3, Y3);\n            X3 = Fp.mul(t3, X3);\n            Z3 = Fp.mul(b3, Z3); // step 15\n            t2 = Fp.mul(a, t2);\n            t3 = Fp.sub(t0, t2);\n            t3 = Fp.mul(a, t3);\n            t3 = Fp.add(t3, Z3);\n            Z3 = Fp.add(t0, t0); // step 20\n            t0 = Fp.add(Z3, t0);\n            t0 = Fp.add(t0, t2);\n            t0 = Fp.mul(t0, t3);\n            Y3 = Fp.add(Y3, t0);\n            t2 = Fp.mul(Y1, Z1); // step 25\n            t2 = Fp.add(t2, t2);\n            t0 = Fp.mul(t2, t3);\n            X3 = Fp.sub(X3, t0);\n            Z3 = Fp.mul(t2, t1);\n            Z3 = Fp.add(Z3, Z3); // step 30\n            Z3 = Fp.add(Z3, Z3);\n            return new Point(X3, Y3, Z3);\n        }\n        // Renes-Costello-Batina exception-free addition formula.\n        // There is 30% faster Jacobian formula, but it is not complete.\n        // https://eprint.iacr.org/2015/1060, algorithm 1\n        // Cost: 12M + 0S + 3*a + 3*b3 + 23add.\n        add(other) {\n            aprjpoint(other);\n            const { X: X1, Y: Y1, Z: Z1 } = this;\n            const { X: X2, Y: Y2, Z: Z2 } = other;\n            let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n            const a = CURVE.a;\n            const b3 = Fp.mul(CURVE.b, _3n);\n            let t0 = Fp.mul(X1, X2); // step 1\n            let t1 = Fp.mul(Y1, Y2);\n            let t2 = Fp.mul(Z1, Z2);\n            let t3 = Fp.add(X1, Y1);\n            let t4 = Fp.add(X2, Y2); // step 5\n            t3 = Fp.mul(t3, t4);\n            t4 = Fp.add(t0, t1);\n            t3 = Fp.sub(t3, t4);\n            t4 = Fp.add(X1, Z1);\n            let t5 = Fp.add(X2, Z2); // step 10\n            t4 = Fp.mul(t4, t5);\n            t5 = Fp.add(t0, t2);\n            t4 = Fp.sub(t4, t5);\n            t5 = Fp.add(Y1, Z1);\n            X3 = Fp.add(Y2, Z2); // step 15\n            t5 = Fp.mul(t5, X3);\n            X3 = Fp.add(t1, t2);\n            t5 = Fp.sub(t5, X3);\n            Z3 = Fp.mul(a, t4);\n            X3 = Fp.mul(b3, t2); // step 20\n            Z3 = Fp.add(X3, Z3);\n            X3 = Fp.sub(t1, Z3);\n            Z3 = Fp.add(t1, Z3);\n            Y3 = Fp.mul(X3, Z3);\n            t1 = Fp.add(t0, t0); // step 25\n            t1 = Fp.add(t1, t0);\n            t2 = Fp.mul(a, t2);\n            t4 = Fp.mul(b3, t4);\n            t1 = Fp.add(t1, t2);\n            t2 = Fp.sub(t0, t2); // step 30\n            t2 = Fp.mul(a, t2);\n            t4 = Fp.add(t4, t2);\n            t0 = Fp.mul(t1, t4);\n            Y3 = Fp.add(Y3, t0);\n            t0 = Fp.mul(t5, t4); // step 35\n            X3 = Fp.mul(t3, X3);\n            X3 = Fp.sub(X3, t0);\n            t0 = Fp.mul(t3, t1);\n            Z3 = Fp.mul(t5, Z3);\n            Z3 = Fp.add(Z3, t0); // step 40\n            return new Point(X3, Y3, Z3);\n        }\n        subtract(other) {\n            return this.add(other.negate());\n        }\n        is0() {\n            return this.equals(Point.ZERO);\n        }\n        /**\n         * Constant time multiplication.\n         * Uses wNAF method. Windowed method may be 10% faster,\n         * but takes 2x longer to generate and consumes 2x memory.\n         * Uses precomputes when available.\n         * Uses endomorphism for Koblitz curves.\n         * @param scalar by which the point would be multiplied\n         * @returns New point\n         */\n        multiply(scalar) {\n            const { endo } = extraOpts;\n            if (!Fn.isValidNot0(scalar))\n                throw new Error('invalid scalar: out of range'); // 0 is invalid\n            let point, fake; // Fake point is used to const-time mult\n            const mul = (n) => wnaf.cached(this, n, (p) => normalizeZ(Point, p));\n            /** See docs for {@link EndomorphismOpts} */\n            if (endo) {\n                const { k1neg, k1, k2neg, k2 } = splitEndoScalarN(scalar);\n                const { p: k1p, f: k1f } = mul(k1);\n                const { p: k2p, f: k2f } = mul(k2);\n                fake = k1f.add(k2f);\n                point = finishEndo(endo.beta, k1p, k2p, k1neg, k2neg);\n            }\n            else {\n                const { p, f } = mul(scalar);\n                point = p;\n                fake = f;\n            }\n            // Normalize `z` for both points, but return only real one\n            return normalizeZ(Point, [point, fake])[0];\n        }\n        /**\n         * Non-constant-time multiplication. Uses double-and-add algorithm.\n         * It's faster, but should only be used when you don't care about\n         * an exposed secret key e.g. sig verification, which works over *public* keys.\n         */\n        multiplyUnsafe(sc) {\n            const { endo } = extraOpts;\n            const p = this;\n            if (!Fn.isValid(sc))\n                throw new Error('invalid scalar: out of range'); // 0 is valid\n            if (sc === _0n || p.is0())\n                return Point.ZERO;\n            if (sc === _1n)\n                return p; // fast-path\n            if (wnaf.hasCache(this))\n                return this.multiply(sc);\n            if (endo) {\n                const { k1neg, k1, k2neg, k2 } = splitEndoScalarN(sc);\n                const { p1, p2 } = mulEndoUnsafe(Point, p, k1, k2); // 30% faster vs wnaf.unsafe\n                return finishEndo(endo.beta, p1, p2, k1neg, k2neg);\n            }\n            else {\n                return wnaf.unsafe(p, sc);\n            }\n        }\n        multiplyAndAddUnsafe(Q, a, b) {\n            const sum = this.multiplyUnsafe(a).add(Q.multiplyUnsafe(b));\n            return sum.is0() ? undefined : sum;\n        }\n        /**\n         * Converts Projective point to affine (x, y) coordinates.\n         * @param invertedZ Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch\n         */\n        toAffine(invertedZ) {\n            return toAffineMemo(this, invertedZ);\n        }\n        /**\n         * Checks whether Point is free of torsion elements (is in prime subgroup).\n         * Always torsion-free for cofactor=1 curves.\n         */\n        isTorsionFree() {\n            const { isTorsionFree } = extraOpts;\n            if (cofactor === _1n)\n                return true;\n            if (isTorsionFree)\n                return isTorsionFree(Point, this);\n            return wnaf.unsafe(this, CURVE_ORDER).is0();\n        }\n        clearCofactor() {\n            const { clearCofactor } = extraOpts;\n            if (cofactor === _1n)\n                return this; // Fast-path\n            if (clearCofactor)\n                return clearCofactor(Point, this);\n            return this.multiplyUnsafe(cofactor);\n        }\n        isSmallOrder() {\n            // can we use this.clearCofactor()?\n            return this.multiplyUnsafe(cofactor).is0();\n        }\n        toBytes(isCompressed = true) {\n            abool(isCompressed, 'isCompressed');\n            this.assertValidity();\n            return encodePoint(Point, this, isCompressed);\n        }\n        toHex(isCompressed = true) {\n            return bytesToHex(this.toBytes(isCompressed));\n        }\n        toString() {\n            return `<Point ${this.is0() ? 'ZERO' : this.toHex()}>`;\n        }\n        // TODO: remove\n        get px() {\n            return this.X;\n        }\n        get py() {\n            return this.X;\n        }\n        get pz() {\n            return this.Z;\n        }\n        toRawBytes(isCompressed = true) {\n            return this.toBytes(isCompressed);\n        }\n        _setWindowSize(windowSize) {\n            this.precompute(windowSize);\n        }\n        static normalizeZ(points) {\n            return normalizeZ(Point, points);\n        }\n        static msm(points, scalars) {\n            return pippenger(Point, Fn, points, scalars);\n        }\n        static fromPrivateKey(privateKey) {\n            return Point.BASE.multiply(_normFnElement(Fn, privateKey));\n        }\n    }\n    // base / generator point\n    Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);\n    // zero / infinity / identity point\n    Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); // 0, 1, 0\n    // math field\n    Point.Fp = Fp;\n    // scalar field\n    Point.Fn = Fn;\n    const bits = Fn.BITS;\n    const wnaf = new wNAF(Point, extraOpts.endo ? Math.ceil(bits / 2) : bits);\n    Point.BASE.precompute(8); // Enable precomputes. Slows down first publicKey computation by 20ms.\n    return Point;\n}\n// Points start with byte 0x02 when y is even; otherwise 0x03\nfunction pprefix(hasEvenY) {\n    return Uint8Array.of(hasEvenY ? 0x02 : 0x03);\n}\n/**\n * Implementation of the Shallue and van de Woestijne method for any weierstrass curve.\n * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular.\n * b = True and y = sqrt(u / v) if (u / v) is square in F, and\n * b = False and y = sqrt(Z * (u / v)) otherwise.\n * @param Fp\n * @param Z\n * @returns\n */\nexport function SWUFpSqrtRatio(Fp, Z) {\n    // Generic implementation\n    const q = Fp.ORDER;\n    let l = _0n;\n    for (let o = q - _1n; o % _2n === _0n; o /= _2n)\n        l += _1n;\n    const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1.\n    // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<.\n    // 2n ** c1 == 2n << (c1-1)\n    const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n);\n    const _2n_pow_c1 = _2n_pow_c1_1 * _2n;\n    const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1)  # Integer arithmetic\n    const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2            # Integer arithmetic\n    const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1                # Integer arithmetic\n    const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1)                  # Integer arithmetic\n    const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2\n    const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2)\n    let sqrtRatio = (u, v) => {\n        let tv1 = c6; // 1. tv1 = c6\n        let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4\n        let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2\n        tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v\n        let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3\n        tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3\n        tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2\n        tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v\n        tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u\n        let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2\n        tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5\n        let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1\n        tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7\n        tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1\n        tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR)\n        tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR)\n        // 17. for i in (c1, c1 - 1, ..., 2):\n        for (let i = c1; i > _1n; i--) {\n            let tv5 = i - _2n; // 18.    tv5 = i - 2\n            tv5 = _2n << (tv5 - _1n); // 19.    tv5 = 2^tv5\n            let tvv5 = Fp.pow(tv4, tv5); // 20.    tv5 = tv4^tv5\n            const e1 = Fp.eql(tvv5, Fp.ONE); // 21.    e1 = tv5 == 1\n            tv2 = Fp.mul(tv3, tv1); // 22.    tv2 = tv3 * tv1\n            tv1 = Fp.mul(tv1, tv1); // 23.    tv1 = tv1 * tv1\n            tvv5 = Fp.mul(tv4, tv1); // 24.    tv5 = tv4 * tv1\n            tv3 = Fp.cmov(tv2, tv3, e1); // 25.    tv3 = CMOV(tv2, tv3, e1)\n            tv4 = Fp.cmov(tvv5, tv4, e1); // 26.    tv4 = CMOV(tv5, tv4, e1)\n        }\n        return { isValid: isQR, value: tv3 };\n    };\n    if (Fp.ORDER % _4n === _3n) {\n        // sqrt_ratio_3mod4(u, v)\n        const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4     # Integer arithmetic\n        const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z)\n        sqrtRatio = (u, v) => {\n            let tv1 = Fp.sqr(v); // 1. tv1 = v^2\n            const tv2 = Fp.mul(u, v); // 2. tv2 = u * v\n            tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2\n            let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1\n            y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2\n            const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2\n            const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v\n            const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u\n            let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR)\n            return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2\n        };\n    }\n    // No curves uses that\n    // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8\n    return sqrtRatio;\n}\n/**\n * Simplified Shallue-van de Woestijne-Ulas Method\n * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2\n */\nexport function mapToCurveSimpleSWU(Fp, opts) {\n    validateField(Fp);\n    const { A, B, Z } = opts;\n    if (!Fp.isValid(A) || !Fp.isValid(B) || !Fp.isValid(Z))\n        throw new Error('mapToCurveSimpleSWU: invalid opts');\n    const sqrtRatio = SWUFpSqrtRatio(Fp, Z);\n    if (!Fp.isOdd)\n        throw new Error('Field does not have .isOdd()');\n    // Input: u, an element of F.\n    // Output: (x, y), a point on E.\n    return (u) => {\n        // prettier-ignore\n        let tv1, tv2, tv3, tv4, tv5, tv6, x, y;\n        tv1 = Fp.sqr(u); // 1.  tv1 = u^2\n        tv1 = Fp.mul(tv1, Z); // 2.  tv1 = Z * tv1\n        tv2 = Fp.sqr(tv1); // 3.  tv2 = tv1^2\n        tv2 = Fp.add(tv2, tv1); // 4.  tv2 = tv2 + tv1\n        tv3 = Fp.add(tv2, Fp.ONE); // 5.  tv3 = tv2 + 1\n        tv3 = Fp.mul(tv3, B); // 6.  tv3 = B * tv3\n        tv4 = Fp.cmov(Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7.  tv4 = CMOV(Z, -tv2, tv2 != 0)\n        tv4 = Fp.mul(tv4, A); // 8.  tv4 = A * tv4\n        tv2 = Fp.sqr(tv3); // 9.  tv2 = tv3^2\n        tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2\n        tv5 = Fp.mul(tv6, A); // 11. tv5 = A * tv6\n        tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5\n        tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3\n        tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4\n        tv5 = Fp.mul(tv6, B); // 15. tv5 = B * tv6\n        tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5\n        x = Fp.mul(tv1, tv3); // 17.   x = tv1 * tv3\n        const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6)\n        y = Fp.mul(tv1, u); // 19.   y = tv1 * u  -> Z * u^3 * y1\n        y = Fp.mul(y, value); // 20.   y = y * y1\n        x = Fp.cmov(x, tv3, isValid); // 21.   x = CMOV(x, tv3, is_gx1_square)\n        y = Fp.cmov(y, value, isValid); // 22.   y = CMOV(y, y1, is_gx1_square)\n        const e1 = Fp.isOdd(u) === Fp.isOdd(y); // 23.  e1 = sgn0(u) == sgn0(y)\n        y = Fp.cmov(Fp.neg(y), y, e1); // 24.   y = CMOV(-y, y, e1)\n        const tv4_inv = FpInvertBatch(Fp, [tv4], true)[0];\n        x = Fp.mul(x, tv4_inv); // 25.   x = x / tv4\n        return { x, y };\n    };\n}\nfunction getWLengths(Fp, Fn) {\n    return {\n        secretKey: Fn.BYTES,\n        publicKey: 1 + Fp.BYTES,\n        publicKeyUncompressed: 1 + 2 * Fp.BYTES,\n        publicKeyHasPrefix: true,\n        signature: 2 * Fn.BYTES,\n    };\n}\n/**\n * Sometimes users only need getPublicKey, getSharedSecret, and secret key handling.\n * This helper ensures no signature functionality is present. Less code, smaller bundle size.\n */\nexport function ecdh(Point, ecdhOpts = {}) {\n    const { Fn } = Point;\n    const randomBytes_ = ecdhOpts.randomBytes || randomBytesWeb;\n    const lengths = Object.assign(getWLengths(Point.Fp, Fn), { seed: getMinHashLength(Fn.ORDER) });\n    function isValidSecretKey(secretKey) {\n        try {\n            return !!_normFnElement(Fn, secretKey);\n        }\n        catch (error) {\n            return false;\n        }\n    }\n    function isValidPublicKey(publicKey, isCompressed) {\n        const { publicKey: comp, publicKeyUncompressed } = lengths;\n        try {\n            const l = publicKey.length;\n            if (isCompressed === true && l !== comp)\n                return false;\n            if (isCompressed === false && l !== publicKeyUncompressed)\n                return false;\n            return !!Point.fromBytes(publicKey);\n        }\n        catch (error) {\n            return false;\n        }\n    }\n    /**\n     * Produces cryptographically secure secret key from random of size\n     * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.\n     */\n    function randomSecretKey(seed = randomBytes_(lengths.seed)) {\n        return mapHashToField(abytes(seed, lengths.seed, 'seed'), Fn.ORDER);\n    }\n    /**\n     * Computes public key for a secret key. Checks for validity of the secret key.\n     * @param isCompressed whether to return compact (default), or full key\n     * @returns Public key, full when isCompressed=false; short when isCompressed=true\n     */\n    function getPublicKey(secretKey, isCompressed = true) {\n        return Point.BASE.multiply(_normFnElement(Fn, secretKey)).toBytes(isCompressed);\n    }\n    function keygen(seed) {\n        const secretKey = randomSecretKey(seed);\n        return { secretKey, publicKey: getPublicKey(secretKey) };\n    }\n    /**\n     * Quick and dirty check for item being public key. Does not validate hex, or being on-curve.\n     */\n    function isProbPub(item) {\n        if (typeof item === 'bigint')\n            return false;\n        if (item instanceof Point)\n            return true;\n        const { secretKey, publicKey, publicKeyUncompressed } = lengths;\n        if (Fn.allowedLengths || secretKey === publicKey)\n            return undefined;\n        const l = ensureBytes('key', item).length;\n        return l === publicKey || l === publicKeyUncompressed;\n    }\n    /**\n     * ECDH (Elliptic Curve Diffie Hellman).\n     * Computes shared public key from secret key A and public key B.\n     * Checks: 1) secret key validity 2) shared key is on-curve.\n     * Does NOT hash the result.\n     * @param isCompressed whether to return compact (default), or full key\n     * @returns shared public key\n     */\n    function getSharedSecret(secretKeyA, publicKeyB, isCompressed = true) {\n        if (isProbPub(secretKeyA) === true)\n            throw new Error('first arg must be private key');\n        if (isProbPub(publicKeyB) === false)\n            throw new Error('second arg must be public key');\n        const s = _normFnElement(Fn, secretKeyA);\n        const b = Point.fromHex(publicKeyB); // checks for being on-curve\n        return b.multiply(s).toBytes(isCompressed);\n    }\n    const utils = {\n        isValidSecretKey,\n        isValidPublicKey,\n        randomSecretKey,\n        // TODO: remove\n        isValidPrivateKey: isValidSecretKey,\n        randomPrivateKey: randomSecretKey,\n        normPrivateKeyToScalar: (key) => _normFnElement(Fn, key),\n        precompute(windowSize = 8, point = Point.BASE) {\n            return point.precompute(windowSize, false);\n        },\n    };\n    return Object.freeze({ getPublicKey, getSharedSecret, keygen, Point, utils, lengths });\n}\n/**\n * Creates ECDSA signing interface for given elliptic curve `Point` and `hash` function.\n * We need `hash` for 2 features:\n * 1. Message prehash-ing. NOT used if `sign` / `verify` are called with `prehash: false`\n * 2. k generation in `sign`, using HMAC-drbg(hash)\n *\n * ECDSAOpts are only rarely needed.\n *\n * @example\n * ```js\n * const p256_Point = weierstrass(...);\n * const p256_sha256 = ecdsa(p256_Point, sha256);\n * const p256_sha224 = ecdsa(p256_Point, sha224);\n * const p256_sha224_r = ecdsa(p256_Point, sha224, { randomBytes: (length) => { ... } });\n * ```\n */\nexport function ecdsa(Point, hash, ecdsaOpts = {}) {\n    ahash(hash);\n    _validateObject(ecdsaOpts, {}, {\n        hmac: 'function',\n        lowS: 'boolean',\n        randomBytes: 'function',\n        bits2int: 'function',\n        bits2int_modN: 'function',\n    });\n    const randomBytes = ecdsaOpts.randomBytes || randomBytesWeb;\n    const hmac = ecdsaOpts.hmac ||\n        ((key, ...msgs) => nobleHmac(hash, key, concatBytes(...msgs)));\n    const { Fp, Fn } = Point;\n    const { ORDER: CURVE_ORDER, BITS: fnBits } = Fn;\n    const { keygen, getPublicKey, getSharedSecret, utils, lengths } = ecdh(Point, ecdsaOpts);\n    const defaultSigOpts = {\n        prehash: false,\n        lowS: typeof ecdsaOpts.lowS === 'boolean' ? ecdsaOpts.lowS : false,\n        format: undefined, //'compact' as ECDSASigFormat,\n        extraEntropy: false,\n    };\n    const defaultSigOpts_format = 'compact';\n    function isBiggerThanHalfOrder(number) {\n        const HALF = CURVE_ORDER >> _1n;\n        return number > HALF;\n    }\n    function validateRS(title, num) {\n        if (!Fn.isValidNot0(num))\n            throw new Error(`invalid signature ${title}: out of range 1..Point.Fn.ORDER`);\n        return num;\n    }\n    function validateSigLength(bytes, format) {\n        validateSigFormat(format);\n        const size = lengths.signature;\n        const sizer = format === 'compact' ? size : format === 'recovered' ? size + 1 : undefined;\n        return abytes(bytes, sizer, `${format} signature`);\n    }\n    /**\n     * ECDSA signature with its (r, s) properties. Supports compact, recovered & DER representations.\n     */\n    class Signature {\n        constructor(r, s, recovery) {\n            this.r = validateRS('r', r); // r in [1..N-1];\n            this.s = validateRS('s', s); // s in [1..N-1];\n            if (recovery != null)\n                this.recovery = recovery;\n            Object.freeze(this);\n        }\n        static fromBytes(bytes, format = defaultSigOpts_format) {\n            validateSigLength(bytes, format);\n            let recid;\n            if (format === 'der') {\n                const { r, s } = DER.toSig(abytes(bytes));\n                return new Signature(r, s);\n            }\n            if (format === 'recovered') {\n                recid = bytes[0];\n                format = 'compact';\n                bytes = bytes.subarray(1);\n            }\n            const L = Fn.BYTES;\n            const r = bytes.subarray(0, L);\n            const s = bytes.subarray(L, L * 2);\n            return new Signature(Fn.fromBytes(r), Fn.fromBytes(s), recid);\n        }\n        static fromHex(hex, format) {\n            return this.fromBytes(hexToBytes(hex), format);\n        }\n        addRecoveryBit(recovery) {\n            return new Signature(this.r, this.s, recovery);\n        }\n        recoverPublicKey(messageHash) {\n            const FIELD_ORDER = Fp.ORDER;\n            const { r, s, recovery: rec } = this;\n            if (rec == null || ![0, 1, 2, 3].includes(rec))\n                throw new Error('recovery id invalid');\n            // ECDSA recovery is hard for cofactor > 1 curves.\n            // In sign, `r = q.x mod n`, and here we recover q.x from r.\n            // While recovering q.x >= n, we need to add r+n for cofactor=1 curves.\n            // However, for cofactor>1, r+n may not get q.x:\n            // r+n*i would need to be done instead where i is unknown.\n            // To easily get i, we either need to:\n            // a. increase amount of valid recid values (4, 5...); OR\n            // b. prohibit non-prime-order signatures (recid > 1).\n            const hasCofactor = CURVE_ORDER * _2n < FIELD_ORDER;\n            if (hasCofactor && rec > 1)\n                throw new Error('recovery id is ambiguous for h>1 curve');\n            const radj = rec === 2 || rec === 3 ? r + CURVE_ORDER : r;\n            if (!Fp.isValid(radj))\n                throw new Error('recovery id 2 or 3 invalid');\n            const x = Fp.toBytes(radj);\n            const R = Point.fromBytes(concatBytes(pprefix((rec & 1) === 0), x));\n            const ir = Fn.inv(radj); // r^-1\n            const h = bits2int_modN(ensureBytes('msgHash', messageHash)); // Truncate hash\n            const u1 = Fn.create(-h * ir); // -hr^-1\n            const u2 = Fn.create(s * ir); // sr^-1\n            // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1). unsafe is fine: there is no private data.\n            const Q = Point.BASE.multiplyUnsafe(u1).add(R.multiplyUnsafe(u2));\n            if (Q.is0())\n                throw new Error('point at infinify');\n            Q.assertValidity();\n            return Q;\n        }\n        // Signatures should be low-s, to prevent malleability.\n        hasHighS() {\n            return isBiggerThanHalfOrder(this.s);\n        }\n        toBytes(format = defaultSigOpts_format) {\n            validateSigFormat(format);\n            if (format === 'der')\n                return hexToBytes(DER.hexFromSig(this));\n            const r = Fn.toBytes(this.r);\n            const s = Fn.toBytes(this.s);\n            if (format === 'recovered') {\n                if (this.recovery == null)\n                    throw new Error('recovery bit must be present');\n                return concatBytes(Uint8Array.of(this.recovery), r, s);\n            }\n            return concatBytes(r, s);\n        }\n        toHex(format) {\n            return bytesToHex(this.toBytes(format));\n        }\n        // TODO: remove\n        assertValidity() { }\n        static fromCompact(hex) {\n            return Signature.fromBytes(ensureBytes('sig', hex), 'compact');\n        }\n        static fromDER(hex) {\n            return Signature.fromBytes(ensureBytes('sig', hex), 'der');\n        }\n        normalizeS() {\n            return this.hasHighS() ? new Signature(this.r, Fn.neg(this.s), this.recovery) : this;\n        }\n        toDERRawBytes() {\n            return this.toBytes('der');\n        }\n        toDERHex() {\n            return bytesToHex(this.toBytes('der'));\n        }\n        toCompactRawBytes() {\n            return this.toBytes('compact');\n        }\n        toCompactHex() {\n            return bytesToHex(this.toBytes('compact'));\n        }\n    }\n    // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets.\n    // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int.\n    // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same.\n    // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors\n    const bits2int = ecdsaOpts.bits2int ||\n        function bits2int_def(bytes) {\n            // Our custom check \"just in case\", for protection against DoS\n            if (bytes.length > 8192)\n                throw new Error('input is too large');\n            // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m)\n            // for some cases, since bytes.length * 8 is not actual bitLength.\n            const num = bytesToNumberBE(bytes); // check for == u8 done here\n            const delta = bytes.length * 8 - fnBits; // truncate to nBitLength leftmost bits\n            return delta > 0 ? num >> BigInt(delta) : num;\n        };\n    const bits2int_modN = ecdsaOpts.bits2int_modN ||\n        function bits2int_modN_def(bytes) {\n            return Fn.create(bits2int(bytes)); // can't use bytesToNumberBE here\n        };\n    // Pads output with zero as per spec\n    const ORDER_MASK = bitMask(fnBits);\n    /** Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`. */\n    function int2octets(num) {\n        // IMPORTANT: the check ensures working for case `Fn.BYTES != Fn.BITS * 8`\n        aInRange('num < 2^' + fnBits, num, _0n, ORDER_MASK);\n        return Fn.toBytes(num);\n    }\n    function validateMsgAndHash(message, prehash) {\n        abytes(message, undefined, 'message');\n        return prehash ? abytes(hash(message), undefined, 'prehashed message') : message;\n    }\n    /**\n     * Steps A, D of RFC6979 3.2.\n     * Creates RFC6979 seed; converts msg/privKey to numbers.\n     * Used only in sign, not in verify.\n     *\n     * Warning: we cannot assume here that message has same amount of bytes as curve order,\n     * this will be invalid at least for P521. Also it can be bigger for P224 + SHA256.\n     */\n    function prepSig(message, privateKey, opts) {\n        if (['recovered', 'canonical'].some((k) => k in opts))\n            throw new Error('sign() legacy options not supported');\n        const { lowS, prehash, extraEntropy } = validateSigOpts(opts, defaultSigOpts);\n        message = validateMsgAndHash(message, prehash); // RFC6979 3.2 A: h1 = H(m)\n        // We can't later call bits2octets, since nested bits2int is broken for curves\n        // with fnBits % 8 !== 0. Because of that, we unwrap it here as int2octets call.\n        // const bits2octets = (bits) => int2octets(bits2int_modN(bits))\n        const h1int = bits2int_modN(message);\n        const d = _normFnElement(Fn, privateKey); // validate secret key, convert to bigint\n        const seedArgs = [int2octets(d), int2octets(h1int)];\n        // extraEntropy. RFC6979 3.6: additional k' (optional).\n        if (extraEntropy != null && extraEntropy !== false) {\n            // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k')\n            // gen random bytes OR pass as-is\n            const e = extraEntropy === true ? randomBytes(lengths.secretKey) : extraEntropy;\n            seedArgs.push(ensureBytes('extraEntropy', e)); // check for being bytes\n        }\n        const seed = concatBytes(...seedArgs); // Step D of RFC6979 3.2\n        const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash!\n        // Converts signature params into point w r/s, checks result for validity.\n        // To transform k => Signature:\n        // q = k⋅G\n        // r = q.x mod n\n        // s = k^-1(m + rd) mod n\n        // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to\n        // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it:\n        // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT\n        function k2sig(kBytes) {\n            // RFC 6979 Section 3.2, step 3: k = bits2int(T)\n            // Important: all mod() calls here must be done over N\n            const k = bits2int(kBytes); // mod n, not mod p\n            if (!Fn.isValidNot0(k))\n                return; // Valid scalars (including k) must be in 1..N-1\n            const ik = Fn.inv(k); // k^-1 mod n\n            const q = Point.BASE.multiply(k).toAffine(); // q = k⋅G\n            const r = Fn.create(q.x); // r = q.x mod n\n            if (r === _0n)\n                return;\n            const s = Fn.create(ik * Fn.create(m + r * d)); // Not using blinding here, see comment above\n            if (s === _0n)\n                return;\n            let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n)\n            let normS = s;\n            if (lowS && isBiggerThanHalfOrder(s)) {\n                normS = Fn.neg(s); // if lowS was passed, ensure s is always\n                recovery ^= 1; // // in the bottom half of N\n            }\n            return new Signature(r, normS, recovery); // use normS, not s\n        }\n        return { seed, k2sig };\n    }\n    /**\n     * Signs message hash with a secret key.\n     *\n     * ```\n     * sign(m, d) where\n     *   k = rfc6979_hmac_drbg(m, d)\n     *   (x, y) = G × k\n     *   r = x mod n\n     *   s = (m + dr) / k mod n\n     * ```\n     */\n    function sign(message, secretKey, opts = {}) {\n        message = ensureBytes('message', message);\n        const { seed, k2sig } = prepSig(message, secretKey, opts); // Steps A, D of RFC6979 3.2.\n        const drbg = createHmacDrbg(hash.outputLen, Fn.BYTES, hmac);\n        const sig = drbg(seed, k2sig); // Steps B, C, D, E, F, G\n        return sig;\n    }\n    function tryParsingSig(sg) {\n        // Try to deduce format\n        let sig = undefined;\n        const isHex = typeof sg === 'string' || isBytes(sg);\n        const isObj = !isHex &&\n            sg !== null &&\n            typeof sg === 'object' &&\n            typeof sg.r === 'bigint' &&\n            typeof sg.s === 'bigint';\n        if (!isHex && !isObj)\n            throw new Error('invalid signature, expected Uint8Array, hex string or Signature instance');\n        if (isObj) {\n            sig = new Signature(sg.r, sg.s);\n        }\n        else if (isHex) {\n            try {\n                sig = Signature.fromBytes(ensureBytes('sig', sg), 'der');\n            }\n            catch (derError) {\n                if (!(derError instanceof DER.Err))\n                    throw derError;\n            }\n            if (!sig) {\n                try {\n                    sig = Signature.fromBytes(ensureBytes('sig', sg), 'compact');\n                }\n                catch (error) {\n                    return false;\n                }\n            }\n        }\n        if (!sig)\n            return false;\n        return sig;\n    }\n    /**\n     * Verifies a signature against message and public key.\n     * Rejects lowS signatures by default: see {@link ECDSAVerifyOpts}.\n     * Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf:\n     *\n     * ```\n     * verify(r, s, h, P) where\n     *   u1 = hs^-1 mod n\n     *   u2 = rs^-1 mod n\n     *   R = u1⋅G + u2⋅P\n     *   mod(R.x, n) == r\n     * ```\n     */\n    function verify(signature, message, publicKey, opts = {}) {\n        const { lowS, prehash, format } = validateSigOpts(opts, defaultSigOpts);\n        publicKey = ensureBytes('publicKey', publicKey);\n        message = validateMsgAndHash(ensureBytes('message', message), prehash);\n        if ('strict' in opts)\n            throw new Error('options.strict was renamed to lowS');\n        const sig = format === undefined\n            ? tryParsingSig(signature)\n            : Signature.fromBytes(ensureBytes('sig', signature), format);\n        if (sig === false)\n            return false;\n        try {\n            const P = Point.fromBytes(publicKey);\n            if (lowS && sig.hasHighS())\n                return false;\n            const { r, s } = sig;\n            const h = bits2int_modN(message); // mod n, not mod p\n            const is = Fn.inv(s); // s^-1 mod n\n            const u1 = Fn.create(h * is); // u1 = hs^-1 mod n\n            const u2 = Fn.create(r * is); // u2 = rs^-1 mod n\n            const R = Point.BASE.multiplyUnsafe(u1).add(P.multiplyUnsafe(u2)); // u1⋅G + u2⋅P\n            if (R.is0())\n                return false;\n            const v = Fn.create(R.x); // v = r.x mod n\n            return v === r;\n        }\n        catch (e) {\n            return false;\n        }\n    }\n    function recoverPublicKey(signature, message, opts = {}) {\n        const { prehash } = validateSigOpts(opts, defaultSigOpts);\n        message = validateMsgAndHash(message, prehash);\n        return Signature.fromBytes(signature, 'recovered').recoverPublicKey(message).toBytes();\n    }\n    return Object.freeze({\n        keygen,\n        getPublicKey,\n        getSharedSecret,\n        utils,\n        lengths,\n        Point,\n        sign,\n        verify,\n        recoverPublicKey,\n        Signature,\n        hash,\n    });\n}\n/** @deprecated use `weierstrass` in newer releases */\nexport function weierstrassPoints(c) {\n    const { CURVE, curveOpts } = _weierstrass_legacy_opts_to_new(c);\n    const Point = weierstrassN(CURVE, curveOpts);\n    return _weierstrass_new_output_to_legacy(c, Point);\n}\nfunction _weierstrass_legacy_opts_to_new(c) {\n    const CURVE = {\n        a: c.a,\n        b: c.b,\n        p: c.Fp.ORDER,\n        n: c.n,\n        h: c.h,\n        Gx: c.Gx,\n        Gy: c.Gy,\n    };\n    const Fp = c.Fp;\n    let allowedLengths = c.allowedPrivateKeyLengths\n        ? Array.from(new Set(c.allowedPrivateKeyLengths.map((l) => Math.ceil(l / 2))))\n        : undefined;\n    const Fn = Field(CURVE.n, {\n        BITS: c.nBitLength,\n        allowedLengths: allowedLengths,\n        modFromBytes: c.wrapPrivateKey,\n    });\n    const curveOpts = {\n        Fp,\n        Fn,\n        allowInfinityPoint: c.allowInfinityPoint,\n        endo: c.endo,\n        isTorsionFree: c.isTorsionFree,\n        clearCofactor: c.clearCofactor,\n        fromBytes: c.fromBytes,\n        toBytes: c.toBytes,\n    };\n    return { CURVE, curveOpts };\n}\nfunction _ecdsa_legacy_opts_to_new(c) {\n    const { CURVE, curveOpts } = _weierstrass_legacy_opts_to_new(c);\n    const ecdsaOpts = {\n        hmac: c.hmac,\n        randomBytes: c.randomBytes,\n        lowS: c.lowS,\n        bits2int: c.bits2int,\n        bits2int_modN: c.bits2int_modN,\n    };\n    return { CURVE, curveOpts, hash: c.hash, ecdsaOpts };\n}\nexport function _legacyHelperEquat(Fp, a, b) {\n    /**\n     * y² = x³ + ax + b: Short weierstrass curve formula. Takes x, returns y².\n     * @returns y²\n     */\n    function weierstrassEquation(x) {\n        const x2 = Fp.sqr(x); // x * x\n        const x3 = Fp.mul(x2, x); // x² * x\n        return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x³ + a * x + b\n    }\n    return weierstrassEquation;\n}\nfunction _weierstrass_new_output_to_legacy(c, Point) {\n    const { Fp, Fn } = Point;\n    function isWithinCurveOrder(num) {\n        return inRange(num, _1n, Fn.ORDER);\n    }\n    const weierstrassEquation = _legacyHelperEquat(Fp, c.a, c.b);\n    return Object.assign({}, {\n        CURVE: c,\n        Point: Point,\n        ProjectivePoint: Point,\n        normPrivateKeyToScalar: (key) => _normFnElement(Fn, key),\n        weierstrassEquation,\n        isWithinCurveOrder,\n    });\n}\nfunction _ecdsa_new_output_to_legacy(c, _ecdsa) {\n    const Point = _ecdsa.Point;\n    return Object.assign({}, _ecdsa, {\n        ProjectivePoint: Point,\n        CURVE: Object.assign({}, c, nLength(Point.Fn.ORDER, Point.Fn.BITS)),\n    });\n}\n// _ecdsa_legacy\nexport function weierstrass(c) {\n    const { CURVE, curveOpts, hash, ecdsaOpts } = _ecdsa_legacy_opts_to_new(c);\n    const Point = weierstrassN(CURVE, curveOpts);\n    const signs = ecdsa(Point, hash, ecdsaOpts);\n    return _ecdsa_new_output_to_legacy(c, signs);\n}\n//# sourceMappingURL=weierstrass.js.map","/**\n * Utilities for hex, bytes, CSPRNG.\n * @module\n */\n/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */\n/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */\nexport function isBytes(a) {\n    return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');\n}\n/** Asserts something is boolean. */\nexport function abool(b) {\n    if (typeof b !== 'boolean')\n        throw new Error(`boolean expected, not ${b}`);\n}\n/** Asserts something is positive integer. */\nexport function anumber(n) {\n    if (!Number.isSafeInteger(n) || n < 0)\n        throw new Error('positive integer expected, got ' + n);\n}\n/** Asserts something is Uint8Array. */\nexport function abytes(b, ...lengths) {\n    if (!isBytes(b))\n        throw new Error('Uint8Array expected');\n    if (lengths.length > 0 && !lengths.includes(b.length))\n        throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);\n}\n/**\n * Asserts something is hash\n * TODO: remove\n * @deprecated\n */\nexport function ahash(h) {\n    if (typeof h !== 'function' || typeof h.create !== 'function')\n        throw new Error('Hash should be wrapped by utils.createHasher');\n    anumber(h.outputLen);\n    anumber(h.blockLen);\n}\n/** Asserts a hash instance has not been destroyed / finished */\nexport function aexists(instance, checkFinished = true) {\n    if (instance.destroyed)\n        throw new Error('Hash instance has been destroyed');\n    if (checkFinished && instance.finished)\n        throw new Error('Hash#digest() has already been called');\n}\n/** Asserts output is properly-sized byte array */\nexport function aoutput(out, instance) {\n    abytes(out);\n    const min = instance.outputLen;\n    if (out.length < min) {\n        throw new Error('digestInto() expects output buffer of length at least ' + min);\n    }\n}\n/** Cast u8 / u16 / u32 to u8. */\nexport function u8(arr) {\n    return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/** Cast u8 / u16 / u32 to u32. */\nexport function u32(arr) {\n    return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n}\n/** Zeroize a byte array. Warning: JS provides no guarantees. */\nexport function clean(...arrays) {\n    for (let i = 0; i < arrays.length; i++) {\n        arrays[i].fill(0);\n    }\n}\n/** Create DataView of an array for easy byte-level manipulation. */\nexport function createView(arr) {\n    return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/** Is current platform little-endian? Most are. Big-Endian platform: IBM */\nexport const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();\n// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex\nconst hasHexBuiltin = /* @__PURE__ */ (() => \n// @ts-ignore\ntypeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * Convert byte array to hex string. Uses built-in function, when available.\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n    abytes(bytes);\n    // @ts-ignore\n    if (hasHexBuiltin)\n        return bytes.toHex();\n    // pre-caching improves the speed 6x\n    let hex = '';\n    for (let i = 0; i < bytes.length; i++) {\n        hex += hexes[bytes[i]];\n    }\n    return hex;\n}\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };\nfunction asciiToBase16(ch) {\n    if (ch >= asciis._0 && ch <= asciis._9)\n        return ch - asciis._0; // '2' => 50-48\n    if (ch >= asciis.A && ch <= asciis.F)\n        return ch - (asciis.A - 10); // 'B' => 66-(65-10)\n    if (ch >= asciis.a && ch <= asciis.f)\n        return ch - (asciis.a - 10); // 'b' => 98-(97-10)\n    return;\n}\n/**\n * Convert hex string to byte array. Uses built-in function, when available.\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n    if (typeof hex !== 'string')\n        throw new Error('hex string expected, got ' + typeof hex);\n    // @ts-ignore\n    if (hasHexBuiltin)\n        return Uint8Array.fromHex(hex);\n    const hl = hex.length;\n    const al = hl / 2;\n    if (hl % 2)\n        throw new Error('hex string expected, got unpadded hex of length ' + hl);\n    const array = new Uint8Array(al);\n    for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n        const n1 = asciiToBase16(hex.charCodeAt(hi));\n        const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n        if (n1 === undefined || n2 === undefined) {\n            const char = hex[hi] + hex[hi + 1];\n            throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n        }\n        array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163\n    }\n    return array;\n}\n// Used in micro\nexport function hexToNumber(hex) {\n    if (typeof hex !== 'string')\n        throw new Error('hex string expected, got ' + typeof hex);\n    return BigInt(hex === '' ? '0' : '0x' + hex); // Big Endian\n}\n// Used in ff1\n// BE: Big Endian, LE: Little Endian\nexport function bytesToNumberBE(bytes) {\n    return hexToNumber(bytesToHex(bytes));\n}\n// Used in micro, ff1\nexport function numberToBytesBE(n, len) {\n    return hexToBytes(n.toString(16).padStart(len * 2, '0'));\n}\n// TODO: remove\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => { };\n/**\n * Converts string to bytes using UTF8 encoding.\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n    if (typeof str !== 'string')\n        throw new Error('string expected');\n    return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Converts bytes to string using UTF8 encoding.\n * @example bytesToUtf8(new Uint8Array([97, 98, 99])) // 'abc'\n */\nexport function bytesToUtf8(bytes) {\n    return new TextDecoder().decode(bytes);\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data) {\n    if (typeof data === 'string')\n        data = utf8ToBytes(data);\n    else if (isBytes(data))\n        data = copyBytes(data);\n    else\n        throw new Error('Uint8Array expected, got ' + typeof data);\n    return data;\n}\n/**\n * Checks if two U8A use same underlying buffer and overlaps.\n * This is invalid and can corrupt data.\n */\nexport function overlapBytes(a, b) {\n    return (a.buffer === b.buffer && // best we can do, may fail with an obscure Proxy\n        a.byteOffset < b.byteOffset + b.byteLength && // a starts before b end\n        b.byteOffset < a.byteOffset + a.byteLength // b starts before a end\n    );\n}\n/**\n * If input and output overlap and input starts before output, we will overwrite end of input before\n * we start processing it, so this is not supported for most ciphers (except chacha/salse, which designed with this)\n */\nexport function complexOverlapBytes(input, output) {\n    // This is very cursed. It works somehow, but I'm completely unsure,\n    // reasoning about overlapping aligned windows is very hard.\n    if (overlapBytes(input, output) && input.byteOffset < output.byteOffset)\n        throw new Error('complex overlap of input and output is not supported');\n}\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays) {\n    let sum = 0;\n    for (let i = 0; i < arrays.length; i++) {\n        const a = arrays[i];\n        abytes(a);\n        sum += a.length;\n    }\n    const res = new Uint8Array(sum);\n    for (let i = 0, pad = 0; i < arrays.length; i++) {\n        const a = arrays[i];\n        res.set(a, pad);\n        pad += a.length;\n    }\n    return res;\n}\nexport function checkOpts(defaults, opts) {\n    if (opts == null || typeof opts !== 'object')\n        throw new Error('options must be defined');\n    const merged = Object.assign(defaults, opts);\n    return merged;\n}\n/** Compares 2 uint8array-s in kinda constant time. */\nexport function equalBytes(a, b) {\n    if (a.length !== b.length)\n        return false;\n    let diff = 0;\n    for (let i = 0; i < a.length; i++)\n        diff |= a[i] ^ b[i];\n    return diff === 0;\n}\n// TODO: remove\n/** For runtime check if class implements interface. */\nexport class Hash {\n}\n/**\n * Wraps a cipher: validates args, ensures encrypt() can only be called once.\n * @__NO_SIDE_EFFECTS__\n */\nexport const wrapCipher = (params, constructor) => {\n    function wrappedCipher(key, ...args) {\n        // Validate key\n        abytes(key);\n        // Big-Endian hardware is rare. Just in case someone still decides to run ciphers:\n        if (!isLE)\n            throw new Error('Non little-endian hardware is not yet supported');\n        // Validate nonce if nonceLength is present\n        if (params.nonceLength !== undefined) {\n            const nonce = args[0];\n            if (!nonce)\n                throw new Error('nonce / iv required');\n            if (params.varSizeNonce)\n                abytes(nonce);\n            else\n                abytes(nonce, params.nonceLength);\n        }\n        // Validate AAD if tagLength present\n        const tagl = params.tagLength;\n        if (tagl && args[1] !== undefined) {\n            abytes(args[1]);\n        }\n        const cipher = constructor(key, ...args);\n        const checkOutput = (fnLength, output) => {\n            if (output !== undefined) {\n                if (fnLength !== 2)\n                    throw new Error('cipher output not supported');\n                abytes(output);\n            }\n        };\n        // Create wrapped cipher with validation and single-use encryption\n        let called = false;\n        const wrCipher = {\n            encrypt(data, output) {\n                if (called)\n                    throw new Error('cannot encrypt() twice with same key + nonce');\n                called = true;\n                abytes(data);\n                checkOutput(cipher.encrypt.length, output);\n                return cipher.encrypt(data, output);\n            },\n            decrypt(data, output) {\n                abytes(data);\n                if (tagl && data.length < tagl)\n                    throw new Error('invalid ciphertext length: smaller than tagLength=' + tagl);\n                checkOutput(cipher.decrypt.length, output);\n                return cipher.decrypt(data, output);\n            },\n        };\n        return wrCipher;\n    }\n    Object.assign(wrappedCipher, params);\n    return wrappedCipher;\n};\n/**\n * By default, returns u8a of length.\n * When out is available, it checks it for validity and uses it.\n */\nexport function getOutput(expectedLength, out, onlyAligned = true) {\n    if (out === undefined)\n        return new Uint8Array(expectedLength);\n    if (out.length !== expectedLength)\n        throw new Error('invalid output length, expected ' + expectedLength + ', got: ' + out.length);\n    if (onlyAligned && !isAligned32(out))\n        throw new Error('invalid output, must be aligned');\n    return out;\n}\n/** Polyfill for Safari 14. */\nexport function setBigUint64(view, byteOffset, value, isLE) {\n    if (typeof view.setBigUint64 === 'function')\n        return view.setBigUint64(byteOffset, value, isLE);\n    const _32n = BigInt(32);\n    const _u32_max = BigInt(0xffffffff);\n    const wh = Number((value >> _32n) & _u32_max);\n    const wl = Number(value & _u32_max);\n    const h = isLE ? 4 : 0;\n    const l = isLE ? 0 : 4;\n    view.setUint32(byteOffset + h, wh, isLE);\n    view.setUint32(byteOffset + l, wl, isLE);\n}\nexport function u64Lengths(dataLength, aadLength, isLE) {\n    abool(isLE);\n    const num = new Uint8Array(16);\n    const view = createView(num);\n    setBigUint64(view, 0, BigInt(aadLength), isLE);\n    setBigUint64(view, 8, BigInt(dataLength), isLE);\n    return num;\n}\n// Is byte array aligned to 4 byte offset (u32)?\nexport function isAligned32(bytes) {\n    return bytes.byteOffset % 4 === 0;\n}\n// copy bytes to new u8a (aligned). Because Buffer.slice is broken.\nexport function copyBytes(bytes) {\n    return Uint8Array.from(bytes);\n}\n//# sourceMappingURL=utils.js.map","/**\n * GHash from AES-GCM and its little-endian \"mirror image\" Polyval from AES-SIV.\n *\n * Implemented in terms of GHash with conversion function for keys\n * GCM GHASH from\n * [NIST SP800-38d](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf),\n * SIV from\n * [RFC 8452](https://datatracker.ietf.org/doc/html/rfc8452).\n *\n * GHASH   modulo: x^128 + x^7   + x^2   + x     + 1\n * POLYVAL modulo: x^128 + x^127 + x^126 + x^121 + 1\n *\n * @module\n */\n// prettier-ignore\nimport { abytes, aexists, aoutput, clean, copyBytes, createView, Hash, toBytes, u32, } from \"./utils.js\";\nconst BLOCK_SIZE = 16;\n// TODO: rewrite\n// temporary padding buffer\nconst ZEROS16 = /* @__PURE__ */ new Uint8Array(16);\nconst ZEROS32 = u32(ZEROS16);\nconst POLY = 0xe1; // v = 2*v % POLY\n// v = 2*v % POLY\n// NOTE: because x + x = 0 (add/sub is same), mul2(x) != x+x\n// We can multiply any number using montgomery ladder and this function (works as double, add is simple xor)\nconst mul2 = (s0, s1, s2, s3) => {\n    const hiBit = s3 & 1;\n    return {\n        s3: (s2 << 31) | (s3 >>> 1),\n        s2: (s1 << 31) | (s2 >>> 1),\n        s1: (s0 << 31) | (s1 >>> 1),\n        s0: (s0 >>> 1) ^ ((POLY << 24) & -(hiBit & 1)), // reduce % poly\n    };\n};\nconst swapLE = (n) => (((n >>> 0) & 0xff) << 24) |\n    (((n >>> 8) & 0xff) << 16) |\n    (((n >>> 16) & 0xff) << 8) |\n    ((n >>> 24) & 0xff) |\n    0;\n/**\n * `mulX_POLYVAL(ByteReverse(H))` from spec\n * @param k mutated in place\n */\nexport function _toGHASHKey(k) {\n    k.reverse();\n    const hiBit = k[15] & 1;\n    // k >>= 1\n    let carry = 0;\n    for (let i = 0; i < k.length; i++) {\n        const t = k[i];\n        k[i] = (t >>> 1) | carry;\n        carry = (t & 1) << 7;\n    }\n    k[0] ^= -hiBit & 0xe1; // if (hiBit) n ^= 0xe1000000000000000000000000000000;\n    return k;\n}\nconst estimateWindow = (bytes) => {\n    if (bytes > 64 * 1024)\n        return 8;\n    if (bytes > 1024)\n        return 4;\n    return 2;\n};\nclass GHASH {\n    // We select bits per window adaptively based on expectedLength\n    constructor(key, expectedLength) {\n        this.blockLen = BLOCK_SIZE;\n        this.outputLen = BLOCK_SIZE;\n        this.s0 = 0;\n        this.s1 = 0;\n        this.s2 = 0;\n        this.s3 = 0;\n        this.finished = false;\n        key = toBytes(key);\n        abytes(key, 16);\n        const kView = createView(key);\n        let k0 = kView.getUint32(0, false);\n        let k1 = kView.getUint32(4, false);\n        let k2 = kView.getUint32(8, false);\n        let k3 = kView.getUint32(12, false);\n        // generate table of doubled keys (half of montgomery ladder)\n        const doubles = [];\n        for (let i = 0; i < 128; i++) {\n            doubles.push({ s0: swapLE(k0), s1: swapLE(k1), s2: swapLE(k2), s3: swapLE(k3) });\n            ({ s0: k0, s1: k1, s2: k2, s3: k3 } = mul2(k0, k1, k2, k3));\n        }\n        const W = estimateWindow(expectedLength || 1024);\n        if (![1, 2, 4, 8].includes(W))\n            throw new Error('ghash: invalid window size, expected 2, 4 or 8');\n        this.W = W;\n        const bits = 128; // always 128 bits;\n        const windows = bits / W;\n        const windowSize = (this.windowSize = 2 ** W);\n        const items = [];\n        // Create precompute table for window of W bits\n        for (let w = 0; w < windows; w++) {\n            // truth table: 00, 01, 10, 11\n            for (let byte = 0; byte < windowSize; byte++) {\n                // prettier-ignore\n                let s0 = 0, s1 = 0, s2 = 0, s3 = 0;\n                for (let j = 0; j < W; j++) {\n                    const bit = (byte >>> (W - j - 1)) & 1;\n                    if (!bit)\n                        continue;\n                    const { s0: d0, s1: d1, s2: d2, s3: d3 } = doubles[W * w + j];\n                    (s0 ^= d0), (s1 ^= d1), (s2 ^= d2), (s3 ^= d3);\n                }\n                items.push({ s0, s1, s2, s3 });\n            }\n        }\n        this.t = items;\n    }\n    _updateBlock(s0, s1, s2, s3) {\n        (s0 ^= this.s0), (s1 ^= this.s1), (s2 ^= this.s2), (s3 ^= this.s3);\n        const { W, t, windowSize } = this;\n        // prettier-ignore\n        let o0 = 0, o1 = 0, o2 = 0, o3 = 0;\n        const mask = (1 << W) - 1; // 2**W will kill performance.\n        let w = 0;\n        for (const num of [s0, s1, s2, s3]) {\n            for (let bytePos = 0; bytePos < 4; bytePos++) {\n                const byte = (num >>> (8 * bytePos)) & 0xff;\n                for (let bitPos = 8 / W - 1; bitPos >= 0; bitPos--) {\n                    const bit = (byte >>> (W * bitPos)) & mask;\n                    const { s0: e0, s1: e1, s2: e2, s3: e3 } = t[w * windowSize + bit];\n                    (o0 ^= e0), (o1 ^= e1), (o2 ^= e2), (o3 ^= e3);\n                    w += 1;\n                }\n            }\n        }\n        this.s0 = o0;\n        this.s1 = o1;\n        this.s2 = o2;\n        this.s3 = o3;\n    }\n    update(data) {\n        aexists(this);\n        data = toBytes(data);\n        abytes(data);\n        const b32 = u32(data);\n        const blocks = Math.floor(data.length / BLOCK_SIZE);\n        const left = data.length % BLOCK_SIZE;\n        for (let i = 0; i < blocks; i++) {\n            this._updateBlock(b32[i * 4 + 0], b32[i * 4 + 1], b32[i * 4 + 2], b32[i * 4 + 3]);\n        }\n        if (left) {\n            ZEROS16.set(data.subarray(blocks * BLOCK_SIZE));\n            this._updateBlock(ZEROS32[0], ZEROS32[1], ZEROS32[2], ZEROS32[3]);\n            clean(ZEROS32); // clean tmp buffer\n        }\n        return this;\n    }\n    destroy() {\n        const { t } = this;\n        // clean precompute table\n        for (const elm of t) {\n            (elm.s0 = 0), (elm.s1 = 0), (elm.s2 = 0), (elm.s3 = 0);\n        }\n    }\n    digestInto(out) {\n        aexists(this);\n        aoutput(out, this);\n        this.finished = true;\n        const { s0, s1, s2, s3 } = this;\n        const o32 = u32(out);\n        o32[0] = s0;\n        o32[1] = s1;\n        o32[2] = s2;\n        o32[3] = s3;\n        return out;\n    }\n    digest() {\n        const res = new Uint8Array(BLOCK_SIZE);\n        this.digestInto(res);\n        this.destroy();\n        return res;\n    }\n}\nclass Polyval extends GHASH {\n    constructor(key, expectedLength) {\n        key = toBytes(key);\n        abytes(key);\n        const ghKey = _toGHASHKey(copyBytes(key));\n        super(ghKey, expectedLength);\n        clean(ghKey);\n    }\n    update(data) {\n        data = toBytes(data);\n        aexists(this);\n        const b32 = u32(data);\n        const left = data.length % BLOCK_SIZE;\n        const blocks = Math.floor(data.length / BLOCK_SIZE);\n        for (let i = 0; i < blocks; i++) {\n            this._updateBlock(swapLE(b32[i * 4 + 3]), swapLE(b32[i * 4 + 2]), swapLE(b32[i * 4 + 1]), swapLE(b32[i * 4 + 0]));\n        }\n        if (left) {\n            ZEROS16.set(data.subarray(blocks * BLOCK_SIZE));\n            this._updateBlock(swapLE(ZEROS32[3]), swapLE(ZEROS32[2]), swapLE(ZEROS32[1]), swapLE(ZEROS32[0]));\n            clean(ZEROS32);\n        }\n        return this;\n    }\n    digestInto(out) {\n        aexists(this);\n        aoutput(out, this);\n        this.finished = true;\n        // tmp ugly hack\n        const { s0, s1, s2, s3 } = this;\n        const o32 = u32(out);\n        o32[0] = s0;\n        o32[1] = s1;\n        o32[2] = s2;\n        o32[3] = s3;\n        return out.reverse();\n    }\n}\nfunction wrapConstructorWithKey(hashCons) {\n    const hashC = (msg, key) => hashCons(key, msg.length).update(toBytes(msg)).digest();\n    const tmp = hashCons(new Uint8Array(16), 0);\n    hashC.outputLen = tmp.outputLen;\n    hashC.blockLen = tmp.blockLen;\n    hashC.create = (key, expectedLength) => hashCons(key, expectedLength);\n    return hashC;\n}\n/** GHash MAC for AES-GCM. */\nexport const ghash = wrapConstructorWithKey((key, expectedLength) => new GHASH(key, expectedLength));\n/** Polyval MAC for AES-SIV. */\nexport const polyval = wrapConstructorWithKey((key, expectedLength) => new Polyval(key, expectedLength));\n//# sourceMappingURL=_polyval.js.map","var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __export = (target, all) => {\n  for (var name in all)\n    __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __publicField = (obj, key, value) => {\n  __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n  return value;\n};\n\n// src/sm2/index.ts\nvar sm2_exports = {};\n__export(sm2_exports, {\n  EmptyArray: () => EmptyArray,\n  arrayToHex: () => arrayToHex,\n  arrayToUtf8: () => arrayToUtf8,\n  calculateSharedKey: () => calculateSharedKey,\n  comparePublicKeyHex: () => comparePublicKeyHex,\n  compressPublicKeyHex: () => compressPublicKeyHex,\n  doDecrypt: () => doDecrypt,\n  doEncrypt: () => doEncrypt,\n  doSignature: () => doSignature,\n  doVerifySignature: () => doVerifySignature,\n  ecdh: () => getSharedSecret,\n  generateKeyPairHex: () => generateKeyPairHex,\n  getHash: () => getHash,\n  getPoint: () => getPoint,\n  getPublicKeyFromPrivateKey: () => getPublicKeyFromPrivateKey,\n  getZ: () => getZ,\n  hexToArray: () => hexToArray,\n  initRNGPool: () => initRNGPool,\n  leftPad: () => leftPad,\n  precomputePublicKey: () => precomputePublicKey,\n  utf8ToHex: () => utf8ToHex,\n  verifyPublicKey: () => verifyPublicKey\n});\n\n// src/sm2/asn1.ts\nimport * as utils from \"@noble/curves/abstract/utils\";\n\n// src/sm2/bn.ts\nvar ZERO = BigInt(0);\nvar ONE = BigInt(1);\nvar TWO = BigInt(2);\nvar THREE = BigInt(3);\n\n// src/sm2/asn1.ts\nfunction bigintToValue(bigint) {\n  let h = bigint.toString(16);\n  if (h[0] !== \"-\") {\n    if (h.length % 2 === 1)\n      h = \"0\" + h;\n    else if (!h.match(/^[0-7]/))\n      h = \"00\" + h;\n  } else {\n    h = h.substring(1);\n    let len = h.length;\n    if (len % 2 === 1)\n      len += 1;\n    else if (!h.match(/^[0-7]/))\n      len += 2;\n    let maskString = \"\";\n    for (let i = 0; i < len; i++)\n      maskString += \"f\";\n    let mask = utils.hexToNumber(maskString);\n    let output = (mask ^ bigint) + ONE;\n    h = output.toString(16).replace(/^-/, \"\");\n  }\n  return h;\n}\nvar ASN1Object = class {\n  constructor(tlv = null, t = \"00\", l = \"00\", v = \"\") {\n    this.tlv = tlv;\n    this.t = t;\n    this.l = l;\n    this.v = v;\n  }\n  /**\n   * 获取 der 编码比特流16进制串\n   */\n  getEncodedHex() {\n    if (!this.tlv) {\n      this.v = this.getValue();\n      this.l = this.getLength();\n      this.tlv = this.t + this.l + this.v;\n    }\n    return this.tlv;\n  }\n  getLength() {\n    const n = this.v.length / 2;\n    let nHex = n.toString(16);\n    if (nHex.length % 2 === 1)\n      nHex = \"0\" + nHex;\n    if (n < 128) {\n      return nHex;\n    } else {\n      const head = 128 + nHex.length / 2;\n      return head.toString(16) + nHex;\n    }\n  }\n  getValue() {\n    return \"\";\n  }\n};\nvar DERInteger = class extends ASN1Object {\n  constructor(bigint) {\n    super();\n    this.t = \"02\";\n    if (bigint)\n      this.v = bigintToValue(bigint);\n  }\n  getValue() {\n    return this.v;\n  }\n};\nvar DEROctetString = class extends ASN1Object {\n  constructor(s) {\n    super();\n    this.s = s;\n    __publicField(this, \"hV\", \"\");\n    this.t = \"04\";\n    if (s)\n      this.v = s.toLowerCase();\n  }\n  getValue() {\n    return this.v;\n  }\n};\nvar DERSequence = class extends ASN1Object {\n  constructor(asn1Array) {\n    super();\n    this.asn1Array = asn1Array;\n    __publicField(this, \"t\", \"30\");\n  }\n  getValue() {\n    this.v = this.asn1Array.map((asn1Object) => asn1Object.getEncodedHex()).join(\"\");\n    return this.v;\n  }\n};\nfunction getLenOfL(str, start) {\n  if (+str[start + 2] < 8)\n    return 1;\n  const encoded = str.slice(start + 2, start + 6);\n  const headHex = encoded.slice(0, 2);\n  const head = parseInt(headHex, 16);\n  const nHexLength = 1 + (head - 128);\n  return nHexLength;\n}\nfunction getL(str, start) {\n  const len = getLenOfL(str, start);\n  const l = str.substring(start + 2, start + 2 + len * 2);\n  if (!l)\n    return -1;\n  const bigint = +l[0] < 8 ? utils.hexToNumber(l) : utils.hexToNumber(l.substring(2));\n  return +bigint.toString();\n}\nfunction getStartOfV(str, start) {\n  const len = getLenOfL(str, start);\n  return start + (len + 1) * 2;\n}\nfunction encodeDer(r, s) {\n  const derR = new DERInteger(r);\n  const derS = new DERInteger(s);\n  const derSeq = new DERSequence([derR, derS]);\n  return derSeq.getEncodedHex();\n}\nfunction encodeEnc(x2, y, hash, cipher) {\n  const derX = new DERInteger(x2);\n  const derY = new DERInteger(y);\n  const derHash = new DEROctetString(hash);\n  const derCipher = new DEROctetString(cipher);\n  const derSeq = new DERSequence([derX, derY, derHash, derCipher]);\n  return derSeq.getEncodedHex();\n}\nfunction decodeDer(input) {\n  const start = getStartOfV(input, 0);\n  const vIndexR = getStartOfV(input, start);\n  const lR = getL(input, start);\n  const vR = input.substring(vIndexR, vIndexR + lR * 2);\n  const nextStart = vIndexR + vR.length;\n  const vIndexS = getStartOfV(input, nextStart);\n  const lS = getL(input, nextStart);\n  const vS = input.substring(vIndexS, vIndexS + lS * 2);\n  const r = utils.hexToNumber(vR);\n  const s = utils.hexToNumber(vS);\n  return { r, s };\n}\nfunction decodeEnc(input) {\n  function extractSequence(input2, start2) {\n    const vIndex = getStartOfV(input2, start2);\n    const length = getL(input2, start2);\n    const value = input2.substring(vIndex, vIndex + length * 2);\n    const nextStart = vIndex + value.length;\n    return { value, nextStart };\n  }\n  const start = getStartOfV(input, 0);\n  const { value: vR, nextStart: startS } = extractSequence(input, start);\n  const { value: vS, nextStart: startHash } = extractSequence(input, startS);\n  const { value: hash, nextStart: startCipher } = extractSequence(input, startHash);\n  const { value: cipher } = extractSequence(input, startCipher);\n  const x2 = utils.hexToNumber(vR);\n  const y = utils.hexToNumber(vS);\n  return { x: x2, y, hash, cipher };\n}\n\n// src/sm2/utils.ts\nimport * as utils2 from \"@noble/curves/abstract/utils\";\n\n// src/sm2/ec.ts\nimport { weierstrass } from \"@noble/curves/abstract/weierstrass\";\nimport { Field } from \"@noble/curves/abstract/modular\";\n\n// src/sm2/rng.ts\nvar DEFAULT_PRNG_POOL_SIZE = 16384;\nvar prngPool = new Uint8Array(0);\nvar _syncCrypto;\nasync function initRNGPool() {\n  if (\"crypto\" in globalThis) {\n    _syncCrypto = globalThis.crypto;\n    return;\n  }\n  if (prngPool.length > DEFAULT_PRNG_POOL_SIZE / 2)\n    return;\n  if (\"wx\" in globalThis && \"getRandomValues\" in globalThis.wx) {\n    prngPool = await new Promise((r) => {\n      wx.getRandomValues({\n        length: DEFAULT_PRNG_POOL_SIZE,\n        success(res) {\n          r(new Uint8Array(res.randomValues));\n        }\n      });\n    });\n  } else {\n    try {\n      if (globalThis.crypto) {\n        _syncCrypto = globalThis.crypto;\n      } else {\n        const crypto = await import(\n          /* webpackIgnore: true */\n          \"crypto\"\n        );\n        _syncCrypto = crypto.webcrypto;\n      }\n      const array = new Uint8Array(DEFAULT_PRNG_POOL_SIZE);\n      _syncCrypto.getRandomValues(array);\n      prngPool = array;\n    } catch (error) {\n      throw new Error(\"no available csprng, abort.\");\n    }\n  }\n}\ninitRNGPool();\nfunction consumePool(length) {\n  if (prngPool.length > length) {\n    const prng = prngPool.slice(0, length);\n    prngPool = prngPool.slice(length);\n    initRNGPool();\n    return prng;\n  } else {\n    throw new Error(\"random number pool is not ready or insufficient, prevent getting too long random values or too often.\");\n  }\n}\nfunction randomBytes(length = 0) {\n  const array = new Uint8Array(length);\n  if (_syncCrypto) {\n    return _syncCrypto.getRandomValues(array);\n  } else {\n    const result = consumePool(length);\n    return result;\n  }\n}\n\n// src/sm3/utils.ts\nvar u8a = (a) => a instanceof Uint8Array;\nvar createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\nvar isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;\nif (!isLE)\n  throw new Error(\"Non little-endian hardware is not supported\");\nvar hexes = Array.from(\n  { length: 256 },\n  (v, i) => i.toString(16).padStart(2, \"0\")\n);\nfunction bytesToHex(bytes) {\n  if (!u8a(bytes))\n    throw new Error(\"Uint8Array expected\");\n  let hex = \"\";\n  for (let i = 0; i < bytes.length; i++) {\n    hex += hexes[bytes[i]];\n  }\n  return hex;\n}\nvar te = typeof TextEncoder != \"undefined\" && /* @__PURE__ */ new TextEncoder();\nvar slc = (v, s, e) => {\n  if (s == null || s < 0)\n    s = 0;\n  if (e == null || e > v.length)\n    e = v.length;\n  return new Uint8Array(v.subarray(s, e));\n};\nfunction strToU8(str) {\n  if (te)\n    return te.encode(str);\n  const l = str.length;\n  let ar = new Uint8Array(str.length + (str.length >> 1));\n  let ai = 0;\n  const w = (v) => {\n    ar[ai++] = v;\n  };\n  for (let i = 0; i < l; ++i) {\n    if (ai + 5 > ar.length) {\n      const n = new Uint8Array(ai + 8 + (l - i << 1));\n      n.set(ar);\n      ar = n;\n    }\n    let c = str.charCodeAt(i);\n    if (c < 128)\n      w(c);\n    else if (c < 2048)\n      w(192 | c >> 6), w(128 | c & 63);\n    else if (c > 55295 && c < 57344)\n      c = 65536 + (c & 1023 << 10) | str.charCodeAt(++i) & 1023, w(240 | c >> 18), w(128 | c >> 12 & 63), w(128 | c >> 6 & 63), w(128 | c & 63);\n    else\n      w(224 | c >> 12), w(128 | c >> 6 & 63), w(128 | c & 63);\n  }\n  return slc(ar, 0, ai);\n}\nfunction toBytes(data) {\n  if (typeof data === \"string\")\n    data = strToU8(data);\n  if (!u8a(data))\n    throw new Error(`expected Uint8Array, got ${typeof data}`);\n  return data;\n}\nvar Hash = class {\n  // Safe version that clones internal state\n  clone() {\n    return this._cloneInto();\n  }\n};\nfunction wrapConstructor(hashCons) {\n  const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n  const tmp2 = hashCons();\n  hashC.outputLen = tmp2.outputLen;\n  hashC.blockLen = tmp2.blockLen;\n  hashC.create = () => hashCons();\n  return hashC;\n}\n\n// src/sm2/sm3.ts\nvar BoolA = (A, B, C) => A & B | A & C | B & C;\nvar BoolB = (A, B, C) => A ^ B ^ C;\nvar BoolC = (A, B, C) => A & B | ~A & C;\nfunction setBigUint64(view, byteOffset, value, isLE2) {\n  if (typeof view.setBigUint64 === \"function\")\n    return view.setBigUint64(byteOffset, value, isLE2);\n  const _32n = BigInt(32);\n  const _u32_max = BigInt(4294967295);\n  const wh = Number(value >> _32n & _u32_max);\n  const wl = Number(value & _u32_max);\n  const h = isLE2 ? 4 : 0;\n  const l = isLE2 ? 0 : 4;\n  view.setUint32(byteOffset + h, wh, isLE2);\n  view.setUint32(byteOffset + l, wl, isLE2);\n}\nfunction rotl(x2, n) {\n  const s = n & 31;\n  return x2 << s | x2 >>> 32 - s;\n}\nfunction P0(X) {\n  return X ^ rotl(X, 9) ^ rotl(X, 17);\n}\nfunction P1(X) {\n  return X ^ rotl(X, 15) ^ rotl(X, 23);\n}\nvar SHA2 = class extends Hash {\n  constructor(blockLen, outputLen, padOffset, isLE2) {\n    super();\n    this.blockLen = blockLen;\n    this.outputLen = outputLen;\n    this.padOffset = padOffset;\n    this.isLE = isLE2;\n    // For partial updates less than block size\n    __publicField(this, \"buffer\");\n    __publicField(this, \"view\");\n    __publicField(this, \"finished\", false);\n    __publicField(this, \"length\", 0);\n    __publicField(this, \"pos\", 0);\n    __publicField(this, \"destroyed\", false);\n    this.buffer = new Uint8Array(blockLen);\n    this.view = createView(this.buffer);\n  }\n  update(data) {\n    const { view, buffer, blockLen } = this;\n    data = toBytes(data);\n    const len = data.length;\n    for (let pos = 0; pos < len; ) {\n      const take = Math.min(blockLen - this.pos, len - pos);\n      if (take === blockLen) {\n        const dataView = createView(data);\n        for (; blockLen <= len - pos; pos += blockLen)\n          this.process(dataView, pos);\n        continue;\n      }\n      buffer.set(data.subarray(pos, pos + take), this.pos);\n      this.pos += take;\n      pos += take;\n      if (this.pos === blockLen) {\n        this.process(view, 0);\n        this.pos = 0;\n      }\n    }\n    this.length += data.length;\n    this.roundClean();\n    return this;\n  }\n  digestInto(out) {\n    this.finished = true;\n    const { buffer, view, blockLen, isLE: isLE2 } = this;\n    let { pos } = this;\n    buffer[pos++] = 128;\n    this.buffer.subarray(pos).fill(0);\n    if (this.padOffset > blockLen - pos) {\n      this.process(view, 0);\n      pos = 0;\n    }\n    for (let i = pos; i < blockLen; i++)\n      buffer[i] = 0;\n    setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);\n    this.process(view, 0);\n    const oview = createView(out);\n    const len = this.outputLen;\n    if (len % 4)\n      throw new Error(\"_sha2: outputLen should be aligned to 32bit\");\n    const outLen = len / 4;\n    const state = this.get();\n    if (outLen > state.length)\n      throw new Error(\"_sha2: outputLen bigger than state\");\n    for (let i = 0; i < outLen; i++)\n      oview.setUint32(4 * i, state[i], isLE2);\n  }\n  digest() {\n    const { buffer, outputLen } = this;\n    this.digestInto(buffer);\n    const res = buffer.slice(0, outputLen);\n    this.destroy();\n    return res;\n  }\n  _cloneInto(to) {\n    to || (to = new this.constructor());\n    to.set(...this.get());\n    const { blockLen, buffer, length, finished, destroyed, pos } = this;\n    to.length = length;\n    to.pos = pos;\n    to.finished = finished;\n    to.destroyed = destroyed;\n    if (length % blockLen)\n      to.buffer.set(buffer);\n    return to;\n  }\n};\nvar IV = new Uint32Array([1937774191, 1226093241, 388252375, 3666478592, 2842636476, 372324522, 3817729613, 2969243214]);\nvar SM3_W = new Uint32Array(68);\nvar SM3_M = new Uint32Array(64);\nvar T1 = 2043430169;\nvar T2 = 2055708042;\nvar SM3 = class extends SHA2 {\n  constructor() {\n    super(64, 32, 8, false);\n    // We cannot use array here since array allows indexing by variable\n    // which means optimizer/compiler cannot use registers.\n    __publicField(this, \"A\", IV[0] | 0);\n    __publicField(this, \"B\", IV[1] | 0);\n    __publicField(this, \"C\", IV[2] | 0);\n    __publicField(this, \"D\", IV[3] | 0);\n    __publicField(this, \"E\", IV[4] | 0);\n    __publicField(this, \"F\", IV[5] | 0);\n    __publicField(this, \"G\", IV[6] | 0);\n    __publicField(this, \"H\", IV[7] | 0);\n  }\n  get() {\n    const { A, B, C, D, E, F, G, H } = this;\n    return [A, B, C, D, E, F, G, H];\n  }\n  // prettier-ignore\n  set(A, B, C, D, E, F, G, H) {\n    this.A = A | 0;\n    this.B = B | 0;\n    this.C = C | 0;\n    this.D = D | 0;\n    this.E = E | 0;\n    this.F = F | 0;\n    this.G = G | 0;\n    this.H = H | 0;\n  }\n  process(view, offset) {\n    for (let i = 0; i < 16; i++, offset += 4)\n      SM3_W[i] = view.getUint32(offset, false);\n    for (let i = 16; i < 68; i++) {\n      SM3_W[i] = P1(SM3_W[i - 16] ^ SM3_W[i - 9] ^ rotl(SM3_W[i - 3], 15)) ^ rotl(SM3_W[i - 13], 7) ^ SM3_W[i - 6];\n    }\n    for (let i = 0; i < 64; i++) {\n      SM3_M[i] = SM3_W[i] ^ SM3_W[i + 4];\n    }\n    let { A, B, C, D, E, F, G, H } = this;\n    for (let j = 0; j < 64; j++) {\n      let small = j >= 0 && j <= 15;\n      let T = small ? T1 : T2;\n      let SS1 = rotl(rotl(A, 12) + E + rotl(T, j), 7);\n      let SS2 = SS1 ^ rotl(A, 12);\n      let TT1 = (small ? BoolB(A, B, C) : BoolA(A, B, C)) + D + SS2 + SM3_M[j] | 0;\n      let TT2 = (small ? BoolB(E, F, G) : BoolC(E, F, G)) + H + SS1 + SM3_W[j] | 0;\n      D = C;\n      C = rotl(B, 9);\n      B = A;\n      A = TT1;\n      H = G;\n      G = rotl(F, 19);\n      F = E;\n      E = P0(TT2);\n    }\n    A = A ^ this.A | 0;\n    B = B ^ this.B | 0;\n    C = C ^ this.C | 0;\n    D = D ^ this.D | 0;\n    E = E ^ this.E | 0;\n    F = F ^ this.F | 0;\n    G = G ^ this.G | 0;\n    H = H ^ this.H | 0;\n    this.set(A, B, C, D, E, F, G, H);\n  }\n  roundClean() {\n    SM3_W.fill(0);\n  }\n  destroy() {\n    this.set(0, 0, 0, 0, 0, 0, 0, 0);\n    this.buffer.fill(0);\n  }\n};\nvar sm3 = wrapConstructor(() => new SM3());\n\n// src/sm2/hmac.ts\nvar HMAC = class extends Hash {\n  constructor(hash, _key) {\n    super();\n    __publicField(this, \"oHash\");\n    __publicField(this, \"iHash\");\n    __publicField(this, \"blockLen\");\n    __publicField(this, \"outputLen\");\n    __publicField(this, \"finished\", false);\n    __publicField(this, \"destroyed\", false);\n    const key = toBytes(_key);\n    this.iHash = hash.create();\n    if (typeof this.iHash.update !== \"function\")\n      throw new Error(\"Expected instance of class which extends utils.Hash\");\n    this.blockLen = this.iHash.blockLen;\n    this.outputLen = this.iHash.outputLen;\n    const blockLen = this.blockLen;\n    const pad = new Uint8Array(blockLen);\n    pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);\n    for (let i = 0; i < pad.length; i++)\n      pad[i] ^= 54;\n    this.iHash.update(pad);\n    this.oHash = hash.create();\n    for (let i = 0; i < pad.length; i++)\n      pad[i] ^= 54 ^ 92;\n    this.oHash.update(pad);\n    pad.fill(0);\n  }\n  update(buf) {\n    this.iHash.update(buf);\n    return this;\n  }\n  digestInto(out) {\n    this.finished = true;\n    this.iHash.digestInto(out);\n    this.oHash.update(out);\n    this.oHash.digestInto(out);\n    this.destroy();\n  }\n  digest() {\n    const out = new Uint8Array(this.oHash.outputLen);\n    this.digestInto(out);\n    return out;\n  }\n  _cloneInto(to) {\n    to || (to = Object.create(Object.getPrototypeOf(this), {}));\n    const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;\n    to = to;\n    to.finished = finished;\n    to.destroyed = destroyed;\n    to.blockLen = blockLen;\n    to.outputLen = outputLen;\n    to.oHash = oHash._cloneInto(to.oHash);\n    to.iHash = iHash._cloneInto(to.iHash);\n    return to;\n  }\n  destroy() {\n    this.destroyed = true;\n    this.oHash.destroy();\n    this.iHash.destroy();\n  }\n};\nvar hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();\nhmac.create = (hash, key) => new HMAC(hash, key);\n\n// src/sm2/ec.ts\nimport { concatBytes } from \"@noble/curves/abstract/utils\";\nvar sm2Fp = Field(BigInt(\"115792089210356248756420345214020892766250353991924191454421193933289684991999\"));\nvar sm2Curve = weierstrass({\n  // sm2: short weierstrass.\n  a: BigInt(\"115792089210356248756420345214020892766250353991924191454421193933289684991996\"),\n  b: BigInt(\"18505919022281880113072981827955639221458448578012075254857346196103069175443\"),\n  Fp: sm2Fp,\n  h: ONE,\n  n: BigInt(\"115792089210356248756420345214020892766061623724957744567843809356293439045923\"),\n  Gx: BigInt(\"22963146547237050559479531362550074578802567295341616970375194840604139615431\"),\n  Gy: BigInt(\"85132369209828568825618990617112496413088388631904505083283536607588877201568\"),\n  hash: sm3,\n  hmac: (key, ...msgs) => hmac(sm3, key, concatBytes(...msgs)),\n  randomBytes\n});\nvar field = Field(BigInt(sm2Curve.CURVE.n));\n\n// src/sm2/utils.ts\nimport { mod } from \"@noble/curves/abstract/modular\";\nfunction generateKeyPairHex(str) {\n  const privateKey = str ? utils2.numberToBytesBE(mod(BigInt(str), ONE) + ONE, 32) : sm2Curve.utils.randomPrivateKey();\n  const publicKey = sm2Curve.getPublicKey(privateKey, false);\n  const privPad = leftPad(utils2.bytesToHex(privateKey), 64);\n  const pubPad = leftPad(utils2.bytesToHex(publicKey), 64);\n  return { privateKey: privPad, publicKey: pubPad };\n}\nfunction compressPublicKeyHex(s) {\n  if (s.length !== 130)\n    throw new Error(\"Invalid public key to compress\");\n  const len = (s.length - 2) / 2;\n  const xHex = s.substring(2, 2 + len);\n  const y = utils2.hexToNumber(s.substring(len + 2, len + len + 2));\n  let prefix = \"03\";\n  if (mod(y, TWO) === ZERO)\n    prefix = \"02\";\n  return prefix + xHex;\n}\nfunction utf8ToHex(input) {\n  const bytes = strToU8(input);\n  return utils2.bytesToHex(bytes);\n}\nfunction leftPad(input, num) {\n  if (input.length >= num)\n    return input;\n  return new Array(num - input.length + 1).join(\"0\") + input;\n}\nfunction arrayToHex(arr) {\n  return arr.map((item) => {\n    const hex = item.toString(16);\n    return hex.length === 1 ? \"0\" + hex : hex;\n  }).join(\"\");\n}\nfunction arrayToUtf8(arr) {\n  const str = [];\n  for (let i = 0, len = arr.length; i < len; i++) {\n    if (arr[i] >= 240 && arr[i] <= 247) {\n      str.push(String.fromCodePoint(((arr[i] & 7) << 18) + ((arr[i + 1] & 63) << 12) + ((arr[i + 2] & 63) << 6) + (arr[i + 3] & 63)));\n      i += 3;\n    } else if (arr[i] >= 224 && arr[i] <= 239) {\n      str.push(String.fromCodePoint(((arr[i] & 15) << 12) + ((arr[i + 1] & 63) << 6) + (arr[i + 2] & 63)));\n      i += 2;\n    } else if (arr[i] >= 192 && arr[i] <= 223) {\n      str.push(String.fromCodePoint(((arr[i] & 31) << 6) + (arr[i + 1] & 63)));\n      i++;\n    } else {\n      str.push(String.fromCodePoint(arr[i]));\n    }\n  }\n  return str.join(\"\");\n}\nfunction hexToArray(hexStr) {\n  let hexStrLength = hexStr.length;\n  if (hexStrLength % 2 !== 0) {\n    hexStr = leftPad(hexStr, hexStrLength + 1);\n  }\n  hexStrLength = hexStr.length;\n  const wordLength = hexStrLength / 2;\n  const words = new Uint8Array(wordLength);\n  for (let i = 0; i < wordLength; i++) {\n    words[i] = parseInt(hexStr.substring(i * 2, i * 2 + 2), 16);\n  }\n  return words;\n}\nfunction verifyPublicKey(publicKey) {\n  const point = sm2Curve.ProjectivePoint.fromHex(publicKey);\n  if (!point)\n    return false;\n  try {\n    point.assertValidity();\n    return true;\n  } catch (error) {\n    return false;\n  }\n}\nfunction comparePublicKeyHex(publicKey1, publicKey2) {\n  const point1 = sm2Curve.ProjectivePoint.fromHex(publicKey1);\n  if (!point1)\n    return false;\n  const point2 = sm2Curve.ProjectivePoint.fromHex(publicKey2);\n  if (!point2)\n    return false;\n  return point1.equals(point2);\n}\n\n// src/sm2/index.ts\nimport * as utils5 from \"@noble/curves/abstract/utils\";\n\n// src/sm2/kdf.ts\nimport * as utils3 from \"@noble/curves/abstract/utils\";\n\n// src/sm3/index.ts\nfunction utf8ToArray(str) {\n  const arr = [];\n  for (let i = 0, len = str.length; i < len; i++) {\n    const point = str.codePointAt(i);\n    if (point <= 127) {\n      arr.push(point);\n    } else if (point <= 2047) {\n      arr.push(192 | point >>> 6);\n      arr.push(128 | point & 63);\n    } else if (point <= 55295 || point >= 57344 && point <= 65535) {\n      arr.push(224 | point >>> 12);\n      arr.push(128 | point >>> 6 & 63);\n      arr.push(128 | point & 63);\n    } else if (point >= 65536 && point <= 1114111) {\n      i++;\n      arr.push(240 | point >>> 18 & 28);\n      arr.push(128 | point >>> 12 & 63);\n      arr.push(128 | point >>> 6 & 63);\n      arr.push(128 | point & 63);\n    } else {\n      arr.push(point);\n      throw new Error(\"input is not supported\");\n    }\n  }\n  return new Uint8Array(arr);\n}\nfunction sm32(input, options) {\n  input = typeof input === \"string\" ? utf8ToArray(input) : input;\n  if (options) {\n    const mode = options.mode || \"hmac\";\n    if (mode !== \"hmac\")\n      throw new Error(\"invalid mode\");\n    let key = options.key;\n    if (!key)\n      throw new Error(\"invalid key\");\n    key = typeof key === \"string\" ? hexToArray(key) : key;\n    return bytesToHex(hmac(sm3, key, input));\n  }\n  return bytesToHex(sm3(input));\n}\n\n// src/sm2/kdf.ts\nfunction kdf(z, keylen, iv) {\n  z = typeof z === \"string\" ? utf8ToArray(z) : z;\n  const IV2 = iv == null ? EmptyArray : typeof iv === \"string\" ? utf8ToArray(iv) : iv;\n  let msg = new Uint8Array(keylen);\n  let ct = 1;\n  let offset = 0;\n  let t = EmptyArray;\n  const ctShift = new Uint8Array(4);\n  const nextT = () => {\n    ctShift[0] = ct >> 24 & 255;\n    ctShift[1] = ct >> 16 & 255;\n    ctShift[2] = ct >> 8 & 255;\n    ctShift[3] = ct & 255;\n    t = sm3(utils3.concatBytes(z, ctShift, IV2));\n    ct++;\n    offset = 0;\n  };\n  nextT();\n  for (let i = 0, len = msg.length; i < len; i++) {\n    if (offset === t.length)\n      nextT();\n    msg[i] = t[offset++] & 255;\n  }\n  return msg;\n}\n\n// src/sm2/kx.ts\nimport * as utils4 from \"@noble/curves/abstract/utils\";\nvar wPow2 = utils4.hexToNumber(\"80000000000000000000000000000000\");\nvar wPow2Sub1 = utils4.hexToNumber(\"7fffffffffffffffffffffffffffffff\");\nfunction calculateSharedKey(keypairA, ephemeralKeypairA, publicKeyB, ephemeralPublicKeyB, sharedKeyLength, isRecipient = false, idA = \"1234567812345678\", idB = \"1234567812345678\") {\n  const RA = sm2Curve.ProjectivePoint.fromHex(ephemeralKeypairA.publicKey);\n  const RB = sm2Curve.ProjectivePoint.fromHex(ephemeralPublicKeyB);\n  const PB = sm2Curve.ProjectivePoint.fromHex(publicKeyB);\n  let ZA = getZ(keypairA.publicKey, idA);\n  let ZB = getZ(publicKeyB, idB);\n  if (isRecipient) {\n    [ZA, ZB] = [ZB, ZA];\n  }\n  const rA = utils4.hexToNumber(ephemeralKeypairA.privateKey);\n  const dA = utils4.hexToNumber(keypairA.privateKey);\n  const x1 = RA.x;\n  const x1_ = wPow2 + (x1 & wPow2Sub1);\n  const tA = field.add(dA, field.mulN(x1_, rA));\n  const x2 = RB.x;\n  const x2_ = field.add(wPow2, x2 & wPow2Sub1);\n  const U = RB.multiply(x2_).add(PB).multiply(tA);\n  const xU = hexToArray(leftPad(utils4.numberToHexUnpadded(U.x), 64));\n  const yU = hexToArray(leftPad(utils4.numberToHexUnpadded(U.y), 64));\n  const KA = kdf(utils4.concatBytes(xU, yU, ZA, ZB), sharedKeyLength);\n  return KA;\n}\n\n// src/sm2/index.ts\nvar { getSharedSecret } = sm2Curve;\nfunction xorCipherStream(x2, y2, msg) {\n  const stream = kdf(utils5.concatBytes(x2, y2), msg.length);\n  for (let i = 0, len = msg.length; i < len; i++) {\n    msg[i] ^= stream[i] & 255;\n  }\n}\nvar C1C2C3 = 0;\nvar EmptyArray = new Uint8Array();\nfunction doEncrypt(msg, publicKey, cipherMode = 1, options) {\n  const msgArr = typeof msg === \"string\" ? hexToArray(utf8ToHex(msg)) : Uint8Array.from(msg);\n  const publicKeyPoint = typeof publicKey === \"string\" ? sm2Curve.ProjectivePoint.fromHex(publicKey) : publicKey;\n  const keypair = generateKeyPairHex();\n  const k = utils5.hexToNumber(keypair.privateKey);\n  let c1 = keypair.publicKey;\n  if (c1.length > 128)\n    c1 = c1.substring(c1.length - 128);\n  const p = publicKeyPoint.multiply(k);\n  const x2 = hexToArray(leftPad(utils5.numberToHexUnpadded(p.x), 64));\n  const y2 = hexToArray(leftPad(utils5.numberToHexUnpadded(p.y), 64));\n  const c3 = bytesToHex(sm3(utils5.concatBytes(x2, msgArr, y2)));\n  xorCipherStream(x2, y2, msgArr);\n  const c2 = bytesToHex(msgArr);\n  if (options?.asn1) {\n    const point = sm2Curve.ProjectivePoint.fromHex(keypair.publicKey);\n    const encode = cipherMode === C1C2C3 ? encodeEnc(point.x, point.y, c2, c3) : encodeEnc(point.x, point.y, c3, c2);\n    return encode;\n  }\n  return cipherMode === C1C2C3 ? c1 + c2 + c3 : c1 + c3 + c2;\n}\nfunction doDecrypt(encryptData, privateKey, cipherMode = 1, options) {\n  const { output = \"string\", asn1 = false } = options || {};\n  const privateKeyInteger = utils5.hexToNumber(privateKey);\n  let c1;\n  let c2;\n  let c3;\n  if (asn1) {\n    const { x: x3, y, cipher, hash } = decodeEnc(encryptData);\n    c1 = sm2Curve.ProjectivePoint.fromAffine({ x: x3, y });\n    c3 = hash;\n    c2 = cipher;\n    if (cipherMode === C1C2C3) {\n      [c2, c3] = [c3, c2];\n    }\n  } else {\n    c1 = sm2Curve.ProjectivePoint.fromHex(\"04\" + encryptData.substring(0, 128));\n    c3 = encryptData.substring(128, 128 + 64);\n    c2 = encryptData.substring(128 + 64);\n    if (cipherMode === C1C2C3) {\n      c3 = encryptData.substring(encryptData.length - 64);\n      c2 = encryptData.substring(128, encryptData.length - 64);\n    }\n  }\n  const msg = hexToArray(c2);\n  const p = c1.multiply(privateKeyInteger);\n  const x2 = hexToArray(leftPad(utils5.numberToHexUnpadded(p.x), 64));\n  const y2 = hexToArray(leftPad(utils5.numberToHexUnpadded(p.y), 64));\n  xorCipherStream(x2, y2, msg);\n  const checkC3 = arrayToHex(Array.from(sm3(utils5.concatBytes(x2, msg, y2))));\n  if (checkC3 === c3.toLowerCase()) {\n    return output === \"array\" ? msg : arrayToUtf8(msg);\n  } else {\n    return output === \"array\" ? [] : \"\";\n  }\n}\nfunction doSignature(msg, privateKey, options = {}) {\n  let {\n    pointPool,\n    der,\n    hash,\n    publicKey,\n    userId\n  } = options;\n  let hashHex = typeof msg === \"string\" ? utf8ToHex(msg) : arrayToHex(Array.from(msg));\n  if (hash) {\n    publicKey = publicKey || getPublicKeyFromPrivateKey(privateKey);\n    hashHex = getHash(hashHex, publicKey, userId);\n  }\n  const dA = utils5.hexToNumber(privateKey);\n  const e = utils5.hexToNumber(hashHex);\n  let k = null;\n  let r = null;\n  let s = null;\n  do {\n    do {\n      let point;\n      if (pointPool && pointPool.length) {\n        point = pointPool.pop();\n      } else {\n        point = getPoint();\n      }\n      k = point.k;\n      r = field.add(e, point.x1);\n    } while (r === ZERO || r + k === sm2Curve.CURVE.n);\n    s = field.mul(field.inv(field.addN(dA, ONE)), field.subN(k, field.mulN(r, dA)));\n  } while (s === ZERO);\n  if (der)\n    return encodeDer(r, s);\n  return leftPad(utils5.numberToHexUnpadded(r), 64) + leftPad(utils5.numberToHexUnpadded(s), 64);\n}\nfunction doVerifySignature(msg, signHex, publicKey, options = {}) {\n  let hashHex;\n  const {\n    hash,\n    der,\n    userId\n  } = options;\n  const publicKeyHex = typeof publicKey === \"string\" ? publicKey : publicKey.toHex(false);\n  if (hash) {\n    hashHex = getHash(typeof msg === \"string\" ? utf8ToHex(msg) : msg, publicKeyHex, userId);\n  } else {\n    hashHex = typeof msg === \"string\" ? utf8ToHex(msg) : arrayToHex(Array.from(msg));\n  }\n  let r;\n  let s;\n  if (der) {\n    const decodeDerObj = decodeDer(signHex);\n    r = decodeDerObj.r;\n    s = decodeDerObj.s;\n  } else {\n    r = utils5.hexToNumber(signHex.substring(0, 64));\n    s = utils5.hexToNumber(signHex.substring(64));\n  }\n  const PA = typeof publicKey === \"string\" ? sm2Curve.ProjectivePoint.fromHex(publicKey) : publicKey;\n  const e = utils5.hexToNumber(hashHex);\n  const t = field.add(r, s);\n  if (t === ZERO)\n    return false;\n  const x1y1 = sm2Curve.ProjectivePoint.BASE.multiply(s).add(PA.multiply(t));\n  const R = field.add(e, x1y1.x);\n  return r === R;\n}\nfunction getZ(publicKey, userId = \"1234567812345678\") {\n  userId = utf8ToHex(userId);\n  const a = leftPad(utils5.numberToHexUnpadded(sm2Curve.CURVE.a), 64);\n  const b = leftPad(utils5.numberToHexUnpadded(sm2Curve.CURVE.b), 64);\n  const gx = leftPad(utils5.numberToHexUnpadded(sm2Curve.ProjectivePoint.BASE.x), 64);\n  const gy = leftPad(utils5.numberToHexUnpadded(sm2Curve.ProjectivePoint.BASE.y), 64);\n  let px;\n  let py;\n  if (publicKey.length === 128) {\n    px = publicKey.substring(0, 64);\n    py = publicKey.substring(64, 128);\n  } else {\n    const point = sm2Curve.ProjectivePoint.fromHex(publicKey);\n    px = leftPad(utils5.numberToHexUnpadded(point.x), 64);\n    py = leftPad(utils5.numberToHexUnpadded(point.y), 64);\n  }\n  const data = hexToArray(userId + a + b + gx + gy + px + py);\n  const entl = userId.length * 4;\n  const z = sm3(utils5.concatBytes(new Uint8Array([entl >> 8 & 255, entl & 255]), data));\n  return z;\n}\nfunction getHash(hashHex, publicKey, userId = \"1234567812345678\") {\n  const z = getZ(publicKey, userId);\n  return bytesToHex(sm3(utils5.concatBytes(z, typeof hashHex === \"string\" ? hexToArray(hashHex) : hashHex)));\n}\nfunction precomputePublicKey(publicKey, windowSize) {\n  const point = sm2Curve.ProjectivePoint.fromHex(publicKey);\n  return sm2Curve.utils.precompute(windowSize, point);\n}\nfunction getPublicKeyFromPrivateKey(privateKey) {\n  const pubKey = sm2Curve.getPublicKey(privateKey, false);\n  const pubPad = leftPad(utils5.bytesToHex(pubKey), 64);\n  return pubPad;\n}\nfunction getPoint() {\n  const keypair = generateKeyPairHex();\n  const PA = sm2Curve.ProjectivePoint.fromHex(keypair.publicKey);\n  const k = utils5.hexToNumber(keypair.privateKey);\n  return {\n    ...keypair,\n    k,\n    x1: PA.x\n  };\n}\n\n// src/sm3/hkdf.ts\nimport { hkdf as hkdfNoble } from \"@noble/hashes/hkdf\";\nfunction hkdf(ikm, salt, info, length) {\n  return hkdfNoble(sm3, ikm, salt, info, length);\n}\n\n// src/sm4/index.ts\nvar sm4_exports = {};\n__export(sm4_exports, {\n  decrypt: () => decrypt,\n  encrypt: () => encrypt,\n  sm4: () => sm4\n});\nimport { ghash } from \"@noble/ciphers/_polyval\";\nimport { createView as createView2, setBigUint64 as setBigUint642 } from \"@noble/ciphers/utils\";\nvar DECRYPT = 0;\nvar ROUND = 32;\nvar BLOCK = 16;\nvar Sbox = Uint8Array.from([\n  214,\n  144,\n  233,\n  254,\n  204,\n  225,\n  61,\n  183,\n  22,\n  182,\n  20,\n  194,\n  40,\n  251,\n  44,\n  5,\n  43,\n  103,\n  154,\n  118,\n  42,\n  190,\n  4,\n  195,\n  170,\n  68,\n  19,\n  38,\n  73,\n  134,\n  6,\n  153,\n  156,\n  66,\n  80,\n  244,\n  145,\n  239,\n  152,\n  122,\n  51,\n  84,\n  11,\n  67,\n  237,\n  207,\n  172,\n  98,\n  228,\n  179,\n  28,\n  169,\n  201,\n  8,\n  232,\n  149,\n  128,\n  223,\n  148,\n  250,\n  117,\n  143,\n  63,\n  166,\n  71,\n  7,\n  167,\n  252,\n  243,\n  115,\n  23,\n  186,\n  131,\n  89,\n  60,\n  25,\n  230,\n  133,\n  79,\n  168,\n  104,\n  107,\n  129,\n  178,\n  113,\n  100,\n  218,\n  139,\n  248,\n  235,\n  15,\n  75,\n  112,\n  86,\n  157,\n  53,\n  30,\n  36,\n  14,\n  94,\n  99,\n  88,\n  209,\n  162,\n  37,\n  34,\n  124,\n  59,\n  1,\n  33,\n  120,\n  135,\n  212,\n  0,\n  70,\n  87,\n  159,\n  211,\n  39,\n  82,\n  76,\n  54,\n  2,\n  231,\n  160,\n  196,\n  200,\n  158,\n  234,\n  191,\n  138,\n  210,\n  64,\n  199,\n  56,\n  181,\n  163,\n  247,\n  242,\n  206,\n  249,\n  97,\n  21,\n  161,\n  224,\n  174,\n  93,\n  164,\n  155,\n  52,\n  26,\n  85,\n  173,\n  147,\n  50,\n  48,\n  245,\n  140,\n  177,\n  227,\n  29,\n  246,\n  226,\n  46,\n  130,\n  102,\n  202,\n  96,\n  192,\n  41,\n  35,\n  171,\n  13,\n  83,\n  78,\n  111,\n  213,\n  219,\n  55,\n  69,\n  222,\n  253,\n  142,\n  47,\n  3,\n  255,\n  106,\n  114,\n  109,\n  108,\n  91,\n  81,\n  141,\n  27,\n  175,\n  146,\n  187,\n  221,\n  188,\n  127,\n  17,\n  217,\n  92,\n  65,\n  31,\n  16,\n  90,\n  216,\n  10,\n  193,\n  49,\n  136,\n  165,\n  205,\n  123,\n  189,\n  45,\n  116,\n  208,\n  18,\n  184,\n  229,\n  180,\n  176,\n  137,\n  105,\n  151,\n  74,\n  12,\n  150,\n  119,\n  126,\n  101,\n  185,\n  241,\n  9,\n  197,\n  110,\n  198,\n  132,\n  24,\n  240,\n  125,\n  236,\n  58,\n  220,\n  77,\n  32,\n  121,\n  238,\n  95,\n  62,\n  215,\n  203,\n  57,\n  72\n]);\nvar CK = new Uint32Array([\n  462357,\n  472066609,\n  943670861,\n  1415275113,\n  1886879365,\n  2358483617,\n  2830087869,\n  3301692121,\n  3773296373,\n  4228057617,\n  404694573,\n  876298825,\n  1347903077,\n  1819507329,\n  2291111581,\n  2762715833,\n  3234320085,\n  3705924337,\n  4177462797,\n  337322537,\n  808926789,\n  1280531041,\n  1752135293,\n  2223739545,\n  2695343797,\n  3166948049,\n  3638552301,\n  4110090761,\n  269950501,\n  741554753,\n  1213159005,\n  1684763257\n]);\nfunction byteSub(a) {\n  return (Sbox[a >>> 24 & 255] & 255) << 24 | (Sbox[a >>> 16 & 255] & 255) << 16 | (Sbox[a >>> 8 & 255] & 255) << 8 | Sbox[a & 255] & 255;\n}\nvar x = new Uint32Array(4);\nvar tmp = new Uint32Array(4);\nfunction sms4Crypt(input, output, roundKey) {\n  let x0 = 0, x1 = 0, x2 = 0, x3 = 0, tmp0 = 0, tmp1 = 0, tmp2 = 0, tmp3 = 0;\n  tmp0 = input[0] & 255;\n  tmp1 = input[1] & 255;\n  tmp2 = input[2] & 255;\n  tmp3 = input[3] & 255;\n  x0 = tmp0 << 24 | tmp1 << 16 | tmp2 << 8 | tmp3;\n  tmp0 = input[4] & 255;\n  tmp1 = input[5] & 255;\n  tmp2 = input[6] & 255;\n  tmp3 = input[7] & 255;\n  x1 = tmp0 << 24 | tmp1 << 16 | tmp2 << 8 | tmp3;\n  tmp0 = input[8] & 255;\n  tmp1 = input[9] & 255;\n  tmp2 = input[10] & 255;\n  tmp3 = input[11] & 255;\n  x2 = tmp0 << 24 | tmp1 << 16 | tmp2 << 8 | tmp3;\n  tmp0 = input[12] & 255;\n  tmp1 = input[13] & 255;\n  tmp2 = input[14] & 255;\n  tmp3 = input[15] & 255;\n  x3 = tmp0 << 24 | tmp1 << 16 | tmp2 << 8 | tmp3;\n  for (let r = 0; r < 32; r += 4) {\n    tmp0 = x1 ^ x2 ^ x3 ^ roundKey[r];\n    tmp0 = byteSub(tmp0);\n    x0 ^= tmp0 ^ (tmp0 << 2 | tmp0 >>> 30) ^ (tmp0 << 10 | tmp0 >>> 22) ^ (tmp0 << 18 | tmp0 >>> 14) ^ (tmp0 << 24 | tmp0 >>> 8);\n    tmp1 = x2 ^ x3 ^ x0 ^ roundKey[r + 1];\n    tmp1 = byteSub(tmp1);\n    x1 ^= tmp1 ^ (tmp1 << 2 | tmp1 >>> 30) ^ (tmp1 << 10 | tmp1 >>> 22) ^ (tmp1 << 18 | tmp1 >>> 14) ^ (tmp1 << 24 | tmp1 >>> 8);\n    tmp2 = x3 ^ x0 ^ x1 ^ roundKey[r + 2];\n    tmp2 = byteSub(tmp2);\n    x2 ^= tmp2 ^ (tmp2 << 2 | tmp2 >>> 30) ^ (tmp2 << 10 | tmp2 >>> 22) ^ (tmp2 << 18 | tmp2 >>> 14) ^ (tmp2 << 24 | tmp2 >>> 8);\n    tmp3 = x0 ^ x1 ^ x2 ^ roundKey[r + 3];\n    tmp3 = byteSub(tmp3);\n    x3 ^= tmp3 ^ (tmp3 << 2 | tmp3 >>> 30) ^ (tmp3 << 10 | tmp3 >>> 22) ^ (tmp3 << 18 | tmp3 >>> 14) ^ (tmp3 << 24 | tmp3 >>> 8);\n  }\n  output[0] = x3 >>> 24 & 255;\n  output[1] = x3 >>> 16 & 255;\n  output[2] = x3 >>> 8 & 255;\n  output[3] = x3 & 255;\n  output[4] = x2 >>> 24 & 255;\n  output[5] = x2 >>> 16 & 255;\n  output[6] = x2 >>> 8 & 255;\n  output[7] = x2 & 255;\n  output[8] = x1 >>> 24 & 255;\n  output[9] = x1 >>> 16 & 255;\n  output[10] = x1 >>> 8 & 255;\n  output[11] = x1 & 255;\n  output[12] = x0 >>> 24 & 255;\n  output[13] = x0 >>> 16 & 255;\n  output[14] = x0 >>> 8 & 255;\n  output[15] = x0 & 255;\n}\nfunction sms4KeyExt(key, roundKey, cryptFlag) {\n  let x0 = 0, x1 = 0, x2 = 0, x3 = 0, mid = 0;\n  x0 = (key[0] & 255) << 24 | (key[1] & 255) << 16 | (key[2] & 255) << 8 | key[3] & 255;\n  x1 = (key[4] & 255) << 24 | (key[5] & 255) << 16 | (key[6] & 255) << 8 | key[7] & 255;\n  x2 = (key[8] & 255) << 24 | (key[9] & 255) << 16 | (key[10] & 255) << 8 | key[11] & 255;\n  x3 = (key[12] & 255) << 24 | (key[13] & 255) << 16 | (key[14] & 255) << 8 | key[15] & 255;\n  x0 ^= 2746333894;\n  x1 ^= 1453994832;\n  x2 ^= 1736282519;\n  x3 ^= 2993693404;\n  for (let r = 0; r < 32; r += 4) {\n    mid = x1 ^ x2 ^ x3 ^ CK[r + 0];\n    mid = byteSub(mid);\n    x0 ^= mid ^ (mid << 13 | mid >>> 19) ^ (mid << 23 | mid >>> 9);\n    roundKey[r + 0] = x0;\n    mid = x2 ^ x3 ^ x0 ^ CK[r + 1];\n    mid = byteSub(mid);\n    x1 ^= mid ^ (mid << 13 | mid >>> 19) ^ (mid << 23 | mid >>> 9);\n    roundKey[r + 1] = x1;\n    mid = x3 ^ x0 ^ x1 ^ CK[r + 2];\n    mid = byteSub(mid);\n    x2 ^= mid ^ (mid << 13 | mid >>> 19) ^ (mid << 23 | mid >>> 9);\n    roundKey[r + 2] = x2;\n    mid = x0 ^ x1 ^ x2 ^ CK[r + 3];\n    mid = byteSub(mid);\n    x3 ^= mid ^ (mid << 13 | mid >>> 19) ^ (mid << 23 | mid >>> 9);\n    roundKey[r + 3] = x3;\n  }\n  if (cryptFlag === DECRYPT) {\n    for (let r = 0; r < 16; r++) {\n      [roundKey[r], roundKey[31 - r]] = [roundKey[31 - r], roundKey[r]];\n    }\n  }\n}\nfunction incrementCounter(counter) {\n  for (let i = counter.length - 1; i >= 0; i--) {\n    counter[i]++;\n    if (counter[i] !== 0)\n      break;\n  }\n}\nfunction sm4Gcm(inArray, key, ivArray, aadArray, cryptFlag, tagArray) {\n  const tagLength = 16;\n  function deriveKeys() {\n    const roundKey2 = new Uint32Array(ROUND);\n    sms4KeyExt(key, roundKey2, 1);\n    const authKey = new Uint8Array(16).fill(0);\n    const h2 = new Uint8Array(16);\n    sms4Crypt(authKey, h2, roundKey2);\n    let j02;\n    if (ivArray.length === 12) {\n      j02 = new Uint8Array(16);\n      j02.set(ivArray, 0);\n      j02[15] = 1;\n    } else {\n      const g = ghash.create(h2);\n      g.update(ivArray);\n      const lenIv = new Uint8Array(16);\n      const view = createView2(lenIv);\n      setBigUint642(view, 8, BigInt(ivArray.length * 8), false);\n      g.update(lenIv);\n      j02 = g.digest();\n    }\n    const counter2 = new Uint8Array(j02);\n    incrementCounter(counter2);\n    const tagMask2 = new Uint8Array(16);\n    sms4Crypt(j02, tagMask2, roundKey2);\n    return { roundKey: roundKey2, h: h2, j0: j02, counter: counter2, tagMask: tagMask2 };\n  }\n  function computeTag(h2, data) {\n    const aadLength = aadArray.length;\n    const dataLength = data.length;\n    const g = ghash.create(h2);\n    if (aadLength > 0) {\n      g.update(aadArray);\n    }\n    g.update(data);\n    const lenBlock = new Uint8Array(16);\n    const view = createView2(lenBlock);\n    setBigUint642(view, 0, BigInt(aadLength * 8), false);\n    setBigUint642(view, 8, BigInt(dataLength * 8), false);\n    g.update(lenBlock);\n    return g.digest();\n  }\n  const { roundKey, h, j0, counter, tagMask } = deriveKeys();\n  if (cryptFlag === DECRYPT && tagArray) {\n    const calculatedTag = computeTag(h, inArray);\n    for (let i = 0; i < 16; i++) {\n      calculatedTag[i] ^= tagMask[i];\n    }\n    let tagMatch = 0;\n    for (let i = 0; i < 16; i++) {\n      tagMatch |= calculatedTag[i] ^ tagArray[i];\n    }\n    if (tagMatch !== 0) {\n      throw new Error(\"authentication tag mismatch\");\n    }\n  }\n  const outArray = new Uint8Array(inArray.length);\n  let point = 0;\n  let restLen = inArray.length;\n  while (restLen >= BLOCK) {\n    const blockOut = new Uint8Array(BLOCK);\n    sms4Crypt(counter, blockOut, roundKey);\n    for (let i = 0; i < BLOCK && i < restLen; i++) {\n      outArray[point + i] = inArray[point + i] ^ blockOut[i];\n    }\n    incrementCounter(counter);\n    point += BLOCK;\n    restLen -= BLOCK;\n  }\n  if (restLen > 0) {\n    const blockOut = new Uint8Array(BLOCK);\n    sms4Crypt(counter, blockOut, roundKey);\n    for (let i = 0; i < restLen; i++) {\n      outArray[point + i] = inArray[point + i] ^ blockOut[i];\n    }\n  }\n  if (cryptFlag !== DECRYPT) {\n    const calculatedTag = computeTag(h, outArray);\n    for (let i = 0; i < 16; i++) {\n      calculatedTag[i] ^= tagMask[i];\n    }\n    return { output: outArray, tag: calculatedTag };\n  }\n  return { output: outArray };\n}\nvar blockOutput = new Uint8Array(16);\nfunction sm4(inArray, key, cryptFlag, options = {}) {\n  let {\n    padding = \"pkcs#7\",\n    mode,\n    iv = new Uint8Array(16),\n    output,\n    associatedData,\n    outputTag,\n    tag\n  } = options;\n  if (mode === \"gcm\") {\n    const keyArray = typeof key === \"string\" ? hexToArray(key) : Uint8Array.from(key);\n    const ivArray = typeof iv === \"string\" ? hexToArray(iv) : Uint8Array.from(iv);\n    const aadArray = associatedData ? typeof associatedData === \"string\" ? hexToArray(associatedData) : Uint8Array.from(associatedData) : new Uint8Array(0);\n    let inputArray;\n    if (typeof inArray === \"string\") {\n      if (cryptFlag !== DECRYPT) {\n        inputArray = utf8ToArray(inArray);\n      } else {\n        inputArray = hexToArray(inArray);\n      }\n    } else {\n      inputArray = Uint8Array.from(inArray);\n    }\n    const tagArray = tag ? typeof tag === \"string\" ? hexToArray(tag) : Uint8Array.from(tag) : void 0;\n    const result = sm4Gcm(inputArray, keyArray, ivArray, aadArray, cryptFlag, tagArray);\n    if (output === \"array\") {\n      if (outputTag && cryptFlag !== DECRYPT) {\n        return result;\n      }\n      return result.output;\n    } else {\n      if (outputTag && cryptFlag !== DECRYPT) {\n        return {\n          output: bytesToHex(result.output),\n          tag: result.tag ? bytesToHex(result.tag) : void 0\n        };\n      }\n      if (cryptFlag !== DECRYPT) {\n        return {\n          output: bytesToHex(result.output),\n          tag: result.tag ? bytesToHex(result.tag) : void 0\n        };\n      } else {\n        return arrayToUtf8(result.output);\n      }\n    }\n  }\n  if (mode === \"cbc\") {\n    if (typeof iv === \"string\")\n      iv = hexToArray(iv);\n    if (iv.length !== 128 / 8) {\n      throw new Error(\"iv is invalid\");\n    }\n  }\n  if (typeof key === \"string\")\n    key = hexToArray(key);\n  if (key.length !== 128 / 8) {\n    throw new Error(\"key is invalid\");\n  }\n  if (typeof inArray === \"string\") {\n    if (cryptFlag !== DECRYPT) {\n      inArray = utf8ToArray(inArray);\n    } else {\n      inArray = hexToArray(inArray);\n    }\n  } else {\n    inArray = Uint8Array.from(inArray);\n  }\n  if ((padding === \"pkcs#5\" || padding === \"pkcs#7\") && cryptFlag !== DECRYPT) {\n    const paddingCount = BLOCK - inArray.length % BLOCK;\n    const newArray = new Uint8Array(inArray.length + paddingCount);\n    newArray.set(inArray, 0);\n    for (let i = 0; i < paddingCount; i++)\n      newArray[inArray.length + i] = paddingCount;\n    inArray = newArray;\n  }\n  const roundKey = new Uint32Array(ROUND);\n  sms4KeyExt(key, roundKey, cryptFlag);\n  let outArray = new Uint8Array(inArray.length);\n  let lastVector = iv;\n  let restLen = inArray.length;\n  let point = 0;\n  while (restLen >= BLOCK) {\n    const input = inArray.subarray(point, point + 16);\n    if (mode === \"cbc\") {\n      for (let i = 0; i < BLOCK; i++) {\n        if (cryptFlag !== DECRYPT) {\n          input[i] ^= lastVector[i];\n        }\n      }\n    }\n    sms4Crypt(input, blockOutput, roundKey);\n    for (let i = 0; i < BLOCK; i++) {\n      if (mode === \"cbc\") {\n        if (cryptFlag === DECRYPT) {\n          blockOutput[i] ^= lastVector[i];\n        }\n      }\n      outArray[point + i] = blockOutput[i];\n    }\n    if (mode === \"cbc\") {\n      if (cryptFlag !== DECRYPT) {\n        lastVector = blockOutput;\n      } else {\n        lastVector = input;\n      }\n    }\n    restLen -= BLOCK;\n    point += BLOCK;\n  }\n  if ((padding === \"pkcs#5\" || padding === \"pkcs#7\") && cryptFlag === DECRYPT) {\n    const len = outArray.length;\n    const paddingCount = outArray[len - 1];\n    for (let i = 1; i <= paddingCount; i++) {\n      if (outArray[len - i] !== paddingCount)\n        throw new Error(\"padding is invalid\");\n    }\n    outArray = outArray.slice(0, len - paddingCount);\n  }\n  if (output !== \"array\") {\n    if (cryptFlag !== DECRYPT) {\n      return bytesToHex(outArray);\n    } else {\n      return arrayToUtf8(outArray);\n    }\n  } else {\n    return outArray;\n  }\n}\nfunction encrypt(inArray, key, options = {}) {\n  return sm4(inArray, key, 1, options);\n}\nfunction decrypt(inArray, key, options = {}) {\n  return sm4(inArray, key, 0, options);\n}\nexport {\n  hkdf,\n  kdf,\n  sm2_exports as sm2,\n  sm32 as sm3,\n  sm4_exports as sm4\n};\n/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n","import { sm2, sm3, sm4 } from \"sm-crypto-v2\"\n\n/**\n * 国密 sm2 加密\n * @param msg\n * @param key\n * @param {Object} [cipherMode]\n * @return {Uint8Array}\n */\nexport function useSm2Encrypt(msg, key, cipherMode) {\n\treturn sm2.doEncrypt(msg, key, cipherMode)\n}\n\n/**\n * 国密 sm3 加密\n * @param msg\n * @param {Object} [options]\n * @return {*}\n */\nexport function useSm3(msg, options) {\n\treturn sm3(msg, options) // 杂凑\n}\n\n/**\n * 国密 sm4 加密\n * @param msg\n * @param key\n * @param {Object} [options]\n * @return {Uint8Array}\n */\nexport function useSm4Encrypt(msg, key, options) {\n\treturn sm4.encrypt(msg, key, options)\n}\n\n/**\n * 国密 sm4 解密\n * @param encryptData\n * @param key\n * @param {Object} [options]\n * @return {Uint8Array}\n */\nexport function useSm4Decrypt(encryptData, key, options) {\n\treturn sm4.encrypt(encryptData, key, options)\n}\n","import dayjs from \"dayjs\"\nimport { isString } from \"lodash-es\"\n\n/**\n * 根据格式创建 Dayjs 对象\n * @param {string|number} date\n * @param {string} [format] - 日期格式\n * @return {dayjs.Dayjs}\n */\nexport function useDayjs(date, format) {\n\tif ((/^\\d+$/.test(date) || /^-\\d+$/.test(date)) && String(date).length <= 10) {\n\t\tdate = parseInt(date + \"000\")\n\t}\n\treturn format ? dayjs(date, format) : dayjs(date)\n}\n\n/**\n * 格式化日期\n * @param {dayjs.Dayjs|Date} date\n * @param {string} format\n * @return {string}\n */\nexport function useDateFormat(date, format) {\n\tif (!date) {\n\t\treturn \"\"\n\t}\n\tif (!dayjs.isDayjs(date)) {\n\t\tdate = dayjs(date)\n\t}\n\n\treturn date.format(format || \"YYYY-MM-DD HH:mm\")\n}\n\n/**\n * 获取日期的 Unix 时间戳\n * @param {dayjs.Dayjs|Date} date\n * @return {number|string}\n */\nexport function useDateUnix(date) {\n\tif (!date) {\n\t\treturn \"\"\n\t}\n\tif (!dayjs.isDayjs(date)) {\n\t\tdate = dayjs(date)\n\t}\n\n\treturn date.unix()\n}\n\n/**\n * 根据时间戳格式化日期\n * @param timestamp 时间戳\n * @param [format] 日期格式\n * @return {string}\n */\nexport function useTimestampFormat(timestamp, format) {\n\tif (timestamp && isString(timestamp)) {\n\t\ttimestamp = parseInt(timestamp)\n\t}\n\tif (!timestamp) {\n\t\treturn \"\"\n\t}\n\n\tif (timestamp < 9999999999) {\n\t\ttimestamp *= 1000\n\t}\n\n\treturn useDateFormat(new Date(timestamp), format)\n}\n","/**\n * @param {String} type 类型\n * @param {Object} [options] 选项\n * @param {String} [options.message] 错误提示信息\n * @param {String} [options.mode] 模式\n * @param {String} [options.version] 版本\n * @returns {{}}\n */\nexport function useRegexRule(type, options) {\n\toptions = options || {}\n\tconst rule = {}\n\n\tswitch (type) {\n\t\tcase \"email\":\n\t\t\t//邮箱: '90203918@qq.com', 'nbilly@126.com'\n\t\t\trule.pattern =\n\t\t\t\t/^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\n\t\t\trule.message = options.message || \"请填写正确的邮箱地址\"\n\t\t\tbreak\n\t\tcase \"phone\":\n\t\t\t//手机号码\n\t\t\tif (options.mode === \"strict\") {\n\t\t\t\t//严谨，根据工信部2019年最新公布的手机号: '008618311006933', '+8617888829981', '19119255642'\n\t\t\t\trule.pattern = /^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[5-7|9])|(?:5[0-3|5-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[1|8|9]))\\d{8}$/\n\t\t\t} else {\n\t\t\t\t//宽松，只要是13,14,15,16,17,18,19开头即可: '008618311006933', '+8617888829981', '19119255642'\n\t\t\t\trule.pattern = /^(?:(?:\\+|00)86)?1[3-9]\\d{9}$/\n\t\t\t}\n\t\t\trule.message = options.message || \"请填写正确的手机号码\"\n\t\t\tbreak\n\t\tcase \"tel\":\n\t\tcase \"telephone\":\n\t\t\t//座机号码\n\t\t\tif (options.strict === \"strict\") {\n\t\t\t\t//严格带区号: '0936-4211235'\n\t\t\t\trule.pattern = /^\\d{3}-\\d{8}$|^\\d{4}-\\d{7,8}$/\n\t\t\t} else {\n\t\t\t\t//可带可不带: '0936-4211235','89076543'\n\t\t\t\trule.pattern = /^(?:\\d{3}-)?\\d{8}$|^(?:\\d{4}-)?\\d{7,8}$/\n\t\t\t}\n\t\t\trule.message = options.message || \"请填写正确的座机号码\"\n\t\t\tbreak\n\t\tcase \"ID\": //身份证号码\n\t\tcase \"id\":\n\t\t\tif (!options.mode || [\"china\", \"cn\"].includes(options.mode?.toLowerCase())) {\n\t\t\t\tif (options.version?.toLowerCase() === \"v1\") {\n\t\t\t\t\t//一代身份证，(1代,15位数字): '123456991010193'\n\t\t\t\t\trule.pattern = /^[1-9]\\d{7}(?:0\\d|10|11|12)(?:0[1-9]|[1-2][\\d]|30|31)\\d{3}$/\n\t\t\t\t} else if (options.version?.toLowerCase() === \"v2\") {\n\t\t\t\t\t//二代身份证，(2代,18位数字)最后一位是校验位,可能为数字或字符X: '12345619900101001X'\n\t\t\t\t\trule.pattern = /^[1-9]\\d{5}(?:18|19|20)\\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\\d|30|31)\\d{3}[\\dXx]$/\n\t\t\t\t} else {\n\t\t\t\t\t//兼容一代和二代\n\t\t\t\t\trule.pattern = /(^\\d{8}(0\\d|10|11|12)([0-2]\\d|30|31)\\d{3}$)|(^\\d{6}(18|19|20)\\d{2}(0[1-9]|10|11|12)([0-2]\\d|30|31)\\d{3}(\\d|X|x)$)/\n\t\t\t\t}\n\t\t\t} else if ([\"hk\", \"hongkong\", \"xg\", \"xianggang\"].includes(options.mode.toLowerCase())) {\n\t\t\t\t//香港身份证: 'K034169(1)'\n\t\t\t\trule.pattern = /^[a-zA-Z]\\d{6}\\([\\dA]\\)$/\n\t\t\t} else if ([\"macau\", \"macao\", \"mo\", \"aomen\", \"am\"].includes(options.mode.toLowerCase())) {\n\t\t\t\t//澳门身份证:'5686611(1)'\n\t\t\t\trule.pattern = /^[a-zA-Z]\\d{6}\\([\\dA]\\)$/\n\t\t\t} else if ([\"taiwan\", \"tw\"].includes(options.mode.toLowerCase())) {\n\t\t\t\t//台湾身份证: 'U193683453'\n\t\t\t\trule.pattern = /^[a-zA-Z][0-9]{9}$/\n\t\t\t}\n\n\t\t\trule.message = options.message || \"请填写正确的证件号码\"\n\t\t\tbreak\n\t\tcase \"passport\":\n\t\t\t//护照（包含香港、澳门）: 's28233515', '141234567', '159203084', 'MA1234567', 'K25345719'\n\t\t\trule.pattern = /(^[EeKkGgDdSsPpHh]\\d{8}$)|(^(([Ee][a-fA-F])|([DdSsPp][Ee])|([Kk][Jj])|([Mm][Aa])|(1[45]))\\d{7}$)/\n\t\t\trule.message = options.message || \"请填写正确的护照号码\"\n\t\t\tbreak\n\t\tcase \"credit-code\":\n\t\tcase \"uscc\":\n\t\t\t//统一社会信用代码: '91230184MA1BUFLT44', '92371000MA3MXH0E3W'\n\t\t\trule.pattern = /^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/\n\t\t\trule.message = options.message || \"请填写正确的统一社会信用代码\"\n\t\t\tbreak\n\t\tcase \"bank-account\":\n\t\tcase \"bank\":\n\t\t\t//银行账号: 6234567890, 6222026006705354217\n\t\t\t//（10到30位, 覆盖对公/私账户, 参考[微信支付](https://pay.weixin.qq.com/wiki/doc/api/xiaowei.php?chapter=22_1)）\n\t\t\trule.pattern = /^[1-9]\\d{9,29}$/\n\t\t\trule.message = options.message || \"请填写正确的银行账号\"\n\t\t\tbreak\n\t\tcase \"stock\":\n\t\t\t//股票代码(A股): 'sz000858', 'SZ002136', 'sz300675', 'SH600600', 'sh601155'\n\t\t\trule.pattern = /^(s[hz]|S[HZ])(000[\\d]{3}|002[\\d]{3}|300[\\d]{3}|600[\\d]{3}|60[\\d]{4})$/\n\t\t\trule.message = options.message || \"请填写正确的股票代码\"\n\t\t\tbreak\n\t\tcase \"url\":\n\t\t\t//链接\n\t\t\tif (options.mode === \"image\") {\n\t\t\t\t//图片链接: 'https://www.abc.com/logo.png'\n\t\t\t\trule.pattern = /^https?:\\/\\/(.+\\/)+.+(\\.(gif|png|jpg|jpeg|webp|svg|psd|bmp|tif))$/i\n\t\t\t} else if (options.mode === \"video\") {\n\t\t\t\t//视频链接:'http://www.abc.com/video/wc.avi'\n\t\t\t\trule.pattern = /^https?:\\/\\/(.+\\/)+.+(\\.(swf|avi|flv|mpg|rm|mov|wav|asf|3gp|mkv|rmvb|mp4))$/i\n\t\t\t} else {\n\t\t\t\t//普通链接: 'www.qq.com', 'https://baidu.com', '360.com:8080/vue/#/a=1&b=2'\n\t\t\t\trule.pattern = /^(((ht|f)tps?):\\/\\/)?[\\w-]+(\\.[\\w-]+)+([\\w.,@?^=%&:/~+#-]*[\\w@?^=%&/~+#-])?$/\n\t\t\t}\n\t\t\trule.message = options.message || \"请填写正确的链接\"\n\t\t\tbreak\n\t\tcase \"md5\":\n\t\t\t//md5(32位) : '21fe181c5bfc16306a6828c1f7b762e8'\n\t\t\trule.pattern = /^([a-f\\d]{32}|[A-F\\d]{32})$/\n\t\t\trule.message = options.message || \"请填写正确的md5值\"\n\t\t\tbreak\n\t\tcase \"base64\":\n\t\t\t//base64 : 'data:image/gif;base64,xxxx=='\n\t\t\trule.pattern = /^\\s*data:(?:[a-z]+\\/[a-z0-9-+.]+(?:;[a-z-]+=[a-z0-9-]+)?)?(?:;base64)?,([a-z0-9!$&',()*+;=\\-._~:@/?%\\s]*?)\\s*$/i\n\t\t\trule.message = options.message || \"请填写正确的base64值\"\n\t\t\tbreak\n\t\tcase \"currency\":\n\t\tcase \"money\":\n\t\t\t//货币\n\t\t\tif (options.mode === \"positive\") {\n\t\t\t\t//只支持正数、不支持校验千分位分隔符: 0.99, 8.99, 666\n\t\t\t\trule.pattern = /^\\d+(,\\d{3})*(\\.\\d{1,2})?$/\n\t\t\t} else {\n\t\t\t\t//支持负数、千分位分隔符: 100, -0.99, 3, 234.32, -1, 900, 235.09, '12,345,678.90'\n\t\t\t\trule.pattern = /^-?\\d+(,\\d{3})*(\\.\\d{1,2})?$/\n\t\t\t}\n\t\t\trule.message = options.message || \"请填写正确的货币金额\"\n\t\t\tbreak\n\t\tcase \"chinese\":\n\t\t\t//中文: '正则', '前端'\n\t\t\trule.pattern =\n\t\t\t\t/^(?:[\\u3400-\\u4DB5\\u4E00-\\u9FEA\\uFA0E\\uFA0F\\uFA11\\uFA13\\uFA14\\uFA1F\\uFA21\\uFA23\\uFA24\\uFA27-\\uFA29]|[\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879][\\uDC00-\\uDFFF]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0])+$/\n\t\t\trule.message = options.message || \"请填写中文字符\"\n\t\t\tbreak\n\t\tcase \"name\":\n\t\t\t//姓名\n\t\t\tif (options.en || options.english) {\n\t\t\t\t//英文: 'James', 'Kevin Wayne Durant', 'Dirk Nowitzki'\n\t\t\t\trule.pattern = /(^[a-zA-Z]{1}[a-zA-Z\\s]{0,20}[a-zA-Z]{1}$)/\n\t\t\t} else {\n\t\t\t\t//中文: '葛二蛋', '凯文·杜兰特', '德克·维尔纳·诺维茨基'\n\t\t\t\trule.pattern = /^(?:[\\u4e00-\\u9fa5·]{2,16})$/\n\t\t\t}\n\t\t\trule.message = options.message || \"请填写正确的姓名\"\n\t\t\tbreak\n\t\tcase \"decimal\":\n\t\t\t//小数: '0.0', '0.09'\n\t\t\trule.pattern = /^\\d+\\.\\d+$/\n\t\t\trule.message = options.message || \"请填写正确的小数\"\n\t\t\tbreak\n\t\tcase \"number\":\n\t\t\t//数字: 12345678\n\t\t\trule.pattern = /^\\d{1,}$/\n\t\t\trule.message = options.message || \"请填写正确的数字\"\n\t\t\tbreak\n\t\tcase \"date\":\n\t\t\t//日期: '1990-12-12', '2020-1-1'\n\t\t\trule.pattern = /^\\d{4}(-)(1[0-2]|0?\\d)\\1([0-2]\\d|\\d|30|31)$/\n\t\t\trule.message = options.message || \"请填写正确的日期\"\n\t\t\tbreak\n\t\tcase \"time\":\n\t\t\t//时间: '12:00:00', '23:59:59'\n\t\t\tif (options.mode === \"12\") {\n\t\t\t\t//12小时制: '12:00:00', '12:30:00', '12:59:59'\n\t\t\t\trule.pattern = /^(?:1[0-2]|0?[1-9]):[0-5]\\d:[0-5]\\d$/\n\t\t\t} else {\n\t\t\t\trule.pattern = /^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$/\n\t\t\t}\n\t\t\trule.message = options.message || \"请填写正确的时间\"\n\t\t\tbreak\n\t\tcase \"car\":\n\t\tcase \"plate-number\":\n\t\tcase \"car-number\":\n\t\t\tif (options.mode === \"green\" || options.mode === \"newEnergy\") {\n\t\t\t\t//新能源绿牌: '京AD92035', '甘G23459F'\n\t\t\t\trule.pattern =\n\t\t\t\t\t/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领]{1}[A-HJ-NP-Z]{1}(([0-9]{5}[DF])|([DF][A-HJ-NP-Z0-9][0-9]{4}))$/\n\t\t\t} else if (options.mode === \"notNewEnergy\") {\n\t\t\t\t//非新能源： '京A00599', '黑D23908'\n\t\t\t\trule.pattern =\n\t\t\t\t\t/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领]{1}[A-HJ-NP-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/\n\t\t\t} else {\n\t\t\t\t//混合: '京A12345D', '京A00599'\n\t\t\t\trule.pattern =\n\t\t\t\t\t/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领]{1}[A-HJ-NP-Z]{1}(?:(([0-9]{5}[DF])|([DF][A-HJ-NP-Z0-9][0-9]{4}))|[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1})$/\n\t\t\t}\n\t\t\trule.message = options.message || \"请填写正确的车牌号\"\n\t\t\tbreak\n\t\tcase \"version\":\n\t\t\t//版本号: 16.3.2\n\t\t\trule.pattern = /^\\d+(?:\\.\\d+){2}$/\n\t\t\trule.message = options.message || \"请填写正确的版本号\"\n\t\t\tbreak\n\t\tcase \"ip\":\n\t\tcase \"IP\":\n\t\t\t//IP地址\n\t\t\tif (options.mode === \"v6\" || options.mode === \"ipv6\") {\n\t\t\t\t//IPv6地址: '2031:0000:130f:0000:0000:09c0:876a:130b', '[2031:0000:130f:0000:0000:09c0:876a:130b]:8080'\n\t\t\t\trule.pattern =\n\t\t\t\t\t/^(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b)\\.){3}(\\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-9A-Fa-f]{1,4}:){0,5}((\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b)\\.){3}(\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))\\](?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$/i\n\t\t\t} else {\n\t\t\t\t//IPv4地址: '172.16.0.0','172.16.0.0:8080', '127.0.0.0', '127.0.0.0:998'\n\t\t\t\trule.pattern =\n\t\t\t\t\t/^((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]).){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])(?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$/\n\t\t\t}\n\n\t\t\trule.message = options.message || \"请填写正确的IP地址\"\n\t\t\tbreak\n\t\tcase \"qq\":\n\t\t\t//QQ号: 123456789\n\t\t\trule.pattern = /^[1-9][0-9]{4,10}$/\n\t\t\trule.message = options.message || \"请填写正确的QQ号\"\n\t\t\tbreak\n\t\tcase \"wechat\":\n\t\t\t//微信号: 'github666', 'kd_-666'\n\t\t\t//6至20位，以字母开头，字母，数字，减号，下划线\n\t\t\trule.pattern = /^[a-zA-Z][-_a-zA-Z0-9]{5,19}$/\n\t\t\trule.message = options.message || \"请填写正确的微信号\"\n\t\t\tbreak\n\t\tcase \"alpha-numeric\":\n\t\tcase \"numeric-alpha\":\n\t\t\t//字母数字: 'abc123', '123abc'\n\t\t\tif (rule.mode === \"strict\") {\n\t\t\t\t//同时有数字和英文字母\n\t\t\t\trule.pattern = /^(?=.*[a-zA-Z])(?=.*\\d).+$/\n\t\t\t} else {\n\t\t\t\trule.pattern = /^[A-Za-z0-9]+$/\n\t\t\t}\n\t\t\trule.message = options.message || \"请填写字母与数字的组合\"\n\t\t\tbreak\n\t\tcase \"alpha\":\n\t\t\t//字母: 'abc', 'ABC'\n\t\t\tif (options.mode === \"lower\" || options.mode === \"lowercase\") {\n\t\t\t\t//小写字母\n\t\t\t\trule.pattern = /^[a-z]+$/\n\t\t\t} else if (options.mode === \"upper\" || options.mode === \"uppercase\") {\n\t\t\t\t//大写字母\n\t\t\t\trule.pattern = /^[A-Z]+$/\n\t\t\t} else {\n\t\t\t\t//英文字母\n\t\t\t\trule.pattern = /^[a-zA-Z]+$/\n\t\t\t}\n\t\t\trule.message = options.message || \"请填写正确的字母\"\n\t\t\tbreak\n\t\tcase \"username\":\n\t\t\t//用户名，账号: 'test_name'\n\t\t\t//4到16位（字母，数字，下划线，减号）\n\t\t\trule.pattern = /^[a-zA-Z0-9_-]{4,16}$/\n\t\t\trule.message = options.message || \"请填写正确的用户名\"\n\t\t\tbreak\n\t\tcase \"password\":\n\t\t\t//密码: '123456', 'Abcdefg'\n\t\t\t//最少6位，包括至少1个大写字母，1个小写字母，1个数字，1个特殊字符\n\t\t\trule.pattern = /^\\S*(?=\\S{6,})(?=\\S*\\d)(?=\\S*[A-Z])(?=\\S*[a-z])(?=\\S*[!@#$%^&*? ])\\S*$/\n\t\t\trule.message = options.message || \"密码必须包含大小写字母、数字和特殊字符，不少于6位\"\n\t\t\tbreak\n\t\tcase \"zip\":\n\t\t\t//邮政编码: '734500', '100101'\n\t\t\trule.pattern = /^(0[1-7]|1[0-356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[0-5]|8[013-6])\\d{4}$/\n\t\t\trule.message = options.message || \"请填写正确的邮政编码\"\n\t\t\tbreak\n\t\tcase \"mac\":\n\t\tcase \"MAC\":\n\t\t\t//MAC 地址: '38:f9:d3:4b:f5:51', '00-0C-29-CA-E4-66'\n\t\t\trule.pattern = /^((([a-f0-9]{2}:){5})|(([a-f0-9]{2}-){5}))[a-f0-9]{2}$/i\n\t\t\trule.message = options.message || \"请填写正确的MAC地址\"\n\t\t\tbreak\n\t}\n\n\treturn rule\n}\n"],"x_google_ignoreList":[3,4,5,6,7,8,9,10,11,12,13],"mappings":"iJAQA,MAAa,EAAS,CACrB,mBAAoB,UACpB,gBAAiB,OACjB,qBAAsB,YACtB,6BAA8B,aAC9B,uBAAwB,cACxB,CAOD,SAAgB,EAAc,EAAQ,CACrC,OAAO,KAAK,EAAO,CAAC,QAAS,GAAQ,CACpC,EAAO,GAAO,EAAO,IACpB,CAQH,SAAgB,EAAS,EAAS,CAEjC,IAAI,EAAgB,KAOpB,MALA,CACC,IAAU,EAAE,CAEb,EAAQ,QAAU,GAEX,CAON,IAAI,EAAK,EAAQ,CAChB,OAAO,IAAI,SAAS,EAAS,IAAW,CACvC,EAAA,QACE,IAAI,EAAK,EAAO,CAChB,KAAM,GAAQ,CACd,EAAQ,EAAI,EACX,CACD,MAAO,GAAQ,CACf,EAAO,EAAI,EACV,CACD,YAAc,CACV,KACH,EAAA,EAAA,oBAAmB,GAAM,CACzB,EAAc,OAAO,EAEtB,EAAQ,QAAU,IACjB,EACF,EASH,KAAK,EAAK,EAAM,EAAQ,CACvB,OAAO,IAAI,SAAS,EAAS,IAAW,CACvC,EAAA,QACE,KAAK,EAAK,EAAM,EAAO,CACvB,KAAM,GAAQ,CACd,EAAQ,EAAI,EACX,CACD,MAAO,GAAQ,CACf,EAAO,EAAI,EACV,CACD,YAAc,CACV,KACH,EAAA,EAAA,oBAAmB,GAAM,CACzB,EAAc,OAAO,EAEtB,EAAQ,QAAU,IACjB,EACF,EAQH,QAAQ,EAAS,CAmBhB,OAlBA,EAAA,EAAA,YAAW,GAAK,EAChB,EAAA,EAAA,qBAAoB,CACpB,AASC,GATD,EAAA,EAAA,UAAa,EAAQ,EACp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ACA,IACA,EACA,IACA,IACA,GACA,GACA,IACA,IACA,IACA,IACA,IACA,GACA,GACA,GACA,GACA,IACA,IACA,IACA,GACA,IACA,IACA,GACA,IACA,IACA,EACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,GACA,IACA,GACA,EACA,IACA,IACA,IACA,IACA,GACA,IACA,IACA,GACA,GACA,GACA,IACA,IACA,GACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,GACA,GACA,IACA,GACA,IACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,IACA,IACA,GACA,GACA,IACA,GACA,EACA,GACA,IACA,IACA,IACA,EACA,GACA,GACA,IACA,IACA,GACA,GACA,GACA,GACA,EACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,GACA,IACA,GACA,IACA,IACA,IACA,IACA,IACA,IACA,GACA,GACA,IACA,IACA,IACA,GACA,IACA,IACA,GACA,GACA,GACA,IACA,IACA,GACA,GACA,IACA,IACA,IACA,IACA,GACA,IACA,IACA,GACA,IACA,IACA,IACA,GACA,IACA,GACA,GACA,IACA,GACA,GACA,GACA,IACA,IACA,IACA,GACA,GACA,IACA,IACA,IACA,GACA,EACA,IACA,IACA,IACA,IACA,IACA,GACA,GACA,IACA,GACA,IACA,IACA,IACA,IACA,IACA,IACA,GACA,IACA,GACA,GACA,GACA,GACA,GACA,IACA,GACA,IACA,GACA,IACA,IACA,IACA,IACA,IACA,GACA,IACA,IACA,GACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,GACA,GACA,IACA,IACA,IACA,IACA,IACA,IACA,EACA,IACA,IACA,IACA,IACA,GACA,IACA,IACA,IACA,GACA,IACA,GACA,GACA,IACA,IACA,GACA,GACA,IACA,IACA,GACA,GACD,CAAC,CACE,GAAK,IAAI,YAAY,CACvB,OACA,UACA,UACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,UACA,UACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,UACA,UACA,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