{h.current=l},[l]);let g=(0,a.useRef)(o);(0,a.useEffect)(()=>{g.current=o},[o]);let[b,v]=(0,a.useState)(!1),[y,w]=(0,a.useState)(!1),{props:S,meta:_}=(0,c.getImgProps)(e,{defaultLoader:p.default,imgConf:i,blurComplete:b,showAltText:y});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(x,{...S,unoptimized:_.unoptimized,placeholder:_.placeholder,fill:_.fill,onLoadRef:h,onLoadingCompleteRef:g,setBlurComplete:v,setShowAltText:w,sizesInput:e.sizes,ref:t}),_.preload?(0,s.jsx)(j,{isAppRouter:!n,imgAttributes:S}):null]})});("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},94909,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={default:function(){return d},getImageProps:function(){return c}};for(var i in r)Object.defineProperty(n,i,{enumerable:!0,get:r[i]});let s=e.r(55682),a=e.r(8927),l=e.r(5500),o=s._(e.r(1948));function c(e){let{props:t}=(0,a.getImgProps)(e,{defaultLoader:o.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!0}});for(let[e,n]of Object.entries(t))void 0===n&&delete t[e];return{props:t}}let d=l.Image},57688,(e,t,n)=>{t.exports=e.r(94909)},8429,e=>{"use strict";async function t(e){if(e instanceof Blob)return e;let t=await fetch(e);if(!t.ok)throw Error("鍥剧墖璇诲彇澶辫触");return t.blob()}function n(e,t){let n=URL.createObjectURL(e),r=document.createElement("div");r.setAttribute("role","dialog"),r.setAttribute("aria-label","淇濆瓨鍥剧墖"),Object.assign(r.style,{position:"fixed",inset:"0",zIndex:"99999",background:"rgba(16,16,14,.94)",display:"flex",flexDirection:"column",alignItems:"center",padding:"max(18px,env(safe-area-inset-top)) 16px max(18px,env(safe-area-inset-bottom))",overflow:"auto",color:"#fff",WebkitOverflowScrolling:"touch"});let i=document.createElement("div");Object.assign(i.style,{width:"min(100%,720px)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",marginBottom:"12px"});let s=document.createElement("div");s.innerHTML='闀挎寜涓嬫柟鍥剧墖淇濆瓨鍒版墜鏈?iPhone 閫夋嫨鈥滃瓨鍌ㄥ埌鐓х墖鈥濓紱寰俊鍐呰闀挎寜鍥剧墖锛屾垨鐐瑰彸涓婅鍦ㄦ祻瑙堝櫒鎵撳紑
';let a=document.createElement("button");a.textContent="鍏抽棴",Object.assign(a.style,{border:"0",borderRadius:"999px",padding:"10px 16px",fontWeight:"700",background:"#d7ff39",color:"#151511"}),i.append(s,a);let l=document.createElement("img");l.src=n,l.alt=t,Object.assign(l.style,{display:"block",width:"min(100%,720px)",height:"auto",maxHeight:"calc(100vh - 150px)",objectFit:"contain",background:"#fff",borderRadius:"14px",WebkitTouchCallout:"default",userSelect:"auto"});let o=document.createElement("div");o.textContent=t,Object.assign(o.style,{fontSize:"12px",opacity:".6",marginTop:"10px",wordBreak:"break-all"});let c=()=>{r.remove(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3)};return a.onclick=c,r.onclick=e=>{e.target===r&&c()},r.append(i,l,o),document.body.appendChild(r),"preview"}async function r(e,r){let i=await t(e),s=r.toLowerCase().endsWith(".png")?r:r+".png",a=new File([i],s,{type:i.type||"image/png"}),l=navigator.userAgent.toLowerCase();if((/iphone|ipad|ipod|android|mobile/.test(l)||navigator.maxTouchPoints>1&&window.innerWidth<1024)&&"function"==typeof navigator.share)try{if(!navigator.canShare||navigator.canShare({files:[a]}))return await navigator.share({files:[a],title:"淇濆瓨鍥剧墖"}),"shared"}catch(e){return e instanceof DOMException&&"AbortError"===e.name||console.warn("绯荤粺鍒嗕韩涓嶅彲鐢紝宸插垏鎹㈠埌鍥剧墖棰勮淇濆瓨",e),n(i,s)}if(/micromessenger|weibo|qq\/|iphone|ipad|ipod/.test(l))return n(i,s);let o=URL.createObjectURL(i),c=document.createElement("a");return c.href=o,c.download=s,c.rel="noopener",c.style.display="none",document.body.appendChild(c),c.click(),c.remove(),window.setTimeout(()=>URL.revokeObjectURL(o),3e4),"downloaded"}e.s(["saveImageOnDevice",0,r])},31017,e=>{"use strict";var t=e.i(43476),n=e.i(57688),r=e.i(22016),i=e.i(8429),s=e.i(71645);let 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:["浜斿畼鏇存竻妤?","淇濈暀琛f湇缁嗚妭","淇濈暀鍙戝瀷","淇濈暀閰嶉グ","鍖呭惈瀹犵墿","绾壊鑳屾櫙"]},{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("鍥剧墖璇诲彇澶辫触锛岃鎹竴寮犻噸璇?");return}s.drawImage(r,0,0,i.width,i.height),URL.revokeObjectURL(n);let a=i.toDataURL("image/jpeg","source"===t?.88:.82);"source"===t?_(a):O(a),E(null),N(!0),T("")},r.onerror=()=>{URL.revokeObjectURL(n),T("鍥剧墖璇诲彇澶辫触锛岃鎹竴寮犻噸璇?")},r.src=n}async function J(){if(!S||!M||k||G){M||F(!0);return}I(!0),T(""),E(null);try{let t=await fetch("/api/chibi/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:M.code,image:S,referenceImage:C,category:e.id,subtype:u.id,gridSize:p,colorCount:m,composition:b,detailTags:j,customPrompt:y.trim()})}),n=await t.json();if(!t.ok||!n.image||!n.access)throw Error(n.error||"鐢熸垚澶辫触锛岃绋嶅悗閲嶈瘯");E(n.image),N(!1),U(n.access),n.downloadGrant&&(sessionStorage.setItem("perler-ai-download-grant",n.downloadGrant),sessionStorage.setItem("perler-ai-download-code",n.access.code))}catch(e){T(e instanceof Error?e.message:"鐢熸垚澶辫触锛岃绋嶅悗閲嶈瘯")}finally{I(!1)}}async function Q(){if(R)try{await (0,i.saveImageOnDevice)(R,`${e.name}-${u.name}-${p}鏍?-鐢熸垚鍥?.png`),N(!0)}catch(e){T(e instanceof Error?e.message:"鍥剧墖淇濆瓨澶辫触锛岃閲嶈瘯")}}function Y(e){G&&(e.preventDefault(),document.querySelector(".saveGuard")?.scrollIntoView({behavior:"smooth",block:"center"}))}return(0,s.useEffect)(()=>{let e=localStorage.getItem("perler-download-code");e&&H(e,!0)},[]),(0,s.useEffect)(()=>{let e=e=>{G&&(e.preventDefault(),e.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[G]),(0,s.useEffect)(()=>{if(!R)return;let e=window.setTimeout(()=>q.current?.scrollIntoView({behavior:"smooth",block:"start"}),120);return()=>window.clearTimeout(e)},[R]),(0,t.jsxs)("main",{className:"chibiPage beadChibiPage",children:[(0,t.jsxs)("nav",{className:"nav",children:[(0,t.jsxs)(r.default,{onClick:Y,className:"brand brandLink",href:"/",children:[(0,t.jsx)("span",{className:"brandMark",children:"P"}),(0,t.jsxs)("span",{children:["PERLER ",(0,t.jsx)("b",{children:"LAB"})]})]}),(0,t.jsxs)("div",{className:"navLinks",children:[(0,t.jsx)(r.default,{onClick:Y,href:"/",children:"鍥剧墖杞嫾璞?"}),(0,t.jsxs)(r.default,{className:"active",href:"/chibi",children:["AI鎷艰眴涓撳尯 ",(0,t.jsx)("span",{children:"PRO"})]})]}),(0,t.jsxs)("div",{className:"chibiNavActions",children:[(0,t.jsx)(r.default,{onClick:Y,className:`mobileBackLink ${G?"needsSave":""}`,href:"/",children:G?"鍏堜繚瀛樺浘鐗?":"鈫? 鏅?氭嫾璞?"}),(0,t.jsxs)("div",{className:"navRight",children:[(0,t.jsx)("span",{className:"liveDot"})," 姣忔鐢熸垚娑堣?? 1 娆℃潈鐩?"]})]})]}),(0,t.jsxs)("section",{className:"beadHero",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"eyebrow",children:"IMAGE TO PERLER"}),(0,t.jsxs)("h1",{children:["鍏堥?夊ぇ绫伙紝鍐嶅畾缁嗚妭锛?",(0,t.jsx)("br",{}),(0,t.jsx)("em",{children:"鐢熸垚缁撴灉鍏堜繚瀛樸??"})]})]}),(0,t.jsx)("p",{children:"姣忔 AI 鎴愬姛鐢熸垚鎵? 1 娆★紱璇ヤ綔鍝佽浆鎴愭寮忔嫾璞嗗浘绾稿苟棣栨涓嬭浇鍏嶈垂銆傚彧鏈夐噸鏂扮敓鎴愭柊浣滃搧鎵嶅啀娆℃墸璐广??"})]}),G&&(0,t.jsxs)("div",{className:"saveGuard",children:[(0,t.jsx)("strong",{children:"鈿? 褰撳墠鐢熸垚鍥剧墖灏氭湭淇濆瓨"}),(0,t.jsx)("span",{children:"鍒嗙被銆侀鏍笺?佸弬鏁板拰涓婁紶鎸夐挳宸查攣瀹氥?傝鍏堝埌涓嬫柟鐐瑰嚮鈥滀繚瀛樺浘鐗囧苟瑙i攣鈥濄??"})]}),(0,t.jsxs)("section",{className:`beadBuilder ${G?"settingsLocked":""}`,children:[(0,t.jsxs)("div",{className:"beadConfig panel",children:[(0,t.jsxs)("div",{className:"configHead",children:[(0,t.jsx)("span",{children:"01"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("b",{children:"閫夋嫨鎷艰眴澶х被"}),(0,t.jsx)("small",{children:"鍏堥?夌敤閫旓紝鍐嶉?夋嫨鏇村叿浣撶殑鎴愬搧鏂瑰悜"})]})]}),(0,t.jsx)("div",{className:"categoryTabs",children:a.map(n=>(0,t.jsxs)("button",{disabled:G,className:e.id===n.id?"selected":"",onClick:()=>{!G&&(d(n),f(n.subtypes[0]),v(n.tags.slice(0,3)),E(null))},children:[(0,t.jsx)("span",{children:n.name}),(0,t.jsx)("small",{children:n.note})]},n.id))}),(0,t.jsxs)("div",{className:"categoryShowcase",children:[e.beforeImage?(0,t.jsxs)("div",{className:"categoryCompare",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(n.default,{src:e.beforeImage,alt:`${e.name}鍘熷浘`,fill:!0,sizes:"(max-width:720px) 42vw, 360px"}),(0,t.jsx)("span",{children:"鍘熷浘"})]}),(0,t.jsx)("b",{children:"鈫?"}),(0,t.jsxs)("div",{children:[(0,t.jsx)(n.default,{src:e.image,alt:`${e.name}鍍忕礌鎷艰眴鏁堟灉`,fill:!0,sizes:"(max-width:720px) 42vw, 360px"}),(0,t.jsx)("span",{children:"鍍忕礌鎷艰眴"})]})]}):(0,t.jsxs)("div",{className:"categorySingle",children:[(0,t.jsx)(n.default,{src:e.image,alt:`${e.name}鍍忕礌鎷艰眴绀轰緥`,fill:!0,sizes:"(max-width:720px) 90vw, 720px"}),(0,t.jsx)("span",{children:"鍍忕礌鎷艰眴绀轰緥"})]}),(0,t.jsxs)("section",{children:[(0,t.jsxs)("b",{children:[e.name," 路 榛樿鍍忕礌鎷艰眴椋?"]}),(0,t.jsx)("small",{children:e.beforeImage?"鐪熷疄鍘熷浘涓庤浆鎹㈠悗鏁堟灉瀵规瘮":"閫夋嫨涓?涓粏鍒嗙被鍒?"}),(0,t.jsx)("div",{children:e.subtypes.map(e=>(0,t.jsxs)("button",{disabled:G,className:u.id===e.id?"active":"",onClick:()=>{f(e),E(null)},children:[(0,t.jsx)("b",{children:e.name}),(0,t.jsx)("span",{children:e.note})]},e.id))})]})]}),(0,t.jsxs)("div",{className:"configSection",children:[(0,t.jsxs)("div",{className:"configLabel",children:[(0,t.jsx)("b",{children:"鍥剧焊鏍兼暟"}),(0,t.jsxs)("span",{children:[p," 脳 ",p]})]}),(0,t.jsx)("p",{children:"鏍兼暟瓒婂ぇ缁嗚妭瓒婃竻妤氾紝瀹為檯鍒朵綔鏃堕棿涔熸洿闀裤??"}),(0,t.jsx)("div",{className:"optionRow four",children:l.map(e=>(0,t.jsxs)("button",{disabled:G,className:p===e?"active":"",onClick:()=>{h(e),E(null)},children:[e,(0,t.jsx)("small",{children:48===e?"绠?鍗?":64===e?"鎺ㄨ崘":80===e?"绮剧粏":"楂樻竻"})]},e))})]}),(0,t.jsxs)("div",{className:"configSection",children:[(0,t.jsxs)("div",{className:"configLabel",children:[(0,t.jsx)("b",{children:"鏈?澶ч鑹叉暟"}),(0,t.jsxs)("span",{children:[m," 鑹?"]})]}),(0,t.jsx)("p",{children:"棰滆壊瓒婂杩樺師搴﹁秺楂橈紱棰滆壊瓒婂皯锛屽璞嗘洿绠?鍗曘??"}),(0,t.jsx)("div",{className:"optionRow four",children:o.map(e=>(0,t.jsxs)("button",{disabled:G,className:m===e?"active":"",onClick:()=>{g(e),E(null)},children:[e,(0,t.jsx)("small",{children:16===e?"鐪佽眴":24===e?"鍧囪 ":32===e?"缁嗚吇":"楂樿繕鍘?"})]},e))})]}),(0,t.jsxs)("div",{className:"configSection",children:[(0,t.jsxs)("div",{className:"configLabel",children:[(0,t.jsx)("b",{children:"涓讳綋鏋勫浘"}),(0,t.jsx)("span",{children:b})]}),(0,t.jsx)("div",{className:"optionRow three",children:c.map(e=>(0,t.jsx)("button",{disabled:G,className:b===e?"active":"",onClick:()=>{x(e),E(null)},children:e},e))})]}),(0,t.jsxs)("div",{className:"configSection",children:[(0,t.jsxs)("div",{className:"configLabel",children:[(0,t.jsx)("b",{children:"缁嗚妭鎻愮ず璇?"}),(0,t.jsx)("span",{children:"鏈?澶氶?? 5 椤?"})]}),(0,t.jsx)("div",{className:"promptTags",children:e.tags.map(e=>(0,t.jsxs)("button",{disabled:G,className:j.includes(e)?"active":"",onClick:()=>{!G&&(v(t=>t.includes(e)?t.filter(t=>t!==e):t.length<5?[...t,e]:t),E(null))},children:[j.includes(e)?"鉁? ":"+ ",e]},e))}),(0,t.jsx)("textarea",{disabled:G,maxLength:160,value:y,onChange:e=>{w(e.target.value),E(null)},placeholder:"琛ュ厖甯屾湜淇濈暀鐨勯鑹层?佺粏鑺傘?佸Э鍔裤?佽儗鏅?︹??"}),(0,t.jsxs)("small",{className:"promptCount",children:[y.length,"/160"]}),(0,t.jsxs)("div",{className:"referenceUploadRow",children:[(0,t.jsxs)("button",{disabled:G,className:C?"hasReference":"",onClick:()=>X.current?.click(),children:[C?(0,t.jsx)("img",{src:C,alt:"椋庢牸绀轰緥鍥?"}):(0,t.jsx)("strong",{children:"锛?"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("b",{children:C?"宸叉坊鍔犻鏍肩ず渚嬪浘":"涓婁紶椋庢牸绀轰緥鍥撅紙鍙?夛級"}),(0,t.jsx)("small",{children:C?"鍙傝?冪敾椋庛?侀厤鑹插拰鎷艰眴璐ㄦ劅":"涓嶄細鐓ф惉绀轰緥涓讳綋"})]}),C&&(0,t.jsx)("i",{children:"鏇存崲"})]}),C&&(0,t.jsx)("button",{disabled:G,className:"removeReference",onClick:()=>{O(null),E(null)},children:"绉婚櫎"})]}),(0,t.jsx)("input",{ref:X,className:"hiddenFileInput",type:"file",accept:"image/jpeg,image/png,image/webp",onChange:e=>K(e.target.files?.[0],"reference")})]})]}),(0,t.jsxs)("aside",{className:"beadPreview panel",children:[(0,t.jsxs)("div",{className:"previewTitle",children:[(0,t.jsx)("span",{children:"02"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("b",{children:"鐢熸垚鍓嶇‘璁?"}),(0,t.jsxs)("small",{children:[e.name," 路 ",u.name]})]})]}),(0,t.jsxs)("div",{className:"selectedSample",children:[(0,t.jsx)(n.default,{src:e.image,alt:`${e.name}绀轰緥`,fill:!0,sizes:"(max-width:720px) 90vw, 420px"}),(0,t.jsx)("span",{children:"榛樿鍍忕礌鏁堟灉"})]}),(0,t.jsxs)("div",{className:"specSummary",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{children:"绫诲埆"}),(0,t.jsx)("b",{children:e.name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{children:"缁嗗垎"}),(0,t.jsx)("b",{children:u.name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{children:"鍥剧焊"}),(0,t.jsxs)("b",{children:[p,"脳",p]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{children:"棰勮"}),(0,t.jsxs)("b",{children:["绾? ",V," 棰?"]})]})]}),(0,t.jsxs)("button",{disabled:G,className:`portraitMini ${S?"hasImage":""}`,onClick:()=>W.current?.click(),children:[S?(0,t.jsx)("img",{src:S,alt:"宸蹭笂浼犲師鍥?"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{children:"锛?"}),(0,t.jsx)("b",{children:"涓婁紶闇?瑕佽浆鎹㈢殑鍘熷浘"}),(0,t.jsx)("small",{children:"涓讳綋娓呮銆佸厜绾胯嚜鐒舵晥鏋滄洿濂?"})]}),S&&(0,t.jsx)("i",{children:"鐐瑰嚮鏇存崲"})]}),(0,t.jsx)("input",{ref:W,className:"hiddenFileInput",type:"file",accept:"image/jpeg,image/png,image/webp",onChange:e=>K(e.target.files?.[0],"source")}),(0,t.jsxs)("div",{className:"paidGenerateNote",children:[(0,t.jsx)("b",{children:M?`鍓╀綑 ${M.remainingUses} 娆$敓鎴愭潈鐩奰:"AI 鐢熸垚灞炰簬浠樿垂鍔熻兘"}),(0,t.jsx)("span",{children:"鎴愬姛鐢熸垚鎵? 1 娆★紱鏈綔鍝佽浆鍥剧焊鍜岄娆′笅杞藉厤璐癸紝澶辫触涓嶆墸銆?"})]}),(0,t.jsx)("button",{className:"generateBeadPreview",disabled:!S||k||G,onClick:J,children:k?"姝e湪鐢熸垚锛岃鍕跨寮?椤甸潰鈥?":M?S?"娑堣?? 1 娆★紝寮?濮嬬敓鎴? 鈫?":"璇峰厛涓婁紶鍘熷浘":"鍏戞崲鍚庣敓鎴? 鈫?"}),L&&(0,t.jsx)("p",{className:"chibiError",children:L})]})]}),R&&(0,t.jsxs)("section",{ref:q,className:`beadResult panel ${!P?"unsaved":"saved"}`,children:[(0,t.jsxs)("div",{className:"resultImage",children:[(0,t.jsx)("img",{src:R,alt:"AI鐢熸垚鐨勬嫾璞嗛瑙?"}),(0,t.jsx)("span",{children:P?"宸蹭繚瀛?":"寰呬繚瀛?"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"resultEyebrow",children:"YOUR PERLER RESULT"}),(0,t.jsx)("h2",{children:P?"鍥剧墖宸蹭繚瀛橈紝鍙互缁х画鎿嶄綔":"鍏堜繚瀛橈紝鍐嶅垏鎹换浣曡缃?"}),(0,t.jsx)("p",{children:P?"鐜板湪鍙互杞崲鎴愭寮忓浘绾革紝鎴栧洖鍒颁笂鏂规洿鎹㈠垎绫诲拰鍙傛暟銆?":"娴忚鍣ㄤ笉浼氶暱鏈熶繚瀛樼敓鎴愮粨鏋溿?備负閬垮厤鍥剧墖涓㈠け锛屽垎绫汇?佸弬鏁板拰瀵艰埅宸茬粡閿佸畾銆?"}),(0,t.jsxs)("div",{className:"resultSpecs",children:[(0,t.jsx)("span",{children:e.name}),(0,t.jsx)("span",{children:u.name}),(0,t.jsxs)("span",{children:[p,"脳",p]}),(0,t.jsxs)("span",{children:[m," 鑹?"]})]}),P?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{onClick:function(){if(R&&P)try{sessionStorage.setItem("perler-chibi-image",R),sessionStorage.setItem("perler-chibi-name",`${e.name}-${u.name}-${p}鏍糮),sessionStorage.setItem("perler-chibi-size",String(p)),sessionStorage.setItem("perler-chibi-colors",String(m)),location.href="/"}catch{T("鍥剧墖鏆傛椂鏃犳硶浼犲埌鎷艰眴鍖猴紝璇峰厛涓嬭浇鍚庡啀涓婁紶")}},children:"杞崲鎴愭寮忔嫾璞嗗浘绾? 鈫?"}),(0,t.jsx)("button",{className:"retryButton",onClick:()=>{E(null),N(!0)},children:"缁х画璋冩暣璁剧疆"})]}):(0,t.jsx)("button",{className:"saveResultButton",onClick:Q,children:"鈫? 淇濆瓨鍥剧墖骞惰В閿佽皟鏁?"})]})]}),R&&(0,t.jsx)("button",{className:"mobileResultJump",onClick:()=>q.current?.scrollIntoView({behavior:"smooth",block:"start"}),children:"鏌ョ湅鐢熸垚鏁堟灉 鈫?"}),(0,t.jsxs)("section",{className:"beadPromise",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("b",{children:"鍒嗙被鏇村噯纭?"}),(0,t.jsx)("span",{children:"涓嶅悓涓讳綋浣跨敤涓嶅悓鎻愮ず璇嶏紝椋庢櫙銆佸疇鐗╁拰椋熺墿涓嶅啀濂楃敤浜虹墿瑙勫垯銆?"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("b",{children:"鐢熸垚鎸夋璁¤垂"}),(0,t.jsx)("span",{children:"姣忔鎴愬姛鐢熸垚鎵? 1 娆℃潈鐩婏紝澶辫触涓嶆墸锛岄伩鍏嶆棤闄愭秷鑰楁ā鍨嬭垂鐢ㄣ??"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("b",{children:"缁撴灉闃蹭涪澶?"}),(0,t.jsx)("span",{children:"鏈繚瀛樻椂閿佷綇鎵?鏈夊垏鎹㈡搷浣滐紝骞跺湪鍏抽棴椤甸潰鍓嶅啀娆℃彁閱掋??"})]})]}),(0,t.jsxs)("footer",{children:[(0,t.jsx)("span",{children:"PERLER LAB 路 AI 鎷艰眴涓撳尯"}),(0,t.jsx)(r.default,{onClick:Y,href:"/",children:"杩斿洖鍥剧墖杞嫾璞? 鈫?"})]}),B&&(0,t.jsx)("div",{className:"generationUnlockOverlay",children:(0,t.jsxs)("section",{children:[(0,t.jsx)("button",{onClick:()=>F(!1),children:"脳"}),(0,t.jsx)("span",{className:"eyebrow",children:"GENERATION ACCESS"}),(0,t.jsx)("h2",{children:"鍏戞崲鍚庢墠鑳界敓鎴?"}),(0,t.jsx)("p",{children:"姣忔垚鍔熺敓鎴? 1 寮犲浘鐗囨秷鑰? 1 娆′娇鐢ㄦ潈鐩婏紱鐢熸垚澶辫触涓嶆墸娆℃暟銆?"}),(0,t.jsx)("input",{value:$,onChange:e=>z(e.target.value.toUpperCase()),placeholder:"杈撳叆鍏戞崲鐮侊紝渚嬪 PB-XXXXX-XXXXX"}),(0,t.jsx)("button",{className:"unlockSubmit",disabled:!$.trim(),onClick:()=>void H($),children:"绔嬪嵆鍏戞崲"}),A&&(0,t.jsx)("small",{children:A}),(0,t.jsx)(r.default,{href:"/",children:"娌℃湁鍏戞崲鐮侊紵杩斿洖棣栭〉璐拱濂楅"})]})})]})}])}]);