mirror of
https://github.com/silenty4ng/k5web
synced 2024-11-14 14:33:23 +00:00
2 lines
2.9 KiB
JavaScript
2 lines
2.9 KiB
JavaScript
import{v as V,ak as j,_ as B}from"./index.84328ebd.js";/* empty css *//* empty css *//* empty css */import{d as C,r as E,w as O,o as U,bT as $,bI as I,C as u,D as h,aI as r,aH as i,u as T,G as H,aM as f,aN as v,aK as x,aJ as y,aE as k,bU as J,a$ as R,bJ as F,bL as G}from"./arco.7f845a67.js";import{g as Y}from"./vue.0bef8fc5.js";import{u as q}from"./loading.1a4e75f4.js";import{L as A}from"./index.c15881d6.js";import{S as K}from"./index.c91f9405.js";import"./chart.95d38b48.js";import"./useConfig.c667f475.js";import"./useDisabled.1ea0b0ca.js";import"./helper.895b8d7d.js";import"./slot.fddc061d.js";const z={class:"container"},P={name:"DIY"},Q=C({...P,setup(W){const M=Y(),{t:S}=V.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=E({versions:[],flag:[],disMatrix:[],disName:[],showSort:[]});O(()=>[...t.flag],()=>{w()});const w=()=>{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:b}=q(!0);return U(async()=>{b(!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),w(),b(!1)}),(a,o)=>{const l=j,n=A,p=$,g=J,e=R,_=K,c=I,s=F,D=G;return u(),h("div",z,[r(l,{items:[a.$t("menu.workshop"),a.$t("idea.diy")]},null,8,["items"]),r(D,{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(()=>[H("div",null,[f(v(a.$t("oi")),1),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})]),(u(!0),h(x,null,y(t.showSort,m=>(u(),k(g,{modelValue:t.flag[m],"onUpdate:modelValue":d=>t.flag[m]=d,type:"button"},{default:i(()=>[(u(!0),h(x,null,y(t.disMatrix[m],d=>(u(),k(p,{value:d[0],disabled:d[1]},{default:i(()=>[f(v(t.disName[m].get(d[0])),1)]),_:2},1032,["value","disabled"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"]))),256)),r(e,{type:"primary",onClick:N},{default:i(()=>[f(v(a.$t("diy.generate")),1)]),_:1})]),_:1})]),_:1},8,["title","loading"])]),_:1})]),_:1})])}}});const pt=B(Q,[["__scopeId","data-v-9368fb4d"]]);export{pt as default};
|