import{C as h,b as f}from"./chunk-CEEPVB2R.js";import{a as p}from"./chunk-NSGLSIBS.js";import{Ab as l,rb as n,uc as m,vc as u,wc as d}from"./chunk-QMYHTLAJ.js";import{d as c,n as v}from"./chunk-HE7HQ6LI.js";v();var y=["autocomplete"],g=class s{constructor(e){this.nomenclatureService=e,this.enableAutocompleteEnterEvent=!0}ngOnInit(){this.dataSourceAutocomplete=this.nomenclatureService.initDataSourceAutocomplete()}customNameFormatter(e){return`${e.name}, \u0410\u0440\u0442: ${e.article??"-"}, \u0428\u041A: ${e.barcode}`}parseWeightBarcode(e){let t=e.target.value.startsWith("27")&&e.target.value.length===13;if(f(e.target.value,t)&&t){this.enableAutocompleteEnterEvent=!1;let o=e.target.value.slice(0,7),r=this.nomenclatureService.toWeightFormatFromBarcode(e.target.value.slice(7,12));this.dataSourceAutocomplete.load({filter:o}).then(a=>{a.data.length===1&&(this.addProduct(a.data[0],r),this.autocomplete.close(!1)),a.data.length>1&&a.data.forEach(i=>{(i.barcode===o||i.additionalBarcodes.includes(o))&&(this.addProduct(i,r),this.autocomplete.close(!1))}),this.enableAutocompleteEnterEvent=!0})}}static{this.\u0275fac=function(t){return new(t||s)(n(h))}}static{this.\u0275cmp=l({type:s,selectors:[["tis-base-parser"]],viewQuery:function(t,o){if(t&1&&m(y,5),t&2){let r;u(r=d())&&(o.autocomplete=r.first)}},decls:0,vars:0,template:function(t,o){},encapsulation:2})}};g=c([p()],g);export{g as a};
