PageSourceSearch

https://moj.gov.eg/chunk-IKIJHBEF.js

js moj.gov.eg collected 2026-09-24 10:14:59 UTC 3,967 bytes, 1 lines download raw bytes

1import{c as g,d as E}from"./chunk-UOK34CM3.js";import{a as b}from"./chunk-UPBHVH53.js";import{a as u}from"./chunk-Y4LDYV5N.js";import{B as s,F as S,S as f,Uc as F,V as h,d as m,m as a,w as v,wd as l}from"./chunk-6JVWBWXY.js";import{a as o,b as c}from"./chunk-QDSGMOWV.js";var B=(()=>{class d{localeService;formStateService;formFactoryService;formValidationService;stateSubject=new m({selectedSection:"",movingSection:null,clonedSection:null,removedSection:null,error:null});state$=this.stateSubject.asObservable();selectedSection$=this.state$.pipe(a(e=>e.selectedSection),S());movingSection$=this.state$.pipe(a(e=>e.movingSection),S());clonedSection$=this.state$.pipe(a(e=>e.clonedSection),S());sectionRemoved$=this.state$.pipe(a(e=>e.removedSection),v(e=>e!==null),S());error$=this.state$.pipe(a(e=>e.error),v(e=>e!==null),S());constructor(e,t,i,r){this.localeService=e,this.formStateService=t,this.formFactoryService=i,this.formValidationService=r}handleSectionAction(e,t,i){switch(i){case u.Move:this.updateState({movingSection:t});break;case u.Clone:this.cloneSection(e,t);break;case u.Remove:this.removeSection(e,t);break}}clearMovingSection(){this.updateState({movingSection:null})}getSections(e){return this.formStateService.getFormData(e).pipe(a(t=>t?.sections||[]))}setSections(e,t){this.formStateService.getFormData(e).pipe(s(1)).subscribe(i=>{i&&this.formStateService.setFormData(c(o({},i),{sections:t}))})}addSection(e,t){this.formStateService.getFormData(e).pipe(s(1)).subscribe(i=>{if(i){let n=[...i.sections||[],t];this.formStateService.setFormData(c(o({},i),{sections:n}))}})}updateSection(e,t,i){this.formStateService.getFormData(e).pipe(s(1)).subscribe(r=>{if(r&&r.sections){let n=r.sections.map(p=>p.id===t?o(o({},p),i):p);this.formStateService.setFormData(c(o({},r),{sections:n}))}})}setSelectedSection(e){this.updateState({selectedSection:e})}resetMovingSectionSubject(){this.stateSubject.next(c(o({},this.stateSubject.value),{movingSection:null}))}clearError(){this.updateState({error:null})}updateState(e){let t=this.stateSubject.value;this.stateSubject.next(o(o({},t),e))}cloneSection(e,t){this.formStateService.getFormData(e).pipe(s(1)).subscribe(i=>{if(!this.hasValidSections(i))return;let r=i.sections.find(n=>n.id===t);if(!r){this.handleError(this.localeService.translateByGroup(l.ValidationErrors,"SectionNotFound").replace("{0}",t));return}this.performSectionCloning(e,r,i.sections.length)})}hasValidSections(e){return e==null?(this.handleError(this.localeService.translateByGroup(l.ValidationErrors,"FormNotFound")),!1):!e.sections||e.sections.length===0?(this.handleError(this.localeService.translateByGroup(l.ValidationErrors,"NoSectionsFound")),!1):!0}performSectionCloning(e,t,i){let r=this.formFactoryService.cloneSection(t,i);this.addSection(e,r),this.updateState({selectedSection:r.id,clonedSection:r.id}),this.clearError()}removeSection(e,t){this.formStateService.getFormData(e).pipe(s(1)).subscribe(i=>{if(!this.canRemoveSection(i))return;let r=i.sections.findIndex(n=>n.id===t);if(r===-1){this.handleError(this.localeService.translateByGroup(l.ValidationErrors,"SectionNotFound").replace("{0}",t));return}this.clearSectionFieldErrors(i.sections[r]),this.performSectionRemoval(i,t,r)})}canRemoveSection(e){return this.hasValidSections(e)?e.sections.length===1?(this.handleError(this.localeService.translateByGroup(l.ValidationErrors,"CannotRemoveLastSection")),!1):!0:!1}clearSectionFieldErrors(e){let t=e.fields?.map(i=>i.id)||[];this.formValidationService.clearMultipleFieldErrors(t)}performSectionRemoval(e,t,i){let r=e.sections.filter(n=>n.id!==t);this.formStateService.setFormData(c(o({},e),{sections:r})),this.updateState({removedSection:{formId:e.formMetadata.id,sectionId:t,sectionIndex:i}}),this.clearError()}handleError(e){this.updateState({error:e})}static \u0275fac=function(t){return new(t||d)(h(F),h(b),h(g),h(E))};static \u0275prov=f({token:d,factory:d.\u0275fac,providedIn:"root"})}return d})();export{B as a};

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