@recombine-ai/platform 0.11.2 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bosun/index.d.ts +2 -2
- package/build/bosun/index.d.ts.map +1 -1
- package/build/bosun/interfaces/agent.d.ts +7 -0
- package/build/bosun/interfaces/agent.d.ts.map +1 -1
- package/build/bosun/interfaces/project.d.ts +6 -0
- package/build/bosun/interfaces/project.d.ts.map +1 -1
- package/build/bosun-app/backend/server.js +7076 -6658
- package/build/bosun-app/backend/server.js.map +4 -4
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{DGqwi6rZ.js → BA_s3vf-.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BA_s3vf-.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BA_s3vf-.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{CjkTW30g.js → BDj12791.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BDj12791.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BDj12791.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{DVqcTvSV.js → BundM1xT.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BundM1xT.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/BundM1xT.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CWrb40J2.js +1 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CWrb40J2.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CWrb40J2.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DaPi9zoH.js +3 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DaPi9zoH.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DaPi9zoH.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/{DiNgE43O.js → hHPtUt6H.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/hHPtUt6H.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/hHPtUt6H.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/{app.rHjbMnFc.js → app.DEGfM7JG.js} +2 -2
- package/build/bosun-app/frontend/client/_app/immutable/entry/app.DEGfM7JG.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/app.DEGfM7JG.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.D2Q-9wJB.js +1 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.D2Q-9wJB.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.D2Q-9wJB.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{0.CffmfeCN.js → 0.D4hVCSQO.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/0.D4hVCSQO.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/0.D4hVCSQO.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{1.CmX_nRov.js → 1.exu_SEtw.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/1.exu_SEtw.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/1.exu_SEtw.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{10.BwODd0ab.js → 10.D9EOZOcA.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/10.D9EOZOcA.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/10.D9EOZOcA.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{17.BxiBPC57.js → 17.BBzzkhS3.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/17.BBzzkhS3.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/17.BBzzkhS3.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{18.fUMviTUO.js → 18.C1Wu7YII.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/18.C1Wu7YII.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/18.C1Wu7YII.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.K_wNLkOy.js +35 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.K_wNLkOy.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.K_wNLkOy.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{3.BpSGVLcf.js → 3.DC1YtH2n.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/3.DC1YtH2n.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/3.DC1YtH2n.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{4.BmcqYasy.js → 4.DjofsVgf.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/4.DjofsVgf.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/4.DjofsVgf.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{5.DXFquMVj.js → 5.Daft73xD.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/5.Daft73xD.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/5.Daft73xD.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{6.WMxmoB8u.js → 6.BC5i16hF.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/6.BC5i16hF.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/6.BC5i16hF.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/{8.DN7-_OgI.js → 8.BD-2mMOE.js} +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/nodes/8.BD-2mMOE.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/8.BD-2mMOE.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DStZMtBP.js +2 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DStZMtBP.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DStZMtBP.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/version.json +1 -1
- package/build/bosun-app/frontend/client/_app/version.json.br +0 -0
- package/build/bosun-app/frontend/client/_app/version.json.gz +0 -0
- package/build/bosun-app/frontend/handler.js +4 -4
- package/build/bosun-app/frontend/index.js +4 -4
- package/build/bosun-app/frontend/server/chunks/chunks/{internal.js-B9o0piPQ.js → internal.js-B2-81-og.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/chunks/{internal.js-B9o0piPQ.js.map → internal.js-B2-81-og.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/chunks/{log-content.svelte.js-C6EzbHLC.js → log-content.svelte.js-NCi6Gu4g.js} +6 -3
- package/build/bosun-app/frontend/server/chunks/chunks/log-content.svelte.js-NCi6Gu4g.js.map +1 -0
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/{_layout.svelte.js-B2wHKJV7.js → _layout.svelte.js-bpxxSpHz.js} +76 -5
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/_layout.svelte.js-bpxxSpHz.js.map +1 -0
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/roleplay/{_page.svelte.js-DDcIjgZD.js → _page.svelte.js-aRz73jD-.js} +58 -18
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/roleplay/_page.svelte.js-aRz73jD-.js.map +1 -0
- package/build/bosun-app/frontend/server/chunks/{handler-CfBVe8pc.js → handler-C5nNwvq2.js} +3 -3
- package/build/bosun-app/frontend/server/chunks/{handler-CfBVe8pc.js.map → handler-C5nNwvq2.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/{index.js-ve0cVNqU.js → index.js-OQig22wo.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/{index.js-ve0cVNqU.js.map → index.js-OQig22wo.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/{manifest.js-BQtoc_eZ.js → manifest.js-mMK7bnzv.js} +14 -14
- package/build/bosun-app/frontend/server/chunks/{manifest.js-BQtoc_eZ.js.map → manifest.js-mMK7bnzv.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{0.js-BvF-NlS2.js → 0.js-DHGYS99S.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{0.js-BvF-NlS2.js.map → 0.js-DHGYS99S.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{1.js-Bymq1A1s.js → 1.js-Bcf6Apx5.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{1.js-Bymq1A1s.js.map → 1.js-Bcf6Apx5.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{10.js-B5EUlAGJ.js → 10.js-DrOSxSqp.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{10.js-B5EUlAGJ.js.map → 10.js-DrOSxSqp.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{17.js-BMWgwZ_e.js → 17.js-CI2KQfFS.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{17.js-BMWgwZ_e.js.map → 17.js-CI2KQfFS.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{18.js-CVZTrZNt.js → 18.js-BrwBD9MG.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{18.js-CVZTrZNt.js.map → 18.js-BrwBD9MG.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{2.js-CRAy3ydl.js → 2.js-CGziSbJs.js} +3 -3
- package/build/bosun-app/frontend/server/chunks/nodes/{2.js-CRAy3ydl.js.map → 2.js-CGziSbJs.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{3.js-CUE-Y7gE.js → 3.js-jXjzl_HM.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{3.js-CUE-Y7gE.js.map → 3.js-jXjzl_HM.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{4.js-C7XtMBCk.js → 4.js-DHb154Fk.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{4.js-C7XtMBCk.js.map → 4.js-DHb154Fk.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{5.js-D4_PnZHP.js → 5.js-DncWCDEN.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{5.js-D4_PnZHP.js.map → 5.js-DncWCDEN.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{6.js-BjqcswgO.js → 6.js-DDVvJCgQ.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{6.js-BjqcswgO.js.map → 6.js-DDVvJCgQ.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{8.js-BYf2Dqth.js → 8.js-DQx6ZWZj.js} +2 -2
- package/build/bosun-app/frontend/server/chunks/nodes/{8.js-BYf2Dqth.js.map → 8.js-DQx6ZWZj.js.map} +1 -1
- package/build/bosun-app/frontend/server/chunks/nodes/{9.js-BumKWgh1.js → 9.js-CWugbQHv.js} +3 -3
- package/build/bosun-app/frontend/server/chunks/nodes/{9.js-BumKWgh1.js.map → 9.js-CWugbQHv.js.map} +1 -1
- package/package.json +1 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CjkTW30g.js.br +0 -2
- package/build/bosun-app/frontend/client/_app/immutable/chunks/CjkTW30g.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/D9OWCkdk.js +0 -3
- package/build/bosun-app/frontend/client/_app/immutable/chunks/D9OWCkdk.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/D9OWCkdk.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DGqwi6rZ.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DGqwi6rZ.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DVqcTvSV.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DVqcTvSV.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DiNgE43O.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/DiNgE43O.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/ouMvMh56.js +0 -1
- package/build/bosun-app/frontend/client/_app/immutable/chunks/ouMvMh56.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/chunks/ouMvMh56.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/app.rHjbMnFc.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/app.rHjbMnFc.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.CocMZrbB.js +0 -1
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.CocMZrbB.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/entry/start.CocMZrbB.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/0.CffmfeCN.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/0.CffmfeCN.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/1.CmX_nRov.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/1.CmX_nRov.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/10.BwODd0ab.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/10.BwODd0ab.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/17.BxiBPC57.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/17.BxiBPC57.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/18.fUMviTUO.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/18.fUMviTUO.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.DMc2hXxC.js +0 -35
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.DMc2hXxC.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/2.DMc2hXxC.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/3.BpSGVLcf.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/3.BpSGVLcf.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/4.BmcqYasy.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/4.BmcqYasy.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/5.DXFquMVj.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/5.DXFquMVj.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/6.WMxmoB8u.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/6.WMxmoB8u.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/8.DN7-_OgI.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/8.DN7-_OgI.js.gz +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DlckNySe.js +0 -2
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DlckNySe.js.br +0 -0
- package/build/bosun-app/frontend/client/_app/immutable/nodes/9.DlckNySe.js.gz +0 -0
- package/build/bosun-app/frontend/server/chunks/chunks/log-content.svelte.js-C6EzbHLC.js.map +0 -1
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/_layout.svelte.js-B2wHKJV7.js.map +0 -1
- package/build/bosun-app/frontend/server/chunks/entries/pages/edit/_agent_/roleplay/_page.svelte.js-DDcIjgZD.js.map +0 -1
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/DLQqXQ6R.js","../chunks/C1FmrZbK.js","../assets/editor.BMIWPGx3.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
var sr=Object.defineProperty;var ar=(P,T,c)=>T in P?sr(P,T,{enumerable:!0,configurable:!0,writable:!0,value:c}):P[T]=c;var Me=(P,T,c)=>ar(P,typeof T!="symbol"?T+"":T,c);import{a as ee,f as ge,d as Qt,b as Tt,t as Ue,c as Lt}from"../chunks/CCYriF4C.js";import{o as Yt,a as Cn}from"../chunks/DnMQeiTY.js";import{p as gt,j as _,a as yt,n as we,br as lr,y as ne,d as Xe,c as ie,r as te,w as Pe,s as de,o as Ke,t as je,f as Qe,a4 as cr,bh as ur,_ as fr,x as vn,T as mn}from"../chunks/CR-uVjxM.js";import{s as Ne}from"../chunks/B0nqNj93.js";import{i as Ie}from"../chunks/BQIf5msi.js";import{M as Ut,k as pr,R as hr}from"../chunks/C3cROXCy.js";import{e as mt,i as Ht}from"../chunks/DuQdgMax.js";import{s as dr}from"../chunks/9mOMnnWN.js";import{a as vr,r as Pn,e as mr,c as gr}from"../chunks/CR5IRTqC.js";import{s as yr}from"../chunks/C9yBjdYI.js";import{b as _r,a as xr}from"../chunks/B9pMb6OP.js";import{P as bt,g as Nn,s as wr}from"../chunks/CHCMKZAC.js";import{B as Ze}from"../chunks/joiJcRPz.js";import{d as gn,e as br,f as Er,g as kr,D as Sr}from"../chunks/ouMvMh56.js";import{I as Or}from"../chunks/BBk8_Xpk.js";import{T as Gt,a as dt}from"../chunks/BEdAvgYp.js";import{b as Jt}from"../chunks/ClLUwVGq.js";import{p as ot,r as Lr}from"../chunks/BcbX6huO.js";import{p as Wt,l as Tr,C as Ar,P as yn}from"../chunks/BW6P0Ecp.js";import{r as Cr,g as wt}from"../chunks/DiNgE43O.js";import{p as et}from"../chunks/CjkTW30g.js";import{e as qt,t as tt}from"../chunks/DGqwi6rZ.js";import{i as Pr}from"../chunks/DgGeUDDh.js";import{_ as Rn}from"../chunks/C1FmrZbK.js";import{e as In,a as Fn,c as Nr}from"../chunks/BU7aeYn4.js";import{A as Rr}from"../chunks/C0rPkxmP.js";import{g as Ir}from"../chunks/Dba0_Upf.js";import"../chunks/DXsF11_5.js";import{i as Fr}from"../chunks/Bp8N7Z1t.js";import{c as _n,a as Br}from"../chunks/B1dhmiqQ.js";var Mr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Kr(P){return P&&P.__esModule&&Object.prototype.hasOwnProperty.call(P,"default")?P.default:P}var jr=new Set(["$$slots","$$events","$$legacy","class","value","variant","el"]),Dr=ge("<textarea></textarea>");function $r(P,T){gt(T,!0);let c=ot(T,"class",3,""),S=ot(T,"value",15,""),w=ot(T,"variant",3,"config"),p=ot(T,"el",15),E=Lr(T,jr),f=we(()=>w()==="chat"?`textarea-chat ${c()}`:`textarea-config ${c()}`);var t=Dr();lr(t),vr(t,()=>({class:_(f),...E}),void 0,void 0,void 0,"svelte-1ilrf3m"),Jt(t,y=>p(y),()=>p()),_r(t,S),ee(P,t),yt()}class Vr{constructor(T){Me(this,"ws",null);Me(this,"openHandler",null);Me(this,"closeHandler",null);Me(this,"errorHandler",null);Me(this,"messageHandler",null);Me(this,"retries",0);Me(this,"maxRetries",5);Me(this,"retryDelay",500);Me(this,"retryTimeout",null);Me(this,"isOpen",!1);Me(this,"isDestroyed",!1);Me(this,"agentsLoaded",!1);Me(this,"init",()=>{if(!this.isOpen){this.agentsLoaded=!1,console.log(`Initializing websocket connection with [${this.wsUrl}]`);try{this.ws=new WebSocket(this.wsUrl)}catch{this.retryConnect();return}this.isDestroyed=!1,this.ws.onmessage=T=>{var S,w,p,E,f,t,y,O;const c=JSON.parse(T.data);c.channel==="error"?(S=this.errorHandler)==null||S.call(this,c.message):c.channel==="app-events"?(console.log("MSG:",c.event.type),c.event.type==="agents-loaded"&&(this.agentsLoaded=!0)):c.channel==="log"?console.log(`MSG: log [${c.message.severity}]`,c.message.message):c.channel==="api-call-trace"?console.log("MSG: api-call-trace",(w=c.trace)==null?void 0:w.operationName,(p=c.trace)==null?void 0:p.method,(E=c.trace)==null?void 0:E.path):c.channel==="conversational-trace"&&console.log("MSG: conversational-trace",(f=c.trace)==null?void 0:f.eventName,(t=c.trace)==null?void 0:t.role,(y=c.trace)==null?void 0:y.medium),(O=this.messageHandler)==null||O.call(this,c)},this.ws.onerror=T=>{var c;console.error("Websocket error:",T),(c=this.ws)==null||c.close(),this.retryConnect()},this.ws.onclose=()=>{console.log("Websocket closed"),this.isOpen=!1,this.retryConnect()},this.ws.onopen=()=>{var T;this.retries=0,this.isOpen=!0,this.retryTimeout&&clearTimeout(this.retryTimeout),(T=this.openHandler)==null||T.call(this),console.log("Websocket connected")}}});Me(this,"destroy",()=>{var T;this.isDestroyed=!0,(T=this.ws)==null||T.close()});Me(this,"onOpen",T=>{this.openHandler=T,this.isOpen&&T()});Me(this,"onClose",T=>{this.closeHandler=T,this.isOpen||T()});Me(this,"onError",T=>{this.errorHandler=T});Me(this,"onMessage",T=>{this.messageHandler=T});Me(this,"sendMessage",T=>{var c;T.channel,(c=this.ws)==null||c.send(JSON.stringify(T))});Me(this,"isReady",()=>this.isOpen&&this.agentsLoaded);Me(this,"retryConnect",()=>{var T,c;this.isDestroyed||(!this.isOpen&&this.retries<this.maxRetries?(this.retries++,this.init(),this.retryTimeout=setTimeout(this.retryConnect,this.retryDelay)):((T=this.errorHandler)==null||T.call(this,"WebSocket Error, please reload the browser"),(c=this.closeHandler)==null||c.call(this)))});this.wsUrl=T}}const Ur=qt.PUBLIC_WS_HOST??`ws://${qt.PUBLIC_WS_HOSTNAME??"localhost"}:${qt.PUBLIC_WS_PORT??"8080"}`,ht=new Vr(Ur);var Wr=ge('<div class="flex h-full flex-col"><div class="h-full w-full"></div></div>');function qr(P,T){gt(T,!0);let c=Pe(null),S=null,w=[],p=!1,E;Yt(async()=>{if(!E)return;In();const f=await Rn(()=>import("../chunks/DLQqXQ6R.js").then(t=>t.e),__vite__mapDeps([0,1,2]),import.meta.url);p||(Fn(f),ne(c,f.editor.create(E,{value:T.schema??"",language:"typescript",theme:"bosun-dark",lineNumbers:"off",automaticLayout:!0,minimap:{enabled:!1},matchBrackets:"never",bracketPairColorization:{enabled:!1},guides:{highlightActiveBracketPair:!1,bracketPairs:!1,bracketPairsHorizontal:!1},occurrencesHighlight:"off",selectionHighlight:!1,unicodeHighlight:{ambiguousCharacters:!1,nonBasicASCII:!1,invisibleCharacters:!1,includeStrings:!1,includeComments:!1},autoClosingQuotes:"never"}),!0),S=_(c).getModel(),w.push(_(c).onDidChangeModelContent(()=>{if(!_(c))return;const t=_(c).getValue();t!==T.schema&&T.onChange(t)})))}),Cn(()=>{p=!0;for(const t of w)try{t.dispose()}catch{}w=[];const f=S;S=null;try{if(_(c)){try{_(c).setModel(null)}catch{}_(c).dispose()}}finally{ne(c,null)}try{f==null||f.dispose()}catch{}}),Xe(()=>{if(!_(c))return;const f=T.schema??"";_(c).getValue()!==f&&_(c).setValue(f)}),bt(P,{get class(){return`overflow-hidden ${T.class??""}`},children:(f,t)=>{var y=Wr(),O=ie(y);Jt(O,V=>E=V,()=>E),te(y),ee(f,y)}}),yt()}function Hr(P,T){return P.languages.registerCompletionItemProvider("markdown",{triggerCharacters:[" ","."],provideCompletionItems:(c,S)=>{const w=c.getValueInRange({startLineNumber:S.lineNumber,startColumn:1,endLineNumber:S.lineNumber,endColumn:S.column}),p=w.match(/\{%\s*(if|elif|for)\s+([^%]*)$/),E=w.match(/\{\{\s*([^}]*)$/);if(p||E){let t="";p?t=p[2].trim():E&&(t=E[1].trim());const{keys:y,lastPartLength:O}=Gr(T,t);return{suggestions:y.map(W=>({label:W,kind:P.languages.CompletionItemKind.Variable,insertText:W,range:{startLineNumber:S.lineNumber,endLineNumber:S.lineNumber,startColumn:S.column-O,endColumn:S.column}}))}}const f=w.match(/\{%\s*([^%]*)$/);if(f){const t=f[1].trim();return{suggestions:zt(["if","elif","else","endif","for","endfor"],t).map((O,V)=>({label:O,kind:P.languages.CompletionItemKind.Keyword,insertText:O,sortText:String(V).padStart(2,"0"),range:{startLineNumber:S.lineNumber,endLineNumber:S.lineNumber,startColumn:S.column-t.length,endColumn:S.column}}))}}return{suggestions:[]}}})}function Gr(P,T){let c=P,S=[],w=0;if(T==="")S=Object.keys(P??{}),w=0;else if(T.includes(".")){const p=T.split("."),E=p.pop()||"";w=E.length;for(const f of p)if(c&&typeof c=="object"&&f in c)c=c[f];else{c=null;break}c&&typeof c=="object"&&(S=zt(Object.keys(c),E))}else w=T.length,S=zt(Object.keys(P??{}),T);return{keys:S,lastPartLength:w}}function zt(P,T){return T?P.map((c,S)=>({value:c,index:S,match:zr(c,T)})).filter(c=>c.match!==null).sort((c,S)=>c.match.kindRank!==S.match.kindRank?c.match.kindRank-S.match.kindRank:c.match.span!==S.match.span?c.match.span-S.match.span:c.match.gapCount!==S.match.gapCount?c.match.gapCount-S.match.gapCount:c.match.start!==S.match.start?c.match.start-S.match.start:c.index-S.index).map(c=>c.value):P}function zr(P,T){const c=P.toLowerCase(),S=T.toLowerCase();if(!S)return null;if(c.startsWith(S))return{kindRank:0,start:0,span:S.length,gapCount:0};const w=c.indexOf(S);if(w!==-1)return{kindRank:Xr(P,w,S.length),start:w,span:S.length,gapCount:0};const p=Qr(c,S);return p?{kindRank:4,start:p.start,span:p.span,gapCount:p.gapCount}:null}function Qr(P,T){if(!P||!T)return null;let c=null,S=0;for(;S<P.length;){let w=S,p=0;for(;w<P.length&&p<T.length;)P[w]===T[p]&&(p+=1),w+=1;if(p!==T.length)break;const E=new Array(T.length);let f=w-1;for(let O=T.length-1;O>=0;O--){for(;f>=0&&P[f]!==T[O];)f-=1;if(f<0)return c;E[O]=f,f-=1}let t=0;for(let O=1;O<E.length;O++)t+=E[O]-E[O-1]-1;const y={start:E[0],span:E[E.length-1]-E[0]+1,gapCount:t};(!c||y.span<c.span||y.span===c.span&&y.gapCount<c.gapCount||y.span===c.span&&y.gapCount===c.gapCount&&y.start<c.start)&&(c=y),S=E[0]+1}return c}function Yr(P,T){return T<=0?!0:/[\s._-]/.test(P[T-1]??"")}function Jr(P,T){return T>=P.length?!0:/[\s._-]/.test(P[T]??"")}function Xr(P,T,c){const S=Yr(P,T),w=Jr(P,T+c);return S&&w?1:S?2:3}const Zr=/^(#{1,6})\s/,ei=/^\s*\{%\s*(if|elif|elseif|else|endif|for|endfor)\b/,ti={provideFoldingRanges(P){return ri(P)}},ni={provideFoldingRanges(P){return ii(P)}};function ri(P){const T=[],c=P.getLineCount(),S=[];for(let w=1;w<=c;w++){const p=Zr.exec(P.getLineContent(w));p&&S.push({line:w,level:p[1].length})}for(let w=0;w<S.length;w++){const{line:p,level:E}=S[w];let f=c;for(let t=w+1;t<S.length;t++)if(S[t].level<=E){f=S[t].line-1;break}f=Bn(P,p,f),f>p&&T.push({start:p,end:f})}return T}function ii(P){const T=[],c=[],S=P.getLineCount();for(let w=1;w<=S;w++){const p=ei.exec(P.getLineContent(w));if(!p)continue;const E=p[1];if(E==="if"){c.push({kind:"if",branchStarts:[w],startLine:w});continue}if(E==="for"){c.push({kind:"for",branchStarts:[w],startLine:w});continue}if(E==="elif"||E==="elseif"||E==="else"){const f=oi(c,"if");if(!f)continue;Ot(T,P,f.branchStarts.at(-1)??f.startLine,w-1),f.branchStarts.push(w);continue}if(E==="endif"){const f=xn(c,"if");if(!f)continue;Ot(T,P,f.branchStarts.at(-1)??f.startLine,w-1);continue}if(E==="endfor"){const f=xn(c,"for");if(!f)continue;Ot(T,P,f.startLine,w-1)}}for(const w of c){const p=w.kind==="if"?w.branchStarts.at(-1)??w.startLine:w.startLine;Ot(T,P,p,S)}return T}function oi(P,T){for(let c=P.length-1;c>=0;c--)if(P[c].kind===T)return P[c];return null}function xn(P,T){for(let c=P.length-1;c>=0;c--)if(P[c].kind===T)return P.splice(c,1)[0];return null}function Ot(P,T,c,S){const w=Bn(T,c,S);w>c&&P.push({start:c,end:w})}function Bn(P,T,c){let S=c;for(;S>T&&P.getLineContent(S).trim()==="";)S-=1;return S}const si=/\{%[-\s]*(if|elif|elseif|else|endif|for|endfor)\b/,ai={provideDocumentHighlights(P,T){const c=ci(P),S=T.lineNumber,w=T.column;for(const p of c)for(const E of p)if(E.line===S&&w>=E.startColumn&&w<=E.endColumn)return p.map(f=>({range:{startLineNumber:f.line,startColumn:f.startColumn,endLineNumber:f.line,endColumn:f.endColumn},kind:1}));return[]}};function li(P,T){const c=P.getLineContent(T),S=si.exec(c);if(!S)return null;const w=S[1],p=S.index+S[0].length-w.length;return{line:T,startColumn:p+1,endColumn:p+w.length+1,keyword:w}}function ci(P){const T=[],c=P.getLineCount(),S=[];for(let w=1;w<=c;w++){const p=li(P,w);if(!p)continue;const E=p.keyword;if(E==="if"){S.push({kind:"if",tags:[p]});continue}if(E==="for"){S.push({kind:"for",tags:[p]});continue}if(E==="elif"||E==="elseif"||E==="else"){const f=ui(S,"if");f&&f.tags.push(p);continue}if(E==="endif"){const f=wn(S,"if");f&&(f.tags.push(p),T.push(f.tags));continue}if(E==="endfor"){const f=wn(S,"for");f&&(f.tags.push(p),T.push(f.tags))}}return T}function ui(P,T){for(let c=P.length-1;c>=0;c--)if(P[c].kind===T)return P[c];return null}function wn(P,T){for(let c=P.length-1;c>=0;c--)if(P[c].kind===T)return P.splice(c,1)[0];return null}var Mn={exports:{}};/*! Browser bundle of nunjucks 3.2.4 */(function(P,T){(function(S,w){P.exports=w()})(typeof self<"u"?self:Mr,function(){return function(c){var S={};function w(p){if(S[p])return S[p].exports;var E=S[p]={i:p,l:!1,exports:{}};return c[p].call(E.exports,E,E.exports,w),E.l=!0,E.exports}return w.m=c,w.c=S,w.d=function(p,E,f){w.o(p,E)||Object.defineProperty(p,E,{configurable:!1,enumerable:!0,get:f})},w.n=function(p){var E=p&&p.__esModule?function(){return p.default}:function(){return p};return w.d(E,"a",E),E},w.o=function(p,E){return Object.prototype.hasOwnProperty.call(p,E)},w.p="",w(w.s=11)}([function(c,y,w){var p=Array.prototype,E=Object.prototype,f={"&":"&",'"':""","'":"'","<":"<",">":">","\\":"\"},t=/[&"'<>\\]/g,y=c.exports={};function O(x,N){return E.hasOwnProperty.call(x,N)}y.hasOwnProp=O;function V(x){return f[x]}function W(x,N,B){if(B.Update||(B=new y.TemplateError(B)),B.Update(x),!N){var C=B;B=new Error(C.message),B.name=C.name}return B}y._prettifyError=W;function j(x,N,B){var C,q;x instanceof Error&&(q=x,x=q.name+": "+q.message),Object.setPrototypeOf?(C=new Error(x),Object.setPrototypeOf(C,j.prototype)):(C=this,Object.defineProperty(C,"message",{enumerable:!1,writable:!0,value:x})),Object.defineProperty(C,"name",{value:"Template render error"}),Error.captureStackTrace&&Error.captureStackTrace(C,this.constructor);var z;if(q){var X=Object.getOwnPropertyDescriptor(q,"stack");z=X&&(X.get||function(){return X.value}),z||(z=function(){return q.stack})}else{var ye=new Error(x).stack;z=function(){return ye}}return Object.defineProperty(C,"stack",{get:function(){return z.call(C)}}),Object.defineProperty(C,"cause",{value:q}),C.lineno=N,C.colno=B,C.firstUpdate=!0,C.Update=function(oe){var ae="("+(oe||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?ae+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(ae+=" [Line "+this.lineno+"]")),ae+=`
|
|
3
|
-
`,this.firstUpdate&&(ae+=" "),this.message=ae+(this.message||""),this.firstUpdate=!1,this},C}Object.setPrototypeOf?Object.setPrototypeOf(j.prototype,Error.prototype):j.prototype=Object.create(Error.prototype,{constructor:{value:j}}),y.TemplateError=j;function L(x){return x.replace(t,V)}y.escape=L;function I(x){return E.toString.call(x)==="[object Function]"}y.isFunction=I;function e(x){return E.toString.call(x)==="[object Array]"}y.isArray=e;function r(x){return E.toString.call(x)==="[object String]"}y.isString=r;function i(x){return E.toString.call(x)==="[object Object]"}y.isObject=i;function m(x){return x?typeof x=="string"?x.split("."):[x]:[]}function l(x){var N=m(x);return function(C){for(var q=C,z=0;z<N.length;z++){var X=N[z];if(O(q,X))q=q[X];else return}return q}}y.getAttrGetter=l;function g(x,N,B){for(var C={},q=I(N)?N:l(N),z=0;z<x.length;z++){var X=x[z],ye=q(X,z);if(ye===void 0&&B===!0)throw new TypeError('groupby: attribute "'+N+'" resolved to undefined');(C[ye]||(C[ye]=[])).push(X)}return C}y.groupBy=g;function n(x){return Array.prototype.slice.call(x)}y.toArray=n;function o(x){var N=[];if(!x)return N;for(var B=x.length,C=n(arguments).slice(1),q=-1;++q<B;)A(C,x[q])===-1&&N.push(x[q]);return N}y.without=o;function u(x,N){for(var B="",C=0;C<N;C++)B+=x;return B}y.repeat=u;function a(x,N,B){if(x!=null){if(p.forEach&&x.forEach===p.forEach)x.forEach(N,B);else if(x.length===+x.length)for(var C=0,q=x.length;C<q;C++)N.call(B,x[C],C,x)}}y.each=a;function s(x,N){var B=[];if(x==null)return B;if(p.map&&x.map===p.map)return x.map(N);for(var C=0;C<x.length;C++)B[B.length]=N(x[C],C);return x.length===+x.length&&(B.length=x.length),B}y.map=s;function d(x,N,B){var C=-1;function q(){C++,C<x.length?N(x[C],C,q,B):B()}q()}y.asyncIter=d;function h(x,N,B){var C=M(x||{}),q=C.length,z=-1;function X(){z++;var ye=C[z];z<q?N(ye,x[ye],z,q,X):B()}X()}y.asyncFor=h;function A(x,N,B){return Array.prototype.indexOf.call(x||[],N,B)}y.indexOf=A;function M(x){var N=[];for(var B in x)O(x,B)&&N.push(B);return N}y.keys=M;function F(x){return M(x).map(function(N){return[N,x[N]]})}y._entries=F;function K(x){return M(x).map(function(N){return x[N]})}y._values=K;function D(x,N){return x=x||{},M(N).forEach(function(B){x[B]=N[B]}),x}y._assign=y.extend=D;function b(x,N){if(e(N)||r(N))return N.indexOf(x)!==-1;if(i(N))return x in N;throw new Error('Cannot use "in" operator to search for "'+x+'" in unexpected types.')}y.inOperator=b},function(c,S,w){function p(r,i){for(var m=0;m<i.length;m++){var l=i[m];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(r,f(l.key),l)}}function E(r,i,m){return i&&p(r.prototype,i),Object.defineProperty(r,"prototype",{writable:!1}),r}function f(r){var i=t(r,"string");return typeof i=="symbol"?i:String(i)}function t(r,i){if(typeof r!="object"||r===null)return r;var m=r[Symbol.toPrimitive];if(m!==void 0){var l=m.call(r,i);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function y(r,i){r.prototype=Object.create(i.prototype),r.prototype.constructor=r,O(r,i)}function O(r,i){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(l,g){return l.__proto__=g,l},O(r,i)}var V=w(16),W=w(0);function j(r,i){return typeof r!="function"||typeof i!="function"?i:function(){var l=this.parent;this.parent=r;var g=i.apply(this,arguments);return this.parent=l,g}}function L(r,i,m){m=m||{},W.keys(m).forEach(function(g){m[g]=j(r.prototype[g],m[g])});var l=function(g){y(n,g);function n(){return g.apply(this,arguments)||this}return E(n,[{key:"typename",get:function(){return i}}]),n}(r);return W._assign(l.prototype,m),l}var I=function(){function r(){this.init.apply(this,arguments)}var i=r.prototype;return i.init=function(){},r.extend=function(l,g){return typeof l=="object"&&(g=l,l="anonymous"),L(this,l,g)},E(r,[{key:"typename",get:function(){return this.constructor.name}}]),r}(),e=function(r){y(i,r);function i(){var l,g;return g=r.call(this)||this,(l=g).init.apply(l,arguments),g}var m=i.prototype;return m.init=function(){},i.extend=function(g,n){return typeof g=="object"&&(n=g,g="anonymous"),L(this,g,n)},E(i,[{key:"typename",get:function(){return this.constructor.name}}]),i}(V);c.exports={Obj:I,EmitterObj:e}},function(c,S,w){var p=w(0),E=Array.from,f=typeof Symbol=="function"&&Symbol.iterator&&typeof E=="function",t=function(){function s(h,A){this.variables=Object.create(null),this.parent=h,this.topLevel=!1,this.isolateWrites=A}var d=s.prototype;return d.set=function(A,M,F){var K=A.split("."),D=this.variables,b=this;if(F&&(b=this.resolve(K[0],!0))){b.set(A,M);return}for(var x=0;x<K.length-1;x++){var N=K[x];D[N]||(D[N]={}),D=D[N]}D[K[K.length-1]]=M},d.get=function(A){var M=this.variables[A];return M!==void 0?M:null},d.lookup=function(A){var M=this.parent,F=this.variables[A];return F!==void 0?F:M&&M.lookup(A)},d.resolve=function(A,M){var F=M&&this.isolateWrites?void 0:this.parent,K=this.variables[A];return K!==void 0?this:F&&F.resolve(A)},d.push=function(A){return new s(this,A)},d.pop=function(){return this.parent},s}();function y(s,d,h){return function(){for(var M=arguments.length,F=new Array(M),K=0;K<M;K++)F[K]=arguments[K];var D=j(F),b,x=W(F);if(D>s.length)b=F.slice(0,s.length),F.slice(b.length,D).forEach(function(C,q){q<d.length&&(x[d[q]]=C)}),b.push(x);else if(D<s.length){b=F.slice(0,D);for(var N=D;N<s.length;N++){var B=s[N];b.push(x[B]),delete x[B]}b.push(x)}else b=F;return h.apply(this,b)}}function O(s){return s.__keywords=!0,s}function V(s){return s&&Object.prototype.hasOwnProperty.call(s,"__keywords")}function W(s){var d=s.length;if(d){var h=s[d-1];if(V(h))return h}return{}}function j(s){var d=s.length;if(d===0)return 0;var h=s[d-1];return V(h)?d-1:d}function L(s){if(typeof s!="string")return s;this.val=s,this.length=s.length}L.prototype=Object.create(String.prototype,{length:{writable:!0,configurable:!0,value:0}}),L.prototype.valueOf=function(){return this.val},L.prototype.toString=function(){return this.val};function I(s,d){return s instanceof L?new L(d):d.toString()}function e(s){var d=typeof s;return d==="string"?new L(s):d!=="function"?s:function(A){var M=s.apply(this,arguments);return typeof M=="string"?new L(M):M}}function r(s,d){return s=s??"",d&&!(s instanceof L)&&(s=p.escape(s.toString())),s}function i(s,d,h){if(s==null)throw new p.TemplateError("attempted to output null or undefined value",d+1,h+1);return s}function m(s,d){if(s!=null)return typeof s[d]=="function"?function(){for(var h=arguments.length,A=new Array(h),M=0;M<h;M++)A[M]=arguments[M];return s[d].apply(s,A)}:s[d]}function l(s,d,h,A){if(s){if(typeof s!="function")throw new Error("Unable to call `"+d+"`, which is not a function")}else throw new Error("Unable to call `"+d+"`, which is undefined or falsey");return s.apply(h,A)}function g(s,d,h){var A=d.lookup(h);return A!==void 0?A:s.lookup(h)}function n(s,d,h){return s.lineno?s:new p.TemplateError(s,d,h)}function o(s,d,h,A){if(p.isArray(s)){var M=s.length;p.asyncIter(s,function(K,D,b){switch(d){case 1:h(K,D,M,b);break;case 2:h(K[0],K[1],D,M,b);break;case 3:h(K[0],K[1],K[2],D,M,b);break;default:K.push(D,M,b),h.apply(this,K)}},A)}else p.asyncFor(s,function(K,D,b,x,N){h(K,D,b,x,N)},A)}function u(s,d,h,A){var M=0,F,K;function D(q,z){M++,K[q]=z,M===F&&A(null,K.join(""))}if(p.isArray(s))if(F=s.length,K=new Array(F),F===0)A(null,"");else for(var b=0;b<s.length;b++){var x=s[b];switch(d){case 1:h(x,b,F,D);break;case 2:h(x[0],x[1],b,F,D);break;case 3:h(x[0],x[1],x[2],b,F,D);break;default:x.push(b,F,D),h.apply(this,x)}}else{var N=p.keys(s||{});if(F=N.length,K=new Array(F),F===0)A(null,"");else for(var B=0;B<N.length;B++){var C=N[B];h(C,s[C],B,F,D)}}}function a(s){return typeof s!="object"||s===null||p.isArray(s)?s:f&&Symbol.iterator in s?E(s):s}c.exports={Frame:t,makeMacro:y,makeKeywordArgs:O,numArgs:j,suppressValue:r,ensureDefined:i,memberLookup:m,contextOrFrameLookup:g,callWrap:l,handleError:n,isArray:p.isArray,keys:p.keys,SafeString:L,copySafeness:I,markSafe:e,asyncEach:o,asyncAll:u,inOperator:p.inOperator,fromIterator:a}},function(c,S,w){function p(se,ce){for(var _e=0;_e<ce.length;_e++){var xe=ce[_e];xe.enumerable=xe.enumerable||!1,xe.configurable=!0,"value"in xe&&(xe.writable=!0),Object.defineProperty(se,f(xe.key),xe)}}function E(se,ce,_e){return ce&&p(se.prototype,ce),Object.defineProperty(se,"prototype",{writable:!1}),se}function f(se){var ce=t(se,"string");return typeof ce=="symbol"?ce:String(ce)}function t(se,ce){if(typeof se!="object"||se===null)return se;var _e=se[Symbol.toPrimitive];if(_e!==void 0){var xe=_e.call(se,ce);if(typeof xe!="object")return xe;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(se)}function y(se,ce){se.prototype=Object.create(ce.prototype),se.prototype.constructor=se,O(se,ce)}function O(se,ce){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(xe,Ee){return xe.__proto__=Ee,xe},O(se,ce)}var V=w(1),W=V.Obj;function j(se,ce,_e){se instanceof ce&&_e.push(se),se instanceof L&&se.findAll(ce,_e)}var L=function(se){y(ce,se);function ce(){return se.apply(this,arguments)||this}var _e=ce.prototype;return _e.init=function(Ee,Fe){for(var $e=arguments,it=this,lt=arguments.length,Nt=new Array(lt>2?lt-2:0),Ge=2;Ge<lt;Ge++)Nt[Ge-2]=arguments[Ge];this.lineno=Ee,this.colno=Fe,this.fields.forEach(function(He,ut){var ct=$e[ut+2];ct===void 0&&(ct=null),it[He]=ct})},_e.findAll=function(Ee,Fe){var $e=this;return Fe=Fe||[],this instanceof e?this.children.forEach(function(it){return j(it,Ee,Fe)}):this.fields.forEach(function(it){return j($e[it],Ee,Fe)}),Fe},_e.iterFields=function(Ee){var Fe=this;this.fields.forEach(function($e){Ee(Fe[$e],$e)})},ce}(W),I=function(se){y(ce,se);function ce(){return se.apply(this,arguments)||this}return E(ce,[{key:"typename",get:function(){return"Value"}},{key:"fields",get:function(){return["value"]}}]),ce}(L),e=function(se){y(ce,se);function ce(){return se.apply(this,arguments)||this}var _e=ce.prototype;return _e.init=function(Ee,Fe,$e){se.prototype.init.call(this,Ee,Fe,$e||[])},_e.addChild=function(Ee){this.children.push(Ee)},E(ce,[{key:"typename",get:function(){return"NodeList"}},{key:"fields",get:function(){return["children"]}}]),ce}(L),r=e.extend("Root"),i=I.extend("Literal"),m=I.extend("Symbol"),l=e.extend("Group"),g=e.extend("Array"),n=L.extend("Pair",{fields:["key","value"]}),o=e.extend("Dict"),u=L.extend("LookupVal",{fields:["target","val"]}),a=L.extend("If",{fields:["cond","body","else_"]}),s=a.extend("IfAsync"),d=L.extend("InlineIf",{fields:["cond","body","else_"]}),h=L.extend("For",{fields:["arr","name","body","else_"]}),A=h.extend("AsyncEach"),M=h.extend("AsyncAll"),F=L.extend("Macro",{fields:["name","args","body"]}),K=F.extend("Caller"),D=L.extend("Import",{fields:["template","target","withContext"]}),b=function(se){y(ce,se);function ce(){return se.apply(this,arguments)||this}var _e=ce.prototype;return _e.init=function(Ee,Fe,$e,it,lt){se.prototype.init.call(this,Ee,Fe,$e,it||new e,lt)},E(ce,[{key:"typename",get:function(){return"FromImport"}},{key:"fields",get:function(){return["template","names","withContext"]}}]),ce}(L),x=L.extend("FunCall",{fields:["name","args"]}),N=x.extend("Filter"),B=N.extend("FilterAsync",{fields:["name","args","symbol"]}),C=o.extend("KeywordArgs"),q=L.extend("Block",{fields:["name","body"]}),z=L.extend("Super",{fields:["blockName","symbol"]}),X=L.extend("TemplateRef",{fields:["template"]}),ye=X.extend("Extends"),be=L.extend("Include",{fields:["template","ignoreMissing"]}),oe=L.extend("Set",{fields:["targets","value"]}),ae=L.extend("Switch",{fields:["expr","cases","default"]}),H=L.extend("Case",{fields:["cond","body"]}),Y=e.extend("Output"),Q=L.extend("Capture",{fields:["body"]}),he=i.extend("TemplateData"),Ae=L.extend("UnaryOp",{fields:["target"]}),Te=L.extend("BinOp",{fields:["left","right"]}),De=Te.extend("In"),k=Te.extend("Is"),$=Te.extend("Or"),Z=Te.extend("And"),J=Ae.extend("Not"),pe=Te.extend("Add"),ue=Te.extend("Concat"),Oe=Te.extend("Sub"),ve=Te.extend("Mul"),ke=Te.extend("Div"),We=Te.extend("FloorDiv"),qe=Te.extend("Mod"),Ye=Te.extend("Pow"),_t=Ae.extend("Neg"),Et=Ae.extend("Pos"),Ct=L.extend("Compare",{fields:["expr","ops"]}),Pt=L.extend("CompareOperand",{fields:["expr","type"]}),xt=L.extend("CallExtension",{init:function(ce,_e,xe,Ee){this.parent(),this.extName=ce.__name||ce,this.prop=_e,this.args=xe||new e,this.contentArgs=Ee||[],this.autoescape=ce.autoescape},fields:["extName","prop","args","contentArgs"]}),kt=xt.extend("CallExtensionAsync");function st(se,ce,_e){var xe=se.split(`
|
|
4
|
-
`);xe.forEach(function(Ee,Fe){Ee&&(_e&&Fe>0||!_e)&&process.stdout.write(" ".repeat(ce));var $e=Fe===xe.length-1?"":`
|
|
5
|
-
`;process.stdout.write(""+Ee+$e)})}function at(se,ce){if(ce=ce||0,st(se.typename+": ",ce),se instanceof e)st(`
|
|
6
|
-
`),se.children.forEach(function(Ee){at(Ee,ce+2)});else if(se instanceof xt)st(se.extName+"."+se.prop+`
|
|
7
|
-
`),se.args&&at(se.args,ce+2),se.contentArgs&&se.contentArgs.forEach(function(Ee){at(Ee,ce+2)});else{var _e=[],xe=null;se.iterFields(function(Ee,Fe){Ee instanceof L?_e.push([Fe,Ee]):(xe=xe||{},xe[Fe]=Ee)}),xe?st(JSON.stringify(xe,null,2)+`
|
|
8
|
-
`,null,!0):st(`
|
|
9
|
-
`),_e.forEach(function(Ee){var Fe=Ee[0],$e=Ee[1];st("["+Fe+"] =>",ce+2),at($e,ce+4)})}}c.exports={Node:L,Root:r,NodeList:e,Value:I,Literal:i,Symbol:m,Group:l,Array:g,Pair:n,Dict:o,Output:Y,Capture:Q,TemplateData:he,If:a,IfAsync:s,InlineIf:d,For:h,AsyncEach:A,AsyncAll:M,Macro:F,Caller:K,Import:D,FromImport:b,FunCall:x,Filter:N,FilterAsync:B,KeywordArgs:C,Block:q,Super:z,Extends:ye,Include:be,Set:oe,Switch:ae,Case:H,LookupVal:u,BinOp:Te,In:De,Is:k,Or:$,And:Z,Not:J,Add:pe,Concat:ue,Sub:Oe,Mul:ve,Div:ke,FloorDiv:We,Mod:qe,Pow:Ye,Neg:_t,Pos:Et,Compare:Ct,CompareOperand:Pt,CallExtension:xt,CallExtensionAsync:kt,printNodes:at}},function(c,S){},function(c,S,w){function p(i,m){i.prototype=Object.create(m.prototype),i.prototype.constructor=i,E(i,m)}function E(i,m){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(g,n){return g.__proto__=n,g},E(i,m)}var f=w(8),t=w(17),y=w(3),O=w(0),V=O.TemplateError,W=w(2),j=W.Frame,L=w(1),I=L.Obj,e={"==":"==","===":"===","!=":"!=","!==":"!==","<":"<",">":">","<=":"<=",">=":">="},r=function(i){p(m,i);function m(){return i.apply(this,arguments)||this}var l=m.prototype;return l.init=function(n,o){this.templateName=n,this.codebuf=[],this.lastId=0,this.buffer=null,this.bufferStack=[],this._scopeClosers="",this.inBlock=!1,this.throwOnUndefined=o},l.fail=function(n,o,u){throw o!==void 0&&(o+=1),u!==void 0&&(u+=1),new V(n,o,u)},l._pushBuffer=function(){var n=this._tmpid();return this.bufferStack.push(this.buffer),this.buffer=n,this._emit("var "+this.buffer+' = "";'),n},l._popBuffer=function(){this.buffer=this.bufferStack.pop()},l._emit=function(n){this.codebuf.push(n)},l._emitLine=function(n){this._emit(n+`
|
|
10
|
-
`)},l._emitLines=function(){for(var n=this,o=arguments.length,u=new Array(o),a=0;a<o;a++)u[a]=arguments[a];u.forEach(function(s){return n._emitLine(s)})},l._emitFuncBegin=function(n,o){this.buffer="output",this._scopeClosers="",this._emitLine("function "+o+"(env, context, frame, runtime, cb) {"),this._emitLine("var lineno = "+n.lineno+";"),this._emitLine("var colno = "+n.colno+";"),this._emitLine("var "+this.buffer+' = "";'),this._emitLine("try {")},l._emitFuncEnd=function(n){n||this._emitLine("cb(null, "+this.buffer+");"),this._closeScopeLevels(),this._emitLine("} catch (e) {"),this._emitLine(" cb(runtime.handleError(e, lineno, colno));"),this._emitLine("}"),this._emitLine("}"),this.buffer=null},l._addScopeLevel=function(){this._scopeClosers+="})"},l._closeScopeLevels=function(){this._emitLine(this._scopeClosers+";"),this._scopeClosers=""},l._withScopedSyntax=function(n){var o=this._scopeClosers;this._scopeClosers="",n.call(this),this._closeScopeLevels(),this._scopeClosers=o},l._makeCallback=function(n){var o=this._tmpid();return"function("+o+(n?","+n:"")+`) {
|
|
11
|
-
if(`+o+") { cb("+o+"); return; }"},l._tmpid=function(){return this.lastId++,"t_"+this.lastId},l._templateName=function(){return this.templateName==null?"undefined":JSON.stringify(this.templateName)},l._compileChildren=function(n,o){var u=this;n.children.forEach(function(a){u.compile(a,o)})},l._compileAggregate=function(n,o,u,a){var s=this;u&&this._emit(u),n.children.forEach(function(d,h){h>0&&s._emit(","),s.compile(d,o)}),a&&this._emit(a)},l._compileExpression=function(n,o){this.assertType(n,y.Literal,y.Symbol,y.Group,y.Array,y.Dict,y.FunCall,y.Caller,y.Filter,y.LookupVal,y.Compare,y.InlineIf,y.In,y.Is,y.And,y.Or,y.Not,y.Add,y.Concat,y.Sub,y.Mul,y.Div,y.FloorDiv,y.Mod,y.Pow,y.Neg,y.Pos,y.Compare,y.NodeList),this.compile(n,o)},l.assertType=function(n){for(var o=arguments.length,u=new Array(o>1?o-1:0),a=1;a<o;a++)u[a-1]=arguments[a];u.some(function(s){return n instanceof s})||this.fail("assertType: invalid type: "+n.typename,n.lineno,n.colno)},l.compileCallExtension=function(n,o,u){var a=this,s=n.args,d=n.contentArgs,h=typeof n.autoescape=="boolean"?n.autoescape:!0;if(u||this._emit(this.buffer+" += runtime.suppressValue("),this._emit('env.getExtension("'+n.extName+'")["'+n.prop+'"]('),this._emit("context"),(s||d)&&this._emit(","),s&&(s instanceof y.NodeList||this.fail("compileCallExtension: arguments must be a NodeList, use `parser.parseSignature`"),s.children.forEach(function(M,F){a._compileExpression(M,o),(F!==s.children.length-1||d.length)&&a._emit(",")})),d.length&&d.forEach(function(M,F){if(F>0&&a._emit(","),M){a._emitLine("function(cb) {"),a._emitLine("if(!cb) { cb = function(err) { if(err) { throw err; }}}");var K=a._pushBuffer();a._withScopedSyntax(function(){a.compile(M,o),a._emitLine("cb(null, "+K+");")}),a._popBuffer(),a._emitLine("return "+K+";"),a._emitLine("}")}else a._emit("null")}),u){var A=this._tmpid();this._emitLine(", "+this._makeCallback(A)),this._emitLine(this.buffer+" += runtime.suppressValue("+A+", "+h+" && env.opts.autoescape);"),this._addScopeLevel()}else this._emit(")"),this._emit(", "+h+` && env.opts.autoescape);
|
|
12
|
-
`)},l.compileCallExtensionAsync=function(n,o){this.compileCallExtension(n,o,!0)},l.compileNodeList=function(n,o){this._compileChildren(n,o)},l.compileLiteral=function(n){if(typeof n.value=="string"){var o=n.value.replace(/\\/g,"\\\\");o=o.replace(/"/g,'\\"'),o=o.replace(/\n/g,"\\n"),o=o.replace(/\r/g,"\\r"),o=o.replace(/\t/g,"\\t"),o=o.replace(/\u2028/g,"\\u2028"),this._emit('"'+o+'"')}else n.value===null?this._emit("null"):this._emit(n.value.toString())},l.compileSymbol=function(n,o){var u=n.value,a=o.lookup(u);a?this._emit(a):this._emit('runtime.contextOrFrameLookup(context, frame, "'+u+'")')},l.compileGroup=function(n,o){this._compileAggregate(n,o,"(",")")},l.compileArray=function(n,o){this._compileAggregate(n,o,"[","]")},l.compileDict=function(n,o){this._compileAggregate(n,o,"{","}")},l.compilePair=function(n,o){var u=n.key,a=n.value;u instanceof y.Symbol?u=new y.Literal(u.lineno,u.colno,u.value):u instanceof y.Literal&&typeof u.value=="string"||this.fail("compilePair: Dict keys must be strings or names",u.lineno,u.colno),this.compile(u,o),this._emit(": "),this._compileExpression(a,o)},l.compileInlineIf=function(n,o){this._emit("("),this.compile(n.cond,o),this._emit("?"),this.compile(n.body,o),this._emit(":"),n.else_!==null?this.compile(n.else_,o):this._emit('""'),this._emit(")")},l.compileIn=function(n,o){this._emit("runtime.inOperator("),this.compile(n.left,o),this._emit(","),this.compile(n.right,o),this._emit(")")},l.compileIs=function(n,o){var u=n.right.name?n.right.name.value:n.right.value;this._emit('env.getTest("'+u+'").call(context, '),this.compile(n.left,o),n.right.args&&(this._emit(","),this.compile(n.right.args,o)),this._emit(") === true")},l._binOpEmitter=function(n,o,u){this.compile(n.left,o),this._emit(u),this.compile(n.right,o)},l.compileOr=function(n,o){return this._binOpEmitter(n,o," || ")},l.compileAnd=function(n,o){return this._binOpEmitter(n,o," && ")},l.compileAdd=function(n,o){return this._binOpEmitter(n,o," + ")},l.compileConcat=function(n,o){return this._binOpEmitter(n,o,' + "" + ')},l.compileSub=function(n,o){return this._binOpEmitter(n,o," - ")},l.compileMul=function(n,o){return this._binOpEmitter(n,o," * ")},l.compileDiv=function(n,o){return this._binOpEmitter(n,o," / ")},l.compileMod=function(n,o){return this._binOpEmitter(n,o," % ")},l.compileNot=function(n,o){this._emit("!"),this.compile(n.target,o)},l.compileFloorDiv=function(n,o){this._emit("Math.floor("),this.compile(n.left,o),this._emit(" / "),this.compile(n.right,o),this._emit(")")},l.compilePow=function(n,o){this._emit("Math.pow("),this.compile(n.left,o),this._emit(", "),this.compile(n.right,o),this._emit(")")},l.compileNeg=function(n,o){this._emit("-"),this.compile(n.target,o)},l.compilePos=function(n,o){this._emit("+"),this.compile(n.target,o)},l.compileCompare=function(n,o){var u=this;this.compile(n.expr,o),n.ops.forEach(function(a){u._emit(" "+e[a.type]+" "),u.compile(a.expr,o)})},l.compileLookupVal=function(n,o){this._emit("runtime.memberLookup(("),this._compileExpression(n.target,o),this._emit("),"),this._compileExpression(n.val,o),this._emit(")")},l._getNodeName=function(n){switch(n.typename){case"Symbol":return n.value;case"FunCall":return"the return value of ("+this._getNodeName(n.name)+")";case"LookupVal":return this._getNodeName(n.target)+'["'+this._getNodeName(n.val)+'"]';case"Literal":return n.value.toString();default:return"--expression--"}},l.compileFunCall=function(n,o){this._emit("(lineno = "+n.lineno+", colno = "+n.colno+", "),this._emit("runtime.callWrap("),this._compileExpression(n.name,o),this._emit(', "'+this._getNodeName(n.name).replace(/"/g,'\\"')+'", context, '),this._compileAggregate(n.args,o,"[","])"),this._emit(")")},l.compileFilter=function(n,o){var u=n.name;this.assertType(u,y.Symbol),this._emit('env.getFilter("'+u.value+'").call(context, '),this._compileAggregate(n.args,o),this._emit(")")},l.compileFilterAsync=function(n,o){var u=n.name,a=n.symbol.value;this.assertType(u,y.Symbol),o.set(a,a),this._emit('env.getFilter("'+u.value+'").call(context, '),this._compileAggregate(n.args,o),this._emitLine(", "+this._makeCallback(a)),this._addScopeLevel()},l.compileKeywordArgs=function(n,o){this._emit("runtime.makeKeywordArgs("),this.compileDict(n,o),this._emit(")")},l.compileSet=function(n,o){var u=this,a=[];n.targets.forEach(function(s){var d=s.value,h=o.lookup(d);h==null&&(h=u._tmpid(),u._emitLine("var "+h+";")),a.push(h)}),n.value?(this._emit(a.join(" = ")+" = "),this._compileExpression(n.value,o),this._emitLine(";")):(this._emit(a.join(" = ")+" = "),this.compile(n.body,o),this._emitLine(";")),n.targets.forEach(function(s,d){var h=a[d],A=s.value;u._emitLine('frame.set("'+A+'", '+h+", true);"),u._emitLine("if(frame.topLevel) {"),u._emitLine('context.setVariable("'+A+'", '+h+");"),u._emitLine("}"),A.charAt(0)!=="_"&&(u._emitLine("if(frame.topLevel) {"),u._emitLine('context.addExport("'+A+'", '+h+");"),u._emitLine("}"))})},l.compileSwitch=function(n,o){var u=this;this._emit("switch ("),this.compile(n.expr,o),this._emit(") {"),n.cases.forEach(function(a,s){u._emit("case "),u.compile(a.cond,o),u._emit(": "),u.compile(a.body,o),a.body.children.length&&u._emitLine("break;")}),n.default&&(this._emit("default:"),this.compile(n.default,o)),this._emit("}")},l.compileIf=function(n,o,u){var a=this;this._emit("if("),this._compileExpression(n.cond,o),this._emitLine(") {"),this._withScopedSyntax(function(){a.compile(n.body,o),u&&a._emit("cb()")}),n.else_?(this._emitLine(`}
|
|
13
|
-
else {`),this._withScopedSyntax(function(){a.compile(n.else_,o),u&&a._emit("cb()")})):u&&(this._emitLine(`}
|
|
14
|
-
else {`),this._emit("cb()")),this._emitLine("}")},l.compileIfAsync=function(n,o){this._emit("(function(cb) {"),this.compileIf(n,o,!0),this._emit("})("+this._makeCallback()),this._addScopeLevel()},l._emitLoopBindings=function(n,o,u,a){var s=this,d=[{name:"index",val:u+" + 1"},{name:"index0",val:u},{name:"revindex",val:a+" - "+u},{name:"revindex0",val:a+" - "+u+" - 1"},{name:"first",val:u+" === 0"},{name:"last",val:u+" === "+a+" - 1"},{name:"length",val:a}];d.forEach(function(h){s._emitLine('frame.set("loop.'+h.name+'", '+h.val+");")})},l.compileFor=function(n,o){var u=this,a=this._tmpid(),s=this._tmpid(),d=this._tmpid();if(o=o.push(),this._emitLine("frame = frame.push();"),this._emit("var "+d+" = "),this._compileExpression(n.arr,o),this._emitLine(";"),this._emit("if("+d+") {"),this._emitLine(d+" = runtime.fromIterator("+d+");"),n.name instanceof y.Array){this._emitLine("var "+a+";"),this._emitLine("if(runtime.isArray("+d+")) {"),this._emitLine("var "+s+" = "+d+".length;"),this._emitLine("for("+a+"=0; "+a+" < "+d+".length; "+a+"++) {"),n.name.children.forEach(function(b,x){var N=u._tmpid();u._emitLine("var "+N+" = "+d+"["+a+"]["+x+"];"),u._emitLine('frame.set("'+b+'", '+d+"["+a+"]["+x+"]);"),o.set(n.name.children[x].value,N)}),this._emitLoopBindings(n,d,a,s),this._withScopedSyntax(function(){u.compile(n.body,o)}),this._emitLine("}"),this._emitLine("} else {");var h=n.name.children,A=h[0],M=h[1],F=this._tmpid(),K=this._tmpid();o.set(A.value,F),o.set(M.value,K),this._emitLine(a+" = -1;"),this._emitLine("var "+s+" = runtime.keys("+d+").length;"),this._emitLine("for(var "+F+" in "+d+") {"),this._emitLine(a+"++;"),this._emitLine("var "+K+" = "+d+"["+F+"];"),this._emitLine('frame.set("'+A.value+'", '+F+");"),this._emitLine('frame.set("'+M.value+'", '+K+");"),this._emitLoopBindings(n,d,a,s),this._withScopedSyntax(function(){u.compile(n.body,o)}),this._emitLine("}"),this._emitLine("}")}else{var D=this._tmpid();o.set(n.name.value,D),this._emitLine("var "+s+" = "+d+".length;"),this._emitLine("for(var "+a+"=0; "+a+" < "+d+".length; "+a+"++) {"),this._emitLine("var "+D+" = "+d+"["+a+"];"),this._emitLine('frame.set("'+n.name.value+'", '+D+");"),this._emitLoopBindings(n,d,a,s),this._withScopedSyntax(function(){u.compile(n.body,o)}),this._emitLine("}")}this._emitLine("}"),n.else_&&(this._emitLine("if (!"+s+") {"),this.compile(n.else_,o),this._emitLine("}")),this._emitLine("frame = frame.pop();")},l._compileAsyncLoop=function(n,o,u){var a=this,s=this._tmpid(),d=this._tmpid(),h=this._tmpid(),A=u?"asyncAll":"asyncEach";if(o=o.push(),this._emitLine("frame = frame.push();"),this._emit("var "+h+" = runtime.fromIterator("),this._compileExpression(n.arr,o),this._emitLine(");"),n.name instanceof y.Array){var M=n.name.children.length;this._emit("runtime."+A+"("+h+", "+M+", function("),n.name.children.forEach(function(D){a._emit(D.value+",")}),this._emit(s+","+d+",next) {"),n.name.children.forEach(function(D){var b=D.value;o.set(b,b),a._emitLine('frame.set("'+b+'", '+b+");")})}else{var F=n.name.value;this._emitLine("runtime."+A+"("+h+", 1, function("+F+", "+s+", "+d+",next) {"),this._emitLine('frame.set("'+F+'", '+F+");"),o.set(F,F)}this._emitLoopBindings(n,h,s,d),this._withScopedSyntax(function(){var D;u&&(D=a._pushBuffer()),a.compile(n.body,o),a._emitLine("next("+s+(D?","+D:"")+");"),u&&a._popBuffer()});var K=this._tmpid();this._emitLine("}, "+this._makeCallback(K)),this._addScopeLevel(),u&&this._emitLine(this.buffer+" += "+K+";"),n.else_&&(this._emitLine("if (!"+h+".length) {"),this.compile(n.else_,o),this._emitLine("}")),this._emitLine("frame = frame.pop();")},l.compileAsyncEach=function(n,o){this._compileAsyncLoop(n,o)},l.compileAsyncAll=function(n,o){this._compileAsyncLoop(n,o,!0)},l._compileMacro=function(n,o){var u=this,a=[],s=null,d="macro_"+this._tmpid(),h=o!==void 0;n.args.children.forEach(function(b,x){x===n.args.children.length-1&&b instanceof y.Dict?s=b:(u.assertType(b,y.Symbol),a.push(b))});var A=[].concat(a.map(function(b){return"l_"+b.value}),["kwargs"]),M=a.map(function(b){return'"'+b.value+'"'}),F=(s&&s.children||[]).map(function(b){return'"'+b.key.value+'"'}),K;h?K=o.push(!0):K=new j,this._emitLines("var "+d+" = runtime.makeMacro(","["+M.join(", ")+"], ","["+F.join(", ")+"], ","function ("+A.join(", ")+") {","var callerFrame = frame;","frame = "+(h?"frame.push(true);":"new runtime.Frame();"),"kwargs = kwargs || {};",'if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {','frame.set("caller", kwargs.caller); }'),a.forEach(function(b){u._emitLine('frame.set("'+b.value+'", l_'+b.value+");"),K.set(b.value,"l_"+b.value)}),s&&s.children.forEach(function(b){var x=b.key.value;u._emit('frame.set("'+x+'", '),u._emit('Object.prototype.hasOwnProperty.call(kwargs, "'+x+'")'),u._emit(' ? kwargs["'+x+'"] : '),u._compileExpression(b.value,K),u._emit(");")});var D=this._pushBuffer();return this._withScopedSyntax(function(){u.compile(n.body,K)}),this._emitLine("frame = "+(h?"frame.pop();":"callerFrame;")),this._emitLine("return new runtime.SafeString("+D+");"),this._emitLine("});"),this._popBuffer(),d},l.compileMacro=function(n,o){var u=this._compileMacro(n),a=n.name.value;o.set(a,u),o.parent?this._emitLine('frame.set("'+a+'", '+u+");"):(n.name.value.charAt(0)!=="_"&&this._emitLine('context.addExport("'+a+'");'),this._emitLine('context.setVariable("'+a+'", '+u+");"))},l.compileCaller=function(n,o){this._emit("(function (){");var u=this._compileMacro(n,o);this._emit("return "+u+";})()")},l._compileGetTemplate=function(n,o,u,a){var s=this._tmpid(),d=this._templateName(),h=this._makeCallback(s),A=u?"true":"false",M=a?"true":"false";return this._emit("env.getTemplate("),this._compileExpression(n.template,o),this._emitLine(", "+A+", "+d+", "+M+", "+h),s},l.compileImport=function(n,o){var u=n.target.value,a=this._compileGetTemplate(n,o,!1,!1);this._addScopeLevel(),this._emitLine(a+".getExported("+(n.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(a)),this._addScopeLevel(),o.set(u,a),o.parent?this._emitLine('frame.set("'+u+'", '+a+");"):this._emitLine('context.setVariable("'+u+'", '+a+");")},l.compileFromImport=function(n,o){var u=this,a=this._compileGetTemplate(n,o,!1,!1);this._addScopeLevel(),this._emitLine(a+".getExported("+(n.withContext?"context.getVariables(), frame, ":"")+this._makeCallback(a)),this._addScopeLevel(),n.names.children.forEach(function(s){var d,h,A=u._tmpid();s instanceof y.Pair?(d=s.key.value,h=s.value.value):(d=s.value,h=d),u._emitLine("if(Object.prototype.hasOwnProperty.call("+a+', "'+d+'")) {'),u._emitLine("var "+A+" = "+a+"."+d+";"),u._emitLine("} else {"),u._emitLine(`cb(new Error("cannot import '`+d+`'")); return;`),u._emitLine("}"),o.set(h,A),o.parent?u._emitLine('frame.set("'+h+'", '+A+");"):u._emitLine('context.setVariable("'+h+'", '+A+");")})},l.compileBlock=function(n){var o=this._tmpid();this.inBlock||this._emit('(parentTemplate ? function(e, c, f, r, cb) { cb(""); } : '),this._emit('context.getBlock("'+n.name.value+'")'),this.inBlock||this._emit(")"),this._emitLine("(env, context, frame, runtime, "+this._makeCallback(o)),this._emitLine(this.buffer+" += "+o+";"),this._addScopeLevel()},l.compileSuper=function(n,o){var u=n.blockName.value,a=n.symbol.value,s=this._makeCallback(a);this._emitLine('context.getSuper(env, "'+u+'", b_'+u+", frame, runtime, "+s),this._emitLine(a+" = runtime.markSafe("+a+");"),this._addScopeLevel(),o.set(a,a)},l.compileExtends=function(n,o){var u=this._tmpid(),a=this._compileGetTemplate(n,o,!0,!1);this._emitLine("parentTemplate = "+a),this._emitLine("for(var "+u+" in parentTemplate.blocks) {"),this._emitLine("context.addBlock("+u+", parentTemplate.blocks["+u+"]);"),this._emitLine("}"),this._addScopeLevel()},l.compileInclude=function(n,o){this._emitLine("var tasks = [];"),this._emitLine("tasks.push("),this._emitLine("function(callback) {");var u=this._compileGetTemplate(n,o,!1,n.ignoreMissing);this._emitLine("callback(null,"+u+");});"),this._emitLine("});");var a=this._tmpid();this._emitLine("tasks.push("),this._emitLine("function(template, callback){"),this._emitLine("template.render(context.getVariables(), frame, "+this._makeCallback(a)),this._emitLine("callback(null,"+a+");});"),this._emitLine("});"),this._emitLine("tasks.push("),this._emitLine("function(result, callback){"),this._emitLine(this.buffer+" += result;"),this._emitLine("callback(null);"),this._emitLine("});"),this._emitLine("env.waterfall(tasks, function(){"),this._addScopeLevel()},l.compileTemplateData=function(n,o){this.compileLiteral(n,o)},l.compileCapture=function(n,o){var u=this,a=this.buffer;this.buffer="output",this._emitLine("(function() {"),this._emitLine('var output = "";'),this._withScopedSyntax(function(){u.compile(n.body,o)}),this._emitLine("return output;"),this._emitLine("})()"),this.buffer=a},l.compileOutput=function(n,o){var u=this,a=n.children;a.forEach(function(s){s instanceof y.TemplateData?s.value&&(u._emit(u.buffer+" += "),u.compileLiteral(s,o),u._emitLine(";")):(u._emit(u.buffer+" += runtime.suppressValue("),u.throwOnUndefined&&u._emit("runtime.ensureDefined("),u.compile(s,o),u.throwOnUndefined&&u._emit(","+n.lineno+","+n.colno+")"),u._emit(`, env.opts.autoescape);
|
|
15
|
-
`))})},l.compileRoot=function(n,o){var u=this;o&&this.fail("compileRoot: root node can't have frame"),o=new j,this._emitFuncBegin(n,"root"),this._emitLine("var parentTemplate = null;"),this._compileChildren(n,o),this._emitLine("if(parentTemplate) {"),this._emitLine("parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);"),this._emitLine("} else {"),this._emitLine("cb(null, "+this.buffer+");"),this._emitLine("}"),this._emitFuncEnd(!0),this.inBlock=!0;var a=[],s=n.findAll(y.Block);s.forEach(function(d,h){var A=d.name.value;if(a.indexOf(A)!==-1)throw new Error('Block "'+A+'" defined more than once.');a.push(A),u._emitFuncBegin(d,"b_"+A);var M=new j;u._emitLine("var frame = frame.push(true);"),u.compile(d.body,M),u._emitFuncEnd()}),this._emitLine("return {"),s.forEach(function(d,h){var A="b_"+d.name.value;u._emitLine(A+": "+A+",")}),this._emitLine(`root: root
|
|
16
|
-
};`)},l.compile=function(n,o){var u=this["compile"+n.typename];u?u.call(this,n,o):this.fail("compile: Cannot compile node: "+n.typename,n.lineno,n.colno)},l.getCode=function(){return this.codebuf.join("")},m}(I);c.exports={compile:function(m,l,g,n,o){o===void 0&&(o={});var u=new r(n,o.throwOnUndefined),a=(g||[]).map(function(d){return d.preprocess}).filter(function(d){return!!d}),s=a.reduce(function(d,h){return h(d)},m);return u.compile(t.transform(f.parse(s,g,o),l,n)),u.getCode()},Compiler:r}},function(c,S,w){function p(O,V){O.prototype=Object.create(V.prototype),O.prototype.constructor=O,E(O,V)}function E(O,V){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(j,L){return j.__proto__=L,j},E(O,V)}var f=w(4),t=w(1),y=t.EmitterObj;c.exports=function(O){p(V,O);function V(){return O.apply(this,arguments)||this}var W=V.prototype;return W.resolve=function(L,I){return f.resolve(f.dirname(L),I)},W.isRelative=function(L){return L.indexOf("./")===0||L.indexOf("../")===0},V}(y)},function(c,S,w){function p(M,F){M.prototype=Object.create(F.prototype),M.prototype.constructor=M,E(M,F)}function E(M,F){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(D,b){return D.__proto__=b,D},E(M,F)}var f=w(12),t=w(15),y=w(0),O=w(5),V=w(18),W=w(10),j=W.FileSystemLoader,L=W.WebLoader,I=W.PrecompiledLoader,e=w(20),r=w(21),i=w(1),m=i.Obj,l=i.EmitterObj,g=w(2),n=g.handleError,o=g.Frame,u=w(22);function a(M,F,K){f(function(){M(F,K)})}var s={type:"code",obj:{root:function(F,K,D,b,x){try{x(null,"")}catch(N){x(n(N,null,null))}}}},d=function(M){p(F,M);function F(){return M.apply(this,arguments)||this}var K=F.prototype;return K.init=function(b,x){var N=this;x=this.opts=x||{},this.opts.dev=!!x.dev,this.opts.autoescape=x.autoescape!=null?x.autoescape:!0,this.opts.throwOnUndefined=!!x.throwOnUndefined,this.opts.trimBlocks=!!x.trimBlocks,this.opts.lstripBlocks=!!x.lstripBlocks,this.loaders=[],b?this.loaders=y.isArray(b)?b:[b]:j?this.loaders=[new j("views")]:L&&(this.loaders=[new L("/views")]),typeof window<"u"&&window.nunjucksPrecompiled&&this.loaders.unshift(new I(window.nunjucksPrecompiled)),this._initLoaders(),this.globals=r(),this.filters={},this.tests={},this.asyncFilters=[],this.extensions={},this.extensionsList=[],y._entries(V).forEach(function(B){var C=B[0],q=B[1];return N.addFilter(C,q)}),y._entries(e).forEach(function(B){var C=B[0],q=B[1];return N.addTest(C,q)})},K._initLoaders=function(){var b=this;this.loaders.forEach(function(x){x.cache={},typeof x.on=="function"&&(x.on("update",function(N,B){x.cache[N]=null,b.emit("update",N,B,x)}),x.on("load",function(N,B){b.emit("load",N,B,x)}))})},K.invalidateCache=function(){this.loaders.forEach(function(b){b.cache={}})},K.addExtension=function(b,x){return x.__name=b,this.extensions[b]=x,this.extensionsList.push(x),this},K.removeExtension=function(b){var x=this.getExtension(b);x&&(this.extensionsList=y.without(this.extensionsList,x),delete this.extensions[b])},K.getExtension=function(b){return this.extensions[b]},K.hasExtension=function(b){return!!this.extensions[b]},K.addGlobal=function(b,x){return this.globals[b]=x,this},K.getGlobal=function(b){if(typeof this.globals[b]>"u")throw new Error("global not found: "+b);return this.globals[b]},K.addFilter=function(b,x,N){var B=x;return N&&this.asyncFilters.push(b),this.filters[b]=B,this},K.getFilter=function(b){if(!this.filters[b])throw new Error("filter not found: "+b);return this.filters[b]},K.addTest=function(b,x){return this.tests[b]=x,this},K.getTest=function(b){if(!this.tests[b])throw new Error("test not found: "+b);return this.tests[b]},K.resolveTemplate=function(b,x,N){var B=b.isRelative&&x?b.isRelative(N):!1;return B&&b.resolve?b.resolve(x,N):N},K.getTemplate=function(b,x,N,B,C){var q=this,z=this,X=null;if(b&&b.raw&&(b=b.raw),y.isFunction(N)&&(C=N,N=null,x=x||!1),y.isFunction(x)&&(C=x,x=!1),b instanceof A)X=b;else{if(typeof b!="string")throw new Error("template names must be a string: "+b);for(var ye=0;ye<this.loaders.length;ye++){var be=this.loaders[ye];if(X=be.cache[this.resolveTemplate(be,N,b)],X)break}}if(X)if(x&&X.compile(),C){C(null,X);return}else return X;var oe,ae=function(Y,Q){if(!Q&&!Y&&!B&&(Y=new Error("template not found: "+b)),Y)if(C){C(Y);return}else throw Y;var he;Q?(he=new A(Q.src,q,Q.path,x),Q.noCache||(Q.loader.cache[b]=he)):he=new A(s,q,"",x),C?C(null,he):oe=he};return y.asyncIter(this.loaders,function(H,Y,Q,he){function Ae(Te,De){Te?he(Te):De?(De.loader=H,he(null,De)):Q()}b=z.resolveTemplate(H,N,b),H.async?H.getSource(b,Ae):Ae(null,H.getSource(b))},ae),oe},K.express=function(b){return u(this,b)},K.render=function(b,x,N){y.isFunction(x)&&(N=x,x=null);var B=null;return this.getTemplate(b,function(C,q){if(C&&N)a(N,C);else{if(C)throw C;B=q.render(x,N)}}),B},K.renderString=function(b,x,N,B){y.isFunction(N)&&(B=N,N={}),N=N||{};var C=new A(b,this,N.path);return C.render(x,B)},K.waterfall=function(b,x,N){return t(b,x,N)},F}(l),h=function(M){p(F,M);function F(){return M.apply(this,arguments)||this}var K=F.prototype;return K.init=function(b,x,N){var B=this;this.env=N||new d,this.ctx=y.extend({},b),this.blocks={},this.exported=[],y.keys(x).forEach(function(C){B.addBlock(C,x[C])})},K.lookup=function(b){return b in this.env.globals&&!(b in this.ctx)?this.env.globals[b]:this.ctx[b]},K.setVariable=function(b,x){this.ctx[b]=x},K.getVariables=function(){return this.ctx},K.addBlock=function(b,x){return this.blocks[b]=this.blocks[b]||[],this.blocks[b].push(x),this},K.getBlock=function(b){if(!this.blocks[b])throw new Error('unknown block "'+b+'"');return this.blocks[b][0]},K.getSuper=function(b,x,N,B,C,q){var z=y.indexOf(this.blocks[x]||[],N),X=this.blocks[x][z+1],ye=this;if(z===-1||!X)throw new Error('no super block available for "'+x+'"');X(b,ye,B,C,q)},K.addExport=function(b){this.exported.push(b)},K.getExported=function(){var b=this,x={};return this.exported.forEach(function(N){x[N]=b.ctx[N]}),x},F}(m),A=function(M){p(F,M);function F(){return M.apply(this,arguments)||this}var K=F.prototype;return K.init=function(b,x,N,B){if(this.env=x||new d,y.isObject(b))switch(b.type){case"code":this.tmplProps=b.obj;break;case"string":this.tmplStr=b.obj;break;default:throw new Error("Unexpected template object type "+b.type+"; expected 'code', or 'string'")}else if(y.isString(b))this.tmplStr=b;else throw new Error("src must be a string or an object describing the source");if(this.path=N,B)try{this._compile()}catch(C){throw y._prettifyError(this.path,this.env.opts.dev,C)}else this.compiled=!1},K.render=function(b,x,N){var B=this;typeof b=="function"?(N=b,b={}):typeof x=="function"&&(N=x,x=null);var C=!x;try{this.compile()}catch(oe){var q=y._prettifyError(this.path,this.env.opts.dev,oe);if(N)return a(N,q);throw q}var z=new h(b||{},this.blocks,this.env),X=x?x.push(!0):new o;X.topLevel=!0;var ye=null,be=!1;return this.rootRenderFunc(this.env,z,X,g,function(oe,ae){if(!(be&&N&&typeof ae<"u"))if(oe&&(oe=y._prettifyError(B.path,B.env.opts.dev,oe),be=!0),N)C?a(N,oe,ae):N(oe,ae);else{if(oe)throw oe;ye=ae}}),ye},K.getExported=function(b,x,N){typeof b=="function"&&(N=b,b={}),typeof x=="function"&&(N=x,x=null);try{this.compile()}catch(q){if(N)return N(q);throw q}var B=x?x.push():new o;B.topLevel=!0;var C=new h(b||{},this.blocks,this.env);this.rootRenderFunc(this.env,C,B,g,function(q){q?N(q,null):N(null,C.getExported())})},K.compile=function(){this.compiled||this._compile()},K._compile=function(){var b;if(this.tmplProps)b=this.tmplProps;else{var x=O.compile(this.tmplStr,this.env.asyncFilters,this.env.extensionsList,this.path,this.env.opts),N=new Function(x);b=N()}this.blocks=this._getBlocks(b),this.rootRenderFunc=b.root,this.compiled=!0},K._getBlocks=function(b){var x={};return y.keys(b).forEach(function(N){N.slice(0,2)==="b_"&&(x[N.slice(2)]=b[N])}),x},F}(m);c.exports={Environment:d,Template:A}},function(c,S,w){function p(W,j){W.prototype=Object.create(j.prototype),W.prototype.constructor=W,E(W,j)}function E(W,j){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(I,e){return I.__proto__=e,I},E(W,j)}var f=w(9),t=w(3),y=w(1).Obj,O=w(0),V=function(W){p(j,W);function j(){return W.apply(this,arguments)||this}var L=j.prototype;return L.init=function(e){this.tokens=e,this.peeked=null,this.breakOnBlocks=null,this.dropLeadingWhitespace=!1,this.extensions=[]},L.nextToken=function(e){var r;if(this.peeked)if(!e&&this.peeked.type===f.TOKEN_WHITESPACE)this.peeked=null;else return r=this.peeked,this.peeked=null,r;if(r=this.tokens.nextToken(),!e)for(;r&&r.type===f.TOKEN_WHITESPACE;)r=this.tokens.nextToken();return r},L.peekToken=function(){return this.peeked=this.peeked||this.nextToken(),this.peeked},L.pushToken=function(e){if(this.peeked)throw new Error("pushToken: can only push one token on between reads");this.peeked=e},L.error=function(e,r,i){if(r===void 0||i===void 0){var m=this.peekToken()||{};r=m.lineno,i=m.colno}return r!==void 0&&(r+=1),i!==void 0&&(i+=1),new O.TemplateError(e,r,i)},L.fail=function(e,r,i){throw this.error(e,r,i)},L.skip=function(e){var r=this.nextToken();return!r||r.type!==e?(this.pushToken(r),!1):!0},L.expect=function(e){var r=this.nextToken();return r.type!==e&&this.fail("expected "+e+", got "+r.type,r.lineno,r.colno),r},L.skipValue=function(e,r){var i=this.nextToken();return!i||i.type!==e||i.value!==r?(this.pushToken(i),!1):!0},L.skipSymbol=function(e){return this.skipValue(f.TOKEN_SYMBOL,e)},L.advanceAfterBlockEnd=function(e){var r;return e||(r=this.peekToken(),r||this.fail("unexpected end of file"),r.type!==f.TOKEN_SYMBOL&&this.fail("advanceAfterBlockEnd: expected symbol token or explicit name to be passed"),e=this.nextToken().value),r=this.nextToken(),r&&r.type===f.TOKEN_BLOCK_END?r.value.charAt(0)==="-"&&(this.dropLeadingWhitespace=!0):this.fail("expected block end in "+e+" statement"),r},L.advanceAfterVariableEnd=function(){var e=this.nextToken();e&&e.type===f.TOKEN_VARIABLE_END?this.dropLeadingWhitespace=e.value.charAt(e.value.length-this.tokens.tags.VARIABLE_END.length-1)==="-":(this.pushToken(e),this.fail("expected variable end"))},L.parseFor=function(){var e=this.peekToken(),r,i;this.skipSymbol("for")?(r=new t.For(e.lineno,e.colno),i="endfor"):this.skipSymbol("asyncEach")?(r=new t.AsyncEach(e.lineno,e.colno),i="endeach"):this.skipSymbol("asyncAll")?(r=new t.AsyncAll(e.lineno,e.colno),i="endall"):this.fail("parseFor: expected for{Async}",e.lineno,e.colno),r.name=this.parsePrimary(),r.name instanceof t.Symbol||this.fail("parseFor: variable name expected for loop");var m=this.peekToken().type;if(m===f.TOKEN_COMMA){var l=r.name;for(r.name=new t.Array(l.lineno,l.colno),r.name.addChild(l);this.skip(f.TOKEN_COMMA);){var g=this.parsePrimary();r.name.addChild(g)}}return this.skipSymbol("in")||this.fail('parseFor: expected "in" keyword for loop',e.lineno,e.colno),r.arr=this.parseExpression(),this.advanceAfterBlockEnd(e.value),r.body=this.parseUntilBlocks(i,"else"),this.skipSymbol("else")&&(this.advanceAfterBlockEnd("else"),r.else_=this.parseUntilBlocks(i)),this.advanceAfterBlockEnd(),r},L.parseMacro=function(){var e=this.peekToken();this.skipSymbol("macro")||this.fail("expected macro");var r=this.parsePrimary(!0),i=this.parseSignature(),m=new t.Macro(e.lineno,e.colno,r,i);return this.advanceAfterBlockEnd(e.value),m.body=this.parseUntilBlocks("endmacro"),this.advanceAfterBlockEnd(),m},L.parseCall=function(){var e=this.peekToken();this.skipSymbol("call")||this.fail("expected call");var r=this.parseSignature(!0)||new t.NodeList,i=this.parsePrimary();this.advanceAfterBlockEnd(e.value);var m=this.parseUntilBlocks("endcall");this.advanceAfterBlockEnd();var l=new t.Symbol(e.lineno,e.colno,"caller"),g=new t.Caller(e.lineno,e.colno,l,r,m),n=i.args.children;n[n.length-1]instanceof t.KeywordArgs||n.push(new t.KeywordArgs);var o=n[n.length-1];return o.addChild(new t.Pair(e.lineno,e.colno,l,g)),new t.Output(e.lineno,e.colno,[i])},L.parseWithContext=function(){var e=this.peekToken(),r=null;return this.skipSymbol("with")?r=!0:this.skipSymbol("without")&&(r=!1),r!==null&&(this.skipSymbol("context")||this.fail("parseFrom: expected context after with/without",e.lineno,e.colno)),r},L.parseImport=function(){var e=this.peekToken();this.skipSymbol("import")||this.fail("parseImport: expected import",e.lineno,e.colno);var r=this.parseExpression();this.skipSymbol("as")||this.fail('parseImport: expected "as" keyword',e.lineno,e.colno);var i=this.parseExpression(),m=this.parseWithContext(),l=new t.Import(e.lineno,e.colno,r,i,m);return this.advanceAfterBlockEnd(e.value),l},L.parseFrom=function(){var e=this.peekToken();this.skipSymbol("from")||this.fail("parseFrom: expected from");var r=this.parseExpression();this.skipSymbol("import")||this.fail("parseFrom: expected import",e.lineno,e.colno);for(var i=new t.NodeList,m;;){var l=this.peekToken();if(l.type===f.TOKEN_BLOCK_END){i.children.length||this.fail("parseFrom: Expected at least one import name",e.lineno,e.colno),l.value.charAt(0)==="-"&&(this.dropLeadingWhitespace=!0),this.nextToken();break}i.children.length>0&&!this.skip(f.TOKEN_COMMA)&&this.fail("parseFrom: expected comma",e.lineno,e.colno);var g=this.parsePrimary();if(g.value.charAt(0)==="_"&&this.fail("parseFrom: names starting with an underscore cannot be imported",g.lineno,g.colno),this.skipSymbol("as")){var n=this.parsePrimary();i.addChild(new t.Pair(g.lineno,g.colno,g,n))}else i.addChild(g);m=this.parseWithContext()}return new t.FromImport(e.lineno,e.colno,r,i,m)},L.parseBlock=function(){var e=this.peekToken();this.skipSymbol("block")||this.fail("parseBlock: expected block",e.lineno,e.colno);var r=new t.Block(e.lineno,e.colno);r.name=this.parsePrimary(),r.name instanceof t.Symbol||this.fail("parseBlock: variable name expected",e.lineno,e.colno),this.advanceAfterBlockEnd(e.value),r.body=this.parseUntilBlocks("endblock"),this.skipSymbol("endblock"),this.skipSymbol(r.name.value);var i=this.peekToken();return i||this.fail("parseBlock: expected endblock, got end of file"),this.advanceAfterBlockEnd(i.value),r},L.parseExtends=function(){var e="extends",r=this.peekToken();this.skipSymbol(e)||this.fail("parseTemplateRef: expected "+e);var i=new t.Extends(r.lineno,r.colno);return i.template=this.parseExpression(),this.advanceAfterBlockEnd(r.value),i},L.parseInclude=function(){var e="include",r=this.peekToken();this.skipSymbol(e)||this.fail("parseInclude: expected "+e);var i=new t.Include(r.lineno,r.colno);return i.template=this.parseExpression(),this.skipSymbol("ignore")&&this.skipSymbol("missing")&&(i.ignoreMissing=!0),this.advanceAfterBlockEnd(r.value),i},L.parseIf=function(){var e=this.peekToken(),r;this.skipSymbol("if")||this.skipSymbol("elif")||this.skipSymbol("elseif")?r=new t.If(e.lineno,e.colno):this.skipSymbol("ifAsync")?r=new t.IfAsync(e.lineno,e.colno):this.fail("parseIf: expected if, elif, or elseif",e.lineno,e.colno),r.cond=this.parseExpression(),this.advanceAfterBlockEnd(e.value),r.body=this.parseUntilBlocks("elif","elseif","else","endif");var i=this.peekToken();switch(i&&i.value){case"elseif":case"elif":r.else_=this.parseIf();break;case"else":this.advanceAfterBlockEnd(),r.else_=this.parseUntilBlocks("endif"),this.advanceAfterBlockEnd();break;case"endif":r.else_=null,this.advanceAfterBlockEnd();break;default:this.fail("parseIf: expected elif, else, or endif, got end of file")}return r},L.parseSet=function(){var e=this.peekToken();this.skipSymbol("set")||this.fail("parseSet: expected set",e.lineno,e.colno);for(var r=new t.Set(e.lineno,e.colno,[]),i;(i=this.parsePrimary())&&(r.targets.push(i),!!this.skip(f.TOKEN_COMMA)););return this.skipValue(f.TOKEN_OPERATOR,"=")?(r.value=this.parseExpression(),this.advanceAfterBlockEnd(e.value)):this.skip(f.TOKEN_BLOCK_END)?(r.body=new t.Capture(e.lineno,e.colno,this.parseUntilBlocks("endset")),r.value=null,this.advanceAfterBlockEnd()):this.fail("parseSet: expected = or block end in set tag",e.lineno,e.colno),r},L.parseSwitch=function(){var e="switch",r="endswitch",i="case",m="default",l=this.peekToken();!this.skipSymbol(e)&&!this.skipSymbol(i)&&!this.skipSymbol(m)&&this.fail('parseSwitch: expected "switch," "case" or "default"',l.lineno,l.colno);var g=this.parseExpression();this.advanceAfterBlockEnd(e),this.parseUntilBlocks(i,m,r);var n=this.peekToken(),o=[],u;do{this.skipSymbol(i);var a=this.parseExpression();this.advanceAfterBlockEnd(e);var s=this.parseUntilBlocks(i,m,r);o.push(new t.Case(n.line,n.col,a,s)),n=this.peekToken()}while(n&&n.value===i);switch(n.value){case m:this.advanceAfterBlockEnd(),u=this.parseUntilBlocks(r),this.advanceAfterBlockEnd();break;case r:this.advanceAfterBlockEnd();break;default:this.fail('parseSwitch: expected "case," "default" or "endswitch," got EOF.')}return new t.Switch(l.lineno,l.colno,g,o,u)},L.parseStatement=function(){var e=this.peekToken(),r;if(e.type!==f.TOKEN_SYMBOL&&this.fail("tag name expected",e.lineno,e.colno),this.breakOnBlocks&&O.indexOf(this.breakOnBlocks,e.value)!==-1)return null;switch(e.value){case"raw":return this.parseRaw();case"verbatim":return this.parseRaw("verbatim");case"if":case"ifAsync":return this.parseIf();case"for":case"asyncEach":case"asyncAll":return this.parseFor();case"block":return this.parseBlock();case"extends":return this.parseExtends();case"include":return this.parseInclude();case"set":return this.parseSet();case"macro":return this.parseMacro();case"call":return this.parseCall();case"import":return this.parseImport();case"from":return this.parseFrom();case"filter":return this.parseFilterStatement();case"switch":return this.parseSwitch();default:if(this.extensions.length)for(var i=0;i<this.extensions.length;i++){var m=this.extensions[i];if(O.indexOf(m.tags||[],e.value)!==-1)return m.parse(this,t,f)}this.fail("unknown block tag: "+e.value,e.lineno,e.colno)}return r},L.parseRaw=function(e){e=e||"raw";for(var r="end"+e,i=new RegExp("([\\s\\S]*?){%\\s*("+e+"|"+r+")\\s*(?=%})%}"),m=1,l="",g=null,n=this.advanceAfterBlockEnd();(g=this.tokens._extractRegex(i))&&m>0;){var o=g[0],u=g[1],a=g[2];a===e?m+=1:a===r&&(m-=1),m===0?(l+=u,this.tokens.backN(o.length-u.length)):l+=o}return new t.Output(n.lineno,n.colno,[new t.TemplateData(n.lineno,n.colno,l)])},L.parsePostfix=function(e){for(var r,i=this.peekToken();i;){if(i.type===f.TOKEN_LEFT_PAREN)e=new t.FunCall(i.lineno,i.colno,e,this.parseSignature());else if(i.type===f.TOKEN_LEFT_BRACKET)r=this.parseAggregate(),r.children.length>1&&this.fail("invalid index"),e=new t.LookupVal(i.lineno,i.colno,e,r.children[0]);else if(i.type===f.TOKEN_OPERATOR&&i.value==="."){this.nextToken();var m=this.nextToken();m.type!==f.TOKEN_SYMBOL&&this.fail("expected name as lookup value, got "+m.value,m.lineno,m.colno),r=new t.Literal(m.lineno,m.colno,m.value),e=new t.LookupVal(i.lineno,i.colno,e,r)}else break;i=this.peekToken()}return e},L.parseExpression=function(){var e=this.parseInlineIf();return e},L.parseInlineIf=function(){var e=this.parseOr();if(this.skipSymbol("if")){var r=this.parseOr(),i=e;e=new t.InlineIf(e.lineno,e.colno),e.body=i,e.cond=r,this.skipSymbol("else")?e.else_=this.parseOr():e.else_=null}return e},L.parseOr=function(){for(var e=this.parseAnd();this.skipSymbol("or");){var r=this.parseAnd();e=new t.Or(e.lineno,e.colno,e,r)}return e},L.parseAnd=function(){for(var e=this.parseNot();this.skipSymbol("and");){var r=this.parseNot();e=new t.And(e.lineno,e.colno,e,r)}return e},L.parseNot=function(){var e=this.peekToken();return this.skipSymbol("not")?new t.Not(e.lineno,e.colno,this.parseNot()):this.parseIn()},L.parseIn=function(){for(var e=this.parseIs();;){var r=this.nextToken();if(!r)break;var i=r.type===f.TOKEN_SYMBOL&&r.value==="not";if(i||this.pushToken(r),this.skipSymbol("in")){var m=this.parseIs();e=new t.In(e.lineno,e.colno,e,m),i&&(e=new t.Not(e.lineno,e.colno,e))}else{i&&this.pushToken(r);break}}return e},L.parseIs=function(){var e=this.parseCompare();if(this.skipSymbol("is")){var r=this.skipSymbol("not"),i=this.parseCompare();e=new t.Is(e.lineno,e.colno,e,i),r&&(e=new t.Not(e.lineno,e.colno,e))}return e},L.parseCompare=function(){for(var e=["==","===","!=","!==","<",">","<=",">="],r=this.parseConcat(),i=[];;){var m=this.nextToken();if(m)if(e.indexOf(m.value)!==-1)i.push(new t.CompareOperand(m.lineno,m.colno,this.parseConcat(),m.value));else{this.pushToken(m);break}else break}return i.length?new t.Compare(i[0].lineno,i[0].colno,r,i):r},L.parseConcat=function(){for(var e=this.parseAdd();this.skipValue(f.TOKEN_TILDE,"~");){var r=this.parseAdd();e=new t.Concat(e.lineno,e.colno,e,r)}return e},L.parseAdd=function(){for(var e=this.parseSub();this.skipValue(f.TOKEN_OPERATOR,"+");){var r=this.parseSub();e=new t.Add(e.lineno,e.colno,e,r)}return e},L.parseSub=function(){for(var e=this.parseMul();this.skipValue(f.TOKEN_OPERATOR,"-");){var r=this.parseMul();e=new t.Sub(e.lineno,e.colno,e,r)}return e},L.parseMul=function(){for(var e=this.parseDiv();this.skipValue(f.TOKEN_OPERATOR,"*");){var r=this.parseDiv();e=new t.Mul(e.lineno,e.colno,e,r)}return e},L.parseDiv=function(){for(var e=this.parseFloorDiv();this.skipValue(f.TOKEN_OPERATOR,"/");){var r=this.parseFloorDiv();e=new t.Div(e.lineno,e.colno,e,r)}return e},L.parseFloorDiv=function(){for(var e=this.parseMod();this.skipValue(f.TOKEN_OPERATOR,"//");){var r=this.parseMod();e=new t.FloorDiv(e.lineno,e.colno,e,r)}return e},L.parseMod=function(){for(var e=this.parsePow();this.skipValue(f.TOKEN_OPERATOR,"%");){var r=this.parsePow();e=new t.Mod(e.lineno,e.colno,e,r)}return e},L.parsePow=function(){for(var e=this.parseUnary();this.skipValue(f.TOKEN_OPERATOR,"**");){var r=this.parseUnary();e=new t.Pow(e.lineno,e.colno,e,r)}return e},L.parseUnary=function(e){var r=this.peekToken(),i;return this.skipValue(f.TOKEN_OPERATOR,"-")?i=new t.Neg(r.lineno,r.colno,this.parseUnary(!0)):this.skipValue(f.TOKEN_OPERATOR,"+")?i=new t.Pos(r.lineno,r.colno,this.parseUnary(!0)):i=this.parsePrimary(),e||(i=this.parseFilter(i)),i},L.parsePrimary=function(e){var r=this.nextToken(),i,m=null;if(r?r.type===f.TOKEN_STRING?i=r.value:r.type===f.TOKEN_INT?i=parseInt(r.value,10):r.type===f.TOKEN_FLOAT?i=parseFloat(r.value):r.type===f.TOKEN_BOOLEAN?r.value==="true"?i=!0:r.value==="false"?i=!1:this.fail("invalid boolean: "+r.value,r.lineno,r.colno):r.type===f.TOKEN_NONE?i=null:r.type===f.TOKEN_REGEX&&(i=new RegExp(r.value.body,r.value.flags)):this.fail("expected expression, got end of file"),i!==void 0?m=new t.Literal(r.lineno,r.colno,i):r.type===f.TOKEN_SYMBOL?m=new t.Symbol(r.lineno,r.colno,r.value):(this.pushToken(r),m=this.parseAggregate()),e||(m=this.parsePostfix(m)),m)return m;throw this.error("unexpected token: "+r.value,r.lineno,r.colno)},L.parseFilterName=function(){for(var e=this.expect(f.TOKEN_SYMBOL),r=e.value;this.skipValue(f.TOKEN_OPERATOR,".");)r+="."+this.expect(f.TOKEN_SYMBOL).value;return new t.Symbol(e.lineno,e.colno,r)},L.parseFilterArgs=function(e){if(this.peekToken().type===f.TOKEN_LEFT_PAREN){var r=this.parsePostfix(e);return r.args.children}return[]},L.parseFilter=function(e){for(;this.skip(f.TOKEN_PIPE);){var r=this.parseFilterName();e=new t.Filter(r.lineno,r.colno,r,new t.NodeList(r.lineno,r.colno,[e].concat(this.parseFilterArgs(e))))}return e},L.parseFilterStatement=function(){var e=this.peekToken();this.skipSymbol("filter")||this.fail("parseFilterStatement: expected filter");var r=this.parseFilterName(),i=this.parseFilterArgs(r);this.advanceAfterBlockEnd(e.value);var m=new t.Capture(r.lineno,r.colno,this.parseUntilBlocks("endfilter"));this.advanceAfterBlockEnd();var l=new t.Filter(r.lineno,r.colno,r,new t.NodeList(r.lineno,r.colno,[m].concat(i)));return new t.Output(r.lineno,r.colno,[l])},L.parseAggregate=function(){var e=this.nextToken(),r;switch(e.type){case f.TOKEN_LEFT_PAREN:r=new t.Group(e.lineno,e.colno);break;case f.TOKEN_LEFT_BRACKET:r=new t.Array(e.lineno,e.colno);break;case f.TOKEN_LEFT_CURLY:r=new t.Dict(e.lineno,e.colno);break;default:return null}for(;;){var i=this.peekToken().type;if(i===f.TOKEN_RIGHT_PAREN||i===f.TOKEN_RIGHT_BRACKET||i===f.TOKEN_RIGHT_CURLY){this.nextToken();break}if(r.children.length>0&&(this.skip(f.TOKEN_COMMA)||this.fail("parseAggregate: expected comma after expression",e.lineno,e.colno)),r instanceof t.Dict){var m=this.parsePrimary();this.skip(f.TOKEN_COLON)||this.fail("parseAggregate: expected colon after dict key",e.lineno,e.colno);var l=this.parseExpression();r.addChild(new t.Pair(m.lineno,m.colno,m,l))}else{var g=this.parseExpression();r.addChild(g)}}return r},L.parseSignature=function(e,r){var i=this.peekToken();if(!r&&i.type!==f.TOKEN_LEFT_PAREN){if(e)return null;this.fail("expected arguments",i.lineno,i.colno)}i.type===f.TOKEN_LEFT_PAREN&&(i=this.nextToken());for(var m=new t.NodeList(i.lineno,i.colno),l=new t.KeywordArgs(i.lineno,i.colno),g=!1;;){if(i=this.peekToken(),!r&&i.type===f.TOKEN_RIGHT_PAREN){this.nextToken();break}else if(r&&i.type===f.TOKEN_BLOCK_END)break;if(g&&!this.skip(f.TOKEN_COMMA))this.fail("parseSignature: expected comma after expression",i.lineno,i.colno);else{var n=this.parseExpression();this.skipValue(f.TOKEN_OPERATOR,"=")?l.addChild(new t.Pair(n.lineno,n.colno,n,this.parseExpression())):m.addChild(n)}g=!0}return l.children.length&&m.addChild(l),m},L.parseUntilBlocks=function(){for(var e=this.breakOnBlocks,r=arguments.length,i=new Array(r),m=0;m<r;m++)i[m]=arguments[m];this.breakOnBlocks=i;var l=this.parse();return this.breakOnBlocks=e,l},L.parseNodes=function(){for(var e,r=[];e=this.nextToken();)if(e.type===f.TOKEN_DATA){var i=e.value,m=this.peekToken(),l=m&&m.value;this.dropLeadingWhitespace&&(i=i.replace(/^\s*/,""),this.dropLeadingWhitespace=!1),m&&(m.type===f.TOKEN_BLOCK_START&&l.charAt(l.length-1)==="-"||m.type===f.TOKEN_VARIABLE_START&&l.charAt(this.tokens.tags.VARIABLE_START.length)==="-"||m.type===f.TOKEN_COMMENT&&l.charAt(this.tokens.tags.COMMENT_START.length)==="-")&&(i=i.replace(/\s*$/,"")),r.push(new t.Output(e.lineno,e.colno,[new t.TemplateData(e.lineno,e.colno,i)]))}else if(e.type===f.TOKEN_BLOCK_START){this.dropLeadingWhitespace=!1;var g=this.parseStatement();if(!g)break;r.push(g)}else if(e.type===f.TOKEN_VARIABLE_START){var n=this.parseExpression();this.dropLeadingWhitespace=!1,this.advanceAfterVariableEnd(),r.push(new t.Output(e.lineno,e.colno,[n]))}else e.type===f.TOKEN_COMMENT?this.dropLeadingWhitespace=e.value.charAt(e.value.length-this.tokens.tags.COMMENT_END.length-1)==="-":this.fail("Unexpected token at top-level: "+e.type,e.lineno,e.colno);return r},L.parse=function(){return new t.NodeList(0,0,this.parseNodes())},L.parseAsRoot=function(){return new t.Root(0,0,this.parseNodes())},j}(y);c.exports={parse:function(j,L,I){var e=new V(f.lex(j,I));return L!==void 0&&(e.extensions=L),e.parseAsRoot()},Parser:V}},function(c,S,w){var p=w(0),E=`
|
|
17
|
-
\r `,f="()[]{}%*-+~/#,:|.<>=!",t="0123456789",y="{%",O="%}",V="{{",W="}}",j="{#",L="#}",I="string",e="whitespace",r="data",i="block-start",m="block-end",l="variable-start",g="variable-end",n="comment",o="left-paren",u="right-paren",a="left-bracket",s="right-bracket",d="left-curly",h="right-curly",A="operator",M="comma",F="colon",K="tilde",D="pipe",b="int",x="float",N="boolean",B="none",C="symbol",q="special",z="regex";function X(be,oe,ae,H){return{type:be,value:oe,lineno:ae,colno:H}}var ye=function(){function be(ae,H){this.str=ae,this.index=0,this.len=ae.length,this.lineno=0,this.colno=0,this.in_code=!1,H=H||{};var Y=H.tags||{};this.tags={BLOCK_START:Y.blockStart||y,BLOCK_END:Y.blockEnd||O,VARIABLE_START:Y.variableStart||V,VARIABLE_END:Y.variableEnd||W,COMMENT_START:Y.commentStart||j,COMMENT_END:Y.commentEnd||L},this.trimBlocks=!!H.trimBlocks,this.lstripBlocks=!!H.lstripBlocks}var oe=be.prototype;return oe.nextToken=function(){var H=this.lineno,Y=this.colno,Q;if(this.in_code){var he=this.current();if(this.isFinished())return null;if(he==='"'||he==="'")return X(I,this._parseString(he),H,Y);if(Q=this._extract(E))return X(e,Q,H,Y);if((Q=this._extractString(this.tags.BLOCK_END))||(Q=this._extractString("-"+this.tags.BLOCK_END)))return this.in_code=!1,this.trimBlocks&&(he=this.current(),he===`
|
|
18
|
-
`?this.forward():he==="\r"&&(this.forward(),he=this.current(),he===`
|
|
19
|
-
`?this.forward():this.back())),X(m,Q,H,Y);if((Q=this._extractString(this.tags.VARIABLE_END))||(Q=this._extractString("-"+this.tags.VARIABLE_END)))return this.in_code=!1,X(g,Q,H,Y);if(he==="r"&&this.str.charAt(this.index+1)==="/"){this.forwardN(2);for(var Ae="";!this.isFinished();)if(this.current()==="/"&&this.previous()!=="\\"){this.forward();break}else Ae+=this.current(),this.forward();for(var Te=["g","i","m","y"],De="";!this.isFinished();){var k=Te.indexOf(this.current())!==-1;if(k)De+=this.current(),this.forward();else break}return X(z,{body:Ae,flags:De},H,Y)}else if(f.indexOf(he)!==-1){this.forward();var $=["==","===","!=","!==","<=",">=","//","**"],Z=he+this.current(),J;switch(p.indexOf($,Z)!==-1&&(this.forward(),he=Z,p.indexOf($,Z+this.current())!==-1&&(he=Z+this.current(),this.forward())),he){case"(":J=o;break;case")":J=u;break;case"[":J=a;break;case"]":J=s;break;case"{":J=d;break;case"}":J=h;break;case",":J=M;break;case":":J=F;break;case"~":J=K;break;case"|":J=D;break;default:J=A}return X(J,he,H,Y)}else if(Q=this._extractUntil(E+f),Q.match(/^[-+]?[0-9]+$/))if(this.current()==="."){this.forward();var pe=this._extract(t);return X(x,Q+"."+pe,H,Y)}else return X(b,Q,H,Y);else{if(Q.match(/^(true|false)$/))return X(N,Q,H,Y);if(Q==="none")return X(B,Q,H,Y);if(Q==="null")return X(B,Q,H,Y);if(Q)return X(C,Q,H,Y);throw new Error("Unexpected value while parsing: "+Q)}}else{var ue=this.tags.BLOCK_START.charAt(0)+this.tags.VARIABLE_START.charAt(0)+this.tags.COMMENT_START.charAt(0)+this.tags.COMMENT_END.charAt(0);if(this.isFinished())return null;if((Q=this._extractString(this.tags.BLOCK_START+"-"))||(Q=this._extractString(this.tags.BLOCK_START)))return this.in_code=!0,X(i,Q,H,Y);if((Q=this._extractString(this.tags.VARIABLE_START+"-"))||(Q=this._extractString(this.tags.VARIABLE_START)))return this.in_code=!0,X(l,Q,H,Y);Q="";var Oe,ve=!1;for(this._matches(this.tags.COMMENT_START)&&(ve=!0,Q=this._extractString(this.tags.COMMENT_START));(Oe=this._extractUntil(ue))!==null;)if(Q+=Oe,(this._matches(this.tags.BLOCK_START)||this._matches(this.tags.VARIABLE_START)||this._matches(this.tags.COMMENT_START))&&!ve){if(this.lstripBlocks&&this._matches(this.tags.BLOCK_START)&&this.colno>0&&this.colno<=Q.length){var ke=Q.slice(-this.colno);if(/^\s+$/.test(ke)&&(Q=Q.slice(0,-this.colno),!Q.length))return this.nextToken()}break}else if(this._matches(this.tags.COMMENT_END)){if(!ve)throw new Error("unexpected end of comment");Q+=this._extractString(this.tags.COMMENT_END);break}else Q+=this.current(),this.forward();if(Oe===null&&ve)throw new Error("expected end of comment, got end of file");return X(ve?n:r,Q,H,Y)}},oe._parseString=function(H){this.forward();for(var Y="";!this.isFinished()&&this.current()!==H;){var Q=this.current();if(Q==="\\"){switch(this.forward(),this.current()){case"n":Y+=`
|
|
20
|
-
`;break;case"t":Y+=" ";break;case"r":Y+="\r";break;default:Y+=this.current()}this.forward()}else Y+=Q,this.forward()}return this.forward(),Y},oe._matches=function(H){if(this.index+H.length>this.len)return null;var Y=this.str.slice(this.index,this.index+H.length);return Y===H},oe._extractString=function(H){return this._matches(H)?(this.forwardN(H.length),H):null},oe._extractUntil=function(H){return this._extractMatching(!0,H||"")},oe._extract=function(H){return this._extractMatching(!1,H)},oe._extractMatching=function(H,Y){if(this.isFinished())return null;var Q=Y.indexOf(this.current());if(H&&Q===-1||!H&&Q!==-1){var he=this.current();this.forward();for(var Ae=Y.indexOf(this.current());(H&&Ae===-1||!H&&Ae!==-1)&&!this.isFinished();)he+=this.current(),this.forward(),Ae=Y.indexOf(this.current());return he}return""},oe._extractRegex=function(H){var Y=this.currentStr().match(H);return Y?(this.forwardN(Y[0].length),Y):null},oe.isFinished=function(){return this.index>=this.len},oe.forwardN=function(H){for(var Y=0;Y<H;Y++)this.forward()},oe.forward=function(){this.index++,this.previous()===`
|
|
21
|
-
`?(this.lineno++,this.colno=0):this.colno++},oe.backN=function(H){for(var Y=0;Y<H;Y++)this.back()},oe.back=function(){if(this.index--,this.current()===`
|
|
22
|
-
`){this.lineno--;var H=this.src.lastIndexOf(`
|
|
23
|
-
`,this.index-1);H===-1?this.colno=this.index:this.colno=this.index-H}else this.colno--},oe.current=function(){return this.isFinished()?"":this.str.charAt(this.index)},oe.currentStr=function(){return this.isFinished()?"":this.str.substr(this.index)},oe.previous=function(){return this.str.charAt(this.index-1)},be}();c.exports={lex:function(oe,ae){return new ye(oe,ae)},TOKEN_STRING:I,TOKEN_WHITESPACE:e,TOKEN_DATA:r,TOKEN_BLOCK_START:i,TOKEN_BLOCK_END:m,TOKEN_VARIABLE_START:l,TOKEN_VARIABLE_END:g,TOKEN_COMMENT:n,TOKEN_LEFT_PAREN:o,TOKEN_RIGHT_PAREN:u,TOKEN_LEFT_BRACKET:a,TOKEN_RIGHT_BRACKET:s,TOKEN_LEFT_CURLY:d,TOKEN_RIGHT_CURLY:h,TOKEN_OPERATOR:A,TOKEN_COMMA:M,TOKEN_COLON:F,TOKEN_TILDE:K,TOKEN_PIPE:D,TOKEN_INT:b,TOKEN_FLOAT:x,TOKEN_BOOLEAN:N,TOKEN_NONE:B,TOKEN_SYMBOL:C,TOKEN_SPECIAL:q,TOKEN_REGEX:z}},function(c,S,w){function p(V,W){V.prototype=Object.create(W.prototype),V.prototype.constructor=V,E(V,W)}function E(V,W){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(L,I){return L.__proto__=I,L},E(V,W)}var f=w(6),t=w(19),y=t.PrecompiledLoader,O=function(V){p(W,V);function W(L,I){var e;return e=V.call(this)||this,e.baseURL=L||".",I=I||{},e.useCache=!!I.useCache,e.async=!!I.async,e}var j=W.prototype;return j.resolve=function(I,e){throw new Error("relative templates not support in the browser yet")},j.getSource=function(I,e){var r=this,i=this.useCache,m;return this.fetch(this.baseURL+"/"+I,function(l,g){if(l)if(e)e(l.content);else if(l.status===404)m=null;else throw l.content;else m={src:g,path:I,noCache:!i},r.emit("load",I,m),e&&e(null,m)}),m},j.fetch=function(I,e){if(typeof window>"u")throw new Error("WebLoader can only by used in a browser");var r=new XMLHttpRequest,i=!0;r.onreadystatechange=function(){r.readyState===4&&i&&(i=!1,r.status===0||r.status===200?e(null,r.responseText):e({status:r.status,content:r.responseText}))},I+=(I.indexOf("?")===-1?"?":"&")+"s="+new Date().getTime(),r.open("GET",I,this.async),r.send()},W}(f);c.exports={WebLoader:O,PrecompiledLoader:y}},function(c,S,w){var p=w(0),E=w(7),f=E.Environment,t=E.Template,y=w(6),O=w(10),V=w(23),W=w(5),j=w(8),L=w(9),I=w(2),e=w(3),r=w(25),i;function m(l,g){g=g||{},p.isObject(l)&&(g=l,l=null);var n;return O.FileSystemLoader?n=new O.FileSystemLoader(l,{watch:g.watch,noCache:g.noCache}):O.WebLoader&&(n=new O.WebLoader(l,{useCache:g.web&&g.web.useCache,async:g.web&&g.web.async})),i=new f(n,g),g&&g.express&&i.express(g.express),i}c.exports={Environment:f,Template:t,Loader:y,FileSystemLoader:O.FileSystemLoader,NodeResolveLoader:O.NodeResolveLoader,PrecompiledLoader:O.PrecompiledLoader,WebLoader:O.WebLoader,compiler:W,parser:j,lexer:L,runtime:I,lib:p,nodes:e,installJinjaCompat:r,configure:m,reset:function(){i=void 0},compile:function(g,n,o,u){return i||m(),new t(g,n,o,u)},render:function(g,n,o){return i||m(),i.render(g,n,o)},renderString:function(g,n,o){return i||m(),i.renderString(g,n,o)},precompile:V?V.precompile:void 0,precompileString:V?V.precompileString:void 0}},function(c,S,w){var p=w(13),E=[],f=[],t=p.makeRequestCallFromTimer(y);function y(){if(f.length)throw f.shift()}c.exports=O;function O(W){var j;E.length?j=E.pop():j=new V,j.task=W,p(j)}function V(){this.task=null}V.prototype.call=function(){try{this.task.call()}catch(W){O.onerror?O.onerror(W):(f.push(W),t())}finally{this.task=null,E[E.length]=this}}},function(c,S,w){(function(p){c.exports=E;function E(e){f.length||t(),f[f.length]=e}var f=[],t,y=0,O=1024;function V(){for(;y<f.length;){var e=y;if(y=y+1,f[e].call(),y>O){for(var r=0,i=f.length-y;r<i;r++)f[r]=f[r+y];f.length-=y,y=0}}f.length=0,y=0}var W=typeof p<"u"?p:self,j=W.MutationObserver||W.WebKitMutationObserver;typeof j=="function"?t=L(V):t=I(V),E.requestFlush=t;function L(e){var r=1,i=new j(e),m=document.createTextNode("");return i.observe(m,{characterData:!0}),function(){r=-r,m.data=r}}function I(e){return function(){var i=setTimeout(l,0),m=setInterval(l,50);function l(){clearTimeout(i),clearInterval(m),e()}}}E.makeRequestCallFromTimer=I}).call(S,w(14))},function(c,S){var w;w=function(){return this}();try{w=w||Function("return this")()||(0,eval)("this")}catch{typeof window=="object"&&(w=window)}c.exports=w},function(c,S,w){var p,E;(function(f){var t=function(){var j=Array.prototype.slice.call(arguments);typeof j[0]=="function"&&j[0].apply(null,j.splice(1))},y=function(j){typeof setImmediate=="function"?setImmediate(j):typeof process<"u"&&process.nextTick?process.nextTick(j):setTimeout(j,0)},O=function(j){var L=function(I){var e=function(){return j.length&&j[I].apply(null,arguments),e.next()};return e.next=function(){return I<j.length-1?L(I+1):null},e};return L(0)},V=Array.isArray||function(j){return Object.prototype.toString.call(j)==="[object Array]"},W=function(j,L,I){var e=I?y:t;if(L=L||function(){},!V(j)){var r=new Error("First argument to waterfall must be an array of functions");return L(r)}if(!j.length)return L();var i=function(m){return function(l){if(l)L.apply(null,arguments),L=function(){};else{var g=Array.prototype.slice.call(arguments,1),n=m.next();n?g.push(i(n)):g.push(L),e(function(){m.apply(null,g)})}}};i(O(j))()};p=[],E=(function(){return W}).apply(S,p),E!==void 0&&(c.exports=E)})()},function(c,S,w){var p=typeof Reflect=="object"?Reflect:null,E=p&&typeof p.apply=="function"?p.apply:function(s,d,h){return Function.prototype.apply.call(s,d,h)},f;p&&typeof p.ownKeys=="function"?f=p.ownKeys:Object.getOwnPropertySymbols?f=function(s){return Object.getOwnPropertyNames(s).concat(Object.getOwnPropertySymbols(s))}:f=function(s){return Object.getOwnPropertyNames(s)};function t(a){console&&console.warn&&console.warn(a)}var y=Number.isNaN||function(s){return s!==s};function O(){O.init.call(this)}c.exports=O,c.exports.once=n,O.EventEmitter=O,O.prototype._events=void 0,O.prototype._eventsCount=0,O.prototype._maxListeners=void 0;var V=10;function W(a){if(typeof a!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof a)}Object.defineProperty(O,"defaultMaxListeners",{enumerable:!0,get:function(){return V},set:function(a){if(typeof a!="number"||a<0||y(a))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+a+".");V=a}}),O.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},O.prototype.setMaxListeners=function(s){if(typeof s!="number"||s<0||y(s))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+s+".");return this._maxListeners=s,this};function j(a){return a._maxListeners===void 0?O.defaultMaxListeners:a._maxListeners}O.prototype.getMaxListeners=function(){return j(this)},O.prototype.emit=function(s){for(var d=[],h=1;h<arguments.length;h++)d.push(arguments[h]);var A=s==="error",M=this._events;if(M!==void 0)A=A&&M.error===void 0;else if(!A)return!1;if(A){var F;if(d.length>0&&(F=d[0]),F instanceof Error)throw F;var K=new Error("Unhandled error."+(F?" ("+F.message+")":""));throw K.context=F,K}var D=M[s];if(D===void 0)return!1;if(typeof D=="function")E(D,this,d);else for(var b=D.length,x=m(D,b),h=0;h<b;++h)E(x[h],this,d);return!0};function L(a,s,d,h){var A,M,F;if(W(d),M=a._events,M===void 0?(M=a._events=Object.create(null),a._eventsCount=0):(M.newListener!==void 0&&(a.emit("newListener",s,d.listener?d.listener:d),M=a._events),F=M[s]),F===void 0)F=M[s]=d,++a._eventsCount;else if(typeof F=="function"?F=M[s]=h?[d,F]:[F,d]:h?F.unshift(d):F.push(d),A=j(a),A>0&&F.length>A&&!F.warned){F.warned=!0;var K=new Error("Possible EventEmitter memory leak detected. "+F.length+" "+String(s)+" listeners added. Use emitter.setMaxListeners() to increase limit");K.name="MaxListenersExceededWarning",K.emitter=a,K.type=s,K.count=F.length,t(K)}return a}O.prototype.addListener=function(s,d){return L(this,s,d,!1)},O.prototype.on=O.prototype.addListener,O.prototype.prependListener=function(s,d){return L(this,s,d,!0)};function I(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function e(a,s,d){var h={fired:!1,wrapFn:void 0,target:a,type:s,listener:d},A=I.bind(h);return A.listener=d,h.wrapFn=A,A}O.prototype.once=function(s,d){return W(d),this.on(s,e(this,s,d)),this},O.prototype.prependOnceListener=function(s,d){return W(d),this.prependListener(s,e(this,s,d)),this},O.prototype.removeListener=function(s,d){var h,A,M,F,K;if(W(d),A=this._events,A===void 0)return this;if(h=A[s],h===void 0)return this;if(h===d||h.listener===d)--this._eventsCount===0?this._events=Object.create(null):(delete A[s],A.removeListener&&this.emit("removeListener",s,h.listener||d));else if(typeof h!="function"){for(M=-1,F=h.length-1;F>=0;F--)if(h[F]===d||h[F].listener===d){K=h[F].listener,M=F;break}if(M<0)return this;M===0?h.shift():l(h,M),h.length===1&&(A[s]=h[0]),A.removeListener!==void 0&&this.emit("removeListener",s,K||d)}return this},O.prototype.off=O.prototype.removeListener,O.prototype.removeAllListeners=function(s){var d,h,A;if(h=this._events,h===void 0)return this;if(h.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):h[s]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete h[s]),this;if(arguments.length===0){var M=Object.keys(h),F;for(A=0;A<M.length;++A)F=M[A],F!=="removeListener"&&this.removeAllListeners(F);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(d=h[s],typeof d=="function")this.removeListener(s,d);else if(d!==void 0)for(A=d.length-1;A>=0;A--)this.removeListener(s,d[A]);return this};function r(a,s,d){var h=a._events;if(h===void 0)return[];var A=h[s];return A===void 0?[]:typeof A=="function"?d?[A.listener||A]:[A]:d?g(A):m(A,A.length)}O.prototype.listeners=function(s){return r(this,s,!0)},O.prototype.rawListeners=function(s){return r(this,s,!1)},O.listenerCount=function(a,s){return typeof a.listenerCount=="function"?a.listenerCount(s):i.call(a,s)},O.prototype.listenerCount=i;function i(a){var s=this._events;if(s!==void 0){var d=s[a];if(typeof d=="function")return 1;if(d!==void 0)return d.length}return 0}O.prototype.eventNames=function(){return this._eventsCount>0?f(this._events):[]};function m(a,s){for(var d=new Array(s),h=0;h<s;++h)d[h]=a[h];return d}function l(a,s){for(;s+1<a.length;s++)a[s]=a[s+1];a.pop()}function g(a){for(var s=new Array(a.length),d=0;d<s.length;++d)s[d]=a[d].listener||a[d];return s}function n(a,s){return new Promise(function(d,h){function A(F){a.removeListener(s,M),h(F)}function M(){typeof a.removeListener=="function"&&a.removeListener("error",A),d([].slice.call(arguments))}u(a,s,M,{once:!0}),s!=="error"&&o(a,A,{once:!0})})}function o(a,s,d){typeof a.on=="function"&&u(a,"error",s,d)}function u(a,s,d,h){if(typeof a.on=="function")h.once?a.once(s,d):a.on(s,d);else if(typeof a.addEventListener=="function")a.addEventListener(s,function A(M){h.once&&a.removeEventListener(s,A),d(M)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof a)}},function(c,S,w){var p=w(3),E=w(0),f=0;function t(){return"hole_"+f++}function y(i,m){for(var l=null,g=0;g<i.length;g++){var n=m(i[g]);n!==i[g]&&(l||(l=i.slice()),l[g]=n)}return l||i}function O(i,m,l){if(!(i instanceof p.Node))return i;if(!l){var g=m(i);if(g&&g!==i)return g}if(i instanceof p.NodeList){var n=y(i.children,function(d){return O(d,m,l)});n!==i.children&&(i=new p[i.typename](i.lineno,i.colno,n))}else if(i instanceof p.CallExtension){var o=O(i.args,m,l),u=y(i.contentArgs,function(d){return O(d,m,l)});(o!==i.args||u!==i.contentArgs)&&(i=new p[i.typename](i.extName,i.prop,o,u))}else{var a=i.fields.map(function(d){return i[d]}),s=y(a,function(d){return O(d,m,l)});s!==a&&(i=new p[i.typename](i.lineno,i.colno),s.forEach(function(d,h){i[i.fields[h]]=d}))}return l&&m(i)||i}function V(i,m){return O(i,m,!0)}function W(i,m,l){var g=[],n=V(l?i[l]:i,function(o){var u;return o instanceof p.Block?o:((o instanceof p.Filter&&E.indexOf(m,o.name.value)!==-1||o instanceof p.CallExtensionAsync)&&(u=new p.Symbol(o.lineno,o.colno,t()),g.push(new p.FilterAsync(o.lineno,o.colno,o.name,o.args,u))),u)});return l?i[l]=n:i=n,g.length?(g.push(i),new p.NodeList(i.lineno,i.colno,g)):i}function j(i,m){return V(i,function(l){return l instanceof p.Output?W(l,m):l instanceof p.Set?W(l,m,"value"):l instanceof p.For?W(l,m,"arr"):l instanceof p.If?W(l,m,"cond"):l instanceof p.CallExtension?W(l,m,"args"):void 0})}function L(i){return O(i,function(m){if(m instanceof p.Block){var l=!1,g=t();m.body=O(m.body,function(n){if(n instanceof p.FunCall&&n.name.value==="super")return l=!0,new p.Symbol(n.lineno,n.colno,g)}),l&&m.body.children.unshift(new p.Super(0,0,m.name,new p.Symbol(0,0,g)))}})}function I(i){return V(i,function(m){if(!(!(m instanceof p.If)&&!(m instanceof p.For))){var l=!1;if(O(m,function(g){if(g instanceof p.FilterAsync||g instanceof p.IfAsync||g instanceof p.AsyncEach||g instanceof p.AsyncAll||g instanceof p.CallExtensionAsync)return l=!0,g}),l){if(m instanceof p.If)return new p.IfAsync(m.lineno,m.colno,m.cond,m.body,m.else_);if(m instanceof p.For&&!(m instanceof p.AsyncAll))return new p.AsyncEach(m.lineno,m.colno,m.arr,m.name,m.body,m.else_)}}})}function e(i,m){return I(L(j(i,m)))}function r(i,m){return e(i,m||[])}c.exports={transform:r}},function(c,f,w){var p=w(0),E=w(2),f=c.exports={};function t(k,$){return k==null||k===!1?$:k}f.abs=Math.abs;function y(k){return k!==k}function O(k,$,Z){var J,pe=[],ue=[];for(J=0;J<k.length;J++)J%$===0&&ue.length&&(pe.push(ue),ue=[]),ue.push(k[J]);if(ue.length){if(Z)for(J=ue.length;J<$;J++)ue.push(Z);pe.push(ue)}return pe}f.batch=O;function V(k){k=t(k,"");var $=k.toLowerCase();return E.copySafeness(k,$.charAt(0).toUpperCase()+$.slice(1))}f.capitalize=V;function W(k,$){if(k=t(k,""),$=$||80,k.length>=$)return k;var Z=$-k.length,J=p.repeat(" ",Z/2-Z%2),pe=p.repeat(" ",Z/2);return E.copySafeness(k,J+k+pe)}f.center=W;function j(k,$,Z){return Z?k||$:k!==void 0?k:$}f.default=j;function L(k,$,Z){if(!p.isObject(k))throw new p.TemplateError("dictsort filter: val must be an object");var J=[];for(var pe in k)J.push([pe,k[pe]]);var ue;if(Z===void 0||Z==="key")ue=0;else if(Z==="value")ue=1;else throw new p.TemplateError("dictsort filter: You can only sort by either key or value");return J.sort(function(Oe,ve){var ke=Oe[ue],We=ve[ue];return $||(p.isString(ke)&&(ke=ke.toUpperCase()),p.isString(We)&&(We=We.toUpperCase())),ke>We?1:ke===We?0:-1}),J}f.dictsort=L;function I(k,$){return JSON.stringify(k,null,$)}f.dump=I;function e(k){return k instanceof E.SafeString?k:(k=k??"",E.markSafe(p.escape(k.toString())))}f.escape=e;function r(k){return k instanceof E.SafeString?k:(k=k??"",E.markSafe(k.toString()))}f.safe=r;function i(k){return k[0]}f.first=i;function m(k){return k=k??"",E.markSafe(p.escape(k.toString()))}f.forceescape=m;function l(k,$){return p.groupBy(k,$,this.env.opts.throwOnUndefined)}f.groupby=l;function g(k,$,Z){if(k=t(k,""),k==="")return"";$=$||4;var J=k.split(`
|
|
24
|
-
`),pe=p.repeat(" ",$),ue=J.map(function(Oe,ve){return ve===0&&!Z?Oe:""+pe+Oe}).join(`
|
|
25
|
-
`);return E.copySafeness(k,ue)}f.indent=g;function n(k,$,Z){return $=$||"",Z&&(k=p.map(k,function(J){return J[Z]})),k.join($)}f.join=n;function o(k){return k[k.length-1]}f.last=o;function u(k){var $=t(k,"");return $!==void 0?typeof Map=="function"&&$ instanceof Map||typeof Set=="function"&&$ instanceof Set?$.size:p.isObject($)&&!($ instanceof E.SafeString)?p.keys($).length:$.length:0}f.length=u;function a(k){if(p.isString(k))return k.split("");if(p.isObject(k))return p._entries(k||{}).map(function($){var Z=$[0],J=$[1];return{key:Z,value:J}});if(p.isArray(k))return k;throw new p.TemplateError("list filter: type not iterable")}f.list=a;function s(k){return k=t(k,""),k.toLowerCase()}f.lower=s;function d(k){return k==null?"":E.copySafeness(k,k.replace(/\r\n|\n/g,`<br />
|
|
26
|
-
`))}f.nl2br=d;function h(k){return k[Math.floor(Math.random()*k.length)]}f.random=h;function A(k){function $(Z,J,pe){J===void 0&&(J="truthy");var ue=this,Oe=ue.env.getTest(J);return p.toArray(Z).filter(function(ke){return Oe.call(ue,ke,pe)===k})}return $}f.reject=A(!1);function M(k,$){return k.filter(function(Z){return!Z[$]})}f.rejectattr=M,f.select=A(!0);function F(k,$){return k.filter(function(Z){return!!Z[$]})}f.selectattr=F;function K(k,$,Z,J){var pe=k;if($ instanceof RegExp)return k.replace($,Z);typeof J>"u"&&(J=-1);var ue="";if(typeof $=="number")$=""+$;else if(typeof $!="string")return k;if(typeof k=="number"&&(k=""+k),typeof k!="string"&&!(k instanceof E.SafeString))return k;if($==="")return ue=Z+k.split("").join(Z)+Z,E.copySafeness(k,ue);var Oe=k.indexOf($);if(J===0||Oe===-1)return k;for(var ve=0,ke=0;Oe>-1&&(J===-1||ke<J);)ue+=k.substring(ve,Oe)+Z,ve=Oe+$.length,ke++,Oe=k.indexOf($,ve);return ve<k.length&&(ue+=k.substring(ve)),E.copySafeness(pe,ue)}f.replace=K;function D(k){var $;return p.isString(k)?$=a(k):$=p.map(k,function(Z){return Z}),$.reverse(),p.isString(k)?E.copySafeness(k,$.join("")):$}f.reverse=D;function b(k,$,Z){$=$||0;var J=Math.pow(10,$),pe;return Z==="ceil"?pe=Math.ceil:Z==="floor"?pe=Math.floor:pe=Math.round,pe(k*J)/J}f.round=b;function x(k,$,Z){for(var J=Math.floor(k.length/$),pe=k.length%$,ue=[],Oe=0,ve=0;ve<$;ve++){var ke=Oe+ve*J;ve<pe&&Oe++;var We=Oe+(ve+1)*J,qe=k.slice(ke,We);Z&&ve>=pe&&qe.push(Z),ue.push(qe)}return ue}f.slice=x;function N(k,$,Z){return Z===void 0&&(Z=0),$&&(k=p.map(k,function(J){return J[$]})),Z+k.reduce(function(J,pe){return J+pe},0)}f.sum=N,f.sort=E.makeMacro(["value","reverse","case_sensitive","attribute"],[],function($,Z,J,pe){var ue=this,Oe=p.map($,function(ke){return ke}),ve=p.getAttrGetter(pe);return Oe.sort(function(ke,We){var qe=pe?ve(ke):ke,Ye=pe?ve(We):We;if(ue.env.opts.throwOnUndefined&&pe&&(qe===void 0||Ye===void 0))throw new TypeError('sort: attribute "'+pe+'" resolved to undefined');return!J&&p.isString(qe)&&p.isString(Ye)&&(qe=qe.toLowerCase(),Ye=Ye.toLowerCase()),qe<Ye?Z?1:-1:qe>Ye?Z?-1:1:0}),Oe});function B(k){return E.copySafeness(k,k)}f.string=B;function C(k,$){k=t(k,"");var Z=/<\/?([a-z][a-z0-9]*)\b[^>]*>|<!--[\s\S]*?-->/gi,J=z(k.replace(Z,"")),pe="";return $?pe=J.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,`
|
|
27
|
-
`).replace(/\n\n\n+/g,`
|
|
28
|
-
|
|
29
|
-
`):pe=J.replace(/\s+/gi," "),E.copySafeness(k,pe)}f.striptags=C;function q(k){k=t(k,"");var $=k.split(" ").map(function(Z){return V(Z)});return E.copySafeness(k,$.join(" "))}f.title=q;function z(k){return E.copySafeness(k,k.replace(/^\s*|\s*$/g,""))}f.trim=z;function X(k,$,Z,J){var pe=k;if(k=t(k,""),$=$||255,k.length<=$)return k;if(Z)k=k.substring(0,$);else{var ue=k.lastIndexOf(" ",$);ue===-1&&(ue=$),k=k.substring(0,ue)}return k+=J??"...",E.copySafeness(pe,k)}f.truncate=X;function ye(k){return k=t(k,""),k.toUpperCase()}f.upper=ye;function be(k){var $=encodeURIComponent;if(p.isString(k))return $(k);var Z=p.isArray(k)?k:p._entries(k);return Z.map(function(J){var pe=J[0],ue=J[1];return $(pe)+"="+$(ue)}).join("&")}f.urlencode=be;var oe=/^(?:\(|<|<)?(.*?)(?:\.|,|\)|\n|>)?$/,ae=/^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i,H=/^https?:\/\/.*$/,Y=/^www\./,Q=/\.(?:org|net|com)(?:\:|\/|$)/;function he(k,$,Z){y($)&&($=1/0);var J=Z===!0?' rel="nofollow"':"",pe=k.split(/(\s+)/).filter(function(ue){return ue&&ue.length}).map(function(ue){var Oe=ue.match(oe),ve=Oe?Oe[1]:ue,ke=ve.substr(0,$);return H.test(ve)?'<a href="'+ve+'"'+J+">"+ke+"</a>":Y.test(ve)?'<a href="http://'+ve+'"'+J+">"+ke+"</a>":ae.test(ve)?'<a href="mailto:'+ve+'">'+ve+"</a>":Q.test(ve)?'<a href="http://'+ve+'"'+J+">"+ke+"</a>":ue});return pe.join("")}f.urlize=he;function Ae(k){k=t(k,"");var $=k?k.match(/\w+/g):null;return $?$.length:null}f.wordcount=Ae;function Te(k,$){var Z=parseFloat(k);return y(Z)?$:Z}f.float=Te;var De=E.makeMacro(["value","default","base"],[],function($,Z,J){J===void 0&&(J=10);var pe=parseInt($,J);return y(pe)?Z:pe});f.int=De,f.d=f.default,f.e=f.escape},function(c,S,w){function p(y,O){y.prototype=Object.create(O.prototype),y.prototype.constructor=y,E(y,O)}function E(y,O){return E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(W,j){return W.__proto__=j,W},E(y,O)}var f=w(6),t=function(y){p(O,y);function O(W){var j;return j=y.call(this)||this,j.precompiled=W||{},j}var V=O.prototype;return V.getSource=function(j){return this.precompiled[j]?{src:{type:"code",obj:this.precompiled[j]},path:j}:null},O}(f);c.exports={PrecompiledLoader:t}},function(c,S,w){var p=w(2).SafeString;function E(h){return typeof h=="function"}S.callable=E;function f(h){return h!==void 0}S.defined=f;function t(h,A){return h%A===0}S.divisibleby=t;function y(h){return h instanceof p}S.escaped=y;function O(h,A){return h===A}S.equalto=O,S.eq=S.equalto,S.sameas=S.equalto;function V(h){return h%2===0}S.even=V;function W(h){return!h}S.falsy=W;function j(h,A){return h>=A}S.ge=j;function L(h,A){return h>A}S.greaterthan=L,S.gt=S.greaterthan;function I(h,A){return h<=A}S.le=I;function e(h,A){return h<A}S.lessthan=e,S.lt=S.lessthan;function r(h){return h.toLowerCase()===h}S.lower=r;function i(h,A){return h!==A}S.ne=i;function m(h){return h===null}S.null=m;function l(h){return typeof h=="number"}S.number=l;function g(h){return h%2===1}S.odd=g;function n(h){return typeof h=="string"}S.string=n;function o(h){return!!h}S.truthy=o;function u(h){return h===void 0}S.undefined=u;function a(h){return h.toUpperCase()===h}S.upper=a;function s(h){return typeof Symbol<"u"?!!h[Symbol.iterator]:Array.isArray(h)||typeof h=="string"}S.iterable=s;function d(h){var A=h!=null&&typeof h=="object"&&!Array.isArray(h);return Set?A&&!(h instanceof Set):A}S.mapping=d},function(c,S,w){function p(t){var y=-1;return{current:null,reset:function(){y=-1,this.current=null},next:function(){return y++,y>=t.length&&(y=0),this.current=t[y],this.current}}}function E(t){t=t||",";var y=!0;return function(){var O=y?"":t;return y=!1,O}}function f(){return{range:function(y,O,V){typeof O>"u"?(O=y,y=0,V=1):V||(V=1);var W=[];if(V>0)for(var j=y;j<O;j+=V)W.push(j);else for(var L=y;L>O;L+=V)W.push(L);return W},cycler:function(){return p(Array.prototype.slice.call(arguments))},joiner:function(y){return E(y)}}}c.exports=f},function(c,S,w){var p=w(4);c.exports=function(f,t){function y(O,V){if(this.name=O,this.path=O,this.defaultEngine=V.defaultEngine,this.ext=p.extname(O),!this.ext&&!this.defaultEngine)throw new Error("No default engine was specified and no extension was provided.");this.ext||(this.name+=this.ext=(this.defaultEngine[0]!=="."?".":"")+this.defaultEngine)}return y.prototype.render=function(V,W){f.render(this.name,V,W)},t.set("view",y),t.set("nunjucksEnv",f),f}},function(c,S,w){var p=w(4),E=w(4),f=w(0),t=f._prettifyError,y=w(5),O=w(7),V=O.Environment,W=w(24);function j(r,i){return Array.isArray(i)?i.some(function(m){return r.match(m)}):!1}function L(r,i){i=i||{},i.isString=!0;var m=i.env||new V([]),l=i.wrapper||W;if(!i.name)throw new Error('the "name" option is required when compiling a string');return l([e(r,i.name,m)],i)}function I(r,i){i=i||{};var m=i.env||new V([]),l=i.wrapper||W;if(i.isString)return L(r,i);var g=p.existsSync(r)&&p.statSync(r),n=[],o=[];function u(d){p.readdirSync(d).forEach(function(h){var A=E.join(d,h),M=A.substr(E.join(r,"/").length),F=p.statSync(A);F&&F.isDirectory()?(M+="/",j(M,i.exclude)||u(A)):j(M,i.include)&&o.push(A)})}if(g.isFile())n.push(e(p.readFileSync(r,"utf-8"),i.name||r,m));else if(g.isDirectory()){u(r);for(var a=0;a<o.length;a++){var s=o[a].replace(E.join(r,"/"),"");try{n.push(e(p.readFileSync(o[a],"utf-8"),s,m))}catch(d){if(i.force)console.error(d);else throw d}}}return l(n,i)}function e(r,i,m){m=m||new V([]);var l=m.asyncFilters,g=m.extensionsList,n;i=i.replace(/\\/g,"/");try{n=y.compile(r,l,g,i,m.opts)}catch(o){throw t(i,!1,o)}return{name:i,template:n}}c.exports={precompile:I,precompileString:L}},function(c,S,w){function p(E,f){var t="";f=f||{};for(var y=0;y<E.length;y++){var O=JSON.stringify(E[y].name),V=E[y].template;t+="(function() {(window.nunjucksPrecompiled = window.nunjucksPrecompiled || {})["+O+`] = (function() {
|
|
30
|
-
`+V+`
|
|
31
|
-
})();
|
|
32
|
-
`,f.asFunction&&(t+="return function(ctx, cb) { return nunjucks.render("+O+`, ctx, cb); }
|
|
33
|
-
`),t+=`})();
|
|
34
|
-
`}return t}c.exports=p},function(c,S,w){function p(){var E=this.runtime,f=this.lib,t=this.compiler.Compiler,y=this.parser.Parser,O=this.nodes,V=this.lexer,W=E.contextOrFrameLookup,j=E.memberLookup,L,I;t&&(L=t.prototype.assertType),y&&(I=y.prototype.parseAggregate);function e(){E.contextOrFrameLookup=W,E.memberLookup=j,t&&(t.prototype.assertType=L),y&&(y.prototype.parseAggregate=I)}E.contextOrFrameLookup=function(u,a,s){var d=W.apply(this,arguments);if(d!==void 0)return d;switch(s){case"True":return!0;case"False":return!1;case"None":return null;default:return}};function r(o){return{index:o.index,lineno:o.lineno,colno:o.colno}}if(O&&t&&y){var i=O.Node.extend("Slice",{fields:["start","stop","step"],init:function(u,a,s,d,h){s=s||new O.Literal(u,a,null),d=d||new O.Literal(u,a,null),h=h||new O.Literal(u,a,1),this.parent(u,a,s,d,h)}});t.prototype.assertType=function(u){u instanceof i||L.apply(this,arguments)},t.prototype.compileSlice=function(u,a){this._emit("("),this._compileExpression(u.start,a),this._emit("),("),this._compileExpression(u.stop,a),this._emit("),("),this._compileExpression(u.step,a),this._emit(")")},y.prototype.parseAggregate=function(){var u=this,a=r(this.tokens);a.colno--,a.index--;try{return I.apply(this)}catch(D){var s=r(this.tokens),d=function(){return f._assign(u.tokens,s),D};f._assign(this.tokens,a),this.peeked=!1;var h=this.peekToken();if(h.type!==V.TOKEN_LEFT_BRACKET)throw d();this.nextToken();for(var A=new i(h.lineno,h.colno),M=!1,F=0;F<=A.fields.length&&!this.skip(V.TOKEN_RIGHT_BRACKET);F++){if(F===A.fields.length)if(M)this.fail("parseSlice: too many slice components",h.lineno,h.colno);else break;if(this.skip(V.TOKEN_COLON))M=!0;else{var K=A.fields[F];A[K]=this.parseExpression(),M=this.skip(V.TOKEN_COLON)||M}}if(!M)throw d();return new O.Array(h.lineno,h.colno,[A])}}}function m(o,u,a,s){o=o||[],u===null&&(u=s<0?o.length-1:0),a===null?a=s<0?-1:o.length:a<0&&(a+=o.length),u<0&&(u+=o.length);for(var d=[],h=u;!(h<0||h>o.length||s>0&&h>=a||s<0&&h<=a);h+=s)d.push(E.memberLookup(o,h));return d}function l(o,u){return Object.prototype.hasOwnProperty.call(o,u)}var g={pop:function(u){if(u===void 0)return this.pop();if(u>=this.length||u<0)throw new Error("KeyError");return this.splice(u,1)},append:function(u){return this.push(u)},remove:function(u){for(var a=0;a<this.length;a++)if(this[a]===u)return this.splice(a,1);throw new Error("ValueError")},count:function(u){for(var a=0,s=0;s<this.length;s++)this[s]===u&&a++;return a},index:function(u){var a;if((a=this.indexOf(u))===-1)throw new Error("ValueError");return a},find:function(u){return this.indexOf(u)},insert:function(u,a){return this.splice(u,0,a)}},n={items:function(){return f._entries(this)},values:function(){return f._values(this)},keys:function(){return f.keys(this)},get:function(u,a){var s=this[u];return s===void 0&&(s=a),s},has_key:function(u){return l(this,u)},pop:function(u,a){var s=this[u];if(s===void 0&&a!==void 0)s=a;else{if(s===void 0)throw new Error("KeyError");delete this[u]}return s},popitem:function(){var u=f.keys(this);if(!u.length)throw new Error("KeyError");var a=u[0],s=this[a];return delete this[a],[a,s]},setdefault:function(u,a){return a===void 0&&(a=null),u in this||(this[u]=a),this[u]},update:function(u){return f._assign(this,u),null}};return n.iteritems=n.items,n.itervalues=n.values,n.iterkeys=n.keys,E.memberLookup=function(u,a,s){return arguments.length===4?m.apply(this,arguments):(u=u||{},f.isArray(u)&&l(g,a)?g[a].bind(u):f.isObject(u)&&l(n,a)?n[a].bind(u):j.apply(this,arguments))},e}c.exports=p}])})})(Mn);var fi=Mn.exports;const At=Kr(fi);var pi=ge('<label class="absolute right-6 top-1 z-10 inline-flex cursor-pointer items-center gap-2 bg-transparent text-rc-gray-100 focus:outline-none focus:ring-0"><input type="checkbox" class="checkbox svelte-1br1z62"/> <span>Preview</span></label>'),hi=ge('<div class="flex justify-end"><!></div>'),di=ge('<div class="prompt-editor flex h-full flex-col"><div class="relative flex-1"><div class="h-full w-full"></div> <!></div> <!></div>');function bn(P,T){gt(T,!0);let c=Pe(null),S,w=ot(T,"readOnly",3,!1),p=ot(T,"readOnlyMessage",3,""),E=ot(T,"bottomPadding",3,0),f=ot(T,"showPreviewToggle",3,!0),t=ot(T,"preview",3,null),y=!1,O=null,V=null,W=!1,j=null,L=[],I=null,e=null,r=0,i=null;const m=24;let l=Pe(!1);const g=we(()=>t()!==null?t():_(l)),n=we(()=>`editorState/prompt/${T.agentId}/${T.stepName}`),o=we(()=>`editorState/prompt/${T.agentId}/${T.stepName}/preview`),u=we(()=>_(g)?_(o):_(n));function a(B,C){const q=B.getLayoutInfo(),z=Number((q==null?void 0:q.contentWidth)??0);if(!Number.isFinite(z)||z<=0)return 80;const X=B.getOption(C.editor.EditorOption.fontInfo),ye=Number(X==null?void 0:X.typicalHalfwidthCharacterWidth)||Number(X==null?void 0:X.typicalFullwidthCharacterWidth)||7;if(!Number.isFinite(ye)||ye<=0)return 80;const be=Math.floor((z-m)/ye);return Math.max(20,be)}function s(){!_(c)||!V||e==null&&(e=requestAnimationFrame(()=>{if(e=null,!_(c)||!V)return;const B=a(_(c),V);B!==r&&(r=B,_(c).updateOptions({wordWrap:"bounded",wordWrapColumn:B}))}))}function d(){Wt(_(u),_(c))}function h(B,C){const q=Tr(C);if(!q)return;const z=B.getContribution("editor.contrib.folding");if(z!=null&&z.getFoldingModel)z.getFoldingModel().then(()=>{try{B.restoreViewState(q)}catch{}});else try{B.restoreViewState(q)}catch{}}function A(){i!=null&&clearTimeout(i),i=setTimeout(()=>{i=null,d()},180)}Yt(()=>{if(!S)return;In();let B=!1;return Rn(()=>import("../chunks/DLQqXQ6R.js").then(C=>C.e),__vite__mapDeps([0,1,2]),import.meta.url).then(C=>{if(B)return;V=C,Fn(C),L.push(C.languages.registerFoldingRangeProvider("markdown",ti)),L.push(C.languages.registerFoldingRangeProvider("markdown",ni)),L.push(C.languages.registerDocumentHighlightProvider("markdown",ai)),ne(c,C.editor.create(S,{value:"",language:"markdown",theme:"bosun-dark",lineNumbers:"off",fontSize:14,fontFamily:'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',automaticLayout:!0,minimap:{enabled:!1},wordBasedSuggestions:"off",wordWrap:"bounded",wordWrapColumn:120,wrappingStrategy:"advanced",matchBrackets:"never",bracketPairColorization:{enabled:!0},guides:{highlightActiveBracketPair:!1,bracketPairs:!1,bracketPairsHorizontal:!1},selectionHighlight:!1,unicodeHighlight:{ambiguousCharacters:!1,nonBasicASCII:!1,invisibleCharacters:!1,includeStrings:!1,includeComments:!1},autoClosingQuotes:"never",padding:{top:32,bottom:E()},readOnly:w(),readOnlyMessage:p()?{value:p()}:void 0}),!0),j=_(c).getModel(),s(),L.push(_(c).onDidLayoutChange(()=>s())),L.push(_(c).onDidChangeModelDecorations(()=>A())),L.push(_(c).onDidScrollChange(()=>A())),L.push(_(c).onDidChangeCursorPosition(()=>A())),L.push(_(c).onDidBlurEditorText(()=>d())),tt.agents.context.query({agentId:T.agentId}).then(z=>{B||(I==null||I.dispose(),I=Hr(C,z),L.push(I))}),O=Nr(C,_(c));const q=T.initialPrompt??"";if(y=!0,_(c).setValue(q),y=!1,requestAnimationFrame(()=>{O==null||O.update(),_(c)&&h(_(c),_(u))}),L.push(_(c).onDidChangeModelContent(()=>{if(_(c)&&(O==null||O.update(),!y)){A();try{const z=_(c).getValue();T.onPromptChanged(z)}catch(z){console.error("Error updating prompt",z)}}})),W=!0,T.onEditorReady)try{T.onEditorReady(_(c),C)}catch(z){console.error("PromptEditor onEditorReady error",z)}}).catch(C=>{console.error("Error initializing Monaco editor:",C)}),()=>{B=!0,e!=null&&cancelAnimationFrame(e),e=null,i!=null&&clearTimeout(i),i=null,d(),I=null;for(const q of L)try{q.dispose()}catch{}L=[],O==null||O.dispose(),O=null;const C=j;if(j=null,_(c)){try{_(c).setModel(null)}catch{}_(c).dispose(),ne(c,null)}try{C==null||C.dispose()}catch{}}}),Xe(()=>{!_(c)||!W||_(c).updateOptions({readOnly:w(),readOnlyMessage:p()?{value:p()}:void 0,padding:{top:32,bottom:E()}})}),Xe(()=>{const B=T.initialPrompt??"";if(!(!_(c)||!W||_(g)&&!w())&&_(c).getValue()!==B){y=!0;try{_(c).setValue(B),O==null||O.update()}finally{y=!1}}});function M(B,C){return At.configure({autoescape:!1,trimBlocks:!0,lstripBlocks:!0}),At.renderString(B,C||{})}let F="",K=0;function D(B){var C;if(t()!==null){(C=T.onPreviewChange)==null||C.call(T,B);return}ne(l,B,!0)}function b(){if(K+=1,!!_(c)){Wt(_(o),_(c)),y=!0;try{F&&(_(c).setValue(F),F=""),_(c).updateOptions({readOnly:w()})}finally{y=!1}h(_(c),_(n))}}async function x(){if(!_(c)||w())return;Wt(_(n),_(c)),F=_(c).getValue();const B=K+=1;let C=null;try{C=await tt.agents.context.query({agentId:T.agentId})}catch(z){console.error("Failed to load agent context for preview:",z),C=null}if(B!==K||!_(c)||!_(g))return;const q=M(F,C||{});y=!0;try{_(c).setValue(q),_(c).updateOptions({readOnly:!0})}finally{y=!1}h(_(c),_(o))}let N=Pe(!1);Xe(()=>{if(!_(c)||!W)return;const B=!!_(g)&&!w();B!==_(N)&&(ne(N,B,!0),B?x():b())}),bt(P,{get class(){return`relative overflow-hidden ${T.class??""}`},children:(B,C)=>{var q=di(),z=ie(q),X=ie(z);Jt(X,H=>S=H,()=>S);var ye=de(X,2);{var be=H=>{var Y=pi(),Q=ie(Y);Pn(Q),Ke(2),te(Y),je(()=>mr(Q,_(g))),Tt("change",Q,he=>D(he.currentTarget.checked)),ee(H,Y)};Ie(ye,H=>{f()&&!w()&&H(be)})}te(z);var oe=de(z,2);{var ae=H=>{var Y=hi(),Q=ie(Y);Ze(Q,{variant:"secondary",get onclick(){return T.onSchemaClick},class:"absolute bottom-2 right-6 !font-medium",children:(he,Ae)=>{Ke();var Te=Ue("Schema");ee(he,Te)},$$slots:{default:!0}}),te(Y),ee(H,Y)};Ie(oe,H=>{T.showSchemaButton&&T.onSchemaClick&&H(ae)})}te(q),ee(B,q)}}),yt()}Qt(["change"]);var vi=ge("<!> <!>",1),mi=ge('<div class="flex h-full items-center justify-center text-sm text-rc-gray-300">Loading</div>'),En=ge('<pre class="whitespace-pre-wrap font-mono text-xs text-rc-gray-200"> </pre>'),gi=ge('<div class="flex h-full flex-col gap-3"><div class="text-sm text-red-400"> </div></div>'),yi=ge('<div class="text-red-400">Error</div>'),_i=ge('<div class="rounded-md border border-rc-gray-700 bg-rc-gray-900/40 px-3 py-2"><div class="flex items-center justify-between text-xs text-rc-gray-400"><div> </div> <!></div> <div class="whitespace-pre-wrap break-words text-sm text-rc-gray-100"> </div></div>'),xi=ge('<div class="mb-4"><div class="mb-2 text-xs font-semibold text-rc-gray-400">Why this response</div> <div class="flex flex-col gap-2"></div></div>'),wi=ge('<button type="button" class="rounded-md border border-rc-gray-700 bg-rc-gray-900/40 px-3 py-2 text-left hover:border-rc-gray-500"><div class="flex items-center justify-between text-xs text-rc-gray-400"><div> </div> <div> </div></div> <div class="whitespace-pre-wrap break-words text-sm text-rc-gray-100"> </div></button>'),bi=ge('<div class="flex flex-col gap-2"></div>'),Ei=ge('<div class="text-sm text-rc-gray-300">No quotes returned.</div>'),ki=ge('<div class="mb-3 text-sm font-semibold text-rc-gray-100"> </div> <!> <!>',1),Si=ge('<button type="button" class="rounded-md border border-rc-gray-700 bg-rc-gray-900/40 px-3 py-2 text-left hover:border-rc-gray-500"><div class="whitespace-pre-wrap break-words text-sm text-rc-gray-100"> </div></button>'),Oi=ge('<div class="mt-3 flex flex-col gap-2"></div>'),Li=ge('<div class="rounded-md border border-rc-gray-700 bg-rc-gray-900/40 p-3"><div class="flex items-start justify-between gap-3"><div class="text-xs font-semibold text-rc-gray-400"></div> <div class="text-xs text-rc-gray-500"> </div></div> <div class="mt-1 whitespace-pre-wrap break-words text-sm text-rc-gray-100"> </div> <!></div>'),Ti=ge('<div class="flex flex-col gap-3"></div>'),Ai=ge('<div class="text-sm text-rc-gray-300">No issues found.</div>'),Ci=ge('<div class="mb-3 text-sm font-semibold text-rc-gray-100"> </div> <!>',1),Pi=ge('<div class="border-b border-rc-gray-700 px-2 py-1"><!></div> <div class="min-h-0 flex-1 overflow-auto p-3"><!></div>',1);function Ni(P,T){gt(T,!0);const{state:c,actions:S}=Nn();let w=Pe("results"),p=Pe(null);Xe(()=>{var O;const y=((O=c.edit.popover)==null?void 0:O.requestId)??null;y!==_(p)&&(ne(p,y,!0),ne(w,"results"))});var E=Lt(),f=Qe(E);{var t=y=>{const O=we(()=>c.edit.popover);var V=Pi(),W=Qe(V),j=ie(W);Gt(j,{get value(){return _(w)},ariaLabel:"Popover tabs",onChange:({value:m})=>ne(w,m,!0),children:(m,l)=>{var g=vi(),n=Qe(g);dt(n,{value:"results",children:(u,a)=>{Ke();var s=Ue("Results");ee(u,s)},$$slots:{default:!0}});var o=de(n,2);dt(o,{value:"raw",children:(u,a)=>{Ke();var s=Ue("Raw");ee(u,s)},$$slots:{default:!0}}),ee(m,g)},$$slots:{default:!0}}),te(W);var L=de(W,2),I=ie(L);{var e=m=>{var l=mi();ee(m,l)},r=m=>{var l=Lt(),g=Qe(l);{var n=u=>{const a=we(()=>{var h;return typeof((h=_(O).data)==null?void 0:h.raw)=="string"?_(O).data.raw:_(O).error});var s=En(),d=ie(s,!0);te(s),je(()=>Ne(d,_(a)||"—")),ee(u,s)},o=u=>{var a=gi(),s=ie(a),d=ie(s,!0);te(s),te(a),je(()=>Ne(d,_(O).error)),ee(u,a)};Ie(g,u=>{_(w)==="raw"?u(n):u(o,-1)})}ee(m,l)},i=m=>{const l=we(()=>_(O).data);var g=Lt(),n=Qe(g);{var o=s=>{var d=En(),h=ie(d,!0);te(d),je(()=>{var A;return Ne(h,typeof((A=_(l))==null?void 0:A.raw)=="string"?_(l).raw:"—")}),ee(s,d)},u=s=>{const d=we(()=>{var C;return typeof((C=_(l))==null?void 0:C.parallelCalls)=="number"&&Number.isFinite(_(l).parallelCalls)?_(l).parallelCalls:10});var h=ki(),A=Qe(h),M=ie(A,!0);te(A);var F=de(A,2);{var K=C=>{var q=xi(),z=de(ie(q),2);mt(z,23,()=>_(l).rationales,(X,ye)=>X.attempt??ye,(X,ye,be)=>{var oe=_i(),ae=ie(oe),H=ie(ae),Y=ie(H);te(H);var Q=de(H,2);{var he=De=>{var k=yi();ee(De,k)};Ie(Q,De=>{_(ye).status==="error"&&De(he)})}te(ae);var Ae=de(ae,2),Te=ie(Ae,!0);te(Ae),te(oe),je(()=>{Ne(Y,`Analysis ${_(ye).attempt??_(be)+1??""}`),Ne(Te,_(ye).text)}),ee(X,oe)}),te(z),te(q),ee(C,q)},D=we(()=>{var C;return Array.isArray((C=_(l))==null?void 0:C.rationales)&&_(l).rationales.length>0});Ie(F,C=>{_(D)&&C(K)})}var b=de(F,2);{var x=C=>{var q=bi();mt(q,23,()=>_(l).quotes,z=>z.quote,(z,X,ye)=>{var be=wi(),oe=ie(be),ae=ie(oe),H=ie(ae);te(ae);var Y=de(ae,2),Q=ie(Y);te(Y),te(oe);var he=de(oe,2),Ae=ie(he,!0);te(he),te(be),je(()=>{Ne(H,`Quote ${_(ye)+1}`),Ne(Q,`x${_(X).count??""}/${_(d)??""}`),Ne(Ae,_(X).quote)}),Tt("click",be,()=>S.focusQuote(_(X).quote)),ee(z,be)}),te(q),ee(C,q)},N=we(()=>{var C;return Array.isArray((C=_(l))==null?void 0:C.quotes)&&_(l).quotes.length>0}),B=C=>{var q=Ei();ee(C,q)};Ie(b,C=>{_(N)?C(x):C(B,-1)})}je(()=>{var C;return Ne(M,((C=_(l))==null?void 0:C.title)??"Analysis")}),ee(s,h)},a=s=>{var d=Ci(),h=Qe(d),A=ie(h,!0);te(h);var M=de(h,2);{var F=b=>{var x=Ti();mt(x,21,()=>_(l).issues,Ht,(N,B,C)=>{var q=Li(),z=ie(q),X=ie(z);X.textContent=`Issue ${C+1}`;var ye=de(X,2),be=ie(ye,!0);te(ye),te(z);var oe=de(z,2),ae=ie(oe,!0);te(oe);var H=de(oe,2);{var Y=Q=>{var he=Oi();mt(he,20,()=>_(B).contradictingQuotes,Ae=>Ae,(Ae,Te)=>{var De=Si(),k=ie(De),$=ie(k,!0);te(k),te(De),je(()=>Ne($,Te)),Tt("click",De,()=>S.focusQuote(Te)),ee(Ae,De)}),te(he),ee(Q,he)};Ie(H,Q=>{_(B).contradictingQuotes&&_(B).contradictingQuotes.length>0&&Q(Y)})}te(q),je(()=>{Ne(be,_(B).type),Ne(ae,_(B).reason)}),ee(N,q)}),te(x),ee(b,x)},K=we(()=>{var b;return Array.isArray((b=_(l))==null?void 0:b.issues)&&_(l).issues.length>0}),D=b=>{var x=Ai();ee(b,x)};Ie(M,b=>{_(K)?b(F):b(D,-1)})}je(()=>{var b;return Ne(A,((b=_(l))==null?void 0:b.title)??"Prompt issues")}),ee(s,d)};Ie(n,s=>{_(w)==="raw"?s(o):_(O).kind==="analyze"?s(u,1):s(a,-1)})}ee(m,g)};Ie(I,m=>{_(O).status==="loading"?m(e):_(O).status==="error"?m(r,1):m(i,-1)})}te(L),ee(y,V)};Ie(f,y=>{c.edit.popover&&y(t)})}ee(P,E),yt()}Qt(["click"]);var Ri=ge('<div class="min-h-0 flex-1 overflow-hidden p-3"><!></div>');function Ii(P,T){gt(T,!1);const c=Nn(),S=cr(c.state),w=c.actions;function p(t){ur(S,_(S).context=t),w.sendAppEvent({type:"context-updated",context:t})}Fr();var E=Ri(),f=ie(E);{let t=fr(()=>{var y;return`editorState/context/${_(S).agentId}/${((y=_(S).currentStep)==null?void 0:y.name)??"main"}`});Ar(f,{class:"h-full min-h-0 border-thin border-rc-gray-650 shadow-inner-white-soft backdrop-blur-3xl focus:outline-none focus:ring-0",get context(){return _(S).context},onContextChanged:p,get editorStateKey(){return _(t)},suppressErrors:!0})}te(E),ee(P,E),yt()}function Fi(P){try{return decodeURIComponent(P)}catch{return P}}function Kn(P){var p;const c=(((p=String(P||"").split("?")[0])==null?void 0:p.split("#")[0])??"").split("/").filter(Boolean);if(c[0]!=="edit")return{agentId:null,tab:null};if(c.length===1)return{agentId:null,tab:null};const S=Fi(c[1]??""),w=c[2]??null;return w?w==="roleplay"?{agentId:S,tab:"roleplay"}:w==="tests"?{agentId:S,tab:"tests"}:w==="configure"?{agentId:S,tab:"configure"}:{agentId:S,tab:null}:{agentId:S,tab:"roleplay"}}function Bi(P){return{tab:Kn(P.pathname).tab??"roleplay",popover:null,highlights:null,requestSeq:0}}function Mi(P,T){const S=Kn(T.pathname).tab??"roleplay";return{...P,tab:S,popover:null,highlights:null}}function Ki(P,T){const c=P.requestSeq+1;return{...P,requestSeq:c,popover:{kind:T.kind,status:"loading",requestId:c},highlights:null}}function ji(P,T){return!P.popover||P.popover.requestId!==T.requestId?P:{...P,popover:{...P.popover,status:"ready",data:T.data,error:void 0}}}function Di(P,T){return!P.popover||P.popover.requestId!==T.requestId?P:{...P,popover:{...P.popover,status:"error",error:String(T.error||"Unknown error"),data:T.data}}}function $i(P){return{...P,popover:null,highlights:null}}function Vi(P,T){return{...P,highlights:{quotes:T??[],focusQuote:null,focusNonce:0}}}function Ui(P,T){const c=String(T||"");if(!c)return P;const S=P.highlights??{quotes:[],focusQuote:null,focusNonce:0};return{...P,highlights:{...S,focusQuote:c,focusNonce:(S.focusNonce??0)+1}}}function Wi(P,T){const c=String(P??""),S=qi(T),w=On(c);for(const p of S){const E=kn(c,p);if(E.length>0)return E;const f=Sn(c,p);if(f.length>0)return f;const t=On(p);if(w!==c||t!==p){const y=kn(w,t);if(y.length>0)return y;const O=Sn(w,t);if(O.length>0)return O}}return[]}function kn(P,T){const c=String(T??"");if(!c)return[];const S=[];let w=0;for(;w<=P.length-c.length;){const p=P.indexOf(c,w);if(p===-1)break;S.push({start:p,end:p+c.length}),w=p+1}return S}function Sn(P,T){const c=String(T??"");if(!c.trim())return[];const S=Hi(c).replace(/\s+/g,"\\s+");let w;try{w=new RegExp(`(?=(${S}))`,"gu")}catch{return[]}const p=[];let E;for(;(E=w.exec(P))!==null;){const f=E.index,t=E[1]??"",y=f+t.length;y>f&&p.push({start:f,end:y}),w.lastIndex===f&&(w.lastIndex+=1)}return p}function qi(P){const T=String(P??""),c=T.trim(),S=new Set;for(const E of[T,c])E&&S.add(E);const w=c.replace(/^[-*•]\s+/,"");w&&w!==c&&S.add(w);const p=c.replace(/^(?:\(?\d+\)?[.)]|[a-zA-Z][.)])\s+/,"");return p&&p!==c&&S.add(p),[...S].filter(E=>E.trim().length>0)}function On(P){return String(P??"").replace(/\r/g,`
|
|
35
|
-
`).replace(/[\u00A0\u2007\u202F\u2009\u200A\u200B\uFEFF]/g," ").replace(/[\u201C\u201D\u201E\u00AB\u00BB]/g,'"').replace(/[\u2018\u2019]/g,"'").replace(/[\u2013\u2014]/g,"-")}function Hi(P){return P.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ln(P,T){const c=P.createDecorationsCollection(),S=P.createDecorationsCollection();let w=null,p=new Map,E=new Map,f=0;function t(){p=new Map,E=new Map,f=0}function y(e,r,i){return Number.isNaN(e)?r:Math.max(r,Math.min(i,e))}function O(e){const r=y(e,1,10);return`rgba(220, 38, 38, ${y(.22+r*.06,.28,.82)})`}function V(e,r){const i=String(e??"");if(!i)return[];const m=p.get(i);if(m)return m;const l=Wi(r,i);return p.set(i,l),l}function W(e){const r=P.getModel();if(!r)return;const i=r.getValue()??"",m=[],l=[...e||[]].sort((g,n)=>(g.count||0)-(n.count||0));for(const g of l){const n=String(g.quote||"");if(!n)continue;const o=y(Number(g.count||0),1,10),u=O(o),a=V(n,i);for(const s of a){const d=r.getPositionAt(s.start),h=r.getPositionAt(s.end);m.push({range:new T.Range(d.lineNumber,d.column,h.lineNumber,h.column),options:{inlineClassName:`analysis-quote analysis-quote-l${o}`,overviewRuler:{color:u,position:T.editor.OverviewRulerLane.Center}}})}}c.set(m)}function j(e){const r=P.getModel();if(!r)return;const i=r.getValue()??"",m=V(e,i);if(m.length===0)return;const g=((E.get(e)??-1)+1)%m.length;E.set(e,g);const n=m[g],o=r.getPositionAt(n.start),u=r.getPositionAt(n.end),a=new T.Range(o.lineNumber,o.column,u.lineNumber,u.column);S.set([{range:a,options:{inlineClassName:"analysis-quote-focus"}}]),P.setSelection(a),P.revealRangeInCenter(a,T.editor.ScrollType.Smooth),P.focus()}function L(e){if(w=e,!w){c.clear(),S.clear(),t();return}W(w.quotes||[]),w.focusQuote&&w.focusNonce!==f?(f=w.focusNonce,j(w.focusQuote)):w.focusQuote||S.clear()}const I=P.onDidChangeModelContent(()=>{w&&(p=new Map,S.clear(),W(w.quotes||[]))});return{setHighlights:L,dispose:()=>{try{I.dispose(),c.clear(),S.clear()}finally{w=null,t()}}}}var Tn=ge("<!> <!>",1),Gi=ge('<span class="truncate"> </span> <!>',1),zi=ge('<div class="mt-1 overflow-hidden rounded-lg border border-rc-gray-110 bg-rc-gray-930 shadow-inner-white-soft backdrop-blur-2xl" role="listbox" aria-label="Region"></div>'),Qi=ge('<span class="text-sm text-rc-gray-300">Region</span> <div><!> <!></div>',1),Yi=ge('<div class="p-2 text-rc-gray-400">Connecting…</div>'),Ji=ge('<div class="p-2 text-rc-gray-400">No steps</div>'),Xi=ge('<button><span class="block truncate"> </span></button>'),Zi=ge('<div class="rc-scroll min-h-0 flex-1 overflow-auto p-2"><!></div>'),eo=ge('<span class="max-w-64 text-sm text-red-300"> </span>'),to=ge('<div class="absolute inset-0 z-10 min-w-0"><!> <div class="absolute bottom-2 left-3 z-20 flex items-center gap-2"><!> <!> <!></div> <!></div>'),no=ge('<div class="relative h-full min-w-0"><!> <!></div>'),An=ge("<!> <!> <!>",1),ro=ge('<div class="border-b border-rc-gray-700 p-2"><!></div> <div class="min-h-0 flex-1"><!></div> <!> <!>',1),io=ge('<div class="text-sm text-red-300"> </div>'),oo=ge('<div class="flex flex-col gap-2"><label for="ai-edit-request" class="font-semibold text-rc-gray-100">What do you want to change?</label> <!> <!></div>'),so=ge('<div class="min-w-0 truncate whitespace-nowrap text-base text-rc-gray-300"> </div>'),ao=ge('<p class="text-rc-gray-200">Try changing your request and suggest edits again.</p>'),lo=ge('<span class="text-rc-red-500 mr-auto text-sm"> </span>'),co=ge('<span class="mr-auto text-sm text-rc-gray-300"> </span>'),uo=ge('<div class="flex h-screen"><!> <div class="flex h-full min-w-0 flex-1 flex-col bg-rc-gray-980 pb-3 pr-4 pt-2"><nav class="flex flex-none items-center bg-rc-gray-980"><div class="flex w-1/3 justify-start"></div> <div class="flex w-1/3 justify-center"><!></div> <div class="flex w-1/3 items-center justify-end gap-2 pr-2"><!></div></nav> <div class="flex-1 overflow-hidden"><div class="grid h-full w-full grid-cols-[minmax(140px,2fr)_minmax(0,10fr)_minmax(0,11fr)]"><!> <div class="flex h-full min-w-0 flex-col"><div class="flex h-14 flex-none items-center justify-between gap-3 border-b border-rc-gray-700 p-2"><div class="min-w-0"><div class="truncate font-semibold text-rc-gray-100"> </div></div> <div class="flex items-center gap-3"><label class="inline-flex items-center gap-2 text-rc-gray-300"><input type="checkbox" aria-label="Preview rendered prompt" class="h-4 w-4 appearance-none rounded border border-rc-gray-300 bg-rc-gray-600 !accent-rc-gray-600 outline-none ring-0 checked:border-rc-gray-200 checked:bg-rc-gray-600 hover:border-rc-gray-200 hover:bg-rc-gray-600 focus:outline-none focus:ring-0 active:border-rc-gray-200 active:bg-rc-gray-600 disabled:cursor-not-allowed disabled:opacity-50"/> <span>Preview</span></label> <!> <!></div></div> <div class="min-h-0 flex-1"><!></div></div> <!></div></div></div></div> <!> <!> <!>',1);function Uo(P,T){gt(T,!0);const{onError:c}=Ir();let S=Pe(vn([]));const w=v=>{try{return v?decodeURIComponent(v):""}catch{return v||""}},p=v=>encodeURIComponent(v);function E(v){return w(v).trim().replace(/^\/+|\/+$/g,"")}const f=we(()=>E(T.params.agent)),t=vn({agentId:E(T.params.agent),region:null,availableRegions:[],defaultRegion:null,agentType:void 0,wsLoaded:!1,chatReady:!1,steps:[],currentStep:null,promptDrafts:{},promptEdits:{},context:null,promptContext:null,agentStates:[],currentState:null,contextPopoverOpen:!1,edit:Bi({pathname:et.url.pathname})});let y=null,O=null,V;const W="region-dropdown";let j=Pe(!1),L=Pe(null);Xe(()=>{const v=t.availableRegions,R=t.region;(!v.length||!R||!v.includes(R))&&ne(j,!1)});function I(v,R){if(typeof window>"u")return;const U=new URL(window.location.href);R===null?U.searchParams.delete(v):U.searchParams.set(v,R),Cr(U.toString(),{})}function e(v){ht.sendMessage({channel:"app-events",event:v})}function r(v){v!=null&&v.name&&t.promptDrafts[v.name]===void 0&&(t.promptDrafts[v.name]=v.prompt??"")}const i=we(()=>{var v;return((v=t.currentStep)==null?void 0:v.name)??null}),m=(v,R)=>`${v}\0${R}`,l=we(()=>{const v=_(i);return v?t.promptEdits[m(t.agentId,v)]??null:null}),g=we(()=>{const v=_(i);if(!v)return"";const R=t.promptDrafts[v];return typeof R=="string"?R:""}),n=we(()=>{var v;return((v=_(l))==null?void 0:v.suggestedPrompt)??_(g)});function o(v=t.agentId){const R={};for(const U of Object.values(t.promptEdits))U.agentId===v&&(R[U.step]=U.suggestedPrompt);return R}function u(){t.wsLoaded&&e({type:"prompt-overrides-updated",prompts:o()})}function a(v,R){return R?t.promptEdits[m(v,R)]??null:null}let s=null,d=null,h=Promise.resolve();const A=800;function M(){s&&(clearTimeout(s),s=null)}async function F(v,R,U){try{await tt.agents.savePrompt.mutate({agentId:v,step:R,prompt:U})}catch(G){console.error("Failed to save prompt",G);const re=t.promptDrafts[R];throw t.agentId===v&&re===U&&(d={stepName:R,prompt:U}),G}}function K(v,R,U){const G=h.catch(()=>{}).then(()=>F(v,R,U));return h=G.catch(()=>{}),G}async function D(){if(!d)return;const v=t.agentId.trim();if(!v)return;const{stepName:R,prompt:U}=d;M(),d=null,await K(v,R,U)}function b(v,R){d={stepName:v,prompt:R},M(),s=setTimeout(()=>{s=null,D()},A)}Xe(()=>{t.wsLoaded&&D()});async function x(v){try{const R=await tt.regionConfig.meta.query({agent:v});if(!R){t.availableRegions=[],t.defaultRegion=null,t.region=null,I("region",null);return}if(t.availableRegions=R.availableRegions,t.defaultRegion=R.defaultRegion??null,!Array.isArray(R.availableRegions)||R.availableRegions.length===0){t.region=null,I("region",null);return}const U=(et.url.searchParams.get("region")||"").trim()||null,G=U&&R.availableRegions.includes(U)&&U||R.defaultRegion&&R.availableRegions.includes(R.defaultRegion)&&R.defaultRegion||R.availableRegions[0]||null;t.region=G,I("region",G)}catch(R){console.error("Failed to load region config meta",R),t.availableRegions=[],t.defaultRegion=null,t.region=null,I("region",null)}}Xe(()=>{const v=_(f);v&&v!==O&&(O=v,x(v))});function N(v){var U;D(),$e();const R=t.steps.find(G=>G.name===v)||null;t.currentStep=R,R?(r(R),I("step",R.name),e({type:"step-selected",step:R.name}),I("promptEdit",((U=a(t.agentId,R.name))==null?void 0:U.id)??null)):I("step",null)}function B(v){const R=_(i);R&&(t.promptDrafts[R]=v,b(R,v))}let C=Pe(!1),q=Pe(""),z=Pe(!1),X=Pe(null);function ye(v){return(v||"").replace(/[*_`]/g,"").replace(/(^|\s)#{1,6}\s+/g," ").replace(/\s+/g," ").trim()||"Thinking..."}const be=we(()=>{var v;return ye((v=_(X))==null?void 0:v.summary)});let oe=Pe(null),ae=Pe(null),H=Pe(!1),Y=Pe(!1),Q=0,he=!1;const Ae=new Set;Xe(()=>{const v=_(C);he&&!v&&_(z)&&(Q+=1,ne(z,!1)),he=v});function Te(v=""){!t.currentStep||_(l)||(ne(q,v,!0),ne(oe,null),ne(Y,!1),ne(C,!0))}function De(){Q+=1,ne(z,!1),ne(C,!1),ne(Y,!1)}async function k(v,R){for(;R===Q&&_(z);){try{const U=await tt.agents.promptEditProgress.query({id:v});if(R!==Q||!_(z))return;U&&ne(X,{phase:U.phase,activity:U.activity,summary:U.summary},!0)}catch(U){R===Q&&console.warn("Failed to read prompt edit progress",U)}await new Promise(U=>setTimeout(U,400))}}async function $(){const v=_(q).trim(),R=_(i),U=t.agentId.trim();if(!v||!R||!U||_(z))return;const G=++Q,re=crypto.randomUUID();ne(z,!0),ne(X,null),ne(oe,null),k(re,G);try{await D();const le=await tt.agents.suggestPromptEdit.mutate({agentId:U,step:R,request:v,progressId:re});if(G!==Q)return;if(le.status==="unchanged"){ne(Y,!0);return}const me=le.proposal;t.promptEdits[m(me.agentId,me.step)]=me,I("promptEdit",me.id),ne(C,!1),ne(ft,!1),u()}catch(le){if(G!==Q)return;console.error("Failed to suggest prompt edits",le),ne(oe,le instanceof Error?le.message:"Failed to suggest edits",!0)}finally{G===Q&&(ne(z,!1),ne(X,null))}}function Z(v){for(const[R,U]of Object.entries(t.promptEdits))U.id===v&&delete t.promptEdits[R];et.url.searchParams.get("promptEdit")===v&&I("promptEdit",null)}function J(){const v=_(l);!v||_(H)||(_e(),ne(ae,null),Z(v.id),u(),tt.agents.rejectPromptEdit.mutate({id:v.id}).catch(R=>{console.error("Failed to release rejected prompt edit",R)}))}async function pe(){var le;const v=_(l);if(!v||_(H))return;const R=ct??Rt,U=(R==null?void 0:R.saveViewState())??null,G=((le=R==null?void 0:R.getVisibleRanges()[0])==null?void 0:le.startLineNumber)??null,re=G&&R?R.getTopForLineNumber(G)-R.getScrollTop():0;_e(),ne(H,!0),ne(ae,null);try{const me=await tt.agents.acceptPromptEdit.mutate({id:v.id});if(t.promptDrafts[v.step]=me.prompt,t.steps=t.steps.map(fe=>fe.name===v.step?{...fe,prompt:me.prompt}:fe),t.currentStep=t.steps.find(fe=>fe.name===_(i))??t.currentStep,await mn(),Z(v.id),u(),await mn(),U&&ut){const fe=ut;requestAnimationFrame(()=>{if(ut===fe)try{fe.restoreViewState(U),G&&fe.setScrollTop(fe.getTopForLineNumber(G)-re)}catch(Se){console.warn("Failed to preserve accepted prompt scroll position",Se)}})}}catch(me){console.error("Failed to accept prompt edit",me),ne(ae,me instanceof Error?me.message:"Failed to save prompt",!0)}finally{ne(H,!1)}}Xe(()=>{const v=(et.url.searchParams.get("promptEdit")||"").trim();!v||Ae.has(v)||(Ae.add(v),tt.agents.promptEditProposal.query({id:v}).then(R=>{!R||R.agentId!==t.agentId||(t.promptEdits[m(R.agentId,R.step)]=R,u())}).catch(R=>console.error("Failed to restore prompt edit",R)))});const ue=we(()=>{var v;return((v=t.currentStep)==null?void 0:v.schema)??null}),Oe=we(()=>!!_(ue)&&_(ue).trim().length>0);let ve=Pe(!1),ke=Pe(""),We=Pe(!1),qe=Pe(null),Ye=Pe(null);const _t=we(()=>_(ke)!==(_(ue)??""));function Et(){_(ue)&&(ne(ke,_(ue),!0),ne(qe,null),ne(Ye,null),ne(ve,!0))}function Ct(v){ne(ke,v,!0),ne(qe,null),ne(Ye,null)}async function Pt(){var U;const v=(U=t.currentStep)==null?void 0:U.name,R=t.agentId.trim();if(!(!v||!R||!_(_t)||_(We))){ne(We,!0),ne(qe,null),ne(Ye,null);try{await D();const G=await tt.agents.saveSchema.mutate({agentId:R,step:v,schema:_(ke)});t.steps=t.steps.map(re=>re.name===v?{...re,schema:_(ke)}:re),t.currentStep=t.steps.find(re=>re.name===v)??t.currentStep,ne(Ye,G.restartScheduled?"Saved. Reloading the project…":"Saved. Restart Bosun to use this schema in tests.",!0),G.restartScheduled&&setTimeout(()=>window.location.reload(),1200)}catch(G){console.error("Failed to save schema",G),ne(qe,G instanceof Error?G.message:"Failed to save schema",!0)}finally{ne(We,!1)}}}function xt({value:v}){if(v===t.edit.tab)return;D(),$e();const R=et.url.searchParams.get("step"),U=et.url.searchParams.get("region"),G=`/edit/${p(t.agentId)}/${v}`,re=new URLSearchParams;R&&re.set("step",R),U&&re.set("region",U),_(l)&&re.set("promptEdit",_(l).id);const le=re.size?`${G}?${re.toString()}`:G;wt(le)}const kt=we(()=>{const v=et.url.pathname.split("/")[1];return v==="traces"?"view":v});function st({value:v}){if(v!==_(kt)){if(D(),$e(),v==="edit")return wt("/edit");if(v==="view"){const R=new URLSearchParams({agent:t.agentId});return t.region&&R.set("region",t.region),wt(`/view?${R.toString()}`)}wt("/"+v)}}function at(v){var R;return t.contextPopoverOpen=!1,t.edit=Ki(t.edit,{kind:v}),((R=t.edit.popover)==null?void 0:R.requestId)??0}function se(v,R){t.edit=ji(t.edit,{requestId:v,data:R})}function ce(v,R,U){t.edit=Di(t.edit,{requestId:v,error:R,data:U})}function _e(){t.edit=$i(t.edit)}function xe(){_e(),t.contextPopoverOpen=!0}function Ee(){t.contextPopoverOpen=!1}function Fe(){t.contextPopoverOpen?Ee():xe()}function $e(){_e(),Ee()}function it(v){return v==="analyze"?"Analyze":"Find issues"}function lt(v){t.edit=Vi(t.edit,v)}function Nt(v){t.edit=Ui(t.edit,v)}let Ge=null,He=null,ut=null,ct=null,Rt=null,ft=Pe(!1),Xt=null;function Zt(v){try{return At.configure({autoescape:!1,trimBlocks:!0,lstripBlocks:!0}),At.renderString(v,t.promptContext??t.context??{})}catch(R){return console.error("Failed to render prompt preview",R),v}}const jn=we(()=>{const v=_(l);return v?_(ft)?Zt(v.originalPrompt):v.originalPrompt:""}),Dn=we(()=>{const v=_(l);return v?_(ft)?Zt(v.suggestedPrompt):v.suggestedPrompt:""});Xe(()=>{var R;const v=((R=t.currentStep)==null?void 0:R.name)??null;v!==Xt&&(Xt=v,ne(ft,!1))});function $n(v,R){ut=v,Ge==null||Ge.dispose(),Ge=Ln(v,R),Ge.setHighlights(t.edit.highlights)}function Vn(v,R){ct=v,He==null||He.dispose(),He=Ln(v,R),He.setHighlights(t.edit.highlights)}Xe(()=>{const v=t.edit.highlights;!!_(l)&&!!t.edit.popover?He==null||He.setHighlights(v):Ge==null||Ge.setHighlights(v)}),Xe(()=>{_(l)&&t.edit.popover||(He==null||He.dispose(),He=null,ct=null)});let en=Pe("");Xe(()=>{const v=et.url.toString();v!==_(en)&&(ne(en,v,!0),t.edit=Mi(t.edit,{pathname:et.url.pathname}),t.contextPopoverOpen=!1)});function Un(v,R,U){return Math.max(R,Math.min(U,v))}function Wn(v){const R=new Map;for(const U of v||[])for(const G of U.contradictingQuotes||[]){const re=String(G||"").trim();re&&R.set(re,(R.get(re)||0)+1)}return[...R.entries()].map(([U,G])=>({quote:U,count:Un(G,1,10)})).sort((U,G)=>G.count-U.count||U.quote.localeCompare(G.quote))}let St=Pe(!1);async function qn(){var R;if(_(St)||!t.currentStep)return;ne(St,!0);const v=at("findIssues");try{const U=await tt.tests.findPromptIssues.mutate({agent:t.agentId,step:t.currentStep.name,prompt:_(n)}),G=Wn(U.issues||[]);if(((R=t.edit.popover)==null?void 0:R.requestId)!==v)return;lt(G);let re=null;try{re=JSON.stringify(U.raw,null,2)}catch{re=null}se(v,{title:`Prompt issues — ${t.currentStep.name}`,issues:U.issues,raw:re})}catch(U){console.error(U);const G=typeof(U==null?void 0:U.message)=="string"?U.message:(()=>{try{return JSON.stringify(U)}catch{return String(U)}})();ce(v,G||"Failed to find issues in this prompt",{title:`Prompt issues failed — ${t.currentStep.name}`,raw:G})}finally{ne(St,!1)}}function Hn(v){D(),$e();const R=et.url.searchParams.get("step"),U=et.url.searchParams.get("region"),G=`/edit/${p(v)}/${t.edit.tab}`,re=new URLSearchParams;R&&re.set("step",R),U&&re.set("region",U);const le=a(v,R);le&&re.set("promptEdit",le.id);const me=re.size?`${G}?${re.toString()}`:G;wt(me)}function Gn(v){!v||v===t.region||(D(),t.region=v,I("region",v))}wr({state:t,actions:{openPopover:at,setPopoverReady:se,setPopoverError:ce,closePopover:_e,setHighlightQuotes:lt,focusQuote:Nt,openContextPopover:xe,closeContextPopover:Ee,toggleContextPopover:Fe,openAiEdit:v=>Te(v),sendAppEvent:e,sendChatMessage:v=>{if(!t.wsLoaded||!t.chatReady){console.warn("[roleplay] Ignoring chat message while websocket session is reconnecting");return}u(),ht.sendMessage({channel:"chat",message:v})},flushPromptSave:D,getPromptOverrides:()=>o(),getActivePromptEditId:()=>{var v;return((v=_(l))==null?void 0:v.id)??null},selectState:v=>{D(),$e(),V=v,t.currentState=v,gn(),_n(),e({type:"select-agent",agent:t.agentId,state:v,region:t.region,promptOverrides:o()})},hangup(){e({type:"hangup",agentId:t.agentId,region:t.region})}}}),Yt(async()=>{try{ne(S,await tt.agents.catalog.query(),!0)}catch(v){console.error("Failed to load agents",v)}ht.onClose(()=>{t.wsLoaded=!1,t.chatReady=!1,t.context=null,t.promptContext=null,t.agentStates=[],t.currentState=null,t.contextPopoverOpen=!1,y=null}),ht.onError(v=>c(v)),ht.onMessage(v=>{if(v.channel==="app-events"){if(v.event.type==="agents-loaded"){t.wsLoaded=!0;return}if(v.event.type==="context-updated"){t.context=v.event.context,v.event.promptContext&&(t.promptContext=v.event.promptContext);return}if(v.event.type==="update-states"){const R=t.agentStates.length;t.agentStates=v.event.states;const U=t.agentStates.length>0?t.agentStates[t.agentStates.length-1].id:null;V!==void 0?t.currentState=V:(t.currentState===null&&R===0&&U||t.agentStates.length>R)&&(t.currentState=U),V=void 0;return}if(v.event.type==="agent-selected"){t.steps=v.event.agent.steps,t.agentType=v.event.agent.type;const R={};for(const me of t.steps){const fe=t.promptDrafts[me.name];R[me.name]=typeof fe=="string"?fe:me.prompt??""}t.promptDrafts=R;const U=(et.url.searchParams.get("step")||"").trim()||null,G=U?t.steps.find(me=>me.name===U)??null:null,re=t.steps.find(me=>me.name.toLowerCase()==="main")??t.steps.find(me=>Pr(me.name))??t.steps[0]??null,le=G??re;t.currentStep=le,le?(r(le),le.name!==U&&I("step",le.name),e({type:"step-selected",step:le.name}),D()):I("step",null);return}return}if(v.channel==="log"){Br(v.message);return}if(v.channel==="step-trace"){br(v.trace);return}if(v.channel==="api-call-trace"){Er(v.trace);return}if(v.channel==="conversational-trace"){kr(v.trace);return}if(v.channel==="error"){c(v.message);return}}),ht.init(),t.wsLoaded=ht.isReady()}),Cn(()=>{D(),M(),Ge==null||Ge.dispose(),Ge=null,ut=null,He==null||He.dispose(),He=null,ct=null,Rt=null}),Xe(()=>{const v=_(f);if(v!==t.agentId&&(D(),d=null,M(),t.chatReady=!1,t.promptDrafts={},t.steps=[],t.currentStep=null),t.agentId=v,!t.wsLoaded){t.chatReady=!1;return}if(!t.agentId){t.chatReady=!1;return}if(t.availableRegions.length>0&&!t.region){t.chatReady=!1;return}const R=`${t.agentId}::${t.region??""}`;y!==R&&(y=R,gn(),_n(),$e(),t.currentState=null,t.agentStates=[],t.context=null,t.promptContext=null,D(),V=void 0,t.chatReady=!1,e({type:"select-agent",agent:t.agentId,region:t.region,promptOverrides:o()}),t.chatReady=!0)});var tn=uo(),It=Qe(tn),nn=ie(It);Rr(nn,{className:"flex-none",get agents(){return _(S)},get currentAgent(){return t.agentId},onAgentClick:Hn});var rn=de(nn,2),Ft=ie(rn),Bt=de(ie(Ft),2),zn=ie(Bt);Gt(zn,{get value(){return _(kt)},ariaLabel:"Top tabs",onChange:st,children:(v,R)=>{var U=Tn(),G=Qe(U);dt(G,{value:"edit",children:(le,me)=>{Ke();var fe=Ue("Edit");ee(le,fe)},$$slots:{default:!0}});var re=de(G,2);dt(re,{value:"view",children:(le,me)=>{Ke();var fe=Ue("View");ee(le,fe)},$$slots:{default:!0}}),ee(v,U)},$$slots:{default:!0}}),te(Bt);var on=de(Bt,2),Qn=ie(on);{var Yn=v=>{var R=Qi(),U=de(Qe(R),2),G=ie(U);Ze(G,{variant:"secondary",size:"small",get"aria-expanded"(){return _(j)},"aria-haspopup":"listbox","aria-controls":W,onclick:le=>{le.stopPropagation(),ne(j,!_(j))},class:"flex w-32 items-center justify-between gap-1 !px-3 !py-1",get el(){return _(L)},set el(le){ne(L,le,!0)},children:(le,me)=>{var fe=Gi(),Se=Qe(fe),Be=ie(Se,!0);te(Se);var Ce=de(Se,2);{let Le=we(()=>"size-5 text-rc-gray-400 transition-transform duration-200 "+(_(j)?"rotate-180":""));Or(Ce,{name:"chevron-down",get class(){return _(Le)}})}je(()=>Ne(Be,t.region)),ee(le,fe)},$$slots:{default:!0}});var re=de(G,2);Sr(re,{id:W,get open(){return _(j)},onClose:()=>ne(j,!1),get anchorEl(){return _(L)},placement:"bottom-end",offset:[0,1],children:me=>{var fe=zi();mt(fe,21,()=>t.availableRegions,Ht,(Se,Be)=>{{let Ce=we(()=>_(Be)===t.region),Le=we(()=>`w-full rounded-none py-2 pr-3 text-left backdrop-blur-2xl hover:bg-rc-gray-700 focus:bg-rc-gray-400 ${_(Be)===t.region?"bg-rc-gray-800 text-rc-gray-100":"text-rc-gray-200"}`);Ze(Se,{variant:"ghost",size:"small",role:"option",get"aria-selected"(){return _(Ce)},onclick:Re=>{Re.stopPropagation(),ne(j,!1),Gn(_(Be))},get class(){return _(Le)},children:(Re,Je)=>{Ke();var nt=Ue();je(()=>Ne(nt,_(Be))),ee(Re,nt)},$$slots:{default:!0}})}}),te(fe),ee(me,fe)},$$slots:{default:!0}}),te(U),ee(v,R)};Ie(Qn,v=>{t.availableRegions.length>0&&t.region&&v(Yn)})}te(on),te(Ft);var sn=de(Ft,2),an=ie(sn),ln=ie(an);bt(ln,{class:"flex h-full min-w-0 flex-col !rounded-none p-0",children:(v,R)=>{var U=Zi(),G=ie(U);{var re=fe=>{var Se=Yi();ee(fe,Se)},le=fe=>{var Se=Ji();ee(fe,Se)},me=fe=>{var Se=Lt(),Be=Qe(Se);mt(Be,17,()=>t.steps,Ht,(Ce,Le)=>{var Re=Xi(),Je=ie(Re),nt=ie(Je,!0);te(Je),te(Re),je(()=>{var pt;yr(Re,1,`my-1 w-full rounded-lg px-3 py-2 text-left text-rc-gray-200 hover:bg-rc-gray-700 ${_(Le).name===((pt=t.currentStep)==null?void 0:pt.name)?"bg-rc-gray-600":"bg-transparent"}`),Ne(nt,_(Le).name)}),Tt("click",Re,()=>N(_(Le).name)),ee(Ce,Re)}),ee(fe,Se)};Ie(G,fe=>{t.wsLoaded?t.steps.length===0?fe(le,1):fe(me,-1):fe(re)})}te(U),ee(v,U)}});var Mt=de(ln,2),Kt=ie(Mt),jt=ie(Kt),cn=ie(jt),Jn=ie(cn,!0);te(cn),te(jt);var un=de(jt,2),Dt=ie(un),$t=ie(Dt);Pn($t),Ke(2),te(Dt);var fn=de(Dt,2);{let v=we(()=>!t.currentStep||_(St));Ze(fn,{variant:"secondary",get disabled(){return _(v)},onclick:qn,children:(R,U)=>{Ke();var G=Ue("Find issues");ee(R,G)},$$slots:{default:!0}})}var Xn=de(fn,2);{let v=we(()=>!t.currentStep||!!_(l)||_(z));Ze(Xn,{variant:"secondary",get disabled(){return _(v)},onclick:()=>Te(),children:(R,U)=>{Ke();var G=Ue("Edit with AI");ee(R,G)},$$slots:{default:!0}})}te(un),te(Kt);var pn=de(Kt,2),Zn=ie(pn);{var er=v=>{var R=no(),U=ie(R);pr(U,()=>t.currentStep.name,le=>{{let me=we(()=>_(Oe)&&!_(l)),fe=we(()=>!!_(l)),Se=we(()=>_(l)?"Accept or reject the AI suggestion before editing.":""),Be=we(()=>_(l)?!1:_(ft));bn(le,{class:"h-full min-w-0 border-thin border-rc-gray-650 bg-rc-gray-800 shadow-inner-white-soft backdrop-blur-3xl focus:outline-none focus:ring-0",get initialPrompt(){return _(g)},get agentId(){return t.agentId},get stepName(){return t.currentStep.name},onPromptChanged:B,get showSchemaButton(){return _(me)},onSchemaClick:Et,get readOnly(){return _(fe)},get readOnlyMessage(){return _(Se)},showPreviewToggle:!1,get preview(){return _(Be)},onEditorReady:$n})}});var G=de(U,2);{var re=le=>{var me=to(),fe=ie(me);{var Se=Ve=>{bn(Ve,{class:"h-full min-w-0 border-thin border-rc-gray-650 bg-rc-gray-800 shadow-inner-white-soft backdrop-blur-3xl focus:outline-none focus:ring-0",get initialPrompt(){return _(l).suggestedPrompt},get agentId(){return t.agentId},get stepName(){return t.currentStep.name},onPromptChanged:()=>{},showSchemaButton:!1,readOnly:!0,readOnlyMessage:"Accept or reject the AI suggestion before editing.",bottomPadding:56,showPreviewToggle:!1,onEditorReady:Vn})},Be=Ve=>{hr(Ve,{class:"h-full min-w-0 !rounded-none",get original(){return _(jn)},get modified(){return _(Dn)},inline:!0,bottomPadding:56,readOnlyMessage:"Accept or reject the AI suggestion before editing.",onModifiedEditorReady:ze=>Rt=ze})};Ie(fe,Ve=>{t.edit.popover?Ve(Se):Ve(Be,-1)})}var Ce=de(fe,2),Le=ie(Ce);Ze(Le,{variant:"secondary",get disabled(){return _(H)},onclick:J,children:(Ve,ze)=>{Ke();var rt=Ue("✕ Reject");ee(Ve,rt)},$$slots:{default:!0}});var Re=de(Le,2);Ze(Re,{get disabled(){return _(H)},onclick:pe,children:(Ve,ze)=>{Ke();var rt=Ue("✓ Accept");ee(Ve,rt)},$$slots:{default:!0}});var Je=de(Re,2);{var nt=Ve=>{var ze=eo(),rt=ie(ze,!0);te(ze),je(()=>Ne(rt,_(ae))),ee(Ve,ze)};Ie(Je,Ve=>{_(ae)&&Ve(nt)})}te(Ce);var pt=de(Ce,2);{var Vt=Ve=>{Ze(Ve,{variant:"secondary",onclick:Et,class:"absolute bottom-2 right-6 z-20 !font-medium",children:(ze,rt)=>{Ke();var vt=Ue("Schema");ee(ze,vt)},$$slots:{default:!0}})};Ie(pt,Ve=>{_(Oe)&&Ve(Vt)})}te(me),ee(le,me)};Ie(G,le=>{_(l)&&le(re)})}te(R),ee(v,R)},tr=v=>{bt(v,{class:"flex h-full min-w-0 items-center justify-center !rounded-none p-4 text-sm text-rc-gray-400",children:(R,U)=>{Ke();var G=Ue("Select a step to edit its prompt");ee(R,G)}})};Ie(Zn,v=>{t.currentStep?v(er):v(tr,-1)})}te(pn),te(Mt);var nr=de(Mt,2);bt(nr,{class:"relative flex h-full min-w-0 flex-col overflow-hidden !rounded-none p-0",children:(v,R)=>{var U=ro(),G=Qe(U),re=ie(G);Gt(re,{get value(){return t.edit.tab},ariaLabel:"Mode tabs",onChange:xt,children:(Le,Re)=>{var Je=An(),nt=Qe(Je);dt(nt,{value:"roleplay",children:(ze,rt)=>{Ke();var vt=Ue("Roleplay");ee(ze,vt)},$$slots:{default:!0}});var pt=de(nt,2);dt(pt,{value:"tests",children:(ze,rt)=>{Ke();var vt=Ue("Tests");ee(ze,vt)},$$slots:{default:!0}});var Vt=de(pt,2);{var Ve=ze=>{dt(ze,{value:"configure",children:(rt,vt)=>{Ke();var or=Ue("Configure");ee(rt,or)},$$slots:{default:!0}})};Ie(Vt,ze=>{t.defaultRegion!==null&&ze(Ve)})}ee(Le,Je)},$$slots:{default:!0}}),te(G);var le=de(G,2),me=ie(le);dr(me,()=>T.children),te(le);var fe=de(le,2);{var Se=Le=>{{const Re=nt=>{Ni(nt,{})};let Je=we(()=>it(t.edit.popover.kind));yn(Le,{get title(){return _(Je)},onClose:_e,children:Re})}};Ie(fe,Le=>{t.edit.popover&&Le(Se)})}var Be=de(fe,2);{var Ce=Le=>{yn(Le,{title:"Edit context",onClose:Ee,children:Je=>{Ii(Je,{})}})};Ie(Be,Le=>{t.contextPopoverOpen&&Le(Ce)})}ee(v,U)}}),te(an),te(sn),te(rn),te(It);var hn=de(It,2);Ut(hn,{title:"Edit with AI",class:"!max-w-xl",get underlayOpen(){return _(z)},get open(){return _(C)},set open(G){ne(C,G,!0)},children:G=>{var re=oo(),le=de(ie(re),2);$r(le,{id:"ai-edit-request",rows:6,get disabled(){return _(z)},placeholder:"I want the agent to ask the user's name during the greeting",class:"rc-scroll disabled:cursor-wait disabled:opacity-70",get value(){return _(q)},set value(Se){ne(q,Se,!0)}});var me=de(le,2);{var fe=Se=>{var Be=io(),Ce=ie(Be,!0);te(Be),je(()=>Ne(Ce,_(oe))),ee(Se,Be)};Ie(me,Se=>{_(oe)&&Se(fe)})}te(re),ee(G,re)},footer:G=>{var re=Tn(),le=Qe(re);Ze(le,{variant:"outlined",size:"small",onclick:De,children:(fe,Se)=>{Ke();var Be=Ue("Cancel");ee(fe,Be)},$$slots:{default:!0}});var me=de(le,2);{let fe=we(()=>!_(q).trim()||_(z));Ze(me,{size:"small",get disabled(){return _(fe)},onclick:$,children:(Se,Be)=>{Ke();var Ce=Ue();je(()=>Ne(Ce,_(z)?"Suggesting edits…":"Suggest edits")),ee(Se,Ce)},$$slots:{default:!0}})}ee(G,re)},underlay:G=>{var re=so(),le=ie(re,!0);te(re),je(()=>{gr(re,"title",_(be)),Ne(le,_(be))}),ee(G,re)},$$slots:{default:!0,footer:!0,underlay:!0}});var dn=de(hn,2);Ut(dn,{title:"No changes were suggested",class:"!z-[60] !max-w-md",overlayClass:"!z-[60]",get open(){return _(Y)},set open(U){ne(Y,U,!0)},children:U=>{var G=ao();ee(U,G)},footer:U=>{Ze(U,{size:"small",onclick:()=>ne(Y,!1),children:(G,re)=>{Ke();var le=Ue("Close");ee(G,le)},$$slots:{default:!0}})},$$slots:{default:!0,footer:!0}});var rr=de(dn,2);{var ir=v=>{Ut(v,{title:"Schema",class:"!w-[80vw] !max-w-5xl",get open(){return _(ve)},set open(G){ne(ve,G,!0)},children:G=>{qr(G,{class:"h-[70vh] min-w-0",get schema(){return _(ke)},onChange:Ct})},footer:G=>{var re=An(),le=Qe(re);{var me=Ce=>{var Le=lo(),Re=ie(Le,!0);te(Le),je(()=>Ne(Re,_(qe))),ee(Ce,Le)},fe=Ce=>{var Le=co(),Re=ie(Le,!0);te(Le),je(()=>Ne(Re,_(Ye))),ee(Ce,Le)};Ie(le,Ce=>{_(qe)?Ce(me):_(Ye)&&Ce(fe,1)})}var Se=de(le,2);Ze(Se,{variant:"outlined",size:"small",onclick:()=>ne(ve,!1),children:(Ce,Le)=>{Ke();var Re=Ue();je(()=>Ne(Re,_(_t)?"Cancel":"Close")),ee(Ce,Re)},$$slots:{default:!0}});var Be=de(Se,2);{let Ce=we(()=>!_(_t)||_(We));Ze(Be,{size:"small",get disabled(){return _(Ce)},onclick:Pt,children:(Le,Re)=>{Ke();var Je=Ue();je(()=>Ne(Je,_(We)?"Saving…":"Save")),ee(Le,Je)},$$slots:{default:!0}})}ee(G,re)},$$slots:{default:!0,footer:!0}})};Ie(rr,v=>{_(ue)&&v(ir)})}je(()=>{var v;Ne(Jn,((v=t.currentStep)==null?void 0:v.name)??"Prompt"),$t.disabled=!t.currentStep||!!_(l)&&!!t.edit.popover}),xr($t,()=>_(ft),v=>ne(ft,v)),ee(P,tn),yt()}Qt(["click"]);export{Uo as component};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as b,f as R,d as Et,b as Ue,t as we,e as vt,c as Dt}from"../chunks/CCYriF4C.js";import{p as rt,c as T,f as Ne,r as I,s as A,j as e,t as oe,y as s,n as m,a as nt,w as L,d as Me,o as Ee,x as kt}from"../chunks/CR-uVjxM.js";import{i as ee}from"../chunks/BQIf5msi.js";import{B as le}from"../chunks/joiJcRPz.js";import{D as Ft,c as re,i as Mt,a as He,b as We,d as jt}from"../chunks/ouMvMh56.js";import{s as ve}from"../chunks/B0nqNj93.js";import{e as Ge,i as xt}from"../chunks/DuQdgMax.js";import{s as tt,c as Jt}from"../chunks/C9yBjdYI.js";import{p as pe}from"../chunks/BcbX6huO.js";import{I as Ke}from"../chunks/BBk8_Xpk.js";import{t as Ye}from"../chunks/DGqwi6rZ.js";import{P as Pt,g as Wt}from"../chunks/CHCMKZAC.js";import{c as pt,s as Gt}from"../chunks/CR5IRTqC.js";import{b as Ot}from"../chunks/ClLUwVGq.js";import{C as Kt,b as Yt,a as Xt,c as bt,f as At,m as Zt,d as $t,e as Qt}from"../chunks/D9OWCkdk.js";import{i as Rt}from"../chunks/DgGeUDDh.js";import{o as er}from"../chunks/DnMQeiTY.js";import{s as tr}from"../chunks/9mOMnnWN.js";import{I as Nt}from"../chunks/DJnDF3d9.js";import{l as et,c as rr}from"../chunks/B1dhmiqQ.js";var nr=R('<span class="min-w-0 flex-1 truncate text-left"> </span> <!>',1),ar=R('<div class="truncate p-1 text-base font-semibold text-rc-green-200"> </div>'),or=R('<div class="truncate p-1 text-base font-semibold text-rc-gray-100"> </div>'),sr=R('<div class="flex items-start gap-2"><div class="min-w-0"><div class="truncate p-1 text-sm text-rc-gray-300 group-hover:text-rc-gray-200"> </div> <!></div></div>'),ir=R('<div class="mt-1 max-h-96 w-max min-w-full max-w-[min(26rem,90vw)] overflow-y-auto overflow-x-hidden rounded-lg border border-rc-gray-110 bg-rc-gray-930 backdrop-blur-2xl" role="listbox"></div>'),lr=R("<div><!> <!></div>");function ur(u,r){rt(r,!0);let n=pe(r,"class",3,""),o=L(!1),i=L(null);const d=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function x(){s(o,!e(o))}function k(p){r.onSelectState(p),s(o,!1)}function v(p){const O=p.userMessage;if(O==null)return"No message";const P=(typeof O=="string"?O:String(O)).trim();return P?p.userMessageSender==="system"?`System: ${P}`:P:"No message"}function g(p,O=50,P="…"){if(!p)return"";if(p.length<=O)return p;const E=p.slice(0,O+1),j=Math.max(E.lastIndexOf(" "),E.lastIndexOf(" "),E.lastIndexOf(" "),E.lastIndexOf(`
|
|
2
|
-
`),E.lastIndexOf("\r"));return(j>0?E.slice(0,j):p.slice(0,O)).trimEnd()+P}function C(p){p.key==="ArrowDown"&&!e(o)?(s(o,!0),p.preventDefault()):p.key==="ArrowUp"&&e(o)&&(s(o,!1),p.preventDefault())}function he(p){const O=p.getDate(),P=d[p.getMonth()];let E=p.getHours();const j=E>=12?"PM":"AM";E=E%12,E===0&&(E=12);const z=String(p.getMinutes()).padStart(2,"0"),M=new Date,se=p.getFullYear(),ce=se!==M.getFullYear()?` ${se}`:"";return`${O} ${P}${ce}, ${E}:${z} ${j}`}function ue(p){const O=new Date(p.id);if(!Number.isNaN(O.getTime()))return he(O);const P=new Date(p.name);return Number.isNaN(P.getTime())?p.name||"History":he(P)}let N=m(()=>r.agentStates.find(p=>p.id===r.currentState)??null),_e=m(()=>e(N)?ue(e(N)):"History");var K=lr(),xe=T(K);le(xe,{variant:"ghost",get"aria-expanded"(){return e(o)},"aria-haspopup":"listbox","aria-controls":"history-dropdown",onclick:x,onkeydown:C,class:"inline-flex w-40 items-center rounded-lg border border-transparent !bg-rc-gray-700 !px-3 !pb-1 !pt-[5px] text-rc-gray-200 hover:border hover:border-rc-gray-500 focus:outline-none focus:ring-0",get el(){return e(i)},set el(p){s(i,p,!0)},children:(p,O)=>{var P=nr(),E=Ne(P),j=T(E,!0);I(E);var z=A(E,2);{let M=m(()=>"size-7 shrink-0 text-rc-gray-500 transition-transform duration-200 "+(e(o)?"rotate-180":""));Ke(z,{name:"chevron-down",get class(){return e(M)}})}oe(()=>ve(j,e(_e))),b(p,P)},$$slots:{default:!0}});var ne=A(xe,2);Ft(ne,{id:"history-dropdown",get open(){return e(o)},onClose:()=>s(o,!1),get anchorEl(){return e(i)},placement:"bottom-start",offset:[0,1],children:O=>{var P=ir();Ge(P,21,()=>r.agentStates.slice().reverse(),xt,(E,j)=>{{let z=m(()=>e(j).id===r.currentState);le(E,{variant:"ghost",size:"small",role:"option",get"aria-selected"(){return e(z)},onclick:()=>k(e(j).id),class:"group w-full rounded-none border-b border-rc-gray-110 py-2 pr-3 text-left backdrop-blur-2xl last:border-b-0 hover:bg-rc-gray-700 focus:bg-rc-gray-400",children:(M,se)=>{var ce=sr(),Pe=T(ce),Ae=T(Pe),De=T(Ae,!0);I(Ae);var Fe=A(Ae,2);{var qe=ae=>{var de=ar(),Ce=T(de,!0);I(de),oe(ge=>ve(Ce,ge),[()=>g(v(e(j)))]),b(ae,de)},Re=ae=>{var de=or(),Ce=T(de,!0);I(de),oe(ge=>ve(Ce,ge),[()=>g(v(e(j)))]),b(ae,de)};ee(Fe,ae=>{e(j).id===r.currentState?ae(qe):ae(Re,-1)})}I(Pe),I(ce),oe(ae=>ve(De,ae),[()=>ue(e(j))]),b(M,ce)},$$slots:{default:!0}})}}),I(P),b(O,P)},$$slots:{default:!0}}),I(K),oe(()=>tt(K,1,`relative ${n()}`)),b(u,K),nt()}var cr=R('<dialog class="dialog m-auto bg-transparent p-0 text-rc-gray-100 shadow-md svelte-jby388"><!> <!></dialog>');function dr(u,r){rt(r,!0);let n,o=pe(r,"showCloseButton",3,!1),i=pe(r,"onClose",3,()=>{}),d=pe(r,"onOpen",3,()=>{}),x=pe(r,"isOpen",3,!1);Me(()=>{x()?(console.log("show"),n==null||n.showModal(),d()()):n!=null&&n.open&&(console.log("close"),n.close())});function k(){i()()}er(()=>(n.addEventListener("close",k),()=>{n.removeEventListener("close",k)}));function v(N){N.target===n&&n.close()}var g=cr(),C=T(g);tr(C,()=>r.children);var he=A(C,2);{var ue=N=>{le(N,{variant:"ghost",onclick:()=>n.close(),class:"absolute right-2 top-2",children:(_e,K)=>{Ee();var xe=we("✕");b(_e,xe)},$$slots:{default:!0}})};ee(he,N=>{o()&&N(ue)})}I(g),Ot(g,N=>n=N,()=>n),Ue("mousedown",g,v),b(u,g),nt()}Et(["mousedown"]);function gr(u){if(!Array.isArray(u))return[];const r=[];for(const n of u){if(!n||typeof n!="object")continue;const o=n.text,i=n.lastSeen,d=n.uses;if(typeof o!="string"||typeof i!="number"||!Number.isFinite(i)||typeof d!="number"||!Number.isFinite(d))continue;const x=o.trim();x&&r.push({text:x,lastSeen:i,uses:d})}return r.sort((n,o)=>o.lastSeen-n.lastSeen),r}function fr(u,r,n=2e3){var k;const o=r.trim();if(!o)return u;const i=(((k=u[0])==null?void 0:k.lastSeen)??0)+1,d=u.findIndex(v=>v.text===o);let x;if(d!==-1){const v=u[d];x=[{text:v.text,lastSeen:i,uses:(v.uses??0)+1},...u.slice(0,d),...u.slice(d+1)]}else x=[{text:o,lastSeen:i,uses:1},...u];return x.length>n?x.slice(0,n):x}function mr(u,r,n=2e3){var k,v;if(!r.length)return u;if(!u.length)return r;const o=((k=u[0])==null?void 0:k.lastSeen)??0,d=(((v=r[0])==null?void 0:v.lastSeen)??0)>o?r:r.map((g,C)=>({...g,lastSeen:o+(r.length-C)})),x=new Map;for(const g of u)x.set(g.text,g);for(const g of d){const C=x.get(g.text);if(!C){x.set(g.text,g);continue}x.set(g.text,{text:g.text,lastSeen:Math.max(C.lastSeen,g.lastSeen),uses:C.uses+g.uses})}return Array.from(x.values()).sort((g,C)=>C.lastSeen-g.lastSeen).slice(0,n)}function vr(u,r,n=5){if(!r.length)return[];const i=u.trim().toLowerCase(),d=ht(u,!1).text,x=/\s$/u.test(u);if(!ht(u,!0).text)return[];const k=[];for(const v of r){const g=ht(v.text);if(!g.text||v.text.trim().toLowerCase()===i)continue;const C=hr(g,v.text,d,x);C&&k.push({item:v,match:C})}return k.sort((v,g)=>v.match.kindRank!==g.match.kindRank?v.match.kindRank-g.match.kindRank:v.match.span!==g.match.span?v.match.span-g.match.span:v.match.start!==g.match.start?v.match.start-g.match.start:v.item.lastSeen!==g.item.lastSeen?g.item.lastSeen-v.item.lastSeen:v.item.uses!==g.item.uses?g.item.uses-v.item.uses:v.item.text.length-g.item.text.length),k.slice(0,n).map(v=>({text:v.item.text,prefixEndIndex:v.match.prefixEndIndex,segments:_r(v.item.text,v.match.ranges)}))}function ht(u,r=!0){const n=[],o=[];for(let i=0;i<u.length;i++){const d=pr(u[i]);if(d===" "){if(!n.length)continue;const x=n.length-1;if(n[x]===" "){o[x][1]=i+1;continue}}n.push(d),o.push([i,i+1])}return r&&n[n.length-1]===" "&&(n.pop(),o.pop()),{text:n.join(""),ranges:o}}function pr(u){if(/\s/u.test(u))return" ";try{return/[\p{P}\p{S}]/u.test(u)?" ":u.toLowerCase()}catch{return/[^a-z0-9\s]/i.test(u)?" ":u.toLowerCase()}}function hr(u,r,n,o){if(!u.text)return null;if(u.text.startsWith(n)){const d=wr(r,n,o)??r.length,x=Math.max(0,Math.min(r.length,d));return{kindRank:0,start:0,span:n.length,ranges:[[0,x]],prefixEndIndex:x}}const i=u.text.indexOf(n);return i!==-1?{kindRank:yr(u.text,i,n.length),start:i,span:n.length,ranges:Sr(u,i,i+n.length),prefixEndIndex:r.length}:null}function xr(u,r){return r<=0?!0:u[r-1]===" "}function br(u,r){return r>=u.length?!0:u[r]===" "}function yr(u,r,n){const o=xr(u,r),i=br(u,r+n);return o&&i?1:o?2:3}function Sr(u,r,n){const o=Math.max(0,Math.min(u.ranges.length,r)),i=Math.max(o,Math.min(u.ranges.length,n));return zt(u.ranges.slice(o,i))}function wr(u,r,n){if(!r)return null;let o="",i=!0;for(let d=0;d<u.length;d++){const x=u[d];let k;if(/\s/u.test(x))k=" ";else try{k=/[\p{P}\p{S}]/u.test(x)?" ":x.toLowerCase()}catch{k=/[^a-z0-9\s]/i.test(x)?" ":x.toLowerCase()}if(k===" "){if(i)continue;o+=" ",i=!0}else o+=k,i=!1;if(o.length===r.length){if(o!==r)return null;let v=d+1;if(n&&r.endsWith(" ")){let g=v;for(;g<u.length;){const C=u[g];if(/\s/u.test(C)){g+=1;continue}try{if(/[\p{P}\p{S}]/u.test(C)){g+=1;continue}}catch{if(/[^a-z0-9\s]/i.test(C)){g+=1;continue}}break}v=g}return v}if(o.length>r.length)return null}return null}function _r(u,r){const n=zt(r);if(!n.length)return[{text:u,matched:!1}];const o=[];let i=0;for(const[d,x]of n)d>i&&o.push({text:u.slice(i,d),matched:!1}),o.push({text:u.slice(d,x),matched:!0}),i=x;return i<u.length&&o.push({text:u.slice(i),matched:!1}),o.filter(d=>d.text.length>0)}function zt(u){if(!u.length)return[];const r=u.map(([o,i])=>[Math.max(0,o),Math.max(0,i)]).filter(([o,i])=>i>o).sort((o,i)=>o[0]-i[0]||o[1]-i[1]);if(!r.length)return[];const n=[[r[0][0],r[0][1]]];for(let o=1;o<r.length;o++){const[i,d]=r[o],x=n[n.length-1];if(i<=x[1]){x[1]=Math.max(x[1],d);continue}n.push([i,d])}return n}var Ir=R('<form><h2 class="text-l mb-4 text-gray-300">Image URL</h2> <!> <!></form>'),Cr=R('<div class="my-2 flex w-full justify-center"><div class="rounded-full border border-rc-gray-650 bg-rc-gray-800/40 px-3 py-1 text-xs text-rc-gray-200"> </div></div>'),Tr=R('<div class="rounded-lg border border-rc-green-450 bg-transparent px-3 py-2 text-sm text-rc-gray-300">Generating 9 more variants…</div>'),kr=R('<div class="rounded-lg border border-red-500/70 bg-red-950/20 px-3 py-2 text-sm text-red-200"> </div>'),Mr=R('<button type="button"><div class="whitespace-pre-line break-words"> </div></button>'),Pr=R('<div class="ml-7 mt-2 flex flex-col gap-2"><!> <!> <!></div>'),Ar=R('<!> <div class="log-element"><div><!></div> <!></div>',1),Rr=R('<div class="absolute bottom-2 left-2 right-2 z-10 flex items-center gap-3 rounded-lg border border-rc-green-450 bg-rc-gray-930/90 px-3 py-3 font-semibold text-rc-gray-100 shadow-inner-white-soft backdrop-blur-3xl"><span>Choose a variant above to continue</span> <button type="button" class="rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-300 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-100 focus:outline-none focus-visible:outline-none disabled:cursor-wait disabled:opacity-50">Regenerate</button> <button type="button" class="rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-300 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-100 focus:outline-none focus-visible:outline-none">Cancel</button></div>'),Nr=R('<div class="absolute bottom-16 left-2 right-2 z-20 rounded-lg border border-red-500/60 bg-red-950/90 px-3 py-2 text-sm text-red-100 shadow-lg" role="alert"> </div>'),Er=R("<span> </span>"),Dr=R('<button type="button" role="option" tabindex="-1"></button>'),Fr=R('<div class="absolute bottom-full left-0 right-0 mb-1 max-h-60 overflow-y-auto rounded-lg border border-rc-gray-110 bg-rc-gray-930 shadow-inner-white-soft backdrop-blur-2xl" role="listbox"></div>'),Or=R('<div class="pointer-events-none absolute inset-0 z-10 overflow-hidden rounded-lg" aria-hidden="true"><div class="whitespace-pre text-rc-gray-400/70"><span class="invisible"> </span><span> </span></div></div>'),zr=R('<!> <form><fieldset class="absolute bottom-2 left-2 right-2 z-10 flex gap-2 disabled:opacity-35"><div class="relative flex-1"><!> <!> <button type="button" class="absolute bottom-0 left-3 top-0 z-20 inline-flex items-center border-r border-rc-gray-500/70 bg-transparent pr-2 text-base font-semibold leading-6 text-rc-gray-300 transition-colors duration-75 hover:text-rc-gray-300 focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50"> </button> <!></div> <!> <!></fieldset></form>',1),Vr=R('<div class="rc-scroll min-h-0 flex-1 overflow-y-auto pr-1"></div> <!>',1),Hr=R("<!> <!>",1);function Ur(u,r){rt(r,!0);let n=pe(r,"promptEditProposalId",3,null),o=pe(r,"analyzeDisabled",3,!1),i=pe(r,"variantSourceTrace",3,null),d=pe(r,"variantChoices",19,()=>[]),x=pe(r,"variantLoading",3,!1),k=pe(r,"variantApplyingId",3,null),v=pe(r,"variantError",3,null),g=kt(new Set),C=L(""),he=L(""),ue=L(""),N,_e=L(!1),K=L(null),xe=L(""),ne=L(!1),p=L("user"),O=L(null),P=L(kt([])),E=L(null),j=L(!1),z=L(!1),M=L(null);const se=m(()=>vr(e(C),e(P))),ce=m(()=>e(M)==null?null:e(se)[e(M)]??null),Pe=m(()=>e(ce)?e(ce).text.slice(e(ce).prefixEndIndex):""),Ae=m(()=>!i()&&!e(ue)&&e(C).trim().length===0);Me(()=>{if(typeof window>"u")return;if(!e(K)){s(xe,"");return}const t=window.getComputedStyle(e(K)),c=`calc(${t.paddingTop} + ${t.borderTopWidth})`,S=`calc(${t.paddingRight} + ${t.borderRightWidth})`,h=`calc(${t.paddingBottom} + ${t.borderBottomWidth})`,U=`calc(${t.paddingLeft} + ${t.borderLeftWidth})`;s(xe,[`padding:${c} ${S} ${h} ${U}`,`font:${t.font}`,`letter-spacing:${t.letterSpacing}`,`line-height:${t.lineHeight}`,`text-indent:${t.textIndent}`,`text-transform:${t.textTransform}`,`text-align:${t.textAlign}`,`box-sizing:${t.boxSizing}`].join(";"),!0)}),Me(()=>{e(M)!=null&&e(M)>=e(se).length&&s(M,null)});const De=m(()=>i()||!e(j)||e(z)?!1:e(se).length>0);function Fe(t){s(C,t.text,!0),s(M,null),s(z,!0)}function qe(){s(j,!0),s(z,!1)}function Re(){s(j,!1),s(M,null),s(z,!1)}function ae(){s(M,null),s(z,!1)}function de(t){if(t.key==="Escape"){e(De)&&t.preventDefault(),s(z,!0),s(M,null);return}if(t.key==="ArrowUp"||t.key==="ArrowDown"){if(!e(se).length)return;e(z)&&s(z,!1),t.preventDefault();const c=e(se).length-1;if(e(M)===null)s(M,t.key==="ArrowUp"?c:0,!0);else{const S=t.key==="ArrowUp"?-1:1;s(M,Math.max(0,Math.min(c,e(M)+S)),!0)}return}if(t.key==="Enter"||t.key==="Tab"&&!t.shiftKey){if(e(M)===null)return;const c=e(se)[e(M)];if(!c)return;t.preventDefault(),Fe(c);return}}let Ce=null,ge=!1,Le=0;function Be(){typeof window>"u"||N&&(!ge&&g.has(N)||Ce==null&&(Ce=requestAnimationFrame(()=>{if(Ce=null,!N||!ge&&g.has(N))return;const t=N.scrollHeight-(N.scrollTop+N.clientHeight),c=ge||t>N.clientHeight?"auto":"smooth";N.scrollTo({top:N.scrollHeight,behavior:c}),ge=!1})))}Me(()=>{const t=re.length;t===0&&Le>0&&(ge=!0,N&&g.delete(N)),Le=t,t>0&&Be()});function Xe(t){t.scrollTop+t.clientHeight+200>t.scrollHeight?g.delete(t):g.add(t)}function at(t){if(e(ne))return;(e(C).trim().length>0||e(ue))&&(s(P,fr(e(P),e(C)),!0),r.onmessage({sender:t,text:e(C),imageUrl:e(ue)}),s(ue,""),s(C,""),s(p,"user"),s(z,!1),s(M,null))}function Ze(t){t.preventDefault(),at(e(p))}function ot(){s(p,e(p)==="system"?"user":"system",!0),requestAnimationFrame(()=>{var t;return(t=e(K))==null?void 0:t.focus()})}function st(t){t.preventDefault(),s(ue,e(he),!0),s(he,""),s(_e,!1)}function $e(t){return t&&typeof t.renderedPrompt=="string"?t.renderedPrompt:null}function it(t,c){for(let S=c-1;S>=0;S--){const h=t[S];if(We(h)&&Rt(h.name)&&$e(h))return h}for(let S=c-1;S>=0;S--){const h=t[S];if(We(h)&&h.name==="prewarm"&&$e(h))return h}return null}function a(t){return(t.eventName==="received-message"||t.eventName==="llm-handler-stream-requested")&&!String(t.content??"").trim()?!1:t.eventName==="received-message"||t.eventName==="llm-handler-stream-requested"||t.eventName==="finished-main-streaming-step"||t.eventName==="sent-message"||t.eventName==="transfer-requested"||t.eventName==="hangup-requested"}function l(t){return!!(r.agentId&&r.agentId.trim())&&t.eventName!=="transfer-requested"&&(t.eventName==="finished-main-streaming-step"||t.eventName==="sent-message")}function f(t){return t.role==="user"||t.eventName==="received-message"||t.eventName==="llm-handler-stream-requested"}function V(t){const c=String(t??"").trim();return!c||/^\[image\]\s+/.test(c)?"":c}function J(t){const c=t==null?void 0:t.bosunInputMessageSender;return c==="system"?"system":c==="user"?"user":t.role==="system"?"system":"user"}function Y(t){if(!r.onRevertToState)return;const c=t==null?void 0:t.bosunPrevStateId,S=typeof c=="string"&&c.trim().length>0?c:null;r.onRevertToState(S);const h=typeof(t==null?void 0:t.bosunUserMessage)=="string"?t.bosunUserMessage:t.content;s(C,V(h),!0),s(p,J(t),!0),s(z,!1),s(M,null),requestAnimationFrame(()=>{var U,fe;try{(U=e(K))==null||U.focus(),(fe=e(K))==null||fe.select()}catch{}})}function W(){var t;r.agentType==="text"?s(_e,!0):r.agentType==="voice"&&((t=r.onHangup)==null||t.call(r))}const w=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function G(t){if(typeof t!="number"||!Number.isFinite(t))return null;const c=new Date(t);if(Number.isNaN(c.getTime()))return null;const S=c.getFullYear(),h=String(c.getMonth()+1).padStart(2,"0"),U=String(c.getDate()).padStart(2,"0");return`${S}-${h}-${U}`}function y(t){if(typeof t!="number"||!Number.isFinite(t))return null;const c=new Date(t);if(Number.isNaN(c.getTime()))return null;const S=c.getDate(),h=w[c.getMonth()],U=c.getFullYear();return`${S} ${h} ${U}`}const $=m(()=>re.filter(t=>Mt(t)||We(t)?!0:He(t)?a(t):!1)),Vt=m(()=>{var t;return((t=re.findLast(c=>He(c)))==null?void 0:t.eventName)==="hangup-requested"}),yt=m(()=>{const t=e($).map((c,S)=>({entry:c,index:S})).reverse().find(({entry:c,index:S})=>!He(c)||!l(c)?!1:e($).slice(0,S).some(h=>He(h)&&f(h)));return t&&He(t.entry)?t.entry:null}),St=m(()=>{const t=e(yt);if(!t)return null;try{const c=wt(t);return{model:c.model,stringifiedConversation:c.stringifiedConversation,response:c.response}}catch{return null}});function wt(t){if(!(r.agentId??"").trim())throw new Error("Agent id is not available; cannot analyze");const S=re.indexOf(t);if(S===-1)throw new Error("Could not locate trace in chat history");const h=bt(re,S,{requireRenderedPrompt:!0});if(!h)throw new Error("Could not find main step trace for this message");const U=typeof h.renderedPrompt=="string"?h.renderedPrompt:"";if(!U.trim())throw new Error("Main step rendered prompt is missing");const fe=typeof h.stringifiedConversation=="string"&&h.stringifiedConversation.trim()?h.stringifiedConversation:At(re,S)??"",Ie=String((t==null?void 0:t.content)??"");if(!Ie.trim())throw new Error("Message content is missing");const B=typeof(h==null?void 0:h.model)=="string"?String(h.model):void 0,F=t==null?void 0:t.createdAt,Q=typeof F=="number"&&Number.isFinite(F)?F:void 0;return{trace:t,stepTrace:h,renderedPrompt:U,stringifiedConversation:fe,response:Ie,model:B,createdAt:Q}}function Ht(t){if(r.onAnalyzeTrace)try{s(O,null),r.onAnalyzeTrace(wt(t))}catch(c){console.error(c),s(O,c instanceof Error?c.message:String(c),!0)}}function Ut(t){if(r.onRegenerateTrace)try{s(O,null),r.onRegenerateTrace(t)}catch(c){console.error(c),s(O,c instanceof Error?c.message:String(c),!0)}}async function qt(){if(e(ne))return;const t=e(St);if(t){s(z,!0),s(M,null),s(ne,!0);try{const c=await Ye.agents.generateUserResponse.mutate(t);s(C,c.text,!0),s(z,!0),s(M,null),requestAnimationFrame(()=>{var S,h;try{(S=e(K))==null||S.focus(),(h=e(K))==null||h.setSelectionRange(c.text.length,c.text.length)}catch{}})}catch(c){console.error("Failed to generate suggested user response",c)}finally{s(ne,!1)}}}Me(()=>{if(typeof window>"u")return;const t=(r.agentId??"").trim(),c=(r.region??"").trim()||null,S=`${t}::${c??""}`;if(!t||S===e(E))return;s(E,S),s(P,[],!0);const h=t,U=c,fe=S;Ye.agents.userMessageHistory.query({agentId:h,region:U}).then(Ie=>{if(e(E)!==fe)return;const B=gr(Ie);s(P,mr(B,e(P)),!0),s(M,null)}).catch(Ie=>{console.error("Failed to load user message history",Ie),e(E)===fe&&(s(P,[],!0),s(M,null))})}),Me(()=>{const t=i(),c=d().length,S=x(),h=v(),U=k();!t&&!c&&!S&&!h&&!U||Be()});var _t=Hr(),It=Ne(_t);dr(It,{get isOpen(){return e(_e)},onClose:()=>s(_e,!1),showCloseButton:!0,children:(t,c)=>{Pt(t,{class:"p-4",children:(S,h)=>{var U=Ir(),fe=A(T(U),2);Nt(fe,{class:"mb-2 w-80",get value(){return e(he)},set value(B){s(he,B,!0)}});var Ie=A(fe,2);le(Ie,{variant:"secondary",type:"submit",class:"ml-2 p-2",children:(B,F)=>{Ee();var Q=we("Attach");b(B,Q)},$$slots:{default:!0}}),I(U),vt("submit",U,st),b(S,U)}})},$$slots:{default:!0}});var Lt=A(It,2);Pt(Lt,{get class(){return`relative flex min-h-0 flex-col p-2 pb-16 ${r.class??""}`},children:(t,c)=>{var S=Vr(),h=Ne(S);Ge(h,21,()=>e($),xt,(B,F,Q)=>{const Oe=m(()=>G(e(F).createdAt)),be=m(()=>Q>0?G(e($)[Q-1].createdAt):null),ze=m(()=>y(e(F).createdAt));var Ve=Ar(),je=Ne(Ve);{var lt=_=>{var H=Cr(),X=T(H),Z=T(X,!0);I(X),I(H),oe(()=>ve(Z,e(ze))),b(_,H)};ee(je,_=>{e(Oe)&&e(ze)&&e(Oe)!==e(be)&&_(lt)})}var Je=A(je,2),ye=T(Je),ut=T(ye);{var ct=_=>{Kt(_,{get trace(){return e(F)}})},dt=m(()=>Mt(e(F))),Qe=_=>{{let H=m(()=>bt(e($),Q)),X=m(()=>r.onAnalyzeTrace?Ht:void 0),Z=m(()=>r.onRegenerateTrace?Ut:void 0),me=m(()=>r.onRevertToState?Y:void 0),ie=m(()=>!!r.onSeeVariants&&!i()&&e(F)===e(yt)),Te=m(()=>i()&&e(F)===i()?"source":"none"),te=m(()=>k()===null&&i()&&e(F)===i()?r.onChooseOriginalVariant:void 0),Se=m(()=>!!i()&&e(F)===i());Yt(_,{testCreationMode:"direct",get trace(){return e(F)},get context(){return r.context},get agentId(){return r.agentId},get region(){return r.region},get promptEditProposalId(){return n()},get testSourceStep(){return e(H)},get testEntries(){return e($)},get analyzeDisabled(){return o()},get onAnalyze(){return e(X)},get onRegenerate(){return e(Z)},get onRevert(){return e(me)},get showSeeVariants(){return e(ie)},get onSeeVariants(){return r.onSeeVariants},get variantSelectionState(){return e(Te)},get onSelectInVariantMode(){return e(te)},get suppressActionRow(){return e(Se)}})}},gt=m(()=>He(e(F))),ft=_=>{{let H=m(()=>At(e($),Q)),X=m(()=>Rt(e(F).name)?it(e($),Q):null);Xt(_,{testCreationMode:"direct",get trace(){return e(F)},get agentId(){return r.agentId},get region(){return r.region},get promptEditProposalId(){return n()},get fallbackConversation(){return e(H)},get runtimeContext(){return r.context},get compareTrace(){return e(X)}})}},mt=m(()=>We(e(F)));ee(ut,_=>{e(dt)?_(ct):e(gt)?_(Qe,1):e(mt)&&_(ft,2)})}I(ye);var D=A(ye,2);{var q=_=>{var H=Pr(),X=T(H);{var Z=te=>{var Se=Tr();b(te,Se)};ee(X,te=>{x()&&te(Z)})}var me=A(X,2);{var ie=te=>{var Se=kr(),ke=T(Se,!0);I(Se),oe(()=>ve(ke,v())),b(te,Se)};ee(me,te=>{v()&&te(ie)})}var Te=A(me,2);Ge(Te,17,d,te=>te.id,(te,Se)=>{var ke=Mr(),Ct=T(ke),Bt=T(Ct,!0);I(Ct),I(ke),oe(()=>{ke.disabled=k()!==null,tt(ke,1,`w-full max-w-[83%] cursor-pointer rounded-lg border border-rc-green-450 bg-transparent p-2 pt-1 text-left text-rc-gray-100 backdrop-blur-md transition-colors hover:bg-rc-green-700 focus:outline-none focus-visible:outline-none disabled:cursor-wait disabled:opacity-70 ${k()===e(Se).id?"bg-rc-green-700":""}`),ve(Bt,e(Se).text)}),Ue("click",ke,()=>{var Tt;return(Tt=r.onChooseVariant)==null?void 0:Tt.call(r,e(Se).id)}),b(te,ke)}),I(H),b(_,H)};ee(D,_=>{i()&&e(F)===i()&&_(q)})}I(Je),b(B,Ve)}),I(h),Ot(h,B=>N=B,()=>N);var U=A(h,2);{var fe=B=>{var F=Rr(),Q=A(T(F),2),Oe=A(Q,2);I(F),oe(()=>Q.disabled=!r.onRegenerateVariants||x()||k()!==null),Ue("click",Q,()=>{var be;return(be=r.onRegenerateVariants)==null?void 0:be.call(r)}),Ue("click",Oe,()=>{var be;return(be=r.onCancelVariants)==null?void 0:be.call(r)}),b(B,F)},Ie=B=>{var F=zr(),Q=Ne(F);{var Oe=D=>{var q=Nr(),_=T(q,!0);I(q),oe(()=>ve(_,e(O))),b(D,q)};ee(Q,D=>{e(O)&&D(Oe)})}var be=A(Q,2),ze=T(be),Ve=T(ze),je=T(Ve);{var lt=D=>{var q=Fr();Ge(q,23,()=>e(se),_=>_.text,(_,H,X)=>{var Z=Dr();Ge(Z,21,()=>e(H).segments,xt,(me,ie)=>{var Te=Er(),te=T(Te,!0);I(Te),oe(()=>{tt(Te,1,Jt(e(ie).matched?"text-rc-green-200":"")),ve(te,e(ie).text)}),b(me,Te)}),I(Z),oe(()=>{pt(Z,"aria-selected",e(M)===e(X)),tt(Z,1,`w-full select-none border-b border-rc-gray-110 px-3 py-2 text-left font-semibold text-rc-gray-100 last:border-b-0 hover:bg-rc-gray-700/70 ${e(M)===e(X)?"bg-rc-gray-700/70":""}`)}),Ue("mousedown",Z,me=>{me.preventDefault(),Fe(e(H))}),b(_,Z)}),I(q),b(D,q)};ee(je,D=>{e(De)&&D(lt)})}var Je=A(je,2);{let D=m(()=>e(p)==="system"?"!border-emerald-500 !pl-[5.5rem] hover:!border-emerald-500 focus:!border-emerald-500":"!pl-[4.25rem]"),q=m(()=>e(ne)?"Generating":"Enter message...");Nt(Je,{variant:"chat",get class(){return`!text-base !leading-6 !duration-75 ${e(D)??""}`},get placeholder(){return e(q)},autocomplete:"off",get readonly(){return e(ne)},onfocus:qe,onblur:Re,oninput:ae,onkeydown:de,get value(){return e(C)},set value(_){s(C,_,!0)},get el(){return e(K)},set el(_){s(K,_,!0)}})}var ye=A(Je,2),ut=T(ye,!0);I(ye);var ct=A(ye,2);{var dt=D=>{var q=Or(),_=T(q),H=T(_),X=T(H,!0);I(H);var Z=A(H),me=T(Z,!0);I(Z),I(_),I(q),oe(()=>{Gt(_,e(xe)),ve(X,e(C)),ve(me,e(Pe))}),b(D,q)};ee(ct,D=>{e(M)!==null&&e(Pe)&&D(dt)})}I(Ve);var Qe=A(Ve,2);{let D=m(()=>e(ne)||!r.agentType);le(Qe,{size:"small",variant:"secondary",get disabled(){return e(D)},onclick:W,children:(q,_)=>{var H=Dt(),X=Ne(H);{var Z=ie=>{Ke(ie,{name:"paperclip"})},me=ie=>{Ke(ie,{name:"hangup"})};ee(X,ie=>{r.agentType==="text"?ie(Z):r.agentType==="voice"&&ie(me,1)})}b(q,H)},$$slots:{default:!0}})}var gt=A(Qe,2);{var ft=D=>{{let q=m(()=>e(ne)||!e(St));le(D,{size:"small",type:"button",title:"Generate response","aria-label":"Generate response",get disabled(){return e(q)},class:"inline-flex !w-[59px] items-center justify-center !px-0",onclick:_=>{_.preventDefault(),qt()},children:(_,H)=>{Ke(_,{name:"sparkles"})},$$slots:{default:!0}})}},mt=D=>{{let q=m(()=>e(p)==="system"?"Send as system":"Send as user"),_=m(()=>e(p)==="system"?"Send as system":"Send as user");le(D,{size:"small",type:"submit",get title(){return e(q)},get"aria-label"(){return e(_)},get disabled(){return e(ne)},class:"inline-flex !w-[59px] items-center justify-center !px-0",children:(H,X)=>{Ke(H,{name:"send"})},$$slots:{default:!0}})}};ee(gt,D=>{e(Ae)?D(ft):D(mt,-1)})}I(ze),I(be),oe(()=>{ze.disabled=e(Vt),pt(ye,"title",e(p)==="system"?"Switch to user":"Switch to system"),pt(ye,"aria-label",e(p)==="system"?"Switch to user":"Switch to system"),ye.disabled=e(ne),ve(ut,e(p)==="system"?"System":"User")}),vt("submit",be,Ze),Ue("click",ye,D=>{D.preventDefault(),D.stopPropagation(),ot()}),b(B,F)};ee(U,B=>{i()?B(fe):B(Ie,-1)})}vt("scroll",h,B=>Xe(B.target)),b(t,S)}}),b(u,_t),nt()}Et(["click","mousedown"]);var qr=R('<div class="mt-1 w-max overflow-hidden rounded-lg border border-rc-gray-110 bg-rc-gray-930 shadow-inner-white-soft backdrop-blur-2xl" role="listbox"><!> <!> <!></div>'),Lr=R('<div class="flex h-full items-center justify-center text-sm text-rc-gray-300">Connecting…</div>'),Br=R('<div class="flex h-full items-center justify-center text-sm text-rc-gray-300">Select an agent to start chatting</div>'),jr=R('<div class="h-full min-h-0 p-2"><!></div>'),Jr=R('<div class="relative flex h-full min-h-0 flex-col"><div class="flex flex-none flex-nowrap items-center gap-2 p-2"><!> <div class="ml-auto flex flex-none flex-nowrap items-center gap-2"><!> <!> <!> <!></div></div> <div class="min-h-0 flex-1"><!></div></div>');function fn(u,r){rt(r,!0);const{state:n,actions:o}=Wt();let i=L(!1),d=L(null);const x=m(()=>{var l,f;const a=(l=n.currentStep)==null?void 0:l.name;return a?((f=Object.values(n.promptEdits).find(V=>V.agentId===n.agentId&&V.step===a))==null?void 0:f.id)??null:null});let k=L(null),v=null,g=L(!1),C=L(null);const he=m(()=>{var l;const a=((l=n.agentStates.at(-1))==null?void 0:l.id)??null;return!!a&&n.currentState===a});Me(()=>{!re.length&&!et.length&&e(g)&&s(g,!1)});function ue(a){const l=(a||"").trim();return l?l.split("/").at(-1)??l:"Agent"}function N(a){if(typeof a!="number"||!Number.isFinite(a))return null;const l=new Date(a);if(Number.isNaN(l.getTime()))return null;const f=String(l.getHours()).padStart(2,"0"),V=String(l.getMinutes()).padStart(2,"0"),J=String(l.getSeconds()).padStart(2,"0");return`${f}:${V}:${J}`}async function _e(a){var Y,W;if(e(i))return;s(i,!0);const l=o.openPopover("analyze"),f=N(a.createdAt),V=f?` • ${f}`:"",J=`Analysis — ${ue(n.agentId)}${V}`;try{const w=await Ye.agents.analyzeTrace.mutate({agentId:n.agentId,traceId:(Y=a.trace)==null?void 0:Y.traceId,eventName:a.trace.eventName,createdAt:a.createdAt,model:a.model,renderedPrompt:a.renderedPrompt,stringifiedConversation:a.stringifiedConversation,response:a.response,stepTrace:a.stepTrace});if(((W=n.edit.popover)==null?void 0:W.requestId)!==l)return;o.setHighlightQuotes(w.quotes);let G=null;try{G=JSON.stringify(w.raw,null,2)}catch{G=null}o.setPopoverReady(l,{title:J,quotes:w.quotes,rationales:w.rationales,parallelCalls:w.parallelCalls,raw:G})}catch(w){console.error(w);const G=typeof(w==null?void 0:w.message)=="string"?w.message:(()=>{try{return JSON.stringify(w)}catch{return String(w)}})();o.setPopoverError(l,G||"Failed to analyze this response",{raw:G})}finally{s(i,!1)}}function K(a){return a?re:re.map(l=>{if(!We(l))return l;const{receivedPrompt:f,renderedPrompt:V,...J}=l;return J})}function xe(a){s(k,a,!0),v&&clearTimeout(v),v=window.setTimeout(()=>{s(k,null),v=null},2e3)}async function ne(){try{await navigator.clipboard.writeText(JSON.stringify(et,null,2)),xe("logs")}catch(a){console.error("Failed to copy logs",a)}}async function p(a){try{await navigator.clipboard.writeText(JSON.stringify(K(a),null,2)),xe(a?"with-prompts":"without-prompts")}catch(l){console.error("Failed to copy traces",l)}}function O(){z(),o.closePopover(),o.closeContextPopover(),o.selectState(null)}function P(a,l="user"){const f=String(a??"").trim();if(!f)return null;const V=/^\[image\]\s+(.+)$/.exec(f);if(V){const J=(V[1]??"").trim();return J?{sender:l,text:"",imageUrl:J}:null}return{sender:l,text:f}}function E(a){return a==="system"?"system":"user"}function j(a){z();const l=a==null?void 0:a.bosunPrevStateId,f=typeof l=="string"&&l.trim()?l:null,V=typeof(a==null?void 0:a.bosunUserMessage)=="string"&&a.bosunUserMessage||null,J=E(a==null?void 0:a.bosunInputMessageSender);let Y=V?P(V,J):null;if(!Y){const W=a==null?void 0:a.bosunStateId;if(typeof W=="string"&&W.trim()){const w=n.agentStates.find(G=>G.id===W);Y=P((w==null?void 0:w.userMessage)??"",E(w==null?void 0:w.userMessageSender))}}if(!Y){if(l===void 0)throw new Error("Cannot regenerate: this response has no saved state metadata");o.selectState(f);return}o.selectState(f),o.sendChatMessage({sender:Y.sender,text:Y.text,imageUrl:Y.imageUrl})}function z(){s(d,null)}function M(a){const l=re.indexOf(a),f=l===-1?null:bt(re,l);return f&&typeof f.receivedContext<"u"?$t(f.receivedContext):Qt(n.context)}function se(a){const l=M(a),f=Zt(n.context);return f?{context:l,mocks:f}:l}async function ce(a){if(!n.agentId)return;const l=o.getPromptOverrides();await o.flushPromptSave(),s(d,{sourceTrace:a,choices:[],loading:!0,applyingId:null,error:null},!0);try{const f=await Ye.agents.generateVariants.mutate({agentId:n.agentId,region:n.region,context:se(a),promptOverrides:l,count:9});if(!e(d)||e(d).sourceTrace!==a)return;s(d,{...e(d),choices:f,loading:!1,error:null},!0)}catch(f){if(console.error("Failed to generate variants",f),!e(d)||e(d).sourceTrace!==a)return;s(d,{...e(d),choices:[],loading:!1,error:typeof(f==null?void 0:f.message)=="string"?f.message:"Failed to generate variants"},!0)}}function Pe(a){ce(a)}function Ae(){o.hangup()}function De(){var l;const a=(l=e(d))==null?void 0:l.sourceTrace;a&&ce(a)}async function Fe(a){if(!e(d)||!n.agentId)return;const l=e(d).choices.find(f=>f.id===a);if(l){s(d,{...e(d),applyingId:a,error:null},!0);try{await Ye.agents.commitVariant.mutate({agentId:n.agentId,region:n.region,state:l.state}),z(),jt(),rr(),o.sendAppEvent({type:"reload-project"})}catch(f){if(console.error("Failed to apply variant",f),!e(d))return;s(d,{...e(d),applyingId:null,error:typeof(f==null?void 0:f.message)=="string"?f.message:"Failed to apply variant"},!0)}}}function qe(){z()}Me(()=>{const a=e(d),l=n.agentId,f=a==null?void 0:a.sourceTrace;!a||!f||(!l||!re.includes(f))&&s(d,null)});var Re=Jr(),ae=T(Re),de=T(ae);{var Ce=a=>{ur(a,{get agentStates(){return n.agentStates},get currentState(){return n.currentState},class:"ml-9",onSelectState:l=>o.selectState(l)})};ee(de,a=>{n.agentStates.length>1&&a(Ce)})}var ge=A(de,2),Le=T(ge);{let a=m(()=>!n.agentId);le(Le,{variant:"secondary",size:"small",get disabled(){return e(a)},get"aria-expanded"(){return n.contextPopoverOpen},"aria-haspopup":"dialog",get onclick(){return o.toggleContextPopover},children:(l,f)=>{Ee();var V=we("Edit context");b(l,V)},$$slots:{default:!0}})}var Be=A(Le,2);{let a=m(()=>!re.length&&!et.length);le(Be,{variant:"secondary",size:"small",get disabled(){return e(a)},get"aria-expanded"(){return e(g)},"aria-haspopup":"listbox","aria-controls":"roleplay-copy-dropdown",onclick:l=>{l.stopPropagation(),s(g,!e(g))},get el(){return e(C)},set el(l){s(C,l,!0)},children:(l,f)=>{var V=Dt(),J=Ne(V);{var Y=y=>{var $=we("Copied logs");b(y,$)},W=y=>{var $=we("Copied traces (with prompts)");b(y,$)},w=y=>{var $=we("Copied traces (without prompts)");b(y,$)},G=y=>{var $=we("Copy...");b(y,$)};ee(J,y=>{e(k)==="logs"?y(Y):e(k)==="with-prompts"?y(W,1):e(k)==="without-prompts"?y(w,2):y(G,-1)})}b(l,V)},$$slots:{default:!0}})}var Xe=A(Be,2);Ft(Xe,{id:"roleplay-copy-dropdown",get open(){return e(g)},onClose:()=>s(g,!1),get anchorEl(){return e(C)},placement:"bottom-end",offset:[0,1],children:l=>{var f=qr(),V=T(f);{let W=m(()=>!et.length);le(V,{variant:"ghost",size:"small",role:"option",get disabled(){return e(W)},onclick:w=>{w.stopPropagation(),s(g,!1),ne()},class:"block rounded-none border-b border-rc-gray-110 py-2 pr-3 text-left backdrop-blur-2xl hover:bg-rc-gray-700 focus:bg-rc-gray-400",children:(w,G)=>{Ee();var y=we("Copy logs");b(w,y)},$$slots:{default:!0}})}var J=A(V,2);{let W=m(()=>!re.length);le(J,{variant:"ghost",size:"small",role:"option",get disabled(){return e(W)},onclick:w=>{w.stopPropagation(),s(g,!1),p(!0)},class:"block rounded-none border-b border-rc-gray-110 py-2 pr-3 text-left backdrop-blur-2xl hover:bg-rc-gray-700 focus:bg-rc-gray-400",children:(w,G)=>{Ee();var y=we("Copy traces with prompts");b(w,y)},$$slots:{default:!0}})}var Y=A(J,2);{let W=m(()=>!re.length);le(Y,{variant:"ghost",size:"small",role:"option",get disabled(){return e(W)},onclick:w=>{w.stopPropagation(),s(g,!1),p(!1)},class:"block rounded-none py-2 pr-3 text-left backdrop-blur-2xl hover:bg-rc-gray-700 focus:bg-rc-gray-400",children:(w,G)=>{Ee();var y=we("Copy traces without prompts");b(w,y)},$$slots:{default:!0}})}I(f),b(l,f)},$$slots:{default:!0}});var at=A(Xe,2);le(at,{size:"small",onclick:O,children:(a,l)=>{Ee();var f=we("New chat");b(a,f)},$$slots:{default:!0}}),I(ge),I(ae);var Ze=A(ae,2),ot=T(Ze);{var st=a=>{var l=Lr();b(a,l)},$e=a=>{var l=Br();b(a,l)},it=a=>{var l=jr(),f=T(l);{let V=m(()=>e(he)?Pe:void 0),J=m(()=>{var y;return((y=e(d))==null?void 0:y.sourceTrace)??null}),Y=m(()=>{var y;return((y=e(d))==null?void 0:y.choices)??[]}),W=m(()=>{var y;return((y=e(d))==null?void 0:y.loading)??!1}),w=m(()=>{var y;return((y=e(d))==null?void 0:y.applyingId)??null}),G=m(()=>{var y;return((y=e(d))==null?void 0:y.error)??null});Ur(f,{class:"h-full min-w-0",get context(){return n.context},get agentId(){return n.agentId},get region(){return n.region},get promptEditProposalId(){return e(x)},get agentType(){return n.agentType},onmessage:y=>o.sendChatMessage(y),get analyzeDisabled(){return e(i)},onAnalyzeTrace:_e,onRegenerateTrace:j,onRevertToState:y=>o.selectState(y),get onSeeVariants(){return e(V)},onHangup:Ae,get variantSourceTrace(){return e(J)},get variantChoices(){return e(Y)},get variantLoading(){return e(W)},get variantApplyingId(){return e(w)},get variantError(){return e(G)},onCancelVariants:z,onRegenerateVariants:De,onChooseOriginalVariant:qe,onChooseVariant:Fe})}I(l),b(a,l)};ee(ot,a=>{!n.wsLoaded||!n.chatReady?a(st):n.agentId?a(it,-1):a($e,1)})}I(Ze),I(Re),b(u,Re),nt()}export{fn as component};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log-content.svelte.js-C6EzbHLC.js","sources":["../../../../.svelte-kit/output/server/chunks/log-content.svelte.js"],"sourcesContent":["const chatContent = [];\nfunction isStepTrace(entry) {\n return !isApiCallTrace(entry) && !isConversationalTrace(entry);\n}\nfunction isApiCallTrace(entry) {\n return \"operationName\" in entry && \"method\" in entry && \"path\" in entry;\n}\nfunction isConversationalTrace(entry) {\n return \"eventName\" in entry && \"role\" in entry && \"medium\" in entry && \"content\" in entry;\n}\nfunction clearChatContent() {\n chatContent.length = 0;\n}\nconst logContent = [];\nfunction clearLogs() {\n logContent.length = 0;\n}\nexport {\n clearLogs as a,\n isConversationalTrace as b,\n clearChatContent as c,\n isStepTrace as d,\n chatContent as e,\n isApiCallTrace as i,\n logContent as l\n};\n"],"names":[],"mappings":"AAAK,MAAC,WAAW,GAAG;AACpB,SAAS,WAAW,CAAC,KAAK,EAAE;AAC5B,EAAE,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC;AAChE;AACA,SAAS,cAAc,CAAC,KAAK,EAAE;AAC/B,EAAE,OAAO,eAAe,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK;AACzE;AACA,SAAS,qBAAqB,CAAC,KAAK,EAAE;AACtC,EAAE,OAAO,WAAW,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK;AAC3F;AACA,SAAS,gBAAgB,GAAG;AAC5B,EAAE,WAAW,CAAC,MAAM,GAAG,CAAC;AACxB;AACK,MAAC,UAAU,GAAG;AACnB,SAAS,SAAS,GAAG;AACrB,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC;AACvB;;;;"}
|