diff --git a/.github/workflows/build-base-image.yml b/.github/workflows/build-base-image.yml index 7b6fec6b..03c45954 100644 --- a/.github/workflows/build-base-image.yml +++ b/.github/workflows/build-base-image.yml @@ -37,7 +37,7 @@ jobs: file: Dockerfile-server-base push: true tags: ghcr.io/${{ github.repository }}:server-base - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 cache-from: type=gha,scope=server-base cache-to: type=gha,mode=max,scope=server-base build-args: | diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index f795fd5a..7fe789b7 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -66,7 +66,7 @@ jobs: push: true tags: | ${{ env.IS_VERSION == 'true' && format('ghcr.io/{0}:server_{1},ghcr.io/{0}:server_latest', github.repository, env.VERSION) || format('ghcr.io/{0}:server_latest', github.repository) }} - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max build-args: | @@ -81,7 +81,7 @@ jobs: push: true tags: | ${{ env.IS_VERSION == 'true' && format('ghcr.io/{0}:web_{1},ghcr.io/{0}:web_latest', github.repository, env.VERSION) || format('ghcr.io/{0}:web_latest', github.repository) }} - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max build-args: | diff --git a/Dockerfile-web b/Dockerfile-web index 583d2e6b..fd0eb017 100644 --- a/Dockerfile-web +++ b/Dockerfile-web @@ -1,5 +1,5 @@ # 第一阶段:构建Vue前端 -FROM node:18 as web-builder +FROM node:18 AS web-builder WORKDIR /app COPY main/manager-web/package*.json ./ RUN npm install @@ -7,7 +7,7 @@ COPY main/manager-web . RUN npm run build # 第二阶段:构建Java后端 -FROM maven:3.9.4-eclipse-temurin-21 as api-builder +FROM maven:3.9.4-eclipse-temurin-21 AS api-builder WORKDIR /app COPY main/manager-api/pom.xml . COPY main/manager-api/src ./src @@ -18,18 +18,19 @@ FROM bellsoft/liberica-runtime-container:jre-21-glibc # 安装Nginx和字体库 RUN apk update && \ - apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \ + apk add --no-cache --no-scripts \ nginx \ bash \ fontconfig \ ttf-dejavu \ - msttcorefonts-installer \ - && ACCEPT_EULA=Y apk add --no-cache msttcorefonts-installer \ - && fc-cache -f -v \ - && rm -rf /var/cache/apk/* + && rm -rf /var/cache/apk/* \ + && mkdir -p /run/nginx /var/log/nginx /var/tmp/nginx /etc/nginx/conf.d + +# 复制项目自带的中文字体 +COPY main/manager-web/public/generator/static/fonts/*.ttf /usr/share/fonts/ # 更新字体缓存 -RUN (printf 'YES\n' | update-ms-fonts || true) && fc-cache -f -v +RUN fc-cache -f -v # 配置Nginx COPY docs/docker/nginx.conf /etc/nginx/nginx.conf diff --git a/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java b/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java index 8bd59229..fe71c05f 100644 --- a/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java +++ b/main/manager-api/src/main/java/xiaozhi/common/constant/Constant.java @@ -304,7 +304,7 @@ public interface Constant { /** * 版本号 */ - public static final String VERSION = "0.8.11"; + public static final String VERSION = "0.9.1"; /** * 无效固件URL diff --git a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java index 3237e22c..5485e425 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/agent/service/impl/AgentServiceImpl.java @@ -1,6 +1,12 @@ package xiaozhi.modules.agent.service.impl; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; import java.util.function.Function; import java.util.stream.Collectors; @@ -81,9 +87,9 @@ public class AgentServiceImpl extends BaseServiceImpl imp if (agent.getMemModelId() != null && agent.getMemModelId().equals(Constant.MEMORY_NO_MEM)) { agent.setChatHistoryConf(Constant.ChatHistoryConfEnum.IGNORE.getCode()); - if (agent.getChatHistoryConf() == null) { - agent.setChatHistoryConf(Constant.ChatHistoryConfEnum.RECORD_TEXT_AUDIO.getCode()); - } + } + if (agent.getChatHistoryConf() == null) { + agent.setChatHistoryConf(Constant.ChatHistoryConfEnum.RECORD_TEXT_AUDIO.getCode()); } // 查询上下文源配置 @@ -132,7 +138,8 @@ public class AgentServiceImpl extends BaseServiceImpl imp if (StringUtils.isNotBlank(keyword)) { if ("mac".equals(searchType)) { // 按MAC地址搜索:先搜索设备,再获取对应的智能体 - List devices = Optional.ofNullable(deviceService.searchDevicesByMacAddress(keyword, userId)).orElseGet(ArrayList::new); + List devices = Optional + .ofNullable(deviceService.searchDevicesByMacAddress(keyword, userId)).orElseGet(ArrayList::new); // 获取设备对应的智能体ID列表 List agentIds = devices.stream() .map(DeviceEntity::getAgentId) diff --git a/main/manager-api/src/main/resources/db/changelog/202601141645.sql b/main/manager-api/src/main/resources/db/changelog/202601141645.sql new file mode 100644 index 00000000..8b0fca88 --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202601141645.sql @@ -0,0 +1,31 @@ +-- 批量清理 ai_model_provider 中的 sample_rate 字段定义 +UPDATE `ai_model_provider` ap +JOIN ( + SELECT + id, + JSON_ARRAYAGG( + JSON_OBJECT('key', jt.k, 'label', jt.l, 'type', jt.t) + ) AS new_fields + FROM `ai_model_provider`, + JSON_TABLE(`fields`, '$[*]' COLUMNS ( + k VARCHAR(50) PATH '$.key', + l VARCHAR(100) PATH '$.label', + t VARCHAR(20) PATH '$.type' + )) AS jt + WHERE `model_type` = 'TTS' + AND jt.k != 'sample_rate' + GROUP BY id +) filtered ON ap.id = filtered.id +SET ap.fields = filtered.new_fields; + +-- 清理 config_json 顶层的 sample_rate +UPDATE `ai_model_config` +SET `config_json` = JSON_REMOVE(`config_json`, '$.sample_rate') +WHERE `model_type` = 'TTS' + AND JSON_EXTRACT(`config_json`, '$.sample_rate') IS NOT NULL; + +-- 清理Minimax流式TTS的sample_rate参数(位于audio_setting内部) +UPDATE `ai_model_config` SET +`config_json` = JSON_SET(`config_json`, '$.audio_setting', JSON_REMOVE(JSON_EXTRACT(`config_json`, '$.audio_setting'), '$.sample_rate')) +WHERE `id` = 'TTS_MinimaxStreamTTS' +AND JSON_EXTRACT(`config_json`, '$.audio_setting.sample_rate') IS NOT NULL; \ No newline at end of file diff --git a/main/manager-api/src/main/resources/db/changelog/202601231530.sql b/main/manager-api/src/main/resources/db/changelog/202601231530.sql new file mode 100644 index 00000000..79be4310 --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202601231530.sql @@ -0,0 +1,87 @@ +-- 更新HuoshanDoubleStreamTTS供应器配置,将分散的参数改为JSON字典配置 +-- 将 speech_rate, loudness_rate, pitch, emotion, emotion_scale 等参数整合为 audio_params, additions, mix_speaker 三个JSON字典 + +UPDATE `ai_model_provider` +SET `fields` = '[ + {"key": "ws_url", "type": "string", "label": "WebSocket地址"}, + {"key": "appid", "type": "string", "label": "应用ID"}, + {"key": "access_token", "type": "string", "label": "访问令牌"}, + {"key": "resource_id", "type": "string", "label": "资源ID"}, + {"key": "speaker", "type": "string", "label": "默认音色"}, + {"key": "enable_ws_reuse", "type": "boolean", "label": "是否开启链接复用", "default": true}, + {"key": "audio_params", "type": "dict", "label": "音频输出配置"}, + {"key": "additions", "type": "dict", "label": "高级文本处理配置"}, + {"key": "mix_speaker", "type": "dict", "label": "混音控制配置"} +]' +WHERE `id` = 'SYSTEM_TTS_HSDSTTS'; + +-- 更新现有配置,将旧的分散参数迁移到新的JSON字典结构 +UPDATE `ai_model_config` +SET `config_json` = JSON_SET( + `config_json`, + '$.audio_params', JSON_OBJECT( + 'speech_rate', CAST(COALESCE(NULLIF(JSON_UNQUOTE(JSON_EXTRACT(`config_json`, '$.speech_rate')), ''), '0') AS SIGNED), + 'loudness_rate', CAST(COALESCE(NULLIF(JSON_UNQUOTE(JSON_EXTRACT(`config_json`, '$.loudness_rate')), ''), '0') AS SIGNED) + ), + '$.additions', JSON_OBJECT( + 'aigc_metadata', JSON_OBJECT(), + 'cache_config', JSON_OBJECT(), + 'post_process', JSON_OBJECT( + 'pitch', CAST(COALESCE(NULLIF(JSON_UNQUOTE(JSON_EXTRACT(`config_json`, '$.pitch')), ''), '0') AS SIGNED) + ) + ), + '$.mix_speaker', JSON_OBJECT() +) +WHERE `id` = 'TTS_HuoshanDoubleStreamTTS'; + +-- 删除旧的分散参数字段 +UPDATE `ai_model_config` +SET `config_json` = JSON_REMOVE( + `config_json`, + '$.speech_rate', + '$.loudness_rate', + '$.pitch', + '$.emotion', + '$.emotion_scale' +) +WHERE `id` = 'TTS_HuoshanDoubleStreamTTS'; + +-- 更新文档链接和备注说明 +UPDATE `ai_model_config` SET +`doc_link` = 'https://www.volcengine.com/docs/6561/1329505', +`remark` = '火山引擎双向流式TTS配置说明: +1. 访问 https://www.volcengine.com/ 注册并开通火山引擎账号 +2. 访问 https://console.volcengine.com/speech/service/10007 开通语音合成大模型,购买音色 +3. 在页面底部获取appid和access_token +4. 资源ID固定为:volc.service_type.10029(大模型语音合成及混音) +5. 链接复用:开启WebSocket连接复用,默认true减少链接损耗(注意:复用后设备处于聆听状态时空闲链接会占并发数) + +详细参数文档:https://www.volcengine.com/docs/6561/1329505 +【audio_params】音频输出配置 - 用户可自定义添加火山引擎支持的任何音频参数 + - speech_rate: 语速(-50~100),默认0 + - loudness_rate: 音量(-50~100),默认0 + - emotion: 情感类型(仅部分音色支持),可选值:neutral、happy、sad、angry、fearful、disgusted、surprised + - emotion_scale: 情感强度(1~5),默认4 + 示例:{"speech_rate": 10, "loudness_rate": 5, "emotion": "happy", "emotion_scale": 4} + +【additions】高级文本处理配置 - 用户可自定义添加火山引擎支持的任何高级参数 + - post_process.pitch: 音高(-12~12),默认0 + - aigc_metadata: AIGC元数据配置 + - cache_config: 缓存配置 + 示例:{"post_process": {"pitch": 2}, "aigc_metadata": {}, "cache_config": {}} + +【mix_speaker】混音控制配置 - 多音色混合(仅 TTS 1.0) + 示例: + {"speakers": [ + {"source_speaker": "zh_male_bvlazysheep","mix_factor": 0.3}, + {"source_speaker": "BV120_streaming","mix_factor": 0.3}, + {"source_speaker": "zh_male_ahu_conversation_wvae_bigtts","mix_factor": 0.4} + ]} + +注意: +- 多情感音色参数(emotion、emotion_scale)仅部分音色支持 +- 相关音色列表:https://www.volcengine.com/docs/6561/1257544 +- 用户可根据火山引擎API文档自行添加更多参数 +- 混音功能主要适用于豆包语音合成模型1.0的音色,使用时需要将req_params.speaker设置为custom_mix_bigtts +' +WHERE `id` = 'TTS_HuoshanDoubleStreamTTS'; diff --git a/main/manager-api/src/main/resources/db/changelog/202601261730.sql b/main/manager-api/src/main/resources/db/changelog/202601261730.sql new file mode 100644 index 00000000..5c2238ad --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202601261730.sql @@ -0,0 +1,14 @@ +-- 更新小智参数中的默认采样率从 16000 改为 24000 +UPDATE `sys_params` +SET `param_value` = '{ + "type": "hello", + "version": 1, + "transport": "websocket", + "audio_params": { + "format": "opus", + "sample_rate": 24000, + "channels": 1, + "frame_duration": 60 + } +}' +WHERE `id` = 309 AND `param_code` = 'xiaozhi'; diff --git a/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml b/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml index c52acf97..f606af77 100755 --- a/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml @@ -487,6 +487,27 @@ databaseChangeLog: - sqlFile: encoding: utf8 path: classpath:db/changelog/202601051433.sql + - changeSet: + id: 202601141645 + author: RanChen + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202601141645.sql + - changeSet: + id: 202601231530 + author: RanChen + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202601231530.sql + - changeSet: + id: 202601261730 + author: RanChen + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202601261730.sql - changeSet: id: 202601291552 author: shengzhou1216 diff --git a/main/manager-mobile/src/pages/settings/index.vue b/main/manager-mobile/src/pages/settings/index.vue index ae4f71ef..02436948 100644 --- a/main/manager-mobile/src/pages/settings/index.vue +++ b/main/manager-mobile/src/pages/settings/index.vue @@ -235,7 +235,7 @@ function showAbout() { title: t('settings.aboutApp', { appName: import.meta.env.VITE_APP_TITLE }), content: t('settings.aboutContent', { appName: import.meta.env.VITE_APP_TITLE, - version: '0.8.11' + version: '0.9.1' }), showCancel: false, confirmText: t('common.confirm'), diff --git a/main/manager-web/public/generator/assets/index-B8r0c7xg.js b/main/manager-web/public/generator/assets/index-B8r0c7xg.js new file mode 100644 index 00000000..dd4b0e58 --- /dev/null +++ b/main/manager-web/public/generator/assets/index-B8r0c7xg.js @@ -0,0 +1,81 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const n of o)if(n.type==="childList")for(const r of n.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function t(o){const n={};return o.integrity&&(n.integrity=o.integrity),o.referrerPolicy&&(n.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?n.credentials="include":o.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(o){if(o.ep)return;o.ep=!0;const n=t(o);fetch(o.href,n)}})();/** +* @vue/shared v3.5.26 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/function Pr(A){const e=Object.create(null);for(const t of A.split(","))e[t]=1;return t=>t in e}const _A={},hi=[],nt=()=>{},tI=()=>!1,Bn=A=>A.charCodeAt(0)===111&&A.charCodeAt(1)===110&&(A.charCodeAt(2)>122||A.charCodeAt(2)<97),Vr=A=>A.startsWith("onUpdate:"),ue=Object.assign,Wr=(A,e)=>{const t=A.indexOf(e);t>-1&&A.splice(t,1)},iB=Object.prototype.hasOwnProperty,JA=(A,e)=>iB.call(A,e),yA=Array.isArray,fi=A=>co(A)==="[object Map]",Qn=A=>co(A)==="[object Set]",Gg=A=>co(A)==="[object Date]",FA=A=>typeof A=="function",ee=A=>typeof A=="string",It=A=>typeof A=="symbol",KA=A=>A!==null&&typeof A=="object",iI=A=>(KA(A)||FA(A))&&FA(A.then)&&FA(A.catch),oI=Object.prototype.toString,co=A=>oI.call(A),oB=A=>co(A).slice(8,-1),nI=A=>co(A)==="[object Object]",qr=A=>ee(A)&&A!=="NaN"&&A[0]!=="-"&&""+parseInt(A,10)===A,Oi=Pr(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),cn=A=>{const e=Object.create(null);return t=>e[t]||(e[t]=A(t))},nB=/-\w/g,Je=cn(A=>A.replace(nB,e=>e.slice(1).toUpperCase())),rB=/\B([A-Z])/g,Ii=cn(A=>A.replace(rB,"-$1").toLowerCase()),En=cn(A=>A.charAt(0).toUpperCase()+A.slice(1)),xn=cn(A=>A?`on${En(A)}`:""),Yt=(A,e)=>!Object.is(A,e),To=(A,...e)=>{for(let t=0;t{Object.defineProperty(A,e,{configurable:!0,enumerable:!1,writable:i,value:t})},un=A=>{const e=parseFloat(A);return isNaN(e)?A:e};let Lg;const hn=()=>Lg||(Lg=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function VA(A){if(yA(A)){const e={};for(let t=0;t{if(t){const i=t.split(sB);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function kA(A){let e="";if(ee(A))e=A;else if(yA(A))for(let t=0;tfn(t,e))}const sI=A=>!!(A&&A.__v_isRef===!0),F=A=>ee(A)?A:A==null?"":yA(A)||KA(A)&&(A.toString===oI||!FA(A.toString))?sI(A)?F(A.value):JSON.stringify(A,aI,2):String(A),aI=(A,e)=>sI(e)?aI(A,e.value):fi(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[i,o],n)=>(t[Jn(i,n)+" =>"]=o,t),{})}:Qn(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>Jn(t))}:It(e)?Jn(e):KA(e)&&!yA(e)&&!nI(e)?String(e):e,Jn=(A,e="")=>{var t;return It(A)?`Symbol(${(t=A.description)!=null?t:e})`:A};/** +* @vue/reactivity v3.5.26 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/let ke;class II{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=ke,!e&&ke&&(this.index=(ke.scopes||(ke.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e0&&--this._on===0&&(ke=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,i;for(t=0,i=this.effects.length;t0)return;if(Vi){let e=Vi;for(Vi=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let A;for(;Pi;){let e=Pi;for(Pi=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(i){A||(A=i)}e=t}}if(A)throw A}function QI(A){for(let e=A.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function cI(A){let e,t=A.depsTail,i=t;for(;i;){const o=i.prevDep;i.version===-1?(i===t&&(t=o),Xr(i),uB(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=o}A.deps=e,A.depsTail=t}function ar(A){for(let e=A.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(EI(e.dep.computed)||e.dep.version!==e.version))return!0;return!!A._dirty}function EI(A){if(A.flags&4&&!(A.flags&16)||(A.flags&=-17,A.globalVersion===$i)||(A.globalVersion=$i,!A.isSSR&&A.flags&128&&(!A.deps&&!A._dirty||!ar(A))))return;A.flags|=2;const e=A.dep,t=OA,i=_e;OA=A,_e=!0;try{QI(A);const o=A.fn(A._value);(e.version===0||Yt(o,A._value))&&(A.flags|=128,A._value=o,e.version++)}catch(o){throw e.version++,o}finally{OA=t,_e=i,cI(A),A.flags&=-3}}function Xr(A,e=!1){const{dep:t,prevSub:i,nextSub:o}=A;if(i&&(i.nextSub=o,A.prevSub=void 0),o&&(o.prevSub=i,A.nextSub=void 0),t.subs===A&&(t.subs=i,!i&&t.computed)){t.computed.flags&=-5;for(let n=t.computed.deps;n;n=n.nextDep)Xr(n,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function uB(A){const{prevDep:e,nextDep:t}=A;e&&(e.nextDep=t,A.prevDep=void 0),t&&(t.prevDep=e,A.nextDep=void 0)}let _e=!0;const uI=[];function wt(){uI.push(_e),_e=!1}function Dt(){const A=uI.pop();_e=A===void 0?!0:A}function Ug(A){const{cleanup:e}=A;if(A.cleanup=void 0,e){const t=OA;OA=void 0;try{e()}finally{OA=t}}}let $i=0;class hB{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class zr{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!OA||!_e||OA===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==OA)t=this.activeLink=new hB(OA,this),OA.deps?(t.prevDep=OA.depsTail,OA.depsTail.nextDep=t,OA.depsTail=t):OA.deps=OA.depsTail=t,hI(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const i=t.nextDep;i.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=i),t.prevDep=OA.depsTail,t.nextDep=void 0,OA.depsTail.nextDep=t,OA.depsTail=t,OA.deps===t&&(OA.deps=i)}return t}trigger(e){this.version++,$i++,this.notify(e)}notify(e){jr();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Zr()}}}function hI(A){if(A.dep.sc++,A.sub.flags&4){const e=A.dep.computed;if(e&&!A.dep.subs){e.flags|=20;for(let i=e.deps;i;i=i.nextDep)hI(i)}const t=A.dep.subs;t!==A&&(A.prevSub=t,t&&(t.nextSub=A)),A.dep.subs=A}}const Ir=new WeakMap,ri=Symbol(""),Cr=Symbol(""),Ao=Symbol("");function ce(A,e,t){if(_e&&OA){let i=Ir.get(A);i||Ir.set(A,i=new Map);let o=i.get(t);o||(i.set(t,o=new zr),o.map=i,o.key=t),o.track()}}function ut(A,e,t,i,o,n){const r=Ir.get(A);if(!r){$i++;return}const g=s=>{s&&s.trigger()};if(jr(),e==="clear")r.forEach(g);else{const s=yA(A),a=s&&qr(t);if(s&&t==="length"){const I=Number(i);r.forEach((l,C)=>{(C==="length"||C===Ao||!It(C)&&C>=I)&&g(l)})}else switch((t!==void 0||r.has(void 0))&&g(r.get(t)),a&&g(r.get(Ao)),e){case"add":s?a&&g(r.get("length")):(g(r.get(ri)),fi(A)&&g(r.get(Cr)));break;case"delete":s||(g(r.get(ri)),fi(A)&&g(r.get(Cr)));break;case"set":fi(A)&&g(r.get(ri));break}}Zr()}function li(A){const e=xA(A);return e===A?e:(ce(e,"iterate",Ao),xe(A)?e:e.map(Oe))}function dn(A){return ce(A=xA(A),"iterate",Ao),A}function Ut(A,e){return kt(A)?gi(A)?Di(Oe(e)):Di(e):Oe(e)}const fB={__proto__:null,[Symbol.iterator](){return Hn(this,Symbol.iterator,A=>Ut(this,A))},concat(...A){return li(this).concat(...A.map(e=>yA(e)?li(e):e))},entries(){return Hn(this,"entries",A=>(A[1]=Ut(this,A[1]),A))},every(A,e){return lt(this,"every",A,e,void 0,arguments)},filter(A,e){return lt(this,"filter",A,e,t=>t.map(i=>Ut(this,i)),arguments)},find(A,e){return lt(this,"find",A,e,t=>Ut(this,t),arguments)},findIndex(A,e){return lt(this,"findIndex",A,e,void 0,arguments)},findLast(A,e){return lt(this,"findLast",A,e,t=>Ut(this,t),arguments)},findLastIndex(A,e){return lt(this,"findLastIndex",A,e,void 0,arguments)},forEach(A,e){return lt(this,"forEach",A,e,void 0,arguments)},includes(...A){return Yn(this,"includes",A)},indexOf(...A){return Yn(this,"indexOf",A)},join(A){return li(this).join(A)},lastIndexOf(...A){return Yn(this,"lastIndexOf",A)},map(A,e){return lt(this,"map",A,e,void 0,arguments)},pop(){return Mi(this,"pop")},push(...A){return Mi(this,"push",A)},reduce(A,...e){return Mg(this,"reduce",A,e)},reduceRight(A,...e){return Mg(this,"reduceRight",A,e)},shift(){return Mi(this,"shift")},some(A,e){return lt(this,"some",A,e,void 0,arguments)},splice(...A){return Mi(this,"splice",A)},toReversed(){return li(this).toReversed()},toSorted(A){return li(this).toSorted(A)},toSpliced(...A){return li(this).toSpliced(...A)},unshift(...A){return Mi(this,"unshift",A)},values(){return Hn(this,"values",A=>Ut(this,A))}};function Hn(A,e,t){const i=dn(A),o=i[e]();return i!==A&&!xe(A)&&(o._next=o.next,o.next=()=>{const n=o._next();return n.done||(n.value=t(n.value)),n}),o}const dB=Array.prototype;function lt(A,e,t,i,o,n){const r=dn(A),g=r!==A&&!xe(A),s=r[e];if(s!==dB[e]){const l=s.apply(A,n);return g?Oe(l):l}let a=t;r!==A&&(g?a=function(l,C){return t.call(this,Ut(A,l),C,A)}:t.length>2&&(a=function(l,C){return t.call(this,l,C,A)}));const I=s.call(r,a,i);return g&&o?o(I):I}function Mg(A,e,t,i){const o=dn(A);let n=t;return o!==A&&(xe(A)?t.length>3&&(n=function(r,g,s){return t.call(this,r,g,s,A)}):n=function(r,g,s){return t.call(this,r,Ut(A,g),s,A)}),o[e](n,...i)}function Yn(A,e,t){const i=xA(A);ce(i,"iterate",Ao);const o=i[e](...t);return(o===-1||o===!1)&&eg(t[0])?(t[0]=xA(t[0]),i[e](...t)):o}function Mi(A,e,t=[]){wt(),jr();const i=xA(A)[e].apply(A,t);return Zr(),Dt(),i}const pB=Pr("__proto__,__v_isRef,__isVue"),fI=new Set(Object.getOwnPropertyNames(Symbol).filter(A=>A!=="arguments"&&A!=="caller").map(A=>Symbol[A]).filter(It));function mB(A){It(A)||(A=String(A));const e=xA(this);return ce(e,"has",A),e.hasOwnProperty(A)}class dI{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){if(t==="__v_skip")return e.__v_skip;const o=this._isReadonly,n=this._isShallow;if(t==="__v_isReactive")return!o;if(t==="__v_isReadonly")return o;if(t==="__v_isShallow")return n;if(t==="__v_raw")return i===(o?n?NB:wI:n?yI:mI).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const r=yA(e);if(!o){let s;if(r&&(s=fB[t]))return s;if(t==="hasOwnProperty")return mB}const g=Reflect.get(e,t,le(e)?e:i);if((It(t)?fI.has(t):pB(t))||(o||ce(e,"get",t),n))return g;if(le(g)){const s=r&&qr(t)?g:g.value;return o&&KA(s)?Br(s):s}return KA(g)?o?Br(g):pn(g):g}}class pI extends dI{constructor(e=!1){super(!1,e)}set(e,t,i,o){let n=e[t];const r=yA(e)&&qr(t);if(!this._isShallow){const a=kt(n);if(!xe(i)&&!kt(i)&&(n=xA(n),i=xA(i)),!r&&le(n)&&!le(i))return a||(n.value=i),!0}const g=r?Number(t)A,vo=A=>Reflect.getPrototypeOf(A);function vB(A,e,t){return function(...i){const o=this.__v_raw,n=xA(o),r=fi(n),g=A==="entries"||A===Symbol.iterator&&r,s=A==="keys"&&r,a=o[A](...i),I=t?lr:e?Di:Oe;return!e&&ce(n,"iterate",s?Cr:ri),{next(){const{value:l,done:C}=a.next();return C?{value:l,done:C}:{value:g?[I(l[0]),I(l[1])]:I(l),done:C}},[Symbol.iterator](){return this}}}}function Fo(A){return function(...e){return A==="delete"?!1:A==="clear"?void 0:this}}function FB(A,e){const t={get(o){const n=this.__v_raw,r=xA(n),g=xA(o);A||(Yt(o,g)&&ce(r,"get",o),ce(r,"get",g));const{has:s}=vo(r),a=e?lr:A?Di:Oe;if(s.call(r,o))return a(n.get(o));if(s.call(r,g))return a(n.get(g));n!==r&&n.get(o)},get size(){const o=this.__v_raw;return!A&&ce(xA(o),"iterate",ri),o.size},has(o){const n=this.__v_raw,r=xA(n),g=xA(o);return A||(Yt(o,g)&&ce(r,"has",o),ce(r,"has",g)),o===g?n.has(o):n.has(o)||n.has(g)},forEach(o,n){const r=this,g=r.__v_raw,s=xA(g),a=e?lr:A?Di:Oe;return!A&&ce(s,"iterate",ri),g.forEach((I,l)=>o.call(n,a(I),a(l),r))}};return ue(t,A?{add:Fo("add"),set:Fo("set"),delete:Fo("delete"),clear:Fo("clear")}:{add(o){!e&&!xe(o)&&!kt(o)&&(o=xA(o));const n=xA(this);return vo(n).has.call(n,o)||(n.add(o),ut(n,"add",o,o)),this},set(o,n){!e&&!xe(n)&&!kt(n)&&(n=xA(n));const r=xA(this),{has:g,get:s}=vo(r);let a=g.call(r,o);a||(o=xA(o),a=g.call(r,o));const I=s.call(r,o);return r.set(o,n),a?Yt(n,I)&&ut(r,"set",o,n):ut(r,"add",o,n),this},delete(o){const n=xA(this),{has:r,get:g}=vo(n);let s=r.call(n,o);s||(o=xA(o),s=r.call(n,o)),g&&g.call(n,o);const a=n.delete(o);return s&&ut(n,"delete",o,void 0),a},clear(){const o=xA(this),n=o.size!==0,r=o.clear();return n&&ut(o,"clear",void 0,void 0),r}}),["keys","values","entries",Symbol.iterator].forEach(o=>{t[o]=vB(o,A,e)}),t}function $r(A,e){const t=FB(A,e);return(i,o,n)=>o==="__v_isReactive"?!A:o==="__v_isReadonly"?A:o==="__v_raw"?i:Reflect.get(JA(t,o)&&o in i?t:i,o,n)}const SB={get:$r(!1,!1)},RB={get:$r(!1,!0)},bB={get:$r(!0,!1)};const mI=new WeakMap,yI=new WeakMap,wI=new WeakMap,NB=new WeakMap;function GB(A){switch(A){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function LB(A){return A.__v_skip||!Object.isExtensible(A)?0:GB(oB(A))}function pn(A){return kt(A)?A:Ag(A,!1,wB,SB,mI)}function DI(A){return Ag(A,!1,kB,RB,yI)}function Br(A){return Ag(A,!0,DB,bB,wI)}function Ag(A,e,t,i,o){if(!KA(A)||A.__v_raw&&!(e&&A.__v_isReactive))return A;const n=LB(A);if(n===0)return A;const r=o.get(A);if(r)return r;const g=new Proxy(A,n===2?i:t);return o.set(A,g),g}function gi(A){return kt(A)?gi(A.__v_raw):!!(A&&A.__v_isReactive)}function kt(A){return!!(A&&A.__v_isReadonly)}function xe(A){return!!(A&&A.__v_isShallow)}function eg(A){return A?!!A.__v_raw:!1}function xA(A){const e=A&&A.__v_raw;return e?xA(e):A}function _i(A){return!JA(A,"__v_skip")&&Object.isExtensible(A)&&rI(A,"__v_skip",!0),A}const Oe=A=>KA(A)?pn(A):A,Di=A=>KA(A)?Br(A):A;function le(A){return A?A.__v_isRef===!0:!1}function EA(A){return kI(A,!1)}function tg(A){return kI(A,!0)}function kI(A,e){return le(A)?A:new UB(A,e)}class UB{constructor(e,t){this.dep=new zr,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:xA(e),this._value=t?e:Oe(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,i=this.__v_isShallow||xe(e)||kt(e);e=i?e:xA(e),Yt(e,t)&&(this._rawValue=e,this._value=i?e:Oe(e),this.dep.trigger())}}function BA(A){return le(A)?A.value:A}const MB={get:(A,e,t)=>e==="__v_raw"?A:BA(Reflect.get(A,e,t)),set:(A,e,t,i)=>{const o=A[e];return le(o)&&!le(t)?(o.value=t,!0):Reflect.set(A,e,t,i)}};function vI(A){return gi(A)?A:new Proxy(A,MB)}class xB{constructor(e,t,i){this.fn=e,this.setter=t,this._value=void 0,this.dep=new zr(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=$i-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&OA!==this)return BI(this,!0),!0}get value(){const e=this.dep.track();return EI(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function JB(A,e,t=!1){let i,o;return FA(A)?i=A:(i=A.get,o=A.set),new xB(i,o,t)}const So={},qo=new WeakMap;let ei;function TB(A,e=!1,t=ei){if(t){let i=qo.get(t);i||qo.set(t,i=[]),i.push(A)}}function HB(A,e,t=_A){const{immediate:i,deep:o,once:n,scheduler:r,augmentJob:g,call:s}=t,a=d=>o?d:xe(d)||o===!1||o===0?ht(d,1):ht(d);let I,l,C,Q,h=!1,f=!1;if(le(A)?(l=()=>A.value,h=xe(A)):gi(A)?(l=()=>a(A),h=!0):yA(A)?(f=!0,h=A.some(d=>gi(d)||xe(d)),l=()=>A.map(d=>{if(le(d))return d.value;if(gi(d))return a(d);if(FA(d))return s?s(d,2):d()})):FA(A)?e?l=s?()=>s(A,2):A:l=()=>{if(C){wt();try{C()}finally{Dt()}}const d=ei;ei=I;try{return s?s(A,3,[Q]):A(Q)}finally{ei=d}}:l=nt,e&&o){const d=l,p=o===!0?1/0:o;l=()=>ht(d(),p)}const u=EB(),E=()=>{I.stop(),u&&u.active&&Wr(u.effects,I)};if(n&&e){const d=e;e=(...p)=>{d(...p),E()}}let D=f?new Array(A.length).fill(So):So;const c=d=>{if(!(!(I.flags&1)||!I.dirty&&!d))if(e){const p=I.run();if(o||h||(f?p.some((v,N)=>Yt(v,D[N])):Yt(p,D))){C&&C();const v=ei;ei=I;try{const N=[p,D===So?void 0:f&&D[0]===So?[]:D,Q];D=p,s?s(e,3,N):e(...N)}finally{ei=v}}}else I.run()};return g&&g(c),I=new CI(l),I.scheduler=r?()=>r(c,!1):c,Q=d=>TB(d,!1,I),C=I.onStop=()=>{const d=qo.get(I);if(d){if(s)s(d,4);else for(const p of d)p();qo.delete(I)}},e?i?c(!0):D=I.run():r?r(c.bind(null,!0),!0):I.run(),E.pause=I.pause.bind(I),E.resume=I.resume.bind(I),E.stop=E,E}function ht(A,e=1/0,t){if(e<=0||!KA(A)||A.__v_skip||(t=t||new Map,(t.get(A)||0)>=e))return A;if(t.set(A,e),e--,le(A))ht(A.value,e,t);else if(yA(A))for(let i=0;i{ht(i,e,t)});else if(nI(A)){for(const i in A)ht(A[i],e,t);for(const i of Object.getOwnPropertySymbols(A))Object.prototype.propertyIsEnumerable.call(A,i)&&ht(A[i],e,t)}return A}/** +* @vue/runtime-core v3.5.26 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/function Eo(A,e,t,i){try{return i?A(...i):A()}catch(o){mn(o,e,t)}}function Ct(A,e,t,i){if(FA(A)){const o=Eo(A,e,t,i);return o&&iI(o)&&o.catch(n=>{mn(n,e,t)}),o}if(yA(A)){const o=[];for(let n=0;n>>1,o=me[i],n=eo(o);n=eo(t)?me.push(A):me.splice(_B(e),0,A),A.flags|=1,SI()}}function SI(){jo||(jo=FI.then(bI))}function KB(A){yA(A)?di.push(...A):Mt&&A.id===-1?Mt.splice(Qi+1,0,A):A.flags&1||(di.push(A),A.flags|=1),SI()}function xg(A,e,t=At+1){for(;teo(t)-eo(i));if(di.length=0,Mt){Mt.push(...e);return}for(Mt=e,Qi=0;QiA.id==null?A.flags&2?-1:1/0:A.id;function bI(A){try{for(At=0;At{i._d&&$o(-1);const n=Zo(e);let r;try{r=A(...o)}finally{Zo(n),i._d&&$o(1)}return r};return i._n=!0,i._c=!0,i._d=!0,i}function ZA(A,e){if(Re===null)return A;const t=kn(Re),i=A.dirs||(A.dirs=[]);for(let o=0;o1)return t&&FA(e)?e.call(i&&i.proxy):e}}const PB=Symbol.for("v-scx"),VB=()=>rt(PB);function ae(A,e,t){return GI(A,e,t)}function GI(A,e,t=_A){const{immediate:i,deep:o,flush:n,once:r}=t,g=ue({},t),s=e&&i||!e&&n!=="post";let a;if(io){if(n==="sync"){const Q=VB();a=Q.__watcherHandles||(Q.__watcherHandles=[])}else if(!s){const Q=()=>{};return Q.stop=nt,Q.resume=nt,Q.pause=nt,Q}}const I=Ee;g.call=(Q,h,f)=>Ct(Q,I,h,f);let l=!1;n==="post"?g.scheduler=Q=>{Se(Q,I&&I.suspense)}:n!=="sync"&&(l=!0,g.scheduler=(Q,h)=>{h?Q():ig(Q)}),g.augmentJob=Q=>{e&&(Q.flags|=4),l&&(Q.flags|=2,I&&(Q.id=I.uid,Q.i=I))};const C=HB(A,e,g);return io&&(a?a.push(C):s&&C()),C}function WB(A,e,t){const i=this.proxy,o=ee(A)?A.includes(".")?LI(i,A):()=>i[A]:A.bind(i,i);let n;FA(e)?n=e:(n=e.handler,t=e);const r=po(this),g=GI(o,n.bind(i),t);return r(),g}function LI(A,e){const t=e.split(".");return()=>{let i=A;for(let o=0;oA.__isTeleport,ZB=Symbol("_leaveCb");function og(A,e){A.shapeFlag&6&&A.component?(A.transition=e,og(A.component.subTree,e)):A.shapeFlag&128?(A.ssContent.transition=e.clone(A.ssContent),A.ssFallback.transition=e.clone(A.ssFallback)):A.transition=e}function ho(A,e){return FA(A)?ue({name:A.name},e,{setup:A}):A}function UI(A){A.ids=[A.ids[0]+A.ids[2]+++"-",0,0]}const Xo=new WeakMap;function Wi(A,e,t,i,o=!1){if(yA(A)){A.forEach((h,f)=>Wi(h,e&&(yA(e)?e[f]:e),t,i,o));return}if(qi(i)&&!o){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&Wi(A,e,t,i.component.subTree);return}const n=i.shapeFlag&4?kn(i.component):i.el,r=o?null:n,{i:g,r:s}=A,a=e&&e.r,I=g.refs===_A?g.refs={}:g.refs,l=g.setupState,C=xA(l),Q=l===_A?tI:h=>JA(C,h);if(a!=null&&a!==s){if(Jg(e),ee(a))I[a]=null,Q(a)&&(l[a]=null);else if(le(a)){a.value=null;const h=e;h.k&&(I[h.k]=null)}}if(FA(s))Eo(s,g,12,[r,I]);else{const h=ee(s),f=le(s);if(h||f){const u=()=>{if(A.f){const E=h?Q(s)?l[s]:I[s]:s.value;if(o)yA(E)&&Wr(E,n);else if(yA(E))E.includes(n)||E.push(n);else if(h)I[s]=[n],Q(s)&&(l[s]=I[s]);else{const D=[n];s.value=D,A.k&&(I[A.k]=D)}}else h?(I[s]=r,Q(s)&&(l[s]=r)):f&&(s.value=r,A.k&&(I[A.k]=r))};if(r){const E=()=>{u(),Xo.delete(A)};E.id=-1,Xo.set(A,E),Se(E,t)}else Jg(A),u()}}}function Jg(A){const e=Xo.get(A);e&&(e.flags|=8,Xo.delete(A))}hn().requestIdleCallback;hn().cancelIdleCallback;const qi=A=>!!A.type.__asyncLoader,MI=A=>A.type.__isKeepAlive;function XB(A,e){xI(A,"a",e)}function zB(A,e){xI(A,"da",e)}function xI(A,e,t=Ee){const i=A.__wdc||(A.__wdc=()=>{let o=t;for(;o;){if(o.isDeactivated)return;o=o.parent}return A()});if(yn(e,i,t),t){let o=t.parent;for(;o&&o.parent;)MI(o.parent.vnode)&&$B(i,e,t,o),o=o.parent}}function $B(A,e,t,i){const o=yn(e,A,i,!0);Ci(()=>{Wr(i[e],o)},t)}function yn(A,e,t=Ee,i=!1){if(t){const o=t[A]||(t[A]=[]),n=e.__weh||(e.__weh=(...r)=>{wt();const g=po(t),s=Ct(e,t,A,r);return g(),Dt(),s});return i?o.unshift(n):o.push(n),n}}const vt=A=>(e,t=Ee)=>{(!io||A==="sp")&&yn(A,(...i)=>e(...i),t)},JI=vt("bm"),Ft=vt("m"),AQ=vt("bu"),eQ=vt("u"),tQ=vt("bum"),Ci=vt("um"),iQ=vt("sp"),oQ=vt("rtg"),nQ=vt("rtc");function rQ(A,e=Ee){yn("ec",A,e)}const gQ="components",TI=Symbol.for("v-ndc");function HI(A){return ee(A)?sQ(gQ,A,!1)||A:A||TI}function sQ(A,e,t=!0,i=!1){const o=Re||Ee;if(o){const n=o.type;{const g=VQ(n,!1);if(g&&(g===e||g===Je(e)||g===En(Je(e))))return n}const r=Tg(o[A]||n[A],e)||Tg(o.appContext[A],e);return!r&&i?n:r}}function Tg(A,e){return A&&(A[e]||A[Je(e)]||A[En(Je(e))])}function Ke(A,e,t,i){let o;const n=t,r=yA(A);if(r||ee(A)){const g=r&&gi(A);let s=!1,a=!1;g&&(s=!xe(A),a=kt(A),A=dn(A)),o=new Array(A.length);for(let I=0,l=A.length;Ie(g,s,void 0,n));else{const g=Object.keys(A);o=new Array(g.length);for(let s=0,a=g.length;sA?nC(A)?kn(A):Qr(A.parent):null,ji=ue(Object.create(null),{$:A=>A,$el:A=>A.vnode.el,$data:A=>A.data,$props:A=>A.props,$attrs:A=>A.attrs,$slots:A=>A.slots,$refs:A=>A.refs,$parent:A=>Qr(A.parent),$root:A=>Qr(A.root),$host:A=>A.ce,$emit:A=>A.emit,$options:A=>_I(A),$forceUpdate:A=>A.f||(A.f=()=>{ig(A.update)}),$nextTick:A=>A.n||(A.n=uo.bind(A.proxy)),$watch:A=>WB.bind(A)}),_n=(A,e)=>A!==_A&&!A.__isScriptSetup&&JA(A,e),aQ={get({_:A},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:i,data:o,props:n,accessCache:r,type:g,appContext:s}=A;if(e[0]!=="$"){const C=r[e];if(C!==void 0)switch(C){case 1:return i[e];case 2:return o[e];case 4:return t[e];case 3:return n[e]}else{if(_n(i,e))return r[e]=1,i[e];if(o!==_A&&JA(o,e))return r[e]=2,o[e];if(JA(n,e))return r[e]=3,n[e];if(t!==_A&&JA(t,e))return r[e]=4,t[e];cr&&(r[e]=0)}}const a=ji[e];let I,l;if(a)return e==="$attrs"&&ce(A.attrs,"get",""),a(A);if((I=g.__cssModules)&&(I=I[e]))return I;if(t!==_A&&JA(t,e))return r[e]=4,t[e];if(l=s.config.globalProperties,JA(l,e))return l[e]},set({_:A},e,t){const{data:i,setupState:o,ctx:n}=A;return _n(o,e)?(o[e]=t,!0):i!==_A&&JA(i,e)?(i[e]=t,!0):JA(A.props,e)||e[0]==="$"&&e.slice(1)in A?!1:(n[e]=t,!0)},has({_:{data:A,setupState:e,accessCache:t,ctx:i,appContext:o,props:n,type:r}},g){let s;return!!(t[g]||A!==_A&&g[0]!=="$"&&JA(A,g)||_n(e,g)||JA(n,g)||JA(i,g)||JA(ji,g)||JA(o.config.globalProperties,g)||(s=r.__cssModules)&&s[g])},defineProperty(A,e,t){return t.get!=null?A._.accessCache[e]=0:JA(t,"value")&&this.set(A,e,t.value,null),Reflect.defineProperty(A,e,t)}};function Hg(A){return yA(A)?A.reduce((e,t)=>(e[t]=null,e),{}):A}let cr=!0;function IQ(A){const e=_I(A),t=A.proxy,i=A.ctx;cr=!1,e.beforeCreate&&Yg(e.beforeCreate,A,"bc");const{data:o,computed:n,methods:r,watch:g,provide:s,inject:a,created:I,beforeMount:l,mounted:C,beforeUpdate:Q,updated:h,activated:f,deactivated:u,beforeDestroy:E,beforeUnmount:D,destroyed:c,unmounted:d,render:p,renderTracked:v,renderTriggered:N,errorCaptured:G,serverPrefetch:H,expose:S,inheritAttrs:b,components:L,directives:QA,filters:dA}=e;if(a&&CQ(a,i,null),r)for(const X in r){const tA=r[X];FA(tA)&&(i[X]=tA.bind(t))}if(o){const X=o.call(t,t);KA(X)&&(A.data=pn(X))}if(cr=!0,n)for(const X in n){const tA=n[X],fA=FA(tA)?tA.bind(t,t):FA(tA.get)?tA.get.bind(t,t):nt,_=!FA(tA)&&FA(tA.set)?tA.set.bind(t):nt,W=hA({get:fA,set:_});Object.defineProperty(i,X,{enumerable:!0,configurable:!0,get:()=>W.value,set:z=>W.value=z})}if(g)for(const X in g)YI(g[X],i,t,X);if(s){const X=FA(s)?s.call(t):s;Reflect.ownKeys(X).forEach(tA=>{Ho(tA,X[tA])})}I&&Yg(I,A,"c");function oA(X,tA){yA(tA)?tA.forEach(fA=>X(fA.bind(t))):tA&&X(tA.bind(t))}if(oA(JI,l),oA(Ft,C),oA(AQ,Q),oA(eQ,h),oA(XB,f),oA(zB,u),oA(rQ,G),oA(nQ,v),oA(oQ,N),oA(tQ,D),oA(Ci,d),oA(iQ,H),yA(S))if(S.length){const X=A.exposed||(A.exposed={});S.forEach(tA=>{Object.defineProperty(X,tA,{get:()=>t[tA],set:fA=>t[tA]=fA,enumerable:!0})})}else A.exposed||(A.exposed={});p&&A.render===nt&&(A.render=p),b!=null&&(A.inheritAttrs=b),L&&(A.components=L),QA&&(A.directives=QA),H&&UI(A)}function CQ(A,e,t=nt){yA(A)&&(A=Er(A));for(const i in A){const o=A[i];let n;KA(o)?"default"in o?n=rt(o.from||i,o.default,!0):n=rt(o.from||i):n=rt(o),le(n)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>n.value,set:r=>n.value=r}):e[i]=n}}function Yg(A,e,t){Ct(yA(A)?A.map(i=>i.bind(e.proxy)):A.bind(e.proxy),e,t)}function YI(A,e,t,i){let o=i.includes(".")?LI(t,i):()=>t[i];if(ee(A)){const n=e[A];FA(n)&&ae(o,n)}else if(FA(A))ae(o,A.bind(t));else if(KA(A))if(yA(A))A.forEach(n=>YI(n,e,t,i));else{const n=FA(A.handler)?A.handler.bind(t):e[A.handler];FA(n)&&ae(o,n,A)}}function _I(A){const e=A.type,{mixins:t,extends:i}=e,{mixins:o,optionsCache:n,config:{optionMergeStrategies:r}}=A.appContext,g=n.get(e);let s;return g?s=g:!o.length&&!t&&!i?s=e:(s={},o.length&&o.forEach(a=>zo(s,a,r,!0)),zo(s,e,r)),KA(e)&&n.set(e,s),s}function zo(A,e,t,i=!1){const{mixins:o,extends:n}=e;n&&zo(A,n,t,!0),o&&o.forEach(r=>zo(A,r,t,!0));for(const r in e)if(!(i&&r==="expose")){const g=lQ[r]||t&&t[r];A[r]=g?g(A[r],e[r]):e[r]}return A}const lQ={data:_g,props:Kg,emits:Kg,methods:Ki,computed:Ki,beforeCreate:fe,created:fe,beforeMount:fe,mounted:fe,beforeUpdate:fe,updated:fe,beforeDestroy:fe,beforeUnmount:fe,destroyed:fe,unmounted:fe,activated:fe,deactivated:fe,errorCaptured:fe,serverPrefetch:fe,components:Ki,directives:Ki,watch:QQ,provide:_g,inject:BQ};function _g(A,e){return e?A?function(){return ue(FA(A)?A.call(this,this):A,FA(e)?e.call(this,this):e)}:e:A}function BQ(A,e){return Ki(Er(A),Er(e))}function Er(A){if(yA(A)){const e={};for(let t=0;te==="modelValue"||e==="model-value"?A.modelModifiers:A[`${e}Modifiers`]||A[`${Je(e)}Modifiers`]||A[`${Ii(e)}Modifiers`];function hQ(A,e,...t){if(A.isUnmounted)return;const i=A.vnode.props||_A;let o=t;const n=e.startsWith("update:"),r=n&&uQ(i,e.slice(7));r&&(r.trim&&(o=t.map(I=>ee(I)?I.trim():I)),r.number&&(o=t.map(un)));let g,s=i[g=xn(e)]||i[g=xn(Je(e))];!s&&n&&(s=i[g=xn(Ii(e))]),s&&Ct(s,A,6,o);const a=i[g+"Once"];if(a){if(!A.emitted)A.emitted={};else if(A.emitted[g])return;A.emitted[g]=!0,Ct(a,A,6,o)}}const fQ=new WeakMap;function OI(A,e,t=!1){const i=t?fQ:e.emitsCache,o=i.get(A);if(o!==void 0)return o;const n=A.emits;let r={},g=!1;if(!FA(A)){const s=a=>{const I=OI(a,e,!0);I&&(g=!0,ue(r,I))};!t&&e.mixins.length&&e.mixins.forEach(s),A.extends&&s(A.extends),A.mixins&&A.mixins.forEach(s)}return!n&&!g?(KA(A)&&i.set(A,null),null):(yA(n)?n.forEach(s=>r[s]=null):ue(r,n),KA(A)&&i.set(A,r),r)}function wn(A,e){return!A||!Bn(e)?!1:(e=e.slice(2).replace(/Once$/,""),JA(A,e[0].toLowerCase()+e.slice(1))||JA(A,Ii(e))||JA(A,e))}function Og(A){const{type:e,vnode:t,proxy:i,withProxy:o,propsOptions:[n],slots:r,attrs:g,emit:s,render:a,renderCache:I,props:l,data:C,setupState:Q,ctx:h,inheritAttrs:f}=A,u=Zo(A);let E,D;try{if(t.shapeFlag&4){const d=o||i,p=d;E=tt(a.call(p,d,I,l,Q,C,h)),D=g}else{const d=e;E=tt(d.length>1?d(l,{attrs:g,slots:r,emit:s}):d(l,null)),D=e.props?g:dQ(g)}}catch(d){Zi.length=0,mn(d,A,1),E=TA(Kt)}let c=E;if(D&&f!==!1){const d=Object.keys(D),{shapeFlag:p}=c;d.length&&p&7&&(n&&d.some(Vr)&&(D=pQ(D,n)),c=ki(c,D,!1,!0))}return t.dirs&&(c=ki(c,null,!1,!0),c.dirs=c.dirs?c.dirs.concat(t.dirs):t.dirs),t.transition&&og(c,t.transition),E=c,Zo(u),E}const dQ=A=>{let e;for(const t in A)(t==="class"||t==="style"||Bn(t))&&((e||(e={}))[t]=A[t]);return e},pQ=(A,e)=>{const t={};for(const i in A)(!Vr(i)||!(i.slice(9)in e))&&(t[i]=A[i]);return t};function mQ(A,e,t){const{props:i,children:o,component:n}=A,{props:r,children:g,patchFlag:s}=e,a=n.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&s>=0){if(s&1024)return!0;if(s&16)return i?Pg(i,r,a):!!r;if(s&8){const I=e.dynamicProps;for(let l=0;lObject.create(PI),WI=A=>Object.getPrototypeOf(A)===PI;function wQ(A,e,t,i=!1){const o={},n=VI();A.propsDefaults=Object.create(null),qI(A,e,o,n);for(const r in A.propsOptions[0])r in o||(o[r]=void 0);t?A.props=i?o:DI(o):A.type.props?A.props=o:A.props=n,A.attrs=n}function DQ(A,e,t,i){const{props:o,attrs:n,vnode:{patchFlag:r}}=A,g=xA(o),[s]=A.propsOptions;let a=!1;if((i||r>0)&&!(r&16)){if(r&8){const I=A.vnode.dynamicProps;for(let l=0;l{s=!0;const[C,Q]=jI(l,e,!0);ue(r,C),Q&&g.push(...Q)};!t&&e.mixins.length&&e.mixins.forEach(I),A.extends&&I(A.extends),A.mixins&&A.mixins.forEach(I)}if(!n&&!s)return KA(A)&&i.set(A,hi),hi;if(yA(n))for(let I=0;IA==="_"||A==="_ctx"||A==="$stable",rg=A=>yA(A)?A.map(tt):[tt(A)],vQ=(A,e,t)=>{if(e._n)return e;const i=OB((...o)=>rg(e(...o)),t);return i._c=!1,i},ZI=(A,e,t)=>{const i=A._ctx;for(const o in A){if(ng(o))continue;const n=A[o];if(FA(n))e[o]=vQ(o,n,i);else if(n!=null){const r=rg(n);e[o]=()=>r}}},XI=(A,e)=>{const t=rg(e);A.slots.default=()=>t},zI=(A,e,t)=>{for(const i in e)(t||!ng(i))&&(A[i]=e[i])},FQ=(A,e,t)=>{const i=A.slots=VI();if(A.vnode.shapeFlag&32){const o=e._;o?(zI(i,e,t),t&&rI(i,"_",o,!0)):ZI(e,i)}else e&&XI(A,e)},SQ=(A,e,t)=>{const{vnode:i,slots:o}=A;let n=!0,r=_A;if(i.shapeFlag&32){const g=e._;g?t&&g===1?n=!1:zI(o,e,t):(n=!e.$stable,ZI(e,o)),r=e}else e&&(XI(A,e),r={default:1});if(n)for(const g in o)!ng(g)&&r[g]==null&&delete o[g]},Se=LQ;function RQ(A){return bQ(A)}function bQ(A,e){const t=hn();t.__VUE__=!0;const{insert:i,remove:o,patchProp:n,createElement:r,createText:g,createComment:s,setText:a,setElementText:I,parentNode:l,nextSibling:C,setScopeId:Q=nt,insertStaticContent:h}=A,f=(w,R,k,x=null,q=null,V=null,iA=void 0,eA=null,m=!!R.dynamicChildren)=>{if(w===R)return;w&&!xi(w,R)&&(x=Y(w),z(w,q,V,!0),w=null),R.patchFlag===-2&&(m=!1,R.dynamicChildren=null);const{type:y,ref:M,shapeFlag:O}=R;switch(y){case fo:u(w,R,k,x);break;case Kt:E(w,R,k,x);break;case Yo:w==null&&D(R,k,x,iA);break;case qA:L(w,R,k,x,q,V,iA,eA,m);break;default:O&1?p(w,R,k,x,q,V,iA,eA,m):O&6?QA(w,R,k,x,q,V,iA,eA,m):(O&64||O&128)&&y.process(w,R,k,x,q,V,iA,eA,m,cA)}M!=null&&q?Wi(M,w&&w.ref,V,R||w,!R):M==null&&w&&w.ref!=null&&Wi(w.ref,null,V,w,!0)},u=(w,R,k,x)=>{if(w==null)i(R.el=g(R.children),k,x);else{const q=R.el=w.el;R.children!==w.children&&a(q,R.children)}},E=(w,R,k,x)=>{w==null?i(R.el=s(R.children||""),k,x):R.el=w.el},D=(w,R,k,x)=>{[w.el,w.anchor]=h(w.children,R,k,x,w.el,w.anchor)},c=({el:w,anchor:R},k,x)=>{let q;for(;w&&w!==R;)q=C(w),i(w,k,x),w=q;i(R,k,x)},d=({el:w,anchor:R})=>{let k;for(;w&&w!==R;)k=C(w),o(w),w=k;o(R)},p=(w,R,k,x,q,V,iA,eA,m)=>{if(R.type==="svg"?iA="svg":R.type==="math"&&(iA="mathml"),w==null)v(R,k,x,q,V,iA,eA,m);else{const y=w.el&&w.el._isVueCE?w.el:null;try{y&&y._beginPatch(),H(w,R,q,V,iA,eA,m)}finally{y&&y._endPatch()}}},v=(w,R,k,x,q,V,iA,eA)=>{let m,y;const{props:M,shapeFlag:O,transition:nA,dirs:Z}=w;if(m=w.el=r(w.type,V,M&&M.is,M),O&8?I(m,w.children):O&16&&G(w.children,m,null,x,q,Kn(w,V),iA,eA),Z&&Zt(w,null,x,"created"),N(m,w,w.scopeId,iA,x),M){for(const P in M)P!=="value"&&!Oi(P)&&n(m,P,null,M[P],V,x);"value"in M&&n(m,"value",null,M.value,V),(y=M.onVnodeBeforeMount)&&ze(y,x,w)}Z&&Zt(w,null,x,"beforeMount");const U=NQ(q,nA);U&&nA.beforeEnter(m),i(m,R,k),((y=M&&M.onVnodeMounted)||U||Z)&&Se(()=>{y&&ze(y,x,w),U&&nA.enter(m),Z&&Zt(w,null,x,"mounted")},q)},N=(w,R,k,x,q)=>{if(k&&Q(w,k),x)for(let V=0;V{for(let y=m;y{const eA=R.el=w.el;let{patchFlag:m,dynamicChildren:y,dirs:M}=R;m|=w.patchFlag&16;const O=w.props||_A,nA=R.props||_A;let Z;if(k&&Xt(k,!1),(Z=nA.onVnodeBeforeUpdate)&&ze(Z,k,R,w),M&&Zt(R,w,k,"beforeUpdate"),k&&Xt(k,!0),(O.innerHTML&&nA.innerHTML==null||O.textContent&&nA.textContent==null)&&I(eA,""),y?S(w.dynamicChildren,y,eA,k,x,Kn(R,q),V):iA||tA(w,R,eA,null,k,x,Kn(R,q),V,!1),m>0){if(m&16)b(eA,O,nA,k,q);else if(m&2&&O.class!==nA.class&&n(eA,"class",null,nA.class,q),m&4&&n(eA,"style",O.style,nA.style,q),m&8){const U=R.dynamicProps;for(let P=0;P{Z&&ze(Z,k,R,w),M&&Zt(R,w,k,"updated")},x)},S=(w,R,k,x,q,V,iA)=>{for(let eA=0;eA{if(R!==k){if(R!==_A)for(const V in R)!Oi(V)&&!(V in k)&&n(w,V,R[V],null,q,x);for(const V in k){if(Oi(V))continue;const iA=k[V],eA=R[V];iA!==eA&&V!=="value"&&n(w,V,eA,iA,q,x)}"value"in k&&n(w,"value",R.value,k.value,q)}},L=(w,R,k,x,q,V,iA,eA,m)=>{const y=R.el=w?w.el:g(""),M=R.anchor=w?w.anchor:g("");let{patchFlag:O,dynamicChildren:nA,slotScopeIds:Z}=R;Z&&(eA=eA?eA.concat(Z):Z),w==null?(i(y,k,x),i(M,k,x),G(R.children||[],k,M,q,V,iA,eA,m)):O>0&&O&64&&nA&&w.dynamicChildren&&w.dynamicChildren.length===nA.length?(S(w.dynamicChildren,nA,k,q,V,iA,eA),(R.key!=null||q&&R===q.subTree)&&$I(w,R,!0)):tA(w,R,k,M,q,V,iA,eA,m)},QA=(w,R,k,x,q,V,iA,eA,m)=>{R.slotScopeIds=eA,w==null?R.shapeFlag&512?q.ctx.activate(R,k,x,iA,m):dA(R,k,x,q,V,iA,m):IA(w,R,m)},dA=(w,R,k,x,q,V,iA)=>{const eA=w.component=YQ(w,x,q);if(MI(w)&&(eA.ctx.renderer=cA),_Q(eA,!1,iA),eA.asyncDep){if(q&&q.registerDep(eA,oA,iA),!w.el){const m=eA.subTree=TA(Kt);E(null,m,R,k),w.placeholder=m.el}}else oA(eA,w,R,k,q,V,iA)},IA=(w,R,k)=>{const x=R.component=w.component;if(mQ(w,R,k))if(x.asyncDep&&!x.asyncResolved){X(x,R,k);return}else x.next=R,x.update();else R.el=w.el,x.vnode=R},oA=(w,R,k,x,q,V,iA)=>{const eA=()=>{if(w.isMounted){let{next:O,bu:nA,u:Z,parent:U,vnode:P}=w;{const Ce=AC(w);if(Ce){O&&(O.el=P.el,X(w,O,iA)),Ce.asyncDep.then(()=>{w.isUnmounted||eA()});return}}let uA=O,bA;Xt(w,!1),O?(O.el=P.el,X(w,O,iA)):O=P,nA&&To(nA),(bA=O.props&&O.props.onVnodeBeforeUpdate)&&ze(bA,U,O,P),Xt(w,!0);const jA=Og(w),he=w.subTree;w.subTree=jA,f(he,jA,l(he.el),Y(he),w,q,V),O.el=jA.el,uA===null&&yQ(w,jA.el),Z&&Se(Z,q),(bA=O.props&&O.props.onVnodeUpdated)&&Se(()=>ze(bA,U,O,P),q)}else{let O;const{el:nA,props:Z}=R,{bm:U,m:P,parent:uA,root:bA,type:jA}=w,he=qi(R);Xt(w,!1),U&&To(U),!he&&(O=Z&&Z.onVnodeBeforeMount)&&ze(O,uA,R),Xt(w,!0);{bA.ce&&bA.ce._def.shadowRoot!==!1&&bA.ce._injectChildStyle(jA);const Ce=w.subTree=Og(w);f(null,Ce,k,x,w,q,V),R.el=Ce.el}if(P&&Se(P,q),!he&&(O=Z&&Z.onVnodeMounted)){const Ce=R;Se(()=>ze(O,uA,Ce),q)}(R.shapeFlag&256||uA&&qi(uA.vnode)&&uA.vnode.shapeFlag&256)&&w.a&&Se(w.a,q),w.isMounted=!0,R=k=x=null}};w.scope.on();const m=w.effect=new CI(eA);w.scope.off();const y=w.update=m.run.bind(m),M=w.job=m.runIfDirty.bind(m);M.i=w,M.id=w.uid,m.scheduler=()=>ig(M),Xt(w,!0),y()},X=(w,R,k)=>{R.component=w;const x=w.vnode.props;w.vnode=R,w.next=null,DQ(w,R.props,x,k),SQ(w,R.children,k),wt(),xg(w),Dt()},tA=(w,R,k,x,q,V,iA,eA,m=!1)=>{const y=w&&w.children,M=w?w.shapeFlag:0,O=R.children,{patchFlag:nA,shapeFlag:Z}=R;if(nA>0){if(nA&128){_(y,O,k,x,q,V,iA,eA,m);return}else if(nA&256){fA(y,O,k,x,q,V,iA,eA,m);return}}Z&8?(M&16&&LA(y,q,V),O!==y&&I(k,O)):M&16?Z&16?_(y,O,k,x,q,V,iA,eA,m):LA(y,q,V,!0):(M&8&&I(k,""),Z&16&&G(O,k,x,q,V,iA,eA,m))},fA=(w,R,k,x,q,V,iA,eA,m)=>{w=w||hi,R=R||hi;const y=w.length,M=R.length,O=Math.min(y,M);let nA;for(nA=0;nAM?LA(w,q,V,!0,!1,O):G(R,k,x,q,V,iA,eA,m,O)},_=(w,R,k,x,q,V,iA,eA,m)=>{let y=0;const M=R.length;let O=w.length-1,nA=M-1;for(;y<=O&&y<=nA;){const Z=w[y],U=R[y]=m?xt(R[y]):tt(R[y]);if(xi(Z,U))f(Z,U,k,null,q,V,iA,eA,m);else break;y++}for(;y<=O&&y<=nA;){const Z=w[O],U=R[nA]=m?xt(R[nA]):tt(R[nA]);if(xi(Z,U))f(Z,U,k,null,q,V,iA,eA,m);else break;O--,nA--}if(y>O){if(y<=nA){const Z=nA+1,U=ZnA)for(;y<=O;)z(w[y],q,V,!0),y++;else{const Z=y,U=y,P=new Map;for(y=U;y<=nA;y++){const Fe=R[y]=m?xt(R[y]):tt(R[y]);Fe.key!=null&&P.set(Fe.key,y)}let uA,bA=0;const jA=nA-U+1;let he=!1,Ce=0;const jt=new Array(jA);for(y=0;y=jA){z(Fe,q,V,!0);continue}let Xe;if(Fe.key!=null)Xe=P.get(Fe.key);else for(uA=U;uA<=nA;uA++)if(jt[uA-U]===0&&xi(Fe,R[uA])){Xe=uA;break}Xe===void 0?z(Fe,q,V,!0):(jt[Xe-U]=y+1,Xe>=Ce?Ce=Xe:he=!0,f(Fe,R[Xe],k,null,q,V,iA,eA,m),bA++)}const Mn=he?GQ(jt):hi;for(uA=Mn.length-1,y=jA-1;y>=0;y--){const Fe=U+y,Xe=R[Fe],bg=R[Fe+1],Ng=Fe+1{const{el:V,type:iA,transition:eA,children:m,shapeFlag:y}=w;if(y&6){W(w.component.subTree,R,k,x);return}if(y&128){w.suspense.move(R,k,x);return}if(y&64){iA.move(w,R,k,cA);return}if(iA===qA){i(V,R,k);for(let O=0;OeA.enter(V),q);else{const{leave:O,delayLeave:nA,afterLeave:Z}=eA,U=()=>{w.ctx.isUnmounted?o(V):i(V,R,k)},P=()=>{V._isLeaving&&V[ZB](!0),O(V,()=>{U(),Z&&Z()})};nA?nA(V,U,P):P()}else i(V,R,k)},z=(w,R,k,x=!1,q=!1)=>{const{type:V,props:iA,ref:eA,children:m,dynamicChildren:y,shapeFlag:M,patchFlag:O,dirs:nA,cacheIndex:Z}=w;if(O===-2&&(q=!1),eA!=null&&(wt(),Wi(eA,null,k,w,!0),Dt()),Z!=null&&(R.renderCache[Z]=void 0),M&256){R.ctx.deactivate(w);return}const U=M&1&&nA,P=!qi(w);let uA;if(P&&(uA=iA&&iA.onVnodeBeforeUnmount)&&ze(uA,R,w),M&6)oe(w.component,k,x);else{if(M&128){w.suspense.unmount(k,x);return}U&&Zt(w,null,R,"beforeUnmount"),M&64?w.type.remove(w,R,k,cA,x):y&&!y.hasOnce&&(V!==qA||O>0&&O&64)?LA(y,R,k,!1,!0):(V===qA&&O&384||!q&&M&16)&&LA(m,R,k),x&&DA(w)}(P&&(uA=iA&&iA.onVnodeUnmounted)||U)&&Se(()=>{uA&&ze(uA,R,w),U&&Zt(w,null,R,"unmounted")},k)},DA=w=>{const{type:R,el:k,anchor:x,transition:q}=w;if(R===qA){NA(k,x);return}if(R===Yo){d(w);return}const V=()=>{o(k),q&&!q.persisted&&q.afterLeave&&q.afterLeave()};if(w.shapeFlag&1&&q&&!q.persisted){const{leave:iA,delayLeave:eA}=q,m=()=>iA(k,V);eA?eA(w.el,V,m):m()}else V()},NA=(w,R)=>{let k;for(;w!==R;)k=C(w),o(w),w=k;o(R)},oe=(w,R,k)=>{const{bum:x,scope:q,job:V,subTree:iA,um:eA,m,a:y}=w;Wg(m),Wg(y),x&&To(x),q.stop(),V&&(V.flags|=8,z(iA,w,R,k)),eA&&Se(eA,R),Se(()=>{w.isUnmounted=!0},R)},LA=(w,R,k,x=!1,q=!1,V=0)=>{for(let iA=V;iA{if(w.shapeFlag&6)return Y(w.component.subTree);if(w.shapeFlag&128)return w.suspense.next();const R=C(w.anchor||w.el),k=R&&R[qB];return k?C(k):R};let $=!1;const AA=(w,R,k)=>{let x;w==null?R._vnode&&(z(R._vnode,null,null,!0),x=R._vnode.component):f(R._vnode||null,w,R,null,null,null,k),R._vnode=w,$||($=!0,xg(x),RI(),$=!1)},cA={p:f,um:z,m:W,r:DA,mt:dA,mc:G,pc:tA,pbc:S,n:Y,o:A};return{render:AA,hydrate:void 0,createApp:EQ(AA)}}function Kn({type:A,props:e},t){return t==="svg"&&A==="foreignObject"||t==="mathml"&&A==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function Xt({effect:A,job:e},t){t?(A.flags|=32,e.flags|=4):(A.flags&=-33,e.flags&=-5)}function NQ(A,e){return(!A||A&&!A.pendingBranch)&&e&&!e.persisted}function $I(A,e,t=!1){const i=A.children,o=e.children;if(yA(i)&&yA(o))for(let n=0;n>1,A[t[g]]0&&(e[i]=t[n-1]),t[n]=i)}}for(n=t.length,r=t[n-1];n-- >0;)t[n]=r,r=e[r];return t}function AC(A){const e=A.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:AC(e)}function Wg(A){if(A)for(let e=0;eA.__isSuspense;function LQ(A,e){e&&e.pendingBranch?yA(A)?e.effects.push(...A):e.effects.push(A):KB(A)}const qA=Symbol.for("v-fgt"),fo=Symbol.for("v-txt"),Kt=Symbol.for("v-cmt"),Yo=Symbol.for("v-stc"),Zi=[];let be=null;function T(A=!1){Zi.push(be=A?null:[])}function UQ(){Zi.pop(),be=Zi[Zi.length-1]||null}let to=1;function $o(A,e=!1){to+=A,A<0&&be&&e&&(be.hasOnce=!0)}function iC(A){return A.dynamicChildren=to>0?be||hi:null,UQ(),to>0&&be&&be.push(A),A}function K(A,e,t,i,o,n){return iC(B(A,e,t,i,o,n,!0))}function ye(A,e,t,i,o){return iC(TA(A,e,t,i,o,!0))}function An(A){return A?A.__v_isVNode===!0:!1}function xi(A,e){return A.type===e.type&&A.key===e.key}const oC=({key:A})=>A??null,_o=({ref:A,ref_key:e,ref_for:t})=>(typeof A=="number"&&(A=""+A),A!=null?ee(A)||le(A)||FA(A)?{i:Re,r:A,k:e,f:!!t}:A:null);function B(A,e=null,t=null,i=0,o=null,n=A===qA?0:1,r=!1,g=!1){const s={__v_isVNode:!0,__v_skip:!0,type:A,props:e,key:e&&oC(e),ref:e&&_o(e),scopeId:NI,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:n,patchFlag:i,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:Re};return g?(gg(s,t),n&128&&A.normalize(s)):t&&(s.shapeFlag|=ee(t)?8:16),to>0&&!r&&be&&(s.patchFlag>0||n&6)&&s.patchFlag!==32&&be.push(s),s}const TA=MQ;function MQ(A,e=null,t=null,i=0,o=null,n=!1){if((!A||A===TI)&&(A=Kt),An(A)){const g=ki(A,e,!0);return t&&gg(g,t),to>0&&!n&&be&&(g.shapeFlag&6?be[be.indexOf(A)]=g:be.push(g)),g.patchFlag=-2,g}if(WQ(A)&&(A=A.__vccOpts),e){e=xQ(e);let{class:g,style:s}=e;g&&!ee(g)&&(e.class=kA(g)),KA(s)&&(eg(s)&&!yA(s)&&(s=ue({},s)),e.style=VA(s))}const r=ee(A)?1:tC(A)?128:jB(A)?64:KA(A)?4:FA(A)?2:0;return B(A,e,t,i,o,r,n,!0)}function xQ(A){return A?eg(A)||WI(A)?ue({},A):A:null}function ki(A,e,t=!1,i=!1){const{props:o,ref:n,patchFlag:r,children:g,transition:s}=A,a=e?JQ(o||{},e):o,I={__v_isVNode:!0,__v_skip:!0,type:A.type,props:a,key:a&&oC(a),ref:e&&e.ref?t&&n?yA(n)?n.concat(_o(e)):[n,_o(e)]:_o(e):n,scopeId:A.scopeId,slotScopeIds:A.slotScopeIds,children:g,target:A.target,targetStart:A.targetStart,targetAnchor:A.targetAnchor,staticCount:A.staticCount,shapeFlag:A.shapeFlag,patchFlag:e&&A.type!==qA?r===-1?16:r|16:r,dynamicProps:A.dynamicProps,dynamicChildren:A.dynamicChildren,appContext:A.appContext,dirs:A.dirs,transition:s,component:A.component,suspense:A.suspense,ssContent:A.ssContent&&ki(A.ssContent),ssFallback:A.ssFallback&&ki(A.ssFallback),placeholder:A.placeholder,el:A.el,anchor:A.anchor,ctx:A.ctx,ce:A.ce};return s&&i&&og(I,s.clone(I)),I}function gt(A=" ",e=0){return TA(fo,null,A,e)}function Dn(A,e){const t=TA(Yo,null,A);return t.staticCount=e,t}function sA(A="",e=!1){return e?(T(),ye(Kt,null,A)):TA(Kt,null,A)}function tt(A){return A==null||typeof A=="boolean"?TA(Kt):yA(A)?TA(qA,null,A.slice()):An(A)?xt(A):TA(fo,null,String(A))}function xt(A){return A.el===null&&A.patchFlag!==-1||A.memo?A:ki(A)}function gg(A,e){let t=0;const{shapeFlag:i}=A;if(e==null)e=null;else if(yA(e))t=16;else if(typeof e=="object")if(i&65){const o=e.default;o&&(o._c&&(o._d=!1),gg(A,o()),o._c&&(o._d=!0));return}else{t=32;const o=e._;!o&&!WI(e)?e._ctx=Re:o===3&&Re&&(Re.slots._===1?e._=1:(e._=2,A.patchFlag|=1024))}else FA(e)?(e={default:e,_ctx:Re},t=32):(e=String(e),i&64?(t=16,e=[gt(e)]):t=8);A.children=e,A.shapeFlag|=t}function JQ(...A){const e={};for(let t=0;tEe||Re;let en,hr;{const A=hn(),e=(t,i)=>{let o;return(o=A[t])||(o=A[t]=[]),o.push(i),n=>{o.length>1?o.forEach(r=>r(n)):o[0](n)}};en=e("__VUE_INSTANCE_SETTERS__",t=>Ee=t),hr=e("__VUE_SSR_SETTERS__",t=>io=t)}const po=A=>{const e=Ee;return en(A),A.scope.on(),()=>{A.scope.off(),en(e)}},qg=()=>{Ee&&Ee.scope.off(),en(null)};function nC(A){return A.vnode.shapeFlag&4}let io=!1;function _Q(A,e=!1,t=!1){e&&hr(e);const{props:i,children:o}=A.vnode,n=nC(A);wQ(A,i,n,e),FQ(A,o,t||e);const r=n?KQ(A,e):void 0;return e&&hr(!1),r}function KQ(A,e){const t=A.type;A.accessCache=Object.create(null),A.proxy=new Proxy(A.ctx,aQ);const{setup:i}=t;if(i){wt();const o=A.setupContext=i.length>1?PQ(A):null,n=po(A),r=Eo(i,A,0,[A.props,o]),g=iI(r);if(Dt(),n(),(g||A.sp)&&!qi(A)&&UI(A),g){if(r.then(qg,qg),e)return r.then(s=>{jg(A,s)}).catch(s=>{mn(s,A,0)});A.asyncDep=r}else jg(A,r)}else rC(A)}function jg(A,e,t){FA(e)?A.type.__ssrInlineRender?A.ssrRender=e:A.render=e:KA(e)&&(A.setupState=vI(e)),rC(A)}function rC(A,e,t){const i=A.type;A.render||(A.render=i.render||nt);{const o=po(A);wt();try{IQ(A)}finally{Dt(),o()}}}const OQ={get(A,e){return ce(A,"get",""),A[e]}};function PQ(A){const e=t=>{A.exposed=t||{}};return{attrs:new Proxy(A.attrs,OQ),slots:A.slots,emit:A.emit,expose:e}}function kn(A){return A.exposed?A.exposeProxy||(A.exposeProxy=new Proxy(vI(_i(A.exposed)),{get(e,t){if(t in e)return e[t];if(t in ji)return ji[t](A)},has(e,t){return t in e||t in ji}})):A.proxy}function VQ(A,e=!0){return FA(A)?A.displayName||A.name:A.name||e&&A.__name}function WQ(A){return FA(A)&&"__vccOpts"in A}const hA=(A,e)=>JB(A,e,io);function GA(A,e,t){try{$o(-1);const i=arguments.length;return i===2?KA(e)&&!yA(e)?An(e)?TA(A,null,[e]):TA(A,e):TA(A,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):i===3&&An(t)&&(t=[t]),TA(A,e,t))}finally{$o(1)}}const qQ="3.5.26";/** +* @vue/runtime-dom v3.5.26 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/let fr;const Zg=typeof window<"u"&&window.trustedTypes;if(Zg)try{fr=Zg.createPolicy("vue",{createHTML:A=>A})}catch{}const gC=fr?A=>fr.createHTML(A):A=>A,jQ="http://www.w3.org/2000/svg",ZQ="http://www.w3.org/1998/Math/MathML",Et=typeof document<"u"?document:null,Xg=Et&&Et.createElement("template"),XQ={insert:(A,e,t)=>{e.insertBefore(A,t||null)},remove:A=>{const e=A.parentNode;e&&e.removeChild(A)},createElement:(A,e,t,i)=>{const o=e==="svg"?Et.createElementNS(jQ,A):e==="mathml"?Et.createElementNS(ZQ,A):t?Et.createElement(A,{is:t}):Et.createElement(A);return A==="select"&&i&&i.multiple!=null&&o.setAttribute("multiple",i.multiple),o},createText:A=>Et.createTextNode(A),createComment:A=>Et.createComment(A),setText:(A,e)=>{A.nodeValue=e},setElementText:(A,e)=>{A.textContent=e},parentNode:A=>A.parentNode,nextSibling:A=>A.nextSibling,querySelector:A=>Et.querySelector(A),setScopeId(A,e){A.setAttribute(e,"")},insertStaticContent(A,e,t,i,o,n){const r=t?t.previousSibling:e.lastChild;if(o&&(o===n||o.nextSibling))for(;e.insertBefore(o.cloneNode(!0),t),!(o===n||!(o=o.nextSibling)););else{Xg.innerHTML=gC(i==="svg"?`${A}`:i==="mathml"?`${A}`:A);const g=Xg.content;if(i==="svg"||i==="mathml"){const s=g.firstChild;for(;s.firstChild;)g.appendChild(s.firstChild);g.removeChild(s)}e.insertBefore(g,t)}return[r?r.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},zQ=Symbol("_vtc");function $Q(A,e,t){const i=A[zQ];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?A.removeAttribute("class"):t?A.setAttribute("class",e):A.className=e}const zg=Symbol("_vod"),Ac=Symbol("_vsh"),ec=Symbol(""),tc=/(?:^|;)\s*display\s*:/;function ic(A,e,t){const i=A.style,o=ee(t);let n=!1;if(t&&!o){if(e)if(ee(e))for(const r of e.split(";")){const g=r.slice(0,r.indexOf(":")).trim();t[g]==null&&Ko(i,g,"")}else for(const r in e)t[r]==null&&Ko(i,r,"");for(const r in t)r==="display"&&(n=!0),Ko(i,r,t[r])}else if(o){if(e!==t){const r=i[ec];r&&(t+=";"+r),i.cssText=t,n=tc.test(t)}}else e&&A.removeAttribute("style");zg in A&&(A[zg]=n?i.display:"",A[Ac]&&(i.display="none"))}const $g=/\s*!important$/;function Ko(A,e,t){if(yA(t))t.forEach(i=>Ko(A,e,i));else if(t==null&&(t=""),e.startsWith("--"))A.setProperty(e,t);else{const i=oc(A,e);$g.test(t)?A.setProperty(Ii(i),t.replace($g,""),"important"):A[i]=t}}const As=["Webkit","Moz","ms"],On={};function oc(A,e){const t=On[e];if(t)return t;let i=Je(e);if(i!=="filter"&&i in A)return On[e]=i;i=En(i);for(let o=0;oPn||(sc.then(()=>Pn=0),Pn=Date.now());function Ic(A,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;Ct(Cc(i,t.value),e,5,[i])};return t.value=A,t.attached=ac(),t}function Cc(A,e){if(yA(e)){const t=A.stopImmediatePropagation;return A.stopImmediatePropagation=()=>{t.call(A),A._stopped=!0},e.map(i=>o=>!o._stopped&&i&&i(o))}else return e}const rs=A=>A.charCodeAt(0)===111&&A.charCodeAt(1)===110&&A.charCodeAt(2)>96&&A.charCodeAt(2)<123,lc=(A,e,t,i,o,n)=>{const r=o==="svg";e==="class"?$Q(A,i,r):e==="style"?ic(A,t,i):Bn(e)?Vr(e)||rc(A,e,t,i,n):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Bc(A,e,i,r))?(is(A,e,i),!A.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&ts(A,e,i,r,n,e!=="value")):A._isVueCE&&(/[A-Z]/.test(e)||!ee(i))?is(A,Je(e),i,n,e):(e==="true-value"?A._trueValue=i:e==="false-value"&&(A._falseValue=i),ts(A,e,i,r))};function Bc(A,e,t,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in A&&rs(e)&&FA(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&A.tagName==="IFRAME"||e==="form"||e==="list"&&A.tagName==="INPUT"||e==="type"&&A.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const o=A.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return rs(e)&&ee(t)?!1:e in A}const tn=A=>{const e=A.props["onUpdate:modelValue"]||!1;return yA(e)?t=>To(e,t):e};function Qc(A){A.target.composing=!0}function gs(A){const e=A.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const mi=Symbol("_assign");function ss(A,e,t){return e&&(A=A.trim()),t&&(A=un(A)),A}const te={created(A,{modifiers:{lazy:e,trim:t,number:i}},o){A[mi]=tn(o);const n=i||o.props&&o.props.type==="number";ti(A,e?"change":"input",r=>{r.target.composing||A[mi](ss(A.value,t,n))}),(t||n)&&ti(A,"change",()=>{A.value=ss(A.value,t,n)}),e||(ti(A,"compositionstart",Qc),ti(A,"compositionend",gs),ti(A,"change",gs))},mounted(A,{value:e}){A.value=e??""},beforeUpdate(A,{value:e,oldValue:t,modifiers:{lazy:i,trim:o,number:n}},r){if(A[mi]=tn(r),A.composing)return;const g=(n||A.type==="number")&&!/^0\d/.test(A.value)?un(A.value):A.value,s=e??"";g!==s&&(document.activeElement===A&&A.type!=="range"&&(i&&e===t||o&&A.value.trim()===s)||(A.value=s))}},dr={deep:!0,created(A,{value:e,modifiers:{number:t}},i){const o=Qn(e);ti(A,"change",()=>{const n=Array.prototype.filter.call(A.options,r=>r.selected).map(r=>t?un(on(r)):on(r));A[mi](A.multiple?o?new Set(n):n:n[0]),A._assigning=!0,uo(()=>{A._assigning=!1})}),A[mi]=tn(i)},mounted(A,{value:e}){as(A,e)},beforeUpdate(A,e,t){A[mi]=tn(t)},updated(A,{value:e}){A._assigning||as(A,e)}};function as(A,e){const t=A.multiple,i=yA(e);if(!(t&&!i&&!Qn(e))){for(let o=0,n=A.options.length;oString(a)===String(g)):r.selected=QB(e,g)>-1}else r.selected=e.has(g);else if(fn(on(r),e)){A.selectedIndex!==o&&(A.selectedIndex=o);return}}!t&&A.selectedIndex!==-1&&(A.selectedIndex=-1)}}function on(A){return"_value"in A?A._value:A.value}const cc=["ctrl","shift","alt","meta"],Ec={stop:A=>A.stopPropagation(),prevent:A=>A.preventDefault(),self:A=>A.target!==A.currentTarget,ctrl:A=>!A.ctrlKey,shift:A=>!A.shiftKey,alt:A=>!A.altKey,meta:A=>!A.metaKey,left:A=>"button"in A&&A.button!==0,middle:A=>"button"in A&&A.button!==1,right:A=>"button"in A&&A.button!==2,exact:(A,e)=>cc.some(t=>A[`${t}Key`]&&!e.includes(t))},dt=(A,e)=>{const t=A._withMods||(A._withMods={}),i=e.join(".");return t[i]||(t[i]=(o,...n)=>{for(let r=0;r{const e=hc().createApp(...A),{mount:t}=e;return e.mount=i=>{const o=pc(i);if(!o)return;const n=e._component;!FA(n)&&!n.render&&!n.template&&(n.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const r=t(o,!1,dc(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),r},e};function dc(A){if(A instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&A instanceof MathMLElement)return"mathml"}function pc(A){return ee(A)?document.querySelector(A):A}/*! + * shared v9.14.5 + * (c) 2025 kazuya kawaguchi + * Released under the MIT License. + */function mc(A,e){typeof console<"u"&&(console.warn("[intlify] "+A),e&&console.warn(e.stack))}const nn=typeof window<"u",Vt=(A,e=!1)=>e?Symbol.for(A):Symbol(A),yc=(A,e,t)=>wc({l:A,k:e,s:t}),wc=A=>JSON.stringify(A).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),Ae=A=>typeof A=="number"&&isFinite(A),Dc=A=>aC(A)==="[object Date]",Ot=A=>aC(A)==="[object RegExp]",vn=A=>vA(A)&&Object.keys(A).length===0,Be=Object.assign,kc=Object.create,HA=(A=null)=>kc(A);let Cs;const ft=()=>Cs||(Cs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:HA());function ls(A){return A.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/").replace(/=/g,"=")}function Bs(A){return A.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function vc(A){return A=A.replace(/(\w+)\s*=\s*"([^"]*)"/g,(i,o,n)=>`${o}="${Bs(n)}"`),A=A.replace(/(\w+)\s*=\s*'([^']*)'/g,(i,o,n)=>`${o}='${Bs(n)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(A)&&(A=A.replace(/(\s+)(on)(\w+\s*=)/gi,"$1on$3")),[/(\s+(?:href|src|action|formaction)\s*=\s*["']?)\s*javascript:/gi,/(style\s*=\s*["'][^"']*url\s*\(\s*)javascript:/gi].forEach(i=>{A=A.replace(i,"$1javascript:")}),A}const Fc=Object.prototype.hasOwnProperty;function He(A,e){return Fc.call(A,e)}const WA=Array.isArray,PA=A=>typeof A=="function",gA=A=>typeof A=="string",RA=A=>typeof A=="boolean",UA=A=>A!==null&&typeof A=="object",Sc=A=>UA(A)&&PA(A.then)&&PA(A.catch),sC=Object.prototype.toString,aC=A=>sC.call(A),vA=A=>{if(!UA(A))return!1;const e=Object.getPrototypeOf(A);return e===null||e.constructor===Object},Rc=A=>A==null?"":WA(A)||vA(A)&&A.toString===sC?JSON.stringify(A,null,2):String(A);function bc(A,e=""){return A.reduce((t,i,o)=>o===0?t+i:t+e+i,"")}function Fn(A){let e=A;return()=>++e}const Ro=A=>!UA(A)||WA(A);function Oo(A,e){if(Ro(A)||Ro(e))throw new Error("Invalid value");const t=[{src:A,des:e}];for(;t.length;){const{src:i,des:o}=t.pop();Object.keys(i).forEach(n=>{n!=="__proto__"&&(UA(i[n])&&!UA(o[n])&&(o[n]=Array.isArray(i[n])?[]:HA()),Ro(o[n])||Ro(i[n])?o[n]=i[n]:t.push({src:i[n],des:o[n]}))})}}/*! + * message-compiler v9.14.5 + * (c) 2025 kazuya kawaguchi + * Released under the MIT License. + */function Nc(A,e,t){return{line:A,column:e,offset:t}}function rn(A,e,t){return{start:A,end:e}}const Gc=/\{([0-9a-zA-Z]+)\}/g;function IC(A,...e){return e.length===1&&Lc(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),A.replace(Gc,(t,i)=>e.hasOwnProperty(i)?e[i]:"")}const CC=Object.assign,Qs=A=>typeof A=="string",Lc=A=>A!==null&&typeof A=="object";function lC(A,e=""){return A.reduce((t,i,o)=>o===0?t+i:t+e+i,"")}const sg={USE_MODULO_SYNTAX:1,__EXTEND_POINT__:2},Uc={[sg.USE_MODULO_SYNTAX]:"Use modulo before '{{0}}'."};function Mc(A,e,...t){const i=IC(Uc[A],...t||[]),o={message:String(i),code:A};return e&&(o.location=e),o}const pA={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16,__EXTEND_POINT__:17},xc={[pA.EXPECTED_TOKEN]:"Expected token: '{0}'",[pA.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[pA.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[pA.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[pA.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[pA.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[pA.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[pA.EMPTY_PLACEHOLDER]:"Empty placeholder",[pA.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[pA.INVALID_LINKED_FORMAT]:"Invalid linked format",[pA.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[pA.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[pA.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[pA.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[pA.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[pA.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function Gi(A,e,t={}){const{domain:i,messages:o,args:n}=t,r=IC((o||xc)[A]||"",...n||[]),g=new SyntaxError(String(r));return g.code=A,e&&(g.location=e),g.domain=i,g}function Jc(A){throw A}const Bt=" ",Tc="\r",de=` +`,Hc="\u2028",Yc="\u2029";function _c(A){const e=A;let t=0,i=1,o=1,n=0;const r=N=>e[N]===Tc&&e[N+1]===de,g=N=>e[N]===de,s=N=>e[N]===Yc,a=N=>e[N]===Hc,I=N=>r(N)||g(N)||s(N)||a(N),l=()=>t,C=()=>i,Q=()=>o,h=()=>n,f=N=>r(N)||s(N)||a(N)?de:e[N],u=()=>f(t),E=()=>f(t+n);function D(){return n=0,I(t)&&(i++,o=0),r(t)&&t++,t++,o++,e[t]}function c(){return r(t+n)&&n++,n++,e[t+n]}function d(){t=0,i=1,o=1,n=0}function p(N=0){n=N}function v(){const N=t+n;for(;N!==t;)D();n=0}return{index:l,line:C,column:Q,peekOffset:h,charAt:f,currentChar:u,currentPeek:E,next:D,peek:c,reset:d,resetPeek:p,skipToPeek:v}}const Rt=void 0,Kc=".",cs="'",Oc="tokenizer";function Pc(A,e={}){const t=e.location!==!1,i=_c(A),o=()=>i.index(),n=()=>Nc(i.line(),i.column(),i.index()),r=n(),g=o(),s={currentType:14,offset:g,startLoc:r,endLoc:r,lastType:14,lastOffset:g,lastStartLoc:r,lastEndLoc:r,braceNest:0,inLinked:!1,text:""},a=()=>s,{onError:I}=e;function l(m,y,M,...O){const nA=a();if(y.column+=M,y.offset+=M,I){const Z=t?rn(nA.startLoc,y):null,U=Gi(m,Z,{domain:Oc,args:O});I(U)}}function C(m,y,M){m.endLoc=n(),m.currentType=y;const O={type:y};return t&&(O.loc=rn(m.startLoc,m.endLoc)),M!=null&&(O.value=M),O}const Q=m=>C(m,14);function h(m,y){return m.currentChar()===y?(m.next(),y):(l(pA.EXPECTED_TOKEN,n(),0,y),"")}function f(m){let y="";for(;m.currentPeek()===Bt||m.currentPeek()===de;)y+=m.currentPeek(),m.peek();return y}function u(m){const y=f(m);return m.skipToPeek(),y}function E(m){if(m===Rt)return!1;const y=m.charCodeAt(0);return y>=97&&y<=122||y>=65&&y<=90||y===95}function D(m){if(m===Rt)return!1;const y=m.charCodeAt(0);return y>=48&&y<=57}function c(m,y){const{currentType:M}=y;if(M!==2)return!1;f(m);const O=E(m.currentPeek());return m.resetPeek(),O}function d(m,y){const{currentType:M}=y;if(M!==2)return!1;f(m);const O=m.currentPeek()==="-"?m.peek():m.currentPeek(),nA=D(O);return m.resetPeek(),nA}function p(m,y){const{currentType:M}=y;if(M!==2)return!1;f(m);const O=m.currentPeek()===cs;return m.resetPeek(),O}function v(m,y){const{currentType:M}=y;if(M!==8)return!1;f(m);const O=m.currentPeek()===".";return m.resetPeek(),O}function N(m,y){const{currentType:M}=y;if(M!==9)return!1;f(m);const O=E(m.currentPeek());return m.resetPeek(),O}function G(m,y){const{currentType:M}=y;if(!(M===8||M===12))return!1;f(m);const O=m.currentPeek()===":";return m.resetPeek(),O}function H(m,y){const{currentType:M}=y;if(M!==10)return!1;const O=()=>{const Z=m.currentPeek();return Z==="{"?E(m.peek()):Z==="@"||Z==="%"||Z==="|"||Z===":"||Z==="."||Z===Bt||!Z?!1:Z===de?(m.peek(),O()):L(m,!1)},nA=O();return m.resetPeek(),nA}function S(m){f(m);const y=m.currentPeek()==="|";return m.resetPeek(),y}function b(m){const y=f(m),M=m.currentPeek()==="%"&&m.peek()==="{";return m.resetPeek(),{isModulo:M,hasSpace:y.length>0}}function L(m,y=!0){const M=(nA=!1,Z="",U=!1)=>{const P=m.currentPeek();return P==="{"?Z==="%"?!1:nA:P==="@"||!P?Z==="%"?!0:nA:P==="%"?(m.peek(),M(nA,"%",!0)):P==="|"?Z==="%"||U?!0:!(Z===Bt||Z===de):P===Bt?(m.peek(),M(!0,Bt,U)):P===de?(m.peek(),M(!0,de,U)):!0},O=M();return y&&m.resetPeek(),O}function QA(m,y){const M=m.currentChar();return M===Rt?Rt:y(M)?(m.next(),M):null}function dA(m){const y=m.charCodeAt(0);return y>=97&&y<=122||y>=65&&y<=90||y>=48&&y<=57||y===95||y===36}function IA(m){return QA(m,dA)}function oA(m){const y=m.charCodeAt(0);return y>=97&&y<=122||y>=65&&y<=90||y>=48&&y<=57||y===95||y===36||y===45}function X(m){return QA(m,oA)}function tA(m){const y=m.charCodeAt(0);return y>=48&&y<=57}function fA(m){return QA(m,tA)}function _(m){const y=m.charCodeAt(0);return y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102}function W(m){return QA(m,_)}function z(m){let y="",M="";for(;y=fA(m);)M+=y;return M}function DA(m){u(m);const y=m.currentChar();return y!=="%"&&l(pA.EXPECTED_TOKEN,n(),0,y),m.next(),"%"}function NA(m){let y="";for(;;){const M=m.currentChar();if(M==="{"||M==="}"||M==="@"||M==="|"||!M)break;if(M==="%")if(L(m))y+=M,m.next();else break;else if(M===Bt||M===de)if(L(m))y+=M,m.next();else{if(S(m))break;y+=M,m.next()}else y+=M,m.next()}return y}function oe(m){u(m);let y="",M="";for(;y=X(m);)M+=y;return m.currentChar()===Rt&&l(pA.UNTERMINATED_CLOSING_BRACE,n(),0),M}function LA(m){u(m);let y="";return m.currentChar()==="-"?(m.next(),y+=`-${z(m)}`):y+=z(m),m.currentChar()===Rt&&l(pA.UNTERMINATED_CLOSING_BRACE,n(),0),y}function Y(m){return m!==cs&&m!==de}function $(m){u(m),h(m,"'");let y="",M="";for(;y=QA(m,Y);)y==="\\"?M+=AA(m):M+=y;const O=m.currentChar();return O===de||O===Rt?(l(pA.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,n(),0),O===de&&(m.next(),h(m,"'")),M):(h(m,"'"),M)}function AA(m){const y=m.currentChar();switch(y){case"\\":case"'":return m.next(),`\\${y}`;case"u":return cA(m,y,4);case"U":return cA(m,y,6);default:return l(pA.UNKNOWN_ESCAPE_SEQUENCE,n(),0,y),""}}function cA(m,y,M){h(m,y);let O="";for(let nA=0;nA{const O=m.currentChar();return O==="{"||O==="%"||O==="@"||O==="|"||O==="("||O===")"||!O||O===Bt?M:(M+=O,m.next(),y(M))};return y("")}function x(m){u(m);const y=h(m,"|");return u(m),y}function q(m,y){let M=null;switch(m.currentChar()){case"{":return y.braceNest>=1&&l(pA.NOT_ALLOW_NEST_PLACEHOLDER,n(),0),m.next(),M=C(y,2,"{"),u(m),y.braceNest++,M;case"}":return y.braceNest>0&&y.currentType===2&&l(pA.EMPTY_PLACEHOLDER,n(),0),m.next(),M=C(y,3,"}"),y.braceNest--,y.braceNest>0&&u(m),y.inLinked&&y.braceNest===0&&(y.inLinked=!1),M;case"@":return y.braceNest>0&&l(pA.UNTERMINATED_CLOSING_BRACE,n(),0),M=V(m,y)||Q(y),y.braceNest=0,M;default:{let nA=!0,Z=!0,U=!0;if(S(m))return y.braceNest>0&&l(pA.UNTERMINATED_CLOSING_BRACE,n(),0),M=C(y,1,x(m)),y.braceNest=0,y.inLinked=!1,M;if(y.braceNest>0&&(y.currentType===5||y.currentType===6||y.currentType===7))return l(pA.UNTERMINATED_CLOSING_BRACE,n(),0),y.braceNest=0,iA(m,y);if(nA=c(m,y))return M=C(y,5,oe(m)),u(m),M;if(Z=d(m,y))return M=C(y,6,LA(m)),u(m),M;if(U=p(m,y))return M=C(y,7,$(m)),u(m),M;if(!nA&&!Z&&!U)return M=C(y,13,w(m)),l(pA.INVALID_TOKEN_IN_PLACEHOLDER,n(),0,M.value),u(m),M;break}}return M}function V(m,y){const{currentType:M}=y;let O=null;const nA=m.currentChar();switch((M===8||M===9||M===12||M===10)&&(nA===de||nA===Bt)&&l(pA.INVALID_LINKED_FORMAT,n(),0),nA){case"@":return m.next(),O=C(y,8,"@"),y.inLinked=!0,O;case".":return u(m),m.next(),C(y,9,".");case":":return u(m),m.next(),C(y,10,":");default:return S(m)?(O=C(y,1,x(m)),y.braceNest=0,y.inLinked=!1,O):v(m,y)||G(m,y)?(u(m),V(m,y)):N(m,y)?(u(m),C(y,12,R(m))):H(m,y)?(u(m),nA==="{"?q(m,y)||O:C(y,11,k(m))):(M===8&&l(pA.INVALID_LINKED_FORMAT,n(),0),y.braceNest=0,y.inLinked=!1,iA(m,y))}}function iA(m,y){let M={type:14};if(y.braceNest>0)return q(m,y)||Q(y);if(y.inLinked)return V(m,y)||Q(y);switch(m.currentChar()){case"{":return q(m,y)||Q(y);case"}":return l(pA.UNBALANCED_CLOSING_BRACE,n(),0),m.next(),C(y,3,"}");case"@":return V(m,y)||Q(y);default:{if(S(m))return M=C(y,1,x(m)),y.braceNest=0,y.inLinked=!1,M;const{isModulo:nA,hasSpace:Z}=b(m);if(nA)return Z?C(y,0,NA(m)):C(y,4,DA(m));if(L(m))return C(y,0,NA(m));break}}return M}function eA(){const{currentType:m,offset:y,startLoc:M,endLoc:O}=s;return s.lastType=m,s.lastOffset=y,s.lastStartLoc=M,s.lastEndLoc=O,s.offset=o(),s.startLoc=n(),i.currentChar()===Rt?C(s,14):iA(i,s)}return{nextToken:eA,currentOffset:o,currentPosition:n,context:a}}const Vc="parser",Wc=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function qc(A,e,t){switch(A){case"\\\\":return"\\";case"\\'":return"'";default:{const i=parseInt(e||t,16);return i<=55295||i>=57344?String.fromCodePoint(i):"�"}}}function jc(A={}){const e=A.location!==!1,{onError:t,onWarn:i}=A;function o(c,d,p,v,...N){const G=c.currentPosition();if(G.offset+=v,G.column+=v,t){const H=e?rn(p,G):null,S=Gi(d,H,{domain:Vc,args:N});t(S)}}function n(c,d,p,v,...N){const G=c.currentPosition();if(G.offset+=v,G.column+=v,i){const H=e?rn(p,G):null;i(Mc(d,H,N))}}function r(c,d,p){const v={type:c};return e&&(v.start=d,v.end=d,v.loc={start:p,end:p}),v}function g(c,d,p,v){e&&(c.end=d,c.loc&&(c.loc.end=p))}function s(c,d){const p=c.context(),v=r(3,p.offset,p.startLoc);return v.value=d,g(v,c.currentOffset(),c.currentPosition()),v}function a(c,d){const p=c.context(),{lastOffset:v,lastStartLoc:N}=p,G=r(5,v,N);return G.index=parseInt(d,10),c.nextToken(),g(G,c.currentOffset(),c.currentPosition()),G}function I(c,d,p){const v=c.context(),{lastOffset:N,lastStartLoc:G}=v,H=r(4,N,G);return H.key=d,p===!0&&(H.modulo=!0),c.nextToken(),g(H,c.currentOffset(),c.currentPosition()),H}function l(c,d){const p=c.context(),{lastOffset:v,lastStartLoc:N}=p,G=r(9,v,N);return G.value=d.replace(Wc,qc),c.nextToken(),g(G,c.currentOffset(),c.currentPosition()),G}function C(c){const d=c.nextToken(),p=c.context(),{lastOffset:v,lastStartLoc:N}=p,G=r(8,v,N);return d.type!==12?(o(c,pA.UNEXPECTED_EMPTY_LINKED_MODIFIER,p.lastStartLoc,0),G.value="",g(G,v,N),{nextConsumeToken:d,node:G}):(d.value==null&&o(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,p.lastStartLoc,0,Te(d)),G.value=d.value||"",g(G,c.currentOffset(),c.currentPosition()),{node:G})}function Q(c,d){const p=c.context(),v=r(7,p.offset,p.startLoc);return v.value=d,g(v,c.currentOffset(),c.currentPosition()),v}function h(c){const d=c.context(),p=r(6,d.offset,d.startLoc);let v=c.nextToken();if(v.type===9){const N=C(c);p.modifier=N.node,v=N.nextConsumeToken||c.nextToken()}switch(v.type!==10&&o(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(v)),v=c.nextToken(),v.type===2&&(v=c.nextToken()),v.type){case 11:v.value==null&&o(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(v)),p.key=Q(c,v.value||"");break;case 5:v.value==null&&o(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(v)),p.key=I(c,v.value||"");break;case 6:v.value==null&&o(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(v)),p.key=a(c,v.value||"");break;case 7:v.value==null&&o(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(v)),p.key=l(c,v.value||"");break;default:{o(c,pA.UNEXPECTED_EMPTY_LINKED_KEY,d.lastStartLoc,0);const N=c.context(),G=r(7,N.offset,N.startLoc);return G.value="",g(G,N.offset,N.startLoc),p.key=G,g(p,N.offset,N.startLoc),{nextConsumeToken:v,node:p}}}return g(p,c.currentOffset(),c.currentPosition()),{node:p}}function f(c){const d=c.context(),p=d.currentType===1?c.currentOffset():d.offset,v=d.currentType===1?d.endLoc:d.startLoc,N=r(2,p,v);N.items=[];let G=null,H=null;do{const L=G||c.nextToken();switch(G=null,L.type){case 0:L.value==null&&o(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(L)),N.items.push(s(c,L.value||""));break;case 6:L.value==null&&o(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(L)),N.items.push(a(c,L.value||""));break;case 4:H=!0;break;case 5:L.value==null&&o(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(L)),N.items.push(I(c,L.value||"",!!H)),H&&(n(c,sg.USE_MODULO_SYNTAX,d.lastStartLoc,0,Te(L)),H=null);break;case 7:L.value==null&&o(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(L)),N.items.push(l(c,L.value||""));break;case 8:{const QA=h(c);N.items.push(QA.node),G=QA.nextConsumeToken||null;break}}}while(d.currentType!==14&&d.currentType!==1);const S=d.currentType===1?d.lastOffset:c.currentOffset(),b=d.currentType===1?d.lastEndLoc:c.currentPosition();return g(N,S,b),N}function u(c,d,p,v){const N=c.context();let G=v.items.length===0;const H=r(1,d,p);H.cases=[],H.cases.push(v);do{const S=f(c);G||(G=S.items.length===0),H.cases.push(S)}while(N.currentType!==14);return G&&o(c,pA.MUST_HAVE_MESSAGES_IN_PLURAL,p,0),g(H,c.currentOffset(),c.currentPosition()),H}function E(c){const d=c.context(),{offset:p,startLoc:v}=d,N=f(c);return d.currentType===14?N:u(c,p,v,N)}function D(c){const d=Pc(c,CC({},A)),p=d.context(),v=r(0,p.offset,p.startLoc);return e&&v.loc&&(v.loc.source=c),v.body=E(d),A.onCacheKey&&(v.cacheKey=A.onCacheKey(c)),p.currentType!==14&&o(d,pA.UNEXPECTED_LEXICAL_ANALYSIS,p.lastStartLoc,0,c[p.offset]||""),g(v,d.currentOffset(),d.currentPosition()),v}return{parse:D}}function Te(A){if(A.type===14)return"EOF";const e=(A.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function Zc(A,e={}){const t={ast:A,helpers:new Set};return{context:()=>t,helper:n=>(t.helpers.add(n),n)}}function Es(A,e){for(let t=0;tus(t)),A}function us(A){if(A.items.length===1){const e=A.items[0];(e.type===3||e.type===9)&&(A.static=e.value,delete e.value)}else{const e=[];for(let t=0;tr;function s(f,u){r.code+=f}function a(f,u=!0){const E=u?i:"";s(o?E+" ".repeat(f):E)}function I(f=!0){const u=++r.indentLevel;f&&a(u)}function l(f=!0){const u=--r.indentLevel;f&&a(u)}function C(){a(r.indentLevel)}return{context:g,push:s,indent:I,deindent:l,newline:C,helper:f=>`_${f}`,needIndent:()=>r.needIndent}}function tE(A,e){const{helper:t}=A;A.push(`${t("linked")}(`),Fi(A,e.key),e.modifier?(A.push(", "),Fi(A,e.modifier),A.push(", _type")):A.push(", undefined, _type"),A.push(")")}function iE(A,e){const{helper:t,needIndent:i}=A;A.push(`${t("normalize")}([`),A.indent(i());const o=e.items.length;for(let n=0;n1){A.push(`${t("plural")}([`),A.indent(i());const o=e.cases.length;for(let n=0;n{const t=Qs(e.mode)?e.mode:"normal",i=Qs(e.filename)?e.filename:"message.intl";e.sourceMap;const o=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":` +`,n=e.needIndent?e.needIndent:t!=="arrow",r=A.helpers||[],g=eE(A,{filename:i,breakLineCode:o,needIndent:n});g.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),g.indent(n),r.length>0&&(g.push(`const { ${lC(r.map(I=>`${I}: _${I}`),", ")} } = ctx`),g.newline()),g.push("return "),Fi(g,A),g.deindent(n),g.push("}"),delete A.helpers;const{code:s,map:a}=g.context();return{ast:A,code:s,map:a?a.toJSON():void 0}};function gE(A,e={}){const t=CC({},e),i=!!t.jit,o=!!t.minify,n=t.optimize==null?!0:t.optimize,g=jc(t).parse(A);return i?(n&&zc(g),o&&ci(g),{ast:g,code:""}):(Xc(g,t),rE(g,t))}/*! + * core-base v9.14.5 + * (c) 2025 kazuya kawaguchi + * Released under the MIT License. + */function sE(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(ft().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(ft().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(ft().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function st(A){return UA(A)&&Ig(A)===0&&(He(A,"b")||He(A,"body"))}const BC=["b","body"];function aE(A){return Wt(A,BC)}const QC=["c","cases"];function IE(A){return Wt(A,QC,[])}const cC=["s","static"];function CE(A){return Wt(A,cC)}const EC=["i","items"];function lE(A){return Wt(A,EC,[])}const uC=["t","type"];function Ig(A){return Wt(A,uC)}const hC=["v","value"];function bo(A,e){const t=Wt(A,hC);if(t!=null)return t;throw oo(e)}const fC=["m","modifier"];function BE(A){return Wt(A,fC)}const dC=["k","key"];function QE(A){const e=Wt(A,dC);if(e)return e;throw oo(6)}function Wt(A,e,t){for(let i=0;i{r===void 0?r=g:r+=g},C[1]=()=>{r!==void 0&&(e.push(r),r=void 0)},C[2]=()=>{C[0](),o++},C[3]=()=>{if(o>0)o--,i=4,C[0]();else{if(o=0,r===void 0||(r=fE(r),r===!1))return!1;C[1]()}};function Q(){const h=A[t+1];if(i===5&&h==="'"||i===6&&h==='"')return t++,g="\\"+h,C[0](),!0}for(;i!==null;)if(t++,n=A[t],!(n==="\\"&&Q())){if(s=hE(n),l=qt[i],a=l[s]||l.l||8,a===8||(i=a[0],a[1]!==void 0&&(I=C[a[1]],I&&(g=n,I()===!1))))return;if(i===7)return e}}const hs=new Map;function pE(A,e){return UA(A)?A[e]:null}function mE(A,e){if(!UA(A))return null;let t=hs.get(e);if(t||(t=dE(e),t&&hs.set(e,t)),!t)return null;const i=t.length;let o=A,n=0;for(;nA,wE=A=>"",DE="text",kE=A=>A.length===0?"":bc(A),vE=Rc;function fs(A,e){return A=Math.abs(A),e===2?A?A>1?1:0:1:A?Math.min(A,2):0}function FE(A){const e=Ae(A.pluralIndex)?A.pluralIndex:-1;return A.named&&(Ae(A.named.count)||Ae(A.named.n))?Ae(A.named.count)?A.named.count:Ae(A.named.n)?A.named.n:e:e}function SE(A,e){e.count||(e.count=A),e.n||(e.n=A)}function RE(A={}){const e=A.locale,t=FE(A),i=UA(A.pluralRules)&&gA(e)&&PA(A.pluralRules[e])?A.pluralRules[e]:fs,o=UA(A.pluralRules)&&gA(e)&&PA(A.pluralRules[e])?fs:void 0,n=E=>E[i(t,E.length,o)],r=A.list||[],g=E=>r[E],s=A.named||HA();Ae(A.pluralIndex)&&SE(t,s);const a=E=>s[E];function I(E){const D=PA(A.messages)?A.messages(E):UA(A.messages)?A.messages[E]:!1;return D||(A.parent?A.parent.message(E):wE)}const l=E=>A.modifiers?A.modifiers[E]:yE,C=vA(A.processor)&&PA(A.processor.normalize)?A.processor.normalize:kE,Q=vA(A.processor)&&PA(A.processor.interpolate)?A.processor.interpolate:vE,h=vA(A.processor)&&gA(A.processor.type)?A.processor.type:DE,u={list:g,named:a,plural:n,linked:(E,...D)=>{const[c,d]=D;let p="text",v="";D.length===1?UA(c)?(v=c.modifier||v,p=c.type||p):gA(c)&&(v=c||v):D.length===2&&(gA(c)&&(v=c||v),gA(d)&&(p=d||p));const N=I(E)(u),G=p==="vnode"&&WA(N)&&v?N[0]:N;return v?l(v)(G,p):G},message:I,type:h,interpolate:Q,normalize:C,values:Be(HA(),r,s)};return u}let no=null;function bE(A){no=A}function NE(A,e,t){no&&no.emit("i18n:init",{timestamp:Date.now(),i18n:A,version:e,meta:t})}const GE=LE("function:translate");function LE(A){return e=>no&&no.emit(A,e)}const UE=sg.__EXTEND_POINT__,zt=Fn(UE),ME={FALLBACK_TO_TRANSLATE:zt(),CANNOT_FORMAT_NUMBER:zt(),FALLBACK_TO_NUMBER_FORMAT:zt(),CANNOT_FORMAT_DATE:zt(),FALLBACK_TO_DATE_FORMAT:zt(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:zt(),__EXTEND_POINT__:zt()},mC=pA.__EXTEND_POINT__,$t=Fn(mC),Ye={INVALID_ARGUMENT:mC,INVALID_DATE_ARGUMENT:$t(),INVALID_ISO_DATE_ARGUMENT:$t(),NOT_SUPPORT_NON_STRING_MESSAGE:$t(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:$t(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:$t(),NOT_SUPPORT_LOCALE_TYPE:$t(),__EXTEND_POINT__:$t()};function it(A){return Gi(A,null,void 0)}function Cg(A,e){return e.locale!=null?ds(e.locale):ds(A.locale)}let Vn;function ds(A){if(gA(A))return A;if(PA(A)){if(A.resolvedOnce&&Vn!=null)return Vn;if(A.constructor.name==="Function"){const e=A();if(Sc(e))throw it(Ye.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Vn=e}else throw it(Ye.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw it(Ye.NOT_SUPPORT_LOCALE_TYPE)}function xE(A,e,t){return[...new Set([t,...WA(e)?e:UA(e)?Object.keys(e):gA(e)?[e]:[t]])]}function yC(A,e,t){const i=gA(t)?t:Si,o=A;o.__localeChainCache||(o.__localeChainCache=new Map);let n=o.__localeChainCache.get(i);if(!n){n=[];let r=[t];for(;WA(r);)r=ps(n,r,e);const g=WA(e)||!vA(e)?e:e.default?e.default:null;r=gA(g)?[g]:g,WA(r)&&ps(n,r,!1),o.__localeChainCache.set(i,n)}return n}function ps(A,e,t){let i=!0;for(let o=0;o`${A.charAt(0).toLocaleUpperCase()}${A.substr(1)}`;function YE(){return{upper:(A,e)=>e==="text"&&gA(A)?A.toUpperCase():e==="vnode"&&UA(A)&&"__v_isVNode"in A?A.children.toUpperCase():A,lower:(A,e)=>e==="text"&&gA(A)?A.toLowerCase():e==="vnode"&&UA(A)&&"__v_isVNode"in A?A.children.toLowerCase():A,capitalize:(A,e)=>e==="text"&&gA(A)?ys(A):e==="vnode"&&UA(A)&&"__v_isVNode"in A?ys(A.children):A}}let wC;function ws(A){wC=A}let DC;function _E(A){DC=A}let kC;function KE(A){kC=A}let vC=null;const OE=A=>{vC=A},PE=()=>vC;let FC=null;const Ds=A=>{FC=A},VE=()=>FC;let ks=0;function WE(A={}){const e=PA(A.onWarn)?A.onWarn:mc,t=gA(A.version)?A.version:HE,i=gA(A.locale)||PA(A.locale)?A.locale:Si,o=PA(i)?Si:i,n=WA(A.fallbackLocale)||vA(A.fallbackLocale)||gA(A.fallbackLocale)||A.fallbackLocale===!1?A.fallbackLocale:o,r=vA(A.messages)?A.messages:Wn(o),g=vA(A.datetimeFormats)?A.datetimeFormats:Wn(o),s=vA(A.numberFormats)?A.numberFormats:Wn(o),a=Be(HA(),A.modifiers,YE()),I=A.pluralRules||HA(),l=PA(A.missing)?A.missing:null,C=RA(A.missingWarn)||Ot(A.missingWarn)?A.missingWarn:!0,Q=RA(A.fallbackWarn)||Ot(A.fallbackWarn)?A.fallbackWarn:!0,h=!!A.fallbackFormat,f=!!A.unresolving,u=PA(A.postTranslation)?A.postTranslation:null,E=vA(A.processor)?A.processor:null,D=RA(A.warnHtmlMessage)?A.warnHtmlMessage:!0,c=!!A.escapeParameter,d=PA(A.messageCompiler)?A.messageCompiler:wC,p=PA(A.messageResolver)?A.messageResolver:DC||pE,v=PA(A.localeFallbacker)?A.localeFallbacker:kC||xE,N=UA(A.fallbackContext)?A.fallbackContext:void 0,G=A,H=UA(G.__datetimeFormatters)?G.__datetimeFormatters:new Map,S=UA(G.__numberFormatters)?G.__numberFormatters:new Map,b=UA(G.__meta)?G.__meta:{};ks++;const L={version:t,cid:ks,locale:i,fallbackLocale:n,messages:r,modifiers:a,pluralRules:I,missing:l,missingWarn:C,fallbackWarn:Q,fallbackFormat:h,unresolving:f,postTranslation:u,processor:E,warnHtmlMessage:D,escapeParameter:c,messageCompiler:d,messageResolver:p,localeFallbacker:v,fallbackContext:N,onWarn:e,__meta:b};return L.datetimeFormats=g,L.numberFormats=s,L.__datetimeFormatters=H,L.__numberFormatters=S,__INTLIFY_PROD_DEVTOOLS__&&NE(L,t,b),L}const Wn=A=>({[A]:HA()});function lg(A,e,t,i,o){const{missing:n,onWarn:r}=A;if(n!==null){const g=n(A,t,e,o);return gA(g)?g:e}else return e}function Ji(A,e,t){const i=A;i.__localeChainCache=new Map,A.localeFallbacker(A,t,e)}function qE(A,e){return A===e?!1:A.split("-")[0]===e.split("-")[0]}function jE(A,e){const t=e.indexOf(A);if(t===-1)return!1;for(let i=t+1;iZE(t,A)}function ZE(A,e){const t=aE(e);if(t==null)throw oo(0);if(Ig(t)===1){const n=IE(t);return A.plural(n.reduce((r,g)=>[...r,vs(A,g)],[]))}else return vs(A,t)}function vs(A,e){const t=CE(e);if(t!=null)return A.type==="text"?t:A.normalize([t]);{const i=lE(e).reduce((o,n)=>[...o,pr(A,n)],[]);return A.normalize(i)}}function pr(A,e){const t=Ig(e);switch(t){case 3:return bo(e,t);case 9:return bo(e,t);case 4:{const i=e;if(He(i,"k")&&i.k)return A.interpolate(A.named(i.k));if(He(i,"key")&&i.key)return A.interpolate(A.named(i.key));throw oo(t)}case 5:{const i=e;if(He(i,"i")&&Ae(i.i))return A.interpolate(A.list(i.i));if(He(i,"index")&&Ae(i.index))return A.interpolate(A.list(i.index));throw oo(t)}case 6:{const i=e,o=BE(i),n=QE(i);return A.linked(pr(A,n),o?pr(A,o):void 0,A.type)}case 7:return bo(e,t);case 8:return bo(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const SC=A=>A;let ui=HA();function RC(A,e={}){let t=!1;const i=e.onError||Jc;return e.onError=o=>{t=!0,i(o)},{...gE(A,e),detectError:t}}const XE=(A,e)=>{if(!gA(A))throw it(Ye.NOT_SUPPORT_NON_STRING_MESSAGE);{RA(e.warnHtmlMessage)&&e.warnHtmlMessage;const i=(e.onCacheKey||SC)(A),o=ui[i];if(o)return o;const{code:n,detectError:r}=RC(A,e),g=new Function(`return ${n}`)();return r?g:ui[i]=g}};function zE(A,e){if(__INTLIFY_JIT_COMPILATION__&&!__INTLIFY_DROP_MESSAGE_COMPILER__&&gA(A)){RA(e.warnHtmlMessage)&&e.warnHtmlMessage;const i=(e.onCacheKey||SC)(A),o=ui[i];if(o)return o;const{ast:n,detectError:r}=RC(A,{...e,location:!1,jit:!0}),g=qn(n);return r?g:ui[i]=g}else{const t=A.cacheKey;if(t){const i=ui[t];return i||(ui[t]=qn(A))}else return qn(A)}}const Fs=()=>"",Me=A=>PA(A);function Ss(A,...e){const{fallbackFormat:t,postTranslation:i,unresolving:o,messageCompiler:n,fallbackLocale:r,messages:g}=A,[s,a]=mr(...e),I=RA(a.missingWarn)?a.missingWarn:A.missingWarn,l=RA(a.fallbackWarn)?a.fallbackWarn:A.fallbackWarn,C=RA(a.escapeParameter)?a.escapeParameter:A.escapeParameter,Q=!!a.resolvedMessage,h=gA(a.default)||RA(a.default)?RA(a.default)?n?s:()=>s:a.default:t?n?s:()=>s:"",f=t||h!=="",u=Cg(A,a);C&&$E(a);let[E,D,c]=Q?[s,u,g[u]||HA()]:bC(A,s,u,r,l,I),d=E,p=s;if(!Q&&!(gA(d)||st(d)||Me(d))&&f&&(d=h,p=d),!Q&&(!(gA(d)||st(d)||Me(d))||!gA(D)))return o?Sn:s;let v=!1;const N=()=>{v=!0},G=Me(d)?d:NC(A,s,D,d,p,N);if(v)return d;const H=tu(A,D,c,a),S=RE(H),b=Au(A,G,S);let L=i?i(b,s):b;if(C&&gA(L)&&(L=vc(L)),__INTLIFY_PROD_DEVTOOLS__){const QA={timestamp:Date.now(),key:gA(s)?s:Me(d)?d.key:"",locale:D||(Me(d)?d.locale:""),format:gA(d)?d:Me(d)?d.source:"",message:L};QA.meta=Be({},A.__meta,PE()||{}),GE(QA)}return L}function $E(A){WA(A.list)?A.list=A.list.map(e=>gA(e)?ls(e):e):UA(A.named)&&Object.keys(A.named).forEach(e=>{gA(A.named[e])&&(A.named[e]=ls(A.named[e]))})}function bC(A,e,t,i,o,n){const{messages:r,onWarn:g,messageResolver:s,localeFallbacker:a}=A,I=a(A,i,t);let l=HA(),C,Q=null;const h="translate";for(let f=0;fi;return a.locale=t,a.key=e,a}const s=r(i,eu(A,t,o,i,g,n));return s.locale=t,s.key=e,s.source=i,s}function Au(A,e,t){return e(t)}function mr(...A){const[e,t,i]=A,o=HA();if(!gA(e)&&!Ae(e)&&!Me(e)&&!st(e))throw it(Ye.INVALID_ARGUMENT);const n=Ae(e)?String(e):(Me(e),e);return Ae(t)?o.plural=t:gA(t)?o.default=t:vA(t)&&!vn(t)?o.named=t:WA(t)&&(o.list=t),Ae(i)?o.plural=i:gA(i)?o.default=i:vA(i)&&Be(o,i),[n,o]}function eu(A,e,t,i,o,n){return{locale:e,key:t,warnHtmlMessage:o,onError:r=>{throw n&&n(r),r},onCacheKey:r=>yc(e,t,r)}}function tu(A,e,t,i){const{modifiers:o,pluralRules:n,messageResolver:r,fallbackLocale:g,fallbackWarn:s,missingWarn:a,fallbackContext:I}=A,C={locale:e,modifiers:o,pluralRules:n,messages:Q=>{let h=r(t,Q);if(h==null&&I){const[,,f]=bC(I,Q,e,g,s,a);h=r(f,Q)}if(gA(h)||st(h)){let f=!1;const E=NC(A,Q,e,h,Q,()=>{f=!0});return f?Fs:E}else return Me(h)?h:Fs}};return A.processor&&(C.processor=A.processor),i.list&&(C.list=i.list),i.named&&(C.named=i.named),Ae(i.plural)&&(C.pluralIndex=i.plural),C}function Rs(A,...e){const{datetimeFormats:t,unresolving:i,fallbackLocale:o,onWarn:n,localeFallbacker:r}=A,{__datetimeFormatters:g}=A,[s,a,I,l]=yr(...e),C=RA(I.missingWarn)?I.missingWarn:A.missingWarn;RA(I.fallbackWarn)?I.fallbackWarn:A.fallbackWarn;const Q=!!I.part,h=Cg(A,I),f=r(A,o,h);if(!gA(s)||s==="")return new Intl.DateTimeFormat(h,l).format(a);let u={},E,D=null;const c="datetime format";for(let v=0;v{GC.includes(s)?r[s]=t[s]:n[s]=t[s]}),gA(i)?n.locale=i:vA(i)&&(r=i),vA(o)&&(r=o),[n.key||"",g,n,r]}function bs(A,e,t){const i=A;for(const o in t){const n=`${e}__${o}`;i.__datetimeFormatters.has(n)&&i.__datetimeFormatters.delete(n)}}function Ns(A,...e){const{numberFormats:t,unresolving:i,fallbackLocale:o,onWarn:n,localeFallbacker:r}=A,{__numberFormatters:g}=A,[s,a,I,l]=wr(...e),C=RA(I.missingWarn)?I.missingWarn:A.missingWarn;RA(I.fallbackWarn)?I.fallbackWarn:A.fallbackWarn;const Q=!!I.part,h=Cg(A,I),f=r(A,o,h);if(!gA(s)||s==="")return new Intl.NumberFormat(h,l).format(a);let u={},E,D=null;const c="number format";for(let v=0;v{LC.includes(s)?r[s]=t[s]:n[s]=t[s]}),gA(i)?n.locale=i:vA(i)&&(r=i),vA(o)&&(r=o),[n.key||"",g,n,r]}function Gs(A,e,t){const i=A;for(const o in t){const n=`${e}__${o}`;i.__numberFormatters.has(n)&&i.__numberFormatters.delete(n)}}sE();/*! + * vue-i18n v9.14.5 + * (c) 2025 kazuya kawaguchi + * Released under the MIT License. + */const iu="9.14.5";function ou(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(ft().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(ft().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(ft().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(ft().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(ft().__INTLIFY_PROD_DEVTOOLS__=!1)}const nu=ME.__EXTEND_POINT__,Qt=Fn(nu);Qt(),Qt(),Qt(),Qt(),Qt(),Qt(),Qt(),Qt(),Qt();const UC=Ye.__EXTEND_POINT__,we=Fn(UC),re={UNEXPECTED_RETURN_TYPE:UC,INVALID_ARGUMENT:we(),MUST_BE_CALL_SETUP_TOP:we(),NOT_INSTALLED:we(),NOT_AVAILABLE_IN_LEGACY_MODE:we(),REQUIRED_VALUE:we(),INVALID_VALUE:we(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:we(),NOT_INSTALLED_WITH_PROVIDE:we(),UNEXPECTED_ERROR:we(),NOT_COMPATIBLE_LEGACY_VUE_I18N:we(),BRIDGE_SUPPORT_VUE_2_ONLY:we(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:we(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:we(),__EXTEND_POINT__:we()};function Ie(A,...e){return Gi(A,null,void 0)}const Dr=Vt("__translateVNode"),kr=Vt("__datetimeParts"),vr=Vt("__numberParts"),MC=Vt("__setPluralRules"),xC=Vt("__injectWithOption"),Fr=Vt("__dispose");function ro(A){if(!UA(A)||st(A))return A;for(const e in A)if(He(A,e))if(!e.includes("."))UA(A[e])&&ro(A[e]);else{const t=e.split("."),i=t.length-1;let o=A,n=!1;for(let r=0;r{if("locale"in g&&"resource"in g){const{locale:s,resource:a}=g;s?(r[s]=r[s]||HA(),Oo(a,r[s])):Oo(a,r)}else gA(g)&&Oo(JSON.parse(g),r)}),o==null&&n)for(const g in r)He(r,g)&&ro(r[g]);return r}function JC(A){return A.type}function TC(A,e,t){let i=UA(e.messages)?e.messages:HA();"__i18nGlobal"in t&&(i=Rn(A.locale.value,{messages:i,__i18n:t.__i18nGlobal}));const o=Object.keys(i);o.length&&o.forEach(n=>{A.mergeLocaleMessage(n,i[n])});{if(UA(e.datetimeFormats)){const n=Object.keys(e.datetimeFormats);n.length&&n.forEach(r=>{A.mergeDateTimeFormat(r,e.datetimeFormats[r])})}if(UA(e.numberFormats)){const n=Object.keys(e.numberFormats);n.length&&n.forEach(r=>{A.mergeNumberFormat(r,e.numberFormats[r])})}}}function Ls(A){return TA(fo,null,A,0)}const Us="__INTLIFY_META__",Ms=()=>[],ru=()=>!1;let xs=0;function Js(A){return(e,t,i,o)=>A(t,i,vi()||void 0,o)}const gu=()=>{const A=vi();let e=null;return A&&(e=JC(A)[Us])?{[Us]:e}:null};function Bg(A={},e){const{__root:t,__injectWithOption:i}=A,o=t===void 0,n=A.flatJson,r=nn?EA:tg,g=!!A.translateExistCompatible;let s=RA(A.inheritLocale)?A.inheritLocale:!0;const a=r(t&&s?t.locale.value:gA(A.locale)?A.locale:Si),I=r(t&&s?t.fallbackLocale.value:gA(A.fallbackLocale)||WA(A.fallbackLocale)||vA(A.fallbackLocale)||A.fallbackLocale===!1?A.fallbackLocale:a.value),l=r(Rn(a.value,A)),C=r(vA(A.datetimeFormats)?A.datetimeFormats:{[a.value]:{}}),Q=r(vA(A.numberFormats)?A.numberFormats:{[a.value]:{}});let h=t?t.missingWarn:RA(A.missingWarn)||Ot(A.missingWarn)?A.missingWarn:!0,f=t?t.fallbackWarn:RA(A.fallbackWarn)||Ot(A.fallbackWarn)?A.fallbackWarn:!0,u=t?t.fallbackRoot:RA(A.fallbackRoot)?A.fallbackRoot:!0,E=!!A.fallbackFormat,D=PA(A.missing)?A.missing:null,c=PA(A.missing)?Js(A.missing):null,d=PA(A.postTranslation)?A.postTranslation:null,p=t?t.warnHtmlMessage:RA(A.warnHtmlMessage)?A.warnHtmlMessage:!0,v=!!A.escapeParameter;const N=t?t.modifiers:vA(A.modifiers)?A.modifiers:{};let G=A.pluralRules||t&&t.pluralRules,H;H=(()=>{o&&Ds(null);const U={version:iu,locale:a.value,fallbackLocale:I.value,messages:l.value,modifiers:N,pluralRules:G,missing:c===null?void 0:c,missingWarn:h,fallbackWarn:f,fallbackFormat:E,unresolving:!0,postTranslation:d===null?void 0:d,warnHtmlMessage:p,escapeParameter:v,messageResolver:A.messageResolver,messageCompiler:A.messageCompiler,__meta:{framework:"vue"}};U.datetimeFormats=C.value,U.numberFormats=Q.value,U.__datetimeFormatters=vA(H)?H.__datetimeFormatters:void 0,U.__numberFormatters=vA(H)?H.__numberFormatters:void 0;const P=WE(U);return o&&Ds(P),P})(),Ji(H,a.value,I.value);function b(){return[a.value,I.value,l.value,C.value,Q.value]}const L=hA({get:()=>a.value,set:U=>{a.value=U,H.locale=a.value}}),QA=hA({get:()=>I.value,set:U=>{I.value=U,H.fallbackLocale=I.value,Ji(H,a.value,U)}}),dA=hA(()=>l.value),IA=hA(()=>C.value),oA=hA(()=>Q.value);function X(){return PA(d)?d:null}function tA(U){d=U,H.postTranslation=U}function fA(){return D}function _(U){U!==null&&(c=Js(U)),D=U,H.missing=c}const W=(U,P,uA,bA,jA,he)=>{b();let Ce;try{__INTLIFY_PROD_DEVTOOLS__,o||(H.fallbackContext=t?VE():void 0),Ce=U(H)}finally{__INTLIFY_PROD_DEVTOOLS__,o||(H.fallbackContext=void 0)}if(uA!=="translate exists"&&Ae(Ce)&&Ce===Sn||uA==="translate exists"&&!Ce){const[jt,Mn]=P();return t&&u?bA(t):jA(jt)}else{if(he(Ce))return Ce;throw Ie(re.UNEXPECTED_RETURN_TYPE)}};function z(...U){return W(P=>Reflect.apply(Ss,null,[P,...U]),()=>mr(...U),"translate",P=>Reflect.apply(P.t,P,[...U]),P=>P,P=>gA(P))}function DA(...U){const[P,uA,bA]=U;if(bA&&!UA(bA))throw Ie(re.INVALID_ARGUMENT);return z(P,uA,Be({resolvedMessage:!0},bA||{}))}function NA(...U){return W(P=>Reflect.apply(Rs,null,[P,...U]),()=>yr(...U),"datetime format",P=>Reflect.apply(P.d,P,[...U]),()=>ms,P=>gA(P))}function oe(...U){return W(P=>Reflect.apply(Ns,null,[P,...U]),()=>wr(...U),"number format",P=>Reflect.apply(P.n,P,[...U]),()=>ms,P=>gA(P))}function LA(U){return U.map(P=>gA(P)||Ae(P)||RA(P)?Ls(String(P)):P)}const $={normalize:LA,interpolate:U=>U,type:"vnode"};function AA(...U){return W(P=>{let uA;const bA=P;try{bA.processor=$,uA=Reflect.apply(Ss,null,[bA,...U])}finally{bA.processor=null}return uA},()=>mr(...U),"translate",P=>P[Dr](...U),P=>[Ls(P)],P=>WA(P))}function cA(...U){return W(P=>Reflect.apply(Ns,null,[P,...U]),()=>wr(...U),"number format",P=>P[vr](...U),Ms,P=>gA(P)||WA(P))}function SA(...U){return W(P=>Reflect.apply(Rs,null,[P,...U]),()=>yr(...U),"datetime format",P=>P[kr](...U),Ms,P=>gA(P)||WA(P))}function w(U){G=U,H.pluralRules=G}function R(U,P){return W(()=>{if(!U)return!1;const uA=gA(P)?P:a.value,bA=q(uA),jA=H.messageResolver(bA,U);return g?jA!=null:st(jA)||Me(jA)||gA(jA)},()=>[U],"translate exists",uA=>Reflect.apply(uA.te,uA,[U,P]),ru,uA=>RA(uA))}function k(U){let P=null;const uA=yC(H,I.value,a.value);for(let bA=0;bA{s&&(a.value=U,H.locale=U,Ji(H,a.value,I.value))}),ae(t.fallbackLocale,U=>{s&&(I.value=U,H.fallbackLocale=U,Ji(H,a.value,I.value))}));const Z={id:xs,locale:L,fallbackLocale:QA,get inheritLocale(){return s},set inheritLocale(U){s=U,U&&t&&(a.value=t.locale.value,I.value=t.fallbackLocale.value,Ji(H,a.value,I.value))},get availableLocales(){return Object.keys(l.value).sort()},messages:dA,get modifiers(){return N},get pluralRules(){return G||{}},get isGlobal(){return o},get missingWarn(){return h},set missingWarn(U){h=U,H.missingWarn=h},get fallbackWarn(){return f},set fallbackWarn(U){f=U,H.fallbackWarn=f},get fallbackRoot(){return u},set fallbackRoot(U){u=U},get fallbackFormat(){return E},set fallbackFormat(U){E=U,H.fallbackFormat=E},get warnHtmlMessage(){return p},set warnHtmlMessage(U){p=U,H.warnHtmlMessage=U},get escapeParameter(){return v},set escapeParameter(U){v=U,H.escapeParameter=U},t:z,getLocaleMessage:q,setLocaleMessage:V,mergeLocaleMessage:iA,getPostTranslationHandler:X,setPostTranslationHandler:tA,getMissingHandler:fA,setMissingHandler:_,[MC]:w};return Z.datetimeFormats=IA,Z.numberFormats=oA,Z.rt=DA,Z.te=R,Z.tm=x,Z.d=NA,Z.n=oe,Z.getDateTimeFormat=eA,Z.setDateTimeFormat=m,Z.mergeDateTimeFormat=y,Z.getNumberFormat=M,Z.setNumberFormat=O,Z.mergeNumberFormat=nA,Z[xC]=i,Z[Dr]=AA,Z[kr]=SA,Z[vr]=cA,Z}function su(A){const e=gA(A.locale)?A.locale:Si,t=gA(A.fallbackLocale)||WA(A.fallbackLocale)||vA(A.fallbackLocale)||A.fallbackLocale===!1?A.fallbackLocale:e,i=PA(A.missing)?A.missing:void 0,o=RA(A.silentTranslationWarn)||Ot(A.silentTranslationWarn)?!A.silentTranslationWarn:!0,n=RA(A.silentFallbackWarn)||Ot(A.silentFallbackWarn)?!A.silentFallbackWarn:!0,r=RA(A.fallbackRoot)?A.fallbackRoot:!0,g=!!A.formatFallbackMessages,s=vA(A.modifiers)?A.modifiers:{},a=A.pluralizationRules,I=PA(A.postTranslation)?A.postTranslation:void 0,l=gA(A.warnHtmlInMessage)?A.warnHtmlInMessage!=="off":!0,C=!!A.escapeParameterHtml,Q=RA(A.sync)?A.sync:!0;let h=A.messages;if(vA(A.sharedMessages)){const v=A.sharedMessages;h=Object.keys(v).reduce((G,H)=>{const S=G[H]||(G[H]={});return Be(S,v[H]),G},h||{})}const{__i18n:f,__root:u,__injectWithOption:E}=A,D=A.datetimeFormats,c=A.numberFormats,d=A.flatJson,p=A.translateExistCompatible;return{locale:e,fallbackLocale:t,messages:h,flatJson:d,datetimeFormats:D,numberFormats:c,missing:i,missingWarn:o,fallbackWarn:n,fallbackRoot:r,fallbackFormat:g,modifiers:s,pluralRules:a,postTranslation:I,warnHtmlMessage:l,escapeParameter:C,messageResolver:A.messageResolver,inheritLocale:Q,translateExistCompatible:p,__i18n:f,__root:u,__injectWithOption:E}}function Sr(A={},e){{const t=Bg(su(A)),{__extender:i}=A,o={id:t.id,get locale(){return t.locale.value},set locale(n){t.locale.value=n},get fallbackLocale(){return t.fallbackLocale.value},set fallbackLocale(n){t.fallbackLocale.value=n},get messages(){return t.messages.value},get datetimeFormats(){return t.datetimeFormats.value},get numberFormats(){return t.numberFormats.value},get availableLocales(){return t.availableLocales},get formatter(){return{interpolate(){return[]}}},set formatter(n){},get missing(){return t.getMissingHandler()},set missing(n){t.setMissingHandler(n)},get silentTranslationWarn(){return RA(t.missingWarn)?!t.missingWarn:t.missingWarn},set silentTranslationWarn(n){t.missingWarn=RA(n)?!n:n},get silentFallbackWarn(){return RA(t.fallbackWarn)?!t.fallbackWarn:t.fallbackWarn},set silentFallbackWarn(n){t.fallbackWarn=RA(n)?!n:n},get modifiers(){return t.modifiers},get formatFallbackMessages(){return t.fallbackFormat},set formatFallbackMessages(n){t.fallbackFormat=n},get postTranslation(){return t.getPostTranslationHandler()},set postTranslation(n){t.setPostTranslationHandler(n)},get sync(){return t.inheritLocale},set sync(n){t.inheritLocale=n},get warnHtmlInMessage(){return t.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(n){t.warnHtmlMessage=n!=="off"},get escapeParameterHtml(){return t.escapeParameter},set escapeParameterHtml(n){t.escapeParameter=n},get preserveDirectiveContent(){return!0},set preserveDirectiveContent(n){},get pluralizationRules(){return t.pluralRules||{}},__composer:t,t(...n){const[r,g,s]=n,a={};let I=null,l=null;if(!gA(r))throw Ie(re.INVALID_ARGUMENT);const C=r;return gA(g)?a.locale=g:WA(g)?I=g:vA(g)&&(l=g),WA(s)?I=s:vA(s)&&(l=s),Reflect.apply(t.t,t,[C,I||l||{},a])},rt(...n){return Reflect.apply(t.rt,t,[...n])},tc(...n){const[r,g,s]=n,a={plural:1};let I=null,l=null;if(!gA(r))throw Ie(re.INVALID_ARGUMENT);const C=r;return gA(g)?a.locale=g:Ae(g)?a.plural=g:WA(g)?I=g:vA(g)&&(l=g),gA(s)?a.locale=s:WA(s)?I=s:vA(s)&&(l=s),Reflect.apply(t.t,t,[C,I||l||{},a])},te(n,r){return t.te(n,r)},tm(n){return t.tm(n)},getLocaleMessage(n){return t.getLocaleMessage(n)},setLocaleMessage(n,r){t.setLocaleMessage(n,r)},mergeLocaleMessage(n,r){t.mergeLocaleMessage(n,r)},d(...n){return Reflect.apply(t.d,t,[...n])},getDateTimeFormat(n){return t.getDateTimeFormat(n)},setDateTimeFormat(n,r){t.setDateTimeFormat(n,r)},mergeDateTimeFormat(n,r){t.mergeDateTimeFormat(n,r)},n(...n){return Reflect.apply(t.n,t,[...n])},getNumberFormat(n){return t.getNumberFormat(n)},setNumberFormat(n,r){t.setNumberFormat(n,r)},mergeNumberFormat(n,r){t.mergeNumberFormat(n,r)},getChoiceIndex(n,r){return-1}};return o.__extender=i,o}}const Qg={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:A=>A==="parent"||A==="global",default:"parent"},i18n:{type:Object}};function au({slots:A},e){return e.length===1&&e[0]==="default"?(A.default?A.default():[]).reduce((i,o)=>[...i,...o.type===qA?o.children:[o]],[]):e.reduce((t,i)=>{const o=A[i];return o&&(t[i]=o()),t},HA())}function HC(A){return qA}const Iu=ho({name:"i18n-t",props:Be({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:A=>Ae(A)||!isNaN(A)}},Qg),setup(A,e){const{slots:t,attrs:i}=e,o=A.i18n||ve({useScope:A.scope,__useComponent:!0});return()=>{const n=Object.keys(t).filter(l=>l!=="_"),r=HA();A.locale&&(r.locale=A.locale),A.plural!==void 0&&(r.plural=gA(A.plural)?+A.plural:A.plural);const g=au(e,n),s=o[Dr](A.keypath,g,r),a=Be(HA(),i),I=gA(A.tag)||UA(A.tag)?A.tag:HC();return GA(I,a,s)}}}),Ts=Iu;function Cu(A){return WA(A)&&!gA(A[0])}function YC(A,e,t,i){const{slots:o,attrs:n}=e;return()=>{const r={part:!0};let g=HA();A.locale&&(r.locale=A.locale),gA(A.format)?r.key=A.format:UA(A.format)&&(gA(A.format.key)&&(r.key=A.format.key),g=Object.keys(A.format).reduce((C,Q)=>t.includes(Q)?Be(HA(),C,{[Q]:A.format[Q]}):C,HA()));const s=i(A.value,r,g);let a=[r.key];WA(s)?a=s.map((C,Q)=>{const h=o[C.type],f=h?h({[C.type]:C.value,index:Q,parts:s}):[C.value];return Cu(f)&&(f[0].key=`${C.type}-${Q}`),f}):gA(s)&&(a=[s]);const I=Be(HA(),n),l=gA(A.tag)||UA(A.tag)?A.tag:HC();return GA(l,I,a)}}const lu=ho({name:"i18n-n",props:Be({value:{type:Number,required:!0},format:{type:[String,Object]}},Qg),setup(A,e){const t=A.i18n||ve({useScope:A.scope,__useComponent:!0});return YC(A,e,LC,(...i)=>t[vr](...i))}}),Hs=lu,Bu=ho({name:"i18n-d",props:Be({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},Qg),setup(A,e){const t=A.i18n||ve({useScope:A.scope,__useComponent:!0});return YC(A,e,GC,(...i)=>t[kr](...i))}}),Ys=Bu;function Qu(A,e){const t=A;if(A.mode==="composition")return t.__getInstance(e)||A.global;{const i=t.__getInstance(e);return i!=null?i.__composer:A.global.__composer}}function cu(A){const e=r=>{const{instance:g,modifiers:s,value:a}=r;if(!g||!g.$)throw Ie(re.UNEXPECTED_ERROR);const I=Qu(A,g.$),l=_s(a);return[Reflect.apply(I.t,I,[...Ks(l)]),I]};return{created:(r,g)=>{const[s,a]=e(g);nn&&A.global===a&&(r.__i18nWatcher=ae(a.locale,()=>{g.instance&&g.instance.$forceUpdate()})),r.__composer=a,r.textContent=s},unmounted:r=>{nn&&r.__i18nWatcher&&(r.__i18nWatcher(),r.__i18nWatcher=void 0,delete r.__i18nWatcher),r.__composer&&(r.__composer=void 0,delete r.__composer)},beforeUpdate:(r,{value:g})=>{if(r.__composer){const s=r.__composer,a=_s(g);r.textContent=Reflect.apply(s.t,s,[...Ks(a)])}},getSSRProps:r=>{const[g]=e(r);return{textContent:g}}}}function _s(A){if(gA(A))return{path:A};if(vA(A)){if(!("path"in A))throw Ie(re.REQUIRED_VALUE,"path");return A}else throw Ie(re.INVALID_VALUE)}function Ks(A){const{path:e,locale:t,args:i,choice:o,plural:n}=A,r={},g=i||{};return gA(t)&&(r.locale=t),Ae(o)&&(r.plural=o),Ae(n)&&(r.plural=n),[e,g,r]}function Eu(A,e,...t){const i=vA(t[0])?t[0]:{},o=!!i.useI18nComponentName;(RA(i.globalInstall)?i.globalInstall:!0)&&([o?"i18n":Ts.name,"I18nT"].forEach(r=>A.component(r,Ts)),[Hs.name,"I18nN"].forEach(r=>A.component(r,Hs)),[Ys.name,"I18nD"].forEach(r=>A.component(r,Ys))),A.directive("t",cu(e))}function uu(A,e,t){return{beforeCreate(){const i=vi();if(!i)throw Ie(re.UNEXPECTED_ERROR);const o=this.$options;if(o.i18n){const n=o.i18n;if(o.__i18n&&(n.__i18n=o.__i18n),n.__root=e,this===this.$root)this.$i18n=Os(A,n);else{n.__injectWithOption=!0,n.__extender=t.__vueI18nExtend,this.$i18n=Sr(n);const r=this.$i18n;r.__extender&&(r.__disposer=r.__extender(this.$i18n))}}else if(o.__i18n)if(this===this.$root)this.$i18n=Os(A,o);else{this.$i18n=Sr({__i18n:o.__i18n,__injectWithOption:!0,__extender:t.__vueI18nExtend,__root:e});const n=this.$i18n;n.__extender&&(n.__disposer=n.__extender(this.$i18n))}else this.$i18n=A;o.__i18nGlobal&&TC(e,o,o),this.$t=(...n)=>this.$i18n.t(...n),this.$rt=(...n)=>this.$i18n.rt(...n),this.$tc=(...n)=>this.$i18n.tc(...n),this.$te=(n,r)=>this.$i18n.te(n,r),this.$d=(...n)=>this.$i18n.d(...n),this.$n=(...n)=>this.$i18n.n(...n),this.$tm=n=>this.$i18n.tm(n),t.__setInstance(i,this.$i18n)},mounted(){},unmounted(){const i=vi();if(!i)throw Ie(re.UNEXPECTED_ERROR);const o=this.$i18n;delete this.$t,delete this.$rt,delete this.$tc,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,o.__disposer&&(o.__disposer(),delete o.__disposer,delete o.__extender),t.__deleteInstance(i),delete this.$i18n}}}function Os(A,e){A.locale=e.locale||A.locale,A.fallbackLocale=e.fallbackLocale||A.fallbackLocale,A.missing=e.missing||A.missing,A.silentTranslationWarn=e.silentTranslationWarn||A.silentFallbackWarn,A.silentFallbackWarn=e.silentFallbackWarn||A.silentFallbackWarn,A.formatFallbackMessages=e.formatFallbackMessages||A.formatFallbackMessages,A.postTranslation=e.postTranslation||A.postTranslation,A.warnHtmlInMessage=e.warnHtmlInMessage||A.warnHtmlInMessage,A.escapeParameterHtml=e.escapeParameterHtml||A.escapeParameterHtml,A.sync=e.sync||A.sync,A.__composer[MC](e.pluralizationRules||A.pluralizationRules);const t=Rn(A.locale,{messages:e.messages,__i18n:e.__i18n});return Object.keys(t).forEach(i=>A.mergeLocaleMessage(i,t[i])),e.datetimeFormats&&Object.keys(e.datetimeFormats).forEach(i=>A.mergeDateTimeFormat(i,e.datetimeFormats[i])),e.numberFormats&&Object.keys(e.numberFormats).forEach(i=>A.mergeNumberFormat(i,e.numberFormats[i])),A}const hu=Vt("global-vue-i18n");function fu(A={},e){const t=__VUE_I18N_LEGACY_API__&&RA(A.legacy)?A.legacy:__VUE_I18N_LEGACY_API__,i=RA(A.globalInjection)?A.globalInjection:!0,o=__VUE_I18N_LEGACY_API__&&t?!!A.allowComposition:!0,n=new Map,[r,g]=du(A,t),s=Vt("");function a(C){return n.get(C)||null}function I(C,Q){n.set(C,Q)}function l(C){n.delete(C)}{const C={get mode(){return __VUE_I18N_LEGACY_API__&&t?"legacy":"composition"},get allowComposition(){return o},async install(Q,...h){if(Q.__VUE_I18N_SYMBOL__=s,Q.provide(Q.__VUE_I18N_SYMBOL__,C),vA(h[0])){const E=h[0];C.__composerExtend=E.__composerExtend,C.__vueI18nExtend=E.__vueI18nExtend}let f=null;!t&&i&&(f=Su(Q,C.global)),__VUE_I18N_FULL_INSTALL__&&Eu(Q,C,...h),__VUE_I18N_LEGACY_API__&&t&&Q.mixin(uu(g,g.__composer,C));const u=Q.unmount;Q.unmount=()=>{f&&f(),C.dispose(),u()}},get global(){return g},dispose(){r.stop()},__instances:n,__getInstance:a,__setInstance:I,__deleteInstance:l};return C}}function ve(A={}){const e=vi();if(e==null)throw Ie(re.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Ie(re.NOT_INSTALLED);const t=pu(e),i=yu(t),o=JC(e),n=mu(A,o);if(__VUE_I18N_LEGACY_API__&&t.mode==="legacy"&&!A.__useComponent){if(!t.allowComposition)throw Ie(re.NOT_AVAILABLE_IN_LEGACY_MODE);return vu(e,n,i,A)}if(n==="global")return TC(i,A,o),i;if(n==="parent"){let s=wu(t,e,A.__useComponent);return s==null&&(s=i),s}const r=t;let g=r.__getInstance(e);if(g==null){const s=Be({},A);"__i18n"in o&&(s.__i18n=o.__i18n),i&&(s.__root=i),g=Bg(s),r.__composerExtend&&(g[Fr]=r.__composerExtend(g)),ku(r,e,g),r.__setInstance(e,g)}return g}function du(A,e,t){const i=cB();{const o=__VUE_I18N_LEGACY_API__&&e?i.run(()=>Sr(A)):i.run(()=>Bg(A));if(o==null)throw Ie(re.UNEXPECTED_ERROR);return[i,o]}}function pu(A){{const e=rt(A.isCE?hu:A.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Ie(A.isCE?re.NOT_INSTALLED_WITH_PROVIDE:re.UNEXPECTED_ERROR);return e}}function mu(A,e){return vn(A)?"__i18n"in e?"local":"global":A.useScope?A.useScope:"local"}function yu(A){return A.mode==="composition"?A.global:A.global.__composer}function wu(A,e,t=!1){let i=null;const o=e.root;let n=Du(e,t);for(;n!=null;){const r=A;if(A.mode==="composition")i=r.__getInstance(n);else if(__VUE_I18N_LEGACY_API__){const g=r.__getInstance(n);g!=null&&(i=g.__composer,t&&i&&!i[xC]&&(i=null))}if(i!=null||o===n)break;n=n.parent}return i}function Du(A,e=!1){return A==null?null:e&&A.vnode.ctx||A.parent}function ku(A,e,t){Ft(()=>{},e),Ci(()=>{const i=t;A.__deleteInstance(e);const o=i[Fr];o&&(o(),delete i[Fr])},e)}function vu(A,e,t,i={}){const o=e==="local",n=tg(null);if(o&&A.proxy&&!(A.proxy.$options.i18n||A.proxy.$options.__i18n))throw Ie(re.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION);const r=RA(i.inheritLocale)?i.inheritLocale:!gA(i.locale),g=EA(!o||r?t.locale.value:gA(i.locale)?i.locale:Si),s=EA(!o||r?t.fallbackLocale.value:gA(i.fallbackLocale)||WA(i.fallbackLocale)||vA(i.fallbackLocale)||i.fallbackLocale===!1?i.fallbackLocale:g.value),a=EA(Rn(g.value,i)),I=EA(vA(i.datetimeFormats)?i.datetimeFormats:{[g.value]:{}}),l=EA(vA(i.numberFormats)?i.numberFormats:{[g.value]:{}}),C=o?t.missingWarn:RA(i.missingWarn)||Ot(i.missingWarn)?i.missingWarn:!0,Q=o?t.fallbackWarn:RA(i.fallbackWarn)||Ot(i.fallbackWarn)?i.fallbackWarn:!0,h=o?t.fallbackRoot:RA(i.fallbackRoot)?i.fallbackRoot:!0,f=!!i.fallbackFormat,u=PA(i.missing)?i.missing:null,E=PA(i.postTranslation)?i.postTranslation:null,D=o?t.warnHtmlMessage:RA(i.warnHtmlMessage)?i.warnHtmlMessage:!0,c=!!i.escapeParameter,d=o?t.modifiers:vA(i.modifiers)?i.modifiers:{},p=i.pluralRules||o&&t.pluralRules;function v(){return[g.value,s.value,a.value,I.value,l.value]}const N=hA({get:()=>n.value?n.value.locale.value:g.value,set:k=>{n.value&&(n.value.locale.value=k),g.value=k}}),G=hA({get:()=>n.value?n.value.fallbackLocale.value:s.value,set:k=>{n.value&&(n.value.fallbackLocale.value=k),s.value=k}}),H=hA(()=>n.value?n.value.messages.value:a.value),S=hA(()=>I.value),b=hA(()=>l.value);function L(){return n.value?n.value.getPostTranslationHandler():E}function QA(k){n.value&&n.value.setPostTranslationHandler(k)}function dA(){return n.value?n.value.getMissingHandler():u}function IA(k){n.value&&n.value.setMissingHandler(k)}function oA(k){return v(),k()}function X(...k){return n.value?oA(()=>Reflect.apply(n.value.t,null,[...k])):oA(()=>"")}function tA(...k){return n.value?Reflect.apply(n.value.rt,null,[...k]):""}function fA(...k){return n.value?oA(()=>Reflect.apply(n.value.d,null,[...k])):oA(()=>"")}function _(...k){return n.value?oA(()=>Reflect.apply(n.value.n,null,[...k])):oA(()=>"")}function W(k){return n.value?n.value.tm(k):{}}function z(k,x){return n.value?n.value.te(k,x):!1}function DA(k){return n.value?n.value.getLocaleMessage(k):{}}function NA(k,x){n.value&&(n.value.setLocaleMessage(k,x),a.value[k]=x)}function oe(k,x){n.value&&n.value.mergeLocaleMessage(k,x)}function LA(k){return n.value?n.value.getDateTimeFormat(k):{}}function Y(k,x){n.value&&(n.value.setDateTimeFormat(k,x),I.value[k]=x)}function $(k,x){n.value&&n.value.mergeDateTimeFormat(k,x)}function AA(k){return n.value?n.value.getNumberFormat(k):{}}function cA(k,x){n.value&&(n.value.setNumberFormat(k,x),l.value[k]=x)}function SA(k,x){n.value&&n.value.mergeNumberFormat(k,x)}const w={get id(){return n.value?n.value.id:-1},locale:N,fallbackLocale:G,messages:H,datetimeFormats:S,numberFormats:b,get inheritLocale(){return n.value?n.value.inheritLocale:r},set inheritLocale(k){n.value&&(n.value.inheritLocale=k)},get availableLocales(){return n.value?n.value.availableLocales:Object.keys(a.value)},get modifiers(){return n.value?n.value.modifiers:d},get pluralRules(){return n.value?n.value.pluralRules:p},get isGlobal(){return n.value?n.value.isGlobal:!1},get missingWarn(){return n.value?n.value.missingWarn:C},set missingWarn(k){n.value&&(n.value.missingWarn=k)},get fallbackWarn(){return n.value?n.value.fallbackWarn:Q},set fallbackWarn(k){n.value&&(n.value.missingWarn=k)},get fallbackRoot(){return n.value?n.value.fallbackRoot:h},set fallbackRoot(k){n.value&&(n.value.fallbackRoot=k)},get fallbackFormat(){return n.value?n.value.fallbackFormat:f},set fallbackFormat(k){n.value&&(n.value.fallbackFormat=k)},get warnHtmlMessage(){return n.value?n.value.warnHtmlMessage:D},set warnHtmlMessage(k){n.value&&(n.value.warnHtmlMessage=k)},get escapeParameter(){return n.value?n.value.escapeParameter:c},set escapeParameter(k){n.value&&(n.value.escapeParameter=k)},t:X,getPostTranslationHandler:L,setPostTranslationHandler:QA,getMissingHandler:dA,setMissingHandler:IA,rt:tA,d:fA,n:_,tm:W,te:z,getLocaleMessage:DA,setLocaleMessage:NA,mergeLocaleMessage:oe,getDateTimeFormat:LA,setDateTimeFormat:Y,mergeDateTimeFormat:$,getNumberFormat:AA,setNumberFormat:cA,mergeNumberFormat:SA};function R(k){k.locale.value=g.value,k.fallbackLocale.value=s.value,Object.keys(a.value).forEach(x=>{k.mergeLocaleMessage(x,a.value[x])}),Object.keys(I.value).forEach(x=>{k.mergeDateTimeFormat(x,I.value[x])}),Object.keys(l.value).forEach(x=>{k.mergeNumberFormat(x,l.value[x])}),k.escapeParameter=c,k.fallbackFormat=f,k.fallbackRoot=h,k.fallbackWarn=Q,k.missingWarn=C,k.warnHtmlMessage=D}return JI(()=>{if(A.proxy==null||A.proxy.$i18n==null)throw Ie(re.NOT_AVAILABLE_COMPOSITION_IN_LEGACY);const k=n.value=A.proxy.$i18n.__composer;e==="global"?(g.value=k.locale.value,s.value=k.fallbackLocale.value,a.value=k.messages.value,I.value=k.datetimeFormats.value,l.value=k.numberFormats.value):o&&R(k)}),w}const Fu=["locale","fallbackLocale","availableLocales"],Ps=["t","rt","d","n","tm","te"];function Su(A,e){const t=Object.create(null);return Fu.forEach(o=>{const n=Object.getOwnPropertyDescriptor(e,o);if(!n)throw Ie(re.UNEXPECTED_ERROR);const r=le(n.value)?{get(){return n.value.value},set(g){n.value.value=g}}:{get(){return n.get&&n.get()}};Object.defineProperty(t,o,r)}),A.config.globalProperties.$i18n=t,Ps.forEach(o=>{const n=Object.getOwnPropertyDescriptor(e,o);if(!n||!n.value)throw Ie(re.UNEXPECTED_ERROR);Object.defineProperty(A.config.globalProperties,`$${o}`,n)}),()=>{delete A.config.globalProperties.$i18n,Ps.forEach(o=>{delete A.config.globalProperties[`$${o}`]})}}ou();__INTLIFY_JIT_COMPILATION__?ws(zE):ws(XE);_E(mE);KE(yC);if(__INTLIFY_PROD_DEVTOOLS__){const A=ft();A.__INTLIFY__=!0,bE(A.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}const Jt=EA({isOnline:!1,error:"",lastCheck:null}),ge=EA({chip:null,board:null,firmware:null,flash:null,assetsPartition:null,network:null,screen:null}),go=EA(""),so=EA(""),Rr=EA(!1),yi=EA(null),Ru=A=>new URLSearchParams(window.location.search).get(A),Po=async(A,e={})=>{const t=await fetch(`/xiaozhi/device/tools/call/${so.value}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${go.value}`},body:JSON.stringify({name:A,arguments:e})});if(t.ok)return await t.json();{const i=await t.text();console.error(`MCP tool ${A} failed:`,t.status,i);let o=`Failed to call ${A}`;try{const n=JSON.parse(i);n.message&&(o=n.message)}catch{o=`${o}: HTTP ${t.status}`}throw new Error(o)}},bu=async()=>{var A,e,t,i;try{const[o,n,r]=await Promise.allSettled([Po("self.get_system_info"),Po("self.get_device_status"),Po("self.screen.get_info")]);if(o.status==="fulfilled"&&o.value){const g=o.value.data||o.value;if(ge.value.chip={model:g.chip_model_name||"Unknown"},ge.value.board={model:((A=g.board)==null?void 0:A.name)||"Unknown"},ge.value.firmware={version:((e=g.application)==null?void 0:e.version)||"Unknown"},g.flash_size){const s=Math.round(g.flash_size/1024/1024);ge.value.flash={size:`${s}MB`}}else ge.value.flash={size:"Unknown"};if(g.partition_table){const s=g.partition_table.find(a=>a.label==="assets");s?ge.value.assetsPartition={size:s.size,sizeFormatted:`${Math.round(s.size/1024/1024)}MB`}:ge.value.assetsPartition=null}else ge.value.assetsPartition=null}else console.warn("系统信息获取失败:",o.reason||o.value),ge.value.chip={model:"Unknown"},ge.value.board={model:"Unknown"},ge.value.firmware={version:"Unknown"},ge.value.flash={size:"Unknown"},ge.value.assetsPartition=null;if(n.status==="fulfilled"&&n.value){const g=n.value.data||n.value;ge.value.network={type:((t=g.network)==null?void 0:t.type)||"unknown",signal:((i=g.network)==null?void 0:i.signal)||"Unknown"}}else console.warn("设备状态获取失败:",n.reason||n.value),ge.value.network={type:"unknown",signal:"Unknown"};if(r.status==="fulfilled"&&r.value){const g=r.value.data||r.value;ge.value.screen={resolution:`${g.width||0}x${g.height||0}`}}else console.warn("屏幕信息获取失败:",r.reason||r.value),ge.value.screen={resolution:"Unknown"}}catch(o){console.error("获取设备信息时发生错误:",o)}},bn=async(A=!0)=>{Rr.value=!0;try{const e=await fetch(`/xiaozhi/device/tools/list/${so.value}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${go.value}`}});if((await e.json()).code===0)Jt.value.isOnline=!0,Jt.value.error="",Jt.value.lastCheck=new Date,A&&await bu();else throw new Error(`HTTP ${e.status}: ${e.statusText}`)}catch{Jt.value.isOnline=!1,Jt.value.error="",Jt.value.lastCheck=new Date,yi.value&&clearTimeout(yi.value),yi.value=setTimeout(bn,3e4)}finally{Rr.value=!1}},Nu=(A,e)=>{if(!A)return e("device.signal.unknown");switch(A.toLowerCase()){case"strong":return e("device.signal.strong");case"medium":return e("device.signal.medium");case"weak":return e("device.signal.weak");case"none":return e("device.signal.none");default:return A}},Gu=()=>{const A=localStorage.getItem("token");so.value=Ru("deviceId"),A&&so.value&&(go.value=JSON.parse(A).token,bn())},Lu=()=>{yi.value&&(clearTimeout(yi.value),yi.value=null)},Uu=async()=>{await bn()};function Nn(){const A=hA(()=>!!go.value),e=hA(()=>Jt.value.isOnline);return{token:go,deviceId:so,deviceStatus:Jt,deviceInfo:ge,isChecking:Rr,hasToken:A,isDeviceOnline:e,initializeDeviceStatus:Gu,cleanupDeviceStatus:Lu,refreshDeviceStatus:Uu,checkDeviceStatus:bn,callMcpTool:Po,getSignalDisplayText:Nu}}const Vs={__name:"WifiIcon",props:{size:{type:String,default:"w-4 h-4"},color:{type:String,default:"text-blue-500"}},setup(A){const e=A,t=hA(()=>`${e.size} ${e.color}`);return(i,o)=>(T(),K("svg",{class:kA(t.value),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...o[0]||(o[0]=[B("path",{d:"M3 9c4.97-4.97 13.03-4.97 18 0","stroke-width":"2","stroke-linecap":"round"},null,-1),B("path",{d:"M6 12c3.31-3.31 8.69-3.31 12 0","stroke-width":"2","stroke-linecap":"round"},null,-1),B("path",{d:"M9 15c1.66-1.66 4.34-1.66 6 0","stroke-width":"2","stroke-linecap":"round"},null,-1),B("circle",{cx:"12",cy:"18",r:"1.5",fill:"currentColor"},null,-1)])],2))}},Ws={__name:"Signal4GIcon",props:{size:{type:String,default:"w-4 h-4"},color:{type:String,default:"text-green-500"}},setup(A){const e=A,t=hA(()=>`${e.size} ${e.color}`);return(i,o)=>(T(),K("svg",{class:kA(t.value),fill:"currentColor",viewBox:"0 0 24 24"},[...o[0]||(o[0]=[Dn('4G',5)])],2))}},qs={__name:"ChipIcon",props:{size:{type:String,default:"w-4 h-4"},color:{type:String,default:"text-gray-400"}},setup(A){const e=A,t=hA(()=>`${e.size} ${e.color}`);return(i,o)=>(T(),K("svg",{class:kA(t.value),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...o[0]||(o[0]=[Dn('',14)])],2))}},js={__name:"FlashIcon",props:{size:{type:String,default:"w-4 h-4"},color:{type:String,default:"text-gray-400"}},setup(A){const e=A,t=hA(()=>`${e.size} ${e.color}`);return(i,o)=>(T(),K("svg",{class:kA(t.value),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...o[0]||(o[0]=[Dn('',10)])],2))}},Zs={__name:"BoardIcon",props:{size:{type:String,default:"w-4 h-4"},color:{type:String,default:"text-gray-400"}},setup(A){const e=A,t=hA(()=>`${e.size} ${e.color}`);return(i,o)=>(T(),K("svg",{class:kA(t.value),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...o[0]||(o[0]=[Dn('',10)])],2))}},Xs={__name:"ScreenIcon",props:{size:{type:String,default:"w-4 h-4"},color:{type:String,default:"text-gray-400"}},setup(A){const e=A,t=hA(()=>`${e.size} ${e.color}`);return(i,o)=>(T(),K("svg",{class:kA(t.value),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...o[0]||(o[0]=[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},null,-1)])],2))}},Mu={class:"flex items-center space-x-2"},xu={class:"flex items-center space-x-1"},Ju={key:0,class:"flex items-center space-x-1"},Tu={class:"text-xs text-gray-500"},Hu={key:0,class:"flex items-center space-x-4 text-sm text-gray-600"},Yu={key:0,class:"flex items-center space-x-1"},_u={key:1,class:"flex items-center space-x-1"},Ku={key:2,class:"flex items-center space-x-1"},Ou={key:3,class:"flex items-center space-x-1"},Pu={key:1,class:"lg:hidden flex flex-col bg-white rounded-lg border border-gray-200 shadow-sm overflow-hidden"},Vu={class:"flex items-center justify-between px-4 py-3 bg-gray-50 border-b border-gray-200"},Wu={class:"flex items-center space-x-2"},qu={key:0,class:"flex items-center space-x-1"},ju={class:"text-xs font-medium text-gray-600"},Zu={key:0,class:"px-4 py-3"},Xu={class:"grid grid-cols-1 gap-2.5"},zu={class:"flex justify-between items-center py-1.5 border-b border-gray-100"},$u={key:0,class:"flex items-center space-x-2 flex-1"},Ah={class:"min-w-0 flex-1"},eh={class:"text-xs text-gray-500 leading-tight"},th={class:"text-sm text-gray-800 font-medium truncate"},ih={key:1,class:"flex items-center space-x-2 flex-1 ml-3"},oh={class:"min-w-0 flex-1"},nh={class:"text-xs text-gray-500 leading-tight"},rh={class:"text-sm text-gray-800 font-medium truncate"},gh={class:"flex justify-between items-center py-1.5"},sh={key:0,class:"flex items-center space-x-2 flex-1"},ah={class:"min-w-0 flex-1"},Ih={class:"text-xs text-gray-500 leading-tight"},Ch={class:"text-sm text-gray-800 font-medium"},lh={key:1,class:"flex items-center space-x-2 flex-1 ml-3"},Bh={class:"min-w-0 flex-1"},Qh={class:"text-xs text-gray-500 leading-tight"},ch={class:"text-sm text-gray-800 font-medium"},Eh={__name:"DeviceStatus",setup(A){const{t:e}=ve(),{deviceStatus:t,deviceInfo:i,hasToken:o,initializeDeviceStatus:n,cleanupDeviceStatus:r,getSignalDisplayText:g}=Nn(),s=hA(()=>o.value);return Ft(()=>{n()}),Ci(()=>{r()}),(a,I)=>(T(),K(qA,null,[s.value?(T(),K("div",{key:0,class:kA(["hidden lg:flex items-center space-x-4",BA(t).isOnline?"":"opacity-60"])},[B("div",Mu,[B("div",xu,[B("div",{class:kA(["w-2 h-2 rounded-full",BA(t).isOnline?"bg-green-500":"bg-gray-400"])},null,2),B("span",{class:kA(["text-sm font-medium",BA(t).isOnline?"text-gray-700":"text-gray-500"])},F(BA(t).isOnline?a.$t("device.online"):a.$t("device.offline")),3)]),BA(t).isOnline&&BA(i).network?(T(),K("div",Ju,[BA(i).network.type==="wifi"?(T(),ye(BA(Vs),{key:0,color:"text-blue-500"})):BA(i).network.type==="4g"?(T(),ye(BA(Ws),{key:1})):sA("",!0),B("span",Tu,F(BA(g)(BA(i).network.signal,BA(e))),1)])):sA("",!0)]),BA(t).isOnline?(T(),K("div",Hu,[BA(i).chip?(T(),K("div",Yu,[TA(BA(qs)),B("span",null,F(BA(i).chip.model),1)])):sA("",!0),BA(i).flash?(T(),K("div",_u,[TA(BA(js)),B("span",null,F(BA(i).flash.size),1)])):sA("",!0),BA(i).board?(T(),K("div",Ku,[TA(BA(Zs)),B("span",null,F(BA(i).board.model),1)])):sA("",!0),BA(i).screen?(T(),K("div",Ou,[TA(BA(Xs)),B("span",null,F(BA(i).screen.resolution),1)])):sA("",!0)])):sA("",!0)],2)):sA("",!0),s.value?(T(),K("div",Pu,[B("div",Vu,[B("div",Wu,[B("div",{class:kA(["w-2.5 h-2.5 rounded-full",BA(t).isOnline?"bg-green-500":"bg-red-400"])},null,2),B("span",{class:kA(["text-sm font-medium",BA(t).isOnline?"text-gray-800":"text-gray-600"])},F(BA(t).isOnline?a.$t("device.online"):a.$t("device.offline")),3)]),BA(t).isOnline&&BA(i).network?(T(),K("div",qu,[BA(i).network.type==="wifi"?(T(),ye(BA(Vs),{key:0,color:"text-blue-500"})):BA(i).network.type==="4g"?(T(),ye(BA(Ws),{key:1})):sA("",!0),B("span",ju,F(BA(g)(BA(i).network.signal,BA(e))),1)])):sA("",!0)]),BA(t).isOnline?(T(),K("div",Zu,[B("div",Xu,[B("div",zu,[BA(i).chip?(T(),K("div",$u,[TA(BA(qs),{class:"flex-shrink-0"}),B("div",Ah,[B("div",eh,F(a.$t("device.chip")),1),B("div",th,F(BA(i).chip.model),1)])])):sA("",!0),BA(i).board?(T(),K("div",ih,[TA(BA(Zs),{class:"flex-shrink-0"}),B("div",oh,[B("div",nh,F(a.$t("device.board")),1),B("div",rh,F(BA(i).board.model),1)])])):sA("",!0)]),B("div",gh,[BA(i).flash?(T(),K("div",sh,[TA(BA(js),{class:"flex-shrink-0"}),B("div",ah,[B("div",Ih,F(a.$t("device.flash")),1),B("div",Ch,F(BA(i).flash.size),1)])])):sA("",!0),BA(i).screen?(T(),K("div",lh,[TA(BA(Xs),{class:"flex-shrink-0"}),B("div",Bh,[B("div",Qh,F(a.$t("device.screen")),1),B("div",ch,F(BA(i).screen.resolution),1)])])):sA("",!0)])])])):sA("",!0)])):sA("",!0)],64))}},uh={title:"Xiaozhi AI Customization"},hh={cancel:"Cancel",confirm:"Confirm",close:"Close",start:"Start",download:"Download",generate:"Generate",reset:"Reset",yes:"Yes",no:"No",loading:"Loading...",error:"Error",success:"Success",warning:"Warning",info:"Information",next:"Next",previous:"Previous",finish:"Finish",retry:"Retry",ok:"OK",other:"Other"},fh={title:"Xiaozhi AI Customization"},dh={title:"Saved Configuration Detected",message:"Configuration has been automatically restored. You can continue from where you left off or start over.",restart:"Start Over"},ph={chip:"Chip Configuration",theme:"Theme Design",generate:"Preview & Generate"},mh={title:"Generate assets.bin",confirmConfig:"Please confirm your configuration",chipModel:"Chip Model:",resolution:"Resolution:",wakeword:"Wake Word:",font:"Font:",emoji:"Emoji Package:",fileList:"Included Files List",estimated:"Estimated",compressed:"Before compression",generating:"Generating assets.bin...",progress:"{progress}% Complete",completed:"Your assets.bin file is ready",filename:"Filename: assets.bin",fileSize:"File Size: {size}",generationTime:"Generation Time: {time}",downloadAssets:"Download assets.bin",flashToDevice:"Flash to Device Online",flashing:"Flashing to device...",flashingCancel:"Cancel Flash",flashingError:"Flashing Error",flashingInProgress:"Flashing in progress, please do not close the window",customFont:"Custom Font",customEmoji:"Custom Emoji Package",notConfigured:"Not Configured",wakewordNames:{wn9s_hilexin:"Hi, Espressif",wn9s_hiesp:"Hi, ESP",wn9s_nihaoxiaozhi:"Hello Xiaozhi",wn9_nihaoxiaozhi_tts:"Hello Xiaozhi",wn9_alexa:"Alexa"}},yh={init:"Initialize Generator",font:"Process Font Files",wakeword:"Package Wake Word Model",emoji:"Process Emoji Images",background:"Process Background Images",index:"Generate Index File",spiffs:"Build SPIFFS Mapping",package:"Complete Packaging"},wh={title:"Wake Word Configuration",description:"Select a preset wake word model or customize it using a command recognition model.",supportWakeNet9:"Your chip supports WakeNet9 models.",supportWakeNet9s:"Your chip supports WakeNet9s models.",notSupported:"Your chip does not support wake word functionality.",notice:"Note:",unsupportedMessage:"{chipModel} chip does not support wake word functionality. If you need to use wake words, please select ESP32-S3, ESP32-P4, or ESP32-C3/C5/C6 chips.",noWakeword:"No Wake Word",presetWakeword:"Preset Wake Word",customWakeword:"Custom Wake Word",selectWakeword:"Select Wake Word",placeholder:"Select wake word...",customSettings:"Custom Wake Word Settings",wakewordName:"Wake Word Name",wakewordNamePlaceholder:"e.g., Xiaozhi / Potato",wakewordCommand:"Wake Command",wakewordCommandPlaceholderCN:"Pinyin separated by spaces, e.g., ni hao xiao zhi",wakewordCommandPlaceholderEN:"English words, no punctuation, e.g., HELLO POTATO",threshold:"Sensitivity Threshold (0-100)",thresholdDesc:"Lower is more sensitive, default 20",duration:"Recognition Duration",durationDesc:"Maximum duration for command recognition",selectModel:"Select Recognition Model",mn6cn:"MultiNet6 (Chinese)",mn6en:"MultiNet6 (English)",mn7cn:"MultiNet7 (Chinese)",mn7en:"MultiNet7 (English)",errors:{nameRequired:"Please enter wake word name",commandRequired:"Please enter wake command",noPunctuation:"Command cannot contain punctuation",durationRange:"Duration must be between 500-10000ms"},tips:{tipLabel:"Tip:",optional:"Wake words are optional. If disabled, the device cannot be voice-activated.",wakeNet9sOnly:"C3/C5/C6 chips only support WakeNet9s lightweight models.",wakeNet9Full:"S3/P4 chips support complete WakeNet9 models with more choices.",customSupport:"Custom wake words use MultiNet models, currently only supported on ESP32-S3."}},Dh={resetFailed:"Reset failed, please refresh the page and try again",generationFailed:"Generation failed: {error}",noFileToDownload:"No downloadable file available",deviceOffline:"Device is offline and cannot be flashed",fileTooLarge:"Flash failed: File size {fileSize}MB exceeds assets partition size {partitionSize}MB. Please reduce configuration content or use a device with larger capacity.",flashCancelConfirm:"Are you sure you want to cancel flashing?",oldDataCleared:`Old version emoji data structure has been detected and cleared. + +The new version uses file deduplication technology to save storage space. + +Please re-upload custom emoji images.`,incompatibleEmojiData:"Incompatible emoji data detected, please reconfigure"},kh={authTokenMissing:"Authentication token not found",checkingDeviceStatus:"Checking device status...",deviceOfflineOrUnresponsive:"The device does not exist or is not online",unableToGetDeviceStatus:"Unable to get device status",initializingTransferService:"Initializing transfer service...",initializeTransferFailed:"Failed to initialize transfer service: {error}",uploadingFile:"Upload the file ...",uploadFailed:"Upload file failed",settingDeviceDownloadUrl:"Setting device download URL...",setDownloadUrlFailed:"Failed to set download URL: {error}",rebootingDevice:"Rebooting device...",waitingForDeviceReboot:"Waiting for device to reboot...",deviceRebootTimeout:"Device reboot timeout (60 seconds)",deviceReady:"Device ready, please wait for program burning",startingFileTransfer:"Starting file transfer...",flashCompleted:"During program burning, please pay attention to the firmware burning status!",onlineFlashFailed:"Online flashing failed: {error}"},vh={online:"Online",offline:"Offline",checking:"Checking...",flashing:"Flashing...",ready:"Ready",chip:"Chip",board:"Board",flash:"Flash",screen:"Screen",signal:{unknown:"Unknown",strong:"Strong",medium:"Medium",weak:"Weak",none:"No Signal"}},Fh={title:"Step 1: Chip Model and Screen Configuration",loadingFromDevice:"Loading hardware configuration from device...",loadedFromDevice:"Hardware configuration automatically loaded from device",manualConfig:"Please configure hardware parameters manually",loadingTitle:"Loading Device Configuration...",loadingDesc:"Reading chip model and screen resolution from device",autoLoadedTitle:"Device Configuration Auto-loaded",chipModel:"Chip Model",screenWidth:"Screen Width",screenHeight:"Screen Height",colorFormat:"Color Format:",manualEdit:"Manual Configuration",collapseManual:"Collapse Manual Configuration",manualConfigTitle:"Manual Hardware Configuration",next:"Next",selectChip:"Select Chip",chipRequired:"Chip Model",widthRequired:"Screen Width",heightRequired:"Screen Height",loadingError:"Loading configuration error",deviceOffline:"Device not connected or offline",chipModelError:"Unable to get chip model, please enter manually",resolutionError:"Unable to get screen resolution, please enter manually",timeoutError:"Configuration loading timeout, please enter manually",manualConfigDesc:"Unable to auto-read device configuration",manualConfigHint:"Device not connected or offline, please manually input hardware configuration",manualConfigRequired:"Please manually input hardware configuration",resolutionFormatError:"Screen resolution format error"},Sh={title:"Step 2: Theme Design",description:"Configure wake word, font, emoji and background to customize your Xiaozhi AI theme.",previous:"Previous",next:"Next",tabs:{wakeword:"Wake Word Config",font:"Font Config",emoji:"Emoji Collection",background:"Chat Background"}},Rh={title:"Step 3: Preview",description:"Preview the effect of your custom configuration on the actual device.",devicePreview:"Device Preview (1:1 Pixel Ratio)",previewSettings:"Preview Settings",previewText:"Preview Text",defaultPreviewText:"Hi, I'm your friend Xiaozhi!",currentEmotion:"Current Emotion",themeMode:"Theme Mode",lightMode:"Light",darkMode:"Dark",configSummary:"Configuration Summary",wakeword:"Wake Word:",font:"Font:",loading:"Loading...",emotion:"Emotion:",skin:"Skin:",previous:"Previous",generate:"Generate assets.bin",emotions:{neutral:"Neutral",happy:"Happy",laughing:"Laughing",funny:"Funny",sad:"Sad",angry:"Angry",crying:"Crying",loving:"Loving",embarrassed:"Embarrassed",surprised:"Surprised",shocked:"Shocked",thinking:"Thinking",winking:"Winking",cool:"Cool",relaxed:"Relaxed",delicious:"Delicious",kissy:"Kiss",confident:"Confident",sleepy:"Sleepy",silly:"Silly",confused:"Confused"},noEmotionConfigured:"No emotion configured",fontLoading:"Font loading...",configureEmojiFirst:"Please configure emoji package in theme design first",customFont:"Custom Font {size}px",customEmoji:"Custom Emoji {count} images",notConfigured:"Not configured",skinLight:"Light {type}",skinDark:"Dark {type}",hideSubtitle:"Hide Subtitle:",image:"Image",color:"Color"},bh={title:"Chat Background Configuration",description:"Configure chat backgrounds for light and dark modes, supporting solid colors or custom images.",lightMode:"Light Mode Background",darkMode:"Dark Mode Background",solidBackground:"Solid Background",imageBackground:"Image Background",backgroundColor:"Background Color:",textColor:"Text Color:",backgroundImage:"Background Image:",clickOrDragToUpload:"Click or drag to upload background image",removeImage:"Remove Image",backgroundPreview:"Background Preview",lightModePreview:"Light Mode",darkModePreview:"Dark Mode",chatArea:"Chat Content Area",quickConfig:"Quick Configuration",defaultColors:"Default Colors",stoneTexture:"Stone Texture",sunnyColors:"Sunny Colors",skyBlue:"Sky Blue",romanticPink:"Romantic Pink",selectValidImage:"Please select a valid image file"},Nh={title:"Emoji Collection Configuration",description:"Choose preset emoji package or custom emoji images. Each emoji package contains 21 different emotion expressions.",noEmojiPack:"No Emoji Pack",noEmojiPackDescription:"Don't configure emoji pack, only font and background resources will be included in the package.",presetEmojiPack:"Preset Emoji Pack",customEmojiPack:"Custom Emoji Pack",selectPresetEmojiPack:"Select Preset Emoji Pack",twemoji64:"Twemoji 64×64",twemoji32:"Twemoji 32×32",twemojiDescription:"High-quality emoji set from Twitter, perfect for clear display",twitterEmojiName:"Twemoji {size}x{size}",twitterEmojiDescription:"Twitter emoji pack, {size}×{size} pixels",size:"Size",preview:"Preview",select:"Select",customEmojiTitle:"Custom Emoji Pack",customEmojiDescription:"Upload your own emoji images. Each emotion needs one image.",uploadInstructions:"Click or drag to upload emoji images (PNG/JPG/WEBP)",supportedFormats:"Supported formats: PNG, JPG, WEBP. Recommended size: 64×64 pixels",emotionMapping:"Emotion Mapping",uploadAllEmotions:"Please upload emoji images for all emotions",maxImageWidth:"Max Image Width (px)",maxImageHeight:"Max Image Height (px)",clickToUpload:"Click to upload",orDragDrop:"or drag and drop",clickToUploadOrDrag:"Click to upload or drag here",remove:"Remove",replace:"Replace",selectValidEmojiImage:"Please select a valid emoji image file",selectValidFormat:"Please select a valid PNG or GIF format image",maxFileSize:"File size cannot exceed 1MB",invalidFormat:"Unsupported image format. Please use PNG, JPG, or WEBP.",required:"Required",uploadEmojiImages:"Upload Emoji Images (GIF requires PSRAM)",customEmojiPackConfig:"Custom Emoji Pack Configuration",neutralRequiredNotice:"* Must upload neutral default emotion, others are optional. If not uploaded, default emotion will be used instead.",sharedFileMessage:"Emotion {emotionKey} uses the same image file as {existingEmotions} (shared storage)",fileDeleted:"File {fileHash} has been deleted (no other emotion references)",fileRetained:"File {fileHash} is still used by other emotions, retained",imageLoadFailed:"Failed to load emoji image",emotions:{neutral:"Neutral",happy:"Happy",laughing:"Laughing",funny:"Funny",sad:"Sad",angry:"Angry",crying:"Crying",loving:"Loving",embarrassed:"Embarrassed",surprised:"Surprised",shocked:"Shocked",thinking:"Thinking",winking:"Winking",cool:"Cool",relaxed:"Relaxed",delicious:"Delicious",kissy:"Kiss",confident:"Confident",sleepy:"Sleepy",silly:"Silly",confused:"Confused"}},Gh={title:"Font Configuration",description:"Choose preset fonts or upload custom font files.",noFonts:"No Fonts",noFontsDescription:"Do not use font configuration, the device will use the default font",presetFonts:"Preset Fonts",customFonts:"Custom Fonts",selectPresetFont:"Select Preset Font",fontSize:"Font Size:",bitDepth:"Bit Depth:",charset:"Character Set:",fileSize:"File Size:",customFontConfig:"Custom Font Configuration",fontFile:"Font File",clickSelectFontFile:"Click to select font file",orDragFileHere:"or drag file here",supportedFormats:"Supports TTF, WOFF, WOFF2 formats",removeFile:"Remove File",fontSizePx:"Font Size (px)",range:"Range:",bitDepthBpp:"Bit Depth (BPP)",monochrome:"1 bpp (Monochrome)",fourColors:"2 bpp (4 colors)",sixteenColors:"4 bpp (16 colors)",characterSet:"Character Set",deepseekR1:"DeepSeek R1 (7405 characters)",gb2312:"GB2312 (7445 characters)",qwen18409:"Qwen (18409 characters)",latin1:"Latin1 (190 characters)",fullCharset:"Full Character Set (All characters in font file)",hideSubtitle:"Hide Subtitle",hideSubtitleDescription:"Do not show real-time text subtitles during conversation",selectValidFontFile:"Please select a valid font file (TTF, WOFF, WOFF2)",presetFontNames:{font_puhui_deepseek_14_1:"Alibaba PuHuiTi 14px",font_puhui_deepseek_16_4:"Alibaba PuHuiTi 16px",font_puhui_deepseek_20_4:"Alibaba PuHuiTi 20px",font_puhui_deepseek_30_4:"Alibaba PuHuiTi 30px",font_noto_qwen_14_1:"Noto Sans 14px",font_noto_qwen_16_4:"Noto Sans 16px",font_noto_qwen_20_4:"Noto Sans 20px",font_noto_qwen_30_4:"Noto Sans 30px"},charsetDeepseek:"DeepSeek 7405",charsetQwen:"Qwen 18409"},Lh={app:uh,common:hh,header:fh,configNotice:dh,steps:ph,generateModal:mh,progressSteps:yh,wakewordConfig:wh,errors:Dh,flashProgress:kh,device:vh,chipConfig:Fh,themeDesign:Sh,generateSummary:Rh,backgroundConfig:bh,emojiConfig:Nh,fontConfig:Gh},Uh={title:"小智 AI 自定义"},Mh={cancel:"取消",confirm:"确认",close:"关闭",start:"开始",download:"下载",generate:"生成",reset:"重置",yes:"是",no:"否",loading:"加载中...",error:"错误",success:"成功",warning:"警告",info:"信息",next:"下一步",previous:"上一步",finish:"完成",retry:"重试",ok:"确定",other:"其他"},xh={title:"小智 AI 自定义"},Jh={title:"检测到已保存的配置",message:"配置已自动恢复,您可以继续之前的进度或重新开始。",restart:"重新开始"},Th={chip:"芯片配置",theme:"主题设计",generate:"效果预览"},Hh={title:"生成 assets.bin",confirmConfig:"请确认您的配置",chipModel:"芯片型号:",resolution:"分辨率:",wakeword:"唤醒词:",font:"字体:",emoji:"表情包:",fileList:"包含的文件列表",estimated:"预估",compressed:"压缩前",generating:"正在生成 assets.bin...",progress:"{progress}% 完成",completed:"您的 assets.bin 文件已准备就绪",filename:"文件名: assets.bin",fileSize:"文件大小: {size}",generationTime:"生成时间: {time}",downloadAssets:"下载 assets.bin",flashToDevice:"在线烧录到设备",flashing:"正在烧录到设备...",flashingCancel:"取消烧录",flashingError:"烧录错误",flashingInProgress:"烧录中,请勿关闭窗口",customFont:"自定义字体",customEmoji:"自定义表情包",notConfigured:"未配置",wakewordNames:{wn9s_hilexin:"Hi,乐鑫",wn9s_hiesp:"Hi,ESP",wn9s_nihaoxiaozhi:"你好小智",wn9_nihaoxiaozhi_tts:"你好小智",wn9_alexa:"Alexa"}},Yh={init:"初始化生成器",font:"处理字体文件",wakeword:"打包唤醒词模型",emoji:"处理表情图片",background:"处理背景图片",index:"生成索引文件",spiffs:"构建SPIFFS映射",package:"完成打包"},_h={resetFailed:"重置失败,请刷新页面重试",generationFailed:"生成失败: {error}",noFileToDownload:"没有可下载的文件",deviceOffline:"设备离线,无法进行烧录",fileTooLarge:"烧录失败:文件大小 {fileSize}MB 超过 assets 分区大小 {partitionSize}MB,请减少配置内容或使用更大容量的设备。",flashCancelConfirm:"确定要取消烧录吗?",oldDataCleared:`检测到旧版本的表情数据结构已被清除。 + +新版本使用文件去重技术,可以节省存储空间。 + +请重新上传自定义表情图片。`,incompatibleEmojiData:"检测到不兼容的表情数据,请重新配置"},Kh={authTokenMissing:"未找到认证令牌",checkingDeviceStatus:"检查设备状态...",deviceOfflineOrUnresponsive:"设备不存在或不在线",unableToGetDeviceStatus:"无法获取设备状态",initializingTransferService:"初始化传输服务...",initializeTransferFailed:"初始化传输服务失败: {error}",uploadingFile:"上传文件中...",uploadFailed:"上传文件失败",settingDeviceDownloadUrl:"设置设备下载URL...",setDownloadUrlFailed:"设置下载URL失败: {error}",rebootingDevice:"重启设备...",waitingForDeviceReboot:"等待设备重启...",deviceRebootTimeout:"等待设备重启超时(60秒)",deviceReady:"设备就绪,请等待程序烧录",startingFileTransfer:"开始传输文件...",flashCompleted:"程序烧录中,请留意固件的烧录状态!",onlineFlashFailed:"在线烧录失败: {error}"},Oh={online:"在线",offline:"离线",checking:"检查中...",flashing:"烧录中...",ready:"就绪",chip:"芯片",board:"开发板",flash:"Flash",screen:"屏幕",signal:{unknown:"未知",strong:"强",medium:"中等",weak:"弱",none:"无信号"}},Ph={title:"步骤 1: 芯片型号和屏幕配置",loadingFromDevice:"正在从设备读取硬件配置...",loadedFromDevice:"已从设备自动读取硬件配置",manualConfig:"请手动配置硬件参数",loadingTitle:"正在加载设备配置...",loadingDesc:"从设备读取芯片型号和屏幕分辨率",autoLoadedTitle:"设备配置已自动加载",chipModel:"芯片型号",screenWidth:"屏幕宽度",screenHeight:"屏幕高度",colorFormat:"颜色格式:",manualEdit:"手动修改配置",collapseManual:"收起手动配置",manualConfigTitle:"手动配置硬件参数",next:"下一步",selectChip:"请选择芯片",chipRequired:"芯片型号",widthRequired:"屏幕宽度",heightRequired:"屏幕高度",loadingError:"加载配置时发生错误",deviceOffline:"设备未连接或离线",chipModelError:"无法获取芯片型号,请手动输入",resolutionError:"无法获取屏幕分辨率,请手动输入",timeoutError:"加载设备配置超时,请手动输入",manualConfigDesc:"无法自动读取设备配置",manualConfigHint:"设备未连接或离线,请手动输入硬件配置",manualConfigRequired:"请手动输入硬件配置",resolutionFormatError:"屏幕分辨率格式错误"},Vh={title:"步骤 2: 主题设计",description:"配置唤醒词、字体、表情和背景来自定义您的小智AI主题。",previous:"上一步",next:"下一步",tabs:{wakeword:"唤醒词配置",font:"字体配置",emoji:"表情集合",background:"聊天背景"}},Wh={title:"步骤 3: 效果预览",description:"预览您的自定义配置在实际设备上的效果。",devicePreview:"设备预览 (1:1 像素比例)",previewSettings:"预览设置",previewText:"预览文字",defaultPreviewText:"你好,我是你的朋友小智!",currentEmotion:"当前表情",themeMode:"主题模式",lightMode:"浅色",darkMode:"深色",configSummary:"配置摘要",wakeword:"唤醒词:",font:"字体:",loading:"加载中...",emotion:"表情:",skin:"皮肤:",previous:"上一步",generate:"生成 assets.bin",emotions:{neutral:"默认",happy:"开心",laughing:"大笑",funny:"搞笑",sad:"伤心",angry:"生气",crying:"哭泣",loving:"喜爱",embarrassed:"尴尬",surprised:"惊讶",shocked:"震惊",thinking:"思考",winking:"眨眼",cool:"酷炫",relaxed:"放松",delicious:"美味",kissy:"飞吻",confident:"自信",sleepy:"困倦",silly:"调皮",confused:"困惑"},noEmotionConfigured:"未配置表情",fontLoading:"字体加载中...",configureEmojiFirst:"请先在主题设计中配置表情包",customFont:"自定义字体 {size}px",customEmoji:"自定义表情 {count}张",notConfigured:"未配置",skinLight:"浅色{type}",skinDark:"深色{type}",hideSubtitle:"隐藏字幕:",image:"图片",color:"颜色"},qh={title:"聊天背景配置",description:"配置浅色模式和深色模式的聊天背景,支持纯色或自定义图片。",lightMode:"浅色模式背景",darkMode:"深色模式背景",solidBackground:"纯色背景",imageBackground:"图片背景",backgroundColor:"背景颜色:",textColor:"文字颜色:",backgroundImage:"背景图片:",clickOrDragToUpload:"点击或拖拽上传背景图片",removeImage:"移除图片",backgroundPreview:"背景预览",lightModePreview:"浅色模式",darkModePreview:"深色模式",chatArea:"聊天内容区域",quickConfig:"快捷配置",defaultColors:"默认配色",stoneTexture:"石墨质感",sunnyColors:"暖阳配色",skyBlue:"天空蓝调",romanticPink:"浪漫粉色",selectValidImage:"请选择有效的图片文件"},jh={title:"表情集合配置",description:"选择预设表情包或自定义表情图片。每个表情包包含21种不同情绪的表情。",noEmojiPack:"无表情包",noEmojiPackDescription:"不配置表情包,打包时只包含字体和背景资源。",presetEmojiPack:"预设表情包",customEmojiPack:"自定义表情包",selectPresetEmojiPack:"选择预设表情包",twemoji64:"Twemoji 64×64",twemoji32:"Twemoji 32×32",twemojiDescription:"来自Twitter的高质量表情符号集,适合清晰显示",twitterEmojiName:"Twemoji {size}x{size}",twitterEmojiDescription:"Twitter表情包,{size}×{size}像素",size:"尺寸",preview:"预览",select:"选择",customEmojiTitle:"自定义表情包",customEmojiDescription:"上传您自己的表情图片。每种情绪需要一张图片。",uploadInstructions:"点击或拖拽上传表情图片 (PNG/JPG/WEBP)",supportedFormats:"支持格式: PNG, JPG, WEBP。推荐尺寸: 64×64像素",emotionMapping:"情绪映射",uploadAllEmotions:"请为所有情绪上传表情图片",maxImageWidth:"最大图片宽度 (px)",maxImageHeight:"最大图片高度 (px)",clickToUpload:"点击上传",orDragDrop:"或拖拽上传",clickToUploadOrDrag:"点击上传或拖拽到此处",remove:"移除",replace:"替换",selectValidEmojiImage:"请选择有效的表情图片文件",selectValidFormat:"请选择有效的PNG或GIF格式图片",maxFileSize:"文件大小不能超过1MB",invalidFormat:"不支持的图片格式。请使用PNG、JPG或WEBP。",required:"必需",uploadEmojiImages:"上传表情图片(GIF 需要 PSRAM)",customEmojiPackConfig:"自定义表情包配置",neutralRequiredNotice:"* 必须上传 neutral 默认表情,其他表情可选。如果不上传其他表情,将使用默认表情代替。",sharedFileMessage:"表情 {emotionKey} 使用了与 {existingEmotions} 相同的图片文件(共享存储)",fileDeleted:"文件 {fileHash} 已删除(无其他表情引用)",fileRetained:"文件 {fileHash} 仍被其他表情使用,保留文件",imageLoadFailed:"表情图片加载失败",emotions:{neutral:"默认",happy:"开心",laughing:"大笑",funny:"搞笑",sad:"伤心",angry:"生气",crying:"哭泣",loving:"喜爱",embarrassed:"尴尬",surprised:"惊讶",shocked:"震惊",thinking:"思考",winking:"眨眼",cool:"酷炫",relaxed:"放松",delicious:"美味",kissy:"飞吻",confident:"自信",sleepy:"困倦",silly:"调皮",confused:"困惑"}},Zh={title:"字体配置",description:"选择预设字体或上传自定义字体文件。",noFonts:"无字体",noFontsDescription:"不使用字体配置,设备将使用默认字体",presetFonts:"预设字体",customFonts:"自定义字体",selectPresetFont:"选择预设字体",fontSize:"字号:",bitDepth:"位深:",charset:"字符集:",fileSize:"文件大小:",customFontConfig:"自定义字体配置",fontFile:"字体文件",clickSelectFontFile:"点击选择字体文件",orDragFileHere:"或拖拽文件到此处",supportedFormats:"支持 TTF, WOFF, WOFF2 格式",removeFile:"移除文件",fontSizePx:"字号 (px)",range:"范围:",bitDepthBpp:"位深 (BPP)",monochrome:"1 bpp (单色)",fourColors:"2 bpp (4色)",sixteenColors:"4 bpp (16色)",characterSet:"字符集",deepseekR1:"DeepSeek R1 (7405字符)",gb2312:"GB2312 (7445字符)",qwen18409:"Qwen (18409字符)",latin1:"Latin1 (190字符)",fullCharset:"完整字符集 (字体文件的所有字符)",hideSubtitle:"隐藏字幕",hideSubtitleDescription:"对话时不显示实时文字字幕",selectValidFontFile:"请选择有效的字体文件 (TTF, WOFF, WOFF2)",presetFontNames:{font_puhui_deepseek_14_1:"阿里巴巴普惠体 14px",font_puhui_deepseek_16_4:"阿里巴巴普惠体 16px",font_puhui_deepseek_20_4:"阿里巴巴普惠体 20px",font_puhui_deepseek_30_4:"阿里巴巴普惠体 30px",font_noto_qwen_14_1:"思源黑体 14px",font_noto_qwen_16_4:"思源黑体 16px",font_noto_qwen_20_4:"思源黑体 20px",font_noto_qwen_30_4:"思源黑体 30px"},charsetDeepseek:"DeepSeek 7405",charsetQwen:"Qwen 18409"},Xh={title:"唤醒词配置",description:"选择预设唤醒词模型或通过命令词模型自定义唤醒词。",supportWakeNet9:"您的芯片支持 WakeNet9 模型。",supportWakeNet9s:"您的芯片支持 WakeNet9s 模型。",notSupported:"您的芯片不支持唤醒词功能。",notice:"注意:",unsupportedMessage:"{chipModel} 芯片不支持唤醒词功能。如需使用唤醒词,请选择 ESP32-S3、ESP32-P4 或 ESP32-C3/C5/C6 芯片。",noWakeword:"关闭唤醒",presetWakeword:"预设唤醒词",customWakeword:"自定义唤醒词",selectWakeword:"选择唤醒词",placeholder:"选择唤醒词...",customSettings:"自定义唤醒词设置",wakewordName:"唤醒词名称",wakewordNamePlaceholder:"例如:小智 / Potato",wakewordCommand:"唤醒命令",wakewordCommandPlaceholderCN:"拼音空格隔开,例如:ni hao xiao zhi",wakewordCommandPlaceholderEN:"英文单词,不能包含标点,例如:HELLO POTATO",threshold:"灵敏度阈值 (0-100)",thresholdDesc:"越小越灵敏,默认 20",duration:"识别时长",durationDesc:"命令词最长持续时间",selectModel:"选择识别模型",mn6cn:"MultiNet6 (中文)",mn6en:"MultiNet6 (英文)",mn7cn:"MultiNet7 (中文)",mn7en:"MultiNet7 (英文)",errors:{nameRequired:"请输入唤醒词名称",commandRequired:"请输入唤醒命令",noPunctuation:"命令不能包含标点符号",durationRange:"时长需在 500-10000ms 之间"},tips:{tipLabel:"提示:",optional:"唤醒词是可选的,关闭后设备将无法通过语音唤醒。",wakeNet9sOnly:"C3/C5/C6 芯片仅支持 WakeNet9s 轻量级模型。",wakeNet9Full:"S3/P4 芯片支持完整的 WakeNet9 模型,选择更多。",customSupport:"自定义唤醒词使用 MultiNet 模型实现,目前仅支持 ESP32-S3 芯片。"}},zh={app:Uh,common:Mh,header:xh,configNotice:Jh,steps:Th,generateModal:Hh,progressSteps:Yh,errors:_h,flashProgress:Kh,device:Oh,chipConfig:Ph,themeDesign:Vh,generateSummary:Wh,backgroundConfig:qh,emojiConfig:jh,fontConfig:Zh,wakewordConfig:Xh},$h={title:"小智 AI 自訂"},Af={cancel:"取消",confirm:"確認",close:"關閉",start:"開始",download:"下載",generate:"生成",reset:"重置",yes:"是",no:"否",loading:"載入中...",error:"錯誤",success:"成功",warning:"警告",info:"資訊",next:"下一步",previous:"上一步",finish:"完成",retry:"重試",ok:"確定",other:"其他"},ef={title:"小智 AI 自訂"},tf={title:"檢測到已儲存的配置",message:"配置已自動恢復,您可以繼續之前的進度或重新開始。",restart:"重新開始"},of={chip:"晶片配置",theme:"主題設計",generate:"效果預覽"},nf={title:"生成 assets.bin",confirmConfig:"請確認您的配置",chipModel:"晶片型號:",resolution:"解析度:",wakeword:"喚醒詞:",font:"字體:",emoji:"表情包:",fileList:"包含的檔案列表",estimated:"預估",compressed:"壓縮前",generating:"正在生成 assets.bin...",progress:"{progress}% 完成",completed:"您的 assets.bin 檔案已準備就緒",filename:"檔案名: assets.bin",fileSize:"檔案大小: {size}",generationTime:"生成時間: {time}",downloadAssets:"下載 assets.bin",flashToDevice:"線上燒錄到設備",flashing:"正在燒錄到設備...",flashingCancel:"取消燒錄",flashingError:"燒錄錯誤",flashingInProgress:"燒錄中,請勿關閉視窗",customFont:"自訂字體",customEmoji:"自訂表情套件",notConfigured:"未設定",wakewordNames:{wn9s_hilexin:"Hi,樂鑫",wn9s_hiesp:"Hi,ESP",wn9s_nihaoxiaozhi:"你好小智",wn9_nihaoxiaozhi_tts:"你好小智",wn9_alexa:"Alexa"}},rf={init:"初始化生成器",font:"處理字體檔案",wakeword:"打包喚醒詞模型",emoji:"處理表情圖片",background:"處理背景圖片",index:"生成索引檔案",spiffs:"建構SPIFFS映射",package:"完成打包"},gf={title:"喚醒詞配置",description:"選擇預設喚醒詞模型或透過命令詞模型自訂喚醒詞。",supportWakeNet9:"您的晶片支援 WakeNet9 模型。",supportWakeNet9s:"您的晶片支援 WakeNet9s 模型。",notSupported:"您的晶片不支援喚醒詞功能。",notice:"注意:",unsupportedMessage:"{chipModel} 晶片不支援喚醒詞功能。如需使用喚醒詞,請選擇 ESP32-S3、ESP32-P4 或 ESP32-C3/C5/C6 晶片。",noWakeword:"關閉喚醒",presetWakeword:"預設喚醒詞",customWakeword:"自訂喚醒詞",selectWakeword:"選擇喚醒詞",placeholder:"選擇喚醒詞...",customSettings:"自訂喚醒詞設定",wakewordName:"喚醒詞名稱",wakewordNamePlaceholder:"例如:小智 / Potato",wakewordCommand:"喚醒命令",wakewordCommandPlaceholderCN:"拼音空格隔開,例如:ni hao xiao zhi",wakewordCommandPlaceholderEN:"英文單詞,不能包含標點,例如:HELLO POTATO",threshold:"靈敏度閾值 (0-100)",thresholdDesc:"越小越靈敏,預設 20",duration:"識別時長",durationDesc:"命令詞最長持續時間",selectModel:"選擇識別模型",mn6cn:"MultiNet6 (中文)",mn6en:"MultiNet6 (英文)",mn7cn:"MultiNet7 (中文)",mn7en:"MultiNet7 (英文)",errors:{nameRequired:"請輸入喚醒詞名稱",commandRequired:"請輸入喚醒命令",noPunctuation:"命令不能包含標點符號",durationRange:"時長需在 500-10000ms 之間"},tips:{tipLabel:"提示:",optional:"喚醒詞是可選的,關閉後裝置將無法透過語音喚醒。",wakeNet9sOnly:"C3/C5/C6 晶片僅支援 WakeNet9s 輕量級模型。",wakeNet9Full:"S3/P4 晶片支援完整的 WakeNet9 模型,選擇更多。",customSupport:"自訂喚醒詞使用 MultiNet 模型實現,目前僅支援 ESP32-S3 晶片。"}},sf={resetFailed:"重置失敗,請重新整理頁面重試",generationFailed:"生成失敗: {error}",noFileToDownload:"沒有可下載的檔案",deviceOffline:"設備離線,無法進行燒錄",fileTooLarge:"燒錄失敗:檔案大小 {fileSize}MB 超過 assets 分區大小 {partitionSize}MB,請減少配置內容或使用更大容量的設備。",flashCancelConfirm:"確定要取消燒錄嗎?",oldDataCleared:`檢測到舊版本的表情資料結構已被清除。 + +新版本使用檔案去重技術,可以節省儲存空間。 + +請重新上傳自訂表情圖片。`,incompatibleEmojiData:"檢測到不相容的表情資料,請重新配置"},af={authTokenMissing:"未找到認證令牌",checkingDeviceStatus:"檢查設備狀態...",deviceOfflineOrUnresponsive:"設備不存在或不線上",unableToGetDeviceStatus:"無法獲取設備狀態",initializingTransferService:"初始化傳輸服務...",initializeTransferFailed:"初始化傳輸服務失敗: {error}",uploadingFile:"上傳文件中...",uploadFailed:"上傳文件失敗",settingDeviceDownloadUrl:"設置設備下載URL...",setDownloadUrlFailed:"設置下載URL失敗: {error}",rebootingDevice:"重啟設備...",waitingForDeviceReboot:"等待設備重啟...",deviceRebootTimeout:"等待設備重啟超時(60秒)",deviceReady:"设备就绪,请等待程序烧录",startingFileTransfer:"開始檔案傳輸...",flashCompleted:"程式燒錄中,請留意固件的燒錄狀態!",onlineFlashFailed:"線上燒錄失敗: {error}"},If={online:"線上",offline:"離線",checking:"檢查中...",flashing:"燒錄中...",ready:"就緒",chip:"晶片",board:"開發板",flash:"Flash",screen:"螢幕",signal:{unknown:"未知",strong:"強",medium:"中等",weak:"弱",none:"無訊號"}},Cf={title:"步驟 1: 晶片型號和螢幕配置",loadingFromDevice:"正在從設備讀取硬體配置...",loadedFromDevice:"已從設備自動讀取硬體配置",manualConfig:"請手動配置硬體參數",loadingTitle:"正在載入設備配置...",loadingDesc:"從設備讀取晶片型號和螢幕解析度",autoLoadedTitle:"設備配置已自動載入",chipModel:"晶片型號",screenWidth:"螢幕寬度",screenHeight:"螢幕高度",colorFormat:"顏色格式:",manualEdit:"手動修改配置",collapseManual:"收起手動配置",manualConfigTitle:"手動配置硬體參數",next:"下一步",selectChip:"請選擇晶片",chipRequired:"晶片型號",widthRequired:"螢幕寬度",heightRequired:"螢幕高度",loadingError:"載入配置時發生錯誤",deviceOffline:"設備未連接或離線",chipModelError:"無法獲取晶片型號,請手動輸入",resolutionError:"無法獲取螢幕解析度,請手動輸入",timeoutError:"載入設備配置超時,請手動輸入",manualConfigDesc:"無法自動讀取設備配置",manualConfigHint:"設備未連接或離線,請手動輸入硬體配置",manualConfigRequired:"請手動輸入硬體配置",resolutionFormatError:"螢幕解析度格式錯誤"},lf={title:"步驟 2: 主題設計",description:"配置喚醒詞、字體、表情和背景來自訂您的小智AI主題。",previous:"上一步",next:"下一步",tabs:{wakeword:"喚醒詞配置",font:"字體配置",emoji:"表情集合",background:"聊天背景"}},Bf={title:"步驟 3: 效果預覽",description:"預覽您的自訂配置在實際設備上的效果。",devicePreview:"設備預覽 (1:1 像素比例)",previewSettings:"預覽設定",previewText:"預覽文字",defaultPreviewText:"你好,我是你的朋友小智!",currentEmotion:"當前表情",themeMode:"主題模式",lightMode:"淺色",darkMode:"深色",configSummary:"配置摘要",wakeword:"喚醒詞:",font:"字體:",loading:"載入中...",emotion:"表情:",skin:"皮膚:",previous:"上一步",generate:"生成 assets.bin",emotions:{neutral:"預設",happy:"開心",laughing:"大笑",funny:"搞笑",sad:"傷心",angry:"生氣",crying:"哭泣",loving:"喜愛",embarrassed:"尷尬",surprised:"驚訝",shocked:"震驚",thinking:"思考",winking:"眨眼",cool:"酷炫",relaxed:"放鬆",delicious:"美味",kissy:"飛吻",confident:"自信",sleepy:"睏倦",silly:"調皮",confused:"困惑"},noEmotionConfigured:"未配置表情",fontLoading:"字體載入中...",configureEmojiFirst:"請先在主題設計中配置表情包",customFont:"自訂字體 {size}px",customEmoji:"自訂表情 {count}張",notConfigured:"未配置",skinLight:"淺色{type}",skinDark:"深色{type}",hideSubtitle:"隱藏字幕:",image:"圖片",color:"顏色"},Qf={title:"聊天背景配置",description:"配置淺色模式和深色模式的聊天背景,支援純色或自訂圖片。",lightMode:"淺色模式背景",darkMode:"深色模式背景",solidBackground:"純色背景",imageBackground:"圖片背景",backgroundColor:"背景顏色:",textColor:"文字顏色:",backgroundImage:"背景圖片:",clickOrDragToUpload:"點擊或拖拽上傳背景圖片",removeImage:"移除圖片",backgroundPreview:"背景預覽",lightModePreview:"淺色模式",darkModePreview:"深色模式",chatArea:"聊天內容區域",quickConfig:"快捷配置",defaultColors:"預設配色",stoneTexture:"石墨質感",sunnyColors:"暖陽配色",skyBlue:"天空藍調",romanticPink:"浪漫粉色",selectValidImage:"請選擇有效的圖片檔案"},cf={title:"表情集合配置",description:"選擇預設表情包或自定義表情圖片。每個表情包包含21種不同情緒的表情。",noEmojiPack:"無表情包",noEmojiPackDescription:"不配置表情包,打包時只包含字體和背景資源。",presetEmojiPack:"預設表情包",customEmojiPack:"自定義表情包",selectPresetEmojiPack:"選擇預設表情包",twemoji64:"Twemoji 64×64",twemoji32:"Twemoji 32×32",twemojiDescription:"來自Twitter的高品質表情符號集,適合清晰顯示",twitterEmojiName:"Twemoji {size}x{size}",twitterEmojiDescription:"Twitter表情包,{size}×{size}像素",size:"尺寸",preview:"預覽",select:"選擇",customEmojiTitle:"自定義表情包",customEmojiDescription:"上傳您自己的表情圖片。每種情緒需要一張圖片。",uploadInstructions:"點擊或拖拽上傳表情圖片 (PNG/JPG/WEBP)",supportedFormats:"支援格式: PNG, JPG, WEBP。推薦尺寸: 64×64像素",emotionMapping:"情緒映射",uploadAllEmotions:"請為所有情緒上傳表情圖片",maxImageWidth:"最大圖片寬度 (px)",maxImageHeight:"最大圖片高度 (px)",clickToUpload:"點擊上傳",orDragDrop:"或拖拽上傳",clickToUploadOrDrag:"點擊上傳或拖拽到此處",remove:"移除",replace:"替換",selectValidEmojiImage:"請選擇有效的表情圖片檔案",selectValidFormat:"請選擇有效的PNG或GIF格式圖片",maxFileSize:"檔案大小不能超過1MB",invalidFormat:"不支援的圖片格式。請使用PNG、JPG或WEBP。",required:"必需",uploadEmojiImages:"上傳表情圖片(GIF 需要 PSRAM)",customEmojiPackConfig:"自定義表情包配置",neutralRequiredNotice:"* 必須上傳 neutral 預設表情,其他表情可選。如果不上傳其他表情,將使用預設表情代替。",sharedFileMessage:"表情 {emotionKey} 使用了與 {existingEmotions} 相同的圖片檔案(共享儲存)",fileDeleted:"檔案 {fileHash} 已刪除(無其他表情引用)",fileRetained:"檔案 {fileHash} 仍被其他表情使用,保留檔案",imageLoadFailed:"表情圖片載入失敗",emotions:{neutral:"預設",happy:"開心",laughing:"大笑",funny:"搞笑",sad:"傷心",angry:"生氣",crying:"哭泣",loving:"喜愛",embarrassed:"尷尬",surprised:"驚訝",shocked:"震驚",thinking:"思考",winking:"眨眼",cool:"酷炫",relaxed:"放鬆",delicious:"美味",kissy:"飛吻",confident:"自信",sleepy:"睏倦",silly:"調皮",confused:"困惑"}},Ef={title:"字體配置",description:"選擇預設字體或上傳自訂字體檔案。",noFonts:"無字體",noFontsDescription:"不使用字體配置,裝置將使用預設字體",presetFonts:"預設字體",customFonts:"自訂字體",selectPresetFont:"選擇預設字體",fontSize:"字號:",bitDepth:"位元深度:",charset:"字元集:",fileSize:"檔案大小:",customFontConfig:"自訂字體配置",fontFile:"字體檔案",clickSelectFontFile:"點擊選擇字體檔案",orDragFileHere:"或拖拽檔案到此處",supportedFormats:"支援 TTF, WOFF, WOFF2 格式",removeFile:"移除檔案",fontSizePx:"字號 (px)",range:"範圍:",bitDepthBpp:"位元深度 (BPP)",monochrome:"1 bpp (單色)",fourColors:"2 bpp (4色)",sixteenColors:"4 bpp (16色)",characterSet:"字元集",deepseekR1:"DeepSeek R1 (7405字元)",gb2312:"GB2312 (7445字元)",qwen18409:"Qwen (18409字元)",latin1:"Latin1 (190字元)",fullCharset:"完整字元集 (字體檔案的所有字元)",hideSubtitle:"隱藏字幕",hideSubtitleDescription:"對話時不顯示即時文字字幕",selectValidFontFile:"請選擇有效的字體檔案 (TTF, WOFF, WOFF2)",presetFontNames:{font_puhui_deepseek_14_1:"阿里巴巴普惠體 14px",font_puhui_deepseek_16_4:"阿里巴巴普惠體 16px",font_puhui_deepseek_20_4:"阿里巴巴普惠體 20px",font_puhui_deepseek_30_4:"阿里巴巴普惠體 30px",font_noto_qwen_14_1:"思源黑體 14px",font_noto_qwen_16_4:"思源黑體 16px",font_noto_qwen_20_4:"思源黑體 20px",font_noto_qwen_30_4:"思源黑體 30px"},charsetDeepseek:"DeepSeek 7405",charsetQwen:"Qwen 18409"},uf={app:$h,common:Af,header:ef,configNotice:tf,steps:of,generateModal:nf,progressSteps:rf,wakewordConfig:gf,errors:sf,flashProgress:af,device:If,chipConfig:Cf,themeDesign:lf,generateSummary:Bf,backgroundConfig:Qf,emojiConfig:cf,fontConfig:Ef},hf={title:"小智 AI カスタマイズ"},ff={cancel:"キャンセル",confirm:"確認",close:"閉じる",start:"開始",download:"ダウンロード",generate:"生成",reset:"リセット",yes:"はい",no:"いいえ",loading:"読み込み中...",error:"エラー",success:"成功",warning:"警告",info:"情報",next:"次へ",previous:"前へ",finish:"完了",retry:"再試行",ok:"OK",other:"その他"},df={title:"小智 AI カスタマイズ"},pf={title:"保存された設定を検出",message:"設定が自動的に復元されました。中断したところから続行するか、最初からやり直すことができます。",restart:"最初からやり直す"},mf={chip:"チップ設定",theme:"テーマデザイン",generate:"プレビュー&生成"},yf={title:"assets.binを生成",confirmConfig:"設定を確認してください",chipModel:"チップモデル:",resolution:"解像度:",wakeword:"ウェイクワード:",font:"フォント:",emoji:"絵文字パック:",fileList:"含まれるファイル一覧",estimated:"推定",compressed:"圧縮前",generating:"assets.binを生成中...",progress:"{progress}% 完了",completed:"assets.binファイルの準備ができました",filename:"ファイル名: assets.bin",fileSize:"ファイルサイズ: {size}",generationTime:"生成時間: {time}",downloadAssets:"assets.binをダウンロード",flashToDevice:"デバイスにオンライン書き込み",flashing:"デバイスに書き込み中...",flashingCancel:"書き込みをキャンセル",flashingError:"書き込みエラー",flashingInProgress:"書き込み中、ウィンドウを閉じないでください",customFont:"カスタムフォント",customEmoji:"カスタム絵文字パック",notConfigured:"未設定",wakewordNames:{wn9s_hilexin:"Hi, Espressif",wn9s_hiesp:"Hi, ESP",wn9s_nihaoxiaozhi:"こんにちは小智",wn9_nihaoxiaozhi_tts:"こんにちは小智",wn9_alexa:"アレクサ"}},wf={init:"ジェネレーターを初期化",font:"フォントファイルを処理",wakeword:"ウェイクワードモデルをパッケージ化",emoji:"絵文字画像を処理",background:"背景画像を処理",index:"インデックスファイルを生成",spiffs:"SPIFFSマッピングを構築",package:"パッケージ化を完了"},Df={title:"ウェイクワード設定",description:"プリセットのウェイクワードを選択するか、コマンド認識モデルを使用してカスタマイズします。",supportWakeNet9:"チップはWakeNet9モデルをサポートしています。",supportWakeNet9s:"チップはWakeNet9sモデルをサポートしています。",notSupported:"チップはウェイクワード機能をサポートしていません。",notice:"注意:",unsupportedMessage:"{chipModel}チップはウェイクワード機能をサポートしていません。ウェイクワードを使用する必要がある場合は、ESP32-S3、ESP32-P4、またはESP32-C3/C5/C6チップを選択してください。",noWakeword:"起動を無効にする",presetWakeword:"プリセット",customWakeword:"カスタム",selectWakeword:"ウェイクワードを選択",placeholder:"選択してください...",customSettings:"カスタムウェイクワード設定",wakewordName:"ウェイクワード名",wakewordNamePlaceholder:"例:小智 / Potato",wakewordCommand:"ウェイクコマンド",wakewordCommandPlaceholderCN:"ピンインをスペースで区切る。例:ni hao xiao zhi",wakewordCommandPlaceholderEN:"英語の単語。句読点は含めない。例:HELLO POTATO",threshold:"感度しきい値 (0-100)",thresholdDesc:"値が小さいほど感度が高くなります。デフォルトは20",duration:"認識時間",durationDesc:"コマンド認識の最大継続時間",selectModel:"認識モデルを選択",mn6cn:"MultiNet6 (中国語)",mn6en:"MultiNet6 (英語)",mn7cn:"MultiNet7 (中国語)",mn7en:"MultiNet7 (英語)",errors:{nameRequired:"ウェイクワード名を入力してください",commandRequired:"ウェイクコマンドを入力してください",noPunctuation:"コマンドに句読点を含めることはできません",durationRange:"時間は500〜10000msの間で設定してください"},tips:{tipLabel:"ヒント:",optional:"ウェイクワードはオプションです。無効にすると、デバイスは音声で起動できなくなります。",wakeNet9sOnly:"C3/C5/C6チップはWakeNet9s軽量モデルしかサポートしていません。",wakeNet9Full:"S3/P4チップは完全なWakeNet9モデルをサポートし、より多くの選択肢があります。",customSupport:"カスタムウェイクワードはMultiNetモデルを使用しており、現在はESP32-S3チップのみをサポートしています。"}},kf={resetFailed:"リセットに失敗しました、ページを更新して再試行してください",generationFailed:"生成に失敗しました: {error}",noFileToDownload:"ダウンロード可能なファイルがありません",deviceOffline:"デバイスがオフラインで書き込みできません",fileTooLarge:"書き込みに失敗しました: ファイルサイズ{fileSize}MBがassetsパーティションサイズ{partitionSize}MBを超えています。設定内容を減らすか、より大容量のデバイスを使用してください。",flashCancelConfirm:"書き込みをキャンセルしてもよろしいですか?",oldDataCleared:`古いバージョンの絵文字データ構造が検出され、クリアされました。 + +新しいバージョンはファイル重複除去技術を使用してストレージスペースを節約します。 + +カスタム絵文字画像を再アップロードしてください。`,incompatibleEmojiData:"互換性のない絵文字データを検出しました、再設定してください"},vf={authTokenMissing:"認証トークンが見つかりません",checkingDeviceStatus:"デバイスの状態を確認中...",deviceOfflineOrUnresponsive:"デバイスが存在しないか、オンラインではありません",unableToGetDeviceStatus:"デバイスの状態を取得できません",initializingTransferService:"転送サービスを初期化中...",initializeTransferFailed:"転送サービスの初期化に失敗しました: {error}",uploadingFile:"ファイルをアップロード中...",uploadFailed:"ファイルのアップロードに失敗しました",settingDeviceDownloadUrl:"デバイスダウンロードURLを設定中...",setDownloadUrlFailed:"ダウンロードURLの設定に失敗しました: {error}",rebootingDevice:"デバイスを再起動中...",waitingForDeviceReboot:"デバイスの再起動を待機中...",deviceRebootTimeout:"デバイスの再起動タイムアウト(60秒)",deviceReady:"デバイスが準備できました。プログラムの書き込みをお待ちください",startingFileTransfer:"ファイル転送を開始中...",flashCompleted:"プログラムの書き込み中、ファームウェアの書き込み状態に注意してください!",onlineFlashFailed:"オンライン書き込みに失敗しました: {error}"},Ff={online:"オンライン",offline:"オフライン",checking:"確認中...",flashing:"書き込み中...",ready:"準備完了",chip:"チップ",board:"ボード",flash:"Flash",screen:"画面",signal:{unknown:"不明",strong:"強",medium:"中",weak:"弱",none:"信号なし"}},Sf={title:"ステップ1: チップモデルと画面設定",loadingFromDevice:"デバイスからハードウェア設定を読み込み中...",loadedFromDevice:"デバイスからハードウェア設定が自動読み込みされました",manualConfig:"ハードウェアパラメータを手動で設定してください",loadingTitle:"デバイス設定を読み込み中...",loadingDesc:"デバイスからチップモデルと画面解像度を読み取り中",autoLoadedTitle:"デバイス設定が自動読み込みされました",chipModel:"チップモデル",screenWidth:"画面幅",screenHeight:"画面高",colorFormat:"色形式:",manualEdit:"手動設定",collapseManual:"手動設定を折りたたむ",manualConfigTitle:"手動ハードウェア設定",next:"次へ",selectChip:"チップを選択",chipRequired:"チップモデル",widthRequired:"画面幅",heightRequired:"画面高",loadingError:"設定読み込みエラー",deviceOffline:"デバイスが接続されていないかオフラインです",chipModelError:"チップモデルを取得できません、手動で入力してください",resolutionError:"画面解像度を取得できません、手動で入力してください",timeoutError:"設定読み込みタイムアウト、手動で入力してください",manualConfigDesc:"デバイスの設定を自動読み取りできません",manualConfigHint:"デバイスが接続されていないかオフラインです、ハードウェア設定を手動で入力してください",manualConfigRequired:"ハードウェア設定を手動で入力してください",resolutionFormatError:"画面解像度形式エラー"},Rf={title:"ステップ2: テーマデザイン",description:"ウェイクワード、フォント、絵文字、背景を設定して、小智AIテーマをカスタマイズします。",previous:"前へ",next:"次へ",tabs:{wakeword:"ウェイクワード設定",font:"フォント設定",emoji:"絵文字コレクション",background:"チャット背景"}},bf={title:"ステップ3: プレビュー",description:"実際のデバイスでのカスタム設定の効果をプレビューします。",devicePreview:"デバイスプレビュー(1:1ピクセル比)",previewSettings:"プレビュー設定",previewText:"プレビューテキスト",defaultPreviewText:"こんにちは、私はあなたの友人、シャオズーです!",currentEmotion:"現在の感情",themeMode:"テーマモード",lightMode:"ライト",darkMode:"ダーク",configSummary:"設定概要",wakeword:"ウェイクワード:",font:"フォント:",loading:"読み込み中...",emotion:"感情:",skin:"スキン:",previous:"前へ",generate:"assets.binを生成",emotions:{neutral:"中立",happy:"幸せ",laughing:"大笑い",funny:"面白い",sad:"悲しい",angry:"怒り",crying:"泣き",loving:"愛情",embarrassed:"恥ずかしい",surprised:"驚き",shocked:"ショック",thinking:"考え中",winking:"ウインク",cool:"クール",relaxed:"リラックス",delicious:"美味しい",kissy:"キス",confident:"自信",sleepy:"眠い",silly:"ばかげた",confused:"混乱"},noEmotionConfigured:"感情が設定されていません",fontLoading:"フォント読み込み中...",configureEmojiFirst:"テーマデザインで絵文字パックを設定してください",customFont:"カスタムフォント {size}px",customEmoji:"カスタム絵文字 {count}画像",notConfigured:"未設定",skinLight:"ライト{type}",skinDark:"ダーク{type}",hideSubtitle:"字幕を隠す:",image:"画像",color:"色"},Nf={title:"チャット背景設定",description:"ライトモードとダークモードのチャット背景を設定し、単色またはカスタム画像をサポートします。",lightMode:"ライトモード背景",darkMode:"ダークモード背景",solidBackground:"単色背景",imageBackground:"画像背景",backgroundColor:"背景色:",textColor:"文字色:",backgroundImage:"背景画像:",clickOrDragToUpload:"クリックまたはドラッグして背景画像をアップロード",removeImage:"画像を削除",backgroundPreview:"背景プレビュー",lightModePreview:"ライトモード",darkModePreview:"ダークモード",chatArea:"チャットコンテンツエリア",quickConfig:"クイック設定",defaultColors:"デフォルト色",stoneTexture:"石質感",sunnyColors:"晴れ色",skyBlue:"空色",romanticPink:"ロマンチックピンク",selectValidImage:"有効な画像ファイルを選択してください"},Gf={title:"絵文字コレクション設定",description:"プリセット絵文字パックを選択するか、カスタム絵文字画像をアップロードします。各絵文字パックには21種類の異なる感情表現が含まれます。",noEmojiPack:"絵文字パックなし",noEmojiPackDescription:"絵文字パックを設定せず、パッケージにはフォントと背景リソースのみを含めます。",presetEmojiPack:"プリセット絵文字パック",customEmojiPack:"カスタム絵文字パック",selectPresetEmojiPack:"プリセット絵文字パックを選択",twemoji64:"Twemoji 64×64",twemoji32:"Twemoji 32×32",twemojiDescription:"Twitterの高品質絵文字セット、鮮明な表示に最適",twitterEmojiName:"Twemoji {size}x{size}",twitterEmojiDescription:"Twitter絵文字パック、{size}×{size}ピクセル",size:"サイズ",preview:"プレビュー",select:"選択",customEmojiTitle:"カスタム絵文字パック",customEmojiDescription:"独自の絵文字画像をアップロードします。各感情に1つの画像が必要です。",uploadInstructions:"クリックまたはドラッグして絵文字画像をアップロード(PNG/JPG/WEBP)",supportedFormats:"サポート形式: PNG, JPG, WEBP。推奨サイズ: 64×64ピクセル",emotionMapping:"感情マッピング",uploadAllEmotions:"すべての感情の絵文字画像をアップロードしてください",maxImageWidth:"最大画像幅(px)",maxImageHeight:"最大画像高(px)",clickToUpload:"クリックしてアップロード",orDragDrop:"またはドラッグ&ドロップ",clickToUploadOrDrag:"クリックしてアップロードまたはここにドラッグ",remove:"削除",replace:"置き換え",selectValidEmojiImage:"有効な絵文字画像ファイルを選択してください",selectValidFormat:"有効なPNGまたはGIF形式の画像を選択してください",maxFileSize:"ファイルサイズは1MBを超えないでください",invalidFormat:"サポートされていない画像形式です。PNG、JPG、またはWEBPを使用してください。",required:"必須",uploadEmojiImages:"絵文字画像をアップロード(GIFにはPSRAMが必要)",customEmojiPackConfig:"カスタム絵文字パック設定",neutralRequiredNotice:"* 中立のデフォルト感情をアップロードする必要があります、他の感情はオプションです。アップロードしない場合、デフォルト感情が代わりに使用されます。",sharedFileMessage:"感情{emotionKey}は{existingEmotions}と同じ画像ファイルを使用しています(共有ストレージ)",fileDeleted:"ファイル{fileHash}が削除されました(他の感情参照なし)",fileRetained:"ファイル{fileHash}は他の感情でまだ使用されているため、保持されます",imageLoadFailed:"絵文字画像の読み込みに失敗しました",emotions:{neutral:"中立",happy:"幸せ",laughing:"大笑い",funny:"面白い",sad:"悲しい",angry:"怒り",crying:"泣き",loving:"愛情",embarrassed:"恥ずかしい",surprised:"驚き",shocked:"ショック",thinking:"考え中",winking:"ウインク",cool:"クール",relaxed:"リラックス",delicious:"美味しい",kissy:"キス",confident:"自信",sleepy:"眠い",silly:"ばかげた",confused:"混乱"}},Lf={title:"フォント設定",description:"プリセットフォントを選択するか、カスタムフォントファイルをアップロードします。",noFonts:"フォントなし",noFontsDescription:"フォント設定を使用しない、デバイスはデフォルトのフォントを使用します",presetFonts:"プリセットフォント",customFonts:"カスタムフォント",selectPresetFont:"プリセットフォントを選択",fontSize:"フォントサイズ:",bitDepth:"ビット深度:",charset:"文字セット:",fileSize:"ファイルサイズ:",customFontConfig:"カスタムフォント設定",fontFile:"フォントファイル",clickSelectFontFile:"クリックしてフォントファイルを選択",orDragFileHere:"またはファイルをここにドラッグ",supportedFormats:"TTF、WOFF、WOFF2形式をサポート",removeFile:"ファイルを削除",fontSizePx:"フォントサイズ(px)",range:"範囲:",bitDepthBpp:"ビット深度(BPP)",monochrome:"1 bpp(モノクロ)",fourColors:"2 bpp(4色)",sixteenColors:"4 bpp(16色)",characterSet:"文字セット",deepseekR1:"DeepSeek R1(7405文字)",gb2312:"GB2312(7445文字)",qwen18409:"Qwen(18409文字)",latin1:"Latin1(190文字)",fullCharset:"完全な文字セット(フォントファイルのすべての文字)",hideSubtitle:"字幕を隠す",hideSubtitleDescription:"会話中にリアルタイム字幕を表示しない",selectValidFontFile:"有効なフォントファイルを選択してください(TTF、WOFF、WOFF2)",presetFontNames:{font_puhui_deepseek_14_1:"Alibaba PuHuiTi 14px",font_puhui_deepseek_16_4:"Alibaba PuHuiTi 16px",font_puhui_deepseek_20_4:"Alibaba PuHuiTi 20px",font_puhui_deepseek_30_4:"Alibaba PuHuiTi 30px",font_noto_qwen_14_1:"Noto Sans 14px",font_noto_qwen_16_4:"Noto Sans 16px",font_noto_qwen_20_4:"Noto Sans 20px",font_noto_qwen_30_4:"Noto Sans 30px"},charsetDeepseek:"DeepSeek 7405",charsetQwen:"Qwen 18409"},Uf={app:hf,common:ff,header:df,configNotice:pf,steps:mf,generateModal:yf,progressSteps:wf,wakewordConfig:Df,errors:kf,flashProgress:vf,device:Ff,chipConfig:Sf,themeDesign:Rf,generateSummary:bf,backgroundConfig:Nf,emojiConfig:Gf,fontConfig:Lf},Mf={title:"Xiaozhi AI Tùy chỉnh"},xf={cancel:"Hủy",confirm:"Xác nhận",close:"Đóng",start:"Bắt đầu",download:"Tải xuống",generate:"Tạo",reset:"Đặt lại",yes:"Có",no:"Không",loading:"Đang tải...",error:"Lỗi",success:"Thành công",warning:"Cảnh báo",info:"Thông tin",next:"Tiếp theo",previous:"Trước đó",finish:"Hoàn thành",retry:"Thử lại",ok:"OK",other:"Khác"},Jf={title:"Xiaozhi AI Tùy chỉnh"},Tf={title:"Phát hiện cấu hình đã lưu",message:"Cấu hình đã được khôi phục tự động. Bạn có thể tiếp tục từ nơi đã dừng hoặc bắt đầu lại.",restart:"Bắt đầu lại"},Hf={chip:"Cấu hình chip",theme:"Thiết kế chủ đề",generate:"Xem trước & Tạo"},Yf={title:"Tạo assets.bin",confirmConfig:"Vui lòng xác nhận cấu hình của bạn",chipModel:"Mô hình chip:",resolution:"Độ phân giải:",wakeword:"Từ đánh thức:",font:"Phông chữ:",emoji:"Gói biểu tượng cảm xúc:",fileList:"Danh sách tệp được bao gồm",estimated:"Ước tính",compressed:"Trước khi nén",generating:"Đang tạo assets.bin...",progress:"{progress}% Hoàn thành",completed:"Tệp assets.bin của bạn đã sẵn sàng",filename:"Tên tệp: assets.bin",fileSize:"Kích thước tệp: {size}",generationTime:"Thời gian tạo: {time}",downloadAssets:"Tải xuống assets.bin",flashToDevice:"Flash trực tuyến vào thiết bị",flashing:"Đang flash vào thiết bị...",flashingCancel:"Hủy flash",flashingError:"Lỗi flash",flashingInProgress:"Đang flash, vui lòng không đóng cửa sổ",customFont:"Phông chữ tùy chỉnh",customEmoji:"Gói biểu tượng cảm xúc tùy chỉnh",notConfigured:"Chưa cấu hình",wakewordNames:{wn9s_hilexin:"Hi, Espressif",wn9s_hiesp:"Hi, ESP",wn9s_nihaoxiaozhi:"Xin chào Xiaozhi",wn9_nihaoxiaozhi_tts:"Xin chào Xiaozhi",wn9_alexa:"Alexa"}},_f={init:"Khởi tạo trình tạo",font:"Xử lý tệp phông chữ",wakeword:"Đóng gói mô hình từ đánh thức",emoji:"Xử lý hình ảnh biểu tượng cảm xúc",background:"Xử lý hình ảnh nền",index:"Tạo tệp chỉ mục",spiffs:"Xây dựng ánh xạ SPIFFS",package:"Hoàn thành đóng gói"},Kf={title:"Cấu hình từ đánh thức",description:"Chọn mô hình từ đánh thức đặt sẵn hoặc tùy chỉnh thông qua mô hình lệnh.",supportWakeNet9:"Chip của bạn hỗ trợ mô hình WakeNet9.",supportWakeNet9s:"Chip của bạn hỗ trợ mô hình WakeNet9s.",notSupported:"Chip của bạn không hỗ trợ chức năng từ đánh thức.",notice:"Lưu ý:",unsupportedMessage:"Chip {chipModel} không hỗ trợ chức năng từ đánh thức. Nếu bạn cần sử dụng từ đánh thức, vui lòng chọn chip ESP32-S3, ESP32-P4 hoặc ESP32-C3/C5/C6.",noWakeword:"Tắt đánh thức",presetWakeword:"Mặc định",customWakeword:"Tùy chỉnh",selectWakeword:"Chọn từ đánh thức",placeholder:"Chọn một từ...",customSettings:"Cài đặt từ đánh thức tùy chỉnh",wakewordName:"Tên từ đánh thức",wakewordNamePlaceholder:"VD: Xiaozhi / Potato",wakewordCommand:"Lệnh đánh thức",wakewordCommandPlaceholderCN:"Pinyin cách nhau bằng dấu cách, VD: ni hao xiao zhi",wakewordCommandPlaceholderEN:"Từ tiếng Anh, không dấu câu, VD: HELLO POTATO",threshold:"Ngưỡng nhạy (0-100)",thresholdDesc:"Càng nhỏ càng nhạy, mặc định là 20",duration:"Thời gian nhận diện",durationDesc:"Thời gian tối đa để nhận diện lệnh",selectModel:"Chọn mô hình nhận diện",mn6cn:"MultiNet6 (Tiếng Trung)",mn6en:"MultiNet6 (Tiếng Anh)",mn7cn:"MultiNet7 (Tiếng Trung)",mn7en:"MultiNet7 (Tiếng Anh)",errors:{nameRequired:"Vui lòng nhập tên từ đánh thức",commandRequired:"Vui lòng nhập lệnh đánh thức",noPunctuation:"Lệnh không thể chứa dấu câu",durationRange:"Thời gian phải từ 500-10000ms"},tips:{tipLabel:"Mẹo:",optional:"Từ đánh thức là tùy chọn. Nếu tắt, thiết bị sẽ không thể đánh thức bằng giọng nói.",wakeNet9sOnly:"Chip C3/C5/C6 chỉ hỗ trợ mô hình nhẹ WakeNet9s.",wakeNet9Full:"Chip S3/P4 hỗ trợ mô hình WakeNet9 hoàn chỉnh với nhiều lựa chọn hơn.",customSupport:"Từ đánh thức tùy chỉnh sử dụng mô hình MultiNet, hiện chỉ hỗ trợ chip ESP32-S3."}},Of={resetFailed:"Đặt lại thất bại, vui lòng làm mới trang và thử lại",generationFailed:"Tạo thất bại: {error}",noFileToDownload:"Không có tệp nào để tải xuống",deviceOffline:"Thiết bị ngoại tuyến và không thể flash",fileTooLarge:"Flash thất bại: Kích thước tệp {fileSize}MB vượt quá kích thước phân vùng assets {partitionSize}MB. Vui lòng giảm nội dung cấu hình hoặc sử dụng thiết bị có dung lượng lớn hơn.",flashCancelConfirm:"Bạn có chắc chắn muốn hủy flash?",oldDataCleared:`Đã phát hiện và xóa cấu trúc dữ liệu biểu tượng cảm xúc phiên bản cũ. + +Phiên bản mới sử dụng công nghệ loại bỏ trùng lặp tệp để tiết kiệm không gian lưu trữ. + +Vui lòng tải lại hình ảnh biểu tượng cảm xúc tùy chỉnh.`,incompatibleEmojiData:"Phát hiện dữ liệu biểu tượng cảm xúc không tương thích, vui lòng cấu hình lại"},Pf={authTokenMissing:"Không tìm thấy mã thông báo xác thực",checkingDeviceStatus:"Đang kiểm tra trạng thái thiết bị...",deviceOfflineOrUnresponsive:"Thiết bị không tồn tại hoặc không trực tuyến",unableToGetDeviceStatus:"Không thể lấy trạng thái thiết bị",initializingTransferService:"Đang khởi tạo dịch vụ truyền tải...",initializeTransferFailed:"Khởi tạo dịch vụ truyền tải thất bại: {error}",uploadingFile:"Tải lên tập tin. .....",uploadFailed:"Tải lên tập tin không thành công",settingDeviceDownloadUrl:"Đang thiết lập URL tải xuống thiết bị...",setDownloadUrlFailed:"Thiết lập URL tải xuống thất bại: {error}",rebootingDevice:"Đang khởi động lại thiết bị...",waitingForDeviceReboot:"Đang chờ thiết bị khởi động lại...",deviceRebootTimeout:"Hết thời gian chờ thiết bị khởi động lại (60 giây)",deviceReady:"Thiết bị đã sẵn sàng, vui lòng chờ chương trình ghi",startingFileTransfer:"Đang bắt đầu truyền tải tệp...",flashCompleted:"Trong quá trình ghi âm chương trình, xin lưu ý trạng thái ghi âm của phần cố định!",onlineFlashFailed:"Flash trực tuyến thất bại: {error}"},Vf={online:"Trực tuyến",offline:"Ngoại tuyến",checking:"Đang kiểm tra...",flashing:"Đang flash...",ready:"Sẵn sàng",chip:"Chip",board:"Bo mạch",flash:"Flash",screen:"Màn hình",signal:{unknown:"Không xác định",strong:"Mạnh",medium:"Trung bình",weak:"Yếu",none:"Không có tín hiệu"}},Wf={title:"Bước 1: Cấu hình mô hình chip và màn hình",loadingFromDevice:"Đang tải cấu hình phần cứng từ thiết bị...",loadedFromDevice:"Cấu hình phần cứng được tải tự động từ thiết bị",manualConfig:"Vui lòng cấu hình các thông số phần cứng theo cách thủ công",loadingTitle:"Đang tải cấu hình thiết bị...",loadingDesc:"Đang đọc mô hình chip và độ phân giải màn hình từ thiết bị",autoLoadedTitle:"Cấu hình thiết bị được tải tự động",chipModel:"Mô hình chip",screenWidth:"Chiều rộng màn hình",screenHeight:"Chiều cao màn hình",colorFormat:"Định dạng màu:",manualEdit:"Cấu hình thủ công",collapseManual:"Thu gọn cấu hình thủ công",manualConfigTitle:"Cấu hình phần cứng thủ công",next:"Tiếp theo",selectChip:"Chọn chip",chipRequired:"Mô hình chip",widthRequired:"Chiều rộng màn hình",heightRequired:"Chiều cao màn hình",loadingError:"Lỗi tải cấu hình",deviceOffline:"Thiết bị chưa kết nối hoặc ngoại tuyến",chipModelError:"Không thể lấy mô hình chip, vui lòng nhập thủ công",resolutionError:"Không thể lấy độ phân giải màn hình, vui lòng nhập thủ công",timeoutError:"Hết thời gian tải cấu hình, vui lòng nhập thủ công",manualConfigDesc:"Không thể tự động đọc cấu hình thiết bị",manualConfigHint:"Thiết bị chưa kết nối hoặc ngoại tuyến, vui lòng nhập cấu hình phần cứng thủ công",manualConfigRequired:"Vui lòng nhập cấu hình phần cứng thủ công",resolutionFormatError:"Lỗi định dạng độ phân giải màn hình"},qf={title:"Bước 2: Thiết kế chủ đề",description:"Cấu hình từ đánh thức, phông chữ, biểu tượng cảm xúc và nền để tùy chỉnh chủ đề Xiaozhi AI của bạn.",previous:"Trước đó",next:"Tiếp theo",tabs:{wakeword:"Cấu hình từ đánh thức",font:"Cấu hình phông chữ",emoji:"Bộ sưu tập biểu tượng cảm xúc",background:"Nền trò chuyện"}},jf={title:"Bước 3: Xem trước",description:"Xem trước hiệu ứng của cấu hình tùy chỉnh trên thiết bị thực tế.",devicePreview:"Xem trước thiết bị (tỷ lệ pixel 1:1)",previewSettings:"Cài đặt xem trước",previewText:"Văn bản xem trước",defaultPreviewText:"Xin chào, tôi là bạn của bạn Xiaozhi!",currentEmotion:"Cảm xúc hiện tại",themeMode:"Chế độ chủ đề",lightMode:"Sáng",darkMode:"Tối",configSummary:"Tóm tắt cấu hình",wakeword:"Từ đánh thức:",font:"Phông chữ:",loading:"Đang tải...",emotion:"Cảm xúc:",skin:"Da:",previous:"Trước đó",generate:"Tạo assets.bin",emotions:{neutral:"Trung lập",happy:"Vui vẻ",laughing:"Cười lớn",funny:"Hài hước",sad:"Buồn",angry:"Giận dữ",crying:"Khóc",loving:"Yêu thương",embarrassed:"Xấu hổ",surprised:"Bất ngờ",shocked:"Sốc",thinking:"Suy nghĩ",winking:"Nháy mắt",cool:"Ngầu",relaxed:"Thoải mái",delicious:"Ngon miệng",kissy:"Hôn",confident:"Tự tin",sleepy:"Buồn ngủ",silly:"Ngớ ngẩn",confused:"Bối rối"},noEmotionConfigured:"Chưa cấu hình cảm xúc",fontLoading:"Đang tải phông chữ...",configureEmojiFirst:"Vui lòng cấu hình gói biểu tượng cảm xúc trong thiết kế chủ đề trước",customFont:"Phông chữ tùy chỉnh {size}px",customEmoji:"Biểu tượng cảm xúc tùy chỉnh {count} hình ảnh",notConfigured:"Chưa cấu hình",skinLight:"Sáng {type}",skinDark:"Tối {type}",hideSubtitle:"Ẩn phụ đề:",image:"Hình ảnh",color:"Màu sắc"},Zf={title:"Cấu hình nền trò chuyện",description:"Cấu hình nền trò chuyện cho chế độ sáng và tối, hỗ trợ màu đơn hoặc hình ảnh tùy chỉnh.",lightMode:"Nền chế độ sáng",darkMode:"Nền chế độ tối",solidBackground:"Nền màu đơn",imageBackground:"Nền hình ảnh",backgroundColor:"Màu nền:",textColor:"Màu chữ:",backgroundImage:"Hình ảnh nền:",clickOrDragToUpload:"Nhấp hoặc kéo để tải lên hình ảnh nền",removeImage:"Xóa hình ảnh",backgroundPreview:"Xem trước nền",lightModePreview:"Chế độ sáng",darkModePreview:"Chế độ tối",chatArea:"Khu vực nội dung trò chuyện",quickConfig:"Cấu hình nhanh",defaultColors:"Màu mặc định",stoneTexture:"Kết cấu đá",sunnyColors:"Màu nắng",skyBlue:"Xanh trời",romanticPink:"Hồng lãng mạn",selectValidImage:"Vui lòng chọn tệp hình ảnh hợp lệ"},Xf={title:"Cấu hình bộ sưu tập biểu tượng cảm xúc",description:"Chọn gói biểu tượng cảm xúc đặt sẵn hoặc hình ảnh biểu tượng cảm xúc tùy chỉnh. Mỗi gói biểu tượng cảm xúc chứa 21 biểu cảm cảm xúc khác nhau.",noEmojiPack:"Không có gói biểu tượng cảm xúc",noEmojiPackDescription:"Không cấu hình gói biểu tượng cảm xúc, chỉ bao gồm phông chữ và tài nguyên nền trong gói.",presetEmojiPack:"Gói biểu tượng cảm xúc đặt sẵn",customEmojiPack:"Gói biểu tượng cảm xúc tùy chỉnh",selectPresetEmojiPack:"Chọn gói biểu tượng cảm xúc đặt sẵn",twemoji64:"Twemoji 64×64",twemoji32:"Twemoji 32×32",twemojiDescription:"Bộ biểu tượng cảm xúc chất lượng cao từ Twitter, hoàn hảo để hiển thị rõ ràng",twitterEmojiName:"Twemoji {size}x{size}",twitterEmojiDescription:"Gói biểu tượng cảm xúc Twitter, {size}×{size} pixel",size:"Kích thước",preview:"Xem trước",select:"Chọn",customEmojiTitle:"Gói biểu tượng cảm xúc tùy chỉnh",customEmojiDescription:"Tải lên hình ảnh biểu tượng cảm xúc của riêng bạn. Mỗi cảm xúc cần một hình ảnh.",uploadInstructions:"Nhấp hoặc kéo để tải lên hình ảnh biểu tượng cảm xúc (PNG/JPG/WEBP)",supportedFormats:"Định dạng được hỗ trợ: PNG, JPG, WEBP. Kích thước khuyến nghị: 64×64 pixel",emotionMapping:"Ánh xạ cảm xúc",uploadAllEmotions:"Vui lòng tải lên hình ảnh biểu tượng cảm xúc cho tất cả cảm xúc",maxImageWidth:"Chiều rộng hình ảnh tối đa (px)",maxImageHeight:"Chiều cao hình ảnh tối đa (px)",clickToUpload:"Nhấp để tải lên",orDragDrop:"hoặc kéo và thả",clickToUploadOrDrag:"Nhấp để tải lên hoặc kéo vào đây",remove:"Xóa",replace:"Thay thế",selectValidEmojiImage:"Vui lòng chọn tệp hình ảnh biểu tượng cảm xúc hợp lệ",selectValidFormat:"Vui lòng chọn hình ảnh định dạng PNG hoặc GIF hợp lệ",maxFileSize:"Kích thước tệp không được vượt quá 1MB",invalidFormat:"Định dạng hình ảnh không được hỗ trợ. Vui lòng sử dụng PNG, JPG hoặc WEBP.",required:"Bắt buộc",uploadEmojiImages:"Tải lên hình ảnh biểu tượng cảm xúc (GIF cần PSRAM)",customEmojiPackConfig:"Cấu hình gói biểu tượng cảm xúc tùy chỉnh",neutralRequiredNotice:"* Phải tải lên cảm xúc mặc định trung lập, các cảm xúc khác là tùy chọn. Nếu không tải lên, cảm xúc mặc định sẽ được sử dụng thay thế.",sharedFileMessage:"Cảm xúc {emotionKey} sử dụng cùng tệp hình ảnh với {existingEmotions} (lưu trữ chia sẻ)",fileDeleted:"Tệp {fileHash} đã bị xóa (không có tham chiếu cảm xúc khác)",fileRetained:"Tệp {fileHash} vẫn được sử dụng bởi các cảm xúc khác, được giữ lại",imageLoadFailed:"Không tải được hình ảnh biểu tượng cảm xúc",emotions:{neutral:"Trung lập",happy:"Vui vẻ",laughing:"Cười lớn",funny:"Hài hước",sad:"Buồn",angry:"Giận dữ",crying:"Khóc",loving:"Yêu thương",embarrassed:"Xấu hổ",surprised:"Bất ngờ",shocked:"Sốc",thinking:"Suy nghĩ",winking:"Nháy mắt",cool:"Ngầu",relaxed:"Thoải mái",delicious:"Ngon miệng",kissy:"Hôn",confident:"Tự tin",sleepy:"Buồn ngủ",silly:"Ngớ ngẩn",confused:"Bối rối"}},zf={title:"Cấu hình phông chữ",description:"Chọn phông chữ đặt sẵn hoặc tải lên tệp phông chữ tùy chỉnh.",noFonts:"Không có phông chữ",noFontsDescription:"Không sử dụng cấu hình phông chữ, thiết bị sẽ sử dụng phông chữ mặc định",presetFonts:"Phông chữ đặt sẵn",customFonts:"Phông chữ tùy chỉnh",selectPresetFont:"Chọn phông chữ đặt sẵn",fontSize:"Kích thước phông chữ:",bitDepth:"Độ sâu bit:",charset:"Bộ ký tự:",fileSize:"Kích thước tệp:",customFontConfig:"Cấu hình phông chữ tùy chỉnh",fontFile:"Tệp phông chữ",clickSelectFontFile:"Nhấp để chọn tệp phông chữ",orDragFileHere:"hoặc kéo tệp vào đây",supportedFormats:"Hỗ trợ định dạng TTF, WOFF, WOFF2",removeFile:"Xóa tệp",fontSizePx:"Kích thước phông chữ (px)",range:"Phạm vi:",bitDepthBpp:"Độ sâu bit (BPP)",monochrome:"1 bpp (Đơn sắc)",fourColors:"2 bpp (4 màu)",sixteenColors:"4 bpp (16 màu)",characterSet:"Bộ ký tự",deepseekR1:"DeepSeek R1 (7405 ký tự)",gb2312:"GB2312 (7445 ký tự)",qwen18409:"Qwen (18409 ký tự)",latin1:"Latin1 (190 ký tự)",fullCharset:"Bộ ký tự đầy đủ (Tất cả ký tự trong tệp phông chữ)",hideSubtitle:"Ẩn phụ đề",hideSubtitleDescription:"Không hiển thị phụ đề văn bản trong khi trò chuyện",selectValidFontFile:"Vui lòng chọn tệp phông chữ hợp lệ (TTF, WOFF, WOFF2)",presetFontNames:{font_puhui_deepseek_14_1:"Alibaba PuHuiTi 14px",font_puhui_deepseek_16_4:"Alibaba PuHuiTi 16px",font_puhui_deepseek_20_4:"Alibaba PuHuiTi 20px",font_puhui_deepseek_30_4:"Alibaba PuHuiTi 30px",font_noto_qwen_14_1:"Noto Sans 14px",font_noto_qwen_16_4:"Noto Sans 16px",font_noto_qwen_20_4:"Noto Sans 20px",font_noto_qwen_30_4:"Noto Sans 30px"},charsetDeepseek:"DeepSeek 7405",charsetQwen:"Qwen 18409"},$f={app:Mf,common:xf,header:Jf,configNotice:Tf,steps:Hf,generateModal:Yf,progressSteps:_f,wakewordConfig:Kf,errors:Of,flashProgress:Pf,device:Vf,chipConfig:Wf,themeDesign:qf,generateSummary:jf,backgroundConfig:Zf,emojiConfig:Xf,fontConfig:zf},Ad={en:Lh,"zh-CN":zh,"zh-TW":uf,ja:Uf,vi:$f},No=[{code:"en",name:"English",flag:"🇺🇸"},{code:"zh-CN",name:"简体中文",flag:"🇨🇳"},{code:"zh-TW",name:"繁體中文",flag:"🇹🇼"},{code:"ja",name:"日本語",flag:"🇯🇵"},{code:"vi",name:"Tiếng Việt",flag:"🇻🇳"}];function ed(){const A=navigator.language||navigator.userLanguage;return{"zh-CN":"zh-CN","zh-TW":"zh-TW","zh-HK":"zh-TW",zh:"zh-CN",ja:"ja",vi:"vi",en:"en","en-US":"en","en-GB":"en"}[A]||"en"}const td={class:"relative"},id={class:"py-1"},od=["onClick"],nd={class:"mr-3"},rd={key:0,class:"ml-auto w-4 h-4 text-blue-600",fill:"currentColor",viewBox:"0 0 20 20"},gd={__name:"LanguageSelector",setup(A){const{locale:e}=ve(),t=EA(!1),i=hA(()=>No.find(s=>s.code===e.value)||No[0]),o=()=>{t.value=!t.value},n=()=>{t.value=!1},r=s=>{e.value=s,localStorage.setItem("user-language",s),n()},g=s=>{s.target.closest(".relative")||n()};return Ft(()=>{document.addEventListener("click",g);const s=localStorage.getItem("user-language");s&&No.find(a=>a.code===s)&&(e.value=s)}),Ci(()=>{document.removeEventListener("click",g)}),(s,a)=>(T(),K("div",td,[B("button",{onClick:o,class:"flex items-center space-x-2 px-3 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"},[B("span",null,F(i.value.flag),1),B("span",null,F(i.value.name),1),(T(),K("svg",{class:kA(["w-4 h-4 transition-transform duration-200",{"rotate-180":t.value}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...a[1]||(a[1]=[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)])],2))]),t.value?(T(),K("div",{key:0,class:"absolute right-0 mt-2 w-48 bg-white border border-gray-200 rounded-md shadow-lg z-50",onClick:a[0]||(a[0]=dt(()=>{},["stop"]))},[B("div",id,[(T(!0),K(qA,null,Ke(BA(No),I=>(T(),K("button",{key:I.code,onClick:l=>r(I.code),class:kA(["flex items-center w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100",{"bg-blue-50 text-blue-700":I.code===i.value.code}])},[B("span",nd,F(I.flag),1),B("span",null,F(I.name),1),I.code===i.value.code?(T(),K("svg",rd,[...a[2]||(a[2]=[B("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"},null,-1)])])):sA("",!0)],10,od))),128))])])):sA("",!0),t.value?(T(),K("div",{key:1,class:"fixed inset-0 z-40",onClick:n})):sA("",!0)]))}},sd={class:"space-y-6"},ad={class:"text-xl font-semibold text-gray-900 mb-4"},Id={class:"text-gray-600 mb-6"},Cd={key:0},ld={key:1},Bd={key:2},Qd={key:0,class:"space-y-4"},cd={class:"bg-blue-50 border-2 border-blue-200 rounded-lg p-6"},Ed={class:"flex items-center justify-center space-x-3"},ud={class:"text-lg font-medium text-blue-900"},hd={class:"text-sm text-blue-700 mt-1"},fd={key:1,class:"space-y-4"},dd={class:"bg-green-50 border-2 border-green-200 rounded-lg p-4"},pd={class:"flex items-start justify-between mb-3"},md={class:"flex items-center"},yd={class:"text-lg font-medium text-green-900"},wd={class:"grid grid-cols-1 md:grid-cols-3 gap-4 mt-4"},Dd={class:"bg-white rounded-lg p-3"},kd={class:"block text-sm font-medium text-gray-700 mb-1"},vd={class:"text-base font-semibold text-gray-900"},Fd={class:"bg-white rounded-lg p-3"},Sd={class:"block text-sm font-medium text-gray-700 mb-1"},Rd={class:"text-base font-semibold text-gray-900"},bd={class:"bg-white rounded-lg p-3"},Nd={class:"block text-sm font-medium text-gray-700 mb-1"},Gd={class:"text-base font-semibold text-gray-900"},Ld={class:"mt-3 text-sm text-green-700"},Ud={class:"border border-gray-200 rounded-lg p-4"},Md={key:0,class:"mt-4"},xd={key:2,class:"space-y-4"},Jd={class:"bg-yellow-50 border border-yellow-200 rounded-lg p-4"},Td={class:"flex items-start"},Hd={class:"font-medium text-yellow-900"},Yd={class:"text-sm text-yellow-700 mt-1"},_d={class:"border-2 border-gray-300 rounded-lg p-4"},Kd={class:"text-lg font-medium text-gray-900 mb-4"},Od={class:"flex justify-end"},Pd=["disabled"],Vd={__name:"ChipConfig",props:{modelValue:{type:Object,default:()=>({model:"",display:{width:320,height:240,color:"RGB565"}})}},emits:["update:modelValue","next"],setup(A,{emit:e}){const{t}=ve(),i=e,o=hA(()=>[{value:"",label:t("chipConfig.selectChip")},{value:"esp32s3",label:"ESP32-S3"},{value:"esp32c3",label:"ESP32-C3"},{value:"esp32c5",label:"ESP32-C5"},{value:"esp32c6",label:"ESP32-C6"},{value:"esp32p4",label:"ESP32-P4"},{value:"esp32",label:"ESP32"},{value:"others",label:t("common.other")}]),n={name:"ConfigForm",props:{config:{type:Object,required:!0},showRequired:{type:Boolean,default:!1}},render(){const p=this.$t;return GA("div",{class:"grid grid-cols-1 md:grid-cols-3 gap-4"},[GA("div",[GA("label",{class:"block text-sm font-medium text-gray-700 mb-2"},[p("chipConfig.chipRequired")+" ",this.showRequired&&GA("span",{class:"text-red-500"},"*")]),GA("select",{class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500",value:this.config.model,onChange:v=>{this.config.model=v.target.value}},BA(o).map(v=>GA("option",{value:v.value,key:v.value},v.label)))]),GA("div",[GA("label",{class:"block text-sm font-medium text-gray-700 mb-2"},[p("chipConfig.widthRequired")+" ",this.showRequired&&GA("span",{class:"text-red-500"},"*")]),GA("input",{type:"number",class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500",value:this.config.display.width,min:128,max:800,placeholder:"320",onInput:v=>{this.config.display.width=Number(v.target.value)}})]),GA("div",[GA("label",{class:"block text-sm font-medium text-gray-700 mb-2"},[p("chipConfig.heightRequired")+" ",this.showRequired&&GA("span",{class:"text-red-500"},"*")]),GA("input",{type:"number",class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500",value:this.config.display.height,min:128,max:600,placeholder:"240",onInput:v=>{this.config.display.height=Number(v.target.value)}})])])}},{deviceInfo:r,isDeviceOnline:g,hasToken:s}=Nn(),a=EA(s.value),I=EA(!1),l=EA(""),C=EA(!1),Q=EA({model:"",display:{width:320,height:240,color:"RGB565"}}),h={"ESP32-S3":"esp32s3",ESP32S3:"esp32s3","ESP32-C3":"esp32c3",ESP32C3:"esp32c3","ESP32-C5":"esp32c5",ESP32C5:"esp32c5","ESP32-P4":"esp32p4",ESP32P4:"esp32p4","ESP32-C6":"esp32c6",ESP32C6:"esp32c6",ESP32:"esp32"},f=()=>{var p,v;try{if(!g.value)return a.value||(l.value=t("chipConfig.deviceOffline"),I.value=!1),!1;const N=(p=r.value.chip)==null?void 0:p.model;if(!N||N==="未知")return!1;let G=h[N.toUpperCase()]||h[N]||N.toLowerCase().replace(/-/g,"");["esp32s3","esp32c3","esp32c5","esp32p4","esp32c6","esp32","others"].includes(G)||(G="others");const S=(v=r.value.screen)==null?void 0:v.resolution;if(!S||S==="未知")return!1;const[b,L]=S.split("x").map(Number);return!b||!L||isNaN(b)||isNaN(L)?(l.value=t("chipConfig.resolutionFormatError"),I.value=!1,a.value=!1,!1):(Q.value={model:G,display:{width:b,height:L,color:"RGB565"}},i("update:modelValue",{model:G,display:{width:b,height:L,color:"RGB565"}}),I.value=!0,l.value="",a.value=!1,console.log("✓ 设备配置加载成功:",{chip:G,width:b,height:L}),!0)}catch(N){return console.error("加载设备配置失败:",N),l.value=t("chipConfig.loadingError"),I.value=!1,a.value=!1,!1}},u=hA(()=>Q.value.model&&Q.value.display.width&&Q.value.display.height),E=hA(()=>Q.value.model?Q.value.model.toUpperCase().replace(/ESP32/i,"ESP32-"):""),D=hA(()=>Q.value.display),c=()=>{C.value=!C.value},d=()=>{u.value&&i("next")};return ae(()=>Q.value,p=>{i("update:modelValue",{model:p.model,display:{...p.display}})},{deep:!0}),ae(()=>g.value,p=>{p&&!I.value&&(a.value=!0,l.value="",setTimeout(()=>{f()},100))}),ae(()=>[r.value.chip,r.value.screen],()=>{g.value&&!I.value&&f()},{deep:!0}),Ft(()=>{if(!s.value){a.value=!1,l.value=t("chipConfig.manualConfigRequired"),console.log("⚠ 未检测到设备连接,使用手动配置模式");return}g.value&&r.value.chip&&r.value.chip.model!=="未知"&&r.value.screen&&r.value.screen.resolution!=="未知"?(console.log("✓ 检测到已缓存的设备信息,立即加载"),f()):g.value?(console.log("⏳ 设备在线,等待设备信息加载..."),a.value=!0,setTimeout(()=>{f()},500),setTimeout(()=>{a.value&&!I.value&&g.value&&(a.value=!1,!r.value.chip||r.value.chip.model==="未知"?l.value=t("chipConfig.chipModelError"):!r.value.screen||r.value.screen.resolution==="未知"?l.value=t("chipConfig.resolutionError"):l.value=t("chipConfig.timeoutError"),console.warn("⚠ 设备配置加载超时:",l.value))},1e4)):(console.log("⏳ 等待设备连接..."),a.value=!0,setTimeout(()=>{a.value&&!I.value&&!g.value&&(a.value=!1,l.value=t("chipConfig.manualConfigHint"),console.warn("⚠ 等待设备连接超时"))},1e4))}),(p,v)=>(T(),K("div",sd,[B("div",null,[B("h2",ad,F(p.$t("chipConfig.title")),1),B("p",Id,[a.value?(T(),K("span",Cd,F(p.$t("chipConfig.loadingFromDevice")),1)):I.value?(T(),K("span",ld,F(p.$t("chipConfig.loadedFromDevice")),1)):(T(),K("span",Bd,F(p.$t("chipConfig.manualConfig")),1))])]),a.value?(T(),K("div",Qd,[B("div",cd,[B("div",Ed,[v[0]||(v[0]=B("svg",{class:"animate-spin h-6 w-6 text-blue-600",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[B("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),B("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})],-1)),B("div",null,[B("h3",ud,F(p.$t("chipConfig.loadingTitle")),1),B("p",hd,F(p.$t("chipConfig.loadingDesc")),1)])])])])):BA(g)&&I.value?(T(),K("div",fd,[B("div",dd,[B("div",pd,[B("div",md,[v[1]||(v[1]=B("div",{class:"w-5 h-5 bg-green-500 rounded-full flex items-center justify-center mr-2"},[B("svg",{class:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})])],-1)),B("h3",yd,F(p.$t("chipConfig.autoLoadedTitle")),1)])]),B("div",wd,[B("div",Dd,[B("label",kd,F(p.$t("chipConfig.chipModel")),1),B("div",vd,F(E.value),1)]),B("div",Fd,[B("label",Sd,F(p.$t("chipConfig.screenWidth")),1),B("div",Rd,F(D.value.width)+" px",1)]),B("div",bd,[B("label",Nd,F(p.$t("chipConfig.screenHeight")),1),B("div",Gd,F(D.value.height)+" px",1)])]),B("div",Ld," ✓ "+F(p.$t("chipConfig.colorFormat"))+" "+F(D.value.color),1)]),B("div",Ud,[B("button",{onClick:c,class:"flex items-center text-sm text-gray-600 hover:text-gray-900"},[v[2]||(v[2]=B("svg",{class:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})],-1)),gt(" "+F(C.value?p.$t("chipConfig.collapseManual"):p.$t("chipConfig.manualEdit")),1)]),C.value?(T(),K("div",Md,[TA(n,{config:Q.value},null,8,["config"])])):sA("",!0)])])):(T(),K("div",xd,[B("div",Jd,[B("div",Td,[v[3]||(v[3]=B("svg",{class:"w-5 h-5 text-yellow-600 mr-3 flex-shrink-0 mt-0.5",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"})],-1)),B("div",null,[B("h4",Hd,F(p.$t("chipConfig.manualConfigDesc")),1),B("p",Yd,F(l.value||p.$t("chipConfig.manualConfigHint")),1)])])]),B("div",_d,[B("h3",Kd,F(p.$t("chipConfig.manualConfigTitle")),1),TA(n,{config:Q.value,"show-required":!0},null,8,["config"])])])),B("div",Od,[B("button",{onClick:d,disabled:!u.value,class:"bg-primary-500 hover:bg-primary-600 disabled:bg-gray-300 text-white px-6 py-2 rounded-lg font-medium transition-colors"},F(p.$t("chipConfig.next")),9,Pd)])]))}},Wd={class:"space-y-6"},qd={class:"text-lg font-medium text-gray-900 mb-2"},jd={class:"text-gray-600"},Zd={key:0,class:"bg-orange-50 border border-orange-200 rounded-lg p-4"},Xd={class:"text-sm text-orange-800"},zd={class:"mt-1"},$d={key:1,class:"space-y-6"},A0={class:"flex space-x-4"},e0={key:0,class:"space-y-4"},t0={class:"block text-sm font-medium text-gray-700"},i0={class:"relative"},o0=["value"],n0=["value"],r0={key:1,class:"space-y-4 bg-gray-50 p-4 rounded-lg border border-gray-200"},g0={class:"font-medium text-gray-900"},s0={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},a0={class:"block text-sm font-medium text-gray-700 mb-1"},I0=["placeholder"],C0={key:0,class:"text-xs text-red-500 mt-1"},l0={class:"block text-sm font-medium text-gray-700 mb-1"},B0=["placeholder"],Q0={key:0,class:"text-xs text-red-500 mt-1"},c0={class:"grid grid-cols-1 md:grid-cols-3 gap-4"},E0={class:"block text-sm font-medium text-gray-700 mb-1"},u0={class:"flex items-center space-x-2"},h0={class:"text-sm text-gray-600 w-8"},f0={class:"text-xs text-gray-500 mt-1"},d0={class:"block text-sm font-medium text-gray-700 mb-1"},p0={key:0,class:"text-xs text-red-500 mt-1"},m0={class:"block text-sm font-medium text-gray-700 mb-1"},y0={value:"mn6_cn"},w0={value:"mn6_en"},D0={class:"bg-blue-50 border border-blue-200 rounded-lg p-3"},k0={class:"text-sm text-blue-800"},v0={class:"mt-1 list-disc list-inside space-y-1"},F0={key:0},S0={key:1},R0={key:2},b0={__name:"WakewordConfig",props:{modelValue:{type:Object,required:!0},chipModel:{type:String,required:!0}},emits:["update:modelValue"],setup(A,{emit:e}){const{t}=ve(),i=A,o=e,n=[{id:"wn9s_hilexin",name:"Hi,乐鑫",model:"WakeNet9s"},{id:"wn9s_hiesp",name:"Hi,ESP",model:"WakeNet9s"},{id:"wn9s_nihaoxiaozhi",name:"你好小智",model:"WakeNet9s"},{id:"wn9s_hijason",name:"Hi,Jason",model:"WakeNet9s"},{id:"wn9s_alexa",name:"Alexa",model:"WakeNet9s"},{id:"wn9_hilexin",name:"Hi,乐鑫",model:"WakeNet9"},{id:"wn9_hiesp",name:"Hi,ESP",model:"WakeNet9"},{id:"wn9_nihaoxiaozhi_tts",name:"你好小智",model:"WakeNet9"},{id:"wn9_hijason_tts2",name:"Hi,Jason",model:"WakeNet9"},{id:"wn9_nihaomiaoban_tts2",name:"你好喵伴",model:"WakeNet9"},{id:"wn9_xiaoaitongxue",name:"小爱同学",model:"WakeNet9"},{id:"wn9_himfive",name:"Hi,M Five",model:"WakeNet9"},{id:"wn9_alexa",name:"Alexa",model:"WakeNet9"},{id:"wn9_jarvis_tts",name:"Jarvis",model:"WakeNet9"},{id:"wn9_computer_tts",name:"Computer",model:"WakeNet9"},{id:"wn9_heywillow_tts",name:"Hey,Willow",model:"WakeNet9"},{id:"wn9_sophia_tts",name:"Sophia",model:"WakeNet9"},{id:"wn9_mycroft_tts",name:"Mycroft",model:"WakeNet9"},{id:"wn9_heyprinter_tts",name:"Hey,Printer",model:"WakeNet9"},{id:"wn9_hijoy_tts",name:"Hi,Joy",model:"WakeNet9"},{id:"wn9_heywanda_tts",name:"Hey,Wand",model:"WakeNet9"},{id:"wn9_astrolabe_tts",name:"Astrolabe",model:"WakeNet9"},{id:"wn9_heyily_tts2",name:"Hey,Ily",model:"WakeNet9"},{id:"wn9_hijolly_tts2",name:"Hi,Jolly",model:"WakeNet9"},{id:"wn9_hifairy_tts2",name:"Hi,Fairy",model:"WakeNet9"},{id:"wn9_bluechip_tts2",name:"Blue Chip",model:"WakeNet9"},{id:"wn9_hiandy_tts2",name:"Hi,Andy",model:"WakeNet9"},{id:"wn9_heyivy_tts2",name:"Hey,Ivy",model:"WakeNet9"},{id:"wn9_hiwalle_tts2",name:"Hi,Wall E",model:"WakeNet9"},{id:"wn9_nihaoxiaoxin_tts",name:"你好小鑫",model:"WakeNet9"},{id:"wn9_xiaomeitongxue_tts",name:"小美同学",model:"WakeNet9"},{id:"wn9_hixiaoxing_tts",name:"Hi,小星",model:"WakeNet9"},{id:"wn9_xiaolongxiaolong_tts",name:"小龙小龙",model:"WakeNet9"},{id:"wn9_miaomiaotongxue_tts",name:"喵喵同学",model:"WakeNet9"},{id:"wn9_himiaomiao_tts",name:"Hi,喵喵",model:"WakeNet9"},{id:"wn9_hilili_tts",name:"Hi,Lily",model:"WakeNet9"},{id:"wn9_hitelly_tts",name:"Hi,Telly",model:"WakeNet9"},{id:"wn9_xiaobinxiaobin_tts",name:"小滨小滨",model:"WakeNet9"},{id:"wn9_haixiaowu_tts",name:"Hi,小巫",model:"WakeNet9"},{id:"wn9_xiaoyaxiaoya_tts2",name:"小鸭小鸭",model:"WakeNet9"},{id:"wn9_linaiban_tts2",name:"璃奈板",model:"WakeNet9"},{id:"wn9_xiaosurou_tts2",name:"小酥肉",model:"WakeNet9"},{id:"wn9_xiaoyutongxue_tts2",name:"小宇同学",model:"WakeNet9"},{id:"wn9_xiaomingtongxue_tts2",name:"小明同学",model:"WakeNet9"},{id:"wn9_xiaokangtongxue_tts2",name:"小康同学",model:"WakeNet9"},{id:"wn9_xiaojianxiaojian_tts2",name:"小箭小箭",model:"WakeNet9"},{id:"wn9_xiaotexiaote_tts2",name:"小特小特",model:"WakeNet9"},{id:"wn9_nihaoxiaoyi_tts2",name:"你好小益",model:"WakeNet9"},{id:"wn9_nihaobaiying_tts2",name:"你好百应",model:"WakeNet9"},{id:"wn9_xiaoluxiaolu_tts2",name:"小鹿小鹿",model:"WakeNet9"},{id:"wn9_nihaodongdong_tts2",name:"你好东东",model:"WakeNet9"},{id:"wn9_nihaoxiaoan_tts2",name:"你好小安",model:"WakeNet9"},{id:"wn9_ni3hao3xiao3mai4_tts2",name:"你好小脉",model:"WakeNet9"},{id:"wn9_ni3hao3xiao3rui4_tts3",name:"你好小瑞",model:"WakeNet9"},{id:"wn9_hai1xiao3ou1_tts3",name:"嗨小欧",model:"WakeNet9"}],r=hA(()=>{const E=i.chipModel.toLowerCase();return E==="esp32s3"||E==="esp32p4"}),g=hA(()=>{const E=i.chipModel.toLowerCase();return E==="esp32c3"||E==="esp32c5"||E==="esp32c6"}),s=hA(()=>i.chipModel.toLowerCase()==="esp32s3"),a=hA(()=>r.value||g.value),I=hA(()=>r.value?n.filter(E=>E.model==="WakeNet9"):g.value?n.filter(E=>E.model==="WakeNet9s"):[]),l=EA({name:"",command:"",threshold:20,duration:3e3,model:"mn6_cn"}),C=EA({name:"",command:"",duration:""}),Q=()=>{let E=!0;return C.value={name:"",command:"",duration:""},l.value.name.trim()||(C.value.name=t("wakewordConfig.errors.nameRequired"),E=!1),l.value.command.trim()?l.value.model.includes("_en")&&/[!,.?]/.test(l.value.command)&&(C.value.command=t("wakewordConfig.errors.noPunctuation"),E=!1):(C.value.command=t("wakewordConfig.errors.commandRequired"),E=!1),(!l.value.duration||l.value.duration<500||l.value.duration>1e4)&&(C.value.duration=t("wakewordConfig.errors.durationRange"),E=!1),E},h=EA(!1),f=E=>{var D;o("update:modelValue",{...i.modelValue,type:E,preset:E==="preset"&&(i.modelValue.preset||((D=I.value[0])==null?void 0:D.id))||"",custom:{...i.modelValue.custom,...l.value}})},u=E=>{o("update:modelValue",{...i.modelValue,preset:E})};return ae(l,E=>{h.value||i.modelValue.type==="custom"&&(Q(),o("update:modelValue",{...i.modelValue,custom:{...E}}))},{deep:!0}),ae(()=>i.modelValue.custom,E=>{E&&(h.value=!0,l.value={name:E.name||"",command:E.command||"",threshold:E.threshold!==void 0?E.threshold:20,duration:E.duration!==void 0?E.duration:3e3,model:E.model||"mn6_cn"},uo(()=>{h.value=!1}))},{deep:!0,immediate:!0}),(E,D)=>(T(),K("div",Wd,[B("div",null,[B("h3",qd,F(E.$t("wakewordConfig.title")),1),B("p",jd,F(E.$t("wakewordConfig.description")),1)]),a.value?(T(),K("div",$d,[B("div",A0,[B("button",{onClick:D[0]||(D[0]=c=>f("none")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="none"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},F(E.$t("wakewordConfig.noWakeword")),3),B("button",{onClick:D[1]||(D[1]=c=>f("preset")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="preset"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},F(E.$t("wakewordConfig.presetWakeword")),3),s.value?(T(),K("button",{key:0,onClick:D[2]||(D[2]=c=>f("custom")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="custom"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},F(E.$t("wakewordConfig.customWakeword")),3)):sA("",!0)]),A.modelValue.type==="preset"?(T(),K("div",e0,[B("label",t0,F(E.$t("wakewordConfig.selectWakeword")),1),B("div",i0,[B("select",{value:A.modelValue.preset,onChange:D[3]||(D[3]=c=>u(c.target.value)),class:"w-full border border-gray-300 rounded-md px-3 py-2 pr-10 bg-white focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"},[(T(!0),K(qA,null,Ke(I.value,c=>(T(),K("option",{key:c.id,value:c.id},F(c.name)+" ("+F(c.model)+") ",9,n0))),128))],40,o0)])])):sA("",!0),A.modelValue.type==="custom"?(T(),K("div",r0,[B("h4",g0,F(E.$t("wakewordConfig.customSettings")),1),B("div",s0,[B("div",null,[B("label",a0,[gt(F(E.$t("wakewordConfig.wakewordName"))+" ",1),D[9]||(D[9]=B("span",{class:"text-red-500"},"*",-1))]),ZA(B("input",{type:"text","onUpdate:modelValue":D[4]||(D[4]=c=>l.value.name=c),placeholder:E.$t("wakewordConfig.wakewordNamePlaceholder"),class:kA(["w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500",{"border-red-500":C.value.name}])},null,10,I0),[[te,l.value.name]]),C.value.name?(T(),K("p",C0,F(C.value.name),1)):sA("",!0)]),B("div",null,[B("label",l0,[gt(F(E.$t("wakewordConfig.wakewordCommand"))+" ",1),D[10]||(D[10]=B("span",{class:"text-red-500"},"*",-1))]),ZA(B("input",{type:"text","onUpdate:modelValue":D[5]||(D[5]=c=>l.value.command=c),placeholder:l.value.model.includes("_cn")?E.$t("wakewordConfig.wakewordCommandPlaceholderCN"):E.$t("wakewordConfig.wakewordCommandPlaceholderEN"),class:kA(["w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500",{"border-red-500":C.value.command}])},null,10,B0),[[te,l.value.command]]),C.value.command?(T(),K("p",Q0,F(C.value.command),1)):sA("",!0)])]),B("div",c0,[B("div",null,[B("label",E0,F(E.$t("wakewordConfig.threshold")),1),B("div",u0,[ZA(B("input",{type:"range","onUpdate:modelValue":D[6]||(D[6]=c=>l.value.threshold=c),min:"0",max:"100",step:"1",class:"flex-1"},null,512),[[te,l.value.threshold,void 0,{number:!0}]]),B("span",h0,F(l.value.threshold),1)]),B("p",f0,F(E.$t("wakewordConfig.thresholdDesc")),1)]),B("div",null,[B("label",d0,F(E.$t("wakewordConfig.duration"))+" (ms) ",1),ZA(B("input",{type:"number","onUpdate:modelValue":D[7]||(D[7]=c=>l.value.duration=c),min:"500",max:"10000",step:"100",class:kA(["w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500",{"border-red-500":C.value.duration}])},null,2),[[te,l.value.duration,void 0,{number:!0}]]),C.value.duration?(T(),K("p",p0,F(C.value.duration),1)):sA("",!0)]),B("div",null,[B("label",m0,F(E.$t("wakewordConfig.selectModel")),1),ZA(B("select",{"onUpdate:modelValue":D[8]||(D[8]=c=>l.value.model=c),class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500"},[B("option",y0,F(E.$t("wakewordConfig.mn6cn")),1),B("option",w0,F(E.$t("wakewordConfig.mn6en")),1)],512),[[dr,l.value.model]])])])])):sA("",!0),B("div",D0,[B("div",k0,[B("strong",null,F(E.$t("wakewordConfig.tips.tipLabel")),1),B("ul",v0,[B("li",null,F(E.$t("wakewordConfig.tips.optional")),1),g.value?(T(),K("li",F0,F(E.$t("wakewordConfig.tips.wakeNet9sOnly")),1)):r.value?(T(),K("li",S0,F(E.$t("wakewordConfig.tips.wakeNet9Full")),1)):sA("",!0),s.value?(T(),K("li",R0,F(E.$t("wakewordConfig.tips.customSupport")),1)):sA("",!0)])])])])):(T(),K("div",Zd,[B("div",Xd,[B("strong",null,F(E.$t("wakewordConfig.notice")),1),B("p",zd,F(E.$t("wakewordConfig.unsupportedMessage",{chipModel:A.chipModel})),1)])]))]))}};class N0{constructor(){this.dbName="XiaozhiConfigDB",this.version=1,this.db=null,this.initialized=!1}async initialize(){if(!(this.initialized&&this.db))return new Promise((e,t)=>{const i=indexedDB.open(this.dbName,this.version);i.onerror=()=>{console.error("IndexedDB 初始化失败:",i.error),t(i.error)},i.onsuccess=()=>{this.db=i.result,this.initialized=!0,console.log("IndexedDB 初始化成功"),e()},i.onupgradeneeded=o=>{const n=o.target.result;if(n.objectStoreNames.contains("configs")||n.createObjectStore("configs",{keyPath:"key"}).createIndex("timestamp","timestamp",{unique:!1}),!n.objectStoreNames.contains("files")){const r=n.createObjectStore("files",{keyPath:"id"});r.createIndex("type","type",{unique:!1}),r.createIndex("timestamp","timestamp",{unique:!1})}if(!n.objectStoreNames.contains("temp_data")){const r=n.createObjectStore("temp_data",{keyPath:"key"});r.createIndex("type","type",{unique:!1}),r.createIndex("timestamp","timestamp",{unique:!1})}console.log("IndexedDB 表结构创建完成")}})}async saveConfig(e){this.initialized||await this.initialize();const i={key:"current_config",config:this.sanitizeConfigForStorage(e),timestamp:Date.now()};return new Promise((o,n)=>{const s=this.db.transaction(["configs"],"readwrite").objectStore("configs").put(i);s.onerror=()=>{console.error("保存配置失败:",s.error),n(s.error)},s.onsuccess=()=>{console.log("配置已保存到 IndexedDB"),o()}})}sanitizeConfigForStorage(e){var i,o,n,r,g,s,a,I,l,C;const t=JSON.parse(JSON.stringify(e||{}));try{if((o=(i=t==null?void 0:t.theme)==null?void 0:i.font)!=null&&o.custom&&(t.theme.font.custom.file=null),((r=(n=t==null?void 0:t.theme)==null?void 0:n.emoji)==null?void 0:r.type)==="custom"){t.theme.emoji.custom||(t.theme.emoji.custom={});const Q=((s=(g=t.theme.emoji)==null?void 0:g.custom)==null?void 0:s.images)||{},h={};if(Object.keys(Q).forEach(f=>{h[f]=null}),t.theme.emoji.custom.images=h,t.theme.emoji.custom.emotionMap,t.theme.emoji.custom.fileMap){const f=t.theme.emoji.custom.fileMap,u={};Object.keys(f).forEach(E=>{u[E]=null}),t.theme.emoji.custom.fileMap=u}}(I=(a=t==null?void 0:t.theme)==null?void 0:a.skin)!=null&&I.light&&(t.theme.skin.light.backgroundImage=null),(C=(l=t==null?void 0:t.theme)==null?void 0:l.skin)!=null&&C.dark&&(t.theme.skin.dark.backgroundImage=null)}catch{}return t}async loadConfig(){return this.initialized||await this.initialize(),new Promise((e,t)=>{const n=this.db.transaction(["configs"],"readonly").objectStore("configs").get("current_config");n.onerror=()=>{console.error("加载配置失败:",n.error),t(n.error)},n.onsuccess=()=>{const r=n.result;r?(console.log("从 IndexedDB 恢复配置成功"),e({config:r.config,timestamp:r.timestamp})):e(null)}})}async saveFile(e,t,i,o={}){this.initialized||await this.initialize();const n=await this.fileToArrayBuffer(t);let r={};try{r=o?JSON.parse(JSON.stringify(o)):{}}catch{r={...o}}const g={id:e,type:i,name:t.name,size:t.size,mimeType:t.type,lastModified:t.lastModified,data:n,metadata:r,timestamp:Date.now()};return new Promise((s,a)=>{const C=this.db.transaction(["files"],"readwrite").objectStore("files").put(g);C.onerror=()=>{console.error("保存文件失败:",C.error),a(C.error)},C.onsuccess=()=>{console.log(`文件 ${t.name} 已保存到 IndexedDB`),s()}})}async loadFile(e){return this.initialized||await this.initialize(),new Promise((t,i)=>{const r=this.db.transaction(["files"],"readonly").objectStore("files").get(e);r.onerror=()=>{console.error("加载文件失败:",r.error),i(r.error)},r.onsuccess=()=>{const g=r.result;if(g){const s=new Blob([g.data],{type:g.mimeType}),a=new File([s],g.name,{type:g.mimeType,lastModified:g.lastModified});a.storedId=g.id,a.storedType=g.type,a.storedMetadata=g.metadata,a.storedTimestamp=g.timestamp,console.log(`文件 ${g.name} 从 IndexedDB 恢复成功`),t(a)}else t(null)}})}async getFilesByType(e){return this.initialized||await this.initialize(),new Promise((t,i)=>{const g=this.db.transaction(["files"],"readonly").objectStore("files").index("type").getAll(e);g.onerror=()=>{console.error("获取文件列表失败:",g.error),i(g.error)},g.onsuccess=()=>{const a=(g.result||[]).map(I=>{const l=new Blob([I.data],{type:I.mimeType}),C=new File([l],I.name,{type:I.mimeType,lastModified:I.lastModified});return C.storedId=I.id,C.storedType=I.type,C.storedMetadata=I.metadata,C.storedTimestamp=I.timestamp,C});t(a)}})}async saveTempData(e,t,i,o={}){this.initialized||await this.initialize();const n={key:e,type:i,data:t,metadata:o,timestamp:Date.now()};return new Promise((r,g)=>{const I=this.db.transaction(["temp_data"],"readwrite").objectStore("temp_data").put(n);I.onerror=()=>{console.error("保存临时数据失败:",I.error),g(I.error)},I.onsuccess=()=>{console.log(`临时数据 ${e} 已保存`),r()}})}async loadTempData(e){return this.initialized||await this.initialize(),new Promise((t,i)=>{const r=this.db.transaction(["temp_data"],"readonly").objectStore("temp_data").get(e);r.onerror=()=>{console.error("加载临时数据失败:",r.error),i(r.error)},r.onsuccess=()=>{const g=r.result;t(g||null)}})}async clearAll(){this.initialized||await this.initialize();const e=["configs","files","temp_data"];return new Promise((t,i)=>{const o=this.db.transaction(e,"readwrite");let n=0,r=!1;const g=()=>{n++,n===e.length&&(r?i(new Error("清空部分数据时出现错误")):(console.log("所有存储数据已清空"),t()))};e.forEach(s=>{const I=o.objectStore(s).clear();I.onerror=()=>{console.error(`清空 ${s} 失败:`,I.error),r=!0,g()},I.onsuccess=()=>{console.log(`${s} 已清空`),g()}})})}async deleteFile(e){return this.initialized||await this.initialize(),new Promise((t,i)=>{const r=this.db.transaction(["files"],"readwrite").objectStore("files").delete(e);r.onerror=()=>{console.error("删除文件失败:",r.error),i(r.error)},r.onsuccess=()=>{console.log(`文件 ${e} 已删除`),t()}})}async getStorageInfo(){this.initialized||await this.initialize();const e=["configs","files","temp_data"],t={};for(const o of e){const n=await new Promise((r,g)=>{const I=this.db.transaction([o],"readonly").objectStore(o).count();I.onerror=()=>g(I.error),I.onsuccess=()=>r(I.result)});t[o]={count:n}}const i=await this.loadConfig();return t.lastSaved=i?new Date(i.timestamp):null,t}async hasStoredConfig(){try{return await this.loadConfig()!==null}catch(e){return console.error("检查存储配置时出错:",e),!1}}fileToArrayBuffer(e){return new Promise((t,i)=>{const o=new FileReader;o.onload=()=>t(o.result),o.onerror=()=>i(new Error("读取文件失败")),o.readAsArrayBuffer(e)})}close(){this.db&&(this.db.close(),this.db=null,this.initialized=!1,console.log("IndexedDB 连接已关闭"))}}const Qe=new N0;class si{static async saveFontFile(e,t={}){if(e){const i="custom_font";try{await Qe.saveFile(i,e,"font",{size:t.size||20,bpp:t.bpp||4,charset:t.charset||"deepseek"}),console.log(`字体文件已保存: ${e.name}`)}catch(o){console.warn(`保存字体文件失败: ${e.name}`,o)}}}static async saveEmojiFile(e,t,i={}){var o,n;if(t&&e){const r=e.startsWith("hash_")?e:`emoji_${e}`;try{const g=((o=i==null?void 0:i.size)==null?void 0:o.width)??64,s=((n=i==null?void 0:i.size)==null?void 0:n.height)??64;await Qe.saveFile(r,t,"emoji",{name:e,size:{width:g,height:s},format:i==null?void 0:i.format,emotions:i==null?void 0:i.emotions}),console.log(`表情文件已保存: ${r} - ${t.name}`)}catch(g){console.warn(`保存表情文件失败: ${e}`,g)}}}static async saveBackgroundFile(e,t,i={}){if(t&&e){const o=`background_${e}`;try{let n={};try{n=i?JSON.parse(JSON.stringify(i)):{}}catch{n={...i}}await Qe.saveFile(o,t,"background",{mode:e,...n}),console.log(`背景文件已保存: ${e} - ${t.name}`)}catch(n){console.warn(`保存背景文件失败: ${e}`,n)}}}static async restoreFontFile(){try{return await Qe.loadFile("custom_font")}catch(e){return console.warn("恢复字体文件失败:",e),null}}static async restoreEmojiFile(e){if(!e)return null;try{const t=e.startsWith("hash_")?e:`emoji_${e}`;return await Qe.loadFile(t)}catch(t){return console.warn(`恢复表情文件失败: ${e}`,t),null}}static async restoreBackgroundFile(e){if(!e)return null;try{const t=`background_${e}`;return await Qe.loadFile(t)}catch(t){return console.warn(`恢复背景文件失败: ${e}`,t),null}}static async deleteFontFile(){try{await Qe.deleteFile("custom_font"),console.log("字体文件已删除")}catch(e){console.warn("删除字体文件失败:",e)}}static async deleteEmojiFile(e){if(e)try{const t=e.startsWith("hash_")?e:`emoji_${e}`;await Qe.deleteFile(t),console.log(`表情文件已删除: ${t}`)}catch(t){console.warn(`删除表情文件失败: ${e}`,t)}}static async deleteBackgroundFile(e){if(e)try{const t=`background_${e}`;await Qe.deleteFile(t),console.log(`背景文件已删除: ${e}`)}catch(t){console.warn(`删除背景文件失败: ${e}`,t)}}static async getStorageInfo(){try{return await Qe.getStorageInfo()}catch(e){return console.warn("获取存储信息失败:",e),{configs:{count:0},files:{count:0},temp_data:{count:0},lastSaved:null}}}static async clearAllFiles(){try{await Qe.clearAll(),console.log("所有存储文件已清理")}catch(e){throw console.warn("清理存储文件失败:",e),e}}}const G0={class:"space-y-6"},L0={class:"text-lg font-medium text-gray-900 mb-2"},U0={class:"text-gray-600"},M0={class:"space-y-4"},x0={class:"flex space-x-4"},J0={key:0,class:"space-y-4"},T0={class:"bg-gray-50 border border-gray-200 rounded-lg p-6 text-center"},H0={class:"mt-2 text-gray-600"},Y0={key:1,class:"space-y-4"},_0={class:"font-medium text-gray-900"},K0={class:"grid grid-cols-1 md:grid-cols-4 gap-4"},O0=["onClick"],P0={class:"flex items-start justify-between"},V0={class:"flex-1"},W0={class:"font-medium text-gray-900 mb-1"},q0={class:"text-sm text-gray-600 space-y-1"},j0={key:0,class:"flex-shrink-0 ml-3"},Z0={key:2,class:"space-y-6"},X0={class:"font-medium text-gray-900"},z0={class:"space-y-2"},$0={class:"block text-sm font-medium text-gray-700"},Ap={key:0},ep={class:"mt-2"},tp={class:"text-gray-500"},ip={class:"text-xs text-gray-400 mt-1"},op={key:1,class:"text-green-600"},np={class:"mt-1 font-medium"},rp={key:0,class:"grid grid-cols-1 md:grid-cols-3 gap-4"},gp={class:"block text-sm font-medium text-gray-700 mb-2"},sp={class:"text-xs text-gray-500 mt-1"},ap={class:"block text-sm font-medium text-gray-700 mb-2"},Ip={value:1},Cp={value:2},lp={value:4},Bp={class:"block text-sm font-medium text-gray-700 mb-2"},Qp={value:"qwen"},cp={value:"deepseek"},Ep={value:"gb2312"},up={value:"latin"},hp={value:"full"},fp={class:"flex items-center justify-between p-4 bg-gray-50 rounded-lg border border-gray-200"},dp={class:"flex-1"},pp={class:"font-medium text-gray-900"},mp={class:"text-sm text-gray-500 mt-1"},yp={class:"ml-4"},wp={class:"relative inline-flex items-center cursor-pointer"},Dp=["checked"],kp={__name:"FontConfig",props:{modelValue:{type:Object,required:!0}},emits:["update:modelValue"],setup(A,{emit:e}){const{t}=ve(),i=A,o=e,n=EA(null),r=[{id:"font_puhui_deepseek_14_1",size:14,bpp:1,fileSize:"~180KB"},{id:"font_puhui_deepseek_16_4",size:16,bpp:4,fileSize:"~720KB"},{id:"font_puhui_deepseek_20_4",size:20,bpp:4,fileSize:"~1.1MB"},{id:"font_puhui_deepseek_30_4",size:30,bpp:4,fileSize:"~2.5MB"},{id:"font_noto_qwen_14_1",size:14,bpp:1,fileSize:"~626KB"},{id:"font_noto_qwen_16_4",size:16,bpp:4,fileSize:"~2.0MB"},{id:"font_noto_qwen_20_4",size:20,bpp:4,fileSize:"~2.9MB"},{id:"font_noto_qwen_30_4",size:30,bpp:4,fileSize:"~5.8MB"}],g=hA(()=>r.map(u=>{let E;return u.id.startsWith("font_puhui_deepseek_")?E=t("fontConfig.charsetDeepseek"):u.id.startsWith("font_noto_qwen_")&&(E=t("fontConfig.charsetQwen")),{...u,name:t("fontConfig.presetFontNames."+u.id),charset:E}})),s=EA({size:20,bpp:4,charset:"qwen"}),a=u=>{o("update:modelValue",{...i.modelValue,type:u,preset:u==="preset"?i.modelValue.preset||"font_puhui_deepseek_20_4":"",custom:{...i.modelValue.custom,file:i.modelValue.custom.file||null}})},I=u=>{o("update:modelValue",{...i.modelValue,preset:u,custom:{...i.modelValue.custom,file:i.modelValue.custom.file||null}})},l=u=>{const E=u.target.files[0];E&&Q(E)},C=u=>{u.preventDefault();const E=u.dataTransfer.files;E.length>0&&Q(E[0])},Q=async u=>{u&&(u.type.includes("font")||u.name.toLowerCase().match(/\.(ttf|woff|woff2)$/))?(o("update:modelValue",{...i.modelValue,custom:{...i.modelValue.custom,file:u,...s.value}}),await si.saveFontFile(u,s.value)):alert(t("fontConfig.selectValidFontFile"))},h=async()=>{o("update:modelValue",{...i.modelValue,custom:{...i.modelValue.custom,file:null}}),n.value&&(n.value.value=""),await si.deleteFontFile()},f=EA(!1);return ae(()=>s.value,u=>{f.value||i.modelValue.type==="custom"&&i.modelValue.custom.file&&o("update:modelValue",{...i.modelValue,custom:{...i.modelValue.custom,...u}})},{deep:!0}),ae(()=>i.modelValue.custom,u=>{u.size&&u.bpp&&u.charset&&(f.value=!0,s.value={size:u.size,bpp:u.bpp,charset:u.charset},uo(()=>{f.value=!1}))},{deep:!0,immediate:!0}),(u,E)=>{var D;return T(),K("div",G0,[B("div",null,[B("h3",L0,F(u.$t("fontConfig.title")),1),B("p",U0,F(u.$t("fontConfig.description")),1)]),B("div",M0,[B("div",x0,[B("button",{onClick:E[0]||(E[0]=c=>a("none")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="none"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},F(u.$t("fontConfig.noFonts")),3),B("button",{onClick:E[1]||(E[1]=c=>a("preset")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="preset"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},F(u.$t("fontConfig.presetFonts")),3),B("button",{onClick:E[2]||(E[2]=c=>a("custom")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="custom"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},F(u.$t("fontConfig.customFonts")),3)])]),A.modelValue.type==="none"?(T(),K("div",J0,[B("div",T0,[E[10]||(E[10]=B("svg",{class:"mx-auto h-12 w-12 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)),B("p",H0,F(u.$t("fontConfig.noFontsDescription")),1)])])):sA("",!0),A.modelValue.type==="preset"?(T(),K("div",Y0,[B("h4",_0,F(u.$t("fontConfig.presetFonts")),1),B("div",K0,[(T(!0),K(qA,null,Ke(g.value,c=>(T(),K("div",{key:c.id,onClick:d=>I(c.id),class:kA(["border-2 rounded-lg p-4 cursor-pointer transition-all",A.modelValue.preset===c.id?"border-primary-500 bg-primary-50":"border-gray-200 hover:border-gray-300"])},[B("div",P0,[B("div",V0,[B("h5",W0,F(c.name),1),B("div",q0,[B("div",null,F(u.$t("fontConfig.fontSize"))+" "+F(c.size)+"px",1),B("div",null,F(u.$t("fontConfig.bitDepth"))+" "+F(c.bpp)+"bpp",1),B("div",null,F(u.$t("fontConfig.charset"))+" "+F(c.charset),1),B("div",null,F(u.$t("fontConfig.fileSize"))+" "+F(c.fileSize),1)])]),A.modelValue.preset===c.id?(T(),K("div",j0,[...E[11]||(E[11]=[B("div",{class:"w-5 h-5 bg-primary-500 rounded-full flex items-center justify-center"},[B("svg",{class:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})])],-1)])])):sA("",!0)])],10,O0))),128))])])):sA("",!0),A.modelValue.type==="custom"?(T(),K("div",Z0,[B("h4",X0,F(u.$t("fontConfig.customFonts")),1),B("div",z0,[B("label",$0,F(u.$t("fontConfig.fontFile")),1),B("div",{onDrop:C,onDragover:E[4]||(E[4]=dt(()=>{},["prevent"])),onDragenter:E[5]||(E[5]=dt(()=>{},["prevent"])),class:"border-2 border-dashed border-gray-300 rounded-lg p-6 text-center hover:border-gray-400 transition-colors"},[B("input",{ref_key:"fileInput",ref:n,type:"file",accept:".ttf,.woff,.woff2",onChange:l,class:"hidden"},null,544),A.modelValue.custom.file?(T(),K("div",op,[E[13]||(E[13]=B("svg",{class:"mx-auto h-8 w-8",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z","clip-rule":"evenodd"})],-1)),B("p",np,F((D=A.modelValue.custom.file)==null?void 0:D.name),1),B("button",{onClick:h,class:"text-red-600 hover:text-red-500 text-sm mt-1"},F(u.$t("fontConfig.removeFile")),1)])):(T(),K("div",Ap,[E[12]||(E[12]=B("svg",{class:"mx-auto h-12 w-12 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})],-1)),B("div",ep,[B("button",{onClick:E[3]||(E[3]=c=>u.$refs.fileInput.click()),class:"text-primary-600 hover:text-primary-500 font-medium"},F(u.$t("fontConfig.clickSelectFontFile")),1),B("p",tp,F(u.$t("fontConfig.orDragFileHere")),1)]),B("p",ip,F(u.$t("fontConfig.supportedFormats")),1)]))],32)]),A.modelValue.custom.file?(T(),K("div",rp,[B("div",null,[B("label",gp,F(u.$t("fontConfig.fontSizePx")),1),ZA(B("input",{type:"number","onUpdate:modelValue":E[6]||(E[6]=c=>s.value.size=c),min:"8",max:"80",class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"},null,512),[[te,s.value.size,void 0,{number:!0}]]),B("p",sp,F(u.$t("fontConfig.range"))+" 8-80px",1)]),B("div",null,[B("label",ap,F(u.$t("fontConfig.bitDepthBpp")),1),ZA(B("select",{"onUpdate:modelValue":E[7]||(E[7]=c=>s.value.bpp=c),class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"},[B("option",Ip,F(u.$t("fontConfig.monochrome")),1),B("option",Cp,F(u.$t("fontConfig.fourColors")),1),B("option",lp,F(u.$t("fontConfig.sixteenColors")),1)],512),[[dr,s.value.bpp]])]),B("div",null,[B("label",Bp,F(u.$t("fontConfig.characterSet")),1),ZA(B("select",{"onUpdate:modelValue":E[8]||(E[8]=c=>s.value.charset=c),class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"},[B("option",Qp,F(u.$t("fontConfig.qwen18409")),1),B("option",cp,F(u.$t("fontConfig.deepseekR1")),1),B("option",Ep,F(u.$t("fontConfig.gb2312")),1),B("option",up,F(u.$t("fontConfig.latin1")),1),B("option",hp,F(u.$t("fontConfig.fullCharset")),1)],512),[[dr,s.value.charset]])])])):sA("",!0)])):sA("",!0),B("div",fp,[B("div",dp,[B("h4",pp,F(u.$t("fontConfig.hideSubtitle")),1),B("p",mp,F(u.$t("fontConfig.hideSubtitleDescription")),1)]),B("div",yp,[B("label",wp,[B("input",{type:"checkbox",checked:A.modelValue.hide_subtitle,onChange:E[9]||(E[9]=c=>o("update:modelValue",{...A.modelValue,hide_subtitle:c.target.checked})),class:"sr-only peer"},null,40,Dp),E[14]||(E[14]=B("div",{class:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-primary-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-primary-500"},null,-1))])])])])}}},vp={class:"space-y-6"},Fp={class:"text-lg font-medium text-gray-900 mb-2"},Sp={class:"text-gray-600"},Rp={class:"space-y-4"},bp={class:"flex flex-wrap gap-3"},Np={key:0,class:"text-sm text-gray-500"},Gp={key:0,class:"space-y-4"},Lp={class:"font-medium text-gray-900"},Up={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},Mp=["onClick"],xp={class:"flex items-start justify-between mb-3"},Jp={class:"font-medium text-gray-900"},Tp={class:"text-sm text-gray-600"},Hp={class:"text-xs text-gray-500 mt-1"},Yp={key:0,class:"flex-shrink-0 ml-3"},_p={class:"grid grid-cols-7 gap-1 justify-items-center"},Kp=["src","alt"],Op={key:1,class:"space-y-6"},Pp={class:"font-medium text-gray-900"},Vp={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},Wp={class:"block text-sm font-medium text-gray-700 mb-2"},qp={class:"block text-sm font-medium text-gray-700 mb-2"},jp={class:"space-y-4"},Zp={class:"font-medium text-gray-900"},Xp={class:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-7 gap-4"},zp={class:"text-center"},$p={class:"text-lg mb-1"},Am={class:"text-xs text-gray-600 flex items-center justify-center gap-1"},em={key:0,class:"text-red-500"},tm=["onDrop"],im=["onChange"],om=["onClick"],nm={class:"text-xs text-gray-500"},rm={key:1,class:"w-full h-full relative"},gm=["src","alt"],sm=["onClick"],am={class:"text-xs text-gray-500 mt-2"},Im={__name:"EmojiConfig",props:{modelValue:{type:Object,required:!0}},emits:["update:modelValue"],setup(A,{emit:e}){const{t}=ve(),i=A,o=e,n=async c=>{var p;const d=await c.arrayBuffer();if((p=crypto==null?void 0:crypto.subtle)!=null&&p.digest)try{const v=await crypto.subtle.digest("SHA-256",d);return Array.from(new Uint8Array(v)).map(G=>G.toString(16).padStart(2,"0")).join("")}catch(v){console.warn("使用 crypto.subtle.digest 失败,回退到自定义哈希函数:",v)}return r(d)},r=c=>{const d=new Uint8Array(c);let p=2166136261,v=16777619;for(let H=0;H>>0).toString(16).padStart(8,"0")},g=[{id:"twemoji32",name:t("emojiConfig.twitterEmojiName",{size:32}),description:t("emojiConfig.twitterEmojiDescription",{size:32}),size:32,preview:["neutral","happy","laughing","funny","sad","angry","crying"]},{id:"twemoji64",name:t("emojiConfig.twitterEmojiName",{size:64}),description:t("emojiConfig.twitterEmojiDescription",{size:64}),size:64,preview:["neutral","happy","laughing","funny","sad","angry","crying"]}],s=hA(()=>[{key:"neutral",name:t("emojiConfig.emotions.neutral"),emoji:"😶"},{key:"happy",name:t("emojiConfig.emotions.happy"),emoji:"🙂"},{key:"laughing",name:t("emojiConfig.emotions.laughing"),emoji:"😆"},{key:"funny",name:t("emojiConfig.emotions.funny"),emoji:"😂"},{key:"sad",name:t("emojiConfig.emotions.sad"),emoji:"😔"},{key:"angry",name:t("emojiConfig.emotions.angry"),emoji:"😠"},{key:"crying",name:t("emojiConfig.emotions.crying"),emoji:"😭"},{key:"loving",name:t("emojiConfig.emotions.loving"),emoji:"😍"},{key:"embarrassed",name:t("emojiConfig.emotions.embarrassed"),emoji:"😳"},{key:"surprised",name:t("emojiConfig.emotions.surprised"),emoji:"😯"},{key:"shocked",name:t("emojiConfig.emotions.shocked"),emoji:"😱"},{key:"thinking",name:t("emojiConfig.emotions.thinking"),emoji:"🤔"},{key:"winking",name:t("emojiConfig.emotions.winking"),emoji:"😉"},{key:"cool",name:t("emojiConfig.emotions.cool"),emoji:"😎"},{key:"relaxed",name:t("emojiConfig.emotions.relaxed"),emoji:"😌"},{key:"delicious",name:t("emojiConfig.emotions.delicious"),emoji:"🤤"},{key:"kissy",name:t("emojiConfig.emotions.kissy"),emoji:"😘"},{key:"confident",name:t("emojiConfig.emotions.confident"),emoji:"😏"},{key:"sleepy",name:t("emojiConfig.emotions.sleepy"),emoji:"😴"},{key:"silly",name:t("emojiConfig.emotions.silly"),emoji:"😜"},{key:"confused",name:t("emojiConfig.emotions.confused"),emoji:"🙄"}]),a=EA({size:{width:32,height:32}}),I=c=>{if(i.modelValue.type===c)return;const d={...i.modelValue,type:c};c==="none"?(d.preset="",d.custom={...i.modelValue.custom,images:i.modelValue.custom.images||{}}):c==="preset"?(d.preset=i.modelValue.preset||"twemoji32",d.custom={...i.modelValue.custom,images:i.modelValue.custom.images||{}}):c==="custom"&&(d.preset="",d.custom={...i.modelValue.custom,images:i.modelValue.custom.images||{}}),o("update:modelValue",d)},l=c=>{i.modelValue.preset!==c&&o("update:modelValue",{...i.modelValue,preset:c,custom:{...i.modelValue.custom,images:i.modelValue.custom.images||{}}})},C=(c,d)=>{const p=c.target.files[0];p&&h(d,p)},Q=(c,d)=>{c.preventDefault();const p=c.dataTransfer.files;p.length>0&&h(d,p[0])},h=async(c,d)=>{const p=["png","gif"],v=d.name.split(".").pop().toLowerCase();if(!p.includes(v)){alert(t("emojiConfig.selectValidFormat"));return}const N=await n(d),G=i.modelValue.custom||{},H={...G.fileMap||{}},S={...G.emotionMap||{}},b={...G.images||{}};let L=[];for(const[QA,dA]of Object.entries(S))dA===N&&QA!==c&&L.push(QA);L.length>0&&console.log(t("emojiConfig.sharedFileMessage",{emotionKey:c,existingEmotions:L.join(", ")})),H[N]=d,S[c]=N,b[c]=d,o("update:modelValue",{...i.modelValue,custom:{...G,size:a.value.size,images:b,fileMap:H,emotionMap:S}}),await si.saveEmojiFile(`hash_${N}`,d,{size:a.value.size,format:v,emotions:[...L,c]})},f=async c=>{const d=i.modelValue.custom||{},p={...d.images},v={...d.emotionMap||{}},N={...d.fileMap||{}},G=v[c];delete p[c],delete v[c],Object.values(v).filter(S=>S===G).length===0&&G?(delete N[G],await si.deleteEmojiFile(`hash_${G}`),console.log(t("emojiConfig.fileDeleted",{fileHash:G}))):console.log(t("emojiConfig.fileRetained",{fileHash:G})),o("update:modelValue",{...i.modelValue,custom:{...d,images:p,emotionMap:v,fileMap:N}})},u=(c,d)=>`./static/twemoji${c==="twemoji64"?"64":"32"}/${d}.png`,E=c=>{if(i.modelValue.type==="preset")return u(i.modelValue.preset,c);{const d=i.modelValue.custom.images[c];return d instanceof File||d instanceof Blob?URL.createObjectURL(d):null}},D=c=>{console.warn(t("emojiConfig.imageLoadFailed"),c.target.src),c.target.style.display="none"};return ae(()=>a.value.size,c=>{if(i.modelValue.type==="custom"){const d=i.modelValue.custom;JSON.stringify(d.size)!==JSON.stringify(c)&&o("update:modelValue",{...i.modelValue,custom:{...d,size:c}})}},{deep:!0}),i.modelValue.custom.size&&(a.value={size:{...i.modelValue.custom.size}}),(c,d)=>(T(),K("div",vp,[B("div",null,[B("h3",Fp,F(c.$t("emojiConfig.title")),1),B("p",Sp,F(c.$t("emojiConfig.description")),1)]),B("div",Rp,[B("div",bp,[B("button",{onClick:d[0]||(d[0]=p=>I("none")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="none"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},F(c.$t("emojiConfig.noEmojiPack")),3),B("button",{onClick:d[1]||(d[1]=p=>I("preset")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="preset"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},F(c.$t("emojiConfig.presetEmojiPack")),3),B("button",{onClick:d[2]||(d[2]=p=>I("custom")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="custom"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},F(c.$t("emojiConfig.customEmojiPack")),3)]),A.modelValue.type==="none"?(T(),K("p",Np,F(c.$t("emojiConfig.noEmojiPackDescription")),1)):sA("",!0)]),A.modelValue.type==="preset"?(T(),K("div",Gp,[B("h4",Lp,F(c.$t("emojiConfig.selectPresetEmojiPack")),1),B("div",Up,[(T(),K(qA,null,Ke(g,p=>B("div",{key:p.id,onClick:v=>l(p.id),class:kA(["border-2 rounded-lg p-4 cursor-pointer transition-all",A.modelValue.preset===p.id?"border-primary-500 bg-primary-50":"border-gray-200 hover:border-gray-300"])},[B("div",xp,[B("div",null,[B("h5",Jp,F(p.name),1),B("p",Tp,F(p.description),1),B("div",Hp,F(c.$t("emojiConfig.size"))+": "+F(p.size)+"px × "+F(p.size)+"px ",1)]),A.modelValue.preset===p.id?(T(),K("div",Yp,[...d[7]||(d[7]=[B("div",{class:"w-5 h-5 bg-primary-500 rounded-full flex items-center justify-center"},[B("svg",{class:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})])],-1)])])):sA("",!0)]),B("div",_p,[(T(!0),K(qA,null,Ke(p.preview,v=>(T(),K("div",{key:v,style:VA({width:p.size+"px",height:p.size+"px"}),class:"bg-gray-100 rounded flex items-center justify-center"},[B("img",{src:u(p.id,v),alt:v,style:VA({width:p.size+"px",height:p.size+"px"}),class:"object-contain rounded",onError:D},null,44,Kp)],4))),128))])],10,Mp)),64))])])):sA("",!0),A.modelValue.type==="custom"?(T(),K("div",Op,[B("h4",Pp,F(c.$t("emojiConfig.customEmojiPackConfig")),1),B("div",Vp,[B("div",null,[B("label",Wp,F(c.$t("emojiConfig.maxImageWidth")),1),ZA(B("input",{type:"number","onUpdate:modelValue":d[3]||(d[3]=p=>a.value.size.width=p),min:"16",max:"200",class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"},null,512),[[te,a.value.size.width,void 0,{number:!0}]])]),B("div",null,[B("label",qp,F(c.$t("emojiConfig.maxImageHeight")),1),ZA(B("input",{type:"number","onUpdate:modelValue":d[4]||(d[4]=p=>a.value.size.height=p),min:"16",max:"200",class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"},null,512),[[te,a.value.size.height,void 0,{number:!0}]])])]),B("div",jp,[B("h5",Zp,F(c.$t("emojiConfig.uploadEmojiImages")),1),B("div",Xp,[(T(!0),K(qA,null,Ke(s.value,p=>(T(),K("div",{key:p.key,class:"space-y-2"},[B("div",zp,[B("div",$p,F(p.emoji),1),B("div",Am,[B("span",null,F(p.name),1),p.key==="neutral"?(T(),K("span",em,F(c.$t("emojiConfig.required")),1)):sA("",!0)])]),B("div",{onDrop:v=>Q(v,p.key),onDragover:d[5]||(d[5]=dt(()=>{},["prevent"])),onDragenter:d[6]||(d[6]=dt(()=>{},["prevent"])),class:kA(["border-2 border-dashed rounded-lg p-2 text-center cursor-pointer transition-colors aspect-square flex flex-col items-center justify-center",A.modelValue.custom.images[p.key]?"border-green-300 bg-green-50":p.key==="neutral"?"border-red-300 bg-red-50":"border-gray-300 hover:border-gray-400"])},[B("input",{ref_for:!0,ref:p.key+"Input",type:"file",accept:".png,.gif",onChange:v=>C(v,p.key),class:"hidden"},null,40,im),A.modelValue.custom.images[p.key]?(T(),K("div",rm,[E(p.key)?(T(),K("img",{key:0,src:E(p.key),alt:p.name,class:"w-full h-full object-cover rounded",onError:D},null,40,gm)):sA("",!0),B("button",{onClick:v=>f(p.key),class:"absolute -top-1 -right-1 w-4 h-4 bg-red-500 text-white rounded-full flex items-center justify-center text-xs hover:bg-red-600"}," × ",8,sm)])):(T(),K("div",{key:0,onClick:v=>{var N;return(N=c.$refs[p.key+"Input"][0])==null?void 0:N.click()}},[d[8]||(d[8]=B("svg",{class:"w-6 h-6 text-gray-400 mx-auto mb-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})],-1)),B("div",nm,F(c.$t("emojiConfig.clickToUploadOrDrag")),1)],8,om))],42,tm)]))),128))]),B("div",am,F(c.$t("emojiConfig.neutralRequiredNotice")),1)])])):sA("",!0)]))}},Cm={class:"space-y-6"},lm={class:"text-lg font-medium text-gray-900 mb-2"},Bm={class:"text-gray-600"},Qm={class:"space-y-4"},cm={class:"font-medium text-gray-900 flex items-center"},Em={class:"border border-gray-200 rounded-lg p-4 space-y-4"},um={class:"flex space-x-4"},hm={key:0,class:"space-y-3"},fm={class:"flex items-center space-x-3"},dm={class:"text-sm font-medium text-gray-700"},pm={class:"flex items-center space-x-2"},mm={class:"flex items-center space-x-3"},ym={class:"text-sm font-medium text-gray-700"},wm={class:"flex items-center space-x-2"},Dm={key:1,class:"space-y-3"},km={class:"text-sm font-medium text-gray-700"},vm={class:"mt-1 text-sm text-gray-600"},Fm={key:1,class:"space-y-2"},Sm=["src"],Rm={class:"text-sm text-green-700 font-medium"},bm={class:"flex items-center space-x-3"},Nm={class:"text-sm font-medium text-gray-700"},Gm={class:"flex items-center space-x-2"},Lm={class:"space-y-4"},Um={class:"font-medium text-gray-900 flex items-center"},Mm={class:"border border-gray-200 rounded-lg p-4 space-y-4"},xm={class:"flex space-x-4"},Jm={key:0,class:"space-y-3"},Tm={class:"flex items-center space-x-3"},Hm={class:"text-sm font-medium text-gray-700"},Ym={class:"flex items-center space-x-2"},_m={class:"flex items-center space-x-3"},Km={class:"text-sm font-medium text-gray-700"},Om={class:"flex items-center space-x-2"},Pm={key:1,class:"space-y-3"},Vm={class:"text-sm font-medium text-gray-700"},Wm={class:"mt-1 text-sm text-gray-600"},qm={key:1,class:"space-y-2"},jm=["src"],Zm={class:"text-sm text-green-700 font-medium"},Xm={class:"flex items-center space-x-3"},zm={class:"text-sm font-medium text-gray-700"},$m={class:"flex items-center space-x-2"},Ay={class:"space-y-4"},ey={class:"font-medium text-gray-900"},ty={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},iy={class:"space-y-2"},oy={class:"text-sm font-medium text-gray-700"},ny={class:"absolute inset-0 bg-white bg-opacity-10 flex items-center justify-center rounded-lg"},ry={class:"space-y-2"},gy={class:"text-sm font-medium text-gray-700"},sy={class:"absolute inset-0 bg-black bg-opacity-10 flex items-center justify-center rounded-lg"},ay={class:"bg-blue-50 border border-blue-200 rounded-lg p-4"},Iy={class:"font-medium text-blue-900 mb-2"},Cy={class:"flex flex-wrap gap-2"},ly={__name:"BackgroundConfig",props:{modelValue:{type:Object,required:!0}},emits:["update:modelValue"],setup(A,{emit:e}){const{t}=ve(),i=A,o=e,n=EA(null),r=EA(null),g=hA({get:()=>i.modelValue.light.backgroundColor,set:S=>Q(S)}),s=hA({get:()=>i.modelValue.dark.backgroundColor,set:S=>h(S)}),a=hA({get:()=>i.modelValue.light.textColor,set:S=>f(S)}),I=hA({get:()=>i.modelValue.dark.textColor,set:S=>u(S)}),l=S=>{o("update:modelValue",{...i.modelValue,light:{...i.modelValue.light,backgroundType:S,backgroundImage:S==="image"?i.modelValue.light.backgroundImage:null}})},C=S=>{o("update:modelValue",{...i.modelValue,dark:{...i.modelValue.dark,backgroundType:S,backgroundImage:S==="image"?i.modelValue.dark.backgroundImage:null}})},Q=S=>{o("update:modelValue",{...i.modelValue,light:{...i.modelValue.light,backgroundColor:S}})},h=S=>{o("update:modelValue",{...i.modelValue,dark:{...i.modelValue.dark,backgroundColor:S}})},f=S=>{o("update:modelValue",{...i.modelValue,light:{...i.modelValue.light,textColor:S}})},u=S=>{o("update:modelValue",{...i.modelValue,dark:{...i.modelValue.dark,textColor:S}})},E=(S,b)=>{const L=S.target.files[0];L&&c(b,L)},D=(S,b)=>{S.preventDefault();const L=S.dataTransfer.files;L.length>0&&c(b,L[0])},c=async(S,b)=>{b&&b.type.startsWith("image/")?(o("update:modelValue",{...i.modelValue,[S]:{...i.modelValue[S],backgroundImage:b}}),await si.saveBackgroundFile(S,b)):alert(t("backgroundConfig.selectValidImage"))},d=async S=>{o("update:modelValue",{...i.modelValue,[S]:{...i.modelValue[S],backgroundImage:null}}),S==="light"&&n.value&&(n.value.value=""),S==="dark"&&r.value&&(r.value.value=""),await si.deleteBackgroundFile(S)},p=S=>{const b=i.modelValue[S].backgroundImage;return b?URL.createObjectURL(b):null},v=()=>i.modelValue.light.backgroundType==="image"&&i.modelValue.light.backgroundImage?{backgroundImage:`url(${p("light")})`,backgroundSize:"cover",backgroundPosition:"center"}:{backgroundColor:i.modelValue.light.backgroundColor},N=()=>i.modelValue.dark.backgroundType==="image"&&i.modelValue.dark.backgroundImage?{backgroundImage:`url(${p("dark")})`,backgroundSize:"cover",backgroundPosition:"center"}:{backgroundColor:i.modelValue.dark.backgroundColor},G=(S,b)=>{const L=H(S)?"#000000":"#ffffff",QA=H(b)?"#000000":"#ffffff";o("update:modelValue",{...i.modelValue,light:{...i.modelValue.light,backgroundType:"color",backgroundColor:S,textColor:L,backgroundImage:null},dark:{...i.modelValue.dark,backgroundType:"color",backgroundColor:b,textColor:QA,backgroundImage:null}})},H=S=>{const b=S.replace("#",""),L=parseInt(b.substr(0,2),16),QA=parseInt(b.substr(2,2),16),dA=parseInt(b.substr(4,2),16);return(L*299+QA*587+dA*114)/1e3>128};return(S,b)=>(T(),K("div",Cm,[B("div",null,[B("h3",lm,F(S.$t("backgroundConfig.title")),1),B("p",Bm,F(S.$t("backgroundConfig.description")),1)]),B("div",Qm,[B("h4",cm,[b[33]||(b[33]=B("svg",{class:"w-5 h-5 mr-2 text-yellow-500",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z","clip-rule":"evenodd"})],-1)),gt(" "+F(S.$t("backgroundConfig.lightMode")),1)]),B("div",Em,[B("div",um,[B("button",{onClick:b[0]||(b[0]=L=>l("color")),class:kA(["px-3 py-2 text-sm border rounded transition-colors",A.modelValue.light.backgroundType==="color"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},F(S.$t("backgroundConfig.solidBackground")),3),B("button",{onClick:b[1]||(b[1]=L=>l("image")),class:kA(["px-3 py-2 text-sm border rounded transition-colors",A.modelValue.light.backgroundType==="image"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},F(S.$t("backgroundConfig.imageBackground")),3)]),A.modelValue.light.backgroundType==="color"?(T(),K("div",hm,[B("div",fm,[B("label",dm,F(S.$t("backgroundConfig.backgroundColor")),1),B("div",pm,[ZA(B("input",{type:"color","onUpdate:modelValue":b[2]||(b[2]=L=>g.value=L),class:"w-10 h-10 border border-gray-300 rounded cursor-pointer"},null,512),[[te,g.value]]),ZA(B("input",{type:"text","onUpdate:modelValue":b[3]||(b[3]=L=>g.value=L),class:"border border-gray-300 rounded px-3 py-2 text-sm font-mono w-24"},null,512),[[te,g.value]])]),B("div",{style:VA({backgroundColor:g.value}),class:"w-16 h-10 border border-gray-300 rounded shadow-inner"},null,4)]),B("div",mm,[B("label",ym,F(S.$t("backgroundConfig.textColor")),1),B("div",wm,[ZA(B("input",{type:"color","onUpdate:modelValue":b[4]||(b[4]=L=>a.value=L),class:"w-10 h-10 border border-gray-300 rounded cursor-pointer"},null,512),[[te,a.value]]),ZA(B("input",{type:"text","onUpdate:modelValue":b[5]||(b[5]=L=>a.value=L),class:"border border-gray-300 rounded px-3 py-2 text-sm font-mono w-24"},null,512),[[te,a.value]])]),B("div",{style:VA({backgroundColor:a.value}),class:"w-16 h-10 border border-gray-300 rounded shadow-inner"},null,4)])])):sA("",!0),A.modelValue.light.backgroundType==="image"?(T(),K("div",Dm,[B("label",km,F(S.$t("backgroundConfig.backgroundImage")),1),B("div",{onDrop:b[9]||(b[9]=L=>D(L,"light")),onDragover:b[10]||(b[10]=dt(()=>{},["prevent"])),onDragenter:b[11]||(b[11]=dt(()=>{},["prevent"])),class:kA(["border-2 border-dashed rounded-lg p-4 text-center cursor-pointer transition-colors",A.modelValue.light.backgroundImage?"border-green-300 bg-green-50":"border-gray-300 hover:border-gray-400"])},[B("input",{ref_key:"lightImageInput",ref:n,type:"file",accept:"image/*",onChange:b[6]||(b[6]=L=>E(L,"light")),class:"hidden"},null,544),A.modelValue.light.backgroundImage?(T(),K("div",Fm,[B("img",{src:p("light"),alt:"{{ $t('backgroundConfig.lightModePreview') }}背景",class:"max-w-32 max-h-32 mx-auto rounded shadow"},null,8,Sm),B("p",Rm,F(A.modelValue.light.backgroundImage.name),1),B("button",{onClick:b[8]||(b[8]=L=>d("light")),class:"text-red-600 hover:text-red-500 text-sm"},F(S.$t("backgroundConfig.removeImage")),1)])):(T(),K("div",{key:0,onClick:b[7]||(b[7]=L=>S.$refs.lightImageInput.click())},[b[34]||(b[34]=B("svg",{class:"mx-auto h-8 w-8 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})],-1)),B("p",vm,F(S.$t("backgroundConfig.clickOrDragToUpload")),1)]))],34),B("div",bm,[B("label",Nm,F(S.$t("backgroundConfig.textColor")),1),B("div",Gm,[ZA(B("input",{type:"color","onUpdate:modelValue":b[12]||(b[12]=L=>a.value=L),class:"w-10 h-10 border border-gray-300 rounded cursor-pointer"},null,512),[[te,a.value]]),ZA(B("input",{type:"text","onUpdate:modelValue":b[13]||(b[13]=L=>a.value=L),class:"border border-gray-300 rounded px-3 py-2 text-sm font-mono w-24"},null,512),[[te,a.value]])]),B("div",{style:VA({backgroundColor:a.value}),class:"w-16 h-10 border border-gray-300 rounded shadow-inner"},null,4)])])):sA("",!0)])]),B("div",Lm,[B("h4",Um,[b[35]||(b[35]=B("svg",{class:"w-5 h-5 mr-2 text-gray-600",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{d:"M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"})],-1)),gt(" "+F(S.$t("backgroundConfig.darkMode")),1)]),B("div",Mm,[B("div",xm,[B("button",{onClick:b[14]||(b[14]=L=>C("color")),class:kA(["px-3 py-2 text-sm border rounded transition-colors",A.modelValue.dark.backgroundType==="color"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},F(S.$t("backgroundConfig.solidBackground")),3),B("button",{onClick:b[15]||(b[15]=L=>C("image")),class:kA(["px-3 py-2 text-sm border rounded transition-colors",A.modelValue.dark.backgroundType==="image"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},F(S.$t("backgroundConfig.imageBackground")),3)]),A.modelValue.dark.backgroundType==="color"?(T(),K("div",Jm,[B("div",Tm,[B("label",Hm,F(S.$t("backgroundConfig.backgroundColor")),1),B("div",Ym,[ZA(B("input",{type:"color","onUpdate:modelValue":b[16]||(b[16]=L=>s.value=L),class:"w-10 h-10 border border-gray-300 rounded cursor-pointer"},null,512),[[te,s.value]]),ZA(B("input",{type:"text","onUpdate:modelValue":b[17]||(b[17]=L=>s.value=L),class:"border border-gray-300 rounded px-3 py-2 text-sm font-mono w-24"},null,512),[[te,s.value]])]),B("div",{style:VA({backgroundColor:s.value}),class:"w-16 h-10 border border-gray-300 rounded shadow-inner"},null,4)]),B("div",_m,[B("label",Km,F(S.$t("backgroundConfig.textColor")),1),B("div",Om,[ZA(B("input",{type:"color","onUpdate:modelValue":b[18]||(b[18]=L=>I.value=L),class:"w-10 h-10 border border-gray-300 rounded cursor-pointer"},null,512),[[te,I.value]]),ZA(B("input",{type:"text","onUpdate:modelValue":b[19]||(b[19]=L=>I.value=L),class:"border border-gray-300 rounded px-3 py-2 text-sm font-mono w-24"},null,512),[[te,I.value]])]),B("div",{style:VA({backgroundColor:I.value}),class:"w-16 h-10 border border-gray-300 rounded shadow-inner"},null,4)])])):sA("",!0),A.modelValue.dark.backgroundType==="image"?(T(),K("div",Pm,[B("label",Vm,F(S.$t("backgroundConfig.backgroundImage")),1),B("div",{onDrop:b[23]||(b[23]=L=>D(L,"dark")),onDragover:b[24]||(b[24]=dt(()=>{},["prevent"])),onDragenter:b[25]||(b[25]=dt(()=>{},["prevent"])),class:kA(["border-2 border-dashed rounded-lg p-4 text-center cursor-pointer transition-colors",A.modelValue.dark.backgroundImage?"border-green-300 bg-green-50":"border-gray-300 hover:border-gray-400"])},[B("input",{ref_key:"darkImageInput",ref:r,type:"file",accept:"image/*",onChange:b[20]||(b[20]=L=>E(L,"dark")),class:"hidden"},null,544),A.modelValue.dark.backgroundImage?(T(),K("div",qm,[B("img",{src:p("dark"),alt:"{{ $t('backgroundConfig.darkModePreview') }}背景",class:"max-w-32 max-h-32 mx-auto rounded shadow"},null,8,jm),B("p",Zm,F(A.modelValue.dark.backgroundImage.name),1),B("button",{onClick:b[22]||(b[22]=L=>d("dark")),class:"text-red-600 hover:text-red-500 text-sm"},F(S.$t("backgroundConfig.removeImage")),1)])):(T(),K("div",{key:0,onClick:b[21]||(b[21]=L=>S.$refs.darkImageInput.click())},[b[36]||(b[36]=B("svg",{class:"mx-auto h-8 w-8 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})],-1)),B("p",Wm,F(S.$t("backgroundConfig.clickOrDragToUpload")),1)]))],34),B("div",Xm,[B("label",zm,F(S.$t("backgroundConfig.textColor")),1),B("div",$m,[ZA(B("input",{type:"color","onUpdate:modelValue":b[26]||(b[26]=L=>I.value=L),class:"w-10 h-10 border border-gray-300 rounded cursor-pointer"},null,512),[[te,I.value]]),ZA(B("input",{type:"text","onUpdate:modelValue":b[27]||(b[27]=L=>I.value=L),class:"border border-gray-300 rounded px-3 py-2 text-sm font-mono w-24"},null,512),[[te,I.value]])]),B("div",{style:VA({backgroundColor:I.value}),class:"w-16 h-10 border border-gray-300 rounded shadow-inner"},null,4)])])):sA("",!0)])]),B("div",Ay,[B("h4",ey,F(S.$t("backgroundConfig.backgroundPreview")),1),B("div",ty,[B("div",iy,[B("div",oy,F(S.$t("backgroundConfig.lightModePreview")),1),B("div",{style:VA(v()),class:"h-32 border border-gray-300 rounded-lg flex items-center justify-center text-sm relative overflow-hidden"},[B("div",ny,[B("span",{style:VA({color:A.modelValue.light.textColor})},F(S.$t("backgroundConfig.chatArea")),5)])],4)]),B("div",ry,[B("div",gy,F(S.$t("backgroundConfig.darkModePreview")),1),B("div",{style:VA(N()),class:"h-32 border border-gray-300 rounded-lg flex items-center justify-center text-sm relative overflow-hidden"},[B("div",sy,[B("span",{style:VA({color:A.modelValue.dark.textColor})},F(S.$t("backgroundConfig.chatArea")),5)])],4)])])]),B("div",ay,[B("h5",Iy,F(S.$t("backgroundConfig.quickConfig")),1),B("div",Cy,[B("button",{onClick:b[28]||(b[28]=L=>G("#ffffff","#1f2937")),class:"px-3 py-1 text-sm bg-white border border-gray-300 rounded hover:bg-gray-50"},F(S.$t("backgroundConfig.defaultColors")),1),B("button",{onClick:b[29]||(b[29]=L=>G("#f5f5f4","#374151")),class:"px-3 py-1 text-sm bg-stone-100 border border-gray-300 rounded hover:bg-stone-200"},F(S.$t("backgroundConfig.stoneTexture")),1),B("button",{onClick:b[30]||(b[30]=L=>G("#fef7cd","#7c2d12")),class:"px-3 py-1 text-sm bg-yellow-100 border border-gray-300 rounded hover:bg-yellow-200"},F(S.$t("backgroundConfig.sunnyColors")),1),B("button",{onClick:b[31]||(b[31]=L=>G("#e0f2fe","#1e40af")),class:"px-3 py-1 text-sm bg-sky-100 border border-gray-300 rounded hover:bg-sky-200"},F(S.$t("backgroundConfig.skyBlue")),1),B("button",{onClick:b[32]||(b[32]=L=>G("#fdf2f8","#be185d")),class:"px-3 py-1 text-sm bg-pink-100 border border-gray-300 rounded hover:bg-pink-200"},F(S.$t("backgroundConfig.romanticPink")),1)])])]))}},By={class:"space-y-6"},Qy={class:"text-xl font-semibold text-gray-900 mb-4"},cy={class:"text-gray-600 mb-6"},Ey={class:"border-b border-gray-200"},uy={class:"-mb-px flex space-x-4 sm:space-x-8"},hy=["onClick"],fy={class:"flex items-center"},dy={class:"hidden sm:inline"},py={class:"min-h-96"},my={class:"flex justify-between"},yy={__name:"ThemeDesign",props:{modelValue:{type:Object,required:!0},chipModel:{type:String,required:!0},activeTab:{type:String,default:"wakeword"}},emits:["update:modelValue","next","prev","tabChange"],setup(A,{emit:e}){const{t}=ve(),i={render(){return GA("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[GA("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z"})])}},o={render(){return GA("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 640 640"},[GA("path",{d:"M320 96C329.5 96 338 101.5 341.9 110.2L515.1 496L536 496C549.3 496 560 506.7 560 520C560 533.3 549.3 544 536 544L440 544C426.7 544 416 533.3 416 520C416 506.7 426.7 496 440 496L462.5 496L426.6 416L213.4 416L177.5 496L200 496C213.3 496 224 506.7 224 520C224 533.3 213.3 544 200 544L104 544C90.7 544 80 533.3 80 520C80 506.7 90.7 496 104 496L124.9 496L298.1 110.2C302 101.5 310.5 96 320 96zM320 178.6L235 368L405 368L320 178.6z"})])}},n={render(){return GA("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[GA("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M14.828 14.828a4 4 0 01-5.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})])}},r={render(){return GA("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 640 640"},[GA("path",{d:"M160 144C151.2 144 144 151.2 144 160L144 480C144 488.8 151.2 496 160 496L480 496C488.8 496 496 488.8 496 480L496 160C496 151.2 488.8 144 480 144L160 144zM96 160C96 124.7 124.7 96 160 96L480 96C515.3 96 544 124.7 544 160L544 480C544 515.3 515.3 544 480 544L160 544C124.7 544 96 515.3 96 480L96 160zM224 192C241.7 192 256 206.3 256 224C256 241.7 241.7 256 224 256C206.3 256 192 241.7 192 224C192 206.3 206.3 192 224 192zM360 264C368.5 264 376.4 268.5 380.7 275.8L460.7 411.8C465.1 419.2 465.1 428.4 460.8 435.9C456.5 443.4 448.6 448 440 448L200 448C191.1 448 182.8 443 178.7 435.1C174.6 427.2 175.2 417.6 180.3 410.3L236.3 330.3C240.8 323.9 248.1 320.1 256 320.1C263.9 320.1 271.2 323.9 275.7 330.3L292.9 354.9L339.4 275.9C343.7 268.6 351.6 264.1 360.1 264.1z"})])}},g=A,s=e,a=EA(g.activeTab),I=hA(()=>[{id:"wakeword",name:t("themeDesign.tabs.wakeword"),icon:i},{id:"font",name:t("themeDesign.tabs.font"),icon:o},{id:"emoji",name:t("themeDesign.tabs.emoji"),icon:n},{id:"background",name:t("themeDesign.tabs.background"),icon:r}]),l=hA({get:()=>g.modelValue,set:h=>s("update:modelValue",h)}),C=()=>{var u,E,D;const h=g.modelValue.wakeword;if(h.type==="custom"){if(!((u=h.custom.name)!=null&&u.trim())){alert(t("wakewordConfig.errors.nameRequired"));return}if(!((E=h.custom.command)!=null&&E.trim())){alert(t("wakewordConfig.errors.commandRequired"));return}if(!h.custom.duration||h.custom.duration<500||h.custom.duration>1e4){alert(t("wakewordConfig.errors.durationRange"));return}}const f=g.modelValue.font;if(f.type==="custom"&&!((D=f.custom)!=null&&D.file)){alert(t("fontConfig.selectValidFontFile"));return}s("next")},Q=h=>{a.value=h,s("tabChange",h)};return ae(()=>g.activeTab,h=>{a.value=h}),(h,f)=>(T(),K("div",By,[B("div",null,[B("h2",Qy,F(h.$t("themeDesign.title")),1),B("p",cy,F(h.$t("themeDesign.description")),1)]),B("div",Ey,[B("nav",uy,[(T(!0),K(qA,null,Ke(I.value,u=>(T(),K("button",{key:u.id,onClick:E=>Q(u.id),class:kA(["py-2 px-1 border-b-2 font-medium text-sm relative",a.value===u.id?"border-primary-500 text-primary-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"])},[B("span",fy,[(T(),ye(HI(u.icon),{class:"w-5 h-5 sm:mr-2"})),B("span",dy,F(u.name),1)])],10,hy))),128))])]),B("div",py,[a.value==="wakeword"?(T(),ye(b0,{key:0,modelValue:l.value.wakeword,"onUpdate:modelValue":f[0]||(f[0]=u=>l.value.wakeword=u),chipModel:A.chipModel},null,8,["modelValue","chipModel"])):sA("",!0),a.value==="font"?(T(),ye(kp,{key:1,modelValue:l.value.font,"onUpdate:modelValue":f[1]||(f[1]=u=>l.value.font=u)},null,8,["modelValue"])):sA("",!0),a.value==="emoji"?(T(),ye(Im,{key:2,modelValue:l.value.emoji,"onUpdate:modelValue":f[2]||(f[2]=u=>l.value.emoji=u)},null,8,["modelValue"])):sA("",!0),a.value==="background"?(T(),ye(ly,{key:3,modelValue:l.value.skin,"onUpdate:modelValue":f[3]||(f[3]=u=>l.value.skin=u)},null,8,["modelValue"])):sA("",!0)]),B("div",my,[B("button",{onClick:f[4]||(f[4]=u=>h.$emit("prev")),class:"bg-gray-500 hover:bg-gray-600 text-white px-6 py-2 rounded-lg font-medium transition-colors"},F(h.$t("themeDesign.previous")),1),B("button",{onClick:C,class:"bg-primary-500 hover:bg-primary-600 text-white px-6 py-2 rounded-lg font-medium transition-colors"},F(h.$t("themeDesign.next")),1)])]))}},wy=(A,e)=>{const t=A.__vccOpts||A;for(const[i,o]of e)t[i]=o;return t},Dy={class:"space-y-6"},ky={class:"text-xl font-semibold text-gray-900 mb-4"},vy={class:"text-gray-600 mb-6"},Fy={class:"flex flex-col lg:flex-row gap-8"},Sy={class:"flex-1"},Ry={class:"text-lg font-medium text-gray-900 mb-4"},by={class:"bg-gray-100 p-4 rounded-lg"},Ny={class:"max-w-full overflow-auto flex justify-center"},Gy={class:"bg-gray-800 p-6 rounded-2xl shadow-2xl inline-block"},Ly={class:"bg-gray-900 p-2 rounded-xl"},Uy={class:"relative z-10 flex flex-col items-center justify-center p-4 text-center"},My={class:"mb-4"},xy={key:0,class:"emoji-container"},Jy=["src","alt"],Ty={key:1,class:"emoji-container"},Hy={class:"text-center"},Yy={class:"text-sm"},_y={class:"text-xs"},Ky={key:0,class:"absolute inset-0 flex items-center justify-center"},Oy={class:"animate-pulse text-gray-400 text-xs"},Py={class:"mt-3 text-center text-xs text-gray-400"},Vy={class:"w-full lg:w-80"},Wy={class:"text-lg font-medium text-gray-900 mb-4"},qy={class:"space-y-6 bg-white border border-gray-200 rounded-lg p-4"},jy={class:"block text-sm font-medium text-gray-700 mb-2"},Zy={class:"block text-sm font-medium text-gray-700 mb-2"},Xy={key:0,class:"flex flex-wrap gap-2 max-h-32 overflow-y-auto justify-center"},zy=["onClick","title"],$y={key:0},Aw=["src","alt"],ew={key:1,class:"text-lg"},tw={key:1,class:"text-center py-4 text-gray-500 bg-gray-50 rounded-lg border-2 border-dashed"},iw={class:"text-2xl mb-2"},ow={class:"text-sm"},nw={class:"block text-sm font-medium text-gray-700 mb-2"},rw={class:"flex space-x-2"},gw={class:"border-t pt-4"},sw={class:"font-medium text-gray-900 mb-2"},aw={class:"text-xs text-gray-600 space-y-1"},Iw={key:0},Cw={class:"flex items-center"},lw={key:0,class:"ml-2 animate-pulse text-blue-500"},Bw={key:1},Qw={class:"flex justify-between"},cw={__name:"GenerateSummary",props:{config:{type:Object,required:!0}},emits:["prev","generate"],setup(A){const{t:e}=ve(),t=A,i=EA(e("generateSummary.defaultPreviewText")),o=EA("happy"),n=EA("light"),r=EA(!1),g=EA(""),s=hA(()=>[{key:"neutral",name:e("generateSummary.emotions.neutral"),emoji:"😶"},{key:"happy",name:e("generateSummary.emotions.happy"),emoji:"🙂"},{key:"laughing",name:e("generateSummary.emotions.laughing"),emoji:"😆"},{key:"funny",name:e("generateSummary.emotions.funny"),emoji:"😂"},{key:"sad",name:e("generateSummary.emotions.sad"),emoji:"😔"},{key:"angry",name:e("generateSummary.emotions.angry"),emoji:"😠"},{key:"crying",name:e("generateSummary.emotions.crying"),emoji:"😭"},{key:"loving",name:e("generateSummary.emotions.loving"),emoji:"😍"},{key:"surprised",name:e("generateSummary.emotions.surprised"),emoji:"😯"},{key:"thinking",name:e("generateSummary.emotions.thinking"),emoji:"🤔"},{key:"cool",name:e("generateSummary.emotions.cool"),emoji:"😎"},{key:"sleepy",name:e("generateSummary.emotions.sleepy"),emoji:"😴"}]),a=hA(()=>{if(t.config.theme.emoji.type==="preset"&&t.config.theme.emoji.preset)return s.value;if(t.config.theme.emoji.type==="custom"){const S=t.config.theme.emoji.custom.images;return s.value.filter(b=>S[b.key])}else return[]}),I=hA(()=>E(o.value)),l=()=>{const{width:S,height:b}=t.config.chip.display;return{width:`${S}px`,height:`${b}px`}},C=()=>{const S=t.config.theme.skin[n.value];if(S.backgroundType==="image"&&S.backgroundImage)try{if(S.backgroundImage&&typeof S.backgroundImage=="object"&&S.backgroundImage.size)return{backgroundImage:`url(${URL.createObjectURL(S.backgroundImage)})`,backgroundSize:"cover",backgroundPosition:"center"}}catch(b){console.warn("背景图片预览加载失败:",b)}return{backgroundColor:S.backgroundColor||"#ffffff"}},Q=()=>{let S=48;return t.config.theme.emoji.type==="preset"?S=t.config.theme.emoji.preset==="twemoji64"?64:32:t.config.theme.emoji.custom.size&&(S=Math.min(t.config.theme.emoji.custom.size.width,t.config.theme.emoji.custom.size.height)),{width:`${S}px`,height:`${S}px`}},h=()=>{let S=14;if(t.config.theme.font.type==="preset"){const L=t.config.theme.font.preset;L.includes("_14_")?S=14:L.includes("_16_")?S=16:L.includes("_20_")?S=20:L.includes("_30_")&&(S=30)}else t.config.theme.font.custom.size&&(S=t.config.theme.font.custom.size);const b=n.value==="dark"?t.config.theme.skin.dark.textColor:t.config.theme.skin.light.textColor;return{fontSize:`${S}px`,color:b,fontFamily:u(),textShadow:n.value==="dark"?"1px 1px 2px rgba(0,0,0,0.5)":"1px 1px 2px rgba(255,255,255,0.5)"}},f=async()=>{document.querySelectorAll("style[data-font-preview]").forEach(b=>b.remove()),r.value=!1,g.value="";try{if(t.config.theme.font.type==="preset"){const b=t.config.theme.font.preset;let L,QA;b&&b.startsWith("font_noto_qwen_")?(L="NotoPreview",QA="./static/fonts/noto_qwen.ttf"):(L="PuHuiPreview",QA="./static/fonts/puhui_deepseek.ttf");const dA=document.createElement("style");dA.setAttribute("data-font-preview","true"),dA.textContent=` + @font-face { + font-family: '${L}'; + src: url('${QA}') format('truetype'); + font-display: swap; + } + `,document.head.appendChild(dA),await document.fonts.load(`16px "${L}"`),g.value=L,r.value=!0}else if(t.config.theme.font.custom.file)try{const b=t.config.theme.font.custom.file;if(!b||typeof b!="object"||!b.size)throw new Error("字体文件对象无效");const L="CustomFontPreview",QA=URL.createObjectURL(b),dA=document.createElement("style");dA.setAttribute("data-font-preview","true"),dA.textContent=` + @font-face { + font-family: '${L}'; + src: url('${QA}'); + font-display: swap; + } + `,document.head.appendChild(dA),await document.fonts.load(`16px "${L}"`),g.value=L,r.value=!0}catch(b){console.warn("自定义字体预览加载失败:",b),g.value="Arial, sans-serif",r.value=!0}else g.value="system-ui",r.value=!0}catch(b){console.warn("Font loading failed:",b),g.value="system-ui",r.value=!0}},u=()=>r.value&&g.value?`"${g.value}", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif`:'"PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif',E=S=>{if(t.config.theme.emoji.type==="preset")return`./static/twemoji${t.config.theme.emoji.preset==="twemoji64"?"64":"32"}/${S}.png`;if(t.config.theme.emoji.type==="custom"&&t.config.theme.emoji.custom.images[S])try{const b=t.config.theme.emoji.custom.images[S];if(b&&typeof b=="object"&&b.size)return URL.createObjectURL(b)}catch(b){console.warn(`表情图片预览加载失败 (${S}):`,b)}return null},D=S=>{const b=s.value.find(L=>L.key===S);return b?b.emoji:"😶"},c=()=>{if(t.config.theme.emoji.type==="preset")return(t.config.theme.emoji.preset==="twemoji64"?64:32)+16;if(t.config.theme.emoji.custom.size){const S=Math.min(t.config.theme.emoji.custom.size.width,t.config.theme.emoji.custom.size.height);return Math.min(S+16,64)}return 48},d=()=>t.config.theme.emoji.type==="preset"?t.config.theme.emoji.preset==="twemoji64"?64:32:t.config.theme.emoji.custom.size?Math.min(t.config.theme.emoji.custom.size.width,t.config.theme.emoji.custom.size.height,48):32,p=S=>{o.value=S},v=()=>{const S=t.config.theme.wakeword;return!S||S.type==="none"?e("wakewordConfig.noWakeword"):S.type==="preset"?{wn9s_hilexin:"Hi,乐鑫",wn9s_hiesp:"Hi,ESP",wn9s_nihaoxiaozhi:"你好小智",wn9_nihaoxiaozhi_tts:"你好小智",wn9_alexa:"Alexa",wn9_jarvis_tts:"Jarvis"}[S.preset]||S.preset:S.type==="custom"?S.custom.name||e("wakewordConfig.customWakeword"):e("wakewordConfig.noWakeword")},N=()=>{if(t.config.theme.font.type==="preset")return e("fontConfig.presetFontNames."+t.config.theme.font.preset)||t.config.theme.font.preset;{const S=t.config.theme.font.custom;return e("generateSummary.customFont",{size:S.size})}},G=()=>{if(t.config.theme.emoji.type==="preset"&&t.config.theme.emoji.preset)return t.config.theme.emoji.preset==="twemoji64"?"Twemoji 64×64":"Twemoji 32×32";if(t.config.theme.emoji.type==="custom"){const S=Object.keys(t.config.theme.emoji.custom.images).length;return e("generateSummary.customEmoji",{count:S})}else return t.config.theme.emoji.type==="none"?e("emojiConfig.noEmojiPack"):e("generateSummary.notConfigured")},H=()=>{const S=t.config.theme.skin.light.backgroundType==="image"?e("generateSummary.image"):e("generateSummary.color"),b=t.config.theme.skin.dark.backgroundType==="image"?e("generateSummary.image"):e("generateSummary.color");return e("generateSummary.skinLight",{type:S})+"/"+e("generateSummary.skinDark",{type:b})};return ae(()=>t.config.theme.font,()=>{f()},{deep:!0}),Ft(async()=>{a.value.length>0?o.value=a.value[0].key:o.value="",await f()}),Ci(()=>{document.querySelectorAll("style[data-font-preview]").forEach(b=>b.remove())}),(S,b)=>(T(),K("div",Dy,[B("div",null,[B("h2",ky,F(S.$t("generateSummary.title")),1),B("p",vy,F(S.$t("generateSummary.description")),1)]),B("div",Fy,[B("div",Sy,[B("h3",Ry,F(S.$t("generateSummary.devicePreview")),1),B("div",by,[B("div",Ny,[B("div",Gy,[B("div",Ly,[B("div",{style:VA(l()),class:"relative rounded-lg overflow-hidden border-2 border-gray-700 flex flex-col items-center justify-center"},[B("div",{style:VA(C()),class:"absolute inset-0"},null,4),B("div",Uy,[B("div",My,[o.value&&a.value.length>0?(T(),K("div",xy,[I.value?(T(),K("img",{key:0,src:I.value,alt:o.value,style:VA(Q()),class:"emoji-image"},null,12,Jy)):(T(),K("div",{key:1,style:VA(Q()),class:"emoji-fallback bg-gray-200 rounded-full flex items-center justify-center text-2xl"},F(D(o.value)),5))])):(T(),K("div",Ty,[B("div",{style:VA(Q()),class:"emoji-placeholder flex items-center justify-center text-gray-400 border-2 border-dashed border-gray-300 rounded bg-gray-50"},[B("div",Hy,[B("div",Yy,F(A.config.theme.emoji.type==="none"?"📦":"😕"),1),B("div",_y,F(A.config.theme.emoji.type==="none"?S.$t("emojiConfig.noEmojiPack"):S.$t("generateSummary.noEmotionConfigured")),1)])],4)]))]),A.config.theme.font.hide_subtitle?sA("",!0):(T(),K("div",{key:0,style:VA(h()),class:"text-message max-w-full break-words relative"},[r.value?sA("",!0):(T(),K("div",Ky,[B("div",Oy,F(S.$t("generateSummary.fontLoading")),1)])),B("div",{class:kA({"opacity-0":!r.value})},F(i.value),3)],4))])],4)]),B("div",Py,F(A.config.chip.display.width)+" × "+F(A.config.chip.display.height)+" "+F(A.config.chip.model.toUpperCase()),1)])])])]),B("div",Vy,[B("h3",Wy,F(S.$t("generateSummary.previewSettings")),1),B("div",qy,[B("div",null,[B("label",jy,F(S.$t("generateSummary.previewText")),1),ZA(B("textarea",{"onUpdate:modelValue":b[0]||(b[0]=L=>i.value=L),class:"w-full border border-gray-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500",rows:"3",placeholder:"Hi, I'm your friend Xiaozhi!"},null,512),[[te,i.value]])]),B("div",null,[B("label",Zy,F(S.$t("generateSummary.currentEmotion")),1),a.value.length>0?(T(),K("div",Xy,[(T(!0),K(qA,null,Ke(a.value,L=>(T(),K("button",{key:L.key,onClick:QA=>p(L.key),class:kA(["p-2 border rounded transition-colors flex items-center justify-center",o.value===L.key?"border-primary-500 bg-primary-50":"border-gray-200 hover:border-gray-300"]),title:L.name,style:VA({width:c()+"px",height:c()+"px"})},[E(L.key)?(T(),K("div",$y,[B("img",{src:E(L.key),alt:L.name,style:VA({width:d()+"px",height:d()+"px"}),class:"object-contain rounded"},null,12,Aw)])):(T(),K("div",ew,F(L.emoji),1))],14,zy))),128))])):(T(),K("div",tw,[B("div",iw,F(A.config.theme.emoji.type==="none"?"📦":"😕"),1),B("div",ow,F(A.config.theme.emoji.type==="none"?S.$t("emojiConfig.noEmojiPackDescription"):S.$t("generateSummary.configureEmojiFirst")),1)]))]),B("div",null,[B("label",nw,F(S.$t("generateSummary.themeMode")),1),B("div",rw,[B("button",{onClick:b[1]||(b[1]=L=>n.value="light"),class:kA(["flex-1 py-2 px-3 text-sm border rounded transition-colors",n.value==="light"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])}," 🌞 "+F(S.$t("generateSummary.lightMode")),3),B("button",{onClick:b[2]||(b[2]=L=>n.value="dark"),class:kA(["flex-1 py-2 px-3 text-sm border rounded transition-colors",n.value==="dark"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])}," 🌙 "+F(S.$t("generateSummary.darkMode")),3)])]),B("div",gw,[B("h4",sw,F(S.$t("generateSummary.configSummary")),1),B("div",aw,[A.config.theme.wakeword?(T(),K("div",Iw,F(S.$t("generateSummary.wakeword"))+" "+F(v()),1)):sA("",!0),B("div",Cw,[B("span",null,F(S.$t("generateSummary.font"))+" "+F(N()),1),r.value?sA("",!0):(T(),K("span",lw,F(S.$t("generateSummary.loading")),1))]),B("div",null,F(S.$t("generateSummary.emotion"))+" "+F(G()),1),B("div",null,F(S.$t("generateSummary.skin"))+" "+F(H()),1),A.config.theme.font.hide_subtitle?(T(),K("div",Bw,F(S.$t("generateSummary.hideSubtitle"))+" "+F(S.$t("common.yes")),1)):sA("",!0)])])])])]),B("div",Qw,[B("button",{onClick:b[3]||(b[3]=L=>S.$emit("prev")),class:"bg-gray-500 hover:bg-gray-600 text-white px-6 py-2 rounded-lg font-medium transition-colors"},F(S.$t("generateSummary.previous")),1),B("button",{onClick:b[4]||(b[4]=L=>S.$emit("generate")),class:"bg-green-500 hover:bg-green-600 text-white px-8 py-2 rounded-lg font-medium transition-colors flex items-center"},[b[5]||(b[5]=B("svg",{class:"w-5 h-5 mr-2",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)),gt(" "+F(S.$t("generateSummary.generate")),1)])])]))}},Ew=wy(cw,[["__scopeId","data-v-aa1dde40"]]);/*! https://mths.be/codepointat v0.2.0 by @mathias */String.prototype.codePointAt||function(){var A=function(){try{var t={},i=Object.defineProperty,o=i(t,t,t)&&i}catch{}return o}(),e=function(t){if(this==null)throw TypeError();var i=String(this),o=i.length,n=t?Number(t):0;if(n!=n&&(n=0),!(n<0||n>=o)){var r=i.charCodeAt(n),g;return r>=55296&&r<=56319&&o>n+1&&(g=i.charCodeAt(n+1),g>=56320&&g<=57343)?(r-55296)*1024+g-56320+65536:r}};A?A(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}();var cg=0,_C=-3;function ao(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function uw(A,e){this.source=A,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new ao,this.dtree=new ao}var KC=new ao,OC=new ao,Eg=new Uint8Array(30),ug=new Uint16Array(30),PC=new Uint8Array(30),VC=new Uint16Array(30),hw=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zs=new ao,$e=new Uint8Array(320);function WC(A,e,t,i){var o,n;for(o=0;o>>=1,e}function et(A,e,t){if(!e)return t;for(;A.bitcount<24;)A.tag|=A.source[A.sourceIndex++]<>>16-e;return A.tag>>>=e,A.bitcount-=e,i+t}function br(A,e){for(;A.bitcount<24;)A.tag|=A.source[A.sourceIndex++]<>>=1,++o,t+=e.table[o],i-=e.table[o];while(i>=0);return A.tag=n,A.bitcount-=o,e.trans[t+i]}function pw(A,e,t){var i,o,n,r,g,s;for(i=et(A,5,257),o=et(A,5,1),n=et(A,4,4),r=0;r<19;++r)$e[r]=0;for(r=0;r8;)A.sourceIndex--,A.bitcount-=8;if(e=A.source[A.sourceIndex+1],e=256*e+A.source[A.sourceIndex],t=A.source[A.sourceIndex+3],t=256*t+A.source[A.sourceIndex+2],e!==(~t&65535))return _C;for(A.sourceIndex+=4,i=e;i;--i)A.dest[A.destLen++]=A.source[A.sourceIndex++];return A.bitcount=0,cg}function yw(A,e){var t=new uw(A,e),i,o,n;do{switch(i=dw(t),o=et(t,2,0),o){case 0:n=mw(t);break;case 1:n=Aa(t,KC,OC);break;case 2:pw(t,t.ltree,t.dtree),n=Aa(t,t.ltree,t.dtree);break;default:n=_C}if(n!==cg)throw new Error("Data error")}while(!i);return t.destLenthis.x2&&(this.x2=A)),typeof e=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.y2&&(this.y2=e))};St.prototype.addX=function(A){this.addPoint(A,null)};St.prototype.addY=function(A){this.addPoint(null,A)};St.prototype.addBezier=function(A,e,t,i,o,n,r,g){var s=[A,e],a=[t,i],I=[o,n],l=[r,g];this.addPoint(A,e),this.addPoint(r,g);for(var C=0;C<=1;C++){var Q=6*s[C]-12*a[C]+6*I[C],h=-3*s[C]+9*a[C]-9*I[C]+3*l[C],f=3*a[C]-3*s[C];if(h===0){if(Q===0)continue;var u=-f/Q;0=0&&s>0&&(g+=" "),g+=e(a)}return g}for(var i="",o=0;o=0&&A<=255,"Byte value should be between 0 and 255."),[A]};wA.BYTE=je(1);rA.CHAR=function(A){return[A.charCodeAt(0)]};wA.CHAR=je(1);rA.CHARARRAY=function(A){typeof A>"u"&&(A="",console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));for(var e=[],t=0;t"u"?0:A.length};rA.USHORT=function(A){return[A>>8&255,A&255]};wA.USHORT=je(2);rA.SHORT=function(A){return A>=ta&&(A=-(2*ta-A)),[A>>8&255,A&255]};wA.SHORT=je(2);rA.UINT24=function(A){return[A>>16&255,A>>8&255,A&255]};wA.UINT24=je(3);rA.ULONG=function(A){return[A>>24&255,A>>16&255,A>>8&255,A&255]};wA.ULONG=je(4);rA.LONG=function(A){return A>=ia&&(A=-(2*ia-A)),[A>>24&255,A>>16&255,A>>8&255,A&255]};wA.LONG=je(4);rA.FIXED=rA.ULONG;wA.FIXED=wA.ULONG;rA.FWORD=rA.SHORT;wA.FWORD=wA.SHORT;rA.UFWORD=rA.USHORT;wA.UFWORD=wA.USHORT;rA.LONGDATETIME=function(A){return[0,0,0,0,A>>24&255,A>>16&255,A>>8&255,A&255]};wA.LONGDATETIME=je(8);rA.TAG=function(A){return mA.argument(A.length===4,"Tag should be exactly 4 ASCII characters."),[A.charCodeAt(0),A.charCodeAt(1),A.charCodeAt(2),A.charCodeAt(3)]};wA.TAG=je(4);rA.Card8=rA.BYTE;wA.Card8=wA.BYTE;rA.Card16=rA.USHORT;wA.Card16=wA.USHORT;rA.OffSize=rA.BYTE;wA.OffSize=wA.BYTE;rA.SID=rA.USHORT;wA.SID=wA.USHORT;rA.NUMBER=function(A){return A>=-107&&A<=107?[A+139]:A>=108&&A<=1131?(A=A-108,[(A>>8)+247,A&255]):A>=-1131&&A<=-108?(A=-A-108,[(A>>8)+251,A&255]):A>=-32768&&A<=32767?rA.NUMBER16(A):rA.NUMBER32(A)};wA.NUMBER=function(A){return rA.NUMBER(A).length};rA.NUMBER16=function(A){return[28,A>>8&255,A&255]};wA.NUMBER16=je(3);rA.NUMBER32=function(A){return[29,A>>24&255,A>>16&255,A>>8&255,A&255]};wA.NUMBER32=je(5);rA.REAL=function(A){var e=A.toString(),t=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);if(t){var i=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));e=(Math.round(A*i)/i).toString()}for(var o="",n=0,r=e.length;n>8&255,e[e.length]=i&255}return e};wA.UTF16=function(A){return A.length*2};var Nr={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};Ri.MACSTRING=function(A,e,t,i){var o=Nr[i];if(o!==void 0){for(var n="",r=0;r=128&&(n=t[n],n===void 0))return;i[o]=n}return i}};wA.MACSTRING=function(A,e){var t=rA.MACSTRING(A,e);return t!==void 0?t.length:0};function Gr(A){return A>=-128&&A<=127}function kw(A,e,t){for(var i=0,o=A.length;e>8&255,s+256&255)}return n}rA.VARDELTAS=function(A){for(var e=0,t=[];e=-128&&i<=127?e=vw(A,e,t):e=Fw(A,e,t)}return t};rA.INDEX=function(A){for(var e=1,t=[e],i=[],o=0;o>8,e[l+1]=C&255,e=e.concat(i[I])}return e};wA.TABLE=function(A){for(var e=0,t=A.fields.length,i=0;i0)return new J(this.data,this.offset+e).parseStruct(A)};J.prototype.parsePointer32=function(A){var e=this.parseOffset32();if(e>0)return new J(this.data,this.offset+e).parseStruct(A)};J.prototype.parseListOfLists=function(A){for(var e=this.parseOffset16List(),t=e.length,i=this.relativeOffset,o=new Array(t),n=0;n>1,e.skip("uShort",3),A.glyphIndexMap={};for(var r=new lA.Parser(t,i+o+14),g=new lA.Parser(t,i+o+16+n*2),s=new lA.Parser(t,i+o+16+n*4),a=new lA.Parser(t,i+o+16+n*6),I=i+o+16+n*8,l=0;l=0;o-=1){var n=lA.getUShort(A,e+4+o*8),r=lA.getUShort(A,e+4+o*8+2);if(n===3&&(r===0||r===1||r===10)||n===0&&(r===0||r===1||r===2||r===3||r===4)){i=lA.getULong(A,e+4+o*8+4);break}}if(i===-1)throw new Error("No valid cmap sub-tables found.");var g=new lA.Parser(A,e+i);if(t.format=g.parseUShort(),t.format===12)Uw(t,g);else if(t.format===4)Mw(t,g,A,e,i);else throw new Error("Only format 4 and 12 cmap tables are supported (found format "+t.format+").");return t}function Jw(A,e,t){A.segments.push({end:e,start:e,delta:-(e-t),offset:0,glyphIndex:t})}function Tw(A){A.segments.push({end:65535,start:65535,delta:1,offset:0})}function Hw(A){var e=!0,t;for(t=A.length-1;t>0;t-=1){var i=A.get(t);if(i.unicode>65535){console.log("Adding CMAP format 12 (needed!)"),e=!1;break}}var o=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:e?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:e?12:20}];e||(o=o.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),o=o.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);var n=new aA.Table("cmap",o);for(n.segments=[],t=0;t>4,r=o&15;if(n===t||(e+=i[n],r===t))break;e+=i[r]}return parseFloat(e)}function AD(A,e){var t,i,o,n;if(e===28)return t=A.parseByte(),i=A.parseByte(),t<<8|i;if(e===29)return t=A.parseByte(),i=A.parseByte(),o=A.parseByte(),n=A.parseByte(),t<<24|i<<16|o<<8|n;if(e===30)return $w(A);if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return t=A.parseByte(),(e-247)*256+t+108;if(e>=251&&e<=254)return t=A.parseByte(),-(e-251)*256-t-108;throw new Error("Invalid b0 "+e)}function eD(A){for(var e={},t=0;t>1,s.length=0,I=!0}function N(G){for(var H,S,b,L,QA,dA,IA,oA,X,tA,fA,_,W=0;W1&&!I&&(d=s.shift()+E,I=!0),Q+=s.pop(),p(C,Q);break;case 5:for(;s.length>0;)C+=s.shift(),Q+=s.shift(),g.lineTo(C,Q);break;case 6:for(;s.length>0&&(C+=s.shift(),g.lineTo(C,Q),s.length!==0);)Q+=s.shift(),g.lineTo(C,Q);break;case 7:for(;s.length>0&&(Q+=s.shift(),g.lineTo(C,Q),s.length!==0);)C+=s.shift(),g.lineTo(C,Q);break;case 8:for(;s.length>0;)i=C+s.shift(),o=Q+s.shift(),n=i+s.shift(),r=o+s.shift(),C=n+s.shift(),Q=r+s.shift(),g.curveTo(i,o,n,r,C,Q);break;case 10:QA=s.pop()+f,dA=h[QA],dA&&N(dA);break;case 11:return;case 12:switch(z=G[W],W+=1,z){case 35:i=C+s.shift(),o=Q+s.shift(),n=i+s.shift(),r=o+s.shift(),IA=n+s.shift(),oA=r+s.shift(),X=IA+s.shift(),tA=oA+s.shift(),fA=X+s.shift(),_=tA+s.shift(),C=fA+s.shift(),Q=_+s.shift(),s.shift(),g.curveTo(i,o,n,r,IA,oA),g.curveTo(X,tA,fA,_,C,Q);break;case 34:i=C+s.shift(),o=Q,n=i+s.shift(),r=o+s.shift(),IA=n+s.shift(),oA=r,X=IA+s.shift(),tA=r,fA=X+s.shift(),_=Q,C=fA+s.shift(),g.curveTo(i,o,n,r,IA,oA),g.curveTo(X,tA,fA,_,C,Q);break;case 36:i=C+s.shift(),o=Q+s.shift(),n=i+s.shift(),r=o+s.shift(),IA=n+s.shift(),oA=r,X=IA+s.shift(),tA=r,fA=X+s.shift(),_=tA+s.shift(),C=fA+s.shift(),g.curveTo(i,o,n,r,IA,oA),g.curveTo(X,tA,fA,_,C,Q);break;case 37:i=C+s.shift(),o=Q+s.shift(),n=i+s.shift(),r=o+s.shift(),IA=n+s.shift(),oA=r+s.shift(),X=IA+s.shift(),tA=oA+s.shift(),fA=X+s.shift(),_=tA+s.shift(),Math.abs(fA-C)>Math.abs(_-Q)?C=fA+s.shift():Q=_+s.shift(),g.curveTo(i,o,n,r,IA,oA),g.curveTo(X,tA,fA,_,C,Q);break;default:console.log("Glyph "+e.index+": unknown operator 1200"+z),s.length=0}break;case 14:s.length>0&&!I&&(d=s.shift()+E,I=!0),l&&(g.closePath(),l=!1);break;case 18:v();break;case 19:case 20:v(),W+=a+7>>3;break;case 21:s.length>2&&!I&&(d=s.shift()+E,I=!0),Q+=s.pop(),C+=s.pop(),p(C,Q);break;case 22:s.length>1&&!I&&(d=s.shift()+E,I=!0),C+=s.pop(),p(C,Q);break;case 23:v();break;case 24:for(;s.length>2;)i=C+s.shift(),o=Q+s.shift(),n=i+s.shift(),r=o+s.shift(),C=n+s.shift(),Q=r+s.shift(),g.curveTo(i,o,n,r,C,Q);C+=s.shift(),Q+=s.shift(),g.lineTo(C,Q);break;case 25:for(;s.length>6;)C+=s.shift(),Q+=s.shift(),g.lineTo(C,Q);i=C+s.shift(),o=Q+s.shift(),n=i+s.shift(),r=o+s.shift(),C=n+s.shift(),Q=r+s.shift(),g.curveTo(i,o,n,r,C,Q);break;case 26:for(s.length%2&&(C+=s.shift());s.length>0;)i=C,o=Q+s.shift(),n=i+s.shift(),r=o+s.shift(),C=n,Q=r+s.shift(),g.curveTo(i,o,n,r,C,Q);break;case 27:for(s.length%2&&(Q+=s.shift());s.length>0;)i=C+s.shift(),o=Q,n=i+s.shift(),r=o+s.shift(),C=n+s.shift(),Q=r,g.curveTo(i,o,n,r,C,Q);break;case 28:H=G[W],S=G[W+1],s.push((H<<24|S<<16)>>16),W+=2;break;case 29:QA=s.pop()+A.gsubrsBias,dA=A.gsubrs[QA],dA&&N(dA);break;case 30:for(;s.length>0&&(i=C,o=Q+s.shift(),n=i+s.shift(),r=o+s.shift(),C=n+s.shift(),Q=r+(s.length===1?s.shift():0),g.curveTo(i,o,n,r,C,Q),s.length!==0);)i=C+s.shift(),o=Q,n=i+s.shift(),r=o+s.shift(),Q=r+s.shift(),C=n+(s.length===1?s.shift():0),g.curveTo(i,o,n,r,C,Q);break;case 31:for(;s.length>0&&(i=C+s.shift(),o=Q,n=i+s.shift(),r=o+s.shift(),Q=r+s.shift(),C=n+(s.length===1?s.shift():0),g.curveTo(i,o,n,r,C,Q),s.length!==0);)i=C,o=Q+s.shift(),n=i+s.shift(),r=o+s.shift(),C=n+s.shift(),Q=r+(s.length===1?s.shift():0),g.curveTo(i,o,n,r,C,Q);break;default:z<32?console.log("Glyph "+e.index+": unknown operator "+z):z<247?s.push(z-139):z<251?(H=G[W],W+=1,s.push((z-247)*256+H+108)):z<255?(H=G[W],W+=1,s.push(-(z-251)*256-H-108)):(H=G[W],S=G[W+1],b=G[W+2],L=G[W+3],W+=4,s.push((H<<24|S<<16|b<<8|L)/65536))}}}return N(t),e.advanceWidth=d,g}function rD(A,e,t,i){var o=[],n,r=new lA.Parser(A,e),g=r.parseCard8();if(g===0)for(var s=0;s=i)throw new Error("CFF table CID Font FDSelect has bad FD index value "+n+" (FD count "+i+")");o.push(n)}else if(g===3){var a=r.parseCard16(),I=r.parseCard16();if(I!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+I);for(var l,C=0;C=i)throw new Error("CFF table CID Font FDSelect has bad FD index value "+n+" (FD count "+i+")");if(l>t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+l);for(;I=0&&(t=i),i=e.indexOf(A),i>=0?t=i+Vo.length:(t=Vo.length+e.length,e.push(A)),t}function sD(){return new aA.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function aD(A){var e=new aA.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);e.names=[];for(var t=0;t=t.begin&&A=1&&(t.ulCodePageRange1=i.parseULong(),t.ulCodePageRange2=i.parseULong()),t.version>=2&&(t.sxHeight=i.parseShort(),t.sCapHeight=i.parseShort(),t.usDefaultChar=i.parseUShort(),t.usBreakChar=i.parseUShort(),t.usMaxContent=i.parseUShort()),t}function JD(A){return new aA.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],A)}var Jr={parse:xD,make:JD,unicodeRanges:xr,getUnicodeRange:MD};function TD(A,e){var t={},i=new lA.Parser(A,e);switch(t.version=i.parseVersion(),t.italicAngle=i.parseFixed(),t.underlinePosition=i.parseShort(),t.underlineThickness=i.parseShort(),t.isFixedPitch=i.parseULong(),t.minMemType42=i.parseULong(),t.maxMemType42=i.parseULong(),t.minMemType1=i.parseULong(),t.maxMemType1=i.parseULong(),t.version){case 1:t.names=ii.slice();break;case 2:t.numberOfGlyphs=i.parseUShort(),t.glyphNameIndex=new Array(t.numberOfGlyphs);for(var o=0;o=ii.length){var r=i.parseChar();t.names.push(i.parseString(r))}break;case 2.5:t.numberOfGlyphs=i.parseUShort(),t.offset=new Array(t.numberOfGlyphs);for(var g=0;gl.value.tag?1:-1}),e.fields=e.fields.concat(i),e.fields=e.fields.concat(o),e}function Qa(A,e,t){for(var i=0;i0){var n=A.glyphs.get(o);return n.getMetrics()}}return t}function PD(A){for(var e=0,t=0;tu||s===void 0)&&u>0&&(s=u),a 123 are reserved for internal usage");if(f.name!==".notdef"){var D=f.getMetrics();e.push(D.xMin),t.push(D.yMin),i.push(D.xMax),o.push(D.yMax),r.push(D.leftSideBearing),g.push(D.rightSideBearing),n.push(f.advanceWidth)}}var c={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,i),yMax:Math.max.apply(null,o),advanceWidthMax:Math.max.apply(null,n),advanceWidthAvg:PD(n),minLeftSideBearing:Math.min.apply(null,r),maxLeftSideBearing:Math.max.apply(null,r),minRightSideBearing:Math.min.apply(null,g)};c.ascender=A.ascender,c.descender=A.descender;var d=sl.make({flags:3,unitsPerEm:A.unitsPerEm,xMin:c.xMin,yMin:c.yMin,xMax:c.xMax,yMax:c.yMax,lowestRecPPEM:3,createdTimestamp:A.createdTimestamp}),p=al.make({ascender:c.ascender,descender:c.descender,advanceWidthMax:c.advanceWidthMax,minLeftSideBearing:c.minLeftSideBearing,minRightSideBearing:c.minRightSideBearing,xMaxExtent:c.maxLeftSideBearing+(c.xMax-c.xMin),numberOfHMetrics:A.glyphs.length}),v=ll.make(A.glyphs.length),N=Jr.make(Object.assign({xAvgCharWidth:Math.round(c.advanceWidthAvg),usFirstCharIndex:s,usLastCharIndex:a,ulUnicodeRange1:I,ulUnicodeRange2:l,ulUnicodeRange3:C,ulUnicodeRange4:Q,sTypoAscender:c.ascender,sTypoDescender:c.descender,sTypoLineGap:0,usWinAscent:c.yMax,usWinDescent:Math.abs(c.yMin),ulCodePageRange1:1,sxHeight:Qa(A,"xyvw",{yMax:Math.round(c.ascender/2)}).yMax,sCapHeight:Qa(A,"HIKLEFJMNTZBDPRAGOQSUVWXY",c).yMax,usDefaultChar:A.hasChar(" ")?32:0,usBreakChar:A.hasChar(" ")?32:0},A.tables.os2)),G=Il.make(A.glyphs),H=ZC.make(A.glyphs),S=A.getEnglishName("fontFamily"),b=A.getEnglishName("fontSubfamily"),L=S+" "+b,QA=A.getEnglishName("postScriptName");QA||(QA=S.replace(/\s/g,"")+"-"+b);var dA={};for(var IA in A.names)dA[IA]=A.names[IA];dA.uniqueID||(dA.uniqueID={en:A.getEnglishName("manufacturer")+":"+L}),dA.postScriptName||(dA.postScriptName={en:QA}),dA.preferredFamily||(dA.preferredFamily=A.names.fontFamily),dA.preferredSubfamily||(dA.preferredSubfamily=A.names.fontSubfamily);var oA=[],X=ul.make(dA,oA),tA=oA.length>0?Cl.make(oA):void 0,fA=hl.make(),_=gl.make(A.glyphs,{version:A.getEnglishName("version"),fullName:L,familyName:S,weightName:b,postScriptName:QA,unitsPerEm:A.unitsPerEm,fontBBox:[0,c.yMin,c.ascender,c.advanceWidthMax]}),W=A.metas&&Object.keys(A.metas).length>0?dl.make(A.metas):void 0,z=[d,p,v,N,X,H,fA,_,G];tA&&z.push(tA),A.tables.gsub&&z.push(fl.make(A.tables.gsub)),W&&z.push(W);for(var DA=pl(z),NA=DA.encode(),oe=pg(NA),LA=DA.fields,Y=!1,$=0;$>>1,n=A[o].tag;if(n===e)return o;n>>1,n=A[o];if(n===e)return o;n>>1;t=A[n];var r=t.start;if(r===e)return t;r0)return t=A[i-1],e>t.end?0:t}function mo(A,e){this.font=A,this.tableName=e}mo.prototype={searchTag:Xn,binSearch:ca,getTable:function(A){var e=this.font.tables[this.tableName];return!e&&A&&(e=this.font.tables[this.tableName]=this.createDefaultTable()),e},getScriptNames:function(){var A=this.getTable();return A?A.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){var A=this.getTable();if(A){for(var e=!1,t=0;t=0)return i[o].script;if(e){var n={tag:A,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return i.splice(-1-o,0,n),n.script}}},getLangSysTable:function(A,e,t){var i=this.getScriptTable(A,t);if(i){if(!e||e==="dflt"||e==="DFLT")return i.defaultLangSys;var o=Xn(i.langSysRecords,e);if(o>=0)return i.langSysRecords[o].langSys;if(t){var n={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return i.langSysRecords.splice(-1-o,0,n),n.langSys}}},getFeatureTable:function(A,e,t,i){var o=this.getLangSysTable(A,e,i);if(o){for(var n,r=o.featureIndexes,g=this.font.tables[this.tableName].features,s=0;s=g[a-1].tag,"Features must be added in alphabetical order."),n={tag:t,feature:{params:0,lookupListIndexes:[]}},g.push(n),r.push(a),n.feature}}},getLookupTables:function(A,e,t,i,o){var n=this.getFeatureTable(A,e,t,o),r=[];if(n){for(var g,s=n.lookupListIndexes,a=this.font.tables[this.tableName].lookups,I=0;I=0?t:-1;case 2:var i=Ea(A.ranges,e);return i?i.index+e-i.start:-1}},expandCoverage:function(A){if(A.format===1)return A.glyphs;for(var e=[],t=A.ranges,i=0;i1,'Multiple: "by" must be an array of two or more ids');var o=this.getLookupTables(t,i,A,2,!0)[0],n=mg(o,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});mA.assert(n.coverage.format===1,"Multiple: unable to modify coverage table format "+n.coverage.format);var r=e.sub,g=this.binSearch(n.coverage.glyphs,r);g<0&&(g=-1-g,n.coverage.glyphs.splice(g,0,r),n.sequences.splice(g,0,0)),n.sequences[g]=e.by};Ge.prototype.addAlternate=function(A,e,t,i){var o=this.getLookupTables(t,i,A,3,!0)[0],n=mg(o,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});mA.assert(n.coverage.format===1,"Alternate: unable to modify coverage table format "+n.coverage.format);var r=e.sub,g=this.binSearch(n.coverage.glyphs,r);g<0&&(g=-1-g,n.coverage.glyphs.splice(g,0,r),n.alternateSets.splice(g,0,0)),n.alternateSets[g]=e.by};Ge.prototype.addLigature=function(A,e,t,i){var o=this.getLookupTables(t,i,A,4,!0)[0],n=o.subtables[0];n||(n={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},o.subtables[0]=n),mA.assert(n.coverage.format===1,"Ligature: unable to modify coverage table format "+n.coverage.format);var r=e.sub[0],g=e.sub.slice(1),s={ligGlyph:e.by,components:g},a=this.binSearch(n.coverage.glyphs,r);if(a>=0){for(var I=n.ligatureSets[a],l=0;l0?(n=A.parseByte(),e&o||(n=-n),n=t+n):(e&o)>0?n=t:n=t+A.parseShort(),n}function yl(A,e,t){var i=new lA.Parser(e,t);A.numberOfContours=i.parseShort(),A._xMin=i.parseShort(),A._yMin=i.parseShort(),A._xMax=i.parseShort(),A._yMax=i.parseShort();var o,n;if(A.numberOfContours>0){for(var r=A.endPointIndices=[],g=0;g0)for(var l=i.parseByte(),C=0;C0){var Q=[],h;if(a>0){for(var f=0;f=0,Q.push(h);for(var u=0,E=0;E0?(o&2)>0?(p.dx=i.parseShort(),p.dy=i.parseShort()):p.matchedPoints=[i.parseUShort(),i.parseUShort()]:(o&2)>0?(p.dx=i.parseChar(),p.dy=i.parseChar()):p.matchedPoints=[i.parseByte(),i.parseByte()],(o&8)>0?p.xScale=p.yScale=i.parseF2Dot14():(o&64)>0?(p.xScale=i.parseF2Dot14(),p.yScale=i.parseF2Dot14()):(o&128)>0&&(p.xScale=i.parseF2Dot14(),p.scale01=i.parseF2Dot14(),p.scale10=i.parseF2Dot14(),p.yScale=i.parseF2Dot14()),A.components.push(p),d=!!(o&32)}if(o&256){A.instructionLength=i.parseUShort(),A.instructions=[];for(var v=0;ve.points.length-1||i.matchedPoints[1]>o.points.length-1)throw Error("Matched points out of range in "+e.name);var r=e.points[i.matchedPoints[0]],g=o.points[i.matchedPoints[1]],s={xScale:i.xScale,scale01:i.scale01,scale10:i.scale10,yScale:i.yScale,dx:0,dy:0};g=zn([g],s)[0],s.dx=r.x-g.x,s.dy=r.y-g.y,n=zn(o.points,s)}e.points=e.points.concat(n)}}return wl(e.points)}function zD(A,e,t,i){for(var o=new at.GlyphSet(i),n=0;n2)){var t=this.font,i=this._prepState;if(!i||i.ppem!==e){var o=this._fpgmState;if(!o){Ht.prototype=rk,o=this._fpgmState=new Ht("fpgm",t.tables.fpgm),o.funcs=[],o.font=t,exports.DEBUG&&(console.log("---EXEC FPGM---"),o.step=-1);try{ai(o)}catch(a){console.log("Hinting error in FPGM:"+a),this._errorState=3;return}}Ht.prototype=o,i=this._prepState=new Ht("prep",t.tables.prep),i.ppem=e;var n=t.tables.cvt;if(n)for(var r=i.cvt=new Array(n.length),g=e/t.unitsPerEm,s=0;s1))try{return Fl(A,i)}catch(a){this._errorState<1&&(console.log("Hinting error:"+a),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}}};Fl=function(A,e){var t=e.ppem/e.font.unitsPerEm,i=t,o=A.components,n,r,g;if(Ht.prototype=e,!o)g=new Ht("glyf",A.instructions),exports.DEBUG&&(console.log("---EXEC GLYPH---"),g.step=-1),Tr(A,g,t,i),r=g.gZone;else{var s=e.font;r=[],n=[];for(var a=0;a=176&&n<=183)i+=n-176+1;else if(n>=184&&n<=191)i+=(n-184+1)*2;else if(e&&o===1&&n===27)break;while(o>0);A.ip=i}function ha(A,e){exports.DEBUG&&console.log(e.step,"SVTCA["+A.axis+"]"),e.fv=e.pv=e.dpv=A}function fa(A,e){exports.DEBUG&&console.log(e.step,"SPVTCA["+A.axis+"]"),e.pv=e.dpv=A}function da(A,e){exports.DEBUG&&console.log(e.step,"SFVTCA["+A.axis+"]"),e.fv=A}function pa(A,e){var t=e.stack,i=t.pop(),o=t.pop(),n=e.z2[i],r=e.z1[o];exports.DEBUG&&console.log("SPVTL["+A+"]",i,o);var g,s;A?(g=n.y-r.y,s=r.x-n.x):(g=r.x-n.x,s=r.y-n.y),e.pv=e.dpv=Do(g,s)}function ma(A,e){var t=e.stack,i=t.pop(),o=t.pop(),n=e.z2[i],r=e.z1[o];exports.DEBUG&&console.log("SFVTL["+A+"]",i,o);var g,s;A?(g=n.y-r.y,s=r.x-n.x):(g=r.x-n.x,s=r.y-n.y),e.fv=Do(g,s)}function gk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"SPVFS[]",t,i),A.pv=A.dpv=Do(i,t)}function sk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"SPVFS[]",t,i),A.fv=Do(i,t)}function ak(A){var e=A.stack,t=A.pv;exports.DEBUG&&console.log(A.step,"GPV[]"),e.push(t.x*16384),e.push(t.y*16384)}function Ik(A){var e=A.stack,t=A.fv;exports.DEBUG&&console.log(A.step,"GFV[]"),e.push(t.x*16384),e.push(t.y*16384)}function Ck(A){A.fv=A.pv,exports.DEBUG&&console.log(A.step,"SFVTPV[]")}function lk(A){var e=A.stack,t=e.pop(),i=e.pop(),o=e.pop(),n=e.pop(),r=e.pop(),g=A.z0,s=A.z1,a=g[t],I=g[i],l=s[o],C=s[n],Q=A.z2[r];exports.DEBUG&&console.log("ISECT[], ",t,i,o,n,r);var h=a.x,f=a.y,u=I.x,E=I.y,D=l.x,c=l.y,d=C.x,p=C.y,v=(h-u)*(c-p)-(f-E)*(D-d),N=h*E-f*u,G=D*p-c*d;Q.x=(N*(D-d)-G*(h-u))/v,Q.y=(N*(c-p)-G*(f-E))/v}function Bk(A){A.rp0=A.stack.pop(),exports.DEBUG&&console.log(A.step,"SRP0[]",A.rp0)}function Qk(A){A.rp1=A.stack.pop(),exports.DEBUG&&console.log(A.step,"SRP1[]",A.rp1)}function ck(A){A.rp2=A.stack.pop(),exports.DEBUG&&console.log(A.step,"SRP2[]",A.rp2)}function Ek(A){var e=A.stack.pop();switch(exports.DEBUG&&console.log(A.step,"SZP0[]",e),A.zp0=e,e){case 0:A.tZone||Gn(A),A.z0=A.tZone;break;case 1:A.z0=A.gZone;break;default:throw new Error("Invalid zone pointer")}}function uk(A){var e=A.stack.pop();switch(exports.DEBUG&&console.log(A.step,"SZP1[]",e),A.zp1=e,e){case 0:A.tZone||Gn(A),A.z1=A.tZone;break;case 1:A.z1=A.gZone;break;default:throw new Error("Invalid zone pointer")}}function hk(A){var e=A.stack.pop();switch(exports.DEBUG&&console.log(A.step,"SZP2[]",e),A.zp2=e,e){case 0:A.tZone||Gn(A),A.z2=A.tZone;break;case 1:A.z2=A.gZone;break;default:throw new Error("Invalid zone pointer")}}function fk(A){var e=A.stack.pop();switch(exports.DEBUG&&console.log(A.step,"SZPS[]",e),A.zp0=A.zp1=A.zp2=e,e){case 0:A.tZone||Gn(A),A.z0=A.z1=A.z2=A.tZone;break;case 1:A.z0=A.z1=A.z2=A.gZone;break;default:throw new Error("Invalid zone pointer")}}function dk(A){A.loop=A.stack.pop(),exports.DEBUG&&console.log(A.step,"SLOOP[]",A.loop)}function pk(A){exports.DEBUG&&console.log(A.step,"RTG[]"),A.round=Rl}function mk(A){exports.DEBUG&&console.log(A.step,"RTHG[]"),A.round=ik}function yk(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"SMD[]",e),A.minDis=e/64}function wk(A){exports.DEBUG&&console.log(A.step,"ELSE[]"),Nl(A,!1)}function Dk(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"JMPR[]",e),A.ip+=e-1}function kk(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"SCVTCI[]",e),A.cvCutIn=e/64}function vk(A){var e=A.stack;exports.DEBUG&&console.log(A.step,"DUP[]"),e.push(e[e.length-1])}function $n(A){exports.DEBUG&&console.log(A.step,"POP[]"),A.stack.pop()}function Fk(A){exports.DEBUG&&console.log(A.step,"CLEAR[]"),A.stack.length=0}function Sk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"SWAP[]"),e.push(t),e.push(i)}function Rk(A){var e=A.stack;exports.DEBUG&&console.log(A.step,"DEPTH[]"),e.push(e.length)}function bk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"LOOPCALL[]",t,i);var o=A.ip,n=A.prog;A.prog=A.funcs[t];for(var r=0;r1?"loop "+(e.loop-g)+": ":"")+"SHP["+(A?"rp1":"rp2")+"]",a)}e.loop=1}function ka(A,e){var t=e.stack,i=A?e.rp1:e.rp2,o=(A?e.z0:e.z1)[i],n=e.fv,r=e.pv,g=t.pop(),s=e.z2[e.contours[g]],a=s;exports.DEBUG&&console.log(e.step,"SHC["+A+"]",g);var I=r.distance(o,o,!1,!0);do a!==o&&n.setRelative(a,a,I,r),a=a.nextPointOnContour;while(a!==s)}function va(A,e){var t=e.stack,i=A?e.rp1:e.rp2,o=(A?e.z0:e.z1)[i],n=e.fv,r=e.pv,g=t.pop();exports.DEBUG&&console.log(e.step,"SHZ["+A+"]",g);var s;switch(g){case 0:s=e.tZone;break;case 1:s=e.gZone;break;default:throw new Error("Invalid zone")}for(var a,I=r.distance(o,o,!1,!0),l=s.length-2,C=0;C1?"loop "+(A.loop-t)+": ":"")+"SHPIX[]",r,o),i.setRelative(g,g,o),i.touch(g)}A.loop=1}function xk(A){for(var e=A.stack,t=A.rp1,i=A.rp2,o=A.loop,n=A.z0[t],r=A.z1[i],g=A.fv,s=A.dpv,a=A.z2;o--;){var I=e.pop(),l=a[I];exports.DEBUG&&console.log(A.step,(A.loop>1?"loop "+(A.loop-o)+": ":"")+"IP[]",I,t,"<->",i),g.interpolate(l,n,r,s),g.touch(l)}A.loop=1}function Fa(A,e){var t=e.stack,i=t.pop()/64,o=t.pop(),n=e.z1[o],r=e.z0[e.rp0],g=e.fv,s=e.pv;g.setRelative(n,r,i,s),g.touch(n),exports.DEBUG&&console.log(e.step,"MSIRP["+A+"]",i,o),e.rp1=e.rp0,e.rp2=o,A&&(e.rp0=o)}function Jk(A){for(var e=A.stack,t=A.rp0,i=A.z0[t],o=A.loop,n=A.fv,r=A.pv,g=A.z1;o--;){var s=e.pop(),a=g[s];exports.DEBUG&&console.log(A.step,(A.loop>1?"loop "+(A.loop-o)+": ":"")+"ALIGNRP[]",s),n.setRelative(a,i,0,r),n.touch(a)}A.loop=1}function Tk(A){exports.DEBUG&&console.log(A.step,"RTDG[]"),A.round=tk}function Sa(A,e){var t=e.stack,i=t.pop(),o=t.pop(),n=e.z0[o],r=e.fv,g=e.pv,s=e.cvt[i];exports.DEBUG&&console.log(e.step,"MIAP["+A+"]",i,"(",s,")",o);var a=g.distance(n,lo);A&&(Math.abs(a-s)",g),e.stack.push(Math.round(g*64))}function Vk(A){exports.DEBUG&&console.log(A.step,"MPPEM[]"),A.stack.push(A.ppem)}function Wk(A){exports.DEBUG&&console.log(A.step,"FLIPON[]"),A.autoFlip=!0}function qk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"LT[]",t,i),e.push(it?1:0)}function Xk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"GTEQ[]",t,i),e.push(i>=t?1:0)}function zk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"EQ[]",t,i),e.push(t===i?1:0)}function $k(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"NEQ[]",t,i),e.push(t!==i?1:0)}function Av(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"ODD[]",t),e.push(Math.trunc(t)%2?1:0)}function ev(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"EVEN[]",t),e.push(Math.trunc(t)%2?0:1)}function tv(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"IF[]",e),e||(Nl(A,!0),exports.DEBUG&&console.log(A.step,"EIF[]"))}function iv(A){exports.DEBUG&&console.log(A.step,"EIF[]")}function ov(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"AND[]",t,i),e.push(t&&i?1:0)}function nv(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"OR[]",t,i),e.push(t||i?1:0)}function rv(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"NOT[]",t),e.push(t?0:1)}function Ar(A,e){var t=e.stack,i=t.pop(),o=e.fv,n=e.pv,r=e.ppem,g=e.deltaBase+(A-1)*16,s=e.deltaShift,a=e.z0;exports.DEBUG&&console.log(e.step,"DELTAP["+A+"]",i,t);for(var I=0;I>4);if(Q===r){var h=(C&15)-8;h>=0&&h++,exports.DEBUG&&console.log(e.step,"DELTAPFIX",l,"by",h*s);var f=a[l];o.setRelative(f,f,h*s,n)}}}function gv(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"SDB[]",t),A.deltaBase=t}function sv(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"SDS[]",t),A.deltaShift=Math.pow(.5,t)}function av(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"ADD[]",t,i),e.push(i+t)}function Iv(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"SUB[]",t,i),e.push(i-t)}function Cv(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"DIV[]",t,i),e.push(i*64/t)}function lv(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"MUL[]",t,i),e.push(i*t/64)}function Bv(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"ABS[]",t),e.push(Math.abs(t))}function Qv(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"NEG[]",t),e.push(-t)}function cv(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"FLOOR[]",t),e.push(Math.floor(t/64)*64)}function Ev(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"CEILING[]",t),e.push(Math.ceil(t/64)*64)}function xo(A,e){var t=e.stack,i=t.pop();exports.DEBUG&&console.log(e.step,"ROUND[]"),t.push(e.round(i/64)*64)}function uv(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"WCVTF[]",t,i),A.cvt[i]=t*A.ppem/A.font.unitsPerEm}function er(A,e){var t=e.stack,i=t.pop(),o=e.ppem,n=e.deltaBase+(A-1)*16,r=e.deltaShift;exports.DEBUG&&console.log(e.step,"DELTAC["+A+"]",i,t);for(var g=0;g>4);if(I===o){var l=(a&15)-8;l>=0&&l++;var C=l*r;exports.DEBUG&&console.log(e.step,"DELTACFIX",s,"by",C),e.cvt[s]+=C}}}function hv(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"SROUND[]",e),A.round=bl;var t;switch(e&192){case 0:t=.5;break;case 64:t=1;break;case 128:t=2;break;default:throw new Error("invalid SROUND value")}switch(A.srPeriod=t,e&48){case 0:A.srPhase=0;break;case 16:A.srPhase=.25*t;break;case 32:A.srPhase=.5*t;break;case 48:A.srPhase=.75*t;break;default:throw new Error("invalid SROUND value")}e&=15,e===0?A.srThreshold=0:A.srThreshold=(e/8-.5)*t}function fv(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"S45ROUND[]",e),A.round=bl;var t;switch(e&192){case 0:t=Math.sqrt(2)/2;break;case 64:t=Math.sqrt(2);break;case 128:t=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(A.srPeriod=t,e&48){case 0:A.srPhase=0;break;case 16:A.srPhase=.25*t;break;case 32:A.srPhase=.5*t;break;case 48:A.srPhase=.75*t;break;default:throw new Error("invalid S45ROUND value")}e&=15,e===0?A.srThreshold=0:A.srThreshold=(e/8-.5)*t}function dv(A){exports.DEBUG&&console.log(A.step,"ROFF[]"),A.round=ek}function pv(A){exports.DEBUG&&console.log(A.step,"RUTG[]"),A.round=ok}function mv(A){exports.DEBUG&&console.log(A.step,"RDTG[]"),A.round=nk}function yv(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"SCANCTRL[]",e)}function Na(A,e){var t=e.stack,i=t.pop(),o=t.pop(),n=e.z2[i],r=e.z1[o];exports.DEBUG&&console.log(e.step,"SDPVTL["+A+"]",i,o);var g,s;A?(g=n.y-r.y,s=r.x-n.x):(g=r.x-n.x,s=r.y-n.y),e.dpv=Do(g,s)}function wv(A){var e=A.stack,t=e.pop(),i=0;exports.DEBUG&&console.log(A.step,"GETINFO[]",t),t&1&&(i=35),t&32&&(i|=4096),e.push(i)}function Dv(A){var e=A.stack,t=e.pop(),i=e.pop(),o=e.pop();exports.DEBUG&&console.log(A.step,"ROLL[]"),e.push(i),e.push(t),e.push(o)}function kv(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"MAX[]",t,i),e.push(Math.max(i,t))}function vv(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"MIN[]",t,i),e.push(Math.min(i,t))}function Fv(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"SCANTYPE[]",e)}function Sv(A){var e=A.stack.pop(),t=A.stack.pop();switch(exports.DEBUG&&console.log(A.step,"INSTCTRL[]",e,t),e){case 1:A.inhibitGridFit=!!t;return;case 2:A.ignoreCvt=!!t;return;default:throw new Error("invalid INSTCTRL[] selector")}}function bt(A,e){var t=e.stack,i=e.prog,o=e.ip;exports.DEBUG&&console.log(e.step,"PUSHB["+A+"]");for(var n=0;n=0?1:-1,u=Math.abs(u),A&&(D=n.cvt[g],i&&Math.abs(u-D)":"_")+(i?"R":"_")+(o===0?"Gr":o===1?"Bl":o===2?"Wh":"")+"]",A?g+"("+n.cvt[g]+","+D+")":"",s,"(d =",f,"->",E*u,")"),n.rp1=n.rp0,n.rp2=s,e&&(n.rp0=s)}vl=[ha.bind(void 0,pt),ha.bind(void 0,ot),fa.bind(void 0,pt),fa.bind(void 0,ot),da.bind(void 0,pt),da.bind(void 0,ot),pa.bind(void 0,0),pa.bind(void 0,1),ma.bind(void 0,0),ma.bind(void 0,1),gk,sk,ak,Ik,Ck,lk,Bk,Qk,ck,Ek,uk,hk,fk,dk,pk,mk,yk,wk,Dk,kk,void 0,void 0,vk,$n,Fk,Sk,Rk,Gk,Lk,void 0,void 0,void 0,bk,Nk,Uk,void 0,ya.bind(void 0,0),ya.bind(void 0,1),wa.bind(void 0,pt),wa.bind(void 0,ot),Da.bind(void 0,0),Da.bind(void 0,1),ka.bind(void 0,0),ka.bind(void 0,1),va.bind(void 0,0),va.bind(void 0,1),Mk,xk,Fa.bind(void 0,0),Fa.bind(void 0,1),Jk,Tk,Sa.bind(void 0,0),Sa.bind(void 0,1),Hk,Yk,_k,Kk,Ok,Pk,Ra.bind(void 0,0),Ra.bind(void 0,1),void 0,ba.bind(void 0,0),ba.bind(void 0,1),Vk,void 0,Wk,void 0,void 0,qk,jk,Zk,Xk,zk,$k,Av,ev,tv,iv,ov,nv,rv,Ar.bind(void 0,1),gv,sv,av,Iv,Cv,lv,Bv,Qv,cv,Ev,xo.bind(void 0,0),xo.bind(void 0,1),xo.bind(void 0,2),xo.bind(void 0,3),void 0,void 0,void 0,void 0,uv,Ar.bind(void 0,2),Ar.bind(void 0,3),er.bind(void 0,1),er.bind(void 0,2),er.bind(void 0,3),hv,fv,void 0,void 0,dv,void 0,pv,mv,$n,$n,void 0,void 0,void 0,void 0,void 0,yv,Na.bind(void 0,0),Na.bind(void 0,1),wv,void 0,Dv,kv,vv,Fv,Sv,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,bt.bind(void 0,1),bt.bind(void 0,2),bt.bind(void 0,3),bt.bind(void 0,4),bt.bind(void 0,5),bt.bind(void 0,6),bt.bind(void 0,7),bt.bind(void 0,8),Nt.bind(void 0,1),Nt.bind(void 0,2),Nt.bind(void 0,3),Nt.bind(void 0,4),Nt.bind(void 0,5),Nt.bind(void 0,6),Nt.bind(void 0,7),Nt.bind(void 0,8),CA.bind(void 0,0,0,0,0,0),CA.bind(void 0,0,0,0,0,1),CA.bind(void 0,0,0,0,0,2),CA.bind(void 0,0,0,0,0,3),CA.bind(void 0,0,0,0,1,0),CA.bind(void 0,0,0,0,1,1),CA.bind(void 0,0,0,0,1,2),CA.bind(void 0,0,0,0,1,3),CA.bind(void 0,0,0,1,0,0),CA.bind(void 0,0,0,1,0,1),CA.bind(void 0,0,0,1,0,2),CA.bind(void 0,0,0,1,0,3),CA.bind(void 0,0,0,1,1,0),CA.bind(void 0,0,0,1,1,1),CA.bind(void 0,0,0,1,1,2),CA.bind(void 0,0,0,1,1,3),CA.bind(void 0,0,1,0,0,0),CA.bind(void 0,0,1,0,0,1),CA.bind(void 0,0,1,0,0,2),CA.bind(void 0,0,1,0,0,3),CA.bind(void 0,0,1,0,1,0),CA.bind(void 0,0,1,0,1,1),CA.bind(void 0,0,1,0,1,2),CA.bind(void 0,0,1,0,1,3),CA.bind(void 0,0,1,1,0,0),CA.bind(void 0,0,1,1,0,1),CA.bind(void 0,0,1,1,0,2),CA.bind(void 0,0,1,1,0,3),CA.bind(void 0,0,1,1,1,0),CA.bind(void 0,0,1,1,1,1),CA.bind(void 0,0,1,1,1,2),CA.bind(void 0,0,1,1,1,3),CA.bind(void 0,1,0,0,0,0),CA.bind(void 0,1,0,0,0,1),CA.bind(void 0,1,0,0,0,2),CA.bind(void 0,1,0,0,0,3),CA.bind(void 0,1,0,0,1,0),CA.bind(void 0,1,0,0,1,1),CA.bind(void 0,1,0,0,1,2),CA.bind(void 0,1,0,0,1,3),CA.bind(void 0,1,0,1,0,0),CA.bind(void 0,1,0,1,0,1),CA.bind(void 0,1,0,1,0,2),CA.bind(void 0,1,0,1,0,3),CA.bind(void 0,1,0,1,1,0),CA.bind(void 0,1,0,1,1,1),CA.bind(void 0,1,0,1,1,2),CA.bind(void 0,1,0,1,1,3),CA.bind(void 0,1,1,0,0,0),CA.bind(void 0,1,1,0,0,1),CA.bind(void 0,1,1,0,0,2),CA.bind(void 0,1,1,0,0,3),CA.bind(void 0,1,1,0,1,0),CA.bind(void 0,1,1,0,1,1),CA.bind(void 0,1,1,0,1,2),CA.bind(void 0,1,1,0,1,3),CA.bind(void 0,1,1,1,0,0),CA.bind(void 0,1,1,1,0,1),CA.bind(void 0,1,1,1,0,2),CA.bind(void 0,1,1,1,0,3),CA.bind(void 0,1,1,1,1,0),CA.bind(void 0,1,1,1,1,1),CA.bind(void 0,1,1,1,1,2),CA.bind(void 0,1,1,1,1,3)];function Ui(A){this.char=A,this.state={},this.activeState=null}function yg(A,e,t){this.contextName=t,this.startIndex=A,this.endOffset=e}function Rv(A,e,t){this.contextName=A,this.openRange=null,this.ranges=[],this.checkStart=e,this.checkEnd=t}function Ve(A,e){this.context=A,this.index=e,this.length=A.length,this.current=A[e],this.backtrack=A.slice(0,e),this.lookahead=A.slice(e+1)}function Ln(A){this.eventId=A,this.subscribers=[]}function bv(A){var e=this,t=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];t.forEach(function(o){Object.defineProperty(e.events,o,{value:new Ln(o)})}),A&&t.forEach(function(o){var n=A[o];typeof n=="function"&&e.events[o].subscribe(n)});var i=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];i.forEach(function(o){e.events[o].subscribe(e.updateContextsRanges)})}function zA(A){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],bv.call(this,A)}Ui.prototype.setState=function(A,e){return this.state[A]=e,this.activeState={key:A,value:this.state[A]},this.activeState};Ui.prototype.getState=function(A){return this.state[A]||null};zA.prototype.inboundIndex=function(A){return A>=0&&A0&&A<=this.lookahead.length):return this.lookahead[A-1];default:return null}};zA.prototype.rangeToText=function(A){if(A instanceof yg)return this.getRangeTokens(A).map(function(e){return e.char}).join("")};zA.prototype.getText=function(){return this.tokens.map(function(A){return A.char}).join("")};zA.prototype.getContext=function(A){var e=this.registeredContexts[A];return e||null};zA.prototype.on=function(A,e){var t=this.events[A];return t?t.subscribe(e):null};zA.prototype.dispatch=function(A,e){var t=this,i=this.events[A];i instanceof Ln&&i.subscribers.forEach(function(o){o.apply(t,e||[])})};zA.prototype.registerContextChecker=function(A,e,t){if(this.getContext(A))return{FAIL:"context name '"+A+"' is already registered."};if(typeof e!="function")return{FAIL:"missing context start check."};if(typeof t!="function")return{FAIL:"missing context end check."};var i=new Rv(A,e,t);return this.registeredContexts[A]=i,this.contextCheckers.push(i),i};zA.prototype.getRangeTokens=function(A){var e=A.startIndex+A.endOffset;return[].concat(this.tokens.slice(A.startIndex,e))};zA.prototype.getContextRanges=function(A){var e=this.getContext(A);return e?e.ranges:{FAIL:"context checker '"+A+"' is not registered."}};zA.prototype.resetContextsRanges=function(){var A=this.registeredContexts;for(var e in A)if(A.hasOwnProperty(e)){var t=A[e];t.ranges=[]}};zA.prototype.updateContextsRanges=function(){this.resetContextsRanges();for(var A=this.tokens.map(function(i){return i.char}),e=0;e=o.start&&A<=o.end){var n=A-o.start;return o.index+n}}break;default:return-1}return-1}function Gv(A,e){var t=ko(A,e.coverage);return t===-1?null:A+e.deltaGlyphId}function Lv(A,e){var t=ko(A,e.coverage);return t===-1?null:e.substitute[t]}function tr(A,e){for(var t=[],i=0;i=0;t--){var i=e[t],o=Gl(i),n=Pt(i);if(!o&&!n)return!0;if(o)return!1}return!1}function jv(A){if(Gl(A.current))return!1;for(var e=0;e0}t("fontFamily"),t("weightName"),t("manufacturer"),t("copyright"),t("version"),this.unitsPerEm>0};YA.prototype.toTables=function(){return WD.fontToTable(this)};YA.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()};YA.prototype.toArrayBuffer=function(){for(var A=this.toTables(),e=A.encode(),t=new ArrayBuffer(e.length),i=new Uint8Array(t),o=0;o=1.2&&(o.markGlyphSets=t.parsePointer(hF)),o}var dF={parse:fF},We=new Array(10);We[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{posFormat:1,coverage:this.parsePointer(J.coverage),value:this.parseValueRecord()};if(t===2)return{posFormat:2,coverage:this.parsePointer(J.coverage),values:this.parseValueRecordList()};mA.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")};We[2]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();mA.assert(t===1||t===2,"0x"+e.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");var i=this.parsePointer(J.coverage),o=this.parseUShort(),n=this.parseUShort();if(t===1)return{posFormat:t,coverage:i,valueFormat1:o,valueFormat2:n,pairSets:this.parseList(J.pointer(J.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(o),value2:this.parseValueRecord(n)}})))};if(t===2){var r=this.parsePointer(J.classDef),g=this.parsePointer(J.classDef),s=this.parseUShort(),a=this.parseUShort();return{posFormat:t,coverage:i,valueFormat1:o,valueFormat2:n,classDef1:r,classDef2:g,class1Count:s,class2Count:a,classRecords:this.parseList(s,J.list(a,function(){return{value1:this.parseValueRecord(o),value2:this.parseValueRecord(n)}}))}}};We[3]=function(){return{error:"GPOS Lookup 3 not supported"}};We[4]=function(){return{error:"GPOS Lookup 4 not supported"}};We[5]=function(){return{error:"GPOS Lookup 5 not supported"}};We[6]=function(){return{error:"GPOS Lookup 6 not supported"}};We[7]=function(){return{error:"GPOS Lookup 7 not supported"}};We[8]=function(){return{error:"GPOS Lookup 8 not supported"}};We[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function pF(A,e){e=e||0;var t=new J(A,e),i=t.parseVersion(1);return mA.argument(i===1||i===1.1,"Unsupported GPOS table version "+i),i===1?{version:i,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(We)}:{version:i,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(We),variations:t.parseFeatureVariationsList()}}var mF=new Array(10);function yF(A){return new aA.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new aA.ScriptList(A.scripts)},{name:"features",type:"TABLE",value:new aA.FeatureList(A.features)},{name:"lookups",type:"TABLE",value:new aA.LookupList(A.lookups,mF)}])}var wF={parse:pF,make:yF};function DF(A){var e={};A.skip("uShort");var t=A.parseUShort();mA.argument(t===0,"Unsupported kern sub-table version."),A.skip("uShort",2);var i=A.parseUShort();A.skip("uShort",3);for(var o=0;o1&&console.warn("Only the first kern subtable is supported."),A.skip("uLong");var i=A.parseUShort(),o=i&255;if(A.skip("uShort"),o===0){var n=A.parseUShort();A.skip("uShort",3);for(var r=0;r"u",o=i&&!t.isUrl?bF:NF;return new Promise(function(n,r){o(A,function(g,s){if(g){if(e)return e(g);r(g)}var a;try{a=kg(s,t)}catch(I){if(e)return e(I,null);r(I)}if(e)return e(null,a);n(a)})})}function UF(A,e){var t=require("fs"),i=t.readFileSync(A);return kg(ml(i),e)}var Hr=Object.freeze({__proto__:null,Font:YA,Glyph:Ne,Path:ie,BoundingBox:St,_parse:lA,parse:kg,load:LF,loadSync:UF});const MF="modulepreload",xF=function(A,e){return new URL(A,e).href},xa={},Ul=function(e,t,i){let o=Promise.resolve();if(t&&t.length>0){const r=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),s=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));o=Promise.allSettled(t.map(a=>{if(a=xF(a,i),a in xa)return;xa[a]=!0;const I=a.endsWith(".css"),l=I?'[rel="stylesheet"]':"";if(!!i)for(let h=r.length-1;h>=0;h--){const f=r[h];if(f.href===a&&(!I||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${l}`))return;const Q=document.createElement("link");if(Q.rel=I?"stylesheet":MF,I||(Q.as="script"),Q.crossOrigin="",Q.href=a,s&&Q.setAttribute("nonce",s),document.head.appendChild(Q),I)return new Promise((h,f)=>{Q.addEventListener("load",h),Q.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${a}`)))})}))}function n(r){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=r,window.dispatchEvent(g),!g.defaultPrevented)throw r}return o.then(r=>{for(const g of r||[])g.status==="rejected"&&n(g.reason);return e().catch(n)})},JF=()=>Ul(()=>import("./ft_render-ByO_jG18.js"),[],import.meta.url);let j=null,Bo=0;const TF=new Promise(A=>{JF().then(e=>{e.default().then(t=>{j=t,A()})})});function Ja(A){return A/65536}function Ue(A){return A/64}function Hi(A){return A>=0?A:A+256}let Ml,xl,Jl,vg,Tl,Hl,Yl;async function HF(){if(await TF,j._init_constants(),Ml=j.cwrap("FT_New_Memory_Face","number",["number","number","number","number","number"]),xl=j.cwrap("FT_Set_Char_Size","number",["number","number","number","number","number"]),Jl=j.cwrap("FT_Set_Pixel_Sizes","number",["number","number","number"]),vg=j.cwrap("FT_Get_Char_Index","number",["number","number"]),Tl=j.cwrap("FT_Load_Glyph","number",["number","number","number"]),Hl=j.cwrap("FT_Get_Sfnt_Table","number",["number","number"]),j.cwrap("FT_Get_Kerning","number",["number","number","number","number","number"]),Yl=j.cwrap("FT_Done_Face","number",["number"]),!Bo){let A=j._malloc(4);try{let e=j.ccall("FT_Init_FreeType","number",["number"],[A]);if(e)throw new Error(`error in FT_Init_FreeType: ${e}`);Bo=j.getValue(A,"i32")}finally{j._free(A)}}}function YF(A,e){let t,i;if(A instanceof ArrayBuffer)i=A.byteLength;else if(A instanceof Uint8Array)i=A.byteLength;else if(A&&typeof A.length=="number")i=A.length;else throw new Error("Invalid font source format");let o={ptr:0,font:j._malloc(i)};const n=A instanceof ArrayBuffer?new Uint8Array(A):A;j.writeArrayToMemory(n,o.font);let r=j._malloc(4);try{if(t=Ml(Bo,o.font,i,0,r),t)throw new Error(`error in FT_New_Memory_Face: ${t}`);o.ptr=j.getValue(r,"i32")}finally{j._free(r)}if(t=xl(o.ptr,0,e*64,300,300),t)throw new Error(`error in FT_Set_Char_Size: ${t}`);if(t=Jl(o.ptr,0,e),t)throw new Error(`error in FT_Set_Pixel_Sizes: ${t}`);let g=j.getValue(o.ptr+j.OFFSET_FACE_UNITS_PER_EM,"i16"),s=j.getValue(o.ptr+j.OFFSET_FACE_ASCENDER,"i16"),a=j.getValue(o.ptr+j.OFFSET_FACE_DESCENDER,"i16"),I=j.getValue(o.ptr+j.OFFSET_FACE_HEIGHT,"i16");return Object.assign(o,{units_per_em:g,ascender:s,descender:a,height:I})}function _F(A){let e=Hl(A.ptr,j.FT_SFNT_OS2);if(!e)throw new Error("os/2 table not found for this font");let t=j.getValue(e+j.OFFSET_TT_OS2_ASCENDER,"i16"),i=j.getValue(e+j.OFFSET_TT_OS2_DESCENDER,"i16"),o=j.getValue(e+j.OFFSET_TT_OS2_LINEGAP,"i16");return{typoAscent:t,typoDescent:i,typoLineGap:o}}function or(A,e){return vg(A.ptr,e)!==0}function KF(A,e,t={}){let i=vg(A.ptr,e);if(i===0)throw new Error(`glyph does not exist for codepoint ${e}`);let o=j.FT_LOAD_RENDER;t.mono?o|=j.FT_LOAD_TARGET_MONO:t.lcd?o|=j.FT_LOAD_TARGET_LCD:t.lcd_v?o|=j.FT_LOAD_TARGET_LCD_V:t.autohint_strong?o|=j.FT_LOAD_TARGET_NORMAL:o|=j.FT_LOAD_TARGET_LIGHT,t.autohint_off?o|=j.FT_LOAD_NO_AUTOHINT:o|=j.FT_LOAD_FORCE_AUTOHINT,t.use_color_info&&(o|=j.FT_LOAD_COLOR);let n=Tl(A.ptr,i,o);if(n)throw new Error(`error in FT_Load_Glyph: ${n}`);let r=j.getValue(A.ptr+j.OFFSET_FACE_GLYPH,"i32"),g={glyph_index:j.getValue(r+j.OFFSET_GLYPH_INDEX,"i32"),metrics:{width:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_WIDTH,"i32")),height:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_HEIGHT,"i32")),horiBearingX:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_HORI_BEARING_X,"i32")),horiBearingY:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_HORI_BEARING_Y,"i32")),horiAdvance:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_HORI_ADVANCE,"i32")),vertBearingX:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_VERT_BEARING_X,"i32")),vertBearingY:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_VERT_BEARING_Y,"i32")),vertAdvance:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_VERT_ADVANCE,"i32"))},linearHoriAdvance:Ja(j.getValue(r+j.OFFSET_GLYPH_LINEAR_HORI_ADVANCE,"i32")),linearVertAdvance:Ja(j.getValue(r+j.OFFSET_GLYPH_LINEAR_VERT_ADVANCE,"i32")),advance:{x:Ue(j.getValue(r+j.OFFSET_GLYPH_ADVANCE_X,"i32")),y:Ue(j.getValue(r+j.OFFSET_GLYPH_ADVANCE_Y,"i32"))},bitmap:{width:j.getValue(r+j.OFFSET_GLYPH_BITMAP_WIDTH,"i32"),rows:j.getValue(r+j.OFFSET_GLYPH_BITMAP_ROWS,"i32"),pitch:j.getValue(r+j.OFFSET_GLYPH_BITMAP_PITCH,"i32"),num_grays:j.getValue(r+j.OFFSET_GLYPH_BITMAP_NUM_GRAYS,"i16"),pixel_mode:j.getValue(r+j.OFFSET_GLYPH_BITMAP_PIXEL_MODE,"i8"),palette_mode:j.getValue(r+j.OFFSET_GLYPH_BITMAP_PALETTE_MODE,"i8")},bitmap_left:j.getValue(r+j.OFFSET_GLYPH_BITMAP_LEFT,"i32"),bitmap_top:j.getValue(r+j.OFFSET_GLYPH_BITMAP_TOP,"i32"),lsb_delta:Ue(j.getValue(r+j.OFFSET_GLYPH_LSB_DELTA,"i32")),rsb_delta:Ue(j.getValue(r+j.OFFSET_GLYPH_RSB_DELTA,"i32"))},s=g.bitmap.width,a=g.bitmap.rows,I=g.bitmap_left,l=g.bitmap_top,C=j.getValue(r+j.OFFSET_GLYPH_BITMAP_BUFFER,"i32"),Q=Math.abs(g.bitmap.pitch),h=g.linearHoriAdvance,f=g.linearVertAdvance,u=g.bitmap.pixel_mode,E=[];for(let D=0;D255&&(S=255),H=(255-S)*H/255,d.push(H)}else{let v=j.getValue(c+p,"i8");d.push(Hi(v))}E.push(d)}return{x:I,y:l,width:s,height:a,advance_x:h,advance_y:f,pixels:E,freetype:g}}function OF(A){let e=Yl(A.ptr);if(e)throw new Error(`error in FT_Done_Face: ${e}`);j._free(A.font),A.ptr=0,A.font=0}function PF(){let A=j.ccall("FT_Done_FreeType","number",["number"],[Bo]);if(A)throw new Error(`error in FT_Done_FreeType: ${A}`);Bo=0}class yt extends Error{constructor(e){super(e),this.name="AppError",Error.captureStackTrace&&Error.captureStackTrace(this,yt)}}class VF{constructor(){this.data={}}add_range(e,t,i,o){let n=o-t,r=[];for(let g=t;g<=i;g++)this._set_char(e,g,g+n),r.push(g);return r}add_symbols(e,t){let i=[];for(let o of t){let n=o.codePointAt(0);this._set_char(e,n,n),i.push(n)}return i}_set_char(e,t,i){this.data[i]={font:e,code:t}}get(){return this.data}}async function WF(A){await HF();let e={};A.font.forEach(C=>{e[C.source_path]=C});let t={},i={};for(let{source_path:C,source_bin:Q}of A.font)if(!t[C])try{let h=Q;h instanceof File?h=await h.arrayBuffer():h instanceof Uint8Array&&(h=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength)),t[C]=Hr.parse(h),i[C]=YF(h,A.size)}catch(h){throw new yt(`Cannot load font "${C}": ${h.message}`)}let o=new VF;for(let{source_path:C,ranges:Q}of A.font){let h=i[C];for(let f of Q){if(f.range)for(let u=0;uC-Q).map(Number);for(let C of g){let Q=n[C].code,h=n[C].font;if(!or(i[h],Q))continue;let f=KF(i[h],Q,{autohint_off:e[h].autohint_off,autohint_strong:e[h].autohint_strong,lcd:A.lcd,lcd_v:A.lcd_v,mono:!A.lcd&&!A.lcd_v&&A.bpp===1,use_color_info:A.use_color_info});r.push({code:C,advanceWidth:f.advance_x,bbox:{x:f.x,y:f.y-f.height,width:f.width,height:f.height},kerning:{},freetype:f.freetype,pixels:f.pixels})}if(!A.no_kerning){let C=r.map(Q=>Q.code);for(let{code:Q,kerning:h}of r){let f=n[Q].code,u=n[Q].font,E=t[u],D=E.charToGlyph(String.fromCodePoint(f));for(let c of C){if(n[c].font!==u)continue;let d=n[c].code,p=E.charToGlyph(String.fromCodePoint(d)),v=E.getKerningValue(D,p);v&&(h[c]=v*A.size/E.unitsPerEm)}}}let s=i[A.font[0].source_path],a=A.size/s.units_per_em,I=_F(s),l=t[A.font[0].source_path].tables.post;for(let C of Object.values(i))OF(C);return PF(),{ascent:Math.max(...r.map(C=>C.bbox.y+C.bbox.height)),descent:Math.min(...r.map(C=>C.bbox.y)),typoAscent:Math.round(I.typoAscent*a),typoDescent:Math.round(I.typoDescent*a),typoLineGap:Math.round(I.typoLineGap*a),size:A.size,glyphs:r,underlinePosition:Math.round(l.underlinePosition*a),underlineThickness:Math.round(l.underlineThickness*a)}}function qF(){return 16}function jF(A,e){return 16+(e-A+1)}function ZF(A){return 16+A*2}function Ta(A){A=A.sort((i,o)=>i-o);let e=[];for(let i=0;i=0?e[n-1].dist:0,g;A[i]-A[n]<256&&(g=jF(A[n],A[i]),r+g=0;){let o=e[i];t.unshift([o.format,A.slice(o.start,o.end+1)]),i=o.start-1}return t}const De=4,XF=(A,e,t)=>{A.setUint32(t,e,!0),A.setUint32(t+4,0,!0)};class zF{constructor(e,t){if(this.src=e,this.opts=t,this.font_name=t.lv_font_name,this.font_name||(this.font_name=t.output||"font"),t.bpp===3&&t.no_compress)throw new yt('LVGL supports "--bpp 3" with compression only');this.init_tables()}init_tables(){this.head=new $F(this),this.glyf=new eS(this),this.cmap=new tS(this),this.kern=new iS(this)}toCBin(){const[e,t]=this.glyf.toCBin(),i=this.cmap.toCBin(De),o=this.kern.toCBin(De),n=12+De*6+0,r=8+De*4,g=new ArrayBuffer(n+r),s=new DataView(g),a=(u,E)=>s.setUint32(E,u,!0);var I=0;a(0,I),I+=De,a(0,I),I+=De,a(0,I),I+=De,s.setUint32(I,this.src.ascent-this.src.descent,!0),I+=4,s.setInt32(I,-this.src.descent,!0),I+=4,s.setUint8(I,this.src.subpixels_mode||0),I+=1,s.setInt8(I,this.src.underlinePosition||0),I+=1,s.setInt8(I,this.src.underlineThickness||0),I+=1,I+=1,a(n,I),I+=De,a(0,I),I+=De,a(0,I),I+=De;const l=this.head.kern_ref();a(r+o.byteLength,I),I+=De,a(r+o.byteLength+e.byteLength,I),I+=De,a(r+o.byteLength+e.byteLength+t.byteLength,I),I+=De,a(l.dsc==="NULL"?0:r,I),I+=De,s.setUint16(I,l.scale,!0),I+=2;const C=this.cmap.getMapNumber(),Q=this.opts.bpp,h=l.classes,f=this.glyf.getCompressionCode();return s.setUint16(I,C|Q<<9|h<<13|f<<14,!0),I+=2,this.concatArrayBuffers([g,o,e,t,i])}concatArrayBuffers(e){const t=e.reduce((r,g)=>r+g.byteLength,0),i=new ArrayBuffer(t),o=new Uint8Array(i);let n=0;for(const r of e)o.set(new Uint8Array(r),n),n+=r.byteLength;return i}}class $F{constructor(e){this.font=e}kern_ref(){return this.font,{scale:0,dsc:"NULL",classes:0}}}class AS{constructor(e){this.buffer=new Uint8Array(e),this.byteIndex=0,this.bitIndex=0,this.bigEndian=!0}writeBits(e,t){for(;t>0;){const i=Math.min(8-this.bitIndex,t),o=(1<>t-i&o;this.bigEndian?this.buffer[this.byteIndex]|=n<<8-this.bitIndex-i:this.buffer[this.byteIndex]|=n<=8&&(this.byteIndex++,this.bitIndex=0),t-=i}}getUsedBytes(){return this.bitIndex>0?this.byteIndex+1:this.byteIndex}}class eS{constructor(e){this.font=e,this.lv_data=[],this.lv_compiled=!1}pixelsToBpp(e){const t=this.font.opts.bpp;return e.map(i=>i.map(o=>o>>>8-t))}storePixels(e,t){this.getCompressionCode()===0?this.storePixelsRaw(e,t):this.storePixelsCompressed(e,t)}storePixelsRaw(e,t){const i=this.font.opts.bpp;for(let o=0;o{const o=e.glyph_id[i.code],n=this.lv_bitmap(i);this.lv_data[o]={bin:n,offset:t,glyph:i},t+=n.byteLength})}toCBin(){this.lv_compile();const e=this.lv_data.slice(1).filter(r=>r).map(r=>r.bin),t=this.balign4(this.concatArrayBuffers(e)),i=new ArrayBuffer(this.lv_data.length*16+16),o=new DataView(i);let n=1;return this.lv_data.forEach(r=>{if(r){const g=Math.round(r.glyph.advanceWidth*16);o.setUint32(n*16,r.offset,!0),o.setUint32(n*16+4,g,!0),o.setUint16(n*16+8,r.glyph.bbox.width,!0),o.setUint16(n*16+10,r.glyph.bbox.height,!0),o.setInt16(n*16+12,r.glyph.bbox.x,!0),o.setInt16(n*16+14,r.glyph.bbox.y,!0)}n++}),[t,i]}balign4(e){const t=e.byteLength%4;if(t===0)return e;const i=4-t,o=new ArrayBuffer(i);return this.concatArrayBuffers([e,o])}concatArrayBuffers(e){const t=e.reduce((r,g)=>r+g.byteLength,0),i=new ArrayBuffer(t),o=new Uint8Array(i);let n=0;for(const r of e)o.set(new Uint8Array(r),n),n+=r.byteLength;return i}getCompressionCode(){return this.font.opts.no_compress||this.font.opts.bpp===1?0:this.font.opts.no_prefilter?2:1}}class tS{constructor(e){this.font=e,this.lv_compiled=!1,this.lv_subtables=[],this.subtables_plan=null,this.buildGlyphIdMap()}buildGlyphIdMap(){const e=this.font;e.glyph_id={},e.src.glyphs&&e.src.glyphs.forEach((t,i)=>{e.glyph_id[t.code]=i+1})}lv_format2enum(e){switch(e){case"format0_tiny":return"LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY";case"format0":return"LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL";case"sparse_tiny":return"LV_FONT_FMT_TXT_CMAP_SPARSE_TINY";case"sparse":return"LV_FONT_FMT_TXT_CMAP_SPARSE_FULL";default:throw new Error("Unknown subtable format")}}lv_format2int(e){return["format0","sparse","format0_tiny","sparse_tiny"].indexOf(e)}getMapNumber(){if(!this.subtables_plan){const e=this.font;if(!e.src.glyphs||e.src.glyphs.length===0)return 0;this.subtables_plan=Ta(e.src.glyphs.map(t=>t.code))}return this.subtables_plan.length}glyphByCode(e){const t=this.font;return t.src.glyphs?t.src.glyphs.find(i=>i.code===e):null}collect_format0_data(e,t,i){const o=this.font,n=[];for(let r=e;r<=t;r++){const g=o.glyph_id[r]||0;n.push(g?g-i:0)}return n}collect_sparse_data(e,t){const i=this.font;let o=[],n=[];for(let r of e){let g=this.glyphByCode(r),s=i.glyph_id[g.code],a=r-e[0],I=s-t;if(a<0||a>65535)throw new Error("Codepoint delta out of range");if(I<0||I>65535)throw new Error("Glyph ID delta out of range");o.push(a),n.push(I)}return{codes:o,ids:n}}toCBin(e){const t=this.font;if(!t.src.glyphs||t.src.glyphs.length===0)return new ArrayBuffer(0);this.subtables_plan||(this.subtables_plan=Ta(t.src.glyphs.map(l=>l.code)));const i=this.subtables_plan;let o=0;const n=12+e*2+(e==4?0:4),r=new ArrayBuffer(i.length*n),g=new DataView(r),s=e==4?(l,C)=>g.setUint32(C,l,!0):(l,C)=>XF(g,l,C),a=[];let I=r.byteLength;for(let[l,C]of i){let Q=this.glyphByCode(C[0]),h=t.glyph_id[Q.code],f=C[0],u=C[C.length-1],E=!1,D=!1,c=0,d=new ArrayBuffer(0),p=new ArrayBuffer(0);if(l!=="format0_tiny")if(l==="format0"){D=!0;let N=this.collect_format0_data(f,u,h);c=N.length,d=this.balign4(this.uint8ArrayToBuffer(new Uint8Array(N)))}else if(l==="sparse_tiny"){E=!0;let N=this.collect_sparse_data(C,h);c=N.codes.length,p=this.balign4(this.uint16ArrayToBuffer(new Uint16Array(N.codes)))}else{E=!0,D=!0;let N=this.collect_sparse_data(C,h);c=N.codes.length,p=this.balign4(this.uint16ArrayToBuffer(new Uint16Array(N.codes))),d=this.align4(this.uint16ArrayToBuffer(new Uint16Array(N.ids)))}let v=o*n;g.setUint32(v,f,!0),v+=4,g.setUint16(v,u-f+1,!0),v+=2,g.setUint16(v,h,!0),v+=2,s(E?I:0,v),v+=e,I+=p.byteLength,s(D?I:0,v),v+=e,I+=d.byteLength,g.setUint16(v,c,!0),v+=2,g.setUint8(v,this.lv_format2int(l)),v+=1,a.push(p),a.push(d),o++}return this.concatArrayBuffers([r,...a])}balign4(e){const t=e.byteLength%4;if(t===0)return e;const i=4-t,o=new ArrayBuffer(i);return this.concatArrayBuffers([e,o])}align4(e){const t=e.byteLength%4;if(t===0)return e;const i=4-t,o=new ArrayBuffer(i);return this.concatArrayBuffers([e,o])}uint8ArrayToBuffer(e){const t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}uint16ArrayToBuffer(e){return e.buffer.slice(0,e.byteLength)}concatArrayBuffers(e){const t=e.reduce((r,g)=>r+g.byteLength,0),i=new ArrayBuffer(t),o=new Uint8Array(i);let n=0;for(const r of e)o.set(new Uint8Array(r),n),n+=r.byteLength;return i}}class iS{constructor(e){this.font=e}toCBin(e){return new ArrayBuffer(0)}}function oS(A,e){if(!A.output)throw new yt('Output is required for "cbin" writer');const i=new zF(e,A).toCBin();return{[A.output]:i}}class nS{constructor(){this.initialized=!1,this.supportedFormats=["ttf","woff","woff2","otf"],this.charsetCache=new Map}async initialize(){if(!this.initialized)try{if(typeof Hr>"u")throw new Error("opentype.js not loaded");this.initialized=!0,console.log("BrowserFontConverter 初始化完成")}catch(e){throw console.error("BrowserFontConverter initialization failed:",e),e}}validateFont(e){if(!e)return!1;if(e instanceof File){const t=e.name.toLowerCase(),i=e.type.toLowerCase(),o=this.supportedFormats.some(r=>t.endsWith(`.${r}`)),n=["font/ttf","font/truetype","application/x-font-ttf","font/woff","font/woff2","application/font-woff","font/otf","application/x-font-otf"].some(r=>i.includes(r));return o||n}return e instanceof ArrayBuffer&&e.byteLength>0}async getFontInfo(e){try{let t;if(e instanceof File)t=await e.arrayBuffer();else if(e instanceof ArrayBuffer)t=e;else throw new Error("Unsupported font file type");const i=Hr.parse(t);return{familyName:this.getLocalizedName(i.names.fontFamily)||"Unknown",fullName:this.getLocalizedName(i.names.fullName)||"Unknown",postScriptName:this.getLocalizedName(i.names.postScriptName)||"Unknown",version:this.getLocalizedName(i.names.version)||"Unknown",unitsPerEm:i.unitsPerEm,ascender:i.ascender,descender:i.descender,numGlyphs:i.numGlyphs,supported:!0}}catch(t){return console.error("Failed to get font information:",t),{familyName:"Unknown",supported:!1,error:t.message}}}getLocalizedName(e){return e?e.zh||e["zh-CN"]||e.en||e[Object.keys(e)[0]]:null}async convertToCBIN(e){this.initialized||await this.initialize();const{fontFile:t,fontName:i,fontSize:o=20,bpp:n=4,charset:r="deepseek",symbols:g="",range:s="",compression:a=!1,lcd:I=!1,lcd_v:l=!1,progressCallback:C=null}=e;if(!this.validateFont(t))throw new yt("不支持的字体文件格式");try{C&&C(0,"Starting font processing...");let Q;t instanceof File?Q=await t.arrayBuffer():Q=t,C&&C(10,"Parsing font structure...");const{ranges:h,charSymbols:f}=await this.parseCharacterInputAsync(r,g,s);C&&C(20,"Preparing conversion parameters...");const u={font:[{source_path:i||"custom_font",source_bin:Q,ranges:[{range:h,symbols:f}],autohint_off:!1,autohint_strong:!1}],size:o,bpp:n,lcd:I,lcd_v:l,no_compress:!a,no_kerning:!1,use_color_info:!1,format:"cbin",output:i||"font"};C&&C(30,"Collecting font data...");const E=await WF(u);C&&C(70,"Generating CBIN format...");const D=oS(u,E),c=u.output;return C&&C(100,"Conversion completed!"),D[c]}catch(Q){throw console.error("Font conversion failed:",Q),new yt(`Font conversion failed: ${Q.message}`)}}async parseCharacterInputAsync(e,t,i){let o=[],n=t||"";return e==="full"?(o=[0,65535,0],{ranges:o,charSymbols:n}):(e&&e!=="custom"&&(n=await this.getCharsetContentAsync(e)+n),i&&(o=this.parseUnicodeRange(i)),{ranges:o,charSymbols:n})}parseCharacterInput(e,t,i){let o=[],n=t||"";return e==="full"?(o=[0,65535,0],{ranges:o,charSymbols:n}):(e&&e!=="custom"&&(n=this.getCharsetContent(e)+n),i&&(o=this.parseUnicodeRange(i)),{ranges:o,charSymbols:n})}async loadCharsetFromFile(e){const i={latin:"./static/charsets/latin1.txt",deepseek:"./static/charsets/deepseek.txt",gb2312:"./static/charsets/gb2312.txt",qwen:"./static/charsets/qwen18409.txt"}[e];if(!i)return null;try{const o=await fetch(i);if(!o.ok)throw new Error(`Failed to load charset file: ${o.status}`);const r=(await o.text()).split(` +`).join("");return this.charsetCache.set(e,r),r}catch(o){return console.error(`Failed to load charset ${e}:`,o),null}}getCharsetContent(e){const t={};return(e==="latin"||e==="deepseek"||e==="gb2312")&&this.charsetCache.has(e)?this.charsetCache.get(e):e==="basic"?this.getCharsetContent("latin"):t[e]||""}async getCharsetContentAsync(e){if(e==="basic"&&(e="latin"),this.charsetCache.has(e))return this.charsetCache.get(e);if(e==="latin"||e==="deepseek"||e==="gb2312"||e==="qwen"){const t=await this.loadCharsetFromFile(e);if(t)return t}return this.getCharsetContent(e)}parseUnicodeRange(e){const t=[],i=e.split(",");for(const o of i){const n=o.trim();if(n)if(n.includes("-")){const[r,g]=n.split("-"),s=this.parseHexOrDec(r),a=this.parseHexOrDec(g);s!==null&&a!==null&&t.push(s,a,s)}else{const r=this.parseHexOrDec(n);r!==null&&t.push(r,r,r)}}return t}parseHexOrDec(e){const t=e.trim();if(t.startsWith("0x")||t.startsWith("0X")){const o=parseInt(t,16);return isNaN(o)?null:o}const i=parseInt(t,10);return isNaN(i)?null:i}async estimateSizeAsync(e){const{fontSize:t=20,bpp:i=4,charset:o="latin",symbols:n="",range:r=""}=e;let g=n.length;if(o==="full")g=65536;else if(o&&o!=="custom"){const I=await this.getCharsetContentAsync(o);g+=I.length}if(r){const I=this.parseUnicodeRange(r);for(let l=0;l0}catch(e){return console.error("加载 FST 模型失败",e),!1}}packString(e,t){const i=new Uint8Array(t),o=Math.min(e.length,t);for(let n=0;n>8&255,t[2]=e>>16&255,t[3]=e>>24&255,t}packModels(){if(this.models.size===0)throw new Error("没有模型数据可打包");let e=0;const t=[];for(const[a,I]of Array.from(this.models.entries()).sort((l,C)=>l[0].localeCompare(C[0]))){e+=I.size;const l=Array.from(I.entries()).sort((C,Q)=>C[0].localeCompare(Q[0]));t.push({name:a,files:l})}const i=this.models.size;let o=4;for(const a of t)o+=36,o+=a.files.length*40;const n=o+Array.from(this.models.values()).reduce((a,I)=>a+Array.from(I.values()).reduce((l,C)=>l+C.byteLength,0),0),r=new Uint8Array(n);let g=0;r.set(this.packUint32(i),g),g+=4;let s=o;for(const a of t){r.set(this.packString(a.name,32),g),g+=32,r.set(this.packUint32(a.files.length),g),g+=4;for(const[I,l]of a.files)r.set(this.packString(I,32),g),g+=32,r.set(this.packUint32(s),g),g+=4,r.set(this.packUint32(l.byteLength),g),g+=4,s+=l.byteLength}for(const a of t)for(const[I,l]of a.files)r.set(new Uint8Array(l),g),g+=l.byteLength;return r.buffer}static async getAvailableModels(){try{return{WakeNet9:["wn9_alexa","wn9_astrolabe_tts","wn9_bluechip_tts2","wn9_computer_tts","wn9_haixiaowu_tts","wn9_heyily_tts2","wn9_heyprinter_tts","wn9_heywanda_tts","wn9_heywillow_tts","wn9_hiesp","wn9_hifairy_tts2","wn9_hijason_tts2","wn9_hijolly_tts2","wn9_hijoy_tts","wn9_hilexin","wn9_hilili_tts","wn9_himfive","wn9_himiaomiao_tts","wn9_hitelly_tts","wn9_hiwalle_tts2","wn9_hixiaoxing_tts","wn9_jarvis_tts","wn9_linaiban_tts2","wn9_miaomiaotongxue_tts","wn9_mycroft_tts","wn9_nihaobaiying_tts2","wn9_nihaodongdong_tts2","wn9_nihaomiaoban_tts2","wn9_nihaoxiaoan_tts2","wn9_nihaoxiaoxin_tts","wn9_nihaoxiaoyi_tts2","wn9_nihaoxiaozhi","wn9_nihaoxiaozhi_tts","wn9_sophia_tts","wn9_xiaoaitongxue","wn9_xiaobinxiaobin_tts","wn9_xiaojianxiaojian_tts2","wn9_xiaokangtongxue_tts2","wn9_xiaolongxiaolong_tts","wn9_xiaoluxiaolu_tts2","wn9_xiaomeitongxue_tts","wn9_xiaomingtongxue_tts2","wn9_xiaosurou_tts2","wn9_xiaotexiaote_tts2","wn9_xiaoyaxiaoya_tts2","wn9_xiaoyutongxue_tts2"],WakeNet9s:["wn9s_alexa","wn9s_hiesp","wn9s_hijason","wn9s_hilexin","wn9s_nihaoxiaozhi"]}}catch(e){return console.error("获取模型列表失败:",e),{WakeNet9:[],WakeNet9s:[]}}}static isValidModel(e,t){return t==="esp32c3"||t==="esp32c6"?e.startsWith("wn9s_"):e.startsWith("wn9_")}clear(){this.models.clear()}getStats(){let e=0,t=0;for(const i of this.models.values()){e+=i.size;for(const o of i.values())t+=o.byteLength}return{modelCount:this.models.size,fileCount:e,totalSize:t,models:Array.from(this.models.keys())}}validatePackingCompatibility(){const e="test_model",t=this.packString(e,32),i=305419896,o=this.packUint32(i);return{stringPacking:{input:e,output:Array.from(t).map(n=>`0x${n.toString(16).padStart(2,"0")}`),isASCII:t.every((n,r)=>r>=e.length||n===e.charCodeAt(r))},intPacking:{input:`0x${i.toString(16)}`,output:Array.from(o).map(n=>`0x${n.toString(16).padStart(2,"0")}`),isLittleEndian:o[0]===120&&o[3]===18}}}}class sS{constructor(){this.files=[],this.textEncoder=new TextEncoder}addFile(e,t,i={}){e.length>32&&console.warn(`Filename "${e}" exceeds 32 bytes and will be truncated`),this.files.push({filename:e,data:t,size:t.byteLength,width:i.width||0,height:i.height||0})}async getImageDimensions(e){return new Promise(t=>{try{const i=new Blob([e]),o=URL.createObjectURL(i),n=new Image;n.onload=()=>{URL.revokeObjectURL(o),t({width:n.width,height:n.height})},n.onerror=()=>{URL.revokeObjectURL(o),t({width:0,height:0})},n.src=o}catch{t({width:0,height:0})}})}parseSpecialImageFormat(e,t){const i=e.toLowerCase().split(".").pop();if([".sjpg",".spng",".sqoi"].includes("."+i))try{const o=new DataView(t),n=o.getUint16(14,!0),r=o.getUint16(16,!0);return{width:n,height:r}}catch(o){console.warn(`Failed to parse special image format: ${e}`,o)}return{width:0,height:0}}packUint32(e){const t=new Uint8Array(4);return t[0]=e&255,t[1]=e>>8&255,t[2]=e>>16&255,t[3]=e>>24&255,t}packUint16(e){const t=new Uint8Array(2);return t[0]=e&255,t[1]=e>>8&255,t}packString(e,t){const i=new Uint8Array(t),o=this.textEncoder.encode(e),n=Math.min(o.length,t);return i.set(o.slice(0,n),0),i}computeChecksum(e){let t=0;for(let i=0;i{const o=t.filename.split(".").pop()||"",n=i.filename.split(".").pop()||"";if(o!==n)return o.localeCompare(n);const r=t.filename.replace(/\.[^/.]+$/,""),g=i.filename.replace(/\.[^/.]+$/,"");return r.localeCompare(g)})}async generate(e=null){if(this.files.length===0)throw new Error("No files to package");e&&e(0,"Starting to package files...");const t=this.sortFiles(this.files),i=t.length,o=[];let n=0;for(let D=0;D0||v.height>0)d=v.width,p=v.height;else{const N=c.filename.toLowerCase().split(".").pop();if(["png","jpg","jpeg","gif","bmp","webp"].includes(N)){const G=await this.getImageDimensions(c.data);d=G.width,p=G.height}}}o.push({filename:c.filename,data:c.data,size:c.size,offset:n,width:d,height:p}),n+=2+c.size}e&&e(40,"Building file mapping table...");const r=i*44,g=new Uint8Array(r);let s=0;for(const D of o)g.set(this.packString(D.filename,32),s),s+=32,g.set(this.packUint32(D.size),s),s+=4,g.set(this.packUint32(D.offset),s),s+=4,g.set(this.packUint16(D.width),s),s+=2,g.set(this.packUint16(D.height),s),s+=2;e&&e(60,"Merging file data...");const a=new Uint8Array(n);let I=0;for(let D=0;D0?Math.round(e/this.files.length):0}}printFileList(){if(console.log("=== Packaged File List ==="),console.log(`Total files: ${this.files.length}`),this.files.length===0){console.log("No files available");return}this.sortFiles(this.files).forEach((i,o)=>{var s;const n=((s=i.filename.split(".").pop())==null?void 0:s.toLowerCase())||"unknown",r=(i.size/1024).toFixed(2),g=i.width&&i.height?`${i.width}x${i.height}`:"N/A";console.log(`${String(o+1).padStart(3," ")}. ${i.filename}`),console.log(` Type: ${n.toUpperCase()}`),console.log(` Size: ${r} KB (${i.size} bytes)`),console.log(` Dimensions: ${g}`),console.log("")});const t=this.getStats();console.log("=== File Statistics ==="),console.log(`Total size: ${(t.totalSize/1024).toFixed(2)} KB`),console.log(`Average size: ${(t.averageFileSize/1024).toFixed(2)} KB`),console.log("File type distribution:"),Object.entries(t.fileTypes).forEach(([i,o])=>{console.log(` ${i.toUpperCase()}: ${o} files`)})}clear(){this.files=[]}}let Jo={tool:{workerLocalUrl:`var gifsicle=function(){Me="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,"undefined"!=typeof __filename&&(Me=Me||__filename);var Me,c=function(e){var j,r,h=void 0!==(e=e||{})?e:{},t=(h.ready=new Promise(function(e,r){j=e}),h.preRun=h.preRun||[],h.preRun.push(function(){if(h.folder&&h.folder.length)for(let e=0;e>10,56320|1023&s)))):i+=String.fromCharCode(u)}return i}function W(e,r){return e?g(E,e,r):""}function X(e,r,t,n){if(!(0>6,r[t++]=128|63&s}else if(s<=65535){if(i<=t+2)break;r[t++]=224|s>>12,r[t++]=128|s>>6&63,r[t++]=128|63&s}else{if(i<=t+3)break;r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}}return r[t]=0,t-o}function G(e){for(var r=0,t=0;t>2]=e}var x={splitPath:function(e){return/^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/.exec(e).slice(1)},normalizeArray:function(e,r){for(var t=0,n=e.length-1;0<=n;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:function(e){var r="/"===e.charAt(0),t="/"===e.substr(-1);return(e=(e=x.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||r?e:".")&&t&&(e+="/"),(r?"/":"")+e},dirname:function(e){var e=x.splitPath(e),r=e[0],e=e[1];return r||e?r+(e=e&&e.substr(0,e.length-1)):"."},basename:function(e){if("/"===e)return"/";var r=e.lastIndexOf("/");return-1===r?e:e.substr(r+1)},extname:function(e){return x.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return x.normalize(e.join("/"))},join2:function(e,r){return x.normalize(e+"/"+r)}},R={resolve:function(){for(var e="",r=!1,t=arguments.length-1;-1<=t&&!r;t--){var n=0<=t?arguments[t]:T.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r="/"===n.charAt(0)}return(r?"/":"")+(e=x.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||"."},relative:function(e,r){function t(e){for(var r=0;r>>0),0!=t&&(r=Math.max(r,256)),t=e.contents,e.contents=new Uint8Array(r),0r)e.contents.length=r;else for(;e.contents.length=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-o,n);if(8>>0)%T.nameTable.length},hashAddNode:function(e){var r=T.hashName(e.parent.id,e.name);e.name_next=T.nameTable[r],T.nameTable[r]=e},hashRemoveNode:function(e){var r=T.hashName(e.parent.id,e.name);if(T.nameTable[r]===e)T.nameTable[r]=e.name_next;else for(var t=T.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode:function(e,r){var t=T.mayLookup(e);if(t)throw new T.ErrnoError(t,e);for(var t=T.hashName(e.id,r),n=T.nameTable[t];n;n=n.name_next){var o=n.name;if(n.parent.id===e.id&&o===r)return n}return T.lookup(e,r)},createNode:function(e,r,t,n){e=new T.FSNode(e,r,t,n);return T.hashAddNode(e),e},destroyNode:function(e){T.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return 32768==(61440&e)},isDir:function(e){return 16384==(61440&e)},isLink:function(e){return 40960==(61440&e)},isChrdev:function(e){return 8192==(61440&e)},isBlkdev:function(e){return 24576==(61440&e)},isFIFO:function(e){return 4096==(61440&e)},isSocket:function(e){return 49152==(49152&e)},flagModes:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function(e){var r=T.flagModes[e];if(void 0===r)throw new Error("Unknown file open mode: "+e);return r},flagsToPermissionString:function(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:function(e,r){return T.ignorePermissions||(-1===r.indexOf("r")||292&e.mode)&&(-1===r.indexOf("w")||146&e.mode)&&(-1===r.indexOf("x")||73&e.mode)?0:2},mayLookup:function(e){var r=T.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate:function(e,r){try{T.lookupNode(e,r);return 20}catch(e){}return T.nodePermissions(e,"wx")},mayDelete:function(e,r,t){var n;try{n=T.lookupNode(e,r)}catch(e){return e.errno}r=T.nodePermissions(e,"wx");if(r)return r;if(t){if(!T.isDir(n.mode))return 54;if(T.isRoot(n)||T.getPath(n)===T.cwd())return 10}else if(T.isDir(n.mode))return 31;return 0},mayOpen:function(e,r){return e?T.isLink(e.mode)?32:T.isDir(e.mode)&&("r"!==T.flagsToPermissionString(r)||512&r)?31:T.nodePermissions(e,T.flagsToPermissionString(r)):44},MAX_OPEN_FDS:4096,nextfd:function(e,r){r=r||T.MAX_OPEN_FDS;for(var t=e=e||0;t<=r;t++)if(!T.streams[t])return t;throw new T.ErrnoError(33)},getStream:function(e){return T.streams[e]},createStream:function(e,r,t){T.FSStream||(T.FSStream=function(){},T.FSStream.prototype={object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}});var n,o=new T.FSStream;for(n in e)o[n]=e[n];e=o;r=T.nextfd(r,t);return e.fd=r,T.streams[r]=e},closeStream:function(e){T.streams[e]=null},chrdev_stream_ops:{open:function(e){var r=T.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:function(){throw new T.ErrnoError(70)}},major:function(e){return e>>8},minor:function(e){return 255&e},makedev:function(e,r){return e<<8|r},registerDevice:function(e,r){T.devices[e]={stream_ops:r}},getDevice:function(e){return T.devices[e]},getMounts:function(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs:function(r,t){"function"==typeof r&&(t=r,r=!1),T.syncFSRequests++,1=n.length&&i(null)}n.forEach(function(e){if(!e.type.syncfs)return a(null);e.type.syncfs(e,r,a)})},mount:function(e,r,t){var n,o="/"===t,i=!t;if(o&&T.root)throw new T.ErrnoError(10);if(!o&&!i){i=T.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,T.isMountpoint(n))throw new T.ErrnoError(10);if(!T.isDir(n.mode))throw new T.ErrnoError(54)}i={type:e,opts:r,mountpoint:t,mounts:[]},r=e.mount(i);return(r.mount=i).root=r,o?T.root=r:n&&(n.mounted=i,n.mount&&n.mount.mounts.push(i)),r},unmount:function(e){e=T.lookupPath(e,{follow_mount:!1});if(!T.isMountpoint(e.node))throw new T.ErrnoError(28);var e=e.node,r=e.mounted,n=T.getMounts(r),r=(Object.keys(T.nameTable).forEach(function(e){for(var r=T.nameTable[e];r;){var t=r.name_next;-1!==n.indexOf(r.mount)&&T.destroyNode(r),r=t}}),e.mounted=null,e.mount.mounts.indexOf(r));e.mount.mounts.splice(r,1)},lookup:function(e,r){return e.node_ops.lookup(e,r)},mknod:function(e,r,t){var n=T.lookupPath(e,{parent:!0}).node,e=x.basename(e);if(!e||"."===e||".."===e)throw new T.ErrnoError(28);var o=T.mayCreate(n,e);if(o)throw new T.ErrnoError(o);if(n.node_ops.mknod)return n.node_ops.mknod(n,e,r,t);throw new T.ErrnoError(63)},create:function(e,r){return T.mknod(e,r=(r=void 0!==r?r:438)&4095|32768,0)},mkdir:function(e,r){return T.mknod(e,r=(r=void 0!==r?r:511)&1023|16384,0)},mkdirTree:function(e,r){for(var t=e.split("/"),n="",o=0;othis.length-1||e<0))return r=e%this.chunkSize,e=e/this.chunkSize|0,this.getter(e)[r]},o.prototype.setDataGetter=function(e){this.getter=e},o.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",a,!1),e.send(null),!(200<=e.status&&e.status<300||304===e.status))throw new Error("Couldn't load "+a+". Status: "+e.status);var r,n=Number(e.getResponseHeader("Content-length")),t=(r=e.getResponseHeader("Accept-Ranges"))&&"bytes"===r,e=(r=e.getResponseHeader("Content-Encoding"))&&"gzip"===r,o=1048576,i=(t||(o=n),this);i.setDataGetter(function(e){var r=e*o,t=(e+1)*o-1,t=Math.min(t,n-1);if(void 0===i.chunks[e]&&(i.chunks[e]=function(e,r){if(r=i.length)return 0;var a=Math.min(i.length-o,n);if(i.slice)for(var s=0;s>2]=n.dev,k[t+4>>2]=0,k[t+8>>2]=n.ino,k[t+12>>2]=n.mode,k[t+16>>2]=n.nlink,k[t+20>>2]=n.uid,k[t+24>>2]=n.gid,k[t+28>>2]=n.rdev,k[t+32>>2]=0,F=[n.size>>>0,(S=n.size,1<=+ne(S)?0>>0:~~+oe((S-(~~S>>>0))/4294967296)>>>0:0)],k[t+40>>2]=F[0],k[t+44>>2]=F[1],k[t+48>>2]=4096,k[t+52>>2]=n.blocks,k[t+56>>2]=n.atime.getTime()/1e3|0,k[t+60>>2]=0,k[t+64>>2]=n.mtime.getTime()/1e3|0,k[t+68>>2]=0,k[t+72>>2]=n.ctime.getTime()/1e3|0,k[t+76>>2]=0,F=[n.ino>>>0,(S=n.ino,1<=+ne(S)?0>>0:~~+oe((S-(~~S>>>0))/4294967296)>>>0:0)],k[t+80>>2]=F[0],k[t+84>>2]=F[1],0},doMsync:function(e,r,t,n,o){e=E.slice(e,e+t);T.msync(r,e,o,t,n)},doMkdir:function(e,r){return"/"===(e=x.normalize(e))[e.length-1]&&(e=e.substr(0,e.length-1)),T.mkdir(e,r,0),0},doMknod:function(e,r,t){switch(61440&r){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}return T.mknod(e,r,t),0},doReadlink:function(e,r,t){if(t<=0)return-28;var e=T.readlink(e),n=Math.min(t,G(e)),o=y[r+n];return X(e,E,r,t+1),y[r+n]=o,n},doAccess:function(e,r){if(-8&r)return-28;e=T.lookupPath(e,{follow:!0}).node;if(!e)return-44;var t="";return 4&r&&(t+="r"),2&r&&(t+="w"),1&r&&(t+="x"),t&&T.nodePermissions(e,t)?-2:0},doDup:function(e,r,t){var n=T.getStream(t);return n&&T.close(n),T.open(e,r,0,t,t).fd},doReadv:function(e,r,t,n){for(var o=0,i=0;i>2],s=k[r+(8*i+4)>>2],a=T.read(e,y,a,s,n);if(a<0)return-1;if(o+=a,a>2],s=k[r+(8*i+4)>>2],a=T.write(e,y,a,s,n);if(a<0)return-1;o+=a}return o},varargs:void 0,get:function(){return N.varargs+=4,k[N.varargs-4>>2]},getStr:function(e){return W(e)},getStreamFromFD:function(e){e=T.getStream(e);if(e)return e;throw new T.ErrnoError(8)},get64:function(e,r){return e}};var ge={};function z(){if(!z.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:C||"./this.program"};for(r in ge)e[r]=ge[r];var r,t=[];for(r in e)t.push(r+"="+e[r]);z.strings=t}return z.strings}function ve(e,r,t,n){this.parent=e=e||this,this.mount=e.mount,this.mounted=null,this.id=T.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n}function ye(e,r,t){t=0>2]=t/1e3|0,k[r+4>>2]=t%1e3*1e3*1e3|0,0},d:function(e,r,t){N.varargs=t;try{var n=N.getStreamFromFD(e);switch(r){case 0:return(o=N.get())<0?-28:T.open(n.path,n.flags,0,o).fd;case 1:case 2:return 0;case 3:return n.flags;case 4:var o=N.get();return n.flags|=o,0;case 12:o=N.get();return K[o+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return A(28),-1;default:return-28}}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),-e.errno}},i:function(e,r,t){N.varargs=t;try{var n=N.getStreamFromFD(e);switch(r){case 21509:case 21505:return n.tty?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return n.tty?0:-59;case 21519:if(!n.tty)return-59;var o=N.get();return k[o>>2]=0;case 21520:return n.tty?-28:-59;case 21531:o=N.get();return T.ioctl(n,r,o);case 21523:case 21524:return n.tty?0:-59;default:D("bad ioctl syscall "+r)}}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),-e.errno}},e:function(e,r,t){N.varargs=t;try{var n=N.getStr(e),o=N.get();return T.open(n,r,o).fd}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),-e.errno}},t:function(e){try{return e=N.getStr(e),T.rmdir(e),0}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),-e.errno}},j:function(e){try{var r=N.umask;return N.umask=e,r}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),-e.errno}},u:function(e){try{return e=N.getStr(e),T.unlink(e),0}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),-e.errno}},v:function(e,r,t,n){try{D("cannot wait on child processes")}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),-e.errno}},n:function(e,r,t){E.copyWithin(e,r,r+t)},b:function(e){var r=E.length,t=2147483648;if(t<(e>>>=0))return!1;for(var n,o=1;o<=4;o*=2){var i=r*(1+.2/o),i=Math.min(i,e+100663296);if(function(e){try{return p.grow(e-v.byteLength+65535>>>16),Y(p.buffer),1}catch(e){}}(Math.min(t,(0<(i=Math.max(16777216,e,i))%(n=65536)&&(i+=n-i%n),i))))return!0}return!1},p:function(a,s){var u=0;return z().forEach(function(e,r){for(var t=s+u,n=(k[a+4*r>>2]=t,e),o=t,r=void 0,i=0;i>0]=n.charCodeAt(i);r||(y[o>>0]=0),u+=e.length+1}),0},q:function(e,r){var t=z(),n=(k[e>>2]=t.length,0);return t.forEach(function(e){n+=e.length+1}),k[r>>2]=n,0},c:function(e){xe(e)},f:function(e){try{var r=N.getStreamFromFD(e);return T.close(r),0}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),e.errno}},r:function(e,r){try{var t=N.getStreamFromFD(e),n=t.tty?2:T.isDir(t.mode)?3:T.isLink(t.mode)?7:4;return y[r>>0]=n,0}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),e.errno}},h:function(e,r,t,n){try{var o=N.getStreamFromFD(e),i=N.doReadv(o,r,t);return k[n>>2]=i,0}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),e.errno}},m:function(e,r,t,n,o){try{var i=N.getStreamFromFD(e),a=4294967296*t+(r>>>0),s=9007199254740992;return a<=-s||s<=a?-61:(T.llseek(i,a,n),F=[i.position>>>0,(S=i.position,1<=+ne(S)?0>>0:~~+oe((S-(~~S>>>0))/4294967296)>>>0:0)],k[o>>2]=F[0],k[o+4>>2]=F[1],i.getdents&&0==a&&0===n&&(i.getdents=null),0)}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),e.errno}},g:function(e,r,t,n){try{var o=N.getStreamFromFD(e),i=N.doWritev(o,r,t);return k[n>>2]=i,0}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),e.errno}},memory:p,o:function(){w("missing function: popen"),D(-1)},l:function(){return 6},k:function(){},table:I},_e=(!function(){var r={a:ke};function t(e,r){e=e.exports;h.asm=e,ue()}function n(e){t(e.instance)}function o(e){return(l||!L&&!c||"function"!=typeof fetch||de(P)?new Promise(function(e,r){e(pe())}):fetch(P,{credentials:"same-origin"}).then(function(e){if(e.ok)return e.arrayBuffer();throw"failed to load wasm binary file at '"+P+"'"}).catch(pe)).then(function(e){return WebAssembly.instantiate(e,r)}).then(e,function(e){w("failed to asynchronously prepare wasm: "+e),D(e)})}if(se(),h.instantiateWasm)try{h.instantiateWasm(r,t);return}catch(e){return w("Module.instantiateWasm callback failed with error: "+e)}l||"function"!=typeof WebAssembly.instantiateStreaming||ce(P,fe)||de(P)||"function"!=typeof fetch?o(n):fetch(P,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,r).then(n,function(e){return w("wasm streaming compile failed: "+e),w("falling back to ArrayBuffer instantiation"),o(n)})})}(),h.___wasm_call_ctors=function(){return(_e=h.___wasm_call_ctors=h.asm.w).apply(null,arguments)}),be=h._malloc=function(){return(be=h._malloc=h.asm.x).apply(null,arguments)},De=h.___errno_location=function(){return(De=h.___errno_location=h.asm.y).apply(null,arguments)},Se=(h._main=function(){return(h._main=h.asm.z).apply(null,arguments)},h.stackAlloc=function(){return(Se=h.stackAlloc=h.asm.A).apply(null,arguments)});function Fe(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Pe(r){var t=h._main;r=r||[];try{for(let e=0;e>2]=V(C);for(var n=1;n>2)+n]=V(e[n-1]);return k[(t>>2)+r]=0,{argc:r,argv:t}}(s.split(" ").filter(e=>Boolean(e)));if(0!==(n=t(o,i)))break}xe(n,!0)}catch(e){if(e instanceof Fe)return;if("unwind"==e)return void(d=!0);var a=e;e&&"object"==typeof e&&e.stack&&(a=[e,e.stack]),w("exception thrown: "+a),u(1,e)}}function Ae(e){function r(){Ee||(Ee=!0,h.calledRun=!0,U||(h.noFSInit||T.init.initialized||T.init(),Z(J),T.ignorePermissions=!1,Z(Q),j(h),h.onRuntimeInitialized&&h.onRuntimeInitialized(),Re&&Pe(e),te()))}e=e||a,0<_||(re(),0<_||(h.setStatus?(h.setStatus("Running..."),setTimeout(function(){setTimeout(function(){h.setStatus("")},1),r()},1)):r()))}function xe(e,r){r&&d&&0===e||(d||(U=!0,h.onExit&&h.onExit(e)),u(e,new Fe(e)))}if(h.dynCall_vi=function(){return(h.dynCall_vi=h.asm.B).apply(null,arguments)},b=function e(){Ee||Ae(),Ee||(b=e)},h.run=Ae,h.preInit)for("function"==typeof h.preInit&&(h.preInit=[h.preInit]);0{0{t+=String.fromCharCode(e),10===e&&(console.error(t),t="")},stdout:e=>{r+=String.fromCharCode(e),10===e&&(console.log(r),r="")}};const l=[];return async(e={})=>{let{data:i=null,command:a=[],folder:s=[],isStrict:u=!1}=e;return await new Promise(e=>{l.push(e),1===l.length&&l[0]()}),new Promise((r,t)=>{let n=!1,o="";c({stdout:f.stdout,stderr:e=>{o+=String.fromCharCode(e),10===e&&(console.error(o),u&&t(o))},arguments:a,input:i,folder:s,output:e=>{r(e),n=!0}}).then(()=>{(0,f.flush)(),n||t(),0{var e=await gifsicle(r.data).catch(e=>{postMessage(e)});postMessage(e)})().catch(e=>{postMessage(null)})};`,workerBlobUrl:"",worker(){return this.workerBlobUrl||(this.workerLocalUrl?this.workerBlobUrl=URL.createObjectURL(new Blob([this.workerLocalUrl])):this.workerBlobUrl="../src/worker.js",this.workerBlobUrl)},errorLink(){return` + Check: https://github.com/renzhezhilu/gifsicle-wasm-browser`},testType(A){return A instanceof Element?"element":Object.prototype.toString.call(A).replace(/\[object\s(.+)\]/,"$1").toLowerCase()},async textToUrl(A){return this.worker()},loadCommand(A){var e=this.testType(A);if(A.length===0)throw" the content can not be blank"+this.errorLink();if(e==="array")return A.map(t=>t.replace(/\n/gi," "));throw" types:"+e+", must be an array"+this.errorLink()},loadOne(A){return new Promise(async(e,t)=>{var i=this.testType(A);if(["string"].includes(i))fetch(A).then(o=>{if(o.status!==200)throw"<"+A+"> Url error!!!"+this.errorLink();return o.arrayBuffer()}).then(o=>e(o));else if(["blob","file"].includes(i))new Response(A).arrayBuffer().then(o=>e(o));else{if(!["arraybuffer"].includes(i))throw" types:"+i+", only supports Url, blob, file, arraybuffer"+this.errorLink();e(A)}})},loadFile(A){return new Promise(async(e,t)=>{var i=this.testType(A);if(i!=="array")throw" types:"+i+", only supports Array"+this.errorLink();if(A.length===0)throw" the content can not be blank"+this.errorLink();i=A.map(o=>this.loadOne(o.file)),Promise.all(i).then(function(o){var n=A.map((r,g)=>(r.file=o[g],r));e(n)}).catch(function(o){})})},loadFolder(A){return new Promise(async(e,t)=>{var i=this.testType(A);if(!["array"].includes(i))throw" types:"+i+", only supports Array"+this.errorLink();e(A)})}},run(A={}){return new Promise(async(e,t)=>{let{input:i=[],command:o="",folder:n=[],isStrict:r=!1,start:g=Q=>{}}=A;var s=await this.tool.textToUrl();let a=new Worker(s);var I=this.tool.loadCommand(o),l=await this.tool.loadFile(i),C=(g(l),await this.tool.loadFolder(n));a.postMessage({data:l,command:I,folder:C,isStrict:r}),a.onmessage=async function(Q){if(!Q.data||typeof Q.data=="string")return a.terminate(),void t(Q.data);let h=[];for(let u=0;u=0&&I.push(`--loopcount=${s}`),g&&g>0&&I.push(`--lossy=${g}`),r&&I.push(`-O${this.optimizationLevel}`),I.push("1.gif"),I.push("-o /out/output.gif");const l=I.join(" ");this.debug&&(console.log("GIF 缩放命令:",l),console.log("输入文件大小:",e.size||"未知"));const C=await Jo.run({input:[{file:e,name:"1.gif"}],command:[l]});if(!C||C.length===0)throw new Error("gifsicle 处理失败,未返回结果");const Q=C[0];if(this.debug&&(console.log("GIF 缩放完成"),console.log("输出文件大小:",Q.size),e.size)){const h=((1-Q.size/e.size)*100).toFixed(2);console.log(`压缩率: ${h}%`)}return new Blob([Q],{type:"image/gif"})}catch(a){throw console.error("GIF 缩放失败:",a),new Error(`GIF 缩放失败: ${a.message}`)}}async scaleGifBatch(e){const t=[];for(let i=0;i=0&&r.push(`--loopcount=${n}`),i&&i>0&&r.push(`--lossy=${i}`),r.push(`-O${o}`),r.push("1.gif"),r.push("-o /out/output.gif");const g=r.join(" ");this.debug&&console.log("GIF 优化命令:",g);const s=await Jo.run({input:[{file:e,name:"1.gif"}],command:[g]});if(!s||s.length===0)throw new Error("gifsicle 优化失败");return new Blob([s[0]],{type:"image/gif"})}catch(r){throw console.error("GIF 优化失败:",r),new Error(`GIF 优化失败: ${r.message}`)}}async getGifInfo(e){try{const t=await Jo.run({input:[{file:e,name:"1.gif"}],command:["--info 1.gif -o /out/info.txt"]});if(!t||t.length===0)throw new Error("无法获取 GIF 信息");const o=await t[0].text();return this.parseGifInfo(o)}catch(t){return console.error("获取 GIF 信息失败:",t),{size:e.size||0,type:"image/gif"}}}parseGifInfo(e){const t={frames:0,width:0,height:0,colors:0,loopCount:0};try{const i=e.match(/(\d+) images?/);i&&(t.frames=parseInt(i[1]));const o=e.match(/logical screen (\d+)x(\d+)/);o&&(t.width=parseInt(o[1]),t.height=parseInt(o[2]));const n=e.match(/(\d+) colors/);if(n&&(t.colors=parseInt(n[1])),e.includes("loop forever"))t.loopCount=0;else{const r=e.match(/loop count (\d+)/);r&&(t.loopCount=parseInt(r[1]))}}catch(i){console.warn("解析 GIF 信息时出错:",i)}return t}async cropGif(e,t){const{x:i,y:o,width:n,height:r}=t;try{const g=["-U",`--crop ${i},${o}+${n}x${r}`,"1.gif","-o /out/output.gif"].join(" ");this.debug&&console.log("GIF 裁剪命令:",g);const s=await Jo.run({input:[{file:e,name:"1.gif"}],command:[g]});if(!s||s.length===0)throw new Error("gifsicle 裁剪失败");return new Blob([s[0]],{type:"image/gif"})}catch(g){throw console.error("GIF 裁剪失败:",g),new Error(`GIF 裁剪失败: ${g.message}`)}}dispose(){this.debug&&console.log("WasmGifScaler disposed")}setDebug(e){this.debug=e}setQuality(e){if(e<1||e>200)throw new Error("质量参数必须在 1-200 之间");this.quality=e}setOptimizationLevel(e){if(e<1||e>3)throw new Error("优化级别必须在 1-3 之间");this.optimizationLevel=e}}class _l{constructor(){this.config=null,this.resources=new Map,this.tempFiles=[],this.fontConverterBrowser=rS,this.convertedFonts=new Map,this.wakenetPacker=new gS,this.spiffsGenerator=new sS,this.gifScaler=new aS({quality:30,debug:!0,scalingMode:"auto",optimize:!0,optimizationLevel:2}),this.configStorage=Qe,this.autoSaveEnabled=!0}setConfig(e,t={}){if(((t==null?void 0:t.strict)??!0)&&!this.validateConfig(e))throw new Error("Configuration object validation failed");return this.config={...e},this}validateConfig(e){var o,n,r;if(!e)return!1;if(!((o=e.chip)!=null&&o.model))return console.error("Missing chip model configuration"),!1;const t=e.chip.display;if(!(t!=null&&t.width)||!(t!=null&&t.height))return console.error("Missing display resolution configuration"),!1;const i=(n=e.theme)==null?void 0:n.font;return(i==null?void 0:i.type)==="preset"&&!i.preset?(console.error("Preset font configuration is incomplete"),!1):(i==null?void 0:i.type)==="custom"&&!((r=i.custom)!=null&&r.file)?(console.error("Custom font file not provided"),!1):!0}addResource(e,t,i,o="other"){return this.resources.set(e,{file:t,filename:i,size:t.size,type:t.type,lastModified:t.lastModified||Date.now(),resourceType:o}),this.autoSaveEnabled&&t instanceof File&&this.saveFileToStorage(e,t,o).catch(n=>{console.warn(`Auto-saving file ${i} failed:`,n)}),this}async saveFileToStorage(e,t,i){try{await this.configStorage.saveFile(e,t,i),console.log(`File ${t.name} auto-saved to storage`)}catch(o){throw console.error(`Failed to save file to storage: ${t.name}`,o),o}}async restoreResourceFromStorage(e){try{const t=await this.configStorage.loadFile(e);return t?(this.resources.set(e,{file:t,filename:t.name,size:t.size,type:t.type,lastModified:t.lastModified,resourceType:t.storedType,fromStorage:!0}),console.log(`Resource ${e} restored from storage successfully: ${t.name}`),!0):!1}catch(t){return console.error(`Failed to restore resource from storage: ${e}`,t),!1}}async restoreAllResourcesFromStorage(e){var i,o,n,r,g,s,a,I,l,C,Q;if(!e)return;const t=[];if((o=(i=e.theme)==null?void 0:i.font)!=null&&o.custom&&((n=e.theme.font.custom)==null?void 0:n.file)===null){const h="custom_font";if(await this.restoreResourceFromStorage(h)){const f=this.resources.get(h);f&&(e.theme.font.custom.file=f.file,t.push(`Custom font: ${f.filename}`),console.log(`Custom font restored even when type is '${e.theme.font.type}'`))}}if(((g=(r=e.theme)==null?void 0:r.emoji)==null?void 0:g.type)==="custom"&&e.theme.emoji.custom){const h=e.theme.emoji.custom,f=h.emotionMap||{},u=h.fileMap||{},E=h.images||{};if(Object.keys(f).length>0||Object.keys(u).length>0){const D=new Set;for(const c of Object.keys(u))u[c]===null&&D.add(c);for(const c of D){let d=`hash_${c}`,p=await this.restoreResourceFromStorage(d);if(!p){const v=`emoji_hash_${c}`;p=await this.restoreResourceFromStorage(v),p&&(d=v)}if(p){const v=this.resources.get(d);if(v){u[c]=v.file;const N=Object.entries(f).filter(([G,H])=>H===c).map(([G,H])=>G);N.forEach(G=>{E[G]=v.file}),t.push(`Emoji file ${c.substring(0,8)}... (used for: ${N.join(", ")})`)}}}Object.keys(u).forEach(c=>{e.theme.emoji.custom.fileMap[c]=u[c]}),Object.keys(E).forEach(c=>{e.theme.emoji.custom.images[c]=E[c]})}else{for(const[D,c]of Object.entries(E))if(c===null){const d=`emoji_${D}`;if(await this.restoreResourceFromStorage(d)){const p=this.resources.get(d);p&&(E[D]=p.file,t.push(`Emoji ${D}: ${p.filename}`))}}e.theme.emoji.custom.images=E}}if(((I=(a=(s=e.theme)==null?void 0:s.skin)==null?void 0:a.light)==null?void 0:I.backgroundType)==="image"&&e.theme.skin.light.backgroundImage===null){const h="background_light";if(await this.restoreResourceFromStorage(h)){const f=this.resources.get(h);f&&(e.theme.skin.light.backgroundImage=f.file,t.push(`Light background: ${f.filename}`))}}if(((Q=(C=(l=e.theme)==null?void 0:l.skin)==null?void 0:C.dark)==null?void 0:Q.backgroundType)==="image"&&e.theme.skin.dark.backgroundImage===null){const h="background_dark";if(await this.restoreResourceFromStorage(h)){const f=this.resources.get(h);f&&(e.theme.skin.dark.backgroundImage=f.file,t.push(`Dark background: ${f.filename}`))}}try{const h=this.getFontInfo();if(h&&h.type==="custom"){const f=`converted_font_${h.filename}`,u=await this.configStorage.loadTempData(f);u&&(this.convertedFonts.set(h.filename,u.data),console.log(`Converted font data restored: ${h.filename}`))}}catch(h){console.warn("Error restoring converted font data:",h)}t.length>0&&console.log("Files restored from storage:",t)}getWakewordModelInfo(){if(!this.config||!this.config.chip||!this.config.theme)return null;const e=this.config.chip.model,t=this.config.theme.wakeword;return!t||t.type==="none"?null:t.type==="preset"?{type:e==="esp32c3"||e==="esp32c6"?"WakeNet9s":"WakeNet9",name:t.preset,filename:"srmodels.bin"}:t.type==="custom"?{type:"MultiNet",name:t.custom.model,filename:"srmodels.bin",custom:t.custom}:null}getFontInfo(){if(!this.config||!this.config.theme||!this.config.theme.font)return null;const e=this.config.theme.font;if(e.type==="preset")return{type:"preset",filename:`${e.preset}.bin`,source:e.preset};if(e.type==="custom"&&e.custom.file){const t=e.custom;return{type:"custom",filename:`font_custom_${t.size}_${t.bpp}.bin`,source:e.custom.file,config:{size:t.size,bpp:t.bpp,charset:t.charset}}}return null}async getEmojiCollectionInfo(){if(!this.config||!this.config.theme||!this.config.theme.emoji)return[];const e=this.config.theme.emoji,t=[];if(e.type==="preset"){const i=["neutral","happy","laughing","funny","sad","angry","crying","loving","embarrassed","surprised","shocked","thinking","winking","cool","relaxed","delicious","kissy","confident","sleepy","silly","confused"],o=e.preset==="twemoji32"?"32":"64";i.forEach(n=>{t.push({name:n,file:`${n}.png`,source:`preset:${e.preset}`,size:{width:parseInt(o),height:parseInt(o)}})})}else if(e.type==="custom"){e.custom.images;const i=e.custom.emotionMap||{},o=e.custom.fileMap||{},n=e.custom.size||{width:64,height:64};if(Object.keys(i).length===0||Object.keys(o).length===0)throw console.error("❌ Error: Detected old version of emoji data structure"),console.error("Please clear browser cache or reset configuration, then re-upload emoji images"),new Error("Incompatible emoji data structure: Missing fileMap or emotionMap. Please reconfigure emojis.");const r=new Map;for(const[g,s]of Object.entries(i)){let a=o[s];if(a||(console.log(`Restoring emoji file from storage: ${g} (hash: ${s.substring(0,8)})`),a=await si.restoreEmojiFile(`hash_${s}`)),a){if(!r.has(s)){const l=a.name?a.name.split(".").pop().toLowerCase():"png",C=`emoji_${s.substring(0,8)}.${l}`;r.set(s,C)}const I=r.get(s);t.push({name:g,file:I,source:a,fileHash:s,size:{...n}})}else console.warn(`Failed to restore emoji file: ${g} (hash: ${s.substring(0,8)})`)}console.log(`Emoji deduplication: ${Object.keys(i).length} emojis using ${r.size} different image files`),t.find(g=>g.name==="neutral")||console.warn("Warning: neutral emoji not provided, default image will be used")}return t}getSkinInfo(){if(!this.config||!this.config.theme||!this.config.theme.skin)return{};const e=this.config.theme.skin,t={};return e.light&&(t.light={text_color:e.light.textColor||"#000000",background_color:e.light.backgroundColor||"#ffffff"},e.light.backgroundType==="image"&&e.light.backgroundImage&&(t.light.background_image="background_light.raw")),e.dark&&(t.dark={text_color:e.dark.textColor||"#ffffff",background_color:e.dark.backgroundColor||"#121212"},e.dark.backgroundType==="image"&&e.dark.backgroundImage&&(t.dark.background_image="background_dark.raw")),t}async generateIndexJson(){if(!this.config)throw new Error("Configuration object not set");const e={version:1,chip_model:this.config.chip.model,hide_subtitle:this.config.theme.font.hide_subtitle||!1,display_config:{width:this.config.chip.display.width,height:this.config.chip.display.height,monochrome:!1,color:this.config.chip.display.color||"RGB565"}},t=this.getWakewordModelInfo();if(t&&(e.srmodels=t.filename,t.type==="MultiNet"&&t.custom)){const r=t.custom;e.multinet_model={language:r.model.includes("_en")?"en":"cn",duration:r.duration||3e3,threshold:r.threshold/100,commands:[{command:r.command,text:r.name,action:"wake"}]}}const i=this.getFontInfo();i&&(e.text_font=i.filename);const o=this.getSkinInfo();Object.keys(o).length>0&&(e.skin=o);const n=await this.getEmojiCollectionInfo();return n.length>0&&(e.emoji_collection=n.map(r=>({name:r.name,file:r.file}))),e}async preparePackageResources(){var g,s,a,I;const e={files:[],indexJson:await this.generateIndexJson(),config:{...this.config}},t=this.getWakewordModelInfo();t&&t.name&&e.files.push({type:"wakeword",name:t.name,filename:t.filename,modelType:t.type,isCustom:t.type==="MultiNet"});const i=this.getFontInfo();i&&e.files.push({type:"font",filename:i.filename,source:i.source,config:i.config||null});const o=await this.getEmojiCollectionInfo(),n=new Set;o.forEach(l=>{if(l.fileHash){if(n.has(l.fileHash)){console.log(`Skipping duplicate file: ${l.name} -> ${l.file} (hash: ${l.fileHash.substring(0,8)})`);return}n.add(l.fileHash)}e.files.push({type:"emoji",name:l.name,filename:l.file,source:l.source,size:l.size,fileHash:l.fileHash})});const r=(s=(g=this.config)==null?void 0:g.theme)==null?void 0:s.skin;return((a=r==null?void 0:r.light)==null?void 0:a.backgroundType)==="image"&&r.light.backgroundImage&&e.files.push({type:"background",filename:"background_light.raw",source:r.light.backgroundImage,mode:"light"}),((I=r==null?void 0:r.dark)==null?void 0:I.backgroundType)==="image"&&r.dark.backgroundImage&&e.files.push({type:"background",filename:"background_dark.raw",source:r.dark.backgroundImage,mode:"dark"}),e}async preprocessCustomFonts(e=null){const t=this.getFontInfo();if(t&&t.type==="custom"&&!this.convertedFonts.has(t.filename)){e&&e(20,"Converting custom font...");try{const i={fontFile:t.source,fontName:t.filename.replace(/\.bin$/,""),fontSize:t.config.size,bpp:t.config.bpp,charset:t.config.charset,symbols:t.config.symbols||"",range:t.config.range||"",compression:!1,progressCallback:(n,r)=>{e&&e(20+n*.2,`Font conversion: ${r}`)}};let o;if(await this.fontConverterBrowser.initialize(),o=await this.fontConverterBrowser.convertToCBIN(i),this.convertedFonts.set(t.filename,o),this.autoSaveEnabled){const n=`converted_font_${t.filename}`;try{await this.configStorage.saveTempData(n,o,"converted_font",{filename:t.filename,size:t.config.size,bpp:t.config.bpp,charset:t.config.charset}),console.log(`Converted font saved to storage: ${t.filename}`)}catch(r){console.warn(`Failed to save converted font: ${t.filename}`,r)}}}catch(i){throw console.error("Font conversion failed:",i),new Error(`Font conversion failed: ${i.message}`)}}}async generateAssetsBin(e=null){if(!this.config)throw new Error("Configuration object not set");try{e&&e(0,"Starting generation..."),await this.preprocessCustomFonts(e),await new Promise(o=>setTimeout(o,100)),e&&e(40,"Preparing resource files...");const t=await this.preparePackageResources();this.wakenetPacker.clear(),this.spiffsGenerator.clear(),await this.processResourceFiles(t,e),await new Promise(o=>setTimeout(o,100)),e&&e(90,"Generating final file..."),this.spiffsGenerator.printFileList();const i=await this.spiffsGenerator.generate((o,n)=>{e&&e(90+o*.1,n)});return e&&e(100,"Generation completed"),new Blob([i],{type:"application/octet-stream"})}catch(t){throw console.error("Failed to generate assets.bin:",t),t}}downloadAssetsBin(e,t="assets.bin"){const i=URL.createObjectURL(e),o=document.createElement("a");o.href=i,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i)}async getFontInfoWithDetails(e=null){var t,i,o,n;try{const r=e||((n=(o=(i=(t=this.config)==null?void 0:t.theme)==null?void 0:i.font)==null?void 0:o.custom)==null?void 0:n.file);if(!r)return null;let g;return await this.fontConverterBrowser.initialize(),g=await this.fontConverterBrowser.getFontInfo(r),{...g,file:r,isCustom:!0}}catch(r){return console.error("Failed to get font details:",r),null}}async estimateFontSize(e=null){var t,i,o;try{const n=e||((o=(i=(t=this.config)==null?void 0:t.theme)==null?void 0:i.font)==null?void 0:o.custom);if(!n)return null;const r={fontSize:n.size,bpp:n.bpp,charset:n.charset,symbols:n.symbols||"",range:n.range||""};let g;return g=this.fontConverterBrowser.estimateSize(r),g}catch(n){return console.error("Failed to estimate font size:",n),null}}validateCustomFont(e){const t=[],i=[];return e.file?this.fontConverterBrowser.validateFont(e.file)||t.push("Font file format not supported"):t.push("Missing font file"),(e.size<8||e.size>80)&&t.push("Font size must be between 8-80"),[1,2,4,8].includes(e.bpp)||t.push("BPP must be 1, 2, 4 or 8"),!e.charset&&!e.symbols&&!e.range&&i.push("No charset, symbols or range specified, default charset will be used"),{valid:t.length===0,errors:t,warnings:i}}getConverterStatus(){return{initialized:this.fontConverterBrowser.initialized,supportedFormats:this.fontConverterBrowser.supportedFormats}}async processResourceFiles(e,t=null){let i=0;const o=e.files.length,n=new TextEncoder().encode(JSON.stringify(e.indexJson,null,2));console.log("index.json",e.indexJson),this.spiffsGenerator.addFile("index.json",n.buffer);for(const r of e.files){const g=40+i/o*40;t&&t(g,`Processing file: ${r.filename}`);try{await this.processResourceFile(r),i++}catch(s){throw console.error(`Failed to process resource file: ${r.filename}`,s),new Error(`Failed to process resource file: ${r.filename} - ${s.message}`)}}}async processResourceFile(e){switch(e.type){case"wakeword":await this.processWakewordModel(e);break;case"font":await this.processFontFile(e);break;case"emoji":await this.processEmojiFile(e);break;case"background":await this.processBackgroundFile(e);break;default:console.warn(`Unknown resource type: ${e.type}`)}}async processWakewordModel(e){if(!await this.wakenetPacker.loadModelFromShare(e.name))throw new Error(`Failed to load wakeword model: ${e.name}`);const i=this.wakenetPacker.packModels();this.spiffsGenerator.addFile(e.filename,i)}async processFontFile(e){if(e.config){const t=this.convertedFonts.get(e.filename);if(t)this.spiffsGenerator.addFile(e.filename,t);else throw new Error(`Converted font not found: ${e.filename}`)}else{const t=await this.loadPresetFont(e.source);this.spiffsGenerator.addFile(e.filename,t)}}async processEmojiFile(e){var r,g;let t,i=!1,o="png",n=!1;if(typeof e.source=="string"&&e.source.startsWith("preset:")){const s=e.source.replace("preset:","");t=await this.loadPresetEmoji(s,e.name)}else{const s=e.source;n=this.isGifFile(s),o=s.name.split(".").pop().toLowerCase();try{const I=await this.getImageDimensions(s),l=e.size||{width:64,height:64};(I.width>l.width||I.height>l.height)&&(i=!0,console.log(`Emoji ${e.name} needs scaling: ${I.width}x${I.height} -> ${l.width}x${l.height}`))}catch(I){console.warn(`Failed to get emoji image dimensions: ${e.name}`,I)}i||(t=await this.fileToArrayBuffer(s))}if(i)try{const s=e.size||{width:64,height:64};if(n){console.log(`Using WasmGifScaler to process GIF emoji: ${e.name}`);const a=await this.gifScaler.scaleGif(e.source,{maxWidth:s.width,maxHeight:s.height,keepAspectRatio:!0,lossy:30});t=await this.fileToArrayBuffer(a)}else t=await this.scaleImageToFit(e.source,s,o)}catch(s){console.error(`Failed to scale emoji image: ${e.name}`,s),t=await this.fileToArrayBuffer(e.source)}this.spiffsGenerator.addFile(e.filename,t,{width:((r=e.size)==null?void 0:r.width)||0,height:((g=e.size)==null?void 0:g.height)||0}),e.fileHash&&console.log(`Emoji file added: ${e.filename} (hash: ${e.fileHash.substring(0,8)})`)}async processBackgroundFile(e){const t=await this.fileToArrayBuffer(e.source),i=await this.convertImageToRgb565(t);this.spiffsGenerator.addFile(e.filename,i)}async loadPresetFont(e){try{const t=await fetch(`./static/fonts/${e}.bin`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.arrayBuffer()}catch(t){throw new Error(`Failed to load preset font: ${e} - ${t.message}`)}}async loadPresetEmoji(e,t){try{const i=await fetch(`./static/${e}/${t}.png`);if(!i.ok)throw new Error(`HTTP ${i.status}`);return await i.arrayBuffer()}catch(i){throw new Error(`Failed to load preset emoji: ${e}/${t} - ${i.message}`)}}fileToArrayBuffer(e){return new Promise((t,i)=>{const o=new FileReader;o.onload=()=>t(o.result),o.onerror=()=>i(new Error("Failed to read file")),o.readAsArrayBuffer(e)})}async scaleImageToFit(e,t,i="png"){return new Promise((o,n)=>{const r=e instanceof File?e:new Blob([e]),g=URL.createObjectURL(r),s=new Image;s.onload=()=>{try{const a=document.createElement("canvas"),I=a.getContext("2d");a.width=t.width,a.height=t.height;const l=s.width/s.height,C=t.width/t.height;let Q,h,f,u;l>C?(Q=t.width,h=t.width/l,f=0,u=(t.height-h)/2):(h=t.height,Q=t.height*l,f=(t.width-Q)/2,u=0),i==="png"?I.clearRect(0,0,a.width,a.height):(I.fillStyle="#FFFFFF",I.fillRect(0,0,a.width,a.height)),I.drawImage(s,f,u,Q,h),a.toBlob(E=>{const D=new FileReader;D.onload=()=>o(D.result),D.onerror=()=>n(new Error("Failed to convert image data")),D.readAsArrayBuffer(E)},`image/${i}`),URL.revokeObjectURL(g)}catch(a){URL.revokeObjectURL(g),n(a)}},s.onerror=()=>{URL.revokeObjectURL(g),n(new Error("Unable to load image"))},s.src=g})}isGifFile(e){return e.type==="image/gif"?!0:e.name.split(".").pop().toLowerCase()==="gif"}async getImageDimensions(e){return new Promise((t,i)=>{const o=e instanceof File?e:new Blob([e]),n=URL.createObjectURL(o),r=new Image;r.onload=()=>{URL.revokeObjectURL(n),t({width:r.width,height:r.height})},r.onerror=()=>{URL.revokeObjectURL(n),i(new Error("Unable to get image dimensions"))},r.src=n})}async convertImageToRgb565(e){return new Promise((t,i)=>{const o=new Blob([e]),n=URL.createObjectURL(o),r=new Image;r.onload=()=>{var g,s,a,I,l,C;try{const Q=document.createElement("canvas"),h=Q.getContext("2d",{willReadFrequently:!0});Q.width=((a=(s=(g=this.config)==null?void 0:g.chip)==null?void 0:s.display)==null?void 0:a.width)||320,Q.height=((C=(l=(I=this.config)==null?void 0:I.chip)==null?void 0:l.display)==null?void 0:C.height)||240;const f=r.width/r.height,u=Q.width/Q.height;let E,D,c,d;f>u?(D=Q.height,E=Q.height*f,c=(Q.width-E)/2,d=0):(E=Q.width,D=Q.width/f,c=0,d=(Q.height-D)/2),h.drawImage(r,c,d,E,D);const v=h.getImageData(0,0,Q.width,Q.height).data,N=new ArrayBuffer(Q.width*Q.height*2),G=new Uint16Array(N);for(let W=0;W>3,DA=v[W+1]>>2,NA=v[W+2]>>3;G[W/4]=z<<11|DA<<5|NA}const H=25,S=18,b=Q.width*2,L=28,QA=L+N.byteLength,dA=new ArrayBuffer(QA),IA=new Uint8Array(dA),oA=new DataView(dA);let X=0;const tA=0|S<<8|H;oA.setUint32(X,tA,!0),X+=4;const fA=Q.height<<16|Q.width;oA.setUint32(X,fA,!0),X+=4;const _=0|b;oA.setUint32(X,_,!0),X+=4,oA.setUint32(X,N.byteLength,!0),X+=4,oA.setUint32(X,L,!0),X+=4,oA.setUint32(X,0,!0),X+=4,oA.setUint32(X,0,!0),X+=4,IA.set(new Uint8Array(N),L),URL.revokeObjectURL(n),t(dA)}catch(Q){URL.revokeObjectURL(n),i(Q)}},r.onerror=()=>{URL.revokeObjectURL(n),i(new Error("Unable to load image"))},r.src=n})}cleanup(){this.resources.clear(),this.tempFiles=[],this.convertedFonts.clear(),this.wakenetPacker.clear(),this.spiffsGenerator.clear(),this.gifScaler.dispose()}async clearAllStoredData(){try{await this.configStorage.clearAll(),this.cleanup(),console.log("All stored data cleared")}catch(e){throw console.error("Failed to clear stored data:",e),e}}async getStorageStatus(){try{const e=await this.configStorage.getStorageInfo();return{hasStoredData:await this.configStorage.hasStoredConfig(),storageInfo:e,autoSaveEnabled:this.autoSaveEnabled}}catch(e){return console.error("Failed to get storage status:",e),{hasStoredData:!1,storageInfo:null,autoSaveEnabled:this.autoSaveEnabled}}}setAutoSave(e){this.autoSaveEnabled=e,console.log(`Auto-save ${e?"enabled":"disabled"}`)}async getResourceSummary(){const e=[],t=await this.preparePackageResources(),i={wakeword:0,font:0,emoji:0,background:0};return t.files.forEach(o=>{i[o.type]=(i[o.type]||0)+1;let n="";switch(o.type){case"wakeword":n=`Wakeword model: ${o.name} (${o.modelType})`;break;case"font":o.config?n=`Custom font: size ${o.config.size}px, BPP ${o.config.bpp}`:n=`Preset font: ${o.source}`;break;case"emoji":n=`Emoji: ${o.name} (${o.size.width}x${o.size.height})`;break;case"background":n=`${o.mode==="light"?"Light":"Dark"} mode background`;break}e.push({type:o.type,filename:o.filename,description:n})}),{files:e,counts:i,totalFiles:e.length,indexJson:t.indexJson}}}const IS={class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4"},CS={class:"bg-white rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden"},lS={class:"flex items-center justify-between p-6 border-b border-gray-200"},BS={class:"text-lg font-medium text-gray-900"},QS={key:1,class:"text-sm text-orange-600 font-medium"},cS={class:"p-6 overflow-y-auto",style:{"max-height":"calc(90vh - 140px)"}},ES={key:0,class:"space-y-6"},uS={class:"font-medium text-gray-900 mb-3"},hS={class:"bg-gray-50 rounded-lg p-4 space-y-2 text-sm"},fS={class:"flex justify-between"},dS={class:"text-gray-600"},pS={class:"font-medium"},mS={class:"flex justify-between"},yS={class:"text-gray-600"},wS={class:"font-medium"},DS={class:"flex justify-between"},kS={class:"text-gray-600"},vS={class:"font-medium"},FS={class:"flex justify-between"},SS={class:"text-gray-600"},RS={class:"font-medium"},bS={class:"flex justify-between"},NS={class:"text-gray-600"},GS={class:"font-medium"},LS={class:"font-medium text-gray-900 mb-3"},US={class:"space-y-2 max-h-64 overflow-y-auto"},MS={class:"flex items-center"},xS={class:"text-sm font-medium text-gray-900"},JS={class:"text-sm text-gray-700"},TS={key:0,class:"text-xs text-gray-500 ml-1"},HS={key:1,class:"text-xs text-gray-500 ml-1"},YS={key:1,class:"space-y-6 text-center"},_S={class:"space-y-4"},KS={class:"text-gray-600 mt-2"},OS={class:"bg-gray-200 rounded-full h-2 overflow-hidden"},PS={class:"text-sm text-gray-600"},VS={class:"mt-1"},WS={class:"space-y-2 text-left"},qS={class:"flex-shrink-0 mr-3"},jS={key:0,class:"w-5 h-5 bg-green-500 rounded-full flex items-center justify-center"},ZS={key:1,class:"w-5 h-5 bg-primary-500 rounded-full animate-pulse"},XS={key:2,class:"w-5 h-5 bg-gray-300 rounded-full"},zS={key:2,class:"text-center space-y-6"},$S={class:"text-gray-600 mt-2"},AR={class:"bg-green-50 border border-green-200 rounded-lg p-4"},eR={class:"text-sm text-green-800 space-y-1"},tR={class:"space-y-3"},iR=["disabled"],oR={key:3,class:"space-y-6 text-center"},nR={class:"space-y-4"},rR={class:"text-gray-600"},gR={class:"bg-gray-200 rounded-full h-2 overflow-hidden"},sR={class:"text-sm text-gray-600"},aR={class:"mt-1"},IR={key:4,class:"text-center mt-4"},CR={class:"text-sm text-red-600"},lR={class:"flex justify-end space-x-3 p-6 border-t border-gray-200"},BR=["disabled"],QR={__name:"GenerateModal",props:{config:{type:Object,required:!0}},emits:["close","generate","startFlash"],setup(A,{emit:e}){const{t}=ve(),i=A,o=e,{deviceInfo:n,checkDeviceStatus:r,isDeviceOnline:g}=Nn(),s=EA(!1),a=EA(!1),I=EA(0),l=EA(""),C=EA(""),Q=EA(""),h=EA(null),f=EA(null),u=EA(!1),E=EA(0),D=EA(""),c=EA(""),d=hA(()=>[{id:1,name:t("progressSteps.init"),status:"pending"},{id:2,name:t("progressSteps.font"),status:"pending"},{id:3,name:t("progressSteps.wakeword"),status:"pending"},{id:4,name:t("progressSteps.emoji"),status:"pending"},{id:5,name:t("progressSteps.background"),status:"pending"},{id:6,name:t("progressSteps.index"),status:"pending"},{id:7,name:t("progressSteps.spiffs"),status:"pending"},{id:8,name:t("progressSteps.package"),status:"pending"}]),p=EA([]),v=_i({render:()=>GA("svg",{fill:"currentColor",viewBox:"0 0 20 20"},[GA("path",{d:"M4 3a2 2 0 00-2 2v1a1 1 0 001 1h14a1 1 0 001-1V5a2 2 0 00-2-2H4zM3 8a1 1 0 011-1h12a1 1 0 011 1v5a2 2 0 01-2 2H5a2 2 0 01-2-2V8z"})])}),N=_i({render:()=>GA("svg",{fill:"currentColor",viewBox:"0 0 20 20"},[GA("path",{"fill-rule":"evenodd",d:"M7 4a3 3 0 016 0v4a3 3 0 11-6 0V4zm4 10.93A7.001 7.001 0 0017 8a1 1 0 10-2 0A5 5 0 015 8a1 1 0 00-2 0 7.001 7.001 0 006 6.93V17H6a1 1 0 100 2h8a1 1 0 100-2h-3v-2.07z","clip-rule":"evenodd"})])}),G=_i({render:()=>GA("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[GA("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 4l8 16m-6-6h4"})])}),H=_i({render:()=>GA("svg",{fill:"currentColor",viewBox:"0 0 20 20"},[GA("path",{"fill-rule":"evenodd",d:"M4 3a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V5a2 2 0 00-2-2H4zm12 12H4l4-8 3 6 2-4 3 6z","clip-rule":"evenodd"})])}),S=hA(()=>p.value.length>0),b=()=>{const _=i.config.theme.wakeword;return!_||_.type==="none"?t("wakewordConfig.noWakeword"):_.type==="preset"?{wn9s_hilexin:"Hi,乐鑫",wn9s_hiesp:"Hi,ESP",wn9s_nihaoxiaozhi:"你好小智",wn9_nihaoxiaozhi_tts:"你好小智",wn9_alexa:"Alexa"}[_.preset]||_.preset:_.type==="custom"?_.custom.name||t("wakewordConfig.customWakeword"):t("wakewordConfig.noWakeword")},L=()=>i.config.theme.font.type==="preset"?i.config.theme.font.preset.replace("font_","").replace("_"," "):t("generateModal.customFont"),QA=()=>i.config.theme.emoji.type==="preset"&&i.config.theme.emoji.preset?i.config.theme.emoji.preset==="twemoji32"?"Twemoji 32×32":"Twemoji 64×64":i.config.theme.emoji.type==="custom"?t("generateModal.customEmoji"):i.config.theme.emoji.type==="none"?t("emojiConfig.noEmojiPack"):t("generateModal.notConfigured"),dA=()=>{p.value=[],p.value.push({id:"index",name:"index.json",description:"配置索引文件",icon:v,iconColor:"text-blue-500",size:"1KB"});const _=i.config.theme.wakeword;if(_&&_.type!=="none"&&p.value.push({id:"srmodels",name:"srmodels.bin",description:_.type==="custom"?"自定义命令词模型":"预设唤醒词模型",icon:N,iconColor:"text-green-500",size:_.type==="custom"?"~1.2MB":"~300KB"}),i.config.theme.font.type==="preset"){const W={font_puhui_deepseek_14_1:"180KB",font_puhui_deepseek_16_4:"720KB",font_puhui_deepseek_20_4:"1.1MB",font_puhui_deepseek_30_4:"2.5MB"};p.value.push({id:"font",name:`${i.config.theme.font.preset}.bin`,description:"预设字体文件",icon:G,iconColor:"text-yellow-500",size:W[i.config.theme.font.preset]||"500KB"})}else if(i.config.theme.font.custom.file){const W=i.config.theme.font.custom,z=Math.max(100,W.size*W.size*W.bpp*.7);p.value.push({id:"font",name:`font_custom_${W.size}_${W.bpp}.bin`,description:"自定义字体文件",icon:G,iconColor:"text-yellow-500",size:z>1024?`${(z/1024).toFixed(1)}MB`:`${Math.round(z)}KB`,estimated:!0})}if(i.config.theme.emoji.type==="preset"&&i.config.theme.emoji.preset){const W=["neutral","happy","laughing","funny","sad","angry","crying","loving","embarrassed","surprised","shocked","thinking","winking","cool","relaxed","delicious","kissy","confident","sleepy","silly","confused"],z=i.config.theme.emoji.preset==="twemoji64"?"3KB":"1KB";W.forEach(DA=>{p.value.push({id:`emoji_${DA}`,name:`${DA}.png`,description:`${DA}表情图片`,icon:H,iconColor:"text-pink-500",size:z})})}else if(i.config.theme.emoji.type==="custom"){const W=i.config.theme.emoji.custom,z=W.emotionMap||{},DA=W.fileMap||{};if(W.images,Object.keys(z).length===0||Object.keys(DA).length===0){console.error(t("errors.incompatibleEmojiData"));return}const NA=new Map,oe=new Map;Object.entries(z).forEach(([LA,Y])=>{const $=DA[Y];if($){if(!NA.has(Y)){const AA=Math.round($.size/1024);NA.set(Y,{file:$,size:AA>1024?`${(AA/1024).toFixed(1)}MB`:`${AA}KB`,emotions:[]})}NA.get(Y).emotions.push(LA),oe.set(LA,Y)}}),NA.forEach((LA,Y)=>{const $=LA.emotions.join(", "),AA=LA.emotions.length>1;p.value.push({id:`emoji_${Y.substring(0,8)}`,name:`emoji_${Y.substring(0,8)}.${LA.file.name.split(".").pop()}`,description:AA?`共享表情图片 (${$})`:`${$}表情图片`,icon:H,iconColor:AA?"text-purple-500":"text-pink-500",size:LA.size,isCustomEmoji:!0})}),NA.size1024?`${(DA/1024).toFixed(1)}MB`:`${DA}KB`,estimated:!0})}if(i.config.theme.skin.dark.backgroundType==="image"&&i.config.theme.skin.dark.backgroundImage){const{width:W,height:z}=i.config.chip.display,DA=Math.round(W*z*2/1024);p.value.push({id:"bg_dark",name:"background_dark.raw",description:"深色模式背景图片",icon:H,iconColor:"text-indigo-500",size:DA>1024?`${(DA/1024).toFixed(1)}MB`:`${DA}KB`,estimated:!0})}},IA=_=>{if(_===0)return"0 B";const W=1024,z=["B","KB","MB","GB"],DA=Math.floor(Math.log(_)/Math.log(W));return`${parseFloat((_/Math.pow(W,DA)).toFixed(2))} ${z[DA]}`},oA=_=>{if(_<1e3)return`${_}ms`;if(_<6e4)return`${(_/1e3).toFixed(1)}s`;{const W=Math.floor(_/6e4),z=Math.floor(_%6e4/1e3);return`${W}m ${z}s`}},X=async()=>{s.value=!0,I.value=0,f.value=Date.now();try{const _=new _l;_.setConfig(i.config);const W=await _.generateAssetsBin((NA,oe)=>{I.value=parseInt(NA),l.value=oe;const LA=Math.floor(NA/(100/d.value.length));d.value.forEach((Y,$)=>{${NA.status="completed"}),o("generate",p.value.map(NA=>({id:NA.id,name:NA.name})))}catch(_){console.error("生成 assets.bin 失败:",_),s.value=!1,a.value=!1,alert(t("errors.generationFailed",{error:_.message}))}},tA=()=>{if(h.value){const _=URL.createObjectURL(h.value),W=document.createElement("a");W.href=_,W.download="assets.bin",W.style.display="none",document.body.appendChild(W),W.click(),document.body.removeChild(W),URL.revokeObjectURL(_)}else console.error(t("errors.noFileToDownload"))},fA=async()=>{if(!h.value){alert(t("errors.noFileToDownload"));return}if(!g.value){alert(t("errors.deviceOffline"));return}if(n.value.assetsPartition&&n.value.assetsPartition.size){const _=n.value.assetsPartition.size,W=h.value.size;if(W>_){const z=(W/1024/1024).toFixed(2),DA=(_/1024/1024).toFixed(2);alert(t("errors.fileTooLarge",{fileSize:z,partitionSize:DA}));return}}u.value=!0,E.value=0,D.value=t("flashProgress.startingFileTransfer"),c.value="";try{o("startFlash",{blob:h.value,onProgress:(_,W)=>{E.value=_,D.value=W},onComplete:()=>{u.value=!1,E.value=100,D.value=t("flashProgress.flashCompleted")},onError:_=>{u.value=!1,c.value=_,console.error(t("flashProgress.onlineFlashFailed",{error:_}))}})}catch(_){u.value=!1,c.value=t("flashProgress.onlineFlashFailed",{error:_.message}),console.error(t("flashProgress.onlineFlashFailed",{error:_}))}};return Ft(async()=>{dA(),await r(!1)}),(_,W)=>(T(),K("div",IS,[B("div",CS,[B("div",lS,[B("h3",BS,F(_.$t("generateModal.title")),1),u.value?(T(),K("div",QS,F(_.$t("generateModal.flashingInProgress")),1)):(T(),K("button",{key:0,onClick:W[0]||(W[0]=z=>_.$emit("close")),class:"text-gray-400 hover:text-gray-500"},[...W[3]||(W[3]=[B("svg",{class:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])]))]),B("div",cS,[!s.value&&!a.value?(T(),K("div",ES,[B("div",null,[B("h4",uS,F(_.$t("generateModal.confirmConfig")),1),B("div",hS,[B("div",fS,[B("span",dS,F(_.$t("generateModal.chipModel")),1),B("span",pS,F(A.config.chip.model.toUpperCase()),1)]),B("div",mS,[B("span",yS,F(_.$t("generateModal.resolution")),1),B("span",wS,F(A.config.chip.display.width)+"×"+F(A.config.chip.display.height),1)]),B("div",DS,[B("span",kS,F(_.$t("generateModal.wakeword")),1),B("span",vS,F(b()),1)]),B("div",FS,[B("span",SS,F(_.$t("generateModal.font")),1),B("span",RS,F(L()),1)]),B("div",bS,[B("span",NS,F(_.$t("generateModal.emoji")),1),B("span",GS,F(QA()),1)])])]),B("div",null,[B("h4",LS,F(_.$t("generateModal.fileList")),1),B("div",US,[(T(!0),K(qA,null,Ke(p.value,z=>(T(),K("div",{key:z.id,class:"flex items-center justify-between px-3 py-2 border border-gray-200 rounded bg-gray-50"},[B("div",MS,[(T(),ye(HI(z.icon),{class:kA(["w-4 h-4 mr-2",z.iconColor])},null,8,["class"])),B("span",xS,F(z.name),1)]),B("div",JS,[gt(F(z.size)+" ",1),z.estimated?(T(),K("span",TS,F(_.$t("generateModal.estimated")),1)):sA("",!0),z.isCustomEmoji?(T(),K("span",HS,F(_.$t("generateModal.compressed")),1)):sA("",!0)])]))),128))])])])):sA("",!0),s.value?(T(),K("div",YS,[W[5]||(W[5]=B("div",{class:"flex items-center justify-center"},[B("div",{class:"animate-spin rounded-full h-16 w-16 border-b-2 border-primary-500"})],-1)),B("div",_S,[B("p",KS,F(_.$t("generateModal.generating")),1),B("div",OS,[B("div",{class:"bg-primary-500 h-2 rounded-full transition-all duration-500 ease-out",style:VA({width:I.value+"%"})},null,4)]),B("div",PS,[B("div",null,F(l.value),1),B("div",VS,F(_.$t("generateModal.progress",{progress:I.value})),1)])]),B("div",WS,[(T(!0),K(qA,null,Ke(d.value,z=>(T(),K("div",{key:z.id,class:"flex items-center text-sm"},[B("div",qS,[z.status==="completed"?(T(),K("div",jS,[...W[4]||(W[4]=[B("svg",{class:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})],-1)])])):z.status==="processing"?(T(),K("div",ZS)):(T(),K("div",XS))]),B("span",{class:kA([z.status==="completed"?"text-green-700":z.status==="processing"?"text-primary-700":"text-gray-500"])},F(z.name),3)]))),128))])])):sA("",!0),a.value&&!u.value?(T(),K("div",zS,[W[8]||(W[8]=B("div",{class:"mx-auto flex items-center justify-center"},[B("svg",{class:"w-20 h-20 text-green-600",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z","clip-rule":"evenodd"})])],-1)),B("div",null,[B("p",$S,F(_.$t("generateModal.completed")),1)]),B("div",AR,[B("div",eR,[B("div",null,F(_.$t("generateModal.filename")),1),B("div",null,F(_.$t("generateModal.fileSize",{size:C.value})),1),B("div",null,F(_.$t("generateModal.generationTime",{time:Q.value})),1)])]),B("div",tR,[B("button",{onClick:tA,class:"w-full bg-gray-100 hover:bg-gray-200 text-gray-700 px-6 py-3 rounded-lg font-medium transition-colors flex items-center justify-center"},[W[6]||(W[6]=B("svg",{class:"w-5 h-5 mr-2",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)),gt(" "+F(_.$t("generateModal.downloadAssets")),1)]),B("button",{onClick:fA,disabled:!BA(g),class:"w-full bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-6 py-3 rounded-lg font-medium transition-colors flex items-center justify-center"},[W[7]||(W[7]=B("svg",{class:"w-5 h-5 mr-2",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)),gt(" "+F(_.$t("generateModal.flashToDevice")),1)],8,iR)])])):sA("",!0),u.value&&!c.value?(T(),K("div",oR,[W[9]||(W[9]=B("div",{class:"flex items-center justify-center"},[B("div",{class:"animate-spin rounded-full h-16 w-16 border-b-2 border-blue-500"})],-1)),B("div",nR,[B("p",rR,F(_.$t("generateModal.flashing")),1),B("div",gR,[B("div",{class:"bg-blue-500 h-2 rounded-full transition-all duration-500 ease-out",style:VA({width:E.value+"%"})},null,4)]),B("div",sR,[B("div",null,F(D.value),1),B("div",aR,F(_.$t("generateModal.progress",{progress:E.value})),1)])])])):sA("",!0),c.value?(T(),K("div",IR,[B("p",CR,F(c.value),1)])):sA("",!0)]),B("div",lR,[!s.value&&!a.value?(T(),K("button",{key:0,onClick:W[1]||(W[1]=z=>_.$emit("close")),class:"px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-md transition-colors"},F(_.$t("common.cancel")),1)):sA("",!0),!s.value&&!a.value?(T(),K("button",{key:1,onClick:X,disabled:!S.value,class:"px-6 py-2 text-sm font-medium text-white bg-primary-500 hover:bg-primary-600 disabled:bg-gray-300 rounded-md transition-colors"},F(_.$t("common.start"))+" "+F(_.$t("common.generate")),9,BR)):sA("",!0),a.value&&!u.value?(T(),K("button",{key:2,onClick:W[2]||(W[2]=z=>_.$emit("close")),class:"px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-md transition-colors"},F(_.$t("common.close")),1)):sA("",!0)])])]))}},cR={class:"flex items-center justify-between mb-2"},ER={class:"flex items-center"},uR={class:"text-blue-800 font-medium"},hR={class:"text-blue-600 text-sm mb-3"},fR={class:"flex justify-end space-x-2"},dR={class:"flex items-center justify-center mb-8"},pR={class:"flex flex-col items-center"},mR={class:"text-sm mt-2 text-gray-600"},yR={key:0,class:"w-16 h-0.5 bg-gray-300 mx-4"},wR={class:"bg-white rounded-lg shadow-sm border p-6"},Kl={__name:"HomePage",setup(A){const e=Nn(),{t}=ve(),i=EA(30),o=EA(null),n=EA(0),r=EA(!1),g=EA("wakeword"),s=EA(!1),a=EA(!1),I=EA(!1),l=EA(!0),C=new _l,Q=EA(null),h=EA(""),f=[{titleKey:"steps.chip",key:"chip"},{titleKey:"steps.theme",key:"theme"},{titleKey:"steps.generate",key:"generate"}],u=EA({chip:{model:"",display:{width:320,height:240,color:"RGB565"}},theme:{wakeword:{type:"none",preset:"",custom:{name:"",command:"",threshold:20,duration:3e3,model:"mn6_cn"}},font:{type:"none",preset:"",hide_subtitle:!1,custom:{file:null,size:20,bpp:4,charset:"deepseek"}},emoji:{type:"none",preset:"",custom:{size:{width:160,height:120},images:{}}},skin:{light:{backgroundType:"color",backgroundColor:"#ffffff",textColor:"#000000",backgroundImage:null},dark:{backgroundType:"color",backgroundColor:"#121212",textColor:"#ffffff",backgroundImage:null}}}});hA(()=>u.value.chip.model&&(u.value.theme.font.type==="none"||u.value.theme.font.preset||u.value.theme.font.custom.file));const E=IA=>IA{n.value{n.value>0&&n.value--},d=()=>{r.value=!0},p=async IA=>{},v=async(IA,oA={})=>await e.callMcpTool(IA,oA),N=async IA=>{const{blob:oA,onProgress:X,onComplete:tA,onError:fA}=IA;try{X(15,t("flashProgress.checkingDeviceStatus"));try{if((await v("self.get_device_status")).code!==0)throw new Error(t("flashProgress.deviceOfflineOrUnresponsive",{error:t("flashProgress.unableToGetDeviceStatus")}))}catch(_){console.error("检查设备状态失败:",_),fA(t("flashProgress.deviceOfflineOrUnresponsive",{error:_.msg}));return}X(30,t("flashProgress.uploadingFile"));try{const _=new FormData;_.append("file",oA,"assets.bin");const z=await(await fetch("/xiaozhi/otaMag/uploadAssetsBin",{method:"POST",body:_,headers:{Authorization:`Bearer ${e.token.value}`}})).json();z.code!==0&&await Promise.reject(z),h.value=z.data}catch{fA(t("flashProgress.uploadFailed"));return}X(45,t("flashProgress.settingDeviceDownloadUrl"));try{const _=await v("self.assets.set_download_url",{url:h.value});_.code!==0&&await Promise.reject(_)}catch(_){console.error("设置下载URL失败:",_),fA(t("flashProgress.setDownloadUrlFailed",{error:_.msg}));return}X(60,t("flashProgress.waitingForDeviceReboot")),await v("self.reboot").catch(_=>{console.warn("reboot指令调用警告(设备可能已重启):",_)}),X(75,t("flashProgress.deviceReady")),o.value=setInterval(()=>{if(X(90,t("flashProgress.flashCompleted")),i.value-=1,i.value<=0){clearInterval(o.value),i.value=30,o.value=null,fA("请求超时,请检查设备烧录是否异常");return}v("self.get_device_status").then(_=>{o.value&&_.code===0&&(clearInterval(o.value),o.value=null,i.value=30,tA())})},5e3)}catch(_){console.error("在线烧录失败:",_),fA(t("flashProgress.onlineFlashFailed",{error:_.msg}))}},G=IA=>{g.value=IA},H=async()=>{var IA,oA,X;try{l.value=!0;const tA=await Qe.loadConfig();if(tA){u.value=tA.config,n.value=0,g.value="wakeword",s.value=!0,a.value=!0,await S(),Q.value&&clearTimeout(Q.value),Q.value=setTimeout(()=>{s.value=!1},5e3),C.setConfig(u.value,{strict:!1}),await C.restoreAllResourcesFromStorage(u.value);try{const fA=((X=(oA=(IA=u.value)==null?void 0:IA.theme)==null?void 0:oA.emoji)==null?void 0:X.custom)||{},_=fA.images||{},W=fA.fileMap||{},z=fA.emotionMap||{};u.value={...u.value,theme:{...u.value.theme,emoji:{...u.value.theme.emoji,custom:{...fA,images:{..._},fileMap:{...W},emotionMap:{...z}}}}}}catch(fA){console.error("刷新表情配置引用失败:",fA)}}else s.value=!1,a.value=!1}catch(tA){console.error("加载配置失败:",tA),s.value=!1,a.value=!1}finally{l.value=!1}},S=async()=>{var IA,oA,X;try{const tA=(X=(oA=(IA=u.value)==null?void 0:IA.theme)==null?void 0:oA.emoji)==null?void 0:X.custom;if(!tA)return;const fA=Object.keys(tA.images||{}).length>0,_=tA.fileMap&&Object.keys(tA.fileMap).length>0,W=tA.emotionMap&&Object.keys(tA.emotionMap).length>0;if(fA&&(!_||!W)){console.warn("⚠️ 检测到旧版本的表情数据结构(不兼容)"),console.log("正在清理旧数据...");try{const DA=Object.keys(tA.images||{});for(const NA of DA)await Qe.deleteFile(`emoji_${NA}`);console.log(`已删除 ${DA.length} 个旧表情文件`)}catch(DA){console.warn("清理旧表情文件时出错:",DA)}u.value.theme.emoji.custom={size:tA.size||{width:64,height:64},images:{},fileMap:{},emotionMap:{}},u.value.theme.emoji.type==="custom"&&(u.value.theme.emoji.type="",console.log("已重置表情类型,请重新选择")),await b(),console.log("✅ 旧表情数据已完全清除"),setTimeout(()=>{alert(`检测到旧版本的表情数据结构已被清除。 + +新版本使用文件去重技术,可以节省存储空间。 + +请重新上传自定义表情图片。`)},500)}}catch(tA){console.error("清理旧表情数据时出错:",tA)}},b=async()=>{try{await Qe.saveConfig(u.value)}catch(IA){console.error("保存配置失败:",IA)}},L=async()=>{try{I.value=!0,await C.clearAllStoredData();const IA={model:u.value.chip.model,display:{...u.value.chip.display}};u.value={chip:IA,theme:{wakeword:{type:"none",preset:"",custom:{name:"",command:"",threshold:20,model:"mn6_cn"}},font:{type:"none",preset:"",hide_subtitle:!1,custom:{file:null,size:20,bpp:4,charset:"deepseek"}},emoji:{type:"none",preset:"",custom:{size:{width:64,height:64},images:{}}},skin:{light:{backgroundType:"color",backgroundColor:"#ffffff",textColor:"#000000",backgroundImage:null},dark:{backgroundType:"color",backgroundColor:"#121212",textColor:"#ffffff",backgroundImage:null}}}},n.value=0,g.value="wakeword",s.value=!1,a.value=!1}catch(IA){console.error("重置配置失败:",IA),alert(t("errors.resetFailed"))}finally{I.value=!1}};ae(u,async IA=>{!l.value&&a.value&&await b()},{deep:!0}),Ft(async()=>{await Qe.initialize(),await H()}),Ci(()=>{Q.value&&(clearTimeout(Q.value),clearInterval(o.value))});const QA=()=>{s.value=!1,Q.value&&clearTimeout(Q.value)},dA=()=>{Q.value&&clearTimeout(Q.value),Q.value=setTimeout(()=>{s.value=!1},5e3)};return(IA,oA)=>(T(),K("div",null,[s.value?(T(),K("div",{key:0,class:"fixed bottom-4 right-4 z-50 bg-blue-50 border border-blue-200 rounded-lg p-4 shadow-lg transition-opacity duration-300 min-w-[300px]",onMouseenter:dA},[B("div",cR,[B("div",ER,[oA[3]||(oA[3]=B("svg",{class:"w-5 h-5 text-blue-500 mr-2",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z","clip-rule":"evenodd"})],-1)),B("span",uR,F(IA.$t("configNotice.title")),1)]),B("button",{onClick:QA,class:"text-gray-500 hover:text-gray-700"},[...oA[4]||(oA[4]=[B("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),B("p",hR,F(IA.$t("configNotice.message")),1),B("div",fR,[B("button",{onClick:L,class:"px-3 py-1 text-sm text-red-600 hover:text-red-800 font-medium"},F(IA.$t("configNotice.restart")),1)])],32)):sA("",!0),B("div",dR,[(T(),K(qA,null,Ke(f,(X,tA)=>B("div",{key:tA,class:"flex items-center"},[B("div",pR,[B("div",{class:kA(E(tA))},F(tA+1),3),B("span",mR,F(IA.$t(X.titleKey)),1)]),tAu.value.chip=X),onNext:D},null,8,["modelValue"])):sA("",!0),n.value===1?(T(),ye(yy,{key:1,modelValue:u.value.theme,"onUpdate:modelValue":oA[1]||(oA[1]=X=>u.value.theme=X),chipModel:u.value.chip.model,activeTab:g.value,onNext:D,onPrev:c,onTabChange:G},null,8,["modelValue","chipModel","activeTab"])):sA("",!0),n.value===2?(T(),ye(Ew,{key:2,config:u.value,onGenerate:d,onPrev:c},null,8,["config"])):sA("",!0)]),r.value?(T(),ye(QR,{key:1,config:u.value,onClose:oA[2]||(oA[2]=X=>r.value=!1),onGenerate:p,onStartFlash:N},null,8,["config"])):sA("",!0)]))}},DR=Object.freeze(Object.defineProperty({__proto__:null,default:Kl},Symbol.toStringTag,{value:"Module"})),kR={class:"min-h-screen bg-gray-50"},vR={class:"bg-white shadow-sm border-b"},FR={class:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4"},SR={class:"flex flex-col relative sm:flex-row items-start sm:items-center justify-between gap-3 sm:gap-0"},RR={class:"text-2xl font-bold text-gray-900"},bR={class:"flex items-center space-x-4"},NR={class:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8"},GR={__name:"App",setup(A){const e=EA(""),t=()=>{e.value&&(window.location.href=e.value)};return Ft(()=>{e.value=sessionStorage.getItem("devicePath")}),(i,o)=>(T(),K("div",kR,[B("header",vR,[B("div",FR,[B("div",SR,[e.value?(T(),K("div",{key:0,class:"bg-primary-500 hover:bg-primary-600 text-white px-6 py-1 rounded-md cursor-pointer",onClick:t},"返回")):sA("",!0),B("h1",RR,F(i.$t("header.title")),1),B("div",bR,[TA(Eh),TA(gd)])])])]),B("main",NR,[TA(Kl)])]))}};/*! + * vue-router v4.6.4 + * (c) 2025 Eduardo San Martin Morote + * @license MIT + */const Ei=typeof document<"u";function Ol(A){return typeof A=="object"||"displayName"in A||"props"in A||"__vccOpts"in A}function LR(A){return A.__esModule||A[Symbol.toStringTag]==="Module"||A.default&&Ol(A.default)}const MA=Object.assign;function nr(A,e){const t={};for(const i in e){const o=e[i];t[i]=qe(o)?o.map(A):A(o)}return t}const zi=()=>{},qe=Array.isArray;function Ha(A,e){const t={};for(const i in A)t[i]=i in e?e[i]:A[i];return t}const Pl=/#/g,UR=/&/g,MR=/\//g,xR=/=/g,JR=/\?/g,Vl=/\+/g,TR=/%5B/g,HR=/%5D/g,Wl=/%5E/g,YR=/%60/g,ql=/%7B/g,_R=/%7C/g,jl=/%7D/g,KR=/%20/g;function Fg(A){return A==null?"":encodeURI(""+A).replace(_R,"|").replace(TR,"[").replace(HR,"]")}function OR(A){return Fg(A).replace(ql,"{").replace(jl,"}").replace(Wl,"^")}function Yr(A){return Fg(A).replace(Vl,"%2B").replace(KR,"+").replace(Pl,"%23").replace(UR,"%26").replace(YR,"`").replace(ql,"{").replace(jl,"}").replace(Wl,"^")}function PR(A){return Yr(A).replace(xR,"%3D")}function VR(A){return Fg(A).replace(Pl,"%23").replace(JR,"%3F")}function WR(A){return VR(A).replace(MR,"%2F")}function Qo(A){if(A==null)return null;try{return decodeURIComponent(""+A)}catch{}return""+A}const qR=/\/$/,jR=A=>A.replace(qR,"");function rr(A,e,t="/"){let i,o={},n="",r="";const g=e.indexOf("#");let s=e.indexOf("?");return s=g>=0&&s>g?-1:s,s>=0&&(i=e.slice(0,s),n=e.slice(s,g>0?g:e.length),o=A(n.slice(1))),g>=0&&(i=i||e.slice(0,g),r=e.slice(g,e.length)),i=$R(i??e,t),{fullPath:i+n+r,path:i,query:o,hash:Qo(r)}}function ZR(A,e){const t=e.query?A(e.query):"";return e.path+(t&&"?")+t+(e.hash||"")}function Ya(A,e){return!e||!A.toLowerCase().startsWith(e.toLowerCase())?A:A.slice(e.length)||"/"}function XR(A,e,t){const i=e.matched.length-1,o=t.matched.length-1;return i>-1&&i===o&&bi(e.matched[i],t.matched[o])&&Zl(e.params,t.params)&&A(e.query)===A(t.query)&&e.hash===t.hash}function bi(A,e){return(A.aliasOf||A)===(e.aliasOf||e)}function Zl(A,e){if(Object.keys(A).length!==Object.keys(e).length)return!1;for(var t in A)if(!zR(A[t],e[t]))return!1;return!0}function zR(A,e){return qe(A)?_a(A,e):qe(e)?_a(e,A):(A==null?void 0:A.valueOf())===(e==null?void 0:e.valueOf())}function _a(A,e){return qe(e)?A.length===e.length&&A.every((t,i)=>t===e[i]):A.length===1&&A[0]===e}function $R(A,e){if(A.startsWith("/"))return A;if(!A)return e;const t=e.split("/"),i=A.split("/"),o=i[i.length-1];(o===".."||o===".")&&i.push("");let n=t.length-1,r,g;for(r=0;r1&&n--;else break;return t.slice(0,n).join("/")+"/"+i.slice(r).join("/")}const Gt={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let _r=function(A){return A.pop="pop",A.push="push",A}({}),gr=function(A){return A.back="back",A.forward="forward",A.unknown="",A}({});function Ab(A){if(!A)if(Ei){const e=document.querySelector("base");A=e&&e.getAttribute("href")||"/",A=A.replace(/^\w+:\/\/[^\/]+/,"")}else A="/";return A[0]!=="/"&&A[0]!=="#"&&(A="/"+A),jR(A)}const eb=/^[^#]+#/;function tb(A,e){return A.replace(eb,"#")+e}function ib(A,e){const t=document.documentElement.getBoundingClientRect(),i=A.getBoundingClientRect();return{behavior:e.behavior,left:i.left-t.left-(e.left||0),top:i.top-t.top-(e.top||0)}}const Un=()=>({left:window.scrollX,top:window.scrollY});function ob(A){let e;if("el"in A){const t=A.el,i=typeof t=="string"&&t.startsWith("#"),o=typeof t=="string"?i?document.getElementById(t.slice(1)):document.querySelector(t):t;if(!o)return;e=ib(o,A)}else e=A;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function Ka(A,e){return(history.state?history.state.position-e:-1)+A}const Kr=new Map;function nb(A,e){Kr.set(A,e)}function rb(A){const e=Kr.get(A);return Kr.delete(A),e}function gb(A){return typeof A=="string"||A&&typeof A=="object"}function Xl(A){return typeof A=="string"||typeof A=="symbol"}let XA=function(A){return A[A.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",A[A.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",A[A.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",A[A.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",A[A.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",A}({});const zl=Symbol("");XA.MATCHER_NOT_FOUND+"",XA.NAVIGATION_GUARD_REDIRECT+"",XA.NAVIGATION_ABORTED+"",XA.NAVIGATION_CANCELLED+"",XA.NAVIGATION_DUPLICATED+"";function Ni(A,e){return MA(new Error,{type:A,[zl]:!0},e)}function ct(A,e){return A instanceof Error&&zl in A&&(e==null||!!(A.type&e))}const sb=["params","query","hash"];function ab(A){if(typeof A=="string")return A;if(A.path!=null)return A.path;const e={};for(const t of sb)t in A&&(e[t]=A[t]);return JSON.stringify(e,null,2)}function Ib(A){const e={};if(A===""||A==="?")return e;const t=(A[0]==="?"?A.slice(1):A).split("&");for(let i=0;io&&Yr(o)):[i&&Yr(i)]).forEach(o=>{o!==void 0&&(e+=(e.length?"&":"")+t,o!=null&&(e+="="+o))})}return e}function Cb(A){const e={};for(const t in A){const i=A[t];i!==void 0&&(e[t]=qe(i)?i.map(o=>o==null?null:""+o):i==null?i:""+i)}return e}const lb=Symbol(""),Pa=Symbol(""),Sg=Symbol(""),$l=Symbol(""),Or=Symbol("");function Yi(){let A=[];function e(i){return A.push(i),()=>{const o=A.indexOf(i);o>-1&&A.splice(o,1)}}function t(){A=[]}return{add:e,list:()=>A.slice(),reset:t}}function Tt(A,e,t,i,o,n=r=>r()){const r=i&&(i.enterCallbacks[o]=i.enterCallbacks[o]||[]);return()=>new Promise((g,s)=>{const a=C=>{C===!1?s(Ni(XA.NAVIGATION_ABORTED,{from:t,to:e})):C instanceof Error?s(C):gb(C)?s(Ni(XA.NAVIGATION_GUARD_REDIRECT,{from:e,to:C})):(r&&i.enterCallbacks[o]===r&&typeof C=="function"&&r.push(C),g())},I=n(()=>A.call(i&&i.instances[o],e,t,a));let l=Promise.resolve(I);A.length<3&&(l=l.then(a)),l.catch(C=>s(C))})}function sr(A,e,t,i,o=n=>n()){const n=[];for(const r of A)for(const g in r.components){let s=r.components[g];if(!(e!=="beforeRouteEnter"&&!r.instances[g]))if(Ol(s)){const a=(s.__vccOpts||s)[e];a&&n.push(Tt(a,t,i,r,g,o))}else{let a=s();n.push(()=>a.then(I=>{if(!I)throw new Error(`Couldn't resolve component "${g}" at "${r.path}"`);const l=LR(I)?I.default:I;r.mods[g]=I,r.components[g]=l;const C=(l.__vccOpts||l)[e];return C&&Tt(C,t,i,r,g,o)()}))}}return n}function Bb(A,e){const t=[],i=[],o=[],n=Math.max(e.matched.length,A.matched.length);for(let r=0;rbi(a,g))?i.push(g):t.push(g));const s=A.matched[r];s&&(e.matched.find(a=>bi(a,s))||o.push(s))}return[t,i,o]}/*! + * vue-router v4.6.4 + * (c) 2025 Eduardo San Martin Morote + * @license MIT + */let Qb=()=>location.protocol+"//"+location.host;function AB(A,e){const{pathname:t,search:i,hash:o}=e,n=A.indexOf("#");if(n>-1){let r=o.includes(A.slice(n))?A.slice(n).length:1,g=o.slice(r);return g[0]!=="/"&&(g="/"+g),Ya(g,"")}return Ya(t,A)+i+o}function cb(A,e,t,i){let o=[],n=[],r=null;const g=({state:C})=>{const Q=AB(A,location),h=t.value,f=e.value;let u=0;if(C){if(t.value=Q,e.value=C,r&&r===h){r=null;return}u=f?C.position-f.position:0}else i(Q);o.forEach(E=>{E(t.value,h,{delta:u,type:_r.pop,direction:u?u>0?gr.forward:gr.back:gr.unknown})})};function s(){r=t.value}function a(C){o.push(C);const Q=()=>{const h=o.indexOf(C);h>-1&&o.splice(h,1)};return n.push(Q),Q}function I(){if(document.visibilityState==="hidden"){const{history:C}=window;if(!C.state)return;C.replaceState(MA({},C.state,{scroll:Un()}),"")}}function l(){for(const C of n)C();n=[],window.removeEventListener("popstate",g),window.removeEventListener("pagehide",I),document.removeEventListener("visibilitychange",I)}return window.addEventListener("popstate",g),window.addEventListener("pagehide",I),document.addEventListener("visibilitychange",I),{pauseListeners:s,listen:a,destroy:l}}function Va(A,e,t,i=!1,o=!1){return{back:A,current:e,forward:t,replaced:i,position:window.history.length,scroll:o?Un():null}}function Eb(A){const{history:e,location:t}=window,i={value:AB(A,t)},o={value:e.state};o.value||n(i.value,{back:null,current:i.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function n(s,a,I){const l=A.indexOf("#"),C=l>-1?(t.host&&document.querySelector("base")?A:A.slice(l))+s:Qb()+A+s;try{e[I?"replaceState":"pushState"](a,"",C),o.value=a}catch(Q){console.error(Q),t[I?"replace":"assign"](C)}}function r(s,a){n(s,MA({},e.state,Va(o.value.back,s,o.value.forward,!0),a,{position:o.value.position}),!0),i.value=s}function g(s,a){const I=MA({},o.value,e.state,{forward:s,scroll:Un()});n(I.current,I,!0),n(s,MA({},Va(i.value,s,null),{position:I.position+1},a),!1),i.value=s}return{location:i,state:o,push:g,replace:r}}function ub(A){A=Ab(A);const e=Eb(A),t=cb(A,e.state,e.location,e.replace);function i(n,r=!0){r||t.pauseListeners(),history.go(n)}const o=MA({location:"",base:A,go:i,createHref:tb.bind(null,A)},e,t);return Object.defineProperty(o,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(o,"state",{enumerable:!0,get:()=>e.state.value}),o}let ni=function(A){return A[A.Static=0]="Static",A[A.Param=1]="Param",A[A.Group=2]="Group",A}({});var ne=function(A){return A[A.Static=0]="Static",A[A.Param=1]="Param",A[A.ParamRegExp=2]="ParamRegExp",A[A.ParamRegExpEnd=3]="ParamRegExpEnd",A[A.EscapeNext=4]="EscapeNext",A}(ne||{});const hb={type:ni.Static,value:""},fb=/[a-zA-Z0-9_]/;function db(A){if(!A)return[[]];if(A==="/")return[[hb]];if(!A.startsWith("/"))throw new Error(`Invalid path "${A}"`);function e(Q){throw new Error(`ERR (${t})/"${a}": ${Q}`)}let t=ne.Static,i=t;const o=[];let n;function r(){n&&o.push(n),n=[]}let g=0,s,a="",I="";function l(){a&&(t===ne.Static?n.push({type:ni.Static,value:a}):t===ne.Param||t===ne.ParamRegExp||t===ne.ParamRegExpEnd?(n.length>1&&(s==="*"||s==="+")&&e(`A repeatable param (${a}) must be alone in its segment. eg: '/:ids+.`),n.push({type:ni.Param,value:a,regexp:I,repeatable:s==="*"||s==="+",optional:s==="*"||s==="?"})):e("Invalid state to consume buffer"),a="")}function C(){a+=s}for(;ge.length?e.length===1&&e[0]===pe.Static+pe.Segment?1:-1:0}function eB(A,e){let t=0;const i=A.score,o=e.score;for(;t0&&e[e.length-1]<0}const Db={strict:!1,end:!0,sensitive:!1};function kb(A,e,t){const i=yb(db(A.path),t),o=MA(i,{record:A,parent:e,children:[],alias:[]});return e&&!o.record.aliasOf==!e.record.aliasOf&&e.children.push(o),o}function vb(A,e){const t=[],i=new Map;e=Ha(Db,e);function o(l){return i.get(l)}function n(l,C,Q){const h=!Q,f=Za(l);f.aliasOf=Q&&Q.record;const u=Ha(e,l),E=[f];if("alias"in l){const d=typeof l.alias=="string"?[l.alias]:l.alias;for(const p of d)E.push(Za(MA({},f,{components:Q?Q.record.components:f.components,path:p,aliasOf:Q?Q.record:f})))}let D,c;for(const d of E){const{path:p}=d;if(C&&p[0]!=="/"){const v=C.record.path,N=v[v.length-1]==="/"?"":"/";d.path=C.record.path+(p&&N+p)}if(D=kb(d,C,u),Q?Q.alias.push(D):(c=c||D,c!==D&&c.alias.push(D),h&&l.name&&!Xa(D)&&r(l.name)),tB(D)&&s(D),f.children){const v=f.children;for(let N=0;N{r(c)}:zi}function r(l){if(Xl(l)){const C=i.get(l);C&&(i.delete(l),t.splice(t.indexOf(C),1),C.children.forEach(r),C.alias.forEach(r))}else{const C=t.indexOf(l);C>-1&&(t.splice(C,1),l.record.name&&i.delete(l.record.name),l.children.forEach(r),l.alias.forEach(r))}}function g(){return t}function s(l){const C=Rb(l,t);t.splice(C,0,l),l.record.name&&!Xa(l)&&i.set(l.record.name,l)}function a(l,C){let Q,h={},f,u;if("name"in l&&l.name){if(Q=i.get(l.name),!Q)throw Ni(XA.MATCHER_NOT_FOUND,{location:l});u=Q.record.name,h=MA(ja(C.params,Q.keys.filter(c=>!c.optional).concat(Q.parent?Q.parent.keys.filter(c=>c.optional):[]).map(c=>c.name)),l.params&&ja(l.params,Q.keys.map(c=>c.name))),f=Q.stringify(h)}else if(l.path!=null)f=l.path,Q=t.find(c=>c.re.test(f)),Q&&(h=Q.parse(f),u=Q.record.name);else{if(Q=C.name?i.get(C.name):t.find(c=>c.re.test(C.path)),!Q)throw Ni(XA.MATCHER_NOT_FOUND,{location:l,currentLocation:C});u=Q.record.name,h=MA({},C.params,l.params),f=Q.stringify(h)}const E=[];let D=Q;for(;D;)E.unshift(D.record),D=D.parent;return{name:u,path:f,params:h,matched:E,meta:Sb(E)}}A.forEach(l=>n(l));function I(){t.length=0,i.clear()}return{addRoute:n,resolve:a,removeRoute:r,clearRoutes:I,getRoutes:g,getRecordMatcher:o}}function ja(A,e){const t={};for(const i of e)i in A&&(t[i]=A[i]);return t}function Za(A){const e={path:A.path,redirect:A.redirect,name:A.name,meta:A.meta||{},aliasOf:A.aliasOf,beforeEnter:A.beforeEnter,props:Fb(A),children:A.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in A?A.components||null:A.component&&{default:A.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function Fb(A){const e={},t=A.props||!1;if("component"in A)e.default=t;else for(const i in A.components)e[i]=typeof t=="object"?t[i]:t;return e}function Xa(A){for(;A;){if(A.record.aliasOf)return!0;A=A.parent}return!1}function Sb(A){return A.reduce((e,t)=>MA(e,t.meta),{})}function Rb(A,e){let t=0,i=e.length;for(;t!==i;){const n=t+i>>1;eB(A,e[n])<0?i=n:t=n+1}const o=bb(A);return o&&(i=e.lastIndexOf(o,i-1)),i}function bb(A){let e=A;for(;e=e.parent;)if(tB(e)&&eB(A,e)===0)return e}function tB({record:A}){return!!(A.name||A.components&&Object.keys(A.components).length||A.redirect)}function za(A){const e=rt(Sg),t=rt($l),i=hA(()=>{const s=BA(A.to);return e.resolve(s)}),o=hA(()=>{const{matched:s}=i.value,{length:a}=s,I=s[a-1],l=t.matched;if(!I||!l.length)return-1;const C=l.findIndex(bi.bind(null,I));if(C>-1)return C;const Q=$a(s[a-2]);return a>1&&$a(I)===Q&&l[l.length-1].path!==Q?l.findIndex(bi.bind(null,s[a-2])):C}),n=hA(()=>o.value>-1&&Mb(t.params,i.value.params)),r=hA(()=>o.value>-1&&o.value===t.matched.length-1&&Zl(t.params,i.value.params));function g(s={}){if(Ub(s)){const a=e[BA(A.replace)?"replace":"push"](BA(A.to)).catch(zi);return A.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>a),a}return Promise.resolve()}return{route:i,href:hA(()=>i.value.href),isActive:n,isExactActive:r,navigate:g}}function Nb(A){return A.length===1?A[0]:A}const Gb=ho({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:za,setup(A,{slots:e}){const t=pn(za(A)),{options:i}=rt(Sg),o=hA(()=>({[AI(A.activeClass,i.linkActiveClass,"router-link-active")]:t.isActive,[AI(A.exactActiveClass,i.linkExactActiveClass,"router-link-exact-active")]:t.isExactActive}));return()=>{const n=e.default&&Nb(e.default(t));return A.custom?n:GA("a",{"aria-current":t.isExactActive?A.ariaCurrentValue:null,href:t.href,onClick:t.navigate,class:o.value},n)}}}),Lb=Gb;function Ub(A){if(!(A.metaKey||A.altKey||A.ctrlKey||A.shiftKey)&&!A.defaultPrevented&&!(A.button!==void 0&&A.button!==0)){if(A.currentTarget&&A.currentTarget.getAttribute){const e=A.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return A.preventDefault&&A.preventDefault(),!0}}function Mb(A,e){for(const t in e){const i=e[t],o=A[t];if(typeof i=="string"){if(i!==o)return!1}else if(!qe(o)||o.length!==i.length||i.some((n,r)=>n.valueOf()!==o[r].valueOf()))return!1}return!0}function $a(A){return A?A.aliasOf?A.aliasOf.path:A.path:""}const AI=(A,e,t)=>A??e??t,xb=ho({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(A,{attrs:e,slots:t}){const i=rt(Or),o=hA(()=>A.route||i.value),n=rt(Pa,0),r=hA(()=>{let a=BA(n);const{matched:I}=o.value;let l;for(;(l=I[a])&&!l.components;)a++;return a}),g=hA(()=>o.value.matched[r.value]);Ho(Pa,hA(()=>r.value+1)),Ho(lb,g),Ho(Or,o);const s=EA();return ae(()=>[s.value,g.value,A.name],([a,I,l],[C,Q,h])=>{I&&(I.instances[l]=a,Q&&Q!==I&&a&&a===C&&(I.leaveGuards.size||(I.leaveGuards=Q.leaveGuards),I.updateGuards.size||(I.updateGuards=Q.updateGuards))),a&&I&&(!Q||!bi(I,Q)||!C)&&(I.enterCallbacks[l]||[]).forEach(f=>f(a))},{flush:"post"}),()=>{const a=o.value,I=A.name,l=g.value,C=l&&l.components[I];if(!C)return eI(t.default,{Component:C,route:a});const Q=l.props[I],h=Q?Q===!0?a.params:typeof Q=="function"?Q(a):Q:null,u=GA(C,MA({},h,e,{onVnodeUnmounted:E=>{E.component.isUnmounted&&(l.instances[I]=null)},ref:s}));return eI(t.default,{Component:u,route:a})||u}}});function eI(A,e){if(!A)return null;const t=A(e);return t.length===1?t[0]:t}const Jb=xb;function Tb(A){const e=vb(A.routes,A),t=A.parseQuery||Ib,i=A.stringifyQuery||Oa,o=A.history,n=Yi(),r=Yi(),g=Yi(),s=tg(Gt);let a=Gt;Ei&&A.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const I=nr.bind(null,Y=>""+Y),l=nr.bind(null,WR),C=nr.bind(null,Qo);function Q(Y,$){let AA,cA;return Xl(Y)?(AA=e.getRecordMatcher(Y),cA=$):cA=Y,e.addRoute(cA,AA)}function h(Y){const $=e.getRecordMatcher(Y);$&&e.removeRoute($)}function f(){return e.getRoutes().map(Y=>Y.record)}function u(Y){return!!e.getRecordMatcher(Y)}function E(Y,$){if($=MA({},$||s.value),typeof Y=="string"){const k=rr(t,Y,$.path),x=e.resolve({path:k.path},$),q=o.createHref(k.fullPath);return MA(k,x,{params:C(x.params),hash:Qo(k.hash),redirectedFrom:void 0,href:q})}let AA;if(Y.path!=null)AA=MA({},Y,{path:rr(t,Y.path,$.path).path});else{const k=MA({},Y.params);for(const x in k)k[x]==null&&delete k[x];AA=MA({},Y,{params:l(k)}),$.params=l($.params)}const cA=e.resolve(AA,$),SA=Y.hash||"";cA.params=I(C(cA.params));const w=ZR(i,MA({},Y,{hash:OR(SA),path:cA.path})),R=o.createHref(w);return MA({fullPath:w,hash:SA,query:i===Oa?Cb(Y.query):Y.query||{}},cA,{redirectedFrom:void 0,href:R})}function D(Y){return typeof Y=="string"?rr(t,Y,s.value.path):MA({},Y)}function c(Y,$){if(a!==Y)return Ni(XA.NAVIGATION_CANCELLED,{from:$,to:Y})}function d(Y){return N(Y)}function p(Y){return d(MA(D(Y),{replace:!0}))}function v(Y,$){const AA=Y.matched[Y.matched.length-1];if(AA&&AA.redirect){const{redirect:cA}=AA;let SA=typeof cA=="function"?cA(Y,$):cA;return typeof SA=="string"&&(SA=SA.includes("?")||SA.includes("#")?SA=D(SA):{path:SA},SA.params={}),MA({query:Y.query,hash:Y.hash,params:SA.path!=null?{}:Y.params},SA)}}function N(Y,$){const AA=a=E(Y),cA=s.value,SA=Y.state,w=Y.force,R=Y.replace===!0,k=v(AA,cA);if(k)return N(MA(D(k),{state:typeof k=="object"?MA({},SA,k.state):SA,force:w,replace:R}),$||AA);const x=AA;x.redirectedFrom=$;let q;return!w&&XR(i,cA,AA)&&(q=Ni(XA.NAVIGATION_DUPLICATED,{to:x,from:cA}),W(cA,cA,!0,!1)),(q?Promise.resolve(q):S(x,cA)).catch(V=>ct(V)?ct(V,XA.NAVIGATION_GUARD_REDIRECT)?V:_(V):tA(V,x,cA)).then(V=>{if(V){if(ct(V,XA.NAVIGATION_GUARD_REDIRECT))return N(MA({replace:R},D(V.to),{state:typeof V.to=="object"?MA({},SA,V.to.state):SA,force:w}),$||x)}else V=L(x,cA,!0,R,SA);return b(x,cA,V),V})}function G(Y,$){const AA=c(Y,$);return AA?Promise.reject(AA):Promise.resolve()}function H(Y){const $=NA.values().next().value;return $&&typeof $.runWithContext=="function"?$.runWithContext(Y):Y()}function S(Y,$){let AA;const[cA,SA,w]=Bb(Y,$);AA=sr(cA.reverse(),"beforeRouteLeave",Y,$);for(const k of cA)k.leaveGuards.forEach(x=>{AA.push(Tt(x,Y,$))});const R=G.bind(null,Y,$);return AA.push(R),LA(AA).then(()=>{AA=[];for(const k of n.list())AA.push(Tt(k,Y,$));return AA.push(R),LA(AA)}).then(()=>{AA=sr(SA,"beforeRouteUpdate",Y,$);for(const k of SA)k.updateGuards.forEach(x=>{AA.push(Tt(x,Y,$))});return AA.push(R),LA(AA)}).then(()=>{AA=[];for(const k of w)if(k.beforeEnter)if(qe(k.beforeEnter))for(const x of k.beforeEnter)AA.push(Tt(x,Y,$));else AA.push(Tt(k.beforeEnter,Y,$));return AA.push(R),LA(AA)}).then(()=>(Y.matched.forEach(k=>k.enterCallbacks={}),AA=sr(w,"beforeRouteEnter",Y,$,H),AA.push(R),LA(AA))).then(()=>{AA=[];for(const k of r.list())AA.push(Tt(k,Y,$));return AA.push(R),LA(AA)}).catch(k=>ct(k,XA.NAVIGATION_CANCELLED)?k:Promise.reject(k))}function b(Y,$,AA){g.list().forEach(cA=>H(()=>cA(Y,$,AA)))}function L(Y,$,AA,cA,SA){const w=c(Y,$);if(w)return w;const R=$===Gt,k=Ei?history.state:{};AA&&(cA||R?o.replace(Y.fullPath,MA({scroll:R&&k&&k.scroll},SA)):o.push(Y.fullPath,SA)),s.value=Y,W(Y,$,AA,R),_()}let QA;function dA(){QA||(QA=o.listen((Y,$,AA)=>{if(!oe.listening)return;const cA=E(Y),SA=v(cA,oe.currentRoute.value);if(SA){N(MA(SA,{replace:!0,force:!0}),cA).catch(zi);return}a=cA;const w=s.value;Ei&&nb(Ka(w.fullPath,AA.delta),Un()),S(cA,w).catch(R=>ct(R,XA.NAVIGATION_ABORTED|XA.NAVIGATION_CANCELLED)?R:ct(R,XA.NAVIGATION_GUARD_REDIRECT)?(N(MA(D(R.to),{force:!0}),cA).then(k=>{ct(k,XA.NAVIGATION_ABORTED|XA.NAVIGATION_DUPLICATED)&&!AA.delta&&AA.type===_r.pop&&o.go(-1,!1)}).catch(zi),Promise.reject()):(AA.delta&&o.go(-AA.delta,!1),tA(R,cA,w))).then(R=>{R=R||L(cA,w,!1),R&&(AA.delta&&!ct(R,XA.NAVIGATION_CANCELLED)?o.go(-AA.delta,!1):AA.type===_r.pop&&ct(R,XA.NAVIGATION_ABORTED|XA.NAVIGATION_DUPLICATED)&&o.go(-1,!1)),b(cA,w,R)}).catch(zi)}))}let IA=Yi(),oA=Yi(),X;function tA(Y,$,AA){_(Y);const cA=oA.list();return cA.length?cA.forEach(SA=>SA(Y,$,AA)):console.error(Y),Promise.reject(Y)}function fA(){return X&&s.value!==Gt?Promise.resolve():new Promise((Y,$)=>{IA.add([Y,$])})}function _(Y){return X||(X=!Y,dA(),IA.list().forEach(([$,AA])=>Y?AA(Y):$()),IA.reset()),Y}function W(Y,$,AA,cA){const{scrollBehavior:SA}=A;if(!Ei||!SA)return Promise.resolve();const w=!AA&&rb(Ka(Y.fullPath,0))||(cA||!AA)&&history.state&&history.state.scroll||null;return uo().then(()=>SA(Y,$,w)).then(R=>R&&ob(R)).catch(R=>tA(R,Y,$))}const z=Y=>o.go(Y);let DA;const NA=new Set,oe={currentRoute:s,listening:!0,addRoute:Q,removeRoute:h,clearRoutes:e.clearRoutes,hasRoute:u,getRoutes:f,resolve:E,options:A,push:d,replace:p,go:z,back:()=>z(-1),forward:()=>z(1),beforeEach:n.add,beforeResolve:r.add,afterEach:g.add,onError:oA.add,isReady:fA,install(Y){Y.component("RouterLink",Lb),Y.component("RouterView",Jb),Y.config.globalProperties.$router=oe,Object.defineProperty(Y.config.globalProperties,"$route",{enumerable:!0,get:()=>BA(s)}),Ei&&!DA&&s.value===Gt&&(DA=!0,d(o.location).catch(cA=>{}));const $={};for(const cA in Gt)Object.defineProperty($,cA,{get:()=>s.value[cA],enumerable:!0});Y.provide(Sg,oe),Y.provide($l,DI($)),Y.provide(Or,s);const AA=Y.unmount;NA.add(Y),Y.unmount=function(){NA.delete(Y),NA.size<1&&(a=Gt,QA&&QA(),QA=null,s.value=Gt,DA=!1,X=!1),AA()}}};function LA(Y){return Y.reduce(($,AA)=>$.then(()=>H(AA)),Promise.resolve())}return oe}const Hb=[{path:"/",name:"Home",component:()=>Ul(()=>Promise.resolve().then(()=>DR),void 0,import.meta.url)}],Yb=Tb({history:ub("./"),routes:Hb}),_b=fu({legacy:!1,locale:ed(),fallbackLocale:"en",messages:Ad}),Rg=fc(GR);Rg.use(Yb);Rg.use(_b);Rg.mount("#app"); diff --git a/main/manager-web/public/generator/assets/index-NXxBVrod.css b/main/manager-web/public/generator/assets/index-CrIJdTCK.css similarity index 84% rename from main/manager-web/public/generator/assets/index-NXxBVrod.css rename to main/manager-web/public/generator/assets/index-CrIJdTCK.css index c14eba63..2674bc17 100644 --- a/main/manager-web/public/generator/assets/index-NXxBVrod.css +++ b/main/manager-web/public/generator/assets/index-CrIJdTCK.css @@ -1 +1 @@ -*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.-right-1{right:-.25rem}.-top-1{top:-.25rem}.bottom-4{bottom:1rem}.right-0{right:0}.right-4{right:1rem}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-0\.5{height:.125rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-32{height:8rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-full{height:100%}.max-h-32{max-height:8rem}.max-h-64{max-height:16rem}.max-h-\[90vh\]{max-height:90vh}.min-h-96{min-height:24rem}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[300px\]{min-width:300px}.max-w-2xl{max-width:42rem}.max-w-32{max-width:8rem}.max-w-7xl{max-width:80rem}.max-w-full{max-width:100%}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.grow{flex-grow:1}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.resize{resize:both}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-items-center{justify-items:center}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-primary-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-500{--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity, 1))}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-pink-100{--tw-bg-opacity: 1;background-color:rgb(252 231 243 / var(--tw-bg-opacity, 1))}.bg-primary-50{--tw-bg-opacity: 1;background-color:rgb(240 249 255 / var(--tw-bg-opacity, 1))}.bg-primary-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-sky-100{--tw-bg-opacity: 1;background-color:rgb(224 242 254 / var(--tw-bg-opacity, 1))}.bg-stone-100{--tw-bg-opacity: 1;background-color:rgb(245 245 244 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-opacity-10{--tw-bg-opacity: .1}.bg-opacity-50{--tw-bg-opacity: .5}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pr-10{padding-right:2.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-tight{line-height:1.25}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-green-900{--tw-text-opacity: 1;color:rgb(20 83 45 / var(--tw-text-opacity, 1))}.text-indigo-500{--tw-text-opacity: 1;color:rgb(99 102 241 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-pink-500{--tw-text-opacity: 1;color:rgb(236 72 153 / var(--tw-text-opacity, 1))}.text-primary-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-primary-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.opacity-0{opacity:0}.opacity-25{opacity:.25}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline{outline-style:solid}.grayscale{--tw-grayscale: grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.step-indicator{display:flex;height:2rem;width:2rem;align-items:center;justify-content:center;border-radius:9999px;font-size:.875rem;line-height:1.25rem;font-weight:500}.step-indicator.active{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.step-indicator.completed{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.step-indicator.inactive{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.tab-button{border-top-left-radius:.5rem;border-top-right-radius:.5rem;border-bottom-width:2px;padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s}.tab-button.active{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.tab-button.inactive{border-color:transparent;--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.tab-button.inactive:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:top-\[2px\]:after{content:var(--tw-content);top:2px}.after\:h-5:after{content:var(--tw-content);height:1.25rem}.after\:w-5:after{content:var(--tw-content);width:1.25rem}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:border:after{content:var(--tw-content);border-width:1px}.after\:border-gray-300:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.after\:bg-white:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.after\:content-\[\'\'\]:after{--tw-content: "";content:var(--tw-content)}.hover\:border-gray-300:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.hover\:border-gray-400:hover{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.hover\:bg-blue-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-600:hover{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.hover\:bg-green-600:hover{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.hover\:bg-pink-200:hover{--tw-bg-opacity: 1;background-color:rgb(251 207 232 / var(--tw-bg-opacity, 1))}.hover\:bg-primary-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-sky-200:hover{--tw-bg-opacity: 1;background-color:rgb(186 230 253 / var(--tw-bg-opacity, 1))}.hover\:bg-stone-200:hover{--tw-bg-opacity: 1;background-color:rgb(231 229 228 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-200:hover{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.hover\:text-gray-500:hover{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.hover\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\:text-gray-900:hover{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.hover\:text-primary-500:hover{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-red-800:hover{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.focus\:border-primary-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-primary-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.disabled\:bg-gray-300:disabled{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-primary-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:after\:translate-x-full:after{content:var(--tw-content);--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:checked~.peer-checked\:after\:border-white:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.peer:focus~.peer-focus\:outline-none{outline:2px solid transparent;outline-offset:2px}.peer:focus~.peer-focus\:ring-4{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}@media (min-width: 640px){.sm\:mr-2{margin-right:.5rem}.sm\:inline{display:inline}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:gap-0{gap:0px}.sm\:space-x-8>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(2rem * var(--tw-space-x-reverse));margin-left:calc(2rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width: 768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-80{width:20rem}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:px-8{padding-left:2rem;padding-right:2rem}}.emoji-container[data-v-aa1dde40]{display:flex;align-items:center;justify-content:center}.emoji-image[data-v-aa1dde40]{border-radius:8px;-o-object-fit:contain;object-fit:contain}.emoji-fallback[data-v-aa1dde40]{display:flex;align-items:center;justify-content:center}.text-message[data-v-aa1dde40]{line-height:1;word-wrap:break-word} +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.-right-1{right:-.25rem}.-top-1{top:-.25rem}.bottom-4{bottom:1rem}.right-0{right:0}.right-4{right:1rem}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-0\.5{height:.125rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-32{height:8rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-full{height:100%}.max-h-32{max-height:8rem}.max-h-64{max-height:16rem}.max-h-\[90vh\]{max-height:90vh}.min-h-96{min-height:24rem}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[300px\]{min-width:300px}.max-w-2xl{max-width:42rem}.max-w-32{max-width:8rem}.max-w-7xl{max-width:80rem}.max-w-full{max-width:100%}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.grow{flex-grow:1}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.resize{resize:both}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-items-center{justify-items:center}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-300{--tw-border-opacity: 1;border-color:rgb(134 239 172 / var(--tw-border-opacity, 1))}.border-orange-200{--tw-border-opacity: 1;border-color:rgb(254 215 170 / var(--tw-border-opacity, 1))}.border-primary-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-red-300{--tw-border-opacity: 1;border-color:rgb(252 165 165 / var(--tw-border-opacity, 1))}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-300{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-500{--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity, 1))}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-pink-100{--tw-bg-opacity: 1;background-color:rgb(252 231 243 / var(--tw-bg-opacity, 1))}.bg-primary-50{--tw-bg-opacity: 1;background-color:rgb(240 249 255 / var(--tw-bg-opacity, 1))}.bg-primary-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-sky-100{--tw-bg-opacity: 1;background-color:rgb(224 242 254 / var(--tw-bg-opacity, 1))}.bg-stone-100{--tw-bg-opacity: 1;background-color:rgb(245 245 244 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-opacity-10{--tw-bg-opacity: .1}.bg-opacity-50{--tw-bg-opacity: .5}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pr-10{padding-right:2.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-tight{line-height:1.25}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-green-900{--tw-text-opacity: 1;color:rgb(20 83 45 / var(--tw-text-opacity, 1))}.text-indigo-500{--tw-text-opacity: 1;color:rgb(99 102 241 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-pink-500{--tw-text-opacity: 1;color:rgb(236 72 153 / var(--tw-text-opacity, 1))}.text-primary-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-primary-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.opacity-0{opacity:0}.opacity-25{opacity:.25}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline{outline-style:solid}.grayscale{--tw-grayscale: grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}.step-indicator{display:flex;height:2rem;width:2rem;align-items:center;justify-content:center;border-radius:9999px;font-size:.875rem;line-height:1.25rem;font-weight:500}.step-indicator.active{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.step-indicator.completed{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.step-indicator.inactive{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.tab-button{border-top-left-radius:.5rem;border-top-right-radius:.5rem;border-bottom-width:2px;padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s}.tab-button.active{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.tab-button.inactive{border-color:transparent;--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.tab-button.inactive:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:top-\[2px\]:after{content:var(--tw-content);top:2px}.after\:h-5:after{content:var(--tw-content);height:1.25rem}.after\:w-5:after{content:var(--tw-content);width:1.25rem}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:border:after{content:var(--tw-content);border-width:1px}.after\:border-gray-300:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.after\:bg-white:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.after\:content-\[\'\'\]:after{--tw-content: "";content:var(--tw-content)}.hover\:border-gray-300:hover{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.hover\:border-gray-400:hover{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.hover\:bg-blue-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-600:hover{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.hover\:bg-green-600:hover{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.hover\:bg-pink-200:hover{--tw-bg-opacity: 1;background-color:rgb(251 207 232 / var(--tw-bg-opacity, 1))}.hover\:bg-primary-600:hover{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-sky-200:hover{--tw-bg-opacity: 1;background-color:rgb(186 230 253 / var(--tw-bg-opacity, 1))}.hover\:bg-stone-200:hover{--tw-bg-opacity: 1;background-color:rgb(231 229 228 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-200:hover{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.hover\:text-gray-500:hover{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.hover\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\:text-gray-900:hover{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.hover\:text-primary-500:hover{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-red-800:hover{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.focus\:border-primary-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-primary-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.disabled\:bg-gray-300:disabled{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-primary-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:after\:translate-x-full:after{content:var(--tw-content);--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:checked~.peer-checked\:after\:border-white:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.peer:focus~.peer-focus\:outline-none{outline:2px solid transparent;outline-offset:2px}.peer:focus~.peer-focus\:ring-4{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}@media (min-width: 640px){.sm\:mr-2{margin-right:.5rem}.sm\:inline{display:inline}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:gap-0{gap:0px}.sm\:space-x-8>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(2rem * var(--tw-space-x-reverse));margin-left:calc(2rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width: 768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width: 1024px){.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:w-80{width:20rem}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:px-8{padding-left:2rem;padding-right:2rem}}.emoji-container[data-v-aa1dde40]{display:flex;align-items:center;justify-content:center}.emoji-image[data-v-aa1dde40]{border-radius:8px;-o-object-fit:contain;object-fit:contain}.emoji-fallback[data-v-aa1dde40]{display:flex;align-items:center;justify-content:center}.text-message[data-v-aa1dde40]{line-height:1;word-wrap:break-word} diff --git a/main/manager-web/public/generator/assets/index-FKVSBRAB.js b/main/manager-web/public/generator/assets/index-FKVSBRAB.js deleted file mode 100644 index 3515c400..00000000 --- a/main/manager-web/public/generator/assets/index-FKVSBRAB.js +++ /dev/null @@ -1,81 +0,0 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const o of n)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&i(r)}).observe(document,{childList:!0,subtree:!0});function t(n){const o={};return n.integrity&&(o.integrity=n.integrity),n.referrerPolicy&&(o.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?o.credentials="include":n.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(n){if(n.ep)return;n.ep=!0;const o=t(n);fetch(n.href,o)}})();/** -* @vue/shared v3.5.26 -* (c) 2018-present Yuxi (Evan) You and Vue contributors -* @license MIT -**/function Pr(A){const e=Object.create(null);for(const t of A.split(","))e[t]=1;return t=>t in e}const KA={},hi=[],ot=()=>{},eI=()=>!1,lo=A=>A.charCodeAt(0)===111&&A.charCodeAt(1)===110&&(A.charCodeAt(2)>122||A.charCodeAt(2)<97),Or=A=>A.startsWith("onUpdate:"),ue=Object.assign,Vr=(A,e)=>{const t=A.indexOf(e);t>-1&&A.splice(t,1)},tB=Object.prototype.hasOwnProperty,JA=(A,e)=>tB.call(A,e),yA=Array.isArray,fi=A=>cn(A)==="[object Map]",Bo=A=>cn(A)==="[object Set]",Ng=A=>cn(A)==="[object Date]",SA=A=>typeof A=="function",te=A=>typeof A=="string",It=A=>typeof A=="symbol",PA=A=>A!==null&&typeof A=="object",tI=A=>(PA(A)||SA(A))&&SA(A.then)&&SA(A.catch),iI=Object.prototype.toString,cn=A=>iI.call(A),iB=A=>cn(A).slice(8,-1),nI=A=>cn(A)==="[object Object]",Wr=A=>te(A)&&A!=="NaN"&&A[0]!=="-"&&""+parseInt(A,10)===A,Oi=Pr(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Qo=A=>{const e=Object.create(null);return t=>e[t]||(e[t]=A(t))},nB=/-\w/g,Je=Qo(A=>A.replace(nB,e=>e.slice(1).toUpperCase())),oB=/\B([A-Z])/g,Ii=Qo(A=>A.replace(oB,"-$1").toLowerCase()),co=Qo(A=>A.charAt(0).toUpperCase()+A.slice(1)),xo=Qo(A=>A?`on${co(A)}`:""),Yt=(A,e)=>!Object.is(A,e),Jn=(A,...e)=>{for(let t=0;t{Object.defineProperty(A,e,{configurable:!0,enumerable:!1,writable:i,value:t})},Eo=A=>{const e=parseFloat(A);return isNaN(e)?A:e};let Gg;const uo=()=>Gg||(Gg=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function WA(A){if(yA(A)){const e={};for(let t=0;t{if(t){const i=t.split(gB);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function kA(A){let e="";if(te(A))e=A;else if(yA(A))for(let t=0;tho(t,e))}const gI=A=>!!(A&&A.__v_isRef===!0),v=A=>te(A)?A:A==null?"":yA(A)||PA(A)&&(A.toString===iI||!SA(A.toString))?gI(A)?v(A.value):JSON.stringify(A,sI,2):String(A),sI=(A,e)=>gI(e)?sI(A,e.value):fi(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[i,n],o)=>(t[Jo(i,o)+" =>"]=n,t),{})}:Bo(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>Jo(t))}:It(e)?Jo(e):PA(e)&&!yA(e)&&!nI(e)?String(e):e,Jo=(A,e="")=>{var t;return It(A)?`Symbol(${(t=A.description)!=null?t:e})`:A};/** -* @vue/reactivity v3.5.26 -* (c) 2018-present Yuxi (Evan) You and Vue contributors -* @license MIT -**/let ke;class aI{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=ke,!e&&ke&&(this.index=(ke.scopes||(ke.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e0&&--this._on===0&&(ke=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,i;for(t=0,i=this.effects.length;t0)return;if(Wi){let e=Wi;for(Wi=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let A;for(;Vi;){let e=Vi;for(Vi=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(i){A||(A=i)}e=t}}if(A)throw A}function BI(A){for(let e=A.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function QI(A){let e,t=A.depsTail,i=t;for(;i;){const n=i.prevDep;i.version===-1?(i===t&&(t=n),Zr(i),EB(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=n}A.deps=e,A.depsTail=t}function ar(A){for(let e=A.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(cI(e.dep.computed)||e.dep.version!==e.version))return!0;return!!A._dirty}function cI(A){if(A.flags&4&&!(A.flags&16)||(A.flags&=-17,A.globalVersion===An)||(A.globalVersion=An,!A.isSSR&&A.flags&128&&(!A.deps&&!A._dirty||!ar(A))))return;A.flags|=2;const e=A.dep,t=OA,i=_e;OA=A,_e=!0;try{BI(A);const n=A.fn(A._value);(e.version===0||Yt(n,A._value))&&(A.flags|=128,A._value=n,e.version++)}catch(n){throw e.version++,n}finally{OA=t,_e=i,QI(A),A.flags&=-3}}function Zr(A,e=!1){const{dep:t,prevSub:i,nextSub:n}=A;if(i&&(i.nextSub=n,A.prevSub=void 0),n&&(n.prevSub=i,A.nextSub=void 0),t.subs===A&&(t.subs=i,!i&&t.computed)){t.computed.flags&=-5;for(let o=t.computed.deps;o;o=o.nextDep)Zr(o,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function EB(A){const{prevDep:e,nextDep:t}=A;e&&(e.nextDep=t,A.prevDep=void 0),t&&(t.prevDep=e,A.nextDep=void 0)}let _e=!0;const EI=[];function wt(){EI.push(_e),_e=!1}function Dt(){const A=EI.pop();_e=A===void 0?!0:A}function Lg(A){const{cleanup:e}=A;if(A.cleanup=void 0,e){const t=OA;OA=void 0;try{e()}finally{OA=t}}}let An=0;class uB{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Xr{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!OA||!_e||OA===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==OA)t=this.activeLink=new uB(OA,this),OA.deps?(t.prevDep=OA.depsTail,OA.depsTail.nextDep=t,OA.depsTail=t):OA.deps=OA.depsTail=t,uI(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const i=t.nextDep;i.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=i),t.prevDep=OA.depsTail,t.nextDep=void 0,OA.depsTail.nextDep=t,OA.depsTail=t,OA.deps===t&&(OA.deps=i)}return t}trigger(e){this.version++,An++,this.notify(e)}notify(e){qr();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{jr()}}}function uI(A){if(A.dep.sc++,A.sub.flags&4){const e=A.dep.computed;if(e&&!A.dep.subs){e.flags|=20;for(let i=e.deps;i;i=i.nextDep)uI(i)}const t=A.dep.subs;t!==A&&(A.prevSub=t,t&&(t.nextSub=A)),A.dep.subs=A}}const Ir=new WeakMap,ri=Symbol(""),Cr=Symbol(""),en=Symbol("");function ce(A,e,t){if(_e&&OA){let i=Ir.get(A);i||Ir.set(A,i=new Map);let n=i.get(t);n||(i.set(t,n=new Xr),n.map=i,n.key=t),n.track()}}function ut(A,e,t,i,n,o){const r=Ir.get(A);if(!r){An++;return}const g=s=>{s&&s.trigger()};if(qr(),e==="clear")r.forEach(g);else{const s=yA(A),a=s&&Wr(t);if(s&&t==="length"){const I=Number(i);r.forEach((l,C)=>{(C==="length"||C===en||!It(C)&&C>=I)&&g(l)})}else switch((t!==void 0||r.has(void 0))&&g(r.get(t)),a&&g(r.get(en)),e){case"add":s?a&&g(r.get("length")):(g(r.get(ri)),fi(A)&&g(r.get(Cr)));break;case"delete":s||(g(r.get(ri)),fi(A)&&g(r.get(Cr)));break;case"set":fi(A)&&g(r.get(ri));break}}jr()}function li(A){const e=xA(A);return e===A?e:(ce(e,"iterate",en),xe(A)?e:e.map(Pe))}function fo(A){return ce(A=xA(A),"iterate",en),A}function Ut(A,e){return kt(A)?gi(A)?Di(Pe(e)):Di(e):Pe(e)}const hB={__proto__:null,[Symbol.iterator](){return Ho(this,Symbol.iterator,A=>Ut(this,A))},concat(...A){return li(this).concat(...A.map(e=>yA(e)?li(e):e))},entries(){return Ho(this,"entries",A=>(A[1]=Ut(this,A[1]),A))},every(A,e){return lt(this,"every",A,e,void 0,arguments)},filter(A,e){return lt(this,"filter",A,e,t=>t.map(i=>Ut(this,i)),arguments)},find(A,e){return lt(this,"find",A,e,t=>Ut(this,t),arguments)},findIndex(A,e){return lt(this,"findIndex",A,e,void 0,arguments)},findLast(A,e){return lt(this,"findLast",A,e,t=>Ut(this,t),arguments)},findLastIndex(A,e){return lt(this,"findLastIndex",A,e,void 0,arguments)},forEach(A,e){return lt(this,"forEach",A,e,void 0,arguments)},includes(...A){return Yo(this,"includes",A)},indexOf(...A){return Yo(this,"indexOf",A)},join(A){return li(this).join(A)},lastIndexOf(...A){return Yo(this,"lastIndexOf",A)},map(A,e){return lt(this,"map",A,e,void 0,arguments)},pop(){return xi(this,"pop")},push(...A){return xi(this,"push",A)},reduce(A,...e){return Ug(this,"reduce",A,e)},reduceRight(A,...e){return Ug(this,"reduceRight",A,e)},shift(){return xi(this,"shift")},some(A,e){return lt(this,"some",A,e,void 0,arguments)},splice(...A){return xi(this,"splice",A)},toReversed(){return li(this).toReversed()},toSorted(A){return li(this).toSorted(A)},toSpliced(...A){return li(this).toSpliced(...A)},unshift(...A){return xi(this,"unshift",A)},values(){return Ho(this,"values",A=>Ut(this,A))}};function Ho(A,e,t){const i=fo(A),n=i[e]();return i!==A&&!xe(A)&&(n._next=n.next,n.next=()=>{const o=n._next();return o.done||(o.value=t(o.value)),o}),n}const fB=Array.prototype;function lt(A,e,t,i,n,o){const r=fo(A),g=r!==A&&!xe(A),s=r[e];if(s!==fB[e]){const l=s.apply(A,o);return g?Pe(l):l}let a=t;r!==A&&(g?a=function(l,C){return t.call(this,Ut(A,l),C,A)}:t.length>2&&(a=function(l,C){return t.call(this,l,C,A)}));const I=s.call(r,a,i);return g&&n?n(I):I}function Ug(A,e,t,i){const n=fo(A);let o=t;return n!==A&&(xe(A)?t.length>3&&(o=function(r,g,s){return t.call(this,r,g,s,A)}):o=function(r,g,s){return t.call(this,r,Ut(A,g),s,A)}),n[e](o,...i)}function Yo(A,e,t){const i=xA(A);ce(i,"iterate",en);const n=i[e](...t);return(n===-1||n===!1)&&Ag(t[0])?(t[0]=xA(t[0]),i[e](...t)):n}function xi(A,e,t=[]){wt(),qr();const i=xA(A)[e].apply(A,t);return jr(),Dt(),i}const dB=Pr("__proto__,__v_isRef,__isVue"),hI=new Set(Object.getOwnPropertyNames(Symbol).filter(A=>A!=="arguments"&&A!=="caller").map(A=>Symbol[A]).filter(It));function pB(A){It(A)||(A=String(A));const e=xA(this);return ce(e,"has",A),e.hasOwnProperty(A)}class fI{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){if(t==="__v_skip")return e.__v_skip;const n=this._isReadonly,o=this._isShallow;if(t==="__v_isReactive")return!n;if(t==="__v_isReadonly")return n;if(t==="__v_isShallow")return o;if(t==="__v_raw")return i===(n?o?RB:yI:o?mI:pI).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const r=yA(e);if(!n){let s;if(r&&(s=hB[t]))return s;if(t==="hasOwnProperty")return pB}const g=Reflect.get(e,t,le(e)?e:i);if((It(t)?hI.has(t):dB(t))||(n||ce(e,"get",t),o))return g;if(le(g)){const s=r&&Wr(t)?g:g.value;return n&&PA(s)?Br(s):s}return PA(g)?n?Br(g):po(g):g}}class dI extends fI{constructor(e=!1){super(!1,e)}set(e,t,i,n){let o=e[t];const r=yA(e)&&Wr(t);if(!this._isShallow){const a=kt(o);if(!xe(i)&&!kt(i)&&(o=xA(o),i=xA(i)),!r&&le(o)&&!le(i))return a||(o.value=i),!0}const g=r?Number(t)A,kn=A=>Reflect.getPrototypeOf(A);function kB(A,e,t){return function(...i){const n=this.__v_raw,o=xA(n),r=fi(o),g=A==="entries"||A===Symbol.iterator&&r,s=A==="keys"&&r,a=n[A](...i),I=t?lr:e?Di:Pe;return!e&&ce(o,"iterate",s?Cr:ri),{next(){const{value:l,done:C}=a.next();return C?{value:l,done:C}:{value:g?[I(l[0]),I(l[1])]:I(l),done:C}},[Symbol.iterator](){return this}}}}function vn(A){return function(...e){return A==="delete"?!1:A==="clear"?void 0:this}}function vB(A,e){const t={get(n){const o=this.__v_raw,r=xA(o),g=xA(n);A||(Yt(n,g)&&ce(r,"get",n),ce(r,"get",g));const{has:s}=kn(r),a=e?lr:A?Di:Pe;if(s.call(r,n))return a(o.get(n));if(s.call(r,g))return a(o.get(g));o!==r&&o.get(n)},get size(){const n=this.__v_raw;return!A&&ce(xA(n),"iterate",ri),n.size},has(n){const o=this.__v_raw,r=xA(o),g=xA(n);return A||(Yt(n,g)&&ce(r,"has",n),ce(r,"has",g)),n===g?o.has(n):o.has(n)||o.has(g)},forEach(n,o){const r=this,g=r.__v_raw,s=xA(g),a=e?lr:A?Di:Pe;return!A&&ce(s,"iterate",ri),g.forEach((I,l)=>n.call(o,a(I),a(l),r))}};return ue(t,A?{add:vn("add"),set:vn("set"),delete:vn("delete"),clear:vn("clear")}:{add(n){!e&&!xe(n)&&!kt(n)&&(n=xA(n));const o=xA(this);return kn(o).has.call(o,n)||(o.add(n),ut(o,"add",n,n)),this},set(n,o){!e&&!xe(o)&&!kt(o)&&(o=xA(o));const r=xA(this),{has:g,get:s}=kn(r);let a=g.call(r,n);a||(n=xA(n),a=g.call(r,n));const I=s.call(r,n);return r.set(n,o),a?Yt(o,I)&&ut(r,"set",n,o):ut(r,"add",n,o),this},delete(n){const o=xA(this),{has:r,get:g}=kn(o);let s=r.call(o,n);s||(n=xA(n),s=r.call(o,n)),g&&g.call(o,n);const a=o.delete(n);return s&&ut(o,"delete",n,void 0),a},clear(){const n=xA(this),o=n.size!==0,r=n.clear();return o&&ut(n,"clear",void 0,void 0),r}}),["keys","values","entries",Symbol.iterator].forEach(n=>{t[n]=kB(n,A,e)}),t}function zr(A,e){const t=vB(A,e);return(i,n,o)=>n==="__v_isReactive"?!A:n==="__v_isReadonly"?A:n==="__v_raw"?i:Reflect.get(JA(t,n)&&n in i?t:i,n,o)}const FB={get:zr(!1,!1)},SB={get:zr(!1,!0)},bB={get:zr(!0,!1)};const pI=new WeakMap,mI=new WeakMap,yI=new WeakMap,RB=new WeakMap;function NB(A){switch(A){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function GB(A){return A.__v_skip||!Object.isExtensible(A)?0:NB(iB(A))}function po(A){return kt(A)?A:$r(A,!1,yB,FB,pI)}function wI(A){return $r(A,!1,DB,SB,mI)}function Br(A){return $r(A,!0,wB,bB,yI)}function $r(A,e,t,i,n){if(!PA(A)||A.__v_raw&&!(e&&A.__v_isReactive))return A;const o=GB(A);if(o===0)return A;const r=n.get(A);if(r)return r;const g=new Proxy(A,o===2?i:t);return n.set(A,g),g}function gi(A){return kt(A)?gi(A.__v_raw):!!(A&&A.__v_isReactive)}function kt(A){return!!(A&&A.__v_isReadonly)}function xe(A){return!!(A&&A.__v_isShallow)}function Ag(A){return A?!!A.__v_raw:!1}function xA(A){const e=A&&A.__v_raw;return e?xA(e):A}function Ki(A){return!JA(A,"__v_skip")&&Object.isExtensible(A)&&oI(A,"__v_skip",!0),A}const Pe=A=>PA(A)?po(A):A,Di=A=>PA(A)?Br(A):A;function le(A){return A?A.__v_isRef===!0:!1}function EA(A){return DI(A,!1)}function eg(A){return DI(A,!0)}function DI(A,e){return le(A)?A:new LB(A,e)}class LB{constructor(e,t){this.dep=new Xr,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:xA(e),this._value=t?e:Pe(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,i=this.__v_isShallow||xe(e)||kt(e);e=i?e:xA(e),Yt(e,t)&&(this._rawValue=e,this._value=i?e:Pe(e),this.dep.trigger())}}function QA(A){return le(A)?A.value:A}const UB={get:(A,e,t)=>e==="__v_raw"?A:QA(Reflect.get(A,e,t)),set:(A,e,t,i)=>{const n=A[e];return le(n)&&!le(t)?(n.value=t,!0):Reflect.set(A,e,t,i)}};function kI(A){return gi(A)?A:new Proxy(A,UB)}class MB{constructor(e,t,i){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Xr(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=An-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&OA!==this)return lI(this,!0),!0}get value(){const e=this.dep.track();return cI(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function xB(A,e,t=!1){let i,n;return SA(A)?i=A:(i=A.get,n=A.set),new MB(i,n,t)}const Fn={},qn=new WeakMap;let ei;function JB(A,e=!1,t=ei){if(t){let i=qn.get(t);i||qn.set(t,i=[]),i.push(A)}}function TB(A,e,t=KA){const{immediate:i,deep:n,once:o,scheduler:r,augmentJob:g,call:s}=t,a=d=>n?d:xe(d)||n===!1||n===0?ht(d,1):ht(d);let I,l,C,Q,E=!1,f=!1;if(le(A)?(l=()=>A.value,E=xe(A)):gi(A)?(l=()=>a(A),E=!0):yA(A)?(f=!0,E=A.some(d=>gi(d)||xe(d)),l=()=>A.map(d=>{if(le(d))return d.value;if(gi(d))return a(d);if(SA(d))return s?s(d,2):d()})):SA(A)?e?l=s?()=>s(A,2):A:l=()=>{if(C){wt();try{C()}finally{Dt()}}const d=ei;ei=I;try{return s?s(A,3,[Q]):A(Q)}finally{ei=d}}:l=ot,e&&n){const d=l,w=n===!0?1/0:n;l=()=>ht(d(),w)}const h=cB(),u=()=>{I.stop(),h&&h.active&&Vr(h.effects,I)};if(o&&e){const d=e;e=(...w)=>{d(...w),u()}}let p=f?new Array(A.length).fill(Fn):Fn;const c=d=>{if(!(!(I.flags&1)||!I.dirty&&!d))if(e){const w=I.run();if(n||E||(f?w.some((F,N)=>Yt(F,p[N])):Yt(w,p))){C&&C();const F=ei;ei=I;try{const N=[w,p===Fn?void 0:f&&p[0]===Fn?[]:p,Q];p=w,s?s(e,3,N):e(...N)}finally{ei=F}}}else I.run()};return g&&g(c),I=new II(l),I.scheduler=r?()=>r(c,!1):c,Q=d=>JB(d,!1,I),C=I.onStop=()=>{const d=qn.get(I);if(d){if(s)s(d,4);else for(const w of d)w();qn.delete(I)}},e?i?c(!0):p=I.run():r?r(c.bind(null,!0),!0):I.run(),u.pause=I.pause.bind(I),u.resume=I.resume.bind(I),u.stop=u,u}function ht(A,e=1/0,t){if(e<=0||!PA(A)||A.__v_skip||(t=t||new Map,(t.get(A)||0)>=e))return A;if(t.set(A,e),e--,le(A))ht(A.value,e,t);else if(yA(A))for(let i=0;i{ht(i,e,t)});else if(nI(A)){for(const i in A)ht(A[i],e,t);for(const i of Object.getOwnPropertySymbols(A))Object.prototype.propertyIsEnumerable.call(A,i)&&ht(A[i],e,t)}return A}/** -* @vue/runtime-core v3.5.26 -* (c) 2018-present Yuxi (Evan) You and Vue contributors -* @license MIT -**/function En(A,e,t,i){try{return i?A(...i):A()}catch(n){mo(n,e,t)}}function Ct(A,e,t,i){if(SA(A)){const n=En(A,e,t,i);return n&&tI(n)&&n.catch(o=>{mo(o,e,t)}),n}if(yA(A)){const n=[];for(let o=0;o>>1,n=me[i],o=tn(n);o=tn(t)?me.push(A):me.splice(YB(e),0,A),A.flags|=1,FI()}}function FI(){jn||(jn=vI.then(bI))}function _B(A){yA(A)?di.push(...A):Mt&&A.id===-1?Mt.splice(Qi+1,0,A):A.flags&1||(di.push(A),A.flags|=1),FI()}function Mg(A,e,t=At+1){for(;ttn(t)-tn(i));if(di.length=0,Mt){Mt.push(...e);return}for(Mt=e,Qi=0;QiA.id==null?A.flags&2?-1:1/0:A.id;function bI(A){try{for(At=0;At{i._d&&$n(-1);const o=Zn(e);let r;try{r=A(...n)}finally{Zn(o),i._d&&$n(1)}return r};return i._n=!0,i._c=!0,i._d=!0,i}function XA(A,e){if(be===null)return A;const t=ko(be),i=A.dirs||(A.dirs=[]);for(let n=0;n1)return t&&SA(e)?e.call(i&&i.proxy):e}}const PB=Symbol.for("v-scx"),OB=()=>rt(PB);function ae(A,e,t){return NI(A,e,t)}function NI(A,e,t=KA){const{immediate:i,deep:n,flush:o,once:r}=t,g=ue({},t),s=e&&i||!e&&o!=="post";let a;if(on){if(o==="sync"){const Q=OB();a=Q.__watcherHandles||(Q.__watcherHandles=[])}else if(!s){const Q=()=>{};return Q.stop=ot,Q.resume=ot,Q.pause=ot,Q}}const I=Ee;g.call=(Q,E,f)=>Ct(Q,I,E,f);let l=!1;o==="post"?g.scheduler=Q=>{Se(Q,I&&I.suspense)}:o!=="sync"&&(l=!0,g.scheduler=(Q,E)=>{E?Q():tg(Q)}),g.augmentJob=Q=>{e&&(Q.flags|=4),l&&(Q.flags|=2,I&&(Q.id=I.uid,Q.i=I))};const C=TB(A,e,g);return on&&(a?a.push(C):s&&C()),C}function VB(A,e,t){const i=this.proxy,n=te(A)?A.includes(".")?GI(i,A):()=>i[A]:A.bind(i,i);let o;SA(e)?o=e:(o=e.handler,t=e);const r=dn(this),g=NI(n,o.bind(i),t);return r(),g}function GI(A,e){const t=e.split(".");return()=>{let i=A;for(let n=0;nA.__isTeleport,jB=Symbol("_leaveCb");function ig(A,e){A.shapeFlag&6&&A.component?(A.transition=e,ig(A.component.subTree,e)):A.shapeFlag&128?(A.ssContent.transition=e.clone(A.ssContent),A.ssFallback.transition=e.clone(A.ssFallback)):A.transition=e}function hn(A,e){return SA(A)?ue({name:A.name},e,{setup:A}):A}function LI(A){A.ids=[A.ids[0]+A.ids[2]+++"-",0,0]}const Xn=new WeakMap;function qi(A,e,t,i,n=!1){if(yA(A)){A.forEach((E,f)=>qi(E,e&&(yA(e)?e[f]:e),t,i,n));return}if(ji(i)&&!n){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&qi(A,e,t,i.component.subTree);return}const o=i.shapeFlag&4?ko(i.component):i.el,r=n?null:o,{i:g,r:s}=A,a=e&&e.r,I=g.refs===KA?g.refs={}:g.refs,l=g.setupState,C=xA(l),Q=l===KA?eI:E=>JA(C,E);if(a!=null&&a!==s){if(xg(e),te(a))I[a]=null,Q(a)&&(l[a]=null);else if(le(a)){a.value=null;const E=e;E.k&&(I[E.k]=null)}}if(SA(s))En(s,g,12,[r,I]);else{const E=te(s),f=le(s);if(E||f){const h=()=>{if(A.f){const u=E?Q(s)?l[s]:I[s]:s.value;if(n)yA(u)&&Vr(u,o);else if(yA(u))u.includes(o)||u.push(o);else if(E)I[s]=[o],Q(s)&&(l[s]=I[s]);else{const p=[o];s.value=p,A.k&&(I[A.k]=p)}}else E?(I[s]=r,Q(s)&&(l[s]=r)):f&&(s.value=r,A.k&&(I[A.k]=r))};if(r){const u=()=>{h(),Xn.delete(A)};u.id=-1,Xn.set(A,u),Se(u,t)}else xg(A),h()}}}function xg(A){const e=Xn.get(A);e&&(e.flags|=8,Xn.delete(A))}uo().requestIdleCallback;uo().cancelIdleCallback;const ji=A=>!!A.type.__asyncLoader,UI=A=>A.type.__isKeepAlive;function ZB(A,e){MI(A,"a",e)}function XB(A,e){MI(A,"da",e)}function MI(A,e,t=Ee){const i=A.__wdc||(A.__wdc=()=>{let n=t;for(;n;){if(n.isDeactivated)return;n=n.parent}return A()});if(yo(e,i,t),t){let n=t.parent;for(;n&&n.parent;)UI(n.parent.vnode)&&zB(i,e,t,n),n=n.parent}}function zB(A,e,t,i){const n=yo(e,A,i,!0);Ci(()=>{Vr(i[e],n)},t)}function yo(A,e,t=Ee,i=!1){if(t){const n=t[A]||(t[A]=[]),o=e.__weh||(e.__weh=(...r)=>{wt();const g=dn(t),s=Ct(e,t,A,r);return g(),Dt(),s});return i?n.unshift(o):n.push(o),o}}const vt=A=>(e,t=Ee)=>{(!on||A==="sp")&&yo(A,(...i)=>e(...i),t)},xI=vt("bm"),Ft=vt("m"),$B=vt("bu"),AQ=vt("u"),eQ=vt("bum"),Ci=vt("um"),tQ=vt("sp"),iQ=vt("rtg"),nQ=vt("rtc");function oQ(A,e=Ee){yo("ec",A,e)}const rQ="components",JI=Symbol.for("v-ndc");function TI(A){return te(A)?gQ(rQ,A,!1)||A:A||JI}function gQ(A,e,t=!0,i=!1){const n=be||Ee;if(n){const o=n.type;{const g=OQ(o,!1);if(g&&(g===e||g===Je(e)||g===co(Je(e))))return o}const r=Jg(n[A]||o[A],e)||Jg(n.appContext[A],e);return!r&&i?o:r}}function Jg(A,e){return A&&(A[e]||A[Je(e)]||A[co(Je(e))])}function Ke(A,e,t,i){let n;const o=t,r=yA(A);if(r||te(A)){const g=r&&gi(A);let s=!1,a=!1;g&&(s=!xe(A),a=kt(A),A=fo(A)),n=new Array(A.length);for(let I=0,l=A.length;Ie(g,s,void 0,o));else{const g=Object.keys(A);n=new Array(g.length);for(let s=0,a=g.length;sA?nC(A)?ko(A):Qr(A.parent):null,Zi=ue(Object.create(null),{$:A=>A,$el:A=>A.vnode.el,$data:A=>A.data,$props:A=>A.props,$attrs:A=>A.attrs,$slots:A=>A.slots,$refs:A=>A.refs,$parent:A=>Qr(A.parent),$root:A=>Qr(A.root),$host:A=>A.ce,$emit:A=>A.emit,$options:A=>YI(A),$forceUpdate:A=>A.f||(A.f=()=>{tg(A.update)}),$nextTick:A=>A.n||(A.n=un.bind(A.proxy)),$watch:A=>VB.bind(A)}),_o=(A,e)=>A!==KA&&!A.__isScriptSetup&&JA(A,e),sQ={get({_:A},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:i,data:n,props:o,accessCache:r,type:g,appContext:s}=A;if(e[0]!=="$"){const C=r[e];if(C!==void 0)switch(C){case 1:return i[e];case 2:return n[e];case 4:return t[e];case 3:return o[e]}else{if(_o(i,e))return r[e]=1,i[e];if(n!==KA&&JA(n,e))return r[e]=2,n[e];if(JA(o,e))return r[e]=3,o[e];if(t!==KA&&JA(t,e))return r[e]=4,t[e];cr&&(r[e]=0)}}const a=Zi[e];let I,l;if(a)return e==="$attrs"&&ce(A.attrs,"get",""),a(A);if((I=g.__cssModules)&&(I=I[e]))return I;if(t!==KA&&JA(t,e))return r[e]=4,t[e];if(l=s.config.globalProperties,JA(l,e))return l[e]},set({_:A},e,t){const{data:i,setupState:n,ctx:o}=A;return _o(n,e)?(n[e]=t,!0):i!==KA&&JA(i,e)?(i[e]=t,!0):JA(A.props,e)||e[0]==="$"&&e.slice(1)in A?!1:(o[e]=t,!0)},has({_:{data:A,setupState:e,accessCache:t,ctx:i,appContext:n,props:o,type:r}},g){let s;return!!(t[g]||A!==KA&&g[0]!=="$"&&JA(A,g)||_o(e,g)||JA(o,g)||JA(i,g)||JA(Zi,g)||JA(n.config.globalProperties,g)||(s=r.__cssModules)&&s[g])},defineProperty(A,e,t){return t.get!=null?A._.accessCache[e]=0:JA(t,"value")&&this.set(A,e,t.value,null),Reflect.defineProperty(A,e,t)}};function Tg(A){return yA(A)?A.reduce((e,t)=>(e[t]=null,e),{}):A}let cr=!0;function aQ(A){const e=YI(A),t=A.proxy,i=A.ctx;cr=!1,e.beforeCreate&&Hg(e.beforeCreate,A,"bc");const{data:n,computed:o,methods:r,watch:g,provide:s,inject:a,created:I,beforeMount:l,mounted:C,beforeUpdate:Q,updated:E,activated:f,deactivated:h,beforeDestroy:u,beforeUnmount:p,destroyed:c,unmounted:d,render:w,renderTracked:F,renderTriggered:N,errorCaptured:G,serverPrefetch:P,expose:b,inheritAttrs:R,components:L,directives:cA,filters:dA}=e;if(a&&IQ(a,i,null),r)for(const X in r){const eA=r[X];SA(eA)&&(i[X]=eA.bind(t))}if(n){const X=n.call(t,t);PA(X)&&(A.data=po(X))}if(cr=!0,o)for(const X in o){const eA=o[X],fA=SA(eA)?eA.bind(t,t):SA(eA.get)?eA.get.bind(t,t):ot,DA=!SA(eA)&&SA(eA.set)?eA.set.bind(t):ot,Y=hA({get:fA,set:DA});Object.defineProperty(i,X,{enumerable:!0,configurable:!0,get:()=>Y.value,set:q=>Y.value=q})}if(g)for(const X in g)HI(g[X],i,t,X);if(s){const X=SA(s)?s.call(t):s;Reflect.ownKeys(X).forEach(eA=>{Tn(eA,X[eA])})}I&&Hg(I,A,"c");function iA(X,eA){yA(eA)?eA.forEach(fA=>X(fA.bind(t))):eA&&X(eA.bind(t))}if(iA(xI,l),iA(Ft,C),iA($B,Q),iA(AQ,E),iA(ZB,f),iA(XB,h),iA(oQ,G),iA(nQ,F),iA(iQ,N),iA(eQ,p),iA(Ci,d),iA(tQ,P),yA(b))if(b.length){const X=A.exposed||(A.exposed={});b.forEach(eA=>{Object.defineProperty(X,eA,{get:()=>t[eA],set:fA=>t[eA]=fA,enumerable:!0})})}else A.exposed||(A.exposed={});w&&A.render===ot&&(A.render=w),R!=null&&(A.inheritAttrs=R),L&&(A.components=L),cA&&(A.directives=cA),P&&LI(A)}function IQ(A,e,t=ot){yA(A)&&(A=Er(A));for(const i in A){const n=A[i];let o;PA(n)?"default"in n?o=rt(n.from||i,n.default,!0):o=rt(n.from||i):o=rt(n),le(o)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>o.value,set:r=>o.value=r}):e[i]=o}}function Hg(A,e,t){Ct(yA(A)?A.map(i=>i.bind(e.proxy)):A.bind(e.proxy),e,t)}function HI(A,e,t,i){let n=i.includes(".")?GI(t,i):()=>t[i];if(te(A)){const o=e[A];SA(o)&&ae(n,o)}else if(SA(A))ae(n,A.bind(t));else if(PA(A))if(yA(A))A.forEach(o=>HI(o,e,t,i));else{const o=SA(A.handler)?A.handler.bind(t):e[A.handler];SA(o)&&ae(n,o,A)}}function YI(A){const e=A.type,{mixins:t,extends:i}=e,{mixins:n,optionsCache:o,config:{optionMergeStrategies:r}}=A.appContext,g=o.get(e);let s;return g?s=g:!n.length&&!t&&!i?s=e:(s={},n.length&&n.forEach(a=>zn(s,a,r,!0)),zn(s,e,r)),PA(e)&&o.set(e,s),s}function zn(A,e,t,i=!1){const{mixins:n,extends:o}=e;o&&zn(A,o,t,!0),n&&n.forEach(r=>zn(A,r,t,!0));for(const r in e)if(!(i&&r==="expose")){const g=CQ[r]||t&&t[r];A[r]=g?g(A[r],e[r]):e[r]}return A}const CQ={data:Yg,props:_g,emits:_g,methods:Pi,computed:Pi,beforeCreate:fe,created:fe,beforeMount:fe,mounted:fe,beforeUpdate:fe,updated:fe,beforeDestroy:fe,beforeUnmount:fe,destroyed:fe,unmounted:fe,activated:fe,deactivated:fe,errorCaptured:fe,serverPrefetch:fe,components:Pi,directives:Pi,watch:BQ,provide:Yg,inject:lQ};function Yg(A,e){return e?A?function(){return ue(SA(A)?A.call(this,this):A,SA(e)?e.call(this,this):e)}:e:A}function lQ(A,e){return Pi(Er(A),Er(e))}function Er(A){if(yA(A)){const e={};for(let t=0;te==="modelValue"||e==="model-value"?A.modelModifiers:A[`${e}Modifiers`]||A[`${Je(e)}Modifiers`]||A[`${Ii(e)}Modifiers`];function uQ(A,e,...t){if(A.isUnmounted)return;const i=A.vnode.props||KA;let n=t;const o=e.startsWith("update:"),r=o&&EQ(i,e.slice(7));r&&(r.trim&&(n=t.map(I=>te(I)?I.trim():I)),r.number&&(n=t.map(Eo)));let g,s=i[g=xo(e)]||i[g=xo(Je(e))];!s&&o&&(s=i[g=xo(Ii(e))]),s&&Ct(s,A,6,n);const a=i[g+"Once"];if(a){if(!A.emitted)A.emitted={};else if(A.emitted[g])return;A.emitted[g]=!0,Ct(a,A,6,n)}}const hQ=new WeakMap;function KI(A,e,t=!1){const i=t?hQ:e.emitsCache,n=i.get(A);if(n!==void 0)return n;const o=A.emits;let r={},g=!1;if(!SA(A)){const s=a=>{const I=KI(a,e,!0);I&&(g=!0,ue(r,I))};!t&&e.mixins.length&&e.mixins.forEach(s),A.extends&&s(A.extends),A.mixins&&A.mixins.forEach(s)}return!o&&!g?(PA(A)&&i.set(A,null),null):(yA(o)?o.forEach(s=>r[s]=null):ue(r,o),PA(A)&&i.set(A,r),r)}function wo(A,e){return!A||!lo(e)?!1:(e=e.slice(2).replace(/Once$/,""),JA(A,e[0].toLowerCase()+e.slice(1))||JA(A,Ii(e))||JA(A,e))}function Kg(A){const{type:e,vnode:t,proxy:i,withProxy:n,propsOptions:[o],slots:r,attrs:g,emit:s,render:a,renderCache:I,props:l,data:C,setupState:Q,ctx:E,inheritAttrs:f}=A,h=Zn(A);let u,p;try{if(t.shapeFlag&4){const d=n||i,w=d;u=tt(a.call(w,d,I,l,Q,C,E)),p=g}else{const d=e;u=tt(d.length>1?d(l,{attrs:g,slots:r,emit:s}):d(l,null)),p=e.props?g:fQ(g)}}catch(d){Xi.length=0,mo(d,A,1),u=HA(Kt)}let c=u;if(p&&f!==!1){const d=Object.keys(p),{shapeFlag:w}=c;d.length&&w&7&&(o&&d.some(Or)&&(p=dQ(p,o)),c=ki(c,p,!1,!0))}return t.dirs&&(c=ki(c,null,!1,!0),c.dirs=c.dirs?c.dirs.concat(t.dirs):t.dirs),t.transition&&ig(c,t.transition),u=c,Zn(h),u}const fQ=A=>{let e;for(const t in A)(t==="class"||t==="style"||lo(t))&&((e||(e={}))[t]=A[t]);return e},dQ=(A,e)=>{const t={};for(const i in A)(!Or(i)||!(i.slice(9)in e))&&(t[i]=A[i]);return t};function pQ(A,e,t){const{props:i,children:n,component:o}=A,{props:r,children:g,patchFlag:s}=e,a=o.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&s>=0){if(s&1024)return!0;if(s&16)return i?Pg(i,r,a):!!r;if(s&8){const I=e.dynamicProps;for(let l=0;lObject.create(PI),VI=A=>Object.getPrototypeOf(A)===PI;function yQ(A,e,t,i=!1){const n={},o=OI();A.propsDefaults=Object.create(null),WI(A,e,n,o);for(const r in A.propsOptions[0])r in n||(n[r]=void 0);t?A.props=i?n:wI(n):A.type.props?A.props=n:A.props=o,A.attrs=o}function wQ(A,e,t,i){const{props:n,attrs:o,vnode:{patchFlag:r}}=A,g=xA(n),[s]=A.propsOptions;let a=!1;if((i||r>0)&&!(r&16)){if(r&8){const I=A.vnode.dynamicProps;for(let l=0;l{s=!0;const[C,Q]=qI(l,e,!0);ue(r,C),Q&&g.push(...Q)};!t&&e.mixins.length&&e.mixins.forEach(I),A.extends&&I(A.extends),A.mixins&&A.mixins.forEach(I)}if(!o&&!s)return PA(A)&&i.set(A,hi),hi;if(yA(o))for(let I=0;IA==="_"||A==="_ctx"||A==="$stable",og=A=>yA(A)?A.map(tt):[tt(A)],kQ=(A,e,t)=>{if(e._n)return e;const i=KB((...n)=>og(e(...n)),t);return i._c=!1,i},jI=(A,e,t)=>{const i=A._ctx;for(const n in A){if(ng(n))continue;const o=A[n];if(SA(o))e[n]=kQ(n,o,i);else if(o!=null){const r=og(o);e[n]=()=>r}}},ZI=(A,e)=>{const t=og(e);A.slots.default=()=>t},XI=(A,e,t)=>{for(const i in e)(t||!ng(i))&&(A[i]=e[i])},vQ=(A,e,t)=>{const i=A.slots=OI();if(A.vnode.shapeFlag&32){const n=e._;n?(XI(i,e,t),t&&oI(i,"_",n,!0)):jI(e,i)}else e&&ZI(A,e)},FQ=(A,e,t)=>{const{vnode:i,slots:n}=A;let o=!0,r=KA;if(i.shapeFlag&32){const g=e._;g?t&&g===1?o=!1:XI(n,e,t):(o=!e.$stable,jI(e,n)),r=e}else e&&(ZI(A,e),r={default:1});if(o)for(const g in n)!ng(g)&&r[g]==null&&delete n[g]},Se=GQ;function SQ(A){return bQ(A)}function bQ(A,e){const t=uo();t.__VUE__=!0;const{insert:i,remove:n,patchProp:o,createElement:r,createText:g,createComment:s,setText:a,setElementText:I,parentNode:l,nextSibling:C,setScopeId:Q=ot,insertStaticContent:E}=A,f=(D,S,k,J=null,W=null,V=null,tA=void 0,AA=null,m=!!S.dynamicChildren)=>{if(D===S)return;D&&!Ji(D,S)&&(J=M(D),q(D,W,V,!0),D=null),S.patchFlag===-2&&(m=!1,S.dynamicChildren=null);const{type:y,ref:x,shapeFlag:K}=S;switch(y){case fn:h(D,S,k,J);break;case Kt:u(D,S,k,J);break;case Hn:D==null&&p(S,k,J,tA);break;case jA:L(D,S,k,J,W,V,tA,AA,m);break;default:K&1?w(D,S,k,J,W,V,tA,AA,m):K&6?cA(D,S,k,J,W,V,tA,AA,m):(K&64||K&128)&&y.process(D,S,k,J,W,V,tA,AA,m,IA)}x!=null&&W?qi(x,D&&D.ref,V,S||D,!S):x==null&&D&&D.ref!=null&&qi(D.ref,null,V,D,!0)},h=(D,S,k,J)=>{if(D==null)i(S.el=g(S.children),k,J);else{const W=S.el=D.el;S.children!==D.children&&a(W,S.children)}},u=(D,S,k,J)=>{D==null?i(S.el=s(S.children||""),k,J):S.el=D.el},p=(D,S,k,J)=>{[D.el,D.anchor]=E(D.children,S,k,J,D.el,D.anchor)},c=({el:D,anchor:S},k,J)=>{let W;for(;D&&D!==S;)W=C(D),i(D,k,J),D=W;i(S,k,J)},d=({el:D,anchor:S})=>{let k;for(;D&&D!==S;)k=C(D),n(D),D=k;n(S)},w=(D,S,k,J,W,V,tA,AA,m)=>{if(S.type==="svg"?tA="svg":S.type==="math"&&(tA="mathml"),D==null)F(S,k,J,W,V,tA,AA,m);else{const y=D.el&&D.el._isVueCE?D.el:null;try{y&&y._beginPatch(),P(D,S,W,V,tA,AA,m)}finally{y&&y._endPatch()}}},F=(D,S,k,J,W,V,tA,AA)=>{let m,y;const{props:x,shapeFlag:K,transition:nA,dirs:z}=D;if(m=D.el=r(D.type,V,x&&x.is,x),K&8?I(m,D.children):K&16&&G(D.children,m,null,J,W,Ko(D,V),tA,AA),z&&Zt(D,null,J,"created"),N(m,D,D.scopeId,tA,J),x){for(const O in x)O!=="value"&&!Oi(O)&&o(m,O,null,x[O],V,J);"value"in x&&o(m,"value",null,x.value,V),(y=x.onVnodeBeforeMount)&&ze(y,J,D)}z&&Zt(D,null,J,"beforeMount");const U=RQ(W,nA);U&&nA.beforeEnter(m),i(m,S,k),((y=x&&x.onVnodeMounted)||U||z)&&Se(()=>{y&&ze(y,J,D),U&&nA.enter(m),z&&Zt(D,null,J,"mounted")},W)},N=(D,S,k,J,W)=>{if(k&&Q(D,k),J)for(let V=0;V{for(let y=m;y{const AA=S.el=D.el;let{patchFlag:m,dynamicChildren:y,dirs:x}=S;m|=D.patchFlag&16;const K=D.props||KA,nA=S.props||KA;let z;if(k&&Xt(k,!1),(z=nA.onVnodeBeforeUpdate)&&ze(z,k,S,D),x&&Zt(S,D,k,"beforeUpdate"),k&&Xt(k,!0),(K.innerHTML&&nA.innerHTML==null||K.textContent&&nA.textContent==null)&&I(AA,""),y?b(D.dynamicChildren,y,AA,k,J,Ko(S,W),V):tA||eA(D,S,AA,null,k,J,Ko(S,W),V,!1),m>0){if(m&16)R(AA,K,nA,k,W);else if(m&2&&K.class!==nA.class&&o(AA,"class",null,nA.class,W),m&4&&o(AA,"style",K.style,nA.style,W),m&8){const U=S.dynamicProps;for(let O=0;O{z&&ze(z,k,S,D),x&&Zt(S,D,k,"updated")},J)},b=(D,S,k,J,W,V,tA)=>{for(let AA=0;AA{if(S!==k){if(S!==KA)for(const V in S)!Oi(V)&&!(V in k)&&o(D,V,S[V],null,W,J);for(const V in k){if(Oi(V))continue;const tA=k[V],AA=S[V];tA!==AA&&V!=="value"&&o(D,V,AA,tA,W,J)}"value"in k&&o(D,"value",S.value,k.value,W)}},L=(D,S,k,J,W,V,tA,AA,m)=>{const y=S.el=D?D.el:g(""),x=S.anchor=D?D.anchor:g("");let{patchFlag:K,dynamicChildren:nA,slotScopeIds:z}=S;z&&(AA=AA?AA.concat(z):z),D==null?(i(y,k,J),i(x,k,J),G(S.children||[],k,x,W,V,tA,AA,m)):K>0&&K&64&&nA&&D.dynamicChildren&&D.dynamicChildren.length===nA.length?(b(D.dynamicChildren,nA,k,W,V,tA,AA),(S.key!=null||W&&S===W.subTree)&&zI(D,S,!0)):eA(D,S,k,x,W,V,tA,AA,m)},cA=(D,S,k,J,W,V,tA,AA,m)=>{S.slotScopeIds=AA,D==null?S.shapeFlag&512?W.ctx.activate(S,k,J,tA,m):dA(S,k,J,W,V,tA,m):CA(D,S,m)},dA=(D,S,k,J,W,V,tA)=>{const AA=D.component=HQ(D,J,W);if(UI(D)&&(AA.ctx.renderer=IA),YQ(AA,!1,tA),AA.asyncDep){if(W&&W.registerDep(AA,iA,tA),!D.el){const m=AA.subTree=HA(Kt);u(null,m,S,k),D.placeholder=m.el}}else iA(AA,D,S,k,W,V,tA)},CA=(D,S,k)=>{const J=S.component=D.component;if(pQ(D,S,k))if(J.asyncDep&&!J.asyncResolved){X(J,S,k);return}else J.next=S,J.update();else S.el=D.el,J.vnode=S},iA=(D,S,k,J,W,V,tA)=>{const AA=()=>{if(D.isMounted){let{next:K,bu:nA,u:z,parent:U,vnode:O}=D;{const Ce=$I(D);if(Ce){K&&(K.el=O.el,X(D,K,tA)),Ce.asyncDep.then(()=>{D.isUnmounted||AA()});return}}let uA=K,NA;Xt(D,!1),K?(K.el=O.el,X(D,K,tA)):K=O,nA&&Jn(nA),(NA=K.props&&K.props.onVnodeBeforeUpdate)&&ze(NA,U,K,O),Xt(D,!0);const ZA=Kg(D),he=D.subTree;D.subTree=ZA,f(he,ZA,l(he.el),M(he),D,W,V),K.el=ZA.el,uA===null&&mQ(D,ZA.el),z&&Se(z,W),(NA=K.props&&K.props.onVnodeUpdated)&&Se(()=>ze(NA,U,K,O),W)}else{let K;const{el:nA,props:z}=S,{bm:U,m:O,parent:uA,root:NA,type:ZA}=D,he=ji(S);Xt(D,!1),U&&Jn(U),!he&&(K=z&&z.onVnodeBeforeMount)&&ze(K,uA,S),Xt(D,!0);{NA.ce&&NA.ce._def.shadowRoot!==!1&&NA.ce._injectChildStyle(ZA);const Ce=D.subTree=Kg(D);f(null,Ce,k,J,D,W,V),S.el=Ce.el}if(O&&Se(O,W),!he&&(K=z&&z.onVnodeMounted)){const Ce=S;Se(()=>ze(K,uA,Ce),W)}(S.shapeFlag&256||uA&&ji(uA.vnode)&&uA.vnode.shapeFlag&256)&&D.a&&Se(D.a,W),D.isMounted=!0,S=k=J=null}};D.scope.on();const m=D.effect=new II(AA);D.scope.off();const y=D.update=m.run.bind(m),x=D.job=m.runIfDirty.bind(m);x.i=D,x.id=D.uid,m.scheduler=()=>tg(x),Xt(D,!0),y()},X=(D,S,k)=>{S.component=D;const J=D.vnode.props;D.vnode=S,D.next=null,wQ(D,S.props,J,k),FQ(D,S.children,k),wt(),Mg(D),Dt()},eA=(D,S,k,J,W,V,tA,AA,m=!1)=>{const y=D&&D.children,x=D?D.shapeFlag:0,K=S.children,{patchFlag:nA,shapeFlag:z}=S;if(nA>0){if(nA&128){DA(y,K,k,J,W,V,tA,AA,m);return}else if(nA&256){fA(y,K,k,J,W,V,tA,AA,m);return}}z&8?(x&16&&TA(y,W,V),K!==y&&I(k,K)):x&16?z&16?DA(y,K,k,J,W,V,tA,AA,m):TA(y,W,V,!0):(x&8&&I(k,""),z&16&&G(K,k,J,W,V,tA,AA,m))},fA=(D,S,k,J,W,V,tA,AA,m)=>{D=D||hi,S=S||hi;const y=D.length,x=S.length,K=Math.min(y,x);let nA;for(nA=0;nAx?TA(D,W,V,!0,!1,K):G(S,k,J,W,V,tA,AA,m,K)},DA=(D,S,k,J,W,V,tA,AA,m)=>{let y=0;const x=S.length;let K=D.length-1,nA=x-1;for(;y<=K&&y<=nA;){const z=D[y],U=S[y]=m?xt(S[y]):tt(S[y]);if(Ji(z,U))f(z,U,k,null,W,V,tA,AA,m);else break;y++}for(;y<=K&&y<=nA;){const z=D[K],U=S[nA]=m?xt(S[nA]):tt(S[nA]);if(Ji(z,U))f(z,U,k,null,W,V,tA,AA,m);else break;K--,nA--}if(y>K){if(y<=nA){const z=nA+1,U=znA)for(;y<=K;)q(D[y],W,V,!0),y++;else{const z=y,U=y,O=new Map;for(y=U;y<=nA;y++){const Fe=S[y]=m?xt(S[y]):tt(S[y]);Fe.key!=null&&O.set(Fe.key,y)}let uA,NA=0;const ZA=nA-U+1;let he=!1,Ce=0;const jt=new Array(ZA);for(y=0;y=ZA){q(Fe,W,V,!0);continue}let Xe;if(Fe.key!=null)Xe=O.get(Fe.key);else for(uA=U;uA<=nA;uA++)if(jt[uA-U]===0&&Ji(Fe,S[uA])){Xe=uA;break}Xe===void 0?q(Fe,W,V,!0):(jt[Xe-U]=y+1,Xe>=Ce?Ce=Xe:he=!0,f(Fe,S[Xe],k,null,W,V,tA,AA,m),NA++)}const Mo=he?NQ(jt):hi;for(uA=Mo.length-1,y=ZA-1;y>=0;y--){const Fe=U+y,Xe=S[Fe],bg=S[Fe+1],Rg=Fe+1{const{el:V,type:tA,transition:AA,children:m,shapeFlag:y}=D;if(y&6){Y(D.component.subTree,S,k,J);return}if(y&128){D.suspense.move(S,k,J);return}if(y&64){tA.move(D,S,k,IA);return}if(tA===jA){i(V,S,k);for(let K=0;KAA.enter(V),W);else{const{leave:K,delayLeave:nA,afterLeave:z}=AA,U=()=>{D.ctx.isUnmounted?n(V):i(V,S,k)},O=()=>{V._isLeaving&&V[jB](!0),K(V,()=>{U(),z&&z()})};nA?nA(V,U,O):O()}else i(V,S,k)},q=(D,S,k,J=!1,W=!1)=>{const{type:V,props:tA,ref:AA,children:m,dynamicChildren:y,shapeFlag:x,patchFlag:K,dirs:nA,cacheIndex:z}=D;if(K===-2&&(W=!1),AA!=null&&(wt(),qi(AA,null,k,D,!0),Dt()),z!=null&&(S.renderCache[z]=void 0),x&256){S.ctx.deactivate(D);return}const U=x&1&&nA,O=!ji(D);let uA;if(O&&(uA=tA&&tA.onVnodeBeforeUnmount)&&ze(uA,S,D),x&6)LA(D.component,k,J);else{if(x&128){D.suspense.unmount(k,J);return}U&&Zt(D,null,S,"beforeUnmount"),x&64?D.type.remove(D,S,k,IA,J):y&&!y.hasOnce&&(V!==jA||K>0&&K&64)?TA(y,S,k,!1,!0):(V===jA&&K&384||!W&&x&16)&&TA(m,S,k),J&&gA(D)}(O&&(uA=tA&&tA.onVnodeUnmounted)||U)&&Se(()=>{uA&&ze(uA,S,D),U&&Zt(D,null,S,"unmounted")},k)},gA=D=>{const{type:S,el:k,anchor:J,transition:W}=D;if(S===jA){FA(k,J);return}if(S===Hn){d(D);return}const V=()=>{n(k),W&&!W.persisted&&W.afterLeave&&W.afterLeave()};if(D.shapeFlag&1&&W&&!W.persisted){const{leave:tA,delayLeave:AA}=W,m=()=>tA(k,V);AA?AA(D.el,V,m):m()}else V()},FA=(D,S)=>{let k;for(;D!==S;)k=C(D),n(D),D=k;n(S)},LA=(D,S,k)=>{const{bum:J,scope:W,job:V,subTree:tA,um:AA,m,a:y}=D;Vg(m),Vg(y),J&&Jn(J),W.stop(),V&&(V.flags|=8,q(tA,D,S,k)),AA&&Se(AA,S),Se(()=>{D.isUnmounted=!0},S)},TA=(D,S,k,J=!1,W=!1,V=0)=>{for(let tA=V;tA{if(D.shapeFlag&6)return M(D.component.subTree);if(D.shapeFlag&128)return D.suspense.next();const S=C(D.anchor||D.el),k=S&&S[WB];return k?C(k):S};let Z=!1;const $=(D,S,k)=>{let J;D==null?S._vnode&&(q(S._vnode,null,null,!0),J=S._vnode.component):f(S._vnode||null,D,S,null,null,null,k),S._vnode=D,Z||(Z=!0,Mg(J),SI(),Z=!1)},IA={p:f,um:q,m:Y,r:gA,mt:dA,mc:G,pc:eA,pbc:b,n:M,o:A};return{render:$,hydrate:void 0,createApp:cQ($)}}function Ko({type:A,props:e},t){return t==="svg"&&A==="foreignObject"||t==="mathml"&&A==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function Xt({effect:A,job:e},t){t?(A.flags|=32,e.flags|=4):(A.flags&=-33,e.flags&=-5)}function RQ(A,e){return(!A||A&&!A.pendingBranch)&&e&&!e.persisted}function zI(A,e,t=!1){const i=A.children,n=e.children;if(yA(i)&&yA(n))for(let o=0;o>1,A[t[g]]0&&(e[i]=t[o-1]),t[o]=i)}}for(o=t.length,r=t[o-1];o-- >0;)t[o]=r,r=e[r];return t}function $I(A){const e=A.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:$I(e)}function Vg(A){if(A)for(let e=0;eA.__isSuspense;function GQ(A,e){e&&e.pendingBranch?yA(A)?e.effects.push(...A):e.effects.push(A):_B(A)}const jA=Symbol.for("v-fgt"),fn=Symbol.for("v-txt"),Kt=Symbol.for("v-cmt"),Hn=Symbol.for("v-stc"),Xi=[];let Re=null;function H(A=!1){Xi.push(Re=A?null:[])}function LQ(){Xi.pop(),Re=Xi[Xi.length-1]||null}let nn=1;function $n(A,e=!1){nn+=A,A<0&&Re&&e&&(Re.hasOnce=!0)}function tC(A){return A.dynamicChildren=nn>0?Re||hi:null,LQ(),nn>0&&Re&&Re.push(A),A}function _(A,e,t,i,n,o){return tC(B(A,e,t,i,n,o,!0))}function ye(A,e,t,i,n){return tC(HA(A,e,t,i,n,!0))}function Ao(A){return A?A.__v_isVNode===!0:!1}function Ji(A,e){return A.type===e.type&&A.key===e.key}const iC=({key:A})=>A??null,Yn=({ref:A,ref_key:e,ref_for:t})=>(typeof A=="number"&&(A=""+A),A!=null?te(A)||le(A)||SA(A)?{i:be,r:A,k:e,f:!!t}:A:null);function B(A,e=null,t=null,i=0,n=null,o=A===jA?0:1,r=!1,g=!1){const s={__v_isVNode:!0,__v_skip:!0,type:A,props:e,key:e&&iC(e),ref:e&&Yn(e),scopeId:RI,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:i,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:be};return g?(rg(s,t),o&128&&A.normalize(s)):t&&(s.shapeFlag|=te(t)?8:16),nn>0&&!r&&Re&&(s.patchFlag>0||o&6)&&s.patchFlag!==32&&Re.push(s),s}const HA=UQ;function UQ(A,e=null,t=null,i=0,n=null,o=!1){if((!A||A===JI)&&(A=Kt),Ao(A)){const g=ki(A,e,!0);return t&&rg(g,t),nn>0&&!o&&Re&&(g.shapeFlag&6?Re[Re.indexOf(A)]=g:Re.push(g)),g.patchFlag=-2,g}if(VQ(A)&&(A=A.__vccOpts),e){e=MQ(e);let{class:g,style:s}=e;g&&!te(g)&&(e.class=kA(g)),PA(s)&&(Ag(s)&&!yA(s)&&(s=ue({},s)),e.style=WA(s))}const r=te(A)?1:eC(A)?128:qB(A)?64:PA(A)?4:SA(A)?2:0;return B(A,e,t,i,n,r,o,!0)}function MQ(A){return A?Ag(A)||VI(A)?ue({},A):A:null}function ki(A,e,t=!1,i=!1){const{props:n,ref:o,patchFlag:r,children:g,transition:s}=A,a=e?xQ(n||{},e):n,I={__v_isVNode:!0,__v_skip:!0,type:A.type,props:a,key:a&&iC(a),ref:e&&e.ref?t&&o?yA(o)?o.concat(Yn(e)):[o,Yn(e)]:Yn(e):o,scopeId:A.scopeId,slotScopeIds:A.slotScopeIds,children:g,target:A.target,targetStart:A.targetStart,targetAnchor:A.targetAnchor,staticCount:A.staticCount,shapeFlag:A.shapeFlag,patchFlag:e&&A.type!==jA?r===-1?16:r|16:r,dynamicProps:A.dynamicProps,dynamicChildren:A.dynamicChildren,appContext:A.appContext,dirs:A.dirs,transition:s,component:A.component,suspense:A.suspense,ssContent:A.ssContent&&ki(A.ssContent),ssFallback:A.ssFallback&&ki(A.ssFallback),placeholder:A.placeholder,el:A.el,anchor:A.anchor,ctx:A.ctx,ce:A.ce};return s&&i&&ig(I,s.clone(I)),I}function gt(A=" ",e=0){return HA(fn,null,A,e)}function Do(A,e){const t=HA(Hn,null,A);return t.staticCount=e,t}function sA(A="",e=!1){return e?(H(),ye(Kt,null,A)):HA(Kt,null,A)}function tt(A){return A==null||typeof A=="boolean"?HA(Kt):yA(A)?HA(jA,null,A.slice()):Ao(A)?xt(A):HA(fn,null,String(A))}function xt(A){return A.el===null&&A.patchFlag!==-1||A.memo?A:ki(A)}function rg(A,e){let t=0;const{shapeFlag:i}=A;if(e==null)e=null;else if(yA(e))t=16;else if(typeof e=="object")if(i&65){const n=e.default;n&&(n._c&&(n._d=!1),rg(A,n()),n._c&&(n._d=!0));return}else{t=32;const n=e._;!n&&!VI(e)?e._ctx=be:n===3&&be&&(be.slots._===1?e._=1:(e._=2,A.patchFlag|=1024))}else SA(e)?(e={default:e,_ctx:be},t=32):(e=String(e),i&64?(t=16,e=[gt(e)]):t=8);A.children=e,A.shapeFlag|=t}function xQ(...A){const e={};for(let t=0;tEe||be;let eo,hr;{const A=uo(),e=(t,i)=>{let n;return(n=A[t])||(n=A[t]=[]),n.push(i),o=>{n.length>1?n.forEach(r=>r(o)):n[0](o)}};eo=e("__VUE_INSTANCE_SETTERS__",t=>Ee=t),hr=e("__VUE_SSR_SETTERS__",t=>on=t)}const dn=A=>{const e=Ee;return eo(A),A.scope.on(),()=>{A.scope.off(),eo(e)}},Wg=()=>{Ee&&Ee.scope.off(),eo(null)};function nC(A){return A.vnode.shapeFlag&4}let on=!1;function YQ(A,e=!1,t=!1){e&&hr(e);const{props:i,children:n}=A.vnode,o=nC(A);yQ(A,i,o,e),vQ(A,n,t||e);const r=o?_Q(A,e):void 0;return e&&hr(!1),r}function _Q(A,e){const t=A.type;A.accessCache=Object.create(null),A.proxy=new Proxy(A.ctx,sQ);const{setup:i}=t;if(i){wt();const n=A.setupContext=i.length>1?PQ(A):null,o=dn(A),r=En(i,A,0,[A.props,n]),g=tI(r);if(Dt(),o(),(g||A.sp)&&!ji(A)&&LI(A),g){if(r.then(Wg,Wg),e)return r.then(s=>{qg(A,s)}).catch(s=>{mo(s,A,0)});A.asyncDep=r}else qg(A,r)}else oC(A)}function qg(A,e,t){SA(e)?A.type.__ssrInlineRender?A.ssrRender=e:A.render=e:PA(e)&&(A.setupState=kI(e)),oC(A)}function oC(A,e,t){const i=A.type;A.render||(A.render=i.render||ot);{const n=dn(A);wt();try{aQ(A)}finally{Dt(),n()}}}const KQ={get(A,e){return ce(A,"get",""),A[e]}};function PQ(A){const e=t=>{A.exposed=t||{}};return{attrs:new Proxy(A.attrs,KQ),slots:A.slots,emit:A.emit,expose:e}}function ko(A){return A.exposed?A.exposeProxy||(A.exposeProxy=new Proxy(kI(Ki(A.exposed)),{get(e,t){if(t in e)return e[t];if(t in Zi)return Zi[t](A)},has(e,t){return t in e||t in Zi}})):A.proxy}function OQ(A,e=!0){return SA(A)?A.displayName||A.name:A.name||e&&A.__name}function VQ(A){return SA(A)&&"__vccOpts"in A}const hA=(A,e)=>xB(A,e,on);function GA(A,e,t){try{$n(-1);const i=arguments.length;return i===2?PA(e)&&!yA(e)?Ao(e)?HA(A,null,[e]):HA(A,e):HA(A,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):i===3&&Ao(t)&&(t=[t]),HA(A,e,t))}finally{$n(1)}}const WQ="3.5.26";/** -* @vue/runtime-dom v3.5.26 -* (c) 2018-present Yuxi (Evan) You and Vue contributors -* @license MIT -**/let fr;const jg=typeof window<"u"&&window.trustedTypes;if(jg)try{fr=jg.createPolicy("vue",{createHTML:A=>A})}catch{}const rC=fr?A=>fr.createHTML(A):A=>A,qQ="http://www.w3.org/2000/svg",jQ="http://www.w3.org/1998/Math/MathML",Et=typeof document<"u"?document:null,Zg=Et&&Et.createElement("template"),ZQ={insert:(A,e,t)=>{e.insertBefore(A,t||null)},remove:A=>{const e=A.parentNode;e&&e.removeChild(A)},createElement:(A,e,t,i)=>{const n=e==="svg"?Et.createElementNS(qQ,A):e==="mathml"?Et.createElementNS(jQ,A):t?Et.createElement(A,{is:t}):Et.createElement(A);return A==="select"&&i&&i.multiple!=null&&n.setAttribute("multiple",i.multiple),n},createText:A=>Et.createTextNode(A),createComment:A=>Et.createComment(A),setText:(A,e)=>{A.nodeValue=e},setElementText:(A,e)=>{A.textContent=e},parentNode:A=>A.parentNode,nextSibling:A=>A.nextSibling,querySelector:A=>Et.querySelector(A),setScopeId(A,e){A.setAttribute(e,"")},insertStaticContent(A,e,t,i,n,o){const r=t?t.previousSibling:e.lastChild;if(n&&(n===o||n.nextSibling))for(;e.insertBefore(n.cloneNode(!0),t),!(n===o||!(n=n.nextSibling)););else{Zg.innerHTML=rC(i==="svg"?`${A}`:i==="mathml"?`${A}`:A);const g=Zg.content;if(i==="svg"||i==="mathml"){const s=g.firstChild;for(;s.firstChild;)g.appendChild(s.firstChild);g.removeChild(s)}e.insertBefore(g,t)}return[r?r.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},XQ=Symbol("_vtc");function zQ(A,e,t){const i=A[XQ];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?A.removeAttribute("class"):t?A.setAttribute("class",e):A.className=e}const Xg=Symbol("_vod"),$Q=Symbol("_vsh"),Ac=Symbol(""),ec=/(?:^|;)\s*display\s*:/;function tc(A,e,t){const i=A.style,n=te(t);let o=!1;if(t&&!n){if(e)if(te(e))for(const r of e.split(";")){const g=r.slice(0,r.indexOf(":")).trim();t[g]==null&&_n(i,g,"")}else for(const r in e)t[r]==null&&_n(i,r,"");for(const r in t)r==="display"&&(o=!0),_n(i,r,t[r])}else if(n){if(e!==t){const r=i[Ac];r&&(t+=";"+r),i.cssText=t,o=ec.test(t)}}else e&&A.removeAttribute("style");Xg in A&&(A[Xg]=o?i.display:"",A[$Q]&&(i.display="none"))}const zg=/\s*!important$/;function _n(A,e,t){if(yA(t))t.forEach(i=>_n(A,e,i));else if(t==null&&(t=""),e.startsWith("--"))A.setProperty(e,t);else{const i=ic(A,e);zg.test(t)?A.setProperty(Ii(i),t.replace(zg,""),"important"):A[i]=t}}const $g=["Webkit","Moz","ms"],Po={};function ic(A,e){const t=Po[e];if(t)return t;let i=Je(e);if(i!=="filter"&&i in A)return Po[e]=i;i=co(i);for(let n=0;n<$g.length;n++){const o=$g[n]+i;if(o in A)return Po[e]=o}return e}const As="http://www.w3.org/1999/xlink";function es(A,e,t,i,n,o=CB(e)){i&&e.startsWith("xlink:")?t==null?A.removeAttributeNS(As,e.slice(6,e.length)):A.setAttributeNS(As,e,t):t==null||o&&!rI(t)?A.removeAttribute(e):A.setAttribute(e,o?"":It(t)?String(t):t)}function ts(A,e,t,i,n){if(e==="innerHTML"||e==="textContent"){t!=null&&(A[e]=e==="innerHTML"?rC(t):t);return}const o=A.tagName;if(e==="value"&&o!=="PROGRESS"&&!o.includes("-")){const g=o==="OPTION"?A.getAttribute("value")||"":A.value,s=t==null?A.type==="checkbox"?"on":"":String(t);(g!==s||!("_value"in A))&&(A.value=s),t==null&&A.removeAttribute(e),A._value=t;return}let r=!1;if(t===""||t==null){const g=typeof A[e];g==="boolean"?t=rI(t):t==null&&g==="string"?(t="",r=!0):g==="number"&&(t=0,r=!0)}try{A[e]=t}catch{}r&&A.removeAttribute(n||e)}function ti(A,e,t,i){A.addEventListener(e,t,i)}function nc(A,e,t,i){A.removeEventListener(e,t,i)}const is=Symbol("_vei");function oc(A,e,t,i,n=null){const o=A[is]||(A[is]={}),r=o[e];if(i&&r)r.value=i;else{const[g,s]=rc(e);if(i){const a=o[e]=ac(i,n);ti(A,g,a,s)}else r&&(nc(A,g,r,s),o[e]=void 0)}}const ns=/(?:Once|Passive|Capture)$/;function rc(A){let e;if(ns.test(A)){e={};let i;for(;i=A.match(ns);)A=A.slice(0,A.length-i[0].length),e[i[0].toLowerCase()]=!0}return[A[2]===":"?A.slice(3):Ii(A.slice(2)),e]}let Oo=0;const gc=Promise.resolve(),sc=()=>Oo||(gc.then(()=>Oo=0),Oo=Date.now());function ac(A,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;Ct(Ic(i,t.value),e,5,[i])};return t.value=A,t.attached=sc(),t}function Ic(A,e){if(yA(e)){const t=A.stopImmediatePropagation;return A.stopImmediatePropagation=()=>{t.call(A),A._stopped=!0},e.map(i=>n=>!n._stopped&&i&&i(n))}else return e}const os=A=>A.charCodeAt(0)===111&&A.charCodeAt(1)===110&&A.charCodeAt(2)>96&&A.charCodeAt(2)<123,Cc=(A,e,t,i,n,o)=>{const r=n==="svg";e==="class"?zQ(A,i,r):e==="style"?tc(A,t,i):lo(e)?Or(e)||oc(A,e,t,i,o):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):lc(A,e,i,r))?(ts(A,e,i),!A.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&es(A,e,i,r,o,e!=="value")):A._isVueCE&&(/[A-Z]/.test(e)||!te(i))?ts(A,Je(e),i,o,e):(e==="true-value"?A._trueValue=i:e==="false-value"&&(A._falseValue=i),es(A,e,i,r))};function lc(A,e,t,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in A&&os(e)&&SA(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&A.tagName==="IFRAME"||e==="form"||e==="list"&&A.tagName==="INPUT"||e==="type"&&A.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const n=A.tagName;if(n==="IMG"||n==="VIDEO"||n==="CANVAS"||n==="SOURCE")return!1}return os(e)&&te(t)?!1:e in A}const to=A=>{const e=A.props["onUpdate:modelValue"]||!1;return yA(e)?t=>Jn(e,t):e};function Bc(A){A.target.composing=!0}function rs(A){const e=A.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const mi=Symbol("_assign");function gs(A,e,t){return e&&(A=A.trim()),t&&(A=Eo(A)),A}const ie={created(A,{modifiers:{lazy:e,trim:t,number:i}},n){A[mi]=to(n);const o=i||n.props&&n.props.type==="number";ti(A,e?"change":"input",r=>{r.target.composing||A[mi](gs(A.value,t,o))}),(t||o)&&ti(A,"change",()=>{A.value=gs(A.value,t,o)}),e||(ti(A,"compositionstart",Bc),ti(A,"compositionend",rs),ti(A,"change",rs))},mounted(A,{value:e}){A.value=e??""},beforeUpdate(A,{value:e,oldValue:t,modifiers:{lazy:i,trim:n,number:o}},r){if(A[mi]=to(r),A.composing)return;const g=(o||A.type==="number")&&!/^0\d/.test(A.value)?Eo(A.value):A.value,s=e??"";g!==s&&(document.activeElement===A&&A.type!=="range"&&(i&&e===t||n&&A.value.trim()===s)||(A.value=s))}},dr={deep:!0,created(A,{value:e,modifiers:{number:t}},i){const n=Bo(e);ti(A,"change",()=>{const o=Array.prototype.filter.call(A.options,r=>r.selected).map(r=>t?Eo(io(r)):io(r));A[mi](A.multiple?n?new Set(o):o:o[0]),A._assigning=!0,un(()=>{A._assigning=!1})}),A[mi]=to(i)},mounted(A,{value:e}){ss(A,e)},beforeUpdate(A,e,t){A[mi]=to(t)},updated(A,{value:e}){A._assigning||ss(A,e)}};function ss(A,e){const t=A.multiple,i=yA(e);if(!(t&&!i&&!Bo(e))){for(let n=0,o=A.options.length;nString(a)===String(g)):r.selected=BB(e,g)>-1}else r.selected=e.has(g);else if(ho(io(r),e)){A.selectedIndex!==n&&(A.selectedIndex=n);return}}!t&&A.selectedIndex!==-1&&(A.selectedIndex=-1)}}function io(A){return"_value"in A?A._value:A.value}const Qc=["ctrl","shift","alt","meta"],cc={stop:A=>A.stopPropagation(),prevent:A=>A.preventDefault(),self:A=>A.target!==A.currentTarget,ctrl:A=>!A.ctrlKey,shift:A=>!A.shiftKey,alt:A=>!A.altKey,meta:A=>!A.metaKey,left:A=>"button"in A&&A.button!==0,middle:A=>"button"in A&&A.button!==1,right:A=>"button"in A&&A.button!==2,exact:(A,e)=>Qc.some(t=>A[`${t}Key`]&&!e.includes(t))},dt=(A,e)=>{const t=A._withMods||(A._withMods={}),i=e.join(".");return t[i]||(t[i]=(n,...o)=>{for(let r=0;r{const e=uc().createApp(...A),{mount:t}=e;return e.mount=i=>{const n=dc(i);if(!n)return;const o=e._component;!SA(o)&&!o.render&&!o.template&&(o.template=n.innerHTML),n.nodeType===1&&(n.textContent="");const r=t(n,!1,fc(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),r},e};function fc(A){if(A instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&A instanceof MathMLElement)return"mathml"}function dc(A){return te(A)?document.querySelector(A):A}/*! - * shared v9.14.5 - * (c) 2025 kazuya kawaguchi - * Released under the MIT License. - */function pc(A,e){typeof console<"u"&&(console.warn("[intlify] "+A),e&&console.warn(e.stack))}const no=typeof window<"u",Vt=(A,e=!1)=>e?Symbol.for(A):Symbol(A),mc=(A,e,t)=>yc({l:A,k:e,s:t}),yc=A=>JSON.stringify(A).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),ee=A=>typeof A=="number"&&isFinite(A),wc=A=>sC(A)==="[object Date]",Pt=A=>sC(A)==="[object RegExp]",vo=A=>vA(A)&&Object.keys(A).length===0,Be=Object.assign,Dc=Object.create,YA=(A=null)=>Dc(A);let Is;const ft=()=>Is||(Is=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:YA());function Cs(A){return A.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/").replace(/=/g,"=")}function ls(A){return A.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function kc(A){return A=A.replace(/(\w+)\s*=\s*"([^"]*)"/g,(i,n,o)=>`${n}="${ls(o)}"`),A=A.replace(/(\w+)\s*=\s*'([^']*)'/g,(i,n,o)=>`${n}='${ls(o)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(A)&&(A=A.replace(/(\s+)(on)(\w+\s*=)/gi,"$1on$3")),[/(\s+(?:href|src|action|formaction)\s*=\s*["']?)\s*javascript:/gi,/(style\s*=\s*["'][^"']*url\s*\(\s*)javascript:/gi].forEach(i=>{A=A.replace(i,"$1javascript:")}),A}const vc=Object.prototype.hasOwnProperty;function He(A,e){return vc.call(A,e)}const qA=Array.isArray,VA=A=>typeof A=="function",rA=A=>typeof A=="string",RA=A=>typeof A=="boolean",UA=A=>A!==null&&typeof A=="object",Fc=A=>UA(A)&&VA(A.then)&&VA(A.catch),gC=Object.prototype.toString,sC=A=>gC.call(A),vA=A=>{if(!UA(A))return!1;const e=Object.getPrototypeOf(A);return e===null||e.constructor===Object},Sc=A=>A==null?"":qA(A)||vA(A)&&A.toString===gC?JSON.stringify(A,null,2):String(A);function bc(A,e=""){return A.reduce((t,i,n)=>n===0?t+i:t+e+i,"")}function Fo(A){let e=A;return()=>++e}const Sn=A=>!UA(A)||qA(A);function Kn(A,e){if(Sn(A)||Sn(e))throw new Error("Invalid value");const t=[{src:A,des:e}];for(;t.length;){const{src:i,des:n}=t.pop();Object.keys(i).forEach(o=>{o!=="__proto__"&&(UA(i[o])&&!UA(n[o])&&(n[o]=Array.isArray(i[o])?[]:YA()),Sn(n[o])||Sn(i[o])?n[o]=i[o]:t.push({src:i[o],des:n[o]}))})}}/*! - * message-compiler v9.14.5 - * (c) 2025 kazuya kawaguchi - * Released under the MIT License. - */function Rc(A,e,t){return{line:A,column:e,offset:t}}function oo(A,e,t){return{start:A,end:e}}const Nc=/\{([0-9a-zA-Z]+)\}/g;function aC(A,...e){return e.length===1&&Gc(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),A.replace(Nc,(t,i)=>e.hasOwnProperty(i)?e[i]:"")}const IC=Object.assign,Bs=A=>typeof A=="string",Gc=A=>A!==null&&typeof A=="object";function CC(A,e=""){return A.reduce((t,i,n)=>n===0?t+i:t+e+i,"")}const gg={USE_MODULO_SYNTAX:1,__EXTEND_POINT__:2},Lc={[gg.USE_MODULO_SYNTAX]:"Use modulo before '{{0}}'."};function Uc(A,e,...t){const i=aC(Lc[A],...t||[]),n={message:String(i),code:A};return e&&(n.location=e),n}const pA={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16,__EXTEND_POINT__:17},Mc={[pA.EXPECTED_TOKEN]:"Expected token: '{0}'",[pA.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[pA.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[pA.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[pA.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[pA.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[pA.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[pA.EMPTY_PLACEHOLDER]:"Empty placeholder",[pA.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[pA.INVALID_LINKED_FORMAT]:"Invalid linked format",[pA.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[pA.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[pA.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[pA.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[pA.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[pA.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function Li(A,e,t={}){const{domain:i,messages:n,args:o}=t,r=aC((n||Mc)[A]||"",...o||[]),g=new SyntaxError(String(r));return g.code=A,e&&(g.location=e),g.domain=i,g}function xc(A){throw A}const Bt=" ",Jc="\r",de=` -`,Tc="\u2028",Hc="\u2029";function Yc(A){const e=A;let t=0,i=1,n=1,o=0;const r=N=>e[N]===Jc&&e[N+1]===de,g=N=>e[N]===de,s=N=>e[N]===Hc,a=N=>e[N]===Tc,I=N=>r(N)||g(N)||s(N)||a(N),l=()=>t,C=()=>i,Q=()=>n,E=()=>o,f=N=>r(N)||s(N)||a(N)?de:e[N],h=()=>f(t),u=()=>f(t+o);function p(){return o=0,I(t)&&(i++,n=0),r(t)&&t++,t++,n++,e[t]}function c(){return r(t+o)&&o++,o++,e[t+o]}function d(){t=0,i=1,n=1,o=0}function w(N=0){o=N}function F(){const N=t+o;for(;N!==t;)p();o=0}return{index:l,line:C,column:Q,peekOffset:E,charAt:f,currentChar:h,currentPeek:u,next:p,peek:c,reset:d,resetPeek:w,skipToPeek:F}}const bt=void 0,_c=".",Qs="'",Kc="tokenizer";function Pc(A,e={}){const t=e.location!==!1,i=Yc(A),n=()=>i.index(),o=()=>Rc(i.line(),i.column(),i.index()),r=o(),g=n(),s={currentType:14,offset:g,startLoc:r,endLoc:r,lastType:14,lastOffset:g,lastStartLoc:r,lastEndLoc:r,braceNest:0,inLinked:!1,text:""},a=()=>s,{onError:I}=e;function l(m,y,x,...K){const nA=a();if(y.column+=x,y.offset+=x,I){const z=t?oo(nA.startLoc,y):null,U=Li(m,z,{domain:Kc,args:K});I(U)}}function C(m,y,x){m.endLoc=o(),m.currentType=y;const K={type:y};return t&&(K.loc=oo(m.startLoc,m.endLoc)),x!=null&&(K.value=x),K}const Q=m=>C(m,14);function E(m,y){return m.currentChar()===y?(m.next(),y):(l(pA.EXPECTED_TOKEN,o(),0,y),"")}function f(m){let y="";for(;m.currentPeek()===Bt||m.currentPeek()===de;)y+=m.currentPeek(),m.peek();return y}function h(m){const y=f(m);return m.skipToPeek(),y}function u(m){if(m===bt)return!1;const y=m.charCodeAt(0);return y>=97&&y<=122||y>=65&&y<=90||y===95}function p(m){if(m===bt)return!1;const y=m.charCodeAt(0);return y>=48&&y<=57}function c(m,y){const{currentType:x}=y;if(x!==2)return!1;f(m);const K=u(m.currentPeek());return m.resetPeek(),K}function d(m,y){const{currentType:x}=y;if(x!==2)return!1;f(m);const K=m.currentPeek()==="-"?m.peek():m.currentPeek(),nA=p(K);return m.resetPeek(),nA}function w(m,y){const{currentType:x}=y;if(x!==2)return!1;f(m);const K=m.currentPeek()===Qs;return m.resetPeek(),K}function F(m,y){const{currentType:x}=y;if(x!==8)return!1;f(m);const K=m.currentPeek()===".";return m.resetPeek(),K}function N(m,y){const{currentType:x}=y;if(x!==9)return!1;f(m);const K=u(m.currentPeek());return m.resetPeek(),K}function G(m,y){const{currentType:x}=y;if(!(x===8||x===12))return!1;f(m);const K=m.currentPeek()===":";return m.resetPeek(),K}function P(m,y){const{currentType:x}=y;if(x!==10)return!1;const K=()=>{const z=m.currentPeek();return z==="{"?u(m.peek()):z==="@"||z==="%"||z==="|"||z===":"||z==="."||z===Bt||!z?!1:z===de?(m.peek(),K()):L(m,!1)},nA=K();return m.resetPeek(),nA}function b(m){f(m);const y=m.currentPeek()==="|";return m.resetPeek(),y}function R(m){const y=f(m),x=m.currentPeek()==="%"&&m.peek()==="{";return m.resetPeek(),{isModulo:x,hasSpace:y.length>0}}function L(m,y=!0){const x=(nA=!1,z="",U=!1)=>{const O=m.currentPeek();return O==="{"?z==="%"?!1:nA:O==="@"||!O?z==="%"?!0:nA:O==="%"?(m.peek(),x(nA,"%",!0)):O==="|"?z==="%"||U?!0:!(z===Bt||z===de):O===Bt?(m.peek(),x(!0,Bt,U)):O===de?(m.peek(),x(!0,de,U)):!0},K=x();return y&&m.resetPeek(),K}function cA(m,y){const x=m.currentChar();return x===bt?bt:y(x)?(m.next(),x):null}function dA(m){const y=m.charCodeAt(0);return y>=97&&y<=122||y>=65&&y<=90||y>=48&&y<=57||y===95||y===36}function CA(m){return cA(m,dA)}function iA(m){const y=m.charCodeAt(0);return y>=97&&y<=122||y>=65&&y<=90||y>=48&&y<=57||y===95||y===36||y===45}function X(m){return cA(m,iA)}function eA(m){const y=m.charCodeAt(0);return y>=48&&y<=57}function fA(m){return cA(m,eA)}function DA(m){const y=m.charCodeAt(0);return y>=48&&y<=57||y>=65&&y<=70||y>=97&&y<=102}function Y(m){return cA(m,DA)}function q(m){let y="",x="";for(;y=fA(m);)x+=y;return x}function gA(m){h(m);const y=m.currentChar();return y!=="%"&&l(pA.EXPECTED_TOKEN,o(),0,y),m.next(),"%"}function FA(m){let y="";for(;;){const x=m.currentChar();if(x==="{"||x==="}"||x==="@"||x==="|"||!x)break;if(x==="%")if(L(m))y+=x,m.next();else break;else if(x===Bt||x===de)if(L(m))y+=x,m.next();else{if(b(m))break;y+=x,m.next()}else y+=x,m.next()}return y}function LA(m){h(m);let y="",x="";for(;y=X(m);)x+=y;return m.currentChar()===bt&&l(pA.UNTERMINATED_CLOSING_BRACE,o(),0),x}function TA(m){h(m);let y="";return m.currentChar()==="-"?(m.next(),y+=`-${q(m)}`):y+=q(m),m.currentChar()===bt&&l(pA.UNTERMINATED_CLOSING_BRACE,o(),0),y}function M(m){return m!==Qs&&m!==de}function Z(m){h(m),E(m,"'");let y="",x="";for(;y=cA(m,M);)y==="\\"?x+=$(m):x+=y;const K=m.currentChar();return K===de||K===bt?(l(pA.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,o(),0),K===de&&(m.next(),E(m,"'")),x):(E(m,"'"),x)}function $(m){const y=m.currentChar();switch(y){case"\\":case"'":return m.next(),`\\${y}`;case"u":return IA(m,y,4);case"U":return IA(m,y,6);default:return l(pA.UNKNOWN_ESCAPE_SEQUENCE,o(),0,y),""}}function IA(m,y,x){E(m,y);let K="";for(let nA=0;nA{const K=m.currentChar();return K==="{"||K==="%"||K==="@"||K==="|"||K==="("||K===")"||!K||K===Bt?x:(x+=K,m.next(),y(x))};return y("")}function J(m){h(m);const y=E(m,"|");return h(m),y}function W(m,y){let x=null;switch(m.currentChar()){case"{":return y.braceNest>=1&&l(pA.NOT_ALLOW_NEST_PLACEHOLDER,o(),0),m.next(),x=C(y,2,"{"),h(m),y.braceNest++,x;case"}":return y.braceNest>0&&y.currentType===2&&l(pA.EMPTY_PLACEHOLDER,o(),0),m.next(),x=C(y,3,"}"),y.braceNest--,y.braceNest>0&&h(m),y.inLinked&&y.braceNest===0&&(y.inLinked=!1),x;case"@":return y.braceNest>0&&l(pA.UNTERMINATED_CLOSING_BRACE,o(),0),x=V(m,y)||Q(y),y.braceNest=0,x;default:{let nA=!0,z=!0,U=!0;if(b(m))return y.braceNest>0&&l(pA.UNTERMINATED_CLOSING_BRACE,o(),0),x=C(y,1,J(m)),y.braceNest=0,y.inLinked=!1,x;if(y.braceNest>0&&(y.currentType===5||y.currentType===6||y.currentType===7))return l(pA.UNTERMINATED_CLOSING_BRACE,o(),0),y.braceNest=0,tA(m,y);if(nA=c(m,y))return x=C(y,5,LA(m)),h(m),x;if(z=d(m,y))return x=C(y,6,TA(m)),h(m),x;if(U=w(m,y))return x=C(y,7,Z(m)),h(m),x;if(!nA&&!z&&!U)return x=C(y,13,D(m)),l(pA.INVALID_TOKEN_IN_PLACEHOLDER,o(),0,x.value),h(m),x;break}}return x}function V(m,y){const{currentType:x}=y;let K=null;const nA=m.currentChar();switch((x===8||x===9||x===12||x===10)&&(nA===de||nA===Bt)&&l(pA.INVALID_LINKED_FORMAT,o(),0),nA){case"@":return m.next(),K=C(y,8,"@"),y.inLinked=!0,K;case".":return h(m),m.next(),C(y,9,".");case":":return h(m),m.next(),C(y,10,":");default:return b(m)?(K=C(y,1,J(m)),y.braceNest=0,y.inLinked=!1,K):F(m,y)||G(m,y)?(h(m),V(m,y)):N(m,y)?(h(m),C(y,12,S(m))):P(m,y)?(h(m),nA==="{"?W(m,y)||K:C(y,11,k(m))):(x===8&&l(pA.INVALID_LINKED_FORMAT,o(),0),y.braceNest=0,y.inLinked=!1,tA(m,y))}}function tA(m,y){let x={type:14};if(y.braceNest>0)return W(m,y)||Q(y);if(y.inLinked)return V(m,y)||Q(y);switch(m.currentChar()){case"{":return W(m,y)||Q(y);case"}":return l(pA.UNBALANCED_CLOSING_BRACE,o(),0),m.next(),C(y,3,"}");case"@":return V(m,y)||Q(y);default:{if(b(m))return x=C(y,1,J(m)),y.braceNest=0,y.inLinked=!1,x;const{isModulo:nA,hasSpace:z}=R(m);if(nA)return z?C(y,0,FA(m)):C(y,4,gA(m));if(L(m))return C(y,0,FA(m));break}}return x}function AA(){const{currentType:m,offset:y,startLoc:x,endLoc:K}=s;return s.lastType=m,s.lastOffset=y,s.lastStartLoc=x,s.lastEndLoc=K,s.offset=n(),s.startLoc=o(),i.currentChar()===bt?C(s,14):tA(i,s)}return{nextToken:AA,currentOffset:n,currentPosition:o,context:a}}const Oc="parser",Vc=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function Wc(A,e,t){switch(A){case"\\\\":return"\\";case"\\'":return"'";default:{const i=parseInt(e||t,16);return i<=55295||i>=57344?String.fromCodePoint(i):"�"}}}function qc(A={}){const e=A.location!==!1,{onError:t,onWarn:i}=A;function n(c,d,w,F,...N){const G=c.currentPosition();if(G.offset+=F,G.column+=F,t){const P=e?oo(w,G):null,b=Li(d,P,{domain:Oc,args:N});t(b)}}function o(c,d,w,F,...N){const G=c.currentPosition();if(G.offset+=F,G.column+=F,i){const P=e?oo(w,G):null;i(Uc(d,P,N))}}function r(c,d,w){const F={type:c};return e&&(F.start=d,F.end=d,F.loc={start:w,end:w}),F}function g(c,d,w,F){e&&(c.end=d,c.loc&&(c.loc.end=w))}function s(c,d){const w=c.context(),F=r(3,w.offset,w.startLoc);return F.value=d,g(F,c.currentOffset(),c.currentPosition()),F}function a(c,d){const w=c.context(),{lastOffset:F,lastStartLoc:N}=w,G=r(5,F,N);return G.index=parseInt(d,10),c.nextToken(),g(G,c.currentOffset(),c.currentPosition()),G}function I(c,d,w){const F=c.context(),{lastOffset:N,lastStartLoc:G}=F,P=r(4,N,G);return P.key=d,w===!0&&(P.modulo=!0),c.nextToken(),g(P,c.currentOffset(),c.currentPosition()),P}function l(c,d){const w=c.context(),{lastOffset:F,lastStartLoc:N}=w,G=r(9,F,N);return G.value=d.replace(Vc,Wc),c.nextToken(),g(G,c.currentOffset(),c.currentPosition()),G}function C(c){const d=c.nextToken(),w=c.context(),{lastOffset:F,lastStartLoc:N}=w,G=r(8,F,N);return d.type!==12?(n(c,pA.UNEXPECTED_EMPTY_LINKED_MODIFIER,w.lastStartLoc,0),G.value="",g(G,F,N),{nextConsumeToken:d,node:G}):(d.value==null&&n(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,Te(d)),G.value=d.value||"",g(G,c.currentOffset(),c.currentPosition()),{node:G})}function Q(c,d){const w=c.context(),F=r(7,w.offset,w.startLoc);return F.value=d,g(F,c.currentOffset(),c.currentPosition()),F}function E(c){const d=c.context(),w=r(6,d.offset,d.startLoc);let F=c.nextToken();if(F.type===9){const N=C(c);w.modifier=N.node,F=N.nextConsumeToken||c.nextToken()}switch(F.type!==10&&n(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(F)),F=c.nextToken(),F.type===2&&(F=c.nextToken()),F.type){case 11:F.value==null&&n(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(F)),w.key=Q(c,F.value||"");break;case 5:F.value==null&&n(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(F)),w.key=I(c,F.value||"");break;case 6:F.value==null&&n(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(F)),w.key=a(c,F.value||"");break;case 7:F.value==null&&n(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(F)),w.key=l(c,F.value||"");break;default:{n(c,pA.UNEXPECTED_EMPTY_LINKED_KEY,d.lastStartLoc,0);const N=c.context(),G=r(7,N.offset,N.startLoc);return G.value="",g(G,N.offset,N.startLoc),w.key=G,g(w,N.offset,N.startLoc),{nextConsumeToken:F,node:w}}}return g(w,c.currentOffset(),c.currentPosition()),{node:w}}function f(c){const d=c.context(),w=d.currentType===1?c.currentOffset():d.offset,F=d.currentType===1?d.endLoc:d.startLoc,N=r(2,w,F);N.items=[];let G=null,P=null;do{const L=G||c.nextToken();switch(G=null,L.type){case 0:L.value==null&&n(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(L)),N.items.push(s(c,L.value||""));break;case 6:L.value==null&&n(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(L)),N.items.push(a(c,L.value||""));break;case 4:P=!0;break;case 5:L.value==null&&n(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(L)),N.items.push(I(c,L.value||"",!!P)),P&&(o(c,gg.USE_MODULO_SYNTAX,d.lastStartLoc,0,Te(L)),P=null);break;case 7:L.value==null&&n(c,pA.UNEXPECTED_LEXICAL_ANALYSIS,d.lastStartLoc,0,Te(L)),N.items.push(l(c,L.value||""));break;case 8:{const cA=E(c);N.items.push(cA.node),G=cA.nextConsumeToken||null;break}}}while(d.currentType!==14&&d.currentType!==1);const b=d.currentType===1?d.lastOffset:c.currentOffset(),R=d.currentType===1?d.lastEndLoc:c.currentPosition();return g(N,b,R),N}function h(c,d,w,F){const N=c.context();let G=F.items.length===0;const P=r(1,d,w);P.cases=[],P.cases.push(F);do{const b=f(c);G||(G=b.items.length===0),P.cases.push(b)}while(N.currentType!==14);return G&&n(c,pA.MUST_HAVE_MESSAGES_IN_PLURAL,w,0),g(P,c.currentOffset(),c.currentPosition()),P}function u(c){const d=c.context(),{offset:w,startLoc:F}=d,N=f(c);return d.currentType===14?N:h(c,w,F,N)}function p(c){const d=Pc(c,IC({},A)),w=d.context(),F=r(0,w.offset,w.startLoc);return e&&F.loc&&(F.loc.source=c),F.body=u(d),A.onCacheKey&&(F.cacheKey=A.onCacheKey(c)),w.currentType!==14&&n(d,pA.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,c[w.offset]||""),g(F,d.currentOffset(),d.currentPosition()),F}return{parse:p}}function Te(A){if(A.type===14)return"EOF";const e=(A.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function jc(A,e={}){const t={ast:A,helpers:new Set};return{context:()=>t,helper:o=>(t.helpers.add(o),o)}}function cs(A,e){for(let t=0;tEs(t)),A}function Es(A){if(A.items.length===1){const e=A.items[0];(e.type===3||e.type===9)&&(A.static=e.value,delete e.value)}else{const e=[];for(let t=0;tr;function s(f,h){r.code+=f}function a(f,h=!0){const u=h?i:"";s(n?u+" ".repeat(f):u)}function I(f=!0){const h=++r.indentLevel;f&&a(h)}function l(f=!0){const h=--r.indentLevel;f&&a(h)}function C(){a(r.indentLevel)}return{context:g,push:s,indent:I,deindent:l,newline:C,helper:f=>`_${f}`,needIndent:()=>r.needIndent}}function eE(A,e){const{helper:t}=A;A.push(`${t("linked")}(`),Fi(A,e.key),e.modifier?(A.push(", "),Fi(A,e.modifier),A.push(", _type")):A.push(", undefined, _type"),A.push(")")}function tE(A,e){const{helper:t,needIndent:i}=A;A.push(`${t("normalize")}([`),A.indent(i());const n=e.items.length;for(let o=0;o1){A.push(`${t("plural")}([`),A.indent(i());const n=e.cases.length;for(let o=0;o{const t=Bs(e.mode)?e.mode:"normal",i=Bs(e.filename)?e.filename:"message.intl";e.sourceMap;const n=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":` -`,o=e.needIndent?e.needIndent:t!=="arrow",r=A.helpers||[],g=AE(A,{filename:i,breakLineCode:n,needIndent:o});g.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),g.indent(o),r.length>0&&(g.push(`const { ${CC(r.map(I=>`${I}: _${I}`),", ")} } = ctx`),g.newline()),g.push("return "),Fi(g,A),g.deindent(o),g.push("}"),delete A.helpers;const{code:s,map:a}=g.context();return{ast:A,code:s,map:a?a.toJSON():void 0}};function rE(A,e={}){const t=IC({},e),i=!!t.jit,n=!!t.minify,o=t.optimize==null?!0:t.optimize,g=qc(t).parse(A);return i?(o&&Xc(g),n&&ci(g),{ast:g,code:""}):(Zc(g,t),oE(g,t))}/*! - * core-base v9.14.5 - * (c) 2025 kazuya kawaguchi - * Released under the MIT License. - */function gE(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(ft().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(ft().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(ft().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function st(A){return UA(A)&&ag(A)===0&&(He(A,"b")||He(A,"body"))}const lC=["b","body"];function sE(A){return Wt(A,lC)}const BC=["c","cases"];function aE(A){return Wt(A,BC,[])}const QC=["s","static"];function IE(A){return Wt(A,QC)}const cC=["i","items"];function CE(A){return Wt(A,cC,[])}const EC=["t","type"];function ag(A){return Wt(A,EC)}const uC=["v","value"];function bn(A,e){const t=Wt(A,uC);if(t!=null)return t;throw rn(e)}const hC=["m","modifier"];function lE(A){return Wt(A,hC)}const fC=["k","key"];function BE(A){const e=Wt(A,fC);if(e)return e;throw rn(6)}function Wt(A,e,t){for(let i=0;i{r===void 0?r=g:r+=g},C[1]=()=>{r!==void 0&&(e.push(r),r=void 0)},C[2]=()=>{C[0](),n++},C[3]=()=>{if(n>0)n--,i=4,C[0]();else{if(n=0,r===void 0||(r=hE(r),r===!1))return!1;C[1]()}};function Q(){const E=A[t+1];if(i===5&&E==="'"||i===6&&E==='"')return t++,g="\\"+E,C[0](),!0}for(;i!==null;)if(t++,o=A[t],!(o==="\\"&&Q())){if(s=uE(o),l=qt[i],a=l[s]||l.l||8,a===8||(i=a[0],a[1]!==void 0&&(I=C[a[1]],I&&(g=o,I()===!1))))return;if(i===7)return e}}const us=new Map;function dE(A,e){return UA(A)?A[e]:null}function pE(A,e){if(!UA(A))return null;let t=us.get(e);if(t||(t=fE(e),t&&us.set(e,t)),!t)return null;const i=t.length;let n=A,o=0;for(;oA,yE=A=>"",wE="text",DE=A=>A.length===0?"":bc(A),kE=Sc;function hs(A,e){return A=Math.abs(A),e===2?A?A>1?1:0:1:A?Math.min(A,2):0}function vE(A){const e=ee(A.pluralIndex)?A.pluralIndex:-1;return A.named&&(ee(A.named.count)||ee(A.named.n))?ee(A.named.count)?A.named.count:ee(A.named.n)?A.named.n:e:e}function FE(A,e){e.count||(e.count=A),e.n||(e.n=A)}function SE(A={}){const e=A.locale,t=vE(A),i=UA(A.pluralRules)&&rA(e)&&VA(A.pluralRules[e])?A.pluralRules[e]:hs,n=UA(A.pluralRules)&&rA(e)&&VA(A.pluralRules[e])?hs:void 0,o=u=>u[i(t,u.length,n)],r=A.list||[],g=u=>r[u],s=A.named||YA();ee(A.pluralIndex)&&FE(t,s);const a=u=>s[u];function I(u){const p=VA(A.messages)?A.messages(u):UA(A.messages)?A.messages[u]:!1;return p||(A.parent?A.parent.message(u):yE)}const l=u=>A.modifiers?A.modifiers[u]:mE,C=vA(A.processor)&&VA(A.processor.normalize)?A.processor.normalize:DE,Q=vA(A.processor)&&VA(A.processor.interpolate)?A.processor.interpolate:kE,E=vA(A.processor)&&rA(A.processor.type)?A.processor.type:wE,h={list:g,named:a,plural:o,linked:(u,...p)=>{const[c,d]=p;let w="text",F="";p.length===1?UA(c)?(F=c.modifier||F,w=c.type||w):rA(c)&&(F=c||F):p.length===2&&(rA(c)&&(F=c||F),rA(d)&&(w=d||w));const N=I(u)(h),G=w==="vnode"&&qA(N)&&F?N[0]:N;return F?l(F)(G,w):G},message:I,type:E,interpolate:Q,normalize:C,values:Be(YA(),r,s)};return h}let gn=null;function bE(A){gn=A}function RE(A,e,t){gn&&gn.emit("i18n:init",{timestamp:Date.now(),i18n:A,version:e,meta:t})}const NE=GE("function:translate");function GE(A){return e=>gn&&gn.emit(A,e)}const LE=gg.__EXTEND_POINT__,zt=Fo(LE),UE={FALLBACK_TO_TRANSLATE:zt(),CANNOT_FORMAT_NUMBER:zt(),FALLBACK_TO_NUMBER_FORMAT:zt(),CANNOT_FORMAT_DATE:zt(),FALLBACK_TO_DATE_FORMAT:zt(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:zt(),__EXTEND_POINT__:zt()},pC=pA.__EXTEND_POINT__,$t=Fo(pC),Ye={INVALID_ARGUMENT:pC,INVALID_DATE_ARGUMENT:$t(),INVALID_ISO_DATE_ARGUMENT:$t(),NOT_SUPPORT_NON_STRING_MESSAGE:$t(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:$t(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:$t(),NOT_SUPPORT_LOCALE_TYPE:$t(),__EXTEND_POINT__:$t()};function it(A){return Li(A,null,void 0)}function Ig(A,e){return e.locale!=null?fs(e.locale):fs(A.locale)}let Vo;function fs(A){if(rA(A))return A;if(VA(A)){if(A.resolvedOnce&&Vo!=null)return Vo;if(A.constructor.name==="Function"){const e=A();if(Fc(e))throw it(Ye.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Vo=e}else throw it(Ye.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw it(Ye.NOT_SUPPORT_LOCALE_TYPE)}function ME(A,e,t){return[...new Set([t,...qA(e)?e:UA(e)?Object.keys(e):rA(e)?[e]:[t]])]}function mC(A,e,t){const i=rA(t)?t:Si,n=A;n.__localeChainCache||(n.__localeChainCache=new Map);let o=n.__localeChainCache.get(i);if(!o){o=[];let r=[t];for(;qA(r);)r=ds(o,r,e);const g=qA(e)||!vA(e)?e:e.default?e.default:null;r=rA(g)?[g]:g,qA(r)&&ds(o,r,!1),n.__localeChainCache.set(i,o)}return o}function ds(A,e,t){let i=!0;for(let n=0;n`${A.charAt(0).toLocaleUpperCase()}${A.substr(1)}`;function HE(){return{upper:(A,e)=>e==="text"&&rA(A)?A.toUpperCase():e==="vnode"&&UA(A)&&"__v_isVNode"in A?A.children.toUpperCase():A,lower:(A,e)=>e==="text"&&rA(A)?A.toLowerCase():e==="vnode"&&UA(A)&&"__v_isVNode"in A?A.children.toLowerCase():A,capitalize:(A,e)=>e==="text"&&rA(A)?ms(A):e==="vnode"&&UA(A)&&"__v_isVNode"in A?ms(A.children):A}}let yC;function ys(A){yC=A}let wC;function YE(A){wC=A}let DC;function _E(A){DC=A}let kC=null;const KE=A=>{kC=A},PE=()=>kC;let vC=null;const ws=A=>{vC=A},OE=()=>vC;let Ds=0;function VE(A={}){const e=VA(A.onWarn)?A.onWarn:pc,t=rA(A.version)?A.version:TE,i=rA(A.locale)||VA(A.locale)?A.locale:Si,n=VA(i)?Si:i,o=qA(A.fallbackLocale)||vA(A.fallbackLocale)||rA(A.fallbackLocale)||A.fallbackLocale===!1?A.fallbackLocale:n,r=vA(A.messages)?A.messages:Wo(n),g=vA(A.datetimeFormats)?A.datetimeFormats:Wo(n),s=vA(A.numberFormats)?A.numberFormats:Wo(n),a=Be(YA(),A.modifiers,HE()),I=A.pluralRules||YA(),l=VA(A.missing)?A.missing:null,C=RA(A.missingWarn)||Pt(A.missingWarn)?A.missingWarn:!0,Q=RA(A.fallbackWarn)||Pt(A.fallbackWarn)?A.fallbackWarn:!0,E=!!A.fallbackFormat,f=!!A.unresolving,h=VA(A.postTranslation)?A.postTranslation:null,u=vA(A.processor)?A.processor:null,p=RA(A.warnHtmlMessage)?A.warnHtmlMessage:!0,c=!!A.escapeParameter,d=VA(A.messageCompiler)?A.messageCompiler:yC,w=VA(A.messageResolver)?A.messageResolver:wC||dE,F=VA(A.localeFallbacker)?A.localeFallbacker:DC||ME,N=UA(A.fallbackContext)?A.fallbackContext:void 0,G=A,P=UA(G.__datetimeFormatters)?G.__datetimeFormatters:new Map,b=UA(G.__numberFormatters)?G.__numberFormatters:new Map,R=UA(G.__meta)?G.__meta:{};Ds++;const L={version:t,cid:Ds,locale:i,fallbackLocale:o,messages:r,modifiers:a,pluralRules:I,missing:l,missingWarn:C,fallbackWarn:Q,fallbackFormat:E,unresolving:f,postTranslation:h,processor:u,warnHtmlMessage:p,escapeParameter:c,messageCompiler:d,messageResolver:w,localeFallbacker:F,fallbackContext:N,onWarn:e,__meta:R};return L.datetimeFormats=g,L.numberFormats=s,L.__datetimeFormatters=P,L.__numberFormatters=b,__INTLIFY_PROD_DEVTOOLS__&&RE(L,t,R),L}const Wo=A=>({[A]:YA()});function Cg(A,e,t,i,n){const{missing:o,onWarn:r}=A;if(o!==null){const g=o(A,t,e,n);return rA(g)?g:e}else return e}function Ti(A,e,t){const i=A;i.__localeChainCache=new Map,A.localeFallbacker(A,t,e)}function WE(A,e){return A===e?!1:A.split("-")[0]===e.split("-")[0]}function qE(A,e){const t=e.indexOf(A);if(t===-1)return!1;for(let i=t+1;ijE(t,A)}function jE(A,e){const t=sE(e);if(t==null)throw rn(0);if(ag(t)===1){const o=aE(t);return A.plural(o.reduce((r,g)=>[...r,ks(A,g)],[]))}else return ks(A,t)}function ks(A,e){const t=IE(e);if(t!=null)return A.type==="text"?t:A.normalize([t]);{const i=CE(e).reduce((n,o)=>[...n,pr(A,o)],[]);return A.normalize(i)}}function pr(A,e){const t=ag(e);switch(t){case 3:return bn(e,t);case 9:return bn(e,t);case 4:{const i=e;if(He(i,"k")&&i.k)return A.interpolate(A.named(i.k));if(He(i,"key")&&i.key)return A.interpolate(A.named(i.key));throw rn(t)}case 5:{const i=e;if(He(i,"i")&&ee(i.i))return A.interpolate(A.list(i.i));if(He(i,"index")&&ee(i.index))return A.interpolate(A.list(i.index));throw rn(t)}case 6:{const i=e,n=lE(i),o=BE(i);return A.linked(pr(A,o),n?pr(A,n):void 0,A.type)}case 7:return bn(e,t);case 8:return bn(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const FC=A=>A;let ui=YA();function SC(A,e={}){let t=!1;const i=e.onError||xc;return e.onError=n=>{t=!0,i(n)},{...rE(A,e),detectError:t}}const ZE=(A,e)=>{if(!rA(A))throw it(Ye.NOT_SUPPORT_NON_STRING_MESSAGE);{RA(e.warnHtmlMessage)&&e.warnHtmlMessage;const i=(e.onCacheKey||FC)(A),n=ui[i];if(n)return n;const{code:o,detectError:r}=SC(A,e),g=new Function(`return ${o}`)();return r?g:ui[i]=g}};function XE(A,e){if(__INTLIFY_JIT_COMPILATION__&&!__INTLIFY_DROP_MESSAGE_COMPILER__&&rA(A)){RA(e.warnHtmlMessage)&&e.warnHtmlMessage;const i=(e.onCacheKey||FC)(A),n=ui[i];if(n)return n;const{ast:o,detectError:r}=SC(A,{...e,location:!1,jit:!0}),g=qo(o);return r?g:ui[i]=g}else{const t=A.cacheKey;if(t){const i=ui[t];return i||(ui[t]=qo(A))}else return qo(A)}}const vs=()=>"",Me=A=>VA(A);function Fs(A,...e){const{fallbackFormat:t,postTranslation:i,unresolving:n,messageCompiler:o,fallbackLocale:r,messages:g}=A,[s,a]=mr(...e),I=RA(a.missingWarn)?a.missingWarn:A.missingWarn,l=RA(a.fallbackWarn)?a.fallbackWarn:A.fallbackWarn,C=RA(a.escapeParameter)?a.escapeParameter:A.escapeParameter,Q=!!a.resolvedMessage,E=rA(a.default)||RA(a.default)?RA(a.default)?o?s:()=>s:a.default:t?o?s:()=>s:"",f=t||E!=="",h=Ig(A,a);C&&zE(a);let[u,p,c]=Q?[s,h,g[h]||YA()]:bC(A,s,h,r,l,I),d=u,w=s;if(!Q&&!(rA(d)||st(d)||Me(d))&&f&&(d=E,w=d),!Q&&(!(rA(d)||st(d)||Me(d))||!rA(p)))return n?So:s;let F=!1;const N=()=>{F=!0},G=Me(d)?d:RC(A,s,p,d,w,N);if(F)return d;const P=eu(A,p,c,a),b=SE(P),R=$E(A,G,b);let L=i?i(R,s):R;if(C&&rA(L)&&(L=kc(L)),__INTLIFY_PROD_DEVTOOLS__){const cA={timestamp:Date.now(),key:rA(s)?s:Me(d)?d.key:"",locale:p||(Me(d)?d.locale:""),format:rA(d)?d:Me(d)?d.source:"",message:L};cA.meta=Be({},A.__meta,PE()||{}),NE(cA)}return L}function zE(A){qA(A.list)?A.list=A.list.map(e=>rA(e)?Cs(e):e):UA(A.named)&&Object.keys(A.named).forEach(e=>{rA(A.named[e])&&(A.named[e]=Cs(A.named[e]))})}function bC(A,e,t,i,n,o){const{messages:r,onWarn:g,messageResolver:s,localeFallbacker:a}=A,I=a(A,i,t);let l=YA(),C,Q=null;const E="translate";for(let f=0;fi;return a.locale=t,a.key=e,a}const s=r(i,Au(A,t,n,i,g,o));return s.locale=t,s.key=e,s.source=i,s}function $E(A,e,t){return e(t)}function mr(...A){const[e,t,i]=A,n=YA();if(!rA(e)&&!ee(e)&&!Me(e)&&!st(e))throw it(Ye.INVALID_ARGUMENT);const o=ee(e)?String(e):(Me(e),e);return ee(t)?n.plural=t:rA(t)?n.default=t:vA(t)&&!vo(t)?n.named=t:qA(t)&&(n.list=t),ee(i)?n.plural=i:rA(i)?n.default=i:vA(i)&&Be(n,i),[o,n]}function Au(A,e,t,i,n,o){return{locale:e,key:t,warnHtmlMessage:n,onError:r=>{throw o&&o(r),r},onCacheKey:r=>mc(e,t,r)}}function eu(A,e,t,i){const{modifiers:n,pluralRules:o,messageResolver:r,fallbackLocale:g,fallbackWarn:s,missingWarn:a,fallbackContext:I}=A,C={locale:e,modifiers:n,pluralRules:o,messages:Q=>{let E=r(t,Q);if(E==null&&I){const[,,f]=bC(I,Q,e,g,s,a);E=r(f,Q)}if(rA(E)||st(E)){let f=!1;const u=RC(A,Q,e,E,Q,()=>{f=!0});return f?vs:u}else return Me(E)?E:vs}};return A.processor&&(C.processor=A.processor),i.list&&(C.list=i.list),i.named&&(C.named=i.named),ee(i.plural)&&(C.pluralIndex=i.plural),C}function Ss(A,...e){const{datetimeFormats:t,unresolving:i,fallbackLocale:n,onWarn:o,localeFallbacker:r}=A,{__datetimeFormatters:g}=A,[s,a,I,l]=yr(...e),C=RA(I.missingWarn)?I.missingWarn:A.missingWarn;RA(I.fallbackWarn)?I.fallbackWarn:A.fallbackWarn;const Q=!!I.part,E=Ig(A,I),f=r(A,n,E);if(!rA(s)||s==="")return new Intl.DateTimeFormat(E,l).format(a);let h={},u,p=null;const c="datetime format";for(let F=0;F{NC.includes(s)?r[s]=t[s]:o[s]=t[s]}),rA(i)?o.locale=i:vA(i)&&(r=i),vA(n)&&(r=n),[o.key||"",g,o,r]}function bs(A,e,t){const i=A;for(const n in t){const o=`${e}__${n}`;i.__datetimeFormatters.has(o)&&i.__datetimeFormatters.delete(o)}}function Rs(A,...e){const{numberFormats:t,unresolving:i,fallbackLocale:n,onWarn:o,localeFallbacker:r}=A,{__numberFormatters:g}=A,[s,a,I,l]=wr(...e),C=RA(I.missingWarn)?I.missingWarn:A.missingWarn;RA(I.fallbackWarn)?I.fallbackWarn:A.fallbackWarn;const Q=!!I.part,E=Ig(A,I),f=r(A,n,E);if(!rA(s)||s==="")return new Intl.NumberFormat(E,l).format(a);let h={},u,p=null;const c="number format";for(let F=0;F{GC.includes(s)?r[s]=t[s]:o[s]=t[s]}),rA(i)?o.locale=i:vA(i)&&(r=i),vA(n)&&(r=n),[o.key||"",g,o,r]}function Ns(A,e,t){const i=A;for(const n in t){const o=`${e}__${n}`;i.__numberFormatters.has(o)&&i.__numberFormatters.delete(o)}}gE();/*! - * vue-i18n v9.14.5 - * (c) 2025 kazuya kawaguchi - * Released under the MIT License. - */const tu="9.14.5";function iu(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(ft().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(ft().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(ft().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(ft().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(ft().__INTLIFY_PROD_DEVTOOLS__=!1)}const nu=UE.__EXTEND_POINT__,Qt=Fo(nu);Qt(),Qt(),Qt(),Qt(),Qt(),Qt(),Qt(),Qt(),Qt();const LC=Ye.__EXTEND_POINT__,we=Fo(LC),re={UNEXPECTED_RETURN_TYPE:LC,INVALID_ARGUMENT:we(),MUST_BE_CALL_SETUP_TOP:we(),NOT_INSTALLED:we(),NOT_AVAILABLE_IN_LEGACY_MODE:we(),REQUIRED_VALUE:we(),INVALID_VALUE:we(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:we(),NOT_INSTALLED_WITH_PROVIDE:we(),UNEXPECTED_ERROR:we(),NOT_COMPATIBLE_LEGACY_VUE_I18N:we(),BRIDGE_SUPPORT_VUE_2_ONLY:we(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:we(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:we(),__EXTEND_POINT__:we()};function Ie(A,...e){return Li(A,null,void 0)}const Dr=Vt("__translateVNode"),kr=Vt("__datetimeParts"),vr=Vt("__numberParts"),UC=Vt("__setPluralRules"),MC=Vt("__injectWithOption"),Fr=Vt("__dispose");function sn(A){if(!UA(A)||st(A))return A;for(const e in A)if(He(A,e))if(!e.includes("."))UA(A[e])&&sn(A[e]);else{const t=e.split("."),i=t.length-1;let n=A,o=!1;for(let r=0;r{if("locale"in g&&"resource"in g){const{locale:s,resource:a}=g;s?(r[s]=r[s]||YA(),Kn(a,r[s])):Kn(a,r)}else rA(g)&&Kn(JSON.parse(g),r)}),n==null&&o)for(const g in r)He(r,g)&&sn(r[g]);return r}function xC(A){return A.type}function JC(A,e,t){let i=UA(e.messages)?e.messages:YA();"__i18nGlobal"in t&&(i=bo(A.locale.value,{messages:i,__i18n:t.__i18nGlobal}));const n=Object.keys(i);n.length&&n.forEach(o=>{A.mergeLocaleMessage(o,i[o])});{if(UA(e.datetimeFormats)){const o=Object.keys(e.datetimeFormats);o.length&&o.forEach(r=>{A.mergeDateTimeFormat(r,e.datetimeFormats[r])})}if(UA(e.numberFormats)){const o=Object.keys(e.numberFormats);o.length&&o.forEach(r=>{A.mergeNumberFormat(r,e.numberFormats[r])})}}}function Gs(A){return HA(fn,null,A,0)}const Ls="__INTLIFY_META__",Us=()=>[],ou=()=>!1;let Ms=0;function xs(A){return(e,t,i,n)=>A(t,i,vi()||void 0,n)}const ru=()=>{const A=vi();let e=null;return A&&(e=xC(A)[Ls])?{[Ls]:e}:null};function lg(A={},e){const{__root:t,__injectWithOption:i}=A,n=t===void 0,o=A.flatJson,r=no?EA:eg,g=!!A.translateExistCompatible;let s=RA(A.inheritLocale)?A.inheritLocale:!0;const a=r(t&&s?t.locale.value:rA(A.locale)?A.locale:Si),I=r(t&&s?t.fallbackLocale.value:rA(A.fallbackLocale)||qA(A.fallbackLocale)||vA(A.fallbackLocale)||A.fallbackLocale===!1?A.fallbackLocale:a.value),l=r(bo(a.value,A)),C=r(vA(A.datetimeFormats)?A.datetimeFormats:{[a.value]:{}}),Q=r(vA(A.numberFormats)?A.numberFormats:{[a.value]:{}});let E=t?t.missingWarn:RA(A.missingWarn)||Pt(A.missingWarn)?A.missingWarn:!0,f=t?t.fallbackWarn:RA(A.fallbackWarn)||Pt(A.fallbackWarn)?A.fallbackWarn:!0,h=t?t.fallbackRoot:RA(A.fallbackRoot)?A.fallbackRoot:!0,u=!!A.fallbackFormat,p=VA(A.missing)?A.missing:null,c=VA(A.missing)?xs(A.missing):null,d=VA(A.postTranslation)?A.postTranslation:null,w=t?t.warnHtmlMessage:RA(A.warnHtmlMessage)?A.warnHtmlMessage:!0,F=!!A.escapeParameter;const N=t?t.modifiers:vA(A.modifiers)?A.modifiers:{};let G=A.pluralRules||t&&t.pluralRules,P;P=(()=>{n&&ws(null);const U={version:tu,locale:a.value,fallbackLocale:I.value,messages:l.value,modifiers:N,pluralRules:G,missing:c===null?void 0:c,missingWarn:E,fallbackWarn:f,fallbackFormat:u,unresolving:!0,postTranslation:d===null?void 0:d,warnHtmlMessage:w,escapeParameter:F,messageResolver:A.messageResolver,messageCompiler:A.messageCompiler,__meta:{framework:"vue"}};U.datetimeFormats=C.value,U.numberFormats=Q.value,U.__datetimeFormatters=vA(P)?P.__datetimeFormatters:void 0,U.__numberFormatters=vA(P)?P.__numberFormatters:void 0;const O=VE(U);return n&&ws(O),O})(),Ti(P,a.value,I.value);function R(){return[a.value,I.value,l.value,C.value,Q.value]}const L=hA({get:()=>a.value,set:U=>{a.value=U,P.locale=a.value}}),cA=hA({get:()=>I.value,set:U=>{I.value=U,P.fallbackLocale=I.value,Ti(P,a.value,U)}}),dA=hA(()=>l.value),CA=hA(()=>C.value),iA=hA(()=>Q.value);function X(){return VA(d)?d:null}function eA(U){d=U,P.postTranslation=U}function fA(){return p}function DA(U){U!==null&&(c=xs(U)),p=U,P.missing=c}const Y=(U,O,uA,NA,ZA,he)=>{R();let Ce;try{__INTLIFY_PROD_DEVTOOLS__,n||(P.fallbackContext=t?OE():void 0),Ce=U(P)}finally{__INTLIFY_PROD_DEVTOOLS__,n||(P.fallbackContext=void 0)}if(uA!=="translate exists"&&ee(Ce)&&Ce===So||uA==="translate exists"&&!Ce){const[jt,Mo]=O();return t&&h?NA(t):ZA(jt)}else{if(he(Ce))return Ce;throw Ie(re.UNEXPECTED_RETURN_TYPE)}};function q(...U){return Y(O=>Reflect.apply(Fs,null,[O,...U]),()=>mr(...U),"translate",O=>Reflect.apply(O.t,O,[...U]),O=>O,O=>rA(O))}function gA(...U){const[O,uA,NA]=U;if(NA&&!UA(NA))throw Ie(re.INVALID_ARGUMENT);return q(O,uA,Be({resolvedMessage:!0},NA||{}))}function FA(...U){return Y(O=>Reflect.apply(Ss,null,[O,...U]),()=>yr(...U),"datetime format",O=>Reflect.apply(O.d,O,[...U]),()=>ps,O=>rA(O))}function LA(...U){return Y(O=>Reflect.apply(Rs,null,[O,...U]),()=>wr(...U),"number format",O=>Reflect.apply(O.n,O,[...U]),()=>ps,O=>rA(O))}function TA(U){return U.map(O=>rA(O)||ee(O)||RA(O)?Gs(String(O)):O)}const Z={normalize:TA,interpolate:U=>U,type:"vnode"};function $(...U){return Y(O=>{let uA;const NA=O;try{NA.processor=Z,uA=Reflect.apply(Fs,null,[NA,...U])}finally{NA.processor=null}return uA},()=>mr(...U),"translate",O=>O[Dr](...U),O=>[Gs(O)],O=>qA(O))}function IA(...U){return Y(O=>Reflect.apply(Rs,null,[O,...U]),()=>wr(...U),"number format",O=>O[vr](...U),Us,O=>rA(O)||qA(O))}function bA(...U){return Y(O=>Reflect.apply(Ss,null,[O,...U]),()=>yr(...U),"datetime format",O=>O[kr](...U),Us,O=>rA(O)||qA(O))}function D(U){G=U,P.pluralRules=G}function S(U,O){return Y(()=>{if(!U)return!1;const uA=rA(O)?O:a.value,NA=W(uA),ZA=P.messageResolver(NA,U);return g?ZA!=null:st(ZA)||Me(ZA)||rA(ZA)},()=>[U],"translate exists",uA=>Reflect.apply(uA.te,uA,[U,O]),ou,uA=>RA(uA))}function k(U){let O=null;const uA=mC(P,I.value,a.value);for(let NA=0;NA{s&&(a.value=U,P.locale=U,Ti(P,a.value,I.value))}),ae(t.fallbackLocale,U=>{s&&(I.value=U,P.fallbackLocale=U,Ti(P,a.value,I.value))}));const z={id:Ms,locale:L,fallbackLocale:cA,get inheritLocale(){return s},set inheritLocale(U){s=U,U&&t&&(a.value=t.locale.value,I.value=t.fallbackLocale.value,Ti(P,a.value,I.value))},get availableLocales(){return Object.keys(l.value).sort()},messages:dA,get modifiers(){return N},get pluralRules(){return G||{}},get isGlobal(){return n},get missingWarn(){return E},set missingWarn(U){E=U,P.missingWarn=E},get fallbackWarn(){return f},set fallbackWarn(U){f=U,P.fallbackWarn=f},get fallbackRoot(){return h},set fallbackRoot(U){h=U},get fallbackFormat(){return u},set fallbackFormat(U){u=U,P.fallbackFormat=u},get warnHtmlMessage(){return w},set warnHtmlMessage(U){w=U,P.warnHtmlMessage=U},get escapeParameter(){return F},set escapeParameter(U){F=U,P.escapeParameter=U},t:q,getLocaleMessage:W,setLocaleMessage:V,mergeLocaleMessage:tA,getPostTranslationHandler:X,setPostTranslationHandler:eA,getMissingHandler:fA,setMissingHandler:DA,[UC]:D};return z.datetimeFormats=CA,z.numberFormats=iA,z.rt=gA,z.te=S,z.tm=J,z.d=FA,z.n=LA,z.getDateTimeFormat=AA,z.setDateTimeFormat=m,z.mergeDateTimeFormat=y,z.getNumberFormat=x,z.setNumberFormat=K,z.mergeNumberFormat=nA,z[MC]=i,z[Dr]=$,z[kr]=bA,z[vr]=IA,z}function gu(A){const e=rA(A.locale)?A.locale:Si,t=rA(A.fallbackLocale)||qA(A.fallbackLocale)||vA(A.fallbackLocale)||A.fallbackLocale===!1?A.fallbackLocale:e,i=VA(A.missing)?A.missing:void 0,n=RA(A.silentTranslationWarn)||Pt(A.silentTranslationWarn)?!A.silentTranslationWarn:!0,o=RA(A.silentFallbackWarn)||Pt(A.silentFallbackWarn)?!A.silentFallbackWarn:!0,r=RA(A.fallbackRoot)?A.fallbackRoot:!0,g=!!A.formatFallbackMessages,s=vA(A.modifiers)?A.modifiers:{},a=A.pluralizationRules,I=VA(A.postTranslation)?A.postTranslation:void 0,l=rA(A.warnHtmlInMessage)?A.warnHtmlInMessage!=="off":!0,C=!!A.escapeParameterHtml,Q=RA(A.sync)?A.sync:!0;let E=A.messages;if(vA(A.sharedMessages)){const F=A.sharedMessages;E=Object.keys(F).reduce((G,P)=>{const b=G[P]||(G[P]={});return Be(b,F[P]),G},E||{})}const{__i18n:f,__root:h,__injectWithOption:u}=A,p=A.datetimeFormats,c=A.numberFormats,d=A.flatJson,w=A.translateExistCompatible;return{locale:e,fallbackLocale:t,messages:E,flatJson:d,datetimeFormats:p,numberFormats:c,missing:i,missingWarn:n,fallbackWarn:o,fallbackRoot:r,fallbackFormat:g,modifiers:s,pluralRules:a,postTranslation:I,warnHtmlMessage:l,escapeParameter:C,messageResolver:A.messageResolver,inheritLocale:Q,translateExistCompatible:w,__i18n:f,__root:h,__injectWithOption:u}}function Sr(A={},e){{const t=lg(gu(A)),{__extender:i}=A,n={id:t.id,get locale(){return t.locale.value},set locale(o){t.locale.value=o},get fallbackLocale(){return t.fallbackLocale.value},set fallbackLocale(o){t.fallbackLocale.value=o},get messages(){return t.messages.value},get datetimeFormats(){return t.datetimeFormats.value},get numberFormats(){return t.numberFormats.value},get availableLocales(){return t.availableLocales},get formatter(){return{interpolate(){return[]}}},set formatter(o){},get missing(){return t.getMissingHandler()},set missing(o){t.setMissingHandler(o)},get silentTranslationWarn(){return RA(t.missingWarn)?!t.missingWarn:t.missingWarn},set silentTranslationWarn(o){t.missingWarn=RA(o)?!o:o},get silentFallbackWarn(){return RA(t.fallbackWarn)?!t.fallbackWarn:t.fallbackWarn},set silentFallbackWarn(o){t.fallbackWarn=RA(o)?!o:o},get modifiers(){return t.modifiers},get formatFallbackMessages(){return t.fallbackFormat},set formatFallbackMessages(o){t.fallbackFormat=o},get postTranslation(){return t.getPostTranslationHandler()},set postTranslation(o){t.setPostTranslationHandler(o)},get sync(){return t.inheritLocale},set sync(o){t.inheritLocale=o},get warnHtmlInMessage(){return t.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(o){t.warnHtmlMessage=o!=="off"},get escapeParameterHtml(){return t.escapeParameter},set escapeParameterHtml(o){t.escapeParameter=o},get preserveDirectiveContent(){return!0},set preserveDirectiveContent(o){},get pluralizationRules(){return t.pluralRules||{}},__composer:t,t(...o){const[r,g,s]=o,a={};let I=null,l=null;if(!rA(r))throw Ie(re.INVALID_ARGUMENT);const C=r;return rA(g)?a.locale=g:qA(g)?I=g:vA(g)&&(l=g),qA(s)?I=s:vA(s)&&(l=s),Reflect.apply(t.t,t,[C,I||l||{},a])},rt(...o){return Reflect.apply(t.rt,t,[...o])},tc(...o){const[r,g,s]=o,a={plural:1};let I=null,l=null;if(!rA(r))throw Ie(re.INVALID_ARGUMENT);const C=r;return rA(g)?a.locale=g:ee(g)?a.plural=g:qA(g)?I=g:vA(g)&&(l=g),rA(s)?a.locale=s:qA(s)?I=s:vA(s)&&(l=s),Reflect.apply(t.t,t,[C,I||l||{},a])},te(o,r){return t.te(o,r)},tm(o){return t.tm(o)},getLocaleMessage(o){return t.getLocaleMessage(o)},setLocaleMessage(o,r){t.setLocaleMessage(o,r)},mergeLocaleMessage(o,r){t.mergeLocaleMessage(o,r)},d(...o){return Reflect.apply(t.d,t,[...o])},getDateTimeFormat(o){return t.getDateTimeFormat(o)},setDateTimeFormat(o,r){t.setDateTimeFormat(o,r)},mergeDateTimeFormat(o,r){t.mergeDateTimeFormat(o,r)},n(...o){return Reflect.apply(t.n,t,[...o])},getNumberFormat(o){return t.getNumberFormat(o)},setNumberFormat(o,r){t.setNumberFormat(o,r)},mergeNumberFormat(o,r){t.mergeNumberFormat(o,r)},getChoiceIndex(o,r){return-1}};return n.__extender=i,n}}const Bg={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:A=>A==="parent"||A==="global",default:"parent"},i18n:{type:Object}};function su({slots:A},e){return e.length===1&&e[0]==="default"?(A.default?A.default():[]).reduce((i,n)=>[...i,...n.type===jA?n.children:[n]],[]):e.reduce((t,i)=>{const n=A[i];return n&&(t[i]=n()),t},YA())}function TC(A){return jA}const au=hn({name:"i18n-t",props:Be({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:A=>ee(A)||!isNaN(A)}},Bg),setup(A,e){const{slots:t,attrs:i}=e,n=A.i18n||ve({useScope:A.scope,__useComponent:!0});return()=>{const o=Object.keys(t).filter(l=>l!=="_"),r=YA();A.locale&&(r.locale=A.locale),A.plural!==void 0&&(r.plural=rA(A.plural)?+A.plural:A.plural);const g=su(e,o),s=n[Dr](A.keypath,g,r),a=Be(YA(),i),I=rA(A.tag)||UA(A.tag)?A.tag:TC();return GA(I,a,s)}}}),Js=au;function Iu(A){return qA(A)&&!rA(A[0])}function HC(A,e,t,i){const{slots:n,attrs:o}=e;return()=>{const r={part:!0};let g=YA();A.locale&&(r.locale=A.locale),rA(A.format)?r.key=A.format:UA(A.format)&&(rA(A.format.key)&&(r.key=A.format.key),g=Object.keys(A.format).reduce((C,Q)=>t.includes(Q)?Be(YA(),C,{[Q]:A.format[Q]}):C,YA()));const s=i(A.value,r,g);let a=[r.key];qA(s)?a=s.map((C,Q)=>{const E=n[C.type],f=E?E({[C.type]:C.value,index:Q,parts:s}):[C.value];return Iu(f)&&(f[0].key=`${C.type}-${Q}`),f}):rA(s)&&(a=[s]);const I=Be(YA(),o),l=rA(A.tag)||UA(A.tag)?A.tag:TC();return GA(l,I,a)}}const Cu=hn({name:"i18n-n",props:Be({value:{type:Number,required:!0},format:{type:[String,Object]}},Bg),setup(A,e){const t=A.i18n||ve({useScope:A.scope,__useComponent:!0});return HC(A,e,GC,(...i)=>t[vr](...i))}}),Ts=Cu,lu=hn({name:"i18n-d",props:Be({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},Bg),setup(A,e){const t=A.i18n||ve({useScope:A.scope,__useComponent:!0});return HC(A,e,NC,(...i)=>t[kr](...i))}}),Hs=lu;function Bu(A,e){const t=A;if(A.mode==="composition")return t.__getInstance(e)||A.global;{const i=t.__getInstance(e);return i!=null?i.__composer:A.global.__composer}}function Qu(A){const e=r=>{const{instance:g,modifiers:s,value:a}=r;if(!g||!g.$)throw Ie(re.UNEXPECTED_ERROR);const I=Bu(A,g.$),l=Ys(a);return[Reflect.apply(I.t,I,[..._s(l)]),I]};return{created:(r,g)=>{const[s,a]=e(g);no&&A.global===a&&(r.__i18nWatcher=ae(a.locale,()=>{g.instance&&g.instance.$forceUpdate()})),r.__composer=a,r.textContent=s},unmounted:r=>{no&&r.__i18nWatcher&&(r.__i18nWatcher(),r.__i18nWatcher=void 0,delete r.__i18nWatcher),r.__composer&&(r.__composer=void 0,delete r.__composer)},beforeUpdate:(r,{value:g})=>{if(r.__composer){const s=r.__composer,a=Ys(g);r.textContent=Reflect.apply(s.t,s,[..._s(a)])}},getSSRProps:r=>{const[g]=e(r);return{textContent:g}}}}function Ys(A){if(rA(A))return{path:A};if(vA(A)){if(!("path"in A))throw Ie(re.REQUIRED_VALUE,"path");return A}else throw Ie(re.INVALID_VALUE)}function _s(A){const{path:e,locale:t,args:i,choice:n,plural:o}=A,r={},g=i||{};return rA(t)&&(r.locale=t),ee(n)&&(r.plural=n),ee(o)&&(r.plural=o),[e,g,r]}function cu(A,e,...t){const i=vA(t[0])?t[0]:{},n=!!i.useI18nComponentName;(RA(i.globalInstall)?i.globalInstall:!0)&&([n?"i18n":Js.name,"I18nT"].forEach(r=>A.component(r,Js)),[Ts.name,"I18nN"].forEach(r=>A.component(r,Ts)),[Hs.name,"I18nD"].forEach(r=>A.component(r,Hs))),A.directive("t",Qu(e))}function Eu(A,e,t){return{beforeCreate(){const i=vi();if(!i)throw Ie(re.UNEXPECTED_ERROR);const n=this.$options;if(n.i18n){const o=n.i18n;if(n.__i18n&&(o.__i18n=n.__i18n),o.__root=e,this===this.$root)this.$i18n=Ks(A,o);else{o.__injectWithOption=!0,o.__extender=t.__vueI18nExtend,this.$i18n=Sr(o);const r=this.$i18n;r.__extender&&(r.__disposer=r.__extender(this.$i18n))}}else if(n.__i18n)if(this===this.$root)this.$i18n=Ks(A,n);else{this.$i18n=Sr({__i18n:n.__i18n,__injectWithOption:!0,__extender:t.__vueI18nExtend,__root:e});const o=this.$i18n;o.__extender&&(o.__disposer=o.__extender(this.$i18n))}else this.$i18n=A;n.__i18nGlobal&&JC(e,n,n),this.$t=(...o)=>this.$i18n.t(...o),this.$rt=(...o)=>this.$i18n.rt(...o),this.$tc=(...o)=>this.$i18n.tc(...o),this.$te=(o,r)=>this.$i18n.te(o,r),this.$d=(...o)=>this.$i18n.d(...o),this.$n=(...o)=>this.$i18n.n(...o),this.$tm=o=>this.$i18n.tm(o),t.__setInstance(i,this.$i18n)},mounted(){},unmounted(){const i=vi();if(!i)throw Ie(re.UNEXPECTED_ERROR);const n=this.$i18n;delete this.$t,delete this.$rt,delete this.$tc,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,n.__disposer&&(n.__disposer(),delete n.__disposer,delete n.__extender),t.__deleteInstance(i),delete this.$i18n}}}function Ks(A,e){A.locale=e.locale||A.locale,A.fallbackLocale=e.fallbackLocale||A.fallbackLocale,A.missing=e.missing||A.missing,A.silentTranslationWarn=e.silentTranslationWarn||A.silentFallbackWarn,A.silentFallbackWarn=e.silentFallbackWarn||A.silentFallbackWarn,A.formatFallbackMessages=e.formatFallbackMessages||A.formatFallbackMessages,A.postTranslation=e.postTranslation||A.postTranslation,A.warnHtmlInMessage=e.warnHtmlInMessage||A.warnHtmlInMessage,A.escapeParameterHtml=e.escapeParameterHtml||A.escapeParameterHtml,A.sync=e.sync||A.sync,A.__composer[UC](e.pluralizationRules||A.pluralizationRules);const t=bo(A.locale,{messages:e.messages,__i18n:e.__i18n});return Object.keys(t).forEach(i=>A.mergeLocaleMessage(i,t[i])),e.datetimeFormats&&Object.keys(e.datetimeFormats).forEach(i=>A.mergeDateTimeFormat(i,e.datetimeFormats[i])),e.numberFormats&&Object.keys(e.numberFormats).forEach(i=>A.mergeNumberFormat(i,e.numberFormats[i])),A}const uu=Vt("global-vue-i18n");function hu(A={},e){const t=__VUE_I18N_LEGACY_API__&&RA(A.legacy)?A.legacy:__VUE_I18N_LEGACY_API__,i=RA(A.globalInjection)?A.globalInjection:!0,n=__VUE_I18N_LEGACY_API__&&t?!!A.allowComposition:!0,o=new Map,[r,g]=fu(A,t),s=Vt("");function a(C){return o.get(C)||null}function I(C,Q){o.set(C,Q)}function l(C){o.delete(C)}{const C={get mode(){return __VUE_I18N_LEGACY_API__&&t?"legacy":"composition"},get allowComposition(){return n},async install(Q,...E){if(Q.__VUE_I18N_SYMBOL__=s,Q.provide(Q.__VUE_I18N_SYMBOL__,C),vA(E[0])){const u=E[0];C.__composerExtend=u.__composerExtend,C.__vueI18nExtend=u.__vueI18nExtend}let f=null;!t&&i&&(f=Fu(Q,C.global)),__VUE_I18N_FULL_INSTALL__&&cu(Q,C,...E),__VUE_I18N_LEGACY_API__&&t&&Q.mixin(Eu(g,g.__composer,C));const h=Q.unmount;Q.unmount=()=>{f&&f(),C.dispose(),h()}},get global(){return g},dispose(){r.stop()},__instances:o,__getInstance:a,__setInstance:I,__deleteInstance:l};return C}}function ve(A={}){const e=vi();if(e==null)throw Ie(re.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Ie(re.NOT_INSTALLED);const t=du(e),i=mu(t),n=xC(e),o=pu(A,n);if(__VUE_I18N_LEGACY_API__&&t.mode==="legacy"&&!A.__useComponent){if(!t.allowComposition)throw Ie(re.NOT_AVAILABLE_IN_LEGACY_MODE);return ku(e,o,i,A)}if(o==="global")return JC(i,A,n),i;if(o==="parent"){let s=yu(t,e,A.__useComponent);return s==null&&(s=i),s}const r=t;let g=r.__getInstance(e);if(g==null){const s=Be({},A);"__i18n"in n&&(s.__i18n=n.__i18n),i&&(s.__root=i),g=lg(s),r.__composerExtend&&(g[Fr]=r.__composerExtend(g)),Du(r,e,g),r.__setInstance(e,g)}return g}function fu(A,e,t){const i=QB();{const n=__VUE_I18N_LEGACY_API__&&e?i.run(()=>Sr(A)):i.run(()=>lg(A));if(n==null)throw Ie(re.UNEXPECTED_ERROR);return[i,n]}}function du(A){{const e=rt(A.isCE?uu:A.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Ie(A.isCE?re.NOT_INSTALLED_WITH_PROVIDE:re.UNEXPECTED_ERROR);return e}}function pu(A,e){return vo(A)?"__i18n"in e?"local":"global":A.useScope?A.useScope:"local"}function mu(A){return A.mode==="composition"?A.global:A.global.__composer}function yu(A,e,t=!1){let i=null;const n=e.root;let o=wu(e,t);for(;o!=null;){const r=A;if(A.mode==="composition")i=r.__getInstance(o);else if(__VUE_I18N_LEGACY_API__){const g=r.__getInstance(o);g!=null&&(i=g.__composer,t&&i&&!i[MC]&&(i=null))}if(i!=null||n===o)break;o=o.parent}return i}function wu(A,e=!1){return A==null?null:e&&A.vnode.ctx||A.parent}function Du(A,e,t){Ft(()=>{},e),Ci(()=>{const i=t;A.__deleteInstance(e);const n=i[Fr];n&&(n(),delete i[Fr])},e)}function ku(A,e,t,i={}){const n=e==="local",o=eg(null);if(n&&A.proxy&&!(A.proxy.$options.i18n||A.proxy.$options.__i18n))throw Ie(re.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION);const r=RA(i.inheritLocale)?i.inheritLocale:!rA(i.locale),g=EA(!n||r?t.locale.value:rA(i.locale)?i.locale:Si),s=EA(!n||r?t.fallbackLocale.value:rA(i.fallbackLocale)||qA(i.fallbackLocale)||vA(i.fallbackLocale)||i.fallbackLocale===!1?i.fallbackLocale:g.value),a=EA(bo(g.value,i)),I=EA(vA(i.datetimeFormats)?i.datetimeFormats:{[g.value]:{}}),l=EA(vA(i.numberFormats)?i.numberFormats:{[g.value]:{}}),C=n?t.missingWarn:RA(i.missingWarn)||Pt(i.missingWarn)?i.missingWarn:!0,Q=n?t.fallbackWarn:RA(i.fallbackWarn)||Pt(i.fallbackWarn)?i.fallbackWarn:!0,E=n?t.fallbackRoot:RA(i.fallbackRoot)?i.fallbackRoot:!0,f=!!i.fallbackFormat,h=VA(i.missing)?i.missing:null,u=VA(i.postTranslation)?i.postTranslation:null,p=n?t.warnHtmlMessage:RA(i.warnHtmlMessage)?i.warnHtmlMessage:!0,c=!!i.escapeParameter,d=n?t.modifiers:vA(i.modifiers)?i.modifiers:{},w=i.pluralRules||n&&t.pluralRules;function F(){return[g.value,s.value,a.value,I.value,l.value]}const N=hA({get:()=>o.value?o.value.locale.value:g.value,set:k=>{o.value&&(o.value.locale.value=k),g.value=k}}),G=hA({get:()=>o.value?o.value.fallbackLocale.value:s.value,set:k=>{o.value&&(o.value.fallbackLocale.value=k),s.value=k}}),P=hA(()=>o.value?o.value.messages.value:a.value),b=hA(()=>I.value),R=hA(()=>l.value);function L(){return o.value?o.value.getPostTranslationHandler():u}function cA(k){o.value&&o.value.setPostTranslationHandler(k)}function dA(){return o.value?o.value.getMissingHandler():h}function CA(k){o.value&&o.value.setMissingHandler(k)}function iA(k){return F(),k()}function X(...k){return o.value?iA(()=>Reflect.apply(o.value.t,null,[...k])):iA(()=>"")}function eA(...k){return o.value?Reflect.apply(o.value.rt,null,[...k]):""}function fA(...k){return o.value?iA(()=>Reflect.apply(o.value.d,null,[...k])):iA(()=>"")}function DA(...k){return o.value?iA(()=>Reflect.apply(o.value.n,null,[...k])):iA(()=>"")}function Y(k){return o.value?o.value.tm(k):{}}function q(k,J){return o.value?o.value.te(k,J):!1}function gA(k){return o.value?o.value.getLocaleMessage(k):{}}function FA(k,J){o.value&&(o.value.setLocaleMessage(k,J),a.value[k]=J)}function LA(k,J){o.value&&o.value.mergeLocaleMessage(k,J)}function TA(k){return o.value?o.value.getDateTimeFormat(k):{}}function M(k,J){o.value&&(o.value.setDateTimeFormat(k,J),I.value[k]=J)}function Z(k,J){o.value&&o.value.mergeDateTimeFormat(k,J)}function $(k){return o.value?o.value.getNumberFormat(k):{}}function IA(k,J){o.value&&(o.value.setNumberFormat(k,J),l.value[k]=J)}function bA(k,J){o.value&&o.value.mergeNumberFormat(k,J)}const D={get id(){return o.value?o.value.id:-1},locale:N,fallbackLocale:G,messages:P,datetimeFormats:b,numberFormats:R,get inheritLocale(){return o.value?o.value.inheritLocale:r},set inheritLocale(k){o.value&&(o.value.inheritLocale=k)},get availableLocales(){return o.value?o.value.availableLocales:Object.keys(a.value)},get modifiers(){return o.value?o.value.modifiers:d},get pluralRules(){return o.value?o.value.pluralRules:w},get isGlobal(){return o.value?o.value.isGlobal:!1},get missingWarn(){return o.value?o.value.missingWarn:C},set missingWarn(k){o.value&&(o.value.missingWarn=k)},get fallbackWarn(){return o.value?o.value.fallbackWarn:Q},set fallbackWarn(k){o.value&&(o.value.missingWarn=k)},get fallbackRoot(){return o.value?o.value.fallbackRoot:E},set fallbackRoot(k){o.value&&(o.value.fallbackRoot=k)},get fallbackFormat(){return o.value?o.value.fallbackFormat:f},set fallbackFormat(k){o.value&&(o.value.fallbackFormat=k)},get warnHtmlMessage(){return o.value?o.value.warnHtmlMessage:p},set warnHtmlMessage(k){o.value&&(o.value.warnHtmlMessage=k)},get escapeParameter(){return o.value?o.value.escapeParameter:c},set escapeParameter(k){o.value&&(o.value.escapeParameter=k)},t:X,getPostTranslationHandler:L,setPostTranslationHandler:cA,getMissingHandler:dA,setMissingHandler:CA,rt:eA,d:fA,n:DA,tm:Y,te:q,getLocaleMessage:gA,setLocaleMessage:FA,mergeLocaleMessage:LA,getDateTimeFormat:TA,setDateTimeFormat:M,mergeDateTimeFormat:Z,getNumberFormat:$,setNumberFormat:IA,mergeNumberFormat:bA};function S(k){k.locale.value=g.value,k.fallbackLocale.value=s.value,Object.keys(a.value).forEach(J=>{k.mergeLocaleMessage(J,a.value[J])}),Object.keys(I.value).forEach(J=>{k.mergeDateTimeFormat(J,I.value[J])}),Object.keys(l.value).forEach(J=>{k.mergeNumberFormat(J,l.value[J])}),k.escapeParameter=c,k.fallbackFormat=f,k.fallbackRoot=E,k.fallbackWarn=Q,k.missingWarn=C,k.warnHtmlMessage=p}return xI(()=>{if(A.proxy==null||A.proxy.$i18n==null)throw Ie(re.NOT_AVAILABLE_COMPOSITION_IN_LEGACY);const k=o.value=A.proxy.$i18n.__composer;e==="global"?(g.value=k.locale.value,s.value=k.fallbackLocale.value,a.value=k.messages.value,I.value=k.datetimeFormats.value,l.value=k.numberFormats.value):n&&S(k)}),D}const vu=["locale","fallbackLocale","availableLocales"],Ps=["t","rt","d","n","tm","te"];function Fu(A,e){const t=Object.create(null);return vu.forEach(n=>{const o=Object.getOwnPropertyDescriptor(e,n);if(!o)throw Ie(re.UNEXPECTED_ERROR);const r=le(o.value)?{get(){return o.value.value},set(g){o.value.value=g}}:{get(){return o.get&&o.get()}};Object.defineProperty(t,n,r)}),A.config.globalProperties.$i18n=t,Ps.forEach(n=>{const o=Object.getOwnPropertyDescriptor(e,n);if(!o||!o.value)throw Ie(re.UNEXPECTED_ERROR);Object.defineProperty(A.config.globalProperties,`$${n}`,o)}),()=>{delete A.config.globalProperties.$i18n,Ps.forEach(n=>{delete A.config.globalProperties[`$${n}`]})}}iu();__INTLIFY_JIT_COMPILATION__?ys(XE):ys(ZE);YE(pE);_E(mC);if(__INTLIFY_PROD_DEVTOOLS__){const A=ft();A.__INTLIFY__=!0,bE(A.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}const Jt=EA({isOnline:!1,error:"",lastCheck:null}),ge=EA({chip:null,board:null,firmware:null,flash:null,assetsPartition:null,network:null,screen:null}),si=EA(""),Pn=EA(!1),yi=EA(null),Su=A=>new URLSearchParams(window.location.search).get(A),On=async(A,e={})=>{if(!si.value)throw new Error("Authentication token not found");const t=await fetch("/api/messaging/device/tools/call",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${si.value}`},body:JSON.stringify({name:A,arguments:e})});if(t.ok)return await t.json();{const i=await t.text();console.error(`MCP tool ${A} failed:`,t.status,i);let n=`Failed to call ${A}`;try{const o=JSON.parse(i);o.message&&(n=o.message)}catch{n=`${n}: HTTP ${t.status}`}throw new Error(n)}},bu=async()=>{var A,e,t,i;try{const[n,o,r]=await Promise.allSettled([On("self.get_system_info"),On("self.get_device_status"),On("self.screen.get_info")]);if(n.status==="fulfilled"&&n.value){const g=n.value.data||n.value;if(ge.value.chip={model:g.chip_model_name||"Unknown"},ge.value.board={model:((A=g.board)==null?void 0:A.name)||"Unknown"},ge.value.firmware={version:((e=g.application)==null?void 0:e.version)||"Unknown"},g.flash_size){const s=Math.round(g.flash_size/1024/1024);ge.value.flash={size:`${s}MB`}}else ge.value.flash={size:"Unknown"};if(g.partition_table){const s=g.partition_table.find(a=>a.label==="assets");s?ge.value.assetsPartition={size:s.size,sizeFormatted:`${Math.round(s.size/1024/1024)}MB`}:ge.value.assetsPartition=null}else ge.value.assetsPartition=null}else console.warn("系统信息获取失败:",n.reason||n.value),ge.value.chip={model:"Unknown"},ge.value.board={model:"Unknown"},ge.value.firmware={version:"Unknown"},ge.value.flash={size:"Unknown"},ge.value.assetsPartition=null;if(o.status==="fulfilled"&&o.value){const g=o.value.data||o.value;ge.value.network={type:((t=g.network)==null?void 0:t.type)||"unknown",signal:((i=g.network)==null?void 0:i.signal)||"Unknown"}}else console.warn("设备状态获取失败:",o.reason||o.value),ge.value.network={type:"unknown",signal:"Unknown"};if(r.status==="fulfilled"&&r.value){const g=r.value.data||r.value;ge.value.screen={resolution:`${g.width||0}x${g.height||0}`}}else console.warn("屏幕信息获取失败:",r.reason||r.value),ge.value.screen={resolution:"Unknown"}}catch(n){console.error("获取设备信息时发生错误:",n)}},Ro=async()=>{if(!(Pn.value||!si.value)){Pn.value=!0;try{const A=await fetch("/api/messaging/device/tools/list",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${si.value}`}});if(A.ok)Jt.value.isOnline=!0,Jt.value.error="",Jt.value.lastCheck=new Date,await bu();else throw new Error(`HTTP ${A.status}: ${A.statusText}`)}catch{Jt.value.isOnline=!1,Jt.value.error="",Jt.value.lastCheck=new Date,yi.value&&clearTimeout(yi.value),yi.value=setTimeout(Ro,3e4)}finally{Pn.value=!1}}},Ru=(A,e)=>{if(!A)return e("device.signal.unknown");switch(A.toLowerCase()){case"strong":return e("device.signal.strong");case"medium":return e("device.signal.medium");case"weak":return e("device.signal.weak");case"none":return e("device.signal.none");default:return A}},Nu=()=>{si.value=Su("token"),si.value&&Ro()},Gu=()=>{yi.value&&(clearTimeout(yi.value),yi.value=null)},Lu=async()=>{await Ro()};function No(){const A=hA(()=>!!si.value),e=hA(()=>Jt.value.isOnline);return{deviceStatus:Jt,deviceInfo:ge,isChecking:Pn,hasToken:A,isDeviceOnline:e,initializeDeviceStatus:Nu,cleanupDeviceStatus:Gu,refreshDeviceStatus:Lu,checkDeviceStatus:Ro,callMcpTool:On,getSignalDisplayText:Ru}}const Os={__name:"WifiIcon",props:{size:{type:String,default:"w-4 h-4"},color:{type:String,default:"text-blue-500"}},setup(A){const e=A,t=hA(()=>`${e.size} ${e.color}`);return(i,n)=>(H(),_("svg",{class:kA(t.value),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...n[0]||(n[0]=[B("path",{d:"M3 9c4.97-4.97 13.03-4.97 18 0","stroke-width":"2","stroke-linecap":"round"},null,-1),B("path",{d:"M6 12c3.31-3.31 8.69-3.31 12 0","stroke-width":"2","stroke-linecap":"round"},null,-1),B("path",{d:"M9 15c1.66-1.66 4.34-1.66 6 0","stroke-width":"2","stroke-linecap":"round"},null,-1),B("circle",{cx:"12",cy:"18",r:"1.5",fill:"currentColor"},null,-1)])],2))}},Vs={__name:"Signal4GIcon",props:{size:{type:String,default:"w-4 h-4"},color:{type:String,default:"text-green-500"}},setup(A){const e=A,t=hA(()=>`${e.size} ${e.color}`);return(i,n)=>(H(),_("svg",{class:kA(t.value),fill:"currentColor",viewBox:"0 0 24 24"},[...n[0]||(n[0]=[Do('4G',5)])],2))}},Ws={__name:"ChipIcon",props:{size:{type:String,default:"w-4 h-4"},color:{type:String,default:"text-gray-400"}},setup(A){const e=A,t=hA(()=>`${e.size} ${e.color}`);return(i,n)=>(H(),_("svg",{class:kA(t.value),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...n[0]||(n[0]=[Do('',14)])],2))}},qs={__name:"FlashIcon",props:{size:{type:String,default:"w-4 h-4"},color:{type:String,default:"text-gray-400"}},setup(A){const e=A,t=hA(()=>`${e.size} ${e.color}`);return(i,n)=>(H(),_("svg",{class:kA(t.value),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...n[0]||(n[0]=[Do('',10)])],2))}},js={__name:"BoardIcon",props:{size:{type:String,default:"w-4 h-4"},color:{type:String,default:"text-gray-400"}},setup(A){const e=A,t=hA(()=>`${e.size} ${e.color}`);return(i,n)=>(H(),_("svg",{class:kA(t.value),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...n[0]||(n[0]=[Do('',10)])],2))}},Zs={__name:"ScreenIcon",props:{size:{type:String,default:"w-4 h-4"},color:{type:String,default:"text-gray-400"}},setup(A){const e=A,t=hA(()=>`${e.size} ${e.color}`);return(i,n)=>(H(),_("svg",{class:kA(t.value),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...n[0]||(n[0]=[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},null,-1)])],2))}},Uu={class:"flex items-center space-x-2"},Mu={class:"flex items-center space-x-1"},xu={key:0,class:"flex items-center space-x-1"},Ju={class:"text-xs text-gray-500"},Tu={key:0,class:"flex items-center space-x-4 text-sm text-gray-600"},Hu={key:0,class:"flex items-center space-x-1"},Yu={key:1,class:"flex items-center space-x-1"},_u={key:2,class:"flex items-center space-x-1"},Ku={key:3,class:"flex items-center space-x-1"},Pu={key:1,class:"lg:hidden flex flex-col bg-white rounded-lg border border-gray-200 shadow-sm overflow-hidden"},Ou={class:"flex items-center justify-between px-4 py-3 bg-gray-50 border-b border-gray-200"},Vu={class:"flex items-center space-x-2"},Wu={key:0,class:"flex items-center space-x-1"},qu={class:"text-xs font-medium text-gray-600"},ju={key:0,class:"px-4 py-3"},Zu={class:"grid grid-cols-1 gap-2.5"},Xu={class:"flex justify-between items-center py-1.5 border-b border-gray-100"},zu={key:0,class:"flex items-center space-x-2 flex-1"},$u={class:"min-w-0 flex-1"},Ah={class:"text-xs text-gray-500 leading-tight"},eh={class:"text-sm text-gray-800 font-medium truncate"},th={key:1,class:"flex items-center space-x-2 flex-1 ml-3"},ih={class:"min-w-0 flex-1"},nh={class:"text-xs text-gray-500 leading-tight"},oh={class:"text-sm text-gray-800 font-medium truncate"},rh={class:"flex justify-between items-center py-1.5"},gh={key:0,class:"flex items-center space-x-2 flex-1"},sh={class:"min-w-0 flex-1"},ah={class:"text-xs text-gray-500 leading-tight"},Ih={class:"text-sm text-gray-800 font-medium"},Ch={key:1,class:"flex items-center space-x-2 flex-1 ml-3"},lh={class:"min-w-0 flex-1"},Bh={class:"text-xs text-gray-500 leading-tight"},Qh={class:"text-sm text-gray-800 font-medium"},ch={__name:"DeviceStatus",setup(A){const{t:e}=ve(),{deviceStatus:t,deviceInfo:i,hasToken:n,initializeDeviceStatus:o,cleanupDeviceStatus:r,getSignalDisplayText:g}=No(),s=hA(()=>n.value);return Ft(()=>{o()}),Ci(()=>{r()}),(a,I)=>(H(),_(jA,null,[s.value?(H(),_("div",{key:0,class:kA(["hidden lg:flex items-center space-x-4",QA(t).isOnline?"":"opacity-60"])},[B("div",Uu,[B("div",Mu,[B("div",{class:kA(["w-2 h-2 rounded-full",QA(t).isOnline?"bg-green-500":"bg-gray-400"])},null,2),B("span",{class:kA(["text-sm font-medium",QA(t).isOnline?"text-gray-700":"text-gray-500"])},v(QA(t).isOnline?a.$t("device.online"):a.$t("device.offline")),3)]),QA(t).isOnline&&QA(i).network?(H(),_("div",xu,[QA(i).network.type==="wifi"?(H(),ye(QA(Os),{key:0,color:"text-blue-500"})):QA(i).network.type==="4g"?(H(),ye(QA(Vs),{key:1})):sA("",!0),B("span",Ju,v(QA(g)(QA(i).network.signal,QA(e))),1)])):sA("",!0)]),QA(t).isOnline?(H(),_("div",Tu,[QA(i).chip?(H(),_("div",Hu,[HA(QA(Ws)),B("span",null,v(QA(i).chip.model),1)])):sA("",!0),QA(i).flash?(H(),_("div",Yu,[HA(QA(qs)),B("span",null,v(QA(i).flash.size),1)])):sA("",!0),QA(i).board?(H(),_("div",_u,[HA(QA(js)),B("span",null,v(QA(i).board.model),1)])):sA("",!0),QA(i).screen?(H(),_("div",Ku,[HA(QA(Zs)),B("span",null,v(QA(i).screen.resolution),1)])):sA("",!0)])):sA("",!0)],2)):sA("",!0),s.value?(H(),_("div",Pu,[B("div",Ou,[B("div",Vu,[B("div",{class:kA(["w-2.5 h-2.5 rounded-full",QA(t).isOnline?"bg-green-500":"bg-red-400"])},null,2),B("span",{class:kA(["text-sm font-medium",QA(t).isOnline?"text-gray-800":"text-gray-600"])},v(QA(t).isOnline?a.$t("device.online"):a.$t("device.offline")),3)]),QA(t).isOnline&&QA(i).network?(H(),_("div",Wu,[QA(i).network.type==="wifi"?(H(),ye(QA(Os),{key:0,color:"text-blue-500"})):QA(i).network.type==="4g"?(H(),ye(QA(Vs),{key:1})):sA("",!0),B("span",qu,v(QA(g)(QA(i).network.signal,QA(e))),1)])):sA("",!0)]),QA(t).isOnline?(H(),_("div",ju,[B("div",Zu,[B("div",Xu,[QA(i).chip?(H(),_("div",zu,[HA(QA(Ws),{class:"flex-shrink-0"}),B("div",$u,[B("div",Ah,v(a.$t("device.chip")),1),B("div",eh,v(QA(i).chip.model),1)])])):sA("",!0),QA(i).board?(H(),_("div",th,[HA(QA(js),{class:"flex-shrink-0"}),B("div",ih,[B("div",nh,v(a.$t("device.board")),1),B("div",oh,v(QA(i).board.model),1)])])):sA("",!0)]),B("div",rh,[QA(i).flash?(H(),_("div",gh,[HA(QA(qs),{class:"flex-shrink-0"}),B("div",sh,[B("div",ah,v(a.$t("device.flash")),1),B("div",Ih,v(QA(i).flash.size),1)])])):sA("",!0),QA(i).screen?(H(),_("div",Ch,[HA(QA(Zs),{class:"flex-shrink-0"}),B("div",lh,[B("div",Bh,v(a.$t("device.screen")),1),B("div",Qh,v(QA(i).screen.resolution),1)])])):sA("",!0)])])])):sA("",!0)])):sA("",!0)],64))}},Eh={title:"Xiaozhi AI Customization"},uh={cancel:"Cancel",confirm:"Confirm",close:"Close",start:"Start",download:"Download",generate:"Generate",reset:"Reset",yes:"Yes",no:"No",loading:"Loading...",error:"Error",success:"Success",warning:"Warning",info:"Information",next:"Next",previous:"Previous",finish:"Finish",retry:"Retry",ok:"OK",other:"Other"},hh={title:"Xiaozhi AI Customization"},fh={title:"Saved Configuration Detected",message:"Configuration has been automatically restored. You can continue from where you left off or start over.",restart:"Start Over"},dh={chip:"Chip Configuration",theme:"Theme Design",generate:"Preview & Generate"},ph={title:"Generate assets.bin",confirmConfig:"Please confirm your configuration",chipModel:"Chip Model:",resolution:"Resolution:",wakeword:"Wake Word:",font:"Font:",emoji:"Emoji Package:",fileList:"Included Files List",estimated:"Estimated",compressed:"Before compression",generating:"Generating assets.bin...",progress:"{progress}% Complete",completed:"Your assets.bin file is ready",filename:"Filename: assets.bin",fileSize:"File Size: {size}",generationTime:"Generation Time: {time}",downloadAssets:"Download assets.bin",flashToDevice:"Flash to Device Online",flashing:"Flashing to device...",flashingCancel:"Cancel Flash",flashingError:"Flashing Error",flashingInProgress:"Flashing in progress, please do not close the window",customFont:"Custom Font",customEmoji:"Custom Emoji Package",notConfigured:"Not Configured",wakewordNames:{wn9s_hilexin:"Hi, Espressif",wn9s_hiesp:"Hi, ESP",wn9s_nihaoxiaozhi:"Hello Xiaozhi",wn9_nihaoxiaozhi_tts:"Hello Xiaozhi",wn9_alexa:"Alexa"}},mh={init:"Initialize Generator",font:"Process Font Files",wakeword:"Package Wake Word Model",emoji:"Process Emoji Images",background:"Process Background Images",index:"Generate Index File",spiffs:"Build SPIFFS Mapping",package:"Complete Packaging"},yh={title:"Wake Word Configuration",description:"Select a preset wake word model or customize it using a command recognition model.",supportWakeNet9:"Your chip supports WakeNet9 models.",supportWakeNet9s:"Your chip supports WakeNet9s models.",notSupported:"Your chip does not support wake word functionality.",notice:"Note:",unsupportedMessage:"{chipModel} chip does not support wake word functionality. If you need to use wake words, please select ESP32-S3, ESP32-P4, or ESP32-C3/C5/C6 chips.",noWakeword:"No Wake Word",presetWakeword:"Preset Wake Word",customWakeword:"Custom Wake Word",selectWakeword:"Select Wake Word",placeholder:"Select wake word...",customSettings:"Custom Wake Word Settings",wakewordName:"Wake Word Name",wakewordNamePlaceholder:"e.g., Xiaozhi / Potato",wakewordCommand:"Wake Command",wakewordCommandPlaceholderCN:"Pinyin separated by spaces, e.g., ni hao xiao zhi",wakewordCommandPlaceholderEN:"English words, no punctuation, e.g., HELLO POTATO",threshold:"Sensitivity Threshold (0-100)",thresholdDesc:"Lower is more sensitive, default 20",duration:"Recognition Duration",durationDesc:"Maximum duration for command recognition",selectModel:"Select Recognition Model",mn6cn:"MultiNet6 (Chinese)",mn6en:"MultiNet6 (English)",mn7cn:"MultiNet7 (Chinese)",mn7en:"MultiNet7 (English)",errors:{nameRequired:"Please enter wake word name",commandRequired:"Please enter wake command",noPunctuation:"Command cannot contain punctuation",durationRange:"Duration must be between 500-10000ms"},tips:{tipLabel:"Tip:",optional:"Wake words are optional. If disabled, the device cannot be voice-activated.",wakeNet9sOnly:"C3/C5/C6 chips only support WakeNet9s lightweight models.",wakeNet9Full:"S3/P4 chips support complete WakeNet9 models with more choices.",customSupport:"Custom wake words use MultiNet models, currently only supported on ESP32-S3."}},wh={resetFailed:"Reset failed, please refresh the page and try again",generationFailed:"Generation failed: {error}",noFileToDownload:"No downloadable file available",deviceOffline:"Device is offline and cannot be flashed",fileTooLarge:"Flash failed: File size {fileSize}MB exceeds assets partition size {partitionSize}MB. Please reduce configuration content or use a device with larger capacity.",flashCancelConfirm:"Are you sure you want to cancel flashing?",oldDataCleared:`Old version emoji data structure has been detected and cleared. - -The new version uses file deduplication technology to save storage space. - -Please re-upload custom emoji images.`,incompatibleEmojiData:"Incompatible emoji data detected, please reconfigure"},Dh={authTokenMissing:"Authentication token not found",checkingDeviceStatus:"Checking device status...",deviceOfflineOrUnresponsive:"Device offline or unresponsive: {error}",unableToGetDeviceStatus:"Unable to get device status",initializingTransferService:"Initializing transfer service...",initializeTransferFailed:"Failed to initialize transfer service: {error}",settingDeviceDownloadUrl:"Setting device download URL...",setDownloadUrlFailed:"Failed to set download URL: {error}",rebootingDevice:"Rebooting device...",waitingForDeviceReboot:"Waiting for device to reboot...",deviceRebootTimeout:"Device reboot timeout (60 seconds)",startingFileTransfer:"Starting file transfer...",flashCompleted:"Flashing completed!",onlineFlashFailed:"Online flashing failed: {error}"},kh={online:"Online",offline:"Offline",checking:"Checking...",flashing:"Flashing...",ready:"Ready",chip:"Chip",board:"Board",flash:"Flash",screen:"Screen",signal:{unknown:"Unknown",strong:"Strong",medium:"Medium",weak:"Weak",none:"No Signal"}},vh={title:"Step 1: Chip Model and Screen Configuration",loadingFromDevice:"Loading hardware configuration from device...",loadedFromDevice:"Hardware configuration automatically loaded from device",manualConfig:"Please configure hardware parameters manually",loadingTitle:"Loading Device Configuration...",loadingDesc:"Reading chip model and screen resolution from device",autoLoadedTitle:"Device Configuration Auto-loaded",chipModel:"Chip Model",screenWidth:"Screen Width",screenHeight:"Screen Height",colorFormat:"Color Format:",manualEdit:"Manual Configuration",collapseManual:"Collapse Manual Configuration",manualConfigTitle:"Manual Hardware Configuration",next:"Next",selectChip:"Select Chip",chipRequired:"Chip Model",widthRequired:"Screen Width",heightRequired:"Screen Height",loadingError:"Loading configuration error",deviceOffline:"Device not connected or offline",chipModelError:"Unable to get chip model, please enter manually",resolutionError:"Unable to get screen resolution, please enter manually",timeoutError:"Configuration loading timeout, please enter manually",manualConfigDesc:"Unable to auto-read device configuration",manualConfigHint:"Device not connected or offline, please manually input hardware configuration",manualConfigRequired:"Please manually input hardware configuration",resolutionFormatError:"Screen resolution format error"},Fh={title:"Step 2: Theme Design",description:"Configure wake word, font, emoji and background to customize your Xiaozhi AI theme.",previous:"Previous",next:"Next",tabs:{wakeword:"Wake Word Config",font:"Font Config",emoji:"Emoji Collection",background:"Chat Background"}},Sh={title:"Step 3: Preview",description:"Preview the effect of your custom configuration on the actual device.",devicePreview:"Device Preview (1:1 Pixel Ratio)",previewSettings:"Preview Settings",previewText:"Preview Text",defaultPreviewText:"Hi, I'm your friend Xiaozhi!",currentEmotion:"Current Emotion",themeMode:"Theme Mode",lightMode:"Light",darkMode:"Dark",configSummary:"Configuration Summary",wakeword:"Wake Word:",font:"Font:",loading:"Loading...",emotion:"Emotion:",skin:"Skin:",previous:"Previous",generate:"Generate assets.bin",emotions:{neutral:"Neutral",happy:"Happy",laughing:"Laughing",funny:"Funny",sad:"Sad",angry:"Angry",crying:"Crying",loving:"Loving",embarrassed:"Embarrassed",surprised:"Surprised",shocked:"Shocked",thinking:"Thinking",winking:"Winking",cool:"Cool",relaxed:"Relaxed",delicious:"Delicious",kissy:"Kiss",confident:"Confident",sleepy:"Sleepy",silly:"Silly",confused:"Confused"},noEmotionConfigured:"No emotion configured",fontLoading:"Font loading...",configureEmojiFirst:"Please configure emoji package in theme design first",customFont:"Custom Font {size}px",customEmoji:"Custom Emoji {count} images",notConfigured:"Not configured",skinLight:"Light {type}",skinDark:"Dark {type}",hideSubtitle:"Hide Subtitle:",image:"Image",color:"Color"},bh={title:"Chat Background Configuration",description:"Configure chat backgrounds for light and dark modes, supporting solid colors or custom images.",lightMode:"Light Mode Background",darkMode:"Dark Mode Background",solidBackground:"Solid Background",imageBackground:"Image Background",backgroundColor:"Background Color:",textColor:"Text Color:",backgroundImage:"Background Image:",clickOrDragToUpload:"Click or drag to upload background image",removeImage:"Remove Image",backgroundPreview:"Background Preview",lightModePreview:"Light Mode",darkModePreview:"Dark Mode",chatArea:"Chat Content Area",quickConfig:"Quick Configuration",defaultColors:"Default Colors",stoneTexture:"Stone Texture",sunnyColors:"Sunny Colors",skyBlue:"Sky Blue",romanticPink:"Romantic Pink",selectValidImage:"Please select a valid image file"},Rh={title:"Emoji Collection Configuration",description:"Choose preset emoji package or custom emoji images. Each emoji package contains 21 different emotion expressions.",noEmojiPack:"No Emoji Pack",noEmojiPackDescription:"Don't configure emoji pack, only font and background resources will be included in the package.",presetEmojiPack:"Preset Emoji Pack",customEmojiPack:"Custom Emoji Pack",selectPresetEmojiPack:"Select Preset Emoji Pack",twemoji64:"Twemoji 64×64",twemoji32:"Twemoji 32×32",twemojiDescription:"High-quality emoji set from Twitter, perfect for clear display",twitterEmojiName:"Twemoji {size}x{size}",twitterEmojiDescription:"Twitter emoji pack, {size}×{size} pixels",size:"Size",preview:"Preview",select:"Select",customEmojiTitle:"Custom Emoji Pack",customEmojiDescription:"Upload your own emoji images. Each emotion needs one image.",uploadInstructions:"Click or drag to upload emoji images (PNG/JPG/WEBP)",supportedFormats:"Supported formats: PNG, JPG, WEBP. Recommended size: 64×64 pixels",emotionMapping:"Emotion Mapping",uploadAllEmotions:"Please upload emoji images for all emotions",maxImageWidth:"Max Image Width (px)",maxImageHeight:"Max Image Height (px)",clickToUpload:"Click to upload",orDragDrop:"or drag and drop",clickToUploadOrDrag:"Click to upload or drag here",remove:"Remove",replace:"Replace",selectValidEmojiImage:"Please select a valid emoji image file",selectValidFormat:"Please select a valid PNG or GIF format image",maxFileSize:"File size cannot exceed 1MB",invalidFormat:"Unsupported image format. Please use PNG, JPG, or WEBP.",required:"Required",uploadEmojiImages:"Upload Emoji Images (GIF requires PSRAM)",customEmojiPackConfig:"Custom Emoji Pack Configuration",neutralRequiredNotice:"* Must upload neutral default emotion, others are optional. If not uploaded, default emotion will be used instead.",sharedFileMessage:"Emotion {emotionKey} uses the same image file as {existingEmotions} (shared storage)",fileDeleted:"File {fileHash} has been deleted (no other emotion references)",fileRetained:"File {fileHash} is still used by other emotions, retained",imageLoadFailed:"Failed to load emoji image",emotions:{neutral:"Neutral",happy:"Happy",laughing:"Laughing",funny:"Funny",sad:"Sad",angry:"Angry",crying:"Crying",loving:"Loving",embarrassed:"Embarrassed",surprised:"Surprised",shocked:"Shocked",thinking:"Thinking",winking:"Winking",cool:"Cool",relaxed:"Relaxed",delicious:"Delicious",kissy:"Kiss",confident:"Confident",sleepy:"Sleepy",silly:"Silly",confused:"Confused"}},Nh={title:"Font Configuration",description:"Choose preset fonts or upload custom font files.",noFonts:"No Fonts",noFontsDescription:"Do not use font configuration, the device will use the default font",presetFonts:"Preset Fonts",customFonts:"Custom Fonts",selectPresetFont:"Select Preset Font",fontSize:"Font Size:",bitDepth:"Bit Depth:",charset:"Character Set:",fileSize:"File Size:",customFontConfig:"Custom Font Configuration",fontFile:"Font File",clickSelectFontFile:"Click to select font file",orDragFileHere:"or drag file here",supportedFormats:"Supports TTF, WOFF, WOFF2 formats",removeFile:"Remove File",fontSizePx:"Font Size (px)",range:"Range:",bitDepthBpp:"Bit Depth (BPP)",monochrome:"1 bpp (Monochrome)",fourColors:"2 bpp (4 colors)",sixteenColors:"4 bpp (16 colors)",characterSet:"Character Set",deepseekR1:"DeepSeek R1 (7405 characters)",gb2312:"GB2312 (7445 characters)",qwen18409:"Qwen (18409 characters)",latin1:"Latin1 (190 characters)",fullCharset:"Full Character Set (All characters in font file)",hideSubtitle:"Hide Subtitle",hideSubtitleDescription:"Do not show real-time text subtitles during conversation",selectValidFontFile:"Please select a valid font file (TTF, WOFF, WOFF2)",presetFontNames:{font_puhui_deepseek_14_1:"Alibaba PuHuiTi 14px",font_puhui_deepseek_16_4:"Alibaba PuHuiTi 16px",font_puhui_deepseek_20_4:"Alibaba PuHuiTi 20px",font_puhui_deepseek_30_4:"Alibaba PuHuiTi 30px",font_noto_qwen_14_1:"Noto Sans 14px",font_noto_qwen_16_4:"Noto Sans 16px",font_noto_qwen_20_4:"Noto Sans 20px",font_noto_qwen_30_4:"Noto Sans 30px"},charsetDeepseek:"DeepSeek 7405",charsetQwen:"Qwen 18409"},Gh={app:Eh,common:uh,header:hh,configNotice:fh,steps:dh,generateModal:ph,progressSteps:mh,wakewordConfig:yh,errors:wh,flashProgress:Dh,device:kh,chipConfig:vh,themeDesign:Fh,generateSummary:Sh,backgroundConfig:bh,emojiConfig:Rh,fontConfig:Nh},Lh={title:"小智 AI 自定义"},Uh={cancel:"取消",confirm:"确认",close:"关闭",start:"开始",download:"下载",generate:"生成",reset:"重置",yes:"是",no:"否",loading:"加载中...",error:"错误",success:"成功",warning:"警告",info:"信息",next:"下一步",previous:"上一步",finish:"完成",retry:"重试",ok:"确定",other:"其他"},Mh={title:"小智 AI 自定义"},xh={title:"检测到已保存的配置",message:"配置已自动恢复,您可以继续之前的进度或重新开始。",restart:"重新开始"},Jh={chip:"芯片配置",theme:"主题设计",generate:"效果预览"},Th={title:"生成 assets.bin",confirmConfig:"请确认您的配置",chipModel:"芯片型号:",resolution:"分辨率:",wakeword:"唤醒词:",font:"字体:",emoji:"表情包:",fileList:"包含的文件列表",estimated:"预估",compressed:"压缩前",generating:"正在生成 assets.bin...",progress:"{progress}% 完成",completed:"您的 assets.bin 文件已准备就绪",filename:"文件名: assets.bin",fileSize:"文件大小: {size}",generationTime:"生成时间: {time}",downloadAssets:"下载 assets.bin",flashToDevice:"在线烧录到设备",flashing:"正在烧录到设备...",flashingCancel:"取消烧录",flashingError:"烧录错误",flashingInProgress:"烧录中,请勿关闭窗口",customFont:"自定义字体",customEmoji:"自定义表情包",notConfigured:"未配置",wakewordNames:{wn9s_hilexin:"Hi,乐鑫",wn9s_hiesp:"Hi,ESP",wn9s_nihaoxiaozhi:"你好小智",wn9_nihaoxiaozhi_tts:"你好小智",wn9_alexa:"Alexa"}},Hh={init:"初始化生成器",font:"处理字体文件",wakeword:"打包唤醒词模型",emoji:"处理表情图片",background:"处理背景图片",index:"生成索引文件",spiffs:"构建SPIFFS映射",package:"完成打包"},Yh={resetFailed:"重置失败,请刷新页面重试",generationFailed:"生成失败: {error}",noFileToDownload:"没有可下载的文件",deviceOffline:"设备离线,无法进行烧录",fileTooLarge:"烧录失败:文件大小 {fileSize}MB 超过 assets 分区大小 {partitionSize}MB,请减少配置内容或使用更大容量的设备。",flashCancelConfirm:"确定要取消烧录吗?",oldDataCleared:`检测到旧版本的表情数据结构已被清除。 - -新版本使用文件去重技术,可以节省存储空间。 - -请重新上传自定义表情图片。`,incompatibleEmojiData:"检测到不兼容的表情数据,请重新配置"},_h={authTokenMissing:"未找到认证令牌",checkingDeviceStatus:"检查设备状态...",deviceOfflineOrUnresponsive:"设备离线或无响应: {error}",unableToGetDeviceStatus:"无法获取设备状态",initializingTransferService:"初始化传输服务...",initializeTransferFailed:"初始化传输服务失败: {error}",settingDeviceDownloadUrl:"设置设备下载URL...",setDownloadUrlFailed:"设置下载URL失败: {error}",rebootingDevice:"重启设备...",waitingForDeviceReboot:"等待设备重启...",deviceRebootTimeout:"等待设备重启超时(60秒)",startingFileTransfer:"开始传输文件...",flashCompleted:"烧录完成!",onlineFlashFailed:"在线烧录失败: {error}"},Kh={online:"在线",offline:"离线",checking:"检查中...",flashing:"烧录中...",ready:"就绪",chip:"芯片",board:"开发板",flash:"Flash",screen:"屏幕",signal:{unknown:"未知",strong:"强",medium:"中等",weak:"弱",none:"无信号"}},Ph={title:"步骤 1: 芯片型号和屏幕配置",loadingFromDevice:"正在从设备读取硬件配置...",loadedFromDevice:"已从设备自动读取硬件配置",manualConfig:"请手动配置硬件参数",loadingTitle:"正在加载设备配置...",loadingDesc:"从设备读取芯片型号和屏幕分辨率",autoLoadedTitle:"设备配置已自动加载",chipModel:"芯片型号",screenWidth:"屏幕宽度",screenHeight:"屏幕高度",colorFormat:"颜色格式:",manualEdit:"手动修改配置",collapseManual:"收起手动配置",manualConfigTitle:"手动配置硬件参数",next:"下一步",selectChip:"请选择芯片",chipRequired:"芯片型号",widthRequired:"屏幕宽度",heightRequired:"屏幕高度",loadingError:"加载配置时发生错误",deviceOffline:"设备未连接或离线",chipModelError:"无法获取芯片型号,请手动输入",resolutionError:"无法获取屏幕分辨率,请手动输入",timeoutError:"加载设备配置超时,请手动输入",manualConfigDesc:"无法自动读取设备配置",manualConfigHint:"设备未连接或离线,请手动输入硬件配置",manualConfigRequired:"请手动输入硬件配置",resolutionFormatError:"屏幕分辨率格式错误"},Oh={title:"步骤 2: 主题设计",description:"配置唤醒词、字体、表情和背景来自定义您的小智AI主题。",previous:"上一步",next:"下一步",tabs:{wakeword:"唤醒词配置",font:"字体配置",emoji:"表情集合",background:"聊天背景"}},Vh={title:"步骤 3: 效果预览",description:"预览您的自定义配置在实际设备上的效果。",devicePreview:"设备预览 (1:1 像素比例)",previewSettings:"预览设置",previewText:"预览文字",defaultPreviewText:"你好,我是你的朋友小智!",currentEmotion:"当前表情",themeMode:"主题模式",lightMode:"浅色",darkMode:"深色",configSummary:"配置摘要",wakeword:"唤醒词:",font:"字体:",loading:"加载中...",emotion:"表情:",skin:"皮肤:",previous:"上一步",generate:"生成 assets.bin",emotions:{neutral:"默认",happy:"开心",laughing:"大笑",funny:"搞笑",sad:"伤心",angry:"生气",crying:"哭泣",loving:"喜爱",embarrassed:"尴尬",surprised:"惊讶",shocked:"震惊",thinking:"思考",winking:"眨眼",cool:"酷炫",relaxed:"放松",delicious:"美味",kissy:"飞吻",confident:"自信",sleepy:"困倦",silly:"调皮",confused:"困惑"},noEmotionConfigured:"未配置表情",fontLoading:"字体加载中...",configureEmojiFirst:"请先在主题设计中配置表情包",customFont:"自定义字体 {size}px",customEmoji:"自定义表情 {count}张",notConfigured:"未配置",skinLight:"浅色{type}",skinDark:"深色{type}",hideSubtitle:"隐藏字幕:",image:"图片",color:"颜色"},Wh={title:"聊天背景配置",description:"配置浅色模式和深色模式的聊天背景,支持纯色或自定义图片。",lightMode:"浅色模式背景",darkMode:"深色模式背景",solidBackground:"纯色背景",imageBackground:"图片背景",backgroundColor:"背景颜色:",textColor:"文字颜色:",backgroundImage:"背景图片:",clickOrDragToUpload:"点击或拖拽上传背景图片",removeImage:"移除图片",backgroundPreview:"背景预览",lightModePreview:"浅色模式",darkModePreview:"深色模式",chatArea:"聊天内容区域",quickConfig:"快捷配置",defaultColors:"默认配色",stoneTexture:"石墨质感",sunnyColors:"暖阳配色",skyBlue:"天空蓝调",romanticPink:"浪漫粉色",selectValidImage:"请选择有效的图片文件"},qh={title:"表情集合配置",description:"选择预设表情包或自定义表情图片。每个表情包包含21种不同情绪的表情。",noEmojiPack:"无表情包",noEmojiPackDescription:"不配置表情包,打包时只包含字体和背景资源。",presetEmojiPack:"预设表情包",customEmojiPack:"自定义表情包",selectPresetEmojiPack:"选择预设表情包",twemoji64:"Twemoji 64×64",twemoji32:"Twemoji 32×32",twemojiDescription:"来自Twitter的高质量表情符号集,适合清晰显示",twitterEmojiName:"Twemoji {size}x{size}",twitterEmojiDescription:"Twitter表情包,{size}×{size}像素",size:"尺寸",preview:"预览",select:"选择",customEmojiTitle:"自定义表情包",customEmojiDescription:"上传您自己的表情图片。每种情绪需要一张图片。",uploadInstructions:"点击或拖拽上传表情图片 (PNG/JPG/WEBP)",supportedFormats:"支持格式: PNG, JPG, WEBP。推荐尺寸: 64×64像素",emotionMapping:"情绪映射",uploadAllEmotions:"请为所有情绪上传表情图片",maxImageWidth:"最大图片宽度 (px)",maxImageHeight:"最大图片高度 (px)",clickToUpload:"点击上传",orDragDrop:"或拖拽上传",clickToUploadOrDrag:"点击上传或拖拽到此处",remove:"移除",replace:"替换",selectValidEmojiImage:"请选择有效的表情图片文件",selectValidFormat:"请选择有效的PNG或GIF格式图片",maxFileSize:"文件大小不能超过1MB",invalidFormat:"不支持的图片格式。请使用PNG、JPG或WEBP。",required:"必需",uploadEmojiImages:"上传表情图片(GIF 需要 PSRAM)",customEmojiPackConfig:"自定义表情包配置",neutralRequiredNotice:"* 必须上传 neutral 默认表情,其他表情可选。如果不上传其他表情,将使用默认表情代替。",sharedFileMessage:"表情 {emotionKey} 使用了与 {existingEmotions} 相同的图片文件(共享存储)",fileDeleted:"文件 {fileHash} 已删除(无其他表情引用)",fileRetained:"文件 {fileHash} 仍被其他表情使用,保留文件",imageLoadFailed:"表情图片加载失败",emotions:{neutral:"默认",happy:"开心",laughing:"大笑",funny:"搞笑",sad:"伤心",angry:"生气",crying:"哭泣",loving:"喜爱",embarrassed:"尴尬",surprised:"惊讶",shocked:"震惊",thinking:"思考",winking:"眨眼",cool:"酷炫",relaxed:"放松",delicious:"美味",kissy:"飞吻",confident:"自信",sleepy:"困倦",silly:"调皮",confused:"困惑"}},jh={title:"字体配置",description:"选择预设字体或上传自定义字体文件。",noFonts:"无字体",noFontsDescription:"不使用字体配置,设备将使用默认字体",presetFonts:"预设字体",customFonts:"自定义字体",selectPresetFont:"选择预设字体",fontSize:"字号:",bitDepth:"位深:",charset:"字符集:",fileSize:"文件大小:",customFontConfig:"自定义字体配置",fontFile:"字体文件",clickSelectFontFile:"点击选择字体文件",orDragFileHere:"或拖拽文件到此处",supportedFormats:"支持 TTF, WOFF, WOFF2 格式",removeFile:"移除文件",fontSizePx:"字号 (px)",range:"范围:",bitDepthBpp:"位深 (BPP)",monochrome:"1 bpp (单色)",fourColors:"2 bpp (4色)",sixteenColors:"4 bpp (16色)",characterSet:"字符集",deepseekR1:"DeepSeek R1 (7405字符)",gb2312:"GB2312 (7445字符)",qwen18409:"Qwen (18409字符)",latin1:"Latin1 (190字符)",fullCharset:"完整字符集 (字体文件的所有字符)",hideSubtitle:"隐藏字幕",hideSubtitleDescription:"对话时不显示实时文字字幕",selectValidFontFile:"请选择有效的字体文件 (TTF, WOFF, WOFF2)",presetFontNames:{font_puhui_deepseek_14_1:"阿里巴巴普惠体 14px",font_puhui_deepseek_16_4:"阿里巴巴普惠体 16px",font_puhui_deepseek_20_4:"阿里巴巴普惠体 20px",font_puhui_deepseek_30_4:"阿里巴巴普惠体 30px",font_noto_qwen_14_1:"思源黑体 14px",font_noto_qwen_16_4:"思源黑体 16px",font_noto_qwen_20_4:"思源黑体 20px",font_noto_qwen_30_4:"思源黑体 30px"},charsetDeepseek:"DeepSeek 7405",charsetQwen:"Qwen 18409"},Zh={title:"唤醒词配置",description:"选择预设唤醒词模型或通过命令词模型自定义唤醒词。",supportWakeNet9:"您的芯片支持 WakeNet9 模型。",supportWakeNet9s:"您的芯片支持 WakeNet9s 模型。",notSupported:"您的芯片不支持唤醒词功能。",notice:"注意:",unsupportedMessage:"{chipModel} 芯片不支持唤醒词功能。如需使用唤醒词,请选择 ESP32-S3、ESP32-P4 或 ESP32-C3/C5/C6 芯片。",noWakeword:"关闭唤醒",presetWakeword:"预设唤醒词",customWakeword:"自定义唤醒词",selectWakeword:"选择唤醒词",placeholder:"选择唤醒词...",customSettings:"自定义唤醒词设置",wakewordName:"唤醒词名称",wakewordNamePlaceholder:"例如:小智 / Potato",wakewordCommand:"唤醒命令",wakewordCommandPlaceholderCN:"拼音空格隔开,例如:ni hao xiao zhi",wakewordCommandPlaceholderEN:"英文单词,不能包含标点,例如:HELLO POTATO",threshold:"灵敏度阈值 (0-100)",thresholdDesc:"越小越灵敏,默认 20",duration:"识别时长",durationDesc:"命令词最长持续时间",selectModel:"选择识别模型",mn6cn:"MultiNet6 (中文)",mn6en:"MultiNet6 (英文)",mn7cn:"MultiNet7 (中文)",mn7en:"MultiNet7 (英文)",errors:{nameRequired:"请输入唤醒词名称",commandRequired:"请输入唤醒命令",noPunctuation:"命令不能包含标点符号",durationRange:"时长需在 500-10000ms 之间"},tips:{tipLabel:"提示:",optional:"唤醒词是可选的,关闭后设备将无法通过语音唤醒。",wakeNet9sOnly:"C3/C5/C6 芯片仅支持 WakeNet9s 轻量级模型。",wakeNet9Full:"S3/P4 芯片支持完整的 WakeNet9 模型,选择更多。",customSupport:"自定义唤醒词使用 MultiNet 模型实现,目前仅支持 ESP32-S3 芯片。"}},Xh={app:Lh,common:Uh,header:Mh,configNotice:xh,steps:Jh,generateModal:Th,progressSteps:Hh,errors:Yh,flashProgress:_h,device:Kh,chipConfig:Ph,themeDesign:Oh,generateSummary:Vh,backgroundConfig:Wh,emojiConfig:qh,fontConfig:jh,wakewordConfig:Zh},zh={title:"小智 AI 自訂"},$h={cancel:"取消",confirm:"確認",close:"關閉",start:"開始",download:"下載",generate:"生成",reset:"重置",yes:"是",no:"否",loading:"載入中...",error:"錯誤",success:"成功",warning:"警告",info:"資訊",next:"下一步",previous:"上一步",finish:"完成",retry:"重試",ok:"確定",other:"其他"},Af={title:"小智 AI 自訂"},ef={title:"檢測到已儲存的配置",message:"配置已自動恢復,您可以繼續之前的進度或重新開始。",restart:"重新開始"},tf={chip:"晶片配置",theme:"主題設計",generate:"效果預覽"},nf={title:"生成 assets.bin",confirmConfig:"請確認您的配置",chipModel:"晶片型號:",resolution:"解析度:",wakeword:"喚醒詞:",font:"字體:",emoji:"表情包:",fileList:"包含的檔案列表",estimated:"預估",compressed:"壓縮前",generating:"正在生成 assets.bin...",progress:"{progress}% 完成",completed:"您的 assets.bin 檔案已準備就緒",filename:"檔案名: assets.bin",fileSize:"檔案大小: {size}",generationTime:"生成時間: {time}",downloadAssets:"下載 assets.bin",flashToDevice:"線上燒錄到設備",flashing:"正在燒錄到設備...",flashingCancel:"取消燒錄",flashingError:"燒錄錯誤",flashingInProgress:"燒錄中,請勿關閉視窗",customFont:"自訂字體",customEmoji:"自訂表情套件",notConfigured:"未設定",wakewordNames:{wn9s_hilexin:"Hi,樂鑫",wn9s_hiesp:"Hi,ESP",wn9s_nihaoxiaozhi:"你好小智",wn9_nihaoxiaozhi_tts:"你好小智",wn9_alexa:"Alexa"}},of={init:"初始化生成器",font:"處理字體檔案",wakeword:"打包喚醒詞模型",emoji:"處理表情圖片",background:"處理背景圖片",index:"生成索引檔案",spiffs:"建構SPIFFS映射",package:"完成打包"},rf={title:"喚醒詞配置",description:"選擇預設喚醒詞模型或透過命令詞模型自訂喚醒詞。",supportWakeNet9:"您的晶片支援 WakeNet9 模型。",supportWakeNet9s:"您的晶片支援 WakeNet9s 模型。",notSupported:"您的晶片不支援喚醒詞功能。",notice:"注意:",unsupportedMessage:"{chipModel} 晶片不支援喚醒詞功能。如需使用喚醒詞,請選擇 ESP32-S3、ESP32-P4 或 ESP32-C3/C5/C6 晶片。",noWakeword:"關閉喚醒",presetWakeword:"預設喚醒詞",customWakeword:"自訂喚醒詞",selectWakeword:"選擇喚醒詞",placeholder:"選擇喚醒詞...",customSettings:"自訂喚醒詞設定",wakewordName:"喚醒詞名稱",wakewordNamePlaceholder:"例如:小智 / Potato",wakewordCommand:"喚醒命令",wakewordCommandPlaceholderCN:"拼音空格隔開,例如:ni hao xiao zhi",wakewordCommandPlaceholderEN:"英文單詞,不能包含標點,例如:HELLO POTATO",threshold:"靈敏度閾值 (0-100)",thresholdDesc:"越小越靈敏,預設 20",duration:"識別時長",durationDesc:"命令詞最長持續時間",selectModel:"選擇識別模型",mn6cn:"MultiNet6 (中文)",mn6en:"MultiNet6 (英文)",mn7cn:"MultiNet7 (中文)",mn7en:"MultiNet7 (英文)",errors:{nameRequired:"請輸入喚醒詞名稱",commandRequired:"請輸入喚醒命令",noPunctuation:"命令不能包含標點符號",durationRange:"時長需在 500-10000ms 之間"},tips:{tipLabel:"提示:",optional:"喚醒詞是可選的,關閉後裝置將無法透過語音喚醒。",wakeNet9sOnly:"C3/C5/C6 晶片僅支援 WakeNet9s 輕量級模型。",wakeNet9Full:"S3/P4 晶片支援完整的 WakeNet9 模型,選擇更多。",customSupport:"自訂喚醒詞使用 MultiNet 模型實現,目前僅支援 ESP32-S3 晶片。"}},gf={resetFailed:"重置失敗,請重新整理頁面重試",generationFailed:"生成失敗: {error}",noFileToDownload:"沒有可下載的檔案",deviceOffline:"設備離線,無法進行燒錄",fileTooLarge:"燒錄失敗:檔案大小 {fileSize}MB 超過 assets 分區大小 {partitionSize}MB,請減少配置內容或使用更大容量的設備。",flashCancelConfirm:"確定要取消燒錄嗎?",oldDataCleared:`檢測到舊版本的表情資料結構已被清除。 - -新版本使用檔案去重技術,可以節省儲存空間。 - -請重新上傳自訂表情圖片。`,incompatibleEmojiData:"檢測到不相容的表情資料,請重新配置"},sf={authTokenMissing:"未找到認證令牌",checkingDeviceStatus:"檢查設備狀態...",deviceOfflineOrUnresponsive:"設備離線或無響應: {error}",unableToGetDeviceStatus:"無法獲取設備狀態",initializingTransferService:"初始化傳輸服務...",initializeTransferFailed:"初始化傳輸服務失敗: {error}",settingDeviceDownloadUrl:"設置設備下載URL...",setDownloadUrlFailed:"設置下載URL失敗: {error}",rebootingDevice:"重啟設備...",waitingForDeviceReboot:"等待設備重啟...",deviceRebootTimeout:"等待設備重啟超時(60秒)",startingFileTransfer:"開始檔案傳輸...",flashCompleted:"燒錄完成!",onlineFlashFailed:"線上燒錄失敗: {error}"},af={online:"線上",offline:"離線",checking:"檢查中...",flashing:"燒錄中...",ready:"就緒",chip:"晶片",board:"開發板",flash:"Flash",screen:"螢幕",signal:{unknown:"未知",strong:"強",medium:"中等",weak:"弱",none:"無訊號"}},If={title:"步驟 1: 晶片型號和螢幕配置",loadingFromDevice:"正在從設備讀取硬體配置...",loadedFromDevice:"已從設備自動讀取硬體配置",manualConfig:"請手動配置硬體參數",loadingTitle:"正在載入設備配置...",loadingDesc:"從設備讀取晶片型號和螢幕解析度",autoLoadedTitle:"設備配置已自動載入",chipModel:"晶片型號",screenWidth:"螢幕寬度",screenHeight:"螢幕高度",colorFormat:"顏色格式:",manualEdit:"手動修改配置",collapseManual:"收起手動配置",manualConfigTitle:"手動配置硬體參數",next:"下一步",selectChip:"請選擇晶片",chipRequired:"晶片型號",widthRequired:"螢幕寬度",heightRequired:"螢幕高度",loadingError:"載入配置時發生錯誤",deviceOffline:"設備未連接或離線",chipModelError:"無法獲取晶片型號,請手動輸入",resolutionError:"無法獲取螢幕解析度,請手動輸入",timeoutError:"載入設備配置超時,請手動輸入",manualConfigDesc:"無法自動讀取設備配置",manualConfigHint:"設備未連接或離線,請手動輸入硬體配置",manualConfigRequired:"請手動輸入硬體配置",resolutionFormatError:"螢幕解析度格式錯誤"},Cf={title:"步驟 2: 主題設計",description:"配置喚醒詞、字體、表情和背景來自訂您的小智AI主題。",previous:"上一步",next:"下一步",tabs:{wakeword:"喚醒詞配置",font:"字體配置",emoji:"表情集合",background:"聊天背景"}},lf={title:"步驟 3: 效果預覽",description:"預覽您的自訂配置在實際設備上的效果。",devicePreview:"設備預覽 (1:1 像素比例)",previewSettings:"預覽設定",previewText:"預覽文字",defaultPreviewText:"你好,我是你的朋友小智!",currentEmotion:"當前表情",themeMode:"主題模式",lightMode:"淺色",darkMode:"深色",configSummary:"配置摘要",wakeword:"喚醒詞:",font:"字體:",loading:"載入中...",emotion:"表情:",skin:"皮膚:",previous:"上一步",generate:"生成 assets.bin",emotions:{neutral:"預設",happy:"開心",laughing:"大笑",funny:"搞笑",sad:"傷心",angry:"生氣",crying:"哭泣",loving:"喜愛",embarrassed:"尷尬",surprised:"驚訝",shocked:"震驚",thinking:"思考",winking:"眨眼",cool:"酷炫",relaxed:"放鬆",delicious:"美味",kissy:"飛吻",confident:"自信",sleepy:"睏倦",silly:"調皮",confused:"困惑"},noEmotionConfigured:"未配置表情",fontLoading:"字體載入中...",configureEmojiFirst:"請先在主題設計中配置表情包",customFont:"自訂字體 {size}px",customEmoji:"自訂表情 {count}張",notConfigured:"未配置",skinLight:"淺色{type}",skinDark:"深色{type}",hideSubtitle:"隱藏字幕:",image:"圖片",color:"顏色"},Bf={title:"聊天背景配置",description:"配置淺色模式和深色模式的聊天背景,支援純色或自訂圖片。",lightMode:"淺色模式背景",darkMode:"深色模式背景",solidBackground:"純色背景",imageBackground:"圖片背景",backgroundColor:"背景顏色:",textColor:"文字顏色:",backgroundImage:"背景圖片:",clickOrDragToUpload:"點擊或拖拽上傳背景圖片",removeImage:"移除圖片",backgroundPreview:"背景預覽",lightModePreview:"淺色模式",darkModePreview:"深色模式",chatArea:"聊天內容區域",quickConfig:"快捷配置",defaultColors:"預設配色",stoneTexture:"石墨質感",sunnyColors:"暖陽配色",skyBlue:"天空藍調",romanticPink:"浪漫粉色",selectValidImage:"請選擇有效的圖片檔案"},Qf={title:"表情集合配置",description:"選擇預設表情包或自定義表情圖片。每個表情包包含21種不同情緒的表情。",noEmojiPack:"無表情包",noEmojiPackDescription:"不配置表情包,打包時只包含字體和背景資源。",presetEmojiPack:"預設表情包",customEmojiPack:"自定義表情包",selectPresetEmojiPack:"選擇預設表情包",twemoji64:"Twemoji 64×64",twemoji32:"Twemoji 32×32",twemojiDescription:"來自Twitter的高品質表情符號集,適合清晰顯示",twitterEmojiName:"Twemoji {size}x{size}",twitterEmojiDescription:"Twitter表情包,{size}×{size}像素",size:"尺寸",preview:"預覽",select:"選擇",customEmojiTitle:"自定義表情包",customEmojiDescription:"上傳您自己的表情圖片。每種情緒需要一張圖片。",uploadInstructions:"點擊或拖拽上傳表情圖片 (PNG/JPG/WEBP)",supportedFormats:"支援格式: PNG, JPG, WEBP。推薦尺寸: 64×64像素",emotionMapping:"情緒映射",uploadAllEmotions:"請為所有情緒上傳表情圖片",maxImageWidth:"最大圖片寬度 (px)",maxImageHeight:"最大圖片高度 (px)",clickToUpload:"點擊上傳",orDragDrop:"或拖拽上傳",clickToUploadOrDrag:"點擊上傳或拖拽到此處",remove:"移除",replace:"替換",selectValidEmojiImage:"請選擇有效的表情圖片檔案",selectValidFormat:"請選擇有效的PNG或GIF格式圖片",maxFileSize:"檔案大小不能超過1MB",invalidFormat:"不支援的圖片格式。請使用PNG、JPG或WEBP。",required:"必需",uploadEmojiImages:"上傳表情圖片(GIF 需要 PSRAM)",customEmojiPackConfig:"自定義表情包配置",neutralRequiredNotice:"* 必須上傳 neutral 預設表情,其他表情可選。如果不上傳其他表情,將使用預設表情代替。",sharedFileMessage:"表情 {emotionKey} 使用了與 {existingEmotions} 相同的圖片檔案(共享儲存)",fileDeleted:"檔案 {fileHash} 已刪除(無其他表情引用)",fileRetained:"檔案 {fileHash} 仍被其他表情使用,保留檔案",imageLoadFailed:"表情圖片載入失敗",emotions:{neutral:"預設",happy:"開心",laughing:"大笑",funny:"搞笑",sad:"傷心",angry:"生氣",crying:"哭泣",loving:"喜愛",embarrassed:"尷尬",surprised:"驚訝",shocked:"震驚",thinking:"思考",winking:"眨眼",cool:"酷炫",relaxed:"放鬆",delicious:"美味",kissy:"飛吻",confident:"自信",sleepy:"睏倦",silly:"調皮",confused:"困惑"}},cf={title:"字體配置",description:"選擇預設字體或上傳自訂字體檔案。",noFonts:"無字體",noFontsDescription:"不使用字體配置,裝置將使用預設字體",presetFonts:"預設字體",customFonts:"自訂字體",selectPresetFont:"選擇預設字體",fontSize:"字號:",bitDepth:"位元深度:",charset:"字元集:",fileSize:"檔案大小:",customFontConfig:"自訂字體配置",fontFile:"字體檔案",clickSelectFontFile:"點擊選擇字體檔案",orDragFileHere:"或拖拽檔案到此處",supportedFormats:"支援 TTF, WOFF, WOFF2 格式",removeFile:"移除檔案",fontSizePx:"字號 (px)",range:"範圍:",bitDepthBpp:"位元深度 (BPP)",monochrome:"1 bpp (單色)",fourColors:"2 bpp (4色)",sixteenColors:"4 bpp (16色)",characterSet:"字元集",deepseekR1:"DeepSeek R1 (7405字元)",gb2312:"GB2312 (7445字元)",qwen18409:"Qwen (18409字元)",latin1:"Latin1 (190字元)",fullCharset:"完整字元集 (字體檔案的所有字元)",hideSubtitle:"隱藏字幕",hideSubtitleDescription:"對話時不顯示即時文字字幕",selectValidFontFile:"請選擇有效的字體檔案 (TTF, WOFF, WOFF2)",presetFontNames:{font_puhui_deepseek_14_1:"阿里巴巴普惠體 14px",font_puhui_deepseek_16_4:"阿里巴巴普惠體 16px",font_puhui_deepseek_20_4:"阿里巴巴普惠體 20px",font_puhui_deepseek_30_4:"阿里巴巴普惠體 30px",font_noto_qwen_14_1:"思源黑體 14px",font_noto_qwen_16_4:"思源黑體 16px",font_noto_qwen_20_4:"思源黑體 20px",font_noto_qwen_30_4:"思源黑體 30px"},charsetDeepseek:"DeepSeek 7405",charsetQwen:"Qwen 18409"},Ef={app:zh,common:$h,header:Af,configNotice:ef,steps:tf,generateModal:nf,progressSteps:of,wakewordConfig:rf,errors:gf,flashProgress:sf,device:af,chipConfig:If,themeDesign:Cf,generateSummary:lf,backgroundConfig:Bf,emojiConfig:Qf,fontConfig:cf},uf={title:"小智 AI カスタマイズ"},hf={cancel:"キャンセル",confirm:"確認",close:"閉じる",start:"開始",download:"ダウンロード",generate:"生成",reset:"リセット",yes:"はい",no:"いいえ",loading:"読み込み中...",error:"エラー",success:"成功",warning:"警告",info:"情報",next:"次へ",previous:"前へ",finish:"完了",retry:"再試行",ok:"OK",other:"その他"},ff={title:"小智 AI カスタマイズ"},df={title:"保存された設定を検出",message:"設定が自動的に復元されました。中断したところから続行するか、最初からやり直すことができます。",restart:"最初からやり直す"},pf={chip:"チップ設定",theme:"テーマデザイン",generate:"プレビュー&生成"},mf={title:"assets.binを生成",confirmConfig:"設定を確認してください",chipModel:"チップモデル:",resolution:"解像度:",wakeword:"ウェイクワード:",font:"フォント:",emoji:"絵文字パック:",fileList:"含まれるファイル一覧",estimated:"推定",compressed:"圧縮前",generating:"assets.binを生成中...",progress:"{progress}% 完了",completed:"assets.binファイルの準備ができました",filename:"ファイル名: assets.bin",fileSize:"ファイルサイズ: {size}",generationTime:"生成時間: {time}",downloadAssets:"assets.binをダウンロード",flashToDevice:"デバイスにオンライン書き込み",flashing:"デバイスに書き込み中...",flashingCancel:"書き込みをキャンセル",flashingError:"書き込みエラー",flashingInProgress:"書き込み中、ウィンドウを閉じないでください",customFont:"カスタムフォント",customEmoji:"カスタム絵文字パック",notConfigured:"未設定",wakewordNames:{wn9s_hilexin:"Hi, Espressif",wn9s_hiesp:"Hi, ESP",wn9s_nihaoxiaozhi:"こんにちは小智",wn9_nihaoxiaozhi_tts:"こんにちは小智",wn9_alexa:"アレクサ"}},yf={init:"ジェネレーターを初期化",font:"フォントファイルを処理",wakeword:"ウェイクワードモデルをパッケージ化",emoji:"絵文字画像を処理",background:"背景画像を処理",index:"インデックスファイルを生成",spiffs:"SPIFFSマッピングを構築",package:"パッケージ化を完了"},wf={title:"ウェイクワード設定",description:"プリセットのウェイクワードを選択するか、コマンド認識モデルを使用してカスタマイズします。",supportWakeNet9:"チップはWakeNet9モデルをサポートしています。",supportWakeNet9s:"チップはWakeNet9sモデルをサポートしています。",notSupported:"チップはウェイクワード機能をサポートしていません。",notice:"注意:",unsupportedMessage:"{chipModel}チップはウェイクワード機能をサポートしていません。ウェイクワードを使用する必要がある場合は、ESP32-S3、ESP32-P4、またはESP32-C3/C5/C6チップを選択してください。",noWakeword:"起動を無効にする",presetWakeword:"プリセット",customWakeword:"カスタム",selectWakeword:"ウェイクワードを選択",placeholder:"選択してください...",customSettings:"カスタムウェイクワード設定",wakewordName:"ウェイクワード名",wakewordNamePlaceholder:"例:小智 / Potato",wakewordCommand:"ウェイクコマンド",wakewordCommandPlaceholderCN:"ピンインをスペースで区切る。例:ni hao xiao zhi",wakewordCommandPlaceholderEN:"英語の単語。句読点は含めない。例:HELLO POTATO",threshold:"感度しきい値 (0-100)",thresholdDesc:"値が小さいほど感度が高くなります。デフォルトは20",duration:"認識時間",durationDesc:"コマンド認識の最大継続時間",selectModel:"認識モデルを選択",mn6cn:"MultiNet6 (中国語)",mn6en:"MultiNet6 (英語)",mn7cn:"MultiNet7 (中国語)",mn7en:"MultiNet7 (英語)",errors:{nameRequired:"ウェイクワード名を入力してください",commandRequired:"ウェイクコマンドを入力してください",noPunctuation:"コマンドに句読点を含めることはできません",durationRange:"時間は500〜10000msの間で設定してください"},tips:{tipLabel:"ヒント:",optional:"ウェイクワードはオプションです。無効にすると、デバイスは音声で起動できなくなります。",wakeNet9sOnly:"C3/C5/C6チップはWakeNet9s軽量モデルしかサポートしていません。",wakeNet9Full:"S3/P4チップは完全なWakeNet9モデルをサポートし、より多くの選択肢があります。",customSupport:"カスタムウェイクワードはMultiNetモデルを使用しており、現在はESP32-S3チップのみをサポートしています。"}},Df={resetFailed:"リセットに失敗しました、ページを更新して再試行してください",generationFailed:"生成に失敗しました: {error}",noFileToDownload:"ダウンロード可能なファイルがありません",deviceOffline:"デバイスがオフラインで書き込みできません",fileTooLarge:"書き込みに失敗しました: ファイルサイズ{fileSize}MBがassetsパーティションサイズ{partitionSize}MBを超えています。設定内容を減らすか、より大容量のデバイスを使用してください。",flashCancelConfirm:"書き込みをキャンセルしてもよろしいですか?",oldDataCleared:`古いバージョンの絵文字データ構造が検出され、クリアされました。 - -新しいバージョンはファイル重複除去技術を使用してストレージスペースを節約します。 - -カスタム絵文字画像を再アップロードしてください。`,incompatibleEmojiData:"互換性のない絵文字データを検出しました、再設定してください"},kf={authTokenMissing:"認証トークンが見つかりません",checkingDeviceStatus:"デバイスの状態を確認中...",deviceOfflineOrUnresponsive:"デバイスがオフラインまたは応答なし: {error}",unableToGetDeviceStatus:"デバイスの状態を取得できません",initializingTransferService:"転送サービスを初期化中...",initializeTransferFailed:"転送サービスの初期化に失敗しました: {error}",settingDeviceDownloadUrl:"デバイスダウンロードURLを設定中...",setDownloadUrlFailed:"ダウンロードURLの設定に失敗しました: {error}",rebootingDevice:"デバイスを再起動中...",waitingForDeviceReboot:"デバイスの再起動を待機中...",deviceRebootTimeout:"デバイスの再起動タイムアウト(60秒)",startingFileTransfer:"ファイル転送を開始中...",flashCompleted:"書き込み完了!",onlineFlashFailed:"オンライン書き込みに失敗しました: {error}"},vf={online:"オンライン",offline:"オフライン",checking:"確認中...",flashing:"書き込み中...",ready:"準備完了",chip:"チップ",board:"ボード",flash:"Flash",screen:"画面",signal:{unknown:"不明",strong:"強",medium:"中",weak:"弱",none:"信号なし"}},Ff={title:"ステップ1: チップモデルと画面設定",loadingFromDevice:"デバイスからハードウェア設定を読み込み中...",loadedFromDevice:"デバイスからハードウェア設定が自動読み込みされました",manualConfig:"ハードウェアパラメータを手動で設定してください",loadingTitle:"デバイス設定を読み込み中...",loadingDesc:"デバイスからチップモデルと画面解像度を読み取り中",autoLoadedTitle:"デバイス設定が自動読み込みされました",chipModel:"チップモデル",screenWidth:"画面幅",screenHeight:"画面高",colorFormat:"色形式:",manualEdit:"手動設定",collapseManual:"手動設定を折りたたむ",manualConfigTitle:"手動ハードウェア設定",next:"次へ",selectChip:"チップを選択",chipRequired:"チップモデル",widthRequired:"画面幅",heightRequired:"画面高",loadingError:"設定読み込みエラー",deviceOffline:"デバイスが接続されていないかオフラインです",chipModelError:"チップモデルを取得できません、手動で入力してください",resolutionError:"画面解像度を取得できません、手動で入力してください",timeoutError:"設定読み込みタイムアウト、手動で入力してください",manualConfigDesc:"デバイスの設定を自動読み取りできません",manualConfigHint:"デバイスが接続されていないかオフラインです、ハードウェア設定を手動で入力してください",manualConfigRequired:"ハードウェア設定を手動で入力してください",resolutionFormatError:"画面解像度形式エラー"},Sf={title:"ステップ2: テーマデザイン",description:"ウェイクワード、フォント、絵文字、背景を設定して、小智AIテーマをカスタマイズします。",previous:"前へ",next:"次へ",tabs:{wakeword:"ウェイクワード設定",font:"フォント設定",emoji:"絵文字コレクション",background:"チャット背景"}},bf={title:"ステップ3: プレビュー",description:"実際のデバイスでのカスタム設定の効果をプレビューします。",devicePreview:"デバイスプレビュー(1:1ピクセル比)",previewSettings:"プレビュー設定",previewText:"プレビューテキスト",defaultPreviewText:"こんにちは、私はあなたの友人、シャオズーです!",currentEmotion:"現在の感情",themeMode:"テーマモード",lightMode:"ライト",darkMode:"ダーク",configSummary:"設定概要",wakeword:"ウェイクワード:",font:"フォント:",loading:"読み込み中...",emotion:"感情:",skin:"スキン:",previous:"前へ",generate:"assets.binを生成",emotions:{neutral:"中立",happy:"幸せ",laughing:"大笑い",funny:"面白い",sad:"悲しい",angry:"怒り",crying:"泣き",loving:"愛情",embarrassed:"恥ずかしい",surprised:"驚き",shocked:"ショック",thinking:"考え中",winking:"ウインク",cool:"クール",relaxed:"リラックス",delicious:"美味しい",kissy:"キス",confident:"自信",sleepy:"眠い",silly:"ばかげた",confused:"混乱"},noEmotionConfigured:"感情が設定されていません",fontLoading:"フォント読み込み中...",configureEmojiFirst:"テーマデザインで絵文字パックを設定してください",customFont:"カスタムフォント {size}px",customEmoji:"カスタム絵文字 {count}画像",notConfigured:"未設定",skinLight:"ライト{type}",skinDark:"ダーク{type}",hideSubtitle:"字幕を隠す:",image:"画像",color:"色"},Rf={title:"チャット背景設定",description:"ライトモードとダークモードのチャット背景を設定し、単色またはカスタム画像をサポートします。",lightMode:"ライトモード背景",darkMode:"ダークモード背景",solidBackground:"単色背景",imageBackground:"画像背景",backgroundColor:"背景色:",textColor:"文字色:",backgroundImage:"背景画像:",clickOrDragToUpload:"クリックまたはドラッグして背景画像をアップロード",removeImage:"画像を削除",backgroundPreview:"背景プレビュー",lightModePreview:"ライトモード",darkModePreview:"ダークモード",chatArea:"チャットコンテンツエリア",quickConfig:"クイック設定",defaultColors:"デフォルト色",stoneTexture:"石質感",sunnyColors:"晴れ色",skyBlue:"空色",romanticPink:"ロマンチックピンク",selectValidImage:"有効な画像ファイルを選択してください"},Nf={title:"絵文字コレクション設定",description:"プリセット絵文字パックを選択するか、カスタム絵文字画像をアップロードします。各絵文字パックには21種類の異なる感情表現が含まれます。",noEmojiPack:"絵文字パックなし",noEmojiPackDescription:"絵文字パックを設定せず、パッケージにはフォントと背景リソースのみを含めます。",presetEmojiPack:"プリセット絵文字パック",customEmojiPack:"カスタム絵文字パック",selectPresetEmojiPack:"プリセット絵文字パックを選択",twemoji64:"Twemoji 64×64",twemoji32:"Twemoji 32×32",twemojiDescription:"Twitterの高品質絵文字セット、鮮明な表示に最適",twitterEmojiName:"Twemoji {size}x{size}",twitterEmojiDescription:"Twitter絵文字パック、{size}×{size}ピクセル",size:"サイズ",preview:"プレビュー",select:"選択",customEmojiTitle:"カスタム絵文字パック",customEmojiDescription:"独自の絵文字画像をアップロードします。各感情に1つの画像が必要です。",uploadInstructions:"クリックまたはドラッグして絵文字画像をアップロード(PNG/JPG/WEBP)",supportedFormats:"サポート形式: PNG, JPG, WEBP。推奨サイズ: 64×64ピクセル",emotionMapping:"感情マッピング",uploadAllEmotions:"すべての感情の絵文字画像をアップロードしてください",maxImageWidth:"最大画像幅(px)",maxImageHeight:"最大画像高(px)",clickToUpload:"クリックしてアップロード",orDragDrop:"またはドラッグ&ドロップ",clickToUploadOrDrag:"クリックしてアップロードまたはここにドラッグ",remove:"削除",replace:"置き換え",selectValidEmojiImage:"有効な絵文字画像ファイルを選択してください",selectValidFormat:"有効なPNGまたはGIF形式の画像を選択してください",maxFileSize:"ファイルサイズは1MBを超えないでください",invalidFormat:"サポートされていない画像形式です。PNG、JPG、またはWEBPを使用してください。",required:"必須",uploadEmojiImages:"絵文字画像をアップロード(GIFにはPSRAMが必要)",customEmojiPackConfig:"カスタム絵文字パック設定",neutralRequiredNotice:"* 中立のデフォルト感情をアップロードする必要があります、他の感情はオプションです。アップロードしない場合、デフォルト感情が代わりに使用されます。",sharedFileMessage:"感情{emotionKey}は{existingEmotions}と同じ画像ファイルを使用しています(共有ストレージ)",fileDeleted:"ファイル{fileHash}が削除されました(他の感情参照なし)",fileRetained:"ファイル{fileHash}は他の感情でまだ使用されているため、保持されます",imageLoadFailed:"絵文字画像の読み込みに失敗しました",emotions:{neutral:"中立",happy:"幸せ",laughing:"大笑い",funny:"面白い",sad:"悲しい",angry:"怒り",crying:"泣き",loving:"愛情",embarrassed:"恥ずかしい",surprised:"驚き",shocked:"ショック",thinking:"考え中",winking:"ウインク",cool:"クール",relaxed:"リラックス",delicious:"美味しい",kissy:"キス",confident:"自信",sleepy:"眠い",silly:"ばかげた",confused:"混乱"}},Gf={title:"フォント設定",description:"プリセットフォントを選択するか、カスタムフォントファイルをアップロードします。",noFonts:"フォントなし",noFontsDescription:"フォント設定を使用しない、デバイスはデフォルトのフォントを使用します",presetFonts:"プリセットフォント",customFonts:"カスタムフォント",selectPresetFont:"プリセットフォントを選択",fontSize:"フォントサイズ:",bitDepth:"ビット深度:",charset:"文字セット:",fileSize:"ファイルサイズ:",customFontConfig:"カスタムフォント設定",fontFile:"フォントファイル",clickSelectFontFile:"クリックしてフォントファイルを選択",orDragFileHere:"またはファイルをここにドラッグ",supportedFormats:"TTF、WOFF、WOFF2形式をサポート",removeFile:"ファイルを削除",fontSizePx:"フォントサイズ(px)",range:"範囲:",bitDepthBpp:"ビット深度(BPP)",monochrome:"1 bpp(モノクロ)",fourColors:"2 bpp(4色)",sixteenColors:"4 bpp(16色)",characterSet:"文字セット",deepseekR1:"DeepSeek R1(7405文字)",gb2312:"GB2312(7445文字)",qwen18409:"Qwen(18409文字)",latin1:"Latin1(190文字)",fullCharset:"完全な文字セット(フォントファイルのすべての文字)",hideSubtitle:"字幕を隠す",hideSubtitleDescription:"会話中にリアルタイム字幕を表示しない",selectValidFontFile:"有効なフォントファイルを選択してください(TTF、WOFF、WOFF2)",presetFontNames:{font_puhui_deepseek_14_1:"Alibaba PuHuiTi 14px",font_puhui_deepseek_16_4:"Alibaba PuHuiTi 16px",font_puhui_deepseek_20_4:"Alibaba PuHuiTi 20px",font_puhui_deepseek_30_4:"Alibaba PuHuiTi 30px",font_noto_qwen_14_1:"Noto Sans 14px",font_noto_qwen_16_4:"Noto Sans 16px",font_noto_qwen_20_4:"Noto Sans 20px",font_noto_qwen_30_4:"Noto Sans 30px"},charsetDeepseek:"DeepSeek 7405",charsetQwen:"Qwen 18409"},Lf={app:uf,common:hf,header:ff,configNotice:df,steps:pf,generateModal:mf,progressSteps:yf,wakewordConfig:wf,errors:Df,flashProgress:kf,device:vf,chipConfig:Ff,themeDesign:Sf,generateSummary:bf,backgroundConfig:Rf,emojiConfig:Nf,fontConfig:Gf},Uf={title:"Xiaozhi AI Tùy chỉnh"},Mf={cancel:"Hủy",confirm:"Xác nhận",close:"Đóng",start:"Bắt đầu",download:"Tải xuống",generate:"Tạo",reset:"Đặt lại",yes:"Có",no:"Không",loading:"Đang tải...",error:"Lỗi",success:"Thành công",warning:"Cảnh báo",info:"Thông tin",next:"Tiếp theo",previous:"Trước đó",finish:"Hoàn thành",retry:"Thử lại",ok:"OK",other:"Khác"},xf={title:"Xiaozhi AI Tùy chỉnh"},Jf={title:"Phát hiện cấu hình đã lưu",message:"Cấu hình đã được khôi phục tự động. Bạn có thể tiếp tục từ nơi đã dừng hoặc bắt đầu lại.",restart:"Bắt đầu lại"},Tf={chip:"Cấu hình chip",theme:"Thiết kế chủ đề",generate:"Xem trước & Tạo"},Hf={title:"Tạo assets.bin",confirmConfig:"Vui lòng xác nhận cấu hình của bạn",chipModel:"Mô hình chip:",resolution:"Độ phân giải:",wakeword:"Từ đánh thức:",font:"Phông chữ:",emoji:"Gói biểu tượng cảm xúc:",fileList:"Danh sách tệp được bao gồm",estimated:"Ước tính",compressed:"Trước khi nén",generating:"Đang tạo assets.bin...",progress:"{progress}% Hoàn thành",completed:"Tệp assets.bin của bạn đã sẵn sàng",filename:"Tên tệp: assets.bin",fileSize:"Kích thước tệp: {size}",generationTime:"Thời gian tạo: {time}",downloadAssets:"Tải xuống assets.bin",flashToDevice:"Flash trực tuyến vào thiết bị",flashing:"Đang flash vào thiết bị...",flashingCancel:"Hủy flash",flashingError:"Lỗi flash",flashingInProgress:"Đang flash, vui lòng không đóng cửa sổ",customFont:"Phông chữ tùy chỉnh",customEmoji:"Gói biểu tượng cảm xúc tùy chỉnh",notConfigured:"Chưa cấu hình",wakewordNames:{wn9s_hilexin:"Hi, Espressif",wn9s_hiesp:"Hi, ESP",wn9s_nihaoxiaozhi:"Xin chào Xiaozhi",wn9_nihaoxiaozhi_tts:"Xin chào Xiaozhi",wn9_alexa:"Alexa"}},Yf={init:"Khởi tạo trình tạo",font:"Xử lý tệp phông chữ",wakeword:"Đóng gói mô hình từ đánh thức",emoji:"Xử lý hình ảnh biểu tượng cảm xúc",background:"Xử lý hình ảnh nền",index:"Tạo tệp chỉ mục",spiffs:"Xây dựng ánh xạ SPIFFS",package:"Hoàn thành đóng gói"},_f={title:"Cấu hình từ đánh thức",description:"Chọn mô hình từ đánh thức đặt sẵn hoặc tùy chỉnh thông qua mô hình lệnh.",supportWakeNet9:"Chip của bạn hỗ trợ mô hình WakeNet9.",supportWakeNet9s:"Chip của bạn hỗ trợ mô hình WakeNet9s.",notSupported:"Chip của bạn không hỗ trợ chức năng từ đánh thức.",notice:"Lưu ý:",unsupportedMessage:"Chip {chipModel} không hỗ trợ chức năng từ đánh thức. Nếu bạn cần sử dụng từ đánh thức, vui lòng chọn chip ESP32-S3, ESP32-P4 hoặc ESP32-C3/C5/C6.",noWakeword:"Tắt đánh thức",presetWakeword:"Mặc định",customWakeword:"Tùy chỉnh",selectWakeword:"Chọn từ đánh thức",placeholder:"Chọn một từ...",customSettings:"Cài đặt từ đánh thức tùy chỉnh",wakewordName:"Tên từ đánh thức",wakewordNamePlaceholder:"VD: Xiaozhi / Potato",wakewordCommand:"Lệnh đánh thức",wakewordCommandPlaceholderCN:"Pinyin cách nhau bằng dấu cách, VD: ni hao xiao zhi",wakewordCommandPlaceholderEN:"Từ tiếng Anh, không dấu câu, VD: HELLO POTATO",threshold:"Ngưỡng nhạy (0-100)",thresholdDesc:"Càng nhỏ càng nhạy, mặc định là 20",duration:"Thời gian nhận diện",durationDesc:"Thời gian tối đa để nhận diện lệnh",selectModel:"Chọn mô hình nhận diện",mn6cn:"MultiNet6 (Tiếng Trung)",mn6en:"MultiNet6 (Tiếng Anh)",mn7cn:"MultiNet7 (Tiếng Trung)",mn7en:"MultiNet7 (Tiếng Anh)",errors:{nameRequired:"Vui lòng nhập tên từ đánh thức",commandRequired:"Vui lòng nhập lệnh đánh thức",noPunctuation:"Lệnh không thể chứa dấu câu",durationRange:"Thời gian phải từ 500-10000ms"},tips:{tipLabel:"Mẹo:",optional:"Từ đánh thức là tùy chọn. Nếu tắt, thiết bị sẽ không thể đánh thức bằng giọng nói.",wakeNet9sOnly:"Chip C3/C5/C6 chỉ hỗ trợ mô hình nhẹ WakeNet9s.",wakeNet9Full:"Chip S3/P4 hỗ trợ mô hình WakeNet9 hoàn chỉnh với nhiều lựa chọn hơn.",customSupport:"Từ đánh thức tùy chỉnh sử dụng mô hình MultiNet, hiện chỉ hỗ trợ chip ESP32-S3."}},Kf={resetFailed:"Đặt lại thất bại, vui lòng làm mới trang và thử lại",generationFailed:"Tạo thất bại: {error}",noFileToDownload:"Không có tệp nào để tải xuống",deviceOffline:"Thiết bị ngoại tuyến và không thể flash",fileTooLarge:"Flash thất bại: Kích thước tệp {fileSize}MB vượt quá kích thước phân vùng assets {partitionSize}MB. Vui lòng giảm nội dung cấu hình hoặc sử dụng thiết bị có dung lượng lớn hơn.",flashCancelConfirm:"Bạn có chắc chắn muốn hủy flash?",oldDataCleared:`Đã phát hiện và xóa cấu trúc dữ liệu biểu tượng cảm xúc phiên bản cũ. - -Phiên bản mới sử dụng công nghệ loại bỏ trùng lặp tệp để tiết kiệm không gian lưu trữ. - -Vui lòng tải lại hình ảnh biểu tượng cảm xúc tùy chỉnh.`,incompatibleEmojiData:"Phát hiện dữ liệu biểu tượng cảm xúc không tương thích, vui lòng cấu hình lại"},Pf={authTokenMissing:"Không tìm thấy mã thông báo xác thực",checkingDeviceStatus:"Đang kiểm tra trạng thái thiết bị...",deviceOfflineOrUnresponsive:"Thiết bị ngoại tuyến hoặc không phản hồi: {error}",unableToGetDeviceStatus:"Không thể lấy trạng thái thiết bị",initializingTransferService:"Đang khởi tạo dịch vụ truyền tải...",initializeTransferFailed:"Khởi tạo dịch vụ truyền tải thất bại: {error}",settingDeviceDownloadUrl:"Đang thiết lập URL tải xuống thiết bị...",setDownloadUrlFailed:"Thiết lập URL tải xuống thất bại: {error}",rebootingDevice:"Đang khởi động lại thiết bị...",waitingForDeviceReboot:"Đang chờ thiết bị khởi động lại...",deviceRebootTimeout:"Hết thời gian chờ thiết bị khởi động lại (60 giây)",startingFileTransfer:"Đang bắt đầu truyền tải tệp...",flashCompleted:"Flash hoàn thành!",onlineFlashFailed:"Flash trực tuyến thất bại: {error}"},Of={online:"Trực tuyến",offline:"Ngoại tuyến",checking:"Đang kiểm tra...",flashing:"Đang flash...",ready:"Sẵn sàng",chip:"Chip",board:"Bo mạch",flash:"Flash",screen:"Màn hình",signal:{unknown:"Không xác định",strong:"Mạnh",medium:"Trung bình",weak:"Yếu",none:"Không có tín hiệu"}},Vf={title:"Bước 1: Cấu hình mô hình chip và màn hình",loadingFromDevice:"Đang tải cấu hình phần cứng từ thiết bị...",loadedFromDevice:"Cấu hình phần cứng được tải tự động từ thiết bị",manualConfig:"Vui lòng cấu hình các thông số phần cứng theo cách thủ công",loadingTitle:"Đang tải cấu hình thiết bị...",loadingDesc:"Đang đọc mô hình chip và độ phân giải màn hình từ thiết bị",autoLoadedTitle:"Cấu hình thiết bị được tải tự động",chipModel:"Mô hình chip",screenWidth:"Chiều rộng màn hình",screenHeight:"Chiều cao màn hình",colorFormat:"Định dạng màu:",manualEdit:"Cấu hình thủ công",collapseManual:"Thu gọn cấu hình thủ công",manualConfigTitle:"Cấu hình phần cứng thủ công",next:"Tiếp theo",selectChip:"Chọn chip",chipRequired:"Mô hình chip",widthRequired:"Chiều rộng màn hình",heightRequired:"Chiều cao màn hình",loadingError:"Lỗi tải cấu hình",deviceOffline:"Thiết bị chưa kết nối hoặc ngoại tuyến",chipModelError:"Không thể lấy mô hình chip, vui lòng nhập thủ công",resolutionError:"Không thể lấy độ phân giải màn hình, vui lòng nhập thủ công",timeoutError:"Hết thời gian tải cấu hình, vui lòng nhập thủ công",manualConfigDesc:"Không thể tự động đọc cấu hình thiết bị",manualConfigHint:"Thiết bị chưa kết nối hoặc ngoại tuyến, vui lòng nhập cấu hình phần cứng thủ công",manualConfigRequired:"Vui lòng nhập cấu hình phần cứng thủ công",resolutionFormatError:"Lỗi định dạng độ phân giải màn hình"},Wf={title:"Bước 2: Thiết kế chủ đề",description:"Cấu hình từ đánh thức, phông chữ, biểu tượng cảm xúc và nền để tùy chỉnh chủ đề Xiaozhi AI của bạn.",previous:"Trước đó",next:"Tiếp theo",tabs:{wakeword:"Cấu hình từ đánh thức",font:"Cấu hình phông chữ",emoji:"Bộ sưu tập biểu tượng cảm xúc",background:"Nền trò chuyện"}},qf={title:"Bước 3: Xem trước",description:"Xem trước hiệu ứng của cấu hình tùy chỉnh trên thiết bị thực tế.",devicePreview:"Xem trước thiết bị (tỷ lệ pixel 1:1)",previewSettings:"Cài đặt xem trước",previewText:"Văn bản xem trước",defaultPreviewText:"Xin chào, tôi là bạn của bạn Xiaozhi!",currentEmotion:"Cảm xúc hiện tại",themeMode:"Chế độ chủ đề",lightMode:"Sáng",darkMode:"Tối",configSummary:"Tóm tắt cấu hình",wakeword:"Từ đánh thức:",font:"Phông chữ:",loading:"Đang tải...",emotion:"Cảm xúc:",skin:"Da:",previous:"Trước đó",generate:"Tạo assets.bin",emotions:{neutral:"Trung lập",happy:"Vui vẻ",laughing:"Cười lớn",funny:"Hài hước",sad:"Buồn",angry:"Giận dữ",crying:"Khóc",loving:"Yêu thương",embarrassed:"Xấu hổ",surprised:"Bất ngờ",shocked:"Sốc",thinking:"Suy nghĩ",winking:"Nháy mắt",cool:"Ngầu",relaxed:"Thoải mái",delicious:"Ngon miệng",kissy:"Hôn",confident:"Tự tin",sleepy:"Buồn ngủ",silly:"Ngớ ngẩn",confused:"Bối rối"},noEmotionConfigured:"Chưa cấu hình cảm xúc",fontLoading:"Đang tải phông chữ...",configureEmojiFirst:"Vui lòng cấu hình gói biểu tượng cảm xúc trong thiết kế chủ đề trước",customFont:"Phông chữ tùy chỉnh {size}px",customEmoji:"Biểu tượng cảm xúc tùy chỉnh {count} hình ảnh",notConfigured:"Chưa cấu hình",skinLight:"Sáng {type}",skinDark:"Tối {type}",hideSubtitle:"Ẩn phụ đề:",image:"Hình ảnh",color:"Màu sắc"},jf={title:"Cấu hình nền trò chuyện",description:"Cấu hình nền trò chuyện cho chế độ sáng và tối, hỗ trợ màu đơn hoặc hình ảnh tùy chỉnh.",lightMode:"Nền chế độ sáng",darkMode:"Nền chế độ tối",solidBackground:"Nền màu đơn",imageBackground:"Nền hình ảnh",backgroundColor:"Màu nền:",textColor:"Màu chữ:",backgroundImage:"Hình ảnh nền:",clickOrDragToUpload:"Nhấp hoặc kéo để tải lên hình ảnh nền",removeImage:"Xóa hình ảnh",backgroundPreview:"Xem trước nền",lightModePreview:"Chế độ sáng",darkModePreview:"Chế độ tối",chatArea:"Khu vực nội dung trò chuyện",quickConfig:"Cấu hình nhanh",defaultColors:"Màu mặc định",stoneTexture:"Kết cấu đá",sunnyColors:"Màu nắng",skyBlue:"Xanh trời",romanticPink:"Hồng lãng mạn",selectValidImage:"Vui lòng chọn tệp hình ảnh hợp lệ"},Zf={title:"Cấu hình bộ sưu tập biểu tượng cảm xúc",description:"Chọn gói biểu tượng cảm xúc đặt sẵn hoặc hình ảnh biểu tượng cảm xúc tùy chỉnh. Mỗi gói biểu tượng cảm xúc chứa 21 biểu cảm cảm xúc khác nhau.",noEmojiPack:"Không có gói biểu tượng cảm xúc",noEmojiPackDescription:"Không cấu hình gói biểu tượng cảm xúc, chỉ bao gồm phông chữ và tài nguyên nền trong gói.",presetEmojiPack:"Gói biểu tượng cảm xúc đặt sẵn",customEmojiPack:"Gói biểu tượng cảm xúc tùy chỉnh",selectPresetEmojiPack:"Chọn gói biểu tượng cảm xúc đặt sẵn",twemoji64:"Twemoji 64×64",twemoji32:"Twemoji 32×32",twemojiDescription:"Bộ biểu tượng cảm xúc chất lượng cao từ Twitter, hoàn hảo để hiển thị rõ ràng",twitterEmojiName:"Twemoji {size}x{size}",twitterEmojiDescription:"Gói biểu tượng cảm xúc Twitter, {size}×{size} pixel",size:"Kích thước",preview:"Xem trước",select:"Chọn",customEmojiTitle:"Gói biểu tượng cảm xúc tùy chỉnh",customEmojiDescription:"Tải lên hình ảnh biểu tượng cảm xúc của riêng bạn. Mỗi cảm xúc cần một hình ảnh.",uploadInstructions:"Nhấp hoặc kéo để tải lên hình ảnh biểu tượng cảm xúc (PNG/JPG/WEBP)",supportedFormats:"Định dạng được hỗ trợ: PNG, JPG, WEBP. Kích thước khuyến nghị: 64×64 pixel",emotionMapping:"Ánh xạ cảm xúc",uploadAllEmotions:"Vui lòng tải lên hình ảnh biểu tượng cảm xúc cho tất cả cảm xúc",maxImageWidth:"Chiều rộng hình ảnh tối đa (px)",maxImageHeight:"Chiều cao hình ảnh tối đa (px)",clickToUpload:"Nhấp để tải lên",orDragDrop:"hoặc kéo và thả",clickToUploadOrDrag:"Nhấp để tải lên hoặc kéo vào đây",remove:"Xóa",replace:"Thay thế",selectValidEmojiImage:"Vui lòng chọn tệp hình ảnh biểu tượng cảm xúc hợp lệ",selectValidFormat:"Vui lòng chọn hình ảnh định dạng PNG hoặc GIF hợp lệ",maxFileSize:"Kích thước tệp không được vượt quá 1MB",invalidFormat:"Định dạng hình ảnh không được hỗ trợ. Vui lòng sử dụng PNG, JPG hoặc WEBP.",required:"Bắt buộc",uploadEmojiImages:"Tải lên hình ảnh biểu tượng cảm xúc (GIF cần PSRAM)",customEmojiPackConfig:"Cấu hình gói biểu tượng cảm xúc tùy chỉnh",neutralRequiredNotice:"* Phải tải lên cảm xúc mặc định trung lập, các cảm xúc khác là tùy chọn. Nếu không tải lên, cảm xúc mặc định sẽ được sử dụng thay thế.",sharedFileMessage:"Cảm xúc {emotionKey} sử dụng cùng tệp hình ảnh với {existingEmotions} (lưu trữ chia sẻ)",fileDeleted:"Tệp {fileHash} đã bị xóa (không có tham chiếu cảm xúc khác)",fileRetained:"Tệp {fileHash} vẫn được sử dụng bởi các cảm xúc khác, được giữ lại",imageLoadFailed:"Không tải được hình ảnh biểu tượng cảm xúc",emotions:{neutral:"Trung lập",happy:"Vui vẻ",laughing:"Cười lớn",funny:"Hài hước",sad:"Buồn",angry:"Giận dữ",crying:"Khóc",loving:"Yêu thương",embarrassed:"Xấu hổ",surprised:"Bất ngờ",shocked:"Sốc",thinking:"Suy nghĩ",winking:"Nháy mắt",cool:"Ngầu",relaxed:"Thoải mái",delicious:"Ngon miệng",kissy:"Hôn",confident:"Tự tin",sleepy:"Buồn ngủ",silly:"Ngớ ngẩn",confused:"Bối rối"}},Xf={title:"Cấu hình phông chữ",description:"Chọn phông chữ đặt sẵn hoặc tải lên tệp phông chữ tùy chỉnh.",noFonts:"Không có phông chữ",noFontsDescription:"Không sử dụng cấu hình phông chữ, thiết bị sẽ sử dụng phông chữ mặc định",presetFonts:"Phông chữ đặt sẵn",customFonts:"Phông chữ tùy chỉnh",selectPresetFont:"Chọn phông chữ đặt sẵn",fontSize:"Kích thước phông chữ:",bitDepth:"Độ sâu bit:",charset:"Bộ ký tự:",fileSize:"Kích thước tệp:",customFontConfig:"Cấu hình phông chữ tùy chỉnh",fontFile:"Tệp phông chữ",clickSelectFontFile:"Nhấp để chọn tệp phông chữ",orDragFileHere:"hoặc kéo tệp vào đây",supportedFormats:"Hỗ trợ định dạng TTF, WOFF, WOFF2",removeFile:"Xóa tệp",fontSizePx:"Kích thước phông chữ (px)",range:"Phạm vi:",bitDepthBpp:"Độ sâu bit (BPP)",monochrome:"1 bpp (Đơn sắc)",fourColors:"2 bpp (4 màu)",sixteenColors:"4 bpp (16 màu)",characterSet:"Bộ ký tự",deepseekR1:"DeepSeek R1 (7405 ký tự)",gb2312:"GB2312 (7445 ký tự)",qwen18409:"Qwen (18409 ký tự)",latin1:"Latin1 (190 ký tự)",fullCharset:"Bộ ký tự đầy đủ (Tất cả ký tự trong tệp phông chữ)",hideSubtitle:"Ẩn phụ đề",hideSubtitleDescription:"Không hiển thị phụ đề văn bản trong khi trò chuyện",selectValidFontFile:"Vui lòng chọn tệp phông chữ hợp lệ (TTF, WOFF, WOFF2)",presetFontNames:{font_puhui_deepseek_14_1:"Alibaba PuHuiTi 14px",font_puhui_deepseek_16_4:"Alibaba PuHuiTi 16px",font_puhui_deepseek_20_4:"Alibaba PuHuiTi 20px",font_puhui_deepseek_30_4:"Alibaba PuHuiTi 30px",font_noto_qwen_14_1:"Noto Sans 14px",font_noto_qwen_16_4:"Noto Sans 16px",font_noto_qwen_20_4:"Noto Sans 20px",font_noto_qwen_30_4:"Noto Sans 30px"},charsetDeepseek:"DeepSeek 7405",charsetQwen:"Qwen 18409"},zf={app:Uf,common:Mf,header:xf,configNotice:Jf,steps:Tf,generateModal:Hf,progressSteps:Yf,wakewordConfig:_f,errors:Kf,flashProgress:Pf,device:Of,chipConfig:Vf,themeDesign:Wf,generateSummary:qf,backgroundConfig:jf,emojiConfig:Zf,fontConfig:Xf},$f={en:Gh,"zh-CN":Xh,"zh-TW":Ef,ja:Lf,vi:zf},Rn=[{code:"en",name:"English",flag:"🇺🇸"},{code:"zh-CN",name:"简体中文",flag:"🇨🇳"},{code:"zh-TW",name:"繁體中文",flag:"🇹🇼"},{code:"ja",name:"日本語",flag:"🇯🇵"},{code:"vi",name:"Tiếng Việt",flag:"🇻🇳"}];function Ad(){const A=navigator.language||navigator.userLanguage;return{"zh-CN":"zh-CN","zh-TW":"zh-TW","zh-HK":"zh-TW",zh:"zh-CN",ja:"ja",vi:"vi",en:"en","en-US":"en","en-GB":"en"}[A]||"en"}const ed={class:"relative"},td={class:"py-1"},id=["onClick"],nd={class:"mr-3"},od={key:0,class:"ml-auto w-4 h-4 text-blue-600",fill:"currentColor",viewBox:"0 0 20 20"},rd={__name:"LanguageSelector",setup(A){const{locale:e}=ve(),t=EA(!1),i=hA(()=>Rn.find(s=>s.code===e.value)||Rn[0]),n=()=>{t.value=!t.value},o=()=>{t.value=!1},r=s=>{e.value=s,localStorage.setItem("user-language",s),o()},g=s=>{s.target.closest(".relative")||o()};return Ft(()=>{document.addEventListener("click",g);const s=localStorage.getItem("user-language");s&&Rn.find(a=>a.code===s)&&(e.value=s)}),Ci(()=>{document.removeEventListener("click",g)}),(s,a)=>(H(),_("div",ed,[B("button",{onClick:n,class:"flex items-center space-x-2 px-3 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"},[B("span",null,v(i.value.flag),1),B("span",null,v(i.value.name),1),(H(),_("svg",{class:kA(["w-4 h-4 transition-transform duration-200",{"rotate-180":t.value}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...a[1]||(a[1]=[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)])],2))]),t.value?(H(),_("div",{key:0,class:"absolute right-0 mt-2 w-48 bg-white border border-gray-200 rounded-md shadow-lg z-50",onClick:a[0]||(a[0]=dt(()=>{},["stop"]))},[B("div",td,[(H(!0),_(jA,null,Ke(QA(Rn),I=>(H(),_("button",{key:I.code,onClick:l=>r(I.code),class:kA(["flex items-center w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100",{"bg-blue-50 text-blue-700":I.code===i.value.code}])},[B("span",nd,v(I.flag),1),B("span",null,v(I.name),1),I.code===i.value.code?(H(),_("svg",od,[...a[2]||(a[2]=[B("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"},null,-1)])])):sA("",!0)],10,id))),128))])])):sA("",!0),t.value?(H(),_("div",{key:1,class:"fixed inset-0 z-40",onClick:o})):sA("",!0)]))}},gd={class:"space-y-6"},sd={class:"text-xl font-semibold text-gray-900 mb-4"},ad={class:"text-gray-600 mb-6"},Id={key:0},Cd={key:1},ld={key:2},Bd={key:0,class:"space-y-4"},Qd={class:"bg-blue-50 border-2 border-blue-200 rounded-lg p-6"},cd={class:"flex items-center justify-center space-x-3"},Ed={class:"text-lg font-medium text-blue-900"},ud={class:"text-sm text-blue-700 mt-1"},hd={key:1,class:"space-y-4"},fd={class:"bg-green-50 border-2 border-green-200 rounded-lg p-4"},dd={class:"flex items-start justify-between mb-3"},pd={class:"flex items-center"},md={class:"text-lg font-medium text-green-900"},yd={class:"grid grid-cols-1 md:grid-cols-3 gap-4 mt-4"},wd={class:"bg-white rounded-lg p-3"},Dd={class:"block text-sm font-medium text-gray-700 mb-1"},kd={class:"text-base font-semibold text-gray-900"},vd={class:"bg-white rounded-lg p-3"},Fd={class:"block text-sm font-medium text-gray-700 mb-1"},Sd={class:"text-base font-semibold text-gray-900"},bd={class:"bg-white rounded-lg p-3"},Rd={class:"block text-sm font-medium text-gray-700 mb-1"},Nd={class:"text-base font-semibold text-gray-900"},Gd={class:"mt-3 text-sm text-green-700"},Ld={class:"border border-gray-200 rounded-lg p-4"},Ud={key:0,class:"mt-4"},Md={key:2,class:"space-y-4"},xd={class:"bg-yellow-50 border border-yellow-200 rounded-lg p-4"},Jd={class:"flex items-start"},Td={class:"font-medium text-yellow-900"},Hd={class:"text-sm text-yellow-700 mt-1"},Yd={class:"border-2 border-gray-300 rounded-lg p-4"},_d={class:"text-lg font-medium text-gray-900 mb-4"},Kd={class:"flex justify-end"},Pd=["disabled"],Od={__name:"ChipConfig",props:{modelValue:{type:Object,default:()=>({model:"",display:{width:320,height:240,color:"RGB565"}})}},emits:["update:modelValue","next"],setup(A,{emit:e}){const{t}=ve(),i=e,n=hA(()=>[{value:"",label:t("chipConfig.selectChip")},{value:"esp32s3",label:"ESP32-S3"},{value:"esp32c3",label:"ESP32-C3"},{value:"esp32c5",label:"ESP32-C5"},{value:"esp32c6",label:"ESP32-C6"},{value:"esp32p4",label:"ESP32-P4"},{value:"esp32",label:"ESP32"},{value:"others",label:t("common.other")}]),o={name:"ConfigForm",props:{config:{type:Object,required:!0},showRequired:{type:Boolean,default:!1}},render(){const w=this.$t;return GA("div",{class:"grid grid-cols-1 md:grid-cols-3 gap-4"},[GA("div",[GA("label",{class:"block text-sm font-medium text-gray-700 mb-2"},[w("chipConfig.chipRequired")+" ",this.showRequired&&GA("span",{class:"text-red-500"},"*")]),GA("select",{class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500",value:this.config.model,onChange:F=>{this.config.model=F.target.value}},QA(n).map(F=>GA("option",{value:F.value,key:F.value},F.label)))]),GA("div",[GA("label",{class:"block text-sm font-medium text-gray-700 mb-2"},[w("chipConfig.widthRequired")+" ",this.showRequired&&GA("span",{class:"text-red-500"},"*")]),GA("input",{type:"number",class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500",value:this.config.display.width,min:128,max:800,placeholder:"320",onInput:F=>{this.config.display.width=Number(F.target.value)}})]),GA("div",[GA("label",{class:"block text-sm font-medium text-gray-700 mb-2"},[w("chipConfig.heightRequired")+" ",this.showRequired&&GA("span",{class:"text-red-500"},"*")]),GA("input",{type:"number",class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500",value:this.config.display.height,min:128,max:600,placeholder:"240",onInput:F=>{this.config.display.height=Number(F.target.value)}})])])}},{deviceInfo:r,isDeviceOnline:g,hasToken:s}=No(),a=EA(s.value),I=EA(!1),l=EA(""),C=EA(!1),Q=EA({model:"",display:{width:320,height:240,color:"RGB565"}}),E={"ESP32-S3":"esp32s3",ESP32S3:"esp32s3","ESP32-C3":"esp32c3",ESP32C3:"esp32c3","ESP32-C5":"esp32c5",ESP32C5:"esp32c5","ESP32-P4":"esp32p4",ESP32P4:"esp32p4","ESP32-C6":"esp32c6",ESP32C6:"esp32c6",ESP32:"esp32"},f=()=>{var w,F;try{if(!g.value)return a.value||(l.value=t("chipConfig.deviceOffline"),I.value=!1),!1;const N=(w=r.value.chip)==null?void 0:w.model;if(!N||N==="未知")return!1;let G=E[N.toUpperCase()]||E[N]||N.toLowerCase().replace(/-/g,"");["esp32s3","esp32c3","esp32c5","esp32p4","esp32c6","esp32","others"].includes(G)||(G="others");const b=(F=r.value.screen)==null?void 0:F.resolution;if(!b||b==="未知")return!1;const[R,L]=b.split("x").map(Number);return!R||!L||isNaN(R)||isNaN(L)?(l.value=t("chipConfig.resolutionFormatError"),I.value=!1,a.value=!1,!1):(Q.value={model:G,display:{width:R,height:L,color:"RGB565"}},i("update:modelValue",{model:G,display:{width:R,height:L,color:"RGB565"}}),I.value=!0,l.value="",a.value=!1,console.log("✓ 设备配置加载成功:",{chip:G,width:R,height:L}),!0)}catch(N){return console.error("加载设备配置失败:",N),l.value=t("chipConfig.loadingError"),I.value=!1,a.value=!1,!1}},h=hA(()=>Q.value.model&&Q.value.display.width&&Q.value.display.height),u=hA(()=>Q.value.model?Q.value.model.toUpperCase().replace(/ESP32/i,"ESP32-"):""),p=hA(()=>Q.value.display),c=()=>{C.value=!C.value},d=()=>{h.value&&i("next")};return ae(()=>Q.value,w=>{i("update:modelValue",{model:w.model,display:{...w.display}})},{deep:!0}),ae(()=>g.value,w=>{w&&!I.value&&(a.value=!0,l.value="",setTimeout(()=>{f()},100))}),ae(()=>[r.value.chip,r.value.screen],()=>{g.value&&!I.value&&f()},{deep:!0}),Ft(()=>{if(!s.value){a.value=!1,l.value=t("chipConfig.manualConfigRequired"),console.log("⚠ 未检测到设备连接,使用手动配置模式");return}g.value&&r.value.chip&&r.value.chip.model!=="未知"&&r.value.screen&&r.value.screen.resolution!=="未知"?(console.log("✓ 检测到已缓存的设备信息,立即加载"),f()):g.value?(console.log("⏳ 设备在线,等待设备信息加载..."),a.value=!0,setTimeout(()=>{f()},500),setTimeout(()=>{a.value&&!I.value&&g.value&&(a.value=!1,!r.value.chip||r.value.chip.model==="未知"?l.value=t("chipConfig.chipModelError"):!r.value.screen||r.value.screen.resolution==="未知"?l.value=t("chipConfig.resolutionError"):l.value=t("chipConfig.timeoutError"),console.warn("⚠ 设备配置加载超时:",l.value))},1e4)):(console.log("⏳ 等待设备连接..."),a.value=!0,setTimeout(()=>{a.value&&!I.value&&!g.value&&(a.value=!1,l.value=t("chipConfig.manualConfigHint"),console.warn("⚠ 等待设备连接超时"))},1e4))}),(w,F)=>(H(),_("div",gd,[B("div",null,[B("h2",sd,v(w.$t("chipConfig.title")),1),B("p",ad,[a.value?(H(),_("span",Id,v(w.$t("chipConfig.loadingFromDevice")),1)):I.value?(H(),_("span",Cd,v(w.$t("chipConfig.loadedFromDevice")),1)):(H(),_("span",ld,v(w.$t("chipConfig.manualConfig")),1))])]),a.value?(H(),_("div",Bd,[B("div",Qd,[B("div",cd,[F[0]||(F[0]=B("svg",{class:"animate-spin h-6 w-6 text-blue-600",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[B("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),B("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})],-1)),B("div",null,[B("h3",Ed,v(w.$t("chipConfig.loadingTitle")),1),B("p",ud,v(w.$t("chipConfig.loadingDesc")),1)])])])])):QA(g)&&I.value?(H(),_("div",hd,[B("div",fd,[B("div",dd,[B("div",pd,[F[1]||(F[1]=B("div",{class:"w-5 h-5 bg-green-500 rounded-full flex items-center justify-center mr-2"},[B("svg",{class:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})])],-1)),B("h3",md,v(w.$t("chipConfig.autoLoadedTitle")),1)])]),B("div",yd,[B("div",wd,[B("label",Dd,v(w.$t("chipConfig.chipModel")),1),B("div",kd,v(u.value),1)]),B("div",vd,[B("label",Fd,v(w.$t("chipConfig.screenWidth")),1),B("div",Sd,v(p.value.width)+" px",1)]),B("div",bd,[B("label",Rd,v(w.$t("chipConfig.screenHeight")),1),B("div",Nd,v(p.value.height)+" px",1)])]),B("div",Gd," ✓ "+v(w.$t("chipConfig.colorFormat"))+" "+v(p.value.color),1)]),B("div",Ld,[B("button",{onClick:c,class:"flex items-center text-sm text-gray-600 hover:text-gray-900"},[F[2]||(F[2]=B("svg",{class:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})],-1)),gt(" "+v(C.value?w.$t("chipConfig.collapseManual"):w.$t("chipConfig.manualEdit")),1)]),C.value?(H(),_("div",Ud,[HA(o,{config:Q.value},null,8,["config"])])):sA("",!0)])])):(H(),_("div",Md,[B("div",xd,[B("div",Jd,[F[3]||(F[3]=B("svg",{class:"w-5 h-5 text-yellow-600 mr-3 flex-shrink-0 mt-0.5",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"})],-1)),B("div",null,[B("h4",Td,v(w.$t("chipConfig.manualConfigDesc")),1),B("p",Hd,v(l.value||w.$t("chipConfig.manualConfigHint")),1)])])]),B("div",Yd,[B("h3",_d,v(w.$t("chipConfig.manualConfigTitle")),1),HA(o,{config:Q.value,"show-required":!0},null,8,["config"])])])),B("div",Kd,[B("button",{onClick:d,disabled:!h.value,class:"bg-primary-500 hover:bg-primary-600 disabled:bg-gray-300 text-white px-6 py-2 rounded-lg font-medium transition-colors"},v(w.$t("chipConfig.next")),9,Pd)])]))}},Vd={class:"space-y-6"},Wd={class:"text-lg font-medium text-gray-900 mb-2"},qd={class:"text-gray-600"},jd={key:0,class:"bg-orange-50 border border-orange-200 rounded-lg p-4"},Zd={class:"text-sm text-orange-800"},Xd={class:"mt-1"},zd={key:1,class:"space-y-6"},$d={class:"flex space-x-4"},A0={key:0,class:"space-y-4"},e0={class:"block text-sm font-medium text-gray-700"},t0={class:"relative"},i0=["value"],n0=["value"],o0={key:1,class:"space-y-4 bg-gray-50 p-4 rounded-lg border border-gray-200"},r0={class:"font-medium text-gray-900"},g0={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},s0={class:"block text-sm font-medium text-gray-700 mb-1"},a0=["placeholder"],I0={key:0,class:"text-xs text-red-500 mt-1"},C0={class:"block text-sm font-medium text-gray-700 mb-1"},l0=["placeholder"],B0={key:0,class:"text-xs text-red-500 mt-1"},Q0={class:"grid grid-cols-1 md:grid-cols-3 gap-4"},c0={class:"block text-sm font-medium text-gray-700 mb-1"},E0={class:"flex items-center space-x-2"},u0={class:"text-sm text-gray-600 w-8"},h0={class:"text-xs text-gray-500 mt-1"},f0={class:"block text-sm font-medium text-gray-700 mb-1"},d0={key:0,class:"text-xs text-red-500 mt-1"},p0={class:"block text-sm font-medium text-gray-700 mb-1"},m0={value:"mn6_cn"},y0={value:"mn6_en"},w0={class:"bg-blue-50 border border-blue-200 rounded-lg p-3"},D0={class:"text-sm text-blue-800"},k0={class:"mt-1 list-disc list-inside space-y-1"},v0={key:0},F0={key:1},S0={key:2},b0={__name:"WakewordConfig",props:{modelValue:{type:Object,required:!0},chipModel:{type:String,required:!0}},emits:["update:modelValue"],setup(A,{emit:e}){const{t}=ve(),i=A,n=e,o=[{id:"wn9s_hilexin",name:"Hi,乐鑫",model:"WakeNet9s"},{id:"wn9s_hiesp",name:"Hi,ESP",model:"WakeNet9s"},{id:"wn9s_nihaoxiaozhi",name:"你好小智",model:"WakeNet9s"},{id:"wn9s_hijason",name:"Hi,Jason",model:"WakeNet9s"},{id:"wn9s_alexa",name:"Alexa",model:"WakeNet9s"},{id:"wn9_hilexin",name:"Hi,乐鑫",model:"WakeNet9"},{id:"wn9_hiesp",name:"Hi,ESP",model:"WakeNet9"},{id:"wn9_nihaoxiaozhi_tts",name:"你好小智",model:"WakeNet9"},{id:"wn9_hijason_tts2",name:"Hi,Jason",model:"WakeNet9"},{id:"wn9_nihaomiaoban_tts2",name:"你好喵伴",model:"WakeNet9"},{id:"wn9_xiaoaitongxue",name:"小爱同学",model:"WakeNet9"},{id:"wn9_himfive",name:"Hi,M Five",model:"WakeNet9"},{id:"wn9_alexa",name:"Alexa",model:"WakeNet9"},{id:"wn9_jarvis_tts",name:"Jarvis",model:"WakeNet9"},{id:"wn9_computer_tts",name:"Computer",model:"WakeNet9"},{id:"wn9_heywillow_tts",name:"Hey,Willow",model:"WakeNet9"},{id:"wn9_sophia_tts",name:"Sophia",model:"WakeNet9"},{id:"wn9_mycroft_tts",name:"Mycroft",model:"WakeNet9"},{id:"wn9_heyprinter_tts",name:"Hey,Printer",model:"WakeNet9"},{id:"wn9_hijoy_tts",name:"Hi,Joy",model:"WakeNet9"},{id:"wn9_heywanda_tts",name:"Hey,Wand",model:"WakeNet9"},{id:"wn9_astrolabe_tts",name:"Astrolabe",model:"WakeNet9"},{id:"wn9_heyily_tts2",name:"Hey,Ily",model:"WakeNet9"},{id:"wn9_hijolly_tts2",name:"Hi,Jolly",model:"WakeNet9"},{id:"wn9_hifairy_tts2",name:"Hi,Fairy",model:"WakeNet9"},{id:"wn9_bluechip_tts2",name:"Blue Chip",model:"WakeNet9"},{id:"wn9_hiandy_tts2",name:"Hi,Andy",model:"WakeNet9"},{id:"wn9_heyivy_tts2",name:"Hey,Ivy",model:"WakeNet9"},{id:"wn9_hiwalle_tts2",name:"Hi,Wall E",model:"WakeNet9"},{id:"wn9_nihaoxiaoxin_tts",name:"你好小鑫",model:"WakeNet9"},{id:"wn9_xiaomeitongxue_tts",name:"小美同学",model:"WakeNet9"},{id:"wn9_hixiaoxing_tts",name:"Hi,小星",model:"WakeNet9"},{id:"wn9_xiaolongxiaolong_tts",name:"小龙小龙",model:"WakeNet9"},{id:"wn9_miaomiaotongxue_tts",name:"喵喵同学",model:"WakeNet9"},{id:"wn9_himiaomiao_tts",name:"Hi,喵喵",model:"WakeNet9"},{id:"wn9_hilili_tts",name:"Hi,Lily",model:"WakeNet9"},{id:"wn9_hitelly_tts",name:"Hi,Telly",model:"WakeNet9"},{id:"wn9_xiaobinxiaobin_tts",name:"小滨小滨",model:"WakeNet9"},{id:"wn9_haixiaowu_tts",name:"Hi,小巫",model:"WakeNet9"},{id:"wn9_xiaoyaxiaoya_tts2",name:"小鸭小鸭",model:"WakeNet9"},{id:"wn9_linaiban_tts2",name:"璃奈板",model:"WakeNet9"},{id:"wn9_xiaosurou_tts2",name:"小酥肉",model:"WakeNet9"},{id:"wn9_xiaoyutongxue_tts2",name:"小宇同学",model:"WakeNet9"},{id:"wn9_xiaomingtongxue_tts2",name:"小明同学",model:"WakeNet9"},{id:"wn9_xiaokangtongxue_tts2",name:"小康同学",model:"WakeNet9"},{id:"wn9_xiaojianxiaojian_tts2",name:"小箭小箭",model:"WakeNet9"},{id:"wn9_xiaotexiaote_tts2",name:"小特小特",model:"WakeNet9"},{id:"wn9_nihaoxiaoyi_tts2",name:"你好小益",model:"WakeNet9"},{id:"wn9_nihaobaiying_tts2",name:"你好百应",model:"WakeNet9"},{id:"wn9_xiaoluxiaolu_tts2",name:"小鹿小鹿",model:"WakeNet9"},{id:"wn9_nihaodongdong_tts2",name:"你好东东",model:"WakeNet9"},{id:"wn9_nihaoxiaoan_tts2",name:"你好小安",model:"WakeNet9"},{id:"wn9_ni3hao3xiao3mai4_tts2",name:"你好小脉",model:"WakeNet9"},{id:"wn9_ni3hao3xiao3rui4_tts3",name:"你好小瑞",model:"WakeNet9"},{id:"wn9_hai1xiao3ou1_tts3",name:"嗨小欧",model:"WakeNet9"}],r=hA(()=>{const u=i.chipModel.toLowerCase();return u==="esp32s3"||u==="esp32p4"}),g=hA(()=>{const u=i.chipModel.toLowerCase();return u==="esp32c3"||u==="esp32c5"||u==="esp32c6"}),s=hA(()=>i.chipModel.toLowerCase()==="esp32s3"),a=hA(()=>r.value||g.value),I=hA(()=>r.value?o.filter(u=>u.model==="WakeNet9"):g.value?o.filter(u=>u.model==="WakeNet9s"):[]),l=EA({name:"",command:"",threshold:20,duration:3e3,model:"mn6_cn"}),C=EA({name:"",command:"",duration:""}),Q=()=>{let u=!0;return C.value={name:"",command:"",duration:""},l.value.name.trim()||(C.value.name=t("wakewordConfig.errors.nameRequired"),u=!1),l.value.command.trim()?l.value.model.includes("_en")&&/[!,.?]/.test(l.value.command)&&(C.value.command=t("wakewordConfig.errors.noPunctuation"),u=!1):(C.value.command=t("wakewordConfig.errors.commandRequired"),u=!1),(!l.value.duration||l.value.duration<500||l.value.duration>1e4)&&(C.value.duration=t("wakewordConfig.errors.durationRange"),u=!1),u},E=EA(!1),f=u=>{var p;n("update:modelValue",{...i.modelValue,type:u,preset:u==="preset"&&(i.modelValue.preset||((p=I.value[0])==null?void 0:p.id))||"",custom:{...i.modelValue.custom,...l.value}})},h=u=>{n("update:modelValue",{...i.modelValue,preset:u})};return ae(l,u=>{E.value||i.modelValue.type==="custom"&&(Q(),n("update:modelValue",{...i.modelValue,custom:{...u}}))},{deep:!0}),ae(()=>i.modelValue.custom,u=>{u&&(E.value=!0,l.value={name:u.name||"",command:u.command||"",threshold:u.threshold!==void 0?u.threshold:20,duration:u.duration!==void 0?u.duration:3e3,model:u.model||"mn6_cn"},un(()=>{E.value=!1}))},{deep:!0,immediate:!0}),(u,p)=>(H(),_("div",Vd,[B("div",null,[B("h3",Wd,v(u.$t("wakewordConfig.title")),1),B("p",qd,v(u.$t("wakewordConfig.description")),1)]),a.value?(H(),_("div",zd,[B("div",$d,[B("button",{onClick:p[0]||(p[0]=c=>f("none")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="none"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},v(u.$t("wakewordConfig.noWakeword")),3),B("button",{onClick:p[1]||(p[1]=c=>f("preset")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="preset"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},v(u.$t("wakewordConfig.presetWakeword")),3),s.value?(H(),_("button",{key:0,onClick:p[2]||(p[2]=c=>f("custom")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="custom"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},v(u.$t("wakewordConfig.customWakeword")),3)):sA("",!0)]),A.modelValue.type==="preset"?(H(),_("div",A0,[B("label",e0,v(u.$t("wakewordConfig.selectWakeword")),1),B("div",t0,[B("select",{value:A.modelValue.preset,onChange:p[3]||(p[3]=c=>h(c.target.value)),class:"w-full border border-gray-300 rounded-md px-3 py-2 pr-10 bg-white focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"},[(H(!0),_(jA,null,Ke(I.value,c=>(H(),_("option",{key:c.id,value:c.id},v(c.name)+" ("+v(c.model)+") ",9,n0))),128))],40,i0)])])):sA("",!0),A.modelValue.type==="custom"?(H(),_("div",o0,[B("h4",r0,v(u.$t("wakewordConfig.customSettings")),1),B("div",g0,[B("div",null,[B("label",s0,[gt(v(u.$t("wakewordConfig.wakewordName"))+" ",1),p[9]||(p[9]=B("span",{class:"text-red-500"},"*",-1))]),XA(B("input",{type:"text","onUpdate:modelValue":p[4]||(p[4]=c=>l.value.name=c),placeholder:u.$t("wakewordConfig.wakewordNamePlaceholder"),class:kA(["w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500",{"border-red-500":C.value.name}])},null,10,a0),[[ie,l.value.name]]),C.value.name?(H(),_("p",I0,v(C.value.name),1)):sA("",!0)]),B("div",null,[B("label",C0,[gt(v(u.$t("wakewordConfig.wakewordCommand"))+" ",1),p[10]||(p[10]=B("span",{class:"text-red-500"},"*",-1))]),XA(B("input",{type:"text","onUpdate:modelValue":p[5]||(p[5]=c=>l.value.command=c),placeholder:l.value.model.includes("_cn")?u.$t("wakewordConfig.wakewordCommandPlaceholderCN"):u.$t("wakewordConfig.wakewordCommandPlaceholderEN"),class:kA(["w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500",{"border-red-500":C.value.command}])},null,10,l0),[[ie,l.value.command]]),C.value.command?(H(),_("p",B0,v(C.value.command),1)):sA("",!0)])]),B("div",Q0,[B("div",null,[B("label",c0,v(u.$t("wakewordConfig.threshold")),1),B("div",E0,[XA(B("input",{type:"range","onUpdate:modelValue":p[6]||(p[6]=c=>l.value.threshold=c),min:"0",max:"100",step:"1",class:"flex-1"},null,512),[[ie,l.value.threshold,void 0,{number:!0}]]),B("span",u0,v(l.value.threshold),1)]),B("p",h0,v(u.$t("wakewordConfig.thresholdDesc")),1)]),B("div",null,[B("label",f0,v(u.$t("wakewordConfig.duration"))+" (ms) ",1),XA(B("input",{type:"number","onUpdate:modelValue":p[7]||(p[7]=c=>l.value.duration=c),min:"500",max:"10000",step:"100",class:kA(["w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500",{"border-red-500":C.value.duration}])},null,2),[[ie,l.value.duration,void 0,{number:!0}]]),C.value.duration?(H(),_("p",d0,v(C.value.duration),1)):sA("",!0)]),B("div",null,[B("label",p0,v(u.$t("wakewordConfig.selectModel")),1),XA(B("select",{"onUpdate:modelValue":p[8]||(p[8]=c=>l.value.model=c),class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500"},[B("option",m0,v(u.$t("wakewordConfig.mn6cn")),1),B("option",y0,v(u.$t("wakewordConfig.mn6en")),1)],512),[[dr,l.value.model]])])])])):sA("",!0),B("div",w0,[B("div",D0,[B("strong",null,v(u.$t("wakewordConfig.tips.tipLabel")),1),B("ul",k0,[B("li",null,v(u.$t("wakewordConfig.tips.optional")),1),g.value?(H(),_("li",v0,v(u.$t("wakewordConfig.tips.wakeNet9sOnly")),1)):r.value?(H(),_("li",F0,v(u.$t("wakewordConfig.tips.wakeNet9Full")),1)):sA("",!0),s.value?(H(),_("li",S0,v(u.$t("wakewordConfig.tips.customSupport")),1)):sA("",!0)])])])])):(H(),_("div",jd,[B("div",Zd,[B("strong",null,v(u.$t("wakewordConfig.notice")),1),B("p",Xd,v(u.$t("wakewordConfig.unsupportedMessage",{chipModel:A.chipModel})),1)])]))]))}};class R0{constructor(){this.dbName="XiaozhiConfigDB",this.version=1,this.db=null,this.initialized=!1}async initialize(){if(!(this.initialized&&this.db))return new Promise((e,t)=>{const i=indexedDB.open(this.dbName,this.version);i.onerror=()=>{console.error("IndexedDB 初始化失败:",i.error),t(i.error)},i.onsuccess=()=>{this.db=i.result,this.initialized=!0,console.log("IndexedDB 初始化成功"),e()},i.onupgradeneeded=n=>{const o=n.target.result;if(o.objectStoreNames.contains("configs")||o.createObjectStore("configs",{keyPath:"key"}).createIndex("timestamp","timestamp",{unique:!1}),!o.objectStoreNames.contains("files")){const r=o.createObjectStore("files",{keyPath:"id"});r.createIndex("type","type",{unique:!1}),r.createIndex("timestamp","timestamp",{unique:!1})}if(!o.objectStoreNames.contains("temp_data")){const r=o.createObjectStore("temp_data",{keyPath:"key"});r.createIndex("type","type",{unique:!1}),r.createIndex("timestamp","timestamp",{unique:!1})}console.log("IndexedDB 表结构创建完成")}})}async saveConfig(e){this.initialized||await this.initialize();const i={key:"current_config",config:this.sanitizeConfigForStorage(e),timestamp:Date.now()};return new Promise((n,o)=>{const s=this.db.transaction(["configs"],"readwrite").objectStore("configs").put(i);s.onerror=()=>{console.error("保存配置失败:",s.error),o(s.error)},s.onsuccess=()=>{console.log("配置已保存到 IndexedDB"),n()}})}sanitizeConfigForStorage(e){var i,n,o,r,g,s,a,I,l,C;const t=JSON.parse(JSON.stringify(e||{}));try{if((n=(i=t==null?void 0:t.theme)==null?void 0:i.font)!=null&&n.custom&&(t.theme.font.custom.file=null),((r=(o=t==null?void 0:t.theme)==null?void 0:o.emoji)==null?void 0:r.type)==="custom"){t.theme.emoji.custom||(t.theme.emoji.custom={});const Q=((s=(g=t.theme.emoji)==null?void 0:g.custom)==null?void 0:s.images)||{},E={};if(Object.keys(Q).forEach(f=>{E[f]=null}),t.theme.emoji.custom.images=E,t.theme.emoji.custom.emotionMap,t.theme.emoji.custom.fileMap){const f=t.theme.emoji.custom.fileMap,h={};Object.keys(f).forEach(u=>{h[u]=null}),t.theme.emoji.custom.fileMap=h}}(I=(a=t==null?void 0:t.theme)==null?void 0:a.skin)!=null&&I.light&&(t.theme.skin.light.backgroundImage=null),(C=(l=t==null?void 0:t.theme)==null?void 0:l.skin)!=null&&C.dark&&(t.theme.skin.dark.backgroundImage=null)}catch{}return t}async loadConfig(){return this.initialized||await this.initialize(),new Promise((e,t)=>{const o=this.db.transaction(["configs"],"readonly").objectStore("configs").get("current_config");o.onerror=()=>{console.error("加载配置失败:",o.error),t(o.error)},o.onsuccess=()=>{const r=o.result;r?(console.log("从 IndexedDB 恢复配置成功"),e({config:r.config,timestamp:r.timestamp})):e(null)}})}async saveFile(e,t,i,n={}){this.initialized||await this.initialize();const o=await this.fileToArrayBuffer(t);let r={};try{r=n?JSON.parse(JSON.stringify(n)):{}}catch{r={...n}}const g={id:e,type:i,name:t.name,size:t.size,mimeType:t.type,lastModified:t.lastModified,data:o,metadata:r,timestamp:Date.now()};return new Promise((s,a)=>{const C=this.db.transaction(["files"],"readwrite").objectStore("files").put(g);C.onerror=()=>{console.error("保存文件失败:",C.error),a(C.error)},C.onsuccess=()=>{console.log(`文件 ${t.name} 已保存到 IndexedDB`),s()}})}async loadFile(e){return this.initialized||await this.initialize(),new Promise((t,i)=>{const r=this.db.transaction(["files"],"readonly").objectStore("files").get(e);r.onerror=()=>{console.error("加载文件失败:",r.error),i(r.error)},r.onsuccess=()=>{const g=r.result;if(g){const s=new Blob([g.data],{type:g.mimeType}),a=new File([s],g.name,{type:g.mimeType,lastModified:g.lastModified});a.storedId=g.id,a.storedType=g.type,a.storedMetadata=g.metadata,a.storedTimestamp=g.timestamp,console.log(`文件 ${g.name} 从 IndexedDB 恢复成功`),t(a)}else t(null)}})}async getFilesByType(e){return this.initialized||await this.initialize(),new Promise((t,i)=>{const g=this.db.transaction(["files"],"readonly").objectStore("files").index("type").getAll(e);g.onerror=()=>{console.error("获取文件列表失败:",g.error),i(g.error)},g.onsuccess=()=>{const a=(g.result||[]).map(I=>{const l=new Blob([I.data],{type:I.mimeType}),C=new File([l],I.name,{type:I.mimeType,lastModified:I.lastModified});return C.storedId=I.id,C.storedType=I.type,C.storedMetadata=I.metadata,C.storedTimestamp=I.timestamp,C});t(a)}})}async saveTempData(e,t,i,n={}){this.initialized||await this.initialize();const o={key:e,type:i,data:t,metadata:n,timestamp:Date.now()};return new Promise((r,g)=>{const I=this.db.transaction(["temp_data"],"readwrite").objectStore("temp_data").put(o);I.onerror=()=>{console.error("保存临时数据失败:",I.error),g(I.error)},I.onsuccess=()=>{console.log(`临时数据 ${e} 已保存`),r()}})}async loadTempData(e){return this.initialized||await this.initialize(),new Promise((t,i)=>{const r=this.db.transaction(["temp_data"],"readonly").objectStore("temp_data").get(e);r.onerror=()=>{console.error("加载临时数据失败:",r.error),i(r.error)},r.onsuccess=()=>{const g=r.result;t(g||null)}})}async clearAll(){this.initialized||await this.initialize();const e=["configs","files","temp_data"];return new Promise((t,i)=>{const n=this.db.transaction(e,"readwrite");let o=0,r=!1;const g=()=>{o++,o===e.length&&(r?i(new Error("清空部分数据时出现错误")):(console.log("所有存储数据已清空"),t()))};e.forEach(s=>{const I=n.objectStore(s).clear();I.onerror=()=>{console.error(`清空 ${s} 失败:`,I.error),r=!0,g()},I.onsuccess=()=>{console.log(`${s} 已清空`),g()}})})}async deleteFile(e){return this.initialized||await this.initialize(),new Promise((t,i)=>{const r=this.db.transaction(["files"],"readwrite").objectStore("files").delete(e);r.onerror=()=>{console.error("删除文件失败:",r.error),i(r.error)},r.onsuccess=()=>{console.log(`文件 ${e} 已删除`),t()}})}async getStorageInfo(){this.initialized||await this.initialize();const e=["configs","files","temp_data"],t={};for(const n of e){const o=await new Promise((r,g)=>{const I=this.db.transaction([n],"readonly").objectStore(n).count();I.onerror=()=>g(I.error),I.onsuccess=()=>r(I.result)});t[n]={count:o}}const i=await this.loadConfig();return t.lastSaved=i?new Date(i.timestamp):null,t}async hasStoredConfig(){try{return await this.loadConfig()!==null}catch(e){return console.error("检查存储配置时出错:",e),!1}}fileToArrayBuffer(e){return new Promise((t,i)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=()=>i(new Error("读取文件失败")),n.readAsArrayBuffer(e)})}close(){this.db&&(this.db.close(),this.db=null,this.initialized=!1,console.log("IndexedDB 连接已关闭"))}}const Qe=new R0;class bi{static async saveFontFile(e,t={}){if(e){const i="custom_font";try{await Qe.saveFile(i,e,"font",{size:t.size||20,bpp:t.bpp||4,charset:t.charset||"deepseek"}),console.log(`字体文件已保存: ${e.name}`)}catch(n){console.warn(`保存字体文件失败: ${e.name}`,n)}}}static async saveEmojiFile(e,t,i={}){var n,o;if(t&&e){const r=e.startsWith("hash_")?e:`emoji_${e}`;try{const g=((n=i==null?void 0:i.size)==null?void 0:n.width)??64,s=((o=i==null?void 0:i.size)==null?void 0:o.height)??64;await Qe.saveFile(r,t,"emoji",{name:e,size:{width:g,height:s},format:i==null?void 0:i.format,emotions:i==null?void 0:i.emotions}),console.log(`表情文件已保存: ${r} - ${t.name}`)}catch(g){console.warn(`保存表情文件失败: ${e}`,g)}}}static async saveBackgroundFile(e,t,i={}){if(t&&e){const n=`background_${e}`;try{let o={};try{o=i?JSON.parse(JSON.stringify(i)):{}}catch{o={...i}}await Qe.saveFile(n,t,"background",{mode:e,...o}),console.log(`背景文件已保存: ${e} - ${t.name}`)}catch(o){console.warn(`保存背景文件失败: ${e}`,o)}}}static async restoreFontFile(){try{return await Qe.loadFile("custom_font")}catch(e){return console.warn("恢复字体文件失败:",e),null}}static async restoreEmojiFile(e){if(!e)return null;try{const t=e.startsWith("hash_")?e:`emoji_${e}`;return await Qe.loadFile(t)}catch(t){return console.warn(`恢复表情文件失败: ${e}`,t),null}}static async restoreBackgroundFile(e){if(!e)return null;try{const t=`background_${e}`;return await Qe.loadFile(t)}catch(t){return console.warn(`恢复背景文件失败: ${e}`,t),null}}static async deleteFontFile(){try{await Qe.deleteFile("custom_font"),console.log("字体文件已删除")}catch(e){console.warn("删除字体文件失败:",e)}}static async deleteEmojiFile(e){if(e)try{const t=e.startsWith("hash_")?e:`emoji_${e}`;await Qe.deleteFile(t),console.log(`表情文件已删除: ${t}`)}catch(t){console.warn(`删除表情文件失败: ${e}`,t)}}static async deleteBackgroundFile(e){if(e)try{const t=`background_${e}`;await Qe.deleteFile(t),console.log(`背景文件已删除: ${e}`)}catch(t){console.warn(`删除背景文件失败: ${e}`,t)}}static async getStorageInfo(){try{return await Qe.getStorageInfo()}catch(e){return console.warn("获取存储信息失败:",e),{configs:{count:0},files:{count:0},temp_data:{count:0},lastSaved:null}}}static async clearAllFiles(){try{await Qe.clearAll(),console.log("所有存储文件已清理")}catch(e){throw console.warn("清理存储文件失败:",e),e}}}const N0={class:"space-y-6"},G0={class:"text-lg font-medium text-gray-900 mb-2"},L0={class:"text-gray-600"},U0={class:"space-y-4"},M0={class:"flex space-x-4"},x0={key:0,class:"space-y-4"},J0={class:"bg-gray-50 border border-gray-200 rounded-lg p-6 text-center"},T0={class:"mt-2 text-gray-600"},H0={key:1,class:"space-y-4"},Y0={class:"font-medium text-gray-900"},_0={class:"grid grid-cols-1 md:grid-cols-4 gap-4"},K0=["onClick"],P0={class:"flex items-start justify-between"},O0={class:"flex-1"},V0={class:"font-medium text-gray-900 mb-1"},W0={class:"text-sm text-gray-600 space-y-1"},q0={key:0,class:"flex-shrink-0 ml-3"},j0={key:2,class:"space-y-6"},Z0={class:"font-medium text-gray-900"},X0={class:"space-y-2"},z0={class:"block text-sm font-medium text-gray-700"},$0={key:0},Ap={class:"mt-2"},ep={class:"text-gray-500"},tp={class:"text-xs text-gray-400 mt-1"},ip={key:1,class:"text-green-600"},np={class:"mt-1 font-medium"},op={key:0,class:"grid grid-cols-1 md:grid-cols-3 gap-4"},rp={class:"block text-sm font-medium text-gray-700 mb-2"},gp={class:"text-xs text-gray-500 mt-1"},sp={class:"block text-sm font-medium text-gray-700 mb-2"},ap={value:1},Ip={value:2},Cp={value:4},lp={class:"block text-sm font-medium text-gray-700 mb-2"},Bp={value:"qwen"},Qp={value:"deepseek"},cp={value:"gb2312"},Ep={value:"latin"},up={value:"full"},hp={class:"flex items-center justify-between p-4 bg-gray-50 rounded-lg border border-gray-200"},fp={class:"flex-1"},dp={class:"font-medium text-gray-900"},pp={class:"text-sm text-gray-500 mt-1"},mp={class:"ml-4"},yp={class:"relative inline-flex items-center cursor-pointer"},wp=["checked"],Dp={__name:"FontConfig",props:{modelValue:{type:Object,required:!0}},emits:["update:modelValue"],setup(A,{emit:e}){const{t}=ve(),i=A,n=e,o=EA(null),r=[{id:"font_puhui_deepseek_14_1",size:14,bpp:1,fileSize:"~180KB"},{id:"font_puhui_deepseek_16_4",size:16,bpp:4,fileSize:"~720KB"},{id:"font_puhui_deepseek_20_4",size:20,bpp:4,fileSize:"~1.1MB"},{id:"font_puhui_deepseek_30_4",size:30,bpp:4,fileSize:"~2.5MB"},{id:"font_noto_qwen_14_1",size:14,bpp:1,fileSize:"~626KB"},{id:"font_noto_qwen_16_4",size:16,bpp:4,fileSize:"~2.0MB"},{id:"font_noto_qwen_20_4",size:20,bpp:4,fileSize:"~2.9MB"},{id:"font_noto_qwen_30_4",size:30,bpp:4,fileSize:"~5.8MB"}],g=hA(()=>r.map(h=>{let u;return h.id.startsWith("font_puhui_deepseek_")?u=t("fontConfig.charsetDeepseek"):h.id.startsWith("font_noto_qwen_")&&(u=t("fontConfig.charsetQwen")),{...h,name:t("fontConfig.presetFontNames."+h.id),charset:u}})),s=EA({size:20,bpp:4,charset:"qwen"}),a=h=>{n("update:modelValue",{...i.modelValue,type:h,preset:h==="preset"?i.modelValue.preset||"font_puhui_deepseek_20_4":"",custom:{...i.modelValue.custom,file:i.modelValue.custom.file||null}})},I=h=>{n("update:modelValue",{...i.modelValue,preset:h,custom:{...i.modelValue.custom,file:i.modelValue.custom.file||null}})},l=h=>{const u=h.target.files[0];u&&Q(u)},C=h=>{h.preventDefault();const u=h.dataTransfer.files;u.length>0&&Q(u[0])},Q=async h=>{h&&(h.type.includes("font")||h.name.toLowerCase().match(/\.(ttf|woff|woff2)$/))?(n("update:modelValue",{...i.modelValue,custom:{...i.modelValue.custom,file:h,...s.value}}),await bi.saveFontFile(h,s.value)):alert(t("fontConfig.selectValidFontFile"))},E=async()=>{n("update:modelValue",{...i.modelValue,custom:{...i.modelValue.custom,file:null}}),o.value&&(o.value.value=""),await bi.deleteFontFile()},f=EA(!1);return ae(()=>s.value,h=>{f.value||i.modelValue.type==="custom"&&i.modelValue.custom.file&&n("update:modelValue",{...i.modelValue,custom:{...i.modelValue.custom,...h}})},{deep:!0}),ae(()=>i.modelValue.custom,h=>{h.size&&h.bpp&&h.charset&&(f.value=!0,s.value={size:h.size,bpp:h.bpp,charset:h.charset},un(()=>{f.value=!1}))},{deep:!0,immediate:!0}),(h,u)=>{var p;return H(),_("div",N0,[B("div",null,[B("h3",G0,v(h.$t("fontConfig.title")),1),B("p",L0,v(h.$t("fontConfig.description")),1)]),B("div",U0,[B("div",M0,[B("button",{onClick:u[0]||(u[0]=c=>a("none")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="none"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},v(h.$t("fontConfig.noFonts")),3),B("button",{onClick:u[1]||(u[1]=c=>a("preset")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="preset"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},v(h.$t("fontConfig.presetFonts")),3),B("button",{onClick:u[2]||(u[2]=c=>a("custom")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="custom"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},v(h.$t("fontConfig.customFonts")),3)])]),A.modelValue.type==="none"?(H(),_("div",x0,[B("div",J0,[u[10]||(u[10]=B("svg",{class:"mx-auto h-12 w-12 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)),B("p",T0,v(h.$t("fontConfig.noFontsDescription")),1)])])):sA("",!0),A.modelValue.type==="preset"?(H(),_("div",H0,[B("h4",Y0,v(h.$t("fontConfig.presetFonts")),1),B("div",_0,[(H(!0),_(jA,null,Ke(g.value,c=>(H(),_("div",{key:c.id,onClick:d=>I(c.id),class:kA(["border-2 rounded-lg p-4 cursor-pointer transition-all",A.modelValue.preset===c.id?"border-primary-500 bg-primary-50":"border-gray-200 hover:border-gray-300"])},[B("div",P0,[B("div",O0,[B("h5",V0,v(c.name),1),B("div",W0,[B("div",null,v(h.$t("fontConfig.fontSize"))+" "+v(c.size)+"px",1),B("div",null,v(h.$t("fontConfig.bitDepth"))+" "+v(c.bpp)+"bpp",1),B("div",null,v(h.$t("fontConfig.charset"))+" "+v(c.charset),1),B("div",null,v(h.$t("fontConfig.fileSize"))+" "+v(c.fileSize),1)])]),A.modelValue.preset===c.id?(H(),_("div",q0,[...u[11]||(u[11]=[B("div",{class:"w-5 h-5 bg-primary-500 rounded-full flex items-center justify-center"},[B("svg",{class:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})])],-1)])])):sA("",!0)])],10,K0))),128))])])):sA("",!0),A.modelValue.type==="custom"?(H(),_("div",j0,[B("h4",Z0,v(h.$t("fontConfig.customFonts")),1),B("div",X0,[B("label",z0,v(h.$t("fontConfig.fontFile")),1),B("div",{onDrop:C,onDragover:u[4]||(u[4]=dt(()=>{},["prevent"])),onDragenter:u[5]||(u[5]=dt(()=>{},["prevent"])),class:"border-2 border-dashed border-gray-300 rounded-lg p-6 text-center hover:border-gray-400 transition-colors"},[B("input",{ref_key:"fileInput",ref:o,type:"file",accept:".ttf,.woff,.woff2",onChange:l,class:"hidden"},null,544),A.modelValue.custom.file?(H(),_("div",ip,[u[13]||(u[13]=B("svg",{class:"mx-auto h-8 w-8",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z","clip-rule":"evenodd"})],-1)),B("p",np,v((p=A.modelValue.custom.file)==null?void 0:p.name),1),B("button",{onClick:E,class:"text-red-600 hover:text-red-500 text-sm mt-1"},v(h.$t("fontConfig.removeFile")),1)])):(H(),_("div",$0,[u[12]||(u[12]=B("svg",{class:"mx-auto h-12 w-12 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})],-1)),B("div",Ap,[B("button",{onClick:u[3]||(u[3]=c=>h.$refs.fileInput.click()),class:"text-primary-600 hover:text-primary-500 font-medium"},v(h.$t("fontConfig.clickSelectFontFile")),1),B("p",ep,v(h.$t("fontConfig.orDragFileHere")),1)]),B("p",tp,v(h.$t("fontConfig.supportedFormats")),1)]))],32)]),A.modelValue.custom.file?(H(),_("div",op,[B("div",null,[B("label",rp,v(h.$t("fontConfig.fontSizePx")),1),XA(B("input",{type:"number","onUpdate:modelValue":u[6]||(u[6]=c=>s.value.size=c),min:"8",max:"80",class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"},null,512),[[ie,s.value.size,void 0,{number:!0}]]),B("p",gp,v(h.$t("fontConfig.range"))+" 8-80px",1)]),B("div",null,[B("label",sp,v(h.$t("fontConfig.bitDepthBpp")),1),XA(B("select",{"onUpdate:modelValue":u[7]||(u[7]=c=>s.value.bpp=c),class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"},[B("option",ap,v(h.$t("fontConfig.monochrome")),1),B("option",Ip,v(h.$t("fontConfig.fourColors")),1),B("option",Cp,v(h.$t("fontConfig.sixteenColors")),1)],512),[[dr,s.value.bpp]])]),B("div",null,[B("label",lp,v(h.$t("fontConfig.characterSet")),1),XA(B("select",{"onUpdate:modelValue":u[8]||(u[8]=c=>s.value.charset=c),class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"},[B("option",Bp,v(h.$t("fontConfig.qwen18409")),1),B("option",Qp,v(h.$t("fontConfig.deepseekR1")),1),B("option",cp,v(h.$t("fontConfig.gb2312")),1),B("option",Ep,v(h.$t("fontConfig.latin1")),1),B("option",up,v(h.$t("fontConfig.fullCharset")),1)],512),[[dr,s.value.charset]])])])):sA("",!0)])):sA("",!0),B("div",hp,[B("div",fp,[B("h4",dp,v(h.$t("fontConfig.hideSubtitle")),1),B("p",pp,v(h.$t("fontConfig.hideSubtitleDescription")),1)]),B("div",mp,[B("label",yp,[B("input",{type:"checkbox",checked:A.modelValue.hide_subtitle,onChange:u[9]||(u[9]=c=>n("update:modelValue",{...A.modelValue,hide_subtitle:c.target.checked})),class:"sr-only peer"},null,40,wp),u[14]||(u[14]=B("div",{class:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-primary-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-primary-500"},null,-1))])])])])}}},kp={class:"space-y-6"},vp={class:"text-lg font-medium text-gray-900 mb-2"},Fp={class:"text-gray-600"},Sp={class:"space-y-4"},bp={class:"flex flex-wrap gap-3"},Rp={key:0,class:"text-sm text-gray-500"},Np={key:0,class:"space-y-4"},Gp={class:"font-medium text-gray-900"},Lp={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},Up=["onClick"],Mp={class:"flex items-start justify-between mb-3"},xp={class:"font-medium text-gray-900"},Jp={class:"text-sm text-gray-600"},Tp={class:"text-xs text-gray-500 mt-1"},Hp={key:0,class:"flex-shrink-0 ml-3"},Yp={class:"grid grid-cols-7 gap-1 justify-items-center"},_p=["src","alt"],Kp={key:1,class:"space-y-6"},Pp={class:"font-medium text-gray-900"},Op={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},Vp={class:"block text-sm font-medium text-gray-700 mb-2"},Wp={class:"block text-sm font-medium text-gray-700 mb-2"},qp={class:"space-y-4"},jp={class:"font-medium text-gray-900"},Zp={class:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-7 gap-4"},Xp={class:"text-center"},zp={class:"text-lg mb-1"},$p={class:"text-xs text-gray-600 flex items-center justify-center gap-1"},Am={key:0,class:"text-red-500"},em=["onDrop"],tm=["onChange"],im=["onClick"],nm={class:"text-xs text-gray-500"},om={key:1,class:"w-full h-full relative"},rm=["src","alt"],gm=["onClick"],sm={class:"text-xs text-gray-500 mt-2"},am={__name:"EmojiConfig",props:{modelValue:{type:Object,required:!0}},emits:["update:modelValue"],setup(A,{emit:e}){const{t}=ve(),i=A,n=e,o=async p=>{const c=await p.arrayBuffer(),d=await crypto.subtle.digest("SHA-256",c);return Array.from(new Uint8Array(d)).map(N=>N.toString(16).padStart(2,"0")).join("")},r=[{id:"twemoji32",name:t("emojiConfig.twitterEmojiName",{size:32}),description:t("emojiConfig.twitterEmojiDescription",{size:32}),size:32,preview:["neutral","happy","laughing","funny","sad","angry","crying"]},{id:"twemoji64",name:t("emojiConfig.twitterEmojiName",{size:64}),description:t("emojiConfig.twitterEmojiDescription",{size:64}),size:64,preview:["neutral","happy","laughing","funny","sad","angry","crying"]}],g=hA(()=>[{key:"neutral",name:t("emojiConfig.emotions.neutral"),emoji:"😶"},{key:"happy",name:t("emojiConfig.emotions.happy"),emoji:"🙂"},{key:"laughing",name:t("emojiConfig.emotions.laughing"),emoji:"😆"},{key:"funny",name:t("emojiConfig.emotions.funny"),emoji:"😂"},{key:"sad",name:t("emojiConfig.emotions.sad"),emoji:"😔"},{key:"angry",name:t("emojiConfig.emotions.angry"),emoji:"😠"},{key:"crying",name:t("emojiConfig.emotions.crying"),emoji:"😭"},{key:"loving",name:t("emojiConfig.emotions.loving"),emoji:"😍"},{key:"embarrassed",name:t("emojiConfig.emotions.embarrassed"),emoji:"😳"},{key:"surprised",name:t("emojiConfig.emotions.surprised"),emoji:"😯"},{key:"shocked",name:t("emojiConfig.emotions.shocked"),emoji:"😱"},{key:"thinking",name:t("emojiConfig.emotions.thinking"),emoji:"🤔"},{key:"winking",name:t("emojiConfig.emotions.winking"),emoji:"😉"},{key:"cool",name:t("emojiConfig.emotions.cool"),emoji:"😎"},{key:"relaxed",name:t("emojiConfig.emotions.relaxed"),emoji:"😌"},{key:"delicious",name:t("emojiConfig.emotions.delicious"),emoji:"🤤"},{key:"kissy",name:t("emojiConfig.emotions.kissy"),emoji:"😘"},{key:"confident",name:t("emojiConfig.emotions.confident"),emoji:"😏"},{key:"sleepy",name:t("emojiConfig.emotions.sleepy"),emoji:"😴"},{key:"silly",name:t("emojiConfig.emotions.silly"),emoji:"😜"},{key:"confused",name:t("emojiConfig.emotions.confused"),emoji:"🙄"}]),s=EA({size:{width:32,height:32}}),a=p=>{if(i.modelValue.type===p)return;const c={...i.modelValue,type:p};p==="none"?(c.preset="",c.custom={...i.modelValue.custom,images:i.modelValue.custom.images||{}}):p==="preset"?(c.preset=i.modelValue.preset||"twemoji32",c.custom={...i.modelValue.custom,images:i.modelValue.custom.images||{}}):p==="custom"&&(c.preset="",c.custom={...i.modelValue.custom,images:i.modelValue.custom.images||{}}),n("update:modelValue",c)},I=p=>{i.modelValue.preset!==p&&n("update:modelValue",{...i.modelValue,preset:p,custom:{...i.modelValue.custom,images:i.modelValue.custom.images||{}}})},l=(p,c)=>{const d=p.target.files[0];d&&Q(c,d)},C=(p,c)=>{p.preventDefault();const d=p.dataTransfer.files;d.length>0&&Q(c,d[0])},Q=async(p,c)=>{const d=["png","gif"],w=c.name.split(".").pop().toLowerCase();if(!d.includes(w)){alert(t("emojiConfig.selectValidFormat"));return}const F=await o(c),N=i.modelValue.custom||{},G={...N.fileMap||{}},P={...N.emotionMap||{}},b={...N.images||{}};let R=[];for(const[L,cA]of Object.entries(P))cA===F&&L!==p&&R.push(L);R.length>0&&console.log(t("emojiConfig.sharedFileMessage",{emotionKey:p,existingEmotions:R.join(", ")})),G[F]=c,P[p]=F,b[p]=c,n("update:modelValue",{...i.modelValue,custom:{...N,size:s.value.size,images:b,fileMap:G,emotionMap:P}}),await bi.saveEmojiFile(`hash_${F}`,c,{size:s.value.size,format:w,emotions:[...R,p]})},E=async p=>{const c=i.modelValue.custom||{},d={...c.images},w={...c.emotionMap||{}},F={...c.fileMap||{}},N=w[p];delete d[p],delete w[p],Object.values(w).filter(P=>P===N).length===0&&N?(delete F[N],await bi.deleteEmojiFile(`hash_${N}`),console.log(t("emojiConfig.fileDeleted",{fileHash:N}))):console.log(t("emojiConfig.fileRetained",{fileHash:N})),n("update:modelValue",{...i.modelValue,custom:{...c,images:d,emotionMap:w,fileMap:F}})},f=(p,c)=>`./static/twemoji${p==="twemoji64"?"64":"32"}/${c}.png`,h=p=>{if(i.modelValue.type==="preset")return f(i.modelValue.preset,p);{const c=i.modelValue.custom.images[p];return c instanceof File||c instanceof Blob?URL.createObjectURL(c):null}},u=p=>{console.warn(t("emojiConfig.imageLoadFailed"),p.target.src),p.target.style.display="none"};return ae(()=>s.value.size,p=>{if(i.modelValue.type==="custom"){const c=i.modelValue.custom;JSON.stringify(c.size)!==JSON.stringify(p)&&n("update:modelValue",{...i.modelValue,custom:{...c,size:p}})}},{deep:!0}),i.modelValue.custom.size&&(s.value={size:{...i.modelValue.custom.size}}),(p,c)=>(H(),_("div",kp,[B("div",null,[B("h3",vp,v(p.$t("emojiConfig.title")),1),B("p",Fp,v(p.$t("emojiConfig.description")),1)]),B("div",Sp,[B("div",bp,[B("button",{onClick:c[0]||(c[0]=d=>a("none")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="none"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},v(p.$t("emojiConfig.noEmojiPack")),3),B("button",{onClick:c[1]||(c[1]=d=>a("preset")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="preset"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},v(p.$t("emojiConfig.presetEmojiPack")),3),B("button",{onClick:c[2]||(c[2]=d=>a("custom")),class:kA(["px-4 py-2 border rounded-lg transition-colors",A.modelValue.type==="custom"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},v(p.$t("emojiConfig.customEmojiPack")),3)]),A.modelValue.type==="none"?(H(),_("p",Rp,v(p.$t("emojiConfig.noEmojiPackDescription")),1)):sA("",!0)]),A.modelValue.type==="preset"?(H(),_("div",Np,[B("h4",Gp,v(p.$t("emojiConfig.selectPresetEmojiPack")),1),B("div",Lp,[(H(),_(jA,null,Ke(r,d=>B("div",{key:d.id,onClick:w=>I(d.id),class:kA(["border-2 rounded-lg p-4 cursor-pointer transition-all",A.modelValue.preset===d.id?"border-primary-500 bg-primary-50":"border-gray-200 hover:border-gray-300"])},[B("div",Mp,[B("div",null,[B("h5",xp,v(d.name),1),B("p",Jp,v(d.description),1),B("div",Tp,v(p.$t("emojiConfig.size"))+": "+v(d.size)+"px × "+v(d.size)+"px ",1)]),A.modelValue.preset===d.id?(H(),_("div",Hp,[...c[7]||(c[7]=[B("div",{class:"w-5 h-5 bg-primary-500 rounded-full flex items-center justify-center"},[B("svg",{class:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})])],-1)])])):sA("",!0)]),B("div",Yp,[(H(!0),_(jA,null,Ke(d.preview,w=>(H(),_("div",{key:w,style:WA({width:d.size+"px",height:d.size+"px"}),class:"bg-gray-100 rounded flex items-center justify-center"},[B("img",{src:f(d.id,w),alt:w,style:WA({width:d.size+"px",height:d.size+"px"}),class:"object-contain rounded",onError:u},null,44,_p)],4))),128))])],10,Up)),64))])])):sA("",!0),A.modelValue.type==="custom"?(H(),_("div",Kp,[B("h4",Pp,v(p.$t("emojiConfig.customEmojiPackConfig")),1),B("div",Op,[B("div",null,[B("label",Vp,v(p.$t("emojiConfig.maxImageWidth")),1),XA(B("input",{type:"number","onUpdate:modelValue":c[3]||(c[3]=d=>s.value.size.width=d),min:"16",max:"200",class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"},null,512),[[ie,s.value.size.width,void 0,{number:!0}]])]),B("div",null,[B("label",Wp,v(p.$t("emojiConfig.maxImageHeight")),1),XA(B("input",{type:"number","onUpdate:modelValue":c[4]||(c[4]=d=>s.value.size.height=d),min:"16",max:"200",class:"w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"},null,512),[[ie,s.value.size.height,void 0,{number:!0}]])])]),B("div",qp,[B("h5",jp,v(p.$t("emojiConfig.uploadEmojiImages")),1),B("div",Zp,[(H(!0),_(jA,null,Ke(g.value,d=>(H(),_("div",{key:d.key,class:"space-y-2"},[B("div",Xp,[B("div",zp,v(d.emoji),1),B("div",$p,[B("span",null,v(d.name),1),d.key==="neutral"?(H(),_("span",Am,v(p.$t("emojiConfig.required")),1)):sA("",!0)])]),B("div",{onDrop:w=>C(w,d.key),onDragover:c[5]||(c[5]=dt(()=>{},["prevent"])),onDragenter:c[6]||(c[6]=dt(()=>{},["prevent"])),class:kA(["border-2 border-dashed rounded-lg p-2 text-center cursor-pointer transition-colors aspect-square flex flex-col items-center justify-center",A.modelValue.custom.images[d.key]?"border-green-300 bg-green-50":d.key==="neutral"?"border-red-300 bg-red-50":"border-gray-300 hover:border-gray-400"])},[B("input",{ref_for:!0,ref:d.key+"Input",type:"file",accept:".png,.gif",onChange:w=>l(w,d.key),class:"hidden"},null,40,tm),A.modelValue.custom.images[d.key]?(H(),_("div",om,[h(d.key)?(H(),_("img",{key:0,src:h(d.key),alt:d.name,class:"w-full h-full object-cover rounded",onError:u},null,40,rm)):sA("",!0),B("button",{onClick:w=>E(d.key),class:"absolute -top-1 -right-1 w-4 h-4 bg-red-500 text-white rounded-full flex items-center justify-center text-xs hover:bg-red-600"}," × ",8,gm)])):(H(),_("div",{key:0,onClick:w=>{var F;return(F=p.$refs[d.key+"Input"][0])==null?void 0:F.click()}},[c[8]||(c[8]=B("svg",{class:"w-6 h-6 text-gray-400 mx-auto mb-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})],-1)),B("div",nm,v(p.$t("emojiConfig.clickToUploadOrDrag")),1)],8,im))],42,em)]))),128))]),B("div",sm,v(p.$t("emojiConfig.neutralRequiredNotice")),1)])])):sA("",!0)]))}},Im={class:"space-y-6"},Cm={class:"text-lg font-medium text-gray-900 mb-2"},lm={class:"text-gray-600"},Bm={class:"space-y-4"},Qm={class:"font-medium text-gray-900 flex items-center"},cm={class:"border border-gray-200 rounded-lg p-4 space-y-4"},Em={class:"flex space-x-4"},um={key:0,class:"space-y-3"},hm={class:"flex items-center space-x-3"},fm={class:"text-sm font-medium text-gray-700"},dm={class:"flex items-center space-x-2"},pm={class:"flex items-center space-x-3"},mm={class:"text-sm font-medium text-gray-700"},ym={class:"flex items-center space-x-2"},wm={key:1,class:"space-y-3"},Dm={class:"text-sm font-medium text-gray-700"},km={class:"mt-1 text-sm text-gray-600"},vm={key:1,class:"space-y-2"},Fm=["src"],Sm={class:"text-sm text-green-700 font-medium"},bm={class:"flex items-center space-x-3"},Rm={class:"text-sm font-medium text-gray-700"},Nm={class:"flex items-center space-x-2"},Gm={class:"space-y-4"},Lm={class:"font-medium text-gray-900 flex items-center"},Um={class:"border border-gray-200 rounded-lg p-4 space-y-4"},Mm={class:"flex space-x-4"},xm={key:0,class:"space-y-3"},Jm={class:"flex items-center space-x-3"},Tm={class:"text-sm font-medium text-gray-700"},Hm={class:"flex items-center space-x-2"},Ym={class:"flex items-center space-x-3"},_m={class:"text-sm font-medium text-gray-700"},Km={class:"flex items-center space-x-2"},Pm={key:1,class:"space-y-3"},Om={class:"text-sm font-medium text-gray-700"},Vm={class:"mt-1 text-sm text-gray-600"},Wm={key:1,class:"space-y-2"},qm=["src"],jm={class:"text-sm text-green-700 font-medium"},Zm={class:"flex items-center space-x-3"},Xm={class:"text-sm font-medium text-gray-700"},zm={class:"flex items-center space-x-2"},$m={class:"space-y-4"},Ay={class:"font-medium text-gray-900"},ey={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},ty={class:"space-y-2"},iy={class:"text-sm font-medium text-gray-700"},ny={class:"absolute inset-0 bg-white bg-opacity-10 flex items-center justify-center rounded-lg"},oy={class:"space-y-2"},ry={class:"text-sm font-medium text-gray-700"},gy={class:"absolute inset-0 bg-black bg-opacity-10 flex items-center justify-center rounded-lg"},sy={class:"bg-blue-50 border border-blue-200 rounded-lg p-4"},ay={class:"font-medium text-blue-900 mb-2"},Iy={class:"flex flex-wrap gap-2"},Cy={__name:"BackgroundConfig",props:{modelValue:{type:Object,required:!0}},emits:["update:modelValue"],setup(A,{emit:e}){const{t}=ve(),i=A,n=e,o=EA(null),r=EA(null),g=hA({get:()=>i.modelValue.light.backgroundColor,set:b=>Q(b)}),s=hA({get:()=>i.modelValue.dark.backgroundColor,set:b=>E(b)}),a=hA({get:()=>i.modelValue.light.textColor,set:b=>f(b)}),I=hA({get:()=>i.modelValue.dark.textColor,set:b=>h(b)}),l=b=>{n("update:modelValue",{...i.modelValue,light:{...i.modelValue.light,backgroundType:b,backgroundImage:b==="image"?i.modelValue.light.backgroundImage:null}})},C=b=>{n("update:modelValue",{...i.modelValue,dark:{...i.modelValue.dark,backgroundType:b,backgroundImage:b==="image"?i.modelValue.dark.backgroundImage:null}})},Q=b=>{n("update:modelValue",{...i.modelValue,light:{...i.modelValue.light,backgroundColor:b}})},E=b=>{n("update:modelValue",{...i.modelValue,dark:{...i.modelValue.dark,backgroundColor:b}})},f=b=>{n("update:modelValue",{...i.modelValue,light:{...i.modelValue.light,textColor:b}})},h=b=>{n("update:modelValue",{...i.modelValue,dark:{...i.modelValue.dark,textColor:b}})},u=(b,R)=>{const L=b.target.files[0];L&&c(R,L)},p=(b,R)=>{b.preventDefault();const L=b.dataTransfer.files;L.length>0&&c(R,L[0])},c=async(b,R)=>{R&&R.type.startsWith("image/")?(n("update:modelValue",{...i.modelValue,[b]:{...i.modelValue[b],backgroundImage:R}}),await bi.saveBackgroundFile(b,R)):alert(t("backgroundConfig.selectValidImage"))},d=async b=>{n("update:modelValue",{...i.modelValue,[b]:{...i.modelValue[b],backgroundImage:null}}),b==="light"&&o.value&&(o.value.value=""),b==="dark"&&r.value&&(r.value.value=""),await bi.deleteBackgroundFile(b)},w=b=>{const R=i.modelValue[b].backgroundImage;return R?URL.createObjectURL(R):null},F=()=>i.modelValue.light.backgroundType==="image"&&i.modelValue.light.backgroundImage?{backgroundImage:`url(${w("light")})`,backgroundSize:"cover",backgroundPosition:"center"}:{backgroundColor:i.modelValue.light.backgroundColor},N=()=>i.modelValue.dark.backgroundType==="image"&&i.modelValue.dark.backgroundImage?{backgroundImage:`url(${w("dark")})`,backgroundSize:"cover",backgroundPosition:"center"}:{backgroundColor:i.modelValue.dark.backgroundColor},G=(b,R)=>{const L=P(b)?"#000000":"#ffffff",cA=P(R)?"#000000":"#ffffff";n("update:modelValue",{...i.modelValue,light:{...i.modelValue.light,backgroundType:"color",backgroundColor:b,textColor:L,backgroundImage:null},dark:{...i.modelValue.dark,backgroundType:"color",backgroundColor:R,textColor:cA,backgroundImage:null}})},P=b=>{const R=b.replace("#",""),L=parseInt(R.substr(0,2),16),cA=parseInt(R.substr(2,2),16),dA=parseInt(R.substr(4,2),16);return(L*299+cA*587+dA*114)/1e3>128};return(b,R)=>(H(),_("div",Im,[B("div",null,[B("h3",Cm,v(b.$t("backgroundConfig.title")),1),B("p",lm,v(b.$t("backgroundConfig.description")),1)]),B("div",Bm,[B("h4",Qm,[R[33]||(R[33]=B("svg",{class:"w-5 h-5 mr-2 text-yellow-500",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z","clip-rule":"evenodd"})],-1)),gt(" "+v(b.$t("backgroundConfig.lightMode")),1)]),B("div",cm,[B("div",Em,[B("button",{onClick:R[0]||(R[0]=L=>l("color")),class:kA(["px-3 py-2 text-sm border rounded transition-colors",A.modelValue.light.backgroundType==="color"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},v(b.$t("backgroundConfig.solidBackground")),3),B("button",{onClick:R[1]||(R[1]=L=>l("image")),class:kA(["px-3 py-2 text-sm border rounded transition-colors",A.modelValue.light.backgroundType==="image"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},v(b.$t("backgroundConfig.imageBackground")),3)]),A.modelValue.light.backgroundType==="color"?(H(),_("div",um,[B("div",hm,[B("label",fm,v(b.$t("backgroundConfig.backgroundColor")),1),B("div",dm,[XA(B("input",{type:"color","onUpdate:modelValue":R[2]||(R[2]=L=>g.value=L),class:"w-10 h-10 border border-gray-300 rounded cursor-pointer"},null,512),[[ie,g.value]]),XA(B("input",{type:"text","onUpdate:modelValue":R[3]||(R[3]=L=>g.value=L),class:"border border-gray-300 rounded px-3 py-2 text-sm font-mono w-24"},null,512),[[ie,g.value]])]),B("div",{style:WA({backgroundColor:g.value}),class:"w-16 h-10 border border-gray-300 rounded shadow-inner"},null,4)]),B("div",pm,[B("label",mm,v(b.$t("backgroundConfig.textColor")),1),B("div",ym,[XA(B("input",{type:"color","onUpdate:modelValue":R[4]||(R[4]=L=>a.value=L),class:"w-10 h-10 border border-gray-300 rounded cursor-pointer"},null,512),[[ie,a.value]]),XA(B("input",{type:"text","onUpdate:modelValue":R[5]||(R[5]=L=>a.value=L),class:"border border-gray-300 rounded px-3 py-2 text-sm font-mono w-24"},null,512),[[ie,a.value]])]),B("div",{style:WA({backgroundColor:a.value}),class:"w-16 h-10 border border-gray-300 rounded shadow-inner"},null,4)])])):sA("",!0),A.modelValue.light.backgroundType==="image"?(H(),_("div",wm,[B("label",Dm,v(b.$t("backgroundConfig.backgroundImage")),1),B("div",{onDrop:R[9]||(R[9]=L=>p(L,"light")),onDragover:R[10]||(R[10]=dt(()=>{},["prevent"])),onDragenter:R[11]||(R[11]=dt(()=>{},["prevent"])),class:kA(["border-2 border-dashed rounded-lg p-4 text-center cursor-pointer transition-colors",A.modelValue.light.backgroundImage?"border-green-300 bg-green-50":"border-gray-300 hover:border-gray-400"])},[B("input",{ref_key:"lightImageInput",ref:o,type:"file",accept:"image/*",onChange:R[6]||(R[6]=L=>u(L,"light")),class:"hidden"},null,544),A.modelValue.light.backgroundImage?(H(),_("div",vm,[B("img",{src:w("light"),alt:"{{ $t('backgroundConfig.lightModePreview') }}背景",class:"max-w-32 max-h-32 mx-auto rounded shadow"},null,8,Fm),B("p",Sm,v(A.modelValue.light.backgroundImage.name),1),B("button",{onClick:R[8]||(R[8]=L=>d("light")),class:"text-red-600 hover:text-red-500 text-sm"},v(b.$t("backgroundConfig.removeImage")),1)])):(H(),_("div",{key:0,onClick:R[7]||(R[7]=L=>b.$refs.lightImageInput.click())},[R[34]||(R[34]=B("svg",{class:"mx-auto h-8 w-8 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})],-1)),B("p",km,v(b.$t("backgroundConfig.clickOrDragToUpload")),1)]))],34),B("div",bm,[B("label",Rm,v(b.$t("backgroundConfig.textColor")),1),B("div",Nm,[XA(B("input",{type:"color","onUpdate:modelValue":R[12]||(R[12]=L=>a.value=L),class:"w-10 h-10 border border-gray-300 rounded cursor-pointer"},null,512),[[ie,a.value]]),XA(B("input",{type:"text","onUpdate:modelValue":R[13]||(R[13]=L=>a.value=L),class:"border border-gray-300 rounded px-3 py-2 text-sm font-mono w-24"},null,512),[[ie,a.value]])]),B("div",{style:WA({backgroundColor:a.value}),class:"w-16 h-10 border border-gray-300 rounded shadow-inner"},null,4)])])):sA("",!0)])]),B("div",Gm,[B("h4",Lm,[R[35]||(R[35]=B("svg",{class:"w-5 h-5 mr-2 text-gray-600",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{d:"M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"})],-1)),gt(" "+v(b.$t("backgroundConfig.darkMode")),1)]),B("div",Um,[B("div",Mm,[B("button",{onClick:R[14]||(R[14]=L=>C("color")),class:kA(["px-3 py-2 text-sm border rounded transition-colors",A.modelValue.dark.backgroundType==="color"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},v(b.$t("backgroundConfig.solidBackground")),3),B("button",{onClick:R[15]||(R[15]=L=>C("image")),class:kA(["px-3 py-2 text-sm border rounded transition-colors",A.modelValue.dark.backgroundType==="image"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])},v(b.$t("backgroundConfig.imageBackground")),3)]),A.modelValue.dark.backgroundType==="color"?(H(),_("div",xm,[B("div",Jm,[B("label",Tm,v(b.$t("backgroundConfig.backgroundColor")),1),B("div",Hm,[XA(B("input",{type:"color","onUpdate:modelValue":R[16]||(R[16]=L=>s.value=L),class:"w-10 h-10 border border-gray-300 rounded cursor-pointer"},null,512),[[ie,s.value]]),XA(B("input",{type:"text","onUpdate:modelValue":R[17]||(R[17]=L=>s.value=L),class:"border border-gray-300 rounded px-3 py-2 text-sm font-mono w-24"},null,512),[[ie,s.value]])]),B("div",{style:WA({backgroundColor:s.value}),class:"w-16 h-10 border border-gray-300 rounded shadow-inner"},null,4)]),B("div",Ym,[B("label",_m,v(b.$t("backgroundConfig.textColor")),1),B("div",Km,[XA(B("input",{type:"color","onUpdate:modelValue":R[18]||(R[18]=L=>I.value=L),class:"w-10 h-10 border border-gray-300 rounded cursor-pointer"},null,512),[[ie,I.value]]),XA(B("input",{type:"text","onUpdate:modelValue":R[19]||(R[19]=L=>I.value=L),class:"border border-gray-300 rounded px-3 py-2 text-sm font-mono w-24"},null,512),[[ie,I.value]])]),B("div",{style:WA({backgroundColor:I.value}),class:"w-16 h-10 border border-gray-300 rounded shadow-inner"},null,4)])])):sA("",!0),A.modelValue.dark.backgroundType==="image"?(H(),_("div",Pm,[B("label",Om,v(b.$t("backgroundConfig.backgroundImage")),1),B("div",{onDrop:R[23]||(R[23]=L=>p(L,"dark")),onDragover:R[24]||(R[24]=dt(()=>{},["prevent"])),onDragenter:R[25]||(R[25]=dt(()=>{},["prevent"])),class:kA(["border-2 border-dashed rounded-lg p-4 text-center cursor-pointer transition-colors",A.modelValue.dark.backgroundImage?"border-green-300 bg-green-50":"border-gray-300 hover:border-gray-400"])},[B("input",{ref_key:"darkImageInput",ref:r,type:"file",accept:"image/*",onChange:R[20]||(R[20]=L=>u(L,"dark")),class:"hidden"},null,544),A.modelValue.dark.backgroundImage?(H(),_("div",Wm,[B("img",{src:w("dark"),alt:"{{ $t('backgroundConfig.darkModePreview') }}背景",class:"max-w-32 max-h-32 mx-auto rounded shadow"},null,8,qm),B("p",jm,v(A.modelValue.dark.backgroundImage.name),1),B("button",{onClick:R[22]||(R[22]=L=>d("dark")),class:"text-red-600 hover:text-red-500 text-sm"},v(b.$t("backgroundConfig.removeImage")),1)])):(H(),_("div",{key:0,onClick:R[21]||(R[21]=L=>b.$refs.darkImageInput.click())},[R[36]||(R[36]=B("svg",{class:"mx-auto h-8 w-8 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})],-1)),B("p",Vm,v(b.$t("backgroundConfig.clickOrDragToUpload")),1)]))],34),B("div",Zm,[B("label",Xm,v(b.$t("backgroundConfig.textColor")),1),B("div",zm,[XA(B("input",{type:"color","onUpdate:modelValue":R[26]||(R[26]=L=>I.value=L),class:"w-10 h-10 border border-gray-300 rounded cursor-pointer"},null,512),[[ie,I.value]]),XA(B("input",{type:"text","onUpdate:modelValue":R[27]||(R[27]=L=>I.value=L),class:"border border-gray-300 rounded px-3 py-2 text-sm font-mono w-24"},null,512),[[ie,I.value]])]),B("div",{style:WA({backgroundColor:I.value}),class:"w-16 h-10 border border-gray-300 rounded shadow-inner"},null,4)])])):sA("",!0)])]),B("div",$m,[B("h4",Ay,v(b.$t("backgroundConfig.backgroundPreview")),1),B("div",ey,[B("div",ty,[B("div",iy,v(b.$t("backgroundConfig.lightModePreview")),1),B("div",{style:WA(F()),class:"h-32 border border-gray-300 rounded-lg flex items-center justify-center text-sm relative overflow-hidden"},[B("div",ny,[B("span",{style:WA({color:A.modelValue.light.textColor})},v(b.$t("backgroundConfig.chatArea")),5)])],4)]),B("div",oy,[B("div",ry,v(b.$t("backgroundConfig.darkModePreview")),1),B("div",{style:WA(N()),class:"h-32 border border-gray-300 rounded-lg flex items-center justify-center text-sm relative overflow-hidden"},[B("div",gy,[B("span",{style:WA({color:A.modelValue.dark.textColor})},v(b.$t("backgroundConfig.chatArea")),5)])],4)])])]),B("div",sy,[B("h5",ay,v(b.$t("backgroundConfig.quickConfig")),1),B("div",Iy,[B("button",{onClick:R[28]||(R[28]=L=>G("#ffffff","#1f2937")),class:"px-3 py-1 text-sm bg-white border border-gray-300 rounded hover:bg-gray-50"},v(b.$t("backgroundConfig.defaultColors")),1),B("button",{onClick:R[29]||(R[29]=L=>G("#f5f5f4","#374151")),class:"px-3 py-1 text-sm bg-stone-100 border border-gray-300 rounded hover:bg-stone-200"},v(b.$t("backgroundConfig.stoneTexture")),1),B("button",{onClick:R[30]||(R[30]=L=>G("#fef7cd","#7c2d12")),class:"px-3 py-1 text-sm bg-yellow-100 border border-gray-300 rounded hover:bg-yellow-200"},v(b.$t("backgroundConfig.sunnyColors")),1),B("button",{onClick:R[31]||(R[31]=L=>G("#e0f2fe","#1e40af")),class:"px-3 py-1 text-sm bg-sky-100 border border-gray-300 rounded hover:bg-sky-200"},v(b.$t("backgroundConfig.skyBlue")),1),B("button",{onClick:R[32]||(R[32]=L=>G("#fdf2f8","#be185d")),class:"px-3 py-1 text-sm bg-pink-100 border border-gray-300 rounded hover:bg-pink-200"},v(b.$t("backgroundConfig.romanticPink")),1)])])]))}},ly={class:"space-y-6"},By={class:"text-xl font-semibold text-gray-900 mb-4"},Qy={class:"text-gray-600 mb-6"},cy={class:"border-b border-gray-200"},Ey={class:"-mb-px flex space-x-4 sm:space-x-8"},uy=["onClick"],hy={class:"flex items-center"},fy={class:"hidden sm:inline"},dy={class:"min-h-96"},py={class:"flex justify-between"},my={__name:"ThemeDesign",props:{modelValue:{type:Object,required:!0},chipModel:{type:String,required:!0},activeTab:{type:String,default:"wakeword"}},emits:["update:modelValue","next","prev","tabChange"],setup(A,{emit:e}){const{t}=ve(),i={render(){return GA("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[GA("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z"})])}},n={render(){return GA("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 640 640"},[GA("path",{d:"M320 96C329.5 96 338 101.5 341.9 110.2L515.1 496L536 496C549.3 496 560 506.7 560 520C560 533.3 549.3 544 536 544L440 544C426.7 544 416 533.3 416 520C416 506.7 426.7 496 440 496L462.5 496L426.6 416L213.4 416L177.5 496L200 496C213.3 496 224 506.7 224 520C224 533.3 213.3 544 200 544L104 544C90.7 544 80 533.3 80 520C80 506.7 90.7 496 104 496L124.9 496L298.1 110.2C302 101.5 310.5 96 320 96zM320 178.6L235 368L405 368L320 178.6z"})])}},o={render(){return GA("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[GA("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M14.828 14.828a4 4 0 01-5.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})])}},r={render(){return GA("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 640 640"},[GA("path",{d:"M160 144C151.2 144 144 151.2 144 160L144 480C144 488.8 151.2 496 160 496L480 496C488.8 496 496 488.8 496 480L496 160C496 151.2 488.8 144 480 144L160 144zM96 160C96 124.7 124.7 96 160 96L480 96C515.3 96 544 124.7 544 160L544 480C544 515.3 515.3 544 480 544L160 544C124.7 544 96 515.3 96 480L96 160zM224 192C241.7 192 256 206.3 256 224C256 241.7 241.7 256 224 256C206.3 256 192 241.7 192 224C192 206.3 206.3 192 224 192zM360 264C368.5 264 376.4 268.5 380.7 275.8L460.7 411.8C465.1 419.2 465.1 428.4 460.8 435.9C456.5 443.4 448.6 448 440 448L200 448C191.1 448 182.8 443 178.7 435.1C174.6 427.2 175.2 417.6 180.3 410.3L236.3 330.3C240.8 323.9 248.1 320.1 256 320.1C263.9 320.1 271.2 323.9 275.7 330.3L292.9 354.9L339.4 275.9C343.7 268.6 351.6 264.1 360.1 264.1z"})])}},g=A,s=e,a=EA(g.activeTab),I=hA(()=>[{id:"wakeword",name:t("themeDesign.tabs.wakeword"),icon:i},{id:"font",name:t("themeDesign.tabs.font"),icon:n},{id:"emoji",name:t("themeDesign.tabs.emoji"),icon:o},{id:"background",name:t("themeDesign.tabs.background"),icon:r}]),l=hA({get:()=>g.modelValue,set:E=>s("update:modelValue",E)}),C=()=>{var h,u,p;const E=g.modelValue.wakeword;if(E.type==="custom"){if(!((h=E.custom.name)!=null&&h.trim())){alert(t("wakewordConfig.errors.nameRequired"));return}if(!((u=E.custom.command)!=null&&u.trim())){alert(t("wakewordConfig.errors.commandRequired"));return}if(!E.custom.duration||E.custom.duration<500||E.custom.duration>1e4){alert(t("wakewordConfig.errors.durationRange"));return}}const f=g.modelValue.font;if(f.type==="custom"&&!((p=f.custom)!=null&&p.file)){alert(t("fontConfig.selectValidFontFile"));return}s("next")},Q=E=>{a.value=E,s("tabChange",E)};return ae(()=>g.activeTab,E=>{a.value=E}),(E,f)=>(H(),_("div",ly,[B("div",null,[B("h2",By,v(E.$t("themeDesign.title")),1),B("p",Qy,v(E.$t("themeDesign.description")),1)]),B("div",cy,[B("nav",Ey,[(H(!0),_(jA,null,Ke(I.value,h=>(H(),_("button",{key:h.id,onClick:u=>Q(h.id),class:kA(["py-2 px-1 border-b-2 font-medium text-sm relative",a.value===h.id?"border-primary-500 text-primary-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"])},[B("span",hy,[(H(),ye(TI(h.icon),{class:"w-5 h-5 sm:mr-2"})),B("span",fy,v(h.name),1)])],10,uy))),128))])]),B("div",dy,[a.value==="wakeword"?(H(),ye(b0,{key:0,modelValue:l.value.wakeword,"onUpdate:modelValue":f[0]||(f[0]=h=>l.value.wakeword=h),chipModel:A.chipModel},null,8,["modelValue","chipModel"])):sA("",!0),a.value==="font"?(H(),ye(Dp,{key:1,modelValue:l.value.font,"onUpdate:modelValue":f[1]||(f[1]=h=>l.value.font=h)},null,8,["modelValue"])):sA("",!0),a.value==="emoji"?(H(),ye(am,{key:2,modelValue:l.value.emoji,"onUpdate:modelValue":f[2]||(f[2]=h=>l.value.emoji=h)},null,8,["modelValue"])):sA("",!0),a.value==="background"?(H(),ye(Cy,{key:3,modelValue:l.value.skin,"onUpdate:modelValue":f[3]||(f[3]=h=>l.value.skin=h)},null,8,["modelValue"])):sA("",!0)]),B("div",py,[B("button",{onClick:f[4]||(f[4]=h=>E.$emit("prev")),class:"bg-gray-500 hover:bg-gray-600 text-white px-6 py-2 rounded-lg font-medium transition-colors"},v(E.$t("themeDesign.previous")),1),B("button",{onClick:C,class:"bg-primary-500 hover:bg-primary-600 text-white px-6 py-2 rounded-lg font-medium transition-colors"},v(E.$t("themeDesign.next")),1)])]))}},yy=(A,e)=>{const t=A.__vccOpts||A;for(const[i,n]of e)t[i]=n;return t},wy={class:"space-y-6"},Dy={class:"text-xl font-semibold text-gray-900 mb-4"},ky={class:"text-gray-600 mb-6"},vy={class:"flex flex-col lg:flex-row gap-8"},Fy={class:"flex-1"},Sy={class:"text-lg font-medium text-gray-900 mb-4"},by={class:"bg-gray-100 p-4 rounded-lg"},Ry={class:"max-w-full overflow-auto flex justify-center"},Ny={class:"bg-gray-800 p-6 rounded-2xl shadow-2xl inline-block"},Gy={class:"bg-gray-900 p-2 rounded-xl"},Ly={class:"relative z-10 flex flex-col items-center justify-center p-4 text-center"},Uy={class:"mb-4"},My={key:0,class:"emoji-container"},xy=["src","alt"],Jy={key:1,class:"emoji-container"},Ty={class:"text-center"},Hy={class:"text-sm"},Yy={class:"text-xs"},_y={key:0,class:"absolute inset-0 flex items-center justify-center"},Ky={class:"animate-pulse text-gray-400 text-xs"},Py={class:"mt-3 text-center text-xs text-gray-400"},Oy={class:"w-full lg:w-80"},Vy={class:"text-lg font-medium text-gray-900 mb-4"},Wy={class:"space-y-6 bg-white border border-gray-200 rounded-lg p-4"},qy={class:"block text-sm font-medium text-gray-700 mb-2"},jy={class:"block text-sm font-medium text-gray-700 mb-2"},Zy={key:0,class:"flex flex-wrap gap-2 max-h-32 overflow-y-auto justify-center"},Xy=["onClick","title"],zy={key:0},$y=["src","alt"],Aw={key:1,class:"text-lg"},ew={key:1,class:"text-center py-4 text-gray-500 bg-gray-50 rounded-lg border-2 border-dashed"},tw={class:"text-2xl mb-2"},iw={class:"text-sm"},nw={class:"block text-sm font-medium text-gray-700 mb-2"},ow={class:"flex space-x-2"},rw={class:"border-t pt-4"},gw={class:"font-medium text-gray-900 mb-2"},sw={class:"text-xs text-gray-600 space-y-1"},aw={key:0},Iw={class:"flex items-center"},Cw={key:0,class:"ml-2 animate-pulse text-blue-500"},lw={key:1},Bw={class:"flex justify-between"},Qw={__name:"GenerateSummary",props:{config:{type:Object,required:!0}},emits:["prev","generate"],setup(A){const{t:e}=ve(),t=A,i=EA(e("generateSummary.defaultPreviewText")),n=EA("happy"),o=EA("light"),r=EA(!1),g=EA(""),s=hA(()=>[{key:"neutral",name:e("generateSummary.emotions.neutral"),emoji:"😶"},{key:"happy",name:e("generateSummary.emotions.happy"),emoji:"🙂"},{key:"laughing",name:e("generateSummary.emotions.laughing"),emoji:"😆"},{key:"funny",name:e("generateSummary.emotions.funny"),emoji:"😂"},{key:"sad",name:e("generateSummary.emotions.sad"),emoji:"😔"},{key:"angry",name:e("generateSummary.emotions.angry"),emoji:"😠"},{key:"crying",name:e("generateSummary.emotions.crying"),emoji:"😭"},{key:"loving",name:e("generateSummary.emotions.loving"),emoji:"😍"},{key:"surprised",name:e("generateSummary.emotions.surprised"),emoji:"😯"},{key:"thinking",name:e("generateSummary.emotions.thinking"),emoji:"🤔"},{key:"cool",name:e("generateSummary.emotions.cool"),emoji:"😎"},{key:"sleepy",name:e("generateSummary.emotions.sleepy"),emoji:"😴"}]),a=hA(()=>{if(t.config.theme.emoji.type==="preset"&&t.config.theme.emoji.preset)return s.value;if(t.config.theme.emoji.type==="custom"){const b=t.config.theme.emoji.custom.images;return s.value.filter(R=>b[R.key])}else return[]}),I=hA(()=>u(n.value)),l=()=>{const{width:b,height:R}=t.config.chip.display;return{width:`${b}px`,height:`${R}px`}},C=()=>{const b=t.config.theme.skin[o.value];if(b.backgroundType==="image"&&b.backgroundImage)try{if(b.backgroundImage&&typeof b.backgroundImage=="object"&&b.backgroundImage.size)return{backgroundImage:`url(${URL.createObjectURL(b.backgroundImage)})`,backgroundSize:"cover",backgroundPosition:"center"}}catch(R){console.warn("背景图片预览加载失败:",R)}return{backgroundColor:b.backgroundColor||"#ffffff"}},Q=()=>{let b=48;return t.config.theme.emoji.type==="preset"?b=t.config.theme.emoji.preset==="twemoji64"?64:32:t.config.theme.emoji.custom.size&&(b=Math.min(t.config.theme.emoji.custom.size.width,t.config.theme.emoji.custom.size.height)),{width:`${b}px`,height:`${b}px`}},E=()=>{let b=14;if(t.config.theme.font.type==="preset"){const L=t.config.theme.font.preset;L.includes("_14_")?b=14:L.includes("_16_")?b=16:L.includes("_20_")?b=20:L.includes("_30_")&&(b=30)}else t.config.theme.font.custom.size&&(b=t.config.theme.font.custom.size);const R=o.value==="dark"?t.config.theme.skin.dark.textColor:t.config.theme.skin.light.textColor;return{fontSize:`${b}px`,color:R,fontFamily:h(),textShadow:o.value==="dark"?"1px 1px 2px rgba(0,0,0,0.5)":"1px 1px 2px rgba(255,255,255,0.5)"}},f=async()=>{document.querySelectorAll("style[data-font-preview]").forEach(R=>R.remove()),r.value=!1,g.value="";try{if(t.config.theme.font.type==="preset"){const R=t.config.theme.font.preset;let L,cA;R&&R.startsWith("font_noto_qwen_")?(L="NotoPreview",cA="./static/fonts/noto_qwen.ttf"):(L="PuHuiPreview",cA="./static/fonts/puhui_deepseek.ttf");const dA=document.createElement("style");dA.setAttribute("data-font-preview","true"),dA.textContent=` - @font-face { - font-family: '${L}'; - src: url('${cA}') format('truetype'); - font-display: swap; - } - `,document.head.appendChild(dA),await document.fonts.load(`16px "${L}"`),g.value=L,r.value=!0}else if(t.config.theme.font.custom.file)try{const R=t.config.theme.font.custom.file;if(!R||typeof R!="object"||!R.size)throw new Error("字体文件对象无效");const L="CustomFontPreview",cA=URL.createObjectURL(R),dA=document.createElement("style");dA.setAttribute("data-font-preview","true"),dA.textContent=` - @font-face { - font-family: '${L}'; - src: url('${cA}'); - font-display: swap; - } - `,document.head.appendChild(dA),await document.fonts.load(`16px "${L}"`),g.value=L,r.value=!0}catch(R){console.warn("自定义字体预览加载失败:",R),g.value="Arial, sans-serif",r.value=!0}else g.value="system-ui",r.value=!0}catch(R){console.warn("Font loading failed:",R),g.value="system-ui",r.value=!0}},h=()=>r.value&&g.value?`"${g.value}", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif`:'"PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif',u=b=>{if(t.config.theme.emoji.type==="preset")return`./static/twemoji${t.config.theme.emoji.preset==="twemoji64"?"64":"32"}/${b}.png`;if(t.config.theme.emoji.type==="custom"&&t.config.theme.emoji.custom.images[b])try{const R=t.config.theme.emoji.custom.images[b];if(R&&typeof R=="object"&&R.size)return URL.createObjectURL(R)}catch(R){console.warn(`表情图片预览加载失败 (${b}):`,R)}return null},p=b=>{const R=s.value.find(L=>L.key===b);return R?R.emoji:"😶"},c=()=>{if(t.config.theme.emoji.type==="preset")return(t.config.theme.emoji.preset==="twemoji64"?64:32)+16;if(t.config.theme.emoji.custom.size){const b=Math.min(t.config.theme.emoji.custom.size.width,t.config.theme.emoji.custom.size.height);return Math.min(b+16,64)}return 48},d=()=>t.config.theme.emoji.type==="preset"?t.config.theme.emoji.preset==="twemoji64"?64:32:t.config.theme.emoji.custom.size?Math.min(t.config.theme.emoji.custom.size.width,t.config.theme.emoji.custom.size.height,48):32,w=b=>{n.value=b},F=()=>{const b=t.config.theme.wakeword;return!b||b.type==="none"?e("wakewordConfig.noWakeword"):b.type==="preset"?{wn9s_hilexin:"Hi,乐鑫",wn9s_hiesp:"Hi,ESP",wn9s_nihaoxiaozhi:"你好小智",wn9_nihaoxiaozhi_tts:"你好小智",wn9_alexa:"Alexa",wn9_jarvis_tts:"Jarvis"}[b.preset]||b.preset:b.type==="custom"?b.custom.name||e("wakewordConfig.customWakeword"):e("wakewordConfig.noWakeword")},N=()=>{if(t.config.theme.font.type==="preset")return e("fontConfig.presetFontNames."+t.config.theme.font.preset)||t.config.theme.font.preset;{const b=t.config.theme.font.custom;return e("generateSummary.customFont",{size:b.size})}},G=()=>{if(t.config.theme.emoji.type==="preset"&&t.config.theme.emoji.preset)return t.config.theme.emoji.preset==="twemoji64"?"Twemoji 64×64":"Twemoji 32×32";if(t.config.theme.emoji.type==="custom"){const b=Object.keys(t.config.theme.emoji.custom.images).length;return e("generateSummary.customEmoji",{count:b})}else return t.config.theme.emoji.type==="none"?e("emojiConfig.noEmojiPack"):e("generateSummary.notConfigured")},P=()=>{const b=t.config.theme.skin.light.backgroundType==="image"?e("generateSummary.image"):e("generateSummary.color"),R=t.config.theme.skin.dark.backgroundType==="image"?e("generateSummary.image"):e("generateSummary.color");return e("generateSummary.skinLight",{type:b})+"/"+e("generateSummary.skinDark",{type:R})};return ae(()=>t.config.theme.font,()=>{f()},{deep:!0}),Ft(async()=>{a.value.length>0?n.value=a.value[0].key:n.value="",await f()}),Ci(()=>{document.querySelectorAll("style[data-font-preview]").forEach(R=>R.remove())}),(b,R)=>(H(),_("div",wy,[B("div",null,[B("h2",Dy,v(b.$t("generateSummary.title")),1),B("p",ky,v(b.$t("generateSummary.description")),1)]),B("div",vy,[B("div",Fy,[B("h3",Sy,v(b.$t("generateSummary.devicePreview")),1),B("div",by,[B("div",Ry,[B("div",Ny,[B("div",Gy,[B("div",{style:WA(l()),class:"relative rounded-lg overflow-hidden border-2 border-gray-700 flex flex-col items-center justify-center"},[B("div",{style:WA(C()),class:"absolute inset-0"},null,4),B("div",Ly,[B("div",Uy,[n.value&&a.value.length>0?(H(),_("div",My,[I.value?(H(),_("img",{key:0,src:I.value,alt:n.value,style:WA(Q()),class:"emoji-image"},null,12,xy)):(H(),_("div",{key:1,style:WA(Q()),class:"emoji-fallback bg-gray-200 rounded-full flex items-center justify-center text-2xl"},v(p(n.value)),5))])):(H(),_("div",Jy,[B("div",{style:WA(Q()),class:"emoji-placeholder flex items-center justify-center text-gray-400 border-2 border-dashed border-gray-300 rounded bg-gray-50"},[B("div",Ty,[B("div",Hy,v(A.config.theme.emoji.type==="none"?"📦":"😕"),1),B("div",Yy,v(A.config.theme.emoji.type==="none"?b.$t("emojiConfig.noEmojiPack"):b.$t("generateSummary.noEmotionConfigured")),1)])],4)]))]),A.config.theme.font.hide_subtitle?sA("",!0):(H(),_("div",{key:0,style:WA(E()),class:"text-message max-w-full break-words relative"},[r.value?sA("",!0):(H(),_("div",_y,[B("div",Ky,v(b.$t("generateSummary.fontLoading")),1)])),B("div",{class:kA({"opacity-0":!r.value})},v(i.value),3)],4))])],4)]),B("div",Py,v(A.config.chip.display.width)+" × "+v(A.config.chip.display.height)+" "+v(A.config.chip.model.toUpperCase()),1)])])])]),B("div",Oy,[B("h3",Vy,v(b.$t("generateSummary.previewSettings")),1),B("div",Wy,[B("div",null,[B("label",qy,v(b.$t("generateSummary.previewText")),1),XA(B("textarea",{"onUpdate:modelValue":R[0]||(R[0]=L=>i.value=L),class:"w-full border border-gray-300 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500",rows:"3",placeholder:"Hi, I'm your friend Xiaozhi!"},null,512),[[ie,i.value]])]),B("div",null,[B("label",jy,v(b.$t("generateSummary.currentEmotion")),1),a.value.length>0?(H(),_("div",Zy,[(H(!0),_(jA,null,Ke(a.value,L=>(H(),_("button",{key:L.key,onClick:cA=>w(L.key),class:kA(["p-2 border rounded transition-colors flex items-center justify-center",n.value===L.key?"border-primary-500 bg-primary-50":"border-gray-200 hover:border-gray-300"]),title:L.name,style:WA({width:c()+"px",height:c()+"px"})},[u(L.key)?(H(),_("div",zy,[B("img",{src:u(L.key),alt:L.name,style:WA({width:d()+"px",height:d()+"px"}),class:"object-contain rounded"},null,12,$y)])):(H(),_("div",Aw,v(L.emoji),1))],14,Xy))),128))])):(H(),_("div",ew,[B("div",tw,v(A.config.theme.emoji.type==="none"?"📦":"😕"),1),B("div",iw,v(A.config.theme.emoji.type==="none"?b.$t("emojiConfig.noEmojiPackDescription"):b.$t("generateSummary.configureEmojiFirst")),1)]))]),B("div",null,[B("label",nw,v(b.$t("generateSummary.themeMode")),1),B("div",ow,[B("button",{onClick:R[1]||(R[1]=L=>o.value="light"),class:kA(["flex-1 py-2 px-3 text-sm border rounded transition-colors",o.value==="light"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])}," 🌞 "+v(b.$t("generateSummary.lightMode")),3),B("button",{onClick:R[2]||(R[2]=L=>o.value="dark"),class:kA(["flex-1 py-2 px-3 text-sm border rounded transition-colors",o.value==="dark"?"border-primary-500 bg-primary-50 text-primary-700":"border-gray-300 hover:border-gray-400"])}," 🌙 "+v(b.$t("generateSummary.darkMode")),3)])]),B("div",rw,[B("h4",gw,v(b.$t("generateSummary.configSummary")),1),B("div",sw,[A.config.theme.wakeword?(H(),_("div",aw,v(b.$t("generateSummary.wakeword"))+" "+v(F()),1)):sA("",!0),B("div",Iw,[B("span",null,v(b.$t("generateSummary.font"))+" "+v(N()),1),r.value?sA("",!0):(H(),_("span",Cw,v(b.$t("generateSummary.loading")),1))]),B("div",null,v(b.$t("generateSummary.emotion"))+" "+v(G()),1),B("div",null,v(b.$t("generateSummary.skin"))+" "+v(P()),1),A.config.theme.font.hide_subtitle?(H(),_("div",lw,v(b.$t("generateSummary.hideSubtitle"))+" "+v(b.$t("common.yes")),1)):sA("",!0)])])])])]),B("div",Bw,[B("button",{onClick:R[3]||(R[3]=L=>b.$emit("prev")),class:"bg-gray-500 hover:bg-gray-600 text-white px-6 py-2 rounded-lg font-medium transition-colors"},v(b.$t("generateSummary.previous")),1),B("button",{onClick:R[4]||(R[4]=L=>b.$emit("generate")),class:"bg-green-500 hover:bg-green-600 text-white px-8 py-2 rounded-lg font-medium transition-colors flex items-center"},[R[5]||(R[5]=B("svg",{class:"w-5 h-5 mr-2",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)),gt(" "+v(b.$t("generateSummary.generate")),1)])])]))}},cw=yy(Qw,[["__scopeId","data-v-aa1dde40"]]);/*! https://mths.be/codepointat v0.2.0 by @mathias */String.prototype.codePointAt||function(){var A=function(){try{var t={},i=Object.defineProperty,n=i(t,t,t)&&i}catch{}return n}(),e=function(t){if(this==null)throw TypeError();var i=String(this),n=i.length,o=t?Number(t):0;if(o!=o&&(o=0),!(o<0||o>=n)){var r=i.charCodeAt(o),g;return r>=55296&&r<=56319&&n>o+1&&(g=i.charCodeAt(o+1),g>=56320&&g<=57343)?(r-55296)*1024+g-56320+65536:r}};A?A(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}();var Qg=0,YC=-3;function an(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Ew(A,e){this.source=A,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new an,this.dtree=new an}var _C=new an,KC=new an,cg=new Uint8Array(30),Eg=new Uint16Array(30),PC=new Uint8Array(30),OC=new Uint16Array(30),uw=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xs=new an,$e=new Uint8Array(320);function VC(A,e,t,i){var n,o;for(n=0;n>>=1,e}function et(A,e,t){if(!e)return t;for(;A.bitcount<24;)A.tag|=A.source[A.sourceIndex++]<>>16-e;return A.tag>>>=e,A.bitcount-=e,i+t}function br(A,e){for(;A.bitcount<24;)A.tag|=A.source[A.sourceIndex++]<>>=1,++n,t+=e.table[n],i-=e.table[n];while(i>=0);return A.tag=o,A.bitcount-=n,e.trans[t+i]}function dw(A,e,t){var i,n,o,r,g,s;for(i=et(A,5,257),n=et(A,5,1),o=et(A,4,4),r=0;r<19;++r)$e[r]=0;for(r=0;r8;)A.sourceIndex--,A.bitcount-=8;if(e=A.source[A.sourceIndex+1],e=256*e+A.source[A.sourceIndex],t=A.source[A.sourceIndex+3],t=256*t+A.source[A.sourceIndex+2],e!==(~t&65535))return YC;for(A.sourceIndex+=4,i=e;i;--i)A.dest[A.destLen++]=A.source[A.sourceIndex++];return A.bitcount=0,Qg}function mw(A,e){var t=new Ew(A,e),i,n,o;do{switch(i=fw(t),n=et(t,2,0),n){case 0:o=pw(t);break;case 1:o=$s(t,_C,KC);break;case 2:dw(t,t.ltree,t.dtree),o=$s(t,t.ltree,t.dtree);break;default:o=YC}if(o!==Qg)throw new Error("Data error")}while(!i);return t.destLenthis.x2&&(this.x2=A)),typeof e=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.y2&&(this.y2=e))};St.prototype.addX=function(A){this.addPoint(A,null)};St.prototype.addY=function(A){this.addPoint(null,A)};St.prototype.addBezier=function(A,e,t,i,n,o,r,g){var s=[A,e],a=[t,i],I=[n,o],l=[r,g];this.addPoint(A,e),this.addPoint(r,g);for(var C=0;C<=1;C++){var Q=6*s[C]-12*a[C]+6*I[C],E=-3*s[C]+9*a[C]-9*I[C]+3*l[C],f=3*a[C]-3*s[C];if(E===0){if(Q===0)continue;var h=-f/Q;0=0&&s>0&&(g+=" "),g+=e(a)}return g}for(var i="",n=0;n=0&&A<=255,"Byte value should be between 0 and 255."),[A]};wA.BYTE=je(1);oA.CHAR=function(A){return[A.charCodeAt(0)]};wA.CHAR=je(1);oA.CHARARRAY=function(A){typeof A>"u"&&(A="",console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));for(var e=[],t=0;t"u"?0:A.length};oA.USHORT=function(A){return[A>>8&255,A&255]};wA.USHORT=je(2);oA.SHORT=function(A){return A>=ea&&(A=-(2*ea-A)),[A>>8&255,A&255]};wA.SHORT=je(2);oA.UINT24=function(A){return[A>>16&255,A>>8&255,A&255]};wA.UINT24=je(3);oA.ULONG=function(A){return[A>>24&255,A>>16&255,A>>8&255,A&255]};wA.ULONG=je(4);oA.LONG=function(A){return A>=ta&&(A=-(2*ta-A)),[A>>24&255,A>>16&255,A>>8&255,A&255]};wA.LONG=je(4);oA.FIXED=oA.ULONG;wA.FIXED=wA.ULONG;oA.FWORD=oA.SHORT;wA.FWORD=wA.SHORT;oA.UFWORD=oA.USHORT;wA.UFWORD=wA.USHORT;oA.LONGDATETIME=function(A){return[0,0,0,0,A>>24&255,A>>16&255,A>>8&255,A&255]};wA.LONGDATETIME=je(8);oA.TAG=function(A){return mA.argument(A.length===4,"Tag should be exactly 4 ASCII characters."),[A.charCodeAt(0),A.charCodeAt(1),A.charCodeAt(2),A.charCodeAt(3)]};wA.TAG=je(4);oA.Card8=oA.BYTE;wA.Card8=wA.BYTE;oA.Card16=oA.USHORT;wA.Card16=wA.USHORT;oA.OffSize=oA.BYTE;wA.OffSize=wA.BYTE;oA.SID=oA.USHORT;wA.SID=wA.USHORT;oA.NUMBER=function(A){return A>=-107&&A<=107?[A+139]:A>=108&&A<=1131?(A=A-108,[(A>>8)+247,A&255]):A>=-1131&&A<=-108?(A=-A-108,[(A>>8)+251,A&255]):A>=-32768&&A<=32767?oA.NUMBER16(A):oA.NUMBER32(A)};wA.NUMBER=function(A){return oA.NUMBER(A).length};oA.NUMBER16=function(A){return[28,A>>8&255,A&255]};wA.NUMBER16=je(3);oA.NUMBER32=function(A){return[29,A>>24&255,A>>16&255,A>>8&255,A&255]};wA.NUMBER32=je(5);oA.REAL=function(A){var e=A.toString(),t=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);if(t){var i=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));e=(Math.round(A*i)/i).toString()}for(var n="",o=0,r=e.length;o>8&255,e[e.length]=i&255}return e};wA.UTF16=function(A){return A.length*2};var Rr={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};Ri.MACSTRING=function(A,e,t,i){var n=Rr[i];if(n!==void 0){for(var o="",r=0;r=128&&(o=t[o],o===void 0))return;i[n]=o}return i}};wA.MACSTRING=function(A,e){var t=oA.MACSTRING(A,e);return t!==void 0?t.length:0};function Nr(A){return A>=-128&&A<=127}function Dw(A,e,t){for(var i=0,n=A.length;e>8&255,s+256&255)}return o}oA.VARDELTAS=function(A){for(var e=0,t=[];e=-128&&i<=127?e=kw(A,e,t):e=vw(A,e,t)}return t};oA.INDEX=function(A){for(var e=1,t=[e],i=[],n=0;n>8,e[l+1]=C&255,e=e.concat(i[I])}return e};wA.TABLE=function(A){for(var e=0,t=A.fields.length,i=0;i0)return new T(this.data,this.offset+e).parseStruct(A)};T.prototype.parsePointer32=function(A){var e=this.parseOffset32();if(e>0)return new T(this.data,this.offset+e).parseStruct(A)};T.prototype.parseListOfLists=function(A){for(var e=this.parseOffset16List(),t=e.length,i=this.relativeOffset,n=new Array(t),o=0;o>1,e.skip("uShort",3),A.glyphIndexMap={};for(var r=new BA.Parser(t,i+n+14),g=new BA.Parser(t,i+n+16+o*2),s=new BA.Parser(t,i+n+16+o*4),a=new BA.Parser(t,i+n+16+o*6),I=i+n+16+o*8,l=0;l=0;n-=1){var o=BA.getUShort(A,e+4+n*8),r=BA.getUShort(A,e+4+n*8+2);if(o===3&&(r===0||r===1||r===10)||o===0&&(r===0||r===1||r===2||r===3||r===4)){i=BA.getULong(A,e+4+n*8+4);break}}if(i===-1)throw new Error("No valid cmap sub-tables found.");var g=new BA.Parser(A,e+i);if(t.format=g.parseUShort(),t.format===12)Lw(t,g);else if(t.format===4)Uw(t,g,A,e,i);else throw new Error("Only format 4 and 12 cmap tables are supported (found format "+t.format+").");return t}function xw(A,e,t){A.segments.push({end:e,start:e,delta:-(e-t),offset:0,glyphIndex:t})}function Jw(A){A.segments.push({end:65535,start:65535,delta:1,offset:0})}function Tw(A){var e=!0,t;for(t=A.length-1;t>0;t-=1){var i=A.get(t);if(i.unicode>65535){console.log("Adding CMAP format 12 (needed!)"),e=!1;break}}var n=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:e?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:e?12:20}];e||(n=n.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),n=n.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);var o=new aA.Table("cmap",n);for(o.segments=[],t=0;t>4,r=n&15;if(o===t||(e+=i[o],r===t))break;e+=i[r]}return parseFloat(e)}function $w(A,e){var t,i,n,o;if(e===28)return t=A.parseByte(),i=A.parseByte(),t<<8|i;if(e===29)return t=A.parseByte(),i=A.parseByte(),n=A.parseByte(),o=A.parseByte(),t<<24|i<<16|n<<8|o;if(e===30)return zw(A);if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return t=A.parseByte(),(e-247)*256+t+108;if(e>=251&&e<=254)return t=A.parseByte(),-(e-251)*256-t-108;throw new Error("Invalid b0 "+e)}function AD(A){for(var e={},t=0;t>1,s.length=0,I=!0}function N(G){for(var P,b,R,L,cA,dA,CA,iA,X,eA,fA,DA,Y=0;Y1&&!I&&(d=s.shift()+u,I=!0),Q+=s.pop(),w(C,Q);break;case 5:for(;s.length>0;)C+=s.shift(),Q+=s.shift(),g.lineTo(C,Q);break;case 6:for(;s.length>0&&(C+=s.shift(),g.lineTo(C,Q),s.length!==0);)Q+=s.shift(),g.lineTo(C,Q);break;case 7:for(;s.length>0&&(Q+=s.shift(),g.lineTo(C,Q),s.length!==0);)C+=s.shift(),g.lineTo(C,Q);break;case 8:for(;s.length>0;)i=C+s.shift(),n=Q+s.shift(),o=i+s.shift(),r=n+s.shift(),C=o+s.shift(),Q=r+s.shift(),g.curveTo(i,n,o,r,C,Q);break;case 10:cA=s.pop()+f,dA=E[cA],dA&&N(dA);break;case 11:return;case 12:switch(q=G[Y],Y+=1,q){case 35:i=C+s.shift(),n=Q+s.shift(),o=i+s.shift(),r=n+s.shift(),CA=o+s.shift(),iA=r+s.shift(),X=CA+s.shift(),eA=iA+s.shift(),fA=X+s.shift(),DA=eA+s.shift(),C=fA+s.shift(),Q=DA+s.shift(),s.shift(),g.curveTo(i,n,o,r,CA,iA),g.curveTo(X,eA,fA,DA,C,Q);break;case 34:i=C+s.shift(),n=Q,o=i+s.shift(),r=n+s.shift(),CA=o+s.shift(),iA=r,X=CA+s.shift(),eA=r,fA=X+s.shift(),DA=Q,C=fA+s.shift(),g.curveTo(i,n,o,r,CA,iA),g.curveTo(X,eA,fA,DA,C,Q);break;case 36:i=C+s.shift(),n=Q+s.shift(),o=i+s.shift(),r=n+s.shift(),CA=o+s.shift(),iA=r,X=CA+s.shift(),eA=r,fA=X+s.shift(),DA=eA+s.shift(),C=fA+s.shift(),g.curveTo(i,n,o,r,CA,iA),g.curveTo(X,eA,fA,DA,C,Q);break;case 37:i=C+s.shift(),n=Q+s.shift(),o=i+s.shift(),r=n+s.shift(),CA=o+s.shift(),iA=r+s.shift(),X=CA+s.shift(),eA=iA+s.shift(),fA=X+s.shift(),DA=eA+s.shift(),Math.abs(fA-C)>Math.abs(DA-Q)?C=fA+s.shift():Q=DA+s.shift(),g.curveTo(i,n,o,r,CA,iA),g.curveTo(X,eA,fA,DA,C,Q);break;default:console.log("Glyph "+e.index+": unknown operator 1200"+q),s.length=0}break;case 14:s.length>0&&!I&&(d=s.shift()+u,I=!0),l&&(g.closePath(),l=!1);break;case 18:F();break;case 19:case 20:F(),Y+=a+7>>3;break;case 21:s.length>2&&!I&&(d=s.shift()+u,I=!0),Q+=s.pop(),C+=s.pop(),w(C,Q);break;case 22:s.length>1&&!I&&(d=s.shift()+u,I=!0),C+=s.pop(),w(C,Q);break;case 23:F();break;case 24:for(;s.length>2;)i=C+s.shift(),n=Q+s.shift(),o=i+s.shift(),r=n+s.shift(),C=o+s.shift(),Q=r+s.shift(),g.curveTo(i,n,o,r,C,Q);C+=s.shift(),Q+=s.shift(),g.lineTo(C,Q);break;case 25:for(;s.length>6;)C+=s.shift(),Q+=s.shift(),g.lineTo(C,Q);i=C+s.shift(),n=Q+s.shift(),o=i+s.shift(),r=n+s.shift(),C=o+s.shift(),Q=r+s.shift(),g.curveTo(i,n,o,r,C,Q);break;case 26:for(s.length%2&&(C+=s.shift());s.length>0;)i=C,n=Q+s.shift(),o=i+s.shift(),r=n+s.shift(),C=o,Q=r+s.shift(),g.curveTo(i,n,o,r,C,Q);break;case 27:for(s.length%2&&(Q+=s.shift());s.length>0;)i=C+s.shift(),n=Q,o=i+s.shift(),r=n+s.shift(),C=o+s.shift(),Q=r,g.curveTo(i,n,o,r,C,Q);break;case 28:P=G[Y],b=G[Y+1],s.push((P<<24|b<<16)>>16),Y+=2;break;case 29:cA=s.pop()+A.gsubrsBias,dA=A.gsubrs[cA],dA&&N(dA);break;case 30:for(;s.length>0&&(i=C,n=Q+s.shift(),o=i+s.shift(),r=n+s.shift(),C=o+s.shift(),Q=r+(s.length===1?s.shift():0),g.curveTo(i,n,o,r,C,Q),s.length!==0);)i=C+s.shift(),n=Q,o=i+s.shift(),r=n+s.shift(),Q=r+s.shift(),C=o+(s.length===1?s.shift():0),g.curveTo(i,n,o,r,C,Q);break;case 31:for(;s.length>0&&(i=C+s.shift(),n=Q,o=i+s.shift(),r=n+s.shift(),Q=r+s.shift(),C=o+(s.length===1?s.shift():0),g.curveTo(i,n,o,r,C,Q),s.length!==0);)i=C,n=Q+s.shift(),o=i+s.shift(),r=n+s.shift(),C=o+s.shift(),Q=r+(s.length===1?s.shift():0),g.curveTo(i,n,o,r,C,Q);break;default:q<32?console.log("Glyph "+e.index+": unknown operator "+q):q<247?s.push(q-139):q<251?(P=G[Y],Y+=1,s.push((q-247)*256+P+108)):q<255?(P=G[Y],Y+=1,s.push(-(q-251)*256-P-108)):(P=G[Y],b=G[Y+1],R=G[Y+2],L=G[Y+3],Y+=4,s.push((P<<24|b<<16|R<<8|L)/65536))}}}return N(t),e.advanceWidth=d,g}function oD(A,e,t,i){var n=[],o,r=new BA.Parser(A,e),g=r.parseCard8();if(g===0)for(var s=0;s=i)throw new Error("CFF table CID Font FDSelect has bad FD index value "+o+" (FD count "+i+")");n.push(o)}else if(g===3){var a=r.parseCard16(),I=r.parseCard16();if(I!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+I);for(var l,C=0;C=i)throw new Error("CFF table CID Font FDSelect has bad FD index value "+o+" (FD count "+i+")");if(l>t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+l);for(;I=0&&(t=i),i=e.indexOf(A),i>=0?t=i+Vn.length:(t=Vn.length+e.length,e.push(A)),t}function gD(){return new aA.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function sD(A){var e=new aA.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);e.names=[];for(var t=0;t=t.begin&&A=1&&(t.ulCodePageRange1=i.parseULong(),t.ulCodePageRange2=i.parseULong()),t.version>=2&&(t.sxHeight=i.parseShort(),t.sCapHeight=i.parseShort(),t.usDefaultChar=i.parseUShort(),t.usBreakChar=i.parseUShort(),t.usMaxContent=i.parseUShort()),t}function xD(A){return new aA.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],A)}var xr={parse:MD,make:xD,unicodeRanges:Mr,getUnicodeRange:UD};function JD(A,e){var t={},i=new BA.Parser(A,e);switch(t.version=i.parseVersion(),t.italicAngle=i.parseFixed(),t.underlinePosition=i.parseShort(),t.underlineThickness=i.parseShort(),t.isFixedPitch=i.parseULong(),t.minMemType42=i.parseULong(),t.maxMemType42=i.parseULong(),t.minMemType1=i.parseULong(),t.maxMemType1=i.parseULong(),t.version){case 1:t.names=ii.slice();break;case 2:t.numberOfGlyphs=i.parseUShort(),t.glyphNameIndex=new Array(t.numberOfGlyphs);for(var n=0;n=ii.length){var r=i.parseChar();t.names.push(i.parseString(r))}break;case 2.5:t.numberOfGlyphs=i.parseUShort(),t.offset=new Array(t.numberOfGlyphs);for(var g=0;gl.value.tag?1:-1}),e.fields=e.fields.concat(i),e.fields=e.fields.concat(n),e}function Ba(A,e,t){for(var i=0;i0){var o=A.glyphs.get(n);return o.getMetrics()}}return t}function PD(A){for(var e=0,t=0;th||s===void 0)&&h>0&&(s=h),a 123 are reserved for internal usage");if(f.name!==".notdef"){var p=f.getMetrics();e.push(p.xMin),t.push(p.yMin),i.push(p.xMax),n.push(p.yMax),r.push(p.leftSideBearing),g.push(p.rightSideBearing),o.push(f.advanceWidth)}}var c={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,i),yMax:Math.max.apply(null,n),advanceWidthMax:Math.max.apply(null,o),advanceWidthAvg:PD(o),minLeftSideBearing:Math.min.apply(null,r),maxLeftSideBearing:Math.max.apply(null,r),minRightSideBearing:Math.min.apply(null,g)};c.ascender=A.ascender,c.descender=A.descender;var d=gl.make({flags:3,unitsPerEm:A.unitsPerEm,xMin:c.xMin,yMin:c.yMin,xMax:c.xMax,yMax:c.yMax,lowestRecPPEM:3,createdTimestamp:A.createdTimestamp}),w=sl.make({ascender:c.ascender,descender:c.descender,advanceWidthMax:c.advanceWidthMax,minLeftSideBearing:c.minLeftSideBearing,minRightSideBearing:c.minRightSideBearing,xMaxExtent:c.maxLeftSideBearing+(c.xMax-c.xMin),numberOfHMetrics:A.glyphs.length}),F=Cl.make(A.glyphs.length),N=xr.make(Object.assign({xAvgCharWidth:Math.round(c.advanceWidthAvg),usFirstCharIndex:s,usLastCharIndex:a,ulUnicodeRange1:I,ulUnicodeRange2:l,ulUnicodeRange3:C,ulUnicodeRange4:Q,sTypoAscender:c.ascender,sTypoDescender:c.descender,sTypoLineGap:0,usWinAscent:c.yMax,usWinDescent:Math.abs(c.yMin),ulCodePageRange1:1,sxHeight:Ba(A,"xyvw",{yMax:Math.round(c.ascender/2)}).yMax,sCapHeight:Ba(A,"HIKLEFJMNTZBDPRAGOQSUVWXY",c).yMax,usDefaultChar:A.hasChar(" ")?32:0,usBreakChar:A.hasChar(" ")?32:0},A.tables.os2)),G=al.make(A.glyphs),P=jC.make(A.glyphs),b=A.getEnglishName("fontFamily"),R=A.getEnglishName("fontSubfamily"),L=b+" "+R,cA=A.getEnglishName("postScriptName");cA||(cA=b.replace(/\s/g,"")+"-"+R);var dA={};for(var CA in A.names)dA[CA]=A.names[CA];dA.uniqueID||(dA.uniqueID={en:A.getEnglishName("manufacturer")+":"+L}),dA.postScriptName||(dA.postScriptName={en:cA}),dA.preferredFamily||(dA.preferredFamily=A.names.fontFamily),dA.preferredSubfamily||(dA.preferredSubfamily=A.names.fontSubfamily);var iA=[],X=El.make(dA,iA),eA=iA.length>0?Il.make(iA):void 0,fA=ul.make(),DA=rl.make(A.glyphs,{version:A.getEnglishName("version"),fullName:L,familyName:b,weightName:R,postScriptName:cA,unitsPerEm:A.unitsPerEm,fontBBox:[0,c.yMin,c.ascender,c.advanceWidthMax]}),Y=A.metas&&Object.keys(A.metas).length>0?fl.make(A.metas):void 0,q=[d,w,F,N,X,P,fA,DA,G];eA&&q.push(eA),A.tables.gsub&&q.push(hl.make(A.tables.gsub)),Y&&q.push(Y);for(var gA=dl(q),FA=gA.encode(),LA=dg(FA),TA=gA.fields,M=!1,Z=0;Z>>1,o=A[n].tag;if(o===e)return n;o>>1,o=A[n];if(o===e)return n;o>>1;t=A[o];var r=t.start;if(r===e)return t;r0)return t=A[i-1],e>t.end?0:t}function pn(A,e){this.font=A,this.tableName=e}pn.prototype={searchTag:Xo,binSearch:Qa,getTable:function(A){var e=this.font.tables[this.tableName];return!e&&A&&(e=this.font.tables[this.tableName]=this.createDefaultTable()),e},getScriptNames:function(){var A=this.getTable();return A?A.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){var A=this.getTable();if(A){for(var e=!1,t=0;t=0)return i[n].script;if(e){var o={tag:A,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return i.splice(-1-n,0,o),o.script}}},getLangSysTable:function(A,e,t){var i=this.getScriptTable(A,t);if(i){if(!e||e==="dflt"||e==="DFLT")return i.defaultLangSys;var n=Xo(i.langSysRecords,e);if(n>=0)return i.langSysRecords[n].langSys;if(t){var o={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return i.langSysRecords.splice(-1-n,0,o),o.langSys}}},getFeatureTable:function(A,e,t,i){var n=this.getLangSysTable(A,e,i);if(n){for(var o,r=n.featureIndexes,g=this.font.tables[this.tableName].features,s=0;s=g[a-1].tag,"Features must be added in alphabetical order."),o={tag:t,feature:{params:0,lookupListIndexes:[]}},g.push(o),r.push(a),o.feature}}},getLookupTables:function(A,e,t,i,n){var o=this.getFeatureTable(A,e,t,n),r=[];if(o){for(var g,s=o.lookupListIndexes,a=this.font.tables[this.tableName].lookups,I=0;I=0?t:-1;case 2:var i=ca(A.ranges,e);return i?i.index+e-i.start:-1}},expandCoverage:function(A){if(A.format===1)return A.glyphs;for(var e=[],t=A.ranges,i=0;i1,'Multiple: "by" must be an array of two or more ids');var n=this.getLookupTables(t,i,A,2,!0)[0],o=pg(n,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});mA.assert(o.coverage.format===1,"Multiple: unable to modify coverage table format "+o.coverage.format);var r=e.sub,g=this.binSearch(o.coverage.glyphs,r);g<0&&(g=-1-g,o.coverage.glyphs.splice(g,0,r),o.sequences.splice(g,0,0)),o.sequences[g]=e.by};Ge.prototype.addAlternate=function(A,e,t,i){var n=this.getLookupTables(t,i,A,3,!0)[0],o=pg(n,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});mA.assert(o.coverage.format===1,"Alternate: unable to modify coverage table format "+o.coverage.format);var r=e.sub,g=this.binSearch(o.coverage.glyphs,r);g<0&&(g=-1-g,o.coverage.glyphs.splice(g,0,r),o.alternateSets.splice(g,0,0)),o.alternateSets[g]=e.by};Ge.prototype.addLigature=function(A,e,t,i){var n=this.getLookupTables(t,i,A,4,!0)[0],o=n.subtables[0];o||(o={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},n.subtables[0]=o),mA.assert(o.coverage.format===1,"Ligature: unable to modify coverage table format "+o.coverage.format);var r=e.sub[0],g=e.sub.slice(1),s={ligGlyph:e.by,components:g},a=this.binSearch(o.coverage.glyphs,r);if(a>=0){for(var I=o.ligatureSets[a],l=0;l0?(o=A.parseByte(),e&n||(o=-o),o=t+o):(e&n)>0?o=t:o=t+A.parseShort(),o}function ml(A,e,t){var i=new BA.Parser(e,t);A.numberOfContours=i.parseShort(),A._xMin=i.parseShort(),A._yMin=i.parseShort(),A._xMax=i.parseShort(),A._yMax=i.parseShort();var n,o;if(A.numberOfContours>0){for(var r=A.endPointIndices=[],g=0;g0)for(var l=i.parseByte(),C=0;C0){var Q=[],E;if(a>0){for(var f=0;f=0,Q.push(E);for(var h=0,u=0;u0?(n&2)>0?(w.dx=i.parseShort(),w.dy=i.parseShort()):w.matchedPoints=[i.parseUShort(),i.parseUShort()]:(n&2)>0?(w.dx=i.parseChar(),w.dy=i.parseChar()):w.matchedPoints=[i.parseByte(),i.parseByte()],(n&8)>0?w.xScale=w.yScale=i.parseF2Dot14():(n&64)>0?(w.xScale=i.parseF2Dot14(),w.yScale=i.parseF2Dot14()):(n&128)>0&&(w.xScale=i.parseF2Dot14(),w.scale01=i.parseF2Dot14(),w.scale10=i.parseF2Dot14(),w.yScale=i.parseF2Dot14()),A.components.push(w),d=!!(n&32)}if(n&256){A.instructionLength=i.parseUShort(),A.instructions=[];for(var F=0;Fe.points.length-1||i.matchedPoints[1]>n.points.length-1)throw Error("Matched points out of range in "+e.name);var r=e.points[i.matchedPoints[0]],g=n.points[i.matchedPoints[1]],s={xScale:i.xScale,scale01:i.scale01,scale10:i.scale10,yScale:i.yScale,dx:0,dy:0};g=zo([g],s)[0],s.dx=r.x-g.x,s.dy=r.y-g.y,o=zo(n.points,s)}e.points=e.points.concat(o)}}return yl(e.points)}function XD(A,e,t,i){for(var n=new at.GlyphSet(i),o=0;o2)){var t=this.font,i=this._prepState;if(!i||i.ppem!==e){var n=this._fpgmState;if(!n){Ht.prototype=ok,n=this._fpgmState=new Ht("fpgm",t.tables.fpgm),n.funcs=[],n.font=t,exports.DEBUG&&(console.log("---EXEC FPGM---"),n.step=-1);try{ai(n)}catch(a){console.log("Hinting error in FPGM:"+a),this._errorState=3;return}}Ht.prototype=n,i=this._prepState=new Ht("prep",t.tables.prep),i.ppem=e;var o=t.tables.cvt;if(o)for(var r=i.cvt=new Array(o.length),g=e/t.unitsPerEm,s=0;s1))try{return vl(A,i)}catch(a){this._errorState<1&&(console.log("Hinting error:"+a),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}}};vl=function(A,e){var t=e.ppem/e.font.unitsPerEm,i=t,n=A.components,o,r,g;if(Ht.prototype=e,!n)g=new Ht("glyf",A.instructions),exports.DEBUG&&(console.log("---EXEC GLYPH---"),g.step=-1),Jr(A,g,t,i),r=g.gZone;else{var s=e.font;r=[],o=[];for(var a=0;a=176&&o<=183)i+=o-176+1;else if(o>=184&&o<=191)i+=(o-184+1)*2;else if(e&&n===1&&o===27)break;while(n>0);A.ip=i}function ua(A,e){exports.DEBUG&&console.log(e.step,"SVTCA["+A.axis+"]"),e.fv=e.pv=e.dpv=A}function ha(A,e){exports.DEBUG&&console.log(e.step,"SPVTCA["+A.axis+"]"),e.pv=e.dpv=A}function fa(A,e){exports.DEBUG&&console.log(e.step,"SFVTCA["+A.axis+"]"),e.fv=A}function da(A,e){var t=e.stack,i=t.pop(),n=t.pop(),o=e.z2[i],r=e.z1[n];exports.DEBUG&&console.log("SPVTL["+A+"]",i,n);var g,s;A?(g=o.y-r.y,s=r.x-o.x):(g=r.x-o.x,s=r.y-o.y),e.pv=e.dpv=wn(g,s)}function pa(A,e){var t=e.stack,i=t.pop(),n=t.pop(),o=e.z2[i],r=e.z1[n];exports.DEBUG&&console.log("SFVTL["+A+"]",i,n);var g,s;A?(g=o.y-r.y,s=r.x-o.x):(g=r.x-o.x,s=r.y-o.y),e.fv=wn(g,s)}function rk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"SPVFS[]",t,i),A.pv=A.dpv=wn(i,t)}function gk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"SPVFS[]",t,i),A.fv=wn(i,t)}function sk(A){var e=A.stack,t=A.pv;exports.DEBUG&&console.log(A.step,"GPV[]"),e.push(t.x*16384),e.push(t.y*16384)}function ak(A){var e=A.stack,t=A.fv;exports.DEBUG&&console.log(A.step,"GFV[]"),e.push(t.x*16384),e.push(t.y*16384)}function Ik(A){A.fv=A.pv,exports.DEBUG&&console.log(A.step,"SFVTPV[]")}function Ck(A){var e=A.stack,t=e.pop(),i=e.pop(),n=e.pop(),o=e.pop(),r=e.pop(),g=A.z0,s=A.z1,a=g[t],I=g[i],l=s[n],C=s[o],Q=A.z2[r];exports.DEBUG&&console.log("ISECT[], ",t,i,n,o,r);var E=a.x,f=a.y,h=I.x,u=I.y,p=l.x,c=l.y,d=C.x,w=C.y,F=(E-h)*(c-w)-(f-u)*(p-d),N=E*u-f*h,G=p*w-c*d;Q.x=(N*(p-d)-G*(E-h))/F,Q.y=(N*(c-w)-G*(f-u))/F}function lk(A){A.rp0=A.stack.pop(),exports.DEBUG&&console.log(A.step,"SRP0[]",A.rp0)}function Bk(A){A.rp1=A.stack.pop(),exports.DEBUG&&console.log(A.step,"SRP1[]",A.rp1)}function Qk(A){A.rp2=A.stack.pop(),exports.DEBUG&&console.log(A.step,"SRP2[]",A.rp2)}function ck(A){var e=A.stack.pop();switch(exports.DEBUG&&console.log(A.step,"SZP0[]",e),A.zp0=e,e){case 0:A.tZone||Go(A),A.z0=A.tZone;break;case 1:A.z0=A.gZone;break;default:throw new Error("Invalid zone pointer")}}function Ek(A){var e=A.stack.pop();switch(exports.DEBUG&&console.log(A.step,"SZP1[]",e),A.zp1=e,e){case 0:A.tZone||Go(A),A.z1=A.tZone;break;case 1:A.z1=A.gZone;break;default:throw new Error("Invalid zone pointer")}}function uk(A){var e=A.stack.pop();switch(exports.DEBUG&&console.log(A.step,"SZP2[]",e),A.zp2=e,e){case 0:A.tZone||Go(A),A.z2=A.tZone;break;case 1:A.z2=A.gZone;break;default:throw new Error("Invalid zone pointer")}}function hk(A){var e=A.stack.pop();switch(exports.DEBUG&&console.log(A.step,"SZPS[]",e),A.zp0=A.zp1=A.zp2=e,e){case 0:A.tZone||Go(A),A.z0=A.z1=A.z2=A.tZone;break;case 1:A.z0=A.z1=A.z2=A.gZone;break;default:throw new Error("Invalid zone pointer")}}function fk(A){A.loop=A.stack.pop(),exports.DEBUG&&console.log(A.step,"SLOOP[]",A.loop)}function dk(A){exports.DEBUG&&console.log(A.step,"RTG[]"),A.round=Sl}function pk(A){exports.DEBUG&&console.log(A.step,"RTHG[]"),A.round=tk}function mk(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"SMD[]",e),A.minDis=e/64}function yk(A){exports.DEBUG&&console.log(A.step,"ELSE[]"),Rl(A,!1)}function wk(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"JMPR[]",e),A.ip+=e-1}function Dk(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"SCVTCI[]",e),A.cvCutIn=e/64}function kk(A){var e=A.stack;exports.DEBUG&&console.log(A.step,"DUP[]"),e.push(e[e.length-1])}function $o(A){exports.DEBUG&&console.log(A.step,"POP[]"),A.stack.pop()}function vk(A){exports.DEBUG&&console.log(A.step,"CLEAR[]"),A.stack.length=0}function Fk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"SWAP[]"),e.push(t),e.push(i)}function Sk(A){var e=A.stack;exports.DEBUG&&console.log(A.step,"DEPTH[]"),e.push(e.length)}function bk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"LOOPCALL[]",t,i);var n=A.ip,o=A.prog;A.prog=A.funcs[t];for(var r=0;r1?"loop "+(e.loop-g)+": ":"")+"SHP["+(A?"rp1":"rp2")+"]",a)}e.loop=1}function Da(A,e){var t=e.stack,i=A?e.rp1:e.rp2,n=(A?e.z0:e.z1)[i],o=e.fv,r=e.pv,g=t.pop(),s=e.z2[e.contours[g]],a=s;exports.DEBUG&&console.log(e.step,"SHC["+A+"]",g);var I=r.distance(n,n,!1,!0);do a!==n&&o.setRelative(a,a,I,r),a=a.nextPointOnContour;while(a!==s)}function ka(A,e){var t=e.stack,i=A?e.rp1:e.rp2,n=(A?e.z0:e.z1)[i],o=e.fv,r=e.pv,g=t.pop();exports.DEBUG&&console.log(e.step,"SHZ["+A+"]",g);var s;switch(g){case 0:s=e.tZone;break;case 1:s=e.gZone;break;default:throw new Error("Invalid zone")}for(var a,I=r.distance(n,n,!1,!0),l=s.length-2,C=0;C1?"loop "+(A.loop-t)+": ":"")+"SHPIX[]",r,n),i.setRelative(g,g,n),i.touch(g)}A.loop=1}function Mk(A){for(var e=A.stack,t=A.rp1,i=A.rp2,n=A.loop,o=A.z0[t],r=A.z1[i],g=A.fv,s=A.dpv,a=A.z2;n--;){var I=e.pop(),l=a[I];exports.DEBUG&&console.log(A.step,(A.loop>1?"loop "+(A.loop-n)+": ":"")+"IP[]",I,t,"<->",i),g.interpolate(l,o,r,s),g.touch(l)}A.loop=1}function va(A,e){var t=e.stack,i=t.pop()/64,n=t.pop(),o=e.z1[n],r=e.z0[e.rp0],g=e.fv,s=e.pv;g.setRelative(o,r,i,s),g.touch(o),exports.DEBUG&&console.log(e.step,"MSIRP["+A+"]",i,n),e.rp1=e.rp0,e.rp2=n,A&&(e.rp0=n)}function xk(A){for(var e=A.stack,t=A.rp0,i=A.z0[t],n=A.loop,o=A.fv,r=A.pv,g=A.z1;n--;){var s=e.pop(),a=g[s];exports.DEBUG&&console.log(A.step,(A.loop>1?"loop "+(A.loop-n)+": ":"")+"ALIGNRP[]",s),o.setRelative(a,i,0,r),o.touch(a)}A.loop=1}function Jk(A){exports.DEBUG&&console.log(A.step,"RTDG[]"),A.round=ek}function Fa(A,e){var t=e.stack,i=t.pop(),n=t.pop(),o=e.z0[n],r=e.fv,g=e.pv,s=e.cvt[i];exports.DEBUG&&console.log(e.step,"MIAP["+A+"]",i,"(",s,")",n);var a=g.distance(o,ln);A&&(Math.abs(a-s)",g),e.stack.push(Math.round(g*64))}function Ok(A){exports.DEBUG&&console.log(A.step,"MPPEM[]"),A.stack.push(A.ppem)}function Vk(A){exports.DEBUG&&console.log(A.step,"FLIPON[]"),A.autoFlip=!0}function Wk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"LT[]",t,i),e.push(it?1:0)}function Zk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"GTEQ[]",t,i),e.push(i>=t?1:0)}function Xk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"EQ[]",t,i),e.push(t===i?1:0)}function zk(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"NEQ[]",t,i),e.push(t!==i?1:0)}function $k(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"ODD[]",t),e.push(Math.trunc(t)%2?1:0)}function Av(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"EVEN[]",t),e.push(Math.trunc(t)%2?0:1)}function ev(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"IF[]",e),e||(Rl(A,!0),exports.DEBUG&&console.log(A.step,"EIF[]"))}function tv(A){exports.DEBUG&&console.log(A.step,"EIF[]")}function iv(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"AND[]",t,i),e.push(t&&i?1:0)}function nv(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"OR[]",t,i),e.push(t||i?1:0)}function ov(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"NOT[]",t),e.push(t?0:1)}function Ar(A,e){var t=e.stack,i=t.pop(),n=e.fv,o=e.pv,r=e.ppem,g=e.deltaBase+(A-1)*16,s=e.deltaShift,a=e.z0;exports.DEBUG&&console.log(e.step,"DELTAP["+A+"]",i,t);for(var I=0;I>4);if(Q===r){var E=(C&15)-8;E>=0&&E++,exports.DEBUG&&console.log(e.step,"DELTAPFIX",l,"by",E*s);var f=a[l];n.setRelative(f,f,E*s,o)}}}function rv(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"SDB[]",t),A.deltaBase=t}function gv(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"SDS[]",t),A.deltaShift=Math.pow(.5,t)}function sv(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"ADD[]",t,i),e.push(i+t)}function av(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"SUB[]",t,i),e.push(i-t)}function Iv(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"DIV[]",t,i),e.push(i*64/t)}function Cv(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"MUL[]",t,i),e.push(i*t/64)}function lv(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"ABS[]",t),e.push(Math.abs(t))}function Bv(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"NEG[]",t),e.push(-t)}function Qv(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"FLOOR[]",t),e.push(Math.floor(t/64)*64)}function cv(A){var e=A.stack,t=e.pop();exports.DEBUG&&console.log(A.step,"CEILING[]",t),e.push(Math.ceil(t/64)*64)}function Mn(A,e){var t=e.stack,i=t.pop();exports.DEBUG&&console.log(e.step,"ROUND[]"),t.push(e.round(i/64)*64)}function Ev(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"WCVTF[]",t,i),A.cvt[i]=t*A.ppem/A.font.unitsPerEm}function er(A,e){var t=e.stack,i=t.pop(),n=e.ppem,o=e.deltaBase+(A-1)*16,r=e.deltaShift;exports.DEBUG&&console.log(e.step,"DELTAC["+A+"]",i,t);for(var g=0;g>4);if(I===n){var l=(a&15)-8;l>=0&&l++;var C=l*r;exports.DEBUG&&console.log(e.step,"DELTACFIX",s,"by",C),e.cvt[s]+=C}}}function uv(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"SROUND[]",e),A.round=bl;var t;switch(e&192){case 0:t=.5;break;case 64:t=1;break;case 128:t=2;break;default:throw new Error("invalid SROUND value")}switch(A.srPeriod=t,e&48){case 0:A.srPhase=0;break;case 16:A.srPhase=.25*t;break;case 32:A.srPhase=.5*t;break;case 48:A.srPhase=.75*t;break;default:throw new Error("invalid SROUND value")}e&=15,e===0?A.srThreshold=0:A.srThreshold=(e/8-.5)*t}function hv(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"S45ROUND[]",e),A.round=bl;var t;switch(e&192){case 0:t=Math.sqrt(2)/2;break;case 64:t=Math.sqrt(2);break;case 128:t=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(A.srPeriod=t,e&48){case 0:A.srPhase=0;break;case 16:A.srPhase=.25*t;break;case 32:A.srPhase=.5*t;break;case 48:A.srPhase=.75*t;break;default:throw new Error("invalid S45ROUND value")}e&=15,e===0?A.srThreshold=0:A.srThreshold=(e/8-.5)*t}function fv(A){exports.DEBUG&&console.log(A.step,"ROFF[]"),A.round=Ak}function dv(A){exports.DEBUG&&console.log(A.step,"RUTG[]"),A.round=ik}function pv(A){exports.DEBUG&&console.log(A.step,"RDTG[]"),A.round=nk}function mv(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"SCANCTRL[]",e)}function Ra(A,e){var t=e.stack,i=t.pop(),n=t.pop(),o=e.z2[i],r=e.z1[n];exports.DEBUG&&console.log(e.step,"SDPVTL["+A+"]",i,n);var g,s;A?(g=o.y-r.y,s=r.x-o.x):(g=r.x-o.x,s=r.y-o.y),e.dpv=wn(g,s)}function yv(A){var e=A.stack,t=e.pop(),i=0;exports.DEBUG&&console.log(A.step,"GETINFO[]",t),t&1&&(i=35),t&32&&(i|=4096),e.push(i)}function wv(A){var e=A.stack,t=e.pop(),i=e.pop(),n=e.pop();exports.DEBUG&&console.log(A.step,"ROLL[]"),e.push(i),e.push(t),e.push(n)}function Dv(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"MAX[]",t,i),e.push(Math.max(i,t))}function kv(A){var e=A.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(A.step,"MIN[]",t,i),e.push(Math.min(i,t))}function vv(A){var e=A.stack.pop();exports.DEBUG&&console.log(A.step,"SCANTYPE[]",e)}function Fv(A){var e=A.stack.pop(),t=A.stack.pop();switch(exports.DEBUG&&console.log(A.step,"INSTCTRL[]",e,t),e){case 1:A.inhibitGridFit=!!t;return;case 2:A.ignoreCvt=!!t;return;default:throw new Error("invalid INSTCTRL[] selector")}}function Rt(A,e){var t=e.stack,i=e.prog,n=e.ip;exports.DEBUG&&console.log(e.step,"PUSHB["+A+"]");for(var o=0;o=0?1:-1,h=Math.abs(h),A&&(p=o.cvt[g],i&&Math.abs(h-p)":"_")+(i?"R":"_")+(n===0?"Gr":n===1?"Bl":n===2?"Wh":"")+"]",A?g+"("+o.cvt[g]+","+p+")":"",s,"(d =",f,"->",u*h,")"),o.rp1=o.rp0,o.rp2=s,e&&(o.rp0=s)}kl=[ua.bind(void 0,pt),ua.bind(void 0,nt),ha.bind(void 0,pt),ha.bind(void 0,nt),fa.bind(void 0,pt),fa.bind(void 0,nt),da.bind(void 0,0),da.bind(void 0,1),pa.bind(void 0,0),pa.bind(void 0,1),rk,gk,sk,ak,Ik,Ck,lk,Bk,Qk,ck,Ek,uk,hk,fk,dk,pk,mk,yk,wk,Dk,void 0,void 0,kk,$o,vk,Fk,Sk,Nk,Gk,void 0,void 0,void 0,bk,Rk,Lk,void 0,ma.bind(void 0,0),ma.bind(void 0,1),ya.bind(void 0,pt),ya.bind(void 0,nt),wa.bind(void 0,0),wa.bind(void 0,1),Da.bind(void 0,0),Da.bind(void 0,1),ka.bind(void 0,0),ka.bind(void 0,1),Uk,Mk,va.bind(void 0,0),va.bind(void 0,1),xk,Jk,Fa.bind(void 0,0),Fa.bind(void 0,1),Tk,Hk,Yk,_k,Kk,Pk,Sa.bind(void 0,0),Sa.bind(void 0,1),void 0,ba.bind(void 0,0),ba.bind(void 0,1),Ok,void 0,Vk,void 0,void 0,Wk,qk,jk,Zk,Xk,zk,$k,Av,ev,tv,iv,nv,ov,Ar.bind(void 0,1),rv,gv,sv,av,Iv,Cv,lv,Bv,Qv,cv,Mn.bind(void 0,0),Mn.bind(void 0,1),Mn.bind(void 0,2),Mn.bind(void 0,3),void 0,void 0,void 0,void 0,Ev,Ar.bind(void 0,2),Ar.bind(void 0,3),er.bind(void 0,1),er.bind(void 0,2),er.bind(void 0,3),uv,hv,void 0,void 0,fv,void 0,dv,pv,$o,$o,void 0,void 0,void 0,void 0,void 0,mv,Ra.bind(void 0,0),Ra.bind(void 0,1),yv,void 0,wv,Dv,kv,vv,Fv,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,Rt.bind(void 0,1),Rt.bind(void 0,2),Rt.bind(void 0,3),Rt.bind(void 0,4),Rt.bind(void 0,5),Rt.bind(void 0,6),Rt.bind(void 0,7),Rt.bind(void 0,8),Nt.bind(void 0,1),Nt.bind(void 0,2),Nt.bind(void 0,3),Nt.bind(void 0,4),Nt.bind(void 0,5),Nt.bind(void 0,6),Nt.bind(void 0,7),Nt.bind(void 0,8),lA.bind(void 0,0,0,0,0,0),lA.bind(void 0,0,0,0,0,1),lA.bind(void 0,0,0,0,0,2),lA.bind(void 0,0,0,0,0,3),lA.bind(void 0,0,0,0,1,0),lA.bind(void 0,0,0,0,1,1),lA.bind(void 0,0,0,0,1,2),lA.bind(void 0,0,0,0,1,3),lA.bind(void 0,0,0,1,0,0),lA.bind(void 0,0,0,1,0,1),lA.bind(void 0,0,0,1,0,2),lA.bind(void 0,0,0,1,0,3),lA.bind(void 0,0,0,1,1,0),lA.bind(void 0,0,0,1,1,1),lA.bind(void 0,0,0,1,1,2),lA.bind(void 0,0,0,1,1,3),lA.bind(void 0,0,1,0,0,0),lA.bind(void 0,0,1,0,0,1),lA.bind(void 0,0,1,0,0,2),lA.bind(void 0,0,1,0,0,3),lA.bind(void 0,0,1,0,1,0),lA.bind(void 0,0,1,0,1,1),lA.bind(void 0,0,1,0,1,2),lA.bind(void 0,0,1,0,1,3),lA.bind(void 0,0,1,1,0,0),lA.bind(void 0,0,1,1,0,1),lA.bind(void 0,0,1,1,0,2),lA.bind(void 0,0,1,1,0,3),lA.bind(void 0,0,1,1,1,0),lA.bind(void 0,0,1,1,1,1),lA.bind(void 0,0,1,1,1,2),lA.bind(void 0,0,1,1,1,3),lA.bind(void 0,1,0,0,0,0),lA.bind(void 0,1,0,0,0,1),lA.bind(void 0,1,0,0,0,2),lA.bind(void 0,1,0,0,0,3),lA.bind(void 0,1,0,0,1,0),lA.bind(void 0,1,0,0,1,1),lA.bind(void 0,1,0,0,1,2),lA.bind(void 0,1,0,0,1,3),lA.bind(void 0,1,0,1,0,0),lA.bind(void 0,1,0,1,0,1),lA.bind(void 0,1,0,1,0,2),lA.bind(void 0,1,0,1,0,3),lA.bind(void 0,1,0,1,1,0),lA.bind(void 0,1,0,1,1,1),lA.bind(void 0,1,0,1,1,2),lA.bind(void 0,1,0,1,1,3),lA.bind(void 0,1,1,0,0,0),lA.bind(void 0,1,1,0,0,1),lA.bind(void 0,1,1,0,0,2),lA.bind(void 0,1,1,0,0,3),lA.bind(void 0,1,1,0,1,0),lA.bind(void 0,1,1,0,1,1),lA.bind(void 0,1,1,0,1,2),lA.bind(void 0,1,1,0,1,3),lA.bind(void 0,1,1,1,0,0),lA.bind(void 0,1,1,1,0,1),lA.bind(void 0,1,1,1,0,2),lA.bind(void 0,1,1,1,0,3),lA.bind(void 0,1,1,1,1,0),lA.bind(void 0,1,1,1,1,1),lA.bind(void 0,1,1,1,1,2),lA.bind(void 0,1,1,1,1,3)];function Mi(A){this.char=A,this.state={},this.activeState=null}function mg(A,e,t){this.contextName=t,this.startIndex=A,this.endOffset=e}function Sv(A,e,t){this.contextName=A,this.openRange=null,this.ranges=[],this.checkStart=e,this.checkEnd=t}function Ve(A,e){this.context=A,this.index=e,this.length=A.length,this.current=A[e],this.backtrack=A.slice(0,e),this.lookahead=A.slice(e+1)}function Lo(A){this.eventId=A,this.subscribers=[]}function bv(A){var e=this,t=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];t.forEach(function(n){Object.defineProperty(e.events,n,{value:new Lo(n)})}),A&&t.forEach(function(n){var o=A[n];typeof o=="function"&&e.events[n].subscribe(o)});var i=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];i.forEach(function(n){e.events[n].subscribe(e.updateContextsRanges)})}function $A(A){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],bv.call(this,A)}Mi.prototype.setState=function(A,e){return this.state[A]=e,this.activeState={key:A,value:this.state[A]},this.activeState};Mi.prototype.getState=function(A){return this.state[A]||null};$A.prototype.inboundIndex=function(A){return A>=0&&A0&&A<=this.lookahead.length):return this.lookahead[A-1];default:return null}};$A.prototype.rangeToText=function(A){if(A instanceof mg)return this.getRangeTokens(A).map(function(e){return e.char}).join("")};$A.prototype.getText=function(){return this.tokens.map(function(A){return A.char}).join("")};$A.prototype.getContext=function(A){var e=this.registeredContexts[A];return e||null};$A.prototype.on=function(A,e){var t=this.events[A];return t?t.subscribe(e):null};$A.prototype.dispatch=function(A,e){var t=this,i=this.events[A];i instanceof Lo&&i.subscribers.forEach(function(n){n.apply(t,e||[])})};$A.prototype.registerContextChecker=function(A,e,t){if(this.getContext(A))return{FAIL:"context name '"+A+"' is already registered."};if(typeof e!="function")return{FAIL:"missing context start check."};if(typeof t!="function")return{FAIL:"missing context end check."};var i=new Sv(A,e,t);return this.registeredContexts[A]=i,this.contextCheckers.push(i),i};$A.prototype.getRangeTokens=function(A){var e=A.startIndex+A.endOffset;return[].concat(this.tokens.slice(A.startIndex,e))};$A.prototype.getContextRanges=function(A){var e=this.getContext(A);return e?e.ranges:{FAIL:"context checker '"+A+"' is not registered."}};$A.prototype.resetContextsRanges=function(){var A=this.registeredContexts;for(var e in A)if(A.hasOwnProperty(e)){var t=A[e];t.ranges=[]}};$A.prototype.updateContextsRanges=function(){this.resetContextsRanges();for(var A=this.tokens.map(function(i){return i.char}),e=0;e=n.start&&A<=n.end){var o=A-n.start;return n.index+o}}break;default:return-1}return-1}function Nv(A,e){var t=Dn(A,e.coverage);return t===-1?null:A+e.deltaGlyphId}function Gv(A,e){var t=Dn(A,e.coverage);return t===-1?null:e.substitute[t]}function tr(A,e){for(var t=[],i=0;i=0;t--){var i=e[t],n=Nl(i),o=Ot(i);if(!n&&!o)return!0;if(n)return!1}return!1}function qv(A){if(Nl(A.current))return!1;for(var e=0;e0}t("fontFamily"),t("weightName"),t("manufacturer"),t("copyright"),t("version"),this.unitsPerEm>0};_A.prototype.toTables=function(){return VD.fontToTable(this)};_A.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()};_A.prototype.toArrayBuffer=function(){for(var A=this.toTables(),e=A.encode(),t=new ArrayBuffer(e.length),i=new Uint8Array(t),n=0;n=1.2&&(n.markGlyphSets=t.parsePointer(uF)),n}var fF={parse:hF},We=new Array(10);We[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{posFormat:1,coverage:this.parsePointer(T.coverage),value:this.parseValueRecord()};if(t===2)return{posFormat:2,coverage:this.parsePointer(T.coverage),values:this.parseValueRecordList()};mA.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")};We[2]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();mA.assert(t===1||t===2,"0x"+e.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");var i=this.parsePointer(T.coverage),n=this.parseUShort(),o=this.parseUShort();if(t===1)return{posFormat:t,coverage:i,valueFormat1:n,valueFormat2:o,pairSets:this.parseList(T.pointer(T.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(n),value2:this.parseValueRecord(o)}})))};if(t===2){var r=this.parsePointer(T.classDef),g=this.parsePointer(T.classDef),s=this.parseUShort(),a=this.parseUShort();return{posFormat:t,coverage:i,valueFormat1:n,valueFormat2:o,classDef1:r,classDef2:g,class1Count:s,class2Count:a,classRecords:this.parseList(s,T.list(a,function(){return{value1:this.parseValueRecord(n),value2:this.parseValueRecord(o)}}))}}};We[3]=function(){return{error:"GPOS Lookup 3 not supported"}};We[4]=function(){return{error:"GPOS Lookup 4 not supported"}};We[5]=function(){return{error:"GPOS Lookup 5 not supported"}};We[6]=function(){return{error:"GPOS Lookup 6 not supported"}};We[7]=function(){return{error:"GPOS Lookup 7 not supported"}};We[8]=function(){return{error:"GPOS Lookup 8 not supported"}};We[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function dF(A,e){e=e||0;var t=new T(A,e),i=t.parseVersion(1);return mA.argument(i===1||i===1.1,"Unsupported GPOS table version "+i),i===1?{version:i,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(We)}:{version:i,scripts:t.parseScriptList(),features:t.parseFeatureList(),lookups:t.parseLookupList(We),variations:t.parseFeatureVariationsList()}}var pF=new Array(10);function mF(A){return new aA.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new aA.ScriptList(A.scripts)},{name:"features",type:"TABLE",value:new aA.FeatureList(A.features)},{name:"lookups",type:"TABLE",value:new aA.LookupList(A.lookups,pF)}])}var yF={parse:dF,make:mF};function wF(A){var e={};A.skip("uShort");var t=A.parseUShort();mA.argument(t===0,"Unsupported kern sub-table version."),A.skip("uShort",2);var i=A.parseUShort();A.skip("uShort",3);for(var n=0;n1&&console.warn("Only the first kern subtable is supported."),A.skip("uLong");var i=A.parseUShort(),n=i&255;if(A.skip("uShort"),n===0){var o=A.parseUShort();A.skip("uShort",3);for(var r=0;r"u",n=i&&!t.isUrl?bF:RF;return new Promise(function(o,r){n(A,function(g,s){if(g){if(e)return e(g);r(g)}var a;try{a=Dg(s,t)}catch(I){if(e)return e(I,null);r(I)}if(e)return e(null,a);o(a)})})}function LF(A,e){var t=require("fs"),i=t.readFileSync(A);return Dg(pl(i),e)}var Tr=Object.freeze({__proto__:null,Font:_A,Glyph:Ne,Path:ne,BoundingBox:St,_parse:BA,parse:Dg,load:GF,loadSync:LF});const UF="modulepreload",MF=function(A,e){return new URL(A,e).href},Ma={},Ll=function(e,t,i){let n=Promise.resolve();if(t&&t.length>0){const r=document.getElementsByTagName("link"),g=document.querySelector("meta[property=csp-nonce]"),s=(g==null?void 0:g.nonce)||(g==null?void 0:g.getAttribute("nonce"));n=Promise.allSettled(t.map(a=>{if(a=MF(a,i),a in Ma)return;Ma[a]=!0;const I=a.endsWith(".css"),l=I?'[rel="stylesheet"]':"";if(!!i)for(let E=r.length-1;E>=0;E--){const f=r[E];if(f.href===a&&(!I||f.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${l}`))return;const Q=document.createElement("link");if(Q.rel=I?"stylesheet":UF,I||(Q.as="script"),Q.crossOrigin="",Q.href=a,s&&Q.setAttribute("nonce",s),document.head.appendChild(Q),I)return new Promise((E,f)=>{Q.addEventListener("load",E),Q.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${a}`)))})}))}function o(r){const g=new Event("vite:preloadError",{cancelable:!0});if(g.payload=r,window.dispatchEvent(g),!g.defaultPrevented)throw r}return n.then(r=>{for(const g of r||[])g.status==="rejected"&&o(g.reason);return e().catch(o)})},xF=()=>Ll(()=>import("./ft_render-ByO_jG18.js"),[],import.meta.url);let j=null,Bn=0;const JF=new Promise(A=>{xF().then(e=>{e.default().then(t=>{j=t,A()})})});function xa(A){return A/65536}function Ue(A){return A/64}function Yi(A){return A>=0?A:A+256}let Ul,Ml,xl,kg,Jl,Tl,Hl;async function TF(){if(await JF,j._init_constants(),Ul=j.cwrap("FT_New_Memory_Face","number",["number","number","number","number","number"]),Ml=j.cwrap("FT_Set_Char_Size","number",["number","number","number","number","number"]),xl=j.cwrap("FT_Set_Pixel_Sizes","number",["number","number","number"]),kg=j.cwrap("FT_Get_Char_Index","number",["number","number"]),Jl=j.cwrap("FT_Load_Glyph","number",["number","number","number"]),Tl=j.cwrap("FT_Get_Sfnt_Table","number",["number","number"]),j.cwrap("FT_Get_Kerning","number",["number","number","number","number","number"]),Hl=j.cwrap("FT_Done_Face","number",["number"]),!Bn){let A=j._malloc(4);try{let e=j.ccall("FT_Init_FreeType","number",["number"],[A]);if(e)throw new Error(`error in FT_Init_FreeType: ${e}`);Bn=j.getValue(A,"i32")}finally{j._free(A)}}}function HF(A,e){let t,i;if(A instanceof ArrayBuffer)i=A.byteLength;else if(A instanceof Uint8Array)i=A.byteLength;else if(A&&typeof A.length=="number")i=A.length;else throw new Error("Invalid font source format");let n={ptr:0,font:j._malloc(i)};const o=A instanceof ArrayBuffer?new Uint8Array(A):A;j.writeArrayToMemory(o,n.font);let r=j._malloc(4);try{if(t=Ul(Bn,n.font,i,0,r),t)throw new Error(`error in FT_New_Memory_Face: ${t}`);n.ptr=j.getValue(r,"i32")}finally{j._free(r)}if(t=Ml(n.ptr,0,e*64,300,300),t)throw new Error(`error in FT_Set_Char_Size: ${t}`);if(t=xl(n.ptr,0,e),t)throw new Error(`error in FT_Set_Pixel_Sizes: ${t}`);let g=j.getValue(n.ptr+j.OFFSET_FACE_UNITS_PER_EM,"i16"),s=j.getValue(n.ptr+j.OFFSET_FACE_ASCENDER,"i16"),a=j.getValue(n.ptr+j.OFFSET_FACE_DESCENDER,"i16"),I=j.getValue(n.ptr+j.OFFSET_FACE_HEIGHT,"i16");return Object.assign(n,{units_per_em:g,ascender:s,descender:a,height:I})}function YF(A){let e=Tl(A.ptr,j.FT_SFNT_OS2);if(!e)throw new Error("os/2 table not found for this font");let t=j.getValue(e+j.OFFSET_TT_OS2_ASCENDER,"i16"),i=j.getValue(e+j.OFFSET_TT_OS2_DESCENDER,"i16"),n=j.getValue(e+j.OFFSET_TT_OS2_LINEGAP,"i16");return{typoAscent:t,typoDescent:i,typoLineGap:n}}function nr(A,e){return kg(A.ptr,e)!==0}function _F(A,e,t={}){let i=kg(A.ptr,e);if(i===0)throw new Error(`glyph does not exist for codepoint ${e}`);let n=j.FT_LOAD_RENDER;t.mono?n|=j.FT_LOAD_TARGET_MONO:t.lcd?n|=j.FT_LOAD_TARGET_LCD:t.lcd_v?n|=j.FT_LOAD_TARGET_LCD_V:t.autohint_strong?n|=j.FT_LOAD_TARGET_NORMAL:n|=j.FT_LOAD_TARGET_LIGHT,t.autohint_off?n|=j.FT_LOAD_NO_AUTOHINT:n|=j.FT_LOAD_FORCE_AUTOHINT,t.use_color_info&&(n|=j.FT_LOAD_COLOR);let o=Jl(A.ptr,i,n);if(o)throw new Error(`error in FT_Load_Glyph: ${o}`);let r=j.getValue(A.ptr+j.OFFSET_FACE_GLYPH,"i32"),g={glyph_index:j.getValue(r+j.OFFSET_GLYPH_INDEX,"i32"),metrics:{width:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_WIDTH,"i32")),height:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_HEIGHT,"i32")),horiBearingX:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_HORI_BEARING_X,"i32")),horiBearingY:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_HORI_BEARING_Y,"i32")),horiAdvance:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_HORI_ADVANCE,"i32")),vertBearingX:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_VERT_BEARING_X,"i32")),vertBearingY:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_VERT_BEARING_Y,"i32")),vertAdvance:Ue(j.getValue(r+j.OFFSET_GLYPH_METRICS_VERT_ADVANCE,"i32"))},linearHoriAdvance:xa(j.getValue(r+j.OFFSET_GLYPH_LINEAR_HORI_ADVANCE,"i32")),linearVertAdvance:xa(j.getValue(r+j.OFFSET_GLYPH_LINEAR_VERT_ADVANCE,"i32")),advance:{x:Ue(j.getValue(r+j.OFFSET_GLYPH_ADVANCE_X,"i32")),y:Ue(j.getValue(r+j.OFFSET_GLYPH_ADVANCE_Y,"i32"))},bitmap:{width:j.getValue(r+j.OFFSET_GLYPH_BITMAP_WIDTH,"i32"),rows:j.getValue(r+j.OFFSET_GLYPH_BITMAP_ROWS,"i32"),pitch:j.getValue(r+j.OFFSET_GLYPH_BITMAP_PITCH,"i32"),num_grays:j.getValue(r+j.OFFSET_GLYPH_BITMAP_NUM_GRAYS,"i16"),pixel_mode:j.getValue(r+j.OFFSET_GLYPH_BITMAP_PIXEL_MODE,"i8"),palette_mode:j.getValue(r+j.OFFSET_GLYPH_BITMAP_PALETTE_MODE,"i8")},bitmap_left:j.getValue(r+j.OFFSET_GLYPH_BITMAP_LEFT,"i32"),bitmap_top:j.getValue(r+j.OFFSET_GLYPH_BITMAP_TOP,"i32"),lsb_delta:Ue(j.getValue(r+j.OFFSET_GLYPH_LSB_DELTA,"i32")),rsb_delta:Ue(j.getValue(r+j.OFFSET_GLYPH_RSB_DELTA,"i32"))},s=g.bitmap.width,a=g.bitmap.rows,I=g.bitmap_left,l=g.bitmap_top,C=j.getValue(r+j.OFFSET_GLYPH_BITMAP_BUFFER,"i32"),Q=Math.abs(g.bitmap.pitch),E=g.linearHoriAdvance,f=g.linearVertAdvance,h=g.bitmap.pixel_mode,u=[];for(let p=0;p255&&(b=255),P=(255-b)*P/255,d.push(P)}else{let F=j.getValue(c+w,"i8");d.push(Yi(F))}u.push(d)}return{x:I,y:l,width:s,height:a,advance_x:E,advance_y:f,pixels:u,freetype:g}}function KF(A){let e=Hl(A.ptr);if(e)throw new Error(`error in FT_Done_Face: ${e}`);j._free(A.font),A.ptr=0,A.font=0}function PF(){let A=j.ccall("FT_Done_FreeType","number",["number"],[Bn]);if(A)throw new Error(`error in FT_Done_FreeType: ${A}`);Bn=0}class yt extends Error{constructor(e){super(e),this.name="AppError",Error.captureStackTrace&&Error.captureStackTrace(this,yt)}}class OF{constructor(){this.data={}}add_range(e,t,i,n){let o=n-t,r=[];for(let g=t;g<=i;g++)this._set_char(e,g,g+o),r.push(g);return r}add_symbols(e,t){let i=[];for(let n of t){let o=n.codePointAt(0);this._set_char(e,o,o),i.push(o)}return i}_set_char(e,t,i){this.data[i]={font:e,code:t}}get(){return this.data}}async function VF(A){await TF();let e={};A.font.forEach(C=>{e[C.source_path]=C});let t={},i={};for(let{source_path:C,source_bin:Q}of A.font)if(!t[C])try{let E=Q;E instanceof File?E=await E.arrayBuffer():E instanceof Uint8Array&&(E=E.buffer.slice(E.byteOffset,E.byteOffset+E.byteLength)),t[C]=Tr.parse(E),i[C]=HF(E,A.size)}catch(E){throw new yt(`Cannot load font "${C}": ${E.message}`)}let n=new OF;for(let{source_path:C,ranges:Q}of A.font){let E=i[C];for(let f of Q){if(f.range)for(let h=0;hC-Q).map(Number);for(let C of g){let Q=o[C].code,E=o[C].font;if(!nr(i[E],Q))continue;let f=_F(i[E],Q,{autohint_off:e[E].autohint_off,autohint_strong:e[E].autohint_strong,lcd:A.lcd,lcd_v:A.lcd_v,mono:!A.lcd&&!A.lcd_v&&A.bpp===1,use_color_info:A.use_color_info});r.push({code:C,advanceWidth:f.advance_x,bbox:{x:f.x,y:f.y-f.height,width:f.width,height:f.height},kerning:{},freetype:f.freetype,pixels:f.pixels})}if(!A.no_kerning){let C=r.map(Q=>Q.code);for(let{code:Q,kerning:E}of r){let f=o[Q].code,h=o[Q].font,u=t[h],p=u.charToGlyph(String.fromCodePoint(f));for(let c of C){if(o[c].font!==h)continue;let d=o[c].code,w=u.charToGlyph(String.fromCodePoint(d)),F=u.getKerningValue(p,w);F&&(E[c]=F*A.size/u.unitsPerEm)}}}let s=i[A.font[0].source_path],a=A.size/s.units_per_em,I=YF(s),l=t[A.font[0].source_path].tables.post;for(let C of Object.values(i))KF(C);return PF(),{ascent:Math.max(...r.map(C=>C.bbox.y+C.bbox.height)),descent:Math.min(...r.map(C=>C.bbox.y)),typoAscent:Math.round(I.typoAscent*a),typoDescent:Math.round(I.typoDescent*a),typoLineGap:Math.round(I.typoLineGap*a),size:A.size,glyphs:r,underlinePosition:Math.round(l.underlinePosition*a),underlineThickness:Math.round(l.underlineThickness*a)}}function WF(){return 16}function qF(A,e){return 16+(e-A+1)}function jF(A){return 16+A*2}function Ja(A){A=A.sort((i,n)=>i-n);let e=[];for(let i=0;i=0?e[o-1].dist:0,g;A[i]-A[o]<256&&(g=qF(A[o],A[i]),r+g=0;){let n=e[i];t.unshift([n.format,A.slice(n.start,n.end+1)]),i=n.start-1}return t}const De=4,ZF=(A,e,t)=>{A.setUint32(t,e,!0),A.setUint32(t+4,0,!0)};class XF{constructor(e,t){if(this.src=e,this.opts=t,this.font_name=t.lv_font_name,this.font_name||(this.font_name=t.output||"font"),t.bpp===3&&t.no_compress)throw new yt('LVGL supports "--bpp 3" with compression only');this.init_tables()}init_tables(){this.head=new zF(this),this.glyf=new AS(this),this.cmap=new eS(this),this.kern=new tS(this)}toCBin(){const[e,t]=this.glyf.toCBin(),i=this.cmap.toCBin(De),n=this.kern.toCBin(De),o=12+De*6+0,r=8+De*4,g=new ArrayBuffer(o+r),s=new DataView(g),a=(h,u)=>s.setUint32(u,h,!0);var I=0;a(0,I),I+=De,a(0,I),I+=De,a(0,I),I+=De,s.setUint32(I,this.src.ascent-this.src.descent,!0),I+=4,s.setInt32(I,-this.src.descent,!0),I+=4,s.setUint8(I,this.src.subpixels_mode||0),I+=1,s.setInt8(I,this.src.underlinePosition||0),I+=1,s.setInt8(I,this.src.underlineThickness||0),I+=1,I+=1,a(o,I),I+=De,a(0,I),I+=De,a(0,I),I+=De;const l=this.head.kern_ref();a(r+n.byteLength,I),I+=De,a(r+n.byteLength+e.byteLength,I),I+=De,a(r+n.byteLength+e.byteLength+t.byteLength,I),I+=De,a(l.dsc==="NULL"?0:r,I),I+=De,s.setUint16(I,l.scale,!0),I+=2;const C=this.cmap.getMapNumber(),Q=this.opts.bpp,E=l.classes,f=this.glyf.getCompressionCode();return s.setUint16(I,C|Q<<9|E<<13|f<<14,!0),I+=2,this.concatArrayBuffers([g,n,e,t,i])}concatArrayBuffers(e){const t=e.reduce((r,g)=>r+g.byteLength,0),i=new ArrayBuffer(t),n=new Uint8Array(i);let o=0;for(const r of e)n.set(new Uint8Array(r),o),o+=r.byteLength;return i}}class zF{constructor(e){this.font=e}kern_ref(){return this.font,{scale:0,dsc:"NULL",classes:0}}}class $F{constructor(e){this.buffer=new Uint8Array(e),this.byteIndex=0,this.bitIndex=0,this.bigEndian=!0}writeBits(e,t){for(;t>0;){const i=Math.min(8-this.bitIndex,t),n=(1<>t-i&n;this.bigEndian?this.buffer[this.byteIndex]|=o<<8-this.bitIndex-i:this.buffer[this.byteIndex]|=o<=8&&(this.byteIndex++,this.bitIndex=0),t-=i}}getUsedBytes(){return this.bitIndex>0?this.byteIndex+1:this.byteIndex}}class AS{constructor(e){this.font=e,this.lv_data=[],this.lv_compiled=!1}pixelsToBpp(e){const t=this.font.opts.bpp;return e.map(i=>i.map(n=>n>>>8-t))}storePixels(e,t){this.getCompressionCode()===0?this.storePixelsRaw(e,t):this.storePixelsCompressed(e,t)}storePixelsRaw(e,t){const i=this.font.opts.bpp;for(let n=0;n{const n=e.glyph_id[i.code],o=this.lv_bitmap(i);this.lv_data[n]={bin:o,offset:t,glyph:i},t+=o.byteLength})}toCBin(){this.lv_compile();const e=this.lv_data.slice(1).filter(r=>r).map(r=>r.bin),t=this.balign4(this.concatArrayBuffers(e)),i=new ArrayBuffer(this.lv_data.length*16+16),n=new DataView(i);let o=1;return this.lv_data.forEach(r=>{if(r){const g=Math.round(r.glyph.advanceWidth*16);n.setUint32(o*16,r.offset,!0),n.setUint32(o*16+4,g,!0),n.setUint16(o*16+8,r.glyph.bbox.width,!0),n.setUint16(o*16+10,r.glyph.bbox.height,!0),n.setInt16(o*16+12,r.glyph.bbox.x,!0),n.setInt16(o*16+14,r.glyph.bbox.y,!0)}o++}),[t,i]}balign4(e){const t=e.byteLength%4;if(t===0)return e;const i=4-t,n=new ArrayBuffer(i);return this.concatArrayBuffers([e,n])}concatArrayBuffers(e){const t=e.reduce((r,g)=>r+g.byteLength,0),i=new ArrayBuffer(t),n=new Uint8Array(i);let o=0;for(const r of e)n.set(new Uint8Array(r),o),o+=r.byteLength;return i}getCompressionCode(){return this.font.opts.no_compress||this.font.opts.bpp===1?0:this.font.opts.no_prefilter?2:1}}class eS{constructor(e){this.font=e,this.lv_compiled=!1,this.lv_subtables=[],this.subtables_plan=null,this.buildGlyphIdMap()}buildGlyphIdMap(){const e=this.font;e.glyph_id={},e.src.glyphs&&e.src.glyphs.forEach((t,i)=>{e.glyph_id[t.code]=i+1})}lv_format2enum(e){switch(e){case"format0_tiny":return"LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY";case"format0":return"LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL";case"sparse_tiny":return"LV_FONT_FMT_TXT_CMAP_SPARSE_TINY";case"sparse":return"LV_FONT_FMT_TXT_CMAP_SPARSE_FULL";default:throw new Error("Unknown subtable format")}}lv_format2int(e){return["format0","sparse","format0_tiny","sparse_tiny"].indexOf(e)}getMapNumber(){if(!this.subtables_plan){const e=this.font;if(!e.src.glyphs||e.src.glyphs.length===0)return 0;this.subtables_plan=Ja(e.src.glyphs.map(t=>t.code))}return this.subtables_plan.length}glyphByCode(e){const t=this.font;return t.src.glyphs?t.src.glyphs.find(i=>i.code===e):null}collect_format0_data(e,t,i){const n=this.font,o=[];for(let r=e;r<=t;r++){const g=n.glyph_id[r]||0;o.push(g?g-i:0)}return o}collect_sparse_data(e,t){const i=this.font;let n=[],o=[];for(let r of e){let g=this.glyphByCode(r),s=i.glyph_id[g.code],a=r-e[0],I=s-t;if(a<0||a>65535)throw new Error("Codepoint delta out of range");if(I<0||I>65535)throw new Error("Glyph ID delta out of range");n.push(a),o.push(I)}return{codes:n,ids:o}}toCBin(e){const t=this.font;if(!t.src.glyphs||t.src.glyphs.length===0)return new ArrayBuffer(0);this.subtables_plan||(this.subtables_plan=Ja(t.src.glyphs.map(l=>l.code)));const i=this.subtables_plan;let n=0;const o=12+e*2+(e==4?0:4),r=new ArrayBuffer(i.length*o),g=new DataView(r),s=e==4?(l,C)=>g.setUint32(C,l,!0):(l,C)=>ZF(g,l,C),a=[];let I=r.byteLength;for(let[l,C]of i){let Q=this.glyphByCode(C[0]),E=t.glyph_id[Q.code],f=C[0],h=C[C.length-1],u=!1,p=!1,c=0,d=new ArrayBuffer(0),w=new ArrayBuffer(0);if(l!=="format0_tiny")if(l==="format0"){p=!0;let N=this.collect_format0_data(f,h,E);c=N.length,d=this.balign4(this.uint8ArrayToBuffer(new Uint8Array(N)))}else if(l==="sparse_tiny"){u=!0;let N=this.collect_sparse_data(C,E);c=N.codes.length,w=this.balign4(this.uint16ArrayToBuffer(new Uint16Array(N.codes)))}else{u=!0,p=!0;let N=this.collect_sparse_data(C,E);c=N.codes.length,w=this.balign4(this.uint16ArrayToBuffer(new Uint16Array(N.codes))),d=this.align4(this.uint16ArrayToBuffer(new Uint16Array(N.ids)))}let F=n*o;g.setUint32(F,f,!0),F+=4,g.setUint16(F,h-f+1,!0),F+=2,g.setUint16(F,E,!0),F+=2,s(u?I:0,F),F+=e,I+=w.byteLength,s(p?I:0,F),F+=e,I+=d.byteLength,g.setUint16(F,c,!0),F+=2,g.setUint8(F,this.lv_format2int(l)),F+=1,a.push(w),a.push(d),n++}return this.concatArrayBuffers([r,...a])}balign4(e){const t=e.byteLength%4;if(t===0)return e;const i=4-t,n=new ArrayBuffer(i);return this.concatArrayBuffers([e,n])}align4(e){const t=e.byteLength%4;if(t===0)return e;const i=4-t,n=new ArrayBuffer(i);return this.concatArrayBuffers([e,n])}uint8ArrayToBuffer(e){const t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}uint16ArrayToBuffer(e){return e.buffer.slice(0,e.byteLength)}concatArrayBuffers(e){const t=e.reduce((r,g)=>r+g.byteLength,0),i=new ArrayBuffer(t),n=new Uint8Array(i);let o=0;for(const r of e)n.set(new Uint8Array(r),o),o+=r.byteLength;return i}}class tS{constructor(e){this.font=e}toCBin(e){return new ArrayBuffer(0)}}function iS(A,e){if(!A.output)throw new yt('Output is required for "cbin" writer');const i=new XF(e,A).toCBin();return{[A.output]:i}}class nS{constructor(){this.initialized=!1,this.supportedFormats=["ttf","woff","woff2","otf"],this.charsetCache=new Map}async initialize(){if(!this.initialized)try{if(typeof Tr>"u")throw new Error("opentype.js not loaded");this.initialized=!0,console.log("BrowserFontConverter 初始化完成")}catch(e){throw console.error("BrowserFontConverter initialization failed:",e),e}}validateFont(e){if(!e)return!1;if(e instanceof File){const t=e.name.toLowerCase(),i=e.type.toLowerCase(),n=this.supportedFormats.some(r=>t.endsWith(`.${r}`)),o=["font/ttf","font/truetype","application/x-font-ttf","font/woff","font/woff2","application/font-woff","font/otf","application/x-font-otf"].some(r=>i.includes(r));return n||o}return e instanceof ArrayBuffer&&e.byteLength>0}async getFontInfo(e){try{let t;if(e instanceof File)t=await e.arrayBuffer();else if(e instanceof ArrayBuffer)t=e;else throw new Error("Unsupported font file type");const i=Tr.parse(t);return{familyName:this.getLocalizedName(i.names.fontFamily)||"Unknown",fullName:this.getLocalizedName(i.names.fullName)||"Unknown",postScriptName:this.getLocalizedName(i.names.postScriptName)||"Unknown",version:this.getLocalizedName(i.names.version)||"Unknown",unitsPerEm:i.unitsPerEm,ascender:i.ascender,descender:i.descender,numGlyphs:i.numGlyphs,supported:!0}}catch(t){return console.error("Failed to get font information:",t),{familyName:"Unknown",supported:!1,error:t.message}}}getLocalizedName(e){return e?e.zh||e["zh-CN"]||e.en||e[Object.keys(e)[0]]:null}async convertToCBIN(e){this.initialized||await this.initialize();const{fontFile:t,fontName:i,fontSize:n=20,bpp:o=4,charset:r="deepseek",symbols:g="",range:s="",compression:a=!1,lcd:I=!1,lcd_v:l=!1,progressCallback:C=null}=e;if(!this.validateFont(t))throw new yt("不支持的字体文件格式");try{C&&C(0,"Starting font processing...");let Q;t instanceof File?Q=await t.arrayBuffer():Q=t,C&&C(10,"Parsing font structure...");const{ranges:E,charSymbols:f}=await this.parseCharacterInputAsync(r,g,s);C&&C(20,"Preparing conversion parameters...");const h={font:[{source_path:i||"custom_font",source_bin:Q,ranges:[{range:E,symbols:f}],autohint_off:!1,autohint_strong:!1}],size:n,bpp:o,lcd:I,lcd_v:l,no_compress:!a,no_kerning:!1,use_color_info:!1,format:"cbin",output:i||"font"};C&&C(30,"Collecting font data...");const u=await VF(h);C&&C(70,"Generating CBIN format...");const p=iS(h,u),c=h.output;return C&&C(100,"Conversion completed!"),p[c]}catch(Q){throw console.error("Font conversion failed:",Q),new yt(`Font conversion failed: ${Q.message}`)}}async parseCharacterInputAsync(e,t,i){let n=[],o=t||"";return e==="full"?(n=[0,65535,0],{ranges:n,charSymbols:o}):(e&&e!=="custom"&&(o=await this.getCharsetContentAsync(e)+o),i&&(n=this.parseUnicodeRange(i)),{ranges:n,charSymbols:o})}parseCharacterInput(e,t,i){let n=[],o=t||"";return e==="full"?(n=[0,65535,0],{ranges:n,charSymbols:o}):(e&&e!=="custom"&&(o=this.getCharsetContent(e)+o),i&&(n=this.parseUnicodeRange(i)),{ranges:n,charSymbols:o})}async loadCharsetFromFile(e){const i={latin:"./static/charsets/latin1.txt",deepseek:"./static/charsets/deepseek.txt",gb2312:"./static/charsets/gb2312.txt",qwen:"./static/charsets/qwen18409.txt"}[e];if(!i)return null;try{const n=await fetch(i);if(!n.ok)throw new Error(`Failed to load charset file: ${n.status}`);const r=(await n.text()).split(` -`).join("");return this.charsetCache.set(e,r),r}catch(n){return console.error(`Failed to load charset ${e}:`,n),null}}getCharsetContent(e){const t={};return(e==="latin"||e==="deepseek"||e==="gb2312")&&this.charsetCache.has(e)?this.charsetCache.get(e):e==="basic"?this.getCharsetContent("latin"):t[e]||""}async getCharsetContentAsync(e){if(e==="basic"&&(e="latin"),this.charsetCache.has(e))return this.charsetCache.get(e);if(e==="latin"||e==="deepseek"||e==="gb2312"||e==="qwen"){const t=await this.loadCharsetFromFile(e);if(t)return t}return this.getCharsetContent(e)}parseUnicodeRange(e){const t=[],i=e.split(",");for(const n of i){const o=n.trim();if(o)if(o.includes("-")){const[r,g]=o.split("-"),s=this.parseHexOrDec(r),a=this.parseHexOrDec(g);s!==null&&a!==null&&t.push(s,a,s)}else{const r=this.parseHexOrDec(o);r!==null&&t.push(r,r,r)}}return t}parseHexOrDec(e){const t=e.trim();if(t.startsWith("0x")||t.startsWith("0X")){const n=parseInt(t,16);return isNaN(n)?null:n}const i=parseInt(t,10);return isNaN(i)?null:i}async estimateSizeAsync(e){const{fontSize:t=20,bpp:i=4,charset:n="latin",symbols:o="",range:r=""}=e;let g=o.length;if(n==="full")g=65536;else if(n&&n!=="custom"){const I=await this.getCharsetContentAsync(n);g+=I.length}if(r){const I=this.parseUnicodeRange(r);for(let l=0;l0}catch(e){return console.error("加载 FST 模型失败",e),!1}}packString(e,t){const i=new Uint8Array(t),n=Math.min(e.length,t);for(let o=0;o>8&255,t[2]=e>>16&255,t[3]=e>>24&255,t}packModels(){if(this.models.size===0)throw new Error("没有模型数据可打包");let e=0;const t=[];for(const[a,I]of Array.from(this.models.entries()).sort((l,C)=>l[0].localeCompare(C[0]))){e+=I.size;const l=Array.from(I.entries()).sort((C,Q)=>C[0].localeCompare(Q[0]));t.push({name:a,files:l})}const i=this.models.size;let n=4;for(const a of t)n+=36,n+=a.files.length*40;const o=n+Array.from(this.models.values()).reduce((a,I)=>a+Array.from(I.values()).reduce((l,C)=>l+C.byteLength,0),0),r=new Uint8Array(o);let g=0;r.set(this.packUint32(i),g),g+=4;let s=n;for(const a of t){r.set(this.packString(a.name,32),g),g+=32,r.set(this.packUint32(a.files.length),g),g+=4;for(const[I,l]of a.files)r.set(this.packString(I,32),g),g+=32,r.set(this.packUint32(s),g),g+=4,r.set(this.packUint32(l.byteLength),g),g+=4,s+=l.byteLength}for(const a of t)for(const[I,l]of a.files)r.set(new Uint8Array(l),g),g+=l.byteLength;return r.buffer}static async getAvailableModels(){try{return{WakeNet9:["wn9_alexa","wn9_astrolabe_tts","wn9_bluechip_tts2","wn9_computer_tts","wn9_haixiaowu_tts","wn9_heyily_tts2","wn9_heyprinter_tts","wn9_heywanda_tts","wn9_heywillow_tts","wn9_hiesp","wn9_hifairy_tts2","wn9_hijason_tts2","wn9_hijolly_tts2","wn9_hijoy_tts","wn9_hilexin","wn9_hilili_tts","wn9_himfive","wn9_himiaomiao_tts","wn9_hitelly_tts","wn9_hiwalle_tts2","wn9_hixiaoxing_tts","wn9_jarvis_tts","wn9_linaiban_tts2","wn9_miaomiaotongxue_tts","wn9_mycroft_tts","wn9_nihaobaiying_tts2","wn9_nihaodongdong_tts2","wn9_nihaomiaoban_tts2","wn9_nihaoxiaoan_tts2","wn9_nihaoxiaoxin_tts","wn9_nihaoxiaoyi_tts2","wn9_nihaoxiaozhi","wn9_nihaoxiaozhi_tts","wn9_sophia_tts","wn9_xiaoaitongxue","wn9_xiaobinxiaobin_tts","wn9_xiaojianxiaojian_tts2","wn9_xiaokangtongxue_tts2","wn9_xiaolongxiaolong_tts","wn9_xiaoluxiaolu_tts2","wn9_xiaomeitongxue_tts","wn9_xiaomingtongxue_tts2","wn9_xiaosurou_tts2","wn9_xiaotexiaote_tts2","wn9_xiaoyaxiaoya_tts2","wn9_xiaoyutongxue_tts2"],WakeNet9s:["wn9s_alexa","wn9s_hiesp","wn9s_hijason","wn9s_hilexin","wn9s_nihaoxiaozhi"]}}catch(e){return console.error("获取模型列表失败:",e),{WakeNet9:[],WakeNet9s:[]}}}static isValidModel(e,t){return t==="esp32c3"||t==="esp32c6"?e.startsWith("wn9s_"):e.startsWith("wn9_")}clear(){this.models.clear()}getStats(){let e=0,t=0;for(const i of this.models.values()){e+=i.size;for(const n of i.values())t+=n.byteLength}return{modelCount:this.models.size,fileCount:e,totalSize:t,models:Array.from(this.models.keys())}}validatePackingCompatibility(){const e="test_model",t=this.packString(e,32),i=305419896,n=this.packUint32(i);return{stringPacking:{input:e,output:Array.from(t).map(o=>`0x${o.toString(16).padStart(2,"0")}`),isASCII:t.every((o,r)=>r>=e.length||o===e.charCodeAt(r))},intPacking:{input:`0x${i.toString(16)}`,output:Array.from(n).map(o=>`0x${o.toString(16).padStart(2,"0")}`),isLittleEndian:n[0]===120&&n[3]===18}}}}class gS{constructor(){this.files=[],this.textEncoder=new TextEncoder}addFile(e,t,i={}){e.length>32&&console.warn(`Filename "${e}" exceeds 32 bytes and will be truncated`),this.files.push({filename:e,data:t,size:t.byteLength,width:i.width||0,height:i.height||0})}async getImageDimensions(e){return new Promise(t=>{try{const i=new Blob([e]),n=URL.createObjectURL(i),o=new Image;o.onload=()=>{URL.revokeObjectURL(n),t({width:o.width,height:o.height})},o.onerror=()=>{URL.revokeObjectURL(n),t({width:0,height:0})},o.src=n}catch{t({width:0,height:0})}})}parseSpecialImageFormat(e,t){const i=e.toLowerCase().split(".").pop();if([".sjpg",".spng",".sqoi"].includes("."+i))try{const n=new DataView(t),o=n.getUint16(14,!0),r=n.getUint16(16,!0);return{width:o,height:r}}catch(n){console.warn(`Failed to parse special image format: ${e}`,n)}return{width:0,height:0}}packUint32(e){const t=new Uint8Array(4);return t[0]=e&255,t[1]=e>>8&255,t[2]=e>>16&255,t[3]=e>>24&255,t}packUint16(e){const t=new Uint8Array(2);return t[0]=e&255,t[1]=e>>8&255,t}packString(e,t){const i=new Uint8Array(t),n=this.textEncoder.encode(e),o=Math.min(n.length,t);return i.set(n.slice(0,o),0),i}computeChecksum(e){let t=0;for(let i=0;i{const n=t.filename.split(".").pop()||"",o=i.filename.split(".").pop()||"";if(n!==o)return n.localeCompare(o);const r=t.filename.replace(/\.[^/.]+$/,""),g=i.filename.replace(/\.[^/.]+$/,"");return r.localeCompare(g)})}async generate(e=null){if(this.files.length===0)throw new Error("No files to package");e&&e(0,"Starting to package files...");const t=this.sortFiles(this.files),i=t.length,n=[];let o=0;for(let p=0;p0||F.height>0)d=F.width,w=F.height;else{const N=c.filename.toLowerCase().split(".").pop();if(["png","jpg","jpeg","gif","bmp","webp"].includes(N)){const G=await this.getImageDimensions(c.data);d=G.width,w=G.height}}}n.push({filename:c.filename,data:c.data,size:c.size,offset:o,width:d,height:w}),o+=2+c.size}e&&e(40,"Building file mapping table...");const r=i*44,g=new Uint8Array(r);let s=0;for(const p of n)g.set(this.packString(p.filename,32),s),s+=32,g.set(this.packUint32(p.size),s),s+=4,g.set(this.packUint32(p.offset),s),s+=4,g.set(this.packUint16(p.width),s),s+=2,g.set(this.packUint16(p.height),s),s+=2;e&&e(60,"Merging file data...");const a=new Uint8Array(o);let I=0;for(let p=0;p0?Math.round(e/this.files.length):0}}printFileList(){if(console.log("=== Packaged File List ==="),console.log(`Total files: ${this.files.length}`),this.files.length===0){console.log("No files available");return}this.sortFiles(this.files).forEach((i,n)=>{var s;const o=((s=i.filename.split(".").pop())==null?void 0:s.toLowerCase())||"unknown",r=(i.size/1024).toFixed(2),g=i.width&&i.height?`${i.width}x${i.height}`:"N/A";console.log(`${String(n+1).padStart(3," ")}. ${i.filename}`),console.log(` Type: ${o.toUpperCase()}`),console.log(` Size: ${r} KB (${i.size} bytes)`),console.log(` Dimensions: ${g}`),console.log("")});const t=this.getStats();console.log("=== File Statistics ==="),console.log(`Total size: ${(t.totalSize/1024).toFixed(2)} KB`),console.log(`Average size: ${(t.averageFileSize/1024).toFixed(2)} KB`),console.log("File type distribution:"),Object.entries(t.fileTypes).forEach(([i,n])=>{console.log(` ${i.toUpperCase()}: ${n} files`)})}clear(){this.files=[]}}let xn={tool:{workerLocalUrl:`var gifsicle=function(){Me="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,"undefined"!=typeof __filename&&(Me=Me||__filename);var Me,c=function(e){var j,r,h=void 0!==(e=e||{})?e:{},t=(h.ready=new Promise(function(e,r){j=e}),h.preRun=h.preRun||[],h.preRun.push(function(){if(h.folder&&h.folder.length)for(let e=0;e>10,56320|1023&s)))):i+=String.fromCharCode(u)}return i}function W(e,r){return e?g(E,e,r):""}function X(e,r,t,n){if(!(0>6,r[t++]=128|63&s}else if(s<=65535){if(i<=t+2)break;r[t++]=224|s>>12,r[t++]=128|s>>6&63,r[t++]=128|63&s}else{if(i<=t+3)break;r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}}return r[t]=0,t-o}function G(e){for(var r=0,t=0;t>2]=e}var x={splitPath:function(e){return/^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/.exec(e).slice(1)},normalizeArray:function(e,r){for(var t=0,n=e.length-1;0<=n;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:function(e){var r="/"===e.charAt(0),t="/"===e.substr(-1);return(e=(e=x.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||r?e:".")&&t&&(e+="/"),(r?"/":"")+e},dirname:function(e){var e=x.splitPath(e),r=e[0],e=e[1];return r||e?r+(e=e&&e.substr(0,e.length-1)):"."},basename:function(e){if("/"===e)return"/";var r=e.lastIndexOf("/");return-1===r?e:e.substr(r+1)},extname:function(e){return x.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return x.normalize(e.join("/"))},join2:function(e,r){return x.normalize(e+"/"+r)}},R={resolve:function(){for(var e="",r=!1,t=arguments.length-1;-1<=t&&!r;t--){var n=0<=t?arguments[t]:T.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r="/"===n.charAt(0)}return(r?"/":"")+(e=x.normalizeArray(e.split("/").filter(function(e){return!!e}),!r).join("/"))||"."},relative:function(e,r){function t(e){for(var r=0;r>>0),0!=t&&(r=Math.max(r,256)),t=e.contents,e.contents=new Uint8Array(r),0r)e.contents.length=r;else for(;e.contents.length=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-o,n);if(8>>0)%T.nameTable.length},hashAddNode:function(e){var r=T.hashName(e.parent.id,e.name);e.name_next=T.nameTable[r],T.nameTable[r]=e},hashRemoveNode:function(e){var r=T.hashName(e.parent.id,e.name);if(T.nameTable[r]===e)T.nameTable[r]=e.name_next;else for(var t=T.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode:function(e,r){var t=T.mayLookup(e);if(t)throw new T.ErrnoError(t,e);for(var t=T.hashName(e.id,r),n=T.nameTable[t];n;n=n.name_next){var o=n.name;if(n.parent.id===e.id&&o===r)return n}return T.lookup(e,r)},createNode:function(e,r,t,n){e=new T.FSNode(e,r,t,n);return T.hashAddNode(e),e},destroyNode:function(e){T.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return 32768==(61440&e)},isDir:function(e){return 16384==(61440&e)},isLink:function(e){return 40960==(61440&e)},isChrdev:function(e){return 8192==(61440&e)},isBlkdev:function(e){return 24576==(61440&e)},isFIFO:function(e){return 4096==(61440&e)},isSocket:function(e){return 49152==(49152&e)},flagModes:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function(e){var r=T.flagModes[e];if(void 0===r)throw new Error("Unknown file open mode: "+e);return r},flagsToPermissionString:function(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:function(e,r){return T.ignorePermissions||(-1===r.indexOf("r")||292&e.mode)&&(-1===r.indexOf("w")||146&e.mode)&&(-1===r.indexOf("x")||73&e.mode)?0:2},mayLookup:function(e){var r=T.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate:function(e,r){try{T.lookupNode(e,r);return 20}catch(e){}return T.nodePermissions(e,"wx")},mayDelete:function(e,r,t){var n;try{n=T.lookupNode(e,r)}catch(e){return e.errno}r=T.nodePermissions(e,"wx");if(r)return r;if(t){if(!T.isDir(n.mode))return 54;if(T.isRoot(n)||T.getPath(n)===T.cwd())return 10}else if(T.isDir(n.mode))return 31;return 0},mayOpen:function(e,r){return e?T.isLink(e.mode)?32:T.isDir(e.mode)&&("r"!==T.flagsToPermissionString(r)||512&r)?31:T.nodePermissions(e,T.flagsToPermissionString(r)):44},MAX_OPEN_FDS:4096,nextfd:function(e,r){r=r||T.MAX_OPEN_FDS;for(var t=e=e||0;t<=r;t++)if(!T.streams[t])return t;throw new T.ErrnoError(33)},getStream:function(e){return T.streams[e]},createStream:function(e,r,t){T.FSStream||(T.FSStream=function(){},T.FSStream.prototype={object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}});var n,o=new T.FSStream;for(n in e)o[n]=e[n];e=o;r=T.nextfd(r,t);return e.fd=r,T.streams[r]=e},closeStream:function(e){T.streams[e]=null},chrdev_stream_ops:{open:function(e){var r=T.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:function(){throw new T.ErrnoError(70)}},major:function(e){return e>>8},minor:function(e){return 255&e},makedev:function(e,r){return e<<8|r},registerDevice:function(e,r){T.devices[e]={stream_ops:r}},getDevice:function(e){return T.devices[e]},getMounts:function(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs:function(r,t){"function"==typeof r&&(t=r,r=!1),T.syncFSRequests++,1=n.length&&i(null)}n.forEach(function(e){if(!e.type.syncfs)return a(null);e.type.syncfs(e,r,a)})},mount:function(e,r,t){var n,o="/"===t,i=!t;if(o&&T.root)throw new T.ErrnoError(10);if(!o&&!i){i=T.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,T.isMountpoint(n))throw new T.ErrnoError(10);if(!T.isDir(n.mode))throw new T.ErrnoError(54)}i={type:e,opts:r,mountpoint:t,mounts:[]},r=e.mount(i);return(r.mount=i).root=r,o?T.root=r:n&&(n.mounted=i,n.mount&&n.mount.mounts.push(i)),r},unmount:function(e){e=T.lookupPath(e,{follow_mount:!1});if(!T.isMountpoint(e.node))throw new T.ErrnoError(28);var e=e.node,r=e.mounted,n=T.getMounts(r),r=(Object.keys(T.nameTable).forEach(function(e){for(var r=T.nameTable[e];r;){var t=r.name_next;-1!==n.indexOf(r.mount)&&T.destroyNode(r),r=t}}),e.mounted=null,e.mount.mounts.indexOf(r));e.mount.mounts.splice(r,1)},lookup:function(e,r){return e.node_ops.lookup(e,r)},mknod:function(e,r,t){var n=T.lookupPath(e,{parent:!0}).node,e=x.basename(e);if(!e||"."===e||".."===e)throw new T.ErrnoError(28);var o=T.mayCreate(n,e);if(o)throw new T.ErrnoError(o);if(n.node_ops.mknod)return n.node_ops.mknod(n,e,r,t);throw new T.ErrnoError(63)},create:function(e,r){return T.mknod(e,r=(r=void 0!==r?r:438)&4095|32768,0)},mkdir:function(e,r){return T.mknod(e,r=(r=void 0!==r?r:511)&1023|16384,0)},mkdirTree:function(e,r){for(var t=e.split("/"),n="",o=0;othis.length-1||e<0))return r=e%this.chunkSize,e=e/this.chunkSize|0,this.getter(e)[r]},o.prototype.setDataGetter=function(e){this.getter=e},o.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",a,!1),e.send(null),!(200<=e.status&&e.status<300||304===e.status))throw new Error("Couldn't load "+a+". Status: "+e.status);var r,n=Number(e.getResponseHeader("Content-length")),t=(r=e.getResponseHeader("Accept-Ranges"))&&"bytes"===r,e=(r=e.getResponseHeader("Content-Encoding"))&&"gzip"===r,o=1048576,i=(t||(o=n),this);i.setDataGetter(function(e){var r=e*o,t=(e+1)*o-1,t=Math.min(t,n-1);if(void 0===i.chunks[e]&&(i.chunks[e]=function(e,r){if(r=i.length)return 0;var a=Math.min(i.length-o,n);if(i.slice)for(var s=0;s>2]=n.dev,k[t+4>>2]=0,k[t+8>>2]=n.ino,k[t+12>>2]=n.mode,k[t+16>>2]=n.nlink,k[t+20>>2]=n.uid,k[t+24>>2]=n.gid,k[t+28>>2]=n.rdev,k[t+32>>2]=0,F=[n.size>>>0,(S=n.size,1<=+ne(S)?0>>0:~~+oe((S-(~~S>>>0))/4294967296)>>>0:0)],k[t+40>>2]=F[0],k[t+44>>2]=F[1],k[t+48>>2]=4096,k[t+52>>2]=n.blocks,k[t+56>>2]=n.atime.getTime()/1e3|0,k[t+60>>2]=0,k[t+64>>2]=n.mtime.getTime()/1e3|0,k[t+68>>2]=0,k[t+72>>2]=n.ctime.getTime()/1e3|0,k[t+76>>2]=0,F=[n.ino>>>0,(S=n.ino,1<=+ne(S)?0>>0:~~+oe((S-(~~S>>>0))/4294967296)>>>0:0)],k[t+80>>2]=F[0],k[t+84>>2]=F[1],0},doMsync:function(e,r,t,n,o){e=E.slice(e,e+t);T.msync(r,e,o,t,n)},doMkdir:function(e,r){return"/"===(e=x.normalize(e))[e.length-1]&&(e=e.substr(0,e.length-1)),T.mkdir(e,r,0),0},doMknod:function(e,r,t){switch(61440&r){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}return T.mknod(e,r,t),0},doReadlink:function(e,r,t){if(t<=0)return-28;var e=T.readlink(e),n=Math.min(t,G(e)),o=y[r+n];return X(e,E,r,t+1),y[r+n]=o,n},doAccess:function(e,r){if(-8&r)return-28;e=T.lookupPath(e,{follow:!0}).node;if(!e)return-44;var t="";return 4&r&&(t+="r"),2&r&&(t+="w"),1&r&&(t+="x"),t&&T.nodePermissions(e,t)?-2:0},doDup:function(e,r,t){var n=T.getStream(t);return n&&T.close(n),T.open(e,r,0,t,t).fd},doReadv:function(e,r,t,n){for(var o=0,i=0;i>2],s=k[r+(8*i+4)>>2],a=T.read(e,y,a,s,n);if(a<0)return-1;if(o+=a,a>2],s=k[r+(8*i+4)>>2],a=T.write(e,y,a,s,n);if(a<0)return-1;o+=a}return o},varargs:void 0,get:function(){return N.varargs+=4,k[N.varargs-4>>2]},getStr:function(e){return W(e)},getStreamFromFD:function(e){e=T.getStream(e);if(e)return e;throw new T.ErrnoError(8)},get64:function(e,r){return e}};var ge={};function z(){if(!z.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:C||"./this.program"};for(r in ge)e[r]=ge[r];var r,t=[];for(r in e)t.push(r+"="+e[r]);z.strings=t}return z.strings}function ve(e,r,t,n){this.parent=e=e||this,this.mount=e.mount,this.mounted=null,this.id=T.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n}function ye(e,r,t){t=0>2]=t/1e3|0,k[r+4>>2]=t%1e3*1e3*1e3|0,0},d:function(e,r,t){N.varargs=t;try{var n=N.getStreamFromFD(e);switch(r){case 0:return(o=N.get())<0?-28:T.open(n.path,n.flags,0,o).fd;case 1:case 2:return 0;case 3:return n.flags;case 4:var o=N.get();return n.flags|=o,0;case 12:o=N.get();return K[o+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return A(28),-1;default:return-28}}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),-e.errno}},i:function(e,r,t){N.varargs=t;try{var n=N.getStreamFromFD(e);switch(r){case 21509:case 21505:return n.tty?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return n.tty?0:-59;case 21519:if(!n.tty)return-59;var o=N.get();return k[o>>2]=0;case 21520:return n.tty?-28:-59;case 21531:o=N.get();return T.ioctl(n,r,o);case 21523:case 21524:return n.tty?0:-59;default:D("bad ioctl syscall "+r)}}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),-e.errno}},e:function(e,r,t){N.varargs=t;try{var n=N.getStr(e),o=N.get();return T.open(n,r,o).fd}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),-e.errno}},t:function(e){try{return e=N.getStr(e),T.rmdir(e),0}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),-e.errno}},j:function(e){try{var r=N.umask;return N.umask=e,r}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),-e.errno}},u:function(e){try{return e=N.getStr(e),T.unlink(e),0}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),-e.errno}},v:function(e,r,t,n){try{D("cannot wait on child processes")}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),-e.errno}},n:function(e,r,t){E.copyWithin(e,r,r+t)},b:function(e){var r=E.length,t=2147483648;if(t<(e>>>=0))return!1;for(var n,o=1;o<=4;o*=2){var i=r*(1+.2/o),i=Math.min(i,e+100663296);if(function(e){try{return p.grow(e-v.byteLength+65535>>>16),Y(p.buffer),1}catch(e){}}(Math.min(t,(0<(i=Math.max(16777216,e,i))%(n=65536)&&(i+=n-i%n),i))))return!0}return!1},p:function(a,s){var u=0;return z().forEach(function(e,r){for(var t=s+u,n=(k[a+4*r>>2]=t,e),o=t,r=void 0,i=0;i>0]=n.charCodeAt(i);r||(y[o>>0]=0),u+=e.length+1}),0},q:function(e,r){var t=z(),n=(k[e>>2]=t.length,0);return t.forEach(function(e){n+=e.length+1}),k[r>>2]=n,0},c:function(e){xe(e)},f:function(e){try{var r=N.getStreamFromFD(e);return T.close(r),0}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),e.errno}},r:function(e,r){try{var t=N.getStreamFromFD(e),n=t.tty?2:T.isDir(t.mode)?3:T.isLink(t.mode)?7:4;return y[r>>0]=n,0}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),e.errno}},h:function(e,r,t,n){try{var o=N.getStreamFromFD(e),i=N.doReadv(o,r,t);return k[n>>2]=i,0}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),e.errno}},m:function(e,r,t,n,o){try{var i=N.getStreamFromFD(e),a=4294967296*t+(r>>>0),s=9007199254740992;return a<=-s||s<=a?-61:(T.llseek(i,a,n),F=[i.position>>>0,(S=i.position,1<=+ne(S)?0>>0:~~+oe((S-(~~S>>>0))/4294967296)>>>0:0)],k[o>>2]=F[0],k[o+4>>2]=F[1],i.getdents&&0==a&&0===n&&(i.getdents=null),0)}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),e.errno}},g:function(e,r,t,n){try{var o=N.getStreamFromFD(e),i=N.doWritev(o,r,t);return k[n>>2]=i,0}catch(e){return void 0!==T&&e instanceof T.ErrnoError||D(e),e.errno}},memory:p,o:function(){w("missing function: popen"),D(-1)},l:function(){return 6},k:function(){},table:I},_e=(!function(){var r={a:ke};function t(e,r){e=e.exports;h.asm=e,ue()}function n(e){t(e.instance)}function o(e){return(l||!L&&!c||"function"!=typeof fetch||de(P)?new Promise(function(e,r){e(pe())}):fetch(P,{credentials:"same-origin"}).then(function(e){if(e.ok)return e.arrayBuffer();throw"failed to load wasm binary file at '"+P+"'"}).catch(pe)).then(function(e){return WebAssembly.instantiate(e,r)}).then(e,function(e){w("failed to asynchronously prepare wasm: "+e),D(e)})}if(se(),h.instantiateWasm)try{h.instantiateWasm(r,t);return}catch(e){return w("Module.instantiateWasm callback failed with error: "+e)}l||"function"!=typeof WebAssembly.instantiateStreaming||ce(P,fe)||de(P)||"function"!=typeof fetch?o(n):fetch(P,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,r).then(n,function(e){return w("wasm streaming compile failed: "+e),w("falling back to ArrayBuffer instantiation"),o(n)})})}(),h.___wasm_call_ctors=function(){return(_e=h.___wasm_call_ctors=h.asm.w).apply(null,arguments)}),be=h._malloc=function(){return(be=h._malloc=h.asm.x).apply(null,arguments)},De=h.___errno_location=function(){return(De=h.___errno_location=h.asm.y).apply(null,arguments)},Se=(h._main=function(){return(h._main=h.asm.z).apply(null,arguments)},h.stackAlloc=function(){return(Se=h.stackAlloc=h.asm.A).apply(null,arguments)});function Fe(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Pe(r){var t=h._main;r=r||[];try{for(let e=0;e>2]=V(C);for(var n=1;n>2)+n]=V(e[n-1]);return k[(t>>2)+r]=0,{argc:r,argv:t}}(s.split(" ").filter(e=>Boolean(e)));if(0!==(n=t(o,i)))break}xe(n,!0)}catch(e){if(e instanceof Fe)return;if("unwind"==e)return void(d=!0);var a=e;e&&"object"==typeof e&&e.stack&&(a=[e,e.stack]),w("exception thrown: "+a),u(1,e)}}function Ae(e){function r(){Ee||(Ee=!0,h.calledRun=!0,U||(h.noFSInit||T.init.initialized||T.init(),Z(J),T.ignorePermissions=!1,Z(Q),j(h),h.onRuntimeInitialized&&h.onRuntimeInitialized(),Re&&Pe(e),te()))}e=e||a,0<_||(re(),0<_||(h.setStatus?(h.setStatus("Running..."),setTimeout(function(){setTimeout(function(){h.setStatus("")},1),r()},1)):r()))}function xe(e,r){r&&d&&0===e||(d||(U=!0,h.onExit&&h.onExit(e)),u(e,new Fe(e)))}if(h.dynCall_vi=function(){return(h.dynCall_vi=h.asm.B).apply(null,arguments)},b=function e(){Ee||Ae(),Ee||(b=e)},h.run=Ae,h.preInit)for("function"==typeof h.preInit&&(h.preInit=[h.preInit]);0{0{t+=String.fromCharCode(e),10===e&&(console.error(t),t="")},stdout:e=>{r+=String.fromCharCode(e),10===e&&(console.log(r),r="")}};const l=[];return async(e={})=>{let{data:i=null,command:a=[],folder:s=[],isStrict:u=!1}=e;return await new Promise(e=>{l.push(e),1===l.length&&l[0]()}),new Promise((r,t)=>{let n=!1,o="";c({stdout:f.stdout,stderr:e=>{o+=String.fromCharCode(e),10===e&&(console.error(o),u&&t(o))},arguments:a,input:i,folder:s,output:e=>{r(e),n=!0}}).then(()=>{(0,f.flush)(),n||t(),0{var e=await gifsicle(r.data).catch(e=>{postMessage(e)});postMessage(e)})().catch(e=>{postMessage(null)})};`,workerBlobUrl:"",worker(){return this.workerBlobUrl||(this.workerLocalUrl?this.workerBlobUrl=URL.createObjectURL(new Blob([this.workerLocalUrl])):this.workerBlobUrl="../src/worker.js",this.workerBlobUrl)},errorLink(){return` - Check: https://github.com/renzhezhilu/gifsicle-wasm-browser`},testType(A){return A instanceof Element?"element":Object.prototype.toString.call(A).replace(/\[object\s(.+)\]/,"$1").toLowerCase()},async textToUrl(A){return this.worker()},loadCommand(A){var e=this.testType(A);if(A.length===0)throw" the content can not be blank"+this.errorLink();if(e==="array")return A.map(t=>t.replace(/\n/gi," "));throw" types:"+e+", must be an array"+this.errorLink()},loadOne(A){return new Promise(async(e,t)=>{var i=this.testType(A);if(["string"].includes(i))fetch(A).then(n=>{if(n.status!==200)throw"<"+A+"> Url error!!!"+this.errorLink();return n.arrayBuffer()}).then(n=>e(n));else if(["blob","file"].includes(i))new Response(A).arrayBuffer().then(n=>e(n));else{if(!["arraybuffer"].includes(i))throw" types:"+i+", only supports Url, blob, file, arraybuffer"+this.errorLink();e(A)}})},loadFile(A){return new Promise(async(e,t)=>{var i=this.testType(A);if(i!=="array")throw" types:"+i+", only supports Array"+this.errorLink();if(A.length===0)throw" the content can not be blank"+this.errorLink();i=A.map(n=>this.loadOne(n.file)),Promise.all(i).then(function(n){var o=A.map((r,g)=>(r.file=n[g],r));e(o)}).catch(function(n){})})},loadFolder(A){return new Promise(async(e,t)=>{var i=this.testType(A);if(!["array"].includes(i))throw" types:"+i+", only supports Array"+this.errorLink();e(A)})}},run(A={}){return new Promise(async(e,t)=>{let{input:i=[],command:n="",folder:o=[],isStrict:r=!1,start:g=Q=>{}}=A;var s=await this.tool.textToUrl();let a=new Worker(s);var I=this.tool.loadCommand(n),l=await this.tool.loadFile(i),C=(g(l),await this.tool.loadFolder(o));a.postMessage({data:l,command:I,folder:C,isStrict:r}),a.onmessage=async function(Q){if(!Q.data||typeof Q.data=="string")return a.terminate(),void t(Q.data);let E=[];for(let h=0;h=0&&I.push(`--loopcount=${s}`),g&&g>0&&I.push(`--lossy=${g}`),r&&I.push(`-O${this.optimizationLevel}`),I.push("1.gif"),I.push("-o /out/output.gif");const l=I.join(" ");this.debug&&(console.log("GIF 缩放命令:",l),console.log("输入文件大小:",e.size||"未知"));const C=await xn.run({input:[{file:e,name:"1.gif"}],command:[l]});if(!C||C.length===0)throw new Error("gifsicle 处理失败,未返回结果");const Q=C[0];if(this.debug&&(console.log("GIF 缩放完成"),console.log("输出文件大小:",Q.size),e.size)){const E=((1-Q.size/e.size)*100).toFixed(2);console.log(`压缩率: ${E}%`)}return new Blob([Q],{type:"image/gif"})}catch(a){throw console.error("GIF 缩放失败:",a),new Error(`GIF 缩放失败: ${a.message}`)}}async scaleGifBatch(e){const t=[];for(let i=0;i=0&&r.push(`--loopcount=${o}`),i&&i>0&&r.push(`--lossy=${i}`),r.push(`-O${n}`),r.push("1.gif"),r.push("-o /out/output.gif");const g=r.join(" ");this.debug&&console.log("GIF 优化命令:",g);const s=await xn.run({input:[{file:e,name:"1.gif"}],command:[g]});if(!s||s.length===0)throw new Error("gifsicle 优化失败");return new Blob([s[0]],{type:"image/gif"})}catch(r){throw console.error("GIF 优化失败:",r),new Error(`GIF 优化失败: ${r.message}`)}}async getGifInfo(e){try{const t=await xn.run({input:[{file:e,name:"1.gif"}],command:["--info 1.gif -o /out/info.txt"]});if(!t||t.length===0)throw new Error("无法获取 GIF 信息");const n=await t[0].text();return this.parseGifInfo(n)}catch(t){return console.error("获取 GIF 信息失败:",t),{size:e.size||0,type:"image/gif"}}}parseGifInfo(e){const t={frames:0,width:0,height:0,colors:0,loopCount:0};try{const i=e.match(/(\d+) images?/);i&&(t.frames=parseInt(i[1]));const n=e.match(/logical screen (\d+)x(\d+)/);n&&(t.width=parseInt(n[1]),t.height=parseInt(n[2]));const o=e.match(/(\d+) colors/);if(o&&(t.colors=parseInt(o[1])),e.includes("loop forever"))t.loopCount=0;else{const r=e.match(/loop count (\d+)/);r&&(t.loopCount=parseInt(r[1]))}}catch(i){console.warn("解析 GIF 信息时出错:",i)}return t}async cropGif(e,t){const{x:i,y:n,width:o,height:r}=t;try{const g=["-U",`--crop ${i},${n}+${o}x${r}`,"1.gif","-o /out/output.gif"].join(" ");this.debug&&console.log("GIF 裁剪命令:",g);const s=await xn.run({input:[{file:e,name:"1.gif"}],command:[g]});if(!s||s.length===0)throw new Error("gifsicle 裁剪失败");return new Blob([s[0]],{type:"image/gif"})}catch(g){throw console.error("GIF 裁剪失败:",g),new Error(`GIF 裁剪失败: ${g.message}`)}}dispose(){this.debug&&console.log("WasmGifScaler disposed")}setDebug(e){this.debug=e}setQuality(e){if(e<1||e>200)throw new Error("质量参数必须在 1-200 之间");this.quality=e}setOptimizationLevel(e){if(e<1||e>3)throw new Error("优化级别必须在 1-3 之间");this.optimizationLevel=e}}class Yl{constructor(){this.config=null,this.resources=new Map,this.tempFiles=[],this.fontConverterBrowser=oS,this.convertedFonts=new Map,this.wakenetPacker=new rS,this.spiffsGenerator=new gS,this.gifScaler=new sS({quality:30,debug:!0,scalingMode:"auto",optimize:!0,optimizationLevel:2}),this.configStorage=Qe,this.autoSaveEnabled=!0}setConfig(e,t={}){if(((t==null?void 0:t.strict)??!0)&&!this.validateConfig(e))throw new Error("Configuration object validation failed");return this.config={...e},this}validateConfig(e){var n,o,r;if(!e)return!1;if(!((n=e.chip)!=null&&n.model))return console.error("Missing chip model configuration"),!1;const t=e.chip.display;if(!(t!=null&&t.width)||!(t!=null&&t.height))return console.error("Missing display resolution configuration"),!1;const i=(o=e.theme)==null?void 0:o.font;return(i==null?void 0:i.type)==="preset"&&!i.preset?(console.error("Preset font configuration is incomplete"),!1):(i==null?void 0:i.type)==="custom"&&!((r=i.custom)!=null&&r.file)?(console.error("Custom font file not provided"),!1):!0}addResource(e,t,i,n="other"){return this.resources.set(e,{file:t,filename:i,size:t.size,type:t.type,lastModified:t.lastModified||Date.now(),resourceType:n}),this.autoSaveEnabled&&t instanceof File&&this.saveFileToStorage(e,t,n).catch(o=>{console.warn(`Auto-saving file ${i} failed:`,o)}),this}async saveFileToStorage(e,t,i){try{await this.configStorage.saveFile(e,t,i),console.log(`File ${t.name} auto-saved to storage`)}catch(n){throw console.error(`Failed to save file to storage: ${t.name}`,n),n}}async restoreResourceFromStorage(e){try{const t=await this.configStorage.loadFile(e);return t?(this.resources.set(e,{file:t,filename:t.name,size:t.size,type:t.type,lastModified:t.lastModified,resourceType:t.storedType,fromStorage:!0}),console.log(`Resource ${e} restored from storage successfully: ${t.name}`),!0):!1}catch(t){return console.error(`Failed to restore resource from storage: ${e}`,t),!1}}async restoreAllResourcesFromStorage(e){var i,n,o,r,g,s,a,I,l,C,Q;if(!e)return;const t=[];if((n=(i=e.theme)==null?void 0:i.font)!=null&&n.custom&&((o=e.theme.font.custom)==null?void 0:o.file)===null){const E="custom_font";if(await this.restoreResourceFromStorage(E)){const f=this.resources.get(E);f&&(e.theme.font.custom.file=f.file,t.push(`Custom font: ${f.filename}`),console.log(`Custom font restored even when type is '${e.theme.font.type}'`))}}if(((g=(r=e.theme)==null?void 0:r.emoji)==null?void 0:g.type)==="custom"&&e.theme.emoji.custom){const E=e.theme.emoji.custom,f=E.emotionMap||{},h=E.fileMap||{},u=E.images||{};if(Object.keys(f).length>0||Object.keys(h).length>0){const p=new Set;for(const c of Object.keys(h))h[c]===null&&p.add(c);for(const c of p){let d=`hash_${c}`,w=await this.restoreResourceFromStorage(d);if(!w){const F=`emoji_hash_${c}`;w=await this.restoreResourceFromStorage(F),w&&(d=F)}if(w){const F=this.resources.get(d);if(F){h[c]=F.file;const N=Object.entries(f).filter(([G,P])=>P===c).map(([G,P])=>G);N.forEach(G=>{u[G]=F.file}),t.push(`Emoji file ${c.substring(0,8)}... (used for: ${N.join(", ")})`)}}}Object.keys(h).forEach(c=>{e.theme.emoji.custom.fileMap[c]=h[c]}),Object.keys(u).forEach(c=>{e.theme.emoji.custom.images[c]=u[c]})}else{for(const[p,c]of Object.entries(u))if(c===null){const d=`emoji_${p}`;if(await this.restoreResourceFromStorage(d)){const w=this.resources.get(d);w&&(u[p]=w.file,t.push(`Emoji ${p}: ${w.filename}`))}}e.theme.emoji.custom.images=u}}if(((I=(a=(s=e.theme)==null?void 0:s.skin)==null?void 0:a.light)==null?void 0:I.backgroundType)==="image"&&e.theme.skin.light.backgroundImage===null){const E="background_light";if(await this.restoreResourceFromStorage(E)){const f=this.resources.get(E);f&&(e.theme.skin.light.backgroundImage=f.file,t.push(`Light background: ${f.filename}`))}}if(((Q=(C=(l=e.theme)==null?void 0:l.skin)==null?void 0:C.dark)==null?void 0:Q.backgroundType)==="image"&&e.theme.skin.dark.backgroundImage===null){const E="background_dark";if(await this.restoreResourceFromStorage(E)){const f=this.resources.get(E);f&&(e.theme.skin.dark.backgroundImage=f.file,t.push(`Dark background: ${f.filename}`))}}try{const E=this.getFontInfo();if(E&&E.type==="custom"){const f=`converted_font_${E.filename}`,h=await this.configStorage.loadTempData(f);h&&(this.convertedFonts.set(E.filename,h.data),console.log(`Converted font data restored: ${E.filename}`))}}catch(E){console.warn("Error restoring converted font data:",E)}t.length>0&&console.log("Files restored from storage:",t)}getWakewordModelInfo(){if(!this.config||!this.config.chip||!this.config.theme)return null;const e=this.config.chip.model,t=this.config.theme.wakeword;return!t||t.type==="none"?null:t.type==="preset"?{type:e==="esp32c3"||e==="esp32c6"?"WakeNet9s":"WakeNet9",name:t.preset,filename:"srmodels.bin"}:t.type==="custom"?{type:"MultiNet",name:t.custom.model,filename:"srmodels.bin",custom:t.custom}:null}getFontInfo(){if(!this.config||!this.config.theme||!this.config.theme.font)return null;const e=this.config.theme.font;if(e.type==="preset")return{type:"preset",filename:`${e.preset}.bin`,source:e.preset};if(e.type==="custom"&&e.custom.file){const t=e.custom;return{type:"custom",filename:`font_custom_${t.size}_${t.bpp}.bin`,source:e.custom.file,config:{size:t.size,bpp:t.bpp,charset:t.charset}}}return null}getEmojiCollectionInfo(){if(!this.config||!this.config.theme||!this.config.theme.emoji)return[];const e=this.config.theme.emoji,t=[];if(e.type==="preset"){const i=["neutral","happy","laughing","funny","sad","angry","crying","loving","embarrassed","surprised","shocked","thinking","winking","cool","relaxed","delicious","kissy","confident","sleepy","silly","confused"],n=e.preset==="twemoji32"?"32":"64";i.forEach(o=>{t.push({name:o,file:`${o}.png`,source:`preset:${e.preset}`,size:{width:parseInt(n),height:parseInt(n)}})})}else if(e.type==="custom"){e.custom.images;const i=e.custom.emotionMap||{},n=e.custom.fileMap||{},o=e.custom.size||{width:64,height:64};if(Object.keys(i).length===0||Object.keys(n).length===0)throw console.error("❌ Error: Detected old version of emoji data structure"),console.error("Please clear browser cache or reset configuration, then re-upload emoji images"),new Error("Incompatible emoji data structure: Missing fileMap or emotionMap. Please reconfigure emojis.");const r=new Map;Object.entries(i).forEach(([g,s])=>{const a=n[s];if(a){if(!r.has(s)){const l=a.name?a.name.split(".").pop().toLowerCase():"png",C=`emoji_${s.substring(0,8)}.${l}`;r.set(s,C)}const I=r.get(s);t.push({name:g,file:I,source:a,fileHash:s,size:{...o}})}}),console.log(`Emoji deduplication: ${Object.keys(i).length} emojis using ${r.size} different image files`),t.find(g=>g.name==="neutral")||console.warn("Warning: neutral emoji not provided, default image will be used")}return t}getSkinInfo(){if(!this.config||!this.config.theme||!this.config.theme.skin)return{};const e=this.config.theme.skin,t={};return e.light&&(t.light={text_color:e.light.textColor||"#000000",background_color:e.light.backgroundColor||"#ffffff"},e.light.backgroundType==="image"&&e.light.backgroundImage&&(t.light.background_image="background_light.raw")),e.dark&&(t.dark={text_color:e.dark.textColor||"#ffffff",background_color:e.dark.backgroundColor||"#121212"},e.dark.backgroundType==="image"&&e.dark.backgroundImage&&(t.dark.background_image="background_dark.raw")),t}generateIndexJson(){if(!this.config)throw new Error("Configuration object not set");const e={version:1,chip_model:this.config.chip.model,hide_subtitle:this.config.theme.font.hide_subtitle||!1,display_config:{width:this.config.chip.display.width,height:this.config.chip.display.height,monochrome:!1,color:this.config.chip.display.color||"RGB565"}},t=this.getWakewordModelInfo();if(t&&(e.srmodels=t.filename,t.type==="MultiNet"&&t.custom)){const r=t.custom;e.multinet_model={language:r.model.includes("_en")?"en":"cn",duration:r.duration||3e3,threshold:r.threshold/100,commands:[{command:r.command,text:r.name,action:"wake"}]}}const i=this.getFontInfo();i&&(e.text_font=i.filename);const n=this.getSkinInfo();Object.keys(n).length>0&&(e.skin=n);const o=this.getEmojiCollectionInfo();return o.length>0&&(e.emoji_collection=o.map(r=>({name:r.name,file:r.file}))),e}preparePackageResources(){var g,s,a,I;const e={files:[],indexJson:this.generateIndexJson(),config:{...this.config}},t=this.getWakewordModelInfo();t&&t.name&&e.files.push({type:"wakeword",name:t.name,filename:t.filename,modelType:t.type,isCustom:t.type==="MultiNet"});const i=this.getFontInfo();i&&e.files.push({type:"font",filename:i.filename,source:i.source,config:i.config||null});const n=this.getEmojiCollectionInfo(),o=new Set;n.forEach(l=>{if(l.fileHash){if(o.has(l.fileHash)){console.log(`Skipping duplicate file: ${l.name} -> ${l.file} (hash: ${l.fileHash.substring(0,8)})`);return}o.add(l.fileHash)}e.files.push({type:"emoji",name:l.name,filename:l.file,source:l.source,size:l.size,fileHash:l.fileHash})});const r=(s=(g=this.config)==null?void 0:g.theme)==null?void 0:s.skin;return((a=r==null?void 0:r.light)==null?void 0:a.backgroundType)==="image"&&r.light.backgroundImage&&e.files.push({type:"background",filename:"background_light.raw",source:r.light.backgroundImage,mode:"light"}),((I=r==null?void 0:r.dark)==null?void 0:I.backgroundType)==="image"&&r.dark.backgroundImage&&e.files.push({type:"background",filename:"background_dark.raw",source:r.dark.backgroundImage,mode:"dark"}),e}async preprocessCustomFonts(e=null){const t=this.getFontInfo();if(t&&t.type==="custom"&&!this.convertedFonts.has(t.filename)){e&&e(20,"Converting custom font...");try{const i={fontFile:t.source,fontName:t.filename.replace(/\.bin$/,""),fontSize:t.config.size,bpp:t.config.bpp,charset:t.config.charset,symbols:t.config.symbols||"",range:t.config.range||"",compression:!1,progressCallback:(o,r)=>{e&&e(20+o*.2,`Font conversion: ${r}`)}};let n;if(await this.fontConverterBrowser.initialize(),n=await this.fontConverterBrowser.convertToCBIN(i),this.convertedFonts.set(t.filename,n),this.autoSaveEnabled){const o=`converted_font_${t.filename}`;try{await this.configStorage.saveTempData(o,n,"converted_font",{filename:t.filename,size:t.config.size,bpp:t.config.bpp,charset:t.config.charset}),console.log(`Converted font saved to storage: ${t.filename}`)}catch(r){console.warn(`Failed to save converted font: ${t.filename}`,r)}}}catch(i){throw console.error("Font conversion failed:",i),new Error(`Font conversion failed: ${i.message}`)}}}async generateAssetsBin(e=null){if(!this.config)throw new Error("Configuration object not set");try{e&&e(0,"Starting generation..."),await this.preprocessCustomFonts(e),await new Promise(n=>setTimeout(n,100)),e&&e(40,"Preparing resource files...");const t=this.preparePackageResources();this.wakenetPacker.clear(),this.spiffsGenerator.clear(),await this.processResourceFiles(t,e),await new Promise(n=>setTimeout(n,100)),e&&e(90,"Generating final file..."),this.spiffsGenerator.printFileList();const i=await this.spiffsGenerator.generate((n,o)=>{e&&e(90+n*.1,o)});return e&&e(100,"Generation completed"),new Blob([i],{type:"application/octet-stream"})}catch(t){throw console.error("Failed to generate assets.bin:",t),t}}downloadAssetsBin(e,t="assets.bin"){const i=URL.createObjectURL(e),n=document.createElement("a");n.href=i,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(i)}async getFontInfoWithDetails(e=null){var t,i,n,o;try{const r=e||((o=(n=(i=(t=this.config)==null?void 0:t.theme)==null?void 0:i.font)==null?void 0:n.custom)==null?void 0:o.file);if(!r)return null;let g;return await this.fontConverterBrowser.initialize(),g=await this.fontConverterBrowser.getFontInfo(r),{...g,file:r,isCustom:!0}}catch(r){return console.error("Failed to get font details:",r),null}}async estimateFontSize(e=null){var t,i,n;try{const o=e||((n=(i=(t=this.config)==null?void 0:t.theme)==null?void 0:i.font)==null?void 0:n.custom);if(!o)return null;const r={fontSize:o.size,bpp:o.bpp,charset:o.charset,symbols:o.symbols||"",range:o.range||""};let g;return g=this.fontConverterBrowser.estimateSize(r),g}catch(o){return console.error("Failed to estimate font size:",o),null}}validateCustomFont(e){const t=[],i=[];return e.file?this.fontConverterBrowser.validateFont(e.file)||t.push("Font file format not supported"):t.push("Missing font file"),(e.size<8||e.size>80)&&t.push("Font size must be between 8-80"),[1,2,4,8].includes(e.bpp)||t.push("BPP must be 1, 2, 4 or 8"),!e.charset&&!e.symbols&&!e.range&&i.push("No charset, symbols or range specified, default charset will be used"),{valid:t.length===0,errors:t,warnings:i}}getConverterStatus(){return{initialized:this.fontConverterBrowser.initialized,supportedFormats:this.fontConverterBrowser.supportedFormats}}async processResourceFiles(e,t=null){let i=0;const n=e.files.length,o=new TextEncoder().encode(JSON.stringify(e.indexJson,null,2));console.log("index.json",e.indexJson),this.spiffsGenerator.addFile("index.json",o.buffer);for(const r of e.files){const g=40+i/n*40;t&&t(g,`Processing file: ${r.filename}`);try{await this.processResourceFile(r),i++}catch(s){throw console.error(`Failed to process resource file: ${r.filename}`,s),new Error(`Failed to process resource file: ${r.filename} - ${s.message}`)}}}async processResourceFile(e){switch(e.type){case"wakeword":await this.processWakewordModel(e);break;case"font":await this.processFontFile(e);break;case"emoji":await this.processEmojiFile(e);break;case"background":await this.processBackgroundFile(e);break;default:console.warn(`Unknown resource type: ${e.type}`)}}async processWakewordModel(e){if(!await this.wakenetPacker.loadModelFromShare(e.name))throw new Error(`Failed to load wakeword model: ${e.name}`);const i=this.wakenetPacker.packModels();this.spiffsGenerator.addFile(e.filename,i)}async processFontFile(e){if(e.config){const t=this.convertedFonts.get(e.filename);if(t)this.spiffsGenerator.addFile(e.filename,t);else throw new Error(`Converted font not found: ${e.filename}`)}else{const t=await this.loadPresetFont(e.source);this.spiffsGenerator.addFile(e.filename,t)}}async processEmojiFile(e){var r,g;let t,i=!1,n="png",o=!1;if(typeof e.source=="string"&&e.source.startsWith("preset:")){const s=e.source.replace("preset:","");t=await this.loadPresetEmoji(s,e.name)}else{const s=e.source;o=this.isGifFile(s),n=s.name.split(".").pop().toLowerCase();try{const I=await this.getImageDimensions(s),l=e.size||{width:64,height:64};(I.width>l.width||I.height>l.height)&&(i=!0,console.log(`Emoji ${e.name} needs scaling: ${I.width}x${I.height} -> ${l.width}x${l.height}`))}catch(I){console.warn(`Failed to get emoji image dimensions: ${e.name}`,I)}i||(t=await this.fileToArrayBuffer(s))}if(i)try{const s=e.size||{width:64,height:64};if(o){console.log(`Using WasmGifScaler to process GIF emoji: ${e.name}`);const a=await this.gifScaler.scaleGif(e.source,{maxWidth:s.width,maxHeight:s.height,keepAspectRatio:!0,lossy:30});t=await this.fileToArrayBuffer(a)}else t=await this.scaleImageToFit(e.source,s,n)}catch(s){console.error(`Failed to scale emoji image: ${e.name}`,s),t=await this.fileToArrayBuffer(e.source)}this.spiffsGenerator.addFile(e.filename,t,{width:((r=e.size)==null?void 0:r.width)||0,height:((g=e.size)==null?void 0:g.height)||0}),e.fileHash&&console.log(`Emoji file added: ${e.filename} (hash: ${e.fileHash.substring(0,8)})`)}async processBackgroundFile(e){const t=await this.fileToArrayBuffer(e.source),i=await this.convertImageToRgb565(t);this.spiffsGenerator.addFile(e.filename,i)}async loadPresetFont(e){try{const t=await fetch(`./static/fonts/${e}.bin`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return await t.arrayBuffer()}catch(t){throw new Error(`Failed to load preset font: ${e} - ${t.message}`)}}async loadPresetEmoji(e,t){try{const i=await fetch(`./static/${e}/${t}.png`);if(!i.ok)throw new Error(`HTTP ${i.status}`);return await i.arrayBuffer()}catch(i){throw new Error(`Failed to load preset emoji: ${e}/${t} - ${i.message}`)}}fileToArrayBuffer(e){return new Promise((t,i)=>{const n=new FileReader;n.onload=()=>t(n.result),n.onerror=()=>i(new Error("Failed to read file")),n.readAsArrayBuffer(e)})}async scaleImageToFit(e,t,i="png"){return new Promise((n,o)=>{const r=e instanceof File?e:new Blob([e]),g=URL.createObjectURL(r),s=new Image;s.onload=()=>{try{const a=document.createElement("canvas"),I=a.getContext("2d");a.width=t.width,a.height=t.height;const l=s.width/s.height,C=t.width/t.height;let Q,E,f,h;l>C?(Q=t.width,E=t.width/l,f=0,h=(t.height-E)/2):(E=t.height,Q=t.height*l,f=(t.width-Q)/2,h=0),i==="png"?I.clearRect(0,0,a.width,a.height):(I.fillStyle="#FFFFFF",I.fillRect(0,0,a.width,a.height)),I.drawImage(s,f,h,Q,E),a.toBlob(u=>{const p=new FileReader;p.onload=()=>n(p.result),p.onerror=()=>o(new Error("Failed to convert image data")),p.readAsArrayBuffer(u)},`image/${i}`),URL.revokeObjectURL(g)}catch(a){URL.revokeObjectURL(g),o(a)}},s.onerror=()=>{URL.revokeObjectURL(g),o(new Error("Unable to load image"))},s.src=g})}isGifFile(e){return e.type==="image/gif"?!0:e.name.split(".").pop().toLowerCase()==="gif"}async getImageDimensions(e){return new Promise((t,i)=>{const n=e instanceof File?e:new Blob([e]),o=URL.createObjectURL(n),r=new Image;r.onload=()=>{URL.revokeObjectURL(o),t({width:r.width,height:r.height})},r.onerror=()=>{URL.revokeObjectURL(o),i(new Error("Unable to get image dimensions"))},r.src=o})}async convertImageToRgb565(e){return new Promise((t,i)=>{const n=new Blob([e]),o=URL.createObjectURL(n),r=new Image;r.onload=()=>{var g,s,a,I,l,C;try{const Q=document.createElement("canvas"),E=Q.getContext("2d",{willReadFrequently:!0});Q.width=((a=(s=(g=this.config)==null?void 0:g.chip)==null?void 0:s.display)==null?void 0:a.width)||320,Q.height=((C=(l=(I=this.config)==null?void 0:I.chip)==null?void 0:l.display)==null?void 0:C.height)||240;const f=r.width/r.height,h=Q.width/Q.height;let u,p,c,d;f>h?(p=Q.height,u=Q.height*f,c=(Q.width-u)/2,d=0):(u=Q.width,p=Q.width/f,c=0,d=(Q.height-p)/2),E.drawImage(r,c,d,u,p);const F=E.getImageData(0,0,Q.width,Q.height).data,N=new ArrayBuffer(Q.width*Q.height*2),G=new Uint16Array(N);for(let Y=0;Y>3,gA=F[Y+1]>>2,FA=F[Y+2]>>3;G[Y/4]=q<<11|gA<<5|FA}const P=25,b=18,R=Q.width*2,L=28,cA=L+N.byteLength,dA=new ArrayBuffer(cA),CA=new Uint8Array(dA),iA=new DataView(dA);let X=0;const eA=0|b<<8|P;iA.setUint32(X,eA,!0),X+=4;const fA=Q.height<<16|Q.width;iA.setUint32(X,fA,!0),X+=4;const DA=0|R;iA.setUint32(X,DA,!0),X+=4,iA.setUint32(X,N.byteLength,!0),X+=4,iA.setUint32(X,L,!0),X+=4,iA.setUint32(X,0,!0),X+=4,iA.setUint32(X,0,!0),X+=4,CA.set(new Uint8Array(N),L),URL.revokeObjectURL(o),t(dA)}catch(Q){URL.revokeObjectURL(o),i(Q)}},r.onerror=()=>{URL.revokeObjectURL(o),i(new Error("Unable to load image"))},r.src=o})}cleanup(){this.resources.clear(),this.tempFiles=[],this.convertedFonts.clear(),this.wakenetPacker.clear(),this.spiffsGenerator.clear(),this.gifScaler.dispose()}async clearAllStoredData(){try{await this.configStorage.clearAll(),this.cleanup(),console.log("All stored data cleared")}catch(e){throw console.error("Failed to clear stored data:",e),e}}async getStorageStatus(){try{const e=await this.configStorage.getStorageInfo();return{hasStoredData:await this.configStorage.hasStoredConfig(),storageInfo:e,autoSaveEnabled:this.autoSaveEnabled}}catch(e){return console.error("Failed to get storage status:",e),{hasStoredData:!1,storageInfo:null,autoSaveEnabled:this.autoSaveEnabled}}}setAutoSave(e){this.autoSaveEnabled=e,console.log(`Auto-save ${e?"enabled":"disabled"}`)}getResourceSummary(){const e=[],t=this.preparePackageResources(),i={wakeword:0,font:0,emoji:0,background:0};return t.files.forEach(n=>{i[n.type]=(i[n.type]||0)+1;let o="";switch(n.type){case"wakeword":o=`Wakeword model: ${n.name} (${n.modelType})`;break;case"font":n.config?o=`Custom font: size ${n.config.size}px, BPP ${n.config.bpp}`:o=`Preset font: ${n.source}`;break;case"emoji":o=`Emoji: ${n.name} (${n.size.width}x${n.size.height})`;break;case"background":o=`${n.mode==="light"?"Light":"Dark"} mode background`;break}e.push({type:n.type,filename:n.filename,description:o})}),{files:e,counts:i,totalFiles:e.length,indexJson:t.indexJson}}}const aS={class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4"},IS={class:"bg-white rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden"},CS={class:"flex items-center justify-between p-6 border-b border-gray-200"},lS={class:"text-lg font-medium text-gray-900"},BS={key:1,class:"text-sm text-orange-600 font-medium"},QS={class:"p-6 overflow-y-auto",style:{"max-height":"calc(90vh - 140px)"}},cS={key:0,class:"space-y-6"},ES={class:"font-medium text-gray-900 mb-3"},uS={class:"bg-gray-50 rounded-lg p-4 space-y-2 text-sm"},hS={class:"flex justify-between"},fS={class:"text-gray-600"},dS={class:"font-medium"},pS={class:"flex justify-between"},mS={class:"text-gray-600"},yS={class:"font-medium"},wS={class:"flex justify-between"},DS={class:"text-gray-600"},kS={class:"font-medium"},vS={class:"flex justify-between"},FS={class:"text-gray-600"},SS={class:"font-medium"},bS={class:"flex justify-between"},RS={class:"text-gray-600"},NS={class:"font-medium"},GS={class:"font-medium text-gray-900 mb-3"},LS={class:"space-y-2 max-h-64 overflow-y-auto"},US={class:"flex items-center"},MS={class:"text-sm font-medium text-gray-900"},xS={class:"text-sm text-gray-700"},JS={key:0,class:"text-xs text-gray-500 ml-1"},TS={key:1,class:"text-xs text-gray-500 ml-1"},HS={key:1,class:"space-y-6 text-center"},YS={class:"space-y-4"},_S={class:"text-gray-600 mt-2"},KS={class:"bg-gray-200 rounded-full h-2 overflow-hidden"},PS={class:"text-sm text-gray-600"},OS={class:"mt-1"},VS={class:"space-y-2 text-left"},WS={class:"flex-shrink-0 mr-3"},qS={key:0,class:"w-5 h-5 bg-green-500 rounded-full flex items-center justify-center"},jS={key:1,class:"w-5 h-5 bg-primary-500 rounded-full animate-pulse"},ZS={key:2,class:"w-5 h-5 bg-gray-300 rounded-full"},XS={key:2,class:"text-center space-y-6"},zS={class:"text-gray-600 mt-2"},$S={class:"bg-green-50 border border-green-200 rounded-lg p-4"},Ab={class:"text-sm text-green-800 space-y-1"},eb={class:"space-y-3"},tb=["disabled"],ib={key:3,class:"space-y-6 text-center"},nb={class:"space-y-4"},ob={class:"text-gray-600"},rb={class:"bg-gray-200 rounded-full h-2 overflow-hidden"},gb={class:"text-sm text-gray-600"},sb={class:"mt-1"},ab={key:4,class:"text-center mt-4"},Ib={class:"text-sm text-red-600"},Cb={class:"flex justify-end space-x-3 p-6 border-t border-gray-200"},lb=["disabled"],Bb={__name:"GenerateModal",props:{config:{type:Object,required:!0}},emits:["close","generate","startFlash","cancelFlash"],setup(A,{emit:e}){const{t}=ve(),i=A,n=e,{deviceInfo:o}=No(),r=EA(!1),g=EA(!1),s=EA(0),a=EA(""),I=EA(""),l=EA(""),C=EA(null),Q=EA(null),E=EA(!1),f=EA(!1),h=EA(0),u=EA(""),p=EA(""),c=hA(()=>[{id:1,name:t("progressSteps.init"),status:"pending"},{id:2,name:t("progressSteps.font"),status:"pending"},{id:3,name:t("progressSteps.wakeword"),status:"pending"},{id:4,name:t("progressSteps.emoji"),status:"pending"},{id:5,name:t("progressSteps.background"),status:"pending"},{id:6,name:t("progressSteps.index"),status:"pending"},{id:7,name:t("progressSteps.spiffs"),status:"pending"},{id:8,name:t("progressSteps.package"),status:"pending"}]),d=EA([]),w=Ki({render:()=>GA("svg",{fill:"currentColor",viewBox:"0 0 20 20"},[GA("path",{d:"M4 3a2 2 0 00-2 2v1a1 1 0 001 1h14a1 1 0 001-1V5a2 2 0 00-2-2H4zM3 8a1 1 0 011-1h12a1 1 0 011 1v5a2 2 0 01-2 2H5a2 2 0 01-2-2V8z"})])}),F=Ki({render:()=>GA("svg",{fill:"currentColor",viewBox:"0 0 20 20"},[GA("path",{"fill-rule":"evenodd",d:"M7 4a3 3 0 016 0v4a3 3 0 11-6 0V4zm4 10.93A7.001 7.001 0 0017 8a1 1 0 10-2 0A5 5 0 015 8a1 1 0 00-2 0 7.001 7.001 0 006 6.93V17H6a1 1 0 100 2h8a1 1 0 100-2h-3v-2.07z","clip-rule":"evenodd"})])}),N=Ki({render:()=>GA("svg",{fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[GA("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 4l8 16m-6-6h4"})])}),G=Ki({render:()=>GA("svg",{fill:"currentColor",viewBox:"0 0 20 20"},[GA("path",{"fill-rule":"evenodd",d:"M4 3a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V5a2 2 0 00-2-2H4zm12 12H4l4-8 3 6 2-4 3 6z","clip-rule":"evenodd"})])}),P=hA(()=>d.value.length>0),b=()=>{const Y=i.config.theme.wakeword;return!Y||Y.type==="none"?t("wakewordConfig.noWakeword"):Y.type==="preset"?{wn9s_hilexin:"Hi,乐鑫",wn9s_hiesp:"Hi,ESP",wn9s_nihaoxiaozhi:"你好小智",wn9_nihaoxiaozhi_tts:"你好小智",wn9_alexa:"Alexa"}[Y.preset]||Y.preset:Y.type==="custom"?Y.custom.name||t("wakewordConfig.customWakeword"):t("wakewordConfig.noWakeword")},R=()=>i.config.theme.font.type==="preset"?i.config.theme.font.preset.replace("font_","").replace("_"," "):t("generateModal.customFont"),L=()=>i.config.theme.emoji.type==="preset"&&i.config.theme.emoji.preset?i.config.theme.emoji.preset==="twemoji32"?"Twemoji 32×32":"Twemoji 64×64":i.config.theme.emoji.type==="custom"?t("generateModal.customEmoji"):i.config.theme.emoji.type==="none"?t("emojiConfig.noEmojiPack"):t("generateModal.notConfigured"),cA=()=>{d.value=[],d.value.push({id:"index",name:"index.json",description:"配置索引文件",icon:w,iconColor:"text-blue-500",size:"1KB"});const Y=i.config.theme.wakeword;if(Y&&Y.type!=="none"&&d.value.push({id:"srmodels",name:"srmodels.bin",description:Y.type==="custom"?"自定义命令词模型":"预设唤醒词模型",icon:F,iconColor:"text-green-500",size:Y.type==="custom"?"~1.2MB":"~300KB"}),i.config.theme.font.type==="preset"){const q={font_puhui_deepseek_14_1:"180KB",font_puhui_deepseek_16_4:"720KB",font_puhui_deepseek_20_4:"1.1MB",font_puhui_deepseek_30_4:"2.5MB"};d.value.push({id:"font",name:`${i.config.theme.font.preset}.bin`,description:"预设字体文件",icon:N,iconColor:"text-yellow-500",size:q[i.config.theme.font.preset]||"500KB"})}else if(i.config.theme.font.custom.file){const q=i.config.theme.font.custom,gA=Math.max(100,q.size*q.size*q.bpp*.7);d.value.push({id:"font",name:`font_custom_${q.size}_${q.bpp}.bin`,description:"自定义字体文件",icon:N,iconColor:"text-yellow-500",size:gA>1024?`${(gA/1024).toFixed(1)}MB`:`${Math.round(gA)}KB`,estimated:!0})}if(i.config.theme.emoji.type==="preset"&&i.config.theme.emoji.preset){const q=["neutral","happy","laughing","funny","sad","angry","crying","loving","embarrassed","surprised","shocked","thinking","winking","cool","relaxed","delicious","kissy","confident","sleepy","silly","confused"],gA=i.config.theme.emoji.preset==="twemoji64"?"3KB":"1KB";q.forEach(FA=>{d.value.push({id:`emoji_${FA}`,name:`${FA}.png`,description:`${FA}表情图片`,icon:G,iconColor:"text-pink-500",size:gA})})}else if(i.config.theme.emoji.type==="custom"){const q=i.config.theme.emoji.custom,gA=q.emotionMap||{},FA=q.fileMap||{};if(q.images,Object.keys(gA).length===0||Object.keys(FA).length===0){console.error(t("errors.incompatibleEmojiData"));return}const LA=new Map,TA=new Map;Object.entries(gA).forEach(([M,Z])=>{const $=FA[Z];if($){if(!LA.has(Z)){const IA=Math.round($.size/1024);LA.set(Z,{file:$,size:IA>1024?`${(IA/1024).toFixed(1)}MB`:`${IA}KB`,emotions:[]})}LA.get(Z).emotions.push(M),TA.set(M,Z)}}),LA.forEach((M,Z)=>{const $=M.emotions.join(", "),IA=M.emotions.length>1;d.value.push({id:`emoji_${Z.substring(0,8)}`,name:`emoji_${Z.substring(0,8)}.${M.file.name.split(".").pop()}`,description:IA?`共享表情图片 (${$})`:`${$}表情图片`,icon:G,iconColor:IA?"text-purple-500":"text-pink-500",size:M.size,isCustomEmoji:!0})}),LA.size1024?`${(FA/1024).toFixed(1)}MB`:`${FA}KB`,estimated:!0})}if(i.config.theme.skin.dark.backgroundType==="image"&&i.config.theme.skin.dark.backgroundImage){const{width:q,height:gA}=i.config.chip.display,FA=Math.round(q*gA*2/1024);d.value.push({id:"bg_dark",name:"background_dark.raw",description:"深色模式背景图片",icon:G,iconColor:"text-indigo-500",size:FA>1024?`${(FA/1024).toFixed(1)}MB`:`${FA}KB`,estimated:!0})}},dA=Y=>{if(Y===0)return"0 B";const q=1024,gA=["B","KB","MB","GB"],FA=Math.floor(Math.log(Y)/Math.log(q));return`${parseFloat((Y/Math.pow(q,FA)).toFixed(2))} ${gA[FA]}`},CA=Y=>{if(Y<1e3)return`${Y}ms`;if(Y<6e4)return`${(Y/1e3).toFixed(1)}s`;{const q=Math.floor(Y/6e4),gA=Math.floor(Y%6e4/1e3);return`${q}m ${gA}s`}},iA=async()=>{r.value=!0,s.value=0,Q.value=Date.now();try{const Y=new Yl;Y.setConfig(i.config);const q=await Y.generateAssetsBin((LA,TA)=>{s.value=parseInt(LA),a.value=TA;const M=Math.floor(LA/(100/c.value.length));c.value.forEach((Z,$)=>{${LA.status="completed"}),n("generate",d.value.map(LA=>({id:LA.id,name:LA.name})))}catch(Y){console.error("生成 assets.bin 失败:",Y),r.value=!1,g.value=!1,alert(t("errors.generationFailed",{error:Y.message}))}},X=()=>{if(C.value){const Y=URL.createObjectURL(C.value),q=document.createElement("a");q.href=Y,q.download="assets.bin",q.style.display="none",document.body.appendChild(q),q.click(),document.body.removeChild(q),URL.revokeObjectURL(Y)}else console.error(t("errors.noFileToDownload"))},eA=async()=>{try{const q=new URLSearchParams(window.location.search).get("token");if(!q){E.value=!1;return}const gA=await fetch("/api/messaging/device/tools/list",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${q}`}});E.value=gA.ok}catch(Y){console.error(t("flashProgress.unableToGetDeviceStatus"),Y),E.value=!1}},fA=async()=>{if(!C.value){alert(t("errors.noFileToDownload"));return}if(!E.value){alert(t("errors.deviceOffline"));return}if(o.value.assetsPartition&&o.value.assetsPartition.size){const Y=o.value.assetsPartition.size,q=C.value.size;if(q>Y){const gA=(q/1024/1024).toFixed(2),FA=(Y/1024/1024).toFixed(2);alert(t("errors.fileTooLarge",{fileSize:gA,partitionSize:FA}));return}}f.value=!0,h.value=0,u.value=t("flashProgress.startingFileTransfer"),p.value="";try{n("startFlash",{blob:C.value,onProgress:(Y,q)=>{h.value=Y,u.value=q},onComplete:()=>{f.value=!1,h.value=100,u.value=t("flashProgress.flashCompleted")},onError:Y=>{f.value=!1,p.value=Y,console.error(t("flashProgress.onlineFlashFailed",{error:Y}))}})}catch(Y){f.value=!1,p.value=t("flashProgress.onlineFlashFailed",{error:Y.message}),console.error(t("flashProgress.onlineFlashFailed",{error:Y}))}},DA=()=>{confirm(t("errors.flashCancelConfirm"))&&(f.value=!1,h.value=0,u.value="",p.value="",n("cancelFlash"))};return Ft(async()=>{cA(),await eA()}),(Y,q)=>(H(),_("div",aS,[B("div",IS,[B("div",CS,[B("h3",lS,v(Y.$t("generateModal.title")),1),f.value?(H(),_("div",BS,v(Y.$t("generateModal.flashingInProgress")),1)):(H(),_("button",{key:0,onClick:q[0]||(q[0]=gA=>Y.$emit("close")),class:"text-gray-400 hover:text-gray-500"},[...q[3]||(q[3]=[B("svg",{class:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])]))]),B("div",QS,[!r.value&&!g.value?(H(),_("div",cS,[B("div",null,[B("h4",ES,v(Y.$t("generateModal.confirmConfig")),1),B("div",uS,[B("div",hS,[B("span",fS,v(Y.$t("generateModal.chipModel")),1),B("span",dS,v(A.config.chip.model.toUpperCase()),1)]),B("div",pS,[B("span",mS,v(Y.$t("generateModal.resolution")),1),B("span",yS,v(A.config.chip.display.width)+"×"+v(A.config.chip.display.height),1)]),B("div",wS,[B("span",DS,v(Y.$t("generateModal.wakeword")),1),B("span",kS,v(b()),1)]),B("div",vS,[B("span",FS,v(Y.$t("generateModal.font")),1),B("span",SS,v(R()),1)]),B("div",bS,[B("span",RS,v(Y.$t("generateModal.emoji")),1),B("span",NS,v(L()),1)])])]),B("div",null,[B("h4",GS,v(Y.$t("generateModal.fileList")),1),B("div",LS,[(H(!0),_(jA,null,Ke(d.value,gA=>(H(),_("div",{key:gA.id,class:"flex items-center justify-between px-3 py-2 border border-gray-200 rounded bg-gray-50"},[B("div",US,[(H(),ye(TI(gA.icon),{class:kA(["w-4 h-4 mr-2",gA.iconColor])},null,8,["class"])),B("span",MS,v(gA.name),1)]),B("div",xS,[gt(v(gA.size)+" ",1),gA.estimated?(H(),_("span",JS,v(Y.$t("generateModal.estimated")),1)):sA("",!0),gA.isCustomEmoji?(H(),_("span",TS,v(Y.$t("generateModal.compressed")),1)):sA("",!0)])]))),128))])])])):sA("",!0),r.value?(H(),_("div",HS,[q[5]||(q[5]=B("div",{class:"flex items-center justify-center"},[B("div",{class:"animate-spin rounded-full h-16 w-16 border-b-2 border-primary-500"})],-1)),B("div",YS,[B("p",_S,v(Y.$t("generateModal.generating")),1),B("div",KS,[B("div",{class:"bg-primary-500 h-2 rounded-full transition-all duration-500 ease-out",style:WA({width:s.value+"%"})},null,4)]),B("div",PS,[B("div",null,v(a.value),1),B("div",OS,v(Y.$t("generateModal.progress",{progress:s.value})),1)])]),B("div",VS,[(H(!0),_(jA,null,Ke(c.value,gA=>(H(),_("div",{key:gA.id,class:"flex items-center text-sm"},[B("div",WS,[gA.status==="completed"?(H(),_("div",qS,[...q[4]||(q[4]=[B("svg",{class:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"})],-1)])])):gA.status==="processing"?(H(),_("div",jS)):(H(),_("div",ZS))]),B("span",{class:kA([gA.status==="completed"?"text-green-700":gA.status==="processing"?"text-primary-700":"text-gray-500"])},v(gA.name),3)]))),128))])])):sA("",!0),g.value&&!f.value?(H(),_("div",XS,[q[8]||(q[8]=B("div",{class:"mx-auto flex items-center justify-center"},[B("svg",{class:"w-20 h-20 text-green-600",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z","clip-rule":"evenodd"})])],-1)),B("div",null,[B("p",zS,v(Y.$t("generateModal.completed")),1)]),B("div",$S,[B("div",Ab,[B("div",null,v(Y.$t("generateModal.filename")),1),B("div",null,v(Y.$t("generateModal.fileSize",{size:I.value})),1),B("div",null,v(Y.$t("generateModal.generationTime",{time:l.value})),1)])]),B("div",eb,[B("button",{onClick:X,class:"w-full bg-gray-100 hover:bg-gray-200 text-gray-700 px-6 py-3 rounded-lg font-medium transition-colors flex items-center justify-center"},[q[6]||(q[6]=B("svg",{class:"w-5 h-5 mr-2",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)),gt(" "+v(Y.$t("generateModal.downloadAssets")),1)]),B("button",{onClick:fA,disabled:!E.value,class:"w-full bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-6 py-3 rounded-lg font-medium transition-colors flex items-center justify-center"},[q[7]||(q[7]=B("svg",{class:"w-5 h-5 mr-2",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)),gt(" "+v(Y.$t("generateModal.flashToDevice")),1)],8,tb)])])):sA("",!0),f.value&&!p.value?(H(),_("div",ib,[q[9]||(q[9]=B("div",{class:"flex items-center justify-center"},[B("div",{class:"animate-spin rounded-full h-16 w-16 border-b-2 border-blue-500"})],-1)),B("div",nb,[B("p",ob,v(Y.$t("generateModal.flashing")),1),B("div",rb,[B("div",{class:"bg-blue-500 h-2 rounded-full transition-all duration-500 ease-out",style:WA({width:h.value+"%"})},null,4)]),B("div",gb,[B("div",null,v(u.value),1),B("div",sb,v(Y.$t("generateModal.progress",{progress:h.value})),1)])]),B("button",{onClick:DA,class:"px-4 py-2 text-sm font-medium text-red-600 bg-red-50 hover:bg-red-100 rounded-md transition-colors"},v(Y.$t("generateModal.flashingCancel")),1)])):sA("",!0),p.value?(H(),_("div",ab,[B("p",Ib,v(p.value),1)])):sA("",!0)]),B("div",Cb,[!r.value&&!g.value?(H(),_("button",{key:0,onClick:q[1]||(q[1]=gA=>Y.$emit("close")),class:"px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-md transition-colors"},v(Y.$t("common.cancel")),1)):sA("",!0),!r.value&&!g.value?(H(),_("button",{key:1,onClick:iA,disabled:!P.value,class:"px-6 py-2 text-sm font-medium text-white bg-primary-500 hover:bg-primary-600 disabled:bg-gray-300 rounded-md transition-colors"},v(Y.$t("common.start"))+" "+v(Y.$t("common.generate")),9,lb)):sA("",!0),g.value&&!f.value?(H(),_("button",{key:2,onClick:q[2]||(q[2]=gA=>Y.$emit("close")),class:"px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-md transition-colors"},v(Y.$t("common.close")),1)):sA("",!0)])])]))}};class Qb{constructor(e){this.token=e,this.ws=null,this.isConnected=!1,this.isCancelled=!1,this.chunkSize=64*1024,this.onProgress=null,this.onError=null,this.onComplete=null,this.onDownloadUrlReady=null,this.onTransferStarted=null,this.currentSession=null,this.totalBytesSent=0,this.isSendingChunk=!1}async connect(){return new Promise((e,t)=>{try{const i=`wss://api.tenclass.net/transfer/?token=${encodeURIComponent(this.token)}`;this.ws=new WebSocket(i),this.ws.onopen=()=>{this.isConnected=!0,console.log("WebSocket connected to transfer server"),e()},this.ws.onmessage=n=>{this.handleMessage(n)},this.ws.onerror=n=>{console.error("WebSocket error:",n),this.isConnected=!1,t(new Error("WebSocket connection failed"))},this.ws.onclose=n=>{console.log("WebSocket closed:",n.code,n.reason),this.isConnected=!1},setTimeout(()=>{this.isConnected||(this.ws.close(),t(new Error("WebSocket connection timeout")))},1e4)}catch(i){t(new Error(`Failed to create WebSocket connection: ${i.message}`))}})}handleMessage(e){try{if(typeof e.data=="string"){const t=JSON.parse(e.data);switch(t.type){case"file_created":this.currentSession&&(this.currentSession.url=t.url,this.onDownloadUrlReady&&this.onDownloadUrlReady(t.url));break;case"transfer_started":this.currentSession&&(this.currentSession.transferStarted=!0,this.onTransferStarted&&this.onTransferStarted(),this.currentSession.transferReady&&this.sendFileData());break;case"ack":if(this.currentSession){const{blob:i}=this.currentSession,n=i.size,o=t.bytesSent;if(o<0){console.error("Invalid server bytesSent (negative):",o),this.isSendingChunk=!1,this.onError&&this.onError(new Error("Server returned invalid byte count"));return}if(o>n){console.error(`Server bytesSent (${o}) exceeds fileSize (${n})`),this.isSendingChunk=!1,this.onError&&this.onError(new Error("Server byte count exceeds file size"));return}this.isSendingChunk=!1,o>this.currentSession.bytesSent&&(this.currentSession.bytesSent=o),this.sendFileData()}break;case"transfer_completed":if(this.currentSession){const i=this.currentSession.blob.size;this.totalBytesSent!==i&&console.warn(`Transfer size mismatch: sent ${this.totalBytesSent} bytes, expected ${i} bytes`)}this.onComplete&&this.onComplete();break;case"error":console.error("Transfer error:",t.message),this.onError&&this.onError(new Error(t.message));break}}}catch(t){console.error("Error handling message:",t),this.onError&&this.onError(t)}}async sendFileData(){if(this.isSendingChunk||!this.currentSession||this.isCancelled)return;const{blob:e}=this.currentSession,t=e.size;let i=this.currentSession.bytesSent;if(i>=t){this.onProgress&&this.onProgress(100,"Transfer completed, waiting for device confirmation...");return}if(this.isSendingChunk=!0,i>t){console.error(`Critical error: bytesSent (${i}) exceeds fileSize (${t})`),this.onError&&this.onError(new Error("Transfer byte count exceeds file size"));return}const n=Math.max(0,t-i),o=Math.min(this.chunkSize,n);if(o<=0)return;const r=e.slice(i,i+o);try{const g=await new Promise((l,C)=>{const Q=new FileReader;Q.onload=()=>l(Q.result),Q.onerror=()=>C(new Error("File read failed")),Q.readAsArrayBuffer(r)});if(this.isCancelled)return;this.ws.send(g);const s=i+o;if(this.currentSession.bytesSent=s,this.totalBytesSent+=o,s>t){console.error(`Critical error: bytesSent (${s}) exceeds fileSize (${t})`),this.onError&&this.onError(new Error("Transfer byte count exceeds file size"));return}if(this.totalBytesSent>t){console.error(`Critical error: totalBytesSent (${this.totalBytesSent}) exceeds fileSize (${t})`),this.onError&&this.onError(new Error("Total sent bytes exceed file size"));return}const a=Math.round(s/t*60)+40,I=`Transferring... ${Math.round(s/1024)}KB / ${Math.round(t/1024)}KB`;this.onProgress&&this.onProgress(a,I)}catch(g){console.error("Error sending file chunk:",g),this.isSendingChunk=!1,this.onError&&this.onError(g)}}async initializeSession(e,t,i,n){return new Promise((o,r)=>{this.onProgress=t,this.onError=g=>{i&&i(g),r(g)},this.onDownloadUrlReady=g=>{n&&n(g),o(g)},this.isCancelled=!1;try{this.onProgress&&this.onProgress(5,"Connecting to transfer server..."),this.connect().then(()=>{this.onProgress&&this.onProgress(10,"Creating file session...");const g={type:"create_file",fileName:"assets.bin",fileSize:e.size};this.ws.send(JSON.stringify(g)),this.currentSession={blob:e,bytesSent:0,fileSize:e.size,transferStarted:!1,transferReady:!0},this.totalBytesSent=0}).catch(g=>{console.error("Transfer initialization failed:",g),this.onError&&this.onError(g)})}catch(g){console.error("Transfer initialization failed:",g),this.onError&&this.onError(g)}})}async startTransfer(e,t,i){return new Promise((n,o)=>{if(this.onProgress=e,this.onError=r=>{this.isSendingChunk=!1,t&&t(r),o(r)},this.onComplete=()=>{this.isSendingChunk=!1,i&&i(),n()},!this.currentSession||!this.currentSession.blob){const r=new Error("Transfer session not initialized");this.onError&&this.onError(r),o(r);return}this.currentSession.transferReady=!0,this.currentSession.transferStarted&&this.sendFileData()})}async transferFile(e,t,i,n,o){if(o){await this.initializeSession(e,t,i,o);return}this.onProgress=t,this.onError=i,this.onComplete=n,this.isCancelled=!1;try{this.onProgress&&this.onProgress(5,"Connecting to transfer server..."),await this.connect(),this.onProgress&&this.onProgress(10,"Creating file session...");const r={type:"create_file",fileName:"assets.bin",fileSize:e.size};this.ws.send(JSON.stringify(r)),this.currentSession={blob:e,bytesSent:0,fileSize:e.size,transferStarted:!1,transferReady:!0}}catch(r){console.error("Transfer initialization failed:",r),this.onError&&this.onError(r)}}cancel(){this.isCancelled=!0,this.isSendingChunk=!1,this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.close()}destroy(){this.cancel(),this.onProgress=null,this.onError=null,this.onComplete=null,this.onDownloadUrlReady=null,this.onTransferStarted=null,this.totalBytesSent=0,this.isSendingChunk=!1}}const cb={class:"flex items-center justify-between mb-2"},Eb={class:"flex items-center"},ub={class:"text-blue-800 font-medium"},hb={class:"text-blue-600 text-sm mb-3"},fb={class:"flex justify-end space-x-2"},db={class:"flex items-center justify-center mb-8"},pb={class:"flex flex-col items-center"},mb={class:"text-sm mt-2 text-gray-600"},yb={key:0,class:"w-16 h-0.5 bg-gray-300 mx-4"},wb={class:"bg-white rounded-lg shadow-sm border p-6"},_l={__name:"HomePage",setup(A){const{callMcpTool:e}=No(),{t}=ve(),i=EA(0),n=EA(!1),o=EA("wakeword"),r=EA(!1),g=EA(!1),s=EA(!1),a=EA(!0),I=new Yl,l=EA(null),C=EA(null),Q=[{titleKey:"steps.chip",key:"chip"},{titleKey:"steps.theme",key:"theme"},{titleKey:"steps.generate",key:"generate"}],E=EA({chip:{model:"",display:{width:320,height:240,color:"RGB565"}},theme:{wakeword:{type:"none",preset:"",custom:{name:"",command:"",threshold:20,duration:3e3,model:"mn6_cn"}},font:{type:"none",preset:"",hide_subtitle:!1,custom:{file:null,size:20,bpp:4,charset:"deepseek"}},emoji:{type:"none",preset:"",custom:{size:{width:160,height:120},images:{}}},skin:{light:{backgroundType:"color",backgroundColor:"#ffffff",textColor:"#000000",backgroundImage:null},dark:{backgroundType:"color",backgroundColor:"#121212",textColor:"#ffffff",backgroundImage:null}}}});hA(()=>E.value.chip.model&&(E.value.theme.font.type==="none"||E.value.theme.font.preset||E.value.theme.font.custom.file));const f=CA=>CA{i.value{i.value>0&&i.value--},p=()=>{n.value=!0},c=async CA=>{},d=()=>new URLSearchParams(window.location.search).get("token"),w=async(CA,iA={})=>await e(CA,iA),F=async CA=>{const{blob:iA,onProgress:X,onComplete:eA,onError:fA}=CA;try{const DA=d();if(!DA)throw new Error(t("flashProgress.authTokenMissing"));X(5,t("flashProgress.checkingDeviceStatus"));try{if(!await w("self.get_device_status"))throw new Error(t("flashProgress.deviceOfflineOrUnresponsive",{error:t("flashProgress.unableToGetDeviceStatus")}))}catch(M){console.error("检查设备状态失败:",M),fA(t("flashProgress.deviceOfflineOrUnresponsive",{error:M.message}));return}X(15,t("flashProgress.initializingTransferService")),C.value=new Qb(DA);let Y=null;const q=new Promise((M,Z)=>{Y=M});let gA=null;const FA=new Promise((M,Z)=>{gA=M});C.value.onTransferStarted=()=>{gA&&(gA(),gA=null)},await C.value.initializeSession(iA,(M,Z)=>{X(15+M*.75,Z)},M=>{console.error("WebSocket初始化失败:",M),fA(t("flashProgress.initializeTransferFailed",{error:M.message}))},M=>{Y(M)});const LA=await q;X(30,t("flashProgress.settingDeviceDownloadUrl"));try{await w("self.assets.set_download_url",{url:LA})}catch(M){console.error("设置下载URL失败:",M),fA(t("flashProgress.setDownloadUrlFailed",{error:M.message}));return}X(40,t("flashProgress.rebootingDevice")),w("self.reboot").catch(M=>{console.warn("reboot指令调用警告(设备可能已重启):",M)}),X(50,t("flashProgress.waitingForDeviceReboot"));const TA=new Promise((M,Z)=>{setTimeout(()=>Z(new Error(t("flashProgress.deviceRebootTimeout"))),6e4)});await Promise.race([FA,TA]),X(60,t("flashProgress.startingFileTransfer")),await C.value.startTransfer((M,Z)=>{const $=60+M*.4;X(Math.round($),Z)},M=>{fA(t("flashProgress.onlineFlashFailed",{error:M.message}))},()=>{eA()}),C.value.onTransferStarted=null}catch(DA){console.error("在线烧录失败:",DA),fA(t("flashProgress.onlineFlashFailed",{error:DA.message}))}},N=()=>{C.value&&(C.value.cancel(),C.value.destroy(),C.value=null)},G=CA=>{o.value=CA},P=async()=>{var CA,iA,X;try{a.value=!0;const eA=await Qe.loadConfig();if(eA){E.value=eA.config,i.value=0,o.value="wakeword",r.value=!0,g.value=!0,await b(),l.value&&clearTimeout(l.value),l.value=setTimeout(()=>{r.value=!1},5e3),I.setConfig(E.value,{strict:!1}),await I.restoreAllResourcesFromStorage(E.value);try{const fA=((X=(iA=(CA=E.value)==null?void 0:CA.theme)==null?void 0:iA.emoji)==null?void 0:X.custom)||{},DA=fA.images||{},Y=fA.fileMap||{},q=fA.emotionMap||{};E.value={...E.value,theme:{...E.value.theme,emoji:{...E.value.theme.emoji,custom:{...fA,images:{...DA},fileMap:{...Y},emotionMap:{...q}}}}}}catch(fA){console.error("刷新表情配置引用失败:",fA)}}else r.value=!1,g.value=!1}catch(eA){console.error("加载配置失败:",eA),r.value=!1,g.value=!1}finally{a.value=!1}},b=async()=>{var CA,iA,X;try{const eA=(X=(iA=(CA=E.value)==null?void 0:CA.theme)==null?void 0:iA.emoji)==null?void 0:X.custom;if(!eA)return;const fA=Object.keys(eA.images||{}).length>0,DA=eA.fileMap&&Object.keys(eA.fileMap).length>0,Y=eA.emotionMap&&Object.keys(eA.emotionMap).length>0;if(fA&&(!DA||!Y)){console.warn("⚠️ 检测到旧版本的表情数据结构(不兼容)"),console.log("正在清理旧数据...");try{const gA=Object.keys(eA.images||{});for(const FA of gA)await Qe.deleteFile(`emoji_${FA}`);console.log(`已删除 ${gA.length} 个旧表情文件`)}catch(gA){console.warn("清理旧表情文件时出错:",gA)}E.value.theme.emoji.custom={size:eA.size||{width:64,height:64},images:{},fileMap:{},emotionMap:{}},E.value.theme.emoji.type==="custom"&&(E.value.theme.emoji.type="",console.log("已重置表情类型,请重新选择")),await R(),console.log("✅ 旧表情数据已完全清除"),setTimeout(()=>{alert(`检测到旧版本的表情数据结构已被清除。 - -新版本使用文件去重技术,可以节省存储空间。 - -请重新上传自定义表情图片。`)},500)}}catch(eA){console.error("清理旧表情数据时出错:",eA)}},R=async()=>{try{await Qe.saveConfig(E.value)}catch(CA){console.error("保存配置失败:",CA)}},L=async()=>{try{s.value=!0,await I.clearAllStoredData();const CA={model:E.value.chip.model,display:{...E.value.chip.display}};E.value={chip:CA,theme:{wakeword:{type:"none",preset:"",custom:{name:"",command:"",threshold:20,model:"mn6_cn"}},font:{type:"none",preset:"",hide_subtitle:!1,custom:{file:null,size:20,bpp:4,charset:"deepseek"}},emoji:{type:"none",preset:"",custom:{size:{width:64,height:64},images:{}}},skin:{light:{backgroundType:"color",backgroundColor:"#ffffff",textColor:"#000000",backgroundImage:null},dark:{backgroundType:"color",backgroundColor:"#121212",textColor:"#ffffff",backgroundImage:null}}}},i.value=0,o.value="wakeword",r.value=!1,g.value=!1}catch(CA){console.error("重置配置失败:",CA),alert(t("errors.resetFailed"))}finally{s.value=!1}};ae(E,async CA=>{!a.value&&g.value&&await R()},{deep:!0}),Ft(async()=>{await Qe.initialize(),await P()}),Ci(()=>{l.value&&clearTimeout(l.value)});const cA=()=>{r.value=!1,l.value&&clearTimeout(l.value)},dA=()=>{l.value&&clearTimeout(l.value),l.value=setTimeout(()=>{r.value=!1},5e3)};return(CA,iA)=>(H(),_("div",null,[r.value?(H(),_("div",{key:0,class:"fixed bottom-4 right-4 z-50 bg-blue-50 border border-blue-200 rounded-lg p-4 shadow-lg transition-opacity duration-300 min-w-[300px]",onMouseenter:dA},[B("div",cb,[B("div",Eb,[iA[3]||(iA[3]=B("svg",{class:"w-5 h-5 text-blue-500 mr-2",fill:"currentColor",viewBox:"0 0 20 20"},[B("path",{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z","clip-rule":"evenodd"})],-1)),B("span",ub,v(CA.$t("configNotice.title")),1)]),B("button",{onClick:cA,class:"text-gray-500 hover:text-gray-700"},[...iA[4]||(iA[4]=[B("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[B("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),B("p",hb,v(CA.$t("configNotice.message")),1),B("div",fb,[B("button",{onClick:L,class:"px-3 py-1 text-sm text-red-600 hover:text-red-800 font-medium"},v(CA.$t("configNotice.restart")),1)])],32)):sA("",!0),B("div",db,[(H(),_(jA,null,Ke(Q,(X,eA)=>B("div",{key:eA,class:"flex items-center"},[B("div",pb,[B("div",{class:kA(f(eA))},v(eA+1),3),B("span",mb,v(CA.$t(X.titleKey)),1)]),eAE.value.chip=X),onNext:h},null,8,["modelValue"])):sA("",!0),i.value===1?(H(),ye(my,{key:1,modelValue:E.value.theme,"onUpdate:modelValue":iA[1]||(iA[1]=X=>E.value.theme=X),chipModel:E.value.chip.model,activeTab:o.value,onNext:h,onPrev:u,onTabChange:G},null,8,["modelValue","chipModel","activeTab"])):sA("",!0),i.value===2?(H(),ye(cw,{key:2,config:E.value,onGenerate:p,onPrev:u},null,8,["config"])):sA("",!0)]),n.value?(H(),ye(Bb,{key:1,config:E.value,onClose:iA[2]||(iA[2]=X=>n.value=!1),onGenerate:c,onStartFlash:F,onCancelFlash:N},null,8,["config"])):sA("",!0)]))}},Db=Object.freeze(Object.defineProperty({__proto__:null,default:_l},Symbol.toStringTag,{value:"Module"})),kb={class:"min-h-screen bg-gray-50"},vb={class:"bg-white shadow-sm border-b"},Fb={class:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4"},Sb={class:"flex flex-col relative sm:flex-row items-start sm:items-center justify-between gap-3 sm:gap-0"},bb={class:"text-2xl font-bold text-gray-900"},Rb={class:"flex items-center space-x-4"},Nb={class:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8"},Gb={__name:"App",setup(A){const e=EA(""),t=()=>{e.value&&(window.location.href=e.value)};return Ft(()=>{e.value=sessionStorage.getItem("devicePath")}),(i,n)=>(H(),_("div",kb,[B("header",vb,[B("div",Fb,[B("div",Sb,[e.value?(H(),_("div",{key:0,class:"bg-primary-500 hover:bg-primary-600 text-white px-6 py-1 rounded-md cursor-pointer",onClick:t},"返回")):sA("",!0),B("h1",bb,v(i.$t("header.title")),1),B("div",Rb,[HA(ch),HA(rd)])])])]),B("main",Nb,[HA(_l)])]))}};/*! - * vue-router v4.6.4 - * (c) 2025 Eduardo San Martin Morote - * @license MIT - */const Ei=typeof document<"u";function Kl(A){return typeof A=="object"||"displayName"in A||"props"in A||"__vccOpts"in A}function Lb(A){return A.__esModule||A[Symbol.toStringTag]==="Module"||A.default&&Kl(A.default)}const MA=Object.assign;function or(A,e){const t={};for(const i in e){const n=e[i];t[i]=qe(n)?n.map(A):A(n)}return t}const $i=()=>{},qe=Array.isArray;function Ta(A,e){const t={};for(const i in A)t[i]=i in e?e[i]:A[i];return t}const Pl=/#/g,Ub=/&/g,Mb=/\//g,xb=/=/g,Jb=/\?/g,Ol=/\+/g,Tb=/%5B/g,Hb=/%5D/g,Vl=/%5E/g,Yb=/%60/g,Wl=/%7B/g,_b=/%7C/g,ql=/%7D/g,Kb=/%20/g;function vg(A){return A==null?"":encodeURI(""+A).replace(_b,"|").replace(Tb,"[").replace(Hb,"]")}function Pb(A){return vg(A).replace(Wl,"{").replace(ql,"}").replace(Vl,"^")}function Hr(A){return vg(A).replace(Ol,"%2B").replace(Kb,"+").replace(Pl,"%23").replace(Ub,"%26").replace(Yb,"`").replace(Wl,"{").replace(ql,"}").replace(Vl,"^")}function Ob(A){return Hr(A).replace(xb,"%3D")}function Vb(A){return vg(A).replace(Pl,"%23").replace(Jb,"%3F")}function Wb(A){return Vb(A).replace(Mb,"%2F")}function Qn(A){if(A==null)return null;try{return decodeURIComponent(""+A)}catch{}return""+A}const qb=/\/$/,jb=A=>A.replace(qb,"");function rr(A,e,t="/"){let i,n={},o="",r="";const g=e.indexOf("#");let s=e.indexOf("?");return s=g>=0&&s>g?-1:s,s>=0&&(i=e.slice(0,s),o=e.slice(s,g>0?g:e.length),n=A(o.slice(1))),g>=0&&(i=i||e.slice(0,g),r=e.slice(g,e.length)),i=$b(i??e,t),{fullPath:i+o+r,path:i,query:n,hash:Qn(r)}}function Zb(A,e){const t=e.query?A(e.query):"";return e.path+(t&&"?")+t+(e.hash||"")}function Ha(A,e){return!e||!A.toLowerCase().startsWith(e.toLowerCase())?A:A.slice(e.length)||"/"}function Xb(A,e,t){const i=e.matched.length-1,n=t.matched.length-1;return i>-1&&i===n&&Ni(e.matched[i],t.matched[n])&&jl(e.params,t.params)&&A(e.query)===A(t.query)&&e.hash===t.hash}function Ni(A,e){return(A.aliasOf||A)===(e.aliasOf||e)}function jl(A,e){if(Object.keys(A).length!==Object.keys(e).length)return!1;for(var t in A)if(!zb(A[t],e[t]))return!1;return!0}function zb(A,e){return qe(A)?Ya(A,e):qe(e)?Ya(e,A):(A==null?void 0:A.valueOf())===(e==null?void 0:e.valueOf())}function Ya(A,e){return qe(e)?A.length===e.length&&A.every((t,i)=>t===e[i]):A.length===1&&A[0]===e}function $b(A,e){if(A.startsWith("/"))return A;if(!A)return e;const t=e.split("/"),i=A.split("/"),n=i[i.length-1];(n===".."||n===".")&&i.push("");let o=t.length-1,r,g;for(r=0;r1&&o--;else break;return t.slice(0,o).join("/")+"/"+i.slice(r).join("/")}const Gt={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Yr=function(A){return A.pop="pop",A.push="push",A}({}),gr=function(A){return A.back="back",A.forward="forward",A.unknown="",A}({});function AR(A){if(!A)if(Ei){const e=document.querySelector("base");A=e&&e.getAttribute("href")||"/",A=A.replace(/^\w+:\/\/[^\/]+/,"")}else A="/";return A[0]!=="/"&&A[0]!=="#"&&(A="/"+A),jb(A)}const eR=/^[^#]+#/;function tR(A,e){return A.replace(eR,"#")+e}function iR(A,e){const t=document.documentElement.getBoundingClientRect(),i=A.getBoundingClientRect();return{behavior:e.behavior,left:i.left-t.left-(e.left||0),top:i.top-t.top-(e.top||0)}}const Uo=()=>({left:window.scrollX,top:window.scrollY});function nR(A){let e;if("el"in A){const t=A.el,i=typeof t=="string"&&t.startsWith("#"),n=typeof t=="string"?i?document.getElementById(t.slice(1)):document.querySelector(t):t;if(!n)return;e=iR(n,A)}else e=A;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function _a(A,e){return(history.state?history.state.position-e:-1)+A}const _r=new Map;function oR(A,e){_r.set(A,e)}function rR(A){const e=_r.get(A);return _r.delete(A),e}function gR(A){return typeof A=="string"||A&&typeof A=="object"}function Zl(A){return typeof A=="string"||typeof A=="symbol"}let zA=function(A){return A[A.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",A[A.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",A[A.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",A[A.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",A[A.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",A}({});const Xl=Symbol("");zA.MATCHER_NOT_FOUND+"",zA.NAVIGATION_GUARD_REDIRECT+"",zA.NAVIGATION_ABORTED+"",zA.NAVIGATION_CANCELLED+"",zA.NAVIGATION_DUPLICATED+"";function Gi(A,e){return MA(new Error,{type:A,[Xl]:!0},e)}function ct(A,e){return A instanceof Error&&Xl in A&&(e==null||!!(A.type&e))}const sR=["params","query","hash"];function aR(A){if(typeof A=="string")return A;if(A.path!=null)return A.path;const e={};for(const t of sR)t in A&&(e[t]=A[t]);return JSON.stringify(e,null,2)}function IR(A){const e={};if(A===""||A==="?")return e;const t=(A[0]==="?"?A.slice(1):A).split("&");for(let i=0;in&&Hr(n)):[i&&Hr(i)]).forEach(n=>{n!==void 0&&(e+=(e.length?"&":"")+t,n!=null&&(e+="="+n))})}return e}function CR(A){const e={};for(const t in A){const i=A[t];i!==void 0&&(e[t]=qe(i)?i.map(n=>n==null?null:""+n):i==null?i:""+i)}return e}const lR=Symbol(""),Pa=Symbol(""),Fg=Symbol(""),zl=Symbol(""),Kr=Symbol("");function _i(){let A=[];function e(i){return A.push(i),()=>{const n=A.indexOf(i);n>-1&&A.splice(n,1)}}function t(){A=[]}return{add:e,list:()=>A.slice(),reset:t}}function Tt(A,e,t,i,n,o=r=>r()){const r=i&&(i.enterCallbacks[n]=i.enterCallbacks[n]||[]);return()=>new Promise((g,s)=>{const a=C=>{C===!1?s(Gi(zA.NAVIGATION_ABORTED,{from:t,to:e})):C instanceof Error?s(C):gR(C)?s(Gi(zA.NAVIGATION_GUARD_REDIRECT,{from:e,to:C})):(r&&i.enterCallbacks[n]===r&&typeof C=="function"&&r.push(C),g())},I=o(()=>A.call(i&&i.instances[n],e,t,a));let l=Promise.resolve(I);A.length<3&&(l=l.then(a)),l.catch(C=>s(C))})}function sr(A,e,t,i,n=o=>o()){const o=[];for(const r of A)for(const g in r.components){let s=r.components[g];if(!(e!=="beforeRouteEnter"&&!r.instances[g]))if(Kl(s)){const a=(s.__vccOpts||s)[e];a&&o.push(Tt(a,t,i,r,g,n))}else{let a=s();o.push(()=>a.then(I=>{if(!I)throw new Error(`Couldn't resolve component "${g}" at "${r.path}"`);const l=Lb(I)?I.default:I;r.mods[g]=I,r.components[g]=l;const C=(l.__vccOpts||l)[e];return C&&Tt(C,t,i,r,g,n)()}))}}return o}function BR(A,e){const t=[],i=[],n=[],o=Math.max(e.matched.length,A.matched.length);for(let r=0;rNi(a,g))?i.push(g):t.push(g));const s=A.matched[r];s&&(e.matched.find(a=>Ni(a,s))||n.push(s))}return[t,i,n]}/*! - * vue-router v4.6.4 - * (c) 2025 Eduardo San Martin Morote - * @license MIT - */let QR=()=>location.protocol+"//"+location.host;function $l(A,e){const{pathname:t,search:i,hash:n}=e,o=A.indexOf("#");if(o>-1){let r=n.includes(A.slice(o))?A.slice(o).length:1,g=n.slice(r);return g[0]!=="/"&&(g="/"+g),Ha(g,"")}return Ha(t,A)+i+n}function cR(A,e,t,i){let n=[],o=[],r=null;const g=({state:C})=>{const Q=$l(A,location),E=t.value,f=e.value;let h=0;if(C){if(t.value=Q,e.value=C,r&&r===E){r=null;return}h=f?C.position-f.position:0}else i(Q);n.forEach(u=>{u(t.value,E,{delta:h,type:Yr.pop,direction:h?h>0?gr.forward:gr.back:gr.unknown})})};function s(){r=t.value}function a(C){n.push(C);const Q=()=>{const E=n.indexOf(C);E>-1&&n.splice(E,1)};return o.push(Q),Q}function I(){if(document.visibilityState==="hidden"){const{history:C}=window;if(!C.state)return;C.replaceState(MA({},C.state,{scroll:Uo()}),"")}}function l(){for(const C of o)C();o=[],window.removeEventListener("popstate",g),window.removeEventListener("pagehide",I),document.removeEventListener("visibilitychange",I)}return window.addEventListener("popstate",g),window.addEventListener("pagehide",I),document.addEventListener("visibilitychange",I),{pauseListeners:s,listen:a,destroy:l}}function Oa(A,e,t,i=!1,n=!1){return{back:A,current:e,forward:t,replaced:i,position:window.history.length,scroll:n?Uo():null}}function ER(A){const{history:e,location:t}=window,i={value:$l(A,t)},n={value:e.state};n.value||o(i.value,{back:null,current:i.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function o(s,a,I){const l=A.indexOf("#"),C=l>-1?(t.host&&document.querySelector("base")?A:A.slice(l))+s:QR()+A+s;try{e[I?"replaceState":"pushState"](a,"",C),n.value=a}catch(Q){console.error(Q),t[I?"replace":"assign"](C)}}function r(s,a){o(s,MA({},e.state,Oa(n.value.back,s,n.value.forward,!0),a,{position:n.value.position}),!0),i.value=s}function g(s,a){const I=MA({},n.value,e.state,{forward:s,scroll:Uo()});o(I.current,I,!0),o(s,MA({},Oa(i.value,s,null),{position:I.position+1},a),!1),i.value=s}return{location:i,state:n,push:g,replace:r}}function uR(A){A=AR(A);const e=ER(A),t=cR(A,e.state,e.location,e.replace);function i(o,r=!0){r||t.pauseListeners(),history.go(o)}const n=MA({location:"",base:A,go:i,createHref:tR.bind(null,A)},e,t);return Object.defineProperty(n,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(n,"state",{enumerable:!0,get:()=>e.state.value}),n}let oi=function(A){return A[A.Static=0]="Static",A[A.Param=1]="Param",A[A.Group=2]="Group",A}({});var oe=function(A){return A[A.Static=0]="Static",A[A.Param=1]="Param",A[A.ParamRegExp=2]="ParamRegExp",A[A.ParamRegExpEnd=3]="ParamRegExpEnd",A[A.EscapeNext=4]="EscapeNext",A}(oe||{});const hR={type:oi.Static,value:""},fR=/[a-zA-Z0-9_]/;function dR(A){if(!A)return[[]];if(A==="/")return[[hR]];if(!A.startsWith("/"))throw new Error(`Invalid path "${A}"`);function e(Q){throw new Error(`ERR (${t})/"${a}": ${Q}`)}let t=oe.Static,i=t;const n=[];let o;function r(){o&&n.push(o),o=[]}let g=0,s,a="",I="";function l(){a&&(t===oe.Static?o.push({type:oi.Static,value:a}):t===oe.Param||t===oe.ParamRegExp||t===oe.ParamRegExpEnd?(o.length>1&&(s==="*"||s==="+")&&e(`A repeatable param (${a}) must be alone in its segment. eg: '/:ids+.`),o.push({type:oi.Param,value:a,regexp:I,repeatable:s==="*"||s==="+",optional:s==="*"||s==="?"})):e("Invalid state to consume buffer"),a="")}function C(){a+=s}for(;ge.length?e.length===1&&e[0]===pe.Static+pe.Segment?1:-1:0}function AB(A,e){let t=0;const i=A.score,n=e.score;for(;t0&&e[e.length-1]<0}const DR={strict:!1,end:!0,sensitive:!1};function kR(A,e,t){const i=yR(dR(A.path),t),n=MA(i,{record:A,parent:e,children:[],alias:[]});return e&&!n.record.aliasOf==!e.record.aliasOf&&e.children.push(n),n}function vR(A,e){const t=[],i=new Map;e=Ta(DR,e);function n(l){return i.get(l)}function o(l,C,Q){const E=!Q,f=ja(l);f.aliasOf=Q&&Q.record;const h=Ta(e,l),u=[f];if("alias"in l){const d=typeof l.alias=="string"?[l.alias]:l.alias;for(const w of d)u.push(ja(MA({},f,{components:Q?Q.record.components:f.components,path:w,aliasOf:Q?Q.record:f})))}let p,c;for(const d of u){const{path:w}=d;if(C&&w[0]!=="/"){const F=C.record.path,N=F[F.length-1]==="/"?"":"/";d.path=C.record.path+(w&&N+w)}if(p=kR(d,C,h),Q?Q.alias.push(p):(c=c||p,c!==p&&c.alias.push(p),E&&l.name&&!Za(p)&&r(l.name)),eB(p)&&s(p),f.children){const F=f.children;for(let N=0;N{r(c)}:$i}function r(l){if(Zl(l)){const C=i.get(l);C&&(i.delete(l),t.splice(t.indexOf(C),1),C.children.forEach(r),C.alias.forEach(r))}else{const C=t.indexOf(l);C>-1&&(t.splice(C,1),l.record.name&&i.delete(l.record.name),l.children.forEach(r),l.alias.forEach(r))}}function g(){return t}function s(l){const C=bR(l,t);t.splice(C,0,l),l.record.name&&!Za(l)&&i.set(l.record.name,l)}function a(l,C){let Q,E={},f,h;if("name"in l&&l.name){if(Q=i.get(l.name),!Q)throw Gi(zA.MATCHER_NOT_FOUND,{location:l});h=Q.record.name,E=MA(qa(C.params,Q.keys.filter(c=>!c.optional).concat(Q.parent?Q.parent.keys.filter(c=>c.optional):[]).map(c=>c.name)),l.params&&qa(l.params,Q.keys.map(c=>c.name))),f=Q.stringify(E)}else if(l.path!=null)f=l.path,Q=t.find(c=>c.re.test(f)),Q&&(E=Q.parse(f),h=Q.record.name);else{if(Q=C.name?i.get(C.name):t.find(c=>c.re.test(C.path)),!Q)throw Gi(zA.MATCHER_NOT_FOUND,{location:l,currentLocation:C});h=Q.record.name,E=MA({},C.params,l.params),f=Q.stringify(E)}const u=[];let p=Q;for(;p;)u.unshift(p.record),p=p.parent;return{name:h,path:f,params:E,matched:u,meta:SR(u)}}A.forEach(l=>o(l));function I(){t.length=0,i.clear()}return{addRoute:o,resolve:a,removeRoute:r,clearRoutes:I,getRoutes:g,getRecordMatcher:n}}function qa(A,e){const t={};for(const i of e)i in A&&(t[i]=A[i]);return t}function ja(A){const e={path:A.path,redirect:A.redirect,name:A.name,meta:A.meta||{},aliasOf:A.aliasOf,beforeEnter:A.beforeEnter,props:FR(A),children:A.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in A?A.components||null:A.component&&{default:A.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function FR(A){const e={},t=A.props||!1;if("component"in A)e.default=t;else for(const i in A.components)e[i]=typeof t=="object"?t[i]:t;return e}function Za(A){for(;A;){if(A.record.aliasOf)return!0;A=A.parent}return!1}function SR(A){return A.reduce((e,t)=>MA(e,t.meta),{})}function bR(A,e){let t=0,i=e.length;for(;t!==i;){const o=t+i>>1;AB(A,e[o])<0?i=o:t=o+1}const n=RR(A);return n&&(i=e.lastIndexOf(n,i-1)),i}function RR(A){let e=A;for(;e=e.parent;)if(eB(e)&&AB(A,e)===0)return e}function eB({record:A}){return!!(A.name||A.components&&Object.keys(A.components).length||A.redirect)}function Xa(A){const e=rt(Fg),t=rt(zl),i=hA(()=>{const s=QA(A.to);return e.resolve(s)}),n=hA(()=>{const{matched:s}=i.value,{length:a}=s,I=s[a-1],l=t.matched;if(!I||!l.length)return-1;const C=l.findIndex(Ni.bind(null,I));if(C>-1)return C;const Q=za(s[a-2]);return a>1&&za(I)===Q&&l[l.length-1].path!==Q?l.findIndex(Ni.bind(null,s[a-2])):C}),o=hA(()=>n.value>-1&&MR(t.params,i.value.params)),r=hA(()=>n.value>-1&&n.value===t.matched.length-1&&jl(t.params,i.value.params));function g(s={}){if(UR(s)){const a=e[QA(A.replace)?"replace":"push"](QA(A.to)).catch($i);return A.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>a),a}return Promise.resolve()}return{route:i,href:hA(()=>i.value.href),isActive:o,isExactActive:r,navigate:g}}function NR(A){return A.length===1?A[0]:A}const GR=hn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Xa,setup(A,{slots:e}){const t=po(Xa(A)),{options:i}=rt(Fg),n=hA(()=>({[$a(A.activeClass,i.linkActiveClass,"router-link-active")]:t.isActive,[$a(A.exactActiveClass,i.linkExactActiveClass,"router-link-exact-active")]:t.isExactActive}));return()=>{const o=e.default&&NR(e.default(t));return A.custom?o:GA("a",{"aria-current":t.isExactActive?A.ariaCurrentValue:null,href:t.href,onClick:t.navigate,class:n.value},o)}}}),LR=GR;function UR(A){if(!(A.metaKey||A.altKey||A.ctrlKey||A.shiftKey)&&!A.defaultPrevented&&!(A.button!==void 0&&A.button!==0)){if(A.currentTarget&&A.currentTarget.getAttribute){const e=A.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return A.preventDefault&&A.preventDefault(),!0}}function MR(A,e){for(const t in e){const i=e[t],n=A[t];if(typeof i=="string"){if(i!==n)return!1}else if(!qe(n)||n.length!==i.length||i.some((o,r)=>o.valueOf()!==n[r].valueOf()))return!1}return!0}function za(A){return A?A.aliasOf?A.aliasOf.path:A.path:""}const $a=(A,e,t)=>A??e??t,xR=hn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(A,{attrs:e,slots:t}){const i=rt(Kr),n=hA(()=>A.route||i.value),o=rt(Pa,0),r=hA(()=>{let a=QA(o);const{matched:I}=n.value;let l;for(;(l=I[a])&&!l.components;)a++;return a}),g=hA(()=>n.value.matched[r.value]);Tn(Pa,hA(()=>r.value+1)),Tn(lR,g),Tn(Kr,n);const s=EA();return ae(()=>[s.value,g.value,A.name],([a,I,l],[C,Q,E])=>{I&&(I.instances[l]=a,Q&&Q!==I&&a&&a===C&&(I.leaveGuards.size||(I.leaveGuards=Q.leaveGuards),I.updateGuards.size||(I.updateGuards=Q.updateGuards))),a&&I&&(!Q||!Ni(I,Q)||!C)&&(I.enterCallbacks[l]||[]).forEach(f=>f(a))},{flush:"post"}),()=>{const a=n.value,I=A.name,l=g.value,C=l&&l.components[I];if(!C)return AI(t.default,{Component:C,route:a});const Q=l.props[I],E=Q?Q===!0?a.params:typeof Q=="function"?Q(a):Q:null,h=GA(C,MA({},E,e,{onVnodeUnmounted:u=>{u.component.isUnmounted&&(l.instances[I]=null)},ref:s}));return AI(t.default,{Component:h,route:a})||h}}});function AI(A,e){if(!A)return null;const t=A(e);return t.length===1?t[0]:t}const JR=xR;function TR(A){const e=vR(A.routes,A),t=A.parseQuery||IR,i=A.stringifyQuery||Ka,n=A.history,o=_i(),r=_i(),g=_i(),s=eg(Gt);let a=Gt;Ei&&A.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const I=or.bind(null,M=>""+M),l=or.bind(null,Wb),C=or.bind(null,Qn);function Q(M,Z){let $,IA;return Zl(M)?($=e.getRecordMatcher(M),IA=Z):IA=M,e.addRoute(IA,$)}function E(M){const Z=e.getRecordMatcher(M);Z&&e.removeRoute(Z)}function f(){return e.getRoutes().map(M=>M.record)}function h(M){return!!e.getRecordMatcher(M)}function u(M,Z){if(Z=MA({},Z||s.value),typeof M=="string"){const k=rr(t,M,Z.path),J=e.resolve({path:k.path},Z),W=n.createHref(k.fullPath);return MA(k,J,{params:C(J.params),hash:Qn(k.hash),redirectedFrom:void 0,href:W})}let $;if(M.path!=null)$=MA({},M,{path:rr(t,M.path,Z.path).path});else{const k=MA({},M.params);for(const J in k)k[J]==null&&delete k[J];$=MA({},M,{params:l(k)}),Z.params=l(Z.params)}const IA=e.resolve($,Z),bA=M.hash||"";IA.params=I(C(IA.params));const D=Zb(i,MA({},M,{hash:Pb(bA),path:IA.path})),S=n.createHref(D);return MA({fullPath:D,hash:bA,query:i===Ka?CR(M.query):M.query||{}},IA,{redirectedFrom:void 0,href:S})}function p(M){return typeof M=="string"?rr(t,M,s.value.path):MA({},M)}function c(M,Z){if(a!==M)return Gi(zA.NAVIGATION_CANCELLED,{from:Z,to:M})}function d(M){return N(M)}function w(M){return d(MA(p(M),{replace:!0}))}function F(M,Z){const $=M.matched[M.matched.length-1];if($&&$.redirect){const{redirect:IA}=$;let bA=typeof IA=="function"?IA(M,Z):IA;return typeof bA=="string"&&(bA=bA.includes("?")||bA.includes("#")?bA=p(bA):{path:bA},bA.params={}),MA({query:M.query,hash:M.hash,params:bA.path!=null?{}:M.params},bA)}}function N(M,Z){const $=a=u(M),IA=s.value,bA=M.state,D=M.force,S=M.replace===!0,k=F($,IA);if(k)return N(MA(p(k),{state:typeof k=="object"?MA({},bA,k.state):bA,force:D,replace:S}),Z||$);const J=$;J.redirectedFrom=Z;let W;return!D&&Xb(i,IA,$)&&(W=Gi(zA.NAVIGATION_DUPLICATED,{to:J,from:IA}),Y(IA,IA,!0,!1)),(W?Promise.resolve(W):b(J,IA)).catch(V=>ct(V)?ct(V,zA.NAVIGATION_GUARD_REDIRECT)?V:DA(V):eA(V,J,IA)).then(V=>{if(V){if(ct(V,zA.NAVIGATION_GUARD_REDIRECT))return N(MA({replace:S},p(V.to),{state:typeof V.to=="object"?MA({},bA,V.to.state):bA,force:D}),Z||J)}else V=L(J,IA,!0,S,bA);return R(J,IA,V),V})}function G(M,Z){const $=c(M,Z);return $?Promise.reject($):Promise.resolve()}function P(M){const Z=FA.values().next().value;return Z&&typeof Z.runWithContext=="function"?Z.runWithContext(M):M()}function b(M,Z){let $;const[IA,bA,D]=BR(M,Z);$=sr(IA.reverse(),"beforeRouteLeave",M,Z);for(const k of IA)k.leaveGuards.forEach(J=>{$.push(Tt(J,M,Z))});const S=G.bind(null,M,Z);return $.push(S),TA($).then(()=>{$=[];for(const k of o.list())$.push(Tt(k,M,Z));return $.push(S),TA($)}).then(()=>{$=sr(bA,"beforeRouteUpdate",M,Z);for(const k of bA)k.updateGuards.forEach(J=>{$.push(Tt(J,M,Z))});return $.push(S),TA($)}).then(()=>{$=[];for(const k of D)if(k.beforeEnter)if(qe(k.beforeEnter))for(const J of k.beforeEnter)$.push(Tt(J,M,Z));else $.push(Tt(k.beforeEnter,M,Z));return $.push(S),TA($)}).then(()=>(M.matched.forEach(k=>k.enterCallbacks={}),$=sr(D,"beforeRouteEnter",M,Z,P),$.push(S),TA($))).then(()=>{$=[];for(const k of r.list())$.push(Tt(k,M,Z));return $.push(S),TA($)}).catch(k=>ct(k,zA.NAVIGATION_CANCELLED)?k:Promise.reject(k))}function R(M,Z,$){g.list().forEach(IA=>P(()=>IA(M,Z,$)))}function L(M,Z,$,IA,bA){const D=c(M,Z);if(D)return D;const S=Z===Gt,k=Ei?history.state:{};$&&(IA||S?n.replace(M.fullPath,MA({scroll:S&&k&&k.scroll},bA)):n.push(M.fullPath,bA)),s.value=M,Y(M,Z,$,S),DA()}let cA;function dA(){cA||(cA=n.listen((M,Z,$)=>{if(!LA.listening)return;const IA=u(M),bA=F(IA,LA.currentRoute.value);if(bA){N(MA(bA,{replace:!0,force:!0}),IA).catch($i);return}a=IA;const D=s.value;Ei&&oR(_a(D.fullPath,$.delta),Uo()),b(IA,D).catch(S=>ct(S,zA.NAVIGATION_ABORTED|zA.NAVIGATION_CANCELLED)?S:ct(S,zA.NAVIGATION_GUARD_REDIRECT)?(N(MA(p(S.to),{force:!0}),IA).then(k=>{ct(k,zA.NAVIGATION_ABORTED|zA.NAVIGATION_DUPLICATED)&&!$.delta&&$.type===Yr.pop&&n.go(-1,!1)}).catch($i),Promise.reject()):($.delta&&n.go(-$.delta,!1),eA(S,IA,D))).then(S=>{S=S||L(IA,D,!1),S&&($.delta&&!ct(S,zA.NAVIGATION_CANCELLED)?n.go(-$.delta,!1):$.type===Yr.pop&&ct(S,zA.NAVIGATION_ABORTED|zA.NAVIGATION_DUPLICATED)&&n.go(-1,!1)),R(IA,D,S)}).catch($i)}))}let CA=_i(),iA=_i(),X;function eA(M,Z,$){DA(M);const IA=iA.list();return IA.length?IA.forEach(bA=>bA(M,Z,$)):console.error(M),Promise.reject(M)}function fA(){return X&&s.value!==Gt?Promise.resolve():new Promise((M,Z)=>{CA.add([M,Z])})}function DA(M){return X||(X=!M,dA(),CA.list().forEach(([Z,$])=>M?$(M):Z()),CA.reset()),M}function Y(M,Z,$,IA){const{scrollBehavior:bA}=A;if(!Ei||!bA)return Promise.resolve();const D=!$&&rR(_a(M.fullPath,0))||(IA||!$)&&history.state&&history.state.scroll||null;return un().then(()=>bA(M,Z,D)).then(S=>S&&nR(S)).catch(S=>eA(S,M,Z))}const q=M=>n.go(M);let gA;const FA=new Set,LA={currentRoute:s,listening:!0,addRoute:Q,removeRoute:E,clearRoutes:e.clearRoutes,hasRoute:h,getRoutes:f,resolve:u,options:A,push:d,replace:w,go:q,back:()=>q(-1),forward:()=>q(1),beforeEach:o.add,beforeResolve:r.add,afterEach:g.add,onError:iA.add,isReady:fA,install(M){M.component("RouterLink",LR),M.component("RouterView",JR),M.config.globalProperties.$router=LA,Object.defineProperty(M.config.globalProperties,"$route",{enumerable:!0,get:()=>QA(s)}),Ei&&!gA&&s.value===Gt&&(gA=!0,d(n.location).catch(IA=>{}));const Z={};for(const IA in Gt)Object.defineProperty(Z,IA,{get:()=>s.value[IA],enumerable:!0});M.provide(Fg,LA),M.provide(zl,wI(Z)),M.provide(Kr,s);const $=M.unmount;FA.add(M),M.unmount=function(){FA.delete(M),FA.size<1&&(a=Gt,cA&&cA(),cA=null,s.value=Gt,gA=!1,X=!1),$()}}};function TA(M){return M.reduce((Z,$)=>Z.then(()=>P($)),Promise.resolve())}return LA}const HR=[{path:"/",name:"Home",component:()=>Ll(()=>Promise.resolve().then(()=>Db),void 0,import.meta.url)}],YR=TR({history:uR("./"),routes:HR}),_R=hu({legacy:!1,locale:Ad(),fallbackLocale:"en",messages:$f}),Sg=hc(Gb);Sg.use(YR);Sg.use(_R);Sg.mount("#app"); diff --git a/main/manager-web/public/generator/favicon.ico b/main/manager-web/public/generator/favicon.ico new file mode 100644 index 00000000..5f285a58 Binary files /dev/null and b/main/manager-web/public/generator/favicon.ico differ diff --git a/main/manager-web/public/generator/index.html b/main/manager-web/public/generator/index.html index f21043da..ab8a05af 100644 --- a/main/manager-web/public/generator/index.html +++ b/main/manager-web/public/generator/index.html @@ -4,9 +4,10 @@ + Xiaozhi AI Customization - - + +
diff --git a/main/manager-web/src/views/DeviceManagement.vue b/main/manager-web/src/views/DeviceManagement.vue index 961680bc..d6aeaeb0 100644 --- a/main/manager-web/src/views/DeviceManagement.vue +++ b/main/manager-web/src/views/DeviceManagement.vue @@ -64,7 +64,7 @@ {{ $t('device.unbind') }} - + {{ $t('device.deviceThemeGeneration') }} @@ -337,10 +337,10 @@ export default { }); }); }, - handleGenertor() { + handleGenertor(row) { const pathname = window.location.pathname; const basePath = pathname.split('/').slice(0, -1).join('/'); - const url = `${window.location.origin}${basePath}/generator/`; + const url = `${window.location.origin}${basePath}/generator/?deviceId=${row.device_id}`; sessionStorage.setItem('devicePath', window.location.href); window.location.href = url; }, diff --git a/main/xiaozhi-server/config.yaml b/main/xiaozhi-server/config.yaml index fcf5cb44..c52d38ca 100644 --- a/main/xiaozhi-server/config.yaml +++ b/main/xiaozhi-server/config.yaml @@ -89,7 +89,8 @@ xiaozhi: transport: websocket audio_params: format: opus - sample_rate: 16000 + # Opus支持的采样率范围为[8000, 12000, 16000, 24000, 48000] + sample_rate: 24000 channels: 1 frame_duration: 60 @@ -717,13 +718,31 @@ TTS: speaker: zh_female_wanwanxiaohe_moon_bigtts # 开启WebSocket连接复用,默认复用(注意:复用后设备处于聆听状态时空闲链接会占并发数) enable_ws_reuse: True - speech_rate: 0 - loudness_rate: 0 - pitch: 0 - # 多情感音色参数,注意:当前仅部分音色支持设置情感。 - # 相关音色列表:https://www.volcengine.com/docs/6561/1257544 - emotion: "neutral" # 情感类型,可选值为:neutral、happy、sad、angry、fearful、disgusted、surprised - emotion_scale: 4 # 情感强度,可选值为:1~5,默认值为4 + # 相关参数文档:https://www.volcengine.com/docs/6561/1329505 + # 音频输出配置(audio_params)- 用户可自定义添加火山引擎支持的任何音频参数 + audio_params: + speech_rate: 0 # 语速(-50~100) + loudness_rate: 0 # 音量(-50~100) + # 多情感音色参数,注意:当前仅部分音色支持设置情感。 + # 相关音色列表:https://www.volcengine.com/docs/6561/1257544 + # emotion: "neutral" # 情感类型(仅部分音色支持):neutral、happy、sad、angry、fearful、disgusted、surprised + # emotion_scale: 4 # 情感强度(1~5) + # 高级文本处理配置(additions)- 用户可自定义添加火山引擎支持的任何高级参数 + additions: + post_process: + pitch: 0 # 音高(-12~12) + # aigc_metadata: {} # AIGC元数据配置 + # cache_config: {} # 缓存配置 + # 混音控制配置(mix_speaker)- 多音色混合(仅 TTS 1.0) + # 混音功能主要适用于豆包语音合成模型1.0的音色,使用时需要将req_params.speaker设置为custom_mix_bigtts + # mix_speaker: + # speakers: + # - source_speaker: zh_male_bvlazysheep + # mix_factor: 0.3 + # - source_speaker: BV120_streaming + # mix_factor: 0.3 + # - source_speaker: zh_male_ahu_conversation_wvae_bigtts + # mix_factor: 0.4 CosyVoiceSiliconflow: type: siliconflow # 硅基流动TTS @@ -840,7 +859,6 @@ TTS: # - "处理/(chu3)(li3)" # - "危险/dangerous" # audio_setting: - # sample_rate: 24000 # bitrate: 128000 # format: "mp3" # channel: 1 @@ -868,7 +886,6 @@ TTS: # 以下可不用设置,使用默认设置 # format: wav - # sample_rate: 16000 # volume: 50 # speech_rate: 0 # pitch_rate: 0 @@ -892,7 +909,6 @@ TTS: host: nls-gateway-cn-beijing.aliyuncs.com # 以下可不用设置,使用默认设置 # format: pcm # 音频格式:pcm、wav、mp3 - # sample_rate: 16000 # 采样率:8000、16000、24000 # volume: 50 # 音量:0-100 # speech_rate: 0 # 语速:-500到500 # pitch_rate: 0 # 语调:-500到500 @@ -1007,7 +1023,6 @@ TTS: protocol: websocket # protocol choices = ['websocket', 'http'] url: ws://127.0.0.1:8092/paddlespeech/tts/streaming # TTS 服务的 URL 地址,指向本地服务器 [websocket默认ws://127.0.0.1:8092/paddlespeech/tts/streaming,http默认http://127.0.0.1:8090/paddlespeech/tts] spk_id: 0 # 发音人 ID,0 通常表示默认的发音人 - sample_rate: 24000 # 采样率 [websocket默认24000,http默认0 自动选择] speed: 1.0 # 语速,1.0 表示正常语速,>1 表示加快,<1 表示减慢 volume: 1.0 # 音量,1.0 表示正常音量,>1 表示增大,<1 表示减小 save_path: # 保存路径 @@ -1031,7 +1046,6 @@ TTS: output_dir: tmp/ # 以下可不用设置,使用默认设置 # format: pcm # 音频格式:pcm、wav、mp3、opus - # sample_rate: 24000 # 采样率:16000, 24000, 48000 # volume: 50 # 音量:0-100 # rate: 1 # 语速:0.5~2 # pitch: 1 # 语调:0.5~2 @@ -1053,7 +1067,6 @@ TTS: # stop_split: 0 # 关闭服务端拆句 不关闭:0,关闭:1 # remain: 0 # 是否保留原书面语的样子 保留:1, 不保留:0 # format: raw # 音频格式:raw(PCM), lame(MP3), speex, opus, opus-wb, opus-swb, speex-wb - # sample_rate: 24000 # 采样率:16000, 8000, 24000 # volume: 50 # 音量:0-100 # speed: 50 # 语速:0-100 # pitch: 50 # 语调:0-100 diff --git a/main/xiaozhi-server/config/logger.py b/main/xiaozhi-server/config/logger.py index 60ca0678..4f687e45 100644 --- a/main/xiaozhi-server/config/logger.py +++ b/main/xiaozhi-server/config/logger.py @@ -5,7 +5,7 @@ from config.config_loader import load_config from config.settings import check_config_file from datetime import datetime -SERVER_VERSION = "0.8.11" +SERVER_VERSION = "0.9.1" _logger_initialized = False diff --git a/main/xiaozhi-server/core/connection.py b/main/xiaozhi-server/core/connection.py index 0578e041..d2856908 100644 --- a/main/xiaozhi-server/core/connection.py +++ b/main/xiaozhi-server/core/connection.py @@ -87,6 +87,7 @@ class ConnectionHandler: self.max_output_size = 0 self.chat_history_conf = 0 self.audio_format = "opus" + self.sample_rate = 24000 # 默认采样率,从客户端 hello 消息中动态更新 # 客户端状态相关 self.client_abort = False @@ -208,6 +209,10 @@ class ConnectionHandler: self.welcome_msg = self.config["xiaozhi"] self.welcome_msg["session_id"] = self.session_id + # 从配置中读取采样率 + self.sample_rate = self.welcome_msg["audio_params"]["sample_rate"] + self.logger.bind(tag=TAG).info(f"配置输出音频采样率为: {self.sample_rate}") + # 在后台初始化配置和组件(完全不阻塞主循环) asyncio.create_task(self._background_initialize()) @@ -1184,6 +1189,8 @@ class ConnectionHandler: if self.tts: await self.tts.close() + if self.asr: + await self.asr.close() # 最后关闭线程池(避免阻塞) if self.executor: @@ -1232,11 +1239,21 @@ class ConnectionHandler: f"清理结束: TTS队列大小={self.tts.tts_text_queue.qsize()}, 音频队列大小={self.tts.tts_audio_queue.qsize()}" ) - def reset_vad_states(self): - self.client_audio_buffer = bytearray() + def reset_audio_states(self): + """ + 重置所有音频相关状态(VAD + ASR) + """ + # Reset VAD states + self.client_audio_buffer.clear() self.client_have_voice = False self.client_voice_stop = False - self.logger.bind(tag=TAG).debug("VAD states reset.") + self.client_voice_window.clear() + self.last_is_voice = False + + # Clear ASR buffers + self.asr_audio.clear() + + self.logger.bind(tag=TAG).debug("All audio states reset.") def chat_and_close(self, text): """Chat with the user and then close the connection""" diff --git a/main/xiaozhi-server/core/handle/helloHandle.py b/main/xiaozhi-server/core/handle/helloHandle.py index cda7d17f..f28eb0dd 100644 --- a/main/xiaozhi-server/core/handle/helloHandle.py +++ b/main/xiaozhi-server/core/handle/helloHandle.py @@ -142,7 +142,8 @@ async def wakeupWordsResponse(conn): # 获取当前音色 voice = getattr(conn.tts, "voice", "default") - wav_bytes = opus_datas_to_wav_bytes(tts_result, sample_rate=16000) + # 使用链接的sample_rate + wav_bytes = opus_datas_to_wav_bytes(tts_result, sample_rate=conn.sample_rate) file_path = wakeup_words_config.generate_file_path(voice) with open(file_path, "wb") as f: f.write(wav_bytes) diff --git a/main/xiaozhi-server/core/handle/receiveAudioHandle.py b/main/xiaozhi-server/core/handle/receiveAudioHandle.py index ec1d3bc7..6490dc67 100644 --- a/main/xiaozhi-server/core/handle/receiveAudioHandle.py +++ b/main/xiaozhi-server/core/handle/receiveAudioHandle.py @@ -17,7 +17,6 @@ async def handleAudioMessage(conn, audio): if hasattr(conn, "just_woken_up") and conn.just_woken_up: have_voice = False # 设置一个短暂延迟后恢复VAD检测 - conn.asr_audio.clear() if not hasattr(conn, "vad_resume_task") or conn.vad_resume_task.done(): conn.vad_resume_task = asyncio.create_task(resume_vad_detection(conn)) return diff --git a/main/xiaozhi-server/core/handle/textHandler/listenMessageHandler.py b/main/xiaozhi-server/core/handle/textHandler/listenMessageHandler.py index c71649ed..81faaeff 100644 --- a/main/xiaozhi-server/core/handle/textHandler/listenMessageHandler.py +++ b/main/xiaozhi-server/core/handle/textHandler/listenMessageHandler.py @@ -26,10 +26,9 @@ class ListenTextMessageHandler(TextMessageHandler): f"客户端拾音模式:{conn.client_listen_mode}" ) if msg_json["state"] == "start": - conn.client_have_voice = True - conn.client_voice_stop = False + # 设备从播放模式切回录音模式,清除所有音频状态和缓冲区 + conn.reset_audio_states() elif msg_json["state"] == "stop": - conn.client_have_voice = True conn.client_voice_stop = True if conn.asr.interface_type == InterfaceType.STREAM: # 流式模式下,发送结束请求 @@ -38,14 +37,13 @@ class ListenTextMessageHandler(TextMessageHandler): # 非流式模式:直接触发ASR识别 if len(conn.asr_audio) > 0: asr_audio_task = conn.asr_audio.copy() - conn.asr_audio.clear() - conn.reset_vad_states() + conn.reset_audio_states() if len(asr_audio_task) > 0: await conn.asr.handle_voice_stop(conn, asr_audio_task) elif msg_json["state"] == "detect": conn.client_have_voice = False - conn.asr_audio.clear() + conn.reset_audio_states() if "text" in msg_json: conn.last_activity_time = time.time() * 1000 original_text = msg_json["text"] # 保留原始文本 diff --git a/main/xiaozhi-server/core/providers/asr/aliyun.py b/main/xiaozhi-server/core/providers/asr/aliyun.py index 36f41745..8824d17b 100644 --- a/main/xiaozhi-server/core/providers/asr/aliyun.py +++ b/main/xiaozhi-server/core/providers/asr/aliyun.py @@ -213,36 +213,24 @@ class ASRProvider(ASRProviderBase): return None async def speech_to_text( - self, opus_data: List[bytes], session_id: str, audio_format="opus" + self, opus_data: List[bytes], session_id: str, audio_format="opus", artifacts=None ) -> Tuple[Optional[str], Optional[str]]: """将语音数据转换为文本""" if self._is_token_expired(): logger.warning("Token已过期,正在自动刷新...") self._refresh_token() - file_path = None try: - # 解码Opus为PCM - if audio_format == "pcm": - pcm_data = opus_data - else: - pcm_data = self.decode_opus(opus_data) - combined_pcm_data = b"".join(pcm_data) - - # 判断是否保存为WAV文件 - if self.delete_audio_file: - pass - else: - file_path = self.save_audio_to_file(pcm_data, session_id) - + if artifacts is None: + return "", None # 发送请求并获取文本 - text = await self._send_request(combined_pcm_data) + text = await self._send_request(artifacts.pcm_bytes) if text: - return text, file_path + return text, artifacts.file_path - return "", file_path + return "", artifacts.file_path except Exception as e: logger.bind(tag=TAG).error(f"语音识别失败: {e}", exc_info=True) - return "", file_path + return "", None diff --git a/main/xiaozhi-server/core/providers/asr/aliyun_stream.py b/main/xiaozhi-server/core/providers/asr/aliyun_stream.py index 4ce588a7..f65d2b4e 100644 --- a/main/xiaozhi-server/core/providers/asr/aliyun_stream.py +++ b/main/xiaozhi-server/core/providers/asr/aliyun_stream.py @@ -126,16 +126,8 @@ class ASRProvider(ASRProviderBase): await super().open_audio_channels(conn) async def receive_audio(self, conn, audio, audio_have_voice): - # 初始化音频缓存 - if not hasattr(conn, 'asr_audio_for_voiceprint'): - conn.asr_audio_for_voiceprint = [] - - # 存储音频数据 - if audio: - conn.asr_audio_for_voiceprint.append(audio) - - conn.asr_audio.append(audio) - conn.asr_audio = conn.asr_audio[-10:] + # 先调用父类方法处理基础逻辑 + await super().receive_audio(conn, audio, audio_have_voice) # 只在有声音且没有连接时建立连接(排除正在停止的情况) if audio_have_voice and not self.is_processing and not self.asr_ws: @@ -204,6 +196,8 @@ class ASRProvider(ASRProviderBase): """转发识别结果""" try: while not conn.stop_event.is_set(): + # 获取当前连接的音频数据 + audio_data = conn.asr_audio try: response = await asyncio.wait_for(self.asr_ws.recv(), timeout=1.0) result = json.loads(response) @@ -257,19 +251,12 @@ class ASRProvider(ASRProviderBase): # 手动模式下,只有在收到stop信号后才触发处理(仅处理一次) if conn.client_voice_stop: - audio_data = getattr(conn, 'asr_audio_for_voiceprint', []) - if len(audio_data) > 0: - logger.bind(tag=TAG).debug("收到最终识别结果,触发处理") - await self.handle_voice_stop(conn, audio_data) - # 清理音频缓存 - conn.asr_audio.clear() - conn.reset_vad_states() + logger.bind(tag=TAG).debug("收到最终识别结果,触发处理") + await self.handle_voice_stop(conn, audio_data) break else: # 自动模式下直接覆盖 self.text = text - conn.reset_vad_states() - audio_data = getattr(conn, 'asr_audio_for_voiceprint', []) await self.handle_voice_stop(conn, audio_data) break @@ -289,11 +276,7 @@ class ASRProvider(ASRProviderBase): finally: # 清理连接的音频缓存 await self._cleanup() - if conn: - if hasattr(conn, 'asr_audio_for_voiceprint'): - conn.asr_audio_for_voiceprint = [] - if hasattr(conn, 'asr_audio'): - conn.asr_audio = [] + conn.reset_audio_states() async def _send_stop_request(self): """发送停止识别请求(不关闭连接)""" @@ -341,7 +324,7 @@ class ASRProvider(ASRProviderBase): logger.bind(tag=TAG).debug("ASR会话清理完成") - async def speech_to_text(self, opus_data, session_id, audio_format): + async def speech_to_text(self, opus_data, session_id, audio_format, artifacts=None): """获取识别结果""" result = self.text self.text = "" diff --git a/main/xiaozhi-server/core/providers/asr/aliyunbl_stream.py b/main/xiaozhi-server/core/providers/asr/aliyunbl_stream.py index a321ce9b..c9aa7c27 100644 --- a/main/xiaozhi-server/core/providers/asr/aliyunbl_stream.py +++ b/main/xiaozhi-server/core/providers/asr/aliyunbl_stream.py @@ -52,16 +52,8 @@ class ASRProvider(ASRProviderBase): await super().open_audio_channels(conn) async def receive_audio(self, conn, audio, audio_have_voice): - # 初始化音频缓存 - if not hasattr(conn, 'asr_audio_for_voiceprint'): - conn.asr_audio_for_voiceprint = [] - - # 存储音频数据 - if audio: - conn.asr_audio_for_voiceprint.append(audio) - - conn.asr_audio.append(audio) - conn.asr_audio = conn.asr_audio[-10:] + # 先调用父类方法处理基础逻辑 + await super().receive_audio(conn, audio, audio_have_voice) # 只在有声音且没有连接时建立连接 if audio_have_voice and not self.is_processing and not self.asr_ws: @@ -166,6 +158,8 @@ class ASRProvider(ASRProviderBase): """转发识别结果""" try: while not conn.stop_event.is_set(): + # 获取当前连接的音频数据 + audio_data = conn.asr_audio try: response = await asyncio.wait_for(self.asr_ws.recv(), timeout=1.0) result = json.loads(response) @@ -214,19 +208,12 @@ class ASRProvider(ASRProviderBase): # 手动模式下,只有在收到stop信号后才触发处理 if conn.client_voice_stop: - audio_data = getattr(conn, 'asr_audio_for_voiceprint', []) - if len(audio_data) > 0: - logger.bind(tag=TAG).debug("收到最终识别结果,触发处理") - await self.handle_voice_stop(conn, audio_data) - # 清理音频缓存 - conn.asr_audio.clear() - conn.reset_vad_states() + logger.bind(tag=TAG).debug("收到最终识别结果,触发处理") + await self.handle_voice_stop(conn, audio_data) break else: # 自动模式下直接覆盖 self.text = text - conn.reset_vad_states() - audio_data = getattr(conn, 'asr_audio_for_voiceprint', []) await self.handle_voice_stop(conn, audio_data) break @@ -257,11 +244,7 @@ class ASRProvider(ASRProviderBase): finally: # 清理连接的音频缓存 await self._cleanup() - if conn: - if hasattr(conn, 'asr_audio_for_voiceprint'): - conn.asr_audio_for_voiceprint = [] - if hasattr(conn, 'asr_audio'): - conn.asr_audio = [] + conn.reset_audio_states() async def _send_stop_request(self): """发送停止请求(用于手动模式停止录音)""" @@ -325,7 +308,7 @@ class ASRProvider(ASRProviderBase): logger.bind(tag=TAG).debug("ASR会话清理完成") - async def speech_to_text(self, opus_data, session_id, audio_format): + async def speech_to_text(self, opus_data, session_id, audio_format, artifacts=None): """获取识别结果""" result = self.text self.text = "" diff --git a/main/xiaozhi-server/core/providers/asr/baidu.py b/main/xiaozhi-server/core/providers/asr/baidu.py index aa8ea901..aa14f443 100644 --- a/main/xiaozhi-server/core/providers/asr/baidu.py +++ b/main/xiaozhi-server/core/providers/asr/baidu.py @@ -30,37 +30,26 @@ class ASRProvider(ASRProviderBase): os.makedirs(self.output_dir, exist_ok=True) async def speech_to_text( - self, opus_data: List[bytes], session_id: str, audio_format="opus" + self, opus_data: List[bytes], session_id: str, audio_format="opus", artifacts=None ) -> Tuple[Optional[str], Optional[str]]: """将语音数据转换为文本""" if not opus_data: logger.bind(tag=TAG).warning("音频数据为空!") return None, None - file_path = None try: # 检查配置是否已设置 if not self.app_id or not self.api_key or not self.secret_key: logger.bind(tag=TAG).error("百度语音识别配置未设置,无法进行识别") - return None, file_path + return None, None - # 将Opus音频数据解码为PCM - if audio_format == "pcm": - pcm_data = opus_data - else: - pcm_data = self.decode_opus(opus_data) - combined_pcm_data = b"".join(pcm_data) - - # 判断是否保存为WAV文件 - if self.delete_audio_file: - pass - else: - self.save_audio_to_file(pcm_data, session_id) + if artifacts is None: + return "", None start_time = time.time() # 识别本地文件 result = self.client.asr( - combined_pcm_data, + artifacts.pcm_bytes, "pcm", 16000, { @@ -73,13 +62,13 @@ class ASRProvider(ASRProviderBase): f"百度语音识别耗时: {time.time() - start_time:.3f}s | 结果: {result}" ) result = result["result"][0] - return result, file_path + return result, artifacts.file_path else: raise Exception( f"百度语音识别失败,错误码: {result['err_no']},错误信息: {result['err_msg']}" ) - return None, file_path + return None, artifacts.file_path except Exception as e: logger.bind(tag=TAG).error(f"处理音频时发生错误!{e}", exc_info=True) - return None, file_path + return None, None diff --git a/main/xiaozhi-server/core/providers/asr/base.py b/main/xiaozhi-server/core/providers/asr/base.py index 0eb23d76..74ea0c2d 100644 --- a/main/xiaozhi-server/core/providers/asr/base.py +++ b/main/xiaozhi-server/core/providers/asr/base.py @@ -8,14 +8,18 @@ import queue import asyncio import traceback import threading +import shutil import opuslib_next + from abc import ABC, abstractmethod from config.logger import setup_logging -from typing import Optional, Tuple, List +from typing import Optional, Tuple, List, NamedTuple +from core.providers.asr.dto.dto import InterfaceType from core.handle.receiveAudioHandle import startToChat from core.handle.reportHandle import enqueue_asr_report from core.utils.util import remove_punctuation_and_length from core.handle.receiveAudioHandle import handleAudioMessage +import tempfile TAG = __name__ logger = setup_logging() @@ -57,18 +61,17 @@ class ASRProviderBase(ABC): conn.asr_audio.append(audio) else: # 自动/实时模式:使用VAD检测 - have_voice = audio_have_voice - conn.asr_audio.append(audio) - if not have_voice and not conn.client_have_voice: + + # 如果没有语音,且之前也没有声音,缓存部分音频 + if not audio_have_voice and not conn.client_have_voice: conn.asr_audio = conn.asr_audio[-10:] return # 自动模式下通过VAD检测到语音停止时触发识别 - if conn.client_voice_stop: + if conn.asr.interface_type != InterfaceType.STREAM and conn.client_voice_stop: asr_audio_task = conn.asr_audio.copy() - conn.asr_audio.clear() - conn.reset_vad_states() + conn.reset_audio_states() if len(asr_audio_task) > 15: await self.handle_voice_stop(conn, asr_audio_task) @@ -93,10 +96,14 @@ class ASRProviderBase(ABC): wav_data = self._pcm_to_wav(combined_pcm_data) # 定义ASR任务 - asr_task = self.speech_to_text(asr_audio_task, conn.session_id, conn.audio_format) + asr_task = self.speech_to_text_wrapper( + asr_audio_task, conn.session_id, conn.audio_format + ) if conn.voiceprint_provider and wav_data: - voiceprint_task = conn.voiceprint_provider.identify_speaker(wav_data, conn.session_id) + voiceprint_task = conn.voiceprint_provider.identify_speaker( + wav_data, conn.session_id + ) # 并发等待两个结果 asr_result, voiceprint_result = await asyncio.gather( asr_task, voiceprint_task, return_exceptions=True @@ -159,20 +166,20 @@ class ASRProviderBase(ABC): if text_len > 0: # 使用自定义模块进行上报 await startToChat(conn, enhanced_text) - enqueue_asr_report(conn, enhanced_text, asr_audio_task) - + audio_snapshot = asr_audio_task.copy() + enqueue_asr_report(conn, enhanced_text, audio_snapshot) except Exception as e: logger.bind(tag=TAG).error(f"处理语音停止失败: {e}") import traceback + logger.bind(tag=TAG).debug(f"异常详情: {traceback.format_exc()}") def _build_enhanced_text(self, text: str, speaker_name: Optional[str]) -> str: """构建包含说话人信息的文本(仅用于纯文本ASR)""" if speaker_name and speaker_name.strip(): - return json.dumps({ - "speaker": speaker_name, - "content": text - }, ensure_ascii=False) + return json.dumps( + {"speaker": speaker_name, "content": text}, ensure_ascii=False + ) else: return text @@ -181,23 +188,23 @@ class ASRProviderBase(ABC): if len(pcm_data) == 0: logger.bind(tag=TAG).warning("PCM数据为空,无法转换WAV") return b"" - + # 确保数据长度是偶数(16位音频) if len(pcm_data) % 2 != 0: pcm_data = pcm_data[:-1] - + # 创建WAV文件头 wav_buffer = io.BytesIO() try: - with wave.open(wav_buffer, 'wb') as wav_file: - wav_file.setnchannels(1) # 单声道 - wav_file.setsampwidth(2) # 16位 + with wave.open(wav_buffer, "wb") as wav_file: + wav_file.setnchannels(1) # 单声道 + wav_file.setsampwidth(2) # 16位 wav_file.setframerate(16000) # 16kHz采样率 wav_file.writeframes(pcm_data) - + wav_buffer.seek(0) wav_data = wav_buffer.read() - + return wav_data except Exception as e: logger.bind(tag=TAG).error(f"WAV转换失败: {e}") @@ -206,6 +213,44 @@ class ASRProviderBase(ABC): def stop_ws_connection(self): pass + async def close(self): + pass + + class AudioArtifacts(NamedTuple): + pcm_frames: List[bytes] + """PCM音频帧列表""" + pcm_bytes: bytes + """合并后的PCM音频字节数据""" + file_path: Optional[str] + """WAV文件路径""" + temp_path: Optional[str] + """临时WAV文件路径""" + + def get_current_artifacts(self) -> Optional["ASRProviderBase.AudioArtifacts"]: + return self._current_artifacts + + def requires_file(self) -> bool: + """是否需要文件输入""" + return False + + def prefers_temp_file(self) -> bool: + """是否优先使用临时文件""" + return False + + def build_temp_file(self, pcm_bytes: bytes) -> Optional[str]: + try: + with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as temp_file: + temp_path = temp_file.name + with wave.open(temp_path, "wb") as wav_file: + wav_file.setnchannels(1) + wav_file.setsampwidth(2) + wav_file.setframerate(16000) + wav_file.writeframes(pcm_bytes) + return temp_path + except Exception as e: + logger.bind(tag=TAG).error(f"临时音频文件生成失败: {e}") + return None + def save_audio_to_file(self, pcm_data: List[bytes], session_id: str) -> str: """PCM数据保存为WAV文件""" module_name = __name__.split(".")[-1] @@ -220,11 +265,80 @@ class ASRProviderBase(ABC): return file_path - @abstractmethod - async def speech_to_text( + async def speech_to_text_wrapper( self, opus_data: List[bytes], session_id: str, audio_format="opus" ) -> Tuple[Optional[str], Optional[str]]: - """将语音数据转换为文本""" + file_path = None + temp_path = None + try: + if audio_format == "pcm": + pcm_data = opus_data + else: + pcm_data = self.decode_opus(opus_data) + combined_pcm_data = b"".join(pcm_data) + + free_space = shutil.disk_usage(self.output_dir).free + if free_space < len(combined_pcm_data) * 2: + raise OSError("磁盘空间不足") + + if self.requires_file() and self.prefers_temp_file(): + temp_path = self.build_temp_file(combined_pcm_data) + + if (hasattr(self, "delete_audio_file") and not self.delete_audio_file) or ( + self.requires_file() and not self.prefers_temp_file() + ): + file_path = self.save_audio_to_file(pcm_data, session_id) + + if len(combined_pcm_data) == 0: + artifacts = None + else: + artifacts = ASRProviderBase.AudioArtifacts( + pcm_frames=pcm_data, + pcm_bytes=combined_pcm_data, + file_path=file_path, + temp_path=temp_path, + ) + + text, _ = await self.speech_to_text( + opus_data, session_id, audio_format, artifacts + ) + return text, file_path + except OSError as e: + logger.bind(tag=TAG).error(f"文件操作错误: {e}") + return None, None + except Exception as e: + logger.bind(tag=TAG).error(f"语音识别失败: {e}") + return None, None + finally: + try: + if temp_path and os.path.exists(temp_path): + os.unlink(temp_path) + if ( + hasattr(self, "delete_audio_file") + and self.delete_audio_file + and file_path + and os.path.exists(file_path) + ): + os.remove(file_path) + except Exception as e: + logger.bind(tag=TAG).error(f"文件清理失败: {e}") + + @abstractmethod + async def speech_to_text( + self, + opus_data: List[bytes], + session_id: str, + audio_format="opus", + artifacts: Optional[AudioArtifacts] = None, + ) -> Tuple[Optional[str], Optional[str]]: + """将语音数据转换为文本 + + :param opus_data: 输入的Opus音频数据 + :param session_id: 会话ID + :param audio_format: 音频格式,默认"opus" + :param artifacts: 音频工件,包含PCM数据、文件路径等 + :return: 识别结果文本和文件路径(如果有) + """ pass @staticmethod @@ -235,23 +349,23 @@ class ASRProviderBase(ABC): decoder = opuslib_next.Decoder(16000, 1) pcm_data = [] buffer_size = 960 # 每次处理960个采样点 (60ms at 16kHz) - + for i, opus_packet in enumerate(opus_data): try: if not opus_packet or len(opus_packet) == 0: continue - + pcm_frame = decoder.decode(opus_packet, buffer_size) if pcm_frame and len(pcm_frame) > 0: pcm_data.append(pcm_frame) - + except opuslib_next.OpusError as e: logger.bind(tag=TAG).warning(f"Opus解码错误,跳过数据包 {i}: {e}") except Exception as e: logger.bind(tag=TAG).error(f"音频处理错误,数据包 {i}: {e}") - + return pcm_data - + except Exception as e: logger.bind(tag=TAG).error(f"音频解码过程发生错误: {e}") return [] diff --git a/main/xiaozhi-server/core/providers/asr/doubao.py b/main/xiaozhi-server/core/providers/asr/doubao.py index f6cd79c6..016ac0fd 100644 --- a/main/xiaozhi-server/core/providers/asr/doubao.py +++ b/main/xiaozhi-server/core/providers/asr/doubao.py @@ -232,24 +232,13 @@ class ASRProvider(ASRProviderBase): yield data[offset:data_len], True async def speech_to_text( - self, opus_data: List[bytes], session_id: str, audio_format="opus" + self, opus_data: List[bytes], session_id: str, audio_format="opus", artifacts=None ) -> Tuple[Optional[str], Optional[str]]: """将语音数据转换为文本""" - file_path = None try: - # 合并所有opus数据包 - if audio_format == "pcm": - pcm_data = opus_data - else: - pcm_data = self.decode_opus(opus_data) - combined_pcm_data = b"".join(pcm_data) - - # 判断是否保存为WAV文件 - if self.delete_audio_file: - pass - else: - file_path = self.save_audio_to_file(pcm_data, session_id) + if artifacts is None: + return "", None # 直接使用PCM数据 # 计算分段大小 (单声道, 16bit, 16kHz采样率) @@ -258,14 +247,14 @@ class ASRProvider(ASRProviderBase): # 语音识别 start_time = time.time() - text = await self._send_request(combined_pcm_data, segment_size) + text = await self._send_request(artifacts.pcm_bytes, segment_size) if text: logger.bind(tag=TAG).debug( f"语音识别耗时: {time.time() - start_time:.3f}s | 结果: {text}" ) - return text, file_path - return "", file_path + return text, artifacts.file_path + return "", artifacts.file_path except Exception as e: logger.bind(tag=TAG).error(f"语音识别失败: {e}", exc_info=True) - return "", file_path + return "", None diff --git a/main/xiaozhi-server/core/providers/asr/doubao_stream.py b/main/xiaozhi-server/core/providers/asr/doubao_stream.py index 3a726b08..3bb9997a 100644 --- a/main/xiaozhi-server/core/providers/asr/doubao_stream.py +++ b/main/xiaozhi-server/core/providers/asr/doubao_stream.py @@ -60,17 +60,8 @@ class ASRProvider(ASRProviderBase): await super().open_audio_channels(conn) async def receive_audio(self, conn, audio, audio_have_voice): - conn.asr_audio.append(audio) - conn.asr_audio = conn.asr_audio[-10:] - # 存储音频数据 - if not hasattr(conn, 'asr_audio_for_voiceprint'): - conn.asr_audio_for_voiceprint = [] - conn.asr_audio_for_voiceprint.append(audio) - - # 当没有音频数据时处理完整语音片段 - if conn.client_listen_mode != "manual" and not audio and len(conn.asr_audio_for_voiceprint) > 0: - await self.handle_voice_stop(conn, conn.asr_audio_for_voiceprint) - conn.asr_audio_for_voiceprint = [] + # 先调用父类方法处理基础逻辑 + await super().receive_audio(conn, audio, audio_have_voice) # 如果本次有声音,且之前没有建立连接 if audio_have_voice and self.asr_ws is None and not self.is_processing: @@ -164,7 +155,7 @@ class ASRProvider(ASRProviderBase): try: while self.asr_ws and not conn.stop_event.is_set(): # 获取当前连接的音频数据 - audio_data = getattr(conn, 'asr_audio_for_voiceprint', []) + audio_data = conn.asr_audio try: response = await self.asr_ws.recv() result = self.parse_response(response) @@ -189,7 +180,6 @@ class ASRProvider(ASRProviderBase): ): logger.bind(tag=TAG).error(f"识别文本:空") self.text = "" - conn.reset_vad_states() if len(audio_data) > 15: # 确保有足够音频数据 await self.handle_voice_stop(conn, audio_data) break @@ -200,12 +190,9 @@ class ASRProvider(ASRProviderBase): if self.enable_multilingual: continue - if conn.client_listen_mode == "manual" and conn.client_voice_stop and len(audio_data) > 0: + if conn.client_listen_mode == "manual" and conn.client_voice_stop and len(audio_data) > 15: logger.bind(tag=TAG).debug("消息结束收到停止信号,触发处理") await self.handle_voice_stop(conn, audio_data) - # 清理音频缓存 - conn.asr_audio.clear() - conn.reset_vad_states() break for utterance in utterances: @@ -226,14 +213,10 @@ class ASRProvider(ASRProviderBase): if conn.client_voice_stop and len(audio_data) > 0: logger.bind(tag=TAG).debug("消息中途收到停止信号,触发处理") await self.handle_voice_stop(conn, audio_data) - # 清理音频缓存 - conn.asr_audio.clear() - conn.reset_vad_states() break else: # 自动模式下直接覆盖 self.text = current_text - conn.reset_vad_states() if len(audio_data) > 15: # 确保有足够音频数据 await self.handle_voice_stop(conn, audio_data) break @@ -262,11 +245,8 @@ class ASRProvider(ASRProviderBase): await self.asr_ws.close() self.asr_ws = None self.is_processing = False - if conn: - if hasattr(conn, 'asr_audio_for_voiceprint'): - conn.asr_audio_for_voiceprint = [] - if hasattr(conn, 'asr_audio'): - conn.asr_audio = [] + # 重置所有音频相关状态 + conn.reset_audio_states() def stop_ws_connection(self): if self.asr_ws: @@ -408,7 +388,7 @@ class ASRProvider(ASRProviderBase): logger.bind(tag=TAG).error(f"原始响应数据: {res.hex()}") raise - async def speech_to_text(self, opus_data, session_id, audio_format): + async def speech_to_text(self, opus_data, session_id, audio_format, artifacts=None): result = self.text self.text = "" # 清空text return result, None @@ -435,11 +415,3 @@ class ASRProvider(ASRProviderBase): logger.bind(tag=TAG).debug("Doubao decoder resources released") except Exception as e: logger.bind(tag=TAG).debug(f"释放Doubao decoder资源时出错: {e}") - - # 清理所有连接的音频缓冲区 - if hasattr(self, '_connections'): - for conn in self._connections.values(): - if hasattr(conn, 'asr_audio_for_voiceprint'): - conn.asr_audio_for_voiceprint = [] - if hasattr(conn, 'asr_audio'): - conn.asr_audio = [] diff --git a/main/xiaozhi-server/core/providers/asr/fun_local.py b/main/xiaozhi-server/core/providers/asr/fun_local.py index bba53f8a..62ae99e7 100644 --- a/main/xiaozhi-server/core/providers/asr/fun_local.py +++ b/main/xiaozhi-server/core/providers/asr/fun_local.py @@ -64,39 +64,21 @@ class ASRProvider(ASRProviderBase): ) async def speech_to_text( - self, opus_data: List[bytes], session_id: str, audio_format="opus" + self, opus_data: List[bytes], session_id: str, audio_format="opus", artifacts=None ) -> Tuple[Optional[str], Optional[str]]: """语音转文本主处理逻辑""" - file_path = None retry_count = 0 - + while retry_count < MAX_RETRIES: try: - # 合并所有opus数据包 - if audio_format == "pcm": - pcm_data = opus_data - else: - pcm_data = self.decode_opus(opus_data) - - combined_pcm_data = b"".join(pcm_data) - - # 检查磁盘空间 - if not self.delete_audio_file: - free_space = shutil.disk_usage(self.output_dir).free - if free_space < len(combined_pcm_data) * 2: # 预留2倍空间 - raise OSError("磁盘空间不足") - - # 判断是否保存为WAV文件 - if self.delete_audio_file: - pass - else: - file_path = self.save_audio_to_file(pcm_data, session_id) + if artifacts is None: + return "", None # 语音识别 - 使用线程池避免阻塞事件循环 start_time = time.time() result = await asyncio.to_thread( self.model.generate, - input=combined_pcm_data, + input=artifacts.pcm_bytes, cache={}, language="auto", use_itn=True, @@ -107,7 +89,7 @@ class ASRProvider(ASRProviderBase): f"语音识别耗时: {time.time() - start_time:.3f}s | 结果: {text['content']}" ) - return text, file_path + return text, artifacts.file_path except OSError as e: retry_count += 1 @@ -115,7 +97,7 @@ class ASRProvider(ASRProviderBase): logger.bind(tag=TAG).error( f"语音识别失败(已重试{retry_count}次): {e}", exc_info=True ) - return "", file_path + return "", None logger.bind(tag=TAG).warning( f"语音识别失败,正在重试({retry_count}/{MAX_RETRIES}): {e}" ) @@ -123,15 +105,4 @@ class ASRProvider(ASRProviderBase): except Exception as e: logger.bind(tag=TAG).error(f"语音识别失败: {e}", exc_info=True) - return "", file_path - - finally: - # 文件清理逻辑 - if self.delete_audio_file and file_path and os.path.exists(file_path): - try: - os.remove(file_path) - logger.bind(tag=TAG).debug(f"已删除临时音频文件: {file_path}") - except Exception as e: - logger.bind(tag=TAG).error( - f"文件删除失败: {file_path} | 错误: {e}" - ) + return "", None diff --git a/main/xiaozhi-server/core/providers/asr/fun_server.py b/main/xiaozhi-server/core/providers/asr/fun_server.py index c6674df9..19b5022d 100644 --- a/main/xiaozhi-server/core/providers/asr/fun_server.py +++ b/main/xiaozhi-server/core/providers/asr/fun_server.py @@ -101,7 +101,7 @@ class ASRProvider(ASRProviderBase): logger.bind(tag=TAG).debug(f"Sent end message: {end_message}") async def speech_to_text( - self, opus_data: List[bytes], session_id: str, audio_format="opus" + self, opus_data: List[bytes], session_id: str, audio_format="opus", artifacts=None ) -> Tuple[Optional[str], Optional[str]]: """ Convert speech data to text using FunASR. @@ -109,18 +109,9 @@ class ASRProvider(ASRProviderBase): :param session_id: Unique session identifier. :return: Tuple containing recognized text and optional timestamp. """ - file_path = None - if audio_format == "pcm": - pcm_data = opus_data - else: - pcm_data = self.decode_opus(opus_data) - combined_pcm_data = b"".join(pcm_data) - - # 判断是否保存为WAV文件 - if self.delete_audio_file: - pass - else: - file_path = self.save_audio_to_file(pcm_data, session_id) + + if artifacts is None: + return "", None auth_header = {"Authorization": "Bearer; {}".format(self.api_key)} async with websockets.connect( self.uri, @@ -132,7 +123,7 @@ class ASRProvider(ASRProviderBase): try: # Use asyncio to handle WebSocket communication send_task = asyncio.create_task( - self._send_data(ws, combined_pcm_data, session_id) + self._send_data(ws, artifacts.pcm_bytes, session_id) ) receive_task = asyncio.create_task(self._receive_responses(ws)) @@ -161,14 +152,14 @@ class ASRProvider(ASRProviderBase): result = lang_tag_filter(result) return ( result, - file_path, + artifacts.file_path, ) # Return the recognized text and timestamp (if any) except websockets.exceptions.ConnectionClosed as e: logger.bind(tag=TAG).error(f"WebSocket connection closed: {e}") - return "", file_path + return "", artifacts.file_path except Exception as e: logger.bind(tag=TAG).error( f"Error during speech-to-text conversion: {e}", exc_info=True ) - return "", file_path + return "", artifacts.file_path diff --git a/main/xiaozhi-server/core/providers/asr/openai.py b/main/xiaozhi-server/core/providers/asr/openai.py index 5c6e849c..7b215589 100644 --- a/main/xiaozhi-server/core/providers/asr/openai.py +++ b/main/xiaozhi-server/core/providers/asr/openai.py @@ -21,20 +21,16 @@ class ASRProvider(ASRProviderBase): os.makedirs(self.output_dir, exist_ok=True) - async def speech_to_text(self, opus_data: List[bytes], session_id: str, audio_format="opus") -> Tuple[Optional[str], Optional[str]]: + def requires_file(self) -> bool: + return True + + async def speech_to_text(self, opus_data: List[bytes], session_id: str, audio_format="opus", artifacts=None) -> Tuple[Optional[str], Optional[str]]: file_path = None try: - start_time = time.time() - if audio_format == "pcm": - pcm_data = opus_data - else: - pcm_data = self.decode_opus(opus_data) - file_path = self.save_audio_to_file(pcm_data, session_id) - - logger.bind(tag=TAG).debug( - f"音频文件保存耗时: {time.time() - start_time:.3f}s | 路径: {file_path}" - ) - + if artifacts is None: + return "", None + file_path = artifacts.file_path + logger.bind(tag=TAG).info(f"file path: {file_path}") headers = { "Authorization": f"Bearer {self.api_key}", @@ -71,12 +67,4 @@ class ASRProvider(ASRProviderBase): except Exception as e: logger.bind(tag=TAG).error(f"语音识别失败: {e}") return "", None - finally: - # 文件清理逻辑 - if self.delete_audio_file and file_path and os.path.exists(file_path): - try: - os.remove(file_path) - logger.bind(tag=TAG).debug(f"已删除临时音频文件: {file_path}") - except Exception as e: - logger.bind(tag=TAG).error(f"文件删除失败: {file_path} | 错误: {e}") diff --git a/main/xiaozhi-server/core/providers/asr/qwen3_asr_flash.py b/main/xiaozhi-server/core/providers/asr/qwen3_asr_flash.py index 51c84a37..21438c1c 100644 --- a/main/xiaozhi-server/core/providers/asr/qwen3_asr_flash.py +++ b/main/xiaozhi-server/core/providers/asr/qwen3_asr_flash.py @@ -1,5 +1,4 @@ import os -import tempfile from typing import Optional, Tuple, List import dashscope from config.logger import setup_logging @@ -35,56 +34,25 @@ class ASRProvider(ASRProviderBase): # 确保输出目录存在 os.makedirs(self.output_dir, exist_ok=True) - def _prepare_audio_file(self, pcm_data: bytes) -> str: - """将PCM数据转换为WAV文件并返回文件路径""" - try: - import wave - - # 创建临时WAV文件 - with tempfile.NamedTemporaryFile(suffix='.wav', delete=False) as temp_file: - temp_path = temp_file.name - - # 写入WAV格式 - with wave.open(temp_path, 'wb') as wav_file: - wav_file.setnchannels(1) # 单声道 - wav_file.setsampwidth(2) # 16位 - wav_file.setframerate(16000) # 16kHz采样率 - wav_file.writeframes(pcm_data) - - return temp_path - - except Exception as e: - logger.bind(tag=tag).error(f"音频文件准备失败: {e}") - return None + def prefers_temp_file(self) -> bool: + return True + + def requires_file(self) -> bool: + return True async def speech_to_text( - self, opus_data: List[bytes], session_id: str, audio_format="opus" + self, opus_data: List[bytes], session_id: str, audio_format="opus", artifacts=None ) -> Tuple[Optional[str], Optional[str]]: """将语音数据转换为文本""" temp_file_path = None file_path = None - try: - # 解码音频数据 - if audio_format == "pcm": - pcm_data = opus_data - else: - pcm_data = self.decode_opus(opus_data) - - combined_pcm_data = b"".join(pcm_data) - if len(combined_pcm_data) == 0: - logger.bind(tag=tag).warning("音频数据为空") + if artifacts is None: return "", None - - # 准备音频文件 - temp_file_path = self._prepare_audio_file(combined_pcm_data) + temp_file_path = artifacts.temp_path + file_path = artifacts.file_path if not temp_file_path: - return "", None - - # 保存音频文件(如果需要) - if not self.delete_audio_file: - file_path = self.save_audio_to_file(pcm_data, session_id) - + return "", file_path # 构造请求消息 messages = [ { @@ -141,11 +109,3 @@ class ASRProvider(ASRProviderBase): except Exception as e: logger.bind(tag=tag).error(f"语音识别失败: {e}") return "", file_path - - finally: - # 清理临时文件 - if temp_file_path and os.path.exists(temp_file_path): - try: - os.unlink(temp_file_path) - except Exception as e: - logger.bind(tag=tag).warning(f"清理临时文件失败: {e}") \ No newline at end of file diff --git a/main/xiaozhi-server/core/providers/asr/sherpa_onnx_local.py b/main/xiaozhi-server/core/providers/asr/sherpa_onnx_local.py index c34909b2..742c3567 100644 --- a/main/xiaozhi-server/core/providers/asr/sherpa_onnx_local.py +++ b/main/xiaozhi-server/core/providers/asr/sherpa_onnx_local.py @@ -120,24 +120,19 @@ class ASRProvider(ASRProviderBase): samples_float32 = samples_float32 / 32768 return samples_float32, f.getframerate() + def requires_file(self) -> bool: + return True + async def speech_to_text( - self, opus_data: List[bytes], session_id: str, audio_format="opus" + self, opus_data: List[bytes], session_id: str, audio_format="opus", artifacts=None ) -> Tuple[Optional[str], Optional[str]]: """语音转文本主处理逻辑""" file_path = None try: - # 保存音频文件 - start_time = time.time() - if audio_format == "pcm": - pcm_data = opus_data - else: - pcm_data = self.decode_opus(opus_data) - file_path = self.save_audio_to_file(pcm_data, session_id) - logger.bind(tag=TAG).debug( - f"音频文件保存耗时: {time.time() - start_time:.3f}s | 路径: {file_path}" - ) + if artifacts is None: + return "", None + file_path = artifacts.file_path - # 语音识别 start_time = time.time() s = self.model.create_stream() samples, sample_rate = self.read_wave(file_path) @@ -153,11 +148,3 @@ class ASRProvider(ASRProviderBase): except Exception as e: logger.bind(tag=TAG).error(f"语音识别失败: {e}", exc_info=True) return "", file_path - finally: - # 文件清理逻辑 - if self.delete_audio_file and file_path and os.path.exists(file_path): - try: - os.remove(file_path) - logger.bind(tag=TAG).debug(f"已删除临时音频文件: {file_path}") - except Exception as e: - logger.bind(tag=TAG).error(f"文件删除失败: {file_path} | 错误: {e}") diff --git a/main/xiaozhi-server/core/providers/asr/tencent.py b/main/xiaozhi-server/core/providers/asr/tencent.py index 1fd1c6f4..d873bd19 100644 --- a/main/xiaozhi-server/core/providers/asr/tencent.py +++ b/main/xiaozhi-server/core/providers/asr/tencent.py @@ -32,35 +32,24 @@ class ASRProvider(ASRProviderBase): os.makedirs(self.output_dir, exist_ok=True) async def speech_to_text( - self, opus_data: List[bytes], session_id: str, audio_format="opus" + self, opus_data: List[bytes], session_id: str, audio_format="opus", artifacts=None ) -> Tuple[Optional[str], Optional[str]]: """将语音数据转换为文本""" if not opus_data: logger.bind(tag=TAG).warning("音频数据为空!") return None, None - file_path = None try: # 检查配置是否已设置 if not self.secret_id or not self.secret_key: logger.bind(tag=TAG).error("腾讯云语音识别配置未设置,无法进行识别") - return None, file_path + return None, None - # 将Opus音频数据解码为PCM - if audio_format == "pcm": - pcm_data = opus_data - else: - pcm_data = self.decode_opus(opus_data) - combined_pcm_data = b"".join(pcm_data) - - # 判断是否保存为WAV文件 - if self.delete_audio_file: - pass - else: - self.save_audio_to_file(pcm_data, session_id) + if artifacts is None: + return "", None # 将音频数据转换为Base64编码 - base64_audio = base64.b64encode(combined_pcm_data).decode("utf-8") + base64_audio = base64.b64encode(artifacts.pcm_bytes).decode("utf-8") # 构建请求体 request_body = self._build_request_body(base64_audio) @@ -77,11 +66,11 @@ class ASRProvider(ASRProviderBase): f"腾讯云语音识别耗时: {time.time() - start_time:.3f}s | 结果: {result}" ) - return result, file_path + return result, artifacts.file_path except Exception as e: logger.bind(tag=TAG).error(f"处理音频时发生错误!{e}", exc_info=True) - return None, file_path + return None, None def _build_request_body(self, base64_audio: str) -> str: """构建请求体""" diff --git a/main/xiaozhi-server/core/providers/asr/vosk.py b/main/xiaozhi-server/core/providers/asr/vosk.py index 19d31822..77cbf986 100644 --- a/main/xiaozhi-server/core/providers/asr/vosk.py +++ b/main/xiaozhi-server/core/providers/asr/vosk.py @@ -44,36 +44,21 @@ class ASRProvider(ASRProviderBase): raise async def speech_to_text( - self, audio_data: List[bytes], session_id: str, audio_format: str = "opus" + self, opus_data: List[bytes], session_id: str, audio_format="opus", artifacts=None ) -> Tuple[Optional[str], Optional[str]]: """将语音数据转换为文本""" - file_path = None try: # 检查模型是否加载成功 if not self.model: logger.bind(tag=TAG).error("VOSK模型未加载,无法进行识别") return "", None - - # 解码音频(如果原始格式是Opus) - if audio_format == "pcm": - pcm_data = audio_data - else: - pcm_data = self.decode_opus(audio_data) - - if not pcm_data: - logger.bind(tag=TAG).warning("解码后的PCM数据为空,无法进行识别") + + if artifacts is None: return "", None - - # 合并PCM数据 - combined_pcm_data = b"".join(pcm_data) - if len(combined_pcm_data) == 0: + if not artifacts.pcm_bytes: logger.bind(tag=TAG).warning("合并后的PCM数据为空") return "", None - # 判断是否保存为WAV文件 - if not self.delete_audio_file: - file_path = self.save_audio_to_file(pcm_data, session_id) - start_time = time.time() @@ -81,8 +66,8 @@ class ASRProvider(ASRProviderBase): chunk_size = 2000 text_result = "" - for i in range(0, len(combined_pcm_data), chunk_size): - chunk = combined_pcm_data[i:i+chunk_size] + for i in range(0, len(artifacts.pcm_bytes), chunk_size): + chunk = artifacts.pcm_bytes[i:i+chunk_size] if self.recognizer.AcceptWaveform(chunk): result = json.loads(self.recognizer.Result()) text = result.get('text', '') @@ -99,16 +84,8 @@ class ASRProvider(ASRProviderBase): f"VOSK语音识别耗时: {time.time() - start_time:.3f}s | 结果: {text_result.strip()}" ) - return text_result.strip(), file_path + return text_result.strip(), artifacts.file_path except Exception as e: logger.bind(tag=TAG).error(f"VOSK语音识别失败: {e}") return "", None - finally: - # 文件清理逻辑 - if self.delete_audio_file and file_path and os.path.exists(file_path): - try: - os.remove(file_path) - logger.bind(tag=TAG).debug(f"已删除临时音频文件: {file_path}") - except Exception as e: - logger.bind(tag=TAG).error(f"文件删除失败: {file_path} | 错误: {e}") diff --git a/main/xiaozhi-server/core/providers/asr/xunfei_stream.py b/main/xiaozhi-server/core/providers/asr/xunfei_stream.py index b7e7886e..31087542 100644 --- a/main/xiaozhi-server/core/providers/asr/xunfei_stream.py +++ b/main/xiaozhi-server/core/providers/asr/xunfei_stream.py @@ -101,11 +101,6 @@ class ASRProvider(ASRProviderBase): # 先调用父类方法处理基础逻辑 await super().receive_audio(conn, audio, audio_have_voice) - # 存储音频数据用于声纹识别 - if not hasattr(conn, "asr_audio_for_voiceprint"): - conn.asr_audio_for_voiceprint = [] - conn.asr_audio_for_voiceprint.append(audio) - # 如果本次有声音,且之前没有建立连接 if audio_have_voice and self.asr_ws is None and not self.is_processing: try: @@ -232,13 +227,8 @@ class ASRProvider(ASRProviderBase): if status == 2: if conn.client_listen_mode == "manual": - audio_data = getattr(conn, 'asr_audio_for_voiceprint', []) - if len(audio_data) > 0: - logger.bind(tag=TAG).debug("收到最终识别结果,触发处理") - await self.handle_voice_stop(conn, audio_data) - # 清理音频缓存 - conn.asr_audio.clear() - conn.reset_vad_states() + logger.bind(tag=TAG).debug("收到最终识别结果,触发处理") + await self.handle_voice_stop(conn, conn.asr_audio) break except asyncio.TimeoutError: @@ -262,13 +252,7 @@ class ASRProvider(ASRProviderBase): finally: # 清理连接资源 await self._cleanup() - - # 清理连接的音频缓存 - if conn: - if hasattr(conn, "asr_audio_for_voiceprint"): - conn.asr_audio_for_voiceprint = [] - if hasattr(conn, "asr_audio"): - conn.asr_audio = [] + conn.reset_audio_states() async def handle_voice_stop(self, conn, asr_audio_task: List[bytes]): """处理语音停止,发送最后一帧并处理识别结果""" @@ -334,7 +318,7 @@ class ASRProvider(ASRProviderBase): logger.bind(tag=TAG).debug("ASR会话清理完成") - async def speech_to_text(self, opus_data, session_id, audio_format): + async def speech_to_text(self, opus_data, session_id, audio_format, artifacts=None): """获取识别结果""" result = self.text self.text = "" @@ -363,10 +347,3 @@ class ASRProvider(ASRProviderBase): except Exception as e: logger.bind(tag=TAG).debug(f"释放Xunfei decoder资源时出错: {e}") - # 清理所有连接的音频缓冲区 - if hasattr(self, "_connections"): - for conn in self._connections.values(): - if hasattr(conn, "asr_audio_for_voiceprint"): - conn.asr_audio_for_voiceprint = [] - if hasattr(conn, "asr_audio"): - conn.asr_audio = [] diff --git a/main/xiaozhi-server/core/providers/tts/alibl_stream.py b/main/xiaozhi-server/core/providers/tts/alibl_stream.py index 42658008..c636d0cb 100644 --- a/main/xiaozhi-server/core/providers/tts/alibl_stream.py +++ b/main/xiaozhi-server/core/providers/tts/alibl_stream.py @@ -41,8 +41,6 @@ class TTSProvider(TTSProviderBase): # 音频参数配置 self.format = config.get("format", "pcm") - sample_rate = config.get("sample_rate", "24000") - self.sample_rate = int(sample_rate) if sample_rate else 24000 volume = config.get("volume", "50") self.volume = int(volume) if volume else 50 @@ -60,11 +58,6 @@ class TTSProvider(TTSProviderBase): "X-DashScope-DataInspection": "enable", } - # 创建Opus编码器 - self.opus_encoder = opus_encoder_utils.OpusEncoderUtils( - sample_rate=self.sample_rate, channels=1, frame_size_ms=60 - ) - async def _ensure_connection(self): """确保WebSocket连接可用,支持60秒内连接复用""" try: @@ -245,7 +238,7 @@ class TTSProvider(TTSProviderBase): "text_type": "PlainText", "voice": self.voice, "format": self.format, - "sample_rate": self.sample_rate, + "sample_rate": self.conn.sample_rate, "volume": self.volume, "rate": self.rate, "pitch": self.pitch, @@ -429,7 +422,7 @@ class TTSProvider(TTSProviderBase): "text_type": "PlainText", "voice": self.voice, "format": self.format, - "sample_rate": self.sample_rate, + "sample_rate": self.conn.sample_rate, "volume": self.volume, "rate": self.rate, "pitch": self.pitch, diff --git a/main/xiaozhi-server/core/providers/tts/aliyun.py b/main/xiaozhi-server/core/providers/tts/aliyun.py index 1a4cab88..e97c13e4 100644 --- a/main/xiaozhi-server/core/providers/tts/aliyun.py +++ b/main/xiaozhi-server/core/providers/tts/aliyun.py @@ -95,8 +95,6 @@ class TTSProvider(TTSProviderBase): self.appkey = config.get("appkey") self.format = config.get("format", "wav") self.audio_file_type = config.get("format", "wav") - sample_rate = config.get("sample_rate", "16000") - self.sample_rate = int(sample_rate) if sample_rate else 16000 if config.get("private_voice"): self.voice = config.get("private_voice") @@ -172,7 +170,7 @@ class TTSProvider(TTSProviderBase): "token": self.token, "text": text, "format": self.format, - "sample_rate": self.sample_rate, + "sample_rate": self.conn.sample_rate, "voice": self.voice, "volume": self.volume, "speech_rate": self.speech_rate, diff --git a/main/xiaozhi-server/core/providers/tts/aliyun_stream.py b/main/xiaozhi-server/core/providers/tts/aliyun_stream.py index 52284466..6026eafa 100644 --- a/main/xiaozhi-server/core/providers/tts/aliyun_stream.py +++ b/main/xiaozhi-server/core/providers/tts/aliyun_stream.py @@ -99,10 +99,6 @@ class TTSProvider(TTSProviderBase): self.format = config.get("format", "pcm") self.audio_file_type = config.get("format", "pcm") - # 采样率配置 - sample_rate = config.get("sample_rate", "16000") - self.sample_rate = int(sample_rate) if sample_rate else 16000 - # 音色配置 - CosyVoice大模型音色 if config.get("private_voice"): self.voice = config.get("private_voice") @@ -134,11 +130,6 @@ class TTSProvider(TTSProviderBase): # 专属tts设置 self.task_id = uuid.uuid4().hex - # 创建Opus编码器 - self.opus_encoder = opus_encoder_utils.OpusEncoderUtils( - sample_rate=16000, channels=1, frame_size_ms=60 - ) - # Token管理 if self.access_key_id and self.access_key_secret: self._refresh_token() @@ -344,7 +335,7 @@ class TTSProvider(TTSProviderBase): "payload": { "voice": self.voice, "format": self.format, - "sample_rate": self.sample_rate, + "sample_rate": self.conn.sample_rate, "volume": self.volume, "speech_rate": self.speech_rate, "pitch_rate": self.pitch_rate, @@ -508,7 +499,7 @@ class TTSProvider(TTSProviderBase): "payload": { "voice": self.voice, "format": self.format, - "sample_rate": self.sample_rate, + "sample_rate": self.conn.sample_rate, "volume": self.volume, "speech_rate": self.speech_rate, "pitch_rate": self.pitch_rate, diff --git a/main/xiaozhi-server/core/providers/tts/base.py b/main/xiaozhi-server/core/providers/tts/base.py index 018215d5..d2126dba 100644 --- a/main/xiaozhi-server/core/providers/tts/base.py +++ b/main/xiaozhi-server/core/providers/tts/base.py @@ -1,17 +1,18 @@ import os import re -import time import uuid import queue import asyncio import threading import traceback + from core.utils import p3 from datetime import datetime from core.utils import textUtils from typing import Callable, Any from abc import ABC, abstractmethod from config.logger import setup_logging +from core.utils import opus_encoder_utils from core.utils.tts import MarkdownCleaner from core.utils.output_counter import add_device_output from core.handle.reportHandle import enqueue_tts_report @@ -97,6 +98,8 @@ class TTSProviderBase(ABC): file_type=self.audio_file_type, is_opus=True, callback=opus_handler, + sample_rate=self.conn.sample_rate, + opus_encoder=self.opus_encoder, ) break else: @@ -138,7 +141,7 @@ class TTSProviderBase(ABC): logger.bind(tag=TAG).error( f"语音生成失败: {text},请检查网络或服务是否正常" ) - self.tts_audio_queue.put((SentenceType.FIRST, None, text)) + self.tts_audio_queue.put((SentenceType.FIRST, None, text)) self._process_audio_file_stream(tmp_file, callback=opus_handler) except Exception as e: logger.bind(tag=TAG).error(f"Failed to generate TTS file: {e}") @@ -158,7 +161,8 @@ class TTSProviderBase(ABC): audio_bytes, file_type=self.audio_file_type, is_opus=True, - callback=lambda data: audio_datas.append(data) + callback=lambda data: audio_datas.append(data), + sample_rate=self.conn.sample_rate, ) return audio_datas else: @@ -214,13 +218,13 @@ class TTSProviderBase(ABC): self, audio_file_path, callback: Callable[[Any], Any] = None ): """音频文件转换为PCM编码""" - return audio_to_data_stream(audio_file_path, is_opus=False, callback=callback) + return audio_to_data_stream(audio_file_path, is_opus=False, callback=callback, sample_rate=self.conn.sample_rate, opus_encoder=None) def audio_to_opus_data_stream( self, audio_file_path, callback: Callable[[Any], Any] = None ): """音频文件转换为Opus编码""" - return audio_to_data_stream(audio_file_path, is_opus=True, callback=callback) + return audio_to_data_stream(audio_file_path, is_opus=True, callback=callback, sample_rate=self.conn.sample_rate, opus_encoder=self.opus_encoder) def tts_one_sentence( self, @@ -252,6 +256,13 @@ class TTSProviderBase(ABC): async def open_audio_channels(self, conn): self.conn = conn + + # 根据conn的sample_rate创建编码器,如果子类已经创建则不覆盖(IndexTTS接口返回为24kHZ-待重采样处理) + if not hasattr(self, 'opus_encoder') or self.opus_encoder is None: + self.opus_encoder = opus_encoder_utils.OpusEncoderUtils( + sample_rate=conn.sample_rate, channels=1, frame_size_ms=60 + ) + # tts 消化线程 self.tts_priority_thread = threading.Thread( target=self.tts_text_priority_thread, daemon=True diff --git a/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py b/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py index d7829e35..b1ba1bed 100644 --- a/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py +++ b/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py @@ -154,16 +154,29 @@ class TTSProvider(TTSProviderBase): self.voice = config.get("private_voice") else: self.voice = config.get("speaker") - speech_rate = config.get("speech_rate", "0") - loudness_rate = config.get("loudness_rate", "0") - pitch = config.get("pitch", "0") - self.speech_rate = int(speech_rate) if speech_rate else 0 - self.loudness_rate = int(loudness_rate) if loudness_rate else 0 - self.pitch = int(pitch) if pitch else 0 - # 多情感音色参数 - self.emotion = config.get("emotion", "neutral") - emotion_scale = config.get("emotion_scale", "4") - self.emotion_scale = int(emotion_scale) if emotion_scale else 4 + + # 默认 audio_params 配置 + default_audio_params = { + "speech_rate": 0, + "loudness_rate": 0 + } + + # 默认 additions 配置 + default_additions = { + "aigc_metadata": {}, + "cache_config": {}, + "post_process": { + "pitch": 0 + } + } + + # 默认 mix_speaker 配置 + default_mix_speaker = {} + + # 合并用户配置 + self.audio_params = {**default_audio_params, **config.get("audio_params", {})} + self.additions = {**default_additions, **config.get("additions", {})} + self.mix_speaker = {**default_mix_speaker, **config.get("mix_speaker", {})} self.ws_url = config.get("ws_url") self.authorization = config.get("authorization") @@ -171,9 +184,7 @@ class TTSProvider(TTSProviderBase): enable_ws_reuse_value = config.get("enable_ws_reuse", True) self.enable_ws_reuse = False if str(enable_ws_reuse_value).lower() == 'false' else True self.tts_text = "" - self.opus_encoder = opus_encoder_utils.OpusEncoderUtils( - sample_rate=16000, channels=1, frame_size_ms=60 - ) + model_key_msg = check_model_key("TTS", self.access_token) if model_key_msg: logger.bind(tag=TAG).error(model_key_msg) @@ -181,6 +192,8 @@ class TTSProvider(TTSProviderBase): async def open_audio_channels(self, conn): try: await super().open_audio_channels(conn) + # 更新 audio_params 中的采样率为实际的 conn.sample_rate + self.audio_params["sample_rate"] = conn.sample_rate except Exception as e: logger.bind(tag=TAG).error(f"Failed to open audio channels: {str(e)}") self.ws = None @@ -646,20 +659,18 @@ class TTSProvider(TTSProviderBase): text="", speaker="", audio_format="pcm", - audio_sample_rate=16000, ): - audio_params = { - "format": audio_format, - "sample_rate": audio_sample_rate, - "speech_rate": self.speech_rate, - "loudness_rate": self.loudness_rate + # 构建 req_params + req_params = { + "text": text, + "speaker": speaker, + "audio_params": {**self.audio_params, "format": audio_format}, + "additions": json.dumps(self.additions) } - - # 如果是多情感音色,添加情感参数 - if '_emo_' in self.voice: - if self.emotion: - audio_params["emotion"] = self.emotion - audio_params["emotion_scale"] = self.emotion_scale + + # 如果有 mix_speaker 配置,添加到 req_params + if self.mix_speaker: + req_params["mix_speaker"] = self.mix_speaker return str.encode( json.dumps( @@ -667,17 +678,7 @@ class TTSProvider(TTSProviderBase): "user": {"uid": uid}, "event": event, "namespace": "BidirectionalTTS", - "req_params": { - "text": text, - "speaker": speaker, - "audio_params": audio_params, - "additions": json.dumps({ - "post_process": { - "pitch": self.pitch - } - }) - }, - + "req_params": req_params } ) ) diff --git a/main/xiaozhi-server/core/providers/tts/index_stream.py b/main/xiaozhi-server/core/providers/tts/index_stream.py index 186e1fc8..72d2d68d 100644 --- a/main/xiaozhi-server/core/providers/tts/index_stream.py +++ b/main/xiaozhi-server/core/providers/tts/index_stream.py @@ -174,6 +174,20 @@ class TTSProvider(TTSProviderBase): logger.bind(tag=TAG).error(f"TTS请求异常: {e}") self.tts_audio_queue.put((SentenceType.LAST, [], None)) + def audio_to_pcm_data_stream( + self, audio_file_path, callback=None + ): + """音频文件转换为PCM编码,使用24kHz采样率""" + from core.utils.util import audio_to_data_stream + return audio_to_data_stream(audio_file_path, is_opus=False, callback=callback, sample_rate=24000, opus_encoder=None) + + def audio_to_opus_data_stream( + self, audio_file_path, callback=None + ): + """音频文件转换为Opus编码,使用24kHz采样率和自己的编码器""" + from core.utils.util import audio_to_data_stream + return audio_to_data_stream(audio_file_path, is_opus=True, callback=callback, sample_rate=24000, opus_encoder=self.opus_encoder) + async def close(self): """资源清理""" await super().close() diff --git a/main/xiaozhi-server/core/providers/tts/linkerai.py b/main/xiaozhi-server/core/providers/tts/linkerai.py index 9b5e946f..7de5f3cd 100644 --- a/main/xiaozhi-server/core/providers/tts/linkerai.py +++ b/main/xiaozhi-server/core/providers/tts/linkerai.py @@ -25,11 +25,6 @@ class TTSProvider(TTSProviderBase): self.audio_format = "pcm" self.before_stop_play_files = [] - # 创建Opus编码器 - self.opus_encoder = opus_encoder_utils.OpusEncoderUtils( - sample_rate=16000, channels=1, frame_size_ms=60 - ) - # PCM缓冲区 self.pcm_buffer = bytearray() @@ -127,7 +122,7 @@ class TTSProvider(TTSProviderBase): "spk_id": self.voice, "frame_durition": 60, "stream": "true", - "target_sr": 16000, + "target_sr": self.conn.sample_rate, "audio_format": "pcm", "instruct_text": "请生成一段自然流畅的语音", } @@ -136,7 +131,7 @@ class TTSProvider(TTSProviderBase): "Content-Type": "application/json", } - # 一帧 PCM 所需字节数:60 ms × 16 kHz × 1 ch × 2 B = 1 920 + # 一帧 PCM 所需字节数:60 ms × sample_rate × 1 ch × 2 B frame_bytes = int( self.opus_encoder.sample_rate * self.opus_encoder.channels # 1 @@ -213,7 +208,7 @@ class TTSProvider(TTSProviderBase): "spk_id": self.voice, "frame_duration": 60, "stream": False, - "target_sr": 16000, + "target_sr": self.conn.sample_rate, "audio_format": self.audio_format, "instruct_text": "请生成一段自然流畅的语音", } diff --git a/main/xiaozhi-server/core/providers/tts/minimax_httpstream.py b/main/xiaozhi-server/core/providers/tts/minimax_httpstream.py index 514d8912..9f145933 100644 --- a/main/xiaozhi-server/core/providers/tts/minimax_httpstream.py +++ b/main/xiaozhi-server/core/providers/tts/minimax_httpstream.py @@ -64,13 +64,17 @@ class TTSProvider(TTSProviderBase): } self.audio_file_type = defult_audio_setting.get("format", "pcm") - self.opus_encoder = opus_encoder_utils.OpusEncoderUtils( - sample_rate=24000, channels=1, frame_size_ms=60 - ) - # PCM缓冲区 self.pcm_buffer = bytearray() + async def open_audio_channels(self, conn): + """初始化音频通道,并根据conn.sample_rate更新配置""" + # 调用父类方法 + await super().open_audio_channels(conn) + + # 更新audio_setting中的采样率为实际的conn.sample_rate + self.audio_setting["sample_rate"] = conn.sample_rate + def tts_text_priority_thread(self): """流式文本处理线程""" while not self.conn.stop_event.is_set(): @@ -212,6 +216,18 @@ class TTSProvider(TTSProviderBase): try: data = json.loads(json_str) + + # 检查业务层错误 + base_resp = data.get("base_resp", {}) + status_code = base_resp.get("status_code", 0) + if status_code != 0: + status_msg = base_resp.get("status_msg", "未知错误") + logger.bind(tag=TAG).error( + f"TTS请求失败, 错误码:{status_code}, 错误消息:{status_msg}" + ) + self.tts_audio_queue.put((SentenceType.LAST, [], None)) + return + status = data.get("data", {}).get("status", 1) audio_hex = data.get("data", {}).get("audio") diff --git a/main/xiaozhi-server/core/providers/tts/paddle_speech.py b/main/xiaozhi-server/core/providers/tts/paddle_speech.py index 864cf505..48b0bb0c 100644 --- a/main/xiaozhi-server/core/providers/tts/paddle_speech.py +++ b/main/xiaozhi-server/core/providers/tts/paddle_speech.py @@ -25,10 +25,7 @@ class TTSProvider(TTSProviderBase): self.spk_id = int(config.get("private_voice")) else: self.spk_id = int(config.get("spk_id", "0")) - - sample_rate = config.get("sample_rate", 24000) - self.sample_rate = float(sample_rate) if sample_rate else 24000 - + speed = config.get("speed", 1.0) self.speed = float(speed) if speed else 1.0 diff --git a/main/xiaozhi-server/core/providers/tts/siliconflow.py b/main/xiaozhi-server/core/providers/tts/siliconflow.py index b85cebf4..ebc3dbb9 100644 --- a/main/xiaozhi-server/core/providers/tts/siliconflow.py +++ b/main/xiaozhi-server/core/providers/tts/siliconflow.py @@ -13,7 +13,6 @@ class TTSProvider(TTSProviderBase): self.voice = config.get("voice") self.response_format = config.get("response_format", "mp3") self.audio_file_type = config.get("response_format", "mp3") - self.sample_rate = config.get("sample_rate") self.speed = float(config.get("speed", 1.0)) self.gain = config.get("gain") diff --git a/main/xiaozhi-server/core/providers/tts/xunfei_stream.py b/main/xiaozhi-server/core/providers/tts/xunfei_stream.py index dc8d833f..e7d4d4e9 100644 --- a/main/xiaozhi-server/core/providers/tts/xunfei_stream.py +++ b/main/xiaozhi-server/core/providers/tts/xunfei_stream.py @@ -91,9 +91,6 @@ class TTSProvider(TTSProviderBase): # 音频编码配置 self.format = config.get("format", "raw") - sample_rate = config.get("sample_rate", "24000") - self.sample_rate = int(sample_rate) if sample_rate else 24000 - # 口语化配置 self.oral_level = config.get("oral_level", "mid") @@ -113,11 +110,6 @@ class TTSProvider(TTSProviderBase): # 序列号管理 self.text_seq = 0 - # 创建Opus编码器 - self.opus_encoder = opus_encoder_utils.OpusEncoderUtils( - sample_rate=self.sample_rate, channels=1, frame_size_ms=60 - ) - # 验证必需参数 if not all([self.app_id, self.api_key, self.api_secret]): raise ValueError("讯飞TTS需要配置app_id、api_key和api_secret") @@ -507,7 +499,7 @@ class TTSProvider(TTSProviderBase): "rhy": 0, "audio": { "encoding": self.format, - "sample_rate": self.sample_rate, + "sample_rate": self.conn.sample_rate, "channels": 1, "bit_depth": 16, "frame_size": 0 diff --git a/main/xiaozhi-server/core/utils/util.py b/main/xiaozhi-server/core/utils/util.py index 0b8ac9e8..256c2bae 100644 --- a/main/xiaozhi-server/core/utils/util.py +++ b/main/xiaozhi-server/core/utils/util.py @@ -227,7 +227,7 @@ def extract_json_from_string(input_string): def audio_to_data_stream( - audio_file_path, is_opus=True, callback: Callable[[Any], Any] = None + audio_file_path, is_opus=True, callback: Callable[[Any], Any] = None, sample_rate=16000, opus_encoder=None ) -> None: # 获取文件后缀名 file_type = os.path.splitext(audio_file_path)[1] @@ -238,12 +238,12 @@ def audio_to_data_stream( audio_file_path, format=file_type, parameters=["-nostdin"] ) - # 转换为单声道/16kHz采样率/16位小端编码(确保与编码器匹配) - audio = audio.set_channels(1).set_frame_rate(16000).set_sample_width(2) + # 转换为单声道/指定采样率/16位小端编码(确保与编码器匹配) + audio = audio.set_channels(1).set_frame_rate(sample_rate).set_sample_width(2) # 获取原始PCM数据(16位小端) raw_data = audio.raw_data - pcm_to_data_stream(raw_data, is_opus, callback) + pcm_to_data_stream(raw_data, is_opus, callback, sample_rate, opus_encoder) async def audio_to_data( @@ -325,7 +325,7 @@ async def audio_to_data( def audio_bytes_to_data_stream( - audio_bytes, file_type, is_opus, callback: Callable[[Any], Any] + audio_bytes, file_type, is_opus, callback: Callable[[Any], Any], sample_rate=16000, opus_encoder=None ) -> None: """ 直接用音频二进制数据转为opus/pcm数据,支持wav、mp3、p3 @@ -338,18 +338,30 @@ def audio_bytes_to_data_stream( audio = AudioSegment.from_file( BytesIO(audio_bytes), format=file_type, parameters=["-nostdin"] ) - audio = audio.set_channels(1).set_frame_rate(16000).set_sample_width(2) + audio = audio.set_channels(1).set_frame_rate(sample_rate).set_sample_width(2) raw_data = audio.raw_data - pcm_to_data_stream(raw_data, is_opus, callback) + pcm_to_data_stream(raw_data, is_opus, callback, sample_rate, opus_encoder) -def pcm_to_data_stream(raw_data, is_opus=True, callback: Callable[[Any], Any] = None): - # 初始化Opus编码器 - encoder = opuslib_next.Encoder(16000, 1, opuslib_next.APPLICATION_AUDIO) +def pcm_to_data_stream(raw_data, is_opus=True, callback: Callable[[Any], Any] = None, sample_rate=16000, opus_encoder=None): + """ + 将PCM数据流式编码为Opus或直接输出PCM + + Args: + raw_data: PCM原始数据 + is_opus: 是否编码为Opus + callback: 回调函数 + sample_rate: 采样率 + opus_encoder: OpusEncoderUtils对象(推荐提供以保持编码器状态连续) + """ + using_temp_encoder = False + if is_opus and opus_encoder is None: + encoder = opuslib_next.Encoder(sample_rate, 1, opuslib_next.APPLICATION_AUDIO) + using_temp_encoder = True # 编码参数 frame_duration = 60 # 60ms per frame - frame_size = int(16000 * frame_duration / 1000) # 960 samples/frame + frame_size = int(sample_rate * frame_duration / 1000) # samples/frame # 按帧处理所有音频数据(包括最后一帧可能补零) for i in range(0, len(raw_data), frame_size * 2): # 16bit=2bytes/sample @@ -361,12 +373,17 @@ def pcm_to_data_stream(raw_data, is_opus=True, callback: Callable[[Any], Any] = chunk += b"\x00" * (frame_size * 2 - len(chunk)) if is_opus: - # 转换为numpy数组处理 - np_frame = np.frombuffer(chunk, dtype=np.int16) - # 编码Opus数据 - frame_data = encoder.encode(np_frame.tobytes(), frame_size) - callback(frame_data) + if using_temp_encoder: + # 使用临时编码器(仅用于独立音频场景) + np_frame = np.frombuffer(chunk, dtype=np.int16) + frame_data = encoder.encode(np_frame.tobytes(), frame_size) + callback(frame_data) + else: + # 使用外部编码器(TTS流式场景,保持状态连续) + is_last = (i + frame_size * 2 >= len(raw_data)) + opus_encoder.encode_pcm_to_opus_stream(chunk, end_of_stream=is_last, callback=callback) else: + # PCM模式,直接输出 frame_data = chunk if isinstance(chunk, bytes) else bytes(chunk) callback(frame_data) diff --git a/main/xiaozhi-server/test/favicon.ico b/main/xiaozhi-server/test/favicon.ico new file mode 100644 index 00000000..5f285a58 Binary files /dev/null and b/main/xiaozhi-server/test/favicon.ico differ diff --git a/main/xiaozhi-server/test/images/1.png b/main/xiaozhi-server/test/images/1.png index 6d822acd..62d848a6 100644 Binary files a/main/xiaozhi-server/test/images/1.png and b/main/xiaozhi-server/test/images/1.png differ diff --git a/main/xiaozhi-server/test/js/app.js b/main/xiaozhi-server/test/js/app.js index 76819a6f..2e588647 100644 --- a/main/xiaozhi-server/test/js/app.js +++ b/main/xiaozhi-server/test/js/app.js @@ -1,9 +1,10 @@ // 主应用入口 -import { log } from './utils/logger.js'; -import { checkOpusLoaded, initOpusEncoder } from './core/audio/opus-codec.js'; -import { uiController } from './ui/controller.js'; -import { getAudioPlayer } from './core/audio/player.js'; -import { initMcpTools } from './core/mcp/tools.js'; +import { checkOpusLoaded, initOpusEncoder } from './core/audio/opus-codec.js?v=0127'; +import { getAudioPlayer } from './core/audio/player.js?v=0127'; +import { checkMicrophoneAvailability, isHttpNonLocalhost } from './core/audio/recorder.js?v=0127'; +import { initMcpTools } from './core/mcp/tools.js?v=0127'; +import { uiController } from './ui/controller.js?v=0127'; +import { log } from './utils/logger.js?v=0127'; // 应用类 class App { @@ -16,30 +17,24 @@ class App { // 初始化应用 async init() { log('正在初始化应用...', 'info'); - // 初始化UI控制器 this.uiController = uiController; this.uiController.init(); - // 检查Opus库 checkOpusLoaded(); - // 初始化Opus编码器 initOpusEncoder(); - // 初始化音频播放器 this.audioPlayer = getAudioPlayer(); await this.audioPlayer.start(); - // 初始化MCP工具 initMcpTools(); - + // 检查麦克风可用性 + await this.checkMicrophoneAvailability(); // 初始化Live2D await this.initLive2D(); - // 关闭加载loading this.setModelLoadingStatus(false); - log('应用初始化完成', 'success'); } @@ -50,21 +45,17 @@ class App { if (typeof window.Live2DManager === 'undefined') { throw new Error('Live2DManager未加载,请检查脚本引入顺序'); } - this.live2dManager = new window.Live2DManager(); await this.live2dManager.initializeLive2D(); - // 更新UI状态 const live2dStatus = document.getElementById('live2dStatus'); if (live2dStatus) { live2dStatus.textContent = '● 已加载'; live2dStatus.className = 'status loaded'; } - log('Live2D初始化完成', 'success'); } catch (error) { log(`Live2D初始化失败: ${error.message}`, 'error'); - // 更新UI状态 const live2dStatus = document.getElementById('live2dStatus'); if (live2dStatus) { @@ -81,18 +72,41 @@ class App { modelLoading.style.display = isLoading ? 'flex' : 'none'; } } + + /** + * 检查麦克风可用性 + * 在应用初始化时调用,检查麦克风是否可用并更新UI状态 + */ + async checkMicrophoneAvailability() { + try { + const isAvailable = await checkMicrophoneAvailability(); + const isHttp = isHttpNonLocalhost(); + // 保存可用性状态到全局变量 + window.microphoneAvailable = isAvailable; + window.isHttpNonLocalhost = isHttp; + // 更新UI + if (this.uiController) { + this.uiController.updateMicrophoneAvailability(isAvailable, isHttp); + } + log(`麦克风可用性检查完成: ${isAvailable ? '可用' : '不可用'}`, isAvailable ? 'success' : 'warning'); + } catch (error) { + log(`检查麦克风可用性失败: ${error.message}`, 'error'); + // 默认设置为不可用 + window.microphoneAvailable = false; + window.isHttpNonLocalhost = isHttpNonLocalhost(); + if (this.uiController) { + this.uiController.updateMicrophoneAvailability(false, window.isHttpNonLocalhost); + } + } + } } // 创建并启动应用 const app = new App(); - // 将应用实例暴露到全局,供其他模块访问 window.chatApp = app; - document.addEventListener('DOMContentLoaded', () => { // 初始化应用 app.init(); }); - - export default app; diff --git a/main/xiaozhi-server/test/js/core/audio/opus-codec.js b/main/xiaozhi-server/test/js/core/audio/opus-codec.js index 254e8c24..8bca8bb8 100644 --- a/main/xiaozhi-server/test/js/core/audio/opus-codec.js +++ b/main/xiaozhi-server/test/js/core/audio/opus-codec.js @@ -1,4 +1,4 @@ -import { log } from '../../utils/logger.js'; +import { log } from '../../utils/logger.js?v=0127'; // 检查Opus库是否已加载 diff --git a/main/xiaozhi-server/test/js/core/audio/player.js b/main/xiaozhi-server/test/js/core/audio/player.js index bc89d58a..191a1981 100644 --- a/main/xiaozhi-server/test/js/core/audio/player.js +++ b/main/xiaozhi-server/test/js/core/audio/player.js @@ -1,7 +1,7 @@ // 音频播放模块 -import { log } from '../../utils/logger.js'; -import BlockingQueue from '../../utils/blocking-queue.js'; -import { createStreamingContext } from './stream-context.js'; +import BlockingQueue from '../../utils/blocking-queue.js?v=0127'; +import { log } from '../../utils/logger.js?v=0127'; +import { createStreamingContext } from './stream-context.js?v=0127'; // 音频播放器类 export class AudioPlayer { diff --git a/main/xiaozhi-server/test/js/core/audio/recorder.js b/main/xiaozhi-server/test/js/core/audio/recorder.js index 0250f94a..8ac14655 100644 --- a/main/xiaozhi-server/test/js/core/audio/recorder.js +++ b/main/xiaozhi-server/test/js/core/audio/recorder.js @@ -1,9 +1,9 @@ -// 音频录制模块 -import { log } from '../../utils/logger.js'; -import { initOpusEncoder } from './opus-codec.js'; -import { getAudioPlayer } from './player.js'; +// Audio recording module +import { log } from '../../utils/logger.js?v=0127'; +import { initOpusEncoder } from './opus-codec.js?v=0127'; +import { getAudioPlayer } from './player.js?v=0127'; -// 音频录制器类 +// Audio recorder class export class AudioRecorder { constructor() { this.isRecording = false; @@ -19,25 +19,23 @@ export class AudioRecorder { this.visualizationRequest = null; this.recordingTimer = null; this.websocket = null; - - // 回调函数 + // Callback functions this.onRecordingStart = null; this.onRecordingStop = null; this.onVisualizerUpdate = null; } - // 设置WebSocket实例 + // Set WebSocket instance setWebSocket(ws) { this.websocket = ws; } - // 获取AudioContext实例 + // Get AudioContext instance getAudioContext() { - const audioPlayer = getAudioPlayer(); - return audioPlayer.getAudioContext(); + return getAudioPlayer().getAudioContext(); } - // 初始化编码器 + // Initialize encoder initEncoder() { if (!this.opusEncoder) { this.opusEncoder = initOpusEncoder(); @@ -45,7 +43,7 @@ export class AudioRecorder { return this.opusEncoder; } - // PCM处理器代码 + // PCM processor code getAudioProcessorCode() { return ` class AudioRecorderProcessor extends AudioWorkletProcessor { @@ -56,166 +54,132 @@ export class AudioRecorder { this.buffer = new Int16Array(this.frameSize); this.bufferIndex = 0; this.isRecording = false; - this.port.onmessage = (event) => { if (event.data.command === 'start') { this.isRecording = true; this.port.postMessage({ type: 'status', status: 'started' }); } else if (event.data.command === 'stop') { this.isRecording = false; - if (this.bufferIndex > 0) { const finalBuffer = this.buffer.slice(0, this.bufferIndex); - this.port.postMessage({ - type: 'buffer', - buffer: finalBuffer - }); + this.port.postMessage({ type: 'buffer', buffer: finalBuffer }); this.bufferIndex = 0; } - this.port.postMessage({ type: 'status', status: 'stopped' }); } }; } - process(inputs, outputs, parameters) { if (!this.isRecording) return true; - const input = inputs[0][0]; if (!input) return true; - for (let i = 0; i < input.length; i++) { if (this.bufferIndex >= this.frameSize) { - this.port.postMessage({ - type: 'buffer', - buffer: this.buffer.slice(0) - }); + this.port.postMessage({ type: 'buffer', buffer: this.buffer.slice(0) }); this.bufferIndex = 0; } - this.buffer[this.bufferIndex++] = Math.max(-32768, Math.min(32767, Math.floor(input[i] * 32767))); } - return true; } } - registerProcessor('audio-recorder-processor', AudioRecorderProcessor); `; } - // 创建音频处理器 + // Create audio processor async createAudioProcessor() { this.audioContext = this.getAudioContext(); - try { if (this.audioContext.audioWorklet) { const blob = new Blob([this.getAudioProcessorCode()], { type: 'application/javascript' }); const url = URL.createObjectURL(blob); await this.audioContext.audioWorklet.addModule(url); URL.revokeObjectURL(url); - const audioProcessor = new AudioWorkletNode(this.audioContext, 'audio-recorder-processor'); - audioProcessor.port.onmessage = (event) => { if (event.data.type === 'buffer') { this.processPCMBuffer(event.data.buffer); } }; - log('使用AudioWorklet处理音频', 'success'); - const silent = this.audioContext.createGain(); silent.gain.value = 0; audioProcessor.connect(silent); silent.connect(this.audioContext.destination); return { node: audioProcessor, type: 'worklet' }; } else { - log('AudioWorklet不可用,使用ScriptProcessorNode作为回退方案', 'warning'); + log('AudioWorklet不可用,使用ScriptProcessorNode作为后备方案', 'warning'); return this.createScriptProcessor(); } } catch (error) { - log(`创建音频处理器失败: ${error.message},尝试回退方案`, 'error'); + log(`创建音频处理器失败: ${error.message},尝试后备方案`, 'error'); return this.createScriptProcessor(); } } - // 创建ScriptProcessor作为回退 + // Create ScriptProcessor as fallback createScriptProcessor() { try { const frameSize = 4096; const scriptProcessor = this.audioContext.createScriptProcessor(frameSize, 1, 1); - scriptProcessor.onaudioprocess = (event) => { if (!this.isRecording) return; - const input = event.inputBuffer.getChannelData(0); const buffer = new Int16Array(input.length); - for (let i = 0; i < input.length; i++) { buffer[i] = Math.max(-32768, Math.min(32767, Math.floor(input[i] * 32767))); } - this.processPCMBuffer(buffer); }; - const silent = this.audioContext.createGain(); silent.gain.value = 0; scriptProcessor.connect(silent); silent.connect(this.audioContext.destination); - - log('使用ScriptProcessorNode作为回退方案成功', 'warning'); + log('使用ScriptProcessorNode作为后备方案成功', 'warning'); return { node: scriptProcessor, type: 'processor' }; } catch (fallbackError) { - log(`回退方案也失败: ${fallbackError.message}`, 'error'); + log(`后备方案也失败: ${fallbackError.message}`, 'error'); return null; } } - // 处理PCM缓冲数据 + // Process PCM buffer data processPCMBuffer(buffer) { if (!this.isRecording) return; - const newBuffer = new Int16Array(this.pcmDataBuffer.length + buffer.length); newBuffer.set(this.pcmDataBuffer); newBuffer.set(buffer, this.pcmDataBuffer.length); this.pcmDataBuffer = newBuffer; - const samplesPerFrame = 960; - while (this.pcmDataBuffer.length >= samplesPerFrame) { const frameData = this.pcmDataBuffer.slice(0, samplesPerFrame); this.pcmDataBuffer = this.pcmDataBuffer.slice(samplesPerFrame); - this.encodeAndSendOpus(frameData); } } - // 编码并发送Opus数据 + // Encode and send Opus data encodeAndSendOpus(pcmData = null) { if (!this.opusEncoder) { log('Opus编码器未初始化', 'error'); return; } - try { if (pcmData) { const opusData = this.opusEncoder.encode(pcmData); - if (opusData && opusData.length > 0) { this.audioBuffers.push(opusData.buffer); this.totalAudioSize += opusData.length; - if (this.websocket && this.websocket.readyState === WebSocket.OPEN) { try { this.websocket.send(opusData.buffer); - log(`发送Opus帧,大小:${opusData.length}字节`, 'debug'); } catch (error) { log(`WebSocket发送错误: ${error.message}`, 'error'); } } } else { - log('Opus编码失败,无有效数据返回', 'error'); + log('Opus编码失败,未返回有效数据', 'error'); } } else { if (this.pcmDataBuffer.length > 0) { @@ -235,96 +199,67 @@ export class AudioRecorder { } } - // 开始录音 + // Start recording async start() { if (this.isRecording) return false; - try { - // 检查是否有WebSocketHandler实例 - const { getWebSocketHandler } = await import('../network/websocket.js'); + // Check if WebSocketHandler instance exists + const { getWebSocketHandler } = await import('../network/websocket.js?v=0127'); const wsHandler = getWebSocketHandler(); - - // 如果机器正在说话,发送打断消息 + // If machine is speaking, send abort message if (wsHandler && wsHandler.isRemoteSpeaking && wsHandler.currentSessionId) { - const abortMessage = { - session_id: wsHandler.currentSessionId, - type: 'abort', - reason: 'wake_word_detected' - }; - + const abortMessage = { session_id: wsHandler.currentSessionId, type: 'abort', reason: 'wake_word_detected' }; if (this.websocket && this.websocket.readyState === WebSocket.OPEN) { this.websocket.send(JSON.stringify(abortMessage)); - log('发送打断消息', 'info'); + log('已发送中止消息', 'info'); } } - if (!this.initEncoder()) { - log('无法启动录音: Opus编码器初始化失败', 'error'); + log('无法开始录音: Opus编码器初始化失败', 'error'); return false; } - - log('请至少录制1-2秒钟的音频,确保采集到足够数据', 'info'); - - const stream = await navigator.mediaDevices.getUserMedia({ - audio: { - echoCancellation: true, - noiseSuppression: true, - sampleRate: 16000, - channelCount: 1 - } - }); - + log('请至少录制1-2秒音频以确保收集足够的数据', 'info'); + const stream = await navigator.mediaDevices.getUserMedia({ audio: { echoCancellation: true, noiseSuppression: true, sampleRate: 16000, channelCount: 1 } }); this.audioContext = this.getAudioContext(); - if (this.audioContext.state === 'suspended') { await this.audioContext.resume(); } - const processorResult = await this.createAudioProcessor(); if (!processorResult) { log('无法创建音频处理器', 'error'); return false; } - this.audioProcessor = processorResult.node; this.audioProcessorType = processorResult.type; - this.audioSource = this.audioContext.createMediaStreamSource(stream); this.analyser = this.audioContext.createAnalyser(); this.analyser.fftSize = 2048; - this.audioSource.connect(this.analyser); this.audioSource.connect(this.audioProcessor); - this.pcmDataBuffer = new Int16Array(); this.audioBuffers = []; this.totalAudioSize = 0; this.isRecording = true; - if (this.audioProcessorType === 'worklet' && this.audioProcessor.port) { this.audioProcessor.port.postMessage({ command: 'start' }); } - - // 发送监听开始消息 + // Send listening start message if (this.websocket && this.websocket.readyState === WebSocket.OPEN) { - log(`发送录音开始消息`, 'info'); + log(`已发送录音开始消息`, 'info'); } else { log('WebSocket未连接,无法发送开始消息', 'error'); return false; } - - // 开始可视化 + // Start visualization if (this.onVisualizerUpdate) { const dataArray = new Uint8Array(this.analyser.frequencyBinCount); this.startVisualization(dataArray); } - - // 立即通知录音开始,更新按钮状态 + // Immediately notify recording start, update button state if (this.onRecordingStart) { this.onRecordingStart(0); } - - // 启动录音计时器 + // Start recording timer let recordingSeconds = 0; this.recordingTimer = setInterval(() => { recordingSeconds += 0.1; @@ -332,8 +267,7 @@ export class AudioRecorder { this.onRecordingStart(recordingSeconds); } }, 100); - - log('开始PCM直接录音', 'success'); + log('已开始PCM直接录音', 'success'); return true; } catch (error) { log(`直接录音启动错误: ${error.message}`, 'error'); @@ -342,15 +276,12 @@ export class AudioRecorder { } } - // 开始可视化 + // Start visualization startVisualization(dataArray) { const draw = () => { this.visualizationRequest = requestAnimationFrame(() => draw()); - if (!this.isRecording) return; - this.analyser.getByteFrequencyData(dataArray); - if (this.onVisualizerUpdate) { this.onVisualizerUpdate(dataArray); } @@ -358,52 +289,42 @@ export class AudioRecorder { draw(); } - // 停止录音 + // Stop recording stop() { if (!this.isRecording) return false; - try { this.isRecording = false; - if (this.audioProcessor) { if (this.audioProcessorType === 'worklet' && this.audioProcessor.port) { this.audioProcessor.port.postMessage({ command: 'stop' }); } - this.audioProcessor.disconnect(); this.audioProcessor = null; } - if (this.audioSource) { this.audioSource.disconnect(); this.audioSource = null; } - if (this.visualizationRequest) { cancelAnimationFrame(this.visualizationRequest); this.visualizationRequest = null; } - if (this.recordingTimer) { clearInterval(this.recordingTimer); this.recordingTimer = null; } - - // 编码并发送剩余的数据 + // Encode and send remaining data this.encodeAndSendOpus(); - - // 发送结束信号 + // Send end signal if (this.websocket && this.websocket.readyState === WebSocket.OPEN) { const emptyOpusFrame = new Uint8Array(0); this.websocket.send(emptyOpusFrame); log('已发送录音停止信号', 'info'); } - if (this.onRecordingStop) { this.onRecordingStop(); } - - log('停止PCM直接录音', 'success'); + log('已停止PCM直接录音', 'success'); return true; } catch (error) { log(`直接录音停止错误: ${error.message}`, 'error'); @@ -411,13 +332,13 @@ export class AudioRecorder { } } - // 获取分析器 + // Get analyser getAnalyser() { return this.analyser; } } -// 创建单例 +// Create singleton instance let audioRecorderInstance = null; export function getAudioRecorder() { @@ -426,3 +347,49 @@ export function getAudioRecorder() { } return audioRecorderInstance; } + +/** + * Check if microphone is available + * @returns {Promise} Returns true if available, false if not available + */ +export async function checkMicrophoneAvailability() { + // Check if browser supports getUserMedia API + if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) { + log('浏览器不支持getUserMedia API', 'warning'); + return false; + } + try { + // Try to access microphone + const stream = await navigator.mediaDevices.getUserMedia({ audio: { echoCancellation: true, noiseSuppression: true, sampleRate: 16000, channelCount: 1 } }); + // Immediately stop all tracks to release microphone + stream.getTracks().forEach(track => track.stop()); + log('麦克风可用性检查成功', 'success'); + return true; + } catch (error) { + log(`麦克风不可用: ${error.message}`, 'warning'); + return false; + } +} + +/** + * Check if it is HTTP non-localhost access + * @returns {boolean} Returns true if it is HTTP non-localhost access + */ +export function isHttpNonLocalhost() { + const protocol = window.location.protocol; + const hostname = window.location.hostname; + // Check if it is HTTP protocol + if (protocol !== 'http:') { + return false; + } + // localhost and 127.0.0.1 can use microphone + if (hostname === 'localhost' || hostname === '127.0.0.1') { + return false; + } + // Private IP addresses can also use microphone (browser allows) + if (hostname.startsWith('192.168.') || hostname.startsWith('10.') || hostname.startsWith('172.')) { + return false; + } + // Other HTTP access is considered non-localhost + return true; +} diff --git a/main/xiaozhi-server/test/js/core/audio/stream-context.js b/main/xiaozhi-server/test/js/core/audio/stream-context.js index 2ff69bcb..eef6dce9 100644 --- a/main/xiaozhi-server/test/js/core/audio/stream-context.js +++ b/main/xiaozhi-server/test/js/core/audio/stream-context.js @@ -1,5 +1,5 @@ -import BlockingQueue from '../../utils/blocking-queue.js'; -import { log } from '../../utils/logger.js'; +import BlockingQueue from '../../utils/blocking-queue.js?v=0127'; +import { log } from '../../utils/logger.js?v=0127'; // 音频流播放上下文类 export class StreamingContext { diff --git a/main/xiaozhi-server/test/js/core/mcp/tools.js b/main/xiaozhi-server/test/js/core/mcp/tools.js index 7a1198c9..34f8e14c 100644 --- a/main/xiaozhi-server/test/js/core/mcp/tools.js +++ b/main/xiaozhi-server/test/js/core/mcp/tools.js @@ -1,4 +1,4 @@ -import { log } from '../../utils/logger.js'; +import { log } from '../../utils/logger.js?v=0127'; // ========================================== // MCP 工具管理逻辑 @@ -24,7 +24,6 @@ export function setWebSocket(ws) { export async function initMcpTools() { // 加载默认工具数据 const defaultMcpTools = await fetch("js/config/default-mcp-tools.json").then(res => res.json()); - const savedTools = localStorage.getItem('mcpTools'); if (savedTools) { try { @@ -36,9 +35,11 @@ export async function initMcpTools() { } else { mcpTools = [...defaultMcpTools]; } - renderMcpTools(); - setupMcpEventListeners(); + // Only setup event listeners if DOM elements exist + if (document.getElementById('toggleMcpTools')) { + setupMcpEventListeners(); + } } /** @@ -47,21 +48,20 @@ export async function initMcpTools() { function renderMcpTools() { const container = document.getElementById('mcpToolsContainer'); const countSpan = document.getElementById('mcpToolsCount'); - + if (!container) { + return; // Container not found, skip rendering + } if (countSpan) { countSpan.textContent = `${mcpTools.length} 个工具`; } - if (mcpTools.length === 0) { container.innerHTML = '
暂无工具,点击下方按钮添加新工具
'; return; } - container.innerHTML = mcpTools.map((tool, index) => { const paramCount = tool.inputSchema.properties ? Object.keys(tool.inputSchema.properties).length : 0; const requiredCount = tool.inputSchema.required ? tool.inputSchema.required.length : 0; const hasMockResponse = tool.mockResponse && Object.keys(tool.mockResponse).length > 0; - return `
@@ -96,12 +96,13 @@ function renderMcpTools() { */ function renderMcpProperties() { const container = document.getElementById('mcpPropertiesContainer'); - + if (!container) { + return; // Container not found, skip rendering + } if (mcpProperties.length === 0) { container.innerHTML = '
暂无参数,点击下方按钮添加参数
'; return; } - container.innerHTML = mcpProperties.map((prop, index) => `
@@ -161,12 +162,7 @@ function renderMcpProperties() { * 添加参数 */ function addMcpProperty() { - mcpProperties.push({ - name: `param_${mcpProperties.length + 1}`, - type: 'string', - required: false, - description: '' - }); + mcpProperties.push({ name: `param_${mcpProperties.length + 1}`, type: 'string', required: false, description: '' }); renderMcpProperties(); } @@ -182,9 +178,7 @@ function updateMcpProperty(index, field, value) { return; } } - mcpProperties[index][field] = value; - if (field === 'type' && value !== 'integer' && value !== 'number') { delete mcpProperties[index].minimum; delete mcpProperties[index].maximum; @@ -212,25 +206,24 @@ function setupMcpEventListeners() { const cancelBtn = document.getElementById('cancelMcpBtn'); const form = document.getElementById('mcpToolForm'); const addPropertyBtn = document.getElementById('addMcpPropertyBtn'); - + // Return early if required elements don't exist (e.g., in test environment) + if (!toggleBtn || !panel || !addBtn || !modal || !closeBtn || !cancelBtn || !form || !addPropertyBtn) { + return; + } toggleBtn.addEventListener('click', () => { const isExpanded = panel.classList.contains('expanded'); panel.classList.toggle('expanded'); - toggleBtn.textContent = isExpanded ? '展开' : '收起'; + toggleBtn.textContent = isExpanded ? '收起' : '展开'; }); - // 确保面板默认展开 panel.classList.add('expanded'); - addBtn.addEventListener('click', () => openMcpModal()); closeBtn.addEventListener('click', closeMcpModal); cancelBtn.addEventListener('click', closeMcpModal); addPropertyBtn.addEventListener('click', addMcpProperty); - modal.addEventListener('click', (e) => { if (e.target === modal) closeMcpModal(); }); - form.addEventListener('submit', handleMcpSubmit); } @@ -243,18 +236,15 @@ function openMcpModal(index = null) { alert('WebSocket 已连接,无法编辑工具'); return; } - mcpEditingIndex = index; const errorContainer = document.getElementById('mcpErrorContainer'); errorContainer.innerHTML = ''; - if (index !== null) { document.getElementById('mcpModalTitle').textContent = '编辑工具'; const tool = mcpTools[index]; document.getElementById('mcpToolName').value = tool.name; document.getElementById('mcpToolDescription').value = tool.description; document.getElementById('mcpMockResponse').value = tool.mockResponse ? JSON.stringify(tool.mockResponse, null, 2) : ''; - mcpProperties = []; const schema = tool.inputSchema; if (schema.properties) { @@ -275,7 +265,6 @@ function openMcpModal(index = null) { document.getElementById('mcpToolForm').reset(); mcpProperties = []; } - renderMcpProperties(); document.getElementById('mcpToolModal').style.display = 'block'; } @@ -298,21 +287,15 @@ function handleMcpSubmit(e) { e.preventDefault(); const errorContainer = document.getElementById('mcpErrorContainer'); errorContainer.innerHTML = ''; - const name = document.getElementById('mcpToolName').value.trim(); const description = document.getElementById('mcpToolDescription').value.trim(); const mockResponseText = document.getElementById('mcpMockResponse').value.trim(); - // 检查名称重复 - const isDuplicate = mcpTools.some((tool, index) => - tool.name === name && index !== mcpEditingIndex - ); - + const isDuplicate = mcpTools.some((tool, index) => tool.name === name && index !== mcpEditingIndex); if (isDuplicate) { showMcpError('工具名称已存在,请使用不同的名称'); return; } - // 解析模拟返回结果 let mockResponse = null; if (mockResponseText) { @@ -323,21 +306,13 @@ function handleMcpSubmit(e) { return; } } - // 构建 inputSchema - const inputSchema = { - type: "object", - properties: {}, - required: [] - }; - + const inputSchema = { type: "object", properties: {}, required: [] }; mcpProperties.forEach(prop => { const propSchema = { type: prop.type }; - if (prop.description) { propSchema.description = prop.description; } - if ((prop.type === 'integer' || prop.type === 'number')) { if (prop.minimum !== undefined && prop.minimum !== '') { propSchema.minimum = prop.minimum; @@ -346,20 +321,15 @@ function handleMcpSubmit(e) { propSchema.maximum = prop.maximum; } } - inputSchema.properties[prop.name] = propSchema; - if (prop.required) { inputSchema.required.push(prop.name); } }); - if (inputSchema.required.length === 0) { delete inputSchema.required; } - const tool = { name, description, inputSchema, mockResponse }; - if (mcpEditingIndex !== null) { mcpTools[mcpEditingIndex] = tool; log(`已更新工具: ${name}`, 'success'); @@ -367,7 +337,6 @@ function handleMcpSubmit(e) { mcpTools.push(tool); log(`已添加工具: ${name}`, 'success'); } - saveMcpTools(); renderMcpTools(); closeMcpModal(); @@ -417,11 +386,7 @@ function saveMcpTools() { * 获取工具列表 */ export function getMcpTools() { - return mcpTools.map(tool => ({ - name: tool.name, - description: tool.description, - inputSchema: tool.inputSchema - })); + return mcpTools.map(tool => ({ name: tool.name, description: tool.description, inputSchema: tool.inputSchema })); } /** @@ -429,20 +394,14 @@ export function getMcpTools() { */ export function executeMcpTool(toolName, toolArgs) { const tool = mcpTools.find(t => t.name === toolName); - if (!tool) { log(`未找到工具: ${toolName}`, 'error'); - return { - success: false, - error: `未知工具: ${toolName}` - }; + return { success: false, error: `未知工具: ${toolName}` }; } - // 如果有模拟返回结果,使用它 if (tool.mockResponse) { // 替换模板变量 let responseStr = JSON.stringify(tool.mockResponse); - // 替换 ${paramName} 格式的变量 if (toolArgs) { Object.keys(toolArgs).forEach(key => { @@ -450,7 +409,6 @@ export function executeMcpTool(toolName, toolArgs) { responseStr = responseStr.replace(regex, toolArgs[key]); }); } - try { const response = JSON.parse(responseStr); log(`工具 ${toolName} 执行成功,返回模拟结果: ${responseStr}`, 'success'); @@ -460,21 +418,10 @@ export function executeMcpTool(toolName, toolArgs) { return tool.mockResponse; } } - // 没有模拟返回结果,返回默认成功消息 log(`工具 ${toolName} 执行成功,返回默认结果`, 'success'); - return { - success: true, - message: `工具 ${toolName} 执行成功`, - tool: toolName, - arguments: toolArgs - }; + return { success: true, message: `工具 ${toolName} 执行成功`, tool: toolName, arguments: toolArgs }; } // 暴露全局方法供 HTML 内联事件调用 -window.mcpModule = { - updateMcpProperty, - deleteMcpProperty, - editMcpTool, - deleteMcpTool -}; +window.mcpModule = { updateMcpProperty, deleteMcpProperty, editMcpTool, deleteMcpTool }; diff --git a/main/xiaozhi-server/test/js/core/network/ota-connector.js b/main/xiaozhi-server/test/js/core/network/ota-connector.js index e254887a..1b6fd134 100644 --- a/main/xiaozhi-server/test/js/core/network/ota-connector.js +++ b/main/xiaozhi-server/test/js/core/network/ota-connector.js @@ -1,4 +1,4 @@ -import { log } from '../../utils/logger.js'; +import { log } from '../../utils/logger.js?v=0127'; // WebSocket 连接 export async function webSocketConnect(otaUrl, config) { diff --git a/main/xiaozhi-server/test/js/core/network/websocket.js b/main/xiaozhi-server/test/js/core/network/websocket.js index c35b5300..386d0be3 100644 --- a/main/xiaozhi-server/test/js/core/network/websocket.js +++ b/main/xiaozhi-server/test/js/core/network/websocket.js @@ -1,11 +1,11 @@ // WebSocket消息处理模块 -import { log } from '../../utils/logger.js'; -import { webSocketConnect } from './ota-connector.js'; -import { getConfig, saveConnectionUrls } from '../../config/manager.js'; -import { getAudioPlayer } from '../audio/player.js'; -import { getAudioRecorder } from '../audio/recorder.js'; -import { getMcpTools, executeMcpTool, setWebSocket as setMcpWebSocket } from '../mcp/tools.js'; -import { uiController } from '../../ui/controller.js' +import { getConfig, saveConnectionUrls } from '../../config/manager.js?v=0127'; +import { uiController } from '../../ui/controller.js?v=0127'; +import { log } from '../../utils/logger.js?v=0127'; +import { getAudioPlayer } from '../audio/player.js?v=0127'; +import { getAudioRecorder } from '../audio/recorder.js?v=0127'; +import { executeMcpTool, getMcpTools, setWebSocket as setMcpWebSocket } from '../mcp/tools.js?v=0127'; +import { webSocketConnect } from './ota-connector.js?v=0127'; // WebSocket处理器类 export class WebSocketHandler { @@ -101,10 +101,10 @@ export class WebSocketHandler { } // 触发Live2D情绪动作 - if (message.emotion) { - console.log(`收到情绪消息: emotion=${message.emotion}, text=${message.text}`); - this.triggerLive2DEmotionAction(message.emotion); - } + if (message.emotion) { + console.log(`收到情绪消息: emotion=${message.emotion}, text=${message.text}`); + this.triggerLive2DEmotionAction(message.emotion); + } } // 只有当文本不仅仅是表情时,才添加到对话中 @@ -273,6 +273,26 @@ export class WebSocketHandler { this.websocket.send(replyMessage); } else if (payload.method === 'initialize') { log(`收到工具初始化请求: ${JSON.stringify(payload.params)}`, 'info'); + const replyMessage = JSON.stringify({ + "session_id": message.session_id || "", + "type": "mcp", + "payload": { + "jsonrpc": "2.0", + "id": payload.id, + "result": { + "protocolVersion": "2024-11-05", + "capabilities": { + "tools": {} + }, + "serverInfo": { + "name": "xiaozhi-web-test", + "version": "2.1.0" + } + } + } + }); + log(`回复初始化响应`, 'info'); + this.websocket.send(replyMessage); } else { log(`未知的MCP方法: ${payload.method}`, 'warning'); } @@ -284,7 +304,6 @@ export class WebSocketHandler { let arrayBuffer; if (data instanceof ArrayBuffer) { arrayBuffer = data; - log(`收到ArrayBuffer音频数据,大小: ${data.byteLength}字节`, 'debug'); } else if (data instanceof Blob) { arrayBuffer = await data.arrayBuffer(); log(`收到Blob音频数据,大小: ${arrayBuffer.byteLength}字节`, 'debug'); @@ -372,7 +391,7 @@ export class WebSocketHandler { this.websocket.onerror = (error) => { log(`WebSocket错误: ${error.message || '未知错误'}`, 'error'); - + uiController.addChatMessage(`⚠️ WebSocket错误: ${error.message || '未知错误'}`, false); if (this.onConnectionStateChange) { this.onConnectionStateChange(false); } diff --git a/main/xiaozhi-server/test/js/ui/controller.js b/main/xiaozhi-server/test/js/ui/controller.js index 2b43a378..4d9fd54e 100644 --- a/main/xiaozhi-server/test/js/ui/controller.js +++ b/main/xiaozhi-server/test/js/ui/controller.js @@ -1,10 +1,10 @@ -// UI控制模块 -import { loadConfig, saveConfig } from '../config/manager.js'; -import { getAudioRecorder } from '../core/audio/recorder.js'; -import { getWebSocketHandler } from '../core/network/websocket.js'; -import { getAudioPlayer } from '../core/audio/player.js'; +// UI controller module +import { loadConfig, saveConfig } from '../config/manager.js?v=0127'; +import { getAudioPlayer } from '../core/audio/player.js?v=0127'; +import { getAudioRecorder } from '../core/audio/recorder.js?v=0127'; +import { getWebSocketHandler } from '../core/network/websocket.js?v=0127'; -// UI控制器类 +// UI controller class class UIController { constructor() { this.isEditing = false; @@ -14,7 +14,7 @@ class UIController { this.currentBackgroundIndex = 0; this.backgroundImages = ['1.png', '2.png', '3.png']; - // 绑定方法 + // Bind methods this.init = this.init.bind(this); this.initEventListeners = this.initEventListeners.bind(this); this.updateDialButton = this.updateDialButton.bind(this); @@ -25,7 +25,7 @@ class UIController { this.switchTab = this.switchTab.bind(this); } - // 初始化 + // Initialize init() { console.log('UIController init started'); @@ -35,7 +35,7 @@ class UIController { this.initVisualizer(); } - // 检查连接按钮在初始化时是否存在 + // Check if connect button exists during initialization const connectBtn = document.getElementById('connectBtn'); console.log('connectBtn during init:', connectBtn); @@ -43,20 +43,20 @@ class UIController { this.startAudioStatsMonitor(); loadConfig(); - // 设置录音器回调 + // Register recording callback const audioRecorder = getAudioRecorder(); audioRecorder.onRecordingStart = (seconds) => { this.updateRecordButtonState(true, seconds); }; - // 初始化状态显示 + // Initialize status display this.updateConnectionUI(false); this.updateDialButton(false); console.log('UIController init completed'); } - // 初始化可视化器 + // Initialize visualizer initVisualizer() { if (this.visualizerCanvas) { this.visualizerCanvas.width = this.visualizerCanvas.clientWidth; @@ -66,9 +66,9 @@ class UIController { } } - // 初始化事件监听器 + // Initialize event listeners initEventListeners() { - // 设置按钮 + // Settings button const settingsBtn = document.getElementById('settingsBtn'); if (settingsBtn) { settingsBtn.addEventListener('click', () => { @@ -76,13 +76,13 @@ class UIController { }); } - // 背景切换按钮 + // Background switch button const backgroundBtn = document.getElementById('backgroundBtn'); if (backgroundBtn) { backgroundBtn.addEventListener('click', this.switchBackground); } - // 拨号按钮 + // Dial button const dialBtn = document.getElementById('dialBtn'); if (dialBtn) { dialBtn.addEventListener('click', () => { @@ -92,40 +92,40 @@ class UIController { if (isConnected) { wsHandler.disconnect(); this.updateDialButton(false); - this.addChatMessage('已断开连接,期待下次再见~😉', false); + this.addChatMessage('Disconnected, see you next time~😊', false); } else { - // 检查OTA地址是否已填写 + // Check if OTA URL is filled const otaUrlInput = document.getElementById('otaUrl'); if (!otaUrlInput || !otaUrlInput.value.trim()) { - // 如果OTA地址未填写,显示设置弹窗并切换到设备配置页 + // If OTA URL is not filled, show settings modal and switch to device tab this.showModal('settingsModal'); this.switchTab('device'); - this.addChatMessage('请先填写OTA服务器地址', false); + this.addChatMessage('Please fill in OTA server URL', false); return; } - // 执行连接操作 + // Start connection process this.handleConnect(); } }); } - // 录音按钮 + // Record button const recordBtn = document.getElementById('recordBtn'); if (recordBtn) { recordBtn.addEventListener('click', () => { const audioRecorder = getAudioRecorder(); if (audioRecorder.isRecording) { audioRecorder.stop(); - // 停止录音时移除录音样式 + // Restore record button to normal state recordBtn.classList.remove('recording'); recordBtn.querySelector('.btn-text').textContent = '录音'; } else { - // 先更新按钮状态为录音中 + // Update button state to recording recordBtn.classList.add('recording'); recordBtn.querySelector('.btn-text').textContent = '录音中'; - // 延迟开始录音,确保按钮状态已更新 + // Start recording, update button state after delay setTimeout(() => { audioRecorder.start(); }, 100); @@ -133,7 +133,7 @@ class UIController { }); } - // 消息输入框事件 + // Chat input event listener const chatIpt = document.getElementById('chatIpt'); if (chatIpt) { const wsHandler = getWebSocketHandler(); @@ -148,7 +148,7 @@ class UIController { }); } - // 关闭按钮 + // Close button const closeButtons = document.querySelectorAll('.close-btn'); closeButtons.forEach(btn => { btn.addEventListener('click', (e) => { @@ -163,7 +163,7 @@ class UIController { }); }); - // 设置标签页切换 + // Settings tab switch const tabBtns = document.querySelectorAll('.tab-btn'); tabBtns.forEach(btn => { btn.addEventListener('click', (e) => { @@ -171,7 +171,7 @@ class UIController { }); }); - // 点击模态框外部关闭 + // Click modal background to close const modals = document.querySelectorAll('.modal'); modals.forEach(modal => { modal.addEventListener('click', (e) => { @@ -184,7 +184,7 @@ class UIController { }); }); - // 添加MCP工具按钮 + // Add MCP tool button const addMCPToolBtn = document.getElementById('addMCPToolBtn'); if (addMCPToolBtn) { addMCPToolBtn.addEventListener('click', (e) => { @@ -193,10 +193,10 @@ class UIController { }); } - // 连接按钮和取消按钮已被移除,功能已集成到拨号按钮中 + // Connect button and send button are not removed, can be added to dial button later } - // 更新连接状态UI + // Update connection status UI updateConnectionUI(isConnected) { const connectionStatus = document.getElementById('connectionStatus'); const statusDot = document.querySelector('.status-dot'); @@ -216,7 +216,7 @@ class UIController { } } - // 更新拨号按钮状态 + // Update dial button state updateDialButton(isConnected) { const dialBtn = document.getElementById('dialBtn'); const recordBtn = document.getElementById('recordBtn'); @@ -225,39 +225,44 @@ class UIController { if (isConnected) { dialBtn.classList.add('dial-active'); dialBtn.querySelector('.btn-text').textContent = '挂断'; - // 更新拨号按钮图标为挂断图标 + // Update dial button icon to hang up icon dialBtn.querySelector('svg').innerHTML = ` `; } else { dialBtn.classList.remove('dial-active'); dialBtn.querySelector('.btn-text').textContent = '拨号'; - // 恢复拨号按钮图标 + // Restore dial button icon dialBtn.querySelector('svg').innerHTML = ` `; } } - // 更新录音按钮状态 + // Update record button state if (recordBtn) { - if (isConnected) { + const microphoneAvailable = window.microphoneAvailable !== false; + if (isConnected && microphoneAvailable) { recordBtn.disabled = false; recordBtn.title = '开始录音'; - // 确保录音按钮恢复到正常状态 + // Restore record button to normal state recordBtn.querySelector('.btn-text').textContent = '录音'; recordBtn.classList.remove('recording'); } else { recordBtn.disabled = true; - recordBtn.title = '请先连接服务器'; - // 确保录音按钮恢复到正常状态 + if (!microphoneAvailable) { + recordBtn.title = window.isHttpNonLocalhost ? '当前由于是http访问,无法录音,只能用文字交互' : '麦克风不可用'; + } else { + recordBtn.title = '请先连接服务器'; + } + // Restore record button to normal state recordBtn.querySelector('.btn-text').textContent = '录音'; recordBtn.classList.remove('recording'); } } } - // 更新录音按钮状态 + // Update record button state updateRecordButtonState(isRecording, seconds = 0) { const recordBtn = document.getElementById('recordBtn'); if (recordBtn) { @@ -268,11 +273,37 @@ class UIController { recordBtn.querySelector('.btn-text').textContent = '录音'; recordBtn.classList.remove('recording'); } - recordBtn.disabled = false; + // Only enable button when microphone is available + recordBtn.disabled = window.microphoneAvailable === false; } } - // 添加聊天消息 + /** + * Update microphone availability state + * @param {boolean} isAvailable - Whether microphone is available + * @param {boolean} isHttpNonLocalhost - Whether it is HTTP non-localhost access + */ + updateMicrophoneAvailability(isAvailable, isHttpNonLocalhost) { + const recordBtn = document.getElementById('recordBtn'); + if (!recordBtn) return; + if (!isAvailable) { + // Disable record button + recordBtn.disabled = true; + // Update button text and title + recordBtn.querySelector('.btn-text').textContent = '录音'; + recordBtn.title = isHttpNonLocalhost ? '当前由于是http访问,无法录音,只能用文字交互' : '麦克风不可用'; + + } else { + // If connected, enable record button + const wsHandler = getWebSocketHandler(); + if (wsHandler && wsHandler.isConnected()) { + recordBtn.disabled = false; + recordBtn.title = '开始录音'; + } + } + } + + // Add chat message addChatMessage(content, isUser = false) { const chatStream = document.getElementById('chatStream'); if (!chatStream) return; @@ -282,11 +313,11 @@ class UIController { messageDiv.innerHTML = `
${content}
`; chatStream.appendChild(messageDiv); - // 自动滚动到底部 + // Scroll to bottom chatStream.scrollTop = chatStream.scrollHeight; } - // 切换背景 + // Switch background switchBackground() { this.currentBackgroundIndex = (this.currentBackgroundIndex + 1) % this.backgroundImages.length; const backgroundContainer = document.querySelector('.background-container'); @@ -295,7 +326,7 @@ class UIController { } } - // 显示模态框 + // Show modal showModal(modalId) { const modal = document.getElementById(modalId); if (modal) { @@ -303,7 +334,7 @@ class UIController { } } - // 隐藏模态框 + // Hide modal hideModal(modalId) { const modal = document.getElementById(modalId); if (modal) { @@ -311,16 +342,16 @@ class UIController { } } - // 切换标签页 + // Switch tab switchTab(tabName) { - // 移除所有标签页的active类 + // Remove active class from all tabs const tabBtns = document.querySelectorAll('.tab-btn'); const tabContents = document.querySelectorAll('.tab-content'); tabBtns.forEach(btn => btn.classList.remove('active')); tabContents.forEach(content => content.classList.remove('active')); - // 激活选中的标签页 + // Activate selected tab const activeTabBtn = document.querySelector(`[data-tab="${tabName}"]`); const activeTabContent = document.getElementById(`${tabName}Tab`); @@ -330,24 +361,34 @@ class UIController { } } - // 连接成功后开始对话 + // Start AI chat session after connection startAIChatSession() { - this.addChatMessage('连接成功,开始聊天吧~🙂', false); - // 开启录音 - const recordBtn = document.getElementById('recordBtn'); - if (recordBtn) { - recordBtn.click(); + this.addChatMessage('连接成功,开始聊天吧~😊', false); + // Check microphone availability and show error messages if needed + if (!window.microphoneAvailable) { + if (window.isHttpNonLocalhost) { + this.addChatMessage('⚠️ 当前由于是http访问,无法录音,只能用文字交互', false); + } else { + this.addChatMessage('⚠️ 麦克风不可用,请检查权限设置,只能用文字交互', false); + } + } + // Start recording only if microphone is available + if (window.microphoneAvailable) { + const recordBtn = document.getElementById('recordBtn'); + if (recordBtn) { + recordBtn.click(); + } } } - // 处理连接按钮点击 + // Handle connect button click async handleConnect() { console.log('handleConnect called'); - // 确保切换到设备配置标签页 + // Switch to device settings tab this.switchTab('device'); - // 等待DOM更新 + // Wait for DOM update await new Promise(resolve => setTimeout(resolve, 50)); const otaUrlInput = document.getElementById('otaUrl'); @@ -362,7 +403,7 @@ class UIController { const otaUrl = otaUrlInput.value; console.log('otaUrl value:', otaUrl); - // 更新拨号按钮状态为连接中 + // Update dial button state to connecting const dialBtn = document.getElementById('dialBtn'); if (dialBtn) { dialBtn.classList.add('dial-active'); @@ -370,7 +411,7 @@ class UIController { dialBtn.disabled = true; } - // 显示连接中消息 + // Show connecting message this.addChatMessage('正在连接服务器...', false); const chatIpt = document.getElementById('chatIpt'); @@ -380,41 +421,51 @@ class UIController { try { - // 获取WebSocket处理器 + // Get WebSocket handler instance const wsHandler = getWebSocketHandler(); + + // Register connection state callback BEFORE connecting + wsHandler.onConnectionStateChange = (isConnected) => { + this.updateConnectionUI(isConnected); + this.updateDialButton(isConnected); + }; + + // Register chat message callback BEFORE connecting + wsHandler.onChatMessage = (text, isUser) => { + this.addChatMessage(text, isUser); + }; + + // Register record button state callback BEFORE connecting + wsHandler.onRecordButtonStateChange = (isRecording) => { + const recordBtn = document.getElementById('recordBtn'); + if (recordBtn) { + if (isRecording) { + recordBtn.classList.add('recording'); + recordBtn.querySelector('.btn-text').textContent = '录音中'; + } else { + recordBtn.classList.remove('recording'); + recordBtn.querySelector('.btn-text').textContent = '录音'; + } + } + }; + const isConnected = await wsHandler.connect(); if (isConnected) { + // Check microphone availability (check again after connection) + const { checkMicrophoneAvailability } = await import('../core/audio/recorder.js?v=0127'); + const micAvailable = await checkMicrophoneAvailability(); - // 设置连接状态回调 - wsHandler.onConnectionStateChange = (isConnected) => { - this.updateConnectionUI(isConnected); - this.updateDialButton(isConnected); - }; - - // 设置聊天消息回调 - wsHandler.onChatMessage = (text, isUser) => { - this.addChatMessage(text, isUser); - }; - - // 设置录音按钮状态回调 - wsHandler.onRecordButtonStateChange = (isRecording) => { - const recordBtn = document.getElementById('recordBtn'); - if (recordBtn) { - if (isRecording) { - recordBtn.classList.add('recording'); - recordBtn.querySelector('.btn-text').textContent = '录音中'; - } else { - recordBtn.classList.remove('recording'); - recordBtn.querySelector('.btn-text').textContent = '录音'; - } + if (!micAvailable) { + const isHttp = window.isHttpNonLocalhost; + if (isHttp) { + this.addChatMessage('⚠️ 当前由于是http访问,无法录音,只能用文字交互', false); } - }; + // Update global state + window.microphoneAvailable = false; + } - // 连接成功 - this.addChatMessage('OTA连接成功,正在建立WebSocket连接...', false); - - // 更新拨号按钮状态 + // Update dial button state const dialBtn = document.getElementById('dialBtn'); if (dialBtn) { dialBtn.disabled = false; @@ -434,14 +485,14 @@ class UIController { name: error.name }); - // 显示错误消息 + // Show error message const errorMessage = error.message.includes('Cannot set properties of null') - ? '连接失败:请刷新页面重试' + ? '连接失败:请检查设备连接' : `连接失败: ${error.message}`; this.addChatMessage(errorMessage, false); - // 恢复拨号按钮状态 + // Restore dial button state const dialBtn = document.getElementById('dialBtn'); if (dialBtn) { dialBtn.disabled = false; @@ -452,7 +503,7 @@ class UIController { } } - // 添加MCP工具 + // Add MCP tool addMCPTool() { const mcpToolsList = document.getElementById('mcpToolsList'); if (!mcpToolsList) return; @@ -471,7 +522,7 @@ class UIController { mcpToolsList.appendChild(toolDiv); } - // 移除MCP工具 + // Remove MCP tool removeMCPTool(toolId) { const toolElement = document.getElementById(toolId); if (toolElement) { @@ -479,24 +530,24 @@ class UIController { } } - // 更新音频统计信息 + // Update audio statistics display updateAudioStats() { const audioPlayer = getAudioPlayer(); if (!audioPlayer) return; const stats = audioPlayer.getAudioStats(); - // 这里可以添加音频统计的UI更新逻辑 + // Here can add audio statistics UI update logic } - // 启动音频统计监控 + // Start audio statistics monitor startAudioStatsMonitor() { - // 每100ms更新一次音频统计 + // Update audio statistics every 100ms this.audioStatsTimer = setInterval(() => { this.updateAudioStats(); }, 100); } - // 停止音频统计监控 + // Stop audio statistics monitor stopAudioStatsMonitor() { if (this.audioStatsTimer) { clearInterval(this.audioStatsTimer); @@ -504,7 +555,7 @@ class UIController { } } - // 绘制音频可视化效果 + // Draw audio visualizer waveform drawVisualizer(dataArray) { if (!this.visualizerContext || !this.visualizerCanvas) return; @@ -518,7 +569,7 @@ class UIController { for (let i = 0; i < dataArray.length; i++) { barHeight = dataArray[i] / 2; - // 创建渐变色:从紫色到蓝色到青色 + // Create gradient color: from purple to blue to green const gradient = this.visualizerContext.createLinearGradient(0, 0, 0, this.visualizerCanvas.height); gradient.addColorStop(0, '#8e44ad'); gradient.addColorStop(0.5, '#3498db'); @@ -530,21 +581,21 @@ class UIController { } } - // 更新会话状态UI + // Update session status UI updateSessionStatus(isSpeaking) { - // 这里可以添加会话状态的UI更新逻辑 - // 例如:更新Live2D角色的表情或状态指示器 + // Here can add session status UI update logic + // For example: update Live2D model's mouth movement status } - // 更新会话表情 + // Update session emotion updateSessionEmotion(emoji) { - // 这里可以添加表情更新的逻辑 - // 例如:在状态指示器中显示表情 + // Here can add emotion update logic + // For example: display emoji in status indicator } } -// 创建全局实例 +// Create singleton instance export const uiController = new UIController(); -// 导出类供其他模块使用 -export { UIController }; \ No newline at end of file +// Export class for module usage +export { UIController }; diff --git a/main/xiaozhi-server/test/test_page.html b/main/xiaozhi-server/test/test_page.html index 9a3bf04e..54d911ec 100644 --- a/main/xiaozhi-server/test/test_page.html +++ b/main/xiaozhi-server/test/test_page.html @@ -5,7 +5,7 @@ 小智服务器测试页面 - + + - + - - + + - + - + - +