@telia-ace/widget-conversation-flamingo 1.1.12-rc.1 → 1.1.12-rc.10
Sign up to get free protection for your applications and to get access to all the features.
- package/conversation-1bf28a6e.js +572 -0
- package/conversation-7da6b954.mjs +2619 -0
- package/conversation-component.d.ts +2 -0
- package/conversation-platform.d.ts +10 -49
- package/conversation-session.d.ts +11 -0
- package/conversation.d.ts +23 -0
- package/entry.d.ts +9 -0
- package/group.d.ts +7 -0
- package/{index-1ea0fde8.mjs → index-217978bc.mjs} +320 -319
- package/index-43151bb4.js +1 -0
- package/index-494250de.js +3 -0
- package/index-4ba82b09.mjs +777 -0
- package/index.d.ts +6 -10
- package/index.js +1 -1
- package/index.mjs +7 -9
- package/{components/conversation/ui/message-types → message-types}/message-type-html.d.ts +3 -2
- package/models/agent.d.ts +8 -0
- package/models/conversation-entry.d.ts +11 -0
- package/models/conversation-provider.d.ts +19 -0
- package/models/conversation-session-state.d.ts +13 -0
- package/models/user.d.ts +8 -0
- package/package.json +5 -6
- package/types.d.ts +9 -123
- package/agent.d.ts +0 -20
- package/components/conversation/conversation.d.ts +0 -19
- package/components/conversation/plugin.d.ts +0 -45
- package/components/conversation/ui/message-list.d.ts +0 -9
- package/components/conversation/ui/message-types/message-type-link-list.d.ts +0 -8
- package/components/conversation/ui/message-types/message-type-separator.d.ts +0 -7
- package/components/conversation/ui/message.d.ts +0 -8
- package/components/conversation/utils.d.ts +0 -1
- package/conversation-5265abc7.js +0 -446
- package/conversation-8c2255c2.mjs +0 -1865
- package/conversation-controller.d.ts +0 -118
- package/conversation-history.d.ts +0 -26
- package/conversation-provider.d.ts +0 -32
- package/index-5cf6726d.js +0 -156
- package/index-836222bd.mjs +0 -3923
- package/index-c51d4b6a.js +0 -1
- package/send-18482cae.mjs +0 -4
- package/send-eb8b9428.js +0 -1
- package/store.d.ts +0 -31
- package/user.d.ts +0 -9
- package/utils/custom-message.d.ts +0 -2
- package/utils/index.d.ts +0 -1
- package/utils/open-chat-widget.d.ts +0 -4
- package/utils/swap-provider.d.ts +0 -8
@@ -1,118 +0,0 @@
|
|
1
|
-
import { Container, EventListener, EventManager } from '@webprovisions/platform';
|
2
|
-
import { AgentSettings } from './agent';
|
3
|
-
import { ConversationProvider } from './conversation-provider';
|
4
|
-
import { ConversationMessageContent, ConversationMessageSender, ConversationMessageSettings, ConversationMessageUpdateSettings, ConverstationMessageItem, NormalizedMessageSettings } from './types';
|
5
|
-
import { User } from './user';
|
6
|
-
export type ValidateHandler = (formValues: Record<string, any>) => Promise<any>;
|
7
|
-
export type SubmitHandler = (formValues: Record<string, any>) => Promise<any>;
|
8
|
-
export type ConversationOptions = {
|
9
|
-
silent: boolean;
|
10
|
-
};
|
11
|
-
export type Print = (content: string | ConversationMessageContent) => ConversationEntry;
|
12
|
-
export type FormHandlers = {
|
13
|
-
[key: string]: FormHandler;
|
14
|
-
};
|
15
|
-
export type FormHandler = {
|
16
|
-
validate?: ValidateHandler;
|
17
|
-
submit: SubmitHandler;
|
18
|
-
};
|
19
|
-
export type CancelLoaderDelegate = () => void;
|
20
|
-
export declare class ConversationEntry {
|
21
|
-
private writer;
|
22
|
-
entryId: string;
|
23
|
-
constructor(writer: EntryWriter);
|
24
|
-
update(content: string | ConversationMessageUpdateSettings | ConverstationMessageItem<any> | ConverstationMessageItem<any>[]): void;
|
25
|
-
remove(): void;
|
26
|
-
private getNormalizedSettings;
|
27
|
-
}
|
28
|
-
export declare enum ConversationMessageType {
|
29
|
-
User = "user",
|
30
|
-
Agent = "agent",
|
31
|
-
System = "system"
|
32
|
-
}
|
33
|
-
export type ConversationMessage = {
|
34
|
-
key: string;
|
35
|
-
timestamp: number | null;
|
36
|
-
content: ConversationMessageContent | null;
|
37
|
-
sender: ConversationMessageSender | null;
|
38
|
-
type: ConversationMessageType;
|
39
|
-
};
|
40
|
-
export type EntryWriter = (content: ConversationMessageUpdateSettings | null) => void;
|
41
|
-
export declare const getNormalizedMessageSettings: (settings: string | ConversationMessageSettings | ConverstationMessageItem<any> | ConverstationMessageItem<any>[], options?: {
|
42
|
-
key?: string;
|
43
|
-
}) => NormalizedMessageSettings;
|
44
|
-
/**
|
45
|
-
* Manages the stream of messages inside a `ConversationComponent` and provides external read-write
|
46
|
-
* access to it as well as exposing emitted actions.
|
47
|
-
*/
|
48
|
-
export declare class ConversationController {
|
49
|
-
container: Container;
|
50
|
-
id: string;
|
51
|
-
formHandlers: FormHandlers;
|
52
|
-
/**
|
53
|
-
* Represents the current end user.
|
54
|
-
*/
|
55
|
-
user: User;
|
56
|
-
events: EventManager;
|
57
|
-
providers: string[];
|
58
|
-
active: boolean;
|
59
|
-
queuedProviders: string[];
|
60
|
-
registeredProviders: ConversationProvider[];
|
61
|
-
private loaders;
|
62
|
-
private componentMounted;
|
63
|
-
private store;
|
64
|
-
messages: ConversationMessage[];
|
65
|
-
private typingActors;
|
66
|
-
private conversationHistory;
|
67
|
-
constructor(container: Container, id: string, options: {
|
68
|
-
rehydrate: boolean;
|
69
|
-
});
|
70
|
-
setInitialStorage(data: {
|
71
|
-
agents: AgentSettings[];
|
72
|
-
}): void;
|
73
|
-
setProviders(providers: string[]): void;
|
74
|
-
createProvider(name: string): ConversationProvider;
|
75
|
-
providerIndex(name: string): number;
|
76
|
-
getAgentById(id?: string): {
|
77
|
-
id: string;
|
78
|
-
name: string;
|
79
|
-
avatar?: string | undefined;
|
80
|
-
providerName: string;
|
81
|
-
} | undefined;
|
82
|
-
dispose(): void;
|
83
|
-
onDispose(fn: EventListener): import("@webprovisions/platform").EventSubscriptionCancellation;
|
84
|
-
onStarted(fn: EventListener): import("@webprovisions/platform").EventSubscriptionCancellation;
|
85
|
-
onMessageCreated(fn: EventListener): import("@webprovisions/platform").EventSubscriptionCancellation;
|
86
|
-
isRehydrated(): Promise<boolean>;
|
87
|
-
disposeProvider(target: ConversationProvider): void;
|
88
|
-
onProvidersChange(fn: EventListener): import("@webprovisions/platform").EventSubscriptionCancellation;
|
89
|
-
setComponentMountedState(mounted: boolean): void;
|
90
|
-
setProviderOptions(providerName: string, options: ConversationOptions): void;
|
91
|
-
changeProvider(providerName: string): void;
|
92
|
-
queueProviders(providers: string[]): void;
|
93
|
-
onCompleteProvider(): void;
|
94
|
-
getComponentMountedState(): boolean;
|
95
|
-
onUnreadMessage(fn: EventListener): import("@webprovisions/platform").EventSubscriptionCancellation;
|
96
|
-
createEntry(key: string, content: ConversationMessageContent, type: ConversationMessageType, sender?: ConversationMessageSender, timestamp?: number | null): ConversationEntry;
|
97
|
-
print: (settings: string | ConversationMessageSettings) => ConversationEntry;
|
98
|
-
update(): void;
|
99
|
-
getMessageStream(): {
|
100
|
-
messages: ConversationMessage[];
|
101
|
-
loading: boolean;
|
102
|
-
typingActors: ConversationMessageSender[];
|
103
|
-
};
|
104
|
-
setTypingState(sender: ConversationMessageSender, _type?: ConversationMessageType): () => void;
|
105
|
-
/**
|
106
|
-
* Displays a loader in the conversation.
|
107
|
-
*/
|
108
|
-
loader(): CancelLoaderDelegate;
|
109
|
-
submitForm(key: string, handler: SubmitHandler): void;
|
110
|
-
validateForm(key: string, handler: ValidateHandler): void;
|
111
|
-
getHistory(): {
|
112
|
-
message?: string | undefined;
|
113
|
-
options?: string[] | undefined;
|
114
|
-
alias: string;
|
115
|
-
source: string;
|
116
|
-
timestamp: number | null;
|
117
|
-
}[];
|
118
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import { ConversationController, ConversationMessageType } from './conversation-controller';
|
2
|
-
import { ConversationMessageContent, ConversationMessageSender } from './types';
|
3
|
-
type ConversationLogMessage = {
|
4
|
-
message?: string;
|
5
|
-
options?: string[];
|
6
|
-
alias: string;
|
7
|
-
source: string;
|
8
|
-
timestamp: number | null;
|
9
|
-
};
|
10
|
-
export declare class ConversationHistory {
|
11
|
-
private controller;
|
12
|
-
private cache;
|
13
|
-
private subscriptions;
|
14
|
-
constructor(controller: ConversationController);
|
15
|
-
getConversationLogs(): ConversationLogMessage[];
|
16
|
-
parseEntry(content: ConversationMessageContent, type: ConversationMessageType, sender?: ConversationMessageSender, timestamp?: any | null): ConversationLogMessage;
|
17
|
-
private createMessageSource;
|
18
|
-
private createAlias;
|
19
|
-
private handleContactMethod;
|
20
|
-
private getDetails;
|
21
|
-
private createMessageContent;
|
22
|
-
private createMessageOptions;
|
23
|
-
private appendText;
|
24
|
-
dispose(): void;
|
25
|
-
}
|
26
|
-
export {};
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import { Container, EventListener, EventSubscriptionCancellation } from '@webprovisions/platform';
|
2
|
-
import { Agent, AgentSettings } from './agent';
|
3
|
-
import { CancelLoaderDelegate, ConversationController, ConversationEntry, ConversationMessageType, ConversationOptions } from './conversation-controller';
|
4
|
-
import { ConversationMessageContent, ConversationMessageSender, ConversationMessageSettings } from './types';
|
5
|
-
export declare class ConversationProvider {
|
6
|
-
name: string;
|
7
|
-
controller: ConversationController | null;
|
8
|
-
private subscriptions;
|
9
|
-
options: ConversationOptions;
|
10
|
-
user: any;
|
11
|
-
private constructor();
|
12
|
-
static create(name: string, container: Container, controller: ConversationController): ConversationProvider;
|
13
|
-
createAgent(settings?: AgentSettings): Agent | undefined;
|
14
|
-
print(settings: string | ConversationMessageSettings): ConversationEntry | undefined;
|
15
|
-
setTypingState(sender: ConversationMessageSender, type?: ConversationMessageType): (() => void) | undefined;
|
16
|
-
loading(): CancelLoaderDelegate;
|
17
|
-
createEntry(key: string, content: ConversationMessageContent, type: ConversationMessageType, sender?: ConversationMessageSender, timestamp?: number | null): ConversationEntry | undefined;
|
18
|
-
dispose(): void;
|
19
|
-
isRehydrated(): Promise<boolean>;
|
20
|
-
getHistory(): {
|
21
|
-
message?: string | undefined;
|
22
|
-
options?: string[] | undefined;
|
23
|
-
alias: string;
|
24
|
-
source: string;
|
25
|
-
timestamp: number | null;
|
26
|
-
}[];
|
27
|
-
complete(): void;
|
28
|
-
setOptions(options?: ConversationOptions): void;
|
29
|
-
onUnreadMessage(fn: EventListener): EventSubscriptionCancellation | void;
|
30
|
-
onMounted(fn: EventListener): EventSubscriptionCancellation | void;
|
31
|
-
}
|
32
|
-
export default ConversationProvider;
|
package/index-5cf6726d.js
DELETED
@@ -1,156 +0,0 @@
|
|
1
|
-
"use strict";const It=(n,t,e,...s)=>{const i=`[${n.get("$environment").name||"webprovisions"}] ${e}`;switch(t){case"info":console.info(i,...s);break;case"warning":console.warn(i,...s);break;case"error":console.error(i,...s);break}},Ps=n=>{const t=n.container||n;return{info:(e,...s)=>It(t,"info",e,...s),warn:(e,...s)=>It(t,"warning",e,...s),error:(e,...s)=>It(t,"error",e,...s)}};var et=(n=>(n.Implementation="implementation",n.Widget="widget",n))(et||{}),N=(n=>(n.Pre="pre",n.Post="post",n))(N||{});const Es=(n,t,e,s)=>{try{const i=new t(e,s);return{name:n,invoke:(r,o)=>{let a;return i[r]&&(a=i[r].call(i,o)),Promise.resolve(a)},getInstance:()=>i}}catch(i){if(i.message&&i.message.indexOf("is not a constructor")>=0)return{name:n,invoke:r=>{let o;return r==="initialize"&&(o=t(e,s)),Promise.resolve(o)},getInstance:()=>t};throw i}};function me(n,t){return typeof n>"u"?t:n}let xs=class{constructor(t={}){this.part=t}createCommand(t,e,s){let i;typeof e=="function"?i={scope:et.Widget,stage:N.Post,defaultArgs:void 0,handlerResolver:e}:i={scope:me(e.scope,et.Widget),stage:me(e.stage,N.Post),defaultArgs:e.defaultArgs,handlerResolver:s};let r=this.part;const o=t.split(".");return o.forEach((a,c)=>{c===o.length-1?r[a]||(r[a]=()=>i):r=this.part[a]=this.part[a]||{}}),this}get(){return this.part}};const qe=n=>{const t=new xs({});return n(t),t.get()};qe(n=>{n.createCommand("types.register",{scope:et.Implementation,stage:N.Pre},t=>(e,s)=>{t.container.get("$types")[e]=s}).createCommand("type",{stage:N.Pre},t=>e=>{t.container.register("$type",e)}).createCommand("settings",{stage:N.Pre,defaultArgs:[null]},t=>e=>{t.events.dispatch("settings:change",e,{bubbles:!0}),t.container.register("$settings",e)}).createCommand("plugin",{stage:N.Pre},t=>(e,s,i)=>{const{container:r}=t;let o=null,a=e,c=s;typeof e=="string"&&(o=e,a=s,c=i);const h=d=>{const{transformPluginSettings:l}=t.container.get("$environmentOptions"),p=l?l(c||{},o,t.container,a):s;try{const u=Es(o,a,r,p);r.get("$plugins").push(u),d&&u.invoke("initialize",null)}catch(u){Ps(t).warn("Error when initializing plugin",u)}};t.container.get("$instance")?h(!0):t.events.subscribeOnce("widget:instance-created",()=>h(!1))}).createCommand("container.register",t=>(e,s)=>{t.container.register(e,s)}).createCommand("container.registerAsync",t=>(e,s)=>{t.container.registerAsync(e,s)}).createCommand("container.registerFactory",t=>(e,s)=>{t.container.registerFactory(e,s)}).createCommand("container.touch",t=>(e,s)=>{t.container.touch(e,s)}).createCommand("csp",{},t=>e=>{t.container.register("csp",e)})});const Cs=qe(n=>{n.createCommand("ready",{scope:et.Implementation,stage:N.Pre},t=>e=>{const{container:s}=t,i=s.owner;s.get("bootstrapping").ready?e(i):i.events.subscribeOnce("bootstrap:ready",()=>{e(i)})})}),Mt=new WeakMap;function q(){return n=>(Mt.has(n)||Mt.set(n,{}),Mt.get(n))}const Dt=(n,t,e,...s)=>{const i=`[${n.get("$environment").name||"webprovisions"}] ${e}`;switch(t){case"info":console.info(i,...s);break;case"warning":console.warn(i,...s);break;case"error":console.error(i,...s);break}},$=n=>{const t=n.container||n;return{info:(e,...s)=>Dt(t,"info",e,...s),warn:(e,...s)=>Dt(t,"warning",e,...s),error:(e,...s)=>Dt(t,"error",e,...s)}},v=q(),Gt=(()=>{let n=0;return()=>++n})(),Xt=(n,t,e)=>{const s=v(n).touchQueue.get(t);s&&s.forEach(i=>{i(e,n)})};let ks=class{constructor(t,e,s,i){this.key=t,this.factory=e,this.parent=s,this.container=i,this.id=Gt(),this.resolved=!1,this.constructed=!1,this.async=!0}resolve(){if(!this.constructed){const t=this.factory(this.parent,this.container);return this.constructed=!0,this.value=Promise.resolve(t).then(e=>(this.resolved=!0,Xt(this.container,this.key,e),e))}return this.value}},Ss=class{constructor(t,e,s,i){this.key=t,this.value=e,this.parent=s,this.container=i,this.id=Gt(),this.async=!1,this.resolved=!1,this.constructed=!0,this.resolve=()=>(this.resolved=!0,Xt(this.container,this.key,this.value),this.value)}},Os=class{constructor(t,e,s,i){this.key=t,this.value=e,this.parent=s,this.container=i,this.id=Gt(),this.async=!1,this.resolved=!1,this.constructed=!1,this.resolve=()=>{this.resolved=!0,this.constructed=!0;const r=this.value(this.parent,this.container);return Xt(this.container,this.key,this.value),r}}},Ns=class Fe{constructor(t,e,s){this.owner=t,this.name=e,this.parent=s,v(this).resolvers=new Map,v(this).touchQueue=new Map,v(this).children=[]}delete(t){const e=v(this).resolvers,s=Array.from(e.values()).find(i=>i.id===t);return s?(v(this).touchQueue.delete(s.key),Promise.resolve(e.delete(s.key))):this.parent?this.parent.delete(t):Promise.resolve(!1)}clear(){const t=v(this).resolvers,e=Array.from(t.values());return Promise.all(e.map(s=>{if(s.constructed)return Promise.resolve(s.resolve()).then(i=>{if(i!==null&&typeof i=="object"&&typeof i.dispose=="function")return i.dispose.call(i,this,s)})})).then(()=>{e.forEach(s=>this.delete(s.id)),v(this).children.forEach(s=>s.clear())})}detach(){if(this.parent){const t=v(this.parent).children,e=t.indexOf(this);e>-1&&(t.splice(e,1),delete this.parent)}}touch(t,e){const s=v(this).resolvers.get(t);if(s&&s.constructed)Promise.resolve(s.resolve()).then(i=>{e(i,this)});else{const i=v(this).touchQueue;let r=i.get(t);r||(r=[],i.set(t,r)),r.push(e)}return this.parent&&!s?this.parent.touch(t,e):Promise.resolve()}registerAsync(t,e){const s=v(this).resolvers.get(t);s&&!s.async&&process.env.NODE_ENV!=="production"&&$(this).warn(`Mismatching resolver type. You are registering an async resolver with a key ('${t}') previously used by a non-async resolver.`);const i=new ks(t,e,s,this);return v(this).resolvers.set(t,i),i.id}registerFactory(t,e){const s=v(this).resolvers.get(t);s&&s.async&&process.env.NODE_ENV!=="production"&&$(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);const i=new Os(t,e,s,this);return v(this).resolvers.set(t,i),i.id}register(t,e){const s=v(this).resolvers.get(t);s&&s.async&&process.env.NODE_ENV!=="production"&&$(this).warn(`Mismatching resolver type. You are registering a non-async resolver with a key ('${t}') previously used by an async resolver.`);const i=new Ss(t,e,s,this);return v(this).resolvers.set(t,i),i.id}get(t){const e=v(this).resolvers.get(t);if(e)return e.async&&process.env.NODE_ENV!=="production"&&$(this).warn(`You are retrieving an async value (with key '${t}') by the non-async function 'container.get(key)'. This will not be supported in future versions. Use 'container.getAsync(key) instead.'`),e.resolve();if(this.parent)return this.parent.get(t)}getAsync(t){const e=v(this).resolvers.get(t);if(e){if(!e.async)throw process.env.NODE_ENV!=="production"&&$(this).warn(`You are retrieving a non-async value (with key '${t}') by the async function 'container.getAsync(key)'.Use 'container.get(key) instead.'`),"Mismatching resolver type";return e.resolve()}return this.parent?this.parent.getAsync(t):Promise.resolve(void 0)}getMany(...t){const e={};return t.forEach(s=>e[s]=this.get(s)),e}getManyAsync(...t){const e={};return Promise.all(t.map(s=>this.getAsync(s).then(i=>e[s]=i))).then(()=>e)}createChild(t,e){const s=new Fe(t,e,this);return v(this).children.push(s),s}},ve=class{constructor(t,e,s=!1,i=!1){this.type=t,this.target=e,this.cancelable=!!s,this.bubbles=!!i,this.defaultPrevented=!1}preventDefault(){this.cancelable&&(this.defaultPrevented=!0)}};const P=q(),fe=(n,t)=>[].concat(P(n).listenerLookup.get(t.toLowerCase())||[],P(n).listenerLookup.get("*")||[]),ye=(n,t,e,s)=>{let i,r;return t instanceof ve?(i=t,r=t.type):(i=new ve(t,n.target,!!e.cancelable,!!e.bubbles),r=t),{event:i,type:r,async:s}};let Ts=class Qe{constructor(t,e){this.target=t,this.parent=e,P(this).listenerLookup=new Map,P(this).children=[]}clear(){P(this).listenerLookup.clear(),P(this).children.forEach(t=>t.clear())}detach(){if(this.parent){const t=P(this.parent).children,e=t.indexOf(this);e>-1&&t.splice(e,1)}}subscribe(t,e,s){const i=P(this).listenerLookup,r=t.toLowerCase();return i.has(r)||i.set(r,[]),i.get(r).push(e),()=>this.unsubscribe(t,e)}subscribeOnce(t,e){const s=this.subscribe(t,(i,r)=>(s(),e(i,r)))}unsubscribe(t,e){const s=P(this).listenerLookup.get(t.toLowerCase());if(s){const i=s.indexOf(e);i>-1&&s.splice(i,1)}}dispatchAsync(t,e,s={}){const{event:i,type:r}=ye(this,t,s,!0),o=fe(this,r);let a=0;const c=o.length;let h=Promise.resolve();for(a=0;a<c;a++)(d=>{h=h.then(l=>l?Promise.resolve(!0):Promise.resolve(d(i,e)).then(()=>i.defaultPrevented))})(o[a]);return h.then(d=>!d&&i.bubbles&&this.parent?this.parent.dispatchAsync(i,e):d)}dispatch(t,e,s={}){const{event:i,type:r}=ye(this,t,s,!1),o=fe(this,r);let a=0;const c=o.length;let h=!1;for(a=0;a<c;a++)if(o[a](i,e),i.defaultPrevented){h=!0;break}return!h&&i.bubbles&&this.parent&&(h=this.parent.dispatch(i,e)),h}createChild(t){const e=new Qe(t,this);return P(this).children.push(e),e}};const ct=(n,t,e)=>{const s=n.get("$plugins").map(i=>{try{return i.invoke(t,e)}catch(r){$(n).error("An error occured when invoking a plugin.",i,r)}});return Promise.all(s)};let Is=class{constructor(t){this.widget=t.get("$widget"),this.events=this.widget.events,this.container=this.widget.container,this.initialized=null,this.activated=null,this.initialize=this.initialize.bind(this),this.activate=this.activate.bind(this),this.deactivate=this.deactivate.bind(this),this.invoke=this.invoke.bind(this),this.createInstance()}createInstance(){if(!this.widget.container.get("$instance")){const t=this.widget.container.get("$types"),e=this.widget.container.get("$type");!e&&$(this).error("Unable to create widget. No type is specified.");const s=t[e];!s&&$(this).error(`Unable to create widget. Type '${e}' is not registered.`),this.widget.events.dispatch("widget:create-instance",{},{bubbles:!0});try{this.widget.container.register("$instance",new s(this.container))}catch(i){$(this).error("Unable to create widget type.",i)}this.widget.events.dispatch("widget:instance-created",{},{bubbles:!0})}}initialize(t){return this.initialized=this.initialized||(()=>{const e=this.container.get("$instance"),s=e.initialize||(()=>{});return this.initialized=Promise.resolve(s.call(e,t)).then(()=>ct(this.container,"initialize",t)).then(()=>{})})()}activate(t){return(this.initialized||this.initialize()).then(()=>{this.activated=this.activated||(()=>ct(this.container,"activate").then(()=>{const e=this.container.get("$instance");return this.activated=e.activate(t)}))()})}deactivate(){const t=this.container.get("$instance"),e=t.deactivate||(()=>{});return ct(this.container,"deactivate").then(()=>Promise.resolve(e.call(t))).then(()=>{this.initialized=null,this.activated=null}).then(()=>{})}invoke(t,...e){return ct(this.container,"invoke",{command:t,args:e}).then(()=>{const s=this.container.get("$instance");if(s[t])return s[t].apply(s,e);const i=s.invoke;if(i)return i.call(s,t,...e)})}};const W=(n,t)=>{if(!t)return!0;if(typeof t=="string"){const e=t.split(",");for(let s=0,i=e.length;s<i;s++){const r=e[s].trim();if(r===n||r==="*")return!0}}return t instanceof Array?t.indexOf(n)>-1:!1},Ms=(n,t)=>{if(typeof t=="function")return t(n);const e=typeof t=="string"?js(t):t;return!(!W(n.implementation.tenant||"",e.tenant||"")||!W(n.implementation.name,e.implementation||"")||!W(n.name,e.widget||"")||!W(n.container.get("$type"),e.type||""))},Ds=(n,t)=>{if(typeof t=="function")return t(n);const e=typeof t=="string"?Hs(t):t;return!(!W(n.tenant||"",e.tenant||"")||!W(n.name,e.implementation||""))},Ke=n=>t=>Ms(t,n),Us=n=>t=>Ds(t,n),C=n=>n instanceof Array&&n.length===1?n[0]:n,js=n=>{const t={},e=n.split(":");return e.length===1?t.widget=C(e[0].split(",")):e.length===2?(t.implementation=C(e[0].split(",")),t.widget=C(e[1].split(","))):(t.tenant=C(e[0].split(",")),t.implementation=C(e[1].split(",")),t.widget=C(e[2].split(","))),t},Hs=n=>{const t={},e=n.split(":");return e.length===1?t.implementation=C(e[0].split(",")):(t.tenant=C(e[0].split(",")),t.implementation=C(e[1].split(","))),t},gt=q(),$e=(n,t,e)=>n.filter(s=>s.stage===t&&Ke(s.selector)(e));function Ls(n){const t=n.container.get("$environment");let e=gt(t).configurationCache;e&&(e=e.filter(s=>s[0]!==n),gt(t).configurationCache=e)}var mt=(n=>(n.Implementation="implementation",n.Widget="widget",n))(mt||{}),k=(n=>(n.Pre="pre",n.Post="post",n))(k||{});const Ye=(n,t,e)=>(Object.keys(t).forEach(s=>{const i=t[s];if(typeof i=="function"){const r=i();typeof r.defaultArgs<"u"&&e(r,...r.defaultArgs),n[s]=(...o)=>{const a=Object.assign({},r,{handlerResolver:r.handlerResolver.bind({})});return e(a,...o),n}}else n[s]=Ye({},i,e)}),n),Rs=(n,t)=>{switch(t){case"implementation":return n.implementation;case"widget":return n}},be=(n,t,e,s)=>(s.forEach(i=>{Ye(n,i,(r,...o)=>{const a={selector:t,stage:r.stage,handler:c=>{const h=Rs(c,r.scope),d={container:h.container,events:h.events},l=r.handlerResolver,p=l(d);let u=gt(e.environment).configurationCache;return u||(u=gt(e.environment).configurationCache=[]),u.find(g=>g.indexOf(h)>-1&&g.indexOf(l)>-1)?Promise.resolve():(u.push([h,l]),Promise.resolve(p(...o)))}};e.instructions.push(a)})}),n);function Ws(n,t){function e(s){return be({},s,n,t)}return be(e,"*",n,t)}const zs=(n,t,e,s)=>{try{const i=new t(e,s);return{name:n,invoke:(r,o)=>{let a;return i[r]&&(a=i[r].call(i,o)),Promise.resolve(a)},getInstance:()=>i}}catch(i){if(i.message&&i.message.indexOf("is not a constructor")>=0)return{name:n,invoke:r=>{let o;return r==="initialize"&&(o=t(e,s)),Promise.resolve(o)},getInstance:()=>t};throw i}};function we(n,t){return typeof n>"u"?t:n}let Bs=class{constructor(t={}){this.part=t}createCommand(t,e,s){let i;typeof e=="function"?i={scope:mt.Widget,stage:k.Post,defaultArgs:void 0,handlerResolver:e}:i={scope:we(e.scope,mt.Widget),stage:we(e.stage,k.Post),defaultArgs:e.defaultArgs,handlerResolver:s};let r=this.part;const o=t.split(".");return o.forEach((a,c)=>{c===o.length-1?r[a]||(r[a]=()=>i):r=this.part[a]=this.part[a]||{}}),this}get(){return this.part}};const Ze=n=>{const t=new Bs({});return n(t),t.get()},Vs=Ze(n=>{n.createCommand("types.register",{scope:mt.Implementation,stage:k.Pre},t=>(e,s)=>{t.container.get("$types")[e]=s}).createCommand("type",{stage:k.Pre},t=>e=>{t.container.register("$type",e)}).createCommand("settings",{stage:k.Pre,defaultArgs:[null]},t=>e=>{t.events.dispatch("settings:change",e,{bubbles:!0}),t.container.register("$settings",e)}).createCommand("plugin",{stage:k.Pre},t=>(e,s,i)=>{const{container:r}=t;let o=null,a=e,c=s;typeof e=="string"&&(o=e,a=s,c=i);const h=d=>{const{transformPluginSettings:l}=t.container.get("$environmentOptions"),p=l?l(c||{},o,t.container,a):s;try{const u=zs(o,a,r,p);r.get("$plugins").push(u),d&&u.invoke("initialize",null)}catch(u){$(t).warn("Error when initializing plugin",u)}};t.container.get("$instance")?h(!0):t.events.subscribeOnce("widget:instance-created",()=>h(!1))}).createCommand("container.register",t=>(e,s)=>{t.container.register(e,s)}).createCommand("container.registerAsync",t=>(e,s)=>{t.container.registerAsync(e,s)}).createCommand("container.registerFactory",t=>(e,s)=>{t.container.registerFactory(e,s)}).createCommand("container.touch",t=>(e,s)=>{t.container.touch(e,s)}).createCommand("csp",{},t=>e=>{t.container.register("csp",e)})}),Js=Vs;function qs(n,t,e=[]){const s=[Js].concat(e),i=Ws(t,s);n(i,t)}let Fs=class{constructor(){this.tasks=[],this.current=Promise.resolve(),this.next=this.next.bind(this)}add(t,e,s,i){this.tasks.push({task:t,resolve:e,reject:s,done:i}),this.next()}next(){this.current=this.current.then(()=>{const t=this.tasks.shift();if(t){const e=Promise.resolve(t.task());return Promise.resolve(e).then(this.next).then(()=>e.then(s=>{t.done(),t.resolve(s)})).catch(s=>(t.done(),t.reject(s),this.next()))}return Promise.resolve()})}};const ht=new WeakMap;function Qs(n){return ht.has(n)||ht.set(n,new Fs),t=>new Promise((e,s)=>{const i=ht.get(n);i.add(t,e,s,()=>{i.tasks.length||ht.delete(n)})})}const _e=n=>typeof n<"u",K=(n,t)=>{n.events.dispatch("widget:state-change",{state:t},{bubbles:!0}),n.state=t,n.events.dispatch("widget:state-changed",{},{bubbles:!0})},_=q(),Ks=n=>{const{container:t,events:e}=n;t.get("$controller")||(t.register("$controller",new Is(t)),e.dispatch("widget:controller-created",{},{bubbles:!0}))};class Ys{constructor(t,e,s){this.state="deactivated",this.name=t,this.implementation=e,this.container=e.container.createChild(this,t),this.events=e.events.createChild(this),_(this).subscriptions=[],s&&e.configure(i=>{const r=i(t);_e(s.type)&&r.type(s.type),_e(s.settings)&&r.settings(s.settings),s.plugins&&Object.keys(s.plugins).forEach(o=>{var a;const c=(a=s.plugins)==null?void 0:a[o];r.plugin(o,c)})}),this.load=this.load.bind(this),this.activate=this.activate.bind(this),this.invoke=this.invoke.bind(this),this.deactivate=this.deactivate.bind(this)}load(){return Qs(this)(()=>{_(this).deactivatedPromise=null;const t=this.state==="deactivated";t&&(K(this,"activating"),this.container.register("$widget",this),this.container.register("$controller",null),this.container.register("$plugins",[]),this.container.register("$type",null),this.container.register("$instance",null)),K(this,"loading");const e=this.implementation.instructions,s=$e(e,k.Pre,this);return Promise.all(s.map(i=>i.handler(this))).then(()=>{Ks(this);const i=$e(e,k.Post,this);return Promise.all(i.map(r=>r.handler(this))).then(()=>{t&&this.container.get("$controller").initialize()})}).then(()=>(K(this,"activated"),this))})}activate(t){_(this).subscriptions.push(this.implementation.events.subscribe("implementation:configured",()=>{["activated","activating","loading"].indexOf(this.state)>-1&&this.load()}));const e=_(this).activatedPromise;return e?(process.env.NODE_ENV!=="production"&&$(this).warn(`Widget '${this.name}' has already been activated. The passed arguments for this activation will be discarded.`,t),e):_(this).activatedPromise=this.load().then(()=>this.container.get("$controller").activate(t))}invoke(t,...e){const s=_(this).activatedPromise,i=(r,...o)=>s.then(this.load).then(()=>this.container.get("$controller").invoke(r,...o));return s?i(t,...e):(process.env.NODE_ENV!=="production"&&$(this).warn("You are invoking a command on a deactivated widget. The invocation will be queued until the widget is activated.",this),new Promise(r=>{const o=this.events.subscribe("widget:state-changed",()=>{this.state==="activated"&&(o(),r(i(t,...e)))})}))}deactivate(){return _(this).deactivatedPromise||(this.state==="deactivated"?Promise.resolve():(K(this,"deactivating"),_(this).deactivatedPromise=this.container.get("$controller").deactivate().then(()=>(_(this).activatedPromise=null,_(this).subscriptions.forEach(e=>e()),_(this).subscriptions=[],this.container.clear().then(()=>{this.events.clear(),Ls(this),K(this,"deactivated")})))))}}const Ae=q();class Zs{constructor(t,e,s=[]){this.instructions=[],this.widgets=new Map,this.name=t.name,this.tenant=t.tenant,this.environment=e,this.container=e.container.createChild(this,this.name),this.events=e.events.createChild(this),this.container.register("$types",{}),Ae(this).configurationApiExtensions=s}load(){const t=Array.from(this.widgets.values());return Promise.all(t.map(e=>e.load())).then(()=>t)}configure(t){return qs(t,this,Ae(this).configurationApiExtensions),this.events.dispatch("implementation:configured",{implementation:this},{bubbles:!0}),this}createWidget(t,e){const s=new Ys(t,this,e);return this.widgets.set(s.name,s),s}}function Gs(n,t,e){const s=new Zs(n,t,e);return n.widgets&&Object.keys(n.widgets).forEach(i=>{var r;const o=(r=n.widgets)==null?void 0:r[i];s.createWidget(i,o)}),s}let Pe=class Ge{constructor(t,e){this.selectorFactory=e,typeof t=="function"?this.resolver=t:this.resolver=()=>t}append(t){const e=typeof t=="function"?t:()=>t;return new Ge(()=>this.all().concat(e()),this.selectorFactory)}all(){return this.resolver().concat([])}query(t){return this.all().filter(this.selectorFactory(t))}find(t){const e=this.query(t);if(e.length)return e[0]}};const te="#____version____#",Ut=q(),Xs=n=>n.tenant?`${n.name}:${n.tenant}`:n.name,Xe=class{constructor(t,e=[],s={}){this.widgets=new Pe(()=>{let i=[];return this.implementations.all().forEach(r=>{i=i.concat(Array.from(r.widgets.values()))}),i},Ke),this.implementations=new Pe([],Us),this.name=t,this.container=new Ns(this,t),this.events=new Ts(this),this.container.register("$version",te),this.container.register("$environment",this),this.container.register("$environmentOptions",s),Ut(this).configurationApiExtensions=e}createImplementation(t){const e=Xs(t);let s=this.implementations.find(e);if(s)return process.env.NODE_ENV!=="production"&&$(s).warn(`Implementation "${e}" already exist on current environment.`),s;const i=Ut(this).configurationApiExtensions;return s=Gs(t,this,i),this.implementations=this.implementations.append([s]),this.events.dispatch("implementation:created",{implementation:s}),s}patch(t={}){const{name:e,configurationApiExtensions:s}=t;typeof e<"u"&&e!==null&&(this.name=e),s&&s.forEach(i=>{Ut(this).configurationApiExtensions.push(i)})}static create(t={}){return new Xe(t.name||"",t.configurationApiExtensions,t.options)}};let ts=Xe;ts.version=te;const bt=(n,t,...e)=>typeof t=="string"?n(`[humany] ${t}`,...e):n(t,...e),Z=class{constructor(){this.keys=[],this.log=(t,...e)=>this.lookup(t,()=>Z.log(...e)),this.warn=(t,...e)=>this.lookup(t,()=>Z.warn(...e)),this.error=(t,...e)=>this.lookup(t,()=>Z.error(...e)),this.info=(t,...e)=>this.lookup(t,()=>Z.info(...e))}lookup(t,e){this.keys.indexOf(t)===-1&&(this.keys.push(t),e())}};let b=Z;b.log=(...n)=>bt(console.log,...n);b.warn=(...n)=>bt(console.warn,...n);b.error=(...n)=>bt(console.error,...n);b.info=(...n)=>bt(console.info,...n);const es=n=>{let t={},e,s;if(typeof n!="object"||n===null)return n;t=Array.isArray(n)?[]:{};for(s in n)e=n[s],t[s]=typeof e=="object"&&e!==null?es(e):e;return t},tn=es;function Ee(n){let t=0;if(n.length===0)return t.toString();for(let e=0;e<n.length;e++){const s=n.charCodeAt(e);t=(t<<5)-t+s,t=t&t}return t.toString()}let en=class{constructor(t,e){this.lockWarningTime=t,this.lockErrorTime=e,this.tasks=[],this.current=Promise.resolve(),this.next=this.next.bind(this)}add(t,e,s,i){this.tasks.push({task:t,resolve:e,reject:s,done:i}),this.next()}next(){this.current=this.current.then(()=>{const t=this.tasks.shift();if(t){let e;const s=setTimeout(()=>{process.env.NODE_ENV!=="production"&&b.warn(`A lock has exceeded ${this.lockWarningTime} ms. Waiting additional ${this.lockErrorTime} ms before rejecting the task.`,t),e=setTimeout(()=>{t.reject("lock timeout exceeded")},this.lockErrorTime)},this.lockWarningTime),i=Promise.resolve(t.task()).then(r=>(clearTimeout(s),clearTimeout(e),r));return Promise.resolve(i).then(this.next).then(()=>i.then(r=>{t.done(),t.resolve(r)})).catch(r=>(t.done(),t.reject(r),this.next()))}return Promise.resolve()})}};const lt=new WeakMap;function rt(n,t=5e3,e=1e3){return lt.has(n)||lt.set(n,new en(t,e)),s=>new Promise((i,r)=>{const o=lt.get(n);o.add(s,i,r,()=>{o.tasks.length||lt.delete(n)})})}const S=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);function H(){return S()+S()+"-"+S()+"-"+S()+"-"+S()+"-"+S()+S()+S()}var sn=Object.defineProperty,nn=Object.defineProperties,rn=Object.getOwnPropertyDescriptors,xe=Object.getOwnPropertySymbols,on=Object.prototype.hasOwnProperty,an=Object.prototype.propertyIsEnumerable,Ce=(n,t,e)=>t in n?sn(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ft=(n,t)=>{for(var e in t||(t={}))on.call(t,e)&&Ce(n,e,t[e]);if(xe)for(var e of xe(t))an.call(t,e)&&Ce(n,e,t[e]);return n},cn=(n,t)=>nn(n,rn(t));const hn=n=>{const t=[];return[(e,s)=>{t.push(n.subscribe(e,s))},()=>{t.forEach(e=>{e()})}]};let wt=class{constructor(t,e=[]){this.platform=t,this.rules=e}match(t){return this.rules.every(e=>!(e.id&&e.id!==t.id||e.type&&e.type!==t.type))}ofType(t){return this.rules.push({type:t}),this}withId(t){return this.rules.push({id:t}),this}select(){return new ln(this.platform,this)}},ss=class{constructor(t,e,s){this.platform=t,this.node=e,this.actions=new ee(t,new wt(t).withId(e.id),s);const[i,r]=hn(this.platform.events);this.subscribe=i,this.unsubscribe=r}properties(t){return t&&this.node.touchProperties(e=>t(e)),this.node.attributes.properties}context(t){return t&&this.subscribe("components:context-changed",(e,{node:s})=>{s===this.node&&t(this.node.attributes.context)}),this.node.attributes.context}layout(t){return t&&this.subscribe("components:layout-changed",(e,{node:s})=>{s===this.node&&t(this.node.attributes.layout)}),this.node.attributes.layout}writeProperties(t,e){this.node.writeProperties(t,e)}writeContext(t,e){this.node.writeProperties(t,e)}writeLayout(t,e){this.node.writeLayout(t,e)}dispose(){this.unsubscribe(),this.actions.dispose()}};class ln{constructor(t,e,s=!0){this.platform=t,this.target=e,this.clearOnDispose=s,this.removes=[],this.actions=new ee(this.platform,this.target)}writeProperties(t,e){this.removes.push(this.platform.write({options:e,attributes:{properties:t},target:this.target,removable:this.clearOnDispose}))}writeContext(t,e){this.removes.push(this.platform.write({options:e,attributes:{context:t},target:this.target,removable:this.clearOnDispose}))}writeLayout(t,e){this.removes.push(this.platform.write({options:e,attributes:{layout:t},target:this.target,removable:this.clearOnDispose}))}dispose(){this.removes.forEach(t=>{t()}),this.actions.dispose()}}const dn=(n,t,e)=>{const s=n.concat(),i=(r,o,a)=>{let c=!0;if(s.length){const h=s.shift(),d=(l,p)=>(c=!1,i(l,Object.assign({},o,p),a));return Promise.resolve(h(r,d,a)).then(l=>cn(Ft({},l),{cancelled:c}))}return Promise.resolve({data:r,cancelled:!1,options:o})};return i(t,{},e)};let ee=class{constructor(t,e,s){this.platform=t,this.target=e,this.ns=s,this.subscriptions=[],this.create=this.create.bind(this)}create(t,e=()=>{}){const s={key:t,fn:e,target:this.target,ns:this.ns};this.platform.actionsState.handlers.push(s);const i=()=>{const r=this.platform.actionsState.handlers.indexOf(s);r>-1&&this.platform.actionsState.handlers.splice(r,1)};return this.subscriptions.push(i),i}dispatch(t,e){const s=this.platform.nodes.all.concat(this.platform.nodes.detached),i={},r=this.platform.actionsState.handlers.filter(o=>o.key===t&&(!o.ns||!this.ns||o.ns===this.ns));return Promise.all(r.map(o=>{const a=s.filter(h=>o.target.match(h)&&this.target.match(h)),c=this.platform.actionsState.watchers.filter(h=>h.key===t&&(!h.ns||!this.ns||h.ns===this.ns)&&a.some(d=>h.target.match(d))).map(h=>h.fn);return Promise.all(a.map(h=>{const d=new ss(this.platform,h,this.ns);return dn(c,e,d).then(l=>{const{data:p={},options:u,cancelled:g}=l;return Promise.resolve(g?{}:o.fn(p,u,d)).then(A=>{i[h.id]=A})})}))})).then(()=>i)}watch(t,e){let s=t,i=this.ns;const r=t.split(".");r.length>1&&(i=r[0],s=r.splice(1).join("."));const o={fn:e,target:this.target,key:s,ns:i};this.platform.actionsState.watchers.push(o);const a=()=>{const c=this.platform.actionsState.watchers.indexOf(o);c>-1&&this.platform.actionsState.watchers.splice(c,1)};return this.subscriptions.push(a),a}dispose(){this.subscriptions.forEach(t=>t())}};Ze(n=>{n.createCommand("components",t=>e=>{t.events.subscribeOnce("components:platform-created",(s,{platform:i})=>{e.handlers&&e.handlers.forEach(([r,o])=>{i.addComponentHandler(r,o)})})})});let ke=class{constructor(t,e){this.events=t,this.tags=[],this.children={},this.changesets=[],this.mountCount=0,this.id=H(),this.type=e,this.attributes={context:{},properties:{},layout:{},tags:[]},this.writeLayout({size:"full",indent:0})}mount(t,e){let s=t.get("mounted-nodes");return s||(s=new Map,t.register("mounted-nodes",s)),s.has(this)?(process.env.NODE_ENV!=="production"&&b.error("Trying to mount an already mounted component node.",this),()=>{}):(this.events.dispatch("components:node-mounted",{node:this}),this.mountCount===0&&(this.mountCount=this.mountCount+1,this.events.dispatch("components:node-enter",{node:this})),()=>{s.delete(this),this.events.dispatch("components:node-unmounted",{node:this}),this.mountCount=this.mountCount-1,this.mountCount===0&&this.events.dispatch("components:node-exit",{node:this})})}appendChild(t,e="default"){if(t.parent){if(t.parent===this)return;t.parent.removeChild(t)}t.parent=this,this.children[e]||(this.children[e]=[]),this.children[e].push(t),this.events.dispatch("components:node-appended",{node:t})}prependChild(t,e="default"){if(t.parent){if(t.parent===this)return;t.parent.removeChild(t)}t.parent=this,this.children[e]||(this.children[e]=[]),this.children[e].unshift(t),this.events.dispatch("components:node-appended",{node:t})}touchProperties(t,e={},s){const i=[{properties:t},e];return this.changesets.push(i),this.events.dispatch("components:set-properties",{node:this}),()=>{if(s){const r=this.changesets.indexOf(i);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-properties",{node:this}))}}}writeProperties(t,e={},s){const i=[{properties:t},e];return this.changesets.push(i),this.events.dispatch("components:set-properties",{node:this}),()=>{if(s){const r=this.changesets.indexOf(i);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-properties",{node:this}))}}}writeLayout(t,e={},s){const i=[{layout:t},e];return this.changesets.push(i),this.events.dispatch("components:set-layout",{node:this}),()=>{if(!s)return;const r=this.changesets.indexOf(i);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-layout",{node:this}))}}writeContext(t,e={},s){const i=[{context:t},e];return this.changesets.push(i),this.events.dispatch("components:set-context",{node:this}),()=>{if(!s)return;const r=this.changesets.indexOf(i);r>-1&&(this.changesets.splice(r,1),this.events.dispatch("components:set-context",{node:this}))}}getChildren(t="default"){const e=this.children[t]||[];return e.reduce((s,i,r)=>{const{order:o=r}=i.attributes.layout;return s[o]?s.splice(o,0,i):s[o]=i,s},Array(e.length))}remove(){this.parent&&this.parent.removeChild(this)}removeChild(t){Object.keys(this.children).forEach(e=>{const s=this.children[e],i=s.indexOf(t);i>-1&&(s.splice(i,1),this.events.dispatch("components:node-removed",{node:t,parentNode:this}))}),delete t.parent}};const ns=(n,t,e)=>{for(let s=0,i=n.length;s<i&&e(n[s])!==!0;s++){const r=t[n[s].id]||"default",o=n[s].getChildren(r);ns(o,t,e)}},se=(n,t,e)=>{if(e(n)!==!0){const s=t[n.id]||"default",i=n.children[s];ns(i,t,e)}},jt=(n,t)=>{const e=[];return se(n,t,s=>{e.push(s)}),e},pn=(n,t,e)=>{let s;return se(n,t,i=>{if(e(i))return s=i,!0}),s};class un{constructor(t,e,s){this.root=t,this.switches=e,this.all=[],this.visible=[],this.detached=[],s.subscribe("components:node-appended",(i,r)=>{this.all.push(r.node),this.visible=jt(t,e)}),s.subscribe("components:node-removed",(i,r)=>{let o=this.all.indexOf(r.node);o>-1&&this.all.splice(o,1),o=this.visible.indexOf(r.node),o>-1&&this.visible.splice(o,1),this.visible=jt(t,e)}),s.subscribe("components:node-switched",(i,r)=>{this.visible=jt(t,e)})}query(t={}){const e=[];return se(this.root,this.switches,s=>{Object.keys(t).every(i=>t[i]===s[i])&&e.push(s)}),e}get(t){return pn(this.root,this.switches,e=>e.id===t)||this.detached.find(e=>e.id===t)}}class gn{constructor(){this.handlers=new Map}add(t,e){this.handlers.set(t,e)}get(t){return this.handlers.get(t)}}const mn=n=>{let t=n,e=0;for(;t.parent;)e=e+1,t=t.parent;return e},vn=n=>n.map(([t,e])=>[mn(t),t,e]).sort(([t],[e])=>t-e).map(([,t,e])=>[t,e]),Ht=n=>n instanceof Date?!1:n&&typeof n=="object"&&!Array.isArray(n),x=(n,...t)=>{if(!t.length)return n;const e=t.shift();if(Ht(n)&&Ht(e))for(const s in e)Ht(e[s])?(n[s]||Object.assign(n,{[s]:{}}),x(n[s],e[s])):Object.assign(n,{[s]:e[s]});return x(n,...t)},fn=(n,t)=>!n||n==="all"?!0:n.some(e=>t.indexOf(e)>-1),yn=(n,t)=>{let e=[],s=[],i;const r=()=>{process.env.NODE_ENV!=="production"&&console.time("state-processor.flush");const a=new Map,c=vn(e.map((d,l)=>[d,s[l]])),h=(d,l)=>{var p;const u=a.get(d)||{},g=l.context&&!u.context,A=l.properties&&!u.properties,Nt=l.layout&&!u.layout;a.set(d,{context:u.context||g,properties:u.properties||A,layout:u.layout||Nt}),A&&(d.attributes.properties={}),Nt&&(d.attributes.layout={}),g&&(d.attributes.context=x({},(p=d.parent)==null?void 0:p.attributes.context));const pe=[],ue=[],ge=[];if(d.changesets.forEach(E=>{const[w,Tt]=E;fn(Tt.breakpoints,n.breakpoints)&&(A&&(typeof w.properties=="function"?pe.push(w.properties):x(d.attributes.properties,w.properties)),Nt&&(typeof w.layout=="function"?ue.push(w.layout):x(d.attributes.layout,w.layout)),g&&(typeof w.context=="function"?ge.push(w.context):x(d.attributes.context,w.context)))}),pe.forEach(E=>{x(d.attributes.properties,E(d.attributes.properties))}),ue.forEach(E=>{x(d.attributes.layout,E(d.attributes.layout))}),ge.forEach(E=>{x(d.attributes.context,E(d.attributes.context))}),g||l.recursive){const E=n.getBranch(d),w=l.recursive?l:{context:!!g};d.getChildren(E).forEach(Tt=>{h(Tt,w)})}};process.env.NODE_ENV!=="production"&&console.timeEnd("state-processor.flush"),c.forEach(([d,l])=>{h(d,l)}),e=[],s=[],t(a)},o=()=>{clearTimeout(i),i=setTimeout(r,0)};return(a,c)=>{const h=e.indexOf(a);if(h>-1){const d=s[h];return c.context&&(d.context=!0),c.properties&&(d.properties=!0),c.layout&&(d.layout=!0),c.recursive&&(d.recursive=!0),o()}return e.push(a),s.push(c),o()}};class ne{constructor(t,e={}){this.providers=e,this.breakpoints=[],this.actionsState={handlers:[],watchers:[]},this.switches={},this.changesets=[],this.subscriptions=[],this.customComponentHandler=new gn,this.events=t.events.createChild(this);const s=new ke(this.events,"root");s.name=`root-${t.name}`,this.nodes=new un(s,this.switches,this.events);const i=this.processNode=yn(this,r=>{const o=Array.from(r.keys());process.env.NODE_ENV!=="production"&&console.info(`STATE PROCESSOR: ${o.length} node(s) processed:
|
2
|
-
${o.map(a=>`${a.name||"<no name>"} (${a.id})
|
3
|
-
`)}`),o.forEach(a=>{const c=r.get(a);a.parent&&a.parent.type==="root"&&this.events.dispatch("components:root-children-changed",{node:a}),c!=null&&c.context&&this.events.dispatch("components:context-changed",{node:a}),c!=null&&c.properties&&this.events.dispatch("components:properties-changed",{node:a}),c!=null&&c.layout&&this.events.dispatch("components:layout-changed",{node:a})}),this.events.dispatch("components:component-model-initialized",{},{bubbles:!0})});Promise.all(Object.keys(e).map(r=>e[r].load(this))),this.subscriptions.push(this.events.subscribe("components:node-appended",(r,o)=>{const{node:a}=o;this.changesets.forEach(c=>{const{changeset:h,target:d,removes:l}=c,[p,u]=h;d.match(o.node)&&(p.properties&&l.push(a.writeProperties(p.properties,u)),p.context&&l.push(a.writeContext(p.context,u)),p.layout&&l.push(a.writeLayout(p.layout,u)))})})),this.subscriptions.push(this.events.subscribe("components:node-appended",(r,o)=>{i(o.node,{properties:!0,context:!0})})),this.subscriptions.push(this.events.subscribe("components:set-properties",(r,o)=>{i(o.node,{properties:!0})})),this.subscriptions.push(this.events.subscribe("components:set-context",(r,o)=>{i(o.node,{properties:!0,context:!0})})),this.subscriptions.push(this.events.subscribe("components:set-indent",(r,o)=>{i(o.node,{layout:!0})})),this.subscriptions.push(this.events.subscribe("components:set-layout",(r,o)=>{i(o.node,{layout:!0})})),this.subscriptions.push(this.events.subscribe("components:node-switched",(r,{node:o,branch:a})=>{i(o,{layout:!0,recursive:!0,properties:!0,context:!0})})),this.subscriptions.push(this.events.subscribe("components:node-removed",(r,{parentNode:o})=>{i(o,{properties:!0})})),this.events.parent&&this.events.parent.dispatch("components:platform-created",{platform:this})}static getInstance(t){return t.getAsync("components")}addBreakpoint(t){this.breakpoints.indexOf(t)===-1&&(this.breakpoints.push(t),this.processNode(this.nodes.root,{context:!0,properties:!0,layout:!0,recursive:!0}))}removeBreakpoint(t){const e=this.breakpoints.indexOf(t);e>-1&&(this.breakpoints.splice(e,1),this.processNode(this.nodes.root,{context:!0,properties:!0,layout:!0,recursive:!0}))}setSwitch(t,e){this.switches[t.id]=e,this.events.dispatch("components:node-switched",{node:t,branch:e})}getBranch(t){return this.switches[t.id]}createNode(t,e={}){const s=new ke(this.events,t);return e.detached&&this.nodes.detached.push(s),s}components(){return new wt(this)}actions(t,e){return new ee(this,t,e)}write(t){const{provider:e,target:s,attributes:i,options:r={},removable:o}=t,a=t.key||H(),c={changeset:[i,r],target:s,removes:[]};if(e){const h=this.providers[e];h.write(a,s,i,r),c.removes.push(()=>{h.remove(a)})}return this.changesets.push(c),this.nodes.all.forEach(h=>{if(s.match(h)){let d=()=>{};i.properties&&(d=h.writeProperties(i.properties,r,o)),i.context&&(d=h.writeContext(i.context,r,o)),i.layout&&(d=h.writeContext(i.layout,r,o)),c.removes.push(d)}}),()=>{if(o){c.removes.forEach(d=>d());const h=this.changesets.indexOf(c);h>-1&&this.changesets.splice(h,1)}}}addComponentHandler(t,e){this.customComponentHandler.add(t,e)}getComponentHandler(t){return this.customComponentHandler.get(t)}dispose(){this.subscriptions.forEach(t=>t())}}const $n=(n,t)=>({id:n.id,type:n.type,name:n.name,branch:t||"default"}),bn=(n,t,e,s=H(),i={})=>n.getAsync("components").then(r=>{let o;if(typeof t=="string"){const h=new wt(r);h.ofType(t),o=h}else o=t;const a={},c=h=>{const d=a[h.id];return d?Promise.resolve(d.controller):ne.getInstance(n).then(l=>new ss(l,h,s))};r.events.subscribe("components:node-enter",(h,{node:d})=>{o.match(d)&&c(d).then(l=>{Promise.resolve(e(l)).then(p=>{a[d.id]={dispose:p,controller:l}})})}),r.events.subscribe("components:node-exit",(h,{node:d})=>{const l=a[d.id];l&&(l.dispose&&l.dispose(),i.reuseController||(l.controller.dispose(),delete a[d.id]))})}),wn="#____version____#",is=class extends ts{constructor(t,e=[]){super(t,e,{transformPluginSettings:(s,i,r)=>{const o=r.get("$settings"),a=o.plugins&&i?o.plugins[i]||{}:{};return Ft(Ft({},a),s)}})}createImplementation(t){const e=super.createImplementation(t);return e.bindings=t.bindings,e}navigate(t,e,s){this.widgets.query(t).forEach(i=>i.invoke("navigate",{route:e,params:s}))}static create(t={}){const e=[Cs].concat(t.configurationApiExtensions||[]);return new is("humany",e)}static createFromGlobal(t,e={}){if(this.isRuntime(t))return t.patch(e),t;const s=[],i=t&&t._c;i&&i.forEach(o=>s.push(o));const r=this.create(e);return r.container.register("$runtimecfg",s),r}static isRuntime(t){return!!(t&&typeof t=="object"&&t.container&&typeof t.container.get=="function"&&t.container.get("$environment")===t&&t.container.owner===t)}};let _n=is;_n.version=`${wn} (${te})`;var An=Object.defineProperty,Se=Object.getOwnPropertySymbols,Pn=Object.prototype.hasOwnProperty,En=Object.prototype.propertyIsEnumerable,Oe=(n,t,e)=>t in n?An(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,L=(n,t)=>{for(var e in t||(t={}))Pn.call(t,e)&&Oe(n,e,t[e]);if(Se)for(var e of Se(t))En.call(t,e)&&Oe(n,e,t[e]);return n},y=(n=>(n.Cookie="cookie",n.Local="local",n.Session="session",n))(y||{}),_t=(n=>(n.Tenant="tenant",n.Implementation="implementation",n.Widget="widget",n))(_t||{}),f=(n=>(n.Necessary="necessary",n.Functional="functional",n.Analytical="analytical",n.Marketing="marketing",n))(f||{});const At=(n,t,e,s={})=>Ne(n,e).then(i=>(process.env.NODE_ENV!=="production"&&i&&b.warn(`createStorageWriter: Attempted to create storage writer using unallowed category.
|
4
|
-
Key: ${t}
|
5
|
-
Category: ${JSON.stringify(e)}
|
6
|
-
Options: ${JSON.stringify(s)}`),r=>(re(n),Ne(n,e).then(o=>{if(o){process.env.NODE_ENV!=="production"&&b.warn(`storageWriter: Attempted to write to storage using unallowed category.
|
7
|
-
Key: ${t}
|
8
|
-
Category: ${JSON.stringify(e)}
|
9
|
-
Value: ${JSON.stringify(r)}
|
10
|
-
Options: ${JSON.stringify(s)}`);return}const{scope:a=_t.Widget,medium:c=y.Session,duration:h}=s,d=Cn();return d[a][t]=as(r,e,h),c===y.Cookie?Tn(n,d):Mn(n,c,d)})))),z=(n,t,e=y.Session)=>(re(n),typeof t>"u"?(process.env.NODE_ENV!=="production"&&b.warn("readStorage: Undefined key passed when reading storage. ",t,e),Promise.resolve(void 0)):e===y.Cookie?Nn(n).then(s=>Kt(s,t)):In(n,e).then(s=>Kt(s,t))),B=n=>!!Object.entries(n).filter(([t,e])=>typeof e<"u").length,Lt=n=>Object.entries(n).filter(([t,e])=>typeof e<"u").forEach(([t,{value:e}])=>{typeof e>"u"&&delete n[t]}),rs=(n,t)=>{const e={tenant:L(L({},n.tenant),t.tenant),implementation:L(L({},n.implementation),t.implementation),widget:L(L({},n.widget),t.widget)};return Lt(e.tenant),Lt(e.implementation),Lt(e.widget),e},xn=n=>Object.entries(n).reduce((t,e)=>{const[s,i]=e;return Object.entries(i).forEach(r=>{const[o,{expiration:a}]=r;a&&t.push(a)}),t},[]).slice().sort((t,e)=>new Date(e).valueOf()-new Date(t).valueOf()).shift()||oe(),Pt=n=>{const{name:t,implementation:{name:e,tenant:s}}=n.get("$widget");return[`humany_${s}`,`humany_${Ee(s+e)}`,`humany_${Ee(s+e+t)}`]},Rt=n=>{const t=new RegExp(`(?:^|;)\\s?${n}=(.*?)(?:;|$)`,"i"),e=document.cookie.match(t);return e&&e[1]&&JSON.parse(e[1])||void 0},Wt=(n,t,e)=>{const s=`${n}=${JSON.stringify(t).trim()}`,i=`expires=${new Date(e).toUTCString()}`,r="path=/",o="SameSite=None;Secure";return document.cookie=`${s}; ${i}; ${r}; ${o}`},ie=n=>{const[t,e,s]=Pt(n),i=Rt(t)||{},r=Rt(e)||{},o=Rt(s)||{};return{tenant:i,implementation:r,widget:o}},os=(n,t)=>{const e=ie(n),s=rs(e,t),[i,r,o]=Pt(n),{tenant:a,implementation:c,widget:h}=s,d=xn(t),l=oe({days:-1});Wt(i,a,B(a)?d:l),Wt(r,c,B(c)?d:l),Wt(o,h,B(h)?d:l)},vt=(n,t)=>{const[e,s,i]=Pt(n),r=t.getItem(e)||"{}",o=t.getItem(s)||"{}",a=t.getItem(i)||"{}";return{tenant:JSON.parse(r),implementation:JSON.parse(o),widget:JSON.parse(a)}},Qt=(n,t,e)=>{const s=vt(n,t),i=rs(s,e),[r,o,a]=Pt(n),{tenant:c,implementation:h,widget:d}=i;B(c)?t.setItem(r,JSON.stringify(c)):t.removeItem(r),B(h)?t.setItem(o,JSON.stringify(h)):t.removeItem(o),B(d)?t.setItem(a,JSON.stringify(d)):t.removeItem(a)},Cn=()=>({tenant:{},implementation:{},widget:{}}),kn=n=>n?!!n&&new Date>new Date(n):!1,Kt=(n,t)=>{const e=n.widget[t]||n.implementation[t]||n.tenant[t];return e==null?void 0:e.value},as=(n,t,e)=>e?{value:n,category:t,expiration:typeof e=="object"?oe(e):e}:{value:n,category:t},Sn=(n,t)=>{const e=tn(n);return Object.entries(e).forEach(([s,i])=>{Object.entries(i).forEach(([r,o])=>{const{expiration:a,category:c}=o;(kn(a)||On(t,c))&&(i[r]=as(void 0,c,a))})}),e},Ne=(n,t)=>z(n,"storagePolicy",y.Cookie).then((e=[f.Necessary])=>!!t&&e.indexOf(t)===-1),On=(n=[f.Necessary],t)=>!!t&&n.indexOf(t)===-1,re=n=>{const t=ie(n),e=vt(n,window.localStorage),s=vt(n,sessionStorage),i=Kt(t,"storagePolicy"),[r,o,a]=[t,e,s].map(c=>Sn(c,i));os(n,r),Qt(n,window.localStorage,o),Qt(n,window.sessionStorage,a)},oe=(n={days:30})=>{const{days:t=0,hours:e=0,minutes:s=0,seconds:i=0}=n,r=new Date;return r.setTime(r.getTime()+e*60*60*1e3),r.setTime(r.getTime()+t*24*60*60*1e3),r.setTime(r.getTime()+s*60*1e3),r.setTime(r.getTime()+i*1e3),r.toISOString()},Nn=n=>rt(document)(()=>ie(n)),Tn=(n,t)=>rt(document)(()=>os(n,t)),In=(n,t)=>{const e=t===y.Local?window.localStorage:window.sessionStorage;return rt(e)(()=>vt(n,e))},Mn=(n,t,e)=>{const s=t===y.Local?window.localStorage:window.sessionStorage;return rt(s)(()=>Qt(n,s,e))},zt=(n,t,e,...s)=>{const i=`[${n.get("$environment").name||"webprovisions"}] ${e}`;switch(t){case"info":console.info(i,...s);break;case"warning":console.warn(i,...s);break;case"error":console.error(i,...s);break}},Dn=n=>{const t=n.container||n;return{info:(e,...s)=>zt(t,"info",e,...s),warn:(e,...s)=>zt(t,"warning",e,...s),error:(e,...s)=>zt(t,"error",e,...s)}};var ft=(n=>(n.Implementation="implementation",n.Widget="widget",n))(ft||{}),D=(n=>(n.Pre="pre",n.Post="post",n))(D||{});const Un=(n,t,e,s)=>{try{const i=new t(e,s);return{name:n,invoke:(r,o)=>{let a;return i[r]&&(a=i[r].call(i,o)),Promise.resolve(a)},getInstance:()=>i}}catch(i){if(i.message&&i.message.indexOf("is not a constructor")>=0)return{name:n,invoke:r=>{let o;return r==="initialize"&&(o=t(e,s)),Promise.resolve(o)},getInstance:()=>t};throw i}};function Te(n,t){return typeof n>"u"?t:n}class jn{constructor(t={}){this.part=t}createCommand(t,e,s){let i;typeof e=="function"?i={scope:ft.Widget,stage:D.Post,defaultArgs:void 0,handlerResolver:e}:i={scope:Te(e.scope,ft.Widget),stage:Te(e.stage,D.Post),defaultArgs:e.defaultArgs,handlerResolver:s};let r=this.part;const o=t.split(".");return o.forEach((a,c)=>{c===o.length-1?r[a]||(r[a]=()=>i):r=this.part[a]=this.part[a]||{}}),this}get(){return this.part}}const cs=n=>{const t=new jn({});return n(t),t.get()};cs(n=>{n.createCommand("types.register",{scope:ft.Implementation,stage:D.Pre},t=>(e,s)=>{t.container.get("$types")[e]=s}).createCommand("type",{stage:D.Pre},t=>e=>{t.container.register("$type",e)}).createCommand("settings",{stage:D.Pre,defaultArgs:[null]},t=>e=>{t.events.dispatch("settings:change",e,{bubbles:!0}),t.container.register("$settings",e)}).createCommand("plugin",{stage:D.Pre},t=>(e,s,i)=>{const{container:r}=t;let o=null,a=e,c=s;typeof e=="string"&&(o=e,a=s,c=i);const h=d=>{const{transformPluginSettings:l}=t.container.get("$environmentOptions"),p=l?l(c||{},o,t.container,a):s;try{const u=Un(o,a,r,p);r.get("$plugins").push(u),d&&u.invoke("initialize",null)}catch(u){Dn(t).warn("Error when initializing plugin",u)}};t.container.get("$instance")?h(!0):t.events.subscribeOnce("widget:instance-created",()=>h(!1))}).createCommand("container.register",t=>(e,s)=>{t.container.register(e,s)}).createCommand("container.registerAsync",t=>(e,s)=>{t.container.registerAsync(e,s)}).createCommand("container.registerFactory",t=>(e,s)=>{t.container.registerFactory(e,s)}).createCommand("container.touch",t=>(e,s)=>{t.container.touch(e,s)}).createCommand("csp",{},t=>e=>{t.container.register("csp",e)})});cs(n=>{n.createCommand("storage",t=>(e={})=>{const{consent:s}=e;if(typeof s<"u"){if(typeof s!="number"&&typeof s!="string"&&!Array.isArray(s)){process.env.NODE_ENV!=="production"&&b.warn(`storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.
|
11
|
-
Passed consent: ${JSON.stringify(s)}`);return}if(Array.isArray(s)&&!s.every(r=>typeof r=="number"||typeof r=="string")){process.env.NODE_ENV!=="production"&&b.warn(`storagePolicyConfigurationApi: passed consent is not valid. Consent either has to be a number, a string, an array of strings or an array of numbers.
|
12
|
-
Passed consent: ${JSON.stringify(s)}`);return}const i=[f.Necessary,f.Functional,f.Analytical,f.Marketing].filter((r,o,a)=>typeof s=="number"?s>o:typeof s=="string"?a.indexOf(s)+1>o:Array.isArray(s)?s.findIndex(c=>c===o+1||c===r)>-1:!0);return i.indexOf(f.Necessary)===-1&&(process.env.NODE_ENV!=="production"&&b.warn(`storagePolicyConfigurationApi: passed consent does not include category: '${f.Necessary}'. Consent has to atleast include the '${f.Necessary}' category.
|
13
|
-
Passed consent: ${JSON.stringify(s)}`),i.unshift(f.Necessary)),At(t.container,"storagePolicy",f.Necessary,{medium:y.Cookie,scope:_t.Tenant,duration:{days:365}}).then(r=>r(i)).then(()=>{re(t.container),t.events.dispatch("storage:policy-changed",i)})}})});class Hn{constructor(t){this.controller=t,this.cache=new Map,this.subscriptions=[];const{events:e}=t.container.get("$widget"),s=e.subscribe("data-client:fetched",(i,r)=>{r.type==="contact-method"&&this.cache.set(r.response.id,r.response)});this.subscriptions.push(s)}getConversationLogs(){return this.controller.messages.reduce((e,s)=>{const i=Et(s),{content:r,type:o,sender:a,timestamp:c}=i.content,h=this.parseEntry(r,o,a,c);return h&&e.push(h),e},[])}parseEntry(t,e,s,i){const r=h=>{let d=[],l=[],p;if(Array.isArray(h)){const[g,A]=h;p=A}else p=h;return this.createMessageContent(p).length&&(l=[...l,this.createMessageContent(p)]),d=[...d,...this.createMessageOptions(p)],{messagesAsList:l,options:d}};let o=[],a=[];if(Array.isArray(t.items)){const{items:h}=t;h.forEach(d=>{const l=r(d);o=[...o,...l.options],a=[...a,...l.messagesAsList]})}else{const h=r(t);o=[...o,...h.options],a=[...a,...h.messagesAsList]}return{options:o,message:a.length?a.join(`
|
14
|
-
`):void 0,source:this.createMessageSource(e),alias:this.createAlias(e,s),timestamp:i}}createMessageSource(t){return t}createAlias(t,e){return t===F.System?"system":(e==null?void 0:e.name)||"Me"}handleContactMethod(t){if(!this.cache.has(t))return;const e=this.cache.get(t);let s="";return s=this.appendText(s,`${e.clientName}:`),s=this.appendText(s,e.title),e.description&&(s=this.appendText(s,e.title)),s}getDetails(t,e=!0){if(!t)return"";const{header:s,title:i,label:r,description:o,text:a,html:c,body:h,contactMethodId:d}=t;let l="";if(d){const p=this.handleContactMethod(d.toString());p&&(l=this.appendText(l,p,e))}return s&&(l=this.appendText(l,s,e)),i&&(l=this.appendText(l,i,e)),o&&(l=this.appendText(l,o,e)),a&&(l=this.appendText(l,a,e)),r&&(l=this.appendText(l,r,e)),c&&(l=this.appendText(l,c,e)),h&&typeof h=="string"&&(l=this.appendText(l,h,e)),l}createMessageContent(t){let e="";return e=this.getDetails(t),e}createMessageOptions(t){let e=[],s=[];return Array.isArray(t==null?void 0:t.actions)?s=t.actions:typeof(t==null?void 0:t.actions)=="object"&&(s=Object.entries(t.actions).map(([i,r])=>({actionKey:i,label:r}))),s.length&&(e=s.map(i=>this.getDetails(i,!1))),e}appendText(t,e,s=!0){return s&&t.length?`${t}
|
15
|
-
${e}`:t.length?`${t} ${e}`:e}dispose(){this.subscriptions.forEach(t=>{t()})}}class Yt{constructor(t,e){this.provider=t,this.print=(s,i)=>{const r={name:this.name,avatar:this.avatar,id:this.id},o=Et(s,i);return this.provider.createEntry(o.key,o.content,F.Agent,r,o.timestamp)},this.typing=()=>this.provider.setTypingState({name:this.name,avatar:this.avatar}),this.id=e.id||H(),this.name=e.name,this.avatar=e.avatar}update(t){var i;const{name:e,avatar:s}=t;s===null?this.avatar=void 0:s&&(this.avatar=s),e===null?this.name=void 0:e&&(this.name=e),(i=this.provider.controller)==null||i.events.dispatch("conversation:agent-updated",{agent:this})}}class ae{constructor(t,e,s){this.name=t,this.controller=s,this.subscriptions=[],this.user=s==null?void 0:s.user,this.options={silent:!1}}static create(t,e,s){return new ae(t,e,s)}createAgent(t={}){var e;if(this.controller){const s=this.controller.getAgentById(t.id),i=s?new Yt(this,{...s,...t}):new Yt(this,t);return s||(e=this.controller)==null||e.events.dispatch("conversation:agent-created",{agent:i}),i}}print(t){var e;return(e=this.controller)==null?void 0:e.print(t)}setTypingState(t,e){var s;return(s=this.controller)==null?void 0:s.setTypingState(t,e)}loading(){return this.controller?this.controller.loader():()=>()=>{}}createEntry(t,e,s,i,r){var o;return(o=this.controller)==null?void 0:o.createEntry(t,e,s,i,r)}dispose(){var t;process.env.NODE_ENV!=="production"&&console.log(`conversation-provider: dispose (${this.name})`),(t=this.controller)==null||t.disposeProvider(this),this.controller=null,this.subscriptions.forEach(e=>e())}isRehydrated(){var t;return((t=this.controller)==null?void 0:t.isRehydrated())||Promise.resolve(!1)}getHistory(){var t;return((t=this.controller)==null?void 0:t.getHistory())||[]}complete(){var t;(t=this.controller)==null||t.onCompleteProvider()}setOptions(t={silent:!1}){this.options=t}onUnreadMessage(t){var e;if(this.controller){const s=(e=this.controller)==null?void 0:e.onUnreadMessage(t);return this.subscriptions.push(s),()=>{s()}}}onMounted(t){var e;if(this.controller){const s=(e=this.controller)==null?void 0:e.events.subscribe("conversation:component-mount-changed",t);return this.subscriptions.push(s),t({},this.controller.getComponentMountedState()),()=>{s()}}}}const hs=n=>`conversation-${n}`;class Ln{constructor(){this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let t;const e=new Promise(i=>t=()=>{this._locks-=1,i()}),s=this._locking.then(()=>t);return this._locking=this._locking.then(()=>e),s}}class Rn{constructor(t,e,s){this.container=t,this.enabled=s,this.locker=new Ln,this.initialStoredAgents=[],this.sessionStorageKey=hs(e.id),e.onStarted(async()=>{if(e.messages.length>0)return;const{agents:i}=await this.read(),r=[];i&&i.forEach(a=>{const c=e.providerIndex(a.providerName),h=c>-1?e.registeredProviders[c]:e.createProvider(a.providerName),d=new Yt(h,{name:a.name,avatar:a.avatar,id:a.id});r.push(d)});const{messages:o}=await this.read();o.forEach(a=>{switch(a.type){case"agent":{const c=r.find(h=>{var d;return h.id===((d=a.sender)==null?void 0:d.id)});c&&c.print(a.content.items||a.content,{key:a.key});return}case"user":{e.user.print(a.content.items||a.content,{key:a.key});return}case"system":default:e.print(a.content.items||a.content)}})}),e.onMessageCreated(async(i,r)=>{this.write(r.message,"messages")}),e.events.subscribe("conversation:agent-created",async(i,r)=>{const o={id:r.agent.id,name:r.agent.name,avatar:r.agent.avatar,providerName:r.agent.provider.name};await this.write(o,"agents")}),e.events.subscribe("conversation:agent-updated",async(i,r)=>{const{agents:o}=await this.read();await this.write([...o.map(a=>a.id===r.agent.id?{...a,name:r.agent.name,avatar:r.agent.avatar}:a)],"agents","update")})}setInitialData(t){this.initialStoredAgents=t.agents}async isRehydrated(){const{messages:t}=await this.read();return t.length>0}getStoredAgent(t){if(this.enabled)return this.initialStoredAgents.find(e=>e.id===t)}async write(t,e,s="add"){if(!this.enabled)return;const i=await this.locker.lock();return At(this.container,this.sessionStorageKey,f.Necessary).then(async r=>{if(s==="add"){const o=await this.read();if(e==="messages"&&o.messages.findIndex(c=>c.key===t.key)>-1){i();return}const a={...o};return e==="messages"?a.messages=[...a.messages,t]:e==="agents"&&(a.agents=[...a.agents,t]),r({...o,...a}).then(()=>{i()})}if(s==="update"&&e==="agents"){const o=await this.read();return r({...o,agents:t}).then(()=>{i()})}return r(t).then(()=>{i()})})}async read(){return z(this.container,this.sessionStorageKey).then(t=>t||{messages:[],agents:[]})}}class Wn{constructor(t){this.controller=t,this.print=(e,s)=>{const i=Et(e,s);return this.controller.createEntry(i.key,i.content,F.User,void 0,i.timestamp)}}}const Zt=async(n,t,e)=>{const s=await n.getAsync("conversation"),i=await n.getAsync("components"),r=s.controllers.find(o=>o.conversation.id===t);if(r){const o=[...r.conversation.providers];o.forEach(c=>{r.conversation.setProviderOptions(c,{silent:!0})}),r.conversation.queueProviders(o),r.conversation.setProviders([e]);const a=i.components().ofType("conversation");i.write({key:"setConversationProvider",attributes:{properties:{providers:[e]}},target:a,provider:"localStorage"})}};class ls{constructor(t){this.writer=t,this.entryId=H()}update(t){const e=this.getNormalizedSettings(t);this.writer(e)}remove(){this.writer(null)}getNormalizedSettings(t){return typeof t=="string"?{body:t}:t.length>-1&&typeof t=="object"?{items:t}:t}}var F=(n=>(n.User="user",n.Agent="agent",n.System="system",n))(F||{});const Et=(n,t)=>{let e,s=(t==null?void 0:t.key)||H(),i=Date.now();return Array.isArray(n)&&n.length>-1?typeof n[0]=="string"?e={items:[n]}:e={items:n}:typeof n=="string"?e={body:n}:(n=n||{},n.type?e={...n}:(e={body:n.body,actions:n.actions,title:n.title},n.key&&(s=n.key),n.timestamp&&(i=n.timestamp),n.form,n.timestamp===null&&(i=null))),{content:e,key:s,timestamp:i}},Ie=(n,t)=>{if(!t)return;const e=JSON.stringify(t),s=n.findIndex(i=>e===JSON.stringify(i));if(s>-1)return n.splice(s,1)};class ds{constructor(t,e,s){this.container=t,this.id=e,this.formHandlers={},this.user=new Wn(this),this.providers=[],this.active=!1,this.queuedProviders=[],this.registeredProviders=[],this.loaders=0,this.componentMounted=!1,this.messages=[],this.typingActors=[],this.print=r=>{const o=Et(r);return this.createEntry(o.key,o.content,"system",void 0,o.timestamp)};const i=t.get("$widget");this.events=i.events.createChild(this),this.store=new Rn(t,this,s.rehydrate),this.conversationHistory=new Hn(this)}setInitialStorage(t){this.store.setInitialData(t)}setProviders(t){const e=[],s=[];this.providers.reduce((i,r)=>(t.indexOf(r)===-1&&i.push(r),i),[]).forEach(i=>{const r=this.providers.indexOf(i);r>-1&&(e.push(i),this.providers.splice(r,1))}),t.forEach(i=>{this.providers.indexOf(i)===-1&&(s.push(i),this.providers.push(i))}),(s.length||e.length)&&this.events.dispatch("conversation:providers-changed",{added:s,removed:e})}createProvider(t){const e=this.providerIndex(t);if(e>-1)return this.registeredProviders[e];const s=ae.create(t,this.container,this);return this.registeredProviders.push(s),s}providerIndex(t){return this.registeredProviders.findIndex(e=>e.name===t)}getAgentById(t){if(t)return this.store.getStoredAgent(t)}dispose(){this.conversationHistory.dispose(),this.registeredProviders.forEach(t=>t.dispose()),this.messages=[],this.events.dispatch("conversation:controller-disposed",this),this.active=!1}onDispose(t){return this.events.subscribe("conversation:controller-disposed",t)}onStarted(t){return this.events.subscribe("conversation:started",t)}onMessageCreated(t){return this.events.subscribe("conversation:message-created",t)}isRehydrated(){return this.store.isRehydrated()}disposeProvider(t){const e=this.providerIndex(t.name);e>-1&&this.registeredProviders.splice(e,1),this.events.dispatch("conversation:providers-changed",{removed:[t.name]}),this.registeredProviders.length||this.dispose()}onProvidersChange(t){return this.events.subscribe("conversation:providers-changed",t)}setComponentMountedState(t){this.componentMounted!==t&&(this.componentMounted=t,t&&(this.events.dispatch("conversation:unread-message",!1),this.events.dispatch("conversation:started",!0),this.active=!0),this.events.dispatch("conversation:component-mount-changed",t))}setProviderOptions(t,e){const s=this.providerIndex(t);s>-1&&this.registeredProviders[s].setOptions(e)}changeProvider(t){this.registeredProviders.find(s=>s.name===t)&&Zt(this.container,this.id,t)}queueProviders(t){this.queuedProviders=t}onCompleteProvider(){const t=this.queuedProviders.pop();t&&Zt(this.container,this.id,t)}getComponentMountedState(){return this.componentMounted}onUnreadMessage(t){return this.events.subscribe("conversation:unread-message",t)}createEntry(t,e,s,i,r){const o={key:t,content:e,type:s,sender:i||null,timestamp:r||r===null?r:Date.now()};this.messages.push(o),o.type==="agent"&&Ie(this.typingActors,i);const a=new ls(c=>{if(c!==null){const{timestamp:h=void 0,...d}=c;o.content=d,h&&(o.timestamp=h)}else{const h=this.messages.indexOf(o);o.content=null,h>-1&&this.messages.splice(h,1)}this.events.dispatch("conversation:message-updated",{message:o}),this.update()});return this.events.dispatch("conversation:message-created",{message:o}),this.update(),this.componentMounted||this.events.dispatch("conversation:unread-message",!0),a}update(){this.events.dispatch("conversation:updated",{messages:this.messages,loading:this.loaders>0,typingActors:this.typingActors})}getMessageStream(){return{messages:this.messages,loading:this.loaders>0,typingActors:this.typingActors}}setTypingState(t,e){return this.typingActors.indexOf(t)===-1&&(this.typingActors.push(t),this.update()),()=>{Ie(this.typingActors,t),this.update()}}loader(){this.loaders=this.loaders+1;let t=!1;return this.loaders===1&&this.update(),()=>{t||(t=!0,this.loaders=this.loaders-1,this.loaders===0&&this.update())}}submitForm(t,e){this.formHandlers[t]={...this.formHandlers[t],submit:e}}validateForm(t,e){this.formHandlers[t]={...this.formHandlers[t],validate:e}}getHistory(){return this.conversationHistory.getConversationLogs()}}const zn=(n,t)=>{const e=n.split("_contact");return t.widgets.get(e[0])},ce=n=>{const t=n.get("$widget"),{name:e,implementation:s}=n.get("$widget"),i=e.indexOf("_contact")>-1?zn(e,s):t,{data:r}=n.get("$settings"),{trigger:o}=i.container.get("$settings"),a=`${e.replace("_contact-method","").replace("_contact","")}_contact-method`,c=s.widgets.get(a);return c&&!o?{chatWidget:c,mainWidget:i,data:r}:{mainWidget:i,data:r}},Bn=n=>{const{chatWidget:t}=ce(n);return!!t},Me=(n,t,e)=>{const{mainWidget:s,data:i,chatWidget:r}=ce(n);return r?r.state==="activated"?r.invoke("open").then(()=>{r.container.getAsync("conversation").then(o=>{o.navigateToConversationIfActive(t.id)})}):r.activate().then(()=>{const{trigger:o}=r.container.get("$settings");return o.action="hide",r.invoke("setSettings",()=>({data:i,trigger:o,activate:!0})).then(()=>r.container.getAsync("components").then(a=>{const c=a.components().ofType("contact-method");a.write({key:"setContactMethodId",attributes:{properties:{id:t.id,guideId:t.guideId}},target:c,provider:"localStorage"});const h=a.components().ofType("conversation");a.write({key:"setConversationProvider",attributes:{properties:{providers:[t.clientName]}},target:h,provider:"localStorage"})}))}).then(()=>r.invoke("attach",{key:"contact-method",triggerDOMElement:e,withRenderState:"open"})).then(()=>(At(r.container,"activeStickyWidget",f.Necessary,{medium:y.Local,scope:_t.Implementation}).then(o=>o(r.name)),r.container.getAsync("conversation").then(o=>{o.setConversationEndedBehavior(xt.Deactivate)}).then(()=>!1))):!r},Vn=(n,t,e="conversation")=>{const{mainWidget:s,chatWidget:i}=ce(n);return s.container.getAsync("conversation").then(r=>{var o;(o=r.setConversationEndedBehavior(xt.Navigate))==null||o.then(()=>{s.container.getAsync("components").then(a=>{const c=a.components().ofType("conversation");a.write({key:"setConversationProvider",attributes:{properties:{providers:[t.clientName]}},target:c,provider:"localStorage"})})})})},dt="conversations";var xt=(n=>(n.Deactivate="deactivate",n.Navigate="navigate",n.None="none",n))(xt||{});class Ct{constructor(t,e){this.container=t,this.components=e,this.controllers=[],this.providers=[],this.disposeProviders={},this.subscriptions=[],this.storageWriter=null,this.buttonQuery=null,this.sessionInfo=null;const s=t.get("$widget");this.events=s.events.createChild(this)}initialize(){At(this.container,dt,f.Necessary,{medium:y.Local}).then(t=>this.storageWriter=t),z(this.container,dt,y.Local).then(t=>{this.buttonQuery=this.components.components().ofType("conversation-return-button"),t&&(this.sessionInfo=t,t.id&&t.route&&this.writeToComponents({active:!0,alert:{show:!1}}))}),this.events.subscribe("conversation:ended",(t,e)=>{var s;switch((s=this.sessionInfo)==null?void 0:s.conversationEndedBehavior){case"deactivate":this.container.get("$widget").deactivate();break}this.writeToComponents({active:!1}),this.sessionInfo=null,this.storageWriter&&this.storageWriter()})}addSubscription(t){this.subscriptions.push(t)}static getInstance(t,e="conversation"){return rt(t)(()=>t.getAsync(e).then(s=>{let i=s;return i||ne.getInstance(t).then(r=>(i=new Ct(t,r),i.initialize(),t.registerAsync(e,()=>i),i))}))}setConversationEndedBehavior(t){return z(this.container,dt,y.Local).then(e=>{let s=e;return s?s.conversationEndedBehavior=t:s={conversationEndedBehavior:t},this.sessionInfo=s,this.storageWriter&&this.storageWriter(this.sessionInfo)||Promise.resolve()})}async createController(t,e){const s=hs(t),{agents:i}=await z(this.container,s)||{agents:[]},r=this.controllers.findIndex(a=>a.conversation.id===t);let o;return r>-1?o=this.controllers[r].conversation:o=new ds(this.container,t,e),o.setInitialStorage({agents:i||[]}),o}registerProvider(t,e){const s={name:t,handler:e};this.providers.push(s),this.controllers.filter(i=>i.conversation.providers.indexOf(t)>-1).forEach(i=>{this.invokeHandler(s,i)})}registerController(t,e){const s=this.controllers.findIndex(r=>r.conversation.id===t.id);let i;if(s<0){i={conversation:t,component:e},this.controllers.push(i);const r=o=>{o&&this.providers.filter(a=>o.indexOf(a.name)>-1).forEach(a=>{this.invokeHandler(a,i)})};return this.subscriptions.push(t.onDispose((o,a)=>{const c=this.controllers.findIndex(h=>h.conversation===a);c>-1&&this.controllers.splice(c,1),this.components.components().ofType("conversation-return-button").select().writeProperties({active:!1}),this.events.dispatch("conversation:ended",{},{bubbles:!0})})),this.subscriptions.push(t.onProvidersChange((o,a)=>{const{added:c,removed:h=[]}=a;h.forEach(d=>{(this.disposeProviders[d]||[]).forEach(l=>{l()})}),r(c)})),this.subscriptions.push(t.onStarted((o,a)=>{var h;const c={id:t.id,conversationEndedBehavior:(h=this.sessionInfo)==null?void 0:h.conversationEndedBehavior};this.sessionInfo=c,this.storageWriter&&this.storageWriter(c),this.writeToComponents({active:a})})),this.subscriptions.push(t.onUnreadMessage((o,a)=>{this.events.dispatch("conversation:unread-message",a),this.writeToComponents({alert:{show:a}})})),r(t.providers),!0}return i=this.controllers[s],!1}writeToComponents(t,e="conversationReturnButtonState"){this.buttonQuery&&this.components.write({key:"conversationReturnButtonState",attributes:{properties:t},target:this.buttonQuery,provider:"localStorage"})}invokeHandler(t,e){const s=t.handler(e.conversation.createProvider(t.name),e.component);s&&(this.disposeProviders[t.name]||(this.disposeProviders[t.name]=[]),this.disposeProviders[t.name].push(s))}getComponentRoute(){return z(this.container,dt,y.Local).then(t=>t==null?void 0:t.route)}dispose(){Object.keys(this.disposeProviders).forEach(t=>{this.disposeProviders[t].forEach(e=>{e()})}),this.subscriptions.forEach(t=>{t()}),this.controllers=[],this.providers=[]}static async handleContactMethodClick(t,e,s,i){if(Bn(e)){t.preventDefault();let r=document.getElementById("humany-dynamic-anchor");r||(r=document.createElement("a"),r.setAttribute("href","#"),r.id="humany-dynamic-anchor",document.body.appendChild(r)),Me(e,s,r)}Me(e,s)}static async handleContactMethodSubmit(t,e){var s,i;return(i=(s=e==null?void 0:e.body.form.meta)==null?void 0:s.conversation)!=null&&i.id?Zt(t,e.body.form.meta.conversation.id,e.clientName):Vn(t,e)}}/**
|
16
|
-
* @license
|
17
|
-
* Copyright 2019 Google LLC
|
18
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
19
|
-
*/const ut=globalThis,he=ut.ShadowRoot&&(ut.ShadyCSS===void 0||ut.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,le=Symbol(),De=new WeakMap;let ps=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==le)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(he&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=De.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&De.set(e,t))}return t}toString(){return this.cssText}};const Jn=n=>new ps(typeof n=="string"?n:n+"",void 0,le),us=(n,...t)=>{const e=n.length===1?n[0]:t.reduce((s,i,r)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[r+1],n[0]);return new ps(e,n,le)},qn=(n,t)=>{if(he)n.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),i=ut.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,n.appendChild(s)}},Ue=he?n=>n:n=>n instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return Jn(e)})(n):n;/**
|
20
|
-
* @license
|
21
|
-
* Copyright 2017 Google LLC
|
22
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
23
|
-
*/const{is:Fn,defineProperty:Qn,getOwnPropertyDescriptor:Kn,getOwnPropertyNames:Yn,getOwnPropertySymbols:Zn,getPrototypeOf:Gn}=Object,T=globalThis,je=T.trustedTypes,Xn=je?je.emptyScript:"",Bt=T.reactiveElementPolyfillSupport,X=(n,t)=>n,yt={toAttribute(n,t){switch(t){case Boolean:n=n?Xn:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,t){let e=n;switch(t){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch{e=null}}return e}},de=(n,t)=>!Fn(n,t),He={attribute:!0,type:String,converter:yt,reflect:!1,hasChanged:de};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),T.litPropertyMetadata??(T.litPropertyMetadata=new WeakMap);class R extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=He){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&Qn(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:r}=Kn(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return i==null?void 0:i.call(this)},set(o){const a=i==null?void 0:i.call(this);r.call(this,o),this.requestUpdate(t,a,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??He}static _$Ei(){if(this.hasOwnProperty(X("elementProperties")))return;const t=Gn(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(X("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(X("properties"))){const e=this.properties,s=[...Yn(e),...Zn(e)];for(const i of s)this.createProperty(i,e[i])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[s,i]of e)this.elementProperties.set(s,i)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const i=this._$Eu(e,s);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const i of s)e.unshift(Ue(i))}else t!==void 0&&e.push(Ue(t));return e}static _$Eu(t,e){const s=e.attribute;return s===!1?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$ES??(this._$ES=[])).push(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$ES)==null||e.splice(this._$ES.indexOf(t)>>>0,1)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return qn(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)==null||t.forEach(e=>{var s;return(s=e.hostConnected)==null?void 0:s.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)==null||t.forEach(e=>{var s;return(s=e.hostDisconnected)==null?void 0:s.call(e)})}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e){var r;const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(i!==void 0&&s.reflect===!0){const o=(((r=s.converter)==null?void 0:r.toAttribute)!==void 0?s.converter:yt).toAttribute(e,s.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){var r;const s=this.constructor,i=s._$Eh.get(t);if(i!==void 0&&this._$Em!==i){const o=s.getPropertyOptions(i),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((r=o.converter)==null?void 0:r.fromAttribute)!==void 0?o.converter:yt;this._$Em=i,this[i]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,s,i=!1,r){if(t!==void 0){if(s??(s=this.constructor.getPropertyOptions(t)),!(s.hasChanged??de)(i?r:this[t],e))return;this.C(t,e,s)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),s.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[r,o]of i)o.wrapped!==!0||this._$AL.has(r)||this[r]===void 0||this.C(r,this[r],o)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$ES)==null||s.forEach(i=>{var r;return(r=i.hostUpdate)==null?void 0:r.call(i)}),this.update(e)):this._$ET()}catch(i){throw t=!1,this._$ET(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)==null||e.forEach(s=>{var i;return(i=s.hostUpdated)==null?void 0:i.call(s)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}}R.elementStyles=[],R.shadowRootOptions={mode:"open"},R[X("elementProperties")]=new Map,R[X("finalized")]=new Map,Bt==null||Bt({ReactiveElement:R}),(T.reactiveElementVersions??(T.reactiveElementVersions=[])).push("2.0.1");/**
|
24
|
-
* @license
|
25
|
-
* Copyright 2017 Google LLC
|
26
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
27
|
-
*/const tt=globalThis,$t=tt.trustedTypes,Le=$t?$t.createPolicy("lit-html",{createHTML:n=>n}):void 0,gs="$lit$",O=`lit$${(Math.random()+"").slice(9)}$`,ms="?"+O,ti=`<${ms}>`,j=document,st=()=>j.createComment(""),nt=n=>n===null||typeof n!="object"&&typeof n!="function",vs=Array.isArray,ei=n=>vs(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",Vt=`[
|
28
|
-
\f\r]`,Y=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Re=/-->/g,We=/>/g,M=RegExp(`>|${Vt}(?:([^\\s"'>=/]+)(${Vt}*=${Vt}*(?:[^
|
29
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),ze=/'/g,Be=/"/g,fs=/^(?:script|style|textarea|title)$/i,si=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),G=si(1),I=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),Ve=new WeakMap,U=j.createTreeWalker(j,129);function ys(n,t){if(!Array.isArray(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Le!==void 0?Le.createHTML(t):t}const ni=(n,t)=>{const e=n.length-1,s=[];let i,r=t===2?"<svg>":"",o=Y;for(let a=0;a<e;a++){const c=n[a];let h,d,l=-1,p=0;for(;p<c.length&&(o.lastIndex=p,d=o.exec(c),d!==null);)p=o.lastIndex,o===Y?d[1]==="!--"?o=Re:d[1]!==void 0?o=We:d[2]!==void 0?(fs.test(d[2])&&(i=RegExp("</"+d[2],"g")),o=M):d[3]!==void 0&&(o=M):o===M?d[0]===">"?(o=i??Y,l=-1):d[1]===void 0?l=-2:(l=o.lastIndex-d[2].length,h=d[1],o=d[3]===void 0?M:d[3]==='"'?Be:ze):o===Be||o===ze?o=M:o===Re||o===We?o=Y:(o=M,i=void 0);const u=o===M&&n[a+1].startsWith("/>")?" ":"";r+=o===Y?c+ti:l>=0?(s.push(h),c.slice(0,l)+gs+c.slice(l)+O+u):c+O+(l===-2?a:u)}return[ys(n,r+(n[e]||"<?>")+(t===2?"</svg>":"")),s]};class it{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let r=0,o=0;const a=t.length-1,c=this.parts,[h,d]=ni(t,e);if(this.el=it.createElement(h,s),U.currentNode=this.el.content,e===2){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(i=U.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(const l of i.getAttributeNames())if(l.endsWith(gs)){const p=d[o++],u=i.getAttribute(l).split(O),g=/([.?@])?(.*)/.exec(p);c.push({type:1,index:r,name:g[2],strings:u,ctor:g[1]==="."?ri:g[1]==="?"?oi:g[1]==="@"?ai:kt}),i.removeAttribute(l)}else l.startsWith(O)&&(c.push({type:6,index:r}),i.removeAttribute(l));if(fs.test(i.tagName)){const l=i.textContent.split(O),p=l.length-1;if(p>0){i.textContent=$t?$t.emptyScript:"";for(let u=0;u<p;u++)i.append(l[u],st()),U.nextNode(),c.push({type:2,index:++r});i.append(l[p],st())}}}else if(i.nodeType===8)if(i.data===ms)c.push({type:2,index:r});else{let l=-1;for(;(l=i.data.indexOf(O,l+1))!==-1;)c.push({type:7,index:r}),l+=O.length-1}r++}}static createElement(t,e){const s=j.createElement("template");return s.innerHTML=t,s}}function J(n,t,e=n,s){var o,a;if(t===I)return t;let i=s!==void 0?(o=e._$Co)==null?void 0:o[s]:e._$Cl;const r=nt(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==r&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),r===void 0?i=void 0:(i=new r(n),i._$AT(n,e,s)),s!==void 0?(e._$Co??(e._$Co=[]))[s]=i:e._$Cl=i),i!==void 0&&(t=J(n,i._$AS(n,t.values),i,s)),t}class ii{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=((t==null?void 0:t.creationScope)??j).importNode(e,!0);U.currentNode=i;let r=U.nextNode(),o=0,a=0,c=s[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new ot(r,r.nextSibling,this,t):c.type===1?h=new c.ctor(r,c.name,c.strings,this,t):c.type===6&&(h=new ci(r,this,t)),this._$AV.push(h),c=s[++a]}o!==(c==null?void 0:c.index)&&(r=U.nextNode(),o++)}return U.currentNode=j,i}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class ot{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=J(this,t,e),nt(t)?t===m||t==null||t===""?(this._$AH!==m&&this._$AR(),this._$AH=m):t!==this._$AH&&t!==I&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):ei(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==m&&nt(this._$AH)?this._$AA.nextSibling.data=t:this.$(j.createTextNode(t)),this._$AH=t}g(t){var r;const{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=it.createElement(ys(s.h,s.h[0]),this.options)),s);if(((r=this._$AH)==null?void 0:r._$AD)===i)this._$AH.p(e);else{const o=new ii(i,this),a=o.u(this.options);o.p(e),this.$(a),this._$AH=o}}_$AC(t){let e=Ve.get(t.strings);return e===void 0&&Ve.set(t.strings,e=new it(t)),e}T(t){vs(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const r of t)i===e.length?e.push(s=new ot(this.k(st()),this.k(st()),this,this.options)):s=e[i],s._$AI(r),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,e);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class kt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,r){this.type=1,this._$AH=m,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}_$AI(t,e=this,s,i){const r=this.strings;let o=!1;if(r===void 0)t=J(this,t,e,0),o=!nt(t)||t!==this._$AH&&t!==I,o&&(this._$AH=t);else{const a=t;let c,h;for(t=r[0],c=0;c<r.length-1;c++)h=J(this,a[s+c],e,c),h===I&&(h=this._$AH[c]),o||(o=!nt(h)||h!==this._$AH[c]),h===m?t=m:t!==m&&(t+=(h??"")+r[c+1]),this._$AH[c]=h}o&&!i&&this.O(t)}O(t){t===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class ri extends kt{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===m?void 0:t}}class oi extends kt{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==m)}}class ai extends kt{constructor(t,e,s,i,r){super(t,e,s,i,r),this.type=5}_$AI(t,e=this){if((t=J(this,t,e,0)??m)===I)return;const s=this._$AH,i=t===m&&s!==m||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==m&&(s===m||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class ci{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){J(this,t)}}const Jt=tt.litHtmlPolyfillSupport;Jt==null||Jt(it,ot),(tt.litHtmlVersions??(tt.litHtmlVersions=[])).push("3.0.2");const hi=(n,t,e)=>{const s=(e==null?void 0:e.renderBefore)??t;let i=s._$litPart$;if(i===void 0){const r=(e==null?void 0:e.renderBefore)??null;s._$litPart$=i=new ot(t.insertBefore(st(),r),r,void 0,e??{})}return i._$AI(n),i};/**
|
30
|
-
* @license
|
31
|
-
* Copyright 2017 Google LLC
|
32
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
33
|
-
*/class V extends R{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=hi(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return I}}var Je;V._$litElement$=!0,V.finalized=!0,(Je=globalThis.litElementHydrateSupport)==null||Je.call(globalThis,{LitElement:V});const qt=globalThis.litElementPolyfillSupport;qt==null||qt({LitElement:V});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.1");/**
|
34
|
-
* @license
|
35
|
-
* Copyright 2017 Google LLC
|
36
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
37
|
-
*/const li={attribute:!0,type:String,converter:yt,reflect:!1,hasChanged:de},di=(n=li,t,e)=>{const{kind:s,metadata:i}=e;let r=globalThis.litPropertyMetadata.get(i);if(r===void 0&&globalThis.litPropertyMetadata.set(i,r=new Map),r.set(e.name,n),s==="accessor"){const{name:o}=e;return{set(a){const c=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,c,n)},init(a){return a!==void 0&&this.C(o,void 0,n),a}}}if(s==="setter"){const{name:o}=e;return function(a){const c=this[o];t.call(this,a),this.requestUpdate(o,c,n)}}throw Error("Unsupported decorator location: "+s)};function St(n){return(t,e)=>typeof e=="object"?di(n,t,e):((s,i,r)=>{const o=i.hasOwnProperty(r);return i.constructor.createProperty(r,o?{...s,wrapped:!0}:s),o?Object.getOwnPropertyDescriptor(i,r):void 0})(n,t,e)}/**
|
38
|
-
* @license
|
39
|
-
* Copyright 2017 Google LLC
|
40
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
41
|
-
*/function Ot(n){return St({...n,state:!0,attribute:!1})}/**
|
42
|
-
* @license
|
43
|
-
* Copyright 2017 Google LLC
|
44
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
45
|
-
*/const $s={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},bs=n=>(...t)=>({_$litDirective$:n,values:t});class ws{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}/**
|
46
|
-
* @license
|
47
|
-
* Copyright 2018 Google LLC
|
48
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
49
|
-
*/const _s=bs(class extends ws{constructor(n){var t;if(super(n),n.type!==$s.ATTRIBUTE||n.name!=="class"||((t=n.strings)==null?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(n){return" "+Object.keys(n).filter(t=>n[t]).join(" ")+" "}update(n,[t]){var s,i;if(this.it===void 0){this.it=new Set,n.strings!==void 0&&(this.st=new Set(n.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(const r in t)t[r]&&!((s=this.st)!=null&&s.has(r))&&this.it.add(r);return this.render(t)}const e=n.element.classList;for(const r of this.it)r in t||(e.remove(r),this.it.delete(r));for(const r in t){const o=!!t[r];o===this.it.has(r)||(i=this.st)!=null&&i.has(r)||(o?(e.add(r),this.it.add(r)):(e.remove(r),this.it.delete(r)))}return I}}),pt=(n,t,e)=>{n&&e.style.setProperty(t,n)},pi=(n,t)=>{var e,s,i,r;pt((e=n.colors)==null?void 0:e.primaryBackground,"--primary-background",t),pt((s=n.colors)==null?void 0:s.textOnPrimaryBackground,"--text-on-primary-background",t),pt((i=n.colors)==null?void 0:i.secondaryBackground,"--secondary-background",t),pt((r=n.colors)==null?void 0:r.textOnSecondaryBackground,"--text-on-secondary-background",t)};var ui=Object.defineProperty,gi=Object.getOwnPropertyDescriptor,at=(n,t,e,s)=>{for(var i=s>1?void 0:s?gi(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(s?o(t,e,i):o(i))||i);return s&&i&&ui(t,e,i),i};class Q extends V{constructor(){super(...arguments),this.active=!1,this.loaded=!1}async connectedCallback(){super.connectedCallback(),this.icon=await this._renderSymbol(this.symbol),this.loaded=!0,this._applyBranding()}_toggleActive(){this.active=!this.active}_applyBranding(){var e;const t=((e=this.container)==null?void 0:e.get("$settings"))??{};t!=null&&t.branding&&pi(t.branding,this)}async _renderSymbol(t){const e=async s=>await Promise.resolve().then(()=>require("./index-c51d4b6a.js")).then(r=>r[s]);if(t){const{type:s,content:i}=t;switch(s){case"Telia":{const r=await e(i);return r?G`<telia-icon
|
50
|
-
class="trigger-icon"
|
51
|
-
svg=${r.svg}
|
52
|
-
size="lg"
|
53
|
-
></telia-icon>`:m}case"FontAwesome":return G`<i class="trigger-fa-icon fa fa-${i}"></i>`;case"Uri":return G`<i
|
54
|
-
class="trigger-custom-icon"
|
55
|
-
style="background: url(${i}) no-repeat center center;background-size: contain;"
|
56
|
-
></i>`;default:return m}}}render(){return G`<button
|
57
|
-
class=${_s({trigger:!0,active:this.active,rendered:this.loaded})}
|
58
|
-
@click=${this._toggleActive}
|
59
|
-
>
|
60
|
-
${this.icon}
|
61
|
-
<span class="trigger-close">
|
62
|
-
<svg
|
63
|
-
width="18"
|
64
|
-
height="9"
|
65
|
-
viewBox="0 0 18 9"
|
66
|
-
fill="none"
|
67
|
-
xmlns="http://www.w3.org/2000/svg"
|
68
|
-
>
|
69
|
-
<path
|
70
|
-
d="M9 9C8.81794 9.00045 8.63759 8.96634 8.46939 8.89965C8.3012 8.83295 8.14851 8.735 8.02015 8.61145L0.194523 1.12367C0.068294 0.99862 -0.00155266 0.831133 2.61958e-05 0.657285C0.00160506 0.483436 0.0744832 0.317136 0.202964 0.194202C0.331445 0.0712675 0.505249 0.00153576 0.686941 2.50649e-05C0.868634 -0.00148563 1.04368 0.0653456 1.17437 0.186125L9 7.6739L16.8256 0.186125C16.9563 0.0653456 17.1314 -0.00148563 17.3131 2.50649e-05C17.4948 0.00153576 17.6686 0.0712675 17.797 0.194202C17.9255 0.317136 17.9984 0.483436 18 0.657285C18.0016 0.831133 17.9317 0.99862 17.8055 1.12367L9.97985 8.61145C9.85149 8.735 9.6988 8.83295 9.53061 8.89965C9.36241 8.96634 9.18206 9.00045 9 9Z"
|
71
|
-
fill="white"
|
72
|
-
/>
|
73
|
-
</svg>
|
74
|
-
</span>
|
75
|
-
<span class="trigger-loader">
|
76
|
-
<svg viewBox="25 25 50 50">
|
77
|
-
<circle
|
78
|
-
cx="50"
|
79
|
-
cy="50"
|
80
|
-
r="20"
|
81
|
-
fill="none"
|
82
|
-
stroke="#000"
|
83
|
-
stroke-width="2"
|
84
|
-
stroke-miterlimit="10"
|
85
|
-
/>
|
86
|
-
</svg>
|
87
|
-
</span>
|
88
|
-
</button>`}}Q.styles=[us`
|
89
|
-
:host {
|
90
|
-
--voca-rem-multiplier: 0.625;
|
91
|
-
display: block;
|
92
|
-
box-sizing: border-box;
|
93
|
-
}
|
94
|
-
|
95
|
-
.trigger {
|
96
|
-
position: fixed;
|
97
|
-
transform: scale(0);
|
98
|
-
box-shadow: rgba(0, 0, 0, 0.16) 0px 5px 40px;
|
99
|
-
bottom: 20px;
|
100
|
-
right: 20px;
|
101
|
-
z-index: 5;
|
102
|
-
display: flex;
|
103
|
-
align-items: center;
|
104
|
-
justify-content: center;
|
105
|
-
border: none;
|
106
|
-
line-height: 55px;
|
107
|
-
height: 55px;
|
108
|
-
width: 55px;
|
109
|
-
border-radius: 55px;
|
110
|
-
cursor: pointer;
|
111
|
-
background-color: var(--trigger-bg, var(--primary-background));
|
112
|
-
font-family: Lato;
|
113
|
-
text-decoration: none;
|
114
|
-
border: 3px dashed transparent;
|
115
|
-
box-sizing: border-box;
|
116
|
-
transition: transform 200ms ease-out;
|
117
|
-
}
|
118
|
-
.trigger:hover {
|
119
|
-
transform: scale(1.1) !important;
|
120
|
-
}
|
121
|
-
.trigger.rendered {
|
122
|
-
transform: scale(1);
|
123
|
-
}
|
124
|
-
.trigger.active .trigger-icon {
|
125
|
-
opacity: 0;
|
126
|
-
transform: rotate(-180deg) scale(0);
|
127
|
-
}
|
128
|
-
.trigger.active .trigger-close {
|
129
|
-
opacity: 1;
|
130
|
-
transform: rotate(0deg) scale(1);
|
131
|
-
}
|
132
|
-
|
133
|
-
.trigger-icon {
|
134
|
-
display: inline-block;
|
135
|
-
line-height: inherit;
|
136
|
-
text-align: center;
|
137
|
-
opacity: 1;
|
138
|
-
transform: rotate(0deg) scale(1);
|
139
|
-
transition: opacity 200ms ease-out, transform 200ms ease-out;
|
140
|
-
color: var(--trigger-text-color, var(--text-on-primary-background));
|
141
|
-
}
|
142
|
-
.trigger-close {
|
143
|
-
opacity: 0;
|
144
|
-
transition: transform 200ms ease-out;
|
145
|
-
transform: rotate(180deg) scale(0);
|
146
|
-
position: absolute;
|
147
|
-
top: 0;
|
148
|
-
bottom: 0;
|
149
|
-
left: 0;
|
150
|
-
right: 0;
|
151
|
-
display: flex;
|
152
|
-
justify-content: center;
|
153
|
-
align-items: center;
|
154
|
-
fill: var(--trigger-text-color, var(--text-on-primary-background));
|
155
|
-
}
|
156
|
-
`];at([St({attribute:!1})],Q.prototype,"symbol",2);at([St({attribute:!1})],Q.prototype,"container",2);at([Ot()],Q.prototype,"active",2);at([Ot()],Q.prototype,"loaded",2);at([Ot()],Q.prototype,"icon",2);const mi=(n,t,e,s,i)=>n.getAsync("componentResolver").then(r=>(r.registerComponent(t,e),bn(n,t,s||(()=>{}),t,i))),vi=(n,t)=>n.reduce((e,s,i)=>{var o,a;const r={...s,content:[{...s.content,key:s.key}]};if(e.length>0&&s.type!==F.System){const c=e[e.length-1];if((!t&&t!==0||Math.abs(c.timestamp-s.timestamp)<t)&&((o=c.sender)==null?void 0:o.name)===((a=s.sender)==null?void 0:a.name)&&c.type===s.type)return c.timestamp=s.timestamp,c.content.push({...s.content,key:s.key}),e}return e.push(r),e},[]),fi=async n=>mi(n,"conversation",Promise.resolve().then(()=>require("./conversation-5265abc7.js")),async t=>{const e=await Ct.getInstance(n),{rehydrate:s=!1}=t.properties(),i="component",r=await e.createController(i,{rehydrate:s}),o=e.registerController(r,t),a=3*60*1e3,c=l=>{const{providers:p=[]}=l;if(p){const u=Array.isArray(p)?p:[p];return r.setProviders(u),u}};c(t.properties(c)),r.setComponentMountedState(!0);const h=l=>{const{loading:p,typingActors:u,messages:g}=l;t.writeProperties({loading:p,typingActors:u,messages:vi(g,a)})};h(r.getMessageStream()),o&&(t.writeProperties({conversationControllerId:r.id}),t.actions.create("user-submit",(l,p)=>{if(p){const{preventDefault:u,validationPromise:g}=p;if(u){g&&g().then(A=>{A&&r.user.print(A)});return}}r.user.print(l.text)}),t.actions.create("user-typing",(l,p)=>{}),t.actions.create("form",(l,p)=>{}),t.actions.create("action",(l,p)=>{}),t.actions.create("overlay-mounted",(l,p)=>{}),t.actions.create("show-overlay",(l,p)=>{t.writeProperties({overlay:{conversation:!1,secondary:!1}})}),t.actions.create("hide-overlay",(l,p)=>{t.writeProperties({overlay:null})}),t.actions.create("show-overlay-conversation",(l,p)=>{t.writeProperties({overlay:{conversation:!0,secondary:!1}})}),t.actions.create("hide-overlay-conversation",(l,p)=>{t.writeProperties({overlay:{conversation:!1,secondary:!1}})}));const d=r.events.subscribe("conversation:updated",(l,p)=>{h(p)});return()=>{r.setComponentMountedState(!1),d(),r.active||h({messages:[],typingActors:[],loading:!1})}},{reuseController:!0});var As=(n=>(n.LinkList="link-list",n.Separator="separator",n.ButtonList="button-list",n.ItemList="item-list",n.Text="text",n.HTML="html",n.VideoRequest="video-request",n))(As||{});const yi=async(n,t,e)=>{await e};exports.ConversationComponent=fi;exports.ConversationController=ds;exports.ConversationEndedBehavior=xt;exports.ConversationEntry=ls;exports.ConversationMessageListItemType=As;exports.ConversationMessageType=F;exports.ConversationPlatform=Ct;exports.Et=$n;exports.P=wt;exports.T=m;exports.e=bs;exports.e$1=_s;exports.ht=H;exports.i=us;exports.i$1=ws;exports.n=St;exports.pt=ne;exports.r=Ot;exports.registerCustomMessageComponent=yi;exports.s=V;exports.t=$s;exports.w=I;exports.x=G;
|