k5web/assets/index.93afdede.js
2024-06-09 20:48:44 +08:00

2 lines
2.6 KiB
JavaScript

import{v as j,ak as C,_ as E}from"./index.c35127f8.js";/* empty css *//* empty css */import{d as L,r as O,w as V,o as $,bS as B,bH as H,C as p,D as g,aI as r,aH as i,u as I,aK as w,aJ as x,aE as y,aM as S,aN as b,bT as T,a$ as U,bI as J,bJ as R}from"./arco.768e32d2.js";import{f as F}from"./vue.5a5bc6a2.js";import{u as Y}from"./loading.c097827a.js";import{S as q}from"./index.f45a8a27.js";import"./chart.affe3403.js";import"./useConfig.2fd6b346.js";import"./slot.f49519e6.js";const A={class:"container"},G={name:"DIY"},K=L({...G,setup(z){const M=F(),{t:N}=j.exports.useI18n(),k=()=>{M.push({path:"/tool/flash",query:{url:"https://k5.vicicode.com/diyapi/LOSEHU"+t.flag.join("")+".bin?v="+new Date().getTime()}})},t=O({versions:[],flag:[],disMatrix:[],disName:[],showSort:[]});V(()=>[...t.flag],()=>{h()});const h=()=>{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:D,setLoading:v}=Y(!0);return $(async()=>{v(!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=[],u=[];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),N("idea.diy")!=="LOSEHU DIY"?c.set(e[s],e[s-e[0]-e[0]]):c.set(e[s],e[s-e[0]]);n.push(_),u.push(c)}),t.flag=new Array(a.length).fill("0"),t.disName=u,t.disMatrix=n,t.showSort=l;const f=await(await fetch("https://k5.vicicode.com/diyapi/version.json?v="+new Date().getTime())).text();t.versions=JSON.parse(f),h(),v(!1)}),(a,o)=>{const l=C,n=B,u=T,f=U,e=q,_=H,c=J,s=R;return p(),g("div",A,[r(l,{items:[a.$t("menu.workshop"),a.$t("idea.diy")]},null,8,["items"]),r(s,{gutter:20,align:"stretch"},{default:i(()=>[r(c,{span:24},{default:i(()=>[r(_,{class:"general-card",title:a.$t("idea.diy"),loading:I(D)},{default:i(()=>[r(e,{direction:"vertical"},{default:i(()=>[(p(!0),g(w,null,x(t.showSort,m=>(p(),y(u,{modelValue:t.flag[m],"onUpdate:modelValue":d=>t.flag[m]=d,type:"button"},{default:i(()=>[(p(!0),g(w,null,x(t.disMatrix[m],d=>(p(),y(n,{value:d[0],disabled:d[1]},{default:i(()=>[S(b(t.disName[m].get(d[0])),1)]),_:2},1032,["value","disabled"]))),256))]),_:2},1032,["modelValue","onUpdate:modelValue"]))),256)),r(f,{type:"primary",onClick:k},{default:i(()=>[S(b(a.$t("diy.generate")),1)]),_:1})]),_:1})]),_:1},8,["title","loading"])]),_:1})]),_:1})])}}});const nt=E(K,[["__scopeId","data-v-101e557a"]]);export{nt as default};