import{a,b as v}from"./chunk-DNU73PSG.js";import{G as f,J as l,kc as s}from"./chunk-OXQYUXXW.js";import{c as y,d}from"./chunk-Q6OK2OOV.js";import{a as o,b as p}from"./chunk-KAT7YFEL.js";var P=d("IcsNative",{web:()=>import("./chunk-LT5VOM3I.js").then(n=>new n.IcsNativeWeb)});var u=class n{electron=l(v);async printReceipt(t,r){let i=r?.ip||s().printer_ip,e=r?.printerType||s().printer_type,c={data:t,fontType:0,space:64,copies:r?.copies??1};return this.verifyPrinter(e,i),this.printInternal(c,i,e)}async printInternal(t,r,i){let[e,c]=s().printer_device.split("-").map(m=>m?parseInt(m,10):void 0);return this.electron.isElectron?i==="usb"?a.print(p(o({},t),{vid:e,pid:c})):a.print(p(o({},t),{address:r})):P.print(p(o({},t),{address:r}))}verifyPrinter(t,r){let i=y.isNativePlatform(),e=this.electron.isElectron;switch(t){case"usb":if(!e)throw new Error("For this platform you cannot use a USB printer using Electron interface");break;case"net":if(!i&&!e)throw new Error("Network printing is supported only on mobile or desktop platform");if(!r)throw new Error("Invalid or missing printer IP");break}}static \u0275fac=function(r){return new(r||n)};static \u0275prov=f({token:n,factory:n.\u0275fac,providedIn:"root"})};export{P as a,u as b};
