import{_ as B,o as n,c as i,d as p,s as h,q as f,t as c,a,F as k,x as S,y as _,p as w,f as C,b8 as P,u as M,S as q,m as A,A as E,l as u,b as D,co as L,r as O}from"./i4_0wS5w.js";import{u as I,_ as U}from"./WebSourceEsbDataSheetButton-Dwb-A1ln.mjs";const x={props:{items:{type:Array},label:{type:String},partNumber:{type:String,required:!0},manufacturer:{type:Number,required:!0},selected:{type:Boolean},buttonName:{type:String},event:{type:String}},emits:["buttonClick"],methods:{toggleButtonBar(){this.$emit("buttonClick",this.buttonName)},navigateTo(r){I("Part Details",this.event,r,{partNumber:this.partNumber,manufacturerId:this.manufacturer,distributorId:this.distributor},this.page),window.open(r)}}},F={class:"ebm-source-esb-dropdown-button"},W=["onClick"];function R(r,t,s,e,l,d){var b;const g=C,v=P;return n(),i("div",F,[p(v,{color:(b=r.$ss)!=null&&b.useNewDesign?r.$ss.colors.primary.main:r.$ss.baseStyles.primaryColor,mode:s.selected?"solid":"hollow",onOnClick:d.toggleButtonBar},{default:h(()=>{var m;return[f(c(s.label)+" ",1),p(g,{icon:s.selected?"mdi:chevron-up":"mdi:chevron-down",color:s.selected?"white":(m=r.$ss)!=null&&m.useNewDesign?r.$ss.colors.primary.main:r.$ss.baseStyles.primaryColor,class:"arrow"},null,8,["icon","color"])]}),_:1},8,["color","mode","onOnClick"]),a("div",{class:_(["flyout",s.selected?"open":"closed"]),style:w({maxHeight:s.selected?60*s.items.length+"px":0})},[(n(!0),i(k,null,S(s.items,m=>(n(),i("a",{key:m.url,target:"_blank",class:"sesb-button",onClick:()=>{d.navigateTo(m.url)}},c(m.title),9,W))),128))],6)])}const V=B(x,[["render",R],["__scopeId","data-v-1afa6469"]]),H={name:"WebSourceEsbPartDetails",props:{partNumber:{type:String,required:!0},manufacturer:{type:String,required:!0},dataSheetMode:{type:String,default:"modal"},showButtonBar:{type:Boolean,default:!0},page:{type:Object}},async setup(r){var d,g;const{$gql:t}=M();let s={};q(async()=>{A({meta:[{name:"part-number",content:s.searchPartNumber},{name:"part-description",content:s.description},{name:"part-category",content:s.category},{name:"part-manufacturer",content:s.searchManufacturerName},{name:"og:type",content:"products",hid:"og-type"},{name:"type",content:"products",hid:"type"}]})});const e=`/parts/${r.partNumber}~${r.manufacturer}`,l=await t.query("getSourceesbData",{endpoint:e});return(d=l.data.meta)!=null&&d.isSuccess?s=((g=l==null?void 0:l.data)==null?void 0:g.data)??[]:E.error("Failed to get Parts Direct data."),{partDetails:s}},data(){return{priceModes:{},buttonSelected:""}},computed:{},methods:{togglePrice(r){const t={...this.priceModes};t[r]=!(t[r]??!1),this.priceModes={...t}},navigateTo(r,t,s){I("Part Details",r,t,s,this.page),window.open(t)},toggleButtonBar(r){this.buttonSelected===r?this.buttonSelected="":this.buttonSelected=r},getPrimaryDistributor(r,t){let s=0;return t.map(e=>{e.buyButtonUrl===r&&(s=e.id)}),s}}},z={key:0,class:"contents"},j={class:"overview"},K={class:"logo"},G={key:0,class:"image-provider"},J={class:"info"},Q={class:"part-number"},X={class:"manufacturer"},Y={class:"category"},Z={class:"description"},$=["innerHTML"],ee={key:0,class:"part-status"},te={key:1,class:"part-status"},ae={key:0,class:"button-bar"},re={class:"distributors"},se={class:"distributor-name"},ne={class:"sku"},oe={class:"package"},ie={class:"rohs"},le={class:"stock"},ce={class:"as-of"},de={class:"price"},ue={class:"price-level"},me={class:"price-price"},pe={class:"actions"};function be(r,t,s,e,l,d){const g=O,v=U,b=V,m=P,T=C;return n(),i("div",{class:"ebm-source-esb-part-details",style:w({fontFamily:r.$ss.primaryFontFamily})},[e.partDetails.partNumber?(n(),i("div",z,[a("div",j,[a("div",K,[p(g,{src:e.partDetails.imageUrl},null,8,["src"]),e.partDetails.imageProvider?(n(),i("div",G," Image provided by "+c(e.partDetails.imageProvider),1)):u("",!0)]),a("div",J,[a("div",Q,[a("h1",null,c(e.partDetails.partNumber),1),e.partDetails.dataSheetUrl?(n(),D(v,{key:0,"search-part-number":e.partDetails.partNumber,"part-number":s.partNumber,"search-manufacturer":s.manufacturer,manufacturer:e.partDetails.manufacturerId,action:s.dataSheetMode,mode:"solid",distributor:d.getPrimaryDistributor(e.partDetails.buyButtonUrl,e.partDetails.distributors),page:s.page,source:"Part Details","data-sheet-url":e.partDetails.dataSheetUrl,class:"data-sheet-button"},null,8,["search-part-number","part-number","search-manufacturer","manufacturer","action","distributor","page","data-sheet-url"])):u("",!0)]),a("h2",X,c(e.partDetails.manufacturerName),1),a("div",Y,[t[1]||(t[1]=a("label",null,"Category: ",-1)),f(" "+c(e.partDetails.category),1)]),a("div",Z,[t[2]||(t[2]=a("label",null,"Description: ",-1)),a("span",{innerHTML:e.partDetails.description},null,8,$)]),e.partDetails.partStatus?(n(),i("div",ee,[t[3]||(t[3]=a("label",null,"Part Status: ",-1)),a("span",null,c(e.partDetails.partStatus),1)])):u("",!0),e.partDetails.factoryLeadTime?(n(),i("div",te,[t[4]||(t[4]=a("label",null,"Lead Time: ",-1)),a("span",null,c(e.partDetails.factoryLeadTime),1)])):u("",!0)])]),s.showButtonBar?(n(),i("div",ae,[e.partDetails.referenceDesigns.length?(n(),i("div",{key:0,class:_(l.buttonSelected==="reference-designs"?"open":"closed")},[p(b,{items:e.partDetails.referenceDesigns,"part-number":e.partDetails.partNumber,manufacturer:e.partDetails.manufacturerId,"button-name":"reference-designs",event:"Reference Design",selected:l.buttonSelected==="reference-designs",label:"Reference Designs",onButtonClick:d.toggleButtonBar},null,8,["items","part-number","manufacturer","selected","onButtonClick"])],2)):u("",!0),e.partDetails.applicationNotes.length?(n(),i("div",{key:1,class:_(l.buttonSelected==="application-notes"?"open":"closed")},[p(b,{items:e.partDetails.applicationNotes,"part-number":e.partDetails.partNumber,manufacturer:e.partDetails.manufacturerId,"button-name":"application-notes",event:"Application Notes",selected:l.buttonSelected==="application-notes",label:"Application Notes",onButtonClick:d.toggleButtonBar},null,8,["items","part-number","manufacturer","selected","onButtonClick"])],2)):u("",!0),e.partDetails.softwareTools.length?(n(),i("div",{key:2,class:_(l.buttonSelected==="software-tools"?"open":"closed")},[p(b,{items:e.partDetails.softwareTools,"part-number":e.partDetails.partNumber,manufacturer:e.partDetails.manufacturerId,"button-name":"software-tools",event:"Soft Tool",selected:l.buttonSelected==="software-tools",label:"Software Tools",onButtonClick:d.toggleButtonBar},null,8,["items","part-number","manufacturer","selected","onButtonClick"])],2)):u("",!0),e.partDetails.cadDrawings.length?(n(),i("div",{key:3,class:_(l.buttonSelected==="cad-drawings"?"open":"closed")},[p(b,{items:e.partDetails.cadDrawings,"part-number":e.partDetails.partNumber,manufacturer:e.partDetails.manufacturerId,"button-name":"cad-drawings",event:"CAD Drawings",selected:l.buttonSelected==="cad-drawings",label:"CAD Drawings",onButtonClick:d.toggleButtonBar},null,8,["items","part-number","manufacturer","selected","onButtonClick"])],2)):u("",!0),e.partDetails.requestSample?(n(),D(m,{key:4,mode:"hollow",onOnClick:t[0]||(t[0]=()=>{d.navigateTo("Sample Request",e.partDetails.requestSample,{partNumber:e.partDetails.partNumber,manufacturerId:e.partDetails.manufacturerId})})},{default:h(()=>t[5]||(t[5]=[f(" Request Sample ")])),_:1})):u("",!0)])):u("",!0),a("div",re,[t[7]||(t[7]=L('<div class="table-header row" data-v-01a9f048><div class="distributor-name" data-v-01a9f048> Distributor </div><div class="sku" data-v-01a9f048> SKU </div><div class="package" data-v-01a9f048> Pkg. </div><div class="rohs" data-v-01a9f048> Rohs </div><div class="stock" data-v-01a9f048> Stock </div><div class="as-of" data-v-01a9f048> (as of) </div><div class="price" data-v-01a9f048> Price </div><div class="actions" data-v-01a9f048></div></div>',1)),(n(!0),i(k,null,S(e.partDetails.distributors,o=>{var N;return n(),i("div",{key:o.distributorPartNumber+"-"+o.distributorName,class:"table-data row"},[a("div",se,c(o.distributorName),1),a("div",ne,c(o.distributorPartNumber),1),a("div",oe,c(o.packaging),1),a("div",ie,c(o.rohs),1),a("div",le,c(o.stock),1),a("div",ce,c(o.stockAsOf),1),a("div",de,[a("div",{class:_(["price-items",l.priceModes[o.distributorPartNumber+"-"+o.distributorName]?"expanded":"collapsed"])},[(n(!0),i(k,null,S(o.priceBreaks,y=>(n(),i("div",{key:y.level,class:"price-item"},[a("div",ue,c(y.level),1),a("div",me," $"+c(y.price),1)]))),128))],2),o.priceBreaks.length>2?(n(),D(T,{key:0,icon:l.priceModes[o.distributorPartNumber+"-"+o.distributorName]?"mdi:minus-circle-outline":"mdi:plus-circle-outline","icon-color":(N=r.$ss)!=null&&N.useNewDesign?r.$ss.colors.primary.main:r.$ss.baseStyles.primaryColor,class:"price-toggle",onClick:()=>{d.togglePrice(o.distributorPartNumber+"-"+o.distributorName)}},null,8,["icon","icon-color","onClick"])):u("",!0)]),a("div",pe,[p(m,{onOnClick:()=>{d.navigateTo("Buy Button Click",o.buyButtonUrl,{partNumber:e.partDetails.partNumber,manufacturerId:e.partDetails.manufacturerId,distributorId:o.id})}},{default:h(()=>t[6]||(t[6]=[f(" Buy Now ")])),_:2},1032,["onOnClick"])])])}),128))])])):u("",!0)],4)}const fe=B(H,[["render",be],["__scopeId","data-v-01a9f048"]]);export{fe as _};