@telia-ace/conversational-hub-bot-provider 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,644 @@
1
+ "use strict";var ke=Object.defineProperty;var Ne=(t,e,o)=>e in t?ke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var P=(t,e,o)=>(Ne(t,typeof e!="symbol"?e+"":e,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),s=require("./index-93631b28.js"),b=require("react");require("react-dom");function H(t={}){const{phrase:e="",category:o,guideCategory:n,contactCategory:i,take:r,connectionKey:c,accordion:a,id:l,uriName:d,sorting:g,tag:f,tagId:y,tagTitle:v,...p}=t,m={};return Object.keys(p).forEach(h=>{typeof t[h]=="string"&&(m[h]=t[h])}),typeof e=="string"&&e.length&&(m.phrase=e),e===null&&(m.phrase=e),typeof n=="string"&&n!=="0"&&(m.guideCategory=n),typeof n=="number"&&n!==0&&(m.guideCategory=n),typeof n=="object"&&n!==null&&(typeof n.id=="string"&&n.id!=="0"&&(m.guideCategory=n.id),typeof n.id=="number"&&n.id!==0&&(m.guideCategory=n.id)),typeof i=="string"&&i!=="0"&&(m.contactCategory=i),typeof i=="number"&&i!==0&&(m.contactCategory=i),typeof i=="object"&&i!==null&&(typeof i.id=="string"&&i.id!=="0"&&(m.contactCategory=i.id),typeof i.id=="number"&&i.id!==0&&(m.contactCategory=i.id)),typeof o=="string"&&o!=="0"&&(m.category=o),typeof o=="number"&&o!==0&&(m.category=o),typeof o=="object"&&o!==null&&(typeof o.id=="string"&&o.id!=="0"&&(m.category=o.id),typeof o.id=="number"&&o.id!==0&&(m.category=o.id)),l&&(m.id=l),d&&(+m.category||+m.guideCategory||+m.guide||+m.contactCategory||+m.contactMethod)&&(m.uriName=d),c&&(m.connectionKey=c),r&&(m.take=r),g&&(m.sorting=g),typeof a=="string"&&a.length>0&&(m.accordion=a),typeof f=="string"&&f!=="0"&&(m.tag=f),typeof f=="number"&&f!==0&&(m.tag=f),Array.isArray(f)&&f.length&&(m.tag=f),(typeof y=="string"||typeof y=="number")&&(m.tagId=y),typeof v=="string"&&(m.tagTitle=v),typeof m.tag=="string"&&(m.tag=m.tag.split(",")),m}const ee=t=>{if(!t)return"";const e=[{from:/[äæǽ]+/gi,to:"ae"},{from:/[öœ]+/gi,to:"oe"},{from:/[ü]+/gi,to:"ue"},{from:/[Ä]+/gi,to:"Ae"},{from:/[Ü]+/gi,to:"Ue"},{from:/[Ö]+/gi,to:"Oe"},{from:/[ÀÁÂÃÄÅǺĀĂĄǍΑΆẢẠẦẪẨẬẰẮẴẲẶА]+/gi,to:"A"},{from:/[àáâãåǻāăąǎªαάảạầấẫẩậằắẵẳặа]+/gi,to:"a"},{from:/[Б]+/gi,to:"B"},{from:/[б]+/gi,to:"b"},{from:/[ÇĆĈĊČ]+/gi,to:"C"},{from:/[çćĉċč]+/gi,to:"c"},{from:/[Д]+/gi,to:"D"},{from:/[д]+/gi,to:"d"},{from:/[ÐĎĐΔ]+/gi,to:"Dj"},{from:/[ðďđδ]+/gi,to:"dj"},{from:/[ÈÉÊËĒĔĖĘĚΕΈẼẺẸỀẾỄỂỆЕЭ]+/gi,to:"E"},{from:/[èéêëēĕėęěέεẽẻẹềếễểệеэ]+/gi,to:"e"},{from:/[Ф]+/gi,to:"F"},{from:/[ф]+/gi,to:"f"},{from:/[ĜĞĠĢΓГҐ]+/gi,to:"G"},{from:/[ĝğġģγгґ]+/gi,to:"g"},{from:/[ĤĦ]+/gi,to:"H"},{from:/[ĥħ]+/gi,to:"h"},{from:/[ÌÍÎÏĨĪĬǏĮİΗΉΊΙΪỈỊИЫ]+/gi,to:"I"},{from:/[ìíîïĩīĭǐįıηήίιϊỉịиыї]+/gi,to:"i"},{from:/[Ĵ]+/gi,to:"J"},{from:/[ĵ]+/gi,to:"j"},{from:/[ĶΚК]+/gi,to:"K"},{from:/[ķκк]+/gi,to:"k"},{from:/[ĹĻĽĿŁΛЛ]+/gi,to:"L"},{from:/[ĺļľŀłλл]+/gi,to:"l"},{from:/[М]+/gi,to:"M"},{from:/[м]+/gi,to:"m"},{from:/[ÑŃŅŇΝН]+/gi,to:"N"},{from:/[ñńņňʼnνн]+/gi,to:"n"},{from:/[ÒÓÔÕŌŎǑŐƠØǾΟΌΩΏỎỌỒỐỖỔỘỜỚỠỞỢО]+/gi,to:"O"},{from:/[òóôõōŏǒőơøǿºοόωώỏọồốỗổộờớỡởợо]+/gi,to:"o"},{from:/[П]+/gi,to:"P"},{from:/[п]+/gi,to:"p"},{from:/[ŔŖŘΡР]+/gi,to:"R"},{from:/[ŕŗřρр]+/gi,to:"r"},{from:/[ŚŜŞȘŠΣС]+/gi,to:"S"},{from:/[śŝşșšſσςс]+/gi,to:"s"},{from:/[ȚŢŤŦτТ]+/gi,to:"T"},{from:/[țţťŧт]+/gi,to:"t"},{from:/[ÙÚÛŨŪŬŮŰŲƯǓǕǗǙǛŨỦỤỪỨỮỬỰУ]+/gi,to:"U"},{from:/[ùúûũūŭůűųưǔǖǘǚǜυύϋủụừứữửựу]+/gi,to:"u"},{from:/[ÝŸŶΥΎΫỲỸỶỴЙ]+/gi,to:"Y"},{from:/[ýÿŷỳỹỷỵй]+/gi,to:"y"},{from:/[В]+/gi,to:"V"},{from:/[в]+/gi,to:"v"},{from:/[Ŵ]+/gi,to:"W"},{from:/[ŵ]+/gi,to:"w"},{from:/[ŹŻŽΖЗ]+/gi,to:"Z"},{from:/[źżžζз]+/gi,to:"z"},{from:/[ÆǼ]+/gi,to:"AE"},{from:/[ß]+/gi,to:"ss"},{from:/[IJ]+/gi,to:"IJ"},{from:/[ij]+/gi,to:"ij"},{from:/[Œ]+/gi,to:"OE"},{from:/[ƒ]+/gi,to:"f"},{from:/[ξ]+/gi,to:"ks"},{from:/[π]+/gi,to:"p"},{from:/[β]+/gi,to:"v"},{from:/[μ]+/gi,to:"m"},{from:/[ψ]+/gi,to:"ps"},{from:/[Ё]+/gi,to:"Yo"},{from:/[ё]+/gi,to:"yo"},{from:/[Є]+/gi,to:"Ye"},{from:/[є]+/gi,to:"ye"},{from:/[Ї]+/gi,to:"Yi"},{from:/[Ж]+/gi,to:"Zh"},{from:/[ж]+/gi,to:"zh"},{from:/[Х]+/gi,to:"Kh"},{from:/[х]+/gi,to:"kh"},{from:/[Ц]+/gi,to:"Ts"},{from:/[ц]+/gi,to:"ts"},{from:/[Ч]+/gi,to:"Ch"},{from:/[ч]+/gi,to:"ch"},{from:/[Ш]+/gi,to:"Sh"},{from:/[ш]+/gi,to:"sh"},{from:/[Щ]+/gi,to:"Shch"},{from:/[щ]+/gi,to:"shch"},{from:/[ЪъЬь]+/gi,to:""},{from:/[Ю]+/gi,to:"Yu"},{from:/[ю]+/gi,to:"yu"},{from:/[Я]+/gi,to:"Ya"},{from:/[я]+/gi,to:"ya"}],o=/[^a-zA-Z0-9]+/g,n=/[-]$/;let i=t;for(const r in e)e.hasOwnProperty(r)&&e[r].from.test(t)&&(i=i.replace(e[r].from,e[r].to));return i=i.replace(o,"-"),i=i.replace(n,""),i=i.toLowerCase(),i||"humany"},je=(t,e)=>{if(!t||!e)return!0;let o=e.parentNode,n=!1;for(;o!==null;)o===t&&(n=!0),o=o.parentNode;return n},te=(t={})=>(Object.keys(t).forEach(e=>{(t[e]===null||typeof t[e]>"u")&&delete t[e]}),t),_=(t,e)=>{let o=!0;return Object.keys(t).length!==Object.keys(e).length||Object.keys(t).some(i=>!Object.keys(e).some(c=>i===c))?!1:(Object.keys(t).forEach(i=>{if(o){const r=typeof t[i]>"u"?"":t[i],c=typeof e[i]>"u"?"":e[i];o=r.toString()===c.toString()}}),o)},fe=()=>b.useContext(s.ComponentNodeContext),Me=(t,e)=>{const o=fe(),n=s.useContainer(),[i,r]=b.useState(void 0),c=s.useIsMounted(),a=t||o.type||"";return b.useEffect(()=>{if(a){let l;return(e||n).getAsync("componentResolver").then(d=>{if(c.current){const g=d.getComponent(a);r(g)}l=d.registerResolver(a,g=>{c.current&&r(g)})}),()=>{l&&l()}}},[c,a,e,n]),i},ze=()=>b.useContext(s.ConversationContext),Te=()=>{const t=s.useComponentPlatform(),e=fe(),[o,n]=b.useState([]),[i,r]=b.useState();return b.useEffect(()=>{if(t&&e){const c=new s.ComponentQuery(t).withId(e.id),a=t.actions(c,e.type||s.uuid());r(a),o!==null&&(o.forEach(l=>{a.dispatch(l.key,l.data).then(d=>l.resolve(d)).catch(d=>l.reject(d))}),n(null))}},[t,e.id]),(c,a)=>o!==null?new Promise((l,d)=>{o.push({key:c,data:a,resolve:l,reject:d})}):i.dispatch(c,a)},Re=()=>{const[t,e]=b.useState(!1);return b.useEffect(()=>{const o=()=>{e(!1)},n=i=>{i.keyCode===9&&e(!0)};return window.addEventListener("keydown",n),window.addEventListener("click",o),()=>{window.removeEventListener("keydown",n),window.removeEventListener("click",o)}},[]),t},ie=t=>{const e=s.useContainer(),o=s.useRouter(),[n,i]=b.useState({name:"",params:{}}),r=s.useIsMounted();return b.useEffect(()=>{const c=(t||e).get("$widget");if(!c)return;const{events:a}=c;return a.subscribe("router:change",(d,{next:{routeData:g}})=>{if(r.current){const{name:f,params:y}=g;te(y),i({name:f,params:y})}})},[r,t,e]),b.useEffect(()=>{if(o&&o.history&&r.current){const c=o.getRouteData(),{name:a,params:l}=c;te(l),i({name:a,params:l})}},[o,r]),n};var ue=(t=>(t.HH_MM="hh:mm",t.YYYY_MM_DD="yyyy-mm-dd",t.YYYY_MM_DD_HH_MM="yyyy-mm-dd hh:mm",t))(ue||{});const he=({className:t="",format:e="hh:mm",timestamp:o})=>u.jsx("span",{className:s.appendClassNames(t,"humany-timestamp"),children:Ie(o,e)}),ne=t=>`0${t}`.slice(-2);function Ie(t,e){const o=new Date(t),n=o.toTimeString().split(" ")[0].split(":"),i=n.length>1?`${n[0]}:${n[1]}`:n[0],r=o.getFullYear(),c=o.getMonth()+1,a=o.getDate(),l=`${r}-${ne(c)}-${ne(a)}`;return e==="yyyy-mm-dd"?l:e==="hh:mm"?i:`${l} ${i}`}var K=(t=>(t.guide="guide",t.link="link",t.default="default",t))(K||{});const re=t=>Promise.resolve().then(()=>require("./index-373df3a5.js")).then(({ServiceClient:e,ServiceProxy:o})=>t.get("settings").then(n=>{const{name:i,events:r}=t.get("$widget"),{data:{projection:c="",site:a="current",forceHttps:l=!1}}=n,d=new o(c,{credentials:"same-origin"}),g=new e(d,{funnel:i.replace("_contact-method","").replace("_contact",""),site:Ee(a,l)},null,t);return r.subscribe("widget:settings-updated",(f,{data:y})=>{y&&y.projection!==c&&g.proxy.setBaseUrl(y.projection)}),g})),Ee=(t,e)=>()=>{const o=i=>{const r=document.createElement("a");return r.href=i,r};let n=window.location;return t==="referrer"&&document.referrer&&(n=o(document.referrer)),[e?"https:":"","//",n.host,n.pathname].join("")},B=t=>{if(t){const{Type:e,Content:o}=t;if(e&&o)return{type:e,content:o}}},oe=t=>t.map(e=>{const o={id:e.Id.toString(),title:e.Name,symbol:B(e.DefaultIcon),activeSymbol:e.ActiveIcon&&B(e.ActiveIcon),description:e.Description||e.Attributes&&e.Attributes.description||"",matches:e.GuidesCount};return e.Children&&e.Children.length&&(o.items=oe(e.Children)),o}),A=(t,e)=>t.filter(({Type:o})=>o===e).map(({Id:o,Title:n,Body:i})=>({id:o.toString(),title:n,body:i})),W=t=>t.map(({Id:e,Title:o,DefaultIcon:n,ListNotices:i,Notices:r})=>({id:e.toString(),title:o,symbol:B(n),defaultHeaderOptions:{visible:!!i.length},notifications:(i||[]).concat(r||[]).map(({Id:c,Title:a,Body:l,Type:d,Modified:g})=>({id:c.toString(),title:a,body:l,modified:g,expandable:d==="listNotice"}))})),Z=({Id:t,Title:e,DefaultIcon:o,Exits:[n],ExitType:i,ConfirmationText:r,ExpandFormAutomatically:c,Form:a,Description:l},d)=>{const{Adapter:g}=n||{Adapter:{}},{ClientName:f="",Settings:y={},CustomClientName:v=""}=g,p={id:t.toString(),title:e,description:l,symbol:B(o),clientName:f==="custom.adapter"?v:f,expanded:!0,inline:!0,body:{}};if(f.indexOf("phone")>-1||f.indexOf("freetext")>-1){const{displayTextBeforeClick:m,textBeforeClick:h}=y;m==="true"&&(p.expanded=!1,p.title=h),f.indexOf("phone.text")>-1?p.body.phoneNumber=y.phoneNumber:p.body.freetext=y.freetext}return(f.indexOf("chat.popup")>-1||f.indexOf("link")>-1||f==="custom.adapter"&&i==="custom")&&(p.body=y,p.body.confirmationFallback=r),f.indexOf("ace")>-1&&(p.body=y),a&&a.HasValueComponents&&(d?p.body.form=s.FormBuilder.fromLegacyForm(t.toString(),a,d).get():p.body.form=s.FormBuilder.fromLegacyForm(t.toString(),a).get(),c||(p.expanded=p.inline=!1)),p},D=(t=[])=>t.map(({Id:e,Title:o,TotalMatches:n,Symbol:i,DefaultIcon:r,ActiveIcon:c})=>({id:e.toString(),title:o,matches:n,symbol:B(r||i),defaultIcon:B(r),activeIcon:B(c)})),J=t=>t.map(({Id:e,Title:o,Tags:n,FirstPublishedDate:i,Modified:r})=>({id:e.toString(),title:o,tags:D(n),published:i,modified:r})),Ae=(t,e)=>{switch(t){case R.MatchByCategory:case R.Match:{const o={guides:[],matches:0,topNotifications:[],middleNotifications:[],bottomNotifications:[],notificationLists:[],tags:[],byCategory:[]},{Matches:n,TotalMatches:i,Notices:r,NoticeLists:c,Tags:a,ByCategory:l}=e;return o.guides=J(n),o.matches=i,o.byCategory=(l||[]).map(({Id:d,Matches:g,TotalMatches:f})=>({id:d,guides:J(g),matches:f})),o.tags=D(a),o.notificationLists=W(c||[]),o.topNotifications=A(r||[],"noticeRowTop"),o.middleNotifications=A(r||[],"noticeRowMiddle"),o.bottomNotifications=A(r||[],"footerNotice"),o}case R.Categories:{const{Children:o,GuidesCountTotal:n}=e;return{categories:oe(o||[]),matches:n}}case R.Guide:{const{Id:o,Title:n,Body:i,Related:r,Options:c,ConnectionId:a,ContactMethods:l,EnableFeedback:d,HandoverExists:g,FirstPublishedDate:f,Modified:y,ModifiedByDisplayName:v,FirstPublishedByDisplayName:p,Categories:m,Tags:h,SeoMetaDescription:x,SeoAllowIndex:C,Perspectives:N,PerspectiveKey:w,Translations:j}=e,$=w||Object.values(N).find(M=>M===a)||N.Default||null,q={guide:{id:o.toString(),title:n,body:i,modified:y,published:f,modifiedBy:v,publishedBy:p,connection:a,categories:m,hasHandover:g,allowFeedback:d,seoMetaDescription:x,seoAllowIndex:C,perspectives:N,perspective:$,translations:Object.keys(j||{}).reduce((M,I)=>(M[I]=j[I].toString(),M),{})},related:J(r||[]),dialog:[],contactMethods:(l||[]).map(M=>Z(M)),tags:D(h)};return(c||[]).forEach(({CanAccess:M,Description:I,ConnectionId:L,Properties:S})=>{if(!M)return;const z={id:o.toString(),title:I,connection:L,connectionKey:S.ConnectionKey,type:K.default,parent:{id:o.toString(),title:n,tags:D(h)}};if(S.Type==="Guide"||S.Type==="Link")switch(S.Id&&(z.id=S.Id.toString()),S.Uri&&(z.href=S.Uri),S.Target&&(z.target=S.Target),S.Type){case"Guide":z.type=K.guide;break;case"Link":z.type=K.link;break}q.dialog.push(z)}),q}case R.Contacts:{const{Children:o,Matches:n,Notices:i,NoticeLists:r}=e;return{contactMethods:(n||[]).map(a=>Z(a)),categories:oe(o||[]),topNotifications:A(i||[],"noticeRowTop"),middleNotifications:A(i||[],"noticeRowMiddle"),bottomNotifications:A(i||[],"footerNotice"),notificationLists:W(r||[])}}case R.ContactMethod:{const{ContactMethod:o}=e;return Z(o||{})}case R.Tags:case R.TagsOnGuides:return D(e||[]);case R.Notifications:{const{Notices:o,NoticeLists:n}=e;return{topNotifications:A(o||[],"noticeRowTop"),middleNotifications:A(o||[],"noticeRowMiddle"),bottomNotifications:A(o||[],"footerNotice"),notificationLists:W(n||[])}}default:return{}}};var ge=(t=>(t.Guide="guide",t.Guides="guides",t.GuidesByCategory="guides-by-category",t.RowNotifications="row-notices",t.NotificationLists="notification-lists",t.GuideCategories="guide-categories",t.ContactMethodCategories="contact-method-categories",t.ContactMethod="contact-method",t.ContactMethods="contact-methods",t.Tags="tags",t.TagsOnGuides="tagsonguides",t))(ge||{}),R=(t=>(t.Match="match",t.Categories="categories",t.Guide="guide",t.Contacts="contacts",t.ContactMethod="contact-method",t.MatchByCategory="match-by-category",t.Tags="tags",t.TagsOnGuides="tagsonguides",t.Notifications="notifications",t))(R||{});const ae=t=>{switch(t){case"guides":return"match";case"guides-by-category":return"match-by-category";case"guide":return"guide";case"guide-categories":return"categories";case"contact-method-categories":case"contact-methods":return"contacts";case"contact-method":return"contact-method";case"tags":return"tags";case"tagsonguides":return"tagsonguides";case"notification-lists":case"row-notices":return"notifications";default:throw"error"}},Le=async t=>{const{invoke:e}=t.get("$widget");return await e("renderState")===s.WidgetRenderState.hidden};class G{constructor(e,o){P(this,"queries",new Map);P(this,"lastTake",0);P(this,"events");P(this,"getUnresolvedQueries",()=>{let e=0;return this.queries.forEach((o,n)=>{o.some(r=>!r.resolved)&&(e=1)}),e});this.container=e,this.matchingClient=o,this.events=e.get("$widget").events,this.events.subscribe("widget:settings-updated",()=>this.queries=new Map),this.events.subscribe("widget:render-state-changed",(n,{next:i,previous:r})=>{r===s.WidgetRenderState.hidden&&i===s.WidgetRenderState.open&&this.fetchAllUnresolvedQueries()})}static getInstance(e,o="dataClient"){return s.lock(this)(()=>e.getAsync(o).then(async n=>{let i=await e.getAsync("matchingClient");i||(i=await re(e),e.registerAsync("matchingClient",()=>i));let r=n;return r||(r=new G(e,i),e.registerAsync(o,()=>r)),r}))}fetch(e,o,n){return new Promise((i,r)=>{o.take&&(this.lastTake=+(o.take||0)),te(o);const c=ae(e);let a=this.queries.get(c)||[],l=a.find(d=>_(d.params,o))||null;if(l&&(n!=null&&n.noCache)){const d=a.findIndex(g=>_(g.params,o));a=[...a.slice(0,d),...a.slice(d+1)],l=null}if(l){const d=a.indexOf(l);if(l.resolved?(this.events.dispatch("data-client:fetched",{params:o,type:c,response:l.data,unresolvedQueries:this.getUnresolvedQueries()}),this.track(l.data,c,l.error),l.data&&l.error?r({error:l.error}):i(l.data)):l.resolvers.push({resolve:i,reject:r}),a.splice(d,1),a.push(l),this.queries.set(c,a),!l.loading&&!l.resolved)return this.runQuery(c,o)}else return a.push({params:o,resolved:!1,loading:!0,data:{},resolvers:[{resolve:i,reject:r}]}),this.queries.set(c,a),this.runQuery(c,o)}).then(i=>s.deepClone(i))}read(e,o){const{select:n}=o,i=ae(e);return(this.queries.get(i)||[]).reduce((a,l)=>{if(typeof n=="function"){const d=n(l.data);d&&a.push(d)}else a.push(l.data);return a},[])}feedback(e,o,n){return this.matchingClient.giveFeedback(e,o,n)}setLoadingStatus(e,o,n){const i=this.queries.get(e)||[],r=i.find(c=>_(c.params,o));r&&(r.loading=n),this.queries.set(e,i)}async runQuery(e,o){const{searchPhrase:n="",categories:i="0",contactMethodCategoryId:r="0",contactMethodId:c="0",tagId:a=void 0,take:l=5,connection:d="",guideId:g,expandCategories:f="descendants",currentCategory:y,sorting:v="popularity-descending",guideIds:p=[]}=o,m=n.toString().trim();if(await Le(this.container))return Promise.resolve();switch(e){case"match":{const h=x=>{const[C,N]=x.split("-");return{type:new Map([["popularity","popularity"],["alphabetic","title"],["modified","lastModified"],["published","firstPublished"]]).get(C),direction:N}};return p.length?this.matchingClient.customRequest("guides","POST",{configuration:{ids:p,take:+l}}).then(x=>x&&this.handleResponse(x,e,o)):this.matchingClient.match(m,{categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+l,tags:a,sorting:h(v),ids:p}).then(x=>x&&this.handleResponse(x,e,o))}case"match-by-category":return this.matchingClient.match(m,{groupByCategory:!0,categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+l,tags:a}).then(h=>h&&this.handleResponse(h,e,o));case"guide":return this.matchingClient.getGuide(g,{connectionId:d}).then(h=>{h&&this.handleResponse(h,e,o)}).catch(h=>{const x={message:"Something went wrong.",status:h.status||400};x.status===404&&(x.message="The guide could not be found."),this.handleResponse({},e,o,x)});case"categories":return this.matchingClient.getCategories({phrase:m,expand:f,tags:a}).then(h=>h&&this.handleResponse(h,e,o));case"contacts":return g?this.matchingClient.contactMethods(+g,{phrase:m}).then(h=>h&&this.handleResponse(h,e,o)):this.matchingClient.contacts(+r,{phrase:m}).then(h=>h&&this.handleResponse(h,e,o));case"contact-method":return this.matchingClient.getContactMethod(+c,{guideId:g,currentCategory:y}).then(h=>h&&this.handleResponse(h,e,o));case"tags":return this.matchingClient.customRequest("tags","GET",{configuration:{take:999999,phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(h=>h&&this.handleResponse(h,e,o));case"tagsonguides":return this.matchingClient.customRequest("tagsonguides","GET",{configuration:{take:999999,phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i],tags:a}}).then(h=>h&&this.handleResponse(h,e,o));case"notifications":return this.matchingClient.customRequest("notices","GET",{configuration:{phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(h=>h&&this.handleResponse(h,e,o))}}handleResponse(e={},o,n,i){const r=this.queries.get(o)||[],c=r.find(a=>_(a.params,n));if(c){const a=i||Ae(o,e);this.track(a,o,i),c.resolvers.forEach(d=>{i?d.reject({error:a}):d.resolve(a)});const l=r.indexOf(c);l>-1&&r.splice(l,1),r.push({...c,error:i,resolvers:[],data:a,resolved:!0}),this.setLoadingStatus(o,n,!1),this.queries.set(o,r),i||this.events.dispatch("data-client:fetched",{type:o,params:n,response:a,unresolvedQueries:this.getUnresolvedQueries()})}}fetchAllUnresolvedQueries(){for(const[e,o]of this.queries)o.filter(n=>!n.resolved).forEach(n=>{this.runQuery(e,n.params)})}track(e={},o,n){const i=this.container.get("$widget");i&&!n?i.events.dispatch("tracking:service-client-response",{type:o,data:e}):i&&i.events.dispatch("tracking:service-client-error",{type:o,error:n})}static create(e){return e.getAsync("matchingClient").then(async o=>{if(o)return new G(e,o);const n=await re(e);return e.registerAsync("matchingClient",()=>n),new G(e,n)})}getClient(){return this.matchingClient}}const Be=({title:t="",className:e,id:o,parent:n,connection:i,type:r,target:c,href:a,children:l,connectionKey:d})=>{const g={},{name:f,params:y}=ie();switch(r){case"default":case"guide":const{id:v,title:p}=n;let m=d||i;v!==o&&!d&&(m=void 0),g.routeName=f,g.params=H({...y,guide:o,connection:m,uriName:ee(o===v?p:t)});break;case"link":g.href=a,g.target=c;break}return u.jsx(s.Link,{className:s.appendClassNames(e,"humany-dialog-link"),...g,children:l||u.jsxs(u.Fragment,{children:[r==="link"&&u.jsx(s.Icon,{faIcon:"link"}),u.jsx("span",{children:t})]})})};b.forwardRef(({className:t,dialog:e,...o},n)=>e.length?u.jsx(Oe,{className:s.appendClassNames(t,"humany-dialog"),items:e,renderItem:i=>u.jsx("li",{"data-dialog":i.connection,children:u.jsx(Be,{...i})},i.connection),...o,ref:n}):null);const Oe=s.newStyled(s.List)`
2
+ ${s.list}
3
+ a {
4
+ min-width: 150px;
5
+ max-width: 400px;
6
+ display: block;
7
+ white-space: normal;
8
+ ${t=>{var e,o;return((e=t.theme.colors)==null?void 0:e.primary)&&s.invertedHoverButton({primaryColor:(o=t.theme.colors)==null?void 0:o.primary,secondaryColor:"#FFFFFF",theme:t.theme})}}
9
+ }
10
+
11
+ i {
12
+ margin: 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}} 0 0;
13
+ }
14
+ `;s.newStyled(s.ItemList)`
15
+ ${s.itemList}
16
+ font-family: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.type}};
17
+ padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
18
+ > ul > li {
19
+ overflow: visible;
20
+ font-weight: 300;
21
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
22
+ }
23
+ `;s.newStyled.div`
24
+ background: #fff;
25
+ border: #ccc 1px solid;
26
+ box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
27
+ font-family: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.type}};
28
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
29
+ `;s.newStyled.div`
30
+ padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
31
+ padding-bottom: 0;
32
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
33
+ font-weight: normal;
34
+ white-space: nowrap;
35
+ display: flex;
36
+ align-items: center;
37
+
38
+ h1,
39
+ h2,
40
+ h3,
41
+ h4,
42
+ h5,
43
+ h6 {
44
+ margin: 0;
45
+ font-weight: normal;
46
+ padding-bottom: 0;
47
+ }
48
+
49
+ svg,
50
+ i {
51
+ margin-right: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
52
+ }
53
+ `;s.newStyled(s.List)`
54
+ list-style: none;
55
+ padding: 0;
56
+ margin: 0;
57
+ padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}} 0;
58
+
59
+ li {
60
+ background: #fff;
61
+
62
+ a {
63
+ display: block;
64
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.small}};
65
+ padding: ${t=>{var e,o;return`${(e=t.theme.sizes)==null?void 0:e.small} ${(o=t.theme.sizes)==null?void 0:o.normal}`}};
66
+ cursor: pointer;
67
+ color: #555;
68
+ text-decoration: none;
69
+
70
+ &:hover {
71
+ background: #f9f9f9;
72
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
73
+ }
74
+ }
75
+ }
76
+ `;s.newStyled(s.ItemList)`
77
+ ${s.itemList}
78
+ font-family: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.type}};
79
+ > div {
80
+ ${t=>{var e;return s.headingElement(t)("> h1",s.css`
81
+ font-size: ${(e=t.theme.fonts)==null?void 0:e.normal};
82
+ line-height: 1.2em;
83
+ `)}}
84
+ }
85
+ > ul > li {
86
+ overflow: visible;
87
+ font-weight: 300;
88
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
89
+
90
+ a {
91
+ display: inline-block;
92
+
93
+ @media (hover: hover) {
94
+ &:hover {
95
+ text-decoration: underline;
96
+ }
97
+ }
98
+ }
99
+ }
100
+ `;const qe=t=>s.css`
101
+ ${t["data-loading"]&&"position: relative;"};
102
+ ${t["data-loading"]&&"min-height: 150px;"}
103
+ > * {
104
+ transition: 200ms ease-out opacity;
105
+ opacity: ${t["data-loading"]?"0.5":"1"};
106
+ }
107
+ .humany-loader {
108
+ opacity: ${t["data-loading"]?"1":"0"};
109
+ }
110
+ `;s.newStyled(s.Icon)`
111
+ && {
112
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.small}};
113
+ }
114
+ width: 1.2em;
115
+ `;s.newStyled(s.Text)`
116
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.medium}};
117
+ font-weight: normal;
118
+ line-height: 1.2em;
119
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
120
+ `;const Fe=s.newStyled(s.Button)`
121
+ display: flex;
122
+ align-items: center;
123
+
124
+ ${t=>{var e;return t["data-has-label"]==="true"&&t["data-has-symbol"]==="true"&&`
125
+ svg, i {
126
+ margin: 0 ${(e=t.theme.sizes)==null?void 0:e.small} 0 0;
127
+ }
128
+ `}}
129
+
130
+ &:focus-visible {
131
+ ${t=>t["data-has-label"]==="true"&&s.paddedBorderTabStyle}
132
+
133
+ svg, i {
134
+ ${t=>t["data-has-label"]==="false"&&t["data-has-symbol"]==="true"&&s.css`
135
+ ${s.paddedBorderTabStyle(t)}
136
+ box-sizing: content-box;
137
+ `}
138
+ }
139
+ }
140
+
141
+ span {
142
+ flex: 1;
143
+ font-weight: 300;
144
+ }
145
+ `,Pe=({addFavoriteTooltip:t,removeFavoriteCancelLabel:e,removeFavoriteConfirmLabel:o,removeFavoriteHeader:n,removeFavoriteLabel:i,removeFavoriteTooltip:r,id:c,isFavorite:a,guideTitle:l,buttonLabel:d="",actions:{addFavorite:g,removeFavorite:f}})=>{const y=b.useCallback(()=>{f(c)},[c,f]),v=b.useCallback(()=>{g(c)},[c,g]),p=`${a?r:t}${l?`: "${l}"`:""}`;return a?u.jsx(s.Confirm,{trigger:u.jsxs(ce,{className:"humany-favorite-button",title:p,"aria-label":p,"data-favorite":"true","data-has-label":d?"true":"false","data-has-symbol":"true",children:[u.jsx(s.SymbolBadge,{size:16,symbol:{type:"Svg",content:"star-empty"}}),d&&u.jsx(s.StyledText,{children:d})]}),onConfirm:y,cancelLabel:e,confirmLabel:o,header:n,text:i}):u.jsxs(ce,{className:"humany-favorite-button",title:p,"aria-label":p,onClick:v,"data-favorite":"false","data-has-label":d?"true":"false","data-has-symbol":"true",children:[u.jsx(s.SymbolBadge,{size:16,symbol:{type:"Svg",content:"star-empty"}}),d&&u.jsx(s.StyledText,{children:d})]})},ce=s.newStyled(Fe)`
146
+ grid-area: favorite;
147
+
148
+ &:focus-visible {
149
+ svg {
150
+ ${t=>{var e,o;return t["data-favorite"]==="true"?`
151
+ fill: transparent;
152
+
153
+ path {
154
+ fill: transparent;
155
+ }
156
+ `:`
157
+ fill: ${(e=t.theme.colors)==null?void 0:e.text};
158
+
159
+ path {
160
+ fill: ${(o=t.theme.colors)==null?void 0:o.text};
161
+ }
162
+ `}}
163
+ }
164
+ }
165
+
166
+ ${t=>{var e,o,n,i,r,c,a;return((e=t.theme.colors)==null?void 0:e.text)&&s.css`
167
+ svg {
168
+ stroke: ${(o=t.theme.colors)==null?void 0:o.text};
169
+
170
+ path {
171
+ stroke: ${(n=t.theme.colors)==null?void 0:n.text};
172
+ }
173
+
174
+ ${t["data-favorite"]==="true"&&`
175
+ fill: ${(i=t.theme.colors)==null?void 0:i.text};
176
+
177
+ path {
178
+ fill: ${(r=t.theme.colors)==null?void 0:r.text};
179
+ }
180
+ `};
181
+ }
182
+
183
+ &:hover {
184
+ svg {
185
+ ${t["data-favorite"]==="true"?`
186
+ fill: transparent;
187
+
188
+ path {
189
+ fill: transparent;
190
+ }
191
+ `:`
192
+ fill: ${(c=t.theme.colors)==null?void 0:c.text};
193
+
194
+ path {
195
+ fill: ${(a=t.theme.colors)==null?void 0:a.text};
196
+ }
197
+ `};
198
+ }
199
+ }
200
+ `}}
201
+ `;b.forwardRef(({onFeedback:t=()=>{},direction:e="horizontal",className:o,header:n,positive:i,negative:r,selected:c,...a},l)=>u.jsxs(Ge,{className:s.appendClassNames(o,"humany-feedback"),"data-direction":e,...s.convertToStringAttributes(a),ref:l,children:[!!n&&u.jsx(De,{children:n}),u.jsxs(le,{className:"humany-feedback-button",disabled:!!c,"data-selected":c==="positive","data-direction":e,onClick:()=>t("positive"),children:[u.jsx(s.Icon,{faIcon:"smile-o"}),u.jsx("span",{children:i})]}),u.jsxs(le,{className:"humany-feedback-button",disabled:!!c,"data-selected":c==="negative","data-direction":e,onClick:()=>t("negative"),children:[u.jsx(s.Icon,{faIcon:"frown-o"}),u.jsx("span",{children:r})]})]}));const De=s.newStyled(s.StyledText)`
202
+ font-weight: normal;
203
+ margin: 0 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
204
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
205
+ display: block;
206
+ `,le=s.newStyled(s.Button)`
207
+ display: inline-block;
208
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
209
+ font-weight: 300;
210
+ && {
211
+ margin-right: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
212
+ }
213
+
214
+ ${t=>{var e,o;return t["data-direction"]==="horizontal"&&s.css`
215
+ width: 225px;
216
+ max-width: calc(50% - ${(e=t.theme.sizes)==null?void 0:e.large} - ${(o=t.theme.sizes)==null?void 0:o.small});
217
+ `}}
218
+
219
+ ${t=>t["data-direction"]==="vertical"&&s.css`
220
+ min-width: 190px;
221
+ `}
222
+
223
+ ${t=>{var e,o;return((e=t.theme.colors)==null?void 0:e.primary)&&s.invertedHoverButton({active:t["data-selected"],primaryColor:(o=t.theme.colors)==null?void 0:o.primary,secondaryColor:"#FFFFFF",theme:t.theme})}}
224
+
225
+ i {
226
+ margin: 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}} 0 0;
227
+ }
228
+ `,Ge=s.newStyled.div`
229
+ ${t=>{var e;return t["data-direction"]==="vertical"&&s.css`
230
+ > button {
231
+ width: 100%;
232
+ &:not(:last-child) {
233
+ margin-bottom: ${(e=t.theme.sizes)==null?void 0:e.normal};
234
+ }
235
+ }
236
+ `}}
237
+ `,He=()=>{const t=s.useContainer(),[e,o]=b.useState([]),n=t.get("favorites");b.useEffect(()=>{if(n){o(n.get());const{events:l}=t.get("$widget");return l.subscribe("widget:favorites-updated",(g,{updated:f})=>{o([...f])})}},[]);const i=l=>n?n.add(l):Promise.resolve([]),r=l=>n?n.remove(l):Promise.resolve([]),c=()=>n?n.clear():Promise.resolve([]),a=b.useCallback(l=>e.indexOf(l)>-1?r(l):i(l),[e]);return[e,b.useMemo(()=>({addFavorite:i,removeFavorite:r,clearFavorites:c,toggleFavorite:a}),[e])]},Ye=({format:t=ue.YYYY_MM_DD_HH_MM,className:e="",byLabel:o="",modifiedLabel:n="",publishedLabel:i="",modifiedBy:r="",publishedBy:c="",showModified:a=!1,showPublished:l=!1,modified:d,published:g})=>{const f=l&&g?u.jsx(de,{format:t,timestamp:g}):null,y=a&&d?u.jsx(de,{format:t,timestamp:d}):null;return!f&&!y?null:u.jsxs(X,{className:s.appendClassNames(e,"humany-metadata"),children:[f&&u.jsxs(X,{className:"humany-published",children:[i,f,o&&c&&` ${o.replace("{{editor}}",c)}`]}),y&&u.jsxs(X,{className:"humany-modified",children:[f&&", ",n,y,o&&r&&` ${o.replace("{{editor}}",r)}`]})]})},de=s.newStyled(he)`
238
+ &:not(:first-child) {
239
+ margin-left: 4px;
240
+ }
241
+ &:not(:last-child) {
242
+ margin-right: 4px;
243
+ }
244
+ `,X=s.newStyled(s.Text)`
245
+ font-style: italic;
246
+ `,Ue=({tags:t})=>t.filter(e=>e.symbol).length?u.jsx(Qe,{className:"humany-guide-list-tags",items:t,renderItem:({id:e,symbol:o,title:n})=>o&&u.jsx("li",{"data-tag":e,children:u.jsx(Ve,{size:18,symbol:o,title:n})},e)}):null;b.forwardRef(({title:t,id:e,route:o,symbolSize:n,collapseUri:i,children:r},c)=>{const{params:a}=ie();return u.jsxs(_e,{ref:c,"data-guide":e,children:[u.jsx(s.TextLink,{title:t,"aria-label":t,routeName:o,params:H({...a,uriName:i||void 0,id:void 0,guide:void 0,accordion:void 0}),text:t,children:u.jsx(s.SymbolBadge,{size:n,symbol:{type:"Svg",content:"caret-up"}})}),r]})});const _e=s.newStyled.li`
247
+ > a {
248
+ grid-column: 1/-1;
249
+ font-weight: bold;
250
+ margin: 0 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}} 0;
251
+ }
252
+
253
+ > div {
254
+ grid-column: 1/-1;
255
+ }
256
+ `;b.forwardRef(({expandable:t=!1,routing:e={},paramMappers:o={},symbolSize:n=11,pageRole:i="link",pageCaret:r="down",showTags:c=!1,showFavoriteToggle:a=!1,localPaging:l=!1,onItemClick:d=()=>{},dispatch:g=()=>{},metadata:f={},pageLabel:y,className:v,children:p,items:m,renderItem:h,addFavoriteTooltip:x,removeFavoriteCancelLabel:C,removeFavoriteConfirmLabel:N,removeFavoriteHeader:w,removeFavoriteLabel:j,removeFavoriteTooltip:$,searchResultsEmptyLabel:q,...M},I)=>{const L=Re(),S=b.useRef(),z=s.usePrevious(m),{guide:ye="guide",page:pe="index"}=e,{guide:be=({id:k})=>H({guide:k}),page:se=()=>H()}=o,[ve,xe]=He();b.useImperativeHandle(I,()=>S.current);const Q=k=>{const{id:E,title:T,tags:O,published:Y,modified:F,publishedBy:U,modifiedBy:V}=k;return u.jsxs("li",{"data-guide":E,"has-metadata":(!!(f!=null&&f.showPublished)&&!!Y||!!(f!=null&&f.showModified)&&!!F).toString(),children:[u.jsx(s.TextLink,{className:"humany-guide-link",title:T,"aria-label":T,routeName:ye,onClick:Se=>d(Se,k),params:be(k),text:T,children:u.jsx(s.SymbolBadge,{size:n,symbol:{type:"Svg",content:t?"caret-down":"caret-right"}})}),a&&u.jsx(Pe,{guideTitle:T,addFavoriteTooltip:x,removeFavoriteCancelLabel:C,removeFavoriteConfirmLabel:N,removeFavoriteHeader:w,removeFavoriteLabel:j,removeFavoriteTooltip:$,isFavorite:ve.indexOf(E)>-1,actions:xe,id:E}),c&&u.jsx(Ue,{tags:O}),u.jsx(We,{...f,indent:t?void 0:n,modified:F,published:Y,publishedBy:U,modifiedBy:V})]},E)},we=b.useCallback((k,E,T)=>h?h(k,E,T,Q):Q(k),[h,Q]),$e=b.useCallback(k=>{l&&(k.preventDefault(),g("page",se()))},[g,l]);b.useEffect(()=>{if(z&&z.length<m.length&&S.current){const k=S.current.querySelectorAll(".humany-guide-list > ul > li"),E=k[z.length];if(k.length===m.length&&z.length){const T=k[z.length];if(T){const O=T.querySelector(".humany-guide-link");O&&O.focus()}}else E&&new MutationObserver((O,Y)=>{O.forEach(F=>{if(F.addedNodes){const U=Array.from(F.addedNodes).find(V=>V.tagName==="A");U&&je(S.current,document.activeElement)&&(L&&U.focus(),Y.disconnect())}})}).observe(E,{attributes:!1,characterData:!1,childList:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1})}});const Ce=!!Object.keys(f).filter(k=>typeof f[k]<"u").length;return u.jsxs(Ke,{className:s.appendClassNames(v,"humany-guide-list"),"data-item-count":m.length,items:m,renderItem:we,isTabbing:L,expandable:t?"true":"false","grid-items":c||a||Ce?"true":"false",...s.convertToStringAttributes(M),ref:S,children:[y?u.jsx(s.TextLink,{text:y,title:y,"aria-label":y,routeName:pe,role:i,params:se(),onClick:$e,children:u.jsx(s.SymbolBadge,{size:n,symbol:{type:"Svg",content:`caret-${r}`}})}):null,p,!M["data-loading"]&&m.length===0&&u.jsx("p",{children:q})]})});const Ke=s.newStyled(s.ItemList)`
257
+ ${s.itemList}
258
+ padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
259
+ overflow: auto;
260
+ justify-content: flex-start;
261
+ white-space: nowrap;
262
+ font-weight: 300;
263
+ text-decoration: none;
264
+
265
+ > div {
266
+ ${t=>s.headingElement(t)("> h1",s.css`
267
+ white-space: pre-wrap;
268
+ `)}
269
+ }
270
+
271
+ > ul > li {
272
+ ${t=>{var e,o;return t["grid-items"]==="true"&&s.css`
273
+ display: grid;
274
+ grid-template-columns: auto 1fr 1fr;
275
+ gap: 0px 0px;
276
+ grid-template-areas: '. favorite tags';
277
+ align-items: center;
278
+
279
+ > button {
280
+ margin: 0 0 0 ${(e=t.theme.sizes)==null?void 0:e.small};
281
+
282
+ &[data-favorite='false'] {
283
+ ${t.isTabbing?"opacity: 0;":"display: none;"};
284
+ &:focus {
285
+ opacity: 1;
286
+ }
287
+ }
288
+ }
289
+
290
+ > span {
291
+ font-size: ${(o=t.theme.fonts)==null?void 0:o.small};
292
+ }
293
+
294
+ &:hover {
295
+ button[data-favorite='false'] {
296
+ display: flex;
297
+ justify-self: flex-start;
298
+ }
299
+ }
300
+
301
+ &[has-metadata='true'] {
302
+ grid-template-rows: 1fr 1fr;
303
+ grid-template-areas:
304
+ '. favorite tags'
305
+ 'metadata metadata metadata';
306
+ }
307
+ `}}
308
+ > a {
309
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
310
+ overflow: hidden;
311
+ text-overflow: ellipsis;
312
+ max-width: 100%;
313
+ display: inline-block;
314
+
315
+ svg {
316
+ margin: 0 calc(${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}}*2) 0 0;
317
+ line {
318
+ stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
319
+ }
320
+ }
321
+
322
+ ${t=>{var e;return t.expandable==="true"&&s.css`
323
+ display: flex;
324
+ flex-direction: row-reverse;
325
+ justify-content: flex-end;
326
+ align-items: center;
327
+
328
+ span {
329
+ overflow: hidden;
330
+ text-overflow: ellipsis;
331
+ }
332
+
333
+ svg {
334
+ margin: 0 0 0 ${(e=t.theme.sizes)==null?void 0:e.small};
335
+ }
336
+ `}}
337
+
338
+ &:focus-visible {
339
+ ${s.borderTabStyle}
340
+ text-decoration: underline;
341
+ }
342
+
343
+ @media (hover: hover) {
344
+ &:hover {
345
+ text-decoration: underline;
346
+ }
347
+ }
348
+ }
349
+ }
350
+
351
+ > a {
352
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
353
+ margin: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}} 0 0;
354
+ align-self: flex-start;
355
+ align-items: center;
356
+ display: flex;
357
+
358
+ span {
359
+ text-decoration: underline;
360
+ }
361
+
362
+ svg {
363
+ margin: 0 calc(${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}}*2) 0 0;
364
+ line {
365
+ stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
366
+ }
367
+ }
368
+
369
+ &:focus-visible {
370
+ ${s.borderTabStyle}
371
+ text-decoration: underline;
372
+ }
373
+ }
374
+ `,Qe=s.newStyled(s.List)`
375
+ ${s.list}
376
+ display: flex;
377
+ margin: 0 0 0 auto;
378
+ grid-area: tags;
379
+
380
+ li,
381
+ li:last-child {
382
+ margin: 0 0 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
383
+ display: flex;
384
+ align-items: center;
385
+ justify-content: space-between;
386
+ }
387
+ `,Ve=s.newStyled(s.SymbolBadge)`
388
+ display: block;
389
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
390
+ ${t=>{if(t.symbol.type==="Uri")return`
391
+ width: ${t.size}px;
392
+ height: ${t.size}px;
393
+ `;if(t.symbol.type==="FontAwesome")return`
394
+ font-size: ${t.size}px;
395
+ `}}
396
+ `,We=s.newStyled(Ye)`
397
+ grid-area: metadata;
398
+ text-overflow: ellipsis;
399
+ overflow: hidden;
400
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.small}};
401
+ ${t=>{var e;return typeof t.indent=="number"&&`text-indent: calc(${(e=t.theme.sizes)==null?void 0:e.small} * 2 + ${t.indent}px);`}}
402
+ `,Ze=s.keyframes`
403
+ 100% {
404
+ transform: rotate(360deg);
405
+ }
406
+ `,Je=s.keyframes`
407
+ 0% {
408
+ stroke-dasharray: 1, 200;
409
+ stroke-dashoffset: 0;
410
+ }
411
+ 50% {
412
+ stroke-dasharray: 89, 200;
413
+ stroke-dashoffset: -35px;
414
+ }
415
+ 100% {
416
+ stroke-dasharray: 89, 200;
417
+ stroke-dashoffset: -124px;
418
+ }
419
+ `;s.newStyled.svg`
420
+ animation: ${Ze} 2s linear infinite;
421
+ height: 100%;
422
+ transform-origin: center center;
423
+ width: 100%;
424
+ position: absolute;
425
+ top: 0;
426
+ bottom: 0;
427
+ left: 0;
428
+ right: 0;
429
+ margin: auto;
430
+ transition: 200ms ease-out opacity;
431
+ `;s.newStyled.div`
432
+ position: absolute;
433
+ top: 0;
434
+ bottom: 0;
435
+ left: 0;
436
+ right: 0;
437
+ height: 100%;
438
+ width: 100%;
439
+ pointer-events: ${t=>t["data-loading"]?"all":"none"};
440
+ display: flex;
441
+ flex-direction: column;
442
+ justify-content: center;
443
+ transition: 200ms ease-out opacity;
444
+ box-sizing: border-box;
445
+ overflow: hidden;
446
+
447
+ .humany-spinner-svg {
448
+ opacity: ${t=>t["data-loading"]?"1":"0"};
449
+ }
450
+ `;s.newStyled.div`
451
+ position: relative;
452
+ margin: 0 auto;
453
+ width: 100px;
454
+ &:before {
455
+ content: '';
456
+ display: block;
457
+ padding-top: 100%;
458
+ }
459
+ `;s.newStyled.circle`
460
+ stroke-dasharray: 1, 200;
461
+ stroke-dashoffset: 0;
462
+ animation: ${Je} 1.5s ease-in-out infinite;
463
+ stroke-linecap: round;
464
+ stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
465
+ stroke-width: 2px;
466
+ `;s.newStyled(s.Button)`
467
+ display: flex;
468
+ justify-content: space-between;
469
+ align-items: center;
470
+ width: 100%;
471
+ text-align: left;
472
+ svg,
473
+ i {
474
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
475
+ }
476
+ span {
477
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
478
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
479
+ overflow: hidden;
480
+ text-overflow: ellipsis;
481
+ flex: 1;
482
+ white-space: nowrap;
483
+ }
484
+ &:focus-visible {
485
+ ${s.borderTabStyle}
486
+ span {
487
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
488
+ text-decoration: underline;
489
+ }
490
+ }
491
+ `;s.newStyled(s.ItemList)`
492
+ ${qe}
493
+ ${s.itemList}
494
+ overflow: hidden;
495
+ justify-content: flex-start;
496
+ padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
497
+ ${t=>!t["data-show-header"]&&s.css`
498
+ > div {
499
+ ${s.headingElement(t)("h1",s.css`
500
+ display: none;
501
+ `)}
502
+ }
503
+ `}
504
+
505
+ @media (hover: hover) {
506
+ button:hover {
507
+ text-decoration: underline;
508
+ }
509
+ }
510
+ `;s.newStyled(s.Paragraph)`
511
+ ${s.genericHtml}
512
+ font-weight: 300;
513
+
514
+ p {
515
+ white-space: normal;
516
+ }
517
+ `;s.newStyled.li`
518
+ .humany-paragraph {
519
+ display: none;
520
+ &:not(:only-child) {
521
+ ${t=>{var e,o,n;return((e=t.theme.sizes)==null?void 0:e.cardinal)&&((o=t.theme.sizes)==null?void 0:o.normal)&&s.css`
522
+ margin: ${(n=t.theme.sizes)==null?void 0:n.normal} 0;
523
+ `}}
524
+ }
525
+ }
526
+
527
+ ${t=>t["data-expanded"]&&s.css`
528
+ .humany-paragraph {
529
+ display: block;
530
+ }
531
+ `}
532
+
533
+ > span {
534
+ display: block;
535
+ font-weight: 300;
536
+ color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.accent}};
537
+ }
538
+ `;s.newStyled(s.SymbolBadge)`
539
+ margin: 0 0 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
540
+ line {
541
+ stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
542
+ }
543
+ `;s.newStyled(he)`
544
+ font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.small}};
545
+ font-weight: 300;
546
+ `;s.newStyled(s.Paragraph)`
547
+ ${t=>{var e;return s.headingElement(t)("h1",s.css`
548
+ font-weight: normal;
549
+ font-size: ${(e=t.theme.fonts)==null?void 0:e.medium};
550
+ `)}}
551
+ `;const Xe=s.newStyled(s.Html)`
552
+ ${s.genericHtml}
553
+ font-weight: 300;
554
+ line-height: 1.5em;
555
+ button:focus-visible {
556
+ ${s.borderTabStyle};
557
+ }
558
+
559
+ a:focus-visible {
560
+ ${s.linkTabStyle};
561
+ }
562
+ `,et=t=>{const e=Me(t.clientName),{params:{contactCategory:o,guideCategory:n,phrase:i}}=ie();if(typeof e>"u")return null;if(e===null)return process.env.NODE_ENV!=="production"?u.jsx(it,{title:`client-name: ${t.clientName}, id: ${t.id}`,className:"humany-non-resolved-contact-method",children:u.jsx(s.Typography,{variant:"h5",children:"Non resolved Contact Method type"})}):null;const r=(c={})=>{const a={...t,...c},{id:l,title:d,clientName:g,symbol:f,inline:y,onClick:v=()=>{},description:p,htmlParseInstruction:m,className:h,disabled:x,guideId:C,dispatch:N=()=>{},expanded:w}=a,j=y?{onKeyDown:$=>{$.key&&$.key==="Enter"&&(v($,a),$.defaultPrevented||!w&&N("expand",l))},onClick:$=>{v($,a),$.defaultPrevented||!w&&N("expand",l)}}:{onClick:$=>v($,a),routeName:"contact-method",params:H({contactCategory:o,guideId:C,guideCategory:n,phrase:i,contactMethod:l,uriName:ee(d)})};return u.jsxs(ot,{title:d,"aria-label":d,className:h,disabled:x,description:p,"data-client-name":g,...c,...j,children:[f&&u.jsx(s.SymbolBadge,{symbol:f}),p?u.jsxs("div",{className:"humany-contact-link-rich-content",children:[u.jsx(me,{children:d}),u.jsx(Xe,{html:p,htmlParseInstruction:m})]}):u.jsx(me,{children:d})]})};return t.expanded?u.jsx(b.Suspense,{fallback:null,children:u.jsx(e,{...t,renderDefault:r})}):r()},tt=t=>{var e,o,n,i,r,c,a,l;return s.css`
563
+ display: flex;
564
+ padding: ${(e=t.theme.sizes)==null?void 0:e.large};
565
+ ${t.description?"":"align-items: center;"}
566
+ text-decoration: none;
567
+ span {
568
+ display: inline-block;
569
+ color: ${(o=t.theme.colors)==null?void 0:o.text};
570
+ }
571
+ i {
572
+ font-size: ${(n=t.theme.fonts)==null?void 0:n.large};
573
+ margin: 0 ${(i=t.theme.sizes)==null?void 0:i.large} 0 0;
574
+ min-height: ${(r=t.theme.fonts)==null?void 0:r.large};
575
+ min-width: ${(c=t.theme.fonts)==null?void 0:c.large};
576
+ line-height: ${(a=t.theme.fonts)==null?void 0:a.large};
577
+ display: inline-block;
578
+ vertical-align: bottom;
579
+ color: ${(l=t.theme.colors)==null?void 0:l.text};
580
+ }
581
+ `},me=s.newStyled(s.StyledText)`
582
+ line-height: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.large}};
583
+ `,ot=s.newStyled(s.Link)`
584
+ ${t=>tt(t)}
585
+
586
+ &:focus-visible {
587
+ ${s.borderTabStyle};
588
+ }
589
+ `,it=s.newStyled.div`
590
+ text-align: center;
591
+ display: block;
592
+ ${t=>{var e,o;return typeof((e=t.theme.colors)==null?void 0:e.warning)<"u"&&`color: ${(o=t.theme.colors)==null?void 0:o.warning};`}}
593
+ `,st=t=>{var e,o,n;return s.css`
594
+ ${s.itemList(t)}
595
+
596
+ > div {
597
+ padding: ${(e=t.theme.sizes)==null?void 0:e.large};
598
+
599
+ ${s.headingElement(t)("h1",s.css`
600
+ margin: 0;
601
+ `)}
602
+ }
603
+
604
+ > ul {
605
+ &:not(:first-child) {
606
+ border-top: ${t.theme.border};
607
+ }
608
+
609
+ > li {
610
+ margin: 0;
611
+ white-space: normal;
612
+
613
+ > a {
614
+ overflow: hidden;
615
+ }
616
+
617
+ &:first-child > a {
618
+ border-radius: ${`${t.theme.borderRadius} ${t.theme.borderRadius} 0 0`};
619
+ }
620
+
621
+ &:last-child:not(:first-child) > a {
622
+ border-radius: ${`0 0 ${t.theme.borderRadius} ${t.theme.borderRadius}`};
623
+ }
624
+
625
+ &:not(:last-child) {
626
+ border-bottom: ${t.theme.border};
627
+ }
628
+
629
+ > div {
630
+ padding: ${(o=t.theme.sizes)==null?void 0:o.large};
631
+ }
632
+ }
633
+ }
634
+
635
+ @media (hover: hover) {
636
+ a:hover {
637
+ background-color: ${(n=t.theme.colors)==null?void 0:n.accent};
638
+ }
639
+ }
640
+ `};s.newStyled(s.ItemList)`
641
+ ${t=>st(t)}
642
+ `;const nt=({contactMethodId:t,guideId:e,groupId:o,className:n,container:i})=>{var f,y,v;const[r,c]=b.useState(),a=Te(),l=b.useRef(!0),d=ze();console.log("¤¤¤Container",i),b.useEffect(()=>{const{events:p}=i==null?void 0:i.get("$widget"),m=p.subscribe("conversational-hub-provider:form-submitted",async(x,C)=>{var I;if(((I=C.form.meta)==null?void 0:I.groupId)!==o||C.id!==(r==null?void 0:r.id))return;d&&(C.form.meta||(C.form.meta={}),C.form.meta.conversation=d);const N=await(i==null?void 0:i.getAsync("contactMethods")),w={...r,body:{...r.body,form:C.form}},{errors:j,valid:$,errorTypes:q}=await N.validate(w);if(!$){const L=new s.FormBuilder(r.body.form);c(void 0),L.setValidationErrors(j),w.body={...w.body,form:L.get()},c({...w});return}const M=await N.submit(w);w.confirmation=M,c(w)}),h=p.subscribe("bot-provider:evaluate",async(x,C)=>{if(C.id!==t)return;const w=await(await(i==null?void 0:i.getAsync("contactMethods"))).evaluate(r);let j={...r,body:{...r.body,form:w}};const $=s.updateForm(j,{submit:"Submit",errors:{},meta:{groupId:o}});j={...j,body:$},c(j)});return()=>{m(),h()}},[i,r,c,d]);const g=b.useCallback(async p=>{const h=await(await G.getInstance(i)).fetch(ge.ContactMethod,{contactMethodId:p,guideId:e},{noCache:!0}),x=s.updateForm(h,{submit:"Submit",errors:{},meta:{groupId:o}});if(h.body=x,h.body.guideId=e,!l.current)return null;c(h)},[l]);return b.useEffect(()=>(g(t),()=>{l.current=!1}),[t,g]),r?u.jsx(rt,{...r,body:{...r.body,form:r.body.form?{...r.body.form,data:(f=r.body.form)==null?void 0:f.data,layout:{...r.body.form.layout},meta:(y=r.body.form)==null?void 0:y.meta,schema:(v=r.body.form)==null?void 0:v.schema}:void 0,guideId:r.body.guideId},inline:!0,expanded:!0,dispatch:a,className:s.appendClassNames("humany-bot-contact-method",n)}):null},rt=s.newStyled(et)`
643
+ padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}} ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
644
+ `;exports.default=nt;