CATEGORY ARRAY: t a=[{id:"landscape",name:"风景",beforeImage:"/chibi-comparisons/landscape-original.png",image:"/chibi-comparisons/landscape-pixel.jpg",badge:"SCENE",note:"山川、城市和旅行纪念",subtypes:[{id:"nature",name:"治愈自然",note:"山湖、森林、日落"},{id:"city",name:"城市夜景",note:"霓虹、街景、天际线"},{id:"landmark",name:"建筑地标",note:"旅行建筑与纪念地"}],tags:["保留天空层次","突出主体建筑","减少零碎纹理","保留光影氛围","纯色边框","高对比轮廓"]},{id:"person",name:"人物",beforeImage:"/chibi-comparisons/person-original.png",image:"/chibi-comparisons/person-pixel.jpg",badge:"PORTRAIT",note:"五官、发型和穿搭清楚",subtypes:[{id:"big-eye",name:"萌系大眼",note:"大眼、圆脸、粗轮廓"},{id:"youth",name:"清爽少年",note:"自然五官、利落穿搭"},{id:"retro",name:"复古像素",note:"怀旧配色、游戏感"}],tags:["五官更清楚","保留衣服细节","保留发型","保留配饰","包含宠物","纯色背景"]},{id:"pet",name:"宠物",beforeImage:"/chibi-comparisons/pet-original.png",image:"/chibi-comparisons/pet-pixel.jpg",badge:"PET",note:"毛色、表情和品种特征",subtypes:[{id:"cat",name:"猫咪头像",note:"圆润脸型与花纹"},{id:"dog",name:"狗狗全身",note:"耳朵、四肢和毛色"},{id:"duo",name:"双宠互动",note:"两只宠物同框"}],tags:["眼睛更有神","保留毛色花纹","突出耳朵轮廓","保留项圈配饰","完整四肢","纯色背景"]},{id:"object",name:"物品",beforeImage:"/chibi-comparisons/object-original.png",image:"/chibi-comparisons/object-pixel.jpg",badge:"OBJECT",note:"手办、礼物和纪念物",subtypes:[{id:"toy",name:"手办玩具",note:"造型轮廓优先"},{id:"daily",name:"生活用品",note:"保留结构与材质"},{id:"gift",name:"礼物纪念",note:"突出包装和装饰"}],tags:["保留品牌外形","突出结构轮廓","减少反光渐变","保留小配件","居中构图","纯色背景"]},{id:"food",name:"食物",beforeImage:"/chibi-comparisons/food-original.png",image:"/chibi-comparisons/food-pixel.jpg",badge:"FOOD",note:"甜品、饮品和特色美食",subtypes:[{id:"dessert",name:"甜品蛋糕",note:"奶油与装饰清楚"},{id:"drink",name:"咖啡饮品",note:"杯型、分层和配料"},{id:"meal",name:"家常美食",note:"主食材清晰可辨"}],tags:["突出食物主体","保留食材层次","减少细碎装饰","增强色彩对比","俯拍构图","纯色背景"]}],l=[48,64,80,96],o=[16,24,32,40],c=["主体特写","半幅构图","完整构图"];e.s(["default",0,function(){let[e,d]=(0,s.useState)(a[2]),[u,f]=(0,s.useState)(a[2].subtypes[0]),[p,h]=(0,s.useState)(64),[m,g]=(0,s.useState)(24),[b,x]=(0,s.useState)("主体特写"),[j,v]=(0,s.useState)(a[2].tags.slice(0,3)),[y,w]=(0,s.useState)(""),[S,_]=(0,s.useState)(null),[C,O]=(0,s.useState)(null),[R,E]=(0,s.useState)(null),[P,N]=(0,s.useState)(!0),[k,I]=(0,s.useState)(!1),[L,T]=(0,s.useState)(""),[M,U]=(0,s.useState)(null),[$,z]=(0,s.useState)(""),[A,D]=(0,s.useState)(""),[B,F]=(0,s.useState)(!1),W=(0,s.useRef)(null),X=(0,s.useRef)(null),q=(0,s.useRef)(null),G=!!(R&&!P),V=(0,s.useMemo)(()=>Math.round(p*p*("主体特写"===b?.7:"半幅构图"===b?.6:.48)),[p,b]);async function H(e,t=!1){try{let t=await fetch("/api/codes/redeem",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e})}),n=await t.json();if(!t.ok||!n.access)throw Error(n.error||"兑换失败");U(n.access),z(n.access.code),localStorage.setItem("perler-download-code",n.access.code),F(!1),D("")}catch(e){t||D(e instanceof Error?e.message:"兑换失败")}}function K(e,t){if(!e||!e.type.startsWith("image/"))return;if(e.size>0xc00000)return void T("图片不能超过 12MB");let n=URL.createObjectURL(e),r=new window.Image;r.onload=()=>{let e=Math.min(1,("source"===t?1400:1200)/Math.max(r.width,r.height)),i=document.createElement("canvas");i.width=Math.round(r.width*e),i.height=Math.round(r.height*e);let s=i.getContext("2d");if(!s){URL.revokeObjectURL(n),T("图片读取失败,请换一张重试"