agentic-mermaid 0.5.3 → 0.5.4
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/CHANGELOG.md +34 -0
- package/dist/agent-core.d.ts +7 -7
- package/dist/agent-core.js +1 -1
- package/dist/agent.d.ts +7 -7
- package/dist/agent.js +1 -1
- package/dist/agentic-mermaid-mcp.js +1 -1
- package/dist/am.js +1 -1
- package/dist/browser-lazy/chunks/{agentic-producer-core-CC6OOLDW.js → agentic-producer-core-ECZ3CMZM.js} +1 -1
- package/dist/browser-lazy/chunks/{architecture-QUFVKYJR.js → architecture-H5LTMKQW.js} +6 -6
- package/dist/browser-lazy/chunks/{block-6J3Q63BO.js → block-566X6FNV.js} +5 -5
- package/dist/browser-lazy/chunks/{builtin-backends-7SOZZHPF.js → builtin-backends-VAFEZXKY.js} +6 -6
- package/dist/browser-lazy/chunks/{c4-SQVBZAKJ.js → c4-ZXFDLBFK.js} +5 -5
- package/dist/browser-lazy/chunks/{chunk-5X6MJX3H.js → chunk-2JQXRKBC.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-E2WMJZNM.js → chunk-37FZNMPR.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-TYZOZXUJ.js → chunk-3JTYTXA6.js} +6 -6
- package/dist/browser-lazy/chunks/{chunk-PQGPS2YV.js → chunk-4NILRBC7.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-AMJLVPUB.js → chunk-5LKPDHPC.js} +2 -2
- package/dist/browser-lazy/chunks/{chunk-BY2CPG6B.js → chunk-62MR3LWJ.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-J7FFAFQF.js → chunk-64JFHCJC.js} +1 -1
- package/dist/browser-lazy/chunks/chunk-6GPDLZFQ.js +1 -0
- package/dist/browser-lazy/chunks/{chunk-VWVZGQE2.js → chunk-6UOOATQR.js} +1 -1
- package/dist/browser-lazy/chunks/chunk-7TTFBJYA.js +1 -0
- package/dist/browser-lazy/chunks/chunk-7UFOFWBA.js +20 -0
- package/dist/browser-lazy/chunks/{chunk-5B2Z7575.js → chunk-A7V5VDKN.js} +1 -1
- package/dist/browser-lazy/chunks/chunk-CPO5P4L2.js +1 -0
- package/dist/browser-lazy/chunks/chunk-EIYLJ4FI.js +20 -0
- package/dist/browser-lazy/chunks/{chunk-X2UYKWKM.js → chunk-G4JBA7HU.js} +3 -3
- package/dist/browser-lazy/chunks/{chunk-2UIA2IME.js → chunk-IUI4DYC3.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-QA6GJQ4X.js → chunk-J57YRC2M.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-BU5LHXNJ.js → chunk-LBXXKLIR.js} +3 -3
- package/dist/browser-lazy/chunks/chunk-NKW2ZNCD.js +1 -0
- package/dist/browser-lazy/chunks/{chunk-ICC7HBJX.js → chunk-O34YYEQV.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-UL6NDWLL.js → chunk-OBI5U5XU.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-YCEICNM6.js → chunk-OFOS57WQ.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-OZ443IVJ.js → chunk-PSZEE64O.js} +7 -7
- package/dist/browser-lazy/chunks/{chunk-SZELX2EJ.js → chunk-PXTLV57R.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-HLWUNUCM.js → chunk-QVSZOF5M.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-2GPK4VFF.js → chunk-TT5GR5EJ.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-DF6765YX.js → chunk-V6I2VGNQ.js} +5 -5
- package/dist/browser-lazy/chunks/{chunk-CN7WTBWB.js → chunk-VRZKI33U.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-2SH76OTH.js → chunk-XHU3A432.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-NO7ZIVRU.js → chunk-YVNJDVQO.js} +1 -1
- package/dist/browser-lazy/chunks/chunk-Z7UHFVKN.js +6 -0
- package/dist/browser-lazy/chunks/{class-5QA4SCTS.js → class-XIFNVBFE.js} +8 -8
- package/dist/{zenuml/chunks/decode-BWERFDGK.js → browser-lazy/chunks/decode-5MFOG3AZ.js} +1 -1
- package/dist/browser-lazy/chunks/{elk.bundled-L4CADV5W.js → elk.bundled-RYWHIS5N.js} +8 -8
- package/dist/browser-lazy/chunks/er-VEUYJBGG.js +11 -0
- package/dist/browser-lazy/chunks/{eventmodeling-2BPLHWRN.js → eventmodeling-G7DITZX7.js} +10 -10
- package/dist/browser-lazy/chunks/{flowchart-NEIMZTB5.js → flowchart-SSFIU4EU.js} +1 -1
- package/dist/browser-lazy/chunks/{forest-implementation-AEP24AIP.js → forest-implementation-RWFF7XDV.js} +1 -1
- package/dist/browser-lazy/chunks/{gantt-RDPIFYAF.js → gantt-HQNVDX2B.js} +6 -6
- package/dist/browser-lazy/chunks/{gitgraph-N4Y5RYB7.js → gitgraph-Z5MN6M6L.js} +4 -4
- package/dist/browser-lazy/chunks/{ishikawa-LD3YBDJN.js → ishikawa-UEERNFQV.js} +2 -2
- package/dist/browser-lazy/chunks/{journey-6YQR5DJX.js → journey-3BEWWGB5.js} +6 -6
- package/dist/browser-lazy/chunks/{kanban-PLMJ7NBW.js → kanban-2WFNCWLB.js} +10 -10
- package/dist/browser-lazy/chunks/{mermaid-yaml-runtime-QVYX4EWK.js → mermaid-yaml-runtime-IK4ET4BT.js} +8 -8
- package/dist/browser-lazy/chunks/{mindmap-K2UBFO3Y.js → mindmap-R2C6SNYR.js} +4 -4
- package/dist/browser-lazy/chunks/{packet-CUW4QY6Y.js → packet-GMVCI5YZ.js} +3 -3
- package/dist/browser-lazy/chunks/{pie-7F7UUCG3.js → pie-WER45DKC.js} +7 -7
- package/dist/browser-lazy/chunks/{quadrant-TOONO2WC.js → quadrant-NCUPSFKN.js} +4 -4
- package/dist/browser-lazy/chunks/{radar-J6JVWVAX.js → radar-WLYS4YC5.js} +8 -8
- package/dist/browser-lazy/chunks/render-core-42UVWIPF.js +3 -0
- package/dist/browser-lazy/chunks/{requirement-CMAKDJPO.js → requirement-AK3NWMJ6.js} +7 -7
- package/dist/browser-lazy/chunks/{sankey-AWXQEP3F.js → sankey-C2DY6WVU.js} +4 -4
- package/dist/browser-lazy/chunks/{sequence-Q2RJRB4L.js → sequence-D4WJB44W.js} +1 -1
- package/dist/browser-lazy/chunks/{state-WRBFQEDX.js → state-YUQVESE7.js} +2 -2
- package/dist/browser-lazy/chunks/{timeline-D2KILFXM.js → timeline-BMBJJXWR.js} +4 -4
- package/dist/browser-lazy/chunks/{treemap-N3VYX5D4.js → treemap-B66XBZZ6.js} +3 -3
- package/dist/browser-lazy/chunks/{xychart-G73OGK66.js → xychart-HAVFROGT.js} +6 -6
- package/dist/browser-lazy/chunks/{zenuml-H4BXNYXR.js → zenuml-62RLYFWP.js} +7 -7
- package/dist/browser-lazy/index.js +1 -1
- package/dist/browser.global.js +507 -507
- package/dist/{chunk-DQDKA5ND.js → chunk-2DNGDTJD.js} +2 -2
- package/dist/{chunk-GVCHLSHH.js → chunk-4F2UGYTM.js} +2 -2
- package/dist/{chunk-H3NCS2XZ.js → chunk-7XYB2LNC.js} +2 -2
- package/dist/chunk-DOFB572I.js +58 -0
- package/dist/chunk-EHJI3QYE.js +52 -0
- package/dist/{chunk-UA234O4M.js → chunk-HINRNKPO.js} +2 -2
- package/dist/{chunk-JZOJ4YGS.js → chunk-KXMANAST.js} +33 -33
- package/dist/{chunk-7CRDX2QR.js → chunk-U4MT3RRE.js} +2 -2
- package/dist/{chunk-NKNFOREZ.js → chunk-WYIB6BUR.js} +2 -2
- package/dist/{cli-YGGTJZH7.js → cli-ZYIDBYNS.js} +2 -2
- package/dist/{index-EeXqJXr5.d.ts → index-Bvhprdxz.d.ts} +3 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/{mcp-cli-63DYXTVD.js → mcp-cli-YVDCORWA.js} +2 -2
- package/dist/{paint-certification-6rwQjIv_.d.ts → paint-certification-BoLyr006.d.ts} +2 -2
- package/dist/{server-5NEOHOFS.js → server-4JGAVXR3.js} +2 -2
- package/dist/{svg-styles-BdnoM7AT.d.ts → svg-styles-BnCoXyYe.d.ts} +1 -1
- package/dist/svg-styles.d.ts +1 -1
- package/dist/svg-styles.js +1 -1
- package/dist/svg.d.ts +4 -4
- package/dist/svg.js +1 -1
- package/dist/{types-BcS52Mjt.d.ts → types-CLVJCaH2.d.ts} +1 -1
- package/dist/zenuml/chunks/{appearance-UOQ5KA6O.js → appearance-5RM5MVM2.js} +1 -1
- package/dist/zenuml/chunks/{builtin-backends-KDKE7YHO.js → builtin-backends-UTNWL4N3.js} +11 -11
- package/dist/zenuml/chunks/{chunk-QWX77U7G.js → chunk-3A6S6GNB.js} +2 -2
- package/dist/zenuml/chunks/{chunk-OXQWRSBM.js → chunk-55WS466K.js} +11 -11
- package/dist/zenuml/chunks/chunk-6J4BGPB2.js +29 -0
- package/dist/zenuml/chunks/chunk-CNLL4BGF.js +1 -0
- package/dist/zenuml/chunks/{chunk-RZ6XK5CD.js → chunk-IARQ24W3.js} +13 -13
- package/dist/zenuml/chunks/{chunk-42DXZ5C6.js → chunk-ZNZRIISS.js} +2 -2
- package/dist/{browser-lazy/chunks/decode-63UIZGD2.js → zenuml/chunks/decode-LDNNXEAO.js} +1 -1
- package/dist/zenuml/chunks/{mermaid-yaml-runtime-KZVU74WU.js → mermaid-yaml-runtime-A5CNJ3IE.js} +8 -8
- package/dist/zenuml/chunks/render-core-ECIWU5ZS.js +3 -0
- package/dist/zenuml/chunks/{zenuml-EA2ZFRUX.js → zenuml-N3LZMB2G.js} +8 -8
- package/dist/zenuml.d.ts +2 -2
- package/dist/zenuml.js +1 -1
- package/docs/MCP-DIRECTORY-LISTINGS.md +81 -12
- package/docs/api.md +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
- package/dist/browser-lazy/chunks/chunk-4LHYF3BS.js +0 -1
- package/dist/browser-lazy/chunks/chunk-FAIMVOX5.js +0 -6
- package/dist/browser-lazy/chunks/chunk-GVOEAY52.js +0 -1
- package/dist/browser-lazy/chunks/chunk-J35HAQQF.js +0 -20
- package/dist/browser-lazy/chunks/chunk-RIVTHZAQ.js +0 -1
- package/dist/browser-lazy/chunks/chunk-Z3FDIVLN.js +0 -20
- package/dist/browser-lazy/chunks/er-7ZSKGN7Y.js +0 -11
- package/dist/browser-lazy/chunks/render-core-BZOM3K7D.js +0 -3
- package/dist/chunk-EHCMJUMD.js +0 -52
- package/dist/chunk-OMY6NRQD.js +0 -58
- package/dist/zenuml/chunks/chunk-7TVYPTDW.js +0 -1
- package/dist/zenuml/chunks/chunk-RLJEI7YN.js +0 -29
- package/dist/zenuml/chunks/render-core-V5RQ737O.js +0 -3
- /package/dist/browser-lazy/chunks/{chunk-5FQ534HP.js → chunk-BMZ24VPS.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-2I4UPL7Q.js → chunk-D6MQ7QSU.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-CQE4HQEW.js → chunk-HJVO5VC3.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-LH7HUDKW.js → chunk-L4UC3KGS.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-NMQQMRIR.js → chunk-MFTQWHUB.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-N5ELX7LR.js → chunk-PJJSDGLB.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-CSFUKSU6.js → chunk-QCU5G5PZ.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-VQYYGAXP.js → chunk-TLFX3U6S.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-5UVGUSD6.js → chunk-YHMTSXIR.js} +0 -0
- /package/dist/zenuml/chunks/{chunk-EVPSMEKN.js → chunk-GC7IPQ5P.js} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{e as e,f as t,s as r,t as n,u as i}from"./chunk-3JTYTXA6.js";import{Ab as o,Bb as a,Cb as s,Eb as d,Fa as c,Fb as l,Ga as u,Gb as m,Ha as p,Hb as f,Ia as g,Ib as h,Ja as y,N as b,Q as E,V as v,Xa as k,Y as $,Z as x,Za as S,_a as N,ab as w,b as C,ca as z,d as O,db as _,e as T,eb as j,f as M,fb as I,g as D,ga as A,ha as U,ia as P,ja as B,l as R,n as L,ob as F,qb as W,rb as q,s as Y,sb as G,ub as V,vb as K,wb as Z,xb as H}from"./chunk-EIYLJ4FI.js";function J(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\(?:\r\n|[\n\r\f])/g,"").replace(/\\([0-9a-fA-F]{1,6})\s?/g,(e,t)=>{let r=Number.parseInt(t,16);return Number.isFinite(r)?String.fromCodePoint(r):""}).replace(/\\([^\n\r\f])/g,"$1")}var Q=/\s([^\s=<>]+)\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/g,X=/<(?:[^\s<>/:]+:)?(?:animate(?:Motion|Transform)?|set)\b/i,ee=/^on[a-z]/,et=/[(:@\\&]/,er=/^(?:javascript|vbscript|data|file):/,en=/(?:javascript|vbscript|data|file)\s*:/i,ei=/(?:expression|behavior)\s*\(/i,eo=/(?:expression|behavior)\s*\(|-moz-binding\s*:/i,ea=new Set(["amp","lt","gt","quot","apos"]);function es(e){return" "===e||" "===e||e===`
|
|
2
|
+
`||"\r"===e}function ed(e,t){let r=e.charCodeAt(t),n=32|r;if(!(n>=97&&n<=122||95===r))return -1;let i=t+1;for(;j(e[i]);)i++;return i}var ec="http://www.w3.org/XML/1998/namespace";function el(e){return 9===e||10===e||13===e||e>=32&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}function eu(e){for(let t=e.indexOf("&");t>=0;t=e.indexOf("&",t+1)){let r=e.indexOf(";",t+1);if(r<0)return!1;let n=e.slice(t+1,r);if(n.startsWith("#x")||n.startsWith("#X")){if(!/^[0-9a-f]+$/i.test(n.slice(2))||!el(Number.parseInt(n.slice(2),16)))return!1}else if(n.startsWith("#")){if(!/^[0-9]+$/.test(n.slice(1))||!el(Number.parseInt(n.slice(1),10)))return!1}else if(!ea.has(n))return!1;t=r}return!0}function em(e,t){if(/[\0-\x08\x0b\x0c\x0e-\x1f\ud800-\udfff\ufffe\uffff]/u.test(e))return!1;let r=[],n=!1,i=!1,o=0;for(;o<e.length;){let a;if("<"!==e[o]){let t=e.indexOf("<",o),n=t<0?e.length:t,i=e.slice(o,n);if(0===r.length&&""!==i.trim()||i.includes("]]>")||!eu(i))return!1;o=n;continue}if(e.startsWith("\x3c!--",o)){if(0===r.length)return!1;let t=e.indexOf("--\x3e",o+4),n=t<0?"":e.slice(o+4,t);if(t<0||n.includes("--")||n.endsWith("-"))return!1;o=t+3;continue}if(e.startsWith("<![CDATA[",o)||e.startsWith("<!",o)||e.startsWith("<?",o))return!1;if(e.startsWith("</",o)){let t=ed(e,o+2);if(t<0)return!1;let n=e.slice(o+2,t);if(n.includes(":"))return!1;for(;es(e[t]);)t++;if(">"!==e[t]||r.pop()?.name!==n)return!1;if(o=t+1,0===r.length){if("svg"!==n||i)return!1;i=!0}continue}let s=ed(e,o+1);if(s<0||i)return!1;let d=e.slice(o+1,s);if(d.includes(":"))return!1;if(0===r.length){if(n||"svg"!==d)return!1;n=!0}let c=s,l=new Set,u=[],m=!1;for(;;){let r=es(e[c]);for(;es(e[c]);)c++;if(">"===e[c]){c++;break}if("/"===e[c]&&">"===e[c+1]){m=!0,c+=2;break}if(!r)return!1;let n=ed(e,c);if(n<0)return!1;let i=e.slice(c,n);if(l.has(i))return!1;let o=i.includes(":"),a=o?function(e){let t=e.indexOf(":");if(!(t<=0||t===e.length-1||e.indexOf(":",t+1)>=0))return{prefix:e.slice(0,t),local:e.slice(t+1)}}(i):void 0;if(o&&!a)return!1;for(l.add(i),c=n;es(e[c]);)c++;if("="!==e[c])return!1;for(c++;es(e[c]);)c++;let s=e[c];if('"'!==s&&"'"!==s)return!1;let d=++c;if((c=e.indexOf(s,d))<0)return!1;let p=e.slice(d,c);if(p.includes("<")||!eu(p))return!1;(a||"xmlns"===i)&&u.push({name:i,...a,value:ep(p)}),t?.(i,p),c++}let p=r.at(-1)?.namespaces??new Map([["xml",ec]]),f;for(let e of u){let t="xmlns"===e.name,r="xmlns"===e.prefix;if(!t&&!r)continue;let n=t?"":e.local,i=e.value;if("xmlns"===n||"http://www.w3.org/2000/xmlns/"===i||"xml"===n&&i!==ec||"xml"!==n&&i===ec||""!==n&&""===i)return!1;f||(p=f=new Map(p)),f.set(n,i)}if("http://www.w3.org/2000/svg"!==p.get("")||r.length>0&&"svg"===d)return!1;for(let e of u){if("xmlns"===e.name||"xmlns"===e.prefix)continue;let t=p.get(e.prefix);if(void 0===t)return!1;let r=`${t}\0${e.local}`;if(a||(a=new Set),a.has(r))return!1;a.add(r)}if(o=c,m){if(0===r.length)return!1}else r.push({name:d,namespaces:p})}return n&&i&&0===r.length}function ep(e){if(!e.includes("&"))return e;let t=e;for(let e=0;e<3;e++){let e=t.replace(/&#x([0-9a-f]+);?/gi,(e,t)=>{let r=Number.parseInt(t,16);return Number.isFinite(r)&&r<=1114111?String.fromCodePoint(r):""}).replace(/&#([0-9]+);?/g,(e,t)=>{let r=Number.parseInt(t,10);return Number.isFinite(r)&&r<=1114111?String.fromCodePoint(r):""}).replace(/:?/gi,":").replace(//?/gi,"/").replace(/&tab;?/gi," ").replace(/&newline;?/gi,`
|
|
3
|
+
`).replace(/"?/gi,'"').replace(/'?/gi,"'").replace(/<?/gi,"<").replace(/>?/gi,">").replace(/&?/gi,"&");if(e===t)break;t=e}return t}function ef(e){return ep(e).replace(/[\u0000-\u0020\u007f-\u009f]+/g,"").toLowerCase()}function eg(e){let t=ep(e);if(/[\u0000-\u001f\u007f-\u009f]/.test(t))return!1;let r=t.replace(/ +/g,"").toLowerCase().trim();return!!/^(?:https?:|mailto:)/.test(r)||!/^[a-z][a-z0-9+.-]*:/.test(r)&&r.length>0}function eh(e){let t=J(ep(e)),r=[];for(let e of(/@import\b/i.test(t)&&r.push("@import"),t.matchAll(/url\s*\(\s*(["']?)([\s\S]*?)\1\s*\)/gi))){let t=ef(e[2]);""===t||t.startsWith("#")||r.push(`url(${e[2].trim()})`)}for(let e of t.matchAll(/(?:-webkit-)?(?:image-set|cross-fade)\s*\(/gi))r.push(`${e[0].slice(0,-1).trim()}()`);return r}function ey(e){return!!(eo.test(e)||en.test(e))}var eb=new Set(["clip-path","cursor","fill","filter","marker-end","marker-mid","marker-start","mask","stroke","style"]);function eE(e,t){if(void 0!==e&&""!==e)return"string"!=typeof e?"Mermaid themeCSS must be a string":`Raw Mermaid themeCSS is not allowed in ${t} security mode because selectors can escape an imported SVG; use a declarative StyleSpec`}function ev(e,t,r,n){let i=e.slice(e.lastIndexOf(":")+1).toLowerCase();if(ee.test(i)&&(r.push("inline-event-handler"),n.push("inline-event-handler")),"xml:base"===e.toLowerCase()&&r.push(`xml:base=${t}`),"href"===i||"src"===i||"data"===i){let i=ef(t);""===i||i.startsWith("#")||r.push(i.startsWith("javascript:")?"javascript-url":t),er.test(i)&&n.push(`${e}=${t}`)}if(eb.has(i)||"values"===i||"from"===i||"to"===i){if(!et.test(t))return;let i=J(ep(t));(eh(i).length>0||en.test(i)||ei.test(i))&&r.push(`${e}=${t}`),ey(i)&&n.push(`${e}=${t}`)}}function ek(e,t,r){for(let n of e.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi))ey(J(ep(n[1])))&&r.push("active-css"),t.push(...eh(n[1]));for(let n of["script","foreignObject","image","object","embed","iframe"])RegExp(`<(?:[^\\s<>/:]+:)?${n}\\b`,"i").test(e)&&(t.push(`<${n}>`),"image"!==n&&r.push(`<${n}>`));return X.test(e)&&(t.push("<animation>"),r.push("<animation>")),Object.freeze({active:Object.freeze(r),refs:Object.freeze(t)})}function e$(e){let{refs:t}=_("security",e,()=>(function(e){let t=e.replace(/<!--[\s\S]*?-->/g,""),r=[],n=[];for(let e of function(e){let t=[];for(let r=e.indexOf("<");r>=0;r=e.indexOf("<",r+1)){let n,i=e[r+1];if(i&&"/"!==i&&"!"!==i&&"?"!==i&&/[^\s<>]/.test(i))for(let i=r+1;i<e.length;i++){let o=e[i];if(n)o===n&&(n=void 0);else if('"'===o||"'"===o)n=o;else if(">"===o){t.push(e.slice(r,i+1)),r=i;break}}}return t}(t))for(let t of e.matchAll(RegExp(Q.source,"g")))ev(t[1],function(e){let t=e[0];return('"'===t||"'"===t)&&e[e.length-1]===t?e.slice(1,-1):e}(t[2]),r,n);return ek(t,r,n)})(e));return{ok:0===t.length,refs:[...t]}}function ex(e,t="default"){let r=_("final-security",e,()=>{let t=[],r=[],n=!1,i;if(!em(e,(e,o)=>{if(!n)try{ev(e,o,t,r)}catch(e){n=!0,i=e}}))return!1;if(n)throw i;return ek(e.replace(/<!--[\s\S]*?-->/g,""),t,r)});if(!r)throw Error("OutputSecurityPolicy rejected an invalid SVG document envelope");let{active:n,refs:i}=r;if(n.length>0)throw Error(`OutputSecurityPolicy rejected active content: ${n.join(", ")}`);if("strict"===t&&i.length)throw Error(`OutputSecurityPolicy strict verification failed: ${i.join(", ")}`);return{svg:e,diagnostics:"strict"===t?[]:i.map(e=>({code:"EXTERNAL_REFERENCE",reference:e}))}}var eS=["document","text","shape","container","connector","marker","data-mark"];Object.freeze(eS.map(e=>Object.freeze({primitive:e,operation:"document"===e?"serialize":"render"})));var eN=["measure","layout","bounds","hit-test","render","accessibility","terminal-project","serialize"],ew=["geometry","paint","stroke","transform","identity","relation","labels","markers","resources","interaction","topology","subpaths","closedness","bend-radius","endpoints","direction","hit-geometry","stroke-opacity","stroke-cap","stroke-join","stroke-miter","dash-array","dash-offset","dash-restart","path-length","paint-order","compositing","non-scaling-stroke","marker-orientation","marker-overflow"],eC=Object.freeze([{primitive:"document",feature:"identity",operation:"serialize"},{primitive:"document",feature:"resources",operation:"serialize"},{primitive:"document",feature:"interaction",operation:"accessibility"},{primitive:"text",feature:"geometry",operation:"render"},{primitive:"text",feature:"paint",operation:"render"},{primitive:"text",feature:"labels",operation:"accessibility"},{primitive:"text",feature:"identity",operation:"serialize"},{primitive:"shape",feature:"geometry",operation:"render"},{primitive:"shape",feature:"paint",operation:"render"},{primitive:"shape",feature:"identity",operation:"serialize"},{primitive:"container",feature:"geometry",operation:"render"},{primitive:"container",feature:"paint",operation:"render"},{primitive:"container",feature:"identity",operation:"serialize"},{primitive:"connector",feature:"geometry",operation:"render"},{primitive:"connector",feature:"stroke",operation:"render"},{primitive:"connector",feature:"transform",operation:"render"},{primitive:"connector",feature:"topology",operation:"render"},{primitive:"connector",feature:"subpaths",operation:"render"},{primitive:"connector",feature:"closedness",operation:"render"},{primitive:"connector",feature:"bend-radius",operation:"render"},{primitive:"connector",feature:"stroke-opacity",operation:"render"},{primitive:"connector",feature:"stroke-cap",operation:"render"},{primitive:"connector",feature:"stroke-join",operation:"render"},{primitive:"connector",feature:"stroke-miter",operation:"render"},{primitive:"connector",feature:"dash-array",operation:"render"},{primitive:"connector",feature:"dash-offset",operation:"render"},{primitive:"connector",feature:"dash-restart",operation:"render"},{primitive:"connector",feature:"path-length",operation:"render"},{primitive:"connector",feature:"paint-order",operation:"render"},{primitive:"connector",feature:"compositing",operation:"render"},{primitive:"connector",feature:"non-scaling-stroke",operation:"render"},{primitive:"connector",feature:"marker-orientation",operation:"render"},{primitive:"connector",feature:"marker-overflow",operation:"render"},{primitive:"connector",feature:"endpoints",operation:"serialize"},{primitive:"connector",feature:"direction",operation:"serialize"},{primitive:"connector",feature:"labels",operation:"render"},{primitive:"connector",feature:"labels",operation:"accessibility"},{primitive:"connector",feature:"markers",operation:"render"},{primitive:"connector",feature:"relation",operation:"accessibility"},{primitive:"connector",feature:"interaction",operation:"hit-test"},{primitive:"connector",feature:"hit-geometry",operation:"hit-test"},{primitive:"connector",feature:"identity",operation:"serialize"},{primitive:"marker",feature:"geometry",operation:"render"},{primitive:"marker",feature:"paint",operation:"render"},{primitive:"marker",feature:"identity",operation:"serialize"},{primitive:"data-mark",feature:"geometry",operation:"render"},{primitive:"data-mark",feature:"paint",operation:"render"},{primitive:"data-mark",feature:"identity",operation:"serialize"}].map(e=>Object.freeze(e))),ez=["native","emulated","projected","lossy","unsupported"];function eO(e){switch(e.kind){case"text":return["text"];case"shape":return e.channels?.value===void 0?["shape"]:["shape","data-mark"];case"group":return["container"];case"connector":return["connector"];case"document":return e.markerResources?.length?["document","marker"]:["document"]}}function e_(e,t,r="rough"){let n="crisp"===t?"native":"emulated",i="crisp"===t?"native":"projected",o="src/__tests__/backend-capability-conformance.test.ts",a=e=>"crisp"===t?{realization:"native"}:"geometry"===e||"topology"===e?{realization:"lossy",diagnostic:"The exact authored path remains as an invisible semantic carrier, but arbitrary curves are flattened to typed routed contours for the visible sketch."}:"closedness"===e?{realization:"lossy",diagnostic:"Sketch shafts are rebuilt from routed geometry and do not preserve explicit closed-subpath semantics."}:"bend-radius"===e?{realization:"lossy",diagnostic:"The authored rounded carrier remains exact, but the visible sketch follows its routed polyline and cannot preserve the continuous bend radius."}:"dash-restart"===e?{realization:"lossy",diagnostic:"A rough stroke may contain multiple generated stroke subpaths, so SVG dash restart boundaries can differ."}:"path-length"===e?{realization:"lossy",diagnostic:"One pathLength value spans generated stroke subpaths, so a sketch cannot retain one authored path calibration exactly."}:"hybrid"===r&&("stroke-cap"===e||"stroke-join"===e||"stroke-miter"===e||"non-scaling-stroke"===e)?{realization:"lossy",diagnostic:`Freehand ribbon geometry cannot preserve authored ${e} semantics; dashed Hybrid connectors fall back to the faithful rough projection.`}:"marker-orientation"===e||"marker-overflow"===e?{realization:"projected",diagnostic:"Marker geometry, orientation, and overflow remain in the typed marker projection instead of being sketched."}:{realization:"emulated"},s=[{target:e,primitive:"document",feature:"identity",operation:"serialize",realization:"native",evidence:o},{target:e,primitive:"document",feature:"resources",operation:"serialize",realization:"native",evidence:o},{target:e,primitive:"document",feature:"interaction",operation:"accessibility",realization:"native",evidence:o},{target:e,primitive:"text",feature:"geometry",operation:"render",realization:"native",evidence:o},{target:e,primitive:"text",feature:"paint",operation:"render",realization:"native",evidence:o},{target:e,primitive:"text",feature:"labels",operation:"accessibility",realization:"native",evidence:o},{target:e,primitive:"text",feature:"identity",operation:"serialize",realization:"native",evidence:o},{target:e,primitive:"shape",feature:"geometry",operation:"render",realization:n,evidence:o},{target:e,primitive:"shape",feature:"paint",operation:"render",realization:n,evidence:o},{target:e,primitive:"shape",feature:"identity",operation:"serialize",realization:"native",evidence:o},{target:e,primitive:"container",feature:"geometry",operation:"render",realization:"native",evidence:o},{target:e,primitive:"container",feature:"paint",operation:"render",realization:"native",evidence:o},{target:e,primitive:"container",feature:"identity",operation:"serialize",realization:"native",evidence:o},{target:e,primitive:"connector",feature:"geometry",operation:"render",...a("geometry"),evidence:o},{target:e,primitive:"connector",feature:"stroke",operation:"render",realization:n,evidence:o},...["transform","topology","subpaths","closedness","bend-radius","stroke-opacity","stroke-cap","stroke-join","stroke-miter","dash-array","dash-offset","dash-restart","path-length","paint-order","compositing","non-scaling-stroke","marker-orientation","marker-overflow"].map(t=>({target:e,primitive:"connector",feature:t,operation:"render",...a(t),evidence:o})),{target:e,primitive:"connector",feature:"relation",operation:"accessibility",realization:"native",evidence:o},{target:e,primitive:"connector",feature:"endpoints",operation:"serialize",realization:"native",evidence:o},{target:e,primitive:"connector",feature:"direction",operation:"serialize",realization:"native",evidence:o},{target:e,primitive:"connector",feature:"labels",operation:"render",realization:"native",evidence:o},{target:e,primitive:"connector",feature:"labels",operation:"accessibility",realization:"native",evidence:o},{target:e,primitive:"connector",feature:"markers",operation:"render",realization:i,evidence:o},{target:e,primitive:"connector",feature:"interaction",operation:"hit-test",realization:"native",evidence:o},{target:e,primitive:"connector",feature:"hit-geometry",operation:"hit-test",realization:"native",evidence:o},{target:e,primitive:"connector",feature:"identity",operation:"serialize",realization:"native",evidence:o},{target:e,primitive:"marker",feature:"geometry",operation:"render",realization:i,evidence:o},{target:e,primitive:"marker",feature:"paint",operation:"render",realization:i,evidence:o},{target:e,primitive:"marker",feature:"identity",operation:"serialize",realization:"native",evidence:o},{target:e,primitive:"data-mark",feature:"geometry",operation:"render",realization:n,evidence:o},{target:e,primitive:"data-mark",feature:"paint",operation:"render",realization:n,evidence:o},{target:e,primitive:"data-mark",feature:"identity",operation:"serialize",realization:"native",evidence:o}],d=ej(s);if(!d.valid)throw Error(`Invalid graphical backend capability contract: ${d.diagnostics.join("; ")}`);return Object.freeze(s.map(e=>Object.freeze({...e})))}function eT(e){return[e.target,e.primitive,e.feature,e.operation].join("\0")}function ej(e){let t=[],r=new Set;for(let n=0;n<e.length;n++){let i=e[n],o=eT(i);r.has(o)&&t.push(`claim[${n}]: duplicate target/primitive/feature/operation`),r.add(o),""===i.target.trim()&&t.push(`claim[${n}]: target must not be empty`),""===i.primitive.trim()&&t.push(`claim[${n}]: primitive must not be empty`),""===i.feature.trim()&&t.push(`claim[${n}]: feature must not be empty`),""===i.operation.trim()&&t.push(`claim[${n}]: operation must not be empty`),ez.includes(i.realization)||t.push(`claim[${n}]: invalid realization ${String(i.realization)}`),"lossy"!==i.realization&&"unsupported"!==i.realization||i.diagnostic?.trim()||t.push(`claim[${n}]: ${i.realization} realization requires a diagnostic`)}return{valid:0===t.length,diagnostics:t}}function eM(e,t,r){let n=r.x-t.x,i=r.y-t.y,o=n*n+i*i;if(0===o)return Math.hypot(e.x-t.x,e.y-t.y);let a=Math.max(0,Math.min(1,((e.x-t.x)*n+(e.y-t.y)*i)/o));return Math.hypot(e.x-(t.x+a*n),e.y-(t.y+a*i))}function eI(e,t,r=0){return function(e,t,r,n){if("none"===e.hit.pointerEvents)return!1;let i=y(p(n,u(e.transform)));if(!i)return!1;if(e.stroke.nonScaling){let i=function(e,t,r){if("none"===e.hit.pointerEvents)return;let n=B(e.hit.geometry,e.hit.closed);if(0===n.length)return;let i=p(r,u(e.transform)),o=1/0;for(let e of n)o=Math.min(o,eM(t,g(e.start,i),g(e.end,i)));return o}(e,t,n);return void 0!==i&&i<=e.hit.strokeWidth/2+Math.max(0,r)}let o=g(t,i),a=(Math.hypot(i[0]+i[3],i[1]-i[2])+Math.hypot(i[0]-i[3],i[1]+i[2]))/2,s=e.hit.strokeWidth/2+(r>0?r*a:0);return B(e.hit.geometry,e.hit.closed).some(e=>eM(o,e.start,e.end)<=s)}(e,t,r,c)}function eD(e,t){if(0!==e.length&&e.length>t)return t+1;if(!/[^\x00-\x7f]/.test(e))return e.length;let r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);if(i<=127)r+=1;else if(i<=2047)r+=2;else if(i>=55296&&i<=56319&&n+1<e.length){let t=e.charCodeAt(n+1);t>=56320&&t<=57343?(r+=4,n++):r+=3}else r+=3;if(r>t)return t+1}return r}Object.freeze(["importance","value","category","status","progress","route","emphasis"]);var eA=/^[A-Za-z_][A-Za-z0-9_.:-]*$/,eU=Object.freeze({maxIdLength:256,maxCoordinate:1e6,maxStopsPerGradient:256,maxResources:1e4,maxAggregateStops:2e4,maxSerializationBytes:8e6});function eP(e,t){if(!Number.isFinite(e))throw Error(`Linear gradient ${t} must be finite`);if(Math.abs(e)>eU.maxCoordinate)throw Error(`Linear gradient ${t} must not exceed ${eU.maxCoordinate}`);return e}function eB(t){if(!eA.test(t.id))throw Error(`Linear gradient id ${JSON.stringify(t.id)} must use the safe SVG id grammar`);if(t.id.length>eU.maxIdLength)throw Error(`Linear gradient id must contain at most ${eU.maxIdLength} characters`);if("userSpaceOnUse"!==t.units&&"objectBoundingBox"!==t.units)throw Error(`Linear gradient "${t.id}" units must be userSpaceOnUse or objectBoundingBox`);if(eP(t.x1,"x1"),eP(t.y1,"y1"),eP(t.x2,"x2"),eP(t.y2,"y2"),t.stops.length<2)throw Error(`Linear gradient "${t.id}" must declare at least two stops`);if(t.stops.length>eU.maxStopsPerGradient)throw Error(`Linear gradient "${t.id}" must declare at most ${eU.maxStopsPerGradient} stops`);let r=-1;for(let[n,i]of t.stops.entries()){if(eP(i.offset,`stops[${n}].offset`),i.offset<0||i.offset>1)throw Error(`Linear gradient "${t.id}" stop offsets must be in [0,1]`);if(i.offset<r)throw Error(`Linear gradient "${t.id}" stop offsets must be non-decreasing`);if(r=i.offset,void 0===e(i.color)||/^url\s*\(/i.test(i.color))throw Error(`Linear gradient "${t.id}" stop ${n} must use a safe non-fetching CSS paint`);if(void 0!==i.opacity&&(!Number.isFinite(i.opacity)||i.opacity<0||i.opacity>1))throw Error(`Linear gradient "${t.id}" stop opacity must be in [0,1]`)}}function eR(e,t={}){eB(e);let r=" ".repeat(t.indent??2),n=`${r} `,i=[`id="${b(e.id)}"`,`gradientUnits="${e.units}"`,`x1="${eP(e.x1,"x1")}"`,`y1="${eP(e.y1,"y1")}"`,`x2="${eP(e.x2,"x2")}"`,`y2="${eP(e.y2,"y2")}"`];return[`${r}<linearGradient ${i.join(" ")}>`,...e.stops.map(e=>{var t;return`${n}<stop offset="${t=e.offset,`${Math.round(1e5*t)/1e3}%`}" stop-color="${b(e.color)}"${void 0===e.opacity?"":` stop-opacity="${e.opacity}"`} />`}),`${r}</linearGradient>`].join(`
|
|
4
|
+
`)}function eL(e,t={}){if(e.length>eU.maxResources)throw Error(`A definitions mark may declare at most ${eU.maxResources} linear gradients`);let r=new Set,n=0,i=0,o=[];for(let a of e){if(r.has(a.id))throw Error(`Duplicate linear gradient resource "${a.id}"`);if(r.add(a.id),(n+=a.stops.length)>eU.maxAggregateStops)throw Error(`Linear gradient resources may declare at most ${eU.maxAggregateStops} aggregate stops`);let e=eR(a,t),s=+(0!==o.length),d=eU.maxSerializationBytes-i-s,c=eD(e,Math.max(0,d));if(c>d)throw Error(`Linear gradient serialization exceeds ${eU.maxSerializationBytes} bytes`);i+=c+s,o.push(e)}return o.join(`
|
|
5
|
+
`)}var eF=Object.freeze({maxExtent:1e6,maxNodes:1e5,maxDepth:64,maxTextLength:1e6,maxTextBytes:2e6,maxPoints:5e4,maxSerializationBytesPerNode:5e6,maxAggregateSerializationBytes:16e6,maxFinalSvgBytes:8e6}),eW=class extends Error{constructor(e){super(`Scene validation failed: ${e.map(e=>`${e.path}: ${e.message}`).join("; ")}`),this.diagnostics=e,this.name="SceneValidationError"}diagnostics;code="SCENE_VALIDATION_FAILED"},eq=eF.maxExtent,eY=eF.maxNodes,eG=eF.maxDepth,eV=eF.maxTextLength,eK=eF.maxTextBytes,eZ=eF.maxPoints,eH=eF.maxSerializationBytesPerNode,eJ=eF.maxAggregateSerializationBytes,eQ=eF.maxFinalSvgBytes,eX=/^[A-Za-z0-9][A-Za-z0-9_.:/-]*$/,e0=/^[a-z0-9][a-z0-9._/-]*:[a-z0-9][a-z0-9._/-]*$/i,e1=/^(?:none|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?(?:[\s,]+[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)*)$/,e2=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,e3=/^([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)(?:px)?$/,e4=/^([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)$/,e5=/^var\(--[a-z0-9_-]+(?:,\s*[-+]?\d*\.?\d+)?\)$/i,e6=Object.freeze({M:2,m:2,L:2,l:2,H:1,h:1,V:1,v:1,C:6,c:6,S:4,s:4,Q:4,q:4,T:2,t:2,A:7,a:7,Z:0,z:0}),e8=/[-+]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:[eE][-+]?\d+)?/y,e7=["fill","stroke","strokeWidth","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","vectorEffect","paintOrder","opacity"];function e9(e,t="final SVG"){if("string"!=typeof e)throw TypeError(`${t} must be a string`);if(!(3*e.length<=eQ)&&!_("final-svg-budget",e,()=>eD(e,eQ)<=eQ))throw RangeError(`${t} exceeds the ${eQ}-byte final SVG limit`)}function te(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function tt(e,t,r,n){e.push({code:t,path:r,message:n})}function tr(e,t,r,n){let i=new Set(t);for(let t of Object.keys(e))i.has(t)||tt(n,"SCENE_DOCUMENT",`${r}.${t}`,"is not part of the external Scene contract")}function tn(e,t,r,n={}){return"number"==typeof e&&Number.isFinite(e)?(n.positive&&e<=0&&tt(r,"SCENE_BOUNDS",t,"must be positive"),n.nonNegative&&e<0&&tt(r,"SCENE_BOUNDS",t,"must be non-negative"),Math.abs(e)>eq&&tt(r,"SCENE_BOUNDS",t,`must not exceed ${eq} user units`),!0):(tt(r,"SCENE_FINITE",t,"must be a finite number"),!1)}function ti(e,t,r,n={}){return"string"!=typeof e?(tt(r,"SCENE_ID",t,"must be a string"),!1):(n.empty||0!==e.length||tt(r,"SCENE_ID",t,"must not be empty"),e.length>(n.max??256)&&tt(r,"SCENE_ID",t,"is too long"),e2.test(e)&&tt(r,"SCENE_ID",t,"contains a control character"),n.externalId&&!eX.test(e)&&tt(r,"SCENE_ID",t,"must use the safe external id grammar"),!0)}function to(e,t,r,n={}){if(void 0===e)return;if("string"!=typeof e&&"number"!=typeof e)return void tt(r,"SCENE_PAINT",t,"must be a finite numeric value");let i=("string"==typeof e?e.trim():void 0)?.match(n.length?e3:e4),o="number"==typeof e?e:i?Number(i[1]):NaN;if(Number.isFinite(o))n.nonNegative&&o<0?tt(r,"SCENE_PAINT",t,"must be non-negative"):n.unitInterval&&(o<0||o>1)&&tt(r,"SCENE_PAINT",t,"must be in [0,1]");else{if("string"==typeof e&&e5.test(e.trim()))return;tt(r,"SCENE_PAINT",t,`must be a finite number or safe numeric custom-property reference (received ${JSON.stringify(e)})`)}}function ta(t,r,n,i=!1){if(!te(t))return void tt(n,"SCENE_PAINT",r,"must be a paint object");for(let o of(i&&tr(t,e7,r,n),["fill","stroke"])){let a=t[o],s=ts(a);void 0!==a&&void 0===e(a)&&(i||!s)&&tt(n,"SCENE_PAINT",`${r}.${o}`,"must be a safe non-fetching CSS paint")}if(to(t.strokeWidth,`${r}.strokeWidth`,n,{nonNegative:!0,length:!0}),to(t.strokeDashoffset,`${r}.strokeDashoffset`,n,{length:!0}),to(t.strokeMiterlimit,`${r}.strokeMiterlimit`,n,{nonNegative:!0}),to(t.opacity,`${r}.opacity`,n,{unitInterval:!0}),to(t.fillOpacity,`${r}.fillOpacity`,n,{unitInterval:!0}),to(t.strokeOpacity,`${r}.strokeOpacity`,n,{unitInterval:!0}),void 0===t.strokeDasharray||"string"==typeof t.strokeDasharray&&e1.test(t.strokeDasharray.trim())||tt(n,"SCENE_PAINT",`${r}.strokeDasharray`,'must be "none" or a finite numeric dash list'),void 0===t.strokeLinecap||["butt","round","square"].includes(String(t.strokeLinecap))||tt(n,"SCENE_PAINT",`${r}.strokeLinecap`,"must be butt, round, or square"),void 0===t.strokeLinejoin||["arcs","bevel","miter","miter-clip","round"].includes(String(t.strokeLinejoin))||tt(n,"SCENE_PAINT",`${r}.strokeLinejoin`,"must be arcs, bevel, miter, miter-clip, or round"),void 0===t.vectorEffect||["none","non-scaling-stroke"].includes(String(t.vectorEffect))||tt(n,"SCENE_PAINT",`${r}.vectorEffect`,"must be none or non-scaling-stroke"),void 0!==t.paintOrder){let e="string"==typeof t.paintOrder?t.paintOrder.trim().split(/\s+/).filter(Boolean).map(e=>e.toLowerCase()):[];1===e.length&&"normal"===e[0]||e.length>=1&&e.length<=3&&new Set(e).size===e.length&&e.every(e=>["fill","stroke","markers"].includes(e))||tt(n,"SCENE_PAINT",`${r}.paintOrder`,"must be normal or one to three unique fill, stroke, and markers keywords")}}function ts(e){return("string"==typeof e?/^url\(#([A-Za-z_][A-Za-z0-9_.:-]*)\)$/.exec(e.trim()):null)?.[1]}function td(e,t,r,n,i,o,a,s){if(!e||"string"!=typeof n||e[r])return;let d=Math.max(0,a-e[t]),c=eD(n,d);c>d?(e[t]=a+1,e[r]=!0,tt(o,"SCENE_BOUNDS",i,`${s} exceed the aggregate ${a}-byte limit`)):e[t]+=c}function tc(e,t,r,n,i=!1){te(e)?(i&&tr(e,["x","y"],t,r),!n||n.pointsExceeded||++n.points>eZ&&(n.pointsExceeded=!0,tt(r,"SCENE_BOUNDS",t,`Scene points exceed the aggregate ${eZ}-point limit`)),tn(e.x,`${t}.x`,r),tn(e.y,`${t}.y`,r)):tt(r,"SCENE_FINITE",t,"must be a point object")}function tl(e,t,r){if(!te(e)||"number"!=typeof e.x||"number"!=typeof e.y)return;let n=Math.hypot(e.x,e.y);(!Number.isFinite(n)||Math.abs(n-1)>1e-9)&&tt(r,"SCENE_FINITE",t,"must be a finite unit vector")}function tu(e,t,r,n,i,o=!1){if(!Array.isArray(e))return void tt(r,"SCENE_FINITE",t,"must be an array of points");if(e.length<n&&tt(r,"SCENE_BOUNDS",t,`must contain at least ${n} points`),i?.pointCollections.has(e))return;i?.pointCollections.add(e),e.length>eY&&tt(r,"SCENE_BOUNDS",t,"contains too many points");let a=Math.min(e.length,eY,i?Math.max(0,eZ-i.points+1):eY);for(let n=0;n<a;n++)tc(e[n],`${t}[${n}]`,r,i,o)}function tm(e,t,r,n=!1,i=0,o,a=!1){if(i>eG)return void tt(r,"SCENE_BOUNDS",t,`geometry exceeds maximum nesting depth ${eG}`);if(!te(e)||"string"!=typeof e.kind)return void tt(r,"SCENE_DOCUMENT",t,"must be a typed geometry object");if(a){let n={rect:["kind","x","y","width","height","rx","ry"],circle:["kind","cx","cy","r"],ellipse:["kind","cx","cy","rx","ry"],line:["kind","x1","y1","x2","y2"],polygon:["kind","points"],polyline:["kind","points"],path:["kind","d","points"],compound:["kind","children"]}[e.kind];n&&tr(e,n,t,r)}switch(e.kind){case"rect":tn(e.x,`${t}.x`,r),tn(e.y,`${t}.y`,r),tn(e.width,`${t}.width`,r,{nonNegative:!0}),tn(e.height,`${t}.height`,r,{nonNegative:!0}),void 0!==e.rx&&tn(e.rx,`${t}.rx`,r,{nonNegative:!0}),void 0!==e.ry&&tn(e.ry,`${t}.ry`,r,{nonNegative:!0});return;case"circle":tn(e.cx,`${t}.cx`,r),tn(e.cy,`${t}.cy`,r),tn(e.r,`${t}.r`,r,{nonNegative:!0});return;case"ellipse":tn(e.cx,`${t}.cx`,r),tn(e.cy,`${t}.cy`,r),tn(e.rx,`${t}.rx`,r,{nonNegative:!0}),tn(e.ry,`${t}.ry`,r,{nonNegative:!0});return;case"line":tn(e.x1,`${t}.x1`,r),tn(e.y1,`${t}.y1`,r),tn(e.x2,`${t}.x2`,r),tn(e.y2,`${t}.y2`,r);return;case"polygon":tu(e.points,`${t}.points`,r,3,o,a);return;case"polyline":tu(e.points,`${t}.points`,r,2,o,a);return;case"path":if("string"!=typeof e.d||0===e.d.length||e.d.length>eV)tt(r,"SCENE_SECURITY",`${t}.d`,"must use bounded SVG path data");else{let i=function(e,t=!1){let r=0,n,i=!1,o=0,a=()=>{for(;r<e.length&&(","===e[r]||/\s/.test(e[r]));)r++},s=()=>{let t=e[r];return void 0!==t&&"MmLlHhVvCcSsQqTtAaZz".includes(t)?t:void 0},d=()=>{a(),e8.lastIndex=r;let t=e8.exec(e);if(!t)return"expected a numeric path parameter";r=e8.lastIndex;let n=Number(t[0]);return Number.isFinite(n)?Math.abs(n)>eq?`path parameter ${t[0]} exceeds ${eq} user units`:void 0:`path parameter ${t[0]} is not finite`};for(;a(),!(r>=e.length);){let c=s();if(void 0!==c){if(n=c,r++,!i&&"M"!==n&&"m"!==n)return"must start with an M or m moveto command";if(i&&t&&("M"===n||"m"===n))return"multiple moveto subpaths require typed subpath geometry";if(i=!0,"Z"===n||"z"===n){n=void 0;continue}}else if(void 0===n)return"path parameters must follow a command";let l=e6[n];if(void 0===l||0===l)return`unknown path command ${String(n)}`;let u=0;for(;;){if(a(),r>=e.length||void 0!==s()){if(0===u)return`command ${n} requires ${l} parameters`;break}for(let t=0;t<l;t++){if(a(),r>=e.length||void 0!==s())return`command ${n} ended before its ${l}-parameter group was complete`;if(("A"===n||"a"===n)&&(3===t||4===t)){let t=e[r];if("0"!==t&&"1"!==t)return`command ${n} arc flags must be 0 or 1`;r++}else{let e=d();if(e)return e}}if(u++,++o>eZ)return`contains more than ${eZ} path parameter groups`}}return i?void 0:"must contain an M or m moveto command"}(e.d,a&&!n);i&&tt(r,"SCENE_SECURITY",`${t}.d`,`must use semantic SVG path data: ${i}`)}if(void 0!==e.points&&tu(e.points,`${t}.points`,r,2,o,a),void 0!==e.markerMidpoints&&tu(e.markerMidpoints,`${t}.markerMidpoints`,r,0,o,a),void 0!==e.subpaths)if(Array.isArray(e.subpaths)&&0!==e.subpaths.length)for(let n=0;n<Math.min(e.subpaths.length,eY);n++){let i=e.subpaths[n];if(!te(i)){tt(r,"SCENE_DOCUMENT",`${t}.subpaths[${n}]`,"must be a typed contour");continue}tu(i.points,`${t}.subpaths[${n}].points`,r,2,o,a),"boolean"!=typeof i.closed&&tt(r,"SCENE_DOCUMENT",`${t}.subpaths[${n}].closed`,"must be boolean")}else tt(r,"SCENE_BOUNDS",`${t}.subpaths`,"must be a non-empty array of typed contours");return;case"compound":if(!Array.isArray(e.children))return void tt(r,"SCENE_BOUNDS",`${t}.children`,"must be a geometry array");e.children.length>eY&&tt(r,"SCENE_BOUNDS",`${t}.children`,"contains too many geometries");for(let s=0;s<Math.min(e.children.length,eY);s++)tm(e.children[s],`${t}.children[${s}]`,r,n,i+1,o,a);return;default:tt(r,"SCENE_DOCUMENT",`${t}.kind`,`unknown geometry kind "${e.kind}"`)}}function tp(e,t,n,i,o){if(!te(e))return tt(n,"SCENE_MARKER",t,"must be a marker descriptor"),!1;if(i&&tr(e,["id","shape","geometry","size","viewBox","ref","bounds","units","orient","overflow","paint","scale"],t,n),ti(e.id,`${t}.id`,n,{externalId:i}),["arrow","open-arrow","circle","cross","triangle","diamond","diamond-open"].includes(String(e.shape))||tt(n,"SCENE_MARKER",`${t}.shape`,"must be a known marker shape"),tm(e.geometry,`${t}.geometry`,n,!0,0,o,i),i&&te(e.geometry)&&"compound"===e.geometry.kind&&(!Array.isArray(e.geometry.children)||0===e.geometry.children.length)&&tt(n,"SCENE_BOUNDS",`${t}.geometry.children`,"external marker compounds must contain geometry"),te(e.size)&&(i&&tr(e.size,["width","height"],`${t}.size`,n),tn(e.size.width,`${t}.size.width`,n,{positive:!0}),tn(e.size.height,`${t}.size.height`,n,{positive:!0})),te(e.ref)&&tc(e.ref,`${t}.ref`,n,o,i),void 0!==e.paint&&ta(e.paint,`${t}.paint`,n,i),te(e.viewBox)&&(i&&tr(e.viewBox,["x","y","width","height"],`${t}.viewBox`,n),tn(e.viewBox.x,`${t}.viewBox.x`,n),tn(e.viewBox.y,`${t}.viewBox.y`,n),tn(e.viewBox.width,`${t}.viewBox.width`,n,{positive:!0}),tn(e.viewBox.height,`${t}.viewBox.height`,n,{positive:!0})),te(e.bounds)){for(let r of(i&&tr(e.bounds,["x0","y0","x1","y1"],`${t}.bounds`,n),["x0","y0","x1","y1"]))tn(e.bounds[r],`${t}.bounds.${r}`,n);"number"==typeof e.bounds.x0&&"number"==typeof e.bounds.x1&&e.bounds.x0>e.bounds.x1&&tt(n,"SCENE_BOUNDS",`${t}.bounds`,"x0 must not exceed x1"),"number"==typeof e.bounds.y0&&"number"==typeof e.bounds.y1&&e.bounds.y0>e.bounds.y1&&tt(n,"SCENE_BOUNDS",`${t}.bounds`,"y0 must not exceed y1")}void 0!==e.scale&&tn(e.scale,`${t}.scale`,n,{nonNegative:!0}),void 0===e.units||["strokeWidth","userSpaceOnUse"].includes(String(e.units))||tt(n,"SCENE_MARKER",`${t}.units`,"must be strokeWidth or userSpaceOnUse"),"number"==typeof e.orient?tn(e.orient,`${t}.orient`,n):void 0===e.orient||["auto","auto-start-reverse"].includes(String(e.orient))||tt(n,"SCENE_MARKER",`${t}.orient`,"must be auto, auto-start-reverse, or a finite angle"),void 0===e.overflow||["hidden","visible"].includes(String(e.overflow))||tt(n,"SCENE_MARKER",`${t}.overflow`,"must be hidden or visible");try{r(e)}catch(e){tt(n,"SCENE_MARKER",t,e instanceof Error?e.message:String(e))}return"string"==typeof e.id}function tf(e,t,r){let n;try{n=K(e),eD(n,eH)>eH&&tt(r.diagnostics,"SCENE_DOCUMENT",t,"has an oversized SVG serialization")}catch(e){tt(r.diagnostics,"SCENE_DOCUMENT",t,e instanceof Error?e.message:String(e))}return r.aggregateBudgets&&void 0!==n&&td(r.budget,"serializationBytes","serializationExceeded",n,t,r.diagnostics,eJ,"Scene serializations"),n}function tg(t,r,n,o,a){var s,d;if(o>eG)return void tt(n.diagnostics,"SCENE_BOUNDS",r,`exceeds maximum nesting depth ${eG}`);if(++n.nodeCount>eY){n.nodeCount===eY+1&&tt(n.diagnostics,"SCENE_BOUNDS",r,"contains too many Scene nodes");return}if(!te(t)||"string"!=typeof t.kind)return void tt(n.diagnostics,"SCENE_DOCUMENT",r,"must be a typed Scene node");let c=t.kind;if(function(e,t,r){if(te(e))if("connector"===e.kind){if(te(e.stroke)){let n=ts(e.stroke.color);n&&r.push({id:n,path:`${t}.stroke.color`})}if(Array.isArray(e.labels))for(let n=0;n<Math.min(e.labels.length,eY);n++){let i=e.labels[n];te(i)&&th(i.paint,`${t}.labels[${n}].paint`,r)}}else th(e.paint,`${t}.paint`,r)}(t,r,n.paintReferences),!["shape","connector","text","group","document"].includes(c))return void tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.kind`,`unknown Scene node kind "${c}"`);if(n.external&&o>0&&"document"===c&&tt(n.diagnostics,"SCENE_DOCUMENT",r,`${c} marks must be top-level document furniture`),n.external){let e=["kind","id","role","identity","accessibility","channels","transform","owner"];tr(t,{shape:[...e,"geometry","paint"],text:[...e,"text","x","y","fontSize","anchor","baselineShift","paint","fontWeight","letterSpacing","display","textLayout","block","measurement","prepared"],group:[...e,"open","close","children","join"],document:[...e,"element","text","domId","markerResources"],connector:[...e,"lineStyle","endpoints","relationship","route","stroke","markers","labels","hit","terminalProjection"]}[c],r,n.diagnostics)}if(ti(t.id,`${r}.id`,n.diagnostics,{externalId:n.external})){let e=n.ids.get(t.id);n.external&&e?tt(n.diagnostics,"SCENE_ID",`${r}.id`,`duplicates ${e.path}`):n.ids.set(t.id,{path:`${r}.id`,kind:c})}if(void 0!==t.domId&&ti(t.domId,`${r}.domId`,n.diagnostics,{externalId:n.external})){let e=n.domIds.get(t.domId),i=n.markerIds.get(t.domId),o=n.gradientIds.get(t.domId);n.external&&e?tt(n.diagnostics,"SCENE_ID",`${r}.domId`,`duplicates DOM id owned by ${e}`):n.external&&i?tt(n.diagnostics,"SCENE_ID",`${r}.domId`,`collides with marker resource "${t.domId}"`):o?tt(n.diagnostics,"SCENE_ID",`${r}.domId`,`collides with gradient resource "${t.domId}"`):n.domIds.set(t.domId,`${r}.domId`)}s=t.role,d=`${r}.role`,"string"!=typeof s?tt(n.diagnostics,"SCENE_ROLE",d,"must be a Scene role string"):Object.prototype.hasOwnProperty.call(R,s)||e0.test(s)?L(s).applicableKinds.includes(c)||tt(n.diagnostics,"SCENE_ROLE",d,`role "${s}" is not applicable to ${c} marks`):tt(n.diagnostics,"SCENE_ROLE",d,"must be a built-in or namespaced Scene role"),"string"==typeof t.id&&"string"==typeof t.role&&n.subjects.add(JSON.stringify([t.id,t.role])),te(t.identity)&&"string"==typeof t.identity.id&&"string"==typeof t.identity.role&&n.subjects.add(JSON.stringify([t.identity.id,t.identity.role])),te(t.owner)&&"string"==typeof t.owner.id&&"string"==typeof t.owner.role&&n.ownerReferences.push({key:JSON.stringify([t.owner.id,t.owner.role]),path:`${r}.owner`}),function(e,t,r){if(void 0!==e){if(!te(e))return tt(r,"SCENE_DOCUMENT",t,"must be a semantic channel object");for(let n of["importance","value","progress"])void 0!==e[n]&&tn(e[n],`${t}.${n}`,r);for(let n of("number"==typeof e.progress&&(e.progress<0||e.progress>1)&&tt(r,"SCENE_BOUNDS",`${t}.progress`,"must be in [0,1]"),["category","status","route"]))void 0!==e[n]&&ti(e[n],`${t}.${n}`,r,{max:4096});void 0!==e.emphasis&&"boolean"!=typeof e.emphasis&&tt(r,"SCENE_DOCUMENT",`${t}.emphasis`,"must be boolean")}}(t.channels,`${r}.channels`,n.diagnostics);let l=n.native&&"document"!==c?void 0:tf(t,r,n);if(void 0!==t.transform){if(te(t.transform)&&["rotate","matrix"].includes(String(t.transform.kind)))for(let e of"matrix"===t.transform.kind?["a","b","c","d","e","f"]:["angle","cx","cy"])tn(t.transform[e],`${r}.transform.${e}`,n.diagnostics);else tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.transform`,"must be a rotate or matrix transform");n.external&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.transform`,"external Scene transforms are not exposed by the declarative builder")}if(void 0!==t.owner&&(te(t.owner)?(ti(t.owner.id,`${r}.owner.id`,n.diagnostics),"string"==typeof t.owner.role&&(Object.hasOwn(R,t.owner.role)||e0.test(t.owner.role))||tt(n.diagnostics,"SCENE_ROLE",`${r}.owner.role`,"must be a Scene role")):tt(n.diagnostics,"SCENE_REFERENCE",`${r}.owner`,"must be a semantic owner")),void 0!==t.visibility&&"conditional"!==t.visibility&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.visibility`,"must be conditional"),void 0!==t.attributes&&function(e,t,r){if(!te(e))return tt(r,"SCENE_DOCUMENT",t,"must be an attribute hook object");if(tr(e,["className","data","ariaHidden","tabIndex","ariaLabel"],t,r),void 0===e.className||"string"==typeof e.className&&q.test(e.className)||tt(r,"SCENE_DOCUMENT",`${t}.className`,"must be space-separated CSS class tokens"),void 0!==e.ariaHidden&&!0!==e.ariaHidden&&tt(r,"SCENE_DOCUMENT",`${t}.ariaHidden`,"must be true when present"),void 0!==e.tabIndex&&0!==e.tabIndex&&tt(r,"SCENE_DOCUMENT",`${t}.tabIndex`,"must be 0 when present"),void 0!==e.ariaLabel&&ti(e.ariaLabel,`${t}.ariaLabel`,r,{max:eV}),void 0!==e.data){if(!te(e.data))return tt(r,"SCENE_DOCUMENT",`${t}.data`,"must be a string record");for(let[n,i]of Object.entries(e.data))(!G.test(n)||W.has(n))&&tt(r,"SCENE_DOCUMENT",`${t}.data.${n}`,"must be a family data-* key the writer does not own"),ti(i,`${t}.data.${n}`,r,{empty:!0,max:eV})}}(t.attributes,`${r}.attributes`,n.diagnostics),"shape"===c){void 0===t.identity&&"string"==typeof t.role&&v(t.role)&&(n.native&&"string"==typeof t.id&&te(t.owner)&&"string"==typeof t.owner.id&&t.owner.role===t.role?n.native.artwork.push({id:t.id,owner:{id:t.owner.id,role:t.role},path:`${r}.identity`}):a&&te(t.owner)&&t.role===a.role&&t.owner.id===a.id&&t.owner.role===a.role||tt(n.diagnostics,"SCENE_FIDELITY",`${r}.identity`,"owned artwork without DOM identity must be inside its matching semantic group")),void 0!==t.surfaceFragment&&"boolean"!=typeof t.surfaceFragment&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.surfaceFragment`,"must be boolean"),tm(t.geometry,`${r}.geometry`,n.diagnostics,!1,0,n.budget,n.external),n.external&&te(t.geometry)&&("path"===t.geometry.kind||"compound"===t.geometry.kind)&&tt(n.diagnostics,"SCENE_BOUNDS",`${r}.geometry`,"external shapes must use a directly bounded structured geometry"),ta(t.paint,`${r}.paint`,n.diagnostics,n.external),void 0!==t.childPaints&&(Array.isArray(t.childPaints)&&te(t.geometry)&&"compound"===t.geometry.kind&&Array.isArray(t.geometry.children)&&t.childPaints.length===t.geometry.children.length?t.childPaints.forEach((e,t)=>ta(e,`${r}.childPaints[${t}]`,n.diagnostics,n.external)):tt(n.diagnostics,"SCENE_PAINT",`${r}.childPaints`,"must give one paint per compound geometry child")),void 0!==t.conditionalPaint&&("conditional"!==t.visibility&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.conditionalPaint`,"requires an explicit conditional state"),ta(t.conditionalPaint,`${r}.conditionalPaint`,n.diagnostics,n.external));return}if("text"===c){if(ti(t.text,`${r}.text`,n.diagnostics,{empty:!0,max:eV}),n.aggregateBudgets&&td(n.budget,"textBytes","textExceeded",t.text,`${r}.text`,n.diagnostics,eK,"Scene text values"),tn(t.x,`${r}.x`,n.diagnostics),tn(t.y,`${r}.y`,n.diagnostics),tn(t.fontSize,`${r}.fontSize`,n.diagnostics,{positive:!0}),void 0!==t.fontWeight&&tn(t.fontWeight,`${r}.fontWeight`,n.diagnostics,{positive:!0}),void 0!==t.letterSpacing&&tn(t.letterSpacing,`${r}.letterSpacing`,n.diagnostics),void 0!==t.display&&"literal"!==t.display&&"formatted"!==t.display&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.display`,"must be literal or formatted"),void 0===t.measurement||["prepared","fallback"].includes(String(t.measurement))||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.measurement`,"must identify prepared or fallback measurement"),"prepared"!==t.measurement||te(t.block)&&"px"===t.block.unit&&te(t.block.prepared)||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.block`,"prepared text must retain its actual pixel block"),te(t.block)){for(let e of($(t.block)||tt(n.diagnostics,"SCENE_FIDELITY",`${r}.block`,"must retain the actual immutable pixel text preparation"),["fontSize","fontWeight","letterSpacing"]))void 0!==t[e]&&t[e]!==t.block[e]&&tt(n.diagnostics,"SCENE_FIDELITY",`${r}.block.${e}`,"must equal the retained text typography");for(let e of["width","height","fontSize","fontWeight","lineHeight"])tn(t.block[e],`${r}.block.${e}`,n.diagnostics,{nonNegative:!0});te(t.textLayout)&&(t.block.width!==t.textLayout.width||t.block.height!==t.textLayout.height||t.block.lineHeight!==t.textLayout.lineHeight)&&tt(n.diagnostics,"SCENE_FIDELITY",`${r}.textLayout`,"retained block differs from occupied text geometry")}if(void 0!==t.textLayout&&(te(t.textLayout)?(n.external&&tr(t.textLayout,["width","height","lineHeight","offsetY"],`${r}.textLayout`,n.diagnostics),tn(t.textLayout.width,`${r}.textLayout.width`,n.diagnostics,{nonNegative:!0}),tn(t.textLayout.height,`${r}.textLayout.height`,n.diagnostics,{nonNegative:!0}),tn(t.textLayout.lineHeight,`${r}.textLayout.lineHeight`,n.diagnostics,{positive:!0}),tn(t.textLayout.offsetY,`${r}.textLayout.offsetY`,n.diagnostics)):tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.textLayout`,"must be measured text geometry")),["start","middle","end"].includes(String(t.anchor))||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.anchor`,"must be start, middle, or end"),void 0!==t.baselineShift&&tn(t.baselineShift,`${r}.baselineShift`,n.diagnostics),void 0===t.dominantBaseline||["middle","central","hanging"].includes(String(t.dominantBaseline))||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.dominantBaseline`,"must be middle, central, or hanging"),void 0!==t.fontStyle&&"italic"!==t.fontStyle&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.fontStyle`,"must be italic"),void 0===t.textDecoration||["underline","line-through","underline line-through"].includes(String(t.textDecoration))||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.textDecoration`,"must be underline, line-through, or both"),void 0!==t.spans)if(Array.isArray(t.spans)&&0!==t.spans.length){t.spans.length>eY&&tt(n.diagnostics,"SCENE_BOUNDS",`${r}.spans`,"contains too many text runs");for(let e=0;e<Math.min(t.spans.length,eY);e++){let i=t.spans[e];if(!te(i)){tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.spans[${e}]`,"must be a painted run");continue}ti(i.text,`${r}.spans[${e}].text`,n.diagnostics,{empty:!0,max:eV}),n.aggregateBudgets&&td(n.budget,"textBytes","textExceeded",i.text,`${r}.spans[${e}].text`,n.diagnostics,eK,"Scene text values"),ta({fill:i.fill},`${r}.spans[${e}]`,n.diagnostics,n.external)}}else tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.spans`,"must be a non-empty run list");ta(t.paint,`${r}.paint`,n.diagnostics,n.external);return}if("group"===c){if(n.native&&"string"==typeof t.role&&v(t.role)&&te(t.identity)&&"string"==typeof t.identity.id&&t.identity.role===t.role&&n.native.groups.add(JSON.stringify([t.identity.id,t.role])),void 0!==t.paint&&(ta(t.paint,`${r}.paint`,n.diagnostics,n.external),te(t.paint)&&tr(t.paint,["opacity","fill"],`${r}.paint`,n.diagnostics)),!Array.isArray(t.children))return void tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.children`,"must be an array");t.children.length>eY&&tt(n.diagnostics,"SCENE_BOUNDS",`${r}.children`,"contains too many Scene nodes");let e=Math.min(t.children.length,Math.max(0,eY-n.nodeCount+1)),i="string"==typeof t.role&&v(t.role)?te(t.identity)&&"string"==typeof t.identity.id&&t.identity.role===t.role?{id:t.identity.id,role:t.role}:void 0:a;for(let a=0;a<e;a++){let e=t.children[a];te(e)?(tn(e.indent,`${r}.children[${a}].indent`,n.diagnostics,{nonNegative:!0}),tg(e.node,`${r}.children[${a}].node`,n,o+1,i)):tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.children[${a}]`,"must wrap a Scene node")}try{F(t)}catch(e){tt(n.diagnostics,"SCENE_DOCUMENT",r,String(e))}return void(n.external&&("string"!=typeof t.open||!/^<g(?:\s|>)/.test(t.open)||"</g>"!==t.close)&&tt(n.diagnostics,"SCENE_SECURITY",r,"external containers must use a generated <g> wrapper"))}if("document"===c){if(void 0!==t.nonPaint){let e={accessibility:["title","desc"],stylesheet:["style"],"interaction-metadata":["title","desc"]}[String(t.nonPaint)];("content"!==t.element||!e||void 0===l||I(l).some(t=>!e.includes(t.name)))&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.nonPaint`,"must describe only closed non-painting metadata elements")}if(["open","title","description","definitions","content","close"].includes(String(t.element))||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.element`,"has an unknown document element"),void 0!==t.markerResources)if(Array.isArray(t.markerResources)){t.markerResources.length>eY&&tt(n.diagnostics,"SCENE_BOUNDS",`${r}.markerResources`,"contains too many marker resources");for(let e=0;e<Math.min(t.markerResources.length,eY);e++){if(n.native&&n.markerIds.size>=eY)return void tt(n.diagnostics,"SCENE_BOUNDS",`${r}.markerResources`,"contains too many aggregate marker resources");let i=t.markerResources[e],o=`${r}.markerResources[${e}]`;if(tp(i,o,n.diagnostics,n.external,n.budget)&&"string"==typeof i.id){let e=n.markerIds.get(i.id),t=n.domIds.get(i.id);e?tt(n.diagnostics,"SCENE_MARKER",`${o}.id`,`duplicates marker resource "${i.id}"`):n.external&&t?tt(n.diagnostics,"SCENE_ID",`${o}.id`,`collides with DOM id owned by ${t}`):n.gradientIds.has(i.id)?tt(n.diagnostics,"SCENE_ID",`${o}.id`,`collides with gradient resource "${i.id}"`):n.markerIds.set(i.id,i)}}if(n.external&&"definitions"===t.element)try{let e=V(`<defs>
|
|
6
|
+
${i(t.markerResources)}
|
|
7
|
+
</defs>`);l!==e&&tt(n.diagnostics,"SCENE_FIDELITY",r,"definitions must be generated from the typed marker resources")}catch{}}else tt(n.diagnostics,"SCENE_MARKER",`${r}.markerResources`,"must be an array");if(void 0!==t.gradientResources)if("definitions"!==t.element&&tt(n.diagnostics,"SCENE_PAINT",`${r}.gradientResources`,"are only valid on a definitions document mark"),Array.isArray(t.gradientResources)){t.gradientResources.length>eU.maxResources&&tt(n.diagnostics,"SCENE_BOUNDS",`${r}.gradientResources`,`contains more than ${eU.maxResources} gradient resources`);for(let e=0;e<Math.min(t.gradientResources.length,eU.maxResources);e++){if(n.native&&n.gradientIds.size>=eU.maxResources)return void tt(n.diagnostics,"SCENE_BOUNDS",`${r}.gradientResources`,`contains more than ${eU.maxResources} aggregate gradient resources`);let i=t.gradientResources[e],o=`${r}.gradientResources[${e}]`;try{eB(i),n.gradientIds.has(i.id)||n.markerIds.has(i.id)||n.domIds.has(i.id)?tt(n.diagnostics,"SCENE_ID",`${o}.id`,`duplicates SVG resource id "${i.id}"`):n.gradientIds.set(i.id,i)}catch(e){tt(n.diagnostics,"SCENE_PAINT",o,e instanceof Error?e.message:String(e))}}if("definitions"===t.element)try{let e=[...Array.isArray(t.markerResources)&&t.markerResources.length>0?[i(t.markerResources)]:[],...t.gradientResources.length>0?[eL(t.gradientResources)]:[]].join(`
|
|
8
|
+
`),o=V(`<defs>
|
|
9
|
+
${e}
|
|
10
|
+
</defs>`);l!==o&&tt(n.diagnostics,"SCENE_FIDELITY",r,"definitions must be generated from typed resources")}catch{}}else tt(n.diagnostics,"SCENE_PAINT",`${r}.gradientResources`,"must be an array");n.aggregateBudgets&&("title"===t.element||"description"===t.element)&&(ti(t.text,`${r}.text`,n.diagnostics,{empty:!0,max:eV}),td(n.budget,"textBytes","textExceeded",t.text,`${r}.text`,n.diagnostics,eK,"Scene text values")),n.external&&"close"===t.element&&"</svg>"!==l&&tt(n.diagnostics,"SCENE_SECURITY",r,"external document close must be canonical");return}if(["solid","dotted","dashed","thick","invisible"].includes(String(t.lineStyle))||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.lineStyle`,"has an unknown line style"),te(t.endpoints)){for(let e of["from","to"])n.external&&void 0===t.endpoints[e]?tt(n.diagnostics,"SCENE_REFERENCE",`${r}.endpoints.${e}`,"is required for external connectors"):void 0!==t.endpoints[e]&&ti(t.endpoints[e],`${r}.endpoints.${e}`,n.diagnostics,{externalId:n.external})&&n.endpointReferences.push({id:t.endpoints[e],path:`${r}.endpoints.${e}`});for(let e of["start","end"]){let i=t.endpoints[e];if(te(i)&&(void 0!==i.point&&tc(i.point,`${r}.endpoints.${e}.point`,n.diagnostics,n.budget,n.external),void 0!==i.id&&ti(i.id,`${r}.endpoints.${e}.id`,n.diagnostics,{externalId:n.external}),void 0!==i.portId&&ti(i.portId,`${r}.endpoints.${e}.portId`,n.diagnostics,{externalId:n.external}),void 0!==i.owner)){let o=`${r}.endpoints.${e}.owner`;if(te(i.owner)){ti(i.owner.id,`${o}.id`,n.diagnostics),"string"==typeof i.owner.role&&(Object.hasOwn(R,i.owner.role)||e0.test(i.owner.role))||tt(n.diagnostics,"SCENE_ROLE",`${o}.role`,"must be a Scene role");let r=t.endpoints["start"===e?"from":"to"];void 0!==r&&i.owner.id!==r&&tt(n.diagnostics,"SCENE_FIDELITY",o,"must retain the authored endpoint identity"),n.ownerReferences.push({key:JSON.stringify([i.owner.id,i.owner.role]),path:o})}else tt(n.diagnostics,"SCENE_REFERENCE",o,"must be a semantic owner")}}}else tt(n.diagnostics,"SCENE_REFERENCE",`${r}.endpoints`,"must be a typed endpoint object");if(te(t.relationship)?ti(t.relationship.kind,`${r}.relationship.kind`,n.diagnostics,{max:4096}):tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.relationship`,"must be a typed relationship"),te(t.relationship)&&!["forward","reverse","bidirectional","undirected","self"].includes(String(t.relationship.direction))&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.relationship.direction`,"has an unknown connector direction"),te(t.route)){if(tm(t.route.geometry,`${r}.route.geometry`,n.diagnostics,!1,0,n.budget,n.external),n.external&&te(t.route.geometry)&&"path"===t.route.geometry.kind&&!Array.isArray(t.route.geometry.points)&&tt(n.diagnostics,"SCENE_BOUNDS",`${r}.route.geometry.points`,"external connector paths require deterministic routed points"),tn(t.route.bendRadius,`${r}.route.bendRadius`,n.diagnostics,{nonNegative:!0}),["authored","layout","family","projected"].includes(String(t.route.ownership))||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.route.ownership`,"has an unknown route ownership"),"boolean"!=typeof t.route.closed&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.route.closed`,"must be boolean"),!0===t.route.closed&&te(t.route.geometry)&&"path"!==t.route.geometry.kind&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.route.closed`,"closed connector topology requires path geometry"),void 0!==t.route.startTangent&&(tc(t.route.startTangent,`${r}.route.startTangent`,n.diagnostics,n.budget,n.external),tl(t.route.startTangent,`${r}.route.startTangent`,n.diagnostics)),void 0!==t.route.endTangent&&(tc(t.route.endTangent,`${r}.route.endTangent`,n.diagnostics,n.budget,n.external),tl(t.route.endTangent,`${r}.route.endTangent`,n.diagnostics)),Array.isArray(t.route.labelAnchors)){t.route.labelAnchors.length>eY&&tt(n.diagnostics,"SCENE_BOUNDS",`${r}.route.labelAnchors`,"contains too many points");let e=Math.min(t.route.labelAnchors.length,eY,Math.max(0,eZ-n.budget.points+1));for(let i=0;i<e;i++)tc(t.route.labelAnchors[i],`${r}.route.labelAnchors[${i}]`,n.diagnostics,n.budget,n.external)}else tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.route.labelAnchors`,"must be an array");if(Array.isArray(t.route.contours)){(0===t.route.contours.length||t.route.contours.length>eY)&&tt(n.diagnostics,"SCENE_BOUNDS",`${r}.route.contours`,"must contain a bounded non-empty contour list");for(let e=0;e<Math.min(t.route.contours.length,eY);e++){let i=t.route.contours[e];if(!te(i)){tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.route.contours[${e}]`,"must be typed contour semantics");continue}for(let[t,o]of(tc(i.start,`${r}.route.contours[${e}].start`,n.diagnostics,n.budget,n.external),tc(i.end,`${r}.route.contours[${e}].end`,n.diagnostics,n.budget,n.external),"boolean"!=typeof i.closed&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.route.contours[${e}].closed`,"must be boolean"),[["startTangent",i.startTangent],["endTangent",i.endTangent]])){if(void 0===o)continue;let i=`${r}.route.contours[${e}].${t}`;tc(o,i,n.diagnostics,n.budget,n.external),tl(o,i,n.diagnostics)}}}else tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.route.contours`,"must be an array")}else tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.route`,"must be a typed connector route");if(te(t.stroke)){if(void 0===e(t.stroke.color)&&(n.external||!ts(t.stroke.color))&&tt(n.diagnostics,"SCENE_PAINT",`${r}.stroke.color`,"must be a safe non-fetching CSS paint"),to(t.stroke.width,`${r}.stroke.width`,n.diagnostics,{nonNegative:!0,length:!0}),to(t.stroke.opacity,`${r}.stroke.opacity`,n.diagnostics,{unitInterval:!0}),to(t.stroke.miterLimit,`${r}.stroke.miterLimit`,n.diagnostics,{nonNegative:!0}),to(t.stroke.pathLength,`${r}.stroke.pathLength`,n.diagnostics,{nonNegative:!0}),["butt","round","square"].includes(String(t.stroke.lineCap))||tt(n.diagnostics,"SCENE_PAINT",`${r}.stroke.lineCap`,"has an unknown line cap"),["arcs","bevel","miter","miter-clip","round"].includes(String(t.stroke.lineJoin))||tt(n.diagnostics,"SCENE_PAINT",`${r}.stroke.lineJoin`,"has an unknown line join"),void 0===t.stroke.mixBlendMode||["normal","multiply"].includes(String(t.stroke.mixBlendMode))||tt(n.diagnostics,"SCENE_PAINT",`${r}.stroke.mixBlendMode`,"must be normal or multiply"),"boolean"!=typeof t.stroke.nonScaling&&tt(n.diagnostics,"SCENE_PAINT",`${r}.stroke.nonScaling`,"must be boolean"),void 0!==t.stroke.encodesValue&&"boolean"!=typeof t.stroke.encodesValue&&tt(n.diagnostics,"SCENE_PAINT",`${r}.stroke.encodesValue`,"must be boolean"),void 0!==t.stroke.dash)if(te(t.stroke.dash)){let e=t.stroke.dash.array;"string"==typeof e?e1.test(e.trim())||tt(n.diagnostics,"SCENE_PAINT",`${r}.stroke.dash.array`,"must be a finite numeric dash list"):Array.isArray(e)?e.forEach((e,t)=>to(e,`${r}.stroke.dash.array[${t}]`,n.diagnostics,{nonNegative:!0})):tt(n.diagnostics,"SCENE_PAINT",`${r}.stroke.dash.array`,"must be a string or numeric array"),to(t.stroke.dash.offset,`${r}.stroke.dash.offset`,n.diagnostics)}else tt(n.diagnostics,"SCENE_PAINT",`${r}.stroke.dash`,"must be a dash descriptor")}else tt(n.diagnostics,"SCENE_PAINT",`${r}.stroke`,"must be a typed connector stroke");if(te(t.hit)?(tm(t.hit.geometry,`${r}.hit.geometry`,n.diagnostics,!1,0,n.budget,n.external),tn(t.hit.strokeWidth,`${r}.hit.strokeWidth`,n.diagnostics,{nonNegative:!0}),"boolean"!=typeof t.hit.closed&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.hit.closed`,"must be boolean"),["stroke","none"].includes(String(t.hit.pointerEvents))||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.hit.pointerEvents`,"has unknown pointer-event semantics"),te(t.route)&&"boolean"==typeof t.route.closed&&"boolean"==typeof t.hit.closed&&t.hit.closed!==t.route.closed&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.hit.closed`,"must match route.closed topology")):tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.hit`,"must be typed hit geometry"),Array.isArray(t.labels)){t.labels.length>eY&&tt(n.diagnostics,"SCENE_BOUNDS",`${r}.labels`,"contains too many connector labels");for(let i=0;i<Math.min(t.labels.length,eY);i++){let o=t.labels[i];if(!te(o)){tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.labels[${i}]`,"must be a label descriptor");continue}if(n.external&&tr(o,["id","text","anchor","bounds","halo","clearance","paint","fontSize","textAnchor","visual"],`${r}.labels[${i}]`,n.diagnostics),void 0!==o.id&&ti(o.id,`${r}.labels[${i}].id`,n.diagnostics,{externalId:n.external}),ti(o.text,`${r}.labels[${i}].text`,n.diagnostics,{empty:!0,max:eV}),n.aggregateBudgets&&td(n.budget,"textBytes","textExceeded",o.text,`${r}.labels[${i}].text`,n.diagnostics,eK,"Scene text values"),void 0!==o.anchor&&tc(o.anchor,`${r}.labels[${i}].anchor`,n.diagnostics,n.budget,n.external),void 0!==o.bounds)if(te(o.bounds)){for(let e of(n.external&&tr(o.bounds,["x0","y0","x1","y1"],`${r}.labels[${i}].bounds`,n.diagnostics),["x0","y0","x1","y1"]))tn(o.bounds[e],`${r}.labels[${i}].bounds.${e}`,n.diagnostics);"number"==typeof o.bounds.x0&&"number"==typeof o.bounds.x1&&o.bounds.x0>o.bounds.x1&&tt(n.diagnostics,"SCENE_BOUNDS",`${r}.labels[${i}].bounds`,"x0 must not exceed x1"),"number"==typeof o.bounds.y0&&"number"==typeof o.bounds.y1&&o.bounds.y0>o.bounds.y1&&tt(n.diagnostics,"SCENE_BOUNDS",`${r}.labels[${i}].bounds`,"y0 must not exceed y1")}else tt(n.diagnostics,"SCENE_BOUNDS",`${r}.labels[${i}].bounds`,"must be a finite ordered box");if(void 0!==o.clearance&&tn(o.clearance,`${r}.labels[${i}].clearance`,n.diagnostics,{nonNegative:!0}),void 0===o.block||te(o.block)&&$(o.block)||tt(n.diagnostics,"SCENE_FIDELITY",`${r}.labels[${i}].block`,"must retain the actual immutable pixel text preparation"),void 0!==o.fontSize&&tn(o.fontSize,`${r}.labels[${i}].fontSize`,n.diagnostics,{positive:!0}),void 0!==o.fontWeight&&tn(o.fontWeight,`${r}.labels[${i}].fontWeight`,n.diagnostics,{positive:!0}),void 0!==o.letterSpacing&&tn(o.letterSpacing,`${r}.labels[${i}].letterSpacing`,n.diagnostics),void 0!==o.display&&"literal"!==o.display&&"formatted"!==o.display&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.labels[${i}].display`,"must be literal or formatted"),void 0===o.textAnchor||["start","middle","end"].includes(String(o.textAnchor))||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.labels[${i}].textAnchor`,"must be start, middle, or end"),void 0!==o.paint&&ta(o.paint,`${r}.labels[${i}].paint`,n.diagnostics,n.external),void 0!==o.halo&&(te(o.halo)?(n.external&&tr(o.halo,["color","width"],`${r}.labels[${i}].halo`,n.diagnostics),tn(o.halo.width,`${r}.labels[${i}].halo.width`,n.diagnostics,{nonNegative:!0}),void 0!==o.halo.color&&void 0===e(o.halo.color)&&tt(n.diagnostics,"SCENE_PAINT",`${r}.labels[${i}].halo.color`,"must be a safe non-fetching CSS paint")):tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.labels[${i}].halo`,"must be a halo descriptor")),void 0!==o.visual)if(te(o.visual)&&["inline","companion"].includes(String(o.visual.kind)))if("companion"===o.visual.kind){let e=`${r}.labels[${i}].visual.markId`;ti(o.visual.markId,e,n.diagnostics,{externalId:n.external})&&n.companionLabelReferences.push({id:o.visual.markId,path:e})}else(void 0===o.anchor||void 0===o.paint||void 0===o.fontSize||void 0===o.textAnchor)&&tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.labels[${i}].visual`,"inline labels require anchor, paint, fontSize, and textAnchor");else tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.labels[${i}].visual`,"must be inline or companion label ownership")}}if(te(t.markers)){Array.isArray(t.markers.mid)||tt(n.diagnostics,"SCENE_MARKER",`${r}.markers.mid`,"must be an array"),Array.isArray(t.markers.mid)&&t.markers.mid.length>eY&&tt(n.diagnostics,"SCENE_BOUNDS",`${r}.markers.mid`,"contains too many mid markers");let e=[[t.markers.start,`${r}.markers.start`],[t.markers.end,`${r}.markers.end`]];if(Array.isArray(t.markers.mid))for(let n=0;n<Math.min(t.markers.mid.length,eY);n++)e.push([t.markers.mid[n],`${r}.markers.mid[${n}]`]);for(let[t,r]of e)void 0!==t&&tp(t,r,n.diagnostics,n.external,n.budget)&&te(t)&&"string"==typeof t.id&&n.markerReferences.push({id:t.id,path:`${r}.id`,marker:t})}else tt(n.diagnostics,"SCENE_MARKER",`${r}.markers`,"must be a typed marker set");if(!(!n.external&&!n.crossChecks&&n.native&&void 0!==S(t))){if(te(t.terminalProjection)){for(let e of(["native","emulated","projected","lossy","unsupported"].includes(String(t.terminalProjection.realization))||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.terminalProjection.realization`,"has an unknown realization"),["line","polyline","path"].includes(String(t.terminalProjection.topology))||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.terminalProjection.topology`,"has an unknown topology"),tm(t.terminalProjection.geometry,`${r}.terminalProjection.geometry`,n.diagnostics,!1,0,void 0,n.external),["forward","reverse","bidirectional","undirected","self"].includes(String(t.terminalProjection.direction))||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.terminalProjection.direction`,"has an unknown direction"),["solid","dotted","dashed","thick","invisible"].includes(String(t.terminalProjection.lineStyle))||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.terminalProjection.lineStyle`,"has an unknown line style"),["labels","strokeLosses","diagnostics"]))Array.isArray(t.terminalProjection[e])||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.terminalProjection.${e}`,"must be an array");if(te(t.terminalProjection.markers)&&Array.isArray(t.terminalProjection.markers.mid)||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.terminalProjection.markers`,"must contain a mid-marker array"),te(t.terminalProjection.markerPlacements))for(let e of["start","mid","end"]){let i=t.terminalProjection.markerPlacements[e];if(!Array.isArray(i)){tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.terminalProjection.markerPlacements.${e}`,"must be an array");continue}for(let t=0;t<Math.min(i.length,eY);t++){let o=i[t];if(!te(o)){tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.terminalProjection.markerPlacements.${e}[${t}]`,"must be a marker placement");continue}ti(o.markerId,`${r}.terminalProjection.markerPlacements.${e}[${t}].markerId`,n.diagnostics,{externalId:n.external}),tc(o.point,`${r}.terminalProjection.markerPlacements.${e}[${t}].point`,n.diagnostics,void 0,n.external),tn(o.contourIndex,`${r}.terminalProjection.markerPlacements.${e}[${t}].contourIndex`,n.diagnostics,{nonNegative:!0})}}else tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.terminalProjection.markerPlacements`,"must contain typed start/mid/end marker placements");for(let e of["endpoints","route","stroke","hit"])te(t.terminalProjection[e])||tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.terminalProjection.${e}`,"must preserve typed connector semantics")}else tt(n.diagnostics,"SCENE_DOCUMENT",`${r}.terminalProjection`,"must be a terminal projection");!n.external&&n.crossChecks&&function(e,t,r){if(!te(e.route)||!te(e.stroke)||!te(e.markers)||!Array.isArray(e.markers.mid)||!Array.isArray(e.labels)||!te(e.hit)||!te(e.endpoints)||!te(e.relationship)||!te(e.terminalProjection)||!Array.isArray(e.terminalProjection.diagnostics))return;let n=e.route.geometry,i=P(n,e.route.closed),o=i.starts[0],a=i.ends.at(-1);for(let[n,i,s]of[["start",e.endpoints.start?.point,o],["end",e.endpoints.end?.point,a]])i&&s&&!z(i,s)&&tt(r.diagnostics,"SCENE_FIDELITY",`${t}.endpoints.${n}.point`,"must equal the endpoint derived from connector geometry");let s=U(n,e.route.closed);e.route.contours.length!==s.length&&tt(r.diagnostics,"SCENE_FIDELITY",`${t}.route.contours`,"must match the geometry-derived contour count");let d=!A(n);for(let n=0;n<Math.min(e.route.contours.length,s.length);n++){let i=e.route.contours[n],o=s[n];if(z(i.start,o.start)&&z(i.end,o.end)&&i.closed===o.closed||tt(r.diagnostics,"SCENE_FIDELITY",`${t}.route.contours[${n}]`,"must match geometry-derived endpoint topology"),d)for(let e of["startTangent","endTangent"]){let a=i[e],s=o[e];(void 0===a!=(void 0===s)||a&&s&&!z(a,s,1e-9))&&tt(r.diagnostics,"SCENE_FIDELITY",`${t}.route.contours[${n}].${e}`,"must match the tangent derived from linear route geometry")}}let c=e.route.contours[0]?.startTangent,l=e.route.contours.at(-1)?.endTangent;for(let[n,i,o]of[["startTangent",e.route.startTangent,c],["endTangent",e.route.endTangent,l]])(void 0===i!=(void 0===o)||i&&o&&!z(i,o,1e-9))&&tt(r.diagnostics,"SCENE_FIDELITY",`${t}.route.${n}`,"must equal the corresponding contour tangent authority");try{let i=k({geometry:n,lineStyle:e.lineStyle,endpoints:e.endpoints,relationship:e.relationship,route:e.route,stroke:e.stroke,markers:e.markers,labels:e.labels,hit:e.hit,...e.transform?{transform:e.transform}:{},additionalDiagnostics:e.terminalProjection.diagnostics.slice(1)});(function e(t,r){if(Object.is(t,r))return!0;if(Array.isArray(t)||Array.isArray(r))return Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((t,n)=>e(t,r[n]));if(!te(t)||!te(r))return!1;let n=Object.keys(t).filter(e=>void 0!==t[e]).sort(),i=Object.keys(r).filter(e=>void 0!==r[e]).sort();return n.length===i.length&&n.every((n,o)=>n===i[o]&&e(t[n],r[n]))})(e.terminalProjection,i)||tt(r.diagnostics,"SCENE_FIDELITY",`${t}.terminalProjection`,"must equal the canonical projection derived from connector semantics")}catch(e){tt(r.diagnostics,"SCENE_FIDELITY",`${t}.terminalProjection`,e instanceof Error?e.message:String(e))}}(t,r,n)}}function th(e,t,r){if(te(e))for(let n of["fill","stroke"]){let i=ts(e[n]);i&&r.push({id:i,path:`${t}.${n}`})}}function ty(e,t={}){return"external"===t.mode||"internal"===t.mode?t.mode:(te(e)&&"string"==typeof e.family?T(e.family):void 0)?.kind==="family"?"external":"internal"}function tb(e,t={}){let r=[];if(tk(e,!1,r),"external"===ty(e)&&tt(r,"SCENE_DOCUMENT","scene.family","native admission requires a built-in family"),r.length>0)throw new eW(r);let n={artwork:[],groups:new Set,enclosures:new Map},i={...tv(r,!1,t.crossChecks??!1,!0),native:n},o,a=()=>{if(o)throw Error("Native Scene validation has already finished");if(r.length>0)throw new eW(r)},s=e=>{if(a(),!Number.isInteger(e)||e<0||e>eG)throw tt(r,"SCENE_BOUNDS","scene.depth",`must be an integer nesting depth between 0 and ${eG}`),new eW(r)};return{node(e,t=0){if(a(),s(t),"group"===e.kind&&(!Array.isArray(e.children)||0!==e.children.length))throw tt(r,"SCENE_DOCUMENT","scene.parts","native groups must be shallow headers with separately submitted children"),new eW(r);let n=`scene.parts[${i.nodeCount}]`;if(tg(e,n,i,t),r.length>0)throw new eW(r);let o="document"===e.kind?K(e):tf(e,n,i);if(r.length>0)throw new eW(r);return o},depth:s,enclosure(e,t){a(),ti(e,"scene.enclosure.id",r),ti(t.id,"scene.enclosure.owner.id",r);let i=n.enclosures.get(e);if(i&&(i.id!==t.id||i.role!==t.role)?tt(r,"SCENE_FIDELITY","scene.enclosure","artwork cannot have conflicting semantic enclosures"):n.enclosures.size>=eY?tt(r,"SCENE_BOUNDS","scene.enclosure","contains too many semantic enclosure relations"):n.enclosures.set(e,{id:t.id,role:t.role}),r.length>0)throw new eW(r)},serialization(e){if(a(),eD(e,eH)>eH)throw tt(r,"SCENE_DOCUMENT","scene.serialization","has an oversized SVG serialization"),new eW(r)},finish(){if(o)return o;for(let e of(tE(i),n.artwork)){let t=n.enclosures.get(e.id);t&&t.id===e.owner.id&&t.role===e.owner.role&&n.groups.has(JSON.stringify([t.id,t.role]))||tt(r,"SCENE_FIDELITY",e.path,"owned artwork without DOM identity must be inside its matching semantic group")}return o=Object.freeze({valid:0===r.length,diagnostics:Object.freeze(r.map(e=>Object.freeze(e)))})}}}function tE(e){for(let t of e.paintReferences)e.gradientIds.has(t.id)||tt(e.diagnostics,"SCENE_REFERENCE",t.path,`references undeclared gradient "${t.id}"`);for(let t of e.ownerReferences)e.subjects.has(t.key)||tt(e.diagnostics,"SCENE_REFERENCE",t.path,"must reference an actual Scene subject identity and role");for(let t of e.companionLabelReferences){let r=e.ids.get(t.id);r?"text"!==r.kind&&tt(e.diagnostics,"SCENE_REFERENCE",t.path,`must reference a Text mark; "${t.id}" is a ${r.kind} mark`):tt(e.diagnostics,"SCENE_REFERENCE",t.path,`references unknown companion Text mark "${t.id}"`)}}function tv(e,t,r,n=t){return{diagnostics:e,external:t,aggregateBudgets:n,paintReferences:[],ids:new Map,subjects:new Set,ownerReferences:[],domIds:new Map,markerIds:new Map,gradientIds:new Map,markerReferences:[],endpointReferences:[],companionLabelReferences:[],budget:{textBytes:0,serializationBytes:0,points:0,textExceeded:!1,serializationExceeded:!1,pointsExceeded:!1,pointCollections:new WeakSet},crossChecks:r,nodeCount:0}}function tk(r,n,i){ti(r.family,"scene.family",i);let o=tn(r.width,"scene.width",i,n?{positive:!0}:{nonNegative:!0}),a=tn(r.height,"scene.height",i,n?{positive:!0}:{nonNegative:!0});if(void 0!==r.transparent&&"boolean"!=typeof r.transparent&&tt(i,"SCENE_DOCUMENT","scene.transparent","must be boolean"),te(r.colors)){for(let t of(n&&tr(r.colors,["bg","fg","line","accent","muted","surface","border","font","shadow","embedFontImport"],"scene.colors",i),["bg","fg","line","accent","muted","surface","border"]))("bg"===t||"fg"===t||void 0!==r.colors[t])&&void 0===e(r.colors[t])&&tt(i,"SCENE_PAINT",`scene.colors.${t}`,"must be a safe non-fetching CSS paint");void 0!==r.colors.font&&void 0===t(r.colors.font)&&tt(i,"SCENE_SECURITY","scene.colors.font","must be a safe non-fetching font family"),void 0!==r.colors.shadow&&"boolean"!=typeof r.colors.shadow&&tt(i,"SCENE_DOCUMENT","scene.colors.shadow","must be boolean"),void 0!==r.colors.embedFontImport&&"boolean"!=typeof r.colors.embedFontImport&&tt(i,"SCENE_DOCUMENT","scene.colors.embedFontImport","must be boolean")}else tt(i,"SCENE_DOCUMENT","scene.colors","must be a DiagramColors object");return{widthOk:o,heightOk:a}}function t$(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function tx(e){if("object"!=typeof e||null===e||Object.isFrozen(e))return e;for(let t of Object.values(e))tx(t);return Object.freeze(e)}var tS=globalThis.process?.env,tN=tS?.AGENTIC_MERMAID_SCENE_ASSERTIONS==="1",tw=new WeakSet;function tC(e){return tN||void 0!==e&&(tw.has(e)||"strict"===e.renderOptions.layoutSafety)}var tz=16*eF.maxNodes,tO=16*eF.maxNodes,t_=8*eF.maxTextBytes,tT=Object.freeze({...Object.freeze({maxObjects:4*eF.maxNodes,maxTextBytes:eF.maxTextBytes,maxArrayEntries:eF.maxNodes,maxAggregateArrayEntries:tO,maxDepth:4*eF.maxDepth,maxPropertiesPerObject:64,maxAggregateProperties:tz,maxPropertyKeyBytes:256,maxAggregatePropertyKeyBytes:t_}),maxObjects:8*eF.maxNodes,maxTextBytes:eF.maxTextBytes+eF.maxAggregateSerializationBytes+eF.maxFinalSvgBytes}),tj=new WeakMap;function tM(e,t,r=!0){tj.set(e,{mode:t,crossChecks:r})}function tI(){throw new eW([{code:"SCENE_DOCUMENT",path:"scene.family",message:"source-only browser admission requires a built-in family"}])}function tD(e,t,r){let n=function(e,t,r,n){let i=[];if(!te(e))return Object.freeze({valid:!1,diagnostics:Object.freeze([{code:"SCENE_DOCUMENT",path:"scene",message:"must be a Scene document object"}])});let o="external"===ty(e,t);if(o&&1)return tt(i,"SCENE_DOCUMENT","scene.family","source-only browser admission requires a built-in family"),Object.freeze({valid:!1,diagnostics:Object.freeze(i)});o&&tr(e,["family","width","height","colors","transparent","parts"],"scene",i);let{widthOk:a,heightOk:s}=tk(e,o,i);if(Array.isArray(e.parts)){let t=tv(i,o,r);e.parts.length>eY&&tt(i,"SCENE_BOUNDS","scene.parts","contains too many top-level Scene nodes");for(let r=0;r<Math.min(e.parts.length,eY);r++)tg(e.parts[r],`scene.parts[${r}]`,t,0);let n=o?(void 0).document(e,t,a,s):void 0;if(tE(t),0===i.length&&o&&(void 0).canonical(e,i),0===i.length&&r)try{let t=o?n:e.parts.map(K).join(`
|
|
11
|
+
`);void 0!==t&&ex(t,o?"strict":"default")}catch(e){tt(i,"SCENE_SECURITY","scene",e instanceof Error?e.message:String(e))}}else tt(i,"SCENE_DOCUMENT","scene.parts","must be an array");return Object.freeze({valid:0===i.length,diagnostics:Object.freeze(i.map(e=>Object.freeze(e)))})}(e,{mode:t},r);if(!n.valid)throw new eW(n.diagnostics)}function tA(e){return tU(e)}function tU(e,t,r=tC()){return function(e,t,r,n,i=!1){let o="object"==typeof e&&null!==e?tj.get(e):void 0;i&&("external"===t||void 0!==o&&("external"===o.mode||"external"===ty(e)))&&tI();let a="internal"!==t||r;if(void 0!==o&&o.mode===(t??ty(e)))return("external"===o.mode||r)&&!o.crossChecks&&(n(e,o.mode,!0),tM(e,o.mode,!0)),e;let s=function(e,t,r="input"){let n=new WeakSet,i=new WeakMap,o=0,a=0,s=0,d=0,c=0,l=(e,r,u)=>{if("string"==typeof e){let r=Math.max(0,t.maxTextBytes-a),n=eD(e,r);if(n>r)throw Error(`External Scene text values exceed the aggregate ${t.maxTextBytes}-byte limit`);return a+=n,e}if(null===e||"object"!=typeof e){if("function"==typeof e||"symbol"==typeof e||"bigint"==typeof e)throw TypeError(`External Scene ${u} must be declarative data`);return e}if(r>t.maxDepth)throw Error("External Scene input object graph is too deeply nested");if(++o>t.maxObjects)throw Error("External Scene input object graph is too large");if(n.has(e))throw Error("External Scene input must be acyclic");let m=i.get(e);if(void 0!==m)return m;n.add(e);try{if(Array.isArray(e)){if(Object.getPrototypeOf(e)!==Array.prototype)throw TypeError(`External Scene ${u} must be a plain array`);let n=Reflect.getOwnPropertyDescriptor(e,"length");if(!n||!("value"in n)||"number"!=typeof n.value||!Number.isSafeInteger(n.value)||n.value<0)throw TypeError(`External Scene ${u}.length must be a non-negative integer data property`);let o=n.value;if(o>t.maxArrayEntries)throw Error(`External Scene ${u} contains too many entries`);if((s+=o)>t.maxAggregateArrayEntries)throw Error(`External Scene input exceeds the aggregate ${t.maxAggregateArrayEntries}-array-entry limit`);let a=Reflect.ownKeys(e);if(a.length>o+1||!a.includes("length"))throw TypeError(`External Scene ${u} must not define custom array properties or iterators`);let d=new Map;for(let t of(d.set("length",n),a)){if("length"===t)continue;let r=Reflect.getOwnPropertyDescriptor(e,t);if(!r)throw TypeError(`External Scene ${u} has an unstable property descriptor`);d.set(t,r)}for(let e of a)if("length"!==e&&("string"!=typeof e||!/^(?:0|[1-9]\d*)$/.test(e)||Number(e)>=o))throw TypeError(`External Scene ${u} must not define custom array properties or iterators`);let c=Array(o);i.set(e,c),H(e,c);for(let e=0;e<o;e++){let t=d.get(String(e));if(!t)throw TypeError(`External Scene ${u} must not be sparse`);if(!("value"in t)||!t.enumerable)throw TypeError(`External Scene ${u}[${e}] must be an enumerable data property`);c[e]=l(t.value,r+1,`${u}[${e}]`)}return Object.freeze(c)}let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&null!==n)throw TypeError(`External Scene ${u} must be a plain object`);let o=Reflect.ownKeys(e);if(o.length>t.maxPropertiesPerObject)throw Error(`External Scene ${u} contains too many properties`);if((d+=o.length)>t.maxAggregateProperties)throw Error(`External Scene input exceeds the aggregate ${t.maxAggregateProperties}-property limit`);for(let e of o){if("string"!=typeof e)continue;let r=Math.max(0,t.maxAggregatePropertyKeyBytes-c),n=eD(e,Math.min(t.maxPropertyKeyBytes,r));if(n>t.maxPropertyKeyBytes)throw Error(`External Scene ${u} contains a property key longer than ${t.maxPropertyKeyBytes} bytes`);if(n>r)throw Error(`External Scene property keys exceed the aggregate ${t.maxAggregatePropertyKeyBytes}-byte limit`);c+=n}let a=Object.create(null);for(let t of(i.set(e,a),H(e,a),o)){let n;if("string"!=typeof t)throw TypeError(`External Scene ${u} must not contain symbol keys`);let i=Reflect.getOwnPropertyDescriptor(e,t);if(!i||!i.enumerable)throw TypeError(`External Scene ${u}.${t} must be an enumerable data property`);if("value"in i)n=i.value;else if(n=N(e,t,i),void 0===n)throw TypeError(`External Scene ${u}.${t} must be an enumerable data property`);Object.defineProperty(a,t,{value:l(n,r+1,`${u}.${t}`),enumerable:!0,configurable:!1,writable:!1})}return x(e,a),Object.freeze(a)}finally{n.delete(e)}};return l(e,0,r)}(e,tT,"scene");return i&&"external"===ty(s)&&tI(),n(s,t,"internal"!==t||r),tM(s,t??ty(s),a),s}(e,t,r,tD,!0)}var tP="backend-claim-matrix@4";function tB(){let e={bg:"#ffffff",fg:"#172033",line:"#334155",accent:"#a33b20"},t={id:"backend-conformance-arrow",shape:"arrow",geometry:{kind:"path",d:"M 0 0 L 8 4 L 0 8 Z"},size:{width:8,height:8},viewBox:{x:0,y:0,width:8,height:8},ref:{x:8,y:4},units:"userSpaceOnUse",orient:"auto",overflow:"visible",paint:{fill:"#a33b20",stroke:"#334155",strokeWidth:"1"}},r={id:"backend-conformance-gradient",units:"userSpaceOnUse",x1:0,y1:0,x2:120,y2:0,stops:[{offset:0,color:"#a33b20"},{offset:1,color:"#334155"}]},i=h({id:"backend-conformance-prelude",width:120,height:80,colors:e,transparent:!0,font:"Inter",hasMonoFont:!1},'<svg xmlns="http://www.w3.org/2000/svg" width="120" height="80" viewBox="0 0 120 80" role="img" aria-labelledby="backend-conformance-title backend-conformance-description">'),c=d({id:"backend-conformance-title",element:"title",text:"Backend conformance fixture",domId:"backend-conformance-title"}),u=d({id:"backend-conformance-description",element:"description",text:"A representative Scene document",domId:"backend-conformance-description"}),p=l({id:"backend-conformance-definitions",markerResources:[t],gradientResources:[r]},`<defs>
|
|
12
|
+
${n(t)}
|
|
13
|
+
${eR(r)}
|
|
14
|
+
</defs>`),g=o({id:"backend-conformance-node",role:"node",geometry:{kind:"rect",x:8,y:16,width:34,height:24,rx:3,ry:3},paint:{fill:"#f4efe6",stroke:"#334155",strokeWidth:"2"}}),y=f({id:"backend-conformance-container",role:"group",open:"<g>",paint:{opacity:"0.8",fill:"#f4efe6"},close:"</g>",children:[{node:g,indent:2}]}),b=o({id:"backend-conformance-data-mark",role:"bar",geometry:{kind:"rect",x:92,y:48,width:16,height:20},paint:{fill:"#a33b20",stroke:"#334155",strokeWidth:"1"},channels:{value:.75,category:"fixture"}}),E=a({id:"backend-conformance-relation",role:"edge",geometry:{kind:"path",d:"M 42 28 L 62 14 Q 66 12 70 14 L 90 28",points:[{x:42,y:28},{x:66,y:12},{x:90,y:28}],markerMidpoints:[{x:62,y:14},{x:70,y:14}]},lineStyle:"dashed",paint:{fill:"none",stroke:"#334155",strokeWidth:"2",opacity:"0.65",strokeLinecap:"square",strokeLinejoin:"bevel",strokeMiterlimit:"7",strokeDasharray:"6 3",strokeDashoffset:"2",vectorEffect:"non-scaling-stroke",paintOrder:"stroke fill"},endpoints:{from:"backend-conformance-node",to:"backend-conformance-data-mark"},relationship:{kind:"dependency",direction:"forward"},route:{ownership:"layout",bendRadius:4,labelAnchors:[{x:66,y:8}],contours:[{start:{x:42,y:28},end:{x:90,y:28},closed:!1,startTangent:{x:.8192319205190405,y:-.5734623443633283},endTangent:{x:.8192319205190405,y:.5734623443633283}}]},stroke:{opacity:.65,dash:{array:"6 3",offset:2},lineCap:"square",lineJoin:"bevel",miterLimit:7,pathLength:77,paintOrder:"stroke fill",mixBlendMode:"multiply",nonScaling:!0},markers:{start:t,mid:[t],end:t},labels:[{id:"backend-conformance-relation-label",text:"depends on",anchor:{x:66,y:8},clearance:2,halo:{color:"#ffffff",width:3},paint:{fill:"#172033"},fontSize:11,textAnchor:"middle",visual:{kind:"inline"}}]}),v=a({id:"backend-conformance-freehand-relation",role:"edge",geometry:{kind:"line",x1:42,y1:58,x2:90,y2:58},lineStyle:"solid",paint:{fill:"none",stroke:"#334155",strokeWidth:"2",strokeLinecap:"square",strokeLinejoin:"miter",strokeMiterlimit:"7",vectorEffect:"non-scaling-stroke"},endpoints:{from:"backend-conformance-node",to:"backend-conformance-data-mark"},relationship:{kind:"association",direction:"forward"},stroke:{lineCap:"square",lineJoin:"miter",miterLimit:7,nonScaling:!0},transform:{kind:"rotate",angle:90,cx:42,cy:58}}),k=a({id:"backend-conformance-closed-relation",role:"edge",geometry:{kind:"path",d:"M 10 65 L 25 50 L 40 65 Z",points:[{x:10,y:65},{x:25,y:50},{x:40,y:65}]},lineStyle:"solid",paint:{fill:"none",stroke:"#334155",strokeWidth:"2"},route:{ownership:"authored",closed:!0}}),$=a({id:"backend-conformance-multi-relation",role:"edge",geometry:{kind:"path",d:"M 8 72 L 28 72 M 52 72 L 72 72",points:[{x:8,y:72},{x:28,y:72},{x:52,y:72},{x:72,y:72}],subpaths:[{points:[{x:8,y:72},{x:28,y:72}],closed:!1},{points:[{x:52,y:72},{x:72,y:72}],closed:!1}]},lineStyle:"solid",paint:{fill:"none",stroke:"#334155",strokeWidth:"2"},markers:{start:t,mid:[],end:t}}),x=s({id:"backend-conformance-text",role:"member",text:"Fixture label",x:25,y:31,fontSize:12,anchor:"middle",paint:{fill:"#172033"},baselineShift:0});return tx({doc:{family:"backend-conformance",width:120,height:80,colors:e,transparent:!1,parts:[i,c,u,p,y,b,E,x,m()]},context:{seed:24301,style:{stroke:"freehand",fill:"wash",roughness:1,bowing:1,passes:2,strokeWidth:1.5,hachureAngle:-41,hachureGap:5,fillWeight:.8,washOpacity:.3,washEdge:.34,backdrop:"plain"}},probes:[{primitive:"document",node:i,requiredFragments:["<svg","backend-conformance-title"]},{primitive:"marker",node:p,requiredFragments:['id="backend-conformance-arrow"']},{primitive:"container",node:y,requiredFragments:['data-id="backend-conformance-container"','data-id="backend-conformance-node"']},{primitive:"shape",node:g,requiredFragments:['data-id="backend-conformance-node"','data-role="node"']},{primitive:"data-mark",node:b,requiredFragments:['data-id="backend-conformance-data-mark"','data-role="bar"']},{primitive:"connector",node:E,requiredFragments:['data-id="backend-conformance-relation"','data-role="edge"']},{primitive:"text",node:x,requiredFragments:['data-id="backend-conformance-text"',"Fixture label"]}],nodes:{root:i,marker:p,shape:g,container:y,dataMark:b,richConnector:E,freehandConnector:v,closedConnector:k,multiSubpathConnector:$,label:x}})}function tR(e){return 0===e.length?void 0:`missing ${e.join(", ")}`}function tL(e,t,r){return e?{passed:e,observation:t}:{passed:e,observation:t,diagnostic:r}}function tF(e,t){return e.split(t).length-1}function tW(e,t){let r=e.drawNode(t,t0.context);return e9(r,"backend conformance drawNode output"),r}function tq(e){let t=e.render(t0.doc,t0.context);return e9(t,"backend conformance render output"),t}function tY(e,t){let r=e.match(/^\s*<(?:line|polyline|path)\b[^>]*>/)?.[0]??"";return/\sstroke-opacity="0"/.test(r)?e.split(`
|
|
15
|
+
`).slice(t.split(`
|
|
16
|
+
`).length).join(`
|
|
17
|
+
`):e}function tG(e,t,r,n=()=>!0){let i=tW(e,r),o=tY(i,K(r)),a="text"===r.kind?i.includes(r.text)&&i.includes(`x="${r.x}"`)&&i.includes(`y="${r.y}"`):"shape"===r.kind&&"rect"===r.geometry.kind?i.includes(`x="${r.geometry.x}"`)&&i.includes(`y="${r.geometry.y}"`)&&i.includes(`width="${r.geometry.width}"`)&&i.includes(`height="${r.geometry.height}"`):"connector"===r.kind&&"line"===r.route.geometry.kind?i.includes(`x1="${r.route.geometry.x1}"`)&&i.includes(`y1="${r.route.geometry.y1}"`)&&i.includes(`x2="${r.route.geometry.x2}"`)&&i.includes(`y2="${r.route.geometry.y2}"`):"connector"===r.kind&&"path"===r.route.geometry.kind?i.includes(`d="${r.route.geometry.d}"`):i===K(r),s="native"===t.realization?a:"emulated"===t.realization&&i!==K(r)&&o.includes("<path"),d="backend:hybrid"!==t.target||"shape"!==r.kind||i.includes("fill-opacity=")&&i.includes('stroke="none"');return tL(s&&d&&n(i,o),(t.realization,""),`backend output did not demonstrate ${t.realization} ${t.primitive}/${t.feature}`)}function tV(e,t,r,n){let i="lossy"===t.realization?t0.nodes.freehandConnector:t0.nodes.richConnector,o=tW(e,i),a=tY(o,K(i));return"lossy"===t.realization?tL(o!==K(i)&&a.includes('stroke="none"')&&!a.includes(`${r}="`),"",`lossy ${r} projection was not observable on the visible freehand ribbon`):tL(("native"===t.realization?o.includes('data-id="backend-conformance-relation"'):o!==K(i))&&a.includes(`${r}="${n}"`),(t.realization,""),`${r}=${n} was not preserved by the ${t.realization} realization`)}function tK(e){return[e.primitive,e.feature,e.operation].join("/")}Object.freeze(["draw-node-determinism","draw-node-semantics","document-determinism","single-svg-document","finite-serialization","output-security","document-semantics","container-semantics","shape-semantics","text-semantics","connector-semantics","marker-semantics","data-mark-semantics","capability-claims"]);var tZ=Object.freeze({"document/identity/serialize":e=>{let t=tq(e);return tL(1===tF(t,"<svg")&&t.includes('viewBox="0 0 120 80"')&&t.trimEnd().endsWith("</svg>"),"","document envelope or bounds were not preserved")},"document/resources/serialize":e=>{let t=tq(e);return tL(t.includes("<defs>")&&t.includes('id="backend-conformance-arrow"')&&t.includes('<linearGradient id="backend-conformance-gradient"')&&e$(t).ok,"","document resources were missing or unsafe")},"document/interaction/accessibility":e=>{let t=tq(e);return tL(t.includes('role="img"')&&t.includes('aria-labelledby="backend-conformance-title backend-conformance-description"')&&t.includes('<title id="backend-conformance-title">Backend conformance fixture</title>')&&t.includes('<desc id="backend-conformance-description">A representative Scene document</desc>'),"","document accessibility projection was incomplete")},"text/geometry/render":(e,t)=>tG(e,t,t0.nodes.label,e=>e.includes('x="25"')&&e.includes('y="31"')&&e.includes('font-size="12"')),"text/paint/render":(e,t)=>tG(e,t,t0.nodes.label,e=>e.includes('fill="#172033"')),"text/labels/accessibility":e=>tL(tW(e,t0.nodes.label).includes("Fixture label"),"","text label was not serialized"),"text/identity/serialize":e=>{let t=tW(e,t0.nodes.label);return tL(t.includes('data-id="backend-conformance-text"')&&t.includes('data-role="member"'),"","text DOM identity was lost")},"shape/geometry/render":(e,t)=>tG(e,t,t0.nodes.shape),"shape/paint/render":(e,t)=>tG(e,t,t0.nodes.shape,e=>e.includes("#334155")&&e.includes("#f4efe6")),"shape/identity/serialize":e=>{let t=tW(e,t0.nodes.shape);return tL(t.includes('data-id="backend-conformance-node"')&&t.includes('data-role="node"'),"","shape DOM identity was lost")},"container/geometry/render":(e,t)=>{let r=tW(e,t0.nodes.container);return tL("native"===t.realization&&r.startsWith("<g ")&&r.trimEnd().endsWith("</g>")&&r.includes('data-id="backend-conformance-node"'),"","container boundary/child geometry was not preserved as a native wrapper")},"container/paint/render":(e,t)=>{let r=tW(e,t0.nodes.container);return tL("native"===t.realization&&r.includes('opacity="0.8"')&&r.includes('fill="#f4efe6"'),"","container paint cascade was not preserved as a native wrapper")},"container/identity/serialize":e=>{let t=tW(e,t0.nodes.container);return tL(t.includes('data-id="backend-conformance-container"')&&t.includes('data-role="group"'),"","container DOM identity was lost")},"connector/geometry/render":(e,t)=>{let r=t0.nodes.richConnector,n=tW(e,r),i=tY(n,K(r));return tL("native"===t.realization?"path"===r.route.geometry.kind&&n.includes(`d="${r.route.geometry.d}"`):"lossy"===t.realization&&n!==K(r)&&n.includes("Q 66 12 70 14")&&!i.includes("Q 66 12 70 14"),(t.realization,""),"connector geometry realization did not match its claim")},"connector/stroke/render":(e,t)=>tG(e,t,t0.nodes.freehandConnector,e=>e.includes("#334155")),"connector/transform/render":(e,t)=>{let r=t0.nodes.freehandConnector,n=tW(e,r),i=tY(n,K(r));return tL(n.includes('transform="rotate(90 42 58)"')&&eI(r,{x:42,y:82})&&!eI(r,{x:66,y:58})&&("native"===t.realization?!/\sstroke-opacity="0"/.test(n.match(/^\s*<(?:line|polyline|path)\b[^>]*>/)?.[0]??""):"emulated"===t.realization&&i.startsWith('<g transform="rotate(90 42 58)">')),"","connector transform was not preserved by both rendering and interaction")},"connector/topology/render":(e,t)=>{let r=t0.nodes.richConnector,n=tW(e,r),i=tY(n,K(r));return tL("native"===t.realization?"path"===r.route.geometry.kind&&n.includes(`d="${r.route.geometry.d}"`):"lossy"===t.realization&&n!==K(r)&&n.includes("Q 66 12 70 14")&&!i.includes("Q 66 12 70 14"),(t.realization,""),"connector topology realization did not match its claim")},"connector/subpaths/render":(e,t)=>{let r=t0.nodes.multiSubpathConnector,n=tW(e,r),i=tY(n,K(r)),o=eI(r,{x:18,y:72})&&eI(r,{x:62,y:72})&&!eI(r,{x:40,y:72})&&2===r.route.contours.length&&r.route.contours.every(e=>e.startTangent?.x===1&&e.endTangent?.x===1),a="native"===t.realization?2===tF(n.match(/^\s*<path\b[^>]*>/)?.[0]??"","M "):"emulated"===t.realization&&n!==K(r)&&tF(i,"<path")>=2;return tL(o&&a,"","connector subpath boundaries were not preserved")},"connector/closedness/render":(e,t)=>{let r=t0.nodes.closedConnector,n=tW(e,r),i=tY(n,K(r));return tL(eI(r,{x:25,y:65})&&("native"===t.realization?/\sZ(?:\s|"|")/.test(n.match(/^\s*<path\b[^>]*>/)?.[0]??""):"lossy"===t.realization&&n!==K(r)&&/\sZ(?:\s|"|")/.test(n.slice(0,n.indexOf(`
|
|
18
|
+
`)))&&!i.includes("M 10 65 L 25 50 L 40 65 Z")),(t.realization,""),"output did not demonstrate the declared closedness realization")},"connector/bend-radius/render":(e,t)=>{let r=t0.nodes.richConnector,n=tW(e,r),i=tY(n,K(r));return tL(n.includes("Q 66 12 70 14")&&4===r.route.bendRadius&&("native"===t.realization?!/\sstroke-opacity="0"/.test(n.match(/^\s*<path\b[^>]*>/)?.[0]??""):"lossy"===t.realization&&n!==K(r)&&!i.includes("Q 66 12 70 14")),(t.realization,""),"bend-radius realization did not match the declared capability")},"connector/stroke-opacity/render":(e,t)=>tV(e,t,"stroke-opacity","0.65"),"connector/stroke-cap/render":(e,t)=>tV(e,t,"stroke-linecap","square"),"connector/stroke-join/render":(e,t)=>tV(e,t,"stroke-linejoin","bevel"),"connector/stroke-miter/render":(e,t)=>tV(e,t,"stroke-miterlimit","7"),"connector/dash-array/render":(e,t)=>tV(e,t,"stroke-dasharray","6 3"),"connector/dash-offset/render":(e,t)=>tV(e,t,"stroke-dashoffset","2"),"connector/dash-restart/render":(e,t)=>{let r=t0.nodes.richConnector,n=tY(tW(e,r),K(r)),i=tF(n,'stroke-dasharray="6 3"'),o=tF(n,"M");return tL("native"===t.realization?1===i:"lossy"===t.realization&&i>=1&&o>1,(t.realization,""),"dash restart boundaries did not match the declared realization")},"connector/path-length/render":(e,t)=>{let r=t0.nodes.richConnector,n=tY(tW(e,r),K(r)),i=tF(n,'pathLength="77"'),o=tF(n,"M");return tL("native"===t.realization?1===i:"lossy"===t.realization&&i>=1&&o>1,(t.realization,""),"pathLength behavior did not match the declared realization")},"connector/paint-order/render":(e,t)=>tV(e,t,"paint-order","stroke fill"),"connector/compositing/render":(e,t)=>tV(e,t,"style","mix-blend-mode:multiply"),"connector/non-scaling-stroke/render":(e,t)=>tV(e,t,"vector-effect","non-scaling-stroke"),"connector/marker-orientation/render":(e,t)=>{let r=tq(e);if("unsupported"===t.realization)return tL(r.includes('orient="auto"')&&!r.includes('marker-start="url(#backend-conformance-arrow)"')&&!r.includes('marker-mid="url(#backend-conformance-arrow)"')&&!r.includes('marker-end="url(#backend-conformance-arrow)"'),"","backend declared connector marker orientation unsupported but attached the marker");let n=r.includes('orient="auto"')&&r.includes('marker-start="url(#backend-conformance-arrow)"')&&r.includes('marker-mid="url(#backend-conformance-arrow)"')&&r.includes('marker-end="url(#backend-conformance-arrow)"'),i="projected"!==t.realization||r.includes('markerUnits="userSpaceOnUse"');return tL(("native"===t.realization||"projected"===t.realization)&&n&&i,(t.realization,""),"marker orientation/carrier projection did not match the declaration")},"connector/marker-overflow/render":(e,t)=>{let r=tq(e),n=r.includes('marker-start="url(#backend-conformance-arrow)"')&&r.includes('marker-end="url(#backend-conformance-arrow)"');return"unsupported"===t.realization?tL(r.includes('overflow="visible"')&&!n&&!r.includes('marker-mid="url(#backend-conformance-arrow)"'),"","backend declared connector marker overflow unsupported but attached the marker"):tL(("native"===t.realization||"projected"===t.realization)&&r.includes('overflow="visible"')&&n,(t.realization,""),"marker overflow or its connector attachment was not preserved")},"connector/endpoints/serialize":e=>{let t=tW(e,t0.nodes.richConnector);return tL(t.includes('data-from="backend-conformance-node"')&&t.includes('data-to="backend-conformance-data-mark"'),"","connector endpoint identities were not serialized")},"connector/direction/serialize":e=>{let t=tW(e,t0.nodes.richConnector);return tL(t.includes('data-relationship="dependency"')&&t.includes('data-direction="forward"'),"","connector relationship direction was not serialized")},"connector/labels/accessibility":e=>tL(tW(e,t0.nodes.richConnector).includes('aria-label="backend-conformance-node to backend-conformance-data-mark: depends on"'),"","connector label was absent from accessibility output"),"connector/labels/render":(e,t)=>{let r=tW(e,t0.nodes.richConnector);return tL("native"===t.realization&&r.includes('data-id="backend-conformance-relation-label"')&&r.includes('data-connector-label-for="backend-conformance-relation"')&&r.includes('x="66" y="6"')&&r.includes('font-size="11"')&&r.includes('fill="#172033"')&&r.includes('stroke="#ffffff"')&&r.includes('stroke-width="3"')&&r.includes('paint-order="stroke fill"')&&r.includes(">depends on</text>"),"","connector label visual semantics were not preserved")},"connector/relation/accessibility":e=>{let t=tW(e,t0.nodes.richConnector);return tL(t.includes('data-from="backend-conformance-node"')&&t.includes('data-to="backend-conformance-data-mark"')&&t.includes('role="graphics-symbol"')&&t.includes('aria-roledescription="relation"')&&t.includes('aria-label="backend-conformance-node to backend-conformance-data-mark: depends on"'),"","connector relation accessibility semantics were lost")},"connector/markers/render":(e,t)=>{let r=tW(e,t0.nodes.richConnector);return"unsupported"===t.realization?tL(!r.includes('marker-start="url(#backend-conformance-arrow)"')&&!r.includes('marker-mid="url(#backend-conformance-arrow)"')&&!r.includes('marker-end="url(#backend-conformance-arrow)"'),"","backend declared connector markers unsupported but still serialized one"):tL(("native"===t.realization||"projected"===t.realization)&&r.includes('marker-start="url(#backend-conformance-arrow)"')&&r.includes('marker-mid="url(#backend-conformance-arrow)"')&&r.includes('marker-end="url(#backend-conformance-arrow)"'),(t.realization,""),"connector marker projection did not match the declaration")},"connector/interaction/hit-test":e=>{let t=t0.nodes.freehandConnector;return tL(tW(e,t).includes('data-id="backend-conformance-freehand-relation"')&&eI(t,{x:42,y:82})&&!eI(t,{x:66,y:58}),"","connector carrier or typed hit geometry was not preserved")},"connector/hit-geometry/hit-test":e=>{let t=t0.nodes.multiSubpathConnector;return tL(tW(e,t).includes('data-id="backend-conformance-multi-relation"')&&eI(t,{x:18,y:72})&&!eI(t,{x:40,y:72}),"","connector hit geometry did not preserve typed contour boundaries")},"connector/identity/serialize":e=>{let t=tW(e,t0.nodes.richConnector);return tL(t.includes('data-id="backend-conformance-relation"')&&t.includes('data-role="edge"'),"","connector DOM identity was lost")},"marker/geometry/render":(e,t)=>{let r=tW(e,t0.nodes.marker);return tL(("native"===t.realization||"projected"===t.realization)&&r.includes("M 0 0 L 8 4 L 0 8 Z")&&r.includes('viewBox="0 0 8 8"'),(t.realization,""),"marker geometry was not present in backend output")},"marker/paint/render":(e,t)=>{let r=tW(e,t0.nodes.marker);return tL(("native"===t.realization||"projected"===t.realization)&&r.includes('fill="#a33b20"')&&r.includes('stroke="#334155"'),(t.realization,""),"marker paint was not present in backend output")},"marker/identity/serialize":e=>tL(tW(e,t0.nodes.marker).includes('id="backend-conformance-arrow"'),"","marker resource identity was lost"),"data-mark/geometry/render":(e,t)=>tG(e,t,t0.nodes.dataMark),"data-mark/paint/render":(e,t)=>tG(e,t,t0.nodes.dataMark,e=>e.includes("#a33b20")&&e.includes("#334155")),"data-mark/identity/serialize":e=>{let t=tW(e,t0.nodes.dataMark);return tL(t.includes('data-id="backend-conformance-data-mark"')&&t.includes('data-role="bar"'),"","quantitative mark DOM identity was lost")}}),tH=Symbol();function tJ(e,t,r){return e[tH]?.(t,r)??r}function tQ(e,t,r,n){return[e,...n.map(e=>Z(e.serialized,e.indent)),t].join(r)}function tX(e,t){return!t.style||e.transparent?"":`<rect width="${E(e.width)}" height="${E(e.height)}" fill="var(--bg)" data-backdrop="page" />`}var t0,t1,t2={id:"default",capabilities:e_("backend:default","crisp"),drawNode:e=>K(e),render(e,t){let r=tA(e),n=tX(r,t);return r.parts.map((e,r)=>{let i=tJ(t,e,K(e));return n&&0===r?`${i}
|
|
19
|
+
${n}`:i}).join(`
|
|
20
|
+
`)}},t3=new WeakSet([t2.render]),t4=Object.getOwnPropertyDescriptors(t2);function t5(e){return e===t2&&t3.has(e.render)}function t6(e){return void 0!==t1&&e===t1}var t8,t7="1.0.0",t9=Object.freeze({core:C,scene:"^2.0.0"}),re=Object.freeze({owner:"agentic-mermaid",source:"built-in",reference:"src/scene/backend.ts"}),rt=Object.freeze({owner:"host",source:"in-process"}),rr=new Map,rn=new Map,ri=new Map,ro=null;function ra(e,t){if(e.passed)return;let r=e.checks.filter(e=>!e.passed).map(e=>`${e.id}${e.diagnostic?`: ${e.diagnostic}`:""}`);throw Error(`Built-in backend "${t}" failed SVG conformance: ${r.join("; ")}`)}function rs(e){(function(){if(null!==ro)throw Error(`Backend registry mutation is forbidden while candidate "${ro}" is undergoing conformance`)})(),ro="<built-in>";try{var t,r,n;let i,o,a,s=e.id,d=O("backend",s);ro=d;let c=rn.get(s);if(void 0!==c)throw Error(`Backend input name "${s}" already selects "${c}"`);let l=function(e){if(e!==t2)return!1;for(let t of["id","capabilities","drawNode","render"]){let r=Object.getOwnPropertyDescriptor(e,t);if(!r||!("value"in r)||r.value!==t4[t].value)return!1}return!0}(e);if(!Array.isArray(e.capabilities))throw Error(`Backend "${e.id}" must declare capability claims`);let u=ej(e.capabilities);if(!u.valid)throw Error(`Backend "${e.id}" has invalid capabilities: ${u.diagnostics.join("; ")}`);if(0===e.capabilities.length)throw Error(`Backend "${e.id}" must declare capability claims`);if(e.capabilities.find(e=>e.target!==d))throw Error(`Backend "${e.id}" capability target must be "${d}"`);let m=e.capabilities.find(e=>!e.evidence?.trim());if(m)throw Error(`Backend "${e.id}" capability ${m.primitive}/${m.feature}/${m.operation} must declare evidence`);for(let{primitive:t,feature:r,operation:n}of eC)if(!e.capabilities.some(e=>e.primitive===t&&e.feature===r&&e.operation===n))throw Error(`Backend "${e.id}" must declare an evidenced essential ${t}/${r}/${n} capability`);let p=(o=!1,{running:()=>o,report:()=>{if(i)return i;let t=ro;ro=d,o=!0;try{i=function(e,t=e.id){var r;t0??=Y(void 0,tB);let n=[],i=(e,t,r)=>{n.push(Object.freeze({id:e,passed:t,...r?{diagnostic:r}:{}}))},o=[],a=[];for(let t of t0.probes)try{let r=tW(e,t.node),n=tW(e,t.node);if("string"!=typeof r||"string"!=typeof n){o.push(`${t.primitive} returned a non-string`),a.push(`${t.primitive} returned a non-string`);continue}r!==n&&o.push(`${t.primitive} changed between identical calls`);let i=t.requiredFragments.filter(e=>!r.includes(e));i.length>0&&a.push(`${t.primitive} ${tR(i)}`)}catch(r){let e=`${t.primitive} threw ${r instanceof Error?r.message:String(r)}`;o.push(e),a.push(e)}i("draw-node-determinism",0===o.length,o.join("; ")||void 0),i("draw-node-semantics",0===a.length,a.join("; ")||void 0);let s="",d="",c;try{s=tq(e),d=tq(e),"string"!=typeof s||"string"!=typeof d?(c="render must return a string",s="string"==typeof s?s:"",d="string"==typeof d?d:""):s!==d&&(c="render changed between identical calls")}catch(e){c=`render threw ${e instanceof Error?e.message:String(e)}`}i("document-determinism",void 0===c,c);let l=_("xml-envelope",r=s,()=>em(r));i("single-svg-document",l,l?void 0:"render must return one well-formed namespaced SVG document");let u=s.match(/\b(?:NaN|Infinity|undefined)\b/)?.[0];i("finite-serialization",!u,u?`serialized ${u}`:void 0);let m=e$(s),p;try{ex(s,"default")}catch(e){p=e instanceof Error?e.message:String(e)}let f=m.ok&&void 0===p;for(let[e,t]of(i("output-security",f,f?void 0:[p,m.ok?void 0:`unsafe SVG constructs: ${m.refs.join(", ")}`].filter(Boolean).join("; ")),[["document-semantics",['aria-labelledby="backend-conformance-title backend-conformance-description"','<title id="backend-conformance-title">Backend conformance fixture</title>','<desc id="backend-conformance-description">A representative Scene document</desc>']],["container-semantics",['data-id="backend-conformance-container"','data-role="group"']],["shape-semantics",['data-id="backend-conformance-node"','data-role="node"']],["text-semantics",['data-id="backend-conformance-text"','data-role="member"',"Fixture label"]],["connector-semantics",['data-id="backend-conformance-relation"','data-role="edge"','data-from="backend-conformance-node"','data-to="backend-conformance-data-mark"','role="graphics-symbol"','aria-roledescription="relation"','aria-label="backend-conformance-node to backend-conformance-data-mark: depends on"']],["marker-semantics",['id="backend-conformance-arrow"']],["data-mark-semantics",['data-id="backend-conformance-data-mark"','data-role="bar"']]])){let r=t.filter(e=>!s.includes(e));i(e,0===r.length,tR(r))}let g=e.capabilities.map(t=>{let r=eT(t),n=tZ[tK(t)],i={claimKey:r,target:t.target,primitive:t.primitive,feature:t.feature,operation:t.operation,realization:t.realization,...t.diagnostic?{limitation:t.diagnostic}:{}};if(!n)return eS.includes(t.primitive)&&ew.includes(t.feature)&&eN.includes(t.operation)?{...i,status:"failed",diagnostic:"No executable witness is registered for this core claim."}:{...i,status:"unverified-extension",diagnostic:"Namespaced extension claim is outside the built-in witness vocabulary."};let o=`${tP}/${tK(t)}`;try{let r=n(e,t);return{...i,witnessId:o,status:r.passed?"passed":"failed",observation:r.observation,...r.diagnostic?{diagnostic:r.diagnostic}:{}}}catch(e){return{...i,witnessId:o,status:"failed",diagnostic:`Witness threw ${e instanceof Error?e.message:String(e)}`}}}),h=g.filter(e=>"failed"===e.status);return i("capability-claims",0===h.length,h.map(e=>`${e.primitive}/${e.feature}/${e.operation}: ${e.diagnostic??"failed"}`).join("; ")||void 0),tx({version:4,fixtureId:tP,backendId:t,contracts:{scene:2,outputSecurity:2},directOutputs:["svg"],passed:n.every(e=>e.passed),checks:n,claims:g})}(l?function(e){let{id:t,capabilities:r,drawNode:n,render:i}=e,o;return{id:t,capabilities:r,drawNode:(t,r)=>n.call(e,t,r),render(t,r){let n=t===t0?.doc?o??=tA(t):t;return i.call(e,n,r)}}}(e):e,d)}finally{o=!1,ro=t}return i}}),f=(r=(t=function(e,t,r){let{drawNode:n,render:i}=e,o=!1,a=()=>{o||r.running()||(ra(r.report(),t),o=!0)};return e.drawNode=(t,r)=>(a(),n.call(e,t,r)),e.render=(t,r)=>(a(),i.call(e,t,r)),e===t2&&t3.has(i)&&t3.add(e.render),e}(e,s,p)).capabilities,a=["target","primitive","feature","operation","realization","evidence","diagnostic"],t.capabilities=Object.freeze(r.map(e=>{let t=("object"==typeof e||"function"==typeof e)&&null!==e?e:void 0,r=t?{...t}:{};if(t)for(let e of a)Object.prototype.hasOwnProperty.call(r,e)||(r[e]=Reflect.get(t,e));return Object.freeze(r)})),Object.freeze(t));D(rr,{identity:(n={version:t7,compatibility:t9,provenance:re},M({id:d,kind:"backend",version:n.version??t7,compatibility:n.compatibility,provenance:n.provenance??rt})),value:f}),ri.set(d,p.report),rn.set(s,d),l&&(t1=f),t8=void 0}finally{ro=null}}function rd(){return Object.freeze(Array.from(rr.values(),({identity:e,value:t})=>{let r=ri.get(e.id);return Object.freeze({identity:e,backend:t,inputName:Array.from(rn.entries()).find(([,t])=>t===e.id)?.[0]??e.id,get conformance(){return r()}})}))}function rc(e,t){return e.find(e=>e.identity.id===t||e.inputName===t)}function rl(e,t){w("backend-registry",t?"bypass":t8?"hit":"miss");let r=t?rd():t8??=rd(),n=rc(r,e);if(!t)return n;let i=t.selectBackend(Object.freeze({requestedId:e,...n?{canonicalId:n.identity.id}:{},registered:r}));if(null!==i)return"string"==typeof i?rc(r,i):n}rs(t2);export{eD as a,t$ as b,tx as c,eg as d,eE as e,ex as f,eC as g,eO as h,e_ as i,eL as j,eF as k,eW as l,e9 as m,tb as n,tC as o,tA as p,tU as q,tJ as r,tQ as s,tX as t,t2 as u,t5 as v,t6 as w,ra as x,rs as y,rl as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{M as e}from"./chunk-
|
|
1
|
+
import{M as e}from"./chunk-G4JBA7HU.js";function t(e){let t=new Map;for(let r of e){let e=t.get(r.parentId)??[];e.push(r),t.set(r.parentId,e)}return t}function r(t,r){e("nodes",t.length);let n=new Map(t.map(e=>[e.id,e]));if(n.size!==t.length)throw Error("Hierarchy contains duplicate identities");let a=new Set(t.map(e=>e.parentId)),i=new Map;for(let o of t){let t=new Set,s=r?.(o)??a.has(o.id),d=o;for(;d&&!i.has(d.id);){if(t.has(d.id))throw Error("Hierarchy contains a cycle");if(t.add(d.id),e("nesting",t.size-!s),d.parentId&&!n.has(d.parentId))throw Error(`Unknown parent ${d.parentId}`);d=d.parentId?n.get(d.parentId):void 0}let p=d?i.get(d.id):0;for(let o of[...t].reverse()){let t=n.get(o);e("nesting",p+=r?.(t)??a.has(o)?1:0),i.set(o,p)}}}export{t as a,r as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(e,l,n){let h=1;for(;h<e.length&&(n(),!(l(e[h-1],e[h])>0));h++);if(h>=e.length)return;n(e.length);let r=Math.floor(e.length/2),o=e.slice(0,r),f=e.slice(r);t(o,l,n),t(f,l,n);let a=0,i=0;for(let t=0;t<e.length;t++){n();let h=a<o.length&&i===f.length;a<o.length&&i<f.length&&(n(),h=!(l(o[a],f[i])>0)),e[t]=h?o[a++]:f[i++]}}function e(e,l,n,h){let r=e=>{n?.(e.length+1);let o={x0:1/0,y0:1/0,x1:-1/0,y1:-1/0};for(let t of e){let e=l(t);o.x0=Math.min(o.x0,e.x0),o.y0=Math.min(o.y0,e.y0),o.x1=Math.max(o.x1,e.x1),o.y1=Math.max(o.y1,e.y1)}if(e.length<=8)return{bounds:o,leaves:e};let f=o.x1-o.x0>=o.y1-o.y0?"x0":"y0",a=(t,e)=>l(t)[f]-l(e)[f]||h?.(t,e)||0;n?t(e,a,n):e.sort(a);let i=Math.floor(e.length/2);return{bounds:o,left:r(e.slice(0,i)),right:r(e.slice(i))}};return e.length?r(e):void 0}function l(t,l,n,h){let r,o=Math.ceil(Math.log2(Math.max(2,t.length))),f=t.length>8&&h>o*o;return h=>{let o=[],a=t=>(n(),h.x0<t.x1&&h.x1>t.x0&&h.y0<t.y1&&h.y1>t.y0),i=t=>{if(a(t.bounds))if(t.leaves)for(let e of t.leaves)a(l(e))&&o.push(e);else i(t.left),i(t.right)};if(!r){if(!f){for(let e of t)a(l(e))&&o.push(e);return o}r=e([...t],l,n)}return i(r),o}}export{t as a,e as b,l as c};
|