import{D as h,b as f}from"./chunk-S7JCP2HI.js";import{a as p}from"./chunk-EK6YV2TW.js";import{Bb as l,ub as n,xc as m,yc as u,zc as d}from"./chunk-DYUFV4HF.js";import{d as s,n as v}from"./chunk-INB5GR2I.js";v();var A=["autocomplete"],t,g=(t=class{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 o=e.target.value.startsWith("27")&&e.target.value.length===13;if(f(e.target.value,o)&&o){this.enableAutocompleteEnterEvent=!1;let r=e.target.value.slice(0,7),a=this.nomenclatureService.toWeightFormatFromBarcode(e.target.value.slice(7,12));this.dataSourceAutocomplete.load({filter:r}).then(i=>{i.data.length===1&&(this.addProduct(i.data[0],a),this.autocomplete.close(!1)),i.data.length>1&&i.data.forEach(c=>{(c.barcode===r||c.additionalBarcodes.includes(r))&&(this.addProduct(c,a),this.autocomplete.close(!1))}),this.enableAutocompleteEnterEvent=!0})}}},t.\u0275fac=function(o){return new(o||t)(n(h))},t.\u0275cmp=l({type:t,selectors:[["tis-base-parser"]],viewQuery:function(o,r){if(o&1&&m(A,5),o&2){let a;u(a=d())&&(r.autocomplete=a.first)}},decls:0,vars:0,template:function(o,r){},encapsulation:2}),t);g=s([p()],g);export{g as a};
//# sourceMappingURL=chunk-CQU7IQ7X.js.map
