PageSourceSearch

https://hsl.co.in/build/assets/Product-OxLXecg-.js

js hsl.co.in collected 2026-10-09 22:41:15 UTC 19,691 bytes, 2 lines download raw bytes

1import{r as l,a as P,j as e,R as fe,x as u}from"./app-Mnt2IEGe.js";import{G as be}from"./GuestLayout-BYnLiqFZ.js";import{C as ye}from"./chevron-left-1rvZdUz9.js";import{C as je}from"./chevron-right-D8Tdk6TR.js";import{S as Ne}from"./sparkles-B-FGkB_u.js";import{S as ve}from"./share-2-D7zohvkM.js";import{S as ee}from"./star-C1jGBhfp.js";import{S as we}from"./shopping-bag-Cwpa8ssJ.js";import{S as Se}from"./shield-check-BX5jY0rg.js";import"./ApplicationLogo-JvKRx6b1.js";import"./x-B1Pn9Kmg.js";import"./message-circle-D4MbkUVn.js";import"./phone-DSAsYLtt.js";import"./chevron-down-BlAiga6f.js";import"./user-ad0RTXxq.js";import"./package-CT4joqbC.js";import"./map-pin-BuVEKMGp.js";import"./truck-CpGakV_6.js";import"./shopping-cart-DokKNEt4.js";import"./search-BeXkNHdv.js";import"./clock-Dnho5FNh.js";import"./shield-Da3uiB5y.js";import"./mail-Ce-sk81h.js";const h=t=>`₹${Number(t||0).toFixed(2)}`;function He({product:t,related:y=[],breadcrumbs:j=[]}){var J,X,Y;const[w,E]=l.useState(1),[S,_e]=l.useState({}),[_,I]=l.useState(!1),[R,q]=l.useState(!1),[O,f]=l.useState(""),[F,L]=l.useState(0),[T,se]=l.useState("detail"),[U,V]=l.useState(!1),m=Array.isArray(t.variants)?t.variants:[],C=l.useMemo(()=>Array.isArray(t.customization_fields)?t.customization_fields:[],[t.customization_fields]),o=l.useMemo(()=>{const s=new Set;return m.forEach(a=>Object.keys(a.options||{}).forEach(r=>s.add(r))),Array.from(s)},[m]),te=l.useMemo(()=>{const s={};return o.forEach(a=>s[a]=[]),m.forEach(a=>{o.forEach(r=>{const n=(a.options||{})[r];n&&!s[r].includes(n)&&s[r].push(n)})}),s},[m,o]),[k,D]=l.useState({}),i=l.useMemo(()=>o.length===0?null:m.find(s=>o.every(a=>(s.options||{})[a]===k[a]))||null,[m,k,o]),ae=l.useMemo(()=>{const s=Number(t.price??0),a=i&&i.price_override!==null?Number(i.price_override):null,r=a!==null&&!Number.isNaN(a)?a:s,n=t.compare_at_price??t.mrp??null,d=i&&i.compare_at_price!==null?Number(i.compare_at_price):null,g=d!==null&&!Number.isNaN(d)?d:n!=null?Number(n):null,x=g!==null&&!Number.isNaN(g)?g:null,Z=typeof x=="number"&&x>r,ge=Z?Math.round((x-r)/x*100):0;return{salePrice:r,comparePrice:x,showCompare:Z,discount:ge}},[t.price,t.compare_at_price,t.mrp,i]),c=l.useMemo(()=>{const s=Array.isArray(t.images)?t.images:[],a=[],r=new Set;return t.primary_image&&(a.push({path:t.primary_image,id:"primary"}),r.add(t.primary_image)),s.forEach(n=>{n.path&&!r.has(n.path)&&(a.push(n),r.add(n.path))}),a},[t.images,t.primary_image]),[N,K]=l.useState(t.primary_image||((X=(J=t.images)==null?void 0:J[0])==null?void 0:X.path)||"/img/haslab-logo.png"),v=l.useMemo(()=>Array.isArray(y)&&y.length?y:Array.isArray(t.related_products)&&t.related_products.length?t.related_products:Array.isArray(t.related)&&t.related.length?t.related:[],[y,t.related_products,t.related]),Q=l.useMemo(()=>Array.isArray(j)&&j.length?j:[{label:"Home",url:"/"},{label:"Shop",url:route("shop.index")},{label:(t==null?void 0:t.name)||"Product",url:null}],[j,t==null?void 0:t.name]);l.useEffect(()=>{(async()=>{try{const{data:s}=await P.get("/cart/items"),a=(s||[]).find(r=>r.product_id===t.id);a&&L(a.quantity)}catch{}})();try{if(typeof window<"u"){P.post("/recently-viewed",{product_id:t.id}).catch(()=>{});try{const s=localStorage.getItem("recently_viewed_products")||"[]",r=(JSON.parse(s)||[]).filter(n=>n.id!==t.id);r.unshift({id:t.id,name:t.name,slug:t.slug,primary_image:t.primary_image,price:t.price}),localStorage.setItem("recently_viewed_products",JSON.stringify(r.slice(0,12)))}catch{}}}catch{}},[t.id]),l.useEffect(()=>{if(m.length===1){const a=m[0].options||{};D(a)}},[m]);const A=l.useMemo(()=>!t.is_customizable||C.length===0?[]:C.filter(s=>{if((s==null?void 0:s.required)===!1)return!1;const a=S[s.key];return(s==null?void 0:s.type)==="file"?!a||!a.filename:typeof a=="string"?a.trim()==="":Array.isArray(a)?a.length===0:a==null||a===""}),[t.is_customizable,C,S]),re=async()=>{const s=o.length>0&&!i;if(s||A.length>0){I(!0),A.length>0?f("Please complete the required customization details before adding to cart."):s&&f("Please select a variant option before adding to cart.");return}I(!1),q(!0),f("");try{const a={product_id:t.id,quantity:w,customizations:S},{data:r}=await P.post("/cart/add",{...a,variant_id:(i==null?void 0:i.id)||null});if(f("Added to cart"),typeof window<"u"){const n=(r==null?void 0:r.cart_count)??void 0;window.dispatchEvent(new CustomEvent("cart:updated",{detail:{count:n}}
1))}L(n=>n+w)}catch{f("Failed to add to cart")}finally{q(!1)}},ne=s=>{if(typeof s!="string")return{};const a=s.trim().toLowerCase();if(/^#(?:[0-9a-f]{3}){1,2}$/i.test(a))return{backgroundColor:a};const r={black:"#0f172a",white:"#f8fafc",blue:"#2563eb",green:"#22c55e",red:"#ef4444",yellow:"#facc15",orange:"#fb923c",purple:"#a855f7",pink:"#ec4899",grey:"#94a3b8",gray:"#94a3b8",teal:"#14b8a6",navy:"#1e3a8a"},n=a.split(" ")[0];return r[n]?{backgroundColor:r[n]}:{backgroundColor:"#cbd5f5"}},le=(s,a)=>{D(r=>{const n={...r};return n[s]===a?delete n[s]:n[s]=a,n})},ie=l.useMemo(()=>c.findIndex(s=>s.path===N),[c,N]),W=s=>{if(!c.length)return;const a=((ie+s)%c.length+c.length)%c.length;K(c[a].path)},{salePrice:oe,comparePrice:de,showCompare:ce,discount:B}=ae,p=l.useMemo(()=>{const a=(Array.isArray(t.variants)?t.variants:[]).map(r=>{const d=[r==null?void 0:r.price_override,r==null?void 0:r.price,r==null?void 0:r.mrp].find(x=>x!=null&&x!==""),g=d!==void 0?Number(d):null;return Number.isFinite(g)?g:null}).filter(r=>r!==null);return a.length===0?{min:null,max:null}:{min:Math.min(...a),max:Math.max(...a)}},[t.variants]),$=l.useMemo(()=>{const s=typeof window<"u"?window.location.href:route("shop.product",t.slug);return{title:t.name,text:t.short_description||t.name,url:s}},[t.name,t.short_description,t.slug]),me=Number(t.rating??t.average_rating??4.8),xe=t.sku??t.code??`SKU-${t.id}`,G=t.inventory??t.stock??null,z=G===null?!0:G>0;Number(t.id)%53+48;const he=Array.isArray(t.bullet_points)&&t.bullet_points.length?t.bullet_points:["Any product types you want — simple or configurable variations.","Premium finishing and flatlock seams for lasting impressions."];[{label:"SKU",value:xe},{label:"Category",value:((Y=(t.categories||[])[0])==null?void 0:Y.name)||null},{label:"Availability",value:z?"In stock":"Out of stock"},{label:"Weight",value:t.weight?`${t.weight} g`:null},{label:"Dimensions",value:t.dimensions||null}].filter(s=>s.value);const pe=[{id:"detail",label:"Detail"}],b=o.length>0&&!i,M=t.is_customizable&&A.length>0,H=R||b||M,ue=async()=>{if(typeof navigator<"u"&&navigator.share)try{V(!0),await navigator.share($)}catch(s){console.error("Share failed",s)}finally{V(!1)}else typeof window<"u"&&window.open(`https://api.whatsapp.com/send?text=${encodeURIComponent(`${$.title}
2${$.url}`)}`)};return e.jsx(be,{children:e.jsx("div",{className:"bg-slate-100",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 space-y-12",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-500 rounded-3xl p-4 bg-white shadow",children:[e.jsx("div",{className:"flex items-center gap-2",children:Q.map((s,a)=>e.jsxs(fe.Fragment,{children:[a>0&&e.jsx("span",{children:"»"}),s.url?e.jsx(u,{href:s.url,className:a===Q.length-1?"font-semibold text-slate-700":"hover:text-primary",children:s.label}):e.jsx("span",{className:"font-semibold text-slate-700",children:s.label})]},`${s.label}-${a}`))}),e.jsx(u,{href:route("shop.index"),className:"text-primary hover:underline text-sm",children:"Continue Shopping"})]}),e.jsxs("div",{className:"grid gap-8 lg:grid-cols-[1.2fr_1fr]",children:[e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-6 md:p-10 shadow-sm",children:[e.jsxs("div",{className:"relative overflow-hidden rounded-xl bg-slate-50",children:[e.jsx("div",{className:"aspect-square flex items-center justify-center",children:e.jsx("img",{src:N,alt:t.name,className:"h-full w-full object-contain drop-shadow-md"})}),c.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>W(-1),className:"absolute left-0 top-1/2 -translate-y-1/2 rounded-full bg-white/90 p-2 shadow hover:bg-white",type:"button",children:e.jsx(ye,{size:20,className:"text-slate-600"})}),e.jsx("button",{onClick:()=>W(1),className:"absolute right-0 top-1/2 -translate-y-1/2 rounded-full bg-white/90 p-2 shadow hover:bg-white",type:"button",children:e.jsx(je,{size:20,className:"text-slate-600"})})]})]}),c.length>1&&e.jsx("div",{className:"mt-6 flex gap-3 overflow-x-auto pb-1",style:{maxWidth:"80vw"},children:c.map((s,a)=>{const r=N===s.path;return e.jsx("button",{onClick:()=>K(s.path),className:`relative flex-shrink-0 rounded-2xl border ${r?"border-indigo-500 ring-2 ring-indigo-200":"border-slate-200"}`,style:{height:"80px",width:"80px"},type:"button",children:e.jsx("img",{src:s.path,alt:`${t.name} thumbnail ${a+1}`,className:"h-full w-full rounded-[14px] object-cover"})},s.id||s.path)})})]}),e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-6 md:p-8 shadow-sm space-y-6",style:{overflow:"auto",height:"100vh"},children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full bg-indigo-50 px-3 py-1 text-xs font-semibold text-primary",children:[e.jsx(Ne,{size:14})," Premium Pick"]}),e.jsxs("button",{type:"button",onClick:ue,className:"inline-flex items-center gap-2 rounded-full border border-slate-200 px-3 py-1 text-xs font-semibold text-slate-600 hover:border-indigo-300 hover:text-primary",disabled:U,children:[e.jsx(ve,{size:14})," ",U?"Sharing…":"Share"]})]}),e.jsx("h1",{className:"text-2xl md:text-3xl font-bold text-slate-900",children:t.name})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 text-amber-500 font-semibold",children:[e.jsx(ee,{size:16,fill:"currentColor"})," ",me.toFixed(1)]}),e.jsx("span",{className:"text-slate-500",children:"•"}),e.jsx("span",{className:z?"text-emerald-600 font-medium":"text-rose-600 font-medium",children:z?"In stock":"Out of stock"})]}),e.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-3xl font-bold text-slate-900",children:!i&&p.min!==null&&p.max!==null?p.min===p.max?h(p.min):`${h(p.min)} - ${h(p.max)}`:h(oe)}),ce&&e.jsxs("div",{className:"text-sm text-slate-400",children:["M.R.P.:"," ",e.jsx("span",{className:"line-through",children:h(de)})]})]}),B>0&&e.jsxs("span",{className:"text-sm font-semibold text-emerald-600",children:["Save ",B,"% today"]})]}),e.jsxs("div",{className:"space-y-4",children:[o.length>0&&e.jsxs("div",{className:"space-y-4",children:[o.map(s=>{const a=te[s]||[];
2if(!a.length)return null;const r=s.toLowerCase().includes("color");return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:s}),e.jsx("div",{className:"flex flex-wrap gap-2",children:a.map(n=>{const d=k[s]===n;return e.jsxs("button",{type:"button",onClick:()=>le(s,n),className:`flex items-center gap-2 rounded-full border px-4 py-2 text-sm transition ${d?"border-indigo-500 bg-indigo-50 text-primary":"border-slate-200 bg-white text-slate-600 hover:border-indigo-200"}`,children:[r?e.jsx("span",{className:"h-4 w-4 rounded-full border border-white shadow-inner",style:ne(n)}):null,e.jsx("span",{children:n})]},n)})})]},s)}),_&&b&&e.jsx("p",{className:"text-xs font-medium text-rose-600",children:"Select all options to continue."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Quantity"}),e.jsxs("div",{className:"inline-flex items-center rounded-full border border-slate-200 bg-white px-2 py-1",children:[e.jsx("button",{type:"button",onClick:()=>E(s=>Math.max(1,s-1)),className:"h-9 w-9 rounded-full text-slate-500 hover:bg-slate-100",children:"−"}),e.jsx("span",{className:"w-10 text-center text-sm font-semibold text-slate-800",children:w}),e.jsx("button",{type:"button",onClick:()=>E(s=>s+1),className:"h-9 w-9 rounded-full text-slate-500 hover:bg-slate-100",children:"+"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-3",children:F>0?e.jsxs(u,{href:route("cart.index"),className:"inline-flex items-center justify-center gap-2 rounded-full bg-slate-900 px-6 py-3 text-sm font-semibold text-white shadow hover:bg-slate-800",children:["View Cart (",F,")"]}):e.jsxs("div",{className:"relative group w-fit",children:[e.jsxs("button",{onClick:re,disabled:H,className:`inline-flex items-center justify-center gap-2 rounded-full px-6 py-3 text-sm font-semibold text-white shadow transition ${H?"bg-indigo-300 cursor-not-allowed":"bg-indigo-600 hover:bg-indigo-700"}`,type:"button",children:[e.jsx(we,{size:18}),R?"Adding…":"Add to Cart"]}),b&&e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-10 bg-slate-900 text-white text-xs font-semibold px-3 py-2 rounded-lg whitespace-nowrap shadow-lg",children:["Select a variant to add to cart",e.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 w-0 h-0 border-l-4 border-r-4 border-t-4 border-l-transparent border-r-transparent border-t-slate-900"})]}),M&&!b&&e.jsxs("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-10 bg-slate-900 text-white text-xs font-semibold px-3 py-2 rounded-lg whitespace-nowrap shadow-lg",children:["Complete customizations to add to cart",e.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 w-0 h-0 border-l-4 border-r-4 border-t-4 border-l-transparent border-r-transparent border-t-slate-900"})]})]})}),e.jsx("div",{className:"mt-3",children:o.length>0&&!i?e.jsx("button",{disabled:!0,className:"inline-flex items-center justify-center gap-2 rounded-full px-5 py-2 text-sm font-semibold text-gray-400 border border-gray-200 bg-gray-50 cursor-not-allowed",children:"Request Bulk Order"}):e.jsx(u,{href:`/quick-order?tab=manual&prefill=${encodeURIComponent(t.name)}${i?`&variant=${encodeURIComponent(i.name||Object.values(i.options||{}).join(" - "))}&variant_id=${i.id}`:""}`,className:"inline-flex items-center justify-center gap-2 rounded-full px-5 py-2 text-sm font-semibold text-indigo-700 border border-indigo-200 bg-white hover:bg-indigo-50 transition-colors",children:"Request Bulk Order"})}),_&&M&&e.jsx("p",{className:"text-xs text-rose-500",children:"Complete the customization fields marked with * to enable Add to Cart."}),_&&b&&e.jsx("p",{className:"text-xs text-rose-500",children:"Select a variant option to continue."}),e.jsx("span",{className:"text-xs text-slate-400",children:"Secure payments • Easy returns"})]}),e.jsxs("div",{className:"rounded-2xl border border-slate-200 bg-slate-50 p-5 text-sm text-slate-600 space-y-3",children:[e.jsx("p",{style:{textAlign:"justify"},children:t.short_description}),e.jsx("ul",{className:"space-y-1 text-sm",children:he.map((s,a)=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(Se,{size:16,className:"mt-[2px] text-indigo-500"}),e.jsx("span",{children:s})]},a))})]}),O&&e.jsx("div",{className:"rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm font-semibold text-emerald-700",children:O})]})})]})]}),v.length>0&&e.jsx("div",{className:"grid gap-4 md:grid-cols-3",children:v.slice(0,3).map(s=>{const a=Number(s.price??0),r=Number(s.compare_at_price??s.mrp??0),n=r>a;return e.jsx(u,{href:route("shop.product",s.slug),className:"group rounded-3xl border border-slate-200 bg-white p-5 shadow-sm transition hover:-translate-y-1 hover:shadow-lg",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-20 w-20 flex-shrink-0 overflow-hidden rounded-2xl bg-slate-50",children:e.jsx("img",{src:s.primary_image||"/img/haslab-logo.png",alt:s.name,className:"h-full w-full object-contain"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-semibold text-slate-900 group-hover:text-primary",children:s.name}),e.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[e.jsx("span",{className:"font-semibold text-slate-900",children:h(a)}),n&&e.jsx("span",{className:"text-slate-400 line-through",children:h(r)})]}),e.jsxs("div",{className:"flex items-center gap-1 text-xs text-amber-500",children:[e.jsx(ee,{size:14,fill:"currentColor"})," ","4.7"]})]})]})},`upsell-${s.id}`)})}),e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-6 md:p-10 shadow-sm space-y-6",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:pe.map(s=>{const a=T===s.id;return e.jsx("button",{onClick:()=>se(s.id),className:`rounded-full px-5 py-2 text-sm font-semibold transition ${a?"bg-indigo-600 text-white shadow":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,type:"button",children:s.label},s.id)})}),e.jsx("div",{className:"rounded-3xl border border-slate-100 bg-slate-50/60 p-6 text-sm leading-relaxed text-slate-600 space-y-4",children:T==="detail"&&e.jsx("div",{className:"space-y-3",children:t.description?e.jsx("div",{className:"space-y-3",dangerouslySetInnerHTML:{__html:t.description}}):e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"Lorem Ipsum is simply dummy text of the printing and typesetting industry. When an unknown printer took a galley of type and scrambled it, the specimen book we know today was born."}),e.jsx("p",{children:"Any product types that you want — simple, configurable, downloadable or bundled. Inventory management with backordered items, flatlock seams throughout, and digital proofs on every job."})]})})})]}),v.length>0&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h2",{className:"text-2xl font-semibold text-slate-900",children:["Related"," ",e.jsx("span",{className:"text-primary",children:"Products"})]}),e.jsx(u,{href:route("shop.index"),className:"text-sm font-semibold text-primary hover:text-indigo-700",children:"View all"})]}),e.jsx("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-4",children:v.slice(0,8).map((s,a)=>{var d;const r=["TRENDING","NEW","SALE","HOT"],n=["bg-indigo-100 text-indigo-700","bg-rose-100 text-rose-600","bg-emerald-100 text-emerald-600","bg-amber-100 text-amber-600"];return e.jsxs(u,{href:route("shop.product",s.slug),className:"group relative rounded-xl border border-slate-200 bg-white p-6 shadow-sm transition hover:-translate-y-1 hover:shadow-lg",children:[e.jsx("span",{className:`absolute top-5 left-5 text-[11px] font-semibold tracking-wide px-3 py-1 rounded-full ${n[a%n.length]}`,children:r[a%r.length]}),e.jsx("div",{className:"h-44 flex items-center justify-center",children:e.jsx("img",{src:s.primary_image||"/img/haslab-logo.png",alt:s.name,className:"max-h-44 object-contain transition-transform duration-300 group-hover:scale-105"})}),e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-slate-500",children:((d=(s.categories||[])[0])==null?void 0:d.name)||"Collection"}),e.jsx("p",{className:"text-base font-semibold text-slate-900 group-hover:text-primary",children:s.name}),e.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[e.jsx("span",{className:"font-semibold text-slate-900",children:h(s.price)}),e.jsx("span",{className:"text-slate-400 line-through",children:h(Number(s.price||0)*1.15)})]})]})]},s.id||`related-${a}`)})})]})]})})})}export{He 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.