k5web/assets/index.be153418.js
2024-06-28 00:44:51 +08:00

2 lines
2.9 KiB
JavaScript

import{v as D,ak as B,_ as E}from"./index.4eb55f07.js";/* empty css *//* empty css *//* empty css */import{d as V,r as j,w as F,o as O,bT as U,bI as I,C as d,D as h,aI as r,aH as i,u as T,G as $,aM as f,aK as x,aJ as b,aE as y,aN as k,bU as H,a$ as J,bJ as R,bL as A}from"./arco.7f845a67.js";import{g as G}from"./vue.0bef8fc5.js";import{u as Y}from"./loading.1a4e75f4.js";import{L as q}from"./index.066f8d20.js";import{S as K}from"./index.8ebc4bcd.js";import"./chart.95d38b48.js";import"./useConfig.f6485710.js";import"./useDisabled.110213c8.js";import"./helper.423f0a4e.js";import"./slot.c3910a16.js";const z={class:"container"},P={name:"DIY"},Q=V({...P,setup(W){const M=G(),{t:S}=D.exports.useI18n(),N=()=>{M.push({path:"/tool/flash",query:{url:"https://k5.vicicode.com/diyapi/LOSEHU"+t.flag.join("")+".bin?v="+new Date().getTime()}})},t=j({versions:[],flag:[],disMatrix:[],disName:[],showSort:[]});F(()=>[...t.flag],()=>{v()});const v=()=>{t.flag.map((a,o)=>{t.disMatrix[o].forEach((l,n)=>{t.versions.indexOf("LOSEHU"+t.flag.join("").substring(0,o)+n+t.flag.join("").substring(o+1)+".bin")==-1?t.disMatrix[o].set(n,!0):t.disMatrix[o].set(n,!1)})})},{loading:L,setLoading:w}=Y(!0);return O(async()=>{w(!0);let a=await(await fetch("https://k5.vicicode.com/diyapi/function.json?v="+new Date().getTime())).text();a=JSON.parse(a);let o=[],l=[];a.map(e=>{o[e[e.length-1]-1]=e,l.push(e[e.length-1]-1)}),a=o;let n=[],p=[];a.map(e=>{let _=new Map,c=new Map;for(let s=e[0]*2+1;s<e[0]*3+1;s++)_.set(e[s],!1),S("idea.diy")!=="LOSEHU DIY"?c.set(e[s],e[s-e[0]-e[0]]):c.set(e[s],e[s-e[0]]);n.push(_),p.push(c)}),t.flag=new Array(a.length).fill("0"),t.disName=p,t.disMatrix=n,t.showSort=l;const g=await(await fetch("https://k5.vicicode.com/diyapi/version.json?v="+new Date().getTime())).text();t.versions=JSON.parse(g),v(),w(!1)}),(a,o)=>{const l=B,n=q,p=U,g=H,e=J,_=K,c=I,s=R,C=A;return d(),h("div",z,[r(l,{items:[a.$t("menu.workshop"),a.$t("idea.diy")]},null,8,["items"]),r(C,{gutter:20,align:"stretch"},{default:i(()=>[r(s,{span:24},{default:i(()=>[r(c,{class:"general-card",title:a.$t("idea.diy"),loading:T(L)},{default:i(()=>[r(_,{direction:"vertical"},{default:i(()=>[$("div",null,[f("\u64CD\u4F5C\u8BF4\u660E\uFF1A"),r(n,{theme:"primary",href:"https://github.com/losehu/uv-k5-firmware-custom",target:"_blank"},{default:i(()=>[f("https://github.com/losehu/uv-k5-firmware-custom")]),_:1})]),(d(!0),h(x,null,b(t.showSort,m=>(d(),y(g,{modelValue:t.flag[m],"onUpdate:modelValue":u=>t.flag[m]=u,type:"button"},{default:i(()=>[(d(!0),h(x,null,b(t.disMatrix[m],u=>(d(),y(p,{value:u[0],disabled:u[1]},{default:i(()=>[f(k(t.disName[m].get(u[0])),1)]),_:2},1032,["value","disabled"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"]))),256)),r(e,{type:"primary",onClick:N},{default:i(()=>[f(k(a.$t("diy.generate")),1)]),_:1})]),_:1})]),_:1},8,["title","loading"])]),_:1})]),_:1})])}}});const pt=E(Q,[["__scopeId","data-v-f761c86a"]]);export{pt as default};