PageSourceSearch

https://www.sleepytofu.com/build/assets/LandingPageBuySection-Chn5uXtz.js

js sleepytofu.com collected 2026-10-05 05:36:27 UTC 17,157 bytes, 1 lines download raw bytes

1import{w as z,z as R,l as a,F as l,H as c,at as N,aG as G,u as g,G as I,a5 as k,W as S,a as E,r as j,v as ie,av as ne,B as w,q as J,C as P,az as K,I as D,c as F,aw as re,p as V,J as le,f as M}from"./vue-core-C5VUGm2Y.js";import ce from"./index-Bv1InX2N.js";import{u as O}from"./preferences-BAg8nEPp.js";import{u as B}from"./index-DjMJOJu1.js";import{I as H}from"./iconify-vr12QgaG.js";import{_ as se}from"./ToolTipContenor-Bkk91JOe.js";import{u as de}from"./useColorIndependent-B_xirw6v.js";import{_ as T}from"./Skeleton-wtuIJ17e.js";import{_ as ue}from"./LocaleConvert-mHWOjoV9.js";import{_ as pe}from"./FabricMagnifier-B9FWexO_.js";import{f as fe}from"./storefront-runtime-vjSfmdTh.js";import"./Header.astro_astro_type_script_index_0_lang-BmfGHoF_.js";import"./pinia-C5jaGgAf.js";import"./index-yIE3eTjb.js";import"./TooltipTrigger-BK7a5QFn.js";import"./PopperContent-CCPtzC2j.js";import"./radix-ui-DmNDyQqc.js";import"./utils-BQHNewu7.js";import"./defu-BshOeUjT.js";function me(i){var x;return((x=i.productInfo)==null?void 0:x.itemList.length)>0}function U(i){return me(i)?JSON.parse(JSON.stringify(i.productInfo.itemList.find(x=>x.itemId==i.defaultItem)??i.productInfo.itemList[0])):{}}function L(i,x){var r;return(r=i.productInfo.productSpecificationList.find(s=>
1s.productSpecificationId==x))==null?void 0:r.productSpecificationName}(function(x){window.youtubePlayerInstances=window.youtubePlayerInstances||new Map;function r(){document.querySelectorAll("[data-media-video]").forEach(t=>{if(t.dataset.processed)return;const d=t;d.dataset.processed="true";const m=()=>{d.classList.add("opacity-100");const b=d.closest("[data-media-bg]");b&&b.querySelectorAll("[data-media-image]").forEach(p=>{p.classList.add("opacity-0")}),d.removeEventListener("loadedmetadata",m)},u=()=>{console.error("ビデオの読み込みに失敗しました"),d.removeEventListener("error",u)};d.addEventListener("loadedmetadata",m),d.addEventListener("error",u)})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r):r(),document.addEventListener("astro:page-load",r,{once:!0})})();const be={"data-astro-cid-xdyjnovp":""},ve=["value"],xe={__name:"ProductSelector",props:{currentProductId:{type:Number,default:26},productReload:{type:Boolean,default:!1}},emits:["changeFormSpecification","update:currentProductId"],setup(i,{emit:x}){const r=i,s=O(),t=[{id:26,name:"160cm 一字型"},{id:27,name:"180cm 一字型"},{id:28,name:"200cm 一字型"},{id:29,name:"225cm 一字型"},{id:30,name:"230cm 一字型"},{id:31,name:"225cm 躺椅L型"},{id:32,name:"240cm 躺椅L型"},{id:33,name:"260cm 躺椅L型"},{id:34,name:"280cm 躺椅L型"}],d=x,m=B(r,"currentProductId",d),u=j();async function b(){s.processing=!0,await ce.get("/api/product/"+r.currentProductId).then(e=>{e.data.statusCode==="0000"?(s.setPropsData({productInfo:e.data.data}),d("changeFormSpecification",U({productInfo:e.data.data}).specificationList.reduce((p,v)=>(p[L({productInfo:e.data.data},v.productSpecificationId)]=v.specificationId,p),{}))):(s.showMessage({toast:!0,icon:"error",message:e.data.description+"錯誤碼:"+e.data.statusCode,timer:3e3,showConfirmButton:!1}),s.setPropsData(null))}).catch(e=>{s.showMessage({toast:!0,icon:"error",message:"Error fetching product data,"+e,timer:3e3,showConfirmButton:!1}),console.error("Error fetching product data:",e)}).finally(()=>{s.processing=!1,console.log("finally...")})}return z(()=>r.currentProductId,(e,p)=>{e!==p&&b()},{immediate:!0}),R(()=>{window.addEventListener("pageshow",e=>{var p;(e.persisted||((p=performance.getEntriesByType("navigation")[0])==null?void 0:p.type)==="back_forward")&&(console.info("使用者是從瀏覽器歷史紀錄回來,清空選項"),m.value=r.currentProductId,u.value=r.currentProductId)})}),(e,p)=>(a(),l("section",be,[p[1]||(p[1]=c("label",{for:"選擇產品",class:"mb-1 block flex-none text-sm xl:mb-3 xl:w-auto xl:text-xl","data-astro-cid-xdyjnovp":""},"選擇產品",-1)),N(c("select",{id:"選擇產品","onUpdate:modelValue":p[0]||(p[0]=v=>E(m)?m.value=v:null),autocomplete:"off",ref:"selectedProdictId",class:"appearance-none w-full p-2 pr-10 text-sm bg-white bg-[url('https://static.sleepytofu.com/images/common/icon-arrow-select.svg')] bg-no-repeat bg-[right_0.5rem_center] bg-[length:1rem] border border-gray-300 rounded-lg cursor-pointer xl:p-4 xl:pr-12 xl:text-base xl:bg-[right_0.5rem_center] xl:bg-[length:1.25rem]"},[(a(),l(I,null,k(t,v=>c("option",{key:`item-${v.id}`,value:v.id},S(v.name),9,ve)),64))],512),[[G,g(m)]])]))}},ge={"data-astro-cid-xdyjnovp":""},ye=["for"],he=["id"],_e=["value"],Ie={__name:"PSelect",props:{modelValue:Number|String,label:String,validOptions:{type:Array,required:!1},enableSpecifications:{Type:Array,required:!0},options:{type:Object,default:()=>[{label:"Option 1",value:1},{label:"Option 2",value:2},{label:"Option 3",value:3},{label:"Option 4",value:4},{label:"Option 5",value:5}]}},emits:["update:modelValue"],setup(i,{emit:x}){O();const r=i,t=B(r,"modelValue",x,{passive:!0});return(d,m)=>(a(),l("section",ge,[c("label",{for:`${i.label}`,class:"mb-1 block flex-none text-sm xl:mb-3 xl:w-auto xl:text-xl","data-astro-cid-xdyjnovp":""},S(i.label),9,ye),N(c("select",{id:`${i.label}`,"onUpdate:modelValue":m[0]||(m[0]=u=>E(t)?t.value=u:null),class:"appearance-none w-full p-2 pr-10 text-sm bg-white bg-[url('https://static.sleepytofu.com/images/common/icon-arrow-select.svg')] bg-no-repeat bg-[right_0.5rem_center] bg-[length:1rem] border border-gray-300 rounded-lg cursor-pointer xl:p-4 xl:pr-12 xl:text-base xl:bg-[right_0.5rem_center] xl:bg-[length:1.25rem]"},[(a(!0),l(I,null,k(r.options.data,u=>(a(),l("option",{key:`item-${u.value}`,value:u.value},S(u.label),9,_e))),128))],8,he),[[G,g(t)]])]))}},we={"data-astro-cid-xdyjnovp":""},Se=["for"],$e={key:1,class:"font-light text-xl"},ke={class:"flex flex-col gap-1 xl:gap-3","data-astro-cid-xdyjnovp":""},Ve={class:"grid grid-cols-[repeat(auto-fill,_minmax(50px,_1fr))] gap-x-2 gap-y-4 pt-2","data-astro-cid-xdyjnovp":""},je={key:0,class:"relative block text-center cursor-pointer"},Le={key:0,class:"bg-white min-w-12 border-1 text-xs p-1 rounded-sm border-skin-fill-accent z-10 absolute text-nowrap -top-7 -right-1 sm:hidden"},Ne=["id","value"],Oe={class:"flex w-10 mx-auto mb-1 overflow-hidden bg-gray-100 rounded-full peer-checked/color:shadow-button-2 aspect-square ring-white peer-checked/color:ring-4 peer-checked/color:outline-1 peer-checked/color:outline-black xl:w-12"},Pe={key:1,class:"block text-center cursor-pointer"},Ee={class:"relative flex w-10 mx-auto mb-1 overflow-hidden bg-gray-100 rounded-full peer-checked/color:shadow-button-2 aspect-square ring-white peer-checked/color:ring-4 xl:w-12 select-none"},Be={class:"absolute inset-0 flex items-center justify-center bg-gray-100 opacity-80"},Ce={__name:"PColorPicker",props:{label:String,validOptions:Array,enableSpecifications:{Type:Array,required:!0},specificationId:String|Number,hideInvalid:{type:Boolean,default:!1},options:{type:Object,default:[{label:"Option 1",colorList:["#237739"],value:1},{label:"Option 2",colorList:["#3a222e","#c000FF"],value:2},{label:"Option 3",colorList:["#DEEEE0","#BCCCCA"],value:3},{label:"Option 4",colorList:["#BBB000"],value:4},{label:"Option 5",colorList:["#BB1777","#777FFF"],value:5}]},modelValue:Number|String},emits:["update:modelValue"],setup(i,{emit:x}){O();const r=i,t=B(r,"modelValue",x),d=()=>r.enableSpecifications,m=u=>{var b;return((b=d())==null?void 0:b.find(e=>e==u))??!1};return(u,b)=>(a(),l("section",we,[i.label?(a(),l("label",{key:0,for:`${i.label}`,class:"mb-1 block flex-none text-sm xl:mb-3 xl:w-auto xl:text-xl","data-astro-cid-xdyjnovp":""},S(i.label),9,Se)):(a(),l("label",$e,[ie(u.$slots,"default")])),c("div",ke,[c("div",Ve,[(a(!0),l(I,null,k(r.options.data,(e,p)=>N((a(),l("div",{key:p},[w(se,{label:e.label},{default:J(()=>[m(e.value)?(a(),l("label",je,[e.value==g(t)?(a(),l("span",Le,S(e.label),1)):P("",!0),N(c("input",{type:"radio",id:`color-${e.value}`,value:e.value,class:"sr-only peer/color hidden","onUpdate:modelValue":b[0]||(b[0]=v=>E(t)?t.value=v:null)},null,8,Ne),[[K,g(t)]]),c("div",Oe,[(a(!0),l(I,null,k(e.colorList,v=>(a(),l("div",{key:v,class:"w-full h-full object-cover",style:D(`background-color: ${v}`)},null,4))),128))])])):i.hideInvalid?P("",!0):(a(),l("label",Pe,[c("div",Ee,[(a(!0),l(I,null,k(e.colorList,v=>(a(),l("div",{key:v,class:"w-full h-full object-cover",style:D(`background-color: ${v}`)},null,4))),128)),c("span",Be,[w(g(H),{icon:"iconoir:cancel",class:"w-10 h-10 rounded-full text-red-800"})])])]))]),_:2},1032,["label"])])),[[ne,!i.hideInvalid||m(e.value)]])),128))])])]))}},Fe={"data-astro-cid-xdyjnovp":""},Me=["for"],Te={class:"flex flex-col gap-1 xl:gap-3","data-astro-cid-xdyjnovp":""},Ue={class:"grid grid-cols-3 gap-1 xl:gap-3","data-astro-cid-dsn46w5v":""},Ae=["for"],qe=["name","id","value"],De={class:"flex items-center justify-center min-h-full px-2 py-2 text-sm text-center bg-white border border-gray-300 rounded-lg cursor-pointer peer-checked/button:border-gray-600 xl:py-4 xl:text-base","data-astro-cid-dsn46w5v":""},ze={key:1,class:"flex items-center justify-center min-h-full px-2 py-2 text-sm text-center bg-white border border-gray-300 xl:py-4 xl:text-base rounded-lg text-skin-disabled","data-astro-cid-dsn46w5v":""},Re={__name:"PButton",props:{label:String,validOptions:Array,enableSpecifications:{Type:Array,required:!0},options:{type:Object,default:[{label:"Option 1",value:1},{label:"Option 2",value:2},{label:"Option 3",value:3},{label:"Option 4",value:4},{label:"Option 5",value:5}]},modelValue:Number|String},emits:["update:modelValue"],setup(i,{emit:x}){O();const r=i,t=B(r,"modelValue",x,{passive:!0}),d=()=>r.enableSpecifications,m=u=>{var b;return((b=d())==null?void 0:b.find(e=>e==u))??!1};return(u,b)=>(a(),l("section",Fe,[c("label",{for:`${i.label}`,class:"mb-1 block flex-none text-sm xl:mb-3 xl:w-auto xl:text-xl","data-astro-cid-xdyjnovp":""},S(i.label),9,Me),c("div",Te,[c("div",Ue,[(a(!0),l(I,null,k(r.options.data,(e,p)=>(a(),l("label",{key:p,class:"relative group",for:`button-${r.options.productSpecificationName}-${e.value}`,"data-astro-cid-dsn46w5v":""},[m(e.value)?(a(),l(I,{key:0},[N(c("input",{type:"radio",name:r.options.productSpecificationName,id:`button-${r.options.productSpecificationName}-${e.value}`,value:e.value,"onUpdate:modelValue":b[0]||(b[0]=v=>E(t)?t.value=v:null),class:"sr-only peer/button hidden","data-astro-cid-dsn46w5v":""},null,8,qe),[[K,g(t)]]),c("div",De,S(e.label),1)],64)):(a(),l("div",ze,S(e.label),1))],8,Ae))),128))])])]))}},Ge={class:"flex flex-col gap-3 md:flex-row md:gap-5","data-astro-cid-xdyjnovp":""},Je={class:"flex aspect-[16/10] flex-1 items-center justify-center md:aspect-auto","data-astro-cid-xdyjnovp":""},Ke={class:"border-lightgray rounded-[20px] border bg-gradient-to-b from-neutral-100/20 to-neutral-300/20 p-4 md:w-[320px] xl:w-[500px] xl:p-8","data-astro-cid-xdyjnovp":""},He={key:0},We={class:"flex flex-col gap-2"}
1,Xe={key:2,class:"my-2 border-t border-neutral-400/20 xl:my-4","data-astro-cid-xdyjnovp":""},Ye={class:"flex justify-end"},Qe={class:"flex flex-col","data-astro-cid-xdyjnovp":""},Ze={"data-astro-cid-xdyjnovp":""},et={class:"text-3xl leading-none xl:text-5xl","data-astro-cid-xdyjnovp":""},tt="https://imagedelivery.net/zNIh-sKcXy87rlPPOMOBdw",_t={__name:"LandingPageBuySection",props:{colorIndependent:{type:Boolean,default:!1}},setup(i){const x={57:{6:"fabric/baltimore-beige",52:"fabric/baltimore-fog",43:"fabric/baltimore-pistachio",51:"fabric/baltimore-pink",390:"fabric/baltimore-woody"},58:{6:"fabric/cowboy-cream",54:"fabric/cowboy-sand",8:"fabric/cowboy-light-grey",55:"fabric/cowboy-silver",9:"fabric/cowboy-camel"},59:{6:"fabric/prj-beige",56:"fabric/prj-toffee",8:"fabric/prj-light-grey",43:"fabric/prj-army"}},r=i,s=O(),t=F({specification:{}}),d=F(U(s.props.data)),m=j([]),u=j(),b=j(""),e=f=>{t.specification=f},p=F({}),v=M(()=>{var f;return((f=s.props.data.productInfo)==null?void 0:f.productSpecificationList)??[]}),{shouldSkip:W,autoSwitchColor:X}=de(v,()=>t.specification),Y=()=>{const f=Object.keys(t.specification);f.forEach(n=>{p[n]=[]}),f.forEach((n,h)=>{s.props.data.productInfo.itemList.forEach(_=>{let o=!0;_.specificationList.forEach(y=>{let $=L(s.props.data,y.productSpecificationId);if(!(r.colorIndependent&&W(n,$))&&$!==n&&t.specification[$]!==y.specificationId){o=!1;return}}),o&&p[n].push(_.specificationList.find(y=>n===L(s.props.data,y.productSpecificationId)).specificationId)})})},C=f=>p[f];function Q(){Y(),r.colorIndependent&&X(p)}const A=f=>["button","color","select"].includes(f);function Z(f){return f.productInfo.itemList.filter(n=>Object.entries(t.specification).every(([h,_])=>{if(_=="")return!0;const o=n.specificationList.find(y=>L(f,y.productSpecificationId)==h);return o&&o.specificationId==_}))}const ee=()=>{fe.capture("landing_cta_clicked",{page:window.location.pathname,product_id:u.value,item_id:d==null?void 0:d.itemId,product_url:b.value}),window.location.href=b.value},q=j("/images/products/tofusofa_slim/product-01-01-01-01-01-01.jpg");z(()=>t.specification,f=>{Q(),m.value=Z(s.props.data),Object.assign(d,m.value[0]),b.value=`/product/${u.value}?item_id=${d.itemId}`,q.value=d.imageList[0]??"/images/products/tofusofa_slim/product-01-01-01-01-01-01.jpg"},{immediate:!1,deep:!0});const te=M(()=>{var h;const f=t.specification.沙發布,n=t.specification.布料顏色;return((h=x[f])==null?void 0:h[n])??null}),oe=M(()=>{var h,_,o,y;const f=t.specification.布料顏色;if(f==null)return"";const n=(_=(h=s.props.data.productInfo)==null?void 0:h.productSpecificationList)==null?void 0:_.find($=>$.productSpecificationName==="布料顏色");return((y=(o=n==null?void 0:n.data)==null?void 0:o.find($=>$.value==f))==null?void 0:y.label)??""}),ae=()=>{const f=U({productInfo:s.props.data.productInfo}).specificationList.reduce((n,h)=>(n[L({productInfo:s.props.data.productInfo},h.productSpecificationId)]=h.specificationId,n),{});t.specification=f};return R(()=>{u.value=26}),(f,n)=>{var _;const h=re("Button");return a(),l("div",Ge,[c("div",Je,[g(s).processing?(a(),V(g(T),{key:0,class:"h-[600px] w-[600px] rounded-sm"})):(a(),V(pe,{key:1,"image-src":q.value,"fabric-image-id":te.value,"color-label":oe.value,"cf-delivery":tt,class:"h-full w-full"},null,8,["image-src","fabric-image-id","color-label"]))]),c("div",Ke,[w(g(xe),{onChangeFormSpecification:e,"current-product-id":u.value,"onUpdate:currentProductId":n[0]||(n[0]=o=>u.value=o)},null,8,["current-product-id"]),n[5]||(n[5]=c("div",{class:"my-2 border-t border-neutral-400/20 xl:my-4","data-astro-cid-xdyjnovp":""},null,-1)),(a(!0),l(I,null,k((_=g(s).props.data.productInfo)==null?void 0:_.productSpecificationList,o=>(a(),l(I,{key:`specification_${o.productSpecificationId}`},[g(s).processing&&A(o.productSpecificationType)?(a(),l("div",He,[c("div",We,[w(g(T),{class:"h-5 w-[50px] rounded-sm"}),w(g(T),{class:"h-12 w-full rounded-sm"})])])):(a(),l(I,{key:1},[o.productSpecificationType==="button"?(a(),V(g(Re),{key:0,modelValue:t.specification[o.productSpecificationName],"onUpdate:modelValue":y=>t.specification[o.productSpecificationName]=y,options:o,"valid-options":m.value,"enable-specifications":C(o.productSpecificationName),label:o.productSpecificationName},null,8,["modelValue","onUpdate:modelValue","options","valid-options","enable-specifications","label"])):o.productSpecificationType==="color"?(a(),V(g(Ce),{key:1,modelValue:t.specification[o.productSpecificationName],"onUpdate:modelValue":y=>t.specification[o.productSpecificationName]=y,options:o,"valid-options":m.value,"enable-specifications":C(o.productSpecificationName),label:o.productSpecificationName,"hide-invalid":i.colorIndependent},null,8,["modelValue","onUpdate:modelValue","options","valid-options","enable-specifications","label","hide-invalid"])):o.productSpecificationType==="select"?(a(),V(g(Ie),{key:2,modelValue:t.specification[o.productSpecificationName],"onUpdate:modelValue":y=>t.specification[o.productSpecificationName]=y,options:o,"valid-options":m.value,"enable-specifications":C(o.productSpecificationName),label:o.productSpecificationName},null,8,["modelValue","onUpdate:modelValue","options","valid-options","enable-specifications","label"])):P("",!0)],64)),A(o.productSpecificationType)?(a(),l("div",Xe)):P("",!0)],64))),128)),c("div",Ye,[w(h,{variant:"outline",onClick:n[1]||(n[1]=o=>ae()),class:"text-skin-accent inline-flex"},{default:J(()=>[w(g(H),{icon:"bx:reset",class:"h-6 w-6"}),n[2]||(n[2]=le("清除重選 ",-1))]),_:1})]),c("div",Qe,[n[4]||(n[4]=c("p",{class:"text-sm xl:text-xl","data-astro-cid-xdyjnovp":""},"價格",-1)),c("p",Ze,[n[3]||(n[3]=c("span",{class:"text-sm leading-none xl:text-xl","data-astro-cid-xdyjnovp":""},"NTD",-1)),c("span",et,[w(ue,{number:d.priceSelling,type:"currency"},null,8,["number"])])])]),c("div",{class:"mt-3 xl:mt-5","data-astro-cid-xdyjnovp":""},[c("button",{onClick:ee,type:"button",class:"w-full cursor-pointer rounded-full bg-gradient-to-r from-neutral-600 to-neutral-700 py-3 text-white shadow-lg hover:from-neutral-800 hover:to-neutral-900 xl:py-4 xl:text-2xl","data-astro-cid-xdyjnovp":""}," 放入購物車 ")])])])}}};export{_t as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.