@opencxh/domain 1.142.0 → 1.144.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.
- package/dist/index.cjs +6 -6
- package/dist/index.js +27 -21
- package/dist/platform/routing.d.ts +27 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=10,_=10,T=10,b=5,We=new Set(["header","section","context","divider","image","list","actions","attachments"]);function L(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 Xe(e,t=()=>{}){if(!Array.isArray(e))return[];const n=[];for(const a of e){if(n.length>=x){t("more than "+x+" blocks; the rest was dropped");break}if(!a||typeof a!="object")continue;const i=a;if(!We.has(i.type)){t("unknown block type "+String(i.type));continue}switch(i.type){case"header":if(!L(i.text)){t("a header without text");continue}break;case"context":if(!L(i.text)){t("a context block without text");continue}break;case"image":if(!i.url||!i.alt){t("an image without url or alt");continue}break;case"section":Array.isArray(i.fields)&&i.fields.length>_&&(t("more than "+_+" fields in a section"),i.fields=i.fields.slice(0,_));break;case"list":if(!Array.isArray(i.items)||i.items.length===0){t("a list without items");continue}i.items.length>T&&(t("more than "+T+" list items"),i.items=i.items.slice(0,T));break;case"actions":{const r=Array.isArray(i.elements)?i.elements:[],o=r.filter(s=>s&&s.action_id&&s.invoke&&L(s.text));if(o.length!==r.length&&t("an action without action_id, invoke or text"),o.length===0)continue;o.length>b&&t("more than "+b+" actions"),i.elements=o.slice(0,b);break}}n.push(i)}return n}function oe(e){return e.replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/\s+/g," ").trim()}function E(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 H(e){return e?` — ${Math.floor(e/60)}m ${e%60}s`:""}function O(e){return e?.split("@")?.[0]||e||""}function y(e){return e.map(t=>t.name).join(", ")}function j(e){return e==="meeting"?"Meeting":e==="video"?"Video call":"Audio call"}const m={VOICE_CALL_STARTED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek gestart",timeline:e=>e.direction==="inbound"?`Inbound call started — ${O(e.payload.from)}`:`Outbound call started — ${O(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?` (${E(e.payload.duration)})`:""}`,timeline:e=>`Call ended${H(e.payload.duration)}`},VOICE_CALL_MISSED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gemiste oproep",timeline:e=>`Missed call — ${O(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?` (${E(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:W},EMAIL_SENT:{shape:"message",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:W},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=>`${y(e.payload.members)} toegevoegd`,timeline:e=>{const t=y(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=>`${y(e.payload.members)} verlaten`,timeline:e=>{const t=y(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=>`${j(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?` (${E(e.payload.duration)})`:""}`,timeline:e=>`${j(e.payload.callType)} ended${H(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?` (${E(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 W(e){const t=e.payload,n=t.bodySnippet?.trim()||oe(t.body??"");return t.subject?`${t.subject} — ${n}`:n}function p(e){return m[e]}function Ye(e){return p(e)?.icon??"circle"}function ze(e){return p(e)?.channelKind}function qe(e){const t=p(e)?.shape;return t==="message"||t==="note"}function Je(e){return p(e)?.replyable===!0}function Qe(e){return p(e)?.carriesText===!0}function Ze(e){return p(e)?.countsAs}function et(e){return p(e)?.playbookAuthored===!0}function se(e){const t=p(e.type)?.snippet;return t?t(e):""}function tt(e,t){const n=p(e.type)?.timeline;return n?n(e,t):e.type.replace(/_/g," ").toLowerCase()}function nt(e){const t=p(e.type)?.joinUrl;return t?t(e):void 0}function M(e,t){let n=e;for(const a of t.split(".")){if(n==null||typeof n!="object")return"";n=n[a]}return n==null?"":typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"?String(n):""}function N(e,t,n){if(e===void 0)return null;if(typeof e=="string")return e||null;if("value"in e)return M(t,e.value)||null;const a={};for(const[r,o]of Object.entries(e.params??{}))a[r]=M(t,o);const i=n(e.key,a);return i===e.key?null:i}function le(e,t){if(!e||typeof e=="string"||"value"in e)return null;const n={};for(const[a,i]of Object.entries(e.params??{}))n[a]=M(t,i);return{key:e.key,params:n}}const it=e=>e;function X(e){const t=m[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 Y(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 ce{constructor(t=[],n=it){this.translate=n;for(const a of t)a?.type&&(a.type in m||this.declared.has(a.type)||this.declared.set(a.type,a))}declared=new Map;get(t){if(t in m)return X(t);const n=this.declared.get(t);return n?Y(n):void 0}triggerable(){const t=Object.keys(m).filter(a=>m[a].triggerable).map(X),n=[...this.declared.values()].map(Y).filter(a=>a.triggerable);return[...t,...n]}timelineText(t,n){const a=m[t.type];if(a?.timeline)return a.timeline(t,n);const i=this.declared.get(t.type);return N(i?.text,t,this.translate)??t.type.replace(/_/g," ").toLowerCase()}snippet(t){const n=m[t.type];if(n?.snippet)return n.snippet(t);const a=this.declared.get(t.type);return N(a?.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 at=new ce,z=140;function rt(e){const t=e.trim();return t.length<=z?t:t.slice(0,z-1).trimEnd()+"…"}function ot(e,t){const n=le(t?.text,e),a=t?N(t.text,e,i=>i):null;return{activityId:e.id,type:e.type,snippet:rt(a??se(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now(),...n?{snippetKey:n.key,snippetParams:n.params}:{}}}function st(e,t,n=[]){const a=e.createdAt;if(!a)return[];const i=new Set(n);return e.author.type==="user"&&e.author.id&&i.add(e.author.id),Object.entries(t).filter(([r,o])=>o>=a&&!i.has(r)).map(([r])=>r)}function lt(e){return e.createdAt??0}const ct=[{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 ut(e){const t=[];for(const n of Object.keys(e))for(const a of Object.keys(e[n]))t.push({lang:n,key:a,value:e[n][a]});return t}function v(e){return e<10?`0${e}`:`${e}`}function ue(e,t){const n=new Date(e),a=`${n.getUTCFullYear()}-${v(n.getUTCMonth()+1)}-${v(n.getUTCDate())}`;return t==="day"?a:`${a}T${v(n.getUTCHours())}`}function pe(e,t){const n=new Date(e);return n.setUTCMinutes(0,0,0),t==="day"&&n.setUTCHours(0),n.getTime()}const pt=36e5,dt=864e5;function ft(e,t,n){const a=n==="hour"?pt:dt,i=[];for(let r=pe(e,n);r<=t;r+=a)i.push(ue(r,n));return i}const de=[{id:"resource",label:"Resource",labelSource:"raw"},{id:"origin",label:"Herkomst",labelSource:"raw"}],fe=de.map(e=>e.id);function me(e,t){return`${e}.usage.${t}`}function mt(e,t){return t.map(n=>({id:me(e,n.unit),label:n.label,category:"Verbruik",valueType:n.valueType??"count",aggregation:"sum",supportedDimensions:["provider",...fe,...n.extraDimensions??[],"time"]}))}const ge=new Set(["info","success","warning","destructive"]),k=200,$=100,D=200,U=12,P=4,K=4e3,I=500,gt=256*1024,ht=new Set(["heading","paragraph","list","quote","code","divider","table","kpi","callout"]),he=["http:","https:","mailto:","tel:"],At=/^[a-z][a-z0-9+.-]*:/i;function Ae(e){const t=e.trim().replace(/^<|>$/g,"");if(!t)return!1;const n=At.exec(t)?.[0];return n?he.includes(n.toLowerCase()):!t.startsWith("//")}const Et=/^[ \t]{0,3}\[([^\]]+)\]:[ \t]*(\S+).*$/gm;function yt(e){let t="",n=0;for(;n<e.length;){const a=e[n]==="!"&&e[n+1]==="[";if(e[n]!=="["&&!a){t+=e[n],n+=1;continue}const i=n+(a?2:1),r=q(e,i,"[","]");if(r<0||e[r+1]!=="("){t+=e[n],n+=1;continue}const o=q(e,r+2,"(",")");if(o<0){t+=e[n],n+=1;continue}const s=e.slice(i,r),l=e.slice(r+2,o).trim().split(/\s+/)[0]??"";t+=a||!Ae(l)?s:e.slice(n,o+1),n=o+1}return t}function q(e,t,n,a){let i=1;for(let r=t;r<e.length;r+=1){if(e[r]==="\\"){r+=1;continue}if(e[r]===n)i+=1;else if(e[r]===a&&(i-=1,i===0))return r}return-1}function Ee(e){return yt(e).replace(Et,(t,n,a)=>Ae(a)?t:"")}function u(e,t=K){return typeof e=="string"?Ee(e).slice(0,t):""}function _t(e,t=K){return typeof e=="string"?e.slice(0,t):""}function Tt(e,t="info"){return typeof e=="string"&&ge.has(e)?e:t}function bt(e,t=()=>{}){if(!Array.isArray(e))return[];const n=[];for(const a of e){if(n.length>=k){t("more than "+k+" blocks; the rest was dropped");break}if(!a||typeof a!="object")continue;const i=a;if(!ht.has(i.type)){t("unknown block type "+String(i.type));continue}const r=typeof i.block_id=="string"?{block_id:i.block_id}:{};switch(i.type){case"heading":{const o=u(i.text);if(!o){t("a heading without text");continue}const s=i.level===2||i.level===3?i.level:1;n.push({...r,type:"heading",level:s,text:o});break}case"paragraph":{const o=u(i.text);if(!o){t("a paragraph without text");continue}n.push({...r,type:"paragraph",text:o});break}case"quote":{const o=u(i.text);if(!o){t("a quote without text");continue}n.push({...r,type:"quote",text:o});break}case"code":{const o=_t(i.text);if(!o){t("a code block without text");continue}const s=typeof i.lang=="string"?{lang:i.lang.slice(0,32)}:{};n.push({...r,type:"code",...s,text:o});break}case"divider":n.push({...r,type:"divider"});break;case"list":{const o=Array.isArray(i.items)?i.items:[],s=[];for(const d of o){if(s.length>=$){t("more than "+$+" list items");break}const f=u(d?.text);if(!f)continue;const c=u(d?.lead,200);s.push(c?{lead:c,text:f}:{text:f})}if(s.length===0){t("a list without usable items");continue}const l=i.style==="numbered"?"numbered":"bulleted";n.push({...r,type:"list",style:l,items:s});break}case"table":{const o=Array.isArray(i.columns)?i.columns:[],s=[];for(const c of o){if(s.length>=U){t("more than "+U+" table columns");break}const A=u(c?.label,I),R=c?.align==="right"?"right":void 0;s.push(R?{label:A,align:R}:{label:A})}if(s.length===0){t("a table without columns");continue}const l=Array.isArray(i.rows)?i.rows:[],d=[];for(const c of l){if(d.length>=D){t("more than "+D+" table rows");break}const A=Array.isArray(c)?c:[];d.push(s.map((R,je)=>u(A[je],I)))}const f=u(i.caption,I);n.push({...r,type:"table",columns:s,rows:d,...f?{caption:f}:{}});break}case"kpi":{const o=Array.isArray(i.items)?i.items:[],s=[];for(const l of o){if(s.length>=P){t("more than "+P+" kpi items");break}const d=u(l?.value,40),f=u(l?.label,80);if(!d||!f)continue;const c=l?.tone;s.push(typeof c=="string"&&ge.has(c)?{value:d,label:f,tone:c}:{value:d,label:f})}if(s.length===0){t("a kpi block without usable items");continue}n.push({...r,type:"kpi",items:s});break}case"callout":{const o=u(i.text);if(!o){t("a callout without text");continue}const s=u(i.title,200);n.push({...r,type:"callout",tone:Tt(i.tone),...s?{title:s}:{},text:o});break}}}return n}function It(e){return JSON.stringify(e).length}function St(e){return{blocks:e.length,types:e.map(t=>t.type),headings:e.flatMap(t=>t.type==="heading"?[t.text]:[])}}function J(e){return e.replace(/\|/g,"\\|").replace(/\r?\n/g," ").trim()}function Q(e,t,n){const a=e.map((i,r)=>n?.[r]==="right"?"---:":"---");return[`| ${e.map(J).join(" | ")} |`,`| ${a.join(" | ")} |`,...t.map(i=>`| ${i.map(J).join(" | ")} |`)]}function Mt(e){switch(e.type){case"heading":return[`${"#".repeat(e.level)} ${e.text}`];case"paragraph":return[e.text];case"quote":return e.text.split(/\r?\n/).map(t=>`> ${t}`);case"code":return[`\`\`\`${e.lang??""}`,e.text,"```"];case"divider":return["---"];case"list":return e.items.map((t,n)=>{const a=e.style==="numbered"?`${n+1}.`:"-";return t.lead?`${a} **${t.lead}** ${t.text}`:`${a} ${t.text}`});case"table":{const t=Q(e.columns.map(n=>n.label),e.rows,e.columns.map(n=>n.align??"left"));return e.caption?[...t,"",`*${e.caption}*`]:t}case"kpi":return Q(e.items.map(t=>t.value),[e.items.map(t=>t.label)]);case"callout":return(e.title?`**${e.title}** ${e.text}`:e.text).split(/\r?\n/).map(n=>`> ${n}`)}}function Nt(e,t){const n=[],a=e.some(i=>i.type==="heading"&&i.level===1);t&&!a&&n.push(`# ${t}`);for(const i of e){const r=Mt(i);r.length>0&&n.push(r.join(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=10,_=10,T=10,b=5,Xe=new Set(["header","section","context","divider","image","list","actions","attachments"]);function L(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 Ye(e,t=()=>{}){if(!Array.isArray(e))return[];const n=[];for(const a of e){if(n.length>=x){t("more than "+x+" blocks; the rest was dropped");break}if(!a||typeof a!="object")continue;const i=a;if(!Xe.has(i.type)){t("unknown block type "+String(i.type));continue}switch(i.type){case"header":if(!L(i.text)){t("a header without text");continue}break;case"context":if(!L(i.text)){t("a context block without text");continue}break;case"image":if(!i.url||!i.alt){t("an image without url or alt");continue}break;case"section":Array.isArray(i.fields)&&i.fields.length>_&&(t("more than "+_+" fields in a section"),i.fields=i.fields.slice(0,_));break;case"list":if(!Array.isArray(i.items)||i.items.length===0){t("a list without items");continue}i.items.length>T&&(t("more than "+T+" list items"),i.items=i.items.slice(0,T));break;case"actions":{const r=Array.isArray(i.elements)?i.elements:[],o=r.filter(s=>s&&s.action_id&&s.invoke&&L(s.text));if(o.length!==r.length&&t("an action without action_id, invoke or text"),o.length===0)continue;o.length>b&&t("more than "+b+" actions"),i.elements=o.slice(0,b);break}}n.push(i)}return n}function oe(e){return e.replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/\s+/g," ").trim()}function E(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 H(e){return e?` — ${Math.floor(e/60)}m ${e%60}s`:""}function O(e){return e?.split("@")?.[0]||e||""}function y(e){return e.map(t=>t.name).join(", ")}function j(e){return e==="meeting"?"Meeting":e==="video"?"Video call":"Audio call"}const m={VOICE_CALL_STARTED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gesprek gestart",timeline:e=>e.direction==="inbound"?`Inbound call started — ${O(e.payload.from)}`:`Outbound call started — ${O(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?` (${E(e.payload.duration)})`:""}`,timeline:e=>`Call ended${H(e.payload.duration)}`},VOICE_CALL_MISSED:{shape:"event",channelKind:"voice",icon:"phone",snippet:()=>"Gemiste oproep",timeline:e=>`Missed call — ${O(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?` (${E(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:W},EMAIL_SENT:{shape:"message",component:"communication:EmailActivity",channelKind:"mail",icon:"mail",replyable:!0,carriesText:!0,countsAs:"outbound_message",snippet:W},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=>`${y(e.payload.members)} toegevoegd`,timeline:e=>{const t=y(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=>`${y(e.payload.members)} verlaten`,timeline:e=>{const t=y(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=>`${j(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?` (${E(e.payload.duration)})`:""}`,timeline:e=>`${j(e.payload.callType)} ended${H(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?` (${E(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 W(e){const t=e.payload,n=t.bodySnippet?.trim()||oe(t.body??"");return t.subject?`${t.subject} — ${n}`:n}function p(e){return m[e]}function ze(e){return p(e)?.icon??"circle"}function qe(e){return p(e)?.channelKind}function Je(e){const t=p(e)?.shape;return t==="message"||t==="note"}function Qe(e){return p(e)?.replyable===!0}function Ze(e){return p(e)?.carriesText===!0}function et(e){return p(e)?.countsAs}function tt(e){return p(e)?.playbookAuthored===!0}function se(e){const t=p(e.type)?.snippet;return t?t(e):""}function nt(e,t){const n=p(e.type)?.timeline;return n?n(e,t):e.type.replace(/_/g," ").toLowerCase()}function it(e){const t=p(e.type)?.joinUrl;return t?t(e):void 0}function M(e,t){let n=e;for(const a of t.split(".")){if(n==null||typeof n!="object")return"";n=n[a]}return n==null?"":typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"?String(n):""}function N(e,t,n){if(e===void 0)return null;if(typeof e=="string")return e||null;if("value"in e)return M(t,e.value)||null;const a={};for(const[r,o]of Object.entries(e.params??{}))a[r]=M(t,o);const i=n(e.key,a);return i===e.key?null:i}function le(e,t){if(!e||typeof e=="string"||"value"in e)return null;const n={};for(const[a,i]of Object.entries(e.params??{}))n[a]=M(t,i);return{key:e.key,params:n}}const at=e=>e;function X(e){const t=m[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 Y(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 ce{constructor(t=[],n=at){this.translate=n;for(const a of t)a?.type&&(a.type in m||this.declared.has(a.type)||this.declared.set(a.type,a))}declared=new Map;get(t){if(t in m)return X(t);const n=this.declared.get(t);return n?Y(n):void 0}triggerable(){const t=Object.keys(m).filter(a=>m[a].triggerable).map(X),n=[...this.declared.values()].map(Y).filter(a=>a.triggerable);return[...t,...n]}timelineText(t,n){const a=m[t.type];if(a?.timeline)return a.timeline(t,n);const i=this.declared.get(t.type);return N(i?.text,t,this.translate)??t.type.replace(/_/g," ").toLowerCase()}snippet(t){const n=m[t.type];if(n?.snippet)return n.snippet(t);const a=this.declared.get(t.type);return N(a?.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 rt=new ce,z=140;function ot(e){const t=e.trim();return t.length<=z?t:t.slice(0,z-1).trimEnd()+"…"}function st(e,t){const n=le(t?.text,e),a=t?N(t.text,e,i=>i):null;return{activityId:e.id,type:e.type,snippet:ot(a??se(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now(),...n?{snippetKey:n.key,snippetParams:n.params}:{}}}function lt(e,t,n=[]){const a=e.createdAt;if(!a)return[];const i=new Set(n);return e.author.type==="user"&&e.author.id&&i.add(e.author.id),Object.entries(t).filter(([r,o])=>o>=a&&!i.has(r)).map(([r])=>r)}function ct(e){return e.createdAt??0}const ut=[{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 pt(e){const t=[];for(const n of Object.keys(e))for(const a of Object.keys(e[n]))t.push({lang:n,key:a,value:e[n][a]});return t}function v(e){return e<10?`0${e}`:`${e}`}function ue(e,t){const n=new Date(e),a=`${n.getUTCFullYear()}-${v(n.getUTCMonth()+1)}-${v(n.getUTCDate())}`;return t==="day"?a:`${a}T${v(n.getUTCHours())}`}function pe(e,t){const n=new Date(e);return n.setUTCMinutes(0,0,0),t==="day"&&n.setUTCHours(0),n.getTime()}const dt=36e5,ft=864e5;function mt(e,t,n){const a=n==="hour"?dt:ft,i=[];for(let r=pe(e,n);r<=t;r+=a)i.push(ue(r,n));return i}const de=[{id:"resource",label:"Resource",labelSource:"raw"},{id:"origin",label:"Herkomst",labelSource:"raw"}],fe=de.map(e=>e.id);function me(e,t){return`${e}.usage.${t}`}function gt(e,t){return t.map(n=>({id:me(e,n.unit),label:n.label,category:"Verbruik",valueType:n.valueType??"count",aggregation:"sum",supportedDimensions:["provider",...fe,...n.extraDimensions??[],"time"]}))}const ge=new Set(["info","success","warning","destructive"]),k=200,$=100,D=200,U=12,P=4,K=4e3,I=500,ht=256*1024,At=new Set(["heading","paragraph","list","quote","code","divider","table","kpi","callout"]),he=["http:","https:","mailto:","tel:"],Et=/^[a-z][a-z0-9+.-]*:/i;function Ae(e){const t=e.trim().replace(/^<|>$/g,"");if(!t)return!1;const n=Et.exec(t)?.[0];return n?he.includes(n.toLowerCase()):!t.startsWith("//")}const yt=/^[ \t]{0,3}\[([^\]]+)\]:[ \t]*(\S+).*$/gm;function _t(e){let t="",n=0;for(;n<e.length;){const a=e[n]==="!"&&e[n+1]==="[";if(e[n]!=="["&&!a){t+=e[n],n+=1;continue}const i=n+(a?2:1),r=q(e,i,"[","]");if(r<0||e[r+1]!=="("){t+=e[n],n+=1;continue}const o=q(e,r+2,"(",")");if(o<0){t+=e[n],n+=1;continue}const s=e.slice(i,r),l=e.slice(r+2,o).trim().split(/\s+/)[0]??"";t+=a||!Ae(l)?s:e.slice(n,o+1),n=o+1}return t}function q(e,t,n,a){let i=1;for(let r=t;r<e.length;r+=1){if(e[r]==="\\"){r+=1;continue}if(e[r]===n)i+=1;else if(e[r]===a&&(i-=1,i===0))return r}return-1}function Ee(e){return _t(e).replace(yt,(t,n,a)=>Ae(a)?t:"")}function u(e,t=K){return typeof e=="string"?Ee(e).slice(0,t):""}function Tt(e,t=K){return typeof e=="string"?e.slice(0,t):""}function bt(e,t="info"){return typeof e=="string"&&ge.has(e)?e:t}function It(e,t=()=>{}){if(!Array.isArray(e))return[];const n=[];for(const a of e){if(n.length>=k){t("more than "+k+" blocks; the rest was dropped");break}if(!a||typeof a!="object")continue;const i=a;if(!At.has(i.type)){t("unknown block type "+String(i.type));continue}const r=typeof i.block_id=="string"?{block_id:i.block_id}:{};switch(i.type){case"heading":{const o=u(i.text);if(!o){t("a heading without text");continue}const s=i.level===2||i.level===3?i.level:1;n.push({...r,type:"heading",level:s,text:o});break}case"paragraph":{const o=u(i.text);if(!o){t("a paragraph without text");continue}n.push({...r,type:"paragraph",text:o});break}case"quote":{const o=u(i.text);if(!o){t("a quote without text");continue}n.push({...r,type:"quote",text:o});break}case"code":{const o=Tt(i.text);if(!o){t("a code block without text");continue}const s=typeof i.lang=="string"?{lang:i.lang.slice(0,32)}:{};n.push({...r,type:"code",...s,text:o});break}case"divider":n.push({...r,type:"divider"});break;case"list":{const o=Array.isArray(i.items)?i.items:[],s=[];for(const d of o){if(s.length>=$){t("more than "+$+" list items");break}const f=u(d?.text);if(!f)continue;const c=u(d?.lead,200);s.push(c?{lead:c,text:f}:{text:f})}if(s.length===0){t("a list without usable items");continue}const l=i.style==="numbered"?"numbered":"bulleted";n.push({...r,type:"list",style:l,items:s});break}case"table":{const o=Array.isArray(i.columns)?i.columns:[],s=[];for(const c of o){if(s.length>=U){t("more than "+U+" table columns");break}const A=u(c?.label,I),R=c?.align==="right"?"right":void 0;s.push(R?{label:A,align:R}:{label:A})}if(s.length===0){t("a table without columns");continue}const l=Array.isArray(i.rows)?i.rows:[],d=[];for(const c of l){if(d.length>=D){t("more than "+D+" table rows");break}const A=Array.isArray(c)?c:[];d.push(s.map((R,We)=>u(A[We],I)))}const f=u(i.caption,I);n.push({...r,type:"table",columns:s,rows:d,...f?{caption:f}:{}});break}case"kpi":{const o=Array.isArray(i.items)?i.items:[],s=[];for(const l of o){if(s.length>=P){t("more than "+P+" kpi items");break}const d=u(l?.value,40),f=u(l?.label,80);if(!d||!f)continue;const c=l?.tone;s.push(typeof c=="string"&&ge.has(c)?{value:d,label:f,tone:c}:{value:d,label:f})}if(s.length===0){t("a kpi block without usable items");continue}n.push({...r,type:"kpi",items:s});break}case"callout":{const o=u(i.text);if(!o){t("a callout without text");continue}const s=u(i.title,200);n.push({...r,type:"callout",tone:bt(i.tone),...s?{title:s}:{},text:o});break}}}return n}function St(e){return JSON.stringify(e).length}function Mt(e){return{blocks:e.length,types:e.map(t=>t.type),headings:e.flatMap(t=>t.type==="heading"?[t.text]:[])}}function J(e){return e.replace(/\|/g,"\\|").replace(/\r?\n/g," ").trim()}function Q(e,t,n){const a=e.map((i,r)=>n?.[r]==="right"?"---:":"---");return[`| ${e.map(J).join(" | ")} |`,`| ${a.join(" | ")} |`,...t.map(i=>`| ${i.map(J).join(" | ")} |`)]}function Nt(e){switch(e.type){case"heading":return[`${"#".repeat(e.level)} ${e.text}`];case"paragraph":return[e.text];case"quote":return e.text.split(/\r?\n/).map(t=>`> ${t}`);case"code":return[`\`\`\`${e.lang??""}`,e.text,"```"];case"divider":return["---"];case"list":return e.items.map((t,n)=>{const a=e.style==="numbered"?`${n+1}.`:"-";return t.lead?`${a} **${t.lead}** ${t.text}`:`${a} ${t.text}`});case"table":{const t=Q(e.columns.map(n=>n.label),e.rows,e.columns.map(n=>n.align??"left"));return e.caption?[...t,"",`*${e.caption}*`]:t}case"kpi":return Q(e.items.map(t=>t.value),[e.items.map(t=>t.label)]);case"callout":return(e.title?`**${e.title}** ${e.text}`:e.text).split(/\r?\n/).map(n=>`> ${n}`)}}function Ct(e,t){const n=[],a=e.some(i=>i.type==="heading"&&i.level===1);t&&!a&&n.push(`# ${t}`);for(const i of e){const r=Nt(i);r.length>0&&n.push(r.join(`
|
|
2
2
|
`))}return`${n.join(`
|
|
3
3
|
|
|
4
4
|
`)}
|
|
5
|
-
`}const B=e=>`user:${e}`,G=e=>`team:${e}`;function
|
|
5
|
+
`}const B=e=>`user:${e}`,G=e=>`team:${e}`;function Rt(e){const t=new Set;for(const n of e??[])n?.id&&(n.kind==="user"&&t.add(B(n.id)),n.kind==="team"&&t.add(G(n.id)));return[...t].sort()}function Lt(e,t){return[B(e),...t.map(G)]}function Ot(e){const t=new Set;for(const n of e??[])n?.kind&&t.add(n.kind);return[...t]}function vt(e){return(e.startsWith("tool:")?e.slice(5):e).replace(/__/g," · ").replace(/\./g," · ").replace(/_/g," ")}const xt=[{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"}],kt={topics:[{name:"topic",type:"string"},{name:"confidence",type:"number"}],question:[{name:"answer",type:"boolean"},{name:"confidence",type:"number"}],extract:[]};function ye(e){switch(e.kind){case"user":return`user:${e.userId}`;case"team":return`team:${e.teamId}`;case"org":return"org"}}function $t(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 a=t.slice(0,n),i=t.slice(n+1).trim();if(i){if(a==="user")return{kind:"user",userId:i};if(a==="team")return{kind:"team",teamId:i}}}function _e(e){return ye(e)}function Dt(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 Ut(e){return _e(e)}const Te=["done","escalated","failed","timed_out","stopped"],be=["awaiting_approval","awaiting_reply"];function Ie(e){return Te.includes(e)}function Pt(e){return Ie(e)}function wt(e){return be.includes(e)}function Kt(e,t){const n=e.labels??[];return n.find(a=>a.locale===t)?.label??n[0]?.label??e.url}function Bt(e,t,n){const a=e.translations??[];return a.find(i=>i.locale===t)??(n?a.find(i=>i.locale===n):void 0)??{locale:t}}const Se="en";function Me(e){return e.defaultLocale||e.locale||Se}function Gt(e){const t=new Set,n=[];for(const a of[Me(e),...e.locales??[]])!a||t.has(a)||(t.add(a),n.push(a));return n}function Ft(e,t,n){const a=e.translations??[];return a.find(i=>i.locale===t)?.name??(n?a.find(i=>i.locale===n)?.name:void 0)??e.name}const F=[{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 h(e){return F.find(t=>t.id===e)}function Vt(e){return h(e)?.label??e}function Ht(e,t="gpt-5-mini"){return h(e)?.defaultModel??t}function jt(e){return F.filter(t=>t.capabilities.includes(e))}function Wt(e){const t=h(e);return!!t&&!t.baseUrl}function Xt(e,t){return t==="text"?!0:h(e)?.attachmentKinds?.includes(t)===!0}const Yt=new Set(["mail","message"]);function Ne(e,t){const n=e.settings?.signatures?.[t];return!n||!n.enabled||!n.body||n.body.trim()===""?null:n}function zt(e,t,n,a="html"){if(!e)return n;const i=Ne(e,t);return i?`${n}${a==="text"?`
|
|
6
6
|
|
|
7
|
-
`:t==="mail"?"<br><br>-- <br>":"<br><br>"}${i.body}`:n}function
|
|
7
|
+
`:t==="mail"?"<br><br>-- <br>":"<br><br>"}${i.body}`:n}function qt(e){return e.endpoints??[]}const Jt=e=>!!e.assignedUserId||!!e.assignedInboxId,Qt=e=>e.status==="closed",Zt=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,en=(e,t=30)=>e.title?.length<=t?e.title:`${e.title.substring(0,t)}...`;function tn(e,t){return e.lastActivityAt?!(e.seenBy??[]).includes(t):!1}const nn=2e3,an=500,rn=12e3,on=4e3,Ce=["contact","company"];function sn(e){if(!e)return!1;const t=e.slice(0,e.indexOf(":"));return Ce.includes(t)}const C={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}},Re="NL",ln=15,cn=8,un=Array.from(new Set(Object.values(C).map(e=>e.callingCode))).sort((e,t)=>t.length-e.length);function Z(e){if(e)return C[e.trim().toUpperCase()]}function S(e,t){return e.length>=t.nsnMin&&e.length<=t.nsnMax}function ee(e){if(e.length>ln)return null;for(const t of un){if(!e.startsWith(t))continue;const n=e.slice(t.length);for(const a of Object.values(C)){if(a.callingCode!==t)continue;const i=a.trunkPrefix,r=i&&n.startsWith(i)?n.slice(i.length):n;if(S(r,a))return`+${t}${r}`}return null}return e.length<cn?null:`+${e}`}function pn(e){let t=e.trim();const n=t.match(/^(sips?|tel|whatsapp):/i);n&&(t=t.slice(n[0].length));const a=t.indexOf("@");return a>=0&&(t=t.slice(0,a)),t.trim()}function dn(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 w(e,t){if(!e)return null;const n=pn(e);if(!n)return null;const a=n.startsWith("+"),i=n.replace(/\D/g,"");if(!i)return null;if(a)return ee(i);if(i.startsWith("00"))return ee(i.slice(2));const r=Z(t)??Z(Re);if(!r)return null;const o=r.trunkPrefix;if(o&&i.startsWith(o)){const s=i.slice(o.length);return S(s,r)?`+${r.callingCode}${s}`:null}if(i.startsWith(r.callingCode)){const s=i.slice(r.callingCode.length);if(S(s,r))return`+${r.callingCode}${s}`}return!o&&S(i,r)?`+${r.callingCode}${i}`:null}function fn(e,t=9){const n=(e??"").replace(/\D/g,"");return n.length<t?null:n.slice(-t)}function V(e){if(!e)return null;const t=e.trim().toLowerCase(),n=t.lastIndexOf("@");if(n<=0||n===t.length-1)return null;const a=t.slice(0,n).split("+")[0],i=t.slice(n+1);return!a||!i.includes(".")?null:`${a}@${i}`}function mn(e){const t=V(e);return t?t.slice(t.lastIndexOf("@")+1):null}const gn=new Set(["co.uk","org.uk","gov.uk","ac.uk","com.au","co.nz","com.br","co.za"]);function Le(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 gn.has(n)&&t.length>=3?t.slice(-3).join("."):n}const Oe=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 hn(e){const t=Le(e);return t?Oe.has(t):!1}function An(e){if(!e)return!1;const t=e.trim().toLowerCase();return t==="tel"||t==="sms"||t==="whatsapp"||t==="fax"}function En(e,t,n){if(!e||!t)return null;const a=e.trim().toLowerCase();if(a==="tel"||a==="sms"||a==="whatsapp"){const r=w(t,n);return r?`tel:${r}`:null}if(a==="fax"){const r=w(t,n);return r?`fax:${r}`:null}if(a==="mailto"||a==="email"){const r=V(t);return r?`mailto:${r}`:null}const i=t.trim().toLowerCase();return i?`${a}:${i}`:null}const yn=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,_n=/(\*|_)(?=\S)([^*_\n]*?\S)\1/g;function Tn(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(`
|
|
8
8
|
`).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(`
|
|
9
|
-
`),t=t.replace(
|
|
10
|
-
`);for(let n=0;n<t.length;n++)if(
|
|
9
|
+
`),t=t.replace(yn,"$2"),t=t.replace(_n,"$2"),t=t.replace(/~~(?=\S)([\s\S]*?\S)~~/g,"$1"),t=t.replace(/`([^`\n]+)`/g,"$1"),t.replace(/\s+/g," ").trim()}const bn=[/<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],te=/^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i,In=/^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;function Sn(e){const t=e.split(`
|
|
10
|
+
`);for(let n=0;n<t.length;n++)if(In.test(t[n])||te.test(t[n])&&t.slice(n+1,n+4).some(a=>te.test(a)))return t.slice(0,n).join(`
|
|
11
11
|
`).trim();return e}function ne(e){let t=e;return t=t.replace(/<(script|style)[\s\S]*?<\/\1>/gi,""),t=t.replace(/<br\s*\/?>/gi,`
|
|
12
12
|
`),t=t.replace(/<\/(p|h[1-6]|ul|ol|table|blockquote)>/gi,`
|
|
13
13
|
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
`),t=t.replace(/<\/(td|th)>/gi," "),t=t.replace(/<[^>]+>/g,""),t=t.replace(/<[^>]*$/,""),t}function ie(e){return!Number.isInteger(e)||e<0||e>1114111?null:String.fromCodePoint(e)}function ae(e){return e.replace(/ /gi," ").replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/&#(\d+);/g,(t,n)=>ie(Number(n))??t).replace(/&#x([0-9a-f]+);/gi,(t,n)=>ie(parseInt(n,16))??t).replace(/&/gi,"&")}function re(e){return e.replace(/\r/g,"").replace(/[ \t]+/g," ").replace(/ *\n */g,`
|
|
16
16
|
`).replace(/\n{3,}/g,`
|
|
17
17
|
|
|
18
|
-
`).trim()}function
|
|
18
|
+
`).trim()}function Mn(e){if(typeof e!="string"||!e)return"";let t=e.length;for(const r of bn){const o=e.search(r);o>=0&&o<t&&(t=o)}const n=e.slice(0,t);let a=re(ae(ne(n)));return a||(a=re(ae(ne(e)))),Sn(a)||a}const Nn=/(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i,Cn=/\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;function Rn(e,t){return!!(e&&Nn.test(e)||t&&Cn.test(t))}const ve=3,xe=600;function Ln(e,t){return e>=ve||t>=xe}const On=new Set(["image/png","image/jpeg","image/jpg","image/gif","image/webp"]),vn=new Set(["text/plain","text/markdown","text/csv","application/json","text/html","application/xml","text/xml"]);function ke(e){const t=(e??"").trim().toLowerCase().split(";")[0];return t?On.has(t)?"image":t==="application/pdf"?"pdf":vn.has(t)?"text":t.startsWith("audio/")?"audio":"unsupported":"unsupported"}const g=1024*1024,$e={image:5*g,pdf:20*g,text:1*g,audio:20*g},xn=25*g,kn=5;function $n(e,t){const n=ke(e);return n==="unsupported"?"unsupported":t>$e[n]?"too-large":null}function De(e,t){const n=new Set(e.disabledIntents??[]),a=e.intentOverrides??{},i=t.intents.filter(o=>!n.has(o.intent)).map(o=>Un(o,a[o.intent]));if(!e.extraIntents||e.extraIntents.length===0)return i;const r=new Set(i.map(o=>o.intent));for(const o of e.extraIntents)r.has(o.intent)||(i.push(o),r.add(o.intent));return i}function Ue(e,t){const n={};for(const a of e.intents){if(!a.togglable)continue;const i=t?.[a.intent];n[a.intent]=i??a.defaultEnabled??!0}return n}function Dn(e,t){const n=Ue(e,t);return Object.entries(n).filter(([,a])=>!a).map(([a])=>a)}function Un(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function Pn(e,t){const n=[];for(const a of e){if(!a.enabled)continue;const i=t[a.providerId];if(i)for(const r of De(a,i))n.push({channel:a,description:i,capability:r})}return n}function wn(e,t){return t.filter(n=>n.capability.intent===e)}function Pe(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function Kn(e,t){return Pe(e.scheme,t)}function Bn(e,t,n){const a=[];for(const i of e)for(const r of n)r.capability.intent===t&&r.capability.targetSchemes.includes(i.scheme)&&a.push({channelIntent:r,endpoint:i});return a}var we=(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))(we||{});const Gn={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 Fn(e){return e?Gn[e]??"note":"note"}const Vn="message_window",Hn="message_templates",jn={FROM:"from",TO:"to",CC:"cc",BCC:"bcc",ORGANIZER:"organizer",PRESENTER:"presenter",ATTENDEE:"attendee",OWNER:"owner",MEMBER:"member",GUEST:"guest",HOST:"host",PARTICIPANT:"participant"},Wn=(e,t)=>({intent:e,...t}),Xn="folder_management",Yn="remote_search",zn={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"},Ke="auth";function Be(e){const t=typeof e=="string"?e.match(/apps\/([^/?#]+)/):null;return t?t[1]:null}function qn(e){const t=Be(e);return t?t!==Ke:typeof e=="string"&&e.startsWith("/wake")}function Jn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ge(e){const n=e.split("/").filter(Boolean).map(a=>a.startsWith(":")?a.endsWith("?")?"(?:/[^/]+)?":"/[^/]+":"/"+Jn(a)).join("");return new RegExp(`^${n}\\/?$`)}function Fe(e,t){const n=e.split("/").filter(Boolean),a=t.split("/").filter(Boolean),i={};return n.forEach((r,o)=>{if(r.startsWith(":")){const s=r.endsWith("?")?r.slice(1,-1):r.slice(1),l=a[o];l&&(i[s]=l)}}),i}function Ve(e){return e.publicBasePath??`/apps/${e.name}`}function Qn(e){const t=[];for(const n of e){if(!n?.name)continue;const a=Ve(n);for(const i of n.routes??[]){if(!i.public)continue;const r=i.path==="/"?"":i.path;t.push({appName:n.name,resource:i.resource,pattern:`${a}${r}`,props:i.props})}}return t}function He(e,t){const n=e.split("/").filter(Boolean),a=t.split("/").filter(Boolean);for(let i=0;i<Math.min(n.length,a.length);i++){const r=n[i].startsWith(":"),o=a[i].startsWith(":");if(r!==o)return o}return n.length>a.length}function je(e,t){if(typeof e!="string")return null;let n=null;for(const a of t)Ge(a.pattern).test(e)&&(!n||He(a.pattern,n.pattern))&&(n=a);return n?{...n,params:{...n.props,...Fe(n.pattern,e)}}:null}function Zn(e,t){return je(e,t)!==null}const ei=9e4,ti="installation-id";exports.ACTIVITY_CATALOG=m;exports.AI_ATTACHMENT_LIMITS=$e;exports.AI_ATTACHMENT_MAX_PER_TURN=kn;exports.AI_ATTACHMENT_TURN_BUDGET=xn;exports.AI_VENDORS=F;exports.ALLOWED_LINK_SCHEMES=he;exports.ARTIFACT_MAX_BLOCKS=k;exports.ARTIFACT_MAX_BODY_BYTES=ht;exports.ARTIFACT_MAX_CELL_LEN=I;exports.ARTIFACT_MAX_KPI_ITEMS=P;exports.ARTIFACT_MAX_LIST_ITEMS=$;exports.ARTIFACT_MAX_TABLE_COLUMNS=U;exports.ARTIFACT_MAX_TABLE_ROWS=D;exports.ARTIFACT_MAX_TEXT_LEN=K;exports.AUTH_APP_NAME=Ke;exports.ActivityTypeRegistry=ce;exports.BUILT_IN_ONLY=rt;exports.CLASSIFY_VARS=kt;exports.CORE_DIMENSIONS=ut;exports.CommunicationScheme=we;exports.DEFAULT_MEMORY_BUDGET=on;exports.DEFAULT_PHONE_REGION=Re;exports.FEATURE_FOLDER_MANAGEMENT=Xn;exports.FEATURE_REMOTE_SEARCH=Yn;exports.INSTALLATION_HEADER=ti;exports.InteractionParticipantRole=jn;exports.KB_FALLBACK_LOCALE=Se;exports.MAX_ACTIONS=b;exports.MAX_BLOCKS=x;exports.MAX_FIELDS=_;exports.MAX_LIST_ITEMS=T;exports.MAX_MEMORY_BUDGET=rn;exports.MAX_MEMORY_CHARS=nn;exports.MIN_MEMORY_BUDGET=an;exports.PAUSED_RUN_STATUSES=be;exports.PHONE_REGIONS=C;exports.PRESENCE_ONLINE_WINDOW_MS=ei;exports.PROVIDER_FEATURE_MESSAGE_TEMPLATES=Hn;exports.PROVIDER_FEATURE_MESSAGE_WINDOW=Vn;exports.PUBLIC_EMAIL_DOMAINS=Oe;exports.RELATED_SUBJECT_KINDS=Ce;exports.SIGNATURE_INTENTS=Yt;exports.SUMMARY_MIN_LAST_CHARS=xe;exports.SUMMARY_MIN_MESSAGES=ve;exports.TERMINAL_RUN_STATUSES=Te;exports.TRIGGER_VARS=xt;exports.UNSUPPORTED=zn;exports.USAGE_DIMENSIONS=de;exports.USAGE_DIMENSION_IDS=fe;exports.actingIdentityKey=_e;exports.activityIconOf=ze;exports.activityJoinUrl=it;exports.activitySnippet=se;exports.activityTextParams=le;exports.activityTimelineText=nt;exports.activityTimestamp=ct;exports.activityTypeInfo=p;exports.actorKey=Ut;exports.aiAttachmentKind=ke;exports.aiAttachmentRejection=$n;exports.aiVendorAcceptsAttachment=Xt;exports.aiVendorDefaultModel=Ht;exports.aiVendorLabel=Vt;exports.aiVendorNeedsBaseUrl=Wt;exports.aiVendorsWith=jt;exports.appNameFromPath=Be;exports.applySignature=zt;exports.artifactBodyBytes=St;exports.artifactOutline=Mt;exports.artifactToMarkdown=Ct;exports.buildActivityPreview=st;exports.buildChannelIntents=Pn;exports.buildShareKeys=Rt;exports.carriesText=Ze;exports.categoryLabel=Ft;exports.channelKindForScheme=Fn;exports.channelKindOf=qe;exports.cleanMessageText=Mn;exports.defaultLocaleOf=Me;exports.defineIntent=Wn;exports.disabledIntentsFromCapabilities=Dn;exports.emailDomain=mn;exports.endpointKey=En;exports.extractParams=Fe;exports.filterByEndpoint=Kn;exports.filterByIntent=wn;exports.filterByTargetScheme=Pe;exports.findAiVendor=h;exports.flattenLocales=pt;exports.floorToPeriod=pe;exports.formatActingIdentity=ye;exports.formatPeriod=ue;exports.getActivitySeenUserIds=lt;exports.getContactEndpoints=qt;exports.getShortTitle=en;exports.getUrgencyScore=Zt;exports.helpCenterText=Bt;exports.humanizeAction=vt;exports.isAssigned=Jt;exports.isClosed=Qt;exports.isDeepLink=qn;exports.isInteractionUnseen=tn;exports.isLikelyBulk=Rn;exports.isMessageType=Je;exports.isMoreSpecificPattern=He;exports.isPaused=wt;exports.isPlaybookAuthoredType=tt;exports.isPublicEmailDomain=hn;exports.isPublicPath=Zn;exports.isReplyableType=Qe;exports.isRetryable=Pt;exports.isTerminal=Ie;exports.isThreadLongEnough=Ln;exports.linkLabel=Kt;exports.localesOf=Gt;exports.looksLikeEmail=dn;exports.matchContactToIntents=Bn;exports.matchPublicRoute=je;exports.messageCountsAs=et;exports.needsPhoneRegion=An;exports.normalizeArtifactBlocks=It;exports.normalizeBlocks=Ye;exports.normalizeEmail=V;exports.parseActingIdentity=$t;exports.pathToRegex=Ge;exports.periodsInRange=mt;exports.phoneSuffix=fn;exports.plainTextFromMarkdown=Tn;exports.playbookActor=Dt;exports.publicBasePathFor=Ve;exports.publicRoutePatterns=Qn;exports.readPath=M;exports.registrableDomain=Le;exports.relatedByDefault=sn;exports.resolveAccountCapabilities=Ue;exports.resolveActivityText=N;exports.resolveChannelIntents=De;exports.resolveSignature=Ne;exports.sanitizeInline=Ee;exports.shareKeyForTeam=G;exports.shareKeyForUser=B;exports.shareKeysForViewer=Lt;exports.stripHtml=oe;exports.toE164=w;exports.toolSourceKinds=Ot;exports.usageMetricId=me;exports.usageMetrics=gt;
|
package/dist/index.js
CHANGED
|
@@ -588,7 +588,7 @@ const Dt = [
|
|
|
588
588
|
{ id: "handledBy", label: "Afhandelaar", labelSource: "raw" },
|
|
589
589
|
{ id: "time", label: "Tijd", labelSource: "raw" }
|
|
590
590
|
];
|
|
591
|
-
function
|
|
591
|
+
function Pt(e) {
|
|
592
592
|
const t = [];
|
|
593
593
|
for (const n of Object.keys(e))
|
|
594
594
|
for (const a of Object.keys(e[n]))
|
|
@@ -607,7 +607,7 @@ function fe(e, t) {
|
|
|
607
607
|
return n.setUTCMinutes(0, 0, 0), t === "day" && n.setUTCHours(0), n.getTime();
|
|
608
608
|
}
|
|
609
609
|
const me = 36e5, ge = 864e5;
|
|
610
|
-
function
|
|
610
|
+
function Ut(e, t, n) {
|
|
611
611
|
const a = n === "hour" ? me : ge, i = [];
|
|
612
612
|
for (let r = fe(e, n); r <= t; r += a)
|
|
613
613
|
i.push(de(r, n));
|
|
@@ -635,7 +635,7 @@ function Kt(e, t) {
|
|
|
635
635
|
]
|
|
636
636
|
}));
|
|
637
637
|
}
|
|
638
|
-
const J = /* @__PURE__ */ new Set(["info", "success", "warning", "destructive"]), w = 200, D = 100,
|
|
638
|
+
const J = /* @__PURE__ */ new Set(["info", "success", "warning", "destructive"]), w = 200, D = 100, P = 200, U = 12, K = 4, Q = 4e3, M = 500, Gt = 256 * 1024, Ae = /* @__PURE__ */ new Set([
|
|
639
639
|
"heading",
|
|
640
640
|
"paragraph",
|
|
641
641
|
"list",
|
|
@@ -785,8 +785,8 @@ function Bt(e, t = () => {
|
|
|
785
785
|
case "table": {
|
|
786
786
|
const o = Array.isArray(i.columns) ? i.columns : [], s = [];
|
|
787
787
|
for (const c of o) {
|
|
788
|
-
if (s.length >=
|
|
789
|
-
t("more than " +
|
|
788
|
+
if (s.length >= U) {
|
|
789
|
+
t("more than " + U + " table columns");
|
|
790
790
|
break;
|
|
791
791
|
}
|
|
792
792
|
const h = u(c?.label, M), _ = c?.align === "right" ? "right" : void 0;
|
|
@@ -798,8 +798,8 @@ function Bt(e, t = () => {
|
|
|
798
798
|
}
|
|
799
799
|
const l = Array.isArray(i.rows) ? i.rows : [], p = [];
|
|
800
800
|
for (const c of l) {
|
|
801
|
-
if (p.length >=
|
|
802
|
-
t("more than " +
|
|
801
|
+
if (p.length >= P) {
|
|
802
|
+
t("more than " + P + " table rows");
|
|
803
803
|
break;
|
|
804
804
|
}
|
|
805
805
|
const h = Array.isArray(c) ? c : [];
|
|
@@ -1212,7 +1212,7 @@ const v = {
|
|
|
1212
1212
|
PL: { callingCode: "48", nsnMin: 9, nsnMax: 9 },
|
|
1213
1213
|
US: { callingCode: "1", nsnMin: 10, nsnMax: 10 },
|
|
1214
1214
|
CA: { callingCode: "1", nsnMin: 10, nsnMax: 10 }
|
|
1215
|
-
},
|
|
1215
|
+
}, Pe = "NL", Ue = 15, Ke = 8, Ge = Array.from(
|
|
1216
1216
|
new Set(Object.values(v).map((e) => e.callingCode))
|
|
1217
1217
|
).sort((e, t) => t.length - e.length);
|
|
1218
1218
|
function V(e) {
|
|
@@ -1223,7 +1223,7 @@ function A(e, t) {
|
|
|
1223
1223
|
return e.length >= t.nsnMin && e.length <= t.nsnMax;
|
|
1224
1224
|
}
|
|
1225
1225
|
function H(e) {
|
|
1226
|
-
if (e.length >
|
|
1226
|
+
if (e.length > Ue) return null;
|
|
1227
1227
|
for (const t of Ge) {
|
|
1228
1228
|
if (!e.startsWith(t)) continue;
|
|
1229
1229
|
const n = e.slice(t.length);
|
|
@@ -1258,7 +1258,7 @@ function F(e, t) {
|
|
|
1258
1258
|
if (!i) return null;
|
|
1259
1259
|
if (a) return H(i);
|
|
1260
1260
|
if (i.startsWith("00")) return H(i.slice(2));
|
|
1261
|
-
const r = V(t) ?? V(
|
|
1261
|
+
const r = V(t) ?? V(Pe);
|
|
1262
1262
|
if (!r) return null;
|
|
1263
1263
|
const o = r.trunkPrefix;
|
|
1264
1264
|
if (o && i.startsWith(o)) {
|
|
@@ -1466,7 +1466,7 @@ const g = 1024 * 1024, it = {
|
|
|
1466
1466
|
text: 1 * g,
|
|
1467
1467
|
audio: 20 * g
|
|
1468
1468
|
}, wn = 25 * g, Dn = 5;
|
|
1469
|
-
function
|
|
1469
|
+
function Pn(e, t) {
|
|
1470
1470
|
const n = nt(e);
|
|
1471
1471
|
return n === "unsupported" ? "unsupported" : t > it[n] ? "too-large" : null;
|
|
1472
1472
|
}
|
|
@@ -1487,7 +1487,7 @@ function rt(e, t) {
|
|
|
1487
1487
|
}
|
|
1488
1488
|
return n;
|
|
1489
1489
|
}
|
|
1490
|
-
function
|
|
1490
|
+
function Un(e, t) {
|
|
1491
1491
|
const n = rt(e, t);
|
|
1492
1492
|
return Object.entries(n).filter(([, a]) => !a).map(([a]) => a);
|
|
1493
1493
|
}
|
|
@@ -1604,7 +1604,12 @@ function Qn(e) {
|
|
|
1604
1604
|
for (const i of n.routes ?? []) {
|
|
1605
1605
|
if (!i.public) continue;
|
|
1606
1606
|
const r = i.path === "/" ? "" : i.path;
|
|
1607
|
-
t.push({
|
|
1607
|
+
t.push({
|
|
1608
|
+
appName: n.name,
|
|
1609
|
+
resource: i.resource,
|
|
1610
|
+
pattern: `${a}${r}`,
|
|
1611
|
+
props: i.props
|
|
1612
|
+
});
|
|
1608
1613
|
}
|
|
1609
1614
|
}
|
|
1610
1615
|
return t;
|
|
@@ -1622,7 +1627,7 @@ function yt(e, t) {
|
|
|
1622
1627
|
let n = null;
|
|
1623
1628
|
for (const a of t)
|
|
1624
1629
|
ft(a.pattern).test(e) && (!n || ht(a.pattern, n.pattern)) && (n = a);
|
|
1625
|
-
return n ? { ...n, params: mt(n.pattern, e) } : null;
|
|
1630
|
+
return n ? { ...n, params: { ...n.props, ...mt(n.pattern, e) } } : null;
|
|
1626
1631
|
}
|
|
1627
1632
|
function Zn(e, t) {
|
|
1628
1633
|
return yt(e, t) !== null;
|
|
@@ -1640,8 +1645,8 @@ export {
|
|
|
1640
1645
|
M as ARTIFACT_MAX_CELL_LEN,
|
|
1641
1646
|
K as ARTIFACT_MAX_KPI_ITEMS,
|
|
1642
1647
|
D as ARTIFACT_MAX_LIST_ITEMS,
|
|
1643
|
-
|
|
1644
|
-
|
|
1648
|
+
U as ARTIFACT_MAX_TABLE_COLUMNS,
|
|
1649
|
+
P as ARTIFACT_MAX_TABLE_ROWS,
|
|
1645
1650
|
Q as ARTIFACT_MAX_TEXT_LEN,
|
|
1646
1651
|
ut as AUTH_APP_NAME,
|
|
1647
1652
|
ue as ActivityTypeRegistry,
|
|
@@ -1650,7 +1655,7 @@ export {
|
|
|
1650
1655
|
Dt as CORE_DIMENSIONS,
|
|
1651
1656
|
lt as CommunicationScheme,
|
|
1652
1657
|
In as DEFAULT_MEMORY_BUDGET,
|
|
1653
|
-
|
|
1658
|
+
Pe as DEFAULT_PHONE_REGION,
|
|
1654
1659
|
zn as FEATURE_FOLDER_MANAGEMENT,
|
|
1655
1660
|
Yn as FEATURE_REMOTE_SEARCH,
|
|
1656
1661
|
ti as INSTALLATION_HEADER,
|
|
@@ -1688,7 +1693,7 @@ export {
|
|
|
1688
1693
|
f as activityTypeInfo,
|
|
1689
1694
|
Zt as actorKey,
|
|
1690
1695
|
nt as aiAttachmentKind,
|
|
1691
|
-
|
|
1696
|
+
Pn as aiAttachmentRejection,
|
|
1692
1697
|
pn as aiVendorAcceptsAttachment,
|
|
1693
1698
|
ln as aiVendorDefaultModel,
|
|
1694
1699
|
sn as aiVendorLabel,
|
|
@@ -1709,7 +1714,7 @@ export {
|
|
|
1709
1714
|
$n as cleanMessageText,
|
|
1710
1715
|
Re as defaultLocaleOf,
|
|
1711
1716
|
Xn as defineIntent,
|
|
1712
|
-
|
|
1717
|
+
Un as disabledIntentsFromCapabilities,
|
|
1713
1718
|
Nn as emailDomain,
|
|
1714
1719
|
kn as endpointKey,
|
|
1715
1720
|
mt as extractParams,
|
|
@@ -1717,7 +1722,7 @@ export {
|
|
|
1717
1722
|
Gn as filterByIntent,
|
|
1718
1723
|
st as filterByTargetScheme,
|
|
1719
1724
|
E as findAiVendor,
|
|
1720
|
-
|
|
1725
|
+
Pt as flattenLocales,
|
|
1721
1726
|
fe as floorToPeriod,
|
|
1722
1727
|
ve as formatActingIdentity,
|
|
1723
1728
|
de as formatPeriod,
|
|
@@ -1733,6 +1738,7 @@ export {
|
|
|
1733
1738
|
An as isInteractionUnseen,
|
|
1734
1739
|
On as isLikelyBulk,
|
|
1735
1740
|
Mt as isMessageType,
|
|
1741
|
+
ht as isMoreSpecificPattern,
|
|
1736
1742
|
tn as isPaused,
|
|
1737
1743
|
xt as isPlaybookAuthoredType,
|
|
1738
1744
|
vn as isPublicEmailDomain,
|
|
@@ -1753,7 +1759,7 @@ export {
|
|
|
1753
1759
|
ie as normalizeEmail,
|
|
1754
1760
|
Jt as parseActingIdentity,
|
|
1755
1761
|
ft as pathToRegex,
|
|
1756
|
-
|
|
1762
|
+
Ut as periodsInRange,
|
|
1757
1763
|
Cn as phoneSuffix,
|
|
1758
1764
|
Ln as plainTextFromMarkdown,
|
|
1759
1765
|
Qt as playbookActor,
|
|
@@ -8,6 +8,18 @@ export interface RouteDefinition {
|
|
|
8
8
|
resource: string;
|
|
9
9
|
/** If true, the path must match exactly. */
|
|
10
10
|
exact?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Fixed props handed to the resource on top of the path parameters.
|
|
13
|
+
*
|
|
14
|
+
* Lets one component serve several routes without the viewport having to
|
|
15
|
+
* remount a different resource per URL — which is what makes navigating
|
|
16
|
+
* between them flash. Two paths that produce the same parameters (a list and
|
|
17
|
+
* its `/search` sibling, say) stay distinguishable because the route says
|
|
18
|
+
* which one it is.
|
|
19
|
+
*
|
|
20
|
+
* Path parameters win on a name collision: those come from the URL.
|
|
21
|
+
*/
|
|
22
|
+
props?: Record<string, string>;
|
|
11
23
|
/**
|
|
12
24
|
* Readable without a session. The shell skips its bounce to the login screen
|
|
13
25
|
* for these paths and renders them without any chrome.
|
|
@@ -66,6 +78,8 @@ export interface PublicRoutePattern {
|
|
|
66
78
|
resource: string;
|
|
67
79
|
/** Absolute pattern, e.g. `/help/:hcSlug/:locale`. */
|
|
68
80
|
pattern: string;
|
|
81
|
+
/** See {@link RouteDefinition.props}. */
|
|
82
|
+
props?: Record<string, string>;
|
|
69
83
|
}
|
|
70
84
|
export interface PublicRouteMatch extends PublicRoutePattern {
|
|
71
85
|
params: Record<string, string>;
|
|
@@ -74,6 +88,19 @@ export interface PublicRouteMatch extends PublicRoutePattern {
|
|
|
74
88
|
export declare function publicBasePathFor(app: PublicRouteSource): string;
|
|
75
89
|
/** Every public route across the installed apps, as absolute patterns. */
|
|
76
90
|
export declare function publicRoutePatterns(apps: Iterable<PublicRouteSource>): PublicRoutePattern[];
|
|
91
|
+
/**
|
|
92
|
+
* Is `a` a more specific pattern than `b`?
|
|
93
|
+
*
|
|
94
|
+
* Segment by segment, a literal beats a parameter: `/help/:hc/:locale/search`
|
|
95
|
+
* has to win over `/help/:hc/:locale/:collection`, or a help centre can never
|
|
96
|
+
* have a search page. Comparing string lengths would get exactly that case
|
|
97
|
+
* backwards, since `:collection` is the longer text.
|
|
98
|
+
*
|
|
99
|
+
* Exported because the shell asks the same question about `/apps/{name}` routes.
|
|
100
|
+
* It used to answer it with "whichever matched last", so a declared `/create`
|
|
101
|
+
* lost to the `/:id` below it — the opposite of what the author wrote down.
|
|
102
|
+
*/
|
|
103
|
+
export declare function isMoreSpecificPattern(a: string, b: string): boolean;
|
|
77
104
|
/**
|
|
78
105
|
* The public route this path lands on, or null.
|
|
79
106
|
*
|