@knoflows/engine 0.1.0 → 0.1.1-alpha.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.
Files changed (54) hide show
  1. package/dist/engine.js +19 -19
  2. package/dist/migrations/20260921193000_local_repo_remote/migration.sql +3 -0
  3. package/dist/migrations/20260921193000_local_repo_remote/snapshot.json +1378 -0
  4. package/package.json +1 -1
  5. package/static/assets/i18n/en.json +14 -0
  6. package/static/assets/i18n/es.json +14 -0
  7. package/static/chunk--EZIkevK.js +1 -0
  8. package/static/{chunk-D3JZ8ur5.js → chunk-8ezEUcxN.js} +6 -6
  9. package/static/chunk-B17yZLWe.js +1 -0
  10. package/static/{chunk-7NTQwN96.js → chunk-B8OjWpOp.js} +1 -1
  11. package/static/chunk-BHko4hHm.js +1 -0
  12. package/static/{chunk-DSgUAlqN.js → chunk-BIJScqTM.js} +1 -1
  13. package/static/{chunk-B_R_vsLt.js → chunk-BKYaECRn.js} +1 -1
  14. package/static/chunk-BLN4QkSi.js +1 -0
  15. package/static/{chunk-BrP_q6LZ.js → chunk-BRAytoQl.js} +1 -1
  16. package/static/{chunk-xeQj_hSF.js → chunk-BaLWULJh.js} +1 -1
  17. package/static/{chunk-Dx92ksvP.js → chunk-BcDRgzYZ.js} +1 -1
  18. package/static/{chunk-5xJXPFlv.js → chunk-Bok52e_k.js} +1 -1
  19. package/static/{chunk-CuwZV6XG.js → chunk-BowAQ7m9.js} +1 -1
  20. package/static/{chunk-C9PkSfMb.js → chunk-Bz7bE4tT.js} +1 -1
  21. package/static/{chunk-BCHj6l85.js → chunk-C7P7hUiX.js} +1 -1
  22. package/static/{chunk-BcQQgpKh.js → chunk-CAxHAuhV.js} +1 -1
  23. package/static/{chunk-Cvoe3MtC.js → chunk-CGHIKxZG.js} +1 -1
  24. package/static/{chunk-CZoPJsBm.js → chunk-CJWR0gwk.js} +1 -1
  25. package/static/{chunk-BRZ5T52h.js → chunk-CZA-kp5w.js} +1 -1
  26. package/static/{chunk-ZqQUQSE8.js → chunk-CoQPYpxp.js} +1 -1
  27. package/static/{chunk-DAONFRT8.js → chunk-CtiubhW7.js} +1 -1
  28. package/static/{chunk-hpn_m1ZC.js → chunk-CwEMAptL.js} +1 -1
  29. package/static/{chunk-CRGkNzel.js → chunk-D-ueyYEC.js} +3 -3
  30. package/static/{chunk-DHC_yfIa.js → chunk-D1355dNd.js} +1 -1
  31. package/static/{chunk-CV-FUe_H.js → chunk-D8qyjd0z.js} +1 -1
  32. package/static/{chunk-Dg-4XevL.js → chunk-DOAz4S6b.js} +1 -1
  33. package/static/{chunk-VXZaUyyE.js → chunk-DbQy6dR8.js} +1 -1
  34. package/static/chunk-DdDI9wRc.js +5 -0
  35. package/static/{chunk-BIdwV0jx.js → chunk-Det50scT.js} +1 -1
  36. package/static/{chunk-BIL86kgf.js → chunk-Dm_EWkUz.js} +1 -1
  37. package/static/chunk-DoJknvak.js +1 -0
  38. package/static/{chunk-DEF7Ge5B.js → chunk-DrncP2Qx.js} +1 -1
  39. package/static/{chunk-DvWh-Q5D.js → chunk-EDwdt-Wk.js} +1 -1
  40. package/static/chunk-IjKs-6Cl.js +1 -0
  41. package/static/{chunk-DyiDg8XX.js → chunk-LPXHXTnJ.js} +1 -1
  42. package/static/{chunk-DVJ9L-aC.js → chunk-SiaN7xSQ.js} +1 -1
  43. package/static/{chunk-Bv1r1Ly-.js → chunk-YU-Bg77r.js} +1 -1
  44. package/static/{chunk-Ysn4Fbgj.js → chunk-bSS_wejP.js} +1 -1
  45. package/static/{chunk-CLM-K-Vg.js → chunk-iIEmH_ui.js} +1 -1
  46. package/static/{chunk-CPNxRF7A.js → chunk-vINo5yVD.js} +1 -1
  47. package/static/index.html +1 -1
  48. package/static/{main-SI5AKDMC.js → main-3VZRFHGG.js} +1 -1
  49. package/static/chunk--WRMKpmO.js +0 -5
  50. package/static/chunk-BaYdwXIA.js +0 -1
  51. package/static/chunk-C3Xml1YG.js +0 -1
  52. package/static/chunk-DDhSFoAE.js +0 -1
  53. package/static/chunk-DaO-gpzS.js +0 -1
  54. package/static/chunk-pi-mtheN.js +0 -1
@@ -1,5 +0,0 @@
1
- import {T}from'./chunk-DVJ9L-aC.js';import {D,B as B$1,z}from'./chunk-pi-mtheN.js';import {H as He$1}from'./chunk-hpn_m1ZC.js';import {C,a as C1,R as J1,b6 as U,b8 as y,b as at,V as Ve$1,bo as O,bp as de,ba as Se$1,q as qo,U as Uw,u as ue,s,r as r$1,c as bi,Z as ZE,d as $8,e as al,bb as er,f as rl,g as $i,v as v3,Y as pf,a0 as bd,a1 as sp,a2 as fp,h as ex,F as Fm,A as Am,K as Kt,j as _i,I as Iw,J as Jc,P as Pw,m as mh,l as _D,o as gI,L as Lh,p as Fw,w as lh,z as rl$1,M as MD,H as HD,G as FD,k as iE,x as xD,y as aE,B as AD,N as ND,n as uh,O as Fu,Q as ju,al as Sh,D as ch,aR as xw}from'./main-SI5AKDMC.js';import {b}from'./chunk-Dx92ksvP.js';import {a as ai,z as z$1}from'./chunk-BIL86kgf.js';import {e as Uu,z as z_,S as S_,G as G$}from'./chunk-D3JZ8ur5.js';import'./chunk-CLM-K-Vg.js';var be=()=>[],B=(t,o)=>o.id,Ie=(t,o)=>o.name;function Ee(t,o){t&1&&(_i(0,"p",6),Iw(1),Pw(2,"transloco"),Jc()),t&2&&(gI(),Lh(Fw(2,1,"common.loading")));}function Ve(t,o){if(t&1&&(_i(0,"p",7),Iw(1),Jc()),t&2){let e=HD();gI(),Lh(e.loadError());}}function Se(t,o){if(t&1&&(_i(0,"li"),Iw(1),Jc()),t&2){let e=o.$implicit;gI(),Lh(e);}}function ze(t,o){if(t&1&&(_i(0,"section",8)(1,"h2"),Iw(2),Pw(3,"transloco"),Jc(),_i(4,"ul"),xD(5,Se,2,1,"li",null,ND),Jc()()),t&2){let e=HD(2);gI(2),Lh(Fw(3,1,"views.editor.validation")),gI(3),AD(e.validationErrors());}}function Pe(t,o){if(t&1&&uh(0,"nz-option",12),t&2){let e=o.$implicit;lh("nzValue",e.id)("nzLabel",e.name);}}function ke(t,o){t&1&&(_i(0,"p",14),Iw(1),Pw(2,"transloco"),Jc()),t&2&&(gI(),rl$1(" ",Fw(2,1,"views.editor.noEligibleInstances")," "));}function qe(t,o){t&1&&(_i(0,"p",17),Iw(1),Pw(2,"transloco"),Jc()),t&2&&(gI(),rl$1(" ",Fw(2,1,"views.editor.instanceNeeded")," "));}function Ne(t,o){if(t&1&&uh(0,"nz-option",12),t&2){let e=o.$implicit;lh("nzValue",e.id)("nzLabel",e.displayName);}}function De(t,o){if(t&1){let e=FD();_i(0,"div",16),_D(1,qe,3,3,"p",17),_i(2,"span"),Iw(3),Pw(4,"transloco"),Jc(),_i(5,"nz-select",18),Pw(6,"transloco"),mh("ngModelChange",function(n){Fu(e);let s=HD(3);return ju(s.onInstanceChange(n))}),xD(7,Ne,1,2,"nz-option",12,B),Jc(),iE(),Jc();}if(t&2){let e=HD(3);Sh("field-attention",e.needsInstanceAttention()),gI(),MD(e.needsInstanceAttention()?1:-1),gI(2),Lh(Fw(4,6,"views.editor.instance")),gI(2),lh("nzPlaceHolder",Fw(6,8,"views.editor.instancePlaceholder"))("ngModel",e.providerInstanceId()),aE(),gI(2),AD(e.eligibleInstances());}}function Ae(t,o){if(t&1&&_D(0,ke,3,3,"p",14)(1,De,9,10,"div",15),t&2){let e=HD(2);MD(e.eligibleInstances().length===0?0:1);}}function Fe(t,o){if(t&1){let e=FD();_i(0,"div",13)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i(4,"div",19)(5,"button",20),mh("click",function(){Fu(e);let n=HD(2);return ju(n.setQueryMode("template"))}),Iw(6),Pw(7,"transloco"),Jc(),_i(8,"button",21),mh("click",function(){Fu(e);let n=HD(2);return ju(n.setQueryMode("raw"))}),Iw(9),Pw(10,"transloco"),Jc()()();}if(t&2){let e=HD(2);gI(2),Lh(Fw(3,5,"views.editor.queryMode")),gI(3),lh("nzType",e.queryMode()==="template"?"primary":"default"),gI(),rl$1(" ",Fw(7,7,"views.editor.queryMode.template")," "),gI(2),lh("nzType",e.queryMode()==="raw"?"primary":"default"),gI(),rl$1(" ",Fw(10,9,"views.editor.queryMode.raw")," ");}}function je(t,o){if(t&1&&uh(0,"nz-option",12),t&2){let e=o.$implicit;lh("nzValue",e.id)("nzLabel",e.label);}}function Be(t,o){if(t&1){let e=FD();_i(0,"label",9)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i(4,"textarea",23),mh("ngModelChange",function(n){Fu(e);let s=HD(4);return ju(s.queryText.set(n))}),Jc(),iE(),_i(5,"span",24),Iw(6),Pw(7,"transloco"),Jc()();}if(t&2){let e=HD(4);gI(2),Lh(Fw(3,3,"views.editor.query")),gI(2),lh("ngModel",e.queryText()),aE(),gI(2),Lh(Fw(7,5,"views.editor.manualListHint"));}}function Oe(t,o){t&1&&(_i(0,"span",25),Iw(1,"*"),Jc());}function Le(t,o){if(t&1&&uh(0,"nz-option",12),t&2){let e=o.$implicit;lh("nzValue",e)("nzLabel",e);}}function $e(t,o){if(t&1){let e=FD();_i(0,"nz-select",29),mh("ngModelChange",function(n){Fu(e);let s=HD().$implicit,C=HD(5);return ju(C.setTemplateParam(s.name,n))}),xD(1,Le,1,2,"nz-option",12,ND),Jc(),iE();}if(t&2){let e=HD().$implicit,i=HD(5);lh("ngModel",i.templateParamValue(e.name)),ch("data-testid","template-param-"+e.name),aE(),gI(),AD(e.options??xw(2,be));}}function Re(t,o){if(t&1){let e=FD();_i(0,"nz-select",30),mh("ngModelChange",function(n){Fu(e);let s=HD().$implicit,C=HD(5);return ju(C.setTemplateParam(s.name,n))}),Jc(),iE();}if(t&2){let e=HD().$implicit,i=HD(5);lh("ngModel",i.templateParamListValue(e.name)),ch("data-testid","template-param-"+e.name),aE();}}function We(t,o){if(t&1){let e=FD();_i(0,"input",31),mh("ngModelChange",function(n){Fu(e);let s=HD().$implicit,C=HD(5);return ju(C.setTemplateParam(s.name,n))}),Jc(),iE();}if(t&2){let e=HD().$implicit,i=HD(5);lh("ngModel",i.templateParamValue(e.name)),ch("data-testid","template-param-"+e.name),aE();}}function Je(t,o){if(t&1&&(_i(0,"label",9)(1,"span"),Iw(2),_D(3,Oe,2,0,"span",25),Jc(),_D(4,$e,3,3,"nz-select",26)(5,Re,1,2,"nz-select",27)(6,We,1,2,"input",28),Jc()),t&2){let e=o.$implicit;gI(2),rl$1(" ",e.label," "),gI(),MD(e.required?3:-1),gI(),MD(e.type==="select"?4:e.type==="string[]"?5:6);}}function Qe(t,o){if(t&1&&xD(0,Je,7,3,"label",9,Ie),t&2){let e=HD();AD(e.params);}}function He(t,o){if(t&1&&_D(0,Be,8,7,"label",9)(1,Qe,2,0),t&2){let e=HD(3);MD(e.isRawSeedTemplate()?0:1);}}function Ue(t,o){if(t&1){let e=FD();_i(0,"div",9)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i(4,"nz-select",22),mh("ngModelChange",function(n){Fu(e);let s=HD(2);return ju(s.selectTemplate(n))}),xD(5,je,1,2,"nz-option",12,B),Jc(),iE(),Jc(),_D(7,He,2,1);}if(t&2){let e,i=HD(2);gI(2),Lh(Fw(3,3,"views.editor.template")),gI(2),lh("ngModel",i.selectedTemplateId()),aE(),gI(),AD(i.templates()),gI(2),MD((e=i.selectedTemplate())?7:-1,e);}}function Ge(t,o){if(t&1){let e=FD();_i(0,"label",9)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i(4,"textarea",23),mh("ngModelChange",function(n){Fu(e);let s=HD(2);return ju(s.queryText.set(n))}),Jc(),iE(),_i(5,"span",32),Iw(6),Pw(7,"transloco"),Jc()();}if(t&2){let e=HD(2);gI(2),Lh(Fw(3,3,"views.editor.query")),gI(2),lh("ngModel",e.queryText()),aE(),gI(2),Lh(Fw(7,5,"views.editor.queryHint"));}}function Ke(t,o){if(t&1){let e=FD();_D(0,ze,7,3,"section",8),_i(1,"label",9)(2,"span"),Iw(3),Pw(4,"transloco"),Jc(),_i(5,"input",10),mh("ngModelChange",function(n){Fu(e);let s=HD();return ju(s.name.set(n))}),Jc(),iE(),Jc(),_i(6,"div",9)(7,"span"),Iw(8),Pw(9,"transloco"),Jc(),_i(10,"nz-select",11),mh("ngModelChange",function(n){Fu(e);let s=HD();return ju(s.onWorkflowChange(n))}),xD(11,Pe,1,2,"nz-option",12,B),Jc(),iE(),Jc(),_D(13,Ae,2,1),_D(14,Fe,11,11,"div",13),_D(15,Ue,8,5)(16,Ge,8,7,"label",9);}if(t&2){let e=HD();MD(e.validationErrors().length>0?0:-1),gI(3),Lh(Fw(4,8,"views.editor.name")),gI(2),lh("ngModel",e.name()),aE(),gI(3),Lh(Fw(9,10,"views.editor.workflow")),gI(2),lh("ngModel",e.workflowId()),aE(),gI(),AD(e.bindableWorkflows()),gI(2),MD(e.selectedWorkflow()&&e.settings()?13:-1),gI(),MD(e.hasTemplates()?14:-1),gI(),MD(e.queryMode()==="template"&&e.hasTemplates()?15:16);}}function Ye(t){let o=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),e=crypto.randomUUID().slice(0,8);return o.length>0?`${o}-${e}`:`view-${e}`}var Ze=[];function Xe(t){let o={};for(let e of t.params)e.type==="select"?o[e.name]=e.options?.[0]??"":e.type==="string[]"?o[e.name]=[]:o[e.name]="";return o}function Me(t,o){let e=r$1(r$1({},Xe(t)),o);for(let i of t.params){if(i.type!=="string[]")continue;let n=e[i.name];e[i.name]=Array.isArray(n)?n.map(s=>String(s)):[];}return e}function et(t){let o=t?.trim()??"";return o.length>0?o:null}var kt=(()=>{class t{constructor(){this.route=C(C1),this.router=C(J1),this.viewsApi=C(U),this.nav=C(y),this.workflowsApi=C(b),this.settingsApi=C(D),this.providersApi=C(B$1),this.message=C(He$1),this.destroyRef=C(at),this.transloco=C(Ve$1),this.language=C(O),this.routeId=de(this.route.paramMap.pipe(Se$1(e=>e.get("id"))),{initialValue:this.route.snapshot.paramMap.get("id")}),this.name=qo(""),this.workflowId=qo(""),this.providerInstanceId=qo(null),this.workflows=qo([]),this.subjectType=qo(null),this.queryText=qo(`{
2
-
3
- }`),this.queryMode=qo("template"),this.templates=qo([]),this.selectedTemplateId=qo(null),this.templateParams=qo({}),this.settings=qo(null),this.loadError=qo(null),this.validationErrors=qo([]),this.saving=qo(false),this.loading=qo(true),this.bindableWorkflows=Uw(()=>this.workflows().filter(e=>e.appliesTo!=="none")),this.selectedWorkflow=Uw(()=>this.bindableWorkflows().find(e=>e.id===this.workflowId())??null),this.subjectTypeOptions=Uw(()=>Uu(this.selectedWorkflow()?.appliesTo??"none")),this.eligibleInstances=Uw(()=>z(this.settings(),this.subjectTypeOptions())),this.selectedInstance=Uw(()=>this.eligibleInstances().find(e=>e.id===this.providerInstanceId())??null),this.needsInstanceAttention=Uw(()=>this.selectedWorkflow()!=null&&this.settings()!=null&&this.eligibleInstances().length>0&&this.selectedInstance()==null),this.isNew=Uw(()=>!this.routeId()),this.pageTitle=Uw(()=>(this.language.currentLang(),this.isNew()?this.transloco.translate("views.editor.titleNew"):this.transloco.translate("views.editor.titleEdit",{name:this.name().trim()}))),this.selectedTemplate=Uw(()=>this.templates().find(e=>e.id===this.selectedTemplateId())??null),this.hasTemplates=Uw(()=>this.templates().length>0),this.isRawSeedTemplate=Uw(()=>this.selectedTemplateId()==="manual-list"),this.workflowsApi.list().pipe(ue(this.destroyRef)).subscribe({next:e=>this.workflows.set(e),error:e=>{this.workflows.set([]),this.message.error(this.errorMessage(e,this.transloco.translate("views.editor.loadFailed")));}}),this.settingsApi.getSettings().pipe(ue(this.destroyRef)).subscribe({next:e=>{this.settings.set(e),this.refreshTemplates();},error:e=>{this.settings.set(z_),this.refreshTemplates(),this.message.error(this.errorMessage(e,this.transloco.translate("views.editor.loadFailed")));}}),this.route.paramMap.pipe(ue(this.destroyRef)).subscribe(e=>{let i=e.get("id");if(this.validationErrors.set([]),this.loadError.set(null),this.pendingProvenance=void 0,!i){this.name.set(""),this.workflowId.set(""),this.providerInstanceId.set(null),this.subjectType.set(null),this.queryText.set(`{
4
-
5
- }`),this.queryMode.set("template"),this.selectedTemplateId.set(null),this.templateParams.set({}),this.loading.set(false),this.refreshTemplates();return}this.loading.set(true),this.viewsApi.get(i).subscribe({next:n=>{this.name.set(n.name),this.workflowId.set(n.workflowId),this.providerInstanceId.set(et(n.providerInstanceId)),this.subjectType.set(n.subjectType),this.queryText.set(JSON.stringify(n.query,null,2)),this.pendingProvenance=n.queryTemplate,this.queryMode.set(n.queryTemplate?"template":"raw"),this.loading.set(false),this.refreshTemplates();},error:n=>{this.loading.set(false),this.loadError.set(this.errorMessage(n,this.transloco.translate("views.editor.loadFailed")));}});});}subjectTypeKey(e){return `workflow-editor.subjectType.${e}`}onWorkflowChange(e){this.workflowId.set(e);let i=Uu(this.bindableWorkflows().find(s=>s.id===e)?.appliesTo??"none");this.pendingProvenance=void 0,this.queryMode.set("template"),this.selectedTemplateId.set(null),this.templateParams.set({});let n=z(this.settings(),i);if(n.length===1)this.applyInstance(n[0]);else {let s=this.providerInstanceId(),C=n.find(k=>k.id===s);C?this.applyInstance(C):(this.providerInstanceId.set(null),this.subjectType.set(null));}this.refreshTemplates();}onInstanceChange(e){let i=this.eligibleInstances().find(n=>n.id===e);this.pendingProvenance=void 0,this.queryMode.set("template"),this.selectedTemplateId.set(null),this.templateParams.set({}),i&&this.applyInstance(i),this.refreshTemplates();}applyInstance(e){this.providerInstanceId.set(e.id),S_(e)&&this.subjectType.set(e.subjectType);}setQueryMode(e){this.queryMode.set(e),e==="template"&&!this.selectedTemplateId()&&this.templates()[0]&&this.selectTemplate(this.templates()[0].id);}selectTemplate(e){let i=this.templates().find(n=>n.id===e);this.selectedTemplateId.set(e),this.templateParams.set(i?Me(i,{}):{}),e==="manual-list"&&this.resolveRawSeedTemplate();}templateParamValue(e){let i=this.templateParams()[e];return i==null?"":String(i)}templateParamListValue(e){let i=this.templateParams()[e];return Array.isArray(i)?i:Ze}setTemplateParam(e,i){this.templateParams.set(s(r$1({},this.templateParams()),{[e]:i}));}save(){if(!this.selectedInstance()){this.validationErrors.set([this.transloco.translate("views.editor.pickInstance")]);return}if(this.queryMode()==="template"&&this.hasTemplates()){this.saveFromTemplate();return}this.saveFromRawJson();}saveFromTemplate(){let e=this.selectedTemplate(),i=this.providerInstanceId();if(!e||!i){this.validationErrors.set([this.transloco.translate("views.editor.pickTemplate")]);return}let n=e.params.filter(s=>s.required?tt(this.templateParams()[s.name]):false);if(n.length>0){this.validationErrors.set(n.map(s=>this.transloco.translate("views.editor.missingParam",{label:s.label})));return}if(e.id==="manual-list"){this.saveFromRawJson({templateId:e.id,params:this.templateParams()});return}this.validationErrors.set([]),this.saving.set(true),this.providersApi.resolveQueryTemplate(i,e.id,this.templateParams()).subscribe({next:s=>{this.persist({query:s.query,queryTemplate:{templateId:e.id,params:this.templateParams()}});},error:s=>{this.saving.set(false),this.message.error(this.errorMessage(s,this.transloco.translate("views.editor.resolveFailed")));}});}saveFromRawJson(e){let i;try{i=JSON.parse(this.queryText());}catch(n){this.validationErrors.set([this.transloco.translate("views.editor.invalidJson")]);return}if(i===null||typeof i!="object"||Array.isArray(i)){this.validationErrors.set([this.transloco.translate("views.editor.invalidJson")]);return}this.persist({query:i,queryTemplate:e});}persist(e){let i=this.routeId(),n=this.subjectType(),s=r$1({id:i??Ye(this.name()),name:this.name().trim(),subjectType:n??"",providerInstanceId:this.providerInstanceId()??"",workflowId:this.workflowId(),query:e.query},e.queryTemplate?{queryTemplate:e.queryTemplate}:{}),C=G$.safeParse(s);if(!C.success){this.saving.set(false),this.validationErrors.set(T(C.error));return}this.validationErrors.set([]),this.saving.set(true);let k=C.data;(this.isNew()||!i?this.viewsApi.create(k):this.viewsApi.update(i,k)).subscribe({next:D=>{this.saving.set(false),this.nav.refresh(),this.message.success(this.transloco.translate(this.isNew()?"views.editor.created":"views.editor.saved")),this.isNew()&&this.router.navigate(["/views",D.id,"edit"]);},error:D=>{this.saving.set(false),this.message.error(this.errorMessage(D,this.transloco.translate("views.editor.saveFailed")));}});}refreshTemplates(){let e=this.providerInstanceId();if(!e){this.templates.set([]),this.applyLoadedTemplates([]);return}this.providersApi.listQueryTemplates(e).subscribe({next:i=>{this.templates.set(i),this.applyLoadedTemplates(i);},error:()=>{this.templates.set([]),this.applyLoadedTemplates([]);}});}resolveRawSeedTemplate(){let e=this.providerInstanceId();e&&this.providersApi.resolveQueryTemplate(e,"manual-list",{}).subscribe({next:i=>{this.selectedTemplateId()==="manual-list"&&this.queryText.set(JSON.stringify(i.query,null,2));},error:i=>{this.message.error(this.errorMessage(i,this.transloco.translate("views.editor.resolveFailed")));}});}applyLoadedTemplates(e){let i=this.pendingProvenance;if(i){let n=e.find(s=>s.id===i.templateId);n?(this.queryMode.set("template"),this.selectedTemplateId.set(n.id),this.templateParams.set(Me(n,i.params))):(this.queryMode.set("raw"),this.selectedTemplateId.set(null)),this.pendingProvenance=void 0;return}if(this.queryMode()!=="raw"){if(e.length===0){this.queryMode.set("raw"),this.selectedTemplateId.set(null),this.templateParams.set({});return}e.some(n=>n.id===this.selectedTemplateId())||this.selectTemplate(e[0].id);}}errorMessage(e,i){return e instanceof bi||e instanceof Error?e.message:i}static{this.\u0275fac=function(i){return new(i||t)};}static{this.\u0275cmp=ZE({type:t,selectors:[["app-view-editor"]],decls:15,vars:10,consts:[["data-testid","view-editor",1,"editor"],[1,"header"],["data-testid","page-title"],[1,"header-actions"],["routerLink","/views"],["nz-button","","nzType","primary","type","button","data-testid","save-button",3,"click","nzLoading","disabled"],["data-testid","loading"],["data-testid","load-error",1,"error"],["data-testid","validation-errors",1,"errors"],[1,"field"],["nz-input","","data-testid","view-name",3,"ngModelChange","ngModel"],["data-testid","view-workflow",3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel"],["data-testid","query-mode-toggle",1,"field"],["data-testid","view-instance-empty",1,"error"],["data-testid","view-instance-field",1,"field",3,"field-attention"],["data-testid","view-instance-field",1,"field"],["data-testid","view-instance-needed",1,"attention"],["data-testid","view-instance",3,"ngModelChange","nzPlaceHolder","ngModel"],[1,"mode-toggle"],["nz-button","","type","button","data-testid","query-mode-template",3,"click","nzType"],["nz-button","","type","button","data-testid","query-mode-raw",3,"click","nzType"],["data-testid","view-template",3,"ngModelChange","ngModel"],["nz-input","","rows","8","data-testid","view-query",3,"ngModelChange","ngModel"],["data-testid","manual-list-hint",1,"hint"],[1,"required"],[3,"ngModel"],["nzMode","tags",3,"ngModel"],["nz-input","",3,"ngModel"],[3,"ngModelChange","ngModel"],["nzMode","tags",3,"ngModelChange","ngModel"],["nz-input","",3,"ngModelChange","ngModel"],[1,"hint"]],template:function(i,n){i&1&&(_i(0,"main",0)(1,"header",1)(2,"div")(3,"h1",2),Iw(4),Jc()(),_i(5,"div",3)(6,"a",4),Iw(7),Pw(8,"transloco"),Jc(),_i(9,"button",5),mh("click",function(){return n.save()}),Iw(10),Pw(11,"transloco"),Jc()()(),_D(12,Ee,3,3,"p",6)(13,Ve,2,1,"p",7)(14,Ke,17,12),Jc()),i&2&&(gI(4),Lh(n.pageTitle()),gI(3),Lh(Fw(8,6,"views.editor.backToList")),gI(2),lh("nzLoading",n.saving())("disabled",n.loading()||!!n.loadError()),gI(),rl$1(" ",Fw(11,8,"common.save")," "),gI(2),MD(n.loading()?12:n.loadError()?13:14));},dependencies:[$8,al,er,rl,$i,v3,pf,bd,sp,fp,ai,z$1,ex,Fm,Am,Kt],styles:[".editor[_ngcontent-%COMP%]{padding:1.25rem 1.5rem 3rem;display:flex;flex-direction:column;gap:1rem}.header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start}.header-actions[_ngcontent-%COMP%]{display:flex;gap:.75rem;align-items:center}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.5rem 0}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.hint[_ngcontent-%COMP%]{font-size:.8rem;color:#78716c}.field-attention[_ngcontent-%COMP%]{border:1px solid #f59e0b;background:#fffbeb;padding:.75rem 1rem;border-radius:.35rem}.attention[_ngcontent-%COMP%]{margin:0;color:#b45309;font-size:.85rem}.mode-toggle[_ngcontent-%COMP%]{display:flex;gap:.5rem}.required[_ngcontent-%COMP%]{color:#9f1239}.errors[_ngcontent-%COMP%]{border:1px solid #fecdd3;background:#fff1f2;padding:.75rem 1rem}.errors[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0 0 .35rem;font-size:1rem}.error[_ngcontent-%COMP%]{color:#9f1239}textarea[_ngcontent-%COMP%]{font-family:ui-monospace,Consolas,monospace}"]});}}return t})();function tt(t){return t==null?true:typeof t=="string"?t.trim()==="":Array.isArray(t)?t.every(o=>String(o).trim()===""):false}export{kt as ViewEditorComponent};
@@ -1 +0,0 @@
1
- import {o as ot}from'./chunk-BIdwV0jx.js';import {_ as _n,C as Cn}from'./chunk-CPNxRF7A.js';import {f}from'./chunk-DSgUAlqN.js';import {Z as ZE,n as uh,C,V as Ve,b as at,q as qo,r as r$1,u as ue$1,c as bi,d as $8,e as al,bb as er,f as rl,g as $i,Y as pf,a0 as bd,a1 as sp,a2 as fp,K as Kt,j as _i,I as Iw,P as Pw,J as Jc,m as mh,l as _D,o as gI,L as Lh,p as Fw,z as rl$1,M as MD,H as HD,G as FD,k as iE,w as lh,y as aE,x as xD,B as AD,D as ch,O as Fu,Q as ju}from'./main-SI5AKDMC.js';import {a as ai,z}from'./chunk-BIL86kgf.js';import {p as pc,a as as,d as dc,K as Kl,c as cc,J as Ji,l as ls}from'./chunk-DAONFRT8.js';import'./chunk-CLM-K-Vg.js';var ce=(i,h)=>h.id;function de(i,h){i&1&&(_i(0,"p",3),Iw(1),Pw(2,"transloco"),Jc()),i&2&&(gI(),Lh(Fw(2,1,"common.loading")));}function me(i,h){if(i&1&&(_i(0,"p",4),Iw(1),Jc()),i&2){let e=HD();gI(),Lh(e.loadError());}}function fe(i,h){if(i&1&&(_i(0,"p",5),Iw(1),Jc()),i&2){let e=HD(2);gI(),Lh(e.deleteError());}}function he(i,h){if(i&1&&(_i(0,"p",9),Iw(1),Jc()),i&2){let e=HD(3);gI(),Lh(e.saveError());}}function ue(i,h){if(i&1){let e=FD();_i(0,"section",6),_D(1,he,2,1,"p",9),_i(2,"label",10)(3,"span"),Iw(4),Pw(5,"transloco"),Jc(),_i(6,"input",11),mh("ngModelChange",function(l){Fu(e);let d=HD(2);return ju(d.formName.set(l))}),Jc(),iE(),Jc(),_i(7,"div",10)(8,"span"),Iw(9),Pw(10,"transloco"),Jc(),_i(11,"app-path-picker",12),mh("pathChange",function(l){Fu(e);let d=HD(2);return ju(d.formLocalPath.set(l))}),Jc()(),_i(12,"div",10)(13,"span"),Iw(14),Pw(15,"transloco"),Jc(),_i(16,"p",13),Iw(17),Pw(18,"transloco"),Jc(),_i(19,"app-path-picker",12),mh("pathChange",function(l){Fu(e);let d=HD(2);return ju(d.formWorktreeBasePath.set(l))}),Jc()(),_i(20,"label",10)(21,"span"),Iw(22),Pw(23,"transloco"),Jc(),_i(24,"input",14),mh("ngModelChange",function(l){Fu(e);let d=HD(2);return ju(d.formDefaultBranch.set(l))}),Jc(),iE(),Jc(),_i(25,"div",15)(26,"button",16),mh("click",function(){Fu(e);let l=HD(2);return ju(l.submitForm())}),Iw(27),Pw(28,"transloco"),Jc(),_i(29,"button",17),mh("click",function(){Fu(e);let l=HD(2);return ju(l.cancelForm())}),Iw(30),Pw(31,"transloco"),Jc()()();}if(i&2){let e=HD(2);gI(),MD(e.saveError()?1:-1),gI(3),Lh(Fw(5,13,"local-repos.form.name")),gI(2),lh("ngModel",e.formName()),aE(),gI(3),Lh(Fw(10,15,"local-repos.form.localPath")),gI(2),lh("path",e.formLocalPath()),gI(3),Lh(Fw(15,17,"local-repos.form.worktreeBasePath")),gI(3),Lh(Fw(18,19,"local-repos.form.worktreeBaseHint")),gI(2),lh("path",e.formWorktreeBasePath()),gI(3),Lh(Fw(23,21,"local-repos.form.defaultBranch")),gI(2),lh("ngModel",e.formDefaultBranch()),aE(),gI(2),lh("disabled",e.saving()),gI(),rl$1(" ",Fw(28,23,"common.save")," "),gI(3),rl$1(" ",Fw(31,25,"common.cancel")," ");}}function _e(i,h){i&1&&(_i(0,"p",7),Iw(1),Pw(2,"transloco"),Jc()),i&2&&(gI(),Lh(Fw(2,1,"local-repos.emptyState")));}function Ce(i,h){if(i&1){let e=FD();_i(0,"tr")(1,"td"),Iw(2),Jc(),_i(3,"td",18),Iw(4),Jc(),_i(5,"td",18),Iw(6),Jc(),_i(7,"td"),Iw(8),Jc(),_i(9,"td",19)(10,"button",20),mh("click",function(){let l=Fu(e).$implicit,d=HD(3);return ju(d.openEditForm(l))}),Iw(11),Pw(12,"transloco"),Jc(),_i(13,"button",21),Pw(14,"transloco"),mh("nzOnConfirm",function(){let l=Fu(e).$implicit,d=HD(3);return ju(d.deleteRepo(l))}),Iw(15),Pw(16,"transloco"),Jc()()();}if(i&2){let e=h.$implicit;ch("data-testid","local-repo-row-"+e.id),gI(2),Lh(e.name),gI(2),Lh(e.localPath),gI(2),Lh(e.worktreeBasePath||"\u2014"),gI(2),Lh(e.defaultBranch||"\u2014"),gI(2),ch("data-testid","edit-local-repo-"+e.id),gI(),rl$1(" ",Fw(12,10,"local-repos.edit")," "),gI(2),lh("nzPopconfirmTitle",Fw(14,12,"local-repos.deleteConfirm")),ch("data-testid","delete-local-repo-"+e.id),gI(2),rl$1(" ",Fw(16,14,"local-repos.delete")," ");}}function ge(i,h){if(i&1&&(_i(0,"nz-table",8)(1,"thead")(2,"tr")(3,"th"),Iw(4),Pw(5,"transloco"),Jc(),_i(6,"th"),Iw(7),Pw(8,"transloco"),Jc(),_i(9,"th"),Iw(10),Pw(11,"transloco"),Jc(),_i(12,"th"),Iw(13),Pw(14,"transloco"),Jc(),_i(15,"th"),Iw(16),Pw(17,"transloco"),Jc()()(),_i(18,"tbody"),xD(19,Ce,17,16,"tr",null,ce),Jc()()),i&2){let e=HD(2);lh("nzData",e.repos())("nzShowPagination",false),gI(4),Lh(Fw(5,7,"local-repos.column.name")),gI(3),Lh(Fw(8,9,"local-repos.column.localPath")),gI(3),Lh(Fw(11,11,"local-repos.column.worktreeBasePath")),gI(3),Lh(Fw(14,13,"local-repos.column.defaultBranch")),gI(3),Lh(Fw(17,15,"local-repos.column.actions")),gI(3),AD(e.repos());}}function xe(i,h){if(i&1&&(_D(0,fe,2,1,"p",5),_D(1,ue,32,27,"section",6),_D(2,_e,3,3,"p",7)(3,ge,21,17,"nz-table",8)),i&2){let e=HD();MD(e.deleteError()?0:-1),gI(),MD(e.formOpen()?1:-1),gI(),MD(e.repos().length===0&&!e.formOpen()?2:e.repos().length>0?3:-1);}}var ae=(()=>{class i{constructor(){this.reposApi=C(f),this.transloco=C(Ve),this.destroyRef=C(at),this.repos=qo([]),this.loading=qo(true),this.loadError=qo(null),this.saveError=qo(null),this.deleteError=qo(null),this.saving=qo(false),this.formOpen=qo(false),this.editingId=qo(null),this.formName=qo(""),this.formLocalPath=qo(""),this.formWorktreeBasePath=qo(""),this.formDefaultBranch=qo(""),this.reload();}openCreateForm(){this.editingId.set(null),this.formName.set(""),this.formLocalPath.set(""),this.formWorktreeBasePath.set(""),this.formDefaultBranch.set(""),this.saveError.set(null),this.formOpen.set(true);}openEditForm(e){this.editingId.set(e.id),this.formName.set(e.name),this.formLocalPath.set(e.localPath),this.formWorktreeBasePath.set(e.worktreeBasePath??""),this.formDefaultBranch.set(e.defaultBranch??""),this.saveError.set(null),this.formOpen.set(true);}cancelForm(){this.formOpen.set(false),this.editingId.set(null),this.saveError.set(null);}submitForm(){if(this.saving())return;this.saveError.set(null),this.saving.set(true);let e=r$1(r$1({name:this.formName().trim(),localPath:this.formLocalPath().trim()},this.formWorktreeBasePath().trim()?{worktreeBasePath:this.formWorktreeBasePath().trim()}:{worktreeBasePath:void 0}),this.formDefaultBranch().trim()?{defaultBranch:this.formDefaultBranch().trim()}:{defaultBranch:void 0}),a=this.editingId();(a?this.reposApi.update(a,e):this.reposApi.create(e)).pipe(ue$1(this.destroyRef)).subscribe({next:d=>{this.saving.set(false),this.formOpen.set(false),this.editingId.set(null),this.repos.update(le=>[...le.filter(M=>M.id!==d.id),d].sort((M,se)=>M.name.localeCompare(se.name))),this.formName.set(""),this.formLocalPath.set(""),this.formWorktreeBasePath.set(""),this.formDefaultBranch.set("");},error:d=>{this.saving.set(false),this.saveError.set(this.errorMessage(d,this.transloco.translate("local-repos.saveFailed")));}});}deleteRepo(e){this.deleteError.set(null),this.reposApi.delete(e.id).pipe(ue$1(this.destroyRef)).subscribe({next:()=>{this.repos.update(a=>a.filter(l=>l.id!==e.id));},error:a=>{this.deleteError.set(this.errorMessage(a,this.transloco.translate("local-repos.deleteFailed")));}});}reload(){this.loading.set(true),this.loadError.set(null),this.reposApi.list().pipe(ue$1(this.destroyRef)).subscribe({next:e=>{this.repos.set(e),this.loading.set(false);},error:e=>{this.loading.set(false),this.loadError.set(this.errorMessage(e,this.transloco.translate("local-repos.loadFailed")));}});}errorMessage(e,a){return e instanceof bi||e instanceof Error?e.message:a}static{this.\u0275fac=function(a){return new(a||i)};}static{this.\u0275cmp=ZE({type:i,selectors:[["app-local-repository-list"]],decls:11,vars:7,consts:[["data-testid","local-repos-manage",1,"list-page"],[1,"header"],["nz-button","","nzType","primary","type","button","data-testid","create-local-repo",3,"click"],["data-testid","loading"],["data-testid","load-error",1,"error"],["data-testid","delete-error",1,"error"],["data-testid","local-repo-form",1,"form"],["data-testid","empty-state",1,"empty"],["data-testid","local-repo-table",3,"nzData","nzShowPagination"],["data-testid","save-error",1,"error"],[1,"field"],["nz-input","","data-testid","local-repo-name",3,"ngModelChange","ngModel"],["mode","directories",3,"pathChange","path"],[1,"hint"],["nz-input","","data-testid","local-repo-default-branch",3,"ngModelChange","ngModel"],[1,"form-actions"],["nz-button","","nzType","primary","type","button","data-testid","save-local-repo",3,"click","disabled"],["nz-button","","type","button","data-testid","cancel-local-repo",3,"click"],[1,"path-cell"],[1,"actions"],["nz-button","","nzType","link","type","button",3,"click"],["nz-button","","nzType","link","nzDanger","","type","button","nz-popconfirm","",3,"nzOnConfirm","nzPopconfirmTitle"]],template:function(a,l){a&1&&(_i(0,"div",0)(1,"header",1)(2,"h1"),Iw(3),Pw(4,"transloco"),Jc(),_i(5,"button",2),mh("click",function(){return l.openCreateForm()}),Iw(6),Pw(7,"transloco"),Jc()(),_D(8,de,3,3,"p",3)(9,me,2,1,"p",4)(10,xe,4,3),Jc()),a&2&&(gI(3),Lh(Fw(4,3,"local-repos.title")),gI(3),rl$1(" ",Fw(7,5,"local-repos.create")," "),gI(2),MD(l.loading()?8:l.loadError()?9:10));},dependencies:[$8,al,er,rl,$i,pf,bd,sp,fp,ai,z,_n,Cn,pc,as,dc,Kl,cc,Ji,ls,ot,Kt],styles:[".list-page[_ngcontent-%COMP%]{padding:1.25rem 1.5rem 3rem;display:flex;flex-direction:column;gap:1rem}.header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start}.form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.65rem;padding:.85rem;border:1px solid #e7e5e4;background:#fff}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.hint[_ngcontent-%COMP%]{margin:.2rem 0 0;font-size:.8rem;color:#78716c}.form-actions[_ngcontent-%COMP%]{display:flex;gap:.5rem}.empty[_ngcontent-%COMP%]{text-align:center;padding:2.5rem 1rem;border:1px dashed #d6d3d1;background:#fff9}.error[_ngcontent-%COMP%]{color:#9f1239}.actions[_ngcontent-%COMP%]{white-space:nowrap}.path-cell[_ngcontent-%COMP%]{overflow-wrap:anywhere;word-break:break-word}"]});}}return i})();var qe=(()=>{class i{static{this.\u0275fac=function(a){return new(a||i)};}static{this.\u0275cmp=ZE({type:i,selectors:[["app-local-repositories-manage"]],decls:1,vars:0,template:function(a,l){a&1&&uh(0,"app-local-repository-list");},dependencies:[ae],encapsulation:2});}}return i})();export{qe as LocalRepositoriesManageComponent};
@@ -1 +0,0 @@
1
- import {S as St}from'./chunk-BrP_q6LZ.js';import'./chunk-BIdwV0jx.js';import'./chunk-CPNxRF7A.js';import {Z as ZE,n as uh}from'./main-SI5AKDMC.js';import'./chunk-BIL86kgf.js';import'./chunk-5xJXPFlv.js';import'./chunk-DAONFRT8.js';import'./chunk-CLM-K-Vg.js';var c=(()=>{class e{static{this.\u0275fac=function(t){return new(t||e)};}static{this.\u0275cmp=ZE({type:e,selectors:[["app-context-files-manage"]],decls:1,vars:0,template:function(t,a){t&1&&uh(0,"app-context-file-list");},dependencies:[St],encapsulation:2});}}return e})();export{c as ContextFilesManageComponent};
@@ -1 +0,0 @@
1
- import {D,B,L,h,v,H,Q,G,J,Y,X as X$1,Z}from'./chunk-pi-mtheN.js';import {H as He}from'./chunk-hpn_m1ZC.js';import {_ as _n,C as Cn}from'./chunk-CPNxRF7A.js';import {G as Gn,u as un}from'./chunk-Ysn4Fbgj.js';import {a as ai,z}from'./chunk-BIL86kgf.js';import {I as I_,k as k_,t as tm}from'./chunk-D3JZ8ur5.js';import {W,I}from'./chunk-5xJXPFlv.js';import {p as pc,a as as,d as dc,K as Kl,c as cc,J as Ji,l as ls}from'./chunk-DAONFRT8.js';import'./chunk-CLM-K-Vg.js';import {C,b as at,V as Ve,q as qo,U as Uw,aW as Ng,u as ue,s,r as r$1,b9 as Nl,ba as Se,aX as es,aY as Dg,c as bi,Z as ZE,d as $8,e as al,bb as er,bc as Jc,f as rl,bd as Nc,g as $i,Y as pf,a0 as bd,a1 as sp,a2 as fp,h as ex,F as Fm,A as Am,K as Kt$1,j as _i,I as Iw,P as Pw,J as Jc$1,m as mh,l as _D,o as gI,L as Lh,p as Fw,z as rl$1,M as MD,a7 as KE,a8 as fu,aA as mT,be as E3,bf as _r,aa as oe,a9 as Z0,bg as Ci,aB as yT,ab as Oe,bh as Bt$1,aq as el,bi as cl,a3 as Ah,a4 as Th,as as st,at as Ee,ai as ly,av as K0,n as uh,al as Sh,w as lh,D as ch,bj as Nw,bk as St,bl as wo,ax as Eh,an as WD,ao as GD,H as HD,x as xD,B as AD,G as FD,k as iE,y as aE,aM as Yl,aw as rh,N as ND,aJ as tl,aK as nl,O as Fu,Q as ju}from'./main-SI5AKDMC.js';var Tt=["switchElement"];function wt(n,m){n&1&&uh(0,"nz-icon",3);}function It(n,m){if(n&1&&(tl(0),Iw(1),nl()),n&2){let e=HD(2);gI(),Lh(e.nzCheckedChildren);}}function Nt(n,m){if(n&1&&rh(0,It,2,1,"ng-container",6),n&2){let e=HD();lh("nzStringTemplateOutlet",e.nzCheckedChildren);}}function kt(n,m){if(n&1&&(tl(0),Iw(1),nl()),n&2){let e=HD(2);gI(),Lh(e.nzUnCheckedChildren);}}function Dt(n,m){if(n&1&&rh(0,kt,2,1,"ng-container",6),n&2){let e=HD();lh("nzStringTemplateOutlet",e.nzUnCheckedChildren);}}var Ot="switch",X=(()=>{let n,m=[],e=[];return class q{static{let i=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;n=[Yl()],mT(null,null,n,{kind:"field",name:"nzSize",static:false,private:false,access:{has:s=>"nzSize"in s,get:s=>s.nzSize,set:(s,S)=>{s.nzSize=S;}},metadata:i},m,e),i&&Object.defineProperty(this,Symbol.metadata,{enumerable:true,configurable:true,writable:true,value:i});}_nzModuleName=Ot;nzConfigService=C(E3);el=C(_r).nativeElement;ngZone=C(oe);cdr=C(Z0);focusMonitor=C(Ci);destroyRef=C(at);isChecked=false;onChange=()=>{};onTouched=()=>{};switchElement;nzLoading=false;nzDisabled=false;nzControl=false;nzCheckedChildren=null;nzUnCheckedChildren=null;nzSize=yT(this,m,"default");nzId=(yT(this,e),null);dir=C(Oe).valueSignal;isNzDisableFirstChange=true;size=qo(this.nzSize);formSize=C(Bt$1,{optional:true});finalSize=Uw(()=>this.formSize?.()||this.size());updateValue(i){this.isChecked!==i&&(this.isChecked=i,this.onChange(this.isChecked));}focus(){this.focusMonitor.focusVia(this.switchElement.nativeElement,"keyboard");}blur(){this.switchElement.nativeElement.blur();}constructor(){this.destroyRef.onDestroy(()=>{this.focusMonitor.stopMonitoring(this.switchElement.nativeElement);});}ngOnChanges(i){let{nzSize:s}=i;s&&this.size.set(s.currentValue);}ngOnInit(){el(this.el,"click").pipe(ue(this.destroyRef)).subscribe(i=>{i.preventDefault(),!(this.nzControl||this.nzDisabled||this.nzLoading)&&this.ngZone.run(()=>{this.updateValue(!this.isChecked),this.cdr.markForCheck();});}),el(this.switchElement.nativeElement,"keydown").pipe(ue(this.destroyRef)).subscribe(i=>{if(this.nzControl||this.nzDisabled||this.nzLoading)return;let{keyCode:s}=i;s!==37&&s!==39&&s!==32&&s!==13||(i.preventDefault(),this.ngZone.run(()=>{s===37?this.updateValue(false):s===39?this.updateValue(true):(s===32||s===13)&&this.updateValue(!this.isChecked),this.cdr.markForCheck();}));});}ngAfterViewInit(){this.focusMonitor.monitor(this.switchElement.nativeElement,true).pipe(ue(this.destroyRef)).subscribe(i=>{i||Promise.resolve().then(()=>this.onTouched());});}writeValue(i){this.isChecked=i,this.cdr.markForCheck();}registerOnChange(i){this.onChange=i;}registerOnTouched(i){this.onTouched=i;}setDisabledState(i){this.nzDisabled=this.isNzDisableFirstChange&&this.nzDisabled||i,this.isNzDisableFirstChange=false,this.cdr.markForCheck();}static \u0275fac=function(s){return new(s||q)};static \u0275cmp=ZE({type:q,selectors:[["nz-switch"]],viewQuery:function(s,S){if(s&1&&Eh(Tt,7),s&2){let j;WD(j=GD())&&(S.switchElement=j.first);}},inputs:{nzLoading:[2,"nzLoading","nzLoading",K0],nzDisabled:[2,"nzDisabled","nzDisabled",K0],nzControl:[2,"nzControl","nzControl",K0],nzCheckedChildren:"nzCheckedChildren",nzUnCheckedChildren:"nzUnCheckedChildren",nzSize:"nzSize",nzId:"nzId"},exportAs:["nzSwitch"],features:[Nw([{provide:St,useExisting:wo(()=>q),multi:true}]),ly],decls:8,vars:15,consts:[["switchElement",""],["nz-wave","","type","button",1,"ant-switch",3,"disabled","nzWaveExtraNode"],[1,"ant-switch-handle"],["nzType","loading",1,"ant-switch-loading-icon"],[1,"ant-switch-inner"],[1,"ant-click-animating-node"],[4,"nzStringTemplateOutlet"]],template:function(s,S){s&1&&(_i(0,"button",1,0)(2,"span",2),_D(3,wt,1,0,"nz-icon",3),Jc$1(),_i(4,"span",4),_D(5,Nt,1,1,"ng-container")(6,Dt,1,1,"ng-container"),Jc$1(),uh(7,"div",5),Jc$1()),s&2&&(Sh("ant-switch-checked",S.isChecked)("ant-switch-loading",S.nzLoading)("ant-switch-disabled",S.nzDisabled)("ant-switch-small",S.finalSize()==="small")("ant-switch-rtl",S.dir()==="rtl"),lh("disabled",S.nzDisabled)("nzWaveExtraNode",true),ch("id",S.nzId),gI(3),MD(S.nzLoading?3:-1),gI(2),MD(S.isChecked?5:6));},dependencies:[cl,fp,Ah,Th,st,Ee],encapsulation:2})}})(),xt=(()=>{class n{static \u0275fac=function(t){return new(t||n)};static \u0275mod=KE({type:n});static \u0275inj=fu({imports:[X]})}return n})();var ee=(n,m)=>m.id,Pt=(n,m)=>m.key;function Rt(n,m){n&1&&(_i(0,"div",4),uh(1,"nz-alert",9),Pw(2,"transloco"),Jc$1()),n&2&&(gI(),lh("nzMessage",Fw(2,1,"settings.restartRequired.message")));}function At(n,m){n&1&&(_i(0,"p",5),Iw(1),Pw(2,"transloco"),Jc$1()),n&2&&(gI(),Lh(Fw(2,1,"common.loading")));}function Ft(n,m){if(n&1&&(_i(0,"p",6),Iw(1),Jc$1()),n&2){let e=HD();gI(),Lh(e.loadError());}}function Bt(n,m){if(n&1&&(_i(0,"nz-tag",11),Iw(1),Pw(2,"transloco"),Jc$1()),n&2){let e=HD().$implicit;ch("data-testid",e.id+"-default-chip"),gI(),Lh(Fw(2,2,"settings.defaultAgent.label"));}}function Lt(n,m){if(n&1&&(_i(0,"nz-tag",17),Iw(1),Pw(2,"transloco"),Jc$1()),n&2){let e=m,t=HD(2).$implicit,i=HD(2);lh("nzColor",i.testResultTone(e)),ch("title",e.message??"")("data-testid",t.id+"-test-result"),gI(),rl$1(" ",Fw(2,4,i.testResultLabelKey(e))," ");}}function Kt(n,m){if(n&1){let e=FD();_i(0,"span",13)(1,"button",16),mh("click",function(){Fu(e);let i=HD().$implicit,s=HD(2);return ju(s.testSavedConnection(i))}),Iw(2),Pw(3,"transloco"),Jc$1(),_D(4,Lt,3,6,"nz-tag",17),Jc$1();}if(n&2){let e,t=HD().$implicit,i=HD(2);gI(),lh("nzLoading",i.listTestState(t.id)?.running===true)("disabled",i.listTestState(t.id)?.running===true),ch("data-testid",t.id+"-test-connection"),gI(),rl$1(" ",Fw(3,5,"settings.testConnection")," "),gI(2),MD((e=i.listTestState(t.id)?.result)?4:-1,e);}}function $t(n,m){if(n&1){let e=FD();_i(0,"tr")(1,"td",10)(2,"span"),Iw(3),Jc$1(),_D(4,Bt,3,4,"nz-tag",11),Jc$1(),_i(5,"td")(6,"nz-tag"),Iw(7),Pw(8,"transloco"),Jc$1()(),_i(9,"td"),Iw(10),Jc$1(),_i(11,"td",12),_D(12,Kt,5,7,"span",13),_i(13,"button",14),mh("click",function(){let i=Fu(e).$implicit,s=HD(2);return ju(s.openEdit(i))}),Iw(14),Pw(15,"transloco"),Jc$1(),_i(16,"button",15),Pw(17,"transloco"),Pw(18,"transloco"),Pw(19,"transloco"),mh("nzOnConfirm",function(){let i=Fu(e).$implicit,s=HD(2);return ju(s.removeInstance(i.id))}),Iw(20),Pw(21,"transloco"),Jc$1()()();}if(n&2){let e=m.$implicit,t=HD(2);ch("data-testid","instance-"+e.id),gI(),ch("data-testid",e.id+"-name"),gI(2),Lh(e.displayName),gI(),MD(t.isDefaultAgent(e)?4:-1),gI(2),ch("data-testid",e.id+"-type"),gI(),Lh(Fw(8,16,t.typeLabelKey(e))),gI(2),ch("data-testid",e.id+"-expires"),gI(),rl$1(" ",e.expiresOn??""," "),gI(2),MD(t.supportsTestConnection(e.type)?12:-1),gI(),ch("data-testid",e.id+"-edit"),gI(),rl$1(" ",Fw(15,18,"settings.edit")," "),gI(2),lh("nzPopconfirmTitle",Fw(17,20,"settings.deleteConfirm"))("nzOkText",Fw(18,22,"settings.delete"))("nzCancelText",Fw(19,24,"common.cancel")),ch("data-testid",e.id+"-delete"),gI(4),rl$1(" ",Fw(21,26,"settings.delete")," ");}}function qt(n,m){if(n&1&&(_i(0,"nz-table",7)(1,"thead")(2,"tr")(3,"th"),Iw(4),Pw(5,"transloco"),Jc$1(),_i(6,"th"),Iw(7),Pw(8,"transloco"),Jc$1(),_i(9,"th"),Iw(10),Pw(11,"transloco"),Jc$1(),_i(12,"th"),Iw(13),Pw(14,"transloco"),Jc$1()()(),_i(15,"tbody"),xD(16,$t,22,28,"tr",null,ee),Jc$1()()),n&2){let e=HD();lh("nzData",e.instances())("nzFrontPagination",false)("nzShowPagination",false),gI(4),Lh(Fw(5,7,"settings.column.displayName")),gI(3),Lh(Fw(8,9,"settings.column.type")),gI(3),Lh(Fw(11,11,"settings.column.expiresOn")),gI(3),Lh(Fw(14,13,"settings.column.actions")),gI(3),AD(e.instances());}}function jt(n,m){if(n&1&&(_i(0,"li"),Iw(1),Jc$1()),n&2){let e=m.$implicit;gI(),Lh(e);}}function Ut(n,m){if(n&1&&(_i(0,"section",19)(1,"h3"),Iw(2),Pw(3,"transloco"),Jc$1(),_i(4,"ul"),xD(5,jt,2,1,"li",null,ND),Jc$1()()),n&2){let e=HD(2);gI(2),Lh(Fw(3,1,"settings.validation")),gI(3),AD(e.validationErrors());}}function Wt(n,m){if(n&1&&(_i(0,"p",20),Iw(1),Jc$1()),n&2){let e=HD(2);gI(),Lh(e.secretSaveError());}}function Zt(n,m){if(n&1&&(uh(0,"nz-option",27),Pw(1,"transloco")),n&2){let e=m.$implicit;lh("nzValue",e.id)("nzLabel",Fw(1,2,e.labelKey));}}function Ht(n,m){if(n&1){let e=FD();_i(0,"label",21)(1,"span"),Iw(2),Pw(3,"transloco"),Jc$1(),_i(4,"input",37),mh("ngModelChange",function(i){let s=Fu(e).$implicit,S=HD(2);return ju(S.setDraftConfig(s.key,i))}),Jc$1(),iE(),Jc$1();}if(n&2){let e=m.$implicit,t=HD(2);gI(2),Lh(Fw(3,3,e.labelKey)),gI(2),lh("ngModel",t.configValue(t.draft().config,e.key)),ch("data-testid","provider-config-"+e.key),aE();}}function Qt(n,m){if(n&1){let e=FD();_i(0,"button",38),mh("click",function(){Fu(e);let i=HD(2);return ju(i.fetchModels())}),Iw(1),Pw(2,"transloco"),Jc$1();}if(n&2){let e=HD(2);lh("nzLoading",e.fetchingModels())("disabled",!e.canFetchModels()),gI(),rl$1(" ",Fw(2,3,"settings.model.fetch")," ");}}function Gt(n,m){if(n&1){let e=FD();_i(0,"button",39),mh("click",function(){Fu(e);let i=HD(2);return ju(i.testDraftConnection())}),Iw(1),Pw(2,"transloco"),Jc$1();}if(n&2){let e=HD(2);lh("nzLoading",e.modalTestRunning())("disabled",!e.canTestConnection()),gI(),rl$1(" ",Fw(2,3,"settings.testConnection")," ");}}function Jt(n,m){if(n&1&&(_i(0,"p",41),Iw(1),Jc$1()),n&2){let e=HD();Sh("warning",e.identityMismatch)("error",!e.success),gI(),rl$1(" ",e.message," ");}}function Yt(n,m){if(n&1&&(_i(0,"div",32)(1,"nz-tag",17),Iw(2),Pw(3,"transloco"),Jc$1(),_D(4,Jt,2,5,"p",40),Jc$1()),n&2){let e=m,t=HD(2);gI(),lh("nzColor",t.testResultTone(e)),gI(),rl$1(" ",Fw(3,3,t.testResultLabelKey(e))," "),gI(2),MD(e.message?4:-1);}}function Xt(n,m){if(n&1&&uh(0,"nz-option",27),n&2){let e=HD(3);lh("nzValue",e.configValue(e.draft().config,"model"))("nzLabel",e.configValue(e.draft().config,"model"));}}function ei(n,m){if(n&1&&uh(0,"nz-option",27),n&2){let e=m.$implicit;lh("nzValue",e.id)("nzLabel",e.displayName);}}function ti(n,m){if(n&1&&(_i(0,"p",43),Iw(1),Jc$1()),n&2){let e=HD(3);gI(),Lh(e.modelsError());}}function ii(n,m){if(n&1){let e=FD();_i(0,"div",21)(1,"span"),Iw(2),Pw(3,"transloco"),Jc$1(),_i(4,"nz-select",42),Pw(5,"transloco"),mh("ngModelChange",function(i){Fu(e);let s=HD(2);return ju(s.setDraftConfig("model",i??""))}),_D(6,Xt,1,2,"nz-option",27),xD(7,ei,1,2,"nz-option",27,ee),Jc$1(),iE(),_D(9,ti,2,1,"p",43),_i(10,"p",25),Iw(11),Pw(12,"transloco"),Jc$1()(),_i(13,"label",21)(14,"span"),Iw(15),Pw(16,"transloco"),Jc$1(),_i(17,"input",44),mh("ngModelChange",function(i){Fu(e);let s=HD(2);return ju(s.setMaxConcurrent(i))}),Jc$1(),iE(),_i(18,"p",25),Iw(19),Pw(20,"transloco"),Jc$1()(),_i(21,"label",45)(22,"span"),Iw(23),Pw(24,"transloco"),Jc$1(),_i(25,"nz-switch",46),mh("ngModelChange",function(i){Fu(e);let s=HD(2);return ju(s.setDefaultAgentDraft(i))}),Jc$1(),iE(),Jc$1();}if(n&2){let e=HD(2);gI(2),Lh(Fw(3,11,"settings.model.label")),gI(2),lh("nzPlaceHolder",Fw(5,13,"settings.model.placeholder"))("ngModel",e.configValue(e.draft().config,"model")),aE(),gI(2),MD(e.selectedModelMissingFromList()?6:-1),gI(),AD(e.availableModels()),gI(2),MD(e.modelsError()?9:-1),gI(2),Lh(Fw(12,15,"settings.model.hint")),gI(4),Lh(Fw(16,17,"settings.maxConcurrent.label")),gI(2),lh("ngModel",e.draft().maxConcurrent),aE(),gI(2),Lh(Fw(20,19,"settings.maxConcurrent.hint")),gI(4),Lh(Fw(24,21,"settings.defaultAgent.toggle")),gI(2),lh("ngModel",e.draft().defaultAgent),aE();}}function ni(n,m){if(n&1){let e=FD();_i(0,"div",8)(1,"div",18)(2,"h2"),Iw(3),Pw(4,"transloco"),Jc$1(),_D(5,Ut,7,3,"section",19),_D(6,Wt,2,1,"p",20),_i(7,"label",21)(8,"span"),Iw(9),Pw(10,"transloco"),Jc$1(),_i(11,"input",22),mh("ngModelChange",function(i){Fu(e);let s=HD();return ju(s.onDisplayNameChange(i))}),Jc$1(),iE(),Jc$1(),_i(12,"label",23)(13,"span"),Iw(14),Pw(15,"transloco"),Jc$1(),_i(16,"input",24),mh("ngModelChange",function(i){Fu(e);let s=HD();return ju(s.onIdChange(i))}),Jc$1(),iE(),_i(17,"p",25),Iw(18),Pw(19,"transloco"),Jc$1()(),_i(20,"div",21)(21,"span"),Iw(22),Pw(23,"transloco"),Jc$1(),_i(24,"nz-select",26),mh("ngModelChange",function(i){Fu(e);let s=HD();return ju(s.onTypeChange(i))}),xD(25,Zt,2,4,"nz-option",27,ee),Jc$1(),iE(),Jc$1(),xD(27,Ht,5,5,"label",21,Pt),_i(29,"label",21)(30,"span"),Iw(31),Pw(32,"transloco"),Jc$1(),_i(33,"div",28)(34,"input",29),Pw(35,"transloco"),mh("ngModelChange",function(i){Fu(e);let s=HD();return ju(s.setSecretValue(i))}),Jc$1(),iE(),_D(36,Qt,3,5,"button",30),_D(37,Gt,3,5,"button",31),Jc$1(),_D(38,Yt,5,5,"div",32),Jc$1(),_D(39,ii,26,23),_i(40,"label",21)(41,"span"),Iw(42),Pw(43,"transloco"),Jc$1(),_i(44,"input",33),mh("ngModelChange",function(i){Fu(e);let s=HD();return ju(s.setExpiresOn(i))}),Jc$1(),iE(),_i(45,"p",25),Iw(46),Pw(47,"transloco"),Jc$1()(),_i(48,"div",34)(49,"button",35),mh("click",function(){Fu(e);let i=HD();return ju(i.closeModal())}),Iw(50),Pw(51,"transloco"),Jc$1(),_i(52,"button",36),mh("click",function(){Fu(e);let i=HD();return ju(i.saveModal())}),Iw(53),Pw(54,"transloco"),Jc$1()()()();}if(n&2){let e,t=HD();gI(3),rl$1(" ",Fw(4,23,t.draft().originalId?"settings.editProvider":"settings.addProvider")," "),gI(2),MD(t.validationErrors().length>0?5:-1),gI(),MD(t.secretSaveError()?6:-1),gI(3),Lh(Fw(10,25,"settings.displayName")),gI(2),lh("ngModel",t.draft().displayName),aE(),gI(3),Lh(Fw(15,27,"settings.instanceId")),gI(2),lh("ngModel",t.draft().id),aE(),gI(2),Lh(Fw(19,29,"settings.instanceIdHint")),gI(4),Lh(Fw(23,31,"settings.type.label")),gI(2),lh("ngModel",t.draft().optionId),aE(),gI(),AD(t.typeOptions),gI(2),AD(t.configFields(t.draft().type)),gI(4),Lh(Fw(32,33,"settings.apiKey.label")),gI(3),lh("ngModel",t.draft().secretValue)("placeholder",Fw(35,35,t.draft().originalId?"settings.apiKey.placeholderEdit":"settings.apiKey.placeholderCreate")),aE(),gI(2),MD(t.draft().kind==="agent"?36:-1),gI(),MD(t.supportsTestConnection(t.draft().type)?37:-1),gI(),MD((e=t.modalTestResult())?38:-1,e),gI(),MD(t.draft().kind==="agent"?39:-1),gI(3),Lh(Fw(43,37,"settings.expiresOn.label")),gI(2),lh("ngModel",t.draft().expiresOn),aE(),gI(2),Lh(Fw(47,39,"settings.expiresOn.hint")),gI(4),rl$1(" ",Fw(51,41,"common.cancel")," "),gI(2),lh("nzLoading",t.saving()),gI(),rl$1(" ",Fw(54,43,"common.save")," ");}}var Xi=(()=>{class n{constructor(){this.api=C(D),this.providersApi=C(B),this.message=C(He),this.destroyRef=C(at),this.transloco=C(Ve),this.loaded=qo({providerInstances:[]}),this.status=qo([]),this.draft=qo(L()),this.loading=qo(true),this.saving=qo(false),this.loadError=qo(null),this.validationErrors=qo([]),this.secretSaveError=qo(null),this.restartRequired=qo(false),this.modalOpen=qo(false),this.availableModels=qo([]),this.fetchingModels=qo(false),this.modelsError=qo(null),this.listTests=qo({}),this.modalTestRunning=qo(false),this.modalTestResult=qo(null),this.instances=Uw(()=>this.loaded().providerInstances??[]),this.typeOptions=h,this.configFields=v,this.typeLabelKey=H,this.isAgent=I_,this.supportsTestConnection=k_,Ng({settings:this.api.getSettings(),status:this.api.getProviderStatus()}).pipe(ue(this.destroyRef)).subscribe({next:({settings:e,status:t})=>{this.applySettings(e,false),this.status.set(t),this.loading.set(false);},error:e=>{this.loading.set(false),this.loadError.set(this.errorMessage(e,this.transloco.translate("settings.loadFailed")));}});}configValue(e,t){let i=e[t];return typeof i=="string"?i:""}isDefaultAgent(e){return I_(e)&&this.loaded().defaultAgentInstanceId===e.id}selectedModelMissingFromList(){let e=this.configValue(this.draft().config,"model");return e?!this.availableModels().some(t=>t.id===e):false}canFetchModels(){let e=this.draft();return e.kind==="agent"&&(e.secretValue.trim().length>0||e.originalId!=null)}canTestConnection(){let e=this.draft();return k_(e.type)&&(e.secretValue.trim().length>0||e.originalId!=null)}listTestState(e){return this.listTests()[e]}testResultTone(e){return e.identityMismatch?"warning":e.success?"success":"error"}testResultLabelKey(e){return e.identityMismatch?"settings.testConnection.mismatch":e.success?"settings.testConnection.connected":"settings.testConnection.failed"}openCreate(){this.resetModal(L());}openEdit(e){this.resetModal(Q(e,this.isDefaultAgent(e)));}closeModal(){this.modalOpen.set(false);}onDisplayNameChange(e){this.draft.update(t=>G(t,e,this.existingIds(t)));}onIdChange(e){this.draft.update(t=>J(t,e));}onTypeChange(e){this.availableModels.set([]),this.modelsError.set(null),this.modalTestResult.set(null),this.draft.update(t=>{let i=Y(t,e);return i.kind!=="agent"||t.kind==="agent"?i:s(r$1({},i),{defaultAgent:this.shouldDefaultNewAgent(t)})});}setDraftConfig(e,t){this.draft.update(i=>s(r$1({},i),{config:s(r$1({},i.config),{[e]:t})}));}setSecretValue(e){this.draft.update(t=>s(r$1({},t),{secretValue:e}));}setExpiresOn(e){this.draft.update(t=>s(r$1({},t),{expiresOn:e}));}setDefaultAgentDraft(e){this.draft.update(t=>s(r$1({},t),{defaultAgent:e}));}setMaxConcurrent(e){let t=typeof e=="number"?e:Number(e),i=Number.isFinite(t)&&t>=1?Math.floor(t):1;this.draft.update(s$1=>s(r$1({},s$1),{maxConcurrent:i}));}fetchModels(){let e=this.draft();if(e.kind!=="agent"||!this.canFetchModels())return;let t=e.secretValue.trim();this.fetchingModels.set(true),this.modelsError.set(null),this.providersApi.previewModels(t?{type:e.type,apiKey:t}:{type:e.type,instanceId:e.originalId}).pipe(ue(this.destroyRef)).subscribe({next:i=>{this.availableModels.set(i),this.fetchingModels.set(false);},error:i=>{this.fetchingModels.set(false),this.modelsError.set(this.errorMessage(i,this.transloco.translate("settings.model.fetchFailed")));}});}testSavedConnection(e){k_(e.type)&&(this.listTests()[e.id]?.running||(this.listTests.update(t=>s(r$1({},t),{[e.id]:{running:true,result:t[e.id]?.result}})),this.api.testProviderConnection(e.id).pipe(ue(this.destroyRef)).subscribe({next:t=>{this.listTests.update(i=>s(r$1({},i),{[e.id]:{running:false,result:t}}));},error:t=>{this.listTests.update(i=>s(r$1({},i),{[e.id]:{running:false,result:{success:false,message:this.errorMessage(t,this.transloco.translate("settings.testConnection.failed"))}}}));}})));}testDraftConnection(){let e=this.draft();if(!this.canTestConnection()||this.modalTestRunning())return;let t=e.secretValue.trim();this.modalTestRunning.set(true),this.modalTestResult.set(null),this.providersApi.testConnection(t?{type:e.type,config:e.config,apiKey:t}:{type:e.type,config:e.config,instanceId:e.originalId}).pipe(ue(this.destroyRef)).subscribe({next:i=>{this.modalTestRunning.set(false),this.modalTestResult.set(i);},error:i=>{this.modalTestRunning.set(false),this.modalTestResult.set({success:false,message:this.errorMessage(i,this.transloco.translate("settings.testConnection.failed"))});}});}saveModal(){let e=this.draft();if(this.validationErrors.set([]),this.secretSaveError.set(null),!e.displayName.trim()){this.validationErrors.set([this.transloco.translate("settings.displayNameRequired")]);return}if(e.originalId==null&&!e.secretValue.trim()){this.validationErrors.set([this.transloco.translate("settings.apiKey.required")]);return}let t=tm.safeParse(X$1(e));if(!t.success){this.validationErrors.set(Z(t.error));return}this.saving.set(true);let i=t.data,s$1=i.kind==="agent"?{defaultAgent:e.defaultAgent}:{};(e.originalId==null?this.api.createProviderInstance(r$1(r$1({},i),s$1)):this.api.updateProviderInstance(e.originalId,r$1(r$1({displayName:i.displayName,config:i.config,secretKey:i.secretKey,expiresOn:i.expiresOn??null},i.kind==="agent"?{maxConcurrent:i.maxConcurrent}:{}),s$1))).pipe(Nl(D=>{this.applySettings(D.settings,D.restartRequired);let P=e.secretValue.trim();return P?this.api.setSecret(i.secretKey,P).pipe(Se(()=>({kind:"ok"})),es(vt=>Dg({kind:"secret-failed",err:vt}))):Dg({kind:"ok"})}),ue(this.destroyRef)).subscribe({next:D=>{if(this.saving.set(false),D.kind==="secret-failed"){this.draft.update(P=>s(r$1({},P),{originalId:i.id,id:i.id,idAutoSync:false,secretKey:i.secretKey})),this.secretSaveError.set(this.errorMessage(D.err,this.transloco.translate("settings.apiKey.setFailedAfterSave"))),this.refreshStatus();return}this.modalOpen.set(false),this.refreshStatus();},error:D=>{this.saving.set(false),this.message.error(this.errorMessage(D,this.transloco.translate("settings.saveFailed")));}});}removeInstance(e){this.api.deleteProviderInstance(e).subscribe({next:t=>this.applySettings(t.settings,t.restartRequired),error:t=>{this.message.error(this.errorMessage(t,this.transloco.translate("settings.saveFailed")));}});}resetModal(e){this.validationErrors.set([]),this.secretSaveError.set(null),this.availableModels.set([]),this.modelsError.set(null),this.fetchingModels.set(false),this.modalTestRunning.set(false),this.modalTestResult.set(null),this.draft.set(e),this.modalOpen.set(true);}shouldDefaultNewAgent(e){return e.originalId&&e.originalId===this.loaded().defaultAgentInstanceId?true:!this.loaded().defaultAgentInstanceId}existingIds(e){return this.instances().map(t=>t.id).filter(t=>t!==e.originalId)}applySettings(e,t){let i=e.providerInstances??[];this.loaded.set(r$1({providerInstances:i},e.defaultAgentInstanceId?{defaultAgentInstanceId:e.defaultAgentInstanceId}:{})),t&&this.restartRequired.set(true);}refreshStatus(){this.api.getProviderStatus().subscribe({next:e=>this.status.set(e),error:()=>{}});}errorMessage(e,t){return e instanceof bi||e instanceof Error?e.message:t}static{this.\u0275fac=function(t){return new(t||n)};}static{this.\u0275cmp=ZE({type:n,selectors:[["app-settings"]],decls:17,vars:12,consts:[["data-testid","settings-page",1,"settings"],[1,"header"],[1,"lede"],["nz-button","","nzType","primary","type","button","data-testid","add-provider",3,"click"],["data-testid","restart-required-banner"],["data-testid","loading"],["data-testid","load-error",1,"error"],["data-testid","provider-instances",3,"nzData","nzFrontPagination","nzShowPagination"],["data-testid","provider-modal",1,"modal-backdrop"],["nzType","warning","nzShowIcon","","nzBanner","",3,"nzMessage"],[1,"name-cell"],["nzColor","blue"],[1,"actions"],[1,"test-connection"],["nz-button","","nzType","link","type","button",3,"click"],["nz-button","","nzType","link","nzDanger","","type","button","nz-popconfirm","",3,"nzOnConfirm","nzPopconfirmTitle","nzOkText","nzCancelText"],["nz-button","","nzType","link","type","button",3,"click","nzLoading","disabled"],[3,"nzColor"],["role","dialog",1,"modal-panel"],["data-testid","validation-errors",1,"errors"],["data-testid","secret-save-error",1,"error"],[1,"field"],["nz-input","","data-testid","provider-display-name",3,"ngModelChange","ngModel"],[1,"field","field-id"],["nz-input","","data-testid","provider-id",3,"ngModelChange","ngModel"],[1,"hint"],["data-testid","provider-type",3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel"],[1,"api-key-row"],["nz-input","","type","password","autocomplete","off","data-testid","provider-api-key",3,"ngModelChange","ngModel","placeholder"],["nz-button","","type","button","data-testid","provider-fetch-models",3,"nzLoading","disabled"],["nz-button","","type","button","data-testid","provider-test-connection",3,"nzLoading","disabled"],["data-testid","provider-test-result",1,"test-result-row"],["nz-input","","type","date","data-testid","provider-expires-on",3,"ngModelChange","ngModel"],[1,"modal-actions"],["nz-button","","type","button","data-testid","provider-cancel",3,"click"],["nz-button","","nzType","primary","type","button","data-testid","provider-save",3,"click","nzLoading"],["nz-input","",3,"ngModelChange","ngModel"],["nz-button","","type","button","data-testid","provider-fetch-models",3,"click","nzLoading","disabled"],["nz-button","","type","button","data-testid","provider-test-connection",3,"click","nzLoading","disabled"],["data-testid","provider-test-result-message",1,"test-result-message",3,"warning","error"],["data-testid","provider-test-result-message",1,"test-result-message"],["data-testid","provider-model","nzAllowClear","",3,"ngModelChange","nzPlaceHolder","ngModel"],["data-testid","provider-models-error",1,"error"],["nz-input","","type","number","min","1","step","1","data-testid","provider-max-concurrent",3,"ngModelChange","ngModel"],[1,"field","field-switch"],["data-testid","provider-default-agent",3,"ngModelChange","ngModel"]],template:function(t,i){t&1&&(_i(0,"main",0)(1,"header",1)(2,"div")(3,"h1"),Iw(4),Pw(5,"transloco"),Jc$1(),_i(6,"p",2),Iw(7),Pw(8,"transloco"),Jc$1()(),_i(9,"button",3),mh("click",function(){return i.openCreate()}),Iw(10),Pw(11,"transloco"),Jc$1()(),_D(12,Rt,3,3,"div",4),_D(13,At,3,3,"p",5)(14,Ft,2,1,"p",6)(15,qt,18,15,"nz-table",7),_D(16,ni,55,45,"div",8),Jc$1()),t&2&&(gI(4),Lh(Fw(5,6,"settings.title")),gI(3),Lh(Fw(8,8,"settings.lede")),gI(3),rl$1(" ",Fw(11,10,"settings.addProvider")," "),gI(2),MD(i.restartRequired()?12:-1),gI(),MD(i.loading()?13:i.loadError()?14:15),gI(3),MD(i.modalOpen()?16:-1));},dependencies:[$8,al,er,Jc,rl,Nc,$i,Gn,un,pf,bd,sp,fp,ai,z,_n,Cn,ex,Fm,Am,xt,X,pc,as,dc,Kl,cc,Ji,ls,W,I,Kt$1],styles:[".settings[_ngcontent-%COMP%]{padding:1.25rem 1.5rem 3rem;display:flex;flex-direction:column;gap:1rem}.header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start}.lede[_ngcontent-%COMP%]{margin:.25rem 0 0;color:#57534e}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.5rem 0}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.field-id[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{font-family:ui-monospace,Consolas,monospace;font-size:.85rem;color:#57534e}.hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:#78716c}.errors[_ngcontent-%COMP%]{border:1px solid #fecdd3;background:#fff1f2;padding:.75rem 1rem}.errors[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin:0 0 .35rem;font-size:1rem}.error[_ngcontent-%COMP%]{color:#9f1239}.actions[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.15rem .25rem}.test-connection[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.35rem}.api-key-row[_ngcontent-%COMP%]{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap}.api-key-row[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{flex:1;min-width:10rem}.test-result-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:flex-start;gap:.4rem .6rem;margin-top:.45rem}.test-result-message[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:#57534e;flex:1;min-width:12rem}.test-result-message.warning[_ngcontent-%COMP%]{color:#b45309}.test-result-message.error[_ngcontent-%COMP%]{color:#9f1239}.field-switch[_ngcontent-%COMP%]{flex-direction:row;align-items:center;justify-content:space-between}.modal-backdrop[_ngcontent-%COMP%]{position:fixed;inset:0;z-index:1000;display:flex;align-items:flex-start;justify-content:center;padding:4rem 1rem 2rem;background:#1c191759}.modal-panel[_ngcontent-%COMP%]{width:min(32rem,100%);max-height:calc(100vh - 6rem);overflow:auto;background:#fff;border-radius:.5rem;padding:1.25rem 1.5rem 1.5rem;box-shadow:0 10px 30px #1c19172e}.modal-panel[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0 0 .75rem;font-size:1.15rem}.modal-actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:.5rem;margin-top:1rem}"]});}}return n})();export{Xi as ProvidersManageComponent,Xi as SettingsComponent};
@@ -1 +0,0 @@
1
- import {A as At}from'./chunk-B_R_vsLt.js';import'./chunk-DvWh-Q5D.js';import {l}from'./chunk-D19C8Gcb.js';import {I,_,b as b$1,v,T,y,h,E,P,A,j}from'./chunk-DVJ9L-aC.js';import {D,B,V,z as z$1}from'./chunk-pi-mtheN.js';import {H as He}from'./chunk-hpn_m1ZC.js';import {z as ze,S as St}from'./chunk-BrP_q6LZ.js';import {o as ot$2}from'./chunk-BIdwV0jx.js';import'./chunk-CPNxRF7A.js';import {f}from'./chunk-DSgUAlqN.js';import {C,a as C1,R as J1,b as at,V as Ve,bo as O,bp as de,ba as Se,q as qo$1,U as Uw,u as ue,s,r as r$1,c as bi$1,Z as ZE,d as $8,e as al,bb as er$1,f as rl,g as $i$1,v as v3,Y as pf,a0 as bd,a1 as sp,a2 as fp,h as ex,F as Fm,A as Am,K as Kt,j as _i$1,I as Iw,J as Jc,P as Pw,l as _D,m as mh,o as gI,L as Lh,p as Fw,M as MD,w as lh,z as rl$1,b0 as jn$1,a5 as q0,a6 as U0,T as id,t as t$1,bq as Ja,b1 as ts,x as xD,D as ch,B as AD,G as FD,H as HD,k as iE,N as ND,aO as SD,y as aE,a7 as KE,a8 as fu,aE as J0,av as K0,br as pn,bs as G0,bf as _r$1,bt as Ee,bg as Ci$1,ab as Oe,bu as ml,aD as Nr,bh as Bt,bv as pl,bw as Gw,bx as z0,by as Qr,bz as tl,bA as kr,bB as Xf,W as qw,bC as il,a3 as Ah,a4 as Th,bD as hl,au as w5,aj as $D,aw as rh,aT as Vw,bj as Nw,bk as St$1,bE as fn,bl as wo$1,bF as oD,bG as ir$1,aG as lw,bH as wh,bI as zD,bJ as Dh,bK as W0,bm as Xc,bL as yh,bn as el,al as Sh,n as uh,az as jw,E as Aw,aH as QD,O as Fu,Q as ju,bM as Hh,bN as Vh,ak as UD,aL as Fh,aR as xw,bO as Tw}from'./main-SI5AKDMC.js';import {b}from'./chunk-Dx92ksvP.js';import {N as Nt,K as Ke}from'./chunk-BCHj6l85.js';import {G as Gn$1,u as un}from'./chunk-Ysn4Fbgj.js';import {a as ai$1,z,o as ot$1,b as at$1,i as it$1,r as rt}from'./chunk-BIL86kgf.js';import {z as z_,A as Ad,i as i_,n as ng,a as im,V as V_,c as nm,R as R_,d as A_,b as bg,e as Uu,S as S_}from'./chunk-D3JZ8ur5.js';import {W,I as I$1}from'./chunk-5xJXPFlv.js';import {L as Lt,u as ut}from'./chunk-DAONFRT8.js';import'./chunk-CLM-K-Vg.js';var Dn=["input"],Ln=["inputNumberHost"],On=[[["","nzInputAddonBefore",""]],[["","nzInputAddonAfter",""]],[["","nzInputPrefix",""]],[["","nzInputSuffix",""]],[["","nzInputNumberUpIcon",""]],[["","nzInputNumberDownIcon",""]]],Wn=["[nzInputAddonBefore]","[nzInputAddonAfter]","[nzInputPrefix]","[nzInputSuffix]","[nzInputNumberUpIcon]","[nzInputNumberDownIcon]"];function jn(i,l){}function Rn(i,l){if(i&1&&rh(0,jn,0,0,"ng-template",8),i&2){HD();let e=QD(4);lh("ngTemplateOutlet",e);}}function Kn(i,l){}function Hn(i,l){if(i&1&&rh(0,Kn,0,0,"ng-template",8),i&2){HD();let e=QD(8);lh("ngTemplateOutlet",e);}}function qn(i,l){}function Gn(i,l){if(i&1&&rh(0,qn,0,0,"ng-template",8),i&2){HD();let e=QD(12);lh("ngTemplateOutlet",e);}}function Un(i,l){if(i&1&&Iw(0),i&2){let e=HD(3);Lh(e.nzAddonBefore());}}function Jn(i,l){i&1&&(_i$1(0,"div",10),UD(1,0,null,Un,1,1),Jc());}function Zn(i,l){}function Qn(i,l){if(i&1&&rh(0,Zn,0,0,"ng-template",8),i&2){HD(2);let e=QD(6);lh("ngTemplateOutlet",e);}}function Yn(i,l){}function Xn(i,l){if(i&1&&rh(0,Yn,0,0,"ng-template",8),i&2){HD(2);let e=QD(10);lh("ngTemplateOutlet",e);}}function ei(i,l){if(i&1&&Iw(0),i&2){let e=HD(3);Lh(e.nzAddonAfter());}}function ti(i,l){i&1&&(_i$1(0,"div",10),UD(1,1,null,ei,1,1),Jc());}function ni(i,l){if(i&1&&(_i$1(0,"div",9),_D(1,Jn,3,0,"div",10),_D(2,Qn,1,1,null,8)(3,Xn,1,1,null,8),_D(4,ti,3,0,"div",10),Jc()),i&2){let e=HD();gI(),MD(e.hasAddonBefore()?1:-1),gI(),MD(e.hasAffix()?2:3),gI(2),MD(e.hasAddonAfter()?4:-1);}}function ii(i,l){}function oi(i,l){if(i&1&&(_i$1(0,"div"),rh(1,ii,0,0,"ng-template",8),Jc()),i&2){let e=HD(),t=QD(8);lw(e.affixWrapperClass()),gI(),lh("ngTemplateOutlet",t);}}function ri(i,l){if(i&1&&Iw(0),i&2){let e=HD(3);Lh(e.nzPrefix());}}function ai(i,l){i&1&&(_i$1(0,"span",11),UD(1,2,null,ri,1,1),Jc());}function si(i,l){}function li(i,l){if(i&1&&Iw(0),i&2){let e=HD(3);Lh(e.nzSuffix());}}function pi(i,l){if(i&1&&uh(0,"nz-form-item-feedback-icon",13),i&2){let e=HD(3);lh("status",e.finalStatus());}}function di(i,l){if(i&1&&(_i$1(0,"span",12),UD(1,3,null,li,1,1),_D(3,pi,1,1,"nz-form-item-feedback-icon",13),Jc()),i&2){let e=HD(2);gI(3),MD(e.hasFeedback()&&e.finalStatus()?3:-1);}}function ci(i,l){if(i&1&&(_D(0,ai,3,0,"span",11),rh(1,si,0,0,"ng-template",8),_D(2,di,4,1,"span",12)),i&2){let e=HD(),t=QD(10);MD(e.hasPrefix()?0:-1),gI(),lh("ngTemplateOutlet",t),gI(),MD(e.hasSuffix()?2:-1);}}function _i(i,l){}function mi(i,l){if(i&1&&(_i$1(0,"div",null,5),rh(2,_i,0,0,"ng-template",8),Jc()),i&2){let e=HD(),t=QD(12);lw(e.inputNumberClass()),gI(2),lh("ngTemplateOutlet",t);}}function ui(i,l){i&1&&uh(0,"nz-icon",20);}function Ci(i,l){i&1&&uh(0,"nz-icon",21);}function xi(i,l){if(i&1){let e=FD();_i$1(0,"div",17,7),mh("mouseup",function(){Fu(e);let n=HD(2);return ju(n.stopAutoStep())})("mouseleave",function(){Fu(e);let n=HD(2);return ju(n.stopAutoStep())}),_i$1(2,"span",18),mh("mousedown",function(n){Fu(e);let o=HD(2);return ju(o.onStepMouseDown(n,true))}),UD(3,4,null,ui,1,0),Jc(),_i$1(5,"span",19),mh("mousedown",function(n){Fu(e);let o=HD(2);return ju(o.onStepMouseDown(n,false))}),UD(6,5,null,Ci,1,0),Jc()();}if(i&2){let e=HD(2);gI(2),Sh("ant-input-number-handler-up-disabled",e.upDisabled()),ch("aria-disabled",e.upDisabled()),gI(3),Sh("ant-input-number-handler-down-disabled",e.downDisabled()),ch("aria-disabled",e.downDisabled());}}function fi(i,l){if(i&1){let e=FD();_D(0,xi,8,6,"div",14),_i$1(1,"div",15)(2,"input",16,6),mh("input",function(){Fu(e);let n=QD(3),o=HD();return ju(o.onInput(n.value))})("wheel",function(n){Fu(e);let o=HD();return ju(o.onWheel(n))}),Jc()();}if(i&2){let e=HD();MD(e.nzControls()?0:-1),gI(2),lh("value",e.displayValue())("placeholder",e.nzPlaceHolder()??"")("disabled",e.finalDisabled())("readOnly",e.nzReadOnly()),ch("aria-valuemin",e.nzMin())("aria-valuemax",e.nzMax())("id",e.nzId())("step",e.nzStep())("value",e.displayValue());}}var ot=(()=>{class i{nzId=q0(null);nzSize=q0("default");nzPlaceHolder=q0(null);nzStatus=q0("");nzVariant=q0();nzStep=q0(1,{transform:J0});nzMin=q0(Number.MIN_SAFE_INTEGER,{transform:J0});nzMax=q0(Number.MAX_SAFE_INTEGER,{transform:J0});nzPrecision=q0(null);nzParser=q0();nzFormatter=q0();nzDisabled=q0(false,{transform:K0});nzReadOnly=q0(false,{transform:K0});nzAutoFocus=q0(false,{transform:K0});nzKeyboard=q0(true,{transform:K0});nzControls=q0(true,{transform:K0});nzChangeOnWheel=q0(true,{transform:K0});nzPrefix=q0();nzSuffix=q0();nzAddonBefore=q0();nzAddonAfter=q0();nzBlur=U0();nzFocus=U0();nzOnStep=U0();onChange=()=>{};onTouched=()=>{};isDisabledFirstChange=true;compactSize=C(pn,{optional:true});inputRef=G0.required("input");hostRef=G0("inputNumberHost");elementRef=C(_r$1);injector=C(Ee);focusMonitor=C(Ci$1);directionality=C(Oe);nzFormStatusService=C(ml,{optional:true});autoStepTimer=null;defaultFormatter=e=>{let t=this.nzPrecision();return Nr(t)?e.toFixed(t):e.toString()};value=qo$1(null);displayValue=qo$1("");formSize=C(Bt,{optional:true});formVariant=C(pl,{optional:true});dir=C(Oe).valueSignal;focused=qo$1(false);hasFeedback=qo$1(false);finalStatus=Gw(()=>this.nzStatus());finalDisabled=Gw(()=>this.nzDisabled());prefix=z0(ot$1);suffix=z0(at$1);addonBefore=z0(it$1);addonAfter=z0(rt);hasPrefix=Uw(()=>!!this.nzPrefix()||!!this.prefix());hasSuffix=Uw(()=>!!this.nzSuffix()||!!this.suffix()||this.hasFeedback());hasAffix=Uw(()=>this.hasPrefix()||this.hasSuffix());hasAddonBefore=Uw(()=>!!this.nzAddonBefore()||!!this.addonBefore());hasAddonAfter=Uw(()=>!!this.nzAddonAfter()||!!this.addonAfter());hasAddon=Uw(()=>this.hasAddonBefore()||this.hasAddonAfter());class=Uw(()=>this.hasAddon()?this.groupWrapperClass():this.hasAffix()?this.affixWrapperClass():this.inputNumberClass());inputNumberClass=Uw(()=>r$1(r$1({"ant-input-number":true,"ant-input-number-lg":this.finalSize()==="large","ant-input-number-sm":this.finalSize()==="small","ant-input-number-disabled":this.finalDisabled(),"ant-input-number-readonly":this.nzReadOnly(),"ant-input-number-focused":this.focused(),"ant-input-number-rtl":this.dir()==="rtl","ant-input-number-in-form-item":!!this.nzFormStatusService,"ant-input-number-out-of-range":this.value()!==null&&!it(this.value(),this.nzMin(),this.nzMax())},tl("ant-input-number",this.finalVariant())),Qr("ant-input-number",this.finalStatus(),this.hasFeedback())));affixWrapperClass=Uw(()=>r$1(r$1({"ant-input-number-affix-wrapper":true,"ant-input-number-affix-wrapper-disabled":this.finalDisabled(),"ant-input-number-affix-wrapper-readonly":this.nzReadOnly(),"ant-input-number-affix-wrapper-focused":this.focused(),"ant-input-number-affix-wrapper-rtl":this.dir()==="rtl"},Qr("ant-input-number-affix-wrapper",this.finalStatus(),this.hasFeedback())),tl("ant-input-number-affix-wrapper",this.finalVariant())));groupWrapperClass=Uw(()=>r$1(r$1({"ant-input-number-group-wrapper":true,"ant-input-number-group-wrapper-rtl":this.dir()==="rtl"},Qr("ant-input-number-group-wrapper",this.finalStatus(),this.hasFeedback())),tl("ant-input-number-group-wrapper",this.finalVariant())));finalSize=Uw(()=>this.formSize?.()?this.formSize():this.compactSize?this.compactSize():this.nzSize());finalVariant=Uw(()=>this.nzVariant()||this.formVariant?.()||"outlined");upDisabled=Uw(()=>!kr(this.value())&&this.value()>=this.nzMax());downDisabled=Uw(()=>!kr(this.value())&&this.value()<=this.nzMin());constructor(){let e=C(at);Xf(()=>{let t=this.hostRef(),n=t||this.elementRef;this.focusMonitor.monitor(n,true).pipe(ue(e)).subscribe(o=>{qw(()=>{this.focused.set(!!o),o?this.nzFocus.emit():(this.fixValue(),this.onTouched(),this.nzBlur.emit());});}),e.onDestroy(()=>{this.focusMonitor.stopMonitoring(n);});}),this.nzFormStatusService?.formStatusChanges.pipe(ue()).subscribe(({status:t,hasFeedback:n})=>{this.finalStatus.set(t),this.hasFeedback.set(n);});}ngOnInit(){this.nzAutoFocus()&&Xf(()=>this.focus(),{injector:this.injector});}writeValue(e){kr(e)&&(e=null),qw(()=>{this.value.set(e),this.setValue(e);});}registerOnChange(e){this.onChange=e;}registerOnTouched(e){this.onTouched=e;}setDisabledState(e){qw(()=>{this.finalDisabled.set(this.isDisabledFirstChange&&this.nzDisabled()||e);}),this.isDisabledFirstChange=false;}focus(e){il(this.inputRef().nativeElement,e);}blur(){this.inputRef().nativeElement.blur();}step(e,t,n){if(t&&this.upDisabled()||!t&&this.downDisabled())return;let o=e.shiftKey?this.nzStep()*10:this.nzStep();t||(o=-o);let I=10**vn(o),J=bn((Math.round((this.value()||0)*I)+Math.round(o*I))/I,this.nzMin(),this.nzMax(),this.nzPrecision());this.setValue(J),this.nzOnStep.emit({type:t?"up":"down",value:this.value(),offset:this.nzStep(),emitter:n}),this.focus();}setValue(e){let t=this.nzFormatter()??this.defaultFormatter,n=this.nzPrecision();Nr(n)&&(e&&=+e.toFixed(n));let o=kr(e)?"":t(e);this.displayValue.set(o),this.updateValue(e);}setValueByTyping(e){if(this.displayValue.set(e),e===""){this.updateValue(null);return}let n=(this.nzParser()??hn)(e);if(bi(e)||Number.isNaN(n))return;let o=this.nzFormatter();if(o){let d=o(n);this.displayValue.set(d);}it(n,this.nzMin(),this.nzMax())&&this.updateValue(n);}updateValue(e){this.value()!==e&&(this.value.set(e),this.onChange(e));}fixValue(){let e=this.displayValue();if(e==="")return;let n=(this.nzParser()??hn)(e);if(Number.isNaN(n))n=this.value();else {let o=this.nzPrecision();Nr(o)&&vn(n)!==o&&(n=+n.toFixed(o)),it(n,this.nzMin(),this.nzMax())||(n=bn(n,this.nzMin(),this.nzMax(),o));}this.setValue(n);}stopAutoStep(){this.autoStepTimer!==null&&(clearTimeout(this.autoStepTimer),this.autoStepTimer=null);}onStepMouseDown(e,t){e.preventDefault(),this.stopAutoStep(),this.step(e,t,"handler");let n=()=>{this.step(e,t,"handler"),this.autoStepTimer=setTimeout(n,gi);};this.autoStepTimer=setTimeout(n,hi);}onKeyDown(e){switch(e.keyCode){case 38:e.preventDefault(),this.nzKeyboard()&&this.step(e,true,"keyboard");break;case 40:e.preventDefault(),this.nzKeyboard()&&this.step(e,false,"keyboard");break;case 13:this.fixValue();break}}onInput(e){this.setValueByTyping(e);}onWheel(e){this.finalDisabled()||this.nzReadOnly()||!this.nzChangeOnWheel()||(e.preventDefault(),this.step(e,e.deltaY<0,"wheel"));}static \u0275fac=function(t){return new(t||i)};static \u0275cmp=ZE({type:i,selectors:[["nz-input-number"]],contentQueries:function(t,n,o){t&1&&Dh(o,n.prefix,ot$1,5)(o,n.suffix,at$1,5)(o,n.addonBefore,it$1,5)(o,n.addonAfter,rt,5),t&2&&zD(4);},viewQuery:function(t,n){t&1&&wh(n.inputRef,Dn,5)(n.hostRef,Ln,5),t&2&&zD(2);},hostVars:2,hostBindings:function(t,n){t&1&&mh("keydown",function(d){return n.onKeyDown(d)}),t&2&&lw(n.class());},inputs:{nzId:[1,"nzId"],nzSize:[1,"nzSize"],nzPlaceHolder:[1,"nzPlaceHolder"],nzStatus:[1,"nzStatus"],nzVariant:[1,"nzVariant"],nzStep:[1,"nzStep"],nzMin:[1,"nzMin"],nzMax:[1,"nzMax"],nzPrecision:[1,"nzPrecision"],nzParser:[1,"nzParser"],nzFormatter:[1,"nzFormatter"],nzDisabled:[1,"nzDisabled"],nzReadOnly:[1,"nzReadOnly"],nzAutoFocus:[1,"nzAutoFocus"],nzKeyboard:[1,"nzKeyboard"],nzControls:[1,"nzControls"],nzChangeOnWheel:[1,"nzChangeOnWheel"],nzPrefix:[1,"nzPrefix"],nzSuffix:[1,"nzSuffix"],nzAddonBefore:[1,"nzAddonBefore"],nzAddonAfter:[1,"nzAddonAfter"]},outputs:{nzBlur:"nzBlur",nzFocus:"nzFocus",nzOnStep:"nzOnStep"},exportAs:["nzInputNumber"],features:[Nw([{provide:St$1,useExisting:wo$1(()=>i),multi:true},{provide:fn,useValue:"input-number"}]),oD([ir$1])],ngContentSelectors:Wn,decls:13,vars:1,consts:[["inputNumberWithAddonInner",""],["inputNumberWithAffix",""],["inputNumberWithAffixInner",""],["inputNumber",""],["inputNumberInner",""],["inputNumberHost",""],["input",""],["handlers",""],[3,"ngTemplateOutlet"],[1,"ant-input-number-wrapper","ant-input-number-group"],[1,"ant-input-number-group-addon"],[1,"ant-input-number-prefix"],[1,"ant-input-number-suffix"],[3,"status"],[1,"ant-input-number-handler-wrap"],[1,"ant-input-number-input-wrap"],["autocomplete","off","role","spinbutton",1,"ant-input-number-input",3,"input","wheel","value","placeholder","disabled","readOnly"],[1,"ant-input-number-handler-wrap",3,"mouseup","mouseleave"],["role","button","unselectable","on",1,"ant-input-number-handler","ant-input-number-handler-up",3,"mousedown"],["role","button","unselectable","on",1,"ant-input-number-handler","ant-input-number-handler-down",3,"mousedown"],["nzType","up",1,"ant-input-number-handler-up-inner"],["nzType","down",1,"ant-input-number-handler-down-inner"]],template:function(t,n){t&1&&($D(On),_D(0,Rn,1,1,null,8)(1,Hn,1,1,null,8)(2,Gn,1,1,null,8),rh(3,ni,5,3,"ng-template",null,0,Vw)(5,oi,2,3,"ng-template",null,1,Vw)(7,ci,3,3,"ng-template",null,2,Vw)(9,mi,3,3,"ng-template",null,3,Vw)(11,fi,4,10,"ng-template",null,4,Vw)),t&2&&MD(n.hasAddon()?0:n.hasAffix()?1:2);},dependencies:[Ah,Th,hl,w5],encapsulation:2})}return i})(),gi=200,hi=600;function hn(i){let l=i.trim().replace(/,/g,"").replace(/。/g,".");return l.length?+l:NaN}function it(i,l,e){return i>=l&&i<=e}function bn(i,l,e,t=null){if(t===null)return i<l?l:i>e?e:i;let n=+i.toFixed(t),o=Math.pow(10,t);return n<l?Math.ceil(l*o)/o:n>e?Math.floor(e*o)/o:n}function vn(i){return i.toString().split(".")[1]?.length||0}function bi(i){return /[.。](\d*0)?$/.test(i.toString())}var wn=(()=>{class i{static \u0275fac=function(t){return new(t||i)};static \u0275mod=KE({type:i});static \u0275inj=fu({imports:[ot]})}return i})();var wi=(i,l)=>l.id;function Si(i,l){if(i&1&&uh(0,"nz-option",2),i&2){let e=l.$implicit;lh("nzValue",e.id)("nzLabel",e.name);}}var Sn=(()=>{class i{constructor(){this.reposApi=C(f),this.destroyRef=C(at),this.path=W0(""),this.repoSelected=U0(),this.repos=qo$1([]),this.selectedCatalogId=Uw(()=>{let e=this.path();return this.repos().find(t=>t.localPath===e)?.id??null}),this.reposApi.list().pipe(ue(this.destroyRef)).subscribe({next:e=>this.repos.set(e),error:()=>this.repos.set([])});}onCatalogSelect(e){if(!e)return;let t=this.repos().find(n=>n.id===e);t&&this.repoSelected.emit(t);}static{this.\u0275fac=function(t){return new(t||i)};}static{this.\u0275cmp=ZE({type:i,selectors:[["app-repo-path-picker"]],inputs:{path:[1,"path"]},outputs:{path:"pathChange",repoSelected:"repoSelected"},decls:7,vars:8,consts:[["data-testid","repo-path-picker",1,"repo-path-picker"],["data-testid","repo-path-catalog",1,"catalog",3,"ngModelChange","ngModel","nzPlaceHolder"],[3,"nzValue","nzLabel"],["mode","directories",3,"pathChange","path","browseLabel"]],template:function(t,n){t&1&&(_i$1(0,"div",0)(1,"nz-select",1),Pw(2,"transloco"),mh("ngModelChange",function(d){return n.onCatalogSelect(d)}),xD(3,Si,1,2,"nz-option",2,wi),Jc(),iE(),_i$1(5,"app-path-picker",3),Pw(6,"transloco"),mh("pathChange",function(d){return n.path.set(d)}),Jc()()),t&2&&(gI(),lh("ngModel",n.selectedCatalogId())("nzPlaceHolder",Fw(2,4,"step-list.createWorktree.catalogPlaceholder")),aE(),gI(2),AD(n.repos()),gI(2),lh("path",n.path())("browseLabel",Fw(6,6,"step-list.createWorktree.browseManually")));},dependencies:[$8,al,rl,$i$1,ex,Fm,Am,ot$2,Kt],styles:["[_nghost-%COMP%]{display:block}.repo-path-picker[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.catalog[_ngcontent-%COMP%]{width:100%}"]});}}return i})();var yi=i=>({action:i}),zi=i=>({fields:i}),yn=(i,l)=>l.token,Mi=(i,l)=>l.subjectType,Ei=(i,l)=>l.id+l.name;function Ti(i,l){i&1&&(Xc(0,"p",7),Iw(1),Pw(2,"transloco"),el()),i&2&&(gI(),rl$1(" ",Fw(2,1,"step-list.availableParameters.subWorkflowForEach")," "));}function ki(i,l){if(i&1){let e=FD();Xc(0,"li")(1,"span",13),Iw(2),el(),Xc(3,"button",14),yh("click",function(){let n=Fu(e).$implicit,o=HD(3);return ju(o.copyToken(n.token))}),Iw(4),el()();}if(i&2){let e=l.$implicit,t=HD(3);gI(2),Lh(e.label),gI(),Sh("copied",t.copiedToken()===e.token),ch("data-testid","copy-token")("data-token",e.token),gI(),rl$1(" ",e.token," ");}}function Ii(i,l){if(i&1&&(Xc(0,"div",8)(1,"h5"),Iw(2),Pw(3,"transloco"),el(),Xc(4,"ul"),xD(5,ki,5,6,"li",null,yn),el()()),i&2){let e=HD(2);gI(2),Lh(Fw(3,1,"step-list.availableParameters.inputs")),gI(3),AD(e.inputEntries());}}function Ni(i,l){if(i&1&&(Xc(0,"p",16),Iw(1),Pw(2,"transloco"),el()),i&2){let e=HD().$implicit;gI(),Lh(Fw(2,1,e.typeKey));}}function Fi(i,l){if(i&1){let e=FD();Xc(0,"li")(1,"button",14),yh("click",function(){let n=Fu(e).$implicit,o=HD(4);return ju(o.copyToken(n.token))}),Iw(2),el()();}if(i&2){let e=l.$implicit,t=HD(4);gI(),Sh("copied",t.copiedToken()===e.token),ch("data-testid","copy-token")("data-token",e.token),gI(),rl$1(" ",e.token," ");}}function Pi(i,l){if(i&1&&(_D(0,Ni,3,3,"p",16),Xc(1,"ul"),xD(2,Fi,3,5,"li",null,yn),el()),i&2){let e=l.$implicit,t=HD(3);MD(t.subjectGroups().length>1?0:-1),gI(2),AD(e.tokens);}}function Vi(i,l){if(i&1&&(Xc(0,"div",9)(1,"h5",15),Iw(2),Pw(3,"transloco"),el(),xD(4,Pi,4,1,null,null,Mi),el()),i&2){let e=HD(2);gI(2),Fh(" ",Fw(3,2,"step-list.availableParameters.subject")," (",e.subjectTypeHeading(),") "),gI(2),AD(e.subjectGroups());}}function Ai(i,l){i&1&&(Xc(0,"p",11),Iw(1),Pw(2,"transloco"),el()),i&2&&(gI(),rl$1(" ",Fw(2,1,"step-list.availableParameters.noPrevious")," "));}function $i(i,l){i&1&&(Xc(0,"span",19),Iw(1),Pw(2,"transloco"),el()),i&2&&(gI(),rl$1(" ",Fw(2,1,"step-list.availableParameters.loopOverwrite")," "));}function Bi(i,l){i&1&&(Xc(0,"p",5),Iw(1),Pw(2,"transloco"),el()),i&2&&(gI(),Lh(Fw(2,1,"step-list.availableParameters.missingId")));}function Di(i,l){if(i&1){let e=FD();Xc(0,"button",14),yh("click",function(){let n=Fu(e).$implicit,o=HD(5);return ju(o.copyToken(n))}),Iw(1),el();}if(i&2){let e=l.$implicit,t=HD(5);Sh("copied",t.copiedToken()===e),ch("data-testid","copy-token")("data-token",e),gI(),rl$1(" ",e," ");}}function Li(i,l){if(i&1&&(Xc(0,"div",20),xD(1,Di,2,5,"button",25,ND),el()),i&2){let e=HD().$implicit;gI(),AD(e.tokens);}}function Oi(i,l){if(i&1&&(Xc(0,"p",21),Iw(1),Pw(2,"transloco"),el()),i&2){let e=HD().$implicit;gI(),rl$1(" ",jw(2,1,"step-list.availableParameters.providerOpaque",Aw(4,yi,e.actionLabel))," ");}}function Wi(i,l){i&1&&(Xc(0,"p",21),Iw(1),Pw(2,"transloco"),el()),i&2&&(gI(),rl$1(" ",Fw(2,1,"step-list.availableParameters.interactionOpaque")," "));}function ji(i,l){if(i&1&&(Xc(0,"p",22),Iw(1),Pw(2,"transloco"),el()),i&2){let e=HD().$implicit,t=HD(3);gI(),rl$1(" ",jw(2,1,"step-list.availableParameters.arrayOf",Aw(4,zi,t.arrayFields(e)))," ");}}function Ri(i,l){i&1&&(Xc(0,"p",23),Iw(1),Pw(2,"transloco"),el()),i&2&&(gI(),rl$1(" ",Fw(2,1,"step-list.availableParameters.subjectTypeUnion")," "));}function Ki(i,l){i&1&&(Xc(0,"p",24),Iw(1),Pw(2,"transloco"),el()),i&2&&(gI(),rl$1(" ",Fw(2,1,"step-list.availableParameters.noOutput")," "));}function Hi(i,l){if(i&1&&(Xc(0,"li",17),Pw(1,"transloco"),Xc(2,"div",18)(3,"span",13),Iw(4),el(),_D(5,$i,3,3,"span",19),el(),_D(6,Bi,3,3,"p",5),_D(7,Li,3,0,"div",20),_D(8,Oi,3,6,"p",21),_D(9,Wi,3,3,"p",21),_D(10,ji,3,6,"p",22),_D(11,Ri,3,3,"p",23),_D(12,Ki,3,3,"p",24),el()),i&2){let e=l.$implicit;ch("data-testid","previous-step-"+e.id)("title",e.inLoop?Fw(1,11,"step-list.availableParameters.loopOverwrite"):null),gI(4),Lh(e.name||e.id),gI(),MD(e.inLoop?5:-1),gI(),MD(e.id?-1:6),gI(),MD(e.tokens.length>0?7:-1),gI(),MD(e.shape.opaque&&e.isProvider?8:-1),gI(),MD(e.shape.opaque&&e.isInteraction?9:-1),gI(),MD(e.shape.isArray&&(e.shape.fields?.length??0)>0?10:-1),gI(),MD(e.shape.fieldsDependOnSubjectType?11:-1),gI(),MD(!e.shape.opaque&&(e.shape.fields?.length??0)===0&&!e.shape.isScalar?12:-1);}}function qi(i,l){if(i&1&&(Xc(0,"ul",12),xD(1,Hi,13,13,"li",17,Ei),el()),i&2){let e=HD(2);gI(),AD(e.previousEntries());}}function Gi(i,l){if(i&1&&(Xc(0,"div",4)(1,"p",5),Iw(2),Pw(3,"transloco"),el(),Xc(4,"p",6),Iw(5),Pw(6,"transloco"),el(),_D(7,Ti,3,3,"p",7),_D(8,Ii,7,3,"div",8),_D(9,Vi,6,4,"div",9),Xc(10,"div",10)(11,"h5"),Iw(12),Pw(13,"transloco"),el(),_D(14,Ai,3,3,"p",11)(15,qi,3,0,"ul",12),el()()),i&2){let e=HD();gI(2),Lh(Fw(3,7,"step-list.availableParameters.hint")),gI(3),rl$1(" ",Fw(6,9,"step-list.availableParameters.condition")," "),gI(2),MD(e.currentStepType()==="sub_workflow"?7:-1),gI(),MD(e.inputEntries().length>0?8:-1),gI(),MD(e.subjectGroups().length>0?9:-1),gI(3),Lh(Fw(13,11,"step-list.availableParameters.previous")),gI(2),MD(e.previousEntries().length===0?14:15);}}var zn=(()=>{class i{constructor(){this.transloco=C(Ve),this.inputSchema=q0([]),this.appliesTo=q0("none"),this.previousSteps=q0([]),this.currentStepType=q0(null),this.expanded=qo$1(false),this.copiedToken=qo$1(null),this.inputEntries=Uw(()=>this.inputSchema().map(e=>({label:e.label.trim()||e.name,name:e.name.trim()})).filter(e=>e.name.length>0).map(e=>({label:e.label,token:nm(e.name)}))),this.subjectGroups=Uw(()=>R_(this.appliesTo()).map(e=>({subjectType:e.subjectType,typeKey:`workflow-editor.subjectType.${e.subjectType}`,tokens:e.fields.map(t=>({field:t,token:nm(`subject.${t}`)}))}))),this.previousEntries=Uw(()=>this.previousSteps().map(({step:e,inLoop:t})=>{let n=e;return {name:n.name,id:n.id,inLoop:t,shape:bg(n,this.appliesTo()),tokens:A_(n,this.appliesTo()),actionLabel:Ui(n),isProvider:n.type==="provider_action",isInteraction:n.type==="interaction"}}));}toggleExpanded(){this.expanded.update(e=>!e);}subjectTypeHeading(){return this.subjectGroups().map(e=>this.transloco.translate(e.typeKey)).join(", ")}arrayFields(e){return (e.shape.fields??[]).join(", ")}copyToken(e){let t=navigator.clipboard;if(!t?.writeText){this.copiedToken.set(e);return}t.writeText(e).then(()=>this.copiedToken.set(e),()=>this.copiedToken.set(e));}static{this.\u0275fac=function(t){return new(t||i)};}static{this.\u0275cmp=ZE({type:i,selectors:[["app-available-parameters"]],inputs:{inputSchema:[1,"inputSchema"],appliesTo:[1,"appliesTo"],previousSteps:[1,"previousSteps"],currentStepType:[1,"currentStepType"]},decls:8,vars:8,consts:[["data-testid","available-parameters",1,"available-parameters"],["type","button","data-testid","available-parameters-toggle",1,"panel-toggle",3,"click"],["aria-hidden","true",1,"chevron"],[1,"panel-title"],["data-testid","available-parameters-body",1,"panel-body"],[1,"hint"],["data-testid","step-condition-note",1,"hint"],["data-testid","sub-workflow-foreach-note",1,"hint"],["data-testid","available-parameters-inputs",1,"group"],["data-testid","available-parameters-subject",1,"group"],["data-testid","available-parameters-previous",1,"group"],["data-testid","available-parameters-no-previous",1,"hint"],[1,"previous-list"],[1,"entry-label"],["type","button",1,"param-token",3,"click"],["data-testid","available-parameters-subject-heading"],[1,"subject-type"],[1,"previous-entry"],[1,"previous-heading"],["data-testid","loop-overwrite-note",1,"loop-note"],[1,"token-row"],["data-testid","opaque-note",1,"hint"],["data-testid","array-note",1,"hint"],["data-testid","subject-type-union-note",1,"hint"],["data-testid","no-output-note",1,"hint"],["type","button",1,"param-token",3,"copied"]],template:function(t,n){t&1&&(Xc(0,"section",0)(1,"button",1),yh("click",function(){return n.toggleExpanded()}),Xc(2,"span",2),Iw(3),el(),Xc(4,"span",3),Iw(5),Pw(6,"transloco"),el()(),_D(7,Gi,16,13,"div",4),el()),t&2&&(Sh("expanded",n.expanded()),gI(),ch("aria-expanded",n.expanded()),gI(2),Lh(n.expanded()?"\u25BE":"\u25B8"),gI(2),Lh(Fw(6,6,"step-list.availableParameters.title")),gI(2),MD(n.expanded()?7:-1));},dependencies:[Kt],styles:[".available-parameters[_ngcontent-%COMP%]{margin:.85rem 0 .25rem;padding:.35rem .65rem;border:1px solid #e7e5e4;border-radius:.5rem;background:#fafaf9}.available-parameters.expanded[_ngcontent-%COMP%]{padding:.65rem .75rem .75rem}.panel-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.4rem;width:100%;margin:0;padding:.2rem 0;border:0;background:transparent;cursor:pointer;text-align:left;color:inherit}.chevron[_ngcontent-%COMP%]{color:#78716c;font-size:.85rem;width:.9rem}.available-parameters[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{margin:0 0 .35rem}.panel-title[_ngcontent-%COMP%]{font-size:.95rem;font-weight:600}.panel-body[_ngcontent-%COMP%]{margin-top:.5rem}.available-parameters[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{font-size:.8rem;text-transform:uppercase;letter-spacing:.03em;color:#57534e}.hint[_ngcontent-%COMP%]{margin:0 0 .5rem;font-size:.8rem;color:#78716c}.group[_ngcontent-%COMP%]{margin-top:.65rem}.group[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:.35rem .5rem}.previous-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.65rem}.previous-entry[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.3rem}.previous-heading[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.35rem .65rem;align-items:baseline}.entry-label[_ngcontent-%COMP%]{font-size:.85rem;font-weight:600;color:#44403c}.loop-note[_ngcontent-%COMP%]{font-size:.75rem;color:#78716c}.subject-type[_ngcontent-%COMP%]{margin:.35rem 0 .2rem;font-size:.8rem;color:#57534e}.token-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.35rem}.param-token[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.75rem;line-height:1.2;padding:.15rem .45rem;border:1px solid #d6d3d1;border-radius:.3rem;background:#fff;color:#1c1917;cursor:pointer}.param-token[_ngcontent-%COMP%]:hover{border-color:#a8a29e}.param-token.copied[_ngcontent-%COMP%]{border-color:#57534e;background:#e7e5e4}"]});}}return i})();function Ui(i){return i.type!=="provider_action"?"":i.extendedAction?.actionId??i.action}function Ji(i,l){if(i&1&&(uh(0,"nz-option",3),Pw(1,"transloco")),i&2){let e=l.$implicit,t=HD();lh("nzValue",e)("nzLabel",Fw(1,2,t.typeKey(e)));}}function Zi(i,l){if(i&1){let e=FD();_i$1(0,"label",1)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"input",4),mh("ngModelChange",function(n){Fu(e);let o=HD();return ju(o.setValue(n))}),Jc(),iE(),Jc();}if(i&2){let e=HD();gI(2),Lh(Fw(3,3,"step-list.fieldCondition.value")),gI(2),lh("ngModel",e.valueText()),ch("data-testid",e.testIdPrefix()+"-value"),aE();}}var Qi=["field_empty","field_equals"],Mn=(()=>{class i{constructor(){this.condition=q0.required(),this.testIdPrefix=q0("field-condition"),this.conditionChange=U0(),this.conditionTypes=Qi;}typeKey(e){return `step-list.untilType.${e}`}valueText(){let e=this.condition();return e.type!=="field_equals"?"":Xi(e.value)}setType(e){let t=this.condition();if(e==="field_empty"){this.conditionChange.emit({type:e,stepId:t.stepId,field:t.field});return}let n=t.type==="field_equals"?t.value:"";this.conditionChange.emit({type:e,stepId:t.stepId,field:t.field,value:n});}setField(e,t){this.conditionChange.emit(s(r$1({},this.condition()),{[e]:t}));}setValue(e){let t=this.condition();t.type==="field_equals"&&this.conditionChange.emit(s(r$1({},t),{value:Yi(e)}));}static{this.\u0275fac=function(t){return new(t||i)};}static{this.\u0275cmp=ZE({type:i,selectors:[["app-field-condition-editor"]],inputs:{condition:[1,"condition"],testIdPrefix:[1,"testIdPrefix"]},outputs:{conditionChange:"conditionChange"},decls:19,vars:17,consts:[[1,"field-grid"],[1,"field"],[3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel"],["nz-input","",3,"ngModelChange","ngModel"]],template:function(t,n){t&1&&(_i$1(0,"div",0)(1,"div",1)(2,"span"),Iw(3),Pw(4,"transloco"),Jc(),_i$1(5,"nz-select",2),mh("ngModelChange",function(d){return n.setType(d)}),xD(6,Ji,2,4,"nz-option",3,ND),Jc(),iE(),Jc(),_i$1(8,"label",1)(9,"span"),Iw(10),Pw(11,"transloco"),Jc(),_i$1(12,"input",4),mh("ngModelChange",function(d){return n.setField("stepId",d)}),Jc(),iE(),Jc(),_i$1(13,"label",1)(14,"span"),Iw(15),Pw(16,"transloco"),Jc(),_i$1(17,"input",4),mh("ngModelChange",function(d){return n.setField("field",d)}),Jc(),iE(),Jc(),_D(18,Zi,5,5,"label",1),Jc()),t&2&&(ch("data-testid",n.testIdPrefix()),gI(3),Lh(Fw(4,11,"step-list.fieldCondition.type")),gI(2),lh("ngModel",n.condition().type),ch("data-testid",n.testIdPrefix()+"-type"),aE(),gI(),AD(n.conditionTypes),gI(4),Lh(Fw(11,13,"step-list.fieldCondition.stepId")),gI(2),lh("ngModel",n.condition().stepId),ch("data-testid",n.testIdPrefix()+"-stepId"),aE(),gI(3),Lh(Fw(16,15,"step-list.fieldCondition.field")),gI(2),lh("ngModel",n.condition().field),ch("data-testid",n.testIdPrefix()+"-field"),aE(),gI(),MD(n.condition().type==="field_equals"?18:-1));},dependencies:[al,er$1,rl,$i$1,ai$1,z,ex,Fm,Am,Kt],styles:[".field-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));gap:.5rem 1rem}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.65rem 0}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}"]});}}return i})();function En(){return {type:"field_empty",stepId:"",field:""}}function Yi(i){let l=i.trim();if(l==="")return "";try{return JSON.parse(l)}catch(e){return i}}function Xi(i){if(i===void 0)return "";if(typeof i=="string")try{return JSON.parse(i),JSON.stringify(i)}catch(l){return i}return JSON.stringify(i)}function eo(i,l){if(i&1){let e=FD();_i$1(0,"div",1)(1,"input",3),Hh("ngModelChange",function(n){let o=Fu(e).$implicit;return Tw(o.key,n)||(o.key=n),ju(n)}),mh("ngModelChange",function(){Fu(e);let n=HD();return ju(n.emitRows())}),Jc(),iE(),_i$1(2,"input",4),Hh("ngModelChange",function(n){let o=Fu(e).$implicit;return Tw(o.value,n)||(o.value=n),ju(n)}),mh("ngModelChange",function(){Fu(e);let n=HD();return ju(n.emitRows())}),Jc(),iE(),_i$1(3,"button",5),mh("click",function(){let n=Fu(e).$index,o=HD();return ju(o.remove(n))}),Iw(4,"Remove"),Jc()();}if(i&2){let e=l.$implicit;gI(),Vh("ngModel",e.key),aE(),gI(),Vh("ngModel",e.value),aE();}}var Nn=(()=>{class i{constructor(){this.rows=W0.required();}add(){this.rows.update(e=>[...e,{key:"",value:""}]);}remove(e){this.rows.update(t=>t.filter((n,o)=>o!==e));}emitRows(){this.rows.set(this.rows().map(e=>r$1({},e)));}static{this.\u0275fac=function(t){return new(t||i)};}static{this.\u0275cmp=ZE({type:i,selectors:[["app-key-value-editor"]],inputs:{rows:[1,"rows"]},outputs:{rows:"rowsChange"},decls:5,vars:0,consts:[[1,"kv-editor"],[1,"kv-row"],["nz-button","","nzType","dashed","type","button",3,"click"],["nz-input","","placeholder","key",3,"ngModelChange","ngModel"],["nz-input","","placeholder","value",3,"ngModelChange","ngModel"],["nz-button","","nzType","default","type","button",3,"click"]],template:function(t,n){t&1&&(_i$1(0,"div",0),xD(1,eo,5,2,"div",1,SD),_i$1(3,"button",2),mh("click",function(){return n.add()}),Iw(4,"Add param"),Jc()()),t&2&&(gI(),AD(n.rows()));},dependencies:[al,er$1,rl,$i$1,pf,bd,sp,fp,ai$1,z],styles:[".kv-editor[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.5rem}.kv-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr auto;gap:.5rem;align-items:center}"]});}}return i})();function $e(i,l){let e=Uu(i);return z$1(l,e).map(t=>t.id)}function Pn(i,l){return $e(i,l)[0]??""}function Fn(i,l,e){let t=$e(l,e);if(t.includes(i))return null;let n=(e?.providerInstances??[]).find(o=>o.id===i);return n?S_(n)&&Uu(l).includes(n.subjectType)?null:{required:i,active:t[0]??n.id}:{required:i,active:t[0]??""}}function Vn(i,l,e){if(i.extendedAction?.providerId){let t=Fn(i.extendedAction.providerId,l,e);if(t)return t}return i.target?.source?Fn(i.target.source,i.target.subjectType,e):null}function An(i){return i.extendedAction!=null}var $n=()=>[];function io(i,l){return this.trackKey(l)}var he=(i,l)=>l.id,oo=(i,l)=>l.actionId,ro=(i,l)=>l.name;function ao(i,l){if(i&1&&(uh(0,"nz-option",15),Pw(1,"transloco")),i&2){let e=l.$implicit,t=HD(3);lh("nzValue",e)("nzLabel",Fw(1,2,t.stepTypeKey(e)));}}function so(i,l){if(i&1){let e=FD();_i$1(0,"app-field-condition-editor",24),mh("conditionChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.patchAt(o,{condition:n}))}),Jc();}if(i&2){let e=HD(2).$index;lh("condition",l)("testIdPrefix","step-condition-"+e);}}function lo(i,l){if(i&1&&(uh(0,"nz-option",15),Pw(1,"transloco")),i&2){let e=l.$implicit,t=HD(4);lh("nzValue",e)("nzLabel",Fw(1,2,t.outputFormatKey(e)));}}function po(i,l){if(i&1&&uh(0,"nz-option",15),i&2){let e=l.$implicit;lh("nzValue",e.id)("nzLabel",e.displayName);}}function co(i,l){if(i&1){let e=FD();_i$1(0,"nz-tag",31),mh("nzOnClose",function(){let n=Fu(e).$implicit,o=HD(3).$index,d=HD();return ju(d.removeContextFile(o,n.id))}),Iw(1),Jc();}if(i&2){let e=l.$implicit;ch("data-testid","context-file-chip-"+e.id),gI(),rl$1(" ",e.name," ");}}function _o(i,l){i&1&&(_i$1(0,"span",29),Iw(1),Pw(2,"transloco"),Jc()),i&2&&(gI(),Lh(Fw(2,1,"step-list.contextFilesEmpty")));}function mo(i,l){if(i&1){let e=FD();_i$1(0,"label",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"textarea",25),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.patchAt(o,{objective:n}))}),Jc(),iE(),Jc(),_i$1(5,"div",16)(6,"span"),Iw(7),Pw(8,"transloco"),Jc(),_i$1(9,"nz-select",26),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.patchAt(o,{outputFormat:n}))}),xD(10,lo,2,4,"nz-option",15,ND),Jc(),iE(),Jc(),_i$1(12,"div",16)(13,"span"),Iw(14),Pw(15,"transloco"),Jc(),_i$1(16,"nz-select",26),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.setAgentInstance(o,n))}),uh(17,"nz-option",15),Pw(18,"transloco"),xD(19,po,1,2,"nz-option",15,he),Jc(),iE(),Jc(),_i$1(21,"div",16)(22,"span"),Iw(23),Pw(24,"transloco"),Jc(),_i$1(25,"div",27),xD(26,co,2,2,"nz-tag",28,he,false,_o,3,3,"span",29),Jc(),_i$1(29,"button",30),mh("click",function(){Fu(e);let n=HD(2).$index,o=HD();return ju(o.openContextFilePicker(n))}),Iw(30),Pw(31,"transloco"),Jc()();}if(i&2){let e=HD(2),t=e.$implicit,n=e.$index,o=HD();gI(),ch("data-testid","agent-prompt-label-"+n),gI(),Lh(Fw(3,17,"step-list.objective")),gI(2),lh("ngModel",o.asAgent(t).objective),ch("data-testid","agent-objective-"+n),aE(),gI(3),Lh(Fw(8,19,"step-list.outputFormat.label")),gI(2),lh("ngModel",o.asAgent(t).outputFormat),ch("data-testid","agent-output-"+n),aE(),gI(),AD(o.outputFormats),gI(4),Lh(Fw(15,21,"step-list.agentInstance.label")),gI(2),lh("ngModel",o.asAgent(t).agentInstanceId??null),ch("data-testid","agent-instance-"+n),aE(),gI(),lh("nzValue",null)("nzLabel",Fw(18,23,"step-list.agentInstance.default")),gI(2),AD(o.agentInstanceOptions()),gI(2),ch("data-testid","agent-context-files-"+n),gI(2),Lh(Fw(24,25,"step-list.contextFiles")),gI(3),AD(o.selectedContextFiles(o.asAgent(t))),gI(3),ch("data-testid","select-context-files-"+n),gI(),rl$1(" ",Fw(31,27,"step-list.selectContextFiles")," ");}}function uo(i,l){if(i&1&&(uh(0,"nz-option",15),Pw(1,"transloco")),i&2){let e=l.$implicit,t=HD(4);lh("nzValue",e)("nzLabel",Fw(1,2,t.interactionKey(e)));}}function Co(i,l){if(i&1&&uh(0,"nz-option",15),i&2){let e=l.$implicit;lh("nzValue",e.id)("nzLabel",e.label);}}function xo(i,l){i&1&&(_i$1(0,"p",19),Iw(1),Pw(2,"transloco"),Jc()),i&2&&(gI(),Lh(Fw(2,1,"step-list.sourceStepIds.empty")));}function fo(i,l){i&1&&(_i$1(0,"p",19),Iw(1),Pw(2,"transloco"),Jc()),i&2&&(gI(),Lh(Fw(2,1,"step-list.sourceStepIds.hint")));}function go(i,l){if(i&1){let e=FD();_i$1(0,"div",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"nz-select",32),mh("ngModelChange",function(n){Fu(e);let o=HD(3).$index,d=HD();return ju(d.patchAt(o,{sourceStepIds:n}))}),xD(5,Co,1,2,"nz-option",15,he),Jc(),iE(),_D(7,xo,3,3,"p",19)(8,fo,3,3,"p",19),Jc();}if(i&2){let e=HD(3),t=e.$implicit,n=e.$index,o=HD();ch("data-testid","comment-review-sources-"+n),gI(2),Lh(Fw(3,5,"step-list.sourceStepIds.label")),gI(2),lh("ngModel",o.asInteraction(t).sourceStepIds??xw(7,$n)),ch("data-testid","comment-review-source-ids-"+n),aE(),gI(),AD(o.commentSuggestionSources(t)),gI(2),MD(o.commentSuggestionSources(t).length===0?7:8);}}function ho(i,l){if(i&1){let e=FD();_i$1(0,"div",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"nz-select",26),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.onInteractionChange(o,n))}),xD(5,uo,2,4,"nz-option",15,ND),Jc(),iE(),Jc(),_D(7,go,9,8,"div",16);}if(i&2){let e=HD(2),t=e.$implicit,n=e.$index,o=HD();gI(2),Lh(Fw(3,4,"step-list.interaction.label")),gI(2),lh("ngModel",o.asInteraction(t).interaction),ch("data-testid","interaction-type-"+n),aE(),gI(),AD(o.interactions),gI(2),MD(o.asInteraction(t).interaction==="comment_review"?7:-1);}}function bo(i,l){if(i&1){let e=FD();_i$1(0,"label",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"textarea",25),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.patchAt(o,{command:n}))}),Jc(),iE(),Jc();}if(i&2){let e=HD(2),t=e.$implicit,n=e.$index,o=HD();gI(2),Lh(Fw(3,3,"step-list.command")),gI(2),lh("ngModel",o.asShell(t).command),ch("data-testid","shell-command-"+n),aE();}}function vo(i,l){if(i&1&&(uh(0,"nz-option",15),Pw(1,"transloco")),i&2){let e=l.$implicit,t=HD(4);lh("nzValue",e)("nzLabel",Fw(1,2,t.onNoMatchKey(e)));}}function wo(i,l){if(i&1){let e=FD();_i$1(0,"label",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"textarea",33),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.patchAt(o,{source:n}))}),Jc(),iE(),Jc(),_i$1(5,"label",16)(6,"span"),Iw(7),Pw(8,"transloco"),Jc(),_i$1(9,"input",18),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.patchAt(o,{path:n}))}),Jc(),iE(),Jc(),_i$1(10,"label",16)(11,"span"),Iw(12),Pw(13,"transloco"),Jc(),_i$1(14,"input",18),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.patchAt(o,{pattern:n}))}),Jc(),iE(),Jc(),_i$1(15,"div",16)(16,"span"),Iw(17),Pw(18,"transloco"),Jc(),_i$1(19,"nz-select",26),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.patchAt(o,{onNoMatch:n}))}),xD(20,vo,2,4,"nz-option",15,ND),Jc(),iE(),Jc();}if(i&2){let e=HD(2),t=e.$implicit,n=e.$index,o=HD();gI(2),Lh(Fw(3,12,"step-list.extract.source")),gI(2),lh("ngModel",o.asExtract(t).source),ch("data-testid","extract-source-"+n),aE(),gI(3),Lh(Fw(8,14,"step-list.extract.path")),gI(2),lh("ngModel",o.asExtract(t).path??""),ch("data-testid","extract-path-"+n),aE(),gI(3),Lh(Fw(13,16,"step-list.extract.pattern")),gI(2),lh("ngModel",o.asExtract(t).pattern??""),ch("data-testid","extract-pattern-"+n),aE(),gI(3),Lh(Fw(18,18,"step-list.extract.onNoMatch")),gI(2),lh("ngModel",o.asExtract(t).onNoMatch),ch("data-testid","extract-on-no-match-"+n),aE(),gI(),AD(o.extractOnNoMatchActions);}}function So(i,l){if(i&1&&(uh(0,"nz-option",15),Pw(1,"transloco")),i&2){let e=l.$implicit,t=HD(4);lh("nzValue",e)("nzLabel",Fw(1,2,t.gitOperationKey(e)));}}function yo(i,l){if(i&1){let e=FD();_i$1(0,"label",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"input",18),mh("ngModelChange",function(n){Fu(e);let o=HD(4).$index,d=HD();return ju(d.setGitParam(o,"baseBranch",n))}),Jc(),iE(),Jc(),_i$1(5,"label",16)(6,"span"),Iw(7),Pw(8,"transloco"),Jc(),_i$1(9,"input",18),mh("ngModelChange",function(n){Fu(e);let o=HD(4).$index,d=HD();return ju(d.setGitParam(o,"branchName",n))}),Jc(),iE(),Jc();}if(i&2){let e=HD(4),t=e.$implicit,n=e.$index,o=HD();gI(2),Lh(Fw(3,6,"step-list.createWorktree.baseBranch")),gI(2),lh("ngModel",o.gitParam(o.asGit(t),"baseBranch")),ch("data-testid","git-base-branch-"+n),aE(),gI(3),Lh(Fw(8,8,"step-list.createWorktree.branchName")),gI(2),lh("ngModel",o.gitParam(o.asGit(t),"branchName")),ch("data-testid","git-branch-name-"+n),aE();}}function zo(i,l){if(i&1){let e=FD();_i$1(0,"label",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"input",18),mh("ngModelChange",function(n){Fu(e);let o=HD(4).$index,d=HD();return ju(d.setGitParam(o,"branch",n))}),Jc(),iE(),Jc();}if(i&2){let e=HD(4),t=e.$implicit,n=e.$index,o=HD();gI(2),Lh(Fw(3,3,"step-list.createWorktree.branch")),gI(2),lh("ngModel",o.gitParam(o.asGit(t),"branch")),ch("data-testid","git-branch-"+n),aE();}}function Mo(i,l){if(i&1){let e=FD();_i$1(0,"div",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"nz-select",26),mh("ngModelChange",function(n){Fu(e);let o=HD(3).$index,d=HD();return ju(d.setCreateWorktreeMode(o,n))}),uh(5,"nz-option",34),Pw(6,"transloco"),uh(7,"nz-option",35),Pw(8,"transloco"),Jc(),iE(),Jc(),_i$1(9,"div",16)(10,"span"),Iw(11),Pw(12,"transloco"),Jc(),_i$1(13,"app-repo-path-picker",36),mh("pathChange",function(n){Fu(e);let o=HD(3).$index,d=HD();return ju(d.setGitParam(o,"repoPath",n))})("repoSelected",function(n){Fu(e);let o=HD(3).$index,d=HD();return ju(d.applyCreateWorktreeCatalogRepo(o,n))}),Jc()(),_D(14,yo,10,10)(15,zo,5,5,"label",16);}if(i&2){let e=HD(3),t=e.$implicit,n=e.$index,o=HD();gI(2),Lh(Fw(3,9,"step-list.createWorktree.mode")),gI(2),lh("ngModel",o.createWorktreeMode(o.asGit(t))),ch("data-testid","git-worktree-mode-"+n),aE(),gI(),lh("nzLabel",Fw(6,11,"step-list.createWorktree.newBranch")),gI(2),lh("nzLabel",Fw(8,13,"step-list.createWorktree.existingBranch")),gI(4),Lh(Fw(12,15,"step-list.createWorktree.repoPath")),gI(2),lh("path",o.gitParam(o.asGit(t),"repoPath")),ch("data-testid","git-repo-path-"+n),gI(),MD(o.createWorktreeMode(o.asGit(t))==="new-branch"?14:15);}}function Eo(i,l){if(i&1){let e=FD();_i$1(0,"div",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"app-key-value-editor",37),mh("rowsChange",function(n){Fu(e);let o=HD(3),d=o.$implicit,I=o.$index,J=HD();return ju(J.onParamRowsChange(I,d,n))}),Jc()();}if(i&2){let e=HD(3).$implicit,t=HD();gI(2),Lh(Fw(3,2,"step-list.params")),gI(2),lh("rows",t.paramRows(e));}}function To(i,l){if(i&1){let e=FD();_i$1(0,"div",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"nz-select",26),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.patchAt(o,{operation:n}))}),xD(5,So,2,4,"nz-option",15,ND),Jc(),iE(),Jc(),_D(7,Mo,16,17)(8,Eo,5,4,"div",16);}if(i&2){let e=HD(2),t=e.$implicit,n=e.$index,o=HD();gI(2),Lh(Fw(3,4,"step-list.operation")),gI(2),lh("ngModel",o.asGit(t).operation),ch("data-testid","git-operation-"+n),aE(),gI(),AD(o.gitOperations),gI(2),MD(o.asGit(t).operation==="create_worktree"?7:8);}}function ko(i,l){if(i&1&&uh(0,"nz-alert",38),i&2){let e=HD(3).$index;lh("nzMessage",l),ch("data-testid","extended-action-mismatch-"+e);}}function Io(i,l){if(i&1&&(uh(0,"nz-option",15),Pw(1,"transloco")),i&2){let e=l.$implicit,t=HD(5);lh("nzValue",e)("nzLabel",Fw(1,2,t.subjectTypeKey(e)));}}function No(i,l){if(i&1&&uh(0,"nz-option",15),i&2){let e=l.$implicit;lh("nzValue",e.id)("nzLabel",e.displayName);}}function Fo(i,l){if(i&1){let e=FD();_i$1(0,"div",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"nz-select",26),mh("ngModelChange",function(n){Fu(e);let o=HD(3).$index,d=HD();return ju(d.setTargetSubjectType(o,n))}),xD(5,Io,2,4,"nz-option",15,ND),Jc(),iE(),Jc(),_i$1(7,"div",16)(8,"span"),Iw(9),Pw(10,"transloco"),Jc(),_i$1(11,"nz-select",41),Pw(12,"transloco"),mh("ngModelChange",function(n){Fu(e);let o=HD(3).$index,d=HD();return ju(d.setTargetSource(o,n))}),xD(13,No,1,2,"nz-option",15,he),Jc(),iE(),Jc(),_i$1(15,"label",16)(16,"span"),Iw(17),Pw(18,"transloco"),Jc(),_i$1(19,"input",18),mh("ngModelChange",function(n){Fu(e);let o=HD(3).$index,d=HD();return ju(d.setTargetSubjectId(o,n))}),Jc(),iE(),_i$1(20,"span",19),Iw(21),Pw(22,"transloco"),Jc()();}if(i&2){let e=l,t=HD(3),n=t.$implicit,o=t.$index,d=HD();gI(2),Lh(Fw(3,11,"step-list.target.subjectType")),gI(2),lh("ngModel",e.subjectType),ch("data-testid","provider-action-target-type-"+o),aE(),gI(),AD(d.targetSubjectTypes),gI(4),Lh(Fw(10,13,"step-list.target.source")),gI(2),lh("ngModel",e.source||null)("nzPlaceHolder",Fw(12,15,"step-list.target.sourcePlaceholder")),ch("data-testid","provider-action-target-source-"+o),aE(),gI(2),AD(d.targetInstanceOptions(d.asProvider(n))),gI(4),Lh(Fw(18,17,"step-list.target.subjectId")),gI(2),lh("ngModel",e.subjectId),ch("data-testid","provider-action-target-id-"+o),aE(),gI(2),Lh(Fw(22,19,"step-list.target.subjectIdHint"));}}function Po(i,l){if(i&1&&uh(0,"nz-option",15),i&2){let e=l.$implicit,t=HD(5);lh("nzValue",e)("nzLabel",t.providerLabel(e));}}function Vo(i,l){if(i&1&&uh(0,"nz-option",15),i&2){let e=l.$implicit;lh("nzValue",e.actionId)("nzLabel",e.label);}}function Ao(i,l){i&1&&(_i$1(0,"span",19),Iw(1),Pw(2,"transloco"),Jc()),i&2&&(gI(),Lh(Fw(2,1,"step-list.extendedAction.empty")));}function $o(i,l){i&1&&(_i$1(0,"span",42),Iw(1,"*"),Jc());}function Bo(i,l){if(i&1&&uh(0,"nz-option",15),i&2){let e=l.$implicit;lh("nzValue",e)("nzLabel",e);}}function Do(i,l){if(i&1){let e=FD();_i$1(0,"nz-select",26),mh("ngModelChange",function(n){Fu(e);let o=HD().$implicit,d=HD(5).$index,I=HD();return ju(I.setExtendedParam(d,o.name,n))}),xD(1,Bo,1,2,"nz-option",15,ND),Jc(),iE();}if(i&2){let e=HD().$implicit,t=HD(5),n=t.$implicit,o=t.$index,d=HD();lh("ngModel",d.extendedParamValue(d.asProvider(n),e.name)),ch("data-testid","extended-action-param-"+e.name+"-"+o),aE(),gI(),AD(e.options??xw(2,$n));}}function Lo(i,l){if(i&1){let e=FD();_i$1(0,"input",18),mh("ngModelChange",function(n){Fu(e);let o=HD().$implicit,d=HD(5).$index,I=HD();return ju(I.setExtendedParam(d,o.name,n))}),Jc(),iE();}if(i&2){let e=HD().$implicit,t=HD(5),n=t.$implicit,o=t.$index,d=HD();lh("ngModel",d.extendedParamValue(d.asProvider(n),e.name)),ch("data-testid","extended-action-param-"+e.name+"-"+o),aE();}}function Oo(i,l){if(i&1&&(_i$1(0,"label",16)(1,"span"),Iw(2),_D(3,$o,2,0,"span",42),Jc(),_D(4,Do,3,3,"nz-select",43)(5,Lo,1,2,"input",44),Jc()),i&2){let e=l.$implicit;gI(2),rl$1(" ",e.label," "),gI(),MD(e.required?3:-1),gI(),MD(e.type==="select"?4:5);}}function Wo(i,l){i&1&&xD(0,Oo,6,3,"label",16,ro),i&2&&AD(l.params);}function jo(i,l){if(i&1){let e=FD();_i$1(0,"div",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"nz-select",26),mh("ngModelChange",function(n){Fu(e);let o=HD(3).$index,d=HD();return ju(d.setExtendedProvider(o,n))}),xD(5,Po,1,2,"nz-option",15,ND),Jc(),iE(),Jc(),_i$1(7,"div",16)(8,"span"),Iw(9),Pw(10,"transloco"),Jc(),_i$1(11,"nz-select",41),Pw(12,"transloco"),mh("ngModelChange",function(n){Fu(e);let o=HD(3).$index,d=HD();return ju(d.setExtendedAction(o,n))}),xD(13,Vo,1,2,"nz-option",15,oo),Jc(),iE(),_D(15,Ao,3,3,"span",19),Jc(),_D(16,Wo,2,0);}if(i&2){let e,t=HD(3),n=t.$implicit,o=t.$index,d=HD();gI(2),Lh(Fw(3,9,"step-list.extendedAction.provider")),gI(2),lh("ngModel",d.asProvider(n).extendedAction?.providerId),ch("data-testid","extended-action-provider-"+o),aE(),gI(),AD(d.extendedProviderOptions()),gI(4),Lh(Fw(10,11,"step-list.extendedAction.action")),gI(2),lh("ngModel",d.asProvider(n).extendedAction?.actionId||null)("nzPlaceHolder",Fw(12,13,"step-list.extendedAction.none")),ch("data-testid","extended-action-id-"+o),aE(),gI(2),AD(d.extendedDescriptors(d.asProvider(n))),gI(2),MD(d.extendedDescriptors(d.asProvider(n)).length===0?15:-1),gI(),MD((e=d.selectedExtendedDescriptor(d.asProvider(n)))?16:-1,e);}}function Ro(i,l){if(i&1&&(uh(0,"nz-option",15),Pw(1,"transloco")),i&2){let e=l.$implicit,t=HD(5);lh("nzValue",e)("nzLabel",Fw(1,2,t.providerActionKey(e)));}}function Ko(i,l){if(i&1){let e=FD();_i$1(0,"div",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"nz-select",26),mh("ngModelChange",function(n){Fu(e);let o=HD(3).$index,d=HD();return ju(d.patchAt(o,{action:n}))}),xD(5,Ro,2,4,"nz-option",15,ND),Jc(),iE(),Jc(),_i$1(7,"div",16)(8,"span"),Iw(9),Pw(10,"transloco"),Jc(),_i$1(11,"app-key-value-editor",37),mh("rowsChange",function(n){Fu(e);let o=HD(3),d=o.$implicit,I=o.$index,J=HD();return ju(J.onParamRowsChange(I,d,n))}),Jc()();}if(i&2){let e=HD(3),t=e.$implicit,n=e.$index,o=HD();gI(2),Lh(Fw(3,5,"step-list.action")),gI(2),lh("ngModel",o.asProvider(t).action),ch("data-testid","provider-action-"+n),aE(),gI(),AD(o.providerActions),gI(4),Lh(Fw(10,7,"step-list.params")),gI(2),lh("rows",o.paramRows(t));}}function Ho(i,l){if(i&1){let e=FD();_D(0,ko,1,2,"nz-alert",38),_i$1(1,"label",22),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.setTargetEnabled(o,n))}),Iw(2),Pw(3,"transloco"),Jc(),iE(),_D(4,Fo,23,21),_i$1(5,"div",16)(6,"span"),Iw(7),Pw(8,"transloco"),Jc(),_i$1(9,"nz-select",26),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.setActionMode(o,n))}),uh(10,"nz-option",39),Pw(11,"transloco"),uh(12,"nz-option",40),Pw(13,"transloco"),Jc(),iE(),Jc(),_D(14,jo,17,15)(15,Ko,12,9);}if(i&2){let e,t,n=HD(2),o=n.$implicit,d=n.$index,I=HD();MD((e=I.mismatchWarning(I.asProvider(o)))?0:-1,e),gI(),lh("ngModel",I.hasTarget(o)),ch("data-testid","provider-action-target-toggle-"+d),aE(),gI(),rl$1(" ",Fw(3,11,"step-list.target.toggle")," "),gI(2),MD((t=I.asProvider(o).target)?4:-1,t),gI(3),Lh(Fw(8,13,"step-list.extendedAction.mode")),gI(2),lh("ngModel",I.isExtended(o)?"extended":"portable"),ch("data-testid","provider-action-mode-"+d),aE(),gI(),lh("nzLabel",Fw(11,15,"step-list.extendedAction.portable")),gI(2),lh("nzLabel",Fw(13,17,"step-list.extendedAction.extended")),gI(2),MD(I.isExtended(o)?14:15);}}function qo(i,l){if(i&1&&uh(0,"nz-option",15),i&2){let e=l.$implicit,t=HD(4);lh("nzValue",e.id)("nzLabel",t.workflowOptionLabel(e));}}function Go(i,l){if(i&1){let e=FD();_i$1(0,"label",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"input",18),mh("ngModelChange",function(n){Fu(e);let o=HD(3).$index,d=HD();return ju(d.setSubWorkflowSource(o,n))}),Jc(),iE(),_i$1(5,"p",19),Iw(6),Pw(7,"transloco"),Jc()();}if(i&2){let e=HD(3),t=e.$implicit,n=e.$index,o=HD();gI(2),Lh(Fw(3,4,"step-list.forEach.sourcePath")),gI(2),lh("ngModel",o.subWorkflowSource(t)),ch("data-testid","sub-workflow-foreach-source-"+n),aE(),gI(2),Lh(Fw(7,6,"step-list.forEach.sourceHint"));}}function Uo(i,l){if(i&1){let e=FD();_i$1(0,"div",16)(1,"span"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"nz-select",45),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.patchAt(o,{workflowId:n}))}),xD(5,qo,1,2,"nz-option",15,he),Jc(),iE(),Jc(),_i$1(7,"div",16)(8,"span"),Iw(9),Pw(10,"transloco"),Jc(),_i$1(11,"nz-select",26),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.setSubWorkflowForEachMode(o,n))}),uh(12,"nz-option",46),Pw(13,"transloco"),uh(14,"nz-option",47),Pw(15,"transloco"),Jc(),iE(),Jc(),_D(16,Go,8,8,"label",16);}if(i&2){let e=HD(2),t=e.$implicit,n=e.$index,o=HD();gI(2),Lh(Fw(3,9,"step-list.workflowId")),gI(2),lh("ngModel",o.asSubWorkflow(t).workflowId),ch("data-testid","sub-workflow-id-"+n),aE(),gI(),AD(o.childWorkflowOptions(t)),gI(4),Lh(Fw(10,11,"step-list.forEach")),gI(2),lh("ngModel",o.subWorkflowForEachMode(t)),ch("data-testid","sub-workflow-foreach-mode-"+n),aE(),gI(),lh("nzLabel",Fw(13,13,"step-list.forEach.selection")),gI(2),lh("nzLabel",Fw(15,15,"step-list.forEach.source")),gI(2),MD(o.subWorkflowForEachMode(t)==="source"?16:-1);}}function Jo(i,l){if(i&1&&(uh(0,"nz-option",15),Pw(1,"transloco")),i&2){let e=l.$implicit,t=HD(4);lh("nzValue",e)("nzLabel",Fw(1,2,t.onMaxIterationsKey(e)));}}function Zo(i,l){if(i&1){let e=FD();_i$1(0,"app-field-condition-editor",24),mh("conditionChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.patchAt(o,{until:n}))}),Jc(),_i$1(1,"div",48)(2,"label",16)(3,"span"),Iw(4),Pw(5,"transloco"),Jc(),_i$1(6,"nz-input-number",49),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.patchAt(o,{maxIterations:n??0}))}),Jc(),iE(),Jc(),_i$1(7,"div",16)(8,"span"),Iw(9),Pw(10,"transloco"),Jc(),_i$1(11,"nz-select",26),mh("ngModelChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.patchAt(o,{onMaxIterations:{action:n}}))}),xD(12,Jo,2,4,"nz-option",15,ND),Jc(),iE(),Jc()(),_i$1(14,"div",50)(15,"h4"),Iw(16),Pw(17,"transloco"),Jc(),_i$1(18,"app-step-list",51),mh("stepsChange",function(n){Fu(e);let o=HD(2).$index,d=HD();return ju(d.setNestedSteps(o,n))}),Jc()();}if(i&2){let e=HD(2),t=e.$implicit,n=e.$index,o=HD();lh("condition",o.asLoop(t).until)("testIdPrefix","loop-until-"+n),gI(4),Lh(Fw(5,18,"step-list.maxIterations")),gI(2),lh("ngModel",o.asLoop(t).maxIterations)("nzMin",0),ch("data-testid","loop-max-"+n),aE(),gI(3),Lh(Fw(10,20,"step-list.onMaxIterations.action")),gI(2),lh("ngModel",o.asLoop(t).onMaxIterations.action),ch("data-testid","loop-on-max-"+n),aE(),gI(),AD(o.maxIterationActions),gI(2),ch("data-testid","loop-nested-"+n),gI(2),Lh(Fw(17,22,"step-list.nestedSteps")),gI(2),lh("steps",o.asLoop(t).steps)("rootSteps",o.effectiveRoot())("availableWorkflows",o.availableWorkflows())("appliesTo",o.appliesTo())("inputSchema",o.inputSchema())("settings",o.settings())("depth",o.depth()+1);}}function Qo(i,l){if(i&1){let e=FD();_i$1(0,"div",12)(1,"div",13)(2,"nz-select",14),mh("ngModelChange",function(n){Fu(e);let o=HD().$index,d=HD();return ju(d.changeType(o,n))}),xD(3,ao,2,4,"nz-option",15,ND),Jc(),iE(),Jc(),_i$1(5,"label",16)(6,"span"),Iw(7),Pw(8,"transloco"),Jc(),_i$1(9,"input",17),mh("ngModelChange",function(n){Fu(e);let o=HD().$index,d=HD();return ju(d.onNameChange(o,n))}),Jc(),iE(),Jc(),_i$1(10,"label",16)(11,"span"),Iw(12),Pw(13,"transloco"),Jc(),_i$1(14,"input",18),mh("ngModelChange",function(n){Fu(e);let o=HD().$index,d=HD();return ju(d.onIdChange(o,n))}),Jc(),iE(),_i$1(15,"p",19),Iw(16),Pw(17,"transloco"),Jc()(),uh(18,"app-available-parameters",20),_i$1(19,"section",21)(20,"label",22),mh("ngModelChange",function(n){Fu(e);let o=HD().$index,d=HD();return ju(d.setConditionEnabled(o,n))}),Iw(21),Pw(22,"transloco"),Jc(),iE(),_i$1(23,"p",19),Iw(24),Pw(25,"transloco"),Jc(),_D(26,so,1,2,"app-field-condition-editor",23),Jc(),_D(27,mo,32,29)(28,ho,8,6)(29,bo,5,5,"label",16)(30,wo,22,20)(31,To,9,6)(32,Ho,16,19)(33,Uo,17,17)(34,Zo,19,24),Jc();}if(i&2){let e,t,n=HD(),o=n.$implicit,d=n.$index,I=HD();ch("data-testid","step-body-"+d),gI(2),lh("ngModel",o.type),ch("data-testid","step-type-"+d),aE(),gI(),AD(I.stepTypes),gI(4),Lh(Fw(8,21,"step-list.name")),gI(2),lh("ngModel",o.name),ch("data-testid","step-name-"+d),aE(),gI(3),Lh(Fw(13,23,"step-list.id")),gI(2),lh("ngModel",o.id),ch("data-testid","step-id-"+d),aE(),gI(2),Lh(Fw(17,25,"step-list.idHint")),gI(2),lh("inputSchema",I.inputSchema())("appliesTo",I.appliesTo())("previousSteps",I.previousFor(o))("currentStepType",o.type),gI(),ch("data-testid","step-condition-"+d),gI(),lh("ngModel",!!o.condition),ch("data-testid","step-condition-toggle-"+d),aE(),gI(),rl$1(" ",Fw(22,27,"step-list.condition.title")," "),gI(3),Lh(Fw(25,29,"step-list.condition.hint")),gI(2),MD((e=o.condition)?26:-1,e),gI(),MD((t=o.type)==="agent"?27:t==="interaction"?28:t==="shell"?29:t==="extract"?30:t==="git"?31:t==="provider_action"?32:t==="sub_workflow"?33:t==="loop"?34:-1);}}function Yo(i,l){if(i&1){let e=FD();_i$1(0,"nz-card",3)(1,"div",4),mh("click",function(){let n=Fu(e).$implicit,o=HD();return ju(o.toggleExpanded(n))}),_i$1(2,"div",5)(3,"span",6),Iw(4),Jc(),_i$1(5,"span",7),Iw(6),Pw(7,"transloco"),Jc(),_i$1(8,"span",8),Iw(9),Pw(10,"transloco"),Jc()(),_i$1(11,"div",9),mh("click",function(n){return n.stopPropagation()}),_i$1(12,"button",10),mh("click",function(){let n=Fu(e).$index,o=HD();return ju(o.moveUp(n))}),Iw(13),Pw(14,"transloco"),Jc(),_i$1(15,"button",10),mh("click",function(){let n=Fu(e).$index,o=HD();return ju(o.moveDown(n))}),Iw(16),Pw(17,"transloco"),Jc(),_i$1(18,"button",11),mh("click",function(){let n=Fu(e).$index,o=HD();return ju(o.removeStep(n))}),Iw(19),Pw(20,"transloco"),Jc()()(),_D(21,Qo,35,31,"div",12),Jc();}if(i&2){let e=l.$implicit,t=l.$index,n=HD();Sh("step-card-expanded",n.isExpanded(e)),ch("data-testid","step-card-"+t),gI(),ch("data-testid","step-header-"+t),gI(3),Lh(n.isExpanded(e)?"\u25BE":"\u25B8"),gI(),ch("data-testid","step-header-name-"+t),gI(),rl$1(" ",e.name||Fw(7,18,"step-list.unnamed")," "),gI(2),ch("data-testid","step-type-label-"+t),gI(),rl$1(" ",Fw(10,20,n.stepTypeKey(e.type))," "),gI(3),lh("disabled",t===0),ch("data-testid","move-up-"+t),gI(),rl$1(" ",Fw(14,22,"step-list.moveUp")," "),gI(2),lh("disabled",t===n.steps().length-1),ch("data-testid","move-down-"+t),gI(),rl$1(" ",Fw(17,24,"step-list.moveDown")," "),gI(2),ch("data-testid","remove-"+t),gI(),rl$1(" ",Fw(20,26,"step-list.remove")," "),gI(2),MD(n.isExpanded(e)?21:-1);}}var Bn=(()=>{class i{constructor(){this.transloco=C(Ve),this.language=C(O),this.providersApi=C(B),this.contextFilesApi=C(ze),this.modal=C(jn$1),this.steps=q0.required(),this.rootSteps=q0([]),this.availableWorkflows=q0([]),this.appliesTo=q0("none"),this.inputSchema=q0([]),this.settings=q0(z_),this.depth=q0(0),this.stepsChange=U0(),this.stepTypes=y,this.outputFormats=["questionnaire","confirmation","comment_suggestions","free_text"],this.interactions=["questionnaire","confirmation","comment_review"],this.gitOperations=["create_worktree","checkout","create_branch","commit","push"],this.providerActions=["get_subject","get_comments","post_comment","update_status","get_content"],this.maxIterationActions=["fail","continue","ask_human"],this.extractOnNoMatchActions=["fail","empty","ask_human"],this.expandedKey=qo$1(null),this.contextFiles=qo$1([]),this.paramRowsByStepKey=new Map,this.actionsByProvider=new Map,this.loadingActions=new Set,this.targetSubjectTypes=V,this.contextFilesApi.list().pipe(ue()).subscribe({next:e=>this.contextFiles.set(e),error:()=>this.contextFiles.set([])}),id(()=>{for(let e of this.steps())e.type==="provider_action"&&e.extendedAction?.providerId&&this.ensureActionsLoaded(e.extendedAction.providerId);});}stepTypeKey(e){return `step-list.stepType.${e}`}outputFormatKey(e){return `step-list.outputFormat.${e}`}interactionKey(e){return `step-list.interaction.${e}`}gitOperationKey(e){return `step-list.gitOperation.${e}`}providerActionKey(e){return `step-list.providerAction.${e}`}onMaxIterationsKey(e){return `step-list.onMaxIterations.${e}`}onNoMatchKey(e){return `step-list.onNoMatch.${e}`}workflowOptionLabel(e){return this.language.currentLang(),this.transloco.translate("step-list.workflowOption",{name:e.name,id:e.id})}effectiveRoot(){let e=this.rootSteps();return e.length>0?e:this.steps()}previousFor(e){return im(this.effectiveRoot(),e)}commentSuggestionSources(e){return V_(this.effectiveRoot(),e).filter(t=>!!t.id).map(t=>({id:t.id,label:t.name?.trim()?`${t.name} (${t.id})`:t.id}))}onInteractionChange(e,t){if(t==="comment_review"){let n=this.asInteraction(this.steps()[e]);this.patchAt(e,{interaction:t,sourceStepIds:n.sourceStepIds??[]});return}this.patchAt(e,{interaction:t,sourceStepIds:void 0});}trackKey(e){return e._key}isExpanded(e){return this.expandedKey()===e._key}toggleExpanded(e){this.expandedKey.update(t=>t===e._key?null:e._key);}addStep(){this.emit([...this.steps(),h("agent")]);}removeStep(e){let t=this.steps()[e];t&&this.paramRowsByStepKey.delete(t._key),this.emit(this.steps().filter((n,o)=>o!==e));}moveUp(e){if(e<=0)return;let t=[...this.steps()],n=t[e-1];t[e-1]=t[e],t[e]=n,this.emit(t);}moveDown(e){if(e>=this.steps().length-1)return;let t=[...this.steps()],n=t[e+1];t[e+1]=t[e],t[e]=n,this.emit(t);}changeType(e,t){let n=this.steps()[e];if(!n||n.type===t)return;this.paramRowsByStepKey.delete(n._key);let o=h(t,{id:n.id,name:n.name,idAutoSync:n._idAutoSync,key:n._key});this.replaceAt(e,n.condition?s(r$1({},o),{condition:n.condition}):o);}patchAt(e,t){let n=this.steps()[e];n&&this.replaceAt(e,r$1(r$1({},n),t));}onNameChange(e,t){let n=this.steps()[e];n&&this.replaceAt(e,E(n,t,this.effectiveRoot()));}onIdChange(e,t){let n=this.steps()[e];n&&this.replaceAt(e,P(n,t));}setNestedSteps(e,t){let n=this.steps()[e];!n||n.type!=="loop"||this.replaceAt(e,s(r$1({},n),{steps:t}));}asAgent(e){return e}asInteraction(e){return e}asShell(e){return e}asExtract(e){return e}asGit(e){return e}createWorktreeMode(e){return e.params?.mode==="existing-branch"?"existing-branch":"new-branch"}gitParam(e,t){let n=e.params?.[t];return typeof n=="string"?n:""}setGitParam(e,t,n){let o=this.steps()[e];!o||o.type!=="git"||(this.paramRowsByStepKey.delete(o._key),this.patchAt(e,{params:s(r$1({},o.params),{[t]:n})}));}applyCreateWorktreeCatalogRepo(e,t){let n=this.steps()[e];if(!n||n.type!=="git")return;this.paramRowsByStepKey.delete(n._key);let o=s(r$1({},n.params),{repoPath:t.localPath}),d=this.gitParam(n,"baseBranch").trim(),I=t.defaultBranch?.trim();!d&&I&&(o.baseBranch=I),this.patchAt(e,{params:o});}setCreateWorktreeMode(e,t){let n=this.steps()[e];if(!n||n.type!=="git")return;let o=this.gitParam(n,"repoPath");if(this.paramRowsByStepKey.delete(n._key),t==="existing-branch"){this.patchAt(e,{params:{mode:"existing-branch",repoPath:o,branch:this.gitParam(n,"branch")||this.gitParam(n,"branchName")}});return}this.patchAt(e,{params:{repoPath:o,baseBranch:this.gitParam(n,"baseBranch"),branchName:this.gitParam(n,"branchName")||this.gitParam(n,"branch")}});}asProvider(e){return e}asSubWorkflow(e){return e}subWorkflowForEachMode(e){return typeof this.asSubWorkflow(e).forEach=="object"?"source":"selection"}setSubWorkflowForEachMode(e,t){if(t==="selection"){this.patchAt(e,{forEach:"selection"});return}let n=this.asSubWorkflow(this.steps()[e]),o=typeof n.forEach=="object"?n.forEach.source:"";this.patchAt(e,{forEach:{source:o}});}subWorkflowSource(e){let t=this.asSubWorkflow(e).forEach;return typeof t=="object"?t.source:""}setSubWorkflowSource(e,t){this.patchAt(e,{forEach:{source:t}});}childWorkflowOptions(e){let t=this.availableWorkflows();return this.subWorkflowForEachMode(e)!=="source"?t:t.filter(n=>n.appliesTo==="none")}asLoop(e){return e}paramRows(e){let t=this.paramRowsByStepKey.get(e._key);if(!t){let n=e.type==="git"||e.type==="provider_action"?e.params:void 0;t=A(n),this.paramRowsByStepKey.set(e._key,t);}return t}onParamRowsChange(e,t,n){this.paramRowsByStepKey.set(t._key,n),this.patchAt(e,{params:j(n)});}isExtended(e){return e.type==="provider_action"&&An(this.asProvider(e))}setActionMode(e,t){let n=this.asProvider(this.steps()[e]);if(t==="portable"){let d=n,{extendedAction:I}=d,J=t$1(d,["extendedAction"]);this.replaceAt(e,J);return}let o=Pn(this.appliesTo(),this.settings());this.patchAt(e,{extendedAction:{providerId:o,actionId:"",params:{}}}),this.ensureActionsLoaded(o);}extendedProviderOptions(){return $e(this.appliesTo(),this.settings())}providerLabel(e){return (this.settings().providerInstances??[]).find(n=>n.id===e)?.displayName||e}agentInstanceOptions(){return (this.settings().providerInstances??[]).filter(e=>e.kind==="agent")}setAgentInstance(e,t){this.patchAt(e,{agentInstanceId:t||void 0});}selectedContextFiles(e){let t=e.contextFileIds??[],n=this.contextFiles();return t.map(o=>n.find(d=>d.id===o)??{id:o,name:o,tier:"user",path:""})}removeContextFile(e,t){let n=this.asAgent(this.steps()[e]);this.patchAt(e,{contextFileIds:(n.contextFileIds??[]).filter(o=>o!==t)});}openContextFilePicker(e){let t=this.asAgent(this.steps()[e]),n=this.modal.create({nzTitle:this.transloco.translate("context-files.selectTitle"),nzContent:St,nzData:{selectionMode:true,selectedIds:[...t.contextFileIds??[]]},nzWidth:800,nzOnOk:()=>{let o=n.getContentComponent();this.patchAt(e,{contextFileIds:o.currentSelectedIds()}),this.contextFilesApi.list().subscribe({next:d=>this.contextFiles.set(d)});}});}setExtendedProvider(e,t){this.patchAt(e,{extendedAction:{providerId:t,actionId:"",params:{}}}),this.ensureActionsLoaded(t);}setExtendedAction(e,t){let n=this.asProvider(this.steps()[e]),o=this.extendedDescriptors(n).find(d=>d.actionId===t);this.patchAt(e,{extendedAction:{providerId:n.extendedAction?.providerId??"",actionId:t,params:o?Xo(o):{}}});}setExtendedParam(e,t,n){let d=this.asProvider(this.steps()[e]).extendedAction;d&&this.patchAt(e,{extendedAction:s(r$1({},d),{params:s(r$1({},d.params??{}),{[t]:n})})});}extendedParamValue(e,t){let n=e.extendedAction?.params?.[t];return n==null?"":String(n)}extendedDescriptors(e){let t=e.extendedAction?.providerId;return t?this.actionsByProvider.get(t)??[]:[]}selectedExtendedDescriptor(e){let t=e.extendedAction?.actionId;if(t)return this.extendedDescriptors(e).find(n=>n.actionId===t)}mismatchWarning(e){let t=Vn(e,this.appliesTo(),this.settings());return t?(this.language.currentLang(),this.transloco.translate("step-list.extendedAction.mismatch",t)):null}hasTarget(e){return e.type==="provider_action"&&this.asProvider(e).target!=null}setTargetEnabled(e,t){let n=this.asProvider(this.steps()[e]);if(!t){let o=n,{target:d}=o,I=t$1(o,["target"]);this.replaceAt(e,I);return}this.patchAt(e,{target:{subjectType:"ticket",source:"",subjectId:""}});}setTargetSubjectType(e,t){let n=this.asProvider(this.steps()[e]);this.patchAt(e,{target:{subjectType:t,source:"",subjectId:n.target?.subjectId??""}});}setTargetSource(e,t){let n=this.asProvider(this.steps()[e]);n.target&&this.patchAt(e,{target:s(r$1({},n.target),{source:t})});}setTargetSubjectId(e,t){let n=this.asProvider(this.steps()[e]);n.target&&this.patchAt(e,{target:s(r$1({},n.target),{subjectId:t})});}targetInstanceOptions(e){let t=e.target?.subjectType;return t?z$1(this.settings(),[t]):[]}setConditionEnabled(e,t){if(t){let n=this.steps()[e];this.patchAt(e,{condition:n?.condition??En()});return}this.patchAt(e,{condition:void 0});}subjectTypeKey(e){return `workflow-editor.subjectType.${e}`}ensureActionsLoaded(e){!e||this.actionsByProvider.has(e)||this.loadingActions.has(e)||(this.loadingActions.add(e),this.providersApi.listExtendedActions(e).subscribe({next:t=>{this.loadingActions.delete(e),this.actionsByProvider.set(e,t);},error:()=>{this.loadingActions.delete(e),this.actionsByProvider.set(e,[]);}}));}replaceAt(e,t){this.emit(this.steps().map((n,o)=>o===e?t:n));}emit(e){this.stepsChange.emit(e);}static{this.\u0275fac=function(t){return new(t||i)};}static{this.\u0275cmp=ZE({type:i,selectors:[["app-step-list"]],inputs:{steps:[1,"steps"],rootSteps:[1,"rootSteps"],availableWorkflows:[1,"availableWorkflows"],appliesTo:[1,"appliesTo"],inputSchema:[1,"inputSchema"],settings:[1,"settings"],depth:[1,"depth"]},outputs:{stepsChange:"stepsChange"},decls:6,vars:4,consts:[["data-testid","step-list",1,"step-list"],[1,"step-card",3,"step-card-expanded"],["nz-button","","nzType","dashed","nzBlock","","type","button","data-testid","add-step",3,"click"],[1,"step-card"],[1,"step-header",3,"click"],[1,"step-header-meta"],["aria-hidden","true",1,"step-chevron"],[1,"step-name-preview"],[1,"step-type"],[1,"step-header-actions",3,"click"],["nz-button","","type","button",3,"click","disabled"],["nz-button","","nzDanger","","type","button",3,"click"],[1,"step-body"],[1,"step-toolbar"],[1,"type-select",3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel"],[1,"field"],["nz-input","","required","",3,"ngModelChange","ngModel"],["nz-input","",3,"ngModelChange","ngModel"],[1,"hint"],[3,"inputSchema","appliesTo","previousSteps","currentStepType"],[1,"condition-section"],["nz-checkbox","",3,"ngModelChange","ngModel"],[3,"condition","testIdPrefix"],[3,"conditionChange","condition","testIdPrefix"],["nz-input","","rows","3",3,"ngModelChange","ngModel"],[3,"ngModelChange","ngModel"],[1,"context-file-chips"],["nzMode","closeable"],["data-testid","context-files-empty",1,"hint"],["nz-button","","type","button",3,"click"],["nzMode","closeable",3,"nzOnClose"],["nzMode","multiple",3,"ngModelChange","ngModel"],["nz-input","","rows","2",3,"ngModelChange","ngModel"],["nzValue","new-branch",3,"nzLabel"],["nzValue","existing-branch",3,"nzLabel"],[3,"pathChange","repoSelected","path"],[3,"rowsChange","rows"],["nzType","warning","nzShowIcon","",1,"mismatch",3,"nzMessage"],["nzValue","portable",3,"nzLabel"],["nzValue","extended",3,"nzLabel"],[3,"ngModelChange","ngModel","nzPlaceHolder"],[1,"required"],[3,"ngModel"],["nz-input","",3,"ngModel"],["nzShowSearch","","nzAllowClear","",3,"ngModelChange","ngModel"],["nzValue","selection",3,"nzLabel"],["nzValue","source",3,"nzLabel"],[1,"field-grid"],[3,"ngModelChange","ngModel","nzMin"],[1,"nested"],[3,"stepsChange","steps","rootSteps","availableWorkflows","appliesTo","inputSchema","settings","depth"]],template:function(t,n){t&1&&(_i$1(0,"div",0),xD(1,Yo,22,28,"nz-card",1,io,true),_i$1(3,"button",2),mh("click",function(){return n.addStep()}),Iw(4),Pw(5,"transloco"),Jc()()),t&2&&(ch("data-depth",n.depth()),gI(),AD(n.steps()),gI(3),rl$1(" ",Fw(5,2,"step-list.addStep")," "));},dependencies:[i,$8,al,er$1,rl,Ja,$i$1,pf,bd,sp,fp,Nt,Ke,Lt,ut,ai$1,z,wn,ot,ts,ex,Fm,Am,Gn$1,un,W,I$1,Nn,Mn,zn,Sn,Kt],styles:[".step-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.75rem}.step-card[_ngcontent-%COMP%]{background:#fff}.step-header[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.75rem;cursor:pointer;-webkit-user-select:none;user-select:none}.step-header-meta[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;min-width:0}.step-chevron[_ngcontent-%COMP%]{color:#78716c;font-size:.85rem;width:.9rem}.step-type[_ngcontent-%COMP%]{font-size:.75rem;font-weight:600;letter-spacing:.02em;text-transform:uppercase;color:#57534e;background:#f5f5f4;border-radius:999px;padding:.15rem .55rem}.step-name-preview[_ngcontent-%COMP%]{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.step-header-actions[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem}.step-body[_ngcontent-%COMP%]{margin-top:.75rem;padding-top:.75rem;border-top:1px solid #e7e5e4}.step-toolbar[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.5rem;margin-bottom:.75rem;align-items:center}.type-select[_ngcontent-%COMP%]{min-width:11rem}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.65rem 0}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.field-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));gap:.5rem 1rem}.hint[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:#78716c}.mismatch[_ngcontent-%COMP%]{margin:.5rem 0}.required[_ngcontent-%COMP%]{color:#b91c1c}.nested[_ngcontent-%COMP%]{margin-top:.75rem;padding:.75rem;border-left:3px solid #d6d3d1;background:#fafaf9}.nested[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{margin:0 0 .5rem}.condition-section[_ngcontent-%COMP%]{margin:.75rem 0;padding-top:.5rem}.condition-section[_ngcontent-%COMP%] .hint[_ngcontent-%COMP%]{margin:.35rem 0 0}.context-file-chips[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.35rem;align-items:center;margin:.35rem 0}"]});}}return i})();function Xo(i){let l={};for(let e of i.params)l[e.name]=e.type==="select"?e.options?.[0]??"":"";return l}var er=i=>({ids:i});function tr(i,l){if(i&1){let e=FD();_i$1(0,"button",10),mh("click",function(){Fu(e);let n=HD();return ju(n.exportWorkflow())}),Iw(1),Pw(2,"transloco"),Jc();}if(i&2){let e=HD();lh("disabled",e.loading()||!!e.loadError()),gI(),rl$1(" ",Fw(2,2,"workflow-editor.export")," ");}}function nr(i,l){if(i&1){let e=FD();_i$1(0,"button",11),mh("click",function(){Fu(e);let n=HD();return ju(n.startWorkflow())}),Iw(1),Pw(2,"transloco"),Jc();}i&2&&(gI(),rl$1(" ",Fw(2,1,"workflow-editor.start")," "));}function ir(i,l){i&1&&(_i$1(0,"p",8),Iw(1),Pw(2,"transloco"),Jc()),i&2&&(gI(),Lh(Fw(2,1,"workflow-editor.loading")));}function or(i,l){if(i&1&&(_i$1(0,"p",9),Iw(1),Jc()),i&2){let e=HD();gI(),Lh(e.loadError());}}function rr(i,l){if(i&1&&(_i$1(0,"li"),Iw(1),Jc()),i&2){let e=l.$implicit;gI(),Lh(e);}}function ar(i,l){if(i&1&&(_i$1(0,"section",12)(1,"h2"),Iw(2),Pw(3,"transloco"),Jc(),_i$1(4,"ul"),xD(5,rr,2,1,"li",null,ND),Jc()()),i&2){let e=HD(2);gI(2),Lh(Fw(3,1,"workflow-editor.validation")),gI(3),AD(e.validationErrors());}}function sr(i,l){if(i&1&&(uh(0,"nz-option",18),Pw(1,"transloco")),i&2){let e=l.$implicit,t=HD(2);lh("nzValue",e)("nzLabel",Fw(1,2,t.subjectTypeKey(e)));}}function lr(i,l){if(i&1&&(uh(0,"nz-option",20),Pw(1,"transloco")),i&2){let e=l.$implicit,t=HD(2);lh("nzValue",e)("nzLabel",Fw(1,3,t.subjectHandlingKey(e)))("nzDisabled",e==="collection"&&t.appliesToValue()==="none");}}function pr(i,l){if(i&1&&(uh(0,"nz-option",18),Pw(1,"transloco")),i&2){let e=l.$implicit,t=HD(3);lh("nzValue",e)("nzLabel",Fw(1,2,t.inputTypeKey(e)));}}function dr(i,l){if(i&1){let e=FD();_i$1(0,"div",23)(1,"label",15)(2,"span"),Iw(3),Pw(4,"transloco"),Jc(),_i$1(5,"input",27),mh("ngModelChange",function(n){let o=Fu(e).$index,d=HD(2);return ju(d.patchInputField(o,{name:n}))}),Jc(),iE(),Jc(),_i$1(6,"label",15)(7,"span"),Iw(8),Pw(9,"transloco"),Jc(),_i$1(10,"input",27),mh("ngModelChange",function(n){let o=Fu(e).$index,d=HD(2);return ju(d.patchInputField(o,{label:n}))}),Jc(),iE(),Jc(),_i$1(11,"div",15)(12,"span"),Iw(13),Pw(14,"transloco"),Jc(),_i$1(15,"nz-select",28),mh("ngModelChange",function(n){let o=Fu(e).$index,d=HD(2);return ju(d.patchInputField(o,{type:n}))}),xD(16,pr,2,4,"nz-option",18,ND),Jc(),iE(),Jc(),_i$1(18,"label",29),mh("ngModelChange",function(n){let o=Fu(e).$index,d=HD(2);return ju(d.patchInputField(o,{required:n}))}),Iw(19),Pw(20,"transloco"),Jc(),iE(),_i$1(21,"button",30),mh("click",function(){let n=Fu(e).$index,o=HD(2);return ju(o.removeInputField(n))}),Iw(22),Pw(23,"transloco"),Jc()();}if(i&2){let e=l.$implicit,t=l.$index,n=HD(2);ch("data-testid","input-field-"+t),gI(3),Lh(Fw(4,10,"workflow-editor.fieldName")),gI(2),lh("ngModel",e.name),aE(),gI(3),Lh(Fw(9,12,"workflow-editor.fieldLabel")),gI(2),lh("ngModel",e.label),aE(),gI(3),Lh(Fw(14,14,"workflow-editor.fieldType")),gI(2),lh("ngModel",e.type),aE(),gI(),AD(n.inputFieldTypes),gI(2),lh("ngModel",e.required),aE(),gI(),rl$1(" ",Fw(20,16,"workflow-editor.required")," "),gI(3),rl$1(" ",Fw(23,18,"workflow-editor.remove")," ");}}function cr(i,l){if(i&1&&(_i$1(0,"p",25),Iw(1),Pw(2,"transloco"),Jc()),i&2){let e=HD(2);gI(),rl$1(" ",jw(2,1,"workflow-editor.duplicateStepIds",Aw(4,er,e.duplicateStepIds().join(", ")))," ");}}function _r(i,l){if(i&1){let e=FD();_D(0,ar,7,3,"section",12),_i$1(1,"nz-card",13),Pw(2,"transloco"),_i$1(3,"div",14)(4,"label",15)(5,"span"),Iw(6),Pw(7,"transloco"),Jc(),_i$1(8,"input",16),mh("ngModelChange",function(n){Fu(e);let o=HD();return ju(o.patchWorkflow({name:n}))}),Jc(),iE(),Jc(),_i$1(9,"div",15)(10,"span"),Iw(11),Pw(12,"transloco"),Jc(),_i$1(13,"nz-select",17),mh("ngModelChange",function(n){Fu(e);let o=HD();return ju(o.setAppliesTo(n))}),xD(14,sr,2,4,"nz-option",18,ND),Jc(),iE(),Jc(),_i$1(16,"div",15)(17,"span"),Iw(18),Pw(19,"transloco"),Jc(),_i$1(20,"nz-select",19),mh("ngModelChange",function(n){Fu(e);let o=HD();return ju(o.patchWorkflow({subjectHandling:n}))}),xD(21,lr,2,5,"nz-option",20,ND),Jc(),iE(),_i$1(23,"p",21),Iw(24),Pw(25,"transloco"),Jc()()(),_i$1(26,"label",15)(27,"span"),Iw(28),Pw(29,"transloco"),Jc(),_i$1(30,"textarea",22),mh("ngModelChange",function(n){Fu(e);let o=HD();return ju(o.patchWorkflow({description:n||void 0}))}),Jc(),iE(),Jc()(),_i$1(31,"nz-card",13),Pw(32,"transloco"),xD(33,dr,24,20,"div",23,SD),_i$1(35,"button",24),mh("click",function(){Fu(e);let n=HD();return ju(n.addInputField())}),Iw(36),Pw(37,"transloco"),Jc()(),_i$1(38,"nz-card",13),Pw(39,"transloco"),_D(40,cr,3,6,"p",25),_i$1(41,"app-step-list",26),mh("stepsChange",function(n){Fu(e);let o=HD();return ju(o.onStepsChange(n))}),Jc()();}if(i&2){let e=HD();MD(e.validationErrors().length>0?0:-1),gI(),lh("nzTitle",Fw(2,21,"workflow-editor.basics")),gI(5),Lh(Fw(7,23,"workflow-editor.name")),gI(2),lh("ngModel",e.workflow().name),aE(),gI(3),Lh(Fw(12,25,"workflow-editor.appliesTo")),gI(2),lh("ngModel",e.appliesToValue()),aE(),gI(),AD(e.subjectTypes),gI(4),Lh(Fw(19,27,"workflow-editor.subjectHandling.label")),gI(2),lh("ngModel",e.workflow().subjectHandling),aE(),gI(),AD(e.subjectHandlingOptions),gI(3),rl$1(" ",Fw(25,29,e.subjectHandlingHelpKey())," "),gI(4),Lh(Fw(29,31,"workflow-editor.description")),gI(2),lh("ngModel",e.workflow().description??""),aE(),gI(),lh("nzTitle",Fw(32,33,"workflow-editor.inputSchema")),gI(2),AD(e.workflow().inputSchema),gI(3),rl$1(" ",Fw(37,35,"workflow-editor.addInputField")," "),gI(2),lh("nzTitle",Fw(39,37,"workflow-editor.steps")),gI(2),MD(e.duplicateStepIds().length>0?40:-1),gI(),lh("steps",e.workflow().steps)("rootSteps",e.workflow().steps)("availableWorkflows",e.availableWorkflows())("appliesTo",e.workflow().appliesTo)("inputSchema",e.workflow().inputSchema)("settings",e.settings());}}var ms=(()=>{class i{constructor(){this.route=C(C1),this.router=C(J1),this.workflowsApi=C(b),this.settingsApi=C(D),this.message=C(He),this.destroyRef=C(at),this.transloco=C(Ve),this.language=C(O),this.startJob=C(At),this.routeId=de(this.route.paramMap.pipe(Se(e=>e.get("id"))),{initialValue:this.route.snapshot.paramMap.get("id")}),this.workflow=qo$1(I()),this.availableWorkflows=qo$1([]),this.settings=qo$1(z_),this.loadError=qo$1(null),this.validationErrors=qo$1([]),this.duplicateStepIds=qo$1([]),this.saving=qo$1(false),this.loading=qo$1(true),this.isNew=Uw(()=>!this.routeId()),this.canStart=Uw(()=>!this.isNew()&&!this.loading()&&!this.loadError()&&this.workflow().subjectHandling==="per-subject"),this.pageTitle=Uw(()=>(this.language.currentLang(),this.isNew()?this.transloco.translate("workflow-editor.titleNew"):this.transloco.translate("workflow-editor.titleEdit",{name:this.workflow().name.trim()}))),this.subjectTypes=["none","ticket","pull_request","documentation"],this.subjectHandlingOptions=["per-subject","collection"],this.inputFieldTypes=["string","number","boolean","select","localRepository"],this.workflowsApi.list().pipe(ue(this.destroyRef)).subscribe({next:e=>this.availableWorkflows.set(e),error:()=>{}}),this.settingsApi.getSettings().pipe(ue(this.destroyRef)).subscribe({next:e=>this.settings.set(e),error:()=>{}}),this.route.paramMap.pipe(ue(this.destroyRef)).subscribe(e=>{let t=e.get("id");if(this.validationErrors.set([]),this.duplicateStepIds.set([]),this.loadError.set(null),!t){this.workflow.set(I()),this.loading.set(false);return}this.loading.set(true),this.workflowsApi.get(t).subscribe({next:n=>{this.workflow.set(s(r$1({},structuredClone(n)),{steps:_(n.steps,{idAutoSync:false})})),this.loading.set(false);},error:n=>{this.loading.set(false),this.loadError.set(this.errorMessage(n,`Failed to load workflow ${t}`));}});});}subjectTypeKey(e){return `workflow-editor.subjectType.${e}`}subjectHandlingKey(e){return `workflow-editor.subjectHandling.${e}`}subjectHandlingHelpKey(){return `workflow-editor.subjectHandling.help.${this.workflow().subjectHandling}`}inputTypeKey(e){return `workflow-editor.inputType.${e}`}patchWorkflow(e){this.workflow.update(t=>r$1(r$1({},t),e));}setAppliesTo(e){if(e==="none"){this.patchWorkflow({appliesTo:e,subjectHandling:"per-subject"});return}this.patchWorkflow({appliesTo:e});}appliesToValue(){let e=this.workflow().appliesTo;return Array.isArray(e)?e[0]??"none":e}onStepsChange(e){this.patchWorkflow({steps:e}),this.duplicateStepIds.set(Ad(e));}addInputField(){this.patchWorkflow({inputSchema:[...this.workflow().inputSchema,b$1()]});}removeInputField(e){this.patchWorkflow({inputSchema:this.workflow().inputSchema.filter((t,n)=>n!==e)});}patchInputField(e,t){let n=this.workflow().inputSchema.map((o,d)=>d===e?r$1(r$1({},o),t):o);this.patchWorkflow({inputSchema:n});}save(){let e=this.workflow(),t=Ad(e.steps);if(this.duplicateStepIds.set(t),t.length>0){this.validationErrors.set([this.transloco.translate("workflow-editor.duplicateStepIds",{ids:t.join(", ")})]);return}let n=v(e,{omitWorkflowId:this.isNew()}),o=i_.safeParse(n);if(!o.success){this.validationErrors.set(T(o.error));return}this.validationErrors.set([]),this.saving.set(true);let d=o.data,I=this.routeId();(this.isNew()||!I?this.workflowsApi.create(d):this.workflowsApi.update(I,s(r$1({},d),{id:I}))).subscribe({next:me=>{this.saving.set(false),this.workflow.set(s(r$1({},structuredClone(me)),{steps:_(me.steps,{idAutoSync:false})})),this.message.success(this.isNew()?"Workflow created":"Workflow saved"),this.isNew()&&this.router.navigate(["/workflows",me.id,"edit"]);},error:me=>{this.saving.set(false),this.message.error(this.errorMessage(me,"Save failed"));}});}startWorkflow(){let e=this.routeId();!e||!this.canStart()||this.startJob.start({workflowId:e});}exportWorkflow(){let e=this.routeId();e&&this.workflowsApi.exportDefinition(e).subscribe({next:t=>{l(`${ng(t.name)}.json`,JSON.stringify(t,null,2),"application/json");},error:t=>{this.message.error(this.errorMessage(t,this.transloco.translate("workflow-editor.exportFailed")));}});}errorMessage(e,t){return e instanceof bi$1||e instanceof Error?e.message:t}static{this.\u0275fac=function(t){return new(t||i)};}static{this.\u0275cmp=ZE({type:i,selectors:[["app-workflow-editor"]],decls:17,vars:12,consts:[["data-testid","workflow-editor",1,"editor"],[1,"header"],["data-testid","page-title"],[1,"header-actions"],["routerLink","/workflows","data-testid","back-to-workflows"],["nz-button","","type","button","data-testid","export-workflow",3,"disabled"],["nz-button","","type","button","data-testid","start-workflow"],["nz-button","","nzType","primary","type","button","data-testid","save-button",3,"click","nzLoading","disabled"],["data-testid","loading"],["data-testid","load-error",1,"error"],["nz-button","","type","button","data-testid","export-workflow",3,"click","disabled"],["nz-button","","type","button","data-testid","start-workflow",3,"click"],["data-testid","validation-errors",1,"errors"],[3,"nzTitle"],[1,"grid"],[1,"field"],["nz-input","","data-testid","workflow-name",3,"ngModelChange","ngModel"],["data-testid","workflow-applies-to",3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel"],["data-testid","workflow-subject-handling",3,"ngModelChange","ngModel"],[3,"nzValue","nzLabel","nzDisabled"],["data-testid","workflow-subject-handling-help",1,"help"],["nz-input","","rows","2","data-testid","workflow-description",3,"ngModelChange","ngModel"],[1,"input-field-row"],["nz-button","","nzType","dashed","type","button",3,"click"],["data-testid","duplicate-step-ids",1,"error"],[3,"stepsChange","steps","rootSteps","availableWorkflows","appliesTo","inputSchema","settings"],["nz-input","",3,"ngModelChange","ngModel"],[3,"ngModelChange","ngModel"],["nz-checkbox","",3,"ngModelChange","ngModel"],["nz-button","","nzDanger","","type","button",3,"click"]],template:function(t,n){t&1&&(_i$1(0,"main",0)(1,"header",1)(2,"div")(3,"h1",2),Iw(4),Jc()(),_i$1(5,"div",3)(6,"a",4),Iw(7),Pw(8,"transloco"),Jc(),_D(9,tr,3,4,"button",5),_D(10,nr,3,3,"button",6),_i$1(11,"button",7),mh("click",function(){return n.save()}),Iw(12),Pw(13,"transloco"),Jc()()(),_D(14,ir,3,3,"p",8)(15,or,2,1,"p",9)(16,_r,42,39),Jc()),t&2&&(gI(4),Lh(n.pageTitle()),gI(3),Lh(Fw(8,8,"workflow-editor.backToWorkflows")),gI(2),MD(n.isNew()?-1:9),gI(),MD(n.canStart()?10:-1),gI(),lh("nzLoading",n.saving())("disabled",n.loading()||!!n.loadError()),gI(),rl$1(" ",Fw(13,10,"common.save")," "),gI(2),MD(n.loading()?14:n.loadError()?15:16));},dependencies:[$8,al,er$1,rl,$i$1,v3,pf,bd,sp,fp,Nt,Ke,Lt,ut,ai$1,z,ex,Fm,Am,Bn,Kt],styles:[".editor[_ngcontent-%COMP%]{padding:1.25rem 1.5rem 3rem;display:flex;flex-direction:column;gap:1rem}.header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start}.header-actions[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.75rem;align-items:center}.lede[_ngcontent-%COMP%]{margin:.25rem 0 0;color:#57534e}.grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fit,minmax(12rem,1fr));gap:.75rem 1rem}.field[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem;margin:.5rem 0}.field[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]{font-size:.85rem;color:#57534e}.help[_ngcontent-%COMP%]{margin:0;font-size:.8rem;color:#78716c}.checkbox-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.75rem;margin-bottom:.5rem}.input-field-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr 8rem auto auto;gap:.5rem;align-items:end;margin-bottom:.5rem}.input-field-row[_ngcontent-%COMP%] > .field[_ngcontent-%COMP%]{margin:0}.errors[_ngcontent-%COMP%]{border:1px solid #fecdd3;background:#fff1f2;padding:.75rem 1rem}.errors[_ngcontent-%COMP%] h2[_ngcontent-%COMP%]{margin:0 0 .35rem;font-size:1rem}.error[_ngcontent-%COMP%]{color:#9f1239}"]});}}return i})();export{ms as WorkflowEditorComponent};
@@ -1 +0,0 @@
1
- import {g as f_,w as w_,I as I_,Y as Y$,S as S_}from'./chunk-D3JZ8ur5.js';import {C,b4 as N2,aV as ix,b5 as cx,ba as Se,i as ie,s,r as r$1}from'./main-SI5AKDMC.js';var B=(()=>{class e{constructor(){this.http=C(N2),this.baseUrl=`${ix.apiBaseUrl}/providers`;}listQueryTemplates(t){return this.http.get(`${this.baseUrl}/${encodeURIComponent(t)}/query-templates`).pipe(cx())}listExtendedActions(t){return this.http.get(`${this.baseUrl}/${encodeURIComponent(t)}/actions`).pipe(cx())}resolveQueryTemplate(t,i,s){return this.http.post(`${this.baseUrl}/${encodeURIComponent(t)}/query-templates/${encodeURIComponent(i)}/resolve`,{params:s}).pipe(cx())}previewModels(t){return this.http.post(`${this.baseUrl}/preview-models`,t).pipe(cx())}testConnection(t){return this.http.post(`${this.baseUrl}/test-connection`,t).pipe(cx())}static{this.\u0275fac=function(i){return new(i||e)};}static{this.\u0275prov=ie({token:e,factory:e.\u0275fac,providedIn:"root"});}}return e})();var D=(()=>{class e{constructor(){this.http=C(N2),this.apiBase=ix.apiBaseUrl;}getSettings(){return this.http.get(`${this.apiBase}/settings`).pipe(cx())}updateSettings(t){return this.http.patch(`${this.apiBase}/settings`,t).pipe(cx())}listProviderInstances(){return this.http.get(`${this.apiBase}/provider-instances`).pipe(cx())}createProviderInstance(t){return this.http.post(`${this.apiBase}/provider-instances`,t).pipe(cx())}updateProviderInstance(t,i){return this.http.patch(`${this.apiBase}/provider-instances/${encodeURIComponent(t)}`,i).pipe(cx())}deleteProviderInstance(t){return this.http.delete(`${this.apiBase}/provider-instances/${encodeURIComponent(t)}`).pipe(cx())}testProviderConnection(t){return this.http.post(`${this.apiBase}/provider-instances/${encodeURIComponent(t)}/test-connection`,{}).pipe(cx())}getProviderStatus(){return this.http.get(`${this.apiBase}/providers/status`).pipe(cx())}setSecret(t,i){return this.http.post(`${this.apiBase}/secrets/${encodeURIComponent(t)}`,{value:i},{responseType:"text"}).pipe(Se(()=>{}),cx())}static{this.\u0275fac=function(i){return new(i||e)};}static{this.\u0275prov=ie({token:e,factory:e.\u0275fac,providedIn:"root"});}}return e})();var h=[{id:"jira",labelKey:"settings.typeOption.jira",kind:"subject",type:"jira",subjectType:"ticket"},{id:"bitbucket",labelKey:"settings.typeOption.bitbucket",kind:"subject",type:"bitbucket",subjectType:"pull_request"},{id:"github",labelKey:"settings.typeOption.github",kind:"subject",type:"github",subjectType:"ticket"},{id:"confluence",labelKey:"settings.typeOption.confluence",kind:"subject",type:"confluence",subjectType:"documentation"},{id:"manual-ticket",labelKey:"settings.typeOption.manualTicket",kind:"subject",type:"manual",subjectType:"ticket"},{id:"manual-documentation",labelKey:"settings.typeOption.manualDocumentation",kind:"subject",type:"manual",subjectType:"documentation"},{id:"claude",labelKey:"settings.typeOption.claude",kind:"agent",type:"claude"},{id:"cursor",labelKey:"settings.typeOption.cursor",kind:"agent",type:"cursor"}],V=["ticket","pull_request","documentation"];function k(e){return h.find(n=>n.id===e)??h[0]}function T(e){return h.find(t=>t.kind!==e.kind||t.type!==e.type?false:t.kind==="agent"?true:S_(e)&&t.subjectType===e.subjectType)?.id??e.type}function H(e){let n=T(e);return k(n).labelKey}function v(e){return e==="jira"?[{key:"baseUrl",labelKey:"settings.jira.baseUrl"},{key:"email",labelKey:"settings.jira.email"}]:e==="bitbucket"?[{key:"email",labelKey:"settings.bitbucket.email"},{key:"workspace",labelKey:"settings.bitbucket.workspace"}]:e==="github"?[{key:"username",labelKey:"settings.github.username"}]:e==="confluence"?[{key:"baseUrl",labelKey:"settings.confluence.baseUrl"},{key:"email",labelKey:"settings.confluence.email"}]:[]}function L(){let e=h[0];return {originalId:null,id:"",idAutoSync:true,optionId:e.id,kind:e.kind,type:e.type,subjectType:e.subjectType??null,displayName:"",config:{},secretKey:w_("instance",e.kind),secretValue:"",expiresOn:"",defaultAgent:false,maxConcurrent:f_}}function Q(e,n=false){let t={};for(let o of v(e.type)){let p=e.config[o.key];typeof p=="string"&&(t[o.key]=p);}if(I_(e)){let o=e.config.model;typeof o=="string"&&o.trim()&&(t.model=o.trim());}let i=T(e),s=k(i);return {originalId:e.id,id:e.id,idAutoSync:false,optionId:i,kind:s.kind,type:s.type,subjectType:s.subjectType??null,displayName:e.displayName,config:t,secretKey:e.secretKey,secretValue:"",expiresOn:e.expiresOn??"",defaultAgent:s.kind==="agent"?n:false,maxConcurrent:I_(e)?e.maxConcurrent??f_:f_}}function Y(e,n){let t=k(n);return s(r$1({},e),{optionId:t.id,kind:t.kind,type:t.type,subjectType:t.subjectType??null,config:{},secretKey:w_(e.id||"instance",t.kind),defaultAgent:t.kind==="agent"?e.defaultAgent:false,maxConcurrent:t.kind==="agent"?e.maxConcurrent||f_:e.maxConcurrent})}function G(e,n,t){if(!e.idAutoSync)return s(r$1({},e),{displayName:n});let i=n.trim().length>0?Y$(n,t):"";return s(r$1({},e),{displayName:n,id:i,secretKey:w_(i||"instance",e.kind)})}function J(e,n){return s(r$1({},e),{id:n,idAutoSync:false,secretKey:w_(n.trim()||"instance",e.kind)})}function X(e){let n={};for(let p of v(e.type)){let I=(e.config[p.key]??"").trim();I&&(n[p.key]=I);}let t=e.id.trim(),i=e.displayName.trim()||t,s=e.secretKey.trim()||w_(t,e.kind),o=e.expiresOn.trim()||void 0;if(e.kind==="agent"){let p=(e.config.model??"").trim();return p&&(n.model=p),r$1({id:t,kind:"agent",type:e.type,displayName:i,config:n,secretKey:s,maxConcurrent:Math.max(1,Math.floor(Number(e.maxConcurrent)||f_))},o?{expiresOn:o}:{})}return r$1({id:t,kind:"subject",type:e.type,subjectType:e.subjectType??"ticket",displayName:i,config:n,secretKey:s},o?{expiresOn:o}:{})}function Z(e){return e.issues.map(n=>`${n.path.length>0?n.path.map(String).join("."):"(root)"}: ${n.message}`)}function $(e){return (e?.providerInstances??[]).filter(S_)}function z(e,n){return $(e).filter(t=>S_(t)&&n.includes(t.subjectType))}export{B,D,G,H,J,L,Q,V,X,Y,Z,h,v,z};