1import{a as Me}from"./chunk-BWC2KJGA.js";import{a as O}from"./chunk-SCGKWWCY.js";import{a as Pe}from"./chunk-Z2HMW2IQ.js";import"./chunk-4MPIUD7L.js";import"./chunk-OMAR6RBO.js";import{c as A}from"./chunk-HB4JGH6L.js";import{e as Oe}from"./chunk-E34OQ4RJ.js";import"./chunk-H4EPMV5Z.js";import{a as K}from"./chunk-ZSHO3KMD.js";import"./chunk-QVGEDMLN.js";import"./chunk-UZY2R5Q5.js";import"./chunk-5GAGQHFR.js";import"./chunk-RYT6C367.js";import"./chunk-SNZM6YGS.js";import"./chunk-3PGMBZAP.js";import"./chunk-FQFO62CD.js";import"./chunk-VT7CJSCD.js";import{a as Ee}from"./chunk-PNYSZFNB.js";import{A as ye,G as be,M as Se,N as we,O as q,P as D,R as xe,V as Te,i as L,k,la as Q,m as G,na as Le,oa as X,s as N,ua as ke,wa as Ie}from"./chunk-Y3MTRBLK.js";import"./chunk-XMBPLYUK.js";import"./chunk-QRMJLQVM.js";import"./chunk-24HYNKH3.js";import"./chunk-65I45D2I.js";import"./chunk-GZL4NBTB.js";import{a as T}from"./chunk-OMIAKVTT.js";import{r as E,t as J,u as Ce}from"./chunk-3XCK7DOC.js";import"./chunk-PJWNDC7A.js";import{M as W,c as fe,h as _e,o as ve}from"./chunk-QDFFLVTB.js";import"./chunk-S43ITSQ5.js";import{k as re}from"./chunk-5FWAKVG3.js";import{z as ge}from"./chunk-KAXBUATZ.js";import{$c as pe,Ac as P,Bc as M,Cc as p,Dc as r,Ec as o,Fa as B,Fc as _,Jb as s,Jc as ce,Kc as de,Oc as x,Sa as v,Ta as C,Vc as u,Wb as m,Xc as g,ad as ue,bc as w,bd as me,cc as H,gc as U,ib as le,jd as c,kd as y,ld as I,md as $,rd as F,sd as z,td as V,vc as h,ve as he,xc as f,zc as oe}from"./chunk-XW6AEKHB.js";import{l as S}from"./chunk-6G35VSEK.js";function Ve(i,d){if(i&1&&(r(0,"cnp-status-pill",4),c(1),o()),i&2){let e=g();s(),I("",e.successCount," valid")}}function Ne(i,d){if(i&1&&(r(0,"cnp-status-pill",5),c(1),o()),i&2){let e=g();s(),I("",e.unchangedCount," unchanged")}}function De(i,d){if(i&1&&(r(0,"cnp-status-pill",6),c(1),o()),i&2){let e=g();s(),$(" ",e.errorCount," ",e.errorCount===1?"error":"errors"," ")}}function Re(i,d){if(i&1&&c(0),i&2){let e=d.index;y(e+1)}}function je(i,d){if(i&1&&(r(0,"cnp-status-pill",4),c(1),o()),i&2){let e=g().$implicit;s(),y(e.exist?"To update":"To add")}}function Ue(i,d){i&1&&(r(0,"cnp-status-pill",5),c(1,"Unchanged"),o())}function Ae(i,d){if(i&1&&(r(0,"li"),c(1),o()),i&2){let e=d.$implicit;s(),I("",e,".")}}function Be(i,d){if(i&1&&(r(0,"div",18)(1,"cnp-status-pill",6),c(2,"Error"),o(),r(3,"ul",19),P(4,Ae,2,1,"li",null,oe),o()()),i&2){let e=g().$implicit;s(4),M(e.error)}}function He(i,d){if(i&1&&(h(0,je,2,1,"cnp-status-pill",4),h(1,Ue,2,0,"cnp-status-pill",5),h(2,Be,6,0,"div",18)),i&2){let e=d.$implicit;f(!e.error.length||e.exist?0:-1),s(),f(e.existNotUpdated?1:-1),s(),f(e.error.length&&!(e.exist||e.existNotUpdated)?2:-1)}}function $e(i,d){if(i&1&&(r(0,"span",20),c(1),o()),i&2){let e=d.$implicit,n=g().$implicit;s(),y(e.data[n])}}function We(i,d){if(i&1&&U(0,$e,2,1,"ng-template",14),i&2){let e=d.$implicit;p("cnpCell",e)}}var ee=(()=>{class i{constructor(e,n,t,a){this.activeModal=e,this.utilitiesService=n,this.http=t,this.translateService=a,this.errorCount=0,this.unchangedCount=0,this.successCount=0,this.totalCount=0,this.csvHeaders=[],this.isLoading=!1,this.updateExisting=!0,this.canUpdate=0,this.dataToDisplay=[],this.columns=[],this.byKey=l=>l.key}ngOnInit(){return S(this,null,function*(){this.canUpdate=0,typeof this.data=="string"?this.dataToDisplay=yield this.http.get(this.data).toPromise():this.dataToDisplay=this.data,this.dataToDisplay.forEach((e,n)=>{e.key=String(n),e.error.length&&!e.error.includes("exists_updated")?e.error.length===1&&e.error.includes("exists")?this.unchangedCount++:this.errorCount++:this.successCount++,e.error.length&&e.error.includes("exists_updated")?(this.canUpdate++,e.exist=!0):e.error.length&&e.error.includes("exists")&&(e.existNotUpdated=!0)}),this.csvHeaders=this.headers?this.headers:Object.keys(this.data[0].data),this.buildColumns()})}import(){return S(this,null,function*(){this.isLoading=!0;let e=yield this.translateService.import(this.result.PK,"import",void 0,this.updateExisting);if(!e.success){this.utilitiesService.alert({header:"Error",message:e.message});return}let n,t;if(e.data.status==="pending")for(;;){if(yield new Promise(a=>{setTimeout(()=>{a(null)},3e3)}),t=yield this.translateService.import(e.data.PK,"status"),t.data.status==="done"){n=t.data?.result?.success?t?.data:t?.data?.result?.data;break}t.data&&t.data.total&&(this.totalCount=t.data.total,this.successCount=t.data.current)}if(this.isLoading=!1,!n.result&&!n.success){this.utilitiesService.alert({header:"Error",message:n.message});return}this.utilitiesService.alert({header:"Success",message:`Imported ${n.imported} translation${n.imported===1?"":"s"}.`}),this.activeModal.close(!0)})}buildColumns(){let e=this.csvHeaders.length?70/this.csvHeaders.length:70;this.columns=[{key:"rowNumber",header:"#",width:"6%"},{key:"result",header:"Result",width:"24%"},...this.csvHeaders.map(n=>({key:n,header:n,width:`${e}%`}))]}static{this.\u0275fac=function(n){return new(n||i)(m(E),m(T),m(he),m(O))}}static{this.\u0275cmp=w({type:i,selectors:[["app-preview"]],decls:23,vars:11,consts:[[1,"modal-header"],["id","translationPreviewTitle",1,"modal-title"],[1,"preview-counts"],["tone","info"],["tone","success","icon","success"],["tone","neutral","icon","dash"],["tone","danger","icon","error"],["variant","ghost","size","sm","ariaLabel","Close",1,"dialog-close",3,"click","iconOnly"],["name","close","size","sm"],[1,"modal-body"],[1,"preview-table"],["ariaLabel","Import preview","density","compact",3,"columns","rows","rowKey"],["cnpCell","rowNumber"],["cnpCell","result"],[3,"cnpCell"],[1,"modal-footer"],["variant","secondary",3,"click"],["loadingLabel","Importing",3,"click","disabled","loading"],[1,"preview-error"],[1,"preview-error-list"],[1,"bidi-text"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"h4",1),c(2,"Preview import"),o(),r(3,"div",2)(4,"cnp-status-pill",3),c(5),o(),h(6,Ve,2,1,"cnp-status-pill",4),h(7,Ne,2,1,"cnp-status-pill",5),h(8,De,2,2,"cnp-status-pill",6),o(),r(9,"cnp-button",7),u("click",function(){return t.activeModal.dismiss(!0)}),_(10,"cnp-icon",8),o()(),r(11,"div",9)(12,"div",10)(13,"cnp-table",11),U(14,Re,1,1,"ng-template",12)(15,He,3,3,"ng-template",13),P(16,We,1,1,null,14,oe),o()()(),r(18,"div",15)(19,"cnp-button",16),u("click",function(){return t.activeModal.dismiss()}),c(20,"Close"),o(),r(21,"cnp-button",17),u("click",function(){return t.import()}),c(22),o()()),n&2&&(s(5),I("",t.successCount+t.errorCount+t.unchangedCount," total"),s(),f(t.successCount?6:-1),s(),f(t.unchangedCount?7:-1),s(),f(t.errorCount?8:-1),s(),p("iconOnly",!0),s(4),p("columns",t.columns)("rows",t.dataToDisplay)("rowKey",t.byKey),s(3),M(t.csvHeaders),s(5),p("disabled",!t.successCount)("loading",t.isLoading),s(),I(" Import ",t.successCount?"("+t.successCount+(t.totalCount?"/"+t.totalCount:"")+" rows)":""," "))},dependencies:[k,q,L,G,D],styles:[".preview-counts[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:var(--cnp-space-2)}.preview-table[_ngcontent-%COMP%]{max-height:500px;overflow-y:auto}.preview-error[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--cnp-space-1);align-items:flex-start}.preview-error-list[_ngcontent-%COMP%]{margin:0;padding-inline-start:var(--cnp-space-4);font-size:var(--cnp-font-size-label);color:var(--cnp-color-text-secondary)}
1.bidi-text[_ngcontent-%COMP%]{unicode-bidi:plaintext;text-align:start}"]})}}return i})();function Ke(i,d){if(i&1&&(r(0,"div",8),_(1,"cnp-table",14),r(2,"p",15),c(3," If you are importing an exported CSV, make sure not to modify the source field of the existing translations. "),o()()),i&2){let e=g();s(),p("columns",e.guideColumns)("rows",e.importHeaders)("rowKey",e.byHeaderName)}}function Ge(i,d){if(i&1&&(r(0,"cnp-callout",10),c(1),o()),i&2){let e=g();s(),y(e.error)}}var qe=i=>i.name.substring(i.name.lastIndexOf(".")).toLowerCase()===".csv",Qe=10*1024*1024,te=(()=>{class i{constructor(e,n,t,a,l){this.modal=e,this.utilitiesService=n,this.eventService=t,this.activeModal=a,this.translateService=l,this.importHeaders=[{name:"source",format:"String",required:"Required",description:"English source text"},{name:"translation",format:"String",required:"Required",description:"Translated text"}],this.guideColumns=[{key:"name",header:"Header name",width:"22%"},{key:"format",header:"Data format",width:"18%"},{key:"required",header:"Required field",width:"20%"},{key:"description",header:"Definition",width:"40%"}],this.dropzoneFiles=[],this.isLoading=!1,this.showGuide=!1,this.error="",this.isImporting=!1,this.selectedFile=null,this.byHeaderName=b=>b.name}get importTitle(){return this.language?`Import ${this.language} translation`:"Import translation"}ngOnInit(){this.eventUrl=this.removeLastSlash(this.eventService.data.appUrl)}onFilePicked(e){let n=e[0]??null;this.error="";let t=n?this.fileError(n):null;if(t){this.selectedFile=null,this.dropzoneFiles=[],this.error=t;return}this.selectedFile=n}onFileRemoved(){this.selectedFile=null}fileError(e){return qe(e)?e.size>Qe?"File is too large. Please upload a CSV under 10 MB.":null:"Please select a CSV file."}upload(){return S(this,null,function*(){if(this.error="",this.isLoading=!0,!this.selectedFile){this.isLoading=!1,this.error="Please select a CSV file.",this.utilitiesService.alert({header:"Error",message:this.error});return}let e=this.selectedFile,n=this.fileError(e);if(n){this.isLoading=!1,this.error=n,this.utilitiesService.alert({header:"Error",message:this.error});return}let t=yield this.translateService.uploadCsvForImport(e);if(!t.success){this.isLoading=!1,this.error=t.message,this.utilitiesService.alert({header:"Error",message:this.error});return}let a=yield this.translateService.import(t.data,"analyze",this.languageCode);if(!a.success){this.isLoading=!1,this.error=a.message,this.utilitiesService.alert({header:"Error",message:this.error});return}let l;if(a.data.status==="pending")for(;;){yield new Promise(ze=>{setTimeout(()=>{ze(null)},3e3)});let j=yield this.translateService.import(a.data.PK,"status");if(j.data.status==="done"){l=j.data.result;break}}if(!l.success){this.isLoading=!1,this.error=l.message,this.utilitiesService.alert({header:"Error",message:this.error});return}let b=this.modal.open(ee,{size:"lg",backdrop:!0,windowClass:"cnp-dialog",ariaLabelledBy:"translationPreviewTitle"});b.componentInstance.result=a.data,b.componentInstance.data=l.data,b.componentInstance.headers=l.headers,b.componentInstance.csv=t.data;try{yield b.result}catch{}finally{this.isLoading=!1,this.activeModal.close(!0)}})}removeLastSlash(e){return e.substring(e.length-1)==="/"&&(e=e.substring(0,e.length-1)),e}static{this.\u0275fac=function(n){return new(n||i)(m(J),m(T),m(K),m(E),m(O))}}static{this.\u0275cmp=w({type:i,selectors:[["app-import"]],inputs:{language:"language",languageCode:"languageCode"},decls:19,vars:11,consts:[[1,"modal-header"],["id","translationImportTitle",1,"modal-title"],["variant","ghost","size","sm","ariaLabel","Close",1,"dialog-close",3,"click","iconOnly"],["name","close","size","sm"],[1,"modal-body","import-body"],[1,"import-intro"],["size","sm",3,"click","variant","ariaExpanded","ariaControls"],[3,"name"],["id","translationImportGuide",1,"import-guide"],["controlId","csvFile","label","Drop your CSV file here, or choose one","hint","Accepted format: CSV. Maximum size 10 MB.","accept",".csv",3,"filesChange","picked","removed","disabled","files"],["tone","danger","live","status"],[1,"modal-footer"],["variant","secondary",3,"click"],["loadingLabel","Analysing",3,"click","loading"],["ariaLabel","Import guide","de
1nsity","compact",3,"columns","rows","rowKey"],[1,"import-guide-note"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"h4",1),c(2),o(),r(3,"cnp-button",2),u("click",function(){return t.activeModal.dismiss()}),_(4,"cnp-icon",3),o()(),r(5,"div",4)(6,"p",5),c(7," To import translation, please select CSV file. "),r(8,"cnp-button",6),u("click",function(){return t.showGuide=!t.showGuide}),c(9," Import guide "),_(10,"cnp-icon",7),o()(),h(11,Ke,4,3,"div",8),r(12,"cnp-dropzone",9),V("filesChange",function(l){return z(t.dropzoneFiles,l)||(t.dropzoneFiles=l),l}),u("picked",function(l){return t.onFilePicked(l)})("removed",function(){return t.onFileRemoved()}),o(),h(13,Ge,2,1,"cnp-callout",10),o(),r(14,"div",11)(15,"cnp-button",12),u("click",function(){return t.activeModal.dismiss()}),c(16,"Close"),o(),r(17,"cnp-button",13),u("click",function(){return t.upload()}),c(18,"Preview"),o()()),n&2&&(s(2),y(t.importTitle),s(),p("iconOnly",!0),s(5),p("variant",t.showGuide?"primary":"secondary")("ariaExpanded",t.showGuide)("ariaControls",t.showGuide?"translationImportGuide":""),s(2),p("name",t.showGuide?"chevron-up":"chevron-down"),s(),f(t.showGuide?11:-1),s(),p("disabled",t.isLoading),F("files",t.dropzoneFiles),s(),f(t.error?13:-1),s(4),p("loading",t.isLoading))},dependencies:[k,Ie,ke,L,D],styles:[".import-body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--cnp-space-4)}.import-intro[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cnp-space-2);margin:0}.import-guide[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--cnp-space-2)}.import-guide-note[_ngcontent-%COMP%]{margin:0;font-size:var(--cnp-font-size-label);color:var(--cnp-color-text-muted)}"]})}}return i})();var Xe=(i,d)=>d.value;function Ye(i,d){if(i&1){let e=x();r(0,"section",7)(1,"h5",9),c(2,"Exclude from translation"),o(),r(3,"p",10),c(4,"These fields stay in their original language for all viewers."),o(),r(5,"cnp-settings-row",17)(6,"cnp-toggle",18),V("checkedChange",function(t){v(e);let a=g();return z(a.excludeJobTitlesFromTranslation,t)||(a.excludeJobTitlesFromTranslation=t),C(t)}),o()(),r(7,"cnp-settings-row",19)(8,"cnp-toggle",20),V("checkedChange",function(t){v(e);let a=g();return z(a.excludeCompanyNamesFromTranslation,t)||(a.excludeCompanyNamesFromTranslation=t),C(t)}),o()()()}if(i&2){let e=g();s(6),F("checked",e.excludeJobTitlesFromTranslation),s(2),F("checked",e.excludeCompanyNamesFromTranslation)}}function Ze(i,d){if(i&1){let e=x();r(0,"cnp-checkbox",24),u("changed",function(t){let a=v(e).$implicit,l=g(2);return C(t?l.addLanguage(a):l.removeLanguage(a))}),o()}if(i&2){let e=d.$implicit,n=g(2);p("label",e.label)("description",e.value==="en"?"English will be enabled at all times":"")("disabled",e.value==="en")("checked",n.isExist(e))}}function et(i,d){if(i&1){let e=x();r(0,"cnp-checkbox",21),u("changed",function(t){v(e);let a=g();return C(t?a.selectAllLanguages():a.clearLanguages())}),o(),r(1,"div",22),P(2,Ze,1,4,"cnp-checkbox",23,Xe),o()}if(i&2){let e=g();p("checked",e.isSelectAll())("indeterminate",e.isPartiallySelected),s(2),M(e.languageOptions)}}function tt(i,d){i&1&&(r(0,"p",13),c(1,"No languages match your search."),o())}var ne=(()=>{class i{constructor(e,n,t,a){this.settingService=e,this.utilities=n,this.modal=t,this.toastService=a,this.selectedLanguage=[],this.translation=!0,this.excludeJobTitlesFromTranslation=!1,this.excludeCompanyNamesFromTranslation=!1,this.readOnly=!0,this.isSaving=!1,this.primaryLanguageOptions=[],this.languageOptions=[],this.supportedLanguages={en:"English",af:"Afrikaans",sq:"Albanian",am:"Amharic",ar:"Arabic",az:"Azerbaijani",bn:"Bengali",bs:"Bosnian",bg:"Bulgarian",zh:"Chinese (Simplified)","zh-TW":"Chinese (Traditional)",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",et:"Estonian",fi:"Finnish",fr:"French","fr-CA":"French (Canada)",ka:"Georgian",de:"German",el:"Greek",ha:"Hausa",hi:"Hindi",hu:"Hungarian",id:"Indonesian",it:"Italian",ja:"Japanese",ko:"Korean",lv:"Latvian",ms:"Malay",no:"Norwegian",ps:"Pashto",pl:"Polish",pt:"Portuguese",ro:"Romanian",ru:"Russian",sr:"Serbian",sk:"Slovak",sl:"Slovenian",so:"Somali",es:"Spanish","es-MX":"Spanish (Mexico)",sw:"Swahili",sv:"Swedish",tl:"Tagalog",ta:"Tamil",th:"Thai",tr:"Turkish",uk:"Ukrainian",vi:"Vietnamese"}}get totalLanguageCount(){return Object.keys(this.supportedLanguages).length}get isPartiallySelected(){let e=this.languageOptions.filter(t=>t.value!=="en"),n=e.filter(t=>this.isExist(t)).length;return n>0&&n<e.length}ngOnInit(){this.loadOthers(),this.populateOptions()}loadOthers(){this.settingService.getSetting("other-features").then(e=>{e&&(e.data?.translation!==void 0&&(this.translation=e.data?.translation),e.data?.availableLanguage?(this.selectedLanguage=JSON.parse(e.data?.availableLanguage),this.selectedLanguage.findIndex(n=>n.value==="en")<0&&this.selectedLanguage.push({value:"en",label:"English"})):this.selectedLanguage=this.includeAll(),e.data?.excludeJobTitlesFromTranslation!==void 0&&(this.excludeJobTitlesFromTranslation=e.data?.excludeJobTitlesFromTranslation),e.data?.excludeCompanyNamesFromTranslation!==void 0&&(this.excludeCompanyNamesFromTranslation=e.data?.excludeCompanyNamesFromTranslation))})}isSelectAll(){return this.selectedLanguage.length===this.languageOptions.length}selectAllLanguages(){this.selectedLanguage=this.includeAll()}clearLanguages(){this.selectedLanguage=[],this.selectedLanguage.push({value:"en",label:"English"})}includeAll(){let e=Object.keys(this.supportedLanguages),n=[],t=[];return e.forEach(a=>{this.searchText&&this.supportedLanguages[a].toLowerCase().indexOf(this.searchText.toLowerCase())===-1&&a.indexOf(this.searchText.toLowerCase())===-1||n.find(l=>
1l.value===a)||t.push({value:a,label:this.supportedLanguages[a]})}),t}populateOptions(){let e=Object.keys(this.supportedLanguages),n=[],t=[];e.forEach(a=>{this.searchText&&this.supportedLanguages[a].toLowerCase().indexOf(this.searchText.toLowerCase())===-1&&a.indexOf(this.searchText.toLowerCase())===-1||n.find(l=>l.value===a)||t.push({value:a,label:this.supportedLanguages[a]})}),this.languageOptions=t}search(e){this.populateOptions()}addLanguage(e){this.selectedLanguage.push(e)}removeLanguage(e){let n=this.selectedLanguage.findIndex(t=>t.value===e.value);n>=0&&this.selectedLanguage.splice(n,1)}isExist(e){return this.selectedLanguage.findIndex(t=>t.value===e.value)>=0}update(){return S(this,null,function*(){this.isSaving=!0;try{let e=yield this.settingService.set("other-features",{availableLanguage:JSON.stringify(this.selectedLanguage),translation:this.translation,excludeJobTitlesFromTranslation:this.excludeJobTitlesFromTranslation,excludeCompanyNamesFromTranslation:this.excludeCompanyNamesFromTranslation});e&&e.success?this.toastService.showSuccess("Success","Settings updated successfully"):this.utilities.alert({header:"Error",message:e.message?e.message:"Unknown error: "+e}),this.modal.close()}finally{this.isSaving=!1}})}cancel(){this.modal.close()}static{this.\u0275fac=function(n){return new(n||i)(m(Oe),m(T),m(E),m(Ee))}}static{this.\u0275cmp=w({type:i,selectors:[["app-settings"]],decls:23,vars:8,consts:[[1,"modal-header"],["id","translationSettingsTitle",1,"modal-title"],["variant","ghost","size","sm","ariaLabel","Close",1,"dialog-close",3,"click","iconOnly"],["name","close","size","sm"],[1,"modal-body","settings-body"],["label","Translation","description","Translate the app and registration pages for attendees."],["ariaLabel","Translation",3,"checkedChange","checked"],[1,"settings-section"],[1,"language-picker"],[1,"section-heading"],[1,"section-note"],["label","Search languages","controlId","translationSettingsSearch"],["cnpInput","","id","translationSettingsSearch","type","text","autocomplete","off","placeholder","Search...",1,"search-input",3,"ngModelChange","keyup","ngModel"],[1,"language-empty"],[1,"modal-footer"],["variant","secondary",3,"click"],["loadingLabel","Saving",3,"click","loading"],["label","Job titles","de
1scription","Applies to attendee and speaker job titles."],["ariaLabel","Job titles",3,"checkedChange","checked"],["label","Company names"],["ariaLabel","Company names",3,"checkedChange","checked"],["label","All",3,"changed","checked","indeterminate"],[1,"language-list"],[3,"label","description","disabled","checked"],[3,"changed","label","description","disabled","checked"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"h4",1),c(2,"Translation settings"),o(),r(3,"cnp-button",2),u("click",function(){return t.modal.dismiss()}),_(4,"cnp-icon",3),o()(),r(5,"div",4)(6,"cnp-settings-row",5)(7,"cnp-toggle",6),V("checkedChange",function(l){return z(t.translation,l)||(t.translation=l),l}),o()(),h(8,Ye,9,2,"section",7),r(9,"fieldset",8)(10,"legend",9),c(11,"Available languages"),o(),r(12,"p",10),c(13),o(),r(14,"cnp-field",11)(15,"input",12),V("ngModelChange",function(l){return z(t.searchText,l)||(t.searchText=l),l}),u("keyup",function(l){return t.search(l)}),o()(),h(16,et,4,2)(17,tt,2,0,"p",13),o()(),r(18,"div",14)(19,"cnp-button",15),u("click",function(){return t.cancel()}),c(20,"Close"),o(),r(21,"cnp-button",16),u("click",function(){return t.update()}),c(22,"Save"),o()()),n&2&&(s(3),p("iconOnly",!0),s(4),F("checked",t.translation),s(),f(t.translation?8:-1),s(5),$("",t.selectedLanguage.length," of ",t.totalLanguageCount," selected."),s(2),F("ngModel",t.searchText),s(),f(t.languageOptions.length?16:17),s(5),p("loading",t.isSaving))},dependencies:[k,Se,Q,L,N,Le,X,W,fe,_e,ve],styles:[".settings-body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--cnp-space-4)}.settings-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--cnp-space-2)}.section-heading[_ngcontent-%COMP%]{width:100%;margin:0;padding-block-end:var(--cnp-space-2);border-block-end:2px solid var(--cnp-color-rule);font-size:var(--cnp-font-size-section);font-weight:var(--cnp-font-weight-bold);color:var(--cnp-color-text-heading)}.section-note[_ngcontent-%COMP%]{margin:0;font-size:var(--cnp-font-size-label);color:var(--cnp-color-text-muted)}.language-picker[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--cnp-space-2);min-width:0;margin:0;padding:0;border:0}.language-empty[_ngcontent-%COMP%]{margin:0;padding:var(--cnp-space-4) 0;font-size:var(--cnp-font-size-label);color:var(--cnp-color-text-muted);text-align:center}.language-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--cnp-space-3)}input.search-input[_ngcontent-%COMP%]{unicode-bidi:plaintext;text-align:start}"]})}}return i})();var nt=["translationInput"],ie=(()=>{class i{constructor(e,n,t){this.activeModal=e,this.utilities=n,this.translateService=t,this.isLoading=!1}ngOnInit(){this.translationLanguageLabel=A.find(e=>e.key===this.translationLanguage).value}submit(){let e=this.translationInput.nativeElement.value;if(!e.trim()){this.utilities.alert({header:"Error",message:"Translation is required."});return}this.isLoading=!0,this.translateService.aiUpdate(this.translationLanguage,this.source,e).then(n=>{n.success?this.activeModal.close():this.utilities.alert({header:"Error",message:n.message})}).catch(n=>{this.utilities.alert({header:"Error",message:n.message})}).finally(()=>{this.isLoading=!1})}static{this.\u0275fac=function(n){return new(n||i)(m(E),m(T),m(O))}}static{this.\u0275cmp=w({type:i,selectors:[["ng-component"]],viewQuery:function(n,t){if(n&1&&pe(nt,5,le),n&2){let a;
1ue(a=me())&&(t.translationInput=a.first)}},decls:19,vars:5,consts:[["translationInput",""],[1,"modal-header"],["id","translationUpdateTitle",1,"modal-title"],["variant","ghost","size","sm","ariaLabel","Close",1,"dialog-close",3,"click","iconOnly"],["name","close","size","sm"],[1,"modal-body"],[1,"source-block"],[1,"source-label"],[1,"source-text"],["controlId","translationValue",3,"label"],["cnpInput","","id","translationValue","rows","10",3,"value"],[1,"modal-footer"],["variant","secondary",3,"click"],["loadingLabel","Saving",3,"click","loading"]],template:function(n,t){if(n&1){let a=x();r(0,"div",1)(1,"h4",2),c(2,"Update"),o(),r(3,"cnp-button",3),u("click",function(){return v(a),C(t.activeModal.dismiss())}),_(4,"cnp-icon",4),o()(),r(5,"div",5)(6,"div",6)(7,"p",7),c(8,"English source"),o(),r(9,"p",8),c(10),o()(),r(11,"cnp-field",9),_(12,"textarea",10,0),o()(),r(14,"div",11)(15,"cnp-button",12),u("click",function(){return v(a),C(t.activeModal.dismiss())}),c(16,"Close"),o(),r(17,"cnp-button",13),u("click",function(){return v(a),C(t.submit())}),c(18,"Save"),o()()}n&2&&(s(3),p("iconOnly",!0),s(7),y(t.source),s(),p("label",t.translationLanguageLabel+" translation"),s(),p("value",t.translation),s(5),p("loading",t.isLoading))},dependencies:[k,Q,L,N],styles:[".source-block[_ngcontent-%COMP%]{margin-block-end:var(--cnp-space-4)}.source-label[_ngcontent-%COMP%]{margin:0 0 var(--cnp-space-1);font-size:var(--cnp-font-size-label);font-weight:var(--cnp-font-weight-medium);color:var(--cnp-color-text-secondary)}.source-text[_ngcontent-%COMP%]{margin:0;font-size:var(--cnp-font-size-body);color:var(--cnp-color-text-body)}textarea[cnpInput][_ngcontent-%COMP%]{unicode-bidi:plaintext;text-align:start}"]})}}return i})();var it=(i,d)=>d.key;function at(i,d){if(i&1){let e=x();r(0,"cnp-button",3),u("click",function(){v(e);let t=g();return C(t.import())}),_(1,"cnp-icon",24),c(2," Import "),o(),r(3,"cnp-button",3),u("click",function(){v(e);let t=g();return C(t.export())}),_(4,"cnp-icon",25),c(5," Export "),o()}}function ot(i,d){if(i&1&&(r(0,"option",9),c(1),o()),i&2){let e=d.$implicit;p("value",e.key),s(),y(e.value)}}function rt(i,d){if(i&1){let e=x();r(0,"cnp-empty-state",17)(1,"cnp-button",26),u("click",function(){v(e);let t=g();return C(t.clearFilters())}),c(2),o()()}if(i&2){let e=g();p("heading",e.emptyHeading)("description",e.emptyDescription)("headingLevel",2),s(2),I(" ",e.emptyActionLabel," ")}}function st(i,d){if(i&1&&_(0,"cnp-empty-state",18),i&2){let e=g();p("heading",e.emptyHeading)("description",e.emptyDescription)("headingLevel",2)}}function lt(i,d){if(i&1&&(r(0,"span",27),c(1),o()),i&2){let e=d.value;s(),y(e)}}function ct(i,d){if(i&1&&(r(0,"span",27),c(1),o()),i&2){let e=d.value;s(),y(e)}}function dt(i,d){if(i&1&&(r(0,"cnp-status-pill",28),c(1),o()),i&2){let e=d.$implicit;p("tone",e.outdated?"info":"neutral")("dot",!0),s(),I(" ",e.outdated?"Needs update":"Up to date"," ")}}function pt(i,d){if(i&1){let e=x();r(0,"cnp-button",29),u("click",function(){let t=v(e).$implicit,a=g();return C(a.update(t))}),c(1," Update "),o()}if(i&2){let e=d.$implicit;p("ariaLabel","Update "+e.source)}}var ae=(()=>{class i{constructor(e,n,t,a,l){this.translateService=e,this.utilities=n,this.modal=t,this.csvDownloadService=a,this.eventService=l,this.columns=[],this.visibleRows=[],this.filteredCount=0,this.sort={key:"source",direction:"asc"},this.currentPage=1,this.pageSize=50,this.pageSizeOptions=[25,50,100],this.languages=[],this.activeLanguageLabel="",this.isLoadingLanguages=!1,this.isLoadingLanguageData=!1,this.searchText="",this.showOnlyOutdated=!1,this.allRows=[],this.bySource=b=>b.source}get hasActiveFilter(){return!!this.searchText.trim()||this.showOnlyOutdated}get countLabel(){return`${this.filteredCount} ${this.filteredCount===1?"translation":"translations"}`}get emptyHeading(){return this.showOnlyOutdated?"No translations match your filters":this.hasActiveFilter?"No translations match your search":"No translations yet"}get emptyDescription(){return this.showOnlyOutdated?"Clear the filters to see every translation.":this.hasActiveFilter?"Try a different term, or clear the search to see every translation.":this.languages.length?`Translations will appear here once the app or a registration page has been visited in ${this.activeLanguageLabel}.`:"Enable a language in Settings to see its translations here."}get emptyActionLabel(){return this.showOnlyOutdated?"Clear filters":"Clear search"}get announcement(){if(!this.sort)return this.countLabel;let e=this.sort.direction==="asc"?"ascending":"descending";return`${this.countLabel}, sorted by ${this.headerFor(this.sort.key)}, ${e}`}ngOnInit(){this.buildColumns(),this.isLoadingLanguages=!0,this.translateService.aiLoadLanguages().then(e=>{e.success?e.data&&e.data.length&&(this.languages=A.filter(n=>e.data.includes(n.key)),this.activeLanguage=this.languages.length?this.languages[0].key:"",this.loadLanguage(this.activeLanguage)):this.utilities.alert(e.message)}
1).catch(e=>{console.log("[aiLoadLanguages] Error",e)}).finally(()=>this.isLoadingLanguages=!1)}openSettings(){return S(this,null,function*(){let e=this.modal.open(ne,{windowClass:"cnp-dialog",ariaLabelledBy:"translationSettingsTitle"});try{yield e.result}catch{}})}loadLanguage(e){this.isLoadingLanguageData=!0,this.allRows=[],this.refreshRows(),this.activeLanguage=e,this.activeLanguageLabel=A.find(n=>n.key===e).value,this.buildColumns(),this.translateService.aiLoadLanguage(e).then(n=>{if(n.success){let t=new Set(n.outdatedKeys??[]);this.allRows=Object.keys(n.data).filter(a=>{let l=n.data[a];return l!==""&&l!==" "&&l!==` 2`&&l!=="\u21B5"}).map(a=>({source:a,translation:n.data[a],outdated:t.has(a)})),this.refreshRows()}else this.utilities.alert(n.message)}).catch(n=>{console.log("[aiLoadLanguage] Error",n)}).finally(()=>{this.isLoadingLanguageData=!1})}onLanguageChange(e){this.loadLanguage(e.target.value)}filter(e){this.searchText=e.target.value,this.applyFilter()}onOutdatedFilterChange(e){this.showOnlyOutdated=e,this.applyFilter()}applyFilter(){this.currentPage=1,this.refreshRows()}clearFilters(){this.searchText="",this.showOnlyOutdated=!1,this.applyFilter()}onSortChange(e){this.sort=e,this.refreshRows()}onPageChange(e){this.currentPage=e,this.refreshRows()}onPageSizeChange(e){this.pageSize=e,this.currentPage=1,this.refreshRows()}update(e){let n=this.modal.open(ie,{windowClass:"cnp-dialog",ariaLabelledBy:"translationUpdateTitle"});n.componentInstance.source=e.source,n.componentInstance.translation=e.translation,n.componentInstance.translationLanguage=this.activeLanguage,n.result.then(()=>{this.loadLanguage(this.activeLanguage)}).catch(t=>{})}export(){let e=new Date().toISOString(),n=this.eventService.data.url;this.csvDownloadService.commentsCsv(`canapii-translations_${this.activeLanguageLabel.toLowerCase()}_${n}_${e}.csv`,JSON.parse(JSON.stringify(this.allRows)),["source","translation"])}import(){return S(this,null,function*(){let e=this.modal.open(te,{size:"lg",backdrop:"static",windowClass:"cnp-dialog",ariaLabelledBy:"translationImportTitle"});e.componentInstance.language=this.languages.find(n=>n.key===this.activeLanguage).value,e.componentInstance.languageCode=this.activeLanguage;try{yield e.result}catch{}finally{this.loadLanguage(this.activeLanguage)}})}buildColumns(){this.columns=[{key:"source",header:"English source",sortable:!0,width:"38%"},{key:"translation",header:this.activeLanguageLabel?`${this.activeLanguageLabel} translation`:"Translation",sortable:!0,width:"38%"},{key:"status",header:"Status",width:"13%"},{key:"actions",header:"",ariaLabel:"Row actions",width:"11%"}]}
2refreshRows(){let e=this.searchText.trim().toLowerCase(),n=this.showOnlyOutdated,t=!e&&!n?[...this.allRows]:this.allRows.filter(l=>{let b=!e||`${l.source} ${l.translation}`.toLowerCase().includes(e),j=!n||l.outdated;return b&&j});this.filteredCount=t.length,this.clampPage();let a=(this.currentPage-1)*this.pageSize;this.visibleRows=Me(t,this.sort).slice(a,a+this.pageSize)}clampPage(){let e=Math.max(1,Math.ceil(this.filteredCount/this.pageSize));this.currentPage>e&&(this.currentPage=e)}headerFor(e){return this.columns.find(n=>n.key===e)?.header??e}static{this.\u0275fac=function(n){return new(n||i)(m(O),m(T),m(J),m(Pe),m(K))}}static{this.\u0275cmp=w({type:i,selectors:[["ng-component"]],decls:31,vars:16,consts:[[1,"container-fluid","py-3","translations-page"],["heading","Update translations"],["cnpPageHeaderDescription",""],["variant","secondary",3,"click"],["name","settings"],[1,"list-card"],["ariaLabel","Translations list controls",3,"count"],["cnpToolbarStart","","for","translationLanguage",1,"toolbar-label"],["cnpInput","","cnpToolbarStart","","id","translationLanguage",1,"language-select",3,"change","disabled"],[3,"value"],["cnpInput","","id","translationSearch","type","text","autocomplete","off","aria-label","Search translations","placeholder","Search...",1,"search-input",3,"keyup","value"],[1,"outdated-filter"],["ariaLabel","Show only needs update",3,"toggled","checked"],["aria-hidden","true",1,"toggle-label",3,"click"],["role","status","cnpVisuallyHidden",""],["ariaLabel","Translations","density","compact","loadingLabel","Loading translations",3,"sortChange","columns","rows","rowKey","sort","loading"],["cnpTableEmpty",""],["icon","no-results",3,"heading","description","headingLevel"],["icon","inbox",3,"heading","description","headingLevel"],["cnpCell","source"],["cnpCell","translation"],["cnpCell","status"],["cnpCell","actions"],["noun","translations",3,"pageChange","pageSizeChange","total","page","pageSize","pageSizeOptions"],["name","import"],["name","export"],["cnpEmptyStatePrimary","","variant","secondary","size","sm",3,"click"],[1,"bidi-text"],[3,"tone","dot"],["variant","secondary","size","sm",3,"click","ariaLabel"]],template:function(n,t){n&1&&(r(0,"div",0)(1,"cnp-page-header",1)(2,"p",2),c(3," Override the AI translations on the app or on registration pages. If the language or text is not here, please visit the page at least once with the selected language. "),o(),h(4,at,6,0),r(5,"cnp-button",3),u("click",function(){return t.openSettings()}),_(6,"cnp-icon",4),c(7," Settings "),o()(),r(8,"div",5)(9,"cnp-toolbar",6)(10,"label",7),c(11,"Select language"),o(),r(12,"select",8),u("change",function(l){return t.onLanguageChange(l)}),P(13,ot,2,2,"option",9,it),o(),r(15,"input",10),u("keyup",function(l){return t.filter(l)}),o(),r(16,"span",11)(17,"cnp-toggle",12),u("toggled",function(l){return t.onOutdatedFilterChange(l)}),o(),r(18,"span",13),u("click",function(){return t.onOutdatedFilterChange(!t.showOnlyOutdated)}),c(19," Show only needs update "),o()()(),r(20,"span",14),c(21),o(),r(22,"cnp-table",15),u("sortChange",function(l){return t.onSortChange(l)}),ce(23,16),h(24,rt,3,4,"cnp-empty-state",17)(25,st,1,3,"cnp-empty-state",18),de(),U(26,lt,2,1,"ng-template",19)(27,ct,2,1,"ng-template",20)(28,dt,2,3,"ng-template",21)(29,pt,2,1,"ng-template",22),o(),r(30,"cnp-paginator",23),u("pageChange",function(l){return t.onPageChange(l)})("pageSizeChange",function(l){return t.onPageSizeChange(l)}),o()()()),n&2&&(s(4),f(t.activeLanguage?4:-1),s(5),p("count",t.countLabel),s(3),p("disabled",t.isLoadingLanguages),s(),M(t.languages),s(2),p("value",t.searchText),s(2),p("checked",t.showOnlyOutdated),s(4),y(t.announcement),s(),p("columns",t.columns)("rows",t.visibleRows)("rowKey",t.bySource)("sort",t.sort)("loading",t.isLoadingLanguages||t.isLoadingLanguageData),s(2),f(t.hasActiveFilter?24:25),s(6),p("total",t.filteredCount)("page",t.currentPage)("pageSize",t.pageSize)("pageSizeOptions",t.pageSizeOptions))},dependencies:[k,q,Te,L,N,ye,xe,G,D,X,be,we],styles:[".translations-page[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--cnp-space-card-gap)}.list-card[_ngcontent-%COMP%]{background:var(--cnp-color-bg-card);border-radius:var(--cnp-radius-container);box-shadow:var(--cnp-shadow-low);overflow:hidden}.toolbar-label[_ngcontent-%COMP%]{margin:0;font-size:var(--cnp-font-size-label);color:var(--cnp-color-text-secondary)}
2.language-select[_ngcontent-%COMP%]{width:200px}.search-input[_ngcontent-%COMP%]{width:260px}.outdated-filter[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:var(--cnp-space-2)}.toggle-label[_ngcontent-%COMP%]{font-size:var(--cnp-font-size-label);color:var(--cnp-color-text-body);cursor:pointer}.bidi-text[_ngcontent-%COMP%], input.search-input[_ngcontent-%COMP%]{unicode-bidi:plaintext;text-align:start}"]})}}return i})();var ut=[{path:"",component:ae}],Fe=(()=>{class i{static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275mod=H({type:i})}static{this.\u0275inj=B({imports:[re.forChild(ut),re]})}}return i})();var tn=(()=>{class i{static{this.\u0275fac=function(n){return new(n||i)}}static{this.\u0275mod=H({type:i})}static{this.\u0275inj=B({imports:[ge,Fe,Ce,W,ae,ie,ne,te,ee]})}}return i})();export{tn as TranslationModule};
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.