@aquera/data-visualizer-sdk 0.0.12 → 0.0.13
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/{chunk-J4NO6UPD.js → chunk-2H2RWKP5.js} +1 -1
- package/{chunk-V77IQCJY.js → chunk-ABVJ65LF.js} +1 -1
- package/{chunk-3ANFJNEW.js → chunk-MWFURRDC.js} +1 -1
- package/{chunk-I4PGOKUA.js → chunk-NA6Z7CGT.js} +1 -1
- package/{chunk-AFTJULGE.js → chunk-PBLP5EZH.js} +1 -1
- package/main.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-MWFURRDC.js";import"./chunk-PBLP5EZH.js";import"./chunk-JP5QY5S6.js";import"./chunk-Z5FDX7CX.js";import"./chunk-FK6H3RFT.js";import"./chunk-SYVY7IJY.js";import"./chunk-DPY4ZJSO.js";import"./chunk-T3NXAI3H.js";import"./chunk-JWVGGQEQ.js";import"./chunk-T4WJW6GR.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 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-NA6Z7CGT.js";import"./chunk-PBLP5EZH.js";import"./chunk-JP5QY5S6.js";import"./chunk-Z5FDX7CX.js";import"./chunk-FK6H3RFT.js";import"./chunk-SYVY7IJY.js";import"./chunk-DPY4ZJSO.js";import"./chunk-T3NXAI3H.js";import"./chunk-JWVGGQEQ.js";import"./chunk-T4WJW6GR.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_DASHBOARDS_TAG,b as defineDvzDashboards};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as Ve,A as le,Aa as ot,B as Qt,Ba as at,C as xe,Ca as Pn,Da as An,E as Kt,Ea as se,F as Jt,Fa as Mn,G as Xt,I as Ee,Ia as rt,Ja as Sn,K as Zt,L as en,M as tn,N as nn,Na as Tn,O as on,Oa as lt,P as an,Pa as Fn,Q as rn,R as ln,S as sn,T as Ie,U as dn,V as cn,W as pn,X as _n,Y as un,_ as gn,a as vt,b as wt,ba as Re,d as Et,e as It,ea as ze,fa as Ne,g as re,ga as $e,h as Ce,ha as Le,i as Vt,ia as We,j as Rt,ja as Be,ka as Ue,l as zt,la as Ge,m as tt,ma as mn,n as Nt,na as nt,o as $t,oa as hn,pa as fn,q as Lt,qa as Cn,ra as xn,s as ee,sa as bn,t as Wt,u as Bt,ua as yn,v as Ut,va as vn,w as Gt,wa as wn,x as Ht,xa as it,y as jt,ya as kn,z as Yt,za as be}from"./chunk-AFTJULGE.js";import{$b as Tt,Ab as k,Eb as g,Gb as r,Ja as Xe,Jb as St,Ka as De,Kb as pe,La as s,Lb as _e,N as me,Ob as oe,Pb as X,Qb as B,Rb as Ze,S as $,Sb as p,Tb as w,Ub as F,Vb as Z,X as _,Y as u,ab as he,ac as ke,bc as et,cc as Ft,ea as kt,ec as Dt,fb as fe,fc as qe,ha as Pt,ia as x,jc as qt,kb as Mt,kc as D,la as we,lb as T,mb as f,nb as C,nc as Oe,ob as Y,oc as Ot,p as V,pa as At,qb as q,rb as O,sb as b,tb as l,ub as d,vb as m,zb as ce}from"./chunk-Z5FDX7CX.js";import{a as y,b as S,d as Fe}from"./chunk-ZW5NV4UO.js";function Dn(){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,dashboardsMenu:!0,executiveSummary:!0,alerts:!0,library:!0},ui:{theme:"light",density:"comfortable",header:!0,locale:"en"},copy:pi(),routing:"none",initial:{dashboardId:null,conversationId:null}}}function pi(){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",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",detailCanvasCrumbLabel:"Canvas",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=$t("dvz-ask",Dn);function R(){return qn.read()}function st(i){let t=Dn(),e=S(y(y({},t),ye(i)),{features:y(y({},t.features),ye(i.features??{})),ui:y(y({},t.ui),ye(i.ui??{})),copy:S(y(y({},t.copy),ye(i.copy??{})),{errors:y(y({},t.copy.errors),ye(i.copy?.errors??{}))}),initial:y(y({},t.initial),ye(i.initial??{})),headers:y(y({},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 He(){return Lt(R())}function On(i,t){return i.replace("{n}",String(t))}function ye(i){let t={};for(let[e,n]of Object.entries(i))n!==void 0&&(t[e]=n);return t}var ue=class i{http=$(Ce);tokenStore=$(le);get customerId(){return R().customerId??this.tokenStore.tenantId()??""}async fetchGridPage(t,e,n,o,a,c,h,v){let A=`${R().baseUrl}/api/customers/${this.customerId}/products/${xe()}/workforce/data-grid/${t}?pageIndex=${e}&pageSize=${n}`,M=(o??[]).filter(P=>P&&P.value!=null&&String(P.value).trim()!=="");return M.length&&(A+=`&filters=${encodeURIComponent(JSON.stringify(M))}`),a&&Object.keys(a).length&&(A+=`&dashboardFilters=${encodeURIComponent(JSON.stringify(a))}`),h&&h.length&&(A+=`&resolvedFilters=${encodeURIComponent(JSON.stringify(h))}`),c&&(A+=`&dashboardId=${encodeURIComponent(c)}`),v&&(A+=`&conversationId=${encodeURIComponent(v)}`),V(this.http.get(A))}static \u0275fac=function(e){return new(e||i)};static \u0275prov=me({token:i,factory:i.\u0275fac,providedIn:"root"})};var dt=["image/png","image/jpeg","image/webp","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"],En=10*1024*1024,ct=1,pt=10,_i=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"];function _t(i,t){return _i.includes(t)||/\.(xls|xlsx)$/i.test(i)}var ve=class i{http=$(Ce);tokenStore=$(le);lastSentCustomerId=null;lastSentProductId=null;get customerId(){return R().customerId??this.tokenStore.tenantId()??""}get productId(){return R().productId??xe()}get baseUrl(){return`${R().baseUrl}/api/customers/${this.customerId}/products/${this.productId}/workforce`}mcpGatewayUrl(){return`${R().baseUrl}/dviz-mcp`}async callMcpTool(t,e={},n){let o=this.customerId,a=this.productId,c=y({},n);o!==this.lastSentCustomerId&&(c.customerId=o),a!==this.lastSentProductId&&(c.productId=a);let h;try{h=await V(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:c})),this.lastSentCustomerId=o,this.lastSentProductId=a}catch(A){throw A instanceof re?new Error(A.error?.error?.message||A.error?.message||A.message):A}if(h.error)throw new Error(h.error.message);let v=h.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?[]:R().features.mcpGateway?(await this.callMcpTool("listConversations",{limit:t,status:"active"}))?.conversations??[]:(await V(this.http.get(`${this.baseUrl}/conversations?limit=${t}&status=active`)))?.data??[]}async getConversation(t){if(!t)return null;if(!R().features.mcpGateway){let h=await V(this.http.get(`${this.baseUrl}/conversations/${t}`));if(!h?.data)return null;let a=h.data,{messages:v}=a;return{conversation:Fe(a,["messages"]),messages:v??[]}}let e=await this.callMcpTool("getConversation",{conversationId:t});if(!e?.conversation)return null;let c=e.conversation,{messages:n}=c;return{conversation:Fe(c,["messages"]),messages:n??[]}}async updateConversation(t,e){await V(this.http.patch(`${this.baseUrl}/conversations/${t}`,e))}async deleteConversation(t){if(!R().features.mcpGateway){await V(this.http.delete(`${this.baseUrl}/conversations/${t}`));return}await this.callMcpTool("deleteConversation",{conversationId:t})}async streamChat(t,e,n,o,a,c,h,v){return c?.length||!R().features.mcpGateway?this.streamChatViaSse(t,e,n,o,a,c,h,v):this.sendChatViaGateway(t,e,n,o,a)}async sendChatViaGateway(t,e,n,o,a){let c={message:e};t&&(c.conversationId=t),o&&(c.connectionId=o);let h=Date.now(),v=new URL(this.mcpGatewayUrl());v.searchParams.set("customerId",this.customerId),v.searchParams.set("productId",this.productId);let A=this.tokenStore.accessToken()??"",M=!1,P=!1,z=I=>{switch(M=!0,I?.kind){case"text":n.onText(I.text??"");break;case"toolCall":n.onToolStart(I.toolId,I.uiLabel??"");break;case"toolResult":n.onToolResult(I.toolId,I.uiDetail??"",!!I.error);break;case"data":{let E=I.payload;E?.data_type==="adhoc_viz"?n.onDataPart(E):E?.data_type==="dashboard_title"?n.onDashboardTitle?.(E.data?.title??""):E?.data_type==="choice"?n.onChoice?.(E.data):E?.data_type==="layout_patch"&&n.onLayoutPatch?.(E.data);break}case"error":n.onError(I.message??"Unknown error");break}},J=I=>{if(I?.isError){let L=I.structuredContent?.error?.message??I.content?.[0]?.text??"askAquera failed";n.onError(L),n.onFinish("error",t??""),P=!0;return}let E=I?.structuredContent??{};if(!M){n.onText(E.responseText??E.text??""),E.dashboardTitle&&n.onDashboardTitle?.(E.dashboardTitle);let L=E.widget?[E.widget]:E.widgets??[];for(let G of L)n.onDataPart({type:"data",data_type:"adhoc_viz",version:1,data:G})}n.onFinish("stop",E.conversationId??t??""),P=!0},Q=I=>{if(I.method==="notifications/gateway/stream"){z(I.params??{});return}if(I.id===h){if(I.error){n.onError(I.error.message??"askAquera failed"),n.onFinish("error",t??""),P=!0;return}J(I.result)}},U;try{U=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:h,method:"tools/call",params:{name:"askAquera",arguments:c}}),signal:a})}catch(I){if(I instanceof DOMException&&I.name==="AbortError")throw I;n.onError(I instanceof Error?I.message:String(I)),n.onFinish("error",t??"");return}if(!U.ok){let I=await U.text().catch(()=>U.statusText);n.onError(`Request failed (${U.status}): ${I}`),n.onFinish("error",t??"");return}if(!(U.headers.get("content-type")??"").includes("text/event-stream")||!U.body){let I=await U.json().catch(()=>null);if(!I){n.onError("Invalid response from server"),n.onFinish("error",t??"");return}Q(I);return}let de=U.body.getReader(),N=new TextDecoder,K="";for(;;){let{done:I,value:E}=await de.read();if(I)break;K+=N.decode(E,{stream:!0});let L=K.split(`
|
|
1
|
+
import{$ as Ve,A as le,Aa as ot,B as Qt,Ba as at,C as xe,Ca as Pn,Da as An,E as Kt,Ea as se,F as Jt,Fa as Mn,G as Xt,I as Ee,Ia as rt,Ja as Sn,K as Zt,L as en,M as tn,N as nn,Na as Tn,O as on,Oa as lt,P as an,Pa as Fn,Q as rn,R as ln,S as sn,T as Ie,U as dn,V as cn,W as pn,X as _n,Y as un,_ as gn,a as vt,b as wt,ba as Re,d as Et,e as It,ea as ze,fa as Ne,g as re,ga as $e,h as Ce,ha as Le,i as Vt,ia as We,j as Rt,ja as Be,ka as Ue,l as zt,la as Ge,m as tt,ma as mn,n as Nt,na as nt,o as $t,oa as hn,pa as fn,q as Lt,qa as Cn,ra as xn,s as ee,sa as bn,t as Wt,u as Bt,ua as yn,v as Ut,va as vn,w as Gt,wa as wn,x as Ht,xa as it,y as jt,ya as kn,z as Yt,za as be}from"./chunk-PBLP5EZH.js";import{$b as Tt,Ab as k,Eb as g,Gb as r,Ja as Xe,Jb as St,Ka as De,Kb as pe,La as s,Lb as _e,N as me,Ob as oe,Pb as X,Qb as B,Rb as Ze,S as $,Sb as p,Tb as w,Ub as F,Vb as Z,X as _,Y as u,ab as he,ac as ke,bc as et,cc as Ft,ea as kt,ec as Dt,fb as fe,fc as qe,ha as Pt,ia as x,jc as qt,kb as Mt,kc as D,la as we,lb as T,mb as f,nb as C,nc as Oe,ob as Y,oc as Ot,p as V,pa as At,qb as q,rb as O,sb as b,tb as l,ub as d,vb as m,zb as ce}from"./chunk-Z5FDX7CX.js";import{a as y,b as S,d as Fe}from"./chunk-ZW5NV4UO.js";function Dn(){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,dashboardsMenu:!0,executiveSummary:!0,alerts:!0,library:!0},ui:{theme:"light",density:"comfortable",header:!0,locale:"en"},copy:pi(),routing:"none",initial:{dashboardId:null,conversationId:null}}}function pi(){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",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",detailCanvasCrumbLabel:"Canvas",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=$t("dvz-ask",Dn);function R(){return qn.read()}function st(i){let t=Dn(),e=S(y(y({},t),ye(i)),{features:y(y({},t.features),ye(i.features??{})),ui:y(y({},t.ui),ye(i.ui??{})),copy:S(y(y({},t.copy),ye(i.copy??{})),{errors:y(y({},t.copy.errors),ye(i.copy?.errors??{}))}),initial:y(y({},t.initial),ye(i.initial??{})),headers:y(y({},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 He(){return Lt(R())}function On(i,t){return i.replace("{n}",String(t))}function ye(i){let t={};for(let[e,n]of Object.entries(i))n!==void 0&&(t[e]=n);return t}var ue=class i{http=$(Ce);tokenStore=$(le);get customerId(){return R().customerId??this.tokenStore.tenantId()??""}async fetchGridPage(t,e,n,o,a,c,h,v){let A=`${R().baseUrl}/api/customers/${this.customerId}/products/${xe()}/workforce/data-grid/${t}?pageIndex=${e}&pageSize=${n}`,M=(o??[]).filter(P=>P&&P.value!=null&&String(P.value).trim()!=="");return M.length&&(A+=`&filters=${encodeURIComponent(JSON.stringify(M))}`),a&&Object.keys(a).length&&(A+=`&dashboardFilters=${encodeURIComponent(JSON.stringify(a))}`),h&&h.length&&(A+=`&resolvedFilters=${encodeURIComponent(JSON.stringify(h))}`),c&&(A+=`&dashboardId=${encodeURIComponent(c)}`),v&&(A+=`&conversationId=${encodeURIComponent(v)}`),V(this.http.get(A))}static \u0275fac=function(e){return new(e||i)};static \u0275prov=me({token:i,factory:i.\u0275fac,providedIn:"root"})};var dt=["image/png","image/jpeg","image/webp","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"],En=10*1024*1024,ct=1,pt=10,_i=["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel"];function _t(i,t){return _i.includes(t)||/\.(xls|xlsx)$/i.test(i)}var ve=class i{http=$(Ce);tokenStore=$(le);lastSentCustomerId=null;lastSentProductId=null;get customerId(){return R().customerId??this.tokenStore.tenantId()??""}get productId(){return R().productId??xe()}get baseUrl(){return`${R().baseUrl}/api/customers/${this.customerId}/products/${this.productId}/workforce`}mcpGatewayUrl(){return`${R().baseUrl}/dviz-mcp`}async callMcpTool(t,e={},n){let o=this.customerId,a=this.productId,c=y({},n);o!==this.lastSentCustomerId&&(c.customerId=o),a!==this.lastSentProductId&&(c.productId=a);let h;try{h=await V(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:c})),this.lastSentCustomerId=o,this.lastSentProductId=a}catch(A){throw A instanceof re?new Error(A.error?.error?.message||A.error?.message||A.message):A}if(h.error)throw new Error(h.error.message);let v=h.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?[]:R().features.mcpGateway?(await this.callMcpTool("listConversations",{limit:t,status:"active"}))?.conversations??[]:(await V(this.http.get(`${this.baseUrl}/conversations?limit=${t}&status=active`)))?.data??[]}async getConversation(t){if(!t)return null;if(!R().features.mcpGateway){let h=await V(this.http.get(`${this.baseUrl}/conversations/${t}`));if(!h?.data)return null;let a=h.data,{messages:v}=a;return{conversation:Fe(a,["messages"]),messages:v??[]}}let e=await this.callMcpTool("getConversation",{conversationId:t});if(!e?.conversation)return null;let c=e.conversation,{messages:n}=c;return{conversation:Fe(c,["messages"]),messages:n??[]}}async updateConversation(t,e){await V(this.http.patch(`${this.baseUrl}/conversations/${t}`,e))}async deleteConversation(t){if(!R().features.mcpGateway){await V(this.http.delete(`${this.baseUrl}/conversations/${t}`));return}await this.callMcpTool("deleteConversation",{conversationId:t})}async streamChat(t,e,n,o,a,c,h,v){return c?.length||!R().features.mcpGateway?this.streamChatViaSse(t,e,n,o,a,c,h,v):this.sendChatViaGateway(t,e,n,o,a)}async sendChatViaGateway(t,e,n,o,a){let c={message:e};t&&(c.conversationId=t),o&&(c.connectionId=o);let h=Date.now(),v=new URL(this.mcpGatewayUrl());v.searchParams.set("customerId",this.customerId),v.searchParams.set("productId",this.productId);let A=this.tokenStore.accessToken()??"",M=!1,P=!1,z=I=>{switch(M=!0,I?.kind){case"text":n.onText(I.text??"");break;case"toolCall":n.onToolStart(I.toolId,I.uiLabel??"");break;case"toolResult":n.onToolResult(I.toolId,I.uiDetail??"",!!I.error);break;case"data":{let E=I.payload;E?.data_type==="adhoc_viz"?n.onDataPart(E):E?.data_type==="dashboard_title"?n.onDashboardTitle?.(E.data?.title??""):E?.data_type==="choice"?n.onChoice?.(E.data):E?.data_type==="layout_patch"&&n.onLayoutPatch?.(E.data);break}case"error":n.onError(I.message??"Unknown error");break}},J=I=>{if(I?.isError){let L=I.structuredContent?.error?.message??I.content?.[0]?.text??"askAquera failed";n.onError(L),n.onFinish("error",t??""),P=!0;return}let E=I?.structuredContent??{};if(!M){n.onText(E.responseText??E.text??""),E.dashboardTitle&&n.onDashboardTitle?.(E.dashboardTitle);let L=E.widget?[E.widget]:E.widgets??[];for(let G of L)n.onDataPart({type:"data",data_type:"adhoc_viz",version:1,data:G})}n.onFinish("stop",E.conversationId??t??""),P=!0},Q=I=>{if(I.method==="notifications/gateway/stream"){z(I.params??{});return}if(I.id===h){if(I.error){n.onError(I.error.message??"askAquera failed"),n.onFinish("error",t??""),P=!0;return}J(I.result)}},U;try{U=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:h,method:"tools/call",params:{name:"askAquera",arguments:c}}),signal:a})}catch(I){if(I instanceof DOMException&&I.name==="AbortError")throw I;n.onError(I instanceof Error?I.message:String(I)),n.onFinish("error",t??"");return}if(!U.ok){let I=await U.text().catch(()=>U.statusText);n.onError(`Request failed (${U.status}): ${I}`),n.onFinish("error",t??"");return}if(!(U.headers.get("content-type")??"").includes("text/event-stream")||!U.body){let I=await U.json().catch(()=>null);if(!I){n.onError("Invalid response from server"),n.onFinish("error",t??"");return}Q(I);return}let de=U.body.getReader(),N=new TextDecoder,K="";for(;;){let{done:I,value:E}=await de.read();if(I)break;K+=N.decode(E,{stream:!0});let L=K.split(`
|
|
2
2
|
|
|
3
3
|
`);K=L.pop()??"";for(let G of L){let H=G.split(`
|
|
4
4
|
`).find(W=>W.startsWith("data:"));if(H){try{Q(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,c,h,v){let A=this.tokenStore.accessToken()??"",M=`${this.baseUrl}/v1/conversations/chat`,P={message:e};t&&(P.conversationId=t),o&&(P.connectionId=o),c?.length&&(P.attachments=c),h&&(P.isPipeline=!0),v&&(P.dashboardId=v);let z=await fetch(M,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${A}`},body:JSON.stringify(P),signal:a});if(!z.ok){let j=await z.text().catch(()=>z.statusText);n.onError(`Request failed (${z.status}): ${j}`);return}if(!z.body){n.onError("No response body received");return}let J=z.body.getReader(),Q=new TextDecoder,U="";for(;;){let{done:j,value:de}=await J.read();if(j)break;U+=Q.decode(de,{stream:!0});let N=U.split(`
|