@formfeed/engine 0.3.21 → 0.3.23

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
@@ -101,7 +101,7 @@ function toNumber(value) {
101
101
  // packages/engine/src/lib/codes/epc.ts
102
102
  function epcPayload(input) {
103
103
  const amount2 = input.amount === void 0 || input.amount === "" ? "" : `EUR${toNumber(input.amount).toFixed(2)}`;
104
- return [
104
+ const elements = [
105
105
  "BCD",
106
106
  "002",
107
107
  "1",
@@ -113,8 +113,12 @@ function epcPayload(input) {
113
113
  (input.purpose ?? "").slice(0, 4),
114
114
  (input.reference ?? "").slice(0, 35),
115
115
  input.reference ? "" : (input.text ?? "").slice(0, 140),
116
+ // the beneficiary to originator information, which a payment here has no field for
116
117
  ""
117
- ].join("\n");
118
+ ];
119
+ while (elements.length > 0 && elements[elements.length - 1] === "")
120
+ elements.pop();
121
+ return elements.join("\n");
118
122
  }
119
123
  var IBAN_LENGTHS = {
120
124
  AD: 24,
@@ -171,34 +175,73 @@ function validateEpc(input) {
171
175
  const problems = [];
172
176
  const name = String(input.name ?? "").trim();
173
177
  if (!name) problems.push({ field: "name", code: "required" });
174
- else if (name.length > 70) problems.push({ field: "name", code: "too_long", max: 70, actual: name.length });
178
+ else if (name.length > 70)
179
+ problems.push({
180
+ field: "name",
181
+ code: "too_long",
182
+ max: 70,
183
+ actual: name.length
184
+ });
175
185
  const iban2 = normaliseIban(String(input.iban ?? ""));
176
186
  if (!iban2) problems.push({ field: "iban", code: "required" });
177
- else if (!/^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$/.test(iban2)) problems.push({ field: "iban", code: "iban_characters" });
187
+ else if (!/^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$/.test(iban2))
188
+ problems.push({ field: "iban", code: "iban_characters" });
178
189
  else {
179
190
  const expected = IBAN_LENGTHS[iban2.slice(0, 2)];
180
191
  if (expected !== void 0 && iban2.length !== expected)
181
- problems.push({ field: "iban", code: "iban_country_length", max: expected, actual: iban2.length });
182
- else if (!ibanChecksum(iban2)) problems.push({ field: "iban", code: "iban_checksum" });
192
+ problems.push({
193
+ field: "iban",
194
+ code: "iban_country_length",
195
+ max: expected,
196
+ actual: iban2.length
197
+ });
198
+ else if (!ibanChecksum(iban2))
199
+ problems.push({ field: "iban", code: "iban_checksum" });
183
200
  }
184
201
  const bic = String(input.bic ?? "").replace(/\s/g, "").toUpperCase();
185
- if (bic && !/^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$/.test(bic)) problems.push({ field: "bic", code: "bic_format" });
202
+ if (bic && !/^[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?$/.test(bic))
203
+ problems.push({ field: "bic", code: "bic_format" });
186
204
  if (input.amount !== void 0 && input.amount !== "") {
187
205
  const amount2 = toNumber(input.amount);
188
- if (Number.isNaN(amount2)) problems.push({ field: "amount", code: "not_a_number" });
189
- else if (amount2 < 0.01 || amount2 > 99999999999e-2) problems.push({ field: "amount", code: "out_of_range" });
206
+ if (Number.isNaN(amount2))
207
+ problems.push({ field: "amount", code: "not_a_number" });
208
+ else if (amount2 < 0.01 || amount2 > 99999999999e-2)
209
+ problems.push({ field: "amount", code: "out_of_range" });
190
210
  }
191
211
  const purpose = String(input.purpose ?? "");
192
- if (purpose.length > 4) problems.push({ field: "purpose", code: "too_long", max: 4, actual: purpose.length });
212
+ if (purpose.length > 4)
213
+ problems.push({
214
+ field: "purpose",
215
+ code: "too_long",
216
+ max: 4,
217
+ actual: purpose.length
218
+ });
193
219
  const reference = String(input.reference ?? "").trim();
194
220
  const text4 = String(input.text ?? "").trim();
195
- if (reference && text4) problems.push({ field: "reference", code: "reference_or_text" });
221
+ if (reference && text4)
222
+ problems.push({ field: "reference", code: "reference_or_text" });
196
223
  if (reference.length > 35)
197
- problems.push({ field: "reference", code: "too_long", max: 35, actual: reference.length });
198
- if (text4.length > 140) problems.push({ field: "text", code: "too_long", max: 140, actual: text4.length });
224
+ problems.push({
225
+ field: "reference",
226
+ code: "too_long",
227
+ max: 35,
228
+ actual: reference.length
229
+ });
230
+ if (text4.length > 140)
231
+ problems.push({
232
+ field: "text",
233
+ code: "too_long",
234
+ max: 140,
235
+ actual: text4.length
236
+ });
199
237
  const bytes = byteLength(epcPayload(input));
200
238
  if (bytes > EPC_MAX_BYTES)
201
- problems.push({ field: "payload", code: "too_long", max: EPC_MAX_BYTES, actual: bytes });
239
+ problems.push({
240
+ field: "payload",
241
+ code: "too_long",
242
+ max: EPC_MAX_BYTES,
243
+ actual: bytes
244
+ });
202
245
  return problems;
203
246
  }
204
247
 
@@ -5477,8 +5520,8 @@ function importJsreport(bundle, ref, options = {}) {
5477
5520
  var textEditRuntime = '"use strict";(()=>{var O=`\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 F(l,d={}){let m=d.clicks!==!1,g=d.live===!0,o=l.document,i=null,s=null,f=e=>{try{l.parent.postMessage(e,"*")}catch{}},v=m?o.querySelector(\'meta[name="formfeed:document"]\')?.getAttribute("content")??null:null,h=!1;l.addEventListener("blur",()=>{h=!0}),l.addEventListener("focus",()=>{h=!1});let y=o.createElement("style");y.setAttribute("data-formfeed","edit"),y.setAttribute("data-pagedjs-ignore",""),y.textContent=O,(o.head??o.documentElement).appendChild(y),m&&o.documentElement.classList.add("ff-edit-mode");let M=e=>(e&&typeof e.closest=="function"?e:null)?.closest("[data-ff-edit]")??null;o.addEventListener("click",e=>{if(!m)return;if(i&&!i.done&&i.element.contains(e.target)){e.stopImmediatePropagation();return}let t=M(e.target);t&&(e.preventDefault(),e.stopImmediatePropagation(),C(t,{x:e.clientX,y:e.clientY}))},!0);function C(e,t){i&&!i.done&&x();let n=e.getAttribute("data-ff-src")??"",r=e.getBoundingClientRect(),u=Array.from(o.querySelectorAll(`[data-ff-src="${n.replace(/"/g,"")}"]`));s={src:n,element:e,point:t},f({type:"formfeed:edit-request",src:n,doc:v,edit:e.getAttribute("data-ff-edit"),text:e.textContent??"",elements:e.childElementCount,count:u.length,index:Math.max(0,u.indexOf(e)),split:e.hasAttribute("data-split-from")||e.hasAttribute("data-split-to"),rect:{left:r.left,top:r.top,width:r.width,height:r.height}})}o.addEventListener("keydown",e=>{if(!m||i&&!i.done||!(e.ctrlKey||e.metaKey)||e.altKey)return;let t=e.key.toLowerCase();(t==="z"||t==="y")&&(e.preventDefault(),f({type:t==="y"||e.shiftKey?"formfeed:redo":"formfeed:undo"}))}),l.addEventListener("message",e=>{if(e.source!==l.parent)return;let t=e.data;!t||typeof t.type!="string"||(t.type==="formfeed:edit-begin"?P(t):t.type==="formfeed:edit-refuse"||t.type==="formfeed:edit-end"?(s=null,i&&!i.done&&E(!1)):t.type==="formfeed:edit-open"&&B(t))});function B(e){if(!m||typeof e.src!="string"||i&&!i.done)return;let t=Array.from(o.querySelectorAll(`[data-ff-src="${e.src.replace(/"/g,"")}"][data-ff-edit]`)),n=Number.isInteger(e.index)?Number(e.index):0,r=t[n]??t[0];r&&C(r,null)}if(m){let e=()=>f({type:"formfeed:edit-ready",doc:v}),t=l;t.PagedConfig?t.formfeedEditReady=e:o.readyState==="loading"?o.addEventListener("DOMContentLoaded",e):e()}function P(e){i&&!i.done&&E(!1);let t=e.layer?o.querySelector(`[data-ff-layer="${String(e.layer).replace(/"/g,"")}"] > .ff-text`):s&&s.src===e.src?s.element:o.querySelector(`[data-ff-src="${String(e.src).replace(/"/g,"")}"]`),n=e.at,r=e.layer?n&&Number.isFinite(n.x)&&Number.isFinite(n.y)?{x:Number(n.x),y:Number(n.y)}:null:s&&s.src===e.src?s.point:null;s=null;let u=h&&!o.hasFocus();if(!t||!Array.isArray(e.items)||u){f({type:"formfeed:edit-cancel",token:String(e.token)});return}let c=Array.from(t.childNodes),b=o.createDocumentFragment();for(let a of e.items)if(a.kind==="text")b.appendChild(o.createTextNode(String(a.text)));else if(a.kind==="break")b.appendChild(o.createElement("br"));else if(a.kind==="chip"){let p=o.createElement("span");p.className="ff-chip",p.setAttribute("data-ff-chip",String(a.index)),p.setAttribute("contenteditable","false"),a.title&&(p.title=String(a.title)),p.textContent=String(a.text),b.appendChild(p)}for(let a of c)t.removeChild(a);t.appendChild(b),t.contentEditable="true",t.classList.add("ff-editing"),t.setAttribute("role","textbox"),e.label&&t.setAttribute("aria-label",String(e.label)),t.spellcheck=!0,i={token:String(e.token),element:t,saved:c,allowBreaks:e.allowBreaks===!0,badge:e.note?H(t,String(e.note)):null,done:!1},t.addEventListener("keydown",A),t.addEventListener("beforeinput",T),t.addEventListener("paste",S),t.addEventListener("drop",N),t.addEventListener("focusout",R),g&&t.addEventListener("input",k),t.focus(),e.select==="all"?I(t):K(t,r),f({type:"formfeed:edit-started",token:i.token}),typeof e.insert=="string"&&e.insert&&L(e.insert.replace(/\\r\\n?|\\n/g," "))}function L(e){if(typeof o.execCommand=="function"&&o.execCommand("insertText",!1,e))return;let t=l.getSelection(),n=t&&t.rangeCount?t.getRangeAt(0):null;n&&(n.deleteContents(),n.insertNode(o.createTextNode(e)),n.collapse(!1),g&&k())}function k(){i&&!i.done&&f({type:"formfeed:edit-input",token:i.token,items:D(i.element)})}function H(e,t){let n=o.createElement("div");n.className="ff-edit-badge",n.textContent=t;let r=e.getBoundingClientRect();return n.style.left=`${r.left+l.scrollX}px`,n.style.top=`${Math.max(0,r.top+l.scrollY-22)}px`,o.body.appendChild(n),n}function I(e){let t=l.getSelection();if(!t)return;let n=o.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}function K(e,t){let n=l.getSelection();if(!n)return;let r=null,u=o;if(t){if(u.caretRangeFromPoint)r=u.caretRangeFromPoint(t.x,t.y);else if(u.caretPositionFromPoint){let c=u.caretPositionFromPoint(t.x,t.y);c&&(r=o.createRange(),r.setStart(c.offsetNode,c.offset))}}if(!r||!e.contains(r.startContainer))r=o.createRange(),r.selectNodeContents(e),r.collapse(!1);else if(t){let c=r.startContainer,a=(c.nodeType===1?c:c.parentElement)?.closest("[data-ff-chip]")??null;if(a&&a!==e&&e.contains(a)){let p=a.getBoundingClientRect();r=o.createRange(),t.x<p.left+p.width/2?r.setStartBefore(a):r.setStartAfter(a),r.collapse(!0)}}n.removeAllRanges(),n.addRange(r)}function A(e){let t=e.key;t==="Escape"?(e.preventDefault(),E(!0)):t==="Enter"&&!e.shiftKey?(e.preventDefault(),x()):t==="Enter"?(e.preventDefault(),i?.allowBreaks&&q()):t==="Tab"?(e.preventDefault(),x()):(e.ctrlKey||e.metaKey)&&["b","i","u"].includes(t.toLowerCase())&&(e.preventDefault(),g&&i&&!e.altKey&&f({type:"formfeed:edit-style",token:i.token,key:t.toLowerCase()}))}function T(e){let t=e.inputType??"";(t.startsWith("format")||t==="insertFromDrop"||t==="insertParagraph"||t==="insertLineBreak")&&e.preventDefault()}function S(e){e.preventDefault(),L((e.clipboardData?.getData("text/plain")??"").replace(/\\r\\n?|\\n/g," "))}function N(e){e.preventDefault()}function R(){l.setTimeout(()=>{i&&!i.done&&(!o.hasFocus()||!i.element.contains(o.activeElement))&&x()},0)}function q(){let e=l.getSelection();if(!e||!e.rangeCount)return;let t=e.getRangeAt(0);t.deleteContents();let n=o.createElement("br");t.insertNode(n),n.nextSibling||n.parentNode?.appendChild(o.createElement("br"));let r=o.createRange();r.setStartAfter(n),r.collapse(!0),e.removeAllRanges(),e.addRange(r)}function w(e){e.done=!0;let t=e.element;t.removeEventListener("keydown",A),t.removeEventListener("beforeinput",T),t.removeEventListener("paste",S),t.removeEventListener("drop",N),t.removeEventListener("focusout",R),t.removeEventListener("input",k),t.removeAttribute("contenteditable"),t.removeAttribute("role"),t.removeAttribute("aria-label"),t.classList.remove("ff-editing"),e.badge?.remove(),i===e&&(i=null)}function x(){let e=i;if(!e||e.done)return;let t=D(e.element);w(e),f({type:"formfeed:edit-commit",token:e.token,items:t})}function E(e){let t=i;if(!t||t.done)return;let n=t.element;for(;n.firstChild;)n.removeChild(n.firstChild);for(let r of t.saved)n.appendChild(r);w(t),e&&f({type:"formfeed:edit-cancel",token:t.token})}}function D(l){let d=[],m=o=>{let i=d[d.length-1];i?.kind==="text"?i.text+=o:o&&d.push({kind:"text",text:o})},g=o=>{for(let i of Array.from(o.childNodes))if(i.nodeType===3)m(i.data);else if(i.nodeType===1){let s=i,f=s.getAttribute("data-ff-chip");f!==null?d.push({kind:"chip",index:Number(f)}):s.tagName==="BR"?d.push({kind:"break"}):((s.tagName==="DIV"||s.tagName==="P")&&d.length&&d.push({kind:"break"}),g(s))}};for(g(l);d[d.length-1]?.kind==="break";)d.pop();return d}F(window);})();';
5478
5521
  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
5522
  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
- 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);})();';
5523
+ 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"),n.removeAttribute("data-ff-break");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);})();';
5524
+ var pagedPrintRuntime = '"use strict";(()=>{var A=t=>!!t&&t.nodeType===1,E=t=>A(t)?t:t?.parentElement??null;function g(t,r){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(e.nodeName===r)return e;return null}var T=t=>Array.from(t.querySelectorAll(":scope > tbody > tr, :scope > tr"));function S(t,r){for(let e=t.parentElement;e&&!e.classList.contains("pagedjs_page_content");e=e.parentElement)if(r.getComputedStyle(e).display.startsWith("inline"))return!0;return!1}function O(t,r){for(let e=t;e&&e!==r;e=e.parentElement)for(let o=e.previousSibling;o;o=o.previousSibling)if(A(o)||(o.textContent??"").trim())return!0;return!1}function P(t){let r=t.cloneNode(!0);for(let e of[r,...Array.from(r.querySelectorAll("[id]"))])e.id&&(e.setAttribute("data-id",e.id),e.removeAttribute("id"));return r.setAttribute("data-ff-repeated",""),r}function w(t,r){for(let e of Array.from(t.querySelectorAll("table > tfoot"))){let o=e.nextElementSibling;for(;o&&o.nodeName!=="TBODY"&&o.nodeName!=="TR";)o=o.nextElementSibling;o&&r.getComputedStyle(e).display==="table-footer-group"&&e.parentNode?.appendChild(e)}}function H(t,r,e){let o=E(t),n=o?.closest("table");if(!o||!n||!n.hasAttribute("data-split-from")||n.hasAttribute("data-ff-head")||(n.setAttribute("data-ff-head",""),g(n,"THEAD")))return;let a=E(r)?.closest("table"),s=a&&g(a,"THEAD");if(!a||!s||S(n,e))return;let d=P(s),i=n.firstChild;for(;i&&(i.nodeName==="CAPTION"||i.nodeName==="COLGROUP");)i=i.nextSibling;if(n.insertBefore(d,i),e.getComputedStyle(d).display!=="table-header-group"){d.remove();return}for(let f=a.firstElementChild;f;f=f.nextElementSibling)f.nodeName==="COLGROUP"&&n.insertBefore(f.cloneNode(!0),d);let l=o.closest("tr"),u=l?.parentElement;l&&u&&u.parentElement===n&&u.nodeName!=="THEAD"&&(l.style.breakInside="auto",l.removeAttribute("data-break-inside"))}function R(t,r,e,o,n){let a=t.startContainer,s=A(a)?a.childNodes[t.startOffset]??a:a,d=E(s);if(!d)return;let i=d.nodeName==="TBODY"?d.querySelector("tr"):d.closest("tr"),l=i?.closest("table"),u=i?.parentElement;if(!i||!l||!u||u.nodeName==="THEAD"||u.nodeName==="TFOOT"||S(l,n))return;let f=T(l),h=f.indexOf(i);if(h<0)return;let m=h,y=0;if(h>0&&(s===i||s===u)){let p=o.querySelector(`[data-ref="${l.getAttribute("data-ref")??""}"]`),b=p&&g(p,"TFOOT");if(b){let c=b.cloneNode(!0);l.appendChild(c),n.getComputedStyle(c).display==="table-footer-group"&&(y=c.getBoundingClientRect().height),c.remove()}let x=Math.round(e),k=c=>!c||Math.floor(c.getBoundingClientRect().bottom)+y<=x;for(;m>0&&!k(f[m-1]);)m--}if(m===0){if(l.hasAttribute("data-split-from")||!g(l,"THEAD"))return;let p=l.previousElementSibling,b=l.getAttribute("data-previous-break-after")==="avoid"&&p?p:l;return O(b,r)?(t.setStartBefore(b),t):void 0}let v=f[m];return m<h&&v&&t.setStartBefore(v),y&&l.setAttribute("data-ff-foot",""),t}function q(t,r){let e=t.querySelector("table[data-ff-foot]");if(!e)return;e.removeAttribute("data-ff-foot");let o=r.querySelector(`[data-ref="${e.getAttribute("data-ref")??""}"]`),n=o&&g(o,"TFOOT");n&&e.appendChild(P(n))}function B(t){let r=t.querySelector(".pagedjs_pagebox");if(!r)return;let e=Array.from(r.children).filter(n=>!(n.getAttribute("class")??"").includes("pagedjs_")&&!n.hasAttribute("data-ff-fixed"));if(!e.length)return;let o=r.ownerDocument.createElement("div");o.setAttribute("data-ff-fixed",""),o.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"),o.appendChild(n);r.appendChild(o)}var N=".ff-running-header, .ff-running-footer";function D(t){let{head:r,body:e}=t;for(let a of Array.from(e.querySelectorAll("style")))a.namespaceURI==="http://www.w3.org/1999/xhtml"&&!a.closest(N)&&r.appendChild(a);let o=[];for(let a of Array.from(e.querySelectorAll("[style]"))){if(a.closest(N))continue;let s=["break-before","break-after","page"].flatMap(d=>{let i=a.style.getPropertyValue(d);return!/^[\\w-]+$/.test(i)||i==="auto"?[]:(a.style.removeProperty(d),[`${d}: ${i};`])});s.length&&(a.style.length||a.removeAttribute("style"),a.setAttribute("data-ff-break",String(o.length)),o.push(`[data-ff-break="${o.length}"] { ${s.join(" ")} }`))}if(!o.length)return;let n=t.createElement("style");n.textContent=o.join(`\n`),r.appendChild(n)}function F(t){for(let r of["data-break-before","data-break-after","data-next-break-before","data-previous-break-after"])for(let e of Array.from(t.querySelectorAll(`[${r}]`)))/^(left|right|recto|verso)$/.test(e.getAttribute(r)??"")&&e.setAttribute(r,"page")}function C(t){t.formfeedMoveTableFeet=()=>w(t.document,t),t.formfeedShowStyles=()=>D(t.document);let r=t.Paged;if(!r?.Handler)return;class e extends r.Handler{afterParsed(n){F(n)}renderNode(n,a){H(n,a,t)}onOverflow(n,a,s){return n?R(n,a,s.bottom,this.chunker.source,t):void 0}afterOverflowRemoved(n,a){q(a,this.chunker.source)}afterPageLayout(n){B(n)}}r.registerHandlers(e)}C(window);})();';
5482
5525
 
5483
5526
  // packages/engine/src/lib/assemble.ts
5484
5527
  var DEFAULT_CHROME_PADDING = "0 10mm";
@@ -5806,6 +5849,14 @@ function overflowScript(mode) {
5806
5849
  if (getComputedStyle(p).overflowX !== 'visible') return true;
5807
5850
  return false;
5808
5851
  };
5852
+ // a named page has a size of its own, which the flow preview's one sheet says nothing about
5853
+ var named = function (el, stop) {
5854
+ for (var p = el; p && p !== stop; p = p.parentElement) {
5855
+ var page = getComputedStyle(p).page;
5856
+ if (page && page !== 'auto') return true;
5857
+ }
5858
+ return false;
5859
+ };
5809
5860
  var measure = function () {
5810
5861
  try {
5811
5862
  var boxes = ${mode === "paged" ? "document.querySelectorAll('.pagedjs_page_content')" : "[document.body]"};
@@ -5823,7 +5874,7 @@ function overflowScript(mode) {
5823
5874
  if (el.closest('.formfeed-chrome, .ff-running-header, .ff-running-footer, script, style, head')) continue;
5824
5875
  var over = el.getBoundingClientRect().right - right;
5825
5876
  if (over <= 1 || (worst && over <= worst.over)) continue;
5826
- if (getComputedStyle(el).position === 'fixed' || clipped(el, box)) continue;
5877
+ if (getComputedStyle(el).position === 'fixed' || clipped(el, box)${mode === "flow" ? " || named(el, box)" : ""}) continue;
5827
5878
  worst = { over: over, width: right - left, el: el };
5828
5879
  }
5829
5880
  }
@@ -5929,9 +5980,11 @@ function pagedDocument(draft, options) {
5929
5980
  .ff-running-header { position: running(ffHeader); }
5930
5981
  .ff-running-footer { position: running(ffFooter); }
5931
5982
  .ff-running-header, .ff-running-footer { color: #6b7280; font: 10px/1.3 system-ui, sans-serif; }
5932
- /* Chromium prints the header at the top edge and the footer at the bottom edge; margin boxes centre */
5933
- .pagedjs_margin-top-center { align-items: flex-start !important; }
5934
- .pagedjs_margin-bottom-center { align-items: flex-end !important; }
5983
+ /* Chromium prints the header at the top edge and the footer at the bottom edge; margin boxes centre, and a template's own stay centred */
5984
+ ${headerHtml ? ".pagedjs_margin-top-center { align-items: flex-start !important; }" : ""}
5985
+ ${footerHtml ? ".pagedjs_margin-bottom-center { align-items: flex-end !important; }" : ""}
5986
+ /* Paged.js gives a named page's size to its page box only, so a landscape section stood on an upright sheet that cut it off */
5987
+ .pagedjs_named_page { --pagedjs-width: var(--pagedjs-pagebox-width); --pagedjs-height: var(--pagedjs-pagebox-height); --pagedjs-width-right: var(--pagedjs-pagebox-width); --pagedjs-height-right: var(--pagedjs-pagebox-height); --pagedjs-width-left: var(--pagedjs-pagebox-width); --pagedjs-height-left: var(--pagedjs-pagebox-height); }
5935
5988
  .ff-running-header { ${chromeBoxStyle(settings, "header")} }
5936
5989
  .ff-running-footer { ${chromeBoxStyle(settings, "footer")} }
5937
5990
  .ff-page-no::after { content: counter(page); }
@@ -5943,7 +5996,7 @@ html { background: #e5e7eb; }
5943
5996
  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>`;
5944
5997
  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>`;
5945
5998
  const tables = `<script data-formfeed="paged-print">${pagedPrintRuntime.replace(/<\/script/gi, "<\\/script")}</script>`;
5946
- 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>`;
5999
+ const config = `<script>window.PagedConfig = { auto: true, before: function () { try { if (window.formfeedShowStyles) window.formfeedShowStyles(); } catch (e) {} 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>`;
5947
6000
  const script = `<script src="${options.pagedScriptUrl}"></script>`;
5948
6001
  const header = headerHtml ? `<div class="ff-running-header">${pageNumberSpans(headerHtml, '<span class="ff-page-no"></span>', '<span class="ff-page-total"></span>')}</div>` : "";
5949
6002
  const footer = footerHtml ? `<div class="ff-running-footer">${pageNumberSpans(footerHtml, '<span class="ff-page-no"></span>', '<span class="ff-page-total"></span>')}</div>` : "";
@@ -11278,6 +11331,89 @@ function staticAudit(input) {
11278
11331
  return findings;
11279
11332
  }
11280
11333
 
11334
+ // packages/engine/src/lib/pdfa/index.ts
11335
+ var PDFA_LEVELS = ["2b", "3b"];
11336
+ var PDFA_DEFAULT_LEVEL = "3b";
11337
+ var PDFA_STANDARDS = {
11338
+ "2b": "PDF/A-2b",
11339
+ "3b": "PDF/A-3b"
11340
+ };
11341
+ function resolvePdfa(setting) {
11342
+ if (setting === true) return PDFA_DEFAULT_LEVEL;
11343
+ return typeof setting === "string" && PDFA_LEVELS.includes(setting) ? setting : null;
11344
+ }
11345
+ function isPdfaSetting(value) {
11346
+ return value === null || typeof value === "boolean" || typeof value === "string" && PDFA_LEVELS.includes(value);
11347
+ }
11348
+ function pdfaStandard(level) {
11349
+ return PDFA_STANDARDS[level];
11350
+ }
11351
+ var PDFA_REFUSALS = {
11352
+ password: "pdf.pdfa cannot be combined with post.password: PDF/A does not allow encryption",
11353
+ einvoice: 'pdf.pdfa "2b" cannot be combined with an e-invoice: the invoice XML is an attachment, which PDF/A-2 does not allow. An e-invoice is a PDF/A-3b already; ask for "3b" or leave pdf.pdfa out',
11354
+ invalid: 'settings.pdf.pdfa is "2b", "3b", true, false or null'
11355
+ };
11356
+ var PDFA_MAX_MESSAGES = 50;
11357
+ var asMessage = (message) => ({
11358
+ severity: message.severity === "warning" ? "warning" : "error",
11359
+ rule: typeof message.rule === "string" ? message.rule : null,
11360
+ message: typeof message.message === "string" ? message.message : "",
11361
+ location: typeof message.location === "string" ? message.location : null
11362
+ });
11363
+ var capped = (messages, truncated) => {
11364
+ const sorted = [
11365
+ ...messages.filter((message) => message.severity === "error"),
11366
+ ...messages.filter((message) => message.severity !== "error")
11367
+ ];
11368
+ return sorted.length > PDFA_MAX_MESSAGES || truncated ? { messages: sorted.slice(0, PDFA_MAX_MESSAGES), truncated: true } : { messages: sorted };
11369
+ };
11370
+ function pdfaResult(level, report, pdfSha256) {
11371
+ return {
11372
+ standard: PDFA_STANDARDS[level],
11373
+ conformant: report.valid === true,
11374
+ validator: report.validator,
11375
+ id: report.id,
11376
+ versions: { ...report.versions ?? {} },
11377
+ pdf_sha256: pdfSha256,
11378
+ ...capped(
11379
+ (Array.isArray(report.messages) ? report.messages : []).map(asMessage),
11380
+ report.truncated === true
11381
+ )
11382
+ };
11383
+ }
11384
+ function pdfaFromEinvoice(validation) {
11385
+ if (!validation || validation.pdfa == null) return null;
11386
+ const messages = validation.messages.filter((message) => message.part === "pdf").map((message) => ({
11387
+ severity: message.severity,
11388
+ rule: message.rule,
11389
+ message: message.message,
11390
+ location: message.location
11391
+ }));
11392
+ const versions = { ...validation.versions ?? {} };
11393
+ return {
11394
+ standard: PDFA_STANDARDS["3b"],
11395
+ conformant: !messages.some((message) => message.severity === "error"),
11396
+ validator: `veraPDF ${versions["verapdf"] ?? "unknown"}`,
11397
+ id: validation.id ?? "",
11398
+ versions,
11399
+ pdf_sha256: validation.pdf_sha256 ?? null,
11400
+ ...capped(messages, false)
11401
+ };
11402
+ }
11403
+ function isPdfaResult(value) {
11404
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
11405
+ const report = value;
11406
+ return typeof report.standard === "string" && Object.values(PDFA_STANDARDS).includes(report.standard) && typeof report.conformant === "boolean";
11407
+ }
11408
+ var PDFA_HEADER_LENGTH = 2e3;
11409
+ function pdfaHeaderValue(result, limit = PDFA_HEADER_LENGTH) {
11410
+ const value = encodeURIComponent(JSON.stringify(result));
11411
+ if (value.length <= limit) return value;
11412
+ return encodeURIComponent(
11413
+ JSON.stringify({ ...result, messages: [], truncated: true })
11414
+ );
11415
+ }
11416
+
11281
11417
  // packages/engine/src/lib/office/errors.ts
11282
11418
  var OfficeError = class extends Error {
11283
11419
  constructor(code, message, details = {}) {
@@ -14201,6 +14337,12 @@ export {
14201
14337
  INVOICE_DATA_KEY,
14202
14338
  OFFICE_FILLED_MAX_BYTES,
14203
14339
  OfficeTemplateError,
14340
+ PDFA_DEFAULT_LEVEL,
14341
+ PDFA_HEADER_LENGTH,
14342
+ PDFA_LEVELS,
14343
+ PDFA_MAX_MESSAGES,
14344
+ PDFA_REFUSALS,
14345
+ PDFA_STANDARDS,
14204
14346
  PDFUA_STANDARD,
14205
14347
  RenderError,
14206
14348
  RenderLimitError,
@@ -14293,6 +14435,8 @@ export {
14293
14435
  isApitemplateRegion,
14294
14436
  isOfficeKind,
14295
14437
  isOutputFormat,
14438
+ isPdfaResult,
14439
+ isPdfaSetting,
14296
14440
  isScss,
14297
14441
  isUaSetting,
14298
14442
  jinja2Engine,
@@ -14325,6 +14469,10 @@ export {
14325
14469
  parseDesign,
14326
14470
  parseSourceAttribute,
14327
14471
  partialInclude,
14472
+ pdfaFromEinvoice,
14473
+ pdfaHeaderValue,
14474
+ pdfaResult,
14475
+ pdfaStandard,
14328
14476
  printReset,
14329
14477
  qrSvg,
14330
14478
  readJsreportExport,
@@ -14335,6 +14483,7 @@ export {
14335
14483
  renderVersion,
14336
14484
  resolveEinvoiceOptions,
14337
14485
  resolvePath,
14486
+ resolvePdfa,
14338
14487
  resolveTranslation,
14339
14488
  resolveUa,
14340
14489
  scanBlocks,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formfeed/engine",
3
- "version": "0.3.21",
3
+ "version": "0.3.23",
4
4
  "description": "The Formfeed template engine (Jinja2, Liquid, Handlebars) for the browser and Node.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -13,8 +13,8 @@
13
13
  * `paged-preview.spec.ts` holds the preview to those PDFs.
14
14
  *
15
15
  * `pagedDocument` adds it after Paged.js's script; its `PagedConfig.before` calls
16
- * `formfeedMoveTableFeet` while the document is still the one the template wrote. Bundled by
17
- * `engine:frames`; keep it self-contained.
16
+ * `formfeedShowStyles` and `formfeedMoveTableFeet` while the document is still the one the template
17
+ * wrote. Bundled by `engine:frames`; keep it self-contained.
18
18
  */
19
19
  /** The part of Paged.js this runtime uses (`window.Paged`, a UMD global of the polyfill). */
20
20
  interface PagedChunker {
@@ -29,6 +29,7 @@ interface PagedGlobal {
29
29
  type PagedWindow = Window & {
30
30
  Paged?: PagedGlobal;
31
31
  formfeedMoveTableFeet?: () => void;
32
+ formfeedShowStyles?: () => void;
32
33
  };
33
34
  /**
34
35
  * HTML lets a `tfoot` stand before the `tbody`. Chromium draws a footer group at the table's foot
@@ -13,8 +13,8 @@
13
13
  * `paged-preview.spec.ts` holds the preview to those PDFs.
14
14
  *
15
15
  * `pagedDocument` adds it after Paged.js's script; its `PagedConfig.before` calls
16
- * `formfeedMoveTableFeet` while the document is still the one the template wrote. Bundled by
17
- * `engine:frames`; keep it self-contained.
16
+ * `formfeedShowStyles` and `formfeedMoveTableFeet` while the document is still the one the template
17
+ * wrote. Bundled by `engine:frames`; keep it self-contained.
18
18
  */
19
19
  /** The part of Paged.js this runtime uses (`window.Paged`, a UMD global of the polyfill). */
20
20
  interface PagedChunker {
@@ -29,6 +29,7 @@ interface PagedGlobal {
29
29
  type PagedWindow = Window & {
30
30
  Paged?: PagedGlobal;
31
31
  formfeedMoveTableFeet?: () => void;
32
+ formfeedShowStyles?: () => void;
32
33
  };
33
34
  /**
34
35
  * HTML lets a `tfoot` stand before the `tbody`. Chromium draws a footer group at the table's foot
package/types/index.d.cts CHANGED
@@ -35,6 +35,8 @@ export type { CheckOptions, DisplayCheck, DisplayValue, EinvoiceDisplay, Einvoic
35
35
  export { ACCESSIBILITY_HEADER_LENGTH, ACCESSIBILITY_MAX_ELEMENTS, ACCESSIBILITY_MAX_FAILURES, AUDIT_CODES, AUDIT_RULES, AUDIT_SEVERITY, AUDIT_SNIPPET_LENGTH, AUDIT_TITLES, PDFUA_STANDARD, UA_CHECKS, UA_REFUSALS, accessibilityHeader, accessibilityHeaderValue, accessibilityResult, auditMessage, isUaSetting, resolveUa, } from './lib/accessibility/index.cjs';
36
36
  export type { AccessibilityFailure, AccessibilityResult, AccessibilityWarning, AuditArgs, AuditCode, AuditFinding, AuditLink, AuditOptions, AuditReport, AuditSeverity, UaCheck, UaOptions, UaSetting, ValidatorFailure, ValidatorVerdict, } from './lib/accessibility/index.cjs';
37
37
  export { staticAudit, staticAuditDiagnostics, } from './lib/accessibility/static.cjs';
38
+ export { PDFA_DEFAULT_LEVEL, PDFA_HEADER_LENGTH, PDFA_LEVELS, PDFA_MAX_MESSAGES, PDFA_REFUSALS, PDFA_STANDARDS, isPdfaResult, isPdfaSetting, pdfaFromEinvoice, pdfaHeaderValue, pdfaResult, pdfaStandard, resolvePdfa, } from './lib/pdfa/index.cjs';
39
+ export type { PdfaLevel, PdfaMessage, PdfaResult, PdfaSetting, PdfaStandard, PdfaValidatorReport, } from './lib/pdfa/index.cjs';
38
40
  export type { StaticAuditDiagnostic, StaticAuditInput, } from './lib/accessibility/static.cjs';
39
41
  export { auditRuntime } from './lib/generated/frames.cjs';
40
42
  export { encodeTemplateText } from './lib/source-edit.cjs';
package/types/index.d.ts CHANGED
@@ -35,6 +35,8 @@ export type { CheckOptions, DisplayCheck, DisplayValue, EinvoiceDisplay, Einvoic
35
35
  export { ACCESSIBILITY_HEADER_LENGTH, ACCESSIBILITY_MAX_ELEMENTS, ACCESSIBILITY_MAX_FAILURES, AUDIT_CODES, AUDIT_RULES, AUDIT_SEVERITY, AUDIT_SNIPPET_LENGTH, AUDIT_TITLES, PDFUA_STANDARD, UA_CHECKS, UA_REFUSALS, accessibilityHeader, accessibilityHeaderValue, accessibilityResult, auditMessage, isUaSetting, resolveUa, } from './lib/accessibility/index.js';
36
36
  export type { AccessibilityFailure, AccessibilityResult, AccessibilityWarning, AuditArgs, AuditCode, AuditFinding, AuditLink, AuditOptions, AuditReport, AuditSeverity, UaCheck, UaOptions, UaSetting, ValidatorFailure, ValidatorVerdict, } from './lib/accessibility/index.js';
37
37
  export { staticAudit, staticAuditDiagnostics, } from './lib/accessibility/static.js';
38
+ export { PDFA_DEFAULT_LEVEL, PDFA_HEADER_LENGTH, PDFA_LEVELS, PDFA_MAX_MESSAGES, PDFA_REFUSALS, PDFA_STANDARDS, isPdfaResult, isPdfaSetting, pdfaFromEinvoice, pdfaHeaderValue, pdfaResult, pdfaStandard, resolvePdfa, } from './lib/pdfa/index.js';
39
+ export type { PdfaLevel, PdfaMessage, PdfaResult, PdfaSetting, PdfaStandard, PdfaValidatorReport, } from './lib/pdfa/index.js';
38
40
  export type { StaticAuditDiagnostic, StaticAuditInput, } from './lib/accessibility/static.js';
39
41
  export { auditRuntime } from './lib/generated/frames.js';
40
42
  export { encodeTemplateText } from './lib/source-edit.js';
@@ -1,4 +1,5 @@
1
1
  import type { UaSetting } from './accessibility/index.cjs';
2
+ import type { PdfaSetting } from './pdfa/index.cjs';
2
3
  import type { BrandContext } from './brand.cjs';
3
4
  import type { EinvoiceOptionsInput } from './einvoice/schema.cjs';
4
5
  import type { EngineId, RenderContext } from './types.cjs';
@@ -56,6 +57,13 @@ export interface TemplateSettings {
56
57
  * implies `tagged`. Read it through `resolveUa`.
57
58
  */
58
59
  ua?: UaSetting;
60
+ /**
61
+ * PDF/A (plan 26): the finished PDF is converted to PDF/A-2b or PDF/A-3b and held to it by the
62
+ * validator; a file that fails fails the render, there is no mode that delivers it. `true` is
63
+ * `'3b'`. An e-invoice is a PDF/A-3b already, so `'2b'` beside one is refused. Read it through
64
+ * `resolvePdfa`.
65
+ */
66
+ pdfa?: PdfaSetting;
59
67
  metadata?: {
60
68
  title?: string;
61
69
  author?: string;
@@ -1,4 +1,5 @@
1
1
  import type { UaSetting } from './accessibility/index.js';
2
+ import type { PdfaSetting } from './pdfa/index.js';
2
3
  import type { BrandContext } from './brand.js';
3
4
  import type { EinvoiceOptionsInput } from './einvoice/schema.js';
4
5
  import type { EngineId, RenderContext } from './types.js';
@@ -56,6 +57,13 @@ export interface TemplateSettings {
56
57
  * implies `tagged`. Read it through `resolveUa`.
57
58
  */
58
59
  ua?: UaSetting;
60
+ /**
61
+ * PDF/A (plan 26): the finished PDF is converted to PDF/A-2b or PDF/A-3b and held to it by the
62
+ * validator; a file that fails fails the render, there is no mode that delivers it. `true` is
63
+ * `'3b'`. An e-invoice is a PDF/A-3b already, so `'2b'` beside one is refused. Read it through
64
+ * `resolvePdfa`.
65
+ */
66
+ pdfa?: PdfaSetting;
59
67
  metadata?: {
60
68
  title?: string;
61
69
  author?: string;
@@ -29,7 +29,11 @@ export interface EpcPayment {
29
29
  }
30
30
  /** What a caller actually hands over: the same fields, none of them guaranteed to be there. */
31
31
  export type EpcInput = Partial<EpcPayment>;
32
- /** EPC QR (GiroCode) payload, version 002, UTF-8, SCT. */
32
+ /**
33
+ * EPC QR (GiroCode) payload, version 002, UTF-8, SCT. It ends with the last populated element:
34
+ * "The last populated element is not followed by any character or element separator" (EPC069-12
35
+ * v3.1 §2.2), so the empty elements after it are left out, line breaks and all.
36
+ */
33
37
  export declare function epcPayload(input: EpcInput): string;
34
38
  /**
35
39
  * What is wrong with a payment, as a code rather than a sentence: the engine has no locale, and the
@@ -29,7 +29,11 @@ export interface EpcPayment {
29
29
  }
30
30
  /** What a caller actually hands over: the same fields, none of them guaranteed to be there. */
31
31
  export type EpcInput = Partial<EpcPayment>;
32
- /** EPC QR (GiroCode) payload, version 002, UTF-8, SCT. */
32
+ /**
33
+ * EPC QR (GiroCode) payload, version 002, UTF-8, SCT. It ends with the last populated element:
34
+ * "The last populated element is not followed by any character or element separator" (EPC069-12
35
+ * v3.1 §2.2), so the empty elements after it are left out, line breaks and all.
36
+ */
33
37
  export declare function epcPayload(input: EpcInput): string;
34
38
  /**
35
39
  * What is wrong with a payment, as a code rather than a sentence: the engine has no locale, and the