import{a as u}from"./chunk-IVW2C32D.js";import{c as I}from"./chunk-OBT56KUD.js";import{pa as d,ua as A}from"./chunk-IYD54RT7.js";var T=(()=>{let e=class e{constructor(t){this.http=t}getTransaction(t){return this.http.get(u+"/orcs/txs/"+t)}getLatestBranchTransaction(t){return this.http.get(u+"/orcs/branches/"+t+"/txs/latest")}performMutation(t){return this.http.post(u+"/orcs/txs",t)}};e.\u0275fac=function(r){return new(r||e)(A(I))},e.\u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"});let m=e;return m})();var b={interfaceMinSimultaneity:"Interface Minimum Simultaneity",interfaceMaxSimultaneity:"Interface Maximum Simultaneity",transportType:"Interface Transport Type",interfacePlatformType2sComplement:"Interface Platform Type 2sComplement",interfacePlatformTypeValidRangeDescription:"Interface Platform Type Valid Range Desc"},h=class{transform(e){return this.contains(e)?b[e]:e}contains(e){return b[e]!==void 0&&b[e]!==null}};var j=(()=>{let e=class e{constructor(){this.translations=new h}createArtifact(t,r,s,i,n,o,l){let a=i||{branch:n||"",txComment:o||"",createArtifacts:[]};a.createArtifacts===void 0&&(a.createArtifacts=[]);let f=[];Object.entries(t).forEach(c=>{c[0]!=="name"&&c[0]!=="applicabilityId"&&c[0]!=="applicability"&&c[0]!=="id"&&!this.translations.contains(c[0])?f.push({typeName:this.attributeNameToHumanReadable(c[0]),value:c[1]}):this.translations.contains(c[0])&&this.translations.transform(c[0])!==c[0]&&f.push({typeName:this.translations.transform(c[0]),value:c[1]})});let p={typeId:r,name:t?.name||"",applicabilityId:t?.applicabilityId||t?.applicability?.id,attributes:f,relations:s,key:l};return a.createArtifacts.push(p),a}modifyArtifact(t,r,s,i){let n=r||{branch:s||"",txComment:i||"",modifyArtifacts:[]},o=[];Object.entries(t).forEach(a=>{a[0]!=="applicabilityId"&&a[0]!=="applicability"&&a[0]!=="id"&&!this.translations.contains(a[0])?o.push({typeName:this.attributeNameToHumanReadable(a[0]),value:a[1]}):this.translations.contains(a[0])&&this.translations.transform(a[0])!==a[0]&&o.push({typeName:this.translations.transform(a[0]),value:a[1]})});let l={id:t?.id||"",applicabilityId:t?.applicability?.id,setAttributes:o};return n.modifyArtifacts||(n.modifyArtifacts=[]),n.modifyArtifacts.push(l),n}deleteArtifact(t,r,s,i){let n=r||{branch:s||"",txComment:i||"",deleteArtifacts:[]};return n.deleteArtifacts.push(t),n}deleteArtifacts(t,r,s){let i={branch:r,txComment:s,deleteArtifacts:[]};return t.forEach(n=>{i=this.deleteArtifact(n,i)}),i}modifyArtifacts(t,r,s){let i={branch:r,txComment:s,modifyArtifacts:[]};return t.forEach(n=>{i=this.modifyArtifact(n,i)}),i}createArtifacts(t,r,s,i,n){let o={branch:s,txComment:i,createArtifacts:[]};return t.forEach((l,a)=>{o=this.createArtifact(l,n[a],r[a],o)}),o}addRelation(t,r,s,i,n,o,l,a,f){let p=l||{branch:a||"",txComment:f||"",addRelations:[]};return p?.addRelations||(p.addRelations=[]),p.addRelations.push({typeName:t,typeId:r,aArtId:s,bArtId:i,afterArtifact:n,rationale:o}),p}deleteRelation(t,r,s,i,n,o,l,a){let f=o||{branch:l||"",txComment:a||"",deleteRelations:[]};return f?.deleteRelations||(f.deleteRelations=[]),f.deleteRelations.push({typeName:t,typeId:r,aArtId:s,bArtId:i,rationale:n}),f}attributeNameToHumanReadable(t){return(t.match(/[A-Z]+[^A-Z]*|[^A-Z]+/g)?.map(s=>s.replace(/(^\w{1})|(\s+\w{1})/g,i=>i.toUpperCase()))).join(" ")}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=d({token:e,factory:e.\u0275fac,providedIn:"root"});let m=e;return m})();export{j as a,T as b};
