1"use strict"; 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5f6c2193-14da-590a-8971-29ff5c62f1c0")}catch(e){}}(); 3(self.webpackChunkchatbot_builder=self.webpackChunkchatbot_builder||[]).push([[1002],{85214:(e,l,o)=>{o.d(l,{gF:()=>f,cG:()=>V,D2:()=>O,Pn:()=>_,SV:()=>m,_P:()=>T,Bm:()=>k,A9:()=>g,CC:()=>x,Jk:()=>N,fq:()=>$,tu:()=>P,eA:()=>U,NO:()=>C,Oh:()=>E});var t=o(18666),n=o(763),i=o(20480),a=o(53877),d=o(27368);const u=/\{\{[A-Za-z0-9 ]+\}\}/g;d.zQ.IMAGE,d.zQ.DOCUMENT,d.zQ.VIDEO,d.zQ.TEXT,d.zQ.NONE;var r=o(18530);const s=/^{{|\[\[|}}|\]\]$/g,v="editableVariable",p="customPlaceholderName",c=`((${p}))`,m=e=>({abandonedProductName:"cart.productName",abandonedProductDescription:"cart.productName",productNameAbandonedCart:"cart.productName",customerName:"customer.name",storeName:"store.name",storeHomePage:"store.url",abandonCartPage:"cart.cartUrl",latestOrderStatusPage:"order.status",latestProductAdded:"product.name",latestCollectionAdded:"catalog.name",refereeDiscountValue:"referral.discountValue",firstName:"customer.firstName",lastName:"customer.name",orderProductName:"order.productName",orderAllProductNames:"order.allProductNames",orderPartnersDataId:"order.partnersDataId",orderTotal:"order.total",orderUrl:"order.url",productName:"product.name",orderNumber:"order.orderNo",orderPaymentAmount:"order.paymentAmount",checkoutCheckoutUrl:"checkout.checkoutUrl",paymentLinkPaymentLink:"paymentLink.paymentLink",orderItemCount:"order.itemCount",productShipmentStatus:"product.shipmentStatus",productTrackingUrl:"product.trackingUrl",productTrackingNumber:"product.trackingNumber",productTrackingCompany:"product.trackingCompany","order.partnerOrderNo":"order.orderNo","order.firstProductName":"order.productName","cart.firstProductName":"cart.productName",widgetRewardCode:"widgetReward.code",widgetRewardDescription:"widgetReward.description","customer.name":"customer.name","order.partnerOrderName":"order.name"}[e]),b=(e,l)=>e.includes(v)&&!l.startsWith("{{")&&!l.endsWith("}}"),h=e=>e.startsWith("((")&&e.endsWith("))"),g=(e,l,o,n,a,d,u)=>{var r,v;const p={},c=(null===e||void 0===e?void 0:e.components)||"{}",g=!(null!==o&&void 0!==o&&null!==(r=o.message_template)&&void 0!==r&&r.approvedTemplateId)||!((null===o||void 0===o||null===(v=o.message_template)||void 0===v?void 0:v.approvedTemplateId)===e.templateId),f="Custom Url";return c.forEach((r=>{var v,c,x,_,C,E;switch(p.title=null===e||void 0===e?void 0:e.name,p.category=null===e||void 0===e?void 0:e.category,p.templateCategory=null===e||void 0===e?void 0:e.templateCategory,p.label=null===e||void 0===e?void 0:e.label,r.type){case"HEADER":let L=null===e||void 0===e||null===(v=e.mapping)||void 0===v?void 0:v.header;p.header=((e,l,o)=>{let t={},n=e.format;const i=n.charAt(0).toUpperCase()+n.slice(1).toLocaleLowerCase();if(!e.example&&"Text"!==i)return t;let a="";switch((l||[]).forEach(((l,o)=>{let t=l.replace(/^{{|}}$/g,""),n=m(t)||t;var i,d,u;b(n,l)?(n=`((${null!==(i=null===(d=e.example)||void 0===d||null===(u=d.header_text)||void 0===u?void 0:u[0])&&void 0!==i?i:""}))`,a=n):a=`{{${n}}}`})),i){case"Image":case"Video":t={type:i,videoOrImageOrdocumentUrl:a||(e.example?e.example.header_handle[0]:"")};break;case"Document":t={type:i,videoOrImageOrdocumentUrl:a||(e.example?e.example.header_handle[0]:""),fileName:o};break;case"Text":let n=e.text,d=[];(l||[]).forEach(((l,o)=>{let t=l.replace(/^{{|}}$/g,""),i=m(t)||t;var a,u,r;b(i,l)&&(i=`((${null!==(a=null===(u=e.example)||void 0===u||null===(r=u.header_text)||void 0===r?void 0:r[0])&&void 0!==a?a:""}))`),d.push(i),n=h(i)?n.replace(`{{${o+1}}}`,`${i.slice(2,-2)}`):n.replace(`{{${o+1}}}`,`{{${i}}}`)})),t={type:i,content:n,selectedFields:d}}return t})(r,L,u);break;case"BODY":const $=(null===e||void 0===e||null===(c=e.mapping)||void 0===c?void 0:c.body)||[],N=r.text,O=[];let k=N;$.forEach(((e,l)=>{let o=e.replace(s,""),t=m(o)||o;var n,i,a,d;b(t,e)&&(t=`((${null!==(n=null===(i=r.example)||void 0===i||null===(a=i.body_text)||void 0===a||null===(d=a[0])||void 0===d?void 0:d[l])&&void 0!==n?n:""}))`);O.push(t),k=h(t)?k.replace(`{{${l+1}}}`,`${t.slice(2,-2)}`):k.replace(`{{${l+1}}}`,`{{${t}}
3}`)})),p.body={content:k,selectedFields:O};break;case"BUTTONS":p.buttonsList=[];const{componentToMapping:V,mappingToComponent:U}=y(r.buttons,null!==(x=null===(_=e.mapping)||void 0===_?void 0:_.buttons)&&void 0!==x?x:[]);r.buttons.forEach(((u,r)=>{const s={reply:"QUICK_REPLY",url_action:"URL",dialer_action:"PHONE_NUMBER"};if(s[u.type]&&(u.type=s[u.type]),"URL"===u.type&&n){if(u.url&&u.url.length){var v,c,b,h;let d=null===e||void 0===e||null===(v=e.mapping)||void 0===v||null===(c=v.buttons)||void 0===c?void 0:c[V[r]],s="",x="";if(d&&d.length){var y;let e=d;e=e.replaceAll("[[",""),e=e.replaceAll("]]",""),e=e.replaceAll("((",""),e=e.replaceAll("))",""),e=e.replaceAll("{{",""),e=e.replaceAll("}}","");const l=null!==(y=m(e))&&void 0!==y&&y.length?m(e):e,o=t.aX.find((e=>e.placeHolder===`{{${l}}}`));o?(x=o.placeHolder,s=o.label):(s=f,x=u.example&&u.example.length?u.example[0]:"")}else s=f,x=u.example&&u.example.length?u.example[0]:"";p.buttonsList.push({buttonKey:g?`website-${(0,i.lY)()+(null!==a&&void 0!==a?a:0)+r}`:n?o.message_template.carousel[null!==a&&void 0!==a?a:0].buttonsList[r].buttonKey:o.message_template.buttonsList[r].buttonKey,buttonText:u.text,buttonId:s,ctaValue:null===(b=null!==(h=x)&&void 0!==h?h:"")||void 0===b?void 0:b.trim(),discount:l,type:"URL"})}}else if("URL"===u.type&&u.url&&u.url.length){var x,_,C,E,L,$,N;let s=null===e||void 0===e||null===(x=e.mapping)||void 0===x||null===(_=x.buttons)||void 0===_?void 0:_[V[r]],v="",c="";if(s&&s.length){var O;let e=s;e=e.replaceAll("[[",""),e=e.replaceAll("]]",""),e=e.replaceAll("((",""),e=e.replaceAll("))",""),e=e.replaceAll("{{",""),e=e.replaceAll("}}","");const l=null!==(O=m(e))&&void 0!==O&&O.length?m(e):e,o=t.aX.find((e=>e.placeHolder===`{{${l}}}`));o?(v=o.label,c=o.placeHolder):(v=f,c=u.example&&u.example.length?u.example[0]:"")}else v=f,c="Not editable";p.buttonsList.push({buttonKey:g?`website-${(0,i.lY)()+r}`:n?o.message_template.carousel[null!==a&&void 0!==a?a:0].buttonsList[r].buttonKey:o.message_template.buttonsList[r].buttonKey,buttonText:u.text,buttonId:v,value:null===(C=null!==(E=c)&&void 0!==E?E:"")||void 0===C?void 0:C.trim(),discount:l,type:"URL",queryParams:null!==(L=null===d||void 0===d||null===($=d.buttons)||void 0===$||null===(N=$[r])||void 0===N?void 0:N.queryParams)&&void 0!==L?L:[]})}var k;("PHONE_NUMBER"===u.type&&u.phone_number&&u.phone_number.length&&p.buttonsList.push({buttonKey:g?`phone-${(0,i.lY)()+r}`:n?o.message_template.carousel[null!==a&&void 0!==a?a:0].buttonsList[r].buttonKey:o.message_template.buttonsList[r].buttonKey,buttonText:u.text,buttonId:"+91",value:u.phone_number,type:"PHONE_NUMBER"}),"QUICK_REPLY"===u.type&&(g?p.buttonsList.push({buttonText:u.text,buttonKey:(0,i.lY)()+r+(null!==a&&void 0!==a?a:0),type:"QUICK_REPLY"}):p.buttonsList.push(n?{...o.message_template.carousel[null!==a&&void 0!==a?a:0].buttonsList[r]}:{...o.message_template.buttonsList[r]})),"COPY_CODE"===u.type)&&p.buttonsList.push({buttonKey:g?`copy_code-${(0,i.lY)()+r}`:n?o.message_template.carousel[null!==a&&void 0!==a?a:0].buttonsList[r].buttonKey:o.message_template.buttonsList[r].buttonKey,buttonText:u.text||"Copy Code",value:"string"===typeof u.example?u.example:null===(k=u.example)||void 0===k?void 0:k[0],type:"COPY_CODE"})}));break;case"FOOTER":p.footer=r.text;break;case"limited_time_offer":p.expiry=null!==(C=null===r||void 0===r||null===(E=r.example)||void 0===E?void 0:E.limited_time_offer)&&void 0!==C?C:""}})),p},y=(e,l)=>{const o={},t={};let n=0,i=0;for(;n<e.length&&i<l.length;)"URL"===e[n].type&&(o[n]=i,t[i]=n,i++),n++;return{componentToMapping:o,mappingToComponent:t}},f=(e,l,o)=>{var t;const i={};if(i.message_template={...e},i.type="Message",U(e.buttonsList)&&(i.backtrack={backtrackMessage:o,backtrackActive:o&&(null===o||void 0===o?void 0:o.length)>0}),i.approvedTemplateId=l.templateId,i.message_template.approvedTemplateId=l.templateId,i.type="message",null!==(t=i.message_template.buttonsList)&&void 0!==t&&t.length){var a,d;i.conditions=[{operator:"goto",operator_values:{}}];const e=(0,n.cloneDeep)(null===(a=i.conditions[0])||void 0===a?void 0:a.operator_values),l=Object.keys(e),o=null===(d=i.message_template.buttonsList)||void 0===d?void 0:d.map((e=>e.buttonKey)),t=l.filter((e=>!o.includes(e)));for(const n of t)delete e[n];i.conditions[0].operator_values={},i.message_template.buttonsList.forEach(((l,o)=>{"custom_url"!==l.buttonId&&(e[l.buttonKey]?e[l.buttonKey].key=l.buttonText:i.conditions[0].operator_values[l.buttonKey]={key:l.buttonText,value:""})}))}return(0,n.cloneDeep)(i)},x=(e,l)=>{var o;const t={...l},n=e.message_template.header;if(n){var i;if("Text"===n.type&&null!==(i=n.selectedFields)&&void 0!==i&&i.length){const e=n.selectedFields.map(((e,o)=>{var t,n,i;return(null!==(t=null===l||void 0===l||null===(n=l.mapping)||void 0===n||null===(i=n.header)||void 0===i?void 0:i[o])&&void 0!==t?t:"").includes(v)||h(e)?e:`{{${e}}}`}));t.mapping={...t.mapping,header:e}}
3["Image","Video","Document"].includes(n.type)&&n.videoOrImageOrdocumentUrl&&l.components.forEach(((e,l)=>{if("HEADER"===e.type){var o,i;const e=null===(o=t.components[l])||void 0===o||null===(i=o.example)||void 0===i?void 0:i.header_handle;e&&e.length>0&&(e[0]=n.videoOrImageOrdocumentUrl),t.components[l].format=n.type.toUpperCase()}}))}if(e.message_template.body&&e.message_template.body.selectedFields.length){const o=e.message_template.body.selectedFields.map(((e,o)=>{var t,n,i;return(null!==(t=null===l||void 0===l||null===(n=l.mapping)||void 0===n||null===(i=n.body)||void 0===i?void 0:i[o])&&void 0!==t?t:"").includes(v)||h(e)?e:`{{${e}}}`}));t.mapping={...t.mapping,body:[...o]}}var a;e.message_template.buttonsList&&e.message_template.buttonsList.length&&(null===(a=l.components)||void 0===a||a.forEach(((l,o)=>{if("BUTTONS"===l.type){const n=[];l.buttons.forEach(((l,i)=>{if("URL"===l.type){const l=t.components[o].buttons,a=e.message_template.buttonsList[i];l&&l.length&&(l[i].example=[null===a||void 0===a?void 0:a.value]),n.push(a)}if("COPY_CODE"===l.type){const l=t.components[o].buttons;var a;if(l&&l.length)l[i].example=[null===(a=e.message_template.buttonsList[i])||void 0===a?void 0:a.value]}})),n.forEach(((e,l)=>{var o;const n=null!==(o=t.mapping.buttons)&&void 0!==o?o:[];var i;null!==n&&void 0!==n&&n[l]&&(n[l]=null!==e&&void 0!==e&&null!==(i=e.value)&&void 0!==i&&i.startsWith("https://")?c:null===e||void 0===e?void 0:e.value);t.mapping={...t.mapping,buttons:n}}))}})));return null===(o=l.components)||void 0===o||o.forEach(((o,n)=>{if("limited_time_offer"===o.type){var i;const l=null===(i=t.components)||void 0===i?void 0:i[n];var a;if(l)l.example||(l.example={}),l.example.limited_time_offer=null!==(a=e.message_template.expiry)&&void 0!==a?a:(new Date).toISOString()}if("HEADER"===o.type){var d,u,r;const e=null!==(d=null===t||void 0===t||null===(u=t.mapping)||void 0===u||null===(r=u.header)||void 0===r?void 0:r[0])&&void 0!==d?d:"";var s,v,p;if(h(e))void 0!==(null===l||void 0===l||null===(s=l.components[n])||void 0===s||null===(v=s.example)||void 0===v||null===(p=v.header_text)||void 0===p?void 0:p[0])&&(l.components[n].example.header_text[0]=e.slice(2,-2))}if("BODY"===o.type){var c,m,b;(null!==(c=null===o||void 0===o||null===(m=o.example)||void 0===m||null===(b=m.body_text)||void 0===b?void 0:b[0])&&void 0!==c?c:[]).forEach(((e,o)=>{var i,a,d;const u=null!==(i=null===t||void 0===t||null===(a=t.mapping)||void 0===a||null===(d=a.body)||void 0===d?void 0:d[o])&&void 0!==i?i:"";var r,s,v;h(u)&&(void 0!==(null===l||void 0===l||null===(r=l.components[n])||void 0===r||null===(s=r.example)||void 0===s||null===(v=s.body_text)||void 0===v?void 0:v[0])&&(l.components[n].example.body_text[0][o]=u.slice(2,-2)))}))}})),t},_=(e,l)=>{var o;const t=(0,n.cloneDeep)(l);if(e.message_template.bubble&&e.message_template.bubble.selectedFields.length){const l=e.message_template.bubble.selectedFields.map((e=>e.includes(v)||h(e)?e:`{{${e}}}`));t.mapping={...t.mapping,body:[...l]}}var i;e.message_template.carousel&&e.message_template.carousel.length&&(null===(i=t.components[1].cards)||void 0===i||i.map(((l,o)=>{const i=e.message_template.carousel[o];return l.components.map(((e,l)=>{const a={...e};if("HEADER"===a.type){const e=i.imgMeta;if(e&&["Image","Video","Document"].includes(e.mediaType)&&e.mediaUrl){var d,u;let l=(0,n.cloneDeep)(null===(d=a.example)||void 0===d?void 0:d.header_handle);l&&(l=[e.mediaUrl]),a.example.header_handle=l,a.format=null===(u=e.mediaType)||void 0===u?void 0:u.toUpperCase()}}else if("BODY"===a.type){if(i.body&&i.body.selectedFields.length){var r;const e=i.body.selectedFields.map((e=>e.includes(v)||h(e)?e:`{{${e}}}`)),l=[...null!==(r=t.mapping.cards)&&void 0!==r?r:[]];l[o].body=e,t.mapping={...t.mapping,cards:l}}}else if("BUTTONS"===a.type&&i.buttonsList&&i.buttonsList.length){var s;const e=[];null===(s=a.buttons)||void 0===s||s.forEach(((l,o)=>{if("URL"===l.type){const t=i.buttonsList[o];l.example=[null===t||void 0===t?void 0:t.ctaValue],e.push(t)}return l})),e.forEach(((e,l)=>{var n,i;const a=[...null!==(n=t.mapping.cards)&&void 0!==n?n:[]],d=null!==(i=a[o].buttons)&&void 0!==i?i:[];var u;null!==d&&void 0!==d&&d[l]&&(d[l]=null!==e&&void 0!==e&&null!==(u=e.ctaValue)&&void 0!==u&&u.startsWith("https://")?c:null===e||void 0===e?void 0:e.ctaValue);a[o].buttons=d,t.mapping={...t.mapping,cards:a}}))}return a}))})));return null===(o=t.components)||void 0===o||o.forEach(((e,l)=>{if("BODY"===e.type){var o,n,i;const a=null===e||void 0===e||null===(o=e.example)||void 0===o||null===(n=o.body_text)||void 0===n?void 0:n[0];
3null===(i=null!==a&&void 0!==a?a:[])||void 0===i||i.forEach(((e,o)=>{var n,i,a;const d=null!==(n=null===t||void 0===t||null===(i=t.mapping)||void 0===i||null===(a=i.body)||void 0===a?void 0:a[o])&&void 0!==n?n:"";var u,r,s;h(d)&&(void 0!==(null===t||void 0===t||null===(u=t.components[l])||void 0===u||null===(r=u.example)||void 0===r||null===(s=r.body_text)||void 0===s?void 0:s[0])&&(t.components[l].example.body_text[0][o]=d.slice(2,-2)))}))}else if("CAROUSEL"===e.type){var a;null===(a=e.cards)||void 0===a||a.forEach(((e,o)=>{e.components.forEach(((e,n)=>{if("HEADER"===e.type){var i,a,d,u,r;const e=null!==(i=null===t||void 0===t||null===(a=t.mapping)||void 0===a||null===(d=a.cards)||void 0===d||null===(u=d[o])||void 0===u||null===(r=u.header)||void 0===r?void 0:r[n])&&void 0!==i?i:"";var s,v,p,c,m,b,g,y;if(h(e))void 0!==(null===t||void 0===t||null===(s=t.components)||void 0===s||null===(v=s[l])||void 0===v||null===(p=v.cards)||void 0===p||null===(c=p[o])||void 0===c||null===(m=c.components)||void 0===m||null===(b=m[n])||void 0===b||null===(g=b.example)||void 0===g||null===(y=g.header_text)||void 0===y?void 0:y[0])&&(t.components[l].cards[o].components[n].example.header_text[0]=e.slice(2,-2))}else if("BODY"===e.type){var f,x,_;(null!==(f=null===e||void 0===e||null===(x=e.example)||void 0===x||null===(_=x.body_text)||void 0===_?void 0:_[0])&&void 0!==f?f:[]).forEach(((e,i)=>{var a,d,u,r,s;const v=null!==(a=null===t||void 0===t||null===(d=t.mapping)||void 0===d||null===(u=d.cards)||void 0===u||null===(r=u[o])||void 0===r||null===(s=r.body)||void 0===s?void 0:s[i])&&void 0!==a?a:"";var p,c,m,b,g,y,f,x,_;h(v)&&(void 0!==(null===t||void 0===t||null===(p=t.components)||void 0===p||null===(c=p[l])||void 0===c||null===(m=c.cards)||void 0===m||null===(b=m[o])||void 0===b||null===(g=b.components)||void 0===g||null===(y=g[n])||void 0===y||null===(f=y.example)||void 0===f||null===(x=f.body_text)||void 0===x||null===(_=x[0])||void 0===_?void 0:_[i])&&(t.components[l].cards[o].components[n].example.body_text[0][i]=v.slice(2,-2)))}))}}))}))}})),t},C=e=>{const l=[];if(e.body.length>0){E(e)&&l.push(-1)}return e.cards.length>0&&e.cards.forEach(((e,o)=>{E(e)&&l.push(o)})),l},E=e=>{if(e.body.length>0||e.buttons.length>0){var l,o,t;const u=[],r={body:[],buttons:[]};var n,i;if((null===e||void 0===e||null===(l=e.header)||void 0===l?void 0:l.length)>0)null===(n=e.header)||void 0===n||n.forEach((e=>{var l;e.isEditableVariable?"link"!==e.type||(0,a.r)(e.updatedValue)?u.push(e.updatedValue):(u.push(""),r.body.push(null!==(l=e.index)&&void 0!==l?l:-1)):u.push(e.updatedValue)}));if((null===e||void 0===e||null===(o=e.body)||void 0===o?void 0:o.length)>0){var d;let l=!1;const o=null===(d=e.body)||void 0===d?void 0:d.filter((e=>null===e||void 0===e?void 0:e.isEditableVariable)).map((e=>(l||(l="link"===e.type&&!(0,a.r)(e.updatedValue)),e.updatedValue)));u.push(...o),l&&u.push("")}if((null===e||void 0===e||null===(t=e.buttons)||void 0===t?void 0:t.length)>0)null===(i=e.buttons)||void 0===i||i.forEach((e=>{if("URL"===e.type){var l,o,t;let v=!e.buttonVariable;var n;if(e.buttonVariable!==c||(0,a.r)(null!==(l=null===e||void 0===e||null===(o=e.example)||void 0===o?void 0:o[0])&&void 0!==l?l:"x")||(v=!0),v)u.push(""),r.buttons.push(null!==(n=e.index)&&void 0!==n?n:-1);const p=null!==(t=e.queryParams)&&void 0!==t?t:[];for(const l of p){var i,d;if(null===(i=l.key)||void 0===i||!i.trim()||null===(d=l.value)||void 0===d||!d.trim()){var s;u.push(""),r.buttons.push(null!==(s=e.index)&&void 0!==s?s:-1);break}}}var v,p,m,b,h;if("COPY_CODE"===e.type)if(e.buttonVariable){if((null===(v=e.buttonVariable)||void 0===v||!v.startsWith("{{")||null===(p=e.buttonVariable)||void 0===p||!p.endsWith("}}"))&&((null===e||void 0===e||null===(m=e.buttonVariable)||void 0===m?void 0:m.length)>15||(h=e.buttonVariable,!/^[a-zA-Z0-9]+$/.test(h)))){var g;u.push(""),r.buttons.push(null!==(g=e.index)&&void 0!==g?g:-1)}}else u.push(""),r.buttons.push(null!==(b=e.index)&&void 0!==b?b:-1)}));if(!u.every((e=>!!e)))return{message:"Please enter values for the variable",errorIndexes:r}}},L=e=>{const l=e.replace(s,"");return["content.variable"].includes(l)},$=(e,l,o)=>{var t;const n={body:[],header:[],buttons:[]};return null===(t=e.components)||void 0===t||t.forEach(((t,i)=>{if("TEXT"===t.format){var a;const o=null===t||void 0===t||null===(a=t.text)||void 0===a?void 0:a.match(u);null===o||void 0===o||o.forEach(((o,i)=>{var a,d,u,r,p,c,m,b,h,g;const y=`{{${null===l||void 0===l||null===(a=l.mapping)||void 0===a||null===(d=a.header)||void 0===d?void 0:d[i].slice(2,-2)}}}`,f=y&&y.includes(v)||(null===(u=e.mapping.header)||void 0===u?void 0:u[i].includes(v))||(null===(r=e.mapping.header)||void 0===r||null===(p=r[i])||void 0===p||null===(c=p.replace(s,""))||void 0===c?void 0:c.startsWith("(("))&&(null===(m=e.mapping.header)||void 0===m||null===(b=m[i])||void 0===b||null===(h=b.replace(s,""))||void 0===h?void 0:h.endsWith("))"));var x,_,C,E,L,$;if(f){if(null!==(g=e.mapping.header)&&void 0!==g&&g[i]&&f){var N,O,k,V,U,T,P;const o=y.replace(s,""),a=null!==(N=null===(O=e.mapping.header)||void 0===O||null===(k=O[i])||void 0===k?void 0:k.replace(s,""))&&void 0!==N?N:"",d=a.replace(s,"").startsWith("((")&&a.replace(s,"").endsWith("))"),u=d?a.slice(2,-2):`{{${a}}}`;n.header.push({variableName:l?o:d?`((${u}))`:`{{${a}}}`,type:"string",isEditableVariable:!0,variableValue:null===(V=t.example)||void 0===V||null===(U=V.header_handle)||void 0===U?void 0:U[0][i],updatedValue:a.includes(v)?null===(T=t.example)||void 0===T||null===(P=T.header_handle)||void 0===P?void 0:P[0][i]:u,index:i})}}else n.header.push({variableName:l?y:`{{${null===(x=e.mapping)||void 0===x||null===(_=x.header)||void 0===_?void 0:_[i].slice(2,-2)}}}`,type:"string",isEditableVariable:!0,variableValue:null===(C=t.example)||void 0===C||null===(E=C.header_handle)||void 0===E?void 0:E[0][i],updatedValue:`{{${null===(L=e.mapping)||void 0===L||null===($=L.header)||void 0===$?void 0:$[i].slice(2,-2)}}}`,index:i})}))}if("BODY"===t.type){var d;const o=null===t||void 0===t||null===(d=t.text)||void 0===d?void 0:d.match(u);null===o||void 0===o||o.forEach(((o,i)=>{var a,d,u,r,p,c,m,b,h;const g=`{{${null===l||void 0===l||null===(a=l.mapping.body)||void 0===a?void 0:a[i].slice(2,-2)}}}`,y=g&&g.includes(v)||(null===(d=e.mapping.body)||void 0===d?void 0:d[i].includes(v))||(null===(u=e.mapping.body)||void 0===u||null===(r=u[i])||void 0===r||null===(p=r.replace(s,""))||void 0===p?void 0:p.startsWith("(("))&&(null===(c=e.mapping.body)||void 0===c||null===(m=c[i])||void 0===m||null===(b=m.replace(s,""))||void 0===b?void 0:b.endsWith("))"));var f,x,_,C,E,$;if(y){if(null!==(h=e.mapping.body)&&void 0!==h&&h[i]&&y){var N,O,k,V,U,T,P;const o=g.replace(s,""),a=null!==(N=null===(O=e.mapping.body)||void 0===O||null===(k=O[i])||void 0===k?void 0:k.replace(s,""))&&void 0!==N?N:"",d=a.replace(s,"").startsWith("((")&&a.replace(s,"").endsWith("))"),u=d?a.slice(2,-2):`{{${a}}}`;n.body.push({variableName:l?o:d?`((${u}))`:`{{${a}}}`,type:"string",isEditableVariable:!0,variableValue:null===(V=t.example)||void 0===V||null===(U=V.body_text)||void 0===U?void 0:U[0][i],updatedValue:a.includes(v)?null===(T=t.example)||void 0===T||null===(P=T.body_text)||void 0===P?void 0:P[0][i]:u,index:i})}}else n.body.push({variableName:l?g:`{{${null===(f=e.mapping.body)||void 0===f?void 0:f[i].slice(2,-2)}}}`,type:"string",isEditableVariable:!L(null!==(x=null===(_=e.mapping.body)||void 0===_?void 0:_[i])&&void 0!==x?x:""),variableValue:null===(C=t.example)||void 0===C||null===(E=C.body_text)||void 0===E?void 0:E[0][i],updatedValue:`{{${null===($=e.mapping.body)||void 0===$?void 0:$[i].slice(2,-2)}}}`,index:i})}))}if("BUTTONS"===t.type){var r,c,b;const{componentToMapping:l,mappingToComponent:i}=y(t.buttons,null!==(r=null===(c=e.mapping)||void 0===c?void 0:c.buttons)&&void 0!==r?r:[]);null===t||void 0===t||null===(b=t.buttons)||void 0===b||b.forEach(((t,i)=>{if("URL"===t.type){var a,d,u,r,s,v,c,b,h;const g=void 0!==l[i]&&null!=(null===(a=e.mapping.buttons)||void 0===a?void 0:a[l[i]]),y=g&&null!==(d=null===(u=e.mapping.buttons)||void 0===u||null===(r=u[l[i]])||void 0===r?void 0:r.slice(2,-2))&&void 0!==d?d:"",f=null!==(s=m(y))&&void 0!==s&&s.length?m(y):y,x=g?f===p?`((${f}))`:`{{${f}}}`:`((${p}
3))`,_={...t,buttonVariable:x,index:i,queryParams:null!==(v=null===o||void 0===o||null===(c=o.message_template)||void 0===c||null===(b=c.buttonsList)||void 0===b||null===(h=b[i])||void 0===h?void 0:h.queryParams)&&void 0!==v?v:[]};!g&&t.url&&(_.example=[t.url]),n.buttons.push(_)}if("COPY_CODE"===t.type){var g;const e={text:"Copy Code",buttonVariable:"string"===typeof t.example?t.example:null===(g=t.example)||void 0===g?void 0:g[0],example:"string"===typeof t.example?[t.example]:t.example,index:i,type:"COPY_CODE"};n.buttons.push(e)}}))}})),n},N=(e,l,o)=>{const t={body:[],cards:[]};return e.components.forEach(((o,n)=>{if("BODY"===o.type){var i;const n=null===o||void 0===o||null===(i=o.text)||void 0===i?void 0:i.match(u);null===n||void 0===n||n.forEach(((n,i)=>{var a,d,u,r,p,c,m,b,h;const g=`{{${null===l||void 0===l||null===(a=l.mapping.body)||void 0===a?void 0:a[i].slice(2,-2)}}}`,y=g&&g.includes(v)||(null===(d=e.mapping.body)||void 0===d?void 0:d[i].includes(v))||(null===(u=e.mapping.body)||void 0===u||null===(r=u[i])||void 0===r||null===(p=r.replace(s,""))||void 0===p?void 0:p.startsWith("(("))&&(null===(c=e.mapping.body)||void 0===c||null===(m=c[i])||void 0===m||null===(b=m.replace(s,""))||void 0===b?void 0:b.endsWith("))"));if(y){if(null!==(h=e.mapping.body)&&void 0!==h&&h[i]&&y){var f,x,_,C,E,L,$;const n=g.replace(s,""),a=null!==(f=null===(x=e.mapping.body)||void 0===x||null===(_=x[i])||void 0===_?void 0:_.replace(s,""))&&void 0!==f?f:"",d=a.replace(s,"").startsWith("((")&&a.replace(s,"").endsWith("))"),u=d?a.slice(2,-2):`{{${a}}}`;t.body.push({variableName:l?n:d?`((${u}))`:`{{${a}}}`,type:"string",isEditableVariable:!0,variableValue:null===(C=o.example)||void 0===C||null===(E=C.body_text)||void 0===E?void 0:E[0][i],updatedValue:null!==a&&void 0!==a&&a.includes(v)?(null===(L=o.example)||void 0===L||null===($=L.body_text)||void 0===$?void 0:$[0][i])||"":u,index:i})}}else{var N,O,k,V;const n={variableName:l?g:`{{${null===(N=e.mapping.body)||void 0===N?void 0:N[i].slice(2,-2)}}}`,type:"string",isEditableVariable:!0,variableValue:null===(O=o.example)||void 0===O||null===(k=O.body_text)||void 0===k?void 0:k[0][i],updatedValue:`{{${null===(V=e.mapping.body)||void 0===V?void 0:V[i].slice(2,-2)}}}`,index:i};t.body.push(n)}}))}var a;"CAROUSEL"===o.type&&(null===o||void 0===o||null===(a=o.cards)||void 0===a||a.forEach(((o,i)=>{var a,d,u;const r={components:o.components,mapping:null===(a=e.mapping.cards)||void 0===a?void 0:a[i]},s=l?{components:null===l||void 0===l||null===(d=l.components[n].cards)||void 0===d?void 0:d[i].components,mapping:null===(u=l.mapping.cards)||void 0===u?void 0:u[i]}:void 0,v=$(r,s);t.cards.push(v)})))}
3)),t},O=e=>{var l;const o=null===e||void 0===e||null===(l=e.backtrack)||void 0===l?void 0:l.backtrackMessage;return null!==o&&void 0!==o?o:""},k=e=>{var l,o,t;const n=null===e||void 0===e||null===(l=e.message_template)||void 0===l||null===(o=l.buttonsList)||void 0===o?void 0:o.find((e=>{var l;return null===(l=e.buttonKey)||void 0===l?void 0:l.startsWith("website")}));return null!==(t=null===n||void 0===n?void 0:n.discount)&&void 0!==t?t:""},V=e=>{var l;let o="";return null===(l=e.components)||void 0===l||l.forEach((e=>{var l;"BUTTONS"===e.type&&(null===(l=e.buttons)||void 0===l||l.forEach((e=>{"QUICK_REPLY"!==e.type||(o="QRB")})))})),o},U=e=>{if(e&&e.length>0){const l=e.filter((e=>!["website","phone","copy_code"].some((l=>e.buttonKey.startsWith(l)))));return l&&l.length>0}return!1},T=e=>{var l;const o={};return null===(l=Object.keys(null!==e&&void 0!==e?e:{}))||void 0===l||l.forEach((l=>{["website","phone","copy_code",r.P.REVIEW_AND_PAY,r.P.PAY_NOW].some((e=>l.startsWith(e)))?o[l]={key:e[l].key,value:null,isConnectable:!1}:o[l]=e[l]})),o},P=(e,l)=>{var o,t;const n=null===e||void 0===e||null===(o=e.components)||void 0===o||null===(t=o.filter)||void 0===t?void 0:t.call(o,(e=>e.type===l));return(null===n||void 0===n?void 0:n.length)>0}},72056:(e,l,o)=>{o.d(l,{F:()=>r});var t=o(81771),n=o(53488),i=o(18666),a=o(30276),d=o(61990),u=o(64755);const r=e=>{const l=new n.OL(i.Cw,i.Cw),o=(0,d.C)((e=>e.homeState)),r=(0,d.C)((e=>e.nodeClickState.nodeId)),s=(e,n)=>{let{file:i,fileName:d,isImage:s}=e;return new Promise((async(e,v)=>{n&&v({success:!1});try{if(s){const e=await t.A.compressImage(i);i=e.compressedFile}const c=l.getUploadRef(i,(p=null!==d&&void 0!==d?d:i.name,`chatbot/${o.storeId}/${o.flowId}/${r}/${p}`));c.on("state_changed",(e=>{}),(e=>{(0,u.d)(e,"An unknown technical error occurred while uploading file"),v({success:!1,url:""})}),(async()=>{try{const l=await(0,a.Jt)(c.snapshot.ref);l?e({success:!0,url:l}):v({success:!1,url:""})}catch(n){(0,u.d)(n,"Error getting download URL or metadata:"),v({success:!1,url:""})}}))}catch(c){console.error("Error during file upload:",n),(0,u.d)(c,"Error during file upload"),v({success:!1,url:""})}var p}))};return{handleFileUpload:async e=>s(e),formatFileSize:e=>{if(!e)return"0 Bytes";const l=Math.floor(Math.log(e)/Math.log(1024));return`${parseFloat((e/Math.pow(1024,l)).toFixed(2))} ${["Bytes","KB","MB"][l]}`}}}},70865:(e,l,o)=>{o.d(l,{Z:()=>n});var t=o(80184);const n=e=>{const{width:l,height:o,color:n,backgroundColor:i}=e;return(0,t.jsxs)("svg",{width:l||"12",height:o||"11",viewBox:"0 0 12 11",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.00376 0.297985L7.00335 0.297595C6.89715 0.196746 6.75208 0.147527 6.60644 0.162933C6.4608 0.17834 6.32924 0.256823 6.2465 0.37766L3.81031 3.93533L1.68194 4.88294C0.588776 5.36965 0.0971462 6.65039 0.583854 7.74355C1.04775 8.78549 2.233 9.28094 3.28964 8.90366L3.85571 10.1751C3.96803 10.4273 4.26358 10.5408 4.51585 10.4285C4.76812 10.3162 4.88157 10.0206 4.76925 9.76833L4.20575 8.50269L5.57283 7.89403L9.84683 8.46413C9.99199 8.4835 10.1383 8.43824 10.2472 8.34032C10.3561 8.2424 10.4166 8.10166 10.4128 7.95526L10.4127 7.95469L10.4127 7.952L10.4125 7.94611L10.4117 7.92656C10.411 7.91013 10.4099 7.88694 10.4082 7.85736C10.4047 7.79821 10.3986 7.71344 10.3884 7.60597C10.3679 7.39111 10.3304 7.08498 10.2623 6.71096C10.1262 5.96382 9.86696 4.94038 9.37279 3.83046C8.87863 2.72055 8.29155 1.84305 7.82735 1.24202C7.59497 0.941137 7.39254 0.708453 7.24659 0.549441C7.17359 0.469904 7.11463 0.408702 7.07301 0.366522C7.0522 0.345429 7.03572 0.329083 7.02397 0.317569L7.00996 0.303929L7.00571 0.299845L7.00376 0.297985ZM2.08868 5.79649L3.88952 4.9947L4.83857 7.12631L3.03773 7.92809C2.4491 8.19017 1.75947 7.92544 1.4974 7.33681C1.23533 6.74819 1.50005 6.05856 2.08868 5.79649ZM9.35727 7.38997L5.84182 6.92105L4.71336 4.38648L6.71717 1.46023C6.8119 1.57127 6.91954 1.70258 7.03592 1.85327C7.46295 2.40617 8.00436 3.21551 8.45925 4.2372C8.91413 5.25889 9.15331 6.20279 9.27846 6.8901C9.31257 7.07742 9.33813 7.24527 9.35727 7.38997Z",fill:n||"currentColor"}),(0,t.jsx)("path",{d:"M9.11251 1.42998C8.91387 1.6218 8.90834 1.93834 9.10017 2.13698C9.29199 2.33562 9.60853 2.34114 9.80717 2.14932L10.1668 1.80199C10.3655 1.61016 10.371 1.29363 10.1792 1.09499C9.98735 0.896349 9.67082 0.890824 9.47218 1.08265L9.11251 1.42998Z",fill:n||"currentColor"}),(0,t.jsx)("path",{d:"M9.9728 3.01605C9.72053 3.12836 9.60707 3.42392 9.71939 3.67619C9.83171 3.92846 10.1273 4.04191 10.3795 3.92959L11.2931 3.52286C11.5453 3.41054 11.6588 3.11498 11.5465 2.86271C11.4342 2.61045 11.1386 2.49699 10.8863 2.60931L9.9728 3.01605Z",fill:n||"currentColor"}),(0,t.jsx)("path",{d:"M10.4572 5.36099C10.4379 5.08552 10.6456 4.84659 10.9211 4.82733L11.4198 4.79245C11.6953 4.77319 11.9342 4.98088 11.9535 5.25635C11.9728 5.53182 11.7651 5.77075 11.4896 5.79001L10.9908 5.82489C10.7153 5.84416 10.4764 5.63646 10.4572 5.36099Z",fill:n||"currentColor"})]})}}}]); 4//# sourceMappingURL=1002.0fb62bc1.chunk.js.map
5//# debugId=5f6c2193-14da-590a-8971-29ff5c62f1c0
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.