swissqrbill
Version:
Swiss QR Bill generation in Node.js and browsers
8 lines • 74.4 kB
JavaScript
(function(w,A){typeof exports=="object"&&typeof module!="undefined"?A(exports):typeof define=="function"&&define.amd?define(["exports"],A):(w=typeof globalThis!="undefined"?globalThis:w||self,A(w.SwissQRBill={}))})(this,function(w){"use strict";var ni=Object.defineProperty,si=Object.defineProperties;var ri=Object.getOwnPropertyDescriptors;var ge=Object.getOwnPropertySymbols;var oi=Object.prototype.hasOwnProperty,ai=Object.prototype.propertyIsEnumerable;var Ie=(w,A,P)=>A in w?ni(w,A,{enumerable:!0,configurable:!0,writable:!0,value:P}):w[A]=P,ct=(w,A)=>{for(var P in A||(A={}))oi.call(A,P)&&Ie(w,P,A[P]);if(ge)for(var P of ge(A))ai.call(A,P)&&Ie(w,P,A[P]);return w},ut=(w,A)=>si(w,ri(A));var $;function A(i){const t=e=>Object.fromEntries(Object.entries(e).map(([n,r])=>typeof r=="object"?[n,t(r)]:typeof r=="string"?n==="account"?[n,dt(P(r))]:n==="reference"?[n,dt(P(r))]:n==="country"?[n,dt(P(r).toUpperCase())]:[n,dt(r)]:[n,r]));return t(i)}function P(i){return i.replace(/ /g,"")}function dt(i){return i.replace(/\n/g,"").replace(/\r/g,"")}const C={DE:{acceptancePoint:"Annahmestelle",account:"Konto / Zahlbar an",additionalInformation:"Zusätzliche Informationen",amount:"Betrag",currency:"Währung",inFavourOf:"Zugunsten",payableBy:"Zahlbar durch",payableByName:"Zahlbar durch (Name/Adresse)",paymentPart:"Zahlteil",receipt:"Empfangsschein",reference:"Referenz",separate:"Vor der Einzahlung abzutrennen"},EN:{acceptancePoint:"Acceptance point",account:"Account / Payable to",additionalInformation:"Additional information",amount:"Amount",currency:"Currency",inFavourOf:"In favour of",payableBy:"Payable by",payableByName:"Payable by (name/address)",paymentPart:"Payment part",receipt:"Receipt",reference:"Reference",separate:"Separate before paying in"},FR:{acceptancePoint:"Point de dépôt",account:"Compte / Payable à",additionalInformation:"Informations supplémentaires",amount:"Montant",currency:"Monnaie",inFavourOf:"En faveur de",payableBy:"Payable par",payableByName:"Payable par (nom/adresse)",paymentPart:"Section paiement",receipt:"Récépissé",reference:"Référence",separate:"A détacher avant le versement"},IT:{acceptancePoint:"Punto di accettazione",account:"Conto / Pagabile a",additionalInformation:"Informazioni supplementari",amount:"Importo",currency:"Valuta",inFavourOf:"A favore di",payableBy:"Pagabile da",payableByName:"Pagabile da (nome/indirizzo)",paymentPart:"Sezione pagamento",receipt:"Ricevuta",reference:"Riferimento",separate:"Da staccare prima del versamento"}};class p extends Error{constructor(t,e){const n=e?wt(t,e):t;super(n),this.name="ValidationError",this.code=At(t)}}function At(i){return Object.keys(m).find(n=>m[n]===i)}function wt(i,t){return Object.entries(t).reduce((e,[n,r])=>e.replace(`{${n}}`,r),i)}var m=(i=>(i.ACCOUNT_IS_QR_IBAN_BUT_REFERENCE_IS_MISSING="If there is no reference, a conventional IBAN must be used.",i.ACCOUNT_IS_QR_IBAN_BUT_REFERENCE_IS_REGULAR="QR-IBAN requires the use of a QR-Reference.",i.ACCOUNT_IS_REGULAR_IBAN_BUT_REFERENCE_IS_QR="QR-Reference requires the use of a QR-IBAN.",i.ACCOUNT_LENGTH_IS_INVALID="The provided IBAN number '{iban}' is either too long or too short.",i.ADDITIONAL_INFORMATION_LENGTH_IS_INVALID="Additional information must be a maximum of 140 characters.",i.ADDITIONAL_INFORMATION_TYPE_IS_INVALID="Additional information must be a string.",i.ALTERNATIVE_SCHEME_LENGTH_IS_INVALID="{scheme} must be a maximum of 100 characters.",i.ALTERNATIVE_SCHEME_TYPE_IS_INVALID="{scheme} must be a string.",i.AMOUNT_LENGTH_IS_INVALID="Amount must be a maximum of 12 digits.",i.AMOUNT_TYPE_IS_INVALID="Amount must be a number.",i.CREDITOR_ACCOUNT_COUNTRY_IS_INVALID="Only CH and LI IBAN numbers are allowed.",i.CREDITOR_ACCOUNT_IS_INVALID="The provided IBAN number '{iban}' is not valid.",i.CREDITOR_ACCOUNT_IS_UNDEFINED="Creditor account cannot be undefined.",i.CREDITOR_ADDRESS_IS_UNDEFINED="Creditor address cannot be undefined.",i.CREDITOR_ADDRESS_LENGTH_IS_INVALID="Creditor address must be a maximum of 70 characters.",i.CREDITOR_ADDRESS_TYPE_IS_INVALID="Creditor address TYPE must be a string.",i.CREDITOR_BUILDING_NUMBER_LENGTH_IS_INVALID="Creditor buildingNumber must be a maximum of 16 characters.",i.CREDITOR_BUILDING_NUMBER_TYPE_IS_INVALID="Creditor buildingNumber must be either a string or a number.",i.CREDITOR_CITY_IS_UNDEFINED="Creditor city cannot be undefined.",i.CREDITOR_CITY_LENGTH_IS_INVALID="Creditor city must be a maximum of 35 characters.",i.CREDITOR_CITY_TYPE_IS_INVALID="Creditor city must be a string.",i.CREDITOR_COUNTRY_IS_UNDEFINED="Creditor country cannot be undefined.",i.CREDITOR_COUNTRY_LENGTH_IS_INVALID="Creditor country must be 2 characters.",i.CREDITOR_COUNTRY_TYPE_IS_INVALID="Creditor country must be a string.",i.CREDITOR_IS_UNDEFINED="Creditor cannot be undefined.",i.CREDITOR_NAME_IS_UNDEFINED="Creditor name cannot be undefined.",i.CREDITOR_NAME_LENGTH_IS_INVALID="Creditor name must be a maximum of 70 characters.",i.CREDITOR_NAME_TYPE_IS_INVALID="Creditor name must be a string.",i.CREDITOR_ZIP_IS_UNDEFINED="Creditor zip cannot be undefined.",i.CREDITOR_ZIP_LENGTH_IS_INVALID="Creditor zip must be a maximum of 16 characters.",i.CREDITOR_ZIP_TYPE_IS_INVALID="Creditor zip must be either a string or a number.",i.CURRENCY_IS_UNDEFINED="Currency cannot be undefined.",i.CURRENCY_LENGTH_IS_INVALID="Currency must be a length of 3 characters.",i.CURRENCY_STRING_IS_INVALID="Currency must be either 'CHF' or 'EUR'",i.CURRENCY_TYPE_IS_INVALID="Currency must be a string.",i.DEBTOR_ADDRESS_IS_UNDEFINED="Debtor address cannot be undefined.",i.DEBTOR_ADDRESS_LENGTH_IS_INVALID="Debtor address must be a maximum of 70 characters.",i.DEBTOR_ADDRESS_TYPE_IS_INVALID="Debtor address TYPE must be a string.",i.DEBTOR_BUILDING_NUMBER_LENGTH_IS_INVALID="Debtor buildingNumber must be a maximum of 16 characters.",i.DEBTOR_BUILDING_NUMBER_TYPE_IS_INVALID="Debtor buildingNumber must be either a string or a number.",i.DEBTOR_CITY_IS_UNDEFINED="Debtor city cannot be undefined.",i.DEBTOR_CITY_LENGTH_IS_INVALID="Debtor city must be a maximum of 35 characters.",i.DEBTOR_CITY_TYPE_IS_INVALID="Debtor city must be a string.",i.DEBTOR_COUNTRY_IS_UNDEFINED="Debtor country cannot be undefined.",i.DEBTOR_COUNTRY_LENGTH_IS_INVALID="Debtor country must be 2 characters.",i.DEBTOR_COUNTRY_TYPE_IS_INVALID="Debtor country must be a string.",i.DEBTOR_IS_UNDEFINED="Debtor cannot be undefined.",i.DEBTOR_NAME_IS_UNDEFINED="Debtor name cannot be undefined.",i.DEBTOR_NAME_LENGTH_IS_INVALID="Debtor name must be a maximum of 70 characters.",i.DEBTOR_NAME_TYPE_IS_INVALID="Debtor name must be a string.",i.DEBTOR_ZIP_IS_UNDEFINED="Debtor zip cannot be undefined.",i.DEBTOR_ZIP_LENGTH_IS_INVALID="Debtor zip must be a maximum of 16 characters.",i.DEBTOR_ZIP_TYPE_IS_INVALID="Debtor zip must be either a string or a number.",i.MESSAGE_AND_ADDITIONAL_INFORMATION_LENGTH_IS_INVALID="Message and additionalInformation combined must be a maximum of 140 characters.",i.MESSAGE_LENGTH_IS_INVALID="Message must be a maximum of 140 characters.",i.MESSAGE_TYPE_IS_INVALID="Message must be a string.",i.QR_REFERENCE_IS_INVALID="The provided QR-Reference '{reference}' is not valid.",i.QR_REFERENCE_LENGTH_IS_INVALID="QR-Reference must be a must be exactly 27 characters.",i.REFERENCE_TYPE_IS_INVALID="Reference must be a string.",i.REGULAR_REFERENCE_LENGTH_IS_INVALID="Creditor reference must be a maximum of 25 characters.",i))(m||{});const ye=Object.freeze(Object.defineProperty({__proto__:null,ValidationError:p,ValidationErrors:m,getErrorCodeByMessage:At,resolveMessageParams:wt},Symbol.toStringTag,{value:"Module"}));function vt(i){i=i.replace(/ /g,"");const t=i.substring(4,9);return+t>=3e4&&+t<=31999}function Lt(i){return i=i.replace(/ /g,"").toUpperCase(),i=i.substring(4)+i.substring(0,4),Ot(i)===1}function st(i){var e;const t=i.replace(/ /g,"").match(/.{1,4}/g);return(e=t==null?void 0:t.join(" "))!=null?e:i}function rt(i){return i=i.replace(/ /g,""),!(i.length!==27||!/^\d+$/.test(i))}function xt(i){if(i=i.replace(/ /g,""),!rt(i))return!1;const t=i.substring(0,26),e=i.substring(26,27);return Pt(t)===e}function Bt(i){return i=i.replace(/ /g,"").toUpperCase(),!(!i.startsWith("RF")||i.length<5||i.length>25||!/^[\dA-Z]+$/.test(i))}function _e(i){if(i=i.replace(/ /g,""),!Bt(i))return!1;const t=i.substring(4);if(Number.isNaN(i))return!1;const e=i.substring(2,4);return Number.isNaN(e)?!1:Mt(t)===e}function Mt(i){return i=i.replace(/ /g,""),`${98-Ot(`${i}RF00`)}`.padStart(2,"0")}function Pt(i){return Se(i)}function $t(i){const t=i.replace(/ /g,""),e=t.substring(2).match(/.{1,5}/g);return e?`${t.substring(0,2)} ${e.join(" ")}`:i}function zt(i){var n;const e=i.replace(/ /g,"").match(/.{1,4}/g);return(n=e==null?void 0:e.join(" "))!=null?n:i}function ot(i){const t=ht(i);return t==="QRR"?$t(i):t==="SCOR"?zt(i):i}function at(i){const e=i.toFixed(2).split(".");let n="";for(let r=e[0].length-1,h=1;r>=0;r--,h++)n=e[0][r]+n,h===3&&(n=` ${n}`,h=0);return`${n.trim()}.${e[1]}`}function y(i){return i*2.83465}function B(i){return i/2.83465}function tt(i){return i*960/254}function Ne(i){return i*254/960}function ht(i){return typeof i=="undefined"?"NON":rt(i)?"QRR":"SCOR"}function Ot(i){const e=i.split("");for(let r=0;r<e.length;r++){const h=e[r].charCodeAt(0);h>=65&&(e[r]=`${h-65+10}`)}i=e.join("");let n=0;for(let r=0;r<i.length;r++){const h=+i[r];n=(10*n+h)%97}return n}function Se(i){const t=i.replace(/ /g,""),e=[0,9,4,6,8,2,7,1,3,5];let n=0;for(let r=0;r<t.length;r++)n=e[(n+parseInt(t.substring(r,r+1),10))%10];return((10-n)%10).toString()}const be=Object.freeze(Object.defineProperty({__proto__:null,calculateQRReferenceChecksum:Pt,calculateSCORReferenceChecksum:Mt,formatAmount:at,formatIBAN:st,formatQRReference:$t,formatReference:ot,formatSCORReference:zt,getReferenceType:ht,isIBANValid:Lt,isQRIBAN:vt,isQRReference:rt,isQRReferenceValid:xt,isSCORReference:Bt,isSCORReferenceValid:_e,mm2pt:y,mm2px:tt,pt2mm:B,px2mm:Ne},Symbol.toStringTag,{value:"Module"}));function mt(i){if(i.reference!==void 0&&typeof i.reference!="string")throw new p(m.REFERENCE_TYPE_IS_INVALID);if(i.message!==void 0){if(typeof i.message!="string")throw new p(m.MESSAGE_TYPE_IS_INVALID);if(i.message.length>140)throw new p(m.MESSAGE_LENGTH_IS_INVALID)}if(i.additionalInformation!==void 0){if(typeof i.additionalInformation!="string")throw new p(m.ADDITIONAL_INFORMATION_TYPE_IS_INVALID);if(i.additionalInformation.length>140)throw new p(m.ADDITIONAL_INFORMATION_LENGTH_IS_INVALID)}if(i.message!==void 0&&i.additionalInformation!==void 0&&i.additionalInformation.length+i.message.length>140)throw new p(m.MESSAGE_AND_ADDITIONAL_INFORMATION_LENGTH_IS_INVALID);if(i.av1!==void 0){if(typeof i.av1!="string")throw new p(m.ALTERNATIVE_SCHEME_TYPE_IS_INVALID,{scheme:"AV1"});if(i.av1.length>100)throw new p(m.ALTERNATIVE_SCHEME_LENGTH_IS_INVALID,{scheme:"AV1"})}if(i.av2!==void 0){if(typeof i.av2!="string")throw new p(m.ALTERNATIVE_SCHEME_TYPE_IS_INVALID,{scheme:"AV2"});if(i.av2.length>100)throw new p(m.ALTERNATIVE_SCHEME_LENGTH_IS_INVALID,{scheme:"AV2"})}if(i.creditor===void 0)throw new p(m.CREDITOR_IS_UNDEFINED);if(i.creditor.account===void 0)throw new p(m.CREDITOR_ACCOUNT_IS_UNDEFINED);if(!i.creditor.account.startsWith("CH")&&!i.creditor.account.startsWith("LI"))throw new p(m.CREDITOR_ACCOUNT_COUNTRY_IS_INVALID);if(i.creditor.account.length!==21)throw new p(m.ACCOUNT_LENGTH_IS_INVALID,{iban:i.creditor.account});if(i.creditor.name===void 0)throw new p(m.CREDITOR_NAME_IS_UNDEFINED);if(typeof i.creditor.name!="string")throw new p(m.CREDITOR_NAME_TYPE_IS_INVALID);if(i.creditor.name.length>70)throw new p(m.CREDITOR_NAME_LENGTH_IS_INVALID);if(i.creditor.address===void 0)throw new p(m.CREDITOR_ADDRESS_IS_UNDEFINED);if(typeof i.creditor.address!="string")throw new p(m.CREDITOR_ADDRESS_TYPE_IS_INVALID);if(i.creditor.address.length>70)throw new p(m.CREDITOR_ADDRESS_LENGTH_IS_INVALID);if(i.creditor.buildingNumber!==void 0){if(typeof i.creditor.buildingNumber!="string"&&typeof i.creditor.buildingNumber!="number")throw new p(m.CREDITOR_BUILDING_NUMBER_TYPE_IS_INVALID);if(i.creditor.buildingNumber.toString().length>16)throw new p(m.CREDITOR_BUILDING_NUMBER_LENGTH_IS_INVALID)}if(i.creditor.zip===void 0)throw new p(m.CREDITOR_ZIP_IS_UNDEFINED);if(typeof i.creditor.zip!="string"&&typeof i.creditor.zip!="number")throw new p(m.CREDITOR_ZIP_TYPE_IS_INVALID);if(i.creditor.zip.toString().length>16)throw new p(m.CREDITOR_ZIP_LENGTH_IS_INVALID);if(i.creditor.city===void 0)throw new p(m.CREDITOR_CITY_IS_UNDEFINED);if(typeof i.creditor.city!="string")throw new p(m.CREDITOR_CITY_TYPE_IS_INVALID);if(i.creditor.city.length>35)throw new p(m.CREDITOR_CITY_LENGTH_IS_INVALID);if(i.creditor.country===void 0)throw new p(m.CREDITOR_COUNTRY_IS_UNDEFINED);if(typeof i.creditor.country!="string")throw new p(m.CREDITOR_COUNTRY_TYPE_IS_INVALID);if(i.creditor.country.length!==2)throw new p(m.CREDITOR_COUNTRY_LENGTH_IS_INVALID);if(i.amount!==void 0){if(typeof i.amount!="number")throw new p(m.AMOUNT_TYPE_IS_INVALID);if(i.amount.toFixed(2).toString().length>12)throw new p(m.AMOUNT_LENGTH_IS_INVALID)}if(i.currency===void 0)throw new p(m.CURRENCY_IS_UNDEFINED);if(typeof i.currency!="string")throw new p(m.CURRENCY_TYPE_IS_INVALID);if(i.currency.length!==3)throw new p(m.CURRENCY_LENGTH_IS_INVALID);if(i.currency!=="CHF"&&i.currency!=="EUR")throw new p(m.CURRENCY_STRING_IS_INVALID);if(i.debtor!==void 0){if(i.debtor.name===void 0)throw new p(m.DEBTOR_NAME_IS_UNDEFINED);if(typeof i.debtor.name!="string")throw new p(m.DEBTOR_NAME_TYPE_IS_INVALID);if(i.debtor.name.length>70)throw new p(m.DEBTOR_NAME_LENGTH_IS_INVALID);if(i.debtor.address===void 0)throw new p(m.DEBTOR_ADDRESS_IS_UNDEFINED);if(typeof i.debtor.address!="string")throw new p(m.DEBTOR_ADDRESS_TYPE_IS_INVALID);if(i.debtor.address.length>70)throw new p(m.DEBTOR_ADDRESS_LENGTH_IS_INVALID);if(i.debtor.buildingNumber!==void 0){if(typeof i.debtor.buildingNumber!="string"&&typeof i.debtor.buildingNumber!="number")throw new p(m.DEBTOR_BUILDING_NUMBER_TYPE_IS_INVALID);if(i.debtor.buildingNumber.toString().length>16)throw new p(m.DEBTOR_BUILDING_NUMBER_LENGTH_IS_INVALID)}if(i.debtor.zip===void 0)throw new p(m.DEBTOR_ZIP_IS_UNDEFINED);if(typeof i.debtor.zip!="string"&&typeof i.debtor.zip!="number")throw new p(m.DEBTOR_ZIP_TYPE_IS_INVALID);if(i.debtor.zip.toString().length>16)throw new p(m.DEBTOR_ZIP_LENGTH_IS_INVALID);if(i.debtor.city===void 0)throw new p(m.DEBTOR_CITY_IS_UNDEFINED);if(typeof i.debtor.city!="string")throw new p(m.DEBTOR_CITY_TYPE_IS_INVALID);if(i.debtor.city.length>35)throw new p(m.DEBTOR_CITY_LENGTH_IS_INVALID);if(i.debtor.country===void 0)throw new p(m.DEBTOR_COUNTRY_IS_UNDEFINED);if(typeof i.debtor.country!="string")throw new p(m.DEBTOR_COUNTRY_TYPE_IS_INVALID);if(i.debtor.country.length!==2)throw new p(m.DEBTOR_COUNTRY_LENGTH_IS_INVALID)}if(Lt(i.creditor.account)===!1)throw new p(m.CREDITOR_ACCOUNT_IS_INVALID,{iban:i.creditor.account});if(vt(i.creditor.account)){if(i.reference===void 0)throw new p(m.ACCOUNT_IS_QR_IBAN_BUT_REFERENCE_IS_MISSING);if(i.reference.length!==27)throw new p(m.QR_REFERENCE_LENGTH_IS_INVALID);if(rt(i.reference)){if(!xt(i.reference))throw new p(m.QR_REFERENCE_IS_INVALID,{reference:i.reference})}else throw new p(m.ACCOUNT_IS_QR_IBAN_BUT_REFERENCE_IS_REGULAR)}else if(i.reference!==void 0){if(rt(i.reference))throw new p(m.ACCOUNT_IS_REGULAR_IBAN_BUT_REFERENCE_IS_QR);if(i.reference.length>25)throw new p(m.REGULAR_REFERENCE_LENGTH_IS_INVALID)}}let Ce=($=class{constructor(t,e){this.scissors=!0,this.separate=!1,this.outlines=!0,this.language="DE",this.font="Helvetica",this._x=0,this._y=0,this.data=A(t),mt(this.data),this.language=(e==null?void 0:e.language)!==void 0?e.language:this.language,this.outlines=(e==null?void 0:e.outlines)!==void 0?e.outlines:this.outlines,this.font=(e==null?void 0:e.fontName)!==void 0?e.fontName:this.font,(e==null?void 0:e.scissors)!==void 0&&(this.scissors=e.scissors,this.separate=!e.scissors),(e==null?void 0:e.separate)!==void 0&&(this.separate=e.separate,this.scissors=!e.separate),(e==null?void 0:e.scissors)===!1&&(e==null?void 0:e.separate)===!1&&(this.separate=!1,this.scissors=!1)}attachTo(t,e=0,n=(r=>(r=t.page)==null?void 0:r.height)()?(h=>(h=t.page)==null?void 0:h.height)()-y(105):0){$.isSpaceSufficient(t,e,n)||(t.addPage({margin:0,size:[$.width,$.height]}),e=0,n=0),this._x=e,this._y=n,this.render(t)}static isSpaceSufficient(t,e,n){return t.page?Math.round(e+$.width)<=Math.round(t.page.width)&&Math.round(t.y+$.height)<=Math.round(t.page.height)&&Math.round(n+$.height)<=Math.round(t.page.height):!1}x(t=0){return this._x+y(t)}y(t=0){return this._y+y(t)}render(t){if(this.outlines&&(t.page.height>y(105)&&t.moveTo(this.x(),this.y()).lineTo(this.x(210),this.y()).lineWidth(.75).strokeOpacity(1).dash(1,{size:1}).strokeColor("black").stroke(),t.moveTo(this.x(62),this.y()).lineTo(this.x(62),this.y(105)).lineWidth(.75).strokeOpacity(1).dash(1,{size:1}).strokeColor("black").stroke()),this.scissors){const r="4.545 -1.803 m 4.06 -2.388 3.185 -2.368 2.531 -2.116 c -1.575 -0.577 l -2.769 -1.23 -3.949 -1.043 -3.949 -1.361 c -3.949 -1.61 -3.721 -1.555 -3.755 -2.203 c -3.788 -2.825 -4.437 -3.285 -5.05 -3.244 c -5.664 -3.248 -6.3 -2.777 -6.305 -2.129 c -6.351 -1.476 -5.801 -0.869 -5.152 -0.826 c -4.391 -0.713 -3.043 -1.174 -2.411 -0.041 c -2.882 0.828 -3.718 0.831 -4.474 0.787 c -5.101 0.751 -5.855 0.931 -6.154 1.547 c -6.443 2.138 -6.16 2.979 -5.496 3.16 c -4.826 3.406 -3.906 3.095 -3.746 2.325 c -3.623 1.731 -4.044 1.452 -3.882 1.236 c -3.76 1.073 -2.987 1.168 -1.608 0.549 c 2.838 2.117 l 3.4 2.273 4.087 2.268 4.584 1.716 c -0.026 -0.027 l 4.545 -1.803 l h -4.609 -2.753 m -3.962 -2.392 -4.015 -1.411 -4.687 -1.221 c -5.295 -1.009 -6.073 -1.6 -5.879 -2.26 c -5.765 -2.801 -5.052 -3 -4.609 -2.753 c h -4.581 1.256 m -3.906 1.505 -4.02 2.648 -4.707 2.802 c -5.163 2.96 -5.814 2.733 -5.86 2.196 c -5.949 1.543 -5.182 0.954 -4.581 1.256 c h",h=" 1.803 4.545 m 2.388 4.06 2.368 3.185 2.116 2.531 c 0.577 -1.575 l 1.23 -2.769 1.043 -3.949 1.361 -3.949 c 1.61 -3.949 1.555 -3.721 2.203 -3.755 c 2.825 -3.788 3.285 -4.437 3.244 -5.05 c 3.248 -5.664 2.777 -6.3 2.129 -6.305 c 1.476 -6.351 0.869 -5.801 0.826 -5.152 c 0.713 -4.391 1.174 -3.043 0.041 -2.411 c -0.828 -2.882 -0.831 -3.718 -0.787 -4.474 c -0.751 -5.101 -0.931 -5.855 -1.547 -6.154 c -2.138 -6.443 -2.979 -6.16 -3.16 -5.496 c -3.406 -4.826 -3.095 -3.906 -2.325 -3.746 c -1.731 -3.623 -1.452 -4.044 -1.236 -3.882 c -1.073 -3.76 -1.168 -2.987 -0.549 -1.608 c -2.117 2.838 l -2.273 3.4 -2.268 4.087 -1.716 4.584 c 0.027 -0.026 l 1.803 4.545 l h 2.753 -4.609 m 2.392 -3.962 1.411 -4.015 1.221 -4.687 c 1.009 -5.295 1.6 -6.073 2.26 -5.879 c 2.801 -5.765 3 -5.052 2.753 -4.609 c h -1.256 -4.581 m -1.505 -3.906 -2.648 -4.02 -2.802 -4.707 c -2.96 -5.163 -2.733 -5.814 -2.196 -5.86 c -1.543 -5.949 -0.954 -5.182 -1.256 -4.581 c h";t.page.height>y(105)&&(t.save(),t.translate(this.x(105),this.y()),t.addContent(r).fillColor("black").fill(),t.restore()),t.save(),t.translate(this.x(62),this.y()+30),t.addContent(h).fillColor("black").fill(),t.restore()}this.separate&&t.page.height>y(105)&&(t.fontSize(11),t.font(this.font),t.text(C[this.language].separate,0,this.y()-12,{align:"center",width:y(210)})),t.fontSize(11),t.font(`${this.font}-Bold`),t.text(C[this.language].receipt,this.x(5),this.y(5),{align:"left",width:y(52)}),t.fontSize(6),t.font(`${this.font}-Bold`),t.text(C[this.language].account,this.x(5),this.y(12),{lineGap:1,width:y(52)}),t.fontSize(8),t.font(this.font),t.text(`${st(this.data.creditor.account)}
${this.formatAddress(this.data.creditor)}`,{lineGap:-.5,width:y(52)}),t.fontSize(9),t.moveDown(),this.data.reference!==void 0&&(t.fontSize(6),t.font(`${this.font}-Bold`),t.text(C[this.language].reference,{lineGap:1,width:y(52)}),t.fontSize(8),t.font(this.font),t.text(ot(this.data.reference),{lineGap:-.5,width:y(52)}),t.fontSize(9),t.moveDown()),this.data.debtor!==void 0?(t.fontSize(6),t.font(`${this.font}-Bold`),t.text(C[this.language].payableBy,{lineGap:1,width:y(52)}),t.fontSize(8),t.font(this.font),t.text(this.formatAddress(this.data.debtor),{lineGap:-.5,width:y(52)})):(t.fontSize(6),t.font(`${this.font}-Bold`),t.text(C[this.language].payableByName,{lineGap:1,width:y(52)}),this.addRectangle(t,5,B(t.y-this.y()),52,20)),t.fontSize(6),t.font(`${this.font}-Bold`),t.text(C[this.language].currency,this.x(5),this.y(68),{lineGap:1,width:y(15)});const e=this.data.amount===void 0?18:27;if(t.text(C[this.language].amount,this.x(e),this.y(68),{lineGap:1,width:y(52-e)}),t.fontSize(8),t.font(this.font),t.text(this.data.currency,this.x(5),this.y(71),{lineGap:-.5,width:y(15)}),this.data.amount!==void 0?t.text(at(this.data.amount),this.x(e),this.y(71),{lineGap:-.5,width:y(52-e)}):this.addRectangle(t,27,68,30,10),t.fontSize(6),t.font(`${this.font}-Bold`),t.text(C[this.language].acceptancePoint,this.x(5),this.y(82),{align:"right",height:y(18),lineGap:1,width:y(52)}),t.fontSize(11),t.font(`${this.font}-Bold`),t.text(C[this.language].paymentPart,this.x(67),this.y(5),{align:"left",lineGap:1,width:y(51)}),new kt(this.data).attachTo(t,this.x(67),this.y(17)),t.fontSize(8),t.font(`${this.font}-Bold`),t.text(C[this.language].currency,this.x(67),this.y(68),{lineGap:1,width:y(15)}),t.text(C[this.language].amount,this.x(89),this.y(68),{width:y(29)}),t.fontSize(10),t.font(this.font),t.text(this.data.currency,this.x(67),this.y(72),{lineGap:-.5,width:y(15)}),this.data.amount!==void 0?t.text(at(this.data.amount),this.x(89),this.y(72),{lineGap:-.5,width:y(29)}):this.addRectangle(t,78,72,40,15),this.data.av1!==void 0){const[r,h]=this.data.av1.split(/(\/.+)/);t.fontSize(7),t.font(`${this.font}-Bold`),t.text(r,this.x(67),this.y(90),{continued:!0,height:y(3),lineGap:1,width:y(138)}),t.font(this.font),t.text(this.data.av1.length>90?`${h.substring(0,87)}...`:h,{continued:!1})}if(this.data.av2!==void 0){const[r,h]=this.data.av2.split(/(\/.+)/);t.fontSize(7),t.font(`${this.font}-Bold`),t.text(r,this.x(67),this.y(93),{continued:!0,height:y(3),lineGap:1,width:y(138)}),t.font(this.font),t.text(this.data.av2.length>90?`${h.substring(0,87)}...`:h,{lineGap:-.5})}if(t.fontSize(8),t.font(`${this.font}-Bold`),t.text(C[this.language].account,this.x(118),this.y(5),{lineGap:1,width:y(87)}),t.fontSize(10),t.font(this.font),t.text(`${st(this.data.creditor.account)}
${this.formatAddress(this.data.creditor)}`,{lineGap:-.75,width:y(87)}),t.fontSize(9),t.moveDown(),this.data.reference!==void 0&&(t.fontSize(8),t.font(`${this.font}-Bold`),t.text(C[this.language].reference,{lineGap:1,width:y(87)}),t.fontSize(10),t.font(this.font),t.text(ot(this.data.reference),{lineGap:-.75,width:y(87)}),t.fontSize(9),t.moveDown()),this.data.message!==void 0||this.data.additionalInformation!==void 0){t.fontSize(8),t.font(`${this.font}-Bold`),t.text(C[this.language].additionalInformation,{lineGap:1,width:y(87)}),t.fontSize(10),t.font(this.font);const r={lineGap:-.75,width:y(87)},h=t.heightOfString("A",r),l=ht(this.data.reference),u=l==="QRR"||l==="SCOR"?3:4,S=this.data.additionalInformation!==void 0?t.heightOfString(this.data.additionalInformation,r)/h:0;if(this.data.additionalInformation!==void 0){if(l==="QRR"||l==="SCOR")this.data.message!==void 0&&t.text(this.data.message,ut(ct({},r),{ellipsis:!0,height:h,lineBreak:!1}));else if(this.data.message!==void 0){const s=u-S;t.text(this.data.message,ut(ct({},r),{ellipsis:!0,height:h*s,lineBreak:!0}))}t.text(this.data.additionalInformation,r)}else this.data.message!==void 0&&t.text(this.data.message,ut(ct({},r),{ellipsis:!0,height:h*u,lineBreak:!0}));t.fontSize(9),t.moveDown()}this.data.debtor!==void 0?(t.fontSize(8),t.font(`${this.font}-Bold`),t.text(C[this.language].payableBy,{lineGap:1,width:y(87)}),t.fontSize(10),t.font(this.font),t.text(this.formatAddress(this.data.debtor),{lineGap:-.75,width:y(87)})):(t.fontSize(8),t.font(`${this.font}-Bold`),t.text(C[this.language].payableByName,{lineGap:1,width:y(87)}),this.addRectangle(t,118,B(t.y-this.y()),65,25))}formatAddress(t){const e=t.country!=="CH"?`${t.country} - `:"";return t.buildingNumber!==void 0?`${t.name}
${t.address} ${t.buildingNumber}
${e}${t.zip} ${t.city}`:`${t.name}
${t.address}
${e}${t.zip} ${t.city}`}addRectangle(t,e,n,r,h){t.moveTo(this.x(e+3),this.y(n)).lineTo(this.x(e),this.y(n)).lineTo(this.x(e),this.y(n+3)).moveTo(this.x(e),this.y(n+h-3)).lineTo(this.x(e),this.y(n+h)).lineTo(this.x(e+3),this.y(n+h)).moveTo(this.x(e+r-3),this.y(n+h)).lineTo(this.x(e+r),this.y(n+h)).lineTo(this.x(e+r),this.y(n+h-3)).moveTo(this.x(e+r),this.y(n+3)).lineTo(this.x(e+r),this.y(n)).lineTo(this.x(e+r-3),this.y(n)).lineWidth(.75).undash().strokeColor("black").stroke()}},$.width=y(210),$.height=y(105),$);var X;(i=>{const l=class l{constructor(s,o,a,f){if(this.version=s,this.errorCorrectionLevel=o,this.modules=[],this.isFunction=[],s<l.MIN_VERSION||s>l.MAX_VERSION)throw"Version value out of range";if(f<-1||f>7)throw"Mask value out of range";this.size=s*4+17;const c=[];for(let d=0;d<this.size;d++)c.push(!1);for(let d=0;d<this.size;d++)this.modules.push(c.slice()),this.isFunction.push(c.slice());this.drawFunctionPatterns();const g=this.addEccAndInterleave(a);if(this.drawCodewords(g),f==-1){let d=1e9;for(let I=0;I<8;I++){this.applyMask(I),this.drawFormatBits(I);const _=this.getPenaltyScore();_<d&&(f=I,d=_),this.applyMask(I)}}r(0<=f&&f<=7),this.mask=f,this.applyMask(f),this.drawFormatBits(f),this.isFunction=[]}static encodeText(s,o){const a=i.QrSegment.makeSegments(s);return l.encodeSegments(a,o)}static encodeBinary(s,o){const a=i.QrSegment.makeBytes(s);return l.encodeSegments([a],o)}static encodeSegments(s,o,a=1,f=40,c=-1,g=!0){if(!(l.MIN_VERSION<=a&&a<=f&&f<=l.MAX_VERSION)||c<-1||c>7)throw"Invalid value";let d,I;for(d=a;;d++){const N=l.getNumDataCodewords(d,o)*8,v=h.getTotalBits(s,d);if(v<=N){I=v;break}if(d>=f)throw"Data too long"}for(const N of[l.Ecc.MEDIUM,l.Ecc.QUARTILE,l.Ecc.HIGH])g&&I<=l.getNumDataCodewords(d,N)*8&&(o=N);const _=[];for(const N of s){e(N.mode.modeBits,4,_),e(N.numChars,N.mode.numCharCountBits(d),_);for(const v of N.getData())_.push(v)}r(_.length==I);const M=l.getNumDataCodewords(d,o)*8;r(_.length<=M),e(0,Math.min(4,M-_.length),_),e(0,(8-_.length%8)%8,_),r(_.length%8==0);for(let N=236;_.length<M;N^=253)e(N,8,_);const L=[];for(;L.length*8<_.length;)L.push(0);return _.forEach((N,v)=>L[v>>>3]|=N<<7-(v&7)),new l(d,o,L,c)}getModule(s,o){return 0<=s&&s<this.size&&0<=o&&o<this.size&&this.modules[o][s]}drawFunctionPatterns(){for(let a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2==0),this.setFunctionModule(a,6,a%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const s=this.getAlignmentPatternPositions(),o=s.length;for(let a=0;a<o;a++)for(let f=0;f<o;f++)a==0&&f==0||a==0&&f==o-1||a==o-1&&f==0||this.drawAlignmentPattern(s[a],s[f]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(s){const o=this.errorCorrectionLevel.formatBits<<3|s;let a=o;for(let c=0;c<10;c++)a=a<<1^(a>>>9)*1335;const f=(o<<10|a)^21522;r(f>>>15==0);for(let c=0;c<=5;c++)this.setFunctionModule(8,c,n(f,c));this.setFunctionModule(8,7,n(f,6)),this.setFunctionModule(8,8,n(f,7)),this.setFunctionModule(7,8,n(f,8));for(let c=9;c<15;c++)this.setFunctionModule(14-c,8,n(f,c));for(let c=0;c<8;c++)this.setFunctionModule(this.size-1-c,8,n(f,c));for(let c=8;c<15;c++)this.setFunctionModule(8,this.size-15+c,n(f,c));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let s=this.version;for(let a=0;a<12;a++)s=s<<1^(s>>>11)*7973;const o=this.version<<12|s;r(o>>>18==0);for(let a=0;a<18;a++){const f=n(o,a),c=this.size-11+a%3,g=Math.floor(a/3);this.setFunctionModule(c,g,f),this.setFunctionModule(g,c,f)}}drawFinderPattern(s,o){for(let a=-4;a<=4;a++)for(let f=-4;f<=4;f++){const c=Math.max(Math.abs(f),Math.abs(a)),g=s+f,d=o+a;0<=g&&g<this.size&&0<=d&&d<this.size&&this.setFunctionModule(g,d,c!=2&&c!=4)}}drawAlignmentPattern(s,o){for(let a=-2;a<=2;a++)for(let f=-2;f<=2;f++)this.setFunctionModule(s+f,o+a,Math.max(Math.abs(f),Math.abs(a))!=1)}setFunctionModule(s,o,a){this.modules[o][s]=a,this.isFunction[o][s]=!0}addEccAndInterleave(s){const o=this.version,a=this.errorCorrectionLevel;if(s.length!=l.getNumDataCodewords(o,a))throw"Invalid argument";const f=l.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][o],c=l.ECC_CODEWORDS_PER_BLOCK[a.ordinal][o],g=Math.floor(l.getNumRawDataModules(o)/8),d=f-g%f,I=Math.floor(g/f),_=[],M=l.reedSolomonComputeDivisor(c);for(let N=0,v=0;N<f;N++){const z=s.slice(v,v+I-c+(N<d?0:1));v+=z.length;const yt=l.reedSolomonComputeRemainder(z,M);N<d&&z.push(0),_.push(z.concat(yt))}const L=[];for(let N=0;N<_[0].length;N++)_.forEach((v,z)=>{(N!=I-c||z>=d)&&L.push(v[N])});return r(L.length==g),L}drawCodewords(s){if(s.length!=Math.floor(l.getNumRawDataModules(this.version)/8))throw"Invalid argument";let o=0;for(let a=this.size-1;a>=1;a-=2){a==6&&(a=5);for(let f=0;f<this.size;f++)for(let c=0;c<2;c++){const g=a-c,I=(a+1&2)==0?this.size-1-f:f;!this.isFunction[I][g]&&o<s.length*8&&(this.modules[I][g]=n(s[o>>>3],7-(o&7)),o++)}}r(o==s.length*8)}applyMask(s){if(s<0||s>7)throw"Mask value out of range";for(let o=0;o<this.size;o++)for(let a=0;a<this.size;a++){let f;switch(s){case 0:f=(a+o)%2==0;break;case 1:f=o%2==0;break;case 2:f=a%3==0;break;case 3:f=(a+o)%3==0;break;case 4:f=(Math.floor(a/3)+Math.floor(o/2))%2==0;break;case 5:f=a*o%2+a*o%3==0;break;case 6:f=(a*o%2+a*o%3)%2==0;break;case 7:f=((a+o)%2+a*o%3)%2==0;break;default:throw"Unreachable"}!this.isFunction[o][a]&&f&&(this.modules[o][a]=!this.modules[o][a])}}getPenaltyScore(){let s=0;for(let c=0;c<this.size;c++){let g=!1,d=0;const I=[0,0,0,0,0,0,0];for(let _=0;_<this.size;_++)this.modules[c][_]==g?(d++,d==5?s+=l.PENALTY_N1:d>5&&s++):(this.finderPenaltyAddHistory(d,I),g||(s+=this.finderPenaltyCountPatterns(I)*l.PENALTY_N3),g=this.modules[c][_],d=1);s+=this.finderPenaltyTerminateAndCount(g,d,I)*l.PENALTY_N3}for(let c=0;c<this.size;c++){let g=!1,d=0;const I=[0,0,0,0,0,0,0];for(let _=0;_<this.size;_++)this.modules[_][c]==g?(d++,d==5?s+=l.PENALTY_N1:d>5&&s++):(this.finderPenaltyAddHistory(d,I),g||(s+=this.finderPenaltyCountPatterns(I)*l.PENALTY_N3),g=this.modules[_][c],d=1);s+=this.finderPenaltyTerminateAndCount(g,d,I)*l.PENALTY_N3}for(let c=0;c<this.size-1;c++)for(let g=0;g<this.size-1;g++){const d=this.modules[c][g];d==this.modules[c][g+1]&&d==this.modules[c+1][g]&&d==this.modules[c+1][g+1]&&(s+=l.PENALTY_N2)}let o=0;for(const c of this.modules)o=c.reduce((g,d)=>g+(d?1:0),o);const a=this.size*this.size,f=Math.ceil(Math.abs(o*20-a*10)/a)-1;return r(0<=f&&f<=9),s+=f*l.PENALTY_N4,r(0<=s&&s<=2568888),s}getAlignmentPatternPositions(){if(this.version==1)return[];{const s=Math.floor(this.version/7)+2,o=this.version==32?26:Math.ceil((this.version*4+4)/(s*2-2))*2,a=[6];for(let f=this.size-7;a.length<s;f-=o)a.splice(1,0,f);return a}}static getNumRawDataModules(s){if(s<l.MIN_VERSION||s>l.MAX_VERSION)throw"Version number out of range";let o=(16*s+128)*s+64;if(s>=2){const a=Math.floor(s/7)+2;o-=(25*a-10)*a-55,s>=7&&(o-=36)}return r(208<=o&&o<=29648),o}static getNumDataCodewords(s,o){return Math.floor(l.getNumRawDataModules(s)/8)-l.ECC_CODEWORDS_PER_BLOCK[o.ordinal][s]*l.NUM_ERROR_CORRECTION_BLOCKS[o.ordinal][s]}static reedSolomonComputeDivisor(s){if(s<1||s>255)throw"Degree out of range";const o=[];for(let f=0;f<s-1;f++)o.push(0);o.push(1);let a=1;for(let f=0;f<s;f++){for(let c=0;c<o.length;c++)o[c]=l.reedSolomonMultiply(o[c],a),c+1<o.length&&(o[c]^=o[c+1]);a=l.reedSolomonMultiply(a,2)}return o}static reedSolomonComputeRemainder(s,o){const a=o.map(f=>0);for(const f of s){const c=f^a.shift();a.push(0),o.forEach((g,d)=>a[d]^=l.reedSolomonMultiply(g,c))}return a}static reedSolomonMultiply(s,o){if(s>>>8||o>>>8)throw"Byte out of range";let a=0;for(let f=7;f>=0;f--)a=a<<1^(a>>>7)*285,a^=(o>>>f&1)*s;return r(a>>>8==0),a}finderPenaltyCountPatterns(s){const o=s[1];r(o<=this.size*3);const a=o>0&&s[2]==o&&s[3]==o*3&&s[4]==o&&s[5]==o;return(a&&s[0]>=o*4&&s[6]>=o?1:0)+(a&&s[6]>=o*4&&s[0]>=o?1:0)}finderPenaltyTerminateAndCount(s,o,a){return s&&(this.finderPenaltyAddHistory(o,a),o=0),o+=this.size,this.finderPenaltyAddHistory(o,a),this.finderPenaltyCountPatterns(a)}finderPenaltyAddHistory(s,o){o[0]==0&&(s+=this.size),o.pop(),o.unshift(s)}};l.MIN_VERSION=1,l.MAX_VERSION=40,l.PENALTY_N1=3,l.PENALTY_N2=3,l.PENALTY_N3=40,l.PENALTY_N4=10,l.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],l.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];let t=l;i.QrCode=t;function e(S,s,o){if(s<0||s>31||S>>>s)throw"Value out of range";for(let a=s-1;a>=0;a--)o.push(S>>>a&1)}function n(S,s){return(S>>>s&1)!=0}function r(S){if(!S)throw"Assertion error"}const u=class u{constructor(s,o,a){if(this.mode=s,this.numChars=o,this.bitData=a,o<0)throw"Invalid argument";this.bitData=a.slice()}static makeBytes(s){const o=[];for(const a of s)e(a,8,o);return new u(u.Mode.BYTE,s.length,o)}static makeNumeric(s){if(!u.isNumeric(s))throw"String contains non-numeric characters";const o=[];for(let a=0;a<s.length;){const f=Math.min(s.length-a,3);e(parseInt(s.substr(a,f),10),f*3+1,o),a+=f}return new u(u.Mode.NUMERIC,s.length,o)}static makeAlphanumeric(s){if(!u.isAlphanumeric(s))throw"String contains unencodable characters in alphanumeric mode";const o=[];let a;for(a=0;a+2<=s.length;a+=2){let f=u.ALPHANUMERIC_CHARSET.indexOf(s.charAt(a))*45;f+=u.ALPHANUMERIC_CHARSET.indexOf(s.charAt(a+1)),e(f,11,o)}return a<s.length&&e(u.ALPHANUMERIC_CHARSET.indexOf(s.charAt(a)),6,o),new u(u.Mode.ALPHANUMERIC,s.length,o)}static makeSegments(s){return s==""?[]:u.isNumeric(s)?[u.makeNumeric(s)]:u.isAlphanumeric(s)?[u.makeAlphanumeric(s)]:[u.makeBytes(u.toUtf8ByteArray(s))]}static makeEci(s){const o=[];if(s<0)throw"ECI assignment value out of range";if(s<128)e(s,8,o);else if(s<16384)e(2,2,o),e(s,14,o);else if(s<1e6)e(6,3,o),e(s,21,o);else throw"ECI assignment value out of range";return new u(u.Mode.ECI,0,o)}static isNumeric(s){return u.NUMERIC_REGEX.test(s)}static isAlphanumeric(s){return u.ALPHANUMERIC_REGEX.test(s)}getData(){return this.bitData.slice()}static getTotalBits(s,o){let a=0;for(const f of s){const c=f.mode.numCharCountBits(o);if(f.numChars>=1<<c)return 1/0;a+=4+c+f.bitData.length}return a}static toUtf8ByteArray(s){s=encodeURI(s);const o=[];for(let a=0;a<s.length;a++)s.charAt(a)!="%"?o.push(s.charCodeAt(a)):(o.push(parseInt(s.substr(a+1,2),16)),a+=2);return o}};u.NUMERIC_REGEX=/^[0-9]*$/,u.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,u.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let h=u;i.QrSegment=h})(X||(X={})),(i=>{(t=>{const n=class n{constructor(h,l){this.ordinal=h,this.formatBits=l}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2);let e=n;t.Ecc=e})(i.QrCode||(i.QrCode={}))})(X||(X={})),(i=>{(t=>{const n=class n{constructor(h,l){this.modeBits=h,this.numBitsCharCount=l}numCharCountBits(h){return this.numBitsCharCount[Math.floor((h+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]);let e=n;t.Mode=e})(i.QrSegment||(i.QrSegment={}))})(X||(X={}));function Te(i){var h,l,u,S,s,o,a;const t=A(i);mt(t);const e=(h=t.amount)==null?void 0:h.toFixed(2),n=ht(t.reference);return["SPC","0200","1",(l=t.creditor.account)!=null?l:"",...t.creditor.buildingNumber?["S",t.creditor.name,t.creditor.address,`${t.creditor.buildingNumber}`,`${t.creditor.zip}`,t.creditor.city]:["K",t.creditor.name,t.creditor.address,`${t.creditor.zip} ${t.creditor.city}`,"",""],t.creditor.country,"","","","","","","",e!=null?e:"",t.currency,...t.debtor?[...t.debtor.buildingNumber?["S",t.debtor.name,t.debtor.address,`${t.debtor.buildingNumber}`,`${t.debtor.zip}`,t.debtor.city]:["K",t.debtor.name,t.debtor.address,`${t.debtor.zip} ${t.debtor.city}`,"",""],(S=(u=t.debtor)==null?void 0:u.country)!=null?S:""]:["","","","","","",""],n,(s=t.reference)!=null?s:"",(o=t.message)!=null?o:"","EPD",(a=t.additionalInformation)!=null?a:"",...t.av1?[t.av1]:[],...t.av2?[t.av2]:[]].join(`
`)}function Ft(i,t,e){const n=Te(i),r=X.QrSegment.makeEci(26),h=X.QrSegment.makeSegments(n),l=X.QrCode.encodeSegments([r,...h],X.QrCode.Ecc.MEDIUM,10,25),u=t/l.size;for(let S=0;S<l.size;S++){const s=S*u;for(let o=0;o<l.size;o++){const a=o*u;l.getModule(S,o)&&e(s,a,u)}}}function Gt(i,t){const e=i/y(46),n=y(7)*e,r=y(6)*e,h=y(1.17)*e,l=y(3.89)*e;t(i/2-n/2,i/2-n/2,n,n,"white"),t(i/2-r/2,i/2-r/2,r,r,"black"),t(i/2-l/2,i/2-h/2,l,h,"white"),t(i/2-h/2,i/2-l/2,h,l,"white")}let kt=class{constructor(t,e=46){this.size=y(e),this.data=A(t),mt(this.data)}attachTo(t,e=(r=>(r=t.x)!=null?r:0)(),n=(h=>(h=t.y)!=null?h:0)()){t.save(),t.translate(e,n),Ft(this.data,this.size,(l,u,S)=>{t.rect(l,u,S,S)}),t.fillColor("black"),t.fill(),Gt(this.size,(l,u,S,s,o)=>{t.rect(l,u,S,s).fillColor(o).fill()}),t.restore()}};var Yt=(i=>(i[i.HeightCalculation=0]="HeightCalculation",i[i.PageInjection=1]="PageInjection",i[i.BackgroundColor=2]="BackgroundColor",i[i.Borders=3]="Borders",i[i.Text=4]="Text",i))(Yt||{});class Re{constructor(t){this.data=t}getCurrentPage(t){const e=t.page;for(let n=t.bufferedPageRange().start;n<t.bufferedPageRange().count;n++)if(t.switchToPage(n),t.page===e)return n;return t.bufferedPageRange().count}attachTo(t,e=(r=>(r=t.x)!=null?r:0)(),n=(h=>(h=t.y)!=null?h:0)()){var v,z,yt,ie,ne,se,re,oe,ae,he,le,fe,ce,ue,de,me;if(this.data.rows===void 0)throw new Error("No table rows provided.");t.page||t.addPage({size:"A4"}),t.options.bufferPages=!0;const l=e,u=n,S=this.getCurrentPage(t),s=this.data.width?this.data.width:t.page.width-l-t.page.margins.right,o=this.data.backgroundColor?this.data.backgroundColor:void 0,a=this.data.borderWidth?this.data.borderWidth:void 0,f=this.data.borderColor?this.data.borderColor:"#000000",c=this.data.padding?this.data.padding:0,g=this.data.fontSize?this.data.fontSize:11,d=this.data.textColor?this.data.textColor:"#000000",I=this.data.fontName?this.data.fontName:"Helvetica",_=this.data.align?this.data.align:void 0,M=this.data.verticalAlign?this.data.verticalAlign:"top",L=this.data.rows.findIndex(K=>!!K.header),N=[];for(let K=0;K<Object.values(Yt).length/2;K++){t.switchToPage(S);let E=u;t:for(let x=0;x<this.data.rows.length;x++){const R=this.data.rows[x],G=N[x],bt=R.minHeight,Ct=R.maxHeight,Fe=R.padding?R.padding:c,Ge=R.backgroundColor?R.backgroundColor:o,ke=R.borderWidth?R.borderWidth:a,Ye=R.borderColor?R.borderColor:f,He=R.fontSize?R.fontSize:g,Ue=R.fontName?R.fontName:I,We=R.textColor?R.textColor:d,Ve=R.align?R.align:_,Qe=R.verticalAlign?R.verticalAlign:M;t.moveTo(l,u);let O=l;e:for(let _t=0;_t<R.columns.length;_t++){const D=R.columns[_t],{remainingColumns:je,widthUsed:Ze}=R.columns.reduce((b,Z)=>(Z.width!==void 0&&(b.widthUsed+=Z.width,b.remainingColumns--),b),{remainingColumns:R.columns.length,widthUsed:0}),J=D.width?D.width:(s-Ze)/je,Xe=D.padding?D.padding:Fe,Tt=D.backgroundColor?D.backgroundColor:Ge,pe=D.borderWidth?D.borderWidth:ke,Rt=D.borderColor?D.borderColor:Ye,Ke=D.fontSize?D.fontSize:He,qe=D.fontName?D.fontName:Ue,Je=D.textColor?D.textColor:We,ti=D.align?D.align:Ve,Et=D.verticalAlign?D.verticalAlign:Qe,ei=Tt===void 0?0:1,ii=Rt===void 0?0:1,F=this._positionsToObject(Xe);t.moveTo(O+J,E);const Dt=ut(ct({},(v=D.textOptions)!=null?v:{}),{align:ti,baseline:"middle",height:G!==void 0?G-((z=F.top)!=null?z:0)-((yt=F.bottom)!=null?yt:0):void 0,lineBreak:!0,width:J-((ie=F.left)!=null?ie:0)-((ne=F.right)!=null?ne:0)});t.font(qe),t.fontSize(Ke);const Nt=t.heightOfString(`${D.text}`,Dt),ft=t.heightOfString("A",Dt);if(K===0){if((N[x]===void 0||N[x]<Nt+((se=F.top)!=null?se:0)+((re=F.bottom)!=null?re:0))&&(N[x]=Nt+((oe=F.top)!=null?oe:0)+((ae=F.bottom)!=null?ae:0),bt!==void 0&&N[x]<bt&&(N[x]=bt),Ct!==void 0&&N[x]>Ct&&(N[x]=Ct)),R.height!==void 0&&(N[x]=R.height),_t<R.columns.length-1)continue e;continue t}if(K===1&&E+G>=t.page.height-t.page.margins.bottom){t.addPage(),E=t.y;const b=this.data.rows[L];if(b!==void 0){this.data.rows.splice(x,0,b),N.splice(x,0,N[L]),x--;continue t}}if(K>1&&(R.header&&E!==((he=t.page.margins.top)!=null?he:0)&&x!==L||E+G>=t.page.height-t.page.margins.bottom)&&(t.switchToPage(this.getCurrentPage(t)+1),t.x=l,t.y=(le=t.page.margins.top)!=null?le:0,E=t.y),K===2&&Tt!==void 0&&t.rect(O,E,J,G).fillColor(Tt).fillOpacity(ei).fill(),K===4){let b=E;Et==="top"?b=E+((fe=F.top)!=null?fe:0)+ft/2:Et==="center"?b=E+G/2-Nt/2+ft/2:Et==="bottom"&&(b=E+G-((ce=F.bottom)!=null?ce:0)-Nt+ft/2),b<E+((ue=F.top)!=null?ue:0)+ft/2&&(b=E+((de=F.top)!=null?de:0)+ft/2),t.fillColor(Je).fillOpacity(1),t.text(`${D.text}`,O+((me=F.left)!=null?me:0),b,Dt)}if(K===3&&pe!==void 0&&Rt!==void 0){const b=this._positionsToObject(pe),Z=this._positionsToObject(Rt);if(t.undash().lineJoin("miter").lineCap("butt").strokeOpacity(ii),b.left&&Z.left){const et=b.bottom?b.bottom/2:0,it=b.top?b.top/2:0;t.moveTo(O,E+G+et),t.lineTo(O,E-it).strokeColor(Z.left).lineWidth(b.left).stroke()}if(b.right&&Z.right){const et=b.top?b.top/2:0,it=b.bottom?b.bottom/2:0;t.moveTo(O+J,E-et),t.lineTo(O+J,E+G+it).strokeColor(Z.right).lineWidth(b.right).stroke()}if(b.top&&Z.top){const et=b.left?b.left/2:0,it=b.right?b.right/2:0;t.moveTo(O-et,E),t.lineTo(O+J+it,E).strokeColor(Z.top).lineWidth(b.top).stroke()}if(b.bottom&&Z.bottom){const et=b.right?b.right/2:0,it=b.left?b.left/2:0;t.moveTo(O+J+et,E+G),t.lineTo(O-it,E+G).strokeColor(Z.bottom).lineWidth(b.bottom).stroke()}}O+=J}E+=G,t.x=O,t.y=E}}t.x=l}_positionsToObject(t){return typeof t=="number"||typeof t=="string"?{bottom:t,left:t,right:t,top:t}:{bottom:t[2]!==void 0?t[2]:t[0],left:t[3]!==void 0?t[3]:t[1],right:t[1]!==void 0?t[1]:void 0,top:t[0]}}}const Ee=Object.freeze(Object.defineProperty({__proto__:null,SwissQRBill:Ce,SwissQRCode:kt,Table:Re},Symbol.toStringTag,{value:"Module"}));function De(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function Ae(i){const t={};for(const e of Object.keys(i))t[i[e].name]=i[e];return t}class T{constructor(t,e){this.childInstances=[],this.element=De(t),this._parent=e}get parent(){return this._parent}get root(){let t=this._parent;for(;(t==null?void 0:t.parent)!==void 0;)t=t.parent;return t}appendInstance(t){return this.childInstances.push(t),this.element.appendChild(t.element),this}id(t){return typeof t=="string"?(this.element.id=t,this):this.element.id}get innerHTML(){return this.element.innerHTML}get outerHTML(){return this.element.outerHTML}empty(){return this.childInstances=[],this.element.innerHTML="",this}addClass(t){return typeof t=="string"?this.element.classList.add(t):Array.isArray(t)&&this.element.classList.add(...t),this}removeClass(t){return typeof t=="string"?this.element.classList.remove(t):Array.isArray(t)&&this.element.classList.remove(...t),this}hasClass(t){return this.element.classList.contains(t)}attr(t,e){var n;const r=Object.entries(Ae(this.element.attributes)).reduce((h,[l,u])=>Object.assign(Object.assign({},h),{[l]:isNaN(+u.value)?u.value:+u.value}),{});return typeof t=="undefined"?r:typeof t=="object"?Array.isArray(t)?Object.fromEntries(Object.entries(r).filter(([h,l])=>t.includes(h))):(Object.keys(t).forEach(h=>{this.element.setAttribute(h,t[h]+"")}),this):typeof t=="string"?typeof e=="undefined"?(n=r[t])!==null&&n!==void 0?n:null:(this.element.setAttribute(t,e+""),this):null}removeAttr(t){return this.element.removeAttribute(t),this}}function k(i,t){t.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(n=>{Object.defineProperty(i.prototype,n,Object.getOwnPropertyDescriptor(e.prototype,n)||Object.create(null))})})}class Y extends T{color(t){if(typeof t=="undefined"){const e=this.attr("color");return typeof e=="string"?e:null}else if(typeof t=="string")return this.attr("color",t),this;return null}}class H extends T{display(t){if(typeof t=="undefined"){const e=this.attr("display");return typeof e=="string"?e:null}else if(typeof t=="string")return this.attr("display",t),this;return null}}class U extends T{fill(t){if(typeof t=="undefined"){const e=this.attr("fill");return typeof e=="string"?e:null}else if(typeof t=="string")return this.attr("fill",t),this;return null}fillOpacity(t){if(typeof t=="undefined"){const e=this.attr("fill-opacity");return typeof e=="number"?e:null}else if(typeof t=="number")return this.attr("fill-opacity",t),this;return null}fillRule(t){if(typeof t=="undefined"){const e=this.attr("fill-rule");return typeof e=="string"?e:null}else if(typeof t=="string")return this.attr("fill-rule",t),this;return null}fillLinearGradient(t,e){var n,r,h;const l=(r=(n=this.root)===null||n===void 0?void 0:n.childInstances.find(s=>s.element.tagName==="defs"))!==null&&r!==void 0?r:(h=this.root)===null||h===void 0?void 0:h.addDefs(),u=l==null?void 0:l.addLinearGradient(),S=l.element.childNodes.length;u.attr("id","gradient-"+S),typeof e=="number"&&u.attr("gradientTransform","rotate("+e+")");for(const s of t)u.addStop(s.position,s.color);return this.attr("fill","url(#gradient-"+S+")"),this}}class W extends T{opacity(t){if(typeof t=="undefined"){const e=this.attr("opacity");return typeof e=="number"?e:null}else if(typeof t=="number")return this.attr("opacity",t),this;return null}}class V extends T{stroke(t=1,e="solid",n="currentColor"){return this.strokeWidth(t),this.strokeColor(n),e==="dashed"&&this.strokeDasharray(3),this}strokeColor(t){if(typeof t=="undefined"){const e=this.attr("stroke");return typeof e=="string"?e:null}else if(typeof t=="string")return this.attr("stroke",t),this;return null}strokeLinearGradient(t,e){var n,r,h;const l=(r=(n=this.root)===null||n===void 0?void 0:n.childInstances.find(s=>s.element.tagName==="defs"))!==null&&r!==void 0?r:(h=this.root)===null||h===void 0?void 0:h.addDefs(),u=l==null?void 0:l.addLinearGradient(),S=l.element.childNodes.length;u.attr("id","gradient-"+S),typeof e=="number"&&u.attr("gradientTransform","rotate("+e+")");for(const s of t)u.addStop(s.position,s.color);return this.attr("stroke","url(#gradient-"+S+")"),this}dash(t=3,e="currentColor"){return this.strokeDasharray(t),this.strokeColor(e),this}strokeDasharray(t,e){if(typeof t=="undefined"){const n=this.attr("stroke-dasharray");if(typeof n=="number")return n;if(typeof n=="string"){const r=n.split(" ");return r.length===1?isNaN(+r[0])?r[0]:+r[0]:r.map(h=>isNaN(+h)?h:+h)}}else{if(typeof t=="string"||typeof t=="number")return this.attr("stroke-dasharray",t),this;if(Array.isArray(t))return this.attr("stroke-dasharray",t.join(" ")),this}return null}strokeDashoffset(t){return typeof t=="string"||typeof t=="number"?(this.attr("stroke-dashoffset",t),this):this.attr("stroke-dashoffset")}strokeLinecap(t){if(typeof t=="undefined"){const e=this.attr("stroke-linecap");return typeof e=="string"?e:null}else if(typeof t=="string")return this.attr("stroke-linecap",t),this;return null}strokeLinejoin(t){if(typeof t=="undefined"){const e=this.attr("stroke-linejoin");return typeof e=="string"?e:null}else if(typeof t=="string")return this.attr("stroke-linejoin",t),this;return null}strokeMiterlimit(t){if(typeof t=="undefined"){const e=this.attr("stroke-miterlimit");return typeof e=="number"?e:null}else if(typeof t=="number")return this.attr("stroke-miterlimit",t),this;return null}strokeOpacity(t){return typeof t=="string"||typeof t=="number"?(this.attr("stroke-opacity",t),this):this.attr("stroke-opacity")}strokeWidth(t){return typeof t=="string"||typeof t=="number"?(this.attr("stroke-width",t),this):this.attr("stroke-width")}}class Q extends T{vectorEffect(t){if(typeof t=="undefined"){const e=this.attr("vector-effect");return typeof e=="string"?e:null}else if(typeof t=="string")return this.attr("vector-effect",t),this;return null}}class j extends T{visibility(t){if(typeof t=="undefined"){const e=this.attr("visibility");return typeof e=="string"?e:null}else if(typeof t=="string")return this.attr("visibility",t),this;return null}}class pt extends T{moveTo(t,e){return this.attr("x",t),this.attr("y",e),this}moveBy(t,e){var n,r;const h=(n=this.attr("x"))!==null&&n!==void 0?n:0+t,l=(r=this.attr("y"))!==null&&r!==void 0?r:0+e;return this.moveTo(h,l)}x(t){return typeof t=="string"||typeof t=="number"?(this.attr("x",t),this):this.attr("x")}y(t){return typeof t=="string"||typeof t=="number"?(this.attr("y",t),this):this.attr("y")}}class gt extends T{width(t){return typeof t=="string"||typeof t=="number"?(this.attr("width",t+""),this):this.attr("width")}height(t){return typeof t=="string"||typeof t=="number"?(this.attr("height",t+""),this):this.attr("height")}}class Ht extends T{constructor(t){super("rect",t)}borderRadius(t){return typeof t=="string"||typeof t=="number"?(this.attr("rx",t),this.attr("ry",t),this):this.attr("rx")}}k(Ht,[Y,H,U,W,V,Q,j,pt,gt]);class we extends T{cx(t){return typeof t=="string"||typeof t=="number"?(this.attr("cx",t),this):this.attr("cx")}cy(t){return typeof t=="string"||typeof t=="number"?(this.attr("cy",t),this):this.attr("cy")}}class Ut extends T{constructor(t){super("circle",t)}radius(t){return typeof t=="string"||typeof t=="number"?(this.attr("r",t),this):this.attr("r")}}k(Ut,[Y,H,U,W,V,Q,j,we]);class Wt extends T{constructor(t){super("line",t)}x1(t){return typeof t=="string"||typeof t=="number"?(this.attr("x1",t),this):this.attr("x1")}y1(t){return typeof t=="string"||typeof t=="number"?(this.attr("y1",t),this):this.attr("y1")}x