@opencxh/domain 1.134.14 → 1.136.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,18 @@ export interface AiVendor {
30
30
  * runtimes en eigen gateways.
31
31
  */
32
32
  baseUrl?: string;
33
+ /**
34
+ * Welke bijlagesoorten deze vendor rechtstreeks aanneemt.
35
+ *
36
+ * Bewust géén waarde in `capabilities`: `findAdapterGaps()` mapt elke
37
+ * capability die het niet kent op `"embedding"`, dus een vendor die daar
38
+ * `"attachments"` zou claimen wordt gemeld als missende embedding-adapter.
39
+ *
40
+ * Afwezig of leeg = alleen tekst. Dat is het juiste default voor de
41
+ * Chat-Completions-vendors: ze delen één adapter maar niet één set
42
+ * mogelijkheden, en een gok levert een 400 midden in een gesprek op.
43
+ */
44
+ attachmentKinds?: readonly ("image" | "pdf")[];
33
45
  }
34
46
  export declare const AI_VENDORS: readonly AiVendor[];
35
47
  export declare function findAiVendor(vendorId: string): AiVendor | undefined;
@@ -45,3 +57,5 @@ export declare function aiVendorDefaultModel(vendorId: string, fallback?: string
45
57
  export declare function aiVendorsWith(capability: AiVendorCapability): AiVendor[];
46
58
  /** True wanneer de user zelf een host moet invullen (vendor heeft er geen vaste). */
47
59
  export declare function aiVendorNeedsBaseUrl(vendorId: string): boolean;
60
+ /** Neemt deze vendor deze bijlagesoort aan? Tekst kan altijd — dat is prompt. */
61
+ export declare function aiVendorAcceptsAttachment(vendorId: string, kind: "image" | "pdf" | "text"): boolean;
@@ -1,7 +1,23 @@
1
+ import { AIAttachment, RejectedAIAttachment } from '../../platform/ai-attachments';
1
2
  import { ToolTraceEntry } from '../../platform/ai-tools';
2
3
  export interface AIMessageInput {
3
4
  text: string;
4
5
  type: "text";
6
+ /**
7
+ * Files handed along with the question. `type` stays "text" — it describes the
8
+ * prompt, and every vendor treats attachments as extra content beside it
9
+ * rather than as a different kind of message.
10
+ *
11
+ * Persisted with the message so the thread shows what was attached, but never
12
+ * with bytes: an `inline` source becomes `expired` on write. See
13
+ * `platform/ai-attachments.ts` for why.
14
+ */
15
+ attachments?: AIAttachment[];
16
+ /**
17
+ * Attachments that did not reach the model, so the UI can say why instead of
18
+ * leaving the user to wonder whether the answer took the file into account.
19
+ */
20
+ rejectedAttachments?: RejectedAIAttachment[];
5
21
  }
6
22
  export interface AIMessageOutput {
7
23
  text: string;
package/dist/index.cjs CHANGED
@@ -1,12 +1,12 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=10,d=10,m=10,f=5,ue=new Set(["header","section","context","divider","image","list","actions","attachments"]);function b(e){if(typeof e=="string")return e.length>0;if(!e||typeof e!="object")return!1;const t=e;return typeof t.key=="string"||typeof t.value=="string"}function de(e,t=()=>{}){if(!Array.isArray(e))return[];const n=[];for(const i of e){if(n.length>=S){t("more than "+S+" blocks; the rest was dropped");break}if(!i||typeof i!="object")continue;const a=i;if(!ue.has(a.type)){t("unknown block type "+String(a.type));continue}switch(a.type){case"header":if(!b(a.text)){t("a header without text");continue}break;case"context":if(!b(a.text)){t("a context block without text");continue}break;case"image":if(!a.url||!a.alt){t("an image without url or alt");continue}break;case"section":Array.isArray(a.fields)&&a.fields.length>d&&(t("more than "+d+" fields in a section"),a.fields=a.fields.slice(0,d));break;case"list":if(!Array.isArray(a.items)||a.items.length===0){t("a list without items");continue}a.items.length>m&&(t("more than "+m+" list items"),a.items=a.items.slice(0,m));break;case"actions":{const r=Array.isArray(a.elements)?a.elements:[],o=r.filter(l=>l&&l.action_id&&l.invoke&&b(l.text));if(o.length!==r.length&&t("an action without action_id, invoke or text"),o.length===0)continue;o.length>f&&t("more than "+f+" actions"),a.elements=o.slice(0,f);break}}n.push(a)}return n}function w(e){return e.replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<[^>]+>/g," ").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/\s+/g," ").trim()}function p(e){if(!e||e<0)return"";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${n.toString().padStart(2,"0")}`}function C(e){return e?` — ${Math.floor(e/60)}m ${e%60}s`:""}function I(e){return e?.split("@")?.[0]||e||""}function u(e){return e.map(t=>t.name).join(", ")}function v(e){return e==="meeting"?"Meeting":e==="video"?"Video call":"Audio call"}const c={VOICE_CALL_STARTED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek gestart",timeline:e=>e.direction==="inbound"?`Inbound call started — ${I(e.payload.from)}`:`Outbound call started — ${I(e.payload.to)}`},VOICE_CALL_ANSWERED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek aangenomen",timeline:(e,t)=>`Call answered — ${t}`},VOICE_CALL_HOLD:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"In de wacht",timeline:(e,t)=>`Call on hold — ${t}`},VOICE_CALL_UNHOLD:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Hervat"},VOICE_CALL_ENDED:{shape:"event",channelKind:"voice",icon:"phone",snippet:e=>`Gesprek beëindigd${e.payload.duration?` (${p(e.payload.duration)})`:""}`,timeline:e=>`Call ended${C(e.payload.duration)}`},VOICE_CALL_MISSED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gemiste oproep",timeline:e=>`Missed call — ${I(e.payload.from)}`},VOICE_CALL_FAILED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek mislukt",timeline:()=>"Call failed"},VOICE_CALL_VOICEMAIL:{shape:"artifact",channelKind:"voice",icon:"phone",snippet:e=>e.payload.transcription?.trim()?e.payload.transcription:"Voicemail ontvangen"},VIDEO_CALL_STARTED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gesprek gestart",timeline:()=>"Video call started"},VIDEO_CALL_ANSWERED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gesprek aangenomen",timeline:()=>"Video call answered"},VIDEO_CALL_HOLD:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"In de wacht"},VIDEO_CALL_UNHOLD:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Hervat"},VIDEO_CALL_ENDED:{shape:"event",channelKind:"video",icon:"video",snippet:e=>`Gesprek beëindigd${e.payload.duration?` (${p(e.payload.duration)})`:""}`,timeline:()=>"Video call ended"},VIDEO_CALL_MISSED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gemiste oproep",timeline:()=>"Missed video call"},VIDEO_CALL_FAILED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gesprek mislukt",timeline:()=>"Video call failed"},EMAIL_RECEIVED:{shape:"message",triggerable:!0,displayNameKey:"communication:activity.EMAIL_RECEIVED",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"inbound_message",snippet:O},EMAIL_SENT:{shape:"message",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:O},CHAT_MESSAGE_SENT:{shape:"message",component:"communication:ChatMessage",channelKind:"chat",icon:"message-circle",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:e=>e.payload.text??""},CHAT_MESSAGE_RECEIVED:{shape:"message",triggerable:!0,displayNameKey:"communication:activity.CHAT_MESSAGE_RECEIVED",component:"communication:ChatMessage",channelKind:"chat",icon:"message-circle",replyable:!0,carriesText:!0,countsAs:"inbound_message",snippet:e=>e.payload.text??""},CHAT_MEMBER_JOINED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`${u(e.payload.members)} toegevoegd`,timeline:e=>{const t=u(e.payload.members)||"Someone",n=e.payload.initiator?.name?` · added by ${e.payload.initiator.name}`:"";return`${t} joined the chat${n}`}},CHAT_MEMBER_LEFT:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`${u(e.payload.members)} verlaten`,timeline:e=>{const t=u(e.payload.members)||"Someone",n=e.payload.initiator?.name?` · removed by ${e.payload.initiator.name}`:"";return`${t} left the chat${n}`}},CHAT_RENAMED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`Hernoemd naar "${e.payload.newName}"`,timeline:e=>`Chat renamed to "${e.payload.newName}"${e.payload.initiator?` by ${e.payload.initiator.name}`:""}`},CHAT_CALL_STARTED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:()=>"Gesprek gestart",timeline:e=>`${v(e.payload.callType)} started${e.payload.initiator?` by ${e.payload.initiator.name}`:""}`,joinUrl:e=>e.payload.joinUrl},CHAT_CALL_ENDED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`Gesprek beëindigd${e.payload.duration?` (${p(e.payload.duration)})`:""}`,timeline:e=>`${v(e.payload.callType)} ended${C(e.payload.duration)}`,joinUrl:e=>e.payload.joinUrl},CHAT_EVENT:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>e.payload.text??e.payload.eventType,timeline:e=>e.payload.text||e.payload.eventType},TRANSCRIPT_ADDED:{shape:"artifact",triggerable:!0,displayNameKey:"communication:activity.TRANSCRIPT_ADDED",component:"communication:TranscriptionActivity",icon:"captions",carriesText:!0,snippet:e=>(e.payload.segments??[]).map(t=>t.text).join(" ")},COMMENT_ADDED:{shape:"note",component:"communication:CommentActivity",icon:"sticky-note",carriesText:!0,snippet:e=>e.payload.text??""},FILE_UPLOADED:{shape:"artifact",component:"communication:FileActivity",icon:"paperclip",snippet:e=>`Bestand: ${e.payload.fileName}`},AI_MESSAGE_ADDED:{shape:"event",triggerable:!0,displayNameKey:"communication:activity.AI_MESSAGE_ADDED",icon:"circle",snippet:e=>e.payload.output?.text??e.payload.input?.text??"",timeline:()=>"AI message added"},AI_ACTION_PROPOSED:{shape:"event",component:"communication:ProposedActionCard",icon:"circle",playbookAuthored:!0,snippet:e=>`Voorstel wacht op goedkeuring (${e.payload.actions?.length??0} actie(s))`},PLAYBOOK_STARTED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:e=>`Playbook gestart${e.payload.playbookName?`: ${e.payload.playbookName}`:""}`,timeline:e=>`Playbook gestart${e.payload.playbookName?` — ${e.payload.playbookName}`:""}`},PLAYBOOK_COMPLETED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:()=>"Playbook afgerond",timeline:()=>"Playbook afgerond"},PLAYBOOK_ESCALATED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:()=>"Playbook geëscaleerd naar een mens",timeline:()=>"Playbook geëscaleerd naar een mens"},MEETING_SCHEDULED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering gepland: ${e.payload.title}`,timeline:()=>"Meeting scheduled",joinUrl:e=>e.payload.joinUrl},MEETING_STARTED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering gestart: ${e.payload.title}`,timeline:()=>"Meeting started",joinUrl:e=>e.payload.joinUrl},MEETING_ENDED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering beëindigd${e.payload.duration?` (${p(e.payload.duration)})`:""}`,timeline:()=>"Meeting ended"},MEETING_PARTICIPANT_JOINED:{shape:"event",icon:"calendar",snippet:e=>`${e.payload.name} deelgenomen`,timeline:(e,t)=>`${t} joined the meeting`},MEETING_PARTICIPANT_LEFT:{shape:"event",icon:"calendar",snippet:e=>`${e.payload.name} verlaten`,timeline:(e,t)=>`${t} left the meeting`},INTERACTION_CREATED:{shape:"event",icon:"circle",snippet:()=>"Interactie aangemaakt",timeline:(e,t)=>`Interaction started by ${t}`},INTERACTION_STATUS_CHANGED:{shape:"event",triggerable:!0,displayNameKey:"communication:activity.INTERACTION_STATUS_CHANGED",icon:"circle-dot",snippet:e=>`Status: ${e.payload.fromStatus} → ${e.payload.toStatus}`,timeline:(e,t)=>`Status changed to ${e.payload.toStatus} by ${t}`},INTERACTION_ASSIGNED:{shape:"event",icon:"user",snippet:()=>"Interactie toegewezen",timeline:(e,t)=>`Assigned by ${t}`}};function O(e){const t=e.payload,n=t.bodySnippet?.trim()||w(t.body??"");return t.subject?`${t.subject} — ${n}`:n}function s(e){return c[e]}function me(e){return s(e)?.icon??"circle"}function fe(e){return s(e)?.channelKind}function ge(e){const t=s(e)?.shape;return t==="message"||t==="note"}function Ee(e){return s(e)?.replyable===!0}function he(e){return s(e)?.carriesText===!0}function ye(e){return s(e)?.countsAs}function Ae(e){return s(e)?.playbookAuthored===!0}function V(e){const t=s(e.type)?.snippet;return t?t(e):""}function be(e,t){const n=s(e.type)?.timeline;return n?n(e,t):e.type.replace(/_/g," ").toLowerCase()}function Ie(e){const t=s(e.type)?.joinUrl;return t?t(e):void 0}function E(e,t){let n=e;for(const i of t.split(".")){if(n==null||typeof n!="object")return"";n=n[i]}return n==null?"":typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"?String(n):""}function h(e,t,n){if(e===void 0)return null;if(typeof e=="string")return e||null;if("value"in e)return E(t,e.value)||null;const i={};for(const[r,o]of Object.entries(e.params??{}))i[r]=E(t,o);const a=n(e.key,i);return a===e.key?null:a}function B(e,t){if(!e||typeof e=="string"||"value"in e)return null;const n={};for(const[i,a]of Object.entries(e.params??{}))n[i]=E(t,a);return{key:e.key,params:n}}const _e=e=>e;function R(e){const t=c[e];return{type:e,shape:t.shape,channelKind:t.channelKind,icon:t.icon,replyable:t.replyable===!0,countsAs:t.countsAs,carriesText:t.carriesText===!0,triggerable:t.triggerable===!0,component:t.component,builtIn:!0,displayNameKey:t.displayNameKey}}function D(e){return{type:e.type,shape:e.shape,channelKind:e.channelKind,icon:e.icon||"circle",replyable:e.replyable===!0,countsAs:e.countsAs,carriesText:e.carriesText===!0,triggerable:e.triggerable===!0,component:e.component,builtIn:!1,displayNameKey:e.displayNameKey}}class H{constructor(t=[],n=_e){this.translate=n;for(const i of t)i?.type&&(i.type in c||this.declared.has(i.type)||this.declared.set(i.type,i))}declared=new Map;get(t){if(t in c)return R(t);const n=this.declared.get(t);return n?D(n):void 0}triggerable(){const t=Object.keys(c).filter(i=>c[i].triggerable).map(R),n=[...this.declared.values()].map(D).filter(i=>i.triggerable);return[...t,...n]}timelineText(t,n){const i=c[t.type];if(i?.timeline)return i.timeline(t,n);const a=this.declared.get(t.type);return h(a?.text,t,this.translate)??t.type.replace(/_/g," ").toLowerCase()}snippet(t){const n=c[t.type];if(n?.snippet)return n.snippet(t);const i=this.declared.get(t.type);return h(i?.text,t,this.translate)??""}descriptor(t){return this.declared.get(t)}blocks(t){const n=this.declared.get(t)?.render;return n?.length?n:void 0}get translator(){return this.translate}}const Se=new H,L=140;function Te(e){const t=e.trim();return t.length<=L?t:t.slice(0,L-1).trimEnd()+"…"}function Me(e,t){const n=B(t?.text,e),i=t?h(t.text,e,a=>a):null;return{activityId:e.id,type:e.type,snippet:Te(i??V(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now(),...n?{snippetKey:n.key,snippetParams:n.params}:{}}}function Ne(e,t,n=[]){const i=e.createdAt;if(!i)return[];const a=new Set(n);return e.author.type==="user"&&e.author.id&&a.add(e.author.id),Object.entries(t).filter(([r,o])=>o>=i&&!a.has(r)).map(([r])=>r)}function Ce(e){return e.createdAt??0}const ve=[{id:"agent",label:"Agent",labelSource:"user"},{id:"team",label:"Team",labelSource:"team"},{id:"inbox",label:"Inbox",labelSource:"inbox"},{id:"channel",label:"Kanaal",labelSource:"channel"},{id:"provider",label:"Provider",labelSource:"raw"},{id:"status",label:"Status",labelSource:"raw"},{id:"handledBy",label:"Afhandelaar",labelSource:"raw"},{id:"time",label:"Tijd",labelSource:"raw"}];function Oe(e){const t=[];for(const n of Object.keys(e))for(const i of Object.keys(e[n]))t.push({lang:n,key:i,value:e[n][i]});return t}function _(e){return e<10?`0${e}`:`${e}`}function F(e,t){const n=new Date(e),i=`${n.getUTCFullYear()}-${_(n.getUTCMonth()+1)}-${_(n.getUTCDate())}`;return t==="day"?i:`${i}T${_(n.getUTCHours())}`}function j(e,t){const n=new Date(e);return n.setUTCMinutes(0,0,0),t==="day"&&n.setUTCHours(0),n.getTime()}const Re=36e5,De=864e5;function Le(e,t,n){const i=n==="hour"?Re:De,a=[];for(let r=j(e,n);r<=t;r+=i)a.push(F(r,n));return a}const W=[{id:"resource",label:"Resource",labelSource:"raw"},{id:"origin",label:"Herkomst",labelSource:"raw"}],Y=W.map(e=>e.id);function z(e,t){return`${e}.usage.${t}`}function ke(e,t){return t.map(n=>({id:z(e,n.unit),label:n.label,category:"Verbruik",valueType:n.valueType??"count",aggregation:"sum",supportedDimensions:["provider",...Y,...n.extraDimensions??[],"time"]}))}function Ue(e){return(e.startsWith("tool:")?e.slice(5):e).replace(/__/g," · ").replace(/\./g," · ").replace(/_/g," ")}const $e=[{name:"text",type:"string"},{name:"subject",type:"string"},{name:"from",type:"string"},{name:"type",type:"string"},{name:"direction",type:"string"},{name:"channelId",type:"string"},{name:"interactionId",type:"string"},{name:"activityId",type:"string"},{name:"authorType",type:"string"},{name:"authorName",type:"string"},{name:"textRaw",type:"string"},{name:"fromStatus",type:"string"},{name:"toStatus",type:"string"},{name:"contactId",type:"string"},{name:"companyId",type:"string"}],xe={topics:[{name:"topic",type:"string"},{name:"confidence",type:"number"}],question:[{name:"answer",type:"boolean"},{name:"confidence",type:"number"}],extract:[]};function X(e){switch(e.kind){case"user":return`user:${e.userId}`;case"team":return`team:${e.teamId}`;case"org":return"org"}}function Pe(e){if(typeof e!="string")return;const t=e.trim();if(t==="org")return{kind:"org"};const n=t.indexOf(":");if(n<=0)return;const i=t.slice(0,n),a=t.slice(n+1).trim();if(a){if(i==="user")return{kind:"user",userId:a};if(i==="team")return{kind:"team",teamId:a}}}function q(e){return X(e)}function Ge(e){switch(e.kind){case"personal":return{kind:"user",userId:e.userId};case"team":return{kind:"team",teamId:e.teamId};case"org":return{kind:"org"}}}function Ke(e){return q(e)}const J=["done","escalated","failed","timed_out","stopped"],Q=["awaiting_approval","awaiting_reply"];function Z(e){return J.includes(e)}function we(e){return Z(e)}function Ve(e){return Q.includes(e)}const M=[{id:"openai",label:"OpenAI",capabilities:["chat","transcription","embedding"],defaultModel:"gpt-5-mini",baseUrl:"https://api.openai.com/v1"},{id:"gemini",label:"Google Gemini",capabilities:["chat","transcription","embedding"],defaultModel:"gemini-3.5-flash",baseUrl:"https://generativelanguage.googleapis.com/v1beta"},{id:"anthropic",label:"Anthropic",capabilities:["chat"],defaultModel:"claude-haiku-4-5",baseUrl:"https://api.anthropic.com/v1"},{id:"elevenlabs",label:"ElevenLabs",capabilities:["transcription"],baseUrl:"https://api.elevenlabs.io/v1"},{id:"moonshot",label:"Moonshot (Kimi)",capabilities:["chat"],defaultModel:"kimi-k3",baseUrl:"https://api.moonshot.ai/v1"},{id:"deepseek",label:"DeepSeek",capabilities:["chat"],defaultModel:"deepseek-v4-flash",baseUrl:"https://api.deepseek.com/v1"},{id:"groq",label:"Groq",capabilities:["chat"],defaultModel:"openai/gpt-oss-120b",baseUrl:"https://api.groq.com/openai/v1"},{id:"mistral",label:"Mistral",capabilities:["chat"],defaultModel:"mistral-large-latest",baseUrl:"https://api.mistral.ai/v1"},{id:"openrouter",label:"OpenRouter",capabilities:["chat"],defaultModel:"openrouter/auto",baseUrl:"https://openrouter.ai/api/v1"},{id:"ollama",label:"Ollama (self-hosted)",capabilities:["chat"],defaultModel:"llama3.3"},{id:"openai-compatible",label:"OpenAI-compatible (eigen endpoint)",capabilities:["chat"],defaultModel:"default"}];function y(e){return M.find(t=>t.id===e)}function Be(e){return y(e)?.label??e}function He(e,t="gpt-5-mini"){return y(e)?.defaultModel??t}function Fe(e){return M.filter(t=>t.capabilities.includes(e))}function je(e){const t=y(e);return!!t&&!t.baseUrl}const We=new Set(["mail","message"]);function ee(e,t){const n=e.settings?.signatures?.[t];return!n||!n.enabled||!n.body||n.body.trim()===""?null:n}function Ye(e,t,n,i="html"){if(!e)return n;const a=ee(e,t);return a?`${n}${i==="text"?`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=10,f=10,g=10,E=5,fe=new Set(["header","section","context","divider","image","list","actions","attachments"]);function b(e){if(typeof e=="string")return e.length>0;if(!e||typeof e!="object")return!1;const t=e;return typeof t.key=="string"||typeof t.value=="string"}function ge(e,t=()=>{}){if(!Array.isArray(e))return[];const n=[];for(const i of e){if(n.length>=S){t("more than "+S+" blocks; the rest was dropped");break}if(!i||typeof i!="object")continue;const a=i;if(!fe.has(a.type)){t("unknown block type "+String(a.type));continue}switch(a.type){case"header":if(!b(a.text)){t("a header without text");continue}break;case"context":if(!b(a.text)){t("a context block without text");continue}break;case"image":if(!a.url||!a.alt){t("an image without url or alt");continue}break;case"section":Array.isArray(a.fields)&&a.fields.length>f&&(t("more than "+f+" fields in a section"),a.fields=a.fields.slice(0,f));break;case"list":if(!Array.isArray(a.items)||a.items.length===0){t("a list without items");continue}a.items.length>g&&(t("more than "+g+" list items"),a.items=a.items.slice(0,g));break;case"actions":{const r=Array.isArray(a.elements)?a.elements:[],o=r.filter(l=>l&&l.action_id&&l.invoke&&b(l.text));if(o.length!==r.length&&t("an action without action_id, invoke or text"),o.length===0)continue;o.length>E&&t("more than "+E+" actions"),a.elements=o.slice(0,E);break}}n.push(a)}return n}function V(e){return e.replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<[^>]+>/g," ").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/\s+/g," ").trim()}function d(e){if(!e||e<0)return"";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${n.toString().padStart(2,"0")}`}function v(e){return e?` — ${Math.floor(e/60)}m ${e%60}s`:""}function T(e){return e?.split("@")?.[0]||e||""}function m(e){return e.map(t=>t.name).join(", ")}function R(e){return e==="meeting"?"Meeting":e==="video"?"Video call":"Audio call"}const c={VOICE_CALL_STARTED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek gestart",timeline:e=>e.direction==="inbound"?`Inbound call started — ${T(e.payload.from)}`:`Outbound call started — ${T(e.payload.to)}`},VOICE_CALL_ANSWERED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek aangenomen",timeline:(e,t)=>`Call answered — ${t}`},VOICE_CALL_HOLD:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"In de wacht",timeline:(e,t)=>`Call on hold — ${t}`},VOICE_CALL_UNHOLD:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Hervat"},VOICE_CALL_ENDED:{shape:"event",channelKind:"voice",icon:"phone",snippet:e=>`Gesprek beëindigd${e.payload.duration?` (${d(e.payload.duration)})`:""}`,timeline:e=>`Call ended${v(e.payload.duration)}`},VOICE_CALL_MISSED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gemiste oproep",timeline:e=>`Missed call — ${T(e.payload.from)}`},VOICE_CALL_FAILED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek mislukt",timeline:()=>"Call failed"},VOICE_CALL_VOICEMAIL:{shape:"artifact",channelKind:"voice",icon:"phone",snippet:e=>e.payload.transcription?.trim()?e.payload.transcription:"Voicemail ontvangen"},VIDEO_CALL_STARTED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gesprek gestart",timeline:()=>"Video call started"},VIDEO_CALL_ANSWERED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gesprek aangenomen",timeline:()=>"Video call answered"},VIDEO_CALL_HOLD:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"In de wacht"},VIDEO_CALL_UNHOLD:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Hervat"},VIDEO_CALL_ENDED:{shape:"event",channelKind:"video",icon:"video",snippet:e=>`Gesprek beëindigd${e.payload.duration?` (${d(e.payload.duration)})`:""}`,timeline:()=>"Video call ended"},VIDEO_CALL_MISSED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gemiste oproep",timeline:()=>"Missed video call"},VIDEO_CALL_FAILED:{shape:"event",channelKind:"video",icon:"video",snippet:()=>"Gesprek mislukt",timeline:()=>"Video call failed"},EMAIL_RECEIVED:{shape:"message",triggerable:!0,displayNameKey:"communication:activity.EMAIL_RECEIVED",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"inbound_message",snippet:O},EMAIL_SENT:{shape:"message",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:O},CHAT_MESSAGE_SENT:{shape:"message",component:"communication:ChatMessage",channelKind:"chat",icon:"message-circle",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:e=>e.payload.text??""},CHAT_MESSAGE_RECEIVED:{shape:"message",triggerable:!0,displayNameKey:"communication:activity.CHAT_MESSAGE_RECEIVED",component:"communication:ChatMessage",channelKind:"chat",icon:"message-circle",replyable:!0,carriesText:!0,countsAs:"inbound_message",snippet:e=>e.payload.text??""},CHAT_MEMBER_JOINED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`${m(e.payload.members)} toegevoegd`,timeline:e=>{const t=m(e.payload.members)||"Someone",n=e.payload.initiator?.name?` · added by ${e.payload.initiator.name}`:"";return`${t} joined the chat${n}`}},CHAT_MEMBER_LEFT:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`${m(e.payload.members)} verlaten`,timeline:e=>{const t=m(e.payload.members)||"Someone",n=e.payload.initiator?.name?` · removed by ${e.payload.initiator.name}`:"";return`${t} left the chat${n}`}},CHAT_RENAMED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`Hernoemd naar "${e.payload.newName}"`,timeline:e=>`Chat renamed to "${e.payload.newName}"${e.payload.initiator?` by ${e.payload.initiator.name}`:""}`},CHAT_CALL_STARTED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:()=>"Gesprek gestart",timeline:e=>`${R(e.payload.callType)} started${e.payload.initiator?` by ${e.payload.initiator.name}`:""}`,joinUrl:e=>e.payload.joinUrl},CHAT_CALL_ENDED:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>`Gesprek beëindigd${e.payload.duration?` (${d(e.payload.duration)})`:""}`,timeline:e=>`${R(e.payload.callType)} ended${v(e.payload.duration)}`,joinUrl:e=>e.payload.joinUrl},CHAT_EVENT:{shape:"event",channelKind:"chat",icon:"message-circle",snippet:e=>e.payload.text??e.payload.eventType,timeline:e=>e.payload.text||e.payload.eventType},TRANSCRIPT_ADDED:{shape:"artifact",triggerable:!0,displayNameKey:"communication:activity.TRANSCRIPT_ADDED",component:"communication:TranscriptionActivity",icon:"captions",carriesText:!0,snippet:e=>(e.payload.segments??[]).map(t=>t.text).join(" ")},COMMENT_ADDED:{shape:"note",component:"communication:CommentActivity",icon:"sticky-note",carriesText:!0,snippet:e=>e.payload.text??""},FILE_UPLOADED:{shape:"artifact",component:"communication:FileActivity",icon:"paperclip",snippet:e=>`Bestand: ${e.payload.fileName}`},AI_MESSAGE_ADDED:{shape:"event",triggerable:!0,displayNameKey:"communication:activity.AI_MESSAGE_ADDED",icon:"circle",snippet:e=>e.payload.output?.text??e.payload.input?.text??"",timeline:()=>"AI message added"},AI_ACTION_PROPOSED:{shape:"event",component:"communication:ProposedActionCard",icon:"circle",playbookAuthored:!0,snippet:e=>`Voorstel wacht op goedkeuring (${e.payload.actions?.length??0} actie(s))`},PLAYBOOK_STARTED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:e=>`Playbook gestart${e.payload.playbookName?`: ${e.payload.playbookName}`:""}`,timeline:e=>`Playbook gestart${e.payload.playbookName?` — ${e.payload.playbookName}`:""}`},PLAYBOOK_COMPLETED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:()=>"Playbook afgerond",timeline:()=>"Playbook afgerond"},PLAYBOOK_ESCALATED:{shape:"event",icon:"circle",playbookAuthored:!0,snippet:()=>"Playbook geëscaleerd naar een mens",timeline:()=>"Playbook geëscaleerd naar een mens"},MEETING_SCHEDULED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering gepland: ${e.payload.title}`,timeline:()=>"Meeting scheduled",joinUrl:e=>e.payload.joinUrl},MEETING_STARTED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering gestart: ${e.payload.title}`,timeline:()=>"Meeting started",joinUrl:e=>e.payload.joinUrl},MEETING_ENDED:{shape:"event",icon:"calendar",snippet:e=>`Vergadering beëindigd${e.payload.duration?` (${d(e.payload.duration)})`:""}`,timeline:()=>"Meeting ended"},MEETING_PARTICIPANT_JOINED:{shape:"event",icon:"calendar",snippet:e=>`${e.payload.name} deelgenomen`,timeline:(e,t)=>`${t} joined the meeting`},MEETING_PARTICIPANT_LEFT:{shape:"event",icon:"calendar",snippet:e=>`${e.payload.name} verlaten`,timeline:(e,t)=>`${t} left the meeting`},INTERACTION_CREATED:{shape:"event",icon:"circle",snippet:()=>"Interactie aangemaakt",timeline:(e,t)=>`Interaction started by ${t}`},INTERACTION_STATUS_CHANGED:{shape:"event",triggerable:!0,displayNameKey:"communication:activity.INTERACTION_STATUS_CHANGED",icon:"circle-dot",snippet:e=>`Status: ${e.payload.fromStatus} → ${e.payload.toStatus}`,timeline:(e,t)=>`Status changed to ${e.payload.toStatus} by ${t}`},INTERACTION_ASSIGNED:{shape:"event",icon:"user",snippet:()=>"Interactie toegewezen",timeline:(e,t)=>`Assigned by ${t}`}};function O(e){const t=e.payload,n=t.bodySnippet?.trim()||V(t.body??"");return t.subject?`${t.subject} — ${n}`:n}function s(e){return c[e]}function Ee(e){return s(e)?.icon??"circle"}function he(e){return s(e)?.channelKind}function Ae(e){const t=s(e)?.shape;return t==="message"||t==="note"}function ye(e){return s(e)?.replyable===!0}function _e(e){return s(e)?.carriesText===!0}function be(e){return s(e)?.countsAs}function Te(e){return s(e)?.playbookAuthored===!0}function H(e){const t=s(e.type)?.snippet;return t?t(e):""}function Ie(e,t){const n=s(e.type)?.timeline;return n?n(e,t):e.type.replace(/_/g," ").toLowerCase()}function Se(e){const t=s(e.type)?.joinUrl;return t?t(e):void 0}function A(e,t){let n=e;for(const i of t.split(".")){if(n==null||typeof n!="object")return"";n=n[i]}return n==null?"":typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"?String(n):""}function y(e,t,n){if(e===void 0)return null;if(typeof e=="string")return e||null;if("value"in e)return A(t,e.value)||null;const i={};for(const[r,o]of Object.entries(e.params??{}))i[r]=A(t,o);const a=n(e.key,i);return a===e.key?null:a}function B(e,t){if(!e||typeof e=="string"||"value"in e)return null;const n={};for(const[i,a]of Object.entries(e.params??{}))n[i]=A(t,a);return{key:e.key,params:n}}const Me=e=>e;function D(e){const t=c[e];return{type:e,shape:t.shape,channelKind:t.channelKind,icon:t.icon,replyable:t.replyable===!0,countsAs:t.countsAs,carriesText:t.carriesText===!0,triggerable:t.triggerable===!0,component:t.component,builtIn:!0,displayNameKey:t.displayNameKey}}function L(e){return{type:e.type,shape:e.shape,channelKind:e.channelKind,icon:e.icon||"circle",replyable:e.replyable===!0,countsAs:e.countsAs,carriesText:e.carriesText===!0,triggerable:e.triggerable===!0,component:e.component,builtIn:!1,displayNameKey:e.displayNameKey}}class j{constructor(t=[],n=Me){this.translate=n;for(const i of t)i?.type&&(i.type in c||this.declared.has(i.type)||this.declared.set(i.type,i))}declared=new Map;get(t){if(t in c)return D(t);const n=this.declared.get(t);return n?L(n):void 0}triggerable(){const t=Object.keys(c).filter(i=>c[i].triggerable).map(D),n=[...this.declared.values()].map(L).filter(i=>i.triggerable);return[...t,...n]}timelineText(t,n){const i=c[t.type];if(i?.timeline)return i.timeline(t,n);const a=this.declared.get(t.type);return y(a?.text,t,this.translate)??t.type.replace(/_/g," ").toLowerCase()}snippet(t){const n=c[t.type];if(n?.snippet)return n.snippet(t);const i=this.declared.get(t.type);return y(i?.text,t,this.translate)??""}descriptor(t){return this.declared.get(t)}blocks(t){const n=this.declared.get(t)?.render;return n?.length?n:void 0}get translator(){return this.translate}}const Ne=new j,k=140;function Ce(e){const t=e.trim();return t.length<=k?t:t.slice(0,k-1).trimEnd()+"…"}function ve(e,t){const n=B(t?.text,e),i=t?y(t.text,e,a=>a):null;return{activityId:e.id,type:e.type,snippet:Ce(i??H(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now(),...n?{snippetKey:n.key,snippetParams:n.params}:{}}}function Re(e,t,n=[]){const i=e.createdAt;if(!i)return[];const a=new Set(n);return e.author.type==="user"&&e.author.id&&a.add(e.author.id),Object.entries(t).filter(([r,o])=>o>=i&&!a.has(r)).map(([r])=>r)}function Oe(e){return e.createdAt??0}const De=[{id:"agent",label:"Agent",labelSource:"user"},{id:"team",label:"Team",labelSource:"team"},{id:"inbox",label:"Inbox",labelSource:"inbox"},{id:"channel",label:"Kanaal",labelSource:"channel"},{id:"provider",label:"Provider",labelSource:"raw"},{id:"status",label:"Status",labelSource:"raw"},{id:"handledBy",label:"Afhandelaar",labelSource:"raw"},{id:"time",label:"Tijd",labelSource:"raw"}];function Le(e){const t=[];for(const n of Object.keys(e))for(const i of Object.keys(e[n]))t.push({lang:n,key:i,value:e[n][i]});return t}function I(e){return e<10?`0${e}`:`${e}`}function F(e,t){const n=new Date(e),i=`${n.getUTCFullYear()}-${I(n.getUTCMonth()+1)}-${I(n.getUTCDate())}`;return t==="day"?i:`${i}T${I(n.getUTCHours())}`}function W(e,t){const n=new Date(e);return n.setUTCMinutes(0,0,0),t==="day"&&n.setUTCHours(0),n.getTime()}const ke=36e5,Ue=864e5;function xe(e,t,n){const i=n==="hour"?ke:Ue,a=[];for(let r=W(e,n);r<=t;r+=i)a.push(F(r,n));return a}const Y=[{id:"resource",label:"Resource",labelSource:"raw"},{id:"origin",label:"Herkomst",labelSource:"raw"}],X=Y.map(e=>e.id);function z(e,t){return`${e}.usage.${t}`}function $e(e,t){return t.map(n=>({id:z(e,n.unit),label:n.label,category:"Verbruik",valueType:n.valueType??"count",aggregation:"sum",supportedDimensions:["provider",...X,...n.extraDimensions??[],"time"]}))}function Pe(e){return(e.startsWith("tool:")?e.slice(5):e).replace(/__/g," · ").replace(/\./g," · ").replace(/_/g," ")}const Ke=[{name:"text",type:"string"},{name:"subject",type:"string"},{name:"from",type:"string"},{name:"type",type:"string"},{name:"direction",type:"string"},{name:"channelId",type:"string"},{name:"interactionId",type:"string"},{name:"activityId",type:"string"},{name:"authorType",type:"string"},{name:"authorName",type:"string"},{name:"textRaw",type:"string"},{name:"fromStatus",type:"string"},{name:"toStatus",type:"string"},{name:"contactId",type:"string"},{name:"companyId",type:"string"}],Ge={topics:[{name:"topic",type:"string"},{name:"confidence",type:"number"}],question:[{name:"answer",type:"boolean"},{name:"confidence",type:"number"}],extract:[]};function q(e){switch(e.kind){case"user":return`user:${e.userId}`;case"team":return`team:${e.teamId}`;case"org":return"org"}}function we(e){if(typeof e!="string")return;const t=e.trim();if(t==="org")return{kind:"org"};const n=t.indexOf(":");if(n<=0)return;const i=t.slice(0,n),a=t.slice(n+1).trim();if(a){if(i==="user")return{kind:"user",userId:a};if(i==="team")return{kind:"team",teamId:a}}}function J(e){return q(e)}function Ve(e){switch(e.kind){case"personal":return{kind:"user",userId:e.userId};case"team":return{kind:"team",teamId:e.teamId};case"org":return{kind:"org"}}}function He(e){return J(e)}const Q=["done","escalated","failed","timed_out","stopped"],Z=["awaiting_approval","awaiting_reply"];function ee(e){return Q.includes(e)}function Be(e){return ee(e)}function je(e){return Z.includes(e)}const N=[{id:"openai",attachmentKinds:["image","pdf"],label:"OpenAI",capabilities:["chat","transcription","embedding"],defaultModel:"gpt-5-mini",baseUrl:"https://api.openai.com/v1"},{id:"gemini",attachmentKinds:["image","pdf"],label:"Google Gemini",capabilities:["chat","transcription","embedding"],defaultModel:"gemini-3.5-flash",baseUrl:"https://generativelanguage.googleapis.com/v1beta"},{id:"anthropic",attachmentKinds:["image","pdf"],label:"Anthropic",capabilities:["chat"],defaultModel:"claude-haiku-4-5",baseUrl:"https://api.anthropic.com/v1"},{id:"elevenlabs",label:"ElevenLabs",capabilities:["transcription"],baseUrl:"https://api.elevenlabs.io/v1"},{id:"moonshot",label:"Moonshot (Kimi)",capabilities:["chat"],defaultModel:"kimi-k3",baseUrl:"https://api.moonshot.ai/v1"},{id:"deepseek",label:"DeepSeek",capabilities:["chat"],defaultModel:"deepseek-v4-flash",baseUrl:"https://api.deepseek.com/v1"},{id:"groq",label:"Groq",capabilities:["chat"],defaultModel:"openai/gpt-oss-120b",baseUrl:"https://api.groq.com/openai/v1"},{id:"mistral",label:"Mistral",capabilities:["chat"],defaultModel:"mistral-large-latest",baseUrl:"https://api.mistral.ai/v1"},{id:"openrouter",label:"OpenRouter",capabilities:["chat"],defaultModel:"openrouter/auto",baseUrl:"https://openrouter.ai/api/v1"},{id:"ollama",label:"Ollama (self-hosted)",capabilities:["chat"],defaultModel:"llama3.3"},{id:"openai-compatible",label:"OpenAI-compatible (eigen endpoint)",capabilities:["chat"],defaultModel:"default"}];function u(e){return N.find(t=>t.id===e)}function Fe(e){return u(e)?.label??e}function We(e,t="gpt-5-mini"){return u(e)?.defaultModel??t}function Ye(e){return N.filter(t=>t.capabilities.includes(e))}function Xe(e){const t=u(e);return!!t&&!t.baseUrl}function ze(e,t){return t==="text"?!0:u(e)?.attachmentKinds?.includes(t)===!0}const qe=new Set(["mail","message"]);function te(e,t){const n=e.settings?.signatures?.[t];return!n||!n.enabled||!n.body||n.body.trim()===""?null:n}function Je(e,t,n,i="html"){if(!e)return n;const a=te(e,t);return a?`${n}${i==="text"?`
2
2
 
3
- `:t==="mail"?"<br><br>-- <br>":"<br><br>"}${a.body}`:n}function ze(e){return e.endpoints??[]}const Xe=e=>!!e.assignedUserId||!!e.assignedInboxId,qe=e=>e.status==="closed",Je=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,Qe=(e,t=30)=>e.title?.length<=t?e.title:`${e.title.substring(0,t)}...`;function Ze(e,t){return e.lastActivityAt?!(e.seenBy??[]).includes(t):!1}const et=2e3,tt=500,nt=12e3,it=4e3,te=["contact","company"];function at(e){if(!e)return!1;const t=e.slice(0,e.indexOf(":"));return te.includes(t)}const A={NL:{callingCode:"31",trunkPrefix:"0",nsnMin:7,nsnMax:9},BE:{callingCode:"32",trunkPrefix:"0",nsnMin:8,nsnMax:9},LU:{callingCode:"352",nsnMin:6,nsnMax:9},DE:{callingCode:"49",trunkPrefix:"0",nsnMin:6,nsnMax:13},FR:{callingCode:"33",trunkPrefix:"0",nsnMin:9,nsnMax:9},GB:{callingCode:"44",trunkPrefix:"0",nsnMin:9,nsnMax:10},IE:{callingCode:"353",trunkPrefix:"0",nsnMin:7,nsnMax:9},ES:{callingCode:"34",nsnMin:9,nsnMax:9},PT:{callingCode:"351",nsnMin:9,nsnMax:9},IT:{callingCode:"39",nsnMin:6,nsnMax:11},AT:{callingCode:"43",trunkPrefix:"0",nsnMin:7,nsnMax:13},CH:{callingCode:"41",trunkPrefix:"0",nsnMin:9,nsnMax:9},DK:{callingCode:"45",nsnMin:8,nsnMax:8},SE:{callingCode:"46",trunkPrefix:"0",nsnMin:7,nsnMax:13},NO:{callingCode:"47",nsnMin:8,nsnMax:8},FI:{callingCode:"358",trunkPrefix:"0",nsnMin:5,nsnMax:12},PL:{callingCode:"48",nsnMin:9,nsnMax:9},US:{callingCode:"1",nsnMin:10,nsnMax:10},CA:{callingCode:"1",nsnMin:10,nsnMax:10}},ne="NL",rt=15,ot=8,st=Array.from(new Set(Object.values(A).map(e=>e.callingCode))).sort((e,t)=>t.length-e.length);function k(e){if(e)return A[e.trim().toUpperCase()]}function g(e,t){return e.length>=t.nsnMin&&e.length<=t.nsnMax}function U(e){if(e.length>rt)return null;for(const t of st){if(!e.startsWith(t))continue;const n=e.slice(t.length);for(const i of Object.values(A)){if(i.callingCode!==t)continue;const a=i.trunkPrefix,r=a&&n.startsWith(a)?n.slice(a.length):n;if(g(r,i))return`+${t}${r}`}return null}return e.length<ot?null:`+${e}`}function lt(e){let t=e.trim();const n=t.match(/^(sips?|tel|whatsapp):/i);n&&(t=t.slice(n[0].length));const i=t.indexOf("@");return i>=0&&(t=t.slice(0,i)),t.trim()}function ct(e){if(!e)return!1;const t=e.indexOf("@");if(t<=0)return!1;const n=e.slice(0,t).trim();return!/^[+\d\s().-]+$/.test(n)}function T(e,t){if(!e)return null;const n=lt(e);if(!n)return null;const i=n.startsWith("+"),a=n.replace(/\D/g,"");if(!a)return null;if(i)return U(a);if(a.startsWith("00"))return U(a.slice(2));const r=k(t)??k(ne);if(!r)return null;const o=r.trunkPrefix;if(o&&a.startsWith(o)){const l=a.slice(o.length);return g(l,r)?`+${r.callingCode}${l}`:null}if(a.startsWith(r.callingCode)){const l=a.slice(r.callingCode.length);if(g(l,r))return`+${r.callingCode}${l}`}return!o&&g(a,r)?`+${r.callingCode}${a}`:null}function pt(e,t=9){const n=(e??"").replace(/\D/g,"");return n.length<t?null:n.slice(-t)}function N(e){if(!e)return null;const t=e.trim().toLowerCase(),n=t.lastIndexOf("@");if(n<=0||n===t.length-1)return null;const i=t.slice(0,n).split("+")[0],a=t.slice(n+1);return!i||!a.includes(".")?null:`${i}@${a}`}function ut(e){const t=N(e);return t?t.slice(t.lastIndexOf("@")+1):null}const dt=new Set(["co.uk","org.uk","gov.uk","ac.uk","com.au","co.nz","com.br","co.za"]);function ie(e){if(!e)return null;const t=e.trim().toLowerCase().replace(/\.$/,"").split(".").filter(Boolean);if(t.length<2)return null;const n=t.slice(-2).join(".");return dt.has(n)&&t.length>=3?t.slice(-3).join("."):n}const ae=new Set(["gmail.com","googlemail.com","outlook.com","hotmail.com","hotmail.nl","hotmail.be","hotmail.co.uk","live.com","live.nl","live.be","msn.com","yahoo.com","yahoo.co.uk","ymail.com","icloud.com","me.com","mac.com","aol.com","gmx.net","gmx.de","web.de","protonmail.com","proton.me","pm.me","tutanota.com","zoho.com","mail.com","ziggo.nl","kpnmail.nl","planet.nl","home.nl","casema.nl","chello.nl","xs4all.nl","telfort.nl","hetnet.nl","zonnet.nl","upcmail.nl","quicknet.nl","telenet.be","skynet.be","proximus.be","scarlet.be"]);function mt(e){const t=ie(e);return t?ae.has(t):!1}function ft(e){if(!e)return!1;const t=e.trim().toLowerCase();return t==="tel"||t==="sms"||t==="whatsapp"||t==="fax"}function gt(e,t,n){if(!e||!t)return null;const i=e.trim().toLowerCase();if(i==="tel"||i==="sms"||i==="whatsapp"){const r=T(t,n);return r?`tel:${r}`:null}if(i==="fax"){const r=T(t,n);return r?`fax:${r}`:null}if(i==="mailto"||i==="email"){const r=N(t);return r?`mailto:${r}`:null}const a=t.trim().toLowerCase();return a?`${i}:${a}`:null}const Et=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,ht=/(\*|_)(?=\S)([^*_\n]*?\S)\1/g;function yt(e){if(typeof e!="string"||!e)return"";let t=e;return t=t.replace(/```[a-z]*\n?/gi,"").replace(/~~~[a-z]*\n?/gi,""),t=t.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1"),t=t.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1"),t=t.replace(/\[([^\]]*)\]\[[^\]]*\]/g,"$1"),t=t.replace(/<((?:https?|mailto):[^>\s]+)>/gi,"$1"),t=t.split(`
3
+ `:t==="mail"?"<br><br>-- <br>":"<br><br>"}${a.body}`:n}function Qe(e){return e.endpoints??[]}const Ze=e=>!!e.assignedUserId||!!e.assignedInboxId,et=e=>e.status==="closed",tt=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,nt=(e,t=30)=>e.title?.length<=t?e.title:`${e.title.substring(0,t)}...`;function it(e,t){return e.lastActivityAt?!(e.seenBy??[]).includes(t):!1}const at=2e3,rt=500,ot=12e3,st=4e3,ne=["contact","company"];function lt(e){if(!e)return!1;const t=e.slice(0,e.indexOf(":"));return ne.includes(t)}const _={NL:{callingCode:"31",trunkPrefix:"0",nsnMin:7,nsnMax:9},BE:{callingCode:"32",trunkPrefix:"0",nsnMin:8,nsnMax:9},LU:{callingCode:"352",nsnMin:6,nsnMax:9},DE:{callingCode:"49",trunkPrefix:"0",nsnMin:6,nsnMax:13},FR:{callingCode:"33",trunkPrefix:"0",nsnMin:9,nsnMax:9},GB:{callingCode:"44",trunkPrefix:"0",nsnMin:9,nsnMax:10},IE:{callingCode:"353",trunkPrefix:"0",nsnMin:7,nsnMax:9},ES:{callingCode:"34",nsnMin:9,nsnMax:9},PT:{callingCode:"351",nsnMin:9,nsnMax:9},IT:{callingCode:"39",nsnMin:6,nsnMax:11},AT:{callingCode:"43",trunkPrefix:"0",nsnMin:7,nsnMax:13},CH:{callingCode:"41",trunkPrefix:"0",nsnMin:9,nsnMax:9},DK:{callingCode:"45",nsnMin:8,nsnMax:8},SE:{callingCode:"46",trunkPrefix:"0",nsnMin:7,nsnMax:13},NO:{callingCode:"47",nsnMin:8,nsnMax:8},FI:{callingCode:"358",trunkPrefix:"0",nsnMin:5,nsnMax:12},PL:{callingCode:"48",nsnMin:9,nsnMax:9},US:{callingCode:"1",nsnMin:10,nsnMax:10},CA:{callingCode:"1",nsnMin:10,nsnMax:10}},ie="NL",ct=15,pt=8,ut=Array.from(new Set(Object.values(_).map(e=>e.callingCode))).sort((e,t)=>t.length-e.length);function U(e){if(e)return _[e.trim().toUpperCase()]}function h(e,t){return e.length>=t.nsnMin&&e.length<=t.nsnMax}function x(e){if(e.length>ct)return null;for(const t of ut){if(!e.startsWith(t))continue;const n=e.slice(t.length);for(const i of Object.values(_)){if(i.callingCode!==t)continue;const a=i.trunkPrefix,r=a&&n.startsWith(a)?n.slice(a.length):n;if(h(r,i))return`+${t}${r}`}return null}return e.length<pt?null:`+${e}`}function dt(e){let t=e.trim();const n=t.match(/^(sips?|tel|whatsapp):/i);n&&(t=t.slice(n[0].length));const i=t.indexOf("@");return i>=0&&(t=t.slice(0,i)),t.trim()}function mt(e){if(!e)return!1;const t=e.indexOf("@");if(t<=0)return!1;const n=e.slice(0,t).trim();return!/^[+\d\s().-]+$/.test(n)}function M(e,t){if(!e)return null;const n=dt(e);if(!n)return null;const i=n.startsWith("+"),a=n.replace(/\D/g,"");if(!a)return null;if(i)return x(a);if(a.startsWith("00"))return x(a.slice(2));const r=U(t)??U(ie);if(!r)return null;const o=r.trunkPrefix;if(o&&a.startsWith(o)){const l=a.slice(o.length);return h(l,r)?`+${r.callingCode}${l}`:null}if(a.startsWith(r.callingCode)){const l=a.slice(r.callingCode.length);if(h(l,r))return`+${r.callingCode}${l}`}return!o&&h(a,r)?`+${r.callingCode}${a}`:null}function ft(e,t=9){const n=(e??"").replace(/\D/g,"");return n.length<t?null:n.slice(-t)}function C(e){if(!e)return null;const t=e.trim().toLowerCase(),n=t.lastIndexOf("@");if(n<=0||n===t.length-1)return null;const i=t.slice(0,n).split("+")[0],a=t.slice(n+1);return!i||!a.includes(".")?null:`${i}@${a}`}function gt(e){const t=C(e);return t?t.slice(t.lastIndexOf("@")+1):null}const Et=new Set(["co.uk","org.uk","gov.uk","ac.uk","com.au","co.nz","com.br","co.za"]);function ae(e){if(!e)return null;const t=e.trim().toLowerCase().replace(/\.$/,"").split(".").filter(Boolean);if(t.length<2)return null;const n=t.slice(-2).join(".");return Et.has(n)&&t.length>=3?t.slice(-3).join("."):n}const re=new Set(["gmail.com","googlemail.com","outlook.com","hotmail.com","hotmail.nl","hotmail.be","hotmail.co.uk","live.com","live.nl","live.be","msn.com","yahoo.com","yahoo.co.uk","ymail.com","icloud.com","me.com","mac.com","aol.com","gmx.net","gmx.de","web.de","protonmail.com","proton.me","pm.me","tutanota.com","zoho.com","mail.com","ziggo.nl","kpnmail.nl","planet.nl","home.nl","casema.nl","chello.nl","xs4all.nl","telfort.nl","hetnet.nl","zonnet.nl","upcmail.nl","quicknet.nl","telenet.be","skynet.be","proximus.be","scarlet.be"]);function ht(e){const t=ae(e);return t?re.has(t):!1}function At(e){if(!e)return!1;const t=e.trim().toLowerCase();return t==="tel"||t==="sms"||t==="whatsapp"||t==="fax"}function yt(e,t,n){if(!e||!t)return null;const i=e.trim().toLowerCase();if(i==="tel"||i==="sms"||i==="whatsapp"){const r=M(t,n);return r?`tel:${r}`:null}if(i==="fax"){const r=M(t,n);return r?`fax:${r}`:null}if(i==="mailto"||i==="email"){const r=C(t);return r?`mailto:${r}`:null}const a=t.trim().toLowerCase();return a?`${i}:${a}`:null}const _t=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,bt=/(\*|_)(?=\S)([^*_\n]*?\S)\1/g;function Tt(e){if(typeof e!="string"||!e)return"";let t=e;return t=t.replace(/```[a-z]*\n?/gi,"").replace(/~~~[a-z]*\n?/gi,""),t=t.replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1"),t=t.replace(/\[([^\]]*)\]\([^)]*\)/g,"$1"),t=t.replace(/\[([^\]]*)\]\[[^\]]*\]/g,"$1"),t=t.replace(/<((?:https?|mailto):[^>\s]+)>/gi,"$1"),t=t.split(`
4
4
  `).map(n=>n.replace(/^\s{0,3}#{1,6}\s+/,"").replace(/^\s{0,3}>\s?/,"").replace(/^\s*[-*+]\s+/,"").replace(/^\s*\d+[.)]\s+/,"").replace(/^\s*(?:[-*_]\s*){3,}$/,"")).join(`
5
- `),t=t.replace(Et,"$2"),t=t.replace(ht,"$2"),t=t.replace(/~~(?=\S)([\s\S]*?\S)~~/g,"$1"),t=t.replace(/`([^`\n]+)`/g,"$1"),t.replace(/\s+/g," ").trim()}const At=[/<blockquote/i,/class="?gmail_quote/i,/id="?[^"]*divRplyFwdMsg/i,/id="?[^"]*mail-editor-reference-message-container/i,/-{3,}\s*Original Message\s*-{3,}/i,/\n_{5,}\s*\n/,/\bOn\b[\s\S]{0,200}?\bwrote:/i],$=/^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i,bt=/^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;function It(e){const t=e.split(`
6
- `);for(let n=0;n<t.length;n++)if(bt.test(t[n])||$.test(t[n])&&t.slice(n+1,n+4).some(i=>$.test(i)))return t.slice(0,n).join(`
7
- `).trim();return e}function x(e){let t=e;return t=t.replace(/<(script|style)[\s\S]*?<\/\1>/gi,""),t=t.replace(/<br\s*\/?>/gi,`
5
+ `),t=t.replace(_t,"$2"),t=t.replace(bt,"$2"),t=t.replace(/~~(?=\S)([\s\S]*?\S)~~/g,"$1"),t=t.replace(/`([^`\n]+)`/g,"$1"),t.replace(/\s+/g," ").trim()}const It=[/<blockquote/i,/class="?gmail_quote/i,/id="?[^"]*divRplyFwdMsg/i,/id="?[^"]*mail-editor-reference-message-container/i,/-{3,}\s*Original Message\s*-{3,}/i,/\n_{5,}\s*\n/,/\bOn\b[\s\S]{0,200}?\bwrote:/i],$=/^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i,St=/^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;function Mt(e){const t=e.split(`
6
+ `);for(let n=0;n<t.length;n++)if(St.test(t[n])||$.test(t[n])&&t.slice(n+1,n+4).some(i=>$.test(i)))return t.slice(0,n).join(`
7
+ `).trim();return e}function P(e){let t=e;return t=t.replace(/<(script|style)[\s\S]*?<\/\1>/gi,""),t=t.replace(/<br\s*\/?>/gi,`
8
8
  `),t=t.replace(/<\/(p|div|li|tr|h[1-6]|ul|ol|table)>/gi,`
9
- `),t=t.replace(/<[^>]+>/g,""),t=t.replace(/<[^>]*$/,""),t}function P(e){return!Number.isInteger(e)||e<0||e>1114111?null:String.fromCodePoint(e)}function G(e){return e.replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#(\d+);/g,(t,n)=>P(Number(n))??t).replace(/&#x([0-9a-f]+);/gi,(t,n)=>P(parseInt(n,16))??t).replace(/&amp;/gi,"&")}function K(e){return e.replace(/\r/g,"").replace(/[ \t]+/g," ").replace(/ *\n */g,`
9
+ `),t=t.replace(/<[^>]+>/g,""),t=t.replace(/<[^>]*$/,""),t}function K(e){return!Number.isInteger(e)||e<0||e>1114111?null:String.fromCodePoint(e)}function G(e){return e.replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#(\d+);/g,(t,n)=>K(Number(n))??t).replace(/&#x([0-9a-f]+);/gi,(t,n)=>K(parseInt(n,16))??t).replace(/&amp;/gi,"&")}function w(e){return e.replace(/\r/g,"").replace(/[ \t]+/g," ").replace(/ *\n */g,`
10
10
  `).replace(/\n{3,}/g,`
11
11
 
12
- `).trim()}function _t(e){if(typeof e!="string"||!e)return"";let t=e.length;for(const r of At){const o=e.search(r);o>=0&&o<t&&(t=o)}const n=e.slice(0,t);let i=K(G(x(n)));return i||(i=K(G(x(e)))),It(i)||i}const St=/(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i,Tt=/\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;function Mt(e,t){return!!(e&&St.test(e)||t&&Tt.test(t))}const re=3,oe=600;function Nt(e,t){return e>=re||t>=oe}function se(e,t){const n=new Set(e.disabledIntents??[]),i=e.intentOverrides??{},a=t.intents.filter(o=>!n.has(o.intent)).map(o=>vt(o,i[o.intent]));if(!e.extraIntents||e.extraIntents.length===0)return a;const r=new Set(a.map(o=>o.intent));for(const o of e.extraIntents)r.has(o.intent)||(a.push(o),r.add(o.intent));return a}function le(e,t){const n={};for(const i of e.intents){if(!i.togglable)continue;const a=t?.[i.intent];n[i.intent]=a??i.defaultEnabled??!0}return n}function Ct(e,t){const n=le(e,t);return Object.entries(n).filter(([,i])=>!i).map(([i])=>i)}function vt(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function Ot(e,t){const n=[];for(const i of e){if(!i.enabled)continue;const a=t[i.providerId];if(a)for(const r of se(i,a))n.push({channel:i,description:a,capability:r})}return n}function Rt(e,t){return t.filter(n=>n.capability.intent===e)}function ce(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function Dt(e,t){return ce(e.scheme,t)}function Lt(e,t,n){const i=[];for(const a of e)for(const r of n)r.capability.intent===t&&r.capability.targetSchemes.includes(a.scheme)&&i.push({channelIntent:r,endpoint:a});return i}var pe=(e=>(e.MAILTO="mailto",e.SIP="sip",e.TEL="tel",e.WEBHOOK="webhook",e.USERNAME="username",e.ID="id",e.CUSTOM="custom",e.URL="url",e.TELEGRAM="telegram",e.WHATSAPP="whatsapp",e.MESSENGER="messenger",e.INSTAGRAM="instagram",e.VIBER="viber",e.SMS="sms",e.FAX="fax",e.TEAMS="teams",e.CALENDAR="calendar",e))(pe||{});const kt={mailto:"mail",sip:"tel",tel:"tel",fax:"tel",sms:"chat",teams:"chat",telegram:"chat",messenger:"chat",instagram:"chat",viber:"chat",whatsapp:"wa",webhook:"note",url:"note",calendar:"note",username:"note",id:"note",custom:"note"};function Ut(e){return e?kt[e]??"note":"note"}const $t="message_window",xt="message_templates",Pt={FROM:"from",TO:"to",CC:"cc",BCC:"bcc",ORGANIZER:"organizer",PRESENTER:"presenter",ATTENDEE:"attendee",OWNER:"owner",MEMBER:"member",GUEST:"guest",HOST:"host",PARTICIPANT:"participant"},Gt=(e,t)=>({intent:e,...t}),Kt="folder_management",wt="remote_search",Vt={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"},Bt=9e4,Ht="installation-id";exports.ACTIVITY_CATALOG=c;exports.AI_VENDORS=M;exports.ActivityTypeRegistry=H;exports.BUILT_IN_ONLY=Se;exports.CLASSIFY_VARS=xe;exports.CORE_DIMENSIONS=ve;exports.CommunicationScheme=pe;exports.DEFAULT_MEMORY_BUDGET=it;exports.DEFAULT_PHONE_REGION=ne;exports.FEATURE_FOLDER_MANAGEMENT=Kt;exports.FEATURE_REMOTE_SEARCH=wt;exports.INSTALLATION_HEADER=Ht;exports.InteractionParticipantRole=Pt;exports.MAX_ACTIONS=f;exports.MAX_BLOCKS=S;exports.MAX_FIELDS=d;exports.MAX_LIST_ITEMS=m;exports.MAX_MEMORY_BUDGET=nt;exports.MAX_MEMORY_CHARS=et;exports.MIN_MEMORY_BUDGET=tt;exports.PAUSED_RUN_STATUSES=Q;exports.PHONE_REGIONS=A;exports.PRESENCE_ONLINE_WINDOW_MS=Bt;exports.PROVIDER_FEATURE_MESSAGE_TEMPLATES=xt;exports.PROVIDER_FEATURE_MESSAGE_WINDOW=$t;exports.PUBLIC_EMAIL_DOMAINS=ae;exports.RELATED_SUBJECT_KINDS=te;exports.SIGNATURE_INTENTS=We;exports.SUMMARY_MIN_LAST_CHARS=oe;exports.SUMMARY_MIN_MESSAGES=re;exports.TERMINAL_RUN_STATUSES=J;exports.TRIGGER_VARS=$e;exports.UNSUPPORTED=Vt;exports.USAGE_DIMENSIONS=W;exports.USAGE_DIMENSION_IDS=Y;exports.actingIdentityKey=q;exports.activityIconOf=me;exports.activityJoinUrl=Ie;exports.activitySnippet=V;exports.activityTextParams=B;exports.activityTimelineText=be;exports.activityTimestamp=Ce;exports.activityTypeInfo=s;exports.actorKey=Ke;exports.aiVendorDefaultModel=He;exports.aiVendorLabel=Be;exports.aiVendorNeedsBaseUrl=je;exports.aiVendorsWith=Fe;exports.applySignature=Ye;exports.buildActivityPreview=Me;exports.buildChannelIntents=Ot;exports.carriesText=he;exports.channelKindForScheme=Ut;exports.channelKindOf=fe;exports.cleanMessageText=_t;exports.defineIntent=Gt;exports.disabledIntentsFromCapabilities=Ct;exports.emailDomain=ut;exports.endpointKey=gt;exports.filterByEndpoint=Dt;exports.filterByIntent=Rt;exports.filterByTargetScheme=ce;exports.findAiVendor=y;exports.flattenLocales=Oe;exports.floorToPeriod=j;exports.formatActingIdentity=X;exports.formatPeriod=F;exports.getActivitySeenUserIds=Ne;exports.getContactEndpoints=ze;exports.getShortTitle=Qe;exports.getUrgencyScore=Je;exports.humanizeAction=Ue;exports.isAssigned=Xe;exports.isClosed=qe;exports.isInteractionUnseen=Ze;exports.isLikelyBulk=Mt;exports.isMessageType=ge;exports.isPaused=Ve;exports.isPlaybookAuthoredType=Ae;exports.isPublicEmailDomain=mt;exports.isReplyableType=Ee;exports.isRetryable=we;exports.isTerminal=Z;exports.isThreadLongEnough=Nt;exports.looksLikeEmail=ct;exports.matchContactToIntents=Lt;exports.messageCountsAs=ye;exports.needsPhoneRegion=ft;exports.normalizeBlocks=de;exports.normalizeEmail=N;exports.parseActingIdentity=Pe;exports.periodsInRange=Le;exports.phoneSuffix=pt;exports.plainTextFromMarkdown=yt;exports.playbookActor=Ge;exports.readPath=E;exports.registrableDomain=ie;exports.relatedByDefault=at;exports.resolveAccountCapabilities=le;exports.resolveActivityText=h;exports.resolveChannelIntents=se;exports.resolveSignature=ee;exports.stripHtml=w;exports.toE164=T;exports.usageMetricId=z;exports.usageMetrics=ke;
12
+ `).trim()}function Nt(e){if(typeof e!="string"||!e)return"";let t=e.length;for(const r of It){const o=e.search(r);o>=0&&o<t&&(t=o)}const n=e.slice(0,t);let i=w(G(P(n)));return i||(i=w(G(P(e)))),Mt(i)||i}const Ct=/(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i,vt=/\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;function Rt(e,t){return!!(e&&Ct.test(e)||t&&vt.test(t))}const oe=3,se=600;function Ot(e,t){return e>=oe||t>=se}const Dt=new Set(["image/png","image/jpeg","image/jpg","image/gif","image/webp"]),Lt=new Set(["text/plain","text/markdown","text/csv","application/json","text/html","application/xml","text/xml"]);function le(e){const t=(e??"").trim().toLowerCase().split(";")[0];return t?Dt.has(t)?"image":t==="application/pdf"?"pdf":Lt.has(t)?"text":t.startsWith("audio/")?"audio":"unsupported":"unsupported"}const p=1024*1024,ce={image:5*p,pdf:20*p,text:1*p,audio:20*p},kt=25*p,Ut=5;function xt(e,t){const n=le(e);return n==="unsupported"?"unsupported":t>ce[n]?"too-large":null}function pe(e,t){const n=new Set(e.disabledIntents??[]),i=e.intentOverrides??{},a=t.intents.filter(o=>!n.has(o.intent)).map(o=>Pt(o,i[o.intent]));if(!e.extraIntents||e.extraIntents.length===0)return a;const r=new Set(a.map(o=>o.intent));for(const o of e.extraIntents)r.has(o.intent)||(a.push(o),r.add(o.intent));return a}function ue(e,t){const n={};for(const i of e.intents){if(!i.togglable)continue;const a=t?.[i.intent];n[i.intent]=a??i.defaultEnabled??!0}return n}function $t(e,t){const n=ue(e,t);return Object.entries(n).filter(([,i])=>!i).map(([i])=>i)}function Pt(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function Kt(e,t){const n=[];for(const i of e){if(!i.enabled)continue;const a=t[i.providerId];if(a)for(const r of pe(i,a))n.push({channel:i,description:a,capability:r})}return n}function Gt(e,t){return t.filter(n=>n.capability.intent===e)}function de(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function wt(e,t){return de(e.scheme,t)}function Vt(e,t,n){const i=[];for(const a of e)for(const r of n)r.capability.intent===t&&r.capability.targetSchemes.includes(a.scheme)&&i.push({channelIntent:r,endpoint:a});return i}var me=(e=>(e.MAILTO="mailto",e.SIP="sip",e.TEL="tel",e.WEBHOOK="webhook",e.USERNAME="username",e.ID="id",e.CUSTOM="custom",e.URL="url",e.TELEGRAM="telegram",e.WHATSAPP="whatsapp",e.MESSENGER="messenger",e.INSTAGRAM="instagram",e.VIBER="viber",e.SMS="sms",e.FAX="fax",e.TEAMS="teams",e.CALENDAR="calendar",e))(me||{});const Ht={mailto:"mail",sip:"tel",tel:"tel",fax:"tel",sms:"chat",teams:"chat",telegram:"chat",messenger:"chat",instagram:"chat",viber:"chat",whatsapp:"wa",webhook:"note",url:"note",calendar:"note",username:"note",id:"note",custom:"note"};function Bt(e){return e?Ht[e]??"note":"note"}const jt="message_window",Ft="message_templates",Wt={FROM:"from",TO:"to",CC:"cc",BCC:"bcc",ORGANIZER:"organizer",PRESENTER:"presenter",ATTENDEE:"attendee",OWNER:"owner",MEMBER:"member",GUEST:"guest",HOST:"host",PARTICIPANT:"participant"},Yt=(e,t)=>({intent:e,...t}),Xt="folder_management",zt="remote_search",qt={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"},Jt=9e4,Qt="installation-id";exports.ACTIVITY_CATALOG=c;exports.AI_ATTACHMENT_LIMITS=ce;exports.AI_ATTACHMENT_MAX_PER_TURN=Ut;exports.AI_ATTACHMENT_TURN_BUDGET=kt;exports.AI_VENDORS=N;exports.ActivityTypeRegistry=j;exports.BUILT_IN_ONLY=Ne;exports.CLASSIFY_VARS=Ge;exports.CORE_DIMENSIONS=De;exports.CommunicationScheme=me;exports.DEFAULT_MEMORY_BUDGET=st;exports.DEFAULT_PHONE_REGION=ie;exports.FEATURE_FOLDER_MANAGEMENT=Xt;exports.FEATURE_REMOTE_SEARCH=zt;exports.INSTALLATION_HEADER=Qt;exports.InteractionParticipantRole=Wt;exports.MAX_ACTIONS=E;exports.MAX_BLOCKS=S;exports.MAX_FIELDS=f;exports.MAX_LIST_ITEMS=g;exports.MAX_MEMORY_BUDGET=ot;exports.MAX_MEMORY_CHARS=at;exports.MIN_MEMORY_BUDGET=rt;exports.PAUSED_RUN_STATUSES=Z;exports.PHONE_REGIONS=_;exports.PRESENCE_ONLINE_WINDOW_MS=Jt;exports.PROVIDER_FEATURE_MESSAGE_TEMPLATES=Ft;exports.PROVIDER_FEATURE_MESSAGE_WINDOW=jt;exports.PUBLIC_EMAIL_DOMAINS=re;exports.RELATED_SUBJECT_KINDS=ne;exports.SIGNATURE_INTENTS=qe;exports.SUMMARY_MIN_LAST_CHARS=se;exports.SUMMARY_MIN_MESSAGES=oe;exports.TERMINAL_RUN_STATUSES=Q;exports.TRIGGER_VARS=Ke;exports.UNSUPPORTED=qt;exports.USAGE_DIMENSIONS=Y;exports.USAGE_DIMENSION_IDS=X;exports.actingIdentityKey=J;exports.activityIconOf=Ee;exports.activityJoinUrl=Se;exports.activitySnippet=H;exports.activityTextParams=B;exports.activityTimelineText=Ie;exports.activityTimestamp=Oe;exports.activityTypeInfo=s;exports.actorKey=He;exports.aiAttachmentKind=le;exports.aiAttachmentRejection=xt;exports.aiVendorAcceptsAttachment=ze;exports.aiVendorDefaultModel=We;exports.aiVendorLabel=Fe;exports.aiVendorNeedsBaseUrl=Xe;exports.aiVendorsWith=Ye;exports.applySignature=Je;exports.buildActivityPreview=ve;exports.buildChannelIntents=Kt;exports.carriesText=_e;exports.channelKindForScheme=Bt;exports.channelKindOf=he;exports.cleanMessageText=Nt;exports.defineIntent=Yt;exports.disabledIntentsFromCapabilities=$t;exports.emailDomain=gt;exports.endpointKey=yt;exports.filterByEndpoint=wt;exports.filterByIntent=Gt;exports.filterByTargetScheme=de;exports.findAiVendor=u;exports.flattenLocales=Le;exports.floorToPeriod=W;exports.formatActingIdentity=q;exports.formatPeriod=F;exports.getActivitySeenUserIds=Re;exports.getContactEndpoints=Qe;exports.getShortTitle=nt;exports.getUrgencyScore=tt;exports.humanizeAction=Pe;exports.isAssigned=Ze;exports.isClosed=et;exports.isInteractionUnseen=it;exports.isLikelyBulk=Rt;exports.isMessageType=Ae;exports.isPaused=je;exports.isPlaybookAuthoredType=Te;exports.isPublicEmailDomain=ht;exports.isReplyableType=ye;exports.isRetryable=Be;exports.isTerminal=ee;exports.isThreadLongEnough=Ot;exports.looksLikeEmail=mt;exports.matchContactToIntents=Vt;exports.messageCountsAs=be;exports.needsPhoneRegion=At;exports.normalizeBlocks=ge;exports.normalizeEmail=C;exports.parseActingIdentity=we;exports.periodsInRange=xe;exports.phoneSuffix=ft;exports.plainTextFromMarkdown=Tt;exports.playbookActor=Ve;exports.readPath=A;exports.registrableDomain=ae;exports.relatedByDefault=lt;exports.resolveAccountCapabilities=ue;exports.resolveActivityText=y;exports.resolveChannelIntents=pe;exports.resolveSignature=te;exports.stripHtml=V;exports.toE164=M;exports.usageMetricId=z;exports.usageMetrics=$e;
package/dist/index.d.ts CHANGED
@@ -35,6 +35,7 @@ export * from './text/endpoint';
35
35
  export * from './text/markdown';
36
36
  export * from './text/message';
37
37
  export * from './text/triage';
38
+ export * from './platform/ai-attachments';
38
39
  export * from './platform/ai-tools';
39
40
  export * from './platform/api';
40
41
  export * from './platform/author';