1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2689,1375],{66854:function(t,e,a){a.d(e,{Z:function(){return N}});var n=a(57437),o=a(9380),l=a(52714),i=a(22202);let r={init:()=>new Uint8Array([27,64]),cut:()=>new Uint8Array([29,86,66,0]),bold:function(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return new Uint8Array([27,69,t?1:0])},align:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"left";return new Uint8Array([27,97,"center"===t?1:"right"===t?2:0])},doubleSize:function(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];return new Uint8Array([29,33,t?17:0])},lineFeed:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return new Uint8Array(Array(t).fill(10))},imageWithText:async function(t,e){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:384;return await u(t,e,a)},text:t=>c(t)},c=t=>new TextEncoder().encode(t),s=t=>{try{let e=t.length,a="";return a+="".concat("\x1d","(k\x04\x001A2\0")+"".concat("\x1d","(k\x03\x001C").concat("\x06")+"".concat("\x1d","(k\x03\x001E").concat("0")+"".concat("\x1d","(k").concat(String.fromCharCode(e%256+3,Math.floor(e/256)),"1P0").concat(t)+"".concat("\x1d","(k\x03\x001Q0")}catch(t){return""}};async function u(t,e){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:384;try{let n=await d(t),o=document.createElement("canvas"),l=o.getContext("2d"),i=Math.floor(n.height/n.width*100),r=a-115-10;o.width=a,o.height=i,l.fillStyle="white",l.fillRect(0,0,a,i),l.drawImage(n,0,0,100,i);let c=i/e.length;l.font="bold ".concat(Math.floor(.7*c),'px "Courier New", monospace'),l.fillStyle="black",l.textAlign="left",l.textBaseline="middle",e.forEach((t,e)=>{let a=t;if(l.measureText(a).width>r){for(;l.measureText(a+"...").width>r&&a.length>0;)a=a.slice(0,-1);a+="..."}l.fillText(a,115,(e+.2)*c)});let s=l.getImageData(0,0,a,i),u=[];for(let t=0;t<i;t++)for(let e=0;e<a;e+=8){let n=0;for(let o=0;o<8;o++){let l=(t*a+(e+o))*4,[i,r,c]=s.data.slice(l,l+3);.299*i+.587*r+.114*c<128&&(n|=1<<7-o)}u.push(n)}let h=a/8,p=255&i,m=i>>8&255;return new Uint8Array([29,118,48,0,h,0,p,m,...u])}catch(t){return null}}async function d(t){try{let e="/api/proxy-image?url=".concat(encodeURIComponent(t));return new Promise((t,a)=>{let n=new Image;n.onload=()=>{t(n)},n.onerror=t=>{a(t)},n.src=e})}catch(t){throw t}}function h(){for(var t=arguments.length,e=Array(t),a=0;a<t;a++)e[a]=arguments[a];let n=new Uint8Array(e.reduce((t,e)=>t+(e?e.length:0),0)),o=0;for(let t of e)t&&(n.set(t,o),o+=t.length);return n}async function p(t){let{text:e="",imageUrl:a=null,textToImage:n=null,align:o="center",bold:l=!1,double:i=!1,cut:c=!0,lineFeedAfter:s=3}=t,u=[];if(u.push(r.init()),o&&u.push(r.align(o)),l&&u.push(r.bold(!0)),i&&u.push(r.doubleSize(!0)),a){let t=await r.imageWithText(a,n);t&&(u.push(t),u.push(r.lineFeed(1)))}return e&&u.push(r.text(e)),l&&u.push(r.bold(!1)),i&&u.push(r.doubleSize(!1)),s&&u.push(r.lineFeed(s)),c&&u.push(r.cut()),h(...u)}var m=a(91793),g=a(6986),v=a(71096),f=a.n(v);let w={"58mm":32,"80mm":48},y={transaction_receipt:"Nota Pelanggan",production_receipt:"Nota Produksi",topup_paket_receipt:"Nota Topup Paket",topup_deposit_receipt:"Nota Topup Deposit",qris_payment_receipt:"Nota Pembayaran QRIS"},b=function(t,e){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"left";if(t||(t=""),(t=String(t)).length>e){let n=[],o=t.split(" "),l="";return o.forEach(t=>{for(;t.length>e;)l&&(n.push(b(l,e,a)),l=""),n.push(b(t.slice(0,e),e,a)),t=t.slice(e);(l+(l?" ":"")+t).length>e?(n.push(b(l,e,a)),l=t):l=l?l+" "+t:t}),l&&n.push(b(l,e,a)),n.flat()}if("center"===a){let a=Math.floor((e-t.length)/2);return" ".repeat(a)+t+" ".repeat(e-t.length-a)}return"right"===a?" ".repeat(e-t.length)+t:t+" ".repeat(e-t.length)},x=(t,e,a)=>{t=String(null!=t?t:""),e=String(null!=e?e:""),t.length+e.length>a&&e.length>a-t.length-1&&(e=e.slice(0,a-t.length-1));let n=a-t.length-e.length;return t+" ".repeat(n>0?n:1)+e},_=function(t,e){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"left";return t?t.split(/\r?\n/).flatMap(t=>[].concat(b(t,e,a))):[]},k=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"DD-MM-YY HH:mm";return t?f().isDayjs(t)?t.format(e):void 0!==t._seconds?f().unix(t._seconds).format(e):f()(t).format(e):"-"},T=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.repeat(t)},j=()=>{let t=(0,l.Z)(),{data:e}=(0,i.pA)(),{generateTransactionReceipt:a,generateProductionReceipt:n,generatePKTTopupReceipt:o,generateDEPTopupReceipt:r,createTransactionReceipt:c,createProductionReceipt:u,createPKTTopupReceipt:d,createDEPTopupReceipt:v,generateQrisPaymentReceipt:f,createQrisPaymentReceipt:y}=function(){let t=m.Z.getState("activeOutlet").activeOutlet;return{generateTransactionReceipt:e=>{var a,n,o,l,i,r,c,s,u,d,h,p,m,v,f,w,y,b,x,_;let{receiptConfig:T,transactionData:j,commonPayments:E=[]}=e,A=((null==j?void 0:j.total_harga)||0)+((null==j?void 0:j.total_ongkir)||0)+((null==j?void 0:j.total_barang)||0),P=(null==j?void 0:null===(a=j.detail_pembayaran)||void 0===a?void 0:a.totalharga)||0,S=null==j?void 0:j.promo,N=(null==j?void 0:j.detail)||[],C=[];S&&"potongan"===S.jenis_promo&&C.push({name:"- ".concat(S.nama_promo),total:(null==j?void 0:j.total_potongan)||0}
1),N.forEach(t=>{Array.isArray(t.promo)&&t.promo.length>0&&t.promo.forEach(t=>{"potongan"===t.jenis_promo&&C.push({name:"- ".concat(t.nama),total:Number(t.total)||0})})});let D=(null==j?void 0:null===(n=j.extra)||void 0===n?void 0:n.map(t=>({name:t.nama,qty:t.qty,satuan:t.satuan,price:(0,g.xG)(t.harga),total:(0,g.xG)(t.total)})))||[],G=(null==j?void 0:null===(o=j.emoney)||void 0===o?void 0:o.saldoawal)||0,M=(null==j?void 0:null===(l=j.emoney)||void 0===l?void 0:l.saldoakhir)||0,R=[...(null==j?void 0:j.emoney)?[{label:"- ".concat(k(null==j?void 0:null===(i=j.emoney)||void 0===i?void 0:i.waktu)," Saldo"),value:(0,g.xG)(G-M)}]:[],...E.map(t=>({label:"- ".concat(k(t.waktu)," ").concat(t.cashbox),value:(0,g.xG)(t.jumlah)}))];return{header:{show:!T.logo,content:[T.text1,T.text2,T.text3]},no_nota:{show:!0,content:(null==j?void 0:j.no_nota)||""},pelanggan:{show:!0,content:(null==j?void 0:j.nama_pelanggan)||""},kasir:{show:T.kasir,content:(null==j?void 0:j.dikonfirmasi_nama)||""},tgl_pesan:{show:!0,content:k(null==j?void 0:j.waktu_pesan)},est_selesai:{show:T.estimasi,content:k(null==j?void 0:j.waktu_estimasi)},items:{show:!(null==j?void 0:j.deposit),content:N.map(t=>({name:"".concat(t.nama_paket," ").concat(t.nama_layanan),satuan:t.satuan_baru||t.satuan,min_order:t.min_order||null,qty:t.qty,price:(0,g.xG)(Number(t.biaya)),total:(0,g.xG)(Number(t.total_detail))}))},deposit:{show:null==j?void 0:j.deposit,data:{name:null===(c=N[0])||void 0===c?void 0:null===(r=c.deposit)||void 0===r?void 0:r.nama,desc:Number(null===(u=N[0])||void 0===u?void 0:null===(s=u.deposit)||void 0===s?void 0:s.min_order)>0?"Min. ".concat(N[0].min_order," ").concat(N[0].satuan_baru||N[0].satuan):null,list:[{label:"- Pemakaian",value:"".concat((null===(h=N[0])||void 0===h?void 0:null===(d=h.deposit)||void 0===d?void 0:d.kuotaawal)-(null===(m=N[0])||void 0===m?void 0:null===(p=m.deposit)||void 0===p?void 0:p.kuotaakhir)," ").concat(N[0].satuan_baru||N[0].satuan)},{label:"- Kuota Awal",value:"".concat(null===(f=N[0])||void 0===f?void 0:null===(v=f.deposit)||void 0===v?void 0:v.kuotaawal," ").concat(N[0].satuan_baru||N[0].satuan)},{label:"- Kuota Akhir",value:"".concat(null===(y=N[0])||void 0===y?void 0:null===(w=y.deposit)||void 0===w?void 0:w.kuotaakhir," ").concat(N[0].satuan_baru||N[0].satuan)}]}},extra:{show:D.length>0,content:D},ongkir:{show:(null==j?void 0:j.total_ongkir)>0,content:{label:"".concat(null==j?void 0:j.jarak," Km"),value:(0,g.xG)(null==j?void 0:j.total_ongkir)}},harga_jual:{show:C.length>0,content:(0,g.xG)(A)},promos:{show:C.length>0,content:C},total_promo:{show:C.length>0,content:null==C?void 0:C.reduce((t,e)=>{let a=t+e.total;return(0,g.xG)(a)},0)},pembulatan:{show:((null==j?void 0:j.total_pembulatan)||0)>0,content:(null==j?void 0:j.total_pembulatan)||0},total_harga:{show:!(null==j?void 0:j.deposit),content:(0,g.xG)(P)},dibayar:{show:!(null==j?void 0:j.deposit),content:(0,g.xG)(null==j?void 0:j.total_dibayar)||0},kurang:{show:(null==j?void 0:null===(b=j.detail_pembayaran)||void 0===b?void 0:b.piutang)>0,content:(0,g.xG)(null==j?void 0:null===(x=j.detail_pembayaran)||void 0===x?void 0:x.piutang)},kembalian:{show:(null==j?void 0:j.total_dibayar)-P>0,content:(0,g.xG)((null==j?void 0:j.total_dibayar)-P)},emoney:(null==j?void 0:j.emoney)?{show:!0,content:[{label:"- Pemakaian",value:(0,g.xG)(G-M)},{label:"- Saldo Awal",value:(0,g.xG)(G)},{label:"- Saldo Akhir",value:(0,g.xG)(M)}]}:{show:!1,content:null},pembayaran:{show:R.length>0,content:R},additionals:{show:!0,content:[{show:T.item,label:"Item",value:"".concat(N.reduce((t,e)=>"Satuan"===e.satuan?t+e.qty:t+1,0)," Item ").concat(null==N?void 0:N.length," Layanan")},{show:T.parfum,label:"Parfum",value:(null==j?void 0:j.parfum)||"Tidak ada"},{show:T.catatan,label:"Catatan",value:(null==j?void 0:j.catatan)||"Tidak ada"}]},footer:{show:null!=t&&null!==(_=t.nota)&&void 0!==_&&!!_.footer,content:null==t?void 0:t.footer}}},generateProductionReceipt:t=>{var e,a;let{transactionData:n,commonPayments:o=[]}=t,l=(null==n?void 0:null===(e=n.detail_pembayaran)||void 0===e?void 0:e.totalharga)||0,i=(null==n?void 0:n.detail)||[];return{no_nota:{show:!0,content:(null==n?void 0:n.no_nota)||""},tgl_pesan:{show:!0,content:k(null==n?void 0:n.waktu_pesan)},est_selesai:{show:!0,content:k(null==n?void 0:n.waktu_estimasi)},items:{show:!0,content:i.map(t=>{let e=t.satuan_baru||t.satuan,a=t.item&&t.item.length>0?"Item : ".concat(t.item.map(t=>"".concat(t.nama," ").concat(t.qty)).join(", ")):"Item : Tidak Dihitung";return{name:"".concat(t.nama_paket," ").concat(t.nama_layanan),satuan:e,min_order:t.min_order||null,qty:t.qty,price:(0,g.xG)(Number(t.biaya)),total:(0,g.xG)(t.qty*Number(t.biaya)),items:"kg"!==e?null:a}})},total_harga:{show:!0,content:(0,g.xG)(l)},dibayar:{show:(null==n?void 0:n.detail_pembayaran.piutang)>0,content:(0,g.xG)(null==n?void 0:n.total_dibayar)||0},waktu_bayar:{show:(null==n?void 0:n.detail_pembayaran.piutang)===0,content:k(null==o?void 0:null===(a=o[(null==o?void 0:o.length)-1])||void 0===a?void 0:a.waktu)},additionals:{show:!0,content:[{show:!0,label:"Parfum",value:(null==n?void 0:n.parfum)||"Tidak ada"},{show:!0,label:"Catatan",value:(null==n?void 0:n.catatan)||"Tidak ada"}]},footer:{show:!0,content:"Hanya Untuk Nota Produksi, Update Pembaaran Silakan Buka di Aplikasi"}}},generatePKTTopupReceipt:t=>{let{transactionData:e,receiptConfig:a}=t,n=(null==e?void 0:e.total_dibayar)-(null==e?void 0:e.total_harga),o=(null==e?void 0:e.detail)||[];return{no_nota:(null==e?void 0:e.no_nota)||"",pelanggan:(null==e?void 0:e.nama_pelanggan)||"",kasir:{show:a.kasir,content:(null==e?void 0:e.diterima_nama)||""},tgl_pesan:k(null==e?void 0:e.waktu),items:o.map(t=>{let e=Number(t.qty),a=Number(t.total_harga);return{name:t.nama_langganan,qty:e,price:(0,g.xG)(a),total:(0,g.xG)(e*a)}}),kuota:o.map(t=>{let e=t.kuota,a=t.kuotaawal,n=t.kuotaakhir;return{satuan:t.satuan,data:[{label:"- Kuota",value:e},{label:"- Kuota Awal",value:a},{label:"- Kuota Akhir",value:n}]}}),total_harga:(0,g.xG)(null==e?void 0:e.total_harga),dibayar:(0,g.xG)(null==e?void 0:e.total_dibayar)||0,kembalian:{show:n>0,content:(0,g.xG)(n)},footer:{show:a.footer,content:"Terima kasih"}}},generateDEPTopupReceipt:t=>{let{transactionData:e,receiptConfig:a}=t;return{no_nota:(null==e?void 0:e.no_nota)||"",pelanggan:(null==e?void 0:e.nama_pelanggan)||"",kasir:{show:a.kasir,content:(null==e?void 0:e.nama_operator)||""},tgl_pesan:k(null==e?void 0:e.waktu),kuota:{show:!0,content:[{label:"- Topup Saldo",value:(0,g.xG)(null==e?void 0:e.jumlah)},{label:"- Saldo Awal",value:(0,g.xG)(null==e?void 0:e.saldoawal)},{label:"- Saldo Akhir",value:(0,g.xG)(null==e?void 0:e.saldoakhir)}]},footer:{show:a.footer,content:"Terima kasih"}}},createProductionReceipt:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"58mm";if(!t)return"";let a=[],n=w[e]||w["58mm"];
1if(a.push(T(n)),t.no_nota.show&&t.no_nota.content&&a.push(...[].concat(x("Order ID",t.no_nota.content,n))),t.tgl_pesan.show&&t.tgl_pesan.content&&a.push(...[].concat(x("Tgl Pesan",t.tgl_pesan.content,n))),t.est_selesai.show&&t.est_selesai.content&&a.push(...[].concat(x("Est Selesai",t.est_selesai.content,n))),a.push(T(n)),t.items.show&&t.items.content.forEach((t,e)=>{a.push(...[].concat(b(t.name,n))),t.min_order&&a.push(...[].concat(b("Min. ".concat(t.min_order," ").concat(t.satuan),n)));let o="".concat(t.qty," ").concat(t.satuan," x ").concat(t.price),l=t.total;a.push(...[].concat(x(o,l,n))),t.items&&a.push(...[].concat(b(t.items,n,"center")))}),a.push(T(n)),t.additionals.show){let e=t.additionals.content,o=Math.max(...e.map(t=>{let{label:e}=t;return e.length}));e.filter(t=>{let{show:e}=t;return e}).forEach(t=>{let{label:e,value:l}=t,i=" ".repeat(o-e.length),r="".concat(e).concat(i,": ").concat(l);a.push(...[].concat(b(r,n)))})}return a.push(T(n)),t.total_harga.show&&a.push(...[].concat(x("Total Harga",t.total_harga.content,n))),t.dibayar.show&&a.push(...[].concat(x("Total Dibayar",t.dibayar.content,n))),t.waktu_bayar.show&&a.push(...[].concat(x("Tgl Dibayar",t.waktu_bayar.content,n))),t.footer.show&&(a.push(""),a.push(...[].concat(_(t.footer.content,n,"center"))),a.push("")),a.push(""),a.join("\n")},createPKTTopupReceipt:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"58mm";if(!t)return"";let a=[],n=w[e]||w["58mm"];if(a.push(T(n)),a.push(...[].concat(x("Order ID",t.no_nota,n))),a.push(...[].concat(x("Pelanggan",t.pelanggan,n))),t.kasir.show&&t.kasir.content&&a.push(...[].concat(x("Kasir",t.kasir.content,n))),a.push(...[].concat(x("Tgl Pesan",t.tgl_pesan,n))),a.push(T(n)),a.push(...[].concat(b("NOTA TOPUP",n,"center"))),t.items.forEach((t,e)=>{a.push(...[].concat(b(t.name,n)));let o="".concat(t.qty," x ").concat(t.price),l=t.total;a.push(...[].concat(x(o,l,n)))}),a.push(""),t.kuota){let e=t.kuota;a.push(...[].concat(b("KUOTA SAYA",n,"center"))),e.forEach(t=>{let{data:e,satuan:o}=t,l=Math.max(...e.map(t=>{let{label:e}=t;return e.length}));e.forEach(t=>{let{label:e,value:i}=t,r=" ".repeat(l-e.length),c="".concat(e).concat(r,": ").concat(i," ").concat(o);a.push(...[].concat(b(c,n)))}),a.push("")})}return a.push(T(n)),a.push(...[].concat(x("Total Harga",t.total_harga,n))),a.push(...[].concat(x("Total Dibayar",t.dibayar,n))),t.kembalian.show&&a.push(...[].concat(x("Kembalian",t.kembalian.content,n))),t.footer.show&&(a.push(""),a.push(...[].concat(_(t.footer.content,n,"center"))),a.push("")),a.push(""),a.join("\n")},createTransactionReceipt:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"58mm";if(!t)return"";let a=[],n=w[e]||w["58mm"];if(t.header.show&&(a.push(""),t.header.content.forEach(t=>{a.push(...[].concat(b(t,n,"center")))})),a.push(T(n)),t.no_nota.show&&t.no_nota.content&&a.push(...[].concat(x("Order ID",t.no_nota.content,n))),t.pelanggan.show&&t.pelanggan.content&&a.push(...[].concat(x("Pelanggan",t.pelanggan.content,n))),t.kasir.show&&t.kasir.content&&a.push(...[].concat(x("Kasir",t.kasir.content,n))),t.tgl_pesan.show&&t.tgl_pesan.content&&(a.push(...[].concat(x("Tgl Pesan",t.tgl_pesan.content,n))),t.est_selesai.show&&t.est_selesai.content&&a.push(...[].concat(x("Est Selesai",t.est_selesai.content,n)))),a.push(T(n)),t.items.show&&t.items.content&&t.items.content.forEach((t,e)=>{a.push(...[].concat(b(t.name,n))),t.min_order&&a.push(...[].concat(b("Min. ".concat(t.min_order," ").concat(t.satuan),n)));let o="".concat(t.qty," ").concat(t.satuan," x ").concat(t.price),l=t.total;a.push(...[].concat(x(o,l,n))),a.push("")}),t.deposit.show){let{name:e,desc:o,list:l}=t.deposit.data;a.push(...[].concat(b(e,n))),o&&a.push(...[].concat(b(o,n)));let i=Math.max(...l.map(t=>{let{label:e}=t;return e.length}));l.forEach(t=>{let{label:e,value:o}=t,l=" ".repeat(i-e.length),r="".concat(e).concat(l,": ").concat(o);a.push(...[].concat(b(r,n)))})}if(t.extra.show&&t.extra.content&&(a.push(...[].concat(b("Produk Lain :",n))),t.extra.content.forEach((t,e)=>{a.push(...[].concat(b(t.name,n)));let o="".concat(t.qty," ").concat(t.satuan," x ").concat(t.price),l=t.total;a.push(...[].concat(x(o,l,n))),a.push("")})),t.ongkir.show&&(a.push(...[].concat(b("Biaya Ongkir",n))),a.push(...[].concat(x(t.ongkir.content.label,t.ongkir.content.value,n)))),t.harga_jual.show&&(a.push(T(n)),a.push(...[].concat(x("HARGA JUAL",t.harga_jual.content,n)))),a.push(T(n)),t.promos.show&&t.promos.content&&t.promos.content.forEach((t,e)=>{a.push(...[].concat(x(t.name,t.total,n)))}),t.total_promo.show&&a.push(...[].concat(x("ANDA HEMAT",t.total_promo.content,n))),t.total_harga.show&&a.push(...[].concat(x("Total Harga",t.total_harga.content,n))),t.pembulatan.show&&a.push(...[].concat(x("Pembulatan",t.pembulatan.content,n))),t.dibayar.show&&a.push(...[].concat(x("Total Dibayar",t.dibayar.content,n))),t.kurang.show&&a.push(...[].concat(x("Kurang",t.kurang.content,n))),t.kembalian.show&&a.push(...[].concat(x("Kembalian",t.kembalian.content,n))),t.emoney.show){a.push(""),a.push(...[].concat(b("Saldo
1Saya",n,"center")));let e=t.emoney.content,o=Math.max(...e.map(t=>{let{label:e}=t;return e.length}));e.forEach(t=>{let{label:e,value:l}=t,i=" ".repeat(o-e.length),r="".concat(e).concat(i,":");a.push(...[].concat(x(r,l,n)))})}if(t.pembayaran.show&&(a.push(""),a.push(T(n)),a.push(""),a.push(...[].concat(b("Detail Pembayaran :",n))),t.pembayaran.content.forEach(t=>{let{label:e,value:o}=t;a.push(...[].concat(x(e,o,n)))})),t.additionals.show){a.push("");let e=t.additionals.content,o=Math.max(...e.map(t=>{let{label:e}=t;return e.length}));e.filter(t=>{let{show:e}=t;return e}).forEach(t=>{let{label:e,value:l}=t,i=" ".repeat(o-e.length),r="".concat(e).concat(i,": ").concat(l);a.push(...[].concat(b(r,n)))})}return t.footer.show&&(a.push(""),a.push(...[].concat(_(t.footer.content,n,"center"))),a.push("")),a.push(""),a.push(...[].concat(b("Terima kasih",n,"center"))),a.join("\n")},createDEPTopupReceipt:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"58mm";if(!t)return"";let a=[],n=w[e]||w["58mm"];if(a.push(T(n)),a.push(...[].concat(x("Order ID",t.no_nota,n))),a.push(...[].concat(x("Pelanggan",t.pelanggan,n))),t.kasir.show&&t.kasir.content&&a.push(...[].concat(x("Kasir",t.kasir.content,n))),a.push(...[].concat(x("Tgl Pesan",t.tgl_pesan,n))),a.push(T(n)),t.kuota.show){let e=t.kuota.content;a.push(...[].concat(b("KUOTA",n,"center")));let o=Math.max(...e.map(t=>{let{label:e}=t;return e.length}));e.forEach(t=>{let{label:e,value:l}=t,i=" ".repeat(o-e.length),r="".concat(e).concat(i,": ").concat(l);a.push(...[].concat(b(r,n)))})}return a.push(T(n)),t.footer.show&&(a.push(""),a.push(...[].concat(_(t.footer.content,n,"center"))),a.push("")),a.push(""),a.join("\n")},generateQrisPaymentReceipt:t=>{let{transactionData:e,receiptConfig:a}=t;return{name:{show:!0,content:(null==e?void 0:e.name)||"QRIS"},amount:{show:!0,content:(0,g.xG)(null==e?void 0:e.amount)},duration:{show:(null==e?void 0:e.type_mesin)==="Analog",content:null==e?void 0:e.duration},footer:{show:null==a?void 0:a.footer,content:"Terima kasih"}}},createQrisPaymentReceipt:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"58mm",a=[],n=w[e]||w["58mm"];a.push(T(n)),a.push(...[].concat(b(t.name.content,n,"center")));let o="Total: Rp ".concat(t.amount.content);return t.duration.show&&(o+=" / ".concat(t.duration.content," menit")),a.push(...[].concat(b(o,n,"center"))),a.push(T(n)),t.footer.show&&(a.push(""),a.push(...[].concat(b(t.footer.content,n,"center")))),a.push(""),a.join("\n")}}}(),j=null==e?void 0:e.nota,E=async t=>{let e=s(t);return await p({text:e,align:"center",cut:!1,lineFeedAfter:2})},A=async(t,e)=>await p({text:"",imageUrl:t,textToImage:e,align:"left",cut:!1,lineFeedAfter:0}),P=async t=>await p({text:t.join("\n"),align:"center",cut:!1,lineFeedAfter:2}),S=async(t,e)=>await p({text:"".concat(t,"\n").concat(e),align:"center",bold:!0,double:!0,cut:!1,lineFeedAfter:1}),N=async t=>await p({text:t,cut:!0,lineFeedAfter:3}),C=t=>{let{deposit:e,detail_pembayaran:a}=t,{piutang:n}=a;return e&&0===n?"LUNAS PAKET":n>0?"BELUM LUNAS":"LUNAS"},D=()=>({url:null==e?void 0:e.url_printer,texts:[null==j?void 0:j.text1,null==j?void 0:j.text2,null==j?void 0:j.text3]}),G=t=>"https://bilas.id/nota?id=".concat(t,"&io=").concat(null==e?void 0:e.id),M=async(t,e)=>{let a=h(...t);await e(a)},R=()=>t.success({message:"Berhasil mencetak nota"}),L=e=>{t.error({message:"Gagal mencetak nota"})},U=async t=>{let{includeQRCode:e=!1,includeLogo:a=!1,includeHeader:n=!1,includeLargeText:o=!1,qrCodeUrl:l=null,logoConfig:i=null,headerTexts:r=null,largeTextContent:c=null,receiptText:s=null}=t,u=[];if(e&&l&&(null==j?void 0:j.qrcode)){let t=await E(l);u.push(t)}if(a&&(null==i?void 0:i.url)&&(null==j?void 0:j.logo)){let t=await A(i.url,i.texts);u.push(t)}if(n&&r&&!(null==j?void 0:j.logo)){let t=await P(r);u.push(t)}if(o&&c){let t=await S(c.name,c.paymentStatus);u.push(t)}if(s){let t=await N(s);u.push(t)}return u},q=async t=>{let{transactionData:e,payments:n,printFn:o}=t;try{let t=a({receiptConfig:j,transactionData:e,commonPayments:n}),l=await c(t),i=G(null==e?void 0:e.id),r=D(),s=await U({includeQRCode:!0,includeLogo:!0,qrCodeUrl:i,logoConfig:r,receiptText:l});await M(s,o),R()}catch(t){L(t)}},I=async t=>{let{transactionData:e,payments:a,printFn:o}=t;try{let t=n({receiptConfig:j,transactionData:e,commonPayments:a}),l=await u(t),i=G(null==e?void 0:e.id),r=D(),c=C(e),s=await U({includeQRCode:!0,includeLogo:!0,includeHeader:!0,includeLargeText:!0,qrCodeUrl:i,logoConfig:r,headerTexts:r.texts,largeTextContent:{name:null==e?void 0:e.nama_pelanggan,paymentStatus:c},receiptText:l});await M(s,o),R()}catch(t){L(t)}},O=async t=>{let{transactionData:e,printFn:a}=t;
1try{let t=o({receiptConfig:j,transactionData:e}),n=await d(t),l=D(),i=await U({includeLogo:!0,includeHeader:!0,logoConfig:l,headerTexts:l.texts,receiptText:n});await M(i,a),R()}catch(t){L(t)}},K=async t=>{let{transactionData:e,printFn:a}=t;try{let t=r({receiptConfig:j,transactionData:e}),n=await v(t),o=D(),l=await U({includeLogo:!0,includeHeader:!0,logoConfig:o,headerTexts:o.texts,receiptText:n});await M(l,a),R()}catch(t){L(t)}},Z=async t=>{let{transactionData:e,printFn:a}=t;try{let t=f({receiptConfig:j,transactionData:e}),n=await y(t),o=D(),l=await U({includeQRCode:!0,includeLogo:!0,includeHeader:!0,qrCodeUrl:null==e?void 0:e.qr_string,logoConfig:o,headerTexts:o.texts,receiptText:n});await M(l,a),R()}catch(t){L(t)}};return{handlePrintByType:async t=>{let{type:e,transactionData:a,payments:n,printFn:o}=t,l={transaction_receipt:()=>q({transactionData:a,payments:n,printFn:o}),production_receipt:()=>I({transactionData:a,payments:n,printFn:o}),topup_paket_receipt:()=>O({transactionData:a,printFn:o}),topup_deposit_receipt:()=>K({transactionData:a,printFn:o}),qris_payment_receipt:()=>Z({transactionData:a,printFn:o})}[e];l&&await l()},handlePrintCustomerReceipt:q,handlePrintProductionReceipt:I,handlePrintPKTTopupReceipt:O,handlePrintDEPTopupReceipt:K,handlePrintQrisPaymentReceipt:Z}};var E=a(92283),A=a(81375),P=a(1014),S=a(44641),N=t=>{let{isOpen:e,type:a,transactionData:l,payments:i=null}=t,{device:r,isConnected:c,isPrinting:s,error:u,connectDevice:d,handleCloseModal:h,isConnecting:p,print:m}=(0,o.W)(),{handlePrintByType:g}=j(),v=async()=>await d(),f=async()=>{await g({type:a,transactionData:l,payments:i,printFn:m})};return(0,n.jsx)(A.Z,{isOpen:e,onClose:()=>h("printer"),title:"Cetak ".concat(y[a]),className:"w-11/12 max-w-md",children:(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsx)("div",{className:"flex items-center justify-between p-4 rounded-lg",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"w-3 h-3 rounded-full ".concat(c?"bg-success-light":"bg-gray-300")}),(0,n.jsxs)("div",{children:[(0,n.jsx)(S.Z,{children:c?"Terhubung":"Tidak Terhubung"}),r&&(0,n.jsx)(S.Z,{size:"small",children:r.name})]})]})}),u&&(0,n.jsx)("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:(0,n.jsx)(S.Z,{color:"danger",children:u})}),(0,n.jsxs)("div",{className:"flex items-center justify-end gap-x-3",children:[!c&&(0,n.jsx)(E.Z,{onClick:v,disabled:p||s,variant:"outline",children:p?(0,n.jsx)(P.Z,{loadingText:"Menghubungkan..."}):(0,n.jsx)(S.Z,{color:"blue",children:"Hubungkan"})}),(0,n.jsx)(E.Z,{variant:"primary",onClick:f,disabled:!c||s,children:s?(0,n.jsx)(P.Z,{textColor:"white",loadingText:"Mencetak..."}):(0,n.jsx)(S.Z,{color:"white",children:"Cetak"})})]})]})})}},81375:function(t,e,a){a.d(e,{Z:function(){return u}});var n=a(57437),o=a(2265);let l=[];var i=t=>{let{callbackFn:e,enabled:a=!0}=t;(0,o.useEffect)(()=>{if(!a||!e)return;let t=t=>{("Escape"===t.key||27===t.keyCode)&&l[l.length-1]===e&&(t.preventDefault(),e())};return l.push(e),document.addEventListener("keydown",t),()=>{let a=l.indexOf(e);-1!==a&&l.splice(a,1),document.removeEventListener("keydown",t)}},[e,a])},r=a(37062),c=a(91443),s=a(44641),u=t=>{let{isOpen:e,onClose:a=null,title:l=null,header:u=!0,children:d,className:h="",draggable:p=!1}=t;i({callbackFn:a,enabled:e&&!!a});let[m,g]=(0,o.useState)({x:0,y:0}),[v,f]=(0,o.useState)(!1),[w,y]=(0,o.useState)({x:0,y:0}),b=(0,o.useRef)(null);return((0,o.useEffect)(()=>(e?(document.body.style.overflow="hidden",g({x:0,y:0})):document.body.style.overflow="auto",()=>{document.body.style.overflow="auto"}),[e]),(0,o.useEffect)(()=>{if(!p)return;let t=t=>{if(!v)return;let e=t.clientX-w.x,a=t.clientY-w.y;g({x:m.x+e,y:m.y+a}),y({x:t.clientX,y:t.clientY})},e=()=>{f(!1)};return v&&(document.addEventListener("mousemove",t),document.addEventListener("mouseup",e)),()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",e)}},[v,w,m,p]),e)?(0,n.jsxs)("div",{className:"fixed inset-0 flex items-center justify-center z-50",children:[(0,n.jsx)("div",{className:"fixed inset-0 bg-black opacity-50","aria-hidden":"true",onClick:a&&a}),(0,n.jsx)("div",{ref:b,className:(0,r.cn)("relative bg-subbackground-light dark:bg-background-dark rounded-lg shadow-lg z-10 overflow-scroll hide-scrollbar w-11/12 max-w-md",h),role:"dialog","aria-modal":"true","aria-labelledby":"dialog-title",style:p?{transform:"translate(".concat(m.x,"px, ").concat(m.y,"px)"),transition:v?"none":"transform 0.1s ease-out"}:{},children:(0,n.jsxs)("div",{className:"h-full flex-1 flex flex-col gap-y-2 ".concat(u?"p-4":"p-2"),children:[u&&(0,n.jsxs)("div",{className:(0,r.cn)("modal-header w-full flex items-center sticky top-0 z-10 bg-subbackground-light dark:bg-background-dark pb-3 pt-4 -mt-4",l?"border-b custom-border justify-between":"justify-end",p?"cursor-pointer select-none":""),onMouseDown:t=>{p&&t.target.closest(".modal-header")&&(f(!0),y({x:t.clientX,y:t.clientY}))},children:[l&&(0,n.jsx)(s.Z,{size:"large",semibold:!0,children:l}),a&&(0,n.jsx)("button",{className:"text-disable-dark hover:text-gray-800 dark:text-disable-light dark:hover:text-disable-soft cursor-pointer",onClick:a,"aria-label":"Close dialog",children:(0,n.jsx)(c.Z,{size:16})})]}),d]})})]}):null}},9380:function(t,e,a){a.d(e,{W:function(){return i}});var n=a(3011);let o=null,l=null,i=(0,n.U)((t,e)=>({device:null,isPrinting:!1,isConnecting:!1,isConnected:!1,error:null,openModal:{printer:{isOpen:!1,data:null,type:null}},handleOpenModal:function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t(t=>({openModal:{...t.openModal,[e]:{...t.openModal[e],isOpen:!0,...a}}}))},handleCloseModal:e=>t(t=>({openModal:{...t.openModal,[e]:({printer:{isOpen:!1,data:null,type:null}})[e]}})),initialize:async()=>{try{var a,n;let l=await (null===(a=(n=navigator.bluetooth).getDevices)||void 0===a?void 0:a.call(n));if(null==l?void 0:l.length){let a=localStorage.getItem("printerName");if(!a)return;let n=l.find(t=>t.name===a);n&&(await n.gatt.connect(),o=n,t({device:n,isConnected:!0}),n.addEventListener("gattserverdisconnected",e().handleDisconnect))}}catch(t){}},handleDisconnect:()=>{t({isConnected:!1}),l=null},connectDevice:async()=>{t({isConnecting:!0,error:null});try{let a=localStorage.getItem("printerName");o=await navigator.bluetooth.requestDevice({filters:a?[{name:a}]:void 0,acceptAllDevices:!a,optionalServices:["generic_access","generic_attribute","000018f0-0000-1000-8000-00805f9b34fb","000018f1-0000-1000-8000-00805f9b34fb","49535343-fe7d-4ae5-8fa9-9fafd205e455","49535343-1e4d-4bd9-ba61-23c647249616","49535343-8841-43f4-a8d4-ecbe34729bb3","49535343-aca3-481c-91ec-d85e28a60318","0000ffe0-0000-1000-8000-00805f9b34fb","0000ff00-0000-1000-8000-00805f9b34fb","0000fff0-0000-1000-8000-00805f9b34fb"]}),localStorage.setItem("printerName",o.name||""),localStorage.setItem("printerDeviceId",o.id);let n=await o.gatt.connect();o.addEventListener("gattserverdisconnected",e().handleDisconnect),t({device:o,isConnected:!0});let i=await n.getPrimaryServices(),r=i.find(t=>/18f0|18f1|49535343|ffe0|ff00|fff0|ae30|fed8/i.test(t.uuid))||i[0];if(!r)throw Error("No compatible printer service found");if(!(l=(await r.getCharacteristics()).find(t=>t.properties.write||t.properties.writeWithoutResponse)))throw Error("No writable characteristic foun
1d");return{server:n,printerService:r,writeCharacteristic:l}}catch(e){throw t({error:"Browser tidak support bluetooth, gunakan Google Chrome.",isConnected:!1}),e}finally{t({isConnecting:!1})}},safeWrite:async(t,e)=>{if(!e||!(e instanceof Uint8Array)||0===e.length)throw Error("Invalid print data");let a=e.length,n=0,o="function"==typeof t.writeValueWithoutResponse;for(;n<a;){let l=Math.min(n+20,a),i=e.slice(n,l);try{o?await t.writeValueWithoutResponse(i):await t.writeValue(i)}catch(e){await new Promise(t=>setTimeout(t,10)),o?await t.writeValueWithoutResponse(i):await t.writeValue(i)}n=l,await new Promise(t=>setTimeout(t,5))}},print:async a=>{t({isPrinting:!0,error:null});try{let{isConnected:t,connectDevice:n,safeWrite:i}=e();o&&t||await n();let r=await o.gatt.connect();if(!l){let t=await r.getPrimaryServices(),e=t.find(t=>/18f0|18f1|49535343|ffe0|ff00|fff0|ae30|fed8/i.test(t.uuid))||t[0];l=(await e.getCharacteristics()).find(t=>t.properties.write||t.properties.writeWithoutResponse)}if(!l)throw Error("Writable characteristic not found");return await i(l,a),!0}catch(e){return t({error:e.message||"Print failed"}),!1}finally{t({isPrinting:!1})}},testConnection:async()=>{t({isPrinting:!0,error:null});try{let t=new TextEncoder().encode("\n\nTEST PRINT\n".concat(new Date().toLocaleTimeString(),"\n\n\n"));return await e().print(t)}catch(t){return!1}finally{t({isPrinting:!1})}},resetAllState:()=>t(()=>(o=null,l=null,{device:null,isPrinting:!1,isConnecting:!1,isConnected:!1,error:null,openModal:{printer:{isOpen:!1,data:null,type:null}}}))}));i.getState().initialize()},55229:function(t,e,a){var n=a(26752),o=a(11713),l=a(99376),i=a(2265),r=a(22202);e.Z=t=>{var e,a,c,s;let{page:u}=t,{data:d}=(0,r.pA)(),h=(0,l.useRouter)(),p=(0,l.useSearchParams)().get("id"),[m,g]=(0,i.useState)(!1);(0,i.useEffect)(()=>{if(!p)return;g(!1);let t=setTimeout(()=>{g(!0)},1500);return()=>clearTimeout(t)},[p]);let v="paket"===u?"deposit":u,f=(0,o.a)({queryKey:["detail-transaksi",p,null==d?void 0:d.id,u],queryFn:async()=>(await n.Z.getDetailTransaction({body:{id:p,id_outlet:null==d?void 0:d.id},page:v})).data.result,enabled:!!p&&!!(null==d?void 0:d.id)&&m,retry:!1,retryOnMount:!1,meta:{onErrorHandler:()=>h.back()}}),w=(null===(e=f.data)||void 0===e?void 0:e.status_pengerjaan)==="Dibatalkan"||(null===(a=f.data)||void 0===a?void 0:a.data_aktif)===!1,y=(null===(c=f.data)||void 0===c?void 0:c.status_pengerjaan)==="Dikonfirmasi"||(null===(s=f.data)||void 0===s?void 0:s.status_pengerjaan)==="Dijemput";return{...f,isCancelled:w,isConfirmationStep:y,isLoading:f.isLoading&&!f.data}}}}]);
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.