expedite-components 0.0.5 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* vue-router-lwc v1.0.4
|
|
3
3
|
* (c) 2024 Eduardo San Martin Morote
|
|
4
4
|
* @license MIT
|
|
5
|
-
*/var co;(function(t){t.pop="pop",t.push="push"})(co||(co={}));var uo;(function(t){t.back="back",t.forward="forward",t.unknown=""})(uo||(uo={})),Symbol(process.env.NODE_ENV!=="production"?"navigation failure":"");var fo;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(fo||(fo={})),Symbol(process.env.NODE_ENV!=="production"?"router view location matched":""),Symbol(process.env.NODE_ENV!=="production"?"router view depth":"");const ja=Symbol(process.env.NODE_ENV!=="production"?"router":""),$a=Symbol(process.env.NODE_ENV!=="production"?"route location":"");Symbol(process.env.NODE_ENV!=="production"?"router view location":"");function an(){return e.inject(ja)}function Kn(){return e.inject($a)}function qe(t){if(typeof t=="string"&&(t=JSON.parse(t)),t!=null&&t.errorMessage)throw new Error(t==null?void 0:t.errorMessage);return t}const Zn={xx_ord1__item__c:"xx_ord1__item__c",xx_ord1__sales_price__c:"xx_ord1__negotiated_price__c",xx_ord1__nrc__c:"xx_ord1__nrc_for_new__c",xx_ord1__line_description__c:"xx_ord1__line_description__c",xx_ord1__list_price__c:"xx_ord1__list_price2__c",xx_ord1__cost__c:"xx_ord1__cost2__c",xx_ord1__rate_plan__c:"xx_ord1__rate_plan__c",xx_ord1__allowed_discount__c:"xx_ord1__allowed_discount__c",xx_ord1__billing_period__c:"xx_ord1__billing_period__c",xx_ord1__ship_to_account__c:"xx_ord1__ship_to_account__c",xx_ord1__erp_item_number__c:"xx_ord1__erp_item_number__c",xx_ord1__mrc__c:"xx_ord1__mrc__c",xx_ord1__qty__c:"xx_ord1__qty__c",id:"id"},ho={xx_ord1__item__c:"xx_ord1__item__c",xx_ord1__negotiated_price__c:"xx_ord1__sales_price__c",xx_ord1__nrc_for_new__c:"xx_ord1__nrc__c",xx_ord1__line_description__c:"xx_ord1__line_description__c",xx_ord1__list_price2__c:"xx_ord1__list_price__c",xx_ord1__cost2__c:"xx_ord1__cost__c",xx_ord1__rate_plan__c:"xx_ord1__rate_plan__c",xx_ord1__allowed_discount__c:"xx_ord1__allowed_discount__c",xx_ord1__billing_period__c:"xx_ord1__billing_period__c",xx_ord1__ship_to_account__c:"xx_ord1__ship_to_account__c",xx_ord1__erp_item_number__c:"xx_ord1__erp_item_number__c",xx_ord1__mrc__c:"xx_ord1__mrc__c",xx_ord1__qty__c:"xx_ord1__qty__c",id:"id"},Fa=t=>{var n;let o=[];for(let r of t)if(r.trim()!=="xx_ord1__item__r.xx_ord1__decimal_precision__c")if(r.includes(".")){let a=r.split(".")[0];a=a.slice(0,-1)+"c";const d=((n=Zn[a==null?void 0:a.toLowerCase()])==null?void 0:n.trim())||"";d&&(o.includes(d)||o.push(d||""),o.push(r))}else o.includes(Zn[r==null?void 0:r.toLowerCase()])||o.push(Zn[r==null?void 0:r.toLowerCase()]||"");return o.filter(r=>r!=="")},Ha=Ke.defineStore("actions",()=>{const t=sn(),o=dt(),n=e.ref(!1);return{openAdaptiveSearch:(b,h=!1)=>{console.info("openAdaptiveSearch",b),t.chatHistory[t.chatHistory.length-1].links=[],t.sendMessage("Open Adaptive Search",!1,{internalCall:!0}),n.value=h},openQuoteItem:b=>{console.info("openQuoteItem",b),t.chatHistory[t.chatHistory.length-1].links=[],t.sendMessage("Open Quote Item",!1,{internalCall:!0})},openQuoteDocument:b=>{console.info("openQuoteDocument",b),t.chatHistory[t.chatHistory.length-1].links=[],t.chatHistory.push({type:"response",message:"Opening quote document",loading:!0});const v=`/apex/XX_ORD1__Expedite_Commerce?scpq=true&oid=${o.quoteId}&atpverified=true&ecCache=false&origin=AI`;window.location.href=`${ta(window.location.href)}${v}`},undo:()=>{const b=t==null?void 0:t.latestDMLRequest;t.sendMessage(`UNDO-${b}`,!1,{internalCall:!0})},isStaticActionCall:n}}),po=Ke.defineStore("adaptiveSearch",()=>{const t=dt(),o=ht(),n=sn(),r=Ha(),i=e.ref(null),a=e.ref(null),d=e.ref(!1),b=e.ref(!1),h=e.ref([]),v=e.ref(""),u=e.ref(!1),m=e.ref(null),s=e.ref(!1),g=e.ref([]),c=ot(),f=e.ref([]),l=e.ref(0),p=e.ref(!1),_=e.ref({rowLimt:10,paging:!0,offset:0,currentPage:1,totalPages:1});async function C(){d.value=!0;try{const x=JSON.stringify({layoutType:"Search Selection",layoutObject:"xx_ord1__ecatalog_item__c"});let A={};return A=await window.salesforceConnector.getDynamicPageLayout(x),a.value=lo(A,"Unable to find the Search Selection Layout for your user profile"),_.value.rowLimt=a.value.configuration.rowLimit||10,a.value.configuration.columns.forEach(L=>{!L.field&&L.label==="QTY"&&(L.field="xx_ord1__qty__c")}),d.value=!1,y(),A}catch(x){d.value=!1,c.handleError("Failed to get Adaptive Search Layout. Please try again."),console.info("[ERROR]: getAdaptiveSearchLayout() error = ",x)}}function y(){var x,A,L;m.value=(L=(A=(x=a.value)==null?void 0:x.configuration)==null?void 0:A.dynamicFilters)==null?void 0:L.filters.map(z=>({...z,field:z.field.toLowerCase(),filtervalue:z.filtervalue||[],filtervaluefrom:z.filtervaluefrom||"",filtervalueTo:z.filtervalueTo||""}))}function E(){var A;let x=[];for(const L of a.value.configuration.columns){let z=L.field;if(x.includes(z)||x.push(z),z!=null&&z.includes(".")){let D=z.split(".")[0];D=D.slice(0,-1)+"c",x.includes(D)||x.push(D)}}return(A=a.value.configuration)!=null&&A.cardHeader&&x.push(a.value.configuration.cardHeader.imageField),a.value.configuration.objectName.toLowerCase()==="xx_ord1__ecatalog_item__c"&&x.push("xx_ord1__item__r.xx_ord1__decimal_precision__c"),x=x.filter(L=>!!L),x.filter(L=>L.toLowerCase()!=="xx_ord1__qty__c"&&L.toLowerCase()!=="xx_ord1__competitor_sku__c")}function I(x,A=!1){if(!x||x.includes("undefined"))return!1;const L=/[!@#$%^&*()+=[\]{};':"\\|.<>/?]+/;if(A){const z=Array.isArray(x)?x:x.split(",");for(const K of z){const D=K.trim();if(L.test(D))return c.handleError(`Invalid character found in value: ${D}`),!1}}else if(L.test(x))return c.handleError("Special characters are not allowed in filter values"),!1;return!0}function O(x,A){return{field:x.field,operator:x.operator||"contains",value:A,dataType:x.dataType.trim()}}function V(x){if(!x.filtervalue)return null;const A=Array.isArray(x.filtervalue),L=A?x.filtervalue.join(","):x.filtervalue.trim();return I(L,A)?L:null}function T(x){var K,D;const A=(K=x.filtervaluefrom)==null?void 0:K.trim(),L=(D=x.filtervalueTo)==null?void 0:D.trim();if(!A||!L)return null;const z=`${A}, ${L}`;return z!==", "&&I(z)?z:null}function S(x){const A=`${ao(x.filtervaluefrom)}, ${ao(x.filtervalueTo)}`;return A!==", "&&I(A)?A:null}function w(x){var L;const A=(L=x.filtervaluefrom)==null?void 0:L.trim();return I(A)?A:null}function N(x){const A=[];return x.forEach(L=>{const z=L.dataType.trim();let K=null;switch(z){case"PICKLIST":case"MULTIPICKLIST":K=V(L);break;case"DOUBLE":case"CURRENCY":K=T(L);break;case"DATETIME":case"DATE":K=S(L);break;default:K=w(L)}K&&A.push(O(L,K))}),g.value=A,A}async function B(x="",A=[],L=[]){var K,D,H,R,M,j,F,Z,G,ie;let z=[];if(A.length&&(z=N(A)),!z.length&&x.trim()===""){h.value=[],u.value=!1;return}try{u.value=!1,b.value=!0;const se=x.trim();L.length||(L=E());const ue={fields:L,...A.length?{dynamicFilters:z}:{},searchText:se||v.value.trim(),accountId:o.accountId,...o.eCatalogId?{catalogId:o.eCatalogId}:{},...o.objectType==="opportunity"?{opportunityId:o.id}:{},...(D=(K=a.value)==null?void 0:K.configuration)!=null&&D.sort?{primarySortBy:a.value.configuration.sort.primary.field,primarySortOrder:a.value.configuration.sort.primary.direction,secondarySortBy:a.value.configuration.sort.secondary.field,secondarySortOrder:a.value.configuration.sort.secondary.direction}:{},rowLimt:(R=(H=a.value)==null?void 0:H.configuration)==null?void 0:R.rowLimit,paging:(j=(M=a.value)==null?void 0:M.configuration)==null?void 0:j.paging,...((F=_.value)==null?void 0:F.offset)!==0?{offset:_.value.offset}:{},objectName:(G=(Z=a.value)==null?void 0:Z.configuration)==null?void 0:G.objectName,currencyCode:o.currencyCode},ce=await window.salesforceConnector.getItems(JSON.stringify(ue));if(ce!=null&&ce.errorMessage){c.handleError(ce.errorMessage);return}ce!=null&&ce.itemCount&&(_.value.totalPages=Math.ceil((ce==null?void 0:ce.itemCount)/_.value.rowLimt)),h.value=rn(ce.lstItems,{xx_ord1__qty__c:"1"}),(ie=ce.lstItems)!=null&&ie.length||(u.value=!0),b.value=!1}catch(se){c.handleError("Failed to fetch Results. Please try again."),b.value=!1,console.info("[ERROR]: Adaptive Search getItems() error = ",se)}}async function $(x){try{s.value=!0;const A=JSON.stringify({lstQLIRequest:U(x),quoteId:t.quoteId});let L=await window.salesforceConnector.createQLI(A);typeof L=="string"&&(L=JSON.parse(L));let z=!1;if((L==null?void 0:L.length)>0&&L.forEach(K=>{K.errorMessage&&(z=!0,c.handleError(K.errorMessage))}),s.value=!1,z){f.value=L;const K=f.value.reduce((D,H)=>(D[H.eCatalogItemId]=H.errorMessage,D),{});h.value=h.value.map(D=>({...D,backendError:K[D.Id]||""}));return}return L}catch(A){c.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addToQuote() error = ",A)}}function U(x){const A=[];for(const L of x)if(!L.addedToQuote&&L.id){const z=J(L);l.value++,A.push({fields:z,recordId:L.id,...x.length===1?{maxSequenceNumber:l.value}:{}})}return A}function J(x){const A=[],L=W();return Object.keys(x).forEach(z=>{if(L.includes(z)){const K=ho[z.toLowerCase()];K&&A.push({fieldname:K,value:x[z]})}}),A}function W(){const x=[];return a.value.configuration.columns.forEach(A=>{A.field&&!A.field.includes(".")&&A.isEditable&&A.visible&&x.push(A.field)}),x}function ne(){var A,L;const x=[];return a.value.configuration.columns.forEach(z=>{const K=z.field.toLowerCase();x.includes(K)||x.push(K)}),(A=a.value.configuration)!=null&&A.dynamicFilters&&a.value.configuration.dynamicFilters.filters.forEach(z=>{const K=z.field.toLowerCase();x.includes(K)||x.push(K)}),(L=a.value.configuration)!=null&&L.cardHeader&&x.push(a.value.configuration.cardHeader.imageField),x}async function X(){var L;const x=ne(),A=((L=a.value.configuration)==null?void 0:L.saveObjectName)||a.value.configuration.objectName;if(A==="xx_ord1__ecatalog_item__c"){const z=x.indexOf("xx_ord1__qty__c");z>-1&&x.splice(z,1)}await t.getFieldsData(x,A),t.fieldsData.xx_ord1__qty__c||t.getFieldsData(["xx_ord1__qty__c"],"xx_ord1__quote_line_item__c")}async function P({searchTerm:x="",filters:A=[]}={}){if(p.value=!0,x&&(v.value=x),A.length&&(g.value=A),await C()){await X(),p.value=!1;const z=v.value;z&&(v.value=z,await B(z,t.dynamicFilters)),console.info("actionStore.isStaticActionCall = ",r.isStaticActionCall),r.isStaticActionCall&&(r.isStaticActionCall=!1,n.chatHistory[n.chatHistory.length-1]={type:"response",message:"Adaptive search is now open. Please search for the products you require and add it quote",loading:!1,links:[{action:"quoteItem",label:"Quote Item"},{action:"quoteDocument",label:"Quote Document"}]})}p.value=!1}return{selectedItem:i,AdaptiveSearchLayout:a,searchText:v,loadingAdaptiveLayout:d,getAdaptiveSearchLayout:C,getItems:B,lstItems:h,rowItemsLoading:b,noSearchRecords:u,dynamicFilters:m,setDynamicFilters:y,createQliErrors:f,addToQuote:$,addingToQuote:s,getFieldsData:X,pagingData:_,appliedDynamicFilters:g,maxSequenceNumber:l,loadingAdaptiveSearch:p,initAdaptiveSearch:P}}),Ua="XX_ORD1__Quote__c",za="xxord1salespricec",ln="xx_ord1__item__c",Ka="xxord1productnrcc",Za=Ke.defineStore("cartStore",()=>{const t=dt(),o=po(),n=ot(),r=e.ref(""),i=e.ref("$0"),a=e.ref("$0"),d=e.ref(null),b=e.ref({}),h=e.ref({}),v=e.ref({}),u=e.ref(""),m=e.ref(""),s=e.ref({}),g=e.ref(""),c=e.ref(""),f=e.ref({});async function l(){I()}async function p(){try{let T=await window.salesforceConnector.getProductCount(t.quoteId);if(T=qe(T),T!=null&&T.errorMessage){n.handleError(T.errorMessage);return}return r.value=T,T}catch{n.handleError("Failed to get Product Count. Please try again.")}}async function _(){try{let T=await window.salesforceConnector.getQuoteTotal(t.quoteId);if(T=qe(T),T!=null&&T.errorMessage){n.handleError(T.errorMessage);return}return a.value=T.monthlyTotal,i.value=T.onetimeTotal,T}catch{n.handleError("Failed to get Total Amount. Please try again.")}}async function C(T,S,w,N=""){if(!t.sectionDataMap.get(w).parentQLIs[S].removingItem){t.sectionDataMap.get(w).parentQLIs[S].removingItem=!0,c.value=T.id,await y(T.id)==="Success"&&(t.fetchAllQuoteLineItems(),N&&N(T,S,w));let $=t.sectionDataMap.get(w).parentQLIs.filter(U=>U[ln]===T[ln]).length;c.value="",o.lstItems.forEach(U=>{U[ln]===T[ln]&&(U.addedToQuote===!0&&(U.addedToQuote=!1),$===0&&(U.removedFromQuote=!0))})}}async function y(T){try{let S=await window.salesforceConnector.deleteQLI(T);if(S!=null&&S.errorMessage){n.handleError(S.errorMessage);return}return p(),_(),S}catch{n.handleError("Failed to remove Quote Item. Please try again.")}}function E(T){var N,B;const S=(N=T==null?void 0:T[Ka])==null?void 0:N.match(/\.\d+/);S&&(S.value=S[0].length-1);const w=(B=T==null?void 0:T[za])==null?void 0:B.match(/\.\d+/);return w&&(w.value=w[0].length-1),S||w}function I(T=!0){p(),_(),T&&t.fetchTemplates(Ua).then(()=>{t.getFilteredListWithFields()})}function O(T){const S=t.sectionDataMap;for(const[,w]of S.entries())w.parentQLIs.forEach(N=>{N.id===T.id&&(w.columns.forEach(B=>{if(B.dataType==="CURRENCY"){const $=B.field.replace(/_/g,"");N[$]=V(N[$],T[B.field])}}),T!=null&&T.billingPeriodValue&&(T!=null&&T.formattedBillingPeriodValue)&&(N.formattedBillingPeriodValue=V(N.formattedBillingPeriodValue,T.billingPeriodValue)),T!=null&&T.oneTimeValue&&(T!=null&&T.formattedOneTimeValue)&&(N.formattedOneTimeValue=V(N.formattedOneTimeValue,T.oneTimeValue)))})}function V(T,S){const w=Number(S);if(isNaN(w))return T;const N=T.match(/(\d[\d,]*)(\.\d+)?/);if(!N)return T;const B=N[2]||"",$=B.length?B.length-1:0,U=w.toLocaleString("en-US",{minimumFractionDigits:$,maximumFractionDigits:$});return T.replace(N[1]+B,U)}return{initializeCart:l,loadCartState:I,productCount:r,onetimeTotal:i,monthlyTotal:a,filterCartItem:d,billingPeriodValue:u,hasOneTimeValue:m,hasBillingPeriodInList:b,oneTimeFieldAvailable:h,billingPeriodFieldAvailable:v,priceDecimalPrecision:s,cartItemUpdatingId:g,removingItemLoaderId:c,cartItemColumnsMap:f,getProductCount:p,getQuoteTotal:_,removeItem:C,removeQuoteItem:y,getDecimalPrecisionFromSalesPriceOrNRC:E,updateFormattedValues:O,formateCurrencyValue:V}}),Qa=t=>[{title:"Apply Discount",subOptions:[...t.map(o=>`Apply Discount on ${o} for `),"Show Maximum discount allowed","Apply Maximum Discount Allowed",...t.map(o=>`Apply Discount on ${o} for a specific total`)]},{title:"Update Fields",subOptions:["Update the price of","Update the quantity of","Update the term start date to","Update the term end date to","Update the line description for"]},{title:"Price Ramp",subOptions:["Add a price ramp for"]}],Xa={salesforceUserLocale:"en_US",chatRoomId:"00DA0000000cDUJMA2__0052G00000AHBNAQA5__a0jKb000004VSaMIAW",status:"SUCCESS",statusCode:200,requestId:"9b1d1f0a9f07aa6cdc",errorMessage:"",payload:{uiModification:{addColumn:[],removeColumn:[],filter:[],groupBy:[{sectionName:"MRC $50 and Above",filters:[{datatype:"currency",field:"XX_ORD1__MRC__c",operator:"greater or equal",value:"50"}],tableId:"4vIEgoK5CbSPrLYPbq"},{sectionName:"MRC Below $50",filters:[{datatype:"currency",field:"XX_ORD1__MRC__c",operator:"less than",value:"50"}],tableId:"BlOPCp7eLBCZ84nDT2"}],showOptions:!0}},agentResponse:{role:"agent",requestId:"9b1d1f0a9f07aa6cdc",content:"Grouped the quote items into two sections: one for MRC $50 and above, and another for MRC below $50.",error:!1,epoch:1759936160464,isDML:!1},redirectObjects:{qliId:"",itemId:"",componentName:"QuoteItem"},actionFunction:"Reload",links:[{action:"quoteDocument",label:"Quote Document"},{action:"addProducts",label:"Add Products"}]},Ja=[{label:"Line Description",field:"xx_ord1__line_description__c",isEditable:!0,dataType:"STRING"},{label:"QTY",field:"xx_ord1__qty__c",isEditable:!0,dataType:"DOUBLE"},{label:"Extended Price",field:"xx_ord1__extended_price__c",isEditable:!1,dataType:"CURRENCY"},{label:"Billing Period",field:"xx_ord1__billing_period__c",isEditable:!0,dataType:"PICKLIST",picklistValues:["Monthly","Quarterly","Yearly"]}],dt=Ke.defineStore("quote",()=>{const t=ot(),o=Za(),n=ht(),r=e.ref(""),i=e.ref(""),a=e.ref(0),d=e.ref(""),b=e.ref([]),h=e.ref({template:!0,filteredList:!1}),v=e.ref(null),u=e.ref(new Map),m=e.ref({}),s=e.ref(!1),g=e.ref(!0),c=e.ref(!1),f=e.ref({text:"Hide Options",altText:"Show Options",handler:()=>{g.value=!g.value,V()},color:"#136E05",isActive:!1}),l=e.computed(()=>{const P=Array.from(u.value.values()).map(x=>x.sectionName);return Qa(P)});e.watch(d,()=>{h.value.template||O()});function p(){const P=new Map,x=[];for(const[L,z]of u.value.entries())P.set(L,z.selected),x.push(z);const A=JSON.parse(JSON.stringify(x));return A.forEach(L=>{delete L.selected;const z=new Map,K=[];L.lineItems.forEach(D=>{D.Selected=P.get(L.tableId).get(D.id)||!1,D.xx_ord1__parent_qli__c?(z.has(D.xx_ord1__parent_qli__c)||z.set(D.xx_ord1__parent_qli__c,[]),z.get(D.xx_ord1__parent_qli__c).push(D)):K.push(D)}),L.lineItems=K.map(D=>({...D,options:z.get(D.id)||[]})),delete L.loading,delete L.parentQLIs,delete L.totalValues}),{showOptions:g.value,sections:A,templateId:d.value}}async function _(P){try{let x=await window.salesforceConnector.getPrimaryQuote(P);x=qe(x),x!==void 0&&(console.info("getPrimaryQuote",JSON.stringify(x)),r.value=x.recordId,console.info("quoteId",r.value),i.value=x.name,d.value=x==null?void 0:x.templateId,a.value=(x==null?void 0:x.lineItemsCount)||0)}catch(x){t.handleError(x.message),console.info("[ERROR]: getPrimaryQuote() error = ",x)}}async function C(P){var x,A;try{h.value.template=!0;let L=await window.salesforceConnector.fetchContentTemplates(JSON.stringify({lstObjectName:[P],templateType:"Document",templateId:null,fetchOnlyDefault:!1}));L=qe(L);const z=L==null?void 0:L.templates[P];return d.value||(d.value=(x=z.find(K=>K.XX_ORD1__Default__c))==null?void 0:x.Id),d.value||(d.value=(A=z[0])==null?void 0:A.Id),b.value=z,h.value.template=!1,b.value}catch(L){t.handleError(L.message),console.info("[ERROR]: fetchTemplates() error = ",L)}}function y(P){if(!P)return null;const x=/\{!\$(\w+):([\w.]+)\}/,A=P.match(x);return A?{function:A[1],apiname:A[2].split(".")[1]}:null}async function E(P){try{const x={Id:r.value,XX_ORD1__Document_Template__c:P};return await window.salesforceConnector.updateQuote(JSON.stringify([x]))}catch(x){t.handleError(x.message),console.info("[ERROR]: updateQuote() error = ",x)}}async function I(){try{h.value.filteredList=!0;let P=await window.salesforceConnector.getQuoteEPageLayout();u.value.clear(),o.cartItemColumnsMap={},P=qe(P);const x=P.map(L=>({label:L.fieldLabel,field:L.fieldName.toLowerCase(),isEditable:L.isEditable,dataType:L.dataType,...L.picklistValues?{picklistValues:L.picklistValues}:{}})),A=wt();return u.value.set(A,{loading:!0,lineItems:[],parentQLIs:[],columns:x,tableId:A,sectionName:"All Rows",selected:new Map,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}),o.cartItemColumnsMap[A]=x,f.value.isActive=!1,g.value=!0,v.value={lstCB:[{columns:x,footer:null,title:"All Rows",sectionName:"All Rows",tableId:A,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}]},V(),h.value.filteredList=!1,P}catch(P){t.handleError(P.message),console.info("[ERROR]: getQuoteEPageLayout() error = ",P)}}async function O(){if(b.value.length===0){I();return}try{h.value.filteredList=!0;let P=await window.salesforceConnector.getFilteredListWithFields(JSON.stringify({templateId:d.value}));E(d.value),P=qe(P),console.info("res.lstCB = ",P.lstCB);const x=P==null?void 0:P.objectFieldsMap;return u.value.clear(),o.cartItemColumnsMap={},P.lstCB=P.lstCB.map(A=>{const{fields:L,filters:z,primarysort:K,primarysortdesc:D}=JSON.parse(A.XX_ORD1__Block_Properties__c),H=L.map(M=>{var j;return{label:(j=x[M.api])==null?void 0:j.label,field:M.api.toLowerCase(),isEditable:M.api.includes(".")?!1:x[M.api].isEditable,dataType:x[M.api].dataType,...x[M.api].picklistValues?{picklistValues:x[M.api].picklistValues}:{}}}),R=A.Id||wt();return u.value.set(R,{loading:!0,lineItems:[],parentQLIs:[],columns:H,tableId:R,sectionName:A.Name,selected:new Map,footer:y(A.XX_ORD1__Table_Footer_HTML__c),filters:z,primarysort:K,primarysortdesc:D}),o.cartItemColumnsMap[R]=H,f.value.isActive=!1,g.value=!0,{columns:H,footer:y(A.XX_ORD1__Table_Footer_HTML__c),title:A.Name,sectionName:A.Name,tableId:R,filters:z,primarysort:K,primarysortdesc:D}}),v.value=P,V(),h.value.filteredList=!1,P}catch(P){t.handleError(P.message),console.info("[ERROR]: getFilteredListWithFields() error = ",P)}}async function V(P=!0){const x=[];for(const[A]of u.value)x.push(w(A,P));return await Promise.all(x),o.getProductCount(),!0}function T(P,x){return u.value.get(P).columns.some(A=>A.field.toLowerCase()===x)||o.cartItemColumnsMap[P].some(A=>A.field.toLowerCase()===x)}function S(P,x){let A=rn(P);const L=n.pricingSchema,z=T(x,"xx_ord1__nrc__c"),K=T(x,"xx_ord1__sales_price__c"),D=T(x,"xx_ord1__qty__c");return A=A.map(H=>{let R={};L==="nrc/mrc"&&(H!=null&&H.xx_ord1__billing_period__c)?R={...K?{billingPeriodValue:(H==null?void 0:H.xx_ord1__sales_price__c)===0?"0":(H==null?void 0:H.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:H==null?void 0:H.xxord1salespricec}:{},...z?{oneTimeValue:(H==null?void 0:H.xx_ord1__nrc__c)===0?"0":(H==null?void 0:H.xx_ord1__nrc__c)||null,formattedOneTimeValue:H==null?void 0:H.xxord1nrcc}:{}}:L==="nrc/mrc"&&!(H!=null&&H.xx_ord1__billing_period__c)?K&&(R={oneTimeValue:(H==null?void 0:H.xx_ord1__sales_price__c)===0?"0":(H==null?void 0:H.xx_ord1__sales_price__c)||null,formattedOneTimeValue:H==null?void 0:H.xxord1salespricec}):L!=="nrc/mrc"&&(H!=null&&H.xx_ord1__billing_period__c)?K&&(R={billingPeriodValue:(H==null?void 0:H.xx_ord1__sales_price__c)===0?"0":(H==null?void 0:H.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:H==null?void 0:H.xxord1salespricec}):L!=="nrc/mrc"&&!(H!=null&&H.xx_ord1__billing_period__c)&&K&&(R={oneTimeValue:(H==null?void 0:H.xx_ord1__sales_price__c)===0?0:(H==null?void 0:H.xx_ord1__sales_price__c)||null,formattedOneTimeValue:H==null?void 0:H.xxord1salespricec});const{xx_ord1__qty__c:M,xx_ord1__sales_price__c:j,xx_ord1__nrc__c:F,...Z}=H,G={...Z,id:H.id,description:(H==null?void 0:H.xx_ord1__line_description__c)||"",xx_ord1__billing_period__c:H==null?void 0:H.xx_ord1__billing_period__c,...D?{xx_ord1__qty__c:M}:{},xx_ord1__item__c:H==null?void 0:H.xx_ord1__item__c,"xx_ord1__item__r.xx_ord1__decimal_precision__c":H["xx_ord1__item__r.xx_ord1__decimal_precision__c"]||"0",...R};return G!=null&&G.billingPeriodValue&&(o.hasBillingPeriodInList[x]=!0,o.billingPeriodValue=G==null?void 0:G.xx_ord1__billing_period__c),"oneTimeValue"in G&&(o.oneTimeFieldAvailable[x]=!0),"billingPeriodValue"in G&&(o.billingPeriodFieldAvailable[x]=!0),(G==null?void 0:G.oneTimeValue)!==""&&(G==null?void 0:G.oneTimeValue)!==null&&(o.hasOneTimeValue=!0),G}),A}async function w(P,x=!0){var A,L;try{const z=u.value.get(P);if(console.info("sectionData = ",z.sectionName),!z)return;z.loading=x,x&&(z.lineItems=[]);const{columns:K,filters:D,primarysort:H,primarysortdesc:R,footer:M}=z,j=K.map(ce=>ce.field.toLowerCase());j.includes("xx_ord1__parent_qli__c")||j.push("xx_ord1__parent_qli__c"),j.includes("xx_ord1__item__c")||j.push("xx_ord1__item__c"),j.includes("xx_ord1__sys_configuration_status2__c")||j.push("xx_ord1__sys_configuration_status2__c"),(A=o.cartItemColumnsMap[P])==null||A.forEach(ce=>{j.includes(ce.field)||j.push(ce.field)});const F=await N({fields:j,recordId:r.value,filters:D||[],primarySortBy:H||"",primarySortOrder:R?"DESC":"ASC",includeOptions:g.value,totalFields:M?[M.apiname]:[]}),Z=F.lineItems,G=new Map;let ie=[];const se=(L=F.fieldTotals)==null?void 0:L.map(ce=>ce.totalValue);Z.forEach(ce=>{ce.XX_ORD1__Parent_QLI__c?G.has(ce.XX_ORD1__Parent_QLI__c)?G.get(ce.XX_ORD1__Parent_QLI__c).push(ce):G.set(ce.XX_ORD1__Parent_QLI__c,[ce]):ie.push(ce)});const ue=[];return ie.forEach(ce=>{ue.push(ce),G.has(ce.Id)&&ue.push(...G.get(ce.Id))}),ie=S(ie,P),z.lineItems=rn(ue),z.parentQLIs=ie,z.totalValues=se,z.loading=!1,u.value=new Map(u.value),ue}catch(z){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",z.message);const K=u.value.get(P);K&&(K.loading=!1)}}async function N(P){try{let x=await window.salesforceConnector.getQuoteLineItemsWithFilteredTable(JSON.stringify(P));return x=qe(x),x}catch(x){t.handleError(x.message),console.info("[ERROR]: getQuoteLineItemsWithFilteredTable() error = ",x)}}async function B(P){try{console.info("updateQli() payload = ",P);let x=await window.salesforceConnector.updateQli(JSON.stringify(P));return x=qe(x),V(!1),x}catch(x){t.handleError(x.message),console.info("[ERROR]: updateQli() error = ",x)}}async function $(P){try{let x=await window.salesforceConnector.deleteQLI(P);return x=qe(x),V(),x}catch(x){t.handleError(x.message),console.info("[ERROR]: deleteQLI() error = ",x)}}async function U(P,x){try{s.value=!0;const A={fields:P};x&&(A.objectName=x),P.includes("xx_ord1__qty__c")&&x==="xx_ord1__ecatalog_item__c"&&(A.fields=A.fields.filter(z=>z!=="xx_ord1__qty__c")),P.includes("xx_ord1__sales_price__c")&&x!=="xx_ord1__quote_line_item__c"&&(A.fields=A.fields.filter(z=>z!=="xx_ord1__sales_price__c"));let L=await window.salesforceConnector.getFieldsData(JSON.stringify(A));return typeof L=="string"&&(L=JSON.parse(L)),L!=null&&L.errorMessage?(t.handleError(L.errorMessage),null):(m.value={...m.value,...L},console.info("fieldsData.value = ",JSON.stringify(m.value)),L)}catch(A){return t.handleError("Failed to get Fields Data. Please try again."),console.info("[ERROR]: getFieldsData() error = ",A),null}finally{s.value=!1}}function J(P=""){var x;return!P||P.includes(".")?!1:P.includes("xx_ord1__qty__c")?!0:((x=m.value[P])==null?void 0:x.isEditable)||!1}function W(){ne(Xa)}async function ne(P){var x,A,L,z,K,D,H,R,M;if(P.payload){if((x=P.payload)!=null&&x.uiModification){const j=P.payload.uiModification;if(((A=j.addColumn)==null?void 0:A.length)>0)if(j.addColumn.forEach(F=>{F.columns.forEach(Z=>{Z.field=Z.field.toLowerCase()})}),j.addColumn[0].sectionName==="all_section")for(const[F,Z]of u.value)Z.columns=[...Z.columns,...j.addColumn[0].columns];else j.addColumn.forEach(F=>{u.value.get(F.tableId)&&(u.value.get(F.tableId).columns=[...u.value.get(F.tableId).columns,...F.columns])});if(((L=j.removeColumn)==null?void 0:L.length)>0)if(j.removeColumn.forEach(F=>{F.columns=F.columns.map(Z=>Z.toLowerCase())}),j.removeColumn[0].sectionName==="all_section")for(const[F,Z]of u.value)Z.columns=Z.columns.filter(G=>!j.removeColumn[0].columns.includes(G.field));else j.removeColumn.forEach(F=>{u.value.get(F.tableId)&&(u.value.get(F.tableId).columns=u.value.get(F.tableId).columns.filter(Z=>!F.columns.includes(Z.field)))});if(((z=j.filter)==null?void 0:z.length)>0)if(j.filter[0].sectionName==="all_section")for(const[F,Z]of u.value)Z.filters=[...Z.filters,...j.filter[0].filters];else j.filter.forEach(F=>{u.value.get(F.tableId)&&(u.value.get(F.tableId).filters=[...u.value.get(F.tableId).filters,...F.filters])});if(((K=j.groupBy)==null?void 0:K.length)>0){const F=((D=[...u.value.values()][0])==null?void 0:D.columns)||Ja;u.value.clear(),o.cartItemColumnsMap={},j.groupBy.forEach(Z=>{o.cartItemColumnsMap[Z.tableId]=Z.columns||F,u.value.set(Z.tableId,{loading:!0,lineItems:[],parentQLIs:[],columns:Z.columns||F,tableId:Z.tableId,sectionName:Z.sectionName,selected:new Map,footer:y(Z.footer),filters:Z.filters,primarysort:Z.primarysort,primarysortdesc:Z.primarysortdesc})})}j.showOptions!==void 0&&(g.value=j.showOptions)}if(((R=(H=P.payload)==null?void 0:H.sections)==null?void 0:R.length)>0){const j=(M=P.payload)==null?void 0:M.sections;u.value.clear(),j.forEach(F=>{F.tableId||(F.tableId=wt()),F.selected=new Map,u.value.set(F.tableId,F)}),V()}}P.actionFunction==="Reload"&&(V(),console.info("Reloading quote line items"))}async function X(P){var x,A;try{const L=new Set;for(const z of u.value.keys())(x=u.value.get(z).lineItems)==null||x.forEach(D=>{D.attributes=null,L.add(D.id)});if(P){const z={lineItemIds:[...L]},K=await window.productManagerController.getLineItemAttributes({request:JSON.stringify(z)}),D=JSON.parse(K.data);for(const H of u.value.keys())(A=u.value.get(H).lineItems)==null||A.forEach(M=>{M.attributes=D[M.id]||null})}}catch(L){console.info("[ERROR]: fetchAttributesData() error = ",L)}}return{showAttributes:c,quoteId:r,quoteName:i,templateId:d,templateOptions:b,loading:h,currentTemplateData:v,fieldsData:m,fieldsDataLoading:s,showOptionHeaderButton:f,sectionDataMap:u,promptSuggestions:l,lineItemsCount:a,addColumns:W,getQuoteEPageLayout:I,getPayload:p,getPrimaryQuote:_,fetchTemplates:C,getFilteredListWithFields:O,getQuoteLineItemsWithFilteredTable:N,updateQli:B,getFieldsData:U,deleteQLI:$,performAIAction:ne,isEditableField:J,fetchQuoteLineItems:w,fetchAllQuoteLineItems:V,fetchAttributesData:X}}),Wa=Ke.defineStore("quickSelection",()=>{const t=ot(),o=ht(),n=dt(),r=e.ref(null),i=e.ref(!1),a=e.ref([]),d=e.ref([]),b=e.ref(!1),h=e.ref({}),v=e.ref({rowLimit:10,paging:!0,offset:0,currentPage:1,totalPages:1}),u=e.ref(!1);async function m(){i.value=!0;try{const E=JSON.stringify({layoutType:"Quick Selection",layoutObject:"xx_ord1__ecatalog_item__c",...o.objectType?{contextObject:o.objectType}:{}});let I={};I=await window.salesforceConnector.getDynamicPageLayout(E),r.value=lo(I,"Unable to find the Quick Selection Layout for your user profile"),console.info("quickSelectionLayout.value = ",r.value),v.value.rowLimit=r.value.configuration.rowLimit||10,r.value.data.columns.forEach(O=>{!O.field&&O.label==="QTY"&&(O.field="xx_ord1__qty__c")}),i.value=!1}catch(E){i.value=!1,t.handleError("Failed to get Page structure data. Please try again."),console.info("[ERROR]: getAdaptiveSearchLayout() error = ",E)}}function s(){const E=new Map;return r.value.data.columns.forEach(I=>{E.set(I.field,!0)}),r.value.data.searchResultColumns.forEach(I=>{E.set(I.field,!0)}),Array.from(E.keys())}async function g(E){var I,O;try{let V=await window.salesforceConnector.saveCompetitorSKU(E);if(V!=null&&V.errorMessage){t.handleError(V.errorMessage);return}if((I=V[0])!=null&&I.errorMessage){t.handleError((O=V[0])==null?void 0:O.errorMessage);return}return V}catch(V){t.handleError("Failed to Match Item. Please try again."),console.info("[ERROR]: saveCompetitorSKU() error = ",V)}}async function c(E="",I=[]){try{let O=r.value.data,V=r.value.configuration;const T=E.trim();if(console.info("searchTextValue.trim() = ",E.trim()),!T)return[];let S=null;console.info("useMappings = ",u.value),u.value?S=Fa(f()):S=f(),console.info("fields before filter = ",S),S=S.filter($=>$!=="xx_ord1__qty__c"),console.info("fields after filter = ",S);const w={fields:S,...I.length?{dynamicFilters:n.getDynamicFilters(I)}:{},searchText:T,accountId:o.accountId,...o.eCatalogId?{catalogId:o.eCatalogId}:{},...o.objectType==="opportunity"?{opportunityId:o.id}:{},...O!=null&&O.sort?{primarySortBy:O.sort.primary.field,primarySortOrder:O.sort.primary.direction,secondarySortBy:O.sort.secondary.field,secondarySortOrder:O.sort.secondary.direction}:{},rowLimt:(V==null?void 0:V.rowLimit)||20,paging:(V==null?void 0:V.paging)||!1,...v.value.offset!==0?{offset:v.value.offset}:{},objectName:O.objectName,currencyCode:o.currencyCode};console.info("getQuickSelectionItems payload = ",JSON.stringify(w));const N=await window.salesforceConnector.getItems(JSON.stringify(w));if(console.info("getQuickSelectionItems Res = ",JSON.stringify(N)),N!=null&&N.errorMessage){t.handleError(N.errorMessage);return}return N!=null&&N.itemCount&&(v.value.totalPages=Math.ceil((N==null?void 0:N.itemCount)/v.value.rowLimit)),rn(N.lstItems,{xx_ord1__qty__c:"1"})}catch(O){t.handleError("Failed to fetch Results. Please try again."),console.info("[ERROR]: getQuickSelectionItems() error = ",O)}}function f(){let E=[];for(const I of r.value.data.columns){let O=I.field;if(O!=null&&O.includes(".")){E.includes(O)||E.push(O);let T=O.split(".")[0];T=T.slice(0,-1)+"c",E.includes(T)||E.push(T)}else E.includes(O)||E.push(O)}return console.info("getAllQuickSelectionFields() fields = ",E),E.filter(I=>I.toLowerCase()!=="xx_ord1__qty__c")}async function l(E,I,O,V){console.info("searchText:",JSON.stringify(E)),console.info("row:",JSON.stringify(I)),console.info("rowIndex:",JSON.stringify(O)),console.info("column:",JSON.stringify(V));const T=O+(v.value.currentPage-1)*v.value.rowLimit;if(V.field.toLowerCase().includes("xx_ord1__item__r")){if(a.value[T].itemLookupLoading=!0,u.value=!0,d.value=await c(E),d.value.length>0){const S=[];for(let w=0;w<d.value.length;w++)a.value[T].itemDataRetrieved=!0,d.value[w].xx_ord1__item__c&&S.push({name:d.value[w]["xx_ord1__item__r.name"],value:d.value[w].xx_ord1__item__c,label:d.value[w][V.field.toLowerCase()]});a.value[T][V.field.toLowerCase()+"_options"]=S}a.value[T].itemLookupLoading=!1}else if(V.field.toLowerCase().includes("xx_ord1__competitor_item__r")){a.value[T].competitorLookupLoading=!0;const S=await p(E);S!=null&&S.items&&(a.value[T][V.field.toLowerCase()+"_options"]=S.items.map(w=>({name:w.fields[2].value,value:w.fields[1].value,label:w.fields[0].value}))),a.value[T].competitorLookupLoading=!1,console.info("getLookupData:: Search Lookup Handler Response = ",S)}}async function p(E){var O,V;console.info("getLookupData() searchText = ",E);const I={searchText:E,obj:"xx_ord1__competitor_item__c",filters:null,displayFields:["xx_ord1__sku__c"]};try{let T=await window.salesforceConnector.getLookupData(JSON.stringify(I));if(typeof T=="string"&&(T=JSON.parse(T)),T!=null&&T.errorMessage){t.handleError(T.errorMessage);return}if((O=T[0])!=null&&O.errorMessage){t.handleError((V=T[0])==null?void 0:V.errorMessage);return}return T}catch(T){t.handleError("Failed to Search For Item. Please try again."),console.info("[ERROR]: getLookupData() error = ",T)}}async function _(E,I){var V;console.info("Update Other Fields Value = ",E),console.info("Update Other Fields Row Index = ",I);const O=I+(v.value.currentPage-1)*v.value.rowLimit;console.info("actualRowIndex = ",O);try{if(E){const T=d.value.filter(S=>S.xx_ord1__item__c===E)[0];if(T){b.value=!0;const S=r.value.data.columns[1].field;a.value[O][S]&&await C(T,O),(V=a.value[O])!=null&&V.itemDataRetrieved&&(a.value[O].status="New Match Requested",a.value[O].noMatchCleared=!0),Object.keys(T).forEach(w=>{const N=ho[w.toLowerCase()];console.info("Mapped Key = ",N),N&&(a.value[O][N]=T[w])}),b.value=!1}else a.value[O].status=""}else a.value[O].status="No Match"}catch(T){t.handleError("Unable to request a match for this item please try again."),console.info("Error in updateOtherFields = ",T)}}async function C(E,I){const O=a.value[I],V=r.value.data.columns[1].field,T=[{sku:O[V],name:O[V],productDescription:O.xx_ord1__line_description__c||"",productURL:null,status:"Match Requested",competitorAccountId:null,itemId:E.xx_ord1__item__c}];let S=await g(JSON.stringify(T));console.info("Match Item: ",JSON.stringify(S)),a.value[I][`${V}_options`]=[{value:S[0].competitorItemId,label:S[0].sku}],a.value[I][V]=S[0].competitorItemId}async function y(E){try{let I=await window.salesforceConnector.createQLI(JSON.stringify(E));typeof I=="string"&&(I=JSON.parse(I));let O=!1;if((I==null?void 0:I.length)>0)for(let V=0;V<I.length;V++)I[V].errorMessage&&(O=!0,I[V].errorMessage.includes("Line Description: data value too large")&&(I[V].errorMessage="Error: The description is too long—it must be under 200 characters."));if(O){I.forEach(V=>{h.value[V.eCatalogItemId]=V});return}else h.value=[];return I}catch(I){t.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addAllItemsToQuote() error = ",I)}}return{quickSelectionLayout:r,quickSelectionLayoutLoading:i,processedRecords:a,useMappings:u,currentSearchData:d,createQliErrors:h,getQuickSelectionLayout:m,getAllFieldsForQuickSelectionLayout:s,saveCompetitorSKU:g,getQuickSelectionItems:c,searchLookupHandler:l,updateOtherFields:_,addAllItemsToQuote:y}}),Ga="Preparing Your Quote Please Wait...",Ya={message:"Your quote is ready! Begin adding products to complete it.",type:"response",requestId:"no-request-id"},el=18e4,sn=Ke.defineStore("ai",()=>{const t=ht(),o=dt(),n=po(),r=Wa(),i=it(),a=Kn(),d=e.ref(""),b=e.ref(""),h=e.ref([]),v=e.ref(""),u=e.ref([]),m=e.ref(!1),s=e.ref(null),g=an(),c=e.ref({}),f=e.ref(null),l=e.ref(null),p=e.ref(null),_=e.ref(null),C=e.ref(null),y=e.ref(Ga),E=e.ref([]),I=e.computed(()=>t.orgId+"__"+t.user.Id+"__"+o.quoteId),O=e.computed(()=>s.value.readyState==WebSocket.OPEN),V=()=>{c.value={salesforceOrgId:t.orgId,salesforceOrgType:t.orgType,salesforceUserId:t.user.Id,userType:"Salesforce",chatRoomId:I.value,requestId:"",prompt:"",initiatedFrom:t.origin||"Quote",internalCall:!1,contextObjectId:o.quoteId,contextObjectType:"Quote",payload:{lineItemsCount:o.lineItemsCount},origin:"Genesis AI",defaultBatchSize:10,actionType:"",packageVersion:t.packageVersion,relatedIds:{eCatalogId:t.eCatalogId,accountId:t.accountId}}};async function T(){const M=b.value+"?chatRoomId="+I.value;s.value=new WebSocket(M),s.value.addEventListener("open",S),s.value.addEventListener("message",B),s.value.addEventListener("close",w),s.value.addEventListener("error",N)}const S=()=>{$(),W()},w=()=>{U()},N=()=>{z(),U()},B=M=>{var F,Z;$();const j=JSON.parse(M.data);if(j.status!=="ALIVE"){if(j.loading){y.value=j.message;return}else Array.isArray(j.messages)?(y.value=null,h.value.push(Ya),j.messages.length>0&&x(j.messages)):j.agentResponse&&(j.errorMessage&&(j.agentResponse.content=j.errorMessage,j.agentResponse.error=!0),y.value=null,h.value.push({message:j.agentResponse.content,type:j.agentResponse.role,requestId:j.requestId,epoch:j.agentResponse.epoch,error:j.agentResponse.error,isDML:j.agentResponse.isDML,...(F=j.agentResponse)!=null&&F.filesData?{filesData:(Z=j.agentResponse)==null?void 0:Z.filesData}:{}}));E.value=j.links||[],D(j)}},$=()=>{U(),f.value=setTimeout(()=>{if(O.value){const M={action:"heartbeat"};s.value.send(JSON.stringify(M)),$()}},el)},U=()=>{f.value&&(clearInterval(f.value),f.value=null)};function J(M){const j={...c.value};j.requestType="Action",j.actionType="Undo",j.undoRequestId=M,j.requestId=wt(),P(j)}function W(){const M={...c.value};M.requestType="Action",M.actionType="History",M.requestId=wt(),P(M)}function ne(M){return a.path.startsWith("/configurator")&&i.isChangedConfiguration?(_.value={save:()=>{i.maintainQuoteConfiguration()}},d.value=M,!0):(d.value="",!1)}function X(M,j=!0,F=null){if(!ne(M)&&M.trim()){let Z={...c.value};Z.prompt=M.trim(),Z.requestType="Chat",Z.requestId=wt(),Z.internalCall=!1,Z.payload=A(),Z.componentName=L.value,Z.templateId=o.templateId,Z.payload.lineItemsCount=o.lineItemsCount,F&&(Z={...Z,...F}),K(),j&&h.value.push({message:M.trim(),type:"user",...C.value&&{fileData:[C.value]},requestId:Z.requestId}),P(Z),$()}}function P(M){const j={action:"prompt",data:M};s.value.send(JSON.stringify(j))}const x=M=>{const j=M.filter(({content:F})=>!!F).map(F=>({message:F.content,type:F.role,requestId:F.requestId,epoch:F.epoch,isDML:F.isDML,undone:F.undone}));j.forEach((F,Z)=>{F.isDML===!0&&Z!==j.length-1&&(F.isDML=!1)}),h.value=[...h.value,...j]};function A(){return a.path==="/quote-item"?o.getPayload():{}}const L=e.computed(()=>a.path==="/quote-item"?"QuoteItem":""),z=()=>{h.value.push({type:"response",message:"Oops! Something went wrong while processing your request. Please try again later.",error:!0})},K=()=>{h.value=h.value.map(M=>({...M,links:[]}))};function D(M){var Z,G,ie;const j=((Z=M==null?void 0:M.redirectObjects)==null?void 0:Z.componentName)||(M==null?void 0:M.componentName),F=(M==null?void 0:M.redirectObjects)||{};if(j==="AdaptiveSearch"){const se=(G=M==null?void 0:M.payload)==null?void 0:G.searchTerm,ue=(ie=M==null?void 0:M.payload)==null?void 0:ie.applyFilters;se&&se!==n.searchText&&n.initAdaptiveSearch({searchTerm:se,filters:ue}),g.push("/adaptive-search")}else j==="Configurator"?g.push(`/configurator/${F.itemId}/${F.qliId}`):j==="QuoteReview"?g.push("/quote-item"):j==="QuoteItem"||j==="QuoteList"?(g.push("/quote-item"),o.performAIAction(M)):j==="QuickSelection"&&(r.quickSelectionLayout=M.payload,console.info("Loading QuickSelection data = ",JSON.stringify(r.quickSelectionLayout)),g.push("/match-records"))}function H(){if(O.value){const M={action:"cancel",data:{requestId:c.value.requestId,chatRoomId:I.value}};s.value.send(JSON.stringify(M))}}const R=()=>{l.value&&(clearInterval(l.value),l.value=null),f.value&&(clearInterval(f.value),f.value=null),p.value&&(clearTimeout(p.value),p.value=null)};return e.onBeforeUnmount(()=>{R()}),{unsavedChanges:_,loadingMessage:y,promptMessage:d,buttonLinks:E,websocketUrl:b,chatHistory:h,latestDMLRequest:v,strikethroughHistory:u,attachmentData:C,dataManuallyChanged:m,undoAction:J,connectSocket:T,sendMessage:X,setInitialPayload:V,cancelRequest:H}}),ht=Ke.defineStore("root",()=>{const t=sn(),o=ot(),n=dt(),r=e.ref(""),i=e.ref(""),a=e.ref("Genesis AI"),d=e.ref(""),b=e.ref({}),h=e.ref(""),v=e.ref(""),u=e.ref(""),m=e.ref(""),s=e.ref({}),g=e.ref(""),c=e.ref(""),f=e.ref(""),l=e.ref(""),p=e.ref(""),_=e.ref(""),C=e.ref(""),y=e.ref("Single"),E=e.ref("closed"),I=e.computed(()=>n.quoteName),O=e.computed(()=>y.value==="Single");async function V(N){r.value=N||io("id"),i.value=io("origin"),await S(),await T()}async function T(){try{console.info("getRecordInfo",r.value);let N=await window.salesforceConnector.getRecordInfo(r.value);return N=qe(N),N!==void 0&&(s.value=N,g.value=N.name,c.value=N.objectType,f.value=N.accountId,l.value=N.eCatalogId,p.value=N.currencyCode,_.value=N.userLocale,C.value=N.opportunityId),(N==null?void 0:N.objectType)==="XX_ORD1__Quote__c"?(n.quoteId=N==null?void 0:N.recordId,n.templateId=N==null?void 0:N.templateId,n.quoteName=N==null?void 0:N.name,n.lineItemsCount=(N==null?void 0:N.lineItemsCount)||0):(N==null?void 0:N.objectType)==="Opportunity"&&await n.getPrimaryQuote(N.recordId),N}catch(N){o.handleError(N.message)}}async function S(){var B,$;console.info("getOrgInformation",r.value);const N=await window.salesforceConnector.getOrgInformation();t.websocketUrl=N.websocketUrl,d.value=(B=N.locale)==null?void 0:B.replace("_","-"),b.value=N.user,h.value=N.orgName,v.value=N.orgId,u.value=N.orgType,m.value=N.packageVersion,y.value=($=N==null?void 0:N.pricingSchema)==null?void 0:$.toLowerCase()}function w(N){a.value=N,na(N)}return{id:r,origin:i,title:I,subTitle:a,locale:d,user:b,orgName:h,orgId:v,orgType:u,packageVersion:m,objectType:c,recordInfo:s,name:g,accountId:f,eCatalogId:l,currencyCode:p,userLocale:_,opportunityId:C,pricingSchema:y,isSinglePricingSchema:O,flyoutState:E,start:V,getRecordInfo:T,setSubTitle:w}}),tl="https://api-svc.blink.expedite1.com/api/product-pricing/evaluateConfigurationSelection",nl={productJSON:{productItem:{configRules:[{publishKey:"rule-a1",name:"If latest is optA include optB",priority:1,enforceRule:!0,ruleJson:'{"latestSelected":"optA","actionType":"include","affectedOptions":["optB"]}'}]}},currentConfig:{product:{publishKey:"prod-1",attributes:[]},options:[]},selected:{publishKey:"optA",attributes:[]}};async function rl(t=nl){const o=tl;try{const n=await fetch(o,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`HTTP error! status: ${n.status} ${n.statusText}`);return await n.json()}catch(n){throw console.info("Error fetching data with Fetch API:",n),n}}function ol(t){const o=n=>Math.min(...n.options.map(r=>r.relationshipInfo.primarySortOrder));return t.forEach(n=>{n.itemTypes.forEach(r=>{r.options.sort((i,a)=>i.relationshipInfo.primarySortOrder-a.relationshipInfo.primarySortOrder||i.itemName.localeCompare(a.itemName))}),n.itemTypes.sort((r,i)=>o(r)-o(i)||r.itemTypeName.localeCompare(i.itemTypeName))}),t.sort((n,r)=>{const i=Math.min(...n.itemTypes.map(o)),a=Math.min(...r.itemTypes.map(o));return i-a||n.category.localeCompare(r.category)}),t}const il=(t,o)=>{const n=(r,i)=>typeof i=="function"?void 0:i;return JSON.stringify(t,n)===JSON.stringify(o,n)},it=Ke.defineStore("configurator-main",()=>{const t=Kn(),o=ht(),n=dt(),r=ot(),i=an(),a=e.ref(null),d=e.ref(null),b=e.ref(null),h=e.ref(null),v=e.ref([]),u=e.ref(null),m=e.ref(null),s=e.ref(new Map),g=e.ref(!1),c=e.ref({configuration:!1,lineItem:!1,productOptionsPricing:!1,bestOfferPrice:!1,lineItemAttributes:!1,save:!1}),f=e.ref(!1),l=e.computed(()=>p.value&&!o.isSinglePricingSchema),p=e.computed(()=>{let R=!0,M=!0,j=!0,F=null;for(const Z of b.value.categoryOptions)for(const G of Z.itemTypes)for(const ie of G.options)ie.billingPeriod&&(F&&F!==ie.billingPeriod&&(j=!1),F=ie.billingPeriod,!ie.yrcPrice&&ie.billingPeriod==="Monthly"&&(R=!1),!ie.mrcPrice&&ie.billingPeriod==="Yearly"&&(M=!1));return R&&M&&j}),_=e.computed(()=>!il(b.value,h.value)),C=e.computed(()=>{const R=b.value.categoryOptions;return R.forEach(M=>{M.itemTypes.forEach(j=>{j.selectedOptions=j.options.filter(F=>j.selected.includes(F.itemId)),j.totalPrice=function(){return j.selectedOptions.reduce((F,Z)=>F+Z.price*Z.qty,0)||0},j.oneTimePrice=function(){return j.selectedOptions.filter(F=>!F.billingPeriod).reduce((F,Z)=>F+Z.price*Z.qty,0)||0},j.recurringPrice=function(){return j.selectedOptions.filter(F=>F.billingPeriod).reduce((F,Z)=>F+Z.price*Z.qty,0)||0}}),M.selectedItemTypes=M.itemTypes.filter(j=>j.selected.length>0),M.totalPrice=function(){return M.itemTypes.reduce((j,F)=>j+F.totalPrice(),0)},M.oneTimePrice=function(){return M.itemTypes.reduce((j,F)=>j+F.oneTimePrice(),0)},M.recurringPrice=function(){return M.itemTypes.reduce((j,F)=>j+F.recurringPrice(),0)}}),R.filter(M=>M.itemTypes.filter(j=>j.selected.length>0).length>0)}),y=e.computed(()=>C.value.reduce((R,M)=>R+M.totalPrice(),0)),E=e.computed(()=>{const R=C.value.reduce((F,Z)=>F+Z.totalPrice(),0);let M=C.value.reduce((F,Z)=>F+Z.oneTimePrice(),0),j=C.value.reduce((F,Z)=>F+Z.recurringPrice(),0);return b.value.billingPeriod?j=(j+b.value.price)*b.value.qty:M=(M+b.value.price)*b.value.qty,{basePrice:b.value.price,addOns:R,oneTimePrice:M,recurringPrice:j,total:b.value.price*b.value.qty+R*b.value.qty+M+j}}),I=e.computed(()=>{const R=new Map;return R.set(u.value.productLineItem.XX_ORD1__Item__c,u.value.productLineItem),u.value.options.forEach(M=>{R.set(M.XX_ORD1__Item__c,M)}),R}),O=e.computed(()=>{const R=new Map;return b.value.categoryOptions.forEach(M=>{M.itemTypes.forEach(j=>{j.options.forEach(F=>{R.set(F.relationshipInfo.publishKey,F)})})}),R}),V=e.computed(()=>{const R=new Map;return R.set(m.value.product.XX_ORD1__Item__c,m.value.product),m.value.options.forEach(M=>{R.set(M.XX_ORD1__Item__c,M)}),R});function T(R){b.value.qliId&&(b.value.qliBillingPeriod==="Monthly"&&!R?b.value.price=b.value.qliSalesPrice||b.value.qliMrcPrice:b.value.qliBillingPeriod==="Yearly"&&R&&(b.value.price=b.value.qliSalesPrice)),b.value.categoryOptions.forEach(M=>{M.itemTypes.forEach(j=>{j.options.forEach(F=>{F.billingPeriod&&(F.price=(R?F.yrcPrice.offerPrice:F.mrcPrice.offerPrice)||F.price,F.qliId&&(F.qliBillingPeriod==="Monthly"&&!R?F.price=F.qliSalesPrice||F.qliMrcPrice:F.qliBillingPeriod==="Yearly"&&R&&(F.price=F.qliSalesPrice)))})})})}function S(){b.value=null,h.value=null,v.value=[],u.value=null,m.value=null,s.value=new Map,g.value=!1,c.value.configuration=!1,c.value.lineItem=!1,c.value.productOptionsPricing=!1,c.value.bestOfferPrice=!1,c.value.lineItemAttributes=!1,c.value.save=!1}async function w(R,M){S(),a.value=R||t.params.itemId,d.value=M||t.params.qliId,console.info("initConfigurator",a.value,d.value,n.quoteId);const j=await N();await W(),await ne(),b.value=$(j);const F=await P();B(F),await J();let Z=!1;for(const G of u.value.options)G.XX_ORD1__Billing_Period__c==="Yearly"&&(Z=!0);Z&&(f.value=!0,T(!0)),h.value=JSON.parse(JSON.stringify(b.value))}async function N(){try{console.info("itemId",a.value);const R=await window.productManagerController.getProductConfiguration({itemId:a.value});console.info("getProductConfiguration:result",R);const M=JSON.parse(R.data).productItem;return M.categoryOptions=ol(M.categoryOptions),M}catch(R){return console.info("error",R.message),!1}}function B(R){const M=new Map;M.set(m.value.product.Id,m.value.product.XX_ORD1__Item__c),m.value.options.forEach(F=>{M.set(F.Id,F.XX_ORD1__Item__c)});const j=new Map;if(R.forEach(F=>{const Z={};F.pricingTypes.forEach(G=>{G.appliedOnField==="Catalog Price"?Z.catalogPrice=G:G.appliedOnField==="MRC"?Z.mrcPrice=G:G.appliedOnField==="YRC"&&(Z.yrcPrice=G)}),Z.billingPeriod=F.billingPeriod,Z.mrcPrice&&!o.isSinglePricingSchema?Z.price=Z.mrcPrice.offerPrice:Z.catalogPrice&&o.isSinglePricingSchema&&(Z.price=Z.catalogPrice.offerPrice),Z.offer={offerDiscount:F.offerDiscount,offerId:F.offerId,offerType:F.offerType},j.set(M.get(F.eCatalogItemId),Z)}),j.has(b.value.itemId)){const F=j.get(b.value.itemId),Z=b.value.price;Object.assign(b.value,F),b.value.qliId&&(b.value.price=Z)}b.value.categoryOptions.forEach(F=>{F.itemTypes.forEach(Z=>{Z.options.forEach(G=>{if(j.has(G.itemId)){const ie=j.get(G.itemId),se=G.price;Object.assign(G,ie),G.qliId&&(G.price=se)}})})})}function $(R){R.isAttributes=R.attributes&&R.attributes.length>0,s.value.set(d.value,R.attributes),v.value=R.configRules;const M=new Set;return v.value.forEach(j=>{const F=JSON.parse(j.ruleJson);F.optionSelected.forEach(Z=>{M.add(Z)}),F.affectedOptions.forEach(Z=>{M.add(Z)})}),U(R),R.categoryOptions.forEach(j=>{j.key=j.category.toLowerCase().replace(/\s+/g,"-").replace(/[&]/g,""),j.itemTypes.forEach(F=>{F.selected=[],F.options=F.options.filter(Z=>V.value.has(Z.itemId)),F.numberOfColumns||(F.numberOfColumns=1),F.numberOfColumns>1&&(F.lightboxAttributes=!0),F.maxNumber||(F.maxNumber=100),F.minNumber||(F.minNumber=0),F.maxQuantity||(F.maxQuantity=1e4),F.minQuantity||(F.minQuantity=1),F.maxNumber===1?(F.isRadio=!0,F.minMessage="Please select 1 option",F.maxMessage="",F.isKit=F.options.some(Z=>Z.relationshipInfo.relationship==="Kit")):(F.minMessage=`Minimum of ${F.minNumber} selection${F.minNumber!==1?"s":""} required`,F.maxMessage=`Maximum of ${F.maxNumber} selection${F.maxNumber!==1?"s":""} allowed`),F.options.forEach(Z=>{j.showImage=j.showImage||!!Z.defaultImageURL,Z.showAttributesModal=!1,Z.calculateRules=M.has(Z.relationshipInfo.publishKey),Z.qty=F.minQuantity||1,Z.getTags=()=>(Z.attributes=Z.attributes||[],Z.attributes.filter(G=>G.value!==null&&G.value!=="").map(G=>({label:G.label,value:G.value}))),Object.defineProperty(Z,"isDisabled",{get:function(){return Z.relationshipInfo.relationship==="Kit"||(F.isRadio?F.isKit:!F.selected.includes(Z.itemId)&&F.maxNumber===F.selected.length)}}),U(Z),(I.value.has(Z.itemId)||Z.relationshipInfo.relationship==="Kit")&&F.selected.push(Z.itemId)})})}),R}function U(R){R.isAttributes=R.attributes&&R.attributes.length>0;const M=V.value.get(R.itemId);if(I.value.has(R.itemId)){const j=I.value.get(R.itemId);R.qliId=j.Id,R.qty=j.XX_ORD1__QTY__c,R.itemName=j.XX_ORD1__Line_Description__c,R.billingPeriod=j.XX_ORD1__Billing_Period__c,R.price=j.XX_ORD1__Sales_Price__c,R.billingPeriod?R.price=j.XX_ORD1__Sales_Price__c||j.XX_ORD1__MRC__c:R.price=j.XX_ORD1__NRC__c||j.XX_ORD1__Sales_Price__c,R.qliSalesPrice=j.XX_ORD1__Sales_Price__c,R.qliNrcPrice=j.XX_ORD1__NRC__c,R.qliMrcPrice=j.XX_ORD1__MRC__c,R.qliBillingPeriod=j.XX_ORD1__Billing_Period__c,s.value.set(R.qliId,R.attributes)}else R.itemName=M.XX_ORD1__Line_Description__c||R.itemName,R.price=M.XX_ORD1__Negotiated_Price__c||M.XX_ORD1__NRC_for_New__c,R.nrcPrice=M.XX_ORD1__NRC_for_New__c}async function J(){console.info("getLineItemAttributes"),c.value.lineItemAttributes=!0;const M={lineItemIds:[u.value.productLineItem.Id,...u.value.options.map(Z=>Z.Id)]},j=await window.productManagerController.getLineItemAttributes({request:JSON.stringify(M)});console.info("getLineItemAttributes:result",j);const F=JSON.parse(j.data);for(const[Z,G]of Object.entries(F))if(s.value.has(Z)){const ie=s.value.get(Z),se=new Map;G==null||G.forEach(ue=>{se.set(ue.apiName,ue)}),ie==null||ie.forEach(ue=>{se.get(ue.apiName)&&(ue.value=se.get(ue.apiName).value||"",ue.dataType==="REFERENCE"&&(ue.referenceRecordId=se.get(ue.apiName).referenceRecordId||"",ue.referenceRecordId?ue.options=[{Name:ue.value||"",Id:ue.referenceRecordId}]:ue.options=[]))})}c.value.lineItemAttributes=!1}async function W(){c.value.lineItem=!0,console.info("getLineItems",n.quoteId,d.value);try{const R={objectId:n.quoteId,filters:{},additionalFields:["Name","XX_ORD1__Line_Description__c"],primarySort:{field:"CreatedDate",direction:"DESC"},productPage:{recordLimit:200,offset:0,productLineItemId:d.value}},M=await window.productManagerController.getLineItems({request:JSON.stringify(R)});return console.info("getLineItems:result",M),u.value=JSON.parse(M.data).products[0],console.info("result",M),c.value.lineItem=!1,M}catch(R){return console.info("error",R.message),c.value.lineItem=!1,!1}}async function ne(){c.value.productOptionsPricing=!0,console.info("getProductOptionsPricing");try{const R={objectId:n.quoteId,itemId:a.value},M=await window.productManagerController.getProductOptionsPricing({request:JSON.stringify(R)});return console.info("getProductOptionsPricing:result",M),m.value=JSON.parse(M.data),c.value.productOptionsPricing=!1,m.value}catch(R){return console.info("error",R.message),c.value.productOptionsPricing=!1,!1}}async function X(R){console.info("getRecords");try{const M=await window.productManagerController.getRecords({request:JSON.stringify(R)});return console.info("getRecords:result",M),JSON.parse(M.data)}catch(M){return console.info("error",M.message),!1}}async function P(){c.value.bestOfferPrice=!0,console.info("getBestOfferPrice");const R=[m.value.product.Id];m.value.options.forEach(M=>{R.push(M.Id)});try{const M=await x(R);return c.value.bestOfferPrice=!1,M}catch(M){return console.info("error",M.message),c.value.bestOfferPrice=!1,!1}}async function x(R){const M={accountId:o.accountId,eCatalogItemIds:R,pricePreference:"Heighest Priority"},j=await window.productManagerController.calculateBestOfferPrice({request:JSON.stringify(M)});return console.info("calculateBestOfferPrice:result",j),c.value.bestOfferPrice=!1,JSON.parse(j.data)}async function A(){g.value=!0,c.value.save=!0,console.info("maintainQuoteConfiguration");const R=[],M=[];b.value.categoryOptions.forEach(Z=>{Z.itemTypes.forEach(G=>{G.options.forEach(ie=>{G.selected.includes(ie.itemId)?R.push(L(ie)):ie.qliId&&M.push(ie.qliId)})})});const j={objectId:n.quoteId,eCatalogId:o.eCatalogId,isGenesisAI:!0,blinkUser:!1,optionsToRemove:M,grandFatheredOptionsToRemove:[],productLineItem:{...L(b.value),optionLineItems:R}};console.info("maintainQuoteConfiguration:request",j);const F=await window.productManagerController.maintainQuoteConfiguration({request:JSON.stringify(j)});if(console.info("maintainQuoteConfiguration:result",F),F!=null&&F.error){const Z={title:"Unable to Save Configuration",description:F.error,button:{label:"Back to Configuration",action:()=>{g.value=!1}},cancel:{label:"Quote List",action:()=>{i.push("/quote-item?id="+n.quoteId)}}};r.errorPopup=Z}else h.value=JSON.parse(JSON.stringify(b.value)),console.info("maintainQuoteConfiguration:result",F);c.value.save=!1}function L(R){const M={};R.isAttributes&&R.attributes.forEach(F=>{F.apiName.includes(".")||(F.dataType==="BOOLEAN"?M[F.apiName]=F.value?"true":"false":F.dataType==="REFERENCE"?M[F.apiName]=F.referenceRecordId:M[F.apiName]=F.value)});const j={attributes:M,itemId:R.itemId,lineItemId:R.qliId,lineDescription:R.itemName,qty:R.qty,billingPeriod:R.billingPeriod,...R.offer};return R.billingPeriod&&p.value&&!o.isSinglePricingSchema&&(j.billingPeriod=f.value?"Yearly":"Monthly"),!o.isSinglePricingSchema&&!R.billingPeriod?j.nrcPrice=R.price:(j.applyOnField="Catalog Price",j.salesPrice=R.price,j.nrcPrice=R.nrcPrice),j}async function z(){const R={objectId:o.eCatalogId,productItemId:a.value};try{let M=await window.productManagerController.getProductCrossSells({request:JSON.stringify(R)});if(console.info("getProductCrossSells:result",M),M=M.data?JSON.parse(M.data):{},M.crossSells.length===0)return M;const j=M.crossSells.map(G=>G.Id),F=await x(j),Z=new Map;return F.forEach(G=>{Z.set(G.eCatalogItemId,{...G,...G.pricingTypes[0]})}),M.crossSells.forEach(G=>{G.loading=!1,G.Name=G.XX_ORD1__Line_Description__c||G.XX_ORD1__Item__r.Name,G.Description=G.XX_ORD1__Item__r.XX_ORD1__Product_Description__c,Z.has(G.Id)?(G.Price=Z.get(G.Id).offerPrice,G.priceFormatted=Z.get(G.Id).formattedOfferPrice,G.offer={offerDiscount:Z.get(G.Id).offerDiscount,offerId:Z.get(G.Id).offerId,offerType:Z.get(G.Id).offerType}):(G.Price=G.XX_ORD1__List_Price2__c,G.priceFormatted=G.XX_ORD1__List_Price2__c,G.offer={offerDiscount:0,offerId:null,offerType:null})}),M}catch(M){return console.info("error",M.message),!1}}async function K(R,M){var G,ie;const j={product:{publishKey:b.value.publishKey,lineDescription:b.value.itemName},options:[]};b.value.categoryOptions.forEach(se=>{se.itemTypes.forEach(ue=>{ue.options.forEach(ce=>{ue.selected.includes(ce.itemId)&&j.options.push({publishKey:ce.relationshipInfo.publishKey,lineDescription:ce.itemName})})})}),console.info("evaluateConfigSelection:currentConfig.options",j.options);const F={productJSON:{productItem:{configRules:v.value}},currentConfig:j,selected:R?{publishKey:(G=R.relationshipInfo)==null?void 0:G.publishKey,attributes:R.attributes,lineDescription:R.itemName}:{},unselected:M?{publishKey:(ie=M.relationshipInfo)==null?void 0:ie.publishKey,attributes:M.attributes,lineDescription:M.itemName}:{}};return await rl(F)}async function D(){try{const R=["Name","XX_ORD1__Line_Description__c","XX_ORD1__Item__r.XX_ORD1__Product_Description__c","XX_ORD1__Sales_Price__c","XX_ORD1__SYS_Configuration_Status2__c"],j=(await n.getQuoteLineItemsWithFilteredTable({fields:R,recordId:n.quoteId,filters:[],includeOptions:!1,totalFields:[]})).lineItems;return console.info("fetchQuoteLineItems:res",j),j}catch(R){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",R.message)}}async function H(R){const M={quoteId:n.quoteId,lstQLIRequest:[{eCatalogItemId:R.Id,quantity:1,offerApplicable:R.offer}]};try{const j=await window.productManagerController.createQuoteProducts({request:JSON.stringify(M)});console.info("getProductCrossSells:result",j)}catch(j){return console.info("error",j.message),!1}}return{itemId:a,configuration:b,_configurationCopy:h,lineItem:u,savedScreen:g,loading:c,summary:C,addOns:y,summaryPrices:E,optionByItemId:I,attributesByQLIId:s,optionByPublishKey:O,showYearlyPricing:f,isYearlyPricingExist:p,isChangedConfiguration:_,isRecurringPricingSchema:l,changePricingScheme:T,createQuoteProducts:H,resetConfigurator:S,fetchQuoteLineItems:D,getRecords:X,getProductCrossSells:z,initConfigurator:w,maintainQuoteConfiguration:A,evaluateConfigSelection:K}}),al={class:"ect-p-4 ect-flex ect-gap-2 ect-items-center ect-justify-between ect-border-b ect-border-gray-200"},ll={class:"ect-flex ect-items-center ect-gap-3"},sl={class:"ect-text-xl ect-font-semibold ect-text-gray-700 ect-leading-relaxed"},cl={key:0,class:"ect-flex ect-gap-1.5 ect-items-center"},dl=e.createElementVNode("span",{class:"ect-text-sm ect-text-gray-700 ect-leading-relaxed"},"Saving configuration...",-1),ul={key:1,class:"ect-flex ect-gap-1.5 ect-items-center"},fl=e.createElementVNode("span",{class:"ect-text-sm ect-text-gray-700 ect-leading-relaxed"},"Configuration Saved Successfully",-1),hl={key:1,class:"ect-flex ect-flex-col ect-gap-4 ect-flex-1 ect-overflow-y-auto ect-mb-16"},pl=e.createElementVNode("h3",{class:"ect-text-lg ect-font-semibold ect-text-gray-700 ect-leading-relaxed ect-p-4 ect-pb-0"},"You may consider these products",-1),ml={class:"ect-flex ect-flex-col ect-gap-4 ect-p-4 ect-pt-0 ect-overflow-y-auto"},gl=["data-test-id"],yl={class:"ect-flex-1 ect-flex ect-flex-col ect-gap-2"},bl={class:"ect-text-sm ect-font-semibold ect-text-gray-800 ect-leading-tight"},_l={class:"ect-text-sm ect-font-medium ect-text-gray-600 ect-leading-relaxed ect-line-clamp-2"},vl={class:"ect-flex ect-flex-row ect-justify-between ect-items-center"},Cl={class:"ect-text-sm ect-font-semibold ect-text-gray-800"},El={key:2,class:"ect-flex ect-flex-col ect-gap-4 ect-m-4 ect-flex-1 ect-overflow-y-auto"},kl=e.createElementVNode("h3",{class:"ect-text-lg ect-font-semibold ect-text-gray-700 ect-leading-relaxed"},"What do you want to do next?",-1),wl={class:"ect-flex ect-flex-col ect-gap-4"},Nl=["data-test-id","onClick"],xl={class:"ect-flex ect-items-center ect-justify-center"},Ol={class:"ect-flex ect-flex-col ect-items-center ect-gap-2 ect-w-full"},Sl=["data-test-id"],Vl=["data-test-id"],Il={key:3,class:"ect-bg-light-bg-x ect-border-t ect-border-gray-200 ect-flex-shrink-0 ect-sticky ect-bottom-0 ect-pb-4"},Tl={class:"ect-flex ect-flex-col ect-gap-4"},Al={class:"ect-text-lg ect-font-semibold ect-text-gray-700 ect-leading-relaxed ect-p-4 ect-pb-0"},Bl={class:"ect-flex ect-flex-col ect-gap-4 ect-p-4 ect-pt-0 ect-overflow-y-auto"},Ll={class:"ect-bg-white ect-border ect-border-gray-300 ect-rounded-md ect-p-3 ect-flex ect-flex-col","data-test-id":"configurator-recommend-card-next-product"},Ml={class:"ect-flex-1 ect-flex ect-flex-col ect-gap-2"},Pl={class:"ect-text-sm ect-font-semibold ect-text-gray-800 ect-leading-tight"},Rl={class:"ect-text-sm ect-font-medium ect-text-gray-600 ect-leading-relaxed ect-line-clamp-2"},ql={class:"ect-flex ect-flex-row ect-justify-between ect-items-center"},Dl={class:"ect-text-sm ect-font-semibold ect-text-gray-800"},jl={__name:"ConfiguratorRecommend",setup(t){const o=it(),n=dt(),r=an(),i=e.computed(()=>o.configuration),a=e.ref(!0),d=e.ref(""),b=e.ref([{icon:"configuration",title:"Back to current Product Configuration",description:"Returns to the active product configuration page.",link:"/item/overview",action:"backToConfiguration"},{icon:"menu",title:"Back to Quote List Page",description:"Returns to the main quote list page.",link:"/quote-item",action:"backToQuoteList"}]),h=e.ref(null),v=e.ref([]),u=async c=>{c.loading=!0,await o.createQuoteProducts(c),c.disabled=!0,c.loading=!1},m=c=>{c.action==="backToConfiguration"?o.savedScreen=!1:c.action==="backToQuoteList"?r.push("/quote-item?id="+n.quoteId):c.link&&r.push(c.link)};async function s(){const c=await o.fetchQuoteLineItems();console.info("getQuoteLineItems1:_quoteLineItems",c);const f=c.filter(p=>p.XX_ORD1__SYS_Configuration_Status2__c=="Needs Configuration").length;console.info("getQuoteLineItems2:needsConfigurationCount",f),d.value=`(${c.length-f}/${c.length})`;const l=c.find(p=>p.XX_ORD1__SYS_Configuration_Status2__c=="Needs Configuration"&&p.Id!=o.qliId);return console.info("getQuoteLineItems3:result",l),h.value=l?{Name:l.XX_ORD1__Line_Description__c,Description:l.XX_ORD1__Item__r.XX_ORD1__Product_Description__c,Price:l.XX_ORD1__Sales_Price__c,XX_ORD1__Item__c:l.XX_ORD1__Item__c,Id:l.Id}:null,console.info("getQuoteLineItems4:configueredProduct",h.value),c}async function g(){o.resetConfigurator(),r.push({path:"/configurator/"+h.value.XX_ORD1__Item__c+"/"+h.value.Id}),o.initConfigurator(h.value.XX_ORD1__Item__c,h.value.Id)}return e.onBeforeMount(async()=>{a.value=!0;const c=await s(),f=await o.getProductCrossSells(),l=new Set;c.forEach(p=>{l.add(p.XX_ORD1__Item__c)}),f.crossSells.forEach(p=>{p.disabled=l.has(p.XX_ORD1__Item__c)}),v.value=f.crossSells||[],a.value=!1}),(c,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",al,[e.createElementVNode("div",ll,[e.createVNode(we,{icon:"arrow",symbol:"",size:12,onClick:f[0]||(f[0]=l=>e.unref(o).savedScreen=!1)}),e.createElementVNode("h2",sl,e.toDisplayString(i.value.itemName),1)]),e.unref(o).loading.save?(e.openBlock(),e.createElementBlock("div",cl,[e.createVNode(so,{svg:""}),dl])):(e.openBlock(),e.createElementBlock("div",ul,[e.createVNode(we,{icon:"check",color:"#136E05",size:14,"data-test-id":"item-tabs-before-button-icon"}),fl]))]),a.value?(e.openBlock(),e.createBlock(zn,{key:0,type:"recommendations",rows:4})):v.value.length>0?(e.openBlock(),e.createElementBlock("div",hl,[pl,e.createElementVNode("div",ml,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,(l,p)=>(e.openBlock(),e.createElementBlock("div",{key:l.Id||p,class:"ect-bg-white ect-border ect-border-gray-300 ect-rounded-md ect-p-3 ect-flex ect-flex-col","data-test-id":`configurator-recommend-card-${l.Id||p}`},[e.createElementVNode("div",yl,[e.createElementVNode("h4",bl,e.toDisplayString(l.Name),1),e.createElementVNode("p",_l,e.toDisplayString(l.Description),1)]),e.createElementVNode("div",vl,[e.createElementVNode("div",Cl,e.toDisplayString(c.$formatCurrency(l.Price)),1),e.createVNode(ze,{btype:l.disabled?"secondary":"primary","button-style":l.disabled?"normal":"outlined",size:"medium",class:e.normalizeClass({"ect-w-[120px]":l.loading}),loading:l.loading,disabled:l.disabled||l.loading,"data-test-id":`configurator-recommend-button-add-${l.Id||p}`,onClick:_=>u(l)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.loading?"":l.disabled?"Added to Quote":"Add to Quote"),1)]),_:2},1032,["btype","button-style","class","loading","disabled","data-test-id","onClick"])])],8,gl))),128))])])):(e.openBlock(),e.createElementBlock("div",El,[kl,e.createElementVNode("div",wl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(l,p)=>(e.openBlock(),e.createElementBlock("div",{key:l.title||p,class:"ect-bg-white ect-border ect-border-[#DEDEDE] ect-rounded-xl ect-p-4 md:ect-p-5 lg:ect-p-6 ect-flex ect-flex-col ect-items-center ect-gap-4 md:ect-gap-6 lg:ect-gap-8 ect-cursor-pointer ect-transition-all ect-duration-200 hover:ect-shadow-md hover:ect-border-gray-400","data-test-id":`configurator-recommend-redirect-card-${p}`,onClick:_=>m(l)},[e.createElementVNode("div",xl,[e.createVNode(we,{icon:l.icon,size:20,color:"#000000","data-test-id":`configurator-recommend-redirect-icon-${p}`},null,8,["icon","data-test-id"])]),e.createElementVNode("div",Ol,[e.createElementVNode("h4",{class:"ect-text-sm ect-font-semibold ect-text-[#5F5F5F] ect-text-center ect-leading-[1.43]","data-test-id":`configurator-recommend-redirect-title-${p}`},e.toDisplayString(l.title),9,Sl),e.createElementVNode("p",{class:"ect-text-sm ect-font-normal ect-text-[#828282] ect-text-center ect-leading-[1.71]","data-test-id":`configurator-recommend-redirect-description-${p}`},e.toDisplayString(l.description),9,Vl)])],8,Nl))),128))])])),h.value?(e.openBlock(),e.createElementBlock("footer",Il,[e.createElementVNode("div",Tl,[e.createElementVNode("h3",Al," Configuere next product from your quote "+e.toDisplayString(d.value),1),e.createElementVNode("div",Bl,[e.createElementVNode("div",Ll,[e.createElementVNode("div",Ml,[e.createElementVNode("h4",Pl,e.toDisplayString(h.value.Name),1),e.createElementVNode("p",Rl,e.toDisplayString(h.value.Description),1)]),e.createElementVNode("div",ql,[e.createElementVNode("div",Dl,e.toDisplayString(c.$formatCurrency(h.value.Price)),1),e.createVNode(ze,{btype:"primary","button-style":"filled",size:"medium","data-test-id":"configurator-recommend-button-add-next-product",onClick:g},{default:e.withCtx(()=>[e.createTextVNode(" Configure Now ")]),_:1})])])])])])):e.createCommentVNode("",!0)],64))}},$l=["data-test-id"],Fl=ke({__name:"AppPill",props:{variant:{type:String,default:"",validator:t=>["success","error",""].includes(t)},dataTestId:{type:String,default:""}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["ect-pill",{"ect-pill-success":t.variant==="success","ect-pill-error":t.variant==="error","ect-pill-default":!t.variant}]),"data-test-id":t.dataTestId},[e.renderSlot(o.$slots,"default",{},void 0,!0)],10,$l))}},[["__scopeId","data-v-c7f05fa0"]]),Hl=["data-test-id"],Ul=["data-test-id"],zl=["data-test-id","onClick"],Kl=["data-test-id"],Zl=ke({__name:"AppTabsV2",props:{showTabs:{type:Boolean,default:!0},modelValue:{type:String,default:""},border:{type:Boolean,default:!1},tabs:{type:Array,required:!0,validator:t=>t.every(o=>typeof o=="object"&&o.title&&o.key&&(o.sections===void 0||Array.isArray(o.sections)))},dataTestId:{type:String,required:!0}},emits:["update:modelValue","tab-change"],setup(t,{emit:o}){const n=t,r=o,i=e.computed(()=>{var d;return n.modelValue||((d=n.tabs[0])==null?void 0:d.key)||""}),a=d=>{r("update:modelValue",d),r("tab-change",d)};return(d,b)=>(e.openBlock(),e.createElementBlock("div",{class:"ect-page-tabs","data-test-id":t.dataTestId},[t.showTabs?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ect-page-tabs-header",[{"ect-tab-border":t.border}]]),"data-test-id":`${t.dataTestId}-header`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tabs,h=>(e.openBlock(),e.createElementBlock("button",{key:h.key,class:e.normalizeClass(["ect-page-tab-button",`ect-page-tab-button${i.value===h.key?"-active":""} ${h.tabClass||""}`]),"data-test-id":`${t.dataTestId}-tab-${h.key}`,onClick:v=>a(h.key)},[e.createTextVNode(e.toDisplayString(h.title)+" ",1),h.pill!==void 0&&h.pill!==null?(e.openBlock(),e.createBlock(Fl,{key:0,class:"ect-ml-2",variant:h.pillStyle,"data-test-id":`${t.dataTestId}-tab-${h.key}-pill`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.pill),1)]),_:2},1032,["variant","data-test-id"])):e.createCommentVNode("",!0)],10,zl))),128))],10,Ul)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"ect-page-tab-content","data-test-id":`${t.dataTestId}-content`},null,8,Kl)],8,Hl))}},[["__scopeId","data-v-f22cb1ed"]]),Ql=["data-test-id"],Xl=["disabled","data-test-id"],Jl=["value","disabled","data-test-id"],Wl=["disabled","data-test-id"],cn={__name:"CounterButton",props:{value:{type:Number,required:!0,default:null},min:{type:Number,default:1},max:{type:Number,default:999},empty:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},dataTestId:{type:String,required:!0}},emits:["update:value","change"],setup(t,{emit:o}){const n=t,r=o,i=e.computed(()=>n.min==null?0:n.min),a=e.computed(()=>n.max==null?999:n.max),d=(y,E,I)=>Math.min(Math.max(y,E),I),b=y=>{if(y==null||y==="")return NaN;const E=Number(y);return Number.isFinite(E)?E:NaN},h=e.ref(null),v=e.ref(n.value??i.value),u=y=>{v.value=d(y,i.value,a.value)};n.value!==null&&u(n.value);const m=e.computed(()=>v.value),s=e.computed(()=>h.value!=null?h.value:String(m.value)),g=e.computed(()=>n.disabled||m.value<=i.value),c=e.computed(()=>n.disabled||m.value>=a.value);function f(y){y!==n.value&&(v.value=y,r("update:value",y),r("change",y))}function l(){if(g.value)return;const y=d(m.value-1,i.value,a.value);h.value=null,f(y)}function p(){if(c.value)return;const y=d(m.value+1,i.value,a.value);h.value=null,f(y)}function _(y){const I=String(y.target.value??"").replace(/\D+/g,"");h.value=I}function C(){const y=b(h.value),E=i.value,I=d(Number.isNaN(y)?E:y,i.value,a.value);h.value=null,f(I)}return(y,E)=>(e.openBlock(),e.createElementBlock("div",{class:"ect-flex ect-items-center ect-gap-1","data-test-id":t.dataTestId},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ect-h-7 ect-w-7 ect-border ect-border-gray ect-rounded-md ect-flex ect-items-center ect-justify-center ect-text-gray-700 ect-text-sm hover:ect-border-gray-400 ect-transition-colors ect-bg-white",{"ect-opacity-50":g.value,"ect-cursor-not-allowed":g.value}]),disabled:g.value,"data-test-id":`${t.dataTestId}-decrement`,onClick:l}," - ",10,Xl),e.createElementVNode("input",{type:"text",inputmode:"numeric",pattern:"[0-9]*",value:t.empty?"":s.value,disabled:t.disabled,class:"ect-h-7 ect-w-[48px] ect-px-2 ect-border ect-border-gray ect-rounded-md ect-text-center ect-text-sm ect-font-medium ect-text-gray-900 focus:ect-outline-none focus:ect-border-gray-400 ect-bg-white","data-test-id":`${t.dataTestId}-input`,onInput:_,onBlur:C},null,40,Jl),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ect-h-7 ect-w-7 ect-border ect-border-gray ect-rounded-md ect-flex ect-items-center ect-justify-center ect-text-gray-700 ect-text-sm hover:ect-border-gray-400 ect-transition-colors ect-bg-white",{"ect-opacity-50":c.value,"ect-cursor-not-allowed":c.value}]),disabled:c.value,"data-test-id":`${t.dataTestId}-increment`,onClick:p}," + ",10,Wl)],8,Ql))}},Gl={class:"ect-flex ect-justify-end ect-items-center ect-gap-2.5 ect-px-6 ect-pb-6 ect-pt-4 ect-bg-white ect-border-t ect-border-gray-300 ect-shadow-[0_-2px_4px_0px_rgba(0,0,0,0.11)]","data-test-id":"configurator-footer"},Yl={"data-test-id":"configurator-footer-quantity"},es={class:"ect-flex ect-justify-end ect-items-center ect-gap-6 ect-px-8 ect-py-0 ect-flex-1","data-test-id":"configurator-footer-prices"},ts=["data-test-id"],ns=["data-test-id"],rs=["data-test-id"],os=["data-test-id"],is={__name:"ConfiguratorFooter",props:{item:{type:Object,required:!0,default:()=>{}},disabled:{type:Boolean,default:!1},btnText:{type:String,default:"Save"}},emits:["update:qty","continue"],setup(t,{emit:o}){const n=it(),r=t,i=e.ref(r.item),a=e.computed(()=>{const h=n.summaryPrices,v=[];return n.isRecurringPricingSchema?(v.push({label:"One Time Price",value:h.oneTimePrice,highlight:!1}),v.push({label:n.showYearlyPricing?"Yearly Price":"Monthly Price",value:h.recurringPrice,highlight:!1})):(v.push({label:"Base Price",value:h.basePrice,highlight:!1}),v.push({label:"Add Ons",value:h.addOns,highlight:!1}),v.push({label:"Total Price",value:h.total,highlight:!1})),v}),d=o,b=()=>{r.disabled||d("continue")};return(h,v)=>(e.openBlock(),e.createElementBlock("footer",Gl,[e.createElementVNode("div",Yl,[e.createVNode(cn,{value:i.value.qty,"onUpdate:value":v[0]||(v[0]=u=>i.value.qty=u),min:1,max:999,disabled:t.disabled,"is-selected":!0,"data-test-id":"configurator-footer-counter-button"},null,8,["value","disabled"])]),e.createElementVNode("div",es,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(u,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:m},[e.createElementVNode("div",{class:"ect-flex ect-flex-col ect-justify-center","data-test-id":`configurator-footer-price-${m}`},[e.createElementVNode("span",{class:"ect-text-xs ect-font-normal ect-text-gray-500 ect-text-left","data-test-id":`configurator-footer-price-label-${m}`},e.toDisplayString(u.label),9,ns),e.createElementVNode("span",{class:e.normalizeClass(["ect-text-left",u.highlight?"ect-text-lg ect-font-bold ect-text-green-700":"ect-text-sm ect-font-medium ect-text-gray-800 "]),"data-test-id":`configurator-footer-price-value-${m}`},e.toDisplayString(u.value),11,rs)],8,ts),m<a.value.length-1?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ect-w-0 ect-h-5 ect-border-l ect-border-gray-400","data-test-id":`configurator-footer-divider-${m}`},null,8,os)):e.createCommentVNode("",!0)],64))),128))]),e.createVNode(ze,{class:"ect-min-w-[100px]",btype:t.disabled?"secondary":"primary",disabled:t.disabled,"button-style":"primary",size:"medium","data-test-id":"configurator-footer-button-continue",onClick:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.btnText),1)]),_:1},8,["btype","disabled"])]))}},as={class:"ect-w-full ect-bg-white ect-mb-4","data-test-id":"configurator-type-section"},ls={class:"ect-sticky ect-top-0 ect-z-30 ect-bg-white ect-shadow-sm ect-p-3 ect-px-4 ect-border-b ect-border-gray-200 ect-flex ect-justify-between ect-items-center","data-test-id":"configurator-type-header-sticky"},ss={class:"ect-flex ect-flex-col"},cs={class:"ect-font-bold ect-text-text-success ect-leading-tight"},ds=["innerHTML"],us={key:0,class:"ect-flex ect-items-center ect-gap-2 ect-px-2 ect-py-1","data-test-id":"configurator-type-message"},fs={class:"ect-text-xs ect-font-medium ect-text-gray-600 ect-leading-tight ect-min-w-[190px]"},hs={class:"ect-divide-y ect-divide-gray-100 ect-overflow-y-auto"},ps={__name:"ConfiguratorType",props:{title:{type:String,required:!0},description:{type:String,default:""},message:{type:String,default:""}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("section",as,[e.createElementVNode("header",ls,[e.createElementVNode("div",ss,[e.createElementVNode("h2",cs,e.toDisplayString(t.title),1),t.description?(e.openBlock(),e.createElementBlock("p",{key:0,class:"ect-mt-1 ect-text-xs ect-text-gray-500 ect-leading-tight",innerHTML:t.description},null,8,ds)):e.createCommentVNode("",!0)]),t.message?(e.openBlock(),e.createElementBlock("div",us,[e.createVNode(we,{icon:"info",symbol:"",color:"#198708",size:14,"data-test-id":"configurator-type-message-icon"}),e.createElementVNode("span",fs,e.toDisplayString(t.message),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",hs,[e.renderSlot(o.$slots,"default")])]))}},ms={__name:"ShadowDisplay",props:{content:{type:String,required:!0}},setup(t){const o=t,n=e.ref(null);let r=null;return e.onMounted(()=>{n.value&&!r&&(r=n.value.attachShadow({mode:"open"}),r.innerHTML=o.content)}),e.watch(()=>o.content,i=>{r&&(r.innerHTML=i)}),(i,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"host",ref:n},null,512))}},gs=["data-test-id"],ys=["data-test-id"],bs=["data-test-id"],_s=[e.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("g",{id:"Group"},[e.createElementVNode("path",{id:"Vector",d:"M7 1.3125V12.6875",stroke:"#A86200","stroke-linecap":"round","stroke-linejoin":"round"}),e.createElementVNode("path",{id:"Vector_2",d:"M1.3125 7H12.6875",stroke:"#A86200","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)],vs=["data-test-id"],Cs=["data-test-id"],Es=["data-test-id"],ks=["data-test-id"],ws=["data-test-id"],Ns=["data-test-id","innerHTML"],Ge={__name:"Tag",props:{label:{type:String,default:""},value:{type:String,default:""},addButton:{type:Boolean,default:!1},editButton:{type:Boolean,default:!1},dataTestId:{type:String,default:""}},setup(t){const o=t,n=e.computed(()=>{const r=o.value;if(typeof r!="string")return!1;const i=new DOMParser().parseFromString(r,"text/html");return Array.from(i.body.childNodes).some(a=>a.nodeType===1)});return(r,i)=>t.addButton?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ect-bg-orange-4 ect-flex ect-gap-1 ect-justify-center ect-items-center ect-px-2 ect-py-0.5 ect-text-xs ect-font-medium ect-text-center ect-rounded-md ect-border ect-border-solid ect-border-orange-secondary","data-test-id":t.dataTestId},[e.createElementVNode("span",{class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-orange-secondary ect-flex ect-items-center ect-gap-1","data-test-id":`${t.dataTestId}-content`},[e.createElementVNode("div",{"data-test-id":`${t.dataTestId}-add-icon`},_s,8,bs),e.createTextVNode(" "+e.toDisplayString(t.label),1)],8,ys)],8,gs)):t.editButton?(e.openBlock(),e.createElementBlock("div",{key:1,class:"ect-bg-white ect-flex ect-gap-1 ect-justify-center ect-items-center ect-px-2 ect-py-0.5 ect-text-xs ect-font-medium ect-text-center ect-rounded-md ect-border ect-border-solid ect-border-success","data-test-id":t.dataTestId},[e.createElementVNode("span",{class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-success ect-flex ect-items-center ect-gap-1","data-test-id":`${t.dataTestId}-content`},e.toDisplayString(t.label),9,Cs)],8,vs)):(e.openBlock(),e.createElementBlock("div",{key:2,class:"ect-bg-white ect-px-2 ect-py-0.5 ect-text-xs ect-font-medium ect-rounded-md ect-border ect-border-solid ect-border-neutral-200","data-test-id":t.dataTestId},[e.createElementVNode("span",{class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-zinc-500","data-test-id":`${t.dataTestId}-label`},e.toDisplayString(t.label),9,ks),t.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-zinc-500","data-test-id":`${t.dataTestId}-separator`}," : ",8,ws)):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createBlock(ms,{key:1,content:t.value},null,8,["content"])):t.value?(e.openBlock(),e.createElementBlock("span",{key:2,class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-neutral-700","data-test-id":`${t.dataTestId}-value`,innerHTML:t.value},null,8,Ns)):e.createCommentVNode("",!0)],8,Es))}},xs=["data-test-id"],Os=["data-test-id"],Ss=["data-test-id"],Vs=["type","step","min","data-test-id"],Qn=ke({__name:"InputEdit",props:{modelValue:{type:String,required:!0},type:{type:String,default:"string",validator:t=>["string","number","currency"].includes(t)},tag:{type:String,default:"span"},disabled:{type:Boolean,default:!1},dataTestId:{type:String,required:!0}},emits:["update:modelValue","change"],setup(t,{expose:o,emit:n}){const r=t,i=n,a=e.ref(!1),d=e.ref(!1),b=e.ref(""),h=e.ref(null),v=e.computed(()=>r.type==="currency"?p(r.modelValue):r.type==="number"?_(r.modelValue):r.modelValue),u=e.computed(()=>r.type==="string"?"text":"number"),m=e.computed(()=>r.type==="currency"?"0.01":void 0),s=e.computed(()=>r.type==="currency"?"0":void 0),g=()=>{r.disabled||(r.type==="currency"?b.value=parseFloat(r.modelValue)||"0.00":r.type==="number"?b.value=parseFloat(r.modelValue)||"0":b.value=r.modelValue,a.value=!0,e.nextTick(()=>{h.value&&(h.value.focus(),h.value.select())}))},c=()=>{let C=b.value;if(r.type==="number"||r.type==="currency"){const y=parseFloat(b.value);isNaN(y)?C=r.modelValue:C=r.type==="currency"?y.toFixed(2):y.toString()}C!==r.modelValue&&(i("update:modelValue",C),i("change",C)),a.value=!1},f=()=>{b.value=r.modelValue,a.value=!1},l=()=>{a.value&&c()},p=C=>!C||isNaN(C)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(parseFloat(C)),_=C=>!C||isNaN(C)?"0":new Intl.NumberFormat("en-US").format(parseFloat(C));return e.watch(()=>r.modelValue,C=>{a.value||(b.value=C)}),o({startEditing:g,saveChanges:c,cancelEditing:f}),(C,y)=>{const E=e.resolveDirective("click-outside");return e.openBlock(),e.createElementBlock("div",{class:"ect-relative ect-inline-block ect-min-w-[60px] ect-h-[30px]","data-test-id":t.dataTestId,onMouseenter:y[1]||(y[1]=I=>d.value=!0),onMouseleave:y[2]||(y[2]=I=>d.value=!1)},[a.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:1,class:"ect-w-full ect-h-full","data-test-id":`${t.dataTestId}-input-wrapper`},[e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:h,"onUpdate:modelValue":y[0]||(y[0]=I=>b.value=I),type:u.value,step:m.value,min:s.value,class:e.normalizeClass(["ect-w-full ect-h-full ect-px-3 ect-bg-white ect-border ect-border-green-500 ect-rounded-sm ect-text-gray-700 ect-text-base ect-font-sans ect-outline-none ect-duration-200",C.$attrs.class]),"data-test-id":`${t.dataTestId}-input`,onKeyup:[e.withKeys(c,["enter"]),e.withKeys(f,["esc"])],onBlur:c},null,42,Vs),[[e.vModelDynamic,b.value]])],8,Ss)),[[E,l]]):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ect-flex ect-items-center ect-gap-2 ect-rounded ect-transition-colors ect-duration-200",{"ect-cursor-pointer":!t.disabled}]),"data-test-id":`${t.dataTestId}-display`,onClick:g},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.tag),e.mergeProps(C.$attrs,{class:"ect-m-0 ect-text-inherit","data-test-id":`${t.dataTestId}-text`}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v.value)+" ",1),e.createVNode(we,{class:e.normalizeClass(d.value&&!t.disabled?"ect-visible":"ect-invisible"),icon:"edit",size:"12",color:"#828282","data-test-id":`${t.dataTestId}-edit-icon`},null,8,["class","data-test-id"])]),_:1},16,["data-test-id"]))],10,Os))],40,xs)}}},[["__scopeId","data-v-07416d80"]]),Is=["data-test-id","data-publish-key"],Ts={key:0,class:"ect-text-xs ect-text-gray-500 ect-text-white ect-font-medium ect-leading-tight ect-absolute ect-top-[-.7rem] ect-left-[-1rem] ect-bg-text-success ect-rounded-xl ect-px-2 ect-py-1"},As={key:1,class:"ect-flex ect-items-start ect-gap-4 ect-p-3 ect-px-4"},Bs={key:0,class:"ect-w-16 ect-h-16 ect-flex ect-items-center ect-justify-center ect-rounded-lg ect-bg-gray-200 ect-flex-shrink-0"},Ls=["src","alt"],Ms={class:"ect-flex-1 ect-min-w-0"},Ps={class:"ect-flex ect-gap-4 ect-items-center ect-justify-between"},Rs={class:"ect-flex ect-flex-row ect-gap-3"},qs=e.createElementVNode("div",{class:"ect-w-px ect-h-auto ect-bg-gray-200 ect-mx-2"},null,-1),Ds={class:"ect-flex ect-flex-col ect-max-w-[125px]"},js={class:"ect-flex ect-items-start ect-justify-center ect-ml-2 ect-mt-0"},$s=["innerHTML"],Fs={key:0,class:"ect-flex ect-flex-wrap ect-gap-2.5 ect-mt-2"},Hs=["data-test-id"],Us=["data-test-id"],zs={key:1,class:"ect-inline-block ect-mb-2"},Ks={key:2,class:"ect-flex ect-flex-col ect-gap-3 ect-p-3 ect-h-full ect-justify-between"},Zs={class:"ect-flex ect-items-start ect-gap-2"},Qs={class:"ect-w-16 ect-h-16 ect-rounded-lg ect-bg-gray-200 ect-flex-shrink-0 ect-overflow-hidden"},Xs=["src","alt"],Js={class:"ect-flex-1 ect-min-w-0"},Ws={class:"ect-text-sm ect-font-semibold ect-text-gray-900 ect-leading-tight"},Gs={class:"ect-mt-1 ect-text-sm ect-text-gray-700 ect-leading-tight"},Ys={class:"ect-flex ect-items-start ect-justify-center ect-ml-2 ect-mt-0"},ec={key:0,class:"ect-flex ect-flex-wrap ect-gap-1.5"},tc=["data-test-id"],nc=["data-test-id"],rc={key:1,class:"ect-inline-block ect-mb-2"},oc={class:"ect-flex ect-justify-between ect-items-center"},ic={class:"ect-flex ect-flex-col"},ac=e.createElementVNode("p",{class:"ect-text-xs ect-text-gray-500 ect-font-medium ect-leading-tight"},"Price",-1),lc={key:3,"data-test-id":"configurator-item-slot-details",class:"ect-bg-white ect-rounded-md"},sc={__name:"ConfiguratorItem",props:{item:{type:Object,required:!0},name:{type:String,required:!0},description:{type:String,default:""},imageUrl:{type:String,default:""},price:{type:Number,required:!0},quantity:{type:Number,default:1},selected:{type:Boolean,default:!1},tags:{type:Array,default:()=>[]},attributes:{type:Array,default:()=>[]},size:{type:Number,default:1},minQuantity:{type:Number,default:null},maxQuantity:{type:Number,default:null},showImage:{type:Boolean,default:!1},option:{type:Object,default:null},isAttributes:{type:Boolean,default:!1},showAttributes:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:quantity","update:name","edit-attributes"],setup(t,{emit:o}){const n=t,r=o,i=e.ref(null),a=e.ref(0),d=e.ref(n.item),b=e.computed(()=>d.value.relationshipInfo.relationship==="Kit"?"ect-bg-green-3 ect-border-gray-200 ect-border-success":n.disabled?"ect-bg-light-bg-x ect-border-gray-200":n.selected?"ect-bg-green-3 ect-border-gray-200 ect-border-success":"ect-bg-white ect-border-gray-200 hover:ect-border-success"),h=e.computed({get:()=>n.quantity,set:c=>r("update:quantity",c)}),v=e.computed({get:()=>n.name,set:c=>r("update:name",c)}),u=c=>{r("update:quantity",c)},m=e.computed(()=>{if(a.value===0)return n.tags;const f=Math.floor(a.value/120);return n.tags.slice(0,Math.max(1,f))}),s=e.computed(()=>Math.max(0,n.tags.length-m.value.length)),g=()=>{if(i.value){const c=i.value,f=80,l=120,p=32,_=64;a.value=c.offsetWidth-f-l-p-_}};return e.onMounted(()=>{e.nextTick(()=>{g()})}),e.watch(()=>n.tags,()=>{e.nextTick(()=>{g()})},{deep:!0}),e.onMounted(()=>{window.addEventListener("resize",g)}),(c,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"containerRef",ref:i,class:e.normalizeClass(["ect-w-full ect-rounded-md ect-border-1 ect-transition-colors ect-relative",b.value]),"data-test-id":`configurator-item-${t.item.itemId}`,"data-publish-key":t.item.publishKey},[t.item.relationshipInfo.relationship==="Kit"?(e.openBlock(),e.createElementBlock("div",Ts," KIT ")):e.createCommentVNode("",!0),t.size===1?(e.openBlock(),e.createElementBlock("div",As,[t.showImage?(e.openBlock(),e.createElementBlock("div",Bs,[t.imageUrl?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.imageUrl,alt:v.value,class:"ect-w-full ect-h-full ect-object-cover"},null,8,Ls)):(e.openBlock(),e.createBlock(we,{key:1,disabled:"",icon:"image",symbol:"",size:20,color:"#ACACAC"}))])):e.createCommentVNode("",!0),e.createElementVNode("div",Ms,[e.createElementVNode("div",Ps,[e.createVNode(Qn,{modelValue:v.value,"onUpdate:modelValue":f[0]||(f[0]=l=>v.value=l),tag:"h3",class:"ect-text-sm ect-font-semibold ect-text-gray-900 ect-leading-tight"},null,8,["modelValue"]),e.createElementVNode("div",Rs,[e.createElementVNode("div",{onClick:f[2]||(f[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(cn,{value:h.value,"onUpdate:value":f[1]||(f[1]=l=>h.value=l),min:t.minQuantity,max:t.maxQuantity,"data-test-id":`configurator-item-counter-${t.item.itemId}`,onChange:u},null,8,["value","min","max","data-test-id"])]),qs,e.createElementVNode("div",Ds,[e.createVNode(Qn,{modelValue:d.value.price,"onUpdate:modelValue":f[3]||(f[3]=l=>d.value.price=l),tag:"p",type:"currency",class:"ect-text-base ect-font-bold"},null,8,["modelValue"])]),e.createElementVNode("div",js,[e.renderSlot(c.$slots,"selection-control")])])]),e.createElementVNode("p",{class:"ect-mt-2 ect-text-sm ect-text-gray-700 ect-leading-tight",innerHTML:t.description},null,8,$s),t.isAttributes&&t.showAttributes&&t.selected?(e.openBlock(),e.createElementBlock("div",Fs,[d.value.getTags().length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(l,p)=>(e.openBlock(),e.createElementBlock("span",{key:p,class:"ect-inline-block"},[e.createVNode(Ge,{label:l.label,value:l.value},null,8,["label","value"])]))),128)),s.value>0?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"ect-text-xs ect-text-gray-700 ect-border ect-border-gray-300 ect-rounded-md ect-px-2 ect-py-0.5","data-test-id":`configurator-item-button-more-tags-${t.item.itemId}`,onClick:f[4]||(f[4]=e.withModifiers(()=>{},["stop"]))}," +"+e.toDisplayString(s.value)+" more ",9,Hs)):e.createCommentVNode("",!0),t.selected?(e.openBlock(),e.createElementBlock("button",{key:1,"data-test-id":`configurator-item-button-edit-attributes-${t.item.itemId}`,onClick:f[5]||(f[5]=l=>r("edit-attributes"))},[e.createVNode(Ge,{label:"Edit attributes","edit-button":""})],8,Us)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock("span",zs,[e.createElementVNode("button",{"data-test-id":"configurator-info-button-add-attributes",onClick:f[6]||(f[6]=l=>r("edit-attributes"))},[e.createVNode(Ge,{label:"Add attributes","add-button":""})])]))])):e.createCommentVNode("",!0)])])):(e.openBlock(),e.createElementBlock("div",Ks,[e.createElementVNode("div",Zs,[e.createElementVNode("div",Qs,[t.imageUrl?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.imageUrl,alt:t.name,class:"ect-w-full ect-h-full ect-object-cover"},null,8,Xs)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Js,[e.createElementVNode("h3",Ws,e.toDisplayString(t.name),1),e.createElementVNode("p",Gs,e.toDisplayString(t.description),1)]),e.createElementVNode("div",Ys,[e.renderSlot(c.$slots,"selection-control")])]),t.isAttributes&&t.showAttributes&&t.selected?(e.openBlock(),e.createElementBlock("div",ec,[d.value.getTags().length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(l,p)=>(e.openBlock(),e.createElementBlock("span",{key:p,class:"ect-inline-block"},[e.createVNode(Ge,{label:l.label,value:l.value},null,8,["label","value"])]))),128)),s.value>0?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"ect-text-xs ect-text-gray-700 ect-border ect-border-gray-300 ect-rounded-md ect-px-2 ect-py-0.5","data-test-id":`configurator-item-button-more-tags-${t.item.itemId}`,onClick:f[7]||(f[7]=e.withModifiers(()=>{},["stop"]))}," +"+e.toDisplayString(s.value)+" more ",9,tc)):e.createCommentVNode("",!0),t.selected?(e.openBlock(),e.createElementBlock("button",{key:1,class:"ect-ml-auto","data-test-id":`configurator-item-button-edit-attributes-${t.item.itemId}`,onClick:f[8]||(f[8]=l=>r("edit-attributes"))},[e.createVNode(Ge,{label:"Edit attributes","edit-button":""})],8,nc)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock("span",rc,[e.createElementVNode("button",{"data-test-id":"configurator-info-button-add-attributes",onClick:f[9]||(f[9]=l=>r("edit-attributes"))},[e.createVNode(Ge,{label:"Add attributes","add-button":""})])]))])):e.createCommentVNode("",!0),e.createElementVNode("div",oc,[e.createElementVNode("div",{onClick:f[11]||(f[11]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(cn,{value:h.value,"onUpdate:value":f[10]||(f[10]=l=>h.value=l),min:t.minQuantity,max:t.maxQuantity,"data-test-id":`configurator-item-counter-${t.item.itemId}`,onChange:u},null,8,["value","min","max","data-test-id"])]),e.createElementVNode("div",ic,[ac,e.createVNode(Qn,{modelValue:d.value.price,"onUpdate:modelValue":f[12]||(f[12]=l=>d.value.price=l),tag:"p",type:"currency",class:"ect-w-[125px] ect-text-base ect-font-bold"},null,8,["modelValue"])])])])),t.selected&&t.isAttributes?(e.openBlock(),e.createElementBlock("div",lc,[e.renderSlot(c.$slots,"default")])):e.createCommentVNode("",!0)],10,Is))}},cc={"af-ZA":",","sq-AL":",","ar-DZ":",","ar-BH":"٫","ar-EG":"٫","ar-IQ":"٫","ar-JO":"٫","ar-KW":"٫","ar-LB":"٫","ar-LY":",","ar-MA":",","ar-OM":"٫","ar-QA":"٫","ar-SA":"٫","ar-SD":"٫","ar-SY":"٫","ar-TN":",","ar-AE":"٫","ar-YE":"٫","hy-AM":",","az-AZ":",","bn-BD":".","bn-IN":".","eu-ES":",","be-BY":",","bs-BA":",","bg-BG":",","my-MM":".","ca-ES":",","ca-ES-EURO":",","zh-CN":".","zh-CN-PINYIN":".","zh-CN-STROKE":".","zh-HK":".","zh-HK-STROKE":".","zh-MO":".","zh-SG":".","zh-TW":".","zh-TW-STROKE":".","hr-HR":",","cs-CZ":",","da-DK":",","nl-AW":",","nl-BE":",","nl-NL":",","nl-SR":",","dz-BT":".","en-AG":".","en-AU":".","en-BS":".","en-BB":".","en-BZ":".","en-BM":".","en-BW":".","en-CM":".","en-CA":".","en-DE":",","en-KY":".","en-ER":".","en-FK":".","en-FJ":".","en-GM":".","en-GH":".","en-GI":".","en-GY":".","en-HK":".","en-IN":".","en-ID":".","en-IE":".","en-IE-EURO":".","en-JM":".","en-KE":".","en-LR":".","en-MG":".","en-MW":".","en-MY":".","en-MU":".","en-NA":".","en-NZ":".","en-NG":".","en-PK":".","en-PG":".","en-PH":".","en-RW":".","en-WS":".","en-SC":".","en-SL":".","en-SG":".","en-SX":".","en-SB":".","en-ZA":",","en-SH":".","en-SZ":".","en-TZ":".","en-TO":".","en-TT":".","en-UG":".","en-GB":".","en-US":".","en-VU":".","et-EE":",","fi-FI":",","fi-FI-EURO":",","fr-BE":",","fr-CA":",","fr-KM":",","fr-FR":",","fr-FR-EURO":",","fr-GN":",","fr-HT":",","fr-LU":",","fr-MR":",","fr-MC":",","fr-CH":",","fr-WF":",","ka-GE":",","de-AT":",","de-AT-EURO":",","de-BE":",","de-DE":",","de-DE-EURO":",","de-LU":",","de-LU-EURO":",","de-CH":".","el-GR":",","gu-IN":".","iw-IL":".","hi-IN":".","hu-HU":",","is-IS":",","in-ID":",","ga-IE":".","it-IT":",","it-CH":".","ja-JP":".","kn-IN":".","kk-KZ":",","km-KH":",","ko-KP":".","ko-KR":".","ky-KG":",","lo-LA":",","lv-LV":",","lt-LT":",","lu-CD":",","lb-LU":",","mk-MK":",","ms-BN":",","ms-MY":".","ml-IN":".","mt-MT":".","mi-NZ":".","mr-IN":".","ne-NP":".","no-NO":",","ps-AF":"٫","fa-IR":"٫","pl-PL":",","pt-AO":",","pt-BR":",","pt-CV":",","pt-MZ":",","pt-PT":",","pt-ST":",","ro-MD":",","ro-RO":",","rm-CH":".","rn-BI":",","ru-KZ":",","ru-RU":",","sr-BA":",","sr-RS":",","sh-BA":",","sh-ME":",","sh-ME-USD":",","sh-CS":",","sk-SK":",","sl-SI":",","so-DJ":".","so-SO":".","es-AR":",","es-BO":",","es-CL":",","es-CO":",","es-CR":",","es-CU":".","es-DO":".","es-EC":",","es-SV":".","es-GT":".","es-HN":".","es-MX":".","es-NI":".","es-PA":".","es-PY":",","es-PE":".","es-PR":".","es-ES":",","es-ES-EURO":",","es-US":".","es-UY":",","es-VE":",","sw-KE":".","sv-SE":",","tl-PH":".","tg-TJ":",","ta-IN":".","ta-LK":".","te-IN":".","th-TH":".","ti-ET":".","tr-TR":",","uk-UA":",","ur-PK":".","uz-LATN-UZ":",","vi-VN":",","cy-GB":".","xh-ZA":".","yo-BJ":".","zu-ZA":"."},dc={name:"CustomInput",components:{AppIcon:we},props:{editMode:{type:Boolean,default:!0},type:{type:String,default:"text"},max:{type:Number,default:500},label:{type:String,default:""},name:{type:String,default:""},showLabel:{type:Boolean,default:!0},modelValue:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},isReadOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},highlight:{type:Boolean,default:!1},placeholder:{type:String,default:""},error:{type:[Boolean,String],default:!1},cssClass:{type:Object,default:()=>({})},tooltip:{type:String,default:null},locale:{type:String,default:"en-US"},icon:{type:String,default:null},itooltip:{type:String,default:null},icolor:{type:String,default:"#7d7d7d"},ihover:{type:String,default:"#57c046"},icustom:{type:Boolean,default:!1},idisabled:{type:Boolean,default:!1},height:{type:Number,default:32},textAlignment:{type:String,default:"left"},decimalPrecision:{type:Number,default:0},allowNegatives:{type:Boolean,default:!1},size:{type:String,default:"medium"},dataTestId:{type:String,required:!0}},emits:["update:modelValue","iclick","blur"],data(){return{initialValue:"",decimalSeprator:".",ctrl:!1}},computed:{getValue(){return this.modelValue?this.type==="currency"?String(this.modelValue).replace(".",this.decimalSeprator):String(this.modelValue):""},error_message(){return typeof this.error=="string"?this.error:this.error===""?!1:this.error===!0?`${this.label||"Field"} is required`:this.error},isHighlight(){return(this.initialValue===""||this.initialValue===null)&&(this.modelValue===""||this.modelValue===null)?!1:this.initialValue!==this.modelValue}},created(){this.initialValue=this.modelValue,this.decimalSeprator=this.type==="currency"?cc[this.locale]:"."},methods:{handlerInput(t){const o=t.target.value;this.type==="currency"?this.$emit("update:modelValue",o.replace(this.decimalSeprator,".")):this.$emit("update:modelValue",o)},preventNonNumeric(t){if(this.type==="number"){const o=this.decimalPrecision,n=t.target.value,r=t.key;if(["Backspace","ArrowLeft","ArrowRight","Delete","Tab"].includes(r)||this.allowNegatives&&r==="-")return;if(r==="."&&o===0){t.preventDefault();return}if(r==="."&&n.includes(".")){t.preventDefault();return}if(r==="."||n.includes(".")&&!n.endsWith(".")&&r!=="Backspace"){const i=n.split(".");if(i.length>1&&i[1].length>=o){t.preventDefault();return}}if(isNaN(r)&&![".","Backspace","Tab"].includes(r)){t.preventDefault();return}}if(t.key==="Backspace"||this.ctrl)return!0;if(t.key==="Control"&&(this.ctrl=!0),this.type==="currency"||this.type==="number"){if(!this.getValue.includes(this.decimalSeprator)&&t.key===this.decimalSeprator)return!0;/[\deE+\-]/.test(t.key)||t.preventDefault()}return!0},handlerKeyup(t){t.key==="Control"&&(this.ctrl=!1)}}},uc=["data-test-id"],fc=["for","data-test-id"],hc=["data-test-id"],pc=["id","type","name","disabled","placeholder","value","maxlength","readonly","data-test-id"],mc=["data-test-id"],gc=["data-test-id"];function yc(t,o,n,r,i,a){const d=e.resolveComponent("AppIcon");return e.openBlock(),e.createElementBlock("div",{class:"input","data-test-id":n.dataTestId},[n.label&&n.showLabel?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass({error_color:!!n.error}),for:n.label,"data-test-id":`${n.dataTestId}-label`},[e.createTextVNode(e.toDisplayString(n.label)+" ",1),n.required?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass({error_color:!!n.error})},"*",2)):e.createCommentVNode("",!0)],10,fc)):e.createCommentVNode("",!0),n.editMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["input-wrapper ect-w-full",{errorBorder_color:!!n.error,highlight:a.isHighlight&&n.highlight}]),"data-test-id":`${n.dataTestId}-wrapper`},[n.icon?(e.openBlock(),e.createBlock(d,{key:0,class:"input-wrapper_icon",icon:n.icon,hover:n.ihover,color:n.icolor,size:19,disabled:n.idisabled,custom:n.icustom,tooltip:n.itooltip,"data-test-id":`${n.dataTestId}-icon`,direction:"top-right",onClick:o[0]||(o[0]=b=>t.$emit("iclick"))},null,8,["icon","hover","color","disabled","custom","tooltip","data-test-id"])):e.createCommentVNode("",!0),e.createElementVNode("input",{id:n.label,class:e.normalizeClass(`ectheme-input-box ${n.size}`),type:n.type,style:e.normalizeStyle({width:n.icon?"calc(100% - 36px)":"100%",height:`${n.height}px`,textAlign:n.textAlignment}),name:n.name,disabled:n.disabled,placeholder:n.placeholder,value:a.getValue,maxlength:n.max,readonly:n.isReadOnly,"data-test-id":`${n.dataTestId}-input`,onInput:o[1]||(o[1]=(...b)=>a.handlerInput&&a.handlerInput(...b)),onKeydown:o[2]||(o[2]=(...b)=>a.preventNonNumeric&&a.preventNonNumeric(...b)),onKeyup:o[3]||(o[3]=(...b)=>a.handlerKeyup&&a.handlerKeyup(...b)),onBlur:o[4]||(o[4]=b=>t.$emit("blur"))},null,46,pc)],10,hc)):e.createCommentVNode("",!0),n.editMode?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("p",{key:2,class:"value","data-test-id":`${n.dataTestId}-value`},e.toDisplayString(a.getValue),9,mc)),a.error_message?(e.openBlock(),e.createElementBlock("div",{key:3,class:"error_tooltip error_tooltip-bottom-right","data-test-id":`${n.dataTestId}-error`},e.toDisplayString(a.error_message),9,gc)):e.createCommentVNode("",!0)],8,uc)}const bc=ke(dc,[["render",yc],["__scopeId","data-v-032ca141"]]),_c={name:"AtomSpinner",props:{dataTestId:{type:String,default:""}}},vc=["data-test-id"];function Cc(t,o,n,r,i,a){return e.openBlock(),e.createElementBlock("div",{class:"spinner","data-test-id":n.dataTestId},null,8,vc)}const Ec={name:"CustomDropdown",components:{AppIcon:we,AtomSpinner:ke(_c,[["render",Cc],["__scopeId","data-v-771ed032"]])},props:{label:{type:String,default:""},placeholder:{type:String,default:""},options:{type:Array,default:()=>[]},display:{type:Array,default:()=>[]},modelValue:{type:String,default:""},error:{type:[Boolean,String],default:!1},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},select:{type:Boolean,default:!1},lookup:{type:Boolean,default:!1},search:{type:Boolean,default:!1},badge:{type:String,default:void 0},highlight:{type:Boolean,default:!1},property:{type:Object,default:()=>({key:"value",value:"label",assigned:"assigned"})},dropdownTheme:{type:String,default:"light"},icon:{type:String,default:""},size:{type:String,default:"medium"},dataTestId:{type:String,required:!0}},emits:["search","focus-in","focus-out","update:modelValue"],data:()=>({inputFocused:!1,value:"",isHover:!1,highlightedIndex:-1,initialValue:"",teleportStyle:{position:"absolute",top:"0px",left:"0px",width:"0px"}}),computed:{isHighlight(){return(this.initialValue===""||this.initialValue==null)&&(this.modelValue===""||this.modelValue==null)?!1:this.initialValue!==this.modelValue},error_message(){return this.error===""?!1:this.error===!0?`${this.label||"Field"} is required`:this.error},getOptions(){if(this.select&&this.search){const t=this.value.toLowerCase();return this.options.filter(o=>JSON.stringify(o).toLowerCase().includes(t))}else return this.options},getSelected(){let t=null;if(this.modelValue)t=this.options.find(o=>o[this.property.key]===this.modelValue);else if(!this.search){const o=this.options.find(n=>n[this.property.key]==="");o?t=o:this.placeholder?t={[this.property.value]:this.placeholder,[this.property.key]:""}:t={[this.property.value]:"--Select--",[this.property.key]:""}}return t||{[this.property.value]:this.placeholder||"--Select--",[this.property.key]:""}},shouldShowAbove(){if(!this.$refs.triggerElement)return!1;const t=this.$refs.triggerElement.getBoundingClientRect(),o=250,n=window.innerHeight-t.bottom,r=t.top;return n<o&&r>o},dropdownStyle(){if(!this.$refs.triggerElement)return{};const t=this.$refs.triggerElement.getBoundingClientRect(),o=250,n=window.innerHeight-t.bottom,r=t.top,i=n<o&&r>o;return{position:"absolute",top:i?"auto":"100%",bottom:i?"100%":"auto",left:"0",width:"100%",zIndex:1e3}}},created(){this.initialValue=this.modelValue},mounted(){window.addEventListener("resize",this.updateDropdownPosition),window.addEventListener("scroll",this.updateDropdownPosition,!0)},beforeUnmount(){window.removeEventListener("resize",this.updateDropdownPosition),window.removeEventListener("scroll",this.updateDropdownPosition,!0)},methods:{updateDropdownPosition(){if(!this.$refs.triggerElement)return;const t=this.$refs.triggerElement.getBoundingClientRect(),o=200,n=window.innerHeight-t.bottom,r=t.top,i=n<o&&r>o;this.teleportStyle={position:"absolute",top:`${i?t.top-o:t.bottom}px`,left:`${t.left}px`,width:`${t.width}px`,zIndex:9999}},subFieldsText(t){if(!this.display||this.display.length<1)return"";const o=[];return this.display.forEach(n=>{const r=this.subField(t,n);r&&o.push(r)}),o.join(" | ")},subField(t,o){return o?o.split(".").reduce((i,a)=>i[a]||"",t):t},lookupSearchHandler:oo(function(t){this.value=t,this.search&&!this.select&&this.$emit("search",t)}),handlerFocusIn(){!(this.modelValue&&this.search)&&!this.disabled&&(this.inputFocused=!0,this.updateDropdownPosition(),this.$emit("focus-in"))},updateSelected(t){t&&(this.value="",this.$emit("update:modelValue",t[this.property.key]),this.search&&!this.select&&!this.lookup&&this.$emit("search",""),this.onInputFocusedOut(!0))},clear(){this.disabled||(this.value="",this.$emit("update:modelValue",null),this.search&&!this.select&&!this.lookup&&this.$emit("search",""))},onInputFocusedOut(t=!1){(!this.isHover||t)&&!this.disabled&&(t?(this.highlightedIndex=-1,this.inputFocused=!1,this.$emit("focus-out")):setTimeout(()=>{this.highlightedIndex=-1,this.inputFocused=!1,this.$emit("focus-out")},100))},highlightNextOption(){this.highlightedIndex<this.options.length-1&&this.highlightedIndex++},highlightPreviousOption(){this.highlightedIndex>0&&this.highlightedIndex--}}},kc=["data-test-id"],wc=["for","data-test-id"],Nc={class:"input-container-box ect-grow ect-w-full"},xc=["data-test-id"],Oc=["placeholder","disabled","data-test-id"],Sc=["data-test-id"],Vc=["title","data-test-id"],Ic=["data-test-id"],Tc=["data-test-id"],Ac=["data-test-id"],Bc=["data-test-id"],Lc=["data-test-id","onClick"],Mc=["data-test-id"],Pc={class:"ect-text-font-clr-light ect-flex ect-gap-2 ect-items-center ect-justify-between ect-w-full"},Rc=["data-test-id"],qc=["data-test-id"],Dc=["data-test-id"],jc=["title","data-test-id"],$c=["data-test-id"];function Fc(t,o,n,r,i,a){const d=e.resolveComponent("AppIcon"),b=e.resolveComponent("AtomSpinner");return e.openBlock(),e.createElementBlock("div",{ref:"dropdownWrapper",class:e.normalizeClass(["customdropdown input-container",{dark:n.dropdownTheme==="dark"}]),"data-test-id":n.dataTestId,onMouseenter:o[7]||(o[7]=h=>t.isHover=!0),onMouseleave:o[8]||(o[8]=h=>t.isHover=!1)},[n.label?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass(["title_label",{error_color:!!n.error}]),for:n.label,"data-test-id":`${n.dataTestId}-label`},[e.createTextVNode(e.toDisplayString(n.label)+" ",1),n.required?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass({error_color:!!n.error})},"*",2)):e.createCommentVNode("",!0)],10,wc)):e.createCommentVNode("",!0),e.createElementVNode("div",Nc,[e.createElementVNode("div",{ref:"triggerElement",class:e.normalizeClass(["input-wrapper ectheme-input-box ect-w-full",{disabled:n.disabled,"input-error":n.error,highlight:a.isHighlight&&n.highlight,"size-large":n.size==="large","size-medium":n.size==="medium"||n.size==="small"}]),"data-test-id":`${n.dataTestId}-trigger`,tabindex:"0",onFocusin:o[2]||(o[2]=(...h)=>a.handlerFocusIn&&a.handlerFocusIn(...h)),onFocusout:o[3]||(o[3]=h=>a.onInputFocusedOut(!1)),onKeydown:[o[4]||(o[4]=e.withKeys(h=>a.updateSelected(n.options[t.highlightedIndex]),["enter"])),o[5]||(o[5]=e.withKeys(e.withModifiers((...h)=>a.highlightPreviousOption&&a.highlightPreviousOption(...h),["prevent"]),["up"])),o[6]||(o[6]=e.withKeys(e.withModifiers((...h)=>a.highlightNextOption&&a.highlightNextOption(...h),["prevent"]),["down"]))]},[!n.modelValue&&n.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref:"searchInput","onUpdate:modelValue":o[0]||(o[0]=h=>t.value=h),type:"text",name:"search",placeholder:n.placeholder,autocomplete:"off",disabled:n.disabled,"data-test-id":`${n.dataTestId}-search-input`,onInput:o[1]||(o[1]=e.withModifiers(h=>a.lookupSearchHandler(h.target.value),["prevent"]))},null,40,Oc)),[[e.vModelText,t.value]]):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["selection-name ect-text-text-primary-dark ect-flex ect-justify-between ect-items-center",{"size-large":n.size==="large","size-medium":n.size==="medium"||n.size==="small"}]),"data-test-id":`${n.dataTestId}-selection`},[a.getSelected?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("span",{title:a.getSelected[n.property.value],class:e.normalizeClass(["ect-flex ect-items-center ect-gap-2 ect-font-medium",{"ect-text-font-clr-light":!n.modelValue}]),"data-test-id":`${n.dataTestId}-selection-value`},[n.icon?(e.openBlock(),e.createBlock(d,{key:0,class:"ect-mr-0",icon:n.icon,size:14,color:"#5F5F5F","data-test-id":`${n.dataTestId}-selection-icon`},null,8,["icon","data-test-id"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(a.getSelected[n.property.value]),1)],10,Vc),n.badge&&a.getSelected[n.badge]?(e.openBlock(),e.createElementBlock("span",{key:0,class:"badge ect-bg-btn ect-rounded-[5px] ect-py-[2px] ect-px-[10px] ect-text-white","data-test-id":`${n.dataTestId}-selection-badge`},e.toDisplayString(a.getSelected[n.badge]),9,Ic)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],10,Sc)),n.search?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[n.loading?(e.openBlock(),e.createBlock(b,{key:0,class:"spinner","data-test-id":`${n.dataTestId}-loading-spinner`},null,8,["data-test-id"])):(e.openBlock(),e.createElementBlock("div",{key:1,class:"clear-button","data-test-id":`${n.dataTestId}-action-button`},[t.value||n.modelValue?(e.openBlock(),e.createBlock(d,{key:0,disabled:n.disabled,icon:"close",color:"#acacac",size:10,"data-test-id":`${n.dataTestId}-clear-button`,onClick:a.clear},null,8,["disabled","data-test-id","onClick"])):(e.openBlock(),e.createBlock(d,{key:1,icon:"search",size:14,color:"#acacac",disabled:n.disabled,"data-test-id":`${n.dataTestId}-search-button`},null,8,["disabled","data-test-id"]))],8,Tc))],64)):(e.openBlock(),e.createBlock(d,{key:3,class:"clear-button",color:a.error_message?"#ff6a6a":"#acacac",icon:"arrow_drop_up",size:12,disabled:n.disabled,"data-test-id":`${n.dataTestId}-dropdown-arrow`},null,8,["color","disabled","data-test-id"]))],42,xc),a.error_message?(e.openBlock(),e.createElementBlock("div",{key:0,class:"error_tooltip error_tooltip-bottom-right","data-test-id":`${n.dataTestId}-error`},e.toDisplayString(a.error_message),9,Ac)):e.createCommentVNode("",!0),a.getOptions&&t.inputFocused&&!n.disabled&&(n.select||n.lookup)?(e.openBlock(),e.createElementBlock("div",{key:1,ref:"dropdown",class:e.normalizeClass(["dropdown",{"dropdown-above":a.shouldShowAbove}]),style:e.normalizeStyle(a.dropdownStyle),"data-test-id":`${n.dataTestId}-dropdown`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.getOptions,(h,v)=>(e.openBlock(),e.createElementBlock("div",{key:h[n.property.key],class:e.normalizeClass(["dropdown-item",{highlighted:v===t.highlightedIndex,"ect-pointer-events-none":h[n.property.assigned]}]),"data-test-id":`${n.dataTestId}-option-${v}`,onClick:u=>a.updateSelected(h)},[e.createElementVNode("div",{class:"name ect-items-center","data-test-id":`${n.dataTestId}-option-${v}-name`},[e.createElementVNode("span",Pc,[e.createElementVNode("span",{class:e.normalizeClass({"ect-text-zinc-400":h[n.property.assigned]}),"data-test-id":`${n.dataTestId}-option-${v}-value`},e.toDisplayString(h[n.property.value]==null?"Key and Value is Wrong":h[n.property.value]),11,Rc),h[n.property.assigned]?(e.openBlock(),e.createElementBlock("span",{key:0,class:"ect-text-xs ect-leading-4 ect-text-zinc-600","data-test-id":`${n.dataTestId}-option-${v}-assigned`},"Assigned",8,qc)):e.createCommentVNode("",!0)]),n.badge?(e.openBlock(),e.createElementBlock("span",{key:0,class:"badge ect-bg-btn ect-rounded-[5px] ect-py-[2px] ect-px-[10px] ect-text-white","data-test-id":`${n.dataTestId}-option-${v}-badge`},e.toDisplayString(h[n.badge]),9,Dc)):e.createCommentVNode("",!0)],8,Mc),e.createElementVNode("div",{class:"info",title:a.subFieldsText(h),"data-test-id":`${n.dataTestId}-option-${v}-info`},[e.createElementVNode("span",null,e.toDisplayString(a.subFieldsText(h)),1)],8,jc)],10,Lc))),128)),!a.getOptions.length&&!n.loading&&(t.value||n.select)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"no-items-found","data-test-id":`${n.dataTestId}-no-options`}," no options found ",8,$c)):e.createCommentVNode("",!0)],14,Bc)):e.createCommentVNode("",!0)])],42,kc)}const mo=ke(Ec,[["render",Fc],["__scopeId","data-v-5ae4f6dc"]]);var Oe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function go(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var yo={exports:{}};/*!
|
|
5
|
+
*/var co;(function(t){t.pop="pop",t.push="push"})(co||(co={}));var uo;(function(t){t.back="back",t.forward="forward",t.unknown=""})(uo||(uo={})),Symbol(process.env.NODE_ENV!=="production"?"navigation failure":"");var fo;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(fo||(fo={})),Symbol(process.env.NODE_ENV!=="production"?"router view location matched":""),Symbol(process.env.NODE_ENV!=="production"?"router view depth":"");const ja=Symbol(process.env.NODE_ENV!=="production"?"router":""),$a=Symbol(process.env.NODE_ENV!=="production"?"route location":"");Symbol(process.env.NODE_ENV!=="production"?"router view location":"");function an(){return e.inject(ja)}function Kn(){return e.inject($a)}function qe(t){if(typeof t=="string"&&(t=JSON.parse(t)),t!=null&&t.errorMessage)throw new Error(t==null?void 0:t.errorMessage);return t}const Zn={xx_ord1__item__c:"xx_ord1__item__c",xx_ord1__sales_price__c:"xx_ord1__negotiated_price__c",xx_ord1__nrc__c:"xx_ord1__nrc_for_new__c",xx_ord1__line_description__c:"xx_ord1__line_description__c",xx_ord1__list_price__c:"xx_ord1__list_price2__c",xx_ord1__cost__c:"xx_ord1__cost2__c",xx_ord1__rate_plan__c:"xx_ord1__rate_plan__c",xx_ord1__allowed_discount__c:"xx_ord1__allowed_discount__c",xx_ord1__billing_period__c:"xx_ord1__billing_period__c",xx_ord1__ship_to_account__c:"xx_ord1__ship_to_account__c",xx_ord1__erp_item_number__c:"xx_ord1__erp_item_number__c",xx_ord1__mrc__c:"xx_ord1__mrc__c",xx_ord1__qty__c:"xx_ord1__qty__c",id:"id"},ho={xx_ord1__item__c:"xx_ord1__item__c",xx_ord1__negotiated_price__c:"xx_ord1__sales_price__c",xx_ord1__nrc_for_new__c:"xx_ord1__nrc__c",xx_ord1__line_description__c:"xx_ord1__line_description__c",xx_ord1__list_price2__c:"xx_ord1__list_price__c",xx_ord1__cost2__c:"xx_ord1__cost__c",xx_ord1__rate_plan__c:"xx_ord1__rate_plan__c",xx_ord1__allowed_discount__c:"xx_ord1__allowed_discount__c",xx_ord1__billing_period__c:"xx_ord1__billing_period__c",xx_ord1__ship_to_account__c:"xx_ord1__ship_to_account__c",xx_ord1__erp_item_number__c:"xx_ord1__erp_item_number__c",xx_ord1__mrc__c:"xx_ord1__mrc__c",xx_ord1__qty__c:"xx_ord1__qty__c",id:"id"},Fa=t=>{var n;let o=[];for(let r of t)if(r.trim()!=="xx_ord1__item__r.xx_ord1__decimal_precision__c")if(r.includes(".")){let a=r.split(".")[0];a=a.slice(0,-1)+"c";const d=((n=Zn[a==null?void 0:a.toLowerCase()])==null?void 0:n.trim())||"";d&&(o.includes(d)||o.push(d||""),o.push(r))}else o.includes(Zn[r==null?void 0:r.toLowerCase()])||o.push(Zn[r==null?void 0:r.toLowerCase()]||"");return o.filter(r=>r!=="")},Ha=Ke.defineStore("actions",()=>{const t=sn(),o=dt(),n=e.ref(!1);return{openAdaptiveSearch:(b,h=!1)=>{console.info("openAdaptiveSearch",b),t.chatHistory[t.chatHistory.length-1].links=[],t.sendMessage("Open Adaptive Search",!1,{internalCall:!0}),n.value=h},openQuoteItem:b=>{console.info("openQuoteItem",b),t.chatHistory[t.chatHistory.length-1].links=[],t.sendMessage("Open Quote Item",!1,{internalCall:!0})},openQuoteDocument:b=>{console.info("openQuoteDocument",b),t.chatHistory[t.chatHistory.length-1].links=[],t.chatHistory.push({type:"response",message:"Opening quote document",loading:!0});const v=`/apex/XX_ORD1__Expedite_Commerce?scpq=true&oid=${o.quoteId}&atpverified=true&ecCache=false&origin=AI`;window.location.href=`${ta(window.location.href)}${v}`},undo:()=>{const b=t==null?void 0:t.latestDMLRequest;t.sendMessage(`UNDO-${b}`,!1,{internalCall:!0})},isStaticActionCall:n}}),po=Ke.defineStore("adaptiveSearch",()=>{const t=dt(),o=ht(),n=sn(),r=Ha(),i=e.ref(null),a=e.ref(null),d=e.ref(!1),b=e.ref(!1),h=e.ref([]),v=e.ref(""),u=e.ref(!1),m=e.ref(null),s=e.ref(!1),g=e.ref([]),c=ot(),f=e.ref([]),l=e.ref(0),p=e.ref(!1),_=e.ref({rowLimt:10,paging:!0,offset:0,currentPage:1,totalPages:1});async function C(){d.value=!0;try{const x=JSON.stringify({layoutType:"Search Selection",layoutObject:"xx_ord1__ecatalog_item__c"});let A={};return A=await window.salesforceConnector.getDynamicPageLayout(x),a.value=lo(A,"Unable to find the Search Selection Layout for your user profile"),_.value.rowLimt=a.value.configuration.rowLimit||10,a.value.configuration.columns.forEach(L=>{!L.field&&L.label==="QTY"&&(L.field="xx_ord1__qty__c")}),d.value=!1,y(),A}catch(x){d.value=!1,c.handleError("Failed to get Adaptive Search Layout. Please try again."),console.info("[ERROR]: getAdaptiveSearchLayout() error = ",x)}}function y(){var x,A,L;m.value=(L=(A=(x=a.value)==null?void 0:x.configuration)==null?void 0:A.dynamicFilters)==null?void 0:L.filters.map(z=>({...z,field:z.field.toLowerCase(),filtervalue:z.filtervalue||[],filtervaluefrom:z.filtervaluefrom||"",filtervalueTo:z.filtervalueTo||""}))}function E(){var A;let x=[];for(const L of a.value.configuration.columns){let z=L.field;if(x.includes(z)||x.push(z),z!=null&&z.includes(".")){let D=z.split(".")[0];D=D.slice(0,-1)+"c",x.includes(D)||x.push(D)}}return(A=a.value.configuration)!=null&&A.cardHeader&&x.push(a.value.configuration.cardHeader.imageField),a.value.configuration.objectName.toLowerCase()==="xx_ord1__ecatalog_item__c"&&x.push("xx_ord1__item__r.xx_ord1__decimal_precision__c"),x=x.filter(L=>!!L),x.filter(L=>L.toLowerCase()!=="xx_ord1__qty__c"&&L.toLowerCase()!=="xx_ord1__competitor_sku__c")}function I(x,A=!1){if(!x||x.includes("undefined"))return!1;const L=/[!@#$%^&*()+=[\]{};':"\\|.<>/?]+/;if(A){const z=Array.isArray(x)?x:x.split(",");for(const K of z){const D=K.trim();if(L.test(D))return c.handleError(`Invalid character found in value: ${D}`),!1}}else if(L.test(x))return c.handleError("Special characters are not allowed in filter values"),!1;return!0}function O(x,A){return{field:x.field,operator:x.operator||"contains",value:A,dataType:x.dataType.trim()}}function V(x){if(!x.filtervalue)return null;const A=Array.isArray(x.filtervalue),L=A?x.filtervalue.join(","):x.filtervalue.trim();return I(L,A)?L:null}function T(x){var K,D;const A=(K=x.filtervaluefrom)==null?void 0:K.trim(),L=(D=x.filtervalueTo)==null?void 0:D.trim();if(!A||!L)return null;const z=`${A}, ${L}`;return z!==", "&&I(z)?z:null}function S(x){const A=`${ao(x.filtervaluefrom)}, ${ao(x.filtervalueTo)}`;return A!==", "&&I(A)?A:null}function w(x){var L;const A=(L=x.filtervaluefrom)==null?void 0:L.trim();return I(A)?A:null}function N(x){const A=[];return x.forEach(L=>{const z=L.dataType.trim();let K=null;switch(z){case"PICKLIST":case"MULTIPICKLIST":K=V(L);break;case"DOUBLE":case"CURRENCY":K=T(L);break;case"DATETIME":case"DATE":K=S(L);break;default:K=w(L)}K&&A.push(O(L,K))}),g.value=A,A}async function B(x="",A=[],L=[]){var K,D,H,R,M,j,F,Z,G,ie;let z=[];if(A.length&&(z=N(A)),!z.length&&x.trim()===""){h.value=[],u.value=!1;return}try{u.value=!1,b.value=!0;const se=x.trim();L.length||(L=E());const ue={fields:L,...A.length?{dynamicFilters:z}:{},searchText:se||v.value.trim(),accountId:o.accountId,...o.eCatalogId?{catalogId:o.eCatalogId}:{},...o.objectType==="opportunity"?{opportunityId:o.id}:{},...(D=(K=a.value)==null?void 0:K.configuration)!=null&&D.sort?{primarySortBy:a.value.configuration.sort.primary.field,primarySortOrder:a.value.configuration.sort.primary.direction,secondarySortBy:a.value.configuration.sort.secondary.field,secondarySortOrder:a.value.configuration.sort.secondary.direction}:{},rowLimt:(R=(H=a.value)==null?void 0:H.configuration)==null?void 0:R.rowLimit,paging:(j=(M=a.value)==null?void 0:M.configuration)==null?void 0:j.paging,...((F=_.value)==null?void 0:F.offset)!==0?{offset:_.value.offset}:{},objectName:(G=(Z=a.value)==null?void 0:Z.configuration)==null?void 0:G.objectName,currencyCode:o.currencyCode},ce=await window.salesforceConnector.getItems(JSON.stringify(ue));if(ce!=null&&ce.errorMessage){c.handleError(ce.errorMessage);return}ce!=null&&ce.itemCount&&(_.value.totalPages=Math.ceil((ce==null?void 0:ce.itemCount)/_.value.rowLimt)),h.value=rn(ce.lstItems,{xx_ord1__qty__c:"1"}),(ie=ce.lstItems)!=null&&ie.length||(u.value=!0),b.value=!1}catch(se){c.handleError("Failed to fetch Results. Please try again."),b.value=!1,console.info("[ERROR]: Adaptive Search getItems() error = ",se)}}async function $(x){try{s.value=!0;const A=JSON.stringify({lstQLIRequest:U(x),quoteId:t.quoteId});let L=await window.salesforceConnector.createQLI(A);typeof L=="string"&&(L=JSON.parse(L));let z=!1;if((L==null?void 0:L.length)>0&&L.forEach(K=>{K.errorMessage&&(z=!0,c.handleError(K.errorMessage))}),s.value=!1,z){f.value=L;const K=f.value.reduce((D,H)=>(D[H.eCatalogItemId]=H.errorMessage,D),{});h.value=h.value.map(D=>({...D,backendError:K[D.Id]||""}));return}return L}catch(A){c.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addToQuote() error = ",A)}}function U(x){const A=[];for(const L of x)if(!L.addedToQuote&&L.id){const z=J(L);l.value++,A.push({fields:z,recordId:L.id,...x.length===1?{maxSequenceNumber:l.value}:{}})}return A}function J(x){const A=[],L=W();return Object.keys(x).forEach(z=>{if(L.includes(z)){const K=ho[z.toLowerCase()];K&&A.push({fieldname:K,value:x[z]})}}),A}function W(){const x=[];return a.value.configuration.columns.forEach(A=>{A.field&&!A.field.includes(".")&&A.isEditable&&A.visible&&x.push(A.field)}),x}function ne(){var A,L;const x=[];return a.value.configuration.columns.forEach(z=>{const K=z.field.toLowerCase();x.includes(K)||x.push(K)}),(A=a.value.configuration)!=null&&A.dynamicFilters&&a.value.configuration.dynamicFilters.filters.forEach(z=>{const K=z.field.toLowerCase();x.includes(K)||x.push(K)}),(L=a.value.configuration)!=null&&L.cardHeader&&x.push(a.value.configuration.cardHeader.imageField),x}async function X(){var L;const x=ne(),A=((L=a.value.configuration)==null?void 0:L.saveObjectName)||a.value.configuration.objectName;if(A==="xx_ord1__ecatalog_item__c"){const z=x.indexOf("xx_ord1__qty__c");z>-1&&x.splice(z,1)}await t.getFieldsData(x,A),t.fieldsData.xx_ord1__qty__c||t.getFieldsData(["xx_ord1__qty__c"],"xx_ord1__quote_line_item__c")}async function P({searchTerm:x="",filters:A=[]}={}){if(p.value=!0,x&&(v.value=x),A.length&&(g.value=A),await C()){await X(),p.value=!1;const z=v.value;z&&(v.value=z,await B(z,t.dynamicFilters)),console.info("actionStore.isStaticActionCall = ",r.isStaticActionCall),r.isStaticActionCall&&(r.isStaticActionCall=!1,n.chatHistory[n.chatHistory.length-1]={type:"response",message:"Adaptive search is now open. Please search for the products you require and add it quote",loading:!1,links:[{action:"quoteItem",label:"Quote Item"},{action:"quoteDocument",label:"Quote Document"}]})}p.value=!1}return{selectedItem:i,AdaptiveSearchLayout:a,searchText:v,loadingAdaptiveLayout:d,getAdaptiveSearchLayout:C,getItems:B,lstItems:h,rowItemsLoading:b,noSearchRecords:u,dynamicFilters:m,setDynamicFilters:y,createQliErrors:f,addToQuote:$,addingToQuote:s,getFieldsData:X,pagingData:_,appliedDynamicFilters:g,maxSequenceNumber:l,loadingAdaptiveSearch:p,initAdaptiveSearch:P}}),Ua="XX_ORD1__Quote__c",za="xxord1salespricec",ln="xx_ord1__item__c",Ka="xxord1productnrcc",Za=Ke.defineStore("cartStore",()=>{const t=dt(),o=po(),n=ot(),r=e.ref(""),i=e.ref("$0"),a=e.ref("$0"),d=e.ref(null),b=e.ref({}),h=e.ref({}),v=e.ref({}),u=e.ref(""),m=e.ref(""),s=e.ref({}),g=e.ref(""),c=e.ref(""),f=e.ref({});async function l(){I()}async function p(){try{let T=await window.salesforceConnector.getProductCount(t.quoteId);if(T=qe(T),T!=null&&T.errorMessage){n.handleError(T.errorMessage);return}return r.value=T,T}catch{n.handleError("Failed to get Product Count. Please try again.")}}async function _(){try{let T=await window.salesforceConnector.getQuoteTotal(t.quoteId);if(T=qe(T),T!=null&&T.errorMessage){n.handleError(T.errorMessage);return}return a.value=T.monthlyTotal,i.value=T.onetimeTotal,T}catch{n.handleError("Failed to get Total Amount. Please try again.")}}async function C(T,S,w,N=""){if(!t.sectionDataMap.get(w).parentQLIs[S].removingItem){t.sectionDataMap.get(w).parentQLIs[S].removingItem=!0,c.value=T.id,await y(T.id)==="Success"&&(t.fetchAllQuoteLineItems(),N&&N(T,S,w));let $=t.sectionDataMap.get(w).parentQLIs.filter(U=>U[ln]===T[ln]).length;c.value="",o.lstItems.forEach(U=>{U[ln]===T[ln]&&(U.addedToQuote===!0&&(U.addedToQuote=!1),$===0&&(U.removedFromQuote=!0))})}}async function y(T){try{let S=await window.salesforceConnector.deleteQLI(T);if(S!=null&&S.errorMessage){n.handleError(S.errorMessage);return}return p(),_(),S}catch{n.handleError("Failed to remove Quote Item. Please try again.")}}function E(T){var N,B;const S=(N=T==null?void 0:T[Ka])==null?void 0:N.match(/\.\d+/);S&&(S.value=S[0].length-1);const w=(B=T==null?void 0:T[za])==null?void 0:B.match(/\.\d+/);return w&&(w.value=w[0].length-1),S||w}function I(T=!0){p(),_(),T&&t.fetchTemplates(Ua).then(()=>{t.getFilteredListWithFields()})}function O(T){const S=t.sectionDataMap;for(const[,w]of S.entries())w.parentQLIs.forEach(N=>{N.id===T.id&&(w.columns.forEach(B=>{if(B.dataType==="CURRENCY"){const $=B.field.replace(/_/g,"");N[$]=V(N[$],T[B.field])}}),T!=null&&T.billingPeriodValue&&(T!=null&&T.formattedBillingPeriodValue)&&(N.formattedBillingPeriodValue=V(N.formattedBillingPeriodValue,T.billingPeriodValue)),T!=null&&T.oneTimeValue&&(T!=null&&T.formattedOneTimeValue)&&(N.formattedOneTimeValue=V(N.formattedOneTimeValue,T.oneTimeValue)))})}function V(T,S){const w=Number(S);if(isNaN(w))return T;const N=T.match(/(\d[\d,]*)(\.\d+)?/);if(!N)return T;const B=N[2]||"",$=B.length?B.length-1:0,U=w.toLocaleString("en-US",{minimumFractionDigits:$,maximumFractionDigits:$});return T.replace(N[1]+B,U)}return{initializeCart:l,loadCartState:I,productCount:r,onetimeTotal:i,monthlyTotal:a,filterCartItem:d,billingPeriodValue:u,hasOneTimeValue:m,hasBillingPeriodInList:b,oneTimeFieldAvailable:h,billingPeriodFieldAvailable:v,priceDecimalPrecision:s,cartItemUpdatingId:g,removingItemLoaderId:c,cartItemColumnsMap:f,getProductCount:p,getQuoteTotal:_,removeItem:C,removeQuoteItem:y,getDecimalPrecisionFromSalesPriceOrNRC:E,updateFormattedValues:O,formateCurrencyValue:V}}),Qa=t=>[{title:"Apply Discount",subOptions:[...t.map(o=>`Apply Discount on ${o} for `),"Show Maximum discount allowed","Apply Maximum Discount Allowed",...t.map(o=>`Apply Discount on ${o} for a specific total`)]},{title:"Update Fields",subOptions:["Update the price of","Update the quantity of","Update the term start date to","Update the term end date to","Update the line description for"]},{title:"Price Ramp",subOptions:["Add a price ramp for"]}],Xa={salesforceUserLocale:"en_US",chatRoomId:"00DA0000000cDUJMA2__0052G00000AHBNAQA5__a0jKb000004VSaMIAW",status:"SUCCESS",statusCode:200,requestId:"9b1d1f0a9f07aa6cdc",errorMessage:"",payload:{uiModification:{addColumn:[],removeColumn:[],filter:[],groupBy:[{sectionName:"MRC $50 and Above",filters:[{datatype:"currency",field:"XX_ORD1__MRC__c",operator:"greater or equal",value:"50"}],tableId:"4vIEgoK5CbSPrLYPbq"},{sectionName:"MRC Below $50",filters:[{datatype:"currency",field:"XX_ORD1__MRC__c",operator:"less than",value:"50"}],tableId:"BlOPCp7eLBCZ84nDT2"}],showOptions:!0}},agentResponse:{role:"agent",requestId:"9b1d1f0a9f07aa6cdc",content:"Grouped the quote items into two sections: one for MRC $50 and above, and another for MRC below $50.",error:!1,epoch:1759936160464,isDML:!1},redirectObjects:{qliId:"",itemId:"",componentName:"QuoteItem"},actionFunction:"Reload",links:[{action:"quoteDocument",label:"Quote Document"},{action:"addProducts",label:"Add Products"}]},Ja=[{label:"Line Description",field:"xx_ord1__line_description__c",isEditable:!0,dataType:"STRING"},{label:"QTY",field:"xx_ord1__qty__c",isEditable:!0,dataType:"DOUBLE"},{label:"Extended Price",field:"xx_ord1__extended_price__c",isEditable:!1,dataType:"CURRENCY"},{label:"Billing Period",field:"xx_ord1__billing_period__c",isEditable:!0,dataType:"PICKLIST",picklistValues:["Monthly","Quarterly","Yearly"]}],dt=Ke.defineStore("quote",()=>{const t=ot(),o=Za(),n=ht(),r=e.ref(""),i=e.ref(""),a=e.ref(0),d=e.ref(""),b=e.ref([]),h=e.ref({template:!0,filteredList:!1}),v=e.ref(null),u=e.ref(new Map),m=e.ref({}),s=e.ref(!1),g=e.ref(!0),c=e.ref(!1),f=e.ref({text:"Hide Options",altText:"Show Options",handler:()=>{g.value=!g.value,V()},color:"#136E05",isActive:!1}),l=e.computed(()=>{const P=Array.from(u.value.values()).map(x=>x.sectionName);return Qa(P)});e.watch(d,()=>{h.value.template||O()});function p(){const P=new Map,x=[];for(const[L,z]of u.value.entries())P.set(L,z.selected),x.push(z);const A=JSON.parse(JSON.stringify(x));return A.forEach(L=>{delete L.selected;const z=new Map,K=[];L.lineItems.forEach(D=>{D.Selected=P.get(L.tableId).get(D.id)||!1,D.xx_ord1__parent_qli__c?(z.has(D.xx_ord1__parent_qli__c)||z.set(D.xx_ord1__parent_qli__c,[]),z.get(D.xx_ord1__parent_qli__c).push(D)):K.push(D)}),L.lineItems=K.map(D=>({...D,options:z.get(D.id)||[]})),delete L.loading,delete L.parentQLIs,delete L.totalValues}),{showOptions:g.value,sections:A,templateId:d.value}}async function _(P){try{let x=await window.salesforceConnector.getPrimaryQuote(P);x=qe(x),x!==void 0&&(console.info("getPrimaryQuote",JSON.stringify(x)),r.value=x.recordId,console.info("quoteId",r.value),i.value=x.name,d.value=x==null?void 0:x.templateId,a.value=(x==null?void 0:x.lineItemsCount)||0)}catch(x){t.handleError(x.message),console.info("[ERROR]: getPrimaryQuote() error = ",x)}}async function C(P){var x,A;try{h.value.template=!0;let L=await window.salesforceConnector.fetchContentTemplates(JSON.stringify({lstObjectName:[P],templateType:"Document",templateId:null,fetchOnlyDefault:!1}));L=qe(L);const z=L==null?void 0:L.templates[P];return d.value||(d.value=(x=z.find(K=>K.XX_ORD1__Default__c))==null?void 0:x.Id),d.value||(d.value=(A=z[0])==null?void 0:A.Id),b.value=z,h.value.template=!1,b.value}catch(L){t.handleError(L.message),console.info("[ERROR]: fetchTemplates() error = ",L)}}function y(P){if(!P)return null;const x=/\{!\$(\w+):([\w.]+)\}/,A=P.match(x);return A?{function:A[1],apiname:A[2].split(".")[1]}:null}async function E(P){try{const x={Id:r.value,XX_ORD1__Document_Template__c:P};return await window.salesforceConnector.updateQuote(JSON.stringify([x]))}catch(x){t.handleError(x.message),console.info("[ERROR]: updateQuote() error = ",x)}}async function I(){try{h.value.filteredList=!0;let P=await window.salesforceConnector.getQuoteEPageLayout();u.value.clear(),o.cartItemColumnsMap={},P=qe(P);const x=P.map(L=>({label:L.fieldLabel,field:L.fieldName.toLowerCase(),isEditable:L.isEditable,dataType:L.dataType,...L.picklistValues?{picklistValues:L.picklistValues}:{}})),A=wt();return u.value.set(A,{loading:!0,lineItems:[],parentQLIs:[],columns:x,tableId:A,sectionName:"All Rows",selected:new Map,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}),o.cartItemColumnsMap[A]=x,f.value.isActive=!1,g.value=!0,v.value={lstCB:[{columns:x,footer:null,title:"All Rows",sectionName:"All Rows",tableId:A,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}]},V(),h.value.filteredList=!1,P}catch(P){t.handleError(P.message),console.info("[ERROR]: getQuoteEPageLayout() error = ",P)}}async function O(){if(b.value.length===0){I();return}try{h.value.filteredList=!0;let P=await window.salesforceConnector.getFilteredListWithFields(JSON.stringify({templateId:d.value}));E(d.value),P=qe(P),console.info("res.lstCB = ",P.lstCB);const x=P==null?void 0:P.objectFieldsMap;return u.value.clear(),o.cartItemColumnsMap={},P.lstCB=P.lstCB.map(A=>{const{fields:L,filters:z,primarysort:K,primarysortdesc:D}=JSON.parse(A.XX_ORD1__Block_Properties__c),H=L.map(M=>{var j;return{label:(j=x[M.api])==null?void 0:j.label,field:M.api.toLowerCase(),isEditable:M.api.includes(".")?!1:x[M.api].isEditable,dataType:x[M.api].dataType,...x[M.api].picklistValues?{picklistValues:x[M.api].picklistValues}:{}}}),R=A.Id||wt();return u.value.set(R,{loading:!0,lineItems:[],parentQLIs:[],columns:H,tableId:R,sectionName:A.Name,selected:new Map,footer:y(A.XX_ORD1__Table_Footer_HTML__c),filters:z,primarysort:K,primarysortdesc:D}),o.cartItemColumnsMap[R]=H,f.value.isActive=!1,g.value=!0,{columns:H,footer:y(A.XX_ORD1__Table_Footer_HTML__c),title:A.Name,sectionName:A.Name,tableId:R,filters:z,primarysort:K,primarysortdesc:D}}),v.value=P,V(),h.value.filteredList=!1,P}catch(P){t.handleError(P.message),console.info("[ERROR]: getFilteredListWithFields() error = ",P)}}async function V(P=!0){const x=[];for(const[A]of u.value)x.push(w(A,P));return await Promise.all(x),o.getProductCount(),!0}function T(P,x){return u.value.get(P).columns.some(A=>A.field.toLowerCase()===x)||o.cartItemColumnsMap[P].some(A=>A.field.toLowerCase()===x)}function S(P,x){let A=rn(P);const L=n.pricingSchema,z=T(x,"xx_ord1__nrc__c"),K=T(x,"xx_ord1__sales_price__c"),D=T(x,"xx_ord1__qty__c");return A=A.map(H=>{let R={};L==="nrc/mrc"&&(H!=null&&H.xx_ord1__billing_period__c)?R={...K?{billingPeriodValue:(H==null?void 0:H.xx_ord1__sales_price__c)===0?"0":(H==null?void 0:H.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:H==null?void 0:H.xxord1salespricec}:{},...z?{oneTimeValue:(H==null?void 0:H.xx_ord1__nrc__c)===0?"0":(H==null?void 0:H.xx_ord1__nrc__c)||null,formattedOneTimeValue:H==null?void 0:H.xxord1nrcc}:{}}:L==="nrc/mrc"&&!(H!=null&&H.xx_ord1__billing_period__c)?K&&(R={oneTimeValue:(H==null?void 0:H.xx_ord1__sales_price__c)===0?"0":(H==null?void 0:H.xx_ord1__sales_price__c)||null,formattedOneTimeValue:H==null?void 0:H.xxord1salespricec}):L!=="nrc/mrc"&&(H!=null&&H.xx_ord1__billing_period__c)?K&&(R={billingPeriodValue:(H==null?void 0:H.xx_ord1__sales_price__c)===0?"0":(H==null?void 0:H.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:H==null?void 0:H.xxord1salespricec}):L!=="nrc/mrc"&&!(H!=null&&H.xx_ord1__billing_period__c)&&K&&(R={oneTimeValue:(H==null?void 0:H.xx_ord1__sales_price__c)===0?0:(H==null?void 0:H.xx_ord1__sales_price__c)||null,formattedOneTimeValue:H==null?void 0:H.xxord1salespricec});const{xx_ord1__qty__c:M,xx_ord1__sales_price__c:j,xx_ord1__nrc__c:F,...Z}=H,G={...Z,id:H.id,description:(H==null?void 0:H.xx_ord1__line_description__c)||"",xx_ord1__billing_period__c:H==null?void 0:H.xx_ord1__billing_period__c,...D?{xx_ord1__qty__c:M}:{},xx_ord1__item__c:H==null?void 0:H.xx_ord1__item__c,"xx_ord1__item__r.xx_ord1__decimal_precision__c":H["xx_ord1__item__r.xx_ord1__decimal_precision__c"]||"0",...R};return G!=null&&G.billingPeriodValue&&(o.hasBillingPeriodInList[x]=!0,o.billingPeriodValue=G==null?void 0:G.xx_ord1__billing_period__c),"oneTimeValue"in G&&(o.oneTimeFieldAvailable[x]=!0),"billingPeriodValue"in G&&(o.billingPeriodFieldAvailable[x]=!0),(G==null?void 0:G.oneTimeValue)!==""&&(G==null?void 0:G.oneTimeValue)!==null&&(o.hasOneTimeValue=!0),G}),A}async function w(P,x=!0){var A,L;try{const z=u.value.get(P);if(console.info("sectionData = ",z.sectionName),!z)return;z.loading=x,x&&(z.lineItems=[]);const{columns:K,filters:D,primarysort:H,primarysortdesc:R,footer:M}=z,j=K.map(ce=>ce.field.toLowerCase());j.includes("xx_ord1__parent_qli__c")||j.push("xx_ord1__parent_qli__c"),j.includes("xx_ord1__item__c")||j.push("xx_ord1__item__c"),j.includes("xx_ord1__sys_configuration_status2__c")||j.push("xx_ord1__sys_configuration_status2__c"),(A=o.cartItemColumnsMap[P])==null||A.forEach(ce=>{j.includes(ce.field)||j.push(ce.field)});const F=await N({fields:j,recordId:r.value,filters:D||[],primarySortBy:H||"",primarySortOrder:R?"DESC":"ASC",includeOptions:g.value,totalFields:M?[M.apiname]:[]}),Z=F.lineItems,G=new Map;let ie=[];const se=(L=F.fieldTotals)==null?void 0:L.map(ce=>ce.totalValue);Z.forEach(ce=>{ce.XX_ORD1__Parent_QLI__c?G.has(ce.XX_ORD1__Parent_QLI__c)?G.get(ce.XX_ORD1__Parent_QLI__c).push(ce):G.set(ce.XX_ORD1__Parent_QLI__c,[ce]):ie.push(ce)});const ue=[];return ie.forEach(ce=>{ue.push(ce),G.has(ce.Id)&&ue.push(...G.get(ce.Id))}),ie=S(ie,P),z.lineItems=rn(ue),z.parentQLIs=ie,z.totalValues=se,z.loading=!1,u.value=new Map(u.value),ue}catch(z){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",z.message);const K=u.value.get(P);K&&(K.loading=!1)}}async function N(P){try{let x=await window.salesforceConnector.getQuoteLineItemsWithFilteredTable(JSON.stringify(P));return x=qe(x),x}catch(x){t.handleError(x.message),console.info("[ERROR]: getQuoteLineItemsWithFilteredTable() error = ",x)}}async function B(P){try{console.info("updateQli() payload = ",P);let x=await window.salesforceConnector.updateQli(JSON.stringify(P));return x=qe(x),V(!1),x}catch(x){t.handleError(x.message),console.info("[ERROR]: updateQli() error = ",x)}}async function $(P){try{let x=await window.salesforceConnector.deleteQLI(P);return x=qe(x),V(),x}catch(x){t.handleError(x.message),console.info("[ERROR]: deleteQLI() error = ",x)}}async function U(P,x){try{s.value=!0;const A={fields:P};x&&(A.objectName=x),P.includes("xx_ord1__qty__c")&&x==="xx_ord1__ecatalog_item__c"&&(A.fields=A.fields.filter(z=>z!=="xx_ord1__qty__c")),P.includes("xx_ord1__sales_price__c")&&x!=="xx_ord1__quote_line_item__c"&&(A.fields=A.fields.filter(z=>z!=="xx_ord1__sales_price__c"));let L=await window.salesforceConnector.getFieldsData(JSON.stringify(A));return typeof L=="string"&&(L=JSON.parse(L)),L!=null&&L.errorMessage?(t.handleError(L.errorMessage),null):(m.value={...m.value,...L},console.info("fieldsData.value = ",JSON.stringify(m.value)),L)}catch(A){return t.handleError("Failed to get Fields Data. Please try again."),console.info("[ERROR]: getFieldsData() error = ",A),null}finally{s.value=!1}}function J(P=""){var x;return!P||P.includes(".")?!1:P.includes("xx_ord1__qty__c")?!0:((x=m.value[P])==null?void 0:x.isEditable)||!1}function W(){ne(Xa)}async function ne(P){var x,A,L,z,K,D,H,R,M;if(P.payload){if((x=P.payload)!=null&&x.uiModification){const j=P.payload.uiModification;if(((A=j.addColumn)==null?void 0:A.length)>0)if(j.addColumn.forEach(F=>{F.columns.forEach(Z=>{Z.field=Z.field.toLowerCase()})}),j.addColumn[0].sectionName==="all_section")for(const[F,Z]of u.value)Z.columns=[...Z.columns,...j.addColumn[0].columns];else j.addColumn.forEach(F=>{u.value.get(F.tableId)&&(u.value.get(F.tableId).columns=[...u.value.get(F.tableId).columns,...F.columns])});if(((L=j.removeColumn)==null?void 0:L.length)>0)if(j.removeColumn.forEach(F=>{F.columns=F.columns.map(Z=>Z.toLowerCase())}),j.removeColumn[0].sectionName==="all_section")for(const[F,Z]of u.value)Z.columns=Z.columns.filter(G=>!j.removeColumn[0].columns.includes(G.field));else j.removeColumn.forEach(F=>{u.value.get(F.tableId)&&(u.value.get(F.tableId).columns=u.value.get(F.tableId).columns.filter(Z=>!F.columns.includes(Z.field)))});if(((z=j.filter)==null?void 0:z.length)>0)if(j.filter[0].sectionName==="all_section")for(const[F,Z]of u.value)Z.filters=[...Z.filters,...j.filter[0].filters];else j.filter.forEach(F=>{u.value.get(F.tableId)&&(u.value.get(F.tableId).filters=[...u.value.get(F.tableId).filters,...F.filters])});if(((K=j.groupBy)==null?void 0:K.length)>0){const F=((D=[...u.value.values()][0])==null?void 0:D.columns)||Ja;u.value.clear(),o.cartItemColumnsMap={},j.groupBy.forEach(Z=>{o.cartItemColumnsMap[Z.tableId]=Z.columns||F,u.value.set(Z.tableId,{loading:!0,lineItems:[],parentQLIs:[],columns:Z.columns||F,tableId:Z.tableId,sectionName:Z.sectionName,selected:new Map,footer:y(Z.footer),filters:Z.filters,primarysort:Z.primarysort,primarysortdesc:Z.primarysortdesc})})}j.showOptions!==void 0&&(g.value=j.showOptions)}if(((R=(H=P.payload)==null?void 0:H.sections)==null?void 0:R.length)>0){const j=(M=P.payload)==null?void 0:M.sections;u.value.clear(),j.forEach(F=>{F.tableId||(F.tableId=wt()),F.selected=new Map,u.value.set(F.tableId,F)}),V()}}P.actionFunction==="Reload"&&(V(),console.info("Reloading quote line items"))}async function X(P){var x,A;try{const L=new Set;for(const z of u.value.keys())(x=u.value.get(z).lineItems)==null||x.forEach(D=>{D.attributes=null,L.add(D.id)});if(P){const z={lineItemIds:[...L]},K=await window.productManagerController.getLineItemAttributes({request:JSON.stringify(z)}),D=JSON.parse(K.data);for(const H of u.value.keys())(A=u.value.get(H).lineItems)==null||A.forEach(M=>{M.attributes=D[M.id]||null})}}catch(L){console.info("[ERROR]: fetchAttributesData() error = ",L)}}return{showAttributes:c,quoteId:r,quoteName:i,templateId:d,templateOptions:b,loading:h,currentTemplateData:v,fieldsData:m,fieldsDataLoading:s,showOptionHeaderButton:f,sectionDataMap:u,promptSuggestions:l,lineItemsCount:a,addColumns:W,getQuoteEPageLayout:I,getPayload:p,getPrimaryQuote:_,fetchTemplates:C,getFilteredListWithFields:O,getQuoteLineItemsWithFilteredTable:N,updateQli:B,getFieldsData:U,deleteQLI:$,performAIAction:ne,isEditableField:J,fetchQuoteLineItems:w,fetchAllQuoteLineItems:V,fetchAttributesData:X}}),Wa=Ke.defineStore("quickSelection",()=>{const t=ot(),o=ht(),n=dt(),r=e.ref(null),i=e.ref(!1),a=e.ref([]),d=e.ref([]),b=e.ref(!1),h=e.ref({}),v=e.ref({rowLimit:10,paging:!0,offset:0,currentPage:1,totalPages:1}),u=e.ref(!1);async function m(){i.value=!0;try{const E=JSON.stringify({layoutType:"Quick Selection",layoutObject:"xx_ord1__ecatalog_item__c",...o.objectType?{contextObject:o.objectType}:{}});let I={};I=await window.salesforceConnector.getDynamicPageLayout(E),r.value=lo(I,"Unable to find the Quick Selection Layout for your user profile"),console.info("quickSelectionLayout.value = ",r.value),v.value.rowLimit=r.value.configuration.rowLimit||10,r.value.data.columns.forEach(O=>{!O.field&&O.label==="QTY"&&(O.field="xx_ord1__qty__c")}),i.value=!1}catch(E){i.value=!1,t.handleError("Failed to get Page structure data. Please try again."),console.info("[ERROR]: getAdaptiveSearchLayout() error = ",E)}}function s(){const E=new Map;return r.value.data.columns.forEach(I=>{E.set(I.field,!0)}),r.value.data.searchResultColumns.forEach(I=>{E.set(I.field,!0)}),Array.from(E.keys())}async function g(E){var I,O;try{let V=await window.salesforceConnector.saveCompetitorSKU(E);if(V!=null&&V.errorMessage){t.handleError(V.errorMessage);return}if((I=V[0])!=null&&I.errorMessage){t.handleError((O=V[0])==null?void 0:O.errorMessage);return}return V}catch(V){t.handleError("Failed to Match Item. Please try again."),console.info("[ERROR]: saveCompetitorSKU() error = ",V)}}async function c(E="",I=[]){try{let O=r.value.data,V=r.value.configuration;const T=E.trim();if(console.info("searchTextValue.trim() = ",E.trim()),!T)return[];let S=null;console.info("useMappings = ",u.value),u.value?S=Fa(f()):S=f(),console.info("fields before filter = ",S),S=S.filter($=>$!=="xx_ord1__qty__c"),console.info("fields after filter = ",S);const w={fields:S,...I.length?{dynamicFilters:n.getDynamicFilters(I)}:{},searchText:T,accountId:o.accountId,...o.eCatalogId?{catalogId:o.eCatalogId}:{},...o.objectType==="opportunity"?{opportunityId:o.id}:{},...O!=null&&O.sort?{primarySortBy:O.sort.primary.field,primarySortOrder:O.sort.primary.direction,secondarySortBy:O.sort.secondary.field,secondarySortOrder:O.sort.secondary.direction}:{},rowLimt:(V==null?void 0:V.rowLimit)||20,paging:(V==null?void 0:V.paging)||!1,...v.value.offset!==0?{offset:v.value.offset}:{},objectName:O.objectName,currencyCode:o.currencyCode};console.info("getQuickSelectionItems payload = ",JSON.stringify(w));const N=await window.salesforceConnector.getItems(JSON.stringify(w));if(console.info("getQuickSelectionItems Res = ",JSON.stringify(N)),N!=null&&N.errorMessage){t.handleError(N.errorMessage);return}return N!=null&&N.itemCount&&(v.value.totalPages=Math.ceil((N==null?void 0:N.itemCount)/v.value.rowLimit)),rn(N.lstItems,{xx_ord1__qty__c:"1"})}catch(O){t.handleError("Failed to fetch Results. Please try again."),console.info("[ERROR]: getQuickSelectionItems() error = ",O)}}function f(){let E=[];for(const I of r.value.data.columns){let O=I.field;if(O!=null&&O.includes(".")){E.includes(O)||E.push(O);let T=O.split(".")[0];T=T.slice(0,-1)+"c",E.includes(T)||E.push(T)}else E.includes(O)||E.push(O)}return console.info("getAllQuickSelectionFields() fields = ",E),E.filter(I=>I.toLowerCase()!=="xx_ord1__qty__c")}async function l(E,I,O,V){console.info("searchText:",JSON.stringify(E)),console.info("row:",JSON.stringify(I)),console.info("rowIndex:",JSON.stringify(O)),console.info("column:",JSON.stringify(V));const T=O+(v.value.currentPage-1)*v.value.rowLimit;if(V.field.toLowerCase().includes("xx_ord1__item__r")){if(a.value[T].itemLookupLoading=!0,u.value=!0,d.value=await c(E),d.value.length>0){const S=[];for(let w=0;w<d.value.length;w++)a.value[T].itemDataRetrieved=!0,d.value[w].xx_ord1__item__c&&S.push({name:d.value[w]["xx_ord1__item__r.name"],value:d.value[w].xx_ord1__item__c,label:d.value[w][V.field.toLowerCase()]});a.value[T][V.field.toLowerCase()+"_options"]=S}a.value[T].itemLookupLoading=!1}else if(V.field.toLowerCase().includes("xx_ord1__competitor_item__r")){a.value[T].competitorLookupLoading=!0;const S=await p(E);S!=null&&S.items&&(a.value[T][V.field.toLowerCase()+"_options"]=S.items.map(w=>({name:w.fields[2].value,value:w.fields[1].value,label:w.fields[0].value}))),a.value[T].competitorLookupLoading=!1,console.info("getLookupData:: Search Lookup Handler Response = ",S)}}async function p(E){var O,V;console.info("getLookupData() searchText = ",E);const I={searchText:E,obj:"xx_ord1__competitor_item__c",filters:null,displayFields:["xx_ord1__sku__c"]};try{let T=await window.salesforceConnector.getLookupData(JSON.stringify(I));if(typeof T=="string"&&(T=JSON.parse(T)),T!=null&&T.errorMessage){t.handleError(T.errorMessage);return}if((O=T[0])!=null&&O.errorMessage){t.handleError((V=T[0])==null?void 0:V.errorMessage);return}return T}catch(T){t.handleError("Failed to Search For Item. Please try again."),console.info("[ERROR]: getLookupData() error = ",T)}}async function _(E,I){var V;console.info("Update Other Fields Value = ",E),console.info("Update Other Fields Row Index = ",I);const O=I+(v.value.currentPage-1)*v.value.rowLimit;console.info("actualRowIndex = ",O);try{if(E){const T=d.value.filter(S=>S.xx_ord1__item__c===E)[0];if(T){b.value=!0;const S=r.value.data.columns[1].field;a.value[O][S]&&await C(T,O),(V=a.value[O])!=null&&V.itemDataRetrieved&&(a.value[O].status="New Match Requested",a.value[O].noMatchCleared=!0),Object.keys(T).forEach(w=>{const N=ho[w.toLowerCase()];console.info("Mapped Key = ",N),N&&(a.value[O][N]=T[w])}),b.value=!1}else a.value[O].status=""}else a.value[O].status="No Match"}catch(T){t.handleError("Unable to request a match for this item please try again."),console.info("Error in updateOtherFields = ",T)}}async function C(E,I){const O=a.value[I],V=r.value.data.columns[1].field,T=[{sku:O[V],name:O[V],productDescription:O.xx_ord1__line_description__c||"",productURL:null,status:"Match Requested",competitorAccountId:null,itemId:E.xx_ord1__item__c}];let S=await g(JSON.stringify(T));console.info("Match Item: ",JSON.stringify(S)),a.value[I][`${V}_options`]=[{value:S[0].competitorItemId,label:S[0].sku}],a.value[I][V]=S[0].competitorItemId}async function y(E){try{let I=await window.salesforceConnector.createQLI(JSON.stringify(E));typeof I=="string"&&(I=JSON.parse(I));let O=!1;if((I==null?void 0:I.length)>0)for(let V=0;V<I.length;V++)I[V].errorMessage&&(O=!0,I[V].errorMessage.includes("Line Description: data value too large")&&(I[V].errorMessage="Error: The description is too long—it must be under 200 characters."));if(O){I.forEach(V=>{h.value[V.eCatalogItemId]=V});return}else h.value=[];return I}catch(I){t.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addAllItemsToQuote() error = ",I)}}return{quickSelectionLayout:r,quickSelectionLayoutLoading:i,processedRecords:a,useMappings:u,currentSearchData:d,createQliErrors:h,getQuickSelectionLayout:m,getAllFieldsForQuickSelectionLayout:s,saveCompetitorSKU:g,getQuickSelectionItems:c,searchLookupHandler:l,updateOtherFields:_,addAllItemsToQuote:y}}),Ga="Preparing Your Quote Please Wait...",Ya={message:"Your quote is ready! Begin adding products to complete it.",type:"response",requestId:"no-request-id"},el=18e4,sn=Ke.defineStore("ai",()=>{const t=ht(),o=dt(),n=po(),r=Wa(),i=it(),a=Kn(),d=e.ref(""),b=e.ref(""),h=e.ref([]),v=e.ref(""),u=e.ref([]),m=e.ref(!1),s=e.ref(null),g=an(),c=e.ref({}),f=e.ref(null),l=e.ref(null),p=e.ref(null),_=e.ref(null),C=e.ref(null),y=e.ref(Ga),E=e.ref([]),I=e.computed(()=>t.orgId+"__"+t.user.Id+"__"+o.quoteId),O=e.computed(()=>s.value.readyState==WebSocket.OPEN),V=()=>{c.value={salesforceOrgId:t.orgId,salesforceOrgType:t.orgType,salesforceUserId:t.user.Id,userType:"Salesforce",chatRoomId:I.value,requestId:"",prompt:"",initiatedFrom:t.origin||"Quote",internalCall:!1,contextObjectId:o.quoteId,contextObjectType:"Quote",payload:{lineItemsCount:o.lineItemsCount},origin:"Genesis AI",defaultBatchSize:10,actionType:"",packageVersion:t.packageVersion,relatedIds:{eCatalogId:t.eCatalogId,accountId:t.accountId}}};async function T(){const M=b.value+"?chatRoomId="+I.value;s.value=new WebSocket(M),s.value.addEventListener("open",S),s.value.addEventListener("message",B),s.value.addEventListener("close",w),s.value.addEventListener("error",N)}const S=()=>{$(),W()},w=()=>{U()},N=()=>{z(),U()},B=M=>{var F,Z;$();const j=JSON.parse(M.data);if(j.status!=="ALIVE"){if(j.loading){y.value=j.message;return}else Array.isArray(j.messages)?(y.value=null,h.value.push(Ya),j.messages.length>0&&x(j.messages)):j.agentResponse&&(j.errorMessage&&(j.agentResponse.content=j.errorMessage,j.agentResponse.error=!0),y.value=null,h.value.push({message:j.agentResponse.content,type:j.agentResponse.role,requestId:j.requestId,epoch:j.agentResponse.epoch,error:j.agentResponse.error,isDML:j.agentResponse.isDML,...(F=j.agentResponse)!=null&&F.filesData?{filesData:(Z=j.agentResponse)==null?void 0:Z.filesData}:{}}));E.value=j.links||[],D(j)}},$=()=>{U(),f.value=setTimeout(()=>{if(O.value){const M={action:"heartbeat"};s.value.send(JSON.stringify(M)),$()}},el)},U=()=>{f.value&&(clearInterval(f.value),f.value=null)};function J(M){const j={...c.value};j.requestType="Action",j.actionType="Undo",j.undoRequestId=M,j.requestId=wt(),P(j)}function W(){const M={...c.value};M.requestType="Action",M.actionType="History",M.requestId=wt(),P(M)}function ne(M){return a.path.startsWith("/configurator")&&i.isChangedConfiguration?(_.value={save:()=>{i.maintainQuoteConfiguration()}},d.value=M,!0):(d.value="",!1)}function X(M,j=!0,F=null){if(!ne(M)&&M.trim()){let Z={...c.value};Z.prompt=M.trim(),Z.requestType="Chat",Z.requestId=wt(),Z.internalCall=!1,Z.payload=A(),Z.componentName=L.value,Z.templateId=o.templateId,Z.payload.lineItemsCount=o.lineItemsCount,F&&(Z={...Z,...F}),K(),j&&h.value.push({message:M.trim(),type:"user",...C.value&&{fileData:[C.value]},requestId:Z.requestId}),P(Z),$()}}function P(M){const j={action:"prompt",data:M};s.value.send(JSON.stringify(j))}const x=M=>{const j=M.filter(({content:F})=>!!F).map(F=>({message:F.content,type:F.role,requestId:F.requestId,epoch:F.epoch,isDML:F.isDML,undone:F.undone}));j.forEach((F,Z)=>{F.isDML===!0&&Z!==j.length-1&&(F.isDML=!1)}),h.value=[...h.value,...j]};function A(){return a.path==="/quote-item"?o.getPayload():{}}const L=e.computed(()=>a.path==="/quote-item"?"QuoteItem":""),z=()=>{h.value.push({type:"response",message:"Oops! Something went wrong while processing your request. Please try again later.",error:!0})},K=()=>{h.value=h.value.map(M=>({...M,links:[]}))};function D(M){var Z,G,ie;const j=((Z=M==null?void 0:M.redirectObjects)==null?void 0:Z.componentName)||(M==null?void 0:M.componentName),F=(M==null?void 0:M.redirectObjects)||{};if(j==="AdaptiveSearch"){const se=(G=M==null?void 0:M.payload)==null?void 0:G.searchTerm,ue=(ie=M==null?void 0:M.payload)==null?void 0:ie.applyFilters;se&&se!==n.searchText&&n.initAdaptiveSearch({searchTerm:se,filters:ue}),g.push("/adaptive-search")}else j==="Configurator"?g.push(`/configurator/${F.itemId}/${F.qliId}`):j==="QuoteReview"?g.push("/quote-item"):j==="QuoteItem"||j==="QuoteList"?(g.push("/quote-item"),o.performAIAction(M)):j==="QuickSelection"&&(r.quickSelectionLayout=M.payload,console.info("Loading QuickSelection data = ",JSON.stringify(r.quickSelectionLayout)),g.push("/match-records"))}function H(){if(O.value){const M={action:"cancel",data:{requestId:c.value.requestId,chatRoomId:I.value}};s.value.send(JSON.stringify(M))}}const R=()=>{l.value&&(clearInterval(l.value),l.value=null),f.value&&(clearInterval(f.value),f.value=null),p.value&&(clearTimeout(p.value),p.value=null)};return e.onBeforeUnmount(()=>{R()}),{unsavedChanges:_,loadingMessage:y,promptMessage:d,buttonLinks:E,websocketUrl:b,chatHistory:h,latestDMLRequest:v,strikethroughHistory:u,attachmentData:C,dataManuallyChanged:m,undoAction:J,connectSocket:T,sendMessage:X,setInitialPayload:V,cancelRequest:H}}),ht=Ke.defineStore("root",()=>{const t=sn(),o=ot(),n=dt(),r=e.ref(""),i=e.ref(""),a=e.ref("Genesis AI"),d=e.ref(""),b=e.ref({}),h=e.ref(""),v=e.ref(""),u=e.ref(""),m=e.ref(""),s=e.ref({}),g=e.ref(""),c=e.ref(""),f=e.ref(""),l=e.ref(""),p=e.ref(""),_=e.ref(""),C=e.ref(""),y=e.ref("Single"),E=e.ref("closed"),I=e.computed(()=>n.quoteName),O=e.computed(()=>y.value==="Single");async function V(N){r.value=N||io("id"),i.value=io("origin"),await S(),await T()}async function T(){try{console.info("getRecordInfo",r.value);let N=await window.salesforceConnector.getRecordInfo(r.value);return N=qe(N),N!==void 0&&(s.value=N,g.value=N.name,c.value=N.objectType,f.value=N.accountId,l.value=N.eCatalogId,p.value=N.currencyCode,_.value=N.userLocale,C.value=N.opportunityId),(N==null?void 0:N.objectType)==="XX_ORD1__Quote__c"?(n.quoteId=N==null?void 0:N.recordId,n.templateId=N==null?void 0:N.templateId,n.quoteName=N==null?void 0:N.name,n.lineItemsCount=(N==null?void 0:N.lineItemsCount)||0):(N==null?void 0:N.objectType)==="Opportunity"&&await n.getPrimaryQuote(N.recordId),N}catch(N){o.handleError(N.message)}}async function S(){var B,$;console.info("getOrgInformation",r.value);const N=await window.salesforceConnector.getOrgInformation();t.websocketUrl=N.websocketUrl,d.value=(B=N.locale)==null?void 0:B.replace("_","-"),b.value=N.user,h.value=N.orgName,v.value=N.orgId,u.value=N.orgType,m.value=N.packageVersion,y.value=($=N==null?void 0:N.pricingSchema)==null?void 0:$.toLowerCase()}function w(N){a.value=N,na(N)}return{id:r,origin:i,title:I,subTitle:a,locale:d,user:b,orgName:h,orgId:v,orgType:u,packageVersion:m,objectType:c,recordInfo:s,name:g,accountId:f,eCatalogId:l,currencyCode:p,userLocale:_,opportunityId:C,pricingSchema:y,isSinglePricingSchema:O,flyoutState:E,start:V,getRecordInfo:T,setSubTitle:w}}),tl="https://api-svc.blink.expedite1.com/api/product-pricing/evaluateConfigurationSelection",nl={productJSON:{productItem:{configRules:[{publishKey:"rule-a1",name:"If latest is optA include optB",priority:1,enforceRule:!0,ruleJson:'{"latestSelected":"optA","actionType":"include","affectedOptions":["optB"]}'}]}},currentConfig:{product:{publishKey:"prod-1",attributes:[]},options:[]},selected:{publishKey:"optA",attributes:[]}};async function rl(t=nl){const o=tl;try{const n=await fetch(o,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(`HTTP error! status: ${n.status} ${n.statusText}`);return await n.json()}catch(n){throw console.info("Error fetching data with Fetch API:",n),n}}function ol(t){const o=n=>Math.min(...n.options.map(r=>r.relationshipInfo.primarySortOrder));return t.forEach(n=>{n.itemTypes.forEach(r=>{r.options.sort((i,a)=>i.relationshipInfo.primarySortOrder-a.relationshipInfo.primarySortOrder||i.itemName.localeCompare(a.itemName))}),n.itemTypes.sort((r,i)=>o(r)-o(i)||r.itemTypeName.localeCompare(i.itemTypeName))}),t.sort((n,r)=>{const i=Math.min(...n.itemTypes.map(o)),a=Math.min(...r.itemTypes.map(o));return i-a||n.category.localeCompare(r.category)}),t}const il=(t,o)=>{const n=(r,i)=>typeof i=="function"?void 0:i;return JSON.stringify(t,n)===JSON.stringify(o,n)},it=Ke.defineStore("configurator-main",()=>{const t=Kn(),o=ht(),n=dt(),r=ot(),i=an(),a=e.ref(null),d=e.ref(null),b=e.ref(null),h=e.ref(null),v=e.ref([]),u=e.ref(null),m=e.ref(null),s=e.ref(new Map),g=e.ref(!1),c=e.ref({configuration:!1,lineItem:!1,productOptionsPricing:!1,bestOfferPrice:!1,lineItemAttributes:!1,save:!1}),f=e.ref(!1),l=e.computed(()=>p.value&&!o.isSinglePricingSchema),p=e.computed(()=>{let R=!0,M=!0,j=!0,F=null;for(const Z of b.value.categoryOptions)for(const G of Z.itemTypes)for(const ie of G.options)ie.billingPeriod&&(F&&F!==ie.billingPeriod&&(j=!1),F=ie.billingPeriod,!ie.yrcPrice&&ie.billingPeriod==="Monthly"&&(R=!1),!ie.mrcPrice&&ie.billingPeriod==="Yearly"&&(M=!1));return R&&M&&j}),_=e.computed(()=>!il(b.value,h.value)),C=e.computed(()=>{const R=b.value.categoryOptions;return R.forEach(M=>{M.itemTypes.forEach(j=>{j.selectedOptions=j.options.filter(F=>j.selected.includes(F.itemId)),j.totalPrice=function(){return j.selectedOptions.reduce((F,Z)=>F+Z.price*Z.qty,0)||0},j.oneTimePrice=function(){return j.selectedOptions.filter(F=>!F.billingPeriod).reduce((F,Z)=>F+Z.price*Z.qty,0)||0},j.recurringPrice=function(){return j.selectedOptions.filter(F=>F.billingPeriod).reduce((F,Z)=>F+Z.price*Z.qty,0)||0}}),M.selectedItemTypes=M.itemTypes.filter(j=>j.selected.length>0),M.totalPrice=function(){return M.itemTypes.reduce((j,F)=>j+F.totalPrice(),0)},M.oneTimePrice=function(){return M.itemTypes.reduce((j,F)=>j+F.oneTimePrice(),0)},M.recurringPrice=function(){return M.itemTypes.reduce((j,F)=>j+F.recurringPrice(),0)}}),R.filter(M=>M.itemTypes.filter(j=>j.selected.length>0).length>0)}),y=e.computed(()=>C.value.reduce((R,M)=>R+M.totalPrice(),0)),E=e.computed(()=>{const R=C.value.reduce((F,Z)=>F+Z.totalPrice(),0);let M=C.value.reduce((F,Z)=>F+Z.oneTimePrice(),0),j=C.value.reduce((F,Z)=>F+Z.recurringPrice(),0);return b.value.billingPeriod?j=(j+b.value.price)*b.value.qty:M=(M+b.value.price)*b.value.qty,{basePrice:b.value.price,addOns:R,oneTimePrice:M,recurringPrice:j,total:b.value.price*b.value.qty+R*b.value.qty+M+j}}),I=e.computed(()=>{const R=new Map;return R.set(u.value.productLineItem.XX_ORD1__Item__c,u.value.productLineItem),u.value.options.forEach(M=>{R.set(M.XX_ORD1__Item__c,M)}),R}),O=e.computed(()=>{const R=new Map;return b.value.categoryOptions.forEach(M=>{M.itemTypes.forEach(j=>{j.options.forEach(F=>{R.set(F.relationshipInfo.publishKey,F)})})}),R}),V=e.computed(()=>{const R=new Map;return R.set(m.value.product.XX_ORD1__Item__c,m.value.product),m.value.options.forEach(M=>{R.set(M.XX_ORD1__Item__c,M)}),R});function T(R){b.value.qliId&&(b.value.qliBillingPeriod==="Monthly"&&!R?b.value.price=b.value.qliSalesPrice||b.value.qliMrcPrice:b.value.qliBillingPeriod==="Yearly"&&R&&(b.value.price=b.value.qliSalesPrice)),b.value.categoryOptions.forEach(M=>{M.itemTypes.forEach(j=>{j.options.forEach(F=>{F.billingPeriod&&(F.price=(R?F.yrcPrice.offerPrice:F.mrcPrice.offerPrice)||F.price,F.qliId&&(F.qliBillingPeriod==="Monthly"&&!R?F.price=F.qliSalesPrice||F.qliMrcPrice:F.qliBillingPeriod==="Yearly"&&R&&(F.price=F.qliSalesPrice)))})})})}function S(){b.value=null,h.value=null,v.value=[],u.value=null,m.value=null,s.value=new Map,g.value=!1,c.value.configuration=!1,c.value.lineItem=!1,c.value.productOptionsPricing=!1,c.value.bestOfferPrice=!1,c.value.lineItemAttributes=!1,c.value.save=!1}async function w(R,M){S(),a.value=R||t.params.itemId,d.value=M||t.params.qliId,console.info("initConfigurator",a.value,d.value,n.quoteId);const j=await N();await W(),await ne(),b.value=$(j);const F=await P();B(F),await J();let Z=!1;for(const G of u.value.options)G.XX_ORD1__Billing_Period__c==="Yearly"&&(Z=!0);Z&&(f.value=!0,T(!0)),h.value=JSON.parse(JSON.stringify(b.value))}async function N(){try{console.info("itemId",a.value);const R=await window.productManagerController.getProductConfiguration({itemId:a.value});console.info("getProductConfiguration:result",R);const M=JSON.parse(R.data).productItem;return M.categoryOptions=ol(M.categoryOptions),M}catch(R){return console.info("error",R.message),!1}}function B(R){const M=new Map;M.set(m.value.product.Id,m.value.product.XX_ORD1__Item__c),m.value.options.forEach(F=>{M.set(F.Id,F.XX_ORD1__Item__c)});const j=new Map;if(R.forEach(F=>{const Z={};F.pricingTypes.forEach(G=>{G.appliedOnField==="Catalog Price"?Z.catalogPrice=G:G.appliedOnField==="MRC"?Z.mrcPrice=G:G.appliedOnField==="YRC"&&(Z.yrcPrice=G)}),Z.billingPeriod=F.billingPeriod,Z.mrcPrice&&!o.isSinglePricingSchema?Z.price=Z.mrcPrice.offerPrice:Z.catalogPrice&&o.isSinglePricingSchema&&(Z.price=Z.catalogPrice.offerPrice),Z.offer={offerDiscount:F.offerDiscount,offerId:F.offerId,offerType:F.offerType},j.set(M.get(F.eCatalogItemId),Z)}),j.has(b.value.itemId)){const F=j.get(b.value.itemId),Z=b.value.price;Object.assign(b.value,F),b.value.qliId&&(b.value.price=Z)}b.value.categoryOptions.forEach(F=>{F.itemTypes.forEach(Z=>{Z.options.forEach(G=>{if(j.has(G.itemId)){const ie=j.get(G.itemId),se=G.price;Object.assign(G,ie),G.qliId&&(G.price=se)}})})})}function $(R){R.isAttributes=R.attributes&&R.attributes.length>0,s.value.set(d.value,R.attributes),v.value=R.configRules;const M=new Set;return v.value.forEach(j=>{const F=JSON.parse(j.ruleJson);F.optionSelected.forEach(Z=>{M.add(Z)}),F.affectedOptions.forEach(Z=>{M.add(Z)})}),U(R),R.categoryOptions.forEach(j=>{j.key=j.category.toLowerCase().replace(/\s+/g,"-").replace(/[&]/g,""),j.itemTypes.forEach(F=>{F.selected=[],F.options=F.options.filter(Z=>V.value.has(Z.itemId)),F.numberOfColumns||(F.numberOfColumns=1),F.numberOfColumns>1&&(F.lightboxAttributes=!0),F.maxNumber||(F.maxNumber=100),F.minNumber||(F.minNumber=0),F.maxQuantity||(F.maxQuantity=1e4),F.minQuantity||(F.minQuantity=1),F.maxNumber===1?(F.isRadio=!0,F.minMessage="Please select 1 option",F.maxMessage="",F.isKit=F.options.some(Z=>Z.relationshipInfo.relationship==="Kit")):(F.minMessage=`Minimum of ${F.minNumber} selection${F.minNumber!==1?"s":""} required`,F.maxMessage=`Maximum of ${F.maxNumber} selection${F.maxNumber!==1?"s":""} allowed`),F.options.forEach(Z=>{j.showImage=j.showImage||!!Z.defaultImageURL,Z.showAttributesModal=!1,Z.calculateRules=M.has(Z.relationshipInfo.publishKey),Z.qty=F.minQuantity||1,Z.getTags=()=>(Z.attributes=Z.attributes||[],Z.attributes.filter(G=>G.value!==null&&G.value!=="").map(G=>({label:G.label,value:G.value}))),Object.defineProperty(Z,"isDisabled",{get:function(){return Z.relationshipInfo.relationship==="Kit"||(F.isRadio?F.isKit:!F.selected.includes(Z.itemId)&&F.maxNumber===F.selected.length)}}),U(Z),(I.value.has(Z.itemId)||Z.relationshipInfo.relationship==="Kit")&&F.selected.push(Z.itemId)})})}),R}function U(R){R.isAttributes=R.attributes&&R.attributes.length>0;const M=V.value.get(R.itemId);if(I.value.has(R.itemId)){const j=I.value.get(R.itemId);R.qliId=j.Id,R.qty=j.XX_ORD1__QTY__c,R.itemName=j.XX_ORD1__Line_Description__c,R.billingPeriod=j.XX_ORD1__Billing_Period__c,R.price=j.XX_ORD1__Sales_Price__c,R.billingPeriod?R.price=j.XX_ORD1__Sales_Price__c||j.XX_ORD1__MRC__c:R.price=j.XX_ORD1__NRC__c||j.XX_ORD1__Sales_Price__c,R.qliSalesPrice=j.XX_ORD1__Sales_Price__c,R.qliNrcPrice=j.XX_ORD1__NRC__c,R.qliMrcPrice=j.XX_ORD1__MRC__c,R.qliBillingPeriod=j.XX_ORD1__Billing_Period__c,s.value.set(R.qliId,R.attributes)}else R.itemName=M.XX_ORD1__Line_Description__c||R.itemName,R.price=M.XX_ORD1__Negotiated_Price__c||M.XX_ORD1__NRC_for_New__c,R.nrcPrice=M.XX_ORD1__NRC_for_New__c}async function J(){console.info("getLineItemAttributes"),c.value.lineItemAttributes=!0;const M={lineItemIds:[u.value.productLineItem.Id,...u.value.options.map(Z=>Z.Id)]},j=await window.productManagerController.getLineItemAttributes({request:JSON.stringify(M)});console.info("getLineItemAttributes:result",j);const F=JSON.parse(j.data);for(const[Z,G]of Object.entries(F))if(s.value.has(Z)){const ie=s.value.get(Z),se=new Map;G==null||G.forEach(ue=>{se.set(ue.apiName,ue)}),ie==null||ie.forEach(ue=>{se.get(ue.apiName)&&(ue.value=se.get(ue.apiName).value||"",ue.dataType==="REFERENCE"&&(ue.referenceRecordId=se.get(ue.apiName).referenceRecordId||"",ue.referenceRecordId?ue.options=[{Name:ue.value||"",Id:ue.referenceRecordId}]:ue.options=[]))})}c.value.lineItemAttributes=!1}async function W(){c.value.lineItem=!0,console.info("getLineItems",n.quoteId,d.value);try{const R={objectId:n.quoteId,filters:{},additionalFields:["Name","XX_ORD1__Line_Description__c"],primarySort:{field:"CreatedDate",direction:"DESC"},productPage:{recordLimit:200,offset:0,productLineItemId:d.value}},M=await window.productManagerController.getLineItems({request:JSON.stringify(R)});return console.info("getLineItems:result",M),u.value=JSON.parse(M.data).products[0],console.info("result",M),c.value.lineItem=!1,M}catch(R){return console.info("error",R.message),c.value.lineItem=!1,!1}}async function ne(){c.value.productOptionsPricing=!0,console.info("getProductOptionsPricing");try{const R={objectId:n.quoteId,itemId:a.value},M=await window.productManagerController.getProductOptionsPricing({request:JSON.stringify(R)});return console.info("getProductOptionsPricing:result",M),m.value=JSON.parse(M.data),c.value.productOptionsPricing=!1,m.value}catch(R){return console.info("error",R.message),c.value.productOptionsPricing=!1,!1}}async function X(R){console.info("getRecords");try{const M=await window.productManagerController.getRecords({request:JSON.stringify(R)});return console.info("getRecords:result",M),JSON.parse(M.data)}catch(M){return console.info("error",M.message),!1}}async function P(){c.value.bestOfferPrice=!0,console.info("getBestOfferPrice");const R=[m.value.product.Id];m.value.options.forEach(M=>{R.push(M.Id)});try{const M=await x(R);return c.value.bestOfferPrice=!1,M}catch(M){return console.info("error",M.message),c.value.bestOfferPrice=!1,!1}}async function x(R){const M={accountId:o.accountId,eCatalogItemIds:R,pricePreference:"Heighest Priority"},j=await window.productManagerController.calculateBestOfferPrice({request:JSON.stringify(M)});return console.info("calculateBestOfferPrice:result",j),c.value.bestOfferPrice=!1,JSON.parse(j.data)}async function A(){g.value=!0,c.value.save=!0,console.info("maintainQuoteConfiguration");const R=[],M=[];b.value.categoryOptions.forEach(Z=>{Z.itemTypes.forEach(G=>{G.options.forEach(ie=>{G.selected.includes(ie.itemId)?R.push(L(ie)):ie.qliId&&M.push(ie.qliId)})})});const j={objectId:n.quoteId,eCatalogId:o.eCatalogId,isGenesisAI:!0,blinkUser:!1,optionsToRemove:M,grandFatheredOptionsToRemove:[],productLineItem:{...L(b.value),optionLineItems:R}};console.info("maintainQuoteConfiguration:request",j);const F=await window.productManagerController.maintainQuoteConfiguration({request:JSON.stringify(j)});if(console.info("maintainQuoteConfiguration:result",F),F!=null&&F.error){const Z={title:"Unable to Save Configuration",description:F.error,button:{label:"Back to Configuration",action:()=>{g.value=!1}},cancel:{label:"Quote List",action:()=>{i.push("/quote-item?id="+n.quoteId)}}};r.errorPopup=Z}else h.value=JSON.parse(JSON.stringify(b.value)),console.info("maintainQuoteConfiguration:result",F);c.value.save=!1}function L(R){const M={};R.isAttributes&&R.attributes.forEach(F=>{F.apiName.includes(".")||(F.dataType==="BOOLEAN"?M[F.apiName]=F.value?"true":"false":F.dataType==="REFERENCE"?M[F.apiName]=F.referenceRecordId:M[F.apiName]=F.value)});const j={attributes:M,itemId:R.itemId,lineItemId:R.qliId,lineDescription:R.itemName,qty:R.qty,billingPeriod:R.billingPeriod,...R.offer};return R.billingPeriod&&p.value&&!o.isSinglePricingSchema&&(j.billingPeriod=f.value?"Yearly":"Monthly"),!o.isSinglePricingSchema&&!R.billingPeriod?j.nrcPrice=R.price:(j.applyOnField="Catalog Price",j.salesPrice=R.price,j.nrcPrice=R.nrcPrice),j}async function z(){const R={objectId:o.eCatalogId,productItemId:a.value};try{let M=await window.productManagerController.getProductCrossSells({request:JSON.stringify(R)});if(console.info("getProductCrossSells:result",M),M=M.data?JSON.parse(M.data):{},M.crossSells.length===0)return M;const j=M.crossSells.map(G=>G.Id),F=await x(j),Z=new Map;return F.forEach(G=>{Z.set(G.eCatalogItemId,{...G,...G.pricingTypes[0]})}),M.crossSells.forEach(G=>{G.loading=!1,G.Name=G.XX_ORD1__Line_Description__c||G.XX_ORD1__Item__r.Name,G.Description=G.XX_ORD1__Item__r.XX_ORD1__Product_Description__c,Z.has(G.Id)?(G.Price=Z.get(G.Id).offerPrice,G.priceFormatted=Z.get(G.Id).formattedOfferPrice,G.offer={offerDiscount:Z.get(G.Id).offerDiscount,offerId:Z.get(G.Id).offerId,offerType:Z.get(G.Id).offerType}):(G.Price=G.XX_ORD1__List_Price2__c,G.priceFormatted=G.XX_ORD1__List_Price2__c,G.offer={offerDiscount:0,offerId:null,offerType:null})}),M}catch(M){return console.info("error",M.message),!1}}async function K(R,M){var G,ie;const j={product:{publishKey:b.value.publishKey,lineDescription:b.value.itemName},options:[]};b.value.categoryOptions.forEach(se=>{se.itemTypes.forEach(ue=>{ue.options.forEach(ce=>{ue.selected.includes(ce.itemId)&&j.options.push({publishKey:ce.relationshipInfo.publishKey,lineDescription:ce.itemName})})})}),console.info("evaluateConfigSelection:currentConfig.options",j.options);const F={productJSON:{productItem:{configRules:v.value}},currentConfig:j,selected:R?{publishKey:(G=R.relationshipInfo)==null?void 0:G.publishKey,attributes:R.attributes,lineDescription:R.itemName}:{},unselected:M?{publishKey:(ie=M.relationshipInfo)==null?void 0:ie.publishKey,attributes:M.attributes,lineDescription:M.itemName}:{}};return await rl(F)}async function D(){try{const R=["Name","XX_ORD1__Line_Description__c","XX_ORD1__Item__r.XX_ORD1__Product_Description__c","XX_ORD1__Sales_Price__c","XX_ORD1__SYS_Configuration_Status2__c"],j=(await n.getQuoteLineItemsWithFilteredTable({fields:R,recordId:n.quoteId,filters:[],includeOptions:!1,totalFields:[]})).lineItems;return console.info("fetchQuoteLineItems:res",j),j}catch(R){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",R.message)}}async function H(R){const M={quoteId:n.quoteId,lstQLIRequest:[{eCatalogItemId:R.Id,quantity:1,offerApplicable:R.offer}]};try{const j=await window.productManagerController.createQuoteProducts({request:JSON.stringify(M)});console.info("getProductCrossSells:result",j)}catch(j){return console.info("error",j.message),!1}}return{itemId:a,configuration:b,_configurationCopy:h,lineItem:u,savedScreen:g,loading:c,summary:C,addOns:y,summaryPrices:E,optionByItemId:I,attributesByQLIId:s,optionByPublishKey:O,showYearlyPricing:f,isYearlyPricingExist:p,isChangedConfiguration:_,isRecurringPricingSchema:l,changePricingScheme:T,createQuoteProducts:H,resetConfigurator:S,fetchQuoteLineItems:D,getRecords:X,getProductCrossSells:z,initConfigurator:w,maintainQuoteConfiguration:A,evaluateConfigSelection:K}}),al={class:"ect-p-4 ect-flex ect-gap-2 ect-items-center ect-justify-between ect-border-b ect-border-gray-200"},ll={class:"ect-flex ect-items-center ect-gap-3"},sl={class:"ect-text-xl ect-font-semibold ect-text-gray-700 ect-leading-relaxed"},cl={key:0,class:"ect-flex ect-gap-1.5 ect-items-center"},dl=e.createElementVNode("span",{class:"ect-text-sm ect-text-gray-700 ect-leading-relaxed"},"Saving configuration...",-1),ul={key:1,class:"ect-flex ect-gap-1.5 ect-items-center"},fl=e.createElementVNode("span",{class:"ect-text-sm ect-text-gray-700 ect-leading-relaxed"},"Configuration Saved Successfully",-1),hl={key:1,class:"ect-flex ect-flex-col ect-gap-4 ect-flex-1 ect-overflow-y-auto ect-mb-16"},pl=e.createElementVNode("h3",{class:"ect-text-lg ect-font-semibold ect-text-gray-700 ect-leading-relaxed ect-p-4 ect-pb-0"},"You may consider these products",-1),ml={class:"ect-flex ect-flex-col ect-gap-4 ect-p-4 ect-pt-0 ect-overflow-y-auto"},gl=["data-test-id"],yl={class:"ect-flex-1 ect-flex ect-flex-col ect-gap-2"},bl={class:"ect-text-sm ect-font-semibold ect-text-gray-800 ect-leading-tight"},_l={class:"ect-text-sm ect-font-medium ect-text-gray-600 ect-leading-relaxed ect-line-clamp-2"},vl={class:"ect-flex ect-flex-row ect-justify-between ect-items-center"},Cl={class:"ect-text-sm ect-font-semibold ect-text-gray-800"},El={key:2,class:"ect-flex ect-flex-col ect-gap-4 ect-m-4 ect-flex-1 ect-overflow-y-auto"},kl=e.createElementVNode("h3",{class:"ect-text-lg ect-font-semibold ect-text-gray-700 ect-leading-relaxed"},"What do you want to do next?",-1),wl={class:"ect-flex ect-flex-col ect-gap-4"},Nl=["data-test-id","onClick"],xl={class:"ect-flex ect-items-center ect-justify-center"},Ol={class:"ect-flex ect-flex-col ect-items-center ect-gap-2 ect-w-full"},Sl=["data-test-id"],Vl=["data-test-id"],Il={key:3,class:"ect-bg-light-bg-x ect-border-t ect-border-gray-200 ect-flex-shrink-0 ect-sticky ect-bottom-0 ect-pb-4"},Tl={class:"ect-flex ect-flex-col ect-gap-4"},Al={class:"ect-text-lg ect-font-semibold ect-text-gray-700 ect-leading-relaxed ect-p-4 ect-pb-0"},Bl={class:"ect-flex ect-flex-col ect-gap-4 ect-p-4 ect-pt-0 ect-overflow-y-auto"},Ll={class:"ect-bg-white ect-border ect-border-gray-300 ect-rounded-md ect-p-3 ect-flex ect-flex-col","data-test-id":"configurator-recommend-card-next-product"},Ml={class:"ect-flex-1 ect-flex ect-flex-col ect-gap-2"},Pl={class:"ect-text-sm ect-font-semibold ect-text-gray-800 ect-leading-tight"},Rl={class:"ect-text-sm ect-font-medium ect-text-gray-600 ect-leading-relaxed ect-line-clamp-2"},ql={class:"ect-flex ect-flex-row ect-justify-between ect-items-center"},Dl={class:"ect-text-sm ect-font-semibold ect-text-gray-800"},jl={__name:"ConfiguratorRecommend",setup(t){const o=it(),n=dt(),r=an(),i=e.computed(()=>o.configuration),a=e.ref(!0),d=e.ref(""),b=e.ref([{icon:"configuration",title:"Back to current Product Configuration",description:"Returns to the active product configuration page.",link:"/item/overview",action:"backToConfiguration"},{icon:"menu",title:"Back to Quote List Page",description:"Returns to the main quote list page.",link:"/quote-item",action:"backToQuoteList"}]),h=e.ref(null),v=e.ref([]),u=async c=>{c.loading=!0,await o.createQuoteProducts(c),c.disabled=!0,c.loading=!1},m=c=>{c.action==="backToConfiguration"?o.savedScreen=!1:c.action==="backToQuoteList"?r.push("/quote-item?id="+n.quoteId):c.link&&r.push(c.link)};async function s(){const c=await o.fetchQuoteLineItems();console.info("getQuoteLineItems1:_quoteLineItems",c);const f=c.filter(p=>p.XX_ORD1__SYS_Configuration_Status2__c=="Needs Configuration").length;console.info("getQuoteLineItems2:needsConfigurationCount",f),d.value=`(${c.length-f}/${c.length})`;const l=c.find(p=>p.XX_ORD1__SYS_Configuration_Status2__c=="Needs Configuration"&&p.Id!=o.qliId);return console.info("getQuoteLineItems3:result",l),h.value=l?{Name:l.XX_ORD1__Line_Description__c,Description:l.XX_ORD1__Item__r.XX_ORD1__Product_Description__c,Price:l.XX_ORD1__Sales_Price__c,XX_ORD1__Item__c:l.XX_ORD1__Item__c,Id:l.Id}:null,console.info("getQuoteLineItems4:configueredProduct",h.value),c}async function g(){o.resetConfigurator(),r.push({path:"/configurator/"+h.value.XX_ORD1__Item__c+"/"+h.value.Id}),o.initConfigurator(h.value.XX_ORD1__Item__c,h.value.Id)}return e.onBeforeMount(async()=>{a.value=!0;const c=await s(),f=await o.getProductCrossSells(),l=new Set;c.forEach(p=>{l.add(p.XX_ORD1__Item__c)}),f.crossSells.forEach(p=>{p.disabled=l.has(p.XX_ORD1__Item__c)}),v.value=f.crossSells||[],a.value=!1}),(c,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",al,[e.createElementVNode("div",ll,[e.createVNode(we,{icon:"arrow",symbol:"",size:12,onClick:f[0]||(f[0]=l=>e.unref(o).savedScreen=!1)}),e.createElementVNode("h2",sl,e.toDisplayString(i.value.itemName),1)]),e.unref(o).loading.save?(e.openBlock(),e.createElementBlock("div",cl,[e.createVNode(so,{svg:""}),dl])):(e.openBlock(),e.createElementBlock("div",ul,[e.createVNode(we,{icon:"check",color:"#136E05",size:14,"data-test-id":"item-tabs-before-button-icon"}),fl]))]),a.value?(e.openBlock(),e.createBlock(zn,{key:0,type:"recommendations",rows:4})):v.value.length>0?(e.openBlock(),e.createElementBlock("div",hl,[pl,e.createElementVNode("div",ml,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,(l,p)=>(e.openBlock(),e.createElementBlock("div",{key:l.Id||p,class:"ect-bg-white ect-border ect-border-gray-300 ect-rounded-md ect-p-3 ect-flex ect-flex-col","data-test-id":`configurator-recommend-card-${l.Id||p}`},[e.createElementVNode("div",yl,[e.createElementVNode("h4",bl,e.toDisplayString(l.Name),1),e.createElementVNode("p",_l,e.toDisplayString(l.Description),1)]),e.createElementVNode("div",vl,[e.createElementVNode("div",Cl,e.toDisplayString(c.$formatCurrency(l.Price)),1),e.createVNode(ze,{btype:l.disabled?"secondary":"primary","button-style":l.disabled?"normal":"outlined",size:"medium",class:e.normalizeClass({"ect-w-[120px]":l.loading}),loading:l.loading,disabled:l.disabled||l.loading,"data-test-id":`configurator-recommend-button-add-${l.Id||p}`,onClick:_=>u(l)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.loading?"":l.disabled?"Added to Quote":"Add to Quote"),1)]),_:2},1032,["btype","button-style","class","loading","disabled","data-test-id","onClick"])])],8,gl))),128))])])):(e.openBlock(),e.createElementBlock("div",El,[kl,e.createElementVNode("div",wl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(l,p)=>(e.openBlock(),e.createElementBlock("div",{key:l.title||p,class:"ect-bg-white ect-border ect-border-[#DEDEDE] ect-rounded-xl ect-p-4 md:ect-p-5 lg:ect-p-6 ect-flex ect-flex-col ect-items-center ect-gap-4 md:ect-gap-6 lg:ect-gap-8 ect-cursor-pointer ect-transition-all ect-duration-200 hover:ect-shadow-md hover:ect-border-gray-400","data-test-id":`configurator-recommend-redirect-card-${p}`,onClick:_=>m(l)},[e.createElementVNode("div",xl,[e.createVNode(we,{icon:l.icon,size:20,color:"#000000","data-test-id":`configurator-recommend-redirect-icon-${p}`},null,8,["icon","data-test-id"])]),e.createElementVNode("div",Ol,[e.createElementVNode("h4",{class:"ect-text-sm ect-font-semibold ect-text-[#5F5F5F] ect-text-center ect-leading-[1.43]","data-test-id":`configurator-recommend-redirect-title-${p}`},e.toDisplayString(l.title),9,Sl),e.createElementVNode("p",{class:"ect-text-sm ect-font-normal ect-text-[#828282] ect-text-center ect-leading-[1.71]","data-test-id":`configurator-recommend-redirect-description-${p}`},e.toDisplayString(l.description),9,Vl)])],8,Nl))),128))])])),h.value?(e.openBlock(),e.createElementBlock("footer",Il,[e.createElementVNode("div",Tl,[e.createElementVNode("h3",Al," Configuere next product from your quote "+e.toDisplayString(d.value),1),e.createElementVNode("div",Bl,[e.createElementVNode("div",Ll,[e.createElementVNode("div",Ml,[e.createElementVNode("h4",Pl,e.toDisplayString(h.value.Name),1),e.createElementVNode("p",Rl,e.toDisplayString(h.value.Description),1)]),e.createElementVNode("div",ql,[e.createElementVNode("div",Dl,e.toDisplayString(c.$formatCurrency(h.value.Price)),1),e.createVNode(ze,{btype:"primary","button-style":"filled",size:"medium","data-test-id":"configurator-recommend-button-add-next-product",onClick:g},{default:e.withCtx(()=>[e.createTextVNode(" Configure Now ")]),_:1})])])])])])):e.createCommentVNode("",!0)],64))}},$l=["data-test-id"],Fl=ke({__name:"AppPill",props:{variant:{type:String,default:"",validator:t=>["success","error",""].includes(t)},dataTestId:{type:String,default:""}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["ect-pill",{"ect-pill-success":t.variant==="success","ect-pill-error":t.variant==="error","ect-pill-default":!t.variant}]),"data-test-id":t.dataTestId},[e.renderSlot(o.$slots,"default",{},void 0,!0)],10,$l))}},[["__scopeId","data-v-c7f05fa0"]]),Hl=["data-test-id"],Ul=["data-test-id"],zl=["data-test-id","onClick"],Kl=["data-test-id"],Zl=ke({__name:"AppTabsV2",props:{showTabs:{type:Boolean,default:!0},modelValue:{type:String,default:""},border:{type:Boolean,default:!1},tabs:{type:Array,required:!0,validator:t=>t.every(o=>typeof o=="object"&&o.title&&o.key&&(o.sections===void 0||Array.isArray(o.sections)))},dataTestId:{type:String,required:!0}},emits:["update:modelValue","tab-change"],setup(t,{emit:o}){const n=t,r=o,i=e.computed(()=>{var d;return n.modelValue||((d=n.tabs[0])==null?void 0:d.key)||""}),a=d=>{r("update:modelValue",d),r("tab-change",d)};return(d,b)=>(e.openBlock(),e.createElementBlock("div",{class:"ect-page-tabs","data-test-id":t.dataTestId},[t.showTabs?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ect-page-tabs-header",[{"ect-tab-border":t.border}]]),"data-test-id":`${t.dataTestId}-header`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tabs,h=>(e.openBlock(),e.createElementBlock("button",{key:h.key,class:e.normalizeClass(["ect-page-tab-button",`ect-page-tab-button${i.value===h.key?"-active":""} ${h.tabClass||""}`]),"data-test-id":`${t.dataTestId}-tab-${h.key}`,onClick:v=>a(h.key)},[e.createTextVNode(e.toDisplayString(h.title)+" ",1),h.pill!==void 0&&h.pill!==null?(e.openBlock(),e.createBlock(Fl,{key:0,class:"ect-ml-2",variant:h.pillStyle,"data-test-id":`${t.dataTestId}-tab-${h.key}-pill`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.pill),1)]),_:2},1032,["variant","data-test-id"])):e.createCommentVNode("",!0)],10,zl))),128))],10,Ul)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"ect-page-tab-content","data-test-id":`${t.dataTestId}-content`},null,8,Kl)],8,Hl))}},[["__scopeId","data-v-f22cb1ed"]]),Ql=["data-test-id"],Xl=["disabled","data-test-id"],Jl=["value","disabled","data-test-id"],Wl=["disabled","data-test-id"],cn={__name:"CounterButton",props:{value:{type:Number,required:!0,default:null},min:{type:Number,default:1},max:{type:Number,default:999},empty:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},dataTestId:{type:String,required:!0}},emits:["update:value","change"],setup(t,{emit:o}){const n=t,r=o,i=e.computed(()=>n.min==null?0:n.min),a=e.computed(()=>n.max==null?999:n.max),d=(y,E,I)=>Math.min(Math.max(y,E),I),b=y=>{if(y==null||y==="")return NaN;const E=Number(y);return Number.isFinite(E)?E:NaN},h=e.ref(null),v=e.ref(n.value??i.value),u=y=>{v.value=d(y,i.value,a.value)};n.value!==null&&u(n.value);const m=e.computed(()=>v.value),s=e.computed(()=>h.value!=null?h.value:String(m.value)),g=e.computed(()=>n.disabled||m.value<=i.value),c=e.computed(()=>n.disabled||m.value>=a.value);function f(y){y!==n.value&&(v.value=y,r("update:value",y),r("change",y))}function l(){if(g.value)return;const y=d(m.value-1,i.value,a.value);h.value=null,f(y)}function p(){if(c.value)return;const y=d(m.value+1,i.value,a.value);h.value=null,f(y)}function _(y){const I=String(y.target.value??"").replace(/\D+/g,"");h.value=I}function C(){const y=b(h.value),E=i.value,I=d(Number.isNaN(y)?E:y,i.value,a.value);h.value=null,f(I)}return(y,E)=>(e.openBlock(),e.createElementBlock("div",{class:"ect-flex ect-items-center ect-gap-1","data-test-id":t.dataTestId},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ect-h-7 ect-w-7 ect-border ect-border-gray ect-rounded-md ect-flex ect-items-center ect-justify-center ect-text-gray-700 ect-text-sm hover:ect-border-gray-400 ect-transition-colors ect-bg-white",{"ect-opacity-50":g.value,"ect-cursor-not-allowed":g.value}]),disabled:g.value,"data-test-id":`${t.dataTestId}-decrement`,onClick:l}," - ",10,Xl),e.createElementVNode("input",{type:"text",inputmode:"numeric",pattern:"[0-9]*",value:t.empty?"":s.value,disabled:t.disabled,class:"ect-h-7 ect-w-[48px] ect-px-2 ect-border ect-border-gray ect-rounded-md ect-text-center ect-text-sm ect-font-medium ect-text-gray-900 focus:ect-outline-none focus:ect-border-gray-400 ect-bg-white","data-test-id":`${t.dataTestId}-input`,onInput:_,onBlur:C},null,40,Jl),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["ect-h-7 ect-w-7 ect-border ect-border-gray ect-rounded-md ect-flex ect-items-center ect-justify-center ect-text-gray-700 ect-text-sm hover:ect-border-gray-400 ect-transition-colors ect-bg-white",{"ect-opacity-50":c.value,"ect-cursor-not-allowed":c.value}]),disabled:c.value,"data-test-id":`${t.dataTestId}-increment`,onClick:p}," + ",10,Wl)],8,Ql))}},Gl={class:"ect-flex ect-justify-end ect-items-center ect-gap-2.5 ect-px-6 ect-pb-6 ect-pt-4 ect-bg-white ect-border-t ect-border-gray-300 ect-shadow-[0_-2px_4px_0px_rgba(0,0,0,0.11)]","data-test-id":"configurator-footer"},Yl={"data-test-id":"configurator-footer-quantity"},es={class:"ect-flex ect-justify-end ect-items-center ect-gap-6 ect-px-8 ect-py-0 ect-flex-1","data-test-id":"configurator-footer-prices"},ts=["data-test-id"],ns=["data-test-id"],rs=["data-test-id"],os=["data-test-id"],is={__name:"ConfiguratorFooter",props:{item:{type:Object,required:!0,default:()=>{}},disabled:{type:Boolean,default:!1},btnText:{type:String,default:"Save"}},emits:["update:qty","continue"],setup(t,{emit:o}){const n=it(),r=t,i=e.ref(r.item),a=e.computed(()=>{const h=n.summaryPrices,v=[];return n.isRecurringPricingSchema?(v.push({label:"One Time Price",value:h.oneTimePrice,highlight:!1}),v.push({label:n.showYearlyPricing?"Yearly Price":"Monthly Price",value:h.recurringPrice,highlight:!1})):(v.push({label:"Base Price",value:h.basePrice,highlight:!1}),v.push({label:"Add Ons",value:h.addOns,highlight:!1}),v.push({label:"Total Price",value:h.total,highlight:!1})),v}),d=o,b=()=>{r.disabled||d("continue")};return(h,v)=>(e.openBlock(),e.createElementBlock("footer",Gl,[e.createElementVNode("div",Yl,[e.createVNode(cn,{value:i.value.qty,"onUpdate:value":v[0]||(v[0]=u=>i.value.qty=u),min:1,max:999,disabled:t.disabled,"is-selected":!0,"data-test-id":"configurator-footer-counter-button"},null,8,["value","disabled"])]),e.createElementVNode("div",es,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(u,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:m},[e.createElementVNode("div",{class:"ect-flex ect-flex-col ect-justify-center","data-test-id":`configurator-footer-price-${m}`},[e.createElementVNode("span",{class:"ect-text-xs ect-font-normal ect-text-gray-500 ect-text-left","data-test-id":`configurator-footer-price-label-${m}`},e.toDisplayString(u.label),9,ns),e.createElementVNode("span",{class:e.normalizeClass(["ect-text-left",u.highlight?"ect-text-lg ect-font-bold ect-text-green-700":"ect-text-sm ect-font-medium ect-text-gray-800 "]),"data-test-id":`configurator-footer-price-value-${m}`},e.toDisplayString(h.$formatCurrency(u.value)),11,rs)],8,ts),m<a.value.length-1?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ect-w-0 ect-h-5 ect-border-l ect-border-gray-400","data-test-id":`configurator-footer-divider-${m}`},null,8,os)):e.createCommentVNode("",!0)],64))),128))]),e.createVNode(ze,{class:"ect-min-w-[100px]",btype:t.disabled?"secondary":"primary",disabled:t.disabled,"button-style":"primary",size:"medium","data-test-id":"configurator-footer-button-continue",onClick:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.btnText),1)]),_:1},8,["btype","disabled"])]))}},as={class:"ect-w-full ect-bg-white ect-mb-4","data-test-id":"configurator-type-section"},ls={class:"ect-sticky ect-top-0 ect-z-30 ect-bg-white ect-shadow-sm ect-p-3 ect-px-4 ect-border-b ect-border-gray-200 ect-flex ect-justify-between ect-items-center","data-test-id":"configurator-type-header-sticky"},ss={class:"ect-flex ect-flex-col"},cs={class:"ect-font-bold ect-text-text-success ect-leading-tight"},ds=["innerHTML"],us={key:0,class:"ect-flex ect-items-center ect-gap-2 ect-px-2 ect-py-1","data-test-id":"configurator-type-message"},fs={class:"ect-text-xs ect-font-medium ect-text-gray-600 ect-leading-tight ect-min-w-[190px]"},hs={class:"ect-divide-y ect-divide-gray-100 ect-overflow-y-auto"},ps={__name:"ConfiguratorType",props:{title:{type:String,required:!0},description:{type:String,default:""},message:{type:String,default:""}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("section",as,[e.createElementVNode("header",ls,[e.createElementVNode("div",ss,[e.createElementVNode("h2",cs,e.toDisplayString(t.title),1),t.description?(e.openBlock(),e.createElementBlock("p",{key:0,class:"ect-mt-1 ect-text-xs ect-text-gray-500 ect-leading-tight",innerHTML:t.description},null,8,ds)):e.createCommentVNode("",!0)]),t.message?(e.openBlock(),e.createElementBlock("div",us,[e.createVNode(we,{icon:"info",symbol:"",color:"#198708",size:14,"data-test-id":"configurator-type-message-icon"}),e.createElementVNode("span",fs,e.toDisplayString(t.message),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",hs,[e.renderSlot(o.$slots,"default")])]))}},ms={__name:"ShadowDisplay",props:{content:{type:String,required:!0}},setup(t){const o=t,n=e.ref(null);let r=null;return e.onMounted(()=>{n.value&&!r&&(r=n.value.attachShadow({mode:"open"}),r.innerHTML=o.content)}),e.watch(()=>o.content,i=>{r&&(r.innerHTML=i)}),(i,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"host",ref:n},null,512))}},gs=["data-test-id"],ys=["data-test-id"],bs=["data-test-id"],_s=[e.createElementVNode("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("g",{id:"Group"},[e.createElementVNode("path",{id:"Vector",d:"M7 1.3125V12.6875",stroke:"#A86200","stroke-linecap":"round","stroke-linejoin":"round"}),e.createElementVNode("path",{id:"Vector_2",d:"M1.3125 7H12.6875",stroke:"#A86200","stroke-linecap":"round","stroke-linejoin":"round"})])],-1)],vs=["data-test-id"],Cs=["data-test-id"],Es=["data-test-id"],ks=["data-test-id"],ws=["data-test-id"],Ns=["data-test-id","innerHTML"],Ge={__name:"Tag",props:{label:{type:String,default:""},value:{type:String,default:""},addButton:{type:Boolean,default:!1},editButton:{type:Boolean,default:!1},dataTestId:{type:String,default:""}},setup(t){const o=t,n=e.computed(()=>{const r=o.value;if(typeof r!="string")return!1;const i=new DOMParser().parseFromString(r,"text/html");return Array.from(i.body.childNodes).some(a=>a.nodeType===1)});return(r,i)=>t.addButton?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ect-bg-orange-4 ect-flex ect-gap-1 ect-justify-center ect-items-center ect-px-2 ect-py-0.5 ect-text-xs ect-font-medium ect-text-center ect-rounded-md ect-border ect-border-solid ect-border-orange-secondary","data-test-id":t.dataTestId},[e.createElementVNode("span",{class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-orange-secondary ect-flex ect-items-center ect-gap-1","data-test-id":`${t.dataTestId}-content`},[e.createElementVNode("div",{"data-test-id":`${t.dataTestId}-add-icon`},_s,8,bs),e.createTextVNode(" "+e.toDisplayString(t.label),1)],8,ys)],8,gs)):t.editButton?(e.openBlock(),e.createElementBlock("div",{key:1,class:"ect-bg-white ect-flex ect-gap-1 ect-justify-center ect-items-center ect-px-2 ect-py-0.5 ect-text-xs ect-font-medium ect-text-center ect-rounded-md ect-border ect-border-solid ect-border-success","data-test-id":t.dataTestId},[e.createElementVNode("span",{class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-success ect-flex ect-items-center ect-gap-1","data-test-id":`${t.dataTestId}-content`},e.toDisplayString(t.label),9,Cs)],8,vs)):(e.openBlock(),e.createElementBlock("div",{key:2,class:"ect-bg-white ect-px-2 ect-py-0.5 ect-text-xs ect-font-medium ect-rounded-md ect-border ect-border-solid ect-border-neutral-200","data-test-id":t.dataTestId},[e.createElementVNode("span",{class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-zinc-500","data-test-id":`${t.dataTestId}-label`},e.toDisplayString(t.label),9,ks),t.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-zinc-500","data-test-id":`${t.dataTestId}-separator`}," : ",8,ws)):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createBlock(ms,{key:1,content:t.value},null,8,["content"])):t.value?(e.openBlock(),e.createElementBlock("span",{key:2,class:"ect-self-stretch ect-my-auto ect-text-xs ect-leading-5 ect-text-neutral-700","data-test-id":`${t.dataTestId}-value`,innerHTML:t.value},null,8,Ns)):e.createCommentVNode("",!0)],8,Es))}},xs=["data-test-id"],Os=["data-test-id"],Ss=["data-test-id"],Vs=["type","step","min","data-test-id"],Qn=ke({__name:"InputEdit",props:{modelValue:{type:String,required:!0},type:{type:String,default:"string",validator:t=>["string","number","currency"].includes(t)},tag:{type:String,default:"span"},disabled:{type:Boolean,default:!1},dataTestId:{type:String,required:!0}},emits:["update:modelValue","change"],setup(t,{expose:o,emit:n}){const r=t,i=n,a=e.ref(!1),d=e.ref(!1),b=e.ref(""),h=e.ref(null),v=e.computed(()=>r.type==="currency"?p(r.modelValue):r.type==="number"?_(r.modelValue):r.modelValue),u=e.computed(()=>r.type==="string"?"text":"number"),m=e.computed(()=>r.type==="currency"?"0.01":void 0),s=e.computed(()=>r.type==="currency"?"0":void 0),g=()=>{r.disabled||(r.type==="currency"?b.value=parseFloat(r.modelValue)||"0.00":r.type==="number"?b.value=parseFloat(r.modelValue)||"0":b.value=r.modelValue,a.value=!0,e.nextTick(()=>{h.value&&(h.value.focus(),h.value.select())}))},c=()=>{let C=b.value;if(r.type==="number"||r.type==="currency"){const y=parseFloat(b.value);isNaN(y)?C=r.modelValue:C=r.type==="currency"?y.toFixed(2):y.toString()}C!==r.modelValue&&(i("update:modelValue",C),i("change",C)),a.value=!1},f=()=>{b.value=r.modelValue,a.value=!1},l=()=>{a.value&&c()},p=C=>!C||isNaN(C)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(parseFloat(C)),_=C=>!C||isNaN(C)?"0":new Intl.NumberFormat("en-US").format(parseFloat(C));return e.watch(()=>r.modelValue,C=>{a.value||(b.value=C)}),o({startEditing:g,saveChanges:c,cancelEditing:f}),(C,y)=>{const E=e.resolveDirective("click-outside");return e.openBlock(),e.createElementBlock("div",{class:"ect-relative ect-inline-block ect-min-w-[60px] ect-h-[30px]","data-test-id":t.dataTestId,onMouseenter:y[1]||(y[1]=I=>d.value=!0),onMouseleave:y[2]||(y[2]=I=>d.value=!1)},[a.value?e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:1,class:"ect-w-full ect-h-full","data-test-id":`${t.dataTestId}-input-wrapper`},[e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:h,"onUpdate:modelValue":y[0]||(y[0]=I=>b.value=I),type:u.value,step:m.value,min:s.value,class:e.normalizeClass(["ect-w-full ect-h-full ect-px-3 ect-bg-white ect-border ect-border-green-500 ect-rounded-sm ect-text-gray-700 ect-text-base ect-font-sans ect-outline-none ect-duration-200",C.$attrs.class]),"data-test-id":`${t.dataTestId}-input`,onKeyup:[e.withKeys(c,["enter"]),e.withKeys(f,["esc"])],onBlur:c},null,42,Vs),[[e.vModelDynamic,b.value]])],8,Ss)),[[E,l]]):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ect-flex ect-items-center ect-gap-2 ect-rounded ect-transition-colors ect-duration-200",{"ect-cursor-pointer":!t.disabled}]),"data-test-id":`${t.dataTestId}-display`,onClick:g},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.tag),e.mergeProps(C.$attrs,{class:"ect-m-0 ect-text-inherit","data-test-id":`${t.dataTestId}-text`}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v.value)+" ",1),e.createVNode(we,{class:e.normalizeClass(d.value&&!t.disabled?"ect-visible":"ect-invisible"),icon:"edit",size:"12",color:"#828282","data-test-id":`${t.dataTestId}-edit-icon`},null,8,["class","data-test-id"])]),_:1},16,["data-test-id"]))],10,Os))],40,xs)}}},[["__scopeId","data-v-07416d80"]]),Is=["data-test-id","data-publish-key"],Ts={key:0,class:"ect-text-xs ect-text-gray-500 ect-text-white ect-font-medium ect-leading-tight ect-absolute ect-top-[-.7rem] ect-left-[-1rem] ect-bg-text-success ect-rounded-xl ect-px-2 ect-py-1"},As={key:1,class:"ect-flex ect-items-start ect-gap-4 ect-p-3 ect-px-4"},Bs={key:0,class:"ect-w-16 ect-h-16 ect-flex ect-items-center ect-justify-center ect-rounded-lg ect-bg-gray-200 ect-flex-shrink-0"},Ls=["src","alt"],Ms={class:"ect-flex-1 ect-min-w-0"},Ps={class:"ect-flex ect-gap-4 ect-items-center ect-justify-between"},Rs={class:"ect-flex ect-flex-row ect-gap-3"},qs=e.createElementVNode("div",{class:"ect-w-px ect-h-auto ect-bg-gray-200 ect-mx-2"},null,-1),Ds={class:"ect-flex ect-flex-col ect-max-w-[125px]"},js={class:"ect-flex ect-items-start ect-justify-center ect-ml-2 ect-mt-0"},$s=["innerHTML"],Fs={key:0,class:"ect-flex ect-flex-wrap ect-gap-2.5 ect-mt-2"},Hs=["data-test-id"],Us=["data-test-id"],zs={key:1,class:"ect-inline-block ect-mb-2"},Ks={key:2,class:"ect-flex ect-flex-col ect-gap-3 ect-p-3 ect-h-full ect-justify-between"},Zs={class:"ect-flex ect-items-start ect-gap-2"},Qs={class:"ect-w-16 ect-h-16 ect-rounded-lg ect-bg-gray-200 ect-flex-shrink-0 ect-overflow-hidden"},Xs=["src","alt"],Js={class:"ect-flex-1 ect-min-w-0"},Ws={class:"ect-text-sm ect-font-semibold ect-text-gray-900 ect-leading-tight"},Gs={class:"ect-mt-1 ect-text-sm ect-text-gray-700 ect-leading-tight"},Ys={class:"ect-flex ect-items-start ect-justify-center ect-ml-2 ect-mt-0"},ec={key:0,class:"ect-flex ect-flex-wrap ect-gap-1.5"},tc=["data-test-id"],nc=["data-test-id"],rc={key:1,class:"ect-inline-block ect-mb-2"},oc={class:"ect-flex ect-justify-between ect-items-center"},ic={class:"ect-flex ect-flex-col"},ac=e.createElementVNode("p",{class:"ect-text-xs ect-text-gray-500 ect-font-medium ect-leading-tight"},"Price",-1),lc={key:3,"data-test-id":"configurator-item-slot-details",class:"ect-bg-white ect-rounded-md"},sc={__name:"ConfiguratorItem",props:{item:{type:Object,required:!0},name:{type:String,required:!0},description:{type:String,default:""},imageUrl:{type:String,default:""},price:{type:Number,required:!0},quantity:{type:Number,default:1},selected:{type:Boolean,default:!1},tags:{type:Array,default:()=>[]},attributes:{type:Array,default:()=>[]},size:{type:Number,default:1},minQuantity:{type:Number,default:null},maxQuantity:{type:Number,default:null},showImage:{type:Boolean,default:!1},option:{type:Object,default:null},isAttributes:{type:Boolean,default:!1},showAttributes:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:quantity","update:name","edit-attributes"],setup(t,{emit:o}){const n=t,r=o,i=e.ref(null),a=e.ref(0),d=e.ref(n.item),b=e.computed(()=>d.value.relationshipInfo.relationship==="Kit"?"ect-bg-green-3 ect-border-gray-200 ect-border-success":n.disabled?"ect-bg-light-bg-x ect-border-gray-200":n.selected?"ect-bg-green-3 ect-border-gray-200 ect-border-success":"ect-bg-white ect-border-gray-200 hover:ect-border-success"),h=e.computed({get:()=>n.quantity,set:c=>r("update:quantity",c)}),v=e.computed({get:()=>n.name,set:c=>r("update:name",c)}),u=c=>{r("update:quantity",c)},m=e.computed(()=>{if(a.value===0)return n.tags;const f=Math.floor(a.value/120);return n.tags.slice(0,Math.max(1,f))}),s=e.computed(()=>Math.max(0,n.tags.length-m.value.length)),g=()=>{if(i.value){const c=i.value,f=80,l=120,p=32,_=64;a.value=c.offsetWidth-f-l-p-_}};return e.onMounted(()=>{e.nextTick(()=>{g()})}),e.watch(()=>n.tags,()=>{e.nextTick(()=>{g()})},{deep:!0}),e.onMounted(()=>{window.addEventListener("resize",g)}),(c,f)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"containerRef",ref:i,class:e.normalizeClass(["ect-w-full ect-rounded-md ect-border-1 ect-transition-colors ect-relative",b.value]),"data-test-id":`configurator-item-${t.item.itemId}`,"data-publish-key":t.item.publishKey},[t.item.relationshipInfo.relationship==="Kit"?(e.openBlock(),e.createElementBlock("div",Ts," KIT ")):e.createCommentVNode("",!0),t.size===1?(e.openBlock(),e.createElementBlock("div",As,[t.showImage?(e.openBlock(),e.createElementBlock("div",Bs,[t.imageUrl?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.imageUrl,alt:v.value,class:"ect-w-full ect-h-full ect-object-cover"},null,8,Ls)):(e.openBlock(),e.createBlock(we,{key:1,disabled:"",icon:"image",symbol:"",size:20,color:"#ACACAC"}))])):e.createCommentVNode("",!0),e.createElementVNode("div",Ms,[e.createElementVNode("div",Ps,[e.createVNode(Qn,{modelValue:v.value,"onUpdate:modelValue":f[0]||(f[0]=l=>v.value=l),tag:"h3",class:"ect-text-sm ect-font-semibold ect-text-gray-900 ect-leading-tight"},null,8,["modelValue"]),e.createElementVNode("div",Rs,[e.createElementVNode("div",{onClick:f[2]||(f[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(cn,{value:h.value,"onUpdate:value":f[1]||(f[1]=l=>h.value=l),min:t.minQuantity,max:t.maxQuantity,"data-test-id":`configurator-item-counter-${t.item.itemId}`,onChange:u},null,8,["value","min","max","data-test-id"])]),qs,e.createElementVNode("div",Ds,[e.createVNode(Qn,{modelValue:d.value.price,"onUpdate:modelValue":f[3]||(f[3]=l=>d.value.price=l),tag:"p",type:"currency",class:"ect-text-base ect-font-bold"},null,8,["modelValue"])]),e.createElementVNode("div",js,[e.renderSlot(c.$slots,"selection-control")])])]),e.createElementVNode("p",{class:"ect-mt-2 ect-text-sm ect-text-gray-700 ect-leading-tight",innerHTML:t.description},null,8,$s),t.isAttributes&&t.showAttributes&&t.selected?(e.openBlock(),e.createElementBlock("div",Fs,[d.value.getTags().length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(l,p)=>(e.openBlock(),e.createElementBlock("span",{key:p,class:"ect-inline-block"},[e.createVNode(Ge,{label:l.label,value:l.value},null,8,["label","value"])]))),128)),s.value>0?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"ect-text-xs ect-text-gray-700 ect-border ect-border-gray-300 ect-rounded-md ect-px-2 ect-py-0.5","data-test-id":`configurator-item-button-more-tags-${t.item.itemId}`,onClick:f[4]||(f[4]=e.withModifiers(()=>{},["stop"]))}," +"+e.toDisplayString(s.value)+" more ",9,Hs)):e.createCommentVNode("",!0),t.selected?(e.openBlock(),e.createElementBlock("button",{key:1,"data-test-id":`configurator-item-button-edit-attributes-${t.item.itemId}`,onClick:f[5]||(f[5]=l=>r("edit-attributes"))},[e.createVNode(Ge,{label:"Edit attributes","edit-button":""})],8,Us)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock("span",zs,[e.createElementVNode("button",{"data-test-id":"configurator-info-button-add-attributes",onClick:f[6]||(f[6]=l=>r("edit-attributes"))},[e.createVNode(Ge,{label:"Add attributes","add-button":""})])]))])):e.createCommentVNode("",!0)])])):(e.openBlock(),e.createElementBlock("div",Ks,[e.createElementVNode("div",Zs,[e.createElementVNode("div",Qs,[t.imageUrl?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.imageUrl,alt:t.name,class:"ect-w-full ect-h-full ect-object-cover"},null,8,Xs)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Js,[e.createElementVNode("h3",Ws,e.toDisplayString(t.name),1),e.createElementVNode("p",Gs,e.toDisplayString(t.description),1)]),e.createElementVNode("div",Ys,[e.renderSlot(c.$slots,"selection-control")])]),t.isAttributes&&t.showAttributes&&t.selected?(e.openBlock(),e.createElementBlock("div",ec,[d.value.getTags().length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(l,p)=>(e.openBlock(),e.createElementBlock("span",{key:p,class:"ect-inline-block"},[e.createVNode(Ge,{label:l.label,value:l.value},null,8,["label","value"])]))),128)),s.value>0?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"ect-text-xs ect-text-gray-700 ect-border ect-border-gray-300 ect-rounded-md ect-px-2 ect-py-0.5","data-test-id":`configurator-item-button-more-tags-${t.item.itemId}`,onClick:f[7]||(f[7]=e.withModifiers(()=>{},["stop"]))}," +"+e.toDisplayString(s.value)+" more ",9,tc)):e.createCommentVNode("",!0),t.selected?(e.openBlock(),e.createElementBlock("button",{key:1,class:"ect-ml-auto","data-test-id":`configurator-item-button-edit-attributes-${t.item.itemId}`,onClick:f[8]||(f[8]=l=>r("edit-attributes"))},[e.createVNode(Ge,{label:"Edit attributes","edit-button":""})],8,nc)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock("span",rc,[e.createElementVNode("button",{"data-test-id":"configurator-info-button-add-attributes",onClick:f[9]||(f[9]=l=>r("edit-attributes"))},[e.createVNode(Ge,{label:"Add attributes","add-button":""})])]))])):e.createCommentVNode("",!0),e.createElementVNode("div",oc,[e.createElementVNode("div",{onClick:f[11]||(f[11]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(cn,{value:h.value,"onUpdate:value":f[10]||(f[10]=l=>h.value=l),min:t.minQuantity,max:t.maxQuantity,"data-test-id":`configurator-item-counter-${t.item.itemId}`,onChange:u},null,8,["value","min","max","data-test-id"])]),e.createElementVNode("div",ic,[ac,e.createVNode(Qn,{modelValue:d.value.price,"onUpdate:modelValue":f[12]||(f[12]=l=>d.value.price=l),tag:"p",type:"currency",class:"ect-w-[125px] ect-text-base ect-font-bold"},null,8,["modelValue"])])])])),t.selected&&t.isAttributes?(e.openBlock(),e.createElementBlock("div",lc,[e.renderSlot(c.$slots,"default")])):e.createCommentVNode("",!0)],10,Is))}},cc={"af-ZA":",","sq-AL":",","ar-DZ":",","ar-BH":"٫","ar-EG":"٫","ar-IQ":"٫","ar-JO":"٫","ar-KW":"٫","ar-LB":"٫","ar-LY":",","ar-MA":",","ar-OM":"٫","ar-QA":"٫","ar-SA":"٫","ar-SD":"٫","ar-SY":"٫","ar-TN":",","ar-AE":"٫","ar-YE":"٫","hy-AM":",","az-AZ":",","bn-BD":".","bn-IN":".","eu-ES":",","be-BY":",","bs-BA":",","bg-BG":",","my-MM":".","ca-ES":",","ca-ES-EURO":",","zh-CN":".","zh-CN-PINYIN":".","zh-CN-STROKE":".","zh-HK":".","zh-HK-STROKE":".","zh-MO":".","zh-SG":".","zh-TW":".","zh-TW-STROKE":".","hr-HR":",","cs-CZ":",","da-DK":",","nl-AW":",","nl-BE":",","nl-NL":",","nl-SR":",","dz-BT":".","en-AG":".","en-AU":".","en-BS":".","en-BB":".","en-BZ":".","en-BM":".","en-BW":".","en-CM":".","en-CA":".","en-DE":",","en-KY":".","en-ER":".","en-FK":".","en-FJ":".","en-GM":".","en-GH":".","en-GI":".","en-GY":".","en-HK":".","en-IN":".","en-ID":".","en-IE":".","en-IE-EURO":".","en-JM":".","en-KE":".","en-LR":".","en-MG":".","en-MW":".","en-MY":".","en-MU":".","en-NA":".","en-NZ":".","en-NG":".","en-PK":".","en-PG":".","en-PH":".","en-RW":".","en-WS":".","en-SC":".","en-SL":".","en-SG":".","en-SX":".","en-SB":".","en-ZA":",","en-SH":".","en-SZ":".","en-TZ":".","en-TO":".","en-TT":".","en-UG":".","en-GB":".","en-US":".","en-VU":".","et-EE":",","fi-FI":",","fi-FI-EURO":",","fr-BE":",","fr-CA":",","fr-KM":",","fr-FR":",","fr-FR-EURO":",","fr-GN":",","fr-HT":",","fr-LU":",","fr-MR":",","fr-MC":",","fr-CH":",","fr-WF":",","ka-GE":",","de-AT":",","de-AT-EURO":",","de-BE":",","de-DE":",","de-DE-EURO":",","de-LU":",","de-LU-EURO":",","de-CH":".","el-GR":",","gu-IN":".","iw-IL":".","hi-IN":".","hu-HU":",","is-IS":",","in-ID":",","ga-IE":".","it-IT":",","it-CH":".","ja-JP":".","kn-IN":".","kk-KZ":",","km-KH":",","ko-KP":".","ko-KR":".","ky-KG":",","lo-LA":",","lv-LV":",","lt-LT":",","lu-CD":",","lb-LU":",","mk-MK":",","ms-BN":",","ms-MY":".","ml-IN":".","mt-MT":".","mi-NZ":".","mr-IN":".","ne-NP":".","no-NO":",","ps-AF":"٫","fa-IR":"٫","pl-PL":",","pt-AO":",","pt-BR":",","pt-CV":",","pt-MZ":",","pt-PT":",","pt-ST":",","ro-MD":",","ro-RO":",","rm-CH":".","rn-BI":",","ru-KZ":",","ru-RU":",","sr-BA":",","sr-RS":",","sh-BA":",","sh-ME":",","sh-ME-USD":",","sh-CS":",","sk-SK":",","sl-SI":",","so-DJ":".","so-SO":".","es-AR":",","es-BO":",","es-CL":",","es-CO":",","es-CR":",","es-CU":".","es-DO":".","es-EC":",","es-SV":".","es-GT":".","es-HN":".","es-MX":".","es-NI":".","es-PA":".","es-PY":",","es-PE":".","es-PR":".","es-ES":",","es-ES-EURO":",","es-US":".","es-UY":",","es-VE":",","sw-KE":".","sv-SE":",","tl-PH":".","tg-TJ":",","ta-IN":".","ta-LK":".","te-IN":".","th-TH":".","ti-ET":".","tr-TR":",","uk-UA":",","ur-PK":".","uz-LATN-UZ":",","vi-VN":",","cy-GB":".","xh-ZA":".","yo-BJ":".","zu-ZA":"."},dc={name:"CustomInput",components:{AppIcon:we},props:{editMode:{type:Boolean,default:!0},type:{type:String,default:"text"},max:{type:Number,default:500},label:{type:String,default:""},name:{type:String,default:""},showLabel:{type:Boolean,default:!0},modelValue:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},isReadOnly:{type:Boolean,default:!1},required:{type:Boolean,default:!1},highlight:{type:Boolean,default:!1},placeholder:{type:String,default:""},error:{type:[Boolean,String],default:!1},cssClass:{type:Object,default:()=>({})},tooltip:{type:String,default:null},locale:{type:String,default:"en-US"},icon:{type:String,default:null},itooltip:{type:String,default:null},icolor:{type:String,default:"#7d7d7d"},ihover:{type:String,default:"#57c046"},icustom:{type:Boolean,default:!1},idisabled:{type:Boolean,default:!1},height:{type:Number,default:32},textAlignment:{type:String,default:"left"},decimalPrecision:{type:Number,default:0},allowNegatives:{type:Boolean,default:!1},size:{type:String,default:"medium"},dataTestId:{type:String,required:!0}},emits:["update:modelValue","iclick","blur"],data(){return{initialValue:"",decimalSeprator:".",ctrl:!1}},computed:{getValue(){return this.modelValue?this.type==="currency"?String(this.modelValue).replace(".",this.decimalSeprator):String(this.modelValue):""},error_message(){return typeof this.error=="string"?this.error:this.error===""?!1:this.error===!0?`${this.label||"Field"} is required`:this.error},isHighlight(){return(this.initialValue===""||this.initialValue===null)&&(this.modelValue===""||this.modelValue===null)?!1:this.initialValue!==this.modelValue}},created(){this.initialValue=this.modelValue,this.decimalSeprator=this.type==="currency"?cc[this.locale]:"."},methods:{handlerInput(t){const o=t.target.value;this.type==="currency"?this.$emit("update:modelValue",o.replace(this.decimalSeprator,".")):this.$emit("update:modelValue",o)},preventNonNumeric(t){if(this.type==="number"){const o=this.decimalPrecision,n=t.target.value,r=t.key;if(["Backspace","ArrowLeft","ArrowRight","Delete","Tab"].includes(r)||this.allowNegatives&&r==="-")return;if(r==="."&&o===0){t.preventDefault();return}if(r==="."&&n.includes(".")){t.preventDefault();return}if(r==="."||n.includes(".")&&!n.endsWith(".")&&r!=="Backspace"){const i=n.split(".");if(i.length>1&&i[1].length>=o){t.preventDefault();return}}if(isNaN(r)&&![".","Backspace","Tab"].includes(r)){t.preventDefault();return}}if(t.key==="Backspace"||this.ctrl)return!0;if(t.key==="Control"&&(this.ctrl=!0),this.type==="currency"||this.type==="number"){if(!this.getValue.includes(this.decimalSeprator)&&t.key===this.decimalSeprator)return!0;/[\deE+\-]/.test(t.key)||t.preventDefault()}return!0},handlerKeyup(t){t.key==="Control"&&(this.ctrl=!1)}}},uc=["data-test-id"],fc=["for","data-test-id"],hc=["data-test-id"],pc=["id","type","name","disabled","placeholder","value","maxlength","readonly","data-test-id"],mc=["data-test-id"],gc=["data-test-id"];function yc(t,o,n,r,i,a){const d=e.resolveComponent("AppIcon");return e.openBlock(),e.createElementBlock("div",{class:"input","data-test-id":n.dataTestId},[n.label&&n.showLabel?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass({error_color:!!n.error}),for:n.label,"data-test-id":`${n.dataTestId}-label`},[e.createTextVNode(e.toDisplayString(n.label)+" ",1),n.required?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass({error_color:!!n.error})},"*",2)):e.createCommentVNode("",!0)],10,fc)):e.createCommentVNode("",!0),n.editMode?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["input-wrapper ect-w-full",{errorBorder_color:!!n.error,highlight:a.isHighlight&&n.highlight}]),"data-test-id":`${n.dataTestId}-wrapper`},[n.icon?(e.openBlock(),e.createBlock(d,{key:0,class:"input-wrapper_icon",icon:n.icon,hover:n.ihover,color:n.icolor,size:19,disabled:n.idisabled,custom:n.icustom,tooltip:n.itooltip,"data-test-id":`${n.dataTestId}-icon`,direction:"top-right",onClick:o[0]||(o[0]=b=>t.$emit("iclick"))},null,8,["icon","hover","color","disabled","custom","tooltip","data-test-id"])):e.createCommentVNode("",!0),e.createElementVNode("input",{id:n.label,class:e.normalizeClass(`ectheme-input-box ${n.size}`),type:n.type,style:e.normalizeStyle({width:n.icon?"calc(100% - 36px)":"100%",height:`${n.height}px`,textAlign:n.textAlignment}),name:n.name,disabled:n.disabled,placeholder:n.placeholder,value:a.getValue,maxlength:n.max,readonly:n.isReadOnly,"data-test-id":`${n.dataTestId}-input`,onInput:o[1]||(o[1]=(...b)=>a.handlerInput&&a.handlerInput(...b)),onKeydown:o[2]||(o[2]=(...b)=>a.preventNonNumeric&&a.preventNonNumeric(...b)),onKeyup:o[3]||(o[3]=(...b)=>a.handlerKeyup&&a.handlerKeyup(...b)),onBlur:o[4]||(o[4]=b=>t.$emit("blur"))},null,46,pc)],10,hc)):e.createCommentVNode("",!0),n.editMode?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("p",{key:2,class:"value","data-test-id":`${n.dataTestId}-value`},e.toDisplayString(a.getValue),9,mc)),a.error_message?(e.openBlock(),e.createElementBlock("div",{key:3,class:"error_tooltip error_tooltip-bottom-right","data-test-id":`${n.dataTestId}-error`},e.toDisplayString(a.error_message),9,gc)):e.createCommentVNode("",!0)],8,uc)}const bc=ke(dc,[["render",yc],["__scopeId","data-v-032ca141"]]),_c={name:"AtomSpinner",props:{dataTestId:{type:String,default:""}}},vc=["data-test-id"];function Cc(t,o,n,r,i,a){return e.openBlock(),e.createElementBlock("div",{class:"spinner","data-test-id":n.dataTestId},null,8,vc)}const Ec={name:"CustomDropdown",components:{AppIcon:we,AtomSpinner:ke(_c,[["render",Cc],["__scopeId","data-v-771ed032"]])},props:{label:{type:String,default:""},placeholder:{type:String,default:""},options:{type:Array,default:()=>[]},display:{type:Array,default:()=>[]},modelValue:{type:String,default:""},error:{type:[Boolean,String],default:!1},required:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},select:{type:Boolean,default:!1},lookup:{type:Boolean,default:!1},search:{type:Boolean,default:!1},badge:{type:String,default:void 0},highlight:{type:Boolean,default:!1},property:{type:Object,default:()=>({key:"value",value:"label",assigned:"assigned"})},dropdownTheme:{type:String,default:"light"},icon:{type:String,default:""},size:{type:String,default:"medium"},dataTestId:{type:String,required:!0}},emits:["search","focus-in","focus-out","update:modelValue"],data:()=>({inputFocused:!1,value:"",isHover:!1,highlightedIndex:-1,initialValue:"",teleportStyle:{position:"absolute",top:"0px",left:"0px",width:"0px"}}),computed:{isHighlight(){return(this.initialValue===""||this.initialValue==null)&&(this.modelValue===""||this.modelValue==null)?!1:this.initialValue!==this.modelValue},error_message(){return this.error===""?!1:this.error===!0?`${this.label||"Field"} is required`:this.error},getOptions(){if(this.select&&this.search){const t=this.value.toLowerCase();return this.options.filter(o=>JSON.stringify(o).toLowerCase().includes(t))}else return this.options},getSelected(){let t=null;if(this.modelValue)t=this.options.find(o=>o[this.property.key]===this.modelValue);else if(!this.search){const o=this.options.find(n=>n[this.property.key]==="");o?t=o:this.placeholder?t={[this.property.value]:this.placeholder,[this.property.key]:""}:t={[this.property.value]:"--Select--",[this.property.key]:""}}return t||{[this.property.value]:this.placeholder||"--Select--",[this.property.key]:""}},shouldShowAbove(){if(!this.$refs.triggerElement)return!1;const t=this.$refs.triggerElement.getBoundingClientRect(),o=250,n=window.innerHeight-t.bottom,r=t.top;return n<o&&r>o},dropdownStyle(){if(!this.$refs.triggerElement)return{};const t=this.$refs.triggerElement.getBoundingClientRect(),o=250,n=window.innerHeight-t.bottom,r=t.top,i=n<o&&r>o;return{position:"absolute",top:i?"auto":"100%",bottom:i?"100%":"auto",left:"0",width:"100%",zIndex:1e3}}},created(){this.initialValue=this.modelValue},mounted(){window.addEventListener("resize",this.updateDropdownPosition),window.addEventListener("scroll",this.updateDropdownPosition,!0)},beforeUnmount(){window.removeEventListener("resize",this.updateDropdownPosition),window.removeEventListener("scroll",this.updateDropdownPosition,!0)},methods:{updateDropdownPosition(){if(!this.$refs.triggerElement)return;const t=this.$refs.triggerElement.getBoundingClientRect(),o=200,n=window.innerHeight-t.bottom,r=t.top,i=n<o&&r>o;this.teleportStyle={position:"absolute",top:`${i?t.top-o:t.bottom}px`,left:`${t.left}px`,width:`${t.width}px`,zIndex:9999}},subFieldsText(t){if(!this.display||this.display.length<1)return"";const o=[];return this.display.forEach(n=>{const r=this.subField(t,n);r&&o.push(r)}),o.join(" | ")},subField(t,o){return o?o.split(".").reduce((i,a)=>i[a]||"",t):t},lookupSearchHandler:oo(function(t){this.value=t,this.search&&!this.select&&this.$emit("search",t)}),handlerFocusIn(){!(this.modelValue&&this.search)&&!this.disabled&&(this.inputFocused=!0,this.updateDropdownPosition(),this.$emit("focus-in"))},updateSelected(t){t&&(this.value="",this.$emit("update:modelValue",t[this.property.key]),this.search&&!this.select&&!this.lookup&&this.$emit("search",""),this.onInputFocusedOut(!0))},clear(){this.disabled||(this.value="",this.$emit("update:modelValue",null),this.search&&!this.select&&!this.lookup&&this.$emit("search",""))},onInputFocusedOut(t=!1){(!this.isHover||t)&&!this.disabled&&(t?(this.highlightedIndex=-1,this.inputFocused=!1,this.$emit("focus-out")):setTimeout(()=>{this.highlightedIndex=-1,this.inputFocused=!1,this.$emit("focus-out")},100))},highlightNextOption(){this.highlightedIndex<this.options.length-1&&this.highlightedIndex++},highlightPreviousOption(){this.highlightedIndex>0&&this.highlightedIndex--}}},kc=["data-test-id"],wc=["for","data-test-id"],Nc={class:"input-container-box ect-grow ect-w-full"},xc=["data-test-id"],Oc=["placeholder","disabled","data-test-id"],Sc=["data-test-id"],Vc=["title","data-test-id"],Ic=["data-test-id"],Tc=["data-test-id"],Ac=["data-test-id"],Bc=["data-test-id"],Lc=["data-test-id","onClick"],Mc=["data-test-id"],Pc={class:"ect-text-font-clr-light ect-flex ect-gap-2 ect-items-center ect-justify-between ect-w-full"},Rc=["data-test-id"],qc=["data-test-id"],Dc=["data-test-id"],jc=["title","data-test-id"],$c=["data-test-id"];function Fc(t,o,n,r,i,a){const d=e.resolveComponent("AppIcon"),b=e.resolveComponent("AtomSpinner");return e.openBlock(),e.createElementBlock("div",{ref:"dropdownWrapper",class:e.normalizeClass(["customdropdown input-container",{dark:n.dropdownTheme==="dark"}]),"data-test-id":n.dataTestId,onMouseenter:o[7]||(o[7]=h=>t.isHover=!0),onMouseleave:o[8]||(o[8]=h=>t.isHover=!1)},[n.label?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass(["title_label",{error_color:!!n.error}]),for:n.label,"data-test-id":`${n.dataTestId}-label`},[e.createTextVNode(e.toDisplayString(n.label)+" ",1),n.required?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass({error_color:!!n.error})},"*",2)):e.createCommentVNode("",!0)],10,wc)):e.createCommentVNode("",!0),e.createElementVNode("div",Nc,[e.createElementVNode("div",{ref:"triggerElement",class:e.normalizeClass(["input-wrapper ectheme-input-box ect-w-full",{disabled:n.disabled,"input-error":n.error,highlight:a.isHighlight&&n.highlight,"size-large":n.size==="large","size-medium":n.size==="medium"||n.size==="small"}]),"data-test-id":`${n.dataTestId}-trigger`,tabindex:"0",onFocusin:o[2]||(o[2]=(...h)=>a.handlerFocusIn&&a.handlerFocusIn(...h)),onFocusout:o[3]||(o[3]=h=>a.onInputFocusedOut(!1)),onKeydown:[o[4]||(o[4]=e.withKeys(h=>a.updateSelected(n.options[t.highlightedIndex]),["enter"])),o[5]||(o[5]=e.withKeys(e.withModifiers((...h)=>a.highlightPreviousOption&&a.highlightPreviousOption(...h),["prevent"]),["up"])),o[6]||(o[6]=e.withKeys(e.withModifiers((...h)=>a.highlightNextOption&&a.highlightNextOption(...h),["prevent"]),["down"]))]},[!n.modelValue&&n.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref:"searchInput","onUpdate:modelValue":o[0]||(o[0]=h=>t.value=h),type:"text",name:"search",placeholder:n.placeholder,autocomplete:"off",disabled:n.disabled,"data-test-id":`${n.dataTestId}-search-input`,onInput:o[1]||(o[1]=e.withModifiers(h=>a.lookupSearchHandler(h.target.value),["prevent"]))},null,40,Oc)),[[e.vModelText,t.value]]):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["selection-name ect-text-text-primary-dark ect-flex ect-justify-between ect-items-center",{"size-large":n.size==="large","size-medium":n.size==="medium"||n.size==="small"}]),"data-test-id":`${n.dataTestId}-selection`},[a.getSelected?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("span",{title:a.getSelected[n.property.value],class:e.normalizeClass(["ect-flex ect-items-center ect-gap-2 ect-font-medium",{"ect-text-font-clr-light":!n.modelValue}]),"data-test-id":`${n.dataTestId}-selection-value`},[n.icon?(e.openBlock(),e.createBlock(d,{key:0,class:"ect-mr-0",icon:n.icon,size:14,color:"#5F5F5F","data-test-id":`${n.dataTestId}-selection-icon`},null,8,["icon","data-test-id"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(a.getSelected[n.property.value]),1)],10,Vc),n.badge&&a.getSelected[n.badge]?(e.openBlock(),e.createElementBlock("span",{key:0,class:"badge ect-bg-btn ect-rounded-[5px] ect-py-[2px] ect-px-[10px] ect-text-white","data-test-id":`${n.dataTestId}-selection-badge`},e.toDisplayString(a.getSelected[n.badge]),9,Ic)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],10,Sc)),n.search?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[n.loading?(e.openBlock(),e.createBlock(b,{key:0,class:"spinner","data-test-id":`${n.dataTestId}-loading-spinner`},null,8,["data-test-id"])):(e.openBlock(),e.createElementBlock("div",{key:1,class:"clear-button","data-test-id":`${n.dataTestId}-action-button`},[t.value||n.modelValue?(e.openBlock(),e.createBlock(d,{key:0,disabled:n.disabled,icon:"close",color:"#acacac",size:10,"data-test-id":`${n.dataTestId}-clear-button`,onClick:a.clear},null,8,["disabled","data-test-id","onClick"])):(e.openBlock(),e.createBlock(d,{key:1,icon:"search",size:14,color:"#acacac",disabled:n.disabled,"data-test-id":`${n.dataTestId}-search-button`},null,8,["disabled","data-test-id"]))],8,Tc))],64)):(e.openBlock(),e.createBlock(d,{key:3,class:"clear-button",color:a.error_message?"#ff6a6a":"#acacac",icon:"arrow_drop_up",size:12,disabled:n.disabled,"data-test-id":`${n.dataTestId}-dropdown-arrow`},null,8,["color","disabled","data-test-id"]))],42,xc),a.error_message?(e.openBlock(),e.createElementBlock("div",{key:0,class:"error_tooltip error_tooltip-bottom-right","data-test-id":`${n.dataTestId}-error`},e.toDisplayString(a.error_message),9,Ac)):e.createCommentVNode("",!0),a.getOptions&&t.inputFocused&&!n.disabled&&(n.select||n.lookup)?(e.openBlock(),e.createElementBlock("div",{key:1,ref:"dropdown",class:e.normalizeClass(["dropdown",{"dropdown-above":a.shouldShowAbove}]),style:e.normalizeStyle(a.dropdownStyle),"data-test-id":`${n.dataTestId}-dropdown`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.getOptions,(h,v)=>(e.openBlock(),e.createElementBlock("div",{key:h[n.property.key],class:e.normalizeClass(["dropdown-item",{highlighted:v===t.highlightedIndex,"ect-pointer-events-none":h[n.property.assigned]}]),"data-test-id":`${n.dataTestId}-option-${v}`,onClick:u=>a.updateSelected(h)},[e.createElementVNode("div",{class:"name ect-items-center","data-test-id":`${n.dataTestId}-option-${v}-name`},[e.createElementVNode("span",Pc,[e.createElementVNode("span",{class:e.normalizeClass({"ect-text-zinc-400":h[n.property.assigned]}),"data-test-id":`${n.dataTestId}-option-${v}-value`},e.toDisplayString(h[n.property.value]==null?"Key and Value is Wrong":h[n.property.value]),11,Rc),h[n.property.assigned]?(e.openBlock(),e.createElementBlock("span",{key:0,class:"ect-text-xs ect-leading-4 ect-text-zinc-600","data-test-id":`${n.dataTestId}-option-${v}-assigned`},"Assigned",8,qc)):e.createCommentVNode("",!0)]),n.badge?(e.openBlock(),e.createElementBlock("span",{key:0,class:"badge ect-bg-btn ect-rounded-[5px] ect-py-[2px] ect-px-[10px] ect-text-white","data-test-id":`${n.dataTestId}-option-${v}-badge`},e.toDisplayString(h[n.badge]),9,Dc)):e.createCommentVNode("",!0)],8,Mc),e.createElementVNode("div",{class:"info",title:a.subFieldsText(h),"data-test-id":`${n.dataTestId}-option-${v}-info`},[e.createElementVNode("span",null,e.toDisplayString(a.subFieldsText(h)),1)],8,jc)],10,Lc))),128)),!a.getOptions.length&&!n.loading&&(t.value||n.select)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"no-items-found","data-test-id":`${n.dataTestId}-no-options`}," no options found ",8,$c)):e.createCommentVNode("",!0)],14,Bc)):e.createCommentVNode("",!0)])],42,kc)}const mo=ke(Ec,[["render",Fc],["__scopeId","data-v-5ae4f6dc"]]);var Oe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function go(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var yo={exports:{}};/*!
|
|
6
6
|
* Quill Editor v1.3.7
|
|
7
7
|
* https://quilljs.com/
|
|
8
8
|
* Copyright (c) 2014, Jason Chen
|