import{a as c}from"./chunk-L6M3ERU6.js";c.config({jitless:!0});var t=class extends Error{issues;constructor(o,n=[]){super(o),this.name="InputError",this.issues=n}};function d(i,o=15e5){let n=new Set;function r(e,s){if(s>12)throw new t("This file has too many nested fields.");if(typeof e=="string"&&e.length>1e5)throw new t("A text field is too long.");if(typeof e=="number"&&!Number.isFinite(e))throw new t("Numbers must be finite.");if(!(!e||typeof e!="object")){if(n.has(e))throw new t("Circular data is not supported.");if(n.add(e),Array.isArray(e)&&e.length>1e3)throw new t("This file contains too many items.");if(!Array.isArray(e)&&![Object.prototype,null].includes(Object.getPrototypeOf(e)))throw new t("Only plain data objects are supported.");for(let[a,p]of Object.entries(e)){if(["__proto__","prototype","constructor"].includes(a))throw new t("This file contains an unsafe field.");r(p,s+1)}n.delete(e)}}if(r(i,0),new TextEncoder().encode(JSON.stringify(i)).byteLength>o)throw new t("This file is too large.")}var f=new WeakMap;async function g(i,o){let n=f.get(o);n||(n=(await import("./browser-module-UKF25DQS.js")).create(o),f.set(o,n));let r=new Set;for(let e of i)for(let s of e){if(/^[\n\r\t]$/.test(s))continue;let a=s.codePointAt(0);if(n.hasGlyphForCodePoint(a)||r.add(a),r.size>=6)break}if(r.size){let e=[...r].map(s=>`U+${s.toString(16).toUpperCase().padStart(4,"0")}`).join(", ");throw new t(`The PDF font cannot display some characters (${e}). Replace those characters for PDF export, or save JSON to keep the original text. Your draft has not changed.`)}}export{d as a,g as b};
