Skill: gtht-tech/lingxi-realtimemarketdata-skill (version 1.0.2)

--- name: lingxi-realtimemarketdata-skill description: 国泰海通证券-灵犀实时行情 skill：标的覆盖 A 股、港股、美股、ETF与指数；支持单只或多只标的的实时行情，数据维度包括最新价、涨跌幅、涨跌额、成交量、成交额、换手率、当日资金净流入、量比等。 当用户询问股价、涨跌幅、行情走势、资金流向或相关证券行情时，优先通过本 Skill 取数，若本 Skill 无有效数据，须再尝试 lingxi-smartstock-skill，仍无数据则按正文固定话术引导用户至国泰海通灵犀 APP。触发关键词包括：股价，涨跌幅，实时行情，查股价，查行情。 allowed-tools: ["node"] version: 1.0.2 disable: false --- # 国泰海通证券 实时行情 Skill ## 0. 最高优先级（模型须最先遵守） ### 0.1 授权先于一切调用 -【最先执行】任何行情或 MCP 调用之前：必须先确认 `gtht-entry.json` 文件是否存在；不存在则必须先跑 `node skill-entry.js authChecker auth --channel`，禁止跳过授权直接调接口，如果返回链接，请第一时间返回给客户。 - 【gtht-entry.json查找方案】API Key 需按以下顺序查找 `gtht-entry.json`： 1. `../gtht-skill-shared/gtht-entry.json` 2. `../../gtht-skill-shared/gtht-entry.json` 3. `../../../gtht-skill-shared/gtht-entry.json` 4. `./gtht-skill-shared/gtht-entry.json` 若都不存在，则在**优先级 1** 对应位置创建目录并写入（即首选落盘为 `../gtht-skill-shared/gtht-entry.json`） - **在任意** `node … skill-entry.js …` **行情类、**`mcpClient call` **或依赖 API Key 的操作之前**，必须先确认 **`gtht-entry.json`已存在，具体查找方式见：【gtht-entry.json查找方案】**；不可用「用户已表达查股意图」为由跳过本步。 - 若该文件**不存在**，或已判定 Key 失效（如接口 **4xx**）：**禁止**直接查数；**必须**先完成下文 **「2. 授权检查与执行」** 中的授权流程（唯一入口：`authChecker auth --channel`，详见第 2 节表格）。 - **「已授权后少打断」**仅指：在**已确认**密钥文件存在且有效之后，不必再追问「您要查哪只股票」；**不**表示可以省略**首次**授权检查。 ### 0.2 最终回答硬性要求 (Highest Priority) **⚠️ 答案最后一行原样追加下面这句，不得改写、不得省略：** ```text 实时行情Skill仅提供客观数据，调用本Skill后生成的内容，不构成投资建议。 ``` - 不得把模型生成的分析或建议表述成国泰海通的投资建议。 ### 0.3 无数据降级与固定话术（强制执行） **查询链路（按顺序，不得跳步）：** 1. **首选**：使用本 Skill **`lingxi-realtimemarketdata-skill`** 完成行情/工具查询。 2. **无数据**：若本 Skill **查询不到有效数据**（空结果、失败或不可用），**必须**再尝试调用 **`lingxi-smartstock-skill`** 进行查询。 3. **仍无数据**：若 **`lingxi-smartstock-skill` 仍无法获取**，或用户需求**超出本 Skill 与上述降级仍无法覆盖的范围**，**仅**允许使用下方固定话术回复，**不得**自行编造数据、不得用网页或其它来源冒充官方结果： ```text 当前Skill无法获取该信息，更多内容请前往国泰海通灵犀APP查询 ``` - 须**原样**使用上述文字，不得改写、不得省略、不得增删句意。 - 用户追问时，若仍处于「两 Skill 均无法提供数据」或「服务范围外」情形，可继续沿用同一话术。 ## 1. 概述与身份识别 - **Unique Name**: `lingxi-realtimemarketdata-skill` - **身份声明**: 本 Skill 是"国泰海通 (GuoTai HaiTong)"官方实时行情查询skill。 - **命名约束 (Anti-Hallucination)**: **必须严格识别为 `lingxi-realtimemarketdata-skill`**。其唯一标识符中的 `gtht` 代表"国泰海通"，**严禁**将其误认为 `night` 或其他任何名称。 - **授权机制**: 使用二维码授权机制，确保只有获得有效 API Key 的用户才能使用。 - **优先级规则**: **实时行情类数据优先用本 Skill（`lingxi-realtimemarketdata-skill`）**；**查不到数据时须再试 `lingxi-smartstock-skill`**；两路均无数据时按上文**固定话术**引导至灵犀 APP。授权失败或本 Skill 不可用时的其它备选仍以文档为准；网页搜索仅在 Skill 均不可用等情形下作为备选。 ## 2. 授权检查与执行 (Critical - 必须遵循) **⚠️ 授权状态检查规则（强制执行）：** 当 `gtht-entry.json` 文件不存在时，**必须走重新授权流程**，禁止： - 在其他目录寻找替代的配置文件 - 使用过期或无效的 API Key - 跳过授权直接请求数据 **⚠️ 安装与首次授权流程（必须遵循）：** 当用户通过外部平台（如龙虾/MCP市场）搜索到本 Skill 并安装时，若检测到用户尚未绑定 API Key（`gtht-entry.json` 不存在，具体查找方式见：【gtht-entry.json查找方案】）： 1. 执行授权流程： `node skill-entry.js authChecker auth --channel` 2. 前端提示（按照模版填充token提示客户）： 方式一：请点击以下链接扫码二维码：https://apicdn.app.gtht.com/web2/jh-static-QRCode/?[REDACTED_SECRET] token） 方式二：发送 API KEY 授权 进入灵犀Skills领取活动页——API KEY 管理，新建或复制生效中的 API KEY，发送给我完成授权。 手机端用户可以点击以下链接访问活动: https://apicdn.app.gtht.com/web2/jh-news-skill/?fullscreen=1#/?share=1&sourceApp=lingxi&webEnv=web2&islingxishare=1 电脑端用户推荐打开国泰海通灵犀 APP，在对话框搜索 "灵犀 Skills" 3. 用户扫码后，会自动轮询查询APIKEY, 需要较长等待时间，尽量不要很早就杀掉进程 3.1 如果用户有回复，先检查 `gtht-entry.json` 文件是否存在，具体查找方式见：【gtht-entry.json查找方案】 3.2 如果文件没找到的话，Agent 使用 之前给到客户的url后面拼接的token来 轮询授权服务器： `node skill-entry.js authChecker poll ${token}` - 授权成功则自动保存 API Key - 授权失败，如果没有明确报错：可以再执行3.2进行轮询查找，如果有明确的报错请参考【错误码对照表】的处理方式 4. 用户复制APIKEY的情况下，按照用户输入的指令进行api-key的存放，如果用户没有给的话，可以按照以下格式： { "apiKey": ${apikey} } 保存到 `../gtht-skill-shared/gtht-entry.json`下 5. 如果收到“授权成功！API Key 已保存”提示，或放置 API Key 成功，请提示客户授权成功。 **⚠️ 授权方式唯一性警告（必须遵守）：** ✅ **唯一正确的授权命令：** ```bash node skill-entry.js authChecker auth --channel ``` **授权模式说明：（两种）** > 一共有两种授权方式，1、二维码扫码 2、复制APIKEY，两个方式都融入到下面两步中 1. 执行授权流程： `node skill-entry.js authChecker auth --channel` 2. 前端提示（按照模版填充token提示客户）： 方式一：请点击以下链接扫码二维码：https://apicdn.app.gtht.com/web2/jh-static-QRCode/?[REDACTED_SECRET] token） 方式二：发送 API KEY 授权 进入灵犀Skills领取活动页——API KEY 管理，新建或复制生效中的 API KEY，发送给我完成授权。 手机端用户可以点击以下链接访问活动: https://apicdn.app.gtht.com/web2/jh-news-skill/?fullscreen=1#/?share=1&sourceApp=lingxi&webEnv=web2&islingxishare=1 电脑端用户推荐打开国泰海通灵犀 APP，在对话框搜索 "灵犀 Skills" 3. 用户扫码后，会自动轮询查询APIKEY, 需要较长等待时间，尽量不要很早就杀掉进程 3.1 如果用户有回复，先检查 `gtht-entry.json` 文件是否存在，具体查找方式见：【gtht-entry.json查找方案】 3.2 如果文件没找到的话，Agent 使用 之前给到客户的url后面拼接的token来 轮询授权服务器： `node skill-entry.js authChecker poll ${token}` - 授权成功则自动保存 API Key - 授权失败，如果没有明确报错：可以再执行3.2进行轮询查找，如果有明确的报错请参考【错误码对照表】的处理方式 4. 用户复制APIKEY的情况下，按照用户输入的指令进行api-key的存放，如果用户没有给的话，可以按照以下格式： { "apiKey": ${apikey} } 保存到 `../gtht-skill-shared/gtht-entry.json`下 5. 如果收到“授权成功！API Key 已保存”提示，或放置 API Key 成功，请提示客户授权成功。 **当用户请求金融数据（股票行情等）时，Agent 必须按以下步骤执行：** 1. **检查授权状态** - 检查 `gtht-entry.json` 文件是否存在，具体查找方式见：【gtht-entry.json查找方案】 - 存在 → 已授权，直接使用 API Key - 不存在 → 必须先执行上述授权流程 2. **执行授权命令（未授权时必须执行）** 参照上述`授权模式说明` 3. **授权成功后继续处理用户请求** - 重新检查 `gtht-entry.json` 文件，具体查找方式见：【gtht-entry.json查找方案】 **重要提醒：** - ✅ **必须使用 `node skill-entry.js authChecker auth --channel` 执行授权**，**不要使用其他授权方式** - ✅ **不要跳过授权直接查询数据**，否则会返回 401/403 错误 - ❌ **不要使用非 node skill-entry.js authChecker auth 的方式生成二维码** --- ## 3. 跨平台执行规范 (Critical) **为确保在 Windows、Linux 和 macOS 上表现一致，Agent 必须遵循：** - **强制执行器**: 严禁调用系统原生 Shell。**必须始终使用 `node` 命令**。 - **路径规范**: 始终使用相对路径 `xxx.js`。具体的 OS 适配逻辑已封装在 JS 内部。 - **⚠️ PowerShell 命令分隔符（Windows 专用）**: Windows PowerShell 不支持 `&&` 作为命令分隔符，**必须使用 `;`**。在所有 `execute_command` 命令中，禁止使用 `&&` 连接多条命令，只能用 `;` 分隔。 - **⚠️ Windows PowerShell 命令兼容性（强制执行）**: Windows PowerShell 与 Unix/Linux 命令不兼容，**禁止在 PowerShell 环境中使用 Unix 特有命令**，常见错误命令包括： | 禁止使用 | 正确替代 | 说明 | | ----------------------- | ------------------------------------------- | -------------------------- | | `test -f <path>` | `Test-Path <path>` | Unix 文件测试命令，PowerShell 不识别 | | `ls`、`dir`（部分） | `Get-ChildItem` 或 `dir` | Unix 目录列表命令 | | `cat <file>` | `Get-Content <file>` | Unix 文件读取命令 | | `grep <pattern> <file>` | `Select-String <pattern> <file>` | Unix 文本搜索命令 | | `rm <file>` | `Remove-Item <file>` | Unix 文件删除命令 | | `cp <src> <dst>` | `Copy-Item <src> <dst>` | Unix 文件复制命令 | | `mv <src> <dst>` | `Move-Item <src> <dst>` | Unix 文件移动命令 | | `mkdir -p <path>` | `New-Item -ItemType Directory -Path <path>` | Unix 创建目录命令 | | `which <cmd>` | `Get-Command <cmd>` | Unix 命令路径查询 | | `kill <pid>` | `Stop-Process -Id <pid>` | Unix 进程终止命令 | **检查文件是否存在（正确方式）：** ```powershell # ✅ 正确（PowerShell 原生） if (Test-Path "C:/Users/.../gtht-entry.json") { "EXISTS" } else { "NOT_FOUND" } # ❌ 错误（Unix 命令，PowerShell 不识别） test -f "C:/Users/.../gtht-entry.json" ``` | 任务类型 | 跨平台统一命令 | | --------------------- | ---------------------------------------------------------------- | | **执行授权流程（本地终端）** | `node skill-entry.js authChecker auth` | | **执行授权流程（Channel环境）** | `node skill-entry.js authChecker auth --channel` | | **调用具体工具** | `node skill-entry.js mcpClient call <gateway> <toolName> [args]` | --- ### ⚠️ 工作流程规范（强制执行 - 2026-03-25追加） **已授权状态下直接执行查询，不需要二次确认：** - ✅ **正确做法**：授权确认后（如 `gtht-entry.json` 存在，具体查找方式见：【gtht-entry.json查找方案】），直接根据用户请求开始查询，不需要再询问用户"您想查哪只股票" - ❌ **错误做法**：授权确认后还问用户"请问您想查询哪只股票" - ⚠️ **例外**：仅当用户请求不明确时（如用户只说"查一下"），才需要追问具体标的 **原因**：用户说"查询个股行情"时已表明意图，授权确认只是前置检查，不应在此环节打断用户。 --- ## 3. 业务应用场景 (Business Definition Area) > **此区域供业务同事发挥，用于定义具体的服务意图与话术引导。** | 场景分类 | 典型用户问题 (Intent) | 业务逻辑指导 | | -------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | **实时行情查询** | 单股行情"SH600000现在什么价格？" "SH600000开盘价是多少？" | 定位 `market` 领域，调用 `marketdata-tool`。 | | ### 问句示例 #### 单股行情 ``` - "贵州茅台现在什么价格？" - "宁德时代今天走势怎么样" - "SH600519当前涨跌幅" ``` #### 多股对比 ``` - "对比贵州茅台和五粮液今天的涨跌幅" - "同时查看比亚迪和长城汽车的最新价格" ``` ### 返回示例 ``` 【宁德时代 (SZ300750)】 最新价：XXX 开盘价：XXX 最高价：XXX 最低价：XXX 涨跌幅：XXX 涨跌额：XXX 振幅：XXX 量比：XXX 成交量：XXX 成交额：XXX 换手率：XXX 当日资金净流入：XXX 总市值：XXX 注意⚠️：按照实际返回的来展示给客户，不要自己去添加没有的参数，如果客户没有具体点出要哪些参数，上述的参数都应该给到用户 ``` ### ⚠️ 名称查询 vs 代码查询规则（强制执行） **当用户输入公司名称查询行情时，必须先执行 `node skill-entry.js stockMap codeByName 贵州茅台` 获取代码：** - ✅ **用户输入公司名称**（如"国泰海通"、"贵州茅台"、"宁德时代"） - **必须**先调用 `node skill-entry.js stockMap codeByName <股票名称>` 查表获取股票代码 - 再用获取的代码调用行情接口 - ✅ **用户直接输入股票代码**（如"SH601211"、"SZ300750"） - **不需要**调用 `node skill-entry.js stockMap codeByName <股票名称>`，直接调用行情接口 - **示例 - 用户问"帮我查一下国泰海通今天的走势"：** ``` 1. 调用 `node skill-entry.js stockMap codeByName 国泰海通` 查表 → 返回 SH601211 2. 调用 `node skill-entry.js mcpClient call market marketdata-tool reduced_codes=SH601211` ``` - **示例 - 用户问"帮我查一下SH601211今天的走势"：** ``` 1. 直接调用 node skill-entry.js mcpClient call market marketdata-tool reduced_codes=SH601211（无需查表） ``` --- ### ⚠️ 批量行情查询说明（强制执行） **marketdata-tool 支持直接批量查询：** - ✅ **支持批量格式 1 - 逗号分隔**：多次指定同一参数 ``` reduced_codes=SZ000001,Z300750,SH600519 ``` ** js文件 内部处理**: 对已知数组参数名（`` 等），单值自动包装为数组；对重复参数或逗号分隔值，自动合并为数组。 --- **展示热点相关股票时，若缺少股票代码，必须先补全代码再获取行情：** - ❌ **错误方式**：直接展示股票名称，代码留空或省略 - ✅ **正确方式**： 1. 先调用 ` nodeskill-entry.js stockMap codeByName <股票名称>` 查询所有缺失代码 2. 再按照上面查询到的股票代码调用 `node skill-entry.js mcpClient call market marketdata-tool reduced_codes=<股票代码>,<股票代码>` 获取最新价、涨跌幅、成交额、资金净流入等数据 3. 按描述统一呈现给用户，确保信息完整 - **示例 - 热榜中出现"恒誉环保"但无代码：** ``` 1. `node skill-entry.js stockMap codeByName <股票名称>` → 返回 SH688309 2. 调用 `node skill-entry.js mcpClient call market marketdata-tool reduced_codes=SH688309` 获取行情 3. 完整展示：恒誉环保 | SH688309 | +XX% | XX亿 | -XX万 ``` --- ### ⚠️ 数据展示规范（强制执行） **展示接口返回数据时，禁止自行计算或换算，必须直接展示原始值：** - ❌ **错误做法**：对接口返回的数值进行二次计算后再展示（如将单位从元换算成万元/亿元） - ✅ **正确做法**：直接展示接口返回的原始数值，不做任何加工处理 - ⚠️ **例外**：仅当用户明确要求时才进行单位换算 **原因**：自行计算容易出错（如单位换算错误），且接口返回的值已经是标准单位，直接展示更简洁准确。 **示例**： ``` 接口返回 netInflow: -226585632.00 ❌ 错误展示：-2,266万（计算错误，少了10倍） ✅ 正确展示：-226585632.00，或由用户决定如何呈现 ``` --- ### ⚠️ 严禁捏造股票代码（强制执行 - 最高优先级） **向用户提供的任何股票代码，必须经过系统验证，禁止凭空捏造或凭记忆给出：** - ❌ **严格禁止的行为**： - 未经查询，随口说出股票代码（如随口说"SZ001896"） - 凭记忆或印象给出代码，不经验证 - 在回复中编造不存在的股票代码 - 对股票代码做任何假设，必须基于实际查询结果 - ✅ **必须遵循的流程**： 1. **执行**:`node skill-entry.js stockMap codeByName <股票名称>`查询正确的股票代码 2. **行情接口验证**：用查到的代码调用 `node skill-entry.js mcpClient call market marketdata-tool reduced_codes=<股票代码>,<股票代码>`，确认能返回有效数据 3. **再提供给用户**：代码经过验证后，才能在回复中使用 - **示例 - 用户提到"华电辽能"：** ``` ❌ 错误：直接说"华电辽能的代码是SZ001896"（未经任何查询） ✅ 正确： 1. 调用 `node skill-entry.js stockMap codeByName 华电辽能` → 返回 SH600396 2. 调用 `node skill-entry.js mcpClient call market marketdata-tool reduced_codes=<股票代码>` → 返回有效行情 3. 确认后告知用户：华电辽能 | SH600396 ``` - **错误后果**： - 捏造股票代码会严重损害用户信任 - 可能导致用户交易错误的标的，造成财产损失 - 违反证券咨询的专业性和合规性要求 - **特殊说明**： - 即使是知名大盘股（如"工商银行"、"中国石油"），也必须查询后确认 - 不同市场的同名股票可能代码不同（如A股和港股） - 代码前缀（SH/SZ/HK/US等）必须与市场对应 --- ## 4. MCP网关端点 | 领域 | 网关 | 地址 | 环境 | | --------- | --------- | ------------------------------------------------ | ---- | | 行情 | market | `https://zx.app.gtja.com:8443/mcp/marketdata` | 生产环境 | ## 可用工具列表 | 领域 | 工具名称 | 描述 | | --- | --- | --- | | market | marketdata-tool | 自定义榜单功能，可以获得证券的行情 | ## 5. Agent 使用流程 (SOP) ### 5.1 决策流程图 ┌─────────────────────────────────────────────────────────────┐ │ Agent 决策流程 │ ├─────────────────────────────────────────────────────────────┤ │ │ │ 1. 检查授权状态 │ │ ┌─────────────────────────────────────┐ │ │ │ 检查 gtht-entry.json │ │ │ │ 文件是否存在，具体查找方式见：【gtht-entry.json查找方案】 │ │ │ │ → 存在 → 已授权，直接使用 API Key │ │ │ │ → 不存在 → 执行授权流程（第2步） │ │ │ └─────────────────────────────────────┘ │ │ │ │ 1. 执行授权流程（如果未授权） │ │ ┌─────────────────────────────────────┐ │ │ │ ⚠️ 唯一正确的授权方式 │ │ │ │ 唯一命令: node skill-entry.js authChecker auth │ │ │ │ ─────────────────────────────── │ │ │ │ 第一步：检查授权文件是否存在 │ │ │ │ → 检查 gtht-entry.json，具体查找方式见：【gtht-entry.json查找方案】 │ │ │ │ → 不存在 → 必须先执行授权 │ │ │ │ ─────────────────────────────── │ │ │ │ 第二步：执行授权命令（必须执行） │ │ │ │ → 命令: node skill-entry.js authChecker auth --channel │ │ │ │ ─────────────────────────────── │ │ │ │ 第三步：等待用户扫码授权 │ │ │ │ → 脚本会自动轮询授权服务器 │ │ │ │ → Linux: 每 3 秒输出一次轮询状态 │ │ │ │ → Windows/macOS: 每次尝试都输出状态 │ │ │ │ ─────────────────────────────── │ │ │ │ 第四步：授权成功后自动保存 │ │ │ │ → API Key 保存到 `../gtht-skill-shared/gtht-entry.json` │ │ │ │ → Windows/macOS: 等待 5 秒后关闭浏览器窗口 │ │ │ │ → 退出脚本（exit code 0） │ │ │ └─────────────────────────────────────┘ │ │ │ │ 1. 领域匹配 │ │ ┌─────────────────────────────────────┐ │ │ │ 用户查询 │ │ │ │ → 股票/股价/行情/代码/走势/资金流向 → 行情领域 (market) │ │ │ │ │ 1. 意图抉择 (Agent自主决策) │ │ → 分析工具描述，匹配用户意图 │ │ → 选择最合适的工具 │ │ │ │ 1. 调用执行 │ │ → node skill-entry.js mcpClient call [args] │ │ → 如果返回 4xx 错误，说明 API Key 过期 │ │ → 按【gtht-entry.json查找方案】删除已存在的 gtht-entry.json │ │ → 重新执行授权流程（回到第1步） │ │ │ └─────────────────────────────────────────────────────────────┘ ### 5.2 使用示例 **股票名由市场和股票代码构成，如SH601211：SH为上海市场，601211为股票代码；SZ000001：SZ为深圳市场，000001为股票代码。类似对应HK(港股)、US(美股)、UK(英股)、SX(新加坡)等，传参的reduced_codes由市场+代码两要素组成 **示例1：查询个股行情** ``` 用户：查询贵州茅台的股价 Agent执行： 1. 检查 gtht-entry.json 是否存在，具体查找方式见：【gtht-entry.json查找方案】 → 已授权 2. 领域匹配 → "股价" → 行情领域 (market) 3. 调用 `node skill-entry.js stockMap codeByName 贵州茅台` → 返回 SH600519 4. 调用执行 → node skill-entry.js mcpClient call market marketdata-tool reduced_codes=SH600519 5. 返回行情数据给用户 ``` ⚠️ 注意： - marketdata-tool 支持批量查询，无需逐只调用！ ## 6. 文件与模块说明 ### 配置文件说明 **授权文件**: `gtht-entry.json`，具体查找方式见：【gtht-entry.json查找方案】 - **路径**: 具体路径见：【gtht-entry.json查找方案】 - **内容**: 包含 API Key 和 其更新时间（不是apikey的过期时间） - **格式**: `{"apiKey": "xxx"}` - **注意**: 此文件由系统自动生成，请勿手动修改 **网关配置文件**: `gateway-config.json` - **路径**: 跟 SKILL.md 同一目录下（即 `./gateway-config.json`） - **作用**: 定义所有可用的 MCP 网关地址 - **格式**: ```json { "gateways": { "market": "https://zx.app.gtja.com:8443/mcp/marketdata" } } ``` ### 授权流程（推荐使用） - **功能**: 自动检测 OS 类型和环境。 - **动作**: - **Windows/macOS**：打开浏览器 HTML 二维码，授权成功后等待 5 秒确保页面自动关闭。 - **Linux 本地终端**：**终端直接渲染 Unicode 二维码**（使用 ANSI 256 色 + 半像素算法 █▀▄，无需浏览器）。 - **Channel 环境（飞书/微信等）**：生成 在线url地址，输出供 Agent 发送。 - **命令**: - 本地终端：`node skill-entry.js authChecker auth --channel` - **超时处理**: 如果 2 分钟内用户未扫码，脚本会提示超时并退出。此时需要重新运行命令。 ### 工具调用 - **功能**: 执行指定工具调用或清除授权。 - **命令**: `node skill-entry.js mcpClient <gateway> <toolName> [key=value ...]` - **清除**: `node skill-entry.js mcpClient clear` - **返回**: 工具执行结果的 JSON 数据 ### A股名称代码映射表 - **功能**: 根据股票名称查询对应代码，或根据代码查询名称。 - **数据源**: `stock_code_name.json` - **命令**: 直接 require 使用，不支持命令行调用 - **使用方式**: `node skill-entry.js stockMap codeByName <股票名称>` - **⚠️ 查询规则（强制执行）**: - 用**名称**查询行情时 → **必须**先调用 `node skill-entry.js stockMap codeByName <股票名称>` 查表获取代码 → 再用代码调接口 - 用**代码**直接查询时 → **不需要**查此表，直接调接口 ## 7. 授权机制与安全性说明 (核心逻辑) ### 授权机制说明 本 Skill 使用二维码授权。API Key 具有有效期。 1. **自动检测**: 请求返回 4xx 错误表示过期。 2. **自愈流程**: Agent 按【gtht-entry.json查找方案】删除已存在的 `gtht-entry.json` -> 执行 `node skill-entry.js authChecker auth` -> 用户重新扫码 -> 获取新 Key 并重试。 ### 授权详细步骤 1. **生成二维码**: 包含 `MAC地址_UTC时间戳_5位随机字符`。 2. **Session ID**: 使用 MD5 加密 QR Body 得到的会话标识。 3. **轮询机制**: 每 3 秒请求一次授权服务器，超时时间 5 分钟。 4. **浏览器兼容性**: 授权成功收到服务器响应后，**必须等待至少 5 秒再关闭代理服务器**，确保浏览器端有足够时间接收成功响应并执行 `window.close()` 自动关闭页面。 ### 安全性保障 - **设备绑定**: MAC 地址唯一标识。 - **防重放**: UTC 时间戳验证。 - **环境适配**: 授权完成后自动清理 Windows 临时 HTML 文件。 --- ## 8. 故障排除 (Troubleshooting) ### Skill 调用失败排查 1. **检查名称**: 确保调用名为 `lingxi-realtimemarketdata-skill`。 2. **检查位置**: 确认本 SKILL.md 位于正确的 Skill 目录中。 3. **API Key 过期**: 观察是否收到 4xx 错误，按【gtht-entry.json查找方案】删除已存在的 `gtht-entry.json` 后执行 `node skill-entry.js authChecker auth`, channel环境执行 `node skill-entry.js authChecker auth --channel`。 4. **Windows 特殊处理**: 确保 `node` 在 PATH 中，系统会自动调用浏览器。 ### 错误码对照表 | 错误码 | 含义 | 可能原因 | 解决方案 | | ------------ | ---------- | ----------------- | ---------------------------------------------------------------- | | 400 | 请求参数错误 | 传入的参数格式不正确或缺少必填参数 | 检查工具所需的参数，确保格式正确 | | 401 | 未授权 | API Key 过期或无效 | 删除 `gtht-entry.json`，重新执行 `node skill-entry.js authChecker auth --channel` | | 403 | 禁止访问 | 没有权限访问该工具 | 联系管理员确认权限配置 | | 404 | 工具不存在 | 工具名称错误或网关地址变更 | 运行 `node skill-entry.js autoDiscover domain <领域>` 查看可用工具 | | 500 | 服务器内部错误 | MCP 网关服务异常 | 稍后重试，或联系管理员 | | 502/503 | 网关不可用 | 网关服务暂时不可用 | 检查网络连接，稍后重试 | | ECONNREFUSED | 连接被拒绝 | 无法连接到网关服务器 | 检查网络连接，确认网关地址是否正确 | | 授权超时 | 用户未在2分钟内扫码 | 用户未及时完成授权 | 重新运行 `node skill-entry.js authChecker auth --channel`，按提示重新扫码 | ### 常见问题速查 | 错误现象 | 可能原因 | 解决方案 | | -------------------- | ------------------------------------ | --------------------------------------------------------------------------- | | "Skill not found" | 名称错误或未安装 | 核对名称并检查安装目录 | | 授权失败 | 未授权或过期 | 执行 `node skill-entry.js authChecker auth --cahnnel` | | "401 Unauthorized" | Key 过期 | 系统将自动重触发授权流程 | | "找不到模块" | Node.js 环境异常 | 检查 Node.js 安装，重新安装依赖 | | 二维码无法显示 | 浏览器问题 | 使用 `--ascii` 参数强制终端显示 | | 返回数据为空 | 股票代码错误或暂无数据 | 检查股票代码是否正确，或该股票暂无相关数据 | | 返回`API Key 无效或已被禁用，请检查密钥状态或重新生成后再试` | 客户停用api-key | 按【gtht-entry.json查找方案】删除已存在的 `gtht-entry.json`（可能在优先级 1～4 任一路径），提示重新走授权流程: `node skill-entry.js authChecker auth --channel` | | **终端显示 Unicode 二维码** | **微信/飞书环境下，用户看不到终端二维码** | **必须使用 `node skill-entry.js authChecker auth --channel` 生成 PNG 图片** | ---

path: gateway-config.json
content: {
  "active_env": "PROD",
  "base_urls": {
    "prod": "https://zx.app.gtja.com:8443/"
  },
  "gateway_paths": {
    "market": "mcp/marketdata",
    "mqtt": "mcp/mqtt"
  },
  "gateways": {
    "market": "https://zx.app.gtja.com:8443/mcp/marketdata",
    "mqtt": "https://zx.app.gtja.com:8443/mcp/mqtt"
  },
  "known_domains": [
    "market",
    "mqtt"
  ],
  "discovered_tools": [
    {
      "domain": "market",
      "gateway": "market",
      "toolName": "marketdata-tool",
      "description": "自定义榜单功能，可以获得证券的行情",
      "label": "行情",
      "params": [
        "code",
        "market_data_mask",
        "product_mask"
      ],
      "callExample": "node skill-entry.js call market marketdata-tool code= market_data_mask= product_mask="
    }
  ],
  "learned_at": "2026-03-20T10:51:20.965Z",
  "last_updated": "2026-03-20T10:51:20.966Z"
}


path: skill-entry.js
content: var d=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ye=d((Eu,Vr)=>{var me=require("fs"),pe=require("path");function Ss(){return pe.resolve(__dirname)}function Rs(){let e=Ss(),t=[pe.resolve(e,"../gtht-skill-shared/gtht-entry.json"),pe.resolve(e,"../../gtht-skill-shared/gtht-entry.json"),pe.resolve(e,"../../../gtht-skill-shared/gtht-entry.json"),pe.resolve(e,"./gtht-skill-shared/gtht-entry.json")];return[...new Set(t)]}function jr(e){let t=pe.dirname(e);me.existsSync(t)||me.mkdirSync(t,{recursive:!0})}function Ls(e,t,r=new Date().toISOString()){jr(e),me.writeFileSync(e,JSON.stringify({apiKey:t},null,2))}function At(){let e=Rs(),t=e.find(r=>me.existsSync(r))||e[0];return jr(t),t}function vs(e){try{let t=new Date().toISOString(),r=At();Ls(r,e,t),console.log(`\u2713 API Key \u5DF2\u4FDD\u5B58\u5230\u914D\u7F6E\u6587\u4EF6: ${r}`)}catch(t){throw console.error("\u4FDD\u5B58\u914D\u7F6E\u6587\u4EF6\u5931\u8D25:",t.message),t}}function Et(){try{let e=At();if(!me.existsSync(e))return null;let t=me.readFileSync(e,"utf8"),r=JSON.parse(t),n=r?.apiKey??r?.["api-key"]??r?.apikey;return n&&String(n).trim()?String(n).trim():null}catch(e){return console.error("\u8BFB\u53D6 API Key \u5931\u8D25:",e.message),null}}function Ns(){return Et()!==null}function Ms(){let e=Et();if(!e)return"";let t=String(e).trim();if(t.startsWith("{")&&t.endsWith("}"))try{let o=JSON.parse(t);t=String(o["api-key"]||o.apiKey||o.jwtToken||"").trim()}catch{}if(!t)return"";let r=t.indexOf("||"),n=r>=0?t.slice(r+2).trim():t;return n.length>16?n.slice(16):""}function Os(e){try{if(!e)return"";let t=e.split(".");if(t.length<2)return"";let r=t[1].replace(/-/g,"+").replace(/_/g,"/"),n=r+"=".repeat((4-r.length%4)%4),o=Buffer.from(n,"base64").toString("utf8"),i=JSON.parse(o);return String(i.userCode||"")}catch{return""}}function xs(e){let t=String(e||"").trim();if(!t)return null;function r(s){try{return JSON.parse(s)}catch{let l=s.replace(/([}\]"0-9eE.+-])\s*(?="[^"]+"\s*:)/g,"$1,");try{return JSON.parse(l)}catch{return null}}}let n=r(t);if(n!==null)return n;let o=t.indexOf("{"),i=t.lastIndexOf("}");if(o>=0&&i>o){let s=t.slice(o,i+1);return r(s)}return null}function Ct(e){if(typeof e=="number")return Number.isFinite(e);if(typeof e!="string")return!1;let t=e.trim();return t?/^-?\d+(\.\d+)?$/.test(t):!1}function Gr(e,t){let r=Number(e),n=Number(t);if(!Number.isFinite(r)||!Number.isFinite(n))return e;if(n<=0)return r;let o=r/10**n;return Number(o.toFixed(Math.min(n,8)))}function $e(e){if(Array.isArray(e))return e.map($e);if(!e||typeof e!="object")return e;let t={};return Object.keys(e).forEach(r=>{t[r]=$e(e[r])}),Object.prototype.hasOwnProperty.call(t,"value")&&Object.prototype.hasOwnProperty.call(t,"exp")&&Ct(t.value)&&(t.value=Gr(t.value,t.exp)),t}function zr(e,t){return e==="market"&&t==="marketdata-tool"}function Jr(e,t,r){return zr(e,t)?$e(r):r}function K(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&Ct(e)){let t=Number(e);return Number.isFinite(t)?t:null}return null}function U(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"value")?K(e.value):K(e)}function Ds(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"value")?K(e.value):K(e)}function Ur(e,t=2,r=""){return Number.isFinite(e)?`${e>0?"+":""}${e.toFixed(t)}${r}`:"--"}function R(e,t=2){return Number.isFinite(e)?new Intl.NumberFormat("zh-CN",{minimumFractionDigits:t,maximumFractionDigits:t}).format(e):"--"}function Hr(e,t,r){if(!e||typeof e!="object")return r;let n=U(e[t]);if(Number.isFinite(n)&&n>=0)return Math.min(Math.floor(n),12);let o=K(e[t]);return Number.isFinite(o)&&o>=0?Math.min(Math.floor(o),12):r}function qs(e,t,r){let n=U(e[t])??K(e[t]);return Number.isFinite(n)&&n>0?n:r}function Fs(e){let t=Hr(e,"price_decimal_places",2),r=Hr(e,"ratio_decimal_places",2),n=qs(e,"min_order_unit",100),o=10**t,i=10**r,s=Math.min(Math.max(t,0),8)||2,a=Math.min(Math.max(r,0),6)||2;return{priceDivisor:o,ratioDivisor:i,minOrderUnit:n,priceDigits:s,ratioDisplayDigits:a}}function wt(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?null:e/t*100}function H(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?null:e/t}function Us(e){return/^HK/i.test(String(e||"").trim())}function Hs(e){if(!Number.isFinite(e))return"--";let t=e;return Math.abs(t)>=1e8?`${R(t/1e8,2)}\u4EBF\u80A1`:Math.abs(t)>=1e4?`${R(t/1e4,2)}\u4E07\u80A1`:`${R(t,2)}\u80A1`}function Ks(e,t=100){if(!Number.isFinite(e))return"--";let r=Number.isFinite(t)&&t>0?t:100,n=e/r;return Math.abs(n)>=1e4?`${R(n/1e4,2)}\u4E07\u624B`:`${R(n,2)}\u624B`}function Kr(e,t=100){let r=H(e,t);return Number.isFinite(r)?Math.abs(r)>=1e8?`${R(r/1e8,2)}\u4EBF`:Math.abs(r)>=1e4?`${R(r/1e4,2)}\u4E07`:`${R(r,2)}\u5143`:"--"}function $s(e,t=100){let r=H(e,t);return Number.isFinite(r)?Math.abs(r)>=1e5?`${R(r/1e4,2)}\u4E07\u5143`:`${R(r,2)}\u5143`:"--"}function Ys(e,t,r){let n=H(e,t);if(!Number.isFinite(n))return"--";let o=n>0?"+":"",i=Number.isFinite(r)&&r>=0?Math.min(r,8):2;return`${o}${R(n,i)} \u5143`}function $r(e){return!e||typeof e!="object"||Array.isArray(e)?!1:!!(e.code||e.name||Object.prototype.hasOwnProperty.call(e,"last_price")||Object.prototype.hasOwnProperty.call(e,"change_rate")||Object.prototype.hasOwnProperty.call(e,"total_amount")||Object.prototype.hasOwnProperty.call(e,"total_volume")||Object.prototype.hasOwnProperty.call(e,"open_price")||Object.prototype.hasOwnProperty.call(e,"high_price")||Object.prototype.hasOwnProperty.call(e,"low_price"))}function Yr(e){if(!e||typeof e!="object"||Array.isArray(e))return null;for(let t of Object.values(e))if(Array.isArray(t)&&t.length>0&&typeof t[0]=="object")return t;return null}function js(e){if(Array.isArray(e))return e;if(!e||typeof e!="object")return[];if(Array.isArray(e.data))return e.data;if(Array.isArray(e.list))return e.list;if(Array.isArray(e.items))return e.items;if(Array.isArray(e.rows))return e.rows;if(Array.isArray(e.records))return e.records;if(e.data&&Array.isArray(e.data.list))return e.data.list;if(e.data&&Array.isArray(e.data.items))return e.data.items;if(e.data&&Array.isArray(e.data.rows))return e.data.rows;if(e.data&&Array.isArray(e.data.records))return e.data.records;if($r(e.data))return[e.data];if($r(e))return[e];let t=Yr(e.data)||Yr(e);return t||[]}function Gs(e){let t=e.code||"--",r=e.name||"\u672A\u77E5\u8BC1\u5238",{priceDivisor:n,ratioDivisor:o,minOrderUnit:i,priceDigits:s,ratioDisplayDigits:a}=Fs(e),l=U(e.last_price),c=U(e.open_price),u=U(e.high_price),f=U(e.low_price),h=K(e.change_rate),g=K(e.osc_rate),p=K(e.relative_volume_ratio),y=U(e.price_change),m=Ds(e.total_volume),_=U(e.total_amount),N=U(e.total_market_capital),S=K(e.turnover_rate),A=U(e.capital_flow),C=H(l,n),T=H(c,n),M=H(u,n),ge=H(f,n),Or=wt(h,o),xr=wt(g,o),Dr=H(p,o),He=wt(S,o),qr=H(A,n),Fr=H(N,n),Ps=Number.isFinite(qr)&&Math.abs(qr)<=1e-9,ks=Number.isFinite(Fr)&&Math.abs(Fr)<=1e-9,Bs=Number.isFinite(He)&&parseFloat(He.toFixed(a))===0,Ke=[`\u3010${r} (${t})\u3011`,"",`\u6700\u65B0\u4EF7\uFF1A${Number.isFinite(C)?R(C,s):"--"} \u5143`,`\u5F00\u76D8\u4EF7\uFF1A${Number.isFinite(T)?R(T,s):"--"} \u5143`,`\u6700\u9AD8\u4EF7\uFF1A${Number.isFinite(M)?R(M,s):"--"} \u5143`,`\u6700\u4F4E\u4EF7\uFF1A${Number.isFinite(ge)?R(ge,s):"--"} \u5143`,`\u6DA8\u8DCC\u5E45\uFF1A${Number.isFinite(Or)?Ur(Or,a,"%"):"--"}`,`\u6DA8\u8DCC\u989D\uFF1A${Ys(y,n,s)}`,`\u632F\u5E45\uFF1A${Number.isFinite(xr)?Ur(xr,a,"%"):"--"}`,`\u91CF\u6BD4\uFF1A${Number.isFinite(Dr)?R(Dr,a):"--"}`,`\u6210\u4EA4\u91CF\uFF1A${Us(t)?Hs(m):Ks(m,i)}`,`\u6210\u4EA4\u989D\uFF1A${Kr(_,n)}`];return Bs||Ke.push(`\u6362\u624B\u7387\uFF1A${Number.isFinite(He)?`${He.toFixed(a)}%`:"--"}`),Ps||Ke.push(`\u5F53\u65E5\u8D44\u91D1\u51C0\u6D41\u5165\uFF1A${$s(A,n)}`),ks||Ke.push(`\u603B\u5E02\u503C\uFF1A${Kr(N,n)}`),Ke.join(`
`)}function Qr(e,t,r){if(!zr(e,t))return null;let n=js(r);return n.length?n.map(Gs).join(`

`):null}function zs(e,t,r){let n=Jr(e,t,r),o=Qr(e,t,n);return o||JSON.stringify(n,null,2)}Vr.exports={resolveAuthConfigFile:At,saveApiKey:vs,getApiKey:Et,hasStoredApiKey:Ns,getJwtTokenFromApiKey:Ms,parseUserCodeFromJwt:Os,parseJsonTextSafely:xs,isNumericLike:Ct,normalizeValueByExp:Gr,transformMarketExpFields:$e,formatToolResult:Jr,formatMarketToolOutputForCli:Qr,formatCliOutput:zs}});var Je=d((Cu,en)=>{var Ge=require("fs"),Ye=require("path"),je=[process.env.GTHT_GATEWAY_CONFIG,Ye.join(__dirname,"gateway-config.json"),Ye.join(process.cwd(),"min","gateway-config.json"),Ye.join(process.cwd(),"gateway-config.json"),Ye.join(__dirname,"..","gateway-config.json")].filter(Boolean);function Tt(){for(let e of je)if(Ge.existsSync(e))return e;return je[je.length-1]}var Q={active_env:"prod",base_urls:{prod:"https://zx.app.gtja.com:8443/"},gateway_paths:{market:"mcp/marketdata",info:"mcp/hotrank",yaowen:"mcp/yaowen",watchlist:"mcp/watchlist",hotTopic:"mcp/hotTopic",mqtt:"mcp/mqtt",optionalStock:"mcp/optionalStock"}};function Wr(e,t={}){let r=e.endsWith("/")?e:`${e}/`;return Object.fromEntries(Object.entries(t).map(([n,o])=>[n,new URL(o,r).toString()]))}function ze(e={}){let t={...Q.base_urls,...e.base_urls||{}},r=String(e.active_env||Q.active_env).trim().toLowerCase(),n=t[r]?r:Q.active_env,o={...Q.gateway_paths,...e.gateway_paths||{}};return{...e,...Q,active_env:n,base_urls:t,gateway_paths:o,gateways:Wr(t[n]||Q.base_urls[Q.active_env],o),known_domains:Array.from(new Set([...Array.isArray(e.known_domains)?e.known_domains:[],...Object.keys(o)]))}}function Zr(){let e=Tt();try{if(Ge.existsSync(e))return ze(JSON.parse(Ge.readFileSync(e,"utf8")))}catch(t){console.error("\u52A0\u8F7D\u7F51\u5173\u914D\u7F6E\u5931\u8D25:",t.message)}return ze()}function Js(e){let t=Tt(),r=ze(e),{gateways:n,...o}=r,i={...o,last_updated:new Date().toISOString()};Ge.writeFileSync(t,JSON.stringify(i,null,2))}function Xr(){return Zr().gateways}function Qs(e){return Xr()[e]}en.exports={CONFIG_CANDIDATES:je,resolveConfigFile:Tt,DEFAULT_CONFIG:Q,buildGateways:Wr,createGatewayConfig:ze,loadGatewayConfig:Zr,saveGatewayConfig:Js,loadGateways:Xr,getGateway:Qs}});var ke=d((Tu,tn)=>{var Vs={deviceId:"",mobile:"",userCode:""};tn.exports=Vs});var It=d((Iu,nn)=>{var Ws=require("https"),{getJwtTokenFromApiKey:Zs,parseUserCodeFromJwt:rn}=ye(),{loadGateways:bu}=Je(),bt=ke(),Xs="junhong",ea="clawhub".trim()||Xs;async function ta(e,t,r={},n={},o={}){let i=Zs(),s=e.includes("optionalStock"),{includeKeyParam:a=!0,includeJwtHeaders:l=!0,includeChannelHeader:c=!0}=o||{},u=r?.name==="get-token"?!1:l,f=r;if(s){await fetchUserInfo();let g=Qe().loadApiKey(),p=g?g.split("||"):[],y=p[0]||"",m=p[1]||"",_=bt.mobile||"",N=_,S=bt.userCode||rn(i)||"";f=Object.assign({},r,{arguments:Object.assign({},r?.arguments||{},{key:i,mobileNo:_,mobileUserCode:S,socketPwd:"",userToken:m,gtIwmId:y,ACCT_CODE:N})}),console.log("[DEBUG optionalStock params]",JSON.stringify(f,null,2))}else a?f=Object.assign({},r,{arguments:Object.assign({},r?.arguments||{},{key:i})}):f=r;let h=bt.userCode||rn(i)||"";return new Promise((g,p)=>{let y=JSON.stringify({jsonrpc:"2.0",id:2,method:t,params:f});console.log("adeline-url",e);let m=new URL(e),_=e.includes("optionalStock")?"miniprogram":"Xclow_skills",N={hostname:m.hostname,port:m.port||443,path:m.pathname,method:"POST",headers:{"Content-Type":"application/json","skill-name":"lingxi-realtimemarketdata-skill","Content-Length":Buffer.byteLength(y),version:"1.0.0",platform:_,...u?{"jwt-assertion":i,usercode:h}:{},...c?{channel:ea}:{},...n},rejectUnauthorized:!0},S=Ws.request(N,A=>{let C="";A.on("data",T=>{C+=T}),A.on("end",()=>{try{g(JSON.parse(C))}catch{p(new Error(`\u89E3\u6790\u54CD\u5E94\u5931\u8D25: ${C}`))}})});S.on("error",p),S.write(y),S.end()})}nn.exports={sendJsonRpcRequest:ta}});var Pt=d((Su,an)=>{var Pu=require("fs"),{loadGateways:ra}=Je(),{sendJsonRpcRequest:na}=It(),oa=ke(),{saveApiKey:ia,getApiKey:sa,getJwtTokenFromApiKey:ku,parseUserCodeFromJwt:Bu}=ye();function aa(e){let t=String(e||"").trim();if(!t)return null;try{return JSON.parse(t)}catch{let n=t.replace(/"bgStatus"\s*:\s*,/g,'"bgStatus": null,');return JSON.parse(n)}}function la(e,t){let r=String(e||"").trim(),n=String(t||"").trim();return!r||!n?"":`${r}||${n}`}function on(e){if(!e||typeof e!="object")return"";let t=[e?.data?.tokenList?.[0],e?.data,e?.result?.data?.tokenList?.[0],e?.result?.data,e?.tokenList?.[0],e];for(let r of t){let n=la(r?.tokenSerialNo,r?.userToken);if(n)return n}return""}function ca(e){let t=on(e);if(t)return t;let r=Array.isArray(e?.result?.content)?e.result.content:[];for(let n of r){let o=aa(n?.text),i=on(o);if(i)return i}throw new Error(`get-token \u672A\u8FD4\u56DE tokenSerialNo/userToken: ${JSON.stringify(e)}`)}function sn(e){return(async()=>{try{let t="mqtt",r=ra(),n=r[t];if(!n)throw new Error(`\u672A\u77E5\u7F51\u5173: ${t}\uFF0C\u53EF\u7528\u7F51\u5173: ${Object.keys(r).join(", ")}`);let i={name:"get-token",arguments:{openDeviceId:e||oa.deviceId||"",pageNo:"1",pageSize:"1",mobileUserCode:"0",accountNo:"",accType:""}};console.log(JSON.stringify(i));let s=await na(n,"tools/call",i,{},{includeKeyParam:!1,includeJwtHeaders:!1,includeChannelHeader:!1});return ca(s)}catch(t){throw new Error(`\u67E5\u8BE2key\u5931\u8D25: ${t.message}`)}})()}async function ua(e,t){return sn(t)}function fa(){let e=["queryKeyFromClawServer(deviceId)","queryViaProxy(proxyUrl, deviceId)","saveApiKey(apiKey)","getApiKey()"];console.log("common.js \u53EF\u7528\u65B9\u6CD5:"),e.forEach(t=>console.log(`- ${t}`))}an.exports={queryKeyFromClawServer:sn,queryViaProxy:ua,saveApiKey:ia,getApiKey:sa,printCommonMethods:fa}});var kt=d((Ru,ln)=>{ln.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var V=d(se=>{var Bt,ha=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];se.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};se.getSymbolTotalCodewords=function(t){return ha[t]};se.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};se.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');Bt=t};se.isKanjiModeEnabled=function(){return typeof Bt<"u"};se.toSJIS=function(t){return Bt(t)}});var Ve=d(O=>{O.L={bit:1};O.M={bit:0};O.Q={bit:3};O.H={bit:2};function da(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return O.L;case"m":case"medium":return O.M;case"q":case"quartile":return O.Q;case"h":case"high":return O.H;default:throw new Error("Unknown EC Level: "+e)}}O.isValid=function(t){return t&&typeof t.bit<"u"&&t.bit>=0&&t.bit<4};O.from=function(t,r){if(O.isValid(t))return t;try{return da(t)}catch{return r}}});var fn=d((Nu,un)=>{function cn(){this.buffer=[],this.length=0}cn.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let r=0;r<t;r++)this.putBit((e>>>t-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};un.exports=cn});var dn=d((Mu,hn)=>{function Be(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}Be.prototype.set=function(e,t,r,n){let o=e*this.size+t;this.data[o]=r,n&&(this.reservedBit[o]=!0)};Be.prototype.get=function(e,t){return this.data[e*this.size+t]};Be.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r};Be.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};hn.exports=Be});var gn=d(We=>{var ga=V().getSymbolSize;We.getRowColCoords=function(t){if(t===1)return[];let r=Math.floor(t/7)+2,n=ga(t),o=n===145?26:Math.ceil((n-13)/(2*r-2))*2,i=[n-7];for(let s=1;s<r-1;s++)i[s]=i[s-1]-o;return i.push(6),i.reverse()};We.getPositions=function(t){let r=[],n=We.getRowColCoords(t),o=n.length;for(let i=0;i<o;i++)for(let s=0;s<o;s++)i===0&&s===0||i===0&&s===o-1||i===o-1&&s===0||r.push([n[i],n[s]]);return r}});var yn=d(mn=>{var pa=V().getSymbolSize,pn=7;mn.getPositions=function(t){let r=pa(t);return[[0,0],[r-pn,0],[0,r-pn]]}});var _n=d(E=>{E.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var ae={N1:3,N2:3,N3:40,N4:10};E.isValid=function(t){return t!=null&&t!==""&&!isNaN(t)&&t>=0&&t<=7};E.from=function(t){return E.isValid(t)?parseInt(t,10):void 0};E.getPenaltyN1=function(t){let r=t.size,n=0,o=0,i=0,s=null,a=null;for(let l=0;l<r;l++){o=i=0,s=a=null;for(let c=0;c<r;c++){let u=t.get(l,c);u===s?o++:(o>=5&&(n+=ae.N1+(o-5)),s=u,o=1),u=t.get(c,l),u===a?i++:(i>=5&&(n+=ae.N1+(i-5)),a=u,i=1)}o>=5&&(n+=ae.N1+(o-5)),i>=5&&(n+=ae.N1+(i-5))}return n};E.getPenaltyN2=function(t){let r=t.size,n=0;for(let o=0;o<r-1;o++)for(let i=0;i<r-1;i++){let s=t.get(o,i)+t.get(o,i+1)+t.get(o+1,i)+t.get(o+1,i+1);(s===4||s===0)&&n++}return n*ae.N2};E.getPenaltyN3=function(t){let r=t.size,n=0,o=0,i=0;for(let s=0;s<r;s++){o=i=0;for(let a=0;a<r;a++)o=o<<1&2047|t.get(s,a),a>=10&&(o===1488||o===93)&&n++,i=i<<1&2047|t.get(a,s),a>=10&&(i===1488||i===93)&&n++}return n*ae.N3};E.getPenaltyN4=function(t){let r=0,n=t.data.length;for(let i=0;i<n;i++)r+=t.data[i];return Math.abs(Math.ceil(r*100/n/5)-10)*ae.N4};function ma(e,t,r){switch(e){case E.Patterns.PATTERN000:return(t+r)%2===0;case E.Patterns.PATTERN001:return t%2===0;case E.Patterns.PATTERN010:return r%3===0;case E.Patterns.PATTERN011:return(t+r)%3===0;case E.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2===0;case E.Patterns.PATTERN101:return t*r%2+t*r%3===0;case E.Patterns.PATTERN110:return(t*r%2+t*r%3)%2===0;case E.Patterns.PATTERN111:return(t*r%3+(t+r)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}}E.applyMask=function(t,r){let n=r.size;for(let o=0;o<n;o++)for(let i=0;i<n;i++)r.isReserved(i,o)||r.xor(i,o,ma(t,i,o))};E.getBestMask=function(t,r){let n=Object.keys(E.Patterns).length,o=0,i=1/0;for(let s=0;s<n;s++){r(s),E.applyMask(s,t);let a=E.getPenaltyN1(t)+E.getPenaltyN2(t)+E.getPenaltyN3(t)+E.getPenaltyN4(t);E.applyMask(s,t),a<i&&(i=a,o=s)}return o}});var Rt=d(St=>{var W=Ve(),Ze=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Xe=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];St.getBlocksCount=function(t,r){switch(r){case W.L:return Ze[(t-1)*4+0];case W.M:return Ze[(t-1)*4+1];case W.Q:return Ze[(t-1)*4+2];case W.H:return Ze[(t-1)*4+3];default:return}};St.getTotalCodewordsCount=function(t,r){switch(r){case W.L:return Xe[(t-1)*4+0];case W.M:return Xe[(t-1)*4+1];case W.Q:return Xe[(t-1)*4+2];case W.H:return Xe[(t-1)*4+3];default:return}}});var wn=d(tt=>{var Se=new Uint8Array(512),et=new Uint8Array(256);(function(){let t=1;for(let r=0;r<255;r++)Se[r]=t,et[t]=r,t<<=1,t&256&&(t^=285);for(let r=255;r<512;r++)Se[r]=Se[r-255]})();tt.log=function(t){if(t<1)throw new Error("log("+t+")");return et[t]};tt.exp=function(t){return Se[t]};tt.mul=function(t,r){return t===0||r===0?0:Se[et[t]+et[r]]}});var An=d(Re=>{var Lt=wn();Re.mul=function(t,r){let n=new Uint8Array(t.length+r.length-1);for(let o=0;o<t.length;o++)for(let i=0;i<r.length;i++)n[o+i]^=Lt.mul(t[o],r[i]);return n};Re.mod=function(t,r){let n=new Uint8Array(t);for(;n.length-r.length>=0;){let o=n[0];for(let s=0;s<r.length;s++)n[s]^=Lt.mul(r[s],o);let i=0;for(;i<n.length&&n[i]===0;)i++;n=n.slice(i)}return n};Re.generateECPolynomial=function(t){let r=new Uint8Array([1]);for(let n=0;n<t;n++)r=Re.mul(r,new Uint8Array([1,Lt.exp(n)]));return r}});var Tn=d((Hu,Cn)=>{var En=An();function vt(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}vt.prototype.initialize=function(t){this.degree=t,this.genPoly=En.generateECPolynomial(this.degree)};vt.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(t.length+this.degree);r.set(t);let n=En.mod(r,this.genPoly),o=this.degree-n.length;if(o>0){let i=new Uint8Array(this.degree);return i.set(n,o),i}return n};Cn.exports=vt});var Nt=d(bn=>{bn.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}});var Mt=d(z=>{var In="[0-9]+",ya="[A-Z $%*+\\-./:]+",Le="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Le=Le.replace(/u/g,"\\u");var _a="(?:(?![A-Z0-9 $%*+\\-./:]|"+Le+`)(?:.|[\r
]))+`;z.KANJI=new RegExp(Le,"g");z.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");z.BYTE=new RegExp(_a,"g");z.NUMERIC=new RegExp(In,"g");z.ALPHANUMERIC=new RegExp(ya,"g");var wa=new RegExp("^"+Le+"$"),Aa=new RegExp("^"+In+"$"),Ea=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");z.testKanji=function(t){return wa.test(t)};z.testNumeric=function(t){return Aa.test(t)};z.testAlphanumeric=function(t){return Ea.test(t)}});var Z=d(b=>{var Ca=Nt(),Ot=Mt();b.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};b.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};b.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};b.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};b.MIXED={bit:-1};b.getCharCountIndicator=function(t,r){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!Ca.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?t.ccBits[0]:r<27?t.ccBits[1]:t.ccBits[2]};b.getBestModeForData=function(t){return Ot.testNumeric(t)?b.NUMERIC:Ot.testAlphanumeric(t)?b.ALPHANUMERIC:Ot.testKanji(t)?b.KANJI:b.BYTE};b.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")};b.isValid=function(t){return t&&t.bit&&t.ccBits};function Ta(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return b.NUMERIC;case"alphanumeric":return b.ALPHANUMERIC;case"kanji":return b.KANJI;case"byte":return b.BYTE;default:throw new Error("Unknown mode: "+e)}}b.from=function(t,r){if(b.isValid(t))return t;try{return Ta(t)}catch{return r}}});var Rn=d(le=>{var rt=V(),ba=Rt(),Pn=Ve(),X=Z(),xt=Nt(),Bn=7973,kn=rt.getBCHDigit(Bn);function Ia(e,t,r){for(let n=1;n<=40;n++)if(t<=le.getCapacity(n,r,e))return n}function Sn(e,t){return X.getCharCountIndicator(e,t)+4}function Pa(e,t){let r=0;return e.forEach(function(n){let o=Sn(n.mode,t);r+=o+n.getBitsLength()}),r}function ka(e,t){for(let r=1;r<=40;r++)if(Pa(e,r)<=le.getCapacity(r,t,X.MIXED))return r}le.from=function(t,r){return xt.isValid(t)?parseInt(t,10):r};le.getCapacity=function(t,r,n){if(!xt.isValid(t))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=X.BYTE);let o=rt.getSymbolTotalCodewords(t),i=ba.getTotalCodewordsCount(t,r),s=(o-i)*8;if(n===X.MIXED)return s;let a=s-Sn(n,t);switch(n){case X.NUMERIC:return Math.floor(a/10*3);case X.ALPHANUMERIC:return Math.floor(a/11*2);case X.KANJI:return Math.floor(a/13);case X.BYTE:default:return Math.floor(a/8)}};le.getBestVersionForData=function(t,r){let n,o=Pn.from(r,Pn.M);if(Array.isArray(t)){if(t.length>1)return ka(t,o);if(t.length===0)return 1;n=t[0]}else n=t;return Ia(n.mode,n.getLength(),o)};le.getEncodedBits=function(t){if(!xt.isValid(t)||t<7)throw new Error("Invalid QR Code version");let r=t<<12;for(;rt.getBCHDigit(r)-kn>=0;)r^=Bn<<rt.getBCHDigit(r)-kn;return t<<12|r}});var Mn=d(Nn=>{var Dt=V(),vn=1335,Ba=21522,Ln=Dt.getBCHDigit(vn);Nn.getEncodedBits=function(t,r){let n=t.bit<<3|r,o=n<<10;for(;Dt.getBCHDigit(o)-Ln>=0;)o^=vn<<Dt.getBCHDigit(o)-Ln;return(n<<10|o)^Ba}});var xn=d((zu,On)=>{var Sa=Z();function _e(e){this.mode=Sa.NUMERIC,this.data=e.toString()}_e.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};_e.prototype.getLength=function(){return this.data.length};_e.prototype.getBitsLength=function(){return _e.getBitsLength(this.data.length)};_e.prototype.write=function(t){let r,n,o;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),o=parseInt(n,10),t.put(o,10);let i=this.data.length-r;i>0&&(n=this.data.substr(r),o=parseInt(n,10),t.put(o,i*3+1))};On.exports=_e});var qn=d((Ju,Dn)=>{var Ra=Z(),qt=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function we(e){this.mode=Ra.ALPHANUMERIC,this.data=e}we.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};we.prototype.getLength=function(){return this.data.length};we.prototype.getBitsLength=function(){return we.getBitsLength(this.data.length)};we.prototype.write=function(t){let r;for(r=0;r+2<=this.data.length;r+=2){let n=qt.indexOf(this.data[r])*45;n+=qt.indexOf(this.data[r+1]),t.put(n,11)}this.data.length%2&&t.put(qt.indexOf(this.data[r]),6)};Dn.exports=we});var Un=d((Qu,Fn)=>{var La=Z();function Ae(e){this.mode=La.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}Ae.getBitsLength=function(t){return t*8};Ae.prototype.getLength=function(){return this.data.length};Ae.prototype.getBitsLength=function(){return Ae.getBitsLength(this.data.length)};Ae.prototype.write=function(e){for(let t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)};Fn.exports=Ae});var Kn=d((Vu,Hn)=>{var va=Z(),Na=V();function Ee(e){this.mode=va.KANJI,this.data=e}Ee.getBitsLength=function(t){return t*13};Ee.prototype.getLength=function(){return this.data.length};Ee.prototype.getBitsLength=function(){return Ee.getBitsLength(this.data.length)};Ee.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let r=Na.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),e.put(r,13)}};Hn.exports=Ee});var $n=d((Wu,Ft)=>{"use strict";var ve={single_source_shortest_paths:function(e,t,r){var n={},o={};o[t]=0;var i=ve.PriorityQueue.make();i.push(t,0);for(var s,a,l,c,u,f,h,g,p;!i.empty();){s=i.pop(),a=s.value,c=s.cost,u=e[a]||{};for(l in u)u.hasOwnProperty(l)&&(f=u[l],h=c+f,g=o[l],p=typeof o[l]>"u",(p||g>h)&&(o[l]=h,i.push(l,h),n[l]=a))}if(typeof r<"u"&&typeof o[r]>"u"){var y=["Could not find a path from ",t," to ",r,"."].join("");throw new Error(y)}return n},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t,o;n;)r.push(n),o=e[n],n=e[n];return r.reverse(),r},find_path:function(e,t,r){var n=ve.single_source_shortest_paths(e,t,r);return ve.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(e){var t=ve.PriorityQueue,r={},n;e=e||{};for(n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof Ft<"u"&&(Ft.exports=ve)});var Wn=d(Ce=>{var w=Z(),Gn=xn(),zn=qn(),Jn=Un(),Qn=Kn(),Ne=Mt(),nt=V(),Ma=$n();function Yn(e){return unescape(encodeURIComponent(e)).length}function Me(e,t,r){let n=[],o;for(;(o=e.exec(r))!==null;)n.push({data:o[0],index:o.index,mode:t,length:o[0].length});return n}function Vn(e){let t=Me(Ne.NUMERIC,w.NUMERIC,e),r=Me(Ne.ALPHANUMERIC,w.ALPHANUMERIC,e),n,o;return nt.isKanjiModeEnabled()?(n=Me(Ne.BYTE,w.BYTE,e),o=Me(Ne.KANJI,w.KANJI,e)):(n=Me(Ne.BYTE_KANJI,w.BYTE,e),o=[]),t.concat(r,n,o).sort(function(s,a){return s.index-a.index}).map(function(s){return{data:s.data,mode:s.mode,length:s.length}})}function Ut(e,t){switch(t){case w.NUMERIC:return Gn.getBitsLength(e);case w.ALPHANUMERIC:return zn.getBitsLength(e);case w.KANJI:return Qn.getBitsLength(e);case w.BYTE:return Jn.getBitsLength(e)}}function Oa(e){return e.reduce(function(t,r){let n=t.length-1>=0?t[t.length-1]:null;return n&&n.mode===r.mode?(t[t.length-1].data+=r.data,t):(t.push(r),t)},[])}function xa(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r];switch(n.mode){case w.NUMERIC:t.push([n,{data:n.data,mode:w.ALPHANUMERIC,length:n.length},{data:n.data,mode:w.BYTE,length:n.length}]);break;case w.ALPHANUMERIC:t.push([n,{data:n.data,mode:w.BYTE,length:n.length}]);break;case w.KANJI:t.push([n,{data:n.data,mode:w.BYTE,length:Yn(n.data)}]);break;case w.BYTE:t.push([{data:n.data,mode:w.BYTE,length:Yn(n.data)}])}}return t}function Da(e,t){let r={},n={start:{}},o=["start"];for(let i=0;i<e.length;i++){let s=e[i],a=[];for(let l=0;l<s.length;l++){let c=s[l],u=""+i+l;a.push(u),r[u]={node:c,lastCount:0},n[u]={};for(let f=0;f<o.length;f++){let h=o[f];r[h]&&r[h].node.mode===c.mode?(n[h][u]=Ut(r[h].lastCount+c.length,c.mode)-Ut(r[h].lastCount,c.mode),r[h].lastCount+=c.length):(r[h]&&(r[h].lastCount=c.length),n[h][u]=Ut(c.length,c.mode)+4+w.getCharCountIndicator(c.mode,t))}}o=a}for(let i=0;i<o.length;i++)n[o[i]].end=0;return{map:n,table:r}}function jn(e,t){let r,n=w.getBestModeForData(e);if(r=w.from(t,n),r!==w.BYTE&&r.bit<n.bit)throw new Error('"'+e+'" cannot be encoded with mode '+w.toString(r)+`.
 Suggested mode is: `+w.toString(n));switch(r===w.KANJI&&!nt.isKanjiModeEnabled()&&(r=w.BYTE),r){case w.NUMERIC:return new Gn(e);case w.ALPHANUMERIC:return new zn(e);case w.KANJI:return new Qn(e);case w.BYTE:return new Jn(e)}}Ce.fromArray=function(t){return t.reduce(function(r,n){return typeof n=="string"?r.push(jn(n,null)):n.data&&r.push(jn(n.data,n.mode)),r},[])};Ce.fromString=function(t,r){let n=Vn(t,nt.isKanjiModeEnabled()),o=xa(n),i=Da(o,r),s=Ma.find_path(i.map,"start","end"),a=[];for(let l=1;l<s.length-1;l++)a.push(i.table[s[l]].node);return Ce.fromArray(Oa(a))};Ce.rawSplit=function(t){return Ce.fromArray(Vn(t,nt.isKanjiModeEnabled()))}});var Gt=d(Zn=>{var it=V(),Ht=Ve(),qa=fn(),Fa=dn(),Ua=gn(),Ha=yn(),Yt=_n(),jt=Rt(),Ka=Tn(),ot=Rn(),$a=Mn(),Ya=Z(),Kt=Wn();function ja(e,t){let r=e.size,n=Ha.getPositions(t);for(let o=0;o<n.length;o++){let i=n[o][0],s=n[o][1];for(let a=-1;a<=7;a++)if(!(i+a<=-1||r<=i+a))for(let l=-1;l<=7;l++)s+l<=-1||r<=s+l||(a>=0&&a<=6&&(l===0||l===6)||l>=0&&l<=6&&(a===0||a===6)||a>=2&&a<=4&&l>=2&&l<=4?e.set(i+a,s+l,!0,!0):e.set(i+a,s+l,!1,!0))}}function Ga(e){let t=e.size;for(let r=8;r<t-8;r++){let n=r%2===0;e.set(r,6,n,!0),e.set(6,r,n,!0)}}function za(e,t){let r=Ua.getPositions(t);for(let n=0;n<r.length;n++){let o=r[n][0],i=r[n][1];for(let s=-2;s<=2;s++)for(let a=-2;a<=2;a++)s===-2||s===2||a===-2||a===2||s===0&&a===0?e.set(o+s,i+a,!0,!0):e.set(o+s,i+a,!1,!0)}}function Ja(e,t){let r=e.size,n=ot.getEncodedBits(t),o,i,s;for(let a=0;a<18;a++)o=Math.floor(a/3),i=a%3+r-8-3,s=(n>>a&1)===1,e.set(o,i,s,!0),e.set(i,o,s,!0)}function $t(e,t,r){let n=e.size,o=$a.getEncodedBits(t,r),i,s;for(i=0;i<15;i++)s=(o>>i&1)===1,i<6?e.set(i,8,s,!0):i<8?e.set(i+1,8,s,!0):e.set(n-15+i,8,s,!0),i<8?e.set(8,n-i-1,s,!0):i<9?e.set(8,15-i-1+1,s,!0):e.set(8,15-i-1,s,!0);e.set(n-8,8,1,!0)}function Qa(e,t){let r=e.size,n=-1,o=r-1,i=7,s=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let l=0;l<2;l++)if(!e.isReserved(o,a-l)){let c=!1;s<t.length&&(c=(t[s]>>>i&1)===1),e.set(o,a-l,c),i--,i===-1&&(s++,i=7)}if(o+=n,o<0||r<=o){o-=n,n=-n;break}}}function Va(e,t,r){let n=new qa;r.forEach(function(l){n.put(l.mode.bit,4),n.put(l.getLength(),Ya.getCharCountIndicator(l.mode,e)),l.write(n)});let o=it.getSymbolTotalCodewords(e),i=jt.getTotalCodewordsCount(e,t),s=(o-i)*8;for(n.getLengthInBits()+4<=s&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(s-n.getLengthInBits())/8;for(let l=0;l<a;l++)n.put(l%2?17:236,8);return Wa(n,e,t)}function Wa(e,t,r){let n=it.getSymbolTotalCodewords(t),o=jt.getTotalCodewordsCount(t,r),i=n-o,s=jt.getBlocksCount(t,r),a=n%s,l=s-a,c=Math.floor(n/s),u=Math.floor(i/s),f=u+1,h=c-u,g=new Ka(h),p=0,y=new Array(s),m=new Array(s),_=0,N=new Uint8Array(e.buffer);for(let M=0;M<s;M++){let ge=M<l?u:f;y[M]=N.slice(p,p+ge),m[M]=g.encode(y[M]),p+=ge,_=Math.max(_,ge)}let S=new Uint8Array(n),A=0,C,T;for(C=0;C<_;C++)for(T=0;T<s;T++)C<y[T].length&&(S[A++]=y[T][C]);for(C=0;C<h;C++)for(T=0;T<s;T++)S[A++]=m[T][C];return S}function Za(e,t,r,n){let o;if(Array.isArray(e))o=Kt.fromArray(e);else if(typeof e=="string"){let c=t;if(!c){let u=Kt.rawSplit(e);c=ot.getBestVersionForData(u,r)}o=Kt.fromString(e,c||40)}else throw new Error("Invalid data");let i=ot.getBestVersionForData(o,r);if(!i)throw new Error("The amount of data is too big to be stored in a QR Code");if(!t)t=i;else if(t<i)throw new Error(`
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: `+i+`.
`);let s=Va(t,r,o),a=it.getSymbolSize(t),l=new Fa(a);return ja(l,t),Ga(l),za(l,t),$t(l,r,0),t>=7&&Ja(l,t),Qa(l,s),isNaN(n)&&(n=Yt.getBestMask(l,$t.bind(null,l,r))),Yt.applyMask(n,l),$t(l,r,n),{modules:l,version:t,errorCorrectionLevel:r,maskPattern:n,segments:o}}Zn.create=function(t,r){if(typeof t>"u"||t==="")throw new Error("No input text");let n=Ht.M,o,i;return typeof r<"u"&&(n=Ht.from(r.errorCorrectionLevel,Ht.M),o=ot.from(r.version),i=Yt.from(r.maskPattern),r.toSJISFunc&&it.setToSJISFunction(r.toSJISFunc)),Za(t,o,n,i)}});var zt=d((ef,eo)=>{"use strict";var Xa=require("util"),Xn=require("stream"),q=eo.exports=function(){Xn.call(this),this._buffers=[],this._buffered=0,this._reads=[],this._paused=!1,this._encoding="utf8",this.writable=!0};Xa.inherits(q,Xn);q.prototype.read=function(e,t){this._reads.push({length:Math.abs(e),allowLess:e<0,func:t}),process.nextTick(function(){this._process(),this._paused&&this._reads&&this._reads.length>0&&(this._paused=!1,this.emit("drain"))}.bind(this))};q.prototype.write=function(e,t){if(!this.writable)return this.emit("error",new Error("Stream not writable")),!1;let r;return Buffer.isBuffer(e)?r=e:r=Buffer.from(e,t||this._encoding),this._buffers.push(r),this._buffered+=r.length,this._process(),this._reads&&this._reads.length===0&&(this._paused=!0),this.writable&&!this._paused};q.prototype.end=function(e,t){e&&this.write(e,t),this.writable=!1,this._buffers&&(this._buffers.length===0?this._end():(this._buffers.push(null),this._process()))};q.prototype.destroySoon=q.prototype.end;q.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("Unexpected end of input")),this.destroy()};q.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))};q.prototype._processReadAllowingLess=function(e){this._reads.shift();let t=this._buffers[0];t.length>e.length?(this._buffered-=e.length,this._buffers[0]=t.slice(e.length),e.func.call(this,t.slice(0,e.length))):(this._buffered-=t.length,this._buffers.shift(),e.func.call(this,t))};q.prototype._processRead=function(e){this._reads.shift();let t=0,r=0,n=Buffer.alloc(e.length);for(;t<e.length;){let o=this._buffers[r++],i=Math.min(o.length,e.length-t);o.copy(n,t,0,i),t+=i,i!==o.length&&(this._buffers[--r]=o.slice(i))}r>0&&this._buffers.splice(0,r),this._buffered-=e.length,e.func.call(this,n)};q.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){let e=this._reads[0];if(e.allowLess)this._processReadAllowingLess(e);else if(this._buffered>=e.length)this._processRead(e);else break}this._buffers&&!this.writable&&this._end()}catch(e){this.emit("error",e)}}});var Qt=d(Jt=>{"use strict";var ee=[{x:[0],y:[0]},{x:[4],y:[0]},{x:[0,4],y:[4]},{x:[2,6],y:[0,4]},{x:[0,2,4,6],y:[2,6]},{x:[1,3,5,7],y:[0,2,4,6]},{x:[0,1,2,3,4,5,6,7],y:[1,3,5,7]}];Jt.getImagePasses=function(e,t){let r=[],n=e%8,o=t%8,i=(e-n)/8,s=(t-o)/8;for(let a=0;a<ee.length;a++){let l=ee[a],c=i*l.x.length,u=s*l.y.length;for(let f=0;f<l.x.length&&l.x[f]<n;f++)c++;for(let f=0;f<l.y.length&&l.y[f]<o;f++)u++;c>0&&u>0&&r.push({width:c,height:u,index:a})}return r};Jt.getInterlaceIterator=function(e){return function(t,r,n){let o=t%ee[n].x.length,i=(t-o)/ee[n].x.length*8+ee[n].x[o],s=r%ee[n].y.length,a=(r-s)/ee[n].y.length*8+ee[n].y[s];return i*4+a*e*4}}});var Vt=d((rf,to)=>{"use strict";to.exports=function(t,r,n){let o=t+r-n,i=Math.abs(o-t),s=Math.abs(o-r),a=Math.abs(o-n);return i<=s&&i<=a?t:s<=a?r:n}});var Wt=d((nf,no)=>{"use strict";var el=Qt(),tl=Vt();function ro(e,t,r){let n=e*t;return r!==8&&(n=Math.ceil(n/(8/r))),n}var Te=no.exports=function(e,t){let r=e.width,n=e.height,o=e.interlace,i=e.bpp,s=e.depth;if(this.read=t.read,this.write=t.write,this.complete=t.complete,this._imageIndex=0,this._images=[],o){let a=el.getImagePasses(r,n);for(let l=0;l<a.length;l++)this._images.push({byteWidth:ro(a[l].width,i,s),height:a[l].height,lineIndex:0})}else this._images.push({byteWidth:ro(r,i,s),height:n,lineIndex:0});s===8?this._xComparison=i:s===16?this._xComparison=i*2:this._xComparison=1};Te.prototype.start=function(){this.read(this._images[this._imageIndex].byteWidth+1,this._reverseFilterLine.bind(this))};Te.prototype._unFilterType1=function(e,t,r){let n=this._xComparison,o=n-1;for(let i=0;i<r;i++){let s=e[1+i],a=i>o?t[i-n]:0;t[i]=s+a}};Te.prototype._unFilterType2=function(e,t,r){let n=this._lastLine;for(let o=0;o<r;o++){let i=e[1+o],s=n?n[o]:0;t[o]=i+s}};Te.prototype._unFilterType3=function(e,t,r){let n=this._xComparison,o=n-1,i=this._lastLine;for(let s=0;s<r;s++){let a=e[1+s],l=i?i[s]:0,c=s>o?t[s-n]:0,u=Math.floor((c+l)/2);t[s]=a+u}};Te.prototype._unFilterType4=function(e,t,r){let n=this._xComparison,o=n-1,i=this._lastLine;for(let s=0;s<r;s++){let a=e[1+s],l=i?i[s]:0,c=s>o?t[s-n]:0,u=s>o&&i?i[s-n]:0,f=tl(c,l,u);t[s]=a+f}};Te.prototype._reverseFilterLine=function(e){let t=e[0],r,n=this._images[this._imageIndex],o=n.byteWidth;if(t===0)r=e.slice(1,o+1);else switch(r=Buffer.alloc(o),t){case 1:this._unFilterType1(e,r,o);break;case 2:this._unFilterType2(e,r,o);break;case 3:this._unFilterType3(e,r,o);break;case 4:this._unFilterType4(e,r,o);break;default:throw new Error("Unrecognised filter type - "+t)}this.write(r),n.lineIndex++,n.lineIndex>=n.height?(this._lastLine=null,this._imageIndex++,n=this._images[this._imageIndex]):this._lastLine=r,n?this.read(n.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}});var so=d((of,io)=>{"use strict";var rl=require("util"),oo=zt(),nl=Wt(),ol=io.exports=function(e){oo.call(this);let t=[],r=this;this._filter=new nl(e,{read:this.read.bind(this),write:function(n){t.push(n)},complete:function(){r.emit("complete",Buffer.concat(t))}}),this._filter.start()};rl.inherits(ol,oo)});var be=d((sf,ao)=>{"use strict";ao.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}});var er=d((af,lo)=>{"use strict";var Zt=[];(function(){for(let e=0;e<256;e++){let t=e;for(let r=0;r<8;r++)t&1?t=3988292384^t>>>1:t=t>>>1;Zt[e]=t}})();var Xt=lo.exports=function(){this._crc=-1};Xt.prototype.write=function(e){for(let t=0;t<e.length;t++)this._crc=Zt[(this._crc^e[t])&255]^this._crc>>>8;return!0};Xt.prototype.crc32=function(){return this._crc^-1};Xt.crc32=function(e){let t=-1;for(let r=0;r<e.length;r++)t=Zt[(t^e[r])&255]^t>>>8;return t^-1}});var tr=d((lf,co)=>{"use strict";var P=be(),il=er(),k=co.exports=function(e,t){this._options=e,e.checkCRC=e.checkCRC!==!1,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[P.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[P.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[P.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[P.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[P.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[P.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=t.read,this.error=t.error,this.metadata=t.metadata,this.gamma=t.gamma,this.transColor=t.transColor,this.palette=t.palette,this.parsed=t.parsed,this.inflateData=t.inflateData,this.finished=t.finished,this.simpleTransparency=t.simpleTransparency,this.headersFinished=t.headersFinished||function(){}};k.prototype.start=function(){this.read(P.PNG_SIGNATURE.length,this._parseSignature.bind(this))};k.prototype._parseSignature=function(e){let t=P.PNG_SIGNATURE;for(let r=0;r<t.length;r++)if(e[r]!==t[r]){this.error(new Error("Invalid file signature"));return}this.read(8,this._parseChunkBegin.bind(this))};k.prototype._parseChunkBegin=function(e){let t=e.readUInt32BE(0),r=e.readUInt32BE(4),n="";for(let i=4;i<8;i++)n+=String.fromCharCode(e[i]);let o=!!(e[4]&32);if(!this._hasIHDR&&r!==P.TYPE_IHDR){this.error(new Error("Expected IHDR on beggining"));return}if(this._crc=new il,this._crc.write(Buffer.from(n)),this._chunks[r])return this._chunks[r](t);if(!o){this.error(new Error("Unsupported critical chunk type "+n));return}this.read(t+4,this._skipChunk.bind(this))};k.prototype._skipChunk=function(){this.read(8,this._parseChunkBegin.bind(this))};k.prototype._handleChunkEnd=function(){this.read(4,this._parseChunkEnd.bind(this))};k.prototype._parseChunkEnd=function(e){let t=e.readInt32BE(0),r=this._crc.crc32();if(this._options.checkCRC&&r!==t){this.error(new Error("Crc error - "+t+" - "+r));return}this._hasIEND||this.read(8,this._parseChunkBegin.bind(this))};k.prototype._handleIHDR=function(e){this.read(e,this._parseIHDR.bind(this))};k.prototype._parseIHDR=function(e){this._crc.write(e);let t=e.readUInt32BE(0),r=e.readUInt32BE(4),n=e[8],o=e[9],i=e[10],s=e[11],a=e[12];if(n!==8&&n!==4&&n!==2&&n!==1&&n!==16){this.error(new Error("Unsupported bit depth "+n));return}if(!(o in P.COLORTYPE_TO_BPP_MAP)){this.error(new Error("Unsupported color type"));return}if(i!==0){this.error(new Error("Unsupported compression method"));return}if(s!==0){this.error(new Error("Unsupported filter method"));return}if(a!==0&&a!==1){this.error(new Error("Unsupported interlace method"));return}this._colorType=o;let l=P.COLORTYPE_TO_BPP_MAP[this._colorType];this._hasIHDR=!0,this.metadata({width:t,height:r,depth:n,interlace:!!a,palette:!!(o&P.COLORTYPE_PALETTE),color:!!(o&P.COLORTYPE_COLOR),alpha:!!(o&P.COLORTYPE_ALPHA),bpp:l,colorType:o}),this._handleChunkEnd()};k.prototype._handlePLTE=function(e){this.read(e,this._parsePLTE.bind(this))};k.prototype._parsePLTE=function(e){this._crc.write(e);let t=Math.floor(e.length/3);for(let r=0;r<t;r++)this._palette.push([e[r*3],e[r*3+1],e[r*3+2],255]);this.palette(this._palette),this._handleChunkEnd()};k.prototype._handleTRNS=function(e){this.simpleTransparency(),this.read(e,this._parseTRNS.bind(this))};k.prototype._parseTRNS=function(e){if(this._crc.write(e),this._colorType===P.COLORTYPE_PALETTE_COLOR){if(this._palette.length===0){this.error(new Error("Transparency chunk must be after palette"));return}if(e.length>this._palette.length){this.error(new Error("More transparent colors than palette size"));return}for(let t=0;t<e.length;t++)this._palette[t][3]=e[t];this.palette(this._palette)}this._colorType===P.COLORTYPE_GRAYSCALE&&this.transColor([e.readUInt16BE(0)]),this._colorType===P.COLORTYPE_COLOR&&this.transColor([e.readUInt16BE(0),e.readUInt16BE(2),e.readUInt16BE(4)]),this._handleChunkEnd()};k.prototype._handleGAMA=function(e){this.read(e,this._parseGAMA.bind(this))};k.prototype._parseGAMA=function(e){this._crc.write(e),this.gamma(e.readUInt32BE(0)/P.GAMMA_DIVISION),this._handleChunkEnd()};k.prototype._handleIDAT=function(e){this._emittedHeadersFinished||(this._emittedHeadersFinished=!0,this.headersFinished()),this.read(-e,this._parseIDAT.bind(this,e))};k.prototype._parseIDAT=function(e,t){if(this._crc.write(t),this._colorType===P.COLORTYPE_PALETTE_COLOR&&this._palette.length===0)throw new Error("Expected palette not found");this.inflateData(t);let r=e-t.length;r>0?this._handleIDAT(r):this._handleChunkEnd()};k.prototype._handleIEND=function(e){this.read(e,this._parseIEND.bind(this))};k.prototype._parseIEND=function(e){this._crc.write(e),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}});var rr=d(fo=>{"use strict";var uo=Qt(),sl=[function(){},function(e,t,r,n){if(n===t.length)throw new Error("Ran out of data");let o=t[n];e[r]=o,e[r+1]=o,e[r+2]=o,e[r+3]=255},function(e,t,r,n){if(n+1>=t.length)throw new Error("Ran out of data");let o=t[n];e[r]=o,e[r+1]=o,e[r+2]=o,e[r+3]=t[n+1]},function(e,t,r,n){if(n+2>=t.length)throw new Error("Ran out of data");e[r]=t[n],e[r+1]=t[n+1],e[r+2]=t[n+2],e[r+3]=255},function(e,t,r,n){if(n+3>=t.length)throw new Error("Ran out of data");e[r]=t[n],e[r+1]=t[n+1],e[r+2]=t[n+2],e[r+3]=t[n+3]}],al=[function(){},function(e,t,r,n){let o=t[0];e[r]=o,e[r+1]=o,e[r+2]=o,e[r+3]=n},function(e,t,r){let n=t[0];e[r]=n,e[r+1]=n,e[r+2]=n,e[r+3]=t[1]},function(e,t,r,n){e[r]=t[0],e[r+1]=t[1],e[r+2]=t[2],e[r+3]=n},function(e,t,r){e[r]=t[0],e[r+1]=t[1],e[r+2]=t[2],e[r+3]=t[3]}];function ll(e,t){let r=[],n=0;function o(){if(n===e.length)throw new Error("Ran out of data");let i=e[n];n++;let s,a,l,c,u,f,h,g;switch(t){default:throw new Error("unrecognised depth");case 16:h=e[n],n++,r.push((i<<8)+h);break;case 4:h=i&15,g=i>>4,r.push(g,h);break;case 2:u=i&3,f=i>>2&3,h=i>>4&3,g=i>>6&3,r.push(g,h,f,u);break;case 1:s=i&1,a=i>>1&1,l=i>>2&1,c=i>>3&1,u=i>>4&1,f=i>>5&1,h=i>>6&1,g=i>>7&1,r.push(g,h,f,u,c,l,a,s);break}}return{get:function(i){for(;r.length<i;)o();let s=r.slice(0,i);return r=r.slice(i),s},resetAfterLine:function(){r.length=0},end:function(){if(n!==e.length)throw new Error("extra data found")}}}function cl(e,t,r,n,o,i){let s=e.width,a=e.height,l=e.index;for(let c=0;c<a;c++)for(let u=0;u<s;u++){let f=r(u,c,l);sl[n](t,o,f,i),i+=n}return i}function ul(e,t,r,n,o,i){let s=e.width,a=e.height,l=e.index;for(let c=0;c<a;c++){for(let u=0;u<s;u++){let f=o.get(n),h=r(u,c,l);al[n](t,f,h,i)}o.resetAfterLine()}}fo.dataToBitMap=function(e,t){let r=t.width,n=t.height,o=t.depth,i=t.bpp,s=t.interlace,a;o!==8&&(a=ll(e,o));let l;o<=8?l=Buffer.alloc(r*n*4):l=new Uint16Array(r*n*4);let c=Math.pow(2,o)-1,u=0,f,h;if(s)f=uo.getImagePasses(r,n),h=uo.getInterlaceIterator(r,n);else{let g=0;h=function(){let p=g;return g+=4,p},f=[{width:r,height:n}]}for(let g=0;g<f.length;g++)o===8?u=cl(f[g],l,h,i,e,u):ul(f[g],l,h,i,a,c);if(o===8){if(u!==e.length)throw new Error("extra data found")}else a.end();return l}});var nr=d((uf,ho)=>{"use strict";function fl(e,t,r,n,o){let i=0;for(let s=0;s<n;s++)for(let a=0;a<r;a++){let l=o[e[i]];if(!l)throw new Error("index "+e[i]+" not in palette");for(let c=0;c<4;c++)t[i+c]=l[c];i+=4}}function hl(e,t,r,n,o){let i=0;for(let s=0;s<n;s++)for(let a=0;a<r;a++){let l=!1;if(o.length===1?o[0]===e[i]&&(l=!0):o[0]===e[i]&&o[1]===e[i+1]&&o[2]===e[i+2]&&(l=!0),l)for(let c=0;c<4;c++)t[i+c]=0;i+=4}}function dl(e,t,r,n,o){let i=255,s=Math.pow(2,o)-1,a=0;for(let l=0;l<n;l++)for(let c=0;c<r;c++){for(let u=0;u<4;u++)t[a+u]=Math.floor(e[a+u]*i/s+.5);a+=4}}ho.exports=function(e,t){let r=t.depth,n=t.width,o=t.height,i=t.colorType,s=t.transColor,a=t.palette,l=e;return i===3?fl(e,l,n,o,a):(s&&hl(e,l,n,o,s),r!==8&&(r===16&&(l=Buffer.alloc(n*o*4)),dl(e,l,n,o,r))),l}});var mo=d((ff,po)=>{"use strict";var gl=require("util"),or=require("zlib"),go=zt(),pl=so(),ml=tr(),yl=rr(),_l=nr(),$=po.exports=function(e){go.call(this),this._parser=new ml(e,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=e,this.writable=!0,this._parser.start()};gl.inherits($,go);$.prototype._handleError=function(e){this.emit("error",e),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",function(){})),this.errord=!0};$.prototype._inflateData=function(e){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=or.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{let r=((this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3)+1)*this._bitmapInfo.height,n=Math.max(r,or.Z_MIN_CHUNK);this._inflate=or.createInflate({chunkSize:n});let o=r,i=this.emit.bind(this,"error");this._inflate.on("error",function(a){o&&i(a)}),this._filter.on("complete",this._complete.bind(this));let s=this._filter.write.bind(this._filter);this._inflate.on("data",function(a){o&&(a.length>o&&(a=a.slice(0,o)),o-=a.length,s(a))}),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(e)};$.prototype._handleMetaData=function(e){this._metaData=e,this._bitmapInfo=Object.create(e),this._filter=new pl(this._bitmapInfo)};$.prototype._handleTransColor=function(e){this._bitmapInfo.transColor=e};$.prototype._handlePalette=function(e){this._bitmapInfo.palette=e};$.prototype._simpleTransparency=function(){this._metaData.alpha=!0};$.prototype._headersFinished=function(){this.emit("metadata",this._metaData)};$.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"))};$.prototype._complete=function(e){if(this.errord)return;let t;try{let r=yl.dataToBitMap(e,this._bitmapInfo);t=_l(r,this._bitmapInfo),r=null}catch(r){this._handleError(r);return}this.emit("parsed",t)}});var _o=d((hf,yo)=>{"use strict";var x=be();yo.exports=function(e,t,r,n){let o=[x.COLORTYPE_COLOR_ALPHA,x.COLORTYPE_ALPHA].indexOf(n.colorType)!==-1;if(n.colorType===n.inputColorType){let p=(function(){let y=new ArrayBuffer(2);return new DataView(y).setInt16(0,256,!0),new Int16Array(y)[0]!==256})();if(n.bitDepth===8||n.bitDepth===16&&p)return e}let i=n.bitDepth!==16?e:new Uint16Array(e.buffer),s=255,a=x.COLORTYPE_TO_BPP_MAP[n.inputColorType];a===4&&!n.inputHasAlpha&&(a=3);let l=x.COLORTYPE_TO_BPP_MAP[n.colorType];n.bitDepth===16&&(s=65535,l*=2);let c=Buffer.alloc(t*r*l),u=0,f=0,h=n.bgColor||{};h.red===void 0&&(h.red=s),h.green===void 0&&(h.green=s),h.blue===void 0&&(h.blue=s);function g(){let p,y,m,_=s;switch(n.inputColorType){case x.COLORTYPE_COLOR_ALPHA:_=i[u+3],p=i[u],y=i[u+1],m=i[u+2];break;case x.COLORTYPE_COLOR:p=i[u],y=i[u+1],m=i[u+2];break;case x.COLORTYPE_ALPHA:_=i[u+1],p=i[u],y=p,m=p;break;case x.COLORTYPE_GRAYSCALE:p=i[u],y=p,m=p;break;default:throw new Error("input color type:"+n.inputColorType+" is not supported at present")}return n.inputHasAlpha&&(o||(_/=s,p=Math.min(Math.max(Math.round((1-_)*h.red+_*p),0),s),y=Math.min(Math.max(Math.round((1-_)*h.green+_*y),0),s),m=Math.min(Math.max(Math.round((1-_)*h.blue+_*m),0),s))),{red:p,green:y,blue:m,alpha:_}}for(let p=0;p<r;p++)for(let y=0;y<t;y++){let m=g(i,u);switch(n.colorType){case x.COLORTYPE_COLOR_ALPHA:case x.COLORTYPE_COLOR:n.bitDepth===8?(c[f]=m.red,c[f+1]=m.green,c[f+2]=m.blue,o&&(c[f+3]=m.alpha)):(c.writeUInt16BE(m.red,f),c.writeUInt16BE(m.green,f+2),c.writeUInt16BE(m.blue,f+4),o&&c.writeUInt16BE(m.alpha,f+6));break;case x.COLORTYPE_ALPHA:case x.COLORTYPE_GRAYSCALE:{let _=(m.red+m.green+m.blue)/3;n.bitDepth===8?(c[f]=_,o&&(c[f+1]=m.alpha)):(c.writeUInt16BE(_,f),o&&c.writeUInt16BE(m.alpha,f+2));break}default:throw new Error("unrecognised color Type "+n.colorType)}u+=a,f+=l}return c}});var Eo=d((df,Ao)=>{"use strict";var wo=Vt();function wl(e,t,r,n,o){for(let i=0;i<r;i++)n[o+i]=e[t+i]}function Al(e,t,r){let n=0,o=t+r;for(let i=t;i<o;i++)n+=Math.abs(e[i]);return n}function El(e,t,r,n,o,i){for(let s=0;s<r;s++){let a=s>=i?e[t+s-i]:0,l=e[t+s]-a;n[o+s]=l}}function Cl(e,t,r,n){let o=0;for(let i=0;i<r;i++){let s=i>=n?e[t+i-n]:0,a=e[t+i]-s;o+=Math.abs(a)}return o}function Tl(e,t,r,n,o){for(let i=0;i<r;i++){let s=t>0?e[t+i-r]:0,a=e[t+i]-s;n[o+i]=a}}function bl(e,t,r){let n=0,o=t+r;for(let i=t;i<o;i++){let s=t>0?e[i-r]:0,a=e[i]-s;n+=Math.abs(a)}return n}function Il(e,t,r,n,o,i){for(let s=0;s<r;s++){let a=s>=i?e[t+s-i]:0,l=t>0?e[t+s-r]:0,c=e[t+s]-(a+l>>1);n[o+s]=c}}function Pl(e,t,r,n){let o=0;for(let i=0;i<r;i++){let s=i>=n?e[t+i-n]:0,a=t>0?e[t+i-r]:0,l=e[t+i]-(s+a>>1);o+=Math.abs(l)}return o}function kl(e,t,r,n,o,i){for(let s=0;s<r;s++){let a=s>=i?e[t+s-i]:0,l=t>0?e[t+s-r]:0,c=t>0&&s>=i?e[t+s-(r+i)]:0,u=e[t+s]-wo(a,l,c);n[o+s]=u}}function Bl(e,t,r,n){let o=0;for(let i=0;i<r;i++){let s=i>=n?e[t+i-n]:0,a=t>0?e[t+i-r]:0,l=t>0&&i>=n?e[t+i-(r+n)]:0,c=e[t+i]-wo(s,a,l);o+=Math.abs(c)}return o}var Sl={0:wl,1:El,2:Tl,3:Il,4:kl},Rl={0:Al,1:Cl,2:bl,3:Pl,4:Bl};Ao.exports=function(e,t,r,n,o){let i;if(!("filterType"in n)||n.filterType===-1)i=[0,1,2,3,4];else if(typeof n.filterType=="number")i=[n.filterType];else throw new Error("unrecognised filter types");n.bitDepth===16&&(o*=2);let s=t*o,a=0,l=0,c=Buffer.alloc((s+1)*r),u=i[0];for(let f=0;f<r;f++){if(i.length>1){let h=1/0;for(let g=0;g<i.length;g++){let p=Rl[i[g]](e,l,s,o);p<h&&(u=i[g],h=p)}}c[a]=u,a++,Sl[u](e,l,s,c,a,o),a+=s,l+=s}return c}});var ir=d((gf,Co)=>{"use strict";var L=be(),Ll=er(),vl=_o(),Nl=Eo(),Ml=require("zlib"),te=Co.exports=function(e){if(this._options=e,e.deflateChunkSize=e.deflateChunkSize||32*1024,e.deflateLevel=e.deflateLevel!=null?e.deflateLevel:9,e.deflateStrategy=e.deflateStrategy!=null?e.deflateStrategy:3,e.inputHasAlpha=e.inputHasAlpha!=null?e.inputHasAlpha:!0,e.deflateFactory=e.deflateFactory||Ml.createDeflate,e.bitDepth=e.bitDepth||8,e.colorType=typeof e.colorType=="number"?e.colorType:L.COLORTYPE_COLOR_ALPHA,e.inputColorType=typeof e.inputColorType=="number"?e.inputColorType:L.COLORTYPE_COLOR_ALPHA,[L.COLORTYPE_GRAYSCALE,L.COLORTYPE_COLOR,L.COLORTYPE_COLOR_ALPHA,L.COLORTYPE_ALPHA].indexOf(e.colorType)===-1)throw new Error("option color type:"+e.colorType+" is not supported at present");if([L.COLORTYPE_GRAYSCALE,L.COLORTYPE_COLOR,L.COLORTYPE_COLOR_ALPHA,L.COLORTYPE_ALPHA].indexOf(e.inputColorType)===-1)throw new Error("option input color type:"+e.inputColorType+" is not supported at present");if(e.bitDepth!==8&&e.bitDepth!==16)throw new Error("option bit depth:"+e.bitDepth+" is not supported at present")};te.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}};te.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())};te.prototype.filterData=function(e,t,r){let n=vl(e,t,r,this._options),o=L.COLORTYPE_TO_BPP_MAP[this._options.colorType];return Nl(n,t,r,this._options,o)};te.prototype._packChunk=function(e,t){let r=t?t.length:0,n=Buffer.alloc(r+12);return n.writeUInt32BE(r,0),n.writeUInt32BE(e,4),t&&t.copy(n,8),n.writeInt32BE(Ll.crc32(n.slice(4,n.length-4)),n.length-4),n};te.prototype.packGAMA=function(e){let t=Buffer.alloc(4);return t.writeUInt32BE(Math.floor(e*L.GAMMA_DIVISION),0),this._packChunk(L.TYPE_gAMA,t)};te.prototype.packIHDR=function(e,t){let r=Buffer.alloc(13);return r.writeUInt32BE(e,0),r.writeUInt32BE(t,4),r[8]=this._options.bitDepth,r[9]=this._options.colorType,r[10]=0,r[11]=0,r[12]=0,this._packChunk(L.TYPE_IHDR,r)};te.prototype.packIDAT=function(e){return this._packChunk(L.TYPE_IDAT,e)};te.prototype.packIEND=function(){return this._packChunk(L.TYPE_IEND,null)}});var Po=d((pf,Io)=>{"use strict";var Ol=require("util"),To=require("stream"),xl=be(),Dl=ir(),bo=Io.exports=function(e){To.call(this);let t=e||{};this._packer=new Dl(t),this._deflate=this._packer.createDeflate(),this.readable=!0};Ol.inherits(bo,To);bo.prototype.pack=function(e,t,r,n){this.emit("data",Buffer.from(xl.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(t,r)),n&&this.emit("data",this._packer.packGAMA(n));let o=this._packer.filterData(e,t,r);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(i){this.emit("data",this._packer.packIDAT(i))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(o)}});var vo=d((Oe,Lo)=>{"use strict";var ko=require("assert").ok,Ie=require("zlib"),ql=require("util"),Bo=require("buffer").kMaxLength;function ce(e){if(!(this instanceof ce))return new ce(e);e&&e.chunkSize<Ie.Z_MIN_CHUNK&&(e.chunkSize=Ie.Z_MIN_CHUNK),Ie.Inflate.call(this,e),this._offset=this._offset===void 0?this._outOffset:this._offset,this._buffer=this._buffer||this._outBuffer,e&&e.maxLength!=null&&(this._maxLength=e.maxLength)}function Fl(e){return new ce(e)}function So(e,t){t&&process.nextTick(t),e._handle&&(e._handle.close(),e._handle=null)}ce.prototype._processChunk=function(e,t,r){if(typeof r=="function")return Ie.Inflate._processChunk.call(this,e,t,r);let n=this,o=e&&e.length,i=this._chunkSize-this._offset,s=this._maxLength,a=0,l=[],c=0,u;this.on("error",function(p){u=p});function f(p,y){if(n._hadError)return;let m=i-y;if(ko(m>=0,"have should not go down"),m>0){let _=n._buffer.slice(n._offset,n._offset+m);if(n._offset+=m,_.length>s&&(_=_.slice(0,s)),l.push(_),c+=_.length,s-=_.length,s===0)return!1}return(y===0||n._offset>=n._chunkSize)&&(i=n._chunkSize,n._offset=0,n._buffer=Buffer.allocUnsafe(n._chunkSize)),y===0?(a+=o-p,o=p,!0):!1}ko(this._handle,"zlib binding closed");let h;do h=this._handle.writeSync(t,e,a,o,this._buffer,this._offset,i),h=h||this._writeState;while(!this._hadError&&f(h[0],h[1]));if(this._hadError)throw u;if(c>=Bo)throw So(this),new RangeError("Cannot create final Buffer. It would be larger than 0x"+Bo.toString(16)+" bytes");let g=Buffer.concat(l,c);return So(this),g};ql.inherits(ce,Ie.Inflate);function Ul(e,t){if(typeof t=="string"&&(t=Buffer.from(t)),!(t instanceof Buffer))throw new TypeError("Not a string or buffer");let r=e._finishFlushFlag;return r==null&&(r=Ie.Z_FINISH),e._processChunk(t,r)}function Ro(e,t){return Ul(new ce(t),e)}Lo.exports=Oe=Ro;Oe.Inflate=ce;Oe.createInflate=Fl;Oe.inflateSync=Ro});var sr=d((mf,Mo)=>{"use strict";var No=Mo.exports=function(e){this._buffer=e,this._reads=[]};No.prototype.read=function(e,t){this._reads.push({length:Math.abs(e),allowLess:e<0,func:t})};No.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){let e=this._reads[0];if(this._buffer.length&&(this._buffer.length>=e.length||e.allowLess)){this._reads.shift();let t=this._buffer;this._buffer=t.slice(e.length),e.func.call(this,t.slice(0,e.length))}else break}if(this._reads.length>0)return new Error("There are some read requests waitng on finished stream");if(this._buffer.length>0)return new Error("unrecognised content at end of stream")}});var xo=d(Oo=>{"use strict";var Hl=sr(),Kl=Wt();Oo.process=function(e,t){let r=[],n=new Hl(e);return new Kl(t,{read:n.read.bind(n),write:function(i){r.push(i)},complete:function(){}}).start(),n.process(),Buffer.concat(r)}});var Uo=d((_f,Fo)=>{"use strict";var Do=!0,qo=require("zlib"),$l=vo();qo.deflateSync||(Do=!1);var Yl=sr(),jl=xo(),Gl=tr(),zl=rr(),Jl=nr();Fo.exports=function(e,t){if(!Do)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let r;function n(A){r=A}let o;function i(A){o=A}function s(A){o.transColor=A}function a(A){o.palette=A}function l(){o.alpha=!0}let c;function u(A){c=A}let f=[];function h(A){f.push(A)}let g=new Yl(e);if(new Gl(t,{read:g.read.bind(g),error:n,metadata:i,gamma:u,palette:a,transColor:s,inflateData:h,simpleTransparency:l}).start(),g.process(),r)throw r;let y=Buffer.concat(f);f.length=0;let m;if(o.interlace)m=qo.inflateSync(y);else{let C=((o.width*o.bpp*o.depth+7>>3)+1)*o.height;m=$l(y,{chunkSize:C,maxLength:C})}if(y=null,!m||!m.length)throw new Error("bad png - invalid inflate data response");let _=jl.process(m,o);y=null;let N=zl.dataToBitMap(_,o);_=null;let S=Jl(N,o);return o.data=S,o.gamma=c||0,o}});var Yo=d((wf,$o)=>{"use strict";var Ho=!0,Ko=require("zlib");Ko.deflateSync||(Ho=!1);var Ql=be(),Vl=ir();$o.exports=function(e,t){if(!Ho)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let r=t||{},n=new Vl(r),o=[];o.push(Buffer.from(Ql.PNG_SIGNATURE)),o.push(n.packIHDR(e.width,e.height)),e.gamma&&o.push(n.packGAMA(e.gamma));let i=n.filterData(e.data,e.width,e.height),s=Ko.deflateSync(i,n.getDeflateOptions());if(i=null,!s||!s.length)throw new Error("bad png - invalid compressed data response");return o.push(n.packIDAT(s)),o.push(n.packIEND()),Buffer.concat(o)}});var jo=d(ar=>{"use strict";var Wl=Uo(),Zl=Yo();ar.read=function(e,t){return Wl(e,t||{})};ar.write=function(e,t){return Zl(e,t)}});var Jo=d(zo=>{"use strict";var Xl=require("util"),Go=require("stream"),ec=mo(),tc=Po(),rc=jo(),v=zo.PNG=function(e){Go.call(this),e=e||{},this.width=e.width|0,this.height=e.height|0,this.data=this.width>0&&this.height>0?Buffer.alloc(4*this.width*this.height):null,e.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new ec(e),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(t){this.data=t,this.emit("parsed",t)}.bind(this)),this._packer=new tc(e),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};Xl.inherits(v,Go);v.sync=rc;v.prototype.pack=function(){return!this.data||!this.data.length?(this.emit("error","No data provided"),this):(process.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this)};v.prototype.parse=function(e,t){if(t){let r,n;r=function(o){this.removeListener("error",n),this.data=o,t(null,this)}.bind(this),n=function(o){this.removeListener("parsed",r),t(o,null)}.bind(this),this.once("parsed",r),this.once("error",n)}return this.end(e),this};v.prototype.write=function(e){return this._parser.write(e),!0};v.prototype.end=function(e){this._parser.end(e)};v.prototype._metadata=function(e){this.width=e.width,this.height=e.height,this.emit("metadata",e)};v.prototype._gamma=function(e){this.gamma=e};v.prototype._handleClose=function(){!this._parser.writable&&!this._packer.readable&&this.emit("close")};v.bitblt=function(e,t,r,n,o,i,s,a){if(r|=0,n|=0,o|=0,i|=0,s|=0,a|=0,r>e.width||n>e.height||r+o>e.width||n+i>e.height)throw new Error("bitblt reading outside image");if(s>t.width||a>t.height||s+o>t.width||a+i>t.height)throw new Error("bitblt writing outside image");for(let l=0;l<i;l++)e.data.copy(t.data,(a+l)*t.width+s<<2,(n+l)*e.width+r<<2,(n+l)*e.width+r+o<<2)};v.prototype.bitblt=function(e,t,r,n,o,i,s){return v.bitblt(this,e,t,r,n,o,i,s),this};v.adjustGamma=function(e){if(e.gamma){for(let t=0;t<e.height;t++)for(let r=0;r<e.width;r++){let n=e.width*t+r<<2;for(let o=0;o<3;o++){let i=e.data[n+o]/255;i=Math.pow(i,1/2.2/e.gamma),e.data[n+o]=Math.round(i*255)}}e.gamma=0}};v.prototype.adjustGamma=function(){v.adjustGamma(this)}});var xe=d(ue=>{function Qo(e){if(typeof e=="number"&&(e=e.toString()),typeof e!="string")throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||t.length===5||t.length>8)throw new Error("Invalid hex color: "+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(n){return[n,n]}))),t.length===6&&t.push("F","F");let r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+t.slice(0,6).join("")}}ue.getOptions=function(t){t||(t={}),t.color||(t.color={});let r=typeof t.margin>"u"||t.margin===null||t.margin<0?4:t.margin,n=t.width&&t.width>=21?t.width:void 0,o=t.scale||4;return{width:n,scale:n?4:o,margin:r,color:{dark:Qo(t.color.dark||"#000000ff"),light:Qo(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}};ue.getScale=function(t,r){return r.width&&r.width>=t+r.margin*2?r.width/(t+r.margin*2):r.scale};ue.getImageWidth=function(t,r){let n=ue.getScale(t,r);return Math.floor((t+r.margin*2)*n)};ue.qrToImageData=function(t,r,n){let o=r.modules.size,i=r.modules.data,s=ue.getScale(o,n),a=Math.floor((o+n.margin*2)*s),l=n.margin*s,c=[n.color.light,n.color.dark];for(let u=0;u<a;u++)for(let f=0;f<a;f++){let h=(u*a+f)*4,g=n.color.light;if(u>=l&&f>=l&&u<a-l&&f<a-l){let p=Math.floor((u-l)/s),y=Math.floor((f-l)/s);g=c[i[p*o+y]?1:0]}t[h++]=g.r,t[h++]=g.g,t[h++]=g.b,t[h]=g.a}}});var Vo=d(Y=>{var nc=require("fs"),oc=Jo().PNG,lr=xe();Y.render=function(t,r){let n=lr.getOptions(r),o=n.rendererOpts,i=lr.getImageWidth(t.modules.size,n);o.width=i,o.height=i;let s=new oc(o);return lr.qrToImageData(s.data,t,n),s};Y.renderToDataURL=function(t,r,n){typeof n>"u"&&(n=r,r=void 0),Y.renderToBuffer(t,r,function(o,i){o&&n(o);let s="data:image/png;base64,";s+=i.toString("base64"),n(null,s)})};Y.renderToBuffer=function(t,r,n){typeof n>"u"&&(n=r,r=void 0);let o=Y.render(t,r),i=[];o.on("error",n),o.on("data",function(s){i.push(s)}),o.on("end",function(){n(null,Buffer.concat(i))}),o.pack()};Y.renderToFile=function(t,r,n,o){typeof o>"u"&&(o=n,n=void 0);let i=!1,s=(...l)=>{i||(i=!0,o.apply(null,l))},a=nc.createWriteStream(t);a.on("error",s),a.on("close",s),Y.renderToFileStream(a,r,n)};Y.renderToFileStream=function(t,r,n){Y.render(r,n).pack().pipe(t)}});var Wo=d(st=>{var ic=xe(),sc={WW:" ",WB:"\u2584",BB:"\u2588",BW:"\u2580"},ac={BB:" ",BW:"\u2584",WW:"\u2588",WB:"\u2580"};function lc(e,t,r){return e&&t?r.BB:e&&!t?r.BW:!e&&t?r.WB:r.WW}st.render=function(e,t,r){let n=ic.getOptions(t),o=sc;(n.color.dark.hex==="#ffffff"||n.color.light.hex==="#000000")&&(o=ac);let i=e.modules.size,s=e.modules.data,a="",l=Array(i+n.margin*2+1).join(o.WW);l=Array(n.margin/2+1).join(l+`
`);let c=Array(n.margin+1).join(o.WW);a+=l;for(let u=0;u<i;u+=2){a+=c;for(let f=0;f<i;f++){let h=s[u*i+f],g=s[(u+1)*i+f];a+=lc(h,g,o)}a+=c+`
`}return a+=l.slice(0,-1),typeof r=="function"&&r(null,a),a};st.renderToFile=function(t,r,n,o){typeof o>"u"&&(o=n,n=void 0);let i=require("fs"),s=st.render(r,n);i.writeFile(t,s,o)}});var Xo=d(Zo=>{Zo.render=function(e,t,r){let n=e.modules.size,o=e.modules.data,i="\x1B[40m  \x1B[0m",s="\x1B[47m  \x1B[0m",a="",l=Array(n+3).join(s),c=Array(2).join(s);a+=l+`
`;for(let u=0;u<n;++u){a+=s;for(let f=0;f<n;f++)a+=o[u*n+f]?i:s;a+=c+`
`}return a+=l+`
`,typeof r=="function"&&r(null,a),a}});var ni=d(ri=>{var cc="\x1B[47m",uc="\x1B[40m",cr="\x1B[37m",ur="\x1B[30m",fe="\x1B[0m",fc=cc+ur,hc=uc+cr,dc=function(e,t,r){return{"00":fe+" "+e,"01":fe+t+"\u2584"+e,"02":fe+r+"\u2584"+e,10:fe+t+"\u2580"+e,11:" ",12:"\u2584",20:fe+r+"\u2580"+e,21:"\u2580",22:"\u2588"}},ei=function(e,t,r,n){let o=t+1;if(r>=o||n>=o||n<-1||r<-1)return"0";if(r>=t||n>=t||n<0||r<0)return"1";let i=n*t+r;return e[i]?"2":"1"},ti=function(e,t,r,n){return ei(e,t,r,n)+ei(e,t,r,n+1)};ri.render=function(e,t,r){let n=e.modules.size,o=e.modules.data,i=!!(t&&t.inverse),s=t&&t.inverse?hc:fc,c=dc(s,i?ur:cr,i?cr:ur),u=fe+`
`+s,f=s;for(let h=-1;h<n+1;h+=2){for(let g=-1;g<n;g++)f+=c[ti(o,n,g,h)];f+=c[ti(o,n,n,h)]+u}return f+=fe,typeof r=="function"&&r(null,f),f}});var ii=d(oi=>{var gc=Xo(),pc=ni();oi.render=function(e,t,r){return t&&t.small?pc.render(e,t,r):gc.render(e,t,r)}});var hr=d(ai=>{var mc=xe();function si(e,t){let r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function fr(e,t,r){let n=e+t;return typeof r<"u"&&(n+=" "+r),n}function yc(e,t,r){let n="",o=0,i=!1,s=0;for(let a=0;a<e.length;a++){let l=Math.floor(a%t),c=Math.floor(a/t);!l&&!i&&(i=!0),e[a]?(s++,a>0&&l>0&&e[a-1]||(n+=i?fr("M",l+r,.5+c+r):fr("m",o,0),o=0,i=!1),l+1<t&&e[a+1]||(n+=fr("h",s),s=0)):o++}return n}ai.render=function(t,r,n){let o=mc.getOptions(r),i=t.modules.size,s=t.modules.data,a=i+o.margin*2,l=o.color.light.a?"<path "+si(o.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",c="<path "+si(o.color.dark,"stroke")+' d="'+yc(s,i,o.margin)+'"/>',u='viewBox="0 0 '+a+" "+a+'"',h='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+u+' shape-rendering="crispEdges">'+l+c+`</svg>
`;return typeof n=="function"&&n(null,h),h}});var li=d(at=>{var _c=hr();at.render=_c.render;at.renderToFile=function(t,r,n,o){typeof o>"u"&&(o=n,n=void 0);let i=require("fs"),a='<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'+at.render(r,n);i.writeFile(t,a,o)}});var ci=d(lt=>{var dr=xe();function wc(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}function Ac(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}lt.render=function(t,r,n){let o=n,i=r;typeof o>"u"&&(!r||!r.getContext)&&(o=r,r=void 0),r||(i=Ac()),o=dr.getOptions(o);let s=dr.getImageWidth(t.modules.size,o),a=i.getContext("2d"),l=a.createImageData(s,s);return dr.qrToImageData(l.data,t,o),wc(a,i,s),a.putImageData(l,0,0),i};lt.renderToDataURL=function(t,r,n){let o=n;typeof o>"u"&&(!r||!r.getContext)&&(o=r,r=void 0),o||(o={});let i=lt.render(t,r,o),s=o.type||"image/png",a=o.rendererOpts||{};return i.toDataURL(s,a.quality)}});var fi=d(De=>{var Ec=kt(),gr=Gt(),ui=ci(),Cc=hr();function pr(e,t,r,n,o){let i=[].slice.call(arguments,1),s=i.length,a=typeof i[s-1]=="function";if(!a&&!Ec())throw new Error("Callback required as last argument");if(a){if(s<2)throw new Error("Too few arguments provided");s===2?(o=r,r=t,t=n=void 0):s===3&&(t.getContext&&typeof o>"u"?(o=n,n=void 0):(o=n,n=r,r=t,t=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(r=t,t=n=void 0):s===2&&!t.getContext&&(n=r,r=t,t=void 0),new Promise(function(l,c){try{let u=gr.create(r,n);l(e(u,t,n))}catch(u){c(u)}})}try{let l=gr.create(r,n);o(null,e(l,t,n))}catch(l){o(l)}}De.create=gr.create;De.toCanvas=pr.bind(null,ui.render);De.toDataURL=pr.bind(null,ui.renderToDataURL);De.toString=pr.bind(null,function(e,t,r){return Cc.render(e,r)})});var pi=d(re=>{var hi=kt(),mr=Gt(),Tc=Vo(),di=Wo(),bc=ii(),gi=li();function qe(e,t,r){if(typeof e>"u")throw new Error("String required as first argument");if(typeof r>"u"&&(r=t,t={}),typeof r!="function")if(hi())t=r||{},r=null;else throw new Error("Callback required as last argument");return{opts:t,cb:r}}function Ic(e){return e.slice((e.lastIndexOf(".")-1>>>0)+2).toLowerCase()}function ct(e){switch(e){case"svg":return gi;case"txt":case"utf8":return di;case"png":case"image/png":default:return Tc}}function Pc(e){switch(e){case"svg":return gi;case"terminal":return bc;case"utf8":default:return di}}function Fe(e,t,r){if(!r.cb)return new Promise(function(n,o){try{let i=mr.create(t,r.opts);return e(i,r.opts,function(s,a){return s?o(s):n(a)})}catch(i){o(i)}});try{let n=mr.create(t,r.opts);return e(n,r.opts,r.cb)}catch(n){r.cb(n)}}re.create=mr.create;re.toCanvas=fi().toCanvas;re.toString=function(t,r,n){let o=qe(t,r,n),i=o.opts?o.opts.type:void 0,s=Pc(i);return Fe(s.render,t,o)};re.toDataURL=function(t,r,n){let o=qe(t,r,n),i=ct(o.opts.type);return Fe(i.renderToDataURL,t,o)};re.toBuffer=function(t,r,n){let o=qe(t,r,n),i=ct(o.opts.type);return Fe(i.renderToBuffer,t,o)};re.toFile=function(t,r,n,o){if(typeof t!="string"||!(typeof r=="string"||typeof r=="object"))throw new Error("Invalid argument");if(arguments.length<3&&!hi())throw new Error("Too few arguments provided");let i=qe(r,n,o),s=i.opts.type||Ic(t),l=ct(s).renderToFile.bind(null,t);return Fe(l,r,i)};re.toFileStream=function(t,r,n){if(arguments.length<2)throw new Error("Too few arguments provided");let o=qe(r,n,t.emit.bind(t,"error")),s=ct("png").renderToFileStream.bind(null,t);Fe(s,r,o)}});var yr=d((Nf,mi)=>{mi.exports=pi()});var _r=d((Mf,yi)=>{yi.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}});var Ai=d((Of,wi)=>{var kc=_r();function _i(e){this.mode=kc.MODE_8BIT_BYTE,this.data=e}_i.prototype={getLength:function(){return this.data.length},write:function(e){for(var t=0;t<this.data.length;t++)e.put(this.data.charCodeAt(t),8)}};wi.exports=_i});var wr=d((xf,Ei)=>{var F={glog:function(e){if(e<1)throw new Error("glog("+e+")");return F.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return F.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(I=0;I<8;I++)F.EXP_TABLE[I]=1<<I;var I;for(I=8;I<256;I++)F.EXP_TABLE[I]=F.EXP_TABLE[I-4]^F.EXP_TABLE[I-5]^F.EXP_TABLE[I-6]^F.EXP_TABLE[I-8];var I;for(I=0;I<255;I++)F.LOG_TABLE[F.EXP_TABLE[I]]=I;var I;Ei.exports=F});var Ar=d((Df,Ci)=>{var he=wr();function ut(e,t){if(e.length===void 0)throw new Error(e.length+"/"+t);for(var r=0;r<e.length&&e[r]===0;)r++;this.num=new Array(e.length-r+t);for(var n=0;n<e.length-r;n++)this.num[n]=e[n+r]}ut.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<e.getLength();n++)t[r+n]^=he.gexp(he.glog(this.get(r))+he.glog(e.get(n)));return new ut(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=he.glog(this.get(0))-he.glog(e.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(var o=0;o<e.getLength();o++)r[o]^=he.gexp(he.glog(e.get(o))+t);return new ut(r,0).mod(e)}};Ci.exports=ut});var bi=d((qf,Ti)=>{Ti.exports={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7}});var ki=d((Ff,Pi)=>{var D=_r(),Ii=Ar(),Bc=wr(),ne=bi(),B={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;B.getBCHDigit(t)-B.getBCHDigit(B.G15)>=0;)t^=B.G15<<B.getBCHDigit(t)-B.getBCHDigit(B.G15);return(e<<10|t)^B.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;B.getBCHDigit(t)-B.getBCHDigit(B.G18)>=0;)t^=B.G18<<B.getBCHDigit(t)-B.getBCHDigit(B.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;e!==0;)t++,e>>>=1;return t},getPatternPosition:function(e){return B.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case ne.PATTERN000:return(t+r)%2===0;case ne.PATTERN001:return t%2===0;case ne.PATTERN010:return r%3===0;case ne.PATTERN011:return(t+r)%3===0;case ne.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2===0;case ne.PATTERN101:return t*r%2+t*r%3===0;case ne.PATTERN110:return(t*r%2+t*r%3)%2===0;case ne.PATTERN111:return(t*r%3+(t+r)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new Ii([1],0),r=0;r<e;r++)t=t.multiply(new Ii([1,Bc.gexp(r)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case D.MODE_NUMBER:return 10;case D.MODE_ALPHA_NUM:return 9;case D.MODE_8BIT_BYTE:return 8;case D.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case D.MODE_NUMBER:return 12;case D.MODE_ALPHA_NUM:return 11;case D.MODE_8BIT_BYTE:return 16;case D.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else if(t<41)switch(e){case D.MODE_NUMBER:return 14;case D.MODE_ALPHA_NUM:return 13;case D.MODE_8BIT_BYTE:return 16;case D.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}else throw new Error("type:"+t)},getLostPoint:function(e){var t=e.getModuleCount(),r=0,n=0,o=0;for(n=0;n<t;n++)for(o=0;o<t;o++){for(var i=0,s=e.isDark(n,o),a=-1;a<=1;a++)if(!(n+a<0||t<=n+a))for(var l=-1;l<=1;l++)o+l<0||t<=o+l||a===0&&l===0||s===e.isDark(n+a,o+l)&&i++;i>5&&(r+=3+i-5)}for(n=0;n<t-1;n++)for(o=0;o<t-1;o++){var c=0;e.isDark(n,o)&&c++,e.isDark(n+1,o)&&c++,e.isDark(n,o+1)&&c++,e.isDark(n+1,o+1)&&c++,(c===0||c===4)&&(r+=3)}for(n=0;n<t;n++)for(o=0;o<t-6;o++)e.isDark(n,o)&&!e.isDark(n,o+1)&&e.isDark(n,o+2)&&e.isDark(n,o+3)&&e.isDark(n,o+4)&&!e.isDark(n,o+5)&&e.isDark(n,o+6)&&(r+=40);for(o=0;o<t;o++)for(n=0;n<t-6;n++)e.isDark(n,o)&&!e.isDark(n+1,o)&&e.isDark(n+2,o)&&e.isDark(n+3,o)&&e.isDark(n+4,o)&&!e.isDark(n+5,o)&&e.isDark(n+6,o)&&(r+=40);var u=0;for(o=0;o<t;o++)for(n=0;n<t;n++)e.isDark(n,o)&&u++;var f=Math.abs(100*u/t/t-50)/5;return r+=f*10,r}};Pi.exports=B});var Er=d((Uf,Bi)=>{Bi.exports={L:1,M:0,Q:3,H:2}});var Ri=d((Hf,Si)=>{var ft=Er();function j(e,t){this.totalCount=e,this.dataCount=t}j.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];j.getRSBlocks=function(e,t){var r=j.getRsBlockTable(e,t);if(r===void 0)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var n=r.length/3,o=[],i=0;i<n;i++)for(var s=r[i*3+0],a=r[i*3+1],l=r[i*3+2],c=0;c<s;c++)o.push(new j(a,l));return o};j.getRsBlockTable=function(e,t){switch(t){case ft.L:return j.RS_BLOCK_TABLE[(e-1)*4+0];case ft.M:return j.RS_BLOCK_TABLE[(e-1)*4+1];case ft.Q:return j.RS_BLOCK_TABLE[(e-1)*4+2];case ft.H:return j.RS_BLOCK_TABLE[(e-1)*4+3];default:return}};Si.exports=j});var Ni=d((Kf,vi)=>{function Li(){this.buffer=[],this.length=0}Li.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var r=0;r<t;r++)this.putBit((e>>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};vi.exports=Li});var Di=d(($f,xi)=>{var Sc=Ai(),oe=ki(),Rc=Ar(),Mi=Ri(),Oi=Ni();function G(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}G.prototype={addData:function(e){var t=new Sc(e);this.dataList.push(t),this.dataCache=null},isDark:function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var t=Mi.getRSBlocks(e,this.errorCorrectLevel),r=new Oi,n=0,o=0;o<t.length;o++)n+=t[o].dataCount;for(var i=0;i<this.dataList.length;i++){var s=this.dataList[i];r.put(s.mode,4),r.put(s.getLength(),oe.getLengthInBits(s.mode,e)),s.write(r)}if(r.getLengthInBits()<=n*8)break}this.typeNumber=e}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,t){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++)this.modules[r][n]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),this.dataCache===null&&(this.dataCache=G.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+n||(0<=r&&r<=6&&(n===0||n===6)||0<=n&&n<=6&&(r===0||r===6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[e+r][t+n]=!0:this.modules[e+r][t+n]=!1)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=oe.getLostPoint(this);(r===0||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r),o=1;this.make();for(var i=0;i<this.modules.length;i++)for(var s=i*o,a=0;a<this.modules[i].length;a++){var l=a*o,c=this.modules[i][a];c&&(n.beginFill(0,100),n.moveTo(l,s),n.lineTo(l+o,s),n.lineTo(l+o,s+o),n.lineTo(l,s+o),n.endFill())}return n},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)this.modules[e][6]===null&&(this.modules[e][6]=e%2===0);for(var t=8;t<this.moduleCount-8;t++)this.modules[6][t]===null&&(this.modules[6][t]=t%2===0)},setupPositionAdjustPattern:function(){for(var e=oe.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var r=0;r<e.length;r++){var n=e[t],o=e[r];if(this.modules[n][o]===null)for(var i=-2;i<=2;i++)for(var s=-2;s<=2;s++)Math.abs(i)===2||Math.abs(s)===2||i===0&&s===0?this.modules[n+i][o+s]=!0:this.modules[n+i][o+s]=!1}},setupTypeNumber:function(e){for(var t=oe.getBCHTypeNumber(this.typeNumber),r,n=0;n<18;n++)r=!e&&(t>>n&1)===1,this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r;for(var o=0;o<18;o++)r=!e&&(t>>o&1)===1,this.modules[o%3+this.moduleCount-8-3][Math.floor(o/3)]=r},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,n=oe.getBCHTypeInfo(r),o,i=0;i<15;i++)o=!e&&(n>>i&1)===1,i<6?this.modules[i][8]=o:i<8?this.modules[i+1][8]=o:this.modules[this.moduleCount-15+i][8]=o;for(var s=0;s<15;s++)o=!e&&(n>>s&1)===1,s<8?this.modules[8][this.moduleCount-s-1]=o:s<9?this.modules[8][15-s-1+1]=o:this.modules[8][15-s-1]=o;this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,o=7,i=0,s=this.moduleCount-1;s>0;s-=2)for(s===6&&s--;;){for(var a=0;a<2;a++)if(this.modules[n][s-a]===null){var l=!1;i<e.length&&(l=(e[i]>>>o&1)===1);var c=oe.getMask(t,n,s-a);c&&(l=!l),this.modules[n][s-a]=l,o--,o===-1&&(i++,o=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};G.PAD0=236;G.PAD1=17;G.createData=function(e,t,r){for(var n=Mi.getRSBlocks(e,t),o=new Oi,i=0;i<r.length;i++){var s=r[i];o.put(s.mode,4),o.put(s.getLength(),oe.getLengthInBits(s.mode,e)),s.write(o)}for(var a=0,l=0;l<n.length;l++)a+=n[l].dataCount;if(o.getLengthInBits()>a*8)throw new Error("code length overflow. ("+o.getLengthInBits()+">"+a*8+")");for(o.getLengthInBits()+4<=a*8&&o.put(0,4);o.getLengthInBits()%8!==0;)o.putBit(!1);for(;!(o.getLengthInBits()>=a*8||(o.put(G.PAD0,8),o.getLengthInBits()>=a*8));)o.put(G.PAD1,8);return G.createBytes(o,n)};G.createBytes=function(e,t){for(var r=0,n=0,o=0,i=new Array(t.length),s=new Array(t.length),a=0;a<t.length;a++){var l=t[a].dataCount,c=t[a].totalCount-l;n=Math.max(n,l),o=Math.max(o,c),i[a]=new Array(l);for(var u=0;u<i[a].length;u++)i[a][u]=255&e.buffer[u+r];r+=l;var f=oe.getErrorCorrectPolynomial(c),h=new Rc(i[a],f.getLength()-1),g=h.mod(f);s[a]=new Array(f.getLength()-1);for(var p=0;p<s[a].length;p++){var y=p+g.getLength()-s[a].length;s[a][p]=y>=0?g.get(y):0}}for(var m=0,_=0;_<t.length;_++)m+=t[_].totalCount;for(var N=new Array(m),S=0,A=0;A<n;A++)for(var C=0;C<t.length;C++)A<i[C].length&&(N[S++]=i[C][A]);for(var T=0;T<o;T++)for(var M=0;M<t.length;M++)T<s[M].length&&(N[S++]=s[M][T]);return N};xi.exports=G});var Ui=d((Yf,Fi)=>{var Lc=Di(),qi=Er(),vc="\x1B[40m  \x1B[0m",ht="\x1B[47m  \x1B[0m",Nc=function(e){return e?vc:ht},Cr=function(e){return{times:function(t){return new Array(t).join(e)}}},Mc=function(e,t){for(var r=new Array(e),n=0;n<e;n++)r[n]=t;return r};Fi.exports={error:qi.L,generate:function(e,t,r){typeof t=="function"&&(r=t,t={});var n=new Lc(-1,this.error);n.addData(e),n.make();var o="";if(t&&t.small){var i=!0,s=!1,a=n.getModuleCount(),l=n.modules.slice(),c=a%2===1;c&&l.push(Mc(a,s));var u={WHITE_ALL:"\u2588",WHITE_BLACK:"\u2580",BLACK_WHITE:"\u2584",BLACK_ALL:" "},f=Cr(u.BLACK_WHITE).times(a+3),h=Cr(u.WHITE_BLACK).times(a+3);o+=f+`
`;for(var g=0;g<a;g+=2){o+=u.WHITE_ALL;for(var p=0;p<a;p++)l[g][p]===s&&l[g+1][p]===s?o+=u.WHITE_ALL:l[g][p]===s&&l[g+1][p]===i?o+=u.WHITE_BLACK:l[g][p]===i&&l[g+1][p]===s?o+=u.BLACK_WHITE:o+=u.BLACK_ALL;o+=u.WHITE_ALL+`
`}c||(o+=h)}else{var y=Cr(ht).times(n.getModuleCount()+3);o+=y+`
`,n.modules.forEach(function(m){o+=ht,o+=m.map(Nc).join(""),o+=ht+`
`}),o+=y}r?r(o):console.log(o)},setErrorLevel:function(e){this.error=qi[e]||this.error}}});var dt=d((jf,br)=>{var Hi=require("crypto");function Ki(){let e=require("os").networkInterfaces();for(let t in e){let r=e[t];for(let n of r)if(!n.internal&&n.mac&&n.mac!=="00:00:00:00:00:00")return n.mac.replace(/:/g,"")}return Hi.randomBytes(6).toString("hex").toUpperCase()}function $i(){let e="";for(let t=0;t<5;t++)e+=[REDACTED_SECRET].charAt(Math.floor(36*Math.random()));return e}function Yi(){return`gthtclaw://qrbody:${Ki()}${Math.floor(Date.now()/1e3)}${$i()}`}function ji(e){return Hi.createHash("md5").update(e).digest("hex")}function Tr(){let e=Yi();return{qrbody:e,sessionId:ji(e)}}function Gi(e){console.log("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"),console.log("\u2551         \u8BF7\u4F7F\u7528\u6388\u6743APP\u626B\u63CF\u4EE5\u4E0B\u4E8C\u7EF4\u7801\u8FDB\u884C\u6388\u6743                \u2551"),console.log("\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563"),console.log("\u2551                                                              \u2551"),console.log("\u2551  \u4E8C\u7EF4\u7801\u5185\u5BB9:                                                  \u2551"),console.log("\u2551  "+e.substring(0,54)+"                              \u2551"),e.length>54&&console.log("\u2551  "+e.substring(54,108)+"                              \u2551"),console.log("\u2551                                                              \u2551"),console.log("\u2551  \u63D0\u793A: \u8BF7\u572830\u79D2\u5185\u5B8C\u6210\u626B\u63CF                                    \u2551"),console.log("\u2551                                                              \u2551"),console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")}function Oc(e){try{return yr().toString(e,{type:"terminal",small:!0})}catch{return Gi(e),null}}async function xc(){let e=process.argv[2];if(e!=="help"&&e)if(e==="generate"){let t=Tr();console.log("\u6388\u6743\u4FE1\u606F\u751F\u6210\u6210\u529F\uFF1A"),console.log("====================="),console.log(`QR Body: ${t.qrbody}`),console.log(`Session ID: ${t.sessionId}`),console.log("");let r=Oc(t.qrbody);r&&console.log(r),process.env.QR_JSON_OUTPUT==="true"&&console.log(JSON.stringify(t,null,2))}else e==="qrbody"?console.log(Tr().qrbody):(console.error(`\u672A\u77E5\u547D\u4EE4: ${e}`),process.exit(1));else console.log(`
\u4E8C\u7EF4\u7801\u751F\u6210\u6A21\u5757
==============

\u7528\u6CD5:
  node qrcode-generator.js generate    # \u751F\u6210\u6388\u6743\u4E8C\u7EF4\u7801
  node qrcode-generator.js qrbody      # \u4EC5\u751F\u6210 QR Body
  node qrcode-generator.js help        # \u663E\u793A\u5E2E\u52A9\u4FE1\u606F

\u8BF4\u660E:
  - \u751F\u6210\u7684\u4E8C\u7EF4\u7801\u7528\u4E8E\u83B7\u53D6 API \u6388\u6743
  - \u626B\u63CF\u4E8C\u7EF4\u7801\u540E\uFF0C\u7CFB\u7EDF\u4F1A\u8F6E\u8BE2\u6388\u6743\u670D\u52A1\u5668\u83B7\u53D6 api-key
  - api-key \u5C06\u4FDD\u5B58\u5728\u914D\u7F6E\u6587\u4EF6\u4E2D\u4F9B\u540E\u7EED\u4F7F\u7528
`)}function zi(){let e=process.stdout;return e.isTTY?{rows:e.rows||24,columns:e.columns||80}:{rows:24,columns:80}}async function Dc(e){let t=zi(),r=Math.floor(.6*t.rows),n=t.columns;console.log(""),console.log("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"),console.log("\u2551         \u8BF7\u4F7F\u7528\u6388\u6743APP\u626B\u63CF\u4EE5\u4E0B\u4E8C\u7EF4\u7801\u8FDB\u884C\u6388\u6743                \u2551"),console.log("\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563"),console.log("\u2551                                                              \u2551");try{let o=Ui(),s=(await new Promise(c=>{let u=r<30||n<80;o.generate(e,{small:u},f=>c(f))})).split(`
`).filter(c=>c.trim()),a=Math.max(...s.map(c=>c.length)),l=Math.max(2,Math.floor((62-a)/2));s.forEach(c=>{let u=Math.max(0,62-l-c.length);console.log("\u2551"+" ".repeat(l)+c+" ".repeat(u)+"\u2551")})}catch{let i=e.length,s=56,a=Math.floor((s-i)/2),l=s-i-a;console.log("\u2551  \u4E8C\u7EF4\u7801\u5185\u5BB9:                                                  \u2551"),console.log("\u2551  \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2551"),console.log("\u2551  \u2502"+" ".repeat(s)+"\u2502 \u2551"),console.log("\u2551  \u2502"+" ".repeat(a)+e+" ".repeat(l)+"\u2502 \u2551"),console.log("\u2551  \u2502"+" ".repeat(s)+"\u2502 \u2551"),console.log("\u2551  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2551")}console.log("\u2551                                                              \u2551"),console.log("\u2551  \u63D0\u793A: \u8BF7\u57282\u5206\u949F\u5185\u5B8C\u6210\u626B\u63CF                                    \u2551"),console.log("\u2551                                                              \u2551"),console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"),console.log("")}function qc(e){return e?e.startsWith("gthtclaw://qrbody:")?e.replace("gthtclaw://qrbody:",""):e:null}br.exports={generateAuthQRCode:Tr,generateQrBody:Yi,generateRandomChars:$i,calculateMD5:ji,displayQRCode:Gi,getMacAddress:Ki,getTerminalSize:zi,displayAdaptiveQRCode:Dc,extractDeviceId:qc};require.main===br&&xc().catch(e=>{console.error("\u9519\u8BEF:",e.message),process.exit(1)})});var Qi=d((Gf,Ji)=>{var Fc="https://apicdn.app.gtht.com/web2/jh-news-skill/?fullscreen=1#/?share=1&sourceApp=lingxi&webEnv=web2&islingxishare=1";Ji.exports={API_KEY_AUTH_ACTIVITY_URL:Fc}});var is=d((Zf,kr)=>{var Uc=require("os"),zf=require("fs"),Jf=require("path"),Hc=require("http"),Xi=yr(),pt=dt(),{saveApiKey:Pr,hasStoredApiKey:Kc,resolveAuthConfigFile:$c}=ye(),{queryKeyFromClawServer:mt,queryViaProxy:Yc}=Pt(),jc=ke(),{API_KEY_AUTH_ACTIVITY_URL:Gc}=Qi(),J=process.argv.slice(2),Vi=Uc.platform(),es=Vi==="win32"||Vi==="darwin",Qf=J.includes("--ascii"),ts=J.includes("--image"),zc=J.includes("--channel"),Vf=process.env.QR_RENDER==="ascii",rs=process.env.QR_RENDER==="image",Jc=process.env.CHANNEL_MODE==="true",Qc=[process.env.OPENCLAW,process.env.OPENCLAW_ENV,process.env.CLAW_ENV,process.env.RUNTIME_ENV,process.env.AGENT_ENV].filter(Boolean),Wf=Qc.some(e=>String(e).toLowerCase().includes("openclaw")),Vc=ts||!es&&rs,gt=!0,Wi=J.includes("--qr-only")||process.env.QR_ONLY==="true",Zi=J.includes("--poll"),Ir=(()=>{let e=J.indexOf("--device-id");return e!==-1&&J[e+1]?J[e+1]:null})();function ns(){return pt.getMacAddress()}function Wc(e){let t=Xi.create(e,{errorCorrectionLevel:"H"}),{modules:r}=t,n=r.size,o="\x1B[48;5;231m",i="\x1B[38;5;16m",s="\x1B[38;5;231m",a="\x1B[0m";console.log(`
\x1B[1m>> \u6B63\u5728\u6E32\u67D3\u4E8C\u7EF4\u7801 (\u9971\u6EE1\u50CF\u7D20\u6A21\u5F0F)\x1B[0m`);let l="    ",c=`${o}${" ".repeat(n+8)}${a}
`;process.stdout.write(c+c);for(let u=0;u<n;u+=2){process.stdout.write(o+l);for(let f=0;f<n;f++){let h=r.get(f,u),g=u+1<n?r.get(f,u+1):0;h&&g?process.stdout.write(i+"\u2588"):h&&!g?process.stdout.write(i+"\u2580"):!h&&g?process.stdout.write(i+"\u2584"):process.stdout.write(s+"\u2588")}process.stdout.write(o+l+a+`
`)}process.stdout.write(c+c),console.log(`\x1B[2m[ \u6E32\u67D3\u5B8C\u6210\uFF1A\u82E5\u8BC6\u522B\u56F0\u96BE\uFF0C\u8BF7\u5C1D\u8BD5\u8C03\u5C0F\u7EC8\u7AEF\u5B57\u53F7 ]\x1B[0m
`)}async function Zc(e){return await Xi.toDataURL(e,{width:300,margin:2,color:{dark:"#6f8dff",light:"#ffffff"}})}function Xc(){console.log(`
\u65B9\u5F0F\u4E8C\uFF1A\u53D1\u9001 API KEY \u6388\u6743`),console.log("\u8FDB\u5165\u7075\u7280Skills\u9886\u53D6\u6D3B\u52A8\u9875\u2014\u2014API KEY \u7BA1\u7406\uFF0C\u65B0\u5EFA\u6216\u590D\u5236\u751F\u6548\u4E2D\u7684 API KEY\uFF0C\u53D1\u9001\u7ED9\u6211\u5B8C\u6210\u6388\u6743\u3002"),console.log("\u624B\u673A\u7AEF\u7528\u6237\u53EF\u4EE5\u70B9\u51FB\u4EE5\u4E0B\u94FE\u63A5\u8BBF\u95EE\u6D3B\u52A8"),console.log(`API_KEY_AUTH_ACTIVITY_URL: ${Gc}`),console.log('\u7535\u8111\u7AEF\u7528\u6237\u63A8\u8350\u6253\u5F00\u56FD\u6CF0\u6D77\u901A\u7075\u7280 APP\uFF0C\u5728\u5BF9\u8BDD\u6846\u641C\u7D22 "\u7075\u7280 Skills"')}function eu(e,t=0){return new Promise((r,n)=>{let o=Hc.createServer((i,s)=>{if(i.method==="OPTIONS"&&i.url==="/query-key"){s.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type","Access-Control-Max-Age":"86400"}),s.end();return}if(i.method==="POST"&&i.url==="/query-key"){let a="";i.on("data",l=>{a+=l}),i.on("end",async()=>{try{let l=await mt(e);s.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}),s.end(JSON.stringify({status:"0",data:{tokenSerialNo:l}}))}catch(l){s.writeHead(200,{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}),s.end(JSON.stringify({status:"1",msg:l.message}))}});return}s.writeHead(404),s.end("Not Found")});o.listen(t,"127.0.0.1",()=>{let s=o.address().port;console.log(`\u672C\u5730\u4EE3\u7406\u670D\u52A1\u5668\u542F\u52A8: http://127.0.0.1:${s}`),r({url:`http://127.0.0.1:${s}`,server:o})}),o.on("error",n)})}function tu(e,t=""){let r=new URLSearchParams;return r.set("token",e),t&&r.set("proxyUrl",t),`https://apicdn.app.gtht.com/web2/jh-static-QRCode/?${r.toString()}`}async function os(){let e=J.includes("--reauth");if(es&&!zc&&!ts&&(Jc||rs)&&console.log("\u63D0\u793A: \u5F53\u524D\u4E3A\u684C\u9762\u7CFB\u7EDF\uFF0C\u672C\u6B21\u5DF2\u5FFD\u7565\u73AF\u5883\u53D8\u91CF CHANNEL_MODE/QR_RENDER\uFF0C\u6309\u672C\u5730\u6D4F\u89C8\u5668\u6388\u6743\u6D41\u7A0B\u6267\u884C\u3002"),!(Zi&&gt)&&!e&&Kc()){let s=$c();console.log(`
\u2713 \u5DF2\u5728\u6388\u6743\u6587\u4EF6\u4E2D\u68C0\u6D4B\u5230\u5DF2\u4FDD\u5B58\u7684 API Key\uFF0C\u65E0\u9700\u91CD\u590D\u626B\u7801\u6388\u6743\u3002`),console.log(`  \u6587\u4EF6\u8DEF\u5F84: ${s}`),console.log(`  \u5982\u9700\u5F3A\u5236\u91CD\u65B0\u6388\u6743\uFF0C\u8BF7\u8FFD\u52A0\u53C2\u6570: --reauth
`),process.exit(0)}if(Zi&&gt){if(!Ir){console.error("\u274C \u7F3A\u5C11 --device-id \u53C2\u6570"),console.error("\u7528\u6CD5: node min/show_qr.js --channel --poll --device-id <\u8BBE\u5907ID>"),process.exit(1);return}console.log(`
========================================`),console.log("  \u72EC\u7ACB\u8F6E\u8BE2\u6A21\u5F0F"),console.log("========================================"),console.log(`Device ID: ${Ir}`),console.log(`
\u23F3 \u8F6E\u8BE2\u5DF2\u542F\u52A8\uFF085\u5206\u949F\u8D85\u65F6\uFF09`);let s=0,a=100,l=setInterval(async()=>{s++;let c=3*s;process.stdout.write(`\r\u25B6 [${s}/${a}] \u7B49\u5F85\u6388\u6743\u786E\u8BA4 (${c}\u79D2)   `);try{let u=await mt(Ir);Pr(u),clearInterval(l),console.log(`

`),console.log([REDACTED_SECRET]),console.log("  \u2713 \u6388\u6743\u6210\u529F\uFF01API Key \u5DF2\u4FDD\u5B58"),console.log("========================================"),console.log(`
\u53EF\u4EE5\u5F00\u59CB\u4F7F\u7528\u8BC1\u5238\u5DE5\u5177\u4E86\uFF01`),process.exit(0)}catch(u){String(u.message||"").includes("\u67E5\u8BE2key\u5931\u8D25")||(process.stdout.write(`
`),console.error(`\u274C \u6388\u6743\u7ED3\u679C\u5904\u7406\u5931\u8D25: ${u.message}`)),s>=a&&(clearInterval(l),console.log(`

========================================`),console.log("  \u274C \u6388\u6743\u8D85\u65F6\uFF085\u5206\u949F\uFF09"),console.log("  \u8BF7\u91CD\u65B0\u8FD0\u884C\u6388\u6743"),console.log([REDACTED_SECRET]),process.exit(1))}},3e3);return}let t=pt.generateAuthQRCode(),r=ns(),n=Math.floor(Date.now()/1e3),o=pt.generateRandomChars(),i=pt.extractDeviceId(t.qrbody);if(jc.deviceId=i,console.log(`
--- \u4E8C\u7EF4\u7801\u5185\u5BB9\u4FE1\u606F ---`),console.log(`MAC \u5730\u5740:    ${r}`),console.log(`UTC \u65F6\u95F4\u6233:  ${n}`),console.log(`5\u4F4D\u968F\u673A\u5B57\u7B26: ${o}`),console.log(`\u5B8C\u6574\u5185\u5BB9:    ${t.qrbody}`),console.log(`Device ID:   ${i}`),gt||Vc){console.log(`
========================================`),console.log("  \u6388\u6743\u4E8C\u7EF4\u7801\u751F\u6210\u4E2D...  "),console.log(`========================================
`);let s=tu(i);if(gt)return console.log(`\u8BF7\u70B9\u51FB\u4EE5\u4E0B\u94FE\u63A5\u626B\u7801\u4E8C\u7EF4\u7801\uFF1A${s}`),console.log(`token: ${i}`),Xc(),Wi?(console.log(`\u7528\u6237\u56DE\u590D\u6388\u6743\u6210\u529F\u540E\uFF0C\u8BF7\u6267\u884C\uFF1Anode skill-entry.js authChecker poll ${i}`),{mode:"qr-only",deviceId:i,authPageUrl:s}):(console.log("\u626B\u7801\u540E\u8BF7\u5728\u624B\u673A\u4E0A\u786E\u8BA4\u6388\u6743"),console.log("\u6388\u6743\u6210\u529F\u540E\u7A0B\u5E8F\u4F1A\u81EA\u52A8\u8F6E\u8BE2\u5E76\u751F\u6210\u6388\u6743\u6587\u4EF6..."),console.log(`
\u23F3 \u8F6E\u8BE2\u5DF2\u542F\u52A8\uFF085\u5206\u949F\u8D85\u65F6\uFF09`),{apiKey:await ru(i,{statusLabel:"\u7B49\u5F85\u6388\u6743\u786E\u8BA4"}),deviceId:i,authPageUrl:s,mode:"channel"});if(console.log(`\u8BF7\u7ED9\u7528\u6237\u5C55\u793A\u4EE5\u4E0B\u5730\u5740\u53BB\u626B\u4E8C\u7EF4\u7801\uFF1A${s}`),console.log(`Device ID: ${i}`),Wi){console.log(`
\u8BF7\u4F7F\u7528\u56FD\u6CF0\u6D77\u901A\u541B\u5F18APP\uFF089.21.12\u7248\u53CA\u4EE5\u4E0A\uFF09\uFF0C\u6216\u56FD\u6CF0\u6D77\u901A\u7075\u7280APP\uFF089.21.12\u7248\u53CA\u4EE5\u4E0A\uFF09\u626B\u7801\u6388\u6743`),console.log("\u626B\u7801\u540E\u8BF7\u5728\u624B\u673A\u4E0A\u786E\u8BA4\u6388\u6743"),console.log("\u6388\u6743\u6210\u529F\u540E\u544A\u77E5 Agent \u8FDB\u884C\u8F6E\u8BE2");return}console.log(`
\u8BF7\u4F7F\u7528\u56FD\u6CF0\u6D77\u901A\u541B\u5F18APP\uFF089.21.12\u7248\u53CA\u4EE5\u4E0A\uFF09\uFF0C\u6216\u56FD\u6CF0\u6D77\u901A\u7075\u7280APP\uFF089.21.12\u7248\u53CA\u4EE5\u4E0A\uFF09\u626B\u7801\u6388\u6743`),console.log("\u626B\u7801\u540E\u8BF7\u5728\u624B\u673A\u4E0A\u786E\u8BA4\u6388\u6743"),console.log("\u6388\u6743\u6210\u529F\u540E\u7A0B\u5E8F\u4F1A\u81EA\u52A8\u7EE7\u7EED..."),console.log(`
\u23F3 \u8F6E\u8BE2\u5DF2\u542F\u52A8\uFF085\u5206\u949F\u8D85\u65F6\uFF09`);let a=0,l=100,c=setInterval(async()=>{a++;let u=3*a;process.stdout.write(`\r\u25B6 [${a}/${l}] \u7B49\u5F85\u626B\u7801 (${u}\u79D2)   `);try{let f=await mt(i);Pr(f),clearInterval(c),console.log(`

`),console.log([REDACTED_SECRET]),console.log("  \u2713 \u6388\u6743\u6210\u529F\uFF01API Key \u5DF2\u4FDD\u5B58"),console.log("========================================"),console.log(`
\u53EF\u4EE5\u5F00\u59CB\u4F7F\u7528\u8BC1\u5238\u5DE5\u5177\u4E86\uFF01`),process.exit(0)}catch(f){String(f.message||"").includes("\u67E5\u8BE2key\u5931\u8D25")||(process.stdout.write(`
`),console.error(`\u274C \u6388\u6743\u7ED3\u679C\u5904\u7406\u5931\u8D25: ${f.message}`)),a>=l&&(clearInterval(c),console.log(`

========================================`),console.log("  \u274C \u6388\u6743\u8D85\u65F6\uFF085\u5206\u949F\uFF09"),console.log("  \u8BF7\u91CD\u65B0\u8FD0\u884C\u6388\u6743"),console.log([REDACTED_SECRET]),process.exit(1))}},3e3)}}async function ru(e,t={}){let{maxAttempts:r=100,intervalMs:n=3e3,statusLabel:o="\u7B49\u5F85\u626B\u7801"}=t;for(let i=1;i<=r;i+=1){let s=Math.floor(n/1e3)*i;process.stdout.write(`\r\u25B6 [${i}/${r}] ${o} (${s}\u79D2)   `);try{let a=await mt(e);return Pr(a),process.stdout.write(`

`),console.log([REDACTED_SECRET]),console.log("  \u2713 \u6388\u6743\u6210\u529F\uFF01API Key \u5DF2\u4FDD\u5B58"),console.log("========================================"),console.log(`
\u53EF\u4EE5\u5F00\u59CB\u4F7F\u7528\u8BC1\u5238\u5DE5\u5177\u4E86\uFF01`),a}catch(a){String(a.message||"").includes("\u67E5\u8BE2key\u5931\u8D25")||(process.stdout.write(`
`),console.error(`\u274C \u6388\u6743\u7ED3\u679C\u5904\u7406\u5931\u8D25: ${a.message}`)),i<r&&await nu(n)}}throw new Error("\u6388\u6743\u8D85\u65F6\uFF085\u5206\u949F\uFF09")}function nu(e){return new Promise(t=>setTimeout(t,e))}kr.exports={getMacAddress:ns,renderQRCode:Wc,generateQRDataURL:Zc,startProxyServer:eu,queryViaProxy:Yc,main:os};require.main===kr&&os().catch(e=>{console.error(e?.message||e),process.exit(1)})});var Qe=d((rh,Rr)=>{var ss=require("fs"),Xf=require("path"),ou=require("http"),eh=require("https"),{saveApiKey:yt,getApiKey:iu,resolveAuthConfigFile:su}=ye(),{queryKeyFromClawServer:Br}=Pt(),th=ke(),de={host:"localhost",port:9999,path:"/check_auth",checkInterval:3e3,timeout:12e4};function Ue(){try{return iu()}catch(e){console.error("\u52A0\u8F7D\u914D\u7F6E\u6587\u4EF6\u5931\u8D25:",e.message)}return null}function as(e,t,r){let n=t||de.host,o=r||de.port;return new Promise((i,s)=>{let a={hostname:n,port:o,path:`${de.path}?session_id=${e}`,method:"GET",timeout:5e3},l=ou.request(a,c=>{let u="";c.on("data",f=>{u+=f}),c.on("end",()=>{try{let f=JSON.parse(u);i(f)}catch{s(new Error(`\u89E3\u6790\u54CD\u5E94\u5931\u8D25: ${u}`))}})});l.on("error",c=>{s(new Error(`\u8BF7\u6C42\u5931\u8D25: ${c.message}`))}),l.on("timeout",()=>{l.destroy(),s(new Error("\u8BF7\u6C42\u8D85\u65F6"))}),l.end()})}async function au(e,t={}){let r=t.interval||de.checkInterval,n=t.timeout||de.timeout,o=t.onProgress||(()=>{}),i=t.customHost||de.host,s=t.customPort||de.port,a=Date.now(),l=0;for(;Date.now()-a<n;){l++;try{let c=await as(e,i,s),u=null;if(c["api-key"]?u=c["api-key"]:c.api_key?u=c.[REDACTED_SECRET]"api-key"]?u=c.result["api-key"]:c.result&&c.result.api_key&&(u=c.result.api_key),u&&String(u).trim()!==""){let f=String(u).trim();return yt(f),console.log(`
\u2713 \u6388\u6743\u6210\u529F\uFF01\u5DF2\u83B7\u53D6 API Key`),console.log("\u539F\u59CB\u54CD\u5E94:",JSON.stringify(c)),f}if(c.status==="failed"||c.error||c.result&&c.result.status==="failed")throw new Error(c.error||c.result?.error||"\u6388\u6743\u5931\u8D25")}catch(c){if(c.message==="\u6388\u6743\u5931\u8D25"||c.message.includes("\u6388\u6743")&&!c.message.includes("expired"))throw c}o(l),await new Promise(c=>setTimeout(c,r))}throw new Error(`\u6388\u6743\u8D85\u65F6: \u5728 ${n/1e3} \u79D2\u5185\u672A\u6536\u5230\u6388\u6743\u54CD\u5E94`)}function Sr(){let e=Ue();return e!==null&&e.trim()!==""}async function lu(e={}){if(Sr()){let s=Ue();return console.log("\u2713 \u5DF2\u6709\u6709\u6548\u7684 API Key\uFF0C\u65E0\u9700\u91CD\u65B0\u6388\u6743"),s}let t=dt();console.log(`
=== \u6388\u6743\u6D41\u7A0B ===
`);let r=t.generateAuthQRCode(),n=t.extractDeviceId(r.qrbody);console.log("QR Body:",r.qrbody),console.log("Device ID:",n),console.log("Session ID:",r.sessionId),console.log(""),t.displayAdaptiveQRCode(r.qrbody),console.log(`
\u{1F4F1} \u8BF7\u4F7F\u7528\u6388\u6743 APP \u626B\u63CF\u4E0A\u65B9\u4E8C\u7EF4\u7801\u8FDB\u884C\u6388\u6743`),console.log(`\u23F3 \u7CFB\u7EDF\u6B63\u5728\u8F6E\u8BE2\u6821\u9A8C\u63A5\u53E3...
`);let o=0,i=20;for(;o<i;){o++;try{let s=await Br(n);return yt(s),console.log(`
\u2713 \u6388\u6743\u6210\u529F\uFF01\u5DF2\u83B7\u53D6 API Key`),console.log("\u539F\u59CB\u54CD\u5E94:",s),s}catch{process.stdout.write(`\r\u8F6E\u8BE2\u4E2D... (${3*o}\u79D2)  `),await new Promise(a=>setTimeout(a,3e3))}if(o>=i)throw new Error("\u6388\u6743\u8D85\u65F6: \u8BBE\u5907\u4E0D\u5B58\u5728\uFF0C\u8BF7\u786E\u4FDD\u5DF2\u626B\u7801")}}function cu(e={}){let t=Ue();if(!t)throw new Error("\u672A\u6388\u6743: \u8BF7\u5148\u6267\u884C\u6388\u6743\u6D41\u7A0B\u83B7\u53D6 API Key");return{...e,"api-key":t}}function ls(){try{let e=su();ss.existsSync(e)?(ss.unlinkSync(e),console.log("\u2713 \u6388\u6743\u5DF2\u6E05\u9664")):console.log("\u2713 \u672A\u627E\u5230\u6388\u6743\u6587\u4EF6")}catch(e){console.error("\u6E05\u9664\u6388\u6743\u5931\u8D25:",e.message)}}async function cs(){let e=process.argv[2];if(e==="help"||!e){console.log(`
\u6388\u6743\u68C0\u67E5\u6A21\u5757
============

\u7528\u6CD5:
  node auth-checker.js check           # \u68C0\u67E5\u6388\u6743\u72B6\u6001
  node auth-checker.js poll <sessionId> # \u8F6E\u8BE2\u6388\u6743\u670D\u52A1\u5668
  node auth-checker.js auth             # \u6267\u884C\u5B8C\u6574\u6388\u6743\u6D41\u7A0B
  node auth-checker.js clear            # \u6E05\u9664\u6388\u6743
  node auth-checker.js help            # \u663E\u793A\u5E2E\u52A9\u4FE1\u606F

\u8BF4\u660E:
  - check: \u68C0\u67E5\u5F53\u524D\u662F\u5426\u5DF2\u6388\u6743
  - poll: \u4F7F\u7528\u6307\u5B9A\u7684 Session ID \u8F6E\u8BE2\u6388\u6743\u670D\u52A1\u5668
  - auth: \u751F\u6210\u4E8C\u7EF4\u7801\u5E76\u6267\u884C\u5B8C\u6574\u6388\u6743\u6D41\u7A0B
  - clear: \u5220\u9664\u4FDD\u5B58\u7684 API Key
`);return}if(e==="check"){if(Sr()){let t=Ue();console.log("\u2713 \u5DF2\u6388\u6743"),console.log(`API Key: ${t.substring(0,8)}...${t.substring(t.length-8)}`)}else console.log("\u2717 \u672A\u6388\u6743"),process.exit(1);return}if(e==="poll"){let t=process.argv[3];t||(console.error("\u9519\u8BEF: \u8BF7\u63D0\u4F9B url\u540E\u9762\u7684token"),process.exit(1));try{yt(await Br(t)),console.log(`
\u2713 \u6388\u6743\u6210\u529F\uFF01`)}catch(r){console.error(`
\u2717 ${r.message}`),process.exit(1)}return}if(e==="auth"){try{await is().main(),console.log(`
\u2713 \u6388\u6743\u6D41\u7A0B\u5B8C\u6210\uFF01`)}catch(t){console.error(`
\u2717 \u6388\u6743\u5931\u8D25: ${t.message}`),process.exit(1)}return}if(e==="clear"){ls();return}console.error(`\u672A\u77E5\u547D\u4EE4: ${e}`),process.exit(1)}Rr.exports={loadApiKey:Ue,saveApiKey:yt,checkAuthStatus:as,pollAuthServer:au,queryKeyFromClawServer:Br,isAuthorized:Sr,performAuthFlow:lu,addApiKeyToHeaders:cu,clearAuth:ls,main:cs};require.main===Rr&&cs().catch(e=>{console.error("\u9519\u8BEF:",e.message),process.exit(1)})});var ys=d((nh,vr)=>{var ie=Qe(),Lr=dt(),{saveApiKey:us,formatCliOutput:uu,parseJsonTextSafely:fu}=ye(),{loadGateways:hu}=Je(),{sendJsonRpcRequest:du}=It();function fs(e){if(e.error)return{error:e.error.message};if(e.result?.content){let t=e.result.content.find(r=>r.type==="text");if(t){let r=fu(t.text);return r!==null?r:{text:t.text}}}return e.result||e}function hs(e){let t={},r=new Set(["stocks","symbols","reduced_codes"]);function n(i){return{...i,market_data_mask:{mask:{M_64_0:549755813887}},product_mask:{mask:{M_64_0:111111}}}}function o(i){return Array.isArray(i)?i.map(s=>n(s&&typeof s=="object"?s:{code:String(s).trim()})).filter(s=>s.code):typeof i=="string"?i.split(",").map(s=>s.trim()).filter(s=>s!=="").map(s=>n({code:s})):[]}return e.forEach(i=>{let s="",a="",l=i.indexOf("=");if(l>0)s=i.substring(0,l),a=i.substring(l+1);else if(i.startsWith("reduced_codes:")){let c=i.indexOf(":");s=i.substring(0,c),a=i.substring(c+1)}if(s){if(s==="reduced_codes"){let u=a.trim();if(u.startsWith("[")||u.startsWith("{"))try{t[s]=o(JSON.parse(u));return}catch{}}if(a.startsWith("[")||a.startsWith("{"))try{let u=JSON.parse(a);t[s]=u;return}catch{}let c=a.includes(",")?a.split(",").map(u=>u.trim()).filter(u=>u!==""):[a];if(Object.prototype.hasOwnProperty.call(t,s)){let u=Array.isArray(t[s])?t[s]:[t[s]];t[s]=u.concat(c)}else t[s]=c.length===1?c[0]:c;r.has(s)&&!Array.isArray(t[s])&&(t[s]=[t[s]]),s==="reduced_codes"&&(t[s]=o(t[s]))}}),t}async function ds(e,t,r={}){let n=hu(),o=n[e];if(!o)throw new Error(`\u672A\u77E5\u7F51\u5173: ${e}\uFF0C\u53EF\u7528\u7F51\u5173: ${Object.keys(n).join(", ")}`);try{let l=ie.loadApiKey();if(!l||l.trim()==="")throw new Error('\u672A\u6388\u6743: \u8BF7\u5148\u8FD0\u884C "node mcp-client.js auth" \u5B8C\u6210\u6388\u6743')}catch(l){throw new Error(`\u6388\u6743\u68C0\u67E5\u5931\u8D25: ${l.message}`)}let i=ie.addApiKeyToHeaders({}),a=await du(o,"tools/call",{name:t,arguments:r},i);if(a.error)throw new Error(`\u5DE5\u5177\u8C03\u7528\u5931\u8D25: ${a.error.message}`);return fs(a)}function gu(){console.log(`
MCP \u5DE5\u5177\u8C03\u7528\u811A\u672C
=================

\u7528\u6CD5:
  node mcp-client.js call <gateway> <toolName> [key=value ...]
  node mcp-client.js auth              # \u6267\u884C\u6388\u6743\u6D41\u7A0B(\u963B\u585E\u6A21\u5F0F)
  node mcp-client.js auth-qr           # \u663E\u793A\u4E8C\u7EF4\u7801(\u975E\u963B\u585E\u6A21\u5F0F,\u63A8\u8350)
  node mcp-client.js auth-info         # \u8F93\u51FA\u6388\u6743\u4FE1\u606F\u5E76\u540E\u53F0\u8F6E\u8BE2
  node mcp-client.js check             # \u68C0\u67E5\u6388\u6743\u72B6\u6001
  node mcp-client.js clear             # \u6E05\u9664\u6388\u6743

\u793A\u4F8B:
  node mcp-client.js call market marketdata-tool code=SH600000
  node mcp-client.js call info get_hotRank
`)}async function gs(){try{let e=Lr.generateAuthQRCode();console.log(`
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557`),console.log("\u2551                       \u6388\u6743\u4FE1\u606F                              \u2551"),console.log("\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563"),console.log(`\u2551  QR Body: ${e.qrbody}`),console.log(`\u2551  Session ID: ${e.sessionId}`),console.log(`\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
`),ie.pollAuthServer(e.sessionId).then(t=>{us(t),console.log(`
\u2713 \u6388\u6743\u6210\u529F! API Key \u5DF2\u4FDD\u5B58`)}).catch(t=>{t.message.includes("\u8D85\u65F6")||console.error(`
\u2717 ${t.message}`)}),console.log(`\u6388\u6743\u6D41\u7A0B\u5DF2\u542F\u52A8, \u540E\u53F0\u6B63\u5728\u8F6E\u8BE2\u6388\u6743\u670D\u52A1\u5668...
`)}catch(e){console.error(`\u83B7\u53D6\u6388\u6743\u4FE1\u606F\u5931\u8D25: ${e.message}`),process.exit(1)}}async function ps(){try{let e=Lr.generateAuthQRCode();console.log(`
=== \u6388\u6743\u4E8C\u7EF4\u7801 ===
`),console.log("QR Body:",e.qrbody),console.log("Session ID:",e.sessionId),console.log(""),Lr.displayAdaptiveQRCode(e.qrbody),console.log(`
\u{1F4F1} \u8BF7\u4F7F\u7528\u6388\u6743 APP \u626B\u63CF\u4E0A\u65B9\u4E8C\u7EF4\u7801`),console.log("\u23F3 \u7CFB\u7EDF\u6B63\u5728\u540E\u53F0\u8F6E\u8BE2\u6388\u6743\u670D\u52A1\u5668..."),console.log(""),ie.pollAuthServer(e.sessionId).then(t=>{us(t),console.log("\u2713 \u6388\u6743\u6210\u529F! API Key \u5DF2\u4FDD\u5B58")}).catch(t=>{console.error(`
\u2717 ${t.message}`)}),console.log(`\u6388\u6743\u6D41\u7A0B\u5DF2\u542F\u52A8, \u8BF7\u626B\u63CF\u4E8C\u7EF4\u7801...
`)}catch(e){console.error(`\u6388\u6743\u5931\u8D25: ${e.message}`),process.exit(1)}}async function ms(){let e=process.argv.slice(2),t=e[0];if(!t||t==="help"){gu();return}if(t==="auth"){try{await ie.performAuthFlow(),console.log(`
\u6388\u6743\u5B8C\u6210\uFF01`)}catch(r){console.error(`\u6388\u6743\u5931\u8D25: ${r.message}`),process.exit(1)}return}if(t==="auth-qr"){await ps();return}if(t==="auth-info"){await gs();return}if(t==="check"){if(ie.isAuthorized()){let r=ie.loadApiKey();console.log("\u2713 \u5DF2\u6388\u6743"),console.log(`API Key: ${r.substring(0,8)}...${r.substring(r.length-8)}`)}else console.log("\u2717 \u672A\u6388\u6743"),console.log("\u8BF7\u8FD0\u884C: node mcp-client.js auth"),process.exit(1);return}if(t==="clear"){ie.clearAuth();return}if(t==="call"){try{let r=String(e[1]||"").trim(),n=String(e[2]||"").trim();if(!r||!n)throw new Error("\u7528\u6CD5: node mcp-client.js call <gateway> <toolName> [key=value ...]");let o=hs(e.slice(3)),i=await ds(r,n,o);console.log(uu(r,n,i))}catch(r){console.error(JSON.stringify({error:r.message})),process.exit(1)}return}console.error(`\u672A\u77E5\u547D\u4EE4: ${t}\uFF0C\u8BF7\u4F7F\u7528 help \u67E5\u770B\u5E2E\u52A9`),process.exit(1)}vr.exports={parseResponse:fs,parseKvArgs:hs,callTool:ds,handleAuthInfo:gs,handleAuthQr:ps,main:ms};require.main===vr&&ms().catch(e=>{console.error(JSON.stringify({error:e.message})),process.exit(1)})});var Es=d((oh,Nr)=>{var pu=require("fs"),mu=require("path");function _s(){let e=mu.join(__dirname,"stock_code_name.json"),t=pu.readFileSync(e,"utf8"),r=JSON.parse(t);if(!Array.isArray(r))throw new Error("stock_code_name.json \u5E94\u4E3A { code, name }[] \u6570\u7EC4");let n={},o={};for(let i=0;i<r.length;i++){let s=r[i];if(!s||typeof s!="object")continue;let a=String(s.code??"").trim(),l=String(s.name??"").trim();a&&l&&(n[l]=a,o[a]=l)}return{nameToCode:n,codeToName:o}}function ws(e,t){return t.nameToCode[e]||null}function As(e,t){return t.codeToName[e]||null}Nr.exports={loadStockMapping:_s,findCodeByName:ws,findNameByCode:As};if(require.main===Nr){let e=_s();console.log("\u6620\u5C04\u8868\u52A0\u8F7D\u6210\u529F\uFF0C\u5171",Object.keys(e.codeToName).length,"\u6761\u8BB0\u5F55");let t=["\u56FD\u6CF0\u6D77\u901A","\u5E73\u5B89\u94F6\u884C","\u8D35\u5DDE\u8305\u53F0","\u6D66\u53D1\u94F6\u884C"];console.log(`
\u540D\u79F0\u67E5\u8BE2\u6D4B\u8BD5:`),t.forEach(n=>{let o=ws(n,e);console.log(`  ${n} -> ${o||"\u672A\u627E\u5230"}`)});let r=["SH601211","SZ000001","SH600519"];console.log(`
\u4EE3\u7801\u67E5\u8BE2\u6D4B\u8BD5:`),r.forEach(n=>{let o=As(n,e);console.log(`  ${n} -> ${o||"\u672A\u627E\u5230"}`)})}});var Mr=Qe(),Pe=ys(),_t=Es(),Ts={isAuthorized:Mr.isAuthorized,checkAuthStatus:Mr.checkAuthStatus,main:Mr.main},bs={callTool:Pe.callTool,parseKvArgs:Pe.parseKvArgs,parseResponse:Pe.parseResponse,handleAuthInfo:Pe.handleAuthInfo,handleAuthQr:Pe.handleAuthQr,main:Pe.main},yu={authChecker:Ts.main,mcpClient:bs.main,stockMap:Cs,stock_map:Cs};function _u(){console.log(`
    stock_map \u7528\u6CD5:
      node index.js stockMap codeByName <\u80A1\u7968\u540D\u79F0>
      node index.js stockMap nameByCode <\u80A1\u7968\u4EE3\u7801>
      node index.js stockMap stats

    \u793A\u4F8B:
      node index.js stockMap codeByName \u8D35\u5DDE\u8305\u53F0
      node index.js stockMap nameByCode SH600519
      node index.js stockMap stats
  `)}async function Cs(e=[]){let t=e[0];if(!t||t==="help"||t==="--help"||t==="-h"){_u();return}let r=_t.loadStockMapping();if(t==="codeByName"){let n=e.slice(1).join(" ").trim();if(!n)throw new Error("\u7528\u6CD5: node index.js stockMap codeByName <\u80A1\u7968\u540D\u79F0>");let o=_t.findCodeByName(n,r);console.log(o||"\u672A\u627E\u5230");return}if(t==="nameByCode"){let n=(e[1]||"").trim();if(!n)throw new Error("\u7528\u6CD5: node index.js stockMap nameByCode <\u80A1\u7968\u4EE3\u7801>");let o=_t.findNameByCode(n,r);console.log(o||"\u672A\u627E\u5230");return}if(t==="stats"){console.log(Object.keys(r.codeToName).length);return}throw new Error(`\u672A\u77E5 stockMap \u547D\u4EE4: ${t}`)}function wu(){console.log(`
    \u7528\u6CD5:
      node skill-entry.js <\u6A21\u5757\u540D> [\u53C2\u6570...]

    \u53EF\u9009\u6A21\u5757:
     authChecker
     mcpClient
     stockMap
  `)}async function Is(e=process.argv.slice(2)){let t=e[0],r=e.slice(1);if(!t||t==="help"||t==="--help"||t==="-h"){wu();return}let n=yu[t];if(typeof n!="function")throw new Error(`\u672A\u77E5\u6A21\u5757: ${t}`);let o=process.argv;process.argv=[o[0],o[1],...r];try{await n(r)}finally{process.argv=o}}module.exports={authChecker:Ts,mcpClient:bs,stock_map:_t,runCli:Is};require.main===module&&Is().catch(e=>{console.error(`\u9519\u8BEF: ${e.message}`),process.exit(1)});


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)