PageSourceSearch

https://fusion.appdome.com/dist/7420.12d59e09bbd804ae.js

js appdome.com collected 2026-10-02 10:36:45 UTC 64,252 bytes, 4 lines download raw bytes

1"use strict";
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8ea018d5-c36b-5f7c-b7e8-01fee548e4b2")}catch(e){}}();
3var ve,ke,ye,Se,Me,xe,we,Oe,Pe,Ce=Object.freeze,De=Object.defineProperty,X=(J,Y)=>Ce(De(J,"raw",{value:Ce(Y||J.slice())}));(self.webpackChunkappdome=self.webpackChunkappdome||[]).push([[7420],{99136:(J,Y,l)=>{l.d(Y,{q:()=>ce});var e=l(34896),$=l(65056),E=l(63904),L=l(13864);const D=/^\s*\|.*\|?\s*$/,d=/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)+\|?\s*$/;function m(u){return D.test(u)||d.test(u)}function h(u){const O=u.trim().replace(/^\|/,"").replace(/\|$/,"");return O?O.split("|").length:0}function _(u,O){if(d.test(u)){const G=Array.from({length:O},()=>"---");return"| ".concat(G.join(" | ")," |")}const y=u.trim().replace(/^\|/,"").replace(/\|$/,""),w=y.length?y.split("|").map(G=>G.trim()):[];for(;w.length<O;)w.push("");return"| ".concat(w.slice(0,O).join(" | ")," |")}function R(u){return"| ".concat(Array.from({length:u},()=>"---").join(" | ")," |")}let s=(()=>{var u;class O{constructor(){this.accumulated=e.YhN.required(),this.streaming=(0,e.YhN)(!0),this.displayed=(0,e.OCB)(""),this.caughtUp=(0,e.OCB)(!1),this.markdownForDisplay=(0,e.S6b)(()=>{const w=this.displayed();return this.streaming()?function a(u){return u&&function P(u){const O=u.match(/^ {0,3}```/gm);return O&&O.length%2==1?"".concat(u,"\n```"):u}(function k(u){const O=u.split("\n");let T=O.length-1;for(;T>=0&&""===O[T].trim();)T-=1;if(T<0||!m(O[T]))return u;let y=T;for(;y>0&&m(O[y-1]);)y-=1;const w=O.slice(y,T+1),G=Math.max(1,...w.map(h)),j=[];for(let V=0;V<w.length;V+=1){const ie=w[V];1===V&&!d.test(ie)&&D.test(w[0])&&j.push(R(G)),j.push(_(ie,G))}return 1===w.length&&j.push(R(G)),[...O.slice(0,y),...j,...O.slice(T+1)].join("\n")}(u))}(w):w}),this.rafId=null,this.lastFrameTs=0,this.charCarry=0,(0,e.uUt)(e.eM9).onDestroy(()=>this.cancelRaf()),(0,e.o3l)(()=>{const w=this.accumulated();if(!this.streaming())return this.cancelRaf(),this.displayed.set(w),void this.caughtUp.set(!0);const j=this.displayed();w.length<j.length&&this.displayed.set(""),this.caughtUp.set(this.displayed().length>=w.length),this.scheduleTick()},{allowSignalWrites:!0})}scheduleTick(){if(null!==this.rafId)return;this.lastFrameTs=0;const y=w=>{const G=this.accumulated(),j=this.displayed();if(j.length>=G.length)return this.rafId=null,this.charCarry=0,void this.caughtUp.set(!0);const ie=Math.min(48,Math.max(0,w-(this.lastFrameTs||w)));this.lastFrameTs=w;const he=Math.min(900,Math.max(60,8*(G.length-j.length)));this.charCarry+=ie/1e3*he;const re=Math.max(0,Math.floor(this.charCarry));if(this.charCarry-=re,re<1)return void(this.rafId=requestAnimationFrame(y));const se=Math.min(G.length,j.length+re);this.displayed.set(G.slice(0,se)),this.caughtUp.set(se>=G.length),this.rafId=requestAnimationFrame(y)};this.rafId=requestAnimationFrame(y)}cancelRaf(){null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.charCarry=0,this.lastFrameTs=0}}return(u=O).\u0275fac=function(y){return new(y||u)},u.\u0275cmp=e.In1({type:u,selectors:[["ad-agentic-assistant-stream-renderer"]],inputs:{accumulated:[e.Wk5.SignalBased,"accumulated"],streaming:[e.Wk5.SignalBased,"streaming"]},standalone:!0,features:[e.M5G([L.u]),e.UHJ],decls:3,vars:7,consts:[[1,"agentic-stream-md__wrap","tw-w-full","tw-max-w-[720px]","tw-break-words"],[1,"agentic-stream-md","tw-block","tw-w-full",3,"data"]],template:function(y,w){1&y&&(e.I0R(0,"div",0),e.wR5(1,"markdown",1),e.wVc(2,"adNormalizeMarkdown"),e.C$Y()),2&y&&(e.eAK("agentic-stream-md__wrap--streaming",w.streaming())("agentic-stream-md__wrap--caret",w.streaming()&&!w.caughtUp()),e.yG2(),e.E7m("data",e.kDX(2,5,w.markdownForDisplay())))},dependencies:[E.Af,L.u],styles:["@keyframes _ngcontent-%COMP%_motion-fade-in{0%{opacity:0}to{opacity:1}}@keyframes _ngcontent-%COMP%_motion-slide-in-up{0%{opacity:0;transform:translateY(var(--motion-slide-distance, 6px))}to{opacity:1;transform:translateY(0)}}@keyframes _ngcontent-%COMP%_motion-pop-in{0%{opacity:0;transform:translateY(4px) scale(.94)}60%{opacity:1;transform:translateY(0) scale(1.02)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes _ngcontent-%COMP%_motion-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@keyframes _ngcontent-%COMP%_motion-pulse-ring{0%{opacity:.6;transform:scale(.9)}70%{opacity:0;transform:scale(1.25)}to{opacity:0;transform:scale(1.25)}}@keyframes _ngcontent-%COMP%_motion-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes _ngcontent-%COMP%_motion-row-flash{0%{background-color:#1c89ad1f}to{background-color:transparent}}[_nghost-%COMP%]{display:block}.agentic-stream-md__wrap[_ngcontent-%COMP%]{position:relative;transition:opacity .24s cubic-bezier(.32,.72,0,1)}.agentic-stream-md__wrap--streaming[_ngcontent-%COMP%]{mask-image:linear-gradient(to bottom,#000,#000 calc(100% - 32px),#00000080 calc(100% - 14px),#00000026);-webkit-mask-image:linear-gradient(to bottom,black 0%,black calc(100% - 32px),rgba(0,0,0,.5) calc(100% - 14px),rgba(0,0,0,.15) 100%)}@media (prefers-reduced-motion: reduce){.agentic-stream-md__wrap[_ngcontent-%COMP%]{transition:none}.agentic-stream-md__wrap--streaming[_ngcontent-%COMP%]{mask-image:none;-webkit-mask-image:none}}"],changeDetection:0}),O})(),I=(()=>{var u;class O{}return(u=O).\u0275fac=function(y){return new(y||u)},u.\u0275cmp=e.In1({type:u,selectors:[["ad-agentic-completed-renderer"]],standalone:!0,features:[e.UHJ],decls:0,vars:0,template:function(y,w){},encapsulation:2,changeDetection:0}),O})();var b=l(84488);let F=(()=>{var u;class O{constructor(){this.message=e.YhN.required()}}return(u=O).\u0275fac=function(y){return new(y||u)},u.\u0275cmp=e.In1({type:u,selectors:[["ad-agentic-error-renderer"]],inputs:{message:[e.Wk5.SignalBased,"message"]},standalone:!0,features:[e.UHJ],decls:2,vars:1,consts:[["role","alert","data-testid","agentic-stream-error",1,"tw-text-red-700","tw-py-2"]],template:function(y,w){1&y&&(e.I0R(0,"div",0),e.OEk(1),e.C$Y()),2&y&&(e.yG2(),e.oRS(" ",w.message()," "))},dependencies:[$.CommonModule,b.C],encapsulation:2,changeDetection:0}),O})();const C={thinking:l(35380).u,assistant:s,error:F,completed:I},U=new e.UbH("AGENTIC_STREAM_RENDERERS",{providedIn:"root",factory:()=>C});function te(u,O){1&u&&e.C_f(0)}function ne(u,O){if(1&u&&(e.I0R(0,"div"),e.yuY(1,te,1,0,"ng-container",2),e.C$Y()),2&u){const T=O.$implicit,y=e.GaO();e.uQ9("agentic-stream-shell__segment agentic-stream-shell__segment--",T.kind,""),e.yG2(),e.E7m("ngComponentOutlet",y.componentFor(T))("ngComponentOutletInputs",y.inputsFor(T))}}let ce=(()=>{var u;class O{constructor(){this.segments=(0,e.YhN)([]),this.renderers=(0,e.uUt)(U)}componentFor(y){return this.renderers[y.kind]}inputsFor(y){return function B(u,O=[]){switch(u.kind){case"assistant":{const y=!O.some(w=>"completed"===w.kind||"error"===w.kind);return{accumulated:u.accumulated,streaming:y}
3}case"error":return{message:u.message};case"thinking":{var T;const y=!O.some(w=>"completed"===w.kind||"error"===w.kind);return{steps:null!==(T=u.steps)&&void 0!==T?T:[],running:y,...void 0!==u.error&&{error:u.error}}}default:return{}}}(y,this.segments())}trackSeg(y,w){return"".concat(w.kind,"-").concat(y)}}return(u=O).\u0275fac=function(y){return new(y||u)},u.\u0275cmp=e.In1({type:u,selectors:[["ad-agentic-stream-shell"]],inputs:{segments:[e.Wk5.SignalBased,"segments"]},standalone:!0,features:[e.UHJ],decls:3,vars:0,consts:[["data-testid","agentic-stream-shell","aria-live","polite","aria-atomic","false",1,"agentic-stream-shell","tw-w-full","tw-max-w-[720px]","tw-m-auto"],[3,"class"],[4,"ngComponentOutlet","ngComponentOutletInputs"]],template:function(y,w){1&y&&(e.I0R(0,"div",0),e.c53(1,ne,2,5,"div",1,w.trackSeg,!0),e.C$Y()),2&y&&(e.yG2(),e.oho(w.segments()))},dependencies:[$.CommonModule,$.NgComponentOutlet],styles:["@keyframes _ngcontent-%COMP%_motion-fade-in{0%{opacity:0}to{opacity:1}}@keyframes _ngcontent-%COMP%_motion-slide-in-up{0%{opacity:0;transform:translateY(var(--motion-slide-distance, 6px))}to{opacity:1;transform:translateY(0)}}@keyframes _ngcontent-%COMP%_motion-pop-in{0%{opacity:0;transform:translateY(4px) scale(.94)}60%{opacity:1;transform:translateY(0) scale(1.02)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes _ngcontent-%COMP%_motion-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@keyframes _ngcontent-%COMP%_motion-pulse-ring{0%{opacity:.6;transform:scale(.9)}70%{opacity:0;transform:scale(1.25)}to{opacity:0;transform:scale(1.25)}}@keyframes _ngcontent-%COMP%_motion-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes _ngcontent-%COMP%_motion-row-flash{0%{background-color:#1c89ad1f}to{background-color:transparent}}@keyframes _ngcontent-%COMP%_agentic-stream-fade-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}.agentic-stream-shell__segment[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_agentic-stream-fade-in .36s cubic-bezier(.32,.72,0,1) both}.agentic-stream-shell__segment--assistant[_ngcontent-%COMP%]{padding:12px 16px;border-radius:16px}@media (prefers-reduced-motion: reduce){.agentic-stream-shell__segment[_ngcontent-%COMP%]{animation:none}}"],changeDetection:0}),O})()},35380:(J,Y,l)=>{l.d(Y,{u:()=>k});var e=l(34896),$=l(84488),E=l(27504);function L(a,M){1&a&&e.wR5(0,"span",2)}function D(a,M){1&a&&e.wR5(0,"i",11)}function d(a,M){1&a&&e.wR5(0,"i",12)}function m(a,M){if(1&a&&(e.I0R(0,"span",4),e.OEk(1),e.C$Y()),2&a){const A=M.$implicit;e.yG2(),e.oRS(" ",A," ")}}function h(a,M){if(1&a&&(e.I0R(0,"span",13),e.OEk(1),e.C$Y()),2&a){const A=M.$implicit,p=e.GaO();e.eAK("thinking__headline-text--live",p.running()),e.yG2(),e.oRS(" ",A," ")}}function _(a,M){1&a&&e.wR5(0,"i",6)}function R(a,M){if(1&a&&(e.I0R(0,"li",14),e.wR5(1,"span",15),e.I0R(2,"span",16),e.OEk(3),e.C$Y()()),2&a){const A=M.$implicit,p=e.GaO();e.eAK("thinking__step--live",p.running()&&!A.done),e.yG2(3),e.cNF(A.text)}}function P(a,M){if(1&a&&(e.I0R(0,"li",10),e.wR5(1,"span",15),e.I0R(2,"span",16),e.OEk(3),e.C$Y()()),2&a){const A=e.GaO();e.yG2(3),e.cNF(A.error())}}let k=(()=>{var a;class M{constructor(){this.testId=(0,e.YhN)("agentic-stream-thinking"),this.steps=(0,e.YhN)([]),this.error=(0,e.YhN)(),this.running=(0,e.YhN)(!0),this.translate=(0,e.uUt)(E.s),this.expanded=(0,e.OCB)(!1),this.headlineFrames=(0,e.S6b)(()=>{var p,s,I;return[null!==(p=null!==(s=this.error())&&void 0!==s?s:null===(I=this.steps().at(-1))||void 0===I?void 0:I.text)&&void 0!==p?p:this.translate.transform("thinking")]}),this.outgoing=(0,e.OCB)(null),this.outgoingFrames=(0,e.S6b)(()=>{const p=this.outgoing();return p?[p]:[]}),this.expandable=(0,e.S6b)(()=>this.steps().length+(this.error()?1:0)>0),this.shownHeadline="",(0,e.o3l)(()=>{const p=this.headlineFrames()[0];if(p===this.shownHeadline)return;const s=this.shownHeadline;this.shownHeadline=p,(0,e.sRj)(()=>this.outgoing.set(s||null))},{allowSignalWrites:!0})}toggle(){this.expandable()&&this.expanded.update(p=>!p)}}return(a=M).\u0275fac=function(p){return new(p||a)},a.\u0275cmp=e.In1({type:a,selectors:[["ad-agentic-thinking-renderer"]],inputs:{testId:[e.Wk5.SignalBased,"testId"],steps:[e.Wk5.SignalBased,"steps"],error:[e.Wk5.SignalBased,"error"],running:[e.Wk5.SignalBased,"running"]},standalone:!0,features:[e.UHJ],decls:17,vars:19,consts:[[1,"thinking"],["type","button",1,"thinking__header",3,"click","disabled"],["aria-hidden","true",1,"thinking__orbit"],["aria-live","polite",1,"thinking__headline"],["aria-hidden","true",1,"thinking__headline-text","thinking__headline-text--out"],[1,"thinking__headline-text",3,"thinking__headline-text--live"],["aria-hidden","true",1,"thinking__chevron","hfr","hfr-chevron-right"],[1,"thinking__drawer",3,"id"],["data-testid","agentic-stream-thinking-trail",1,"thinking__trail"],[1,"thinking__step",3,"thinking__step--live"],[1,"thinking__step","thinking__step--failed"],["aria-hidden","true",1,"thinking__failed","hfr","hfr-error-circle"],["aria-hidden","true",1,"thinking__done","hfr","hfr-checkmark-simple"],[1,"thinking__headline-text"],[1,"thinking__step"],["aria-hidden","true",1,"thinking__bullet"],[1,"thinking__step-text"]],template:function(p,s){1&p&&(e.I0R(0,"div",0)(1,"button",1),e.wVc(2,"translate"),e.qCj("click",function(){return s.toggle()}),e.yuY(3,L,1,0,"span",2)(4,D,1,0)(5,d,1,0),e.I0R(6,"span",3),e.c53(7,m,2,1,"span",4,e.oxv),e.c53(9,h,2,3,"span",5,e.oxv),e.C$Y(),e.yuY(11,_,1,0,"i",6),e.C$Y(),e.I0R(12,"div",7)(13,"ol",8),e.c53(14,R,4,3,"li",9,e.wJt),e.yuY(16,P,4,1,"li",10),e.C$Y()()()),2&p&&(e.eAK("thinking--open",s.expanded())("thinking--running",s.running())("thinking--failed",!s.running()&&!!s.error()),e.e48("data-testid",s.testId()),e.yG2(),e.eAK("thinking__header--static",!s.expandable()),e.E7m("disabled",!s.expandable()),e.e48("aria-expanded",s.expandable()?s.expanded():null)("aria-controls",s.expandable()?s.testId()+"-trail":null)("aria-label",e.kDX(2,17,s.expanded()?"agent_thinking_hide_steps":"agent_thinking_show_steps")),e.yG2(2),e.C0Y(3,s.running()?3:s.error()?4:5),e.yG2(4),e.oho(s.outgoingFrames()),e.yG2(2),e.oho(s.headlineFrames()),e.yG2(2),e.C0Y(11,s.expandable()?11:-1),e.yG2(),e.E7m("id",s.testId()+"-trail"),e.yG2(2),e.oho(s.steps()),e.yG2(2),e.C0Y(16,s.error()?16:-1))},dependencies:[$.C,E.s],styles:['@keyframes _ngcontent-%COMP%_motion-fade-in{0%{opacity:0}
3to{opacity:1}}@keyframes _ngcontent-%COMP%_motion-slide-in-up{0%{opacity:0;transform:translateY(var(--motion-slide-distance, 6px))}to{opacity:1;transform:translateY(0)}}@keyframes _ngcontent-%COMP%_motion-pop-in{0%{opacity:0;transform:translateY(4px) scale(.94)}60%{opacity:1;transform:translateY(0) scale(1.02)}to{opacity:1;transform:translateY(0) scale(1)}}@keyframes _ngcontent-%COMP%_motion-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@keyframes _ngcontent-%COMP%_motion-pulse-ring{0%{opacity:.6;transform:scale(.9)}70%{opacity:0;transform:scale(1.25)}to{opacity:0;transform:scale(1.25)}}@keyframes _ngcontent-%COMP%_motion-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes _ngcontent-%COMP%_motion-row-flash{0%{background-color:#1c89ad1f}to{background-color:transparent}}@keyframes _ngcontent-%COMP%_thinking-orbit{0%{transform:translate(calc(var(--uib-size) * .25)) scale(.73684);opacity:.65}25%{transform:translate(0) scale(.47368);opacity:.3}50%{transform:translate(calc(var(--uib-size) * -.25)) scale(.73684);opacity:.65}75%{transform:translate(0) scale(1);opacity:1}to{transform:translate(calc(var(--uib-size) * .25)) scale(.73684);opacity:.65}}@keyframes _ngcontent-%COMP%_thinking-sheen{0%{background-position:180% 0}to{background-position:-80% 0}}@keyframes _ngcontent-%COMP%_thinking-line-in{0%{opacity:0;transform:translateY(7px)}40%{opacity:.25}to{opacity:1;transform:translateY(0)}}@keyframes _ngcontent-%COMP%_thinking-line-out{0%{opacity:.85;transform:translateY(0)}to{opacity:0;transform:translateY(-7px)}}@keyframes _ngcontent-%COMP%_thinking-bullet-pulse{0%,to{transform:scale(1);opacity:1}50%{transform:scale(1.45);opacity:.55}}[_nghost-%COMP%]{display:block}.thinking[_ngcontent-%COMP%]{display:flex;flex-direction:column;padding:2px 16px;max-width:100%}.thinking__header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;align-self:flex-start;max-width:100%;padding:6px 10px 6px 8px;-webkit-margin-start:-12px;margin-inline-start:-12px;border:none;background-color:transparent;text-align:start;cursor:pointer;border-radius:10px;transition:background-color .24s cubic-bezier(.32,.72,0,1)}.thinking__header[_ngcontent-%COMP%]:focus-visible{outline:none;box-shadow:0 0 0 2px #fff,0 0 0 4px #16abd8}.thinking__header[_ngcontent-%COMP%]:hover:not(.thinking__header--static){background-color:#f5f7f9}.thinking--running[_ngcontent-%COMP%]   .thinking__header[_ngcontent-%COMP%]:hover:not(.thinking__header--static){background-color:#e8f7fb}.thinking--failed[_ngcontent-%COMP%]   .thinking__header[_ngcontent-%COMP%]:hover:not(.thinking__header--static){background-color:#fdecf2}.thinking__header--static[_ngcontent-%COMP%]{cursor:default}.thinking__orbit[_ngcontent-%COMP%]{--uib-size: 20px;--uib-speed: 1.5s;--uib-dot-size: calc(var(--uib-size) * .4);position:relative;display:flex;align-items:center;justify-content:center;height:var(--uib-size);width:var(--uib-size);flex-shrink:0;animation:spinner calc(var(--uib-speed) * 1.667) infinite linear}.thinking__orbit[_ngcontent-%COMP%]:before, .thinking__orbit[_ngcontent-%COMP%]:after{content:"";position:absolute;height:var(--uib-dot-size);width:var(--uib-dot-size);border-radius:50%;flex-shrink:0}.thinking__orbit[_ngcontent-%COMP%]:before{background-color:#16abd8;animation:_ngcontent-%COMP%_thinking-orbit var(--uib-speed) linear infinite}.thinking__orbit[_ngcontent-%COMP%]:after{background-color:#41cd9e;animation:_ngcontent-%COMP%_thinking-orbit var(--uib-speed) linear calc(var(--uib-speed) / -2) infinite}.thinking__done[_ngcontent-%COMP%], .thinking__failed[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;flex-shrink:0;line-height:1;animation:_ngcontent-%COMP%_motion-pop-in .24s cubic-bezier(.34,1.56,.64,1) 0ms both}.thinking__done[_ngcontent-%COMP%]{font-size:16px;color:#41cd9e}.thinking__failed[_ngcontent-%COMP%]{font-size:15px;color:#ec407a}.thinking__headline[_ngcontent-%COMP%]{position:relative;display:grid;min-width:0;font-size:14px;line-height:20px}.thinking__headline-text[_ngcontent-%COMP%]{grid-area:1/1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#5c5c5c;animation:_ngcontent-%COMP%_thinking-line-in .42s cubic-bezier(.32,.72,0,1) both}
3.thinking__headline-text--live[_ngcontent-%COMP%]{background:linear-gradient(90deg,#5c5c5c,#5c5c5c 32%,#16abd8 46%,#1fbfe8 54%,#5c5c5c 68%,#5c5c5c);background-size:220% 100%;background-clip:text;-webkit-background-clip:text;color:transparent;animation:_ngcontent-%COMP%_thinking-line-in .42s cubic-bezier(.32,.72,0,1) both,thinking-sheen 4s linear infinite}.thinking__headline-text--out[_ngcontent-%COMP%]{pointer-events:none;animation:_ngcontent-%COMP%_thinking-line-out .42s cubic-bezier(.32,.72,0,1) both}.thinking__chevron[_ngcontent-%COMP%]{-webkit-margin-start:4px;margin-inline-start:4px;font-size:12px;color:#ced5dd;opacity:0;transition:transform .24s cubic-bezier(.32,.72,0,1),opacity .18s cubic-bezier(.32,.72,0,1),color .18s cubic-bezier(.32,.72,0,1)}.thinking__header[_ngcontent-%COMP%]:hover   .thinking__chevron[_ngcontent-%COMP%], .thinking__header[_ngcontent-%COMP%]:focus-visible   .thinking__chevron[_ngcontent-%COMP%]{opacity:1}.thinking--running[_ngcontent-%COMP%]   .thinking__header[_ngcontent-%COMP%]:hover   .thinking__chevron[_ngcontent-%COMP%]{color:#16abd8}.thinking--failed[_ngcontent-%COMP%]   .thinking__header[_ngcontent-%COMP%]:hover   .thinking__chevron[_ngcontent-%COMP%]{color:#f6a0bd}.thinking--open[_ngcontent-%COMP%]   .thinking__chevron[_ngcontent-%COMP%]{opacity:1;transform:rotate(90deg)}.thinking__drawer[_ngcontent-%COMP%]{display:grid;grid-template-rows:0fr;visibility:hidden;opacity:0;transition:grid-template-rows .24s cubic-bezier(.32,.72,0,1),opacity .18s cubic-bezier(.32,.72,0,1),visibility .24s}.thinking--open[_ngcontent-%COMP%]   .thinking__drawer[_ngcontent-%COMP%]{grid-template-rows:1fr;visibility:visible;opacity:1}.thinking__trail[_ngcontent-%COMP%]{overflow:hidden;margin:6px 0 0;padding:6px 12px 6px 21px;list-style:none;background-color:#fafcff;border:1px solid #e0e8f0;border-radius:10px}.thinking__step[_ngcontent-%COMP%]{position:relative;display:flex;align-items:flex-start;gap:12px;padding:6px 0 6px 12px;font-size:13px;line-height:18px;color:#808288}.thinking__step[_ngcontent-%COMP%]:before{content:"";position:absolute;inset-block:0;inset-inline-start:0;width:1px;background-color:#ced5dd}.thinking__step[_ngcontent-%COMP%]:first-child:before{inset-block-start:12px}.thinking__step[_ngcontent-%COMP%]:last-child:before{inset-block-end:calc(100% - 12px)}.thinking__step--live[_ngcontent-%COMP%]{color:#4d5d67}.thinking__step--live[_ngcontent-%COMP%]   .thinking__bullet[_ngcontent-%COMP%]{background-color:#16abd8;box-shadow:0 0 0 3px #e8f7fb;animation:_ngcontent-%COMP%_thinking-bullet-pulse 1.6s cubic-bezier(.4,0,.2,1) infinite}.thinking__step--failed[_ngcontent-%COMP%]{color:#ec407a}.thinking__step--failed[_ngcontent-%COMP%]   .thinking__bullet[_ngcontent-%COMP%]{background-color:#ec407a;box-shadow:0 0 0 3px #fdecf2}.thinking__bullet[_ngcontent-%COMP%]{position:absolute;inset-inline-start:-3px;top:11px;width:7px;height:7px;border-radius:50%;background-color:#8bd5ec;box-shadow:0 0 0 3px #fafcff}.thinking__step-text[_ngcontent-%COMP%]{min-width:0;overflow-wrap:anywhere}@media (prefers-reduced-motion: reduce){.thinking__orbit[_ngcontent-%COMP%]{animation:none}.thinking__orbit[_ngcontent-%COMP%]:before, .thinking__orbit[_ngcontent-%COMP%]:after{animation:none;opacity:1}.thinking__orbit[_ngcontent-%COMP%]:before{transform:translate(calc(var(--uib-size) * -.25)) scale(.6)}.thinking__orbit[_ngcontent-%COMP%]:after{transform:translate(calc(var(--uib-size) * .25)) scale(.6)}.thinking__done[_ngcontent-%COMP%], .thinking__failed[_ngcontent-%COMP%], .thinking__headline-text[_ngcontent-%COMP%], .thinking__headline-text--live[_ngcontent-%COMP%], .thinking__step--live[_ngcontent-%COMP%]   .thinking__bullet[_ngcontent-%COMP%]{animation:none}.thinking__headline-text--out[_ngcontent-%COMP%]{animation:none;opacity:0}.thinking__headline-text--live[_ngcontent-%COMP%]{background:none;color:#5c5c5c}.thinking__drawer[_ngcontent-%COMP%], .thinking__chevron[_ngcontent-%COMP%]{transition-duration:1ms}}'],changeDetection:0}),M})()},90520:(J,Y,l)=>{l.d(Y,{o:()=>k});var e=l(34896),$=l(33712),E=l(4376);let D,d,m,h,_,R,P,k=(()=>{var a;class M{constructor(){this.httpClient=(0,e.uUt)($.KK),this.viewAsService=(0,e.uUt)(E.g),this.baseUrl="api/agentic"}getAgentChats(p,s){var I,b,F;const x={};null!=s&&null!==(I=s.nextPageToken)&&void 0!==I&&I.trim()&&(x.nextPageToken=s.nextPageToken),null!=s&&s.size&&(x.size=s.size);const C=null==s||null===(b=s.search)||void 0===b?void 0:b.trim();C&&(x.search=C);const B=null==s||null===(F=s.companyId)||void 0===F?void 0:F.trim();return B&&(x.filters=JSON.stringify({companyId:B})),this.httpClient.get(this.buildUrl(D||(D=ve||(ve=X(["","/chats"]))),p),{params:x})}getConversationHistory(p,s){const I=s?this.buildUrl(d||(d=ke||(ke=X(["","/","/message"]))),p,s):this.buildUrl(m||(m=ye||(ye=X(["","/message"]))),p);return this.httpClient.get(I)}fetchChatById(p,s){const I=this.viewAsService.companyId();return this.httpClient.get(this.buildUrl(h||(h=Se||(Se=X(["","/insights/c
3hats/",""]))),p,s),{params:I?{companyId:I}:{}})}renameChat(p,s,I){return this.httpClient.put(this.buildUrl(_||(_=Me||(Me=X(["","/insights/chats/","/title"]))),p,s),{title:I})}deleteChat(p,s){return this.httpClient.delete(this.buildUrl(R||(R=xe||(xe=X(["","/insights/chats/",""]))),p,s))}getChatCounts$(){return this.httpClient.get("".concat(this.baseUrl,"/chats/counts"))}getSuggestions(p,s){const I={},b=null==s?void 0:s.trim();return b&&(I.companyId=b),this.httpClient.get(this.buildUrl(P||(P=we||(we=X(["","/suggestions"]))),p),{params:I})}buildUrl(p,...s){const I=p.reduce((b,F,x)=>{var C;return b+F+(null!==(C=s[x])&&void 0!==C?C:"")},"");return"".concat(this.baseUrl,"/").concat(I)}}return(a=M).\u0275fac=function(p){return new(p||a)},a.\u0275prov=e.wxM({token:a,factory:a.\u0275fac,providedIn:"root"}),M})()},66496:(J,Y,l)=>{l.d(Y,{E:()=>I});var e=l(34896),$=l(65056),E=l(63904),L=l(53124),D=l(13864);const d=["messageTmpl"];function m(b,F){if(1&b){const x=e.KQA();e.I0R(0,"markdown",2),e.wVc(1,"adNormalizeMarkdown"),e.qCj("ready",function(){e.usT(x);const B=e.GaO();return e.CGJ(B.onMarkdownReady())}),e.C$Y()}if(2&b){const x=e.GaO();e.E7m("data",e.kDX(1,1,x.text()))}}function h(b,F){if(1&b&&e.wR5(0,"v-message",3),2&b){const x=e.GaO();e.E7m("severity","error")("text",x.text())}}function _(b,F){if(1&b&&(e.I0R(0,"p"),e.OEk(1),e.C$Y()),2&b){const x=e.GaO();e.yG2(),e.cNF(x.text())}}let R=(()=>{var b;class F{constructor(){this.messageTmpl=(0,e.kpb)("messageTmpl"),this.text=(0,e.YhN)(""),this.isLastMessage=(0,e.YhN)(!1),this.type=(0,e.YhN)("system"),this.timestamp=(0,e.YhN)(0),this.onReady=(0,e.Qpm)()}getNativeElement(){var C;return null===(C=this.messageTmpl())||void 0===C?void 0:C.nativeElement}ngAfterViewInit(){this.onReady.emit()}onMarkdownReady(){var C;null===(C=this.getNativeElement())||void 0===C||C.querySelectorAll("a").forEach(B=>{B.target="_blank",B.rel="noopener noreferrer"})}}return(b=F).\u0275fac=function(C){return new(C||b)},b.\u0275cmp=e.In1({type:b,selectors:[["ad-message-bubble"]],viewQuery:function(C,B){1&C&&e.MF$(B.messageTmpl,d,5),2&C&&e.K_$()},inputs:{text:[e.Wk5.SignalBased,"text"],isLastMessage:[e.Wk5.SignalBased,"isLastMessage"],type:[e.Wk5.SignalBased,"type"],timestamp:[e.Wk5.SignalBased,"timestamp"]},outputs:{onReady:"onReady"},standalone:!0,features:[e.M5G([{provide:E.Mf,useValue:{gfm:!0,breaks:!0}}]),e.UHJ],decls:5,vars:5,consts:[["messageTmpl",""],[1,"agentic-stream-md",3,"data"],[1,"agentic-stream-md",3,"ready","data"],[3,"severity","text"]],template:function(C,B){1&C&&(e.I0R(0,"div",null,0),e.yuY(2,m,2,3,"markdown",1)(3,h,1,2)(4,_,2,1),e.C$Y()),2&C&&(e.uQ9("bubble ",B.type(),""),e.e48("data-testid","ai-message-bubble-"+B.type()),e.yG2(2),e.C0Y(2,"system"===B.type()?2:"error"===B.type()?3:4))},dependencies:[$.CommonModule,L.ov,E.GW,E.Af,D.u],styles:['[_ngcontent-%COMP%]:root{--white: #ffffff;--dark: #303d45;--iceberg: #8fafc2;--pink-1400: #BD3362;--pink-1200: #D43A6E;--pink-1000: #ec407a;--pink-500: #f6a0bd;--pink-200: #fbd9e4;--pink-100: #fdecf2;--pink-fuchsia: #ec407a;--blue-1400: #1289AD;--blue-1200: #149AC2;--blue-1000: #16abd8;--blue-500: #8bd5ec;--blue-200: #d0eef7;--blue-100: #e8f7fb;--turquoise: #1fbfe8;--green-1400: #829B2D;--green-1200: #93AF32;--green-1000: #a3c238;--green-500: #d1e19c;--green-200: #edf3d7;--green-100: #f6f9eb;--green-lime: #b3e016;--light-green: #41cd9e;--status-success-bg: #e3f6ee;--mint-1000: #41cd9e;--mint-100: #e3f6ee;--orange-1400: #C46E1C;--orange-1200: #DC7C20;--orange-1000: #f58a23;--orange-500: #fac591;--orange-200: #fde8d3;--orange-100: #fef3e9;--orange-bright: #ffaa04;--yellow-1400: #BE9A1A;--yellow-1200: #D5AD1D;--yellow-1000: #edc020;--yellow-500: #f6e090;--yellow-200: #fbf2d2;--yellow-100: #fdf9e9;--yellow-amber: #fff595;--amber-200: #fef9ef;--amber-300: #fef7ea;--amber-400: #fff1d8;--amber-500: #ffedcd;--neutral-1000: #5c5c5c;--neutral-500: #a4a4a5;--neutral-400: #bebebe;--neutral-200: #dbdbdb;--neutral-100: #edecec;--sky-1400: #BCC3CA;--sky-1200: #CED5DD;--sky-1000: #e0e8f0;--sky-700: #eaf1f6;--sky-600: #f0f3f6;--sky-400: #f5f7f9;--sky-200: #fafbfb;--sky-100: #fafcff;--violet-900: #554197;--violet-700: #8E6DFD;--violet-500: #9575CD;--violet-300: #EDE8FF;
3--violet-100: #F6F3FF;--success: #a3c238;--info: #16abd8;--warning: #f58a23;--danger: #ec407a;--ai-purple: #9D00FFFF;--ai-button-gradient: linear-gradient(280deg, #9D00FFFF 5.8%, #1FBFE8 93.45%);--ai-1000: linear-gradient(135deg, #1FBFE8 0%, #A89CFB 100%);--ai-1200: linear-gradient(135deg, #1DB0D5 0%, #9B90E7 100%);--ai-1400: linear-gradient(135deg, #1AA0C3 0%, #8D83D3 100%);--ai-3: linear-gradient(280deg, #9D00FF 5.8%, #1FBFE8 93.45%);--ai3: linear-gradient(280deg, #9D00FF 5.8%, #1FBFE8 93.45%)}[_nghost-%COMP%]{width:100%;max-width:720px;min-width:0;padding:12px 16px;border-radius:16px;align-items:center;gap:4px;font-size:14px;display:flex;flex-wrap:wrap}[_nghost-%COMP%]   .bubble[_ngcontent-%COMP%]:is(:not(.system)){display:flex;padding:12px 16px;gap:4px;border-radius:16px;background:#eaf1f6}[_nghost-%COMP%]   .bubble[_ngcontent-%COMP%]:is(.error){background:transparent!important}[_nghost-%COMP%]   .bubble[_ngcontent-%COMP%] > p[_ngcontent-%COMP%]{overflow-wrap:anywhere}[_nghost-%COMP%]     markdown.agentic-stream-md{display:block;color:var(--dark, #303d45);font-size:14px;font-weight:400;line-height:2;word-wrap:break-word;word-break:break-word}[_nghost-%COMP%]     v-message{justify-content:start;display:flex!important;align-items:center!important;gap:8px!important;max-width:100%!important}[_nghost-%COMP%]     v-message .message-container{border-radius:16px!important;padding:12px 16px!important;min-height:44px!important}[_nghost-%COMP%]     .bubble{min-width:0;max-width:100%}[_nghost-%COMP%]     .bubble markdown{display:block;min-width:0;max-width:100%;font-size:13px;line-height:1.6;color:#5c5c5c}[_nghost-%COMP%]     .bubble markdown>:first-child{margin-top:0}[_nghost-%COMP%]     .bubble markdown>:last-child{margin-bottom:0}[_nghost-%COMP%]     .bubble markdown p{margin:0 0 8px}[_nghost-%COMP%]     .bubble markdown h1, [_nghost-%COMP%]     .bubble markdown h2, [_nghost-%COMP%]     .bubble markdown h3, [_nghost-%COMP%]     .bubble markdown h4{margin:14px 0 6px;line-height:1.3;font-weight:700;color:#5c5c5c}[_nghost-%COMP%]     .bubble markdown h1{font-size:17px}[_nghost-%COMP%]     .bubble markdown h2{font-size:15px}[_nghost-%COMP%]     .bubble markdown h3, [_nghost-%COMP%]     .bubble markdown h4{font-size:14px}[_nghost-%COMP%]     .bubble markdown ul, [_nghost-%COMP%]     .bubble markdown ol{margin:0 0 8px;padding-left:18px}[_nghost-%COMP%]     .bubble markdown li{margin:3px 0}[_nghost-%COMP%]     .bubble markdown li::marker{color:#16abd8}[_nghost-%COMP%]     .bubble markdown a{color:#16abd8;text-decoration:underline;text-underline-offset:2px;word-break:break-word}[_nghost-%COMP%]     .bubble markdown a:hover{color:#1289ad}[_nghost-%COMP%]     .bubble markdown code{font-family:SFMono-Regular,Consolas,Liberation Mono,monospace;font-size:12px;background:#eaf1f6;color:#5c5c5c;padding:1px 5px;border-radius:4px;word-break:break-word}[_nghost-%COMP%]     .bubble markdown pre{margin:0 0 8px;padding:10px 12px;background:#f0f3f6;border:1px solid #e0e8f0;border-radius:8px;overflow-x:auto}[_nghost-%COMP%]     .bubble markdown pre code{padding:0;background:transparent}[_nghost-%COMP%]     .bubble markdown blockquote{margin:0 0 8px;padding:2px 12px;border-left:3px solid #16abd8;color:#a4a4a5}[_nghost-%COMP%]     .bubble markdown hr{margin:12px 0;border:none;border-top:1px solid #e0e8f0}[_nghost-%COMP%]     .bubble markdown table{display:block;width:100%;max-width:100%;overflow-x:auto;margin:0 0 8px;border-collapse:collapse;font-size:12px}[_nghost-%COMP%]     .bubble markdown table th, [_nghost-%COMP%]     .bubble markdown table td{padding:7px 10px;text-align:left;white-space:nowrap;border-bottom:1px solid #e0e8f0}[_nghost-%COMP%]     .bubble markdown table th, [_nghost-%COMP%]     .bubble markdown table th[align=""], [_nghost-%COMP%]     .bubble markdown table th:not([align]){text-align:left;font-weight:700;color:#5c5c5c;background:#eaf1f6;border-bottom:1px solid #CED5DD}'],changeDetection:0}),F})();var P=l(62940),k=l(35380);const a=(b,F)=>F.timestamp,M=()=>[];function A(b,F){if(1&b&&e.wR5(0,"ad-agentic-thinking-renderer",2),2&b){let x;const C=e.GaO().$implicit;e.E7m("steps",null!==(x=C.thinkingSteps)&&void 0!==x?x:e.q4q(3,M))("error",C.thinkingError)("running",!1)}}function p(b,F){if(1&b){const x=e.KQA();e.yuY(0,A,1,4,"ad-agentic-thinking-renderer",2),e.I0R(1,"ad-message-bubble",3,0),e.qCj("onReady",function(){const B=e.usT(x).$implicit,U=e.Gew(2),K=e.GaO(2);
3return e.CGJ(K.animateBubble(U,"user"!==B.sender?"left":"right"))}),e.C$Y()}if(2&b){const x=F.$implicit,C=F.$index,B=F.$count;e.C0Y(0,null!=x.thinkingSteps&&x.thinkingSteps.length||x.thinkingError?0:-1),e.yG2(),e.E7m("timestamp",x.timestamp)("text",x.content)("type",x.sender)("isLastMessage",C===B-1)}}function s(b,F){1&b&&e.c53(0,p,3,5,"ad-message-bubble",1,a),2&b&&e.oho(F)}let I=(()=>{var b;class F{constructor(){this.messages=(0,e.YhN)([]),this.suppressAnimationFor=(0,e.YhN)(null),this.documentService=(0,e.uUt)(P.C)}shouldSkipAnimation(C){return!(!C.timestamp()||C.timestamp()!==this.suppressAnimationFor())||!C.isLastMessage()||!C.getNativeElement()}animateBubble(C,B="left"){var U,K;if(this.shouldSkipAnimation(C))return!1;const te=C.getNativeElement(),ne="left"===B?"bubble-enter-left":"bubble-enter-right";te.classList.remove("bubble-enter-left","bubble-enter-right"),te.classList.add(ne),null===(U=this.documentService.document.querySelector("#thinking-anchor"))||void 0===U||null===(K=U.scrollIntoView)||void 0===K||K.call(U,{behavior:"smooth",block:"end",inline:"end"})}}return(b=F).\u0275fac=function(C){return new(C||b)},b.\u0275cmp=e.In1({type:b,selectors:[["ad-chat-thread"]],inputs:{messages:[e.Wk5.SignalBased,"messages"],suppressAnimationFor:[e.Wk5.SignalBased,"suppressAnimationFor"]},standalone:!0,features:[e.UHJ],decls:1,vars:1,consts:[["bubbleEl",""],[3,"timestamp","text","type","isLastMessage"],["testId","chat-thread-thinking",3,"steps","error","running"],[3,"onReady","timestamp","text","type","isLastMessage"]],template:function(C,B){if(1&C&&e.yuY(0,s,2,0),2&C){let U;e.C0Y(0,(U=B.messages())?0:-1,U)}},dependencies:[R,$.CommonModule,k.u],styles:["[_ngcontent-%COMP%]:root{--white: #ffffff;--dark: #303d45;--iceberg: #8fafc2;--pink-1400: #BD3362;--pink-1200: #D43A6E;--pink-1000: #ec407a;--pink-500: #f6a0bd;--pink-200: #fbd9e4;--pink-100: #fdecf2;--pink-fuchsia: #ec407a;--blue-1400: #1289AD;--blue-1200: #149AC2;--blue-1000: #16abd8;--blue-500: #8bd5ec;--blue-200: #d0eef7;--blue-100: #e8f7fb;--turquoise: #1fbfe8;--green-1400: #829B2D;--green-1200: #93AF32;--green-1000: #a3c238;--green-500: #d1e19c;--green-200: #edf3d7;--green-100: #f6f9eb;--green-lime: #b3e016;--light-green: #41cd9e;--status-success-bg: #e3f6ee;--mint-1000: #41cd9e;--mint-100: #e3f6ee;--orange-1400: #C46E1C;--orange-1200: #DC7C20;--orange-1000: #f58a23;--orange-500: #fac591;--orange-200: #fde8d3;--orange-100: #fef3e9;--orange-bright: #ffaa04;--yellow-1400: #BE9A1A;--yellow-1200: #D5AD1D;--yellow-1000: #edc020;--yellow-500: #f6e090;--yellow-200: #fbf2d2;--yellow-100: #fdf9e9;--yellow-amber: #fff595;--amber-200: #fef9ef;--amber-300: #fef7ea;--amber-400: #fff1d8;--amber-500: #ffedcd;--neutral-1000: #5c5c5c;--neutral-500: #a4a4a5;--neutral-400: #bebebe;--neutral-200: #dbdbdb;--neutral-100: #edecec;--sky-1400: #BCC3CA;--sky-1200: #CED5DD;--sky-1000: #e0e8f0;--sky-700: #eaf1f6;--sky-600: #f0f3f6;--sky-400: #f5f7f9;--sky-200: #fafbfb;--sky-100: #fafcff;--violet-900: #554197;--violet-700: #8E6DFD;--violet-500: #9575CD;--violet-300: #EDE8FF;--violet-100: #F6F3FF;--success: #a3c238;--info: #16abd8;--warning: #f58a23;--danger: #ec407a;--ai-purple: #9D00FFFF;--ai-button-gradient: linear-gradient(280deg, #9D00FFFF 5.8%, #1FBFE8 93.45%);--ai-1000: linear-gradient(135deg, #1FBFE8 0%, #A89CFB 100%);--ai-1200: linear-gradient(135deg, #1DB0D5 0%, #9B90E7 100%);--ai-1400: linear-gradient(135deg, #1AA0C3 0%, #8D83D3 100%);--ai-3: linear-gradient(280deg, #9D00FF 5.8%, #1FBFE8 93.45%);--ai3: linear-gradient(280deg, #9D00FF 5.8%, #1FBFE8 93.45%)}[_nghost-%COMP%]{gap:12px;width:100%;max-width:720px;margin:0 auto;display:grid;grid-template-columns:minmax(0,1fr);flex-direction:column;flex-wrap:wrap}[_nghost-%COMP%]   ad-message-bubble[_ngcontent-%COMP%]:not(:has(.system)):not(:has(.error)){display:flex;justify-content:end}[_nghost-%COMP%]   ad-message-bubble[_ngcontent-%COMP%]:has(.error){display:flex;justify-content:start}[_nghost-%COMP%]   ad-agentic-thinking-renderer[_ngcontent-%COMP%]{margin-bottom:-12px}[_nghost-%COMP%]     .bubble-enter-left{animation:bubble-enter-left .75s cubic-bezier(.22,.61,.36,1)}[_nghost-%COMP%]     .bubble-enter-right{animation:bubble-enter-right .75s cubic-bezier(.22,.61,.36,1)}"],changeDetection:0}),F})()},75044:(J,Y,l)=>{l.d(Y,{k:()=>h});var e=l(34896),$=l(71904),E=l(65056),L=l(84488),D=l(70336),d=l(27504);const m=["ta"];let h=(()=>{var _;class R{constructor(){this.placeholder=(0,e.YhN)("ask_anything"),this.minRows=(0,e.YhN)(1),this.maxHeight=(0,e.YhN)(187),this.isChatLoading=(0,e.YhN)(!1),this.disabled=(0,e.YhN)(!1),this.value=(0,e.YhN)(""),this.submitText=(0,e.Qpm)(),this.focusIn=(0,e.Qpm)(),this.focusOut=(0,e.Qpm)(),this.hovering=(0,e.OCB)(!1),this.focused=(0,e.OCB)(!1),this.canSend=(0,e.S6b)(()=>!this.disabled()&&!this.isTextareaEmpty()&&!this.isChatLoading()),this.tochedTextAreaStyle=(0,e.S6b)(()=>({"line-height":"20px"})),this.isTextareaEmpty=(0,e.OCB)(!0),this.heightChanged=(0,e.OCB)(!1),this.ctrl=ne
3w $.Ku("",{nonNullable:!0}),this.destroyRef=(0,e.uUt)(e.eM9),(0,e._g$)(()=>{this.resize()}),(0,e.o3l)(()=>{this.disabled()||this.focusInput()})}focusInput(){var k;if(this.disabled())return;const a=null===(k=this.ta)||void 0===k?void 0:k.nativeElement;a&&setTimeout(()=>a.focus({preventScroll:!0}),0)}ngOnInit(){this.ctrl.setValue(this.value()),this.ctrl.valueChanges.pipe((0,D.ay)(this.destroyRef)).subscribe(k=>{this.isTextareaEmptyFn(k)})}ngOnDestroy(){void 0!==this.resizeFrameId&&cancelAnimationFrame(this.resizeFrameId)}ngAfterViewInit(){this.resize(),this.focusInput()}onInput(){void 0!==this.resizeFrameId&&cancelAnimationFrame(this.resizeFrameId),this.resizeFrameId=requestAnimationFrame(()=>{this.resizeFrameId=void 0,this.resize()})}onKeydown(k){if(!this.disabled()){if("Enter"===k.key&&!k.shiftKey)return k.preventDefault(),void(this.canSend()&&this.emitSubmit());if("Enter"===k.key&&(k.ctrlKey||k.metaKey))return k.preventDefault(),void(this.canSend()&&this.emitSubmit())}}emitSubmit(){if(this.isChatLoading())return;const k=this.ctrl.value.trim();k&&(this.submitText.emit(k),this.ctrl.setValue(""),this.resize())}resize(){var k;const a=null===(k=this.ta)||void 0===k?void 0:k.nativeElement;if(!a)return;a.style.height="auto";const M=getComputedStyle(a),A=parseFloat(M.lineHeight)||20,p=parseFloat(M.paddingTop)||0,s=parseFloat(M.paddingBottom)||0,I=parseFloat(M.borderTopWidth)||0,b=parseFloat(M.borderBottomWidth)||0,x=Math.max(R.MIN_SINGLE_LINE_HEIGHT_PX,Math.ceil(A+p+s+I+b)),C=Math.max(x,this.maxHeight()),B=a.scrollHeight+I+b,U=Math.min(C,Math.max(x,B));a.style.height="".concat(U,"px"),a.style.overflowY=B>C?"auto":"hidden",this.heightChanged.set(U>x+.5)}focus(){this.disabled()||(this.focused.set(!0),this.focusIn.emit())}blur(){this.focused.set(!1),this.focusOut.emit()}isTextareaEmptyFn(k){this.isTextareaEmpty.set(!k||0===k.trim().length)}}return(_=R).MIN_SINGLE_LINE_HEIGHT_PX=44,_.\u0275fac=function(k){return new(k||_)},_.\u0275cmp=e.In1({type:_,selectors:[["ad-chat-textarea"]],viewQuery:function(k,a){if(1&k&&e.CC$(m,7),2&k){let M;e.wto(M=e.Gqi())&&(a.ta=M.first)}},inputs:{placeholder:[e.Wk5.SignalBased,"placeholder"],minRows:[e.Wk5.SignalBased,"minRows"],maxHeight:[e.Wk5.SignalBased,"maxHeight"],isChatLoading:[e.Wk5.SignalBased,"isChatLoading"],disabled:[e.Wk5.SignalBased,"disabled"],value:[e.Wk5.SignalBased,"value"]},outputs:{submitText:"submitText",focusIn:"focusIn",focusOut:"focusOut"},standalone:!0,features:[e.UHJ],decls:10,vars:21,consts:[["ta",""],["data-testid","ai-chat-textarea-shell",1,"chat-shell",3,"mouseenter","mouseleave"],["data-testid","ai-chat-textarea-input",1,"ta",3,"keydown.enter","input","focus","blur","keydown","placeholder","ngStyle","rows","disabled","formControl"],[1,"actions"],["data-testid","ai-chat-send-button","type","button",1,"icon","btn-right",3,"click","disabled"],["aria-hidden","true",1,"hfr","hfr-send-arrow","send-arrow"],[1,"help"]],template:function(k,a){if(1&k){const M=e.KQA();e.I0R(0,"div",1),e.qCj("mouseenter",function(){return e.usT(M),e.CGJ(a.hovering.set(!0))})("mouseleave",function(){return e.usT(M),e.CGJ(a.hovering.set(!1))}),e.I0R(1,"textarea",2,0),e.wVc(3,"translate"),e.qCj("keydown.enter",function(){return e.usT(M),e.CGJ(a.emitSubmit())})("input",function(){return e.usT(M),e.CGJ(a.onInput())})("focus",function(){return e.usT(M),e.CGJ(a.focus())})("blur",function(){return e.usT(M),e.CGJ(a.blur())})("keydown",function(p){return e.usT(M),e.CGJ(a.onKeydown(p))}),e.C$Y(),e.I0R(4,"div",3)(5,"button",4),e.qCj("click",function(){return e.usT(M),e.CGJ(a.emitSubmit())}),e.wR5(6,"i",5),e.C$Y()()(),e.I0R(7,"div",6),e.OEk(8),e.wVc(9,"translate"),e.C$Y()}2&k&&(e.eAK("disabled",a.disabled())("focused",a.focused())("hover",a.hovering())("expanded",a.heightChanged()),e.yG2(),e.E7m("placeholder",e.kDX(3,17,a.placeholder()))("ngStyle",a.tochedTextAreaStyle())("rows",a.minRows())("disabled",a.disabled())("formControl",a.ctrl),e.yG2(4),e.eAK("animation",!a.isTextareaEmpty()&&!a.disabled()&&!a.isChatLoading()),e.E7m("disabled",a.disabled()||a.isChatLoading()),e.yG2(3),e.cNF(e.kDX(9,19,"chat_input_text_area")))},dependencies:[$.y,$.ot,$.ue,$.sl,$.ug,E.NgStyle,L.C,d.s],styles:["[_ngcontent-%COMP%]:root{--white: #ffffff;--dark: #303d45;--iceberg: #8fafc2;--pink-1400: #BD3362;--pink-1200: #D43A6E;--pink-1000: #ec407a;--pink-500: #f6a0bd;--pink-200: #fbd9e4;--pink-100: #fdecf2;--pink-fuchsia: #ec407a;--blue-1400: #1289AD;--blue-1200: #149AC2;--blue-1000: #16abd8;--blue-500: #8bd5ec;--blue-200: #d0eef7;--blue-100: #e8f7fb;--turquoise: #1fbfe8;--green-1400: #829B2D;--green-1200: #93AF32;--green-1000: #a3c238;--green-500: #d1e19c;--green-200: #edf3d7;--green-100: #f6f9eb;--green-lime: #b3e016;--light-green: #41cd9e;--status-success-bg: #e3f6ee;--mint-1000: #41cd9e;--mint-100: #e3f6ee;
3--orange-1400: #C46E1C;--orange-1200: #DC7C20;--orange-1000: #f58a23;--orange-500: #fac591;--orange-200: #fde8d3;--orange-100: #fef3e9;--orange-bright: #ffaa04;--yellow-1400: #BE9A1A;--yellow-1200: #D5AD1D;--yellow-1000: #edc020;--yellow-500: #f6e090;--yellow-200: #fbf2d2;--yellow-100: #fdf9e9;--yellow-amber: #fff595;--amber-200: #fef9ef;--amber-300: #fef7ea;--amber-400: #fff1d8;--amber-500: #ffedcd;--neutral-1000: #5c5c5c;--neutral-500: #a4a4a5;--neutral-400: #bebebe;--neutral-200: #dbdbdb;--neutral-100: #edecec;--sky-1400: #BCC3CA;--sky-1200: #CED5DD;--sky-1000: #e0e8f0;--sky-700: #eaf1f6;--sky-600: #f0f3f6;--sky-400: #f5f7f9;--sky-200: #fafbfb;--sky-100: #fafcff;--violet-900: #554197;--violet-700: #8E6DFD;--violet-500: #9575CD;--violet-300: #EDE8FF;--violet-100: #F6F3FF;--success: #a3c238;--info: #16abd8;--warning: #f58a23;--danger: #ec407a;--ai-purple: #9D00FFFF;--ai-button-gradient: linear-gradient(280deg, #9D00FFFF 5.8%, #1FBFE8 93.45%);--ai-1000: linear-gradient(135deg, #1FBFE8 0%, #A89CFB 100%);--ai-1200: linear-gradient(135deg, #1DB0D5 0%, #9B90E7 100%);--ai-1400: linear-gradient(135deg, #1AA0C3 0%, #8D83D3 100%);--ai-3: linear-gradient(280deg, #9D00FF 5.8%, #1FBFE8 93.45%);--ai3: linear-gradient(280deg, #9D00FF 5.8%, #1FBFE8 93.45%)}[_nghost-%COMP%]{display:block;width:100%;min-width:0}[_nghost-%COMP%]   .chat-shell.disabled[_ngcontent-%COMP%]{pointer-events:none;border-radius:32px;border:1px solid var(--sky-1000, #e0e8f0);background:var(--neutral-100, #edecec)}[_nghost-%COMP%]   .chat-shell.disabled[_ngcontent-%COMP%]   .icon[_ngcontent-%COMP%]{border-radius:8px;background:#edecec;color:var(--neutral-400, #bebebe);border:none;cursor:pointer}[_nghost-%COMP%]   [_ngcontent-%COMP%]::-webkit-scrollbar:hover{background-color:transparent;border:none;outline:none;width:8px}[_nghost-%COMP%]   [_ngcontent-%COMP%]::-webkit-scrollbar{border:none;outline:none;width:8px}[_nghost-%COMP%]   .actions[_ngcontent-%COMP%]{position:absolute;right:16px;z-index:2;display:flex;align-items:center;justify-content:center}.chat-shell[_ngcontent-%COMP%]:not(.expanded)   .actions[_ngcontent-%COMP%]{top:50%;transform:translateY(-50%);bottom:auto}.chat-shell.expanded[_ngcontent-%COMP%]   .actions[_ngcontent-%COMP%]{top:auto;bottom:8px;transform:none}.chat-shell[_ngcontent-%COMP%]{position:relative;display:block;padding:8px 16px 8px 24px;box-sizing:border-box;background:#fff;border-radius:24px;border:1px solid rgba(0,0,0,.06)}.chat-shell[_ngcontent-%COMP%]:not(.disabled){border-radius:32px;border:1px solid var(--sky-1000, #e0e8f0);background:#fff;box-shadow:0 20px 25px -5px #5c5c5c1a,0 8px 10px #0000001a}.chat-shell.expanded[_ngcontent-%COMP%]{padding-bottom:40px}.ta[_ngcontent-%COMP%]{display:block;width:100%;border:none;resize:none;overflow-y:hidden;min-height:44px;background:transparent;outline:none;color:#5c5c5c;font-family:Lato;font-size:14px;font-weight:400;box-sizing:border-box;line-height:20px;padding:12px 44px 12px 0}.btn-right[_ngcontent-%COMP%]{top:auto}.icon[_ngcontent-%COMP%]{border-radius:8px;border:none;width:32px;height:32px;padding:4px;cursor:pointer;display:flex;align-items:center;justify-content:center;background:var(--neutral-200, #dbdbdb);color:var(--neutral-500, #a4a4a5);transition:background-color .2s ease,transform .2s ease}.icon[_ngcontent-%COMP%]   .send-arrow[_ngcontent-%COMP%]{display:block;font-size:24px;line-height:1}.icon.animation[_ngcontent-%COMP%]{background:var(--blue-1200, #149ac2);color:#fff}.icon.animation[_ngcontent-%COMP%]:hover{transform:scale(1.06)}.icon[_ngcontent-%COMP%]:disabled{cursor:not-allowed}.chat-shell.hover[_ngcontent-%COMP%]:not(.disabled), .chat-shell.focused[_ngcontent-%COMP%]:not(.disabled){border-radius:32px;border:1px solid var(--sky-1000, #e0e8f0);background:#fff;box-shadow:0 20px 25px -5px #5c5c5c1a,0 8px 10px #0000001a}.help[_ngcontent-%COMP%]{color:var(--neutral-500, #a4a4a5);text-align:center;margin-top:8px;margin-bottom:8px;font-size:12px;font-style:normal;font-weight:400;line-height:16px}"],changeDetection:0}),R})()},30604:(J,Y,l)=>{l.d(Y,{I:()=>L});var e=l(34896),$=l(74052);let L=(()=>{var D;class d{constructor(){this._activeTab=(0,e.OCB)(null),this._selectionByAgent=(0,e.OCB)({}),this._shouldScrollToMention=(0,e.OCB)(!1),this._agentType=(0,e.OCB)(null),this._newSessionRequested=(0,e.OCB)(!1),this.activeTab=this._activeTab.asReadonly(),this.shouldScrollToMention=this._shouldScrollToMention.asReadonly(),this.agentType=this._agentType.asReadonly(),this.activeReport=(0,e.S6b)(()=>{var h;const _=this._agentType();return _&&null!==(h=this._selectionByAgent()[_])&&void 0!==h?h:{chatId:null,insightId:null}}),this.activeChatId=(0,e.S6b)(()=>this.activeReport().chatId),this.activeInsightId=(0,e.S6b)(()=>this.activeReport().insightId),this.activeReportType=(0,e.S6b)(()=>{const h=this.activeReport();return h.chatId?$.wN.CHAT:h.insightId?$.wN.INSIGHT:null}),this._selectionSignals=new Map}setActiveTab(h){this._activeTab.set(h)}setActiveChatId(h,_=this._agentType()){this.patchSelection({chatId:h},_)}setActiveInsightId(h,_=this._agentType()){this.patchSelection({insightId:h},_)}patchSelection(h,_){_&&this._selectionByAgent.update(R=>{var P;return{...R,[_]:{...null!==(P=R[_])&&void 0!==P?P:{chatId:null,insightId:null},...h}}})}setShouldScrollToMention(h){this._shouldScrollToMention.set(h)}setAgentType(h){this._agentType.set(h)}requestNewSession(){this._newSessionRequested.set(!0)}consumeNewSessionRequest(){const h=this._newSessionRequested();return h&&this._newSessionRequested.set(!1),h}getSelectionForAgent(h){let _=this._selectionSignals.get(h);return _||(_=(0,e.S6b)(()=>{var R;return null!==(R=this._selectionByAgent()[h])&&void 0!==R?R:{chatId:null,insightId:null}}),this._selectionSignals.set(h,_)),_}reset(){this._activeTab.set(null),this._selectionByAgent.set({}),this._shouldScrollToMention.set(!1),this._agentType.set(null),this._newSessionRequested.set(!1)}}return(D=d).\u0275fac=function(h){return new(h||D)},D.\u0275prov=e.wxM({token:D,factory:D.\u0275fac,providedIn:"root"}),d})()},85311:(J,Y,l)=>{l.d(Y,{g:()=>$});var e=l(34896);let $=(()=>{var E;class L{constructor(){this.chatsByAgent=(0,e.OCB)({}),this.loadingByAgent=(0,e.OCB)({}),this.initialLoadingByAgent=(0,e.OCB)({}),this._streamingSegments=(0,e.OCB)([]),this._lastStreamedAt=(0,e.OCB)(null),this.streamingSegments=this._streamingSegments.asReadonly(),this.lastStreamedAt=this._lastStreamedAt.asReadonly()}getChatHistory(d){return(0,e.S6b)(()=>{var m;return(null===(m=this.chatsByAgent()[d])||void 0===m?void 0:m.history)||[]})}getCurrentChat(d){return(0,e.S6b)(()=>{var m;return null!==(m=this.chatsByAgent()[d])&&void 0!==m?m:null})}setCurrentChat(d,m){var h;if(!m)return void this.chatsByAgent.update(P=>({...P,[d]:null}));const _=null===(h=this.chatsByAgent()[d])||void 0===h?void 0:h.id;(!_||_!==m.id)&&this.chatsByAgent.update(P=>({...P,[d]:null})),this.chatsByAgent.update(P=>({...P,[d]:{...m,history:m.history||[]}}))}getLoadingState(d){return(0,e.S6b)(()=>{var m;return null!==(m=this.loadingByAgent()[d])&&void 0!==m&&m})}setLoadingState(d,m){this.loadingByAgent.update(h=>({...h,[d]:m}))}getInitialLoadingState(d){return(0,e.S6b)(()=>{var m;return null!==(m=this.initialLoadingByAgent()[d])&&void 0!==m&&m})}setInitialLoadingState(d,m){this.initialLoadingByAgent.update(h=>({...h,[d]:m}))}setStreamingSegments(d){this._streamingSegments.set(d)}clearStreamingSegments(){this._streamingSegments.set([])}markLastStreamed(d){this._lastStreamedAt.set(d)}patchStreamMeta(d,m){this.chatsByAgent.update(h=>{var _,R;const P=null!==(_=h[d])&&void 0!==_?_:null;var k;return P?{...h,[d]:{...P,id:m.id,insightId:null!==(R=m.insightId)&&void 0!==R?R:P.insightId}}:{...h,[d]:{id:m.id,insightId:null!==(k=m.insightId)&&void 0!==k?k:void 0,history:[]}}})}updateChatHistory(d,m,h,_,R=!1,P){const k=Date.now();this.chatsByAgent.update(a=>{var M,A;const p=null!==(M=a[d])&&void 0!==M?M:null,s=_||(null==p?void 0:p.id)||"",I=!!_&&!(null==p||!p.id)&&_!==p.id,b=p&&!I&&p.history||[],F={content:h,timestamp:k,sender:m,...(null==P||null===(A=P.thinkingSteps)||void 0===A?void 0:A.length)&&{thinkingSteps:P.thinkingSteps},...(null==P?void 0:P.thinkingError)&&{thinkingError:P.thinkingError}};return{...a,[d]:{...p&&!I?p:{},id:s,history:[...b,F]}}}),R&&this._lastStreamedAt.set(k)}markCurrentAsNew(d){this.chatsByAgent.update(m=>{const h=m[d];return h?{...m,[d]:{...h,isNewChat:!0}}:m})}popLastMessage(d){this.chatsByAgent.update(m=>{var h;const _=m[d];return null!=_&&null!==(h=_.history)&&void 0!==h&&h.length?{...m,[d]:{..._,history:_.history.slice(0,-1)}}:m})}}return(E=L).\u0275fac=function(d){return new(d||E)},E.\u0275prov=e.wxM({token:E,factory:E.\u0275fac,providedIn:"root"}),L})()},2711:(J,Y,l)=>{l.d(Y,{e:()=>Fe});var e=l(34896),$=l(18184),E=l(61616),L=l(40604),D=l(51672),d=l(1296),m=l(27488),h=l(78600),_=l(94364),R=l(76016),P=l(6560),k=l(37496),a=l(23580),M=l(20968),A=l(33712),p=l(90520),s=l(35392);function b(){return(b=(0,s.c)(function*(n,r){const g=n.getReader();let t;for(;!(t=yield g.read()).done;)r(t.value)})).apply(this,arguments)}const K="text/event-stream",ne="last-event-id";function ce(n,r){var{signal:g,headers:t,onopen:i,onmessage:o,onclose:f,onerror:v,openWhenHidden:S,fetch:c}=r,N=function(n,r){var g={};for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&r.indexOf(t)<0&&(g[t]=n[t]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(t=Object.getOwnPropertySymbols(n);i<t.length;i++)r.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(n,t[i])&&(g[t[i]]=n[t[i]])}return g}(r,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise((W,oe)=>{const z=Object.assign({},t);let H;function q(){H.abort(),document.hidden||pe()}z.accept||(z.accept=K),S||document.addEventListener("visibilitychange",q);let ee=1e3,Q=0;function me(){document.removeEventListener("visibilitychange",q),window.clearTimeout(Q),H.abort()}null==g||g.addEventListener("abort",()=>{me(),W()});const Re=null!=c?c:window.fetch,Be=null!=i?i:u;function pe(){return fe.apply(this,arguments)}function fe(){return fe=(0,s.c)(function*(){var _e;H=new AbortController;try{const le=yield Re(n,Object.assign(Object.assign({}
3,N),{headers:z,signal:H.signal}));yield Be(le),yield function I(n,r){return b.apply(this,arguments)}(le.body,function F(n){let r,g,t,i=!1;return function(f){void 0===r?(r=f,g=0,t=-1):r=function C(n,r){const g=new Uint8Array(n.length+r.length);return g.set(n),g.set(r,n.length),g}(r,f);const v=r.length;let S=0;for(;g<v;){i&&(10===r[g]&&(S=++g),i=!1);let c=-1;for(;g<v&&-1===c;++g)switch(r[g]){case 58:-1===t&&(t=g-S);break;case 13:i=!0;case 10:c=g}if(-1===c)break;n(r.subarray(S,c),t),S=g,t=-1}S===v?r=void 0:0!==S&&(r=r.subarray(S),g-=S)}}(function x(n,r,g){let t={data:"",event:"",id:"",retry:void 0};const i=new TextDecoder;return function(f,v){if(0===f.length)null==g||g(t),t={data:"",event:"",id:"",retry:void 0};else if(v>0){const S=i.decode(f.subarray(0,v)),N=i.decode(f.subarray(v+(32===f[v+1]?2:1)));switch(S){case"data":t.data=t.data?t.data+"\n"+N:N;break;case"event":t.event=N;break;case"id":n(t.id=N);break;case"retry":const W=parseInt(N,10);isNaN(W)||r(t.retry=W)}}}}(Z=>{Z?z[ne]=Z:delete z[ne]},Z=>{ee=Z},o))),null==f||f(),me(),W()}catch(le){if(!H.signal.aborted)try{const Z=null!==(_e=null==v?void 0:v(le))&&void 0!==_e?_e:ee;window.clearTimeout(Q),Q=window.setTimeout(pe,Z)}catch(Z){me(),oe(Z)}}}),fe.apply(this,arguments)}pe()})}function u(n){const r=n.headers.get("content-type");if(null==r||!r.startsWith(K))throw new Error("Expected content-type to be ".concat(K,", Actual: ").concat(r))}var O=l(21296),T=l(4376);let w,G,j=(()=>{var n;class r{constructor(){this.viewAsService=(0,e.uUt)(T.g),this.baseUrl="api/agentic"}createChatStream(t,i){const o=i===$.kF.Vault?"".concat(this.baseUrl,"/vault/chat"):this.buildUrl(w||(w=Oe||(Oe=X(["","/insights/chat"]))),i);return this.postSse(o,this.withViewedCompany(t))}sendMessageStream(t){const i=this.buildUrl(G||(G=Pe||(Pe=X(["","/insight/chat/","/message"]))),t.type,t.chatId);return this.postSse(i,this.withViewedCompany({prompt:t.prompt}))}withViewedCompany(t){const i=this.viewAsService.companyId();return t.companyId||!i?t:{...t,companyId:i}}postSse(t,i){return new O._(o=>{const f=new AbortController;let v;return ce(t,{signal:f.signal,method:"POST",openWhenHidden:!0,headers:{"Content-Type":"application/json",Accept:"".concat(K,", application/json")},body:JSON.stringify(i),credentials:"include",onopen:S=>(0,s.c)(function*(){if(!S.ok){const N=yield S.text();throw new Error(N||"".concat(S.status," ").concat(S.statusText))}const c=S.headers.get("content-type")||"";if(c.includes("application/json"))v=yield S.json();else if(!c.startsWith(K))throw new Error("Unexpected content-type: ".concat(c))})(),onmessage(S){const c=function ie(n){var r;const g=(n.event||"message").trim(),t=null!==(r=n.data)&&void 0!==r?r:"";try{switch(g){case"initial":{var i,o;const c=JSON.parse(t);return null==(null==c?void 0:c.id)?null:{type:"initial",id:c.id,insightId:null!==(i=c.insightId)&&void 0!==i?i:null,timestamp:null!==(o=c.timestamp)&&void 0!==o?o:null}}case"message":return t.length?{type:"message",content:t}:null;case"error":return{type:"error",content:t};case"completed":{var f,v;const c=JSON.parse(t);return null==(null==c?void 0:c.id)?null:{type:"completed",id:c.id,insightId:null!==(f=c.insightId)&&void 0!==f?f:null,timestamp:null!==(v=c.timestamp)&&void 0!==v?v:null}}case"ThinkContentDelta":case"thinkContentDelta":{const c=V(t);return null!=c&&c.runId&&c.content?{type:"thinkContentDelta",runId:c.runId,content:c.content}:null}case"ThinkCompleted":case"thinkCompleted":{const c=V(t);return null!=c&&c.runId?{type:"thinkCompleted",runId:c.runId}:null}case"ThinkError":case"thinkError":{var S;const c=V(t);return null!=c&&c.runId?{type:"thinkError",runId:c.runId,message:null!==(S=c.message)&&void 0!==S?S:""}:null}default:return null}}catch{return{type:"error",content:t||"Invalid stream data"}}}(S);c&&o.next(c)},onerror(S){throw S}}).then(()=>{void 0!==v&&function de(n,r){var g,t,i,o;const f=r,v=String(null!==(g=null!==(t=f.id)&&void 0!==t?t:f.chatId)&&void 0!==g?g:""),S=null!==(i=f.insightId)&&void 0!==i?i:null,c="number"==typeof f.timestamp?f.timestamp:null,N=String(null!==(o=f.content)&&void 0!==o?o:"");n.next({type:"initial",id:v,insightId:S,timestamp:c}),N.length>0&&n.next({type:"message",content:N}),n.next({type:"completed",id:v,insightId:S,timestamp:c})}(o,v),o.complete()}).catch(S=>{f.signal.aborted||o.error(S instanceof Error?S:new Error(String(S)))}),()=>f.abort()})}buildUrl(t,...i){const o=t.reduce((f,v,S)=>{var c;return f+v+(null!==(c=i[S])&&void 0!==c?c:"")},"");return"".concat(this.baseUrl,"/").concat(o)}}return(n=r).\u0275fac=function(t){return new(t||n)},n.\u0275prov=e.wxM({token:n,factory:n.\u0275fac,providedIn:"root"}),r})();function V(n){try{var r;const g=JSON.parse(n);return{runId:null!==(r=null==g?void 0:g.runId)&&void 0!==r?r:null==g?void 0:g.run_id,content:null==g?void 0:g.content,message:null==g?void 0:g.message}}catch{return null}}var he=l(85311),re=l(27504);function ae(n){return n.find(r=>"thinking"===r.kind)}function ge(n,r){const g=n.segments.filter(t=>"thinking"!==t.kind);return{...n,segments:[r,...g]}}function ue(n){var r,g;return null!=n&&null!==(r=n.steps)&&void 0!==r&&r.length||null!=n&&n.error?[{kind:"thinking",...(null===(g=n.steps)||void 0===g?void 0:g.length)&&{steps:n.steps.map(t=>({...t,done:!0}))},...n.error&&{error:n.error}}]:[]}function Ae(n,r){var g,t;switch(r.type){case"initial":return{...n,meta:{id:r.id,insightId:null!==(g=r.insightId)&&void 0!==g?g:null,timestamp:null!==(t=r.timestamp)&&void 0!==t?t:null}};
3case"message":{if(!r.content)return n;const z=n.accumulated+r.content,H=ue(ae(n.segments)),q=n.segments.filter(ee=>"thinking"!==ee.kind&&"assistant"!==ee.kind);return{...n,accumulated:z,segments:[...H,...q,{kind:"assistant",accumulated:z}]}}case"error":return{...n,finished:!0,segments:[...ue(ae(n.segments)),...n.segments.filter(z=>"thinking"!==z.kind),{kind:"error",message:r.content}]};case"completed":{var i,o,f,v,S,c;const z=n.segments.filter(Q=>"thinking"!==Q.kind&&"completed"!==Q.kind),H=ue(ae(n.segments)),ee=z.some(Q=>"assistant"===Q.kind)||!n.accumulated?z:[...z.filter(Q=>"assistant"!==Q.kind),{kind:"assistant",accumulated:n.accumulated}];return{...n,finished:!0,meta:{id:r.id,insightId:null!==(i=null!==(o=r.insightId)&&void 0!==o?o:n.meta.insightId)&&void 0!==i?i:null,timestamp:null!==(f=null!==(v=r.timestamp)&&void 0!==v?v:n.meta.timestamp)&&void 0!==f?f:null},segments:[...H,...ee,{kind:"completed",id:r.id,insightId:null!==(S=r.insightId)&&void 0!==S?S:null,timestamp:null!==(c=r.timestamp)&&void 0!==c?c:null}]}}case"thinkContentDelta":{var N;const z=ae(n.segments);return z&&r.content?ge(n,{kind:"thinking",steps:[...(null!==(N=z.steps)&&void 0!==N?N:[]).map(q=>({...q,done:!0})),{text:r.content,done:!1}]}):n}case"thinkCompleted":{var W;const z=ae(n.segments);return z?ge(n,{kind:"thinking",...(null===(W=z.steps)||void 0===W?void 0:W.length)&&{steps:z.steps.map(H=>({...H,done:!0}))},...z.error&&{error:z.error}}):n}case"thinkError":{var oe;const z=ae(n.segments);return z?ge(n,{kind:"thinking",...(null===(oe=z.steps)||void 0===oe?void 0:oe.length)&&{steps:z.steps.map(H=>({...H,done:!0}))},error:r.message}):n}default:return n}}var Ie=l(68696);let Fe=(()=>{var n;class r{constructor(){this.chatApiService=(0,e.uUt)(p.o),this.agenticChatSse=(0,e.uUt)(j),this.chatStateService=(0,e.uUt)(he.g),this.translatePipe=(0,e.uUt)(re.s),this.viewAsService=(0,e.uUt)(T.g),this.streamCancel$=new E.E,this.suggestionsCache=new Map}getSuggestions(t,i){var o;const f="".concat(t,":").concat(null!==(o=i.companyId)&&void 0!==o?o:"");let v=this.suggestionsCache.get(f);if(!v){const S=(n=>n.length<=3?n:Ie.sampleSize(n,3))(i.fallback);v=this.chatApiService.getSuggestions(t,i.companyId).pipe((0,L.k)(c=>Array.isArray(c)&&c.length?c:S),(0,D.a)(()=>(0,d.of)(S)),(0,m.C)(1)),this.suggestionsCache.set(f,v)}return v}getStreamingSegments(){return this.chatStateService.streamingSegments}getLastStreamedAt(){return this.chatStateService.lastStreamedAt}getChatHistory(t){return this.chatStateService.getChatHistory(t)}getCurrentChat(t){return this.chatStateService.getCurrentChat(t)}getLoadingState(t){return this.chatStateService.getLoadingState(t)}getInitialLoadingState(t){return this.chatStateService.getInitialLoadingState(t)}setCurrentChat(t,i){var o;const f=null===(o=this.chatStateService.getCurrentChat(t)())||void 0===o?void 0:o.id;(!i||i.id!==f)&&this.cancelActiveStream(),this.chatStateService.setCurrentChat(t,i)}getAgentChats(t,i){var o,f;const v=null!==(o=null!==(f=null==i?void 0:i.companyId)&&void 0!==f?f:this.viewAsService.companyId())&&void 0!==o?o:void 0;return this.withLoading(t,this.chatApiService.getAgentChats(t,{...i,companyId:v}))}getConversationHistory(t,i){return this.withInitialLoading(t,this.chatApiService.getConversationHistory(t,i).pipe((0,h.y)(o=>{this.setCurrentChat(t,o)})))}createChat(t,i){return this.chatStateService.getLoadingState(i)()?(0,d.of)(null):(this.cancelActiveStream(),this.chatStateService.setStreamingSegments([{kind:"thinking"}]),this.chatStateService.updateChatHistory(i,"user",t.prompt),this.withLoading(i,this.runAgenticChatStream(i,this.agenticChatSse.createChatStream(t,i))))}sendMessage({prompt:t,chatId:i,type:o}){return this.cancelActiveStream(),this.chatStateService.setStreamingSegments([{kind:"thinking"}]),this.chatStateService.updateChatHistory(o,"user",t,i),this.withLoading(o,this.runAgenticChatStream(o,this.agenticChatSse.sendMessageStream({prompt:t,chatId:i,type:o})))}cancelActiveStream(){this.chatStateService.streamingSegments().length>0&&this.chatStateService.clearStreamingSegments(),this.streamCancel$.next()}fetchChatById(t,i){return this.withInitialLoading(t,this.chatApiService.fetchChatById(t,i).pipe((0,h.y)(o=>{o&&this.setCurrentChat(t,o)}),(0,D.a)(()=>(0,d.of)(null))))}renameChat(t,i,o){return this.withLoading(t,this.chatApiService.renameChat(t,i,o).pipe((0,D.a)(()=>(0,d.of)(null))))}deleteChat(t,i){return this.withLoading(t,this.chatApiService.deleteChat(t,i).pipe((0,D.a)(()=>(0,d.of)(null))))}runAgenticChatStream(t,i){return i.pipe((0,_.a)(this.streamCancel$),(0,R.K)(Ae,{segments:[{kind:"thinking"}],accumulated:"",meta:{},finished:!1}),(0,h.y)(o=>{this.chatStateService.setStreamingSegments(o.segments),o.meta.id&&this.chatStateService.patchStreamMeta(t,{id:o.meta.id,insightId:o.meta.insightId})}),(0,P.I)(o=>o.finished),(0,k.U)(1),(0,L.k)(o=>{var f;const v=o.segments.find(W=>"thinking"===W.kind),S={...(null==v||null===(f=v.steps)||void 0===f?void 0:f.length)&&{thinkingSteps:v.steps},...(null==v?void 0:v.error)&&{thinkingError:v.error}},c=o.segments.find(W=>"error"===W.kind);if(c)return this.chatStateService.updateChatHistory(t,"error",c.message,void 0,!1,S),this.chatStateService.clearStreamingSegments(),null;const N=function Ee(n){var r,g;if(!n.meta.id&&!n.accumulated)return null;const t=n.meta.id||"";return{id:t,chatId:t,insightId:null!==(r=n.meta.insightId)&&void 0!==r?r:null,content:n.accumulated,timestamp:null!==(g=n.meta.timestamp)&&void 0!==g?g:null}}(o);return null==v||!v.error||null!=N&&N.content?(null!=N&&N.id&&this.chatStateService.updateChatHistory(t,"system",N.content,N.id,!0,S),this.chatStateService.clearStreamingSegments(),N):(this.chatStateService.updateChatHistory(t,"error",v.error,void 0,!1,S),this.chatStateService.clearStreamingSegments(),null)}),(0,a.G)(null),(0,h.y)(o=>{null!==o||0===this.chatStateService.streamingSegments().length||(this.chatStateService.clearStreamingSegments(),this.chatStateService.updateChatHistory(t,"error",this.translatePipe.transform("ai_chat_system_error")))}),(0,D.a)(o=>{if(this.chatStateService.popLastMessage(t),!this.isLimitConflict(o,t)){const f=this.resolveErrorMessage(o);this.chatStateService.updateChatHistory(t,"error",f)}return this.chatStateService.clearStreamingSegments(),(0,d.of)(null)}))}withLoading(t,i){return this.chatStateService.setLoadingState(t,!0),i.pipe((0,M.U)(()=>{this.chatStateService.setLoadingState(t,!1)}))}withInitialLoading(t,i){return this.chatStateService.setInitialLoadingState(t,!0),i.pipe((0,M.U)(()=>{this.chatStateService.setInitialLoadingState(t,!1)}))}isLimitConflict(t,i){return i===$.kF.Vault&&t instanceof A.gj&&409===t.status}resolveErrorMessage(t){const i=this.translatePipe.transform("ai_chat_system_error");
3if(!(t instanceof A.gj))return i;const o=t.error,f="string"==typeof o?o:null==o?void 0:o.message;return"string"==typeof f&&f.trim()?f:i}}return(n=r).\u0275fac=function(t){return new(t||n)},n.\u0275prov=e.wxM({token:n,factory:n.\u0275fac,providedIn:"root"}),r})()},13864:(J,Y,l)=>{l.d(Y,{u:()=>$});var e=l(34896);let $=(()=>{var E;class L{transform(d){return null==d?d:d.split(/(```[\s\S]*?```|`[^`\n]*`)/g).map((m,h)=>h%2==0?this.normalizeProse(m):m).join("")}normalizeProse(d){return d.replace(/\\r\\n/g,"\n").replace(/\\n/g,"\n").replace(/\\r/g,"\n").replace(new RegExp("(?<!\\|)\\n(?!\\|)","gm")," \n \n ")}}return(E=L).\u0275fac=function(d){return new(d||E)},E.\u0275pipe=e.UTH({name:"adNormalizeMarkdown",type:E,pure:!0,standalone:!0}),L})()}}]);
4//# debugId=8ea018d5-c36b-5f7c-b7e8-01fee548e4b2

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.