@aquera/data-visualizer-sdk 0.0.45 → 0.0.46

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.
@@ -1,4 +1,4 @@
1
- import{$ as un,A as Jt,B as Zt,Ba as $e,C as en,D as tn,E as nn,F as on,Fa as We,H as an,J as rn,K as ae,L as ln,La as Be,Ma as Ue,N as ge,Na as Ge,Oa as je,Pa as He,Q as sn,Qa as Ye,Ra as Ke,S as dn,Sa as Qe,T as cn,Ta as In,U as pn,Ua as pt,W as ze,Wa as Vn,Xa as Rn,Y as _n,Ya as zn,Za as Nn,_ as gn,_a as Ln,a as qt,aa as Ne,b as Dt,ba as mn,c as Wt,ca as Pe,cb as $n,da as dt,db as Wn,ea as ct,eb as Bn,f as Bt,fa as hn,fb as Un,ga as Cn,gb as ue,h as Ut,ha as fn,ia as xn,ib as Gn,ja as yn,k as Gt,ka as bn,l as oe,la as vn,m as _e,ma as wn,n as jt,na as kn,o as Ht,oa as Pn,ob as _t,q as Yt,qa as An,qb as jn,r as st,ra as Mn,s as Kt,sa as Le,t as Qt,ta as Sn,ua as Tn,ub as Hn,va as qn,vb as gt,w as Xt,wa as Dn,wb as Yn,xa as Fn,ya as On,z as ee,za as En}from"./chunk-LURZSUBG.js";import{Db as Ce,Eb as k,Ib as u,Kb as r,La as ot,Ma as Ve,Na as l,Nb as Vt,O as ie,Ob as fe,Pb as xe,Sb as de,T as N,Tb as Z,Ub as W,Vb as at,Wb as c,Xb as y,Y as _,Yb as q,Z as g,Zb as Y,_b as Rt,ca as Ft,eb as we,ec as zt,fa as Ot,fc as pe,gc as rt,hc as Nt,ia as Et,ja as f,jb as ke,jc as Lt,kc as Re,ma as he,ob as It,oc as $t,p as E,pb as M,pc as D,qb as m,ra as Ie,rb as h,sb as G,sc as Te,tc as lt,ub as F,vb as O,wb as b,xb as s,yb as d,zb as C}from"./chunk-BTA57TVR.js";import{a as w,b as T,d as Ee}from"./chunk-ZW5NV4UO.js";function zi(){return{filters:!0,undoRedo:!0,widgetSelection:!0,publishAsDashboard:!0,addToDashboard:!0}}function Ni(){return{enabled:!0,dataset:!0,pipeline:!0}}function Li(){return{enabled:!0,ask:!0,changeChartType:!0,manageFilters:!0,customizeColors:!0,chartData:!0,setAlert:!0,forecast:!0,addToStory:!1,exportPng:!0,exportCsv:!0,print:!0,tweak:!0,edit:!0,delete:!0}}function Kn(){return{baseUrl:ee.baseUrl??"",mcpUrl:ee.MCP_URL??"",adminApiUrl:ee.ADMIN_API_URL??"",utilitiesUrl:ee.UTILITIES_ENGINE_URL??"",proxyUrl:ee.PROXY_BASEAPI_URL??"",tokenizedOrigins:[ee.baseUrl,ee.ADMIN_API_URL,ee.MCP_URL,ee.UTILITIES_ENGINE_URL,ee.PROXY_BASEAPI_URL].filter(i=>!!i),headers:{},customerId:null,productId:null,productName:null,authMode:"inherit",authToken:null,getToken:null,onUnauthorized:null,ssoEnabled:ee.SSO_ENABLED??!1,features:{mcpGateway:ee.MCP_GATEWAY_ENABLED??!1,forecast:!0,connections:!0,attachments:!0,stories:!1,promptGallery:!0,xray:!0,welcomePrompts:!0,dashboardsMenu:!0,executiveSummary:!0,alerts:!0,library:!0,tools:!0,chat:!0,widgetMenu:Li(),scopePicker:Ni(),canvas:zi()},ui:{theme:"light",density:"comfortable",header:!0,locale:"en"},copy:$i(),routing:"none",initial:{dashboardId:null,conversationId:null,summary:!1},chatDefaults:{indexName:null,planningMode:!0}}}function $i(){return{composerPlaceholder:"Ask anything about your workforce data\u2026",welcomeTitle:"What would you like to ask?",welcomeSubtitle:"Ask anything about your workforce data.",dropFilesOverlay:"Drop images or Excel files to attach",replyButton:"Reply",defineItButton:"Define it",submitAnswersButton:"Submit answers",givePlanButton:"Give me the plan \u2192",somethingElseButton:"Something else? Tell me what to do \u2192",chatDraftPlaceholderWidget:"Tell me what to check instead\u2026",chatDraftPlaceholderClarification:"Tell me more\u2026",chatDraftPlaceholderPlan:"Tell me what to change about this widget\u2026",chatDraftPlaceholderIntake:"Type your own answer\u2026",filterValuePlaceholder:"Value\u2026",promptGallerySearchPlaceholder:"Search prompts\u2026",promptGalleryLabel:"Prompt gallery",xrayLabel:"X-ray a dataset",xrayDrawerTitle:"X-ray a dataset",xrayDatasetLabel:"Dataset",xrayEntitySearchPlaceholder:"Search tables and indexes\u2026",xrayTopicPlaceholder:"Optional \u2014 what should this dashboard show?",xrayRunLabel:"X-ray this",xrayNoSources:"No data sources are configured yet.",xrayNoEntities:"Nothing to x-ray on this data source.",xrayNoEntitiesMatch:"No tables or indexes match",xrayLoadingSources:"Loading data sources\u2026",xrayLoadingEntities:"Loading tables\u2026",xrayAnalyzing:"Analyzing this data\u2026",xrayBuilding:"Building your dashboard\u2026",xrayFailed:"The x-ray could not be completed.",xrayPickHint:"Pick one to build a dashboard",xrayFieldsLabel:"fields",xrayTablesNoun:"tables",xrayIndexesNoun:"indexes",xrayFocusToggle:"Add a focus (optional)",noPromptsMatch:"No prompts match",noPromptsYet:"No prompts yet.",noChoiceOptions:"No options available to choose from.",noChartTypesFit:"No other chart types fit this widget's data.",noFilterableFields:"No filterable fields found for this chart's data.",dashboardNamePlaceholder:"Enter a name\u2026",saveDashboardDialogLabel:"Save as dashboard",saveDashboardButton:"Save dashboard",cancelButton:"Cancel",applyButton:"Apply",forecastSettingsLabel:"Forecast settings",forecastButton:"Forecast",removeForecastButton:"Remove forecast",newConversationLabel:"New conversation",newDashboardLabel:"New dashboard",noConversationsYet:"No conversations yet",noDashboardsYet:"No dashboards yet",searchConversationsPlaceholder:"Search conversations\u2026",searchDashboardsPlaceholder:"Search dashboards\u2026",noResultsMatchFilters:"No results match your filters",renameLabel:"Rename",deleteLabel:"Delete",groupToday:"Today",groupYesterday:"Yesterday",groupPrevious7Days:"Previous 7 days",groupOlder:"Older",noDatasetsFound:"No datasets found",noPipelinesFound:"No pipelines found",createAlertButton:"Create alert",addToLibraryButton:"Add to library",addToDashboardButton:"Add to dashboard",addToCurrentDashboardButton:"Add to current dashboard",addToStoryButton:"Add to Story",publishAsDashboardButton:"Publish as a new dashboard",viewButton:"View",recomputeButton:"Recompute",chatTabLabel:"Conversation",libraryTabLabel:"Library",toolsTabLabel:"Tools",cohortBuilderTitle:"Build a cohort",cohortBuilderSubtitle:"Two steps \u2014 pick a criterion, then review who matches.",cohortStep1Label:"Choose a criterion",cohortStep2Label:"Review matches",cohortMatchSummary:"{matchCount} people match, of {totalCount} in the log",cohortViewAllLink:"View all {matchCount} \u2192",cohortShowFewerLink:"Show fewer",cohortMatchesTruncatedNote:"Showing the first {shown} of {matchCount}.",cohortPreviewWidgetButton:"Preview widget",cohortAddToCanvasDisclaimer:"Adds this cohort directly to the canvas \u2014 it is not saved to the widget library.",cohortAddToCanvasButton:"Add to canvas",cohortDetailCaption:"1 criterion \xB7 live membership \xB7 derived from the Aquera log",cohortDetailCoverage:"scanned {events} events across {systems} systems",cohortExportRowsButton:"Export rows (CSV)",cohortCopyDefinitionButton:"Copy definition",cohortEmptyMatchesMessage:"No identities in the log currently match this criterion.",cohortPreviewErrorMessage:"Couldn't load matches for this criterion.",cohortPreviewRetryButton:"Retry",cohortCriteriaErrorMessage:"Couldn't load the criteria list.",cohortLogUnavailableMessage:"This tenant has no identity log yet, so cohorts cannot be built here. Connect a source system to start recording identity events.",cohortNamesWithheldMessage:"Names are not available for this cohort.",cohortMembersForbiddenMessage:"You do not have access to the names in this cohort.",cohortMembersErrorMessage:"Couldn't load the full list.",cohortCopyDefinitionConfirmation:"Cohort definition copied to clipboard",detailCanvasCrumbLabel:"Canvas",detailDashboardCrumbLabel:"Dashboard",detailCrumbLabel:"Detail",libraryIntroTitle:"Start from a pre-canned widget or dashboard",libraryIntro:"\u2014 pick what you need, then refine it on the canvas.",libraryWidgetsTabLabel:"Widgets",libraryDashboardsTabLabel:"Dashboards",librarySearchWidgetsPlaceholder:"Search widgets\u2026",librarySearchDashboardsPlaceholder:"Search dashboards\u2026",libraryAllCategoryLabel:"All",librarySelectAllButton:"Select all",libraryClearSelectionButton:"Clear",librarySelectedCount:"{n} selected",libraryAddToCanvasButton:"Add {n} to canvas",libraryWidgetCountChip:"{n} widgets",noWidgetsMatch:"No widgets match your search.",noWidgetsInCategory:"No widgets in this category yet.",noDashboardsMatch:"No dashboards match your search.",noDashboardsInCategory:"No dashboards in this category yet.",emptyCanvasTitle:"Your canvas is empty",emptyCanvasSubtitle:"Add widgets or a whole dashboard from the Library \u2014 or ask a question in Chat.",connectionsTitle:"Connections",connectionsBreadcrumbHome:"Ask Aquera",registerConnectionTitle:"Register connection",registerConnectionButton:"Register connection",registerAndTestButton:"Register & test",registeringButton:"Registering\u2026",testConnectionButton:"Test",loadingConnections:"Loading connections\u2026",noConnectionsTitle:"No connections yet",noConnectionsSub:"Register a connection to start using Ask Aquera with your data source.",connectionNamePlaceholder:"Primary",displayNamePlaceholder:"My workforce data",errors:{assistantErrorFallback:"Failed to generate a response. Please try again.",connectionTestFailedFallback:"Connection failed",couldntForecastWidget:"Couldn't forecast this widget.",couldntLoadDatasetsOrPipelines:"Failed to load datasets / pipelines",couldntOpenConversation:"Couldn't open that conversation. Please try again.",couldntDeleteConversation:"Couldn't delete that conversation. Please try again.",couldntCreateDashboard:"Couldn't create the dashboard. Please try again.",couldntRenameConversation:"Couldn't rename that conversation. Please try again.",tooManyExcelAttachments:"You can attach up to 10 Excel files.",tooManyNonExcelAttachments:"You can attach only one non-Excel file.",unsupportedFileType:"isn't a supported file type.",fileTooLarge:"is larger than 10 MB.",couldntUpdateForecast:"Couldn't update that forecast. Please try again.",couldntSaveToLibrary:"Couldn't save that to your widget library. Please try again.",couldntApplyFilter:"Couldn't apply that filter. Please try again.",couldntAddToDashboard:"Couldn't add this to the dashboard. Please try again.",couldntPublishDashboard:"Couldn't publish the dashboard. Please try again.",couldntRenameDashboard:"Couldn't rename the dashboard. Please try again.",couldntDeleteDashboard:"Couldn't delete that dashboard. Please try again.",couldntGenerateSummary:"Failed to generate summary.",couldntSaveDashboard:"Couldn't save the dashboard. Please try again.",chartTypeChangeFailed:"Chart type change failed"}}}var Qn=Qt("dvz-ask",Kn);function I(){return Qn.read()}function ut(i){let t=Kn(),e=T(w(w({},t),re(i)),{features:T(w(w({},t.features),re(i.features??{})),{widgetMenu:w(w({},t.features.widgetMenu),re(i.features?.widgetMenu??{})),scopePicker:w(w({},t.features.scopePicker),re(i.features?.scopePicker??{})),canvas:w(w({},t.features.canvas),re(i.features?.canvas??{}))}),ui:w(w({},t.ui),re(i.ui??{})),copy:T(w(w({},t.copy),re(i.copy??{})),{errors:w(w({},t.copy.errors),re(i.copy?.errors??{}))}),initial:w(w({},t.initial),re(i.initial??{})),chatDefaults:w(w({},t.chatDefaults),re(i.chatDefaults??{})),headers:w(w({},t.headers),i.headers??{})});return i.tokenizedOrigins||(e.tokenizedOrigins=[e.baseUrl,e.adminApiUrl,e.mcpUrl,e.utilitiesUrl,e.proxyUrl].filter(n=>!!n)),Qn.write(e)}async function Ae(){return Xt(I())}function Xn(i,t){return i.replace("{n}",String(t))}function re(i){let t={};for(let[e,n]of Object.entries(i))n!==void 0&&(t[e]=n);return t}var ye=class i{http=N(_e);tokenStore=N(ae);get customerId(){return I().customerId??this.tokenStore.tenantId()??""}async fetchGridPage(t,e,n,o,a,p,x,v){let A=`${I().baseUrl}/api/customers/${this.customerId}/products/${ge()}/workforce/data-grid/${t}?pageIndex=${e}&pageSize=${n}`,S=(o??[]).filter(P=>P&&P.value!=null&&String(P.value).trim()!=="");return S.length&&(A+=`&filters=${encodeURIComponent(JSON.stringify(S))}`),a&&Object.keys(a).length&&(A+=`&dashboardFilters=${encodeURIComponent(JSON.stringify(a))}`),x&&x.length&&(A+=`&resolvedFilters=${encodeURIComponent(JSON.stringify(x))}`),p&&(A+=`&dashboardId=${encodeURIComponent(p)}`),v&&(A+=`&conversationId=${encodeURIComponent(v)}`),E(this.http.get(A))}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ie({token:i,factory:i.\u0275fac,providedIn:"root"})};var mt=["image/png","image/jpeg","image/webp","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"],Jn=10*1024*1024,ht=1,Ct=10,Wi=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"];function ft(i,t){return Wi.includes(t)||/\.(xls|xlsx)$/i.test(i)}var me=class i{http=N(_e);tokenStore=N(ae);async bearer(){return await Ae()??await rn()??this.tokenStore.accessToken()??""}lastSentCustomerId=null;lastSentProductId=null;get customerId(){return I().customerId??this.tokenStore.tenantId()??""}get productId(){return I().productId??ge()}get baseUrl(){return`${I().baseUrl}/api/customers/${this.customerId}/products/${this.productId}/workforce`}mcpGatewayUrl(){return`${I().baseUrl}/dviz-mcp`}async callMcpTool(t,e={},n){let o=this.customerId,a=this.productId,p=w({},n);o!==this.lastSentCustomerId&&(p.customerId=o),a!==this.lastSentProductId&&(p.productId=a);let x;try{x=await E(this.http.post(this.mcpGatewayUrl(),{jsonrpc:"2.0",id:Date.now(),method:"tools/call",params:{name:t,arguments:e}},{headers:{Accept:"application/json, text/event-stream"},params:p})),this.lastSentCustomerId=o,this.lastSentProductId=a}catch(A){throw A instanceof oe?new Error(A.error?.error?.message||A.error?.message||A.message):A}if(x.error)throw new Error(x.error.message);let v=x.result;if(v?.isError)throw new Error(v.structuredContent?.error?.message??v.content?.[0]?.text??`${t} failed`);return v?.structuredContent??{}}async listConversations(t=30){return!this.customerId||!this.productId?[]:I().features.mcpGateway?(await this.callMcpTool("listConversations",{limit:t,status:"active"}))?.conversations??[]:(await E(this.http.get(`${this.baseUrl}/conversations?limit=${t}&status=active`)))?.data??[]}async getConversation(t){if(!t)return null;if(!I().features.mcpGateway){let x=await E(this.http.get(`${this.baseUrl}/conversations/${t}`));if(!x?.data)return null;let a=x.data,{messages:v}=a;return{conversation:Ee(a,["messages"]),messages:v??[]}}let e=await this.callMcpTool("getConversation",{conversationId:t});if(!e?.conversation)return null;let p=e.conversation,{messages:n}=p;return{conversation:Ee(p,["messages"]),messages:n??[]}}async updateConversation(t,e){await E(this.http.patch(`${this.baseUrl}/conversations/${t}`,e))}async deleteConversation(t){if(!I().features.mcpGateway){await E(this.http.delete(`${this.baseUrl}/conversations/${t}`));return}await this.callMcpTool("deleteConversation",{conversationId:t})}async streamChat(t,e,n,o,a,p,x,v){return p?.length||!I().features.mcpGateway?this.streamChatViaSse(t,e,n,o,a,p,x,v):this.sendChatViaGateway(t,e,n,o,a)}async sendChatViaGateway(t,e,n,o,a){let p={message:e};t&&(p.conversationId=t),o&&(p.connectionId=o);let x=Date.now(),v=new URL(this.mcpGatewayUrl());v.searchParams.set("customerId",this.customerId),v.searchParams.set("productId",this.productId);let A=await this.bearer(),S=!1,P=!1,z=R=>{switch(S=!0,R?.kind){case"text":n.onText(R.text??"");break;case"toolCall":n.onToolStart(R.toolId,R.uiLabel??"");break;case"toolResult":n.onToolResult(R.toolId,R.uiDetail??"",!!R.error);break;case"data":{let V=R.payload;V?.data_type==="adhoc_viz"?n.onDataPart(V):V?.data_type==="dashboard_title"?n.onDashboardTitle?.(V.data?.title??""):V?.data_type==="choice"?n.onChoice?.(V.data):V?.data_type==="layout_patch"&&n.onLayoutPatch?.(V.data);break}case"error":n.onError(R.message??"Unknown error");break}},Q=R=>{if(R?.isError){let $=R.structuredContent?.error?.message??R.content?.[0]?.text??"askAquera failed";n.onError($),n.onFinish("error",t??""),P=!0;return}let V=R?.structuredContent??{};if(!S){n.onText(V.responseText??V.text??""),V.dashboardTitle&&n.onDashboardTitle?.(V.dashboardTitle);let $=V.widget?[V.widget]:V.widgets??[];for(let j of $)n.onDataPart({type:"data",data_type:"adhoc_viz",version:1,data:j})}n.onFinish("stop",V.conversationId??t??""),P=!0},U=R=>{if(R.method==="notifications/gateway/stream"){z(R.params??{});return}if(R.id===x){if(R.error){n.onError(R.error.message??"askAquera failed"),n.onFinish("error",t??""),P=!0;return}Q(R.result)}},K;try{K=await fetch(v.toString(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream",Authorization:`Bearer ${A}`},body:JSON.stringify({jsonrpc:"2.0",id:x,method:"tools/call",params:{name:"askAquera",arguments:p}}),signal:a})}catch(R){if(R instanceof DOMException&&R.name==="AbortError")throw R;n.onError(R instanceof Error?R.message:String(R)),n.onFinish("error",t??"");return}if(!K.ok){let R=await K.text().catch(()=>K.statusText);n.onError(`Request failed (${K.status}): ${R}`),n.onFinish("error",t??"");return}if(!(K.headers.get("content-type")??"").includes("text/event-stream")||!K.body){let R=await K.json().catch(()=>null);if(!R){n.onError("Invalid response from server"),n.onFinish("error",t??"");return}U(R);return}let ne=K.body.getReader(),L=new TextDecoder,J="";for(;;){let{done:R,value:V}=await ne.read();if(R)break;J+=L.decode(V,{stream:!0});let $=J.split(`
1
+ import{$ as un,A as Jt,B as Zt,Ba as $e,C as en,D as tn,E as nn,F as on,Fa as We,H as an,J as rn,K as ae,L as ln,La as Be,Ma as Ue,N as ge,Na as Ge,Oa as je,Pa as He,Q as sn,Qa as Ye,Ra as Ke,S as dn,Sa as Qe,T as cn,Ta as In,U as pn,Ua as pt,W as ze,Wa as Vn,Xa as Rn,Y as _n,Ya as zn,Za as Nn,_ as gn,_a as Ln,a as qt,aa as Ne,b as Dt,ba as mn,c as Wt,ca as Pe,cb as $n,da as dt,db as Wn,ea as ct,eb as Bn,f as Bt,fa as hn,fb as Un,ga as Cn,gb as ue,h as Ut,ha as fn,ia as xn,ib as Gn,ja as yn,k as Gt,ka as bn,l as oe,la as vn,m as _e,ma as wn,n as jt,na as kn,o as Ht,oa as Pn,ob as _t,q as Yt,qa as An,qb as jn,r as st,ra as Mn,s as Kt,sa as Le,t as Qt,ta as Sn,ua as Tn,ub as Hn,va as qn,vb as gt,w as Xt,wa as Dn,wb as Yn,xa as Fn,ya as On,z as ee,za as En}from"./chunk-HTTPZ3M2.js";import{Db as Ce,Eb as k,Ib as u,Kb as r,La as ot,Ma as Ve,Na as l,Nb as Vt,O as ie,Ob as fe,Pb as xe,Sb as de,T as N,Tb as Z,Ub as W,Vb as at,Wb as c,Xb as y,Y as _,Yb as q,Z as g,Zb as Y,_b as Rt,ca as Ft,eb as we,ec as zt,fa as Ot,fc as pe,gc as rt,hc as Nt,ia as Et,ja as f,jb as ke,jc as Lt,kc as Re,ma as he,ob as It,oc as $t,p as E,pb as M,pc as D,qb as m,ra as Ie,rb as h,sb as G,sc as Te,tc as lt,ub as F,vb as O,wb as b,xb as s,yb as d,zb as C}from"./chunk-BTA57TVR.js";import{a as w,b as T,d as Ee}from"./chunk-ZW5NV4UO.js";function zi(){return{filters:!0,undoRedo:!0,widgetSelection:!0,publishAsDashboard:!0,addToDashboard:!0}}function Ni(){return{enabled:!0,dataset:!0,pipeline:!0}}function Li(){return{enabled:!0,ask:!0,changeChartType:!0,manageFilters:!0,customizeColors:!0,chartData:!0,setAlert:!0,forecast:!0,addToStory:!1,exportPng:!0,exportCsv:!0,print:!0,tweak:!0,edit:!0,delete:!0}}function Kn(){return{baseUrl:ee.baseUrl??"",mcpUrl:ee.MCP_URL??"",adminApiUrl:ee.ADMIN_API_URL??"",utilitiesUrl:ee.UTILITIES_ENGINE_URL??"",proxyUrl:ee.PROXY_BASEAPI_URL??"",tokenizedOrigins:[ee.baseUrl,ee.ADMIN_API_URL,ee.MCP_URL,ee.UTILITIES_ENGINE_URL,ee.PROXY_BASEAPI_URL].filter(i=>!!i),headers:{},customerId:null,productId:null,productName:null,authMode:"inherit",authToken:null,getToken:null,onUnauthorized:null,ssoEnabled:ee.SSO_ENABLED??!1,features:{mcpGateway:ee.MCP_GATEWAY_ENABLED??!1,forecast:!0,connections:!0,attachments:!0,stories:!1,promptGallery:!0,xray:!0,welcomePrompts:!0,dashboardsMenu:!0,executiveSummary:!0,alerts:!0,library:!0,tools:!0,chat:!0,widgetMenu:Li(),scopePicker:Ni(),canvas:zi()},ui:{theme:"light",density:"comfortable",header:!0,locale:"en"},copy:$i(),routing:"none",initial:{dashboardId:null,conversationId:null,summary:!1},chatDefaults:{indexName:null,planningMode:!0}}}function $i(){return{composerPlaceholder:"Ask anything about your workforce data\u2026",welcomeTitle:"What would you like to ask?",welcomeSubtitle:"Ask anything about your workforce data.",dropFilesOverlay:"Drop images or Excel files to attach",replyButton:"Reply",defineItButton:"Define it",submitAnswersButton:"Submit answers",givePlanButton:"Give me the plan \u2192",somethingElseButton:"Something else? Tell me what to do \u2192",chatDraftPlaceholderWidget:"Tell me what to check instead\u2026",chatDraftPlaceholderClarification:"Tell me more\u2026",chatDraftPlaceholderPlan:"Tell me what to change about this widget\u2026",chatDraftPlaceholderIntake:"Type your own answer\u2026",filterValuePlaceholder:"Value\u2026",promptGallerySearchPlaceholder:"Search prompts\u2026",promptGalleryLabel:"Prompt gallery",xrayLabel:"X-ray a dataset",xrayDrawerTitle:"X-ray a dataset",xrayDatasetLabel:"Dataset",xrayEntitySearchPlaceholder:"Search tables and indexes\u2026",xrayTopicPlaceholder:"Optional \u2014 what should this dashboard show?",xrayRunLabel:"X-ray this",xrayNoSources:"No data sources are configured yet.",xrayNoEntities:"Nothing to x-ray on this data source.",xrayNoEntitiesMatch:"No tables or indexes match",xrayLoadingSources:"Loading data sources\u2026",xrayLoadingEntities:"Loading tables\u2026",xrayAnalyzing:"Analyzing this data\u2026",xrayBuilding:"Building your dashboard\u2026",xrayFailed:"The x-ray could not be completed.",xrayPickHint:"Pick one to build a dashboard",xrayFieldsLabel:"fields",xrayTablesNoun:"tables",xrayIndexesNoun:"indexes",xrayFocusToggle:"Add a focus (optional)",noPromptsMatch:"No prompts match",noPromptsYet:"No prompts yet.",noChoiceOptions:"No options available to choose from.",noChartTypesFit:"No other chart types fit this widget's data.",noFilterableFields:"No filterable fields found for this chart's data.",dashboardNamePlaceholder:"Enter a name\u2026",saveDashboardDialogLabel:"Save as dashboard",saveDashboardButton:"Save dashboard",cancelButton:"Cancel",applyButton:"Apply",forecastSettingsLabel:"Forecast settings",forecastButton:"Forecast",removeForecastButton:"Remove forecast",newConversationLabel:"New conversation",newDashboardLabel:"New dashboard",noConversationsYet:"No conversations yet",noDashboardsYet:"No dashboards yet",searchConversationsPlaceholder:"Search conversations\u2026",searchDashboardsPlaceholder:"Search dashboards\u2026",noResultsMatchFilters:"No results match your filters",renameLabel:"Rename",deleteLabel:"Delete",groupToday:"Today",groupYesterday:"Yesterday",groupPrevious7Days:"Previous 7 days",groupOlder:"Older",noDatasetsFound:"No datasets found",noPipelinesFound:"No pipelines found",createAlertButton:"Create alert",addToLibraryButton:"Add to library",addToDashboardButton:"Add to dashboard",addToCurrentDashboardButton:"Add to current dashboard",addToStoryButton:"Add to Story",publishAsDashboardButton:"Publish as a new dashboard",viewButton:"View",recomputeButton:"Recompute",chatTabLabel:"Conversation",libraryTabLabel:"Library",toolsTabLabel:"Tools",cohortBuilderTitle:"Build a cohort",cohortBuilderSubtitle:"Two steps \u2014 pick a criterion, then review who matches.",cohortStep1Label:"Choose a criterion",cohortStep2Label:"Review matches",cohortMatchSummary:"{matchCount} people match, of {totalCount} in the log",cohortViewAllLink:"View all {matchCount} \u2192",cohortShowFewerLink:"Show fewer",cohortMatchesTruncatedNote:"Showing the first {shown} of {matchCount}.",cohortPreviewWidgetButton:"Preview widget",cohortAddToCanvasDisclaimer:"Adds this cohort directly to the canvas \u2014 it is not saved to the widget library.",cohortAddToCanvasButton:"Add to canvas",cohortDetailCaption:"1 criterion \xB7 live membership \xB7 derived from the Aquera log",cohortDetailCoverage:"scanned {events} events across {systems} systems",cohortExportRowsButton:"Export rows (CSV)",cohortCopyDefinitionButton:"Copy definition",cohortEmptyMatchesMessage:"No identities in the log currently match this criterion.",cohortPreviewErrorMessage:"Couldn't load matches for this criterion.",cohortPreviewRetryButton:"Retry",cohortCriteriaErrorMessage:"Couldn't load the criteria list.",cohortLogUnavailableMessage:"This tenant has no identity log yet, so cohorts cannot be built here. Connect a source system to start recording identity events.",cohortNamesWithheldMessage:"Names are not available for this cohort.",cohortMembersForbiddenMessage:"You do not have access to the names in this cohort.",cohortMembersErrorMessage:"Couldn't load the full list.",cohortCopyDefinitionConfirmation:"Cohort definition copied to clipboard",detailCanvasCrumbLabel:"Canvas",detailDashboardCrumbLabel:"Dashboard",detailCrumbLabel:"Detail",libraryIntroTitle:"Start from a pre-canned widget or dashboard",libraryIntro:"\u2014 pick what you need, then refine it on the canvas.",libraryWidgetsTabLabel:"Widgets",libraryDashboardsTabLabel:"Dashboards",librarySearchWidgetsPlaceholder:"Search widgets\u2026",librarySearchDashboardsPlaceholder:"Search dashboards\u2026",libraryAllCategoryLabel:"All",librarySelectAllButton:"Select all",libraryClearSelectionButton:"Clear",librarySelectedCount:"{n} selected",libraryAddToCanvasButton:"Add {n} to canvas",libraryWidgetCountChip:"{n} widgets",noWidgetsMatch:"No widgets match your search.",noWidgetsInCategory:"No widgets in this category yet.",noDashboardsMatch:"No dashboards match your search.",noDashboardsInCategory:"No dashboards in this category yet.",emptyCanvasTitle:"Your canvas is empty",emptyCanvasSubtitle:"Add widgets or a whole dashboard from the Library \u2014 or ask a question in Chat.",connectionsTitle:"Connections",connectionsBreadcrumbHome:"Ask Aquera",registerConnectionTitle:"Register connection",registerConnectionButton:"Register connection",registerAndTestButton:"Register & test",registeringButton:"Registering\u2026",testConnectionButton:"Test",loadingConnections:"Loading connections\u2026",noConnectionsTitle:"No connections yet",noConnectionsSub:"Register a connection to start using Ask Aquera with your data source.",connectionNamePlaceholder:"Primary",displayNamePlaceholder:"My workforce data",errors:{assistantErrorFallback:"Failed to generate a response. Please try again.",connectionTestFailedFallback:"Connection failed",couldntForecastWidget:"Couldn't forecast this widget.",couldntLoadDatasetsOrPipelines:"Failed to load datasets / pipelines",couldntOpenConversation:"Couldn't open that conversation. Please try again.",couldntDeleteConversation:"Couldn't delete that conversation. Please try again.",couldntCreateDashboard:"Couldn't create the dashboard. Please try again.",couldntRenameConversation:"Couldn't rename that conversation. Please try again.",tooManyExcelAttachments:"You can attach up to 10 Excel files.",tooManyNonExcelAttachments:"You can attach only one non-Excel file.",unsupportedFileType:"isn't a supported file type.",fileTooLarge:"is larger than 10 MB.",couldntUpdateForecast:"Couldn't update that forecast. Please try again.",couldntSaveToLibrary:"Couldn't save that to your widget library. Please try again.",couldntApplyFilter:"Couldn't apply that filter. Please try again.",couldntAddToDashboard:"Couldn't add this to the dashboard. Please try again.",couldntPublishDashboard:"Couldn't publish the dashboard. Please try again.",couldntRenameDashboard:"Couldn't rename the dashboard. Please try again.",couldntDeleteDashboard:"Couldn't delete that dashboard. Please try again.",couldntGenerateSummary:"Failed to generate summary.",couldntSaveDashboard:"Couldn't save the dashboard. Please try again.",chartTypeChangeFailed:"Chart type change failed"}}}var Qn=Qt("dvz-ask",Kn);function I(){return Qn.read()}function ut(i){let t=Kn(),e=T(w(w({},t),re(i)),{features:T(w(w({},t.features),re(i.features??{})),{widgetMenu:w(w({},t.features.widgetMenu),re(i.features?.widgetMenu??{})),scopePicker:w(w({},t.features.scopePicker),re(i.features?.scopePicker??{})),canvas:w(w({},t.features.canvas),re(i.features?.canvas??{}))}),ui:w(w({},t.ui),re(i.ui??{})),copy:T(w(w({},t.copy),re(i.copy??{})),{errors:w(w({},t.copy.errors),re(i.copy?.errors??{}))}),initial:w(w({},t.initial),re(i.initial??{})),chatDefaults:w(w({},t.chatDefaults),re(i.chatDefaults??{})),headers:w(w({},t.headers),i.headers??{})});return i.tokenizedOrigins||(e.tokenizedOrigins=[e.baseUrl,e.adminApiUrl,e.mcpUrl,e.utilitiesUrl,e.proxyUrl].filter(n=>!!n)),Qn.write(e)}async function Ae(){return Xt(I())}function Xn(i,t){return i.replace("{n}",String(t))}function re(i){let t={};for(let[e,n]of Object.entries(i))n!==void 0&&(t[e]=n);return t}var ye=class i{http=N(_e);tokenStore=N(ae);get customerId(){return I().customerId??this.tokenStore.tenantId()??""}async fetchGridPage(t,e,n,o,a,p,x,v){let A=`${I().baseUrl}/api/customers/${this.customerId}/products/${ge()}/workforce/data-grid/${t}?pageIndex=${e}&pageSize=${n}`,S=(o??[]).filter(P=>P&&P.value!=null&&String(P.value).trim()!=="");return S.length&&(A+=`&filters=${encodeURIComponent(JSON.stringify(S))}`),a&&Object.keys(a).length&&(A+=`&dashboardFilters=${encodeURIComponent(JSON.stringify(a))}`),x&&x.length&&(A+=`&resolvedFilters=${encodeURIComponent(JSON.stringify(x))}`),p&&(A+=`&dashboardId=${encodeURIComponent(p)}`),v&&(A+=`&conversationId=${encodeURIComponent(v)}`),E(this.http.get(A))}static \u0275fac=function(e){return new(e||i)};static \u0275prov=ie({token:i,factory:i.\u0275fac,providedIn:"root"})};var mt=["image/png","image/jpeg","image/webp","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"],Jn=10*1024*1024,ht=1,Ct=10,Wi=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"];function ft(i,t){return Wi.includes(t)||/\.(xls|xlsx)$/i.test(i)}var me=class i{http=N(_e);tokenStore=N(ae);async bearer(){return await Ae()??await rn()??this.tokenStore.accessToken()??""}lastSentCustomerId=null;lastSentProductId=null;get customerId(){return I().customerId??this.tokenStore.tenantId()??""}get productId(){return I().productId??ge()}get baseUrl(){return`${I().baseUrl}/api/customers/${this.customerId}/products/${this.productId}/workforce`}mcpGatewayUrl(){return`${I().baseUrl}/dviz-mcp`}async callMcpTool(t,e={},n){let o=this.customerId,a=this.productId,p=w({},n);o!==this.lastSentCustomerId&&(p.customerId=o),a!==this.lastSentProductId&&(p.productId=a);let x;try{x=await E(this.http.post(this.mcpGatewayUrl(),{jsonrpc:"2.0",id:Date.now(),method:"tools/call",params:{name:t,arguments:e}},{headers:{Accept:"application/json, text/event-stream"},params:p})),this.lastSentCustomerId=o,this.lastSentProductId=a}catch(A){throw A instanceof oe?new Error(A.error?.error?.message||A.error?.message||A.message):A}if(x.error)throw new Error(x.error.message);let v=x.result;if(v?.isError)throw new Error(v.structuredContent?.error?.message??v.content?.[0]?.text??`${t} failed`);return v?.structuredContent??{}}async listConversations(t=30){return!this.customerId||!this.productId?[]:I().features.mcpGateway?(await this.callMcpTool("listConversations",{limit:t,status:"active"}))?.conversations??[]:(await E(this.http.get(`${this.baseUrl}/conversations?limit=${t}&status=active`)))?.data??[]}async getConversation(t){if(!t)return null;if(!I().features.mcpGateway){let x=await E(this.http.get(`${this.baseUrl}/conversations/${t}`));if(!x?.data)return null;let a=x.data,{messages:v}=a;return{conversation:Ee(a,["messages"]),messages:v??[]}}let e=await this.callMcpTool("getConversation",{conversationId:t});if(!e?.conversation)return null;let p=e.conversation,{messages:n}=p;return{conversation:Ee(p,["messages"]),messages:n??[]}}async updateConversation(t,e){await E(this.http.patch(`${this.baseUrl}/conversations/${t}`,e))}async deleteConversation(t){if(!I().features.mcpGateway){await E(this.http.delete(`${this.baseUrl}/conversations/${t}`));return}await this.callMcpTool("deleteConversation",{conversationId:t})}async streamChat(t,e,n,o,a,p,x,v){return p?.length||!I().features.mcpGateway?this.streamChatViaSse(t,e,n,o,a,p,x,v):this.sendChatViaGateway(t,e,n,o,a)}async sendChatViaGateway(t,e,n,o,a){let p={message:e};t&&(p.conversationId=t),o&&(p.connectionId=o);let x=Date.now(),v=new URL(this.mcpGatewayUrl());v.searchParams.set("customerId",this.customerId),v.searchParams.set("productId",this.productId);let A=await this.bearer(),S=!1,P=!1,z=R=>{switch(S=!0,R?.kind){case"text":n.onText(R.text??"");break;case"toolCall":n.onToolStart(R.toolId,R.uiLabel??"");break;case"toolResult":n.onToolResult(R.toolId,R.uiDetail??"",!!R.error);break;case"data":{let V=R.payload;V?.data_type==="adhoc_viz"?n.onDataPart(V):V?.data_type==="dashboard_title"?n.onDashboardTitle?.(V.data?.title??""):V?.data_type==="choice"?n.onChoice?.(V.data):V?.data_type==="layout_patch"&&n.onLayoutPatch?.(V.data);break}case"error":n.onError(R.message??"Unknown error");break}},Q=R=>{if(R?.isError){let $=R.structuredContent?.error?.message??R.content?.[0]?.text??"askAquera failed";n.onError($),n.onFinish("error",t??""),P=!0;return}let V=R?.structuredContent??{};if(!S){n.onText(V.responseText??V.text??""),V.dashboardTitle&&n.onDashboardTitle?.(V.dashboardTitle);let $=V.widget?[V.widget]:V.widgets??[];for(let j of $)n.onDataPart({type:"data",data_type:"adhoc_viz",version:1,data:j})}n.onFinish("stop",V.conversationId??t??""),P=!0},U=R=>{if(R.method==="notifications/gateway/stream"){z(R.params??{});return}if(R.id===x){if(R.error){n.onError(R.error.message??"askAquera failed"),n.onFinish("error",t??""),P=!0;return}Q(R.result)}},K;try{K=await fetch(v.toString(),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream",Authorization:`Bearer ${A}`},body:JSON.stringify({jsonrpc:"2.0",id:x,method:"tools/call",params:{name:"askAquera",arguments:p}}),signal:a})}catch(R){if(R instanceof DOMException&&R.name==="AbortError")throw R;n.onError(R instanceof Error?R.message:String(R)),n.onFinish("error",t??"");return}if(!K.ok){let R=await K.text().catch(()=>K.statusText);n.onError(`Request failed (${K.status}): ${R}`),n.onFinish("error",t??"");return}if(!(K.headers.get("content-type")??"").includes("text/event-stream")||!K.body){let R=await K.json().catch(()=>null);if(!R){n.onError("Invalid response from server"),n.onFinish("error",t??"");return}U(R);return}let ne=K.body.getReader(),L=new TextDecoder,J="";for(;;){let{done:R,value:V}=await ne.read();if(R)break;J+=L.decode(V,{stream:!0});let $=J.split(`
2
2
 
3
3
  `);J=$.pop()??"";for(let j of $){let H=j.split(`
4
4
  `).find(B=>B.startsWith("data:"));if(H){try{U(JSON.parse(H.slice(5).trim()))}catch{}if(P)return}}}P||(n.onError("Stream ended unexpectedly"),n.onFinish("error",t??""))}async streamChatViaSse(t,e,n,o,a,p,x,v){let A=await this.bearer(),S=`${this.baseUrl}/v1/conversations/chat`,P={message:e};t&&(P.conversationId=t),o&&(P.connectionId=o),p?.length&&(P.attachments=p),x&&(P.isPipeline=!0),v&&(P.dashboardId=v);let{indexName:z,planningMode:Q}=I().chatDefaults;z&&(P.indexName=z),Q===!1&&(P.planningMode=!1);let U=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${A}`},body:JSON.stringify(P),signal:a});if(!U.ok){let L=await U.text().catch(()=>U.statusText);n.onError(`Request failed (${U.status}): ${L}`);return}if(!U.body){n.onError("No response body received");return}let K=U.body.getReader(),X=new TextDecoder,ne="";for(;;){let{done:L,value:J}=await K.read();if(L)break;ne+=X.decode(J,{stream:!0});let R=ne.split(`
@@ -1 +1 @@
1
- import{a,b}from"./chunk-R4HZ2TCM.js";import"./chunk-LURZSUBG.js";import"./chunk-ZRJYRUTX.js";import"./chunk-T4WJW6GR.js";import"./chunk-JP5QY5S6.js";import"./chunk-BTA57TVR.js";import"./chunk-FK6H3RFT.js";import"./chunk-SYVY7IJY.js";import"./chunk-DPY4ZJSO.js";import"./chunk-T3NXAI3H.js";import"./chunk-JWVGGQEQ.js";import"./chunk-R3C2A3GE.js";import"./chunk-RRYXNANE.js";import"./chunk-SVXYWKUB.js";import"./chunk-QXVITQOV.js";import"./chunk-I4TM4AGJ.js";import"./chunk-F6YL5NFN.js";import"./chunk-ATUZQYGW.js";import"./chunk-XCT4UKLK.js";import"./chunk-4XZ7RFFX.js";import"./chunk-YHTLTPEH.js";import"./chunk-LFSX3TZJ.js";import"./chunk-BTDKTIE6.js";import"./chunk-5CTM6JVQ.js";import"./chunk-W2HKCDVZ.js";import"./chunk-MPGDQZRI.js";import"./chunk-HOS2FAXH.js";import"./chunk-INJSG5RK.js";import"./chunk-RCWO45CI.js";import"./chunk-ZW5NV4UO.js";export{a as DVZ_ASK_TAG,b as defineDvzAsk};
1
+ import{a,b}from"./chunk-SK7RPSRO.js";import"./chunk-HTTPZ3M2.js";import"./chunk-ZRJYRUTX.js";import"./chunk-T4WJW6GR.js";import"./chunk-JP5QY5S6.js";import"./chunk-BTA57TVR.js";import"./chunk-FK6H3RFT.js";import"./chunk-SYVY7IJY.js";import"./chunk-DPY4ZJSO.js";import"./chunk-T3NXAI3H.js";import"./chunk-JWVGGQEQ.js";import"./chunk-R3C2A3GE.js";import"./chunk-RRYXNANE.js";import"./chunk-SVXYWKUB.js";import"./chunk-QXVITQOV.js";import"./chunk-I4TM4AGJ.js";import"./chunk-F6YL5NFN.js";import"./chunk-ATUZQYGW.js";import"./chunk-XCT4UKLK.js";import"./chunk-4XZ7RFFX.js";import"./chunk-YHTLTPEH.js";import"./chunk-LFSX3TZJ.js";import"./chunk-BTDKTIE6.js";import"./chunk-5CTM6JVQ.js";import"./chunk-W2HKCDVZ.js";import"./chunk-MPGDQZRI.js";import"./chunk-HOS2FAXH.js";import"./chunk-INJSG5RK.js";import"./chunk-RCWO45CI.js";import"./chunk-ZW5NV4UO.js";export{a as DVZ_ASK_TAG,b as defineDvzAsk};