@formfeed/engine 0.3.16 → 0.3.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -303,11 +303,11 @@ var codeHelpers = [
303
303
  aliases: ["epc_qr", "girocode"],
304
304
  doc: {
305
305
  signature: "epcQr({ name, iban, bic?, amount?, reference?, text? }, { size })",
306
- description: "SEPA credit transfer QR code (EPC069-12 / GiroCode) that banking apps scan to prefill a payment. Give the image an `alt`, and print the bank details as text as well: the code is a picture.",
306
+ description: "SEPA credit transfer QR code (EPC069-12 / GiroCode) that banking apps scan to prefill a payment. Put an invoice number into `text` (the remittance line); `reference` is only for a structured creditor reference (RF\u2026). Give the image an `alt`, and print the bank details as text as well: the code is a picture.",
307
307
  examples: {
308
- jinja2: '<img src="{{ epcQr({ name: company.name, iban: company.iban, amount: invoice.total, reference: invoice.number }) }}" alt="QR code to pay invoice {{ invoice.number }}">',
309
- liquid: '<img src="{{ company.iban | epcQr: name: company.name, amount: invoice.total, reference: invoice.number }}" alt="QR code to pay invoice {{ invoice.number }}">',
310
- handlebars: '<img src="{{epcQr name=company.name iban=company.iban amount=invoice.total reference=invoice.number}}" alt="QR code to pay invoice {{invoice.number}}">'
308
+ jinja2: '<img src="{{ epcQr({ name: company.name, iban: company.iban, amount: invoice.total, text: invoice.number }) }}" alt="QR code to pay invoice {{ invoice.number }}">',
309
+ liquid: '<img src="{{ company.iban | epcQr: name: company.name, amount: invoice.total, text: invoice.number }}" alt="QR code to pay invoice {{ invoice.number }}">',
310
+ handlebars: '<img src="{{epcQr name=company.name iban=company.iban amount=invoice.total text=invoice.number}}" alt="QR code to pay invoice {{invoice.number}}">'
311
311
  },
312
312
  category: "code"
313
313
  },
@@ -5478,6 +5478,7 @@ var textEditRuntime = '"use strict";(()=>{var O=`\nhtml.ff-edit-mode [data-ff-ed
5478
5478
  var fitRuntime = '"use strict";(()=>{function a(t,e,n){if(e===t)return t.scrollHeight<=t.clientHeight+.5&&t.scrollWidth<=t.clientWidth+.5;let o=n.getComputedStyle(t),i=t.clientHeight-(parseFloat(o.paddingTop)||0)-(parseFloat(o.paddingBottom)||0);return e.scrollHeight<=i+.5&&e.scrollWidth<=e.clientWidth+.5}function m(t,e){let n=t.firstElementChild??t;n.style.fontSize="";let o=parseFloat(e.getComputedStyle(n).fontSize)||16,i=Math.min(o,parseFloat(t.getAttribute("data-ff-fit-min")??"")||o/2);if(a(t,n,e))return o;let l=i,s=o;for(let d=0;d<14;d++){let r=(l+s)/2;n.style.fontSize=`${r}px`,a(t,n,e)?l=r:s=r}let f=Math.floor(l*100)/100;return n.style.fontSize=`${f}px`,f}function c(t){let e=()=>{for(let o of Array.from(t.document.querySelectorAll(\'[data-ff-fit="shrink"]\')))m(o,t);t.document.documentElement.setAttribute("data-ff-fit","done")};t.formfeedFit=e;let n=t.document.fonts;n?n.ready.then(e):t.addEventListener("load",e)}c(window);})();';
5479
5479
  var stageRuntime = '"use strict";(()=>{var W=`\nhtml.ff-edit-mode [data-ff-edit] { cursor: text; }\nhtml.ff-edit-mode [data-ff-edit]:hover { outline: 1px dashed rgba(37,99,235,.85); outline-offset: 2px; }\nhtml.ff-edit-mode [data-ff-edit="t"]:hover { outline-color: rgba(147,51,234,.9); }\n.ff-editing { outline: 2px solid #2563eb !important; outline-offset: 2px; cursor: text; }\n.ff-editing .ff-chip { background: rgba(37,99,235,.14) !important; box-shadow: inset 0 0 0 1px rgba(37,99,235,.45) !important; border-radius: 3px !important; padding: 0 1px !important; cursor: default; }\n.ff-edit-badge { position: absolute; z-index: 2147483647; font: 500 11px/1.4 system-ui, sans-serif !important; color: #fff !important; background: #2563eb !important; padding: 1px 6px !important; border-radius: 4px !important; pointer-events: none; white-space: nowrap; }\n`;function H(a,l={}){let f=l.clicks!==!1,p=l.live===!0,n=a.document,o=null,d=null,u=e=>{try{a.parent.postMessage(e,"*")}catch{}},m=f?n.querySelector(\'meta[name="formfeed:document"]\')?.getAttribute("content")??null:null,s=!1;a.addEventListener("blur",()=>{s=!0}),a.addEventListener("focus",()=>{s=!1});let g=n.createElement("style");g.setAttribute("data-formfeed","edit"),g.setAttribute("data-pagedjs-ignore",""),g.textContent=W,(n.head??n.documentElement).appendChild(g),f&&n.documentElement.classList.add("ff-edit-mode");let x=e=>(e&&typeof e.closest=="function"?e:null)?.closest("[data-ff-edit]")??null;n.addEventListener("click",e=>{if(!f)return;if(o&&!o.done&&o.element.contains(e.target)){e.stopImmediatePropagation();return}let t=x(e.target);t&&(e.preventDefault(),e.stopImmediatePropagation(),v(t,{x:e.clientX,y:e.clientY}))},!0);function v(e,t){o&&!o.done&&L();let r=e.getAttribute("data-ff-src")??"",i=e.getBoundingClientRect(),b=Array.from(n.querySelectorAll(`[data-ff-src="${r.replace(/"/g,"")}"]`));d={src:r,element:e,point:t},u({type:"formfeed:edit-request",src:r,doc:m,edit:e.getAttribute("data-ff-edit"),text:e.textContent??"",elements:e.childElementCount,count:b.length,index:Math.max(0,b.indexOf(e)),split:e.hasAttribute("data-split-from")||e.hasAttribute("data-split-to"),rect:{left:i.left,top:i.top,width:i.width,height:i.height}})}n.addEventListener("keydown",e=>{if(!f||o&&!o.done||!(e.ctrlKey||e.metaKey)||e.altKey)return;let t=e.key.toLowerCase();(t==="z"||t==="y")&&(e.preventDefault(),u({type:t==="y"||e.shiftKey?"formfeed:redo":"formfeed:undo"}))}),a.addEventListener("message",e=>{if(e.source!==a.parent)return;let t=e.data;!t||typeof t.type!="string"||(t.type==="formfeed:edit-begin"?B(t):t.type==="formfeed:edit-refuse"||t.type==="formfeed:edit-end"?(d=null,o&&!o.done&&S(!1)):t.type==="formfeed:edit-open"&&E(t))});function E(e){if(!f||typeof e.src!="string"||o&&!o.done)return;let t=Array.from(n.querySelectorAll(`[data-ff-src="${e.src.replace(/"/g,"")}"][data-ff-edit]`)),r=Number.isInteger(e.index)?Number(e.index):0,i=t[r]??t[0];i&&v(i,null)}if(f){let e=()=>u({type:"formfeed:edit-ready",doc:m}),t=a;t.PagedConfig?t.formfeedEditReady=e:n.readyState==="loading"?n.addEventListener("DOMContentLoaded",e):e()}function B(e){o&&!o.done&&S(!1);let t=e.layer?n.querySelector(`[data-ff-layer="${String(e.layer).replace(/"/g,"")}"] > .ff-text`):d&&d.src===e.src?d.element:n.querySelector(`[data-ff-src="${String(e.src).replace(/"/g,"")}"]`),r=e.at,i=e.layer?r&&Number.isFinite(r.x)&&Number.isFinite(r.y)?{x:Number(r.x),y:Number(r.y)}:null:d&&d.src===e.src?d.point:null;d=null;let b=s&&!n.hasFocus();if(!t||!Array.isArray(e.items)||b){u({type:"formfeed:edit-cancel",token:String(e.token)});return}let y=Array.from(t.childNodes),k=n.createDocumentFragment();for(let c of e.items)if(c.kind==="text")k.appendChild(n.createTextNode(String(c.text)));else if(c.kind==="break")k.appendChild(n.createElement("br"));else if(c.kind==="chip"){let h=n.createElement("span");h.className="ff-chip",h.setAttribute("data-ff-chip",String(c.index)),h.setAttribute("contenteditable","false"),c.title&&(h.title=String(c.title)),h.textContent=String(c.text),k.appendChild(h)}for(let c of y)t.removeChild(c);t.appendChild(k),t.contentEditable="true",t.classList.add("ff-editing"),t.setAttribute("role","textbox"),e.label&&t.setAttribute("aria-label",String(e.label)),t.spellcheck=!0,o={token:String(e.token),element:t,saved:y,allowBreaks:e.allowBreaks===!0,badge:e.note?I(t,String(e.note)):null,done:!1},t.addEventListener("keydown",T),t.addEventListener("beforeinput",N),t.addEventListener("paste",w),t.addEventListener("drop",R),t.addEventListener("focusout",F),p&&t.addEventListener("input",C),t.focus(),e.select==="all"?q(t):K(t,i),u({type:"formfeed:edit-started",token:o.token}),typeof e.insert=="string"&&e.insert&&A(e.insert.replace(/\\r\\n?|\\n/g," "))}function A(e){if(typeof n.execCommand=="function"&&n.execCommand("insertText",!1,e))return;let t=a.getSelection(),r=t&&t.rangeCount?t.getRangeAt(0):null;r&&(r.deleteContents(),r.insertNode(n.createTextNode(e)),r.collapse(!1),p&&C())}function C(){o&&!o.done&&u({type:"formfeed:edit-input",token:o.token,items:D(o.element)})}function I(e,t){let r=n.createElement("div");r.className="ff-edit-badge",r.textContent=t;let i=e.getBoundingClientRect();return r.style.left=`${i.left+a.scrollX}px`,r.style.top=`${Math.max(0,i.top+a.scrollY-22)}px`,n.body.appendChild(r),r}function q(e){let t=a.getSelection();if(!t)return;let r=n.createRange();r.selectNodeContents(e),t.removeAllRanges(),t.addRange(r)}function K(e,t){let r=a.getSelection();if(!r)return;let i=null,b=n;if(t){if(b.caretRangeFromPoint)i=b.caretRangeFromPoint(t.x,t.y);else if(b.caretPositionFromPoint){let y=b.caretPositionFromPoint(t.x,t.y);y&&(i=n.createRange(),i.setStart(y.offsetNode,y.offset))}}if(!i||!e.contains(i.startContainer))i=n.createRange(),i.selectNodeContents(e),i.collapse(!1);else if(t){let y=i.startContainer,c=(y.nodeType===1?y:y.parentElement)?.closest("[data-ff-chip]")??null;if(c&&c!==e&&e.contains(c)){let h=c.getBoundingClientRect();i=n.createRange(),t.x<h.left+h.width/2?i.setStartBefore(c):i.setStartAfter(c),i.collapse(!0)}}r.removeAllRanges(),r.addRange(i)}function T(e){let t=e.key;t==="Escape"?(e.preventDefault(),S(!0)):t==="Enter"&&!e.shiftKey?(e.preventDefault(),L()):t==="Enter"?(e.preventDefault(),o?.allowBreaks&&$()):t==="Tab"?(e.preventDefault(),L()):(e.ctrlKey||e.metaKey)&&["b","i","u"].includes(t.toLowerCase())&&(e.preventDefault(),p&&o&&!e.altKey&&u({type:"formfeed:edit-style",token:o.token,key:t.toLowerCase()}))}function N(e){let t=e.inputType??"";(t.startsWith("format")||t==="insertFromDrop"||t==="insertParagraph"||t==="insertLineBreak")&&e.preventDefault()}function w(e){e.preventDefault(),A((e.clipboardData?.getData("text/plain")??"").replace(/\\r\\n?|\\n/g," "))}function R(e){e.preventDefault()}function F(){a.setTimeout(()=>{o&&!o.done&&(!n.hasFocus()||!o.element.contains(n.activeElement))&&L()},0)}function $(){let e=a.getSelection();if(!e||!e.rangeCount)return;let t=e.getRangeAt(0);t.deleteContents();let r=n.createElement("br");t.insertNode(r),r.nextSibling||r.parentNode?.appendChild(n.createElement("br"));let i=n.createRange();i.setStartAfter(r),i.collapse(!0),e.removeAllRanges(),e.addRange(i)}function M(e){e.done=!0;let t=e.element;t.removeEventListener("keydown",T),t.removeEventListener("beforeinput",N),t.removeEventListener("paste",w),t.removeEventListener("drop",R),t.removeEventListener("focusout",F),t.removeEventListener("input",C),t.removeAttribute("contenteditable"),t.removeAttribute("role"),t.removeAttribute("aria-label"),t.classList.remove("ff-editing"),e.badge?.remove(),o===e&&(o=null)}function L(){let e=o;if(!e||e.done)return;let t=D(e.element);M(e),u({type:"formfeed:edit-commit",token:e.token,items:t})}function S(e){let t=o;if(!t||t.done)return;let r=t.element;for(;r.firstChild;)r.removeChild(r.firstChild);for(let i of t.saved)r.appendChild(i);M(t),e&&u({type:"formfeed:edit-cancel",token:t.token})}}function D(a){let l=[],f=n=>{let o=l[l.length-1];o?.kind==="text"?o.text+=n:n&&l.push({kind:"text",text:n})},p=n=>{for(let o of Array.from(n.childNodes))if(o.nodeType===3)f(o.data);else if(o.nodeType===1){let d=o,u=d.getAttribute("data-ff-chip");u!==null?l.push({kind:"chip",index:Number(u)}):d.tagName==="BR"?l.push({kind:"break"}):((d.tagName==="DIV"||d.tagName==="P")&&l.length&&l.push({kind:"break"}),p(d))}};for(p(a);l[l.length-1]?.kind==="break";)l.pop();return l}function O(a,l){return Array.from(a.querySelectorAll("[data-ff-layer]")).map(f=>{let p=f.querySelector(":scope > .ff-text"),n=!1;if(p&&f.style.height!=="auto"){let o=l.getComputedStyle(f),d=f.clientHeight-(parseFloat(o.paddingTop)||0)-(parseFloat(o.paddingBottom)||0);n=o.overflow==="hidden"&&(p.scrollHeight>d+1||p.scrollWidth>p.clientWidth+1)}return{id:f.getAttribute("data-ff-layer")??"",width:f.offsetWidth,height:f.offsetHeight,overflow:n}})}function P(a){let l=a.document,f=m=>{try{a.parent.postMessage(m,"*")}catch{}},p=m=>typeof m=="string"?l.querySelector(`[data-ff-layer="${m.replace(/"/g,"")}"]`):null,n=()=>{for(let m of Array.from(l.querySelectorAll("[data-ff-layer]")))for(let s of["left","top","width","height","transform"])m.style.removeProperty(s)},o=()=>{a.formfeedFit?.(),f({type:"formfeed:ready",layers:O(l,a)})};a.addEventListener("message",m=>{if(m.source!==a.parent)return;let s=m.data;if(!(!s||typeof s.type!="string")){if(s.type==="formfeed:layer-style"){let g=p(s.id);if(!g)return;let x=(v,E)=>{typeof E=="number"&&Number.isFinite(E)&&g.style.setProperty(v,`${E}px`)};x("left",s.left),x("top",s.top),x("width",s.width),x("height",s.height),typeof s.rotation=="number"&&Number.isFinite(s.rotation)&&g.style.setProperty("transform",s.rotation?`rotate(${s.rotation}deg)`:"none")}else if(s.type==="formfeed:layer-style-clear")n();else if(s.type==="formfeed:css"&&typeof s.css=="string"){let g=l.querySelector(\'style[data-formfeed="template"]\');g&&(g.textContent=s.css),n(),o()}}}),H(a,{clicks:!1,live:!0});let d=l.fonts,u=()=>d?void d.ready.then(o):o();l.readyState==="complete"?u():a.addEventListener("load",u)}P(window);})();';
5480
5480
  var auditRuntime = '"use strict";(()=>{var I={"document-title":"error","image-alt":"error","figure-name":"error","heading-order":"error","table-rows":"error","table-cell-empty":"error","masked-text":"error","filtered-text":"warning","document-language":"warning","table-headers":"warning","link-name":"warning","generated-text":"warning","fixed-text":"warning","running-text":"warning"};var S=120;var O=".formfeed-chrome, .ff-running-header, .ff-running-footer",_=".pageNumber, .totalPages, .date, .title, .url, .ff-page-no, .ff-page-total",k=new Set(["script","style","template","noscript","head"]),j=2e4,q=10,B=new Set(["page","pages","of","seite","seiten","von","p","s"]),u=t=>(t??"").replace(/\\s+/g," ").trim(),D=t=>t.replace(/\\s+/g,"").toLowerCase(),$=t=>/[\\p{L}\\p{N}]/u.test(t),Y=/^data-(ref|id|split-(from|to|original)|(previous-|next-)?break-(before|after|inside)|(align-)?last-split-element|nth-of-type|counter-.+|page(-number)?|undisplayed|after-page|following|has-notes|children|item-num)$/;function X(t){let n=t.cloneNode(!1);n.removeAttribute("data-ff-src"),n.removeAttribute("data-ff-edit");let i=t.closest(".pagedjs_page")!==null;for(let s of Array.from(n.attributes))i&&Y.test(s.name)?n.removeAttribute(s.name):s.value.length>48&&n.setAttribute(s.name,`${s.value.slice(0,40)}\\u2026`);let o=n.outerHTML.replace(new RegExp(`</${t.tagName}>$`,"i"),"");return o.length>S?`${o.slice(0,S-1)}\\u2026`:o}function F(t,n={}){let i=t.document,o=i.body,s=[],d=new Set,a=n.findings!==!1,c=(e,r,l={})=>{if(!a)return;let m=r?.closest("[data-ff-src]")?.getAttribute("data-ff-src")??null,h=r?X(r):"",g=`${e}|${m??h}|${JSON.stringify(l)}`;d.has(g)||(d.add(g),s.push({code:e,severity:I[e],src:m,snippet:h,args:l}))},f=new WeakMap,A=e=>{let r=f.get(e);if(r!==void 0)return r;let l=t.getComputedStyle(e),m=l.display==="none"||l.visibility==="hidden"||l.visibility==="collapse"||e.parentElement!==null&&e.parentElement!==i.documentElement&&A(e.parentElement);return f.set(e,m),m},p=e=>e.closest(\'[aria-hidden="true"]\')!==null,E=e=>/^(presentation|none)$/.test(e.getAttribute("role")??""),H=e=>e.closest(O)!==null,y=e=>$(e.textContent??""),x=e=>{let r=u(e.getAttribute("aria-label"));return r||u((e.getAttribute("aria-labelledby")??"").split(/\\s+/).filter(Boolean).map(l=>e.ownerDocument.getElementById(l)?.textContent??"").join(" "))},P=e=>x(e)||u(e.textContent)||u(Array.from(e.querySelectorAll("img[alt]")).map(r=>r.getAttribute("alt")).join(" "))||u(e.getAttribute("title")),T=e=>{let r=e.getAttribute("href")??"";return{href:r.startsWith("#")?r:e.href??r,name:P(e)}};u(i.title)||c("document-title",null),!u(i.documentElement.getAttribute("lang"))&&!n.locale&&c("document-language",null);let M=n.pages??(n.pageHeight&&n.pageHeight>0?Math.ceil(i.documentElement.scrollHeight/n.pageHeight):1),C=[],v=[],R={"masked-text":[],"filtered-text":[],"fixed-text":[]},w=(e,r)=>{R[e].some(l=>l.contains(r))||(R[e].push(r),c(e,r))},V=a&&ne(i),G=o?Array.from(o.querySelectorAll("*")).slice(0,j):[];for(let e of G){let r=e.tagName.toLowerCase();if(k.has(r)||H(e)||A(e))continue;if(r==="a"&&e.hasAttribute("href")){let g=T(e);C.push(g),!g.name&&!p(e)&&c("link-name",e)}if(!a)continue;let l=t.getComputedStyle(e),m=l.getPropertyValue("mask-image")||l.getPropertyValue("-webkit-mask-image");if(m&&m!=="none"&&y(e)&&w("masked-text",e),l.filter&&l.filter!=="none"&&y(e)&&w("filtered-text",e),l.position==="fixed"&&M>1&&y(e)&&w("fixed-text",e),V)for(let g of["::before","::after"]){let U=re(t.getComputedStyle(e,g).content);U&&c("generated-text",e,{text:U})}if(p(e))continue;r==="img"&&!E(e)?e.hasAttribute("alt")||x(e)||u(e.getAttribute("title"))||c("image-alt",e):(r==="canvas"||e.getAttribute("role")==="img"&&r!=="img")&&(x(e)||u(e.getAttribute("title"))||u(e.querySelector(":scope > title")?.textContent)||c("figure-name",e,{tag:r}));let h=/^h[1-6]$/.test(r)?Number(r[1]):e.getAttribute("role")==="heading"?Number(e.getAttribute("aria-level"))||2:0;h&&v.push({element:e,level:h}),r==="table"&&!E(e)&&Q(e,c)}let b=0;for(let{element:e,level:r}of v)(b===0?r!==1:r>b+1)&&c("heading-order",e,{level:r,previous:b}),b=r;let N=[],W=a&&o?D(J(o)):"",L=0;for(let e of["header","footer"])for(let r of z(i,e,n[e])){for(let l of Array.from(r.querySelectorAll("a[href]")))N.push(T(l));if(a)for(let{text:l,element:m}of K(r)){if(L>=q||W.includes(D(l)))continue;let h=s.length;c("running-text",m,{text:l.slice(0,80),part:e}),s.length>h&&L++}}return{findings:s,links:C,templateLinks:N}}function z(t,n,i){if(i!==void 0){if(!i.trim())return[];let o=new DOMParser().parseFromString(`<!doctype html><body>${i}</body>`,"text/html");return o.body?[o.body]:[]}return Array.from(t.querySelectorAll(`.ff-running-${n}, .formfeed-chrome[data-ff-chrome="${n}"]`))}function J(t){let n=[],i=o=>{if(o.nodeType===3){n.push(o.nodeValue??"");return}if(o.nodeType!==1)return;let s=o;if(!(k.has(s.tagName.toLowerCase())||s.matches(O)))for(let d of Array.from(o.childNodes))i(d)};return i(t),n.join(" ")}function K(t){let n=[],i=o=>{let s=o.tagName.toLowerCase();if(k.has(s)||o.matches(_))return;let d=Array.from(o.children).some(a=>a.matches(_));for(let a of Array.from(o.childNodes))if(a.nodeType===1)i(a);else if(a.nodeType===3&&!d)for(let c of(a.nodeValue??"").split(/\\s*[\xB7\u2022|]\\s*|\\s{2,}|\\n/)){let f=u(c);(f.toLowerCase().match(/[\\p{L}\\p{N}]+/gu)??[]).some(p=>!B.has(p))&&n.push({text:f,element:o})}};return i(t),n}function Q(t,n){let i=Array.from(t.rows);if(!(t.querySelector(\'th, [role="columnheader"], [role="rowheader"]\')!==null)){i.length>=2&&n("table-headers",t);return}let s=te(i),d=s.find(c=>c!==s[0]);d!==void 0&&n("table-rows",t,{first:s[0]??0,other:d});let a=i.flatMap(c=>Array.from(c.cells).filter(f=>f.tagName==="TD"&&ee(f)));a[0]&&n("table-cell-empty",a[0],{count:a.length})}var Z=\'img[alt]:not([alt=""]), svg, canvas, input, select, textarea, button, meter, progress\';function ee(t){return!/[^ \\t\\n\\r\\f]/.test(t.textContent??"")&&t.querySelector(Z)===null}function te(t){let n=[];return t.map(i=>{let o=[],s=0,d=()=>{for(;(n[s]??0)>0;)o[s]=n[s]-1,s++};for(let a of Array.from(i.cells)){d();let c=Math.max(1,a.rowSpan||1)-1;for(let f=Math.max(1,a.colSpan||1);f>0;f--)o[s++]=c}d();for(let a=s;a<n.length;a++)(n[a]??0)>0&&(o[a]=n[a]-1,s=a+1);return n=o,s})}function ne(t){let n=i=>{for(let o of Array.from(i??[])){let s=o;if(s.selectorText&&/::?(before|after)/.test(s.selectorText)&&s.style?.content||o.cssRules&&n(o.cssRules))return!0}return!1};for(let i of Array.from(t.styleSheets))try{if(n(i.cssRules))return!0}catch{return!0}return!1}function re(t){if(!t||t==="none"||t==="normal")return"";let n=(t.match(/"(?:[^"\\\\]|\\\\.)*"/g)??[]).map(o=>o.slice(1,-1).replace(/\\\\(.)/g,"$1"));if(/\\bcounters?\\(/.test(t))return u(t).slice(0,80);let i=u(n.join(""));return $(i)?i.slice(0,80):""}window.formfeedAudit=t=>F(window,t);})();';
5481
+ var pagedPrintRuntime = '"use strict";(()=>{var N=t=>!!t&&t.nodeType===1,y=t=>N(t)?t:t?.parentElement??null;function b(t,o){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(e.nodeName===o)return e;return null}var T=t=>Array.from(t.querySelectorAll(":scope > tbody > tr, :scope > tr"));function v(t,o){for(let e=t.parentElement;e&&!e.classList.contains("pagedjs_page_content");e=e.parentElement)if(o.getComputedStyle(e).display.startsWith("inline"))return!0;return!1}function O(t,o){for(let e=t;e&&e!==o;e=e.parentElement)for(let r=e.previousSibling;r;r=r.previousSibling)if(N(r)||(r.textContent??"").trim())return!0;return!1}function P(t){let o=t.cloneNode(!0);for(let e of[o,...Array.from(o.querySelectorAll("[id]"))])e.id&&(e.setAttribute("data-id",e.id),e.removeAttribute("id"));return o.setAttribute("data-ff-repeated",""),o}function k(t,o){for(let e of Array.from(t.querySelectorAll("table > tfoot"))){let r=e.nextElementSibling;for(;r&&r.nodeName!=="TBODY"&&r.nodeName!=="TR";)r=r.nextElementSibling;r&&o.getComputedStyle(e).display==="table-footer-group"&&e.parentNode?.appendChild(e)}}function H(t,o,e){let r=y(t),n=r?.closest("table");if(!r||!n||!n.hasAttribute("data-split-from")||n.hasAttribute("data-ff-head")||(n.setAttribute("data-ff-head",""),b(n,"THEAD")))return;let a=y(o)?.closest("table"),f=a&&b(a,"THEAD");if(!a||!f||v(n,e))return;let l=P(f),d=n.firstChild;for(;d&&(d.nodeName==="CAPTION"||d.nodeName==="COLGROUP");)d=d.nextSibling;if(n.insertBefore(l,d),e.getComputedStyle(l).display!=="table-header-group"){l.remove();return}for(let s=a.firstElementChild;s;s=s.nextElementSibling)s.nodeName==="COLGROUP"&&n.insertBefore(s.cloneNode(!0),l);let i=r.closest("tr"),u=i?.parentElement;i&&u&&u.parentElement===n&&u.nodeName!=="THEAD"&&(i.style.breakInside="auto",i.removeAttribute("data-break-inside"))}function w(t,o,e,r,n){let a=t.startContainer,f=N(a)?a.childNodes[t.startOffset]??a:a,l=y(f);if(!l)return;let d=l.nodeName==="TBODY"?l.querySelector("tr"):l.closest("tr"),i=d?.closest("table"),u=d?.parentElement;if(!d||!i||!u||u.nodeName==="THEAD"||u.nodeName==="TFOOT"||v(i,n))return;let s=T(i),h=s.indexOf(d);if(h<0)return;let m=h,E=0;if(h>0&&(f===d||f===u)){let p=r.querySelector(`[data-ref="${i.getAttribute("data-ref")??""}"]`),g=p&&b(p,"TFOOT");if(g){let c=g.cloneNode(!0);i.appendChild(c),n.getComputedStyle(c).display==="table-footer-group"&&(E=c.getBoundingClientRect().height),c.remove()}let C=Math.round(e),S=c=>!c||Math.floor(c.getBoundingClientRect().bottom)+E<=C;for(;m>0&&!S(s[m-1]);)m--}if(m===0){if(i.hasAttribute("data-split-from")||!b(i,"THEAD"))return;let p=i.previousElementSibling,g=i.getAttribute("data-previous-break-after")==="avoid"&&p?p:i;return O(g,o)?(t.setStartBefore(g),t):void 0}let A=s[m];return m<h&&A&&t.setStartBefore(A),E&&i.setAttribute("data-ff-foot",""),t}function R(t,o){let e=t.querySelector("table[data-ff-foot]");if(!e)return;e.removeAttribute("data-ff-foot");let r=o.querySelector(`[data-ref="${e.getAttribute("data-ref")??""}"]`),n=r&&b(r,"TFOOT");n&&e.appendChild(P(n))}function B(t){let o=t.querySelector(".pagedjs_pagebox");if(!o)return;let e=Array.from(o.children).filter(n=>!(n.getAttribute("class")??"").includes("pagedjs_")&&!n.hasAttribute("data-ff-fixed"));if(!e.length)return;let r=o.ownerDocument.createElement("div");r.setAttribute("data-ff-fixed",""),r.setAttribute("style","grid-column: center; grid-row: page; position: relative; pointer-events: none;");for(let n of e)"style"in n&&(n.style.pointerEvents="auto"),r.appendChild(n);o.appendChild(r)}function x(t){t.formfeedMoveTableFeet=()=>k(t.document,t);let o=t.Paged;if(!o?.Handler)return;class e extends o.Handler{renderNode(n,a){H(n,a,t)}onOverflow(n,a,f){return n?w(n,a,f.bottom,this.chunker.source,t):void 0}afterOverflowRemoved(n,a){R(a,this.chunker.source)}afterPageLayout(n){B(n)}}o.registerHandlers(e)}x(window);})();';
5481
5482
 
5482
5483
  // packages/engine/src/lib/assemble.ts
5483
5484
  var DEFAULT_CHROME_PADDING = "0 10mm";
@@ -5497,7 +5498,12 @@ function defaultSettings() {
5497
5498
  scale: 1,
5498
5499
  preferCssPageSize: false,
5499
5500
  pageRanges: "",
5500
- waitFor: { networkIdle: true, selector: null, timeoutMs: 5e3, delayMs: 0 },
5501
+ waitFor: {
5502
+ networkIdle: "auto",
5503
+ selector: null,
5504
+ timeoutMs: 5e3,
5505
+ delayMs: 0
5506
+ },
5501
5507
  pdf: { tagged: false, outline: false, metadata: { title: "", author: "" } },
5502
5508
  image: {
5503
5509
  width: 1200,
@@ -5572,12 +5578,12 @@ function fontFaceCss(fonts, referencedIn) {
5572
5578
  }).join("\n");
5573
5579
  }
5574
5580
  function chartInitScript() {
5575
- return `<script>window.formfeedDrawCharts=function(){if(typeof Chart==='undefined')return;var all=Chart.instances||{};for(var k in all){if(all[k]&&all[k].canvas&&!all[k].canvas.isConnected){try{all[k].destroy();}catch(e){}}}var cs=document.querySelectorAll('canvas[data-ff-chart]');for(var i=0;i<cs.length;i++){var c=cs[i];try{if(Chart.getChart(c))continue;var s=JSON.parse(c.getAttribute('data-ff-chart')||'{}');new Chart(c.getContext('2d'),s);c.setAttribute('data-ff-chart-ready','1');}catch(e){console.error('formfeed chart',e);}}};if(!window.PagedConfig){window.formfeedDrawCharts();}</script>`;
5581
+ return `<script data-formfeed="charts">window.formfeedDrawCharts=function(){if(typeof Chart==='undefined')return;var all=Chart.instances||{};for(var k in all){if(all[k]&&all[k].canvas&&!all[k].canvas.isConnected){try{all[k].destroy();}catch(e){}}}var cs=document.querySelectorAll('canvas[data-ff-chart]');for(var i=0;i<cs.length;i++){var c=cs[i];try{if(Chart.getChart(c))continue;var s=JSON.parse(c.getAttribute('data-ff-chart')||'{}');new Chart(c.getContext('2d'),s);c.setAttribute('data-ff-chart-ready','1');}catch(e){console.error('formfeed chart',e);}}};if(!window.PagedConfig){window.formfeedDrawCharts();}</script>`;
5576
5582
  }
5577
5583
  function chartScripts(html, vendor) {
5578
5584
  if (!vendor?.chartJs || !html.includes("data-ff-chart"))
5579
5585
  return { head: "", body: "" };
5580
- const lib = "inline" in vendor.chartJs ? `<script>${vendor.chartJs.inline}</script>` : `<script src="${escapeHtml(vendor.chartJs.src)}"></script>`;
5586
+ const lib = "inline" in vendor.chartJs ? `<script data-formfeed="chartjs">${vendor.chartJs.inline}</script>` : `<script data-formfeed="chartjs" src="${escapeHtml(vendor.chartJs.src)}"></script>`;
5581
5587
  return {
5582
5588
  head: `${lib}
5583
5589
  `,
@@ -5606,11 +5612,11 @@ ${brandFontFamilies(input.brand)}`
5606
5612
  const brandStyle = brand ? `<style data-formfeed="brand">${brand}</style>
5607
5613
  ` : "";
5608
5614
  const tailwind = settings.tailwind ? input.extraCss ? `<style data-formfeed="tailwind">${input.extraCss}</style>
5609
- ` : input.vendor?.tailwind ? `<script src="${escapeHtml(input.vendor.tailwind.src)}"></script>
5615
+ ` : input.vendor?.tailwind ? `<script data-formfeed="tailwind" src="${escapeHtml(input.vendor.tailwind.src)}"></script>
5610
5616
  ` : "" : input.extraCss ? `<style data-formfeed="extra">${input.extraCss}</style>
5611
5617
  ` : "";
5612
5618
  const charts = chartScripts(input.html, input.vendor);
5613
- const fit = input.html.includes("data-ff-fit") ? `<script>${fitRuntime.replace(/<\/script/gi, "<\\/script")}</script>
5619
+ const fit = input.html.includes("data-ff-fit") ? `<script data-formfeed="fit">${fitRuntime.replace(/<\/script/gi, "<\\/script")}</script>
5614
5620
  ` : "";
5615
5621
  return `<!doctype html>
5616
5622
  <html lang="${escapeHtml(locale.split("_")[0] ?? locale)}">
@@ -5928,14 +5934,15 @@ html { background: #e5e7eb; }
5928
5934
  `;
5929
5935
  const selectorGuard = `<script>(function(){var q=DocumentFragment.prototype.querySelectorAll;DocumentFragment.prototype.querySelectorAll=function(s){try{return q.call(this,s);}catch(e){console.warn('formfeed paged preview: skipped a selector Paged.js could not use:',s);return q.call(this,':not(*)');}};})();</script>`;
5930
5936
  const boxSizingGuard = `<script>(function(){var rule='.pagedjs_pagebox *';var o=new MutationObserver(function(ms){ms.forEach(function(m){m.addedNodes.forEach(function(n){if(n.nodeName==='STYLE'&&n.textContent&&n.textContent.indexOf(rule)>=0){n.textContent=n.textContent.split(rule).join('.pagedjs_pagebox [class*="pagedjs_"]');o.disconnect();}});});});o.observe(document.documentElement,{childList:true,subtree:true});})();</script>`;
5931
- const config = `<script>window.PagedConfig = { auto: true, after: function (flow) { try { if (window.formfeedDrawCharts) window.formfeedDrawCharts(); } catch (e) {} try { if (window.formfeedFit) window.formfeedFit(); } catch (e) {} try { parent.postMessage({ type: 'formfeed:pages', pages: flow.total }, '*'); } catch (e) {} if (window.formfeedCheckOverflow) window.formfeedCheckOverflow(); if (window.formfeedRunAudit) window.formfeedRunAudit(flow.total); try { if (window.formfeedEditReady) window.formfeedEditReady(); } catch (e) {} } };</script>`;
5937
+ const tables = `<script data-formfeed="paged-print">${pagedPrintRuntime.replace(/<\/script/gi, "<\\/script")}</script>`;
5938
+ const config = `<script>window.PagedConfig = { auto: true, before: function () { try { if (window.formfeedMoveTableFeet) window.formfeedMoveTableFeet(); } catch (e) {} }, after: function (flow) { try { if (window.formfeedDrawCharts) window.formfeedDrawCharts(); } catch (e) {} try { if (window.formfeedFit) window.formfeedFit(); } catch (e) {} try { parent.postMessage({ type: 'formfeed:pages', pages: flow.total }, '*'); } catch (e) {} if (window.formfeedCheckOverflow) window.formfeedCheckOverflow(); if (window.formfeedRunAudit) window.formfeedRunAudit(flow.total); try { if (window.formfeedEditReady) window.formfeedEditReady(); } catch (e) {} } };</script>`;
5932
5939
  const script = `<script src="${options.pagedScriptUrl}"></script>`;
5933
5940
  const header = headerHtml ? `<div class="ff-running-header">${pageNumberSpans(headerHtml, '<span class="ff-page-no"></span>', '<span class="ff-page-total"></span>')}</div>` : "";
5934
5941
  const footer = footerHtml ? `<div class="ff-running-footer">${pageNumberSpans(footerHtml, '<span class="ff-page-no"></span>', '<span class="ff-page-total"></span>')}</div>` : "";
5935
5942
  return intoBody(
5936
5943
  intoHead(
5937
5944
  draft.document,
5938
- `${documentMeta(options)}<style data-formfeed="paged">${runningCss}</style>${selectorGuard}${boxSizingGuard}${overflowScript("paged")}${options.audit ? auditScript("paged") : ""}${config}${script}${options.editing ? textEditScript : ""}${inspectScript}${pageNavScript}${zoomGestureScript}`
5945
+ `${documentMeta(options)}<style data-formfeed="paged">${runningCss}</style>${selectorGuard}${boxSizingGuard}${overflowScript("paged")}${options.audit ? auditScript("paged") : ""}${config}${script}${tables}${options.editing ? textEditScript : ""}${inspectScript}${pageNavScript}${zoomGestureScript}`
5939
5946
  ),
5940
5947
  `${header}${footer}`
5941
5948
  );
@@ -8558,15 +8565,24 @@ var FRENCH_FRAMEWORKS = /* @__PURE__ */ new Set([
8558
8565
  "B2",
8559
8566
  "S2",
8560
8567
  "M2",
8568
+ "S3",
8561
8569
  "B4",
8562
8570
  "S4",
8563
8571
  "M4",
8564
8572
  "S5",
8565
8573
  "S6",
8566
8574
  "B7",
8567
- "S7"
8575
+ "S7",
8576
+ "B8",
8577
+ "S8",
8578
+ "M8"
8568
8579
  ]);
8569
8580
  var FRENCH_OPERATION = { goods: "B1", services: "S1", mixed: "M1" };
8581
+ var FRENCH_NOTES = [
8582
+ ["PMT", "the fixed compensation of \u20AC40 for recovery costs"],
8583
+ ["PMD", "the penalties for late payment"],
8584
+ ["AAB", "the discount for early payment, or that none is given"]
8585
+ ];
8570
8586
  var CREDIT_TRANSFER = /* @__PURE__ */ new Set(["30", "58"]);
8571
8587
  function checkInvoice(data, options = {}) {
8572
8588
  const problems = [];
@@ -8624,7 +8640,7 @@ function checkInvoice(data, options = {}) {
8624
8640
  }
8625
8641
  const invoice = normalise(parsed.data, add2, options);
8626
8642
  if (problems.length > 0) return { ok: false, invoice: null, problems };
8627
- rules(invoice, add2);
8643
+ rules(invoice, add2, options);
8628
8644
  return problems.length > 0 ? { ok: false, invoice: null, problems } : { ok: true, invoice, problems: [] };
8629
8645
  }
8630
8646
  function pathText(path) {
@@ -9054,7 +9070,7 @@ function defined(value) {
9054
9070
  var cents = (text4) => text4 === void 0 ? 0n : toUnits(text4, 2);
9055
9071
  var money = (value) => fromUnits(value, 2);
9056
9072
  var rateKey = (tax) => `${tax.category}|${tax.rate ?? ""}`;
9057
- function rules(invoice, add2) {
9073
+ function rules(invoice, add2, options) {
9058
9074
  const { totals: totals2 } = invoice;
9059
9075
  const sum = (path, stated, expected, rule2, formula) => {
9060
9076
  if (stated !== expected)
@@ -9461,6 +9477,13 @@ function rules(invoice, add2) {
9461
9477
  { rule: "BR-CO-25" }
9462
9478
  );
9463
9479
  if (invoice.seller.address.country === "FR" && invoice.buyer.address.country === "FR") {
9480
+ if (options.profile === "basic")
9481
+ add2(
9482
+ "fr_profile",
9483
+ "",
9484
+ "_invoice is an invoice between French businesses, which France's e-invoicing reform does not accept in the profile basic (AFNOR XP Z12-012 takes EN 16931 and EXTENDED-CTC-FR); use en16931",
9485
+ { args: { profile: "basic" } }
9486
+ );
9464
9487
  const digits = (id) => (id?.value ?? "").replace(/\s/g, "");
9465
9488
  if (!/^\d{9}$/.test(digits(invoice.seller.legal_registration)))
9466
9489
  add2(
@@ -9502,6 +9525,29 @@ function rules(invoice, add2) {
9502
9525
  "seller.vat_on_debits",
9503
9526
  "_invoice.seller.vat_on_debits is missing: an invoice between French businesses says whether the seller pays VAT on invoicing (true) or on payment (false)"
9504
9527
  );
9528
+ const subjects = new Set(invoice.notes.map((note2) => note2.subject_code));
9529
+ for (const [code, what] of FRENCH_NOTES)
9530
+ if (!subjects.has(code))
9531
+ add2(
9532
+ "fr_note",
9533
+ "notes",
9534
+ `_invoice.notes has no note with the subject_code ${code}: an invoice between French businesses states ${what} as a note (BT-21, BT-22)`,
9535
+ { rule: "BR-FR-05", args: { subject_code: code } }
9536
+ );
9537
+ if (!invoice.seller.electronic_address)
9538
+ add2(
9539
+ "fr_electronic_address",
9540
+ "seller.electronic_address",
9541
+ "_invoice.seller.electronic_address is missing: an invoice between French businesses names the seller's electronic address (BT-34)",
9542
+ { rule: "BR-FR-13", args: { term: "BT-34" } }
9543
+ );
9544
+ if (!invoice.buyer.electronic_address)
9545
+ add2(
9546
+ "fr_electronic_address",
9547
+ "buyer.electronic_address",
9548
+ "_invoice.buyer.electronic_address is missing: an invoice between French businesses names the buyer's electronic address (BT-49)",
9549
+ { rule: "BR-FR-12", args: { term: "BT-49" } }
9550
+ );
9505
9551
  }
9506
9552
  }
9507
9553
 
@@ -9797,6 +9843,595 @@ ${children}${indent}</${element.name}>
9797
9843
  `;
9798
9844
  }
9799
9845
 
9846
+ // packages/engine/src/lib/einvoice/coverage.ts
9847
+ var EN16931_TERMS = [
9848
+ { term: "BT-1", name: "Invoice number", fields: ["number"] },
9849
+ { term: "BT-2", name: "Invoice issue date", fields: ["issue_date"] },
9850
+ { term: "BT-3", name: "Invoice type code", fields: ["type_code"] },
9851
+ { term: "BT-5", name: "Invoice currency code", fields: ["currency"] },
9852
+ {
9853
+ term: "BT-6",
9854
+ name: "VAT accounting currency code",
9855
+ fields: ["accounting_currency"]
9856
+ },
9857
+ { term: "BT-7", name: "Value added tax point date", fields: [] },
9858
+ {
9859
+ term: "BT-8",
9860
+ name: "Value added tax point date code",
9861
+ fields: ["seller.vat_on_debits"]
9862
+ },
9863
+ { term: "BT-9", name: "Payment due date", fields: ["payment.due_date"] },
9864
+ { term: "BT-10", name: "Buyer reference", fields: ["buyer_reference"] },
9865
+ { term: "BT-11", name: "Project reference", fields: [] },
9866
+ { term: "BT-12", name: "Contract reference", fields: ["contract_reference"] },
9867
+ {
9868
+ term: "BT-13",
9869
+ name: "Purchase order reference",
9870
+ fields: ["order_reference"]
9871
+ },
9872
+ { term: "BT-14", name: "Sales order reference", fields: [] },
9873
+ { term: "BT-15", name: "Receiving advice reference", fields: [] },
9874
+ { term: "BT-16", name: "Despatch advice reference", fields: [] },
9875
+ { term: "BT-17", name: "Tender or lot reference", fields: [] },
9876
+ { term: "BT-18", name: "Invoiced object identifier", fields: [] },
9877
+ { term: "BT-19", name: "Buyer accounting reference", fields: [] },
9878
+ { term: "BT-20", name: "Payment terms", fields: ["payment.terms"] },
9879
+ {
9880
+ term: "BT-21",
9881
+ name: "Invoice note subject code",
9882
+ fields: ["notes[].subject_code"]
9883
+ },
9884
+ { term: "BT-22", name: "Invoice note", fields: ["note", "notes[].text"] },
9885
+ {
9886
+ term: "BT-23",
9887
+ name: "Business process type",
9888
+ fields: ["operation", "operation_code"]
9889
+ },
9890
+ {
9891
+ term: "BT-24",
9892
+ name: "Specification identifier",
9893
+ fields: [],
9894
+ option: "profile"
9895
+ },
9896
+ {
9897
+ term: "BT-25",
9898
+ name: "Preceding Invoice reference",
9899
+ fields: ["preceding_invoices[].number"]
9900
+ },
9901
+ {
9902
+ term: "BT-26",
9903
+ name: "Preceding Invoice issue date",
9904
+ fields: ["preceding_invoices[].issue_date"]
9905
+ },
9906
+ { term: "BT-27", name: "Seller name", fields: ["seller.name"] },
9907
+ {
9908
+ term: "BT-28",
9909
+ name: "Seller trading name",
9910
+ fields: ["seller.trading_name"]
9911
+ },
9912
+ { term: "BT-29", name: "Seller identifier", fields: ["seller.id"] },
9913
+ {
9914
+ term: "BT-30",
9915
+ name: "Seller legal registration identifier",
9916
+ fields: ["seller.legal_registration"]
9917
+ },
9918
+ { term: "BT-31", name: "Seller VAT identifier", fields: ["seller.vat_id"] },
9919
+ {
9920
+ term: "BT-32",
9921
+ name: "Seller tax registration identifier",
9922
+ fields: ["seller.tax_number"]
9923
+ },
9924
+ {
9925
+ term: "BT-33",
9926
+ name: "Seller additional legal information",
9927
+ fields: ["seller.legal_info"],
9928
+ en16931Only: true
9929
+ },
9930
+ {
9931
+ term: "BT-34",
9932
+ name: "Seller electronic address",
9933
+ fields: ["seller.electronic_address"]
9934
+ },
9935
+ {
9936
+ term: "BT-35",
9937
+ name: "Seller address line 1",
9938
+ fields: ["seller.address.street"]
9939
+ },
9940
+ {
9941
+ term: "BT-36",
9942
+ name: "Seller address line 2",
9943
+ fields: ["seller.address.street2"]
9944
+ },
9945
+ { term: "BT-37", name: "Seller city", fields: ["seller.address.city"] },
9946
+ {
9947
+ term: "BT-38",
9948
+ name: "Seller post code",
9949
+ fields: ["seller.address.postcode"]
9950
+ },
9951
+ {
9952
+ term: "BT-39",
9953
+ name: "Seller country subdivision",
9954
+ fields: ["seller.address.subdivision"]
9955
+ },
9956
+ {
9957
+ term: "BT-40",
9958
+ name: "Seller country code",
9959
+ fields: ["seller.address.country"]
9960
+ },
9961
+ {
9962
+ term: "BT-41",
9963
+ name: "Seller contact point",
9964
+ fields: ["seller.contact.name"],
9965
+ en16931Only: true
9966
+ },
9967
+ {
9968
+ term: "BT-42",
9969
+ name: "Seller contact telephone number",
9970
+ fields: ["seller.contact.phone"],
9971
+ en16931Only: true
9972
+ },
9973
+ {
9974
+ term: "BT-43",
9975
+ name: "Seller contact email address",
9976
+ fields: ["seller.contact.email"],
9977
+ en16931Only: true
9978
+ },
9979
+ { term: "BT-44", name: "Buyer name", fields: ["buyer.name"] },
9980
+ { term: "BT-45", name: "Buyer trading name", fields: ["buyer.trading_name"] },
9981
+ { term: "BT-46", name: "Buyer identifier", fields: ["buyer.id"] },
9982
+ {
9983
+ term: "BT-47",
9984
+ name: "Buyer legal registration identifier",
9985
+ fields: ["buyer.legal_registration", "buyer.siren"]
9986
+ },
9987
+ { term: "BT-48", name: "Buyer VAT identifier", fields: ["buyer.vat_id"] },
9988
+ {
9989
+ term: "BT-49",
9990
+ name: "Buyer electronic address",
9991
+ fields: ["buyer.electronic_address"]
9992
+ },
9993
+ {
9994
+ term: "BT-50",
9995
+ name: "Buyer address line 1",
9996
+ fields: ["buyer.address.street"]
9997
+ },
9998
+ {
9999
+ term: "BT-51",
10000
+ name: "Buyer address line 2",
10001
+ fields: ["buyer.address.street2"]
10002
+ },
10003
+ { term: "BT-52", name: "Buyer city", fields: ["buyer.address.city"] },
10004
+ {
10005
+ term: "BT-53",
10006
+ name: "Buyer post code",
10007
+ fields: ["buyer.address.postcode"]
10008
+ },
10009
+ {
10010
+ term: "BT-54",
10011
+ name: "Buyer country subdivision",
10012
+ fields: ["buyer.address.subdivision"]
10013
+ },
10014
+ {
10015
+ term: "BT-55",
10016
+ name: "Buyer country code",
10017
+ fields: ["buyer.address.country"]
10018
+ },
10019
+ {
10020
+ term: "BT-56",
10021
+ name: "Buyer contact point",
10022
+ fields: ["buyer.contact.name"],
10023
+ en16931Only: true
10024
+ },
10025
+ {
10026
+ term: "BT-57",
10027
+ name: "Buyer contact telephone number",
10028
+ fields: ["buyer.contact.phone"],
10029
+ en16931Only: true
10030
+ },
10031
+ {
10032
+ term: "BT-58",
10033
+ name: "Buyer contact email address",
10034
+ fields: ["buyer.contact.email"],
10035
+ en16931Only: true
10036
+ },
10037
+ { term: "BT-59", name: "Payee name", fields: [] },
10038
+ { term: "BT-60", name: "Payee identifier", fields: [] },
10039
+ { term: "BT-61", name: "Payee legal registration identifier", fields: [] },
10040
+ { term: "BT-62", name: "Seller tax representative name", fields: [] },
10041
+ {
10042
+ term: "BT-63",
10043
+ name: "Seller tax representative VAT identifier",
10044
+ fields: []
10045
+ },
10046
+ { term: "BT-64", name: "Tax representative address line 1", fields: [] },
10047
+ { term: "BT-65", name: "Tax representative address line 2", fields: [] },
10048
+ { term: "BT-66", name: "Tax representative city", fields: [] },
10049
+ { term: "BT-67", name: "Tax representative post code", fields: [] },
10050
+ { term: "BT-68", name: "Tax representative country subdivision", fields: [] },
10051
+ { term: "BT-69", name: "Tax representative country code", fields: [] },
10052
+ { term: "BT-70", name: "Deliver to party name", fields: ["delivery.name"] },
10053
+ { term: "BT-71", name: "Deliver to location identifier", fields: [] },
10054
+ { term: "BT-72", name: "Actual delivery date", fields: ["delivery.date"] },
10055
+ {
10056
+ term: "BT-73",
10057
+ name: "Invoicing period start date",
10058
+ fields: ["period.start"]
10059
+ },
10060
+ { term: "BT-74", name: "Invoicing period end date", fields: ["period.end"] },
10061
+ {
10062
+ term: "BT-75",
10063
+ name: "Deliver to address line 1",
10064
+ fields: ["delivery.address.street"]
10065
+ },
10066
+ {
10067
+ term: "BT-76",
10068
+ name: "Deliver to address line 2",
10069
+ fields: ["delivery.address.street2"]
10070
+ },
10071
+ { term: "BT-77", name: "Deliver to city", fields: ["delivery.address.city"] },
10072
+ {
10073
+ term: "BT-78",
10074
+ name: "Deliver to post code",
10075
+ fields: ["delivery.address.postcode"]
10076
+ },
10077
+ {
10078
+ term: "BT-79",
10079
+ name: "Deliver to country subdivision",
10080
+ fields: ["delivery.address.subdivision"]
10081
+ },
10082
+ {
10083
+ term: "BT-80",
10084
+ name: "Deliver to country code",
10085
+ fields: ["delivery.address.country"]
10086
+ },
10087
+ {
10088
+ term: "BT-81",
10089
+ name: "Payment means type code",
10090
+ fields: ["payment.means_code"]
10091
+ },
10092
+ { term: "BT-82", name: "Payment means text", fields: [] },
10093
+ {
10094
+ term: "BT-83",
10095
+ name: "Remittance information",
10096
+ fields: ["payment.reference"]
10097
+ },
10098
+ {
10099
+ term: "BT-84",
10100
+ name: "Payment account identifier",
10101
+ fields: ["payment.iban"]
10102
+ },
10103
+ {
10104
+ term: "BT-85",
10105
+ name: "Payment account name",
10106
+ fields: ["payment.account_name"],
10107
+ en16931Only: true
10108
+ },
10109
+ {
10110
+ term: "BT-86",
10111
+ name: "Payment service provider identifier",
10112
+ fields: ["payment.bic"],
10113
+ en16931Only: true
10114
+ },
10115
+ { term: "BT-87", name: "Payment card primary account number", fields: [] },
10116
+ { term: "BT-88", name: "Payment card holder name", fields: [] },
10117
+ {
10118
+ term: "BT-89",
10119
+ name: "Mandate reference identifier",
10120
+ fields: ["payment.mandate_id"]
10121
+ },
10122
+ {
10123
+ term: "BT-90",
10124
+ name: "Bank assigned creditor identifier",
10125
+ fields: ["payment.creditor_id"]
10126
+ },
10127
+ {
10128
+ term: "BT-91",
10129
+ name: "Debited account identifier",
10130
+ fields: ["payment.debited_iban"]
10131
+ },
10132
+ {
10133
+ term: "BT-92",
10134
+ name: "Document level allowance amount",
10135
+ fields: ["allowances[].amount"]
10136
+ },
10137
+ {
10138
+ term: "BT-93",
10139
+ name: "Document level allowance base amount",
10140
+ fields: ["allowances[].base_amount"]
10141
+ },
10142
+ {
10143
+ term: "BT-94",
10144
+ name: "Document level allowance percentage",
10145
+ fields: ["allowances[].percent"]
10146
+ },
10147
+ {
10148
+ term: "BT-95",
10149
+ name: "Document level allowance VAT category code",
10150
+ fields: ["allowances[].tax.category"]
10151
+ },
10152
+ {
10153
+ term: "BT-96",
10154
+ name: "Document level allowance VAT rate",
10155
+ fields: ["allowances[].tax.rate"]
10156
+ },
10157
+ {
10158
+ term: "BT-97",
10159
+ name: "Document level allowance reason",
10160
+ fields: ["allowances[].reason"]
10161
+ },
10162
+ {
10163
+ term: "BT-98",
10164
+ name: "Document level allowance reason code",
10165
+ fields: ["allowances[].reason_code"]
10166
+ },
10167
+ {
10168
+ term: "BT-99",
10169
+ name: "Document level charge amount",
10170
+ fields: ["charges[].amount"]
10171
+ },
10172
+ {
10173
+ term: "BT-100",
10174
+ name: "Document level charge base amount",
10175
+ fields: ["charges[].base_amount"]
10176
+ },
10177
+ {
10178
+ term: "BT-101",
10179
+ name: "Document level charge percentage",
10180
+ fields: ["charges[].percent"]
10181
+ },
10182
+ {
10183
+ term: "BT-102",
10184
+ name: "Document level charge VAT category code",
10185
+ fields: ["charges[].tax.category"]
10186
+ },
10187
+ {
10188
+ term: "BT-103",
10189
+ name: "Document level charge VAT rate",
10190
+ fields: ["charges[].tax.rate"]
10191
+ },
10192
+ {
10193
+ term: "BT-104",
10194
+ name: "Document level charge reason",
10195
+ fields: ["charges[].reason"]
10196
+ },
10197
+ {
10198
+ term: "BT-105",
10199
+ name: "Document level charge reason code",
10200
+ fields: ["charges[].reason_code"]
10201
+ },
10202
+ {
10203
+ term: "BT-106",
10204
+ name: "Sum of Invoice line net amount",
10205
+ fields: ["totals.line_net"]
10206
+ },
10207
+ {
10208
+ term: "BT-107",
10209
+ name: "Sum of allowances on document level",
10210
+ fields: ["totals.allowances"]
10211
+ },
10212
+ {
10213
+ term: "BT-108",
10214
+ name: "Sum of charges on document level",
10215
+ fields: ["totals.charges"]
10216
+ },
10217
+ {
10218
+ term: "BT-109",
10219
+ name: "Invoice total amount without VAT",
10220
+ fields: ["totals.tax_basis"]
10221
+ },
10222
+ {
10223
+ term: "BT-110",
10224
+ name: "Invoice total VAT amount",
10225
+ fields: ["totals.tax_total"]
10226
+ },
10227
+ {
10228
+ term: "BT-111",
10229
+ name: "Invoice total VAT amount in accounting currency",
10230
+ fields: ["totals.tax_total_accounting"]
10231
+ },
10232
+ {
10233
+ term: "BT-112",
10234
+ name: "Invoice total amount with VAT",
10235
+ fields: ["totals.grand"]
10236
+ },
10237
+ { term: "BT-113", name: "Paid amount", fields: ["totals.prepaid"] },
10238
+ {
10239
+ term: "BT-114",
10240
+ name: "Rounding amount",
10241
+ fields: ["totals.rounding"],
10242
+ en16931Only: true
10243
+ },
10244
+ { term: "BT-115", name: "Amount due for payment", fields: ["totals.due"] },
10245
+ {
10246
+ term: "BT-116",
10247
+ name: "VAT category taxable amount",
10248
+ fields: ["tax.breakdown[].basis"]
10249
+ },
10250
+ {
10251
+ term: "BT-117",
10252
+ name: "VAT category tax amount",
10253
+ fields: ["tax.breakdown[].amount"]
10254
+ },
10255
+ {
10256
+ term: "BT-118",
10257
+ name: "VAT category code",
10258
+ fields: ["tax.breakdown[].category"]
10259
+ },
10260
+ {
10261
+ term: "BT-119",
10262
+ name: "VAT category rate",
10263
+ fields: ["tax.breakdown[].rate"]
10264
+ },
10265
+ {
10266
+ term: "BT-120",
10267
+ name: "VAT exemption reason text",
10268
+ fields: ["tax.breakdown[].exemption_reason"]
10269
+ },
10270
+ {
10271
+ term: "BT-121",
10272
+ name: "VAT exemption reason code",
10273
+ fields: ["tax.breakdown[].exemption_reason_code"]
10274
+ },
10275
+ { term: "BT-122", name: "Supporting document reference", fields: [] },
10276
+ { term: "BT-123", name: "Supporting document description", fields: [] },
10277
+ { term: "BT-124", name: "External document location", fields: [] },
10278
+ { term: "BT-125", name: "Attached document", fields: [] },
10279
+ { term: "BT-126", name: "Invoice line identifier", fields: ["lines[].id"] },
10280
+ { term: "BT-127", name: "Invoice line note", fields: ["lines[].note"] },
10281
+ { term: "BT-128", name: "Invoice line object identifier", fields: [] },
10282
+ { term: "BT-129", name: "Invoiced quantity", fields: ["lines[].quantity"] },
10283
+ {
10284
+ term: "BT-130",
10285
+ name: "Invoiced quantity unit of measure code",
10286
+ fields: ["lines[].unit_code"]
10287
+ },
10288
+ {
10289
+ term: "BT-131",
10290
+ name: "Invoice line net amount",
10291
+ fields: ["lines[].net_amount"]
10292
+ },
10293
+ {
10294
+ term: "BT-132",
10295
+ name: "Referenced purchase order line reference",
10296
+ fields: ["lines[].order_line_reference"],
10297
+ en16931Only: true
10298
+ },
10299
+ {
10300
+ term: "BT-133",
10301
+ name: "Invoice line Buyer accounting reference",
10302
+ fields: ["lines[].buyer_accounting_reference"],
10303
+ en16931Only: true
10304
+ },
10305
+ {
10306
+ term: "BT-134",
10307
+ name: "Invoice line period start date",
10308
+ fields: ["lines[].period.start"]
10309
+ },
10310
+ {
10311
+ term: "BT-135",
10312
+ name: "Invoice line period end date",
10313
+ fields: ["lines[].period.end"]
10314
+ },
10315
+ {
10316
+ term: "BT-136",
10317
+ name: "Invoice line allowance amount",
10318
+ fields: ["lines[].allowances[].amount"]
10319
+ },
10320
+ {
10321
+ term: "BT-137",
10322
+ name: "Invoice line allowance base amount",
10323
+ fields: ["lines[].allowances[].base_amount"]
10324
+ },
10325
+ {
10326
+ term: "BT-138",
10327
+ name: "Invoice line allowance percentage",
10328
+ fields: ["lines[].allowances[].percent"]
10329
+ },
10330
+ {
10331
+ term: "BT-139",
10332
+ name: "Invoice line allowance reason",
10333
+ fields: ["lines[].allowances[].reason"]
10334
+ },
10335
+ {
10336
+ term: "BT-140",
10337
+ name: "Invoice line allowance reason code",
10338
+ fields: ["lines[].allowances[].reason_code"]
10339
+ },
10340
+ {
10341
+ term: "BT-141",
10342
+ name: "Invoice line charge amount",
10343
+ fields: ["lines[].charges[].amount"]
10344
+ },
10345
+ {
10346
+ term: "BT-142",
10347
+ name: "Invoice line charge base amount",
10348
+ fields: ["lines[].charges[].base_amount"]
10349
+ },
10350
+ {
10351
+ term: "BT-143",
10352
+ name: "Invoice line charge percentage",
10353
+ fields: ["lines[].charges[].percent"]
10354
+ },
10355
+ {
10356
+ term: "BT-144",
10357
+ name: "Invoice line charge reason",
10358
+ fields: ["lines[].charges[].reason"]
10359
+ },
10360
+ {
10361
+ term: "BT-145",
10362
+ name: "Invoice line charge reason code",
10363
+ fields: ["lines[].charges[].reason_code"]
10364
+ },
10365
+ { term: "BT-146", name: "Item net price", fields: ["lines[].net_price"] },
10366
+ { term: "BT-147", name: "Item price discount", fields: [] },
10367
+ { term: "BT-148", name: "Item gross price", fields: [] },
10368
+ {
10369
+ term: "BT-149",
10370
+ name: "Item price base quantity",
10371
+ fields: ["lines[].price_base_quantity"]
10372
+ },
10373
+ {
10374
+ term: "BT-150",
10375
+ name: "Item price base quantity unit of measure",
10376
+ fields: ["lines[].unit_code"]
10377
+ },
10378
+ {
10379
+ term: "BT-151",
10380
+ name: "Invoiced item VAT category code",
10381
+ fields: ["lines[].tax.category"]
10382
+ },
10383
+ {
10384
+ term: "BT-152",
10385
+ name: "Invoiced item VAT rate",
10386
+ fields: ["lines[].tax.rate"]
10387
+ },
10388
+ { term: "BT-153", name: "Item name", fields: ["lines[].name"] },
10389
+ {
10390
+ term: "BT-154",
10391
+ name: "Item description",
10392
+ fields: ["lines[].description"],
10393
+ en16931Only: true
10394
+ },
10395
+ {
10396
+ term: "BT-155",
10397
+ name: "Item Sellers identifier",
10398
+ fields: ["lines[].seller_item_id"],
10399
+ en16931Only: true
10400
+ },
10401
+ {
10402
+ term: "BT-156",
10403
+ name: "Item Buyers identifier",
10404
+ fields: ["lines[].buyer_item_id"],
10405
+ en16931Only: true
10406
+ },
10407
+ {
10408
+ term: "BT-157",
10409
+ name: "Item standard identifier",
10410
+ fields: ["lines[].standard_item_id"]
10411
+ },
10412
+ { term: "BT-158", name: "Item classification identifier", fields: [] },
10413
+ { term: "BT-159", name: "Item country of origin", fields: [] },
10414
+ { term: "BT-160", name: "Item attribute name", fields: [] },
10415
+ { term: "BT-161", name: "Item attribute value", fields: [] },
10416
+ {
10417
+ term: "BT-162",
10418
+ name: "Seller address line 3",
10419
+ fields: ["seller.address.street3"]
10420
+ },
10421
+ {
10422
+ term: "BT-163",
10423
+ name: "Buyer address line 3",
10424
+ fields: ["buyer.address.street3"]
10425
+ },
10426
+ { term: "BT-164", name: "Tax representative address line 3", fields: [] },
10427
+ {
10428
+ term: "BT-165",
10429
+ name: "Deliver to address line 3",
10430
+ fields: ["delivery.address.street3"]
10431
+ }
10432
+ ];
10433
+ var carriesTerm = (term) => term.fields.length > 0 || term.option !== void 0;
10434
+
9800
10435
  // packages/engine/src/lib/einvoice/display.ts
9801
10436
  var DISPLAY_TERMS = {
9802
10437
  "BT-1": "invoice number",
@@ -10070,7 +10705,12 @@ function einvoiceResult(options, specVersion, validation, display) {
10070
10705
  valid: validation.valid,
10071
10706
  schematron: validation.schematron,
10072
10707
  pdfa: validation.pdfa,
10073
- ...capMessages(validation.messages)
10708
+ ...capMessages(validation.messages),
10709
+ // what judged which bytes: the report a business keeps as its proof names both
10710
+ ...validation.id ? { id: validation.id } : {},
10711
+ ...validation.versions ? { versions: validation.versions } : {},
10712
+ ...validation.xml_sha256 ? { xml_sha256: validation.xml_sha256 } : {},
10713
+ ...validation.pdf_sha256 !== void 0 ? { pdf_sha256: validation.pdf_sha256 } : {}
10074
10714
  } : null,
10075
10715
  display: display ? { checked: display.checked, missing: display.missing } : null
10076
10716
  };
@@ -13516,6 +14156,7 @@ export {
13516
14156
  EINVOICE_PROFILE_NAMES,
13517
14157
  EINVOICE_SPEC_VERSIONS,
13518
14158
  EINVOICE_XML_NAME,
14159
+ EN16931_TERMS,
13519
14160
  EPC_MAX_BYTES,
13520
14161
  EngineSyntaxError,
13521
14162
  INVOICE_DATA_KEY,
@@ -13544,6 +14185,7 @@ export {
13544
14185
  builtinHelpers,
13545
14186
  canvasDocument,
13546
14187
  capMessages,
14188
+ carriesTerm,
13547
14189
  chartInitScript,
13548
14190
  chartMarkup,
13549
14191
  chartPayload,