@hiver/connector-agent 4.9.0-splitApps-beta.3 → 4.9.0-splitApps-beta.5

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/index.es.js CHANGED
@@ -9868,17 +9868,29 @@ const id = {
9868
9868
  url: `${g6}?${t.toString()}`,
9869
9869
  method: kf.GET
9870
9870
  });
9871
- }, L6 = "/v1/api/connectors/ug?onlyEnabledAuthenticated=true&minimal=true", jf = async () => {
9872
- const e = await je({
9873
- url: L6,
9871
+ }, L6 = "/v1/api/connectors/ug?onlyEnabledAuthenticated=true&minimal=true", jf = async (e) => {
9872
+ const t = new URLSearchParams();
9873
+ for (const [i, s] of Object.entries(e || {}))
9874
+ if (Array.isArray(s))
9875
+ s.forEach((a) => {
9876
+ a && t.append(i, String(a));
9877
+ });
9878
+ else {
9879
+ if (!s) continue;
9880
+ t.append(i, s);
9881
+ }
9882
+ let n = L6;
9883
+ e && (n += `?${t.toString()}`);
9884
+ const r = await je({
9885
+ url: n,
9874
9886
  method: kf.GET
9875
- }), t = e == null ? void 0 : e.data;
9876
- return Array.isArray(t) ? t.map(({ id: n, name: r, logo: o, connectorType: i }) => ({
9877
- id: n,
9878
- name: r,
9879
- logo: o,
9880
- connectorType: i
9881
- })).filter(({ logo: n }) => !!n) : [];
9887
+ }), o = r == null ? void 0 : r.data;
9888
+ return Array.isArray(o) ? o.map(({ id: i, name: s, logo: a, connectorType: c }) => ({
9889
+ id: i,
9890
+ name: s,
9891
+ logo: a,
9892
+ connectorType: c
9893
+ })).filter(({ logo: i }) => !!i) : [];
9882
9894
  };
9883
9895
  let $r = {};
9884
9896
  const O6 = {
@@ -18492,7 +18504,7 @@ const Jc = /* @__PURE__ */ new Set(), tw = (e, t) => {
18492
18504
  Ut === "HIVERWEB" ? `hot-${Pu}` : Pu
18493
18505
  ), { data: cr } = rr({
18494
18506
  queryKey: ["connectors", "enabledAuthenticated"],
18495
- queryFn: jf,
18507
+ queryFn: () => jf(),
18496
18508
  enabled: _t && e
18497
18509
  }), Vn = Ie(() => (cr ?? []).map((oe) => oe.id), [cr]), { data: Xt, isSuccess: Ln } = rr({
18498
18510
  queryKey: ["lookup", "bulk", Vn.join(",")],
@@ -22059,42 +22071,51 @@ const KT = ({ observer: e, ...t }) => /* @__PURE__ */ u.jsx(Zl, { children: /* @
22059
22071
  data: e
22060
22072
  }), Yo = (...e) => {
22061
22073
  console.log("CONNECTOR_STORE_DEBUG", ...e);
22062
- }, Mp = async (e = 0) => {
22074
+ }, Mp = async (e, t = 0) => {
22063
22075
  try {
22064
- return Yo("getConnectorsList", e), await jf();
22065
- } catch (t) {
22066
- return e > 2 ? (console.error("Failed to get connectors list after 3 tries", t), []) : Mp(e + 1);
22076
+ return Yo("getConnectorsList", t), await jf(e);
22077
+ } catch (n) {
22078
+ return t > 2 ? (console.error("Failed to get connectors list after 3 tries", n), []) : Mp(e, t + 1);
22067
22079
  }
22068
22080
  }, eS = (e) => {
22069
- const { connectorTabSelector: t, sideBarDropdownSize: n } = e, r = { connectorApiPending: !1, sideBarTabs: 0 };
22081
+ const { connectorTabSelector: t, sideBarDropdownSize: n } = e, r = { connectorApiPending: !1 };
22070
22082
  if (!an())
22071
22083
  throw new Error("Please initiate bifrost by calling initConnectorsBifrost function before creating app store");
22072
22084
  const i = k6({
22073
22085
  name: "app-store",
22074
22086
  initialState: {}
22075
22087
  }), s = () => {
22076
- r.connectorApiPending || (r.connectorApiPending = !0, Mp().then((d) => {
22077
- r.connectorApiPending = !1, Yo("setConnectors", d), !(!Array.isArray(d) || !d.length) && i.setData(d, "connectors");
22078
- }));
22079
- }, a = (d) => [...d].sort((g, b) => {
22080
- const y = g.lastAccessed ?? 0, m = b.lastAccessed ?? 0;
22081
- return y === m ? 0 : y > m ? -1 : 1;
22082
- }).map((g, b) => ({ ...g, sidebarView: b < r.sideBarTabs })), c = () => {
22088
+ const d = i.getData("inboxIds");
22089
+ if (r.connectorApiPending || !Array.isArray(d)) return;
22090
+ r.connectorApiPending = !0, Mp({
22091
+ channel_type: "email",
22092
+ inbox_id: d
22093
+ }).then((b) => {
22094
+ r.connectorApiPending = !1, Yo("setConnectors", b), !(!Array.isArray(b) || !b.length) && i.setData(b, "connectors");
22095
+ });
22096
+ }, a = (d) => {
22097
+ (!Array.isArray(d) || !d.length) && (d = i.getData("connectors") || []);
22098
+ const g = i.getData("sideBarTabs") || 0, b = [...d].sort((y, m) => {
22099
+ const p = y.lastAccessed ?? 0, f = m.lastAccessed ?? 0;
22100
+ return p === f ? 0 : p > f ? -1 : 1;
22101
+ }).map((y, m) => ({ ...y, sidebarView: m < g }));
22102
+ i.setData(b, "connectorTabs");
22103
+ }, c = () => {
22083
22104
  const d = i.getData("connectors"), g = i.getData("tabElement");
22084
- if (Yo("setConnectorTabs", d, g), !Array.isArray(d) || !d.length) return s();
22105
+ if (Yo("calculateTabPositions", d, g), !Array.isArray(d) || !d.length) return s();
22085
22106
  if (!g) return;
22086
22107
  const b = g.querySelector(`:scope > ${t}`);
22087
22108
  if (!b) {
22088
- let I = null;
22089
- I = new MutationObserver(() => {
22090
- I == null || I.disconnect(), c();
22091
- }), I.observe(g, { childList: !0, subtree: !0 });
22109
+ let _ = null;
22110
+ _ = new MutationObserver(() => {
22111
+ _ == null || _.disconnect(), c();
22112
+ }), _.observe(g, { childList: !0, subtree: !0 });
22092
22113
  return;
22093
22114
  }
22094
22115
  const y = b.previousElementSibling;
22095
22116
  if (!y) return;
22096
- const m = b.getBoundingClientRect().left, p = y.getBoundingClientRect().right, f = g.getBoundingClientRect().right, h = m - p, v = h + b.clientWidth, C = f - p, E = Math.floor(C / v), x = Math.floor((C - n) / v);
22097
- d.length > E ? r.sideBarTabs = x : r.sideBarTabs = E, Yo("calculations", {
22117
+ const m = b.getBoundingClientRect().left, p = y.getBoundingClientRect().right, f = g.getBoundingClientRect().right, h = m - p, v = h + b.clientWidth, C = f - p, E = Math.floor(C / v), x = Math.floor((C - n) / v), I = d.length > E ? x : E;
22118
+ i.setData(I, "sideBarTabs"), Yo("calculations", {
22098
22119
  connectorTabLeft: m,
22099
22120
  nonConnectorRight: p,
22100
22121
  tabElementRight: f,
@@ -22103,15 +22124,15 @@ const KT = ({ observer: e, ...t }) => /* @__PURE__ */ u.jsx(Zl, { children: /* @
22103
22124
  spaceAvailable: C,
22104
22125
  tabsAvailable: E,
22105
22126
  tabsAvailableWithDropdown: x
22106
- }), i.setData(a(d), "connectorTabs");
22127
+ });
22107
22128
  }, l = (d) => {
22108
22129
  if (!d) return;
22109
22130
  const g = i.getData("connectorTabs"), b = g == null ? void 0 : g.find((m) => m.id === d);
22110
22131
  if (!b || b.sidebarView) return;
22111
22132
  const y = (/* @__PURE__ */ new Date()).getTime();
22112
- b.lastAccessed = y, i.setData(a(g), "connectorTabs");
22133
+ b.lastAccessed = y, a(g);
22113
22134
  };
22114
- return i.subscribe(c, "connectors"), i.subscribe(c, "tabElement", !1), i.subscribe(l, "connectorId", !1), Yo("appStore created", i), i;
22135
+ return i.subscribe(c, "connectors"), i.subscribe(c, "tabElement", !1), i.subscribe(() => a(), "sideBarTabs", !1), i.subscribe(l, "connectorId", !1), i.subscribe(s, "inboxIds", !1), Yo("appStore created", i), i;
22115
22136
  };
22116
22137
  export {
22117
22138
  JT as ActionQueue,
package/index.umd.js CHANGED
@@ -592,7 +592,7 @@ Take a look at the reducer(s) handling this action type: ${x.type}.
592
592
  fill: #ffffff;
593
593
  width: 10px;
594
594
  }
595
- `,Iy=(e,{closeToast:t})=>u.jsx(Ey,{children:u.jsx("img",{src:yy,onClick:t})}),Js=({message:e})=>u.jsxs(Cy,{children:[u.jsx(vy,{}),u.jsx(xy,{children:e})]});function _e(e){const{message:t,type:n,autoClose:r}=e,o={closeButton:u.jsx(Iy,{}),autoClose:r??5e3,pauseOnHover:!0,position:"bottom-left",rtl:!1,draggable:!0,closeOnClick:!0,hideProgressBar:!0};let s;switch(n){case"success":{s=Le.success(u.jsx(Js,{message:t}),{...o,icon:!1});break}case"error":{s=Le.error(u.jsx(Js,{message:t}),{...o,icon:!1});break}case"info-dark":{s=Le.info(u.jsx(Js,{message:t}),{...o,icon:!1,className:"toast_dark"});break}default:{s=Le.info(u.jsx(Js,{message:t}),{...o,icon:!1});break}}return setTimeout(()=>{wy(s)},r&&!isNaN(r)?Number(r):5e3),s}function wy(e){Le.dismiss(e)}const N0={updateFormApiStatus:K.IDLE,createObjectList:[],createObjectConnectorNamesList:[],linkObjectList:[],editObjectList:[],searchObjectList:[],objectDict:null,formFields:null,objectListApiStatus:K.IDLE,unlinkCardApiStatus:K.IDLE,linkCardApiStatus:K.IDLE,optionsMap:null,dropdownOptionsApis:K.IDLE,dependentFieldsMap:{},createFormApiStatus:K.IDLE,currentResourceDetailsApiStatus:K.IDLE,currentResourceDetails:null,currentCardInEdit:null,hasUnsavedChanges:!1},_y="/v1/api"+"/templates/metadata",R0={GET:"GET",POST:"POST",DELETE:"DELETE",PATCH:"PATCH",PUT:"PUT"},Sy="Required Field",Ay="Invalid date",M0=/^https:\/\/([a-z0-9-]+(\.[a-z0-9-]+)+)(:[0-9]{1,5})?(\/[^\s/]*)*$/i,Ty=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,P0="Please enter a valid URL",Ly="Please enter valid ID",Oy="Please enter valid input",Fy="URL must start with https://",Dy="URL should not end with a slash",ky="Invalid email address",Ny="Email must be a string",j0="Invalid date",Ry="Date cannot be in the past",My="Date cannot be in the future",Py="Invalid number",jy="Invalid text",By=async e=>{const t=new URLSearchParams,{inboxIds:n,channelType:r,conversationId:o,fetchAuthenticatedConnectors:s}=e||{};return n==null||n.forEach(i=>{t.append("inbox_ids",i)}),[["channel_type",r],["conversation_id",o],["fetch_authenticated_connectors",s==null?void 0:s.toString()]].forEach(([i,c])=>{c!==void 0&&t.append(i,c)}),we({url:`${_y}?${t.toString()}`,method:R0.GET})},Vy="/v1/api/connectors/ug?onlyEnabledAuthenticated=true&minimal=true",B0=async()=>{const e=await we({url:Vy,method:R0.GET}),t=e==null?void 0:e.data;return Array.isArray(t)?t.map(({id:n,name:r,logo:o,connectorType:s})=>({id:n,name:r,logo:o,connectorType:s})).filter(({logo:n})=>!!n):[]};let Gr={};const Gy={get length(){return Object.keys(Gr).length},getItem(e){return Gr[e]??null},setItem(e,t){Gr[e]=t},removeItem(e){delete Gr[e]},clear(){Gr={}},key(e){return Object.keys(Gr)[e]}},Hy={LOCAL:window==null?void 0:window.localStorage,SESSION:window==null?void 0:window.sessionStorage},V0=(e="LOCAL")=>Hy[e]??Gy,G0=(e="LOCAL")=>{const t=V0(e);return{...t,getItem(n){const r=t.getItem(n);if(!r)return r;try{return JSON.parse(r)}catch(o){return console.warn(o),r}},setItem(n,r){try{const o=JSON.stringify(r);t.setItem(n,o)}catch(o){console.warn(o)}}}};var hc=(e=>(e.ADD="ADD",e.MULTIPLY="MULTIPLY",e))(hc||{});const Wy={[hc.ADD]:(e,t)=>e+t,[hc.MULTIPLY]:(e,t)=>e*t},Zy=e=>e,H0=()=>{if("crypto"in window&&"randomUUID"in window.crypto)return window.crypto.randomUUID();const e=Date.now().toString(16),t=Math.random().toString(16).substring(2,8);return`${e}-${t}`},W0=(e,t)=>{let n;const r=Wy[t]??Zy;for(const o of e){const s=Number(o);isNaN(s)||(n=n===void 0?s:r(n,s))}return(n??0).toFixed(2)},Z0=(e,t=n=>n)=>{const n=new Set,r=[];for(const o of e){const s=t(o);n.has(s)||(n.add(s),r.push(o))}return r},gc=Symbol("root"),Xy="connectors-store",zy=e=>{const{name:t,initialState:n,persist:r,persistKey:o=`${Xy}-${t}`}=e,s=G0("LOCAL"),a={...n},i=r?s.getItem(o)??a:a,c=new Map,l=new Map;l.set(gc,new Set);const f=(b,h,p=!0)=>{var v;const g=Symbol("callback");c.set(g,b);const C=h||gc;if(l.has(C)||l.set(C,new Set),(v=l.get(C))==null||v.add(g),p){const I=h?i[h]:i;b(I)}return()=>{var I;c.delete(g),(I=l.get(C))==null||I.delete(g)}},m=(b,h)=>{h?i[h]=b:Object.assign(i,b),x();const p=h||gc,g=l.get(p);if(g)for(const C of g){const v=c.get(C);v==null||v(h?i[h]:i)}},y=b=>b?i[b]:{...i},x=()=>{r&&s.setItem(o,i)};return{subscribe:f,setData:m,getData:y}},Yy=e=>t=>{if(t&&typeof t=="string"){const n=t.replace(/\/$/,"");return n.startsWith("https://")?t.endsWith("/")?Dy:M0.test(n)?!0:e||P0:Fy}return!1},Jy=e=>t=>t&&typeof t=="string"?Ty.test(t)?!0:e||ky:Ny,qy=e=>t=>t==null||t===""?e||Sy:!0,$y=e=>(t,n)=>{var r;if(!t||(t==null?void 0:t.toString())===Ay)return j0;if(typeof t=="object"){const o=t,s=new Date;s.setHours(0,0,0,0);const a=n.disablePast,i=n.disableFuture;return a&&o<s?e||Ry:i&&o>s?e||My:!0}return typeof t=="string"&&((r=new Date(t))==null?void 0:r.toString())!=="Invalid Date"?!0:j0},Qy=e=>(t,n)=>{if(t=Number(t),typeof t=="number"&&!isNaN(t)){const r=n.min,o=n.max;return r!==void 0&&t<r?e||`Value should not be less than ${r}`:o!==void 0&&t>o?e||`Value should not be greater than ${o}`:!0}return e||Py},mc=e=>(t,n)=>{if(typeof t=="string"){const r=n.limit;return r!==void 0&&t.length>r?e||`Maximum characters allowed are ${r}`:!0}return e||jy},Uy=e=>t=>typeof t=="string"?t.startsWith("https:")?M0.test(t)?!0:e||P0:t.trim().length>0?!0:e||Ly:e||Oy;function lr(e){"@babel/helpers - typeof";return lr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lr(e)}function Ky(e,t){if(lr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(lr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function X0(e){var t=Ky(e,"string");return lr(t)=="symbol"?t:t+""}function Hr(e,t,n){return(t=X0(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function oe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?z0(Object(n),!0).forEach(function(r){Hr(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z0(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function e9(e){if(Array.isArray(e))return e}function t9(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,s,a,i=[],c=!0,l=!1;try{if(s=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=s.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(f){l=!0,o=f}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return i}}function bc(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Y0(e,t){if(e){if(typeof e=="string")return bc(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bc(e,t):void 0}}function n9(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
595
+ `,Iy=(e,{closeToast:t})=>u.jsx(Ey,{children:u.jsx("img",{src:yy,onClick:t})}),Js=({message:e})=>u.jsxs(Cy,{children:[u.jsx(vy,{}),u.jsx(xy,{children:e})]});function _e(e){const{message:t,type:n,autoClose:r}=e,o={closeButton:u.jsx(Iy,{}),autoClose:r??5e3,pauseOnHover:!0,position:"bottom-left",rtl:!1,draggable:!0,closeOnClick:!0,hideProgressBar:!0};let s;switch(n){case"success":{s=Le.success(u.jsx(Js,{message:t}),{...o,icon:!1});break}case"error":{s=Le.error(u.jsx(Js,{message:t}),{...o,icon:!1});break}case"info-dark":{s=Le.info(u.jsx(Js,{message:t}),{...o,icon:!1,className:"toast_dark"});break}default:{s=Le.info(u.jsx(Js,{message:t}),{...o,icon:!1});break}}return setTimeout(()=>{wy(s)},r&&!isNaN(r)?Number(r):5e3),s}function wy(e){Le.dismiss(e)}const N0={updateFormApiStatus:K.IDLE,createObjectList:[],createObjectConnectorNamesList:[],linkObjectList:[],editObjectList:[],searchObjectList:[],objectDict:null,formFields:null,objectListApiStatus:K.IDLE,unlinkCardApiStatus:K.IDLE,linkCardApiStatus:K.IDLE,optionsMap:null,dropdownOptionsApis:K.IDLE,dependentFieldsMap:{},createFormApiStatus:K.IDLE,currentResourceDetailsApiStatus:K.IDLE,currentResourceDetails:null,currentCardInEdit:null,hasUnsavedChanges:!1},_y="/v1/api"+"/templates/metadata",R0={GET:"GET",POST:"POST",DELETE:"DELETE",PATCH:"PATCH",PUT:"PUT"},Sy="Required Field",Ay="Invalid date",M0=/^https:\/\/([a-z0-9-]+(\.[a-z0-9-]+)+)(:[0-9]{1,5})?(\/[^\s/]*)*$/i,Ty=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,P0="Please enter a valid URL",Ly="Please enter valid ID",Oy="Please enter valid input",Fy="URL must start with https://",Dy="URL should not end with a slash",ky="Invalid email address",Ny="Email must be a string",j0="Invalid date",Ry="Date cannot be in the past",My="Date cannot be in the future",Py="Invalid number",jy="Invalid text",By=async e=>{const t=new URLSearchParams,{inboxIds:n,channelType:r,conversationId:o,fetchAuthenticatedConnectors:s}=e||{};return n==null||n.forEach(i=>{t.append("inbox_ids",i)}),[["channel_type",r],["conversation_id",o],["fetch_authenticated_connectors",s==null?void 0:s.toString()]].forEach(([i,c])=>{c!==void 0&&t.append(i,c)}),we({url:`${_y}?${t.toString()}`,method:R0.GET})},Vy="/v1/api/connectors/ug?onlyEnabledAuthenticated=true&minimal=true",B0=async e=>{const t=new URLSearchParams;for(const[s,a]of Object.entries(e||{}))if(Array.isArray(a))a.forEach(i=>{i&&t.append(s,String(i))});else{if(!a)continue;t.append(s,a)}let n=Vy;e&&(n+=`?${t.toString()}`);const r=await we({url:n,method:R0.GET}),o=r==null?void 0:r.data;return Array.isArray(o)?o.map(({id:s,name:a,logo:i,connectorType:c})=>({id:s,name:a,logo:i,connectorType:c})).filter(({logo:s})=>!!s):[]};let Gr={};const Gy={get length(){return Object.keys(Gr).length},getItem(e){return Gr[e]??null},setItem(e,t){Gr[e]=t},removeItem(e){delete Gr[e]},clear(){Gr={}},key(e){return Object.keys(Gr)[e]}},Hy={LOCAL:window==null?void 0:window.localStorage,SESSION:window==null?void 0:window.sessionStorage},V0=(e="LOCAL")=>Hy[e]??Gy,G0=(e="LOCAL")=>{const t=V0(e);return{...t,getItem(n){const r=t.getItem(n);if(!r)return r;try{return JSON.parse(r)}catch(o){return console.warn(o),r}},setItem(n,r){try{const o=JSON.stringify(r);t.setItem(n,o)}catch(o){console.warn(o)}}}};var hc=(e=>(e.ADD="ADD",e.MULTIPLY="MULTIPLY",e))(hc||{});const Wy={[hc.ADD]:(e,t)=>e+t,[hc.MULTIPLY]:(e,t)=>e*t},Zy=e=>e,H0=()=>{if("crypto"in window&&"randomUUID"in window.crypto)return window.crypto.randomUUID();const e=Date.now().toString(16),t=Math.random().toString(16).substring(2,8);return`${e}-${t}`},W0=(e,t)=>{let n;const r=Wy[t]??Zy;for(const o of e){const s=Number(o);isNaN(s)||(n=n===void 0?s:r(n,s))}return(n??0).toFixed(2)},Z0=(e,t=n=>n)=>{const n=new Set,r=[];for(const o of e){const s=t(o);n.has(s)||(n.add(s),r.push(o))}return r},gc=Symbol("root"),Xy="connectors-store",zy=e=>{const{name:t,initialState:n,persist:r,persistKey:o=`${Xy}-${t}`}=e,s=G0("LOCAL"),a={...n},i=r?s.getItem(o)??a:a,c=new Map,l=new Map;l.set(gc,new Set);const f=(b,h,p=!0)=>{var v;const g=Symbol("callback");c.set(g,b);const C=h||gc;if(l.has(C)||l.set(C,new Set),(v=l.get(C))==null||v.add(g),p){const I=h?i[h]:i;b(I)}return()=>{var I;c.delete(g),(I=l.get(C))==null||I.delete(g)}},m=(b,h)=>{h?i[h]=b:Object.assign(i,b),x();const p=h||gc,g=l.get(p);if(g)for(const C of g){const v=c.get(C);v==null||v(h?i[h]:i)}},y=b=>b?i[b]:{...i},x=()=>{r&&s.setItem(o,i)};return{subscribe:f,setData:m,getData:y}},Yy=e=>t=>{if(t&&typeof t=="string"){const n=t.replace(/\/$/,"");return n.startsWith("https://")?t.endsWith("/")?Dy:M0.test(n)?!0:e||P0:Fy}return!1},Jy=e=>t=>t&&typeof t=="string"?Ty.test(t)?!0:e||ky:Ny,qy=e=>t=>t==null||t===""?e||Sy:!0,$y=e=>(t,n)=>{var r;if(!t||(t==null?void 0:t.toString())===Ay)return j0;if(typeof t=="object"){const o=t,s=new Date;s.setHours(0,0,0,0);const a=n.disablePast,i=n.disableFuture;return a&&o<s?e||Ry:i&&o>s?e||My:!0}return typeof t=="string"&&((r=new Date(t))==null?void 0:r.toString())!=="Invalid Date"?!0:j0},Qy=e=>(t,n)=>{if(t=Number(t),typeof t=="number"&&!isNaN(t)){const r=n.min,o=n.max;return r!==void 0&&t<r?e||`Value should not be less than ${r}`:o!==void 0&&t>o?e||`Value should not be greater than ${o}`:!0}return e||Py},mc=e=>(t,n)=>{if(typeof t=="string"){const r=n.limit;return r!==void 0&&t.length>r?e||`Maximum characters allowed are ${r}`:!0}return e||jy},Uy=e=>t=>typeof t=="string"?t.startsWith("https:")?M0.test(t)?!0:e||P0:t.trim().length>0?!0:e||Ly:e||Oy;function lr(e){"@babel/helpers - typeof";return lr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lr(e)}function Ky(e,t){if(lr(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(lr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function X0(e){var t=Ky(e,"string");return lr(t)=="symbol"?t:t+""}function Hr(e,t,n){return(t=X0(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function oe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?z0(Object(n),!0).forEach(function(r){Hr(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z0(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function e9(e){if(Array.isArray(e))return e}function t9(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,s,a,i=[],c=!0,l=!1;try{if(s=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=s.call(n)).done)&&(i.push(r.value),i.length!==t);c=!0);}catch(f){l=!0,o=f}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return i}}function bc(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Y0(e,t){if(e){if(typeof e=="string")return bc(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bc(e,t):void 0}}function n9(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
596
596
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nt(e,t){return e9(e)||t9(e,t)||Y0(e,t)||n9()}function r9(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function Jt(e,t){if(e==null)return{};var n,r,o=r9(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var o9=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function yc(e){var t=e.defaultInputValue,n=t===void 0?"":t,r=e.defaultMenuIsOpen,o=r===void 0?!1:r,s=e.defaultValue,a=s===void 0?null:s,i=e.inputValue,c=e.menuIsOpen,l=e.onChange,f=e.onInputChange,m=e.onMenuClose,y=e.onMenuOpen,x=e.value,b=Jt(e,o9),h=w.useState(i!==void 0?i:n),p=nt(h,2),g=p[0],C=p[1],v=w.useState(c!==void 0?c:o),I=nt(v,2),E=I[0],_=I[1],A=w.useState(x!==void 0?x:a),S=nt(A,2),L=S[0],k=S[1],D=w.useCallback(function(X,q){typeof l=="function"&&l(X,q),k(X)},[l]),N=w.useCallback(function(X,q){var se;typeof f=="function"&&(se=f(X,q)),C(se!==void 0?se:X)},[f]),P=w.useCallback(function(){typeof y=="function"&&y(),_(!0)},[y]),B=w.useCallback(function(){typeof m=="function"&&m(),_(!1)},[m]),Y=i!==void 0?i:g,$=c!==void 0?c:E,H=x!==void 0?x:L;return oe(oe({},b),{},{inputValue:Y,menuIsOpen:$,onChange:D,onInputChange:N,onMenuClose:B,onMenuOpen:P,value:H})}function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ue.apply(null,arguments)}function s9(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function J0(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,X0(r.key),r)}}function a9(e,t,n){return t&&J0(e.prototype,t),n&&J0(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Cc(e,t){return Cc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Cc(e,t)}function i9(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Cc(e,t)}function qs(e){return qs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},qs(e)}function q0(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(q0=function(){return!!e})()}function c9(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l9(e,t){if(t&&(lr(t)=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return c9(e)}function u9(e){var t=q0();return function(){var n,r=qs(e);if(t){var o=qs(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return l9(this,n)}}function d9(e){if(Array.isArray(e))return bc(e)}function f9(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function p9(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
597
597
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wr(e){return d9(e)||f9(e)||Y0(e)||p9()}var h9=!1;function g9(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function m9(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var b9=function(){function e(n){var r=this;this._insertTag=function(o){var s;r.tags.length===0?r.insertionPoint?s=r.insertionPoint.nextSibling:r.prepend?s=r.container.firstChild:s=r.before:s=r.tags[r.tags.length-1].nextSibling,r.container.insertBefore(o,s),r.tags.push(o)},this.isSpeedy=n.speedy===void 0?!h9:n.speedy,this.tags=[],this.ctr=0,this.nonce=n.nonce,this.key=n.key,this.container=n.container,this.prepend=n.prepend,this.insertionPoint=n.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(m9(this));var o=this.tags[this.tags.length-1];if(this.isSpeedy){var s=g9(o);try{s.insertRule(r,s.cssRules.length)}catch{}}else o.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var o;return(o=r.parentNode)==null?void 0:o.removeChild(r)}),this.tags=[],this.ctr=0},e}(),st="-ms-",$s="-moz-",Ae="-webkit-",$0="comm",xc="rule",vc="decl",y9="@import",Q0="@keyframes",C9="@layer",x9=Math.abs,Qs=String.fromCharCode,v9=Object.assign;function E9(e,t){return ot(e,0)^45?(((t<<2^ot(e,0))<<2^ot(e,1))<<2^ot(e,2))<<2^ot(e,3):0}function U0(e){return e.trim()}function I9(e,t){return(e=t.exec(e))?e[0]:e}function Te(e,t,n){return e.replace(t,n)}function Ec(e,t){return e.indexOf(t)}function ot(e,t){return e.charCodeAt(t)|0}function jo(e,t,n){return e.slice(t,n)}function on(e){return e.length}function Ic(e){return e.length}function Us(e,t){return t.push(e),e}function w9(e,t){return e.map(t).join("")}var Ks=1,Zr=1,K0=0,mt=0,$e=0,Xr="";function ea(e,t,n,r,o,s,a){return{value:e,root:t,parent:n,type:r,props:o,children:s,line:Ks,column:Zr,length:a,return:""}}function Bo(e,t){return v9(ea("",null,null,"",null,null,0),e,{length:-e.length},t)}function _9(){return $e}function S9(){return $e=mt>0?ot(Xr,--mt):0,Zr--,$e===10&&(Zr=1,Ks--),$e}function Ot(){return $e=mt<K0?ot(Xr,mt++):0,Zr++,$e===10&&(Zr=1,Ks++),$e}function sn(){return ot(Xr,mt)}function ta(){return mt}function Vo(e,t){return jo(Xr,e,t)}function Go(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function ef(e){return Ks=Zr=1,K0=on(Xr=e),mt=0,[]}function tf(e){return Xr="",e}function na(e){return U0(Vo(mt-1,wc(e===91?e+2:e===40?e+1:e)))}function A9(e){for(;($e=sn())&&$e<33;)Ot();return Go(e)>2||Go($e)>3?"":" "}function T9(e,t){for(;--t&&Ot()&&!($e<48||$e>102||$e>57&&$e<65||$e>70&&$e<97););return Vo(e,ta()+(t<6&&sn()==32&&Ot()==32))}function wc(e){for(;Ot();)switch($e){case e:return mt;case 34:case 39:e!==34&&e!==39&&wc($e);break;case 40:e===41&&wc(e);break;case 92:Ot();break}return mt}function L9(e,t){for(;Ot()&&e+$e!==57;)if(e+$e===84&&sn()===47)break;return"/*"+Vo(t,mt-1)+"*"+Qs(e===47?e:Ot())}function O9(e){for(;!Go(sn());)Ot();return Vo(e,mt)}function F9(e){return tf(ra("",null,null,null,[""],e=ef(e),0,[0],e))}function ra(e,t,n,r,o,s,a,i,c){for(var l=0,f=0,m=a,y=0,x=0,b=0,h=1,p=1,g=1,C=0,v="",I=o,E=s,_=r,A=v;p;)switch(b=C,C=Ot()){case 40:if(b!=108&&ot(A,m-1)==58){Ec(A+=Te(na(C),"&","&\f"),"&\f")!=-1&&(g=-1);break}case 34:case 39:case 91:A+=na(C);break;case 9:case 10:case 13:case 32:A+=A9(b);break;case 92:A+=T9(ta()-1,7);continue;case 47:switch(sn()){case 42:case 47:Us(D9(L9(Ot(),ta()),t,n),c);break;default:A+="/"}break;case 123*h:i[l++]=on(A)*g;case 125*h:case 59:case 0:switch(C){case 0:case 125:p=0;case 59+f:g==-1&&(A=Te(A,/\f/g,"")),x>0&&on(A)-m&&Us(x>32?rf(A+";",r,n,m-1):rf(Te(A," ","")+";",r,n,m-2),c);break;case 59:A+=";";default:if(Us(_=nf(A,t,n,l,f,o,i,v,I=[],E=[],m),s),C===123)if(f===0)ra(A,t,_,_,I,s,m,i,E);else switch(y===99&&ot(A,3)===110?100:y){case 100:case 108:case 109:case 115:ra(e,_,_,r&&Us(nf(e,_,_,0,0,o,i,v,o,I=[],m),E),o,E,m,i,r?I:E);break;default:ra(A,_,_,_,[""],E,0,i,E)}}l=f=x=0,h=g=1,v=A="",m=a;break;case 58:m=1+on(A),x=b;default:if(h<1){if(C==123)--h;else if(C==125&&h++==0&&S9()==125)continue}switch(A+=Qs(C),C*h){case 38:g=f>0?1:(A+="\f",-1);break;case 44:i[l++]=(on(A)-1)*g,g=1;break;case 64:sn()===45&&(A+=na(Ot())),y=sn(),f=m=on(v=A+=O9(ta())),C++;break;case 45:b===45&&on(A)==2&&(h=0)}}return s}function nf(e,t,n,r,o,s,a,i,c,l,f){for(var m=o-1,y=o===0?s:[""],x=Ic(y),b=0,h=0,p=0;b<r;++b)for(var g=0,C=jo(e,m+1,m=x9(h=a[b])),v=e;g<x;++g)(v=U0(h>0?y[g]+" "+C:Te(C,/&\f/g,y[g])))&&(c[p++]=v);return ea(e,t,n,o===0?xc:i,c,l,f)}function D9(e,t,n){return ea(e,t,n,$0,Qs(_9()),jo(e,2,-2),0)}function rf(e,t,n,r){return ea(e,t,n,vc,jo(e,0,r),jo(e,r+1,-1),r)}function zr(e,t){for(var n="",r=Ic(e),o=0;o<r;o++)n+=t(e[o],o,e,t)||"";return n}function k9(e,t,n,r){switch(e.type){case C9:if(e.children.length)break;case y9:case vc:return e.return=e.return||e.value;case $0:return"";case Q0:return e.return=e.value+"{"+zr(e.children,r)+"}";case xc:e.value=e.props.join(",")}return on(n=zr(e.children,r))?e.return=e.value+"{"+n+"}":""}function N9(e){var t=Ic(e);return function(n,r,o,s){for(var a="",i=0;i<t;i++)a+=e[i](n,r,o,s)||"";return a}}function R9(e){return function(t){t.root||(t=t.return)&&e(t)}}function M9(e){var t=Object.create(null);return function(n){return t[n]===void 0&&(t[n]=e(n)),t[n]}}var P9=function(t,n,r){for(var o=0,s=0;o=s,s=sn(),o===38&&s===12&&(n[r]=1),!Go(s);)Ot();return Vo(t,mt)},j9=function(t,n){var r=-1,o=44;do switch(Go(o)){case 0:o===38&&sn()===12&&(n[r]=1),t[r]+=P9(mt-1,n,r);break;case 2:t[r]+=na(o);break;case 4:if(o===44){t[++r]=sn()===58?"&\f":"",n[r]=t[r].length;break}default:t[r]+=Qs(o)}while(o=Ot());return t},B9=function(t,n){return tf(j9(ef(t),n))},of=new WeakMap,V9=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var n=t.value,r=t.parent,o=t.column===r.column&&t.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(t.props.length===1&&n.charCodeAt(0)!==58&&!of.get(r))&&!o){of.set(t,!0);for(var s=[],a=B9(n,s),i=r.props,c=0,l=0;c<a.length;c++)for(var f=0;f<i.length;f++,l++)t.props[l]=s[c]?a[c].replace(/&\f/g,i[f]):i[f]+" "+a[c]}}},G9=function(t){if(t.type==="decl"){var n=t.value;n.charCodeAt(0)===108&&n.charCodeAt(2)===98&&(t.return="",t.value="")}};function sf(e,t){switch(E9(e,t)){case 5103:return Ae+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Ae+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Ae+e+$s+e+st+e+e;case 6828:case 4268:return Ae+e+st+e+e;case 6165:return Ae+e+st+"flex-"+e+e;case 5187:return Ae+e+Te(e,/(\w+).+(:[^]+)/,Ae+"box-$1$2"+st+"flex-$1$2")+e;case 5443:return Ae+e+st+"flex-item-"+Te(e,/flex-|-self/,"")+e;case 4675:return Ae+e+st+"flex-line-pack"+Te(e,/align-content|flex-|-self/,"")+e;case 5548:return Ae+e+st+Te(e,"shrink","negative")+e;case 5292:return Ae+e+st+Te(e,"basis","preferred-size")+e;case 6060:return Ae+"box-"+Te(e,"-grow","")+Ae+e+st+Te(e,"grow","positive")+e;case 4554:return Ae+Te(e,/([^-])(transform)/g,"$1"+Ae+"$2")+e;case 6187:return Te(Te(Te(e,/(zoom-|grab)/,Ae+"$1"),/(image-set)/,Ae+"$1"),e,"")+e;case 5495:case 3959:return Te(e,/(image-set\([^]*)/,Ae+"$1$`$1");case 4968:return Te(Te(e,/(.+:)(flex-)?(.*)/,Ae+"box-pack:$3"+st+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ae+e+e;case 4095:case 3583:case 4068:case 2532:return Te(e,/(.+)-inline(.+)/,Ae+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(on(e)-1-t>6)switch(ot(e,t+1)){case 109:if(ot(e,t+4)!==45)break;case 102:return Te(e,/(.+:)(.+)-([^]+)/,"$1"+Ae+"$2-$3$1"+$s+(ot(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Ec(e,"stretch")?sf(Te(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(ot(e,t+1)!==115)break;case 6444:switch(ot(e,on(e)-3-(~Ec(e,"!important")&&10))){case 107:return Te(e,":",":"+Ae)+e;case 101:return Te(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Ae+(ot(e,14)===45?"inline-":"")+"box$3$1"+Ae+"$2$3$1"+st+"$2box$3")+e}break;case 5936:switch(ot(e,t+11)){case 114:return Ae+e+st+Te(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Ae+e+st+Te(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Ae+e+st+Te(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Ae+e+st+e+e}return e}var H9=function(t,n,r,o){if(t.length>-1&&!t.return)switch(t.type){case vc:t.return=sf(t.value,t.length);break;case Q0:return zr([Bo(t,{value:Te(t.value,"@","@"+Ae)})],o);case xc:if(t.length)return w9(t.props,function(s){switch(I9(s,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return zr([Bo(t,{props:[Te(s,/:(read-\w+)/,":"+$s+"$1")]})],o);case"::placeholder":return zr([Bo(t,{props:[Te(s,/:(plac\w+)/,":"+Ae+"input-$1")]}),Bo(t,{props:[Te(s,/:(plac\w+)/,":"+$s+"$1")]}),Bo(t,{props:[Te(s,/:(plac\w+)/,st+"input-$1")]})],o)}return""})}},W9=[H9],Z9=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(h){var p=h.getAttribute("data-emotion");p.indexOf(" ")!==-1&&(document.head.appendChild(h),h.setAttribute("data-s",""))})}var o=t.stylisPlugins||W9,s={},a,i=[];a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(h){for(var p=h.getAttribute("data-emotion").split(" "),g=1;g<p.length;g++)s[p[g]]=!0;i.push(h)});var c,l=[V9,G9];{var f,m=[k9,R9(function(h){f.insert(h)})],y=N9(l.concat(o,m)),x=function(p){return zr(F9(p),y)};c=function(p,g,C,v){f=C,x(p?p+"{"+g.styles+"}":g.styles),v&&(b.inserted[g.name]=!0)}}var b={key:n,sheet:new b9({key:n,container:a,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:s,registered:{},insert:c};return b.sheet.hydrate(i),b},_c={exports:{}},Oe={};/** @license React v16.13.1
598
598
  * react-is.production.min.js
@@ -1294,7 +1294,7 @@ Do you want to continue?`,Sx="Select an object to create",Ax="Select an object t
1294
1294
  `,iI="data:image/svg+xml,%3csvg%20width='124'%20height='107'%20viewBox='0%200%20124%20107'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M28.6168%2054.7446C28.6931%2052.5589%2031.0146%2051.1102%2033.0842%2051.8174C35.9985%2052.8133%2040.0375%2053.9024%2044.0621%2054.043C48.0034%2054.1806%2051.968%2053.4097%2054.8762%2052.6339C57.0264%2052.0602%2059.2927%2053.6932%2059.215%2055.9172C59.1742%2057.0856%2058.4742%2058.1269%2057.3723%2058.5178C54.8051%2059.4284%2049.7633%2060.8927%2044.3075%2060.7022C38.7694%2060.5088%2033.1999%2058.6241%2030.4004%2057.5311C29.2637%2057.0873%2028.5742%2055.9641%2028.6168%2054.7446Z'%20fill='url(%23paint0_linear_8481_102191)'/%3e%3cpath%20d='M47.223%2043.6373C44.4928%2030.7926%2052.6922%2018.1666%2065.5368%2015.4364C78.3815%2012.7062%2091.0075%2020.9055%2093.7377%2033.7502L105.079%2087.1053L84.1844%2091.5466C70.0346%2094.5542%2056.1258%2085.5217%2053.1182%2071.3719L47.223%2043.6373Z'%20fill='url(%23paint1_linear_8481_102191)'/%3e%3cmask%20id='mask0_8481_102191'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='46'%20y='14'%20width='60'%20height='79'%3e%3cpath%20d='M47.223%2043.6373C44.4928%2030.7926%2052.6922%2018.1666%2065.5368%2015.4364C78.3815%2012.7062%2091.0075%2020.9055%2093.7377%2033.7502L105.079%2087.1053L84.1844%2091.5466C70.0346%2094.5542%2056.1258%2085.5217%2053.1182%2071.3719L47.223%2043.6373Z'%20fill='white'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_8481_102191)'%3e%3cellipse%20cx='63.7775'%20cy='46.8684'%20rx='1.48152'%20ry='1.39438'%20transform='rotate(-12%2063.7775%2046.8684)'%20fill='%23435C71'/%3e%3crect%20x='47.4368'%20y='59.3203'%20width='53.657'%20height='13.2235'%20transform='rotate(-12%2047.4368%2059.3203)'%20fill='url(%23paint2_linear_8481_102191)'/%3e%3crect%20x='51.1907'%20y='76.9824'%20width='53.657'%20height='10.4263'%20transform='rotate(-12%2051.1907%2076.9824)'%20fill='url(%23paint3_linear_8481_102191)'/%3e%3c/g%3e%3cpath%20opacity='0.883952'%20d='M113.939%2051.0679C114.775%2055%20112.265%2058.865%20108.333%2059.7008L107.842%2059.8052C103.639%2060.6986%2099.5073%2058.0155%2098.6139%2053.8123L97.205%2047.1837L105.307%2045.4616C109.239%2044.6259%20113.104%2047.1359%20113.939%2051.0679Z'%20fill='url(%23paint4_linear_8481_102191)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M68.7215%2066.4138C67.1801%2064.8725%2067.6745%2062.2062%2069.587%2061.1603C72.4457%2059.5969%2076.2861%2057.1773%2079.3785%2054.0849C82.4099%2051.0535%2084.752%2047.3461%2086.2775%2044.5465C87.3388%2042.5989%2090.0598%2042.0819%2091.6282%2043.6503C92.4782%2044.5003%2092.758%2045.7623%2092.2604%2046.8566C91.0829%2049.4466%2088.5191%2054.344%2084.4346%2058.4285C80.2853%2062.5778%2074.8639%2065.591%2072.0553%2066.9952C70.9363%2067.5548%2069.6062%2067.2985%2068.7215%2066.4138Z'%20fill='url(%23paint5_linear_8481_102191)'/%3e%3crect%20x='48.7264'%20y='33.7744'%20width='11.2108'%20height='11.2108'%20rx='5.59457'%20transform='rotate(-12%2048.7264%2033.7744)'%20fill='url(%23paint6_linear_8481_102191)'/%3e%3crect%20x='50.0175'%20y='35.8193'%20width='4.0158'%20height='3.84848'%20rx='1.92424'%20transform='rotate(-12%2050.0175%2035.8193)'%20fill='%23435C71'/%3e%3crect%20x='59.2875'%20y='31.5723'%20width='11.2108'%20height='11.2108'%20rx='5.59457'%20transform='rotate(-12%2059.2875%2031.5723)'%20fill='%23FFFEFE'/%3e%3cpath%20opacity='0.883952'%20d='M111.25%2038.5376C110.415%2034.6055%20106.55%2032.0955%20102.618%2032.9313L102.127%2033.0356C97.9234%2033.9291%2095.2403%2038.0607%2096.1337%2042.2639L97.5426%2048.8925L105.644%2047.1705C109.576%2046.3347%20112.086%2042.4696%20111.25%2038.5376Z'%20fill='url(%23paint7_linear_8481_102191)'/%3e%3crect%20x='60.0181'%20y='33.8037'%20width='3.84848'%20height='3.84848'%20rx='1.90724'%20transform='rotate(-12%2060.0181%2033.8037)'%20fill='%23435C71'/%3e%3cpath%20d='M36.9246%2059.1604C36.4487%2060.717%2034.7371%2061.6271%2033.1805%2061.1512C32.3613%2060.9007%2031.7241%2060.3475%2031.3259%2059.5987L25.2059%2046.7983C24.9784%2046.3703%2025.1286%2045.8788%2025.5566%2045.6513L28.338%2044.1724C28.7659%2043.9449%2029.2574%2044.0951%2029.4849%2044.5231L36.6496%2056.8367C37.0728%2057.5036%2037.15%2058.423%2036.9246%2059.1604Z'%20fill='%23FFDF9F'/%3e%3crect%20x='27.9973'%20y='44.333'%20width='2.39869'%20height='3.59807'%20transform='rotate(152%2027.9973%2044.333)'%20fill='%23FF9090'/%3e%3cpath%20d='M26.6628%2044.3769L26.9472%2044.9118L28.0169%2044.343L26.3106%2041.1338L24.171%2042.2714L25.0243%2043.876C25.6661%2043.5347%2026.3215%2043.7351%2026.6628%2044.3769Z'%20fill='%23FFB19F'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.26386%2027.248C9.3428%2020.4481%2016.5101%2016.6372%2023.31%2018.7161C30.11%2020.7951%2033.9209%2027.9624%2031.8419%2034.7623C29.763%2041.5622%2022.5956%2045.3731%2015.7958%2043.2942C8.99587%2041.2152%205.18493%2034.0479%207.26386%2027.248ZM9.72157%2027.9983C8.06843%2033.4055%2011.1399%2039.1821%2016.5471%2040.8352C21.9543%2042.4884%2027.7309%2039.4168%2029.384%2034.0096C31.0372%2028.6024%2027.9657%2022.8258%2022.5585%2021.1727C17.1513%2019.5196%2011.3747%2022.5911%209.72157%2027.9983Z'%20fill='%23FFE69F'/%3e%3ccircle%20opacity='0.414016'%20cx='19.5529'%20cy='31.0039'%20r='10.2804'%20transform='rotate(17%2019.5529%2031.0039)'%20fill='%23BBDEFC'/%3e%3cpath%20d='M14.3685%2030.6746C15.7299%2027.6867%2018.9391%2025.9803%2022.1776%2026.5225L22.2595%2026.5475C23.7024%2026.8095%2024.3854%2024.8682%2023.1497%2024.2218C22.3806%2023.8074%2021.5613%2023.557%2020.717%2023.3884C17.3715%2022.9031%2014.0553%2024.6664%2012.6939%2027.6543C12.2796%2028.4235%2012.0859%2029.3497%2012.0244%2030.1372C11.8444%2031.6051%2013.8607%2032.0424%2014.4503%2030.6997C14.3434%2030.7566%2014.3685%2030.6746%2014.3685%2030.6746Z'%20fill='%23F6FBFF'/%3e%3cpath%20d='M10.2904%2029.0679C11.9436%2023.6607%2017.7202%2020.5893%2023.1274%2022.2424C25.6671%2023.0189%2027.5785%2024.6783%2028.9301%2026.704C27.7539%2024.1048%2025.508%2022.0744%2022.5586%2021.1727C17.1514%2019.5196%2011.3748%2022.591%209.72165%2027.9982C8.81993%2030.9476%209.32924%2033.97%2010.7444%2036.3735C9.82081%2034.1203%209.51395%2031.6077%2010.2904%2029.0679Z'%20fill='%23ADCBE7'/%3e%3cpath%20opacity='0.406087'%20d='M36.4864%2056.8021L36.1373%2056.2691C36.3845%2056.8563%2036.428%2057.5516%2036.2372%2058.1754C35.9273%2059.189%2034.5593%2059.1971%2034.0713%2058.2806L28.3787%2047.5877C28.0534%2046.9767%2027.3508%2046.7619%2026.7395%2047.0866L25.7206%2047.6277L31.4395%2059.3516C31.7648%2059.9627%2032.27%2060.5434%2032.8706%2060.8123C33.7054%2061.1528%2034.6593%2061.1034%2035.3726%2060.7247C36.0858%2060.3459%2036.6602%2059.5837%2036.8444%2058.7021C37.0351%2058.0783%2036.8117%2057.4132%2036.4864%2056.8021Z'%20fill='white'/%3e%3cpath%20d='M29.8826%2048.4977C29.8006%2048.4726%2029.6368%2048.4225%2029.5799%2048.3155L28.1579%2045.6411C28.0442%2045.4272%2028.1193%2045.1814%2028.3332%2045.0677C28.5472%2044.9539%2028.7929%2045.0291%2028.9067%2045.243L30.3287%2047.9174C30.4424%2048.1313%2030.3673%2048.3771%2030.1534%2048.4908C30.1284%2048.5728%2029.9645%2048.5227%2029.8826%2048.4977Z'%20fill='%23FFF5EB'/%3e%3cellipse%20cx='29.2637'%20cy='54.631'%20rx='1.50593'%20ry='3.17918'%20transform='rotate(-23%2029.2637%2054.631)'%20fill='%23FFC478'/%3e%3cellipse%20cx='34.0592'%20cy='52.4078'%20rx='0.920288'%20ry='1.67325'%20transform='rotate(106%2034.0592%2052.4078)'%20fill='%23FFC478'/%3e%3cpath%20d='M89.1282%2019.2055L68.2257%2026.8725L45.9197%2028.3898L44.4929%2016.4082C44.3371%2013.798%2047.5283%2011.4502%2050.9859%2011.6309L65.1429%2012.369L67.3969%2012.4869C68.5309%2012.5463%2069.7066%2012.3289%2070.7522%2011.8627L78.6899%208.34726C81.725%206.99992%2085.3012%207.87475%2086.2125%2010.1876L89.1282%2019.2055Z'%20fill='url(%23paint8_linear_8481_102191)'/%3e%3cpath%20opacity='0.479771'%20d='M88.6262%2019.0953L68.3101%2026.5288L65.3314%2012.5149L67.5211%2012.6263C68.6228%2012.6824%2069.7652%2012.471%2070.7816%2012.0192L78.4972%208.61266C81.4474%207.30707%2084.9208%208.14856%2085.8036%2010.3829L88.6262%2019.0953Z'%20fill='%23ADCBE7'/%3e%3cpath%20d='M91.6332%2026.6212L46.9517%2036.1186L46.0387%2028.4438L89.2535%2019.2582L91.6332%2026.6212Z'%20fill='%23717DAD'/%3e%3cpath%20d='M102.961%2024.2033C103.125%2024.9722%20102.371%2025.7829%20101.278%2026.015L37.9675%2039.4722C36.8754%2039.7043%2035.8568%2039.2704%2035.6933%2038.5015C35.5301%2037.7336%2036.284%2036.922%2037.3761%2036.6898L100.687%2023.2327C101.779%2023.0005%20102.798%2023.4354%20102.961%2024.2033Z'%20fill='%239ED1FF'/%3e%3cpath%20d='M102.703%2024.1718C102.838%2024.805%20102.067%2025.5045%20100.983%2025.7349L69.5583%2032.4144L69.0712%2030.123L100.496%2023.4436C101.58%2023.2131%20102.569%2023.5394%20102.703%2024.1718Z'%20fill='%2378AFE1'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_8481_102191'%20x1='32.2665'%20y1='59.6553'%20x2='59.0518'%20y2='60.5906'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FFFDE0'/%3e%3cstop%20offset='1'%20stop-color='%23FFB362'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_8481_102191'%20x1='67.3434'%20y1='85.966'%20x2='103.216'%20y2='78.3411'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FFFABC'/%3e%3cstop%20offset='1'%20stop-color='%23FFA650'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_8481_102191'%20x1='51.4347'%20y1='74.8197'%20x2='91.1539'%20y2='74.8197'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23A3C1FF'/%3e%3cstop%20offset='1'%20stop-color='%234243FF'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear_8481_102191'%20x1='55.1887'%20y1='89.2031'%20x2='94.9078'%20y2='89.2031'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23A3C1FF'/%3e%3cstop%20offset='1'%20stop-color='%234243FF'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear_8481_102191'%20x1='94.5023'%20y1='53.1799'%20x2='106.762'%20y2='58.7056'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF9498'/%3e%3cstop%20offset='1'%20stop-color='%23FFD671'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear_8481_102191'%20x1='74.9906'%20y1='66.9871'%20x2='94.9778'%20y2='46.9999'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FFFDE0'/%3e%3cstop%20offset='1'%20stop-color='%23FFB362'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint6_linear_8481_102191'%20x1='50.5805'%20y1='44.0581'%20x2='59.9372'%20y2='44.0581'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='white'/%3e%3cstop%20offset='1'%20stop-color='%23E3EEF3'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint7_linear_8481_102191'%20x1='88.4187'%20y1='43.3906'%20x2='99.3981'%20y2='25.1833'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF9498'/%3e%3cstop%20offset='1'%20stop-color='%23FFD671'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint8_linear_8481_102191'%20x1='56.4985'%20y1='29.5482'%20x2='100.532'%20y2='20.1885'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23ECF7FF'/%3e%3cstop%20offset='1'%20stop-color='%23C2E0FF'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",cI=()=>u.jsxs(d.Box,{justifyItems:"center",marginTop:"40px",children:[u.jsx("img",{src:iI,width:124,height:107}),u.jsx(d.Typography,{variant:"body2",color:d.theme.palette.gray.gray3,children:FE})]}),lI=({searchResults:e,selectedObject:t,onReset:n,fetchCards:r})=>{const o=zt(),{sendTrackingEvent:s,currentSmIds:a}=w.useContext(Ve),[i,c]=w.useState(null),l=lt(LE,{count:e.length.toString(),countSuffix:e.length>1?"s":"",searchObject:t.objectName,connectorName:t.connectorName}),f=(x,b)=>{s(k3,{search_keyword:t.label,search_result_label:b,sm_ids:a,connector_name:t.connectorName}),c({externalResourceId:x,formId:t.value.toString(),searchKeyword:t.label,searchResultLabel:b})},m=()=>{c(null),o(nx())},y=()=>{n(),r(),m()};return e.length?i?u.jsx(aI,{meta:i,onBack:m,onLink:y}):u.jsxs(d.Stack,{gap:"14px",marginTop:"12px",children:[u.jsx(d.Typography,{variant:"body2",children:l}),u.jsx(d.Stack,{gap:"17px",children:e==null?void 0:e.map(({externalResourceId:x,name:b,description:h})=>u.jsxs(_p,{onClick:()=>f(x,b),direction:"row",children:[u.jsxs(d.Stack,{flexGrow:1,children:[u.jsx(d.Typography,{variant:"body2",color:d.theme.palette.gray.gray1,children:b}),u.jsx(d.Typography,{variant:"caption",color:d.theme.palette.gray.gray3,children:h})]}),u.jsx(d.Box,{alignSelf:"center",className:"search-item__chevron",width:"20px",height:"20px",children:u.jsx("img",{src:tI})})]},x))})]}):u.jsx(cI,{})},Uc=d.styled(d.Skeleton)`
1295
1295
  display: block;
1296
1296
  margin: ${e=>e.margin?e.margin:0};
1297
- `,uI=()=>u.jsxs(d.Stack,{marginTop:"12px",children:[u.jsx(Uc,{variant:"rounded",width:"50%",height:"16px",animation:"wave",margin:"0 0 18px 0"}),u.jsx(d.Stack,{gap:"17px",children:u.jsxs(_p,{gap:"8px",disableHover:!0,children:[u.jsx(Uc,{variant:"rounded",width:"30%",height:"16px",animation:"wave"}),u.jsx(Uc,{variant:"rounded",width:"70%",height:"16px",animation:"wave"})]})})]});let Kc={};const el=new Set,dI=(e,t)=>{Kc={...Kc,[e]:t},el.forEach(n=>n())},fI=e=>(el.add(e),()=>el.delete(e)),pI=e=>w.useSyncExternalStore(fI,()=>Kc)[e],hI=async({id:e,searchString:t,args:n})=>{try{if(e===void 0||t===void 0)return[];const r=await we({url:qE.replace(":formId",e.toString()),method:Re.POST,data:{search_string:t,args:n}});let o=null;return r!=null&&r.data&&"data"in r.data&&(o=r.data.data),o}catch(r){_e({message:yn,type:qe}),console.error(r)}},gI=(e,t)=>en({mutationFn:hI,onMutate:({searchString:n,connectorName:r})=>{e(n,r)},onSuccess:(n,{searchString:r,connectorName:o})=>{t(r,n,o)}}),tl={OPEN_FORM_VIEW:"connector-agent-open-form-view"},mI=(e,t={})=>{const{delayAfterLoad:n=1e3}=t,r=w.useRef(!1),o=w.useRef(void 0),s=w.useCallback((c="auto")=>{const l=e.current;l&&l.scrollIntoView({behavior:c})},[e]),a=w.useCallback((c,l="smooth")=>{r.current||(o.current!==void 0&&clearTimeout(o.current),c&&(o.current=setTimeout(()=>{s(l),r.current=!0},n)))},[s,n]),i=w.useCallback(()=>{r.current=!1,o.current!==void 0&&clearTimeout(o.current)},[]);return w.useEffect(()=>()=>{o.current!==void 0&&clearTimeout(o.current)},[]),{scrollOnceAfterLoad:a,resetScrollState:i,hasScrolledOnce:r.current}},bI=e=>T.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.86993 0.652446C7.56922 0.248711 8.43078 0.248711 9.13007 0.652446L13.7981 3.34755C14.4974 3.75129 14.9282 4.49742 14.9282 5.30489V10.6951C14.9282 11.5026 14.4974 12.2487 13.7981 12.6524L9.13007 15.3476C8.43078 15.7513 7.56922 15.7513 6.86993 15.3476L2.20187 12.6524C1.50258 12.2487 1.0718 11.5026 1.0718 10.6951V5.30489C1.0718 4.49742 1.50258 3.75129 2.20187 3.34755L6.86993 0.652446Z",fill:"#FFD122"}),T.createElement("g",{filter:"url(#filter0_d_360_39563)"},T.createElement("path",{d:"M5.83154 4.43359V4.43359C6.84296 4.43359 7.66287 5.25351 7.66287 6.26492V11.5179V11.5179C6.65146 11.5179 5.83154 10.698 5.83154 9.68661V4.43359Z",fill:"white"})),T.createElement("g",{filter:"url(#filter1_d_360_39563)"},T.createElement("path",{d:"M8.57812 7.66211V7.66211C9.58954 7.66211 10.4095 8.48202 10.4095 9.49343V11.7103V11.7103C9.39804 11.7103 8.57812 10.8904 8.57812 9.87898V7.66211Z",fill:"white"})),T.createElement("defs",null,T.createElement("filter",{id:"filter0_d_360_39563",x:4.76488,y:3.36693,width:3.96488,height:9.21732,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},T.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),T.createElement("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),T.createElement("feOffset",null),T.createElement("feGaussianBlur",{stdDeviation:.533333}),T.createElement("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.114019 0"}),T.createElement("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_360_39563"}),T.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_360_39563",result:"shape"})),T.createElement("filter",{id:"filter1_d_360_39563",x:7.51146,y:6.59544,width:3.96488,height:6.18216,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},T.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),T.createElement("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),T.createElement("feOffset",null),T.createElement("feGaussianBlur",{stdDeviation:.533333}),T.createElement("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.114019 0"}),T.createElement("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_360_39563"}),T.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_360_39563",result:"shape"})))),yI="/v1/api/connectors/lookup/bulk",CI="/v1/api/connectors/lookup/bulk",xI=async e=>{const t=new URLSearchParams;e.forEach(o=>t.append("connector_ids",o));const n=`${yI}?${t.toString()}`,r=await we({url:n,method:Re.GET});return r==null?void 0:r.data},vI=async e=>{const t=await we({url:CI,method:Re.PUT,data:{entries:e}});return t==null?void 0:t.data},EI={fontSize:"14px",width:"209px",height:"40px",background:"#F6F8FC",borderRadius:"8px",fontWeight:400,"& .MuiOutlinedInput-notchedOutline":{borderColor:"#ECEFF6"}},II={border:`1px solid ${d.theme.palette.gray.gray5}`,borderRadius:"8px",padding:"12px"},Sp={flex:1,height:"1px",backgroundColor:d.theme.palette.gray.gray6},wI={flexShrink:0,border:`1px solid ${d.theme.palette.gray.gray6}`,borderRadius:"15px"},_I={border:`1px solid ${d.theme.palette.gray.gray6}`,backgroundColor:d.theme.palette.gray.gray6a,borderRadius:"8px",padding:"8px 10px"},SI=w.memo(function({connector:t,selectedHiverParam:n,onChange:r,sendTrackingEvent:o}){var i;const s=((i=(t.presets??[]).find(c=>c.hiverParam===n))==null?void 0:i.objectParamLabel)??"",a=w.useCallback(c=>{o(G3,{hiver_param:c.target.value,connector_name:t.connectorName,page:"agent_connector_panel"}),r(t.connectorId,c.target.value)},[t.connectorId,t.connectorName,r,o]);return u.jsxs(d.Stack,{direction:"row",alignItems:"center",gap:"0px",justifyContent:"space-between",children:[u.jsx(d.Select,{value:n,onChange:a,size:"small",variant:"outlined",sx:EI,MenuProps:{sx:{zIndex:1500}},renderValue:c=>{var f;const l=((f=(t.presets??[]).find(m=>m.hiverParam===c))==null?void 0:f.label)??"";return u.jsxs(d.Stack,{direction:"row",alignItems:"center",gap:"8px",children:[u.jsx(bI,{width:18,height:18}),u.jsx("span",{children:l})]})},children:(t.presets??[]).map(c=>u.jsx(d.MenuItem,{value:c.hiverParam,sx:{fontSize:"14px"},children:c.label},c.hiverParam))}),u.jsx(d.Box,{sx:Sp}),u.jsxs(d.Stack,{direction:"row",alignItems:"center",gap:"4px",padding:"4px 12px",sx:wI,children:[t.logo&&u.jsx("img",{src:t.logo,width:16,height:16,alt:t.connectorName}),u.jsxs(d.Typography,{variant:"body2",color:d.theme.palette.gray.gray3,children:["Matches with ",t.connectorName,"'s"]})]}),u.jsx(d.Box,{sx:Sp}),u.jsx(d.Box,{sx:_I,children:u.jsx(d.Typography,{variant:"body2",fontSize:14,children:s})})]})}),AI=w.memo(function({open:t,onClose:n,connectors:r,onSaveSuccess:o}){const{sendTrackingEvent:s}=w.useContext(Ve),[a,i]=w.useState({});w.useEffect(()=>{if(t&&r.length>0){const b={};r.filter(h=>{var p;return((p=h.presets)==null?void 0:p.length)>1}).forEach(h=>{b[h.connectorId]=h.hiverParam}),i(b)}},[t,r]);const c=wo(),{mutate:l,isPending:f}=en({mutationFn:vI,onSuccess:b=>{const h={};b.results.forEach(({connectorId:p,hiverParam:g})=>{h[p]=g}),c.setQueriesData({queryKey:["lookup","bulk"]},p=>p&&{...p,connectors:p.connectors.map(g=>h[g.connectorId]!==void 0?{...g,hiverParam:h[g.connectorId]}:g)}),s(H3,{page:"agent_connector_panel"}),_e({message:"Identity mapping saved successfully",type:"success"}),o==null||o(),n()},onError:()=>{_e({message:"Failed to save identity mapping",type:"error"})}}),m=w.useCallback(()=>{const b=Object.entries(a).map(([h,p])=>({connector_id:h,hiver_param:p}));l(b)},[a,l]),y=w.useCallback((b,h)=>{i(p=>({...p,[b]:h}))},[]),x=w.useCallback(b=>{b||n()},[n]);return u.jsx(hr,{shown:t,setShown:x,showCloseButton:!1,children:u.jsxs(d.Stack,{padding:"24px 20px",gap:"16px",sx:{minWidth:"800px"},children:[u.jsx(d.Typography,{variant:"h2",children:"Customer identity mapping"}),u.jsx(d.Typography,{variant:"body2",children:"Choose how Hiver should identify customers when fetching data from connected apps."}),r.some(b=>{var h;return((h=b.presets)==null?void 0:h.length)>1})&&u.jsx(d.Stack,{gap:"8px",sx:II,children:r.filter(b=>{var h;return((h=b.presets)==null?void 0:h.length)>1}).map(b=>u.jsx(SI,{connector:b,selectedHiverParam:a[b.connectorId]??b.hiverParam,onChange:y,sendTrackingEvent:s},b.connectorId))}),u.jsxs(d.Stack,{direction:"row",justifyContent:"flex-end",gap:"8px",children:[u.jsx(d.Button,{variant:"text",onClick:n,children:"Cancel"}),u.jsx(d.Button,{variant:"contained",onClick:m,disabled:f,children:"Save"})]})]})})}),TI=({enabled:e,...t})=>{const{actionQueue:n}=w.useContext(Ve);n&&e&&n.register(t),w.useEffect(()=>{if(n)return()=>{n.destroy()}},[n,e])},LI=({isAdmin:e=!1})=>{var fe,Ie;const{email:t,currentSmIds:n,sendTrackingEvent:r,availableFeatures:o,conversationId:s,connectorId:a}=w.useContext(Ve),i=zt(),{userGroupId:c,userId:l}=kt()||{},f=w.useRef(!1),m=w.useRef(null),y=w.useRef(null),x=w.useRef(null),[b,h]=w.useState({}),[p,g]=w.useState(!1),[C,v]=w.useState(!1),[I,E]=w.useState(!1),[_,A]=w.useState(!1),[S,L]=w.useState(),[k,D]=w.useState(!1),[N,P]=w.useState(null),[B,Y]=w.useState(),[$,H]=w.useState(null),[X,q]=w.useState(!1),[se,de]=w.useState(!1),[V,W]=w.useState(!1),M=ye(Px),G=ye(jx),z=ye(Vx),ne=ye(Gx),ae=ye(Wx),j=ye(Bx),ee=ye(J1),ve=ye(nv),J=ye(q1),Pe=ye($1),je=ye(Q1),ze=ye(sE),Mt=tt(o,Z3),In=tt(o,md),Ct=tt(o,$3),Ge=tt(o,U3),Qe=tt(o,K3),wn=tt(o,e5),Pt=(fe=kt())==null?void 0:fe.tenantPlatform,xt=tt(o,Pt==="HIVERWEB"?`hot-${bd}`:bd),{data:wr}=Ln({queryKey:["connectors","enabledAuthenticated"],queryFn:B0,enabled:xt&&e}),zn=w.useMemo(()=>(wr??[]).map(te=>te.id),[wr]),{data:jt,isSuccess:_n}=Ln({queryKey:["lookup","bulk",zn.join(",")],queryFn:()=>xI(zn),enabled:zn.length>0&&xt&&e,refetchOnMount:!1}),ho=_n&&((jt==null?void 0:jt.connectors)??[]).some(te=>{var re;return(((re=te.presets)==null?void 0:re.length)??0)>1});TI({conversationId:s,openCreateForm:()=>E(!0),enabled:G});const Yn=w.useMemo(()=>!M||!M.length?null:Yx(M,z,ne),[M,z,ne]),_r=b5(z),{data:Sr,isLoading:Jn}=Ip({senderEmail:t,conversationId:String(s),enabled:Ge&&!!t}),{emailHeaders:go,selectedEmail:he}=Sr??{},{scrollOnceAfterLoad:Ee,resetScrollState:et}=mI(y),it=j!==K.LOADING&&(!ne||!Object.values(ne).some(te=>te===K.LOADING))&&M&&M.length>0;w.useLayoutEffect(()=>{var te;X&&!p&&se&&((te=x==null?void 0:x.current)!=null&&te.scrollHeight)&&Ee(!!it,"smooth")},[X,p,se,it,Ee,(Ie=x==null?void 0:x.current)==null?void 0:Ie.scrollHeight,l]);const vt=(te,re)=>{r(O3,{search_keyword:te,sm_ids:n,connector_name:re,suggestion_type:ze})},Ut=(te,re,pe)=>{!Array.isArray(re)||!re.length?r(F3,{search_keyword:te,sm_ids:n,connector_name:pe,suggestion_type:ze}):re.length&&r(D3,{num_of_results:re.length,search_keyword:te,sm_ids:n,connector_name:pe,suggestion_type:ze})},{mutate:Kt,reset:Et,data:Bt,isPending:Ar,isIdle:mo}=gI(vt,Ut),Tr=w.useCallback(()=>{Et(),P(null)},[Et,P]),Sn=wo(),hn=w.useCallback(()=>{t&&n.length&&s&&i(La({inboxIds:n,conversationId:s,connectorId:a}))},[i,t,n,s,a]),Ra=w.useCallback(()=>{Sn.invalidateQueries({queryKey:["lookup","bulk"]}),hn()},[Sn,hn]),ns=w.useCallback((te,re)=>{te&&s&&re&&i(Ta({id:te,channelType:"email",conversationId:s,externalResourceId:re,contactEmail:t})).unwrap().catch(()=>{i(Qr(null))})},[i,s,t]);if(w.useEffect(()=>{(async()=>{l&&(q(await hi(l)),de(await du(l)))})()},[l]),w.useEffect(()=>{Jn||Y(he||t)},[t,he,Jn]),w.useEffect(()=>{B&&s&&dI(String(s),B)},[B,s]),w.useEffect(()=>{se&&l&&fu(l)},[se,l]),w.useEffect(()=>{var te;if(Pe){v(!0);const{externalResourceId:re}=Pe,pe=(te=Pe.forms.find(He=>He.type==="edit"))==null?void 0:te.id;ns(pe,re)}else v(!1),i(Dx())},[Pe,ns,i]),w.useEffect(()=>(hn(),et(),()=>{i(z1.clearConnectorList())}),[i,hn,et]),w.useEffect(()=>{if(ae&&M&&M.length&&Yn&&!f.current){const{cards_per_app:te,total_empty_cards:re,total_cards_with_errors:pe}=Yn;r(o3,{numOfCards:M.length,total_cards_loaded:M.length,total_empty_cards:re,total_cards_with_errors:pe,cards_per_app:te,sm_ids:n}),f.current=!0}return()=>{f.current=!1}},[ae,M,Yn,r,n]),w.useEffect(()=>{s&&n&&n.length&&i(Ia({inboxIds:n,conversationId:s,channelType:"email",isExpandedFormEnabled:wn,connectorId:a}))},[i,n,s,wn,a]),w.useEffect(()=>{const te=re=>{var He;if(!(re instanceof CustomEvent))return;const pe=(He=re.detail)==null?void 0:He.connectorKey;h({connectorKey:pe})};return window.addEventListener(tl.OPEN_FORM_VIEW,te),()=>{window.removeEventListener(tl.OPEN_FORM_VIEW,te)}},[]),w.useEffect(()=>{if(!(ee!=null&&ee.length)||!b.connectorKey)return;const te=b.connectorKey;h({});const re=ee.find(pe=>{var He;return((He=pe.connectorKey)==null?void 0:He.toLowerCase())===(te==null?void 0:te.toLowerCase())});re&&(H(re),E(!0))},[ee,b]),!t.length||j===K.LOADING)return u.jsx(Zv,{});const hl=te=>{r(l3,{connector_name:ve,source:te,sm_ids:n})},Ma=te=>{E(!0),hl(te)},Pa=()=>{A(!0),r(u3)},rs=te=>{r(te,S),je?D(!0):(E(!1),H(null))},ja=te=>{if(Pe){const{connectorName:re,title:pe}=Pe;r(te,{connector_name:re,card_title:pe,sm_ids:n,ug_id:c})}je?D(!0):i(Qr(null))},gl=()=>{E(!1),i(Qr(null)),L(void 0),D(!1)},Ba=()=>{hn(),i(z1.clearConnectorList())},ml=[{label:"Go back",variant:"text",action:gl},{label:"Stay",variant:"contained",action:()=>D(!1)}],O=ee.length>0,Z=J.length>0,Q=()=>O||Z?u.jsx(vE,{haveCreateObjects:O,haveLinkObjects:Z,onCreateClick:()=>Ma(Ld.MAIN_BUTTON),onLinkClick:()=>A(!0)}):u.jsx(ep,{isAdmin:e,hideHeading:!0});return u.jsxs(Bd,{ref:m,"data-testid":Array.isArray(M)?"connector-agent":"loading",id:"connector-agent-container",stopOverflow:I||_,children:[u.jsx(dp,{shown:k,setShown:D,title:wx,description:_x,buttons:ml}),u.jsx($5,{onWheel:()=>g(!0),ref:x,children:G?u.jsxs(u.Fragment,{children:[u.jsx(T4,{connectors:_r,isWriteFlowEnabled:In,haveCreateObjects:O,haveLinkObjects:Z,cards:M,handleCreateNewObject:()=>Ma(Ld.ICON),handleLinkNewObject:Pa}),Ct?u.jsx(eI,{selectedObject:N,setSelectedObject:P,fetchSearchResults:Kt,onReset:Tr,root:m.current}):null,u.jsxs(Ur,{children:[u.jsx(Kr,{condition:Ct&&Ar,children:u.jsx(uI,{})},"search"),u.jsx(Kr,{condition:Ct&&!!N&&!mo,children:u.jsx(lI,{searchResults:Bt??[],selectedObject:N,onReset:Tr,fetchCards:hn})},"results"),u.jsxs(Kr,{fallback:!0,children:[Ge&&(M!=null&&M.length)?u.jsxs(d.Stack,{direction:"row",alignItems:"center",gap:"8px",children:[u.jsx(d.Stack,{sx:{flex:1,minWidth:0},children:u.jsx(eE,{emailHeaders:go,selectedEmail:B,root:m.current,isLoading:Jn,setSelectedEmail:Y})}),xt&&ho&&e&&u.jsx(d.Tooltip,{title:"Update customer identity mapping",placement:"top",children:u.jsx(d.IconButton,{"aria-label":"Open customer identity mapping settings",sx:{height:"32px",width:"32px",marginTop:"12px",flexShrink:0},onClick:()=>{r(gd,{page:"agent_connector_panel"}),W(!0)},children:u.jsx(d.icons.SettingsOutlined,{sx:{height:"20px",width:"20px"}})})})]}):null,!Ge&&xt&&ho&&e&&(M!=null&&M.length)?u.jsx(d.Button,{fullWidth:!0,variant:"contained",startIcon:u.jsx(d.icons.SettingsOutlined,{sx:{height:"14px",width:"14px"}}),sx:{backgroundColor:"#edf1f6",color:"#4d596c",borderRadius:"6px",padding:"9px 12px",marginTop:"12px",textTransform:"none",fontWeight:500,fontSize:"14px",lineHeight:"20px",boxShadow:"none","&:hover":{backgroundColor:"#e2e8f0",boxShadow:"none"}},onClick:()=>{r(gd,{page:"agent_connector_panel"}),W(!0)},children:"Customer identity mapping"}):null,Mt?u.jsx(Xv,{}):null,u.jsxs(Ur,{children:[u.jsxs(Kr,{condition:!!M&&M.length>0,children:[u.jsx(Cv,{cards:M,specificCardData:z,email:B??"",specificConnectorApiStatus:ne,onCardUnlinking:hn}),u.jsx("div",{ref:y,children:Qe?u.jsx(L5,{connectors:_r,expanded:X}):null})]},"cards-list"),u.jsx(Kr,{condition:!(M!=null&&M.length)&&In,children:Q()},"create-banner")]})]},"cards")]})]}):u.jsx(ep,{isAdmin:e})}),u.jsx(qc,{onClose:()=>ja(I3),isOpen:C,setIsOpen:v,title:l5,portalId:"connector-layover-portal",backButtonTooltip:"Back",children:u.jsx(pp,{isEdit:!0,onClose:()=>ja(E3),onCreateSuccess:Ba,metaData:S,setMetaData:L})}),u.jsx(qc,{onClose:()=>rs(m3),portalId:"connector-layover-portal",isOpen:I,setIsOpen:E,children:u.jsx(pp,{onClose:()=>rs(g3),onCreateSuccess:Ba,metaData:S,setMetaData:L,defaultOption:$})}),u.jsx(qc,{onClose:()=>A(!1),portalId:"connector-layover-portal",isOpen:_,setIsOpen:A,children:u.jsx(mE,{setOpenTaskLinking:A,onLinkingSuccess:hn})}),!G&&u.jsx(G5,{}),xt&&u.jsx(AI,{open:V,onClose:()=>W(!1),connectors:(jt==null?void 0:jt.connectors)??[],onSaveSuccess:Ra})]})},OI=({children:e,sendTrackingEvent:t,contactEmail:n,baseUrls:r={},currentSmIds:o=[],userEmail:s,metaData:a,availableFeatures:i,conversationId:c,connectorFunctions:l,stackingContext:f,isAdmin:m=!1,actionQueue:y,store:x})=>{const[b,h]=w.useState(void 0);w.useEffect(()=>{if(!x)return;const g=x.subscribe(C=>{h(C)},"connectorId");return()=>g()},[x]);const p=w.useMemo(()=>({userEmail:s,email:n,baseUrls:r,currentSmIds:o,metaData:a,conversationId:c,sendTrackingEvent:t||(()=>{}),availableFeatures:i,isAdmin:m,connectorFunctions:l,stackingContext:f,actionQueue:y,store:x,connectorId:b}),[s,n,r,t,o,a,i,c,m,l,f,y,x,b]);return u.jsx(Ve.Provider,{value:p,children:e})},nl=({children:e})=>{const[t]=w.useState(()=>new N2);return u.jsx(B2,{client:t,children:e})},FI=t0({cardList:Kx,write:kx,common:ox}),rl=Jb({reducer:FI,devTools:!0}),DI=({children:e,userEmail:t,extraParams:n,contactEmail:r,baseUrls:o,availableFeatures:s,connectorFunctions:a,stackingContext:i,actionQueue:c,store:l})=>u.jsx(Ki,{store:rl,children:u.jsx(d.HiverProvider,{custom:!0,children:u.jsx(nl,{children:u.jsx(OI,{userEmail:t,availableFeatures:s,sendTrackingEvent:n==null?void 0:n.sendTrackingEvent,contactEmail:r,currentSmIds:n==null?void 0:n.currentSmIds,metaData:n==null?void 0:n.metaData,conversationId:n==null?void 0:n.conversationId,baseUrls:o,connectorFunctions:a,stackingContext:i,actionQueue:c,isAdmin:n==null?void 0:n.isAdmin,store:l,children:u.jsx(w.Suspense,{fallback:u.jsx(u.Fragment,{}),children:e})})})})}),ol=d.styled(d.Box)`
1297
+ `,uI=()=>u.jsxs(d.Stack,{marginTop:"12px",children:[u.jsx(Uc,{variant:"rounded",width:"50%",height:"16px",animation:"wave",margin:"0 0 18px 0"}),u.jsx(d.Stack,{gap:"17px",children:u.jsxs(_p,{gap:"8px",disableHover:!0,children:[u.jsx(Uc,{variant:"rounded",width:"30%",height:"16px",animation:"wave"}),u.jsx(Uc,{variant:"rounded",width:"70%",height:"16px",animation:"wave"})]})})]});let Kc={};const el=new Set,dI=(e,t)=>{Kc={...Kc,[e]:t},el.forEach(n=>n())},fI=e=>(el.add(e),()=>el.delete(e)),pI=e=>w.useSyncExternalStore(fI,()=>Kc)[e],hI=async({id:e,searchString:t,args:n})=>{try{if(e===void 0||t===void 0)return[];const r=await we({url:qE.replace(":formId",e.toString()),method:Re.POST,data:{search_string:t,args:n}});let o=null;return r!=null&&r.data&&"data"in r.data&&(o=r.data.data),o}catch(r){_e({message:yn,type:qe}),console.error(r)}},gI=(e,t)=>en({mutationFn:hI,onMutate:({searchString:n,connectorName:r})=>{e(n,r)},onSuccess:(n,{searchString:r,connectorName:o})=>{t(r,n,o)}}),tl={OPEN_FORM_VIEW:"connector-agent-open-form-view"},mI=(e,t={})=>{const{delayAfterLoad:n=1e3}=t,r=w.useRef(!1),o=w.useRef(void 0),s=w.useCallback((c="auto")=>{const l=e.current;l&&l.scrollIntoView({behavior:c})},[e]),a=w.useCallback((c,l="smooth")=>{r.current||(o.current!==void 0&&clearTimeout(o.current),c&&(o.current=setTimeout(()=>{s(l),r.current=!0},n)))},[s,n]),i=w.useCallback(()=>{r.current=!1,o.current!==void 0&&clearTimeout(o.current)},[]);return w.useEffect(()=>()=>{o.current!==void 0&&clearTimeout(o.current)},[]),{scrollOnceAfterLoad:a,resetScrollState:i,hasScrolledOnce:r.current}},bI=e=>T.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},T.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.86993 0.652446C7.56922 0.248711 8.43078 0.248711 9.13007 0.652446L13.7981 3.34755C14.4974 3.75129 14.9282 4.49742 14.9282 5.30489V10.6951C14.9282 11.5026 14.4974 12.2487 13.7981 12.6524L9.13007 15.3476C8.43078 15.7513 7.56922 15.7513 6.86993 15.3476L2.20187 12.6524C1.50258 12.2487 1.0718 11.5026 1.0718 10.6951V5.30489C1.0718 4.49742 1.50258 3.75129 2.20187 3.34755L6.86993 0.652446Z",fill:"#FFD122"}),T.createElement("g",{filter:"url(#filter0_d_360_39563)"},T.createElement("path",{d:"M5.83154 4.43359V4.43359C6.84296 4.43359 7.66287 5.25351 7.66287 6.26492V11.5179V11.5179C6.65146 11.5179 5.83154 10.698 5.83154 9.68661V4.43359Z",fill:"white"})),T.createElement("g",{filter:"url(#filter1_d_360_39563)"},T.createElement("path",{d:"M8.57812 7.66211V7.66211C9.58954 7.66211 10.4095 8.48202 10.4095 9.49343V11.7103V11.7103C9.39804 11.7103 8.57812 10.8904 8.57812 9.87898V7.66211Z",fill:"white"})),T.createElement("defs",null,T.createElement("filter",{id:"filter0_d_360_39563",x:4.76488,y:3.36693,width:3.96488,height:9.21732,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},T.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),T.createElement("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),T.createElement("feOffset",null),T.createElement("feGaussianBlur",{stdDeviation:.533333}),T.createElement("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.114019 0"}),T.createElement("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_360_39563"}),T.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_360_39563",result:"shape"})),T.createElement("filter",{id:"filter1_d_360_39563",x:7.51146,y:6.59544,width:3.96488,height:6.18216,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},T.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),T.createElement("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),T.createElement("feOffset",null),T.createElement("feGaussianBlur",{stdDeviation:.533333}),T.createElement("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.114019 0"}),T.createElement("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_360_39563"}),T.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_360_39563",result:"shape"})))),yI="/v1/api/connectors/lookup/bulk",CI="/v1/api/connectors/lookup/bulk",xI=async e=>{const t=new URLSearchParams;e.forEach(o=>t.append("connector_ids",o));const n=`${yI}?${t.toString()}`,r=await we({url:n,method:Re.GET});return r==null?void 0:r.data},vI=async e=>{const t=await we({url:CI,method:Re.PUT,data:{entries:e}});return t==null?void 0:t.data},EI={fontSize:"14px",width:"209px",height:"40px",background:"#F6F8FC",borderRadius:"8px",fontWeight:400,"& .MuiOutlinedInput-notchedOutline":{borderColor:"#ECEFF6"}},II={border:`1px solid ${d.theme.palette.gray.gray5}`,borderRadius:"8px",padding:"12px"},Sp={flex:1,height:"1px",backgroundColor:d.theme.palette.gray.gray6},wI={flexShrink:0,border:`1px solid ${d.theme.palette.gray.gray6}`,borderRadius:"15px"},_I={border:`1px solid ${d.theme.palette.gray.gray6}`,backgroundColor:d.theme.palette.gray.gray6a,borderRadius:"8px",padding:"8px 10px"},SI=w.memo(function({connector:t,selectedHiverParam:n,onChange:r,sendTrackingEvent:o}){var i;const s=((i=(t.presets??[]).find(c=>c.hiverParam===n))==null?void 0:i.objectParamLabel)??"",a=w.useCallback(c=>{o(G3,{hiver_param:c.target.value,connector_name:t.connectorName,page:"agent_connector_panel"}),r(t.connectorId,c.target.value)},[t.connectorId,t.connectorName,r,o]);return u.jsxs(d.Stack,{direction:"row",alignItems:"center",gap:"0px",justifyContent:"space-between",children:[u.jsx(d.Select,{value:n,onChange:a,size:"small",variant:"outlined",sx:EI,MenuProps:{sx:{zIndex:1500}},renderValue:c=>{var f;const l=((f=(t.presets??[]).find(m=>m.hiverParam===c))==null?void 0:f.label)??"";return u.jsxs(d.Stack,{direction:"row",alignItems:"center",gap:"8px",children:[u.jsx(bI,{width:18,height:18}),u.jsx("span",{children:l})]})},children:(t.presets??[]).map(c=>u.jsx(d.MenuItem,{value:c.hiverParam,sx:{fontSize:"14px"},children:c.label},c.hiverParam))}),u.jsx(d.Box,{sx:Sp}),u.jsxs(d.Stack,{direction:"row",alignItems:"center",gap:"4px",padding:"4px 12px",sx:wI,children:[t.logo&&u.jsx("img",{src:t.logo,width:16,height:16,alt:t.connectorName}),u.jsxs(d.Typography,{variant:"body2",color:d.theme.palette.gray.gray3,children:["Matches with ",t.connectorName,"'s"]})]}),u.jsx(d.Box,{sx:Sp}),u.jsx(d.Box,{sx:_I,children:u.jsx(d.Typography,{variant:"body2",fontSize:14,children:s})})]})}),AI=w.memo(function({open:t,onClose:n,connectors:r,onSaveSuccess:o}){const{sendTrackingEvent:s}=w.useContext(Ve),[a,i]=w.useState({});w.useEffect(()=>{if(t&&r.length>0){const b={};r.filter(h=>{var p;return((p=h.presets)==null?void 0:p.length)>1}).forEach(h=>{b[h.connectorId]=h.hiverParam}),i(b)}},[t,r]);const c=wo(),{mutate:l,isPending:f}=en({mutationFn:vI,onSuccess:b=>{const h={};b.results.forEach(({connectorId:p,hiverParam:g})=>{h[p]=g}),c.setQueriesData({queryKey:["lookup","bulk"]},p=>p&&{...p,connectors:p.connectors.map(g=>h[g.connectorId]!==void 0?{...g,hiverParam:h[g.connectorId]}:g)}),s(H3,{page:"agent_connector_panel"}),_e({message:"Identity mapping saved successfully",type:"success"}),o==null||o(),n()},onError:()=>{_e({message:"Failed to save identity mapping",type:"error"})}}),m=w.useCallback(()=>{const b=Object.entries(a).map(([h,p])=>({connector_id:h,hiver_param:p}));l(b)},[a,l]),y=w.useCallback((b,h)=>{i(p=>({...p,[b]:h}))},[]),x=w.useCallback(b=>{b||n()},[n]);return u.jsx(hr,{shown:t,setShown:x,showCloseButton:!1,children:u.jsxs(d.Stack,{padding:"24px 20px",gap:"16px",sx:{minWidth:"800px"},children:[u.jsx(d.Typography,{variant:"h2",children:"Customer identity mapping"}),u.jsx(d.Typography,{variant:"body2",children:"Choose how Hiver should identify customers when fetching data from connected apps."}),r.some(b=>{var h;return((h=b.presets)==null?void 0:h.length)>1})&&u.jsx(d.Stack,{gap:"8px",sx:II,children:r.filter(b=>{var h;return((h=b.presets)==null?void 0:h.length)>1}).map(b=>u.jsx(SI,{connector:b,selectedHiverParam:a[b.connectorId]??b.hiverParam,onChange:y,sendTrackingEvent:s},b.connectorId))}),u.jsxs(d.Stack,{direction:"row",justifyContent:"flex-end",gap:"8px",children:[u.jsx(d.Button,{variant:"text",onClick:n,children:"Cancel"}),u.jsx(d.Button,{variant:"contained",onClick:m,disabled:f,children:"Save"})]})]})})}),TI=({enabled:e,...t})=>{const{actionQueue:n}=w.useContext(Ve);n&&e&&n.register(t),w.useEffect(()=>{if(n)return()=>{n.destroy()}},[n,e])},LI=({isAdmin:e=!1})=>{var fe,Ie;const{email:t,currentSmIds:n,sendTrackingEvent:r,availableFeatures:o,conversationId:s,connectorId:a}=w.useContext(Ve),i=zt(),{userGroupId:c,userId:l}=kt()||{},f=w.useRef(!1),m=w.useRef(null),y=w.useRef(null),x=w.useRef(null),[b,h]=w.useState({}),[p,g]=w.useState(!1),[C,v]=w.useState(!1),[I,E]=w.useState(!1),[_,A]=w.useState(!1),[S,L]=w.useState(),[k,D]=w.useState(!1),[N,P]=w.useState(null),[B,Y]=w.useState(),[$,H]=w.useState(null),[X,q]=w.useState(!1),[se,de]=w.useState(!1),[V,W]=w.useState(!1),M=ye(Px),G=ye(jx),z=ye(Vx),ne=ye(Gx),ae=ye(Wx),j=ye(Bx),ee=ye(J1),ve=ye(nv),J=ye(q1),Pe=ye($1),je=ye(Q1),ze=ye(sE),Mt=tt(o,Z3),In=tt(o,md),Ct=tt(o,$3),Ge=tt(o,U3),Qe=tt(o,K3),wn=tt(o,e5),Pt=(fe=kt())==null?void 0:fe.tenantPlatform,xt=tt(o,Pt==="HIVERWEB"?`hot-${bd}`:bd),{data:wr}=Ln({queryKey:["connectors","enabledAuthenticated"],queryFn:()=>B0(),enabled:xt&&e}),zn=w.useMemo(()=>(wr??[]).map(te=>te.id),[wr]),{data:jt,isSuccess:_n}=Ln({queryKey:["lookup","bulk",zn.join(",")],queryFn:()=>xI(zn),enabled:zn.length>0&&xt&&e,refetchOnMount:!1}),ho=_n&&((jt==null?void 0:jt.connectors)??[]).some(te=>{var re;return(((re=te.presets)==null?void 0:re.length)??0)>1});TI({conversationId:s,openCreateForm:()=>E(!0),enabled:G});const Yn=w.useMemo(()=>!M||!M.length?null:Yx(M,z,ne),[M,z,ne]),_r=b5(z),{data:Sr,isLoading:Jn}=Ip({senderEmail:t,conversationId:String(s),enabled:Ge&&!!t}),{emailHeaders:go,selectedEmail:he}=Sr??{},{scrollOnceAfterLoad:Ee,resetScrollState:et}=mI(y),it=j!==K.LOADING&&(!ne||!Object.values(ne).some(te=>te===K.LOADING))&&M&&M.length>0;w.useLayoutEffect(()=>{var te;X&&!p&&se&&((te=x==null?void 0:x.current)!=null&&te.scrollHeight)&&Ee(!!it,"smooth")},[X,p,se,it,Ee,(Ie=x==null?void 0:x.current)==null?void 0:Ie.scrollHeight,l]);const vt=(te,re)=>{r(O3,{search_keyword:te,sm_ids:n,connector_name:re,suggestion_type:ze})},Ut=(te,re,pe)=>{!Array.isArray(re)||!re.length?r(F3,{search_keyword:te,sm_ids:n,connector_name:pe,suggestion_type:ze}):re.length&&r(D3,{num_of_results:re.length,search_keyword:te,sm_ids:n,connector_name:pe,suggestion_type:ze})},{mutate:Kt,reset:Et,data:Bt,isPending:Ar,isIdle:mo}=gI(vt,Ut),Tr=w.useCallback(()=>{Et(),P(null)},[Et,P]),Sn=wo(),hn=w.useCallback(()=>{t&&n.length&&s&&i(La({inboxIds:n,conversationId:s,connectorId:a}))},[i,t,n,s,a]),Ra=w.useCallback(()=>{Sn.invalidateQueries({queryKey:["lookup","bulk"]}),hn()},[Sn,hn]),ns=w.useCallback((te,re)=>{te&&s&&re&&i(Ta({id:te,channelType:"email",conversationId:s,externalResourceId:re,contactEmail:t})).unwrap().catch(()=>{i(Qr(null))})},[i,s,t]);if(w.useEffect(()=>{(async()=>{l&&(q(await hi(l)),de(await du(l)))})()},[l]),w.useEffect(()=>{Jn||Y(he||t)},[t,he,Jn]),w.useEffect(()=>{B&&s&&dI(String(s),B)},[B,s]),w.useEffect(()=>{se&&l&&fu(l)},[se,l]),w.useEffect(()=>{var te;if(Pe){v(!0);const{externalResourceId:re}=Pe,pe=(te=Pe.forms.find(He=>He.type==="edit"))==null?void 0:te.id;ns(pe,re)}else v(!1),i(Dx())},[Pe,ns,i]),w.useEffect(()=>(hn(),et(),()=>{i(z1.clearConnectorList())}),[i,hn,et]),w.useEffect(()=>{if(ae&&M&&M.length&&Yn&&!f.current){const{cards_per_app:te,total_empty_cards:re,total_cards_with_errors:pe}=Yn;r(o3,{numOfCards:M.length,total_cards_loaded:M.length,total_empty_cards:re,total_cards_with_errors:pe,cards_per_app:te,sm_ids:n}),f.current=!0}return()=>{f.current=!1}},[ae,M,Yn,r,n]),w.useEffect(()=>{s&&n&&n.length&&i(Ia({inboxIds:n,conversationId:s,channelType:"email",isExpandedFormEnabled:wn,connectorId:a}))},[i,n,s,wn,a]),w.useEffect(()=>{const te=re=>{var He;if(!(re instanceof CustomEvent))return;const pe=(He=re.detail)==null?void 0:He.connectorKey;h({connectorKey:pe})};return window.addEventListener(tl.OPEN_FORM_VIEW,te),()=>{window.removeEventListener(tl.OPEN_FORM_VIEW,te)}},[]),w.useEffect(()=>{if(!(ee!=null&&ee.length)||!b.connectorKey)return;const te=b.connectorKey;h({});const re=ee.find(pe=>{var He;return((He=pe.connectorKey)==null?void 0:He.toLowerCase())===(te==null?void 0:te.toLowerCase())});re&&(H(re),E(!0))},[ee,b]),!t.length||j===K.LOADING)return u.jsx(Zv,{});const hl=te=>{r(l3,{connector_name:ve,source:te,sm_ids:n})},Ma=te=>{E(!0),hl(te)},Pa=()=>{A(!0),r(u3)},rs=te=>{r(te,S),je?D(!0):(E(!1),H(null))},ja=te=>{if(Pe){const{connectorName:re,title:pe}=Pe;r(te,{connector_name:re,card_title:pe,sm_ids:n,ug_id:c})}je?D(!0):i(Qr(null))},gl=()=>{E(!1),i(Qr(null)),L(void 0),D(!1)},Ba=()=>{hn(),i(z1.clearConnectorList())},ml=[{label:"Go back",variant:"text",action:gl},{label:"Stay",variant:"contained",action:()=>D(!1)}],O=ee.length>0,Z=J.length>0,Q=()=>O||Z?u.jsx(vE,{haveCreateObjects:O,haveLinkObjects:Z,onCreateClick:()=>Ma(Ld.MAIN_BUTTON),onLinkClick:()=>A(!0)}):u.jsx(ep,{isAdmin:e,hideHeading:!0});return u.jsxs(Bd,{ref:m,"data-testid":Array.isArray(M)?"connector-agent":"loading",id:"connector-agent-container",stopOverflow:I||_,children:[u.jsx(dp,{shown:k,setShown:D,title:wx,description:_x,buttons:ml}),u.jsx($5,{onWheel:()=>g(!0),ref:x,children:G?u.jsxs(u.Fragment,{children:[u.jsx(T4,{connectors:_r,isWriteFlowEnabled:In,haveCreateObjects:O,haveLinkObjects:Z,cards:M,handleCreateNewObject:()=>Ma(Ld.ICON),handleLinkNewObject:Pa}),Ct?u.jsx(eI,{selectedObject:N,setSelectedObject:P,fetchSearchResults:Kt,onReset:Tr,root:m.current}):null,u.jsxs(Ur,{children:[u.jsx(Kr,{condition:Ct&&Ar,children:u.jsx(uI,{})},"search"),u.jsx(Kr,{condition:Ct&&!!N&&!mo,children:u.jsx(lI,{searchResults:Bt??[],selectedObject:N,onReset:Tr,fetchCards:hn})},"results"),u.jsxs(Kr,{fallback:!0,children:[Ge&&(M!=null&&M.length)?u.jsxs(d.Stack,{direction:"row",alignItems:"center",gap:"8px",children:[u.jsx(d.Stack,{sx:{flex:1,minWidth:0},children:u.jsx(eE,{emailHeaders:go,selectedEmail:B,root:m.current,isLoading:Jn,setSelectedEmail:Y})}),xt&&ho&&e&&u.jsx(d.Tooltip,{title:"Update customer identity mapping",placement:"top",children:u.jsx(d.IconButton,{"aria-label":"Open customer identity mapping settings",sx:{height:"32px",width:"32px",marginTop:"12px",flexShrink:0},onClick:()=>{r(gd,{page:"agent_connector_panel"}),W(!0)},children:u.jsx(d.icons.SettingsOutlined,{sx:{height:"20px",width:"20px"}})})})]}):null,!Ge&&xt&&ho&&e&&(M!=null&&M.length)?u.jsx(d.Button,{fullWidth:!0,variant:"contained",startIcon:u.jsx(d.icons.SettingsOutlined,{sx:{height:"14px",width:"14px"}}),sx:{backgroundColor:"#edf1f6",color:"#4d596c",borderRadius:"6px",padding:"9px 12px",marginTop:"12px",textTransform:"none",fontWeight:500,fontSize:"14px",lineHeight:"20px",boxShadow:"none","&:hover":{backgroundColor:"#e2e8f0",boxShadow:"none"}},onClick:()=>{r(gd,{page:"agent_connector_panel"}),W(!0)},children:"Customer identity mapping"}):null,Mt?u.jsx(Xv,{}):null,u.jsxs(Ur,{children:[u.jsxs(Kr,{condition:!!M&&M.length>0,children:[u.jsx(Cv,{cards:M,specificCardData:z,email:B??"",specificConnectorApiStatus:ne,onCardUnlinking:hn}),u.jsx("div",{ref:y,children:Qe?u.jsx(L5,{connectors:_r,expanded:X}):null})]},"cards-list"),u.jsx(Kr,{condition:!(M!=null&&M.length)&&In,children:Q()},"create-banner")]})]},"cards")]})]}):u.jsx(ep,{isAdmin:e})}),u.jsx(qc,{onClose:()=>ja(I3),isOpen:C,setIsOpen:v,title:l5,portalId:"connector-layover-portal",backButtonTooltip:"Back",children:u.jsx(pp,{isEdit:!0,onClose:()=>ja(E3),onCreateSuccess:Ba,metaData:S,setMetaData:L})}),u.jsx(qc,{onClose:()=>rs(m3),portalId:"connector-layover-portal",isOpen:I,setIsOpen:E,children:u.jsx(pp,{onClose:()=>rs(g3),onCreateSuccess:Ba,metaData:S,setMetaData:L,defaultOption:$})}),u.jsx(qc,{onClose:()=>A(!1),portalId:"connector-layover-portal",isOpen:_,setIsOpen:A,children:u.jsx(mE,{setOpenTaskLinking:A,onLinkingSuccess:hn})}),!G&&u.jsx(G5,{}),xt&&u.jsx(AI,{open:V,onClose:()=>W(!1),connectors:(jt==null?void 0:jt.connectors)??[],onSaveSuccess:Ra})]})},OI=({children:e,sendTrackingEvent:t,contactEmail:n,baseUrls:r={},currentSmIds:o=[],userEmail:s,metaData:a,availableFeatures:i,conversationId:c,connectorFunctions:l,stackingContext:f,isAdmin:m=!1,actionQueue:y,store:x})=>{const[b,h]=w.useState(void 0);w.useEffect(()=>{if(!x)return;const g=x.subscribe(C=>{h(C)},"connectorId");return()=>g()},[x]);const p=w.useMemo(()=>({userEmail:s,email:n,baseUrls:r,currentSmIds:o,metaData:a,conversationId:c,sendTrackingEvent:t||(()=>{}),availableFeatures:i,isAdmin:m,connectorFunctions:l,stackingContext:f,actionQueue:y,store:x,connectorId:b}),[s,n,r,t,o,a,i,c,m,l,f,y,x,b]);return u.jsx(Ve.Provider,{value:p,children:e})},nl=({children:e})=>{const[t]=w.useState(()=>new N2);return u.jsx(B2,{client:t,children:e})},FI=t0({cardList:Kx,write:kx,common:ox}),rl=Jb({reducer:FI,devTools:!0}),DI=({children:e,userEmail:t,extraParams:n,contactEmail:r,baseUrls:o,availableFeatures:s,connectorFunctions:a,stackingContext:i,actionQueue:c,store:l})=>u.jsx(Ki,{store:rl,children:u.jsx(d.HiverProvider,{custom:!0,children:u.jsx(nl,{children:u.jsx(OI,{userEmail:t,availableFeatures:s,sendTrackingEvent:n==null?void 0:n.sendTrackingEvent,contactEmail:r,currentSmIds:n==null?void 0:n.currentSmIds,metaData:n==null?void 0:n.metaData,conversationId:n==null?void 0:n.conversationId,baseUrls:o,connectorFunctions:a,stackingContext:i,actionQueue:c,isAdmin:n==null?void 0:n.isAdmin,store:l,children:u.jsx(w.Suspense,{fallback:u.jsx(u.Fragment,{}),children:e})})})})}),ol=d.styled(d.Box)`
1298
1298
  height: inherit;
1299
1299
  .MuiScopedCssBaseline-root {
1300
1300
  height: inherit;
@@ -2675,4 +2675,4 @@ Do you want to continue?`,Sx="Select an object to create",Ax="Select an object t
2675
2675
  line-height: 14px;
2676
2676
  color: #506dff;
2677
2677
  margin-left: 6px;
2678
- `,WS=[xe.PENDING,xe.LOGGED,xe.NOT_LOGGED,xe.PAUSED],ZS=[xe.LOGGED,xe.PAUSED],XS=({status:e,emailLogStatus:t})=>{const{isAdmin:n,conversationId:r,connectorFunctions:o}=w.useContext(qt),s=o==null?void 0:o.sendTrackingEvent,{refetch:a}=Da({conversationId:r}),{mutate:i,isPending:c}=VS({onSuccess:a}),l=kw[e],f=Mw[e],m=Rw[e],{emailLogSettings:y,messageLogStatus:x}=t,{connectorName:b}=y??{},{logged:h,total:p}=x??{},g=ZS.includes(e)&&p?` (${h}/${p})`:"",C=e===xe.ERROR,v=WS.includes(e),I=({close:_})=>u.jsx(jS,{close:_,emailLogStatus:t}),E=()=>{i({conversationId:r}),s==null||s(Ft.email_logging_failed_clicked,{app_name:b})};return u.jsx(I_,{logSettings:y,status:e,isAdmin:n,retry:C,renderEntities:v?I:void 0,children:u.jsxs(GS,{style:{cursor:v?"pointer":"not-allowed"},children:[l,m?m(`${f} ${g}`):null,C?u.jsx(HS,{variant:"text",disabled:c,onClick:E,children:"Retry"}):null]})})},pl=({emailLogStatus:e,containerElement:t,messageId:n,legacyMessageId:r})=>{if(!t)return null;const o=Sw(e);return Ne.createPortal(u.jsx(XS,{status:o,emailLogStatus:e,messageId:n,legacyMessageId:r}),t)},zS=({observer:e})=>{var x;const[t,n]=w.useState({}),[r,o]=w.useState({}),[s,a]=w.useState({}),{conversationId:i}=w.useContext(qt),{data:c}=Da({conversationId:i}),l=(x=c==null?void 0:c.emailLogSettings)==null?void 0:x.enabled,f=b=>{n(h=>({...h,...b}))},m=b=>{o(h=>({...h,...b}))},y=b=>{a(b)};return w.useEffect(()=>{if(!(!e||!l))return e.observe({setEmailButtonContainers:f,setComposeButtonContainers:m,setSubjectButtonContainers:y}),()=>{e.destroy(),n({}),o({})}},[e,l]),c?u.jsxs(u.Fragment,{children:[Object.entries(t).map(([b,h])=>u.jsx(pl,{emailLogStatus:c,containerElement:h.element,messageId:h.messageId,legacyMessageId:h.legacyMessageId},b)),Object.entries(r).map(([b,h])=>u.jsx(pl,{emailLogStatus:c,containerElement:h.element},b)),Object.entries(s).map(([b,h])=>u.jsx(pl,{emailLogStatus:c,containerElement:h.element},b))]}):null},YS=({isAdmin:e,conversationId:t,connectorFunctions:n,children:r})=>{const o=w.useMemo(()=>({isAdmin:e,conversationId:t,connectorFunctions:n}),[e,t,n]);return u.jsx(qt.Provider,{value:o,children:r})},JS=({children:e,...t})=>u.jsx(Ki,{store:rl,children:u.jsx(d.HiverProvider,{custom:!0,children:u.jsx(nl,{children:u.jsx(w.Suspense,{fallback:u.jsx(u.Fragment,{}),children:u.jsx(YS,{...t,children:e})})})})}),ka=".hiver-log-crm-button",Na=".hiver-log-crm-compose-button",Yp=".hiver-log-crm-subject-button";class qS{constructor({emailNodeFilter:t,composeNodeFilter:n,emailHeaderTargetSelector:r=".gE.iv.gt .c2",composeHeaderTargetSelector:o=".aoD.hl .bgW",emailMessageContainerSelector:s=".adn.ads",subjectContainer:a=null,disableAutoLogInEmail:i=!1,disableAutoLogInCompose:c=!1,disableAutoLogInSubject:l=!1}={}){ke(this,"observer",null);ke(this,"setComposeButtonContainers",null);ke(this,"setEmailButtonContainers",null);ke(this,"setSubjectButtonContainers",null);ke(this,"emailNodeFilter");ke(this,"composeNodeFilter");ke(this,"emailHeaderTargetSelector");ke(this,"composeHeaderTargetSelector");ke(this,"emailMessageContainerSelector");ke(this,"disableAutoLogInEmail");ke(this,"disableAutoLogInCompose");ke(this,"disableAutoLogInSubject");ke(this,"subjectContainer",null);ke(this,"_addLogButtonsOnEmail",()=>{if(this.disableAutoLogInEmail)return;document.querySelectorAll(ka).forEach(r=>r.remove());const n=document.querySelectorAll(this.emailMessageContainerSelector);n.length&&n.forEach(r=>{var c;const o=r.querySelector(this.emailHeaderTargetSelector),s=r.getAttribute("data-message-id")||null,a=r.getAttribute("data-legacy-message-id")||null;if(o!=null&&o.querySelector(ka))return;const i=document.createElement("div");i.classList.add(ka.slice(1)),i.style.display="inline-block",i.style.marginLeft="8px",o==null||o.appendChild(i),(c=this.setEmailButtonContainers)==null||c.call(this,{[s??""]:{element:i,messageId:s,legacyMessageId:a}})})});ke(this,"_addLogButtonsOnCompose",()=>{if(this.disableAutoLogInCompose)return;document.querySelectorAll(Na).forEach(r=>r.remove());const n=document.querySelectorAll(this.composeHeaderTargetSelector);n.length&&n.forEach((r,o)=>{var a;if(r.querySelector(Na))return;const s=document.createElement("div");s.classList.add(Na.slice(1)),s.style.display="inline-block",r.appendChild(s),(a=this.setComposeButtonContainers)==null||a.call(this,{["_compose_"+o]:{element:s}})})});ke(this,"_addLogButtonOnSubject",()=>{var r,o,s;if(this.disableAutoLogInSubject||!this.subjectContainer)return;const t=(r=this.subjectContainer)==null?void 0:r.querySelectorAll(Yp);t==null||t.forEach(a=>a.remove());const n=document.createElement("div");n.classList.add(Yp.slice(1)),n.style.display="inline-block",(o=this.subjectContainer)==null||o.appendChild(n),(s=this.setSubjectButtonContainers)==null||s.call(this,{crm_subject:{element:n}})});this.emailNodeFilter=t||this._defaultEmailNodeFilter,this.composeNodeFilter=n||this._defaultComposeNodeFilter,this.emailHeaderTargetSelector=r,this.composeHeaderTargetSelector=o,this.emailMessageContainerSelector=s,this.subjectContainer=a,this.disableAutoLogInEmail=i,this.disableAutoLogInCompose=c,this.disableAutoLogInSubject=l}_defaultEmailNodeFilter(t){var n,r;return!!(t.nodeType===1&&t instanceof Element&&((n=t.classList)!=null&&n.contains("a3s")||(r=t.classList)!=null&&r.contains("ii")||typeof t.querySelector=="function"&&t.querySelector(".a3s")))}_defaultComposeNodeFilter(t){var n,r;return!!(t.nodeType===1&&t instanceof Element&&((n=t.classList)!=null&&n.contains("hiver-new-email-top-div")||(r=t.classList)!=null&&r.contains("hiver-compose-bar")))}_initMutationObserver(){this.observer&&this.observer.disconnect(),this.observer=new MutationObserver(t=>{let n=!1,r=!1;t.forEach(o=>{if(o.type==="childList"){const s=Array.from(o.addedNodes);this.disableAutoLogInEmail||s.some(this.emailNodeFilter)&&(n=!0),this.disableAutoLogInCompose||s.some(this.composeNodeFilter)&&(r=!0)}}),n&&setTimeout(()=>this._addLogButtonsOnEmail(),100),r&&setTimeout(()=>this._addLogButtonsOnCompose(),100)}),this.observer.observe(document.body,{childList:!0,subtree:!0})}_init(){this._addLogButtonsOnEmail(),this._addLogButtonsOnCompose(),this._addLogButtonOnSubject()}observe({setComposeButtonContainers:t,setEmailButtonContainers:n,setSubjectButtonContainers:r}){this.setComposeButtonContainers=t,this.setEmailButtonContainers=n,this.setSubjectButtonContainers=r,this._init(),(!this.disableAutoLogInEmail||!this.disableAutoLogInCompose)&&this._initMutationObserver()}destroy(){document.querySelectorAll(ka).forEach(r=>r.remove()),document.querySelectorAll(Na).forEach(r=>r.remove()),this.observer&&(this.observer.disconnect(),this.observer=null)}}const $S=({observer:e,...t})=>u.jsx(ol,{children:u.jsxs(JS,{...t,children:[u.jsx(zS,{observer:e}),Ne.createPortal(u.jsx(sl,{id:"toast-message",children:u.jsx(Ya,{position:"bottom-left",autoClose:5e3,hideProgressBar:!0,newestOnTop:!1,closeOnClick:!0,rtl:!1,draggable:!0,pauseOnHover:!0})}),document.body)]})}),QS=e=>we({url:Q8,method:Re.POST,data:e}),Qo=(...e)=>{console.log("CONNECTOR_STORE_DEBUG",...e)},Jp=async(e=0)=>{try{return Qo("getConnectorsList",e),await B0()}catch(t){return e>2?(console.error("Failed to get connectors list after 3 tries",t),[]):Jp(e+1)}},US=e=>{const{connectorTabSelector:t,sideBarDropdownSize:n}=e,r={connectorApiPending:!1,sideBarTabs:0};if(!kt())throw new Error("Please initiate bifrost by calling initConnectorsBifrost function before creating app store");const s=zy({name:"app-store",initialState:{}}),a=()=>{r.connectorApiPending||(r.connectorApiPending=!0,Jp().then(f=>{r.connectorApiPending=!1,Qo("setConnectors",f),!(!Array.isArray(f)||!f.length)&&s.setData(f,"connectors")}))},i=f=>[...f].sort((m,y)=>{const x=m.lastAccessed??0,b=y.lastAccessed??0;return x===b?0:x>b?-1:1}).map((m,y)=>({...m,sidebarView:y<r.sideBarTabs})),c=()=>{const f=s.getData("connectors"),m=s.getData("tabElement");if(Qo("setConnectorTabs",f,m),!Array.isArray(f)||!f.length)return a();if(!m)return;const y=m.querySelector(`:scope > ${t}`);if(!y){let _=null;_=new MutationObserver(()=>{_==null||_.disconnect(),c()}),_.observe(m,{childList:!0,subtree:!0});return}const x=y.previousElementSibling;if(!x)return;const b=y.getBoundingClientRect().left,h=x.getBoundingClientRect().right,p=m.getBoundingClientRect().right,g=b-h,C=g+y.clientWidth,v=p-h,I=Math.floor(v/C),E=Math.floor((v-n)/C);f.length>I?r.sideBarTabs=E:r.sideBarTabs=I,Qo("calculations",{connectorTabLeft:b,nonConnectorRight:h,tabElementRight:p,gap:g,tabSpace:C,spaceAvailable:v,tabsAvailable:I,tabsAvailableWithDropdown:E}),s.setData(i(f),"connectorTabs")},l=f=>{if(!f)return;const m=s.getData("connectorTabs"),y=m==null?void 0:m.find(b=>b.id===f);if(!y||y.sidebarView)return;const x=new Date().getTime();y.lastAccessed=x,s.setData(i(m),"connectorTabs")};return s.subscribe(c,"connectors"),s.subscribe(c,"tabElement",!1),s.subscribe(l,"connectorId",!1),Qo("appStore created",s),s};ie.ActionQueue=ww,ie.CONNECTORS_AGENT_EVENTS=tl,ie.ConnectorCardList=NI,ie.EmailLogger=$S,ie.GmailLogObserver=qS,ie.HiverConnectorBifrostAuth=we,ie.IntegrationSense=Ew,ie.addNewConnectors=yh,ie.createAppStore=US,ie.dismissNotification=fu,ie.fetchAppCfValues=QS,ie.getConnectorsBifrostConfigs=kt,ie.getMetaData=By,ie.initConnectorsBifrost=Zm,ie.setCaptureFeedbackOnDemand=Ch,ie.shouldCaptureFeedback=hi,ie.shouldShowNotification=du,ie.useConnectorSelectedEmail=pI,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})});
2678
+ `,WS=[xe.PENDING,xe.LOGGED,xe.NOT_LOGGED,xe.PAUSED],ZS=[xe.LOGGED,xe.PAUSED],XS=({status:e,emailLogStatus:t})=>{const{isAdmin:n,conversationId:r,connectorFunctions:o}=w.useContext(qt),s=o==null?void 0:o.sendTrackingEvent,{refetch:a}=Da({conversationId:r}),{mutate:i,isPending:c}=VS({onSuccess:a}),l=kw[e],f=Mw[e],m=Rw[e],{emailLogSettings:y,messageLogStatus:x}=t,{connectorName:b}=y??{},{logged:h,total:p}=x??{},g=ZS.includes(e)&&p?` (${h}/${p})`:"",C=e===xe.ERROR,v=WS.includes(e),I=({close:_})=>u.jsx(jS,{close:_,emailLogStatus:t}),E=()=>{i({conversationId:r}),s==null||s(Ft.email_logging_failed_clicked,{app_name:b})};return u.jsx(I_,{logSettings:y,status:e,isAdmin:n,retry:C,renderEntities:v?I:void 0,children:u.jsxs(GS,{style:{cursor:v?"pointer":"not-allowed"},children:[l,m?m(`${f} ${g}`):null,C?u.jsx(HS,{variant:"text",disabled:c,onClick:E,children:"Retry"}):null]})})},pl=({emailLogStatus:e,containerElement:t,messageId:n,legacyMessageId:r})=>{if(!t)return null;const o=Sw(e);return Ne.createPortal(u.jsx(XS,{status:o,emailLogStatus:e,messageId:n,legacyMessageId:r}),t)},zS=({observer:e})=>{var x;const[t,n]=w.useState({}),[r,o]=w.useState({}),[s,a]=w.useState({}),{conversationId:i}=w.useContext(qt),{data:c}=Da({conversationId:i}),l=(x=c==null?void 0:c.emailLogSettings)==null?void 0:x.enabled,f=b=>{n(h=>({...h,...b}))},m=b=>{o(h=>({...h,...b}))},y=b=>{a(b)};return w.useEffect(()=>{if(!(!e||!l))return e.observe({setEmailButtonContainers:f,setComposeButtonContainers:m,setSubjectButtonContainers:y}),()=>{e.destroy(),n({}),o({})}},[e,l]),c?u.jsxs(u.Fragment,{children:[Object.entries(t).map(([b,h])=>u.jsx(pl,{emailLogStatus:c,containerElement:h.element,messageId:h.messageId,legacyMessageId:h.legacyMessageId},b)),Object.entries(r).map(([b,h])=>u.jsx(pl,{emailLogStatus:c,containerElement:h.element},b)),Object.entries(s).map(([b,h])=>u.jsx(pl,{emailLogStatus:c,containerElement:h.element},b))]}):null},YS=({isAdmin:e,conversationId:t,connectorFunctions:n,children:r})=>{const o=w.useMemo(()=>({isAdmin:e,conversationId:t,connectorFunctions:n}),[e,t,n]);return u.jsx(qt.Provider,{value:o,children:r})},JS=({children:e,...t})=>u.jsx(Ki,{store:rl,children:u.jsx(d.HiverProvider,{custom:!0,children:u.jsx(nl,{children:u.jsx(w.Suspense,{fallback:u.jsx(u.Fragment,{}),children:u.jsx(YS,{...t,children:e})})})})}),ka=".hiver-log-crm-button",Na=".hiver-log-crm-compose-button",Yp=".hiver-log-crm-subject-button";class qS{constructor({emailNodeFilter:t,composeNodeFilter:n,emailHeaderTargetSelector:r=".gE.iv.gt .c2",composeHeaderTargetSelector:o=".aoD.hl .bgW",emailMessageContainerSelector:s=".adn.ads",subjectContainer:a=null,disableAutoLogInEmail:i=!1,disableAutoLogInCompose:c=!1,disableAutoLogInSubject:l=!1}={}){ke(this,"observer",null);ke(this,"setComposeButtonContainers",null);ke(this,"setEmailButtonContainers",null);ke(this,"setSubjectButtonContainers",null);ke(this,"emailNodeFilter");ke(this,"composeNodeFilter");ke(this,"emailHeaderTargetSelector");ke(this,"composeHeaderTargetSelector");ke(this,"emailMessageContainerSelector");ke(this,"disableAutoLogInEmail");ke(this,"disableAutoLogInCompose");ke(this,"disableAutoLogInSubject");ke(this,"subjectContainer",null);ke(this,"_addLogButtonsOnEmail",()=>{if(this.disableAutoLogInEmail)return;document.querySelectorAll(ka).forEach(r=>r.remove());const n=document.querySelectorAll(this.emailMessageContainerSelector);n.length&&n.forEach(r=>{var c;const o=r.querySelector(this.emailHeaderTargetSelector),s=r.getAttribute("data-message-id")||null,a=r.getAttribute("data-legacy-message-id")||null;if(o!=null&&o.querySelector(ka))return;const i=document.createElement("div");i.classList.add(ka.slice(1)),i.style.display="inline-block",i.style.marginLeft="8px",o==null||o.appendChild(i),(c=this.setEmailButtonContainers)==null||c.call(this,{[s??""]:{element:i,messageId:s,legacyMessageId:a}})})});ke(this,"_addLogButtonsOnCompose",()=>{if(this.disableAutoLogInCompose)return;document.querySelectorAll(Na).forEach(r=>r.remove());const n=document.querySelectorAll(this.composeHeaderTargetSelector);n.length&&n.forEach((r,o)=>{var a;if(r.querySelector(Na))return;const s=document.createElement("div");s.classList.add(Na.slice(1)),s.style.display="inline-block",r.appendChild(s),(a=this.setComposeButtonContainers)==null||a.call(this,{["_compose_"+o]:{element:s}})})});ke(this,"_addLogButtonOnSubject",()=>{var r,o,s;if(this.disableAutoLogInSubject||!this.subjectContainer)return;const t=(r=this.subjectContainer)==null?void 0:r.querySelectorAll(Yp);t==null||t.forEach(a=>a.remove());const n=document.createElement("div");n.classList.add(Yp.slice(1)),n.style.display="inline-block",(o=this.subjectContainer)==null||o.appendChild(n),(s=this.setSubjectButtonContainers)==null||s.call(this,{crm_subject:{element:n}})});this.emailNodeFilter=t||this._defaultEmailNodeFilter,this.composeNodeFilter=n||this._defaultComposeNodeFilter,this.emailHeaderTargetSelector=r,this.composeHeaderTargetSelector=o,this.emailMessageContainerSelector=s,this.subjectContainer=a,this.disableAutoLogInEmail=i,this.disableAutoLogInCompose=c,this.disableAutoLogInSubject=l}_defaultEmailNodeFilter(t){var n,r;return!!(t.nodeType===1&&t instanceof Element&&((n=t.classList)!=null&&n.contains("a3s")||(r=t.classList)!=null&&r.contains("ii")||typeof t.querySelector=="function"&&t.querySelector(".a3s")))}_defaultComposeNodeFilter(t){var n,r;return!!(t.nodeType===1&&t instanceof Element&&((n=t.classList)!=null&&n.contains("hiver-new-email-top-div")||(r=t.classList)!=null&&r.contains("hiver-compose-bar")))}_initMutationObserver(){this.observer&&this.observer.disconnect(),this.observer=new MutationObserver(t=>{let n=!1,r=!1;t.forEach(o=>{if(o.type==="childList"){const s=Array.from(o.addedNodes);this.disableAutoLogInEmail||s.some(this.emailNodeFilter)&&(n=!0),this.disableAutoLogInCompose||s.some(this.composeNodeFilter)&&(r=!0)}}),n&&setTimeout(()=>this._addLogButtonsOnEmail(),100),r&&setTimeout(()=>this._addLogButtonsOnCompose(),100)}),this.observer.observe(document.body,{childList:!0,subtree:!0})}_init(){this._addLogButtonsOnEmail(),this._addLogButtonsOnCompose(),this._addLogButtonOnSubject()}observe({setComposeButtonContainers:t,setEmailButtonContainers:n,setSubjectButtonContainers:r}){this.setComposeButtonContainers=t,this.setEmailButtonContainers=n,this.setSubjectButtonContainers=r,this._init(),(!this.disableAutoLogInEmail||!this.disableAutoLogInCompose)&&this._initMutationObserver()}destroy(){document.querySelectorAll(ka).forEach(r=>r.remove()),document.querySelectorAll(Na).forEach(r=>r.remove()),this.observer&&(this.observer.disconnect(),this.observer=null)}}const $S=({observer:e,...t})=>u.jsx(ol,{children:u.jsxs(JS,{...t,children:[u.jsx(zS,{observer:e}),Ne.createPortal(u.jsx(sl,{id:"toast-message",children:u.jsx(Ya,{position:"bottom-left",autoClose:5e3,hideProgressBar:!0,newestOnTop:!1,closeOnClick:!0,rtl:!1,draggable:!0,pauseOnHover:!0})}),document.body)]})}),QS=e=>we({url:Q8,method:Re.POST,data:e}),Qo=(...e)=>{console.log("CONNECTOR_STORE_DEBUG",...e)},Jp=async(e,t=0)=>{try{return Qo("getConnectorsList",t),await B0(e)}catch(n){return t>2?(console.error("Failed to get connectors list after 3 tries",n),[]):Jp(e,t+1)}},US=e=>{const{connectorTabSelector:t,sideBarDropdownSize:n}=e,r={connectorApiPending:!1};if(!kt())throw new Error("Please initiate bifrost by calling initConnectorsBifrost function before creating app store");const s=zy({name:"app-store",initialState:{}}),a=()=>{const f=s.getData("inboxIds");if(r.connectorApiPending||!Array.isArray(f))return;r.connectorApiPending=!0,Jp({channel_type:"email",inbox_id:f}).then(y=>{r.connectorApiPending=!1,Qo("setConnectors",y),!(!Array.isArray(y)||!y.length)&&s.setData(y,"connectors")})},i=f=>{(!Array.isArray(f)||!f.length)&&(f=s.getData("connectors")||[]);const m=s.getData("sideBarTabs")||0,y=[...f].sort((x,b)=>{const h=x.lastAccessed??0,p=b.lastAccessed??0;return h===p?0:h>p?-1:1}).map((x,b)=>({...x,sidebarView:b<m}));s.setData(y,"connectorTabs")},c=()=>{const f=s.getData("connectors"),m=s.getData("tabElement");if(Qo("calculateTabPositions",f,m),!Array.isArray(f)||!f.length)return a();if(!m)return;const y=m.querySelector(`:scope > ${t}`);if(!y){let A=null;A=new MutationObserver(()=>{A==null||A.disconnect(),c()}),A.observe(m,{childList:!0,subtree:!0});return}const x=y.previousElementSibling;if(!x)return;const b=y.getBoundingClientRect().left,h=x.getBoundingClientRect().right,p=m.getBoundingClientRect().right,g=b-h,C=g+y.clientWidth,v=p-h,I=Math.floor(v/C),E=Math.floor((v-n)/C),_=f.length>I?E:I;s.setData(_,"sideBarTabs"),Qo("calculations",{connectorTabLeft:b,nonConnectorRight:h,tabElementRight:p,gap:g,tabSpace:C,spaceAvailable:v,tabsAvailable:I,tabsAvailableWithDropdown:E})},l=f=>{if(!f)return;const m=s.getData("connectorTabs"),y=m==null?void 0:m.find(b=>b.id===f);if(!y||y.sidebarView)return;const x=new Date().getTime();y.lastAccessed=x,i(m)};return s.subscribe(c,"connectors"),s.subscribe(c,"tabElement",!1),s.subscribe(()=>i(),"sideBarTabs",!1),s.subscribe(l,"connectorId",!1),s.subscribe(a,"inboxIds",!1),Qo("appStore created",s),s};ie.ActionQueue=ww,ie.CONNECTORS_AGENT_EVENTS=tl,ie.ConnectorCardList=NI,ie.EmailLogger=$S,ie.GmailLogObserver=qS,ie.HiverConnectorBifrostAuth=we,ie.IntegrationSense=Ew,ie.addNewConnectors=yh,ie.createAppStore=US,ie.dismissNotification=fu,ie.fetchAppCfValues=QS,ie.getConnectorsBifrostConfigs=kt,ie.getMetaData=By,ie.initConnectorsBifrost=Zm,ie.setCaptureFeedbackOnDemand=Ch,ie.shouldCaptureFeedback=hi,ie.shouldShowNotification=du,ie.useConnectorSelectedEmail=pI,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiver/connector-agent",
3
- "version": "4.9.0-splitApps-beta.3",
3
+ "version": "4.9.0-splitApps-beta.5",
4
4
  "main": "index.es.js",
5
5
  "module": "index.es.js",
6
6
  "types": "index.d.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"appStore.d.ts","sourceRoot":"","sources":["../../src/store/appStore.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAiB,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAoBhD,MAAM,MAAM,aAAa,GAAG;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,aAAa,KAAG,KAAK,CAAC,UAAU,CA2GrE,CAAC"}
1
+ {"version":3,"file":"appStore.d.ts","sourceRoot":"","sources":["../../src/store/appStore.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAiB,KAAK,EAAe,MAAM,kBAAkB,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAoBhD,MAAM,MAAM,aAAa,GAAG;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,aAAa,KAAG,KAAK,CAAC,UAAU,CAoHrE,CAAC"}
package/types/store.d.ts CHANGED
@@ -2,6 +2,8 @@ import { Connector, ConnectorTabs } from '@connector/utils';
2
2
  export type StoreState = Partial<{
3
3
  connectorId: string;
4
4
  tabElement: HTMLElement | null;
5
+ sideBarTabs: number;
6
+ inboxIds: (string | number)[];
5
7
  connectors: Connector[];
6
8
  connectorTabs: ConnectorTabs[];
7
9
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/types/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE5D,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,aAAa,EAAE,aAAa,EAAE,CAAC;CAChC,CAAC,CAAC"}
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/types/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE5D,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC9B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,aAAa,EAAE,aAAa,EAAE,CAAC;CAChC,CAAC,CAAC"}