@e-invoice-eu/core
Version:
Generate e-invoices (E-Rechnung in German) conforming to EN16931 (Factur-X/ZUGFeRD, UBL, CII, XRechnung aka X-Rechnung) from LibreOffice Calc/Excel data or JSON.
1 lines • 1.6 MB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).eInvoiceEU={})}(this,function(e){"use strict";class t{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+t.version}static addUnaryOp(e){return t.max_unop_len=Math.max(e.length,t.max_unop_len),t.unary_ops[e]=1,t}static addBinaryOp(e,r,n){return t.max_binop_len=Math.max(e.length,t.max_binop_len),t.binary_ops[e]=r,n?t.right_associative.add(e):t.right_associative.delete(e),t}static addIdentifierChar(e){return t.additional_identifier_chars.add(e),t}static addLiteral(e,r){return t.literals[e]=r,t}static removeUnaryOp(e){return delete t.unary_ops[e],e.length===t.max_unop_len&&(t.max_unop_len=t.getMaxKeyLen(t.unary_ops)),t}static removeAllUnaryOps(){return t.unary_ops={},t.max_unop_len=0,t}static removeIdentifierChar(e){return t.additional_identifier_chars.delete(e),t}static removeBinaryOp(e){return delete t.binary_ops[e],e.length===t.max_binop_len&&(t.max_binop_len=t.getMaxKeyLen(t.binary_ops)),t.right_associative.delete(e),t}static removeAllBinaryOps(){return t.binary_ops={},t.max_binop_len=0,t}static removeLiteral(e){return delete t.literals[e],t}static removeAllLiterals(){return t.literals={},t}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new t(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return t.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!t.binary_ops[String.fromCharCode(e)]||t.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return t.isIdentifierStart(e)||t.isDecimalDigit(e)}throwError(e){const t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,r){if(t.hooks[e]){const n={context:this,node:r};return t.hooks.run(e,n),n.node}return r}searchHook(e){if(t.hooks[e]){const r={context:this};return t.hooks[e].find(function(e){return e.call(r.context,r),r.node}),r.node}}gobbleSpaces(){let e=this.code;for(;e===t.SPACE_CODE||e===t.TAB_CODE||e===t.LF_CODE||e===t.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const e=this.gobbleExpressions(),r=1===e.length?e[0]:{type:t.COMPOUND,body:e};return this.runHook("after-all",r)}gobbleExpressions(e){let r,n,i=[];for(;this.index<this.expr.length;)if(r=this.code,r===t.SEMCOL_CODE||r===t.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())i.push(n);else if(this.index<this.expr.length){if(r===e)break;this.throwError('Unexpected "'+this.char+'"')}return i}gobbleExpression(){const e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,t.max_binop_len),r=e.length;for(;r>0;){if(t.binary_ops.hasOwnProperty(e)&&(!t.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!t.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=r,e;e=e.substr(0,--r)}return!1}gobbleBinaryExpression(){let e,r,n,i,a,s,o,c,l;if(s=this.gobbleToken(),!s)return s;if(r=this.gobbleBinaryOp(),!r)return s;for(a={value:r,prec:t.binaryPrecedence(r),right_a:t.right_associative.has(r)},o=this.gobbleToken(),o||this.throwError("Expected expression after "+r),i=[s,a,o];r=this.gobbleBinaryOp();){if(n=t.binaryPrecedence(r),0===n){this.index-=r.length;break}a={value:r,prec:n,right_a:t.right_associative.has(r)},l=r;const c=e=>a.right_a&&e.right_a?n>e.prec:n<=e.prec;for(;i.length>2&&c(i[i.length-2]);)o=i.pop(),r=i.pop().value,s=i.pop(),e={type:t.BINARY_EXP,operator:r,left:s,right:o},i.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+l),i.push(a,e)}for(c=i.length-1,e=i[c];c>1;)e={type:t.BINARY_EXP,operator:i[c-1].value,left:i[c-2],right:e},c-=2;return e}gobbleToken(){let e,r,n,i;if(this.gobbleSpaces(),i=this.searchHook("gobble-token"),i)return this.runHook("after-token",i);if(e=this.code,t.isDecimalDigit(e)||e===t.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===t.SQUOTE_CODE||e===t.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(e===t.OBRACK_CODE)i=this.gobbleArray();else{for(r=this.expr.substr(this.index,t.max_unop_len),n=r.length;n>0;){if(t.unary_ops.hasOwnProperty(r)&&(!t.isIdentifierStart(this.code)||this.index+r.length<this.expr.length&&!t.isIdentifierPart(this.expr.charCodeAt(this.index+r.length)))){this.index+=n;const e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:t.UNARY_EXP,operator:r,argument:e,prefix:!0})}r=r.substr(0,--n)}t.isIdentifierStart(e)?(i=this.gobbleIdentifier(),t.literals.hasOwnProperty(i.name)?i={type:t.LITERAL,value:t.literals[i.name],raw:i.name}:i.name===t.this_str&&(i={type:t.THIS_EXP})):e===t.OPAREN_CODE&&(i=this.gobbleGroup())}return i?(i=this.gobbleTokenProperty(i),this.runHook("after-token",i)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let r=this.code;for(;r===t.PERIOD_CODE||r===t.OBRACK_CODE||r===t.OPAREN_CODE||r===t.QUMARK_CODE;){let n;if(r===t.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==t.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),r=this.code}this.index++,r===t.OBRACK_CODE?((e={type:t.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),r=this.code,r!==t.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):r===t.OPAREN_CODE?e={type:t.CALL_EXP,arguments:this.gobbleArguments(t.CPAREN_CODE),callee:e}:(r===t.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),e={type:t.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),n&&(e.optional=!0),this.gobbleSpaces(),r=this.code}return e}gobbleNumericLiteral(){let e,r,n="";for(;t.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(this.code===t.PERIOD_CODE)for(n+=this.expr.charAt(this.index++);t.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(e=this.char,"e"===e||"E"===e){for(n+=this.expr.charAt(this.index++),e=this.char,"+"!==e&&"-"!==e||(n+=this.expr.charAt(this.index++));t.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);t.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")")}return r=this.code,t.isIdentifierStart(r)?this.throwError("Variable names cannot start with a number ("+n+this.char+")"):(r===t.PERIOD_CODE||1===n.length&&n.charCodeAt(0)===t.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:t.LITERAL,value:parseFloat(n),raw:n}}gobbleStringLiteral(){let e="";const r=this.index,n=this.expr.charAt(this.index++);let i=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===n){i=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++),t){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return i||this.throwError('Unclosed quote after "'+e+'"'),{type:t.LITERAL,value:e,raw:this.expr.substring(r,this.index)}}gobbleIdentifier(){let e=this.code,r=this.index;for(t.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,t.isIdentifierPart(e));)this.index++;return{type:t.IDENTIFIER,name:this.expr.slice(r,this.index)}}gobbleArguments(e){const r=[];let n=!1,i=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let a=this.code;if(a===e){n=!0,this.index++,e===t.CPAREN_CODE&&i&&i>=r.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(a===t.COMMA_CODE){if(this.index++,i++,i!==r.length)if(e===t.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===t.CBRACK_CODE)for(let e=r.length;e<i;e++)r.push(null)}else if(r.length!==i&&0!==i)this.throwError("Expected comma");else{const e=this.gobbleExpression();e&&e.type!==t.COMPOUND||this.throwError("Expected comma"),r.push(e)}}return n||this.throwError("Expected "+String.fromCharCode(e)),r}gobbleGroup(){this.index++;let e=this.gobbleExpressions(t.CPAREN_CODE);if(this.code===t.CPAREN_CODE)return this.index++,1===e.length?e[0]:!!e.length&&{type:t.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:t.ARRAY_EXP,elements:this.gobbleArguments(t.CBRACK_CODE)}}}const r=new class{add(e,t,r){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}};Object.assign(t,{hooks:r,plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw new Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}}(t),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),t.max_unop_len=t.getMaxKeyLen(t.unary_ops),t.max_binop_len=t.getMaxKeyLen(t.binary_ops);const n=e=>new t(e).parse(),i=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(t).filter(e=>!i.includes(e)&&void 0===n[e]).forEach(e=>{n[e]=t[e]}),n.Jsep=t;var a={name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;const r=t.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:n,alternate:i},r.operator&&e.binary_ops[r.operator]<=.9){let n=r;for(;n.right.operator&&e.binary_ops[n.right.operator]<=.9;)n=n.right;t.node.test=n.right,n.right=t.node,t.node=r}}else this.throwError("Expected :")}})}};n.plugins.register(a);var s={name:"regex",init(e){e.hooks.add("gobble-token",function(t){if(47===this.code){const r=++this.index;let n=!1;for(;this.index<this.expr.length;){if(47===this.code&&!n){const n=this.expr.slice(r,this.index);let i,a="";for(;++this.index<this.expr.length;){const e=this.code;if(!(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57))break;a+=this.char}try{i=new RegExp(n,a)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:i,raw:this.expr.slice(r-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}};const o={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[43,45],assignmentPrecedence:.9,init(e){const t=[e.IDENTIFIER,e.MEMBER_EXP];function r(e){o.assignmentOperators.has(e.operator)?(e.type="AssignmentExpression",r(e.left),r(e.right)):e.operator||Object.values(e).forEach(e=>{e&&"object"==typeof e&&r(e)})}o.assignmentOperators.forEach(t=>e.addBinaryOp(t,o.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(e){const r=this.code;o.updateOperators.some(e=>e===r&&e===this.expr.charCodeAt(this.index+1))&&(this.index+=2,e.node={type:"UpdateExpression",operator:43===r?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},e.node.argument&&t.includes(e.node.argument.type)||this.throwError(`Unexpected ${e.node.operator}`))}),e.hooks.add("after-token",function(e){if(e.node){const r=this.code;o.updateOperators.some(e=>e===r&&e===this.expr.charCodeAt(this.index+1))&&(t.includes(e.node.type)||this.throwError(`Unexpected ${e.node.operator}`),this.index+=2,e.node={type:"UpdateExpression",operator:43===r?"++":"--",argument:e.node,prefix:!1})}}),e.hooks.add("after-expression",function(e){e.node&&r(e.node)})}};n.plugins.register(s,o),n.addUnaryOp("typeof"),n.addUnaryOp("void"),n.addLiteral("null",null),n.addLiteral("undefined",void 0);const c=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"]),l={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return l.evalBinaryExpression(e,t);case"Compound":return l.evalCompound(e,t);case"ConditionalExpression":return l.evalConditionalExpression(e,t);case"Identifier":return l.evalIdentifier(e,t);case"Literal":return l.evalLiteral(e,t);case"MemberExpression":return l.evalMemberExpression(e,t);case"UnaryExpression":return l.evalUnaryExpression(e,t);case"ArrayExpression":return l.evalArrayExpression(e,t);case"CallExpression":return l.evalCallExpression(e,t);case"AssignmentExpression":return l.evalAssignmentExpression(e,t);default:throw SyntaxError("Unexpected expression",e)}},evalBinaryExpression:(e,t)=>({"||":(e,t)=>e||t(),"&&":(e,t)=>e&&t(),"|":(e,t)=>e|t(),"^":(e,t)=>e^t(),"&":(e,t)=>e&t(),"==":(e,t)=>e==t(),"!=":(e,t)=>e!=t(),"===":(e,t)=>e===t(),"!==":(e,t)=>e!==t(),"<":(e,t)=>e<t(),">":(e,t)=>e>t(),"<=":(e,t)=>e<=t(),">=":(e,t)=>e>=t(),"<<":(e,t)=>e<<t(),">>":(e,t)=>e>>t(),">>>":(e,t)=>e>>>t(),"+":(e,t)=>e+t(),"-":(e,t)=>e-t(),"*":(e,t)=>e*t(),"/":(e,t)=>e/t(),"%":(e,t)=>e%t()}[e.operator](l.evalAst(e.left,t),()=>l.evalAst(e.right,t))),evalCompound(e,t){let r;for(let n=0;n<e.body.length;n++){"Identifier"===e.body[n].type&&["var","let","const"].includes(e.body[n].name)&&e.body[n+1]&&"AssignmentExpression"===e.body[n+1].type&&(n+=1);const i=e.body[n];r=l.evalAst(i,t)}return r},evalConditionalExpression:(e,t)=>l.evalAst(e.test,t)?l.evalAst(e.consequent,t):l.evalAst(e.alternate,t),evalIdentifier(e,t){if(Object.hasOwn(t,e.name))return t[e.name];throw ReferenceError(`${e.name} is not defined`)},evalLiteral:e=>e.value,evalMemberExpression(e,t){const r=String(e.computed?l.evalAst(e.property):e.property.name),n=l.evalAst(e.object,t);if(null==n)throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);if(!Object.hasOwn(n,r)&&c.has(r))throw TypeError(`Cannot read properties of ${n} (reading '${r}')`);const i=n[r];return"function"==typeof i?i.bind(n):i},evalUnaryExpression:(e,t)=>({"-":e=>-l.evalAst(e,t),"!":e=>!l.evalAst(e,t),"~":e=>~l.evalAst(e,t),"+":e=>+l.evalAst(e,t),typeof:e=>typeof l.evalAst(e,t),void:e=>{l.evalAst(e,t)}}[e.operator](e.argument)),evalArrayExpression:(e,t)=>e.elements.map(e=>l.evalAst(e,t)),evalCallExpression(e,t){const r=e.arguments.map(e=>l.evalAst(e,t)),n=l.evalAst(e.callee,t);if(n===Function)throw new Error("Function constructor is disabled");return n(...r)},evalAssignmentExpression(e,t){if("Identifier"!==e.left.type)throw SyntaxError("Invalid left-hand side in assignment");const r=e.left.name,n=l.evalAst(e.right,t);return t[r]=n,t[r]}};function u(e,t){return(e=e.slice()).push(t),e}function d(e,t){return(t=t.slice()).unshift(e),t}class h extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}}function f(e,t,r,n,i){if(!(this instanceof f))try{return new f(e,t,r,n,i)}catch(e){if(!e.avoidNew)throw e;return e.value}"string"==typeof e&&(i=n,n=r,r=t,t=e,e=null);const a=e&&"object"==typeof e;if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=!Object.hasOwn(e,"wrap")||e.wrap,this.sandbox=e.sandbox||{},this.eval=void 0===e.eval?"safe":e.eval,this.ignoreEvalErrors=void 0!==e.ignoreEvalErrors&&e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||n||null,this.otherTypeCallback=e.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},!1!==e.autostart){const n={path:a?e.path:t};a?"json"in e&&(n.json=e.json):n.json=r;const i=this.evaluate(n);if(!i||"object"!=typeof i)throw new h(i);return i}}f.prototype.evaluate=function(e,t,r,n){let i=this.parent,a=this.parentProperty,{flatten:s,wrap:o}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,t=t||this.json,(e=e||this.path)&&"object"==typeof e&&!Array.isArray(e)){if(!e.path&&""!==e.path)throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),s=Object.hasOwn(e,"flatten")?e.flatten:s,this.currResultType=Object.hasOwn(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,"sandbox")?e.sandbox:this.currSandbox,o=Object.hasOwn(e,"wrap")?e.wrap:o,this.currEval=Object.hasOwn(e,"eval")?e.eval:this.currEval,r=Object.hasOwn(e,"callback")?e.callback:r,this.currOtherTypeCallback=Object.hasOwn(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,i=Object.hasOwn(e,"parent")?e.parent:i,a=Object.hasOwn(e,"parentProperty")?e.parentProperty:a,e=e.path}if(i=i||null,a=a||null,Array.isArray(e)&&(e=f.toPathString(e)),!e&&""!==e||!t)return;const c=f.toPathArray(e);"$"===c[0]&&c.length>1&&c.shift(),this._hasParentSelector=null;const l=this._trace(c,t,["$"],i,a,r).filter(function(e){return e&&!e.isParentSelector});return l.length?o||1!==l.length||l[0].hasArrExpr?l.reduce((e,t)=>{const r=this._getPreferredOutput(t);return s&&Array.isArray(r)?e=e.concat(r):e.push(r),e},[]):this._getPreferredOutput(l[0]):o?[]:void 0},f.prototype._getPreferredOutput=function(e){const t=this.currResultType;switch(t){case"all":{const t=Array.isArray(e.path)?e.path:f.toPathArray(e.path);return e.pointer=f.toPointer(t),e.path="string"==typeof e.path?e.path:f.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return f.toPathString(e[t]);case"pointer":return f.toPointer(e.path);default:throw new TypeError("Unknown result type")}},f.prototype._handleCallback=function(e,t,r){if(t){const n=this._getPreferredOutput(e);e.path="string"==typeof e.path?e.path:f.toPathString(e.path),t(n,r,e)}},f.prototype._trace=function(e,t,r,n,i,a,s,o){let c;if(!e.length)return c={path:r,value:t,parent:n,parentProperty:i,hasArrExpr:s},this._handleCallback(c,a,"value"),c;const l=e[0],h=e.slice(1),f=[];function p(e){Array.isArray(e)?e.forEach(e=>{f.push(e)}):f.push(e)}if(("string"!=typeof l||o)&&t&&Object.hasOwn(t,l))p(this._trace(h,t[l],u(r,l),t,l,a,s));else if("*"===l)this._walk(t,e=>{p(this._trace(h,t[e],u(r,e),t,e,a,!0,!0))});else if(".."===l)p(this._trace(h,t,r,n,i,a,s)),this._walk(t,n=>{"object"==typeof t[n]&&p(this._trace(e.slice(),t[n],u(r,n),t,n,a,!0))});else{if("^"===l)return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:h,isParentSelector:!0};if("~"===l)return c={path:u(r,l),value:i,parent:n,parentProperty:null},this._handleCallback(c,a,"property"),c;if("$"===l)p(this._trace(h,t,r,null,null,a,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(l))p(this._slice(l,h,t,r,n,i,a));else if(0===l.indexOf("?(")){if(!1===this.currEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const e=l.replace(/^\?\((.*?)\)$/u,"$1"),s=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(e);s?this._walk(t,e=>{const o=[s[2]],c=s[1]?t[e][s[1]]:t[e];this._trace(o,c,r,n,i,a,!0).length>0&&p(this._trace(h,t[e],u(r,e),t,e,a,!0))}):this._walk(t,s=>{this._eval(e,t[s],s,r,n,i)&&p(this._trace(h,t[s],u(r,s),t,s,a,!0))})}else if("("===l[0]){if(!1===this.currEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");p(this._trace(d(this._eval(l,t,r.at(-1),r.slice(0,-1),n,i),h),t,r,n,i,a,s))}else if("@"===l[0]){let e=!1;const s=l.slice(1,-2);switch(s){case"scalar":t&&["object","function"].includes(typeof t)||(e=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===s&&(e=!0);break;case"integer":!Number.isFinite(t)||t%1||(e=!0);break;case"number":Number.isFinite(t)&&(e=!0);break;case"nonFinite":"number"!=typeof t||Number.isFinite(t)||(e=!0);break;case"object":t&&typeof t===s&&(e=!0);break;case"array":Array.isArray(t)&&(e=!0);break;case"other":e=this.currOtherTypeCallback(t,r,n,i);break;case"null":null===t&&(e=!0);break;default:throw new TypeError("Unknown value type "+s)}if(e)return c={path:r,value:t,parent:n,parentProperty:i},this._handleCallback(c,a,"value"),c}else if("`"===l[0]&&t&&Object.hasOwn(t,l.slice(1))){const e=l.slice(1);p(this._trace(h,t[e],u(r,e),t,e,a,s,!0))}else if(l.includes(",")){const e=l.split(",");for(const s of e)p(this._trace(d(s,h),t,r,n,i,a,!0))}else!o&&t&&Object.hasOwn(t,l)&&p(this._trace(h,t[l],u(r,l),t,l,a,s,!0))}if(this._hasParentSelector)for(let e=0;e<f.length;e++){const r=f[e];if(r&&r.isParentSelector){const o=this._trace(r.expr,t,r.path,n,i,a,s);if(Array.isArray(o)){f[e]=o[0];const t=o.length;for(let r=1;r<t;r++)e++,f.splice(e,0,o[r])}else f[e]=o}}return f},f.prototype._walk=function(e,t){if(Array.isArray(e)){const r=e.length;for(let e=0;e<r;e++)t(e)}else e&&"object"==typeof e&&Object.keys(e).forEach(e=>{t(e)})},f.prototype._slice=function(e,t,r,n,i,a,s){if(!Array.isArray(r))return;const o=r.length,c=e.split(":"),l=c[2]&&Number.parseInt(c[2])||1;let u=c[0]&&Number.parseInt(c[0])||0,h=c[1]&&Number.parseInt(c[1])||o;u=u<0?Math.max(0,u+o):Math.min(o,u),h=h<0?Math.max(0,h+o):Math.min(o,h);const f=[];for(let e=u;e<h;e+=l){this._trace(d(e,t),r,n,i,a,s,!0).forEach(e=>{f.push(e)})}return f},f.prototype._eval=function(e,t,r,n,i,a){this.currSandbox._$_parentProperty=a,this.currSandbox._$_parent=i,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;const s=e.includes("@path");s&&(this.currSandbox._$_path=f.toPathString(n.concat([r])));const o=this.currEval+"Script:"+e;if(!f.cache[o]){let t=e.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(s&&(t=t.replaceAll("@path","_$_path")),"safe"===this.currEval||!0===this.currEval||void 0===this.currEval)f.cache[o]=new this.safeVm.Script(t);else if("native"===this.currEval)f.cache[o]=new this.vm.Script(t);else if("function"==typeof this.currEval&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const e=this.currEval;f.cache[o]=new e(t)}else{if("function"!=typeof this.currEval)throw new TypeError(`Unknown "eval" property "${this.currEval}"`);f.cache[o]={runInNewContext:e=>this.currEval(t,e)}}}try{return f.cache[o].runInNewContext(this.currSandbox)}catch(t){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+t.message+": "+e)}},f.cache={},f.toPathString=function(e){const t=e,r=t.length;let n="$";for(let e=1;e<r;e++)/^(~|\^|@.*?\(\))$/u.test(t[e])||(n+=/^[0-9*]+$/u.test(t[e])?"["+t[e]+"]":"['"+t[e]+"']");return n},f.toPointer=function(e){const t=e,r=t.length;let n="";for(let e=1;e<r;e++)/^(~|\^|@.*?\(\))$/u.test(t[e])||(n+="/"+t[e].toString().replaceAll("~","~0").replaceAll("/","~1"));return n},f.toPathArray=function(e){const{cache:t}=f;if(t[e])return t[e].concat();const r=[],n=e.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(e,t){return"[#"+(r.push(t)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(e,t){return"['"+t.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(e,t){return";"+t.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(e){const t=e.match(/#(\d+)/u);return t&&t[1]?r[t[1]]:e});return t[e]=n,t[e].concat()},f.prototype.safeVm={Script:class{constructor(e){this.code=e,this.ast=n(this.code)}runInNewContext(e){const t=Object.assign(Object.create(null),e);return l.evalAst(this.ast,t)}}};f.prototype.vm={Script:class{constructor(e){this.code=e}runInNewContext(e){let t=this.code;const r=Object.keys(e),n=[];!function(e,t,r){const n=e.length;for(let i=0;i<n;i++)r(e[i])&&t.push(e.splice(i--,1)[0])}(r,n,t=>"function"==typeof e[t]);const i=r.map(t=>e[t]);t=n.reduce((t,r)=>{let n=e[r].toString();return/function/u.test(n)||(n="function "+n),"var "+r+"="+n+";"+t},"")+t,/(['"])use strict\1/u.test(t)||r.includes("arguments")||(t="var arguments = undefined;"+t),t=t.replace(/;\s*$/u,"");const a=t.lastIndexOf(";"),s=-1!==a?t.slice(0,a+1)+" return "+t.slice(a+1):" return "+t;return new Function(...r,s)(...i)}}};const p={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://www.cantanea.com/schemas/ubl-invoice-schema-v3.1.0",type:"object",additionalProperties:!1,properties:{"ubl:Invoice":{type:"object",additionalProperties:!1,properties:{"cbc:CustomizationID":{type:"string",title:"Specification identifier",description:"An identification of the specification containing the total set of rules regarding semantic content, cardinalities and business rules to which the data contained in the instance document conforms.\nBusiness terms: BT-24"},"cbc:ProfileID":{type:"string",title:"Business process type",description:"Identifies the business process context in which the transaction appears, to enable the Buyer to process the Invoice in an appropriate way.\nBusiness terms: BT-23"},"cbc:ID":{type:"string",title:"Invoice number",description:"A unique identification of the Invoice. The sequential number required in Article 226(2) of the directive 2006/112/EC [2], to uniquely identify the Invoice within the business context, time-frame, operating systems and records of the Seller. No identification scheme is to be used.\nBusiness terms: BT-1"},"cbc:IssueDate":{$ref:"#/$defs/dataTypes/Date",title:"Invoice issue date",description:'The date when the Invoice was issued. Format "YYYY-MM-DD"\nBusiness terms: BT-2'},"cbc:DueDate":{$ref:"#/$defs/dataTypes/Date",title:"Payment due date",description:'The date when the payment is due.Format "YYYY-MM-DD". In case the Amount due for payment (BT-115) is positive, either the Payment due date (BT-9) or the Payment terms (BT-20) shall be present.\nBusiness terms: BT-9'},"cbc:InvoiceTypeCode":{type:"string",title:"Invoice type code",description:"A code specifying the functional type of the Invoice.\nBusiness terms: BT-3",anyOf:[{$ref:"#/$defs/codeLists/UNCL1001-inv"},{$ref:"#/$defs/codeLists/UNCL1001-cn"}]},"cbc:Note":{type:"array",items:{type:"string",title:"Invoice note",description:"A textual note that gives unstructured information that is relevant to the Invoice as a whole.Such as the reason for any correction or assignment note in case the invoice has been factored. The element is not repeatable, except when both the Buyer and Seller are German, in which case the element can be repeated to meet specific legal requirements.\nBusiness terms: BT-22"}},"cbc:TaxPointDate":{$ref:"#/$defs/dataTypes/Date",title:"Value added tax point date",description:"The date when the VAT becomes accountable for the Seller and for the Buyer in so far as that date can be determined and differs from the date of issue of the invoice, according to the VAT directive.This element is required if the Value added tax point date is different from the Invoice issue date.\nBusiness terms: BT-7"},"cbc:DocumentCurrencyCode":{type:"string",$ref:"#/$defs/codeLists/ISO4217",title:"Invoice currency code",description:"The currency in which all Invoice amounts are given, except for the Total VAT amount in accounting currency. Only one currency shall be used in the Invoice, except for the VAT accounting currency code (BT-6) and the invoice total VAT amount in accounting currency (BT-111).\nBusiness terms: BT-5"},"cbc:TaxCurrencyCode":{type:"string",$ref:"#/$defs/codeLists/ISO4217",title:"VAT accounting currency code",description:"The currency used for VAT accounting and reporting purposes as accepted or required in the country of the Seller. Shall be used in combination with the Invoice total VAT amount in accounting currency (BT-111), when the VAT accounting currency code differs from the Invoice currency code.\nBusiness terms: BT-6"},"cbc:AccountingCost":{type:"string",title:"Buyer accounting reference",description:"A textual value that specifies where to book the relevant data into the Buyer's financial accounts.\nBusiness terms: BT-19"},"cbc:BuyerReference":{type:"string",title:"Buyer reference",description:"An identifier assigned by the Buyer used for internal routing purposes. An invoice must have buyer reference or purchase order reference (BT-13).\nBusiness terms: BT-10"},"cac:InvoicePeriod":{type:"object",additionalProperties:!1,title:"DELIVERY OR INVOICE PERIOD",description:"A group of business terms providing information on the invoice period. Also called delivery period. If the group is used, the invoiceing period start date and/or end date must be used.\nBusiness terms: BG-14",properties:{"cbc:StartDate":{$ref:"#/$defs/dataTypes/Date",title:"Invoicing period start date",description:'The date when the Invoice period starts. Format = "YYYY-MM-DD".\nBusiness terms: BT-73'},"cbc:EndDate":{$ref:"#/$defs/dataTypes/Date",title:"Invoicing period end date",description:'The date when the Invoice period ends. Format = "YYYY-MM-DD".\nBusiness terms: BT-74'},"cbc:DescriptionCode":{type:"string",$ref:"#/$defs/codeLists/UNCL2005",title:"Value added tax point date code",description:"The code of the date when the VAT becomes accountable for the Seller and for the Buyer.\nBusiness terms: BT-8"}}},"cac:OrderReference":{type:"object",additionalProperties:!1,title:"ORDER AND SALES ORDER REFERENCE",properties:{"cbc:ID":{type:"string",title:"Purchase order reference",description:'An identifier of a referenced purchase order, issued by the Buyer. An invoice must have buyer reference (BT-10) or purchase order reference. In cases where sales order reference is provided, but there\'s no purchase order reference, then use value "NA" as this element is mandatory in UBL.\nBusiness terms: BT-13'},"cbc:SalesOrderID":{type:"string",title:"Sales order reference",description:'An identifier of a referenced sales order, issued by the Seller. In cases where sales order reference is provided, but there\'s no purchase order reference, then set cac:OrderReference/cbc:ID to value "NA" as this element is mandatory in UBL.\nBusiness terms: BT-14'}}},"cac:BillingReference":{type:"array",items:{type:"object",additionalProperties:!1,title:"PRECEDING INVOICE REFERENCE",description:"A group of business terms providing information on one or more preceding Invoices.\nBusiness terms: BG-3",properties:{"cac:InvoiceDocumentReference":{type:"object",additionalProperties:!1,title:"INVOICE DOCUMENT REFERENCE",properties:{"cbc:ID":{type:"string",title:"Preceding Invoice number",description:"The identification of an Invoice that was previously sent by the Seller.\nBusiness terms: BT-25"},"cbc:IssueDate":{$ref:"#/$defs/dataTypes/Date",title:"Preceding Invoice issue date",description:'The date when the Preceding Invoice was issued.Shall be provided in case the Preceding Invoice identifier is not unique. Format = "YYYY-MM-DD".\nBusiness terms: BT-26'}},required:["cbc:ID"]}},required:["cac:InvoiceDocumentReference"]}},"cac:DespatchDocumentReference":{type:"object",additionalProperties:!1,title:"DESPATCH ADVICE REFERENCE",properties:{"cbc:ID":{type:"string",title:"Despatch advice reference",description:"An identifier of a referenced despatch advice.\nBusiness terms: BT-16"}},required:["cbc:ID"]},"cac:ReceiptDocumentReference":{type:"object",additionalProperties:!1,title:"RECEIPT ADVICE REFERENCE",properties:{"cbc:ID":{type:"string",title:"Receiving advice reference",description:"An identifier of a referenced receiving advice.\nBusiness terms: BT-15"}},required:["cbc:ID"]},"cac:OriginatorDocumentReference":{type:"object",additionalProperties:!1,title:"TENDER OR LOT REFERENCE",properties:{"cbc:ID":{type:"string",title:"Tender or lot reference",description:"The identification of the call for tender or lot the invoice relates to.\nBusiness terms: BT-17"}},required:["cbc:ID"]},"cac:ContractDocumentReference":{type:"object",additionalProperties:!1,title:"CONTRACT REFERENCE",properties:{"cbc:ID":{type:"string",title:"Contract reference",description:"The identification of a contract.\nBusiness terms: BT-12"}},required:["cbc:ID"]},"cac:AdditionalDocumentReference":{type:"array",items:{type:"object",additionalProperties:!1,title:"ADDITIONAL SUPPORTING DOCUMENTS",description:"A group of business terms providing information about additional supporting documents substantiating the claims made in the Invoice. The additional supporting documents can be used for both referencing a document number which is expected to be known by the receiver, an external document (referenced by a URL) or as an embedded document, Base64 encoded (such as a time report).\nBusiness terms: BG-24",properties:{"cbc:ID":{type:"string",title:"Invoiced object identifier, Supporting document reference",description:"An identifier for an object on which the invoice is based, given by the Seller, or the identifier for the supporting document.\nBusiness terms: BT-18, BT-122"},"cbc:ID@schemeID":{type:"string",$ref:"#/$defs/codeLists/UNCL1153",title:"Scheme identifier",description:"The identification scheme identifier of the Invoiced object identifier."},"cbc:DocumentTypeCode":{type:"string",title:"Document type code",description:'Code "130" MUST be used to indicate an invoice object reference. Not used for other additional documents\nBusiness terms: BT-18'},"cbc:DocumentDescription":{type:"string",title:"Supporting document description",description:"A description of the supporting document, such as: timesheet, usage report etc.\nBusiness terms: BT-123"},"cac:Attachment":{type:"object",additionalProperties:!1,title:"ATTACHMENT",properties:{"cbc:EmbeddedDocumentBinaryObject":{$ref:"#/$defs/dataTypes/Binary object",title:"Attached document",description:"An attached document embedded as binary object (Base64) or sent together with the invoice.\nBusiness terms: BT-125"},"cbc:EmbeddedDocumentBinaryObject@mimeCode":{type:"string",$ref:"#/$defs/codeLists/MimeCode",title:"Attached document Mime code",description:"The mime code of the attached document."},"cbc:EmbeddedDocumentBinaryObject@filename":{type:"string",title:"Attached document Filename",description:"The file name of the attached document"},"cac:ExternalReference":{type:"object",additionalProperties:!1,title:"EXTERNAL REFERENCE",properties:{"cbc:URI":{type:"string",title:"External document location",description:"The URL (Uniform Resource Locator) that identifies where the external document is located. A means of locating the resource, including its primary access mechanism, e.g. http:// or ftp://.\nBusiness terms: BT-124"}},required:["cbc:URI"]}},required:[],dependentRequired:{"cbc:EmbeddedDocumentBinaryObject":["cbc:EmbeddedDocumentBinaryObject@mimeCode","cbc:EmbeddedDocumentBinaryObject@filename"],"cbc:EmbeddedDocumentBinaryObject@mimeCode":["cbc:EmbeddedDocumentBinaryObject"],"cbc:EmbeddedDocumentBinaryObject@filename":["cbc:EmbeddedDocumentBinaryObject"]}}},required:["cbc:ID"],dependentRequired:{"cbc:ID@schemeID":["cbc:ID"]}}},"cac:ProjectReference":{type:"object",additionalProperties:!1,title:"PROJECT REFERENCE",properties:{"cbc:ID":{type:"string",title:"Project reference",description:"The identification of the project the invoice refers to.\nBusiness terms: BT-11"}},required:["cbc:ID"]},"cac:AccountingSupplierParty":{type:"object",additionalProperties:!1,title:"SELLER",description:"A group of business terms providing information about the Seller.\nBusiness terms: BG-4",properties:{"cac:Party":{type:"object",additionalProperties:!1,title:"PARTY",properties:{"cbc:EndpointID":{type:"string",title:"Seller electronic address",description:"Identifies the Seller's electronic address to which the application level response to the invoice may be delivered.\nBusiness terms: BT-34"},"cbc:EndpointID@schemeID":{type:"string",$ref:"#/$defs/codeLists/eas",title:"Seller electronic address identification scheme identifier",description:"The identification scheme identifier of the Seller electronic address"},"cac:PartyIdentification":{type:"array",items:{type:"object",additionalProperties:!1,title:"PARTY IDENTIFICATION",properties:{"cbc:ID":{type:"string",title:"Seller identifier or bank assigned creditor identifier",description:"This element is used for both the identification of the Seller, or the unique banking reference identifier of Seller (assigned by the Seller bank.). For seller identification use ICD code list, for SEPA bank assigned creditor reference, use SEPA. In order for the buyer to automatically identify a supplier, the Seller identifier (BT-29), the Seller legal registration identifier (BT-30) and/or the Seller VAT identifier (BT-31) shall be present\nBusiness terms: BT-29, BT-90"},"cbc:ID@schemeID":{type:"string",oneOf:[{$ref:"#/$defs/codeLists/ICD"},{$ref:"#/$defs/codeLists/SEPA"}],title:"Seller or bank assigned creditor identifier identification scheme identifier",description:'The identification scheme identifier of the Seller identifier. For bank assigned creditor identifier (BT-90), value MUST be "SEPA"'}},required:["cbc:ID"],dependentRequired:{"cbc:ID@schemeID":["cbc:ID"]}}},"cac:PartyName":{type:"object",additionalProperties:!1,title:"PARTY NAME",properties:{"cbc:Name":{type:"string",title:"Seller trading name",description:"A name by which the Seller is known, other than Seller name (also known as Business name).\nBusiness terms: BT-28"}},required:["cbc:Name"]},"cac:PostalAddress":{type:"object",additionalProperties:!1,title:"SELLER POSTAL ADDRESS",description:"A group of business terms providing information about the address of the Seller. Sufficient components of the address are to be filled to comply with legal requirements.\nBusiness terms: BG-5",properties:{"cbc:StreetName":{type:"string",title:"Seller address line 1",description:"The main address line in an address.\nBusiness terms: BT-35"},"cbc:AdditionalStreetName":{type:"string",title:"Seller address line 2",description:"An additional address line in an address that can be used to give further details supplementing the main line.\nBusiness terms: BT-36"},"cbc:CityName":{type:"string",title:"Seller city",description:"The common name of the city, town or village, where the Seller address is located.\nBusiness terms: BT-37"},"cbc:PostalZone":{type:"string",title:"Seller post code",description:"The identifier for an addressable group of properties according to the relevant postal service.\nBusiness terms: BT-38"},"cbc:CountrySubentity":{type:"string",title:"Seller country subdivision",description:"The subdivision of a country.\nBusiness terms: BT-39"},"cac:AddressLine":{type:"object",additionalProperties:!1,title:"ADDRESS LINE",properties:{"cbc:Line":{type:"string",title:"Seller address line 3",description:"An additional address line in an address that can be used to give further details supplementing the main line.\nBusiness terms: BT-162"}},required:["cbc:Line"]},"cac:Country":{type:"object",additionalProperties:!1,title:"COUNTRY",properties:{"cbc:IdentificationCode":{type:"string",$ref:"#/$defs/codeLists/ISO3166",title:"Seller country code",description:"A code that identifies the country.\nBusiness terms: BT-40"}},required:["cbc:IdentificationCode"]}},required:["cac:Country"]},"cac:PartyTaxScheme":{type:"array",items:{type:"object",additionalProperties:!1,title:"PARTY VAT/TAX IDENTIFIERS",properties:{"cbc:CompanyID":{type:"string",title:"Seller VAT identifier, Seller tax registration identifier",description:"The Seller's VAT identifier (also known as Seller VAT identification number) or the local identification (defined by the Seller’s address) of the Seller for tax purposes or a reference that enables the Seller to state his registered tax status. In order for the buyer to automatically identify a supplier, the Seller identifier (BT-29), the Seller legal registration identifier (BT-30) and/or the Seller VAT identifier (BT-31) shall be present\nBusiness terms: BT-31, BT-32"},"cac:TaxScheme":{type:"object",additionalProperties:!1,title:"TAX SCHEME",properties:{"cbc:ID":{type:"string",description:'Mandatory element. For Seller VAT identifier (BT-31), use value “VAT”, for the seller tax registration identifier (BT-32), use != "VAT"'}},required:["cbc:ID"]}},required:["cbc:CompanyID","cac:TaxScheme"]},maxItems:2},"cac:PartyLegalEntity":{type:"object",additionalProperties:!1,title:"PARTY LEGAL ENTITY",properties:{"cbc:RegistrationName":{type:"string",title:"Seller name",description:"The full formal name by which the Seller is registered in the national registry of legal entities or as a Taxable person or otherwise trades as a person or persons.\nBusiness terms: BT-27"},"cbc:CompanyID":{type:"string",title:"Seller legal registration identifier",description:"An identifier issued by an official registrar that identifies the Seller as a legal entity or person. In order for the buyer to automatically identify a supplier, the Seller identifier (BT-29), the Seller legal registration identifier (BT-30) and/or the Seller VAT identifier (BT-31) shall be present\nBusiness terms: BT-30"},"cbc:CompanyID@schemeID":{type:"string",$ref:"#/$defs/codeLists/ICD",title:"Seller legal registration identifier identification scheme identifier",description:"The identification scheme identifier of the Seller legal registration identifier."},"cbc:CompanyLegalForm":{type:"string",title:"Seller additional legal information",description:"Additional legal information relevant for the Seller.\nBusiness terms: BT-33"}},required:["cbc:RegistrationName"],dependentRequired:{"cbc:CompanyID@schemeID":["cbc:CompanyID"]}},"cac:Contact":{type:"object",additionalProperties:!1,title:"SELLER CONTACT",description:"A group of business terms providing contact information about the Seller.\nBusiness terms: BG-6",properties:{"cbc:Name":{type:"string",title:"Seller contact point",description:"A contact point for a legal entity or person.\nBusiness terms: BT-41"},"cbc:Telephone":{type:"string",title:"Seller contact telephone number",description:"A phone number for the contact point.\nBusiness terms: BT-42"},"cbc:ElectronicMail":{type:"string",title:"Seller contact email address",description:"An e-mail address for the contact point.\nBusiness terms: BT-43"}}}},required:["cac:PostalAddress","cac:PartyLegalEntity"],dependentRequired:{"cbc:EndpointID":["cbc:EndpointID@schemeID"],"cbc:EndpointID@schemeID":["cbc:EndpointID"]}}},required:["cac:Party"]},"cac:AccountingCustomerParty":{type:"object",additionalProperties:!1,title:"BUYER",description:"A group of business terms providing information about the Buyer.\nBusiness terms: BG-7",properties:{"cac:Party":{type:"object",additionalProperties:!1,title:"PARTY",properties:{"cbc:EndpointID":{type:"string",title:"Buyer electronic address",description:"Identifies the Buyer's electronic address to which the invoice is delivered.\nBusiness terms: BT-49"},"cbc:EndpointID@schemeID":{type:"string",$ref:"#/$defs/codeLists/eas",title:"Buyer electronic address identification scheme identifier",description:"The identification scheme identifier of the Buyer electronic address."},"cac:PartyIdentification":{type:"object",additionalProperties:!1,title:"PARTY IDENTIFICATION",properties:{"cbc:ID":{type:"string",title:"Buyer identifier",description:"An identifier of the Buyer.\nBusiness terms: BT-46"},"cbc:ID@schemeID":{type:"string",$ref:"#/$defs/codeLists/ICD",title:"Buyer identifier identification scheme identifier",description:"The identification scheme identifier of the Buyer identifier."}},required:["cbc:ID"],dependentRequired:{"cbc:ID@schemeID":["cbc:ID"]}},"cac:PartyName":{type:"object",additionalProperties:!1,title:"PARTY NAME",properties:{"cbc:Name":{type:"string",title:"Buyer trading name",description:"A name by which the Buyer is known, other than Buyer name (also known as Business name).\nBusiness terms: BT-45"}},required:["cbc:Name"]},"cac:PostalAddress":{type:"object",additionalProperties:!1,title:"BUYER POSTAL ADDRESS",description:"A group of business terms providing information about the postal address for the Buyer. Sufficient components of the address are to be filled to comply with legal requirements.\nBusiness terms: BG-8",properties:{"cbc:StreetName":{type:"string",title:"Buyer address line 1",description:"The main address line in an address.\nBusiness terms: BT-50"},"cbc:AdditionalStreetName":{type:"string",title:"Buyer address line 2",description:"An additional address line in an address that can be used to give further details supplementing the main line.\nBusiness terms: BT-51"},"cbc:CityName":{type:"string",title:"Buyer city",description:"The common name of the city, town or village, where the Buyer's address is located.\nBusiness terms: BT-52"},"cbc:PostalZone":{type:"string",title:"Buyer post code",description:"The identifier for an addressable group of properties according to the relevant postal service.\nBusiness terms: BT-53"},"cbc:CountrySubentity":{type:"string",title:"Buyer country subdivision",description:"The subdivision of a country.\nBusiness terms: BT-54"},"cac:AddressLine":{type:"object",additionalProperties:!1,title:"ADDRESS LINE",properties:{"cbc:Line":{type:"string",title:"Buyer address line 3",description:"An additional address line in an address that can be used to give further details supplementing the main line.\nBusiness terms: BT-163"}},required:["cbc:Line"]},"cac:Country":{type:"object",additionalProperties:!1,title:"COUNTRY",properties:{"cbc:IdentificationCode":{type:"string",$ref:"#/$defs/codeLists/ISO3166",title:"Buyer country code",description:"A code that identifies the country.\nBusiness terms: BT-55"}},required:["cbc:IdentificationCode"]}},required:["cac:Country"]},"cac:PartyTaxScheme":{type:"object",additionalProperties:!1,title:"PARTY VAT IDENTIFIER",properties:{"cbc:CompanyID":{type:"string",title:"Buyer VAT identifier",description:"The Buyer's VAT identifier (also known as Buyer VAT identification number).\nBusiness terms: BT-48"},"cac:TaxScheme":{type:"object",additionalProperties:!1,title:"TAX SCHEME",properties:{"cbc:ID":{type:"string",description:"Mandatory element. Use “VAT”"}},required:["cbc:ID"]}},required:["cbc:CompanyID","cac:TaxScheme"]},"cac:PartyLegalEntity":{type:"object",additionalProperties:!1,title:"PARTY LEGAL ENTITY",properties:{"cbc:RegistrationName":{type:"string",title:"Buyer name",description:"The full name of the Buyer.\nBusiness terms: BT-44"},"cbc:CompanyID":{type:"string",title:"Buyer legal registration identifier",description:"An identifier issued by an official registrar that identifies the Buyer as a legal entity or person.\nBusiness terms: BT-47"},"cbc:CompanyID@schemeID":{type:"string",$ref:"#/$defs/codeLists/ICD",title:"Buyer legal registration identifier identification scheme identifier",description:"The identification scheme identifier of the Buyer legal registration identifier."}},required:["cbc:RegistrationName"],dependentRequired:{"cbc:CompanyID@schemeID":["cbc:CompanyID"]}},"cac:Contact":{type:"object",additionalProperties:!1,title:"BUYER CONTACT",description:"A group of business terms providing contact information relevant for the Buyer.\nBusiness terms: BG-9",properties:{"cbc:Name":{type:"string",title:"Buyer contact point",description:"A contact point for a legal entity or person.\nBusiness terms: BT-56"},"cbc:Telephone":{type:"string",title:"Buyer contact telephone number",description:"A phone number for the contact point.\nBusiness terms: BT-57"},"cbc:ElectronicMail":{type:"string",title:"Buyer contact email address",description:"An e-mail address for the contact point.\nBusiness terms: BT-58"}}}},required:["cac:PostalAddress","cac:PartyLegalEntity"],dependentRequired:{"cbc:EndpointID":["cbc:EndpointID@schemeID"],"cbc:EndpointID@schemeID":["cbc:EndpointID"]}}},required:["cac:Party"]},"cac:PayeeParty":{type:"object",additionalProperties:!1,title:"PAYEE",description:"A group of business terms providing information about the Payee, i.e. the role that receives the payment. Shall be used when the Payee is different from the Seller.\nBusiness terms: BG-10",properties:{"cac:PartyIdentification":{type:"object",additionalProperties:!1,title:"PARTY IDENTIFICATION",properties:{"cbc:ID":{type:"string",title:"Payee identifier or bank assigned creditor identifier",description:"This element is used for both the identification of the Payee, or the unique banking reference identifier of Payee (assigned by the Payee bank.) For payee identification use ICD code list, for SEPA bank assigned creditor reference, use SEPA.\nBusiness terms: BT-60, BT-90"},"cbc:ID@schemeID":{type:"string",oneOf:[{$ref:"#/$defs/codeLists/ICD"},{$ref:"#/$defs/codeLists/SEPA"