expedite-components 0.3.2 → 0.3.3
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 $a=Symbol(process.env.NODE_ENV!=="production"?"router":""),Fa=Symbol(process.env.NODE_ENV!=="production"?"route location":"");Symbol(process.env.NODE_ENV!=="production"?"router view location":"");function ln(){return e.inject($a)}function ho(){return e.inject(Fa)}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 Kn={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"},po={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"},Ha=t=>{var n;let i=[];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 c=((n=Kn[a==null?void 0:a.toLowerCase()])==null?void 0:n.trim())||"";c&&(i.includes(c)||i.push(c||""),i.push(r))}else i.includes(Kn[r==null?void 0:r.toLowerCase()])||i.push(Kn[r==null?void 0:r.toLowerCase()]||"");return i.filter(r=>r!=="")},Ua=Ke.defineStore("actions",()=>{const t=sn(),i=ut(),n=e.ref(!1);return{openAdaptiveSearch:(b,p=!1)=>{console.info("openAdaptiveSearch",b),t.chatHistory[t.chatHistory.length-1].links=[],t.sendMessage("Open Adaptive Search",!1,{internalCall:!0}),n.value=p},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=${i.quoteId}&atpverified=true&ecCache=false&origin=AI`;window.location.href=`${na(window.location.href)}${v}`},undo:()=>{const b=t==null?void 0:t.latestDMLRequest;t.sendMessage(`UNDO-${b}`,!1,{internalCall:!0})},isStaticActionCall:n}}),mo=Ke.defineStore("adaptiveSearch",()=>{const t=ut(),i=Rt(),n=sn(),r=Ua(),o=e.ref(null),a=e.ref(null),c=e.ref(!1),b=e.ref(!1),p=e.ref([]),v=e.ref(""),u=e.ref(!1),m=e.ref(null),l=e.ref(!1),f=e.ref([]),h=at(),d=e.ref([]),s=e.ref(0),g=e.ref(!1),_=e.ref({rowLimt:10,paging:!0,offset:0,currentPage:1,totalPages:1});async function C(){c.value=!0;try{const x=JSON.stringify({layoutType:"Search Selection",layoutObject:"xx_ord1__ecatalog_item__c"});let B={};return B=await window.salesforceConnector.getDynamicPageLayout(x),a.value=ao(B,"Unable to find the Search Selection Layout for your user profile"),_.value.rowLimt=a.value.configuration.rowLimit||10,a.value.configuration.columns.forEach(R=>{!R.field&&R.label==="QTY"&&(R.field="xx_ord1__qty__c")}),c.value=!1,y(),B}catch(x){c.value=!1,h.handleError("Failed to get Adaptive Search Layout. Please try again."),console.info("[ERROR]: getAdaptiveSearchLayout() error = ",x)}}function y(){var x,B,R;m.value=(R=(B=(x=a.value)==null?void 0:x.configuration)==null?void 0:B.dynamicFilters)==null?void 0:R.filters.map(U=>({...U,field:U.field.toLowerCase(),filtervalue:U.filtervalue||[],filtervaluefrom:U.filtervaluefrom||"",filtervalueTo:U.filtervalueTo||""}))}function E(){var B;let x=[];for(const R of a.value.configuration.columns){let U=R.field;if(x.includes(U)||x.push(U),U!=null&&U.includes(".")){let A=U.split(".")[0];A=A.slice(0,-1)+"c",x.includes(A)||x.push(A)}}return(B=a.value.configuration)!=null&&B.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(R=>!!R),x.filter(R=>R.toLowerCase()!=="xx_ord1__qty__c"&&R.toLowerCase()!=="xx_ord1__competitor_sku__c")}function T(x,B=!1){if(!x||x.includes("undefined"))return!1;const R=/[!@#$%^&*()+=[\]{};':"\\|.<>/?]+/;if(B){const U=Array.isArray(x)?x:x.split(",");for(const z of U){const A=z.trim();if(R.test(A))return h.handleError(`Invalid character found in value: ${A}`),!1}}else if(R.test(x))return h.handleError("Special characters are not allowed in filter values"),!1;return!0}function O(x,B){return{field:x.field,operator:x.operator||"contains",value:B,dataType:x.dataType.trim()}}function V(x){if(!x.filtervalue)return null;const B=Array.isArray(x.filtervalue),R=B?x.filtervalue.join(","):x.filtervalue.trim();return T(R,B)?R:null}function I(x){var z,A;const B=(z=x.filtervaluefrom)==null?void 0:z.trim(),R=(A=x.filtervalueTo)==null?void 0:A.trim();if(!B||!R)return null;const U=`${B}, ${R}`;return U!==", "&&T(U)?U:null}function S(x){const B=`${io(x.filtervaluefrom)}, ${io(x.filtervalueTo)}`;return B!==", "&&T(B)?B:null}function w(x){var R;const B=(R=x.filtervaluefrom)==null?void 0:R.trim();return T(B)?B:null}function N(x){const B=[];return x.forEach(R=>{const U=R.dataType.trim();let z=null;switch(U){case"PICKLIST":case"MULTIPICKLIST":z=V(R);break;case"DOUBLE":case"CURRENCY":z=I(R);break;case"DATETIME":case"DATE":z=S(R);break;default:z=w(R)}z&&B.push(O(R,z))}),f.value=B,B}async function L(x="",B=[],R=[]){var z,A,P,F,M,j,K,G,oe,ie;let U=[];if(B.length&&(U=N(B)),!U.length&&x.trim()===""){p.value=[],u.value=!1;return}try{u.value=!1,b.value=!0;const se=x.trim();R.length||(R=E());const ye={fields:R,...B.length?{dynamicFilters:U}:{},searchText:se||v.value.trim(),accountId:i.accountId,...i.eCatalogId?{catalogId:i.eCatalogId}:{},...i.objectType==="opportunity"?{opportunityId:i.id}:{},...(A=(z=a.value)==null?void 0:z.configuration)!=null&&A.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:(F=(P=a.value)==null?void 0:P.configuration)==null?void 0:F.rowLimit,paging:(j=(M=a.value)==null?void 0:M.configuration)==null?void 0:j.paging,...((K=_.value)==null?void 0:K.offset)!==0?{offset:_.value.offset}:{},objectName:(oe=(G=a.value)==null?void 0:G.configuration)==null?void 0:oe.objectName,currencyCode:i.currencyCode},de=await window.salesforceConnector.getItems(JSON.stringify(ye));if(de!=null&&de.errorMessage){h.handleError(de.errorMessage);return}de!=null&&de.itemCount&&(_.value.totalPages=Math.ceil((de==null?void 0:de.itemCount)/_.value.rowLimt)),p.value=on(de.lstItems,{xx_ord1__qty__c:"1"}),(ie=de.lstItems)!=null&&ie.length||(u.value=!0),b.value=!1}catch(se){h.handleError("Failed to fetch Results. Please try again."),b.value=!1,console.info("[ERROR]: Adaptive Search getItems() error = ",se)}}async function $(x){try{l.value=!0;const B=JSON.stringify({lstQLIRequest:H(x),quoteId:t.quoteId});let R=await window.salesforceConnector.createQLI(B);typeof R=="string"&&(R=JSON.parse(R));let U=!1;if((R==null?void 0:R.length)>0&&R.forEach(z=>{z.errorMessage&&(U=!0,h.handleError(z.errorMessage))}),l.value=!1,U){d.value=R;const z=d.value.reduce((A,P)=>(A[P.eCatalogItemId]=P.errorMessage,A),{});p.value=p.value.map(A=>({...A,backendError:z[A.Id]||""}));return}return R}catch(B){h.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addToQuote() error = ",B)}}function H(x){const B=[];for(const R of x)if(!R.addedToQuote&&R.id){const U=Q(R);s.value++,B.push({fields:U,recordId:R.id,...x.length===1?{maxSequenceNumber:s.value}:{}})}return B}function Q(x){const B=[],R=X();return Object.keys(x).forEach(U=>{if(R.includes(U)){const z=po[U.toLowerCase()];z&&B.push({fieldname:z,value:x[U]})}}),B}function X(){const x=[];return a.value.configuration.columns.forEach(B=>{B.field&&!B.field.includes(".")&&B.isEditable&&B.visible&&x.push(B.field)}),x}function te(){var B,R;const x=[];return a.value.configuration.columns.forEach(U=>{const z=U.field.toLowerCase();x.includes(z)||x.push(z)}),(B=a.value.configuration)!=null&&B.dynamicFilters&&a.value.configuration.dynamicFilters.filters.forEach(U=>{const z=U.field.toLowerCase();x.includes(z)||x.push(z)}),(R=a.value.configuration)!=null&&R.cardHeader&&x.push(a.value.configuration.cardHeader.imageField),x}async function J(){var R;const x=te(),B=((R=a.value.configuration)==null?void 0:R.saveObjectName)||a.value.configuration.objectName;if(B==="xx_ord1__ecatalog_item__c"){const U=x.indexOf("xx_ord1__qty__c");U>-1&&x.splice(U,1)}await t.getFieldsData(x,B),t.fieldsData.xx_ord1__qty__c||t.getFieldsData(["xx_ord1__qty__c"],"xx_ord1__quote_line_item__c")}async function q({searchTerm:x="",filters:B=[]}={}){if(g.value=!0,x&&(v.value=x),B.length&&(f.value=B),await C()){await J(),g.value=!1;const U=v.value;U&&(v.value=U,await L(U,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"}]})}g.value=!1}return{selectedItem:o,AdaptiveSearchLayout:a,searchText:v,loadingAdaptiveLayout:c,getAdaptiveSearchLayout:C,getItems:L,lstItems:p,rowItemsLoading:b,noSearchRecords:u,dynamicFilters:m,setDynamicFilters:y,createQliErrors:d,addToQuote:$,addingToQuote:l,getFieldsData:J,pagingData:_,appliedDynamicFilters:f,maxSequenceNumber:s,loadingAdaptiveSearch:g,initAdaptiveSearch:q}}),za=Ke.defineStore("quickSelection",()=>{const t=at(),i=Rt(),n=ut(),r=e.ref(null),o=e.ref(!1),a=e.ref([]),c=e.ref([]),b=e.ref(!1),p=e.ref({}),v=e.ref({rowLimit:10,paging:!0,offset:0,currentPage:1,totalPages:1}),u=e.ref(!1);async function m(){o.value=!0;try{const E=JSON.stringify({layoutType:"Quick Selection",layoutObject:"xx_ord1__ecatalog_item__c",...i.objectType?{contextObject:i.objectType}:{}});let T={};T=await window.salesforceConnector.getDynamicPageLayout(E),r.value=ao(T,"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")}),o.value=!1}catch(E){o.value=!1,t.handleError("Failed to get Page structure data. Please try again."),console.info("[ERROR]: getAdaptiveSearchLayout() error = ",E)}}function l(){const E=new Map;return r.value.data.columns.forEach(T=>{E.set(T.field,!0)}),r.value.data.searchResultColumns.forEach(T=>{E.set(T.field,!0)}),Array.from(E.keys())}async function f(E){var T,O;try{let V=await window.salesforceConnector.saveCompetitorSKU(E);if(V!=null&&V.errorMessage){t.handleError(V.errorMessage);return}if((T=V[0])!=null&&T.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 h(E="",T=[]){try{let O=r.value.data,V=r.value.configuration;const I=E.trim();if(console.info("searchTextValue.trim() = ",E.trim()),!I)return[];let S=null;console.info("useMappings = ",u.value),u.value?S=Ha(d()):S=d(),console.info("fields before filter = ",S),S=S.filter($=>$!=="xx_ord1__qty__c"),console.info("fields after filter = ",S);const w={fields:S,...T.length?{dynamicFilters:n.getDynamicFilters(T)}:{},searchText:I,accountId:i.accountId,...i.eCatalogId?{catalogId:i.eCatalogId}:{},...i.objectType==="opportunity"?{opportunityId:i.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:i.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)),on(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 d(){let E=[];for(const T of r.value.data.columns){let O=T.field;if(O!=null&&O.includes(".")){E.includes(O)||E.push(O);let I=O.split(".")[0];I=I.slice(0,-1)+"c",E.includes(I)||E.push(I)}else E.includes(O)||E.push(O)}return console.info("getAllQuickSelectionFields() fields = ",E),E.filter(T=>T.toLowerCase()!=="xx_ord1__qty__c")}async function s(E,T,O,V){console.info("searchText:",JSON.stringify(E)),console.info("row:",JSON.stringify(T)),console.info("rowIndex:",JSON.stringify(O)),console.info("column:",JSON.stringify(V));const I=O+(v.value.currentPage-1)*v.value.rowLimit;if(V.field.toLowerCase().includes("xx_ord1__item__r")){if(a.value[I].itemLookupLoading=!0,u.value=!0,c.value=await h(E),c.value.length>0){const S=[];for(let w=0;w<c.value.length;w++)a.value[I].itemDataRetrieved=!0,c.value[w].xx_ord1__item__c&&S.push({name:c.value[w]["xx_ord1__item__r.name"],value:c.value[w].xx_ord1__item__c,label:c.value[w][V.field.toLowerCase()]});a.value[I][V.field.toLowerCase()+"_options"]=S}a.value[I].itemLookupLoading=!1}else if(V.field.toLowerCase().includes("xx_ord1__competitor_item__r")){a.value[I].competitorLookupLoading=!0;const S=await g(E);S!=null&&S.items&&(a.value[I][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[I].competitorLookupLoading=!1,console.info("getLookupData:: Search Lookup Handler Response = ",S)}}async function g(E){var O,V;console.info("getLookupData() searchText = ",E);const T={searchText:E,obj:"xx_ord1__competitor_item__c",filters:null,displayFields:["xx_ord1__sku__c"]};try{let I=await window.salesforceConnector.getLookupData(JSON.stringify(T));if(typeof I=="string"&&(I=JSON.parse(I)),I!=null&&I.errorMessage){t.handleError(I.errorMessage);return}if((O=I[0])!=null&&O.errorMessage){t.handleError((V=I[0])==null?void 0:V.errorMessage);return}return I}catch(I){t.handleError("Failed to Search For Item. Please try again."),console.info("[ERROR]: getLookupData() error = ",I)}}async function _(E,T){var V;console.info("Update Other Fields Value = ",E),console.info("Update Other Fields Row Index = ",T);const O=T+(v.value.currentPage-1)*v.value.rowLimit;console.info("actualRowIndex = ",O);try{if(E){const I=c.value.filter(S=>S.xx_ord1__item__c===E)[0];if(I){b.value=!0;const S=r.value.data.columns[1].field;a.value[O][S]&&await C(I,O),(V=a.value[O])!=null&&V.itemDataRetrieved&&(a.value[O].status="New Match Requested",a.value[O].noMatchCleared=!0),Object.keys(I).forEach(w=>{const N=po[w.toLowerCase()];console.info("Mapped Key = ",N),N&&(a.value[O][N]=I[w])}),b.value=!1}else a.value[O].status=""}else a.value[O].status="No Match"}catch(I){t.handleError("Unable to request a match for this item please try again."),console.info("Error in updateOtherFields = ",I)}}async function C(E,T){const O=a.value[T],V=r.value.data.columns[1].field,I=[{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 f(JSON.stringify(I));console.info("Match Item: ",JSON.stringify(S)),a.value[T][`${V}_options`]=[{value:S[0].competitorItemId,label:S[0].sku}],a.value[T][V]=S[0].competitorItemId}async function y(E){try{let T=await window.salesforceConnector.createQLI(JSON.stringify(E));typeof T=="string"&&(T=JSON.parse(T));let O=!1;if((T==null?void 0:T.length)>0)for(let V=0;V<T.length;V++)T[V].errorMessage&&(O=!0,T[V].errorMessage.includes("Line Description: data value too large")&&(T[V].errorMessage="Error: The description is too long—it must be under 200 characters."));if(O){T.forEach(V=>{p.value[V.eCatalogItemId]=V});return}else p.value=[];return T}catch(T){t.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addAllItemsToQuote() error = ",T)}}return{quickSelectionLayout:r,quickSelectionLayoutLoading:o,processedRecords:a,useMappings:u,currentSearchData:c,createQliErrors:p,getQuickSelectionLayout:m,getAllFieldsForQuickSelectionLayout:l,saveCompetitorSKU:f,getQuickSelectionItems:h,searchLookupHandler:s,updateOtherFields:_,addAllItemsToQuote:y}}),Ka="Preparing Your Quote Please Wait...",Za={message:"Your quote is ready! Begin adding products to complete it.",type:"response",requestId:"no-request-id"},Qa=18e4,sn=Ke.defineStore("ai",()=>{const t=Rt(),i=ut(),n=mo(),r=za(),o=Ye(),a=ho(),c=e.ref(""),b=e.ref(""),p=e.ref([]),v=e.ref(""),u=e.ref([]),m=e.ref(!1),l=e.ref(null),f=ln(),h=e.ref({}),d=e.ref(null),s=e.ref(null),g=e.ref(null),_=e.ref(null),C=e.ref(null),y=e.ref(Ka),E=e.ref([]),T=e.computed(()=>t.orgId+"__"+t.user.Id+"__"+i.quoteId),O=e.computed(()=>l.value.readyState==WebSocket.OPEN),V=()=>{h.value={salesforceOrgId:t.orgId,salesforceOrgType:t.orgType,salesforceUserId:t.user.Id,userType:"Salesforce",chatRoomId:T.value,requestId:"",prompt:"",initiatedFrom:t.origin||"Quote",internalCall:!1,contextObjectId:i.quoteId,contextObjectType:"Quote",payload:{lineItemsCount:i.lineItemsCount},origin:"Genesis AI",defaultBatchSize:10,actionType:"",packageVersion:t.packageVersion,relatedIds:{eCatalogId:t.eCatalogId,accountId:t.accountId}}};async function I(){const M=b.value+"?chatRoomId="+T.value;l.value=new WebSocket(M),l.value.addEventListener("open",S),l.value.addEventListener("message",L),l.value.addEventListener("close",w),l.value.addEventListener("error",N)}const S=()=>{$(),X()},w=()=>{H()},N=()=>{U(),H()},L=M=>{var K,G;$();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,p.value.push(Za),j.messages.length>0&&x(j.messages)):j.agentResponse&&(j.errorMessage&&(j.agentResponse.content=j.errorMessage,j.agentResponse.error=!0),y.value=null,p.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,...(K=j.agentResponse)!=null&&K.filesData?{filesData:(G=j.agentResponse)==null?void 0:G.filesData}:{}}));E.value=j.links||[],A(j)}},$=()=>{H(),d.value=setTimeout(()=>{if(O.value){const M={action:"heartbeat"};l.value.send(JSON.stringify(M)),$()}},Qa)},H=()=>{d.value&&(clearInterval(d.value),d.value=null)};function Q(M){const j={...h.value};j.requestType="Action",j.actionType="Undo",j.undoRequestId=M,j.requestId=wt(),q(j)}function X(){const M={...h.value};M.requestType="Action",M.actionType="History",M.requestId=wt(),q(M)}function te(M){return a.path.startsWith("/configurator")&&o.isChangedConfiguration?(_.value={save:()=>{o.maintainQuoteConfiguration()}},c.value=M,!0):(c.value="",!1)}function J(M,j=!0,K=null){if(!te(M)&&M.trim()){let G={...h.value};G.prompt=M.trim(),G.requestType="Chat",G.requestId=wt(),G.internalCall=!1,G.payload=B(),G.componentName=R.value,G.templateId=i.templateId,G.payload.lineItemsCount=i.lineItemsCount,K&&(G={...G,...K}),z(),j&&p.value.push({message:M.trim(),type:"user",...C.value&&{fileData:[C.value]},requestId:G.requestId}),q(G),$()}}function q(M){const j={action:"prompt",data:M};l.value.send(JSON.stringify(j))}const x=M=>{const j=M.filter(({content:K})=>!!K).map(K=>({message:K.content,type:K.role,requestId:K.requestId,epoch:K.epoch,isDML:K.isDML,undone:K.undone}));j.forEach((K,G)=>{K.isDML===!0&&G!==j.length-1&&(K.isDML=!1)}),p.value=[...p.value,...j]};function B(){return a.path==="/quote-item"?i.getPayload():{}}const R=e.computed(()=>a.path==="/quote-item"?"QuoteItem":""),U=()=>{p.value.push({type:"response",message:"Oops! Something went wrong while processing your request. Please try again later.",error:!0})},z=()=>{p.value=p.value.map(M=>({...M,links:[]}))};function A(M){var G,oe,ie;const j=((G=M==null?void 0:M.redirectObjects)==null?void 0:G.componentName)||(M==null?void 0:M.componentName),K=(M==null?void 0:M.redirectObjects)||{};if(j==="AdaptiveSearch"){const se=(oe=M==null?void 0:M.payload)==null?void 0:oe.searchTerm,ye=(ie=M==null?void 0:M.payload)==null?void 0:ie.applyFilters;se&&se!==n.searchText&&n.initAdaptiveSearch({searchTerm:se,filters:ye}),f.push("/adaptive-search")}else j==="Configurator"?f.push(`/configurator/${K.itemId}/${K.qliId}`):j==="QuoteReview"?f.push("/quote-item"):j==="QuoteItem"||j==="QuoteList"?(f.push("/quote-item"),i.performAIAction(M)):j==="QuickSelection"&&(r.quickSelectionLayout=M.payload,console.info("Loading QuickSelection data = ",JSON.stringify(r.quickSelectionLayout)),f.push("/match-records"))}function P(){if(O.value){const M={action:"cancel",data:{requestId:h.value.requestId,chatRoomId:T.value}};l.value.send(JSON.stringify(M))}}const F=()=>{s.value&&(clearInterval(s.value),s.value=null),d.value&&(clearInterval(d.value),d.value=null),g.value&&(clearTimeout(g.value),g.value=null)};return e.onBeforeUnmount(()=>{F()}),{unsavedChanges:_,loadingMessage:y,promptMessage:c,buttonLinks:E,websocketUrl:b,chatHistory:p,latestDMLRequest:v,strikethroughHistory:u,attachmentData:C,dataManuallyChanged:m,undoAction:Q,connectSocket:I,sendMessage:J,setInitialPayload:V,cancelRequest:P}}),Rt=Ke.defineStore("comRoot",()=>{const t=sn(),i=at(),n=ut(),r=e.ref(""),o=e.ref(""),a=e.ref("Genesis AI"),c=e.ref(""),b=e.ref({}),p=e.ref(""),v=e.ref(""),u=e.ref(""),m=e.ref(""),l=e.ref({}),f=e.ref(""),h=e.ref(""),d=e.ref(""),s=e.ref(""),g=e.ref(""),_=e.ref(""),C=e.ref(""),y=e.ref("Single"),E=e.ref("closed"),T=e.computed(()=>n.quoteName),O=e.computed(()=>y.value==="Single");async function V(N){r.value=N||oo("id"),o.value=oo("origin"),await S(),await I()}async function I(){try{console.info("getRecordInfo",r.value);let N=await window.salesforceConnector.getRecordInfo(r.value);return N=qe(N),N!==void 0&&(l.value=N,f.value=N.name,h.value=N.objectType,d.value=N.accountId,s.value=N.eCatalogId,g.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){i.handleError(N.message)}}async function S(){var L,$;console.info("getOrgInformation",r.value);const N=await window.salesforceConnector.getOrgInformation();t.websocketUrl=N.websocketUrl,c.value=(L=N.locale)==null?void 0:L.replace("_","-"),b.value=N.user,p.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,ra(N)}return{id:r,origin:o,title:T,subTitle:a,locale:c,user:b,orgName:p,orgId:v,orgType:u,packageVersion:m,objectType:h,recordInfo:l,name:f,accountId:d,eCatalogId:s,currencyCode:g,userLocale:_,opportunityId:C,pricingSchema:y,isSinglePricingSchema:O,flyoutState:E,start:V,getRecordInfo:I,setSubTitle:w}}),Ja="XX_ORD1__Quote__c",Xa="xxord1salespricec",cn="xx_ord1__item__c",Ga="xxord1productnrcc",Wa=Ke.defineStore("cartStore",()=>{const t=ut(),i=mo(),n=at(),r=e.ref(""),o=e.ref("$0"),a=e.ref("$0"),c=e.ref(null),b=e.ref({}),p=e.ref({}),v=e.ref({}),u=e.ref(""),m=e.ref(""),l=e.ref({}),f=e.ref(""),h=e.ref(""),d=e.ref({});async function s(){T()}async function g(){try{let I=await window.salesforceConnector.getProductCount(t.quoteId);if(I=qe(I),I!=null&&I.errorMessage){n.handleError(I.errorMessage);return}return r.value=I,I}catch{n.handleError("Failed to get Product Count. Please try again.")}}async function _(){try{let I=await window.salesforceConnector.getQuoteTotal(t.quoteId);if(I=qe(I),I!=null&&I.errorMessage){n.handleError(I.errorMessage);return}return a.value=I.monthlyTotal,o.value=I.onetimeTotal,I}catch{n.handleError("Failed to get Total Amount. Please try again.")}}async function C(I,S,w,N=""){if(!t.sectionDataMap.get(w).parentQLIs[S].removingItem){t.sectionDataMap.get(w).parentQLIs[S].removingItem=!0,h.value=I.id,await y(I.id)==="Success"&&(t.fetchAllQuoteLineItems(),N&&N(I,S,w));let $=t.sectionDataMap.get(w).parentQLIs.filter(H=>H[cn]===I[cn]).length;h.value="",i.lstItems.forEach(H=>{H[cn]===I[cn]&&(H.addedToQuote===!0&&(H.addedToQuote=!1),$===0&&(H.removedFromQuote=!0))})}}async function y(I){try{let S=await window.salesforceConnector.deleteQLI(I);if(S!=null&&S.errorMessage){n.handleError(S.errorMessage);return}return g(),_(),S}catch{n.handleError("Failed to remove Quote Item. Please try again.")}}function E(I){var N,L;const S=(N=I==null?void 0:I[Ga])==null?void 0:N.match(/\.\d+/);S&&(S.value=S[0].length-1);const w=(L=I==null?void 0:I[Xa])==null?void 0:L.match(/\.\d+/);return w&&(w.value=w[0].length-1),S||w}function T(I=!0){g(),_(),I&&t.fetchTemplates(Ja).then(()=>{t.getFilteredListWithFields()})}function O(I){const S=t.sectionDataMap;for(const[,w]of S.entries())w.parentQLIs.forEach(N=>{N.id===I.id&&(w.columns.forEach(L=>{if(L.dataType==="CURRENCY"){const $=L.field.replace(/_/g,"");N[$]=V(N[$],I[L.field])}}),I!=null&&I.billingPeriodValue&&(I!=null&&I.formattedBillingPeriodValue)&&(N.formattedBillingPeriodValue=V(N.formattedBillingPeriodValue,I.billingPeriodValue)),I!=null&&I.oneTimeValue&&(I!=null&&I.formattedOneTimeValue)&&(N.formattedOneTimeValue=V(N.formattedOneTimeValue,I.oneTimeValue)))})}function V(I,S){const w=Number(S);if(isNaN(w))return I;const N=I.match(/(\d[\d,]*)(\.\d+)?/);if(!N)return I;const L=N[2]||"",$=L.length?L.length-1:0,H=w.toLocaleString("en-US",{minimumFractionDigits:$,maximumFractionDigits:$});return I.replace(N[1]+L,H)}return{initializeCart:s,loadCartState:T,productCount:r,onetimeTotal:o,monthlyTotal:a,filterCartItem:c,billingPeriodValue:u,hasOneTimeValue:m,hasBillingPeriodInList:b,oneTimeFieldAvailable:p,billingPeriodFieldAvailable:v,priceDecimalPrecision:l,cartItemUpdatingId:f,removingItemLoaderId:h,cartItemColumnsMap:d,getProductCount:g,getQuoteTotal:_,removeItem:C,removeQuoteItem:y,getDecimalPrecisionFromSalesPriceOrNRC:E,updateFormattedValues:O,formateCurrencyValue:V}}),Ya=t=>[{title:"Apply Discount",subOptions:[...t.map(i=>`Apply Discount on ${i} for `),"Show Maximum discount allowed","Apply Maximum Discount Allowed",...t.map(i=>`Apply Discount on ${i} 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"]}],el={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"}]},tl=[{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"]}],ut=Ke.defineStore("quote",()=>{const t=at(),i=Wa(),n=Rt(),r=e.ref(""),o=e.ref(""),a=e.ref(0),c=e.ref(""),b=e.ref([]),p=e.ref({template:!0,filteredList:!1}),v=e.ref(null),u=e.ref(new Map),m=e.ref({}),l=e.ref(!1),f=e.ref(!0),h=e.ref(!1),d=e.ref({text:"Hide Options",altText:"Show Options",handler:()=>{f.value=!f.value,V()},color:"#136E05",isActive:!1}),s=e.computed(()=>{const q=Array.from(u.value.values()).map(x=>x.sectionName);return Ya(q)});e.watch(c,()=>{p.value.template||O()});function g(){const q=new Map,x=[];for(const[R,U]of u.value.entries())q.set(R,U.selected),x.push(U);const B=JSON.parse(JSON.stringify(x));return B.forEach(R=>{delete R.selected;const U=new Map,z=[];R.lineItems.forEach(A=>{A.Selected=q.get(R.tableId).get(A.id)||!1,A.xx_ord1__parent_qli__c?(U.has(A.xx_ord1__parent_qli__c)||U.set(A.xx_ord1__parent_qli__c,[]),U.get(A.xx_ord1__parent_qli__c).push(A)):z.push(A)}),R.lineItems=z.map(A=>({...A,options:U.get(A.id)||[]})),delete R.loading,delete R.parentQLIs,delete R.totalValues}),{showOptions:f.value,sections:B,templateId:c.value}}async function _(q){try{let x=await window.salesforceConnector.getPrimaryQuote(q);x=qe(x),x!==void 0&&(console.info("getPrimaryQuote",JSON.stringify(x)),r.value=x.recordId,console.info("quoteId",r.value),o.value=x.name,c.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(q){var x,B;try{p.value.template=!0;let R=await window.salesforceConnector.fetchContentTemplates(JSON.stringify({lstObjectName:[q],templateType:"Document",templateId:null,fetchOnlyDefault:!1}));R=qe(R);const U=R==null?void 0:R.templates[q];return c.value||(c.value=(x=U.find(z=>z.XX_ORD1__Default__c))==null?void 0:x.Id),c.value||(c.value=(B=U[0])==null?void 0:B.Id),b.value=U,p.value.template=!1,b.value}catch(R){t.handleError(R.message),console.info("[ERROR]: fetchTemplates() error = ",R)}}function y(q){if(!q)return null;const x=/\{!\$(\w+):([\w.]+)\}/,B=q.match(x);return B?{function:B[1],apiname:B[2].split(".")[1]}:null}async function E(q){try{const x={Id:r.value,XX_ORD1__Document_Template__c:q};return await window.salesforceConnector.updateQuote(JSON.stringify([x]))}catch(x){t.handleError(x.message),console.info("[ERROR]: updateQuote() error = ",x)}}async function T(){try{p.value.filteredList=!0;let q=await window.salesforceConnector.getQuoteEPageLayout();u.value.clear(),i.cartItemColumnsMap={},q=qe(q);const x=q.map(R=>({label:R.fieldLabel,field:R.fieldName.toLowerCase(),isEditable:R.isEditable,dataType:R.dataType,...R.picklistValues?{picklistValues:R.picklistValues}:{}})),B=wt();return u.value.set(B,{loading:!0,lineItems:[],parentQLIs:[],columns:x,tableId:B,sectionName:"All Rows",selected:new Map,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}),i.cartItemColumnsMap[B]=x,d.value.isActive=!1,f.value=!0,v.value={lstCB:[{columns:x,footer:null,title:"All Rows",sectionName:"All Rows",tableId:B,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}]},V(),p.value.filteredList=!1,q}catch(q){t.handleError(q.message),console.info("[ERROR]: getQuoteEPageLayout() error = ",q)}}async function O(){if(b.value.length===0){T();return}try{p.value.filteredList=!0;let q=await window.salesforceConnector.getFilteredListWithFields(JSON.stringify({templateId:c.value}));E(c.value),q=qe(q),console.info("res.lstCB = ",q.lstCB);const x=q==null?void 0:q.objectFieldsMap;return u.value.clear(),i.cartItemColumnsMap={},q.lstCB=q.lstCB.map(B=>{const{fields:R,filters:U,primarysort:z,primarysortdesc:A}=JSON.parse(B.XX_ORD1__Block_Properties__c),P=R.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}:{}}}),F=B.Id||wt();return u.value.set(F,{loading:!0,lineItems:[],parentQLIs:[],columns:P,tableId:F,sectionName:B.Name,selected:new Map,footer:y(B.XX_ORD1__Table_Footer_HTML__c),filters:U,primarysort:z,primarysortdesc:A}),i.cartItemColumnsMap[F]=P,d.value.isActive=!1,f.value=!0,{columns:P,footer:y(B.XX_ORD1__Table_Footer_HTML__c),title:B.Name,sectionName:B.Name,tableId:F,filters:U,primarysort:z,primarysortdesc:A}}),v.value=q,V(),p.value.filteredList=!1,q}catch(q){t.handleError(q.message),console.info("[ERROR]: getFilteredListWithFields() error = ",q)}}async function V(q=!0){const x=[];for(const[B]of u.value)x.push(w(B,q));return await Promise.all(x),i.getProductCount(),!0}function I(q,x){return u.value.get(q).columns.some(B=>B.field.toLowerCase()===x)||i.cartItemColumnsMap[q].some(B=>B.field.toLowerCase()===x)}function S(q,x){let B=on(q);const R=n.pricingSchema,U=I(x,"xx_ord1__nrc__c"),z=I(x,"xx_ord1__sales_price__c"),A=I(x,"xx_ord1__qty__c");return B=B.map(P=>{let F={};R==="nrc/mrc"&&(P!=null&&P.xx_ord1__billing_period__c)?F={...z?{billingPeriodValue:(P==null?void 0:P.xx_ord1__sales_price__c)===0?"0":(P==null?void 0:P.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:P==null?void 0:P.xxord1salespricec}:{},...U?{oneTimeValue:(P==null?void 0:P.xx_ord1__nrc__c)===0?"0":(P==null?void 0:P.xx_ord1__nrc__c)||null,formattedOneTimeValue:P==null?void 0:P.xxord1nrcc}:{}}:R==="nrc/mrc"&&!(P!=null&&P.xx_ord1__billing_period__c)?z&&(F={oneTimeValue:(P==null?void 0:P.xx_ord1__sales_price__c)===0?"0":(P==null?void 0:P.xx_ord1__sales_price__c)||null,formattedOneTimeValue:P==null?void 0:P.xxord1salespricec}):R!=="nrc/mrc"&&(P!=null&&P.xx_ord1__billing_period__c)?z&&(F={billingPeriodValue:(P==null?void 0:P.xx_ord1__sales_price__c)===0?"0":(P==null?void 0:P.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:P==null?void 0:P.xxord1salespricec}):R!=="nrc/mrc"&&!(P!=null&&P.xx_ord1__billing_period__c)&&z&&(F={oneTimeValue:(P==null?void 0:P.xx_ord1__sales_price__c)===0?0:(P==null?void 0:P.xx_ord1__sales_price__c)||null,formattedOneTimeValue:P==null?void 0:P.xxord1salespricec});const{xx_ord1__qty__c:M,xx_ord1__sales_price__c:j,xx_ord1__nrc__c:K,...G}=P,oe={...G,id:P.id,description:(P==null?void 0:P.xx_ord1__line_description__c)||"",xx_ord1__billing_period__c:P==null?void 0:P.xx_ord1__billing_period__c,...A?{xx_ord1__qty__c:M}:{},xx_ord1__item__c:P==null?void 0:P.xx_ord1__item__c,"xx_ord1__item__r.xx_ord1__decimal_precision__c":P["xx_ord1__item__r.xx_ord1__decimal_precision__c"]||"0",...F};return oe!=null&&oe.billingPeriodValue&&(i.hasBillingPeriodInList[x]=!0,i.billingPeriodValue=oe==null?void 0:oe.xx_ord1__billing_period__c),"oneTimeValue"in oe&&(i.oneTimeFieldAvailable[x]=!0),"billingPeriodValue"in oe&&(i.billingPeriodFieldAvailable[x]=!0),(oe==null?void 0:oe.oneTimeValue)!==""&&(oe==null?void 0:oe.oneTimeValue)!==null&&(i.hasOneTimeValue=!0),oe}),B}async function w(q,x=!0){var B,R;try{const U=u.value.get(q);if(console.info("sectionData = ",U.sectionName),!U)return;U.loading=x,x&&(U.lineItems=[]);const{columns:z,filters:A,primarysort:P,primarysortdesc:F,footer:M}=U,j=z.map(de=>de.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"),(B=i.cartItemColumnsMap[q])==null||B.forEach(de=>{j.includes(de.field)||j.push(de.field)});const K=await N({fields:j,recordId:r.value,filters:A||[],primarySortBy:P||"",primarySortOrder:F?"DESC":"ASC",includeOptions:f.value,totalFields:M?[M.apiname]:[]}),G=K.lineItems,oe=new Map;let ie=[];const se=(R=K.fieldTotals)==null?void 0:R.map(de=>de.totalValue);G.forEach(de=>{de.XX_ORD1__Parent_QLI__c?oe.has(de.XX_ORD1__Parent_QLI__c)?oe.get(de.XX_ORD1__Parent_QLI__c).push(de):oe.set(de.XX_ORD1__Parent_QLI__c,[de]):ie.push(de)});const ye=[];return ie.forEach(de=>{ye.push(de),oe.has(de.Id)&&ye.push(...oe.get(de.Id))}),ie=S(ie,q),U.lineItems=on(ye),U.parentQLIs=ie,U.totalValues=se,U.loading=!1,u.value=new Map(u.value),ye}catch(U){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",U.message);const z=u.value.get(q);z&&(z.loading=!1)}}async function N(q){try{let x=await window.salesforceConnector.getQuoteLineItemsWithFilteredTable(JSON.stringify(q));return x=qe(x),x}catch(x){t.handleError(x.message),console.info("[ERROR]: getQuoteLineItemsWithFilteredTable() error = ",x)}}async function L(q){try{console.info("updateQli() payload = ",q);let x=await window.salesforceConnector.updateQli(JSON.stringify(q));return x=qe(x),V(!1),x}catch(x){t.handleError(x.message),console.info("[ERROR]: updateQli() error = ",x)}}async function $(q){try{let x=await window.salesforceConnector.deleteQLI(q);return x=qe(x),V(),x}catch(x){t.handleError(x.message),console.info("[ERROR]: deleteQLI() error = ",x)}}async function H(q,x){try{l.value=!0;const B={fields:q};x&&(B.objectName=x),q.includes("xx_ord1__qty__c")&&x==="xx_ord1__ecatalog_item__c"&&(B.fields=B.fields.filter(U=>U!=="xx_ord1__qty__c")),q.includes("xx_ord1__sales_price__c")&&x!=="xx_ord1__quote_line_item__c"&&(B.fields=B.fields.filter(U=>U!=="xx_ord1__sales_price__c"));let R=await window.salesforceConnector.getFieldsData(JSON.stringify(B));return typeof R=="string"&&(R=JSON.parse(R)),R!=null&&R.errorMessage?(t.handleError(R.errorMessage),null):(m.value={...m.value,...R},console.info("fieldsData.value = ",JSON.stringify(m.value)),R)}catch(B){return t.handleError("Failed to get Fields Data. Please try again."),console.info("[ERROR]: getFieldsData() error = ",B),null}finally{l.value=!1}}function Q(q=""){var x;return!q||q.includes(".")?!1:q.includes("xx_ord1__qty__c")?!0:((x=m.value[q])==null?void 0:x.isEditable)||!1}function X(){te(el)}async function te(q){var x,B,R,U,z,A,P,F,M;if(q.payload){if((x=q.payload)!=null&&x.uiModification){const j=q.payload.uiModification;if(((B=j.addColumn)==null?void 0:B.length)>0)if(j.addColumn.forEach(K=>{K.columns.forEach(G=>{G.field=G.field.toLowerCase()})}),j.addColumn[0].sectionName==="all_section")for(const[K,G]of u.value)G.columns=[...G.columns,...j.addColumn[0].columns];else j.addColumn.forEach(K=>{u.value.get(K.tableId)&&(u.value.get(K.tableId).columns=[...u.value.get(K.tableId).columns,...K.columns])});if(((R=j.removeColumn)==null?void 0:R.length)>0)if(j.removeColumn.forEach(K=>{K.columns=K.columns.map(G=>G.toLowerCase())}),j.removeColumn[0].sectionName==="all_section")for(const[K,G]of u.value)G.columns=G.columns.filter(oe=>!j.removeColumn[0].columns.includes(oe.field));else j.removeColumn.forEach(K=>{u.value.get(K.tableId)&&(u.value.get(K.tableId).columns=u.value.get(K.tableId).columns.filter(G=>!K.columns.includes(G.field)))});if(((U=j.filter)==null?void 0:U.length)>0)if(j.filter[0].sectionName==="all_section")for(const[K,G]of u.value)G.filters=[...G.filters,...j.filter[0].filters];else j.filter.forEach(K=>{u.value.get(K.tableId)&&(u.value.get(K.tableId).filters=[...u.value.get(K.tableId).filters,...K.filters])});if(((z=j.groupBy)==null?void 0:z.length)>0){const K=((A=[...u.value.values()][0])==null?void 0:A.columns)||tl;u.value.clear(),i.cartItemColumnsMap={},j.groupBy.forEach(G=>{i.cartItemColumnsMap[G.tableId]=G.columns||K,u.value.set(G.tableId,{loading:!0,lineItems:[],parentQLIs:[],columns:G.columns||K,tableId:G.tableId,sectionName:G.sectionName,selected:new Map,footer:y(G.footer),filters:G.filters,primarysort:G.primarysort,primarysortdesc:G.primarysortdesc})})}j.showOptions!==void 0&&(f.value=j.showOptions)}if(((F=(P=q.payload)==null?void 0:P.sections)==null?void 0:F.length)>0){const j=(M=q.payload)==null?void 0:M.sections;u.value.clear(),j.forEach(K=>{K.tableId||(K.tableId=wt()),K.selected=new Map,u.value.set(K.tableId,K)}),V()}}q.actionFunction==="Reload"&&(V(),console.info("Reloading quote line items"))}async function J(q){var x,B;try{const R=new Set;for(const U of u.value.keys())(x=u.value.get(U).lineItems)==null||x.forEach(A=>{A.attributes=null,R.add(A.id)});if(q){const U={lineItemIds:[...R]},z=await window.productManagerController.getLineItemAttributes({request:JSON.stringify(U)}),A=JSON.parse(z.data);for(const P of u.value.keys())(B=u.value.get(P).lineItems)==null||B.forEach(M=>{M.attributes=A[M.id]||null})}}catch(R){console.info("[ERROR]: fetchAttributesData() error = ",R)}}return{showAttributes:h,quoteId:r,quoteName:o,templateId:c,templateOptions:b,loading:p,currentTemplateData:v,fieldsData:m,fieldsDataLoading:l,showOptionHeaderButton:d,sectionDataMap:u,promptSuggestions:s,lineItemsCount:a,addColumns:X,getQuoteEPageLayout:T,getPayload:g,getPrimaryQuote:_,fetchTemplates:C,getFilteredListWithFields:O,getQuoteLineItemsWithFilteredTable:N,updateQli:L,getFieldsData:H,deleteQLI:$,performAIAction:te,isEditableField:Q,fetchQuoteLineItems:w,fetchAllQuoteLineItems:V,fetchAttributesData:J}}),go=Ke.defineStore("comShare",()=>{const t=e.ref(""),i=e.ref(""),n=e.ref(""),r=e.ref(""),o=e.ref(""),a=e.ref(""),c=e.ref(""),b=e.ref("Single"),p=e.computed(()=>b.value==="Single");async function v(u){t.value=u.orgType||"Production",i.value=u.orgId||"",n.value=u.userId||"",r.value=u.accountId||"",o.value=u.opportunityId||"",c.value=u.userLocale||"en_US",b.value=u.pricingSchema||"Single"}return{orgType:t,orgId:i,userId:n,accountId:r,opportunityId:o,userLocale:c,pricingSchema:b,quoteId:a,isSinglePricingSchema:p,setSetupData:v}}),nl="https://api-svc.blink.expedite1.com/api/product-pricing/evaluateConfigurationSelection",rl={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 ol(t=rl){const i=nl;try{const n=await fetch(i,{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 il(t){const i=n=>Math.min(...n.options.map(r=>r.relationshipInfo.primarySortOrder));return t.forEach(n=>{n.itemTypes.forEach(r=>{r.options.sort((o,a)=>o.relationshipInfo.primarySortOrder-a.relationshipInfo.primarySortOrder||o.itemName.localeCompare(a.itemName))}),n.itemTypes.sort((r,o)=>i(r)-i(o)||r.itemTypeName.localeCompare(o.itemTypeName))}),t.sort((n,r)=>{const o=Math.min(...n.itemTypes.map(i)),a=Math.min(...r.itemTypes.map(i));return o-a||n.category.localeCompare(r.category)}),t}const al=(t,i)=>{const n=(r,o)=>typeof o=="function"?void 0:o;return JSON.stringify(t,n)===JSON.stringify(i,n)},Ye=Ke.defineStore("comConfigurator",()=>{ho();const t=ut(),i=at(),n=go(),r=ln(),o=e.ref(null),a=e.ref(null),c=e.ref(null),b=e.ref({}),p=e.ref(null),v=e.ref([]),u=e.ref(null),m=e.ref(null),l=e.ref(new Map),f=e.ref(!1),h=e.ref({configuration:!1,lineItem:!1,productOptionsPricing:!1,bestOfferPrice:!1,lineItemAttributes:!1,save:!1}),d=e.ref(!1),s=e.computed(()=>g.value&&!n.isSinglePricingSchema),g=e.computed(()=>{let A=!0,P=!0,F=!0,M=null;for(const j of b.value.categoryOptions)for(const K of j.itemTypes)for(const G of K.options)G.billingPeriod&&(M&&M!==G.billingPeriod&&(F=!1),M=G.billingPeriod,!G.yrcPrice&&G.billingPeriod==="Monthly"&&(A=!1),!G.mrcPrice&&G.billingPeriod==="Yearly"&&(P=!1));return A&&P&&F}),_=e.computed(()=>!al(b.value,p.value)),C=e.computed(()=>{var P;const A=((P=b.value)==null?void 0:P.categoryOptions)||[];return A.forEach(F=>{F.itemTypes.forEach(M=>{M.selectedOptions=M.options.filter(j=>M.selected.includes(j.itemId)),M.totalPrice=function(){return M.selectedOptions.reduce((j,K)=>j+K.price*K.qty,0)||0},M.oneTimePrice=function(){return M.selectedOptions.filter(j=>!j.billingPeriod).reduce((j,K)=>j+K.price*K.qty,0)||0},M.recurringPrice=function(){return M.selectedOptions.filter(j=>j.billingPeriod).reduce((j,K)=>j+K.price*K.qty,0)||0}}),F.selectedItemTypes=F.itemTypes.filter(M=>M.selected.length>0),F.totalPrice=function(){return F.itemTypes.reduce((M,j)=>M+j.totalPrice(),0)},F.oneTimePrice=function(){return F.itemTypes.reduce((M,j)=>M+j.oneTimePrice(),0)},F.recurringPrice=function(){return F.itemTypes.reduce((M,j)=>M+j.recurringPrice(),0)}}),A.filter(F=>F.itemTypes.filter(M=>M.selected.length>0).length>0)}),y=e.computed(()=>C.value.reduce((A,P)=>A+P.totalPrice(),0)),E=e.computed(()=>{if(!b.value)return{basePrice:0,addOns:0,oneTimePrice:0,recurringPrice:0,total:0};const A=C.value.reduce((M,j)=>M+j.totalPrice(),0);let P=C.value.reduce((M,j)=>M+j.oneTimePrice(),0),F=C.value.reduce((M,j)=>M+j.recurringPrice(),0);return b.value.billingPeriod?F=(F+b.value.price)*b.value.qty:P=(P+b.value.price)*b.value.qty,{basePrice:b.value.price,addOns:A,oneTimePrice:P,recurringPrice:F,total:b.value.price*b.value.qty+A*b.value.qty+P+F}}),T=e.computed(()=>{var P,F,M,j;const A=new Map;return(P=u.value)!=null&&P.productLineItem&&A.set((F=u.value)==null?void 0:F.productLineItem.XX_ORD1__Item__c,(M=u.value)==null?void 0:M.productLineItem),(j=u.value)==null||j.options.forEach(K=>{A.set(K.XX_ORD1__Item__c,K)}),A}),O=e.computed(()=>{const A=new Map;return b.value.categoryOptions.forEach(P=>{P.itemTypes.forEach(F=>{F.options.forEach(M=>{A.set(M.relationshipInfo.publishKey,M)})})}),A}),V=e.computed(()=>{if(!b.value)return{};const A=M=>!M||!Array.isArray(M)?[]:M.filter(j=>j.apiName&&j.value!==null&&j.value!==void 0&&j.value!=="").map(j=>({fieldAPIName:j.apiName,value:j.dataType==="BOOLEAN"?j.value?"true":"false":j.dataType==="REFERENCE"?j.referenceRecordId||j.value||"":j.value||""})),P={item_id:b.value.itemId,qli_id:b.value.qliId||null,name:b.value.itemName,qty:b.value.qty||1,price:b.value.price||0,attributes:A(b.value.attributes)},F=[];return b.value.categoryOptions.forEach(M=>{M.itemTypes.forEach(j=>{j.options.forEach(K=>{j.selected.includes(K.itemId)&&F.push({item_id:K.itemId,qli_id:K.qliId||null,name:K.itemName,qty:K.qty||1,price:K.price||0,attributes:A(K.attributes)})})})}),{[b.value.itemId]:{product:P,options:{add:F,remove:[]}}}});function I(A){const P=new Map;A.options.add.forEach(F=>{P.set(F.item_id,F)}),b.value.qty=A.product.qty,b.value.price=A.product.price,b.value.attributes=A.product.attributes,b.value.categoryOptions.forEach(F=>{F.itemTypes.forEach(M=>{M.options.forEach(j=>{P.has(j.itemId)&&(j.itemName=P.get(j.itemId).name,j.qty=P.get(j.itemId).qty,j.price=P.get(j.itemId).price,M.selected.includes(j.itemId)||M.selected.push(j.itemId))})})})}function S(){return{get getConfig(){return V.value},setConfig:I}}function w(A){b.value.qliId&&(b.value.qliBillingPeriod==="Monthly"&&!A?b.value.price=b.value.qliSalesPrice||b.value.qliMrcPrice:b.value.qliBillingPeriod==="Yearly"&&A&&(b.value.price=b.value.qliSalesPrice)),b.value.categoryOptions.forEach(P=>{P.itemTypes.forEach(F=>{F.options.forEach(M=>{M.billingPeriod&&(M.price=(A?M.yrcPrice.offerPrice:M.mrcPrice.offerPrice)||M.price,M.qliId&&(M.qliBillingPeriod==="Monthly"&&!A?M.price=M.qliSalesPrice||M.qliMrcPrice:M.qliBillingPeriod==="Yearly"&&A&&(M.price=M.qliSalesPrice)))})})})}function N(){b.value={},p.value=null,v.value=[],u.value=null,m.value=null,l.value=new Map,f.value=!1,h.value.configuration=!1,h.value.lineItem=!1,h.value.productOptionsPricing=!1,h.value.bestOfferPrice=!1,h.value.lineItemAttributes=!1,h.value.save=!1}async function L(A,P,F){console.time("CONFIGURATOR INIT CONFIGURATOR"),N(),console.timeLog("CONFIGURATOR INIT CONFIGURATOR","1"),a.value=A,c.value=P,o.value=F||n.quoteId;const M=await $();console.timeLog("CONFIGURATOR INIT CONFIGURATOR","2"),b.value=H(M),c.value&&(await X(),console.timeLog("CONFIGURATOR INIT CONFIGURATOR","3"),Q(b.value),b.value.categoryOptions.forEach(j=>{j.itemTypes.forEach(K=>{K.options.forEach(G=>{Q(G),(T.value.has(G.itemId)||G.relationshipInfo.relationship==="Kit")&&K.selected.push(G.itemId)})})}),console.timeLog("CONFIGURATOR INIT CONFIGURATOR","4")),p.value=JSON.parse(JSON.stringify(b.value)),console.timeEnd("CONFIGURATOR INIT CONFIGURATOR")}async function $(){try{const A={accountId:n.accountId,objectId:o.value,itemId:a.value,configScope:"BASIC",fields:[],pricePreference:"Lowest Price"},P=await window.productManagerController.getAvailableConfiguration(A);console.info("getAvailableConfiguration:result",P);const F=P.data.productConfiguration;return F.categoryOptions=il(F.categoryOptions),F}catch(A){return console.info("error",A.message),!1}}function H(A){l.value.set(c.value,A.attributes),v.value=A.configRules;const P=new Set;return v.value.forEach(F=>{const M=JSON.parse(F.ruleJson);M.optionSelected.forEach(j=>{P.add(j)}),M.affectedOptions.forEach(j=>{P.add(j)})}),Q(A),A.categoryOptions.forEach(F=>{F.key=F.category.toLowerCase().replace(/\s+/g,"-").replace(/[&]/g,""),F.itemTypes.forEach(M=>{M.selected=[],M.numberOfColumns||(M.numberOfColumns=1),M.numberOfColumns>1&&(M.lightboxAttributes=!0),M.maxNumber||(M.maxNumber=100),M.minNumber||(M.minNumber=0),M.maxQuantity||(M.maxQuantity=1e4),M.minQuantity||(M.minQuantity=1),M.maxNumber===1?(M.isRadio=!0,M.minMessage="Please select 1 option",M.maxMessage="",M.isKit=M.options.some(j=>j.relationshipInfo.relationship==="Kit")):(M.minMessage=`Minimum of ${M.minNumber} selection${M.minNumber!==1?"s":""} required`,M.maxMessage=`Maximum of ${M.maxNumber} selection${M.maxNumber!==1?"s":""} allowed`),M.options.forEach(j=>{F.showImage=F.showImage||!!j.defaultImageURL,j.showAttributesModal=!1,j.calculateRules=P.has(j.relationshipInfo.publishKey),j.qty=M.minQuantity||1,j.getTags=()=>(j.attributes=j.attributes||[],j.attributes.filter(K=>K.value!==null&&K.value!=="").map(K=>({label:K.label,value:K.value}))),Object.defineProperty(j,"isDisabled",{get:function(){return j.relationshipInfo.relationship==="Kit"||(M.isRadio?M.isKit:!M.selected.includes(j.itemId)&&M.maxNumber===M.selected.length)}}),Q(j)})})}),A}function Q(A){A.isAttributes=A.attributes&&A.attributes.length>0;const P=A.catalogItem;if(T.value.has(A.itemId)){const F=T.value.get(A.itemId);A.qliId=F.Id,A.qty=F.XX_ORD1__QTY__c,A.itemName=F.XX_ORD1__Line_Description__c,A.billingPeriod=F.XX_ORD1__Billing_Period__c,A.price=F.XX_ORD1__Sales_Price__c,A.billingPeriod?A.price=F.XX_ORD1__Sales_Price__c||F.XX_ORD1__MRC__c:A.price=F.XX_ORD1__NRC__c||F.XX_ORD1__Sales_Price__c,A.qliSalesPrice=F.XX_ORD1__Sales_Price__c,A.qliNrcPrice=F.XX_ORD1__NRC__c,A.qliMrcPrice=F.XX_ORD1__MRC__c,A.qliBillingPeriod=F.XX_ORD1__Billing_Period__c,l.value.set(A.qliId,A.attributes)}else A.itemName=P.XX_ORD1__Line_Description__c||A.itemName,A.price=P.XX_ORD1__Negotiated_Price__c||P.XX_ORD1__NRC_for_New__c,A.nrcPrice=P.XX_ORD1__NRC_for_New__c}async function X(){var A;h.value.lineItem=!0,console.info("getLineItems",o.value,c.value);try{const P={objectId:o.value,filters:{},additionalFields:["Name","XX_ORD1__Line_Description__c"],primarySort:{field:"CreatedDate",direction:"DESC"},productPage:{limit:200,offset:0,productLineItemId:c.value}},F=await window.productManagerController.getLineItems({request:JSON.stringify(P)});return u.value=((A=F.data.products)==null?void 0:A.find(({productLineItem:M})=>M.Id===c.value))||null,console.info("lineItem.value",u.value),h.value.lineItem=!1,F}catch(P){return console.info("error",P.message),h.value.lineItem=!1,!1}}async function te(A){console.info("getRecords");try{const P=await window.productManagerController.getRecords({request:JSON.stringify(A)});return console.info("getRecords:result",P),JSON.parse(P.data)}catch(P){return console.info("error",P.message),!1}}async function J(A){const P={accountId:n.accountId,eCatalogItemIds:A,pricePreference:"Heighest Priority"},F=await window.productManagerController.calculateBestOfferPrice({request:JSON.stringify(P)});return console.info("calculateBestOfferPrice:result",F),h.value.bestOfferPrice=!1,JSON.parse(F.data)}async function q(){f.value=!0,h.value.save=!0,console.info("maintainQuoteConfiguration");const A=[],P=[];b.value.categoryOptions.forEach(j=>{j.itemTypes.forEach(K=>{K.options.forEach(G=>{K.selected.includes(G.itemId)?A.push(x(G)):G.qliId&&P.push(G.qliId)})})});const F={objectId:o.value,eCatalogId:n.eCatalogId,isGenesisAI:!0,blinkUser:!1,optionsToRemove:P,grandFatheredOptionsToRemove:[],productLineItem:{...x(b.value),optionLineItems:A}};console.info("maintainQuoteConfiguration:request",F);const M=await window.productManagerController.maintainQuoteConfiguration({request:JSON.stringify(F)});if(console.info("maintainQuoteConfiguration:result",M),M!=null&&M.error){const j={title:"Unable to Save Configuration",description:M.error,button:{label:"Back to Configuration",action:()=>{f.value=!1}},cancel:{label:"Quote List",action:()=>{r.push("/quote-item?id="+o.value)}}};i.errorPopup=j}else p.value=JSON.parse(JSON.stringify(b.value)),console.info("maintainQuoteConfiguration:result",M);h.value.save=!1}function x(A){const P={};A.isAttributes&&A.attributes.forEach(M=>{M.apiName.includes(".")||(M.dataType==="BOOLEAN"?P[M.apiName]=M.value?"true":"false":M.dataType==="REFERENCE"?P[M.apiName]=M.referenceRecordId:P[M.apiName]=M.value)});const F={attributes:P,itemId:A.itemId,lineItemId:A.qliId,lineDescription:A.itemName,qty:A.qty,billingPeriod:A.billingPeriod,...A.offer};return A.billingPeriod&&g.value&&!n.isSinglePricingSchema&&(F.billingPeriod=d.value?"Yearly":"Monthly"),!n.isSinglePricingSchema&&!A.billingPeriod?F.nrcPrice=A.price:(F.applyOnField="Catalog Price",F.salesPrice=A.price,F.nrcPrice=A.nrcPrice),F}async function B(){const A={objectId:n.accountId,productItemId:a.value};try{let P=await window.productManagerController.getProductCrossSells(A);console.info("getProductCrossSells:result",P),P=P.data?JSON.parse(P.data):{};debugger;if(P.crossSells.length===0)return P;const F=P.crossSells.map(K=>K.Id),M=await J(F),j=new Map;return M.forEach(K=>{j.set(K.eCatalogItemId,{...K,...K.pricingTypes[0]})}),P.crossSells.forEach(K=>{K.loading=!1,K.Name=K.XX_ORD1__Line_Description__c||K.XX_ORD1__Item__r.Name,K.Description=K.XX_ORD1__Item__r.XX_ORD1__Product_Description__c,j.has(K.Id)?(K.Price=j.get(K.Id).offerPrice,K.priceFormatted=j.get(K.Id).formattedOfferPrice,K.offer={offerDiscount:j.get(K.Id).offerDiscount,offerId:j.get(K.Id).offerId,offerType:j.get(K.Id).offerType}):(K.Price=K.XX_ORD1__List_Price2__c,K.priceFormatted=K.XX_ORD1__List_Price2__c,K.offer={offerDiscount:0,offerId:null,offerType:null})}),P}catch(P){return console.info("error",P.message),!1}}async function R(A,P){var K,G;const F={product:{publishKey:b.value.publishKey,lineDescription:b.value.itemName},options:[]};b.value.categoryOptions.forEach(oe=>{oe.itemTypes.forEach(ie=>{ie.options.forEach(se=>{ie.selected.includes(se.itemId)&&F.options.push({publishKey:se.relationshipInfo.publishKey,lineDescription:se.itemName})})})}),console.info("evaluateConfigSelection:currentConfig.options",F.options);const M={productJSON:{productItem:{configRules:v.value}},currentConfig:F,selected:A?{publishKey:(K=A.relationshipInfo)==null?void 0:K.publishKey,attributes:A.attributes,lineDescription:A.itemName}:{},unselected:P?{publishKey:(G=P.relationshipInfo)==null?void 0:G.publishKey,attributes:P.attributes,lineDescription:P.itemName}:{}};return await ol(M)}async function U(){try{const A=["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"],F=(await t.getQuoteLineItemsWithFilteredTable({fields:A,recordId:o.value,filters:[],includeOptions:!1,totalFields:[]})).lineItems;return console.info("fetchQuoteLineItems:res",F),F}catch(A){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",A.message)}}async function z(A){const P={quoteId:o.value,lstQLIRequest:[{eCatalogItemId:A.Id,quantity:1,offerApplicable:A.offer}]};try{const F=await window.productManagerController.createQuoteProducts({request:JSON.stringify(P)});console.info("getProductCrossSells:result",F)}catch(F){return console.info("error",F.message),!1}}return{itemId:a,configuration:b,_configurationCopy:p,lineItem:u,savedScreen:f,loading:h,summary:C,addOns:y,summaryPrices:E,optionByItemId:T,attributesByQLIId:l,optionByPublishKey:O,showYearlyPricing:d,isYearlyPricingExist:g,isChangedConfiguration:_,isRecurringPricingSchema:s,exposeProperties:S,updateCurrentConfiguration:I,changePricingScheme:w,createQuoteProducts:z,resetConfigurator:N,fetchQuoteLineItems:U,getRecords:te,getProductCrossSells:B,initConfigurator:L,maintainQuoteConfiguration:q,evaluateConfigSelection:R}}),ll={class:"ect-p-4 ect-flex ect-gap-2 ect-items-center ect-justify-between ect-border-b ect-border-gray-200"},sl={class:"ect-flex ect-items-center ect-gap-3"},cl={class:"ect-text-xl ect-font-semibold ect-text-gray-700 ect-leading-relaxed"},dl={key:0,class:"ect-flex ect-gap-1.5 ect-items-center"},ul=e.createElementVNode("span",{class:"ect-text-sm ect-text-gray-700 ect-leading-relaxed"},"Saving configuration...",-1),fl={key:1,class:"ect-flex ect-gap-1.5 ect-items-center"},hl=e.createElementVNode("span",{class:"ect-text-sm ect-text-gray-700 ect-leading-relaxed"},"Configuration Saved Successfully",-1),pl={key:1,class:"ect-flex ect-flex-col ect-gap-4 ect-flex-1 ect-overflow-y-auto ect-mb-16"},ml=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),gl={class:"ect-flex ect-flex-col ect-gap-4 ect-p-4 ect-pt-0 ect-overflow-y-auto"},yl=["data-test-id"],bl={class:"ect-flex-1 ect-flex ect-flex-col ect-gap-2"},_l={class:"ect-text-sm ect-font-semibold ect-text-gray-800 ect-leading-tight"},vl={class:"ect-text-sm ect-font-medium ect-text-gray-600 ect-leading-relaxed ect-line-clamp-2"},Cl={class:"ect-flex ect-flex-row ect-justify-between ect-items-center"},El={class:"ect-text-sm ect-font-semibold ect-text-gray-800"},kl={key:2,class:"ect-flex ect-flex-col ect-gap-4 ect-m-4 ect-flex-1 ect-overflow-y-auto"},wl=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),Nl={class:"ect-flex ect-flex-col ect-gap-4"},xl=["data-test-id","onClick"],Ol={class:"ect-flex ect-items-center ect-justify-center"},Sl={class:"ect-flex ect-flex-col ect-items-center ect-gap-2 ect-w-full"},Vl=["data-test-id"],Tl=["data-test-id"],Al={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"},Il={class:"ect-flex ect-flex-col ect-gap-4"},Bl={class:"ect-text-lg ect-font-semibold ect-text-gray-700 ect-leading-relaxed ect-p-4 ect-pb-0"},Ll={class:"ect-flex ect-flex-col ect-gap-4 ect-p-4 ect-pt-0 ect-overflow-y-auto"},Ml={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"},Rl={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"},ql={class:"ect-text-sm ect-font-medium ect-text-gray-600 ect-leading-relaxed ect-line-clamp-2"},Dl={class:"ect-flex ect-flex-row ect-justify-between ect-items-center"},jl={class:"ect-text-sm ect-font-semibold ect-text-gray-800"},$l={__name:"ConfiguratorRecommend",setup(t){const i=Ye(),n=ut(),r=ln(),o=e.computed(()=>i.configuration),a=e.ref(!0),c=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"}]),p=e.ref(null),v=e.ref([]),u=async f=>{f.loading=!0,await i.createQuoteProducts(f),f.disabled=!0,f.loading=!1},m=f=>{f.action==="backToConfiguration"?i.savedScreen=!1:f.action==="backToQuoteList"?r.push("/quote-item?id="+n.quoteId):f.link&&r.push(f.link)};async function l(){i.resetConfigurator(),r.push({path:"/configurator/"+p.value.XX_ORD1__Item__c+"/"+p.value.Id}),i.initConfigurator(p.value.XX_ORD1__Item__c,p.value.Id)}return e.onBeforeMount(async()=>{a.value=!0,await i.getProductCrossSells(),a.value=!1}),(f,h)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",ll,[e.createElementVNode("div",sl,[e.createVNode(we,{icon:"arrow",symbol:"",size:12,onClick:h[0]||(h[0]=d=>e.unref(i).savedScreen=!1)}),e.createElementVNode("h2",cl,e.toDisplayString(o.value.itemName),1)]),e.unref(i).loading.save?(e.openBlock(),e.createElementBlock("div",dl,[e.createVNode(so,{svg:""}),ul])):(e.openBlock(),e.createElementBlock("div",fl,[e.createVNode(we,{icon:"check",color:"#136E05",size:14,"data-test-id":"item-tabs-before-button-icon"}),hl]))]),a.value?(e.openBlock(),e.createBlock(lo,{key:0,type:"recommendations",rows:4})):v.value.length>0?(e.openBlock(),e.createElementBlock("div",pl,[ml,e.createElementVNode("div",gl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,(d,s)=>(e.openBlock(),e.createElementBlock("div",{key:d.Id||s,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-${d.Id||s}`},[e.createElementVNode("div",bl,[e.createElementVNode("h4",_l,e.toDisplayString(d.Name),1),e.createElementVNode("p",vl,e.toDisplayString(d.Description),1)]),e.createElementVNode("div",Cl,[e.createElementVNode("div",El,e.toDisplayString(e.unref(He)(d.Price)),1),e.createVNode(Ze,{btype:d.disabled?"secondary":"primary","button-style":d.disabled?"normal":"outlined",size:"medium",class:e.normalizeClass({"ect-w-[120px]":d.loading}),loading:d.loading,disabled:d.disabled||d.loading,"data-test-id":`configurator-recommend-button-add-${d.Id||s}`,onClick:g=>u(d)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.loading?"":d.disabled?"Added to Quote":"Add to Quote"),1)]),_:2},1032,["btype","button-style","class","loading","disabled","data-test-id","onClick"])])],8,yl))),128))])])):(e.openBlock(),e.createElementBlock("div",kl,[wl,e.createElementVNode("div",Nl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(d,s)=>(e.openBlock(),e.createElementBlock("div",{key:d.title||s,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-${s}`,onClick:g=>m(d)},[e.createElementVNode("div",Ol,[e.createVNode(we,{icon:d.icon,size:20,color:"#000000","data-test-id":`configurator-recommend-redirect-icon-${s}`},null,8,["icon","data-test-id"])]),e.createElementVNode("div",Sl,[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-${s}`},e.toDisplayString(d.title),9,Vl),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-${s}`},e.toDisplayString(d.description),9,Tl)])],8,xl))),128))])])),p.value?(e.openBlock(),e.createElementBlock("footer",Al,[e.createElementVNode("div",Il,[e.createElementVNode("h3",Bl," Configuere next product from your quote "+e.toDisplayString(c.value),1),e.createElementVNode("div",Ll,[e.createElementVNode("div",Ml,[e.createElementVNode("div",Rl,[e.createElementVNode("h4",Pl,e.toDisplayString(p.value.Name),1),e.createElementVNode("p",ql,e.toDisplayString(p.value.Description),1)]),e.createElementVNode("div",Dl,[e.createElementVNode("div",jl,e.toDisplayString(e.unref(He)(p.value.Price)),1),e.createVNode(Ze,{btype:"primary","button-style":"filled",size:"medium","data-test-id":"configurator-recommend-button-add-next-product",onClick:l},{default:e.withCtx(()=>[e.createTextVNode(" Configure Now ")]),_:1})])])])])])):e.createCommentVNode("",!0)],64))}},Fl=["data-test-id"],Hl=Ee({__name:"AppPill",props:{variant:{type:String,default:"",validator:t=>["success","error",""].includes(t)},dataTestId:{type:String,default:""}},setup(t){return(i,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(i.$slots,"default",{},void 0,!0)],10,Fl))}},[["__scopeId","data-v-c7f05fa0"]]),Ul=["data-test-id"],zl=["data-test-id"],Kl=["data-test-id","onClick"],Zl=["data-test-id"],Ql=Ee({__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(i=>typeof i=="object"&&i.title&&i.key&&(i.sections===void 0||Array.isArray(i.sections)))},dataTestId:{type:String,required:!0}},emits:["update:modelValue","tab-change"],setup(t,{emit:i}){const n=t,r=i,o=e.computed(()=>{var c;return n.modelValue||((c=n.tabs[0])==null?void 0:c.key)||""}),a=c=>{r("update:modelValue",c),r("tab-change",c)};return(c,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,p=>(e.openBlock(),e.createElementBlock("button",{key:p.key,class:e.normalizeClass(["ect-page-tab-button",`ect-page-tab-button${o.value===p.key?"-active":""} ${p.tabClass||""}`]),"data-test-id":`${t.dataTestId}-tab-${p.key}`,onClick:v=>a(p.key)},[e.createTextVNode(e.toDisplayString(p.title)+" ",1),p.pill!==void 0&&p.pill!==null?(e.openBlock(),e.createBlock(Hl,{key:0,class:"ect-ml-2",variant:p.pillStyle,"data-test-id":`${t.dataTestId}-tab-${p.key}-pill`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.pill),1)]),_:2},1032,["variant","data-test-id"])):e.createCommentVNode("",!0)],10,Kl))),128))],10,zl)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"ect-page-tab-content","data-test-id":`${t.dataTestId}-content`},null,8,Zl)],8,Ul))}},[["__scopeId","data-v-f22cb1ed"]]),Jl=["data-test-id"],Xl=["disabled","data-test-id"],Gl=["value","disabled","data-test-id"],Wl=["disabled","data-test-id"],dn={__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:i}){const n=t,r=i,o=e.computed(()=>n.min==null?0:n.min),a=e.computed(()=>n.max==null?999:n.max),c=(y,E,T)=>Math.min(Math.max(y,E),T),b=y=>{if(y==null||y==="")return NaN;const E=Number(y);return Number.isFinite(E)?E:NaN},p=e.ref(null),v=e.ref(n.value??o.value),u=y=>{v.value=c(y,o.value,a.value)};n.value!==null&&u(n.value);const m=e.computed(()=>v.value),l=e.computed(()=>p.value!=null?p.value:String(m.value)),f=e.computed(()=>n.disabled||m.value<=o.value),h=e.computed(()=>n.disabled||m.value>=a.value);function d(y){y!==n.value&&(v.value=y,r("update:value",y),r("change",y))}function s(){if(f.value)return;const y=c(m.value-1,o.value,a.value);p.value=null,d(y)}function g(){if(h.value)return;const y=c(m.value+1,o.value,a.value);p.value=null,d(y)}function _(y){const T=String(y.target.value??"").replace(/\D+/g,"");p.value=T}function C(){const y=b(p.value),E=o.value,T=c(Number.isNaN(y)?E:y,o.value,a.value);p.value=null,d(T)}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":f.value,"ect-cursor-not-allowed":f.value}]),disabled:f.value,"data-test-id":`${t.dataTestId}-decrement`,onClick:s}," - ",10,Xl),e.createElementVNode("input",{type:"text",inputmode:"numeric",pattern:"[0-9]*",value:t.empty?"":l.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,Gl),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":h.value,"ect-cursor-not-allowed":h.value}]),disabled:h.value,"data-test-id":`${t.dataTestId}-increment`,onClick:g}," + ",10,Wl)],8,Jl))}},Yl={class:"ect-flex ect-justify-end ect-items-center ect-gap-2.5 ect-px-6 ect-py-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"},es={"data-test-id":"configurator-footer-quantity"},ts={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"},ns=["data-test-id"],rs=["data-test-id"],os=["data-test-id"],is=["data-test-id"],as={__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:i}){const n=Ye(),r=t,o=e.ref(r.item),a=e.computed(()=>{const p=n.summaryPrices,v=[];return n.isRecurringPricingSchema?(v.push({label:"One Time Price",value:p.oneTimePrice,highlight:!1}),v.push({label:n.showYearlyPricing?"Yearly Price":"Monthly Price",value:p.recurringPrice,highlight:!1})):(v.push({label:"Base Price",value:p.basePrice,highlight:!1}),v.push({label:"Add Ons",value:p.addOns,highlight:!1}),v.push({label:"Total Price",value:p.total,highlight:!1})),v}),c=i,b=()=>{r.disabled||c("continue")};return(p,v)=>(e.openBlock(),e.createElementBlock("footer",Yl,[e.createElementVNode("div",es,[e.createVNode(dn,{value:o.value.qty,"onUpdate:value":v[0]||(v[0]=u=>o.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",ts,[(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,rs),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(e.unref(He)(u.value)),11,os)],8,ns),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,is)):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"])]))}},ls={class:"ect-w-full ect-bg-white ect-mb-4","data-test-id":"configurator-type-section"},ss={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"},cs={class:"ect-flex ect-flex-col"},ds={class:"ect-font-bold ect-text-text-success ect-leading-tight"},us=["innerHTML"],fs={key:0,class:"ect-flex ect-items-center ect-gap-2 ect-px-2 ect-py-1","data-test-id":"configurator-type-message"},hs={class:"ect-text-xs ect-font-medium ect-text-gray-600 ect-leading-tight ect-min-w-[190px]"},ps={class:"ect-divide-y ect-divide-gray-100 ect-overflow-y-auto"},ms={__name:"ConfiguratorType",props:{title:{type:String,required:!0},description:{type:String,default:""},message:{type:String,default:""}},setup(t){return(i,n)=>(e.openBlock(),e.createElementBlock("section",ls,[e.createElementVNode("header",ss,[e.createElementVNode("div",cs,[e.createElementVNode("h2",ds,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,us)):e.createCommentVNode("",!0)]),t.message?(e.openBlock(),e.createElementBlock("div",fs,[e.createVNode(we,{icon:"info",symbol:"",color:"#198708",size:14,"data-test-id":"configurator-type-message-icon"}),e.createElementVNode("span",hs,e.toDisplayString(t.message),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",ps,[e.renderSlot(i.$slots,"default")])]))}},gs={__name:"ShadowDisplay",props:{content:{type:String,required:!0}},setup(t){const i=t,n=e.ref(null);let r=null;return e.onMounted(()=>{n.value&&!r&&(r=n.value.attachShadow({mode:"open"}),r.innerHTML=i.content)}),e.watch(()=>i.content,o=>{r&&(r.innerHTML=o)}),(o,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"host",ref:n},null,512))}},ys=["data-test-id"],bs=["data-test-id"],_s=["data-test-id"],vs=[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)],Cs=["data-test-id"],Es=["data-test-id"],ks=["data-test-id"],ws=["data-test-id"],Ns=["data-test-id"],xs=["data-test-id","innerHTML"],et={__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 i=t,n=e.computed(()=>{const r=i.value;if(typeof r!="string")return!1;const o=new DOMParser().parseFromString(r,"text/html");return Array.from(o.body.childNodes).some(a=>a.nodeType===1)});return(r,o)=>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`},vs,8,_s),e.createTextVNode(" "+e.toDisplayString(t.label),1)],8,bs)],8,ys)):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,Es)],8,Cs)):(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,ws),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,Ns)):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createBlock(gs,{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,xs)):e.createCommentVNode("",!0)],8,ks))}},Os=["data-test-id"],Ss=["data-test-id"],Vs=["data-test-id"],Ts=["type","step","min","data-test-id"],Zn=Ee({__name:"InputEdit",props:{modelValue:{type:[String,Number],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:i,emit:n}){const r=t,o=n,a=e.ref(!1),c=e.ref(!1),b=e.ref(""),p=e.ref(null),v=e.computed(()=>r.type==="currency"?g(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),l=e.computed(()=>r.type==="currency"?"0":void 0),f=()=>{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(()=>{p.value&&(p.value.focus(),p.value.select())}))},h=()=>{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&&(o("update:modelValue",C),o("change",C)),a.value=!1},d=()=>{b.value=r.modelValue,a.value=!1},s=()=>{a.value&&h()},g=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)}),i({startEditing:f,saveChanges:h,cancelEditing:d}),(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]=T=>c.value=!0),onMouseleave:y[2]||(y[2]=T=>c.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:p,"onUpdate:modelValue":y[0]||(y[0]=T=>b.value=T),type:u.value,step:m.value,min:l.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(h,["enter"]),e.withKeys(d,["esc"])],onBlur:h},null,42,Ts),[[e.vModelDynamic,b.value]])],8,Vs)),[[E,s]]):(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:f},[(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(c.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,Ss))],40,Os)}}},[["__scopeId","data-v-5cd60070"]]),As=["data-test-id","data-publish-key"],Is={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"},Bs={key:1,class:"ect-flex ect-items-start ect-gap-4 ect-p-3 ect-px-4"},Ls={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"},Ms=["src","alt"],Rs={class:"ect-flex-1 ect-min-w-0"},Ps={class:"ect-flex ect-gap-4 ect-items-center ect-justify-between"},qs={class:"ect-flex ect-flex-row ect-gap-3"},Ds=e.createElementVNode("div",{class:"ect-w-px ect-h-auto ect-bg-gray-200 ect-mx-2"},null,-1),js={class:"ect-flex ect-flex-col ect-max-w-[125px]"},$s={class:"ect-flex ect-items-start ect-justify-center ect-ml-2 ect-mt-0"},Fs=["innerHTML"],Hs={key:0,class:"ect-flex ect-flex-wrap ect-gap-2.5 ect-mt-2"},Us=["data-test-id"],zs=["data-test-id"],Ks={key:1,class:"ect-inline-block ect-mb-2"},Zs={key:2,class:"ect-flex ect-flex-col ect-gap-3 ect-p-3 ect-h-full ect-justify-between"},Qs={class:"ect-flex ect-items-start ect-gap-2"},Js={key:0,class:"ect-w-16 ect-h-16 ect-rounded-lg ect-bg-gray-200 ect-flex-shrink-0 ect-overflow-hidden"},Xs=["src","alt"],Gs={class:"ect-flex-1 ect-min-w-0"},Ws={class:"ect-text-sm ect-font-semibold ect-text-gray-900 ect-leading-tight"},Ys=["innerHTML"],ec={class:"ect-flex ect-items-start ect-justify-center ect-ml-2 ect-mt-0"},tc={key:0,class:"ect-flex ect-flex-wrap ect-gap-1.5"},nc=["data-test-id"],rc=["data-test-id"],oc={key:1,class:"ect-inline-block ect-mb-2"},ic={class:"ect-flex ect-justify-between ect-items-center"},ac={class:"ect-flex ect-flex-col"},lc=e.createElementVNode("p",{class:"ect-text-xs ect-text-gray-500 ect-font-medium ect-leading-tight"},"Price",-1),sc={key:3,"data-test-id":"configurator-item-slot-details",class:"ect-bg-white ect-rounded-md"},cc={__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:i}){const n=t,r=i,o=e.ref(null),a=e.ref(0),c=e.ref(n.item),b=e.computed(()=>c.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"),p=e.computed({get:()=>n.quantity,set:h=>r("update:quantity",h)}),v=e.computed({get:()=>n.name,set:h=>r("update:name",h)}),u=h=>{r("update:quantity",h)},m=e.computed(()=>{if(a.value===0)return n.tags;const d=Math.floor(a.value/120);return n.tags.slice(0,Math.max(1,d))}),l=e.computed(()=>Math.max(0,n.tags.length-m.value.length)),f=()=>{if(o.value){const h=o.value,d=80,s=120,g=32,_=64;a.value=h.offsetWidth-d-s-g-_}};return e.onMounted(()=>{e.nextTick(()=>{f()})}),e.watch(()=>n.tags,()=>{e.nextTick(()=>{f()})},{deep:!0}),e.onMounted(()=>{window.addEventListener("resize",f)}),(h,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"containerRef",ref:o,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",Is," KIT ")):e.createCommentVNode("",!0),t.size===1?(e.openBlock(),e.createElementBlock("div",Bs,[t.showImage?(e.openBlock(),e.createElementBlock("div",Ls,[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,Ms)):(e.openBlock(),e.createBlock(we,{key:1,disabled:"",icon:"image",symbol:"",size:20,color:"#ACACAC"}))])):e.createCommentVNode("",!0),e.createElementVNode("div",Rs,[e.createElementVNode("div",Ps,[e.createVNode(Zn,{modelValue:v.value,"onUpdate:modelValue":d[0]||(d[0]=s=>v.value=s),tag:"h3","data-test-id":"itemId"+t.item.itemId,class:"ect-text-sm ect-font-semibold ect-text-gray-900 ect-leading-tight"},null,8,["modelValue","data-test-id"]),e.createElementVNode("div",qs,[e.createElementVNode("div",{onClick:d[2]||(d[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(dn,{value:p.value,"onUpdate:value":d[1]||(d[1]=s=>p.value=s),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"])]),Ds,e.createElementVNode("div",js,[e.createVNode(Zn,{modelValue:c.value.price,"onUpdate:modelValue":d[3]||(d[3]=s=>c.value.price=s),tag:"p",type:"currency","data-test-id":"itemId"+t.item.itemId,class:"ect-text-base ect-font-bold"},null,8,["modelValue","data-test-id"])]),e.createElementVNode("div",$s,[e.renderSlot(h.$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,Fs),t.isAttributes&&t.showAttributes&&t.selected?(e.openBlock(),e.createElementBlock("div",Hs,[c.value.getTags().length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(s,g)=>(e.openBlock(),e.createElementBlock("span",{key:g,class:"ect-inline-block"},[e.createVNode(et,{label:s.label,value:s.value},null,8,["label","value"])]))),128)),l.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:d[4]||(d[4]=e.withModifiers(()=>{},["stop"]))}," +"+e.toDisplayString(l.value)+" more ",9,Us)):e.createCommentVNode("",!0),t.selected?(e.openBlock(),e.createElementBlock("button",{key:1,"data-test-id":`configurator-item-button-edit-attributes-${t.item.itemId}`,onClick:d[5]||(d[5]=s=>r("edit-attributes"))},[e.createVNode(et,{label:"Edit attributes","edit-button":""})],8,zs)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock("span",Ks,[e.createElementVNode("button",{"data-test-id":"configurator-info-button-add-attributes",onClick:d[6]||(d[6]=s=>r("edit-attributes"))},[e.createVNode(et,{label:"Add attributes","add-button":""})])]))])):e.createCommentVNode("",!0)])])):(e.openBlock(),e.createElementBlock("div",Zs,[e.createElementVNode("div",Qs,[t.showImage?(e.openBlock(),e.createElementBlock("div",Js,[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.createCommentVNode("",!0),e.createElementVNode("div",Gs,[e.createElementVNode("h3",Ws,e.toDisplayString(t.name),1),e.createElementVNode("p",{class:"ect-mt-1 ect-text-sm ect-text-gray-700 ect-leading-tight",innerHTML:t.description},null,8,Ys)]),e.createElementVNode("div",ec,[e.renderSlot(h.$slots,"selection-control")])]),t.isAttributes&&t.showAttributes&&t.selected?(e.openBlock(),e.createElementBlock("div",tc,[c.value.getTags().length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(s,g)=>(e.openBlock(),e.createElementBlock("span",{key:g,class:"ect-inline-block"},[e.createVNode(et,{label:s.label,value:s.value},null,8,["label","value"])]))),128)),l.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:d[7]||(d[7]=e.withModifiers(()=>{},["stop"]))}," +"+e.toDisplayString(l.value)+" more ",9,nc)):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:d[8]||(d[8]=s=>r("edit-attributes"))},[e.createVNode(et,{label:"Edit attributes","edit-button":""})],8,rc)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock("span",oc,[e.createElementVNode("button",{"data-test-id":"configurator-info-button-add-attributes",onClick:d[9]||(d[9]=s=>r("edit-attributes"))},[e.createVNode(et,{label:"Add attributes","add-button":""})])]))])):e.createCommentVNode("",!0),e.createElementVNode("div",ic,[e.createElementVNode("div",{onClick:d[11]||(d[11]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(dn,{value:p.value,"onUpdate:value":d[10]||(d[10]=s=>p.value=s),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",ac,[lc,e.createVNode(Zn,{modelValue:c.value.price,"onUpdate:modelValue":d[12]||(d[12]=s=>c.value.price=s),tag:"p",type:"currency","data-test-id":"itemId"+t.item.itemId,class:"ect-w-[125px] ect-text-base ect-font-bold"},null,8,["modelValue","data-test-id"])])])])),t.selected&&t.isAttributes?(e.openBlock(),e.createElementBlock("div",sc,[e.renderSlot(h.$slots,"default")])):e.createCommentVNode("",!0)],10,As))}},dc={"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":"."},uc={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"?dc[this.locale]:"."},methods:{handlerInput(t){const i=t.target.value;this.type==="currency"?this.$emit("update:modelValue",i.replace(this.decimalSeprator,".")):this.$emit("update:modelValue",i)},preventNonNumeric(t){if(this.type==="number"){const i=this.decimalPrecision,n=t.target.value,r=t.key;if(["Backspace","ArrowLeft","ArrowRight","Delete","Tab"].includes(r)||this.allowNegatives&&r==="-")return;if(r==="."&&i===0){t.preventDefault();return}if(r==="."&&n.includes(".")){t.preventDefault();return}if(r==="."||n.includes(".")&&!n.endsWith(".")&&r!=="Backspace"){const o=n.split(".");if(o.length>1&&o[1].length>=i){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)}}},fc=["data-test-id"],hc=["for","data-test-id"],pc=["data-test-id"],mc=["id","type","name","disabled","placeholder","value","maxlength","readonly","data-test-id"],gc=["data-test-id"],yc=["data-test-id"];function bc(t,i,n,r,o,a){const c=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,hc)):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(c,{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:i[0]||(i[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:i[1]||(i[1]=(...b)=>a.handlerInput&&a.handlerInput(...b)),onKeydown:i[2]||(i[2]=(...b)=>a.preventNonNumeric&&a.preventNonNumeric(...b)),onKeyup:i[3]||(i[3]=(...b)=>a.handlerKeyup&&a.handlerKeyup(...b)),onBlur:i[4]||(i[4]=b=>t.$emit("blur"))},null,46,mc)],10,pc)):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,gc)),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,yc)):e.createCommentVNode("",!0)],8,fc)}const _c=Ee(uc,[["render",bc],["__scopeId","data-v-032ca141"]]),vc={name:"AtomSpinner",props:{dataTestId:{type:String,default:""}}},Cc=["data-test-id"];function Ec(t,i,n,r,o,a){return e.openBlock(),e.createElementBlock("div",{class:"spinner","data-test-id":n.dataTestId},null,8,Cc)}const kc={name:"CustomDropdown",components:{AppIcon:we,AtomSpinner:Ee(vc,[["render",Ec],["__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(i=>JSON.stringify(i).toLowerCase().includes(t))}else return this.options},getSelected(){let t=null;if(this.modelValue)t=this.options.find(i=>i[this.property.key]===this.modelValue);else if(!this.search){const i=this.options.find(n=>n[this.property.key]==="");i?t=i: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(),i=250,n=window.innerHeight-t.bottom,r=t.top;return n<i&&r>i},dropdownStyle(){if(!this.$refs.triggerElement)return{};const t=this.$refs.triggerElement.getBoundingClientRect(),i=250,n=window.innerHeight-t.bottom,r=t.top,o=n<i&&r>i;return{position:"absolute",top:o?"auto":"100%",bottom:o?"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(),i=200,n=window.innerHeight-t.bottom,r=t.top,o=n<i&&r>i;this.teleportStyle={position:"absolute",top:`${o?t.top-i:t.bottom}px`,left:`${t.left}px`,width:`${t.width}px`,zIndex:9999}},subFieldsText(t){if(!this.display||this.display.length<1)return"";const i=[];return this.display.forEach(n=>{const r=this.subField(t,n);r&&i.push(r)}),i.join(" | ")},subField(t,i){return i?i.split(".").reduce((o,a)=>o[a]||"",t):t},lookupSearchHandler:ro(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--}}},wc=["data-test-id"],Nc=["for","data-test-id"],xc={class:"input-container-box ect-grow ect-w-full"},Oc=["data-test-id"],Sc=["placeholder","disabled","data-test-id"],Vc=["data-test-id"],Tc=["title","data-test-id"],Ac=["data-test-id"],Ic=["data-test-id"],Bc=["data-test-id"],Lc=["data-test-id"],Mc=["data-test-id","onClick"],Rc=["data-test-id"],Pc={class:"ect-text-font-clr-light ect-flex ect-gap-2 ect-items-center ect-justify-between ect-w-full"},qc=["data-test-id"],Dc=["data-test-id"],jc=["data-test-id"],$c=["title","data-test-id"],Fc=["data-test-id"];function Hc(t,i,n,r,o,a){const c=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:i[7]||(i[7]=p=>t.isHover=!0),onMouseleave:i[8]||(i[8]=p=>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,Nc)):e.createCommentVNode("",!0),e.createElementVNode("div",xc,[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:i[2]||(i[2]=(...p)=>a.handlerFocusIn&&a.handlerFocusIn(...p)),onFocusout:i[3]||(i[3]=p=>a.onInputFocusedOut(!1)),onKeydown:[i[4]||(i[4]=e.withKeys(p=>a.updateSelected(n.options[t.highlightedIndex]),["enter"])),i[5]||(i[5]=e.withKeys(e.withModifiers((...p)=>a.highlightPreviousOption&&a.highlightPreviousOption(...p),["prevent"]),["up"])),i[6]||(i[6]=e.withKeys(e.withModifiers((...p)=>a.highlightNextOption&&a.highlightNextOption(...p),["prevent"]),["down"]))]},[!n.modelValue&&n.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref:"searchInput","onUpdate:modelValue":i[0]||(i[0]=p=>t.value=p),type:"text",name:"search",placeholder:n.placeholder,autocomplete:"off",disabled:n.disabled,"data-test-id":`${n.dataTestId}-search-input`,onInput:i[1]||(i[1]=e.withModifiers(p=>a.lookupSearchHandler(p.target.value),["prevent"]))},null,40,Sc)),[[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(c,{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,Tc),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,Ac)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],10,Vc)),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(c,{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(c,{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,Ic))],64)):(e.openBlock(),e.createBlock(c,{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,Oc),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,Bc)):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,(p,v)=>(e.openBlock(),e.createElementBlock("div",{key:p[n.property.key],class:e.normalizeClass(["dropdown-item",{highlighted:v===t.highlightedIndex,"ect-pointer-events-none":p[n.property.assigned]}]),"data-test-id":`${n.dataTestId}-option-${v}`,onClick:u=>a.updateSelected(p)},[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":p[n.property.assigned]}),"data-test-id":`${n.dataTestId}-option-${v}-value`},e.toDisplayString(p[n.property.value]==null?"Key and Value is Wrong":p[n.property.value]),11,qc),p[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,Dc)):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(p[n.badge]),9,jc)):e.createCommentVNode("",!0)],8,Rc),e.createElementVNode("div",{class:"info",title:a.subFieldsText(p),"data-test-id":`${n.dataTestId}-option-${v}-info`},[e.createElementVNode("span",null,e.toDisplayString(a.subFieldsText(p)),1)],8,$c)],10,Mc))),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,Fc)):e.createCommentVNode("",!0)],14,Lc)):e.createCommentVNode("",!0)])],42,wc)}const yo=Ee(kc,[["render",Hc],["__scopeId","data-v-5ae4f6dc"]]);var Oe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _o={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 $a=Symbol(process.env.NODE_ENV!=="production"?"router":""),Fa=Symbol(process.env.NODE_ENV!=="production"?"route location":"");Symbol(process.env.NODE_ENV!=="production"?"router view location":"");function ln(){return e.inject($a)}function ho(){return e.inject(Fa)}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 Kn={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"},po={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"},Ha=t=>{var n;let i=[];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 c=((n=Kn[a==null?void 0:a.toLowerCase()])==null?void 0:n.trim())||"";c&&(i.includes(c)||i.push(c||""),i.push(r))}else i.includes(Kn[r==null?void 0:r.toLowerCase()])||i.push(Kn[r==null?void 0:r.toLowerCase()]||"");return i.filter(r=>r!=="")},Ua=Ke.defineStore("actions",()=>{const t=sn(),i=ut(),n=e.ref(!1);return{openAdaptiveSearch:(b,p=!1)=>{console.info("openAdaptiveSearch",b),t.chatHistory[t.chatHistory.length-1].links=[],t.sendMessage("Open Adaptive Search",!1,{internalCall:!0}),n.value=p},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=${i.quoteId}&atpverified=true&ecCache=false&origin=AI`;window.location.href=`${na(window.location.href)}${v}`},undo:()=>{const b=t==null?void 0:t.latestDMLRequest;t.sendMessage(`UNDO-${b}`,!1,{internalCall:!0})},isStaticActionCall:n}}),mo=Ke.defineStore("adaptiveSearch",()=>{const t=ut(),i=Rt(),n=sn(),r=Ua(),o=e.ref(null),a=e.ref(null),c=e.ref(!1),b=e.ref(!1),p=e.ref([]),v=e.ref(""),u=e.ref(!1),m=e.ref(null),l=e.ref(!1),f=e.ref([]),h=at(),d=e.ref([]),s=e.ref(0),g=e.ref(!1),_=e.ref({rowLimt:10,paging:!0,offset:0,currentPage:1,totalPages:1});async function C(){c.value=!0;try{const x=JSON.stringify({layoutType:"Search Selection",layoutObject:"xx_ord1__ecatalog_item__c"});let B={};return B=await window.salesforceConnector.getDynamicPageLayout(x),a.value=ao(B,"Unable to find the Search Selection Layout for your user profile"),_.value.rowLimt=a.value.configuration.rowLimit||10,a.value.configuration.columns.forEach(R=>{!R.field&&R.label==="QTY"&&(R.field="xx_ord1__qty__c")}),c.value=!1,y(),B}catch(x){c.value=!1,h.handleError("Failed to get Adaptive Search Layout. Please try again."),console.info("[ERROR]: getAdaptiveSearchLayout() error = ",x)}}function y(){var x,B,R;m.value=(R=(B=(x=a.value)==null?void 0:x.configuration)==null?void 0:B.dynamicFilters)==null?void 0:R.filters.map(U=>({...U,field:U.field.toLowerCase(),filtervalue:U.filtervalue||[],filtervaluefrom:U.filtervaluefrom||"",filtervalueTo:U.filtervalueTo||""}))}function E(){var B;let x=[];for(const R of a.value.configuration.columns){let U=R.field;if(x.includes(U)||x.push(U),U!=null&&U.includes(".")){let A=U.split(".")[0];A=A.slice(0,-1)+"c",x.includes(A)||x.push(A)}}return(B=a.value.configuration)!=null&&B.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(R=>!!R),x.filter(R=>R.toLowerCase()!=="xx_ord1__qty__c"&&R.toLowerCase()!=="xx_ord1__competitor_sku__c")}function T(x,B=!1){if(!x||x.includes("undefined"))return!1;const R=/[!@#$%^&*()+=[\]{};':"\\|.<>/?]+/;if(B){const U=Array.isArray(x)?x:x.split(",");for(const z of U){const A=z.trim();if(R.test(A))return h.handleError(`Invalid character found in value: ${A}`),!1}}else if(R.test(x))return h.handleError("Special characters are not allowed in filter values"),!1;return!0}function O(x,B){return{field:x.field,operator:x.operator||"contains",value:B,dataType:x.dataType.trim()}}function V(x){if(!x.filtervalue)return null;const B=Array.isArray(x.filtervalue),R=B?x.filtervalue.join(","):x.filtervalue.trim();return T(R,B)?R:null}function I(x){var z,A;const B=(z=x.filtervaluefrom)==null?void 0:z.trim(),R=(A=x.filtervalueTo)==null?void 0:A.trim();if(!B||!R)return null;const U=`${B}, ${R}`;return U!==", "&&T(U)?U:null}function S(x){const B=`${io(x.filtervaluefrom)}, ${io(x.filtervalueTo)}`;return B!==", "&&T(B)?B:null}function w(x){var R;const B=(R=x.filtervaluefrom)==null?void 0:R.trim();return T(B)?B:null}function N(x){const B=[];return x.forEach(R=>{const U=R.dataType.trim();let z=null;switch(U){case"PICKLIST":case"MULTIPICKLIST":z=V(R);break;case"DOUBLE":case"CURRENCY":z=I(R);break;case"DATETIME":case"DATE":z=S(R);break;default:z=w(R)}z&&B.push(O(R,z))}),f.value=B,B}async function L(x="",B=[],R=[]){var z,A,P,F,M,j,K,G,oe,ie;let U=[];if(B.length&&(U=N(B)),!U.length&&x.trim()===""){p.value=[],u.value=!1;return}try{u.value=!1,b.value=!0;const se=x.trim();R.length||(R=E());const ye={fields:R,...B.length?{dynamicFilters:U}:{},searchText:se||v.value.trim(),accountId:i.accountId,...i.eCatalogId?{catalogId:i.eCatalogId}:{},...i.objectType==="opportunity"?{opportunityId:i.id}:{},...(A=(z=a.value)==null?void 0:z.configuration)!=null&&A.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:(F=(P=a.value)==null?void 0:P.configuration)==null?void 0:F.rowLimit,paging:(j=(M=a.value)==null?void 0:M.configuration)==null?void 0:j.paging,...((K=_.value)==null?void 0:K.offset)!==0?{offset:_.value.offset}:{},objectName:(oe=(G=a.value)==null?void 0:G.configuration)==null?void 0:oe.objectName,currencyCode:i.currencyCode},de=await window.salesforceConnector.getItems(JSON.stringify(ye));if(de!=null&&de.errorMessage){h.handleError(de.errorMessage);return}de!=null&&de.itemCount&&(_.value.totalPages=Math.ceil((de==null?void 0:de.itemCount)/_.value.rowLimt)),p.value=on(de.lstItems,{xx_ord1__qty__c:"1"}),(ie=de.lstItems)!=null&&ie.length||(u.value=!0),b.value=!1}catch(se){h.handleError("Failed to fetch Results. Please try again."),b.value=!1,console.info("[ERROR]: Adaptive Search getItems() error = ",se)}}async function $(x){try{l.value=!0;const B=JSON.stringify({lstQLIRequest:H(x),quoteId:t.quoteId});let R=await window.salesforceConnector.createQLI(B);typeof R=="string"&&(R=JSON.parse(R));let U=!1;if((R==null?void 0:R.length)>0&&R.forEach(z=>{z.errorMessage&&(U=!0,h.handleError(z.errorMessage))}),l.value=!1,U){d.value=R;const z=d.value.reduce((A,P)=>(A[P.eCatalogItemId]=P.errorMessage,A),{});p.value=p.value.map(A=>({...A,backendError:z[A.Id]||""}));return}return R}catch(B){h.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addToQuote() error = ",B)}}function H(x){const B=[];for(const R of x)if(!R.addedToQuote&&R.id){const U=Q(R);s.value++,B.push({fields:U,recordId:R.id,...x.length===1?{maxSequenceNumber:s.value}:{}})}return B}function Q(x){const B=[],R=X();return Object.keys(x).forEach(U=>{if(R.includes(U)){const z=po[U.toLowerCase()];z&&B.push({fieldname:z,value:x[U]})}}),B}function X(){const x=[];return a.value.configuration.columns.forEach(B=>{B.field&&!B.field.includes(".")&&B.isEditable&&B.visible&&x.push(B.field)}),x}function te(){var B,R;const x=[];return a.value.configuration.columns.forEach(U=>{const z=U.field.toLowerCase();x.includes(z)||x.push(z)}),(B=a.value.configuration)!=null&&B.dynamicFilters&&a.value.configuration.dynamicFilters.filters.forEach(U=>{const z=U.field.toLowerCase();x.includes(z)||x.push(z)}),(R=a.value.configuration)!=null&&R.cardHeader&&x.push(a.value.configuration.cardHeader.imageField),x}async function J(){var R;const x=te(),B=((R=a.value.configuration)==null?void 0:R.saveObjectName)||a.value.configuration.objectName;if(B==="xx_ord1__ecatalog_item__c"){const U=x.indexOf("xx_ord1__qty__c");U>-1&&x.splice(U,1)}await t.getFieldsData(x,B),t.fieldsData.xx_ord1__qty__c||t.getFieldsData(["xx_ord1__qty__c"],"xx_ord1__quote_line_item__c")}async function q({searchTerm:x="",filters:B=[]}={}){if(g.value=!0,x&&(v.value=x),B.length&&(f.value=B),await C()){await J(),g.value=!1;const U=v.value;U&&(v.value=U,await L(U,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"}]})}g.value=!1}return{selectedItem:o,AdaptiveSearchLayout:a,searchText:v,loadingAdaptiveLayout:c,getAdaptiveSearchLayout:C,getItems:L,lstItems:p,rowItemsLoading:b,noSearchRecords:u,dynamicFilters:m,setDynamicFilters:y,createQliErrors:d,addToQuote:$,addingToQuote:l,getFieldsData:J,pagingData:_,appliedDynamicFilters:f,maxSequenceNumber:s,loadingAdaptiveSearch:g,initAdaptiveSearch:q}}),za=Ke.defineStore("quickSelection",()=>{const t=at(),i=Rt(),n=ut(),r=e.ref(null),o=e.ref(!1),a=e.ref([]),c=e.ref([]),b=e.ref(!1),p=e.ref({}),v=e.ref({rowLimit:10,paging:!0,offset:0,currentPage:1,totalPages:1}),u=e.ref(!1);async function m(){o.value=!0;try{const E=JSON.stringify({layoutType:"Quick Selection",layoutObject:"xx_ord1__ecatalog_item__c",...i.objectType?{contextObject:i.objectType}:{}});let T={};T=await window.salesforceConnector.getDynamicPageLayout(E),r.value=ao(T,"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")}),o.value=!1}catch(E){o.value=!1,t.handleError("Failed to get Page structure data. Please try again."),console.info("[ERROR]: getAdaptiveSearchLayout() error = ",E)}}function l(){const E=new Map;return r.value.data.columns.forEach(T=>{E.set(T.field,!0)}),r.value.data.searchResultColumns.forEach(T=>{E.set(T.field,!0)}),Array.from(E.keys())}async function f(E){var T,O;try{let V=await window.salesforceConnector.saveCompetitorSKU(E);if(V!=null&&V.errorMessage){t.handleError(V.errorMessage);return}if((T=V[0])!=null&&T.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 h(E="",T=[]){try{let O=r.value.data,V=r.value.configuration;const I=E.trim();if(console.info("searchTextValue.trim() = ",E.trim()),!I)return[];let S=null;console.info("useMappings = ",u.value),u.value?S=Ha(d()):S=d(),console.info("fields before filter = ",S),S=S.filter($=>$!=="xx_ord1__qty__c"),console.info("fields after filter = ",S);const w={fields:S,...T.length?{dynamicFilters:n.getDynamicFilters(T)}:{},searchText:I,accountId:i.accountId,...i.eCatalogId?{catalogId:i.eCatalogId}:{},...i.objectType==="opportunity"?{opportunityId:i.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:i.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)),on(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 d(){let E=[];for(const T of r.value.data.columns){let O=T.field;if(O!=null&&O.includes(".")){E.includes(O)||E.push(O);let I=O.split(".")[0];I=I.slice(0,-1)+"c",E.includes(I)||E.push(I)}else E.includes(O)||E.push(O)}return console.info("getAllQuickSelectionFields() fields = ",E),E.filter(T=>T.toLowerCase()!=="xx_ord1__qty__c")}async function s(E,T,O,V){console.info("searchText:",JSON.stringify(E)),console.info("row:",JSON.stringify(T)),console.info("rowIndex:",JSON.stringify(O)),console.info("column:",JSON.stringify(V));const I=O+(v.value.currentPage-1)*v.value.rowLimit;if(V.field.toLowerCase().includes("xx_ord1__item__r")){if(a.value[I].itemLookupLoading=!0,u.value=!0,c.value=await h(E),c.value.length>0){const S=[];for(let w=0;w<c.value.length;w++)a.value[I].itemDataRetrieved=!0,c.value[w].xx_ord1__item__c&&S.push({name:c.value[w]["xx_ord1__item__r.name"],value:c.value[w].xx_ord1__item__c,label:c.value[w][V.field.toLowerCase()]});a.value[I][V.field.toLowerCase()+"_options"]=S}a.value[I].itemLookupLoading=!1}else if(V.field.toLowerCase().includes("xx_ord1__competitor_item__r")){a.value[I].competitorLookupLoading=!0;const S=await g(E);S!=null&&S.items&&(a.value[I][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[I].competitorLookupLoading=!1,console.info("getLookupData:: Search Lookup Handler Response = ",S)}}async function g(E){var O,V;console.info("getLookupData() searchText = ",E);const T={searchText:E,obj:"xx_ord1__competitor_item__c",filters:null,displayFields:["xx_ord1__sku__c"]};try{let I=await window.salesforceConnector.getLookupData(JSON.stringify(T));if(typeof I=="string"&&(I=JSON.parse(I)),I!=null&&I.errorMessage){t.handleError(I.errorMessage);return}if((O=I[0])!=null&&O.errorMessage){t.handleError((V=I[0])==null?void 0:V.errorMessage);return}return I}catch(I){t.handleError("Failed to Search For Item. Please try again."),console.info("[ERROR]: getLookupData() error = ",I)}}async function _(E,T){var V;console.info("Update Other Fields Value = ",E),console.info("Update Other Fields Row Index = ",T);const O=T+(v.value.currentPage-1)*v.value.rowLimit;console.info("actualRowIndex = ",O);try{if(E){const I=c.value.filter(S=>S.xx_ord1__item__c===E)[0];if(I){b.value=!0;const S=r.value.data.columns[1].field;a.value[O][S]&&await C(I,O),(V=a.value[O])!=null&&V.itemDataRetrieved&&(a.value[O].status="New Match Requested",a.value[O].noMatchCleared=!0),Object.keys(I).forEach(w=>{const N=po[w.toLowerCase()];console.info("Mapped Key = ",N),N&&(a.value[O][N]=I[w])}),b.value=!1}else a.value[O].status=""}else a.value[O].status="No Match"}catch(I){t.handleError("Unable to request a match for this item please try again."),console.info("Error in updateOtherFields = ",I)}}async function C(E,T){const O=a.value[T],V=r.value.data.columns[1].field,I=[{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 f(JSON.stringify(I));console.info("Match Item: ",JSON.stringify(S)),a.value[T][`${V}_options`]=[{value:S[0].competitorItemId,label:S[0].sku}],a.value[T][V]=S[0].competitorItemId}async function y(E){try{let T=await window.salesforceConnector.createQLI(JSON.stringify(E));typeof T=="string"&&(T=JSON.parse(T));let O=!1;if((T==null?void 0:T.length)>0)for(let V=0;V<T.length;V++)T[V].errorMessage&&(O=!0,T[V].errorMessage.includes("Line Description: data value too large")&&(T[V].errorMessage="Error: The description is too long—it must be under 200 characters."));if(O){T.forEach(V=>{p.value[V.eCatalogItemId]=V});return}else p.value=[];return T}catch(T){t.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addAllItemsToQuote() error = ",T)}}return{quickSelectionLayout:r,quickSelectionLayoutLoading:o,processedRecords:a,useMappings:u,currentSearchData:c,createQliErrors:p,getQuickSelectionLayout:m,getAllFieldsForQuickSelectionLayout:l,saveCompetitorSKU:f,getQuickSelectionItems:h,searchLookupHandler:s,updateOtherFields:_,addAllItemsToQuote:y}}),Ka="Preparing Your Quote Please Wait...",Za={message:"Your quote is ready! Begin adding products to complete it.",type:"response",requestId:"no-request-id"},Qa=18e4,sn=Ke.defineStore("ai",()=>{const t=Rt(),i=ut(),n=mo(),r=za(),o=Ye(),a=ho(),c=e.ref(""),b=e.ref(""),p=e.ref([]),v=e.ref(""),u=e.ref([]),m=e.ref(!1),l=e.ref(null),f=ln(),h=e.ref({}),d=e.ref(null),s=e.ref(null),g=e.ref(null),_=e.ref(null),C=e.ref(null),y=e.ref(Ka),E=e.ref([]),T=e.computed(()=>t.orgId+"__"+t.user.Id+"__"+i.quoteId),O=e.computed(()=>l.value.readyState==WebSocket.OPEN),V=()=>{h.value={salesforceOrgId:t.orgId,salesforceOrgType:t.orgType,salesforceUserId:t.user.Id,userType:"Salesforce",chatRoomId:T.value,requestId:"",prompt:"",initiatedFrom:t.origin||"Quote",internalCall:!1,contextObjectId:i.quoteId,contextObjectType:"Quote",payload:{lineItemsCount:i.lineItemsCount},origin:"Genesis AI",defaultBatchSize:10,actionType:"",packageVersion:t.packageVersion,relatedIds:{eCatalogId:t.eCatalogId,accountId:t.accountId}}};async function I(){const M=b.value+"?chatRoomId="+T.value;l.value=new WebSocket(M),l.value.addEventListener("open",S),l.value.addEventListener("message",L),l.value.addEventListener("close",w),l.value.addEventListener("error",N)}const S=()=>{$(),X()},w=()=>{H()},N=()=>{U(),H()},L=M=>{var K,G;$();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,p.value.push(Za),j.messages.length>0&&x(j.messages)):j.agentResponse&&(j.errorMessage&&(j.agentResponse.content=j.errorMessage,j.agentResponse.error=!0),y.value=null,p.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,...(K=j.agentResponse)!=null&&K.filesData?{filesData:(G=j.agentResponse)==null?void 0:G.filesData}:{}}));E.value=j.links||[],A(j)}},$=()=>{H(),d.value=setTimeout(()=>{if(O.value){const M={action:"heartbeat"};l.value.send(JSON.stringify(M)),$()}},Qa)},H=()=>{d.value&&(clearInterval(d.value),d.value=null)};function Q(M){const j={...h.value};j.requestType="Action",j.actionType="Undo",j.undoRequestId=M,j.requestId=wt(),q(j)}function X(){const M={...h.value};M.requestType="Action",M.actionType="History",M.requestId=wt(),q(M)}function te(M){return a.path.startsWith("/configurator")&&o.isChangedConfiguration?(_.value={save:()=>{o.maintainQuoteConfiguration()}},c.value=M,!0):(c.value="",!1)}function J(M,j=!0,K=null){if(!te(M)&&M.trim()){let G={...h.value};G.prompt=M.trim(),G.requestType="Chat",G.requestId=wt(),G.internalCall=!1,G.payload=B(),G.componentName=R.value,G.templateId=i.templateId,G.payload.lineItemsCount=i.lineItemsCount,K&&(G={...G,...K}),z(),j&&p.value.push({message:M.trim(),type:"user",...C.value&&{fileData:[C.value]},requestId:G.requestId}),q(G),$()}}function q(M){const j={action:"prompt",data:M};l.value.send(JSON.stringify(j))}const x=M=>{const j=M.filter(({content:K})=>!!K).map(K=>({message:K.content,type:K.role,requestId:K.requestId,epoch:K.epoch,isDML:K.isDML,undone:K.undone}));j.forEach((K,G)=>{K.isDML===!0&&G!==j.length-1&&(K.isDML=!1)}),p.value=[...p.value,...j]};function B(){return a.path==="/quote-item"?i.getPayload():{}}const R=e.computed(()=>a.path==="/quote-item"?"QuoteItem":""),U=()=>{p.value.push({type:"response",message:"Oops! Something went wrong while processing your request. Please try again later.",error:!0})},z=()=>{p.value=p.value.map(M=>({...M,links:[]}))};function A(M){var G,oe,ie;const j=((G=M==null?void 0:M.redirectObjects)==null?void 0:G.componentName)||(M==null?void 0:M.componentName),K=(M==null?void 0:M.redirectObjects)||{};if(j==="AdaptiveSearch"){const se=(oe=M==null?void 0:M.payload)==null?void 0:oe.searchTerm,ye=(ie=M==null?void 0:M.payload)==null?void 0:ie.applyFilters;se&&se!==n.searchText&&n.initAdaptiveSearch({searchTerm:se,filters:ye}),f.push("/adaptive-search")}else j==="Configurator"?f.push(`/configurator/${K.itemId}/${K.qliId}`):j==="QuoteReview"?f.push("/quote-item"):j==="QuoteItem"||j==="QuoteList"?(f.push("/quote-item"),i.performAIAction(M)):j==="QuickSelection"&&(r.quickSelectionLayout=M.payload,console.info("Loading QuickSelection data = ",JSON.stringify(r.quickSelectionLayout)),f.push("/match-records"))}function P(){if(O.value){const M={action:"cancel",data:{requestId:h.value.requestId,chatRoomId:T.value}};l.value.send(JSON.stringify(M))}}const F=()=>{s.value&&(clearInterval(s.value),s.value=null),d.value&&(clearInterval(d.value),d.value=null),g.value&&(clearTimeout(g.value),g.value=null)};return e.onBeforeUnmount(()=>{F()}),{unsavedChanges:_,loadingMessage:y,promptMessage:c,buttonLinks:E,websocketUrl:b,chatHistory:p,latestDMLRequest:v,strikethroughHistory:u,attachmentData:C,dataManuallyChanged:m,undoAction:Q,connectSocket:I,sendMessage:J,setInitialPayload:V,cancelRequest:P}}),Rt=Ke.defineStore("comRoot",()=>{const t=sn(),i=at(),n=ut(),r=e.ref(""),o=e.ref(""),a=e.ref("Genesis AI"),c=e.ref(""),b=e.ref({}),p=e.ref(""),v=e.ref(""),u=e.ref(""),m=e.ref(""),l=e.ref({}),f=e.ref(""),h=e.ref(""),d=e.ref(""),s=e.ref(""),g=e.ref(""),_=e.ref(""),C=e.ref(""),y=e.ref("Single"),E=e.ref("closed"),T=e.computed(()=>n.quoteName),O=e.computed(()=>y.value==="Single");async function V(N){r.value=N||oo("id"),o.value=oo("origin"),await S(),await I()}async function I(){try{console.info("getRecordInfo",r.value);let N=await window.salesforceConnector.getRecordInfo(r.value);return N=qe(N),N!==void 0&&(l.value=N,f.value=N.name,h.value=N.objectType,d.value=N.accountId,s.value=N.eCatalogId,g.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){i.handleError(N.message)}}async function S(){var L,$;console.info("getOrgInformation",r.value);const N=await window.salesforceConnector.getOrgInformation();t.websocketUrl=N.websocketUrl,c.value=(L=N.locale)==null?void 0:L.replace("_","-"),b.value=N.user,p.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,ra(N)}return{id:r,origin:o,title:T,subTitle:a,locale:c,user:b,orgName:p,orgId:v,orgType:u,packageVersion:m,objectType:h,recordInfo:l,name:f,accountId:d,eCatalogId:s,currencyCode:g,userLocale:_,opportunityId:C,pricingSchema:y,isSinglePricingSchema:O,flyoutState:E,start:V,getRecordInfo:I,setSubTitle:w}}),Ja="XX_ORD1__Quote__c",Xa="xxord1salespricec",cn="xx_ord1__item__c",Ga="xxord1productnrcc",Wa=Ke.defineStore("cartStore",()=>{const t=ut(),i=mo(),n=at(),r=e.ref(""),o=e.ref("$0"),a=e.ref("$0"),c=e.ref(null),b=e.ref({}),p=e.ref({}),v=e.ref({}),u=e.ref(""),m=e.ref(""),l=e.ref({}),f=e.ref(""),h=e.ref(""),d=e.ref({});async function s(){T()}async function g(){try{let I=await window.salesforceConnector.getProductCount(t.quoteId);if(I=qe(I),I!=null&&I.errorMessage){n.handleError(I.errorMessage);return}return r.value=I,I}catch{n.handleError("Failed to get Product Count. Please try again.")}}async function _(){try{let I=await window.salesforceConnector.getQuoteTotal(t.quoteId);if(I=qe(I),I!=null&&I.errorMessage){n.handleError(I.errorMessage);return}return a.value=I.monthlyTotal,o.value=I.onetimeTotal,I}catch{n.handleError("Failed to get Total Amount. Please try again.")}}async function C(I,S,w,N=""){if(!t.sectionDataMap.get(w).parentQLIs[S].removingItem){t.sectionDataMap.get(w).parentQLIs[S].removingItem=!0,h.value=I.id,await y(I.id)==="Success"&&(t.fetchAllQuoteLineItems(),N&&N(I,S,w));let $=t.sectionDataMap.get(w).parentQLIs.filter(H=>H[cn]===I[cn]).length;h.value="",i.lstItems.forEach(H=>{H[cn]===I[cn]&&(H.addedToQuote===!0&&(H.addedToQuote=!1),$===0&&(H.removedFromQuote=!0))})}}async function y(I){try{let S=await window.salesforceConnector.deleteQLI(I);if(S!=null&&S.errorMessage){n.handleError(S.errorMessage);return}return g(),_(),S}catch{n.handleError("Failed to remove Quote Item. Please try again.")}}function E(I){var N,L;const S=(N=I==null?void 0:I[Ga])==null?void 0:N.match(/\.\d+/);S&&(S.value=S[0].length-1);const w=(L=I==null?void 0:I[Xa])==null?void 0:L.match(/\.\d+/);return w&&(w.value=w[0].length-1),S||w}function T(I=!0){g(),_(),I&&t.fetchTemplates(Ja).then(()=>{t.getFilteredListWithFields()})}function O(I){const S=t.sectionDataMap;for(const[,w]of S.entries())w.parentQLIs.forEach(N=>{N.id===I.id&&(w.columns.forEach(L=>{if(L.dataType==="CURRENCY"){const $=L.field.replace(/_/g,"");N[$]=V(N[$],I[L.field])}}),I!=null&&I.billingPeriodValue&&(I!=null&&I.formattedBillingPeriodValue)&&(N.formattedBillingPeriodValue=V(N.formattedBillingPeriodValue,I.billingPeriodValue)),I!=null&&I.oneTimeValue&&(I!=null&&I.formattedOneTimeValue)&&(N.formattedOneTimeValue=V(N.formattedOneTimeValue,I.oneTimeValue)))})}function V(I,S){const w=Number(S);if(isNaN(w))return I;const N=I.match(/(\d[\d,]*)(\.\d+)?/);if(!N)return I;const L=N[2]||"",$=L.length?L.length-1:0,H=w.toLocaleString("en-US",{minimumFractionDigits:$,maximumFractionDigits:$});return I.replace(N[1]+L,H)}return{initializeCart:s,loadCartState:T,productCount:r,onetimeTotal:o,monthlyTotal:a,filterCartItem:c,billingPeriodValue:u,hasOneTimeValue:m,hasBillingPeriodInList:b,oneTimeFieldAvailable:p,billingPeriodFieldAvailable:v,priceDecimalPrecision:l,cartItemUpdatingId:f,removingItemLoaderId:h,cartItemColumnsMap:d,getProductCount:g,getQuoteTotal:_,removeItem:C,removeQuoteItem:y,getDecimalPrecisionFromSalesPriceOrNRC:E,updateFormattedValues:O,formateCurrencyValue:V}}),Ya=t=>[{title:"Apply Discount",subOptions:[...t.map(i=>`Apply Discount on ${i} for `),"Show Maximum discount allowed","Apply Maximum Discount Allowed",...t.map(i=>`Apply Discount on ${i} 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"]}],el={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"}]},tl=[{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"]}],ut=Ke.defineStore("quote",()=>{const t=at(),i=Wa(),n=Rt(),r=e.ref(""),o=e.ref(""),a=e.ref(0),c=e.ref(""),b=e.ref([]),p=e.ref({template:!0,filteredList:!1}),v=e.ref(null),u=e.ref(new Map),m=e.ref({}),l=e.ref(!1),f=e.ref(!0),h=e.ref(!1),d=e.ref({text:"Hide Options",altText:"Show Options",handler:()=>{f.value=!f.value,V()},color:"#136E05",isActive:!1}),s=e.computed(()=>{const q=Array.from(u.value.values()).map(x=>x.sectionName);return Ya(q)});e.watch(c,()=>{p.value.template||O()});function g(){const q=new Map,x=[];for(const[R,U]of u.value.entries())q.set(R,U.selected),x.push(U);const B=JSON.parse(JSON.stringify(x));return B.forEach(R=>{delete R.selected;const U=new Map,z=[];R.lineItems.forEach(A=>{A.Selected=q.get(R.tableId).get(A.id)||!1,A.xx_ord1__parent_qli__c?(U.has(A.xx_ord1__parent_qli__c)||U.set(A.xx_ord1__parent_qli__c,[]),U.get(A.xx_ord1__parent_qli__c).push(A)):z.push(A)}),R.lineItems=z.map(A=>({...A,options:U.get(A.id)||[]})),delete R.loading,delete R.parentQLIs,delete R.totalValues}),{showOptions:f.value,sections:B,templateId:c.value}}async function _(q){try{let x=await window.salesforceConnector.getPrimaryQuote(q);x=qe(x),x!==void 0&&(console.info("getPrimaryQuote",JSON.stringify(x)),r.value=x.recordId,console.info("quoteId",r.value),o.value=x.name,c.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(q){var x,B;try{p.value.template=!0;let R=await window.salesforceConnector.fetchContentTemplates(JSON.stringify({lstObjectName:[q],templateType:"Document",templateId:null,fetchOnlyDefault:!1}));R=qe(R);const U=R==null?void 0:R.templates[q];return c.value||(c.value=(x=U.find(z=>z.XX_ORD1__Default__c))==null?void 0:x.Id),c.value||(c.value=(B=U[0])==null?void 0:B.Id),b.value=U,p.value.template=!1,b.value}catch(R){t.handleError(R.message),console.info("[ERROR]: fetchTemplates() error = ",R)}}function y(q){if(!q)return null;const x=/\{!\$(\w+):([\w.]+)\}/,B=q.match(x);return B?{function:B[1],apiname:B[2].split(".")[1]}:null}async function E(q){try{const x={Id:r.value,XX_ORD1__Document_Template__c:q};return await window.salesforceConnector.updateQuote(JSON.stringify([x]))}catch(x){t.handleError(x.message),console.info("[ERROR]: updateQuote() error = ",x)}}async function T(){try{p.value.filteredList=!0;let q=await window.salesforceConnector.getQuoteEPageLayout();u.value.clear(),i.cartItemColumnsMap={},q=qe(q);const x=q.map(R=>({label:R.fieldLabel,field:R.fieldName.toLowerCase(),isEditable:R.isEditable,dataType:R.dataType,...R.picklistValues?{picklistValues:R.picklistValues}:{}})),B=wt();return u.value.set(B,{loading:!0,lineItems:[],parentQLIs:[],columns:x,tableId:B,sectionName:"All Rows",selected:new Map,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}),i.cartItemColumnsMap[B]=x,d.value.isActive=!1,f.value=!0,v.value={lstCB:[{columns:x,footer:null,title:"All Rows",sectionName:"All Rows",tableId:B,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}]},V(),p.value.filteredList=!1,q}catch(q){t.handleError(q.message),console.info("[ERROR]: getQuoteEPageLayout() error = ",q)}}async function O(){if(b.value.length===0){T();return}try{p.value.filteredList=!0;let q=await window.salesforceConnector.getFilteredListWithFields(JSON.stringify({templateId:c.value}));E(c.value),q=qe(q),console.info("res.lstCB = ",q.lstCB);const x=q==null?void 0:q.objectFieldsMap;return u.value.clear(),i.cartItemColumnsMap={},q.lstCB=q.lstCB.map(B=>{const{fields:R,filters:U,primarysort:z,primarysortdesc:A}=JSON.parse(B.XX_ORD1__Block_Properties__c),P=R.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}:{}}}),F=B.Id||wt();return u.value.set(F,{loading:!0,lineItems:[],parentQLIs:[],columns:P,tableId:F,sectionName:B.Name,selected:new Map,footer:y(B.XX_ORD1__Table_Footer_HTML__c),filters:U,primarysort:z,primarysortdesc:A}),i.cartItemColumnsMap[F]=P,d.value.isActive=!1,f.value=!0,{columns:P,footer:y(B.XX_ORD1__Table_Footer_HTML__c),title:B.Name,sectionName:B.Name,tableId:F,filters:U,primarysort:z,primarysortdesc:A}}),v.value=q,V(),p.value.filteredList=!1,q}catch(q){t.handleError(q.message),console.info("[ERROR]: getFilteredListWithFields() error = ",q)}}async function V(q=!0){const x=[];for(const[B]of u.value)x.push(w(B,q));return await Promise.all(x),i.getProductCount(),!0}function I(q,x){return u.value.get(q).columns.some(B=>B.field.toLowerCase()===x)||i.cartItemColumnsMap[q].some(B=>B.field.toLowerCase()===x)}function S(q,x){let B=on(q);const R=n.pricingSchema,U=I(x,"xx_ord1__nrc__c"),z=I(x,"xx_ord1__sales_price__c"),A=I(x,"xx_ord1__qty__c");return B=B.map(P=>{let F={};R==="nrc/mrc"&&(P!=null&&P.xx_ord1__billing_period__c)?F={...z?{billingPeriodValue:(P==null?void 0:P.xx_ord1__sales_price__c)===0?"0":(P==null?void 0:P.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:P==null?void 0:P.xxord1salespricec}:{},...U?{oneTimeValue:(P==null?void 0:P.xx_ord1__nrc__c)===0?"0":(P==null?void 0:P.xx_ord1__nrc__c)||null,formattedOneTimeValue:P==null?void 0:P.xxord1nrcc}:{}}:R==="nrc/mrc"&&!(P!=null&&P.xx_ord1__billing_period__c)?z&&(F={oneTimeValue:(P==null?void 0:P.xx_ord1__sales_price__c)===0?"0":(P==null?void 0:P.xx_ord1__sales_price__c)||null,formattedOneTimeValue:P==null?void 0:P.xxord1salespricec}):R!=="nrc/mrc"&&(P!=null&&P.xx_ord1__billing_period__c)?z&&(F={billingPeriodValue:(P==null?void 0:P.xx_ord1__sales_price__c)===0?"0":(P==null?void 0:P.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:P==null?void 0:P.xxord1salespricec}):R!=="nrc/mrc"&&!(P!=null&&P.xx_ord1__billing_period__c)&&z&&(F={oneTimeValue:(P==null?void 0:P.xx_ord1__sales_price__c)===0?0:(P==null?void 0:P.xx_ord1__sales_price__c)||null,formattedOneTimeValue:P==null?void 0:P.xxord1salespricec});const{xx_ord1__qty__c:M,xx_ord1__sales_price__c:j,xx_ord1__nrc__c:K,...G}=P,oe={...G,id:P.id,description:(P==null?void 0:P.xx_ord1__line_description__c)||"",xx_ord1__billing_period__c:P==null?void 0:P.xx_ord1__billing_period__c,...A?{xx_ord1__qty__c:M}:{},xx_ord1__item__c:P==null?void 0:P.xx_ord1__item__c,"xx_ord1__item__r.xx_ord1__decimal_precision__c":P["xx_ord1__item__r.xx_ord1__decimal_precision__c"]||"0",...F};return oe!=null&&oe.billingPeriodValue&&(i.hasBillingPeriodInList[x]=!0,i.billingPeriodValue=oe==null?void 0:oe.xx_ord1__billing_period__c),"oneTimeValue"in oe&&(i.oneTimeFieldAvailable[x]=!0),"billingPeriodValue"in oe&&(i.billingPeriodFieldAvailable[x]=!0),(oe==null?void 0:oe.oneTimeValue)!==""&&(oe==null?void 0:oe.oneTimeValue)!==null&&(i.hasOneTimeValue=!0),oe}),B}async function w(q,x=!0){var B,R;try{const U=u.value.get(q);if(console.info("sectionData = ",U.sectionName),!U)return;U.loading=x,x&&(U.lineItems=[]);const{columns:z,filters:A,primarysort:P,primarysortdesc:F,footer:M}=U,j=z.map(de=>de.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"),(B=i.cartItemColumnsMap[q])==null||B.forEach(de=>{j.includes(de.field)||j.push(de.field)});const K=await N({fields:j,recordId:r.value,filters:A||[],primarySortBy:P||"",primarySortOrder:F?"DESC":"ASC",includeOptions:f.value,totalFields:M?[M.apiname]:[]}),G=K.lineItems,oe=new Map;let ie=[];const se=(R=K.fieldTotals)==null?void 0:R.map(de=>de.totalValue);G.forEach(de=>{de.XX_ORD1__Parent_QLI__c?oe.has(de.XX_ORD1__Parent_QLI__c)?oe.get(de.XX_ORD1__Parent_QLI__c).push(de):oe.set(de.XX_ORD1__Parent_QLI__c,[de]):ie.push(de)});const ye=[];return ie.forEach(de=>{ye.push(de),oe.has(de.Id)&&ye.push(...oe.get(de.Id))}),ie=S(ie,q),U.lineItems=on(ye),U.parentQLIs=ie,U.totalValues=se,U.loading=!1,u.value=new Map(u.value),ye}catch(U){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",U.message);const z=u.value.get(q);z&&(z.loading=!1)}}async function N(q){try{let x=await window.salesforceConnector.getQuoteLineItemsWithFilteredTable(JSON.stringify(q));return x=qe(x),x}catch(x){t.handleError(x.message),console.info("[ERROR]: getQuoteLineItemsWithFilteredTable() error = ",x)}}async function L(q){try{console.info("updateQli() payload = ",q);let x=await window.salesforceConnector.updateQli(JSON.stringify(q));return x=qe(x),V(!1),x}catch(x){t.handleError(x.message),console.info("[ERROR]: updateQli() error = ",x)}}async function $(q){try{let x=await window.salesforceConnector.deleteQLI(q);return x=qe(x),V(),x}catch(x){t.handleError(x.message),console.info("[ERROR]: deleteQLI() error = ",x)}}async function H(q,x){try{l.value=!0;const B={fields:q};x&&(B.objectName=x),q.includes("xx_ord1__qty__c")&&x==="xx_ord1__ecatalog_item__c"&&(B.fields=B.fields.filter(U=>U!=="xx_ord1__qty__c")),q.includes("xx_ord1__sales_price__c")&&x!=="xx_ord1__quote_line_item__c"&&(B.fields=B.fields.filter(U=>U!=="xx_ord1__sales_price__c"));let R=await window.salesforceConnector.getFieldsData(JSON.stringify(B));return typeof R=="string"&&(R=JSON.parse(R)),R!=null&&R.errorMessage?(t.handleError(R.errorMessage),null):(m.value={...m.value,...R},console.info("fieldsData.value = ",JSON.stringify(m.value)),R)}catch(B){return t.handleError("Failed to get Fields Data. Please try again."),console.info("[ERROR]: getFieldsData() error = ",B),null}finally{l.value=!1}}function Q(q=""){var x;return!q||q.includes(".")?!1:q.includes("xx_ord1__qty__c")?!0:((x=m.value[q])==null?void 0:x.isEditable)||!1}function X(){te(el)}async function te(q){var x,B,R,U,z,A,P,F,M;if(q.payload){if((x=q.payload)!=null&&x.uiModification){const j=q.payload.uiModification;if(((B=j.addColumn)==null?void 0:B.length)>0)if(j.addColumn.forEach(K=>{K.columns.forEach(G=>{G.field=G.field.toLowerCase()})}),j.addColumn[0].sectionName==="all_section")for(const[K,G]of u.value)G.columns=[...G.columns,...j.addColumn[0].columns];else j.addColumn.forEach(K=>{u.value.get(K.tableId)&&(u.value.get(K.tableId).columns=[...u.value.get(K.tableId).columns,...K.columns])});if(((R=j.removeColumn)==null?void 0:R.length)>0)if(j.removeColumn.forEach(K=>{K.columns=K.columns.map(G=>G.toLowerCase())}),j.removeColumn[0].sectionName==="all_section")for(const[K,G]of u.value)G.columns=G.columns.filter(oe=>!j.removeColumn[0].columns.includes(oe.field));else j.removeColumn.forEach(K=>{u.value.get(K.tableId)&&(u.value.get(K.tableId).columns=u.value.get(K.tableId).columns.filter(G=>!K.columns.includes(G.field)))});if(((U=j.filter)==null?void 0:U.length)>0)if(j.filter[0].sectionName==="all_section")for(const[K,G]of u.value)G.filters=[...G.filters,...j.filter[0].filters];else j.filter.forEach(K=>{u.value.get(K.tableId)&&(u.value.get(K.tableId).filters=[...u.value.get(K.tableId).filters,...K.filters])});if(((z=j.groupBy)==null?void 0:z.length)>0){const K=((A=[...u.value.values()][0])==null?void 0:A.columns)||tl;u.value.clear(),i.cartItemColumnsMap={},j.groupBy.forEach(G=>{i.cartItemColumnsMap[G.tableId]=G.columns||K,u.value.set(G.tableId,{loading:!0,lineItems:[],parentQLIs:[],columns:G.columns||K,tableId:G.tableId,sectionName:G.sectionName,selected:new Map,footer:y(G.footer),filters:G.filters,primarysort:G.primarysort,primarysortdesc:G.primarysortdesc})})}j.showOptions!==void 0&&(f.value=j.showOptions)}if(((F=(P=q.payload)==null?void 0:P.sections)==null?void 0:F.length)>0){const j=(M=q.payload)==null?void 0:M.sections;u.value.clear(),j.forEach(K=>{K.tableId||(K.tableId=wt()),K.selected=new Map,u.value.set(K.tableId,K)}),V()}}q.actionFunction==="Reload"&&(V(),console.info("Reloading quote line items"))}async function J(q){var x,B;try{const R=new Set;for(const U of u.value.keys())(x=u.value.get(U).lineItems)==null||x.forEach(A=>{A.attributes=null,R.add(A.id)});if(q){const U={lineItemIds:[...R]},z=await window.productManagerController.getLineItemAttributes({request:JSON.stringify(U)}),A=JSON.parse(z.data);for(const P of u.value.keys())(B=u.value.get(P).lineItems)==null||B.forEach(M=>{M.attributes=A[M.id]||null})}}catch(R){console.info("[ERROR]: fetchAttributesData() error = ",R)}}return{showAttributes:h,quoteId:r,quoteName:o,templateId:c,templateOptions:b,loading:p,currentTemplateData:v,fieldsData:m,fieldsDataLoading:l,showOptionHeaderButton:d,sectionDataMap:u,promptSuggestions:s,lineItemsCount:a,addColumns:X,getQuoteEPageLayout:T,getPayload:g,getPrimaryQuote:_,fetchTemplates:C,getFilteredListWithFields:O,getQuoteLineItemsWithFilteredTable:N,updateQli:L,getFieldsData:H,deleteQLI:$,performAIAction:te,isEditableField:Q,fetchQuoteLineItems:w,fetchAllQuoteLineItems:V,fetchAttributesData:J}}),go=Ke.defineStore("comShare",()=>{const t=e.ref(""),i=e.ref(""),n=e.ref(""),r=e.ref(""),o=e.ref(""),a=e.ref(""),c=e.ref(""),b=e.ref("Single"),p=e.computed(()=>b.value==="Single");async function v(u){t.value=u.orgType||"Production",i.value=u.orgId||"",n.value=u.userId||"",r.value=u.accountId||"",o.value=u.opportunityId||"",c.value=u.userLocale||"en_US",b.value=u.pricingSchema||"Single"}return{orgType:t,orgId:i,userId:n,accountId:r,opportunityId:o,userLocale:c,pricingSchema:b,quoteId:a,isSinglePricingSchema:p,setSetupData:v}}),nl="https://api-svc.blink.expedite1.com/api/product-pricing/evaluateConfigurationSelection",rl={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 ol(t=rl){const i=nl;try{const n=await fetch(i,{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 il(t){const i=n=>Math.min(...n.options.map(r=>r.relationshipInfo.primarySortOrder));return t.forEach(n=>{n.itemTypes.forEach(r=>{r.options.sort((o,a)=>o.relationshipInfo.primarySortOrder-a.relationshipInfo.primarySortOrder||o.itemName.localeCompare(a.itemName))}),n.itemTypes.sort((r,o)=>i(r)-i(o)||r.itemTypeName.localeCompare(o.itemTypeName))}),t.sort((n,r)=>{const o=Math.min(...n.itemTypes.map(i)),a=Math.min(...r.itemTypes.map(i));return o-a||n.category.localeCompare(r.category)}),t}const al=(t,i)=>{const n=(r,o)=>typeof o=="function"?void 0:o;return JSON.stringify(t,n)===JSON.stringify(i,n)},Ye=Ke.defineStore("comConfigurator",()=>{ho();const t=ut(),i=at(),n=go(),r=ln(),o=e.ref(null),a=e.ref(null),c=e.ref(null),b=e.ref({}),p=e.ref(null),v=e.ref([]),u=e.ref(null),m=e.ref(null),l=e.ref(new Map),f=e.ref(!1),h=e.ref({configuration:!1,lineItem:!1,productOptionsPricing:!1,bestOfferPrice:!1,lineItemAttributes:!1,save:!1}),d=e.ref(!1),s=e.computed(()=>g.value&&!n.isSinglePricingSchema),g=e.computed(()=>{let A=!0,P=!0,F=!0,M=null;for(const j of b.value.categoryOptions)for(const K of j.itemTypes)for(const G of K.options)G.billingPeriod&&(M&&M!==G.billingPeriod&&(F=!1),M=G.billingPeriod,!G.yrcPrice&&G.billingPeriod==="Monthly"&&(A=!1),!G.mrcPrice&&G.billingPeriod==="Yearly"&&(P=!1));return A&&P&&F}),_=e.computed(()=>!al(b.value,p.value)),C=e.computed(()=>{var P;const A=((P=b.value)==null?void 0:P.categoryOptions)||[];return A.forEach(F=>{F.itemTypes.forEach(M=>{M.selectedOptions=M.options.filter(j=>M.selected.includes(j.itemId)),M.totalPrice=function(){return M.selectedOptions.reduce((j,K)=>j+K.price*K.qty,0)||0},M.oneTimePrice=function(){return M.selectedOptions.filter(j=>!j.billingPeriod).reduce((j,K)=>j+K.price*K.qty,0)||0},M.recurringPrice=function(){return M.selectedOptions.filter(j=>j.billingPeriod).reduce((j,K)=>j+K.price*K.qty,0)||0}}),F.selectedItemTypes=F.itemTypes.filter(M=>M.selected.length>0),F.totalPrice=function(){return F.itemTypes.reduce((M,j)=>M+j.totalPrice(),0)},F.oneTimePrice=function(){return F.itemTypes.reduce((M,j)=>M+j.oneTimePrice(),0)},F.recurringPrice=function(){return F.itemTypes.reduce((M,j)=>M+j.recurringPrice(),0)}}),A.filter(F=>F.itemTypes.filter(M=>M.selected.length>0).length>0)}),y=e.computed(()=>C.value.reduce((A,P)=>A+P.totalPrice(),0)),E=e.computed(()=>{if(!b.value)return{basePrice:0,addOns:0,oneTimePrice:0,recurringPrice:0,total:0};const A=C.value.reduce((M,j)=>M+j.totalPrice(),0);let P=C.value.reduce((M,j)=>M+j.oneTimePrice(),0),F=C.value.reduce((M,j)=>M+j.recurringPrice(),0);return b.value.billingPeriod?F=(F+b.value.price)*b.value.qty:P=(P+b.value.price)*b.value.qty,{basePrice:b.value.price,addOns:A,oneTimePrice:P,recurringPrice:F,total:b.value.price*b.value.qty+A*b.value.qty+P+F}}),T=e.computed(()=>{var P,F,M,j;const A=new Map;return(P=u.value)!=null&&P.productLineItem&&A.set((F=u.value)==null?void 0:F.productLineItem.XX_ORD1__Item__c,(M=u.value)==null?void 0:M.productLineItem),(j=u.value)==null||j.options.forEach(K=>{A.set(K.XX_ORD1__Item__c,K)}),A}),O=e.computed(()=>{const A=new Map;return b.value.categoryOptions.forEach(P=>{P.itemTypes.forEach(F=>{F.options.forEach(M=>{A.set(M.relationshipInfo.publishKey,M)})})}),A}),V=e.computed(()=>{if(!b.value)return{};const A=M=>!M||!Array.isArray(M)?[]:M.filter(j=>j.apiName&&j.value!==null&&j.value!==void 0&&j.value!=="").map(j=>({fieldAPIName:j.apiName,value:j.dataType==="BOOLEAN"?j.value?"true":"false":j.dataType==="REFERENCE"?j.referenceRecordId||j.value||"":j.value||""})),P={item_id:b.value.itemId,qli_id:b.value.qliId||null,name:b.value.itemName,qty:b.value.qty||1,price:b.value.price||0,attributes:A(b.value.attributes)},F=[];return b.value.categoryOptions.forEach(M=>{M.itemTypes.forEach(j=>{j.options.forEach(K=>{j.selected.includes(K.itemId)&&F.push({item_id:K.itemId,qli_id:K.qliId||null,name:K.itemName,qty:K.qty||1,price:K.price||0,attributes:A(K.attributes)})})})}),{[b.value.itemId]:{product:P,options:{add:F,remove:[]}}}});function I(A){const P=new Map;A.options.add.forEach(F=>{P.set(F.item_id,F)}),b.value.qty=A.product.qty,b.value.price=A.product.price,b.value.attributes=A.product.attributes,b.value.categoryOptions.forEach(F=>{F.itemTypes.forEach(M=>{M.options.forEach(j=>{M.selected=[],P.has(j.itemId)&&(j.itemName=P.get(j.itemId).name,j.qty=P.get(j.itemId).qty,j.price=P.get(j.itemId).price,M.selected.push(j.itemId))})})})}function S(){return{get getConfig(){return V.value},setConfig:I}}function w(A){b.value.qliId&&(b.value.qliBillingPeriod==="Monthly"&&!A?b.value.price=b.value.qliSalesPrice||b.value.qliMrcPrice:b.value.qliBillingPeriod==="Yearly"&&A&&(b.value.price=b.value.qliSalesPrice)),b.value.categoryOptions.forEach(P=>{P.itemTypes.forEach(F=>{F.options.forEach(M=>{M.billingPeriod&&(M.price=(A?M.yrcPrice.offerPrice:M.mrcPrice.offerPrice)||M.price,M.qliId&&(M.qliBillingPeriod==="Monthly"&&!A?M.price=M.qliSalesPrice||M.qliMrcPrice:M.qliBillingPeriod==="Yearly"&&A&&(M.price=M.qliSalesPrice)))})})})}function N(){b.value={},p.value=null,v.value=[],u.value=null,m.value=null,l.value=new Map,f.value=!1,h.value.configuration=!1,h.value.lineItem=!1,h.value.productOptionsPricing=!1,h.value.bestOfferPrice=!1,h.value.lineItemAttributes=!1,h.value.save=!1}async function L(A,P,F){console.time("CONFIGURATOR INIT CONFIGURATOR"),N(),console.timeLog("CONFIGURATOR INIT CONFIGURATOR","1"),a.value=A,c.value=P,o.value=F||n.quoteId;const M=await $();console.timeLog("CONFIGURATOR INIT CONFIGURATOR","2"),b.value=H(M),c.value&&(await X(),console.timeLog("CONFIGURATOR INIT CONFIGURATOR","3"),Q(b.value),b.value.categoryOptions.forEach(j=>{j.itemTypes.forEach(K=>{K.options.forEach(G=>{Q(G),(T.value.has(G.itemId)||G.relationshipInfo.relationship==="Kit")&&K.selected.push(G.itemId)})})}),console.timeLog("CONFIGURATOR INIT CONFIGURATOR","4")),p.value=JSON.parse(JSON.stringify(b.value)),console.timeEnd("CONFIGURATOR INIT CONFIGURATOR")}async function $(){try{const A={accountId:n.accountId,objectId:o.value,itemId:a.value,configScope:"BASIC",fields:[],pricePreference:"Lowest Price"},P=await window.productManagerController.getAvailableConfiguration(A);console.info("getAvailableConfiguration:result",P);const F=P.data.productConfiguration;return F.categoryOptions=il(F.categoryOptions),F}catch(A){return console.info("error",A.message),!1}}function H(A){l.value.set(c.value,A.attributes),v.value=A.configRules;const P=new Set;return v.value.forEach(F=>{const M=JSON.parse(F.ruleJson);M.optionSelected.forEach(j=>{P.add(j)}),M.affectedOptions.forEach(j=>{P.add(j)})}),Q(A),A.categoryOptions.forEach(F=>{F.key=F.category.toLowerCase().replace(/\s+/g,"-").replace(/[&]/g,""),F.itemTypes.forEach(M=>{M.selected=[],M.numberOfColumns||(M.numberOfColumns=1),M.numberOfColumns>1&&(M.lightboxAttributes=!0),M.maxNumber||(M.maxNumber=100),M.minNumber||(M.minNumber=0),M.maxQuantity||(M.maxQuantity=1e4),M.minQuantity||(M.minQuantity=1),M.maxNumber===1?(M.isRadio=!0,M.minMessage="Please select 1 option",M.maxMessage="",M.isKit=M.options.some(j=>j.relationshipInfo.relationship==="Kit")):(M.minMessage=`Minimum of ${M.minNumber} selection${M.minNumber!==1?"s":""} required`,M.maxMessage=`Maximum of ${M.maxNumber} selection${M.maxNumber!==1?"s":""} allowed`),M.options.forEach(j=>{F.showImage=F.showImage||!!j.defaultImageURL,j.showAttributesModal=!1,j.calculateRules=P.has(j.relationshipInfo.publishKey),j.qty=M.minQuantity||1,j.getTags=()=>(j.attributes=j.attributes||[],j.attributes.filter(K=>K.value!==null&&K.value!=="").map(K=>({label:K.label,value:K.value}))),Object.defineProperty(j,"isDisabled",{get:function(){return j.relationshipInfo.relationship==="Kit"||(M.isRadio?M.isKit:!M.selected.includes(j.itemId)&&M.maxNumber===M.selected.length)}}),Q(j)})})}),A}function Q(A){A.isAttributes=A.attributes&&A.attributes.length>0;const P=A.catalogItem;if(T.value.has(A.itemId)){const F=T.value.get(A.itemId);A.qliId=F.Id,A.qty=F.XX_ORD1__QTY__c,A.itemName=F.XX_ORD1__Line_Description__c,A.billingPeriod=F.XX_ORD1__Billing_Period__c,A.price=F.XX_ORD1__Sales_Price__c,A.billingPeriod?A.price=F.XX_ORD1__Sales_Price__c||F.XX_ORD1__MRC__c:A.price=F.XX_ORD1__NRC__c||F.XX_ORD1__Sales_Price__c,A.qliSalesPrice=F.XX_ORD1__Sales_Price__c,A.qliNrcPrice=F.XX_ORD1__NRC__c,A.qliMrcPrice=F.XX_ORD1__MRC__c,A.qliBillingPeriod=F.XX_ORD1__Billing_Period__c,l.value.set(A.qliId,A.attributes)}else A.itemName=P.XX_ORD1__Line_Description__c||A.itemName,A.price=P.XX_ORD1__Negotiated_Price__c||P.XX_ORD1__NRC_for_New__c,A.nrcPrice=P.XX_ORD1__NRC_for_New__c}async function X(){var A;h.value.lineItem=!0,console.info("getLineItems",o.value,c.value);try{const P={objectId:o.value,filters:{},additionalFields:["Name","XX_ORD1__Line_Description__c"],primarySort:{field:"CreatedDate",direction:"DESC"},productPage:{limit:200,offset:0,productLineItemId:c.value}},F=await window.productManagerController.getLineItems({request:JSON.stringify(P)});return u.value=((A=F.data.products)==null?void 0:A.find(({productLineItem:M})=>M.Id===c.value))||null,console.info("lineItem.value",u.value),h.value.lineItem=!1,F}catch(P){return console.info("error",P.message),h.value.lineItem=!1,!1}}async function te(A){console.info("getRecords");try{const P=await window.productManagerController.getRecords({request:JSON.stringify(A)});return console.info("getRecords:result",P),JSON.parse(P.data)}catch(P){return console.info("error",P.message),!1}}async function J(A){const P={accountId:n.accountId,eCatalogItemIds:A,pricePreference:"Heighest Priority"},F=await window.productManagerController.calculateBestOfferPrice({request:JSON.stringify(P)});return console.info("calculateBestOfferPrice:result",F),h.value.bestOfferPrice=!1,JSON.parse(F.data)}async function q(){f.value=!0,h.value.save=!0,console.info("maintainQuoteConfiguration");const A=[],P=[];b.value.categoryOptions.forEach(j=>{j.itemTypes.forEach(K=>{K.options.forEach(G=>{K.selected.includes(G.itemId)?A.push(x(G)):G.qliId&&P.push(G.qliId)})})});const F={objectId:o.value,eCatalogId:n.eCatalogId,isGenesisAI:!0,blinkUser:!1,optionsToRemove:P,grandFatheredOptionsToRemove:[],productLineItem:{...x(b.value),optionLineItems:A}};console.info("maintainQuoteConfiguration:request",F);const M=await window.productManagerController.maintainQuoteConfiguration({request:JSON.stringify(F)});if(console.info("maintainQuoteConfiguration:result",M),M!=null&&M.error){const j={title:"Unable to Save Configuration",description:M.error,button:{label:"Back to Configuration",action:()=>{f.value=!1}},cancel:{label:"Quote List",action:()=>{r.push("/quote-item?id="+o.value)}}};i.errorPopup=j}else p.value=JSON.parse(JSON.stringify(b.value)),console.info("maintainQuoteConfiguration:result",M);h.value.save=!1}function x(A){const P={};A.isAttributes&&A.attributes.forEach(M=>{M.apiName.includes(".")||(M.dataType==="BOOLEAN"?P[M.apiName]=M.value?"true":"false":M.dataType==="REFERENCE"?P[M.apiName]=M.referenceRecordId:P[M.apiName]=M.value)});const F={attributes:P,itemId:A.itemId,lineItemId:A.qliId,lineDescription:A.itemName,qty:A.qty,billingPeriod:A.billingPeriod,...A.offer};return A.billingPeriod&&g.value&&!n.isSinglePricingSchema&&(F.billingPeriod=d.value?"Yearly":"Monthly"),!n.isSinglePricingSchema&&!A.billingPeriod?F.nrcPrice=A.price:(F.applyOnField="Catalog Price",F.salesPrice=A.price,F.nrcPrice=A.nrcPrice),F}async function B(){const A={objectId:n.accountId,productItemId:a.value};try{let P=await window.productManagerController.getProductCrossSells(A);console.info("getProductCrossSells:result",P),P=P.data?JSON.parse(P.data):{};debugger;if(P.crossSells.length===0)return P;const F=P.crossSells.map(K=>K.Id),M=await J(F),j=new Map;return M.forEach(K=>{j.set(K.eCatalogItemId,{...K,...K.pricingTypes[0]})}),P.crossSells.forEach(K=>{K.loading=!1,K.Name=K.XX_ORD1__Line_Description__c||K.XX_ORD1__Item__r.Name,K.Description=K.XX_ORD1__Item__r.XX_ORD1__Product_Description__c,j.has(K.Id)?(K.Price=j.get(K.Id).offerPrice,K.priceFormatted=j.get(K.Id).formattedOfferPrice,K.offer={offerDiscount:j.get(K.Id).offerDiscount,offerId:j.get(K.Id).offerId,offerType:j.get(K.Id).offerType}):(K.Price=K.XX_ORD1__List_Price2__c,K.priceFormatted=K.XX_ORD1__List_Price2__c,K.offer={offerDiscount:0,offerId:null,offerType:null})}),P}catch(P){return console.info("error",P.message),!1}}async function R(A,P){var K,G;const F={product:{publishKey:b.value.publishKey,lineDescription:b.value.itemName},options:[]};b.value.categoryOptions.forEach(oe=>{oe.itemTypes.forEach(ie=>{ie.options.forEach(se=>{ie.selected.includes(se.itemId)&&F.options.push({publishKey:se.relationshipInfo.publishKey,lineDescription:se.itemName})})})}),console.info("evaluateConfigSelection:currentConfig.options",F.options);const M={productJSON:{productItem:{configRules:v.value}},currentConfig:F,selected:A?{publishKey:(K=A.relationshipInfo)==null?void 0:K.publishKey,attributes:A.attributes,lineDescription:A.itemName}:{},unselected:P?{publishKey:(G=P.relationshipInfo)==null?void 0:G.publishKey,attributes:P.attributes,lineDescription:P.itemName}:{}};return await ol(M)}async function U(){try{const A=["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"],F=(await t.getQuoteLineItemsWithFilteredTable({fields:A,recordId:o.value,filters:[],includeOptions:!1,totalFields:[]})).lineItems;return console.info("fetchQuoteLineItems:res",F),F}catch(A){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",A.message)}}async function z(A){const P={quoteId:o.value,lstQLIRequest:[{eCatalogItemId:A.Id,quantity:1,offerApplicable:A.offer}]};try{const F=await window.productManagerController.createQuoteProducts({request:JSON.stringify(P)});console.info("getProductCrossSells:result",F)}catch(F){return console.info("error",F.message),!1}}return{itemId:a,configuration:b,_configurationCopy:p,lineItem:u,savedScreen:f,loading:h,summary:C,addOns:y,summaryPrices:E,optionByItemId:T,attributesByQLIId:l,optionByPublishKey:O,showYearlyPricing:d,isYearlyPricingExist:g,isChangedConfiguration:_,isRecurringPricingSchema:s,exposeProperties:S,updateCurrentConfiguration:I,changePricingScheme:w,createQuoteProducts:z,resetConfigurator:N,fetchQuoteLineItems:U,getRecords:te,getProductCrossSells:B,initConfigurator:L,maintainQuoteConfiguration:q,evaluateConfigSelection:R}}),ll={class:"ect-p-4 ect-flex ect-gap-2 ect-items-center ect-justify-between ect-border-b ect-border-gray-200"},sl={class:"ect-flex ect-items-center ect-gap-3"},cl={class:"ect-text-xl ect-font-semibold ect-text-gray-700 ect-leading-relaxed"},dl={key:0,class:"ect-flex ect-gap-1.5 ect-items-center"},ul=e.createElementVNode("span",{class:"ect-text-sm ect-text-gray-700 ect-leading-relaxed"},"Saving configuration...",-1),fl={key:1,class:"ect-flex ect-gap-1.5 ect-items-center"},hl=e.createElementVNode("span",{class:"ect-text-sm ect-text-gray-700 ect-leading-relaxed"},"Configuration Saved Successfully",-1),pl={key:1,class:"ect-flex ect-flex-col ect-gap-4 ect-flex-1 ect-overflow-y-auto ect-mb-16"},ml=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),gl={class:"ect-flex ect-flex-col ect-gap-4 ect-p-4 ect-pt-0 ect-overflow-y-auto"},yl=["data-test-id"],bl={class:"ect-flex-1 ect-flex ect-flex-col ect-gap-2"},_l={class:"ect-text-sm ect-font-semibold ect-text-gray-800 ect-leading-tight"},vl={class:"ect-text-sm ect-font-medium ect-text-gray-600 ect-leading-relaxed ect-line-clamp-2"},Cl={class:"ect-flex ect-flex-row ect-justify-between ect-items-center"},El={class:"ect-text-sm ect-font-semibold ect-text-gray-800"},kl={key:2,class:"ect-flex ect-flex-col ect-gap-4 ect-m-4 ect-flex-1 ect-overflow-y-auto"},wl=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),Nl={class:"ect-flex ect-flex-col ect-gap-4"},xl=["data-test-id","onClick"],Ol={class:"ect-flex ect-items-center ect-justify-center"},Sl={class:"ect-flex ect-flex-col ect-items-center ect-gap-2 ect-w-full"},Vl=["data-test-id"],Tl=["data-test-id"],Al={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"},Il={class:"ect-flex ect-flex-col ect-gap-4"},Bl={class:"ect-text-lg ect-font-semibold ect-text-gray-700 ect-leading-relaxed ect-p-4 ect-pb-0"},Ll={class:"ect-flex ect-flex-col ect-gap-4 ect-p-4 ect-pt-0 ect-overflow-y-auto"},Ml={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"},Rl={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"},ql={class:"ect-text-sm ect-font-medium ect-text-gray-600 ect-leading-relaxed ect-line-clamp-2"},Dl={class:"ect-flex ect-flex-row ect-justify-between ect-items-center"},jl={class:"ect-text-sm ect-font-semibold ect-text-gray-800"},$l={__name:"ConfiguratorRecommend",setup(t){const i=Ye(),n=ut(),r=ln(),o=e.computed(()=>i.configuration),a=e.ref(!0),c=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"}]),p=e.ref(null),v=e.ref([]),u=async f=>{f.loading=!0,await i.createQuoteProducts(f),f.disabled=!0,f.loading=!1},m=f=>{f.action==="backToConfiguration"?i.savedScreen=!1:f.action==="backToQuoteList"?r.push("/quote-item?id="+n.quoteId):f.link&&r.push(f.link)};async function l(){i.resetConfigurator(),r.push({path:"/configurator/"+p.value.XX_ORD1__Item__c+"/"+p.value.Id}),i.initConfigurator(p.value.XX_ORD1__Item__c,p.value.Id)}return e.onBeforeMount(async()=>{a.value=!0,await i.getProductCrossSells(),a.value=!1}),(f,h)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",ll,[e.createElementVNode("div",sl,[e.createVNode(we,{icon:"arrow",symbol:"",size:12,onClick:h[0]||(h[0]=d=>e.unref(i).savedScreen=!1)}),e.createElementVNode("h2",cl,e.toDisplayString(o.value.itemName),1)]),e.unref(i).loading.save?(e.openBlock(),e.createElementBlock("div",dl,[e.createVNode(so,{svg:""}),ul])):(e.openBlock(),e.createElementBlock("div",fl,[e.createVNode(we,{icon:"check",color:"#136E05",size:14,"data-test-id":"item-tabs-before-button-icon"}),hl]))]),a.value?(e.openBlock(),e.createBlock(lo,{key:0,type:"recommendations",rows:4})):v.value.length>0?(e.openBlock(),e.createElementBlock("div",pl,[ml,e.createElementVNode("div",gl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,(d,s)=>(e.openBlock(),e.createElementBlock("div",{key:d.Id||s,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-${d.Id||s}`},[e.createElementVNode("div",bl,[e.createElementVNode("h4",_l,e.toDisplayString(d.Name),1),e.createElementVNode("p",vl,e.toDisplayString(d.Description),1)]),e.createElementVNode("div",Cl,[e.createElementVNode("div",El,e.toDisplayString(e.unref(He)(d.Price)),1),e.createVNode(Ze,{btype:d.disabled?"secondary":"primary","button-style":d.disabled?"normal":"outlined",size:"medium",class:e.normalizeClass({"ect-w-[120px]":d.loading}),loading:d.loading,disabled:d.disabled||d.loading,"data-test-id":`configurator-recommend-button-add-${d.Id||s}`,onClick:g=>u(d)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.loading?"":d.disabled?"Added to Quote":"Add to Quote"),1)]),_:2},1032,["btype","button-style","class","loading","disabled","data-test-id","onClick"])])],8,yl))),128))])])):(e.openBlock(),e.createElementBlock("div",kl,[wl,e.createElementVNode("div",Nl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(d,s)=>(e.openBlock(),e.createElementBlock("div",{key:d.title||s,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-${s}`,onClick:g=>m(d)},[e.createElementVNode("div",Ol,[e.createVNode(we,{icon:d.icon,size:20,color:"#000000","data-test-id":`configurator-recommend-redirect-icon-${s}`},null,8,["icon","data-test-id"])]),e.createElementVNode("div",Sl,[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-${s}`},e.toDisplayString(d.title),9,Vl),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-${s}`},e.toDisplayString(d.description),9,Tl)])],8,xl))),128))])])),p.value?(e.openBlock(),e.createElementBlock("footer",Al,[e.createElementVNode("div",Il,[e.createElementVNode("h3",Bl," Configuere next product from your quote "+e.toDisplayString(c.value),1),e.createElementVNode("div",Ll,[e.createElementVNode("div",Ml,[e.createElementVNode("div",Rl,[e.createElementVNode("h4",Pl,e.toDisplayString(p.value.Name),1),e.createElementVNode("p",ql,e.toDisplayString(p.value.Description),1)]),e.createElementVNode("div",Dl,[e.createElementVNode("div",jl,e.toDisplayString(e.unref(He)(p.value.Price)),1),e.createVNode(Ze,{btype:"primary","button-style":"filled",size:"medium","data-test-id":"configurator-recommend-button-add-next-product",onClick:l},{default:e.withCtx(()=>[e.createTextVNode(" Configure Now ")]),_:1})])])])])])):e.createCommentVNode("",!0)],64))}},Fl=["data-test-id"],Hl=Ee({__name:"AppPill",props:{variant:{type:String,default:"",validator:t=>["success","error",""].includes(t)},dataTestId:{type:String,default:""}},setup(t){return(i,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(i.$slots,"default",{},void 0,!0)],10,Fl))}},[["__scopeId","data-v-c7f05fa0"]]),Ul=["data-test-id"],zl=["data-test-id"],Kl=["data-test-id","onClick"],Zl=["data-test-id"],Ql=Ee({__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(i=>typeof i=="object"&&i.title&&i.key&&(i.sections===void 0||Array.isArray(i.sections)))},dataTestId:{type:String,required:!0}},emits:["update:modelValue","tab-change"],setup(t,{emit:i}){const n=t,r=i,o=e.computed(()=>{var c;return n.modelValue||((c=n.tabs[0])==null?void 0:c.key)||""}),a=c=>{r("update:modelValue",c),r("tab-change",c)};return(c,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,p=>(e.openBlock(),e.createElementBlock("button",{key:p.key,class:e.normalizeClass(["ect-page-tab-button",`ect-page-tab-button${o.value===p.key?"-active":""} ${p.tabClass||""}`]),"data-test-id":`${t.dataTestId}-tab-${p.key}`,onClick:v=>a(p.key)},[e.createTextVNode(e.toDisplayString(p.title)+" ",1),p.pill!==void 0&&p.pill!==null?(e.openBlock(),e.createBlock(Hl,{key:0,class:"ect-ml-2",variant:p.pillStyle,"data-test-id":`${t.dataTestId}-tab-${p.key}-pill`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.pill),1)]),_:2},1032,["variant","data-test-id"])):e.createCommentVNode("",!0)],10,Kl))),128))],10,zl)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"ect-page-tab-content","data-test-id":`${t.dataTestId}-content`},null,8,Zl)],8,Ul))}},[["__scopeId","data-v-f22cb1ed"]]),Jl=["data-test-id"],Xl=["disabled","data-test-id"],Gl=["value","disabled","data-test-id"],Wl=["disabled","data-test-id"],dn={__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:i}){const n=t,r=i,o=e.computed(()=>n.min==null?0:n.min),a=e.computed(()=>n.max==null?999:n.max),c=(y,E,T)=>Math.min(Math.max(y,E),T),b=y=>{if(y==null||y==="")return NaN;const E=Number(y);return Number.isFinite(E)?E:NaN},p=e.ref(null),v=e.ref(n.value??o.value),u=y=>{v.value=c(y,o.value,a.value)};n.value!==null&&u(n.value);const m=e.computed(()=>v.value),l=e.computed(()=>p.value!=null?p.value:String(m.value)),f=e.computed(()=>n.disabled||m.value<=o.value),h=e.computed(()=>n.disabled||m.value>=a.value);function d(y){y!==n.value&&(v.value=y,r("update:value",y),r("change",y))}function s(){if(f.value)return;const y=c(m.value-1,o.value,a.value);p.value=null,d(y)}function g(){if(h.value)return;const y=c(m.value+1,o.value,a.value);p.value=null,d(y)}function _(y){const T=String(y.target.value??"").replace(/\D+/g,"");p.value=T}function C(){const y=b(p.value),E=o.value,T=c(Number.isNaN(y)?E:y,o.value,a.value);p.value=null,d(T)}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":f.value,"ect-cursor-not-allowed":f.value}]),disabled:f.value,"data-test-id":`${t.dataTestId}-decrement`,onClick:s}," - ",10,Xl),e.createElementVNode("input",{type:"text",inputmode:"numeric",pattern:"[0-9]*",value:t.empty?"":l.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,Gl),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":h.value,"ect-cursor-not-allowed":h.value}]),disabled:h.value,"data-test-id":`${t.dataTestId}-increment`,onClick:g}," + ",10,Wl)],8,Jl))}},Yl={class:"ect-flex ect-justify-end ect-items-center ect-gap-2.5 ect-px-6 ect-py-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"},es={"data-test-id":"configurator-footer-quantity"},ts={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"},ns=["data-test-id"],rs=["data-test-id"],os=["data-test-id"],is=["data-test-id"],as={__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:i}){const n=Ye(),r=t,o=e.ref(r.item),a=e.computed(()=>{const p=n.summaryPrices,v=[];return n.isRecurringPricingSchema?(v.push({label:"One Time Price",value:p.oneTimePrice,highlight:!1}),v.push({label:n.showYearlyPricing?"Yearly Price":"Monthly Price",value:p.recurringPrice,highlight:!1})):(v.push({label:"Base Price",value:p.basePrice,highlight:!1}),v.push({label:"Add Ons",value:p.addOns,highlight:!1}),v.push({label:"Total Price",value:p.total,highlight:!1})),v}),c=i,b=()=>{r.disabled||c("continue")};return(p,v)=>(e.openBlock(),e.createElementBlock("footer",Yl,[e.createElementVNode("div",es,[e.createVNode(dn,{value:o.value.qty,"onUpdate:value":v[0]||(v[0]=u=>o.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",ts,[(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,rs),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(e.unref(He)(u.value)),11,os)],8,ns),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,is)):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"])]))}},ls={class:"ect-w-full ect-bg-white ect-mb-4","data-test-id":"configurator-type-section"},ss={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"},cs={class:"ect-flex ect-flex-col"},ds={class:"ect-font-bold ect-text-text-success ect-leading-tight"},us=["innerHTML"],fs={key:0,class:"ect-flex ect-items-center ect-gap-2 ect-px-2 ect-py-1","data-test-id":"configurator-type-message"},hs={class:"ect-text-xs ect-font-medium ect-text-gray-600 ect-leading-tight ect-min-w-[190px]"},ps={class:"ect-divide-y ect-divide-gray-100 ect-overflow-y-auto"},ms={__name:"ConfiguratorType",props:{title:{type:String,required:!0},description:{type:String,default:""},message:{type:String,default:""}},setup(t){return(i,n)=>(e.openBlock(),e.createElementBlock("section",ls,[e.createElementVNode("header",ss,[e.createElementVNode("div",cs,[e.createElementVNode("h2",ds,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,us)):e.createCommentVNode("",!0)]),t.message?(e.openBlock(),e.createElementBlock("div",fs,[e.createVNode(we,{icon:"info",symbol:"",color:"#198708",size:14,"data-test-id":"configurator-type-message-icon"}),e.createElementVNode("span",hs,e.toDisplayString(t.message),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",ps,[e.renderSlot(i.$slots,"default")])]))}},gs={__name:"ShadowDisplay",props:{content:{type:String,required:!0}},setup(t){const i=t,n=e.ref(null);let r=null;return e.onMounted(()=>{n.value&&!r&&(r=n.value.attachShadow({mode:"open"}),r.innerHTML=i.content)}),e.watch(()=>i.content,o=>{r&&(r.innerHTML=o)}),(o,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"host",ref:n},null,512))}},ys=["data-test-id"],bs=["data-test-id"],_s=["data-test-id"],vs=[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)],Cs=["data-test-id"],Es=["data-test-id"],ks=["data-test-id"],ws=["data-test-id"],Ns=["data-test-id"],xs=["data-test-id","innerHTML"],et={__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 i=t,n=e.computed(()=>{const r=i.value;if(typeof r!="string")return!1;const o=new DOMParser().parseFromString(r,"text/html");return Array.from(o.body.childNodes).some(a=>a.nodeType===1)});return(r,o)=>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`},vs,8,_s),e.createTextVNode(" "+e.toDisplayString(t.label),1)],8,bs)],8,ys)):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,Es)],8,Cs)):(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,ws),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,Ns)):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createBlock(gs,{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,xs)):e.createCommentVNode("",!0)],8,ks))}},Os=["data-test-id"],Ss=["data-test-id"],Vs=["data-test-id"],Ts=["type","step","min","data-test-id"],Zn=Ee({__name:"InputEdit",props:{modelValue:{type:[String,Number],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:i,emit:n}){const r=t,o=n,a=e.ref(!1),c=e.ref(!1),b=e.ref(""),p=e.ref(null),v=e.computed(()=>r.type==="currency"?g(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),l=e.computed(()=>r.type==="currency"?"0":void 0),f=()=>{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(()=>{p.value&&(p.value.focus(),p.value.select())}))},h=()=>{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&&(o("update:modelValue",C),o("change",C)),a.value=!1},d=()=>{b.value=r.modelValue,a.value=!1},s=()=>{a.value&&h()},g=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)}),i({startEditing:f,saveChanges:h,cancelEditing:d}),(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]=T=>c.value=!0),onMouseleave:y[2]||(y[2]=T=>c.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:p,"onUpdate:modelValue":y[0]||(y[0]=T=>b.value=T),type:u.value,step:m.value,min:l.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(h,["enter"]),e.withKeys(d,["esc"])],onBlur:h},null,42,Ts),[[e.vModelDynamic,b.value]])],8,Vs)),[[E,s]]):(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:f},[(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(c.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,Ss))],40,Os)}}},[["__scopeId","data-v-5cd60070"]]),As=["data-test-id","data-publish-key"],Is={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"},Bs={key:1,class:"ect-flex ect-items-start ect-gap-4 ect-p-3 ect-px-4"},Ls={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"},Ms=["src","alt"],Rs={class:"ect-flex-1 ect-min-w-0"},Ps={class:"ect-flex ect-gap-4 ect-items-center ect-justify-between"},qs={class:"ect-flex ect-flex-row ect-gap-3"},Ds=e.createElementVNode("div",{class:"ect-w-px ect-h-auto ect-bg-gray-200 ect-mx-2"},null,-1),js={class:"ect-flex ect-flex-col ect-max-w-[125px]"},$s={class:"ect-flex ect-items-start ect-justify-center ect-ml-2 ect-mt-0"},Fs=["innerHTML"],Hs={key:0,class:"ect-flex ect-flex-wrap ect-gap-2.5 ect-mt-2"},Us=["data-test-id"],zs=["data-test-id"],Ks={key:1,class:"ect-inline-block ect-mb-2"},Zs={key:2,class:"ect-flex ect-flex-col ect-gap-3 ect-p-3 ect-h-full ect-justify-between"},Qs={class:"ect-flex ect-items-start ect-gap-2"},Js={key:0,class:"ect-w-16 ect-h-16 ect-rounded-lg ect-bg-gray-200 ect-flex-shrink-0 ect-overflow-hidden"},Xs=["src","alt"],Gs={class:"ect-flex-1 ect-min-w-0"},Ws={class:"ect-text-sm ect-font-semibold ect-text-gray-900 ect-leading-tight"},Ys=["innerHTML"],ec={class:"ect-flex ect-items-start ect-justify-center ect-ml-2 ect-mt-0"},tc={key:0,class:"ect-flex ect-flex-wrap ect-gap-1.5"},nc=["data-test-id"],rc=["data-test-id"],oc={key:1,class:"ect-inline-block ect-mb-2"},ic={class:"ect-flex ect-justify-between ect-items-center"},ac={class:"ect-flex ect-flex-col"},lc=e.createElementVNode("p",{class:"ect-text-xs ect-text-gray-500 ect-font-medium ect-leading-tight"},"Price",-1),sc={key:3,"data-test-id":"configurator-item-slot-details",class:"ect-bg-white ect-rounded-md"},cc={__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:i}){const n=t,r=i,o=e.ref(null),a=e.ref(0),c=e.ref(n.item),b=e.computed(()=>c.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"),p=e.computed({get:()=>n.quantity,set:h=>r("update:quantity",h)}),v=e.computed({get:()=>n.name,set:h=>r("update:name",h)}),u=h=>{r("update:quantity",h)},m=e.computed(()=>{if(a.value===0)return n.tags;const d=Math.floor(a.value/120);return n.tags.slice(0,Math.max(1,d))}),l=e.computed(()=>Math.max(0,n.tags.length-m.value.length)),f=()=>{if(o.value){const h=o.value,d=80,s=120,g=32,_=64;a.value=h.offsetWidth-d-s-g-_}};return e.onMounted(()=>{e.nextTick(()=>{f()})}),e.watch(()=>n.tags,()=>{e.nextTick(()=>{f()})},{deep:!0}),e.onMounted(()=>{window.addEventListener("resize",f)}),(h,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"containerRef",ref:o,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",Is," KIT ")):e.createCommentVNode("",!0),t.size===1?(e.openBlock(),e.createElementBlock("div",Bs,[t.showImage?(e.openBlock(),e.createElementBlock("div",Ls,[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,Ms)):(e.openBlock(),e.createBlock(we,{key:1,disabled:"",icon:"image",symbol:"",size:20,color:"#ACACAC"}))])):e.createCommentVNode("",!0),e.createElementVNode("div",Rs,[e.createElementVNode("div",Ps,[e.createVNode(Zn,{modelValue:v.value,"onUpdate:modelValue":d[0]||(d[0]=s=>v.value=s),tag:"h3","data-test-id":"itemId"+t.item.itemId,class:"ect-text-sm ect-font-semibold ect-text-gray-900 ect-leading-tight"},null,8,["modelValue","data-test-id"]),e.createElementVNode("div",qs,[e.createElementVNode("div",{onClick:d[2]||(d[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(dn,{value:p.value,"onUpdate:value":d[1]||(d[1]=s=>p.value=s),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"])]),Ds,e.createElementVNode("div",js,[e.createVNode(Zn,{modelValue:c.value.price,"onUpdate:modelValue":d[3]||(d[3]=s=>c.value.price=s),tag:"p",type:"currency","data-test-id":"itemId"+t.item.itemId,class:"ect-text-base ect-font-bold"},null,8,["modelValue","data-test-id"])]),e.createElementVNode("div",$s,[e.renderSlot(h.$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,Fs),t.isAttributes&&t.showAttributes&&t.selected?(e.openBlock(),e.createElementBlock("div",Hs,[c.value.getTags().length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(s,g)=>(e.openBlock(),e.createElementBlock("span",{key:g,class:"ect-inline-block"},[e.createVNode(et,{label:s.label,value:s.value},null,8,["label","value"])]))),128)),l.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:d[4]||(d[4]=e.withModifiers(()=>{},["stop"]))}," +"+e.toDisplayString(l.value)+" more ",9,Us)):e.createCommentVNode("",!0),t.selected?(e.openBlock(),e.createElementBlock("button",{key:1,"data-test-id":`configurator-item-button-edit-attributes-${t.item.itemId}`,onClick:d[5]||(d[5]=s=>r("edit-attributes"))},[e.createVNode(et,{label:"Edit attributes","edit-button":""})],8,zs)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock("span",Ks,[e.createElementVNode("button",{"data-test-id":"configurator-info-button-add-attributes",onClick:d[6]||(d[6]=s=>r("edit-attributes"))},[e.createVNode(et,{label:"Add attributes","add-button":""})])]))])):e.createCommentVNode("",!0)])])):(e.openBlock(),e.createElementBlock("div",Zs,[e.createElementVNode("div",Qs,[t.showImage?(e.openBlock(),e.createElementBlock("div",Js,[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.createCommentVNode("",!0),e.createElementVNode("div",Gs,[e.createElementVNode("h3",Ws,e.toDisplayString(t.name),1),e.createElementVNode("p",{class:"ect-mt-1 ect-text-sm ect-text-gray-700 ect-leading-tight",innerHTML:t.description},null,8,Ys)]),e.createElementVNode("div",ec,[e.renderSlot(h.$slots,"selection-control")])]),t.isAttributes&&t.showAttributes&&t.selected?(e.openBlock(),e.createElementBlock("div",tc,[c.value.getTags().length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(s,g)=>(e.openBlock(),e.createElementBlock("span",{key:g,class:"ect-inline-block"},[e.createVNode(et,{label:s.label,value:s.value},null,8,["label","value"])]))),128)),l.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:d[7]||(d[7]=e.withModifiers(()=>{},["stop"]))}," +"+e.toDisplayString(l.value)+" more ",9,nc)):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:d[8]||(d[8]=s=>r("edit-attributes"))},[e.createVNode(et,{label:"Edit attributes","edit-button":""})],8,rc)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock("span",oc,[e.createElementVNode("button",{"data-test-id":"configurator-info-button-add-attributes",onClick:d[9]||(d[9]=s=>r("edit-attributes"))},[e.createVNode(et,{label:"Add attributes","add-button":""})])]))])):e.createCommentVNode("",!0),e.createElementVNode("div",ic,[e.createElementVNode("div",{onClick:d[11]||(d[11]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(dn,{value:p.value,"onUpdate:value":d[10]||(d[10]=s=>p.value=s),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",ac,[lc,e.createVNode(Zn,{modelValue:c.value.price,"onUpdate:modelValue":d[12]||(d[12]=s=>c.value.price=s),tag:"p",type:"currency","data-test-id":"itemId"+t.item.itemId,class:"ect-w-[125px] ect-text-base ect-font-bold"},null,8,["modelValue","data-test-id"])])])])),t.selected&&t.isAttributes?(e.openBlock(),e.createElementBlock("div",sc,[e.renderSlot(h.$slots,"default")])):e.createCommentVNode("",!0)],10,As))}},dc={"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":"."},uc={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"?dc[this.locale]:"."},methods:{handlerInput(t){const i=t.target.value;this.type==="currency"?this.$emit("update:modelValue",i.replace(this.decimalSeprator,".")):this.$emit("update:modelValue",i)},preventNonNumeric(t){if(this.type==="number"){const i=this.decimalPrecision,n=t.target.value,r=t.key;if(["Backspace","ArrowLeft","ArrowRight","Delete","Tab"].includes(r)||this.allowNegatives&&r==="-")return;if(r==="."&&i===0){t.preventDefault();return}if(r==="."&&n.includes(".")){t.preventDefault();return}if(r==="."||n.includes(".")&&!n.endsWith(".")&&r!=="Backspace"){const o=n.split(".");if(o.length>1&&o[1].length>=i){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)}}},fc=["data-test-id"],hc=["for","data-test-id"],pc=["data-test-id"],mc=["id","type","name","disabled","placeholder","value","maxlength","readonly","data-test-id"],gc=["data-test-id"],yc=["data-test-id"];function bc(t,i,n,r,o,a){const c=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,hc)):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(c,{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:i[0]||(i[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:i[1]||(i[1]=(...b)=>a.handlerInput&&a.handlerInput(...b)),onKeydown:i[2]||(i[2]=(...b)=>a.preventNonNumeric&&a.preventNonNumeric(...b)),onKeyup:i[3]||(i[3]=(...b)=>a.handlerKeyup&&a.handlerKeyup(...b)),onBlur:i[4]||(i[4]=b=>t.$emit("blur"))},null,46,mc)],10,pc)):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,gc)),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,yc)):e.createCommentVNode("",!0)],8,fc)}const _c=Ee(uc,[["render",bc],["__scopeId","data-v-032ca141"]]),vc={name:"AtomSpinner",props:{dataTestId:{type:String,default:""}}},Cc=["data-test-id"];function Ec(t,i,n,r,o,a){return e.openBlock(),e.createElementBlock("div",{class:"spinner","data-test-id":n.dataTestId},null,8,Cc)}const kc={name:"CustomDropdown",components:{AppIcon:we,AtomSpinner:Ee(vc,[["render",Ec],["__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(i=>JSON.stringify(i).toLowerCase().includes(t))}else return this.options},getSelected(){let t=null;if(this.modelValue)t=this.options.find(i=>i[this.property.key]===this.modelValue);else if(!this.search){const i=this.options.find(n=>n[this.property.key]==="");i?t=i: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(),i=250,n=window.innerHeight-t.bottom,r=t.top;return n<i&&r>i},dropdownStyle(){if(!this.$refs.triggerElement)return{};const t=this.$refs.triggerElement.getBoundingClientRect(),i=250,n=window.innerHeight-t.bottom,r=t.top,o=n<i&&r>i;return{position:"absolute",top:o?"auto":"100%",bottom:o?"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(),i=200,n=window.innerHeight-t.bottom,r=t.top,o=n<i&&r>i;this.teleportStyle={position:"absolute",top:`${o?t.top-i:t.bottom}px`,left:`${t.left}px`,width:`${t.width}px`,zIndex:9999}},subFieldsText(t){if(!this.display||this.display.length<1)return"";const i=[];return this.display.forEach(n=>{const r=this.subField(t,n);r&&i.push(r)}),i.join(" | ")},subField(t,i){return i?i.split(".").reduce((o,a)=>o[a]||"",t):t},lookupSearchHandler:ro(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--}}},wc=["data-test-id"],Nc=["for","data-test-id"],xc={class:"input-container-box ect-grow ect-w-full"},Oc=["data-test-id"],Sc=["placeholder","disabled","data-test-id"],Vc=["data-test-id"],Tc=["title","data-test-id"],Ac=["data-test-id"],Ic=["data-test-id"],Bc=["data-test-id"],Lc=["data-test-id"],Mc=["data-test-id","onClick"],Rc=["data-test-id"],Pc={class:"ect-text-font-clr-light ect-flex ect-gap-2 ect-items-center ect-justify-between ect-w-full"},qc=["data-test-id"],Dc=["data-test-id"],jc=["data-test-id"],$c=["title","data-test-id"],Fc=["data-test-id"];function Hc(t,i,n,r,o,a){const c=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:i[7]||(i[7]=p=>t.isHover=!0),onMouseleave:i[8]||(i[8]=p=>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,Nc)):e.createCommentVNode("",!0),e.createElementVNode("div",xc,[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:i[2]||(i[2]=(...p)=>a.handlerFocusIn&&a.handlerFocusIn(...p)),onFocusout:i[3]||(i[3]=p=>a.onInputFocusedOut(!1)),onKeydown:[i[4]||(i[4]=e.withKeys(p=>a.updateSelected(n.options[t.highlightedIndex]),["enter"])),i[5]||(i[5]=e.withKeys(e.withModifiers((...p)=>a.highlightPreviousOption&&a.highlightPreviousOption(...p),["prevent"]),["up"])),i[6]||(i[6]=e.withKeys(e.withModifiers((...p)=>a.highlightNextOption&&a.highlightNextOption(...p),["prevent"]),["down"]))]},[!n.modelValue&&n.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref:"searchInput","onUpdate:modelValue":i[0]||(i[0]=p=>t.value=p),type:"text",name:"search",placeholder:n.placeholder,autocomplete:"off",disabled:n.disabled,"data-test-id":`${n.dataTestId}-search-input`,onInput:i[1]||(i[1]=e.withModifiers(p=>a.lookupSearchHandler(p.target.value),["prevent"]))},null,40,Sc)),[[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(c,{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,Tc),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,Ac)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],10,Vc)),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(c,{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(c,{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,Ic))],64)):(e.openBlock(),e.createBlock(c,{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,Oc),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,Bc)):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,(p,v)=>(e.openBlock(),e.createElementBlock("div",{key:p[n.property.key],class:e.normalizeClass(["dropdown-item",{highlighted:v===t.highlightedIndex,"ect-pointer-events-none":p[n.property.assigned]}]),"data-test-id":`${n.dataTestId}-option-${v}`,onClick:u=>a.updateSelected(p)},[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":p[n.property.assigned]}),"data-test-id":`${n.dataTestId}-option-${v}-value`},e.toDisplayString(p[n.property.value]==null?"Key and Value is Wrong":p[n.property.value]),11,qc),p[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,Dc)):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(p[n.badge]),9,jc)):e.createCommentVNode("",!0)],8,Rc),e.createElementVNode("div",{class:"info",title:a.subFieldsText(p),"data-test-id":`${n.dataTestId}-option-${v}-info`},[e.createElementVNode("span",null,e.toDisplayString(a.subFieldsText(p)),1)],8,$c)],10,Mc))),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,Fc)):e.createCommentVNode("",!0)],14,Lc)):e.createCommentVNode("",!0)])],42,wc)}const yo=Ee(kc,[["render",Hc],["__scopeId","data-v-5ae4f6dc"]]);var Oe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _o={exports:{}};/*!
|
|
6
6
|
* Quill Editor v1.3.7
|
|
7
7
|
* https://quilljs.com/
|
|
8
8
|
* Copyright (c) 2014, Jason Chen
|