import {J,c as tS,aV as ut,U as RN,i as S,aU as rs,cp as Mi,cz as zt,aZ as Dt,by as it,bJ as F,f as QT,be as q3,bf as ns,cA as Qi,bg as lt,b_ as iH,b$ as Yo,bh as at,c0 as XN,dN as ci,bi as et,c1 as Tc,X as _z,cw as Ac,cB as Kt,cC as ln,cD as on,u as R,a0 as ks,z as vM,bl as dv,bn as Z_,a3 as Py,cl as JC,a2 as Uu,cE as py,bs as k_,bt as cM,bq as uv,a4 as Sy,F as EM,A as Iw,cm as XC,cF as rD,gI as op,v as W_,bp as QC,c2 as iv,br as ZC,bk as i_,bz as f_,cg as J_,gJ as A,bB as oT,ch as My,bC as sT,bm as Bp,bo as $p,bK as G}from'./main-WUGO6e7n.js';function Ve(t){return t?t.scriptText?t.scriptText:t.isEmbeddedScript&&t.embeddedScript?t.embeddedScript:t.command??"":""}function D(t){let i=t?.parameters;return Array.isArray(i)?i.map((e,r)=>he(e,r+1)).filter(e=>!!e):[]}function Ee(t){let i=D(t);return i.length===0?false:t?.promptForParametersOnOpen!==false||i.some(e=>e.secured||e.mandatory&&!e.value)}function be(t,i){let e=new Map(i.map(r=>[r.index,r.value]));return (t??"").replace(/\{(\d+)\}/g,(r,n)=>{let a=Number(n);return e.has(a)?e.get(a)??"":r})}function Fe(t,i){let e=be(t,i);if(i.some(c=>(t??"").includes(`{${c.index}}`)))return e;let n=[],a=[];for(let c of i){let V=Se(String(c.value??""));xe(c.label)?a.push(`-${c.label} ${V}`):n.push(V);}let u=[...n,...a].join(" ");return u?`& {
${e}
} ${u}`:e}function Ce(t){return (t??[]).map(i=>{let e=i?.data?.connection;if(e?.isRoot||e?.isFolder){let r=Ce(i.children??[]);return r.length>0?G(F({},i),{children:r,leaf:false}):null}return e?.permissions?.canExecute&&e.data?.canRunInWebTerminal!==false?i:null}).filter(i=>!!i)}function he(t,i){let e=t?.dataType??A.Unused;if(e===A.Unused)return null;let r=Number(t?.index)||i,n=e===A.Secured;return {index:r,dataType:e,label:t?.label||`Parameter #${r}`,mandatory:!!t?.isMandatory,secured:n,value:n?"":t?.defaultValue??"",inputId:`run-script-parameter-${r}`}}function xe(t){return /^[A-Za-z_][A-Za-z0-9_]*$/.test(t??"")}function Se(t){return `'${t.replace(/'/g,"''")}'`}var ce=J(()=>{op();});function we(t,i){if(t&1){let e=i_();ks(0,"input",8),dv("ngModelChange",function(n){Bp(e);let a=f_().$implicit;return Z_(a.value,n)||(a.value=n),$p(n)}),Uu(),oT();}if(t&2){let e=f_().$implicit;Sy("id",e.inputId)("name","parameter"+e.index)("feedback",false)("required",e.mandatory),uv("ngModel",e.value),My("aria-label",e.label),sT();}}function Pe(t,i){if(t&1){let e=i_();ks(0,"input",9),dv("ngModelChange",function(n){Bp(e);let a=f_().$implicit;return Z_(a.value,n)||(a.value=n),$p(n)}),Uu(),oT();}if(t&2){let e=f_().$implicit;Sy("id",e.inputId)("name","parameter"+e.index)("required",e.mandatory),uv("ngModel",e.value),My("aria-label",e.label),sT();}}function Me(t,i){if(t&1&&(ks(0,"div",3)(1,"label",5),W_(2),Uu(),QC(3,we,1,6,"input",6)(4,Pe,1,5,"input",7),Uu()),t&2){let e=i.$implicit;Iw(),Sy("for",e.inputId),Iw(),iv(e.label),Iw(),ZC(e.secured?3:4);}}function Re(t,i){if(t&1){let e=i_();ks(0,"dvl-button",10),vM(1,"translate"),Py("onClick",function(){Bp(e);let n=f_();return $p(n.submit())}),Uu(),ks(2,"dvl-button",11),vM(3,"translate"),Py("onClick",function(){Bp(e);let n=f_();return $p(n.cancel())}),Uu();}if(t&2){let e=f_();Sy("label",J_(EM(1,5,"lblRun")))("disabled",e.hasMissingMandatory()),Iw(2),Sy("label",J_(EM(3,7,"lblCancel")));}}var ve,ye,Ye,Te=J(()=>{tS();ut();RN();S();rs();Mi();zt();ce();tS();rs();Dt();ut();Mi();zt();ve=()=>({width:"460px"}),ye=(t,i)=>i.index;Ye=(()=>{class t{constructor(){this.visible=!1,this.data=null,this.visibleChange=new it,this.onResult=new it,this.parameters=[];}ngOnChanges(e){(e.data||e.visible?.currentValue)&&(this.parameters=D(this.data));}hasMissingMandatory(){return this.parameters.some(e=>e.mandatory&&!e.value)}submit(){this.hasMissingMandatory()||(this.onResult.emit(this.parameters.map(e=>F({},e))),this.close());}cancel(){this.close();}onHideDialog(){this.visibleChange.emit(!1),this.parameters=[];}close(){this.visible=!1,this.visibleChange.emit(!1),this.parameters=[];}static{this.\u0275fac=function(r){return new(r||t)};}static{this.\u0275cmp=QT({type:t,selectors:[["dvl-run-script-parameters-dialog"]],inputs:{visible:"visible",data:"data"},outputs:{visibleChange:"visibleChange",onResult:"onResult"},features:[rD],decls:7,vars:10,consts:[["closeIcon","di dvl-icon-close",3,"visibleChange","onHide","visible","header","modal","draggable","resizable"],["novalidate","",3,"ngSubmit"],[1,"flex","flex-col","gap-3","px-10","pb-5"],[1,"flex","flex-col","gap-1.5"],["pTemplate","footer"],[1,"text-sm","text-300",3,"for"],["pPassword","","type","password",1,"w-full",3,"id","name","feedback","required","ngModel"],["pInputText","","type","text",1,"w-full",3,"id","name","required","ngModel"],["pPassword","","type","password",1,"w-full",3,"ngModelChange","id","name","feedback","required","ngModel"],["pInputText","","type","text",1,"w-full",3,"ngModelChange","id","name","required","ngModel"],["size","md","variant","primary","type","button",3,"onClick","label","disabled"],["size","md","variant","tertiary","type","button",3,"onClick","label"]],template:function(r,n){r&1&&(ks(0,"p-dialog",0),vM(1,"translate"),dv("visibleChange",function(u){return Z_(n.visible,u)||(n.visible=u),u}),Py("onHide",function(){return n.onHideDialog()}),ks(2,"form",1),Py("ngSubmit",function(){return n.submit()}),ks(3,"div",2),JC(4,Me,5,3,"div",3,ye),Uu()(),py(6,Re,4,9,"ng-template",4),Uu()),r&2&&(k_(cM(9,ve)),uv("visible",n.visible),Sy("header",EM(1,7,"lblExecuteScript"))("modal",!0)("draggable",!1)("resizable",!1),Iw(4),XC(n.parameters));},dependencies:[q3,ns,Qi,lt,iH,Yo,at,XN,ci,et,Tc,_z,Ac,Kt,ln,on,R],encapsulation:2,changeDetection:1});}}return t})();});export{Ce as C,D,Ee as E,Fe as F,Te as T,Ve as V,Ye as Y,be as b,ce as c};