expedite-components 0.1.1 → 0.1.4
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.
- package/README.md +1 -1
- package/dist/expedite-components.css +1 -1
- package/dist/expedite-components.es.js +666 -666
- package/dist/expedite-components.umd.js +2 -2
- package/dist/style.css +1 -0
- package/dist/vue-expedite-components.js +24215 -0
- package/dist/vue-expedite-components.umd.cjs +86 -0
- package/package.json +1 -1
|
@@ -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 uo;(function(t){t.pop="pop",t.push="push"})(uo||(uo={}));var fo;(function(t){t.back="back",t.forward="forward",t.unknown=""})(fo||(fo={})),Symbol(process.env.NODE_ENV!=="production"?"navigation failure":"");var ho;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(ho||(ho={})),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 Kn(){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 Zn={xx_ord1__item__c:"xx_ord1__item__c",xx_ord1__sales_price__c:"xx_ord1__negotiated_price__c",xx_ord1__nrc__c:"xx_ord1__nrc_for_new__c",xx_ord1__line_description__c:"xx_ord1__line_description__c",xx_ord1__list_price__c:"xx_ord1__list_price2__c",xx_ord1__cost__c:"xx_ord1__cost2__c",xx_ord1__rate_plan__c:"xx_ord1__rate_plan__c",xx_ord1__allowed_discount__c:"xx_ord1__allowed_discount__c",xx_ord1__billing_period__c:"xx_ord1__billing_period__c",xx_ord1__ship_to_account__c:"xx_ord1__ship_to_account__c",xx_ord1__erp_item_number__c:"xx_ord1__erp_item_number__c",xx_ord1__mrc__c:"xx_ord1__mrc__c",xx_ord1__qty__c:"xx_ord1__qty__c",id:"id"},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=Zn[a==null?void 0:a.toLowerCase()])==null?void 0:n.trim())||"";c&&(i.includes(c)||i.push(c||""),i.push(r))}else i.includes(Zn[r==null?void 0:r.toLowerCase()])||i.push(Zn[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,h=!1)=>{console.info("openAdaptiveSearch",b),t.chatHistory[t.chatHistory.length-1].links=[],t.sendMessage("Open Adaptive Search",!1,{internalCall:!0}),n.value=h},openQuoteItem:b=>{console.info("openQuoteItem",b),t.chatHistory[t.chatHistory.length-1].links=[],t.sendMessage("Open Quote Item",!1,{internalCall:!0})},openQuoteDocument:b=>{console.info("openQuoteDocument",b),t.chatHistory[t.chatHistory.length-1].links=[],t.chatHistory.push({type:"response",message:"Opening quote document",loading:!0});const v=`/apex/XX_ORD1__Expedite_Commerce?scpq=true&oid=${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),h=e.ref([]),v=e.ref(""),u=e.ref(!1),g=e.ref(null),s=e.ref(!1),m=e.ref([]),d=it(),f=e.ref([]),l=e.ref(0),p=e.ref(!1),_=e.ref({rowLimt:10,paging:!0,offset:0,currentPage:1,totalPages:1});async function C(){c.value=!0;try{const x=JSON.stringify({layoutType:"Search Selection",layoutObject:"xx_ord1__ecatalog_item__c"});let L={};return L=await window.salesforceConnector.getDynamicPageLayout(x),a.value=lo(L,"Unable to find the Search Selection Layout for your user profile"),_.value.rowLimt=a.value.configuration.rowLimit||10,a.value.configuration.columns.forEach(O=>{!O.field&&O.label==="QTY"&&(O.field="xx_ord1__qty__c")}),c.value=!1,y(),L}catch(x){c.value=!1,d.handleError("Failed to get Adaptive Search Layout. Please try again."),console.info("[ERROR]: getAdaptiveSearchLayout() error = ",x)}}function y(){var x,L,O;g.value=(O=(L=(x=a.value)==null?void 0:x.configuration)==null?void 0:L.dynamicFilters)==null?void 0:O.filters.map(q=>({...q,field:q.field.toLowerCase(),filtervalue:q.filtervalue||[],filtervaluefrom:q.filtervaluefrom||"",filtervalueTo:q.filtervalueTo||""}))}function E(){var L;let x=[];for(const O of a.value.configuration.columns){let q=O.field;if(x.includes(q)||x.push(q),q!=null&&q.includes(".")){let I=q.split(".")[0];I=I.slice(0,-1)+"c",x.includes(I)||x.push(I)}}return(L=a.value.configuration)!=null&&L.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(O=>!!O),x.filter(O=>O.toLowerCase()!=="xx_ord1__qty__c"&&O.toLowerCase()!=="xx_ord1__competitor_sku__c")}function A(x,L=!1){if(!x||x.includes("undefined"))return!1;const O=/[!@#$%^&*()+=[\]{};':"\\|.<>/?]+/;if(L){const q=Array.isArray(x)?x:x.split(",");for(const R of q){const I=R.trim();if(O.test(I))return d.handleError(`Invalid character found in value: ${I}`),!1}}else if(O.test(x))return d.handleError("Special characters are not allowed in filter values"),!1;return!0}function S(x,L){return{field:x.field,operator:x.operator||"contains",value:L,dataType:x.dataType.trim()}}function T(x){if(!x.filtervalue)return null;const L=Array.isArray(x.filtervalue),O=L?x.filtervalue.join(","):x.filtervalue.trim();return A(O,L)?O:null}function B(x){var R,I;const L=(R=x.filtervaluefrom)==null?void 0:R.trim(),O=(I=x.filtervalueTo)==null?void 0:I.trim();if(!L||!O)return null;const q=`${L}, ${O}`;return q!==", "&&A(q)?q:null}function V(x){const L=`${ao(x.filtervaluefrom)}, ${ao(x.filtervalueTo)}`;return L!==", "&&A(L)?L:null}function w(x){var O;const L=(O=x.filtervaluefrom)==null?void 0:O.trim();return A(L)?L:null}function N(x){const L=[];return x.forEach(O=>{const q=O.dataType.trim();let R=null;switch(q){case"PICKLIST":case"MULTIPICKLIST":R=T(O);break;case"DOUBLE":case"CURRENCY":R=B(O);break;case"DATETIME":case"DATE":R=V(O);break;default:R=w(O)}R&&L.push(S(O,R))}),m.value=L,L}async function M(x="",L=[],O=[]){var R,I,D,H,F,z,J,G,oe,ae;let q=[];if(L.length&&(q=N(L)),!q.length&&x.trim()===""){h.value=[],u.value=!1;return}try{u.value=!1,b.value=!0;const ce=x.trim();O.length||(O=E());const ye={fields:O,...L.length?{dynamicFilters:q}:{},searchText:ce||v.value.trim(),accountId:i.accountId,...i.eCatalogId?{catalogId:i.eCatalogId}:{},...i.objectType==="opportunity"?{opportunityId:i.id}:{},...(I=(R=a.value)==null?void 0:R.configuration)!=null&&I.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:(H=(D=a.value)==null?void 0:D.configuration)==null?void 0:H.rowLimit,paging:(z=(F=a.value)==null?void 0:F.configuration)==null?void 0:z.paging,...((J=_.value)==null?void 0:J.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){d.handleError(de.errorMessage);return}de!=null&&de.itemCount&&(_.value.totalPages=Math.ceil((de==null?void 0:de.itemCount)/_.value.rowLimt)),h.value=on(de.lstItems,{xx_ord1__qty__c:"1"}),(ae=de.lstItems)!=null&&ae.length||(u.value=!0),b.value=!1}catch(ce){d.handleError("Failed to fetch Results. Please try again."),b.value=!1,console.info("[ERROR]: Adaptive Search getItems() error = ",ce)}}async function $(x){try{s.value=!0;const L=JSON.stringify({lstQLIRequest:U(x),quoteId:t.quoteId});let O=await window.salesforceConnector.createQLI(L);typeof O=="string"&&(O=JSON.parse(O));let q=!1;if((O==null?void 0:O.length)>0&&O.forEach(R=>{R.errorMessage&&(q=!0,d.handleError(R.errorMessage))}),s.value=!1,q){f.value=O;const R=f.value.reduce((I,D)=>(I[D.eCatalogItemId]=D.errorMessage,I),{});h.value=h.value.map(I=>({...I,backendError:R[I.Id]||""}));return}return O}catch(L){d.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addToQuote() error = ",L)}}function U(x){const L=[];for(const O of x)if(!O.addedToQuote&&O.id){const q=Q(O);l.value++,L.push({fields:q,recordId:O.id,...x.length===1?{maxSequenceNumber:l.value}:{}})}return L}function Q(x){const L=[],O=X();return Object.keys(x).forEach(q=>{if(O.includes(q)){const R=po[q.toLowerCase()];R&&L.push({fieldname:R,value:x[q]})}}),L}function X(){const x=[];return a.value.configuration.columns.forEach(L=>{L.field&&!L.field.includes(".")&&L.isEditable&&L.visible&&x.push(L.field)}),x}function te(){var L,O;const x=[];return a.value.configuration.columns.forEach(q=>{const R=q.field.toLowerCase();x.includes(R)||x.push(R)}),(L=a.value.configuration)!=null&&L.dynamicFilters&&a.value.configuration.dynamicFilters.filters.forEach(q=>{const R=q.field.toLowerCase();x.includes(R)||x.push(R)}),(O=a.value.configuration)!=null&&O.cardHeader&&x.push(a.value.configuration.cardHeader.imageField),x}async function Z(){var O;const x=te(),L=((O=a.value.configuration)==null?void 0:O.saveObjectName)||a.value.configuration.objectName;if(L==="xx_ord1__ecatalog_item__c"){const q=x.indexOf("xx_ord1__qty__c");q>-1&&x.splice(q,1)}await t.getFieldsData(x,L),t.fieldsData.xx_ord1__qty__c||t.getFieldsData(["xx_ord1__qty__c"],"xx_ord1__quote_line_item__c")}async function P({searchTerm:x="",filters:L=[]}={}){if(p.value=!0,x&&(v.value=x),L.length&&(m.value=L),await C()){await Z(),p.value=!1;const q=v.value;q&&(v.value=q,await M(q,t.dynamicFilters)),console.info("actionStore.isStaticActionCall = ",r.isStaticActionCall),r.isStaticActionCall&&(r.isStaticActionCall=!1,n.chatHistory[n.chatHistory.length-1]={type:"response",message:"Adaptive search is now open. Please search for the products you require and add it quote",loading:!1,links:[{action:"quoteItem",label:"Quote Item"},{action:"quoteDocument",label:"Quote Document"}]})}p.value=!1}return{selectedItem:o,AdaptiveSearchLayout:a,searchText:v,loadingAdaptiveLayout:c,getAdaptiveSearchLayout:C,getItems:M,lstItems:h,rowItemsLoading:b,noSearchRecords:u,dynamicFilters:g,setDynamicFilters:y,createQliErrors:f,addToQuote:$,addingToQuote:s,getFieldsData:Z,pagingData:_,appliedDynamicFilters:m,maxSequenceNumber:l,loadingAdaptiveSearch:p,initAdaptiveSearch:P}}),za=Ke.defineStore("quickSelection",()=>{const t=it(),i=Rt(),n=ut(),r=e.ref(null),o=e.ref(!1),a=e.ref([]),c=e.ref([]),b=e.ref(!1),h=e.ref({}),v=e.ref({rowLimit:10,paging:!0,offset:0,currentPage:1,totalPages:1}),u=e.ref(!1);async function g(){o.value=!0;try{const E=JSON.stringify({layoutType:"Quick Selection",layoutObject:"xx_ord1__ecatalog_item__c",...i.objectType?{contextObject:i.objectType}:{}});let A={};A=await window.salesforceConnector.getDynamicPageLayout(E),r.value=lo(A,"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(S=>{!S.field&&S.label==="QTY"&&(S.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 s(){const E=new Map;return r.value.data.columns.forEach(A=>{E.set(A.field,!0)}),r.value.data.searchResultColumns.forEach(A=>{E.set(A.field,!0)}),Array.from(E.keys())}async function m(E){var A,S;try{let T=await window.salesforceConnector.saveCompetitorSKU(E);if(T!=null&&T.errorMessage){t.handleError(T.errorMessage);return}if((A=T[0])!=null&&A.errorMessage){t.handleError((S=T[0])==null?void 0:S.errorMessage);return}return T}catch(T){t.handleError("Failed to Match Item. Please try again."),console.info("[ERROR]: saveCompetitorSKU() error = ",T)}}async function d(E="",A=[]){try{let S=r.value.data,T=r.value.configuration;const B=E.trim();if(console.info("searchTextValue.trim() = ",E.trim()),!B)return[];let V=null;console.info("useMappings = ",u.value),u.value?V=Ha(f()):V=f(),console.info("fields before filter = ",V),V=V.filter($=>$!=="xx_ord1__qty__c"),console.info("fields after filter = ",V);const w={fields:V,...A.length?{dynamicFilters:n.getDynamicFilters(A)}:{},searchText:B,accountId:i.accountId,...i.eCatalogId?{catalogId:i.eCatalogId}:{},...i.objectType==="opportunity"?{opportunityId:i.id}:{},...S!=null&&S.sort?{primarySortBy:S.sort.primary.field,primarySortOrder:S.sort.primary.direction,secondarySortBy:S.sort.secondary.field,secondarySortOrder:S.sort.secondary.direction}:{},rowLimt:(T==null?void 0:T.rowLimit)||20,paging:(T==null?void 0:T.paging)||!1,...v.value.offset!==0?{offset:v.value.offset}:{},objectName:S.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(S){t.handleError("Failed to fetch Results. Please try again."),console.info("[ERROR]: getQuickSelectionItems() error = ",S)}}function f(){let E=[];for(const A of r.value.data.columns){let S=A.field;if(S!=null&&S.includes(".")){E.includes(S)||E.push(S);let B=S.split(".")[0];B=B.slice(0,-1)+"c",E.includes(B)||E.push(B)}else E.includes(S)||E.push(S)}return console.info("getAllQuickSelectionFields() fields = ",E),E.filter(A=>A.toLowerCase()!=="xx_ord1__qty__c")}async function l(E,A,S,T){console.info("searchText:",JSON.stringify(E)),console.info("row:",JSON.stringify(A)),console.info("rowIndex:",JSON.stringify(S)),console.info("column:",JSON.stringify(T));const B=S+(v.value.currentPage-1)*v.value.rowLimit;if(T.field.toLowerCase().includes("xx_ord1__item__r")){if(a.value[B].itemLookupLoading=!0,u.value=!0,c.value=await d(E),c.value.length>0){const V=[];for(let w=0;w<c.value.length;w++)a.value[B].itemDataRetrieved=!0,c.value[w].xx_ord1__item__c&&V.push({name:c.value[w]["xx_ord1__item__r.name"],value:c.value[w].xx_ord1__item__c,label:c.value[w][T.field.toLowerCase()]});a.value[B][T.field.toLowerCase()+"_options"]=V}a.value[B].itemLookupLoading=!1}else if(T.field.toLowerCase().includes("xx_ord1__competitor_item__r")){a.value[B].competitorLookupLoading=!0;const V=await p(E);V!=null&&V.items&&(a.value[B][T.field.toLowerCase()+"_options"]=V.items.map(w=>({name:w.fields[2].value,value:w.fields[1].value,label:w.fields[0].value}))),a.value[B].competitorLookupLoading=!1,console.info("getLookupData:: Search Lookup Handler Response = ",V)}}async function p(E){var S,T;console.info("getLookupData() searchText = ",E);const A={searchText:E,obj:"xx_ord1__competitor_item__c",filters:null,displayFields:["xx_ord1__sku__c"]};try{let B=await window.salesforceConnector.getLookupData(JSON.stringify(A));if(typeof B=="string"&&(B=JSON.parse(B)),B!=null&&B.errorMessage){t.handleError(B.errorMessage);return}if((S=B[0])!=null&&S.errorMessage){t.handleError((T=B[0])==null?void 0:T.errorMessage);return}return B}catch(B){t.handleError("Failed to Search For Item. Please try again."),console.info("[ERROR]: getLookupData() error = ",B)}}async function _(E,A){var T;console.info("Update Other Fields Value = ",E),console.info("Update Other Fields Row Index = ",A);const S=A+(v.value.currentPage-1)*v.value.rowLimit;console.info("actualRowIndex = ",S);try{if(E){const B=c.value.filter(V=>V.xx_ord1__item__c===E)[0];if(B){b.value=!0;const V=r.value.data.columns[1].field;a.value[S][V]&&await C(B,S),(T=a.value[S])!=null&&T.itemDataRetrieved&&(a.value[S].status="New Match Requested",a.value[S].noMatchCleared=!0),Object.keys(B).forEach(w=>{const N=po[w.toLowerCase()];console.info("Mapped Key = ",N),N&&(a.value[S][N]=B[w])}),b.value=!1}else a.value[S].status=""}else a.value[S].status="No Match"}catch(B){t.handleError("Unable to request a match for this item please try again."),console.info("Error in updateOtherFields = ",B)}}async function C(E,A){const S=a.value[A],T=r.value.data.columns[1].field,B=[{sku:S[T],name:S[T],productDescription:S.xx_ord1__line_description__c||"",productURL:null,status:"Match Requested",competitorAccountId:null,itemId:E.xx_ord1__item__c}];let V=await m(JSON.stringify(B));console.info("Match Item: ",JSON.stringify(V)),a.value[A][`${T}_options`]=[{value:V[0].competitorItemId,label:V[0].sku}],a.value[A][T]=V[0].competitorItemId}async function y(E){try{let A=await window.salesforceConnector.createQLI(JSON.stringify(E));typeof A=="string"&&(A=JSON.parse(A));let S=!1;if((A==null?void 0:A.length)>0)for(let T=0;T<A.length;T++)A[T].errorMessage&&(S=!0,A[T].errorMessage.includes("Line Description: data value too large")&&(A[T].errorMessage="Error: The description is too long—it must be under 200 characters."));if(S){A.forEach(T=>{h.value[T.eCatalogItemId]=T});return}else h.value=[];return A}catch(A){t.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addAllItemsToQuote() error = ",A)}}return{quickSelectionLayout:r,quickSelectionLayoutLoading:o,processedRecords:a,useMappings:u,currentSearchData:c,createQliErrors:h,getQuickSelectionLayout:g,getAllFieldsForQuickSelectionLayout:s,saveCompetitorSKU:m,getQuickSelectionItems:d,searchLookupHandler:l,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=at(),a=Kn(),c=e.ref(""),b=e.ref(""),h=e.ref([]),v=e.ref(""),u=e.ref([]),g=e.ref(!1),s=e.ref(null),m=ln(),d=e.ref({}),f=e.ref(null),l=e.ref(null),p=e.ref(null),_=e.ref(null),C=e.ref(null),y=e.ref(Ka),E=e.ref([]),A=e.computed(()=>t.orgId+"__"+t.user.Id+"__"+i.quoteId),S=e.computed(()=>s.value.readyState==WebSocket.OPEN),T=()=>{d.value={salesforceOrgId:t.orgId,salesforceOrgType:t.orgType,salesforceUserId:t.user.Id,userType:"Salesforce",chatRoomId:A.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 B(){const F=b.value+"?chatRoomId="+A.value;s.value=new WebSocket(F),s.value.addEventListener("open",V),s.value.addEventListener("message",M),s.value.addEventListener("close",w),s.value.addEventListener("error",N)}const V=()=>{$(),X()},w=()=>{U()},N=()=>{q(),U()},M=F=>{var J,G;$();const z=JSON.parse(F.data);if(z.status!=="ALIVE"){if(z.loading){y.value=z.message;return}else Array.isArray(z.messages)?(y.value=null,h.value.push(Za),z.messages.length>0&&x(z.messages)):z.agentResponse&&(z.errorMessage&&(z.agentResponse.content=z.errorMessage,z.agentResponse.error=!0),y.value=null,h.value.push({message:z.agentResponse.content,type:z.agentResponse.role,requestId:z.requestId,epoch:z.agentResponse.epoch,error:z.agentResponse.error,isDML:z.agentResponse.isDML,...(J=z.agentResponse)!=null&&J.filesData?{filesData:(G=z.agentResponse)==null?void 0:G.filesData}:{}}));E.value=z.links||[],I(z)}},$=()=>{U(),f.value=setTimeout(()=>{if(S.value){const F={action:"heartbeat"};s.value.send(JSON.stringify(F)),$()}},Qa)},U=()=>{f.value&&(clearInterval(f.value),f.value=null)};function Q(F){const z={...d.value};z.requestType="Action",z.actionType="Undo",z.undoRequestId=F,z.requestId=wt(),P(z)}function X(){const F={...d.value};F.requestType="Action",F.actionType="History",F.requestId=wt(),P(F)}function te(F){return a.path.startsWith("/configurator")&&o.isChangedConfiguration?(_.value={save:()=>{o.maintainQuoteConfiguration()}},c.value=F,!0):(c.value="",!1)}function Z(F,z=!0,J=null){if(!te(F)&&F.trim()){let G={...d.value};G.prompt=F.trim(),G.requestType="Chat",G.requestId=wt(),G.internalCall=!1,G.payload=L(),G.componentName=O.value,G.templateId=i.templateId,G.payload.lineItemsCount=i.lineItemsCount,J&&(G={...G,...J}),R(),z&&h.value.push({message:F.trim(),type:"user",...C.value&&{fileData:[C.value]},requestId:G.requestId}),P(G),$()}}function P(F){const z={action:"prompt",data:F};s.value.send(JSON.stringify(z))}const x=F=>{const z=F.filter(({content:J})=>!!J).map(J=>({message:J.content,type:J.role,requestId:J.requestId,epoch:J.epoch,isDML:J.isDML,undone:J.undone}));z.forEach((J,G)=>{J.isDML===!0&&G!==z.length-1&&(J.isDML=!1)}),h.value=[...h.value,...z]};function L(){return a.path==="/quote-item"?i.getPayload():{}}const O=e.computed(()=>a.path==="/quote-item"?"QuoteItem":""),q=()=>{h.value.push({type:"response",message:"Oops! Something went wrong while processing your request. Please try again later.",error:!0})},R=()=>{h.value=h.value.map(F=>({...F,links:[]}))};function I(F){var G,oe,ae;const z=((G=F==null?void 0:F.redirectObjects)==null?void 0:G.componentName)||(F==null?void 0:F.componentName),J=(F==null?void 0:F.redirectObjects)||{};if(z==="AdaptiveSearch"){const ce=(oe=F==null?void 0:F.payload)==null?void 0:oe.searchTerm,ye=(ae=F==null?void 0:F.payload)==null?void 0:ae.applyFilters;ce&&ce!==n.searchText&&n.initAdaptiveSearch({searchTerm:ce,filters:ye}),m.push("/adaptive-search")}else z==="Configurator"?m.push(`/configurator/${J.itemId}/${J.qliId}`):z==="QuoteReview"?m.push("/quote-item"):z==="QuoteItem"||z==="QuoteList"?(m.push("/quote-item"),i.performAIAction(F)):z==="QuickSelection"&&(r.quickSelectionLayout=F.payload,console.info("Loading QuickSelection data = ",JSON.stringify(r.quickSelectionLayout)),m.push("/match-records"))}function D(){if(S.value){const F={action:"cancel",data:{requestId:d.value.requestId,chatRoomId:A.value}};s.value.send(JSON.stringify(F))}}const H=()=>{l.value&&(clearInterval(l.value),l.value=null),f.value&&(clearInterval(f.value),f.value=null),p.value&&(clearTimeout(p.value),p.value=null)};return e.onBeforeUnmount(()=>{H()}),{unsavedChanges:_,loadingMessage:y,promptMessage:c,buttonLinks:E,websocketUrl:b,chatHistory:h,latestDMLRequest:v,strikethroughHistory:u,attachmentData:C,dataManuallyChanged:g,undoAction:Q,connectSocket:B,sendMessage:Z,setInitialPayload:T,cancelRequest:D}}),Rt=Ke.defineStore("root",()=>{const t=sn(),i=it(),n=ut(),r=e.ref(""),o=e.ref(""),a=e.ref("Genesis AI"),c=e.ref(""),b=e.ref({}),h=e.ref(""),v=e.ref(""),u=e.ref(""),g=e.ref(""),s=e.ref({}),m=e.ref(""),d=e.ref(""),f=e.ref(""),l=e.ref(""),p=e.ref(""),_=e.ref(""),C=e.ref(""),y=e.ref("Single"),E=e.ref("closed"),A=e.computed(()=>n.quoteName),S=e.computed(()=>y.value==="Single");async function T(N){r.value=N||io("id"),o.value=io("origin"),await V(),await B()}async function B(){try{console.info("getRecordInfo",r.value);let N=await window.salesforceConnector.getRecordInfo(r.value);return N=qe(N),N!==void 0&&(s.value=N,m.value=N.name,d.value=N.objectType,f.value=N.accountId,l.value=N.eCatalogId,p.value=N.currencyCode,_.value=N.userLocale,C.value=N.opportunityId),(N==null?void 0:N.objectType)==="XX_ORD1__Quote__c"?(n.quoteId=N==null?void 0:N.recordId,n.templateId=N==null?void 0:N.templateId,n.quoteName=N==null?void 0:N.name,n.lineItemsCount=(N==null?void 0:N.lineItemsCount)||0):(N==null?void 0:N.objectType)==="Opportunity"&&await n.getPrimaryQuote(N.recordId),N}catch(N){i.handleError(N.message)}}async function V(){var M,$;console.info("getOrgInformation",r.value);const N=await window.salesforceConnector.getOrgInformation();t.websocketUrl=N.websocketUrl,c.value=(M=N.locale)==null?void 0:M.replace("_","-"),b.value=N.user,h.value=N.orgName,v.value=N.orgId,u.value=N.orgType,g.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:A,subTitle:a,locale:c,user:b,orgName:h,orgId:v,orgType:u,packageVersion:g,objectType:d,recordInfo:s,name:m,accountId:f,eCatalogId:l,currencyCode:p,userLocale:_,opportunityId:C,pricingSchema:y,isSinglePricingSchema:S,flyoutState:E,start:T,getRecordInfo:B,setSubTitle:w}}),Xa="XX_ORD1__Quote__c",Ja="xxord1salespricec",cn="xx_ord1__item__c",Ga="xxord1productnrcc",Wa=Ke.defineStore("cartStore",()=>{const t=ut(),i=mo(),n=it(),r=e.ref(""),o=e.ref("$0"),a=e.ref("$0"),c=e.ref(null),b=e.ref({}),h=e.ref({}),v=e.ref({}),u=e.ref(""),g=e.ref(""),s=e.ref({}),m=e.ref(""),d=e.ref(""),f=e.ref({});async function l(){A()}async function p(){try{let B=await window.salesforceConnector.getProductCount(t.quoteId);if(B=qe(B),B!=null&&B.errorMessage){n.handleError(B.errorMessage);return}return r.value=B,B}catch{n.handleError("Failed to get Product Count. Please try again.")}}async function _(){try{let B=await window.salesforceConnector.getQuoteTotal(t.quoteId);if(B=qe(B),B!=null&&B.errorMessage){n.handleError(B.errorMessage);return}return a.value=B.monthlyTotal,o.value=B.onetimeTotal,B}catch{n.handleError("Failed to get Total Amount. Please try again.")}}async function C(B,V,w,N=""){if(!t.sectionDataMap.get(w).parentQLIs[V].removingItem){t.sectionDataMap.get(w).parentQLIs[V].removingItem=!0,d.value=B.id,await y(B.id)==="Success"&&(t.fetchAllQuoteLineItems(),N&&N(B,V,w));let $=t.sectionDataMap.get(w).parentQLIs.filter(U=>U[cn]===B[cn]).length;d.value="",i.lstItems.forEach(U=>{U[cn]===B[cn]&&(U.addedToQuote===!0&&(U.addedToQuote=!1),$===0&&(U.removedFromQuote=!0))})}}async function y(B){try{let V=await window.salesforceConnector.deleteQLI(B);if(V!=null&&V.errorMessage){n.handleError(V.errorMessage);return}return p(),_(),V}catch{n.handleError("Failed to remove Quote Item. Please try again.")}}function E(B){var N,M;const V=(N=B==null?void 0:B[Ga])==null?void 0:N.match(/\.\d+/);V&&(V.value=V[0].length-1);const w=(M=B==null?void 0:B[Ja])==null?void 0:M.match(/\.\d+/);return w&&(w.value=w[0].length-1),V||w}function A(B=!0){p(),_(),B&&t.fetchTemplates(Xa).then(()=>{t.getFilteredListWithFields()})}function S(B){const V=t.sectionDataMap;for(const[,w]of V.entries())w.parentQLIs.forEach(N=>{N.id===B.id&&(w.columns.forEach(M=>{if(M.dataType==="CURRENCY"){const $=M.field.replace(/_/g,"");N[$]=T(N[$],B[M.field])}}),B!=null&&B.billingPeriodValue&&(B!=null&&B.formattedBillingPeriodValue)&&(N.formattedBillingPeriodValue=T(N.formattedBillingPeriodValue,B.billingPeriodValue)),B!=null&&B.oneTimeValue&&(B!=null&&B.formattedOneTimeValue)&&(N.formattedOneTimeValue=T(N.formattedOneTimeValue,B.oneTimeValue)))})}function T(B,V){const w=Number(V);if(isNaN(w))return B;const N=B.match(/(\d[\d,]*)(\.\d+)?/);if(!N)return B;const M=N[2]||"",$=M.length?M.length-1:0,U=w.toLocaleString("en-US",{minimumFractionDigits:$,maximumFractionDigits:$});return B.replace(N[1]+M,U)}return{initializeCart:l,loadCartState:A,productCount:r,onetimeTotal:o,monthlyTotal:a,filterCartItem:c,billingPeriodValue:u,hasOneTimeValue:g,hasBillingPeriodInList:b,oneTimeFieldAvailable:h,billingPeriodFieldAvailable:v,priceDecimalPrecision:s,cartItemUpdatingId:m,removingItemLoaderId:d,cartItemColumnsMap:f,getProductCount:p,getQuoteTotal:_,removeItem:C,removeQuoteItem:y,getDecimalPrecisionFromSalesPriceOrNRC:E,updateFormattedValues:S,formateCurrencyValue:T}}),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=it(),i=Wa(),n=Rt(),r=e.ref(""),o=e.ref(""),a=e.ref(0),c=e.ref(""),b=e.ref([]),h=e.ref({template:!0,filteredList:!1}),v=e.ref(null),u=e.ref(new Map),g=e.ref({}),s=e.ref(!1),m=e.ref(!0),d=e.ref(!1),f=e.ref({text:"Hide Options",altText:"Show Options",handler:()=>{m.value=!m.value,T()},color:"#136E05",isActive:!1}),l=e.computed(()=>{const P=Array.from(u.value.values()).map(x=>x.sectionName);return Ya(P)});e.watch(c,()=>{h.value.template||S()});function p(){const P=new Map,x=[];for(const[O,q]of u.value.entries())P.set(O,q.selected),x.push(q);const L=JSON.parse(JSON.stringify(x));return L.forEach(O=>{delete O.selected;const q=new Map,R=[];O.lineItems.forEach(I=>{I.Selected=P.get(O.tableId).get(I.id)||!1,I.xx_ord1__parent_qli__c?(q.has(I.xx_ord1__parent_qli__c)||q.set(I.xx_ord1__parent_qli__c,[]),q.get(I.xx_ord1__parent_qli__c).push(I)):R.push(I)}),O.lineItems=R.map(I=>({...I,options:q.get(I.id)||[]})),delete O.loading,delete O.parentQLIs,delete O.totalValues}),{showOptions:m.value,sections:L,templateId:c.value}}async function _(P){try{let x=await window.salesforceConnector.getPrimaryQuote(P);x=qe(x),x!==void 0&&(console.info("getPrimaryQuote",JSON.stringify(x)),r.value=x.recordId,console.info("quoteId",r.value),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(P){var x,L;try{h.value.template=!0;let O=await window.salesforceConnector.fetchContentTemplates(JSON.stringify({lstObjectName:[P],templateType:"Document",templateId:null,fetchOnlyDefault:!1}));O=qe(O);const q=O==null?void 0:O.templates[P];return c.value||(c.value=(x=q.find(R=>R.XX_ORD1__Default__c))==null?void 0:x.Id),c.value||(c.value=(L=q[0])==null?void 0:L.Id),b.value=q,h.value.template=!1,b.value}catch(O){t.handleError(O.message),console.info("[ERROR]: fetchTemplates() error = ",O)}}function y(P){if(!P)return null;const x=/\{!\$(\w+):([\w.]+)\}/,L=P.match(x);return L?{function:L[1],apiname:L[2].split(".")[1]}:null}async function E(P){try{const x={Id:r.value,XX_ORD1__Document_Template__c:P};return await window.salesforceConnector.updateQuote(JSON.stringify([x]))}catch(x){t.handleError(x.message),console.info("[ERROR]: updateQuote() error = ",x)}}async function A(){try{h.value.filteredList=!0;let P=await window.salesforceConnector.getQuoteEPageLayout();u.value.clear(),i.cartItemColumnsMap={},P=qe(P);const x=P.map(O=>({label:O.fieldLabel,field:O.fieldName.toLowerCase(),isEditable:O.isEditable,dataType:O.dataType,...O.picklistValues?{picklistValues:O.picklistValues}:{}})),L=wt();return u.value.set(L,{loading:!0,lineItems:[],parentQLIs:[],columns:x,tableId:L,sectionName:"All Rows",selected:new Map,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}),i.cartItemColumnsMap[L]=x,f.value.isActive=!1,m.value=!0,v.value={lstCB:[{columns:x,footer:null,title:"All Rows",sectionName:"All Rows",tableId:L,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}]},T(),h.value.filteredList=!1,P}catch(P){t.handleError(P.message),console.info("[ERROR]: getQuoteEPageLayout() error = ",P)}}async function S(){if(b.value.length===0){A();return}try{h.value.filteredList=!0;let P=await window.salesforceConnector.getFilteredListWithFields(JSON.stringify({templateId:c.value}));E(c.value),P=qe(P),console.info("res.lstCB = ",P.lstCB);const x=P==null?void 0:P.objectFieldsMap;return u.value.clear(),i.cartItemColumnsMap={},P.lstCB=P.lstCB.map(L=>{const{fields:O,filters:q,primarysort:R,primarysortdesc:I}=JSON.parse(L.XX_ORD1__Block_Properties__c),D=O.map(F=>{var z;return{label:(z=x[F.api])==null?void 0:z.label,field:F.api.toLowerCase(),isEditable:F.api.includes(".")?!1:x[F.api].isEditable,dataType:x[F.api].dataType,...x[F.api].picklistValues?{picklistValues:x[F.api].picklistValues}:{}}}),H=L.Id||wt();return u.value.set(H,{loading:!0,lineItems:[],parentQLIs:[],columns:D,tableId:H,sectionName:L.Name,selected:new Map,footer:y(L.XX_ORD1__Table_Footer_HTML__c),filters:q,primarysort:R,primarysortdesc:I}),i.cartItemColumnsMap[H]=D,f.value.isActive=!1,m.value=!0,{columns:D,footer:y(L.XX_ORD1__Table_Footer_HTML__c),title:L.Name,sectionName:L.Name,tableId:H,filters:q,primarysort:R,primarysortdesc:I}}),v.value=P,T(),h.value.filteredList=!1,P}catch(P){t.handleError(P.message),console.info("[ERROR]: getFilteredListWithFields() error = ",P)}}async function T(P=!0){const x=[];for(const[L]of u.value)x.push(w(L,P));return await Promise.all(x),i.getProductCount(),!0}function B(P,x){return u.value.get(P).columns.some(L=>L.field.toLowerCase()===x)||i.cartItemColumnsMap[P].some(L=>L.field.toLowerCase()===x)}function V(P,x){let L=on(P);const O=n.pricingSchema,q=B(x,"xx_ord1__nrc__c"),R=B(x,"xx_ord1__sales_price__c"),I=B(x,"xx_ord1__qty__c");return L=L.map(D=>{let H={};O==="nrc/mrc"&&(D!=null&&D.xx_ord1__billing_period__c)?H={...R?{billingPeriodValue:(D==null?void 0:D.xx_ord1__sales_price__c)===0?"0":(D==null?void 0:D.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:D==null?void 0:D.xxord1salespricec}:{},...q?{oneTimeValue:(D==null?void 0:D.xx_ord1__nrc__c)===0?"0":(D==null?void 0:D.xx_ord1__nrc__c)||null,formattedOneTimeValue:D==null?void 0:D.xxord1nrcc}:{}}:O==="nrc/mrc"&&!(D!=null&&D.xx_ord1__billing_period__c)?R&&(H={oneTimeValue:(D==null?void 0:D.xx_ord1__sales_price__c)===0?"0":(D==null?void 0:D.xx_ord1__sales_price__c)||null,formattedOneTimeValue:D==null?void 0:D.xxord1salespricec}):O!=="nrc/mrc"&&(D!=null&&D.xx_ord1__billing_period__c)?R&&(H={billingPeriodValue:(D==null?void 0:D.xx_ord1__sales_price__c)===0?"0":(D==null?void 0:D.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:D==null?void 0:D.xxord1salespricec}):O!=="nrc/mrc"&&!(D!=null&&D.xx_ord1__billing_period__c)&&R&&(H={oneTimeValue:(D==null?void 0:D.xx_ord1__sales_price__c)===0?0:(D==null?void 0:D.xx_ord1__sales_price__c)||null,formattedOneTimeValue:D==null?void 0:D.xxord1salespricec});const{xx_ord1__qty__c:F,xx_ord1__sales_price__c:z,xx_ord1__nrc__c:J,...G}=D,oe={...G,id:D.id,description:(D==null?void 0:D.xx_ord1__line_description__c)||"",xx_ord1__billing_period__c:D==null?void 0:D.xx_ord1__billing_period__c,...I?{xx_ord1__qty__c:F}:{},xx_ord1__item__c:D==null?void 0:D.xx_ord1__item__c,"xx_ord1__item__r.xx_ord1__decimal_precision__c":D["xx_ord1__item__r.xx_ord1__decimal_precision__c"]||"0",...H};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}),L}async function w(P,x=!0){var L,O;try{const q=u.value.get(P);if(console.info("sectionData = ",q.sectionName),!q)return;q.loading=x,x&&(q.lineItems=[]);const{columns:R,filters:I,primarysort:D,primarysortdesc:H,footer:F}=q,z=R.map(de=>de.field.toLowerCase());z.includes("xx_ord1__parent_qli__c")||z.push("xx_ord1__parent_qli__c"),z.includes("xx_ord1__item__c")||z.push("xx_ord1__item__c"),z.includes("xx_ord1__sys_configuration_status2__c")||z.push("xx_ord1__sys_configuration_status2__c"),(L=i.cartItemColumnsMap[P])==null||L.forEach(de=>{z.includes(de.field)||z.push(de.field)});const J=await N({fields:z,recordId:r.value,filters:I||[],primarySortBy:D||"",primarySortOrder:H?"DESC":"ASC",includeOptions:m.value,totalFields:F?[F.apiname]:[]}),G=J.lineItems,oe=new Map;let ae=[];const ce=(O=J.fieldTotals)==null?void 0:O.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]):ae.push(de)});const ye=[];return ae.forEach(de=>{ye.push(de),oe.has(de.Id)&&ye.push(...oe.get(de.Id))}),ae=V(ae,P),q.lineItems=on(ye),q.parentQLIs=ae,q.totalValues=ce,q.loading=!1,u.value=new Map(u.value),ye}catch(q){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",q.message);const R=u.value.get(P);R&&(R.loading=!1)}}async function N(P){try{let x=await window.salesforceConnector.getQuoteLineItemsWithFilteredTable(JSON.stringify(P));return x=qe(x),x}catch(x){t.handleError(x.message),console.info("[ERROR]: getQuoteLineItemsWithFilteredTable() error = ",x)}}async function M(P){try{console.info("updateQli() payload = ",P);let x=await window.salesforceConnector.updateQli(JSON.stringify(P));return x=qe(x),T(!1),x}catch(x){t.handleError(x.message),console.info("[ERROR]: updateQli() error = ",x)}}async function $(P){try{let x=await window.salesforceConnector.deleteQLI(P);return x=qe(x),T(),x}catch(x){t.handleError(x.message),console.info("[ERROR]: deleteQLI() error = ",x)}}async function U(P,x){try{s.value=!0;const L={fields:P};x&&(L.objectName=x),P.includes("xx_ord1__qty__c")&&x==="xx_ord1__ecatalog_item__c"&&(L.fields=L.fields.filter(q=>q!=="xx_ord1__qty__c")),P.includes("xx_ord1__sales_price__c")&&x!=="xx_ord1__quote_line_item__c"&&(L.fields=L.fields.filter(q=>q!=="xx_ord1__sales_price__c"));let O=await window.salesforceConnector.getFieldsData(JSON.stringify(L));return typeof O=="string"&&(O=JSON.parse(O)),O!=null&&O.errorMessage?(t.handleError(O.errorMessage),null):(g.value={...g.value,...O},console.info("fieldsData.value = ",JSON.stringify(g.value)),O)}catch(L){return t.handleError("Failed to get Fields Data. Please try again."),console.info("[ERROR]: getFieldsData() error = ",L),null}finally{s.value=!1}}function Q(P=""){var x;return!P||P.includes(".")?!1:P.includes("xx_ord1__qty__c")?!0:((x=g.value[P])==null?void 0:x.isEditable)||!1}function X(){te(el)}async function te(P){var x,L,O,q,R,I,D,H,F;if(P.payload){if((x=P.payload)!=null&&x.uiModification){const z=P.payload.uiModification;if(((L=z.addColumn)==null?void 0:L.length)>0)if(z.addColumn.forEach(J=>{J.columns.forEach(G=>{G.field=G.field.toLowerCase()})}),z.addColumn[0].sectionName==="all_section")for(const[J,G]of u.value)G.columns=[...G.columns,...z.addColumn[0].columns];else z.addColumn.forEach(J=>{u.value.get(J.tableId)&&(u.value.get(J.tableId).columns=[...u.value.get(J.tableId).columns,...J.columns])});if(((O=z.removeColumn)==null?void 0:O.length)>0)if(z.removeColumn.forEach(J=>{J.columns=J.columns.map(G=>G.toLowerCase())}),z.removeColumn[0].sectionName==="all_section")for(const[J,G]of u.value)G.columns=G.columns.filter(oe=>!z.removeColumn[0].columns.includes(oe.field));else z.removeColumn.forEach(J=>{u.value.get(J.tableId)&&(u.value.get(J.tableId).columns=u.value.get(J.tableId).columns.filter(G=>!J.columns.includes(G.field)))});if(((q=z.filter)==null?void 0:q.length)>0)if(z.filter[0].sectionName==="all_section")for(const[J,G]of u.value)G.filters=[...G.filters,...z.filter[0].filters];else z.filter.forEach(J=>{u.value.get(J.tableId)&&(u.value.get(J.tableId).filters=[...u.value.get(J.tableId).filters,...J.filters])});if(((R=z.groupBy)==null?void 0:R.length)>0){const J=((I=[...u.value.values()][0])==null?void 0:I.columns)||tl;u.value.clear(),i.cartItemColumnsMap={},z.groupBy.forEach(G=>{i.cartItemColumnsMap[G.tableId]=G.columns||J,u.value.set(G.tableId,{loading:!0,lineItems:[],parentQLIs:[],columns:G.columns||J,tableId:G.tableId,sectionName:G.sectionName,selected:new Map,footer:y(G.footer),filters:G.filters,primarysort:G.primarysort,primarysortdesc:G.primarysortdesc})})}z.showOptions!==void 0&&(m.value=z.showOptions)}if(((H=(D=P.payload)==null?void 0:D.sections)==null?void 0:H.length)>0){const z=(F=P.payload)==null?void 0:F.sections;u.value.clear(),z.forEach(J=>{J.tableId||(J.tableId=wt()),J.selected=new Map,u.value.set(J.tableId,J)}),T()}}P.actionFunction==="Reload"&&(T(),console.info("Reloading quote line items"))}async function Z(P){var x,L;try{const O=new Set;for(const q of u.value.keys())(x=u.value.get(q).lineItems)==null||x.forEach(I=>{I.attributes=null,O.add(I.id)});if(P){const q={lineItemIds:[...O]},R=await window.productManagerController.getLineItemAttributes({request:JSON.stringify(q)}),I=JSON.parse(R.data);for(const D of u.value.keys())(L=u.value.get(D).lineItems)==null||L.forEach(F=>{F.attributes=I[F.id]||null})}}catch(O){console.info("[ERROR]: fetchAttributesData() error = ",O)}}return{showAttributes:d,quoteId:r,quoteName:o,templateId:c,templateOptions:b,loading:h,currentTemplateData:v,fieldsData:g,fieldsDataLoading:s,showOptionHeaderButton:f,sectionDataMap:u,promptSuggestions:l,lineItemsCount:a,addColumns:X,getQuoteEPageLayout:A,getPayload:p,getPrimaryQuote:_,fetchTemplates:C,getFilteredListWithFields:S,getQuoteLineItemsWithFilteredTable:N,updateQli:M,getFieldsData:U,deleteQLI:$,performAIAction:te,isEditableField:Q,fetchQuoteLineItems:w,fetchAllQuoteLineItems:T,fetchAttributesData:Z}}),go=Ke.defineStore("share",()=>{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"),h=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:h,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)},at=Ke.defineStore("configurator-main",()=>{Kn();const t=ut(),i=it(),n=go(),r=ln(),o=e.ref(null),a=e.ref(null),c=e.ref(null),b=e.ref(null),h=e.ref(null),v=e.ref([]),u=e.ref(null),g=e.ref(null),s=e.ref(new Map),m=e.ref(!1),d=e.ref({configuration:!1,lineItem:!1,productOptionsPricing:!1,bestOfferPrice:!1,lineItemAttributes:!1,save:!1}),f=e.ref(!1),l=e.computed(()=>p.value&&!n.isSinglePricingSchema),p=e.computed(()=>{let O=!0,q=!0,R=!0,I=null;for(const D of b.value.categoryOptions)for(const H of D.itemTypes)for(const F of H.options)F.billingPeriod&&(I&&I!==F.billingPeriod&&(R=!1),I=F.billingPeriod,!F.yrcPrice&&F.billingPeriod==="Monthly"&&(O=!1),!F.mrcPrice&&F.billingPeriod==="Yearly"&&(q=!1));return O&&q&&R}),_=e.computed(()=>!al(b.value,h.value)),C=e.computed(()=>{const O=b.value.categoryOptions;return O.forEach(q=>{q.itemTypes.forEach(R=>{R.selectedOptions=R.options.filter(I=>R.selected.includes(I.itemId)),R.totalPrice=function(){return R.selectedOptions.reduce((I,D)=>I+D.price*D.qty,0)||0},R.oneTimePrice=function(){return R.selectedOptions.filter(I=>!I.billingPeriod).reduce((I,D)=>I+D.price*D.qty,0)||0},R.recurringPrice=function(){return R.selectedOptions.filter(I=>I.billingPeriod).reduce((I,D)=>I+D.price*D.qty,0)||0}}),q.selectedItemTypes=q.itemTypes.filter(R=>R.selected.length>0),q.totalPrice=function(){return q.itemTypes.reduce((R,I)=>R+I.totalPrice(),0)},q.oneTimePrice=function(){return q.itemTypes.reduce((R,I)=>R+I.oneTimePrice(),0)},q.recurringPrice=function(){return q.itemTypes.reduce((R,I)=>R+I.recurringPrice(),0)}}),O.filter(q=>q.itemTypes.filter(R=>R.selected.length>0).length>0)}),y=e.computed(()=>C.value.reduce((O,q)=>O+q.totalPrice(),0)),E=e.computed(()=>{const O=C.value.reduce((I,D)=>I+D.totalPrice(),0);let q=C.value.reduce((I,D)=>I+D.oneTimePrice(),0),R=C.value.reduce((I,D)=>I+D.recurringPrice(),0);return b.value.billingPeriod?R=(R+b.value.price)*b.value.qty:q=(q+b.value.price)*b.value.qty,{basePrice:b.value.price,addOns:O,oneTimePrice:q,recurringPrice:R,total:b.value.price*b.value.qty+O*b.value.qty+q+R}}),A=e.computed(()=>{var q,R,I,D;const O=new Map;return(q=u.value)!=null&&q.productLineItem&&O.set((R=u.value)==null?void 0:R.productLineItem.XX_ORD1__Item__c,(I=u.value)==null?void 0:I.productLineItem),(D=u.value)==null||D.options.forEach(H=>{O.set(H.XX_ORD1__Item__c,H)}),O}),S=e.computed(()=>{const O=new Map;return b.value.categoryOptions.forEach(q=>{q.itemTypes.forEach(R=>{R.options.forEach(I=>{O.set(I.relationshipInfo.publishKey,I)})})}),O});function T(O){b.value.qliId&&(b.value.qliBillingPeriod==="Monthly"&&!O?b.value.price=b.value.qliSalesPrice||b.value.qliMrcPrice:b.value.qliBillingPeriod==="Yearly"&&O&&(b.value.price=b.value.qliSalesPrice)),b.value.categoryOptions.forEach(q=>{q.itemTypes.forEach(R=>{R.options.forEach(I=>{I.billingPeriod&&(I.price=(O?I.yrcPrice.offerPrice:I.mrcPrice.offerPrice)||I.price,I.qliId&&(I.qliBillingPeriod==="Monthly"&&!O?I.price=I.qliSalesPrice||I.qliMrcPrice:I.qliBillingPeriod==="Yearly"&&O&&(I.price=I.qliSalesPrice)))})})})}function B(){b.value=null,h.value=null,v.value=[],u.value=null,g.value=null,s.value=new Map,m.value=!1,d.value.configuration=!1,d.value.lineItem=!1,d.value.productOptionsPricing=!1,d.value.bestOfferPrice=!1,d.value.lineItemAttributes=!1,d.value.save=!1}async function V(O,q,R){console.time("CONFIGURATOR INIT CONFIGURATOR"),B(),console.timeLog("CONFIGURATOR INIT CONFIGURATOR","1"),a.value=O,c.value=q,o.value=R||n.quoteId;const I=await w();console.timeLog("CONFIGURATOR INIT CONFIGURATOR","2"),b.value=N(I),c.value&&(await $(),console.timeLog("CONFIGURATOR INIT CONFIGURATOR","3"),M(b.value),b.value.categoryOptions.forEach(D=>{D.itemTypes.forEach(H=>{H.options.forEach(F=>{M(F),(A.value.has(F.itemId)||F.relationshipInfo.relationship==="Kit")&&H.selected.push(F.itemId)})})}),console.timeLog("CONFIGURATOR INIT CONFIGURATOR","4")),h.value=JSON.parse(JSON.stringify(b.value)),console.timeEnd("CONFIGURATOR INIT CONFIGURATOR")}async function w(){try{const O={accountId:n.accountId,objectId:o.value,itemId:a.value,configScope:"BASIC",fields:[],pricePreference:"Lowest Price"},q=await window.productManagerController.getAvailableConfiguration(O);console.info("getAvailableConfiguration:result",q);const R=q.data.productConfiguration;return R.categoryOptions=il(R.categoryOptions),R}catch(O){return console.info("error",O.message),!1}}function N(O){s.value.set(c.value,O.attributes),v.value=O.configRules;const q=new Set;return v.value.forEach(R=>{const I=JSON.parse(R.ruleJson);I.optionSelected.forEach(D=>{q.add(D)}),I.affectedOptions.forEach(D=>{q.add(D)})}),M(O),O.categoryOptions.forEach(R=>{R.key=R.category.toLowerCase().replace(/\s+/g,"-").replace(/[&]/g,""),R.itemTypes.forEach(I=>{I.selected=[],I.numberOfColumns||(I.numberOfColumns=1),I.numberOfColumns>1&&(I.lightboxAttributes=!0),I.maxNumber||(I.maxNumber=100),I.minNumber||(I.minNumber=0),I.maxQuantity||(I.maxQuantity=1e4),I.minQuantity||(I.minQuantity=1),I.maxNumber===1?(I.isRadio=!0,I.minMessage="Please select 1 option",I.maxMessage="",I.isKit=I.options.some(D=>D.relationshipInfo.relationship==="Kit")):(I.minMessage=`Minimum of ${I.minNumber} selection${I.minNumber!==1?"s":""} required`,I.maxMessage=`Maximum of ${I.maxNumber} selection${I.maxNumber!==1?"s":""} allowed`),I.options.forEach(D=>{R.showImage=R.showImage||!!D.defaultImageURL,D.showAttributesModal=!1,D.calculateRules=q.has(D.relationshipInfo.publishKey),D.qty=I.minQuantity||1,D.getTags=()=>(D.attributes=D.attributes||[],D.attributes.filter(H=>H.value!==null&&H.value!=="").map(H=>({label:H.label,value:H.value}))),Object.defineProperty(D,"isDisabled",{get:function(){return D.relationshipInfo.relationship==="Kit"||(I.isRadio?I.isKit:!I.selected.includes(D.itemId)&&I.maxNumber===I.selected.length)}}),M(D)})})}),O}function M(O){O.isAttributes=O.attributes&&O.attributes.length>0;const q=O.catalogItem;if(A.value.has(O.itemId)){const R=A.value.get(O.itemId);O.qliId=R.Id,O.qty=R.XX_ORD1__QTY__c,O.itemName=R.XX_ORD1__Line_Description__c,O.billingPeriod=R.XX_ORD1__Billing_Period__c,O.price=R.XX_ORD1__Sales_Price__c,O.billingPeriod?O.price=R.XX_ORD1__Sales_Price__c||R.XX_ORD1__MRC__c:O.price=R.XX_ORD1__NRC__c||R.XX_ORD1__Sales_Price__c,O.qliSalesPrice=R.XX_ORD1__Sales_Price__c,O.qliNrcPrice=R.XX_ORD1__NRC__c,O.qliMrcPrice=R.XX_ORD1__MRC__c,O.qliBillingPeriod=R.XX_ORD1__Billing_Period__c,s.value.set(O.qliId,O.attributes)}else O.itemName=q.XX_ORD1__Line_Description__c||O.itemName,O.price=q.XX_ORD1__Negotiated_Price__c||q.XX_ORD1__NRC_for_New__c,O.nrcPrice=q.XX_ORD1__NRC_for_New__c}async function $(){var O;d.value.lineItem=!0,console.info("getLineItems",o.value,c.value);try{const q={objectId:o.value,filters:{},additionalFields:["Name","XX_ORD1__Line_Description__c"],primarySort:{field:"CreatedDate",direction:"DESC"},productPage:{limit:200,offset:0,productLineItemId:c.value}},R=await window.productManagerController.getLineItems({request:JSON.stringify(q)});return u.value=((O=R.data.products)==null?void 0:O.find(({productLineItem:I})=>I.Id===c.value))||null,console.info("lineItem.value",u.value),d.value.lineItem=!1,R}catch(q){return console.info("error",q.message),d.value.lineItem=!1,!1}}async function U(O){console.info("getRecords");try{const q=await window.productManagerController.getRecords({request:JSON.stringify(O)});return console.info("getRecords:result",q),JSON.parse(q.data)}catch(q){return console.info("error",q.message),!1}}async function Q(O){const q={accountId:n.accountId,eCatalogItemIds:O,pricePreference:"Heighest Priority"},R=await window.productManagerController.calculateBestOfferPrice({request:JSON.stringify(q)});return console.info("calculateBestOfferPrice:result",R),d.value.bestOfferPrice=!1,JSON.parse(R.data)}async function X(){m.value=!0,d.value.save=!0,console.info("maintainQuoteConfiguration");const O=[],q=[];b.value.categoryOptions.forEach(D=>{D.itemTypes.forEach(H=>{H.options.forEach(F=>{H.selected.includes(F.itemId)?O.push(te(F)):F.qliId&&q.push(F.qliId)})})});const R={objectId:o.value,eCatalogId:n.eCatalogId,isGenesisAI:!0,blinkUser:!1,optionsToRemove:q,grandFatheredOptionsToRemove:[],productLineItem:{...te(b.value),optionLineItems:O}};console.info("maintainQuoteConfiguration:request",R);const I=await window.productManagerController.maintainQuoteConfiguration({request:JSON.stringify(R)});if(console.info("maintainQuoteConfiguration:result",I),I!=null&&I.error){const D={title:"Unable to Save Configuration",description:I.error,button:{label:"Back to Configuration",action:()=>{m.value=!1}},cancel:{label:"Quote List",action:()=>{r.push("/quote-item?id="+o.value)}}};i.errorPopup=D}else h.value=JSON.parse(JSON.stringify(b.value)),console.info("maintainQuoteConfiguration:result",I);d.value.save=!1}function te(O){const q={};O.isAttributes&&O.attributes.forEach(I=>{I.apiName.includes(".")||(I.dataType==="BOOLEAN"?q[I.apiName]=I.value?"true":"false":I.dataType==="REFERENCE"?q[I.apiName]=I.referenceRecordId:q[I.apiName]=I.value)});const R={attributes:q,itemId:O.itemId,lineItemId:O.qliId,lineDescription:O.itemName,qty:O.qty,billingPeriod:O.billingPeriod,...O.offer};return O.billingPeriod&&p.value&&!n.isSinglePricingSchema&&(R.billingPeriod=f.value?"Yearly":"Monthly"),!n.isSinglePricingSchema&&!O.billingPeriod?R.nrcPrice=O.price:(R.applyOnField="Catalog Price",R.salesPrice=O.price,R.nrcPrice=O.nrcPrice),R}async function Z(){const O={objectId:n.eCatalogId,productItemId:a.value};try{let q=await window.productManagerController.getProductCrossSells({request:JSON.stringify(O)});if(console.info("getProductCrossSells:result",q),q=q.data?JSON.parse(q.data):{},q.crossSells.length===0)return q;const R=q.crossSells.map(H=>H.Id),I=await Q(R),D=new Map;return I.forEach(H=>{D.set(H.eCatalogItemId,{...H,...H.pricingTypes[0]})}),q.crossSells.forEach(H=>{H.loading=!1,H.Name=H.XX_ORD1__Line_Description__c||H.XX_ORD1__Item__r.Name,H.Description=H.XX_ORD1__Item__r.XX_ORD1__Product_Description__c,D.has(H.Id)?(H.Price=D.get(H.Id).offerPrice,H.priceFormatted=D.get(H.Id).formattedOfferPrice,H.offer={offerDiscount:D.get(H.Id).offerDiscount,offerId:D.get(H.Id).offerId,offerType:D.get(H.Id).offerType}):(H.Price=H.XX_ORD1__List_Price2__c,H.priceFormatted=H.XX_ORD1__List_Price2__c,H.offer={offerDiscount:0,offerId:null,offerType:null})}),q}catch(q){return console.info("error",q.message),!1}}async function P(O,q){var H,F;const R={product:{publishKey:b.value.publishKey,lineDescription:b.value.itemName},options:[]};b.value.categoryOptions.forEach(z=>{z.itemTypes.forEach(J=>{J.options.forEach(G=>{J.selected.includes(G.itemId)&&R.options.push({publishKey:G.relationshipInfo.publishKey,lineDescription:G.itemName})})})}),console.info("evaluateConfigSelection:currentConfig.options",R.options);const I={productJSON:{productItem:{configRules:v.value}},currentConfig:R,selected:O?{publishKey:(H=O.relationshipInfo)==null?void 0:H.publishKey,attributes:O.attributes,lineDescription:O.itemName}:{},unselected:q?{publishKey:(F=q.relationshipInfo)==null?void 0:F.publishKey,attributes:q.attributes,lineDescription:q.itemName}:{}};return await ol(I)}async function x(){try{const O=["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"],R=(await t.getQuoteLineItemsWithFilteredTable({fields:O,recordId:o.value,filters:[],includeOptions:!1,totalFields:[]})).lineItems;return console.info("fetchQuoteLineItems:res",R),R}catch(O){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",O.message)}}async function L(O){const q={quoteId:o.value,lstQLIRequest:[{eCatalogItemId:O.Id,quantity:1,offerApplicable:O.offer}]};try{const R=await window.productManagerController.createQuoteProducts({request:JSON.stringify(q)});console.info("getProductCrossSells:result",R)}catch(R){return console.info("error",R.message),!1}}return{itemId:a,configuration:b,_configurationCopy:h,lineItem:u,savedScreen:m,loading:d,summary:C,addOns:y,summaryPrices:E,optionByItemId:A,attributesByQLIId:s,optionByPublishKey:S,showYearlyPricing:f,isYearlyPricingExist:p,isChangedConfiguration:_,isRecurringPricingSchema:l,changePricingScheme:T,createQuoteProducts:L,resetConfigurator:B,fetchQuoteLineItems:x,getRecords:U,getProductCrossSells:Z,initConfigurator:V,maintainQuoteConfiguration:X,evaluateConfigSelection:P}}),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=at(),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"}]),h=e.ref(null),v=e.ref([]),u=async d=>{d.loading=!0,await i.createQuoteProducts(d),d.disabled=!0,d.loading=!1},g=d=>{d.action==="backToConfiguration"?i.savedScreen=!1:d.action==="backToQuoteList"?r.push("/quote-item?id="+n.quoteId):d.link&&r.push(d.link)};async function s(){const d=await i.fetchQuoteLineItems();console.info("getQuoteLineItems1:_quoteLineItems",d);const f=d.filter(p=>p.XX_ORD1__SYS_Configuration_Status2__c=="Needs Configuration").length;console.info("getQuoteLineItems2:needsConfigurationCount",f),c.value=`(${d.length-f}/${d.length})`;const l=d.find(p=>p.XX_ORD1__SYS_Configuration_Status2__c=="Needs Configuration"&&p.Id!=i.qliId);return console.info("getQuoteLineItems3:result",l),h.value=l?{Name:l.XX_ORD1__Line_Description__c,Description:l.XX_ORD1__Item__r.XX_ORD1__Product_Description__c,Price:l.XX_ORD1__Sales_Price__c,XX_ORD1__Item__c:l.XX_ORD1__Item__c,Id:l.Id}:null,console.info("getQuoteLineItems4:configueredProduct",h.value),d}async function m(){i.resetConfigurator(),r.push({path:"/configurator/"+h.value.XX_ORD1__Item__c+"/"+h.value.Id}),i.initConfigurator(h.value.XX_ORD1__Item__c,h.value.Id)}return e.onBeforeMount(async()=>{a.value=!0;const d=await s(),f=await i.getProductCrossSells(),l=new Set;d.forEach(p=>{l.add(p.XX_ORD1__Item__c)}),f.crossSells.forEach(p=>{p.disabled=l.has(p.XX_ORD1__Item__c)}),v.value=f.crossSells||[],a.value=!1}),(d,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",ll,[e.createElementVNode("div",sl,[e.createVNode(we,{icon:"arrow",symbol:"",size:12,onClick:f[0]||(f[0]=l=>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(co,{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(so,{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,(l,p)=>(e.openBlock(),e.createElementBlock("div",{key:l.Id||p,class:"ect-bg-white ect-border ect-border-gray-300 ect-rounded-md ect-p-3 ect-flex ect-flex-col","data-test-id":`configurator-recommend-card-${l.Id||p}`},[e.createElementVNode("div",bl,[e.createElementVNode("h4",_l,e.toDisplayString(l.Name),1),e.createElementVNode("p",vl,e.toDisplayString(l.Description),1)]),e.createElementVNode("div",Cl,[e.createElementVNode("div",El,e.toDisplayString(e.unref(He)(l.Price)),1),e.createVNode(Ze,{btype:l.disabled?"secondary":"primary","button-style":l.disabled?"normal":"outlined",size:"medium",class:e.normalizeClass({"ect-w-[120px]":l.loading}),loading:l.loading,disabled:l.disabled||l.loading,"data-test-id":`configurator-recommend-button-add-${l.Id||p}`,onClick:_=>u(l)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.loading?"":l.disabled?"Added to Quote":"Add to Quote"),1)]),_:2},1032,["btype","button-style","class","loading","disabled","data-test-id","onClick"])])],8,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,(l,p)=>(e.openBlock(),e.createElementBlock("div",{key:l.title||p,class:"ect-bg-white ect-border ect-border-[#DEDEDE] ect-rounded-xl ect-p-4 md:ect-p-5 lg:ect-p-6 ect-flex ect-flex-col ect-items-center ect-gap-4 md:ect-gap-6 lg:ect-gap-8 ect-cursor-pointer ect-transition-all ect-duration-200 hover:ect-shadow-md hover:ect-border-gray-400","data-test-id":`configurator-recommend-redirect-card-${p}`,onClick:_=>g(l)},[e.createElementVNode("div",Ol,[e.createVNode(we,{icon:l.icon,size:20,color:"#000000","data-test-id":`configurator-recommend-redirect-icon-${p}`},null,8,["icon","data-test-id"])]),e.createElementVNode("div",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-${p}`},e.toDisplayString(l.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-${p}`},e.toDisplayString(l.description),9,Tl)])],8,xl))),128))])])),h.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(h.value.Name),1),e.createElementVNode("p",ql,e.toDisplayString(h.value.Description),1)]),e.createElementVNode("div",Dl,[e.createElementVNode("div",jl,e.toDisplayString(e.unref(He)(h.value.Price)),1),e.createVNode(Ze,{btype:"primary","button-style":"filled",size:"medium","data-test-id":"configurator-recommend-button-add-next-product",onClick:m},{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,h=>(e.openBlock(),e.createElementBlock("button",{key:h.key,class:e.normalizeClass(["ect-page-tab-button",`ect-page-tab-button${o.value===h.key?"-active":""} ${h.tabClass||""}`]),"data-test-id":`${t.dataTestId}-tab-${h.key}`,onClick:v=>a(h.key)},[e.createTextVNode(e.toDisplayString(h.title)+" ",1),h.pill!==void 0&&h.pill!==null?(e.openBlock(),e.createBlock(Hl,{key:0,class:"ect-ml-2",variant:h.pillStyle,"data-test-id":`${t.dataTestId}-tab-${h.key}-pill`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.pill),1)]),_:2},1032,["variant","data-test-id"])):e.createCommentVNode("",!0)],10,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"]]),Xl=["data-test-id"],Jl=["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,A)=>Math.min(Math.max(y,E),A),b=y=>{if(y==null||y==="")return NaN;const E=Number(y);return Number.isFinite(E)?E:NaN},h=e.ref(null),v=e.ref(n.value??o.value),u=y=>{v.value=c(y,o.value,a.value)};n.value!==null&&u(n.value);const g=e.computed(()=>v.value),s=e.computed(()=>h.value!=null?h.value:String(g.value)),m=e.computed(()=>n.disabled||g.value<=o.value),d=e.computed(()=>n.disabled||g.value>=a.value);function f(y){y!==n.value&&(v.value=y,r("update:value",y),r("change",y))}function l(){if(m.value)return;const y=c(g.value-1,o.value,a.value);h.value=null,f(y)}function p(){if(d.value)return;const y=c(g.value+1,o.value,a.value);h.value=null,f(y)}function _(y){const A=String(y.target.value??"").replace(/\D+/g,"");h.value=A}function C(){const y=b(h.value),E=o.value,A=c(Number.isNaN(y)?E:y,o.value,a.value);h.value=null,f(A)}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":m.value,"ect-cursor-not-allowed":m.value}]),disabled:m.value,"data-test-id":`${t.dataTestId}-decrement`,onClick:l}," - ",10,Jl),e.createElementVNode("input",{type:"text",inputmode:"numeric",pattern:"[0-9]*",value:t.empty?"":s.value,disabled:t.disabled,class:"ect-h-7 ect-w-[48px] ect-px-2 ect-border ect-border-gray ect-rounded-md ect-text-center ect-text-sm ect-font-medium ect-text-gray-900 focus:ect-outline-none focus:ect-border-gray-400 ect-bg-white","data-test-id":`${t.dataTestId}-input`,onInput:_,onBlur:C},null,40,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":d.value,"ect-cursor-not-allowed":d.value}]),disabled:d.value,"data-test-id":`${t.dataTestId}-increment`,onClick:p}," + ",10,Wl)],8,Xl))}},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=at(),r=t,o=e.ref(r.item),a=e.computed(()=>{const h=n.summaryPrices,v=[];return n.isRecurringPricingSchema?(v.push({label:"One Time Price",value:h.oneTimePrice,highlight:!1}),v.push({label:n.showYearlyPricing?"Yearly Price":"Monthly Price",value:h.recurringPrice,highlight:!1})):(v.push({label:"Base Price",value:h.basePrice,highlight:!1}),v.push({label:"Add Ons",value:h.addOns,highlight:!1}),v.push({label:"Total Price",value:h.total,highlight:!1})),v}),c=i,b=()=>{r.disabled||c("continue")};return(h,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,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g},[e.createElementVNode("div",{class:"ect-flex ect-flex-col ect-justify-center","data-test-id":`configurator-footer-price-${g}`},[e.createElementVNode("span",{class:"ect-text-xs ect-font-normal ect-text-gray-500 ect-text-left","data-test-id":`configurator-footer-price-label-${g}`},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-${g}`},e.toDisplayString(e.unref(He)(u.value)),11,os)],8,ns),g<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-${g}`},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"],Ye={__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"],Qn=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(""),h=e.ref(null),v=e.computed(()=>r.type==="currency"?p(r.modelValue):r.type==="number"?_(r.modelValue):r.modelValue),u=e.computed(()=>r.type==="string"?"text":"number"),g=e.computed(()=>r.type==="currency"?"0.01":void 0),s=e.computed(()=>r.type==="currency"?"0":void 0),m=()=>{r.disabled||(r.type==="currency"?b.value=parseFloat(r.modelValue)||"0.00":r.type==="number"?b.value=parseFloat(r.modelValue)||"0":b.value=r.modelValue,a.value=!0,e.nextTick(()=>{h.value&&(h.value.focus(),h.value.select())}))},d=()=>{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},f=()=>{b.value=r.modelValue,a.value=!1},l=()=>{a.value&&d()},p=C=>!C||isNaN(C)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(parseFloat(C)),_=C=>!C||isNaN(C)?"0":new Intl.NumberFormat("en-US").format(parseFloat(C));return e.watch(()=>r.modelValue,C=>{a.value||(b.value=C)}),i({startEditing:m,saveChanges:d,cancelEditing:f}),(C,y)=>{const E=e.resolveDirective("click-outside");return e.openBlock(),e.createElementBlock("div",{class:"ect-relative ect-inline-block ect-min-w-[60px] ect-h-[30px]","data-test-id":t.dataTestId,onMouseenter:y[1]||(y[1]=A=>c.value=!0),onMouseleave:y[2]||(y[2]=A=>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:h,"onUpdate:modelValue":y[0]||(y[0]=A=>b.value=A),type:u.value,step:g.value,min:s.value,class:e.normalizeClass(["ect-w-full ect-h-full ect-px-3 ect-bg-white ect-border ect-border-green-500 ect-rounded-sm ect-text-gray-700 ect-text-base ect-font-sans ect-outline-none ect-duration-200",C.$attrs.class]),"data-test-id":`${t.dataTestId}-input`,onKeyup:[e.withKeys(d,["enter"]),e.withKeys(f,["esc"])],onBlur:d},null,42,Ts),[[e.vModelDynamic,b.value]])],8,Vs)),[[E,l]]):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ect-flex ect-items-center ect-gap-2 ect-rounded ect-transition-colors ect-duration-200",{"ect-cursor-pointer":!t.disabled}]),"data-test-id":`${t.dataTestId}-display`,onClick:m},[(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"},Xs={key:0,class:"ect-w-16 ect-h-16 ect-rounded-lg ect-bg-gray-200 ect-flex-shrink-0 ect-overflow-hidden"},Js=["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={class:"ect-mt-1 ect-text-sm ect-text-gray-700 ect-leading-tight"},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"),h=e.computed({get:()=>n.quantity,set:d=>r("update:quantity",d)}),v=e.computed({get:()=>n.name,set:d=>r("update:name",d)}),u=d=>{r("update:quantity",d)},g=e.computed(()=>{if(a.value===0)return n.tags;const f=Math.floor(a.value/120);return n.tags.slice(0,Math.max(1,f))}),s=e.computed(()=>Math.max(0,n.tags.length-g.value.length)),m=()=>{if(o.value){const d=o.value,f=80,l=120,p=32,_=64;a.value=d.offsetWidth-f-l-p-_}};return e.onMounted(()=>{e.nextTick(()=>{m()})}),e.watch(()=>n.tags,()=>{e.nextTick(()=>{m()})},{deep:!0}),e.onMounted(()=>{window.addEventListener("resize",m)}),(d,f)=>(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(Qn,{modelValue:v.value,"onUpdate:modelValue":f[0]||(f[0]=l=>v.value=l),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:f[2]||(f[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(dn,{value:h.value,"onUpdate:value":f[1]||(f[1]=l=>h.value=l),min:t.minQuantity,max:t.maxQuantity,"data-test-id":`configurator-item-counter-${t.item.itemId}`,onChange:u},null,8,["value","min","max","data-test-id"])]),Ds,e.createElementVNode("div",js,[e.createVNode(Qn,{modelValue:c.value.price,"onUpdate:modelValue":f[3]||(f[3]=l=>c.value.price=l),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(d.$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(g.value,(l,p)=>(e.openBlock(),e.createElementBlock("span",{key:p,class:"ect-inline-block"},[e.createVNode(Ye,{label:l.label,value:l.value},null,8,["label","value"])]))),128)),s.value>0?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"ect-text-xs ect-text-gray-700 ect-border ect-border-gray-300 ect-rounded-md ect-px-2 ect-py-0.5","data-test-id":`configurator-item-button-more-tags-${t.item.itemId}`,onClick:f[4]||(f[4]=e.withModifiers(()=>{},["stop"]))}," +"+e.toDisplayString(s.value)+" more ",9,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:f[5]||(f[5]=l=>r("edit-attributes"))},[e.createVNode(Ye,{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:f[6]||(f[6]=l=>r("edit-attributes"))},[e.createVNode(Ye,{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",Xs,[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,Js)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",Gs,[e.createElementVNode("h3",Ws,e.toDisplayString(t.name),1),e.createElementVNode("p",Ys,e.toDisplayString(t.description),1)]),e.createElementVNode("div",ec,[e.renderSlot(d.$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(g.value,(l,p)=>(e.openBlock(),e.createElementBlock("span",{key:p,class:"ect-inline-block"},[e.createVNode(Ye,{label:l.label,value:l.value},null,8,["label","value"])]))),128)),s.value>0?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"ect-text-xs ect-text-gray-700 ect-border ect-border-gray-300 ect-rounded-md ect-px-2 ect-py-0.5","data-test-id":`configurator-item-button-more-tags-${t.item.itemId}`,onClick:f[7]||(f[7]=e.withModifiers(()=>{},["stop"]))}," +"+e.toDisplayString(s.value)+" more ",9,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:f[8]||(f[8]=l=>r("edit-attributes"))},[e.createVNode(Ye,{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:f[9]||(f[9]=l=>r("edit-attributes"))},[e.createVNode(Ye,{label:"Add attributes","add-button":""})])]))])):e.createCommentVNode("",!0),e.createElementVNode("div",ic,[e.createElementVNode("div",{onClick:f[11]||(f[11]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(dn,{value:h.value,"onUpdate:value":f[10]||(f[10]=l=>h.value=l),min:t.minQuantity,max:t.maxQuantity,"data-test-id":`configurator-item-counter-${t.item.itemId}`,onChange:u},null,8,["value","min","max","data-test-id"])]),e.createElementVNode("div",ac,[lc,e.createVNode(Qn,{modelValue:c.value.price,"onUpdate:modelValue":f[12]||(f[12]=l=>c.value.price=l),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(d.$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:oo(function(t){this.value=t,this.search&&!this.select&&this.$emit("search",t)}),handlerFocusIn(){!(this.modelValue&&this.search)&&!this.disabled&&(this.inputFocused=!0,this.updateDropdownPosition(),this.$emit("focus-in"))},updateSelected(t){t&&(this.value="",this.$emit("update:modelValue",t[this.property.key]),this.search&&!this.select&&!this.lookup&&this.$emit("search",""),this.onInputFocusedOut(!0))},clear(){this.disabled||(this.value="",this.$emit("update:modelValue",null),this.search&&!this.select&&!this.lookup&&this.$emit("search",""))},onInputFocusedOut(t=!1){(!this.isHover||t)&&!this.disabled&&(t?(this.highlightedIndex=-1,this.inputFocused=!1,this.$emit("focus-out")):setTimeout(()=>{this.highlightedIndex=-1,this.inputFocused=!1,this.$emit("focus-out")},100))},highlightNextOption(){this.highlightedIndex<this.options.length-1&&this.highlightedIndex++},highlightPreviousOption(){this.highlightedIndex>0&&this.highlightedIndex--}}},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]=h=>t.isHover=!0),onMouseleave:i[8]||(i[8]=h=>t.isHover=!1)},[n.label?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass(["title_label",{error_color:!!n.error}]),for:n.label,"data-test-id":`${n.dataTestId}-label`},[e.createTextVNode(e.toDisplayString(n.label)+" ",1),n.required?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass({error_color:!!n.error})},"*",2)):e.createCommentVNode("",!0)],10,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]=(...h)=>a.handlerFocusIn&&a.handlerFocusIn(...h)),onFocusout:i[3]||(i[3]=h=>a.onInputFocusedOut(!1)),onKeydown:[i[4]||(i[4]=e.withKeys(h=>a.updateSelected(n.options[t.highlightedIndex]),["enter"])),i[5]||(i[5]=e.withKeys(e.withModifiers((...h)=>a.highlightPreviousOption&&a.highlightPreviousOption(...h),["prevent"]),["up"])),i[6]||(i[6]=e.withKeys(e.withModifiers((...h)=>a.highlightNextOption&&a.highlightNextOption(...h),["prevent"]),["down"]))]},[!n.modelValue&&n.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref:"searchInput","onUpdate:modelValue":i[0]||(i[0]=h=>t.value=h),type:"text",name:"search",placeholder:n.placeholder,autocomplete:"off",disabled:n.disabled,"data-test-id":`${n.dataTestId}-search-input`,onInput:i[1]||(i[1]=e.withModifiers(h=>a.lookupSearchHandler(h.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,(h,v)=>(e.openBlock(),e.createElementBlock("div",{key:h[n.property.key],class:e.normalizeClass(["dropdown-item",{highlighted:v===t.highlightedIndex,"ect-pointer-events-none":h[n.property.assigned]}]),"data-test-id":`${n.dataTestId}-option-${v}`,onClick:u=>a.updateSelected(h)},[e.createElementVNode("div",{class:"name ect-items-center","data-test-id":`${n.dataTestId}-option-${v}-name`},[e.createElementVNode("span",Pc,[e.createElementVNode("span",{class:e.normalizeClass({"ect-text-zinc-400":h[n.property.assigned]}),"data-test-id":`${n.dataTestId}-option-${v}-value`},e.toDisplayString(h[n.property.value]==null?"Key and Value is Wrong":h[n.property.value]),11,qc),h[n.property.assigned]?(e.openBlock(),e.createElementBlock("span",{key:0,class:"ect-text-xs ect-leading-4 ect-text-zinc-600","data-test-id":`${n.dataTestId}-option-${v}-assigned`},"Assigned",8,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(h[n.badge]),9,jc)):e.createCommentVNode("",!0)],8,Rc),e.createElementVNode("div",{class:"info",title:a.subFieldsText(h),"data-test-id":`${n.dataTestId}-option-${v}-info`},[e.createElementVNode("span",null,e.toDisplayString(a.subFieldsText(h)),1)],8,$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 uo;(function(t){t.pop="pop",t.push="push"})(uo||(uo={}));var fo;(function(t){t.back="back",t.forward="forward",t.unknown=""})(fo||(fo={})),Symbol(process.env.NODE_ENV!=="production"?"navigation failure":"");var ho;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(ho||(ho={})),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 Kn(){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 Zn={xx_ord1__item__c:"xx_ord1__item__c",xx_ord1__sales_price__c:"xx_ord1__negotiated_price__c",xx_ord1__nrc__c:"xx_ord1__nrc_for_new__c",xx_ord1__line_description__c:"xx_ord1__line_description__c",xx_ord1__list_price__c:"xx_ord1__list_price2__c",xx_ord1__cost__c:"xx_ord1__cost2__c",xx_ord1__rate_plan__c:"xx_ord1__rate_plan__c",xx_ord1__allowed_discount__c:"xx_ord1__allowed_discount__c",xx_ord1__billing_period__c:"xx_ord1__billing_period__c",xx_ord1__ship_to_account__c:"xx_ord1__ship_to_account__c",xx_ord1__erp_item_number__c:"xx_ord1__erp_item_number__c",xx_ord1__mrc__c:"xx_ord1__mrc__c",xx_ord1__qty__c:"xx_ord1__qty__c",id:"id"},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=Zn[a==null?void 0:a.toLowerCase()])==null?void 0:n.trim())||"";c&&(i.includes(c)||i.push(c||""),i.push(r))}else i.includes(Zn[r==null?void 0:r.toLowerCase()])||i.push(Zn[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,h=!1)=>{console.info("openAdaptiveSearch",b),t.chatHistory[t.chatHistory.length-1].links=[],t.sendMessage("Open Adaptive Search",!1,{internalCall:!0}),n.value=h},openQuoteItem:b=>{console.info("openQuoteItem",b),t.chatHistory[t.chatHistory.length-1].links=[],t.sendMessage("Open Quote Item",!1,{internalCall:!0})},openQuoteDocument:b=>{console.info("openQuoteDocument",b),t.chatHistory[t.chatHistory.length-1].links=[],t.chatHistory.push({type:"response",message:"Opening quote document",loading:!0});const v=`/apex/XX_ORD1__Expedite_Commerce?scpq=true&oid=${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),h=e.ref([]),v=e.ref(""),u=e.ref(!1),g=e.ref(null),s=e.ref(!1),m=e.ref([]),d=it(),f=e.ref([]),l=e.ref(0),p=e.ref(!1),_=e.ref({rowLimt:10,paging:!0,offset:0,currentPage:1,totalPages:1});async function C(){c.value=!0;try{const x=JSON.stringify({layoutType:"Search Selection",layoutObject:"xx_ord1__ecatalog_item__c"});let L={};return L=await window.salesforceConnector.getDynamicPageLayout(x),a.value=lo(L,"Unable to find the Search Selection Layout for your user profile"),_.value.rowLimt=a.value.configuration.rowLimit||10,a.value.configuration.columns.forEach(O=>{!O.field&&O.label==="QTY"&&(O.field="xx_ord1__qty__c")}),c.value=!1,y(),L}catch(x){c.value=!1,d.handleError("Failed to get Adaptive Search Layout. Please try again."),console.info("[ERROR]: getAdaptiveSearchLayout() error = ",x)}}function y(){var x,L,O;g.value=(O=(L=(x=a.value)==null?void 0:x.configuration)==null?void 0:L.dynamicFilters)==null?void 0:O.filters.map(q=>({...q,field:q.field.toLowerCase(),filtervalue:q.filtervalue||[],filtervaluefrom:q.filtervaluefrom||"",filtervalueTo:q.filtervalueTo||""}))}function E(){var L;let x=[];for(const O of a.value.configuration.columns){let q=O.field;if(x.includes(q)||x.push(q),q!=null&&q.includes(".")){let I=q.split(".")[0];I=I.slice(0,-1)+"c",x.includes(I)||x.push(I)}}return(L=a.value.configuration)!=null&&L.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(O=>!!O),x.filter(O=>O.toLowerCase()!=="xx_ord1__qty__c"&&O.toLowerCase()!=="xx_ord1__competitor_sku__c")}function A(x,L=!1){if(!x||x.includes("undefined"))return!1;const O=/[!@#$%^&*()+=[\]{};':"\\|.<>/?]+/;if(L){const q=Array.isArray(x)?x:x.split(",");for(const R of q){const I=R.trim();if(O.test(I))return d.handleError(`Invalid character found in value: ${I}`),!1}}else if(O.test(x))return d.handleError("Special characters are not allowed in filter values"),!1;return!0}function S(x,L){return{field:x.field,operator:x.operator||"contains",value:L,dataType:x.dataType.trim()}}function T(x){if(!x.filtervalue)return null;const L=Array.isArray(x.filtervalue),O=L?x.filtervalue.join(","):x.filtervalue.trim();return A(O,L)?O:null}function B(x){var R,I;const L=(R=x.filtervaluefrom)==null?void 0:R.trim(),O=(I=x.filtervalueTo)==null?void 0:I.trim();if(!L||!O)return null;const q=`${L}, ${O}`;return q!==", "&&A(q)?q:null}function V(x){const L=`${ao(x.filtervaluefrom)}, ${ao(x.filtervalueTo)}`;return L!==", "&&A(L)?L:null}function w(x){var O;const L=(O=x.filtervaluefrom)==null?void 0:O.trim();return A(L)?L:null}function N(x){const L=[];return x.forEach(O=>{const q=O.dataType.trim();let R=null;switch(q){case"PICKLIST":case"MULTIPICKLIST":R=T(O);break;case"DOUBLE":case"CURRENCY":R=B(O);break;case"DATETIME":case"DATE":R=V(O);break;default:R=w(O)}R&&L.push(S(O,R))}),m.value=L,L}async function M(x="",L=[],O=[]){var R,I,D,H,F,z,J,G,oe,ae;let q=[];if(L.length&&(q=N(L)),!q.length&&x.trim()===""){h.value=[],u.value=!1;return}try{u.value=!1,b.value=!0;const ce=x.trim();O.length||(O=E());const ye={fields:O,...L.length?{dynamicFilters:q}:{},searchText:ce||v.value.trim(),accountId:i.accountId,...i.eCatalogId?{catalogId:i.eCatalogId}:{},...i.objectType==="opportunity"?{opportunityId:i.id}:{},...(I=(R=a.value)==null?void 0:R.configuration)!=null&&I.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:(H=(D=a.value)==null?void 0:D.configuration)==null?void 0:H.rowLimit,paging:(z=(F=a.value)==null?void 0:F.configuration)==null?void 0:z.paging,...((J=_.value)==null?void 0:J.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){d.handleError(de.errorMessage);return}de!=null&&de.itemCount&&(_.value.totalPages=Math.ceil((de==null?void 0:de.itemCount)/_.value.rowLimt)),h.value=on(de.lstItems,{xx_ord1__qty__c:"1"}),(ae=de.lstItems)!=null&&ae.length||(u.value=!0),b.value=!1}catch(ce){d.handleError("Failed to fetch Results. Please try again."),b.value=!1,console.info("[ERROR]: Adaptive Search getItems() error = ",ce)}}async function $(x){try{s.value=!0;const L=JSON.stringify({lstQLIRequest:U(x),quoteId:t.quoteId});let O=await window.salesforceConnector.createQLI(L);typeof O=="string"&&(O=JSON.parse(O));let q=!1;if((O==null?void 0:O.length)>0&&O.forEach(R=>{R.errorMessage&&(q=!0,d.handleError(R.errorMessage))}),s.value=!1,q){f.value=O;const R=f.value.reduce((I,D)=>(I[D.eCatalogItemId]=D.errorMessage,I),{});h.value=h.value.map(I=>({...I,backendError:R[I.Id]||""}));return}return O}catch(L){d.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addToQuote() error = ",L)}}function U(x){const L=[];for(const O of x)if(!O.addedToQuote&&O.id){const q=Q(O);l.value++,L.push({fields:q,recordId:O.id,...x.length===1?{maxSequenceNumber:l.value}:{}})}return L}function Q(x){const L=[],O=X();return Object.keys(x).forEach(q=>{if(O.includes(q)){const R=po[q.toLowerCase()];R&&L.push({fieldname:R,value:x[q]})}}),L}function X(){const x=[];return a.value.configuration.columns.forEach(L=>{L.field&&!L.field.includes(".")&&L.isEditable&&L.visible&&x.push(L.field)}),x}function te(){var L,O;const x=[];return a.value.configuration.columns.forEach(q=>{const R=q.field.toLowerCase();x.includes(R)||x.push(R)}),(L=a.value.configuration)!=null&&L.dynamicFilters&&a.value.configuration.dynamicFilters.filters.forEach(q=>{const R=q.field.toLowerCase();x.includes(R)||x.push(R)}),(O=a.value.configuration)!=null&&O.cardHeader&&x.push(a.value.configuration.cardHeader.imageField),x}async function Z(){var O;const x=te(),L=((O=a.value.configuration)==null?void 0:O.saveObjectName)||a.value.configuration.objectName;if(L==="xx_ord1__ecatalog_item__c"){const q=x.indexOf("xx_ord1__qty__c");q>-1&&x.splice(q,1)}await t.getFieldsData(x,L),t.fieldsData.xx_ord1__qty__c||t.getFieldsData(["xx_ord1__qty__c"],"xx_ord1__quote_line_item__c")}async function P({searchTerm:x="",filters:L=[]}={}){if(p.value=!0,x&&(v.value=x),L.length&&(m.value=L),await C()){await Z(),p.value=!1;const q=v.value;q&&(v.value=q,await M(q,t.dynamicFilters)),console.info("actionStore.isStaticActionCall = ",r.isStaticActionCall),r.isStaticActionCall&&(r.isStaticActionCall=!1,n.chatHistory[n.chatHistory.length-1]={type:"response",message:"Adaptive search is now open. Please search for the products you require and add it quote",loading:!1,links:[{action:"quoteItem",label:"Quote Item"},{action:"quoteDocument",label:"Quote Document"}]})}p.value=!1}return{selectedItem:o,AdaptiveSearchLayout:a,searchText:v,loadingAdaptiveLayout:c,getAdaptiveSearchLayout:C,getItems:M,lstItems:h,rowItemsLoading:b,noSearchRecords:u,dynamicFilters:g,setDynamicFilters:y,createQliErrors:f,addToQuote:$,addingToQuote:s,getFieldsData:Z,pagingData:_,appliedDynamicFilters:m,maxSequenceNumber:l,loadingAdaptiveSearch:p,initAdaptiveSearch:P}}),za=Ke.defineStore("quickSelection",()=>{const t=it(),i=Rt(),n=ut(),r=e.ref(null),o=e.ref(!1),a=e.ref([]),c=e.ref([]),b=e.ref(!1),h=e.ref({}),v=e.ref({rowLimit:10,paging:!0,offset:0,currentPage:1,totalPages:1}),u=e.ref(!1);async function g(){o.value=!0;try{const E=JSON.stringify({layoutType:"Quick Selection",layoutObject:"xx_ord1__ecatalog_item__c",...i.objectType?{contextObject:i.objectType}:{}});let A={};A=await window.salesforceConnector.getDynamicPageLayout(E),r.value=lo(A,"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(S=>{!S.field&&S.label==="QTY"&&(S.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 s(){const E=new Map;return r.value.data.columns.forEach(A=>{E.set(A.field,!0)}),r.value.data.searchResultColumns.forEach(A=>{E.set(A.field,!0)}),Array.from(E.keys())}async function m(E){var A,S;try{let T=await window.salesforceConnector.saveCompetitorSKU(E);if(T!=null&&T.errorMessage){t.handleError(T.errorMessage);return}if((A=T[0])!=null&&A.errorMessage){t.handleError((S=T[0])==null?void 0:S.errorMessage);return}return T}catch(T){t.handleError("Failed to Match Item. Please try again."),console.info("[ERROR]: saveCompetitorSKU() error = ",T)}}async function d(E="",A=[]){try{let S=r.value.data,T=r.value.configuration;const B=E.trim();if(console.info("searchTextValue.trim() = ",E.trim()),!B)return[];let V=null;console.info("useMappings = ",u.value),u.value?V=Ha(f()):V=f(),console.info("fields before filter = ",V),V=V.filter($=>$!=="xx_ord1__qty__c"),console.info("fields after filter = ",V);const w={fields:V,...A.length?{dynamicFilters:n.getDynamicFilters(A)}:{},searchText:B,accountId:i.accountId,...i.eCatalogId?{catalogId:i.eCatalogId}:{},...i.objectType==="opportunity"?{opportunityId:i.id}:{},...S!=null&&S.sort?{primarySortBy:S.sort.primary.field,primarySortOrder:S.sort.primary.direction,secondarySortBy:S.sort.secondary.field,secondarySortOrder:S.sort.secondary.direction}:{},rowLimt:(T==null?void 0:T.rowLimit)||20,paging:(T==null?void 0:T.paging)||!1,...v.value.offset!==0?{offset:v.value.offset}:{},objectName:S.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(S){t.handleError("Failed to fetch Results. Please try again."),console.info("[ERROR]: getQuickSelectionItems() error = ",S)}}function f(){let E=[];for(const A of r.value.data.columns){let S=A.field;if(S!=null&&S.includes(".")){E.includes(S)||E.push(S);let B=S.split(".")[0];B=B.slice(0,-1)+"c",E.includes(B)||E.push(B)}else E.includes(S)||E.push(S)}return console.info("getAllQuickSelectionFields() fields = ",E),E.filter(A=>A.toLowerCase()!=="xx_ord1__qty__c")}async function l(E,A,S,T){console.info("searchText:",JSON.stringify(E)),console.info("row:",JSON.stringify(A)),console.info("rowIndex:",JSON.stringify(S)),console.info("column:",JSON.stringify(T));const B=S+(v.value.currentPage-1)*v.value.rowLimit;if(T.field.toLowerCase().includes("xx_ord1__item__r")){if(a.value[B].itemLookupLoading=!0,u.value=!0,c.value=await d(E),c.value.length>0){const V=[];for(let w=0;w<c.value.length;w++)a.value[B].itemDataRetrieved=!0,c.value[w].xx_ord1__item__c&&V.push({name:c.value[w]["xx_ord1__item__r.name"],value:c.value[w].xx_ord1__item__c,label:c.value[w][T.field.toLowerCase()]});a.value[B][T.field.toLowerCase()+"_options"]=V}a.value[B].itemLookupLoading=!1}else if(T.field.toLowerCase().includes("xx_ord1__competitor_item__r")){a.value[B].competitorLookupLoading=!0;const V=await p(E);V!=null&&V.items&&(a.value[B][T.field.toLowerCase()+"_options"]=V.items.map(w=>({name:w.fields[2].value,value:w.fields[1].value,label:w.fields[0].value}))),a.value[B].competitorLookupLoading=!1,console.info("getLookupData:: Search Lookup Handler Response = ",V)}}async function p(E){var S,T;console.info("getLookupData() searchText = ",E);const A={searchText:E,obj:"xx_ord1__competitor_item__c",filters:null,displayFields:["xx_ord1__sku__c"]};try{let B=await window.salesforceConnector.getLookupData(JSON.stringify(A));if(typeof B=="string"&&(B=JSON.parse(B)),B!=null&&B.errorMessage){t.handleError(B.errorMessage);return}if((S=B[0])!=null&&S.errorMessage){t.handleError((T=B[0])==null?void 0:T.errorMessage);return}return B}catch(B){t.handleError("Failed to Search For Item. Please try again."),console.info("[ERROR]: getLookupData() error = ",B)}}async function _(E,A){var T;console.info("Update Other Fields Value = ",E),console.info("Update Other Fields Row Index = ",A);const S=A+(v.value.currentPage-1)*v.value.rowLimit;console.info("actualRowIndex = ",S);try{if(E){const B=c.value.filter(V=>V.xx_ord1__item__c===E)[0];if(B){b.value=!0;const V=r.value.data.columns[1].field;a.value[S][V]&&await C(B,S),(T=a.value[S])!=null&&T.itemDataRetrieved&&(a.value[S].status="New Match Requested",a.value[S].noMatchCleared=!0),Object.keys(B).forEach(w=>{const N=po[w.toLowerCase()];console.info("Mapped Key = ",N),N&&(a.value[S][N]=B[w])}),b.value=!1}else a.value[S].status=""}else a.value[S].status="No Match"}catch(B){t.handleError("Unable to request a match for this item please try again."),console.info("Error in updateOtherFields = ",B)}}async function C(E,A){const S=a.value[A],T=r.value.data.columns[1].field,B=[{sku:S[T],name:S[T],productDescription:S.xx_ord1__line_description__c||"",productURL:null,status:"Match Requested",competitorAccountId:null,itemId:E.xx_ord1__item__c}];let V=await m(JSON.stringify(B));console.info("Match Item: ",JSON.stringify(V)),a.value[A][`${T}_options`]=[{value:V[0].competitorItemId,label:V[0].sku}],a.value[A][T]=V[0].competitorItemId}async function y(E){try{let A=await window.salesforceConnector.createQLI(JSON.stringify(E));typeof A=="string"&&(A=JSON.parse(A));let S=!1;if((A==null?void 0:A.length)>0)for(let T=0;T<A.length;T++)A[T].errorMessage&&(S=!0,A[T].errorMessage.includes("Line Description: data value too large")&&(A[T].errorMessage="Error: The description is too long—it must be under 200 characters."));if(S){A.forEach(T=>{h.value[T.eCatalogItemId]=T});return}else h.value=[];return A}catch(A){t.handleError("Failed to add item to Quote. Please try again."),console.info("[ERROR]: addAllItemsToQuote() error = ",A)}}return{quickSelectionLayout:r,quickSelectionLayoutLoading:o,processedRecords:a,useMappings:u,currentSearchData:c,createQliErrors:h,getQuickSelectionLayout:g,getAllFieldsForQuickSelectionLayout:s,saveCompetitorSKU:m,getQuickSelectionItems:d,searchLookupHandler:l,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=at(),a=Kn(),c=e.ref(""),b=e.ref(""),h=e.ref([]),v=e.ref(""),u=e.ref([]),g=e.ref(!1),s=e.ref(null),m=ln(),d=e.ref({}),f=e.ref(null),l=e.ref(null),p=e.ref(null),_=e.ref(null),C=e.ref(null),y=e.ref(Ka),E=e.ref([]),A=e.computed(()=>t.orgId+"__"+t.user.Id+"__"+i.quoteId),S=e.computed(()=>s.value.readyState==WebSocket.OPEN),T=()=>{d.value={salesforceOrgId:t.orgId,salesforceOrgType:t.orgType,salesforceUserId:t.user.Id,userType:"Salesforce",chatRoomId:A.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 B(){const F=b.value+"?chatRoomId="+A.value;s.value=new WebSocket(F),s.value.addEventListener("open",V),s.value.addEventListener("message",M),s.value.addEventListener("close",w),s.value.addEventListener("error",N)}const V=()=>{$(),X()},w=()=>{U()},N=()=>{q(),U()},M=F=>{var J,G;$();const z=JSON.parse(F.data);if(z.status!=="ALIVE"){if(z.loading){y.value=z.message;return}else Array.isArray(z.messages)?(y.value=null,h.value.push(Za),z.messages.length>0&&x(z.messages)):z.agentResponse&&(z.errorMessage&&(z.agentResponse.content=z.errorMessage,z.agentResponse.error=!0),y.value=null,h.value.push({message:z.agentResponse.content,type:z.agentResponse.role,requestId:z.requestId,epoch:z.agentResponse.epoch,error:z.agentResponse.error,isDML:z.agentResponse.isDML,...(J=z.agentResponse)!=null&&J.filesData?{filesData:(G=z.agentResponse)==null?void 0:G.filesData}:{}}));E.value=z.links||[],I(z)}},$=()=>{U(),f.value=setTimeout(()=>{if(S.value){const F={action:"heartbeat"};s.value.send(JSON.stringify(F)),$()}},Qa)},U=()=>{f.value&&(clearInterval(f.value),f.value=null)};function Q(F){const z={...d.value};z.requestType="Action",z.actionType="Undo",z.undoRequestId=F,z.requestId=wt(),P(z)}function X(){const F={...d.value};F.requestType="Action",F.actionType="History",F.requestId=wt(),P(F)}function te(F){return a.path.startsWith("/configurator")&&o.isChangedConfiguration?(_.value={save:()=>{o.maintainQuoteConfiguration()}},c.value=F,!0):(c.value="",!1)}function Z(F,z=!0,J=null){if(!te(F)&&F.trim()){let G={...d.value};G.prompt=F.trim(),G.requestType="Chat",G.requestId=wt(),G.internalCall=!1,G.payload=L(),G.componentName=O.value,G.templateId=i.templateId,G.payload.lineItemsCount=i.lineItemsCount,J&&(G={...G,...J}),R(),z&&h.value.push({message:F.trim(),type:"user",...C.value&&{fileData:[C.value]},requestId:G.requestId}),P(G),$()}}function P(F){const z={action:"prompt",data:F};s.value.send(JSON.stringify(z))}const x=F=>{const z=F.filter(({content:J})=>!!J).map(J=>({message:J.content,type:J.role,requestId:J.requestId,epoch:J.epoch,isDML:J.isDML,undone:J.undone}));z.forEach((J,G)=>{J.isDML===!0&&G!==z.length-1&&(J.isDML=!1)}),h.value=[...h.value,...z]};function L(){return a.path==="/quote-item"?i.getPayload():{}}const O=e.computed(()=>a.path==="/quote-item"?"QuoteItem":""),q=()=>{h.value.push({type:"response",message:"Oops! Something went wrong while processing your request. Please try again later.",error:!0})},R=()=>{h.value=h.value.map(F=>({...F,links:[]}))};function I(F){var G,oe,ae;const z=((G=F==null?void 0:F.redirectObjects)==null?void 0:G.componentName)||(F==null?void 0:F.componentName),J=(F==null?void 0:F.redirectObjects)||{};if(z==="AdaptiveSearch"){const ce=(oe=F==null?void 0:F.payload)==null?void 0:oe.searchTerm,ye=(ae=F==null?void 0:F.payload)==null?void 0:ae.applyFilters;ce&&ce!==n.searchText&&n.initAdaptiveSearch({searchTerm:ce,filters:ye}),m.push("/adaptive-search")}else z==="Configurator"?m.push(`/configurator/${J.itemId}/${J.qliId}`):z==="QuoteReview"?m.push("/quote-item"):z==="QuoteItem"||z==="QuoteList"?(m.push("/quote-item"),i.performAIAction(F)):z==="QuickSelection"&&(r.quickSelectionLayout=F.payload,console.info("Loading QuickSelection data = ",JSON.stringify(r.quickSelectionLayout)),m.push("/match-records"))}function D(){if(S.value){const F={action:"cancel",data:{requestId:d.value.requestId,chatRoomId:A.value}};s.value.send(JSON.stringify(F))}}const H=()=>{l.value&&(clearInterval(l.value),l.value=null),f.value&&(clearInterval(f.value),f.value=null),p.value&&(clearTimeout(p.value),p.value=null)};return e.onBeforeUnmount(()=>{H()}),{unsavedChanges:_,loadingMessage:y,promptMessage:c,buttonLinks:E,websocketUrl:b,chatHistory:h,latestDMLRequest:v,strikethroughHistory:u,attachmentData:C,dataManuallyChanged:g,undoAction:Q,connectSocket:B,sendMessage:Z,setInitialPayload:T,cancelRequest:D}}),Rt=Ke.defineStore("root",()=>{const t=sn(),i=it(),n=ut(),r=e.ref(""),o=e.ref(""),a=e.ref("Genesis AI"),c=e.ref(""),b=e.ref({}),h=e.ref(""),v=e.ref(""),u=e.ref(""),g=e.ref(""),s=e.ref({}),m=e.ref(""),d=e.ref(""),f=e.ref(""),l=e.ref(""),p=e.ref(""),_=e.ref(""),C=e.ref(""),y=e.ref("Single"),E=e.ref("closed"),A=e.computed(()=>n.quoteName),S=e.computed(()=>y.value==="Single");async function T(N){r.value=N||io("id"),o.value=io("origin"),await V(),await B()}async function B(){try{console.info("getRecordInfo",r.value);let N=await window.salesforceConnector.getRecordInfo(r.value);return N=qe(N),N!==void 0&&(s.value=N,m.value=N.name,d.value=N.objectType,f.value=N.accountId,l.value=N.eCatalogId,p.value=N.currencyCode,_.value=N.userLocale,C.value=N.opportunityId),(N==null?void 0:N.objectType)==="XX_ORD1__Quote__c"?(n.quoteId=N==null?void 0:N.recordId,n.templateId=N==null?void 0:N.templateId,n.quoteName=N==null?void 0:N.name,n.lineItemsCount=(N==null?void 0:N.lineItemsCount)||0):(N==null?void 0:N.objectType)==="Opportunity"&&await n.getPrimaryQuote(N.recordId),N}catch(N){i.handleError(N.message)}}async function V(){var M,$;console.info("getOrgInformation",r.value);const N=await window.salesforceConnector.getOrgInformation();t.websocketUrl=N.websocketUrl,c.value=(M=N.locale)==null?void 0:M.replace("_","-"),b.value=N.user,h.value=N.orgName,v.value=N.orgId,u.value=N.orgType,g.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:A,subTitle:a,locale:c,user:b,orgName:h,orgId:v,orgType:u,packageVersion:g,objectType:d,recordInfo:s,name:m,accountId:f,eCatalogId:l,currencyCode:p,userLocale:_,opportunityId:C,pricingSchema:y,isSinglePricingSchema:S,flyoutState:E,start:T,getRecordInfo:B,setSubTitle:w}}),Xa="XX_ORD1__Quote__c",Ja="xxord1salespricec",cn="xx_ord1__item__c",Ga="xxord1productnrcc",Wa=Ke.defineStore("cartStore",()=>{const t=ut(),i=mo(),n=it(),r=e.ref(""),o=e.ref("$0"),a=e.ref("$0"),c=e.ref(null),b=e.ref({}),h=e.ref({}),v=e.ref({}),u=e.ref(""),g=e.ref(""),s=e.ref({}),m=e.ref(""),d=e.ref(""),f=e.ref({});async function l(){A()}async function p(){try{let B=await window.salesforceConnector.getProductCount(t.quoteId);if(B=qe(B),B!=null&&B.errorMessage){n.handleError(B.errorMessage);return}return r.value=B,B}catch{n.handleError("Failed to get Product Count. Please try again.")}}async function _(){try{let B=await window.salesforceConnector.getQuoteTotal(t.quoteId);if(B=qe(B),B!=null&&B.errorMessage){n.handleError(B.errorMessage);return}return a.value=B.monthlyTotal,o.value=B.onetimeTotal,B}catch{n.handleError("Failed to get Total Amount. Please try again.")}}async function C(B,V,w,N=""){if(!t.sectionDataMap.get(w).parentQLIs[V].removingItem){t.sectionDataMap.get(w).parentQLIs[V].removingItem=!0,d.value=B.id,await y(B.id)==="Success"&&(t.fetchAllQuoteLineItems(),N&&N(B,V,w));let $=t.sectionDataMap.get(w).parentQLIs.filter(U=>U[cn]===B[cn]).length;d.value="",i.lstItems.forEach(U=>{U[cn]===B[cn]&&(U.addedToQuote===!0&&(U.addedToQuote=!1),$===0&&(U.removedFromQuote=!0))})}}async function y(B){try{let V=await window.salesforceConnector.deleteQLI(B);if(V!=null&&V.errorMessage){n.handleError(V.errorMessage);return}return p(),_(),V}catch{n.handleError("Failed to remove Quote Item. Please try again.")}}function E(B){var N,M;const V=(N=B==null?void 0:B[Ga])==null?void 0:N.match(/\.\d+/);V&&(V.value=V[0].length-1);const w=(M=B==null?void 0:B[Ja])==null?void 0:M.match(/\.\d+/);return w&&(w.value=w[0].length-1),V||w}function A(B=!0){p(),_(),B&&t.fetchTemplates(Xa).then(()=>{t.getFilteredListWithFields()})}function S(B){const V=t.sectionDataMap;for(const[,w]of V.entries())w.parentQLIs.forEach(N=>{N.id===B.id&&(w.columns.forEach(M=>{if(M.dataType==="CURRENCY"){const $=M.field.replace(/_/g,"");N[$]=T(N[$],B[M.field])}}),B!=null&&B.billingPeriodValue&&(B!=null&&B.formattedBillingPeriodValue)&&(N.formattedBillingPeriodValue=T(N.formattedBillingPeriodValue,B.billingPeriodValue)),B!=null&&B.oneTimeValue&&(B!=null&&B.formattedOneTimeValue)&&(N.formattedOneTimeValue=T(N.formattedOneTimeValue,B.oneTimeValue)))})}function T(B,V){const w=Number(V);if(isNaN(w))return B;const N=B.match(/(\d[\d,]*)(\.\d+)?/);if(!N)return B;const M=N[2]||"",$=M.length?M.length-1:0,U=w.toLocaleString("en-US",{minimumFractionDigits:$,maximumFractionDigits:$});return B.replace(N[1]+M,U)}return{initializeCart:l,loadCartState:A,productCount:r,onetimeTotal:o,monthlyTotal:a,filterCartItem:c,billingPeriodValue:u,hasOneTimeValue:g,hasBillingPeriodInList:b,oneTimeFieldAvailable:h,billingPeriodFieldAvailable:v,priceDecimalPrecision:s,cartItemUpdatingId:m,removingItemLoaderId:d,cartItemColumnsMap:f,getProductCount:p,getQuoteTotal:_,removeItem:C,removeQuoteItem:y,getDecimalPrecisionFromSalesPriceOrNRC:E,updateFormattedValues:S,formateCurrencyValue:T}}),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=it(),i=Wa(),n=Rt(),r=e.ref(""),o=e.ref(""),a=e.ref(0),c=e.ref(""),b=e.ref([]),h=e.ref({template:!0,filteredList:!1}),v=e.ref(null),u=e.ref(new Map),g=e.ref({}),s=e.ref(!1),m=e.ref(!0),d=e.ref(!1),f=e.ref({text:"Hide Options",altText:"Show Options",handler:()=>{m.value=!m.value,T()},color:"#136E05",isActive:!1}),l=e.computed(()=>{const P=Array.from(u.value.values()).map(x=>x.sectionName);return Ya(P)});e.watch(c,()=>{h.value.template||S()});function p(){const P=new Map,x=[];for(const[O,q]of u.value.entries())P.set(O,q.selected),x.push(q);const L=JSON.parse(JSON.stringify(x));return L.forEach(O=>{delete O.selected;const q=new Map,R=[];O.lineItems.forEach(I=>{I.Selected=P.get(O.tableId).get(I.id)||!1,I.xx_ord1__parent_qli__c?(q.has(I.xx_ord1__parent_qli__c)||q.set(I.xx_ord1__parent_qli__c,[]),q.get(I.xx_ord1__parent_qli__c).push(I)):R.push(I)}),O.lineItems=R.map(I=>({...I,options:q.get(I.id)||[]})),delete O.loading,delete O.parentQLIs,delete O.totalValues}),{showOptions:m.value,sections:L,templateId:c.value}}async function _(P){try{let x=await window.salesforceConnector.getPrimaryQuote(P);x=qe(x),x!==void 0&&(console.info("getPrimaryQuote",JSON.stringify(x)),r.value=x.recordId,console.info("quoteId",r.value),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(P){var x,L;try{h.value.template=!0;let O=await window.salesforceConnector.fetchContentTemplates(JSON.stringify({lstObjectName:[P],templateType:"Document",templateId:null,fetchOnlyDefault:!1}));O=qe(O);const q=O==null?void 0:O.templates[P];return c.value||(c.value=(x=q.find(R=>R.XX_ORD1__Default__c))==null?void 0:x.Id),c.value||(c.value=(L=q[0])==null?void 0:L.Id),b.value=q,h.value.template=!1,b.value}catch(O){t.handleError(O.message),console.info("[ERROR]: fetchTemplates() error = ",O)}}function y(P){if(!P)return null;const x=/\{!\$(\w+):([\w.]+)\}/,L=P.match(x);return L?{function:L[1],apiname:L[2].split(".")[1]}:null}async function E(P){try{const x={Id:r.value,XX_ORD1__Document_Template__c:P};return await window.salesforceConnector.updateQuote(JSON.stringify([x]))}catch(x){t.handleError(x.message),console.info("[ERROR]: updateQuote() error = ",x)}}async function A(){try{h.value.filteredList=!0;let P=await window.salesforceConnector.getQuoteEPageLayout();u.value.clear(),i.cartItemColumnsMap={},P=qe(P);const x=P.map(O=>({label:O.fieldLabel,field:O.fieldName.toLowerCase(),isEditable:O.isEditable,dataType:O.dataType,...O.picklistValues?{picklistValues:O.picklistValues}:{}})),L=wt();return u.value.set(L,{loading:!0,lineItems:[],parentQLIs:[],columns:x,tableId:L,sectionName:"All Rows",selected:new Map,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}),i.cartItemColumnsMap[L]=x,f.value.isActive=!1,m.value=!0,v.value={lstCB:[{columns:x,footer:null,title:"All Rows",sectionName:"All Rows",tableId:L,filters:[],primarysort:"XX_ORD1__Sequence__c",primarysortdesc:""}]},T(),h.value.filteredList=!1,P}catch(P){t.handleError(P.message),console.info("[ERROR]: getQuoteEPageLayout() error = ",P)}}async function S(){if(b.value.length===0){A();return}try{h.value.filteredList=!0;let P=await window.salesforceConnector.getFilteredListWithFields(JSON.stringify({templateId:c.value}));E(c.value),P=qe(P),console.info("res.lstCB = ",P.lstCB);const x=P==null?void 0:P.objectFieldsMap;return u.value.clear(),i.cartItemColumnsMap={},P.lstCB=P.lstCB.map(L=>{const{fields:O,filters:q,primarysort:R,primarysortdesc:I}=JSON.parse(L.XX_ORD1__Block_Properties__c),D=O.map(F=>{var z;return{label:(z=x[F.api])==null?void 0:z.label,field:F.api.toLowerCase(),isEditable:F.api.includes(".")?!1:x[F.api].isEditable,dataType:x[F.api].dataType,...x[F.api].picklistValues?{picklistValues:x[F.api].picklistValues}:{}}}),H=L.Id||wt();return u.value.set(H,{loading:!0,lineItems:[],parentQLIs:[],columns:D,tableId:H,sectionName:L.Name,selected:new Map,footer:y(L.XX_ORD1__Table_Footer_HTML__c),filters:q,primarysort:R,primarysortdesc:I}),i.cartItemColumnsMap[H]=D,f.value.isActive=!1,m.value=!0,{columns:D,footer:y(L.XX_ORD1__Table_Footer_HTML__c),title:L.Name,sectionName:L.Name,tableId:H,filters:q,primarysort:R,primarysortdesc:I}}),v.value=P,T(),h.value.filteredList=!1,P}catch(P){t.handleError(P.message),console.info("[ERROR]: getFilteredListWithFields() error = ",P)}}async function T(P=!0){const x=[];for(const[L]of u.value)x.push(w(L,P));return await Promise.all(x),i.getProductCount(),!0}function B(P,x){return u.value.get(P).columns.some(L=>L.field.toLowerCase()===x)||i.cartItemColumnsMap[P].some(L=>L.field.toLowerCase()===x)}function V(P,x){let L=on(P);const O=n.pricingSchema,q=B(x,"xx_ord1__nrc__c"),R=B(x,"xx_ord1__sales_price__c"),I=B(x,"xx_ord1__qty__c");return L=L.map(D=>{let H={};O==="nrc/mrc"&&(D!=null&&D.xx_ord1__billing_period__c)?H={...R?{billingPeriodValue:(D==null?void 0:D.xx_ord1__sales_price__c)===0?"0":(D==null?void 0:D.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:D==null?void 0:D.xxord1salespricec}:{},...q?{oneTimeValue:(D==null?void 0:D.xx_ord1__nrc__c)===0?"0":(D==null?void 0:D.xx_ord1__nrc__c)||null,formattedOneTimeValue:D==null?void 0:D.xxord1nrcc}:{}}:O==="nrc/mrc"&&!(D!=null&&D.xx_ord1__billing_period__c)?R&&(H={oneTimeValue:(D==null?void 0:D.xx_ord1__sales_price__c)===0?"0":(D==null?void 0:D.xx_ord1__sales_price__c)||null,formattedOneTimeValue:D==null?void 0:D.xxord1salespricec}):O!=="nrc/mrc"&&(D!=null&&D.xx_ord1__billing_period__c)?R&&(H={billingPeriodValue:(D==null?void 0:D.xx_ord1__sales_price__c)===0?"0":(D==null?void 0:D.xx_ord1__sales_price__c)||null,formattedBillingPeriodValue:D==null?void 0:D.xxord1salespricec}):O!=="nrc/mrc"&&!(D!=null&&D.xx_ord1__billing_period__c)&&R&&(H={oneTimeValue:(D==null?void 0:D.xx_ord1__sales_price__c)===0?0:(D==null?void 0:D.xx_ord1__sales_price__c)||null,formattedOneTimeValue:D==null?void 0:D.xxord1salespricec});const{xx_ord1__qty__c:F,xx_ord1__sales_price__c:z,xx_ord1__nrc__c:J,...G}=D,oe={...G,id:D.id,description:(D==null?void 0:D.xx_ord1__line_description__c)||"",xx_ord1__billing_period__c:D==null?void 0:D.xx_ord1__billing_period__c,...I?{xx_ord1__qty__c:F}:{},xx_ord1__item__c:D==null?void 0:D.xx_ord1__item__c,"xx_ord1__item__r.xx_ord1__decimal_precision__c":D["xx_ord1__item__r.xx_ord1__decimal_precision__c"]||"0",...H};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}),L}async function w(P,x=!0){var L,O;try{const q=u.value.get(P);if(console.info("sectionData = ",q.sectionName),!q)return;q.loading=x,x&&(q.lineItems=[]);const{columns:R,filters:I,primarysort:D,primarysortdesc:H,footer:F}=q,z=R.map(de=>de.field.toLowerCase());z.includes("xx_ord1__parent_qli__c")||z.push("xx_ord1__parent_qli__c"),z.includes("xx_ord1__item__c")||z.push("xx_ord1__item__c"),z.includes("xx_ord1__sys_configuration_status2__c")||z.push("xx_ord1__sys_configuration_status2__c"),(L=i.cartItemColumnsMap[P])==null||L.forEach(de=>{z.includes(de.field)||z.push(de.field)});const J=await N({fields:z,recordId:r.value,filters:I||[],primarySortBy:D||"",primarySortOrder:H?"DESC":"ASC",includeOptions:m.value,totalFields:F?[F.apiname]:[]}),G=J.lineItems,oe=new Map;let ae=[];const ce=(O=J.fieldTotals)==null?void 0:O.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]):ae.push(de)});const ye=[];return ae.forEach(de=>{ye.push(de),oe.has(de.Id)&&ye.push(...oe.get(de.Id))}),ae=V(ae,P),q.lineItems=on(ye),q.parentQLIs=ae,q.totalValues=ce,q.loading=!1,u.value=new Map(u.value),ye}catch(q){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",q.message);const R=u.value.get(P);R&&(R.loading=!1)}}async function N(P){try{let x=await window.salesforceConnector.getQuoteLineItemsWithFilteredTable(JSON.stringify(P));return x=qe(x),x}catch(x){t.handleError(x.message),console.info("[ERROR]: getQuoteLineItemsWithFilteredTable() error = ",x)}}async function M(P){try{console.info("updateQli() payload = ",P);let x=await window.salesforceConnector.updateQli(JSON.stringify(P));return x=qe(x),T(!1),x}catch(x){t.handleError(x.message),console.info("[ERROR]: updateQli() error = ",x)}}async function $(P){try{let x=await window.salesforceConnector.deleteQLI(P);return x=qe(x),T(),x}catch(x){t.handleError(x.message),console.info("[ERROR]: deleteQLI() error = ",x)}}async function U(P,x){try{s.value=!0;const L={fields:P};x&&(L.objectName=x),P.includes("xx_ord1__qty__c")&&x==="xx_ord1__ecatalog_item__c"&&(L.fields=L.fields.filter(q=>q!=="xx_ord1__qty__c")),P.includes("xx_ord1__sales_price__c")&&x!=="xx_ord1__quote_line_item__c"&&(L.fields=L.fields.filter(q=>q!=="xx_ord1__sales_price__c"));let O=await window.salesforceConnector.getFieldsData(JSON.stringify(L));return typeof O=="string"&&(O=JSON.parse(O)),O!=null&&O.errorMessage?(t.handleError(O.errorMessage),null):(g.value={...g.value,...O},console.info("fieldsData.value = ",JSON.stringify(g.value)),O)}catch(L){return t.handleError("Failed to get Fields Data. Please try again."),console.info("[ERROR]: getFieldsData() error = ",L),null}finally{s.value=!1}}function Q(P=""){var x;return!P||P.includes(".")?!1:P.includes("xx_ord1__qty__c")?!0:((x=g.value[P])==null?void 0:x.isEditable)||!1}function X(){te(el)}async function te(P){var x,L,O,q,R,I,D,H,F;if(P.payload){if((x=P.payload)!=null&&x.uiModification){const z=P.payload.uiModification;if(((L=z.addColumn)==null?void 0:L.length)>0)if(z.addColumn.forEach(J=>{J.columns.forEach(G=>{G.field=G.field.toLowerCase()})}),z.addColumn[0].sectionName==="all_section")for(const[J,G]of u.value)G.columns=[...G.columns,...z.addColumn[0].columns];else z.addColumn.forEach(J=>{u.value.get(J.tableId)&&(u.value.get(J.tableId).columns=[...u.value.get(J.tableId).columns,...J.columns])});if(((O=z.removeColumn)==null?void 0:O.length)>0)if(z.removeColumn.forEach(J=>{J.columns=J.columns.map(G=>G.toLowerCase())}),z.removeColumn[0].sectionName==="all_section")for(const[J,G]of u.value)G.columns=G.columns.filter(oe=>!z.removeColumn[0].columns.includes(oe.field));else z.removeColumn.forEach(J=>{u.value.get(J.tableId)&&(u.value.get(J.tableId).columns=u.value.get(J.tableId).columns.filter(G=>!J.columns.includes(G.field)))});if(((q=z.filter)==null?void 0:q.length)>0)if(z.filter[0].sectionName==="all_section")for(const[J,G]of u.value)G.filters=[...G.filters,...z.filter[0].filters];else z.filter.forEach(J=>{u.value.get(J.tableId)&&(u.value.get(J.tableId).filters=[...u.value.get(J.tableId).filters,...J.filters])});if(((R=z.groupBy)==null?void 0:R.length)>0){const J=((I=[...u.value.values()][0])==null?void 0:I.columns)||tl;u.value.clear(),i.cartItemColumnsMap={},z.groupBy.forEach(G=>{i.cartItemColumnsMap[G.tableId]=G.columns||J,u.value.set(G.tableId,{loading:!0,lineItems:[],parentQLIs:[],columns:G.columns||J,tableId:G.tableId,sectionName:G.sectionName,selected:new Map,footer:y(G.footer),filters:G.filters,primarysort:G.primarysort,primarysortdesc:G.primarysortdesc})})}z.showOptions!==void 0&&(m.value=z.showOptions)}if(((H=(D=P.payload)==null?void 0:D.sections)==null?void 0:H.length)>0){const z=(F=P.payload)==null?void 0:F.sections;u.value.clear(),z.forEach(J=>{J.tableId||(J.tableId=wt()),J.selected=new Map,u.value.set(J.tableId,J)}),T()}}P.actionFunction==="Reload"&&(T(),console.info("Reloading quote line items"))}async function Z(P){var x,L;try{const O=new Set;for(const q of u.value.keys())(x=u.value.get(q).lineItems)==null||x.forEach(I=>{I.attributes=null,O.add(I.id)});if(P){const q={lineItemIds:[...O]},R=await window.productManagerController.getLineItemAttributes({request:JSON.stringify(q)}),I=JSON.parse(R.data);for(const D of u.value.keys())(L=u.value.get(D).lineItems)==null||L.forEach(F=>{F.attributes=I[F.id]||null})}}catch(O){console.info("[ERROR]: fetchAttributesData() error = ",O)}}return{showAttributes:d,quoteId:r,quoteName:o,templateId:c,templateOptions:b,loading:h,currentTemplateData:v,fieldsData:g,fieldsDataLoading:s,showOptionHeaderButton:f,sectionDataMap:u,promptSuggestions:l,lineItemsCount:a,addColumns:X,getQuoteEPageLayout:A,getPayload:p,getPrimaryQuote:_,fetchTemplates:C,getFilteredListWithFields:S,getQuoteLineItemsWithFilteredTable:N,updateQli:M,getFieldsData:U,deleteQLI:$,performAIAction:te,isEditableField:Q,fetchQuoteLineItems:w,fetchAllQuoteLineItems:T,fetchAttributesData:Z}}),go=Ke.defineStore("share",()=>{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"),h=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:h,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)},at=Ke.defineStore("configurator",()=>{Kn();const t=ut(),i=it(),n=go(),r=ln(),o=e.ref(null),a=e.ref(null),c=e.ref(null),b=e.ref(null),h=e.ref(null),v=e.ref([]),u=e.ref(null),g=e.ref(null),s=e.ref(new Map),m=e.ref(!1),d=e.ref({configuration:!1,lineItem:!1,productOptionsPricing:!1,bestOfferPrice:!1,lineItemAttributes:!1,save:!1}),f=e.ref(!1),l=e.computed(()=>p.value&&!n.isSinglePricingSchema),p=e.computed(()=>{let O=!0,q=!0,R=!0,I=null;for(const D of b.value.categoryOptions)for(const H of D.itemTypes)for(const F of H.options)F.billingPeriod&&(I&&I!==F.billingPeriod&&(R=!1),I=F.billingPeriod,!F.yrcPrice&&F.billingPeriod==="Monthly"&&(O=!1),!F.mrcPrice&&F.billingPeriod==="Yearly"&&(q=!1));return O&&q&&R}),_=e.computed(()=>!al(b.value,h.value)),C=e.computed(()=>{const O=b.value.categoryOptions;return O.forEach(q=>{q.itemTypes.forEach(R=>{R.selectedOptions=R.options.filter(I=>R.selected.includes(I.itemId)),R.totalPrice=function(){return R.selectedOptions.reduce((I,D)=>I+D.price*D.qty,0)||0},R.oneTimePrice=function(){return R.selectedOptions.filter(I=>!I.billingPeriod).reduce((I,D)=>I+D.price*D.qty,0)||0},R.recurringPrice=function(){return R.selectedOptions.filter(I=>I.billingPeriod).reduce((I,D)=>I+D.price*D.qty,0)||0}}),q.selectedItemTypes=q.itemTypes.filter(R=>R.selected.length>0),q.totalPrice=function(){return q.itemTypes.reduce((R,I)=>R+I.totalPrice(),0)},q.oneTimePrice=function(){return q.itemTypes.reduce((R,I)=>R+I.oneTimePrice(),0)},q.recurringPrice=function(){return q.itemTypes.reduce((R,I)=>R+I.recurringPrice(),0)}}),O.filter(q=>q.itemTypes.filter(R=>R.selected.length>0).length>0)}),y=e.computed(()=>C.value.reduce((O,q)=>O+q.totalPrice(),0)),E=e.computed(()=>{const O=C.value.reduce((I,D)=>I+D.totalPrice(),0);let q=C.value.reduce((I,D)=>I+D.oneTimePrice(),0),R=C.value.reduce((I,D)=>I+D.recurringPrice(),0);return b.value.billingPeriod?R=(R+b.value.price)*b.value.qty:q=(q+b.value.price)*b.value.qty,{basePrice:b.value.price,addOns:O,oneTimePrice:q,recurringPrice:R,total:b.value.price*b.value.qty+O*b.value.qty+q+R}}),A=e.computed(()=>{var q,R,I,D;const O=new Map;return(q=u.value)!=null&&q.productLineItem&&O.set((R=u.value)==null?void 0:R.productLineItem.XX_ORD1__Item__c,(I=u.value)==null?void 0:I.productLineItem),(D=u.value)==null||D.options.forEach(H=>{O.set(H.XX_ORD1__Item__c,H)}),O}),S=e.computed(()=>{const O=new Map;return b.value.categoryOptions.forEach(q=>{q.itemTypes.forEach(R=>{R.options.forEach(I=>{O.set(I.relationshipInfo.publishKey,I)})})}),O});function T(O){b.value.qliId&&(b.value.qliBillingPeriod==="Monthly"&&!O?b.value.price=b.value.qliSalesPrice||b.value.qliMrcPrice:b.value.qliBillingPeriod==="Yearly"&&O&&(b.value.price=b.value.qliSalesPrice)),b.value.categoryOptions.forEach(q=>{q.itemTypes.forEach(R=>{R.options.forEach(I=>{I.billingPeriod&&(I.price=(O?I.yrcPrice.offerPrice:I.mrcPrice.offerPrice)||I.price,I.qliId&&(I.qliBillingPeriod==="Monthly"&&!O?I.price=I.qliSalesPrice||I.qliMrcPrice:I.qliBillingPeriod==="Yearly"&&O&&(I.price=I.qliSalesPrice)))})})})}function B(){b.value=null,h.value=null,v.value=[],u.value=null,g.value=null,s.value=new Map,m.value=!1,d.value.configuration=!1,d.value.lineItem=!1,d.value.productOptionsPricing=!1,d.value.bestOfferPrice=!1,d.value.lineItemAttributes=!1,d.value.save=!1}async function V(O,q,R){console.time("CONFIGURATOR INIT CONFIGURATOR"),B(),console.timeLog("CONFIGURATOR INIT CONFIGURATOR","1"),a.value=O,c.value=q,o.value=R||n.quoteId;const I=await w();console.timeLog("CONFIGURATOR INIT CONFIGURATOR","2"),b.value=N(I),c.value&&(await $(),console.timeLog("CONFIGURATOR INIT CONFIGURATOR","3"),M(b.value),b.value.categoryOptions.forEach(D=>{D.itemTypes.forEach(H=>{H.options.forEach(F=>{M(F),(A.value.has(F.itemId)||F.relationshipInfo.relationship==="Kit")&&H.selected.push(F.itemId)})})}),console.timeLog("CONFIGURATOR INIT CONFIGURATOR","4")),h.value=JSON.parse(JSON.stringify(b.value)),console.timeEnd("CONFIGURATOR INIT CONFIGURATOR")}async function w(){try{const O={accountId:n.accountId,objectId:o.value,itemId:a.value,configScope:"BASIC",fields:[],pricePreference:"Lowest Price"},q=await window.productManagerController.getAvailableConfiguration(O);console.info("getAvailableConfiguration:result",q);const R=q.data.productConfiguration;return R.categoryOptions=il(R.categoryOptions),R}catch(O){return console.info("error",O.message),!1}}function N(O){s.value.set(c.value,O.attributes),v.value=O.configRules;const q=new Set;return v.value.forEach(R=>{const I=JSON.parse(R.ruleJson);I.optionSelected.forEach(D=>{q.add(D)}),I.affectedOptions.forEach(D=>{q.add(D)})}),M(O),O.categoryOptions.forEach(R=>{R.key=R.category.toLowerCase().replace(/\s+/g,"-").replace(/[&]/g,""),R.itemTypes.forEach(I=>{I.selected=[],I.numberOfColumns||(I.numberOfColumns=1),I.numberOfColumns>1&&(I.lightboxAttributes=!0),I.maxNumber||(I.maxNumber=100),I.minNumber||(I.minNumber=0),I.maxQuantity||(I.maxQuantity=1e4),I.minQuantity||(I.minQuantity=1),I.maxNumber===1?(I.isRadio=!0,I.minMessage="Please select 1 option",I.maxMessage="",I.isKit=I.options.some(D=>D.relationshipInfo.relationship==="Kit")):(I.minMessage=`Minimum of ${I.minNumber} selection${I.minNumber!==1?"s":""} required`,I.maxMessage=`Maximum of ${I.maxNumber} selection${I.maxNumber!==1?"s":""} allowed`),I.options.forEach(D=>{R.showImage=R.showImage||!!D.defaultImageURL,D.showAttributesModal=!1,D.calculateRules=q.has(D.relationshipInfo.publishKey),D.qty=I.minQuantity||1,D.getTags=()=>(D.attributes=D.attributes||[],D.attributes.filter(H=>H.value!==null&&H.value!=="").map(H=>({label:H.label,value:H.value}))),Object.defineProperty(D,"isDisabled",{get:function(){return D.relationshipInfo.relationship==="Kit"||(I.isRadio?I.isKit:!I.selected.includes(D.itemId)&&I.maxNumber===I.selected.length)}}),M(D)})})}),O}function M(O){O.isAttributes=O.attributes&&O.attributes.length>0;const q=O.catalogItem;if(A.value.has(O.itemId)){const R=A.value.get(O.itemId);O.qliId=R.Id,O.qty=R.XX_ORD1__QTY__c,O.itemName=R.XX_ORD1__Line_Description__c,O.billingPeriod=R.XX_ORD1__Billing_Period__c,O.price=R.XX_ORD1__Sales_Price__c,O.billingPeriod?O.price=R.XX_ORD1__Sales_Price__c||R.XX_ORD1__MRC__c:O.price=R.XX_ORD1__NRC__c||R.XX_ORD1__Sales_Price__c,O.qliSalesPrice=R.XX_ORD1__Sales_Price__c,O.qliNrcPrice=R.XX_ORD1__NRC__c,O.qliMrcPrice=R.XX_ORD1__MRC__c,O.qliBillingPeriod=R.XX_ORD1__Billing_Period__c,s.value.set(O.qliId,O.attributes)}else O.itemName=q.XX_ORD1__Line_Description__c||O.itemName,O.price=q.XX_ORD1__Negotiated_Price__c||q.XX_ORD1__NRC_for_New__c,O.nrcPrice=q.XX_ORD1__NRC_for_New__c}async function $(){var O;d.value.lineItem=!0,console.info("getLineItems",o.value,c.value);try{const q={objectId:o.value,filters:{},additionalFields:["Name","XX_ORD1__Line_Description__c"],primarySort:{field:"CreatedDate",direction:"DESC"},productPage:{limit:200,offset:0,productLineItemId:c.value}},R=await window.productManagerController.getLineItems({request:JSON.stringify(q)});return u.value=((O=R.data.products)==null?void 0:O.find(({productLineItem:I})=>I.Id===c.value))||null,console.info("lineItem.value",u.value),d.value.lineItem=!1,R}catch(q){return console.info("error",q.message),d.value.lineItem=!1,!1}}async function U(O){console.info("getRecords");try{const q=await window.productManagerController.getRecords({request:JSON.stringify(O)});return console.info("getRecords:result",q),JSON.parse(q.data)}catch(q){return console.info("error",q.message),!1}}async function Q(O){const q={accountId:n.accountId,eCatalogItemIds:O,pricePreference:"Heighest Priority"},R=await window.productManagerController.calculateBestOfferPrice({request:JSON.stringify(q)});return console.info("calculateBestOfferPrice:result",R),d.value.bestOfferPrice=!1,JSON.parse(R.data)}async function X(){m.value=!0,d.value.save=!0,console.info("maintainQuoteConfiguration");const O=[],q=[];b.value.categoryOptions.forEach(D=>{D.itemTypes.forEach(H=>{H.options.forEach(F=>{H.selected.includes(F.itemId)?O.push(te(F)):F.qliId&&q.push(F.qliId)})})});const R={objectId:o.value,eCatalogId:n.eCatalogId,isGenesisAI:!0,blinkUser:!1,optionsToRemove:q,grandFatheredOptionsToRemove:[],productLineItem:{...te(b.value),optionLineItems:O}};console.info("maintainQuoteConfiguration:request",R);const I=await window.productManagerController.maintainQuoteConfiguration({request:JSON.stringify(R)});if(console.info("maintainQuoteConfiguration:result",I),I!=null&&I.error){const D={title:"Unable to Save Configuration",description:I.error,button:{label:"Back to Configuration",action:()=>{m.value=!1}},cancel:{label:"Quote List",action:()=>{r.push("/quote-item?id="+o.value)}}};i.errorPopup=D}else h.value=JSON.parse(JSON.stringify(b.value)),console.info("maintainQuoteConfiguration:result",I);d.value.save=!1}function te(O){const q={};O.isAttributes&&O.attributes.forEach(I=>{I.apiName.includes(".")||(I.dataType==="BOOLEAN"?q[I.apiName]=I.value?"true":"false":I.dataType==="REFERENCE"?q[I.apiName]=I.referenceRecordId:q[I.apiName]=I.value)});const R={attributes:q,itemId:O.itemId,lineItemId:O.qliId,lineDescription:O.itemName,qty:O.qty,billingPeriod:O.billingPeriod,...O.offer};return O.billingPeriod&&p.value&&!n.isSinglePricingSchema&&(R.billingPeriod=f.value?"Yearly":"Monthly"),!n.isSinglePricingSchema&&!O.billingPeriod?R.nrcPrice=O.price:(R.applyOnField="Catalog Price",R.salesPrice=O.price,R.nrcPrice=O.nrcPrice),R}async function Z(){const O={objectId:n.eCatalogId,productItemId:a.value};try{let q=await window.productManagerController.getProductCrossSells({request:JSON.stringify(O)});if(console.info("getProductCrossSells:result",q),q=q.data?JSON.parse(q.data):{},q.crossSells.length===0)return q;const R=q.crossSells.map(H=>H.Id),I=await Q(R),D=new Map;return I.forEach(H=>{D.set(H.eCatalogItemId,{...H,...H.pricingTypes[0]})}),q.crossSells.forEach(H=>{H.loading=!1,H.Name=H.XX_ORD1__Line_Description__c||H.XX_ORD1__Item__r.Name,H.Description=H.XX_ORD1__Item__r.XX_ORD1__Product_Description__c,D.has(H.Id)?(H.Price=D.get(H.Id).offerPrice,H.priceFormatted=D.get(H.Id).formattedOfferPrice,H.offer={offerDiscount:D.get(H.Id).offerDiscount,offerId:D.get(H.Id).offerId,offerType:D.get(H.Id).offerType}):(H.Price=H.XX_ORD1__List_Price2__c,H.priceFormatted=H.XX_ORD1__List_Price2__c,H.offer={offerDiscount:0,offerId:null,offerType:null})}),q}catch(q){return console.info("error",q.message),!1}}async function P(O,q){var H,F;const R={product:{publishKey:b.value.publishKey,lineDescription:b.value.itemName},options:[]};b.value.categoryOptions.forEach(z=>{z.itemTypes.forEach(J=>{J.options.forEach(G=>{J.selected.includes(G.itemId)&&R.options.push({publishKey:G.relationshipInfo.publishKey,lineDescription:G.itemName})})})}),console.info("evaluateConfigSelection:currentConfig.options",R.options);const I={productJSON:{productItem:{configRules:v.value}},currentConfig:R,selected:O?{publishKey:(H=O.relationshipInfo)==null?void 0:H.publishKey,attributes:O.attributes,lineDescription:O.itemName}:{},unselected:q?{publishKey:(F=q.relationshipInfo)==null?void 0:F.publishKey,attributes:q.attributes,lineDescription:q.itemName}:{}};return await ol(I)}async function x(){try{const O=["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"],R=(await t.getQuoteLineItemsWithFilteredTable({fields:O,recordId:o.value,filters:[],includeOptions:!1,totalFields:[]})).lineItems;return console.info("fetchQuoteLineItems:res",R),R}catch(O){console.info("[ERROR]: fetchQuoteLineItems()123 error = ",O.message)}}async function L(O){const q={quoteId:o.value,lstQLIRequest:[{eCatalogItemId:O.Id,quantity:1,offerApplicable:O.offer}]};try{const R=await window.productManagerController.createQuoteProducts({request:JSON.stringify(q)});console.info("getProductCrossSells:result",R)}catch(R){return console.info("error",R.message),!1}}return{itemId:a,configuration:b,_configurationCopy:h,lineItem:u,savedScreen:m,loading:d,summary:C,addOns:y,summaryPrices:E,optionByItemId:A,attributesByQLIId:s,optionByPublishKey:S,showYearlyPricing:f,isYearlyPricingExist:p,isChangedConfiguration:_,isRecurringPricingSchema:l,changePricingScheme:T,createQuoteProducts:L,resetConfigurator:B,fetchQuoteLineItems:x,getRecords:U,getProductCrossSells:Z,initConfigurator:V,maintainQuoteConfiguration:X,evaluateConfigSelection:P}}),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=at(),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"}]),h=e.ref(null),v=e.ref([]),u=async d=>{d.loading=!0,await i.createQuoteProducts(d),d.disabled=!0,d.loading=!1},g=d=>{d.action==="backToConfiguration"?i.savedScreen=!1:d.action==="backToQuoteList"?r.push("/quote-item?id="+n.quoteId):d.link&&r.push(d.link)};async function s(){const d=await i.fetchQuoteLineItems();console.info("getQuoteLineItems1:_quoteLineItems",d);const f=d.filter(p=>p.XX_ORD1__SYS_Configuration_Status2__c=="Needs Configuration").length;console.info("getQuoteLineItems2:needsConfigurationCount",f),c.value=`(${d.length-f}/${d.length})`;const l=d.find(p=>p.XX_ORD1__SYS_Configuration_Status2__c=="Needs Configuration"&&p.Id!=i.qliId);return console.info("getQuoteLineItems3:result",l),h.value=l?{Name:l.XX_ORD1__Line_Description__c,Description:l.XX_ORD1__Item__r.XX_ORD1__Product_Description__c,Price:l.XX_ORD1__Sales_Price__c,XX_ORD1__Item__c:l.XX_ORD1__Item__c,Id:l.Id}:null,console.info("getQuoteLineItems4:configueredProduct",h.value),d}async function m(){i.resetConfigurator(),r.push({path:"/configurator/"+h.value.XX_ORD1__Item__c+"/"+h.value.Id}),i.initConfigurator(h.value.XX_ORD1__Item__c,h.value.Id)}return e.onBeforeMount(async()=>{a.value=!0;const d=await s(),f=await i.getProductCrossSells(),l=new Set;d.forEach(p=>{l.add(p.XX_ORD1__Item__c)}),f.crossSells.forEach(p=>{p.disabled=l.has(p.XX_ORD1__Item__c)}),v.value=f.crossSells||[],a.value=!1}),(d,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",ll,[e.createElementVNode("div",sl,[e.createVNode(we,{icon:"arrow",symbol:"",size:12,onClick:f[0]||(f[0]=l=>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(co,{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(so,{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,(l,p)=>(e.openBlock(),e.createElementBlock("div",{key:l.Id||p,class:"ect-bg-white ect-border ect-border-gray-300 ect-rounded-md ect-p-3 ect-flex ect-flex-col","data-test-id":`configurator-recommend-card-${l.Id||p}`},[e.createElementVNode("div",bl,[e.createElementVNode("h4",_l,e.toDisplayString(l.Name),1),e.createElementVNode("p",vl,e.toDisplayString(l.Description),1)]),e.createElementVNode("div",Cl,[e.createElementVNode("div",El,e.toDisplayString(e.unref(He)(l.Price)),1),e.createVNode(Ze,{btype:l.disabled?"secondary":"primary","button-style":l.disabled?"normal":"outlined",size:"medium",class:e.normalizeClass({"ect-w-[120px]":l.loading}),loading:l.loading,disabled:l.disabled||l.loading,"data-test-id":`configurator-recommend-button-add-${l.Id||p}`,onClick:_=>u(l)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.loading?"":l.disabled?"Added to Quote":"Add to Quote"),1)]),_:2},1032,["btype","button-style","class","loading","disabled","data-test-id","onClick"])])],8,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,(l,p)=>(e.openBlock(),e.createElementBlock("div",{key:l.title||p,class:"ect-bg-white ect-border ect-border-[#DEDEDE] ect-rounded-xl ect-p-4 md:ect-p-5 lg:ect-p-6 ect-flex ect-flex-col ect-items-center ect-gap-4 md:ect-gap-6 lg:ect-gap-8 ect-cursor-pointer ect-transition-all ect-duration-200 hover:ect-shadow-md hover:ect-border-gray-400","data-test-id":`configurator-recommend-redirect-card-${p}`,onClick:_=>g(l)},[e.createElementVNode("div",Ol,[e.createVNode(we,{icon:l.icon,size:20,color:"#000000","data-test-id":`configurator-recommend-redirect-icon-${p}`},null,8,["icon","data-test-id"])]),e.createElementVNode("div",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-${p}`},e.toDisplayString(l.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-${p}`},e.toDisplayString(l.description),9,Tl)])],8,xl))),128))])])),h.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(h.value.Name),1),e.createElementVNode("p",ql,e.toDisplayString(h.value.Description),1)]),e.createElementVNode("div",Dl,[e.createElementVNode("div",jl,e.toDisplayString(e.unref(He)(h.value.Price)),1),e.createVNode(Ze,{btype:"primary","button-style":"filled",size:"medium","data-test-id":"configurator-recommend-button-add-next-product",onClick:m},{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,h=>(e.openBlock(),e.createElementBlock("button",{key:h.key,class:e.normalizeClass(["ect-page-tab-button",`ect-page-tab-button${o.value===h.key?"-active":""} ${h.tabClass||""}`]),"data-test-id":`${t.dataTestId}-tab-${h.key}`,onClick:v=>a(h.key)},[e.createTextVNode(e.toDisplayString(h.title)+" ",1),h.pill!==void 0&&h.pill!==null?(e.openBlock(),e.createBlock(Hl,{key:0,class:"ect-ml-2",variant:h.pillStyle,"data-test-id":`${t.dataTestId}-tab-${h.key}-pill`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.pill),1)]),_:2},1032,["variant","data-test-id"])):e.createCommentVNode("",!0)],10,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"]]),Xl=["data-test-id"],Jl=["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,A)=>Math.min(Math.max(y,E),A),b=y=>{if(y==null||y==="")return NaN;const E=Number(y);return Number.isFinite(E)?E:NaN},h=e.ref(null),v=e.ref(n.value??o.value),u=y=>{v.value=c(y,o.value,a.value)};n.value!==null&&u(n.value);const g=e.computed(()=>v.value),s=e.computed(()=>h.value!=null?h.value:String(g.value)),m=e.computed(()=>n.disabled||g.value<=o.value),d=e.computed(()=>n.disabled||g.value>=a.value);function f(y){y!==n.value&&(v.value=y,r("update:value",y),r("change",y))}function l(){if(m.value)return;const y=c(g.value-1,o.value,a.value);h.value=null,f(y)}function p(){if(d.value)return;const y=c(g.value+1,o.value,a.value);h.value=null,f(y)}function _(y){const A=String(y.target.value??"").replace(/\D+/g,"");h.value=A}function C(){const y=b(h.value),E=o.value,A=c(Number.isNaN(y)?E:y,o.value,a.value);h.value=null,f(A)}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":m.value,"ect-cursor-not-allowed":m.value}]),disabled:m.value,"data-test-id":`${t.dataTestId}-decrement`,onClick:l}," - ",10,Jl),e.createElementVNode("input",{type:"text",inputmode:"numeric",pattern:"[0-9]*",value:t.empty?"":s.value,disabled:t.disabled,class:"ect-h-7 ect-w-[48px] ect-px-2 ect-border ect-border-gray ect-rounded-md ect-text-center ect-text-sm ect-font-medium ect-text-gray-900 focus:ect-outline-none focus:ect-border-gray-400 ect-bg-white","data-test-id":`${t.dataTestId}-input`,onInput:_,onBlur:C},null,40,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":d.value,"ect-cursor-not-allowed":d.value}]),disabled:d.value,"data-test-id":`${t.dataTestId}-increment`,onClick:p}," + ",10,Wl)],8,Xl))}},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=at(),r=t,o=e.ref(r.item),a=e.computed(()=>{const h=n.summaryPrices,v=[];return n.isRecurringPricingSchema?(v.push({label:"One Time Price",value:h.oneTimePrice,highlight:!1}),v.push({label:n.showYearlyPricing?"Yearly Price":"Monthly Price",value:h.recurringPrice,highlight:!1})):(v.push({label:"Base Price",value:h.basePrice,highlight:!1}),v.push({label:"Add Ons",value:h.addOns,highlight:!1}),v.push({label:"Total Price",value:h.total,highlight:!1})),v}),c=i,b=()=>{r.disabled||c("continue")};return(h,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,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g},[e.createElementVNode("div",{class:"ect-flex ect-flex-col ect-justify-center","data-test-id":`configurator-footer-price-${g}`},[e.createElementVNode("span",{class:"ect-text-xs ect-font-normal ect-text-gray-500 ect-text-left","data-test-id":`configurator-footer-price-label-${g}`},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-${g}`},e.toDisplayString(e.unref(He)(u.value)),11,os)],8,ns),g<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-${g}`},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"],Ye={__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"],Qn=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(""),h=e.ref(null),v=e.computed(()=>r.type==="currency"?p(r.modelValue):r.type==="number"?_(r.modelValue):r.modelValue),u=e.computed(()=>r.type==="string"?"text":"number"),g=e.computed(()=>r.type==="currency"?"0.01":void 0),s=e.computed(()=>r.type==="currency"?"0":void 0),m=()=>{r.disabled||(r.type==="currency"?b.value=parseFloat(r.modelValue)||"0.00":r.type==="number"?b.value=parseFloat(r.modelValue)||"0":b.value=r.modelValue,a.value=!0,e.nextTick(()=>{h.value&&(h.value.focus(),h.value.select())}))},d=()=>{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},f=()=>{b.value=r.modelValue,a.value=!1},l=()=>{a.value&&d()},p=C=>!C||isNaN(C)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(parseFloat(C)),_=C=>!C||isNaN(C)?"0":new Intl.NumberFormat("en-US").format(parseFloat(C));return e.watch(()=>r.modelValue,C=>{a.value||(b.value=C)}),i({startEditing:m,saveChanges:d,cancelEditing:f}),(C,y)=>{const E=e.resolveDirective("click-outside");return e.openBlock(),e.createElementBlock("div",{class:"ect-relative ect-inline-block ect-min-w-[60px] ect-h-[30px]","data-test-id":t.dataTestId,onMouseenter:y[1]||(y[1]=A=>c.value=!0),onMouseleave:y[2]||(y[2]=A=>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:h,"onUpdate:modelValue":y[0]||(y[0]=A=>b.value=A),type:u.value,step:g.value,min:s.value,class:e.normalizeClass(["ect-w-full ect-h-full ect-px-3 ect-bg-white ect-border ect-border-green-500 ect-rounded-sm ect-text-gray-700 ect-text-base ect-font-sans ect-outline-none ect-duration-200",C.$attrs.class]),"data-test-id":`${t.dataTestId}-input`,onKeyup:[e.withKeys(d,["enter"]),e.withKeys(f,["esc"])],onBlur:d},null,42,Ts),[[e.vModelDynamic,b.value]])],8,Vs)),[[E,l]]):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ect-flex ect-items-center ect-gap-2 ect-rounded ect-transition-colors ect-duration-200",{"ect-cursor-pointer":!t.disabled}]),"data-test-id":`${t.dataTestId}-display`,onClick:m},[(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"},Xs={key:0,class:"ect-w-16 ect-h-16 ect-rounded-lg ect-bg-gray-200 ect-flex-shrink-0 ect-overflow-hidden"},Js=["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={class:"ect-mt-1 ect-text-sm ect-text-gray-700 ect-leading-tight"},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"),h=e.computed({get:()=>n.quantity,set:d=>r("update:quantity",d)}),v=e.computed({get:()=>n.name,set:d=>r("update:name",d)}),u=d=>{r("update:quantity",d)},g=e.computed(()=>{if(a.value===0)return n.tags;const f=Math.floor(a.value/120);return n.tags.slice(0,Math.max(1,f))}),s=e.computed(()=>Math.max(0,n.tags.length-g.value.length)),m=()=>{if(o.value){const d=o.value,f=80,l=120,p=32,_=64;a.value=d.offsetWidth-f-l-p-_}};return e.onMounted(()=>{e.nextTick(()=>{m()})}),e.watch(()=>n.tags,()=>{e.nextTick(()=>{m()})},{deep:!0}),e.onMounted(()=>{window.addEventListener("resize",m)}),(d,f)=>(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(Qn,{modelValue:v.value,"onUpdate:modelValue":f[0]||(f[0]=l=>v.value=l),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:f[2]||(f[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(dn,{value:h.value,"onUpdate:value":f[1]||(f[1]=l=>h.value=l),min:t.minQuantity,max:t.maxQuantity,"data-test-id":`configurator-item-counter-${t.item.itemId}`,onChange:u},null,8,["value","min","max","data-test-id"])]),Ds,e.createElementVNode("div",js,[e.createVNode(Qn,{modelValue:c.value.price,"onUpdate:modelValue":f[3]||(f[3]=l=>c.value.price=l),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(d.$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(g.value,(l,p)=>(e.openBlock(),e.createElementBlock("span",{key:p,class:"ect-inline-block"},[e.createVNode(Ye,{label:l.label,value:l.value},null,8,["label","value"])]))),128)),s.value>0?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"ect-text-xs ect-text-gray-700 ect-border ect-border-gray-300 ect-rounded-md ect-px-2 ect-py-0.5","data-test-id":`configurator-item-button-more-tags-${t.item.itemId}`,onClick:f[4]||(f[4]=e.withModifiers(()=>{},["stop"]))}," +"+e.toDisplayString(s.value)+" more ",9,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:f[5]||(f[5]=l=>r("edit-attributes"))},[e.createVNode(Ye,{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:f[6]||(f[6]=l=>r("edit-attributes"))},[e.createVNode(Ye,{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",Xs,[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,Js)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",Gs,[e.createElementVNode("h3",Ws,e.toDisplayString(t.name),1),e.createElementVNode("p",Ys,e.toDisplayString(t.description),1)]),e.createElementVNode("div",ec,[e.renderSlot(d.$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(g.value,(l,p)=>(e.openBlock(),e.createElementBlock("span",{key:p,class:"ect-inline-block"},[e.createVNode(Ye,{label:l.label,value:l.value},null,8,["label","value"])]))),128)),s.value>0?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"ect-text-xs ect-text-gray-700 ect-border ect-border-gray-300 ect-rounded-md ect-px-2 ect-py-0.5","data-test-id":`configurator-item-button-more-tags-${t.item.itemId}`,onClick:f[7]||(f[7]=e.withModifiers(()=>{},["stop"]))}," +"+e.toDisplayString(s.value)+" more ",9,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:f[8]||(f[8]=l=>r("edit-attributes"))},[e.createVNode(Ye,{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:f[9]||(f[9]=l=>r("edit-attributes"))},[e.createVNode(Ye,{label:"Add attributes","add-button":""})])]))])):e.createCommentVNode("",!0),e.createElementVNode("div",ic,[e.createElementVNode("div",{onClick:f[11]||(f[11]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(dn,{value:h.value,"onUpdate:value":f[10]||(f[10]=l=>h.value=l),min:t.minQuantity,max:t.maxQuantity,"data-test-id":`configurator-item-counter-${t.item.itemId}`,onChange:u},null,8,["value","min","max","data-test-id"])]),e.createElementVNode("div",ac,[lc,e.createVNode(Qn,{modelValue:c.value.price,"onUpdate:modelValue":f[12]||(f[12]=l=>c.value.price=l),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(d.$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:oo(function(t){this.value=t,this.search&&!this.select&&this.$emit("search",t)}),handlerFocusIn(){!(this.modelValue&&this.search)&&!this.disabled&&(this.inputFocused=!0,this.updateDropdownPosition(),this.$emit("focus-in"))},updateSelected(t){t&&(this.value="",this.$emit("update:modelValue",t[this.property.key]),this.search&&!this.select&&!this.lookup&&this.$emit("search",""),this.onInputFocusedOut(!0))},clear(){this.disabled||(this.value="",this.$emit("update:modelValue",null),this.search&&!this.select&&!this.lookup&&this.$emit("search",""))},onInputFocusedOut(t=!1){(!this.isHover||t)&&!this.disabled&&(t?(this.highlightedIndex=-1,this.inputFocused=!1,this.$emit("focus-out")):setTimeout(()=>{this.highlightedIndex=-1,this.inputFocused=!1,this.$emit("focus-out")},100))},highlightNextOption(){this.highlightedIndex<this.options.length-1&&this.highlightedIndex++},highlightPreviousOption(){this.highlightedIndex>0&&this.highlightedIndex--}}},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]=h=>t.isHover=!0),onMouseleave:i[8]||(i[8]=h=>t.isHover=!1)},[n.label?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass(["title_label",{error_color:!!n.error}]),for:n.label,"data-test-id":`${n.dataTestId}-label`},[e.createTextVNode(e.toDisplayString(n.label)+" ",1),n.required?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass({error_color:!!n.error})},"*",2)):e.createCommentVNode("",!0)],10,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]=(...h)=>a.handlerFocusIn&&a.handlerFocusIn(...h)),onFocusout:i[3]||(i[3]=h=>a.onInputFocusedOut(!1)),onKeydown:[i[4]||(i[4]=e.withKeys(h=>a.updateSelected(n.options[t.highlightedIndex]),["enter"])),i[5]||(i[5]=e.withKeys(e.withModifiers((...h)=>a.highlightPreviousOption&&a.highlightPreviousOption(...h),["prevent"]),["up"])),i[6]||(i[6]=e.withKeys(e.withModifiers((...h)=>a.highlightNextOption&&a.highlightNextOption(...h),["prevent"]),["down"]))]},[!n.modelValue&&n.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref:"searchInput","onUpdate:modelValue":i[0]||(i[0]=h=>t.value=h),type:"text",name:"search",placeholder:n.placeholder,autocomplete:"off",disabled:n.disabled,"data-test-id":`${n.dataTestId}-search-input`,onInput:i[1]||(i[1]=e.withModifiers(h=>a.lookupSearchHandler(h.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,(h,v)=>(e.openBlock(),e.createElementBlock("div",{key:h[n.property.key],class:e.normalizeClass(["dropdown-item",{highlighted:v===t.highlightedIndex,"ect-pointer-events-none":h[n.property.assigned]}]),"data-test-id":`${n.dataTestId}-option-${v}`,onClick:u=>a.updateSelected(h)},[e.createElementVNode("div",{class:"name ect-items-center","data-test-id":`${n.dataTestId}-option-${v}-name`},[e.createElementVNode("span",Pc,[e.createElementVNode("span",{class:e.normalizeClass({"ect-text-zinc-400":h[n.property.assigned]}),"data-test-id":`${n.dataTestId}-option-${v}-value`},e.toDisplayString(h[n.property.value]==null?"Key and Value is Wrong":h[n.property.value]),11,qc),h[n.property.assigned]?(e.openBlock(),e.createElementBlock("span",{key:0,class:"ect-text-xs ect-leading-4 ect-text-zinc-600","data-test-id":`${n.dataTestId}-option-${v}-assigned`},"Assigned",8,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(h[n.badge]),9,jc)):e.createCommentVNode("",!0)],8,Rc),e.createElementVNode("div",{class:"info",title:a.subFieldsText(h),"data-test-id":`${n.dataTestId}-option-${v}-info`},[e.createElementVNode("span",null,e.toDisplayString(a.subFieldsText(h)),1)],8,$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
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
* Date: 2023-05-12T08:44:03.742Z
|
|
56
56
|
*/const Io={essential:[[{header:[1,2,3,4,5,6,!1]}],["bold","italic","underline"],[{list:"ordered"},{list:"bullet"},{align:[]}],["blockquote","code-block","link"],[{color:[]},"clean"]],minimal:[[{header:1},{header:2}],["bold","italic","underline"],[{list:"ordered"},{list:"bullet"},{align:[]}]],full:[["bold","italic","underline","strike"],["blockquote","code-block"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["link","video","image"],["clean"]]},id=e.defineComponent({name:"QuillEditor",inheritAttrs:!1,props:{content:{type:[String,Object]},contentType:{type:String,default:"delta",validator:t=>["delta","html","text"].includes(t)},enable:{type:Boolean,default:!0},readOnly:{type:Boolean,default:!1},placeholder:{type:String,required:!1},theme:{type:String,default:"snow",validator:t=>["snow","bubble",""].includes(t)},toolbar:{type:[String,Array,Object],required:!1,validator:t=>typeof t=="string"&&t!==""?t.charAt(0)==="#"?!0:Object.keys(Io).indexOf(t)!==-1:!0},modules:{type:Object,required:!1},options:{type:Object,required:!1},globalOptions:{type:Object,required:!1}},emits:["textChange","selectionChange","editorChange","update:content","focus","blur","ready"],setup:(t,i)=>{e.onMounted(()=>{a()}),e.onBeforeUnmount(()=>{n=null});let n,r;const o=e.ref(),a=()=>{var w;if(o.value){if(r=c(),t.modules)if(Array.isArray(t.modules))for(const N of t.modules)Xn.register(`modules/${N.name}`,N.module);else Xn.register(`modules/${t.modules.name}`,t.modules.module);n=new Xn(o.value,r),C(t.content),n.on("text-change",g),n.on("selection-change",m),n.on("editor-change",d),t.theme!=="bubble"&&o.value.classList.remove("ql-bubble"),t.theme!=="snow"&&o.value.classList.remove("ql-snow"),(w=n.getModule("toolbar"))===null||w===void 0||w.container.addEventListener("mousedown",N=>{N.preventDefault()}),i.emit("ready",n)}},c=()=>{const w={};if(t.theme!==""&&(w.theme=t.theme),t.readOnly&&(w.readOnly=t.readOnly),t.placeholder&&(w.placeholder=t.placeholder),t.toolbar&&t.toolbar!==""&&(w.modules={toolbar:(()=>{if(typeof t.toolbar=="object")return t.toolbar;if(typeof t.toolbar=="string")return t.toolbar.charAt(0)==="#"?t.toolbar:Io[t.toolbar]})()}),t.modules){const N=(()=>{var M,$;const U={};if(Array.isArray(t.modules))for(const Q of t.modules)U[Q.name]=(M=Q.options)!==null&&M!==void 0?M:{};else U[t.modules.name]=($=t.modules.options)!==null&&$!==void 0?$:{};return U})();w.modules=Object.assign({},w.modules,N)}return Object.assign({},t.globalOptions,t.options,w)},b=w=>typeof w=="object"&&w?w.slice():w,h=w=>Object.values(w.ops).some(N=>!N.retain||Object.keys(N).length!==1);let v;const u=w=>{if(typeof v==typeof w){if(w===v)return!0;if(typeof w=="object"&&w&&typeof v=="object"&&v)return!h(v.diff(w))}return!1},g=(w,N,M)=>{v=b(_()),u(t.content)||i.emit("update:content",v),i.emit("textChange",{delta:w,oldContents:N,source:M})},s=e.ref(),m=(w,N,M)=>{s.value=!!(n!=null&&n.hasFocus()),i.emit("selectionChange",{range:w,oldRange:N,source:M})};e.watch(s,w=>{w?i.emit("focus",o):i.emit("blur",o)});const d=(...w)=>{w[0]==="text-change"&&i.emit("editorChange",{name:w[0],delta:w[1],oldContents:w[2],source:w[3]}),w[0]==="selection-change"&&i.emit("editorChange",{name:w[0],range:w[1],oldRange:w[2],source:w[3]})},f=()=>o.value,l=()=>{var w;return(w=n==null?void 0:n.getModule("toolbar"))===null||w===void 0?void 0:w.container},p=()=>{if(n)return n;throw`The quill editor hasn't been instantiated yet,
|
|
57
57
|
make sure to call this method when the editor ready
|
|
58
|
-
or use v-on:ready="onReady(quill)" event instead.`},_=(w,N)=>t.contentType==="html"?A():t.contentType==="text"?y(w,N):n==null?void 0:n.getContents(w,N),C=(w,N="api")=>{const M=w||(t.contentType==="delta"?new od:"");t.contentType==="html"?S(M):t.contentType==="text"?E(M,N):n==null||n.setContents(M,N),v=b(M)},y=(w,N)=>{var M;return(M=n==null?void 0:n.getText(w,N))!==null&&M!==void 0?M:""},E=(w,N="api")=>{n==null||n.setText(w,N)},A=()=>{var w;return(w=n==null?void 0:n.root.innerHTML)!==null&&w!==void 0?w:""},S=w=>{n&&(n.root.innerHTML=w)},T=(w,N="api")=>{const M=n==null?void 0:n.clipboard.convert(w);M&&(n==null||n.setContents(M,N))},B=()=>{n==null||n.focus()},V=()=>{e.nextTick(()=>{var w;!i.slots.toolbar&&n&&((w=n.getModule("toolbar"))===null||w===void 0||w.container.remove()),a()})};return e.watch(()=>t.content,w=>{if(!n||!w||u(w))return;const N=n.getSelection();N&&e.nextTick(()=>n==null?void 0:n.setSelection(N)),C(w)},{deep:!0}),e.watch(()=>t.enable,w=>{n&&n.enable(w)}),{editor:o,getEditor:f,getToolbar:l,getQuill:p,getContents:_,setContents:C,getHTML:A,setHTML:S,pasteHTML:T,focus:B,getText:y,setText:E,reinit:V}},render(){var t,i;return[(i=(t=this.$slots).toolbar)===null||i===void 0?void 0:i.call(t),e.h("div",{ref:"editor",...this.$attrs})]}}),ad={class:"input"},ld=["for","data-test-id"],sd=["data-test-id"],cd=Ee({__name:"RichTextEditor",props:{modelValue:{type:String,default:""},editorOptions:{type:Object,default:()=>({modules:{toolbar:["bold","italic","underline",{align:[]},{list:"ordered"},{list:"bullet"}]},placeholder:"Add AI Instructions",theme:"snow"})},dataTestId:{type:String,default:""},label:{type:String,default:""},required:{type:Boolean,default:!1},error:{type:String,default:""}},emits:["update:modelValue"],setup(t){const i=t,n=e.computed(()=>typeof i.error=="string"?i.error:i.error===""?!1:i.error===!0?`${i.label||"Field"} is required`:i.error),r=e.ref("");return e.onBeforeMount(()=>{r.value=i.modelValue}),(o,a)=>(e.openBlock(),e.createElementBlock("div",ad,[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass({error_color:!!t.error}),for:t.label,"data-test-id":`${t.dataTestId}-label`},[e.createTextVNode(e.toDisplayString(t.label)+" ",1),t.required?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass({error_color:!!t.error})},"*",2)):e.createCommentVNode("",!0)],10,ld)):e.createCommentVNode("",!0),e.createVNode(e.unref(id),{"content-type":"html",toolbar:t.editorOptions,"model-value":t.modelValue,"data-test-id":t.dataTestId,content:r.value,"onUpdate:content":a[0]||(a[0]=c=>o.$emit("update:modelValue",c))},null,8,["toolbar","model-value","data-test-id","content"]),n.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"error_tooltip error_tooltip-bottom-right","data-test-id":`${t.dataTestId}-error`},e.toDisplayString(n.value),9,sd)):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-76aecac0"]]),dd={class:"ect-w-full ect-flex ect-flex-col ect-gap-4 ect-p-4 ect-rounded-md ect-border-1 ect-border-gray-200 md:ect-gap-5 lg:ect-gap-6","data-test-id":"configurator-inputs-container"},ud={key:0,class:"ect-text-sm ect-font-regular ect-text-gray-900"},fd={class:"ect-grid ect-grid-cols-1 sm:ect-grid-cols-2 ect-gap-4"},hd={key:0,class:"ect-col-span-2"},pd=["data-test-id"],md=["id","onUpdate:modelValue","disabled","data-test-id"],gd=["for","data-test-id"],yd={key:2,class:"quill-editor-styles"},bd=e.createElementVNode("div",{class:"dropdowntp"},null,-1),_d=e.createElementVNode("div",{id:"modals"},null,-1),Bo={__name:"InputsContainer",props:{title:{type:String,default:""},lookup:{type:Object,default:()=>null},attributes:{type:Array,required:!0,default:()=>[]},locale:{type:String,default:"en-US"}},setup(t){const i=at(),n=t,r=e.ref({modules:{toolbar:["bold","italic","underline",{align:[]},{list:"ordered"},{list:"bullet"}]},placeholder:"Add AI Instructions",theme:"snow"}),o=e.ref(n.lookup),a=e.computed(()=>{const h=n.lookup.relatedFields.map(v=>v.child);return h.push("Name"),h});function c(h,v){const u=v.options.find(g=>g.Id===h);h===null?(v.options=[],v.value=null,v.relatedFields.forEach(g=>{g.value=null})):(v.value=u.Name,v.relatedFields.forEach(g=>{g.value=u[g.child]}))}const b=oo(async function(h,v){v.loading=!0;const u={objectType:v.referenceObject,searchText:h||"",lstFields:a.value||[]},g=await i.getRecords(u);v.options=g,v.loading=!1});return(h,v)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",dd,[t.title?(e.openBlock(),e.createElementBlock("div",ud,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",fd,[o.value?(e.openBlock(),e.createElementBlock("div",hd,[e.createVNode(yo,{modelValue:o.value.referenceRecordId,"onUpdate:modelValue":[v[0]||(v[0]=u=>o.value.referenceRecordId=u),v[1]||(v[1]=u=>c(u,o.value))],"data-test-id":`configurator-inputs-lookup-${o.value.attRecordId??h.index}`,label:o.value.label,options:o.value.options,disabled:!o.value.editable,required:o.value.required,loading:o.value.loading,property:{key:"Id",value:"Name"},lookup:"",search:"",highlight:"",onSearch:v[2]||(v[2]=u=>e.unref(b)(u,o.value))},null,8,["modelValue","data-test-id","label","options","disabled","required","loading"])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.attributes,(u,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:"attribute-input"},[u.dataType==="PICKLIST"||u.dataType==="MULTIPICKLIST"?(e.openBlock(),e.createBlock(yo,{key:0,modelValue:u.value,"onUpdate:modelValue":s=>u.value=s,label:u.label,placeholder:u.label,disabled:!u.editable,options:u.picklistValues.map(s=>({label:s,value:s})),select:"",highlight:"","data-test-id":`configurator-inputs-dropdown-${u.attRecordId??h.index}`},null,8,["modelValue","onUpdate:modelValue","label","placeholder","disabled","options","data-test-id"])):u.dataType==="BOOLEAN"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"ect-flex ect-items-center ect-gap-3 ect-py-3.5","data-test-id":`configurator-inputs-checkbox-${u.attRecordId??h.index}`},[e.withDirectives(e.createElementVNode("input",{id:`checkbox-${u.attRecordId??h.index}`,"onUpdate:modelValue":s=>u.value=s,type:"checkbox",disabled:!u.editable,class:"ect-w-4 ect-h-4 ect-accent-success ect-border-gray-300 ect-rounded ect-text-text-success focus:ect-ring-green-500","data-test-id":`configurator-inputs-checkbox-input-${u.attRecordId??h.index}`},null,8,md),[[e.vModelCheckbox,u.value]]),e.createElementVNode("label",{for:`checkbox-${u.attRecordId??h.index}`,class:"ect-text-sm ect-font-medium ect-text-gray-900 ect-cursor-pointer","data-test-id":`configurator-inputs-checkbox-label-${u.attRecordId??h.index}`},e.toDisplayString(u.label),9,gd)],8,pd)):u.dataType==="TEXTAREA"?(e.openBlock(),e.createElementBlock("div",yd,[e.createVNode(cd,{modelValue:u.value,"onUpdate:modelValue":s=>u.value=s,label:u.label,required:u.required,"editor-options":r.value,"data-test-id":`configurator-inputs-textarea-quill-editor-${u.attRecordId??h.index}`},null,8,["modelValue","onUpdate:modelValue","label","required","editor-options","data-test-id"])])):(e.openBlock(),e.createBlock(_c,{key:3,modelValue:u.value,"onUpdate:modelValue":s=>u.value=s,label:u.label,disabled:!u.editable,highlight:"","data-test-id":`configurator-inputs-custom-${u.attRecordId??h.index}`},null,8,["modelValue","onUpdate:modelValue","label","disabled","data-test-id"]))]))),128))])]),bd,_d],64))}},vd={class:"ect-w-full ect-flex ect-flex-col ect-gap-4","data-test-id":"configurator-inputs-container"},Cd={class:"ect-bg-white ect-rounded-lg"},nr={__name:"AttributesContainer",props:{attributes:{type:Array,required:!0,default:()=>[]},locale:{type:String,default:"en-US"}},setup(t){const i=t,n=e.ref([]),r=e.ref([]),o=e.ref({});return e.onBeforeMount(()=>{const a={},c=[...i.attributes];c.forEach(h=>{h.dataType==="REFERENCE"&&(o.value[h.apiName]=["Name"],h.relatedFields=[],a[h.apiName]=h),h.editable=h.editable&&!h.apiName.includes(".")});let b=null;c.forEach(h=>{if(h.referenceObject==="XX_Base__Location__c"&&(b?h.firstLookup="Copy from "+b.label:b=h),h.apiName.includes(".")){const[v,u]=h.apiName.split(".");h.parent=v,h.child=u,o.value[v]!=null&&(o.value[v].push(u),a[v].relatedFields.push(h))}}),r.value=c.filter(h=>h.dataType==="REFERENCE"),n.value=c.filter(h=>!(h.apiName.includes(".")||h.dataType==="REFERENCE"))}),(a,c)=>(e.openBlock(),e.createElementBlock("div",vd,[e.createElementVNode("div",Cd,[e.createVNode(Bo,{attributes:n.value},null,8,["attributes"])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,b=>(e.openBlock(),e.createElementBlock("div",{key:b.attRecordId,class:"ect-bg-white ect-rounded-lg"},[e.createVNode(Bo,{title:b.referenceLabel+" Lookup",lookup:b,attributes:b.relatedFields},null,8,["title","lookup","attributes"])]))),128))]))}},Ed={class:"ect-px-6 ect-pt-4 ect-pb-6 ect-w-full ect-text-sm ect-leading-none ect-text-neutral-700 ect-max-md:max-w-full"},kd=e.createElementVNode("p",{class:"ect-m-1 ect-text-sm ect-font-regular ect-leading-5 ect-text-neutral-700"},"You Selected",-1),wd={class:"ect-flex ect-items-center ect-justify-between ect-rounded-lg ect-px-4 ect-py-2 ect-gap-2 ect-bg-light-bg-x"},Nd={class:"ect-mt-1 ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700"},xd={class:"ect-mt-1 ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700"},Od={class:"ect-mt-1 ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700"},Sd={class:"ect-px-6 ect-pt-4 ect-pb-6 ect-w-full ect-bg-light-bg-x ect-max-md:max-w-full"},Vd={class:"ect-flex ect-justify-end ect-gap-2 ect-p-4"},Td={__name:"AttributesModal",props:{option:{type:Object,required:!0},attributes:{type:Array,required:!0}},emits:["close","done"],setup(t,{emit:i}){const n=i,r=t,o=e.computed(()=>JSON.parse(JSON.stringify(r.attributes))),a=()=>{n("close")},c=()=>{n("done",o.value),n("close")};return(b,h)=>(e.openBlock(),e.createBlock(zn,{header:"",title:"Update Attributes Values",description:"Update the values associated with selected attributes.",footer:"","no-close":"",onClose:a},{content:e.withCtx(()=>[e.createElementVNode("header",Ed,[kd,e.createElementVNode("div",wd,[e.createElementVNode("p",Nd,e.toDisplayString(t.option.itemName),1),e.createElementVNode("p",xd,e.toDisplayString(t.option.qty),1),e.createElementVNode("p",Od,e.toDisplayString(t.option.price),1)])]),e.createElementVNode("main",Sd,[e.createVNode(nr,{attributes:o.value},null,8,["attributes"])])]),footer:e.withCtx(()=>[e.createElementVNode("div",Vd,[e.createVNode(Ze,{class:"ect-min-w-[100px]",btype:"secondary","button-style":"outlined",size:"medium","data-test-id":"attributes-modal-button-cancel",onClick:h[0]||(h[0]=v=>n("close"))},{default:e.withCtx(()=>[e.createTextVNode("Cancel")]),_:1}),e.createVNode(Ze,{class:"ect-min-w-[100px]",btype:"primary","button-style":"primary",size:"medium","data-test-id":"attributes-modal-button-done",onClick:c},{default:e.withCtx(()=>[e.createTextVNode("Done")]),_:1})])]),_:1}))}},Ad=["data-test-id"],Id=["data-test-id"],Bd=["data-test-id"],Ld={class:"ect-bg-white ect-rounded-xl ect-shadow-sm"},Md={class:"ect-relative ect-w-full ect-border-b ect-border-solid ect-border-b-neutral-200 max-md:ect-max-w-full"},Rd={key:0,class:"ect-flex ect-z-0 ect-flex-col ect-gap-4 ect-justify-center ect-py-4 ect-px-6 ect-w-full max-md:ect-px-5 max-md:ect-max-w-full"},Pd={class:"ect-gap-1 ect-w-full max-md:ect-max-w-full"},qd={class:"ect-text-lg ect-font-semibold ect-leading-5 ect-text-neutral-700 max-md:ect-max-w-full"},Dd={key:0,class:"ect-mt-1 ect-text-sm ect-leading-none ect-text-zinc-600 max-md:ect-max-w-full"},jd={class:"ect-flex ect-overflow-hidden ect-absolute ect-top-2.5 ect-right-4 ect-z-0 ect-p-1 ect-rounded-lg"},$d={key:0,class:"ect-flex-1 ect-overflow-y-auto ect-h-[600px] ect-max-h-[70vh]"},Fd={key:1,class:"ect-px-6 ect-pt-4 ect-pb-6 ect-w-full ect-text-xs ect-leading-4 ect-text-neutral-700 max-md:ect-px-5 max-md:ect-max-w-full"},Hd={key:2,class:"ect-relative ect-w-full ect-border-t ect-border-solid ect-border-t-neutral-200 max-md:ect-max-w-full"},Ud=Ee({__name:"AppModalGen3",props:{title:{type:String,required:!0},description:{type:String,required:!0},header:{type:Boolean,default:!1},footer:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:i}){const n=i;return(r,o)=>(e.openBlock(),e.createBlock(ro,{to:"modaltp"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"modal-mask","data-test-id":`${r.dataTestId}-mask`},[e.createElementVNode("div",{class:"modal-wrapper","data-test-id":`${r.dataTestId}-wrapper`},[e.createElementVNode("div",{class:"modal-container",style:e.normalizeStyle(r.width?`max-width: ${r.width.includes("calc")?r.width:r.width+"px"}; width: 100%;`:""),"data-test-id":`${r.dataTestId}-container`},[e.createElementVNode("div",Ld,[e.createElementVNode("div",Md,[t.header?(e.openBlock(),e.createElementBlock("div",Rd,[e.createElementVNode("div",Pd,[e.createElementVNode("div",qd,e.toDisplayString(t.title),1),t.description?(e.openBlock(),e.createElementBlock("div",Dd,e.toDisplayString(t.description),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),e.createElementVNode("div",jd,[e.createElementVNode("button",{class:"ect-flex ect-self-stretch ect-my-auto ect-w-6 ect-min-h-6 ect-cursor-pointer hover:ect-bg-gray-100 ect-rounded ect-transition-colors ect-justify-center ect-items-center","aria-label":"Close modal",onClick:o[0]||(o[0]=a=>n("close"))},[e.createVNode(we,{icon:"close",color:"#000000",size:"11",height:"11"})])])]),r.$slots.content?(e.openBlock(),e.createElementBlock("div",$d,[e.renderSlot(r.$slots,"content",{},void 0,!0)])):(e.openBlock(),e.createElementBlock("div",Fd,[e.renderSlot(r.$slots,"default",{},void 0,!0)])),t.footer?(e.openBlock(),e.createElementBlock("div",Hd,[e.renderSlot(r.$slots,"footer",{},void 0,!0)])):e.createCommentVNode("",!0)])],12,Bd)],8,Id)],8,Ad)]),_:3}))}},[["__scopeId","data-v-41ebff01"]]),pt=t=>(e.pushScopeId("data-v-d109b9d7"),t=t(),e.popScopeId(),t),zd={class:"ect-w-[600px]"},Kd={class:"ect-px-6 ect-pt-4 ect-w-full ect-text-sm ect-leading-none ect-text-neutral-700 ect-max-md:max-w-full"},Zd=pt(()=>e.createElementVNode("p",{class:"ect-m-1 ect-text-sm ect-font-regular ect-leading-5 ect-text-neutral-700"},"You Selected",-1)),Qd={class:"ect-flex ect-items-center ect-justify-between ect-rounded-lg ect-px-4 ect-py-2 ect-gap-2 ect-bg-light-bg-x"},Xd={class:"ect-mt-1 ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700"},Jd={class:"ect-mt-1 ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700"},Gd={class:"ect-mt-1 ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700"},Wd={class:"ect-px-6 ect-pt-4 ect-pb-6 ect-mt-4 ect-w-full ect-bg-light-bg-x ect-max-md:max-w-full"},Yd=pt(()=>e.createElementVNode("p",{class:"ect-text-xs ect-font-medium ect-leading-6 ect-text-neutral-700 ect-mb-3","data-test-id":"conflict-modal-supporting-text"}," Above selection requires a configuration change ",-1)),eu={class:"ect-flex ect-flex-col ect-gap-2"},tu={key:0,class:"ect-bg-white ect-border ect-border-neutral-200 ect-rounded-md","data-test-id":"conflict-modal-add-table"},nu=pt(()=>e.createElementVNode("div",{class:"ect-px-4 ect-py-2"},[e.createElementVNode("p",{class:"ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700","data-test-id":"conflict-modal-add-header"}," This change will add: ")],-1)),ru={class:"ect-flex-grow font-regular","data-test-id":"conflict-modal-add-product"},ou={class:"ect-w-20 ect-text-center font-regular","data-test-id":"conflict-modal-add-qty"},iu={class:"ect-w-28 ect-text-right font-regular","data-test-id":"conflict-modal-add-price"},au={key:1,class:"ect-bg-white ect-border ect-border-neutral-200 ect-rounded-md","data-test-id":"conflict-modal-remove-table"},lu=pt(()=>e.createElementVNode("div",{class:"ect-px-4 ect-py-2"},[e.createElementVNode("p",{class:"ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700","data-test-id":"conflict-modal-remove-header"}," This change will remove: ")],-1)),su={class:"ect-flex-grow font-regular","data-test-id":"conflict-modal-remove-product"},cu={class:"ect-w-20 ect-text-center font-regular","data-test-id":"conflict-modal-remove-qty"},du={class:"ect-w-28 ect-text-right font-regular","data-test-id":"conflict-modal-remove-price"},uu={class:"ect-flex ect-justify-between ect-items-center ect-px-4 ect-py-1 ect-w-full ect-text-sm ect-leading-none ect-text-neutral-700 ect-bg-white ect-rounded-md ect-border ect-border-neutral-200 ect-rounded-md"},fu=pt(()=>e.createElementVNode("p",{class:"ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700","data-test-id":"conflict-modal-price-change-label"}," Price change ",-1)),hu={class:"ect-text-sm ect-font-semibold ect-leading-5","data-test-id":"conflict-modal-price-change-value"},pu={class:"ect-px-6 ect-pt-4 ect-pb-6 ect-w-full"},mu=pt(()=>e.createElementVNode("p",{class:"ect-text-xs ect-font-medium ect-leading-6 ect-text-neutral-500 ect-mb-2","data-test-id":"conflict-modal-summary-supporting-text"}," Price Adjustment Summary ",-1)),gu={class:"ect-border ect-border-neutral-200 ect-rounded-md ect-overflow-hidden ect-mt-2 ect-bg-neutral-50","data-test-id":"conflict-modal-summary-table"},yu={class:"ect-flex ect-flex-col ect-gap-2"},bu={class:"ect-flex-1"},_u={class:"font-regular","data-test-id":"conflict-modal-summary-base-price-label"},vu={class:"ect-text-center ect-w-28"},Cu={class:"ect-text-sm ect-font-medium ect-leading-5 ect-text-neutral-700 ect-text-right ect-line-through","data-test-id":"conflict-modal-summary-base-price-original"},Eu={class:"ect-text-center ect-w-28"},ku={class:"ect-text-sm ect-font-semibold ect-leading-5 ect-text-text-success ect-text-right","data-test-id":"conflict-modal-summary-base-price-adjusted"},wu={class:"ect-border ect-border-neutral-200 ect-rounded-md ect-overflow-hidden ect-px-4 ect-py-1 ect-mt-2","data-test-id":"conflict-modal-summary-total"},Nu={class:"ect-flex ect-items-center"},xu=pt(()=>e.createElementVNode("div",{class:"ect-flex-1"},[e.createElementVNode("p",{class:"ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700","data-test-id":"conflict-modal-summary-total-label"}," Total Price change ")],-1)),Ou={class:"ect-text-center ect-w-28"},Su={class:"ect-text-sm ect-font-medium ect-leading-5 ect-text-neutral-700 ect-text-right ect-line-through","data-test-id":"conflict-modal-summary-base-price-original"},Vu={class:"ect-text-center ect-w-28"},Tu={class:"ect-text-sm ect-font-semibold ect-leading-5 ect-text-text-success ect-text-right","data-test-id":"conflict-modal-summary-base-price-adjusted"},Au={class:"ect-flex ect-justify-end ect-gap-2 ect-p-4"},Iu=Ee({__name:"ConflictModal",props:{item:{type:Object,required:!0},data:{type:Object,required:!0}},emits:["close","done"],setup(t,{emit:i}){const n=at(),r=i,o=t,a=e.computed(()=>{const d=n.summaryPrices,f=[];return f.push({label:"Base Price",value:d.basePrice,priceChange:d.basePrice}),f.push({label:"Add Ons",value:d.addOns,priceChange:d.addOns+g.value}),f}),c=e.computed(()=>{const d=n.summaryPrices;return{label:"Total Price",value:d.total,priceChange:d.total+g.value}}),b=e.computed(()=>o.data.inclusions.map(f=>n.optionByPublishKey.get(f))),h=e.computed(()=>b.value.filter(d=>d.itemId!==o.item.itemId)),v=e.computed(()=>o.data.exclusions.map(d=>n.optionByPublishKey.get(d))),u=e.computed(()=>v.value.filter(d=>d.itemId!==o.item.itemId)),g=e.computed(()=>b.value.reduce((d,f)=>d+f.price,0)-v.value.reduce((d,f)=>d+f.price,0)),s=()=>{r("close")},m=()=>{r("done")};return(d,f)=>(e.openBlock(),e.createBlock(Ud,{header:"",title:"Confirm Your Selection",description:"This selection requires a configuration change",footer:"","no-close":"",onClose:s},{content:e.withCtx(()=>[e.createElementVNode("div",zd,[e.createElementVNode("header",Kd,[Zd,e.createElementVNode("div",Qd,[e.createElementVNode("p",Xd,e.toDisplayString(t.item.itemName),1),e.createElementVNode("p",Jd,e.toDisplayString(t.item.qty),1),e.createElementVNode("p",Gd,e.toDisplayString(e.unref(He)(t.item.price)),1)])]),e.createElementVNode("main",Wd,[Yd,e.createElementVNode("div",eu,[h.value.length>0?(e.openBlock(),e.createElementBlock("div",tu,[nu,(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,l=>(e.openBlock(),e.createElementBlock("div",{key:l.itemId,class:"ect-flex ect-items-center ect-py-2 ect-px-4 ect-border-t ect-border-neutral-200"},[e.createElementVNode("p",ru,e.toDisplayString(l.itemName),1),e.createElementVNode("p",ou,e.toDisplayString(l.qty),1),e.createElementVNode("p",iu," + "+e.toDisplayString(e.unref(He)(l.price)),1)]))),128))])):e.createCommentVNode("",!0),u.value.length>0?(e.openBlock(),e.createElementBlock("div",au,[lu,(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,l=>(e.openBlock(),e.createElementBlock("div",{key:l.itemId,class:"ect-flex ect-items-center ect-py-2 ect-px-4 ect-border-t ect-border-neutral-200"},[e.createElementVNode("p",su,e.toDisplayString(l.itemName),1),e.createElementVNode("p",cu,e.toDisplayString(l.qty),1),e.createElementVNode("p",du," - "+e.toDisplayString(e.unref(He)(l.price)),1)]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",uu,[fu,e.createElementVNode("p",hu,e.toDisplayString(e.unref(He)(g.value)),1)])])]),e.createElementVNode("footer",null,[e.createElementVNode("div",pu,[mu,e.createElementVNode("div",gu,[e.createElementVNode("div",yu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(l,p)=>(e.openBlock(),e.createElementBlock("div",{key:l.label,class:e.normalizeClass(["ect-flex ect-px-4 ect-py-1",{"ect-border-t ect-border-neutral-200":p>0}])},[e.createElementVNode("div",bu,[e.createElementVNode("p",_u,e.toDisplayString(l.label),1)]),e.createElementVNode("div",vu,[e.createElementVNode("p",Cu,e.toDisplayString(e.unref(He)(l.value)),1)]),e.createElementVNode("div",Eu,[e.createElementVNode("p",ku,e.toDisplayString(e.unref(He)(l.priceChange)),1)])],2))),128))])]),e.createElementVNode("div",wu,[e.createElementVNode("div",Nu,[xu,e.createElementVNode("div",Ou,[e.createElementVNode("p",Su,e.toDisplayString(e.unref(He)(c.value.value)),1)]),e.createElementVNode("div",Vu,[e.createElementVNode("p",Tu,e.toDisplayString(e.unref(He)(c.value.priceChange)),1)])])])])])])]),footer:e.withCtx(()=>[e.createElementVNode("div",Au,[e.createVNode(Ze,{class:"ect-min-w-[100px]",btype:"secondary","button-style":"outlined",size:"medium","data-test-id":"conflict-modal-button-cancel",onClick:f[0]||(f[0]=l=>r("close"))},{default:e.withCtx(()=>[e.createTextVNode("Cancel")]),_:1}),e.createVNode(Ze,{class:"ect-min-w-[100px]",btype:"primary","button-style":"primary",size:"medium","data-test-id":"conflict-modal-button-done",onClick:m},{default:e.withCtx(()=>[e.createTextVNode("Done")]),_:1})])]),_:1}))}},[["__scopeId","data-v-d109b9d7"]]),Bu={class:"ect-flex ect-flex-col"},Lu=["onUpdate:modelValue","data-test-id","value","disabled","onChange"],Mu=["onUpdate:modelValue","data-test-id","value","disabled","onChange"],Ru={key:0},Pu={key:1,class:"ect-border-t ect-border-gray-200 ect-p-4"},qu={__name:"ConfiguratorTabSections",props:{data:{type:Object,required:!0}},setup(t){const i=at(),n=t,r=e.computed(()=>n.data.itemTypes||[]),o=e.computed(()=>n.data.showImage||!1),a=e.ref(null),c=e.ref({});let b=e.ref(null),h=e.ref(null);const v=(d,f)=>{d.qty=f},u=(d,f)=>{d.itemName=f},g=()=>{i.configuration.categoryOptions.forEach(d=>{d.itemTypes.forEach(f=>{f.options.forEach(l=>{i.configuration.sysGuidedOptions&&(a.value.hidden.includes(l.relationshipInfo.publishKey)?l.hidden=!0:l.hidden=!1),a.value.inclusions.includes(l.relationshipInfo.publishKey)&&!f.selected.includes(l.itemId)&&f.selected.push(l.itemId),a.value.exclusions.includes(l.relationshipInfo.publishKey)&&f.selected.includes(l.itemId)&&f.selected.splice(f.selected.indexOf(l.itemId),1)})})}),a.value=null,c.value=null},s=async(d,f,l,p)=>{if(d.preventDefault(),d.stopPropagation(),b.value=null,h.value=null,f.calculateRules){p&&p.isRadio?l.includes(f.itemId)?(l.splice(0,l.length),h.value=f.relationshipInfo.publishKey):(l.splice(0,l.length),l.push(f.itemId),b.value=f.relationshipInfo.publishKey):l.includes(f.itemId)?(l.splice(l.indexOf(f.itemId),1),h.value=f.relationshipInfo.publishKey):(l.push(f.itemId),b.value=f.relationshipInfo.publishKey);const _=h.value?f:null,C=b.value?f:null,y=await i.evaluateConfigSelection(_,C);y.inclusions.length>0||y.exclusions.length>0?(a.value=y,c.value=f,[...y.inclusions,...y.exclusions].includes(f.relationshipInfo.publishKey)||(b.value&&a.value.exclusions.push(b.value),h.value&&a.value.inclusions.push(h.value))):(a.value=y,b.value&&a.value.exclusions.push(b.value),h.value&&a.value.inclusions.push(h.value),g())}},m=(d,f,l,p)=>{d.target.type==="checkbox"||d.target.type==="radio"||(d.preventDefault(),d.stopPropagation(),p.isRadio?l.includes(f.itemId)?l.splice(0,l.length):(l.splice(0,l.length),l.push(f.itemId)):l.includes(f.itemId)?l.splice(l.indexOf(f.itemId),1):l.push(f.itemId),s(d,f,l,p))};return(d,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[a.value?(e.openBlock(),e.createBlock(Iu,{key:0,item:c.value,data:a.value,onClose:f[0]||(f[0]=l=>a.value=null),onDone:g},null,8,["item","data"])):e.createCommentVNode("",!0),e.createElementVNode("div",Bu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,l=>(e.openBlock(),e.createBlock(ms,{key:l.itemTypeId,title:l.itemTypeName,description:l.description,message:l.isRadio?l.selected?"":l.minMessage:l.selected.length<l.minNumber?l.minMessage:l.selected.length===l.maxNumber?l.maxMessage:""},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass([l.numberOfColumns===1?"ect-space-y-3 md:ect-space-y-4 ect-p-2 md:ect-p-4":l.numberOfColumns===2?"ect-grid ect-grid-cols-1 md:ect-grid-cols-2 ect-gap-3 md:ect-gap-4 ect-p-2 md:ect-p-4":"ect-grid ect-grid-cols-1 md:ect-grid-cols-2 lg:ect-grid-cols-3 ect-gap-3 md:ect-gap-4 ect-p-2 md:ect-p-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options||[],p=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p.itemId},[p.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(cc,{key:0,item:p,name:p.itemName,description:p.description||"","min-quantity":l.minQuantity,"max-quantity":l.maxQuantity,"show-image":o.value,selected:l.selected.includes(p.itemId),tags:p.getTags(),price:p.price,quantity:p.qty,"image-url":p.defaultImageURL,attributes:p.attributes||[],size:l.numberOfColumns,"item-id":p.itemId,"item-type":l.itemTypeName||"",category:l.category,"relationship-info":p.relationshipInfo||{},option:e.unref(i).optionByItemId.get(p.itemId),"is-attributes":p.isAttributes,"show-attributes":l.lightboxAttributes,disabled:p.isDisabled,"onUpdate:quantity":_=>v(p,_),"onUpdate:name":_=>u(p,_),onEditAttributes:_=>p.showAttributesModal=!0,onClick:_=>l.selected.includes(p.itemId)||p.isDisabled?null:m(_,p,l.selected,l)},{"selection-control":e.withCtx(()=>[l.isRadio?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,"onUpdate:modelValue":_=>l.selected[0]=_,"data-test-id":`configurator-${l.itemTypeId}-radio-${p.itemId}`,class:"ect-accent-success ect-w-5 ect-h-5",type:"radio",value:p.itemId,disabled:p.isDisabled,onClick:f[1]||(f[1]=e.withModifiers(()=>{},["stop"])),onChange:_=>s(_,p,l.selected,l)},null,40,Lu)),[[e.vModelRadio,l.selected[0]]]):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,"onUpdate:modelValue":_=>l.selected=_,"data-test-id":`configurator-${l.itemTypeId}-checkbox-${p.itemId}`,class:"ect-accent-success ect-w-5 ect-h-5",type:"checkbox",value:p.itemId,disabled:p.isDisabled,onClick:f[2]||(f[2]=e.withModifiers(()=>{},["stop"])),onChange:_=>s(_,p,l.selected,l)},null,40,Mu)),[[e.vModelCheckbox,l.selected]])]),default:e.withCtx(()=>[l.lightboxAttributes?(e.openBlock(),e.createElementBlock("div",Ru,[p.showAttributesModal?(e.openBlock(),e.createBlock(Td,{key:0,option:p,attributes:p.attributes,onDone:_=>p.attributes=_,onClose:_=>p.showAttributesModal=!1},null,8,["option","attributes","onDone","onClose"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",Pu,[e.createVNode(nr,{attributes:p.attributes},null,8,["attributes"])]))]),_:2},1032,["item","name","description","min-quantity","max-quantity","show-image","selected","tags","price","quantity","image-url","attributes","size","item-id","item-type","category","relationship-info","option","is-attributes","show-attributes","disabled","onUpdate:quantity","onUpdate:name","onEditAttributes","onClick"]))],64))),128))],2)]),_:2},1032,["title","description","message"]))),128))])],64))}},Du=t=>(e.pushScopeId("data-v-cb7a75a9"),t=t(),e.popScopeId(),t),ju={class:"ect-space-y-4"},$u={class:"ect-w-full ect-bg-white ect-border ect-border-ect-gray-200 ect-rounded-lg"},Fu={class:"ect-bg-white ect-border-b ect-border-ect-gray-200 ect-px-4 ect-py-4 ect-sticky ect-top-0 ect-z-[5] ect-overflow-hidden ect-rounded-t-lg"},Hu={class:"ect-text-sm ect-font-semibold ect-text-green-700","data-test-id":"configurator-summary-header-title"},Uu={class:"ect-bg-white ect-px-4 ect-py-4 ect-pb-3 ect-border-b ect-border-ect-gray-200 ect-top-[53px] ect-z-9 ect-overflow-hidden ect-sticky ect-top-[53px]"},zu={class:"ect-text-sm ect-font-medium ect-text-ect-gray-800","data-test-id":"configurator-summary-section-frame-color"},Ku={class:"ect-flex ect-items-center ect-bg-light-bg-x ect-border-b ect-border-ect-gray-200"},Zu={class:"ect-flex-1 ect-bg-ect-gray-50 ect-px-8 ect-py-4 ect-min-h-[56px] ect-flex ect-items-center"},Qu={class:"ect-text-sm ect-text-font-clr-light","data-test-id":"configurator-summary-item-red"},Xu={class:"ect-flex ect-items-center ect-px-8 ect-py-4 ect-gap-5"},Ju={class:"ect-flex ect-justify-center ect-min-w-[128px]"},Gu=Du(()=>e.createElementVNode("div",{class:"ect-border-r ect-w-[1px] ect-border-text-muted-light ect-h-6"},null,-1)),Wu={class:"ect-flex ect-justify-center ect-min-w-[100px]"},Yu={class:"ect-text-sm ect-font-semibold ect-text-ect-gray-800","data-test-id":"configurator-summary-price-red"},e1={key:0,class:"ect-flex ect-items-center ect-bg-light-bg-x ect-px-10 ect-py-3"},t1={class:"ect-flex ect-flex-wrap ect-items-center ect-bg-light-bg-x ect-gap-2"},n1={class:"ect-bg-white ect-px-8 ect-py-4 ect-pr-4 ect-flex ect-justify-end"},r1={class:"ect-text-sm ect-font-semibold ect-text-ect-gray-800","data-test-id":"configurator-summary-total"},o1=Ee({__name:"ConfiguratorSummaryTab",props:{summary:{type:Array,required:!0}},setup(t){return(i,n)=>(e.openBlock(),e.createElementBlock("div",ju,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.summary,r=>(e.openBlock(),e.createElementBlock("div",{key:r.key,class:"ect-mb-4"},[e.createElementVNode("section",$u,[e.createElementVNode("div",Fu,[e.createElementVNode("h3",Hu,e.toDisplayString(r.category),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.selectedItemTypes,o=>(e.openBlock(),e.createElementBlock("div",{key:o.itemTypeId,class:"ect-flex ect-flex-col ect-border-b ect-border-ect-gray-200"},[e.createElementVNode("div",Uu,[e.createElementVNode("h4",zu,e.toDisplayString(o.itemTypeName),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.selectedOptions,a=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:a.itemId},[e.createElementVNode("div",Ku,[e.createElementVNode("div",Zu,[e.createElementVNode("span",Qu,e.toDisplayString(a.itemName),1)]),e.createElementVNode("div",Xu,[e.createElementVNode("div",Ju,[e.createVNode(dn,{value:a.qty,"onUpdate:value":c=>a.qty=c,min:o.minQuantity,max:o.maxQuantity,"data-test-id":`configurator-summary-counter-${a.itemId}`},null,8,["value","onUpdate:value","min","max","data-test-id"])]),Gu,e.createElementVNode("div",Wu,[e.createElementVNode("span",Yu,e.toDisplayString(e.unref(He)(a.price)),1)])])]),a.isAttributes&&a.getTags().length>0?(e.openBlock(),e.createElementBlock("div",e1,[e.createElementVNode("div",t1,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.getTags(),c=>(e.openBlock(),e.createBlock(Ye,{key:c.attributeId,label:c.label,value:c.value},null,8,["label","value"]))),128))])])):e.createCommentVNode("",!0)],64))),128))]))),128)),e.createElementVNode("div",n1,[e.createElementVNode("span",r1," Total : "+e.toDisplayString(e.unref(He)(r.totalPrice())),1)])])]))),128))]))}},[["__scopeId","data-v-cb7a75a9"]]),i1={class:"configurator-page ect-flex ect-flex-col ect-h-full ect-relative","data-test-id":"configurator-page-container"},a1={"data-test-id":"configurator-tabs-container",class:"ect-bg-white ect-shadow-sm ect-flex-shrink-0 ect-mb-4"},l1={class:"ect-bg-white ect-border-t ect-border-gray-200 ect-flex-shrink-0 ect-absolute ect-bottom-0 ect-left-0 ect-right-0 ect-z-50","data-test-id":"configurator-footer-sticky"},s1=Ee({__name:"ConfiguratorTabs",emits:["scroll"],setup(t,{emit:i}){const n=at(),r=e.ref("billing-options"),o=e.computed(()=>n.configuration.categoryOptions),a=e.computed(()=>{const s=o.value.map(m=>({key:m.key,title:m.category}));return s.push({key:"summary",title:"Summary"}),s}),c=i,b=e.computed(()=>h.value.get(r.value)),h=e.computed(()=>{const s=new Map;return o.value.forEach(m=>{s.set(m.key,m)}),s}),v=()=>{console.info("Continue");const s=a.value.findIndex(m=>m.key===r.value);if(s<a.value.length-1){const m=a.value[s+1];r.value=m.key}else n.maintainQuoteConfiguration()};e.watch(r,s=>{u(s),c("scroll",0)});const u=s=>{r.value=s},g=s=>{const m=s.target.scrollTop;c("scroll",m)};return e.onBeforeMount(()=>{r.value=a.value[0].key}),(s,m)=>(e.openBlock(),e.createElementBlock("div",i1,[e.createElementVNode("div",a1,[e.createVNode(Ql,{modelValue:r.value,"onUpdate:modelValue":m[0]||(m[0]=d=>r.value=d),"show-tabs":!0,border:"",tabs:a.value,"data-test-id":"configurator-tabs-container",onTabChange:u},null,8,["modelValue","tabs"])]),r.value!=="summary"?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ect-flex-1 ect-min-h-0 ect-overflow-y-auto ect-p-4 ect-pt-0 ect-pb-20","data-test-id":"`configurator-${activeTab}-tab-content`",onScroll:g},[e.createVNode(qu,{data:b.value},null,8,["data"])],32)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"ect-flex-1 ect-min-h-0 ect-overflow-y-auto ect-p-4 ect-pt-0 ect-pb-20","data-test-id":"`configurator-${activeTab}-tab-content`",onScroll:g},[e.createVNode(o1,{summary:e.unref(n).summary},null,8,["summary"])],32)),e.createElementVNode("div",l1,[e.createVNode(as,{"btn-text":r.value!=="summary"?"Continue":"Save",item:e.unref(n).configuration,onContinue:v},null,8,["btn-text","item"])])]))}},[["__scopeId","data-v-22b3d01b"]]),c1={class:"ect-px-6 ect-pt-4 ect-pb-2 ect-bg-white"},d1={class:"ect-flow-root"},u1=["src","alt"],f1={key:1,class:"ect-mb-2"},h1={class:"ect-text-sm ect-text-gray-700 ect-leading-relaxed ect-transition-all ect-duration-400"},p1={key:0,class:"ect-mt-2"},m1={class:"ect-inline-block ect-mb-2"},g1={key:1,class:"ect-inline-block ect-mb-2"},y1={key:1,class:"ect-mt-2"},b1={__name:"ConfiguratorInfo",props:{config:{type:Object,required:!0},editAttributes:{type:Boolean,required:!0},scroll:{type:Number,default:0}},emits:["edit-attributes"],setup(t,{emit:i}){const n=t,r=i,o=e.computed(()=>n.config.attributes.map(a=>({label:a.label,value:a.value})).filter(a=>a.value!==null&&a.value!==""));return(a,c)=>(e.openBlock(),e.createElementBlock("div",c1,[e.createElementVNode("div",d1,[t.config.defaultImageURL&&t.scroll<50?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ect-bg-gray-200 ect-rounded-lg ect-overflow-hidden ect-float-left ect-mr-4 ect-mb-2",t.editAttributes?"ect-w-[40px] ect-h-[40px]":"ect-w-[104px] ect-h-[104px]"])},[t.config.defaultImageURL?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.config.defaultImageURL,alt:t.config.itemName,class:"ect-w-full ect-h-full ect-object-cover"},null,8,u1)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),t.scroll<50?(e.openBlock(),e.createElementBlock("div",f1,[e.createElementVNode("p",h1,e.toDisplayString(t.config.description),1)])):e.createCommentVNode("",!0),t.config.isAttributes?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[t.editAttributes?(e.openBlock(),e.createElementBlock("div",y1,[e.createVNode(nr,{attributes:t.config.attributes},null,8,["attributes"])])):(e.openBlock(),e.createElementBlock("div",p1,[o.value.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(b,h)=>(e.openBlock(),e.createElementBlock("span",{key:h,class:"ect-inline-block ect-mr-2 ect-mb-2"},[e.createVNode(Ye,{label:b.label,value:b.value},null,8,["label","value"])]))),128)),e.createElementVNode("span",m1,[e.createElementVNode("button",{"data-test-id":"configurator-info-button-edit-attributes",onClick:c[0]||(c[0]=b=>r("edit-attributes"))},[e.createVNode(Ye,{label:"Edit attributes","edit-button":""})])])],64)):(e.openBlock(),e.createElementBlock("span",g1,[e.createElementVNode("button",{"data-test-id":"configurator-info-button-add-attributes",onClick:c[1]||(c[1]=b=>r("edit-attributes"))},[e.createVNode(Ye,{label:"Add attributes","add-button":""})])]))]))],64)):e.createCommentVNode("",!0)])]))}},_1=["data-test-id"],v1=["placeholder","value","data-test-id"],C1=["data-test-id"],E1=["data-test-id","onClick"],k1=Ee({__name:"MoleculeSearch",props:{placeholder:{type:String,default:""},modelValue:{type:String,default:""},height:{type:[Number,String],default:32},size:{type:String,default:"regular"},loading:{type:Boolean,default:!1},options:{type:Array,default:()=>[]},iconPosition:{type:String,default:"right",validator:t=>["left","right"].includes(t)},dataTestId:{type:String,required:!0}},emits:["update:modelValue","optionClick"],setup(t,{emit:i}){const n=t,r=i,o=e.ref(""),a=e.ref(null),c=e.ref(!1),b=e.ref(null),h=e.ref(!0),v=e.computed(()=>h.value?{}:{bottom:"100%",marginTop:"0",marginBottom:"4px"}),u=async()=>{var E;if(await e.nextTick(),!b.value)return;const p=b.value.getBoundingClientRect(),C=window.innerHeight-p.bottom,y=Math.min(((E=n.options)==null?void 0:E.length)*40+20,200);h.value=C>=y},g=()=>{a.value=null,r("update:modelValue","")},s=l=>{const p=l.target.value;o.value&&(clearTimeout(o.value),o.value=null),o.value=setTimeout(()=>{r("update:modelValue",p)},500)},m=async()=>{c.value=!0,await u()},d=()=>{setTimeout(()=>{c.value=!1},150)},f=l=>{c.value=!1,o.value&&(clearTimeout(o.value),o.value=null),r("update:modelValue",l.label),r("optionClick",l)};return(l,p)=>{var _;return e.openBlock(),e.createElementBlock("div",{ref_key:"searchContainer",ref:b,class:e.normalizeClass(["molecule-search",{"icon-left":t.iconPosition==="left"}]),"data-test-id":t.dataTestId},[t.loading?(e.openBlock(),e.createBlock(co,{key:0,size:16,class:"icon ect-top-2 icon-loader","data-test-id":`${t.dataTestId}-loader`},null,8,["data-test-id"])):t.iconPosition==="left"||!t.modelValue?(e.openBlock(),e.createBlock(we,{key:1,class:"icon-search ect-mt-[-1px]",icon:"search",size:14,color:"#5f5f5f","data-test-id":`${t.dataTestId}-search`,onClick:g},null,8,["data-test-id"])):e.createCommentVNode("",!0),e.createElementVNode("input",{class:e.normalizeClass(["search-input-box",{large:t.size==="large"}]),type:"text",style:e.normalizeStyle({height:`${t.height}px`}),placeholder:n.placeholder,value:t.modelValue,"data-test-id":`${t.dataTestId}-input`,onInput:s,onFocus:m,onBlur:d},null,46,v1),t.modelValue&&!t.loading?(e.openBlock(),e.createBlock(we,{key:2,class:"close-btn",icon:"close",size:8,color:"#5f5f5f","data-test-id":`${t.dataTestId}-close`,onClick:g},null,8,["data-test-id"])):e.createCommentVNode("",!0),((_=t.options)==null?void 0:_.length)>0&&c.value?(e.openBlock(),e.createElementBlock("div",{key:3,class:e.normalizeClass(["search-options",{"dropdown-top":!h.value}]),style:e.normalizeStyle(v.value),"data-test-id":`${t.dataTestId}-dropdown`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(C,y)=>(e.openBlock(),e.createElementBlock("div",{key:C.id,class:"search-option","data-test-id":`${t.dataTestId}-option-${y}`,onClick:e.withModifiers(E=>f(C),["stop"]),onMousedown:p[0]||(p[0]=e.withModifiers(()=>{},["prevent"]))},[e.createTextVNode(e.toDisplayString(C.label)+" ",1),e.createElementVNode("span",null,e.toDisplayString(C.subLabel),1)],40,E1))),128))],14,C1)):e.createCommentVNode("",!0)],10,_1)}}},[["__scopeId","data-v-6cdaa802"]]),w1=["data-test-id"],N1=Ee({__name:"StatePill",props:{text:{type:String,required:!0},state:{type:String,default:"default",validator:t=>["default","draft","review","active","inactive","in draft","active"].includes(t)},dataTestId:{type:String,default:""}},setup(t){const i=t,n=e.computed(()=>({"ect-state-pill--default":i.state==="default","ect-state-pill--draft":i.state==="draft"||i.state==="in draft","ect-state-pill--review":i.state==="review","ect-state-pill--active":i.state==="active","ect-state-pill--inactive":i.state==="inactive"}));return(r,o)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["ect-state-pill",n.value]),"data-test-id":t.dataTestId},e.toDisplayString(t.text),11,w1))}},[["__scopeId","data-v-6be678b8"]]),x1=["data-test-id"],O1=["data-test-id"],S1=["data-test-id"],V1=["data-test-id"],T1=["data-test-id","onClick"],A1=["data-test-id"],I1=Ee({__name:"ecBreadcrumbs",props:{links:{type:Array,default:()=>[],validator:t=>t.every(i=>typeof i=="object"&&typeof i.text=="string"&&(i.route===void 0||typeof i.route=="string"||typeof i.route=="object"))},dataTestId:{type:String,required:!0}},setup(t){const i=ln(),n=r=>{r&&i.push(r)};return(r,o)=>(e.openBlock(),e.createElementBlock("div",{class:"ect-flex ect-items-center ect-justify-between","data-test-id":t.dataTestId},[e.createElementVNode("div",{class:"ect-flex ect-items-center ect-gap-4","data-test-id":`${t.dataTestId}-container`},[e.createElementVNode("div",{class:"ect-flex ect-items-center ect-gap-1","data-test-id":`${t.dataTestId}-breadcrumbs`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.links,(a,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:c},[c>0?(e.openBlock(),e.createElementBlock("span",{key:0,class:"ect-text-[#828282] ect-text-xs ect-font-semibold","data-test-id":`${t.dataTestId}-separator-${c}`}," / ",8,V1)):e.createCommentVNode("",!0),a.route?(e.openBlock(),e.createElementBlock("button",{key:1,class:"ect-text-[#828282] ect-text-xs ect-font-semibold ect-font-ui ect-leading-normal hover:ect-text-[#0076D6] hover:ect-underline ect-transition-colors","data-test-id":`${t.dataTestId}-link-${c}`,onClick:b=>n(a.route)},e.toDisplayString(a.text),9,T1)):(e.openBlock(),e.createElementBlock("span",{key:2,class:"ect-text-[#828282] ect-text-xs ect-font-semibold ect-font-ui ect-leading-normal","data-test-id":`${t.dataTestId}-text-${c}`},e.toDisplayString(a.text),9,A1))],64))),128))],8,S1)],8,O1)],8,x1))}},[["__scopeId","data-v-151ca816"]]),B1={components:{AppIcon:we},props:{direction:{type:String,default:"top",validator:t=>["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"].includes(t)},content:{type:String,default:null},disabled:{type:Boolean,default:!1},width:{type:Number,default:130},icon:{type:String,default:null},dataTestId:{type:String,default:""}},data(){return{show:!1}},computed:{tooltipClass(){return{tooltip:!0,[`tooltip-${this.direction}`]:!0}},styleObj(){return{width:`${this.width}px !important`}}},methods:{showTooltip(){this.disabled||(this.show=!0)},hideTooltip(){this.show=!1}}},L1=["data-test-id"],M1=["data-test-id"];function R1(t,i,n,r,o,a){const c=e.resolveComponent("AppIcon");return n.content?(e.openBlock(),e.createElementBlock("div",{key:0,class:"tooltip-container","data-test-id":n.dataTestId,onMouseover:i[0]||(i[0]=(...b)=>a.showTooltip&&a.showTooltip(...b)),onMouseleave:i[1]||(i[1]=(...b)=>a.hideTooltip&&a.hideTooltip(...b))},[e.renderSlot(t.$slots,"default",{},void 0,!0),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(a.tooltipClass),style:e.normalizeStyle(a.styleObj),"data-test-id":`${n.dataTestId}-content`},[n.icon?(e.openBlock(),e.createBlock(c,{key:0,icon:n.icon,color:"#57c046",size:14,"data-test-id":`${n.dataTestId}-icon`},null,8,["icon","data-test-id"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.content),1)],14,M1),[[e.vShow,o.show]])],40,L1)):e.renderSlot(t.$slots,"default",{key:1},void 0,!0)}const P1=Ee(B1,[["render",R1],["__scopeId","data-v-b36acc62"]]),q1=Ke.defineStore("item",()=>{const t=it(),i=e.ref([]),n=e.ref([]),r=e.ref(!1),o=e.ref(0),a=e.ref(1),c=e.ref(""),b=e.ref(20),h=e.ref(null),v=e.ref(!1),u=e.ref(null),g=e.ref(!1),s=e.ref(null),m=e.ref(null),d=e.ref(null),f=e.ref(null),l=e.ref(null),p=e.ref({addedOptionIds:null,eCatalogCount:null,ecatalogs:null,publishVersionId:null,removedOptionIds:null}),_=e.ref([]),C=e.ref({ecatalogIds:[],optionItemsToAdd:[]}),y=e.ref(!1),E=e.ref(null),A=e.ref(0),S=2,T=H=>{!Array.isArray(H)||H.every(z=>{var J;return z.id&&((J=z.itemTypes)==null?void 0:J.every(G=>{var oe;return G.id&&((oe=G.options)==null?void 0:oe.every(ae=>ae.id))}))})||H.forEach((z,J)=>{z.id||(z.id=`category-${J}-${z.category}`),z.itemTypes&&Array.isArray(z.itemTypes)&&z.itemTypes.forEach((G,oe)=>{G.id||(G.id=G.itemTypeId||`itemType-${J}-${oe}-${G.itemTypeName||"unnamed"}`),G.options&&Array.isArray(G.options)&&G.options.forEach((ae,ce)=>{ae.id||(ae.id=ae.itemId||`option-${J}-${oe}-${ce}-${ae.itemName||"unnamed"}`)})})})},B=async(H,F=null)=>{var z;try{g.value=!0;let J={};if(F)J={fileId:F};else{const oe=_.value.find(ce=>ce.status==="Draft"),ae=_.value.find(ce=>ce.status==="Active");ae?J={fileId:ae.id}:oe?J={fileId:oe.id}:J={itemId:H}}let G=await window.AdminConfiguratorManager.getItemConfiguration({request:JSON.stringify(J)});return G!=null&&G.errorMessage?(t.handleError(G.errorMessage),null):(G=qe(G.data),typeof G.data=="string"&&(G=JSON.parse(G.data)),(z=G==null?void 0:G.productItem)!=null&&z.categoryOptions&&T(G.productItem.categoryOptions),h.value=G,g.value=!1,_.value.length===0&&!r.value&&await te(),G.data)}catch(J){return g.value=!1,t.handleError("Failed to fetch item configuration. Please try again.",J),null}},V=async(H,F="",z="")=>{try{const J={searchTerm:H,itemTypeId:F,filterType:z};let G=await window.AdminConfiguratorManager.getItemsList({request:JSON.stringify(J)});return G=qe(G),G!=null&&G.errorMessage?(t.handleError(G.errorMessage),null):G}catch{return t.handleError("Failed to fetch option list. Please try again."),null}},w=async(H,F)=>{try{const z={productItemId:l.value,optionItemId:H,existingItemType:F};let J=await window.AdminConfiguratorManager.getItemDetails({request:JSON.stringify(z)});return J=qe(J),J!=null&&J.errorMessage?(t.handleError(J.errorMessage),null):J}catch{return t.handleError("Failed to fetch option details. Please try again."),null}},N=async()=>{try{const H=await window.AdminConfiguratorManager.getAvailableAttributes();return JSON.parse(H)}catch{t.handleError("Failed to fetch available attributes. Please try again.")}},M=async H=>{try{const F=await window.AdminConfiguratorManager.addAttribute({request:JSON.stringify(H)});return JSON.parse(F)}catch{t.handleError("Failed to fetch item configuration. Please try again.")}},$=async H=>{try{const F=JSON.stringify(H),z=await window.AdminConfiguratorManager.getChildFields({request:F});return JSON.parse(z)}catch(F){throw t.handleError("Failed to fetch child fields. Please try again.",F),F}},U=async()=>{const H={objectApiName:"XX_Base__Item_Type__c",fieldApiName:"XX_Base__Item_Type_Category__c"};try{return(await window.AdminConfiguratorManager.getPicklistValues({request:JSON.stringify(H)})).data}catch(F){throw t.handleError("Failed to fetch picklist values. Please try again.",F),F}},Q=async()=>{var H,F,z;try{const J=(F=(H=h.value)==null?void 0:H.productItem)==null?void 0:F.itemStatus,oe={fileId:(z=_.value.find(ce=>ce.status===J))==null?void 0:z.id,itemId:l.value};let ae=await window.AdminConfiguratorManager.activateItemConfig({request:JSON.stringify(oe)});return ae!=null&&ae.error?(L(ae==null?void 0:ae.error),null):(ae=qe(ae.data),p.value=ae,ae)}catch{return L(),null}},X=async()=>{try{const H={productId:"068bn00000Anu0YAAR"};return(await window.AdminConfiguratorManager.getECatalogsForProduct({request:JSON.stringify(H)})).data}catch(H){t.handleError("Failed to fetch e catalogs for product. Please try again.",H)}},te=async()=>{try{const H={productId:l.value},F=await window.AdminConfiguratorManager.getProductConfigInfo({request:JSON.stringify(H)}),z=JSON.parse(F.data);return _.value=z.data,z}catch(H){t.handleError("Failed to save item configuration. Please try again.",H)}},Z=async()=>{try{const H={ecatalogIds:C.value.ecatalogIds,productItemId:l.value,optionItemsToAdd:C.value.optionItemsToAdd};return(await window.AdminConfiguratorManager.saveItemConfigToCatalog({request:JSON.stringify(H)})).data}catch(H){t.handleError("Failed to save item configuration to catalog. Please try again.",H)}},P=async()=>{var H,F,z;try{const J=(F=(H=h.value)==null?void 0:H.productItem)==null?void 0:F.itemStatus,G={itemId:l.value,fileId:(z=_.value.find(ye=>ye.status===J))==null?void 0:z.id},oe=await window.AdminConfiguratorManager.createNewVersion({request:JSON.stringify(G)}),ae=JSON.parse(oe);await te(),await B(l.value,ae.id);const ce=_.value.findIndex(ye=>ye.status==="Draft");return ce!==-1?_.value[ce]=ae:_.value.push(ae),ae}catch(J){t.handleError("Failed to create new version. Please try again.",J)}},x=async()=>{var J,G;const H=(J=_.value.find(oe=>oe.status==="Inactive"))==null?void 0:J.id,F=(G=_.value.find(oe=>oe.status==="Active"))==null?void 0:G.id,z={itemId:l.value,activeVersionId:F,inactiveVersionId:H};try{return(await window.AdminConfiguratorManager.rollbackItemConfig({request:JSON.stringify(z)})).data}catch(oe){t.handleError("Failed to rollback item configuration. Please try again.",oe)}},L=H=>{H?E.value=H:E.value=null,y.value=!0};return{items:i,loading:r,totalCount:o,currentPage:a,searchTerm:c,itemLimit:b,columns:n,currentItemConfig:h,savingItemConfiguration:v,currentItem:u,configLoader:g,currentItemData:s,currentGroupIndex:m,currentOptionIndex:d,currentOptionData:f,versionInfo:_,activateConfigData:p,activatePayload:C,itemId:l,showActivationErrorModal:y,activationError:E,activationRetryCount:A,maxRetries:S,getItemConfiguration:B,getItemsList:V,getItemDetails:w,getAvailableAttributes:N,addAttribute:M,getChildFields:$,getPicklistValues:U,activateItemConfig:Q,getECatalogsForProduct:X,getversionInfo:te,saveItemConfigToCatalog:Z,createNewVersion:P,rollbackItemConfig:x,addCrossSell:async H=>{const F={itemId:H.id||H.itemId,primarySortOrder:H.primarySortOrder};try{const z=await window.AdminConfiguratorManager.addCrossSell({request:JSON.stringify(F)});return JSON.parse(z.data)}catch(z){return t.handleError("Failed to add cross sell. Please try again.",z),null}},saveItemConfiguration:async()=>{var H;if(g.value||r.value||v.value||!((H=h.value)!=null&&H.productItem))return null;if(!(h.value.productItem.itemStatus==="Active"||h.value.productItem.itemStatus==="Inactive"))try{v.value=!0;const F={itemId:l.value,configurationData:h.value},z=await window.AdminConfiguratorManager.saveItemConfiguration({request:JSON.stringify(F)});if(z!=null&&z.errorMessage)return t.handleError(z.errorMessage),null;if(!(z!=null&&z.error)){const J=_.value.findIndex(G=>G.status==="Draft");_.value[J].id=z.data}return z}catch(F){return t.handleError("Failed to save item configuration. Please try again.",F),null}finally{v.value=!1}},showActivationError:L,hideActivationError:()=>{y.value=!1,A.value=0},incrementRetryCount:()=>{A.value+=1,y.value=!0},canRetry:()=>A.value<S,assignStableIds:T}}),D1={class:"app-filters-main-wrapper"},j1={class:"app-filters-wrapper"},$1={class:"app-filters"},F1={class:"left-section"},H1={class:"ect-flex ect-gap-2 ect-items-center"},U1={class:"ect-absolute ect-top-0 ect-right-0 ect-w-full ect-h-full ect-z-10"},z1={class:"right-section"},K1={class:"after-search-wrapper"},Z1={class:"buttons-wrapper"},Q1={class:"before-button-wrapper"},X1={key:0,class:"action-wrapper"},J1={key:1,class:"button-text ect-font-medium"},G1={key:2,class:"count-badge"},W1=Ee({__name:"FilterHeader",props:{title:{type:String,default:""},showSearch:{type:Boolean,default:!1},buttons:{type:Array,default:()=>[],validator:t=>t.every(i=>(i.icon||i.text)&&typeof i.handler=="function")},searchWidth:{type:String,default:"312px"},showBackButton:{type:Boolean,default:!1},statusText:{type:String,default:""},placeholder:{type:String,default:"Search by name"},breadcrumbLinks:{type:Array,default:()=>[],validator:t=>t.every(i=>typeof i=="object"&&typeof i.text=="string"&&(i.route===void 0||typeof i.route=="string"))},recordLink:{type:String,default:""}},emits:["search","back"],setup(t,{emit:i}){const n=q1(),r=t,o=e.reactive([]);e.onMounted(()=>{a()});const a=()=>{o.splice(0,o.length),r.buttons&&r.buttons.length>0&&r.buttons.forEach(s=>{o.push({...s})})};e.watch(()=>r.buttons,()=>{a()},{deep:!0});const c=s=>{b("search",s)},b=i,h=e.ref(""),v=(s,m)=>{s.supportsToggle&&(s.isActive=!s.isActive),typeof s.handler=="function"&&s.handler(s,s.isActive)},u=()=>{b("back")},g=()=>{if(!r.recordLink)return;let s=r.recordLink;if(!s){let p=n.itemId;if(!p){const _=new URLSearchParams(window.location.search),C=new URLSearchParams(window.location.hash.split("?")[1]);p=_.get("itemId")||C.get("itemId")}s=p}if(!s)return;const d=window.location.href.match(/^(https?:\/\/[^/]+)/);if(!d){console.info("[ERROR]: Unable to extract base domain from current URL");return}const l=`${d[1]}/${s}`;window.open(l,"_blank")};return(s,m)=>(e.openBlock(),e.createElementBlock("div",D1,[e.createElementVNode("div",j1,[e.createElementVNode("div",$1,[e.createElementVNode("div",F1,[t.breadcrumbLinks&&t.breadcrumbLinks.length>1?(e.openBlock(),e.createBlock(I1,{key:0,links:t.breadcrumbLinks,"data-test-id":"filter-header-breadcrumbs",class:"ect-mb-3"},null,8,["links"])):e.createCommentVNode("",!0),e.createElementVNode("div",H1,[t.showBackButton?(e.openBlock(),e.createElementBlock("button",{key:0,class:"back-button","data-test-id":"filter-header-button-back",onClick:u},[e.createVNode(we,{icon:"arrow",symbol:"",size:16,color:"#198708",class:"ect-relative ect-top-[3px]"})])):e.createCommentVNode("",!0),t.title?(e.openBlock(),e.createElementBlock("p",{key:1,class:e.normalizeClass(["ect-relative ect-text-lg ect-font-semibold ect-leading-5 ect-text-[#1F1F1F] ect-transition-colors ect-duration-200",{"hover:ect-text-[#0076D6] ect-cursor-pointer":t.recordLink}]),"data-test-id":"filter-header-title",onClick:m[0]||(m[0]=d=>t.recordLink?g():null)},[e.createTextVNode(e.toDisplayString(t.title)+" ",1),t.recordLink?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(we,{icon:"open-link",symbol:"",size:16,color:"currentColor",class:"ect-relative ect-top-[3px]"}),e.createElementVNode("div",U1,[e.createVNode(P1,{class:"ect-min-w-full ect-h-full",direction:"top",content:"View Item in Salesforce","data-test-id":"filter-header-tooltip",width:160})])],64)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),t.statusText?(e.openBlock(),e.createBlock(N1,{key:2,text:t.statusText,state:t.statusText.toLowerCase(),"data-test-id":"`filter-header-status-pill`"},null,8,["text","state"])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"after-status",{},void 0,!0)])]),e.createElementVNode("div",z1,[t.showSearch?(e.openBlock(),e.createElementBlock("div",{key:0,class:"search-wrapper",style:e.normalizeStyle({width:t.searchWidth})},[e.createVNode(k1,{modelValue:h.value,"onUpdate:modelValue":[m[1]||(m[1]=d=>h.value=d),c],class:"search-input",placeholder:t.placeholder,"data-test-id":"filter-header-search-input"},null,8,["modelValue","placeholder"])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",K1,[e.renderSlot(s.$slots,"afterSearch",{},void 0,!0)]),e.createElementVNode("div",Z1,[e.createElementVNode("div",Q1,[e.renderSlot(s.$slots,"before-button",{},void 0,!0)]),s.$slots.buttons?(e.openBlock(),e.createElementBlock("div",X1,[e.renderSlot(s.$slots,"buttons",{},void 0,!0)])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(o,(d,f)=>(e.openBlock(),e.createElementBlock("div",{key:f,class:"action-wrapper"},[e.createVNode(Ze,{btype:d.type||"primary","button-style":d.style||"outlined",size:"medium",style:e.normalizeStyle({minWidth:d.minWidth||"auto"}),class:e.normalizeClass([{active:d.isActive},{"icon-only":d.icon&&!d.text},{"text-button":d.text}]),loading:d.loading,disabled:d.disabled,"data-test-id":`filter-header-button-${d.text?d.text.toLowerCase().replace(/\s+/g,"-"):f}`,onClick:l=>v(d)},{default:e.withCtx(()=>[d.icon?(e.openBlock(),e.createBlock(we,{key:0,icon:d.icon,symbol:"",color:d.color||"#136E05",size:d.size||14},null,8,["icon","color","size"])):e.createCommentVNode("",!0),d.text?(e.openBlock(),e.createElementBlock("span",J1,e.toDisplayString(d.isActive?d.altText:d.text),1)):e.createCommentVNode("",!0),d.count?(e.openBlock(),e.createElementBlock("span",G1,e.toDisplayString(d.count),1)):e.createCommentVNode("",!0)]),_:2},1032,["btype","button-style","style","class","loading","disabled","data-test-id","onClick"])]))),128))])])])])]))}},[["__scopeId","data-v-2ea70801"]]),Y1=["data-test-id"],ef=["data-test-id"],tf=["data-test-id"],nf=["data-test-id"],rf=["data-test-id"],of=["data-test-id"],af=["data-test-id"],lf=Ee({__name:"ecSwitch",props:e.mergeModels({text:{type:[String,Object],required:!1,validator:t=>typeof t=="string"?!0:typeof t=="object"&&t!==null?Object.prototype.hasOwnProperty.call(t,"on")&&Object.prototype.hasOwnProperty.call(t,"off"):!1},subtext:{type:String,required:!1},size:{type:String,default:"regular",validator:t=>["regular","large"].includes(t)},disabled:{type:Boolean,default:!1},dataTestId:{type:String,default:""},leftAlign:{type:Boolean,default:!1}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(t,{emit:i}){const n=t,r=e.useModel(t,"modelValue"),o=i,a=e.computed(()=>typeof n.text=="string"?n.text:typeof n.text=="object"&&n.text!==null?r.value?n.text.on:n.text.off:""),c=()=>{n.disabled||o("update:modelValue",!r.value)};return(b,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["ec-switch-container",{disabled:t.disabled}]),"data-test-id":t.dataTestId},[t.leftAlign?(e.openBlock(),e.createElementBlock("span",{key:0,class:"ec-switch__label","data-test-id":`${t.dataTestId}-label`},[e.createTextVNode(e.toDisplayString(a.value)+" ",1),t.subtext?(e.openBlock(),e.createElementBlock("span",{key:0,class:"ec-switch__subtext","data-test-id":`${t.dataTestId}-subtext`},e.toDisplayString(t.subtext),9,tf)):e.createCommentVNode("",!0)],8,ef)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["ec-switch",{"ec-switch--active":r.value,"ec-switch--large":t.size==="large"}]),"data-test-id":`${t.dataTestId}-switch`,onClick:c},[e.createElementVNode("div",{class:"ec-switch__handle","data-test-id":`${t.dataTestId}-handle`},null,8,rf)],10,nf),t.leftAlign?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:1,class:"ec-switch__label","data-test-id":`${t.dataTestId}-label`},[e.createTextVNode(e.toDisplayString(a.value)+" ",1),t.subtext?(e.openBlock(),e.createElementBlock("span",{key:0,class:"ec-switch__subtext","data-test-id":`${t.dataTestId}-subtext`},e.toDisplayString(t.subtext),9,af)):e.createCommentVNode("",!0)],8,of))],10,Y1))}},[["__scopeId","data-v-cfefad9a"]]),sf={key:0,class:"ect-bg-white ect-h-full ect-flex ect-flex-col ect-overflow-auto"},cf={class:"ect-sticky ect-top-0 ect-z-50 ect-bg-white","data-test-id":"configurator-header-sticky"},df={class:"ect-flex ect-flex-col ect-sticky ect-top-0 ect-z-50 ect-bg-white ect-border-b ect-border-gray-200"},uf={key:0,class:"ect-flex-1 ect-min-h-0 ect-overflow-y-auto ect-bg-light-bg-x","data-test-id":"configurator-content-scrollable"},ff=Ee({__name:"ProductConfiguration",setup(t){const i=at(),n=e.ref(!1),r=e.ref(0),o=e.computed(()=>i.configuration),a=e.computed(()=>n.value?[{text:"Done",altText:"Done",type:"primary",style:"primary",handler:()=>c()}]:[{text:"Save",altText:"Save",type:i.isChangedConfiguration?"primary":"secondary",style:"primary",disabled:!i.isChangedConfiguration,handler:()=>b()}]),c=()=>{n.value=!1},b=()=>{console.info("Save"),i.maintainQuoteConfiguration()};return(h,v)=>e.unref(i).configuration?(e.openBlock(),e.createElementBlock("div",sf,[e.unref(i).savedScreen?(e.openBlock(),e.createBlock($l,{key:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",cf,[e.createElementVNode("div",df,[e.createCommentVNode("",!0),e.createVNode(W1,{title:o.value.itemName,buttons:a.value},{"before-button":e.withCtx(()=>[e.unref(i).isYearlyPricingExist?(e.openBlock(),e.createBlock(lf,{key:0,modelValue:e.unref(i).showYearlyPricing,"onUpdate:modelValue":[v[0]||(v[0]=u=>e.unref(i).showYearlyPricing=u),e.unref(i).changePricingScheme],"left-align":"",class:"ect-text-nowrap",text:{on:"Yearly Price",off:"Monthly Price"},"data-test-id":"configurator-switch-show-yearly-pricing"},null,8,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)]),_:1},8,["title","buttons"])]),e.createElementVNode("div",{class:e.normalizeClass(n.value?"ect-pb-16":"ect-pb-0")},[e.createVNode(b1,{config:o.value,"edit-attributes":n.value,scroll:r.value,onEditAttributes:v[1]||(v[1]=u=>n.value=!0)},null,8,["config","edit-attributes","scroll"])],2)]),n.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",uf,[e.createVNode(s1)]))],64))])):e.createCommentVNode("",!0)}},[["__scopeId","data-v-9269c2c0"]]),hf=["data-item-id","data-qli-id"],pf={key:0,class:"ect-flex-1 ect-min-h-0"},mf={key:1,class:"ect-flex-1 ect-min-h-0"},gf={__name:"Configurator",props:{itemId:{type:String,required:!0},qliId:{type:String,required:!1}},setup(t){Kn();const i=t,n=e.ref(!0),r=at();return e.onBeforeMount(async()=>{n.value=!0,console.time("CONFIGURATOR ON BEFORE MOUNT"),console.timeLog("CONFIGURATOR ON BEFORE MOUNT","1"),await r.initConfigurator(i.itemId,i.qliId),console.timeLog("CONFIGURATOR ON BEFORE MOUNT","2"),console.timeEnd("CONFIGURATOR ON BEFORE MOUNT"),n.value=!1}),(o,a)=>(e.openBlock(),e.createElementBlock("div",{class:"ect-h-full ect-flex ect-flex-col","data-item-id":t.itemId,"data-qli-id":t.qliId},[n.value?(e.openBlock(),e.createElementBlock("div",mf,[e.createVNode(so)])):(e.openBlock(),e.createElementBlock("div",pf,[e.createVNode(ff)]))],8,hf))}};function Lo(t,i){return function(){return t.apply(i,arguments)}}const{toString:yf}=Object.prototype,{getPrototypeOf:rr}=Object,{iterator:yn,toStringTag:Mo}=Symbol,bn=(t=>i=>{const n=yf.call(i);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Xe=t=>(t=t.toLowerCase(),i=>bn(i)===t),_n=t=>i=>typeof i===t,{isArray:Nt}=Array,xt=_n("undefined");function jt(t){return t!==null&&!xt(t)&&t.constructor!==null&&!xt(t.constructor)&&je(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Ro=Xe("ArrayBuffer");function bf(t){let i;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?i=ArrayBuffer.isView(t):i=t&&t.buffer&&Ro(t.buffer),i}const _f=_n("string"),je=_n("function"),Po=_n("number"),$t=t=>t!==null&&typeof t=="object",vf=t=>t===!0||t===!1,vn=t=>{if(bn(t)!=="object")return!1;const i=rr(t);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(Mo in t)&&!(yn in t)},Cf=t=>{if(!$t(t)||jt(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Ef=Xe("Date"),kf=Xe("File"),wf=Xe("Blob"),Nf=Xe("FileList"),xf=t=>$t(t)&&je(t.pipe),Of=t=>{let i;return t&&(typeof FormData=="function"&&t instanceof FormData||je(t.append)&&((i=bn(t))==="formdata"||i==="object"&&je(t.toString)&&t.toString()==="[object FormData]"))},Sf=Xe("URLSearchParams"),[Vf,Tf,Af,If]=["ReadableStream","Request","Response","Headers"].map(Xe),Bf=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ft(t,i,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,o;if(typeof t!="object"&&(t=[t]),Nt(t))for(r=0,o=t.length;r<o;r++)i.call(null,t[r],r,t);else{if(jt(t))return;const a=n?Object.getOwnPropertyNames(t):Object.keys(t),c=a.length;let b;for(r=0;r<c;r++)b=a[r],i.call(null,t[b],b,t)}}function qo(t,i){if(jt(t))return null;i=i.toLowerCase();const n=Object.keys(t);let r=n.length,o;for(;r-- >0;)if(o=n[r],i===o.toLowerCase())return o;return null}const mt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Do=t=>!xt(t)&&t!==mt;function or(){const{caseless:t,skipUndefined:i}=Do(this)&&this||{},n={},r=(o,a)=>{const c=t&&qo(n,a)||a;vn(n[c])&&vn(o)?n[c]=or(n[c],o):vn(o)?n[c]=or({},o):Nt(o)?n[c]=o.slice():(!i||!xt(o))&&(n[c]=o)};for(let o=0,a=arguments.length;o<a;o++)arguments[o]&&Ft(arguments[o],r);return n}const Lf=(t,i,n,{allOwnKeys:r}={})=>(Ft(i,(o,a)=>{n&&je(o)?t[a]=Lo(o,n):t[a]=o},{allOwnKeys:r}),t),Mf=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Rf=(t,i,n,r)=>{t.prototype=Object.create(i.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:i.prototype}),n&&Object.assign(t.prototype,n)},Pf=(t,i,n,r)=>{let o,a,c;const b={};if(i=i||{},t==null)return i;do{for(o=Object.getOwnPropertyNames(t),a=o.length;a-- >0;)c=o[a],(!r||r(c,t,i))&&!b[c]&&(i[c]=t[c],b[c]=!0);t=n!==!1&&rr(t)}while(t&&(!n||n(t,i))&&t!==Object.prototype);return i},qf=(t,i,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=i.length;const r=t.indexOf(i,n);return r!==-1&&r===n},Df=t=>{if(!t)return null;if(Nt(t))return t;let i=t.length;if(!Po(i))return null;const n=new Array(i);for(;i-- >0;)n[i]=t[i];return n},jf=(t=>i=>t&&i instanceof t)(typeof Uint8Array<"u"&&rr(Uint8Array)),$f=(t,i)=>{const r=(t&&t[yn]).call(t);let o;for(;(o=r.next())&&!o.done;){const a=o.value;i.call(t,a[0],a[1])}},Ff=(t,i)=>{let n;const r=[];for(;(n=t.exec(i))!==null;)r.push(n);return r},Hf=Xe("HTMLFormElement"),Uf=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),jo=(({hasOwnProperty:t})=>(i,n)=>t.call(i,n))(Object.prototype),zf=Xe("RegExp"),$o=(t,i)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Ft(n,(o,a)=>{let c;(c=i(o,a,t))!==!1&&(r[a]=c||o)}),Object.defineProperties(t,r)},Kf=t=>{$o(t,(i,n)=>{if(je(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(je(r)){if(i.enumerable=!1,"writable"in i){i.writable=!1;return}i.set||(i.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Zf=(t,i)=>{const n={},r=o=>{o.forEach(a=>{n[a]=!0})};return Nt(t)?r(t):r(String(t).split(i)),n},Qf=()=>{},Xf=(t,i)=>t!=null&&Number.isFinite(t=+t)?t:i;function Jf(t){return!!(t&&je(t.append)&&t[Mo]==="FormData"&&t[yn])}const Gf=t=>{const i=new Array(10),n=(r,o)=>{if($t(r)){if(i.indexOf(r)>=0)return;if(jt(r))return r;if(!("toJSON"in r)){i[o]=r;const a=Nt(r)?[]:{};return Ft(r,(c,b)=>{const h=n(c,o+1);!xt(h)&&(a[b]=h)}),i[o]=void 0,a}}return r};return n(t,0)},Wf=Xe("AsyncFunction"),Yf=t=>t&&($t(t)||je(t))&&je(t.then)&&je(t.catch),Fo=((t,i)=>t?setImmediate:i?((n,r)=>(mt.addEventListener("message",({source:o,data:a})=>{o===mt&&a===n&&r.length&&r.shift()()},!1),o=>{r.push(o),mt.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",je(mt.postMessage)),e0=typeof queueMicrotask<"u"?queueMicrotask.bind(mt):typeof process<"u"&&process.nextTick||Fo,W={isArray:Nt,isArrayBuffer:Ro,isBuffer:jt,isFormData:Of,isArrayBufferView:bf,isString:_f,isNumber:Po,isBoolean:vf,isObject:$t,isPlainObject:vn,isEmptyObject:Cf,isReadableStream:Vf,isRequest:Tf,isResponse:Af,isHeaders:If,isUndefined:xt,isDate:Ef,isFile:kf,isBlob:wf,isRegExp:zf,isFunction:je,isStream:xf,isURLSearchParams:Sf,isTypedArray:jf,isFileList:Nf,forEach:Ft,merge:or,extend:Lf,trim:Bf,stripBOM:Mf,inherits:Rf,toFlatObject:Pf,kindOf:bn,kindOfTest:Xe,endsWith:qf,toArray:Df,forEachEntry:$f,matchAll:Ff,isHTMLForm:Hf,hasOwnProperty:jo,hasOwnProp:jo,reduceDescriptors:$o,freezeMethods:Kf,toObjectSet:Zf,toCamelCase:Uf,noop:Qf,toFiniteNumber:Xf,findKey:qo,global:mt,isContextDefined:Do,isSpecCompliantForm:Jf,toJSONObject:Gf,isAsyncFn:Wf,isThenable:Yf,setImmediate:Fo,asap:e0,isIterable:t=>t!=null&&je(t[yn])};function me(t,i,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",i&&(this.code=i),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}W.inherits(me,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:W.toJSONObject(this.config),code:this.code,status:this.status}}});const Ho=me.prototype,Uo={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Uo[t]={value:t}}),Object.defineProperties(me,Uo),Object.defineProperty(Ho,"isAxiosError",{value:!0}),me.from=(t,i,n,r,o,a)=>{const c=Object.create(Ho);W.toFlatObject(t,c,function(u){return u!==Error.prototype},v=>v!=="isAxiosError");const b=t&&t.message?t.message:"Error",h=i==null&&t?t.code:i;return me.call(c,b,h,n,r,o),t&&c.cause==null&&Object.defineProperty(c,"cause",{value:t,configurable:!0}),c.name=t&&t.name||"Error",a&&Object.assign(c,a),c};const t0=null;function ir(t){return W.isPlainObject(t)||W.isArray(t)}function zo(t){return W.endsWith(t,"[]")?t.slice(0,-2):t}function Ko(t,i,n){return t?t.concat(i).map(function(o,a){return o=zo(o),!n&&a?"["+o+"]":o}).join(n?".":""):i}function n0(t){return W.isArray(t)&&!t.some(ir)}const r0=W.toFlatObject(W,{},null,function(i){return/^is[A-Z]/.test(i)});function Cn(t,i,n){if(!W.isObject(t))throw new TypeError("target must be an object");i=i||new FormData,n=W.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,l){return!W.isUndefined(l[f])});const r=n.metaTokens,o=n.visitor||u,a=n.dots,c=n.indexes,h=(n.Blob||typeof Blob<"u"&&Blob)&&W.isSpecCompliantForm(i);if(!W.isFunction(o))throw new TypeError("visitor must be a function");function v(d){if(d===null)return"";if(W.isDate(d))return d.toISOString();if(W.isBoolean(d))return d.toString();if(!h&&W.isBlob(d))throw new me("Blob is not supported. Use a Buffer instead.");return W.isArrayBuffer(d)||W.isTypedArray(d)?h&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function u(d,f,l){let p=d;if(d&&!l&&typeof d=="object"){if(W.endsWith(f,"{}"))f=r?f:f.slice(0,-2),d=JSON.stringify(d);else if(W.isArray(d)&&n0(d)||(W.isFileList(d)||W.endsWith(f,"[]"))&&(p=W.toArray(d)))return f=zo(f),p.forEach(function(C,y){!(W.isUndefined(C)||C===null)&&i.append(c===!0?Ko([f],y,a):c===null?f:f+"[]",v(C))}),!1}return ir(d)?!0:(i.append(Ko(l,f,a),v(d)),!1)}const g=[],s=Object.assign(r0,{defaultVisitor:u,convertValue:v,isVisitable:ir});function m(d,f){if(!W.isUndefined(d)){if(g.indexOf(d)!==-1)throw Error("Circular reference detected in "+f.join("."));g.push(d),W.forEach(d,function(p,_){(!(W.isUndefined(p)||p===null)&&o.call(i,p,W.isString(_)?_.trim():_,f,s))===!0&&m(p,f?f.concat(_):[_])}),g.pop()}}if(!W.isObject(t))throw new TypeError("data must be an object");return m(t),i}function Zo(t){const i={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return i[r]})}function ar(t,i){this._pairs=[],t&&Cn(t,this,i)}const Qo=ar.prototype;Qo.append=function(i,n){this._pairs.push([i,n])},Qo.toString=function(i){const n=i?function(r){return i.call(this,r,Zo)}:Zo;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function o0(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Xo(t,i,n){if(!i)return t;const r=n&&n.encode||o0;W.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let a;if(o?a=o(i,n):a=W.isURLSearchParams(i)?i.toString():new ar(i,n).toString(r),a){const c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+a}return t}class Jo{constructor(){this.handlers=[]}use(i,n,r){return this.handlers.push({fulfilled:i,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(i){this.handlers[i]&&(this.handlers[i]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(i){W.forEach(this.handlers,function(r){r!==null&&i(r)})}}const Go={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},i0={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ar,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},lr=typeof window<"u"&&typeof document<"u",sr=typeof navigator=="object"&&navigator||void 0,a0=lr&&(!sr||["ReactNative","NativeScript","NS"].indexOf(sr.product)<0),l0=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",s0=lr&&window.location.href||"http://localhost",Ie={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:lr,hasStandardBrowserEnv:a0,hasStandardBrowserWebWorkerEnv:l0,navigator:sr,origin:s0},Symbol.toStringTag,{value:"Module"})),...i0};function c0(t,i){return Cn(t,new Ie.classes.URLSearchParams,{visitor:function(n,r,o,a){return Ie.isNode&&W.isBuffer(n)?(this.append(r,n.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...i})}function d0(t){return W.matchAll(/\w+|\[(\w*)]/g,t).map(i=>i[0]==="[]"?"":i[1]||i[0])}function u0(t){const i={},n=Object.keys(t);let r;const o=n.length;let a;for(r=0;r<o;r++)a=n[r],i[a]=t[a];return i}function Wo(t){function i(n,r,o,a){let c=n[a++];if(c==="__proto__")return!0;const b=Number.isFinite(+c),h=a>=n.length;return c=!c&&W.isArray(o)?o.length:c,h?(W.hasOwnProp(o,c)?o[c]=[o[c],r]:o[c]=r,!b):((!o[c]||!W.isObject(o[c]))&&(o[c]=[]),i(n,r,o[c],a)&&W.isArray(o[c])&&(o[c]=u0(o[c])),!b)}if(W.isFormData(t)&&W.isFunction(t.entries)){const n={};return W.forEachEntry(t,(r,o)=>{i(d0(r),o,n,0)}),n}return null}function f0(t,i,n){if(W.isString(t))try{return(i||JSON.parse)(t),W.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const cr={transitional:Go,adapter:["xhr","http","fetch"],transformRequest:[function(i,n){const r=n.getContentType()||"",o=r.indexOf("application/json")>-1,a=W.isObject(i);if(a&&W.isHTMLForm(i)&&(i=new FormData(i)),W.isFormData(i))return o?JSON.stringify(Wo(i)):i;if(W.isArrayBuffer(i)||W.isBuffer(i)||W.isStream(i)||W.isFile(i)||W.isBlob(i)||W.isReadableStream(i))return i;if(W.isArrayBufferView(i))return i.buffer;if(W.isURLSearchParams(i))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),i.toString();let b;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return c0(i,this.formSerializer).toString();if((b=W.isFileList(i))||r.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return Cn(b?{"files[]":i}:i,h&&new h,this.formSerializer)}}return a||o?(n.setContentType("application/json",!1),f0(i)):i}],transformResponse:[function(i){const n=this.transitional||cr.transitional,r=n&&n.forcedJSONParsing,o=this.responseType==="json";if(W.isResponse(i)||W.isReadableStream(i))return i;if(i&&W.isString(i)&&(r&&!this.responseType||o)){const c=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(i,this.parseReviver)}catch(b){if(c)throw b.name==="SyntaxError"?me.from(b,me.ERR_BAD_RESPONSE,this,null,this.response):b}}return i}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ie.classes.FormData,Blob:Ie.classes.Blob},validateStatus:function(i){return i>=200&&i<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};W.forEach(["delete","get","head","post","put","patch"],t=>{cr.headers[t]={}});const dr=cr,h0=W.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),p0=t=>{const i={};let n,r,o;return t&&t.split(`
|
|
58
|
+
or use v-on:ready="onReady(quill)" event instead.`},_=(w,N)=>t.contentType==="html"?A():t.contentType==="text"?y(w,N):n==null?void 0:n.getContents(w,N),C=(w,N="api")=>{const M=w||(t.contentType==="delta"?new od:"");t.contentType==="html"?S(M):t.contentType==="text"?E(M,N):n==null||n.setContents(M,N),v=b(M)},y=(w,N)=>{var M;return(M=n==null?void 0:n.getText(w,N))!==null&&M!==void 0?M:""},E=(w,N="api")=>{n==null||n.setText(w,N)},A=()=>{var w;return(w=n==null?void 0:n.root.innerHTML)!==null&&w!==void 0?w:""},S=w=>{n&&(n.root.innerHTML=w)},T=(w,N="api")=>{const M=n==null?void 0:n.clipboard.convert(w);M&&(n==null||n.setContents(M,N))},B=()=>{n==null||n.focus()},V=()=>{e.nextTick(()=>{var w;!i.slots.toolbar&&n&&((w=n.getModule("toolbar"))===null||w===void 0||w.container.remove()),a()})};return e.watch(()=>t.content,w=>{if(!n||!w||u(w))return;const N=n.getSelection();N&&e.nextTick(()=>n==null?void 0:n.setSelection(N)),C(w)},{deep:!0}),e.watch(()=>t.enable,w=>{n&&n.enable(w)}),{editor:o,getEditor:f,getToolbar:l,getQuill:p,getContents:_,setContents:C,getHTML:A,setHTML:S,pasteHTML:T,focus:B,getText:y,setText:E,reinit:V}},render(){var t,i;return[(i=(t=this.$slots).toolbar)===null||i===void 0?void 0:i.call(t),e.h("div",{ref:"editor",...this.$attrs})]}}),ad={class:"input"},ld=["for","data-test-id"],sd=["data-test-id"],cd=Ee({__name:"RichTextEditor",props:{modelValue:{type:String,default:""},editorOptions:{type:Object,default:()=>({modules:{toolbar:["bold","italic","underline",{align:[]},{list:"ordered"},{list:"bullet"}]},placeholder:"Add AI Instructions",theme:"snow"})},dataTestId:{type:String,default:""},label:{type:String,default:""},required:{type:Boolean,default:!1},error:{type:String,default:""}},emits:["update:modelValue"],setup(t){const i=t,n=e.computed(()=>typeof i.error=="string"?i.error:i.error===""?!1:i.error===!0?`${i.label||"Field"} is required`:i.error),r=e.ref("");return e.onBeforeMount(()=>{r.value=i.modelValue}),(o,a)=>(e.openBlock(),e.createElementBlock("div",ad,[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass({error_color:!!t.error}),for:t.label,"data-test-id":`${t.dataTestId}-label`},[e.createTextVNode(e.toDisplayString(t.label)+" ",1),t.required?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass({error_color:!!t.error})},"*",2)):e.createCommentVNode("",!0)],10,ld)):e.createCommentVNode("",!0),e.createVNode(e.unref(id),{"content-type":"html",toolbar:t.editorOptions,"model-value":t.modelValue,"data-test-id":t.dataTestId,content:r.value,"onUpdate:content":a[0]||(a[0]=c=>o.$emit("update:modelValue",c))},null,8,["toolbar","model-value","data-test-id","content"]),n.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"error_tooltip error_tooltip-bottom-right","data-test-id":`${t.dataTestId}-error`},e.toDisplayString(n.value),9,sd)):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-76aecac0"]]),dd={class:"ect-w-full ect-flex ect-flex-col ect-gap-4 ect-p-4 ect-rounded-md ect-border-1 ect-border-gray-200 md:ect-gap-5 lg:ect-gap-6","data-test-id":"configurator-inputs-container"},ud={key:0,class:"ect-text-sm ect-font-regular ect-text-gray-900"},fd={class:"ect-grid ect-grid-cols-1 sm:ect-grid-cols-2 ect-gap-4"},hd={key:0,class:"ect-col-span-2"},pd=["data-test-id"],md=["id","onUpdate:modelValue","disabled","data-test-id"],gd=["for","data-test-id"],yd={key:2,class:"quill-editor-styles"},bd=e.createElementVNode("div",{class:"dropdowntp"},null,-1),_d=e.createElementVNode("div",{id:"modals"},null,-1),Bo={__name:"InputsContainer",props:{title:{type:String,default:""},lookup:{type:Object,default:()=>null},attributes:{type:Array,required:!0,default:()=>[]},locale:{type:String,default:"en-US"}},setup(t){const i=at(),n=t,r=e.ref({modules:{toolbar:["bold","italic","underline",{align:[]},{list:"ordered"},{list:"bullet"}]},placeholder:"Add AI Instructions",theme:"snow"}),o=e.ref(n.lookup),a=e.computed(()=>{const h=n.lookup.relatedFields.map(v=>v.child);return h.push("Name"),h});function c(h,v){const u=v.options.find(g=>g.Id===h);h===null?(v.options=[],v.value=null,v.relatedFields.forEach(g=>{g.value=null})):(v.value=u.Name,v.relatedFields.forEach(g=>{g.value=u[g.child]}))}const b=oo(async function(h,v){v.loading=!0;const u={objectType:v.referenceObject,searchText:h||"",lstFields:a.value||[]},g=await i.getRecords(u);v.options=g,v.loading=!1});return(h,v)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",dd,[t.title?(e.openBlock(),e.createElementBlock("div",ud,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",fd,[o.value?(e.openBlock(),e.createElementBlock("div",hd,[e.createVNode(yo,{modelValue:o.value.referenceRecordId,"onUpdate:modelValue":[v[0]||(v[0]=u=>o.value.referenceRecordId=u),v[1]||(v[1]=u=>c(u,o.value))],"data-test-id":`configurator-inputs-lookup-${o.value.attRecordId??h.index}`,label:o.value.label,options:o.value.options,disabled:!o.value.editable,required:o.value.required,loading:o.value.loading,property:{key:"Id",value:"Name"},lookup:"",search:"",highlight:"",onSearch:v[2]||(v[2]=u=>e.unref(b)(u,o.value))},null,8,["modelValue","data-test-id","label","options","disabled","required","loading"])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.attributes,(u,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:"attribute-input"},[u.dataType==="PICKLIST"||u.dataType==="MULTIPICKLIST"?(e.openBlock(),e.createBlock(yo,{key:0,modelValue:u.value,"onUpdate:modelValue":s=>u.value=s,label:u.label,placeholder:u.label,disabled:!u.editable,options:u.picklistValues.map(s=>({label:s,value:s})),select:"",highlight:"","data-test-id":`configurator-inputs-dropdown-${u.attRecordId??h.index}`},null,8,["modelValue","onUpdate:modelValue","label","placeholder","disabled","options","data-test-id"])):u.dataType==="BOOLEAN"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"ect-flex ect-items-center ect-gap-3 ect-py-3.5","data-test-id":`configurator-inputs-checkbox-${u.attRecordId??h.index}`},[e.withDirectives(e.createElementVNode("input",{id:`checkbox-${u.attRecordId??h.index}`,"onUpdate:modelValue":s=>u.value=s,type:"checkbox",disabled:!u.editable,class:"ect-w-4 ect-h-4 ect-accent-success ect-border-gray-300 ect-rounded ect-text-text-success focus:ect-ring-green-500","data-test-id":`configurator-inputs-checkbox-input-${u.attRecordId??h.index}`},null,8,md),[[e.vModelCheckbox,u.value]]),e.createElementVNode("label",{for:`checkbox-${u.attRecordId??h.index}`,class:"ect-text-sm ect-font-medium ect-text-gray-900 ect-cursor-pointer","data-test-id":`configurator-inputs-checkbox-label-${u.attRecordId??h.index}`},e.toDisplayString(u.label),9,gd)],8,pd)):u.dataType==="TEXTAREA"?(e.openBlock(),e.createElementBlock("div",yd,[e.createVNode(cd,{modelValue:u.value,"onUpdate:modelValue":s=>u.value=s,label:u.label,required:u.required,"editor-options":r.value,"data-test-id":`configurator-inputs-textarea-quill-editor-${u.attRecordId??h.index}`},null,8,["modelValue","onUpdate:modelValue","label","required","editor-options","data-test-id"])])):(e.openBlock(),e.createBlock(_c,{key:3,modelValue:u.value,"onUpdate:modelValue":s=>u.value=s,label:u.label,disabled:!u.editable,highlight:"","data-test-id":`configurator-inputs-custom-${u.attRecordId??h.index}`},null,8,["modelValue","onUpdate:modelValue","label","disabled","data-test-id"]))]))),128))])]),bd,_d],64))}},vd={class:"ect-w-full ect-flex ect-flex-col ect-gap-4","data-test-id":"configurator-inputs-container"},Cd={class:"ect-bg-white ect-rounded-lg"},nr={__name:"AttributesContainer",props:{attributes:{type:Array,required:!0,default:()=>[]},locale:{type:String,default:"en-US"}},setup(t){const i=t,n=e.ref([]),r=e.ref([]),o=e.ref({});return e.onBeforeMount(()=>{const a={},c=[...i.attributes];c.forEach(h=>{h.dataType==="REFERENCE"&&(o.value[h.apiName]=["Name"],h.relatedFields=[],a[h.apiName]=h),h.editable=h.editable&&!h.apiName.includes(".")});let b=null;c.forEach(h=>{if(h.referenceObject==="XX_Base__Location__c"&&(b?h.firstLookup="Copy from "+b.label:b=h),h.apiName.includes(".")){const[v,u]=h.apiName.split(".");h.parent=v,h.child=u,o.value[v]!=null&&(o.value[v].push(u),a[v].relatedFields.push(h))}}),r.value=c.filter(h=>h.dataType==="REFERENCE"),n.value=c.filter(h=>!(h.apiName.includes(".")||h.dataType==="REFERENCE"))}),(a,c)=>(e.openBlock(),e.createElementBlock("div",vd,[e.createElementVNode("div",Cd,[e.createVNode(Bo,{attributes:n.value},null,8,["attributes"])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,b=>(e.openBlock(),e.createElementBlock("div",{key:b.attRecordId,class:"ect-bg-white ect-rounded-lg"},[e.createVNode(Bo,{title:b.referenceLabel+" Lookup",lookup:b,attributes:b.relatedFields},null,8,["title","lookup","attributes"])]))),128))]))}},Ed={class:"ect-px-6 ect-pt-4 ect-pb-6 ect-w-full ect-text-sm ect-leading-none ect-text-neutral-700 ect-max-md:max-w-full"},kd=e.createElementVNode("p",{class:"ect-m-1 ect-text-sm ect-font-regular ect-leading-5 ect-text-neutral-700"},"You Selected",-1),wd={class:"ect-flex ect-items-center ect-justify-between ect-rounded-lg ect-px-4 ect-py-2 ect-gap-2 ect-bg-light-bg-x"},Nd={class:"ect-mt-1 ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700"},xd={class:"ect-mt-1 ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700"},Od={class:"ect-mt-1 ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700"},Sd={class:"ect-px-6 ect-pt-4 ect-pb-6 ect-w-full ect-bg-light-bg-x ect-max-md:max-w-full"},Vd={class:"ect-flex ect-justify-end ect-gap-2 ect-p-4"},Td={__name:"AttributesModal",props:{option:{type:Object,required:!0},attributes:{type:Array,required:!0}},emits:["close","done"],setup(t,{emit:i}){const n=i,r=t,o=e.computed(()=>JSON.parse(JSON.stringify(r.attributes))),a=()=>{n("close")},c=()=>{n("done",o.value),n("close")};return(b,h)=>(e.openBlock(),e.createBlock(zn,{header:"",title:"Update Attributes Values",description:"Update the values associated with selected attributes.",footer:"","no-close":"",onClose:a},{content:e.withCtx(()=>[e.createElementVNode("header",Ed,[kd,e.createElementVNode("div",wd,[e.createElementVNode("p",Nd,e.toDisplayString(t.option.itemName),1),e.createElementVNode("p",xd,e.toDisplayString(t.option.qty),1),e.createElementVNode("p",Od,e.toDisplayString(t.option.price),1)])]),e.createElementVNode("main",Sd,[e.createVNode(nr,{attributes:o.value},null,8,["attributes"])])]),footer:e.withCtx(()=>[e.createElementVNode("div",Vd,[e.createVNode(Ze,{class:"ect-min-w-[100px]",btype:"secondary","button-style":"outlined",size:"medium","data-test-id":"attributes-modal-button-cancel",onClick:h[0]||(h[0]=v=>n("close"))},{default:e.withCtx(()=>[e.createTextVNode("Cancel")]),_:1}),e.createVNode(Ze,{class:"ect-min-w-[100px]",btype:"primary","button-style":"primary",size:"medium","data-test-id":"attributes-modal-button-done",onClick:c},{default:e.withCtx(()=>[e.createTextVNode("Done")]),_:1})])]),_:1}))}},Ad=["data-test-id"],Id=["data-test-id"],Bd=["data-test-id"],Ld={class:"ect-bg-white ect-rounded-xl ect-shadow-sm"},Md={class:"ect-relative ect-w-full ect-border-b ect-border-solid ect-border-b-neutral-200 max-md:ect-max-w-full"},Rd={key:0,class:"ect-flex ect-z-0 ect-flex-col ect-gap-4 ect-justify-center ect-py-4 ect-px-6 ect-w-full max-md:ect-px-5 max-md:ect-max-w-full"},Pd={class:"ect-gap-1 ect-w-full max-md:ect-max-w-full"},qd={class:"ect-text-lg ect-font-semibold ect-leading-5 ect-text-neutral-700 max-md:ect-max-w-full"},Dd={key:0,class:"ect-mt-1 ect-text-sm ect-leading-none ect-text-zinc-600 max-md:ect-max-w-full"},jd={class:"ect-flex ect-overflow-hidden ect-absolute ect-top-2.5 ect-right-4 ect-z-0 ect-p-1 ect-rounded-lg"},$d={key:0,class:"ect-flex-1 ect-overflow-y-auto ect-h-[600px] ect-max-h-[70vh]"},Fd={key:1,class:"ect-px-6 ect-pt-4 ect-pb-6 ect-w-full ect-text-xs ect-leading-4 ect-text-neutral-700 max-md:ect-px-5 max-md:ect-max-w-full"},Hd={key:2,class:"ect-relative ect-w-full ect-border-t ect-border-solid ect-border-t-neutral-200 max-md:ect-max-w-full"},Ud=Ee({__name:"AppModalGen3",props:{title:{type:String,required:!0},description:{type:String,required:!0},header:{type:Boolean,default:!1},footer:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:i}){const n=i;return(r,o)=>(e.openBlock(),e.createBlock(ro,{to:"modaltp"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"modal-mask","data-test-id":`${r.dataTestId}-mask`},[e.createElementVNode("div",{class:"modal-wrapper","data-test-id":`${r.dataTestId}-wrapper`},[e.createElementVNode("div",{class:"modal-container",style:e.normalizeStyle(r.width?`max-width: ${r.width.includes("calc")?r.width:r.width+"px"}; width: 100%;`:""),"data-test-id":`${r.dataTestId}-container`},[e.createElementVNode("div",Ld,[e.createElementVNode("div",Md,[t.header?(e.openBlock(),e.createElementBlock("div",Rd,[e.createElementVNode("div",Pd,[e.createElementVNode("div",qd,e.toDisplayString(t.title),1),t.description?(e.openBlock(),e.createElementBlock("div",Dd,e.toDisplayString(t.description),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),e.createElementVNode("div",jd,[e.createElementVNode("button",{class:"ect-flex ect-self-stretch ect-my-auto ect-w-6 ect-min-h-6 ect-cursor-pointer hover:ect-bg-gray-100 ect-rounded ect-transition-colors ect-justify-center ect-items-center","aria-label":"Close modal",onClick:o[0]||(o[0]=a=>n("close"))},[e.createVNode(we,{icon:"close",color:"#000000",size:"11",height:"11"})])])]),r.$slots.content?(e.openBlock(),e.createElementBlock("div",$d,[e.renderSlot(r.$slots,"content",{},void 0,!0)])):(e.openBlock(),e.createElementBlock("div",Fd,[e.renderSlot(r.$slots,"default",{},void 0,!0)])),t.footer?(e.openBlock(),e.createElementBlock("div",Hd,[e.renderSlot(r.$slots,"footer",{},void 0,!0)])):e.createCommentVNode("",!0)])],12,Bd)],8,Id)],8,Ad)]),_:3}))}},[["__scopeId","data-v-41ebff01"]]),pt=t=>(e.pushScopeId("data-v-e51cc54e"),t=t(),e.popScopeId(),t),zd={class:"ect-w-[600px]"},Kd={class:"ect-px-6 ect-pt-4 ect-w-full ect-text-sm ect-leading-none ect-text-neutral-700 ect-max-md:max-w-full"},Zd=pt(()=>e.createElementVNode("p",{class:"ect-m-1 ect-text-sm ect-font-regular ect-leading-5 ect-text-neutral-700"},"You Selected",-1)),Qd={class:"ect-flex ect-items-center ect-justify-between ect-rounded-lg ect-px-4 ect-py-2 ect-gap-2 ect-bg-light-bg-x"},Xd={class:"ect-mt-1 ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700"},Jd={class:"ect-mt-1 ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700"},Gd={class:"ect-mt-1 ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700"},Wd={class:"ect-px-6 ect-pt-4 ect-pb-6 ect-mt-4 ect-w-full ect-bg-light-bg-x ect-max-md:max-w-full"},Yd=pt(()=>e.createElementVNode("p",{class:"ect-text-xs ect-font-medium ect-leading-6 ect-text-neutral-700 ect-mb-3","data-test-id":"conflict-modal-supporting-text"}," Above selection requires a configuration change ",-1)),eu={class:"ect-flex ect-flex-col ect-gap-2"},tu={key:0,class:"ect-bg-white ect-border ect-border-neutral-200 ect-rounded-md","data-test-id":"conflict-modal-add-table"},nu=pt(()=>e.createElementVNode("div",{class:"ect-px-4 ect-py-2"},[e.createElementVNode("p",{class:"ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700","data-test-id":"conflict-modal-add-header"}," This change will add: ")],-1)),ru={class:"ect-flex-grow font-regular","data-test-id":"conflict-modal-add-product"},ou={class:"ect-w-20 ect-text-center font-regular","data-test-id":"conflict-modal-add-qty"},iu={class:"ect-w-28 ect-text-right font-regular","data-test-id":"conflict-modal-add-price"},au={key:1,class:"ect-bg-white ect-border ect-border-neutral-200 ect-rounded-md","data-test-id":"conflict-modal-remove-table"},lu=pt(()=>e.createElementVNode("div",{class:"ect-px-4 ect-py-2"},[e.createElementVNode("p",{class:"ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700","data-test-id":"conflict-modal-remove-header"}," This change will remove: ")],-1)),su={class:"ect-flex-grow font-regular","data-test-id":"conflict-modal-remove-product"},cu={class:"ect-w-20 ect-text-center font-regular","data-test-id":"conflict-modal-remove-qty"},du={class:"ect-w-28 ect-text-right font-regular","data-test-id":"conflict-modal-remove-price"},uu={class:"ect-flex ect-justify-between ect-items-center ect-px-4 ect-py-1 ect-w-full ect-text-sm ect-leading-none ect-text-neutral-700 ect-bg-white ect-rounded-md ect-border ect-border-neutral-200 ect-rounded-md"},fu=pt(()=>e.createElementVNode("p",{class:"ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700","data-test-id":"conflict-modal-price-change-label"}," Price change ",-1)),hu={class:"ect-text-sm ect-font-semibold ect-leading-5","data-test-id":"conflict-modal-price-change-value"},pu={class:"ect-px-6 ect-pt-4 ect-pb-6 ect-w-full"},mu=pt(()=>e.createElementVNode("p",{class:"ect-text-xs ect-font-medium ect-leading-6 ect-text-neutral-500 ect-mb-2","data-test-id":"conflict-modal-summary-supporting-text"}," Price Adjustment Summary ",-1)),gu={class:"ect-border ect-border-neutral-200 ect-rounded-md ect-overflow-hidden ect-mt-2 ect-bg-neutral-50","data-test-id":"conflict-modal-summary-table"},yu={class:"ect-flex ect-flex-col ect-gap-2"},bu={class:"ect-flex-1"},_u={class:"font-regular","data-test-id":"conflict-modal-summary-base-price-label"},vu={class:"ect-text-center ect-w-28"},Cu={class:"ect-text-sm ect-font-medium ect-leading-5 ect-text-neutral-700 ect-text-right ect-line-through","data-test-id":"conflict-modal-summary-base-price-original"},Eu={class:"ect-text-center ect-w-28"},ku={class:"ect-text-sm ect-font-semibold ect-leading-5 ect-text-text-success ect-text-right","data-test-id":"conflict-modal-summary-base-price-adjusted"},wu={class:"ect-border ect-border-neutral-200 ect-rounded-md ect-overflow-hidden ect-px-4 ect-py-1 ect-mt-2","data-test-id":"conflict-modal-summary-total"},Nu={class:"ect-flex ect-items-center"},xu=pt(()=>e.createElementVNode("div",{class:"ect-flex-1"},[e.createElementVNode("p",{class:"ect-text-sm ect-font-semibold ect-leading-5 ect-text-neutral-700","data-test-id":"conflict-modal-summary-total-label"}," Total Price change ")],-1)),Ou={class:"ect-text-center ect-w-28"},Su={class:"ect-text-sm ect-font-medium ect-leading-5 ect-text-neutral-700 ect-text-right ect-line-through","data-test-id":"conflict-modal-summary-base-price-original"},Vu={class:"ect-text-center ect-w-28"},Tu={class:"ect-text-sm ect-font-semibold ect-leading-5 ect-text-text-success ect-text-right","data-test-id":"conflict-modal-summary-base-price-adjusted"},Au={class:"ect-flex ect-justify-end ect-gap-2 ect-p-4"},Iu=Ee({__name:"ConflictModal",props:{item:{type:Object,required:!0},data:{type:Object,required:!0}},emits:["close","done"],setup(t,{emit:i}){const n=at(),r=i,o=t,a=e.computed(()=>{const d=n.summaryPrices,f=[];return f.push({label:"Base Price",value:d.basePrice,priceChange:d.basePrice}),f.push({label:"Add Ons",value:d.addOns,priceChange:d.addOns+g.value}),f}),c=e.computed(()=>{const d=n.summaryPrices;return{label:"Total Price",value:d.total,priceChange:d.total+g.value}}),b=e.computed(()=>o.data.inclusions.map(f=>n.optionByPublishKey.get(f))),h=e.computed(()=>b.value.filter(d=>d.itemId!==o.item.itemId)),v=e.computed(()=>o.data.exclusions.map(d=>n.optionByPublishKey.get(d))),u=e.computed(()=>v.value.filter(d=>d.itemId!==o.item.itemId)),g=e.computed(()=>b.value.reduce((d,f)=>d+f.price,0)-v.value.reduce((d,f)=>d+f.price,0)),s=()=>{r("close")},m=()=>{r("done")};return(d,f)=>(e.openBlock(),e.createBlock(Ud,{header:"",title:"Confirm Your Selection",description:"This selection requires a configuration change",footer:"","no-close":"",onClose:s},{content:e.withCtx(()=>[e.createElementVNode("div",zd,[e.createElementVNode("header",Kd,[Zd,e.createElementVNode("div",Qd,[e.createElementVNode("p",Xd,e.toDisplayString(t.item.itemName),1),e.createElementVNode("p",Jd,e.toDisplayString(t.item.qty),1),e.createElementVNode("p",Gd,e.toDisplayString(e.unref(He)(t.item.price)),1)])]),e.createElementVNode("main",Wd,[Yd,e.createElementVNode("div",eu,[h.value.length>0?(e.openBlock(),e.createElementBlock("div",tu,[nu,(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,l=>(e.openBlock(),e.createElementBlock("div",{key:l.itemId,class:"ect-flex ect-items-center ect-py-2 ect-px-4 ect-border-t ect-border-neutral-200"},[e.createElementVNode("p",ru,e.toDisplayString(l.itemName),1),e.createElementVNode("p",ou,e.toDisplayString(l.qty),1),e.createElementVNode("p",iu," + "+e.toDisplayString(e.unref(He)(l.price)),1)]))),128))])):e.createCommentVNode("",!0),u.value.length>0?(e.openBlock(),e.createElementBlock("div",au,[lu,(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,l=>(e.openBlock(),e.createElementBlock("div",{key:l.itemId,class:"ect-flex ect-items-center ect-py-2 ect-px-4 ect-border-t ect-border-neutral-200"},[e.createElementVNode("p",su,e.toDisplayString(l.itemName),1),e.createElementVNode("p",cu,e.toDisplayString(l.qty),1),e.createElementVNode("p",du," - "+e.toDisplayString(e.unref(He)(l.price)),1)]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",uu,[fu,e.createElementVNode("p",hu,e.toDisplayString(e.unref(He)(g.value)),1)])])]),e.createElementVNode("footer",null,[e.createElementVNode("div",pu,[mu,e.createElementVNode("div",gu,[e.createElementVNode("div",yu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(l,p)=>(e.openBlock(),e.createElementBlock("div",{key:l.label,class:e.normalizeClass(["ect-flex ect-px-4 ect-py-1",{"ect-border-t ect-border-neutral-200":p>0}])},[e.createElementVNode("div",bu,[e.createElementVNode("p",_u,e.toDisplayString(l.label),1)]),e.createElementVNode("div",vu,[e.createElementVNode("p",Cu,e.toDisplayString(e.unref(He)(l.value)),1)]),e.createElementVNode("div",Eu,[e.createElementVNode("p",ku,e.toDisplayString(e.unref(He)(l.priceChange)),1)])],2))),128))])]),e.createElementVNode("div",wu,[e.createElementVNode("div",Nu,[xu,e.createElementVNode("div",Ou,[e.createElementVNode("p",Su,e.toDisplayString(e.unref(He)(c.value.value)),1)]),e.createElementVNode("div",Vu,[e.createElementVNode("p",Tu,e.toDisplayString(e.unref(He)(c.value.priceChange)),1)])])])])])])]),footer:e.withCtx(()=>[e.createElementVNode("div",Au,[e.createVNode(Ze,{class:"ect-min-w-[100px]",btype:"secondary","button-style":"outlined",size:"medium","data-test-id":"conflict-modal-button-cancel",onClick:f[0]||(f[0]=l=>r("close"))},{default:e.withCtx(()=>[e.createTextVNode("Cancel")]),_:1}),e.createVNode(Ze,{class:"ect-min-w-[100px]",btype:"primary","button-style":"primary",size:"medium","data-test-id":"conflict-modal-button-done",onClick:m},{default:e.withCtx(()=>[e.createTextVNode("Done")]),_:1})])]),_:1}))}},[["__scopeId","data-v-e51cc54e"]]),Bu={class:"ect-flex ect-flex-col"},Lu=["onUpdate:modelValue","data-test-id","value","disabled","onChange"],Mu=["onUpdate:modelValue","data-test-id","value","disabled","onChange"],Ru={key:0},Pu={key:1,class:"ect-border-t ect-border-gray-200 ect-p-4"},qu={__name:"ConfiguratorTabSections",props:{data:{type:Object,required:!0}},setup(t){const i=at(),n=t,r=e.computed(()=>n.data.itemTypes||[]),o=e.computed(()=>n.data.showImage||!1),a=e.ref(null),c=e.ref({});let b=e.ref(null),h=e.ref(null);const v=(d,f)=>{d.qty=f},u=(d,f)=>{d.itemName=f},g=()=>{i.configuration.categoryOptions.forEach(d=>{d.itemTypes.forEach(f=>{f.options.forEach(l=>{i.configuration.sysGuidedOptions&&(a.value.hidden.includes(l.relationshipInfo.publishKey)?l.hidden=!0:l.hidden=!1),a.value.inclusions.includes(l.relationshipInfo.publishKey)&&!f.selected.includes(l.itemId)&&f.selected.push(l.itemId),a.value.exclusions.includes(l.relationshipInfo.publishKey)&&f.selected.includes(l.itemId)&&f.selected.splice(f.selected.indexOf(l.itemId),1)})})}),a.value=null,c.value=null},s=async(d,f,l,p)=>{if(d.preventDefault(),d.stopPropagation(),b.value=null,h.value=null,f.calculateRules){p&&p.isRadio?l.includes(f.itemId)?(l.splice(0,l.length),h.value=f.relationshipInfo.publishKey):(l.splice(0,l.length),l.push(f.itemId),b.value=f.relationshipInfo.publishKey):l.includes(f.itemId)?(l.splice(l.indexOf(f.itemId),1),h.value=f.relationshipInfo.publishKey):(l.push(f.itemId),b.value=f.relationshipInfo.publishKey);const _=h.value?f:null,C=b.value?f:null,y=await i.evaluateConfigSelection(_,C);y.inclusions.length>0||y.exclusions.length>0?(a.value=y,c.value=f,[...y.inclusions,...y.exclusions].includes(f.relationshipInfo.publishKey)||(b.value&&a.value.exclusions.push(b.value),h.value&&a.value.inclusions.push(h.value))):(a.value=y,b.value&&a.value.exclusions.push(b.value),h.value&&a.value.inclusions.push(h.value),g())}},m=(d,f,l,p)=>{d.target.type==="checkbox"||d.target.type==="radio"||(d.preventDefault(),d.stopPropagation(),p.isRadio?l.includes(f.itemId)?l.splice(0,l.length):(l.splice(0,l.length),l.push(f.itemId)):l.includes(f.itemId)?l.splice(l.indexOf(f.itemId),1):l.push(f.itemId),s(d,f,l,p))};return(d,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[a.value?(e.openBlock(),e.createBlock(Iu,{key:0,item:c.value,data:a.value,onClose:f[0]||(f[0]=l=>a.value=null),onDone:g},null,8,["item","data"])):e.createCommentVNode("",!0),e.createElementVNode("div",Bu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,l=>(e.openBlock(),e.createBlock(ms,{key:l.itemTypeId,title:l.itemTypeName,description:l.description,message:l.isRadio?l.selected?"":l.minMessage:l.selected.length<l.minNumber?l.minMessage:l.selected.length===l.maxNumber?l.maxMessage:""},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass([l.numberOfColumns===1?"ect-space-y-3 md:ect-space-y-4 ect-p-2 md:ect-p-4":l.numberOfColumns===2?"ect-grid ect-grid-cols-1 md:ect-grid-cols-2 ect-gap-3 md:ect-gap-4 ect-p-2 md:ect-p-4":"ect-grid ect-grid-cols-1 md:ect-grid-cols-2 lg:ect-grid-cols-3 ect-gap-3 md:ect-gap-4 ect-p-2 md:ect-p-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options||[],p=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p.itemId},[p.hidden?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(cc,{key:0,item:p,name:p.itemName,description:p.description||"","min-quantity":l.minQuantity,"max-quantity":l.maxQuantity,"show-image":o.value,selected:l.selected.includes(p.itemId),tags:p.getTags(),price:p.price,quantity:p.qty,"image-url":p.defaultImageURL,attributes:p.attributes||[],size:l.numberOfColumns,"item-id":p.itemId,"item-type":l.itemTypeName||"",category:l.category,"relationship-info":p.relationshipInfo||{},option:e.unref(i).optionByItemId.get(p.itemId),"is-attributes":p.isAttributes,"show-attributes":l.lightboxAttributes,disabled:p.isDisabled,"onUpdate:quantity":_=>v(p,_),"onUpdate:name":_=>u(p,_),onEditAttributes:_=>p.showAttributesModal=!0,onClick:_=>l.selected.includes(p.itemId)||p.isDisabled?null:m(_,p,l.selected,l)},{"selection-control":e.withCtx(()=>[l.isRadio?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,"onUpdate:modelValue":_=>l.selected[0]=_,"data-test-id":`configurator-${l.itemTypeId}-radio-${p.itemId}`,class:"ect-accent-success ect-w-5 ect-h-5",type:"radio",value:p.itemId,disabled:p.isDisabled,onClick:f[1]||(f[1]=e.withModifiers(()=>{},["stop"])),onChange:_=>s(_,p,l.selected,l)},null,40,Lu)),[[e.vModelRadio,l.selected[0]]]):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,"onUpdate:modelValue":_=>l.selected=_,"data-test-id":`configurator-${l.itemTypeId}-checkbox-${p.itemId}`,class:"ect-accent-success ect-w-5 ect-h-5",type:"checkbox",value:p.itemId,disabled:p.isDisabled,onClick:f[2]||(f[2]=e.withModifiers(()=>{},["stop"])),onChange:_=>s(_,p,l.selected,l)},null,40,Mu)),[[e.vModelCheckbox,l.selected]])]),default:e.withCtx(()=>[l.lightboxAttributes?(e.openBlock(),e.createElementBlock("div",Ru,[p.showAttributesModal?(e.openBlock(),e.createBlock(Td,{key:0,option:p,attributes:p.attributes,onDone:_=>p.attributes=_,onClose:_=>p.showAttributesModal=!1},null,8,["option","attributes","onDone","onClose"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",Pu,[e.createVNode(nr,{attributes:p.attributes},null,8,["attributes"])]))]),_:2},1032,["item","name","description","min-quantity","max-quantity","show-image","selected","tags","price","quantity","image-url","attributes","size","item-id","item-type","category","relationship-info","option","is-attributes","show-attributes","disabled","onUpdate:quantity","onUpdate:name","onEditAttributes","onClick"]))],64))),128))],2)]),_:2},1032,["title","description","message"]))),128))])],64))}},Du=t=>(e.pushScopeId("data-v-cb7a75a9"),t=t(),e.popScopeId(),t),ju={class:"ect-space-y-4"},$u={class:"ect-w-full ect-bg-white ect-border ect-border-ect-gray-200 ect-rounded-lg"},Fu={class:"ect-bg-white ect-border-b ect-border-ect-gray-200 ect-px-4 ect-py-4 ect-sticky ect-top-0 ect-z-[5] ect-overflow-hidden ect-rounded-t-lg"},Hu={class:"ect-text-sm ect-font-semibold ect-text-green-700","data-test-id":"configurator-summary-header-title"},Uu={class:"ect-bg-white ect-px-4 ect-py-4 ect-pb-3 ect-border-b ect-border-ect-gray-200 ect-top-[53px] ect-z-9 ect-overflow-hidden ect-sticky ect-top-[53px]"},zu={class:"ect-text-sm ect-font-medium ect-text-ect-gray-800","data-test-id":"configurator-summary-section-frame-color"},Ku={class:"ect-flex ect-items-center ect-bg-light-bg-x ect-border-b ect-border-ect-gray-200"},Zu={class:"ect-flex-1 ect-bg-ect-gray-50 ect-px-8 ect-py-4 ect-min-h-[56px] ect-flex ect-items-center"},Qu={class:"ect-text-sm ect-text-font-clr-light","data-test-id":"configurator-summary-item-red"},Xu={class:"ect-flex ect-items-center ect-px-8 ect-py-4 ect-gap-5"},Ju={class:"ect-flex ect-justify-center ect-min-w-[128px]"},Gu=Du(()=>e.createElementVNode("div",{class:"ect-border-r ect-w-[1px] ect-border-text-muted-light ect-h-6"},null,-1)),Wu={class:"ect-flex ect-justify-center ect-min-w-[100px]"},Yu={class:"ect-text-sm ect-font-semibold ect-text-ect-gray-800","data-test-id":"configurator-summary-price-red"},e1={key:0,class:"ect-flex ect-items-center ect-bg-light-bg-x ect-px-10 ect-py-3"},t1={class:"ect-flex ect-flex-wrap ect-items-center ect-bg-light-bg-x ect-gap-2"},n1={class:"ect-bg-white ect-px-8 ect-py-4 ect-pr-4 ect-flex ect-justify-end"},r1={class:"ect-text-sm ect-font-semibold ect-text-ect-gray-800","data-test-id":"configurator-summary-total"},o1=Ee({__name:"ConfiguratorSummaryTab",props:{summary:{type:Array,required:!0}},setup(t){return(i,n)=>(e.openBlock(),e.createElementBlock("div",ju,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.summary,r=>(e.openBlock(),e.createElementBlock("div",{key:r.key,class:"ect-mb-4"},[e.createElementVNode("section",$u,[e.createElementVNode("div",Fu,[e.createElementVNode("h3",Hu,e.toDisplayString(r.category),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.selectedItemTypes,o=>(e.openBlock(),e.createElementBlock("div",{key:o.itemTypeId,class:"ect-flex ect-flex-col ect-border-b ect-border-ect-gray-200"},[e.createElementVNode("div",Uu,[e.createElementVNode("h4",zu,e.toDisplayString(o.itemTypeName),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.selectedOptions,a=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:a.itemId},[e.createElementVNode("div",Ku,[e.createElementVNode("div",Zu,[e.createElementVNode("span",Qu,e.toDisplayString(a.itemName),1)]),e.createElementVNode("div",Xu,[e.createElementVNode("div",Ju,[e.createVNode(dn,{value:a.qty,"onUpdate:value":c=>a.qty=c,min:o.minQuantity,max:o.maxQuantity,"data-test-id":`configurator-summary-counter-${a.itemId}`},null,8,["value","onUpdate:value","min","max","data-test-id"])]),Gu,e.createElementVNode("div",Wu,[e.createElementVNode("span",Yu,e.toDisplayString(e.unref(He)(a.price)),1)])])]),a.isAttributes&&a.getTags().length>0?(e.openBlock(),e.createElementBlock("div",e1,[e.createElementVNode("div",t1,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.getTags(),c=>(e.openBlock(),e.createBlock(Ye,{key:c.attributeId,label:c.label,value:c.value},null,8,["label","value"]))),128))])])):e.createCommentVNode("",!0)],64))),128))]))),128)),e.createElementVNode("div",n1,[e.createElementVNode("span",r1," Total : "+e.toDisplayString(e.unref(He)(r.totalPrice())),1)])])]))),128))]))}},[["__scopeId","data-v-cb7a75a9"]]),i1={class:"configurator-page ect-flex ect-flex-col ect-h-full ect-relative","data-test-id":"configurator-page-container"},a1={"data-test-id":"configurator-tabs-container",class:"ect-bg-white ect-shadow-sm ect-flex-shrink-0 ect-mb-4"},l1={class:"ect-bg-white ect-border-t ect-border-gray-200 ect-flex-shrink-0 ect-absolute ect-bottom-0 ect-left-0 ect-right-0 ect-z-50","data-test-id":"configurator-footer-sticky"},s1=Ee({__name:"ConfiguratorTabs",emits:["scroll"],setup(t,{emit:i}){const n=at(),r=e.ref("billing-options"),o=e.computed(()=>n.configuration.categoryOptions),a=e.computed(()=>{const s=o.value.map(m=>({key:m.key,title:m.category}));return s.push({key:"summary",title:"Summary"}),s}),c=i,b=e.computed(()=>h.value.get(r.value)),h=e.computed(()=>{const s=new Map;return o.value.forEach(m=>{s.set(m.key,m)}),s}),v=()=>{console.info("Continue");const s=a.value.findIndex(m=>m.key===r.value);if(s<a.value.length-1){const m=a.value[s+1];r.value=m.key}else n.maintainQuoteConfiguration()};e.watch(r,s=>{u(s),c("scroll",0)});const u=s=>{r.value=s},g=s=>{const m=s.target.scrollTop;c("scroll",m)};return e.onBeforeMount(()=>{r.value=a.value[0].key}),(s,m)=>(e.openBlock(),e.createElementBlock("div",i1,[e.createElementVNode("div",a1,[e.createVNode(Ql,{modelValue:r.value,"onUpdate:modelValue":m[0]||(m[0]=d=>r.value=d),"show-tabs":!0,border:"",tabs:a.value,"data-test-id":"configurator-tabs-container",onTabChange:u},null,8,["modelValue","tabs"])]),r.value!=="summary"?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ect-flex-1 ect-min-h-0 ect-overflow-y-auto ect-p-4 ect-pt-0 ect-pb-20","data-test-id":"`configurator-${activeTab}-tab-content`",onScroll:g},[e.createVNode(qu,{data:b.value},null,8,["data"])],32)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"ect-flex-1 ect-min-h-0 ect-overflow-y-auto ect-p-4 ect-pt-0 ect-pb-20","data-test-id":"`configurator-${activeTab}-tab-content`",onScroll:g},[e.createVNode(o1,{summary:e.unref(n).summary},null,8,["summary"])],32)),e.createElementVNode("div",l1,[e.createVNode(as,{"btn-text":r.value!=="summary"?"Continue":"Save",item:e.unref(n).configuration,onContinue:v},null,8,["btn-text","item"])])]))}},[["__scopeId","data-v-8cb140ff"]]),c1={class:"ect-px-6 ect-pt-4 ect-pb-2 ect-bg-white"},d1={class:"ect-flow-root"},u1=["src","alt"],f1={key:1,class:"ect-mb-2"},h1={class:"ect-text-sm ect-text-gray-700 ect-leading-relaxed ect-transition-all ect-duration-400"},p1={key:0,class:"ect-mt-2"},m1={class:"ect-inline-block ect-mb-2"},g1={key:1,class:"ect-inline-block ect-mb-2"},y1={key:1,class:"ect-mt-2"},b1={__name:"ConfiguratorInfo",props:{config:{type:Object,required:!0},editAttributes:{type:Boolean,required:!0},scroll:{type:Number,default:0}},emits:["edit-attributes"],setup(t,{emit:i}){const n=t,r=i,o=e.computed(()=>n.config.attributes.map(a=>({label:a.label,value:a.value})).filter(a=>a.value!==null&&a.value!==""));return(a,c)=>(e.openBlock(),e.createElementBlock("div",c1,[e.createElementVNode("div",d1,[t.config.defaultImageURL&&t.scroll<50?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["ect-bg-gray-200 ect-rounded-lg ect-overflow-hidden ect-float-left ect-mr-4 ect-mb-2",t.editAttributes?"ect-w-[40px] ect-h-[40px]":"ect-w-[104px] ect-h-[104px]"])},[t.config.defaultImageURL?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.config.defaultImageURL,alt:t.config.itemName,class:"ect-w-full ect-h-full ect-object-cover"},null,8,u1)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),t.scroll<50?(e.openBlock(),e.createElementBlock("div",f1,[e.createElementVNode("p",h1,e.toDisplayString(t.config.description),1)])):e.createCommentVNode("",!0),t.config.isAttributes?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[t.editAttributes?(e.openBlock(),e.createElementBlock("div",y1,[e.createVNode(nr,{attributes:t.config.attributes},null,8,["attributes"])])):(e.openBlock(),e.createElementBlock("div",p1,[o.value.length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(b,h)=>(e.openBlock(),e.createElementBlock("span",{key:h,class:"ect-inline-block ect-mr-2 ect-mb-2"},[e.createVNode(Ye,{label:b.label,value:b.value},null,8,["label","value"])]))),128)),e.createElementVNode("span",m1,[e.createElementVNode("button",{"data-test-id":"configurator-info-button-edit-attributes",onClick:c[0]||(c[0]=b=>r("edit-attributes"))},[e.createVNode(Ye,{label:"Edit attributes","edit-button":""})])])],64)):(e.openBlock(),e.createElementBlock("span",g1,[e.createElementVNode("button",{"data-test-id":"configurator-info-button-add-attributes",onClick:c[1]||(c[1]=b=>r("edit-attributes"))},[e.createVNode(Ye,{label:"Add attributes","add-button":""})])]))]))],64)):e.createCommentVNode("",!0)])]))}},_1=["data-test-id"],v1=["placeholder","value","data-test-id"],C1=["data-test-id"],E1=["data-test-id","onClick"],k1=Ee({__name:"MoleculeSearch",props:{placeholder:{type:String,default:""},modelValue:{type:String,default:""},height:{type:[Number,String],default:32},size:{type:String,default:"regular"},loading:{type:Boolean,default:!1},options:{type:Array,default:()=>[]},iconPosition:{type:String,default:"right",validator:t=>["left","right"].includes(t)},dataTestId:{type:String,required:!0}},emits:["update:modelValue","optionClick"],setup(t,{emit:i}){const n=t,r=i,o=e.ref(""),a=e.ref(null),c=e.ref(!1),b=e.ref(null),h=e.ref(!0),v=e.computed(()=>h.value?{}:{bottom:"100%",marginTop:"0",marginBottom:"4px"}),u=async()=>{var E;if(await e.nextTick(),!b.value)return;const p=b.value.getBoundingClientRect(),C=window.innerHeight-p.bottom,y=Math.min(((E=n.options)==null?void 0:E.length)*40+20,200);h.value=C>=y},g=()=>{a.value=null,r("update:modelValue","")},s=l=>{const p=l.target.value;o.value&&(clearTimeout(o.value),o.value=null),o.value=setTimeout(()=>{r("update:modelValue",p)},500)},m=async()=>{c.value=!0,await u()},d=()=>{setTimeout(()=>{c.value=!1},150)},f=l=>{c.value=!1,o.value&&(clearTimeout(o.value),o.value=null),r("update:modelValue",l.label),r("optionClick",l)};return(l,p)=>{var _;return e.openBlock(),e.createElementBlock("div",{ref_key:"searchContainer",ref:b,class:e.normalizeClass(["molecule-search",{"icon-left":t.iconPosition==="left"}]),"data-test-id":t.dataTestId},[t.loading?(e.openBlock(),e.createBlock(co,{key:0,size:16,class:"icon ect-top-2 icon-loader","data-test-id":`${t.dataTestId}-loader`},null,8,["data-test-id"])):t.iconPosition==="left"||!t.modelValue?(e.openBlock(),e.createBlock(we,{key:1,class:"icon-search ect-mt-[-1px]",icon:"search",size:14,color:"#5f5f5f","data-test-id":`${t.dataTestId}-search`,onClick:g},null,8,["data-test-id"])):e.createCommentVNode("",!0),e.createElementVNode("input",{class:e.normalizeClass(["search-input-box",{large:t.size==="large"}]),type:"text",style:e.normalizeStyle({height:`${t.height}px`}),placeholder:n.placeholder,value:t.modelValue,"data-test-id":`${t.dataTestId}-input`,onInput:s,onFocus:m,onBlur:d},null,46,v1),t.modelValue&&!t.loading?(e.openBlock(),e.createBlock(we,{key:2,class:"close-btn",icon:"close",size:8,color:"#5f5f5f","data-test-id":`${t.dataTestId}-close`,onClick:g},null,8,["data-test-id"])):e.createCommentVNode("",!0),((_=t.options)==null?void 0:_.length)>0&&c.value?(e.openBlock(),e.createElementBlock("div",{key:3,class:e.normalizeClass(["search-options",{"dropdown-top":!h.value}]),style:e.normalizeStyle(v.value),"data-test-id":`${t.dataTestId}-dropdown`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(C,y)=>(e.openBlock(),e.createElementBlock("div",{key:C.id,class:"search-option","data-test-id":`${t.dataTestId}-option-${y}`,onClick:e.withModifiers(E=>f(C),["stop"]),onMousedown:p[0]||(p[0]=e.withModifiers(()=>{},["prevent"]))},[e.createTextVNode(e.toDisplayString(C.label)+" ",1),e.createElementVNode("span",null,e.toDisplayString(C.subLabel),1)],40,E1))),128))],14,C1)):e.createCommentVNode("",!0)],10,_1)}}},[["__scopeId","data-v-6cdaa802"]]),w1=["data-test-id"],N1=Ee({__name:"StatePill",props:{text:{type:String,required:!0},state:{type:String,default:"default",validator:t=>["default","draft","review","active","inactive","in draft","active"].includes(t)},dataTestId:{type:String,default:""}},setup(t){const i=t,n=e.computed(()=>({"ect-state-pill--default":i.state==="default","ect-state-pill--draft":i.state==="draft"||i.state==="in draft","ect-state-pill--review":i.state==="review","ect-state-pill--active":i.state==="active","ect-state-pill--inactive":i.state==="inactive"}));return(r,o)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["ect-state-pill",n.value]),"data-test-id":t.dataTestId},e.toDisplayString(t.text),11,w1))}},[["__scopeId","data-v-6be678b8"]]),x1=["data-test-id"],O1=["data-test-id"],S1=["data-test-id"],V1=["data-test-id"],T1=["data-test-id","onClick"],A1=["data-test-id"],I1=Ee({__name:"ecBreadcrumbs",props:{links:{type:Array,default:()=>[],validator:t=>t.every(i=>typeof i=="object"&&typeof i.text=="string"&&(i.route===void 0||typeof i.route=="string"||typeof i.route=="object"))},dataTestId:{type:String,required:!0}},setup(t){const i=ln(),n=r=>{r&&i.push(r)};return(r,o)=>(e.openBlock(),e.createElementBlock("div",{class:"ect-flex ect-items-center ect-justify-between","data-test-id":t.dataTestId},[e.createElementVNode("div",{class:"ect-flex ect-items-center ect-gap-4","data-test-id":`${t.dataTestId}-container`},[e.createElementVNode("div",{class:"ect-flex ect-items-center ect-gap-1","data-test-id":`${t.dataTestId}-breadcrumbs`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.links,(a,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:c},[c>0?(e.openBlock(),e.createElementBlock("span",{key:0,class:"ect-text-[#828282] ect-text-xs ect-font-semibold","data-test-id":`${t.dataTestId}-separator-${c}`}," / ",8,V1)):e.createCommentVNode("",!0),a.route?(e.openBlock(),e.createElementBlock("button",{key:1,class:"ect-text-[#828282] ect-text-xs ect-font-semibold ect-font-ui ect-leading-normal hover:ect-text-[#0076D6] hover:ect-underline ect-transition-colors","data-test-id":`${t.dataTestId}-link-${c}`,onClick:b=>n(a.route)},e.toDisplayString(a.text),9,T1)):(e.openBlock(),e.createElementBlock("span",{key:2,class:"ect-text-[#828282] ect-text-xs ect-font-semibold ect-font-ui ect-leading-normal","data-test-id":`${t.dataTestId}-text-${c}`},e.toDisplayString(a.text),9,A1))],64))),128))],8,S1)],8,O1)],8,x1))}},[["__scopeId","data-v-151ca816"]]),B1={components:{AppIcon:we},props:{direction:{type:String,default:"top",validator:t=>["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"].includes(t)},content:{type:String,default:null},disabled:{type:Boolean,default:!1},width:{type:Number,default:130},icon:{type:String,default:null},dataTestId:{type:String,default:""}},data(){return{show:!1}},computed:{tooltipClass(){return{tooltip:!0,[`tooltip-${this.direction}`]:!0}},styleObj(){return{width:`${this.width}px !important`}}},methods:{showTooltip(){this.disabled||(this.show=!0)},hideTooltip(){this.show=!1}}},L1=["data-test-id"],M1=["data-test-id"];function R1(t,i,n,r,o,a){const c=e.resolveComponent("AppIcon");return n.content?(e.openBlock(),e.createElementBlock("div",{key:0,class:"tooltip-container","data-test-id":n.dataTestId,onMouseover:i[0]||(i[0]=(...b)=>a.showTooltip&&a.showTooltip(...b)),onMouseleave:i[1]||(i[1]=(...b)=>a.hideTooltip&&a.hideTooltip(...b))},[e.renderSlot(t.$slots,"default",{},void 0,!0),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(a.tooltipClass),style:e.normalizeStyle(a.styleObj),"data-test-id":`${n.dataTestId}-content`},[n.icon?(e.openBlock(),e.createBlock(c,{key:0,icon:n.icon,color:"#57c046",size:14,"data-test-id":`${n.dataTestId}-icon`},null,8,["icon","data-test-id"])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.content),1)],14,M1),[[e.vShow,o.show]])],40,L1)):e.renderSlot(t.$slots,"default",{key:1},void 0,!0)}const P1=Ee(B1,[["render",R1],["__scopeId","data-v-b36acc62"]]),q1=Ke.defineStore("item",()=>{const t=it(),i=e.ref([]),n=e.ref([]),r=e.ref(!1),o=e.ref(0),a=e.ref(1),c=e.ref(""),b=e.ref(20),h=e.ref(null),v=e.ref(!1),u=e.ref(null),g=e.ref(!1),s=e.ref(null),m=e.ref(null),d=e.ref(null),f=e.ref(null),l=e.ref(null),p=e.ref({addedOptionIds:null,eCatalogCount:null,ecatalogs:null,publishVersionId:null,removedOptionIds:null}),_=e.ref([]),C=e.ref({ecatalogIds:[],optionItemsToAdd:[]}),y=e.ref(!1),E=e.ref(null),A=e.ref(0),S=2,T=H=>{!Array.isArray(H)||H.every(z=>{var J;return z.id&&((J=z.itemTypes)==null?void 0:J.every(G=>{var oe;return G.id&&((oe=G.options)==null?void 0:oe.every(ae=>ae.id))}))})||H.forEach((z,J)=>{z.id||(z.id=`category-${J}-${z.category}`),z.itemTypes&&Array.isArray(z.itemTypes)&&z.itemTypes.forEach((G,oe)=>{G.id||(G.id=G.itemTypeId||`itemType-${J}-${oe}-${G.itemTypeName||"unnamed"}`),G.options&&Array.isArray(G.options)&&G.options.forEach((ae,ce)=>{ae.id||(ae.id=ae.itemId||`option-${J}-${oe}-${ce}-${ae.itemName||"unnamed"}`)})})})},B=async(H,F=null)=>{var z;try{g.value=!0;let J={};if(F)J={fileId:F};else{const oe=_.value.find(ce=>ce.status==="Draft"),ae=_.value.find(ce=>ce.status==="Active");ae?J={fileId:ae.id}:oe?J={fileId:oe.id}:J={itemId:H}}let G=await window.AdminConfiguratorManager.getItemConfiguration({request:JSON.stringify(J)});return G!=null&&G.errorMessage?(t.handleError(G.errorMessage),null):(G=qe(G.data),typeof G.data=="string"&&(G=JSON.parse(G.data)),(z=G==null?void 0:G.productItem)!=null&&z.categoryOptions&&T(G.productItem.categoryOptions),h.value=G,g.value=!1,_.value.length===0&&!r.value&&await te(),G.data)}catch(J){return g.value=!1,t.handleError("Failed to fetch item configuration. Please try again.",J),null}},V=async(H,F="",z="")=>{try{const J={searchTerm:H,itemTypeId:F,filterType:z};let G=await window.AdminConfiguratorManager.getItemsList({request:JSON.stringify(J)});return G=qe(G),G!=null&&G.errorMessage?(t.handleError(G.errorMessage),null):G}catch{return t.handleError("Failed to fetch option list. Please try again."),null}},w=async(H,F)=>{try{const z={productItemId:l.value,optionItemId:H,existingItemType:F};let J=await window.AdminConfiguratorManager.getItemDetails({request:JSON.stringify(z)});return J=qe(J),J!=null&&J.errorMessage?(t.handleError(J.errorMessage),null):J}catch{return t.handleError("Failed to fetch option details. Please try again."),null}},N=async()=>{try{const H=await window.AdminConfiguratorManager.getAvailableAttributes();return JSON.parse(H)}catch{t.handleError("Failed to fetch available attributes. Please try again.")}},M=async H=>{try{const F=await window.AdminConfiguratorManager.addAttribute({request:JSON.stringify(H)});return JSON.parse(F)}catch{t.handleError("Failed to fetch item configuration. Please try again.")}},$=async H=>{try{const F=JSON.stringify(H),z=await window.AdminConfiguratorManager.getChildFields({request:F});return JSON.parse(z)}catch(F){throw t.handleError("Failed to fetch child fields. Please try again.",F),F}},U=async()=>{const H={objectApiName:"XX_Base__Item_Type__c",fieldApiName:"XX_Base__Item_Type_Category__c"};try{return(await window.AdminConfiguratorManager.getPicklistValues({request:JSON.stringify(H)})).data}catch(F){throw t.handleError("Failed to fetch picklist values. Please try again.",F),F}},Q=async()=>{var H,F,z;try{const J=(F=(H=h.value)==null?void 0:H.productItem)==null?void 0:F.itemStatus,oe={fileId:(z=_.value.find(ce=>ce.status===J))==null?void 0:z.id,itemId:l.value};let ae=await window.AdminConfiguratorManager.activateItemConfig({request:JSON.stringify(oe)});return ae!=null&&ae.error?(L(ae==null?void 0:ae.error),null):(ae=qe(ae.data),p.value=ae,ae)}catch{return L(),null}},X=async()=>{try{const H={productId:"068bn00000Anu0YAAR"};return(await window.AdminConfiguratorManager.getECatalogsForProduct({request:JSON.stringify(H)})).data}catch(H){t.handleError("Failed to fetch e catalogs for product. Please try again.",H)}},te=async()=>{try{const H={productId:l.value},F=await window.AdminConfiguratorManager.getProductConfigInfo({request:JSON.stringify(H)}),z=JSON.parse(F.data);return _.value=z.data,z}catch(H){t.handleError("Failed to save item configuration. Please try again.",H)}},Z=async()=>{try{const H={ecatalogIds:C.value.ecatalogIds,productItemId:l.value,optionItemsToAdd:C.value.optionItemsToAdd};return(await window.AdminConfiguratorManager.saveItemConfigToCatalog({request:JSON.stringify(H)})).data}catch(H){t.handleError("Failed to save item configuration to catalog. Please try again.",H)}},P=async()=>{var H,F,z;try{const J=(F=(H=h.value)==null?void 0:H.productItem)==null?void 0:F.itemStatus,G={itemId:l.value,fileId:(z=_.value.find(ye=>ye.status===J))==null?void 0:z.id},oe=await window.AdminConfiguratorManager.createNewVersion({request:JSON.stringify(G)}),ae=JSON.parse(oe);await te(),await B(l.value,ae.id);const ce=_.value.findIndex(ye=>ye.status==="Draft");return ce!==-1?_.value[ce]=ae:_.value.push(ae),ae}catch(J){t.handleError("Failed to create new version. Please try again.",J)}},x=async()=>{var J,G;const H=(J=_.value.find(oe=>oe.status==="Inactive"))==null?void 0:J.id,F=(G=_.value.find(oe=>oe.status==="Active"))==null?void 0:G.id,z={itemId:l.value,activeVersionId:F,inactiveVersionId:H};try{return(await window.AdminConfiguratorManager.rollbackItemConfig({request:JSON.stringify(z)})).data}catch(oe){t.handleError("Failed to rollback item configuration. Please try again.",oe)}},L=H=>{H?E.value=H:E.value=null,y.value=!0};return{items:i,loading:r,totalCount:o,currentPage:a,searchTerm:c,itemLimit:b,columns:n,currentItemConfig:h,savingItemConfiguration:v,currentItem:u,configLoader:g,currentItemData:s,currentGroupIndex:m,currentOptionIndex:d,currentOptionData:f,versionInfo:_,activateConfigData:p,activatePayload:C,itemId:l,showActivationErrorModal:y,activationError:E,activationRetryCount:A,maxRetries:S,getItemConfiguration:B,getItemsList:V,getItemDetails:w,getAvailableAttributes:N,addAttribute:M,getChildFields:$,getPicklistValues:U,activateItemConfig:Q,getECatalogsForProduct:X,getversionInfo:te,saveItemConfigToCatalog:Z,createNewVersion:P,rollbackItemConfig:x,addCrossSell:async H=>{const F={itemId:H.id||H.itemId,primarySortOrder:H.primarySortOrder};try{const z=await window.AdminConfiguratorManager.addCrossSell({request:JSON.stringify(F)});return JSON.parse(z.data)}catch(z){return t.handleError("Failed to add cross sell. Please try again.",z),null}},saveItemConfiguration:async()=>{var H;if(g.value||r.value||v.value||!((H=h.value)!=null&&H.productItem))return null;if(!(h.value.productItem.itemStatus==="Active"||h.value.productItem.itemStatus==="Inactive"))try{v.value=!0;const F={itemId:l.value,configurationData:h.value},z=await window.AdminConfiguratorManager.saveItemConfiguration({request:JSON.stringify(F)});if(z!=null&&z.errorMessage)return t.handleError(z.errorMessage),null;if(!(z!=null&&z.error)){const J=_.value.findIndex(G=>G.status==="Draft");_.value[J].id=z.data}return z}catch(F){return t.handleError("Failed to save item configuration. Please try again.",F),null}finally{v.value=!1}},showActivationError:L,hideActivationError:()=>{y.value=!1,A.value=0},incrementRetryCount:()=>{A.value+=1,y.value=!0},canRetry:()=>A.value<S,assignStableIds:T}}),D1={class:"app-filters-main-wrapper"},j1={class:"app-filters-wrapper"},$1={class:"app-filters"},F1={class:"left-section"},H1={class:"ect-flex ect-gap-2 ect-items-center"},U1={class:"ect-absolute ect-top-0 ect-right-0 ect-w-full ect-h-full ect-z-10"},z1={class:"right-section"},K1={class:"after-search-wrapper"},Z1={class:"buttons-wrapper"},Q1={class:"before-button-wrapper"},X1={key:0,class:"action-wrapper"},J1={key:1,class:"button-text ect-font-medium"},G1={key:2,class:"count-badge"},W1=Ee({__name:"FilterHeader",props:{title:{type:String,default:""},showSearch:{type:Boolean,default:!1},buttons:{type:Array,default:()=>[],validator:t=>t.every(i=>(i.icon||i.text)&&typeof i.handler=="function")},searchWidth:{type:String,default:"312px"},showBackButton:{type:Boolean,default:!1},statusText:{type:String,default:""},placeholder:{type:String,default:"Search by name"},breadcrumbLinks:{type:Array,default:()=>[],validator:t=>t.every(i=>typeof i=="object"&&typeof i.text=="string"&&(i.route===void 0||typeof i.route=="string"))},recordLink:{type:String,default:""}},emits:["search","back"],setup(t,{emit:i}){const n=q1(),r=t,o=e.reactive([]);e.onMounted(()=>{a()});const a=()=>{o.splice(0,o.length),r.buttons&&r.buttons.length>0&&r.buttons.forEach(s=>{o.push({...s})})};e.watch(()=>r.buttons,()=>{a()},{deep:!0});const c=s=>{b("search",s)},b=i,h=e.ref(""),v=(s,m)=>{s.supportsToggle&&(s.isActive=!s.isActive),typeof s.handler=="function"&&s.handler(s,s.isActive)},u=()=>{b("back")},g=()=>{if(!r.recordLink)return;let s=r.recordLink;if(!s){let p=n.itemId;if(!p){const _=new URLSearchParams(window.location.search),C=new URLSearchParams(window.location.hash.split("?")[1]);p=_.get("itemId")||C.get("itemId")}s=p}if(!s)return;const d=window.location.href.match(/^(https?:\/\/[^/]+)/);if(!d){console.info("[ERROR]: Unable to extract base domain from current URL");return}const l=`${d[1]}/${s}`;window.open(l,"_blank")};return(s,m)=>(e.openBlock(),e.createElementBlock("div",D1,[e.createElementVNode("div",j1,[e.createElementVNode("div",$1,[e.createElementVNode("div",F1,[t.breadcrumbLinks&&t.breadcrumbLinks.length>1?(e.openBlock(),e.createBlock(I1,{key:0,links:t.breadcrumbLinks,"data-test-id":"filter-header-breadcrumbs",class:"ect-mb-3"},null,8,["links"])):e.createCommentVNode("",!0),e.createElementVNode("div",H1,[t.showBackButton?(e.openBlock(),e.createElementBlock("button",{key:0,class:"back-button","data-test-id":"filter-header-button-back",onClick:u},[e.createVNode(we,{icon:"arrow",symbol:"",size:16,color:"#198708",class:"ect-relative ect-top-[3px]"})])):e.createCommentVNode("",!0),t.title?(e.openBlock(),e.createElementBlock("p",{key:1,class:e.normalizeClass(["ect-relative ect-text-lg ect-font-semibold ect-leading-5 ect-text-[#1F1F1F] ect-transition-colors ect-duration-200",{"hover:ect-text-[#0076D6] ect-cursor-pointer":t.recordLink}]),"data-test-id":"filter-header-title",onClick:m[0]||(m[0]=d=>t.recordLink?g():null)},[e.createTextVNode(e.toDisplayString(t.title)+" ",1),t.recordLink?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(we,{icon:"open-link",symbol:"",size:16,color:"currentColor",class:"ect-relative ect-top-[3px]"}),e.createElementVNode("div",U1,[e.createVNode(P1,{class:"ect-min-w-full ect-h-full",direction:"top",content:"View Item in Salesforce","data-test-id":"filter-header-tooltip",width:160})])],64)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),t.statusText?(e.openBlock(),e.createBlock(N1,{key:2,text:t.statusText,state:t.statusText.toLowerCase(),"data-test-id":"`filter-header-status-pill`"},null,8,["text","state"])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"after-status",{},void 0,!0)])]),e.createElementVNode("div",z1,[t.showSearch?(e.openBlock(),e.createElementBlock("div",{key:0,class:"search-wrapper",style:e.normalizeStyle({width:t.searchWidth})},[e.createVNode(k1,{modelValue:h.value,"onUpdate:modelValue":[m[1]||(m[1]=d=>h.value=d),c],class:"search-input",placeholder:t.placeholder,"data-test-id":"filter-header-search-input"},null,8,["modelValue","placeholder"])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",K1,[e.renderSlot(s.$slots,"afterSearch",{},void 0,!0)]),e.createElementVNode("div",Z1,[e.createElementVNode("div",Q1,[e.renderSlot(s.$slots,"before-button",{},void 0,!0)]),s.$slots.buttons?(e.openBlock(),e.createElementBlock("div",X1,[e.renderSlot(s.$slots,"buttons",{},void 0,!0)])):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(o,(d,f)=>(e.openBlock(),e.createElementBlock("div",{key:f,class:"action-wrapper"},[e.createVNode(Ze,{btype:d.type||"primary","button-style":d.style||"outlined",size:"medium",style:e.normalizeStyle({minWidth:d.minWidth||"auto"}),class:e.normalizeClass([{active:d.isActive},{"icon-only":d.icon&&!d.text},{"text-button":d.text}]),loading:d.loading,disabled:d.disabled,"data-test-id":`filter-header-button-${d.text?d.text.toLowerCase().replace(/\s+/g,"-"):f}`,onClick:l=>v(d)},{default:e.withCtx(()=>[d.icon?(e.openBlock(),e.createBlock(we,{key:0,icon:d.icon,symbol:"",color:d.color||"#136E05",size:d.size||14},null,8,["icon","color","size"])):e.createCommentVNode("",!0),d.text?(e.openBlock(),e.createElementBlock("span",J1,e.toDisplayString(d.isActive?d.altText:d.text),1)):e.createCommentVNode("",!0),d.count?(e.openBlock(),e.createElementBlock("span",G1,e.toDisplayString(d.count),1)):e.createCommentVNode("",!0)]),_:2},1032,["btype","button-style","style","class","loading","disabled","data-test-id","onClick"])]))),128))])])])])]))}},[["__scopeId","data-v-2ea70801"]]),Y1=["data-test-id"],ef=["data-test-id"],tf=["data-test-id"],nf=["data-test-id"],rf=["data-test-id"],of=["data-test-id"],af=["data-test-id"],lf=Ee({__name:"ecSwitch",props:e.mergeModels({text:{type:[String,Object],required:!1,validator:t=>typeof t=="string"?!0:typeof t=="object"&&t!==null?Object.prototype.hasOwnProperty.call(t,"on")&&Object.prototype.hasOwnProperty.call(t,"off"):!1},subtext:{type:String,required:!1},size:{type:String,default:"regular",validator:t=>["regular","large"].includes(t)},disabled:{type:Boolean,default:!1},dataTestId:{type:String,default:""},leftAlign:{type:Boolean,default:!1}},{modelValue:{type:Boolean,required:!0},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(t,{emit:i}){const n=t,r=e.useModel(t,"modelValue"),o=i,a=e.computed(()=>typeof n.text=="string"?n.text:typeof n.text=="object"&&n.text!==null?r.value?n.text.on:n.text.off:""),c=()=>{n.disabled||o("update:modelValue",!r.value)};return(b,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["ec-switch-container",{disabled:t.disabled}]),"data-test-id":t.dataTestId},[t.leftAlign?(e.openBlock(),e.createElementBlock("span",{key:0,class:"ec-switch__label","data-test-id":`${t.dataTestId}-label`},[e.createTextVNode(e.toDisplayString(a.value)+" ",1),t.subtext?(e.openBlock(),e.createElementBlock("span",{key:0,class:"ec-switch__subtext","data-test-id":`${t.dataTestId}-subtext`},e.toDisplayString(t.subtext),9,tf)):e.createCommentVNode("",!0)],8,ef)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["ec-switch",{"ec-switch--active":r.value,"ec-switch--large":t.size==="large"}]),"data-test-id":`${t.dataTestId}-switch`,onClick:c},[e.createElementVNode("div",{class:"ec-switch__handle","data-test-id":`${t.dataTestId}-handle`},null,8,rf)],10,nf),t.leftAlign?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:1,class:"ec-switch__label","data-test-id":`${t.dataTestId}-label`},[e.createTextVNode(e.toDisplayString(a.value)+" ",1),t.subtext?(e.openBlock(),e.createElementBlock("span",{key:0,class:"ec-switch__subtext","data-test-id":`${t.dataTestId}-subtext`},e.toDisplayString(t.subtext),9,af)):e.createCommentVNode("",!0)],8,of))],10,Y1))}},[["__scopeId","data-v-cfefad9a"]]),sf={key:0,class:"ect-bg-white ect-h-full ect-flex ect-flex-col ect-overflow-auto"},cf={class:"ect-sticky ect-top-0 ect-z-50 ect-bg-white","data-test-id":"configurator-header-sticky"},df={class:"ect-flex ect-flex-col ect-sticky ect-top-0 ect-z-50 ect-bg-white ect-border-b ect-border-gray-200"},uf={key:0,class:"ect-flex-1 ect-min-h-0 ect-overflow-y-auto ect-bg-light-bg-x","data-test-id":"configurator-content-scrollable"},ff=Ee({__name:"ProductConfiguration",setup(t){const i=at(),n=e.ref(!1),r=e.ref(0),o=e.computed(()=>i.configuration),a=e.computed(()=>n.value?[{text:"Done",altText:"Done",type:"primary",style:"primary",handler:()=>c()}]:[{text:"Save",altText:"Save",type:i.isChangedConfiguration?"primary":"secondary",style:"primary",disabled:!i.isChangedConfiguration,handler:()=>b()}]),c=()=>{n.value=!1},b=()=>{console.info("Save"),i.maintainQuoteConfiguration()};return(h,v)=>e.unref(i).configuration?(e.openBlock(),e.createElementBlock("div",sf,[e.unref(i).savedScreen?(e.openBlock(),e.createBlock($l,{key:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",cf,[e.createElementVNode("div",df,[e.createCommentVNode("",!0),e.createVNode(W1,{title:o.value.itemName,buttons:a.value},{"before-button":e.withCtx(()=>[e.unref(i).isYearlyPricingExist?(e.openBlock(),e.createBlock(lf,{key:0,modelValue:e.unref(i).showYearlyPricing,"onUpdate:modelValue":[v[0]||(v[0]=u=>e.unref(i).showYearlyPricing=u),e.unref(i).changePricingScheme],"left-align":"",class:"ect-text-nowrap",text:{on:"Yearly Price",off:"Monthly Price"},"data-test-id":"configurator-switch-show-yearly-pricing"},null,8,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)]),_:1},8,["title","buttons"])]),e.createElementVNode("div",{class:e.normalizeClass(n.value?"ect-pb-16":"ect-pb-0")},[e.createVNode(b1,{config:o.value,"edit-attributes":n.value,scroll:r.value,onEditAttributes:v[1]||(v[1]=u=>n.value=!0)},null,8,["config","edit-attributes","scroll"])],2)]),n.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",uf,[e.createVNode(s1)]))],64))])):e.createCommentVNode("",!0)}},[["__scopeId","data-v-52095abb"]]),hf=["data-item-id","data-qli-id"],pf={key:0,class:"ect-flex-1 ect-min-h-0"},mf={key:1,class:"ect-flex-1 ect-min-h-0"},gf={__name:"Configurator",props:{itemId:{type:String,required:!0},qliId:{type:String,required:!1}},setup(t){Kn();const i=t,n=e.ref(!0),r=at();return e.onBeforeMount(async()=>{n.value=!0,console.time("CONFIGURATOR ON BEFORE MOUNT"),console.timeLog("CONFIGURATOR ON BEFORE MOUNT","1"),await r.initConfigurator(i.itemId,i.qliId),console.timeLog("CONFIGURATOR ON BEFORE MOUNT","2"),console.timeEnd("CONFIGURATOR ON BEFORE MOUNT"),n.value=!1}),(o,a)=>(e.openBlock(),e.createElementBlock("div",{class:"ect-h-full ect-flex ect-flex-col","data-item-id":t.itemId,"data-qli-id":t.qliId},[n.value?(e.openBlock(),e.createElementBlock("div",mf,[e.createVNode(so)])):(e.openBlock(),e.createElementBlock("div",pf,[e.createVNode(ff)]))],8,hf))}};function Lo(t,i){return function(){return t.apply(i,arguments)}}const{toString:yf}=Object.prototype,{getPrototypeOf:rr}=Object,{iterator:yn,toStringTag:Mo}=Symbol,bn=(t=>i=>{const n=yf.call(i);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Xe=t=>(t=t.toLowerCase(),i=>bn(i)===t),_n=t=>i=>typeof i===t,{isArray:Nt}=Array,xt=_n("undefined");function jt(t){return t!==null&&!xt(t)&&t.constructor!==null&&!xt(t.constructor)&&je(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Ro=Xe("ArrayBuffer");function bf(t){let i;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?i=ArrayBuffer.isView(t):i=t&&t.buffer&&Ro(t.buffer),i}const _f=_n("string"),je=_n("function"),Po=_n("number"),$t=t=>t!==null&&typeof t=="object",vf=t=>t===!0||t===!1,vn=t=>{if(bn(t)!=="object")return!1;const i=rr(t);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(Mo in t)&&!(yn in t)},Cf=t=>{if(!$t(t)||jt(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},Ef=Xe("Date"),kf=Xe("File"),wf=Xe("Blob"),Nf=Xe("FileList"),xf=t=>$t(t)&&je(t.pipe),Of=t=>{let i;return t&&(typeof FormData=="function"&&t instanceof FormData||je(t.append)&&((i=bn(t))==="formdata"||i==="object"&&je(t.toString)&&t.toString()==="[object FormData]"))},Sf=Xe("URLSearchParams"),[Vf,Tf,Af,If]=["ReadableStream","Request","Response","Headers"].map(Xe),Bf=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ft(t,i,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,o;if(typeof t!="object"&&(t=[t]),Nt(t))for(r=0,o=t.length;r<o;r++)i.call(null,t[r],r,t);else{if(jt(t))return;const a=n?Object.getOwnPropertyNames(t):Object.keys(t),c=a.length;let b;for(r=0;r<c;r++)b=a[r],i.call(null,t[b],b,t)}}function qo(t,i){if(jt(t))return null;i=i.toLowerCase();const n=Object.keys(t);let r=n.length,o;for(;r-- >0;)if(o=n[r],i===o.toLowerCase())return o;return null}const mt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Do=t=>!xt(t)&&t!==mt;function or(){const{caseless:t,skipUndefined:i}=Do(this)&&this||{},n={},r=(o,a)=>{const c=t&&qo(n,a)||a;vn(n[c])&&vn(o)?n[c]=or(n[c],o):vn(o)?n[c]=or({},o):Nt(o)?n[c]=o.slice():(!i||!xt(o))&&(n[c]=o)};for(let o=0,a=arguments.length;o<a;o++)arguments[o]&&Ft(arguments[o],r);return n}const Lf=(t,i,n,{allOwnKeys:r}={})=>(Ft(i,(o,a)=>{n&&je(o)?t[a]=Lo(o,n):t[a]=o},{allOwnKeys:r}),t),Mf=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Rf=(t,i,n,r)=>{t.prototype=Object.create(i.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:i.prototype}),n&&Object.assign(t.prototype,n)},Pf=(t,i,n,r)=>{let o,a,c;const b={};if(i=i||{},t==null)return i;do{for(o=Object.getOwnPropertyNames(t),a=o.length;a-- >0;)c=o[a],(!r||r(c,t,i))&&!b[c]&&(i[c]=t[c],b[c]=!0);t=n!==!1&&rr(t)}while(t&&(!n||n(t,i))&&t!==Object.prototype);return i},qf=(t,i,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=i.length;const r=t.indexOf(i,n);return r!==-1&&r===n},Df=t=>{if(!t)return null;if(Nt(t))return t;let i=t.length;if(!Po(i))return null;const n=new Array(i);for(;i-- >0;)n[i]=t[i];return n},jf=(t=>i=>t&&i instanceof t)(typeof Uint8Array<"u"&&rr(Uint8Array)),$f=(t,i)=>{const r=(t&&t[yn]).call(t);let o;for(;(o=r.next())&&!o.done;){const a=o.value;i.call(t,a[0],a[1])}},Ff=(t,i)=>{let n;const r=[];for(;(n=t.exec(i))!==null;)r.push(n);return r},Hf=Xe("HTMLFormElement"),Uf=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),jo=(({hasOwnProperty:t})=>(i,n)=>t.call(i,n))(Object.prototype),zf=Xe("RegExp"),$o=(t,i)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Ft(n,(o,a)=>{let c;(c=i(o,a,t))!==!1&&(r[a]=c||o)}),Object.defineProperties(t,r)},Kf=t=>{$o(t,(i,n)=>{if(je(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(je(r)){if(i.enumerable=!1,"writable"in i){i.writable=!1;return}i.set||(i.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Zf=(t,i)=>{const n={},r=o=>{o.forEach(a=>{n[a]=!0})};return Nt(t)?r(t):r(String(t).split(i)),n},Qf=()=>{},Xf=(t,i)=>t!=null&&Number.isFinite(t=+t)?t:i;function Jf(t){return!!(t&&je(t.append)&&t[Mo]==="FormData"&&t[yn])}const Gf=t=>{const i=new Array(10),n=(r,o)=>{if($t(r)){if(i.indexOf(r)>=0)return;if(jt(r))return r;if(!("toJSON"in r)){i[o]=r;const a=Nt(r)?[]:{};return Ft(r,(c,b)=>{const h=n(c,o+1);!xt(h)&&(a[b]=h)}),i[o]=void 0,a}}return r};return n(t,0)},Wf=Xe("AsyncFunction"),Yf=t=>t&&($t(t)||je(t))&&je(t.then)&&je(t.catch),Fo=((t,i)=>t?setImmediate:i?((n,r)=>(mt.addEventListener("message",({source:o,data:a})=>{o===mt&&a===n&&r.length&&r.shift()()},!1),o=>{r.push(o),mt.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",je(mt.postMessage)),e0=typeof queueMicrotask<"u"?queueMicrotask.bind(mt):typeof process<"u"&&process.nextTick||Fo,W={isArray:Nt,isArrayBuffer:Ro,isBuffer:jt,isFormData:Of,isArrayBufferView:bf,isString:_f,isNumber:Po,isBoolean:vf,isObject:$t,isPlainObject:vn,isEmptyObject:Cf,isReadableStream:Vf,isRequest:Tf,isResponse:Af,isHeaders:If,isUndefined:xt,isDate:Ef,isFile:kf,isBlob:wf,isRegExp:zf,isFunction:je,isStream:xf,isURLSearchParams:Sf,isTypedArray:jf,isFileList:Nf,forEach:Ft,merge:or,extend:Lf,trim:Bf,stripBOM:Mf,inherits:Rf,toFlatObject:Pf,kindOf:bn,kindOfTest:Xe,endsWith:qf,toArray:Df,forEachEntry:$f,matchAll:Ff,isHTMLForm:Hf,hasOwnProperty:jo,hasOwnProp:jo,reduceDescriptors:$o,freezeMethods:Kf,toObjectSet:Zf,toCamelCase:Uf,noop:Qf,toFiniteNumber:Xf,findKey:qo,global:mt,isContextDefined:Do,isSpecCompliantForm:Jf,toJSONObject:Gf,isAsyncFn:Wf,isThenable:Yf,setImmediate:Fo,asap:e0,isIterable:t=>t!=null&&je(t[yn])};function me(t,i,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",i&&(this.code=i),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}W.inherits(me,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:W.toJSONObject(this.config),code:this.code,status:this.status}}});const Ho=me.prototype,Uo={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Uo[t]={value:t}}),Object.defineProperties(me,Uo),Object.defineProperty(Ho,"isAxiosError",{value:!0}),me.from=(t,i,n,r,o,a)=>{const c=Object.create(Ho);W.toFlatObject(t,c,function(u){return u!==Error.prototype},v=>v!=="isAxiosError");const b=t&&t.message?t.message:"Error",h=i==null&&t?t.code:i;return me.call(c,b,h,n,r,o),t&&c.cause==null&&Object.defineProperty(c,"cause",{value:t,configurable:!0}),c.name=t&&t.name||"Error",a&&Object.assign(c,a),c};const t0=null;function ir(t){return W.isPlainObject(t)||W.isArray(t)}function zo(t){return W.endsWith(t,"[]")?t.slice(0,-2):t}function Ko(t,i,n){return t?t.concat(i).map(function(o,a){return o=zo(o),!n&&a?"["+o+"]":o}).join(n?".":""):i}function n0(t){return W.isArray(t)&&!t.some(ir)}const r0=W.toFlatObject(W,{},null,function(i){return/^is[A-Z]/.test(i)});function Cn(t,i,n){if(!W.isObject(t))throw new TypeError("target must be an object");i=i||new FormData,n=W.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,l){return!W.isUndefined(l[f])});const r=n.metaTokens,o=n.visitor||u,a=n.dots,c=n.indexes,h=(n.Blob||typeof Blob<"u"&&Blob)&&W.isSpecCompliantForm(i);if(!W.isFunction(o))throw new TypeError("visitor must be a function");function v(d){if(d===null)return"";if(W.isDate(d))return d.toISOString();if(W.isBoolean(d))return d.toString();if(!h&&W.isBlob(d))throw new me("Blob is not supported. Use a Buffer instead.");return W.isArrayBuffer(d)||W.isTypedArray(d)?h&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function u(d,f,l){let p=d;if(d&&!l&&typeof d=="object"){if(W.endsWith(f,"{}"))f=r?f:f.slice(0,-2),d=JSON.stringify(d);else if(W.isArray(d)&&n0(d)||(W.isFileList(d)||W.endsWith(f,"[]"))&&(p=W.toArray(d)))return f=zo(f),p.forEach(function(C,y){!(W.isUndefined(C)||C===null)&&i.append(c===!0?Ko([f],y,a):c===null?f:f+"[]",v(C))}),!1}return ir(d)?!0:(i.append(Ko(l,f,a),v(d)),!1)}const g=[],s=Object.assign(r0,{defaultVisitor:u,convertValue:v,isVisitable:ir});function m(d,f){if(!W.isUndefined(d)){if(g.indexOf(d)!==-1)throw Error("Circular reference detected in "+f.join("."));g.push(d),W.forEach(d,function(p,_){(!(W.isUndefined(p)||p===null)&&o.call(i,p,W.isString(_)?_.trim():_,f,s))===!0&&m(p,f?f.concat(_):[_])}),g.pop()}}if(!W.isObject(t))throw new TypeError("data must be an object");return m(t),i}function Zo(t){const i={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return i[r]})}function ar(t,i){this._pairs=[],t&&Cn(t,this,i)}const Qo=ar.prototype;Qo.append=function(i,n){this._pairs.push([i,n])},Qo.toString=function(i){const n=i?function(r){return i.call(this,r,Zo)}:Zo;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function o0(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Xo(t,i,n){if(!i)return t;const r=n&&n.encode||o0;W.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let a;if(o?a=o(i,n):a=W.isURLSearchParams(i)?i.toString():new ar(i,n).toString(r),a){const c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+a}return t}class Jo{constructor(){this.handlers=[]}use(i,n,r){return this.handlers.push({fulfilled:i,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(i){this.handlers[i]&&(this.handlers[i]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(i){W.forEach(this.handlers,function(r){r!==null&&i(r)})}}const Go={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},i0={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:ar,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},lr=typeof window<"u"&&typeof document<"u",sr=typeof navigator=="object"&&navigator||void 0,a0=lr&&(!sr||["ReactNative","NativeScript","NS"].indexOf(sr.product)<0),l0=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",s0=lr&&window.location.href||"http://localhost",Ie={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:lr,hasStandardBrowserEnv:a0,hasStandardBrowserWebWorkerEnv:l0,navigator:sr,origin:s0},Symbol.toStringTag,{value:"Module"})),...i0};function c0(t,i){return Cn(t,new Ie.classes.URLSearchParams,{visitor:function(n,r,o,a){return Ie.isNode&&W.isBuffer(n)?(this.append(r,n.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...i})}function d0(t){return W.matchAll(/\w+|\[(\w*)]/g,t).map(i=>i[0]==="[]"?"":i[1]||i[0])}function u0(t){const i={},n=Object.keys(t);let r;const o=n.length;let a;for(r=0;r<o;r++)a=n[r],i[a]=t[a];return i}function Wo(t){function i(n,r,o,a){let c=n[a++];if(c==="__proto__")return!0;const b=Number.isFinite(+c),h=a>=n.length;return c=!c&&W.isArray(o)?o.length:c,h?(W.hasOwnProp(o,c)?o[c]=[o[c],r]:o[c]=r,!b):((!o[c]||!W.isObject(o[c]))&&(o[c]=[]),i(n,r,o[c],a)&&W.isArray(o[c])&&(o[c]=u0(o[c])),!b)}if(W.isFormData(t)&&W.isFunction(t.entries)){const n={};return W.forEachEntry(t,(r,o)=>{i(d0(r),o,n,0)}),n}return null}function f0(t,i,n){if(W.isString(t))try{return(i||JSON.parse)(t),W.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const cr={transitional:Go,adapter:["xhr","http","fetch"],transformRequest:[function(i,n){const r=n.getContentType()||"",o=r.indexOf("application/json")>-1,a=W.isObject(i);if(a&&W.isHTMLForm(i)&&(i=new FormData(i)),W.isFormData(i))return o?JSON.stringify(Wo(i)):i;if(W.isArrayBuffer(i)||W.isBuffer(i)||W.isStream(i)||W.isFile(i)||W.isBlob(i)||W.isReadableStream(i))return i;if(W.isArrayBufferView(i))return i.buffer;if(W.isURLSearchParams(i))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),i.toString();let b;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return c0(i,this.formSerializer).toString();if((b=W.isFileList(i))||r.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return Cn(b?{"files[]":i}:i,h&&new h,this.formSerializer)}}return a||o?(n.setContentType("application/json",!1),f0(i)):i}],transformResponse:[function(i){const n=this.transitional||cr.transitional,r=n&&n.forcedJSONParsing,o=this.responseType==="json";if(W.isResponse(i)||W.isReadableStream(i))return i;if(i&&W.isString(i)&&(r&&!this.responseType||o)){const c=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(i,this.parseReviver)}catch(b){if(c)throw b.name==="SyntaxError"?me.from(b,me.ERR_BAD_RESPONSE,this,null,this.response):b}}return i}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ie.classes.FormData,Blob:Ie.classes.Blob},validateStatus:function(i){return i>=200&&i<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};W.forEach(["delete","get","head","post","put","patch"],t=>{cr.headers[t]={}});const dr=cr,h0=W.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),p0=t=>{const i={};let n,r,o;return t&&t.split(`
|
|
59
59
|
`).forEach(function(c){o=c.indexOf(":"),n=c.substring(0,o).trim().toLowerCase(),r=c.substring(o+1).trim(),!(!n||i[n]&&h0[n])&&(n==="set-cookie"?i[n]?i[n].push(r):i[n]=[r]:i[n]=i[n]?i[n]+", "+r:r)}),i},Yo=Symbol("internals");function Ht(t){return t&&String(t).trim().toLowerCase()}function En(t){return t===!1||t==null?t:W.isArray(t)?t.map(En):String(t)}function m0(t){const i=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)i[r[1]]=r[2];return i}const g0=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function ur(t,i,n,r,o){if(W.isFunction(r))return r.call(this,i,n);if(o&&(i=n),!!W.isString(i)){if(W.isString(r))return i.indexOf(r)!==-1;if(W.isRegExp(r))return r.test(i)}}function y0(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(i,n,r)=>n.toUpperCase()+r)}function b0(t,i){const n=W.toCamelCase(" "+i);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(o,a,c){return this[r].call(this,i,o,a,c)},configurable:!0})})}class kn{constructor(i){i&&this.set(i)}set(i,n,r){const o=this;function a(b,h,v){const u=Ht(h);if(!u)throw new Error("header name must be a non-empty string");const g=W.findKey(o,u);(!g||o[g]===void 0||v===!0||v===void 0&&o[g]!==!1)&&(o[g||h]=En(b))}const c=(b,h)=>W.forEach(b,(v,u)=>a(v,u,h));if(W.isPlainObject(i)||i instanceof this.constructor)c(i,n);else if(W.isString(i)&&(i=i.trim())&&!g0(i))c(p0(i),n);else if(W.isObject(i)&&W.isIterable(i)){let b={},h,v;for(const u of i){if(!W.isArray(u))throw TypeError("Object iterator must return a key-value pair");b[v=u[0]]=(h=b[v])?W.isArray(h)?[...h,u[1]]:[h,u[1]]:u[1]}c(b,n)}else i!=null&&a(n,i,r);return this}get(i,n){if(i=Ht(i),i){const r=W.findKey(this,i);if(r){const o=this[r];if(!n)return o;if(n===!0)return m0(o);if(W.isFunction(n))return n.call(this,o,r);if(W.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(i,n){if(i=Ht(i),i){const r=W.findKey(this,i);return!!(r&&this[r]!==void 0&&(!n||ur(this,this[r],r,n)))}return!1}delete(i,n){const r=this;let o=!1;function a(c){if(c=Ht(c),c){const b=W.findKey(r,c);b&&(!n||ur(r,r[b],b,n))&&(delete r[b],o=!0)}}return W.isArray(i)?i.forEach(a):a(i),o}clear(i){const n=Object.keys(this);let r=n.length,o=!1;for(;r--;){const a=n[r];(!i||ur(this,this[a],a,i,!0))&&(delete this[a],o=!0)}return o}normalize(i){const n=this,r={};return W.forEach(this,(o,a)=>{const c=W.findKey(r,a);if(c){n[c]=En(o),delete n[a];return}const b=i?y0(a):String(a).trim();b!==a&&delete n[a],n[b]=En(o),r[b]=!0}),this}concat(...i){return this.constructor.concat(this,...i)}toJSON(i){const n=Object.create(null);return W.forEach(this,(r,o)=>{r!=null&&r!==!1&&(n[o]=i&&W.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([i,n])=>i+": "+n).join(`
|
|
60
60
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(i){return i instanceof this?i:new this(i)}static concat(i,...n){const r=new this(i);return n.forEach(o=>r.set(o)),r}static accessor(i){const r=(this[Yo]=this[Yo]={accessors:{}}).accessors,o=this.prototype;function a(c){const b=Ht(c);r[b]||(b0(o,c),r[b]=!0)}return W.isArray(i)?i.forEach(a):a(i),this}}kn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),W.reduceDescriptors(kn.prototype,({value:t},i)=>{let n=i[0].toUpperCase()+i.slice(1);return{get:()=>t,set(r){this[n]=r}}}),W.freezeMethods(kn);const Je=kn;function fr(t,i){const n=this||dr,r=i||n,o=Je.from(r.headers);let a=r.data;return W.forEach(t,function(b){a=b.call(n,a,o.normalize(),i?i.status:void 0)}),o.normalize(),a}function ei(t){return!!(t&&t.__CANCEL__)}function Ot(t,i,n){me.call(this,t??"canceled",me.ERR_CANCELED,i,n),this.name="CanceledError"}W.inherits(Ot,me,{__CANCEL__:!0});function ti(t,i,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):i(new me("Request failed with status code "+n.status,[me.ERR_BAD_REQUEST,me.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function _0(t){const i=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return i&&i[1]||""}function v0(t,i){t=t||10;const n=new Array(t),r=new Array(t);let o=0,a=0,c;return i=i!==void 0?i:1e3,function(h){const v=Date.now(),u=r[a];c||(c=v),n[o]=h,r[o]=v;let g=a,s=0;for(;g!==o;)s+=n[g++],g=g%t;if(o=(o+1)%t,o===a&&(a=(a+1)%t),v-c<i)return;const m=u&&v-u;return m?Math.round(s*1e3/m):void 0}}function C0(t,i){let n=0,r=1e3/i,o,a;const c=(v,u=Date.now())=>{n=u,o=null,a&&(clearTimeout(a),a=null),t(...v)};return[(...v)=>{const u=Date.now(),g=u-n;g>=r?c(v,u):(o=v,a||(a=setTimeout(()=>{a=null,c(o)},r-g)))},()=>o&&c(o)]}const wn=(t,i,n=3)=>{let r=0;const o=v0(50,250);return C0(a=>{const c=a.loaded,b=a.lengthComputable?a.total:void 0,h=c-r,v=o(h),u=c<=b;r=c;const g={loaded:c,total:b,progress:b?c/b:void 0,bytes:h,rate:v||void 0,estimated:v&&b&&u?(b-c)/v:void 0,event:a,lengthComputable:b!=null,[i?"download":"upload"]:!0};t(g)},n)},ni=(t,i)=>{const n=t!=null;return[r=>i[0]({lengthComputable:n,total:t,loaded:r}),i[1]]},ri=t=>(...i)=>W.asap(()=>t(...i)),E0=Ie.hasStandardBrowserEnv?((t,i)=>n=>(n=new URL(n,Ie.origin),t.protocol===n.protocol&&t.host===n.host&&(i||t.port===n.port)))(new URL(Ie.origin),Ie.navigator&&/(msie|trident)/i.test(Ie.navigator.userAgent)):()=>!0,k0=Ie.hasStandardBrowserEnv?{write(t,i,n,r,o,a,c){if(typeof document>"u")return;const b=[`${t}=${encodeURIComponent(i)}`];W.isNumber(n)&&b.push(`expires=${new Date(n).toUTCString()}`),W.isString(r)&&b.push(`path=${r}`),W.isString(o)&&b.push(`domain=${o}`),a===!0&&b.push("secure"),W.isString(c)&&b.push(`SameSite=${c}`),document.cookie=b.join("; ")},read(t){if(typeof document>"u")return null;const i=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return i?decodeURIComponent(i[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function w0(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function N0(t,i){return i?t.replace(/\/?\/$/,"")+"/"+i.replace(/^\/+/,""):t}function oi(t,i,n){let r=!w0(i);return t&&(r||n==!1)?N0(t,i):i}const ii=t=>t instanceof Je?{...t}:t;function gt(t,i){i=i||{};const n={};function r(v,u,g,s){return W.isPlainObject(v)&&W.isPlainObject(u)?W.merge.call({caseless:s},v,u):W.isPlainObject(u)?W.merge({},u):W.isArray(u)?u.slice():u}function o(v,u,g,s){if(W.isUndefined(u)){if(!W.isUndefined(v))return r(void 0,v,g,s)}else return r(v,u,g,s)}function a(v,u){if(!W.isUndefined(u))return r(void 0,u)}function c(v,u){if(W.isUndefined(u)){if(!W.isUndefined(v))return r(void 0,v)}else return r(void 0,u)}function b(v,u,g){if(g in i)return r(v,u);if(g in t)return r(void 0,v)}const h={url:a,method:a,data:a,baseURL:c,transformRequest:c,transformResponse:c,paramsSerializer:c,timeout:c,timeoutMessage:c,withCredentials:c,withXSRFToken:c,adapter:c,responseType:c,xsrfCookieName:c,xsrfHeaderName:c,onUploadProgress:c,onDownloadProgress:c,decompress:c,maxContentLength:c,maxBodyLength:c,beforeRedirect:c,transport:c,httpAgent:c,httpsAgent:c,cancelToken:c,socketPath:c,responseEncoding:c,validateStatus:b,headers:(v,u,g)=>o(ii(v),ii(u),g,!0)};return W.forEach(Object.keys({...t,...i}),function(u){const g=h[u]||o,s=g(t[u],i[u],u);W.isUndefined(s)&&g!==b||(n[u]=s)}),n}const ai=t=>{const i=gt({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:a,headers:c,auth:b}=i;if(i.headers=c=Je.from(c),i.url=Xo(oi(i.baseURL,i.url,i.allowAbsoluteUrls),t.params,t.paramsSerializer),b&&c.set("Authorization","Basic "+btoa((b.username||"")+":"+(b.password?unescape(encodeURIComponent(b.password)):""))),W.isFormData(n)){if(Ie.hasStandardBrowserEnv||Ie.hasStandardBrowserWebWorkerEnv)c.setContentType(void 0);else if(W.isFunction(n.getHeaders)){const h=n.getHeaders(),v=["content-type","content-length"];Object.entries(h).forEach(([u,g])=>{v.includes(u.toLowerCase())&&c.set(u,g)})}}if(Ie.hasStandardBrowserEnv&&(r&&W.isFunction(r)&&(r=r(i)),r||r!==!1&&E0(i.url))){const h=o&&a&&k0.read(a);h&&c.set(o,h)}return i},x0=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,r){const o=ai(t);let a=o.data;const c=Je.from(o.headers).normalize();let{responseType:b,onUploadProgress:h,onDownloadProgress:v}=o,u,g,s,m,d;function f(){m&&m(),d&&d(),o.cancelToken&&o.cancelToken.unsubscribe(u),o.signal&&o.signal.removeEventListener("abort",u)}let l=new XMLHttpRequest;l.open(o.method.toUpperCase(),o.url,!0),l.timeout=o.timeout;function p(){if(!l)return;const C=Je.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),E={data:!b||b==="text"||b==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:C,config:t,request:l};ti(function(S){n(S),f()},function(S){r(S),f()},E),l=null}"onloadend"in l?l.onloadend=p:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(p)},l.onabort=function(){l&&(r(new me("Request aborted",me.ECONNABORTED,t,l)),l=null)},l.onerror=function(y){const E=y&&y.message?y.message:"Network Error",A=new me(E,me.ERR_NETWORK,t,l);A.event=y||null,r(A),l=null},l.ontimeout=function(){let y=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const E=o.transitional||Go;o.timeoutErrorMessage&&(y=o.timeoutErrorMessage),r(new me(y,E.clarifyTimeoutError?me.ETIMEDOUT:me.ECONNABORTED,t,l)),l=null},a===void 0&&c.setContentType(null),"setRequestHeader"in l&&W.forEach(c.toJSON(),function(y,E){l.setRequestHeader(E,y)}),W.isUndefined(o.withCredentials)||(l.withCredentials=!!o.withCredentials),b&&b!=="json"&&(l.responseType=o.responseType),v&&([s,d]=wn(v,!0),l.addEventListener("progress",s)),h&&l.upload&&([g,m]=wn(h),l.upload.addEventListener("progress",g),l.upload.addEventListener("loadend",m)),(o.cancelToken||o.signal)&&(u=C=>{l&&(r(!C||C.type?new Ot(null,t,l):C),l.abort(),l=null)},o.cancelToken&&o.cancelToken.subscribe(u),o.signal&&(o.signal.aborted?u():o.signal.addEventListener("abort",u)));const _=_0(o.url);if(_&&Ie.protocols.indexOf(_)===-1){r(new me("Unsupported protocol "+_+":",me.ERR_BAD_REQUEST,t));return}l.send(a||null)})},O0=(t,i)=>{const{length:n}=t=t?t.filter(Boolean):[];if(i||n){let r=new AbortController,o;const a=function(v){if(!o){o=!0,b();const u=v instanceof Error?v:this.reason;r.abort(u instanceof me?u:new Ot(u instanceof Error?u.message:u))}};let c=i&&setTimeout(()=>{c=null,a(new me(`timeout ${i} of ms exceeded`,me.ETIMEDOUT))},i);const b=()=>{t&&(c&&clearTimeout(c),c=null,t.forEach(v=>{v.unsubscribe?v.unsubscribe(a):v.removeEventListener("abort",a)}),t=null)};t.forEach(v=>v.addEventListener("abort",a));const{signal:h}=r;return h.unsubscribe=()=>W.asap(b),h}},S0=function*(t,i){let n=t.byteLength;if(!i||n<i){yield t;return}let r=0,o;for(;r<n;)o=r+i,yield t.slice(r,o),r=o},V0=async function*(t,i){for await(const n of T0(t))yield*S0(n,i)},T0=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const i=t.getReader();try{for(;;){const{done:n,value:r}=await i.read();if(n)break;yield r}}finally{await i.cancel()}},li=(t,i,n,r)=>{const o=V0(t,i);let a=0,c,b=h=>{c||(c=!0,r&&r(h))};return new ReadableStream({async pull(h){try{const{done:v,value:u}=await o.next();if(v){b(),h.close();return}let g=u.byteLength;if(n){let s=a+=g;n(s)}h.enqueue(new Uint8Array(u))}catch(v){throw b(v),v}},cancel(h){return b(h),o.return()}},{highWaterMark:2})},si=64*1024,{isFunction:Nn}=W,A0=(({Request:t,Response:i})=>({Request:t,Response:i}))(W.global),{ReadableStream:ci,TextEncoder:di}=W.global,ui=(t,...i)=>{try{return!!t(...i)}catch{return!1}},I0=t=>{t=W.merge.call({skipUndefined:!0},A0,t);const{fetch:i,Request:n,Response:r}=t,o=i?Nn(i):typeof fetch=="function",a=Nn(n),c=Nn(r);if(!o)return!1;const b=o&&Nn(ci),h=o&&(typeof di=="function"?(d=>f=>d.encode(f))(new di):async d=>new Uint8Array(await new n(d).arrayBuffer())),v=a&&b&&ui(()=>{let d=!1;const f=new n(Ie.origin,{body:new ci,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!f}),u=c&&b&&ui(()=>W.isReadableStream(new r("").body)),g={stream:u&&(d=>d.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!g[d]&&(g[d]=(f,l)=>{let p=f&&f[d];if(p)return p.call(f);throw new me(`Response type '${d}' is not supported`,me.ERR_NOT_SUPPORT,l)})});const s=async d=>{if(d==null)return 0;if(W.isBlob(d))return d.size;if(W.isSpecCompliantForm(d))return(await new n(Ie.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(W.isArrayBufferView(d)||W.isArrayBuffer(d))return d.byteLength;if(W.isURLSearchParams(d)&&(d=d+""),W.isString(d))return(await h(d)).byteLength},m=async(d,f)=>{const l=W.toFiniteNumber(d.getContentLength());return l??s(f)};return async d=>{let{url:f,method:l,data:p,signal:_,cancelToken:C,timeout:y,onDownloadProgress:E,onUploadProgress:A,responseType:S,headers:T,withCredentials:B="same-origin",fetchOptions:V}=ai(d),w=i||fetch;S=S?(S+"").toLowerCase():"text";let N=O0([_,C&&C.toAbortSignal()],y),M=null;const $=N&&N.unsubscribe&&(()=>{N.unsubscribe()});let U;try{if(A&&v&&l!=="get"&&l!=="head"&&(U=await m(T,p))!==0){let x=new n(f,{method:"POST",body:p,duplex:"half"}),L;if(W.isFormData(p)&&(L=x.headers.get("content-type"))&&T.setContentType(L),x.body){const[O,q]=ni(U,wn(ri(A)));p=li(x.body,si,O,q)}}W.isString(B)||(B=B?"include":"omit");const Q=a&&"credentials"in n.prototype,X={...V,signal:N,method:l.toUpperCase(),headers:T.normalize().toJSON(),body:p,duplex:"half",credentials:Q?B:void 0};M=a&&new n(f,X);let te=await(a?w(M,V):w(f,X));const Z=u&&(S==="stream"||S==="response");if(u&&(E||Z&&$)){const x={};["status","statusText","headers"].forEach(R=>{x[R]=te[R]});const L=W.toFiniteNumber(te.headers.get("content-length")),[O,q]=E&&ni(L,wn(ri(E),!0))||[];te=new r(li(te.body,si,O,()=>{q&&q(),$&&$()}),x)}S=S||"text";let P=await g[W.findKey(g,S)||"text"](te,d);return!Z&&$&&$(),await new Promise((x,L)=>{ti(x,L,{data:P,headers:Je.from(te.headers),status:te.status,statusText:te.statusText,config:d,request:M})})}catch(Q){throw $&&$(),Q&&Q.name==="TypeError"&&/Load failed|fetch/i.test(Q.message)?Object.assign(new me("Network Error",me.ERR_NETWORK,d,M),{cause:Q.cause||Q}):me.from(Q,Q&&Q.code,d,M)}}},B0=new Map,fi=t=>{let i=t&&t.env||{};const{fetch:n,Request:r,Response:o}=i,a=[r,o,n];let c=a.length,b=c,h,v,u=B0;for(;b--;)h=a[b],v=u.get(h),v===void 0&&u.set(h,v=b?new Map:I0(i)),u=v;return v};fi();const hr={http:t0,xhr:x0,fetch:{get:fi}};W.forEach(hr,(t,i)=>{if(t){try{Object.defineProperty(t,"name",{value:i})}catch{}Object.defineProperty(t,"adapterName",{value:i})}});const hi=t=>`- ${t}`,L0=t=>W.isFunction(t)||t===null||t===!1;function M0(t,i){t=W.isArray(t)?t:[t];const{length:n}=t;let r,o;const a={};for(let c=0;c<n;c++){r=t[c];let b;if(o=r,!L0(r)&&(o=hr[(b=String(r)).toLowerCase()],o===void 0))throw new me(`Unknown adapter '${b}'`);if(o&&(W.isFunction(o)||(o=o.get(i))))break;a[b||"#"+c]=o}if(!o){const c=Object.entries(a).map(([h,v])=>`adapter ${h} `+(v===!1?"is not supported by the environment":"is not available in the build"));let b=n?c.length>1?`since :
|
|
61
61
|
`+c.map(hi).join(`
|