@knockdata/objectexplorer 0.5.7 → 0.5.9
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/app/assets/ShareView.js +2 -2
- package/app/assets/WorkerParser.js +80 -75
- package/app/assets/index.css +1 -1
- package/app/assets/index.js +155 -155
- package/app/assets/share.js +6 -6
- package/package.json +1 -1
- package/server/WebServer.mjs +285 -285
|
@@ -327,43 +327,49 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
327
327
|
`)}const XE={py:`python`,js:`js`,jsx:`js`,sql:`sql`,yaml:`yaml`,yml:`yaml`,md:`md`,markdown:`md`,mark:`md`,c:`c`,h:`c`,cpp:`cpp`,cc:`cpp`,cxx:`cpp`,hpp:`cpp`,hh:`cpp`,go:`go`,rs:`rust`,html:`html`,htm:`html`,java:`java`,kt:`kotlin`,kts:`kotlin`,scala:`scala`,sc:`scala`,swift:`swift`,rb:`ruby`,r:`r`,jl:`julia`,m:`matlab`,css:`css`,ts:`ts`,tsx:`ts`,mts:`ts`,cts:`ts`,vue:`vue`,svelte:`svelte`,zig:`zig`,mojo:`mojo`};function ZE(e){if(!e||e.length<10)return;for(let[t,n]of[[/^(import \w+|from \w+ import |def \w+\(|class \w+[:(]|if __name__\s*==)/m,`python`],[/^\s*(print\(|elif |except |raise \w|lambda )/m,`python`],[/^(const |let |var |function \w+\(|import .+ from |export (default |const |function ))/m,`javascript`],[/=>\s*[{(]|require\(['"]|module\.exports/m,`javascript`],[/^(interface \w+|type \w+ =|:\s*(string|number|boolean|void)\b|<[A-Z]\w*>)/m,`typescript`],[/^<!DOCTYPE html>|<html[\s>]|<\/?(div|span|body|head|script|style|link|meta)[\s>]/im,`html`],[/^(\.|#|\w+)\s*\{[^}]*\b(display|margin|padding|color|font-size|background)\s*:/m,`css`],[/^\s*\{[\s\n]*"[^"]+"\s*:/m,`json`],[/^(SELECT|INSERT INTO|UPDATE|DELETE FROM|CREATE TABLE|ALTER TABLE|DROP TABLE)\s/im,`sql`],[/^(fn \w+|let mut |impl |pub (fn|struct|enum|mod)|use std::)/m,`rust`],[/^(package \w+|func \w+\(|import \(|fmt\.\w+|func \(\w+ \*?\w+\))/m,`go`],[/^#include\s*[<"]|^(int|void|char|float|double)\s+\w+\s*\(|printf\s*\(/m,`c`],[/^(std::|using namespace |template\s*<|class \w+\s*\{|cout\s*<<)/m,`cpp`],[/^(public|private|protected)\s+(static\s+)?(void|class|int|String)\s/m,`java`],[/^import\s+java\.|System\.out\.print/m,`java`],[/^(require ['"]|def \w+|end$|puts |class \w+ < )/m,`ruby`],[/<\?php|\$\w+\s*=\s*|function \w+\s*\(\$|echo\s+['"\$]/m,`php`],[/^#!\/bin\/(bash|sh|zsh)|^\s*(if \[|fi$|done$|esac$|then$)/m,`shell`],[/\$\(\w+|\becho\s+["']|\|\s*(grep|awk|sed|cut)\b/m,`shell`],[/^\w[\w-]*:\s*(\n\s+|[^\n{])|^---\s*$/m,`yaml`],[/^#{1,6}\s+\w|^\s*[-*]\s+\w|^\s*```\w*/m,`markdown`],[/^<\?xml\s|<\/?\w+[\s:]\w+[=>]/m,`xml`]])if(t.test(e))return n;let t=e.split(`
|
|
328
328
|
`),n=0;for(let e of t)/;\s*$/.test(e)&&n++,/[{}]\s*$/.test(e)&&n++,/\/\/\s/.test(e)&&n++;if(n>t.length*.3)return`unknown`}function QE(e,t={}){let n=new TextDecoder(`utf-8`).decode(e);return{text:n,language:t.language??XE[t.ext]??ZE(n)}}function $E(){return typeof process<`u`&&process.versions&&process.versions.node}async function eD(e){if($E()){let{inflateSync:t}=await import(`zlib`);return new Uint8Array(t(Buffer.from(e)))}return tD(e)}async function tD(e){let t=new DecompressionStream(`deflate`),n=t.writable.getWriter(),i=t.readable.getReader();n.write(e),n.close();let a=[];for(;;){let{done:e,value:t}=await i.read();if(e)break;a.push(t)}let o=a.reduce((e,t)=>e+t.length,0),s=new Uint8Array(o),c=0;for(let e of a)s.set(e,c),c+=e.length;return s}function nD(e,t,n){let i=``;for(let a=t;a<n;a++)i+=String.fromCharCode(e[a]);return i}function rD(e){let t=nD(e,0,e.length),n=[],i=/(\d+)\s+0\s+obj/g,a;for(;(a=i.exec(t))!==null;)n.push({num:parseInt(a[1]),offset:a.index,headerLen:a[0].length});return n.sort((e,t)=>e.offset-t.offset),n}function iD(e,t){let n=0,i=t,a=-1;for(;i<e.length-1;)if(e[i]===60&&e[i+1]===60)n===0&&(a=i+2),n++,i+=2;else if(e[i]===62&&e[i+1]===62){if(n--,n===0)return{dict:nD(e,a,i),end:i+2};i+=2}else i++;return null}function aD(e,t){let n=RegExp(`/`+t+`\\s+(\\[[^\\]]*\\])`).exec(e);if(n)return n[1].trim();let i=RegExp(`/`+t+`\\s+(/\\w+|[^/\\n]+)`).exec(e);return i?i[1].trim():null}function oD(e){if(e){let t=e.match(/(\d+)\s+0\s+R/);if(t)return parseInt(t[1])}return null}function sD(e,t,n){if(!e)return null;let i=oD(e);if(i!==null&&t[i]){let e=t[i],a=nD(n,e.offset+e.headerLen,e.boundary).trim(),o=parseInt(a);if(!isNaN(o))return o}let a=parseInt(e);return isNaN(a)?null:a}function cD(e,t,n){let i=iD(e,t.offset+t.headerLen);if(!i)return{dict:``,stream:null};let a=i.dict,o=i.end;for(;o<t.boundary&&(e[o]===32||e[o]===10||e[o]===13);)o++;if(nD(e,o,Math.min(o+6,t.boundary))!==`stream`)return{dict:a,stream:null};let s=o+6;e[s]===13&&e[s+1]===10?s+=2:e[s]===10&&(s+=1);let c=sD(aD(a,`Length`),n,e);if(c!==null&&c>0)return{dict:a,stream:e.slice(s,s+c)};let l=[101,110,100,115,116,114,101,97,109];for(let n=s;n<t.boundary;n++){let t=!0;for(let i=0;i<l.length;i++)if(e[n+i]!==l[i]){t=!1;break}if(t){let t=n;for(;t>s&&(e[t-1]===10||e[t-1]===13);)t--;return{dict:a,stream:e.slice(s,t)}}}return{dict:a,stream:null}}function lD(e,t,n){if(!e||(e=e.trim(),e.startsWith(`/DeviceRGB`)))return{type:`DeviceRGB`};if(e.startsWith(`/DeviceGray`))return{type:`DeviceGray`};let i=e.match(/\[\s*\/Indexed\s+\/(\w+)\s+(\d+)\s+(\d+)\s+0\s+R\s*\]/);if(i){let e=i[1],a=parseInt(i[2]),o=t[parseInt(i[3])];if(o){let{dict:i,stream:s}=cD(n,o,t);return{type:`Indexed`,base:e,maxIdx:a,paletteData:s,compressed:i.includes(`/FlateDecode`)}}}if(/^\d/.test(e)){let i=oD(e);if(i!==null&&t[i]){let e=t[i];return lD(nD(n,e.offset+e.headerLen,e.boundary).trim(),t,n)}}return{type:`DeviceRGB`}}async function uD(e,t,n,i){let a=new Uint8Array(t*n*3);if(i.type===`Indexed`){let o=i.paletteData;i.compressed&&(o=await eD(o));for(let s=0;s<t*n;s++){let t=e[s];i.base===`DeviceRGB`?(a[s*3]=o[t*3],a[s*3+1]=o[t*3+1],a[s*3+2]=o[t*3+2]):a[s*3]=a[s*3+1]=a[s*3+2]=o[t]}}else if(i.type===`DeviceRGB`)a.set(e.slice(0,t*n*3));else if(i.type===`DeviceGray`)for(let i=0;i<t*n;i++)a[i*3]=a[i*3+1]=a[i*3+2]=e[i];return a}function dD(e,t,n){let i=Math.ceil(t*3/4)*4,a=i*n,o=54+a,s=new Uint8Array(o),c=new DataView(s.buffer);s[0]=66,s[1]=77,c.setUint32(2,o,!0),c.setUint32(10,54,!0),c.setUint32(14,40,!0),c.setInt32(18,t,!0),c.setInt32(22,-n,!0),c.setUint16(26,1,!0),c.setUint16(28,24,!0),c.setUint32(34,a,!0);for(let a=0;a<n;a++)for(let n=0;n<t;n++){let o=(a*t+n)*3,c=54+a*i+n*3;s[c]=e[o+2],s[c+1]=e[o+1],s[c+2]=e[o]}return s}function fD(e){let t=``,n=e.match(/\bBT\b[\s\S]*?\bET\b/g);if(!n)return t;for(let e of n){let n=e.match(/\(([^)]*)\)/g);if(n)for(let e of n)t+=e.slice(1,-1)}return t}function pD(e){let t=e.length,n=nD(e,Math.max(0,t-8192),t);if(/\/Encrypt\s+\d+\s+0\s+R/.test(n))return!0;let i=nD(e,0,Math.min(t,4096));return/\/Encrypt\s+\d+\s+0\s+R/.test(i)}async function mD(e){let t=new Uint8Array(e),n=pD(t);if(n)return{encrypted:n,images:[],hasText:!1,hasImages:!1,hasGraphics:!1};let i=rD(t),a={};for(let e=0;e<i.length;e++){let n=i[e];n.boundary=e+1<i.length?i[e+1].offset:t.length,a[n.num]=n}let o=[],s=[],c=!1,l=!1;for(let e of Object.keys(a)){let n=a[e],{dict:i,stream:u}=cD(t,n,a);console.log(i);let d=i.match(/\/Subtype\s*\/(\w+)/);if(d&&d[1]===`Image`&&u){let e=sD(aD(i,`Width`),a,t),n=sD(aD(i,`Height`),a,t);if(e&&n){let s=aD(i,`Filter`)||``;if(s.includes(`DCTDecode`))o.push({width:e,height:n,data:u,mime:`image/jpeg`});else{let c=u;s.includes(`FlateDecode`)&&(c=await eD(u));let l=lD(aD(i,`ColorSpace`),a,t),d=dD(await uD(c,e,n,l),e,n);o.push({width:e,height:n,data:d,mime:`image/bmp`})}}}if(/\/Type\s*\/Page\b/.test(i)&&!/\/Type\s*\/Pages/.test(i)){let e=aD(i,`Contents`);if(e){let n=[],i=e.match(/\[([^\]]*)\]/);if(i){let e=/(\d+)\s+0\s+R/g,t;for(;(t=e.exec(i[1]))!==null;)n.push(parseInt(t[1]))}else{let t=oD(e);t!==null&&n.push(t)}for(let e of n){let n=a[e];if(!n)continue;let{dict:i,stream:o}=cD(t,n,a);if(!o)continue;let u=o;if(i.includes(`/FlateDecode`))try{u=await eD(o)}catch{continue}let d=nD(u,0,u.length),f=fD(d);f.length>0&&(c=!0,s.push(f)),(/[\d.]+\s+[\d.]+\s+m\b/.test(d)||/[\d.]+\s+[\d.]+\s+[\d.]+\s+[\d.]+\s+re\b/.test(d))&&(l=!0)}}}}let u=s.join(`
|
|
329
329
|
`);console.log(u);let d=o.length>0&&u.length<100;return{encrypted:n,images:o,texts:s,hasText:c,hasImages:o.length>0,hasGraphics:l,majorityImage:d}}const hD=Symbol(`EOF`),gD=Symbol(`<<`),_D=Symbol(`>>`),vD=Symbol(`[`),yD=Symbol(`]`);function bD(e){return e===0||e===9||e===10||e===13||e===12||e===32}function xD(e){return e>=48&&e<=57}function SD(e,t){let n=e.length;function i(){return t>=n?-1:e[t]}function a(){return t>=n?-1:e[t++]}function o(){for(;t<n;){let i=e[t];if(bD(i)){t++;continue}if(i===37){for(t++;t<n&&e[t]!==10&&e[t]!==13;)t++;continue}break}}function s(i){let a=String.fromCharCode(i);for(;t<n;){let n=e[t];if(xD(n)||n===46)a+=String.fromCharCode(n),t++;else break}let o=parseFloat(a);return isNaN(o)?0:o}function c(){let e=1,o=``;for(;t<n;){let n=a();if(n===40)e++,o+=`(`;else if(n===41){if(e--,e===0)return o;o+=`)`}else if(n===92){if(n=a(),n===110)o+=`
|
|
330
|
-
`;else if(n===114)o+=`\r`;else if(n===116)o+=` `;else if(n===98)o+=`\b`;else if(n===102)o+=`\f`;else if(n===40)o+=`(`;else if(n===41)o+=`)`;else if(n===92)o+=`\\`;else if(n===13)i()===10&&t++;else if(n!==10){if(n>=48&&n<=55){let e=n-48;i()>=48&&i()<=55&&(e=e*8+(a()-48),i()>=48&&i()<=55&&(e=e*8+(a()-48))),o+=String.fromCharCode(e)}else o+=String.fromCharCode(n)}}else o+=String.fromCharCode(n)}return o}function l(){let e=``;for(;t<n;){let t=a();if(t===62)break;bD(t)||(e+=String.fromCharCode(t))}e.length%2!=0&&(e+=`0`);let i=``;for(let t=0;t<e.length;t+=2)i+=String.fromCharCode(parseInt(e.substring(t,t+2),16));return i}function u(){let i=``;for(;t<n;){let a=e[t];if(bD(a)||a===47||a===40||a===41||a===60||a===62||a===91||a===93||a===123||a===125||a===37)break;if(t++,a===35&&t+1<n){let n=e[t],a=e[t+1];i+=String.fromCharCode(parseInt(String.fromCharCode(n,a),16)),t+=2}else i+=String.fromCharCode(a)}return{name:i}}function d(){let i=``;for(;t<n;){let n=e[t];if(bD(n)||n===47||n===40||n===41||n===60||n===62||n===91||n===93||n===123||n===125||n===37)break;i+=String.fromCharCode(n),t++}return i===`true`?!0:i===`false`?!1:i===`null`?null:{cmd:i}}function f(){if(o(),t>=n)return hD;let e=a();return xD(e)||e===43||e===45||e===46?(e===43||e===45)&&!xD(i())&&i()!==46?(t--,d()):s(e):e===40?c():e===47?u():e===60?i()===60?(t++,gD):l():e===62?i()===62?(t++,_D):hD:e===91?vD:e===93?yD:(t--,d())}function p(){return t}function m(e){t=e}return{nextToken:f,getPosition:p,setPosition:m,peekByte:i,readByte:a}}function CD(e){return typeof e==`object`&&!!e&&`name`in e}function wD(e,t){return typeof e!=`object`||!e||!(`cmd`in e)?!1:t===void 0||e.cmd===t}let TD=null;try{typeof process<`u`&&process.versions&&process.versions.node&&(TD=(await import(`node:zlib`)).inflateSync)}catch{}function ED(e,t){if(e==null)return new Uint8Array;let n=OD(t);return n===`FlateDecode`||n===`Fl`?kD(e):n===`ASCII85Decode`||n===`A85`?jD(e):n===`ASCIIHexDecode`||n===`AHx`?MD(e):e}async function DD(e,t){if(e==null)return new Uint8Array;let n=OD(t);return n===`FlateDecode`||n===`Fl`?AD(e):n===`ASCII85Decode`||n===`A85`?jD(e):n===`ASCIIHexDecode`||n===`AHx`?MD(e):e}function OD(e){return typeof e==`string`?e:e&&typeof e==`object`&&`name`in e?e.name:``}function kD(e){return e.length<2?e:TD?new Uint8Array(TD(Buffer.from(e))):e}async function AD(e){if(e.length<2)return e;if(TD)return new Uint8Array(TD(Buffer.from(e)));if(typeof DecompressionStream<`u`){let t=new DecompressionStream(`deflate`),n=t.writable.getWriter(),i=t.readable.getReader();n.write(e),n.close();let a=[];for(;;){let{done:e,value:t}=await i.read();if(e)break;a.push(t)}let o=a.reduce(function(e,t){return e+t.length},0),s=new Uint8Array(o),c=0;for(let e of a)s.set(e,c),c+=e.length;return s}return e}function jD(e){let t=typeof e==`string`?e:ND(e),n=[],i=0;for(;i<t.length&&(t[i]!==`~`||t[i+1]!==`>`);){if(t[i]===`z`){n.push(0,0,0,0),i++;continue}let e=[];for(;e.length<5&&i<t.length;){let n=t.charCodeAt(i);if(n>=33&&n<=117)e.push(n-33);else if(t[i]===`~`)break;i++}if(e.length===0)break;for(;e.length<5;)e.push(84);let a=0;for(let t=0;t<5;t++)a=a*85+e[t];let o=e.length-1;o>=1&&n.push(a>>24&255),o>=2&&n.push(a>>16&255),o>=3&&n.push(a>>8&255),o>=4&&n.push(a&255)}return new Uint8Array(n)}function MD(e){let t=typeof e==`string`?e:ND(e),n=[],i=``;for(let e=0;e<t.length&&t[e]!==`>`;e++)/[0-9a-fA-F]/.test(t[e])&&(i+=t[e],i.length===2&&(n.push(parseInt(i,16)),i=``));return i.length===1&&n.push(parseInt(i+`0`,16)),new Uint8Array(n)}function ND(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function PD(e,t){return FD(SD(e,t),e)}function FD(e,t){let n=e.nextToken();if(n===hD)return null;if(n===gD)return ID(e,t);if(n===vD)return LD(e,t);if(CD(n)||wD(n)||typeof n==`string`||typeof n==`boolean`||n===null)return n;if(typeof n==`number`){let t=e.getPosition(),i=e.nextToken();return typeof i==`number`&&wD(e.nextToken(),`R`)?{num:n,gen:i}:(e.setPosition(t),n)}return n}function ID(e,t){let n={};for(;;){let i=e.nextToken();if(i===_D||i===hD)break;if(!CD(i))continue;let a=FD(e,t);n[i.name]=a}let i=e.getPosition();if(wD(e.nextToken(),`stream`)){let i=e.getPosition();t[i]===13&&t[i+1]===10?i+=2:(t[i]===10||t[i]===13)&&(i+=1);let a=typeof n.Length==`number`?n.Length:0;if(a>0)n._streamBytes=t.slice(i,i+a),n._streamEnd=i+a;else{let e=RD(t,i);n._streamBytes=t.slice(i,e),n._streamEnd=e}n._hasStream=!0}else e.setPosition(i);return n}function LD(e,t){let n=[];for(;;){let i=e.getPosition(),a=e.nextToken();if(a===yD||a===hD)break;e.setPosition(i),n.push(FD(e,t))}return n}function RD(e,t){let n=[101,110,100,115,116,114,101,97,109];for(let i=t;i<e.length-n.length;i++){let a=!0;for(let t=0;t<n.length;t++)if(e[i+t]!==n[t]){a=!1;break}if(a){let n=i;for(;n>t&&(e[n-1]===10||e[n-1]===13);)n--;return n}}return e.length}function zD(e,t,n){let i=typeof e==`object`&&`num`in e?e.num:e,a=t[i];if(a==null)return null;if(a.compressed)return BD(i,a,t,n);let o=SD(n,a.offset);return o.nextToken(),o.nextToken(),wD(o.nextToken(),`obj`)?FD(o,n):null}function BD(e,t,n,i){let a=zD(t.offset,n,i);if(a==null||!a._hasStream)return null;let o=a.First||0,s=a.N||0,c=a.Filter,l=CD(c)?c.name:typeof c==`string`?c:``,u=a._streamBytes;return l&&(u=ED(u,l)),VD(u,e,o,s)}function VD(e,t,n,i){let a=SD(e,0),o=[];for(let e=0;e<i;e++){let e=a.nextToken(),t=a.nextToken();o.push({num:e,offset:n+t})}for(let n=0;n<o.length;n++)if(o[n].num===t)return FD(SD(e,o[n].offset),e);return null}function HD(e){let t=Math.min(1024,e.length),n=e.length-t,i=``;for(let t=n;t<e.length;t++)i+=String.fromCharCode(e[t]);let a=i.lastIndexOf(`startxref`);if(a===-1)return-1;let o=i.substring(a+9).trim().match(/^(\d+)/);return o?parseInt(o[1]):-1}async function UD(e){let t={},n=null,i=HD(e);if(i===-1)return{entries:KD(e),trailerDict:{}};let a=``,o=Math.min(10,e.length-i);for(let t=0;t<o;t++)a+=String.fromCharCode(e[i+t]);if(a.trimStart().startsWith(`xref`)){let a=WD(e,i);Object.assign(t,a.entries),n=a.trailerDict;let o=n.Prev;for(;typeof o==`number`;){let n=WD(e,o);for(let[e,i]of Object.entries(n.entries))t[e]??(t[e]=i);o=n.trailerDict.Prev}}else{let a=await GD(e,i);Object.assign(t,a.entries),n=a.trailerDict;let o=n.Prev;for(;typeof o==`number`;){let n=await GD(e,o);for(let[e,i]of Object.entries(n.entries))t[e]??(t[e]=i);o=n.trailerDict.Prev}}return{entries:t,trailerDict:n}}function WD(e,t){let n={},i=SD(e,t),a=i.nextToken();for(wD(a,`xref`)&&(a=i.nextToken());typeof a==`number`;){let e=a,t=i.nextToken();if(typeof t!=`number`)break;for(let a=0;a<t;a++){let t=i.nextToken(),o=i.nextToken(),s=i.nextToken();if(typeof t!=`number`)break;let c=wD(s,`f`);n[e+a]={offset:t,gen:typeof o==`number`?o:0,free:c,compressed:!1}}a=i.nextToken()}let o={};return wD(a,`trailer`)&&(o=PD(e,i.getPosition()),o??={}),{entries:n,trailerDict:o}}async function GD(e,t){let n=SD(e,t);if(wD(n.nextToken(),`xref`))return WD(e,t);n.nextToken(),n.nextToken();let i=PD(e,n.getPosition());if(i==null||!i._hasStream)return{entries:{},trailerDict:i||{}};let a=i._streamBytes;if(a==null||a.length===0)return{entries:{},trailerDict:i};let o=i.Filter,s=CD(o)?o.name:``,c=a;if(s)try{c=await DD(c,s)}catch(e){return console.log(`xref stream decode error:`,e.message),{entries:{},trailerDict:i}}let l=i.W||[1,2,1],u=l[0]||0,d=l[1]||0,f=l[2]||0,p=i.Size||0,m=i.Index||[0,p],h={},g=0;for(let e=0;e<m.length;e+=2){let t=m[e],n=m[e+1];for(let e=0;e<n;e++){let n=+(u===0);for(let e=0;e<u;e++)n=n<<8|(c[g++]||0);let i=0;for(let e=0;e<d;e++)i=i<<8|(c[g++]||0);let a=0;for(let e=0;e<f;e++)a=a<<8|(c[g++]||0);let o=t+e;n===0?h[o]={offset:i,gen:a,free:!0,compressed:!1}:n===1?h[o]={offset:i,gen:a,free:!1,compressed:!1}:n===2&&(h[o]={offset:i,gen:a,free:!1,compressed:!0})}}return{entries:h,trailerDict:i}}function KD(e){let t={},n=``;for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);let i=/(\d+)\s+0\s+obj/g,a;for(;(a=i.exec(n))!==null;){let e=parseInt(a[1]);t[e]={offset:a.index,gen:0,free:!1,compressed:!1}}return t}const qD=new TextDecoder(`latin1`);function JD(e){let t=Math.min(16,e.length),n=qD.decode(e.subarray(0,t)).split(/[\r\n]/)[0];return{kind:`header`,label:`Header`,subLabel:n,offset:0,size:n.length,badges:[n.replace(`%PDF-`,`v`)],meta:[{key:`offset`,value:`0x0`},{key:`version`,value:n.replace(`%PDF-`,``)}],rowsLabel:`Header`,rows:[{address:`0x0`,value:n}]}}function YD(e){return e==null?`null`:Array.isArray(e)?`[ ${e.slice(0,6).map(YD).join(` `)}${e.length>6?` …`:``} ]`:typeof e==`object`&&e.num!==void 0&&e.gen!==void 0?`${e.num} ${e.gen} R`:typeof e==`object`&&e.name!==void 0?`/${e.name}`:typeof e==`object`?`<< ${Object.keys(e).filter(e=>e.startsWith(`_`)===!1).slice(0,4).join(` `)} >>`:String(e)}function XD(e){return Object.keys(e).filter(e=>e.startsWith(`_`)===!1)}function ZD(e,t,n,i){let a=e[t],o=typeof a==`object`&&a&&Array.isArray(a)===!1&&a.name===void 0&&a.num===void 0?XD(a).slice(0,64).map(e=>ZD(a,e,n,i)):[];return{kind:`field`,label:`/${t}`,subLabel:YD(a),offset:n,size:i,rowsLabel:`Value`,rows:[{address:`/${t}`,value:YD(a)}],children:o}}function QD(e,t){let n=e.Filter?YD(e.Filter):`none`;return{kind:`data`,label:`Stream`,subLabel:`${n}, ${j(e._streamBytes.length)}`,offset:e._streamEnd-e._streamBytes.length,size:e._streamBytes.length,badges:[n.replace(`/`,``)],meta:[{key:`filter`,value:n},{key:`length`,value:j(e._streamBytes.length)},{key:`ends at`,value:M(e._streamEnd)},{key:`object`,value:M(t)}]}}function $D(e,t,n,i,a){let o=zD(n,t,e),s=typeof o==`object`&&!!o&&Array.isArray(o)===!1,c=s?XD(o):[],l=c.slice(0,64).map(e=>ZD(o,e,i.offset,a));s&&o._hasStream&&l.push(QD(o,i.offset));let u=s&&o.Type?YD(o.Type):``;return{kind:`entry`,label:`${n} ${i.gen} obj`,subLabel:u===``?YD(o):`${u}, ${N(c.length)} keys`,offset:i.offset,size:a,badges:u===``?[]:[u.replace(`/`,``)],meta:[{key:`object`,value:`${n} ${i.gen}`},{key:`offset`,value:M(i.offset)},{key:`size`,value:j(a)},{key:`type`,value:u===``?`no /Type`:u}],rowsLabel:`Dictionary`,rows:c.map(e=>({address:`/${e}`,value:YD(o[e])})),children:l}}function eO(e,t){let n=Object.keys(t).map(e=>({num:Number(e),entry:t[e]})).filter(e=>e.entry.free!==!0&&e.entry.compressed!==!0&&e.entry.offset>0).sort((e,t)=>e.entry.offset-t.entry.offset).slice(0,512);return n.map((i,a)=>{let o=n[a+1],s=o?o.entry.offset:e.length;return $D(e,t,i.num,i.entry,s-i.entry.offset)})}function tO(e,t){let n=qD.decode(e.subarray(t,Math.min(t+32,e.length))).trimStart().startsWith(`xref`);return{kind:`index`,label:n?`Cross reference table`:`Cross reference stream`,subLabel:`starts at ${M(t)}`,offset:t,size:Math.max(e.length-t,0),badges:[n?`table`:`stream`],meta:[{key:`offset`,value:M(t)},{key:`kind`,value:n?`xref table`:`xref stream`}]}}function nO(e,t,n){let i=e?XD(e):[];return{kind:`footer`,label:`Trailer`,subLabel:`${N(i.length)} keys, startxref and %%EOF`,offset:t,size:n,meta:i.slice(0,8).map(t=>({key:t,value:YD(e[t])})),rowsLabel:`Trailer dictionary`,rows:i.map(t=>({address:`/${t}`,value:YD(e[t])})),children:i.map(i=>ZD(e,i,t,n))}}function rO(e){let t=Math.max(e.length-1024,0),n=qD.decode(e.subarray(t)),i=n.lastIndexOf(`startxref`);if(i>=0){let e=n.slice(i+9).match(/\d+/);return{keyword:t+i,offset:e?Number(e[0]):-1}}return{keyword:-1,offset:-1}}function iO(e,t,n){let i=rO(e),a=[JD(e),...eO(e,t.entries)];return i.offset>=0&&a.push(tO(e,i.offset)),i.keyword>=0&&a.push(nO(t.trailerDict,i.keyword,e.length-i.keyword)),{format:`pdf`,size:n.byteLength,blocks:a}}async function aO(e){let t=await mD(e),{images:n,texts:i,majorityImage:a}=t,o;try{let t=new Uint8Array(e);o=iO(t,await UD(t),e)}catch(e){console.warn(`pdf structure failed`,e.message)}return{content:t,images:n,majorityImage:a,structure:o,icon:`pdf`}}function oO(e){let t=new TextDecoder(`utf-8`).decode(e);return{html:t,text:t,icon:`html`,icons:[`render`,`text`,`hex`]}}async function sO(){return Tt?(await import(`node:path`)).join:function(...e){return e.join(`/`)}}async function cO(e,t){let n=await sO();if(Tt){let i=await import(`node:fs/promises`);return async function*a([o,s]){let c=await i.readdir(s,{withFileTypes:!0});for(let i of c){let c=`${o}/${i.name}`,l=n(s,i.name);i.isDirectory()?i.name.startsWith(`.`)||e.has(i.name)||(yield*a([c,l])):t.has(i.name)||(yield[c,l])}}}return async function*n([i,a]){for await(let[o,s]of a.entries()){let a=`${i}/${o}`;s.kind===`directory`?o.startsWith(`.`)||e.has(o)||(yield*n([a,s])):t.has(o)||(yield[a,s])}}}const lO=await async function(){if(Tt){let e=await import(`node:fs/promises`);return async function(t){return(await e.readFile(t)).buffer}}return async function(e){return await(await e.getFile()).arrayBuffer()}}(),uO=await async function(){if(Tt){let e=await import(`node:fs/promises`);return async function(t){return e.readFile(t,`utf-8`)}}return async function(e){return(await e.getFile()).text()}}();function dO(e){return e.replace(/</g,`<`).replace(/>/g,`>`).replace(/'/g,`'`).replace(/"/g,`"`).replace(/&/g,`&`)}function fO(e){let t={},n=/([\w-]+(?::[\w-]+)?)\s*=\s*["']([^"']*)["']/g,i;for(;(i=n.exec(e))!==null;)t[i[1]]=i[2];return t}function pO(e,t){let n=e.indexOf(`<`,t);if(n===-1)return null;if(e[n+1]===`/`){let t=e.indexOf(`>`,n);return{type:`close`,name:e.slice(n+2,t),pos:t+1}}let i=e.indexOf(`>`,n),a=e.slice(n+1,i),o=a.endsWith(`/`),s=a.search(/\s/),c=s>0?a.slice(0,s):o?a.slice(0,-1):a,l=s>0?o?a.slice(s+1,-1):a.slice(s+1):``,u=l?fO(l):{};return{type:o?`self-closing`:`open`,name:c,attributes:u,pos:i+1}}function mO(e,t){let n=pO(e,t);if(n){if(n.type===`self-closing`)return{element:{name:n.name,attributes:n.attributes,children:[],text:``},pos:n.pos};let t={name:n.name,attributes:n.attributes,children:[],text:``},i=n.pos,a=i;for(;i<e.length;){let n=e.indexOf(`<`,i);if(n===-1)break;if(n>a){let i=e.slice(a,n);i.trim()&&(t.text+=dO(i))}if(e[n+1]===`/`){let o=pO(e,n);if(o.name===t.name)return{element:t,pos:o.pos};i=o.pos,a=i;continue}let o=mO(e,n);if(o)t.children.push(o.element),i=o.pos,a=i;else break}return{element:t,pos:i}}return null}function hO(e){let t=e.replace(/<\?xml[^?]*\?>/g,``);t=t.replace(/<!--[\s\S]*?-->/g,``),t=t.replace(/<!DOCTYPE[^>[]*(\[[\s\S]*?\])?[^>]*>/gi,``);let n=mO(t,0);return n?n.element:null}function gO(e,t){let n=[];function i(e){e.name===t&&n.push(e);for(let t of e.children)i(t)}return i(e),n}function _O(e){let t=e.text||``;for(let n of e.children)t+=_O(n);return t}function J(e,t){if(e?.children)return e.children.find(e=>e.name===t)}function Y(e,t){if(e){let n=e;for(let e of t)if(n=typeof e==`number`?n.children[e]:J(n,e),!n)return;return n}}function vO(e,t){if(e){let n=e,i=t.pop();for(let e of t)if(n=J(n,e),!n)return;return n.children.filter(e=>e.name===i)}}function yO(e,t,n,i){let a=xO(e,t,n,i);return a&&parseFloat(a)}function bO(e,t,n,i){let a=xO(e,t,n,i);return a&&+a}function xO(e,t,n,i){let a=Y(e,t);return a&&(a.attributes?.[n]??i)}function SO(e,t,n){let i=Y(e,t)?.attributes;if(i)for(let e of n){let t=i[e];if(t!==void 0)return t}}function CO(e){return e.replace(/[<>&'"]/g,e=>{switch(e){case`<`:return`<`;case`>`:return`>`;case`&`:return`&`;case`'`:return`'`;case`"`:return`"`;default:return e}})}const wO=typeof process<`u`&&process.versions&&process.versions.node;let TO,EO;wO&&(TO=(await import(`zlib`)).inflateRawSync,EO=(await import(`node:fs/promises`)).default);function DO(e,t,n){let i=0;for(let a=0;a<n;a++)i|=e[t+a]<<a*8;return i}function OO(e,t){if(DO(e,t,4)!==67324752)return null;let n=DO(e,t+8,2),i=DO(e,t+18,4),a=DO(e,t+22,4),o=DO(e,t+26,2),s=DO(e,t+28,2);return{filename:new TextDecoder().decode(e.slice(t+30,t+30+o)),compressionMethod:n,compressedSize:i,uncompressedSize:a,dataOffset:t+30+o+s}}async function kO(e,t,n){let i=e.slice(t,t+n);if(wO)return TO(i);{let e=new DecompressionStream(`deflate-raw`),t=await new Response(new Blob([i]).stream().pipeThrough(e)).arrayBuffer();return new Uint8Array(t)}}function AO(e){return e.match(/\.(jpeg|jpg|png|gif|bmp|svg|webp|avif)/i)?.[1]?.toLowerCase()}function jO(e){if(wO)return Buffer.from(e).toString(`base64`);{let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}}async function MO(e){let t;if(typeof e==`string`)t=await EO.readFile(e);else if(e instanceof Uint8Array)t=e;else if(e instanceof ArrayBuffer)t=new Uint8Array(e);else throw Error(`Input must be a file path (Node.js) or Uint8Array/ArrayBuffer (browser)`);let n={},i={},a={},o={},s=0;for(;s<t.length-30;){let e=OO(t,s);if(!e)break;let{filename:o,compressionMethod:c,compressedSize:l,dataOffset:u}=e;if(!o.endsWith(`/`)){let e=o.endsWith(`.xml`)||o.endsWith(`.rels`),s=o.endsWith(`.iwa`),d=AO(o);if(e||d||s)try{let f;if(c===0?f=t.slice(u,u+l):c===8?f=await kO(t,u,l):console.warn(`Skipping ${o}: unknown compression method ${c}`),f){if(e)i[o]=new TextDecoder().decode(f);else if(s)a[o]=new Uint8Array(f);else{let e=jO(f);n[o]=`data:image/${{jpg:`jpeg`,svg:`svg+xml`}[d]??d};base64,${e}`}}}catch(e){console.warn(`Error extracting ${o}:`,e.message)}}s=u+l}function c(e){return!o[e]&&i[e]&&(o[e]=hO(i[e])),o[e]}function l(e){let t=new RegExp(e),n={};for(let e of Object.keys(i))t.test(e)&&(n[e]=c(e));return n}function u(e){return n[e]}return{medias:n,binaries:a,getDom:c,getDoms:l,getMedia:u}}function NO(e){return async function(t){let n=await e(t);if(!n)return null;let i=AO(t);if(!i)return null;let a=jO(n);return`data:image/${{jpg:`jpeg`,svg:`svg+xml`}[i]??i};base64,${a}`}}function PO(e,t){return e[t]|e[t+1]<<8}function FO(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function IO(e,t){if(t+8<=e.length){let n=new DataView(e.buffer,e.byteOffset+t,8);return Number(n.getBigUint64(0,!0))}return 0}function LO(e,t,n){let i=[],a=Math.min(t+n,e.length),o=t;for(;o+4<=a;){let t=PO(e,o),n=PO(e,o+2);i.push({id:t,offset:o,size:n+4}),o+=4+n}return i}function RO(e,t,n){let i=LO(e,t.extraOffset,t.extraLength).find(e=>e.id===1);if(i){let a=i.offset+i.size,o=i.offset+4;t.size===4294967295&&o+8<=a&&(t.size=IO(e,o),o+=8),t.compressedSize===4294967295&&o+8<=a&&(t.compressedSize=IO(e,o),o+=8),t.localHeaderOffset===4294967295&&o+8<=a&&(t.localHeaderOffset=IO(e,o),o+=8),n===65535&&o+4<=a&&(o+=4),t.zip64=!0}return t}function zO(e,t){let n=PO(e,t+20),i=new TextDecoder().decode(e.subarray(t+22,t+22+n)),a={eocdOffset:t,eocdSize:22+n,eocd64Offset:0,eocd64Size:0,locatorOffset:0,cdOffset:FO(e,t+16),cdSize:FO(e,t+12),totalEntries:PO(e,t+10),zip64:!1,comment:i},o=t-20;if(o>=0&&FO(e,o)===117853008){let t=IO(e,o+8);t+56<=e.length&&FO(e,t)===101075792&&(a.zip64=!0,a.locatorOffset=o,a.eocd64Offset=t,a.eocd64Size=12+IO(e,t+4),a.totalEntries=IO(e,t+32),a.cdSize=IO(e,t+40),a.cdOffset=IO(e,t+48))}return a}function BO(e,t,n){let i=t+4<=e.length&&FO(e,t)===134695760;return{offset:t,size:(i?4:0)+4+(n?8:4)*2,hasSignature:i}}function VO(e,t){let n=OO(e,t.localHeaderOffset),i=n?n.dataOffset:t.localHeaderOffset+30,a=t.flags&8?BO(e,i+t.compressedSize,t.zip64===!0):{offset:0,size:0,hasSignature:!1};return{name:t.name,cdOffset:t.cdOffset,cdSize:t.cdSize,localHeaderOffset:t.localHeaderOffset,localHeaderSize:i-t.localHeaderOffset,dataOffset:i,dataSize:t.compressedSize,descriptorOffset:a.offset,descriptorSize:a.size,descriptorSigned:a.hasSignature,compMethod:t.compMethod,crc32:t.crc32,compressedSize:t.compressedSize,uncompressedSize:t.size,flags:t.flags,lastModified:t.lastModified,zip64:t.zip64===!0,extraFields:LO(e,t.extraOffset,t.extraLength)}}function HO(e,t,n){return{eocdOffset:t.eocdOffset,eocdSize:t.eocdSize,eocd64Offset:t.eocd64Offset,eocd64Size:t.eocd64Size,locatorOffset:t.locatorOffset,cdOffset:t.cdOffset,cdSize:t.cdSize,totalEntries:t.totalEntries,zip64:t.zip64,comment:t.comment,entries:n.map(t=>VO(e,t))}}const UO=[253,55,122,88,90,0];function WO(e,t){return e[0]===UO[0]&&e[1]===UO[1]&&e[2]===UO[2]&&e[3]===UO[3]?GO(e,t):XO(e,t)}function GO(e,t){let n=new Uint8Array(t),i=0,a=6,o=e[a]<<8|e[a+1];for(a+=2,a+=4;a<e.length;){let s=e[a];if(s===0)break;let c=(s+1)*4,l=a;a++;let u=e[a++],d=(u&3)+1,f=!!(u&64),p=!!(u&128),m=0;if(f){let t=ok(e,a);m=t.value,a=t.pos}if(p){let t=ok(e,a);t.value,a=t.pos}let h=0;for(let t=0;t<d;t++){let t=ok(e,a),n=t.value;a=t.pos;let i=ok(e,a),o=i.value;if(a=i.pos,n===33){if(o>0){let t=e[a];if(t>40)throw Error(`invalid LZMA2 dict size byte: `+t);h=t===40?4294967295:(2|t&1)<<(t>>1)+11}a+=o}else a+=o}if(a=l+c,f){let o=KO(e,a,m,h,t-i);n.set(o,i),i+=o.length,a+=m}else{let o=KO(e,a,e.length-a,h,t-i);n.set(o,i),i+=o.length,a+=o._consumedInput||e.length-a}for(;a%4!=0;)a++;let g=o&15;a+=[0,4,4,4,8,8,8,16,16,16,32,32,32,32,32,32][g]||0}return n.subarray(0,i)}function KO(e,t,n,i,a){let o=new Uint8Array(a),s=0,c=t,l=t+n;i===0&&(i=4096);let u=new Uint8Array(i),d=0,f=null;for(;c<l&&s<a;){let t=e[c++];if(t===0)break;if(t===1){let t=(e[c]<<8|e[c+1])+1;c+=2;for(let n=0;n<t&&s<a;n++){let t=e[c++];o[s++]=t,u[d]=t,d=(d+1)%i}f=null}else if(t===2){let t=(e[c]<<8|e[c+1])+1;c+=2;for(let n=0;n<t&&s<a;n++){let t=e[c++];o[s++]=t,u[d]=t,d=(d+1)%i}}else if(t>=128){t&32,t&64,t&64&&t&32;let n=(t&31)<<16|e[c]<<8|e[c+1];c+=2;let a=n+1,l=(e[c]<<8|e[c+1])+1;c+=2;let p=t>=192,m=t>=160,h=t>=224,g,_,v;if(p){let t=e[c++];g=t%9;let n=(t-g)/9;_=n%5,v=(n-_)/5,f=qO(g,_,v)}else(m||f===null)&&(f===null?(g=3,_=0,v=2,f=qO(g,_,v)):JO(f));h&&(u.fill(0),d=0);let y=c,b=YO(e,c,l,a,f,u,d,i,s);o.set(b.data,s),s+=b.data.length,d=b.dictPos,c=y+l}else break}let p=o.subarray(0,s);return p._consumedInput=c-t,p}function qO(e,t,n){let i=1<<n,a=1<<e+t;return{lc:e,lp:t,pb:n,state:0,rep0:0,rep1:0,rep2:0,rep3:0,isMatch:ak(12*i),isRep:ak(12),isRepG0:ak(12),isRepG1:ak(12),isRepG2:ak(12),isRep0Long:ak(12*i),litProbs:ak(a*768),posSlotDec:[ak(64),ak(64),ak(64),ak(64)],alignProbs:ak(16),posProbs:ak(124),lenDec:{choice:ak(1),choice2:ak(1),low:ak(i*8),mid:ak(i*8),high:ak(256)},repLenDec:{choice:ak(1),choice2:ak(1),low:ak(i*8),mid:ak(i*8),high:ak(256)}}}function JO(e){e.state=0,e.rep0=0,e.rep1=0,e.rep2=0,e.rep3=0,e.isMatch.fill(1024),e.isRep.fill(1024),e.isRepG0.fill(1024),e.isRepG1.fill(1024),e.isRepG2.fill(1024),e.isRep0Long.fill(1024),e.litProbs.fill(1024);for(let t=0;t<4;t++)e.posSlotDec[t].fill(1024);e.alignProbs.fill(1024),e.posProbs.fill(1024),e.lenDec.choice.fill(1024),e.lenDec.choice2.fill(1024),e.lenDec.low.fill(1024),e.lenDec.mid.fill(1024),e.lenDec.high.fill(1024),e.repLenDec.choice.fill(1024),e.repLenDec.choice2.fill(1024),e.repLenDec.low.fill(1024),e.repLenDec.mid.fill(1024),e.repLenDec.high.fill(1024)}function YO(e,t,n,i,a,o,s,c,l){let u=sk(e,t),d=new Uint8Array(i),f=0,p=1<<a.pb;for(;f<i;){let e=l+f&p-1;if(u.decodeBit(a.isMatch,a.state*p+e)===0){let e=f>0?d[f-1]:s>0?o[s-1]:0,t=((l+f&(1<<a.lp)-1)<<a.lc|e>>8-a.lc)*768,n;if(a.state>=7){let e=s-a.rep0-1;e<0&&(e+=c);let i=o[e];n=ek(u,a.litProbs,t,i)}else n=$O(u,a.litProbs,t);d[f++]=n,o[s]=n,s=(s+1)%c,a.state=tk(a.state)}else{let t;if(u.decodeBit(a.isRep,a.state)===0){t=QO(u,a.lenDec,e,p);let n=ZO(u,t,a);a.rep3=a.rep2,a.rep2=a.rep1,a.rep1=a.rep0,a.rep0=n,a.state=nk(a.state)}else{if(u.decodeBit(a.isRepG0,a.state)===0){if(u.decodeBit(a.isRep0Long,a.state*p+e)===0){let e=s-a.rep0-1;e<0&&(e+=c);let t=o[e];d[f++]=t,o[s]=t,s=(s+1)%c,a.state=ik(a.state);continue}t=QO(u,a.repLenDec,e,p)}else if(u.decodeBit(a.isRepG1,a.state)===0){let n=a.rep1;a.rep1=a.rep0,a.rep0=n,t=QO(u,a.repLenDec,e,p)}else if(u.decodeBit(a.isRepG2,a.state)===0){let n=a.rep2;a.rep2=a.rep1,a.rep1=a.rep0,a.rep0=n,t=QO(u,a.repLenDec,e,p)}else{let n=a.rep3;a.rep3=a.rep2,a.rep2=a.rep1,a.rep1=a.rep0,a.rep0=n,t=QO(u,a.repLenDec,e,p)}a.state=rk(a.state)}let n=t+2;for(let e=0;e<n&&f<i;e++){let e=s-a.rep0-1;e<0&&(e+=c);let t=o[e];d[f++]=t,o[s]=t,s=(s+1)%c}}}return{data:d,dictPos:s,inputPos:u.getPos()}}function XO(e,t){let n=e[0],i=n%9,a=(n-i)/9,o=a%5,s=(a-o)/5,c=Math.max(4096,e[1]|e[2]<<8|e[3]<<16|e[4]<<24>>>0);t===void 0&&(t=(e[5]|e[6]<<8|e[7]<<16|e[8]<<24>>>0)+(e[9]|e[10]<<8|e[11]<<16|e[12]<<24>>>0)*4294967296);let l=qO(i,o,s),u=new Uint8Array(c);return YO(e,13,e.length-13,t,l,u,0,c,0).data}function ZO(e,t,n){let i=Math.min(t,3),a=e.decodeBitTree(n.posSlotDec[i],6);if(a<4)return a;let o=(a>>1)-1,s=(2|a&1)<<o;return a<14?s+=e.decodeReverseBitTree(n.posProbs,o,s-a):(s+=e.decodeDirect(o-4)<<4,s+=e.decodeReverseBitTree(n.alignProbs,4,0)),s}function QO(e,t,n){return e.decodeBit(t.choice,0)===0?e.decodeBitTree(t.low,3,n*8):e.decodeBit(t.choice2,0)===0?8+e.decodeBitTree(t.mid,3,n*8):16+e.decodeBitTree(t.high,8)}function $O(e,t,n){let i=1;for(;i<256;)i=i<<1|e.decodeBit(t,n+i);return i&255}function ek(e,t,n,i){let a=1,o=i,s=!0;for(;a<256;)if(s){o<<=1;let i=o>>8&1,c=e.decodeBit(t,n+(1+i<<8)+a);a=a<<1|c,i!==c&&(s=!1)}else a=a<<1|e.decodeBit(t,n+a);return a&255}function tk(e){return e<4?0:e<10?e-3:e-6}function nk(e){return e<7?7:10}function rk(e){return e<7?8:11}function ik(e){return e<7?9:11}function ak(e){let t=new Uint16Array(e);return t.fill(1024),t}function ok(e,t){let n=0,i=0;for(;;){let a=e[t++];if(n|=(a&127)<<i,!(a&128))break;i+=7}return{value:n,pos:t}}function sk(e,t){let n=t,i=4294967295,a=0;n++;for(let t=0;t<4;t++)a=(a<<8|e[n++])>>>0;function o(){i<16777216&&(i=i<<8>>>0,a=(a<<8|(e[n++]||0))>>>0)}function s(e,t){let n=e[t],s=(i>>>11)*n>>>0;return a<s?(i=s,e[t]=n+(2048-n>>5),o(),0):(i=i-s>>>0,a=a-s>>>0,e[t]=n-(n>>5),o(),1)}function c(e){let t=0;for(let n=0;n<e;n++)i=i>>>1>>>0,a=a-i>>>0,a&2147483648?(a=a+i>>>0,t<<=1):t=t<<1|1,o();return t}function l(e,t,n){n===void 0&&(n=0);let i=1;for(let a=0;a<t;a++)i=i<<1|s(e,n+i);return i-(1<<t)}function u(e,t,n){let i=0,a=1;for(let o=0;o<t;o++){let t=s(e,n+a);a=a<<1|t,i|=t<<o}return i}function d(){return n}return{decodeBit:s,decodeDirect:c,decodeBitTree:l,decodeReverseBitTree:u,getPos:d}}let ck;Tt&&(ck=(await import(`node:zlib`)).inflateRawSync);async function lk(e){if(Tt)return ck(e);{let t=new DecompressionStream(`deflate-raw`),n=new Response(new Blob([e]).stream().pipeThrough(t));return new Uint8Array(await n.arrayBuffer())}}function uk(e,t){return e[t]|e[t+1]<<8}function dk(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function fk(e,t){let n=(e>>9&127)+1980,i=(e>>5&15)-1,a=e&31,o=t>>11&31,s=t>>5&63,c=(t&31)*2;return new Date(n,i,a,o,s,c)}function pk(e){for(let t=e.length-22;t>=0;t--)if(e[t]===80&&e[t+1]===75&&e[t+2]===5&&e[t+3]===6)return t;return-1}async function mk(e,t,n){if(t===0)return e;if(t===8)return await lk(e);if(t===12)return kt(e);if(t===14)return WO(e,n);if(t===93)return ve(e);throw Error(`unsupported compression method: `+t)}async function hk(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(await lO(e))}async function gk(e){let t=await hk(e),n=pk(t);if(n<0)throw Error(`no EOCD found, not a ZIP file`);let i=zO(t,n),a=i.totalEntries,o=i.cdOffset,s=[],c={},l=o;for(let e=0;e<a&&dk(t,l)===33639248;e++){let e=uk(t,l+8),n=uk(t,l+10),i=uk(t,l+12),a=uk(t,l+14),o=dk(t,l+16),u=dk(t,l+20),d=dk(t,l+24),f=uk(t,l+28),p=uk(t,l+30),m=uk(t,l+32),h=uk(t,l+34),g=dk(t,l+42),_=new TextDecoder().decode(t.subarray(l+46,l+46+f)),v={name:_,size:d,compressedSize:u,compMethod:n,crc32:o,flags:e,lastModified:fk(a,i),localHeaderOffset:g,cdOffset:l,cdSize:46+f+p+m,extraOffset:l+46+f,extraLength:p};(u===4294967295||d===4294967295||g===4294967295||h===65535)&&RO(t,v,h),c[_]=s.length,s.push(v),l+=46+f+p+m}return{getEntries:d,getEntry:f,getLayout:u};function u(){return HO(t,i,s)}function d(){return s.map(function(e){return{name:e.name,size:e.size,compressedSize:e.compressedSize,compMethod:e.compMethod,lastModified:e.lastModified}})}async function f(e){let n=c[e];if(n==null)throw Error(`file not found: `+e);let i=s[n],a=i.localHeaderOffset;if(dk(t,a)!==67324752)throw Error(`invalid local file header for: `+e);let o=uk(t,a+26),l=uk(t,a+28),u=a+30+o+l;return await mk(t.subarray(u,u+i.compressedSize),i.compMethod,i.size)}}const _k={0:`stored`,1:`shrunk`,6:`imploded`,8:`deflate`,9:`deflate64`,12:`bzip2`,14:`lzma`,93:`zstd`,95:`xz`,96:`jpeg`,98:`ppmd`},vk={1:`zip64 extended information`,10:`ntfs timestamps`,21589:`extended timestamp`,28789:`unicode path`,30837:`unix uid/gid`,39169:`aes encryption`};function yk(e){return _k[e]??`method ${e}`}function bk(e){return e.uncompressedSize>0?`${Math.round(100*e.compressedSize/e.uncompressedSize)}%`:`—`}function xk(e){return{kind:`header`,label:`Local header`,subLabel:`${j(e.localHeaderSize)}, name + extra fields`,offset:e.localHeaderOffset,size:e.localHeaderSize,meta:[{key:`offset`,value:M(e.localHeaderOffset)},{key:`size`,value:j(e.localHeaderSize)},{key:`name`,value:e.name}],rowsLabel:`Fields`,rows:[{address:M(e.localHeaderOffset),value:`50 4b 03 04 local file header signature`},{address:M(e.localHeaderOffset+8),value:`compression method ${e.compMethod} — ${yk(e.compMethod)}`},{address:M(e.localHeaderOffset+30),value:`file name, ${e.name.length} bytes`}]}}function Sk(e){return{kind:`data`,label:`Compressed data`,subLabel:`${yk(e.compMethod)}, ${j(e.compressedSize)}`,offset:e.dataOffset,size:e.dataSize,badges:[yk(e.compMethod)],meta:[{key:`offset`,value:M(e.dataOffset)},{key:`compressed`,value:j(e.compressedSize)},{key:`uncompressed`,value:j(e.uncompressedSize)},{key:`ratio`,value:bk(e)}]}}function Ck(e){return{kind:`footer`,label:`Data descriptor`,subLabel:`${j(e.descriptorSize)}, crc and sizes written after the data`,offset:e.descriptorOffset,size:e.descriptorSize,badges:[e.descriptorSigned?`signed`:`unsigned`],meta:[{key:`offset`,value:M(e.descriptorOffset)},{key:`size`,value:j(e.descriptorSize)},{key:`signature`,value:e.descriptorSigned?`0x08074b50`:`omitted`},{key:`crc32`,value:`0x${e.crc32.toString(16).padStart(8,`0`)}`}]}}function wk(e){return e.extraFields.map(e=>({kind:`field`,label:`0x${e.id.toString(16).padStart(4,`0`)}`,subLabel:`${vk[e.id]??`extra field`}, ${j(e.size)}`,offset:e.offset,size:e.size}))}function Tk(e){let t=[xk(e),Sk(e)];e.descriptorSize>0&&t.push(Ck(e));let n=e.descriptorSize>0?e.descriptorOffset+e.descriptorSize:e.dataOffset+e.dataSize,i=[yk(e.compMethod)];return e.zip64&&i.push(`zip64`),{kind:`entry`,label:e.name,subLabel:`${j(e.uncompressedSize)} → ${j(e.compressedSize)} (${bk(e)})`,offset:e.localHeaderOffset,size:n-e.localHeaderOffset,badges:i,meta:[{key:`name`,value:e.name},{key:`method`,value:yk(e.compMethod)},{key:`uncompressed`,value:j(e.uncompressedSize)},{key:`compressed`,value:j(e.compressedSize)},{key:`crc32`,value:`0x${e.crc32.toString(16).padStart(8,`0`)}`},{key:`modified`,value:e.lastModified.toISOString().slice(0,19).replace(`T`,` `)}],rowsLabel:`Layout`,rows:t.map(e=>({address:M(e.offset),value:`${e.label}, ${j(e.size)}`})),children:t}}function Ek(e){return{kind:`field`,label:e.name,subLabel:`${j(e.cdSize)} record → local header ${M(e.localHeaderOffset)}`,offset:e.cdOffset,size:e.cdSize,badges:[yk(e.compMethod)],meta:[{key:`name`,value:e.name},{key:`record`,value:`${M(e.cdOffset)}, ${j(e.cdSize)}`},{key:`points at`,value:M(e.localHeaderOffset)},{key:`extra fields`,value:String(e.extraFields.length)}],rowsLabel:`Record`,rows:[{address:M(e.cdOffset),value:`50 4b 01 02 central directory signature`},{address:M(e.cdOffset+42),value:`local header offset ${M(e.localHeaderOffset)}`},{address:M(e.cdOffset+46),value:`file name, ${e.name.length} bytes`}],children:wk(e)}}function Dk(e){return{kind:`index`,label:`Central directory`,subLabel:`${N(e.entries.length)} records, ${j(e.cdSize)}`,offset:e.cdOffset,size:e.cdSize,meta:[{key:`offset`,value:M(e.cdOffset)},{key:`size`,value:j(e.cdSize)},{key:`entries`,value:N(e.totalEntries)}],rowsLabel:`Records`,rows:e.entries.map(e=>({address:M(e.cdOffset),value:`${e.name}, ${j(e.cdSize)}`})),children:e.entries.map(Ek)}}function Ok(e){return e.zip64?[{kind:`footer`,label:`Zip64 EOCD`,subLabel:`${j(e.eocd64Size)}, 64 bit counts and offsets`,offset:e.eocd64Offset,size:e.eocd64Size,badges:[`zip64`],meta:[{key:`offset`,value:M(e.eocd64Offset)},{key:`size`,value:j(e.eocd64Size)},{key:`entries`,value:N(e.totalEntries)}]},{kind:`footer`,label:`Zip64 locator`,subLabel:`20 B, points at ${M(e.eocd64Offset)}`,offset:e.locatorOffset,size:20,badges:[`zip64`]}]:[]}function kk(e){return{kind:`footer`,label:`End of central directory`,subLabel:`${j(e.eocdSize)}, ${N(e.totalEntries)} entries`,offset:e.eocdOffset,size:e.eocdSize,meta:[{key:`offset`,value:M(e.eocdOffset)},{key:`size`,value:j(e.eocdSize)},{key:`entries`,value:N(e.totalEntries)},{key:`central directory`,value:`${M(e.cdOffset)}, ${j(e.cdSize)}`},{key:`comment`,value:e.comment===``?`(none)`:e.comment}],rowsLabel:`Fields`,rows:[{address:M(e.eocdOffset),value:`50 4b 05 06 end of central directory signature`},{address:M(e.eocdOffset+10),value:`${N(e.totalEntries)} entries`},{address:M(e.eocdOffset+16),value:`central directory at ${M(e.cdOffset)}`}]}}function Ak(e,t){return{format:`zip`,size:t,blocks:[...e.entries.map(Tk),Dk(e),...Ok(e),kk(e)]}}function jk(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}function Mk(e,t){let n=e?e.split(`/`):[];for(let e of decodeURIComponent(t).split(`/`))e===`..`?n.pop():e!==`.`&&e!==``&&n.push(e);return n.join(`/`)}function Nk(e){return e.slice(e.lastIndexOf(`/`)+1).replace(/\.[^.]*$/,``)}function Pk(e){return e.match(/<body[^>]*>([\s\S]*)<\/body>/i)?.[1]??``}function Fk(e){return e.replace(/<[^>]*>/g,` `).replace(/&[a-z#0-9]+;/gi,` `).trim()}function Ik(e){return e.replace(/<script[\s\S]*?<\/script>/gi,``).replace(/<link\b[^>]*>/gi,``).replace(/<a\b[^>]*>/gi,e=>e.replace(/\shref=["'](?!https?:)[^"']*["']/i,` href="#"`))}async function Lk(e,t,n){let i=e,a=[...e.matchAll(/<(?:img|image)[^>]+(?:src|xlink:href|href)=["']([^"']+)["']/gi)].map(e=>e[1]);for(let e of new Set(a))if(/^(https?:|data:)/i.test(e)===!1){let a=await n(Mk(t,e));a&&(i=i.split(`"${e}"`).join(`"${a}"`).split(`'${e}'`).join(`'${a}'`))}return i}function Rk(e){let t=null;return e[0]===255&&e[1]===216?t=`image/jpeg`:e[0]===137&&e[1]===80?t=`image/png`:e[0]===71&&e[1]===73?t=`image/gif`:e[8]===87&&e[9]===69&&e[10]===66?t=`image/webp`:e[0]===66&&e[1]===77&&(t=`image/bmp`),t}function zk(e){let t=Rk(e);return t?URL.createObjectURL(new Blob([e],{type:t})):null}async function Bk(e){let t=await gk(e),n=NO(e=>Hk(t,e)),i=gO(await Uk(t,`META-INF/container.xml`)??Vk,`rootfile`)[0]?.attributes[`full-path`];if(i){let a=jk(i),o=await Uk(t,i),s=J(o,`metadata`),c=Gk(o),l=Kk(c,s),u=l?await n(Mk(a,l.href)):null,d=await qk(t,o,c,a,n);return{title:Wk(s,`title`)||`Untitled`,creator:Wk(s,`creator`),publisher:Wk(s,`publisher`),language:Wk(s,`language`),date:Wk(s,`date`),description:Wk(s,`description`),coverUrl:u,chapters:d,icon:`book`,structure:Ak(t.getLayout(),e.byteLength)}}return{error:`not an epub: META-INF/container.xml has no rootfile`}}const Vk={name:``,attributes:{},children:[]};async function Hk(e,t){try{return await e.getEntry(t)}catch(e){return console.warn(`epub entry missing`,t,e.message),null}}async function Uk(e,t){let n=await Hk(e,t);return n?hO(new TextDecoder().decode(n)):null}function Wk(e,t){let n=e?.children?.find(e=>e.name===t||e.name.endsWith(`:`+t));return n?_O(n).trim():``}function Gk(e){let t=J(e,`manifest`);return t?gO(t,`item`).map(e=>({id:e.attributes.id||``,href:e.attributes.href||``,mediaType:e.attributes[`media-type`]||``,properties:e.attributes.properties||``})):[]}function Kk(e,t){let n=e.filter(e=>e.mediaType.startsWith(`image/`)),i=n.find(e=>e.properties.includes(`cover-image`));if(i)return i;{let e=t?.children?.find(e=>e.name===`meta`&&e.attributes?.name===`cover`);return n.find(t=>t.id===e?.attributes?.content)||n.find(e=>/cover/i.test(e.id)||/cover/i.test(e.href))}}async function qk(e,t,n,i,a){let o=J(t,`spine`),s=[];if(o){let t=await Yk(e,n,i);for(let c of gO(o,`itemref`)){let o=n.find(e=>e.id===c.attributes.idref),l=o?Mk(i,o.href):``,u=await Jk(e,l);if(Fk(u).length>0){let e=await Lk(Ik(u),jk(l),a);s.push({title:t[l]||Nk(l),path:l,html:e})}}}return s}async function Jk(e,t){let n=await Hk(e,t);return n?Pk(new TextDecoder().decode(n)):``}async function Yk(e,t,n){let i=t.find(e=>e.properties.includes(`nav`)),a=t.find(e=>e.mediaType===`application/x-dtbncx+xml`);return i?await Xk(e,Mk(n,i.href)):a?await Zk(e,Mk(n,a.href)):{}}async function Xk(e,t){let n={},i=await Uk(e,t),a=jk(t);for(let e of gO(i??Vk,`a`)){let t=e.attributes.href;t&&(n[Mk(a,t.split(`#`)[0])]=_O(e).trim())}return n}async function Zk(e,t){let n={},i=await Uk(e,t),a=jk(t);for(let e of gO(i??Vk,`navPoint`)){let t=J(e,`content`)?.attributes?.src,i=J(e,`navLabel`);t&&(n[Mk(a,t.split(`#`)[0])]=_O(i??Vk).trim())}return n}function Qk(e,t,n){let i=``,a=Math.min(t+n,e.length);for(let n=t;n<a;n++)i+=String.fromCharCode(e[n]);return i}function $k(e,t){let n=[],i=`<${t}`,a=`</${t}>`,o=0;for(;o<e.length;){let t=e.indexOf(i,o);if(t<0)o=e.length;else{let i=e.indexOf(a,t),s=i<0?e.length:i+a.length;n.push({offset:t,size:s-t,head:e.slice(t,e.indexOf(`>`,t)+1)}),o=s}}return n}function eA(e,t){return e.match(RegExp(`${t}=["']([^"']*)["']`,`i`))?.[1]??``}function tA(e){let t=Qk(e,0,200),n=t.indexOf(`?>`);if(n>0){let e=n+2;return{kind:`header`,label:`XML declaration`,subLabel:eA(t,`encoding`)||`utf-8`,offset:0,size:e,badges:[eA(t,`encoding`)||`utf-8`],meta:[{key:`version`,value:eA(t,`version`)||`1.0`},{key:`encoding`,value:eA(t,`encoding`)||`utf-8`}],rowsLabel:`Declaration`,rows:[{address:`0x0`,value:t.slice(0,e)}]}}return null}function nA(e){return{kind:`header`,label:`description`,subLabel:`book metadata`,offset:e.offset,size:e.size,badges:[`metadata`],meta:[{key:`size`,value:j(e.size)}],rowsLabel:`Fields`,rows:[{address:M(e.offset),value:`<description> … ${j(e.size)}`}]}}function rA(e,t){let n=eA(e.head,`name`);return{kind:`body`,label:n?`body "${n}"`:`body ${t+1}`,subLabel:n===`notes`?`footnotes`:`reading order`,offset:e.offset,size:e.size,badges:[j(e.size)],meta:[{key:`name`,value:n||`—`},{key:`size`,value:j(e.size)}],rowsLabel:`Fields`,rows:[{address:M(e.offset),value:e.head}]}}function iA(e){let t=eA(e.head,`id`),n=eA(e.head,`content-type`);return{kind:`entry`,label:t||`binary`,subLabel:n,offset:e.offset,size:e.size,badges:[n.replace(`image/`,``)],meta:[{key:`id`,value:t},{key:`content type`,value:n},{key:`base64 size`,value:j(e.size)},{key:`decoded size`,value:j(Math.floor(e.size*3/4))}],rowsLabel:`Fields`,rows:[{address:M(e.offset),value:e.head}]}}function aA(e){let t=e.reduce((e,t)=>e+t.size,0);return{kind:`data`,label:`binaries`,subLabel:`${N(e.length)} embedded images`,offset:e[0].offset,size:t,badges:[N(e.length)],meta:[{key:`images`,value:N(e.length)},{key:`total size`,value:j(t)}],children:e.map(iA)}}function oA(e){let t=new TextDecoder(`latin1`).decode(e),n=[],i=tA(e);i&&n.push(i);let[a]=$k(t,`description`);a&&n.push(nA(a)),$k(t,`body`).forEach((e,t)=>n.push(rA(e,t)));let o=$k(t,`binary`);return o.length>0&&n.push(aA(o)),{format:`fb2`,size:e.length,blocks:n}}const sA={section:`div`,title:`h2`,subtitle:`h3`,emphasis:`em`,strikethrough:`s`,strong:`strong`,code:`code`,cite:`blockquote`,epigraph:`blockquote`,poem:`blockquote`,stanza:`div`,v:`p`,"text-author":`p`,annotation:`div`,table:`table`,tr:`tr`,td:`td`,th:`th`,p:`p`,sub:`sub`,sup:`sup`,style:`span`},cA=new Set([`a`,`img`,`br`]);function lA(e){let t=[],n=0,i=0;for(let a of e.matchAll(/<section\b[^>]*>|<\/section\s*>/gi))a[0][1]===`/`?(--n,n===0&&t.push(e.slice(i,a.index+a[0].length))):(n===0&&(i=a.index),n+=1);return t.length===0&&t.push(e),t}function uA(e){return(e.match(/<title\b[^>]*>([\s\S]*?)<\/title>/i)?.[1]??``).replace(/<[^>]*>/g,` `).replace(/\s+/g,` `).trim()}function dA(e,t){let n=e;return n=n.replace(/<empty-line\s*\/?>/gi,`<br>`),n=n.replace(/<image\b([^>]*?)\/?>/gi,(e,n)=>pA(n,t)),n=n.replace(/<\/image\s*>/gi,``),n=n.replace(/<a\b[^>]*>/gi,`<a href="#">`),n=n.replace(/<\/?([a-z][\w-]*)((?:\s[^>]*?)?)\/?>/gi,fA),n}function fA(e,t,n){let i=t.toLowerCase(),a=e[1]===`/`,o;return o=cA.has(i)?e:sA[i]?a?`</${sA[i]}>`:`<${sA[i]}>`:``,o}function pA(e,t){let n=t[(e.match(/(?:l:href|xlink:href|href)=["']([^"']+)["']/i)?.[1]??``).replace(/^#/,``)];return n?`<img src="${n}">`:``}async function mA(e){let t=new Uint8Array(e),n=t[0]===80&&t[1]===75,i,a;if(n){let t=await gk(e),n=t.getEntries().find(e=>/\.fb2$/i.test(e.name))??t.getEntries()[0];a=n?await t.getEntry(n.name):null,i=Ak(t.getLayout(),e.byteLength)}else a=t,i=oA(t);return a?hA(a,i):{error:`not an fb2: the archive holds no document`}}function hA(e,t){let n=gA(e),i=_A(n),a=J(hO(vA(n)),`title-info`);return a?{title:yA(a,`book-title`)||`Untitled`,creator:bA(a),publisher:xA(n),language:yA(a,`lang`),date:yA(a,`date`),description:SA(a),coverUrl:CA(a,i),chapters:TA(n,i),icon:`book`,structure:t}:{error:`not an fb2: the document has no <title-info>`}}function gA(e){let t=new TextDecoder(`ascii`).decode(e.subarray(0,200)).match(/encoding=["']([\w-]+)["']/i)?.[1]??`utf-8`;try{return new TextDecoder(t).decode(e)}catch(n){return console.warn(`fb2 unknown encoding`,t,n.message),new TextDecoder(`utf-8`).decode(e)}}function _A(e){let t={};for(let n of e.matchAll(/<binary\b([^>]*)>([\s\S]*?)<\/binary>/gi)){let e=n[1].match(/id=["']([^"']+)["']/i)?.[1],i=n[1].match(/content-type=["']([^"']+)["']/i)?.[1]??`image/jpeg`;e&&(t[e]=`data:${i};base64,${n[2].replace(/\s+/g,``)}`)}return t}function vA(e){return e.match(/<description\b[\s\S]*?<\/description>/i)?.[0]??`<description/>`}function yA(e,t){let n=J(e,t);return n?_O(n).trim():``}function bA(e){return gO(e,`author`).map(e=>[yA(e,`first-name`),yA(e,`middle-name`),yA(e,`last-name`),yA(e,`nickname`)].filter(e=>e).join(` `)).filter(e=>e).join(`, `)}function xA(e){return yA(hO(e.match(/<publish-info\b[\s\S]*?<\/publish-info>/i)?.[0]??`<publish-info/>`),`publisher`)}function SA(e){let t=J(e,`annotation`);return t?_O(t).trim():``}function CA(e,t){let n=J(e,`coverpage`),i=n?J(n,`image`):null;return t[(i?wA(i.attributes):``).replace(/^#/,``)]??null}function wA(e){return e[`l:href`]??e[`xlink:href`]??e.href??``}function TA(e,t){let n=lA(e.match(/<body(?![^>]*\bname=)[^>]*>([\s\S]*?)<\/body>/i)?.[1]??e.match(/<body[^>]*>([\s\S]*?)<\/body>/i)?.[1]??``),i=[];for(let[e,a]of n.entries()){let n=Ik(dA(a,t));Fk(n).length>0&&i.push({title:uA(a)||`Chapter ${e+1}`,html:n})}return i}function EA(e,t,n){let i=t+n;for(;i>t&&(e[i-1]===0||e[i-1]===32);)i--;if(i===t)return 0;let a=``;for(let n=t;n<i;n++)a+=String.fromCharCode(e[n]);return parseInt(a,8)||0}function DA(e,t,n){let i=t,a=t+n;for(;i<a&&e[i]!==0;)i++;return new TextDecoder().decode(e.subarray(t,i))}function OA(e,t){for(let n=0;n<512;n++)if(e[t+n]!==0)return!1;return!0}function kA(e,t,n){let i=new TextDecoder().decode(e.subarray(t,t+n)),a={},o=0;for(;o<i.length;){let e=i.indexOf(` `,o);if(e<0)break;let t=parseInt(i.substring(o,e),10);if(isNaN(t)||t<=0)break;let n=i.substring(e+1,o+t-1),s=n.indexOf(`=`);s>=0&&(a[n.substring(0,s)]=n.substring(s+1)),o+=t}return a}const AA={0:`file`,"\0":`file`,"":`file`,5:`directory`,2:`symlink`,1:`hardlink`,3:`character-device`,4:`block-device`,6:`fifo`};function jA(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=[],i={},a=0,o=null,s=null,c=null;for(;a+512<=t.length;){if(OA(t,a)){if(a+1024<=t.length&&OA(t,a+512))break;a+=512;continue}let e=DA(t,a,100),l=EA(t,a+100,8),u=EA(t,a+124,12),d=new Date(EA(t,a+136,12)*1e3),f=String.fromCharCode(t[a+156]),p=DA(t,a+157,100),m=DA(t,a+257,6),h=e;if(m===`ustar`||m===`ustar\0`){let n=DA(t,a+345,155);n&&(h=n+`/`+e)}let g=a+512,_=Math.ceil(u/512)*512;if(f===`L`){o=DA(t,g,u),a=g+_;continue}if(f===`K`){s=DA(t,g,u),a=g+_;continue}if(f===`x`||f===`X`){c=kA(t,g,u),a=g+_;continue}o&&=(h=o,null);let v=u;c&&=(c.path&&(h=c.path),c.size&&(v=parseInt(c.size,10)),c.linkpath&&s==null&&(s=c.linkpath),null);let y=s||p;s=null;let b=AA[f]||`unknown`,x={name:h,size:v,mtime:d,mode:l,type:b,linkname:y,dataOffset:g};i[h]=n.length,n.push(x),a=g+_}return{getEntries:l,readEntry:u};function l(){return n.map(function(e){return{name:e.name,size:e.size,mtime:e.mtime,mode:e.mode,type:e.type,linkname:e.linkname}})}function u(e){let a=i[e];if(a==null)throw Error(`file not found: `+e);let o=n[a];return t.subarray(o.dataOffset,o.dataOffset+o.size)}}const MA=/\.(jpe?g|png|gif|webp|bmp|avif)$/i;async function NA(e){let t=new Uint8Array(e),n;return n=t[0]===80&&t[1]===75?await PA(e):t[0]===82&&t[1]===97&&t[2]===114&&t[3]===33?{error:`this comic uses RAR compression, which is not supported`}:FA(t),n}async function PA(e){let t=await gk(e),n=t.getEntries().map(e=>e.name),i=await RA(n,e=>t.getEntry(e)),a=[];for(let e of IA(n))a.push({title:Nk(e),image:zk(await t.getEntry(e))});return VA(a,i,Ak(t.getLayout(),e.byteLength))}function FA(e){let t=jA(e),n=t.getEntries().map(e=>e.name);return VA(IA(n).map(e=>({title:Nk(e),image:zk(t.readEntry(e))})),zA(LA(n)?hO(new TextDecoder().decode(t.readEntry(LA(n)))):null),null)}function IA(e){return e.filter(e=>MA.test(e)).filter(e=>e.startsWith(`__MACOSX/`)===!1&&e.split(`/`).pop().startsWith(`.`)===!1).sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))}function LA(e){return e.find(e=>/(^|\/)ComicInfo\.xml$/i.test(e))}async function RA(e,t){let n=LA(e);return zA(n?hO(new TextDecoder().decode(await t(n))):null)}function zA(e){return{series:BA(e,`Series`),number:BA(e,`Number`),title:BA(e,`Title`),writer:BA(e,`Writer`),publisher:BA(e,`Publisher`),year:BA(e,`Year`),summary:BA(e,`Summary`),language:BA(e,`LanguageISO`)}}function BA(e,t){let n=J(e??{children:[]},t);return n?_O(n).trim():``}function VA(e,t,n){return e.length>0?{title:HA(t)||`Untitled`,creator:t.writer,publisher:t.publisher,language:t.language,date:t.year,description:t.summary,coverUrl:e[0].image,chapters:e.slice(1),icon:`book-image`,structure:n}:{error:`this comic archive holds no page images`}}function HA(e){return e.series&&e.number?`${e.series} #${e.number}`:e.series||e.title}const UA={100:`author`,101:`publisher`,103:`description`,104:`isbn`,105:`subject`,106:`date`,108:`contributor`,109:`rights`,112:`source`,113:`asin`,121:`kf8Boundary`,201:`coverOffset`,202:`thumbOffset`,503:`updatedTitle`,524:`language`,525:`direction`};function WA(e){let t=new DataView(e),n=new Uint8Array(e),i=t.getUint16(76),a=[];for(let e=0;e<i;e++)a.push(t.getUint32(78+e*8));a.push(e.byteLength);function o(e){return e>=0&&e<i?n.subarray(a[e],a[e+1]):new Uint8Array}return{count:i,offsets:a,record:o,name:new TextDecoder(`ascii`).decode(n.subarray(0,32)).replace(/\0.*$/,``),type:new TextDecoder(`ascii`).decode(n.subarray(60,64)),creator:new TextDecoder(`ascii`).decode(n.subarray(64,68)),listSize:78+i*8}}function GA(e,t){let n=e.record(t),i=new DataView(n.buffer,n.byteOffset,n.byteLength),a={compression:i.getUint16(0),textLength:i.getUint32(4),textRecordCount:i.getUint16(8),recordSize:i.getUint16(10),encryption:i.getUint16(12),firstRecord:t};return n.length>20&&KA(n,16,4)===`MOBI`?(a.headerLength=i.getUint32(20),a.mobiType=i.getUint32(24),a.encoding=i.getUint32(28),a.version=i.getUint32(36),a.firstNonBook=qA(i,80,a.headerLength,4),a.fullNameOffset=qA(i,84,a.headerLength,4),a.fullNameLength=qA(i,88,a.headerLength,4),a.firstImage=qA(i,108,a.headerLength,4),a.exthFlags=qA(i,128,a.headerLength,4),a.firstContent=qA(i,192,a.headerLength,2),a.lastContent=qA(i,194,a.headerLength,2),a.extraFlags=qA(i,242,a.headerLength,2),a.fullName=JA(n,a),a.exth=YA(n,16+a.headerLength,a.exthFlags),a.exthOffset=16+a.headerLength):(a.headerLength=0,a.exth={}),a}function KA(e,t,n){return new TextDecoder(`ascii`).decode(e.subarray(t,t+n))}function qA(e,t,n,i){return t+i<=16+n&&t+i<=e.byteLength?i===2?e.getUint16(t):e.getUint32(t):0}function JA(e,t){let n=t.fullNameOffset+t.fullNameLength;return t.fullNameLength>0&&n<=e.length?XA(e.subarray(t.fullNameOffset,n),t.encoding):``}function YA(e,t,n){let i={};if(n&64&&t+12<=e.length&&KA(e,t,4)===`EXTH`){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),a=n.getUint32(t+8),o=t+12;for(let t=0;t<a&&o+8<=e.length;t++){let t=n.getUint32(o),a=Math.max(n.getUint32(o+4),8),s=e.subarray(o+8,o+a),c=UA[t];c&&(t===121||t===201||t===202?i[c]=s.length>=4?new DataView(s.buffer,s.byteOffset,4).getUint32(0):0:i[c]===void 0&&(i[c]=new TextDecoder(`utf-8`).decode(s).trim())),o+=a}}return i}function XA(e,t){return new TextDecoder(t===1252?`windows-1252`:`utf-8`).decode(e)}function ZA(e){let t=[],n=0;for(;n<e.length;){let i=e[n];if(n+=1,i===0)t.push(i);else if(i<=8)for(let a=0;a<i&&n<e.length;a++)t.push(e[n]),n+=1;else if(i<=127)t.push(i);else if(i<=191){let a=i<<8|e[n];n+=1;let o=a>>3&2047,s=(a&7)+3,c=t.length-o;for(let e=0;e<s;e++)t.push(t[c+e])}else t.push(32,i^128)}return Uint8Array.from(t)}function QA(e,t){let n=e.length;for(let i=1;i<16;i++)t&1<<i&&(n-=$A(e,n));return t&1&&(n-=(e[n-1]&3)+1),e.subarray(0,Math.max(n,0))}function $A(e,t){let n=0,i=0,a=t-1,o=!1;for(;o===!1&&a>=0;){let t=e[a];n|=(t&127)<<i,i+=7,--a,t&128&&(o=!0)}return n}const ej={1:`none`,2:`palmdoc`,17480:`huff/cdic`};function tj(e){return ej[e]??`method ${e}`}function nj(e,t){return e.offsets[t+1]-e.offsets[t]}function rj(e){return{kind:`header`,label:`PalmDB header`,subLabel:`${e.type}${e.creator}, ${N(e.count)} records`,offset:0,size:78,badges:[e.creator],meta:[{key:`name`,value:e.name},{key:`type`,value:e.type},{key:`creator`,value:e.creator},{key:`records`,value:N(e.count)}],rowsLabel:`Fields`,rows:[{address:`0x0`,value:`${e.name} database name`},{address:`0x3c`,value:`${e.type}${e.creator} type and creator`},{address:`0x4c`,value:`${N(e.count)} records`}]}}function ij(e){return{kind:`index`,label:`Record list`,subLabel:`${N(e.count)} entries of 8 bytes`,offset:78,size:e.count*8,badges:[N(e.count)],meta:[{key:`entries`,value:N(e.count)},{key:`first record at`,value:M(e.offsets[0])}],rowsLabel:`Entries`,rows:e.offsets.slice(0,e.count).map((t,n)=>({address:M(78+n*8),value:`record ${n} at ${M(t)}, ${j(nj(e,n))}`}))}}function aj(e,t,n){let i=Object.entries(t.exth).map(([n,i])=>({address:M(e.offsets[t.firstRecord]+t.exthOffset),value:`${n}: ${String(i).slice(0,120)}`}));return{kind:`header`,label:n,subLabel:`palmdoc, mobi and exth headers`,offset:e.offsets[t.firstRecord],size:nj(e,t.firstRecord),badges:[`v${t.version}`,tj(t.compression)],meta:[{key:`full name`,value:t.fullName},{key:`mobi version`,value:String(t.version)},{key:`compression`,value:tj(t.compression)},{key:`encryption`,value:t.encryption===0?`none`:`type ${t.encryption}`},{key:`text length`,value:j(t.textLength)},{key:`text records`,value:N(t.textRecordCount)},{key:`encoding`,value:t.encoding===1252?`windows-1252`:`utf-8`},{key:`exth records`,value:N(Object.keys(t.exth).length)}],rowsLabel:`Fields`,rows:[{address:`0x0`,value:`${tj(t.compression)} compression`},{address:`0x4`,value:`${N(t.textLength)} text bytes`},{address:`0x8`,value:`${N(t.textRecordCount)} text records`},{address:`0xc`,value:`${t.encryption} encryption type`},{address:`0x10`,value:`MOBI header magic`},{address:`0x14`,value:`${N(t.headerLength)} mobi header bytes`},{address:`0x24`,value:`${t.version} file version`},{address:`0x6c`,value:`record ${t.firstImage} first image`},{address:`0xf2`,value:`0x${t.extraFlags.toString(16)} extra record data flags`},...i]}}function oj(e,t,n,i){return{kind:n,label:`${i} ${t}`,subLabel:j(nj(e,t)),offset:e.offsets[t],size:nj(e,t),badges:[j(nj(e,t))],meta:[{key:`record`,value:String(t)},{key:`offset`,value:M(e.offsets[t])},{key:`size`,value:j(nj(e,t))}]}}function sj(e,t,n,i,a,o){let s=[];for(let o=t;o<=n&&o<e.count;o++)s.push(oj(e,o,i,a));let c=s.reduce((e,t)=>e+t.size,0);return{kind:i,label:`${a} records`,subLabel:o,offset:e.offsets[t],size:c,badges:[N(s.length)],meta:[{key:`records`,value:N(s.length)},{key:`range`,value:`${t} … ${Math.min(n,e.count-1)}`},{key:`total size`,value:j(c)}],children:s}}function cj(e,t,n){let i=[aj(e,t,n)],a=t.firstRecord+1,o=t.firstRecord+t.textRecordCount;t.textRecordCount>0&&a<e.count&&i.push(sj(e,a,o,`body`,`Text`,`${tj(t.compression)} compressed`));let s=t.firstRecord+t.firstImage,c=t.lastContent>t.firstImage?t.firstRecord+t.lastContent:e.count-1;return t.firstImage>0&&s<e.count&&s>o&&i.push(sj(e,s,c,`data`,`Image`,`one image per record`)),i}function lj(e,t,n,i){let a=[rj(e),ij(e)];return t.headerLength>0&&a.push(...cj(e,t,n?`Record 0 — MOBI 6 half`:`Record 0 — headers`)),n&&a.push(...cj(e,n,`Record ${n.firstRecord} — KF8 half`)),{format:(n??t).version>=8?`azw3`:`mobi`,size:i,blocks:a}}async function uj(e){let t=WA(e),n=GA(t,0),i=n.exth?.kf8Boundary,a=i>0&&i<t.count,o=a?GA(t,i):n,s=lj(t,n,a?o:null,e.byteLength),c;return c=o.encryption===0?o.compression===17480?{error:`this book uses HUFF/CDIC compression, which is not supported`}:o.headerLength===0?{error:`not a mobi book: record 0 has no MOBI header`}:dj(t,n,o,s):{error:`this book is DRM protected and cannot be opened`},c}function dj(e,t,n,i){let a=mj(e,n),o=a.some(e=>e)?a:mj(e,t),s=_j(gj(fj(e,n),o)),c={...t.exth,...n.exth};return{title:c.updatedTitle||n.fullName||t.fullName||e.name||`Untitled`,creator:c.author??``,publisher:c.publisher??``,language:c.language??``,date:c.date??``,description:c.description?Fk(c.description):``,coverUrl:hj(o,c),chapters:s,icon:`book`,structure:i}}function fj(e,t){let n=[];for(let i=1;i<=t.textRecordCount;i++){let a=QA(e.record(t.firstRecord+i),t.extraFlags);t.compression===2?n.push(ZA(a)):n.push(a)}let i=new Uint8Array(n.reduce((e,t)=>e+t.length,0)),a=0;for(let e of n)i.set(e,a),a+=e.length;let o=XA(i.subarray(0,t.textLength||i.length),t.encoding);return pj(Pk(o)||o)}function pj(e){return e.replace(/<\?xml[^?]*\?>/gi,``).replace(/<!DOCTYPE[^>]*>/gi,``).replace(/<\/?(?:html|body|head|title|meta|guide|reference)\b[^>]*>/gi,``)}function mj(e,t){let n=[],i=t.firstRecord+t.firstImage,a=t.firstRecord+t.lastContent,o=a>i?a:e.count-1;if(t.firstImage>0&&i<e.count)for(let t=i;t<=o&&t<e.count;t++)n.push(zk(e.record(t)));return n}function hj(e,t){return(t.coverOffset===void 0?null:e[t.coverOffset])??e.find(e=>e)??null}function gj(e,t){let n=e;return n=n.replace(/<img\b[^>]*>/gi,e=>{let n=e.match(/recindex=["']?(\d+)/i)?.[1],i=e.match(/kindle:embed:([0-9A-Za-z]+)/)?.[1],a=null;n?a=Number(n)-1:i&&(a=parseInt(i,32)-1);let o=a===null?null:t[a];return o?`<img src="${o}">`:``}),Ik(n)}function _j(e){let t=e.split(/<\/?mbp:pagebreak[^>]*>/i);t.length<2&&(t=e.split(/(?=<h[12]\b)/i)),t.length<2&&(t=yj(e,4e4));let n=[];for(let e of t)Fk(e).length>0&&n.push({title:vj(e)||`Page ${n.length+1}`,html:e});return n}function vj(e){return(e.match(/<h[1-3]\b[^>]*>([\s\S]*?)<\/h[1-3]>/i)?.[1]??e.match(/<font\s[^>]*size=["']?[67][^>]*>([\s\S]*?)<\/font>/i)?.[1]??``).replace(/<[^>]*>/g,` `).replace(/\s+/g,` `).trim().slice(0,80)}function yj(e,t){let n=[],i=0;for(;i<e.length;){let a=i+t,o=a<e.length?e.indexOf(`><`,a)+1:e.length,s=o>i?o:e.length;n.push(e.slice(i,s)),i=s}return n}const bj=Kg({html:!0,linkify:!0,typographer:!0,highlight:function(e,t){return t&&Tb.getLanguage(t)?Tb.highlight(e,{language:t}).value:``}});function xj(e){return wj(bj.render(e))}function Sj(e){return{html:xj(new TextDecoder(`utf-8`).decode(e)),icon:`markdown`}}function Cj(e,t){let n=console.warn;console.warn=()=>{};try{return IE.renderToString(e.trim(),{displayMode:t,strict:!1})}catch{return null}finally{console.warn=n}}function wj(e){return e=e.replace(/\$\$([\s\S]+?)\$\$/g,(e,t)=>Cj(t,!0)||e),e=e.replace(/\$([^\$\n]+?)\$/g,(e,t)=>Cj(t,!1)||e),e}function Tj(e){let t=new TextDecoder(`utf-8`).decode(e);return{xml:hO(t),text:t,icon:`xml`,icons:[`render`,`text`,`hex`]}}function Ej(e){return{text:new TextDecoder(`utf-8`).decode(e),icon:`mermaid`,icons:[`render`,`text`,`hex`]}}function Dj(e){let t=e.indexOf(`<?xml`),n=e.indexOf(`</plist>`)+8;if(t===-1||n===-1)throw Error(`Invalid provisionprofile`);return e.slice(t,n)}function Oj(e){let t=e.name;if(t===`dict`){let t={},n=e.children||[];for(let e=0;e<n.length;e+=2){let i=n[e].text;t[i]=Oj(n[e+1])}return t}return t===`array`?e.children.map(Oj):t===`string`?e.text:t===`integer`?parseInt(e.text,10):t===`true`?!0:t===`false`?!1:t===`date`?new Date(e.text):t===`data`?e.text.trim():null}function kj(e){let t=Oj(Y(hO(Dj(e)),[`dict`]));return Object.entries(t).map(([e,t])=>({key:e,value:t}))}new TextDecoder(`utf-8`);const Aj=new TextDecoder(`utf-16be`),jj=new TextDecoder(`ascii`);function Mj(e){return e.length>40&&jj.decode(e.subarray(0,8))===`bplist00`}function Nj(e,t,n){if(n===1)return e.getUint8(t);if(n===2)return e.getUint16(t);if(n===4)return e.getUint32(t);if(n===8)return Number(e.getBigUint64(t));{let i=0;for(let a=0;a<n;a+=1)i=i*256+e.getUint8(t+a);return i}}function Pj(e,t,n){if(n===15){let n=1<<(e.getUint8(t+1)&15);return{value:Nj(e,t+2,n),headerSize:2+n}}return{value:n,headerSize:1}}function Fj(e,t,n){let i=1<<n;return i===8?{value:Number(e.getBigInt64(t+1)),size:1+i}:{value:Nj(e,t+1,i),size:1+i}}function Ij(e,t,n){let i=1<<n;return{value:i===4?e.getFloat32(t+1):e.getFloat64(t+1),size:1+i}}function Lj(e,t,n,i){let a=e.getUint8(n),o=a>>4,s=a&15;if(o===0)return{type:s===8||s===9?`bool`:`null`,value:{0:null,8:!1,9:!0,15:`(fill)`}[s]??null,offset:n,size:1};if(o===1){let t=Fj(e,n,s);return{type:`integer`,value:t.value,offset:n,size:t.size}}if(o===2){let t=Ij(e,n,s);return{type:`real`,value:t.value,offset:n,size:t.size}}if(o===3){let t=e.getFloat64(n+1);return{type:`date`,value:new Date(Date.UTC(2001,0,1)+t*1e3).toISOString(),offset:n,size:9}}if(o===4){let t=Pj(e,n,s);return{type:`data`,value:`${t.value} bytes`,offset:n,size:t.headerSize+t.value,dataOffset:n+t.headerSize,dataSize:t.value}}if(o===5){let i=Pj(e,n,s),a=n+i.headerSize;return{type:`string`,value:jj.decode(t.subarray(a,a+i.value)),offset:n,size:i.headerSize+i.value}}if(o===6){let i=Pj(e,n,s),a=n+i.headerSize;return{type:`string`,value:Aj.decode(t.subarray(a,a+i.value*2)),offset:n,size:i.headerSize+i.value*2}}if(o===8){let t=s+1;return{type:`uid`,value:Nj(e,n+1,t),offset:n,size:1+t}}if(o===10||o===12){let t=Pj(e,n,s),a=n+t.headerSize,c=[];for(let n=0;n<t.value;n+=1)c.push(Nj(e,a+n*i,i));return{type:o===10?`array`:`set`,refs:c,offset:n,size:t.headerSize+t.value*i}}if(o===13){let t=Pj(e,n,s),a=n+t.headerSize,o=[],c=[];for(let n=0;n<t.value;n+=1)o.push(Nj(e,a+n*i,i)),c.push(Nj(e,a+(t.value+n)*i,i));return{type:`dict`,keyRefs:o,valueRefs:c,offset:n,size:t.headerSize+t.value*i*2}}return{type:`unknown`,value:`marker 0x${a.toString(16)}`,offset:n,size:1}}function Rj(e,t,n){if(t&&n.has(t)===!1){if(n.add(t),t.type===`array`||t.type===`set`){t.children=t.refs.map(t=>e[t]).filter(Boolean);for(let i of t.children)Rj(e,i,n)}else if(t.type===`dict`){t.entries=t.keyRefs.map((n,i)=>({key:e[n],value:e[t.valueRefs[i]]})).filter(e=>e.key&&e.value);for(let i of t.entries)Rj(e,i.value,n)}}return t}function zj(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);if(Mj(t)){let e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=t.length-32,i=e.getUint8(n+6),a=e.getUint8(n+7),o=Math.min(Number(e.getBigUint64(n+8)),16384),s=Number(e.getBigUint64(n+16)),c=Number(e.getBigUint64(n+24)),l=[];for(let t=0;t<o;t+=1)l.push(Nj(e,c+t*i,i));let u=l.map(n=>Lj(e,t,n,a));return{magicOffset:0,magicSize:8,objects:u,offsets:l,root:Rj(u,u[s],new Set),rootIndex:s,numObjects:o,offsetWidth:i,refWidth:a,tableOffset:c,tableSize:o*i,trailerOffset:n,trailerSize:32,fileSize:t.length}}throw Error(`not a binary plist`)}function Bj(e){return e.type===`string`||e.type===`data`?e.value:String(e.value)}function Vj(e){return e.type===`dict`||e.type===`array`||e.type===`set`?`body`:e.type===`data`?`data`:`field`}function Hj(e,t){let n=Uj(e);return{kind:Vj(e),label:t,subLabel:n.length>0?`${e.type}, ${N(n.length)} items`:`${e.type}: ${Bj(e)}`,offset:e.offset,size:e.size,badges:[e.type],meta:[{key:`type`,value:e.type},{key:`offset`,value:M(e.offset)},{key:`size`,value:j(e.size)}],rowsLabel:n.length>0?`Items`:`Value`,rows:n.length>0?n.map(e=>({address:e.label,value:e.subLabel})):[{address:t,value:Bj(e)}],children:n}}function Uj(e){return e.type===`dict`?e.entries.slice(0,512).map(e=>Hj(e.value,Bj(e.key))):e.type===`array`||e.type===`set`?e.children.slice(0,512).map((e,t)=>Hj(e,`[${t}]`)):[]}function Wj(e){return[{kind:`header`,label:`Magic`,subLabel:`bplist00`,offset:e.magicOffset,size:e.magicSize,rowsLabel:`Magic`,rows:[{address:`0x0`,value:`62 70 6c 69 73 74 30 30 (b p l i s t 0 0)`}]},{kind:`body`,label:`Root object`,subLabel:`${e.root.type}, object ${e.rootIndex} of ${N(e.numObjects)}`,offset:e.root.offset,size:e.tableOffset-e.magicSize,meta:[{key:`root`,value:`object ${e.rootIndex}`},{key:`objects`,value:N(e.numObjects)},{key:`object table`,value:`${M(e.magicSize)}, ${j(e.tableOffset-e.magicSize)}`}],rowsLabel:`Items`,rows:Uj(e.root).map(e=>({address:e.label,value:e.subLabel})),children:Uj(e.root)},{kind:`index`,label:`Offset table`,subLabel:`${N(e.numObjects)} offsets, ${e.offsetWidth} bytes each`,offset:e.tableOffset,size:e.tableSize,meta:[{key:`offset`,value:M(e.tableOffset)},{key:`size`,value:j(e.tableSize)},{key:`entry width`,value:`${e.offsetWidth} B`}],rowsLabel:`Offsets`,rows:e.offsets.map((e,t)=>({address:String(t).padStart(5,`0`),value:M(e)}))},{kind:`footer`,label:`Trailer`,subLabel:`32 B, widths, object count and root index`,offset:e.trailerOffset,size:e.trailerSize,meta:[{key:`offset width`,value:`${e.offsetWidth} B`},{key:`ref width`,value:`${e.refWidth} B`},{key:`objects`,value:N(e.numObjects)},{key:`root`,value:String(e.rootIndex)}],rowsLabel:`Trailer`,rows:[{address:M(e.trailerOffset+6),value:`offset width ${e.offsetWidth}`},{address:M(e.trailerOffset+7),value:`ref width ${e.refWidth}`},{address:M(e.trailerOffset+8),value:`${N(e.numObjects)} objects`},{address:M(e.trailerOffset+16),value:`root object ${e.rootIndex}`}]}]}function Gj(e,t){return e.map(e=>({kind:`field`,label:e.key,subLabel:String(e.value),offset:0,size:t,rowsLabel:`Value`,rows:[{address:e.key,value:String(e.value)}]}))}function Kj(e){let t=new Uint8Array(e);if(Mj(t))return{format:`bplist`,size:e.byteLength,blocks:Wj(zj(t))};{let t=new TextDecoder(`utf-8`).decode(e);return{format:`plist`,size:e.byteLength,blocks:Gj(kj(t),e.byteLength)}}}function qj(e){return e&&e.type===`dict`?e.entries.map(e=>({key:String(e.key.value),value:e.value.entries||e.value.children?`<${e.value.type}>`:String(e.value.value)})):[]}function Jj(e){let t=new Uint8Array(e);return{payload:Mj(t)?qj(zj(t).root):kj(new TextDecoder(`utf-8`).decode(e)),structure:Kj(e),icon:`plist`}}function Yj(e){let t=new TextDecoder(`utf-8`).decode(e).split(`
|
|
331
|
-
`),n=t[0].startsWith(`#`),i=n?Xj(t[0]):{},a=[];for(let e=+!!n;e<t.length;e++){let n=t[e],i=n.lastIndexOf(` `);i>0&&a.push({frames:n.slice(0,i).split(`;`),count:Number(n.slice(i+1))})}return{meta:i,stacks:a,icon:`flame`,icons:[`flame`,`text`,`hex`]}}function Xj(e){try{return JSON.parse(e.slice(1))}catch{return{}}}function Zj(e){let t=new DataView(e),n=[],i=String.fromCharCode(t.getUint8(4),t.getUint8(5),t.getUint8(6),t.getUint8(7));if(i!==`Bud1`)return console.log(`DSStore: invalid magic`,i),[{filename:`error`,structureType:``,dataType:``,value:`Not a valid .DS_Store file`}];let a=t.getUint32(8);t.getUint32(12);let o=4+a;t.getUint32(o);let s=[];for(let e=0;e<256;e++)s.push(t.getUint32(o+8+e*4));let c=o+8+1024,l=t.getUint32(c),u=null,d=c+4;for(let e=0;e<l;e++){let e=t.getUint8(d);d+=1;let n=``;for(let i=0;i<e;i++)n+=String.fromCharCode(t.getUint8(d+i));d+=e;let i=t.getUint32(d);d+=4,n===`DSDB`&&(u=i)}if(u==null)return console.log(`DSStore: DSDB directory not found`),[{filename:`error`,structureType:``,dataType:``,value:`DSDB not found`}];function f(e){let t=s[e];return{offset:(t&-32)+4,size:1<<(t&31)}}let p=f(u),m=t.getUint32(p.offset);t.getUint32(p.offset+4),t.getUint32(p.offset+8),t.getUint32(p.offset+12),t.getUint32(p.offset+16);function h(e,n){let i=``;for(let a=0;a<n;a++)i+=String.fromCharCode(t.getUint16(e+a*2));return i}function g(e){return String.fromCharCode(t.getUint8(e),t.getUint8(e+1),t.getUint8(e+2),t.getUint8(e+3))}function _(n,i){if(n===`long`||n===`shor`)return{value:t.getUint32(i),nextPos:i+4};if(n===`bool`)return{value:t.getUint8(i),nextPos:i+1};if(n===`blob`){let n=t.getUint32(i);return{value:new Uint8Array(e.slice(i+4,i+4+n)),nextPos:i+4+n}}if(n===`ustr`){let e=t.getUint32(i);return{value:h(i+4,e),nextPos:i+4+e*2}}if(n===`type`)return{value:g(i),nextPos:i+4};if(n===`comp`){let e=t.getUint32(i),n=t.getUint32(i+4);return{value:e*4294967296+n,nextPos:i+8}}if(n===`dutc`){let e=t.getUint32(i),n=t.getUint32(i+4);return{value:e*4294967296+n,nextPos:i+8}}return{value:null,nextPos:i+4}}function v(e){let n=t.getUint32(e);e+=4;let i=h(e,n);e+=n*2;let a=g(e);e+=4;let o=g(e);e+=4;let{value:s,nextPos:c}=_(o,e);return{record:{filename:i,structureType:a,dataType:o,value:s},nextPos:c}}function y(e){let i=f(e),a=t.getUint32(i.offset),o=t.getUint32(i.offset+4),s=i.offset+8;if(a===0)for(let e=0;e<o;e++)try{let e=v(s);n.push(e.record),s=e.nextPos}catch(e){console.log(`DSStore: error reading record at`,s,e);break}else{for(let e=0;e<o;e++){let e=t.getUint32(s);s+=4,y(e);try{let e=v(s);n.push(e.record),s=e.nextPos}catch(e){console.log(`DSStore: error reading record at`,s,e);break}}y(t.getUint32(s))}}try{y(m)}catch(e){console.log(`DSStore: error traversing B-tree`,e)}return n}const Qj=Date.UTC(2001,0,1),$j=Date.UTC(1904,0,1),eM=e=>String(e).padStart(2,`0`);function tM(e){return`${e.getFullYear()}-${eM(e.getMonth()+1)}-${eM(e.getDate())} ${eM(e.getHours())}:${eM(e.getMinutes())}:${eM(e.getSeconds())}`}function nM(e){let t=new Date(Qj+e*1e3);if(t.getFullYear()>=2e3&&t.getFullYear()<=2100)return tM(t);let n=new Date($j+e*1e3);if(n.getFullYear()>=2e3&&n.getFullYear()<=2100)return tM(n);let i=new Date(Qj+e/65536*1e3);return i.getFullYear()>=2e3&&i.getFullYear()<=2100?tM(i):`${e}`}function rM(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function iM(e,t){return e[t]<<8|e[t+1]}function aM(e,t){return String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])}function oM(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(` `)}function sM(e){if(e.length<8)return oM(e);let t=new DataView(e.buffer,e.byteOffset,8).getFloat64(0,!0),n=new Date(Qj+t*1e3);return n.getFullYear()>=2e3&&n.getFullYear()<=2100?tM(n):oM(e)}const cM={Iloc:function(e){return e.length<16?oM(e):`pos(${rM(e,0)}, ${rM(e,4)})`},fwi0:function(e){return e.length<16?oM(e):`rect(${iM(e,0)}, ${iM(e,2)}, ${iM(e,4)}, ${iM(e,6)}) view=${aM(e,8)}`},BKGD:function(e){if(e.length<12)return oM(e);let t=aM(e,0);return t===`DefB`?`default`:t===`ClrB`?`color(${iM(e,4)}, ${iM(e,6)}, ${iM(e,8)})`:`${t} ${oM(e.slice(4))}`},lssp:function(e){return e.length<8?oM(e):`scroll(${rM(e,0)}, ${rM(e,4)})`},icsp:function(e){return e.length<8?oM(e):`scroll(${rM(e,0)}, ${rM(e,4)})`},icgo:function(e){return e.length<8?oM(e):`scroll(${rM(e,0)}, ${rM(e,4)})`},modD:sM,moDD:sM};function lM(e){return e.map(function(e){let{filename:t,structureType:n,dataType:i,value:a}=e,o=String(a);if(i===`dutc`)o=nM(a);else if(i===`bool`)o=a?`true`:`false`;else if(i===`comp`)o=`${a} bytes`;else if(i===`blob`&&a instanceof Uint8Array){let e=cM[n];o=e?e(a):a.length<=32?oM(a):`[blob ${a.length} bytes]`}else n===`vstl`&&(o={icnv:`icon`,clmv:`column`,Nlsv:`list`,Flwv:`coverflow`}[a]||a);return{filename:t,structureType:n,dataType:i,value:o}})}function uM(e,t,n){let i=``;for(let a=0;a<n;a+=1)i+=String.fromCharCode(e.getUint16(t+a*2));return i}function dM(e,t){return String.fromCharCode(e.getUint8(t),e.getUint8(t+1),e.getUint8(t+2),e.getUint8(t+3))}function fM(e,t,n){return t===`long`||t===`shor`||t===`type`?4:t===`bool`?1:t===`comp`||t===`dutc`?8:t===`blob`?4+e.getUint32(n):t===`ustr`?4+e.getUint32(n)*2:4}function pM(e,t){let n=e.getUint32(t),i=uM(e,t+4,n),a=t+4+n*2,o=dM(e,a),s=dM(e,a+4),c=a+8,l=fM(e,s,c);return{filename:i,structureType:o,dataType:s,offset:t,size:c+l-t,valueOffset:c,valueSize:l}}function mM(e){let t=new DataView(e);if(dM(t,4)!==`Bud1`)throw Error(`not a .DS_Store file`);let n=t.getUint32(8),i=t.getUint32(12),a=4+n,o=t.getUint32(a),s=a+8,c=[];for(let e=0;e<256;e+=1)c.push(t.getUint32(s+e*4));function l(e){let t=c[e];return{offset:(t&-32)+4,size:1<<(t&31)}}let u=s+1024,d=t.getUint32(u),f=[],p=u+4;for(let e=0;e<d;e+=1){let e=t.getUint8(p),n=``;for(let i=0;i<e;i+=1)n+=String.fromCharCode(t.getUint8(p+1+i));let i=t.getUint32(p+1+e);f.push({name:n,blockId:i,offset:p,size:1+e+4}),p+=1+e+4}let m=f.find(e=>e.name===`DSDB`);if(m===void 0)throw Error(`DSDB directory not found`);let h=l(m.blockId),g=t.getUint32(h.offset),_={blockId:m.blockId,offset:h.offset,size:h.size,rootBlockId:g,internalNodeCount:t.getUint32(h.offset+4),recordCount:t.getUint32(h.offset+8),nodeCount:t.getUint32(h.offset+12),pageSize:t.getUint32(h.offset+16)},v=[],y=new Set;function b(e){let n=l(e),i=n.offset+8<=t.byteLength&&n.offset+n.size<=t.byteLength;if(v.length<512&&y.has(e)===!1&&i){y.add(e);let i=t.getUint32(n.offset),a=t.getUint32(n.offset+4),o={blockId:e,offset:n.offset,size:n.size,mode:i,count:a,records:[],children:[]};v.push(o);let s=n.offset+n.size,c=n.offset+8;for(let e=0;e<a&&c+8<=s;e+=1){i!==0&&(o.children.push(t.getUint32(c)),c+=4);let e=pM(t,c);e.offset+e.size<=s?(o.records.push(e),c=e.offset+e.size):c=s}i!==0&&c+4<=s&&o.children.push(t.getUint32(c));for(let e of o.children)b(e)}}return b(g),{magicOffset:4,magicSize:4,headerOffset:0,headerSize:32,bookkeepingOffset:a,bookkeepingSize:i,numBlocks:o,addressTableOffset:s,addressTableSize:1024,blockAddresses:c,directoryOffset:u,directorySize:p-u,directories:f,tree:_,nodes:v,fileSize:e.byteLength}}var hM={BKGD:`background: Finder window background type and color`,ICVO:`iconViewOptions: Icon view options flag`,Iloc:`iconLocation: Icon x,y position coordinates`,LSVO:`listViewOptions: List view options flag`,bwsp:`windowProperties: Window size, position, sidebar (plist)`,cmmt:`comment: Spotlight comment`,dilc:`desktopIconLocation: Desktop icon location`,dscl:`disclosed: Indicates that subdirectory is open in list view`,extn:`extension: File extension override`,fwi0:`finderWindowInfo: Window rect (top, left, bottom, right) and view type`,fwsw:`finderSidebarWidth: Sidebar width in pixels`,fwvh:`finderWindowVerticalHeight: Window vertical height`,GRP0:`group: Group name`,icgo:`iconGridOptions: Icon grid options`,icsp:`iconScrollPosition: Icon scroll position`,icvo:`iconViewOptions: Icon view options blob`,icvp:`iconViewPreferences: Icon view preferences (plist)`,icvt:`iconViewTextSize: Icon view text size in points`,info:`info: Directory info with timestamps`,logS:`logicalSize: Logical size of directory contents`,lg1S:`logicalSize1: Logical size alternate`,lssp:`listScrollPosition: List view scroll position`,lsvo:`listViewOptions: List view column settings and widths`,lsvt:`listViewTextSize: List view text size in points`,lsvp:`listViewPreferences: List view settings (plist)`,lsvP:`listViewColumnSpecs: List view column specs (plist)`,modD:`modificationDate: File modification date`,moDD:`modificationDateDir: Directory modification date`,phyS:`physicalSize: Physical size in 8KB blocks`,ph1S:`physicalSize1: Physical size alternate`,pict:`picture: Alias record to background image`,vSrn:`version: Version number`,vstl:`viewStyle: View style (icnv/clmv/Nlsv/Flwv)`};function gM(e){return{kind:`header`,label:`Header`,subLabel:`alignment, Bud1 magic and the bookkeeping pointer`,offset:e.headerOffset,size:e.headerSize,meta:[{key:`magic`,value:`Bud1`},{key:`bookkeeping`,value:`${M(e.bookkeepingOffset)}, ${j(e.bookkeepingSize)}`},{key:`blocks`,value:N(e.numBlocks)}],rowsLabel:`Fields`,rows:[{address:`0x0`,value:`00 00 00 01 alignment`},{address:`0x4`,value:`42 75 64 31 (B u d 1)`},{address:`0x8`,value:`bookkeeping offset ${M(e.bookkeepingOffset-4)}`},{address:`0xc`,value:`bookkeeping size ${j(e.bookkeepingSize)}`}]}}function _M(e){let t=e.blockAddresses.map((e,t)=>({blockId:t,raw:e})).filter(e=>e.raw!==0);return{kind:`index`,label:`Buddy allocator`,subLabel:`${N(e.numBlocks)} blocks, 256 entry address table`,offset:e.bookkeepingOffset,size:e.addressTableOffset+e.addressTableSize-e.bookkeepingOffset,meta:[{key:`offset`,value:M(e.bookkeepingOffset)},{key:`blocks`,value:N(e.numBlocks)},{key:`address table`,value:`${M(e.addressTableOffset)}, ${j(e.addressTableSize)}`}],rowsLabel:`Allocated blocks`,rows:t.map(e=>({address:String(e.blockId).padStart(3,`0`),value:`${M((e.raw&-32)+4)}, ${j(1<<(e.raw&31))}`})),children:t.map(t=>({kind:`field`,label:`Block ${t.blockId}`,subLabel:`${j(1<<(t.raw&31))} at ${M((t.raw&-32)+4)}`,offset:e.addressTableOffset+t.blockId*4,size:4}))}}function vM(e){return{kind:`index`,label:`Directory list`,subLabel:`${N(e.directories.length)} named blocks`,offset:e.directoryOffset,size:e.directorySize,rowsLabel:`Directories`,rows:e.directories.map(e=>({address:e.name,value:`block ${e.blockId}`})),children:e.directories.map(e=>({kind:`field`,label:e.name,subLabel:`block ${e.blockId}`,offset:e.offset,size:e.size}))}}function yM(e,t){let n=new Uint8Array(e,t.valueOffset+4,Math.max(t.valueSize-4,0));if(Mj(n)){let e=zj(n),i=t.valueOffset+4;return e.root&&e.root.type===`dict`?e.root.entries.map(e=>({kind:`field`,label:String(e.key.value),subLabel:`${e.value.type}: ${String(e.value.value??``)}`,offset:i+e.value.offset,size:e.value.size,badges:[e.value.type],rowsLabel:`Value`,rows:[{address:String(e.key.value),value:String(e.value.value??e.value.type)}]})):[]}return[]}function bM(e,t){let n=t.dataType===`blob`?yM(e,t):[];return{kind:n.length>0?`entry`:`field`,label:t.structureType,subLabel:`${hM[t.structureType]??`property`} of ${t.filename}`,offset:t.offset,size:t.size,badges:[t.dataType],meta:[{key:`file`,value:t.filename},{key:`property`,value:t.structureType},{key:`type`,value:t.dataType},{key:`value`,value:`${M(t.valueOffset)}, ${j(t.valueSize)}`},{key:`meaning`,value:hM[t.structureType]??`unknown`}],children:n}}function xM(e,t,n){return{kind:`body`,label:`Node ${n} (block ${t.blockId})`,subLabel:`${t.mode===0?`leaf`:`internal`}, ${N(t.records.length)} records`,offset:t.offset,size:t.size,badges:[t.mode===0?`leaf`:`internal`],meta:[{key:`block`,value:String(t.blockId)},{key:`offset`,value:M(t.offset)},{key:`size`,value:j(t.size)},{key:`mode`,value:t.mode===0?`leaf`:`internal, ${t.children.length} children`},{key:`records`,value:N(t.records.length)}],rowsLabel:`Records`,rows:t.records.map(e=>({address:e.filename,value:`${e.structureType} (${e.dataType})`})),children:t.records.map(t=>bM(e,t))}}function SM(e){return{kind:`footer`,label:`B-tree master`,subLabel:`root block ${e.tree.rootBlockId}, ${N(e.tree.recordCount)} records`,offset:e.tree.offset,size:e.tree.size,meta:[{key:`root block`,value:String(e.tree.rootBlockId)},{key:`records`,value:N(e.tree.recordCount)},{key:`nodes`,value:N(e.tree.nodeCount)},{key:`page size`,value:j(e.tree.pageSize)}],rowsLabel:`Master block`,rows:[{address:M(e.tree.offset),value:`root block id ${e.tree.rootBlockId}`},{address:M(e.tree.offset+8),value:`${N(e.tree.recordCount)} records`},{address:M(e.tree.offset+12),value:`${N(e.tree.nodeCount)} nodes`},{address:M(e.tree.offset+16),value:`page size ${j(e.tree.pageSize)}`}]}}function CM(e){let t=mM(e),n=[gM(t),_M(t),vM(t),SM(t),...t.nodes.map((t,n)=>xM(e,t,n))];return{format:`ds_store`,size:e.byteLength,blocks:n}}function wM(e){let t=lM(Zj(e)),n;try{n=CM(e)}catch(e){console.warn(`ds_store structure failed`,e.message)}return{payload:t,structure:n,icon:`apple`}}const TM=/[\p{White_Space}\p{P}\p{S}]+/u;function EM(e){let{text:t}=e,n=new Map;if(t){let e=t.split(TM).filter(Boolean);for(let t of e)n.set(t,(n.get(t)||0)+1)}return n}function DM(e,t){let{title:n,body:i,keywords:a,ext:o}=e;function s(e,n){let i=e.toLowerCase().trim();i.length<=1||(!t.has(i)||t.get(i)<n)&&t.set(i,n)}if(Array.isArray(a))for(let e of a)s(e,100);if(n){let e=EM({text:n,ext:o});for(let[t]of e)s(t,90)}if(i){let e=EM({text:i,ext:o});for(let[t,n]of e.entries())s(t,Math.min(Math.round(n*10),89))}return t}function OM(e){let t=[],n=/<content>\s*<!\[CDATA\[([\s\S]*?)\]\]>\s*<\/content>/g,i;for(;(i=n.exec(e))!==null;)t.push(i[1]);return{cleaned:e.replace(n,`<content></content>`),blocks:t}}function kM(e){let t=new TextDecoder(`utf-8`).decode(e),{cleaned:n,blocks:i}=OM(t),a=gO(hO(n),`note`),o=[];for(let e=0;e<a.length;e++){let t=a[e],n=J(t,`title`)?.text||``,s=J(t,`created`)?.text||``,c=J(t,`updated`)?.text||``,l=Y(t,[`note-attributes`,`author`])?.text||``,u={},d=gO(t,`resource`);for(let e of d){let t=J(e,`data`)?.text?.trim()||``,n=J(e,`mime`)?.text||``,i=J(e,`width`)?.text||``,a=J(e,`height`)?.text||``,o=(Y(e,[`resource-attributes`,`source-url`])?.text||``).match(/\+([a-f0-9]{32})\+/),s=o?o[1]:``;s&&t&&(u[s]={data:t,mime:n,width:i,height:a})}let f=AM(i[e]||``,u);o.push({title:n,created:s,updated:c,author:l,html:f})}return{notes:o,text:t,icon:`evernote`,icons:[`render`,`text`,`hex`]}}function AM(e,t){let n=e.replace(/<\?xml[^?]*\?>/g,``).replace(/<!DOCTYPE[^>]*>/g,``).trim();return n=n.replace(/<en-note>/g,`<div class="en-note">`),n=n.replace(/<\/en-note>/g,`</div>`),n=n.replace(/<en-media[^/]*?hash="([a-f0-9]+)"[^/]*?type="([^"]*)"[^/]*?\/>/g,function(e,n,i){let a=t[n];return a?`<img src="${`data:${a.mime};base64,${a.data}`}" style="${a.width?`max-width:${a.width}px`:``}" />`:`<div class="en-media-missing">[media: ${n}]</div>`}),n=n.replace(/evernote:\/\/\/[^"']*/g,`#`),n}function jM(){let e={};return{Parser:t,getCache:t=>e[t],releaseZip:t=>delete e[t]};async function t(t,n){let i=n.url||n?.file?.name||n.ext,a=await gk(t);e[i]=a;let o=a.getEntries().map(e=>e.name);return console.log(`zip indexed`,i,o.length,`entries`),{entries:o,zipPath:i,structure:Ak(a.getLayout(),t.byteLength)}}}function MM(e){let t=e.byteLength-512,n=new DataView(e,t,512),i=n.getUint32(0);if(i!==1802464377)throw Error(`not a DMG file: koly magic not found`);return{magic:i,version:n.getUint32(4),headerSize:n.getUint32(8),flags:n.getUint32(12),dataForkOffset:Number(n.getBigUint64(24)),dataForkLength:Number(n.getBigUint64(32)),xmlOffset:Number(n.getBigUint64(216)),xmlLength:Number(n.getBigUint64(224)),sectorCount:Number(n.getBigUint64(380))}}function NM(e,t,n){let i=new Uint8Array(e,t,n),a=new TextDecoder().decode(i),o=[],s=PM(a,`blkx`);if(s){let e=FM(s,`dict`);for(let t of e){let e=IM(t,`CFName`,`string`)||``,n=LM((IM(t,`Data`,`data`)||``).trim());o.push({name:e,data:n})}}return{blkx:o}}function PM(e,t){let n=e.indexOf(`<key>resource-fork</key>`);if(n===-1)return null;let i=`<key>${t}</key>`,a=e.indexOf(i,n);if(a===-1)return null;let o=e.indexOf(`<array>`,a);if(o===-1)return null;let s=e.indexOf(`</array>`,o);return s===-1?null:e.slice(o+7,s)}function FM(e,t){let n=[],i=`<${t}>`,a=`</${t}>`,o=0;for(;;){let t=e.indexOf(i,o);if(t===-1)break;let s=e.indexOf(a,t);if(s===-1)break;n.push(e.slice(t+i.length,s)),o=s+a.length}return n}function IM(e,t,n){let i=`<key>${t}</key>`,a=e.indexOf(i);if(a===-1)return null;let o=a+i.length,s=`<${n}>`,c=`</${n}>`,l=e.indexOf(s,o);if(l===-1)return null;let u=e.indexOf(c,l);return u===-1?null:e.slice(l+s.length,u)}function LM(e){let t=e.replace(/\s/g,``);if(globalThis.Buffer){let e=Buffer.from(t,`base64`);return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}{let e=atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n}}function RM(e){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),n=new DataView(t),i=n.getUint32(0);if(i!==1835627368)throw Error(`invalid mish magic: 0x`+i.toString(16));let a=Number(n.getBigUint64(8)),o=Number(n.getBigUint64(16)),s=Number(n.getBigUint64(24)),c=n.getUint32(200),l=[];for(let e=0;e<c;e++){let t=204+e*40,i=n.getUint32(t);if(i===4294967295)break;i!==2147483646&&l.push({type:i,sectorStart:Number(n.getBigUint64(t+8)),sectorCount:Number(n.getBigUint64(t+16)),compressedOffset:Number(n.getBigUint64(t+24)),compressedLength:Number(n.getBigUint64(t+32))})}return{sectorNumber:a,sectorCount:o,dataOffset:s,chunks:l}}function zM(e,t){let n=new Uint8Array(t),i=0,a=0;for(;i<e.length&&a<t;){let o=e[i++];if(o&128){let s=(o&127)+1;for(let o=0;o<s&&a<t;o++)n[a++]=e[i++]}else if(o&64){let s=(o&63)+4,c=e[i]<<8|e[i+1];i+=2;let l=a-c;for(let e=0;e<s&&a<t;e++)n[a++]=n[l+e]}else{let s=(o>>2&3)+3,c=(o&3)<<8|e[i++],l=a-c;for(let e=0;e<s&&a<t;e++)n[a++]=n[l+e]}}return n}function BM(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=[],i=0;for(;i<e.length;){let a=t.getUint32(i,!0);if(a===611874402)break;if(a===1853388386){let a=t.getUint32(i+4,!0);i+=8;for(let t=0;t<a;t++)n.push(e[i++])}else if(a===846755426){let a=t.getUint32(i+4,!0),o=t.getUint32(i+8,!0);i+=12;let s=VM(e.subarray(i,i+o),a);for(let e=0;e<s.length;e++)n.push(s[e]);i+=o}else if(a===829978210){let t=HM(e,i);for(let e=0;e<t.data.length;e++)n.push(t.data[e]);i=t.nextPos}else throw Error(`unknown LZFSE block magic: 0x`+a.toString(16))}return new Uint8Array(n)}function VM(e,t){let n=new Uint8Array(t),i=0,a=0;for(;i<e.length&&a<t;){let o=e[i];if(o===6)break;let s=o&240;if(o===224){let o=e[i+1]+1;i+=2;for(let s=0;s<o&&a<t;s++)n[a++]=e[i++]}else if(s===224){let s=o&15;i+=1;for(let o=0;o<s&&a<t;o++)n[a++]=e[i++]}else if(s===240){let s=(o&15)+16,c=e[i+1]|e[i+2]<<8;i+=3;for(let e=0;e<s&&a<t;e++)n[a]=n[a-c],a++}else if((o&224)==160||(o&224)==128){let s=o>>3&3,c=(o&7)+3,l=o&224,u;l===160?(u=e[i+1+s]|e[i+2+s]<<8,i+=1):(u=e[i+1+s]|(e[i+2+s]&63)<<8,i+=1);for(let o=0;o<s&&a<t;o++)n[a++]=e[i++];if(i+=2,u===0)break;for(let e=0;e<c&&a<t;e++)n[a]=n[a-u],a++}else if(!(o&192)||(o&192)==64){let s=(o>>4&3)+3,c=o>>6&3;i+=1;for(let o=0;o<c&&a<t;o++)n[a++]=e[i++];let l=e[i]|(o&15)<<8;if(i+=1,l===0)break;for(let e=0;e<s&&a<t;e++)n[a]=n[a-l],a++}else i++}return n.subarray(0,a)}function HM(e,t){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=t+4,a=n.getUint32(i,!0);i+=4,n.getUint32(i,!0),i+=4;let o=n.getUint32(i,!0);i+=4;let s=n.getUint32(i,!0);i+=4;let c=n.getUint32(i,!0);i+=4;let l=n.getUint32(i,!0);i+=4;let u=n.getInt32(i,!0);i+=4;let d=n.getInt32(i,!0);i+=4;let f=new Uint16Array(20);for(let e=0;e<20;e++)f[e]=n.getUint16(i,!0),i+=2;let p=new Uint16Array(20);for(let e=0;e<20;e++)p[e]=n.getUint16(i,!0),i+=2;let m=new Uint16Array(64);for(let e=0;e<64;e++)m[e]=n.getUint16(i,!0),i+=2;let h=new Uint16Array(256);for(let e=0;e<256;e++)h[e]=n.getUint16(i,!0),i+=2;i-t;let g=UM(e.subarray(i,i+c),h,256,o,u);i+=c;let _=WM(e.subarray(i,i+l),f,p,m,s,d);i+=l;let v=new Uint8Array(a),y=0,b=0;for(let e=0;e<s;e++){let t=_.lengths[e],n=_.matches[e],i=_.distances[e];for(let e=0;e<t&&y<a;e++)v[y++]=g[b++];if(i>0)for(let e=0;e<n&&y<a;e++)v[y]=v[y-i],y++}for(;b<o&&y<a;)v[y++]=g[b++];return{data:v.subarray(0,y),nextPos:i}}function UM(e,t,n,i,a){let o=GM(t,n),s=KM(t,n,o),c=new Uint8Array(i),l=qM(e,a),u=l.read(o);for(let e=0;e<i;e++){let t=s[u];c[e]=t.symbol,u=t.newState+l.read(t.nBits)}return c}function WM(e,t,n,i,a,o){let s=GM(t,20),c=GM(n,20),l=GM(i,64),u=KM(t,20,s),d=KM(n,20,c),f=KM(i,64,l),p=qM(e,o),m=p.read(s),h=p.read(c),g=p.read(l),_=new Uint32Array(a),v=new Uint32Array(a),y=new Uint32Array(a),b=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,24],x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2],S=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,24],C=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2],w=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,34,36,40,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576,32768,49152,65536,98304,131072,196608,262144,393216,524288],T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30];for(let e=0;e<a;e++){let t=u[m].symbol,n=d[h].symbol,i=f[g].symbol;_[e]=b[t]+p.read(x[t]),v[e]=S[n]+p.read(C[n]),y[e]=w[i]+p.read(T[i]);let a=u[m],o=d[h],s=f[g];m=a.newState+p.read(a.nBits),h=o.newState+p.read(o.nBits),g=s.newState+p.read(s.nBits)}return{lengths:_,matches:v,distances:y}}function GM(e,t){let n=0;for(let i=0;i<t;i++)n+=e[i];if(n===0)return 0;let i=0,a=n;for(;a>1;)a>>=1,i++;return i}function KM(e,t,n){let i=1<<n,a=Array(i),o=0;for(let i=0;i<t;i++)for(let t=0;t<e[i];t++){let t=n-Math.floor(Math.log2(e[i]||1));a[o]={symbol:i,nBits:Math.max(0,t),newState:0},o++}let s=new Uint32Array(t);for(let n=0;n<t;n++)e[n]<=1?s[n]=i+e[n]-1:s[n]=e[n];for(let t=0;t<i;t++)if(a[t]){let o=e[a[t].symbol];if(o>0){let e=n-Math.floor(Math.log2(o)),s=(o<<e)-i;a[t].nBits=e,a[t].newState=s}}return a}function qM(e,t){let n=e.length-1,i=7;function a(t){if(t===0)return 0;let a=0;for(let o=0;o<t;o++)n>=0&&(a|=(e[n]>>i&1)<<o,i--,i<0&&(i=7,n--));return a}return{read:a}}function JM(e){let{arrayBuffer:t,partitions:n,dataForkOffset:i}=e,a=new Map;n[0].sectorNumber;let o=[];for(let e of n)for(let t of e.chunks)o.push({...t,absoluteSectorStart:t.sectorStart,compressedOffset:e.dataOffset+t.compressedOffset});async function s(e,t){let n=new Uint8Array(t),i=0;for(;i<t;){let a=e+i,o=c(Math.floor(a/512));if(!o){let e=Math.min(t-i,512);i+=e;continue}let s=await l(o),u=a-o.absoluteSectorStart*512,d=s.byteLength-u,f=Math.min(d,t-i);n.set(s.subarray(u,u+f),i),i+=f}return n}function c(e){for(let t of o)if(e>=t.absoluteSectorStart&&e<t.absoluteSectorStart+t.sectorCount)return t;return null}async function l(e){let n=e.compressedOffset+`:`+e.compressedLength;if(a.has(n)){let e=a.get(n);return a.delete(n),a.set(n,e),e}let o=e.sectorCount*512,s;if(e.type===0||e.type===2)s=new Uint8Array(o);else if(e.type===1){let n=i+e.compressedOffset;s=new Uint8Array(t,n,e.compressedLength)}else{let n=i+e.compressedOffset,a=new Uint8Array(t,n,e.compressedLength);e.type===2147483653?s=await vt(a):e.type===2147483654?s=kt(a):e.type===2147483655?s=BM(a):e.type===2147483652?s=zM(a,o):e.type===2147483656?s=WO(a,o):(console.log(`unknown block type: 0x`+e.type.toString(16)+`, filling zeros`),s=new Uint8Array(o))}if(a.size>=16){let e=a.keys().next().value;a.delete(e)}return a.set(n,s),s}function u(e,t){let n=0;return new ReadableStream({async pull(i){if(n>=t){i.close();return}let a=Math.min(32768,t-n),o=await s(e+n,a);i.enqueue(o),n+=a}})}return{read:s,readStream:u}}async function YM(e){let t=await e.read(1024,512),n=new DataView(t.buffer,t.byteOffset,t.byteLength),i=n.getUint16(0);if(i!==18475&&i!==18520)throw Error(`not HFS+: signature 0x`+i.toString(16));return{signature:i,version:n.getUint16(2),blockSize:n.getUint32(40),totalBlocks:n.getUint32(44),allocationFile:XM(n,112),extentsFile:XM(n,192),catalogFile:XM(n,272),attributesFile:XM(n,352),startupFile:XM(n,432)}}function XM(e,t){let n=Number(e.getBigUint64(t)),i=e.getUint32(t+8),a=e.getUint32(t+12),o=[];for(let n=0;n<8;n++){let i=e.getUint32(t+16+n*8),a=e.getUint32(t+16+n*8+4);a>0&&o.push({startBlock:i,blockCount:a})}return{logicalSize:n,clumpSize:i,totalBlocks:a,extents:o}}async function ZM(e){let{reader:t,volume:n,forkData:i}=e;async function a(e,a){let o=0;for(let s of i.extents){let i=s.blockCount*n.blockSize;if(e<o+i){let i=s.startBlock*n.blockSize+(e-o);return await t.read(i,a)}o+=i}throw Error(`offset beyond fork extents: `+e)}let o=await a(0,512),s=new DataView(o.buffer,o.byteOffset,o.byteLength);s.getInt8(8);let c=s.getUint16(14),l=s.getUint32(16),u=s.getUint32(20),d=s.getUint32(24);s.getUint32(28);let f=s.getUint16(32);s.getUint16(34),s.getUint32(36);async function p(e){let t=await a(e*f,f),n=new DataView(t.buffer,t.byteOffset,t.byteLength),i=n.getUint32(0),o=n.getUint32(4),s=n.getInt8(8),c=n.getUint8(9),l=n.getUint16(10),u=[];for(let e=0;e<=l;e++)u.push(n.getUint16(f-2*(e+1)));let d=[];for(let e=0;e<l;e++){let n=u[e],i=u[e+1];d.push(t.subarray(n,i))}return{fLink:i,bLink:o,kind:s,height:c,numRecords:l,records:d}}async function m(e){if(d===0)return;let t=d;for(;t!==0;){let n=await p(t);for(let t of n.records)e(t);t=n.fLink}}async function h(e){if(l===0)return null;let t=l;for(;;){let n=await p(t);if(n.kind===-1){for(let t of n.records)if(e(t)===0)return t;return null}if(n.kind===0){let i=0;for(let t of n.records){let n=e(t);if(n>=0){let e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=e.getUint16(0);i=e.getUint32(2+n)}if(n<0)break}if(i===0)return null;t=i}else return null}}return{traverse:m,search:h,readNode:p,nodeSize:f,rootNode:l,firstLeafNode:d,leafRecords:u,treeDepth:c}}function QM(e){let{reader:t,volume:n,forkData:i}=e,a=i.logicalSize,o=0,s=[];for(let e of i.extents)e.blockCount>0&&s.push({diskOffset:e.startBlock*n.blockSize,length:e.blockCount*n.blockSize});let c=0,l=0;return new ReadableStream({async pull(e){if(o>=a){e.close();return}if(c>=s.length){e.close();return}let n=s[c],i=n.length-l,u=Math.min(i,65536,a-o),d=await t.read(n.diskOffset+l,u);l+=u,l>=n.length&&(c++,l=0);let f=a-o;u>f?(e.enqueue(d.subarray(0,f)),o+=f,e.close()):(e.enqueue(d),o+=u)}})}async function $M(e){let{reader:t,volume:n}=e,i=await ZM({reader:t,volume:n,forkData:n.catalogFile}),a=new Map,o=new Map,s=new Map;await i.traverse(function(e){if(e.byteLength<6)return;let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getUint16(0);if(n<6||2+n>=e.byteLength)return;let i=t.getUint32(2),s=nN(e,8,t.getUint16(6)),l=2+n,u=l+l%2;if(u+2>e.byteLength)return;let d=t.getInt16(u);if(d===1){if(u+8>e.byteLength)return;let n=t.getUint32(u+8);a.set(n,{name:s,parentID:i}),c(i,s,n,`folder`)}else if(d===2){if(u+248>e.byteLength)return;let n=t.getUint32(u+8),a=eN(t.getUint16(u+42),t.getUint16(u+56)),l=tN(t,u+88),d=l.logicalSize;o.set(n,{name:s,parentID:i,size:d,forkData:l,type:a}),c(i,s,n,a)}});function c(e,t,n,i){s.has(e)||s.set(e,[]),s.get(e).push({name:t,cnid:n,type:i})}function l(e){let t=[],n=e;for(;n!==2&&n!==0;){let e=a.get(n),i=o.get(n);if(e)t.unshift(e.name),n=e.parentID;else if(i)t.unshift(i.name),n=i.parentID;else break}return`/`+t.join(`/`)}function u(e){let t=[];for(let[n,i]of a){let i=l(n);(!e||i.startsWith(e))&&t.push({path:i,size:0,type:`folder`})}for(let[n,i]of o){let a=l(n);(!e||a.startsWith(e))&&t.push({path:a,size:i.size,type:i.type})}return t.sort(function(e,t){return e.path<t.path?-1:+(e.path>t.path)}),t}function d(e){for(let[i,a]of o)if(l(i)===e)return QM({reader:t,volume:n,forkData:a.forkData});throw Error(`file not found: `+e)}return{list:u,readFile:d}}function eN(e,t){let n=e&61440;return n===40960?`symlink`:n===49152?`socket`:n===8192?`char-device`:n===24576?`block-device`:n===4096?`fifo`:t&32768?`alias`:`file`}function tN(e,t){let n=Number(e.getBigUint64(t)),i=e.getUint32(t+8),a=e.getUint32(t+12),o=[];for(let n=0;n<8;n++){let i=e.getUint32(t+16+n*8),a=e.getUint32(t+16+n*8+4);a>0&&o.push({startBlock:i,blockCount:a})}return{logicalSize:n,clumpSize:i,totalBlocks:a,extents:o}}function nN(e,t,n){let i=[];for(let a=0;a<n;a++){let n=e[t+a*2]<<8|e[t+a*2+1];i.push(String.fromCharCode(n))}return i.join(``)}async function rN(e){let t=MM(e);console.log(`koly:`,t);let n=NM(e,t.xmlOffset,t.xmlLength);console.log(`partitions:`,n.blkx.length,n.blkx.map(function(e){return e.name}));let i=n.blkx.map(function(e){return{...RM(e.data),name:e.name}}),a=i.find(function(e){return e.name.includes(`Apple_HFS`)})||i.reduce(function(e,t){return t.sectorCount>e.sectorCount?t:e});if(!a)throw Error(`no HFS partition found in DMG`);console.log(`HFS partition:`,a.name,`sectorNumber:`,a.sectorNumber,`sectorCount:`,a.sectorCount,`chunks:`,a.chunks.length),console.log(`first chunk:`,a.chunks[0]);let o=JM({arrayBuffer:e,partitions:[a],dataForkOffset:t.dataForkOffset}),s=await YM(o);console.log(`HFS+ volume: blockSize=`+s.blockSize+` totalBlocks=`+s.totalBlocks);let c=await $M({reader:o,volume:s});return{getEntries:l,readEntry:u,koly:t,volume:s};function l(e){return c.list(e)}function u(e){return c.readFile(e.startsWith(`/`)?e:`/`+e)}}async function iN(e){let t=await gk(e),n=t.getEntries(),a=await aN(t,n);return{getEntries:o,getEntry:s};async function o(){let e=n.find(e=>e.name===`collection.anki21`)??n.find(e=>e.name===`collection.anki2`),o=await t.getEntry(e.name),s=await i(o);try{let e=oN(s.query(`SELECT models FROM col`)[0].models);return{notes:s.query(`SELECT id, guid, mid, tags, flds FROM notes`).map(t=>sN(t,e)),models:e,mediaMap:a}}finally{await s.close()}}async function s(e){let n=a[e];return await t.getEntry(n)}}async function aN(e,t){let n={};if(t.find(e=>e.name===`media`)){let t=await e.getEntry(`media`),i=JSON.parse(new TextDecoder().decode(t));Object.keys(i).forEach(e=>{n[i[e]]=e})}return n}function oN(e){let t=JSON.parse(e),n={};return Object.keys(t).forEach(e=>{let i=t[e];n[e]={name:i.name,flds:i.flds.map(e=>({name:e.name,ord:e.ord})),tmpls:i.tmpls.map(e=>({name:e.name,qfmt:e.qfmt,afmt:e.afmt})),css:i.css}}),n}function sN(e,t){let n=t[String(e.mid)],i=e.flds.split(``),a={};return n&&n.flds.forEach(e=>{a[e.name]=i[e.ord]??``}),{id:Number(e.id),guid:e.guid,mid:String(e.mid),tags:e.tags,fields:a}}function cN(e,t,n){let i=!0;for(let a=0;a<n.length;a++)e[t+a]!==n.charCodeAt(a)&&(i=!1);return i}function lN(e){return cN(e,0,`SQLite format 3\0`)?`sqlite`:cN(e,8,`DUCK`)?`duckdb`:cN(e,0,`$FL2`)||cN(e,0,`$FL3`)?`sav`:cN(e,0,`HEADER RECORD*******LIBRARY HEADER RECORD`)?`xpt`:cN(e,0,`PAR1`)?`parquet`:cN(e,0,`Obj`)?`avro`:cN(e,0,`ORC`)?`orc`:null}async function uN(e,t,n=``){return await fN(e,e=>e.getEntries(t,n))}async function dN(e,t,n=0,i=1e3){return await fN(e,e=>e.getEntry(t,n,i))}async function fN(e,t){let{open:n,entryApi:i}=await pN(e),a=await n(e);try{return await t(i(a.query))}finally{await a.close()}}async function pN(e){if(lN(await mN(e))===`duckdb`){let e=(await import(`./duckdb.js`)).default,t=(await import(`./duckdbEntry.js`)).default;return Tt||await(await import(`./duckdbWasm.js`)).default(),{open:e,entryApi:t}}{let e=(await import(`./sqlite.js`)).default,t=(await import(`./sqliteEntry.js`)).default;return Tt||await(await import(`./sqliteWasm.js`)).default(),{open:e,entryApi:t}}}async function mN(e,t=64){if(typeof e==`string`){let{open:n}=await import(`node:fs/promises`),i=await n(e);try{let{buffer:e,bytesRead:n}=await i.read(new Uint8Array(t),0,t,0);return e.subarray(0,n)}finally{await i.close()}}else if(e&&typeof e.slice==`function`&&typeof e.arrayBuffer==`function`)return new Uint8Array(await e.slice(0,t).arrayBuffer());else return new Uint8Array(e).subarray(0,t)}function hN(e,t){let{path:n}=t,i={name:``,path:n,pathEntry:``,size:0,objectKind:`folder`,children:[]};return e.forEach(e=>{let t=e.name.endsWith(`/`),a=e.name.split(`/`).filter(e=>e!==``),o=i;a.forEach((i,s)=>{let c=s===a.length-1,l=a.slice(0,s+1).join(`/`),u=o.children.find(e=>e.name===i);u||(u={name:i,path:n,pathEntry:l,size:0,objectKind:`folder`,children:[]},o.children.push(u)),c&&!t?(u.objectKind=`file`,u.size=e.size,u.compressedSize=e.compressedSize,u.compMethod=e.compMethod,u.lastModified=e.lastModified,delete u.children):c&&t&&(u.size=e.size,u.lastModified=e.lastModified),o=u})}),i.children}function gN(e,t){let n=e;return t&&(n=[],e.forEach(e=>{e.pathEntry===t?n=e.children||[]:e.children&&t.startsWith(`${e.pathEntry}/`)&&(n=gN(e.children,t))})),n}function _N(e){let t=Dt(e?.path);if(t){let{archivePath:e,entryPath:n,kind:s}=t;return{archivePath:e,entryPath:n,kind:s,getObjects:a,getEntries:i,getEntry:o}}return;function n(i){return i.forEach(i=>{i.serviceType=e.serviceType,i.root=e.root,i.pathEntry&&(i.path=`${t.archivePath}/${i.pathEntry}`,i.isPackedEntry=!0),i.children&&n(i.children)}),i}async function i(e){let i,{kind:a}=t;if(a===`db`)i=await uN(e,t.archivePath,t.entryPath);else if(a===`dmg`)i=gN(hN((await rN(await vN(e))).getEntries(`/`).map(e=>({name:e.path.replace(/^\//,``)+(e.type===`folder`?`/`:``),size:e.size})),{path:t.archivePath}),t.entryPath);else if(a===`apkg`)return{payload:await(await iN(await vN(e))).getEntries()};else i=gN(hN((await gk(await vN(e))).getEntries(),{path:t.archivePath}),t.entryPath);return{payload:{children:n(i),meta:null}}}async function a(e){return await i(e)}async function o(e,n,i){let{kind:a,entryPath:o}=t;return a===`db`?{payload:await dN(e,o,n,i)}:a===`dmg`?await yN((await rN(await vN(e))).readEntry(o)):a===`apkg`?await(await iN(await vN(e))).getEntry(o):await(await gk(await vN(e))).getEntry(o)}}async function vN(e){return typeof e==`string`?await lO(e):e&&typeof e.arrayBuffer==`function`?await e.arrayBuffer():e}async function yN(e){return new Uint8Array(await new Response(e).arrayBuffer())}const bN=new Set([`if`,`else`,`for`,`while`,`do`,`switch`,`case`,`break`,`continue`,`return`,`throw`,`try`,`catch`,`finally`,`new`,`delete`,`typeof`,`instanceof`,`void`,`in`,`of`,`await`,`yield`,`class`,`super`]),xN=new Set(`console.log.warn.error.info.debug.setTimeout.setInterval.clearTimeout.clearInterval.parseInt.parseFloat.isNaN.isFinite.JSON.stringify.Math.Object.Array.String.Number.Boolean.RegExp.Date.Promise.Map.Set.WeakMap.WeakSet.Symbol.Proxy.Reflect.Error.TypeError.RangeError.require.module.exports.push.pop.shift.unshift.splice.slice.concat.forEach.map.filter.reduce.find.findIndex.some.every.includes.indexOf.lastIndexOf.join.split.trim.replace.match.search.test.exec.keys.values.entries.from.assign.freeze.hasOwnProperty.toString.valueOf.substring.startsWith.endsWith.padStart.padEnd.charAt.charCodeAt.codePointAt.toUpperCase.toLowerCase.getElementById.querySelector.querySelectorAll.createElement.createElementNS.appendChild.removeChild.setAttribute.getAttribute.addEventListener.removeEventListener.getBoundingClientRect.preventDefault.stopPropagation.then.catch.resolve.reject.all.race.fetch.Response.Request.Headers.atob.btoa.encodeURIComponent.decodeURIComponent.Function.Infinity.NaN.undefined.null.document.window.globalThis.self.has.add.get.set.delete.clear.size.apply.call.bind`.split(`.`));function SN(e){let t=e.replace(/\/\/.*$/gm,``);return t=t.replace(/\/\*[\s\S]*?\*\//g,``),t}function CN(e){return e.replace(/'(?:[^'\\]|\\.)*'/g,`''`).replace(/"(?:[^"\\]|\\.)*"/g,`""`).replace(/`(?:[^`\\]|\\.)*`/g,"``")}function wN(e,t,n){let i=e.substring(0,n).split(`
|
|
330
|
+
`;else if(n===114)o+=`\r`;else if(n===116)o+=` `;else if(n===98)o+=`\b`;else if(n===102)o+=`\f`;else if(n===40)o+=`(`;else if(n===41)o+=`)`;else if(n===92)o+=`\\`;else if(n===13)i()===10&&t++;else if(n!==10){if(n>=48&&n<=55){let e=n-48;i()>=48&&i()<=55&&(e=e*8+(a()-48),i()>=48&&i()<=55&&(e=e*8+(a()-48))),o+=String.fromCharCode(e)}else o+=String.fromCharCode(n)}}else o+=String.fromCharCode(n)}return o}function l(){let e=``;for(;t<n;){let t=a();if(t===62)break;bD(t)||(e+=String.fromCharCode(t))}e.length%2!=0&&(e+=`0`);let i=``;for(let t=0;t<e.length;t+=2)i+=String.fromCharCode(parseInt(e.substring(t,t+2),16));return i}function u(){let i=``;for(;t<n;){let a=e[t];if(bD(a)||a===47||a===40||a===41||a===60||a===62||a===91||a===93||a===123||a===125||a===37)break;if(t++,a===35&&t+1<n){let n=e[t],a=e[t+1];i+=String.fromCharCode(parseInt(String.fromCharCode(n,a),16)),t+=2}else i+=String.fromCharCode(a)}return{name:i}}function d(){let i=``;for(;t<n;){let n=e[t];if(bD(n)||n===47||n===40||n===41||n===60||n===62||n===91||n===93||n===123||n===125||n===37)break;i+=String.fromCharCode(n),t++}return i===`true`?!0:i===`false`?!1:i===`null`?null:{cmd:i}}function f(){if(o(),t>=n)return hD;let e=a();return xD(e)||e===43||e===45||e===46?(e===43||e===45)&&!xD(i())&&i()!==46?(t--,d()):s(e):e===40?c():e===47?u():e===60?i()===60?(t++,gD):l():e===62?i()===62?(t++,_D):hD:e===91?vD:e===93?yD:(t--,d())}function p(){return t}function m(e){t=e}return{nextToken:f,getPosition:p,setPosition:m,peekByte:i,readByte:a}}function CD(e){return typeof e==`object`&&!!e&&`name`in e}function wD(e,t){return typeof e!=`object`||!e||!(`cmd`in e)?!1:t===void 0||e.cmd===t}let TD=null;try{typeof process<`u`&&process.versions&&process.versions.node&&(TD=(await import(`node:zlib`)).inflateSync)}catch{}function ED(e,t){if(e==null)return new Uint8Array;let n=OD(t);return n===`FlateDecode`||n===`Fl`?kD(e):n===`ASCII85Decode`||n===`A85`?jD(e):n===`ASCIIHexDecode`||n===`AHx`?MD(e):e}async function DD(e,t){if(e==null)return new Uint8Array;let n=OD(t);return n===`FlateDecode`||n===`Fl`?AD(e):n===`ASCII85Decode`||n===`A85`?jD(e):n===`ASCIIHexDecode`||n===`AHx`?MD(e):e}function OD(e){return typeof e==`string`?e:e&&typeof e==`object`&&`name`in e?e.name:``}function kD(e){return e.length<2?e:TD?new Uint8Array(TD(Buffer.from(e))):e}async function AD(e){if(e.length<2)return e;if(TD)return new Uint8Array(TD(Buffer.from(e)));if(typeof DecompressionStream<`u`){let t=new DecompressionStream(`deflate`),n=t.writable.getWriter(),i=t.readable.getReader();n.write(e),n.close();let a=[];for(;;){let{done:e,value:t}=await i.read();if(e)break;a.push(t)}let o=a.reduce(function(e,t){return e+t.length},0),s=new Uint8Array(o),c=0;for(let e of a)s.set(e,c),c+=e.length;return s}return e}function jD(e){let t=typeof e==`string`?e:ND(e),n=[],i=0;for(;i<t.length&&(t[i]!==`~`||t[i+1]!==`>`);){if(t[i]===`z`){n.push(0,0,0,0),i++;continue}let e=[];for(;e.length<5&&i<t.length;){let n=t.charCodeAt(i);if(n>=33&&n<=117)e.push(n-33);else if(t[i]===`~`)break;i++}if(e.length===0)break;for(;e.length<5;)e.push(84);let a=0;for(let t=0;t<5;t++)a=a*85+e[t];let o=e.length-1;o>=1&&n.push(a>>24&255),o>=2&&n.push(a>>16&255),o>=3&&n.push(a>>8&255),o>=4&&n.push(a&255)}return new Uint8Array(n)}function MD(e){let t=typeof e==`string`?e:ND(e),n=[],i=``;for(let e=0;e<t.length&&t[e]!==`>`;e++)/[0-9a-fA-F]/.test(t[e])&&(i+=t[e],i.length===2&&(n.push(parseInt(i,16)),i=``));return i.length===1&&n.push(parseInt(i+`0`,16)),new Uint8Array(n)}function ND(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function PD(e,t){return FD(SD(e,t),e)}function FD(e,t){let n=e.nextToken();if(n===hD)return null;if(n===gD)return ID(e,t);if(n===vD)return LD(e,t);if(CD(n)||wD(n)||typeof n==`string`||typeof n==`boolean`||n===null)return n;if(typeof n==`number`){let t=e.getPosition(),i=e.nextToken();return typeof i==`number`&&wD(e.nextToken(),`R`)?{num:n,gen:i}:(e.setPosition(t),n)}return n}function ID(e,t){let n={};for(;;){let i=e.nextToken();if(i===_D||i===hD)break;if(!CD(i))continue;let a=FD(e,t);n[i.name]=a}let i=e.getPosition();if(wD(e.nextToken(),`stream`)){let i=e.getPosition();t[i]===13&&t[i+1]===10?i+=2:(t[i]===10||t[i]===13)&&(i+=1);let a=typeof n.Length==`number`?n.Length:0;if(a>0)n._streamBytes=t.slice(i,i+a),n._streamEnd=i+a;else{let e=RD(t,i);n._streamBytes=t.slice(i,e),n._streamEnd=e}n._hasStream=!0}else e.setPosition(i);return n}function LD(e,t){let n=[];for(;;){let i=e.getPosition(),a=e.nextToken();if(a===yD||a===hD)break;e.setPosition(i),n.push(FD(e,t))}return n}function RD(e,t){let n=[101,110,100,115,116,114,101,97,109];for(let i=t;i<e.length-n.length;i++){let a=!0;for(let t=0;t<n.length;t++)if(e[i+t]!==n[t]){a=!1;break}if(a){let n=i;for(;n>t&&(e[n-1]===10||e[n-1]===13);)n--;return n}}return e.length}function zD(e,t,n){let i=typeof e==`object`&&`num`in e?e.num:e,a=t[i];if(a==null)return null;if(a.compressed)return BD(i,a,t,n);let o=SD(n,a.offset);return o.nextToken(),o.nextToken(),wD(o.nextToken(),`obj`)?FD(o,n):null}function BD(e,t,n,i){let a=zD(t.offset,n,i);if(a==null||!a._hasStream)return null;let o=a.First||0,s=a.N||0,c=a.Filter,l=CD(c)?c.name:typeof c==`string`?c:``,u=a._streamBytes;return l&&(u=ED(u,l)),VD(u,e,o,s)}function VD(e,t,n,i){let a=SD(e,0),o=[];for(let e=0;e<i;e++){let e=a.nextToken(),t=a.nextToken();o.push({num:e,offset:n+t})}for(let n=0;n<o.length;n++)if(o[n].num===t)return FD(SD(e,o[n].offset),e);return null}function HD(e){let t=Math.min(1024,e.length),n=e.length-t,i=``;for(let t=n;t<e.length;t++)i+=String.fromCharCode(e[t]);let a=i.lastIndexOf(`startxref`);if(a===-1)return-1;let o=i.substring(a+9).trim().match(/^(\d+)/);return o?parseInt(o[1]):-1}async function UD(e){let t={},n=null,i=HD(e);if(i===-1)return{entries:KD(e),trailerDict:{}};let a=``,o=Math.min(10,e.length-i);for(let t=0;t<o;t++)a+=String.fromCharCode(e[i+t]);if(a.trimStart().startsWith(`xref`)){let a=WD(e,i);Object.assign(t,a.entries),n=a.trailerDict;let o=n.Prev;for(;typeof o==`number`;){let n=WD(e,o);for(let[e,i]of Object.entries(n.entries))t[e]??(t[e]=i);o=n.trailerDict.Prev}}else{let a=await GD(e,i);Object.assign(t,a.entries),n=a.trailerDict;let o=n.Prev;for(;typeof o==`number`;){let n=await GD(e,o);for(let[e,i]of Object.entries(n.entries))t[e]??(t[e]=i);o=n.trailerDict.Prev}}return{entries:t,trailerDict:n}}function WD(e,t){let n={},i=SD(e,t),a=i.nextToken();for(wD(a,`xref`)&&(a=i.nextToken());typeof a==`number`;){let e=a,t=i.nextToken();if(typeof t!=`number`)break;for(let a=0;a<t;a++){let t=i.nextToken(),o=i.nextToken(),s=i.nextToken();if(typeof t!=`number`)break;let c=wD(s,`f`);n[e+a]={offset:t,gen:typeof o==`number`?o:0,free:c,compressed:!1}}a=i.nextToken()}let o={};return wD(a,`trailer`)&&(o=PD(e,i.getPosition()),o??={}),{entries:n,trailerDict:o}}async function GD(e,t){let n=SD(e,t);if(wD(n.nextToken(),`xref`))return WD(e,t);n.nextToken(),n.nextToken();let i=PD(e,n.getPosition());if(i==null||!i._hasStream)return{entries:{},trailerDict:i||{}};let a=i._streamBytes;if(a==null||a.length===0)return{entries:{},trailerDict:i};let o=i.Filter,s=CD(o)?o.name:``,c=a;if(s)try{c=await DD(c,s)}catch(e){return console.log(`xref stream decode error:`,e.message),{entries:{},trailerDict:i}}let l=i.W||[1,2,1],u=l[0]||0,d=l[1]||0,f=l[2]||0,p=i.Size||0,m=i.Index||[0,p],h={},g=0;for(let e=0;e<m.length;e+=2){let t=m[e],n=m[e+1];for(let e=0;e<n;e++){let n=+(u===0);for(let e=0;e<u;e++)n=n<<8|(c[g++]||0);let i=0;for(let e=0;e<d;e++)i=i<<8|(c[g++]||0);let a=0;for(let e=0;e<f;e++)a=a<<8|(c[g++]||0);let o=t+e;n===0?h[o]={offset:i,gen:a,free:!0,compressed:!1}:n===1?h[o]={offset:i,gen:a,free:!1,compressed:!1}:n===2&&(h[o]={offset:i,gen:a,free:!1,compressed:!0})}}return{entries:h,trailerDict:i}}function KD(e){let t={},n=``;for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);let i=/(\d+)\s+0\s+obj/g,a;for(;(a=i.exec(n))!==null;){let e=parseInt(a[1]);t[e]={offset:a.index,gen:0,free:!1,compressed:!1}}return t}const qD=new TextDecoder(`latin1`);function JD(e){let t=Math.min(16,e.length),n=qD.decode(e.subarray(0,t)).split(/[\r\n]/)[0];return{kind:`header`,label:`Header`,subLabel:n,offset:0,size:n.length,badges:[n.replace(`%PDF-`,`v`)],meta:[{key:`offset`,value:`0x0`},{key:`version`,value:n.replace(`%PDF-`,``)}],rowsLabel:`Header`,rows:[{address:`0x0`,value:n}]}}function YD(e){return e==null?`null`:Array.isArray(e)?`[ ${e.slice(0,6).map(YD).join(` `)}${e.length>6?` …`:``} ]`:typeof e==`object`&&e.num!==void 0&&e.gen!==void 0?`${e.num} ${e.gen} R`:typeof e==`object`&&e.name!==void 0?`/${e.name}`:typeof e==`object`?`<< ${Object.keys(e).filter(e=>e.startsWith(`_`)===!1).slice(0,4).join(` `)} >>`:String(e)}function XD(e){return Object.keys(e).filter(e=>e.startsWith(`_`)===!1)}function ZD(e,t,n,i){let a=e[t],o=typeof a==`object`&&a&&Array.isArray(a)===!1&&a.name===void 0&&a.num===void 0?XD(a).slice(0,64).map(e=>ZD(a,e,n,i)):[];return{kind:`field`,label:`/${t}`,subLabel:YD(a),offset:n,size:i,rowsLabel:`Value`,rows:[{address:`/${t}`,value:YD(a)}],children:o}}function QD(e,t){let n=e.Filter?YD(e.Filter):`none`;return{kind:`data`,label:`Stream`,subLabel:`${n}, ${j(e._streamBytes.length)}`,offset:e._streamEnd-e._streamBytes.length,size:e._streamBytes.length,badges:[n.replace(`/`,``)],meta:[{key:`filter`,value:n},{key:`length`,value:j(e._streamBytes.length)},{key:`ends at`,value:M(e._streamEnd)},{key:`object`,value:M(t)}]}}function $D(e,t,n,i,a){let o=zD(n,t,e),s=typeof o==`object`&&!!o&&Array.isArray(o)===!1,c=s?XD(o):[],l=c.slice(0,64).map(e=>ZD(o,e,i.offset,a));s&&o._hasStream&&l.push(QD(o,i.offset));let u=s&&o.Type?YD(o.Type):``;return{kind:`entry`,label:`${n} ${i.gen} obj`,subLabel:u===``?YD(o):`${u}, ${N(c.length)} keys`,offset:i.offset,size:a,badges:u===``?[]:[u.replace(`/`,``)],meta:[{key:`object`,value:`${n} ${i.gen}`},{key:`offset`,value:M(i.offset)},{key:`size`,value:j(a)},{key:`type`,value:u===``?`no /Type`:u}],rowsLabel:`Dictionary`,rows:c.map(e=>({address:`/${e}`,value:YD(o[e])})),children:l}}function eO(e,t){let n=Object.keys(t).map(e=>({num:Number(e),entry:t[e]})).filter(e=>e.entry.free!==!0&&e.entry.compressed!==!0&&e.entry.offset>0).sort((e,t)=>e.entry.offset-t.entry.offset).slice(0,512);return n.map((i,a)=>{let o=n[a+1],s=o?o.entry.offset:e.length;return $D(e,t,i.num,i.entry,s-i.entry.offset)})}function tO(e,t){let n=qD.decode(e.subarray(t,Math.min(t+32,e.length))).trimStart().startsWith(`xref`);return{kind:`index`,label:n?`Cross reference table`:`Cross reference stream`,subLabel:`starts at ${M(t)}`,offset:t,size:Math.max(e.length-t,0),badges:[n?`table`:`stream`],meta:[{key:`offset`,value:M(t)},{key:`kind`,value:n?`xref table`:`xref stream`}]}}function nO(e,t,n){let i=e?XD(e):[];return{kind:`footer`,label:`Trailer`,subLabel:`${N(i.length)} keys, startxref and %%EOF`,offset:t,size:n,meta:i.slice(0,8).map(t=>({key:t,value:YD(e[t])})),rowsLabel:`Trailer dictionary`,rows:i.map(t=>({address:`/${t}`,value:YD(e[t])})),children:i.map(i=>ZD(e,i,t,n))}}function rO(e){let t=Math.max(e.length-1024,0),n=qD.decode(e.subarray(t)),i=n.lastIndexOf(`startxref`);if(i>=0){let e=n.slice(i+9).match(/\d+/);return{keyword:t+i,offset:e?Number(e[0]):-1}}return{keyword:-1,offset:-1}}function iO(e,t,n){let i=rO(e),a=[JD(e),...eO(e,t.entries)];return i.offset>=0&&a.push(tO(e,i.offset)),i.keyword>=0&&a.push(nO(t.trailerDict,i.keyword,e.length-i.keyword)),{format:`pdf`,size:n.byteLength,blocks:a}}async function aO(e){let t=await mD(e),{images:n,texts:i,majorityImage:a}=t,o;try{let t=new Uint8Array(e);o=iO(t,await UD(t),e)}catch(e){console.warn(`pdf structure failed`,e.message)}return{content:t,images:n,majorityImage:a,structure:o,icon:`pdf`}}function oO(e){let t=new TextDecoder(`utf-8`).decode(e);return{html:t,text:t,icon:`html`,icons:[`render`,`text`,`hex`]}}function sO(){let e=[0],t=[0];function n(n,i){let a=e[e.length-1],o=t[t.length-1];(n-a>=100||i-o>=1e6)&&(e.push(n),t.push(i))}function i(n){let i=0,a=e.length-1;for(;i<a;){let t=Math.ceil((i+a)/2);e[t]>n?a=t-1:i=t}return{line:e[i],offset:t[i]}}return{add:n,find:i,get count(){return e.length}}}const cO=8388608,lO=67108864;function uO(e){return e-e%16}function dO(e,t){let n=sO(),i=1,a=0,o=!0;async function s(n,i){let a=Math.max(0,Math.min(n,t));return await e(a,Math.max(a,Math.min(a+i,t)))}async function c(s){let c=0,l=0;for(;c<t;){let o=Math.min(c+cO,t),u=await e(c,o);for(let e=0;e<u.length;e++)u[e]===10&&(l+=1,n.add(l,c+e+1));c=o,i=l+1,a=c,s&&s({lineCount:i,scanned:a,size:t})}return o=!1,{lineCount:i,checkpoints:n.count}}async function l(i,a,o,s){let c=n.find(i),l=new TextDecoder(`utf-8`),u=c.offset,d=c.offset,f=c.line,p=``,m=!0;for(;m&&d<t&&d-u<o;){let n=Math.min(d+s,t),i=await e(d,n);d=n;let o=(p+l.decode(i,{stream:!0})).split(`
|
|
331
|
+
`);p=o.pop();for(let e of o)m&&(m=a(e,f),f+=1)}return m&&d>=t&&(a(p,f),f+=1),{line:f,ended:d>=t}}async function u(e,t){let n=[],i=e+t;return await l(e,function(t,a){return a>=e&&n.push(t),a+1<i},lO,262144),n}async function d(e,t,n){let i=[],a=[],o=t,s=await l(t,function(s,c){return o=c,c>=t&&e(s)&&(i.push(c),a.push(s)),i.length<n},lO,cO);return{hits:i,texts:a,nextFrom:o+1,done:s.ended&&i.length<n}}async function f(n,i,a){let o=[],s=[],c=Math.max(0,n.length-1),l=uO(Math.max(0,i)),u=l,d=l;for(;o.length<a&&l<t&&l-u<lO;){let i=Math.min(l+cO,t),u=await e(l,i),f=fO(u,n,0);for(;f>=0&&o.length<a;){o.push(l+f);let e=uO(f);s.push(u.subarray(e,e+16)),f=fO(u,n,f+1)}d=o.length<a?i:o[o.length-1]+1,l=i<t?uO(i-c):i}let f=new Uint8Array(s.length*16);for(let e=0;e<s.length;e++)f.set(s[e],e*16);return{offsets:o,blocks:f,nextFrom:d,done:l>=t&&o.length<a}}return{size:t,bytes:s,buildIndex:c,lines:u,scan:d,findBytes:f,lineCount(){return i},indexing(){return o},checkpointLines:100}}function fO(e,t,n){let i=t[0],a=e.length-t.length,o=-1;for(let s=n;s<=a&&o<0;s++)if(e[s]===i){let n=1;for(;n<t.length&&e[s+n]===t[n];)n+=1;n===t.length&&(o=s)}return o}console.log(`dom`);function pO(e){return e.replace(/^\$/,``)}function mO(e){return e.replace(/<\s*script\s*>.*<\/\s*script\s*>/g,``)}function hO(e){let t=typeof e==`string`?mO(e):e;return t!==e&&console.log(e,t),t}function gO(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}const _O=new Set([`contentEditable`,`markerWidth`,`markerHeight`,`markerUnits`,`refX`,`refY`,`srcDoc`,`viewBox`,`preserveAspectRatio`,`baseFrequency`,`numOctaves`,`xChannelSelector`,`yChannelSelector`]);function vO(e){return _O.has(e)?e:gO(e)}const yO=function(){let e={className:`class`,onClick:`onclick`};return t=>vO(e[t]||t)}();function bO(e,t){let n=hO(t);try{if(e instanceof SVGElement&&typeof t==`string`&&t.includes(`NaN`))return;e.innerHTML=n}catch(i){console.log(e,i,t,n)}}function xO(e,t,n){try{switch(t){case`value`:return e.value=n;case`checked`:return e.checked=hO(n);case`innerHTML`:return e.innerHTML=hO(n);default:wO(e,t,n)}}catch(i){console.log({error:i,$el:e,type:t,val:n})}}function SO(e,t,n){n=pO(n);try{n&&(t?e.classList.add(n):e.classList.remove(n))}catch{console.error({$el:e,name,clazz:n})}}function CO(e,t,n){let i=t.startsWith(`--`);t=pO(t);try{n===void 0||(i?e.style.setProperty(t,n):e.style[t]=n)}catch{console.error({$el:e,name:t,value:n})}}function wO(e,t,n){t=pO(t);try{let i=yO(t);if(i===`value`)e.value=n;else if(t===`src`&&n===void 0)console.log(`set src=undefined will just trigger an invalid fetch. so ignore here`);else{let t=hO(n);e.setAttribute(i,t)}}catch{console.error({$el:e,name:t,val:n})}}function TO(e,t,n,{capture:i=!1}={}){e.event_listeners=e.event_listeners||[];try{if(t===`touchclick`)e.addEventListener(`click`,n,i),e.addEventListener(`touchstart`,e=>{n(e)},i);else{let[a,o]=t.split(`:`);if(o&&o.length>0){function t(e){return o.includes(`stop`)&&e.stopPropagation(),o.includes(`prevent`)&&e.preventDefault(),n!==!0&&n(e)}e.addEventListener(a,t,i),e[`_remove_${a}`]=()=>(e.removeEventListener(a,t),t)}else e.addEventListener(t,n,i),e[`_remove_${a}`]=()=>(e.removeEventListener(a,n),n)}}catch{console.warn(e,t,n)}}new Map(Object.entries({__source:EO,_html:DO,_onmounted:AO,$text:OO,$dom:kO,$show:jO,$hide:MO,$display:NO,$height:PO,className:FO,class:FO,style:IO,editable:LO,editables:RO,model:zO}));function EO(e,t,n){let{fileName:i,lineNumber:a}=t;if(i&&a){let e=`${i.split(`/`).slice(-3).join(`/`)}:${a}`;n.setAttribute(`__source`,e)}}function DO(e,t,n){rk(t)?nk(()=>{let e=t.value;bO(n,e)}):bO(n,t)}function OO(e,t,n){rk(t)?nk(()=>{n.innerText=t.value}):n.innerText=t}function kO(e,t,n){if(rk(t))requestAnimationFrame(()=>{let e=null;return nk(()=>{let i=t.value,a=[...n.children][0];try{i?(i=i._clone?i.clone(!0):i,a?a.replaceWith(i):n.appendChild(i),e=i):e&&=(a&&a.remove(),null)}catch(e){console.error({error:e,dom:i,child:a,$el:n})}})});else if(t instanceof Element)requestAnimationFrame(()=>(t=t._clone?t.cloneNode(!0):t,n.appendChild(t)));else if(!Array.isArray(t)){if(typeof t==`string`)n.innerText=t;else return console.log(`it shall be either ref or an Element`)}}function AO(e,t,n){let i=t;return requestAnimationFrame(()=>requestAnimationFrame(()=>requestAnimationFrame(()=>i(n))))}function jO(e,t,n){return nk(()=>{CO(n,`visibility`,(rk(t)?t.value:t)===!0?`visible`:`unset`)})}function MO(e,t,n){return nk(()=>{CO(n,`visibility`,(rk(t)?t.value:t)?`hidden`:`unset`)})}function NO(e,t,n){return nk(()=>{let i=rk(t)?t.value:t;CO(n,e.slice(1),i)})}function PO(e,t,n){return nk(()=>{let i=rk(t)?t.value:t;CO(n,e.slice(1),i)})}function FO(e,t,n){if(rk(t))nk(()=>{typeof t.value==`string`?n.setAttribute(`class`,t.value):console.log(`not supported`,t.value)});else if(typeof t==`string`)n.setAttribute(`class`,t);else for(let e of Object.keys(t)){let i=t[e];rk(i)?nk(()=>{SO(n,i.value,e)}):typeof i==`boolean`?SO(n,i,e):typeof i==`string`?SO(n,!0,i):typeof i==`function`?nk(()=>{SO(n,i(),e)}):i===void 0?logger.debug({clazz:e,enabled:i}):logger.error({type:`not supported`,clazz:e,enabled:i})}}function IO(e,t,n){try{rk(t)?ik(t,(e,t)=>{if(e!==t){let t=typeof e;t===`object`?Object.entries(e).forEach(([e,t])=>{CO(n,e,rk(t)?t.value:t)}):t===`string`&&(n.style.cssText=e)}}):typeof t==`string`?n.style.cssText=t:Object.entries(t).forEach(([e,t])=>{rk(t)?ik(t,(i,a)=>{i!==a&&CO(n,e,t.value)}):CO(n,e,t)})}catch(e){console.log({error:e,val:t,$el:n})}}function LO(e,t,n){n.textContent=t.value||``,n.onkeydown=e=>{e.key===`Enter`&&(e.preventDefault(),t.value===n.textContent||(t.value=n.textContent),n.blur())},ik(t,(e,i)=>{t&&(t.value===n.textContent||(n.textContent=t.value))}),n.onclick=e=>{console.log(e),n.contentEditable===`true`||(n.contentEditable=`true`),e.stopPropagation()},n.onblur=e=>{console.log(e),n.contentEditable=!1,t.value===n.textContent||(t.value=n.textContent),n.blur()}}function RO(e,t,n){(t.value||``).split(`
|
|
332
|
+
`).forEach(e=>{let t=document.createElement(`div`);t.textContent=e,n.appendChild(t)}),n.onkeydown=e=>{e.key===`Enter`&&(t.value=[...n.childNodes].map(e=>e.textContent).join(`
|
|
333
|
+
`))},n.onclick=e=>{n.contentEditable=!0},n.onblur=e=>{n.contentEditable=!1,t.value=[...n.childNodes].map(e=>e.textContent).join(`
|
|
334
|
+
`)}}function zO(e,t,n){requestAnimationFrame(()=>{console.log(n,t),TO(n,`input`,e=>{n.type===`checkbox`?t.value=hO(e.target.checked):n.type===`radio`?n.checked&&(t.value=hO(n.value)):t.value=hO(e.target.value)})}),nk(()=>{let i=yO(e);try{let e=rk(t)?t.value:t;n.type===`checkbox`?xO(n,`checked`,e):n.type===`radio`?n.value===e&&(n.checked=!0):e!==void 0&&xO(n,`value`,e)}catch(e){logger.error({k:i,val:t,error:e})}})}globalThis.__nano_render_mode===void 0&&(globalThis.__nano_render_mode=`spa`),new Set(`x y x1 y1 x2 y2 cx cy`.split(` `));const BO=Object.freeze({None:0,Tracking:1,Recursed:2,InnerEffectsPending:4,ToCheckDirty:8,Dirty:16});let VO,HO,UO=0,WO=0;function GO(){return++WO}function KO(e,t){let n=t.depsTail,i=n===void 0?t.deps:n.nextDep;i!==void 0&&i.dep===e?t.depsTail=i:qO(e,t,i,n)}function qO(e,t,n,i){let a;if(VO===void 0?a={dep:e,sub:t,nextDep:n,prevSub:void 0,nextSub:void 0}:(a=VO,VO=a.nextDep,a.nextDep=n,a.dep=e,a.sub=t),i===void 0?t.deps=a:i.nextDep=a,e.subs===void 0)e.subs=a;else{let t=e.subsTail;a.prevSub=t,t.nextSub=a}t.depsTail=a,e.subsTail=a}function JO(e){do{let t=e.sub,n=t.flags;(n&(BO.ToCheckDirty|BO.Dirty))===BO.ToCheckDirty&&(t.flags=n|BO.Dirty),e=e.nextSub}while(e!==void 0)}function YO(e){let t=0,n,i;top:do{n=!1;let a=e.dep;if(`update`in a){let i=a.flags;if(i&BO.Dirty){if(a.update()){let e=a.subs;e.nextSub!==void 0&&JO(e),n=!0}}else if(i&BO.ToCheckDirty){let n=a.subs;n.nextSub!==void 0&&(n.prevSub=e),e=a.deps,++t;continue}}if(n||(i=e.nextDep)===void 0){if(t){let i=e.sub;do{--t;let a=i.subs,o=a.prevSub;if(o!==void 0){if(a.prevSub=void 0,n){if(i.update()){JO(i.subs),i=o.sub;continue}}else i.flags&=~BO.ToCheckDirty}else{if(n){if(i.update()){i=a.sub;continue}}else i.flags&=~BO.ToCheckDirty;o=a}if(e=o.nextDep,e!==void 0)continue top;i=o.sub,n=!1}while(t)}return n}e=i}while(1)}function XO(e){e.depsTail=void 0,e.flags=BO.Tracking}function ZO(e){let t=e.depsTail;if(t!==void 0){let e=t.nextDep;e!==void 0&&(QO(e),t.nextDep=void 0)}else e.deps!==void 0&&(QO(e.deps),e.deps=void 0);e.flags&=~BO.Tracking}function QO(e){do{let t=e.dep,n=e.nextDep,i=e.nextSub,a=e.prevSub;if(i===void 0?(t.subsTail=a,`lastTrackedId`in t&&(t.lastTrackedId=0)):(i.prevSub=a,e.nextSub=void 0),a===void 0?t.subs=i:(a.nextSub=i,e.prevSub=void 0),e.dep=void 0,e.sub=void 0,e.nextDep=VO,VO=e,t.subs===void 0&&`deps`in t){if(`notify`in t)t.flags=BO.None;else{let e=t.flags;e&BO.Dirty||(t.flags=e|BO.Dirty)}let i=t.deps;if(i!==void 0){e=i,t.depsTail.nextDep=n,t.deps=void 0,t.depsTail=void 0;continue}}e=n}while(e!==void 0)}function $O(e){let t=HO,n=UO;ek(void 0,0);try{return e()}catch(t){console.error(t,e)}finally{ek(t,n)}}function ek(e,t){HO=e,UO=t}function tk(e){let t=e;for(;t!==void 0&&t.dep!==void 0;){let e=t.dep;`notify`in e&&e.notify(),t=t.nextDep}}function nk(e){let t={fn:e,nextNotify:void 0,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:BO.Dirty,notify:n,run:i,stop:a};return UO&&KO(t,HO),t.run(),t;function n(){let e=t.flags;if(e&BO.Dirty){t.run();return}if(e&BO.ToCheckDirty){if(YO(t.deps)){t.run();return}t.flags&=~BO.ToCheckDirty}e&BO.InnerEffectsPending&&(t.flags&=~BO.InnerEffectsPending,tk(t.deps))}function i(){let e=HO,n=UO;ek(t,GO()),XO(t);try{return t.fn()}finally{ek(e,n),ZO(t)}}function a(){XO(t),ZO(t)}}function rk(e){return typeof e==`object`&&e.__type===`__ref`}function ik(e,t){let n;nk(()=>{try{let i=e.value;$O(()=>t(i,n)),n=i}catch(n){let i=n.stack.split(`
|
|
335
|
+
`).slice(0,2);console.warn(i.join(`
|
|
336
|
+
`)),console.log(e,t,n)}})}function ak(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ok(e,t){let n=String(t??``),i=[];e.lastIndex=0;let a=e.exec(n);for(;a;)a[0].length>0?i.push([a.index,a.index+a[0].length]):e.lastIndex+=1,a=e.exec(n);return i}function sk(e,t={}){let n=String(e||``);if(n){let e=t.regex?n:ak(n),i=t.wholeWord?`\\b${e}\\b`:e,a=t.caseSensitive?``:`i`;try{let e=new RegExp(i,a),t=new RegExp(i,`${a}g`);return{match:t=>e.test(String(t??``)),ranges:e=>ok(t,e),valid:!0}}catch{return{match:()=>!1,ranges:()=>[],valid:!1}}}return{match:()=>!0,ranges:()=>[],valid:!0}}const ck={};function lk(e){return`${e.url??``}|${e.name??``}`}function uk(e){return`/api${e.url}`.replace(`//`,`/`)}function dk(e){if(e.file)return async function(t,n){return new Uint8Array(await e.file.slice(t,n).arrayBuffer())};{let t=uk(e);return async function(e,n){let i=await fetch(t,{headers:{Range:`bytes=${e}-${n-1}`}});return new Uint8Array(await i.arrayBuffer())}}}async function fk(e){if(e.file)return e.file.size;if(e.size)return Number(e.size);{let t=await fetch(uk(e),{method:`HEAD`});return Number(t.headers.get(`content-length`)||0)}}function pk(e){return e.building||=e.raw.buildIndex(),e.building}async function mk(e){let t=lk(e);if(!ck[t]){let n=await fk(e);ck[t]={raw:dO(dk(e),n),building:null}}return ck[t]}function hk(e){return{size:e.raw.size,lineCount:e.raw.lineCount(),indexing:e.raw.indexing()}}async function gk(e){let t=await mk(e);if(e.type===`rawOpen`)return hk(t);if(e.type===`rawLines`){pk(t);let n=e.from<t.raw.lineCount()?await t.raw.lines(e.from,e.count):[];return{...hk(t),from:e.from,lines:n}}if(e.type===`rawBytes`){let n=await t.raw.bytes(e.start,e.length);return{...hk(t),start:e.start,bytes:n}}if(e.type===`rawScan`){pk(t);let n=sk(e.filter.text,e.filter),i=await t.raw.scan(n.match,e.from,e.want);return{...hk(t),...i}}{let n=await t.raw.findBytes(e.needle,e.from,e.want);return{...hk(t),...n}}}async function _k(){return Tt?(await import(`node:path`)).join:function(...e){return e.join(`/`)}}async function vk(e,t){let n=await _k();if(Tt){let i=await import(`node:fs/promises`);return async function*a([o,s]){let c=await i.readdir(s,{withFileTypes:!0});for(let i of c){let c=`${o}/${i.name}`,l=n(s,i.name);i.isDirectory()?i.name.startsWith(`.`)||e.has(i.name)||(yield*a([c,l])):t.has(i.name)||(yield[c,l])}}}return async function*n([i,a]){for await(let[o,s]of a.entries()){let a=`${i}/${o}`;s.kind===`directory`?o.startsWith(`.`)||e.has(o)||(yield*n([a,s])):t.has(o)||(yield[a,s])}}}const yk=await async function(){if(Tt){let e=await import(`node:fs/promises`);return async function(t){return(await e.readFile(t)).buffer}}return async function(e){return await(await e.getFile()).arrayBuffer()}}(),bk=await async function(){if(Tt){let e=await import(`node:fs/promises`);return async function(t){return e.readFile(t,`utf-8`)}}return async function(e){return(await e.getFile()).text()}}();function xk(e){return e.replace(/</g,`<`).replace(/>/g,`>`).replace(/'/g,`'`).replace(/"/g,`"`).replace(/&/g,`&`)}function Sk(e){let t={},n=/([\w-]+(?::[\w-]+)?)\s*=\s*["']([^"']*)["']/g,i;for(;(i=n.exec(e))!==null;)t[i[1]]=i[2];return t}function Ck(e,t){let n=e.indexOf(`<`,t);if(n===-1)return null;if(e[n+1]===`/`){let t=e.indexOf(`>`,n);return{type:`close`,name:e.slice(n+2,t),pos:t+1}}let i=e.indexOf(`>`,n),a=e.slice(n+1,i),o=a.endsWith(`/`),s=a.search(/\s/),c=s>0?a.slice(0,s):o?a.slice(0,-1):a,l=s>0?o?a.slice(s+1,-1):a.slice(s+1):``,u=l?Sk(l):{};return{type:o?`self-closing`:`open`,name:c,attributes:u,pos:i+1}}function wk(e,t){let n=Ck(e,t);if(n){if(n.type===`self-closing`)return{element:{name:n.name,attributes:n.attributes,children:[],text:``},pos:n.pos};let t={name:n.name,attributes:n.attributes,children:[],text:``},i=n.pos,a=i;for(;i<e.length;){let n=e.indexOf(`<`,i);if(n===-1)break;if(n>a){let i=e.slice(a,n);i.trim()&&(t.text+=xk(i))}if(e[n+1]===`/`){let o=Ck(e,n);if(o.name===t.name)return{element:t,pos:o.pos};i=o.pos,a=i;continue}let o=wk(e,n);if(o)t.children.push(o.element),i=o.pos,a=i;else break}return{element:t,pos:i}}return null}function Tk(e){let t=e.replace(/<\?xml[^?]*\?>/g,``);t=t.replace(/<!--[\s\S]*?-->/g,``),t=t.replace(/<!DOCTYPE[^>[]*(\[[\s\S]*?\])?[^>]*>/gi,``);let n=wk(t,0);return n?n.element:null}function Ek(e,t){let n=[];function i(e){e.name===t&&n.push(e);for(let t of e.children)i(t)}return i(e),n}function Dk(e){let t=e.text||``;for(let n of e.children)t+=Dk(n);return t}function J(e,t){if(e?.children)return e.children.find(e=>e.name===t)}function Y(e,t){if(e){let n=e;for(let e of t)if(n=typeof e==`number`?n.children[e]:J(n,e),!n)return;return n}}function Ok(e,t){if(e){let n=e,i=t.pop();for(let e of t)if(n=J(n,e),!n)return;return n.children.filter(e=>e.name===i)}}function kk(e,t,n,i){let a=jk(e,t,n,i);return a&&parseFloat(a)}function Ak(e,t,n,i){let a=jk(e,t,n,i);return a&&+a}function jk(e,t,n,i){let a=Y(e,t);return a&&(a.attributes?.[n]??i)}function Mk(e,t,n){let i=Y(e,t)?.attributes;if(i)for(let e of n){let t=i[e];if(t!==void 0)return t}}function Nk(e){return e.replace(/[<>&'"]/g,e=>{switch(e){case`<`:return`<`;case`>`:return`>`;case`&`:return`&`;case`'`:return`'`;case`"`:return`"`;default:return e}})}const Pk=typeof process<`u`&&process.versions&&process.versions.node;let Fk,Ik;Pk&&(Fk=(await import(`zlib`)).inflateRawSync,Ik=(await import(`node:fs/promises`)).default);function Lk(e,t,n){let i=0;for(let a=0;a<n;a++)i|=e[t+a]<<a*8;return i}function Rk(e,t){if(Lk(e,t,4)!==67324752)return null;let n=Lk(e,t+8,2),i=Lk(e,t+18,4),a=Lk(e,t+22,4),o=Lk(e,t+26,2),s=Lk(e,t+28,2);return{filename:new TextDecoder().decode(e.slice(t+30,t+30+o)),compressionMethod:n,compressedSize:i,uncompressedSize:a,dataOffset:t+30+o+s}}async function zk(e,t,n){let i=e.slice(t,t+n);if(Pk)return Fk(i);{let e=new DecompressionStream(`deflate-raw`),t=await new Response(new Blob([i]).stream().pipeThrough(e)).arrayBuffer();return new Uint8Array(t)}}function Bk(e){return e.match(/\.(jpeg|jpg|png|gif|bmp|svg|webp|avif)/i)?.[1]?.toLowerCase()}function Vk(e){if(Pk)return Buffer.from(e).toString(`base64`);{let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}}async function Hk(e){let t;if(typeof e==`string`)t=await Ik.readFile(e);else if(e instanceof Uint8Array)t=e;else if(e instanceof ArrayBuffer)t=new Uint8Array(e);else throw Error(`Input must be a file path (Node.js) or Uint8Array/ArrayBuffer (browser)`);let n={},i={},a={},o={},s=0;for(;s<t.length-30;){let e=Rk(t,s);if(!e)break;let{filename:o,compressionMethod:c,compressedSize:l,dataOffset:u}=e;if(!o.endsWith(`/`)){let e=o.endsWith(`.xml`)||o.endsWith(`.rels`),s=o.endsWith(`.iwa`),d=Bk(o);if(e||d||s)try{let f;if(c===0?f=t.slice(u,u+l):c===8?f=await zk(t,u,l):console.warn(`Skipping ${o}: unknown compression method ${c}`),f){if(e)i[o]=new TextDecoder().decode(f);else if(s)a[o]=new Uint8Array(f);else{let e=Vk(f);n[o]=`data:image/${{jpg:`jpeg`,svg:`svg+xml`}[d]??d};base64,${e}`}}}catch(e){console.warn(`Error extracting ${o}:`,e.message)}}s=u+l}function c(e){return!o[e]&&i[e]&&(o[e]=Tk(i[e])),o[e]}function l(e){let t=new RegExp(e),n={};for(let e of Object.keys(i))t.test(e)&&(n[e]=c(e));return n}function u(e){return n[e]}return{medias:n,binaries:a,getDom:c,getDoms:l,getMedia:u}}function Uk(e){return async function(t){let n=await e(t);if(!n)return null;let i=Bk(t);if(!i)return null;let a=Vk(n);return`data:image/${{jpg:`jpeg`,svg:`svg+xml`}[i]??i};base64,${a}`}}function Wk(e,t){return e[t]|e[t+1]<<8}function Gk(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Kk(e,t){if(t+8<=e.length){let n=new DataView(e.buffer,e.byteOffset+t,8);return Number(n.getBigUint64(0,!0))}return 0}function qk(e,t,n){let i=[],a=Math.min(t+n,e.length),o=t;for(;o+4<=a;){let t=Wk(e,o),n=Wk(e,o+2);i.push({id:t,offset:o,size:n+4}),o+=4+n}return i}function Jk(e,t,n){let i=qk(e,t.extraOffset,t.extraLength).find(e=>e.id===1);if(i){let a=i.offset+i.size,o=i.offset+4;t.size===4294967295&&o+8<=a&&(t.size=Kk(e,o),o+=8),t.compressedSize===4294967295&&o+8<=a&&(t.compressedSize=Kk(e,o),o+=8),t.localHeaderOffset===4294967295&&o+8<=a&&(t.localHeaderOffset=Kk(e,o),o+=8),n===65535&&o+4<=a&&(o+=4),t.zip64=!0}return t}function Yk(e,t){let n=Wk(e,t+20),i=new TextDecoder().decode(e.subarray(t+22,t+22+n)),a={eocdOffset:t,eocdSize:22+n,eocd64Offset:0,eocd64Size:0,locatorOffset:0,cdOffset:Gk(e,t+16),cdSize:Gk(e,t+12),totalEntries:Wk(e,t+10),zip64:!1,comment:i},o=t-20;if(o>=0&&Gk(e,o)===117853008){let t=Kk(e,o+8);t+56<=e.length&&Gk(e,t)===101075792&&(a.zip64=!0,a.locatorOffset=o,a.eocd64Offset=t,a.eocd64Size=12+Kk(e,t+4),a.totalEntries=Kk(e,t+32),a.cdSize=Kk(e,t+40),a.cdOffset=Kk(e,t+48))}return a}function Xk(e,t,n){let i=t+4<=e.length&&Gk(e,t)===134695760;return{offset:t,size:(i?4:0)+4+(n?8:4)*2,hasSignature:i}}function Zk(e,t){let n=Rk(e,t.localHeaderOffset),i=n?n.dataOffset:t.localHeaderOffset+30,a=t.flags&8?Xk(e,i+t.compressedSize,t.zip64===!0):{offset:0,size:0,hasSignature:!1};return{name:t.name,cdOffset:t.cdOffset,cdSize:t.cdSize,localHeaderOffset:t.localHeaderOffset,localHeaderSize:i-t.localHeaderOffset,dataOffset:i,dataSize:t.compressedSize,descriptorOffset:a.offset,descriptorSize:a.size,descriptorSigned:a.hasSignature,compMethod:t.compMethod,crc32:t.crc32,compressedSize:t.compressedSize,uncompressedSize:t.size,flags:t.flags,lastModified:t.lastModified,zip64:t.zip64===!0,extraFields:qk(e,t.extraOffset,t.extraLength)}}function Qk(e,t,n){return{eocdOffset:t.eocdOffset,eocdSize:t.eocdSize,eocd64Offset:t.eocd64Offset,eocd64Size:t.eocd64Size,locatorOffset:t.locatorOffset,cdOffset:t.cdOffset,cdSize:t.cdSize,totalEntries:t.totalEntries,zip64:t.zip64,comment:t.comment,entries:n.map(t=>Zk(e,t))}}const $k=[253,55,122,88,90,0];function eA(e,t){return e[0]===$k[0]&&e[1]===$k[1]&&e[2]===$k[2]&&e[3]===$k[3]?tA(e,t):oA(e,t)}function tA(e,t){let n=new Uint8Array(t),i=0,a=6,o=e[a]<<8|e[a+1];for(a+=2,a+=4;a<e.length;){let s=e[a];if(s===0)break;let c=(s+1)*4,l=a;a++;let u=e[a++],d=(u&3)+1,f=!!(u&64),p=!!(u&128),m=0;if(f){let t=gA(e,a);m=t.value,a=t.pos}if(p){let t=gA(e,a);t.value,a=t.pos}let h=0;for(let t=0;t<d;t++){let t=gA(e,a),n=t.value;a=t.pos;let i=gA(e,a),o=i.value;if(a=i.pos,n===33){if(o>0){let t=e[a];if(t>40)throw Error(`invalid LZMA2 dict size byte: `+t);h=t===40?4294967295:(2|t&1)<<(t>>1)+11}a+=o}else a+=o}if(a=l+c,f){let o=nA(e,a,m,h,t-i);n.set(o,i),i+=o.length,a+=m}else{let o=nA(e,a,e.length-a,h,t-i);n.set(o,i),i+=o.length,a+=o._consumedInput||e.length-a}for(;a%4!=0;)a++;let g=o&15;a+=[0,4,4,4,8,8,8,16,16,16,32,32,32,32,32,32][g]||0}return n.subarray(0,i)}function nA(e,t,n,i,a){let o=new Uint8Array(a),s=0,c=t,l=t+n;i===0&&(i=4096);let u=new Uint8Array(i),d=0,f=null;for(;c<l&&s<a;){let t=e[c++];if(t===0)break;if(t===1){let t=(e[c]<<8|e[c+1])+1;c+=2;for(let n=0;n<t&&s<a;n++){let t=e[c++];o[s++]=t,u[d]=t,d=(d+1)%i}f=null}else if(t===2){let t=(e[c]<<8|e[c+1])+1;c+=2;for(let n=0;n<t&&s<a;n++){let t=e[c++];o[s++]=t,u[d]=t,d=(d+1)%i}}else if(t>=128){t&32,t&64,t&64&&t&32;let n=(t&31)<<16|e[c]<<8|e[c+1];c+=2;let a=n+1,l=(e[c]<<8|e[c+1])+1;c+=2;let p=t>=192,m=t>=160,h=t>=224,g,_,v;if(p){let t=e[c++];g=t%9;let n=(t-g)/9;_=n%5,v=(n-_)/5,f=rA(g,_,v)}else(m||f===null)&&(f===null?(g=3,_=0,v=2,f=rA(g,_,v)):iA(f));h&&(u.fill(0),d=0);let y=c,b=aA(e,c,l,a,f,u,d,i,s);o.set(b.data,s),s+=b.data.length,d=b.dictPos,c=y+l}else break}let p=o.subarray(0,s);return p._consumedInput=c-t,p}function rA(e,t,n){let i=1<<n,a=1<<e+t;return{lc:e,lp:t,pb:n,state:0,rep0:0,rep1:0,rep2:0,rep3:0,isMatch:hA(12*i),isRep:hA(12),isRepG0:hA(12),isRepG1:hA(12),isRepG2:hA(12),isRep0Long:hA(12*i),litProbs:hA(a*768),posSlotDec:[hA(64),hA(64),hA(64),hA(64)],alignProbs:hA(16),posProbs:hA(124),lenDec:{choice:hA(1),choice2:hA(1),low:hA(i*8),mid:hA(i*8),high:hA(256)},repLenDec:{choice:hA(1),choice2:hA(1),low:hA(i*8),mid:hA(i*8),high:hA(256)}}}function iA(e){e.state=0,e.rep0=0,e.rep1=0,e.rep2=0,e.rep3=0,e.isMatch.fill(1024),e.isRep.fill(1024),e.isRepG0.fill(1024),e.isRepG1.fill(1024),e.isRepG2.fill(1024),e.isRep0Long.fill(1024),e.litProbs.fill(1024);for(let t=0;t<4;t++)e.posSlotDec[t].fill(1024);e.alignProbs.fill(1024),e.posProbs.fill(1024),e.lenDec.choice.fill(1024),e.lenDec.choice2.fill(1024),e.lenDec.low.fill(1024),e.lenDec.mid.fill(1024),e.lenDec.high.fill(1024),e.repLenDec.choice.fill(1024),e.repLenDec.choice2.fill(1024),e.repLenDec.low.fill(1024),e.repLenDec.mid.fill(1024),e.repLenDec.high.fill(1024)}function aA(e,t,n,i,a,o,s,c,l){let u=_A(e,t),d=new Uint8Array(i),f=0,p=1<<a.pb;for(;f<i;){let e=l+f&p-1;if(u.decodeBit(a.isMatch,a.state*p+e)===0){let e=f>0?d[f-1]:s>0?o[s-1]:0,t=((l+f&(1<<a.lp)-1)<<a.lc|e>>8-a.lc)*768,n;if(a.state>=7){let e=s-a.rep0-1;e<0&&(e+=c);let i=o[e];n=uA(u,a.litProbs,t,i)}else n=lA(u,a.litProbs,t);d[f++]=n,o[s]=n,s=(s+1)%c,a.state=dA(a.state)}else{let t;if(u.decodeBit(a.isRep,a.state)===0){t=cA(u,a.lenDec,e,p);let n=sA(u,t,a);a.rep3=a.rep2,a.rep2=a.rep1,a.rep1=a.rep0,a.rep0=n,a.state=fA(a.state)}else{if(u.decodeBit(a.isRepG0,a.state)===0){if(u.decodeBit(a.isRep0Long,a.state*p+e)===0){let e=s-a.rep0-1;e<0&&(e+=c);let t=o[e];d[f++]=t,o[s]=t,s=(s+1)%c,a.state=mA(a.state);continue}t=cA(u,a.repLenDec,e,p)}else if(u.decodeBit(a.isRepG1,a.state)===0){let n=a.rep1;a.rep1=a.rep0,a.rep0=n,t=cA(u,a.repLenDec,e,p)}else if(u.decodeBit(a.isRepG2,a.state)===0){let n=a.rep2;a.rep2=a.rep1,a.rep1=a.rep0,a.rep0=n,t=cA(u,a.repLenDec,e,p)}else{let n=a.rep3;a.rep3=a.rep2,a.rep2=a.rep1,a.rep1=a.rep0,a.rep0=n,t=cA(u,a.repLenDec,e,p)}a.state=pA(a.state)}let n=t+2;for(let e=0;e<n&&f<i;e++){let e=s-a.rep0-1;e<0&&(e+=c);let t=o[e];d[f++]=t,o[s]=t,s=(s+1)%c}}}return{data:d,dictPos:s,inputPos:u.getPos()}}function oA(e,t){let n=e[0],i=n%9,a=(n-i)/9,o=a%5,s=(a-o)/5,c=Math.max(4096,e[1]|e[2]<<8|e[3]<<16|e[4]<<24>>>0);t===void 0&&(t=(e[5]|e[6]<<8|e[7]<<16|e[8]<<24>>>0)+(e[9]|e[10]<<8|e[11]<<16|e[12]<<24>>>0)*4294967296);let l=rA(i,o,s),u=new Uint8Array(c);return aA(e,13,e.length-13,t,l,u,0,c,0).data}function sA(e,t,n){let i=Math.min(t,3),a=e.decodeBitTree(n.posSlotDec[i],6);if(a<4)return a;let o=(a>>1)-1,s=(2|a&1)<<o;return a<14?s+=e.decodeReverseBitTree(n.posProbs,o,s-a):(s+=e.decodeDirect(o-4)<<4,s+=e.decodeReverseBitTree(n.alignProbs,4,0)),s}function cA(e,t,n){return e.decodeBit(t.choice,0)===0?e.decodeBitTree(t.low,3,n*8):e.decodeBit(t.choice2,0)===0?8+e.decodeBitTree(t.mid,3,n*8):16+e.decodeBitTree(t.high,8)}function lA(e,t,n){let i=1;for(;i<256;)i=i<<1|e.decodeBit(t,n+i);return i&255}function uA(e,t,n,i){let a=1,o=i,s=!0;for(;a<256;)if(s){o<<=1;let i=o>>8&1,c=e.decodeBit(t,n+(1+i<<8)+a);a=a<<1|c,i!==c&&(s=!1)}else a=a<<1|e.decodeBit(t,n+a);return a&255}function dA(e){return e<4?0:e<10?e-3:e-6}function fA(e){return e<7?7:10}function pA(e){return e<7?8:11}function mA(e){return e<7?9:11}function hA(e){let t=new Uint16Array(e);return t.fill(1024),t}function gA(e,t){let n=0,i=0;for(;;){let a=e[t++];if(n|=(a&127)<<i,!(a&128))break;i+=7}return{value:n,pos:t}}function _A(e,t){let n=t,i=4294967295,a=0;n++;for(let t=0;t<4;t++)a=(a<<8|e[n++])>>>0;function o(){i<16777216&&(i=i<<8>>>0,a=(a<<8|(e[n++]||0))>>>0)}function s(e,t){let n=e[t],s=(i>>>11)*n>>>0;return a<s?(i=s,e[t]=n+(2048-n>>5),o(),0):(i=i-s>>>0,a=a-s>>>0,e[t]=n-(n>>5),o(),1)}function c(e){let t=0;for(let n=0;n<e;n++)i=i>>>1>>>0,a=a-i>>>0,a&2147483648?(a=a+i>>>0,t<<=1):t=t<<1|1,o();return t}function l(e,t,n){n===void 0&&(n=0);let i=1;for(let a=0;a<t;a++)i=i<<1|s(e,n+i);return i-(1<<t)}function u(e,t,n){let i=0,a=1;for(let o=0;o<t;o++){let t=s(e,n+a);a=a<<1|t,i|=t<<o}return i}function d(){return n}return{decodeBit:s,decodeDirect:c,decodeBitTree:l,decodeReverseBitTree:u,getPos:d}}let vA;Tt&&(vA=(await import(`node:zlib`)).inflateRawSync);async function yA(e){if(Tt)return vA(e);{let t=new DecompressionStream(`deflate-raw`),n=new Response(new Blob([e]).stream().pipeThrough(t));return new Uint8Array(await n.arrayBuffer())}}function bA(e,t){return e[t]|e[t+1]<<8}function xA(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function SA(e,t){let n=(e>>9&127)+1980,i=(e>>5&15)-1,a=e&31,o=t>>11&31,s=t>>5&63,c=(t&31)*2;return new Date(n,i,a,o,s,c)}function CA(e){for(let t=e.length-22;t>=0;t--)if(e[t]===80&&e[t+1]===75&&e[t+2]===5&&e[t+3]===6)return t;return-1}async function wA(e,t,n){if(t===0)return e;if(t===8)return await yA(e);if(t===12)return kt(e);if(t===14)return eA(e,n);if(t===93)return ve(e);throw Error(`unsupported compression method: `+t)}async function TA(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(await yk(e))}async function EA(e){let t=await TA(e),n=CA(t);if(n<0)throw Error(`no EOCD found, not a ZIP file`);let i=Yk(t,n),a=i.totalEntries,o=i.cdOffset,s=[],c={},l=o;for(let e=0;e<a&&xA(t,l)===33639248;e++){let e=bA(t,l+8),n=bA(t,l+10),i=bA(t,l+12),a=bA(t,l+14),o=xA(t,l+16),u=xA(t,l+20),d=xA(t,l+24),f=bA(t,l+28),p=bA(t,l+30),m=bA(t,l+32),h=bA(t,l+34),g=xA(t,l+42),_=new TextDecoder().decode(t.subarray(l+46,l+46+f)),v={name:_,size:d,compressedSize:u,compMethod:n,crc32:o,flags:e,lastModified:SA(a,i),localHeaderOffset:g,cdOffset:l,cdSize:46+f+p+m,extraOffset:l+46+f,extraLength:p};(u===4294967295||d===4294967295||g===4294967295||h===65535)&&Jk(t,v,h),c[_]=s.length,s.push(v),l+=46+f+p+m}return{getEntries:d,getEntry:f,getLayout:u};function u(){return Qk(t,i,s)}function d(){return s.map(function(e){return{name:e.name,size:e.size,compressedSize:e.compressedSize,compMethod:e.compMethod,lastModified:e.lastModified}})}async function f(e){let n=c[e];if(n==null)throw Error(`file not found: `+e);let i=s[n],a=i.localHeaderOffset;if(xA(t,a)!==67324752)throw Error(`invalid local file header for: `+e);let o=bA(t,a+26),l=bA(t,a+28),u=a+30+o+l;return await wA(t.subarray(u,u+i.compressedSize),i.compMethod,i.size)}}const DA={0:`stored`,1:`shrunk`,6:`imploded`,8:`deflate`,9:`deflate64`,12:`bzip2`,14:`lzma`,93:`zstd`,95:`xz`,96:`jpeg`,98:`ppmd`},OA={1:`zip64 extended information`,10:`ntfs timestamps`,21589:`extended timestamp`,28789:`unicode path`,30837:`unix uid/gid`,39169:`aes encryption`};function kA(e){return DA[e]??`method ${e}`}function AA(e){return e.uncompressedSize>0?`${Math.round(100*e.compressedSize/e.uncompressedSize)}%`:`—`}function jA(e){return{kind:`header`,label:`Local header`,subLabel:`${j(e.localHeaderSize)}, name + extra fields`,offset:e.localHeaderOffset,size:e.localHeaderSize,meta:[{key:`offset`,value:M(e.localHeaderOffset)},{key:`size`,value:j(e.localHeaderSize)},{key:`name`,value:e.name}],rowsLabel:`Fields`,rows:[{address:M(e.localHeaderOffset),value:`50 4b 03 04 local file header signature`},{address:M(e.localHeaderOffset+8),value:`compression method ${e.compMethod} — ${kA(e.compMethod)}`},{address:M(e.localHeaderOffset+30),value:`file name, ${e.name.length} bytes`}]}}function MA(e){return{kind:`data`,label:`Compressed data`,subLabel:`${kA(e.compMethod)}, ${j(e.compressedSize)}`,offset:e.dataOffset,size:e.dataSize,badges:[kA(e.compMethod)],meta:[{key:`offset`,value:M(e.dataOffset)},{key:`compressed`,value:j(e.compressedSize)},{key:`uncompressed`,value:j(e.uncompressedSize)},{key:`ratio`,value:AA(e)}]}}function NA(e){return{kind:`footer`,label:`Data descriptor`,subLabel:`${j(e.descriptorSize)}, crc and sizes written after the data`,offset:e.descriptorOffset,size:e.descriptorSize,badges:[e.descriptorSigned?`signed`:`unsigned`],meta:[{key:`offset`,value:M(e.descriptorOffset)},{key:`size`,value:j(e.descriptorSize)},{key:`signature`,value:e.descriptorSigned?`0x08074b50`:`omitted`},{key:`crc32`,value:`0x${e.crc32.toString(16).padStart(8,`0`)}`}]}}function PA(e){return e.extraFields.map(e=>({kind:`field`,label:`0x${e.id.toString(16).padStart(4,`0`)}`,subLabel:`${OA[e.id]??`extra field`}, ${j(e.size)}`,offset:e.offset,size:e.size}))}function FA(e){let t=[jA(e),MA(e)];e.descriptorSize>0&&t.push(NA(e));let n=e.descriptorSize>0?e.descriptorOffset+e.descriptorSize:e.dataOffset+e.dataSize,i=[kA(e.compMethod)];return e.zip64&&i.push(`zip64`),{kind:`entry`,label:e.name,subLabel:`${j(e.uncompressedSize)} → ${j(e.compressedSize)} (${AA(e)})`,offset:e.localHeaderOffset,size:n-e.localHeaderOffset,badges:i,meta:[{key:`name`,value:e.name},{key:`method`,value:kA(e.compMethod)},{key:`uncompressed`,value:j(e.uncompressedSize)},{key:`compressed`,value:j(e.compressedSize)},{key:`crc32`,value:`0x${e.crc32.toString(16).padStart(8,`0`)}`},{key:`modified`,value:e.lastModified.toISOString().slice(0,19).replace(`T`,` `)}],rowsLabel:`Layout`,rows:t.map(e=>({address:M(e.offset),value:`${e.label}, ${j(e.size)}`})),children:t}}function IA(e){return{kind:`field`,label:e.name,subLabel:`${j(e.cdSize)} record → local header ${M(e.localHeaderOffset)}`,offset:e.cdOffset,size:e.cdSize,badges:[kA(e.compMethod)],meta:[{key:`name`,value:e.name},{key:`record`,value:`${M(e.cdOffset)}, ${j(e.cdSize)}`},{key:`points at`,value:M(e.localHeaderOffset)},{key:`extra fields`,value:String(e.extraFields.length)}],rowsLabel:`Record`,rows:[{address:M(e.cdOffset),value:`50 4b 01 02 central directory signature`},{address:M(e.cdOffset+42),value:`local header offset ${M(e.localHeaderOffset)}`},{address:M(e.cdOffset+46),value:`file name, ${e.name.length} bytes`}],children:PA(e)}}function LA(e){return{kind:`index`,label:`Central directory`,subLabel:`${N(e.entries.length)} records, ${j(e.cdSize)}`,offset:e.cdOffset,size:e.cdSize,meta:[{key:`offset`,value:M(e.cdOffset)},{key:`size`,value:j(e.cdSize)},{key:`entries`,value:N(e.totalEntries)}],rowsLabel:`Records`,rows:e.entries.map(e=>({address:M(e.cdOffset),value:`${e.name}, ${j(e.cdSize)}`})),children:e.entries.map(IA)}}function RA(e){return e.zip64?[{kind:`footer`,label:`Zip64 EOCD`,subLabel:`${j(e.eocd64Size)}, 64 bit counts and offsets`,offset:e.eocd64Offset,size:e.eocd64Size,badges:[`zip64`],meta:[{key:`offset`,value:M(e.eocd64Offset)},{key:`size`,value:j(e.eocd64Size)},{key:`entries`,value:N(e.totalEntries)}]},{kind:`footer`,label:`Zip64 locator`,subLabel:`20 B, points at ${M(e.eocd64Offset)}`,offset:e.locatorOffset,size:20,badges:[`zip64`]}]:[]}function zA(e){return{kind:`footer`,label:`End of central directory`,subLabel:`${j(e.eocdSize)}, ${N(e.totalEntries)} entries`,offset:e.eocdOffset,size:e.eocdSize,meta:[{key:`offset`,value:M(e.eocdOffset)},{key:`size`,value:j(e.eocdSize)},{key:`entries`,value:N(e.totalEntries)},{key:`central directory`,value:`${M(e.cdOffset)}, ${j(e.cdSize)}`},{key:`comment`,value:e.comment===``?`(none)`:e.comment}],rowsLabel:`Fields`,rows:[{address:M(e.eocdOffset),value:`50 4b 05 06 end of central directory signature`},{address:M(e.eocdOffset+10),value:`${N(e.totalEntries)} entries`},{address:M(e.eocdOffset+16),value:`central directory at ${M(e.cdOffset)}`}]}}function BA(e,t){return{format:`zip`,size:t,blocks:[...e.entries.map(FA),LA(e),...RA(e),zA(e)]}}function VA(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}function HA(e,t){let n=e?e.split(`/`):[];for(let e of decodeURIComponent(t).split(`/`))e===`..`?n.pop():e!==`.`&&e!==``&&n.push(e);return n.join(`/`)}function UA(e){return e.slice(e.lastIndexOf(`/`)+1).replace(/\.[^.]*$/,``)}function WA(e){return e.match(/<body[^>]*>([\s\S]*)<\/body>/i)?.[1]??``}function GA(e){return e.replace(/<[^>]*>/g,` `).replace(/&[a-z#0-9]+;/gi,` `).trim()}function KA(e){return e.replace(/<script[\s\S]*?<\/script>/gi,``).replace(/<link\b[^>]*>/gi,``).replace(/<a\b[^>]*>/gi,e=>e.replace(/\shref=["'](?!https?:)[^"']*["']/i,` href="#"`))}async function qA(e,t,n){let i=e,a=[...e.matchAll(/<(?:img|image)[^>]+(?:src|xlink:href|href)=["']([^"']+)["']/gi)].map(e=>e[1]);for(let e of new Set(a))if(/^(https?:|data:)/i.test(e)===!1){let a=await n(HA(t,e));a&&(i=i.split(`"${e}"`).join(`"${a}"`).split(`'${e}'`).join(`'${a}'`))}return i}function JA(e){let t=null;return e[0]===255&&e[1]===216?t=`image/jpeg`:e[0]===137&&e[1]===80?t=`image/png`:e[0]===71&&e[1]===73?t=`image/gif`:e[8]===87&&e[9]===69&&e[10]===66?t=`image/webp`:e[0]===66&&e[1]===77&&(t=`image/bmp`),t}function YA(e){let t=JA(e);return t?URL.createObjectURL(new Blob([e],{type:t})):null}async function XA(e){let t=await EA(e),n=Uk(e=>QA(t,e)),i=Ek(await $A(t,`META-INF/container.xml`)??ZA,`rootfile`)[0]?.attributes[`full-path`];if(i){let a=VA(i),o=await $A(t,i),s=J(o,`metadata`),c=tj(o),l=nj(c,s),u=l?await n(HA(a,l.href)):null,d=await rj(t,o,c,a,n);return{title:ej(s,`title`)||`Untitled`,creator:ej(s,`creator`),publisher:ej(s,`publisher`),language:ej(s,`language`),date:ej(s,`date`),description:ej(s,`description`),coverUrl:u,chapters:d,icon:`book`,structure:BA(t.getLayout(),e.byteLength)}}return{error:`not an epub: META-INF/container.xml has no rootfile`}}const ZA={name:``,attributes:{},children:[]};async function QA(e,t){try{return await e.getEntry(t)}catch(e){return console.warn(`epub entry missing`,t,e.message),null}}async function $A(e,t){let n=await QA(e,t);return n?Tk(new TextDecoder().decode(n)):null}function ej(e,t){let n=e?.children?.find(e=>e.name===t||e.name.endsWith(`:`+t));return n?Dk(n).trim():``}function tj(e){let t=J(e,`manifest`);return t?Ek(t,`item`).map(e=>({id:e.attributes.id||``,href:e.attributes.href||``,mediaType:e.attributes[`media-type`]||``,properties:e.attributes.properties||``})):[]}function nj(e,t){let n=e.filter(e=>e.mediaType.startsWith(`image/`)),i=n.find(e=>e.properties.includes(`cover-image`));if(i)return i;{let e=t?.children?.find(e=>e.name===`meta`&&e.attributes?.name===`cover`);return n.find(t=>t.id===e?.attributes?.content)||n.find(e=>/cover/i.test(e.id)||/cover/i.test(e.href))}}async function rj(e,t,n,i,a){let o=J(t,`spine`),s=[];if(o){let t=await aj(e,n,i);for(let c of Ek(o,`itemref`)){let o=n.find(e=>e.id===c.attributes.idref),l=o?HA(i,o.href):``,u=await ij(e,l);if(GA(u).length>0){let e=await qA(KA(u),VA(l),a);s.push({title:t[l]||UA(l),path:l,html:e})}}}return s}async function ij(e,t){let n=await QA(e,t);return n?WA(new TextDecoder().decode(n)):``}async function aj(e,t,n){let i=t.find(e=>e.properties.includes(`nav`)),a=t.find(e=>e.mediaType===`application/x-dtbncx+xml`);return i?await oj(e,HA(n,i.href)):a?await sj(e,HA(n,a.href)):{}}async function oj(e,t){let n={},i=await $A(e,t),a=VA(t);for(let e of Ek(i??ZA,`a`)){let t=e.attributes.href;t&&(n[HA(a,t.split(`#`)[0])]=Dk(e).trim())}return n}async function sj(e,t){let n={},i=await $A(e,t),a=VA(t);for(let e of Ek(i??ZA,`navPoint`)){let t=J(e,`content`)?.attributes?.src,i=J(e,`navLabel`);t&&(n[HA(a,t.split(`#`)[0])]=Dk(i??ZA).trim())}return n}function cj(e,t,n){let i=``,a=Math.min(t+n,e.length);for(let n=t;n<a;n++)i+=String.fromCharCode(e[n]);return i}function lj(e,t){let n=[],i=`<${t}`,a=`</${t}>`,o=0;for(;o<e.length;){let t=e.indexOf(i,o);if(t<0)o=e.length;else{let i=e.indexOf(a,t),s=i<0?e.length:i+a.length;n.push({offset:t,size:s-t,head:e.slice(t,e.indexOf(`>`,t)+1)}),o=s}}return n}function uj(e,t){return e.match(RegExp(`${t}=["']([^"']*)["']`,`i`))?.[1]??``}function dj(e){let t=cj(e,0,200),n=t.indexOf(`?>`);if(n>0){let e=n+2;return{kind:`header`,label:`XML declaration`,subLabel:uj(t,`encoding`)||`utf-8`,offset:0,size:e,badges:[uj(t,`encoding`)||`utf-8`],meta:[{key:`version`,value:uj(t,`version`)||`1.0`},{key:`encoding`,value:uj(t,`encoding`)||`utf-8`}],rowsLabel:`Declaration`,rows:[{address:`0x0`,value:t.slice(0,e)}]}}return null}function fj(e){return{kind:`header`,label:`description`,subLabel:`book metadata`,offset:e.offset,size:e.size,badges:[`metadata`],meta:[{key:`size`,value:j(e.size)}],rowsLabel:`Fields`,rows:[{address:M(e.offset),value:`<description> … ${j(e.size)}`}]}}function pj(e,t){let n=uj(e.head,`name`);return{kind:`body`,label:n?`body "${n}"`:`body ${t+1}`,subLabel:n===`notes`?`footnotes`:`reading order`,offset:e.offset,size:e.size,badges:[j(e.size)],meta:[{key:`name`,value:n||`—`},{key:`size`,value:j(e.size)}],rowsLabel:`Fields`,rows:[{address:M(e.offset),value:e.head}]}}function mj(e){let t=uj(e.head,`id`),n=uj(e.head,`content-type`);return{kind:`entry`,label:t||`binary`,subLabel:n,offset:e.offset,size:e.size,badges:[n.replace(`image/`,``)],meta:[{key:`id`,value:t},{key:`content type`,value:n},{key:`base64 size`,value:j(e.size)},{key:`decoded size`,value:j(Math.floor(e.size*3/4))}],rowsLabel:`Fields`,rows:[{address:M(e.offset),value:e.head}]}}function hj(e){let t=e.reduce((e,t)=>e+t.size,0);return{kind:`data`,label:`binaries`,subLabel:`${N(e.length)} embedded images`,offset:e[0].offset,size:t,badges:[N(e.length)],meta:[{key:`images`,value:N(e.length)},{key:`total size`,value:j(t)}],children:e.map(mj)}}function gj(e){let t=new TextDecoder(`latin1`).decode(e),n=[],i=dj(e);i&&n.push(i);let[a]=lj(t,`description`);a&&n.push(fj(a)),lj(t,`body`).forEach((e,t)=>n.push(pj(e,t)));let o=lj(t,`binary`);return o.length>0&&n.push(hj(o)),{format:`fb2`,size:e.length,blocks:n}}const _j={section:`div`,title:`h2`,subtitle:`h3`,emphasis:`em`,strikethrough:`s`,strong:`strong`,code:`code`,cite:`blockquote`,epigraph:`blockquote`,poem:`blockquote`,stanza:`div`,v:`p`,"text-author":`p`,annotation:`div`,table:`table`,tr:`tr`,td:`td`,th:`th`,p:`p`,sub:`sub`,sup:`sup`,style:`span`},vj=new Set([`a`,`img`,`br`]);function yj(e){let t=[],n=0,i=0;for(let a of e.matchAll(/<section\b[^>]*>|<\/section\s*>/gi))a[0][1]===`/`?(--n,n===0&&t.push(e.slice(i,a.index+a[0].length))):(n===0&&(i=a.index),n+=1);return t.length===0&&t.push(e),t}function bj(e){return(e.match(/<title\b[^>]*>([\s\S]*?)<\/title>/i)?.[1]??``).replace(/<[^>]*>/g,` `).replace(/\s+/g,` `).trim()}function xj(e,t){let n=e;return n=n.replace(/<empty-line\s*\/?>/gi,`<br>`),n=n.replace(/<image\b([^>]*?)\/?>/gi,(e,n)=>Cj(n,t)),n=n.replace(/<\/image\s*>/gi,``),n=n.replace(/<a\b[^>]*>/gi,`<a href="#">`),n=n.replace(/<\/?([a-z][\w-]*)((?:\s[^>]*?)?)\/?>/gi,Sj),n}function Sj(e,t,n){let i=t.toLowerCase(),a=e[1]===`/`,o;return o=vj.has(i)?e:_j[i]?a?`</${_j[i]}>`:`<${_j[i]}>`:``,o}function Cj(e,t){let n=t[(e.match(/(?:l:href|xlink:href|href)=["']([^"']+)["']/i)?.[1]??``).replace(/^#/,``)];return n?`<img src="${n}">`:``}async function wj(e){let t=new Uint8Array(e),n=t[0]===80&&t[1]===75,i,a;if(n){let t=await EA(e),n=t.getEntries().find(e=>/\.fb2$/i.test(e.name))??t.getEntries()[0];a=n?await t.getEntry(n.name):null,i=BA(t.getLayout(),e.byteLength)}else a=t,i=gj(t);return a?Tj(a,i):{error:`not an fb2: the archive holds no document`}}function Tj(e,t){let n=Ej(e),i=Dj(n),a=J(Tk(Oj(n)),`title-info`);return a?{title:kj(a,`book-title`)||`Untitled`,creator:Aj(a),publisher:jj(n),language:kj(a,`lang`),date:kj(a,`date`),description:Mj(a),coverUrl:Nj(a,i),chapters:Fj(n,i),icon:`book`,structure:t}:{error:`not an fb2: the document has no <title-info>`}}function Ej(e){let t=new TextDecoder(`ascii`).decode(e.subarray(0,200)).match(/encoding=["']([\w-]+)["']/i)?.[1]??`utf-8`;try{return new TextDecoder(t).decode(e)}catch(n){return console.warn(`fb2 unknown encoding`,t,n.message),new TextDecoder(`utf-8`).decode(e)}}function Dj(e){let t={};for(let n of e.matchAll(/<binary\b([^>]*)>([\s\S]*?)<\/binary>/gi)){let e=n[1].match(/id=["']([^"']+)["']/i)?.[1],i=n[1].match(/content-type=["']([^"']+)["']/i)?.[1]??`image/jpeg`;e&&(t[e]=`data:${i};base64,${n[2].replace(/\s+/g,``)}`)}return t}function Oj(e){return e.match(/<description\b[\s\S]*?<\/description>/i)?.[0]??`<description/>`}function kj(e,t){let n=J(e,t);return n?Dk(n).trim():``}function Aj(e){return Ek(e,`author`).map(e=>[kj(e,`first-name`),kj(e,`middle-name`),kj(e,`last-name`),kj(e,`nickname`)].filter(e=>e).join(` `)).filter(e=>e).join(`, `)}function jj(e){return kj(Tk(e.match(/<publish-info\b[\s\S]*?<\/publish-info>/i)?.[0]??`<publish-info/>`),`publisher`)}function Mj(e){let t=J(e,`annotation`);return t?Dk(t).trim():``}function Nj(e,t){let n=J(e,`coverpage`),i=n?J(n,`image`):null;return t[(i?Pj(i.attributes):``).replace(/^#/,``)]??null}function Pj(e){return e[`l:href`]??e[`xlink:href`]??e.href??``}function Fj(e,t){let n=yj(e.match(/<body(?![^>]*\bname=)[^>]*>([\s\S]*?)<\/body>/i)?.[1]??e.match(/<body[^>]*>([\s\S]*?)<\/body>/i)?.[1]??``),i=[];for(let[e,a]of n.entries()){let n=KA(xj(a,t));GA(n).length>0&&i.push({title:bj(a)||`Chapter ${e+1}`,html:n})}return i}function Ij(e,t,n){let i=t+n;for(;i>t&&(e[i-1]===0||e[i-1]===32);)i--;if(i===t)return 0;let a=``;for(let n=t;n<i;n++)a+=String.fromCharCode(e[n]);return parseInt(a,8)||0}function Lj(e,t,n){let i=t,a=t+n;for(;i<a&&e[i]!==0;)i++;return new TextDecoder().decode(e.subarray(t,i))}function Rj(e,t){for(let n=0;n<512;n++)if(e[t+n]!==0)return!1;return!0}function zj(e,t,n){let i=new TextDecoder().decode(e.subarray(t,t+n)),a={},o=0;for(;o<i.length;){let e=i.indexOf(` `,o);if(e<0)break;let t=parseInt(i.substring(o,e),10);if(isNaN(t)||t<=0)break;let n=i.substring(e+1,o+t-1),s=n.indexOf(`=`);s>=0&&(a[n.substring(0,s)]=n.substring(s+1)),o+=t}return a}const Bj={0:`file`,"\0":`file`,"":`file`,5:`directory`,2:`symlink`,1:`hardlink`,3:`character-device`,4:`block-device`,6:`fifo`};function Vj(e){let t=e instanceof Uint8Array?e:new Uint8Array(e),n=[],i={},a=0,o=null,s=null,c=null;for(;a+512<=t.length;){if(Rj(t,a)){if(a+1024<=t.length&&Rj(t,a+512))break;a+=512;continue}let e=Lj(t,a,100),l=Ij(t,a+100,8),u=Ij(t,a+124,12),d=new Date(Ij(t,a+136,12)*1e3),f=String.fromCharCode(t[a+156]),p=Lj(t,a+157,100),m=Lj(t,a+257,6),h=e;if(m===`ustar`||m===`ustar\0`){let n=Lj(t,a+345,155);n&&(h=n+`/`+e)}let g=a+512,_=Math.ceil(u/512)*512;if(f===`L`){o=Lj(t,g,u),a=g+_;continue}if(f===`K`){s=Lj(t,g,u),a=g+_;continue}if(f===`x`||f===`X`){c=zj(t,g,u),a=g+_;continue}o&&=(h=o,null);let v=u;c&&=(c.path&&(h=c.path),c.size&&(v=parseInt(c.size,10)),c.linkpath&&s==null&&(s=c.linkpath),null);let y=s||p;s=null;let b=Bj[f]||`unknown`,x={name:h,size:v,mtime:d,mode:l,type:b,linkname:y,dataOffset:g};i[h]=n.length,n.push(x),a=g+_}return{getEntries:l,readEntry:u};function l(){return n.map(function(e){return{name:e.name,size:e.size,mtime:e.mtime,mode:e.mode,type:e.type,linkname:e.linkname}})}function u(e){let a=i[e];if(a==null)throw Error(`file not found: `+e);let o=n[a];return t.subarray(o.dataOffset,o.dataOffset+o.size)}}const Hj=/\.(jpe?g|png|gif|webp|bmp|avif)$/i;async function Uj(e){let t=new Uint8Array(e),n;return n=t[0]===80&&t[1]===75?await Wj(e):t[0]===82&&t[1]===97&&t[2]===114&&t[3]===33?{error:`this comic uses RAR compression, which is not supported`}:Gj(t),n}async function Wj(e){let t=await EA(e),n=t.getEntries().map(e=>e.name),i=await Jj(n,e=>t.getEntry(e)),a=[];for(let e of Kj(n))a.push({title:UA(e),image:YA(await t.getEntry(e))});return Zj(a,i,BA(t.getLayout(),e.byteLength))}function Gj(e){let t=Vj(e),n=t.getEntries().map(e=>e.name);return Zj(Kj(n).map(e=>({title:UA(e),image:YA(t.readEntry(e))})),Yj(qj(n)?Tk(new TextDecoder().decode(t.readEntry(qj(n)))):null),null)}function Kj(e){return e.filter(e=>Hj.test(e)).filter(e=>e.startsWith(`__MACOSX/`)===!1&&e.split(`/`).pop().startsWith(`.`)===!1).sort((e,t)=>e.localeCompare(t,void 0,{numeric:!0}))}function qj(e){return e.find(e=>/(^|\/)ComicInfo\.xml$/i.test(e))}async function Jj(e,t){let n=qj(e);return Yj(n?Tk(new TextDecoder().decode(await t(n))):null)}function Yj(e){return{series:Xj(e,`Series`),number:Xj(e,`Number`),title:Xj(e,`Title`),writer:Xj(e,`Writer`),publisher:Xj(e,`Publisher`),year:Xj(e,`Year`),summary:Xj(e,`Summary`),language:Xj(e,`LanguageISO`)}}function Xj(e,t){let n=J(e??{children:[]},t);return n?Dk(n).trim():``}function Zj(e,t,n){return e.length>0?{title:Qj(t)||`Untitled`,creator:t.writer,publisher:t.publisher,language:t.language,date:t.year,description:t.summary,coverUrl:e[0].image,chapters:e.slice(1),icon:`book-image`,structure:n}:{error:`this comic archive holds no page images`}}function Qj(e){return e.series&&e.number?`${e.series} #${e.number}`:e.series||e.title}const $j={100:`author`,101:`publisher`,103:`description`,104:`isbn`,105:`subject`,106:`date`,108:`contributor`,109:`rights`,112:`source`,113:`asin`,121:`kf8Boundary`,201:`coverOffset`,202:`thumbOffset`,503:`updatedTitle`,524:`language`,525:`direction`};function eM(e){let t=new DataView(e),n=new Uint8Array(e),i=t.getUint16(76),a=[];for(let e=0;e<i;e++)a.push(t.getUint32(78+e*8));a.push(e.byteLength);function o(e){return e>=0&&e<i?n.subarray(a[e],a[e+1]):new Uint8Array}return{count:i,offsets:a,record:o,name:new TextDecoder(`ascii`).decode(n.subarray(0,32)).replace(/\0.*$/,``),type:new TextDecoder(`ascii`).decode(n.subarray(60,64)),creator:new TextDecoder(`ascii`).decode(n.subarray(64,68)),listSize:78+i*8}}function tM(e,t){let n=e.record(t),i=new DataView(n.buffer,n.byteOffset,n.byteLength),a={compression:i.getUint16(0),textLength:i.getUint32(4),textRecordCount:i.getUint16(8),recordSize:i.getUint16(10),encryption:i.getUint16(12),firstRecord:t};return n.length>20&&nM(n,16,4)===`MOBI`?(a.headerLength=i.getUint32(20),a.mobiType=i.getUint32(24),a.encoding=i.getUint32(28),a.version=i.getUint32(36),a.firstNonBook=rM(i,80,a.headerLength,4),a.fullNameOffset=rM(i,84,a.headerLength,4),a.fullNameLength=rM(i,88,a.headerLength,4),a.firstImage=rM(i,108,a.headerLength,4),a.exthFlags=rM(i,128,a.headerLength,4),a.firstContent=rM(i,192,a.headerLength,2),a.lastContent=rM(i,194,a.headerLength,2),a.extraFlags=rM(i,242,a.headerLength,2),a.fullName=iM(n,a),a.exth=aM(n,16+a.headerLength,a.exthFlags),a.exthOffset=16+a.headerLength):(a.headerLength=0,a.exth={}),a}function nM(e,t,n){return new TextDecoder(`ascii`).decode(e.subarray(t,t+n))}function rM(e,t,n,i){return t+i<=16+n&&t+i<=e.byteLength?i===2?e.getUint16(t):e.getUint32(t):0}function iM(e,t){let n=t.fullNameOffset+t.fullNameLength;return t.fullNameLength>0&&n<=e.length?oM(e.subarray(t.fullNameOffset,n),t.encoding):``}function aM(e,t,n){let i={};if(n&64&&t+12<=e.length&&nM(e,t,4)===`EXTH`){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),a=n.getUint32(t+8),o=t+12;for(let t=0;t<a&&o+8<=e.length;t++){let t=n.getUint32(o),a=Math.max(n.getUint32(o+4),8),s=e.subarray(o+8,o+a),c=$j[t];c&&(t===121||t===201||t===202?i[c]=s.length>=4?new DataView(s.buffer,s.byteOffset,4).getUint32(0):0:i[c]===void 0&&(i[c]=new TextDecoder(`utf-8`).decode(s).trim())),o+=a}}return i}function oM(e,t){return new TextDecoder(t===1252?`windows-1252`:`utf-8`).decode(e)}function sM(e){let t=[],n=0;for(;n<e.length;){let i=e[n];if(n+=1,i===0)t.push(i);else if(i<=8)for(let a=0;a<i&&n<e.length;a++)t.push(e[n]),n+=1;else if(i<=127)t.push(i);else if(i<=191){let a=i<<8|e[n];n+=1;let o=a>>3&2047,s=(a&7)+3,c=t.length-o;for(let e=0;e<s;e++)t.push(t[c+e])}else t.push(32,i^128)}return Uint8Array.from(t)}function cM(e,t){let n=e.length;for(let i=1;i<16;i++)t&1<<i&&(n-=lM(e,n));return t&1&&(n-=(e[n-1]&3)+1),e.subarray(0,Math.max(n,0))}function lM(e,t){let n=0,i=0,a=t-1,o=!1;for(;o===!1&&a>=0;){let t=e[a];n|=(t&127)<<i,i+=7,--a,t&128&&(o=!0)}return n}const uM={1:`none`,2:`palmdoc`,17480:`huff/cdic`};function dM(e){return uM[e]??`method ${e}`}function fM(e,t){return e.offsets[t+1]-e.offsets[t]}function pM(e){return{kind:`header`,label:`PalmDB header`,subLabel:`${e.type}${e.creator}, ${N(e.count)} records`,offset:0,size:78,badges:[e.creator],meta:[{key:`name`,value:e.name},{key:`type`,value:e.type},{key:`creator`,value:e.creator},{key:`records`,value:N(e.count)}],rowsLabel:`Fields`,rows:[{address:`0x0`,value:`${e.name} database name`},{address:`0x3c`,value:`${e.type}${e.creator} type and creator`},{address:`0x4c`,value:`${N(e.count)} records`}]}}function mM(e){return{kind:`index`,label:`Record list`,subLabel:`${N(e.count)} entries of 8 bytes`,offset:78,size:e.count*8,badges:[N(e.count)],meta:[{key:`entries`,value:N(e.count)},{key:`first record at`,value:M(e.offsets[0])}],rowsLabel:`Entries`,rows:e.offsets.slice(0,e.count).map((t,n)=>({address:M(78+n*8),value:`record ${n} at ${M(t)}, ${j(fM(e,n))}`}))}}function hM(e,t,n){let i=Object.entries(t.exth).map(([n,i])=>({address:M(e.offsets[t.firstRecord]+t.exthOffset),value:`${n}: ${String(i).slice(0,120)}`}));return{kind:`header`,label:n,subLabel:`palmdoc, mobi and exth headers`,offset:e.offsets[t.firstRecord],size:fM(e,t.firstRecord),badges:[`v${t.version}`,dM(t.compression)],meta:[{key:`full name`,value:t.fullName},{key:`mobi version`,value:String(t.version)},{key:`compression`,value:dM(t.compression)},{key:`encryption`,value:t.encryption===0?`none`:`type ${t.encryption}`},{key:`text length`,value:j(t.textLength)},{key:`text records`,value:N(t.textRecordCount)},{key:`encoding`,value:t.encoding===1252?`windows-1252`:`utf-8`},{key:`exth records`,value:N(Object.keys(t.exth).length)}],rowsLabel:`Fields`,rows:[{address:`0x0`,value:`${dM(t.compression)} compression`},{address:`0x4`,value:`${N(t.textLength)} text bytes`},{address:`0x8`,value:`${N(t.textRecordCount)} text records`},{address:`0xc`,value:`${t.encryption} encryption type`},{address:`0x10`,value:`MOBI header magic`},{address:`0x14`,value:`${N(t.headerLength)} mobi header bytes`},{address:`0x24`,value:`${t.version} file version`},{address:`0x6c`,value:`record ${t.firstImage} first image`},{address:`0xf2`,value:`0x${t.extraFlags.toString(16)} extra record data flags`},...i]}}function gM(e,t,n,i){return{kind:n,label:`${i} ${t}`,subLabel:j(fM(e,t)),offset:e.offsets[t],size:fM(e,t),badges:[j(fM(e,t))],meta:[{key:`record`,value:String(t)},{key:`offset`,value:M(e.offsets[t])},{key:`size`,value:j(fM(e,t))}]}}function _M(e,t,n,i,a,o){let s=[];for(let o=t;o<=n&&o<e.count;o++)s.push(gM(e,o,i,a));let c=s.reduce((e,t)=>e+t.size,0);return{kind:i,label:`${a} records`,subLabel:o,offset:e.offsets[t],size:c,badges:[N(s.length)],meta:[{key:`records`,value:N(s.length)},{key:`range`,value:`${t} … ${Math.min(n,e.count-1)}`},{key:`total size`,value:j(c)}],children:s}}function vM(e,t,n){let i=[hM(e,t,n)],a=t.firstRecord+1,o=t.firstRecord+t.textRecordCount;t.textRecordCount>0&&a<e.count&&i.push(_M(e,a,o,`body`,`Text`,`${dM(t.compression)} compressed`));let s=t.firstRecord+t.firstImage,c=t.lastContent>t.firstImage?t.firstRecord+t.lastContent:e.count-1;return t.firstImage>0&&s<e.count&&s>o&&i.push(_M(e,s,c,`data`,`Image`,`one image per record`)),i}function yM(e,t,n,i){let a=[pM(e),mM(e)];return t.headerLength>0&&a.push(...vM(e,t,n?`Record 0 — MOBI 6 half`:`Record 0 — headers`)),n&&a.push(...vM(e,n,`Record ${n.firstRecord} — KF8 half`)),{format:(n??t).version>=8?`azw3`:`mobi`,size:i,blocks:a}}async function bM(e){let t=eM(e),n=tM(t,0),i=n.exth?.kf8Boundary,a=i>0&&i<t.count,o=a?tM(t,i):n,s=yM(t,n,a?o:null,e.byteLength),c;return c=o.encryption===0?o.compression===17480?{error:`this book uses HUFF/CDIC compression, which is not supported`}:o.headerLength===0?{error:`not a mobi book: record 0 has no MOBI header`}:xM(t,n,o,s):{error:`this book is DRM protected and cannot be opened`},c}function xM(e,t,n,i){let a=wM(e,n),o=a.some(e=>e)?a:wM(e,t),s=DM(EM(SM(e,n),o)),c={...t.exth,...n.exth};return{title:c.updatedTitle||n.fullName||t.fullName||e.name||`Untitled`,creator:c.author??``,publisher:c.publisher??``,language:c.language??``,date:c.date??``,description:c.description?GA(c.description):``,coverUrl:TM(o,c),chapters:s,icon:`book`,structure:i}}function SM(e,t){let n=[];for(let i=1;i<=t.textRecordCount;i++){let a=cM(e.record(t.firstRecord+i),t.extraFlags);t.compression===2?n.push(sM(a)):n.push(a)}let i=new Uint8Array(n.reduce((e,t)=>e+t.length,0)),a=0;for(let e of n)i.set(e,a),a+=e.length;let o=oM(i.subarray(0,t.textLength||i.length),t.encoding);return CM(WA(o)||o)}function CM(e){return e.replace(/<\?xml[^?]*\?>/gi,``).replace(/<!DOCTYPE[^>]*>/gi,``).replace(/<\/?(?:html|body|head|title|meta|guide|reference)\b[^>]*>/gi,``)}function wM(e,t){let n=[],i=t.firstRecord+t.firstImage,a=t.firstRecord+t.lastContent,o=a>i?a:e.count-1;if(t.firstImage>0&&i<e.count)for(let t=i;t<=o&&t<e.count;t++)n.push(YA(e.record(t)));return n}function TM(e,t){return(t.coverOffset===void 0?null:e[t.coverOffset])??e.find(e=>e)??null}function EM(e,t){let n=e;return n=n.replace(/<img\b[^>]*>/gi,e=>{let n=e.match(/recindex=["']?(\d+)/i)?.[1],i=e.match(/kindle:embed:([0-9A-Za-z]+)/)?.[1],a=null;n?a=Number(n)-1:i&&(a=parseInt(i,32)-1);let o=a===null?null:t[a];return o?`<img src="${o}">`:``}),KA(n)}function DM(e){let t=e.split(/<\/?mbp:pagebreak[^>]*>/i);t.length<2&&(t=e.split(/(?=<h[12]\b)/i)),t.length<2&&(t=kM(e,4e4));let n=[];for(let e of t)GA(e).length>0&&n.push({title:OM(e)||`Page ${n.length+1}`,html:e});return n}function OM(e){return(e.match(/<h[1-3]\b[^>]*>([\s\S]*?)<\/h[1-3]>/i)?.[1]??e.match(/<font\s[^>]*size=["']?[67][^>]*>([\s\S]*?)<\/font>/i)?.[1]??``).replace(/<[^>]*>/g,` `).replace(/\s+/g,` `).trim().slice(0,80)}function kM(e,t){let n=[],i=0;for(;i<e.length;){let a=i+t,o=a<e.length?e.indexOf(`><`,a)+1:e.length,s=o>i?o:e.length;n.push(e.slice(i,s)),i=s}return n}const AM=Kg({html:!0,linkify:!0,typographer:!0,highlight:function(e,t){return t&&Tb.getLanguage(t)?Tb.highlight(e,{language:t}).value:``}});function jM(e){return PM(AM.render(e))}function MM(e){return{html:jM(new TextDecoder(`utf-8`).decode(e)),icon:`markdown`}}function NM(e,t){let n=console.warn;console.warn=()=>{};try{return IE.renderToString(e.trim(),{displayMode:t,strict:!1})}catch{return null}finally{console.warn=n}}function PM(e){return e=e.replace(/\$\$([\s\S]+?)\$\$/g,(e,t)=>NM(t,!0)||e),e=e.replace(/\$([^\$\n]+?)\$/g,(e,t)=>NM(t,!1)||e),e}function FM(e){let t=new TextDecoder(`utf-8`).decode(e);return{xml:Tk(t),text:t,icon:`xml`,icons:[`render`,`text`,`hex`]}}function IM(e){return{text:new TextDecoder(`utf-8`).decode(e),icon:`mermaid`,icons:[`render`,`text`,`hex`]}}function LM(e){let t=e.indexOf(`<?xml`),n=e.indexOf(`</plist>`)+8;if(t===-1||n===-1)throw Error(`Invalid provisionprofile`);return e.slice(t,n)}function RM(e){let t=e.name;if(t===`dict`){let t={},n=e.children||[];for(let e=0;e<n.length;e+=2){let i=n[e].text;t[i]=RM(n[e+1])}return t}return t===`array`?e.children.map(RM):t===`string`?e.text:t===`integer`?parseInt(e.text,10):t===`true`?!0:t===`false`?!1:t===`date`?new Date(e.text):t===`data`?e.text.trim():null}function zM(e){let t=RM(Y(Tk(LM(e)),[`dict`]));return Object.entries(t).map(([e,t])=>({key:e,value:t}))}new TextDecoder(`utf-8`);const BM=new TextDecoder(`utf-16be`),VM=new TextDecoder(`ascii`);function HM(e){return e.length>40&&VM.decode(e.subarray(0,8))===`bplist00`}function UM(e,t,n){if(n===1)return e.getUint8(t);if(n===2)return e.getUint16(t);if(n===4)return e.getUint32(t);if(n===8)return Number(e.getBigUint64(t));{let i=0;for(let a=0;a<n;a+=1)i=i*256+e.getUint8(t+a);return i}}function WM(e,t,n){if(n===15){let n=1<<(e.getUint8(t+1)&15);return{value:UM(e,t+2,n),headerSize:2+n}}return{value:n,headerSize:1}}function GM(e,t,n){let i=1<<n;return i===8?{value:Number(e.getBigInt64(t+1)),size:1+i}:{value:UM(e,t+1,i),size:1+i}}function KM(e,t,n){let i=1<<n;return{value:i===4?e.getFloat32(t+1):e.getFloat64(t+1),size:1+i}}function qM(e,t,n,i){let a=e.getUint8(n),o=a>>4,s=a&15;if(o===0)return{type:s===8||s===9?`bool`:`null`,value:{0:null,8:!1,9:!0,15:`(fill)`}[s]??null,offset:n,size:1};if(o===1){let t=GM(e,n,s);return{type:`integer`,value:t.value,offset:n,size:t.size}}if(o===2){let t=KM(e,n,s);return{type:`real`,value:t.value,offset:n,size:t.size}}if(o===3){let t=e.getFloat64(n+1);return{type:`date`,value:new Date(Date.UTC(2001,0,1)+t*1e3).toISOString(),offset:n,size:9}}if(o===4){let t=WM(e,n,s);return{type:`data`,value:`${t.value} bytes`,offset:n,size:t.headerSize+t.value,dataOffset:n+t.headerSize,dataSize:t.value}}if(o===5){let i=WM(e,n,s),a=n+i.headerSize;return{type:`string`,value:VM.decode(t.subarray(a,a+i.value)),offset:n,size:i.headerSize+i.value}}if(o===6){let i=WM(e,n,s),a=n+i.headerSize;return{type:`string`,value:BM.decode(t.subarray(a,a+i.value*2)),offset:n,size:i.headerSize+i.value*2}}if(o===8){let t=s+1;return{type:`uid`,value:UM(e,n+1,t),offset:n,size:1+t}}if(o===10||o===12){let t=WM(e,n,s),a=n+t.headerSize,c=[];for(let n=0;n<t.value;n+=1)c.push(UM(e,a+n*i,i));return{type:o===10?`array`:`set`,refs:c,offset:n,size:t.headerSize+t.value*i}}if(o===13){let t=WM(e,n,s),a=n+t.headerSize,o=[],c=[];for(let n=0;n<t.value;n+=1)o.push(UM(e,a+n*i,i)),c.push(UM(e,a+(t.value+n)*i,i));return{type:`dict`,keyRefs:o,valueRefs:c,offset:n,size:t.headerSize+t.value*i*2}}return{type:`unknown`,value:`marker 0x${a.toString(16)}`,offset:n,size:1}}function JM(e,t,n){if(t&&n.has(t)===!1){if(n.add(t),t.type===`array`||t.type===`set`){t.children=t.refs.map(t=>e[t]).filter(Boolean);for(let i of t.children)JM(e,i,n)}else if(t.type===`dict`){t.entries=t.keyRefs.map((n,i)=>({key:e[n],value:e[t.valueRefs[i]]})).filter(e=>e.key&&e.value);for(let i of t.entries)JM(e,i.value,n)}}return t}function YM(e){let t=e instanceof Uint8Array?e:new Uint8Array(e);if(HM(t)){let e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=t.length-32,i=e.getUint8(n+6),a=e.getUint8(n+7),o=Math.min(Number(e.getBigUint64(n+8)),16384),s=Number(e.getBigUint64(n+16)),c=Number(e.getBigUint64(n+24)),l=[];for(let t=0;t<o;t+=1)l.push(UM(e,c+t*i,i));let u=l.map(n=>qM(e,t,n,a));return{magicOffset:0,magicSize:8,objects:u,offsets:l,root:JM(u,u[s],new Set),rootIndex:s,numObjects:o,offsetWidth:i,refWidth:a,tableOffset:c,tableSize:o*i,trailerOffset:n,trailerSize:32,fileSize:t.length}}throw Error(`not a binary plist`)}function XM(e){return e.type===`string`||e.type===`data`?e.value:String(e.value)}function ZM(e){return e.type===`dict`||e.type===`array`||e.type===`set`?`body`:e.type===`data`?`data`:`field`}function QM(e,t){let n=$M(e);return{kind:ZM(e),label:t,subLabel:n.length>0?`${e.type}, ${N(n.length)} items`:`${e.type}: ${XM(e)}`,offset:e.offset,size:e.size,badges:[e.type],meta:[{key:`type`,value:e.type},{key:`offset`,value:M(e.offset)},{key:`size`,value:j(e.size)}],rowsLabel:n.length>0?`Items`:`Value`,rows:n.length>0?n.map(e=>({address:e.label,value:e.subLabel})):[{address:t,value:XM(e)}],children:n}}function $M(e){return e.type===`dict`?e.entries.slice(0,512).map(e=>QM(e.value,XM(e.key))):e.type===`array`||e.type===`set`?e.children.slice(0,512).map((e,t)=>QM(e,`[${t}]`)):[]}function eN(e){return[{kind:`header`,label:`Magic`,subLabel:`bplist00`,offset:e.magicOffset,size:e.magicSize,rowsLabel:`Magic`,rows:[{address:`0x0`,value:`62 70 6c 69 73 74 30 30 (b p l i s t 0 0)`}]},{kind:`body`,label:`Root object`,subLabel:`${e.root.type}, object ${e.rootIndex} of ${N(e.numObjects)}`,offset:e.root.offset,size:e.tableOffset-e.magicSize,meta:[{key:`root`,value:`object ${e.rootIndex}`},{key:`objects`,value:N(e.numObjects)},{key:`object table`,value:`${M(e.magicSize)}, ${j(e.tableOffset-e.magicSize)}`}],rowsLabel:`Items`,rows:$M(e.root).map(e=>({address:e.label,value:e.subLabel})),children:$M(e.root)},{kind:`index`,label:`Offset table`,subLabel:`${N(e.numObjects)} offsets, ${e.offsetWidth} bytes each`,offset:e.tableOffset,size:e.tableSize,meta:[{key:`offset`,value:M(e.tableOffset)},{key:`size`,value:j(e.tableSize)},{key:`entry width`,value:`${e.offsetWidth} B`}],rowsLabel:`Offsets`,rows:e.offsets.map((e,t)=>({address:String(t).padStart(5,`0`),value:M(e)}))},{kind:`footer`,label:`Trailer`,subLabel:`32 B, widths, object count and root index`,offset:e.trailerOffset,size:e.trailerSize,meta:[{key:`offset width`,value:`${e.offsetWidth} B`},{key:`ref width`,value:`${e.refWidth} B`},{key:`objects`,value:N(e.numObjects)},{key:`root`,value:String(e.rootIndex)}],rowsLabel:`Trailer`,rows:[{address:M(e.trailerOffset+6),value:`offset width ${e.offsetWidth}`},{address:M(e.trailerOffset+7),value:`ref width ${e.refWidth}`},{address:M(e.trailerOffset+8),value:`${N(e.numObjects)} objects`},{address:M(e.trailerOffset+16),value:`root object ${e.rootIndex}`}]}]}function tN(e,t){return e.map(e=>({kind:`field`,label:e.key,subLabel:String(e.value),offset:0,size:t,rowsLabel:`Value`,rows:[{address:e.key,value:String(e.value)}]}))}function nN(e){let t=new Uint8Array(e);if(HM(t))return{format:`bplist`,size:e.byteLength,blocks:eN(YM(t))};{let t=new TextDecoder(`utf-8`).decode(e);return{format:`plist`,size:e.byteLength,blocks:tN(zM(t),e.byteLength)}}}function rN(e){return e&&e.type===`dict`?e.entries.map(e=>({key:String(e.key.value),value:e.value.entries||e.value.children?`<${e.value.type}>`:String(e.value.value)})):[]}function iN(e){let t=new Uint8Array(e);return{payload:HM(t)?rN(YM(t).root):zM(new TextDecoder(`utf-8`).decode(e)),structure:nN(e),icon:`plist`}}function aN(e){let t=new TextDecoder(`utf-8`).decode(e).split(`
|
|
337
|
+
`),n=t[0].startsWith(`#`),i=n?oN(t[0]):{},a=[];for(let e=+!!n;e<t.length;e++){let n=t[e],i=n.lastIndexOf(` `);i>0&&a.push({frames:n.slice(0,i).split(`;`),count:Number(n.slice(i+1))})}return{meta:i,stacks:a,icon:`flame`,icons:[`flame`,`text`,`hex`]}}function oN(e){try{return JSON.parse(e.slice(1))}catch{return{}}}function sN(e){let t=new DataView(e),n=[],i=String.fromCharCode(t.getUint8(4),t.getUint8(5),t.getUint8(6),t.getUint8(7));if(i!==`Bud1`)return console.log(`DSStore: invalid magic`,i),[{filename:`error`,structureType:``,dataType:``,value:`Not a valid .DS_Store file`}];let a=t.getUint32(8);t.getUint32(12);let o=4+a;t.getUint32(o);let s=[];for(let e=0;e<256;e++)s.push(t.getUint32(o+8+e*4));let c=o+8+1024,l=t.getUint32(c),u=null,d=c+4;for(let e=0;e<l;e++){let e=t.getUint8(d);d+=1;let n=``;for(let i=0;i<e;i++)n+=String.fromCharCode(t.getUint8(d+i));d+=e;let i=t.getUint32(d);d+=4,n===`DSDB`&&(u=i)}if(u==null)return console.log(`DSStore: DSDB directory not found`),[{filename:`error`,structureType:``,dataType:``,value:`DSDB not found`}];function f(e){let t=s[e];return{offset:(t&-32)+4,size:1<<(t&31)}}let p=f(u),m=t.getUint32(p.offset);t.getUint32(p.offset+4),t.getUint32(p.offset+8),t.getUint32(p.offset+12),t.getUint32(p.offset+16);function h(e,n){let i=``;for(let a=0;a<n;a++)i+=String.fromCharCode(t.getUint16(e+a*2));return i}function g(e){return String.fromCharCode(t.getUint8(e),t.getUint8(e+1),t.getUint8(e+2),t.getUint8(e+3))}function _(n,i){if(n===`long`||n===`shor`)return{value:t.getUint32(i),nextPos:i+4};if(n===`bool`)return{value:t.getUint8(i),nextPos:i+1};if(n===`blob`){let n=t.getUint32(i);return{value:new Uint8Array(e.slice(i+4,i+4+n)),nextPos:i+4+n}}if(n===`ustr`){let e=t.getUint32(i);return{value:h(i+4,e),nextPos:i+4+e*2}}if(n===`type`)return{value:g(i),nextPos:i+4};if(n===`comp`){let e=t.getUint32(i),n=t.getUint32(i+4);return{value:e*4294967296+n,nextPos:i+8}}if(n===`dutc`){let e=t.getUint32(i),n=t.getUint32(i+4);return{value:e*4294967296+n,nextPos:i+8}}return{value:null,nextPos:i+4}}function v(e){let n=t.getUint32(e);e+=4;let i=h(e,n);e+=n*2;let a=g(e);e+=4;let o=g(e);e+=4;let{value:s,nextPos:c}=_(o,e);return{record:{filename:i,structureType:a,dataType:o,value:s},nextPos:c}}function y(e){let i=f(e),a=t.getUint32(i.offset),o=t.getUint32(i.offset+4),s=i.offset+8;if(a===0)for(let e=0;e<o;e++)try{let e=v(s);n.push(e.record),s=e.nextPos}catch(e){console.log(`DSStore: error reading record at`,s,e);break}else{for(let e=0;e<o;e++){let e=t.getUint32(s);s+=4,y(e);try{let e=v(s);n.push(e.record),s=e.nextPos}catch(e){console.log(`DSStore: error reading record at`,s,e);break}}y(t.getUint32(s))}}try{y(m)}catch(e){console.log(`DSStore: error traversing B-tree`,e)}return n}const cN=Date.UTC(2001,0,1),lN=Date.UTC(1904,0,1),uN=e=>String(e).padStart(2,`0`);function dN(e){return`${e.getFullYear()}-${uN(e.getMonth()+1)}-${uN(e.getDate())} ${uN(e.getHours())}:${uN(e.getMinutes())}:${uN(e.getSeconds())}`}function fN(e){let t=new Date(cN+e*1e3);if(t.getFullYear()>=2e3&&t.getFullYear()<=2100)return dN(t);let n=new Date(lN+e*1e3);if(n.getFullYear()>=2e3&&n.getFullYear()<=2100)return dN(n);let i=new Date(cN+e/65536*1e3);return i.getFullYear()>=2e3&&i.getFullYear()<=2100?dN(i):`${e}`}function pN(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function mN(e,t){return e[t]<<8|e[t+1]}function hN(e,t){return String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])}function gN(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(` `)}function _N(e){if(e.length<8)return gN(e);let t=new DataView(e.buffer,e.byteOffset,8).getFloat64(0,!0),n=new Date(cN+t*1e3);return n.getFullYear()>=2e3&&n.getFullYear()<=2100?dN(n):gN(e)}const vN={Iloc:function(e){return e.length<16?gN(e):`pos(${pN(e,0)}, ${pN(e,4)})`},fwi0:function(e){return e.length<16?gN(e):`rect(${mN(e,0)}, ${mN(e,2)}, ${mN(e,4)}, ${mN(e,6)}) view=${hN(e,8)}`},BKGD:function(e){if(e.length<12)return gN(e);let t=hN(e,0);return t===`DefB`?`default`:t===`ClrB`?`color(${mN(e,4)}, ${mN(e,6)}, ${mN(e,8)})`:`${t} ${gN(e.slice(4))}`},lssp:function(e){return e.length<8?gN(e):`scroll(${pN(e,0)}, ${pN(e,4)})`},icsp:function(e){return e.length<8?gN(e):`scroll(${pN(e,0)}, ${pN(e,4)})`},icgo:function(e){return e.length<8?gN(e):`scroll(${pN(e,0)}, ${pN(e,4)})`},modD:_N,moDD:_N};function yN(e){return e.map(function(e){let{filename:t,structureType:n,dataType:i,value:a}=e,o=String(a);if(i===`dutc`)o=fN(a);else if(i===`bool`)o=a?`true`:`false`;else if(i===`comp`)o=`${a} bytes`;else if(i===`blob`&&a instanceof Uint8Array){let e=vN[n];o=e?e(a):a.length<=32?gN(a):`[blob ${a.length} bytes]`}else n===`vstl`&&(o={icnv:`icon`,clmv:`column`,Nlsv:`list`,Flwv:`coverflow`}[a]||a);return{filename:t,structureType:n,dataType:i,value:o}})}function bN(e,t,n){let i=``;for(let a=0;a<n;a+=1)i+=String.fromCharCode(e.getUint16(t+a*2));return i}function xN(e,t){return String.fromCharCode(e.getUint8(t),e.getUint8(t+1),e.getUint8(t+2),e.getUint8(t+3))}function SN(e,t,n){return t===`long`||t===`shor`||t===`type`?4:t===`bool`?1:t===`comp`||t===`dutc`?8:t===`blob`?4+e.getUint32(n):t===`ustr`?4+e.getUint32(n)*2:4}function CN(e,t){let n=e.getUint32(t),i=bN(e,t+4,n),a=t+4+n*2,o=xN(e,a),s=xN(e,a+4),c=a+8,l=SN(e,s,c);return{filename:i,structureType:o,dataType:s,offset:t,size:c+l-t,valueOffset:c,valueSize:l}}function wN(e){let t=new DataView(e);if(xN(t,4)!==`Bud1`)throw Error(`not a .DS_Store file`);let n=t.getUint32(8),i=t.getUint32(12),a=4+n,o=t.getUint32(a),s=a+8,c=[];for(let e=0;e<256;e+=1)c.push(t.getUint32(s+e*4));function l(e){let t=c[e];return{offset:(t&-32)+4,size:1<<(t&31)}}let u=s+1024,d=t.getUint32(u),f=[],p=u+4;for(let e=0;e<d;e+=1){let e=t.getUint8(p),n=``;for(let i=0;i<e;i+=1)n+=String.fromCharCode(t.getUint8(p+1+i));let i=t.getUint32(p+1+e);f.push({name:n,blockId:i,offset:p,size:1+e+4}),p+=1+e+4}let m=f.find(e=>e.name===`DSDB`);if(m===void 0)throw Error(`DSDB directory not found`);let h=l(m.blockId),g=t.getUint32(h.offset),_={blockId:m.blockId,offset:h.offset,size:h.size,rootBlockId:g,internalNodeCount:t.getUint32(h.offset+4),recordCount:t.getUint32(h.offset+8),nodeCount:t.getUint32(h.offset+12),pageSize:t.getUint32(h.offset+16)},v=[],y=new Set;function b(e){let n=l(e),i=n.offset+8<=t.byteLength&&n.offset+n.size<=t.byteLength;if(v.length<512&&y.has(e)===!1&&i){y.add(e);let i=t.getUint32(n.offset),a=t.getUint32(n.offset+4),o={blockId:e,offset:n.offset,size:n.size,mode:i,count:a,records:[],children:[]};v.push(o);let s=n.offset+n.size,c=n.offset+8;for(let e=0;e<a&&c+8<=s;e+=1){i!==0&&(o.children.push(t.getUint32(c)),c+=4);let e=CN(t,c);e.offset+e.size<=s?(o.records.push(e),c=e.offset+e.size):c=s}i!==0&&c+4<=s&&o.children.push(t.getUint32(c));for(let e of o.children)b(e)}}return b(g),{magicOffset:4,magicSize:4,headerOffset:0,headerSize:32,bookkeepingOffset:a,bookkeepingSize:i,numBlocks:o,addressTableOffset:s,addressTableSize:1024,blockAddresses:c,directoryOffset:u,directorySize:p-u,directories:f,tree:_,nodes:v,fileSize:e.byteLength}}var TN={BKGD:`background: Finder window background type and color`,ICVO:`iconViewOptions: Icon view options flag`,Iloc:`iconLocation: Icon x,y position coordinates`,LSVO:`listViewOptions: List view options flag`,bwsp:`windowProperties: Window size, position, sidebar (plist)`,cmmt:`comment: Spotlight comment`,dilc:`desktopIconLocation: Desktop icon location`,dscl:`disclosed: Indicates that subdirectory is open in list view`,extn:`extension: File extension override`,fwi0:`finderWindowInfo: Window rect (top, left, bottom, right) and view type`,fwsw:`finderSidebarWidth: Sidebar width in pixels`,fwvh:`finderWindowVerticalHeight: Window vertical height`,GRP0:`group: Group name`,icgo:`iconGridOptions: Icon grid options`,icsp:`iconScrollPosition: Icon scroll position`,icvo:`iconViewOptions: Icon view options blob`,icvp:`iconViewPreferences: Icon view preferences (plist)`,icvt:`iconViewTextSize: Icon view text size in points`,info:`info: Directory info with timestamps`,logS:`logicalSize: Logical size of directory contents`,lg1S:`logicalSize1: Logical size alternate`,lssp:`listScrollPosition: List view scroll position`,lsvo:`listViewOptions: List view column settings and widths`,lsvt:`listViewTextSize: List view text size in points`,lsvp:`listViewPreferences: List view settings (plist)`,lsvP:`listViewColumnSpecs: List view column specs (plist)`,modD:`modificationDate: File modification date`,moDD:`modificationDateDir: Directory modification date`,phyS:`physicalSize: Physical size in 8KB blocks`,ph1S:`physicalSize1: Physical size alternate`,pict:`picture: Alias record to background image`,vSrn:`version: Version number`,vstl:`viewStyle: View style (icnv/clmv/Nlsv/Flwv)`};function EN(e){return{kind:`header`,label:`Header`,subLabel:`alignment, Bud1 magic and the bookkeeping pointer`,offset:e.headerOffset,size:e.headerSize,meta:[{key:`magic`,value:`Bud1`},{key:`bookkeeping`,value:`${M(e.bookkeepingOffset)}, ${j(e.bookkeepingSize)}`},{key:`blocks`,value:N(e.numBlocks)}],rowsLabel:`Fields`,rows:[{address:`0x0`,value:`00 00 00 01 alignment`},{address:`0x4`,value:`42 75 64 31 (B u d 1)`},{address:`0x8`,value:`bookkeeping offset ${M(e.bookkeepingOffset-4)}`},{address:`0xc`,value:`bookkeeping size ${j(e.bookkeepingSize)}`}]}}function DN(e){let t=e.blockAddresses.map((e,t)=>({blockId:t,raw:e})).filter(e=>e.raw!==0);return{kind:`index`,label:`Buddy allocator`,subLabel:`${N(e.numBlocks)} blocks, 256 entry address table`,offset:e.bookkeepingOffset,size:e.addressTableOffset+e.addressTableSize-e.bookkeepingOffset,meta:[{key:`offset`,value:M(e.bookkeepingOffset)},{key:`blocks`,value:N(e.numBlocks)},{key:`address table`,value:`${M(e.addressTableOffset)}, ${j(e.addressTableSize)}`}],rowsLabel:`Allocated blocks`,rows:t.map(e=>({address:String(e.blockId).padStart(3,`0`),value:`${M((e.raw&-32)+4)}, ${j(1<<(e.raw&31))}`})),children:t.map(t=>({kind:`field`,label:`Block ${t.blockId}`,subLabel:`${j(1<<(t.raw&31))} at ${M((t.raw&-32)+4)}`,offset:e.addressTableOffset+t.blockId*4,size:4}))}}function ON(e){return{kind:`index`,label:`Directory list`,subLabel:`${N(e.directories.length)} named blocks`,offset:e.directoryOffset,size:e.directorySize,rowsLabel:`Directories`,rows:e.directories.map(e=>({address:e.name,value:`block ${e.blockId}`})),children:e.directories.map(e=>({kind:`field`,label:e.name,subLabel:`block ${e.blockId}`,offset:e.offset,size:e.size}))}}function kN(e,t){let n=new Uint8Array(e,t.valueOffset+4,Math.max(t.valueSize-4,0));if(HM(n)){let e=YM(n),i=t.valueOffset+4;return e.root&&e.root.type===`dict`?e.root.entries.map(e=>({kind:`field`,label:String(e.key.value),subLabel:`${e.value.type}: ${String(e.value.value??``)}`,offset:i+e.value.offset,size:e.value.size,badges:[e.value.type],rowsLabel:`Value`,rows:[{address:String(e.key.value),value:String(e.value.value??e.value.type)}]})):[]}return[]}function AN(e,t){let n=t.dataType===`blob`?kN(e,t):[];return{kind:n.length>0?`entry`:`field`,label:t.structureType,subLabel:`${TN[t.structureType]??`property`} of ${t.filename}`,offset:t.offset,size:t.size,badges:[t.dataType],meta:[{key:`file`,value:t.filename},{key:`property`,value:t.structureType},{key:`type`,value:t.dataType},{key:`value`,value:`${M(t.valueOffset)}, ${j(t.valueSize)}`},{key:`meaning`,value:TN[t.structureType]??`unknown`}],children:n}}function jN(e,t,n){return{kind:`body`,label:`Node ${n} (block ${t.blockId})`,subLabel:`${t.mode===0?`leaf`:`internal`}, ${N(t.records.length)} records`,offset:t.offset,size:t.size,badges:[t.mode===0?`leaf`:`internal`],meta:[{key:`block`,value:String(t.blockId)},{key:`offset`,value:M(t.offset)},{key:`size`,value:j(t.size)},{key:`mode`,value:t.mode===0?`leaf`:`internal, ${t.children.length} children`},{key:`records`,value:N(t.records.length)}],rowsLabel:`Records`,rows:t.records.map(e=>({address:e.filename,value:`${e.structureType} (${e.dataType})`})),children:t.records.map(t=>AN(e,t))}}function MN(e){return{kind:`footer`,label:`B-tree master`,subLabel:`root block ${e.tree.rootBlockId}, ${N(e.tree.recordCount)} records`,offset:e.tree.offset,size:e.tree.size,meta:[{key:`root block`,value:String(e.tree.rootBlockId)},{key:`records`,value:N(e.tree.recordCount)},{key:`nodes`,value:N(e.tree.nodeCount)},{key:`page size`,value:j(e.tree.pageSize)}],rowsLabel:`Master block`,rows:[{address:M(e.tree.offset),value:`root block id ${e.tree.rootBlockId}`},{address:M(e.tree.offset+8),value:`${N(e.tree.recordCount)} records`},{address:M(e.tree.offset+12),value:`${N(e.tree.nodeCount)} nodes`},{address:M(e.tree.offset+16),value:`page size ${j(e.tree.pageSize)}`}]}}function NN(e){let t=wN(e),n=[EN(t),DN(t),ON(t),MN(t),...t.nodes.map((t,n)=>jN(e,t,n))];return{format:`ds_store`,size:e.byteLength,blocks:n}}function PN(e){let t=yN(sN(e)),n;try{n=NN(e)}catch(e){console.warn(`ds_store structure failed`,e.message)}return{payload:t,structure:n,icon:`apple`}}const FN=/[\p{White_Space}\p{P}\p{S}]+/u;function IN(e){let{text:t}=e,n=new Map;if(t){let e=t.split(FN).filter(Boolean);for(let t of e)n.set(t,(n.get(t)||0)+1)}return n}function LN(e,t){let{title:n,body:i,keywords:a,ext:o}=e;function s(e,n){let i=e.toLowerCase().trim();i.length<=1||(!t.has(i)||t.get(i)<n)&&t.set(i,n)}if(Array.isArray(a))for(let e of a)s(e,100);if(n){let e=IN({text:n,ext:o});for(let[t]of e)s(t,90)}if(i){let e=IN({text:i,ext:o});for(let[t,n]of e.entries())s(t,Math.min(Math.round(n*10),89))}return t}function RN(e){let t=[],n=/<content>\s*<!\[CDATA\[([\s\S]*?)\]\]>\s*<\/content>/g,i;for(;(i=n.exec(e))!==null;)t.push(i[1]);return{cleaned:e.replace(n,`<content></content>`),blocks:t}}function zN(e){let t=new TextDecoder(`utf-8`).decode(e),{cleaned:n,blocks:i}=RN(t),a=Ek(Tk(n),`note`),o=[];for(let e=0;e<a.length;e++){let t=a[e],n=J(t,`title`)?.text||``,s=J(t,`created`)?.text||``,c=J(t,`updated`)?.text||``,l=Y(t,[`note-attributes`,`author`])?.text||``,u={},d=Ek(t,`resource`);for(let e of d){let t=J(e,`data`)?.text?.trim()||``,n=J(e,`mime`)?.text||``,i=J(e,`width`)?.text||``,a=J(e,`height`)?.text||``,o=(Y(e,[`resource-attributes`,`source-url`])?.text||``).match(/\+([a-f0-9]{32})\+/),s=o?o[1]:``;s&&t&&(u[s]={data:t,mime:n,width:i,height:a})}let f=BN(i[e]||``,u);o.push({title:n,created:s,updated:c,author:l,html:f})}return{notes:o,text:t,icon:`evernote`,icons:[`render`,`text`,`hex`]}}function BN(e,t){let n=e.replace(/<\?xml[^?]*\?>/g,``).replace(/<!DOCTYPE[^>]*>/g,``).trim();return n=n.replace(/<en-note>/g,`<div class="en-note">`),n=n.replace(/<\/en-note>/g,`</div>`),n=n.replace(/<en-media[^/]*?hash="([a-f0-9]+)"[^/]*?type="([^"]*)"[^/]*?\/>/g,function(e,n,i){let a=t[n];return a?`<img src="${`data:${a.mime};base64,${a.data}`}" style="${a.width?`max-width:${a.width}px`:``}" />`:`<div class="en-media-missing">[media: ${n}]</div>`}),n=n.replace(/evernote:\/\/\/[^"']*/g,`#`),n}function VN(){let e={};return{Parser:t,getCache:t=>e[t],releaseZip:t=>delete e[t]};async function t(t,n){let i=n.url||n?.file?.name||n.ext,a=await EA(t);e[i]=a;let o=a.getEntries().map(e=>e.name);return console.log(`zip indexed`,i,o.length,`entries`),{entries:o,zipPath:i,structure:BA(a.getLayout(),t.byteLength)}}}function HN(e){let t=e.byteLength-512,n=new DataView(e,t,512),i=n.getUint32(0);if(i!==1802464377)throw Error(`not a DMG file: koly magic not found`);return{magic:i,version:n.getUint32(4),headerSize:n.getUint32(8),flags:n.getUint32(12),dataForkOffset:Number(n.getBigUint64(24)),dataForkLength:Number(n.getBigUint64(32)),xmlOffset:Number(n.getBigUint64(216)),xmlLength:Number(n.getBigUint64(224)),sectorCount:Number(n.getBigUint64(380))}}function UN(e,t,n){let i=new Uint8Array(e,t,n),a=new TextDecoder().decode(i),o=[],s=WN(a,`blkx`);if(s){let e=GN(s,`dict`);for(let t of e){let e=KN(t,`CFName`,`string`)||``,n=qN((KN(t,`Data`,`data`)||``).trim());o.push({name:e,data:n})}}return{blkx:o}}function WN(e,t){let n=e.indexOf(`<key>resource-fork</key>`);if(n===-1)return null;let i=`<key>${t}</key>`,a=e.indexOf(i,n);if(a===-1)return null;let o=e.indexOf(`<array>`,a);if(o===-1)return null;let s=e.indexOf(`</array>`,o);return s===-1?null:e.slice(o+7,s)}function GN(e,t){let n=[],i=`<${t}>`,a=`</${t}>`,o=0;for(;;){let t=e.indexOf(i,o);if(t===-1)break;let s=e.indexOf(a,t);if(s===-1)break;n.push(e.slice(t+i.length,s)),o=s+a.length}return n}function KN(e,t,n){let i=`<key>${t}</key>`,a=e.indexOf(i);if(a===-1)return null;let o=a+i.length,s=`<${n}>`,c=`</${n}>`,l=e.indexOf(s,o);if(l===-1)return null;let u=e.indexOf(c,l);return u===-1?null:e.slice(l+s.length,u)}function qN(e){let t=e.replace(/\s/g,``);if(globalThis.Buffer){let e=Buffer.from(t,`base64`);return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}{let e=atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n}}function JN(e){let t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),n=new DataView(t),i=n.getUint32(0);if(i!==1835627368)throw Error(`invalid mish magic: 0x`+i.toString(16));let a=Number(n.getBigUint64(8)),o=Number(n.getBigUint64(16)),s=Number(n.getBigUint64(24)),c=n.getUint32(200),l=[];for(let e=0;e<c;e++){let t=204+e*40,i=n.getUint32(t);if(i===4294967295)break;i!==2147483646&&l.push({type:i,sectorStart:Number(n.getBigUint64(t+8)),sectorCount:Number(n.getBigUint64(t+16)),compressedOffset:Number(n.getBigUint64(t+24)),compressedLength:Number(n.getBigUint64(t+32))})}return{sectorNumber:a,sectorCount:o,dataOffset:s,chunks:l}}function YN(e,t){let n=new Uint8Array(t),i=0,a=0;for(;i<e.length&&a<t;){let o=e[i++];if(o&128){let s=(o&127)+1;for(let o=0;o<s&&a<t;o++)n[a++]=e[i++]}else if(o&64){let s=(o&63)+4,c=e[i]<<8|e[i+1];i+=2;let l=a-c;for(let e=0;e<s&&a<t;e++)n[a++]=n[l+e]}else{let s=(o>>2&3)+3,c=(o&3)<<8|e[i++],l=a-c;for(let e=0;e<s&&a<t;e++)n[a++]=n[l+e]}}return n}function XN(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=[],i=0;for(;i<e.length;){let a=t.getUint32(i,!0);if(a===611874402)break;if(a===1853388386){let a=t.getUint32(i+4,!0);i+=8;for(let t=0;t<a;t++)n.push(e[i++])}else if(a===846755426){let a=t.getUint32(i+4,!0),o=t.getUint32(i+8,!0);i+=12;let s=ZN(e.subarray(i,i+o),a);for(let e=0;e<s.length;e++)n.push(s[e]);i+=o}else if(a===829978210){let t=QN(e,i);for(let e=0;e<t.data.length;e++)n.push(t.data[e]);i=t.nextPos}else throw Error(`unknown LZFSE block magic: 0x`+a.toString(16))}return new Uint8Array(n)}function ZN(e,t){let n=new Uint8Array(t),i=0,a=0;for(;i<e.length&&a<t;){let o=e[i];if(o===6)break;let s=o&240;if(o===224){let o=e[i+1]+1;i+=2;for(let s=0;s<o&&a<t;s++)n[a++]=e[i++]}else if(s===224){let s=o&15;i+=1;for(let o=0;o<s&&a<t;o++)n[a++]=e[i++]}else if(s===240){let s=(o&15)+16,c=e[i+1]|e[i+2]<<8;i+=3;for(let e=0;e<s&&a<t;e++)n[a]=n[a-c],a++}else if((o&224)==160||(o&224)==128){let s=o>>3&3,c=(o&7)+3,l=o&224,u;l===160?(u=e[i+1+s]|e[i+2+s]<<8,i+=1):(u=e[i+1+s]|(e[i+2+s]&63)<<8,i+=1);for(let o=0;o<s&&a<t;o++)n[a++]=e[i++];if(i+=2,u===0)break;for(let e=0;e<c&&a<t;e++)n[a]=n[a-u],a++}else if(!(o&192)||(o&192)==64){let s=(o>>4&3)+3,c=o>>6&3;i+=1;for(let o=0;o<c&&a<t;o++)n[a++]=e[i++];let l=e[i]|(o&15)<<8;if(i+=1,l===0)break;for(let e=0;e<s&&a<t;e++)n[a]=n[a-l],a++}else i++}return n.subarray(0,a)}function QN(e,t){let n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=t+4,a=n.getUint32(i,!0);i+=4,n.getUint32(i,!0),i+=4;let o=n.getUint32(i,!0);i+=4;let s=n.getUint32(i,!0);i+=4;let c=n.getUint32(i,!0);i+=4;let l=n.getUint32(i,!0);i+=4;let u=n.getInt32(i,!0);i+=4;let d=n.getInt32(i,!0);i+=4;let f=new Uint16Array(20);for(let e=0;e<20;e++)f[e]=n.getUint16(i,!0),i+=2;let p=new Uint16Array(20);for(let e=0;e<20;e++)p[e]=n.getUint16(i,!0),i+=2;let m=new Uint16Array(64);for(let e=0;e<64;e++)m[e]=n.getUint16(i,!0),i+=2;let h=new Uint16Array(256);for(let e=0;e<256;e++)h[e]=n.getUint16(i,!0),i+=2;i-t;let g=$N(e.subarray(i,i+c),h,256,o,u);i+=c;let _=eP(e.subarray(i,i+l),f,p,m,s,d);i+=l;let v=new Uint8Array(a),y=0,b=0;for(let e=0;e<s;e++){let t=_.lengths[e],n=_.matches[e],i=_.distances[e];for(let e=0;e<t&&y<a;e++)v[y++]=g[b++];if(i>0)for(let e=0;e<n&&y<a;e++)v[y]=v[y-i],y++}for(;b<o&&y<a;)v[y++]=g[b++];return{data:v.subarray(0,y),nextPos:i}}function $N(e,t,n,i,a){let o=tP(t,n),s=nP(t,n,o),c=new Uint8Array(i),l=rP(e,a),u=l.read(o);for(let e=0;e<i;e++){let t=s[u];c[e]=t.symbol,u=t.newState+l.read(t.nBits)}return c}function eP(e,t,n,i,a,o){let s=tP(t,20),c=tP(n,20),l=tP(i,64),u=nP(t,20,s),d=nP(n,20,c),f=nP(i,64,l),p=rP(e,o),m=p.read(s),h=p.read(c),g=p.read(l),_=new Uint32Array(a),v=new Uint32Array(a),y=new Uint32Array(a),b=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,24],x=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2],S=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,24],C=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2],w=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,34,36,40,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576,32768,49152,65536,98304,131072,196608,262144,393216,524288],T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30];for(let e=0;e<a;e++){let t=u[m].symbol,n=d[h].symbol,i=f[g].symbol;_[e]=b[t]+p.read(x[t]),v[e]=S[n]+p.read(C[n]),y[e]=w[i]+p.read(T[i]);let a=u[m],o=d[h],s=f[g];m=a.newState+p.read(a.nBits),h=o.newState+p.read(o.nBits),g=s.newState+p.read(s.nBits)}return{lengths:_,matches:v,distances:y}}function tP(e,t){let n=0;for(let i=0;i<t;i++)n+=e[i];if(n===0)return 0;let i=0,a=n;for(;a>1;)a>>=1,i++;return i}function nP(e,t,n){let i=1<<n,a=Array(i),o=0;for(let i=0;i<t;i++)for(let t=0;t<e[i];t++){let t=n-Math.floor(Math.log2(e[i]||1));a[o]={symbol:i,nBits:Math.max(0,t),newState:0},o++}let s=new Uint32Array(t);for(let n=0;n<t;n++)e[n]<=1?s[n]=i+e[n]-1:s[n]=e[n];for(let t=0;t<i;t++)if(a[t]){let o=e[a[t].symbol];if(o>0){let e=n-Math.floor(Math.log2(o)),s=(o<<e)-i;a[t].nBits=e,a[t].newState=s}}return a}function rP(e,t){let n=e.length-1,i=7;function a(t){if(t===0)return 0;let a=0;for(let o=0;o<t;o++)n>=0&&(a|=(e[n]>>i&1)<<o,i--,i<0&&(i=7,n--));return a}return{read:a}}function iP(e){let{arrayBuffer:t,partitions:n,dataForkOffset:i}=e,a=new Map;n[0].sectorNumber;let o=[];for(let e of n)for(let t of e.chunks)o.push({...t,absoluteSectorStart:t.sectorStart,compressedOffset:e.dataOffset+t.compressedOffset});async function s(e,t){let n=new Uint8Array(t),i=0;for(;i<t;){let a=e+i,o=c(Math.floor(a/512));if(!o){let e=Math.min(t-i,512);i+=e;continue}let s=await l(o),u=a-o.absoluteSectorStart*512,d=s.byteLength-u,f=Math.min(d,t-i);n.set(s.subarray(u,u+f),i),i+=f}return n}function c(e){for(let t of o)if(e>=t.absoluteSectorStart&&e<t.absoluteSectorStart+t.sectorCount)return t;return null}async function l(e){let n=e.compressedOffset+`:`+e.compressedLength;if(a.has(n)){let e=a.get(n);return a.delete(n),a.set(n,e),e}let o=e.sectorCount*512,s;if(e.type===0||e.type===2)s=new Uint8Array(o);else if(e.type===1){let n=i+e.compressedOffset;s=new Uint8Array(t,n,e.compressedLength)}else{let n=i+e.compressedOffset,a=new Uint8Array(t,n,e.compressedLength);e.type===2147483653?s=await vt(a):e.type===2147483654?s=kt(a):e.type===2147483655?s=XN(a):e.type===2147483652?s=YN(a,o):e.type===2147483656?s=eA(a,o):(console.log(`unknown block type: 0x`+e.type.toString(16)+`, filling zeros`),s=new Uint8Array(o))}if(a.size>=16){let e=a.keys().next().value;a.delete(e)}return a.set(n,s),s}function u(e,t){let n=0;return new ReadableStream({async pull(i){if(n>=t){i.close();return}let a=Math.min(32768,t-n),o=await s(e+n,a);i.enqueue(o),n+=a}})}return{read:s,readStream:u}}async function aP(e){let t=await e.read(1024,512),n=new DataView(t.buffer,t.byteOffset,t.byteLength),i=n.getUint16(0);if(i!==18475&&i!==18520)throw Error(`not HFS+: signature 0x`+i.toString(16));return{signature:i,version:n.getUint16(2),blockSize:n.getUint32(40),totalBlocks:n.getUint32(44),allocationFile:oP(n,112),extentsFile:oP(n,192),catalogFile:oP(n,272),attributesFile:oP(n,352),startupFile:oP(n,432)}}function oP(e,t){let n=Number(e.getBigUint64(t)),i=e.getUint32(t+8),a=e.getUint32(t+12),o=[];for(let n=0;n<8;n++){let i=e.getUint32(t+16+n*8),a=e.getUint32(t+16+n*8+4);a>0&&o.push({startBlock:i,blockCount:a})}return{logicalSize:n,clumpSize:i,totalBlocks:a,extents:o}}async function sP(e){let{reader:t,volume:n,forkData:i}=e;async function a(e,a){let o=0;for(let s of i.extents){let i=s.blockCount*n.blockSize;if(e<o+i){let i=s.startBlock*n.blockSize+(e-o);return await t.read(i,a)}o+=i}throw Error(`offset beyond fork extents: `+e)}let o=await a(0,512),s=new DataView(o.buffer,o.byteOffset,o.byteLength);s.getInt8(8);let c=s.getUint16(14),l=s.getUint32(16),u=s.getUint32(20),d=s.getUint32(24);s.getUint32(28);let f=s.getUint16(32);s.getUint16(34),s.getUint32(36);async function p(e){let t=await a(e*f,f),n=new DataView(t.buffer,t.byteOffset,t.byteLength),i=n.getUint32(0),o=n.getUint32(4),s=n.getInt8(8),c=n.getUint8(9),l=n.getUint16(10),u=[];for(let e=0;e<=l;e++)u.push(n.getUint16(f-2*(e+1)));let d=[];for(let e=0;e<l;e++){let n=u[e],i=u[e+1];d.push(t.subarray(n,i))}return{fLink:i,bLink:o,kind:s,height:c,numRecords:l,records:d}}async function m(e){if(d===0)return;let t=d;for(;t!==0;){let n=await p(t);for(let t of n.records)e(t);t=n.fLink}}async function h(e){if(l===0)return null;let t=l;for(;;){let n=await p(t);if(n.kind===-1){for(let t of n.records)if(e(t)===0)return t;return null}if(n.kind===0){let i=0;for(let t of n.records){let n=e(t);if(n>=0){let e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=e.getUint16(0);i=e.getUint32(2+n)}if(n<0)break}if(i===0)return null;t=i}else return null}}return{traverse:m,search:h,readNode:p,nodeSize:f,rootNode:l,firstLeafNode:d,leafRecords:u,treeDepth:c}}function cP(e){let{reader:t,volume:n,forkData:i}=e,a=i.logicalSize,o=0,s=[];for(let e of i.extents)e.blockCount>0&&s.push({diskOffset:e.startBlock*n.blockSize,length:e.blockCount*n.blockSize});let c=0,l=0;return new ReadableStream({async pull(e){if(o>=a){e.close();return}if(c>=s.length){e.close();return}let n=s[c],i=n.length-l,u=Math.min(i,65536,a-o),d=await t.read(n.diskOffset+l,u);l+=u,l>=n.length&&(c++,l=0);let f=a-o;u>f?(e.enqueue(d.subarray(0,f)),o+=f,e.close()):(e.enqueue(d),o+=u)}})}async function lP(e){let{reader:t,volume:n}=e,i=await sP({reader:t,volume:n,forkData:n.catalogFile}),a=new Map,o=new Map,s=new Map;await i.traverse(function(e){if(e.byteLength<6)return;let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getUint16(0);if(n<6||2+n>=e.byteLength)return;let i=t.getUint32(2),s=fP(e,8,t.getUint16(6)),l=2+n,u=l+l%2;if(u+2>e.byteLength)return;let d=t.getInt16(u);if(d===1){if(u+8>e.byteLength)return;let n=t.getUint32(u+8);a.set(n,{name:s,parentID:i}),c(i,s,n,`folder`)}else if(d===2){if(u+248>e.byteLength)return;let n=t.getUint32(u+8),a=uP(t.getUint16(u+42),t.getUint16(u+56)),l=dP(t,u+88),d=l.logicalSize;o.set(n,{name:s,parentID:i,size:d,forkData:l,type:a}),c(i,s,n,a)}});function c(e,t,n,i){s.has(e)||s.set(e,[]),s.get(e).push({name:t,cnid:n,type:i})}function l(e){let t=[],n=e;for(;n!==2&&n!==0;){let e=a.get(n),i=o.get(n);if(e)t.unshift(e.name),n=e.parentID;else if(i)t.unshift(i.name),n=i.parentID;else break}return`/`+t.join(`/`)}function u(e){let t=[];for(let[n,i]of a){let i=l(n);(!e||i.startsWith(e))&&t.push({path:i,size:0,type:`folder`})}for(let[n,i]of o){let a=l(n);(!e||a.startsWith(e))&&t.push({path:a,size:i.size,type:i.type})}return t.sort(function(e,t){return e.path<t.path?-1:+(e.path>t.path)}),t}function d(e){for(let[i,a]of o)if(l(i)===e)return cP({reader:t,volume:n,forkData:a.forkData});throw Error(`file not found: `+e)}return{list:u,readFile:d}}function uP(e,t){let n=e&61440;return n===40960?`symlink`:n===49152?`socket`:n===8192?`char-device`:n===24576?`block-device`:n===4096?`fifo`:t&32768?`alias`:`file`}function dP(e,t){let n=Number(e.getBigUint64(t)),i=e.getUint32(t+8),a=e.getUint32(t+12),o=[];for(let n=0;n<8;n++){let i=e.getUint32(t+16+n*8),a=e.getUint32(t+16+n*8+4);a>0&&o.push({startBlock:i,blockCount:a})}return{logicalSize:n,clumpSize:i,totalBlocks:a,extents:o}}function fP(e,t,n){let i=[];for(let a=0;a<n;a++){let n=e[t+a*2]<<8|e[t+a*2+1];i.push(String.fromCharCode(n))}return i.join(``)}async function pP(e){let t=HN(e);console.log(`koly:`,t);let n=UN(e,t.xmlOffset,t.xmlLength);console.log(`partitions:`,n.blkx.length,n.blkx.map(function(e){return e.name}));let i=n.blkx.map(function(e){return{...JN(e.data),name:e.name}}),a=i.find(function(e){return e.name.includes(`Apple_HFS`)})||i.reduce(function(e,t){return t.sectorCount>e.sectorCount?t:e});if(!a)throw Error(`no HFS partition found in DMG`);console.log(`HFS partition:`,a.name,`sectorNumber:`,a.sectorNumber,`sectorCount:`,a.sectorCount,`chunks:`,a.chunks.length),console.log(`first chunk:`,a.chunks[0]);let o=iP({arrayBuffer:e,partitions:[a],dataForkOffset:t.dataForkOffset}),s=await aP(o);console.log(`HFS+ volume: blockSize=`+s.blockSize+` totalBlocks=`+s.totalBlocks);let c=await lP({reader:o,volume:s});return{getEntries:l,readEntry:u,koly:t,volume:s};function l(e){return c.list(e)}function u(e){return c.readFile(e.startsWith(`/`)?e:`/`+e)}}async function mP(e){let t=await EA(e),n=t.getEntries(),a=await hP(t,n);return{getEntries:o,getEntry:s};async function o(){let e=n.find(e=>e.name===`collection.anki21`)??n.find(e=>e.name===`collection.anki2`),o=await t.getEntry(e.name),s=await i(o);try{let e=gP(s.query(`SELECT models FROM col`)[0].models);return{notes:s.query(`SELECT id, guid, mid, tags, flds FROM notes`).map(t=>_P(t,e)),models:e,mediaMap:a}}finally{await s.close()}}async function s(e){let n=a[e];return await t.getEntry(n)}}async function hP(e,t){let n={};if(t.find(e=>e.name===`media`)){let t=await e.getEntry(`media`),i=JSON.parse(new TextDecoder().decode(t));Object.keys(i).forEach(e=>{n[i[e]]=e})}return n}function gP(e){let t=JSON.parse(e),n={};return Object.keys(t).forEach(e=>{let i=t[e];n[e]={name:i.name,flds:i.flds.map(e=>({name:e.name,ord:e.ord})),tmpls:i.tmpls.map(e=>({name:e.name,qfmt:e.qfmt,afmt:e.afmt})),css:i.css}}),n}function _P(e,t){let n=t[String(e.mid)],i=e.flds.split(``),a={};return n&&n.flds.forEach(e=>{a[e.name]=i[e.ord]??``}),{id:Number(e.id),guid:e.guid,mid:String(e.mid),tags:e.tags,fields:a}}function vP(e,t,n){let i=!0;for(let a=0;a<n.length;a++)e[t+a]!==n.charCodeAt(a)&&(i=!1);return i}function yP(e){return vP(e,0,`SQLite format 3\0`)?`sqlite`:vP(e,8,`DUCK`)?`duckdb`:vP(e,0,`$FL2`)||vP(e,0,`$FL3`)?`sav`:vP(e,0,`HEADER RECORD*******LIBRARY HEADER RECORD`)?`xpt`:vP(e,0,`PAR1`)?`parquet`:vP(e,0,`Obj`)?`avro`:vP(e,0,`ORC`)?`orc`:null}async function bP(e,t,n=``){return await SP(e,e=>e.getEntries(t,n))}async function xP(e,t,n=0,i=1e3){return await SP(e,e=>e.getEntry(t,n,i))}async function SP(e,t){let{open:n,entryApi:i}=await CP(e),a=await n(e);try{return await t(i(a.query))}finally{await a.close()}}async function CP(e){if(yP(await wP(e))===`duckdb`){let e=(await import(`./duckdb.js`)).default,t=(await import(`./duckdbEntry.js`)).default;return Tt||await(await import(`./duckdbWasm.js`)).default(),{open:e,entryApi:t}}{let e=(await import(`./sqlite.js`)).default,t=(await import(`./sqliteEntry.js`)).default;return Tt||await(await import(`./sqliteWasm.js`)).default(),{open:e,entryApi:t}}}async function wP(e,t=64){if(typeof e==`string`){let{open:n}=await import(`node:fs/promises`),i=await n(e);try{let{buffer:e,bytesRead:n}=await i.read(new Uint8Array(t),0,t,0);return e.subarray(0,n)}finally{await i.close()}}else if(e&&typeof e.slice==`function`&&typeof e.arrayBuffer==`function`)return new Uint8Array(await e.slice(0,t).arrayBuffer());else return new Uint8Array(e).subarray(0,t)}function TP(e,t){let{path:n}=t,i={name:``,path:n,pathEntry:``,size:0,objectKind:`folder`,children:[]};return e.forEach(e=>{let t=e.name.endsWith(`/`),a=e.name.split(`/`).filter(e=>e!==``),o=i;a.forEach((i,s)=>{let c=s===a.length-1,l=a.slice(0,s+1).join(`/`),u=o.children.find(e=>e.name===i);u||(u={name:i,path:n,pathEntry:l,size:0,objectKind:`folder`,children:[]},o.children.push(u)),c&&!t?(u.objectKind=`file`,u.size=e.size,u.compressedSize=e.compressedSize,u.compMethod=e.compMethod,u.lastModified=e.lastModified,delete u.children):c&&t&&(u.size=e.size,u.lastModified=e.lastModified),o=u})}),i.children}function EP(e,t){let n=e;return t&&(n=[],e.forEach(e=>{e.pathEntry===t?n=e.children||[]:e.children&&t.startsWith(`${e.pathEntry}/`)&&(n=EP(e.children,t))})),n}function DP(e){let t=Dt(e?.path);if(t){let{archivePath:e,entryPath:n,kind:s}=t;return{archivePath:e,entryPath:n,kind:s,getObjects:a,getEntries:i,getEntry:o}}return;function n(i){return i.forEach(i=>{i.serviceType=e.serviceType,i.root=e.root,i.pathEntry&&(i.path=`${t.archivePath}/${i.pathEntry}`,i.isPackedEntry=!0),i.children&&n(i.children)}),i}async function i(e){let i,{kind:a}=t;if(a===`db`)i=await bP(e,t.archivePath,t.entryPath);else if(a===`dmg`)i=EP(TP((await pP(await OP(e))).getEntries(`/`).map(e=>({name:e.path.replace(/^\//,``)+(e.type===`folder`?`/`:``),size:e.size})),{path:t.archivePath}),t.entryPath);else if(a===`apkg`)return{payload:await(await mP(await OP(e))).getEntries()};else i=EP(TP((await EA(await OP(e))).getEntries(),{path:t.archivePath}),t.entryPath);return{payload:{children:n(i),meta:null}}}async function a(e){return await i(e)}async function o(e,n,i){let{kind:a,entryPath:o}=t;return a===`db`?{payload:await xP(e,o,n,i)}:a===`dmg`?await kP((await pP(await OP(e))).readEntry(o)):a===`apkg`?await(await mP(await OP(e))).getEntry(o):await(await EA(await OP(e))).getEntry(o)}}async function OP(e){return typeof e==`string`?await yk(e):e&&typeof e.arrayBuffer==`function`?await e.arrayBuffer():e}async function kP(e){return new Uint8Array(await new Response(e).arrayBuffer())}const AP=new Set([`if`,`else`,`for`,`while`,`do`,`switch`,`case`,`break`,`continue`,`return`,`throw`,`try`,`catch`,`finally`,`new`,`delete`,`typeof`,`instanceof`,`void`,`in`,`of`,`await`,`yield`,`class`,`super`]),jP=new Set(`console.log.warn.error.info.debug.setTimeout.setInterval.clearTimeout.clearInterval.parseInt.parseFloat.isNaN.isFinite.JSON.stringify.Math.Object.Array.String.Number.Boolean.RegExp.Date.Promise.Map.Set.WeakMap.WeakSet.Symbol.Proxy.Reflect.Error.TypeError.RangeError.require.module.exports.push.pop.shift.unshift.splice.slice.concat.forEach.map.filter.reduce.find.findIndex.some.every.includes.indexOf.lastIndexOf.join.split.trim.replace.match.search.test.exec.keys.values.entries.from.assign.freeze.hasOwnProperty.toString.valueOf.substring.startsWith.endsWith.padStart.padEnd.charAt.charCodeAt.codePointAt.toUpperCase.toLowerCase.getElementById.querySelector.querySelectorAll.createElement.createElementNS.appendChild.removeChild.setAttribute.getAttribute.addEventListener.removeEventListener.getBoundingClientRect.preventDefault.stopPropagation.then.catch.resolve.reject.all.race.fetch.Response.Request.Headers.atob.btoa.encodeURIComponent.decodeURIComponent.Function.Infinity.NaN.undefined.null.document.window.globalThis.self.has.add.get.set.delete.clear.size.apply.call.bind`.split(`.`));function MP(e){let t=e.replace(/\/\/.*$/gm,``);return t=t.replace(/\/\*[\s\S]*?\*\//g,``),t}function NP(e){return e.replace(/'(?:[^'\\]|\\.)*'/g,`''`).replace(/"(?:[^"\\]|\\.)*"/g,`""`).replace(/`(?:[^`\\]|\\.)*`/g,"``")}function PP(e,t,n){let i=e.substring(0,n).split(`
|
|
332
338
|
`).length,a=t.split(`
|
|
333
|
-
`),o=a[i-1]?a[i-1].trim():``;return{line:i,text:o.length>80?o.substring(0,80)+`…`:o}}function
|
|
334
|
-
`).length,f=u.index+u[0].length,p=
|
|
335
|
-
`).length-1,s=s.substring(g)}return i}function
|
|
336
|
-
`).length;a.push({name:e,line:t,exported:!0})}}return a}function
|
|
337
|
-
`);)n++;if(n>=e.length||e[n]!==`{`)return``;let a=0,o=n;for(;n<e.length;){if(e[n]===`{`)a++;else if(e[n]===`}`&&(a--,a===0))return e.substring(o+1,n);n++}return e.substring(o+1)}function
|
|
338
|
-
`),a=0;for(let e=0;e<i.length;e++){let o=i[e],s=a;a+=o.length+1;let c=o.trimStart();if(o.length-c.length>1||c.length===0||c.startsWith(`#`)||c.startsWith(`typedef`)||c.startsWith(`extern `)&&!c.includes(`(`))continue;let l=c.match(/^((?:(?:static|inline|extern|const|volatile)\s+)*)(\w[\w\s\*]*?)\b(\w+)\s*\(/);if(!l)continue;let u=l[1],d=l[2].trim(),f=l[3];if(
|
|
339
|
-
`).length-1;e+=S,a=s;for(let t=0;t<=e&&t<i.length;t++)if(t<=e){a=0;for(let t=0;t<=e;t++)a+=i[t].length+1;break}}return n}function
|
|
340
|
-
`),a=[],o=new Set;return i.forEach(function(e,t){let n=t+1,i=e.trim().length>80?e.trim().substring(0,80)+`…`:e.trim(),s=e.match(/<script[^>]+src=['"]([^'"]+)['"]/i);if(s){let e=s[1];o.has(e)||(o.add(e),a.push({path:e,symbols:[`default`],line:n,text:i}))}let c=e.match(/<link[^>]+href=['"]([^'"]+)['"]/i);if(c){let e=c[1];o.has(e)||(o.add(e),a.push({path:e,symbols:[],line:n,text:i}))}}),{filename:n,imports:a,exports:[],functions:[],variables:[]}}const
|
|
339
|
+
`),o=a[i-1]?a[i-1].trim():``;return{line:i,text:o.length>80?o.substring(0,80)+`…`:o}}function FP(e){let t=MP(e),n=new Set,i=[],a,o=/import\s+\{([^}]*)\}\s+from\s+['"]([^'"]+)['"]/g;for(;(a=o.exec(t))!==null;){let o=a[2];if(!n.has(o)){n.add(o);let s=a[1].split(`,`).map(function(e){return e.trim().split(/\s+as\s+/)[0].trim()}).filter(Boolean),{line:c,text:l}=PP(t,e,a.index);i.push({path:o,symbols:s,line:c,text:l})}}let s=/import\s+(?:\*\s+as\s+)?\w+\s+from\s+['"]([^'"]+)['"]/g;for(;(a=s.exec(t))!==null;){let o=a[1];if(!n.has(o)){n.add(o);let{line:s,text:c}=PP(t,e,a.index);i.push({path:o,symbols:[`default`],line:s,text:c})}}let c=/import\s+['"]([^'"]+)['"]/g;for(;(a=c.exec(t))!==null;){let o=a[1];if(!n.has(o)){n.add(o);let{line:s,text:c}=PP(t,e,a.index);i.push({path:o,symbols:[],line:s,text:c})}}let l=/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;for(;(a=l.exec(t))!==null;){let o=a[1];if(!n.has(o)){n.add(o);let{line:s,text:c}=PP(t,e,a.index);i.push({path:o,symbols:[],line:s,text:c})}}return i}function IP(e){let t=NP(MP(e)),n=new Set,i,a=/export\s+(?:async\s+)?function\s+(\w+)/g;for(;(i=a.exec(t))!==null;)n.add(i[1]);let o=/export\s+const\s+(\w+)/g;for(;(i=o.exec(t))!==null;)n.add(i[1]);let s=/export\s+default\s+(?:async\s+)?function\s+(\w+)/g;for(;(i=s.exec(t))!==null;)n.add(i[1]);let c=/export\s+default\s+(\w+)\s*;/g;for(;(i=c.exec(t))!==null;)AP.has(i[1])||n.add(i[1]);let l=/export\s*\{([^}]+)\}/g;for(;(i=l.exec(t))!==null;)i[1].split(`,`).forEach(function(e){let t=e.trim().split(/\s+as\s+/)[0].trim();t.length>0&&n.add(t)});return n}function LP(e){let t=new Set,n=0;for(;n<e.length;){let i=e[n],a=e.substring(n),o=a.match(/^(?:async\s+)?function\s+[a-zA-Z_$]\w*\s*\(/);if(o){for(n+=o[0].length;n<e.length&&e[n]!==`{`;)n++;if(n<e.length){let t=1;for(n++;n<e.length&&t>0;)e[n]===`{`?t++:e[n]===`}`&&t--,n++}continue}if(i===`{`||i===`}`){n++;continue}let s=a.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(s){let e=s[1];!AP.has(e)&&!jP.has(e)&&e!==`function`&&t.add(e),n+=s[0].length;continue}n++}return[...t]}function RP(e,t,n){let i=[],a=NP(MP(e)),o=0,s=a,c=/(?:export\s+)?(?:async\s+)?function\s+(\w+)\s*(?:<[^>()]*>)?\s*\(/,l=/(?:export\s+)?const\s+(\w+)\s*=\s*(?:async\s+)?(?:function\s*)?(?:<[^>()]*>)?\s*\(/;for(;s.length>0;){let e=c.exec(s),a=l.exec(s),u=null;if(e&&a)u=e.index<=a.index?e:a;else if(e)u=e;else if(a)u=a;else break;let d=o+s.substring(0,u.index).split(`
|
|
340
|
+
`).length,f=u.index+u[0].length,p=BP(s,f),m=LP(p),h=t.has(u[1]);n.includes(`interaction`)&&(console.log({name:u[1],line:d,calls:m}),console.log(`body`,p)),i.push({name:u[1],line:d,calls:m,exported:h});let g=f+p.length+1;o+=s.substring(0,g).split(`
|
|
341
|
+
`).length-1,s=s.substring(g)}return i}function zP(e,t,n){let i=NP(MP(e)),a=[],o,s=/(?:export\s+)?(?:const|let)\s+(\w+)\s*=/g;for(;(o=s.exec(i))!==null;){let e=o[1];if(t.has(e)&&!n.has(e)){let t=i.substring(0,o.index).split(`
|
|
342
|
+
`).length;a.push({name:e,line:t,exported:!0})}}return a}function BP(e,t){let n=t,i=1;for(;n<e.length;){let t=e[n];if(t===`(`){i++,n++;continue}if(t===`)`){if(i--,n++,i===0)break;continue}n++}for(;n<e.length;){let t=e[n];if(t===`{`)break;if(t===`=`&&e[n+1]===`>`){n+=2;break}if(t===`;`)return``;n++}if(n<e.length&&e[n]!==`{`)for(;n<e.length&&(e[n]===` `||e[n]===`
|
|
343
|
+
`);)n++;if(n>=e.length||e[n]!==`{`)return``;let a=0,o=n;for(;n<e.length;){if(e[n]===`{`)a++;else if(e[n]===`}`&&(a--,a===0))return e.substring(o+1,n);n++}return e.substring(o+1)}function VP(e){let t=e.replace(/\bimport\s+type\s+/g,`import `);return t=t.replace(/\bexport\s+type\s+(\w+)\s*=[^;]+;/g,`export const $1 = null;`),t=t.replace(/\bexport\s+interface\s+(\w+)[^{]*\{[^}]*\}/g,`export const $1 = {}`),t=t.replace(/\bexport\s+class\s+(\w+)/g,`export const $1 = class $1`),t=t.replace(/\bexport\s+enum\s+(\w+)[^{]*\{[^}]*\}/g,`export const $1 = {}`),t=t.replace(/\binterface\s+\w+[^{]*\{[^}]*\}/g,``),t}function HP(e){let{source:t,filename:n}=e,i=n.split(`.`).pop(),a=i===`ts`||i===`tsx`?VP(t):t,o=FP(a),s=IP(a),c=RP(a,s,n),l=zP(a,s,new Set(c.map(e=>e.name)));return{filename:n,imports:o,exports:[...s],functions:c,variables:l}}function UP(e){let{source:t,filename:n}=e,i=/@import\s+(?:url\s*\(\s*)?['"]([^'"]+)['"]\s*\)?/g,a,o=new Map;for(;(a=i.exec(t))!==null;){let e=a[1];o.has(e)||o.set(e,{path:e,symbols:[],line:null,text:null})}return{filename:n,imports:[...o.values()],exports:[],functions:[]}}const WP=new Set(`if.else.for.while.do.switch.case.break.continue.return.goto.default.sizeof.typeof.struct.union.enum.typedef.static.extern.const.volatile.register.inline.void.int.char.float.double.long.short.unsigned.signed.auto.restrict._Bool._Complex._Imaginary`.split(`.`)),GP=new Set(`printf.fprintf.sprintf.snprintf.scanf.fscanf.sscanf.puts.fputs.gets.fgets.putchar.getchar.putc.getc.fopen.fclose.fread.fwrite.fseek.ftell.rewind.fflush.malloc.calloc.realloc.free.memcpy.memmove.memset.memcmp.strcpy.strncpy.strcat.strncat.strcmp.strncmp.strlen.strchr.strrchr.strstr.strtok.strncasecmp.atoi.atof.atol.strtol.strtoul.strtod.strtoll.abs.labs.div.ldiv.exit.abort.atexit.system.getenv.qsort.bsearch.rand.srand.time.clock.difftime.mktime.clock_gettime.assert.perror.strerror.errno.isalpha.isdigit.isalnum.isspace.isupper.islower.toupper.tolower.sin.cos.tan.asin.acos.atan.atan2.exp.log.log10.pow.sqrt.ceil.floor.fabs.open.close.read.write.lseek.stat.fstat.mmap.munmap.mprotect.socket.bind.listen.accept.connect.send.recv.fork.exec.execv.execve.wait.waitpid.pipe.signal.raise.kill.pthread_create.pthread_join.pthread_mutex_lock.pthread_mutex_unlock.main.napi_throw_error.napi_get_undefined.napi_create_int32.napi_create_int64.napi_get_value_string_utf8.napi_get_value_int32.napi_typeof.napi_get_named_property.napi_get_value_bool.napi_get_value_double.napi_is_array.napi_get_array_length.napi_get_element.napi_create_array_with_length.napi_create_string_utf8.napi_set_element.napi_create_typedarray.napi_create_arraybuffer.napi_create_object.napi_set_named_property.napi_get_cb_info.napi_create_double.napi_define_properties.napi_property_descriptor`.split(`.`));function KP(e){let t=e.replace(/\/\/.*$/gm,``);return t=t.replace(/\/\*[\s\S]*?\*\//g,``),t}function qP(e){return e.replace(/'(?:[^'\\]|\\.)*'/g,`''`).replace(/"(?:[^"\\]|\\.)*"/g,`""`)}function JP(e){return e.replace(/^[ \t]*#(?:define|ifdef|ifndef|endif|else|elif|undef|pragma).*(?:\\\n.*)*$/gm,``)}function YP(e){let t=KP(e),n=new Map,i,a=/#include\s+"([^"]+)"/g;for(;(i=a.exec(t))!==null;){let e=i[1];n.has(e)||n.set(e,{path:e,symbols:[],line:null,text:null})}let o=/#include\s+<([^>]+)>/g;for(;(i=o.exec(t))!==null;){let e=`external:`+i[1];n.has(e)||n.set(e,{path:e,symbols:[],line:null,text:null})}return[...n.values()]}function XP(e,t){let n=t;if(e[n]!==`{`)return``;let i=0,a=n;for(;n<e.length;){if(e[n]===`{`)i++;else if(e[n]===`}`&&(i--,i===0))return e.substring(a+1,n);n++}return e.substring(a+1)}function ZP(e,t){let n=t;for(;n<e.length;){if(e[n]===`{`)return n;if(e[n]===`;`)return-1;n++}return-1}function QP(e){let t=qP(KP(e)),n=new Set,i=/\b([a-zA-Z_]\w*)\s*\(/g,a;for(;(a=i.exec(t))!==null;){let e=a[1];!WP.has(e)&&!GP.has(e)&&n.add(e)}return[...n]}function $P(e){let t=qP(JP(KP(e))),n=[],i=t.split(`
|
|
344
|
+
`),a=0;for(let e=0;e<i.length;e++){let o=i[e],s=a;a+=o.length+1;let c=o.trimStart();if(o.length-c.length>1||c.length===0||c.startsWith(`#`)||c.startsWith(`typedef`)||c.startsWith(`extern `)&&!c.includes(`(`))continue;let l=c.match(/^((?:(?:static|inline|extern|const|volatile)\s+)*)(\w[\w\s\*]*?)\b(\w+)\s*\(/);if(!l)continue;let u=l[1],d=l[2].trim(),f=l[3];if(WP.has(f)||d.length===0&&u.length===0||d.replace(/\*/g,``).trim().split(/\s+/).filter(e=>e.length>0).length===0&&!u.includes(`void`)&&!u.includes(`inline`)&&!u.trim().split(/\s+/).filter(e=>e.length>0).some(e=>e===`void`||e===`int`||e===`char`||e===`double`||e===`float`||e===`long`||e===`short`||e===`unsigned`||e===`signed`))continue;let p=s+o.indexOf(f)+f.length,m=0,h=p;for(;h<t.length;){if(t[h]===`(`)m++;else if(t[h]===`)`&&(m--,m===0))break;h++}if(m!==0)continue;let g=ZP(t,h+1);if(g===-1)continue;let _=XP(t,g),v=QP(_),y=/\bstatic\b/.test(u),b=e+1;n.push({name:f,line:b,calls:v,exported:!y});let x=g+_.length+2,S=t.substring(s,x).split(`
|
|
345
|
+
`).length-1;e+=S,a=s;for(let t=0;t<=e&&t<i.length;t++)if(t<=e){a=0;for(let t=0;t<=e;t++)a+=i[t].length+1;break}}return n}function eF(e){let t=qP(JP(KP(e))),n=[],i,a=/typedef\s+struct\s*\w*\s*\{/g;for(;(i=a.exec(t))!==null;){let e=i.index+i[0].length-1,a=XP(t,e),o=t.substring(e+a.length+2).trimStart().match(/^(\w+)\s*;/);o&&n.push(o[1])}let o=/\bstruct\s+(\w+)\s*\{/g;for(;(i=o.exec(t))!==null;)n.push(i[1]);return[...new Set(n)]}function tF(e){let{source:t,filename:n}=e,i=YP(t);n.endsWith(`.h`);let a=$P(t),o=eF(t),s=a.filter(e=>e.exported).map(e=>e.name);return{filename:n,imports:i,exports:[...new Set([...s,...o])],functions:a,variables:[]}}function nF(e){let{source:t,filename:n}=e,i=t.split(`
|
|
346
|
+
`),a=[],o=new Set;return i.forEach(function(e,t){let n=t+1,i=e.trim().length>80?e.trim().substring(0,80)+`…`:e.trim(),s=e.match(/<script[^>]+src=['"]([^'"]+)['"]/i);if(s){let e=s[1];o.has(e)||(o.add(e),a.push({path:e,symbols:[`default`],line:n,text:i}))}let c=e.match(/<link[^>]+href=['"]([^'"]+)['"]/i);if(c){let e=c[1];o.has(e)||(o.add(e),a.push({path:e,symbols:[],line:n,text:i}))}}),{filename:n,imports:a,exports:[],functions:[],variables:[]}}const rF=new Set(`if.else.elif.for.while.with.try.except.finally.return.yield.raise.pass.break.continue.del.assert.lambda.not.and.or.in.is.await.async.def.class.import.from.as.global.nonlocal`.split(`.`)),iF=new Set(`print.len.range.enumerate.zip.map.filter.sorted.reversed.list.dict.set.tuple.str.int.float.bool.bytes.bytearray.type.isinstance.issubclass.hasattr.getattr.setattr.delattr.open.super.object.property.staticmethod.classmethod.abs.max.min.sum.round.pow.divmod.hash.hex.oct.bin.repr.input.format.vars.dir.id.callable.compile.eval.exec.any.all.next.iter.slice.complex.frozenset.memoryview.Exception.ValueError.TypeError.KeyError.IndexError.AttributeError.RuntimeError.NotImplementedError.StopIteration.AssertionError.OSError.IOError.FileNotFoundError.PermissionError.ImportError.append.extend.insert.remove.pop.sort.index.count.update.get.keys.values.items.copy.clear.split.join.strip.replace.find.startswith.endswith.upper.lower.encode.decode.read.write.close`.split(`.`));function aF(e){let t=e.replace(/"""[\s\S]*?"""/g,`""`);return t=t.replace(/'''[\s\S]*?'''/g,`''`),t=t.replace(/#[^\n]*/g,``),t}function oF(e){let t=e.replace(/"""[\s\S]*?"""/g,`""`);return t=t.replace(/'''[\s\S]*?'''/g,`''`),t=t.replace(/"(?:[^"\\]|\\.)*"/g,`""`),t=t.replace(/'(?:[^'\\]|\\.)*'/g,`''`),t}function sF(e){let t=e.match(/^(\s*)/);return t?t[1].length:0}function cF(e){let t=aF(oF(e)),n=e.split(`
|
|
341
347
|
`),i=t.split(`
|
|
342
|
-
`),a=[];return i.forEach(function(e,t){let i=t+1,o=n[t]?n[t].trim():``,s=o.length>80?o.substring(0,80)+`…`:o,c=e.match(/^\s*from\s+(\.{0,3}[\w.]*)\s+import\s+(.+)$/);if(c){let e=c[1],t=c[2].trim().replace(/[()]/g,``),n;n=t.trim()===`*`?[`*`]:t.split(`,`).map(function(e){return e.trim().split(/\s+as\s+/)[0].trim()}).filter(Boolean),a.push({path:e,symbols:n,line:i,text:s});return}let l=e.match(/^\s*import\s+(.+)$/);l&&l[1].split(`,`).forEach(function(e){let t=e.trim().split(/\s+as\s+/)[0].trim();t&&a.push({path:t,symbols:[],line:i,text:s})})}),a}function
|
|
343
|
-
`),n=e.match(/__all__\s*=\s*\[([^\]]+)\]/);if(n){let e=n[1].match(/'([^']+)'|"([^"]+)"/g);if(e)return e.map(e=>e.replace(/['"]/g,``))}let i=[];for(let e of t){let t=e.match(/^(?:def|async\s+def|class)\s+(\w+)/);t&&i.push(t[1])}return i}function
|
|
344
|
-
`),n=[],i=0;for(;i<t.length;){let e=t[i].match(/^(async\s+)?def\s+(\w+)\s*\(/);if(e){let a=e[2],o=i+1,s=[];for(i++;i<t.length;){let e=t[i];if(e.trim()===``){s.push(e),i++;continue}if(
|
|
345
|
-
`));n.push({name:a,line:o,calls:c,exported:!0});continue}i++}return n}function
|
|
348
|
+
`),a=[];return i.forEach(function(e,t){let i=t+1,o=n[t]?n[t].trim():``,s=o.length>80?o.substring(0,80)+`…`:o,c=e.match(/^\s*from\s+(\.{0,3}[\w.]*)\s+import\s+(.+)$/);if(c){let e=c[1],t=c[2].trim().replace(/[()]/g,``),n;n=t.trim()===`*`?[`*`]:t.split(`,`).map(function(e){return e.trim().split(/\s+as\s+/)[0].trim()}).filter(Boolean),a.push({path:e,symbols:n,line:i,text:s});return}let l=e.match(/^\s*import\s+(.+)$/);l&&l[1].split(`,`).forEach(function(e){let t=e.trim().split(/\s+as\s+/)[0].trim();t&&a.push({path:t,symbols:[],line:i,text:s})})}),a}function lF(e){let t=aF(e).split(`
|
|
349
|
+
`),n=e.match(/__all__\s*=\s*\[([^\]]+)\]/);if(n){let e=n[1].match(/'([^']+)'|"([^"]+)"/g);if(e)return e.map(e=>e.replace(/['"]/g,``))}let i=[];for(let e of t){let t=e.match(/^(?:def|async\s+def|class)\s+(\w+)/);t&&i.push(t[1])}return i}function uF(e){let t=new Set,n=/\b([a-zA-Z_]\w*)\s*\(/g,i;for(;(i=n.exec(e))!==null;){let e=i[1];!rF.has(e)&&!iF.has(e)&&t.add(e)}return[...t]}function dF(e){let t=aF(oF(e)).split(`
|
|
350
|
+
`),n=[],i=0;for(;i<t.length;){let e=t[i].match(/^(async\s+)?def\s+(\w+)\s*\(/);if(e){let a=e[2],o=i+1,s=[];for(i++;i<t.length;){let e=t[i];if(e.trim()===``){s.push(e),i++;continue}if(sF(e)===0)break;s.push(e),i++}let c=uF(s.join(`
|
|
351
|
+
`));n.push({name:a,line:o,calls:c,exported:!0});continue}i++}return n}function fF(e){let{source:t,filename:n}=e;return{filename:n,imports:cF(t),exports:lF(t),functions:dF(t),variables:[]}}const pF=new Set(`if.else.match.for.while.loop.return.break.continue.let.mut.const.static.move.ref.where.impl.trait.struct.enum.type.mod.use.pub.fn.async.await.self.Self.super.crate.in.as`.split(`.`)),mF=new Set(`println.print.eprintln.eprint.format.panic.assert.assert_eq.assert_ne.todo.unimplemented.unreachable.dbg.vec.writeln.write.drop.clone.into.from.unwrap.expect.map.filter.fold.iter.collect.push.pop.len.is_empty.contains.get.insert.remove.to_string.to_owned.parse.trim.split.join.replace.Some.None.Ok.Err.Box.Vec.String.Option.Result`.split(`.`));function hF(e){let t=e.replace(/\/\/[^\n]*/g,``);return t=t.replace(/\/\*[\s\S]*?\*\//g,``),t}function gF(e){let t=e.replace(/r#+"[\s\S]*?"#+/g,`""`);return t=t.replace(/"(?:[^"\\]|\\.)*"/g,`""`),t=t.replace(/'(?:[^'\\]|\\.)*'/g,`''`),t}function _F(e,t){let n=t;for(;n<e.length&&e[n]!==`{`&&e[n]!==`;`;)n++;if(n>=e.length||e[n]===`;`)return``;let i=0,a=n;for(;n<e.length;){if(e[n]===`{`)i++;else if(e[n]===`}`&&(i--,i===0))return e.substring(a+1,n);n++}return e.substring(a+1)}function vF(e){let t=new Set,n=/\b([a-zA-Z_]\w*)\s*(?:::\s*\w+\s*)?\(/g,i;for(;(i=n.exec(e))!==null;){let e=i[1];!pF.has(e)&&!mF.has(e)&&t.add(e)}return[...t]}function yF(e,t,n,i){let a=e.match(/^(.*)::\{([^}]+)\}$/);if(a){let e=a[1],o=a[2].split(`,`).map(function(e){return e.trim().split(/\s+as\s+/)[0].trim()}).filter(Boolean);i.push({path:e,symbols:o,line:t,text:n});return}if(e.endsWith(`::*`)){i.push({path:e.slice(0,-3),symbols:[`*`],line:t,text:n});return}let o=e.split(`::`),s=o[o.length-1].split(/\s+as\s+/)[0].trim(),c=o.slice(0,-1).join(`::`);c?i.push({path:c,symbols:[s],line:t,text:n}):i.push({path:s,symbols:[],line:t,text:n})}function bF(e){let t=hF(e),n=e.split(`
|
|
346
352
|
`),i=[],a=/^\s*(?:pub\s+)?mod\s+(\w+)\s*;/gm,o;for(;(o=a.exec(t))!==null;){let e=t.substring(0,o.index).split(`
|
|
347
353
|
`).length,a=n[e-1]?n[e-1].trim():``;i.push({path:`./${o[1]}`,symbols:[],line:e,text:a})}let s=/^\s*(?:pub\s+)?use\s+([^;]+);/gm;for(;(o=s.exec(t))!==null;){let e=t.substring(0,o.index).split(`
|
|
348
|
-
`).length,a=n[e-1]?n[e-1].trim():``;
|
|
349
|
-
`).length,s=
|
|
354
|
+
`).length,a=n[e-1]?n[e-1].trim():``;yF(o[1].trim(),e,a,i)}return i}function xF(e){let t=hF(e),n=[],i=/\bpub(?:\s*\([^)]*\))?\s+(?:async\s+)?(?:fn|struct|enum|type|const|static)\s+(\w+)/g,a;for(;(a=i.exec(t))!==null;)n.push(a[1]);return n}function SF(e){let t=hF(gF(e)),n=[],i=/\b(pub(?:\s*\([^)]*\))?\s+)?(?:async\s+)?fn\s+(\w+)\s*(?:<[^>]*>)?\s*\(/g,a;for(;(a=i.exec(t))!==null;){let e=!!a[1],i=a[2],o=t.substring(0,a.index).split(`
|
|
355
|
+
`).length,s=vF(_F(t,a.index+a[0].length));n.push({name:i,line:o,calls:s,exported:e})}return n}function CF(e){let{source:t,filename:n}=e;return{filename:n,imports:bF(t),exports:xF(t),functions:SF(t),variables:[]}}const wF=new Set([`if`,`else`,`for`,`range`,`switch`,`case`,`default`,`select`,`return`,`break`,`continue`,`goto`,`fallthrough`,`var`,`const`,`type`,`func`,`struct`,`interface`,`map`,`chan`,`go`,`defer`,`import`,`package`]),TF=new Set(`make.new.len.cap.append.copy.delete.close.panic.recover.print.println.error.string.int.int8.int16.int32.int64.uint.uint8.uint16.uint32.uint64.float32.float64.complex64.complex128.bool.byte.rune.true.false.nil.iota`.split(`.`));function EF(e){let t=e.replace(/\/\/[^\n]*/g,``);return t=t.replace(/\/\*[\s\S]*?\*\//g,``),t}function DF(e){let t=e.replace(/`[^`]*`/g,"``");return t=t.replace(/"(?:[^"\\]|\\.)*"/g,`""`),t=t.replace(/'(?:[^'\\]|\\.)*'/g,`''`),t}function OF(e,t){let n=t;for(;n<e.length&&e[n]!==`{`;)n++;if(n>=e.length)return``;let i=0,a=n;for(;n<e.length;){if(e[n]===`{`)i++;else if(e[n]===`}`&&(i--,i===0))return e.substring(a+1,n);n++}return e.substring(a+1)}function kF(e){let t=new Set,n=/\b([a-zA-Z_]\w*)\s*\(/g,i;for(;(i=n.exec(e))!==null;){let e=i[1];!wF.has(e)&&!TF.has(e)&&t.add(e)}return[...t]}function AF(e){let t=EF(e),n=e.split(`
|
|
350
356
|
`),i=[],a=/\bimport\s*\(([^)]+)\)/g,o;for(;(o=a.exec(t))!==null;){let e=o[1],a=t.substring(0,o.index).split(`
|
|
351
357
|
`).length,s=/(?:[\w_.]+\s+)?["']([^"']+)["']/g,c,l=0;for(;(c=s.exec(e))!==null;){l=e.substring(0,c.index).split(`
|
|
352
358
|
`).length-1;let t=a+l,o=n[t-1]?n[t-1].trim():``;i.push({path:c[1],symbols:[],line:t,text:o})}}let s=/\bimport\s+(?:[\w_.]+\s+)?["']([^"']+)["']/g;for(;(o=s.exec(t))!==null;){let e=t.substring(0,o.index).split(`
|
|
353
|
-
`).length,a=n[e-1]?n[e-1].trim():``,s=t.substring(0,o.index),c=Math.max(s.lastIndexOf(`(`),s.lastIndexOf(`)`));(c===-1||t[c]!==`(`)&&i.push({path:o[1],symbols:[],line:e,text:a})}return i}function
|
|
354
|
-
`).length,s=
|
|
359
|
+
`).length,a=n[e-1]?n[e-1].trim():``,s=t.substring(0,o.index),c=Math.max(s.lastIndexOf(`(`),s.lastIndexOf(`)`));(c===-1||t[c]!==`(`)&&i.push({path:o[1],symbols:[],line:e,text:a})}return i}function jF(e){let t=EF(e),n=[],i=/\b(?:func\s+(?:\([^)]+\)\s+)?|type\s+|var\s+|const\s+)([A-Z]\w*)/g,a;for(;(a=i.exec(t))!==null;)n.push(a[1]);return n}function MF(e){let t=EF(DF(e)),n=[],i=/\bfunc\s+(?:\([^)]*\)\s+)?(\w+)\s*\(/g,a;for(;(a=i.exec(t))!==null;){let e=a[1],i=e[0]===e[0].toUpperCase()&&e[0]!==e[0].toLowerCase(),o=t.substring(0,a.index).split(`
|
|
360
|
+
`).length,s=kF(OF(t,a.index+a[0].length));n.push({name:e,line:o,calls:s,exported:i})}return n}function NF(e){let{source:t,filename:n}=e;return{filename:n,imports:AF(t),exports:jF(t),functions:MF(t),variables:[]}}const PF=new Set(`if.else.for.while.do.switch.case.default.return.break.continue.throw.try.catch.finally.new.instanceof.this.super.class.interface.enum.extends.implements.import.package.static.final.public.private.protected.abstract.synchronized.volatile.transient.native.strictfp.assert.void.var`.split(`.`)),FF=new Set(`System.out.println.print.printf.format.err.String.Integer.Long.Double.Float.Boolean.Object.Math.StringBuilder.StringBuffer.Arrays.Collections.equals.hashCode.toString.getClass.notify.wait.length.size.isEmpty.contains.get.put.add.remove.indexOf.substring.charAt.trim.replace.split.valueOf.parseInt.parseDouble`.split(`.`));function IF(e){let t=e.replace(/\/\/[^\n]*/g,``);return t=t.replace(/\/\*[\s\S]*?\*\//g,``),t}function LF(e){let t=e.replace(/"(?:[^"\\]|\\.)*"/g,`""`);return t=t.replace(/'(?:[^'\\]|\\.)*'/g,`''`),t}function RF(e,t){let n=t;for(;n<e.length&&e[n]!==`{`&&e[n]!==`;`;)n++;if(n>=e.length||e[n]===`;`)return``;let i=0,a=n;for(;n<e.length;){if(e[n]===`{`)i++;else if(e[n]===`}`&&(i--,i===0))return e.substring(a+1,n);n++}return e.substring(a+1)}function zF(e){let t=new Set,n=/\b([a-zA-Z_$][\w$]*)\s*\(/g,i;for(;(i=n.exec(e))!==null;){let e=i[1];!PF.has(e)&&!FF.has(e)&&t.add(e)}return[...t]}function BF(e){let t=IF(e),n=e.split(`
|
|
355
361
|
`),i=[],a=/^\s*import\s+(?:static\s+)?([^;]+);/gm,o;for(;(o=a.exec(t))!==null;){let e=t.substring(0,o.index).split(`
|
|
356
|
-
`).length,a=n[e-1]?n[e-1].trim():``,s=o[1].trim();if(s.endsWith(`.*`))i.push({path:s.slice(0,-2),symbols:[`*`],line:e,text:a});else{let t=s.split(`.`),n=t[t.length-1],o=t.slice(0,-1).join(`.`);i.push({path:o||s,symbols:[n],line:e,text:a})}}return i}function
|
|
357
|
-
`).length,s=
|
|
358
|
-
`),s=0;for(let e of o){let i=e.trimStart();if(e.length-i.length<=1&&i.includes(`(`)&&!i.startsWith(`static `)){let a=i.indexOf(`(`),o=i.substring(0,a).match(/((?:\w+::)*~?\w+)\s*$/);if(o){let i=o[1].split(`::`),a=i[i.length-1].replace(/^~/,``);a&&!
|
|
359
|
-
`),a=/^(?:template\b|using\b|namespace\b|class\s|if\s*\(|for\s*\(|while\s*\(|switch\s*\(|#)/,o=0;for(let e=0;e<i.length;e++){let s=i[e],c=s.trimStart();if(s.length-c.length>1||!c||!c.includes(`(`)||a.test(c)){o+=s.length+1;continue}let l=c.indexOf(`(`),u=c.substring(0,l),d=u.match(/((?:\w+::)*~?\w+)\s*$/);if(!d){o+=s.length+1;continue}let f=d[1],p=f.split(`::`),m=p[p.length-1].replace(/^~/,``);if(!m||
|
|
362
|
+
`).length,a=n[e-1]?n[e-1].trim():``,s=o[1].trim();if(s.endsWith(`.*`))i.push({path:s.slice(0,-2),symbols:[`*`],line:e,text:a});else{let t=s.split(`.`),n=t[t.length-1],o=t.slice(0,-1).join(`.`);i.push({path:o||s,symbols:[n],line:e,text:a})}}return i}function VF(e){let t=IF(e),n=[],i=/\bpublic\s+(?:static\s+)?(?:final\s+)?(?:abstract\s+)?(?:class|interface|enum)\s+(\w+)/g,a;for(;(a=i.exec(t))!==null;)n.push(a[1]);let o=/\bpublic\b[^({\n]*\s+(\w+)\s*\(/g;for(;(a=o.exec(t))!==null;){let e=a[1];PF.has(e)||n.push(e)}return n}function HF(e){let t=IF(LF(e)),n=[],i=/\b(public|private|protected)\b[^({\n]*\s+(\w+)\s*\(/g,a;for(;(a=i.exec(t))!==null;){let e=a[2];if(PF.has(e))continue;let i=a[1]===`public`,o=t.substring(0,a.index).split(`
|
|
363
|
+
`).length,s=zF(RF(t,a.index+a[0].length));n.push({name:e,line:o,calls:s,exported:i})}return n}function UF(e){let{source:t,filename:n}=e;return{filename:n,imports:BF(t),exports:VF(t),functions:HF(t),variables:[]}}const WF=new Set(`if.else.for.while.do.switch.case.break.continue.return.goto.default.sizeof.typeof.struct.union.enum.typedef.static.extern.const.volatile.register.inline.void.int.char.float.double.long.short.unsigned.signed`.split(`.`)),GF=new Set(`class.template.typename.namespace.using.new.delete.virtual.override.final.explicit.operator.friend.public.private.protected.try.catch.throw.const_cast.dynamic_cast.reinterpret_cast.static_cast.typeid.decltype.nullptr.true.false.this.constexpr.consteval.mutable.noexcept.bool.auto`.split(`.`));function KF(e){let t=e.replace(/\/\/[^\n]*/g,``);return t=t.replace(/\/\*[\s\S]*?\*\//g,``),t}function qF(e){return e.replace(/'(?:[^'\\]|\\.)*'/g,`''`).replace(/"(?:[^"\\]|\\.)*"/g,`""`)}function JF(e){return e.replace(/^[ \t]*#(?:define|ifdef|ifndef|endif|else|elif|undef|pragma).*(?:\\\n.*)*$/gm,``)}function YF(e,t){let n=t;for(;n<e.length;){if(e[n]===`{`)return n;if(e[n]===`;`)return-1;n++}return-1}function XF(e,t){let n=t,i=0,a=n;for(;n<e.length;){if(e[n]===`{`)i++;else if(e[n]===`}`&&(i--,i===0))return e.substring(a+1,n);n++}return e.substring(a+1)}function ZF(e){return YP(e)}function QF(e){let t=qF(JF(KF(e))),n=[],i=/\b(?:class|struct)\s+(\w+)\s*(?::|{)/g,a;for(;(a=i.exec(t))!==null;)n.push(a[1]);let o=t.split(`
|
|
364
|
+
`),s=0;for(let e of o){let i=e.trimStart();if(e.length-i.length<=1&&i.includes(`(`)&&!i.startsWith(`static `)){let a=i.indexOf(`(`),o=i.substring(0,a).match(/((?:\w+::)*~?\w+)\s*$/);if(o){let i=o[1].split(`::`),a=i[i.length-1].replace(/^~/,``);a&&!WF.has(a)&&!GF.has(a)&&YF(t,s+e.indexOf(o[1])+o[1].length)!==-1&&n.push(a)}}s+=e.length+1}return[...new Set(n)]}function $F(e){let t=qF(JF(KF(e))),n=[],i=t.split(`
|
|
365
|
+
`),a=/^(?:template\b|using\b|namespace\b|class\s|if\s*\(|for\s*\(|while\s*\(|switch\s*\(|#)/,o=0;for(let e=0;e<i.length;e++){let s=i[e],c=s.trimStart();if(s.length-c.length>1||!c||!c.includes(`(`)||a.test(c)){o+=s.length+1;continue}let l=c.indexOf(`(`),u=c.substring(0,l),d=u.match(/((?:\w+::)*~?\w+)\s*$/);if(!d){o+=s.length+1;continue}let f=d[1],p=f.split(`::`),m=p[p.length-1].replace(/^~/,``);if(!m||WF.has(m)||GF.has(m)){o+=s.length+1;continue}let h=YF(t,o+s.indexOf(f)+f.length);if(h===-1){o+=s.length+1;continue}let g=QP(XF(t,h)),_=!/\bstatic\b/.test(u);n.push({name:m,line:e+1,calls:g,exported:_}),o+=s.length+1}return n}function eI(e){let{source:t,filename:n}=e;return{filename:n,imports:ZF(t),exports:QF(t),functions:$F(t),variables:[]}}const tI=new Set(`if.else.for.foreach.while.do.switch.case.default.return.break.continue.throw.try.catch.finally.new.this.base.null.true.false.is.as.in.out.ref.class.interface.enum.struct.record.delegate.event.namespace.using.static.readonly.const.void.var.public.private.protected.internal.abstract.virtual.override.sealed.partial.async.await.yield`.split(`.`)),nI=new Set(`Console.WriteLine.Write.ReadLine.Read.String.Int32.Int64.Double.Boolean.Object.Type.Math.StringBuilder.Convert.Enum.Array.List.Dictionary.Task.Exception.DateTime.ToString.Equals.GetHashCode.GetType.Length.Count.Add.Remove.Contains.Clear.ToList.ToArray.Where.Select.FirstOrDefault.Any.Format.Parse.TryParse.Substring.Replace.Split.Trim`.split(`.`));function rI(e){let t=e.replace(/\/\/[^\n]*/g,``);return t=t.replace(/\/\*[\s\S]*?\*\//g,``),t}function iI(e){let t=e.replace(/@"(?:[^"]|"")*"/g,`""`);return t=t.replace(/"(?:[^"\\]|\\.)*"/g,`""`),t=t.replace(/'(?:[^'\\]|\\.)*'/g,`''`),t}function aI(e,t){let n=t;for(;n<e.length&&e[n]!==`{`&&e[n]!==`;`;)n++;if(n>=e.length||e[n]===`;`)return``;let i=0,a=n;for(;n<e.length;){if(e[n]===`{`)i++;else if(e[n]===`}`&&(i--,i===0))return e.substring(a+1,n);n++}return e.substring(a+1)}function oI(e){let t=new Set,n=/\b([a-zA-Z_$][\w$]*)\s*\(/g,i;for(;(i=n.exec(e))!==null;){let e=i[1];!tI.has(e)&&!nI.has(e)&&t.add(e)}return[...t]}function sI(e){let t=rI(e),n=e.split(`
|
|
360
366
|
`),i=[],a=/^\s*using\s+(?:static\s+)?(?:\w+\s*=\s*)?([^;]+);/gm,o;for(;(o=a.exec(t))!==null;){let e=t.substring(0,o.index).split(`
|
|
361
|
-
`).length,a=n[e-1]?n[e-1].trim():``;i.push({path:o[1].trim(),symbols:[],line:e,text:a})}return i}function
|
|
362
|
-
`).length,s=
|
|
367
|
+
`).length,a=n[e-1]?n[e-1].trim():``;i.push({path:o[1].trim(),symbols:[],line:e,text:a})}return i}function cI(e){let t=rI(e),n=[],i=/\bpublic\s+(?:static\s+)?(?:abstract\s+)?(?:sealed\s+)?(?:partial\s+)?(?:class|interface|enum|record|struct)\s+(\w+)/g,a;for(;(a=i.exec(t))!==null;)n.push(a[1]);let o=/\bpublic\b[^({\n]*\s+(\w+)\s*\(/g;for(;(a=o.exec(t))!==null;){let e=a[1];tI.has(e)||n.push(e)}return[...new Set(n)]}function lI(e){let t=rI(iI(e)),n=[],i=/\b(public|private|protected|internal)\b[^({\n]*\s+(\w+)\s*\(/g,a;for(;(a=i.exec(t))!==null;){let e=a[2];if(tI.has(e))continue;let i=a[1]===`public`,o=t.substring(0,a.index).split(`
|
|
368
|
+
`).length,s=oI(aI(t,a.index+a[0].length));n.push({name:e,line:o,calls:s,exported:i})}return n}function uI(e){let{source:t,filename:n}=e;return{filename:n,imports:sI(t),exports:cI(t),functions:lI(t),variables:[]}}const dI=new Set(`if.else.guard.switch.case.default.for.while.repeat.break.continue.return.throw.try.catch.defer.in.let.var.func.class.struct.enum.protocol.extension.import.deinit.subscript.typealias.associatedtype.where.as.is.nil.true.false.self.Self.super.static.override.final.lazy.weak.unowned.mutating.nonmutating.public.private.internal.fileprivate.open.required.optional.async.await.actor.init.inout.some.any`.split(`.`)),fI=new Set(`print.debugPrint.dump.assert.assertionFailure.precondition.preconditionFailure.fatalError.abort.exit.min.max.abs.stride.zip.sequence.repeatElement.type.Int.Int8.Int16.Int32.Int64.UInt.UInt8.UInt16.UInt32.UInt64.Float.Double.Bool.String.Character.Optional.Array.Dictionary.Set.Void.Never.AnyObject.Any.Error.UUID.Date.URL.Data.map.filter.reduce.flatMap.compactMap.forEach.sorted.contains.append.insert.remove.removeAll.count.isEmpty.first.last.resume.decode.encode.trimmingCharacters.dataTask`.split(`.`));function pI(e){let t=e.replace(/\/\/[^\n]*/g,``);return t=t.replace(/\/\*[\s\S]*?\*\//g,``),t}function mI(e){let t=e.replace(/"""[\s\S]*?"""/g,`""`);return t=t.replace(/"(?:[^"\\]|\\.)*"/g,`""`),t}function hI(e,t){let n=t,i=0;for(;n<e.length;){if(e[n]===`(`)i++;else if(e[n]===`)`)i>0&&i--;else if(e[n]===`{`&&i===0)break;else if(e[n]===`;`&&i===0)return``;n++}if(n>=e.length)return``;let a=0,o=n;for(;n<e.length;){if(e[n]===`{`)a++;else if(e[n]===`}`&&(a--,a===0))return e.substring(o+1,n);n++}return e.substring(o+1)}function gI(e){let t=new Set,n=/\b([a-zA-Z_]\w*)\s*\(/g,i;for(;(i=n.exec(e))!==null;){let e=i[1];!dI.has(e)&&!fI.has(e)&&t.add(e)}return[...t]}function _I(e){let t=pI(e),n=e.split(`
|
|
363
369
|
`),i=[],a=/^\s*(?:@\w+\s+)?import\s+(?:(?:class|struct|enum|protocol|typealias|func|var|let)\s+)?([A-Za-z_]\w*(?:\.[A-Za-z_]\w*)*)/gm,o;for(;(o=a.exec(t))!==null;){let e=o[1],a=t.substring(0,o.index).split(`
|
|
364
|
-
`).length,s=n[a-1]?n[a-1].trim():``;i.push({path:e,symbols:[],line:a,text:s})}return i}function
|
|
365
|
-
`).length,s=
|
|
366
|
-
`).length,o=
|
|
370
|
+
`).length,s=n[a-1]?n[a-1].trim():``;i.push({path:e,symbols:[],line:a,text:s})}return i}function vI(e){let t=pI(e),n=[],i=/\b(?:public|open)(?:\s*\([^)]*\))?\s+(?:(?:override|static|class|final|required|mutating|nonmutating|dynamic)\s+)*(?:func|class|struct|enum|protocol|typealias|var|let|actor)\s+([A-Za-z_]\w*)/g,a;for(;(a=i.exec(t))!==null;)n.push(a[1]);return n}function yI(e){let t=pI(mI(e)),n=[],i=/\b((?:public|open|internal|private|fileprivate)(?:\s*\([^)]*\))?\s+)?(?:(?:override|static|class|final|mutating|nonmutating|required|dynamic)\s+)*func\s+([A-Za-z_]\w*)\s*(?:<[^>]*>)?\s*\(/g,a;for(;(a=i.exec(t))!==null;){let e=!!(a[1]&&/\b(?:public|open)\b/.test(a[1])),i=a[2],o=t.substring(0,a.index).split(`
|
|
371
|
+
`).length,s=gI(hI(t,a.index+a[0].length));n.push({name:i,line:o,calls:s,exported:e})}let o=/\b((?:public|open|internal|private|fileprivate)(?:\s*\([^)]*\))?\s+)?(?:(?:required|override|convenience)\s+)*init\s*(?:<[^>]*>)?\s*\(/g;for(;(a=o.exec(t))!==null;){let e=!!(a[1]&&/\b(?:public|open)\b/.test(a[1])),i=t.substring(0,a.index).split(`
|
|
372
|
+
`).length,o=gI(hI(t,a.index+a[0].length));n.push({name:`init`,line:i,calls:o,exported:e})}return n}function bI(e){let{source:t,filename:n}=e;return{filename:n,imports:_I(t),exports:vI(t),functions:yI(t),variables:[]}}function xI(e){let{parseResults:t,showExternal:n}=e,i=[],a=[],o=new Set(t.map(e=>e.filename)),s=new Set;t.forEach(function(e){console.log(e);let t=e.filename.split(`/`),c=t[t.length-1],l=[];e.functions.forEach(function(e){e.exported&&l.push(e.name)}),e.variables&&e.variables.forEach(function(e){e.exported&&l.push(e.name)}),i.push({id:e.filename,label:c,path:e.filename,entries:l,type:`file`}),e.imports.forEach(function(t){let i=CI(e.filename,t.path,o),c=t.line==null?null:[{line:t.line,text:t.text}];if(i)a.push({source:e.filename,target:i,symbols:t.symbols,lineRefs:c});else if(n){let n=SI(t.path);n&&(s.add(n),a.push({source:e.filename,target:n,symbols:t.symbols,lineRefs:c}))}})}),s.forEach(function(e){let t=e.replace(`external:`,``);i.push({id:e,label:t,path:e,entries:[],type:`external`})});let c={},l=new Set;t.forEach(function(e){e.functions.forEach(function(t){t.exported&&(c[t.name]&&c[t.name]!==e.filename?l.add(t.name):c[t.name]=e.filename)})}),l.forEach(function(e){delete c[e]});let u=new Set(a.map(function(e){return e.source+`->`+e.target}));return t.forEach(function(e){e.functions.forEach(function(t){t.calls.forEach(function(t){let n=c[t];if(n&&n!==e.filename){let i=e.filename+`->`+n;u.has(i)||(u.add(i),a.push({source:e.filename,target:n,symbols:[t],lineRefs:null}))}})})}),{nodes:i,edges:a}}function SI(e){return e.startsWith(`external:`)?e:!e.startsWith(`.`)&&!e.startsWith(`/`)?`external:`+e:null}function CI(e,t,n){if(t.startsWith(`external:`))return null;if(t.startsWith(`.`)){let i=t,a=t.match(/^(\.+)([^/].*)$/);if(a){let e=a[1].length,t=a[2];i=e===1?`./`+t:`../`.repeat(e-1)+t}let o=e.substring(0,e.lastIndexOf(`/`));return wI(TI((o?o+`/`:``)+i),n)}if(t.startsWith(`/`)){let i=t.substring(1),a=wI(i,n);if(a)return a;let o=e.substring(0,e.lastIndexOf(`/`));for(;o;){let e=wI(TI(o+`/`+i),n);if(e)return e;let t=o.lastIndexOf(`/`);if(t<=0)break;o=o.substring(0,t)}return null}let i=e.substring(0,e.lastIndexOf(`/`));if(i){let e=wI(TI(i+`/`+t),n);if(e)return e}let a=wI(t,n);if(a)return a;let o=t.indexOf(`/`);if(o!==-1){let e=wI(TI(t.substring(o+1)),n);if(e)return e}if(t.includes(`/`)){let e=t.split(`/`);for(let t=2;t<e.length;t++){let i=e.slice(t).join(`/`),a=wI(i,n);if(a)return a;for(let e of n)if(e.startsWith(i+`/`))return e}let i=e[e.length-1];for(let e of n)if(e.startsWith(i+`/`))return e}if(!t.includes(`/`)&&t.includes(`.`)){let e=t.replace(/\./g,`/`),i=wI(e,n);if(i)return i;for(let t of n)if(t.startsWith(e+`/`)||t.includes(`/`+e+`/`))return t}return null}function wI(e,t){if(t.has(e))return e;let n={".js":[`.ts`,`.tsx`],".jsx":[`.tsx`]},i=e.lastIndexOf(`.`);if(i!==-1){let a=n[e.substring(i)];if(a){let n=e.substring(0,i);for(let e of a)if(t.has(n+e))return n+e}}let a=[`.js`,`.jsx`,`.mjs`,`.ts`,`.tsx`,`.css`,`.c`,`.h`,`.py`,`.rs`,`.go`,`.java`,`.cpp`,`.cc`,`.cxx`,`.hpp`,`.hxx`,`.cs`,`.swift`];for(let n of a)if(t.has(e+n))return e+n;for(let n of a)if(t.has(e+`/index`+n))return e+`/index`+n;return null}function TI(e){let t=e.startsWith(`/`),n=e.split(`/`),i=[];n.forEach(function(e){e===`..`?i.pop():e!==`.`&&e!==``&&i.push(e)});let a=i.join(`/`);return t?`/`+a:a}const EI=new Set([`.js`,`.jsx`,`.mjs`,`.ts`,`.tsx`,`.css`,`.c`,`.h`,`.html`,`.py`,`.rs`,`.go`,`.java`,`.cpp`,`.cc`,`.cxx`,`.hpp`,`.hxx`,`.cs`,`.swift`]),DI=new Set([`node_modules`,`.git`,`dist`,`build`,`.vite`]),OI={".js":HP,".jsx":HP,".mjs":HP,".ts":HP,".tsx":HP,".css":UP,".c":tF,".h":tF,".html":nF,".py":fF,".rs":CF,".go":NF,".java":UF,".cpp":eI,".cc":eI,".cxx":eI,".hpp":eI,".hxx":eI,".cs":uI,".swift":bI};Object.keys(OI);function kI(e){let{source:t,filename:n}=e,i=`.`+n.split(`.`).pop(),a=OI[i];return a?a({source:t,filename:n}):null}const AI=new Set([]);function jI(e){let t=e.lastIndexOf(`.`);return t===-1?``:e.substring(t)}function MI(e,t){return t.some(function(t){return RegExp(`^`+t.replace(/\./g,`\\.`).replace(/\*/g,`.*`)+`$`).test(e)})}async function NI(e){let{root:t,extraRoots:n=[],exclude:i}=e,a=i||[],o=[],s=await vk(DI,AI);for await(let[e,n]of s(t)){let t=e.replace(/^\//,``);if(!EI.has(jI(t))||MI(t,a))continue;let i=kI({source:await bk(n),filename:t});i&&o.push(i)}if(n&&n.length>0)for(let e of n)for await(let[t,n]of s(e)){let e=t.replace(/^\//,``);if(!EI.has(jI(e))||MI(e,a))continue;let i=kI({source:await bk(n),filename:e});i&&o.push(i)}return o}async function PI(e){let{handle:t}=e,n=await NI({root:[`/`,t]});return console.log(n),xI({parseResults:n})}function FI(e,t){let n=new Set;return new Proxy(t,{get(t,i){return i in t||n.has(i)||(n.add(i),console.warn(`${e} does not exist for key ${i}`)),t[i]}})}function II(e,t,n){return FI(e,Object.fromEntries(n.map(e=>[e,`${t}${e}`])))}function LI(){return`
|
|
367
373
|
/* Firefox */
|
|
368
374
|
.slim_scrollbar {
|
|
369
375
|
scrollbar-width: thin;
|
|
@@ -390,7 +396,7 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
390
396
|
border: 2px solid transparent; /* creates gap = invisible track */
|
|
391
397
|
background-clip: content-box;
|
|
392
398
|
}
|
|
393
|
-
`}const X=EF(`a`,`a:`,`left.right.top.bottom.tblGrid.gridCol.txBody.tableStyleId.tcTxStyle.tcStyle.fill.wholeTbl.band1H.band2H.band1V.band2V.lastCol.firstCol.lastRow.firstRow.tint.tcBdr.gd.headEnd.tailEnd.hlinkClick.themeElements.fmtScheme.bgFillStyleLst.clrScheme.minorFont.fontScheme.blip.srcRect.stretch.tile.fillRect.sz.algn.lvl.lnRef.fillRef.fontRef.gsLst.majorFont.minorFont.objectDefaults.spDefm.defPPr.effectStyle.bevelB.bevelT.camera.contourClr.extrusionClr.lightRig.scene3d.sp3d.buAutoNum.buBlip.buChar.buClr.buClrTx.buFont.buNone.buSzPct.buSzPts.buSzTx.hslClr.prstClr.schemeClr.scrgbClr.srgbClr.sysClr.blur.effectDag.effectLst.glow.innerShdw.outerShdw.reflection.softEdge.bgClr.blipFill.fgClr.gradFill.noFill.pattFill.solidFill.cs.ea.latin.sym.typeface.ahLst.avLst.custGeom.cxnLst.gdLst.path.pathLst.prstGeom.rect.graphic.graphicData.bevel.custDash.ln.miter.prstDash.round.ext.extLst.lvl1pPr.lvl2pPr.lvl3pPr.lvl4pPr.lvl5pPr.lvl6pPr.lvl7pPr.lvl8pPr.lvl9pPr.lnSpc.spcAft.spcBef.gridCol.tbl.tblGrid.tblPr.tc.tcPr.tr.tab.tabLst.bodyPr.br.defRPr.endParaRPr.fld.lnBrk.lstStyle.p.pPr.r.rPr.t.custTxWarp.flatTx.noAutofit.normAutofit.prstTxWarp.spAutoFit.ext.off.xfrm`.split(`.`)),OF=EF(`a`,``,`algn.lvl.rtl.anchor.anchorCtr.compatLnSpc.forceAA.fromWordArt.horzOverflow.numCol.rot.rtlCol.spcCol.spcFirstLastPara.upright.vert.vertOverflow.wrap.startAt.type.b.baseline.cap.i.kern.lang.altLang.strike.sz.u.cx.cy.h.w.x.y.char.descr.hidden.id.idx.name.prst.typeface.bIns.lIns.rIns.tIns.dir.lat.lon.rev.rig.defTabSz.indent.marL.marR.dirty.err.uri.val.fill.pathH.pathW.stroke.spcPct.spcPts.scheme.style.theme`.split(`.`));var kF={aliceblue:`#F0F8FF`,antiquewhite:`#FAEBD7`,aqua:`#00FFFF`,aquamarine:`#7FFFD4`,azure:`#F0FFFF`,beige:`#F5F5DC`,bisque:`#FFE4C4`,black:`#000000`,blanchedalmond:`#FFEBCD`,blue:`#0000FF`,blueviolet:`#8A2BE2`,brown:`#A52A2A`,burlywood:`#DEB887`,cadetblue:`#5F9EA0`,chartreuse:`#7FFF00`,chocolate:`#D2691E`,coral:`#FF7F50`,cornflowerblue:`#6495ED`,cornsilk:`#FFF8DC`,crimson:`#DC143C`,cyan:`#00FFFF`,darkblue:`#00008B`,darkcyan:`#008B8B`,darkgoldenrod:`#B8860B`,darkgray:`#A9A9A9`,darkgreen:`#006400`,darkgrey:`#A9A9A9`,darkkhaki:`#BDB76B`,darkmagenta:`#8B008B`,darkolivegreen:`#556B2F`,darkorange:`#FF8C00`,darkorchid:`#9932CC`,darkred:`#8B0000`,darksalmon:`#E9967A`,darkseagreen:`#8FBC8F`,darkslateblue:`#483D8B`,darkslategray:`#2F4F4F`,darkslategrey:`#2F4F4F`,darkturquoise:`#00CED1`,darkviolet:`#9400D3`,deeppink:`#FF1493`,deepskyblue:`#00BFFF`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1E90FF`,firebrick:`#B22222`,floralwhite:`#FFFAF0`,forestgreen:`#228B22`,fuchsia:`#FF00FF`,gainsboro:`#DCDCDC`,ghostwhite:`#F8F8FF`,gold:`#FFD700`,goldenrod:`#DAA520`,gray:`#808080`,green:`#008000`,greenyellow:`#ADFF2F`,grey:`#808080`,honeydew:`#F0FFF0`,hotpink:`#FF69B4`,indianred:`#CD5C5C`,indigo:`#4B0082`,ivory:`#FFFFF0`,khaki:`#F0E68C`,lavender:`#E6E6FA`,lavenderblush:`#FFF0F5`,lawngreen:`#7CFC00`,lemonchiffon:`#FFFACD`,lightblue:`#ADD8E6`,lightcoral:`#F08080`,lightcyan:`#E0FFFF`,lightgoldenrodyellow:`#FAFAD2`,lightgray:`#D3D3D3`,lightgreen:`#90EE90`,lightgrey:`#D3D3D3`,lightpink:`#FFB6C1`,lightsalmon:`#FFA07A`,lightseagreen:`#20B2AA`,lightskyblue:`#87CEFA`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#B0C4DE`,lightyellow:`#FFFFE0`,lime:`#00FF00`,limegreen:`#32CD32`,linen:`#FAF0E6`,magenta:`#FF00FF`,maroon:`#800000`,mediumaquamarine:`#66CDAA`,mediumblue:`#0000CD`,mediumorchid:`#BA55D3`,mediumpurple:`#9370DB`,mediumseagreen:`#3CB371`,mediumslateblue:`#7B68EE`,mediumspringgreen:`#00FA9A`,mediumturquoise:`#48D1CC`,mediumvioletred:`#C71585`,midnightblue:`#191970`,mintcream:`#F5FFFA`,mistyrose:`#FFE4E1`,moccasin:`#FFE4B5`,navajowhite:`#FFDEAD`,navy:`#000080`,oldlace:`#FDF5E6`,olive:`#808000`,olivedrab:`#6B8E23`,orange:`#FFA500`,orangered:`#FF4500`,orchid:`#DA70D6`,palegoldenrod:`#EEE8AA`,palegreen:`#98FB98`,paleturquoise:`#AFEEEE`,palevioletred:`#DB7093`,papayawhip:`#FFEFD5`,peachpuff:`#FFDAB9`,peru:`#CD853F`,pink:`#FFC0CB`,plum:`#DDA0DD`,powderblue:`#B0E0E6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#FF0000`,rosybrown:`#BC8F8F`,royalblue:`#4169E1`,saddlebrown:`#8B4513`,salmon:`#FA8072`,sandybrown:`#F4A460`,seagreen:`#2E8B57`,seashell:`#FFF5EE`,sienna:`#A0522D`,silver:`#C0C0C0`,skyblue:`#87CEEB`,slateblue:`#6A5ACD`,slategray:`#708090`,slategrey:`#708090`,snow:`#FFFAFA`,springgreen:`#00FF7F`,steelblue:`#4682B4`,tan:`#D2B48C`,teal:`#008080`,thistle:`#D8BFD8`,tomato:`#FF6347`,turquoise:`#40E0D0`,violet:`#EE82EE`,wheat:`#F5DEB3`,white:`#FFFFFF`,whitesmoke:`#F5F5F5`,yellow:`#FFFF00`,yellowgreen:`#9ACD32`};const AF=/^[0-9a-fA-F]{3}|[0-9a-fA-F]{6}$/,jF=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,MF=/^[a-zA-Z]+$/;function NF(e,t,n){for(let n of t){let t=n?.clrMap?.resolveColor(e);if(t)return t}console.log(`${e} not able to resolve, might missing upstreams parameter`)}function PF(e,t){let n=t/1e5;e=e.replace(`#`,``);let i=parseInt(e.substr(0,2),16),a=parseInt(e.substr(2,2),16),o=parseInt(e.substr(4,2),16);return i=Math.round(i+(255-i)*n),a=Math.round(a+(255-a)*n),o=Math.round(o+(255-o)*n),`#`+((1<<24)+(i<<16)+(a<<8)+o).toString(16).slice(1)}function FF(e){if(e)return AF.test(e)?`#${e}`:jF.test(e)?e:MF.test(e)?kF[e]:`#${e}`}function IF(e,t,n,i){let a=Y(e,t),o=xO(a,[X.srgbClr],`val`);if(o){let e=bO(a,[X.srgbClr,X.tint],`val`)??0;return PF(FF(o),e)}let s=xO(a,[X.schemeClr],`val`);if(s){let e=bO(a,[X.schemeClr,X.tint],`val`)??0;return PF(FF(NF(s,n,i)),e)}}function LF(e,t,n,i){let a=Y(e,t),o=xO(a,[X.srgbClr],`val`);if(o)return FF(o);let s=xO(a,[X.schemeClr],`val`);if(s)return FF(NF(s,n,i))}function RF(e){return e=e.replace(`#`,``),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),{r:parseInt(e.slice(0,2),16),g:parseInt(e.slice(2,4),16),b:parseInt(e.slice(4,6),16)}}function zF(e,t){if(!e)return null;let n=e;kF[e.toLowerCase()]&&(n=kF[e.toLowerCase()]);let{r:i,g:a,b:o}=RF(n);return`rgba(${i}, ${a}, ${o}, ${t})`}const BF={l:`start`,ctr:`middle`,r:`end`};function VF(e){return BF[e]}const HF={r:`text-align: right;`,ctr:`text-align: center;`};function UF(e){return HF[e]??``}function WF(e){return e?Math.round(parseInt(e)/952.5)/10:0}function GF(e,t=null){return e?e/6e4:t}function KF(e,t,n,i){let a=xO(e,t,n,i);return a&&WF(a)}function qF(e,t=[],n=`sz`,i=void 0){let a=bO(e,t,n);return a?a/100:i}function JF(e,t=null){return e?`#`+e:t}function YF(e){if(e)for(let t of e){let e=t.codePointAt(0);if(e>=19968&&e<=40959||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=13312&&e<=19903||e>=65280&&e<=65519)return`ea`;if(e>=1424&&e<=1535||e>=1536&&e<=1791||e>=1792&&e<=1871||e>=3584&&e<=3711||e>=2304&&e<=2431)return`cs`}return`latin`}function XF(e,t){if(e){let n=bO(e,[],`blurRad`),i=bO(e,[],`dist`),a=bO(e,[],`dir`),o=yO(e,[],`alpha`)||.5,s=LF(e,[],t.upstreams,t.theme),c=Math.round(n/914400*96),l=i/914400*96,u=a/6e4*(Math.PI/180);return`drop-shadow(${Math.round(l*Math.cos(u))}px ${Math.round(l*Math.sin(u))}px ${c}px ${zF(s,o)});`}return``}const Z=EF(`p`,`p:`,`bgRef.xfrm.nvPicPr.audio.bg.bgPr.blipFill.bodyStyle.clrMap.clrMapOvr.cNvGraphicFramePr.cNvGrpSpPr.cNvPr.cNvSpPr.cSld.cTn.cxnSp.defaultTextStyle.graphicFrame.grpSp.notes.notesMaster.nvGraphicFramePr.nvGrpSpPr.nvPicPr.nvPr.nvSpPr.nvCxnSpPr.otherStyle.par.ph.pic.presentation.seq.sld.sldIdLst.sldId.sldLayout.sldMaster.sldSz.sndAc.sp.spPr.spTree.style.timing.titleStyle.transition.txBody.txStyles.video`.split(`.`));EF(`p`,``,[`bwMode`,`dir`,`id`,`idx`,`lvl`,`name`,`orient`,`show`,`sz`,`title`,`type`,`useBgFill`]);const ZF=EF(`c`,`c:`,`axId.catAx.dateAx.logBase.majorUnit.max.min.minorUnit.orientation.scaling.serAx.tickLblPos.valAx.chart.chartSpace.legend.legendPos.overlay.plotArea.title.areaChart.barChart.bubbleChart.lineChart.pieChart.radarChart.scatterChart.stockChart.surfaceChart.f.numLit.numRef.pt.ptCount.strLit.strRef.v.gapWidth.overlap.varyColors.dLbl.dLbls.marker.size.symbol.errBars.explosion.smooth.trendline.dPt.order.ser.spPr.tx`.split(`.`));EF(`c`,``,[`crossAx`,`crosses`,`crossesAt`,`delete`,`formatCode`,`layout`,`pos`,`showCatName`,`showLeaderLines`,`showPercent`,`showSerName`,`showVal`,`sourceLinked`,`val`]);function QF(e){if(e){let t=J(e,X.off),n=J(e,X.ext),{flipH:i=0,flipV:a=0,rot:o=0}=e.attributes,s=GF(o),c=t?WF(t.attributes.x):0,l=t?WF(t.attributes.y):0,u=n?WF(n.attributes.cx):0,d=n?WF(n.attributes.cy):0;return{$xfrm:e,x:c,y:l,width:u,height:d,x1:i?u:0,y1:a?d:0,x2:i?0:u,y2:a?0:d,flipH:+i,flipV:+a,rotation:s}}}var $F=EF(`r`,`r:`,[`id`,`embed`,`link`]);function eI(e,t){if(t){let n=t.placeholder2Shapes;if(n){let{placeholderIndex:t,placeholderType:i}=e;if(t!==void 0&&n[t])return n[t];if(i!==void 0&&n[i])return n[i]}}}function tI(e,t){Object.keys(t).forEach(n=>e[n]=t[n])}function nI(e){let{$sp:t,shape:n,upstreams:i,theme:a,presentation:o}=e,s=Y(t,[Z.spPr]);return tI(e,{render:c,getCap:m,toGeometryPath:u,getHeadEnd:f,getTailEnd:p,getShapeFill:h,getStroke:g,getStrokeWidth:_}),e;function c(){return`${u({prst:xO(s,[X.prstGeom],`prst`)})}`}function l(){let e=Y(s,[X.prstGeom,X.avLst]),t={};if(e){for(let n of e.children||[])if(n.name===X.gd&&n.attributes?.name&&n.attributes?.fmla){let e=n.attributes.name,i=n.attributes.fmla.match(/val\s+(\d+)/);i&&(t[e]=parseInt(i[1],10))}}return t}function u({prst:e}){let{width:t,height:i,x1:a,y1:o,x2:s,y2:c}=n.getXForm(),u=v(),f=l();g();let p=g(),m={fill:`none`,stroke:`transparent`};p&&(m.stroke=p,m[`stroke-width`]=_());let h=d();h&&(m.filter=h);let y=Object.entries(m).map(([e,t])=>`${e}="${t}"`).join(` `);if(e){if(e===`line`)return`<line desc="shape-decoration" x1="0" y1="0" x2="${t}" y2="${i}" ${y} fill="${p} style="${u}">`;if(e===`ellipse`)return`<ellipse desc="shape-decoration" cx="${t/2}" cy="${i/2}" rx="${t/2}" ry="${i/2}" ${y} style="${u}"/>`;if(e===`roundRect`){let e=(f?.adj||16667)/1e5*Math.min(t,i);return`<rect desc="shape-decoration" x="0" y="0" width="${t}" height="${i}" rx="${e}" ry="${e}" ${y} style="${u}"/>`}if(e===`round2SameRect`){let e=f?.adj1??16667;if((f?.adj2??0)===0){let n=e/1e5*Math.min(t,i);return`<rect desc="shape-decoration" x="0" y="0" width="${t}" height="${i}" rx="${n}" ry="${n}" ${y} style="${u}"/>`}{let e=t,n=i,a=inset,o=inset,s=e-2*inset,c=n-2*inset,l=Math.max(0,r-inset);return`<path desc="shape-decoration" d="${`
|
|
399
|
+
`}const X=II(`a`,`a:`,`left.right.top.bottom.tblGrid.gridCol.txBody.tableStyleId.tcTxStyle.tcStyle.fill.wholeTbl.band1H.band2H.band1V.band2V.lastCol.firstCol.lastRow.firstRow.tint.tcBdr.gd.headEnd.tailEnd.hlinkClick.themeElements.fmtScheme.bgFillStyleLst.clrScheme.minorFont.fontScheme.blip.srcRect.stretch.tile.fillRect.sz.algn.lvl.lnRef.fillRef.fontRef.gsLst.majorFont.minorFont.objectDefaults.spDefm.defPPr.effectStyle.bevelB.bevelT.camera.contourClr.extrusionClr.lightRig.scene3d.sp3d.buAutoNum.buBlip.buChar.buClr.buClrTx.buFont.buNone.buSzPct.buSzPts.buSzTx.hslClr.prstClr.schemeClr.scrgbClr.srgbClr.sysClr.blur.effectDag.effectLst.glow.innerShdw.outerShdw.reflection.softEdge.bgClr.blipFill.fgClr.gradFill.noFill.pattFill.solidFill.cs.ea.latin.sym.typeface.ahLst.avLst.custGeom.cxnLst.gdLst.path.pathLst.prstGeom.rect.graphic.graphicData.bevel.custDash.ln.miter.prstDash.round.ext.extLst.lvl1pPr.lvl2pPr.lvl3pPr.lvl4pPr.lvl5pPr.lvl6pPr.lvl7pPr.lvl8pPr.lvl9pPr.lnSpc.spcAft.spcBef.gridCol.tbl.tblGrid.tblPr.tc.tcPr.tr.tab.tabLst.bodyPr.br.defRPr.endParaRPr.fld.lnBrk.lstStyle.p.pPr.r.rPr.t.custTxWarp.flatTx.noAutofit.normAutofit.prstTxWarp.spAutoFit.ext.off.xfrm`.split(`.`)),RI=II(`a`,``,`algn.lvl.rtl.anchor.anchorCtr.compatLnSpc.forceAA.fromWordArt.horzOverflow.numCol.rot.rtlCol.spcCol.spcFirstLastPara.upright.vert.vertOverflow.wrap.startAt.type.b.baseline.cap.i.kern.lang.altLang.strike.sz.u.cx.cy.h.w.x.y.char.descr.hidden.id.idx.name.prst.typeface.bIns.lIns.rIns.tIns.dir.lat.lon.rev.rig.defTabSz.indent.marL.marR.dirty.err.uri.val.fill.pathH.pathW.stroke.spcPct.spcPts.scheme.style.theme`.split(`.`));var zI={aliceblue:`#F0F8FF`,antiquewhite:`#FAEBD7`,aqua:`#00FFFF`,aquamarine:`#7FFFD4`,azure:`#F0FFFF`,beige:`#F5F5DC`,bisque:`#FFE4C4`,black:`#000000`,blanchedalmond:`#FFEBCD`,blue:`#0000FF`,blueviolet:`#8A2BE2`,brown:`#A52A2A`,burlywood:`#DEB887`,cadetblue:`#5F9EA0`,chartreuse:`#7FFF00`,chocolate:`#D2691E`,coral:`#FF7F50`,cornflowerblue:`#6495ED`,cornsilk:`#FFF8DC`,crimson:`#DC143C`,cyan:`#00FFFF`,darkblue:`#00008B`,darkcyan:`#008B8B`,darkgoldenrod:`#B8860B`,darkgray:`#A9A9A9`,darkgreen:`#006400`,darkgrey:`#A9A9A9`,darkkhaki:`#BDB76B`,darkmagenta:`#8B008B`,darkolivegreen:`#556B2F`,darkorange:`#FF8C00`,darkorchid:`#9932CC`,darkred:`#8B0000`,darksalmon:`#E9967A`,darkseagreen:`#8FBC8F`,darkslateblue:`#483D8B`,darkslategray:`#2F4F4F`,darkslategrey:`#2F4F4F`,darkturquoise:`#00CED1`,darkviolet:`#9400D3`,deeppink:`#FF1493`,deepskyblue:`#00BFFF`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1E90FF`,firebrick:`#B22222`,floralwhite:`#FFFAF0`,forestgreen:`#228B22`,fuchsia:`#FF00FF`,gainsboro:`#DCDCDC`,ghostwhite:`#F8F8FF`,gold:`#FFD700`,goldenrod:`#DAA520`,gray:`#808080`,green:`#008000`,greenyellow:`#ADFF2F`,grey:`#808080`,honeydew:`#F0FFF0`,hotpink:`#FF69B4`,indianred:`#CD5C5C`,indigo:`#4B0082`,ivory:`#FFFFF0`,khaki:`#F0E68C`,lavender:`#E6E6FA`,lavenderblush:`#FFF0F5`,lawngreen:`#7CFC00`,lemonchiffon:`#FFFACD`,lightblue:`#ADD8E6`,lightcoral:`#F08080`,lightcyan:`#E0FFFF`,lightgoldenrodyellow:`#FAFAD2`,lightgray:`#D3D3D3`,lightgreen:`#90EE90`,lightgrey:`#D3D3D3`,lightpink:`#FFB6C1`,lightsalmon:`#FFA07A`,lightseagreen:`#20B2AA`,lightskyblue:`#87CEFA`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#B0C4DE`,lightyellow:`#FFFFE0`,lime:`#00FF00`,limegreen:`#32CD32`,linen:`#FAF0E6`,magenta:`#FF00FF`,maroon:`#800000`,mediumaquamarine:`#66CDAA`,mediumblue:`#0000CD`,mediumorchid:`#BA55D3`,mediumpurple:`#9370DB`,mediumseagreen:`#3CB371`,mediumslateblue:`#7B68EE`,mediumspringgreen:`#00FA9A`,mediumturquoise:`#48D1CC`,mediumvioletred:`#C71585`,midnightblue:`#191970`,mintcream:`#F5FFFA`,mistyrose:`#FFE4E1`,moccasin:`#FFE4B5`,navajowhite:`#FFDEAD`,navy:`#000080`,oldlace:`#FDF5E6`,olive:`#808000`,olivedrab:`#6B8E23`,orange:`#FFA500`,orangered:`#FF4500`,orchid:`#DA70D6`,palegoldenrod:`#EEE8AA`,palegreen:`#98FB98`,paleturquoise:`#AFEEEE`,palevioletred:`#DB7093`,papayawhip:`#FFEFD5`,peachpuff:`#FFDAB9`,peru:`#CD853F`,pink:`#FFC0CB`,plum:`#DDA0DD`,powderblue:`#B0E0E6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#FF0000`,rosybrown:`#BC8F8F`,royalblue:`#4169E1`,saddlebrown:`#8B4513`,salmon:`#FA8072`,sandybrown:`#F4A460`,seagreen:`#2E8B57`,seashell:`#FFF5EE`,sienna:`#A0522D`,silver:`#C0C0C0`,skyblue:`#87CEEB`,slateblue:`#6A5ACD`,slategray:`#708090`,slategrey:`#708090`,snow:`#FFFAFA`,springgreen:`#00FF7F`,steelblue:`#4682B4`,tan:`#D2B48C`,teal:`#008080`,thistle:`#D8BFD8`,tomato:`#FF6347`,turquoise:`#40E0D0`,violet:`#EE82EE`,wheat:`#F5DEB3`,white:`#FFFFFF`,whitesmoke:`#F5F5F5`,yellow:`#FFFF00`,yellowgreen:`#9ACD32`};const BI=/^[0-9a-fA-F]{3}|[0-9a-fA-F]{6}$/,VI=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,HI=/^[a-zA-Z]+$/;function UI(e,t,n){for(let n of t){let t=n?.clrMap?.resolveColor(e);if(t)return t}console.log(`${e} not able to resolve, might missing upstreams parameter`)}function WI(e,t){let n=t/1e5;e=e.replace(`#`,``);let i=parseInt(e.substr(0,2),16),a=parseInt(e.substr(2,2),16),o=parseInt(e.substr(4,2),16);return i=Math.round(i+(255-i)*n),a=Math.round(a+(255-a)*n),o=Math.round(o+(255-o)*n),`#`+((1<<24)+(i<<16)+(a<<8)+o).toString(16).slice(1)}function GI(e){if(e)return BI.test(e)?`#${e}`:VI.test(e)?e:HI.test(e)?zI[e]:`#${e}`}function KI(e,t,n,i){let a=Y(e,t),o=jk(a,[X.srgbClr],`val`);if(o){let e=Ak(a,[X.srgbClr,X.tint],`val`)??0;return WI(GI(o),e)}let s=jk(a,[X.schemeClr],`val`);if(s){let e=Ak(a,[X.schemeClr,X.tint],`val`)??0;return WI(GI(UI(s,n,i)),e)}}function qI(e,t,n,i){let a=Y(e,t),o=jk(a,[X.srgbClr],`val`);if(o)return GI(o);let s=jk(a,[X.schemeClr],`val`);if(s)return GI(UI(s,n,i))}function JI(e){return e=e.replace(`#`,``),e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),{r:parseInt(e.slice(0,2),16),g:parseInt(e.slice(2,4),16),b:parseInt(e.slice(4,6),16)}}function YI(e,t){if(!e)return null;let n=e;zI[e.toLowerCase()]&&(n=zI[e.toLowerCase()]);let{r:i,g:a,b:o}=JI(n);return`rgba(${i}, ${a}, ${o}, ${t})`}const XI={l:`start`,ctr:`middle`,r:`end`};function ZI(e){return XI[e]}const QI={r:`text-align: right;`,ctr:`text-align: center;`};function $I(e){return QI[e]??``}function eL(e){return e?Math.round(parseInt(e)/952.5)/10:0}function tL(e,t=null){return e?e/6e4:t}function nL(e,t,n,i){let a=jk(e,t,n,i);return a&&eL(a)}function rL(e,t=[],n=`sz`,i=void 0){let a=Ak(e,t,n);return a?a/100:i}function iL(e,t=null){return e?`#`+e:t}function aL(e){if(e)for(let t of e){let e=t.codePointAt(0);if(e>=19968&&e<=40959||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=13312&&e<=19903||e>=65280&&e<=65519)return`ea`;if(e>=1424&&e<=1535||e>=1536&&e<=1791||e>=1792&&e<=1871||e>=3584&&e<=3711||e>=2304&&e<=2431)return`cs`}return`latin`}function oL(e,t){if(e){let n=Ak(e,[],`blurRad`),i=Ak(e,[],`dist`),a=Ak(e,[],`dir`),o=kk(e,[],`alpha`)||.5,s=qI(e,[],t.upstreams,t.theme),c=Math.round(n/914400*96),l=i/914400*96,u=a/6e4*(Math.PI/180);return`drop-shadow(${Math.round(l*Math.cos(u))}px ${Math.round(l*Math.sin(u))}px ${c}px ${YI(s,o)});`}return``}const Z=II(`p`,`p:`,`bgRef.xfrm.nvPicPr.audio.bg.bgPr.blipFill.bodyStyle.clrMap.clrMapOvr.cNvGraphicFramePr.cNvGrpSpPr.cNvPr.cNvSpPr.cSld.cTn.cxnSp.defaultTextStyle.graphicFrame.grpSp.notes.notesMaster.nvGraphicFramePr.nvGrpSpPr.nvPicPr.nvPr.nvSpPr.nvCxnSpPr.otherStyle.par.ph.pic.presentation.seq.sld.sldIdLst.sldId.sldLayout.sldMaster.sldSz.sndAc.sp.spPr.spTree.style.timing.titleStyle.transition.txBody.txStyles.video`.split(`.`));II(`p`,``,[`bwMode`,`dir`,`id`,`idx`,`lvl`,`name`,`orient`,`show`,`sz`,`title`,`type`,`useBgFill`]);const sL=II(`c`,`c:`,`axId.catAx.dateAx.logBase.majorUnit.max.min.minorUnit.orientation.scaling.serAx.tickLblPos.valAx.chart.chartSpace.legend.legendPos.overlay.plotArea.title.areaChart.barChart.bubbleChart.lineChart.pieChart.radarChart.scatterChart.stockChart.surfaceChart.f.numLit.numRef.pt.ptCount.strLit.strRef.v.gapWidth.overlap.varyColors.dLbl.dLbls.marker.size.symbol.errBars.explosion.smooth.trendline.dPt.order.ser.spPr.tx`.split(`.`));II(`c`,``,[`crossAx`,`crosses`,`crossesAt`,`delete`,`formatCode`,`layout`,`pos`,`showCatName`,`showLeaderLines`,`showPercent`,`showSerName`,`showVal`,`sourceLinked`,`val`]);function cL(e){if(e){let t=J(e,X.off),n=J(e,X.ext),{flipH:i=0,flipV:a=0,rot:o=0}=e.attributes,s=tL(o),c=t?eL(t.attributes.x):0,l=t?eL(t.attributes.y):0,u=n?eL(n.attributes.cx):0,d=n?eL(n.attributes.cy):0;return{$xfrm:e,x:c,y:l,width:u,height:d,x1:i?u:0,y1:a?d:0,x2:i?0:u,y2:a?0:d,flipH:+i,flipV:+a,rotation:s}}}var lL=II(`r`,`r:`,[`id`,`embed`,`link`]);function uL(e,t){if(t){let n=t.placeholder2Shapes;if(n){let{placeholderIndex:t,placeholderType:i}=e;if(t!==void 0&&n[t])return n[t];if(i!==void 0&&n[i])return n[i]}}}function dL(e,t){Object.keys(t).forEach(n=>e[n]=t[n])}function fL(e){let{$sp:t,shape:n,upstreams:i,theme:a,presentation:o}=e,s=Y(t,[Z.spPr]);return dL(e,{render:c,getCap:m,toGeometryPath:u,getHeadEnd:f,getTailEnd:p,getShapeFill:h,getStroke:g,getStrokeWidth:_}),e;function c(){return`${u({prst:jk(s,[X.prstGeom],`prst`)})}`}function l(){let e=Y(s,[X.prstGeom,X.avLst]),t={};if(e){for(let n of e.children||[])if(n.name===X.gd&&n.attributes?.name&&n.attributes?.fmla){let e=n.attributes.name,i=n.attributes.fmla.match(/val\s+(\d+)/);i&&(t[e]=parseInt(i[1],10))}}return t}function u({prst:e}){let{width:t,height:i,x1:a,y1:o,x2:s,y2:c}=n.getXForm(),u=v(),f=l();g();let p=g(),m={fill:`none`,stroke:`transparent`};p&&(m.stroke=p,m[`stroke-width`]=_());let h=d();h&&(m.filter=h);let y=Object.entries(m).map(([e,t])=>`${e}="${t}"`).join(` `);if(e){if(e===`line`)return`<line desc="shape-decoration" x1="0" y1="0" x2="${t}" y2="${i}" ${y} fill="${p} style="${u}">`;if(e===`ellipse`)return`<ellipse desc="shape-decoration" cx="${t/2}" cy="${i/2}" rx="${t/2}" ry="${i/2}" ${y} style="${u}"/>`;if(e===`roundRect`){let e=(f?.adj||16667)/1e5*Math.min(t,i);return`<rect desc="shape-decoration" x="0" y="0" width="${t}" height="${i}" rx="${e}" ry="${e}" ${y} style="${u}"/>`}if(e===`round2SameRect`){let e=f?.adj1??16667;if((f?.adj2??0)===0){let n=e/1e5*Math.min(t,i);return`<rect desc="shape-decoration" x="0" y="0" width="${t}" height="${i}" rx="${n}" ry="${n}" ${y} style="${u}"/>`}{let e=t,n=i,a=inset,o=inset,s=e-2*inset,c=n-2*inset,l=Math.max(0,r-inset);return`<path desc="shape-decoration" d="${`
|
|
394
400
|
M ${0+r},0
|
|
395
401
|
H ${0+e-r}
|
|
396
402
|
A ${r},${r} 0 0 1 ${0+e},${0+r}
|
|
@@ -412,12 +418,12 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
412
418
|
V ${o+l}
|
|
413
419
|
A ${l},${l} 0 0 1 ${a+l},${o}
|
|
414
420
|
Z
|
|
415
|
-
`:``}" fill-rule="evenodd" ${y} style="${u}"/>`}}if(e===`triangle`)return`<polygon desc="shape-decoration" points="${`${t/2},0 ${t},${i} 0,${i}`}" ${y} style="${u}"/>`;if(e===`diamond`)return`<polygon desc="shape-decoration" points="${`${t/2},0 ${t},${i/2} ${t/2},${i} 0,${i/2}`}" ${y} style="${u}"/>`;if(e===`straightConnector1`)return`<line x1="${a}" y1="${o}" x2="${s}" y2="${c}" ${y} style="${u}" fill="${p}" color="${p}"/>`;if(e===`rect`)return`<rect desc="shape-decoration" x="0" y="0" width="${t}" height="${i}" ${y} style="${u}"/>`;if(e===`can`){let e=i*((f?.adj??25e3)/1e5)/2,n=t/2,a=e,o=i-e;return`<path desc="shape-decoration" d="${[`M 0 ${a}`,`A ${n} ${e} 0 0 0 ${t} ${a}`,`L ${t} ${o}`,`A ${n} ${e} 0 0 1 0 ${o}`,`Z`,`M 0 ${a}`,`A ${n} ${e} 0 0 1 ${t} ${a}`].join(` `)}" ${y} style="${u}"/>`}if(e===`bentConnector2`)return`<path d="M 0 0 L ${t} 0 L ${t} ${i}" ${y} style="${u}"/>`;if(e===`bentConnector3`){let e=(a+s)/2;return`<path d="${`M ${a} ${o} L ${e} ${o} L ${e} ${c} L ${s} ${c}`}" ${y} style="${u}"/>`}if(e===`bentConnector4`){let e=f?.adj1||5e4,n=f?.adj2||5e4,a=e/1e5*t,o=n/1e5*i;return`<path d="${`M 0 0 L ${a} 0 L ${a} ${o} L ${t} ${o} L ${t} ${i}`}" ${y} style="${u}"/>`}if(e===`bentConnector5`){let e=f?.adj1||5e4,n=f?.adj2||5e4,a=f?.adj3||5e4,o=e/1e5*t,s=n/1e5*i,c=a/1e5*t;return`<path d="${`M 0 0 L ${o} 0 L ${o} ${s} L ${c} ${s} L ${c} ${i} L ${t} ${i}`}" ${y} style="${u}"/>`}if(e===`curvedConnector2`){let e=t/2;return`<path d="${`M 0 0 C ${e} 0 ${e} ${i} ${t} ${i}`}" ${y} style="${u}"/>`}if(e===`curvedConnector3`){let e=t*((f?.adj1||5e4)/1e5);return`<path d="${`M 0 0 C ${e/2} 0 ${e/2} 0 ${e} 0 C ${e} ${i/2} ${e} ${i/2} ${e} ${i} C ${(e+t)/2} ${i} ${(e+t)/2} ${i} ${t} ${i}`}" ${y} style="${u}"/>`}if(e===`curvedConnector4`){let e=f?.adj1||5e4,n=f?.adj2||5e4,a=e/1e5*t,o=n/1e5*i;return`<path d="${`M 0 0 C ${a/2} 0 ${a/2} 0 ${a} 0 C ${a} ${o/2} ${a} ${o/2} ${a} ${o} C ${(a+t)/2} ${o} ${(a+t)/2} ${o} ${t} ${o} C ${t} ${(o+i)/2} ${t} ${(o+i)/2} ${t} ${i}`}" ${y} style="${u}"/>`}if(e===`curvedConnector5`){let e=f?.adj1||5e4,n=f?.adj2||5e4,a=f?.adj3||5e4,o=e/1e5*t,s=n/1e5*i,c=a/1e5*t;return`<path d="${`M 0 0 C ${o/2} 0 ${o/2} 0 ${o} 0 C ${o} ${s/2} ${o} ${s/2} ${o} ${s} C ${(o+c)/2} ${s} ${(o+c)/2} ${s} ${c} ${s} C ${c} ${(s+i)/2} ${c} ${(s+i)/2} ${c} ${i} C ${(c+t)/2} ${i} ${(c+t)/2} ${i} ${t} ${i}`}" ${y} style="${u}"/>`}console.warn(`${e} prst not supported yet in Geometry`)}else return``}function d(){if(n.effects?.shadow){let e=n.effects.shadow;return`drop-shadow(${e.offsetX||0}px ${e.offsetY||0}px ${e.blur||5}px ${e.color||`rgba(0,0,0,0.3)`})`}return``}function f(){return
|
|
416
|
-
`)}return console.warn(`shape does not have xform in the chain`,e.$sp),``}function b({xform:t}={}){if(t){let{x:n=0,y:i=0,flipH:a,flipV:o,rotation:s=0,width:c,height:l}=t,u=[];u.push(`<g desc="shape:${
|
|
417
|
-
`)}}function
|
|
421
|
+
`:``}" fill-rule="evenodd" ${y} style="${u}"/>`}}if(e===`triangle`)return`<polygon desc="shape-decoration" points="${`${t/2},0 ${t},${i} 0,${i}`}" ${y} style="${u}"/>`;if(e===`diamond`)return`<polygon desc="shape-decoration" points="${`${t/2},0 ${t},${i/2} ${t/2},${i} 0,${i/2}`}" ${y} style="${u}"/>`;if(e===`straightConnector1`)return`<line x1="${a}" y1="${o}" x2="${s}" y2="${c}" ${y} style="${u}" fill="${p}" color="${p}"/>`;if(e===`rect`)return`<rect desc="shape-decoration" x="0" y="0" width="${t}" height="${i}" ${y} style="${u}"/>`;if(e===`can`){let e=i*((f?.adj??25e3)/1e5)/2,n=t/2,a=e,o=i-e;return`<path desc="shape-decoration" d="${[`M 0 ${a}`,`A ${n} ${e} 0 0 0 ${t} ${a}`,`L ${t} ${o}`,`A ${n} ${e} 0 0 1 0 ${o}`,`Z`,`M 0 ${a}`,`A ${n} ${e} 0 0 1 ${t} ${a}`].join(` `)}" ${y} style="${u}"/>`}if(e===`bentConnector2`)return`<path d="M 0 0 L ${t} 0 L ${t} ${i}" ${y} style="${u}"/>`;if(e===`bentConnector3`){let e=(a+s)/2;return`<path d="${`M ${a} ${o} L ${e} ${o} L ${e} ${c} L ${s} ${c}`}" ${y} style="${u}"/>`}if(e===`bentConnector4`){let e=f?.adj1||5e4,n=f?.adj2||5e4,a=e/1e5*t,o=n/1e5*i;return`<path d="${`M 0 0 L ${a} 0 L ${a} ${o} L ${t} ${o} L ${t} ${i}`}" ${y} style="${u}"/>`}if(e===`bentConnector5`){let e=f?.adj1||5e4,n=f?.adj2||5e4,a=f?.adj3||5e4,o=e/1e5*t,s=n/1e5*i,c=a/1e5*t;return`<path d="${`M 0 0 L ${o} 0 L ${o} ${s} L ${c} ${s} L ${c} ${i} L ${t} ${i}`}" ${y} style="${u}"/>`}if(e===`curvedConnector2`){let e=t/2;return`<path d="${`M 0 0 C ${e} 0 ${e} ${i} ${t} ${i}`}" ${y} style="${u}"/>`}if(e===`curvedConnector3`){let e=t*((f?.adj1||5e4)/1e5);return`<path d="${`M 0 0 C ${e/2} 0 ${e/2} 0 ${e} 0 C ${e} ${i/2} ${e} ${i/2} ${e} ${i} C ${(e+t)/2} ${i} ${(e+t)/2} ${i} ${t} ${i}`}" ${y} style="${u}"/>`}if(e===`curvedConnector4`){let e=f?.adj1||5e4,n=f?.adj2||5e4,a=e/1e5*t,o=n/1e5*i;return`<path d="${`M 0 0 C ${a/2} 0 ${a/2} 0 ${a} 0 C ${a} ${o/2} ${a} ${o/2} ${a} ${o} C ${(a+t)/2} ${o} ${(a+t)/2} ${o} ${t} ${o} C ${t} ${(o+i)/2} ${t} ${(o+i)/2} ${t} ${i}`}" ${y} style="${u}"/>`}if(e===`curvedConnector5`){let e=f?.adj1||5e4,n=f?.adj2||5e4,a=f?.adj3||5e4,o=e/1e5*t,s=n/1e5*i,c=a/1e5*t;return`<path d="${`M 0 0 C ${o/2} 0 ${o/2} 0 ${o} 0 C ${o} ${s/2} ${o} ${s/2} ${o} ${s} C ${(o+c)/2} ${s} ${(o+c)/2} ${s} ${c} ${s} C ${c} ${(s+i)/2} ${c} ${(s+i)/2} ${c} ${i} C ${(c+t)/2} ${i} ${(c+t)/2} ${i} ${t} ${i}`}" ${y} style="${u}"/>`}console.warn(`${e} prst not supported yet in Geometry`)}else return``}function d(){if(n.effects?.shadow){let e=n.effects.shadow;return`drop-shadow(${e.offsetX||0}px ${e.offsetY||0}px ${e.blur||5}px ${e.color||`rgba(0,0,0,0.3)`})`}return``}function f(){return jk(s,[X.ln,X.headEnd],`type`)}function p(){return jk(s,[X.ln,X.tailEnd],`type`)}function m(){return jk(s,[X.ln],`cap`)}function h(){return qI(s,[X.solidFill],i,a)||(qI(t,[Z.style,X.fillRef],i,a)??n.lookup(`geometry`,`getShapeFill`))}function g(){return qI(s,[X.ln,X.solidFill],i,a)||(qI(t,[Z.style,X.lnRef],i,a)??n.lookup(`geometry`,`getStroke`))}function _(){let e=kk(s,[X.ln],`w`);if(e)return e*96/914400;let n=Ak(t,[Z.style,X.lnRef],`idx`);return n>0&&[.5,1,1.5][n-1]||1}function v(){let e={};if(n.type===`shape`){let t=h();t&&(e.fill=t)}let t=g();t&&(e.stroke=t);let i=_();i&&(e[`stroke-width`]=`${i}px`);let a=p(),o=f();return a&&(e[`marker-end`]=`url(#${a}`),o&&(e[`marker-start`]=`url(#${o}`),h(),Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}}const pL=new Set([`title`,`body`,`other`]);function mL(e){let{$sp:t,relationships:n,width:i,height:a,parent:o,upstreams:s,theme:c,presentation:l,cNvName:u=Z.nvSpPr,xfrmPaths:d=[Z.spPr,X.xfrm]}=e,f=Y(t,[Z.txBody,X.lstStyle]),p=Y(t,[u]),m=Y(p,[Z.nvPr,Z.ph]),h=m?.attributes?.type,g=m?.attributes?.idx,_=Y(p,[Z.cNvPr]),v=_?.attributes?.name||``;return dL(e,{$nvSpPr:p,id:_?.attributes?.id||``,name:v,xform:cL(Y(t,d)),notPlaceHolder:!h&&!g,placeholderType:h,placeholderIndex:g,getParent:S,getUpstream:w,lookup:D,upstreams:s,parent:o,theme:c,render:y,getXForm:C,getEffectOuterShadow:E,getEffectivePlaceholderType:T}),e.geometry=fL({$sp:t,shape:e,upstreams:s,theme:c,presentation:l}),e;async function y(){let t=e.getXForm();if(t){let n={...t,xform:t,upstreams:s,theme:c},i=b({xform:t}),a=e?.textContent?e?.textContent({xform:t}):``,o=await e.renderContent(n);return[...i,o,...x(i),a].join(`
|
|
422
|
+
`)}return console.warn(`shape does not have xform in the chain`,e.$sp),``}function b({xform:t}={}){if(t){let{x:n=0,y:i=0,flipH:a,flipV:o,rotation:s=0,width:c,height:l}=t,u=[];u.push(`<g desc="shape:${Nk(e.name)}" transform="translate(${n}, ${i})">`);let d=a?-1:1,f=o?-1:1,p=s?`translate(${c/2}, ${l/2}) rotate(${s}) scale(${d}, ${f}) translate(${-c/2}, ${-l/2})`:``;return u.push(` <g transform="${p}"><circle cx="0" cy="0" r="0"/>`),u}return[]}function x(){return[` </g>`,`</g>`]}function S(){return e[o]}function C(){return e.xform??D(void 0,`getXForm`)}function w(){switch(e.parent){case`slide`:return e.layout;case`layout`:return e.master;case`master`:return;default:throw{message:`unknown parent ${e.parent}`}}}function T(){if(pL.has(h))return h;if(e.parent===`slide`){let t=uL(e,e.layout)?.placeholderType;if(pL.has(t))return t;let n=uL(e,e.master)?.placeholderType;if(pL.has(n))return n}if(h)return h;if(e.parent===`slide`){let t=uL(e,e.layout)?.placeholderType;if(t)return t;let n=uL(e,e.master)?.placeholderType;if(n)return n}}function E(e){let{lstStyle:t=f,level:n=0}=e;return Y(t,[`a:lvl${n+1}pPr`,Z.spPr,X.effectLst,X.outerShdw])||Y(t,[Z.style,X.effectStyle,X.effectLst,X.outerShdw])||Y(t,[`a:lvl${n+1}pPr`,X.defRPr,X.effectLst,X.outerShdw])||D(void 0,`getEffectOuterShadow`,e)}function D(t,n,i){if(o===`slide`&&!i?.stop){for(let a of e.upstreams){let o=uL(e,a);if(o){let e=(t?o[t]:o)[n],a=e(i);if(a)return a}}if(i&&e.master){i.lstStyle=e.master.getTxStyle(e),i.stop=!0;let a=(t?e[t]:e)[n],o=a(i);if(o)return o}let a=c[n];if(a)return a(i);throw{message:`${n} not added in theme yet`}}}}function hL(e){let{$pic:t,relationships:n,parent:i=`slide`,upstreams:a,presentation:o,layout:s,master:c,theme:l}=e,u=mL({...e,cNvName:Z.nvPicPr}),d=jk(t,[Z.blipFill,X.blip],lL.embed),f=jk(t,[Z.blipFill,X.blip,X.extLst,X.ext,`asvg:svgBlip`],lL.embed);return dL(u,{type:`picture`,renderContent:p}),u;async function p(e){let{xform:t}=e,i=await n.getMedia(f||d),{x:a=0,y:o=0,width:s,height:c}=t,l=[];return l.push(` <image x="0" y="0" width="${s}" height="${c}" xlink:href="${i}" preserveAspectRatio="xMidYMid meet"/>`),l.join(`
|
|
423
|
+
`)}}function gL(e){return e?e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`):``}const _L={latin:X.latin,ea:X.ea,cs:X.cs};function vL({$r:e,slideRels:t,paragraph:n,shape:i,upstreams:a,theme:o,presentation:s}){let c=J(e,X.t),l=c?Dk(c):``,u={text:l,render:_,formatting:{},$dom:e,getFontSize:m},d=aL(l),f=J(e,X.rPr);if(f){f.attributes?.b===`1`&&(u.formatting.bold=!0),f.attributes?.i===`1`&&(u.formatting.italic=!0),f.attributes?.u&&(u.formatting.underline=!0);let e=J(f,X.latin);e?.attributes?.typeface&&(u.formatting.font=e.attributes.typeface);let n=J(f,X.hlinkClick);if(n){let e=n?.attributes?.[`r:id`]||null;u.hyperlink={relationId:e,url:null,tooltip:n.attributes.tooltip||null},e&&t&&(u.hyperlink.url=t[e]||null)}}return u;function p(){return qI(f,[X.solidFill],a,o,s)||n.getColor()}function m(){return rL(f)??n.getFontSize()}function h(){let t=_L[d];return jk(e,[X.rPr,t],`typeface`)??n.getFontFamily(t)}function g(){let t=Ak(e,[X.rPr],`baseline`);if(t>0)return`font-size: 0.6em;`;if(t<0)return`font-size: 0.6em; baseline-shift: sub;`}function _(e={}){let{effects:t,xform:n}=e,i=[d],a=[],o=m();o&&a.push(`font-size: ${o}px;`);let s=g();s&&a.push(s);let c=p();c&&a.push(`color: ${c};`);let u=t&&Object.values(t).join(` `);u&&a.push(`filter: ${u}`),f?.attributes?.b===`1`&&a.push(`font-weight: bold;`),f?.attributes?.i===`1`&&a.push(`font-style: italic;`);let _=h();return _&&a.push(`font-family: ${_};`),`<span ${[i.length?`class="${i.join(` `)}"`:``,a.length?`style="${a.join(``)}"`:``].filter(e=>e).join(` `)}>${gL(l)}</span>`}}function yL(e){let{$p:t,slideRels:n,txBody:i,shape:a,upstreams:o,theme:s,presentation:c}=e,l=Ak(J(t,X.pPr),[],`lvl`)??0,u={shape:a,level:l,runs:[],fullText:``,render:C,getFontSize:p,getColor:m,getFontFamily:h,getBulletStyle:g,$dom:t,getLineHeight:x,getEffectOuterShadow:S};for(let i of t.children)if(i.name===X.r){let t=vL({...e,$r:i,slideRels:n,paragraph:u});t&&(u.runs.push(t),u.fullText+=t.text)}else i.name===X.br&&(u.runs.push({type:`br`,text:`
|
|
418
424
|
`,svg:()=>``}),u.fullText+=`
|
|
419
|
-
`);return u;function d(){return
|
|
420
|
-
`),p;function g(e,t){return Y(l,[`a:lvl${e+1}pPr`,...t])}function _(e){let{level:t,paths:n,attr:i,defaultValue:a}=e;return
|
|
425
|
+
`);return u;function d(){return ZI(i.getAnchor())}function f(){return $I(jk(t,[X.pPr],`algn`)??i.getAlignment({level:l}))}function p(){return i.getFontSize({level:l})}function m(){return i.getColor({level:l})}function h(e){return i.getFontFamily({level:l,fontCategory:e})}function g(){return i.getBulletStyle({level:l})}function _(){let e=p(),t=i.getBulletFontSize({level:l});return t&&e*t/1e5}function v(){return i.getBulletColor({level:l})}function y(){return eL(i.getMarginLeft({level:l}))||0}function b(){return eL(i.getIndentValue({level:l}))||0}function x(){let e=i.getFontScale(),t=0;for(let e of Object.values(u.runs)){if(e.type===`br`)continue;let n=e.getFontSize();n&&(t=Math.max(t,n))}return(t||c.getFontSize())*(e/1e5)*(96/72)*1}function S(){return a.getEffectOuterShadow({level:l})}function C(e){let{y:t=0,contentWidth:n=0,leftInset:o=0}=e,s=`${i.getPlaceholderType()}-lvl${l+1}`,c=y(),p=b(),h={outerShadow:oL(S(),a)};o+c,o+c+p;let x=f();d(),x===`middle`&&n>0?o+n/2:x===`right`&&n>0&&o+n;let C=[x,`padding-left: ${c}px;`],w=m();w&&C.push(`color: ${w};`);let T=g(),E=[],D=``,O;if(T){T.type===`char`?D=T.char:T.type===`number`&&(D=`1.`),O=_(),O&&E.push(`font-size: ${O}px;`),T.font&&E.push(`font-family: ${T.font};`);let e=v();e&&E.push(`color: ${e};`)}let ee=[];u.runs.forEach(e=>{e.getFontSize&&ee.push(e.getFontSize())});let te=(Math.max(...ee)-O)/2,k=`filter: ${Object.values(h).join(` `)}`;E.push(`left: 0;`),E.push(`top: ${te}px;`);let ne=E.join(``),re=[`<div class="ppt-text ${s}" style="${C.join(``)}">`];D&&re.push(`<span class="bullet" style="${ne}; ${k}">${D}</span>`);for(let t of u.runs)if(t.type===`br`)re.push(`<br/>`);else{let n=t.render({...e,level:l,effects:h});re.push(n)}return re.push(`</div>`),`${re.join(``)}`}}function bL(e){let{$sp:t,$txBody:n,slideRels:i,shape:a,upstreams:o,theme:s,presentation:c}=e,l=J(n,X.lstStyle),u=J(n,X.bodyPr),d=[],f=[],p={text:void 0,paragraphs:d,textLines:f,shape:a,render:ie,getBodyProperty:v,getListStyle:_,getLvlpPr:g,getBulletStyle:S,getBulletFontSize:C,getBulletColor:w,getParagraphStyle:k,getSpaceBefore:T,getSpaceAfter:E,getPlaceholderType:h,$dom:n,getAlignment:b,getAnchor:x,getColor:D,getFontFamily:te,getFontScale:O,getFontSize:ee,getMarginLeft:ne,getIndentValue:re},m=a.lookup;function h(){let e=a.getEffectivePlaceholderType?.()??a.placeholderType;return[`title`,`ctrTitle`,`subTitle`].includes(e)?`title`:[`body`,`obj`,`tbl`].includes(e)?`body`:`other`}for(let t of n.children)if(t.name===X.p){let n=yL({...e,txBody:p,$p:t});n&&(d.push(n),f.push(n.fullText))}return p.text=f.join(`
|
|
426
|
+
`),p;function g(e,t){return Y(l,[`a:lvl${e+1}pPr`,...t])}function _(e){let{level:t,paths:n,attr:i,defaultValue:a}=e;return jk(l,[`a:lvl${t+1}pPr`,...n],i,a)??m(`txBody`,`getListStyle`,e)}function v(e){let{shape:t,attr:n}=e;return u?.attributes?.[n]??m(`txBody`,`getBodyProperty`,e)}function y(){return{left:eL(v({attr:RI.lIns})),top:eL(v({attr:RI.tIns})),right:eL(v({attr:RI.rIns})),bottom:eL(v({attr:RI.bIns}))}}function b(e){let{lstStyle:t=l,level:n=0}=e;return jk(t,[`a:lvl${n+1}pPr`],`algn`)??m(`txBody`,`getAlignment`,e)}function x(){return jk(t,[Z.txBody,X.bodyPr],`anchor`)??m(`txBody`,`getAnchor`)}function S(e){let{lstStyle:t=l,level:n=0}=e,i=jk(t,[`a:lvl${n+1}pPr`,X.buChar],`char`,`•`);if(i)return{type:`char`,char:i};let a=jk(t,[`a:lvl${n+1}pPr`,X.buAutoNum],`type`,`arabicPeriod`);return a?{type:`number`,scheme:a}:Y(t,[`a:lvl${n+1}pPr`,X.buNone])?{type:`none`}:m(`txBody`,`getBulletStyle`,e)}function C(e){let{lstStyle:t=l,level:n=0}=e;return Ak(t,[`a:lvl${n+1}pPr`,X.buSzPct],`val`)??m(`txBody`,`getBulletFontSize`,e)}function w(e){let{lstStyle:t=l,level:n=0}=e;return qI(t,[`a:lvl${n+1}pPr`,X.buClr],o)??m(`txBody`,`getBulletColor`,e)}function T(e){let{lstStyle:t=l,level:n=0}=e;return Ak(t,[`a:lvl${n+1}pPr`,X.spcBef,X.spcPct],`val`)??m(`txBody`,`getSpaceBefore`,e)}function E(e){let{lstStyle:t=l,level:n=0}=e;return Ak(t,[`a:lvl${n+1}pPr`,X.spcAft,X.spcPct],`val`)??m(`txBody`,`getSpaceAfter`,e)}function D(e){let{lstStyle:t=l,level:n=0}=e;return qI(t,[`a:lvl${n+1}pPr`,X.defRPr,X.solidFill],o)??m(`txBody`,`getColor`,e)}function O(e=0){return 1e5}function ee(e){let{lstStyle:t=l,level:n=0}=e;return rL(t,[`a:lvl${n+1}pPr`,X.defRPr])??m(`txBody`,`getFontSize`,e)}function te(e){let{lstStyle:t=l,level:n=0,fontCategory:i}=e;return jk(t,[`a:lvl${n+1}pPr`,X.defRPr,i],`typeface`)??m(`txBody`,`getFontFamily`,e)}function k(e=0){return _(e,[],[RI.marL,RI.indent,RI.algn])??o?.getParagraphStyle?.(a,e)}function ne(e){let{lstStyle:t=l,level:n=0}=e;return jk(t,[`a:lvl${n+1}pPr`],RI.marL)??m(`txBody`,`getMarginLeft`,e)}function re(e){let{lstStyle:t=l,level:n=0}=e;return jk(t,[`a:lvl${n+1}pPr`],RI.indent)??m(`txBody`,`getIndentValue`,e)}function ie(e){let{xform:t}=e;if(t){let{x:n,y:i,width:a,height:o}=t,s=y(),c=a-s.left-s.right,l=o-s.top-s.bottom,u=0;for(let e of d){let t=e.getFontSize()||18;u+=t*1.2}let f=s.top,p=x(),m={b:`flex-end`,t:`flex-start`,ctr:`center`}[p];l>0&&u>0&&(p===`ctr`?f=s.top+(l-u)/2:p===`b`&&(f=s.top+l-u));let h=f,g=d.map(t=>{let n=t.getLineHeight(),i=t.render(` `,{...e,y:h,contentWidth:c,leftInset:s.left});return h+=n,i});return`<foreignObject x="${n}" y="${i}" width="${a}" height="${o}" style="overflow: visible; ">
|
|
421
427
|
<div xmlns="http://www.w3.org/1999/xhtml"
|
|
422
428
|
style="${`width:100%; height:100%;
|
|
423
429
|
display:flex;
|
|
@@ -427,16 +433,16 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
427
433
|
${g.join(`
|
|
428
434
|
`)}
|
|
429
435
|
</div>
|
|
430
|
-
</foreignObject>`}return``}}function
|
|
431
|
-
`)}}function
|
|
432
|
-
`)}return``}return{defaultStyleId:a,getTblStyle:s,generateCSS:f}}function
|
|
436
|
+
</foreignObject>`}return``}}function xL(e){let{$tc:t}=e,n=J(t,X.txBody),i=bL({...e,$txBody:n}),a={text:i.text,paragraphs:i.paragraphs,gridSpan:parseInt(t.attributes.gridSpan||`1`),rowSpan:parseInt(t.attributes.rowSpan||`1`),backgroundColor:null,render:s},o=Y(t,[X.tcPr,X.solidFill,X.srgbClr]);return o&&(a.backgroundColor=iL(o.attributes.val,`#000000`)),a;function s(e){let{iRow:t,iCol:n,isLastRow:i,isLastCol:o,firstRow:s,firstCol:c,bandRow:l,bandCol:u}=e,d=[`grid-cell`];if(l&&t){let e=(t-+!!s)%2+1;d.push(`band${e}h`)}if(u&&n){let e=(n-+!!c)%2+1;d.push(`band${e}v`)}return t===0&&d.push(`first-row`),i&&d.push(`last-row`),n===0&&d.push(`first-col`),o&&d.push(`last-col`),`<div data-row="${t}" data-col="${n}" class="${d.join(` `)}" >${gL(a.text)}</div>`}}function SL(e){let{$tr:t}=e,n=[],i=eL(Ak(t,[],`h`));for(let i of t.children)if(i.name===X.tc){let t=xL({...e,$tc:i});t&&n.push(t)}return{cells:n,height:i,render:a};function a(e){let t=n.length-1;return n.map((n,i)=>n.render({...e,iCol:i,isLastCol:t===i})).join(`
|
|
437
|
+
`)}}function CL(e){let{$tblStyleLst:t,upstreams:n=[],theme:i}=e,a=t.attributes?.def,o={};for(let e of t.children)if(e.name===`a:tblStyle`){let{styleId:t}=e.attributes;o[t]=e}function s(e){return styles[e]||styles[a]}let c={[X.wholeTbl]:`whole-table`,[X.band1V]:`grid-cell.band1v`,[X.band2V]:`grid-cell.band2v`,[X.band1H]:`grid-cell.band1h`,[X.band2H]:`grid-cell.band2h`,[X.firstCol]:`grid-cell.first-column`,[X.firstRow]:`grid-cell.first-row`,[X.lastCol]:`grid-cell.last-column`,[X.lastRow]:`grid-cell.last-row`},l=new Set([X.left,X.right,X.top,X.bottom]);function u(e,t){if(e){let i=[];for(let a of e.children){let e=a.name;if(l.has(e)){let o=e.split(`:`).at(-1),s=nL(a,[X.ln],`w`);s&&(t[`border-${o}-width`]=`${s}px`);let c=qI(a,[X.ln,X.solidFill],n);c&&(t[`border-${o}-color`]=c);let l=jk(a,[X.ln],`cmpd`);if(l&&l!==`sng`){if(l===`dbl`)t[`border-${o}-style`]=`double`;else if(l.startsWidth(`thick`))switch(e){case X.left:i.push(`-3px 0 0 0 ${c}`);break;case X.right:i.push(`3px 0 0 0 ${c}`);break;case X.top:i.push(`0 -3px 0 0 ${c}`);break;case X.bottom:i.push(`-3px 0 0 0 ${c}`);break;default:console.log(`wrong name ${e}`)}}}}i.length&&(t[`box-shadow`]=i.join(`,`))}}function d(e,t,a){let o=Y(e,[t]);if(o){let e={};jk(o,[X.tcTxStyle],`b`)===`on`&&(e[`font-weight`]=`bold`);let s=KI(o,[X.tcTxStyle],n,i);s&&(e.color=s);let l=jk(o,[X.tcTxStyle,X.fontRef],`idx`);if(l){let t=i.getFontFamily(l,`latin`);t&&(e[`font-family`]=t)}let d=Y(o,[X.tcStyle,X.tcBdr]);d&&u(d,e);let f=KI(o,[X.tcStyle,X.fill,X.solidFill],n,i);f&&(e.background=f);let p=Object.entries(e).map(([e,t])=>`${e}: ${t};`).join(``),m=c[t];a.push(`.${m} {${p}}`)}}function f(){if(t){let e=[];for(let n of t.children)if(n.name===`a:tblStyle`){let t=n;d(t,X.wholeTbl,e),d(t,X.band1H,e),d(t,X.band2H,e),d(t,X.band1V,e),d(t,X.band2V,e),d(t,X.lastCol,e),d(t,X.firstCol,e),d(t,X.lastRow,e),d(t,X.firstRow,e)}return e.join(`
|
|
438
|
+
`)}return``}return{defaultStyleId:a,getTblStyle:s,generateCSS:f}}function wL(e){let{$sp:t,$tbl:n,$txBody:i,relationships:a,shape:o,upstreams:s,theme:c,presentation:l}=e,u=[],d=[],f=[];Ok(n,[X.tblGrid,X.gridCol]).forEach(e=>{let t=Ak(e,[],`w`);d.push({width:eL(t)})});for(let t of n.children)if(t.name===X.tr){let n=SL({...e,$tr:t});n&&(u.push(n),f.push(n.height))}return{rows:u,render:p};function p(e){let{xform:t}=e;if(t){Y(n,[X.tblPr,X.tableStyleId]);let e={width:`100%`,height:`100%`,"grid-template-columns":d.map(e=>`${e.width.toFixed(0)}fr`).join(` `),"grid-template-rows":f.map(e=>`${e.toFixed(0)}px`).join(` `)},i=Ak(n,[X.tblPr],`firstRow`)??0,a=Ak(n,[X.tblPr],`firstCol`)??0,o=Ak(n,[X.tblPr],`bandRow`)??0,s=Ak(n,[X.tblPr],`bandCol`)??0,{x:c,y:l,width:p,height:m}=t,h=Object.entries(e).map(([e,t])=>`${e}: ${t};`).join(``),g=u.length-1;return`<foreignObject width="${p}" height="${m}" style="overflow: visible; ">
|
|
433
439
|
<div xmlns="http://www.w3.org/1999/xhtml" class="worksheet grid-table whole-table"
|
|
434
440
|
style="${h}">
|
|
435
441
|
${u.map((e,t)=>e.render({iRow:t,isLastRow:t===g,firstCol:a,firstRow:i,bandRow:o,bandCol:s})).join(`
|
|
436
442
|
`)}
|
|
437
443
|
</div>
|
|
438
|
-
</foreignObject>`}}}const
|
|
439
|
-
`)}return{styleId:a,getTitleStyle:u,getLegendStyle:d,getDataPointStyle:f,getCategoryAxisStyle:p,getValueAxisStyle:m,generateCSS:h}}const CI=`http://www.w3.org/1999/xhtml`;function wI(){let e={};return{setProperty(t,n){e[t]=n},removeProperty(t){delete e[t]},getPropertyValue(t){return e[t]||``},get cssText(){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)},set cssText(t){for(let t of Object.keys(e))delete e[t];t&&t.split(`;`).forEach(t=>{let[n,i]=t.split(`:`).map(e=>e.trim());n&&i&&(e[n]=i)})}}}function TI(e){return{add(...t){let n=(e.getAttribute(`class`)||``).split(/\s+/).filter(Boolean),i=new Set(n);t.forEach(e=>i.add(e)),e.setAttribute(`class`,[...i].join(` `))},remove(...t){let n=(e.getAttribute(`class`)||``).split(/\s+/).filter(Boolean),i=new Set(n);t.forEach(e=>i.delete(e)),e.setAttribute(`class`,[...i].join(` `))},contains(t){return(e.getAttribute(`class`)||``).split(/\s+/).includes(t)},toggle(e){this.contains(e)?this.remove(e):this.add(e)}}}function EI(e,t=CI){let n={},i=[],a=wI(),o=``,s={nodeType:1,tagName:e,nodeName:e,namespaceURI:t,attributes:n,children:i,childNodes:i,style:a,ownerDocument:null,parentNode:null,parentElement:null,get textContent(){return i.length===0?o:i.map(e=>e.textContent).join(``)+o},set textContent(e){i.length=0,o=e},get className(){return n.class||``},set className(e){n.class=e},get classList(){return TI(s)},get id(){return n.id||``},set id(e){n.id=e},setAttribute(e,t){n[e]=String(t)},getAttribute(e){return n[e]},removeAttribute(e){delete n[e]},hasAttribute(e){return e in n},setAttributeNS(e,t,i){n[t]=String(i)},getAttributeNS(e,t){return n[t]},removeAttributeNS(e,t){delete n[t]},hasAttributeNS(e,t){return t in n},appendChild(e){return e.parentNode=s,e.parentElement=s,i.push(e),e},append(...e){for(let t of e)if(t!=null){if(typeof t==`string`){let e=s.ownerDocument.createTextNode(t);i.push(e)}else t.parentNode=s,t.parentElement=s,i.push(t)}},prepend(...e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n!=null){if(typeof n==`string`){let e=s.ownerDocument.createTextNode(n);i.unshift(e)}else n.parentNode=s,n.parentElement=s,i.unshift(n)}}},removeChild(e){let t=i.indexOf(e);return t>=0&&i.splice(t,1),e.parentNode=null,e.parentElement=null,e},replaceChild(e,t){let n=i.indexOf(t);return n>=0&&(i[n]=e,e.parentNode=s,e.parentElement=s,t.parentNode=null,t.parentElement=null),t},insertBefore(e,t){e.parentNode=s,e.parentElement=s;let n=t?i.indexOf(t):i.length;return i.splice(n>=0?n:i.length,0,e),e},remove(){s.parentNode&&s.parentNode.removeChild(s)},cloneNode(a){let c=EI(e,t);if(c.ownerDocument=s.ownerDocument,Object.assign(c.attributes,n),c._textContent=o,a)for(let e of i)c.appendChild(e.cloneNode(!0));return c},querySelector(e){return null},querySelectorAll(e){return[]},getElementsByTagName(e){let t=[];function n(i){for(let a of i.children||[])(a.tagName===e||e===`*`)&&t.push(a),n(a)}return n(s),t},getElementsByClassName(e){return[]},getElementById(e){return null},matches(e){return!1},closest(e){return null},getBoundingClientRect(){return{x:0,y:0,width:0,height:0,top:0,left:0,right:0,bottom:0}},getComputedStyle(){return a},get firstChild(){return i[0]||null},get lastChild(){return i[i.length-1]||null},get firstElementChild(){return i.find(e=>e.nodeType===1)||null},get lastElementChild(){return[...i].reverse().find(e=>e.nodeType===1)||null},get nextSibling(){if(!s.parentNode)return null;let e=s.parentNode.children;return e[e.indexOf(s)+1]||null},get previousSibling(){if(!s.parentNode)return null;let e=s.parentNode.children,t=e.indexOf(s);return t>0?e[t-1]:null},get nextElementSibling(){return s.nextSibling},get previousElementSibling(){return s.previousSibling},addEventListener(){},removeEventListener(){},dispatchEvent(){return!0},focus(){},blur(){},click(){},get outerHTML(){let t=Object.entries(n).map(([e,t])=>` ${e}="${String(t).replace(/&/g,`&`).replace(/"/g,`"`)}"`).join(``),s=a.cssText,c=s?` style="${s}"`:``,l=i.map(e=>e.outerHTML??e.textContent).join(``)+o;return[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`].includes(e.toLowerCase())?`<${e}${t}${c}/>`:`<${e}${t}${c}>${l}</${e}>`},get innerHTML(){return i.map(e=>e.outerHTML??e.textContent).join(``)},set innerHTML(e){i.length=0,o=``}};return s}function DI(e,t){return{nodeType:3,nodeName:`#text`,textContent:t,ownerDocument:e,parentNode:null,parentElement:null,get outerHTML(){return this.textContent},cloneNode(){return DI(e,t)}}}function OI(){let e={nodeType:9,nodeName:`#document`,documentElement:null,body:null,head:null,defaultView:null,createElement(t){let n=EI(t,CI);return n.ownerDocument=e,n},createElementNS(t,n){let i=EI(n,t);return i.ownerDocument=e,i},createTextNode(t){return DI(e,t)},createComment(t){return{nodeType:8,nodeName:`#comment`,textContent:t,ownerDocument:e,get outerHTML(){return`<!--${t}-->`},cloneNode(){return e.createComment(t)}}},createDocumentFragment(){let t=[];return{nodeType:11,nodeName:`#document-fragment`,children:t,childNodes:t,ownerDocument:e,appendChild(e){return e.parentNode=this,t.push(e),e},append(...n){for(let i of n)i!=null&&(typeof i==`string`?t.push(DI(e,i)):(i.parentNode=this,t.push(i)))},get firstChild(){return t[0]||null},get lastChild(){return t[t.length-1]||null},cloneNode(n){let i=e.createDocumentFragment();if(n)for(let e of t)i.appendChild(e.cloneNode(!0));return i}}},querySelector(e){return null},querySelectorAll(e){return[]},getElementById(e){return null},getElementsByTagName(t){return e.documentElement?e.documentElement.getElementsByTagName(t):[]},getElementsByClassName(e){return[]},createRange(){return{setStart(){},setEnd(){},selectNode(){},selectNodeContents(){},createContextualFragment(t){return e.createDocumentFragment()}}},get activeElement(){return e.body}},t=EI(`html`,CI);t.ownerDocument=e;let n=EI(`head`,CI);n.ownerDocument=e;let i=EI(`body`,CI);return i.ownerDocument=e,t.appendChild(n),t.appendChild(i),e.documentElement=t,e.head=n,e.body=i,e}function kI(e){return{document:e,getComputedStyle(e){return e.style},requestAnimationFrame(e){return setTimeout(e,16)},cancelAnimationFrame(e){clearTimeout(e)},addEventListener(){},removeEventListener(){},dispatchEvent(){return!0},innerWidth:1024,innerHeight:768,devicePixelRatio:1,scrollX:0,scrollY:0,pageXOffset:0,pageYOffset:0,location:{href:``,protocol:`file:`,host:``,hostname:``,pathname:``},navigator:{userAgent:`node`},Node:{ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_FRAGMENT_NODE:11}}}if(typeof global<`u`){let e=OI(),t=kI(e);e.defaultView=t,global.isNode=!0,global.document=e,global.window=t}const AI=[``,`k`,`M`,`G`,`T`,`P`];function jI(e){let t=e<0;if(Math.abs(e)<1)return MI(e);let n=Math.abs(e),i=0;for(;n>=1e3&&i<AI.length-1;)n/=1e3,i+=1;let a=+(n<10&&i>0);return(t?`-`:``)+Number(n.toFixed(a))+AI[i]}function MI(e){return String(Number.isFinite(e)?Number(e.toPrecision(12)):e)}function NI(e){let t=e.startsWith(`-`),n=t?e.slice(1):e,i=n.indexOf(`.`),a=i<0?n:n.slice(0,i),o=i<0?``:n.slice(i);return(t?`-`:``)+a.replace(/\B(?=(\d{3})+$)/g,`,`)+o}function PI(e){let t=String(Number(e.toPrecision(12))),n=t.indexOf(`.`);return n<0||t.includes(`e`)?0:t.length-n-1}function FI(e){return e.length>0&&e.every(e=>Number.isInteger(e)&&e>=1500&&e<=2500)}function II(e,t=!FI(e)){let n=0;for(let t of e)typeof t==`number`&&Number.isFinite(t)&&(n=Math.max(n,PI(t)));return e=>{if(typeof e==`number`&&Number.isFinite(e)){let i=e.toFixed(n);return t?NI(i):i}return String(e)}}function LI(e){return t=>Number(t).toFixed(e)}function RI(e){return Number((e*100).toPrecision(12))+`%`}const zI=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function BI(e){return String(e).padStart(2,`0`)}function VI(e,t=0){let n=e instanceof Date?e:new Date(e),i=864e5;return t>=i*300?String(n.getUTCFullYear()):t>=i*20?zI[n.getUTCMonth()]+` `+n.getUTCFullYear():t>i*2?zI[n.getUTCMonth()]+` `+n.getUTCDate():BI(n.getUTCHours())+`:`+BI(n.getUTCMinutes())}function HI(e){let t=864e5,n=e.map(Number).sort((e,t)=>e-t),i=n.length>1?(n[n.length-1]-n[0])/(n.length-1):0,a=new Set,o;for(let e of n){let t=new Date(e).getUTCMonth();t!==o&&(o=t,a.add(e))}return e=>{let n=e instanceof Date?e:new Date(e);return i>=t*300?String(n.getUTCFullYear()):i>=t*20?n.getUTCMonth()===0?zI[0]+` `+n.getUTCFullYear():zI[n.getUTCMonth()]:i>t*2||i===0?zI[n.getUTCMonth()]+` `+n.getUTCDate():i>=t?a.has(Number(n))?zI[n.getUTCMonth()]+` `+n.getUTCDate():String(n.getUTCDate()):BI(n.getUTCHours())+`:`+BI(n.getUTCMinutes())}}function UI(e,t=10,n){let i=e.base??10,a=Math.max(1,i*t/e.ticks().length);return e=>{let t=Math.round(Math.log(e)/Math.log(i)),o=e/i**+t;return o*i<i-.5&&(o*=i),o<=a?n(e):``}}function WI(e,t,n){if(typeof e==`function`)return e;if(e===`s`)return jI;if(e===`%`)return RI;if(typeof e==`string`&&/^\.\d+f$/.test(e))return LI(Number(e.slice(1,-1)));if(e===`d`)return e=>String(Math.round(Number(e)));if(e===`,`||e===`,d`)return II(n??[],!0);if(t&&t.type===`log`&&e===void 0&&(t.base??10)===10)return jI;if(t&&t.type===`time`){if(n)return HI(n);{let[e,n]=t.domain,i=Math.abs(Number(n)-Number(e));return e=>VI(e,i)}}return t&&(t.type===`band`||t.type===`point`||t.type===`ordinal`)?n&&n.length>0&&n[0]instanceof Date?HI(n):String:n?II(n):e=>typeof e==`number`?MI(e):String(e)}function GI(e,t){return t==null?e instanceof Date?VI(e,2592e7):String(e):String(KI(t)(e))}function KI(e,t,n,i){let a=WI(e,t,n);return t&&t.type===`log`?UI(t,i,a):a}function qI(e=`en-US`,t=`short`){let n=new Intl.DateTimeFormat(e,{timeZone:`UTC`,month:t});return e=>n.format(new Date(Date.UTC(2e3,Number(e))))}function JI(e=`en-US`,t=`short`){let n=new Intl.DateTimeFormat(e,{timeZone:`UTC`,weekday:t});return e=>n.format(new Date(Date.UTC(2001,0,Number(e))))}function YI(e){return(e instanceof Date?e:new Date(e)).toISOString().slice(0,10)}function XI(e){return String(Number.isFinite(e)?Math.round(e*10)/10:e)}function Q(e,t){return`${XI(e)},${XI(t)}`}const ZI=`http://www.w3.org/2000/svg`,QI=typeof document<`u`,$I=new Set([`viewBox`,`preserveAspectRatio`,`gradientUnits`,`gradientTransform`,`patternUnits`,`patternTransform`,`spreadMethod`,`markerWidth`,`markerHeight`,`markerUnits`,`refX`,`refY`,`textLength`,`lengthAdjust`,`startOffset`,`clipPathUnits`,`maskUnits`,`stdDeviation`,`baseFrequency`]);function eL(e){return $I.has(e)?e:e.replace(/([A-Z])/g,`-$1`).toLowerCase()}const tL=new Set([`opacity`,`fill-opacity`,`stroke-opacity`,`stop-opacity`,`offset`]);function nL(e,t){return typeof t==`number`&&tL.has(e)===!1?XI(t):t}function rL(e){return String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function iL(e){return rL(e).replace(/"/g,`"`)}function aL(e){let t={tag:e,attributes:{},styles:{},children:[],textContent:``,style:{},parent:void 0,setAttribute:n,appendChild:i,replaceWith:a,toString:o};function n(e,n){t.attributes[eL(e)]=n}function i(e){return t.children.push(e),e&&typeof e==`object`&&(e.parent=t),e}function a(e){t.parent&&(t.parent.children[t.parent.children.indexOf(t)]=e,e.parent=t.parent)}function o(){let n=[];for(let e of Object.keys(t.attributes))n.push(e+`="`+iL(t.attributes[e])+`"`);let i=Object.keys(t.style);if(i.length>0){let e=i.map(e=>eL(e)+`:`+t.style[e]);n.push(`style="`+iL(e.join(`;`))+`"`)}let a=n.length>0?e+` `+n.join(` `):e,o=(e===`style`?t.textContent:rL(t.textContent))+t.children.map(String).join(``);return o.length>0?`<`+a+`>`+o+`</`+e+`>`:`<`+a+`/>`}return t}function oL(e,t){for(let n of Object.keys(t)){let i=t[n];if(i!=null){if(n===`textContent`)e.textContent=String(i);else if(n===`style`&&typeof i==`object`)for(let t of Object.keys(i))e.style[t]=i[t];else{let t=eL(n);e.setAttribute(t,nL(t,i))}}}return e}function sL(e,t={}){return oL(QI?document.createElementNS(ZI,e):aL(e),t)}function cL(e,t={}){return oL(QI?document.createElement(e):aL(e),t)}function lL(e={}){let t=(e.width??640)+1,n=(e.height??400)+1;return sL(`svg`,{...e,xmlns:ZI,width:t,height:n,viewBox:e.viewBox??`0 0 `+t+` `+n})}const uL=e=>sL(`g`,e),dL=e=>sL(`rect`,e),fL=e=>sL(`line`,e),pL=e=>sL(`text`,e),mL=e=>sL(`circle`,e),hL=e=>sL(`path`,{fill:`none`,...e}),gL=e=>sL(`tspan`,e),_L=e=>sL(`defs`,e),vL=e=>sL(`clipPath`,e),yL=e=>cL(`figure`,e),bL=e=>cL(`figcaption`,e),xL=e=>cL(`div`,e),SL=e=>cL(`span`,e);function CL(e){let t=sL(`style`);return t.textContent=e,t}function wL(e,t,n={}){return{...n,interaction:{kx:e,ky:t,maxRadius:n.maxRadius??40}}}function TL(e={}){return wL(1,1,e)}function EL(e={}){return wL(1,.01,e)}function DL(e={}){return wL(.01,1,e)}function OL(e,t,n,i,a){let o=e.px??e.x,s=e.py??e.y;return[o?o[t]+n:a.width/2,s?s[t]+i:a.height/2]}function kL(e,t,n){let{state:i,index:a,interaction:o,offsetX:s,offsetY:c,dimensions:l}=e,u,d=o.maxRadius*o.maxRadius;for(let e of a){let[a,f]=OL(i.values,e,s,c,l),p=o.kx*(a-t),m=o.ky*(f-n),h=p*p+m*m;h<=d&&(u=e,d=h)}return u}function AL(e,t,n){let i=t.getBoundingClientRect(),a=Number(t.getAttribute(`width`)),o=i.width>0?a/i.width:1,s=(e.clientX-i.left)*o,c=(e.clientY-i.top)*o;return[s-n.originX,c-n.originY]}function jL(e,t){function n(n){for(let i of t){let[t,a]=AL(n,e,i);i.draw(kL(i,t,a))}}function i(){for(let e of t)e.draw(void 0)}e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,i)}const ML=Math.sqrt(50),NL=Math.sqrt(10),PL=Math.sqrt(2);function FL(e,t,n=10){let i=Math.abs(t-e)/Math.max(1,n);if(i>0&&Number.isFinite(i)){let e=10**Math.floor(Math.log10(i)),t=i/e,n=1;return t>=ML?n=10:t>=NL?n=5:t>=PL&&(n=2),n*e}return 1}function IL(e,t){let n=Math.max(0,-Math.floor(Math.log10(t)));return Number(e.toFixed(Math.min(20,n)))}function LL(e,t,n=10){let i=Math.min(e,t),a=Math.max(e,t);if(i===a)return[i];{let o=FL(i,a,n),s=Math.ceil(i/o),c=Math.floor(a/o),l=[];for(let e=s;e<=c;e++)l.push(IL(e*o,o));return e>t&&l.reverse(),l}}function RL(e,t=10){let[n,i]=e;if(n===i||!Number.isFinite(n)||!Number.isFinite(i))return e;{let e=n>i,a=e?i:n,o=e?n:i,s=FL(a,o,t),c=IL(Math.floor(a/s)*s,s),l=IL(Math.ceil(o/s)*s,s);return e?[l,c]:[c,l]}}const zL={second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:26298e5,year:315576e5},BL=[[`second`,1],[`second`,5],[`second`,15],[`second`,30],[`minute`,1],[`minute`,5],[`minute`,15],[`minute`,30],[`hour`,1],[`hour`,3],[`hour`,6],[`hour`,12],[`day`,1],[`day`,2],[`week`,1],[`month`,1],[`month`,3],[`year`,1]];function VL(e,t,n){let i=new Date(e);return t===`year`?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0),i.setUTCFullYear(Math.floor(i.getUTCFullYear()/n)*n)):t===`month`?(i.setUTCDate(1),i.setUTCHours(0,0,0,0),i.setUTCMonth(Math.floor(i.getUTCMonth()/n)*n)):t===`week`?(i.setUTCHours(0,0,0,0),i.setUTCDate(i.getUTCDate()-i.getUTCDay())):t===`day`?i.setUTCHours(0,0,0,0):t===`hour`?i.setUTCMinutes(0,0,0):t===`minute`?i.setUTCSeconds(0,0):i.setUTCMilliseconds(0),i}function HL(e,t,n){let i=new Date(e);return t===`year`?i.setUTCFullYear(i.getUTCFullYear()+n):t===`month`?i.setUTCMonth(i.getUTCMonth()+n):i.setTime(i.getTime()+zL[t]*n),i}function UL(e,t,n=10){let i=Math.min(Number(e),Number(t)),a=Math.max(Number(e),Number(t)),o=(a-i)/Math.max(1,n),s=`year`,c=1,l=1/0;for(let[e,t]of BL){let n=zL[e]*t,i=n>o?n/o:o/n;i<l&&(l=i,s=e,c=t)}s===`year`&&o>zL.year&&(c=Math.max(1,Math.round(FL(i/zL.year,a/zL.year,n))));let u=[],d=VL(new Date(i),s,c);for(d.getTime()<i&&(d=HL(d,s,c));d.getTime()<=a&&u.length<1e3;)u.push(new Date(d)),d=HL(d,s,c);return u}function WL(e={}){let t=e.domain??[0,1],n=e.range??[0,1],i=e.clamp===!0,[a,o]=t,[s,c]=n,l=o-a,u=c-s;function d(e){if(l===0)return(s+c)/2;{let t=(e-a)/l;return s+(i?Math.max(0,Math.min(1,t)):t)*u}}return d.type=`linear`,d.domain=t,d.range=n,d.invert=e=>a+(e-s)/u*l,d.ticks=(e=10)=>LL(a,o,e),d.nice=(n=10)=>WL({...e,domain:RL(t,n)}),d}function GL(e={}){let t=e.domain??[1,10],n=e.range??[0,1],i=e.base??10,a=e=>Math.log(e)/Math.log(i),[o,s]=t,[c,l]=n,u=a(o),d=a(s)-u,f=l-c;function p(e){return d===0||e<=0?(c+l)/2:c+(a(e)-u)/d*f}return p.type=`log`,p.base=i,p.domain=t,p.range=n,p.invert=e=>i**+(u+(e-c)/f*d),p.ticks=(e=10)=>{let t=Math.min(o,s),n=Math.max(o,s),c=Number(a(t).toPrecision(12)),l=Number(a(n).toPrecision(12)),u;if(Number.isInteger(i)&&t>0&&l-c<e){u=[];for(let e=Math.floor(c);e<=Math.ceil(l);e++)for(let a=1;a<i;a++){let o=a*i**+e;o>=t&&o<=n&&u.push(Number(o.toPrecision(12)))}u.length*2<e&&(u=LL(t,n,e))}else u=LL(c,l,Math.min(Math.ceil(l-c),e)).map(e=>i**+e);return o>s&&u.reverse(),u},p.nice=()=>GL({...e,domain:[i**+Math.floor(u),i**+Math.ceil(a(s))]}),p}function KL(e={}){let t=e.domain??[0,1],n=e.range??[0,1],i=e.constant??1,a=e=>Math.sign(e)*Math.log1p(Math.abs(e/i)),[o,s]=t.map(Number),[c,l]=n,u=a(o),d=a(s)-u,f=l-c;function p(e){return d===0?(c+l)/2:c+(a(Number(e))-u)/d*f}return p.type=`symlog`,p.domain=t,p.range=n,p.invert=e=>{let t=u+(e-c)/f*d;return Math.sign(t)*Math.expm1(Math.abs(t))*i},p.ticks=(e=10)=>LL(o,s,e),p}function qL(e={}){let t=e.domain??[0,1],n=e.range??[0,1],i=e.exponent??.5,a=e=>Math.sign(e)*Math.abs(e)**+i,[o,s]=t,[c,l]=n,u=a(o),d=a(s)-u,f=l-c;function p(e){return d===0?(c+l)/2:c+(a(e)-u)/d*f}return p.type=`sqrt`,p.domain=t,p.range=n,p.ticks=(e=5)=>LL(o,s,e),p.nice=()=>qL(e),p}function JL(e={}){let t=e.domain??[new Date(0),new Date],n=e.range??[0,1],[i,a]=t.map(Number),[o,s]=n,c=a-i,l=s-o;function u(e){return c===0?(o+s)/2:o+(Number(e)-i)/c*l}return u.type=`time`,u.domain=t,u.range=n,u.invert=e=>new Date(i+(e-o)/l*c),u.ticks=(e=10)=>UL(i,a,e),u.nice=()=>JL(e),u}function YL(e){return e!=null&&!(typeof e==`number`&&Number.isNaN(e))}function XL(e,t){return e<t?-1:+(e>t)}function ZL(e){let t,n;for(let i of e)YL(i)&&((t===void 0||i<t)&&(t=i),(n===void 0||i>n)&&(n=i));return[t,n]}function QL(e){return ZL(e)[0]}function $L(e){return ZL(e)[1]}function eR(e){let t=0;for(let n of e)YL(n)&&(t+=Number(n));return t}function tR(e){let t=0;for(let n of e)YL(n)&&(t+=1);return t}function nR(e){let t=tR(e);if(t>0)return eR(e)/t}function rR(e,t){let n=e.filter(YL).map(Number).sort(XL);if(n.length!==0){if(n.length===1)return n[0];{let e=(n.length-1)*t,i=Math.floor(e),a=Math.ceil(e);return n[i]+(n[a]-n[i])*(e-i)}}}function iR(e){return rR(e,.5)}function aR(e){let t=nR(e);if(t!==void 0){let n=e.filter(YL).map(Number),i=n.reduce((e,n)=>e+(n-t)**2,0);return n.length>1?Math.sqrt(i/(n.length-1)):0}}function oR(e){return e instanceof Date?+e:e}function sR(e){let t=new Set,n=[];for(let i of e)YL(i)&&!t.has(oR(i))&&(t.add(oR(i)),n.push(i));return n}function cR(e){let t=tR(e),n=aR(e),[i,a]=ZL(e);return t>0&&n>0?Math.min(200,Math.max(1,Math.ceil((a-i)*Math.cbrt(t)/(3.49*n)))):1}function lR(e){let t=aR(e);if(t!==void 0)return t*t}function uR(e){let t=new Map,n,i=0;for(let a of e)if(YL(a)){let e=(t.get(a)??0)+1;t.set(a,e),e>i&&(n=a,i=e)}return n}function dR(e){let t=e.map((e,t)=>t);t.sort((t,n)=>XL(e[t],e[n]));let n=Array(e.length);for(let i=0;i<t.length;i++){let a=i>0&&XL(e[t[i-1]],e[t[i]])===0;n[t[i]]=a?n[t[i-1]]:i}return n}function fR(e={}){let t=e.domain??[],n=e.range??[0,1],i=e.paddingInner??e.padding??.1,a=e.paddingOuter??e.padding??.1,o=e.align??.5,s=n[1]<n[0],c=s?n[1]:n[0],l=(s?n[0]:n[1])-c,u=Math.max(1,t.length),d=l/Math.max(1,u-i+a*2),f=d*(1-i),p=c+(l-d*(u-i))*o,m=new Map(t.map((e,n)=>[oR(e),s?t.length-1-n:n]));function h(e){let t=m.get(YL(e)?oR(e):null);if(t!==void 0)return p+d*t}return h.type=`band`,h.domain=t,h.range=n,h.bandwidth=()=>f,h.step=()=>d,h.ticks=()=>t,h.invert=e=>{let n=Math.max(0,Math.min(t.length-1,Math.floor((e-p)/d)));return t[s?t.length-1-n:n]},h}function pR(e={}){let t=e.domain??[],n=e.range??[0,1],i=e.padding??.5,a=e.align??.5,o=n[1]<n[0],s=o?n[1]:n[0],c=(o?n[0]:n[1])-s,l=Math.max(1,t.length),u=c/Math.max(1,l-1+i*2),d=s+(c-u*(l-1))*a,f=new Map(t.map((e,n)=>[oR(e),o?t.length-1-n:n]));function p(e){let t=f.get(YL(e)?oR(e):null);if(t!==void 0)return d+u*t}return p.type=`point`,p.domain=t,p.range=n,p.bandwidth=()=>0,p.step=()=>u,p.ticks=()=>t,p.invert=e=>{let n=Math.max(0,Math.min(t.length-1,Math.round((e-d)/u)));return t[o?t.length-1-n:n]},p}function mR(e={}){let t=e.domain??[],n=e.range??[],i=e.unknown??`currentColor`,a=new Map(t.map((e,t)=>[oR(e),t]));function o(e){let t=a.get(YL(e)?oR(e):null);return t===void 0||n.length===0?i:n[t%n.length]}return o.type=`ordinal`,o.domain=t,o.range=n,o.ticks=()=>t,o}const hR=[`#4269d0`,`#efb118`,`#ff725c`,`#6cc5b0`,`#3ca951`,`#ff8ab7`,`#a463f2`,`#97bbf5`,`#9c6b4e`,`#9498a0`],gR=[`#1f77b4`,`#ff7f0e`,`#2ca02c`,`#d62728`,`#9467bd`,`#8c564b`,`#e377c2`,`#7f7f7f`,`#bcbd22`,`#17becf`],_R=[`#4e79a7`,`#f28e2c`,`#e15759`,`#76b7b2`,`#59a14f`,`#edc949`,`#af7aa1`,`#ff9da7`,`#9c755f`,`#bab0ab`],vR=[`#7fc97f`,`#beaed4`,`#fdc086`,`#ffff99`,`#386cb0`,`#f0027f`,`#bf5b17`,`#666666`],yR=[`#1b9e77`,`#d95f02`,`#7570b3`,`#e7298a`,`#66a61e`,`#e6ab02`,`#a6761d`,`#666666`],bR=[`#a6cee3`,`#1f78b4`,`#b2df8a`,`#33a02c`,`#fb9a99`,`#e31a1c`,`#fdbf6f`,`#ff7f00`,`#cab2d6`,`#6a3d9a`,`#ffff99`,`#b15928`],xR=[`#fbb4ae`,`#b3cde3`,`#ccebc5`,`#decbe4`,`#fed9a6`,`#ffffcc`,`#e5d8bd`,`#fddaec`,`#f2f2f2`],SR=[`#b3e2cd`,`#fdcdac`,`#cbd5e8`,`#f4cae4`,`#e6f5c9`,`#fff2ae`,`#f1e2cc`,`#cccccc`],CR=[`#e41a1c`,`#377eb8`,`#4daf4a`,`#984ea3`,`#ff7f00`,`#ffff33`,`#a65628`,`#f781bf`,`#999999`],wR=[`#66c2a5`,`#fc8d62`,`#8da0cb`,`#e78ac3`,`#a6d854`,`#ffd92f`,`#e5c494`,`#b3b3b3`],TR=[`#8dd3c7`,`#ffffb3`,`#bebada`,`#fb8072`,`#80b1d3`,`#fdb462`,`#b3de69`,`#fccde5`,`#d9d9d9`,`#bc80bd`,`#ccebc5`,`#ffed6f`],ER=[`#f7fbff`,`#deebf7`,`#c6dbef`,`#9ecae1`,`#6baed6`,`#4292c6`,`#2171b5`,`#08519c`,`#08306b`],DR=[`#f7fcf5`,`#e5f5e0`,`#c7e9c0`,`#a1d99b`,`#74c476`,`#41ab5d`,`#238b45`,`#006d2c`,`#00441b`],OR=[`#fff5eb`,`#fee6ce`,`#fdd0a2`,`#fdae6b`,`#fd8d3c`,`#f16913`,`#d94801`,`#a63603`,`#7f2704`],kR=[`#fcfbfd`,`#efedf5`,`#dadaeb`,`#bcbddc`,`#9e9ac8`,`#807dba`,`#6a51a3`,`#54278f`,`#3f007d`],AR=[`#fff5f0`,`#fee0d2`,`#fcbba1`,`#fc9272`,`#fb6a4a`,`#ef3b2c`,`#cb181d`,`#a50f15`,`#67000d`],jR=[`#ffffff`,`#f0f0f0`,`#d9d9d9`,`#bdbdbd`,`#969696`,`#737373`,`#525252`,`#252525`,`#000000`],MR=[`#f7fcfd`,`#e5f5f9`,`#ccece6`,`#99d8c9`,`#66c2a4`,`#41ae76`,`#238b45`,`#006d2c`,`#00441b`],NR=[`#f7fcfd`,`#e0ecf4`,`#bfd3e6`,`#9ebcda`,`#8c96c6`,`#8c6bb1`,`#88419d`,`#810f7c`,`#4d004b`],PR=[`#f7fcf0`,`#e0f3db`,`#ccebc5`,`#a8ddb5`,`#7bccc4`,`#4eb3d3`,`#2b8cbe`,`#0868ac`,`#084081`],FR=[`#fff7ec`,`#fee8c8`,`#fdd49e`,`#fdbb84`,`#fc8d59`,`#ef6548`,`#d7301f`,`#b30000`,`#7f0000`],IR=[`#fff7fb`,`#ece7f2`,`#d0d1e6`,`#a6bddb`,`#74a9cf`,`#3690c0`,`#0570b0`,`#045a8d`,`#023858`],LR=[`#fff7fb`,`#ece2f0`,`#d0d1e6`,`#a6bddb`,`#67a9cf`,`#3690c0`,`#02818a`,`#016c59`,`#014636`],RR=[`#f7f4f9`,`#e7e1ef`,`#d4b9da`,`#c994c7`,`#df65b0`,`#e7298a`,`#ce1256`,`#980043`,`#67001f`],zR=[`#fff7f3`,`#fde0dd`,`#fcc5c0`,`#fa9fb5`,`#f768a1`,`#dd3497`,`#ae017e`,`#7a0177`,`#49006a`],BR=[`#ffffe5`,`#f7fcb9`,`#d9f0a3`,`#addd8e`,`#78c679`,`#41ab5d`,`#238443`,`#006837`,`#004529`],VR=[`#ffffd9`,`#edf8b1`,`#c7e9b4`,`#7fcdbb`,`#41b6c4`,`#1d91c0`,`#225ea8`,`#253494`,`#081d58`],HR=[`#ffffe5`,`#fff7bc`,`#fee391`,`#fec44f`,`#fe9929`,`#ec7014`,`#cc4c02`,`#993404`,`#662506`],UR=[`#ffffcc`,`#ffeda0`,`#fed976`,`#feb24c`,`#fd8d3c`,`#fc4e2a`,`#e31a1c`,`#bd0026`,`#800026`],WR=[`#440154`,`#482878`,`#3e4989`,`#31688e`,`#26828e`,`#1f9e89`,`#35b779`,`#6ece58`,`#b5de2b`,`#fde725`],GR=[`#000004`,`#0a0822`,`#1d1147`,`#36106b`,`#51127c`,`#6a1c81`,`#832681`,`#9c2e7f`,`#b73779`,`#d0416f`,`#e75263`,`#f56b5c`,`#fc8961`,`#fea772`,`#fec488`,`#fde2a3`,`#fcfdbf`],KR=[`#000004`,`#0b0724`,`#210c4a`,`#3d0965`,`#57106e`,`#71196e`,`#8a226a`,`#a32c61`,`#bc3754`,`#d24644`,`#e45a31`,`#f1731d`,`#f98e09`,`#fcac11`,`#f9cb35`,`#f2ea69`,`#fcffa4`],qR=[`#0d0887`,`#310597`,`#4c02a1`,`#6600a7`,`#7e03a8`,`#9511a1`,`#aa2395`,`#bc3587`,`#cc4778`,`#da5a6a`,`#e66c5c`,`#f0804e`,`#f89540`,`#fdac33`,`#fdc527`,`#f8df25`,`#f0f921`],JR=[`#002051`,`#012b65`,`#11366c`,`#26426e`,`#3c4d6e`,`#51586e`,`#62646f`,`#727071`,`#7f7c75`,`#8c8877`,`#9a9478`,`#a9a177`,`#bbaf71`,`#cebd68`,`#e2cb5c`,`#f3da4f`,`#fdea45`],YR=[`#000000`,`#150b1d`,`#1b1d3b`,`#17374d`,`#16534c`,`#236a3e`,`#437731`,`#717b32`,`#a07949`,`#c47a74`,`#d483a7`,`#d197d3`,`#c7b3ed`,`#c1cff3`,`#cae7f0`,`#e2f6f0`,`#ffffff`],XR=[`#6e40aa`,`#873eb1`,`#a03db3`,`#ba3cb0`,`#d23ea7`,`#e8429b`,`#f9488a`,`#ff5177`,`#ff5e63`,`#ff6d51`,`#ff7f41`,`#fd9235`,`#efa72f`,`#dfbb2f`,`#cdcf37`,`#bde146`,`#aff05b`],ZR=[`#6e40aa`,`#664cbe`,`#5c5ace`,`#4f6bda`,`#417de0`,`#3390e1`,`#27a3dc`,`#1eb6d1`,`#1ac7c2`,`#1ad7af`,`#21e39b`,`#2ded86`,`#40f373`,`#57f664`,`#73f65a`,`#91f457`,`#aff05b`],QR=[`#6e40aa`,`#a03db3`,`#d23ea7`,`#f9488a`,`#ff5e63`,`#ff7f41`,`#efa72f`,`#cdcf37`,`#aff05b`,`#73f65a`,`#40f373`,`#21e39b`,`#1ac7c2`,`#27a3dc`,`#417de0`,`#5c5ace`,`#6e40aa`],$R=[`#ff4040`,`#f56f1a`,`#daa004`,`#b0cd01`,`#7fee11`,`#4ffe32`,`#25fb5f`,`#0ae590`,`#00bfbf`,`#0a90e5`,`#255ffb`,`#4f32fe`,`#7f11ee`,`#b001cd`,`#da04a0`,`#f51a6f`,`#ff4040`];function ez(e){let t=Math.max(0,Math.min(1,e)),n=34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-t*14825.05)))),i=23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+t*707.56)))),a=27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-t*6838.66))));return`rgb(`+tz(n)+`, `+tz(i)+`, `+tz(a)+`)`}function tz(e){return Math.max(0,Math.min(255,Math.round(e)))}const nz=Array.from({length:33},(e,t)=>ez(t/32)),rz=[`#a50026`,`#d73027`,`#f46d43`,`#fdae61`,`#fee090`,`#ffffbf`,`#e0f3f8`,`#abd9e9`,`#74add1`,`#4575b4`,`#313695`],iz=[`#a50026`,`#d73027`,`#f46d43`,`#fdae61`,`#fee08b`,`#ffffbf`,`#d9ef8b`,`#a6d96a`,`#66bd63`,`#1a9850`,`#006837`],az=[`#67001f`,`#b2182b`,`#d6604d`,`#f4a582`,`#fddbc7`,`#f7f7f7`,`#d1e5f0`,`#92c5de`,`#4393c3`,`#2166ac`,`#053061`],oz={observable10:hR,category10:gR,tableau10:_R,accent:vR,dark2:yR,paired:bR,pastel1:xR,pastel2:SR,set1:CR,set2:wR,set3:TR,blues:ER,greens:DR,oranges:OR,purples:kR,reds:AR,greys:jR,bugn:MR,bupu:NR,gnbu:PR,orrd:FR,pubu:IR,pubugn:LR,purd:RR,rdpu:zR,ylgn:BR,ylgnbu:VR,ylorbr:HR,ylorrd:UR,viridis:WR,magma:GR,inferno:KR,plasma:qR,cividis:JR,cubehelix:YR,warm:XR,cool:ZR,turbo:nz,rainbow:QR,sinebow:$R,brbg:[`#543005`,`#8c510a`,`#bf812d`,`#dfc27d`,`#f6e8c3`,`#f5f5f5`,`#c7eae5`,`#80cdc1`,`#35978f`,`#01665e`,`#003c30`],prgn:[`#40004b`,`#762a83`,`#9970ab`,`#c2a5cf`,`#e7d4e8`,`#f7f7f7`,`#d9f0d3`,`#a6dba0`,`#5aae61`,`#1b7837`,`#00441b`],piyg:[`#8e0152`,`#c51b7d`,`#de77ae`,`#f1b6da`,`#fde0ef`,`#f7f7f7`,`#e6f5d0`,`#b8e186`,`#7fbc41`,`#4d9221`,`#276419`],puor:[`#7f3b08`,`#b35806`,`#e08214`,`#fdb863`,`#fee0b6`,`#f7f7f7`,`#d8daeb`,`#b2abd2`,`#8073ac`,`#542788`,`#2d004b`],rdbu:az,rdgy:[`#67001f`,`#b2182b`,`#d6604d`,`#f4a582`,`#fddbc7`,`#ffffff`,`#e0e0e0`,`#bababa`,`#878787`,`#4d4d4d`,`#1a1a1a`],rdylbu:rz,rdylgn:iz,spectral:[`#9e0142`,`#d53e4f`,`#f46d43`,`#fdae61`,`#fee08b`,`#ffffbf`,`#e6f598`,`#abdda4`,`#66c2a5`,`#3288bd`,`#5e4fa2`],burd:[...az].reverse(),buylrd:[...rz].reverse()},sz=new Set([`blues`,`greens`,`oranges`,`purples`,`reds`,`greys`,`bugn`,`bupu`,`gnbu`,`orrd`,`pubu`,`pubugn`,`purd`,`rdpu`,`ylgn`,`ylgnbu`,`ylorbr`,`ylorrd`,`viridis`,`magma`,`inferno`,`plasma`,`cividis`,`cubehelix`,`warm`,`cool`,`turbo`,`rainbow`,`sinebow`,...new Set([`brbg`,`prgn`,`piyg`,`puor`,`rdbu`,`rdgy`,`rdylbu`,`rdylgn`,`spectral`,`burd`,`buylrd`])]);function cz(e,t=hR){return oz[String(e).toLowerCase()]??t}const lz={spectral:{3:[`#fc8d59`,`#ffffbf`,`#99d594`],4:[`#d7191c`,`#fdae61`,`#abdda4`,`#2b83ba`],5:[`#d7191c`,`#fdae61`,`#ffffbf`,`#abdda4`,`#2b83ba`],6:[`#d53e4f`,`#fc8d59`,`#fee08b`,`#e6f598`,`#99d594`,`#3288bd`],7:[`#d53e4f`,`#fc8d59`,`#fee08b`,`#ffffbf`,`#e6f598`,`#99d594`,`#3288bd`],8:[`#d53e4f`,`#f46d43`,`#fdae61`,`#fee08b`,`#e6f598`,`#abdda4`,`#66c2a5`,`#3288bd`],9:[`#d53e4f`,`#f46d43`,`#fdae61`,`#fee08b`,`#ffffbf`,`#e6f598`,`#abdda4`,`#66c2a5`,`#3288bd`],10:[`#9e0142`,`#d53e4f`,`#f46d43`,`#fdae61`,`#fee08b`,`#e6f598`,`#abdda4`,`#66c2a5`,`#3288bd`,`#5e4fa2`],11:[`#9e0142`,`#d53e4f`,`#f46d43`,`#fdae61`,`#fee08b`,`#ffffbf`,`#e6f598`,`#abdda4`,`#66c2a5`,`#3288bd`,`#5e4fa2`]},rdylbu:{3:[`#fc8d59`,`#ffffbf`,`#91bfdb`],4:[`#d7191c`,`#fdae61`,`#abd9e9`,`#2c7bb6`],5:[`#d7191c`,`#fdae61`,`#ffffbf`,`#abd9e9`,`#2c7bb6`],6:[`#d73027`,`#fc8d59`,`#fee090`,`#e0f3f8`,`#91bfdb`,`#4575b4`],7:[`#d73027`,`#fc8d59`,`#fee090`,`#ffffbf`,`#e0f3f8`,`#91bfdb`,`#4575b4`],8:[`#d73027`,`#f46d43`,`#fdae61`,`#fee090`,`#e0f3f8`,`#abd9e9`,`#74add1`,`#4575b4`],9:[`#d73027`,`#f46d43`,`#fdae61`,`#fee090`,`#ffffbf`,`#e0f3f8`,`#abd9e9`,`#74add1`,`#4575b4`]}};function uz(e,t,n){let i=lz[String(e).toLowerCase()];if(i&&i[n])return i[n];if(n<=1)return[t[Math.floor(t.length/2)]];{let e=gz(t),i=[];for(let t=0;t<n;t++)i.push(e(t/(n-1)));return i}}const dz={aqua:`#00ffff`,aquamarine:`#7fffd4`,beige:`#f5f5dc`,black:`#000000`,blue:`#0000ff`,brown:`#a52a2a`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkred:`#8b0000`,fuchsia:`#ff00ff`,gold:`#ffd700`,gray:`#808080`,green:`#008000`,grey:`#808080`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lightblue:`#add8e6`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lime:`#00ff00`,magenta:`#ff00ff`,maroon:`#800000`,navy:`#000080`,olive:`#808000`,orange:`#ffa500`,orchid:`#da70d6`,pink:`#ffc0cb`,plum:`#dda0dd`,purple:`#800080`,red:`#ff0000`,salmon:`#fa8072`,sienna:`#a0522d`,silver:`#c0c0c0`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,yellow:`#ffff00`},fz=new Set([`currentcolor`,`transparent`,`none`]);function pz(e){if(typeof e!=`string`)return!1;{let t=e.trim().toLowerCase();return dz[t]!==void 0||fz.has(t)||/^#[0-9a-f]{3,8}$/.test(t)||/^(rgb|hsl|hwb|lab|lch|oklab|oklch|color)a?\(/.test(t)||t.startsWith(`var(`)||t.startsWith(`url(`)}}function mz(e){let t=dz[String(e).trim().toLowerCase()]??String(e).trim();if(/^#[0-9a-fA-F]{3}$/.test(t))return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];if(/^#[0-9a-fA-F]{6}$/.test(t))return[parseInt(t.slice(1,3),16),parseInt(t.slice(3,5),16),parseInt(t.slice(5,7),16)];{let e=t.match(/[\d.]+/g);return e&&e.length>=3?e.slice(0,3).map(Number):[0,0,0]}}function hz(e,t,n){let i=mz(e),a=mz(t);return`rgb(`+i.map((e,t)=>Math.round(e+(a[t]-e)*n)).join(`, `)+`)`}function gz(e){return function(t){let n=Math.max(0,Math.min(1,t))*(e.length-1),i=Math.floor(n),a=Math.min(e.length-1,i+1);return hz(e[i],e[a],n-i)}}function _z(e,t){return typeof e==`function`?e.length>=2?e(t[0],t[t.length-1]):e:gz(t)}function vz(e={}){let t=e.domain??[0,1],n=e.range??cz(e.scheme??`blues`),i=_z(e.interpolate,n),[a,o]=t.map(Number),s=o-a,c=e.position;function l(e){return i(c?c(e):s===0?.5:(Number(e)-a)/s)}return l.type=c?c.type:`sequential`,l.base=c?c.base:void 0,l.domain=t,l.range=n,l.position=c,l.ticks=c?c.ticks:((e=5)=>LL(a,o,e)),l}function yz(e={}){let t=e.range??[],n=(e.values??[]).filter(Number.isFinite).sort(XL),i=[];for(let e=1;e<t.length;e++)i.push(rR(n,e/t.length));function a(n){if(Number.isFinite(Number(n))){let e=0;for(;e<i.length&&Number(n)>=i[e];)e+=1;return t[e]}return e.unknown}return a.type=`quantile`,a.domain=i,a.range=t,a.thresholds=i,a.ticks=()=>i,a}const bz=e=>e,xz=[`x`,`y`,`x1`,`x2`,`y1`,`y2`,`frameAnchor`];function Sz(e){return xz.some(t=>e[t]!==void 0)||e.transform!==void 0?e:{...e,x:e=>e[0],y:e=>e[1]}}function Cz(e){return typeof e!=`object`||!e}function wz(e,t){return Cz(e)?e:e[t]===void 0&&e.type===`Feature`?e.properties?.[t]:e[t]}const Tz=new Set([`FeatureCollection`,`GeometryCollection`,`Feature`,`Sphere`,`Point`,`MultiPoint`,`LineString`,`MultiLineString`,`Polygon`,`MultiPolygon`]);function Ez(e){return e==null?[]:Array.isArray(e)?e:Tz.has(e.type)?e.type===`FeatureCollection`?e.features:e.type===`GeometryCollection`?e.geometries:[e]:Array.from(e)}function Dz(e){return typeof e==`function`?e:Array.isArray(e)?(t,n)=>e[n]:typeof e==`string`?t=>wz(t,e):typeof e==`object`&&e&&`value`in e?Dz(e.value):()=>e}function Oz(e,t){let n=e??[];return typeof t==`function`?n.map(t):Array.isArray(t)?t:typeof t==`string`?n.map(e=>wz(e,t)):typeof t==`object`&&t&&`value`in t?Oz(n,t.value):n.map(()=>t)}function kz(e){if(typeof e==`string`)return e;if(typeof e==`object`&&e&&typeof e.label==`string`)return e.label}function Az(e,t,n=`color`){return e==null?{constant:t}:typeof e==`string`&&pz(e)?{constant:e}:{value:e,scale:n}}function jz(e,t,n){return e==null?{constant:t}:typeof e==`number`?{constant:e}:{value:e,scale:n}}const Mz=new Set([`second`,`minute`,`hour`,`day`,`week`,`month`,`year`]);function Nz(e){let[,t,n]=/^\s*(?:(\d+)\s+)?(\w+?)s?\s*$/.exec(String(e))??[];return{unit:n,every:t===void 0?1:Number(t)}}function Pz(e){let t=e>=1||Number.isInteger(1/e)===!1,n=t?e:1/e,i=e=>t?Math.floor(e/n)*n:Math.floor(e*n)/n,a=(e,i=1)=>t?e+n*i:(e*n+i)/n;return{floor:i,offset:a,range(e,t){let n=[];for(let o=i(e);o<t;o=a(o))n.push(o);return n}}}function Fz(e,t){return{floor:n=>VL(new Date(n),e,t),offset:(n,i=1)=>HL(new Date(n),e,t*i),range(n,i){let a=[],o=VL(new Date(n),e,t);for(;o.getTime()<Number(i)&&a.length<1e4;)a.push(new Date(o)),o=HL(o,e,t);return a}}}function Iz(e){if(typeof e==`number`)return Pz(e);if(typeof e==`object`&&e)return e;{let{unit:t,every:n}=Nz(e);if(Mz.has(t))return Fz(t,n);throw Error(`unknown interval: `+e)}}function Lz(e){let t=XI(Math.sqrt(e/Math.PI));return`M ${t},0 A ${t},${t} 0 1,1 -${t},0 A ${t},${t} 0 1,1 ${t},0 Z`}function Rz(e){let t=Math.sqrt(e)/2;return`M ${Q(-t,-t)} L ${Q(t,-t)} L ${Q(t,t)} L ${Q(-t,t)} Z`}function zz(e){let t=Math.sqrt(e*4/Math.sqrt(3)),n=t*Math.sqrt(3)/4;return`M ${Q(0,-t/2)} L ${Q(n,t/2)} L ${Q(-n,t/2)} Z`}function Bz(e){let t=Math.sqrt(e/2);return`M ${Q(0,-t)} L ${Q(t,0)} L ${Q(0,t)} L ${Q(-t,0)} Z`}function Vz(e){let t=Math.sqrt(e/5),n=t*3/2;return`M ${Q(-t,-n)} L ${Q(t,-n)} L ${Q(t,-t)} L ${Q(n,-t)} L ${Q(n,t)} L ${Q(t,t)} L ${Q(t,n)} L ${Q(-t,n)} L ${Q(-t,t)} L ${Q(-n,t)} L ${Q(-n,-t)} L ${Q(-t,-t)} Z`}function Hz(e){let t=Math.sqrt(e/Math.PI)*1.5,n=t*.4,i=[];for(let e=0;e<10;e++){let a=e%2==0?t:n,o=e*Math.PI/5-Math.PI/2;i.push(Q(Math.cos(o)*a,Math.sin(o)*a))}return`M ${i.join(` L `)} Z`}function Uz(e){let t=Math.sqrt(e/3);return`M ${Q(0,-(t*2))} L ${Q(t,-t)} L ${Q(t,0)} L ${Q(0,t)} L ${Q(-t,0)} L ${Q(-t,-t)} Z`}function Wz(e){let t=Math.sqrt(e-Math.min(e/7,2))*.87559;return`M ${Q(-t,0)} L ${Q(t,0)} M ${Q(0,t)} L ${Q(0,-t)}`}function Gz(e){let t=Math.sqrt(e-Math.min(e/6,1.7))*.6189;return`M ${Q(-t,-t)} L ${Q(t,t)} M ${Q(-t,t)} L ${Q(t,-t)}`}function Kz(e){let t=Math.sqrt(e+Math.min(e/28,.75))*.59436,n=t/2,i=n*Math.sqrt(3);return`M ${Q(0,t)} L ${Q(0,-t)} M ${Q(-i,-n)} L ${Q(i,n)} M ${Q(-i,n)} L ${Q(i,-n)}`}function qz(e){let t=Math.sqrt(e)*.4431;return`M ${Q(t,t)} L ${Q(t,-t)} L ${Q(-t,-t)} L ${Q(-t,t)} Z`}function Jz(e){let t=Math.sqrt(e)*.6824,n=t/2,i=t*Math.sqrt(3)/2;return`M ${Q(0,-t)} L ${Q(i,n)} L ${Q(-i,n)} Z`}function Yz(e){let t=Math.sqrt(e)*.62625;return`M ${Q(0,-t)} L ${Q(t,0)} L ${Q(0,t)} L ${Q(-t,0)} Z`}function Xz(e){let t=Math.sqrt(e/Math.PI),n=t*2/Math.sqrt(3),i=n/2;return`M ${Q(0,n)} L ${Q(t,i)} L ${Q(t,-i)} L ${Q(0,-n)} L ${Q(-t,-i)} L ${Q(-t,i)} Z`}const Zz={circle:Lz,square:Rz,triangle:zz,diamond:Bz,cross:Vz,star:Hz,wye:Uz,hexagon:Xz,plus:Wz,times:Gz,asterisk:Kz,square2:qz,triangle2:Jz,diamond2:Yz},Qz=Object.keys(Zz),$z=[`circle`,`cross`,`diamond`,`square`,`star`,`triangle`,`wye`],eB=[`circle`,`plus`,`times`,`triangle2`,`asterisk`,`square2`,`diamond2`];function tB(e=`circle`,t=64){return(Zz[e]??Lz)(t)}const $={fill:`currentColor`,stroke:`currentColor`,background:`var(--plot-background, white)`,fontFamily:`system-ui, sans-serif`,fontSize:10,categoricalScheme:`observable10`,categorical:hR,sequentialScheme:`turbo`,divergingScheme:`rdbu`,axisStroke:`currentColor`,axisStrokeOpacity:1,axisTextOpacity:.8,tickSize:6,tickPadding:3,tickCount:10,tickSpacingX:80,tickSpacingY:35,gridStroke:`currentColor`,gridStrokeOpacity:.1,frameStroke:`currentColor`,frameStrokeOpacity:1,labelPadding:10,dotRadius:3,boxFill:`light-dark(#ccc, #555)`,boxWidth:.6,medianStrokeWidth:2,vectorLength:12,vectorRadius:3.5,strokeWidth:1.5,barPadding:.1,bandHeight:20,facetPadding:.2,facetGap:20,legendSwatchSize:15},nB=new Set([`band`,`point`,`ordinal`,`categorical`]);function rB(e){let t=[];for(let n of e)for(let e of n.values)YL(e)&&t.push(e);return t}function iB(e,t,n){let i=e.length>0?rB(e):Ez(t.domain??[]),a=e.find(e=>e.type);return t.type?t.type===`utc`?`time`:t.type:t.domain!==void 0&&Ez(t.domain).length>2&&n===`ordinal`?n:i.length===0?a?a.type:`linear`:i.every(e=>e instanceof Date)?`time`:i.every(e=>typeof e==`number`)?a&&nB.has(a.type)?a.type:`linear`:a&&nB.has(a.type)?a.type:n}function aB(e,t,n){let i=rB(t),a=t.find(e=>e.domain!==void 0);if(n.domain)return Ez(n.domain);if(a)return Ez(a.domain);if(nB.has(e)){let e;if(n.interval!==void 0){let t=Iz(n.interval),[a,o]=ZL(i);e=t.range(a,t.offset(o))}else e=sR(i),n.sort!==!1&&e.sort(XL);return t.some(e=>e.values.some(e=>YL(e)===!1))&&(e=[...e,null]),n.reverse===!0&&e.reverse(),e}{let[a,o]=ZL(i);if(a===void 0)return[0,1];{let i=n.zero===!0||t.some(e=>e.zero===!0),s=i&&e!==`time`?Math.min(0,a):a,c=i&&e!==`time`?Math.max(0,o):o;return s===c&&(s=e===`time`?new Date(Number(s)-1):Number(s)-1,c=e===`time`?new Date(Number(c)+1):Number(c)+1),n.reverse===!0?[c,s]:[s,c]}}}function oB(e,t,n,i,a){return e===`band`?fR({domain:t,range:i??n,padding:a.padding??$.barPadding,paddingInner:a.paddingInner,paddingOuter:a.paddingOuter,align:a.align}):e===`point`?pR({domain:t,range:i??n,padding:a.padding??.5,align:a.align}):e===`time`?JL({domain:t,range:n}):e===`log`?GL({domain:t,range:n,base:a.base}):e===`symlog`?KL({domain:t,range:n,constant:a.constant}):e===`sqrt`||e===`pow`?qL({domain:t,range:n,exponent:a.exponent}):WL({domain:t,range:n,clamp:a.clamp})}function sB(e,t){let n=t.pivot??0,i=Math.min(Number(e[0]),n),a=Math.max(Number(e[1]),n);if(t.symmetric===!1)return[i,a];{let e=Math.max(n-i,a-n);return[n-e,n+e]}}function cB(e,t,n,i){let a=e===`diverging`,o=nB.has(e)?$.categoricalScheme:a?$.divergingScheme:$.sequentialScheme,s=n.scheme??o,c=n.range??cz(s,$.categorical),l=sz.has(String(s).toLowerCase());if(e===`quantile`){let e=n.n??n.range?.length??5;return yz({values:i,range:n.range??uz(s,c,e),unknown:n.unknown??$.fill})}if(a)return vz({domain:sB(t,n),range:c,interpolate:n.interpolate});if(nB.has(e))return mR({domain:t,range:n.range===void 0&&l?uz(s,c,t.length):c,unknown:n.unknown??$.fill});if(n.range===void 0||l||n.type===`sequential`){let i=e!==`linear`&&e!==`sequential`?oB(e,t,[0,1],void 0,n):void 0;return vz({domain:t,range:c,interpolate:n.interpolate,position:i})}return mR({domain:t,range:c,unknown:n.unknown??$.fill})}function lB(e,t,n){let i=e.find(e=>e.radius!==void 0);if(i)return[0,i.radius];{let i=iR(e.map(e=>rR(e.values.filter(uB),.25)));if(i>0){let e=t.map(e=>3*Math.sqrt(e/i)),n=30/$L(e.map(Math.abs));return n<1?e.map(e=>e*n):e}return n}}function uB(e){return e>0}function dB(e,t){let n=iR(e.map(e=>iR(e.values.filter(YL).map(Math.abs)))),i=t.map(e=>12*e/n),a=60/$L(i.map(Math.abs));return a<1?i.map(e=>e*a):i}function fB(e){let{name:t,channels:n,config:i={},range:a,ordinalRange:o}=e,s=t===`color`||t===`symbol`?`ordinal`:t===`fx`||t===`fy`?`band`:`point`,c=t===`fx`||t===`fy`,l=c?i.type??`band`:iB(n,i,s),u=aB(l,n,c?{...i,facet:!0}:i),d=n.some(e=>e.nice===!1);if((t===`x`||t===`y`)&&!nB.has(l)&&l!==`time`&&l!==`log`&&l!==`identity`&&!d&&i.nice!==!1&&i.domain===void 0){let e=typeof i.ticks==`number`?i.ticks:$.tickCount;u=RL(u,e)}let f;if(l===`identity`)f=e=>e,f.type=`identity`,f.domain=u,f.range=u,f.ticks=()=>[];else if(t===`color`)f=cB(l,u,i,rB(n));else if(t===`opacity`)f=WL({domain:u,range:i.range??[0,1],clamp:!0});else if(t===`symbol`){let e=n.some(e=>e.hint===`fill`),t=i.range??(e?$z:eB);f=mR({domain:u,range:t,unknown:t[0]})}else if(t===`length`)f=WL({domain:u,range:i.range??dB(n,u)});else if(t===`r`){let e=i.domain===void 0?[Math.min(0,u[0]),Math.max(0,u[1])]:u;f=qL({domain:e,range:i.range??lB(n,e,a)})}else f=oB(l,u,a,o,i);f.key=t;let p=n.map(e=>e.label).find(Boolean),m=i.percent===!0&&!nB.has(l)&&p!==void 0;return f.label=i.label===void 0?m?p+` (%)`:p:i.label,f.config=i,f}function pB(e){return nB.has(e.type)}function mB(e,t){let n=e.label===void 0?t.label:e.label;if(!(e.label===void 0&&t.type===`time`&&/^(date|time|year)$/i.test(String(n))))return n}function hB(e,t={},n){return Array.isArray(t.ticks)?t.ticks:typeof t.ticks==`number`?e.ticks(t.ticks):e.ticks(n??$.tickCount)}function gB(e,t){let n=e(t);return e.bandwidth?n+e.bandwidth()/2:n}function _B(e,t,n={}){let i=e===`color`?`ordinal`:e===`fx`||e===`fy`?`band`:`point`,a=e===`fx`||e===`fy`,o=a?n.type??`band`:iB(t,n,i);if(nB.has(o))return aB(o,t,a?{...n,facet:!0}:n).length}let vB=0;const yB=`:where(.plot-swatches) {
|
|
444
|
+
</foreignObject>`}}}const TL=II(`cs.js`,`c:`,`ser.strCache.numCache.gapWidth.overlap.chartStyle.colorStyle.axisTitle.categoryAxis.chartArea.dataLabel.dataLabelCallout.dataPoint.dataPoint3D.dataPointLine.dataPointMarker.dataPointMarkerLayout.dataPointWireframe.dataTable.downBar.dropLine.errorBar.floor.gridlineMajor.gridlineMinor.hiLoLine.leaderLine.legend.plotArea.plotArea3D.seriesAxis.seriesLine.title.trendline.trendlineLabel.upBar.valueAxis.wall.lnRef.fillRef.effectRef.fontRef.styleClr.spPr.bodyPr.defRPr.variation.order.tx.cat.numRef.numLit.variation.strRef.strLit.pt.v.idx.val.meth.id.mods.symbol.size`.split(`.`));function EL(e,t={}){let{theme:n,upstreams:i}=t;return{idx:parseInt(Y(e,[TL.idx])?.attributes?.val??`0`),order:parseInt(Y(e,[TL.order])?.attributes?.val??`0`),name:DL(Y(e,[TL.tx])),categories:DL(Y(e,[TL.cat])),values:OL(Y(e,[TL.val])),fill:AL(Y(e,[TL.spPr]))}}function DL(e){if(e){let t=J(e,TL.strRef);if(t){let e=J(t,`c:strCache`);if(e)return kL(e)}let n=J(e,TL.strLit);if(n)return kL(n)}return[]}function OL(e){if(e){let t=J(e,TL.numRef);if(t){let e=J(t,`c:numCache`);if(e)return kL(e).map(e=>parseFloat(e))}let n=J(e,TL.numLit);if(n)return kL(n).map(e=>parseFloat(e))}return[]}function kL(e){let t=[];if(e){for(let n of e.children)if(n.name===TL.pt){let e=parseInt(n.attributes?.idx??`0`),i=J(n,TL.v);t[e]=i?Dk(i):``}}return t}function AL(e){if(e){let t=J(e,X.solidFill);if(t){let e=J(t,X.schemeClr);if(e)return{type:`scheme`,value:e.attributes?.val};let n=J(t,X.srgbClr);if(n)return{type:`rgb`,value:`#`+n.attributes?.val}}}return null}function jL(e){let{$colorStyle:t,theme:n,upstreams:i=[]}=e,a=[],o=[];if(t){for(let e of t.children)if(e.name===X.schemeClr)a.push(e.attributes?.val);else if(e.name===TL.variation){let t=s(e);o.push(t)}}function s(e){let t={};for(let n of e.children)n.name===`a:lumMod`?t.lumMod=parseInt(n.attributes?.val??`100000`)/1e5:n.name===`a:lumOff`&&(t.lumOff=parseInt(n.attributes?.val??`0`)/1e5);return t}function c(e,t){let n=a.length,i=o.length||1,s=e%n,c=Math.floor(e/n)%i,u=a[s],d=o[c]||{};if(t){let e=t(u);return e&&(d.lumMod||d.lumOff)&&(e=l(e,d.lumMod,d.lumOff)),e}return{scheme:u,...d}}function l(e,t=1,n=0){if(!e||!e.startsWith(`#`))return e;let i=parseInt(e.slice(1,3),16)/255,a=parseInt(e.slice(3,5),16)/255,o=parseInt(e.slice(5,7),16)/255,s=Math.max(i,a,o),c=Math.min(i,a,o),l,u,d=(s+c)/2;if(s===c)l=u=0;else{let e=s-c;u=d>.5?e/(2-s-c):e/(s+c),l=s===i?((a-o)/e+(a<o?6:0))/6:s===a?((o-i)/e+2)/6:((i-a)/e+4)/6}d=d*t+n,d=Math.max(0,Math.min(1,d));function f(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}let p,m,h;if(u===0)p=m=h=d;else{let e=d<.5?d*(1+u):d+u-d*u,t=2*d-e;p=f(t,e,l+1/3),m=f(t,e,l),h=f(t,e,l-1/3)}let g=e=>Math.round(e*255).toString(16).padStart(2,`0`);return`#${g(p)}${g(m)}${g(h)}`}return{colors:a,variations:o,getSeriesColor:c}}function ML(e){let{$chartStyle:t,theme:n,upstreams:i=[]}=e,a=t?.attributes?.id;function o(e){return t?J(t,e):null}function s(e){let t=J(e,sL.defRPr);if(t){let e=t.attributes||{};return{fontSize:e.sz?parseInt(e.sz)/100:null,bold:e.b===`1`,kern:e.kern?parseInt(e.kern):null}}return null}function c(e){let t=J(e,sL.fontRef);return t?{idx:t.attributes?.idx,color:J(t,X.schemeClr)?.attributes?.val}:null}function l(e){let t=J(e,sL.spPr);if(t){let e={},n=J(t,X.ln);if(n){let t=n.attributes?.w;t&&(e.lineWidth=parseInt(t)/12700);let i=J(n,X.solidFill);if(i){let t=J(i,X.schemeClr);t&&(e.lineColor={scheme:t.attributes?.val})}}let i=J(t,X.solidFill);if(i){let t=J(i,X.schemeClr);t&&(e.fillColor={scheme:t.attributes?.val})}return J(t,X.noFill)&&(e.noFill=!0),e}return null}function u(){let e=o(sL.title);return e?{font:c(e),text:s(e),shape:l(e)}:null}function d(){let e=o(sL.legend);return e?{font:c(e),text:s(e)}:null}function f(){let e=o(sL.dataPoint);return e?{font:c(e),shape:l(e)}:null}function p(){let e=o(sL.categoryAxis);return e?{font:c(e),text:s(e),shape:l(e)}:null}function m(){let e=o(sL.valueAxis);return e?{font:c(e),text:s(e),shape:l(e)}:null}function h(){let e=[],t=u();t?.text?.fontSize&&e.push(`.chart-title { font-size: ${t.text.fontSize}pt; }`);let n=d();return n?.text?.fontSize&&e.push(`.chart-legend { font-size: ${n.text.fontSize}pt; }`),e.join(`
|
|
445
|
+
`)}return{styleId:a,getTitleStyle:u,getLegendStyle:d,getDataPointStyle:f,getCategoryAxisStyle:p,getValueAxisStyle:m,generateCSS:h}}const NL=`http://www.w3.org/1999/xhtml`;function PL(){let e={};return{setProperty(t,n){e[t]=n},removeProperty(t){delete e[t]},getPropertyValue(t){return e[t]||``},get cssText(){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)},set cssText(t){for(let t of Object.keys(e))delete e[t];t&&t.split(`;`).forEach(t=>{let[n,i]=t.split(`:`).map(e=>e.trim());n&&i&&(e[n]=i)})}}}function FL(e){return{add(...t){let n=(e.getAttribute(`class`)||``).split(/\s+/).filter(Boolean),i=new Set(n);t.forEach(e=>i.add(e)),e.setAttribute(`class`,[...i].join(` `))},remove(...t){let n=(e.getAttribute(`class`)||``).split(/\s+/).filter(Boolean),i=new Set(n);t.forEach(e=>i.delete(e)),e.setAttribute(`class`,[...i].join(` `))},contains(t){return(e.getAttribute(`class`)||``).split(/\s+/).includes(t)},toggle(e){this.contains(e)?this.remove(e):this.add(e)}}}function IL(e,t=NL){let n={},i=[],a=PL(),o=``,s={nodeType:1,tagName:e,nodeName:e,namespaceURI:t,attributes:n,children:i,childNodes:i,style:a,ownerDocument:null,parentNode:null,parentElement:null,get textContent(){return i.length===0?o:i.map(e=>e.textContent).join(``)+o},set textContent(e){i.length=0,o=e},get className(){return n.class||``},set className(e){n.class=e},get classList(){return FL(s)},get id(){return n.id||``},set id(e){n.id=e},setAttribute(e,t){n[e]=String(t)},getAttribute(e){return n[e]},removeAttribute(e){delete n[e]},hasAttribute(e){return e in n},setAttributeNS(e,t,i){n[t]=String(i)},getAttributeNS(e,t){return n[t]},removeAttributeNS(e,t){delete n[t]},hasAttributeNS(e,t){return t in n},appendChild(e){return e.parentNode=s,e.parentElement=s,i.push(e),e},append(...e){for(let t of e)if(t!=null){if(typeof t==`string`){let e=s.ownerDocument.createTextNode(t);i.push(e)}else t.parentNode=s,t.parentElement=s,i.push(t)}},prepend(...e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n!=null){if(typeof n==`string`){let e=s.ownerDocument.createTextNode(n);i.unshift(e)}else n.parentNode=s,n.parentElement=s,i.unshift(n)}}},removeChild(e){let t=i.indexOf(e);return t>=0&&i.splice(t,1),e.parentNode=null,e.parentElement=null,e},replaceChild(e,t){let n=i.indexOf(t);return n>=0&&(i[n]=e,e.parentNode=s,e.parentElement=s,t.parentNode=null,t.parentElement=null),t},insertBefore(e,t){e.parentNode=s,e.parentElement=s;let n=t?i.indexOf(t):i.length;return i.splice(n>=0?n:i.length,0,e),e},remove(){s.parentNode&&s.parentNode.removeChild(s)},cloneNode(a){let c=IL(e,t);if(c.ownerDocument=s.ownerDocument,Object.assign(c.attributes,n),c._textContent=o,a)for(let e of i)c.appendChild(e.cloneNode(!0));return c},querySelector(e){return null},querySelectorAll(e){return[]},getElementsByTagName(e){let t=[];function n(i){for(let a of i.children||[])(a.tagName===e||e===`*`)&&t.push(a),n(a)}return n(s),t},getElementsByClassName(e){return[]},getElementById(e){return null},matches(e){return!1},closest(e){return null},getBoundingClientRect(){return{x:0,y:0,width:0,height:0,top:0,left:0,right:0,bottom:0}},getComputedStyle(){return a},get firstChild(){return i[0]||null},get lastChild(){return i[i.length-1]||null},get firstElementChild(){return i.find(e=>e.nodeType===1)||null},get lastElementChild(){return[...i].reverse().find(e=>e.nodeType===1)||null},get nextSibling(){if(!s.parentNode)return null;let e=s.parentNode.children;return e[e.indexOf(s)+1]||null},get previousSibling(){if(!s.parentNode)return null;let e=s.parentNode.children,t=e.indexOf(s);return t>0?e[t-1]:null},get nextElementSibling(){return s.nextSibling},get previousElementSibling(){return s.previousSibling},addEventListener(){},removeEventListener(){},dispatchEvent(){return!0},focus(){},blur(){},click(){},get outerHTML(){let t=Object.entries(n).map(([e,t])=>` ${e}="${String(t).replace(/&/g,`&`).replace(/"/g,`"`)}"`).join(``),s=a.cssText,c=s?` style="${s}"`:``,l=i.map(e=>e.outerHTML??e.textContent).join(``)+o;return[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`].includes(e.toLowerCase())?`<${e}${t}${c}/>`:`<${e}${t}${c}>${l}</${e}>`},get innerHTML(){return i.map(e=>e.outerHTML??e.textContent).join(``)},set innerHTML(e){i.length=0,o=``}};return s}function LL(e,t){return{nodeType:3,nodeName:`#text`,textContent:t,ownerDocument:e,parentNode:null,parentElement:null,get outerHTML(){return this.textContent},cloneNode(){return LL(e,t)}}}function RL(){let e={nodeType:9,nodeName:`#document`,documentElement:null,body:null,head:null,defaultView:null,createElement(t){let n=IL(t,NL);return n.ownerDocument=e,n},createElementNS(t,n){let i=IL(n,t);return i.ownerDocument=e,i},createTextNode(t){return LL(e,t)},createComment(t){return{nodeType:8,nodeName:`#comment`,textContent:t,ownerDocument:e,get outerHTML(){return`<!--${t}-->`},cloneNode(){return e.createComment(t)}}},createDocumentFragment(){let t=[];return{nodeType:11,nodeName:`#document-fragment`,children:t,childNodes:t,ownerDocument:e,appendChild(e){return e.parentNode=this,t.push(e),e},append(...n){for(let i of n)i!=null&&(typeof i==`string`?t.push(LL(e,i)):(i.parentNode=this,t.push(i)))},get firstChild(){return t[0]||null},get lastChild(){return t[t.length-1]||null},cloneNode(n){let i=e.createDocumentFragment();if(n)for(let e of t)i.appendChild(e.cloneNode(!0));return i}}},querySelector(e){return null},querySelectorAll(e){return[]},getElementById(e){return null},getElementsByTagName(t){return e.documentElement?e.documentElement.getElementsByTagName(t):[]},getElementsByClassName(e){return[]},createRange(){return{setStart(){},setEnd(){},selectNode(){},selectNodeContents(){},createContextualFragment(t){return e.createDocumentFragment()}}},get activeElement(){return e.body}},t=IL(`html`,NL);t.ownerDocument=e;let n=IL(`head`,NL);n.ownerDocument=e;let i=IL(`body`,NL);return i.ownerDocument=e,t.appendChild(n),t.appendChild(i),e.documentElement=t,e.head=n,e.body=i,e}function zL(e){return{document:e,getComputedStyle(e){return e.style},requestAnimationFrame(e){return setTimeout(e,16)},cancelAnimationFrame(e){clearTimeout(e)},addEventListener(){},removeEventListener(){},dispatchEvent(){return!0},innerWidth:1024,innerHeight:768,devicePixelRatio:1,scrollX:0,scrollY:0,pageXOffset:0,pageYOffset:0,location:{href:``,protocol:`file:`,host:``,hostname:``,pathname:``},navigator:{userAgent:`node`},Node:{ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_FRAGMENT_NODE:11}}}if(typeof global<`u`){let e=RL(),t=zL(e);e.defaultView=t,global.isNode=!0,global.document=e,global.window=t}const BL=[``,`k`,`M`,`G`,`T`,`P`];function VL(e){let t=e<0;if(Math.abs(e)<1)return HL(e);let n=Math.abs(e),i=0;for(;n>=1e3&&i<BL.length-1;)n/=1e3,i+=1;let a=+(n<10&&i>0);return(t?`-`:``)+Number(n.toFixed(a))+BL[i]}function HL(e){return String(Number.isFinite(e)?Number(e.toPrecision(12)):e)}function UL(e){let t=e.startsWith(`-`),n=t?e.slice(1):e,i=n.indexOf(`.`),a=i<0?n:n.slice(0,i),o=i<0?``:n.slice(i);return(t?`-`:``)+a.replace(/\B(?=(\d{3})+$)/g,`,`)+o}function WL(e){let t=String(Number(e.toPrecision(12))),n=t.indexOf(`.`);return n<0||t.includes(`e`)?0:t.length-n-1}function GL(e){return e.length>0&&e.every(e=>Number.isInteger(e)&&e>=1500&&e<=2500)}function KL(e,t=!GL(e)){let n=0;for(let t of e)typeof t==`number`&&Number.isFinite(t)&&(n=Math.max(n,WL(t)));return e=>{if(typeof e==`number`&&Number.isFinite(e)){let i=e.toFixed(n);return t?UL(i):i}return String(e)}}function qL(e){return t=>Number(t).toFixed(e)}function JL(e){return Number((e*100).toPrecision(12))+`%`}const YL=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function XL(e){return String(e).padStart(2,`0`)}function ZL(e,t=0){let n=e instanceof Date?e:new Date(e),i=864e5;return t>=i*300?String(n.getUTCFullYear()):t>=i*20?YL[n.getUTCMonth()]+` `+n.getUTCFullYear():t>i*2?YL[n.getUTCMonth()]+` `+n.getUTCDate():XL(n.getUTCHours())+`:`+XL(n.getUTCMinutes())}function QL(e){let t=864e5,n=e.map(Number).sort((e,t)=>e-t),i=n.length>1?(n[n.length-1]-n[0])/(n.length-1):0,a=new Set,o;for(let e of n){let t=new Date(e).getUTCMonth();t!==o&&(o=t,a.add(e))}return e=>{let n=e instanceof Date?e:new Date(e);return i>=t*300?String(n.getUTCFullYear()):i>=t*20?n.getUTCMonth()===0?YL[0]+` `+n.getUTCFullYear():YL[n.getUTCMonth()]:i>t*2||i===0?YL[n.getUTCMonth()]+` `+n.getUTCDate():i>=t?a.has(Number(n))?YL[n.getUTCMonth()]+` `+n.getUTCDate():String(n.getUTCDate()):XL(n.getUTCHours())+`:`+XL(n.getUTCMinutes())}}function $L(e,t=10,n){let i=e.base??10,a=Math.max(1,i*t/e.ticks().length);return e=>{let t=Math.round(Math.log(e)/Math.log(i)),o=e/i**+t;return o*i<i-.5&&(o*=i),o<=a?n(e):``}}function eR(e,t,n){if(typeof e==`function`)return e;if(e===`s`)return VL;if(e===`%`)return JL;if(typeof e==`string`&&/^\.\d+f$/.test(e))return qL(Number(e.slice(1,-1)));if(e===`d`)return e=>String(Math.round(Number(e)));if(e===`,`||e===`,d`)return KL(n??[],!0);if(t&&t.type===`log`&&e===void 0&&(t.base??10)===10)return VL;if(t&&t.type===`time`){if(n)return QL(n);{let[e,n]=t.domain,i=Math.abs(Number(n)-Number(e));return e=>ZL(e,i)}}return t&&(t.type===`band`||t.type===`point`||t.type===`ordinal`)?n&&n.length>0&&n[0]instanceof Date?QL(n):String:n?KL(n):e=>typeof e==`number`?HL(e):String(e)}function tR(e,t){return t==null?e instanceof Date?ZL(e,2592e7):String(e):String(nR(t)(e))}function nR(e,t,n,i){let a=eR(e,t,n);return t&&t.type===`log`?$L(t,i,a):a}function rR(e=`en-US`,t=`short`){let n=new Intl.DateTimeFormat(e,{timeZone:`UTC`,month:t});return e=>n.format(new Date(Date.UTC(2e3,Number(e))))}function iR(e=`en-US`,t=`short`){let n=new Intl.DateTimeFormat(e,{timeZone:`UTC`,weekday:t});return e=>n.format(new Date(Date.UTC(2001,0,Number(e))))}function aR(e){return(e instanceof Date?e:new Date(e)).toISOString().slice(0,10)}function oR(e){return String(Number.isFinite(e)?Math.round(e*10)/10:e)}function Q(e,t){return`${oR(e)},${oR(t)}`}const sR=`http://www.w3.org/2000/svg`,cR=typeof document<`u`,lR=new Set([`viewBox`,`preserveAspectRatio`,`gradientUnits`,`gradientTransform`,`patternUnits`,`patternTransform`,`spreadMethod`,`markerWidth`,`markerHeight`,`markerUnits`,`refX`,`refY`,`textLength`,`lengthAdjust`,`startOffset`,`clipPathUnits`,`maskUnits`,`stdDeviation`,`baseFrequency`]);function uR(e){return lR.has(e)?e:e.replace(/([A-Z])/g,`-$1`).toLowerCase()}const dR=new Set([`opacity`,`fill-opacity`,`stroke-opacity`,`stop-opacity`,`offset`]);function fR(e,t){return typeof t==`number`&&dR.has(e)===!1?oR(t):t}function pR(e){return String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function mR(e){return pR(e).replace(/"/g,`"`)}function hR(e){let t={tag:e,attributes:{},styles:{},children:[],textContent:``,style:{},parent:void 0,setAttribute:n,appendChild:i,replaceWith:a,toString:o};function n(e,n){t.attributes[uR(e)]=n}function i(e){return t.children.push(e),e&&typeof e==`object`&&(e.parent=t),e}function a(e){t.parent&&(t.parent.children[t.parent.children.indexOf(t)]=e,e.parent=t.parent)}function o(){let n=[];for(let e of Object.keys(t.attributes))n.push(e+`="`+mR(t.attributes[e])+`"`);let i=Object.keys(t.style);if(i.length>0){let e=i.map(e=>uR(e)+`:`+t.style[e]);n.push(`style="`+mR(e.join(`;`))+`"`)}let a=n.length>0?e+` `+n.join(` `):e,o=(e===`style`?t.textContent:pR(t.textContent))+t.children.map(String).join(``);return o.length>0?`<`+a+`>`+o+`</`+e+`>`:`<`+a+`/>`}return t}function gR(e,t){for(let n of Object.keys(t)){let i=t[n];if(i!=null){if(n===`textContent`)e.textContent=String(i);else if(n===`style`&&typeof i==`object`)for(let t of Object.keys(i))e.style[t]=i[t];else{let t=uR(n);e.setAttribute(t,fR(t,i))}}}return e}function _R(e,t={}){return gR(cR?document.createElementNS(sR,e):hR(e),t)}function vR(e,t={}){return gR(cR?document.createElement(e):hR(e),t)}function yR(e={}){let t=(e.width??640)+1,n=(e.height??400)+1;return _R(`svg`,{...e,xmlns:sR,width:t,height:n,viewBox:e.viewBox??`0 0 `+t+` `+n})}const bR=e=>_R(`g`,e),xR=e=>_R(`rect`,e),SR=e=>_R(`line`,e),CR=e=>_R(`text`,e),wR=e=>_R(`circle`,e),TR=e=>_R(`path`,{fill:`none`,...e}),ER=e=>_R(`tspan`,e),DR=e=>_R(`defs`,e),OR=e=>_R(`clipPath`,e),kR=e=>vR(`figure`,e),AR=e=>vR(`figcaption`,e),jR=e=>vR(`div`,e),MR=e=>vR(`span`,e);function NR(e){let t=_R(`style`);return t.textContent=e,t}function PR(e,t,n={}){return{...n,interaction:{kx:e,ky:t,maxRadius:n.maxRadius??40}}}function FR(e={}){return PR(1,1,e)}function IR(e={}){return PR(1,.01,e)}function LR(e={}){return PR(.01,1,e)}function RR(e,t,n,i,a){let o=e.px??e.x,s=e.py??e.y;return[o?o[t]+n:a.width/2,s?s[t]+i:a.height/2]}function zR(e,t,n){let{state:i,index:a,interaction:o,offsetX:s,offsetY:c,dimensions:l}=e,u,d=o.maxRadius*o.maxRadius;for(let e of a){let[a,f]=RR(i.values,e,s,c,l),p=o.kx*(a-t),m=o.ky*(f-n),h=p*p+m*m;h<=d&&(u=e,d=h)}return u}function BR(e,t,n){let i=t.getBoundingClientRect(),a=Number(t.getAttribute(`width`)),o=i.width>0?a/i.width:1,s=(e.clientX-i.left)*o,c=(e.clientY-i.top)*o;return[s-n.originX,c-n.originY]}function VR(e,t){function n(n){for(let i of t){let[t,a]=BR(n,e,i);i.draw(zR(i,t,a))}}function i(){for(let e of t)e.draw(void 0)}e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,i)}const HR=Math.sqrt(50),UR=Math.sqrt(10),WR=Math.sqrt(2);function GR(e,t,n=10){let i=Math.abs(t-e)/Math.max(1,n);if(i>0&&Number.isFinite(i)){let e=10**Math.floor(Math.log10(i)),t=i/e,n=1;return t>=HR?n=10:t>=UR?n=5:t>=WR&&(n=2),n*e}return 1}function KR(e,t){let n=Math.max(0,-Math.floor(Math.log10(t)));return Number(e.toFixed(Math.min(20,n)))}function qR(e,t,n=10){let i=Math.min(e,t),a=Math.max(e,t);if(i===a)return[i];{let o=GR(i,a,n),s=Math.ceil(i/o),c=Math.floor(a/o),l=[];for(let e=s;e<=c;e++)l.push(KR(e*o,o));return e>t&&l.reverse(),l}}function JR(e,t=10){let[n,i]=e;if(n===i||!Number.isFinite(n)||!Number.isFinite(i))return e;{let e=n>i,a=e?i:n,o=e?n:i,s=GR(a,o,t),c=KR(Math.floor(a/s)*s,s),l=KR(Math.ceil(o/s)*s,s);return e?[l,c]:[c,l]}}const YR={second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5,month:26298e5,year:315576e5},XR=[[`second`,1],[`second`,5],[`second`,15],[`second`,30],[`minute`,1],[`minute`,5],[`minute`,15],[`minute`,30],[`hour`,1],[`hour`,3],[`hour`,6],[`hour`,12],[`day`,1],[`day`,2],[`week`,1],[`month`,1],[`month`,3],[`year`,1]];function ZR(e,t,n){let i=new Date(e);return t===`year`?(i.setUTCMonth(0,1),i.setUTCHours(0,0,0,0),i.setUTCFullYear(Math.floor(i.getUTCFullYear()/n)*n)):t===`month`?(i.setUTCDate(1),i.setUTCHours(0,0,0,0),i.setUTCMonth(Math.floor(i.getUTCMonth()/n)*n)):t===`week`?(i.setUTCHours(0,0,0,0),i.setUTCDate(i.getUTCDate()-i.getUTCDay())):t===`day`?i.setUTCHours(0,0,0,0):t===`hour`?i.setUTCMinutes(0,0,0):t===`minute`?i.setUTCSeconds(0,0):i.setUTCMilliseconds(0),i}function QR(e,t,n){let i=new Date(e);return t===`year`?i.setUTCFullYear(i.getUTCFullYear()+n):t===`month`?i.setUTCMonth(i.getUTCMonth()+n):i.setTime(i.getTime()+YR[t]*n),i}function $R(e,t,n=10){let i=Math.min(Number(e),Number(t)),a=Math.max(Number(e),Number(t)),o=(a-i)/Math.max(1,n),s=`year`,c=1,l=1/0;for(let[e,t]of XR){let n=YR[e]*t,i=n>o?n/o:o/n;i<l&&(l=i,s=e,c=t)}s===`year`&&o>YR.year&&(c=Math.max(1,Math.round(GR(i/YR.year,a/YR.year,n))));let u=[],d=ZR(new Date(i),s,c);for(d.getTime()<i&&(d=QR(d,s,c));d.getTime()<=a&&u.length<1e3;)u.push(new Date(d)),d=QR(d,s,c);return u}function ez(e={}){let t=e.domain??[0,1],n=e.range??[0,1],i=e.clamp===!0,[a,o]=t,[s,c]=n,l=o-a,u=c-s;function d(e){if(l===0)return(s+c)/2;{let t=(e-a)/l;return s+(i?Math.max(0,Math.min(1,t)):t)*u}}return d.type=`linear`,d.domain=t,d.range=n,d.invert=e=>a+(e-s)/u*l,d.ticks=(e=10)=>qR(a,o,e),d.nice=(n=10)=>ez({...e,domain:JR(t,n)}),d}function tz(e={}){let t=e.domain??[1,10],n=e.range??[0,1],i=e.base??10,a=e=>Math.log(e)/Math.log(i),[o,s]=t,[c,l]=n,u=a(o),d=a(s)-u,f=l-c;function p(e){return d===0||e<=0?(c+l)/2:c+(a(e)-u)/d*f}return p.type=`log`,p.base=i,p.domain=t,p.range=n,p.invert=e=>i**+(u+(e-c)/f*d),p.ticks=(e=10)=>{let t=Math.min(o,s),n=Math.max(o,s),c=Number(a(t).toPrecision(12)),l=Number(a(n).toPrecision(12)),u;if(Number.isInteger(i)&&t>0&&l-c<e){u=[];for(let e=Math.floor(c);e<=Math.ceil(l);e++)for(let a=1;a<i;a++){let o=a*i**+e;o>=t&&o<=n&&u.push(Number(o.toPrecision(12)))}u.length*2<e&&(u=qR(t,n,e))}else u=qR(c,l,Math.min(Math.ceil(l-c),e)).map(e=>i**+e);return o>s&&u.reverse(),u},p.nice=()=>tz({...e,domain:[i**+Math.floor(u),i**+Math.ceil(a(s))]}),p}function nz(e={}){let t=e.domain??[0,1],n=e.range??[0,1],i=e.constant??1,a=e=>Math.sign(e)*Math.log1p(Math.abs(e/i)),[o,s]=t.map(Number),[c,l]=n,u=a(o),d=a(s)-u,f=l-c;function p(e){return d===0?(c+l)/2:c+(a(Number(e))-u)/d*f}return p.type=`symlog`,p.domain=t,p.range=n,p.invert=e=>{let t=u+(e-c)/f*d;return Math.sign(t)*Math.expm1(Math.abs(t))*i},p.ticks=(e=10)=>qR(o,s,e),p}function rz(e={}){let t=e.domain??[0,1],n=e.range??[0,1],i=e.exponent??.5,a=e=>Math.sign(e)*Math.abs(e)**+i,[o,s]=t,[c,l]=n,u=a(o),d=a(s)-u,f=l-c;function p(e){return d===0?(c+l)/2:c+(a(e)-u)/d*f}return p.type=`sqrt`,p.domain=t,p.range=n,p.ticks=(e=5)=>qR(o,s,e),p.nice=()=>rz(e),p}function iz(e={}){let t=e.domain??[new Date(0),new Date],n=e.range??[0,1],[i,a]=t.map(Number),[o,s]=n,c=a-i,l=s-o;function u(e){return c===0?(o+s)/2:o+(Number(e)-i)/c*l}return u.type=`time`,u.domain=t,u.range=n,u.invert=e=>new Date(i+(e-o)/l*c),u.ticks=(e=10)=>$R(i,a,e),u.nice=()=>iz(e),u}function az(e){return e!=null&&!(typeof e==`number`&&Number.isNaN(e))}function oz(e,t){return e<t?-1:+(e>t)}function sz(e){let t,n;for(let i of e)az(i)&&((t===void 0||i<t)&&(t=i),(n===void 0||i>n)&&(n=i));return[t,n]}function cz(e){return sz(e)[0]}function lz(e){return sz(e)[1]}function uz(e){let t=0;for(let n of e)az(n)&&(t+=Number(n));return t}function dz(e){let t=0;for(let n of e)az(n)&&(t+=1);return t}function fz(e){let t=dz(e);if(t>0)return uz(e)/t}function pz(e,t){let n=e.filter(az).map(Number).sort(oz);if(n.length!==0){if(n.length===1)return n[0];{let e=(n.length-1)*t,i=Math.floor(e),a=Math.ceil(e);return n[i]+(n[a]-n[i])*(e-i)}}}function mz(e){return pz(e,.5)}function hz(e){let t=fz(e);if(t!==void 0){let n=e.filter(az).map(Number),i=n.reduce((e,n)=>e+(n-t)**2,0);return n.length>1?Math.sqrt(i/(n.length-1)):0}}function gz(e){return e instanceof Date?+e:e}function _z(e){let t=new Set,n=[];for(let i of e)az(i)&&!t.has(gz(i))&&(t.add(gz(i)),n.push(i));return n}function vz(e){let t=dz(e),n=hz(e),[i,a]=sz(e);return t>0&&n>0?Math.min(200,Math.max(1,Math.ceil((a-i)*Math.cbrt(t)/(3.49*n)))):1}function yz(e){let t=hz(e);if(t!==void 0)return t*t}function bz(e){let t=new Map,n,i=0;for(let a of e)if(az(a)){let e=(t.get(a)??0)+1;t.set(a,e),e>i&&(n=a,i=e)}return n}function xz(e){let t=e.map((e,t)=>t);t.sort((t,n)=>oz(e[t],e[n]));let n=Array(e.length);for(let i=0;i<t.length;i++){let a=i>0&&oz(e[t[i-1]],e[t[i]])===0;n[t[i]]=a?n[t[i-1]]:i}return n}function Sz(e={}){let t=e.domain??[],n=e.range??[0,1],i=e.paddingInner??e.padding??.1,a=e.paddingOuter??e.padding??.1,o=e.align??.5,s=n[1]<n[0],c=s?n[1]:n[0],l=(s?n[0]:n[1])-c,u=Math.max(1,t.length),d=l/Math.max(1,u-i+a*2),f=d*(1-i),p=c+(l-d*(u-i))*o,m=new Map(t.map((e,n)=>[gz(e),s?t.length-1-n:n]));function h(e){let t=m.get(az(e)?gz(e):null);if(t!==void 0)return p+d*t}return h.type=`band`,h.domain=t,h.range=n,h.bandwidth=()=>f,h.step=()=>d,h.ticks=()=>t,h.invert=e=>{let n=Math.max(0,Math.min(t.length-1,Math.floor((e-p)/d)));return t[s?t.length-1-n:n]},h}function Cz(e={}){let t=e.domain??[],n=e.range??[0,1],i=e.padding??.5,a=e.align??.5,o=n[1]<n[0],s=o?n[1]:n[0],c=(o?n[0]:n[1])-s,l=Math.max(1,t.length),u=c/Math.max(1,l-1+i*2),d=s+(c-u*(l-1))*a,f=new Map(t.map((e,n)=>[gz(e),o?t.length-1-n:n]));function p(e){let t=f.get(az(e)?gz(e):null);if(t!==void 0)return d+u*t}return p.type=`point`,p.domain=t,p.range=n,p.bandwidth=()=>0,p.step=()=>u,p.ticks=()=>t,p.invert=e=>{let n=Math.max(0,Math.min(t.length-1,Math.round((e-d)/u)));return t[o?t.length-1-n:n]},p}function wz(e={}){let t=e.domain??[],n=e.range??[],i=e.unknown??`currentColor`,a=new Map(t.map((e,t)=>[gz(e),t]));function o(e){let t=a.get(az(e)?gz(e):null);return t===void 0||n.length===0?i:n[t%n.length]}return o.type=`ordinal`,o.domain=t,o.range=n,o.ticks=()=>t,o}const Tz=[`#4269d0`,`#efb118`,`#ff725c`,`#6cc5b0`,`#3ca951`,`#ff8ab7`,`#a463f2`,`#97bbf5`,`#9c6b4e`,`#9498a0`],Ez=[`#1f77b4`,`#ff7f0e`,`#2ca02c`,`#d62728`,`#9467bd`,`#8c564b`,`#e377c2`,`#7f7f7f`,`#bcbd22`,`#17becf`],Dz=[`#4e79a7`,`#f28e2c`,`#e15759`,`#76b7b2`,`#59a14f`,`#edc949`,`#af7aa1`,`#ff9da7`,`#9c755f`,`#bab0ab`],Oz=[`#7fc97f`,`#beaed4`,`#fdc086`,`#ffff99`,`#386cb0`,`#f0027f`,`#bf5b17`,`#666666`],kz=[`#1b9e77`,`#d95f02`,`#7570b3`,`#e7298a`,`#66a61e`,`#e6ab02`,`#a6761d`,`#666666`],Az=[`#a6cee3`,`#1f78b4`,`#b2df8a`,`#33a02c`,`#fb9a99`,`#e31a1c`,`#fdbf6f`,`#ff7f00`,`#cab2d6`,`#6a3d9a`,`#ffff99`,`#b15928`],jz=[`#fbb4ae`,`#b3cde3`,`#ccebc5`,`#decbe4`,`#fed9a6`,`#ffffcc`,`#e5d8bd`,`#fddaec`,`#f2f2f2`],Mz=[`#b3e2cd`,`#fdcdac`,`#cbd5e8`,`#f4cae4`,`#e6f5c9`,`#fff2ae`,`#f1e2cc`,`#cccccc`],Nz=[`#e41a1c`,`#377eb8`,`#4daf4a`,`#984ea3`,`#ff7f00`,`#ffff33`,`#a65628`,`#f781bf`,`#999999`],Pz=[`#66c2a5`,`#fc8d62`,`#8da0cb`,`#e78ac3`,`#a6d854`,`#ffd92f`,`#e5c494`,`#b3b3b3`],Fz=[`#8dd3c7`,`#ffffb3`,`#bebada`,`#fb8072`,`#80b1d3`,`#fdb462`,`#b3de69`,`#fccde5`,`#d9d9d9`,`#bc80bd`,`#ccebc5`,`#ffed6f`],Iz=[`#f7fbff`,`#deebf7`,`#c6dbef`,`#9ecae1`,`#6baed6`,`#4292c6`,`#2171b5`,`#08519c`,`#08306b`],Lz=[`#f7fcf5`,`#e5f5e0`,`#c7e9c0`,`#a1d99b`,`#74c476`,`#41ab5d`,`#238b45`,`#006d2c`,`#00441b`],Rz=[`#fff5eb`,`#fee6ce`,`#fdd0a2`,`#fdae6b`,`#fd8d3c`,`#f16913`,`#d94801`,`#a63603`,`#7f2704`],zz=[`#fcfbfd`,`#efedf5`,`#dadaeb`,`#bcbddc`,`#9e9ac8`,`#807dba`,`#6a51a3`,`#54278f`,`#3f007d`],Bz=[`#fff5f0`,`#fee0d2`,`#fcbba1`,`#fc9272`,`#fb6a4a`,`#ef3b2c`,`#cb181d`,`#a50f15`,`#67000d`],Vz=[`#ffffff`,`#f0f0f0`,`#d9d9d9`,`#bdbdbd`,`#969696`,`#737373`,`#525252`,`#252525`,`#000000`],Hz=[`#f7fcfd`,`#e5f5f9`,`#ccece6`,`#99d8c9`,`#66c2a4`,`#41ae76`,`#238b45`,`#006d2c`,`#00441b`],Uz=[`#f7fcfd`,`#e0ecf4`,`#bfd3e6`,`#9ebcda`,`#8c96c6`,`#8c6bb1`,`#88419d`,`#810f7c`,`#4d004b`],Wz=[`#f7fcf0`,`#e0f3db`,`#ccebc5`,`#a8ddb5`,`#7bccc4`,`#4eb3d3`,`#2b8cbe`,`#0868ac`,`#084081`],Gz=[`#fff7ec`,`#fee8c8`,`#fdd49e`,`#fdbb84`,`#fc8d59`,`#ef6548`,`#d7301f`,`#b30000`,`#7f0000`],Kz=[`#fff7fb`,`#ece7f2`,`#d0d1e6`,`#a6bddb`,`#74a9cf`,`#3690c0`,`#0570b0`,`#045a8d`,`#023858`],qz=[`#fff7fb`,`#ece2f0`,`#d0d1e6`,`#a6bddb`,`#67a9cf`,`#3690c0`,`#02818a`,`#016c59`,`#014636`],Jz=[`#f7f4f9`,`#e7e1ef`,`#d4b9da`,`#c994c7`,`#df65b0`,`#e7298a`,`#ce1256`,`#980043`,`#67001f`],Yz=[`#fff7f3`,`#fde0dd`,`#fcc5c0`,`#fa9fb5`,`#f768a1`,`#dd3497`,`#ae017e`,`#7a0177`,`#49006a`],Xz=[`#ffffe5`,`#f7fcb9`,`#d9f0a3`,`#addd8e`,`#78c679`,`#41ab5d`,`#238443`,`#006837`,`#004529`],Zz=[`#ffffd9`,`#edf8b1`,`#c7e9b4`,`#7fcdbb`,`#41b6c4`,`#1d91c0`,`#225ea8`,`#253494`,`#081d58`],Qz=[`#ffffe5`,`#fff7bc`,`#fee391`,`#fec44f`,`#fe9929`,`#ec7014`,`#cc4c02`,`#993404`,`#662506`],$z=[`#ffffcc`,`#ffeda0`,`#fed976`,`#feb24c`,`#fd8d3c`,`#fc4e2a`,`#e31a1c`,`#bd0026`,`#800026`],eB=[`#440154`,`#482878`,`#3e4989`,`#31688e`,`#26828e`,`#1f9e89`,`#35b779`,`#6ece58`,`#b5de2b`,`#fde725`],tB=[`#000004`,`#0a0822`,`#1d1147`,`#36106b`,`#51127c`,`#6a1c81`,`#832681`,`#9c2e7f`,`#b73779`,`#d0416f`,`#e75263`,`#f56b5c`,`#fc8961`,`#fea772`,`#fec488`,`#fde2a3`,`#fcfdbf`],nB=[`#000004`,`#0b0724`,`#210c4a`,`#3d0965`,`#57106e`,`#71196e`,`#8a226a`,`#a32c61`,`#bc3754`,`#d24644`,`#e45a31`,`#f1731d`,`#f98e09`,`#fcac11`,`#f9cb35`,`#f2ea69`,`#fcffa4`],rB=[`#0d0887`,`#310597`,`#4c02a1`,`#6600a7`,`#7e03a8`,`#9511a1`,`#aa2395`,`#bc3587`,`#cc4778`,`#da5a6a`,`#e66c5c`,`#f0804e`,`#f89540`,`#fdac33`,`#fdc527`,`#f8df25`,`#f0f921`],iB=[`#002051`,`#012b65`,`#11366c`,`#26426e`,`#3c4d6e`,`#51586e`,`#62646f`,`#727071`,`#7f7c75`,`#8c8877`,`#9a9478`,`#a9a177`,`#bbaf71`,`#cebd68`,`#e2cb5c`,`#f3da4f`,`#fdea45`],aB=[`#000000`,`#150b1d`,`#1b1d3b`,`#17374d`,`#16534c`,`#236a3e`,`#437731`,`#717b32`,`#a07949`,`#c47a74`,`#d483a7`,`#d197d3`,`#c7b3ed`,`#c1cff3`,`#cae7f0`,`#e2f6f0`,`#ffffff`],oB=[`#6e40aa`,`#873eb1`,`#a03db3`,`#ba3cb0`,`#d23ea7`,`#e8429b`,`#f9488a`,`#ff5177`,`#ff5e63`,`#ff6d51`,`#ff7f41`,`#fd9235`,`#efa72f`,`#dfbb2f`,`#cdcf37`,`#bde146`,`#aff05b`],sB=[`#6e40aa`,`#664cbe`,`#5c5ace`,`#4f6bda`,`#417de0`,`#3390e1`,`#27a3dc`,`#1eb6d1`,`#1ac7c2`,`#1ad7af`,`#21e39b`,`#2ded86`,`#40f373`,`#57f664`,`#73f65a`,`#91f457`,`#aff05b`],cB=[`#6e40aa`,`#a03db3`,`#d23ea7`,`#f9488a`,`#ff5e63`,`#ff7f41`,`#efa72f`,`#cdcf37`,`#aff05b`,`#73f65a`,`#40f373`,`#21e39b`,`#1ac7c2`,`#27a3dc`,`#417de0`,`#5c5ace`,`#6e40aa`],lB=[`#ff4040`,`#f56f1a`,`#daa004`,`#b0cd01`,`#7fee11`,`#4ffe32`,`#25fb5f`,`#0ae590`,`#00bfbf`,`#0a90e5`,`#255ffb`,`#4f32fe`,`#7f11ee`,`#b001cd`,`#da04a0`,`#f51a6f`,`#ff4040`];function uB(e){let t=Math.max(0,Math.min(1,e)),n=34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-t*14825.05)))),i=23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+t*707.56)))),a=27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-t*6838.66))));return`rgb(`+dB(n)+`, `+dB(i)+`, `+dB(a)+`)`}function dB(e){return Math.max(0,Math.min(255,Math.round(e)))}const fB=Array.from({length:33},(e,t)=>uB(t/32)),pB=[`#a50026`,`#d73027`,`#f46d43`,`#fdae61`,`#fee090`,`#ffffbf`,`#e0f3f8`,`#abd9e9`,`#74add1`,`#4575b4`,`#313695`],mB=[`#a50026`,`#d73027`,`#f46d43`,`#fdae61`,`#fee08b`,`#ffffbf`,`#d9ef8b`,`#a6d96a`,`#66bd63`,`#1a9850`,`#006837`],hB=[`#67001f`,`#b2182b`,`#d6604d`,`#f4a582`,`#fddbc7`,`#f7f7f7`,`#d1e5f0`,`#92c5de`,`#4393c3`,`#2166ac`,`#053061`],gB={observable10:Tz,category10:Ez,tableau10:Dz,accent:Oz,dark2:kz,paired:Az,pastel1:jz,pastel2:Mz,set1:Nz,set2:Pz,set3:Fz,blues:Iz,greens:Lz,oranges:Rz,purples:zz,reds:Bz,greys:Vz,bugn:Hz,bupu:Uz,gnbu:Wz,orrd:Gz,pubu:Kz,pubugn:qz,purd:Jz,rdpu:Yz,ylgn:Xz,ylgnbu:Zz,ylorbr:Qz,ylorrd:$z,viridis:eB,magma:tB,inferno:nB,plasma:rB,cividis:iB,cubehelix:aB,warm:oB,cool:sB,turbo:fB,rainbow:cB,sinebow:lB,brbg:[`#543005`,`#8c510a`,`#bf812d`,`#dfc27d`,`#f6e8c3`,`#f5f5f5`,`#c7eae5`,`#80cdc1`,`#35978f`,`#01665e`,`#003c30`],prgn:[`#40004b`,`#762a83`,`#9970ab`,`#c2a5cf`,`#e7d4e8`,`#f7f7f7`,`#d9f0d3`,`#a6dba0`,`#5aae61`,`#1b7837`,`#00441b`],piyg:[`#8e0152`,`#c51b7d`,`#de77ae`,`#f1b6da`,`#fde0ef`,`#f7f7f7`,`#e6f5d0`,`#b8e186`,`#7fbc41`,`#4d9221`,`#276419`],puor:[`#7f3b08`,`#b35806`,`#e08214`,`#fdb863`,`#fee0b6`,`#f7f7f7`,`#d8daeb`,`#b2abd2`,`#8073ac`,`#542788`,`#2d004b`],rdbu:hB,rdgy:[`#67001f`,`#b2182b`,`#d6604d`,`#f4a582`,`#fddbc7`,`#ffffff`,`#e0e0e0`,`#bababa`,`#878787`,`#4d4d4d`,`#1a1a1a`],rdylbu:pB,rdylgn:mB,spectral:[`#9e0142`,`#d53e4f`,`#f46d43`,`#fdae61`,`#fee08b`,`#ffffbf`,`#e6f598`,`#abdda4`,`#66c2a5`,`#3288bd`,`#5e4fa2`],burd:[...hB].reverse(),buylrd:[...pB].reverse()},_B=new Set([`blues`,`greens`,`oranges`,`purples`,`reds`,`greys`,`bugn`,`bupu`,`gnbu`,`orrd`,`pubu`,`pubugn`,`purd`,`rdpu`,`ylgn`,`ylgnbu`,`ylorbr`,`ylorrd`,`viridis`,`magma`,`inferno`,`plasma`,`cividis`,`cubehelix`,`warm`,`cool`,`turbo`,`rainbow`,`sinebow`,...new Set([`brbg`,`prgn`,`piyg`,`puor`,`rdbu`,`rdgy`,`rdylbu`,`rdylgn`,`spectral`,`burd`,`buylrd`])]);function vB(e,t=Tz){return gB[String(e).toLowerCase()]??t}const yB={spectral:{3:[`#fc8d59`,`#ffffbf`,`#99d594`],4:[`#d7191c`,`#fdae61`,`#abdda4`,`#2b83ba`],5:[`#d7191c`,`#fdae61`,`#ffffbf`,`#abdda4`,`#2b83ba`],6:[`#d53e4f`,`#fc8d59`,`#fee08b`,`#e6f598`,`#99d594`,`#3288bd`],7:[`#d53e4f`,`#fc8d59`,`#fee08b`,`#ffffbf`,`#e6f598`,`#99d594`,`#3288bd`],8:[`#d53e4f`,`#f46d43`,`#fdae61`,`#fee08b`,`#e6f598`,`#abdda4`,`#66c2a5`,`#3288bd`],9:[`#d53e4f`,`#f46d43`,`#fdae61`,`#fee08b`,`#ffffbf`,`#e6f598`,`#abdda4`,`#66c2a5`,`#3288bd`],10:[`#9e0142`,`#d53e4f`,`#f46d43`,`#fdae61`,`#fee08b`,`#e6f598`,`#abdda4`,`#66c2a5`,`#3288bd`,`#5e4fa2`],11:[`#9e0142`,`#d53e4f`,`#f46d43`,`#fdae61`,`#fee08b`,`#ffffbf`,`#e6f598`,`#abdda4`,`#66c2a5`,`#3288bd`,`#5e4fa2`]},rdylbu:{3:[`#fc8d59`,`#ffffbf`,`#91bfdb`],4:[`#d7191c`,`#fdae61`,`#abd9e9`,`#2c7bb6`],5:[`#d7191c`,`#fdae61`,`#ffffbf`,`#abd9e9`,`#2c7bb6`],6:[`#d73027`,`#fc8d59`,`#fee090`,`#e0f3f8`,`#91bfdb`,`#4575b4`],7:[`#d73027`,`#fc8d59`,`#fee090`,`#ffffbf`,`#e0f3f8`,`#91bfdb`,`#4575b4`],8:[`#d73027`,`#f46d43`,`#fdae61`,`#fee090`,`#e0f3f8`,`#abd9e9`,`#74add1`,`#4575b4`],9:[`#d73027`,`#f46d43`,`#fdae61`,`#fee090`,`#ffffbf`,`#e0f3f8`,`#abd9e9`,`#74add1`,`#4575b4`]}};function bB(e,t,n){let i=yB[String(e).toLowerCase()];if(i&&i[n])return i[n];if(n<=1)return[t[Math.floor(t.length/2)]];{let e=EB(t),i=[];for(let t=0;t<n;t++)i.push(e(t/(n-1)));return i}}const xB={aqua:`#00ffff`,aquamarine:`#7fffd4`,beige:`#f5f5dc`,black:`#000000`,blue:`#0000ff`,brown:`#a52a2a`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkred:`#8b0000`,fuchsia:`#ff00ff`,gold:`#ffd700`,gray:`#808080`,green:`#008000`,grey:`#808080`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lightblue:`#add8e6`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lime:`#00ff00`,magenta:`#ff00ff`,maroon:`#800000`,navy:`#000080`,olive:`#808000`,orange:`#ffa500`,orchid:`#da70d6`,pink:`#ffc0cb`,plum:`#dda0dd`,purple:`#800080`,red:`#ff0000`,salmon:`#fa8072`,sienna:`#a0522d`,silver:`#c0c0c0`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,yellow:`#ffff00`},SB=new Set([`currentcolor`,`transparent`,`none`]);function CB(e){if(typeof e!=`string`)return!1;{let t=e.trim().toLowerCase();return xB[t]!==void 0||SB.has(t)||/^#[0-9a-f]{3,8}$/.test(t)||/^(rgb|hsl|hwb|lab|lch|oklab|oklch|color)a?\(/.test(t)||t.startsWith(`var(`)||t.startsWith(`url(`)}}function wB(e){let t=xB[String(e).trim().toLowerCase()]??String(e).trim();if(/^#[0-9a-fA-F]{3}$/.test(t))return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];if(/^#[0-9a-fA-F]{6}$/.test(t))return[parseInt(t.slice(1,3),16),parseInt(t.slice(3,5),16),parseInt(t.slice(5,7),16)];{let e=t.match(/[\d.]+/g);return e&&e.length>=3?e.slice(0,3).map(Number):[0,0,0]}}function TB(e,t,n){let i=wB(e),a=wB(t);return`rgb(`+i.map((e,t)=>Math.round(e+(a[t]-e)*n)).join(`, `)+`)`}function EB(e){return function(t){let n=Math.max(0,Math.min(1,t))*(e.length-1),i=Math.floor(n),a=Math.min(e.length-1,i+1);return TB(e[i],e[a],n-i)}}function DB(e,t){return typeof e==`function`?e.length>=2?e(t[0],t[t.length-1]):e:EB(t)}function OB(e={}){let t=e.domain??[0,1],n=e.range??vB(e.scheme??`blues`),i=DB(e.interpolate,n),[a,o]=t.map(Number),s=o-a,c=e.position;function l(e){return i(c?c(e):s===0?.5:(Number(e)-a)/s)}return l.type=c?c.type:`sequential`,l.base=c?c.base:void 0,l.domain=t,l.range=n,l.position=c,l.ticks=c?c.ticks:((e=5)=>qR(a,o,e)),l}function kB(e={}){let t=e.range??[],n=(e.values??[]).filter(Number.isFinite).sort(oz),i=[];for(let e=1;e<t.length;e++)i.push(pz(n,e/t.length));function a(n){if(Number.isFinite(Number(n))){let e=0;for(;e<i.length&&Number(n)>=i[e];)e+=1;return t[e]}return e.unknown}return a.type=`quantile`,a.domain=i,a.range=t,a.thresholds=i,a.ticks=()=>i,a}const AB=e=>e,jB=[`x`,`y`,`x1`,`x2`,`y1`,`y2`,`frameAnchor`];function MB(e){return jB.some(t=>e[t]!==void 0)||e.transform!==void 0?e:{...e,x:e=>e[0],y:e=>e[1]}}function NB(e){return typeof e!=`object`||!e}function PB(e,t){return NB(e)?e:e[t]===void 0&&e.type===`Feature`?e.properties?.[t]:e[t]}const FB=new Set([`FeatureCollection`,`GeometryCollection`,`Feature`,`Sphere`,`Point`,`MultiPoint`,`LineString`,`MultiLineString`,`Polygon`,`MultiPolygon`]);function IB(e){return e==null?[]:Array.isArray(e)?e:FB.has(e.type)?e.type===`FeatureCollection`?e.features:e.type===`GeometryCollection`?e.geometries:[e]:Array.from(e)}function LB(e){return typeof e==`function`?e:Array.isArray(e)?(t,n)=>e[n]:typeof e==`string`?t=>PB(t,e):typeof e==`object`&&e&&`value`in e?LB(e.value):()=>e}function RB(e,t){let n=e??[];return typeof t==`function`?n.map(t):Array.isArray(t)?t:typeof t==`string`?n.map(e=>PB(e,t)):typeof t==`object`&&t&&`value`in t?RB(n,t.value):n.map(()=>t)}function zB(e){if(typeof e==`string`)return e;if(typeof e==`object`&&e&&typeof e.label==`string`)return e.label}function BB(e,t,n=`color`){return e==null?{constant:t}:typeof e==`string`&&CB(e)?{constant:e}:{value:e,scale:n}}function VB(e,t,n){return e==null?{constant:t}:typeof e==`number`?{constant:e}:{value:e,scale:n}}const HB=new Set([`second`,`minute`,`hour`,`day`,`week`,`month`,`year`]);function UB(e){let[,t,n]=/^\s*(?:(\d+)\s+)?(\w+?)s?\s*$/.exec(String(e))??[];return{unit:n,every:t===void 0?1:Number(t)}}function WB(e){let t=e>=1||Number.isInteger(1/e)===!1,n=t?e:1/e,i=e=>t?Math.floor(e/n)*n:Math.floor(e*n)/n,a=(e,i=1)=>t?e+n*i:(e*n+i)/n;return{floor:i,offset:a,range(e,t){let n=[];for(let o=i(e);o<t;o=a(o))n.push(o);return n}}}function GB(e,t){return{floor:n=>ZR(new Date(n),e,t),offset:(n,i=1)=>QR(new Date(n),e,t*i),range(n,i){let a=[],o=ZR(new Date(n),e,t);for(;o.getTime()<Number(i)&&a.length<1e4;)a.push(new Date(o)),o=QR(o,e,t);return a}}}function KB(e){if(typeof e==`number`)return WB(e);if(typeof e==`object`&&e)return e;{let{unit:t,every:n}=UB(e);if(HB.has(t))return GB(t,n);throw Error(`unknown interval: `+e)}}function qB(e){let t=oR(Math.sqrt(e/Math.PI));return`M ${t},0 A ${t},${t} 0 1,1 -${t},0 A ${t},${t} 0 1,1 ${t},0 Z`}function JB(e){let t=Math.sqrt(e)/2;return`M ${Q(-t,-t)} L ${Q(t,-t)} L ${Q(t,t)} L ${Q(-t,t)} Z`}function YB(e){let t=Math.sqrt(e*4/Math.sqrt(3)),n=t*Math.sqrt(3)/4;return`M ${Q(0,-t/2)} L ${Q(n,t/2)} L ${Q(-n,t/2)} Z`}function XB(e){let t=Math.sqrt(e/2);return`M ${Q(0,-t)} L ${Q(t,0)} L ${Q(0,t)} L ${Q(-t,0)} Z`}function ZB(e){let t=Math.sqrt(e/5),n=t*3/2;return`M ${Q(-t,-n)} L ${Q(t,-n)} L ${Q(t,-t)} L ${Q(n,-t)} L ${Q(n,t)} L ${Q(t,t)} L ${Q(t,n)} L ${Q(-t,n)} L ${Q(-t,t)} L ${Q(-n,t)} L ${Q(-n,-t)} L ${Q(-t,-t)} Z`}function QB(e){let t=Math.sqrt(e/Math.PI)*1.5,n=t*.4,i=[];for(let e=0;e<10;e++){let a=e%2==0?t:n,o=e*Math.PI/5-Math.PI/2;i.push(Q(Math.cos(o)*a,Math.sin(o)*a))}return`M ${i.join(` L `)} Z`}function $B(e){let t=Math.sqrt(e/3);return`M ${Q(0,-(t*2))} L ${Q(t,-t)} L ${Q(t,0)} L ${Q(0,t)} L ${Q(-t,0)} L ${Q(-t,-t)} Z`}function eV(e){let t=Math.sqrt(e-Math.min(e/7,2))*.87559;return`M ${Q(-t,0)} L ${Q(t,0)} M ${Q(0,t)} L ${Q(0,-t)}`}function tV(e){let t=Math.sqrt(e-Math.min(e/6,1.7))*.6189;return`M ${Q(-t,-t)} L ${Q(t,t)} M ${Q(-t,t)} L ${Q(t,-t)}`}function nV(e){let t=Math.sqrt(e+Math.min(e/28,.75))*.59436,n=t/2,i=n*Math.sqrt(3);return`M ${Q(0,t)} L ${Q(0,-t)} M ${Q(-i,-n)} L ${Q(i,n)} M ${Q(-i,n)} L ${Q(i,-n)}`}function rV(e){let t=Math.sqrt(e)*.4431;return`M ${Q(t,t)} L ${Q(t,-t)} L ${Q(-t,-t)} L ${Q(-t,t)} Z`}function iV(e){let t=Math.sqrt(e)*.6824,n=t/2,i=t*Math.sqrt(3)/2;return`M ${Q(0,-t)} L ${Q(i,n)} L ${Q(-i,n)} Z`}function aV(e){let t=Math.sqrt(e)*.62625;return`M ${Q(0,-t)} L ${Q(t,0)} L ${Q(0,t)} L ${Q(-t,0)} Z`}function oV(e){let t=Math.sqrt(e/Math.PI),n=t*2/Math.sqrt(3),i=n/2;return`M ${Q(0,n)} L ${Q(t,i)} L ${Q(t,-i)} L ${Q(0,-n)} L ${Q(-t,-i)} L ${Q(-t,i)} Z`}const sV={circle:qB,square:JB,triangle:YB,diamond:XB,cross:ZB,star:QB,wye:$B,hexagon:oV,plus:eV,times:tV,asterisk:nV,square2:rV,triangle2:iV,diamond2:aV},cV=Object.keys(sV),lV=[`circle`,`cross`,`diamond`,`square`,`star`,`triangle`,`wye`],uV=[`circle`,`plus`,`times`,`triangle2`,`asterisk`,`square2`,`diamond2`];function dV(e=`circle`,t=64){return(sV[e]??qB)(t)}const $={fill:`currentColor`,stroke:`currentColor`,background:`var(--plot-background, white)`,fontFamily:`system-ui, sans-serif`,fontSize:10,categoricalScheme:`observable10`,categorical:Tz,sequentialScheme:`turbo`,divergingScheme:`rdbu`,axisStroke:`currentColor`,axisStrokeOpacity:1,axisTextOpacity:.8,tickSize:6,tickPadding:3,tickCount:10,tickSpacingX:80,tickSpacingY:35,gridStroke:`currentColor`,gridStrokeOpacity:.1,frameStroke:`currentColor`,frameStrokeOpacity:1,labelPadding:10,dotRadius:3,boxFill:`light-dark(#ccc, #555)`,boxWidth:.6,medianStrokeWidth:2,vectorLength:12,vectorRadius:3.5,strokeWidth:1.5,barPadding:.1,bandHeight:20,facetPadding:.2,facetGap:20,legendSwatchSize:15},fV=new Set([`band`,`point`,`ordinal`,`categorical`]);function pV(e){let t=[];for(let n of e)for(let e of n.values)az(e)&&t.push(e);return t}function mV(e,t,n){let i=e.length>0?pV(e):IB(t.domain??[]),a=e.find(e=>e.type);return t.type?t.type===`utc`?`time`:t.type:t.domain!==void 0&&IB(t.domain).length>2&&n===`ordinal`?n:i.length===0?a?a.type:`linear`:i.every(e=>e instanceof Date)?`time`:i.every(e=>typeof e==`number`)?a&&fV.has(a.type)?a.type:`linear`:a&&fV.has(a.type)?a.type:n}function hV(e,t,n){let i=pV(t),a=t.find(e=>e.domain!==void 0);if(n.domain)return IB(n.domain);if(a)return IB(a.domain);if(fV.has(e)){let e;if(n.interval!==void 0){let t=KB(n.interval),[a,o]=sz(i);e=t.range(a,t.offset(o))}else e=_z(i),n.sort!==!1&&e.sort(oz);return t.some(e=>e.values.some(e=>az(e)===!1))&&(e=[...e,null]),n.reverse===!0&&e.reverse(),e}{let[a,o]=sz(i);if(a===void 0)return[0,1];{let i=n.zero===!0||t.some(e=>e.zero===!0),s=i&&e!==`time`?Math.min(0,a):a,c=i&&e!==`time`?Math.max(0,o):o;return s===c&&(s=e===`time`?new Date(Number(s)-1):Number(s)-1,c=e===`time`?new Date(Number(c)+1):Number(c)+1),n.reverse===!0?[c,s]:[s,c]}}}function gV(e,t,n,i,a){return e===`band`?Sz({domain:t,range:i??n,padding:a.padding??$.barPadding,paddingInner:a.paddingInner,paddingOuter:a.paddingOuter,align:a.align}):e===`point`?Cz({domain:t,range:i??n,padding:a.padding??.5,align:a.align}):e===`time`?iz({domain:t,range:n}):e===`log`?tz({domain:t,range:n,base:a.base}):e===`symlog`?nz({domain:t,range:n,constant:a.constant}):e===`sqrt`||e===`pow`?rz({domain:t,range:n,exponent:a.exponent}):ez({domain:t,range:n,clamp:a.clamp})}function _V(e,t){let n=t.pivot??0,i=Math.min(Number(e[0]),n),a=Math.max(Number(e[1]),n);if(t.symmetric===!1)return[i,a];{let e=Math.max(n-i,a-n);return[n-e,n+e]}}function vV(e,t,n,i){let a=e===`diverging`,o=fV.has(e)?$.categoricalScheme:a?$.divergingScheme:$.sequentialScheme,s=n.scheme??o,c=n.range??vB(s,$.categorical),l=_B.has(String(s).toLowerCase());if(e===`quantile`){let e=n.n??n.range?.length??5;return kB({values:i,range:n.range??bB(s,c,e),unknown:n.unknown??$.fill})}if(a)return OB({domain:_V(t,n),range:c,interpolate:n.interpolate});if(fV.has(e))return wz({domain:t,range:n.range===void 0&&l?bB(s,c,t.length):c,unknown:n.unknown??$.fill});if(n.range===void 0||l||n.type===`sequential`){let i=e!==`linear`&&e!==`sequential`?gV(e,t,[0,1],void 0,n):void 0;return OB({domain:t,range:c,interpolate:n.interpolate,position:i})}return wz({domain:t,range:c,unknown:n.unknown??$.fill})}function yV(e,t,n){let i=e.find(e=>e.radius!==void 0);if(i)return[0,i.radius];{let i=mz(e.map(e=>pz(e.values.filter(bV),.25)));if(i>0){let e=t.map(e=>3*Math.sqrt(e/i)),n=30/lz(e.map(Math.abs));return n<1?e.map(e=>e*n):e}return n}}function bV(e){return e>0}function xV(e,t){let n=mz(e.map(e=>mz(e.values.filter(az).map(Math.abs)))),i=t.map(e=>12*e/n),a=60/lz(i.map(Math.abs));return a<1?i.map(e=>e*a):i}function SV(e){let{name:t,channels:n,config:i={},range:a,ordinalRange:o}=e,s=t===`color`||t===`symbol`?`ordinal`:t===`fx`||t===`fy`?`band`:`point`,c=t===`fx`||t===`fy`,l=c?i.type??`band`:mV(n,i,s),u=hV(l,n,c?{...i,facet:!0}:i),d=n.some(e=>e.nice===!1);if((t===`x`||t===`y`)&&!fV.has(l)&&l!==`time`&&l!==`log`&&l!==`identity`&&!d&&i.nice!==!1&&i.domain===void 0){let e=typeof i.ticks==`number`?i.ticks:$.tickCount;u=JR(u,e)}let f;if(l===`identity`)f=e=>e,f.type=`identity`,f.domain=u,f.range=u,f.ticks=()=>[];else if(t===`color`)f=vV(l,u,i,pV(n));else if(t===`opacity`)f=ez({domain:u,range:i.range??[0,1],clamp:!0});else if(t===`symbol`){let e=n.some(e=>e.hint===`fill`),t=i.range??(e?lV:uV);f=wz({domain:u,range:t,unknown:t[0]})}else if(t===`length`)f=ez({domain:u,range:i.range??xV(n,u)});else if(t===`r`){let e=i.domain===void 0?[Math.min(0,u[0]),Math.max(0,u[1])]:u;f=rz({domain:e,range:i.range??yV(n,e,a)})}else f=gV(l,u,a,o,i);f.key=t;let p=n.map(e=>e.label).find(Boolean),m=i.percent===!0&&!fV.has(l)&&p!==void 0;return f.label=i.label===void 0?m?p+` (%)`:p:i.label,f.config=i,f}function CV(e){return fV.has(e.type)}function wV(e,t){let n=e.label===void 0?t.label:e.label;if(!(e.label===void 0&&t.type===`time`&&/^(date|time|year)$/i.test(String(n))))return n}function TV(e,t={},n){return Array.isArray(t.ticks)?t.ticks:typeof t.ticks==`number`?e.ticks(t.ticks):e.ticks(n??$.tickCount)}function EV(e,t){let n=e(t);return e.bandwidth?n+e.bandwidth()/2:n}function DV(e,t,n={}){let i=e===`color`?`ordinal`:e===`fx`||e===`fy`?`band`:`point`,a=e===`fx`||e===`fy`,o=a?n.type??`band`:mV(t,n,i);if(fV.has(o))return hV(o,t,a?{...n,facet:!0}:n).length}let OV=0;const kV=`:where(.plot-swatches) {
|
|
440
446
|
font-family: ${$.fontFamily};
|
|
441
447
|
font-size: ${$.fontSize}px;
|
|
442
448
|
margin-bottom: 0.5em;
|
|
@@ -453,16 +459,16 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
453
459
|
:where(.plot-swatch > svg) {
|
|
454
460
|
margin-right: 0.5em;
|
|
455
461
|
overflow: visible;
|
|
456
|
-
}`;function bB(e){let t=xL({class:`plot-swatches plot-swatches-wrap`});for(let n of e.domain){let i=SL({class:`plot-swatch`}),a=lL({width:$.legendSwatchSize,height:$.legendSwatchSize,fill:e(n)});a.appendChild(dL({width:`100%`,height:`100%`})),i.appendChild(a),i.appendChild(SL({textContent:String(n)})),t.appendChild(i)}return t.appendChild(CL(yB)),t}function xB(e,t){let n=xL({class:`plot-swatches plot-swatches-wrap`});for(let i of e.domain){let a=SL({class:`plot-swatch`}),o=lL({viewBox:`-8 -8 16 16`,width:$.legendSwatchSize,height:$.legendSwatchSize,fill:`none`,stroke:t?t(i):$.stroke,strokeWidth:$.strokeWidth});o.appendChild(hL({d:tB(e(i),64)})),a.appendChild(o),a.appendChild(SL({textContent:String(i)})),n.appendChild(a)}return n.appendChild(CL(yB)),n}function SB(e,t){let n=t.width??240,i=e.label?18:4,[a,o]=e.domain,s=xL({class:`plot-swatches`}),c=lL({width:n,height:i+10+6+$.fontSize+6,style:{overflow:`visible`}});e.label&&c.appendChild(pL({x:0,y:i-6,textContent:e.label,fontSize:$.fontSize,fontWeight:`bold`,fill:$.axisStroke}));let l=e.key===`opacity`?n=>({stopColor:t.color??$.fill,stopOpacity:e(n)}):t=>({stopColor:e(t)}),u=Number(o)-Number(a),d=e.position??WL({domain:[Number(a),Number(o)],range:[0,1]}),f=`plot-ramp-`+ ++vB,p=sL(`linearGradient`,{id:f,x1:`0%`,x2:`100%`,y1:`0%`,y2:`0%`});for(let e=0;e<=64;e++){let t=e/64;p.appendChild(sL(`stop`,{offset:`${t*100}%`,...l(d.invert(t))}))}let m=_L();m.appendChild(p),c.appendChild(m),c.appendChild(dL({x:0,y:i,width:n,height:10,fill:`url(#`+f+`)`}));let h=Math.max(2,n/64),g=hB(e,t,h),_=KI(t.tickFormat,e,g,h);for(let e of g){let t=u===0?0:n*d(e);t>=0&&t<=n&&(c.appendChild(fL({x1:t,y1:i,x2:t,y2:i+10+6,stroke:$.axisStroke})),c.appendChild(pL({x:t,y:i+10+6+2,textContent:_(e),textAnchor:`middle`,dominantBaseline:`hanging`,fontSize:$.fontSize,fill:$.axisStroke})))}return s.appendChild(c),s.appendChild(CL(yB)),s}function CB(e,t){let n=t.width??240,i=$.legendSwatchSize,a=xL({class:`plot-swatches`}),o=lL({width:n,height:i+$.fontSize+8}),s=e.range,c=n/s.length;for(let e=0;e<s.length;e++)o.appendChild(dL({x:c*e,y:0,width:c+.5,height:i,fill:s[e]}));let l=KI(t.tickFormat,e,e.thresholds);for(let t=0;t<e.thresholds.length;t++){let n=c*(t+1);o.appendChild(fL({x1:n,y1:i,x2:n,y2:i+3,stroke:$.axisStroke})),o.appendChild(pL({x:n,y:i+5,textContent:l(e.thresholds[t]),textAnchor:`middle`,dominantBaseline:`hanging`,fontSize:$.fontSize,fill:$.axisStroke}))}return a.appendChild(o),a.appendChild(CL(yB)),a}function wB(e,t={},n){return e.key===`symbol`?xB(e,n):e.type===`ordinal`?bB(e):e.type===`quantile`?CB(e,t):SB(e,t)}function TB(e){let{$svg:t,legends:n=[],title:i,subtitle:a,caption:o}=e;if(t.setAttribute(`class`,`plot`),n.length>0||i||a||o){let e=yL({class:`plot-figure`,style:{margin:`0`,maxWidth:`initial`}});i&&e.appendChild(cL(`h2`,{textContent:i})),a&&e.appendChild(cL(`h3`,{textContent:a}));for(let t of n)e.appendChild(wB(t.scale,t.config,t.colorScale));return e.appendChild(t),o&&e.appendChild(bL({textContent:o})),e}return t}function EB({k:e=1,tx:t=0,ty:n=0}={}){return{k:e,tx:t,ty:n,applyX:n=>n*e+t,applyY:t=>t*e+n,invertX:n=>(n-t)/e,invertY:t=>(t-n)/e}}function DB(e,t,n){return Math.max(t,Math.min(n,e))}function OB(e,t,n,i,a){let o=DB(e.k*t,a[0],a[1]);return EB({k:o,tx:n-(n-e.tx)*o/e.k,ty:i-(i-e.ty)*o/e.k})}function kB(e,t,n){return EB({k:e.k,tx:e.tx+t,ty:e.ty+n})}function AB(e,t,n){return EB({k:e.k,tx:DB(e.tx,t*(1-e.k),0),ty:DB(e.ty,n*(1-e.k),0)})}function jB(e,t){let n=e.scales[t],i=e.configs[t].zoom!==!1;if(n&&n.invert&&pB(n)===!1&&i)return n}function MB(e,t,n,i){let a=e.$svg,o={originX:e.layout.marginLeft,originY:e.layout.marginTop},s=EB(),c=!1,l;function u(t){let[n,i]=AL(t,a,o);return{x:n,y:i,inside:n>=0&&n<=e.layout.plotWidth&&i>=0&&i<=e.layout.plotHeight}}function d(){c===!1&&(c=!0,a.ownerDocument.defaultView.requestAnimationFrame(()=>{c=!1;let n={};t.x&&(n.x=t.x.range.map(e=>t.x.invert(s.invertX(e)))),t.y&&(n.y=t.y.range.map(e=>t.y.invert(s.invertY(e)))),e.redraw(n)}))}function f(t){s=AB(t,e.cellWidth,e.cellHeight),d()}a.addEventListener(`wheel`,e=>{let t=u(e);if(t.inside){e.preventDefault();let i=e.ctrlKey?.01:.002;f(OB(s,2**(-e.deltaY*i),t.x,t.y,n))}},{passive:!1}),a.addEventListener(`pointerdown`,e=>{let t=u(e);i&&t.inside&&(l=t,a.setPointerCapture&&a.setPointerCapture(e.pointerId))}),a.addEventListener(`pointermove`,e=>{if(l){let t=u(e);f(kB(s,t.x-l.x,t.y-l.y)),l=t}}),a.addEventListener(`pointerup`,()=>{l=void 0}),a.addEventListener(`dblclick`,()=>{s=EB(),d()})}function NB(e,t={}){let n={x:jB(e,`x`),y:jB(e,`y`)};(n.x||n.y)&&MB(e,n,t.scaleExtent??[1,64],t.pan!==!1)}const PB=new Set([`x`,`x1`,`x2`,`y`,`y1`,`y2`,`r`,`length`,`rotate`,`strokeWidth`,`fillOpacity`,`strokeOpacity`,`opacity`]),FB=new Set([`fill`,`stroke`]);function IB(e){if(e.interp.source!==e.values){e.interp={source:e.values};for(let t of Object.keys(e.values)){let n=Array(e.interpLength);for(let i=0;i<e.length;i++)n[i]=e.values[t][i];e.interp[t]=n}e.values.opacity===void 0&&(e.interp.opacity=Array(e.interpLength).fill(1))}}function LB(e,t){let n=0;for(;n+1<e.length&&e[n+1]<=t;)n++;let i=e[n],a=e[Math.min(n+1,e.length-1)];return{from:i,to:a,fraction:a>i?Math.max(0,Math.min(1,(t-i)/(a-i))):0}}function RB(e,t,n,i,a,o){for(let o of Object.keys(e.values)){let s=e.values[o],c=s[n],l=s[i],u;u=PB.has(o)?c+(l-c)*a:FB.has(o)&&c!==l?hz(c,l,a):c,e.interp[o][t]=u}let s=e.values.opacity?e.values.opacity[n]:1;e.interp.opacity[t]=s*o}function zB(e,t,n=`eq`){IB(e);let{from:i,to:a,fraction:o}=LB(e.keyframeDomain,t),s=e.rowsAt.get(i),c=e.rowsAt.get(a),l=new Map(c.map(t=>[e.keys[t],t])),u=new Set(s.map(t=>e.keys[t])),d=[],f=e.length;for(let t of s){let n=l.get(e.keys[t]);n===void 0?RB(e,f,t,t,0,1-o):RB(e,f,t,n,o,1),d.push(f),f++}for(let t of c)u.has(e.keys[t])===!1&&(RB(e,f,t,t,0,o),d.push(f),f++);if(n===`lte`){let t=[];for(let n=0;n<e.length;n++)e.times[n]<i&&t.push(n);return[...t,...d]}return d}function BB(e){let t={};for(let n of Object.keys(e.channels??{})){let i=e.channels[n];i!=null&&(i.constant!==void 0||i.value!==void 0&&i.value!==null)&&(t[n]=i)}t.z===void 0&&e.options?.z!==void 0&&e.options.z!==null&&(t.z={value:e.options.z});for(let n of Object.keys(e.options?.channels??{})){let i=e.options.channels[n];t[n]=typeof i==`object`&&i?i:{value:i}}return{type:e.type??`mark`,data:e.data??[],channels:t,render:e.render,options:e.options??{},transform:e.transform??e.options?.transform,facet:e.facet!==!1,layer:e.layer??0}}function VB(e){return e==null||e===`none`}function HB(e){return VB(e)===!1}function UB(e,t={}){let n=t.fill,i=t.stroke;return VB(n)?HB(i)&&HB(e.fill)&&(i=`none`):VB(i)&&HB(e.stroke)&&(n=`none`),{fill:Az(e.fill,n),stroke:Az(e.stroke,i),strokeWidth:jz(e.strokeWidth,t.strokeWidth),strokeDasharray:e.strokeDasharray?{constant:e.strokeDasharray}:void 0,fillOpacity:jz(e.fillOpacity,t.fillOpacity),strokeOpacity:jz(e.strokeOpacity,t.strokeOpacity),opacity:jz(e.opacity,t.opacity,`opacity`),mixBlendMode:e.mixBlendMode?{constant:e.mixBlendMode}:void 0,time:e.time===void 0?void 0:{value:e.time},key:e.key===void 0?void 0:{value:e.key},px:e.px===void 0?void 0:{value:e.px,scale:`x`},py:e.py===void 0?void 0:{value:e.py,scale:`y`},fx:e.fx?{value:e.fx,scale:`fx`,type:`band`}:void 0,fy:e.fy?{value:e.fy,scale:`fy`,type:`band`}:void 0}}const WB=[`fill`,`stroke`,`strokeWidth`,`strokeDasharray`,`fillOpacity`,`strokeOpacity`,`opacity`];function GB(e,t){let n={};for(let i of WB)e[i]!==void 0&&(n[i]=e[i][t]);return e.mixBlendMode!==void 0&&(n.style={mixBlendMode:e.mixBlendMode[t]}),n}function KB(e=`middle`,t){return{x:/left$/.test(e)?0:/right$/.test(e)?t.width:t.width/2,y:/^top/.test(e)?0:/^bottom/.test(e)?t.height:t.height/2}}function qB(e){return e&&e.bandwidth?e.bandwidth()/2:0}function JB(e,t){let n=[],i=[];for(let a of e)t(a)?i.push(a):i.length>0&&(n.push(i),i=[]);return i.length>0&&n.push(i),n}function YB(e,t){let n=(e,n)=>WB.every(i=>t[i]===void 0||t[i][e]===t[i][n]),i=[],a=[];for(let t of e)a.length===0||n(a[0],t)?a.push(t):(a.push(t),i.push(a),a=[t]);return a.length>0&&i.push(a),i}function XB(e,t){if(t===void 0)return[e];{let n=new Map;for(let i of e){let e=t[i];n.has(e)?n.get(e).push(i):n.set(e,[i])}return[...n.values()]}}function ZB(e,t,n){let i=e?e.domain:[void 0],a=t?t.domain:[void 0],o=[];for(let s=0;s<a.length;s++)for(let c=0;c<i.length;c++)o.push({fx:i[c],fy:a[s],x:e?e(i[c]):0,y:t?t(a[s]):0,width:e?e.bandwidth():n.width,height:t?t.bandwidth():n.height,column:c,row:s,isLeft:c===0,isRight:c===i.length-1,isTop:s===0,isBottom:s===a.length-1,isFirst:s===0&&c===0});return o}function QB(e){return e===void 0?null:e}function $B(e,t,n,i){let a=[];for(let o=0;o<e;o++){let e=n===void 0||oR(QB(n[o]))===oR(t.fx),s=i===void 0||oR(QB(i[o]))===oR(t.fy);e&&s&&a.push(o)}return a}function eV(e,t,n,i){let a=typeof i==`number`?i:t/n;return Math.max(1,Math.round(e/Math.max(1,a)))}function tV(e){return e.map(t=>({...t,isLeft:e.every(e=>e.row!==t.row||e.column>=t.column),isRight:e.every(e=>e.row!==t.row||e.column<=t.column),isTop:e.every(e=>e.column!==t.column||e.row>=t.row),isBottom:e.every(e=>e.column!==t.column||e.row<=t.row),isFirst:e[0]!==void 0&&e[0].row===t.row&&e[0].column===t.column}))}function nV(e,t){let n=t.dx??0,i=t.dy??0;if(n===0&&i===0)return e;{let t=uL({transform:`translate(${XI(n)}, ${XI(i)})`});return t.appendChild(e),t}}function rV(e,t){let n=nV(t,e.mark.options);return e.clipped&&n.setAttribute(`clip-path`,`url(#`+e.chart.clipId+`)`),n}function iV(e){let{states:t,ordered:n,scales:i,layout:a,projection:o}=e;e.pointerTargets.length=0;for(let e of n)e.nodes=[];let s=e=>t.some(t=>t.mark.facet&&$B(t.length,e,t.raw.fx,t.raw.fy).length>0),c=ZB(i.fx,i.fy,{width:a.plotWidth,height:a.plotHeight}),l=i.fx!==void 0||i.fy!==void 0?tV(c.filter(s)):c;for(let t of l){let s=uL({transform:`translate(${XI(t.x)}, ${XI(t.y)})`});e.$plot.appendChild(s);let c={width:t.width,height:t.height,plotWidth:a.plotWidth,plotHeight:a.plotHeight,marginTop:a.marginTop,marginRight:a.marginRight,marginBottom:a.marginBottom,marginLeft:a.marginLeft,tickCountX:e.tickCountX,tickCountY:e.tickCountY,cell:t,projection:o};for(let o of n){let n=o.mark.facet?$B(o.length,t,o.raw.fx,o.raw.fy):o.data.map((e,t)=>t),l=o.shown?n.filter(e=>o.shown[e]):n;o.mark.options.initialize&&o.mark.options.initialize(l,i,o.values,c);let u=o.mark.options.interaction;if(u){let n=uL();s.appendChild(n),e.pointerTargets.push({state:o,interaction:u,index:l,dimensions:c,originX:a.marginLeft+t.x,originY:a.marginTop+t.y,offsetX:qB(i.x),offsetY:qB(i.y),draw(e){let t=e===void 0?void 0:o.mark.render([e],i,o.values,c,o);n.replaceChildren(),t&&n.appendChild(nV(t,o.mark.options))}})}else{let e=o.mark.render(l,i,o.values,c,o);if(e){let t=rV(o,e);s.appendChild(t),o.nodes.push({$node:t,$cell:s,index:l,dimensions:c})}}}}}function aV(e,t,n){for(let i of t.states){let t=zB(i,n,i.mark.options.timeFilter??`eq`);for(let n of i.nodes){let a=i.mark.render(t,e.scales,i.interp,n.dimensions,i);if(a){let e=rV(i,a);n.$node.replaceWith(e),n.$node=e}}}}function oV(e,t){let n=e.$root,i=n.ownerDocument.defaultView,[a,o]=t.domain,s=o-a,c=t.initial,l=t.playbackRate,u=t.loop,d=t.autoplay===!1,f=!1,p;function m(){n.dispatchEvent(new i.Event(`timeupdate`,{bubbles:!0}))}function h(n){c=n,aV(e,t,c),m()}function g(e){let n=c+e/t.duration*s*l;n>=a&&n<=o?h(n):u?h(l<0?o:a):(d=!0,f=!0,h(l<0?a:o))}let _=!1,v=0;function y(e){let t=n.isConnected;_||=t,t?(d===!1&&s>0&&p!==void 0&&g(e-p),p=e,i.requestAnimationFrame(y)):_===!1&&v<600&&(v++,i.requestAnimationFrame(y))}i.requestAnimationFrame(y),n.play=()=>(d=!1,f=!1,Promise.resolve()),n.pause=()=>{d=!0},Object.defineProperty(n,"paused",{get:()=>d}),Object.defineProperty(n,"ended",{get:()=>f}),Object.defineProperty(n,"duration",{get:()=>t.duration/1e3}),Object.defineProperty(n,"currentTime",{get:()=>t.holdsDates?new Date(c):c,set:e=>{f=!1,h(Math.max(a,Math.min(o,Number(e))))}}),Object.defineProperty(n,"playbackRate",{get:()=>l,set:e=>{l=Number(e)}}),Object.defineProperty(n,"loop",{get:()=>u,set:e=>{u=e===!0}})}const sV=Math.PI/2;function cV(e,t){return[e,t]}function lV(e,t){return[e,Math.log(Math.tan((sV+t)/2))]}function uV(e,t){return[Math.cos(t)*Math.sin(e),Math.sin(t)]}function dV(e,t){let n=Math.cos(t),i=1+n*Math.cos(e);return[n*Math.sin(e)/i,Math.sin(t)/i]}function fV(e,t){let n=Math.cos(t),i=Math.cos(e)*n;return[n*Math.sin(e)/i,Math.sin(t)/i]}function pV(e,t){return hV(e,t,e=>(e=Math.acos(e))&&e/Math.sin(e))}function mV(e,t){return hV(e,t,e=>Math.sqrt(2/(1+e)))}function hV(e,t,n){let i=Math.cos(e),a=Math.cos(t),o=n(i*a);return Number.isFinite(o)?[o*a*Math.sin(e),o*Math.sin(t)]:[0,0]}const gV=1.340264,_V=-.081106,vV=893e-6,yV=.003796,bV=Math.sqrt(3)/2;function xV(e,t){let n=Math.asin(bV*Math.sin(t)),i=n*n,a=i*i*i;return[e*Math.cos(n)/(bV*(gV+3*_V*i+a*(7*vV+9*yV*i))),n*(gV+_V*i+a*(vV+yV*i))]}function SV(e){let[t,n]=e.map(e=>e*Math.PI/180),i=Math.sin(t),a=(i+Math.sin(n))/2;if(Math.abs(a)<1e-6)return CV(t);{let e=1+i*(2*a-i),t=Math.sqrt(e)/a;return(n,i)=>{let o=Math.sqrt(e-2*a*Math.sin(i))/a,s=n*a;return[o*Math.sin(s),t-o*Math.cos(s)]}}}function CV(e){let t=Math.cos(e);return(e,n)=>[e*t,Math.sin(n)/t]}const wV=Math.PI/180;function TV(e){let[t=0,n=0,i=0]=e??[],a=t*wV,o=n*wV,s=i*wV,c=Math.cos(o),l=Math.sin(o),u=Math.cos(s),d=Math.sin(s);return e=>{let t=e[0]+a,n=e[1];if(o!==0||s!==0){let e=Math.cos(n),i=Math.cos(t)*e,a=Math.sin(t)*e,o=Math.sin(n),s=o*c+i*l;t=Math.atan2(a*u-s*d,i*c-o*l),n=Math.asin(Math.max(-1,Math.min(1,s*u+a*d)))}else t=EV(t);return[EV(t),n]}}function EV(e){return Math.abs(e)<=Math.PI?e:e-Math.round(e/(2*Math.PI))*2*Math.PI}const DV=Math.PI/180;function OV(e,t,n,i,a){let o=SV(n);return{raw:o,rotateTo:TV(e),middle:o(t[0]*DV,t[1]*DV),offset:i,extent:a}}const kV=[OV([96,0],[-.6,38.7],[29.5,45.5],[0,0],[-.455,-.238,.455,.238]),OV([154,0],[-2,58.5],[55,65],[-.307,.201],[-.425,.12,-.214,.234]),OV([157,0],[-3,19.9],[8,18],[-.205,.212],[-.214,.166,-.115,.234])],AV=[1,.35,1];function jV(e,t){let[n,i]=t;return(t,a)=>{for(let o=0;o<kV.length;o++){let{raw:s,rotateTo:c,middle:l,offset:u,extent:d}=kV[o],[f,p]=s(...c([t,a])),m=e*AV[o],h=(f-l[0])*m+n+u[0]*e,g=i-(p-l[1])*m+u[1]*e,[_,v,y,b]=d;if(h>=n+_*e&&h<=n+y*e&&g>=i+v*e&&g<=i+b*e)return[h,g]}}}const MV=Math.PI/180;function NV(e,t){let n=1/0,i=1/0,a=-1/0,o=-1/0;function s(t){let s=e.planar?[t[0],t[1]]:e.rotate([t[0]*MV,t[1]*MV]),c=e.forward(s);c&&Number.isFinite(c[0])&&Number.isFinite(c[1])&&(n=Math.min(n,c[0]),i=Math.min(i,c[1]),a=Math.max(a,c[0]),o=Math.max(o,c[1]))}function c(e,t){Array.isArray(e)&&(t===0?s(e):e.forEach(e=>c(e,t-1)))}function l(e){if(e){let t=e.type;t===`FeatureCollection`?e.features.forEach(l):t===`Feature`?l(e.geometry):t===`GeometryCollection`?e.geometries.forEach(l):t===`Point`?c(e.coordinates,0):t===`MultiPoint`||t===`LineString`?c(e.coordinates,1):t===`MultiLineString`||t===`Polygon`?c(e.coordinates,2):t===`MultiPolygon`&&c(e.coordinates,3)}}return l(t),[[n,i],[a,o]]}const PV=Math.PI/180,FV=Math.PI,IV=2*FV,LV={equirectangular:{project:()=>cV,kx:IV,ky:FV},mercator:{project:()=>lV,kx:IV,ky:IV,clampPhi:85.0511287798},"equal-earth":{project:()=>xV,kx:5.4133,ky:2.6347},orthographic:{project:()=>uV,kx:2,ky:2,clipAngle:90},stereographic:{project:()=>dV,kx:2,ky:2,clipAngle:135},gnomonic:{project:()=>fV,kx:3.4641,ky:3.4641,clipAngle:60},"azimuthal-equidistant":{project:()=>pV,kx:IV,ky:IV},"azimuthal-equal-area":{project:()=>mV,kx:4,ky:4},"conic-equal-area":{project:e=>SV(e.parallels??[0,60]),kx:6.1702,ky:2.9781},albers:{project:e=>SV(e.parallels??[29.5,45.5]),kx:.7463,ky:.4673,rotate:[96,0],center:[-.6,38.7]},"albers-usa":{composite:jV,kx:.7463,ky:.4673},identity:{planar:!0,kx:1,ky:1},"reflect-y":{planar:!0,flipY:!0,kx:1,ky:1}};function RV(e){let t=String(e).toLowerCase();if(LV[t])return LV[t];throw Error(`projection `+t+` is not implemented`)}function zV(e){if(e!=null){if(typeof e==`function`)return .618;if(typeof e==`object`)return e.type===void 0?void 0:zV(e.type);{let t=RV(e);return t.ky/t.kx}}}function BV(e,t){if(e!=null)return VV(typeof e==`object`&&typeof e!=`function`?e:{type:e},t)}function VV(e,t){let{width:n,height:i,marginTop:a,marginRight:o,marginBottom:s,marginLeft:c}=t,l=e.inset??0,u=n-c-o-l*2,d=i-a-s-l*2,f=c+l,p=a+l;if(typeof e.type==`function`)return HV(e,{frameWidth:u,frameHeight:d,originX:f,originY:p});let m=RV(e.type),h=Math.min(u/m.kx,d/m.ky),g=[u/2,d/2],_=TV(e.rotate??m.rotate),v=e.clip??m.clipAngle,y=typeof v==`number`?v*PV:void 0,b=m.clampPhi===void 0?void 0:m.clampPhi*PV,x;if(m.composite){let e=m.composite(h,[f+g[0],p+g[1]]);x=t=>e(t[0],t[1])}else if(m.planar){let e=m.flipY?-1:1;x=t=>[f+t[0],p+t[1]*e]}else{let t=m.project(e),n=e.center??m.center,i=n?t(n[0]*PV,n[1]*PV):[0,0];x=e=>{let n=b===void 0?e[1]:Math.max(-b,Math.min(b,e[1])),[a,o]=t(e[0],n);return[f+g[0]+(a-i[0])*h,p+g[1]-(o-i[1])*h]}}let S={planar:m.planar===!0,rotate:_,clipAngle:y,forward:x,aspectRatio:m.ky/m.kx};return e.domain?UV(S,e.domain,{frameWidth:u,frameHeight:d,originX:f,originY:p}):S}function HV(e,t){let n=e.type({width:t.frameWidth,height:t.frameHeight});if(typeof n!=`function`)throw Error(`a projection function must return a projection`);let i=180/Math.PI,a={planar:!1,rotate:e=>e,clipAngle:void 0,forward:e=>{let a=n([e[0]*i,e[1]*i]);if(a&&Number.isFinite(a[0])&&Number.isFinite(a[1]))return[a[0]+t.originX,a[1]+t.originY]},aspectRatio:t.frameHeight/t.frameWidth};return e.domain?UV(a,e.domain,t):a}function UV(e,t,n){let[[i,a],[o,s]]=NV(e,t),c=Math.min(n.frameWidth/(o-i),n.frameHeight/(s-a));if(Number.isFinite(c)&&c>0){let t=n.originX+(n.frameWidth-c*(i+o-2*n.originX))/2-n.originX*c,l=n.originY+(n.frameHeight-c*(a+s-2*n.originY))/2-n.originY*c,u=e.forward;return{...e,forward:e=>{let n=u(e);if(n)return[n[0]*c+t,n[1]*c+l]}}}return e}function WV(e){let t=t=>({axis:e.axis,padding:e.padding,...t}),n=e.facet??{},i=e=>({label:n.label,...t(e)}),a={x:t(e.x),y:t(e.y),fx:i(e.fx),fy:i(e.fy),color:e.color??{},r:e.r??{},opacity:e.opacity??{},length:e.length??{},symbol:e.symbol??{}};for(let e of Object.keys(a))a[e].percent===!0&&a[e].transform===void 0&&(a[e]={...a[e],transform:e=>e*100}),a[e].interval!==void 0&&a[e].transform===void 0&&(a[e]={...a[e],transform:Iz(a[e].interval).floor});return{configs:a,facetOptions:n}}const GV={a:56,b:63,c:57,d:63,e:58,f:37,g:62,h:60,i:26,j:26,k:55,l:26,m:88,n:60,o:60,p:62,q:62,r:39,s:54,t:38,u:60,v:55,w:79,x:54,y:55,z:55,A:69,B:67,C:73,D:74,E:61,F:58,G:76,H:75,I:28,J:55,K:67,L:58,M:89,N:75,O:78,P:65,Q:78,R:67,S:65,T:65,U:75,V:69,W:98,X:69,Y:67,Z:67,0:64,1:48,2:62,3:64,4:66,5:63,6:65,7:58,8:65,9:65," ":29,"!":32,'"':49,"'":31,"(":39,")":39,",":31,"-":48,".":31,"/":32,":":31,";":31,"?":52,"‘":31,"’":31,"“":47,"”":47,"…":82};function KV(e){let t=0;for(let n of e)t+=GV[n]??GV.e;return t}function*qV(e){let t=0,n=0;for(;n<e.length;){let i=e[n];if(i===``||i===`-`)n+=1,yield[t,n,!1],t=n;else if(i===` `){for(yield[t,n,!1];e[n+1]===` `;)n+=1;n+=1,t=n}else i===`
|
|
462
|
+
}`;function AV(e){let t=jR({class:`plot-swatches plot-swatches-wrap`});for(let n of e.domain){let i=MR({class:`plot-swatch`}),a=yR({width:$.legendSwatchSize,height:$.legendSwatchSize,fill:e(n)});a.appendChild(xR({width:`100%`,height:`100%`})),i.appendChild(a),i.appendChild(MR({textContent:String(n)})),t.appendChild(i)}return t.appendChild(NR(kV)),t}function jV(e,t){let n=jR({class:`plot-swatches plot-swatches-wrap`});for(let i of e.domain){let a=MR({class:`plot-swatch`}),o=yR({viewBox:`-8 -8 16 16`,width:$.legendSwatchSize,height:$.legendSwatchSize,fill:`none`,stroke:t?t(i):$.stroke,strokeWidth:$.strokeWidth});o.appendChild(TR({d:dV(e(i),64)})),a.appendChild(o),a.appendChild(MR({textContent:String(i)})),n.appendChild(a)}return n.appendChild(NR(kV)),n}function MV(e,t){let n=t.width??240,i=e.label?18:4,[a,o]=e.domain,s=jR({class:`plot-swatches`}),c=yR({width:n,height:i+10+6+$.fontSize+6,style:{overflow:`visible`}});e.label&&c.appendChild(CR({x:0,y:i-6,textContent:e.label,fontSize:$.fontSize,fontWeight:`bold`,fill:$.axisStroke}));let l=e.key===`opacity`?n=>({stopColor:t.color??$.fill,stopOpacity:e(n)}):t=>({stopColor:e(t)}),u=Number(o)-Number(a),d=e.position??ez({domain:[Number(a),Number(o)],range:[0,1]}),f=`plot-ramp-`+ ++OV,p=_R(`linearGradient`,{id:f,x1:`0%`,x2:`100%`,y1:`0%`,y2:`0%`});for(let e=0;e<=64;e++){let t=e/64;p.appendChild(_R(`stop`,{offset:`${t*100}%`,...l(d.invert(t))}))}let m=DR();m.appendChild(p),c.appendChild(m),c.appendChild(xR({x:0,y:i,width:n,height:10,fill:`url(#`+f+`)`}));let h=Math.max(2,n/64),g=TV(e,t,h),_=nR(t.tickFormat,e,g,h);for(let e of g){let t=u===0?0:n*d(e);t>=0&&t<=n&&(c.appendChild(SR({x1:t,y1:i,x2:t,y2:i+10+6,stroke:$.axisStroke})),c.appendChild(CR({x:t,y:i+10+6+2,textContent:_(e),textAnchor:`middle`,dominantBaseline:`hanging`,fontSize:$.fontSize,fill:$.axisStroke})))}return s.appendChild(c),s.appendChild(NR(kV)),s}function NV(e,t){let n=t.width??240,i=$.legendSwatchSize,a=jR({class:`plot-swatches`}),o=yR({width:n,height:i+$.fontSize+8}),s=e.range,c=n/s.length;for(let e=0;e<s.length;e++)o.appendChild(xR({x:c*e,y:0,width:c+.5,height:i,fill:s[e]}));let l=nR(t.tickFormat,e,e.thresholds);for(let t=0;t<e.thresholds.length;t++){let n=c*(t+1);o.appendChild(SR({x1:n,y1:i,x2:n,y2:i+3,stroke:$.axisStroke})),o.appendChild(CR({x:n,y:i+5,textContent:l(e.thresholds[t]),textAnchor:`middle`,dominantBaseline:`hanging`,fontSize:$.fontSize,fill:$.axisStroke}))}return a.appendChild(o),a.appendChild(NR(kV)),a}function PV(e,t={},n){return e.key===`symbol`?jV(e,n):e.type===`ordinal`?AV(e):e.type===`quantile`?NV(e,t):MV(e,t)}function FV(e){let{$svg:t,legends:n=[],title:i,subtitle:a,caption:o}=e;if(t.setAttribute(`class`,`plot`),n.length>0||i||a||o){let e=kR({class:`plot-figure`,style:{margin:`0`,maxWidth:`initial`}});i&&e.appendChild(vR(`h2`,{textContent:i})),a&&e.appendChild(vR(`h3`,{textContent:a}));for(let t of n)e.appendChild(PV(t.scale,t.config,t.colorScale));return e.appendChild(t),o&&e.appendChild(AR({textContent:o})),e}return t}function IV({k:e=1,tx:t=0,ty:n=0}={}){return{k:e,tx:t,ty:n,applyX:n=>n*e+t,applyY:t=>t*e+n,invertX:n=>(n-t)/e,invertY:t=>(t-n)/e}}function LV(e,t,n){return Math.max(t,Math.min(n,e))}function RV(e,t,n,i,a){let o=LV(e.k*t,a[0],a[1]);return IV({k:o,tx:n-(n-e.tx)*o/e.k,ty:i-(i-e.ty)*o/e.k})}function zV(e,t,n){return IV({k:e.k,tx:e.tx+t,ty:e.ty+n})}function BV(e,t,n){return IV({k:e.k,tx:LV(e.tx,t*(1-e.k),0),ty:LV(e.ty,n*(1-e.k),0)})}function VV(e,t){let n=e.scales[t],i=e.configs[t].zoom!==!1;if(n&&n.invert&&CV(n)===!1&&i)return n}function HV(e,t,n,i){let a=e.$svg,o={originX:e.layout.marginLeft,originY:e.layout.marginTop},s=IV(),c=!1,l;function u(t){let[n,i]=BR(t,a,o);return{x:n,y:i,inside:n>=0&&n<=e.layout.plotWidth&&i>=0&&i<=e.layout.plotHeight}}function d(){c===!1&&(c=!0,a.ownerDocument.defaultView.requestAnimationFrame(()=>{c=!1;let n={};t.x&&(n.x=t.x.range.map(e=>t.x.invert(s.invertX(e)))),t.y&&(n.y=t.y.range.map(e=>t.y.invert(s.invertY(e)))),e.redraw(n)}))}function f(t){s=BV(t,e.cellWidth,e.cellHeight),d()}a.addEventListener(`wheel`,e=>{let t=u(e);if(t.inside){e.preventDefault();let i=e.ctrlKey?.01:.002;f(RV(s,2**(-e.deltaY*i),t.x,t.y,n))}},{passive:!1}),a.addEventListener(`pointerdown`,e=>{let t=u(e);i&&t.inside&&(l=t,a.setPointerCapture&&a.setPointerCapture(e.pointerId))}),a.addEventListener(`pointermove`,e=>{if(l){let t=u(e);f(zV(s,t.x-l.x,t.y-l.y)),l=t}}),a.addEventListener(`pointerup`,()=>{l=void 0}),a.addEventListener(`dblclick`,()=>{s=IV(),d()})}function UV(e,t={}){let n={x:VV(e,`x`),y:VV(e,`y`)};(n.x||n.y)&&HV(e,n,t.scaleExtent??[1,64],t.pan!==!1)}const WV=new Set([`x`,`x1`,`x2`,`y`,`y1`,`y2`,`r`,`length`,`rotate`,`strokeWidth`,`fillOpacity`,`strokeOpacity`,`opacity`]),GV=new Set([`fill`,`stroke`]);function KV(e){if(e.interp.source!==e.values){e.interp={source:e.values};for(let t of Object.keys(e.values)){let n=Array(e.interpLength);for(let i=0;i<e.length;i++)n[i]=e.values[t][i];e.interp[t]=n}e.values.opacity===void 0&&(e.interp.opacity=Array(e.interpLength).fill(1))}}function qV(e,t){let n=0;for(;n+1<e.length&&e[n+1]<=t;)n++;let i=e[n],a=e[Math.min(n+1,e.length-1)];return{from:i,to:a,fraction:a>i?Math.max(0,Math.min(1,(t-i)/(a-i))):0}}function JV(e,t,n,i,a,o){for(let o of Object.keys(e.values)){let s=e.values[o],c=s[n],l=s[i],u;u=WV.has(o)?c+(l-c)*a:GV.has(o)&&c!==l?TB(c,l,a):c,e.interp[o][t]=u}let s=e.values.opacity?e.values.opacity[n]:1;e.interp.opacity[t]=s*o}function YV(e,t,n=`eq`){KV(e);let{from:i,to:a,fraction:o}=qV(e.keyframeDomain,t),s=e.rowsAt.get(i),c=e.rowsAt.get(a),l=new Map(c.map(t=>[e.keys[t],t])),u=new Set(s.map(t=>e.keys[t])),d=[],f=e.length;for(let t of s){let n=l.get(e.keys[t]);n===void 0?JV(e,f,t,t,0,1-o):JV(e,f,t,n,o,1),d.push(f),f++}for(let t of c)u.has(e.keys[t])===!1&&(JV(e,f,t,t,0,o),d.push(f),f++);if(n===`lte`){let t=[];for(let n=0;n<e.length;n++)e.times[n]<i&&t.push(n);return[...t,...d]}return d}function XV(e){let t={};for(let n of Object.keys(e.channels??{})){let i=e.channels[n];i!=null&&(i.constant!==void 0||i.value!==void 0&&i.value!==null)&&(t[n]=i)}t.z===void 0&&e.options?.z!==void 0&&e.options.z!==null&&(t.z={value:e.options.z});for(let n of Object.keys(e.options?.channels??{})){let i=e.options.channels[n];t[n]=typeof i==`object`&&i?i:{value:i}}return{type:e.type??`mark`,data:e.data??[],channels:t,render:e.render,options:e.options??{},transform:e.transform??e.options?.transform,facet:e.facet!==!1,layer:e.layer??0}}function ZV(e){return e==null||e===`none`}function QV(e){return ZV(e)===!1}function $V(e,t={}){let n=t.fill,i=t.stroke;return ZV(n)?QV(i)&&QV(e.fill)&&(i=`none`):ZV(i)&&QV(e.stroke)&&(n=`none`),{fill:BB(e.fill,n),stroke:BB(e.stroke,i),strokeWidth:VB(e.strokeWidth,t.strokeWidth),strokeDasharray:e.strokeDasharray?{constant:e.strokeDasharray}:void 0,fillOpacity:VB(e.fillOpacity,t.fillOpacity),strokeOpacity:VB(e.strokeOpacity,t.strokeOpacity),opacity:VB(e.opacity,t.opacity,`opacity`),mixBlendMode:e.mixBlendMode?{constant:e.mixBlendMode}:void 0,time:e.time===void 0?void 0:{value:e.time},key:e.key===void 0?void 0:{value:e.key},px:e.px===void 0?void 0:{value:e.px,scale:`x`},py:e.py===void 0?void 0:{value:e.py,scale:`y`},fx:e.fx?{value:e.fx,scale:`fx`,type:`band`}:void 0,fy:e.fy?{value:e.fy,scale:`fy`,type:`band`}:void 0}}const eH=[`fill`,`stroke`,`strokeWidth`,`strokeDasharray`,`fillOpacity`,`strokeOpacity`,`opacity`];function tH(e,t){let n={};for(let i of eH)e[i]!==void 0&&(n[i]=e[i][t]);return e.mixBlendMode!==void 0&&(n.style={mixBlendMode:e.mixBlendMode[t]}),n}function nH(e=`middle`,t){return{x:/left$/.test(e)?0:/right$/.test(e)?t.width:t.width/2,y:/^top/.test(e)?0:/^bottom/.test(e)?t.height:t.height/2}}function rH(e){return e&&e.bandwidth?e.bandwidth()/2:0}function iH(e,t){let n=[],i=[];for(let a of e)t(a)?i.push(a):i.length>0&&(n.push(i),i=[]);return i.length>0&&n.push(i),n}function aH(e,t){let n=(e,n)=>eH.every(i=>t[i]===void 0||t[i][e]===t[i][n]),i=[],a=[];for(let t of e)a.length===0||n(a[0],t)?a.push(t):(a.push(t),i.push(a),a=[t]);return a.length>0&&i.push(a),i}function oH(e,t){if(t===void 0)return[e];{let n=new Map;for(let i of e){let e=t[i];n.has(e)?n.get(e).push(i):n.set(e,[i])}return[...n.values()]}}function sH(e,t,n){let i=e?e.domain:[void 0],a=t?t.domain:[void 0],o=[];for(let s=0;s<a.length;s++)for(let c=0;c<i.length;c++)o.push({fx:i[c],fy:a[s],x:e?e(i[c]):0,y:t?t(a[s]):0,width:e?e.bandwidth():n.width,height:t?t.bandwidth():n.height,column:c,row:s,isLeft:c===0,isRight:c===i.length-1,isTop:s===0,isBottom:s===a.length-1,isFirst:s===0&&c===0});return o}function cH(e){return e===void 0?null:e}function lH(e,t,n,i){let a=[];for(let o=0;o<e;o++){let e=n===void 0||gz(cH(n[o]))===gz(t.fx),s=i===void 0||gz(cH(i[o]))===gz(t.fy);e&&s&&a.push(o)}return a}function uH(e,t,n,i){let a=typeof i==`number`?i:t/n;return Math.max(1,Math.round(e/Math.max(1,a)))}function dH(e){return e.map(t=>({...t,isLeft:e.every(e=>e.row!==t.row||e.column>=t.column),isRight:e.every(e=>e.row!==t.row||e.column<=t.column),isTop:e.every(e=>e.column!==t.column||e.row>=t.row),isBottom:e.every(e=>e.column!==t.column||e.row<=t.row),isFirst:e[0]!==void 0&&e[0].row===t.row&&e[0].column===t.column}))}function fH(e,t){let n=t.dx??0,i=t.dy??0;if(n===0&&i===0)return e;{let t=bR({transform:`translate(${oR(n)}, ${oR(i)})`});return t.appendChild(e),t}}function pH(e,t){let n=fH(t,e.mark.options);return e.clipped&&n.setAttribute(`clip-path`,`url(#`+e.chart.clipId+`)`),n}function mH(e){let{states:t,ordered:n,scales:i,layout:a,projection:o}=e;e.pointerTargets.length=0;for(let e of n)e.nodes=[];let s=e=>t.some(t=>t.mark.facet&&lH(t.length,e,t.raw.fx,t.raw.fy).length>0),c=sH(i.fx,i.fy,{width:a.plotWidth,height:a.plotHeight}),l=i.fx!==void 0||i.fy!==void 0?dH(c.filter(s)):c;for(let t of l){let s=bR({transform:`translate(${oR(t.x)}, ${oR(t.y)})`});e.$plot.appendChild(s);let c={width:t.width,height:t.height,plotWidth:a.plotWidth,plotHeight:a.plotHeight,marginTop:a.marginTop,marginRight:a.marginRight,marginBottom:a.marginBottom,marginLeft:a.marginLeft,tickCountX:e.tickCountX,tickCountY:e.tickCountY,cell:t,projection:o};for(let o of n){let n=o.mark.facet?lH(o.length,t,o.raw.fx,o.raw.fy):o.data.map((e,t)=>t),l=o.shown?n.filter(e=>o.shown[e]):n;o.mark.options.initialize&&o.mark.options.initialize(l,i,o.values,c);let u=o.mark.options.interaction;if(u){let n=bR();s.appendChild(n),e.pointerTargets.push({state:o,interaction:u,index:l,dimensions:c,originX:a.marginLeft+t.x,originY:a.marginTop+t.y,offsetX:rH(i.x),offsetY:rH(i.y),draw(e){let t=e===void 0?void 0:o.mark.render([e],i,o.values,c,o);n.replaceChildren(),t&&n.appendChild(fH(t,o.mark.options))}})}else{let e=o.mark.render(l,i,o.values,c,o);if(e){let t=pH(o,e);s.appendChild(t),o.nodes.push({$node:t,$cell:s,index:l,dimensions:c})}}}}}function hH(e,t,n){for(let i of t.states){let t=YV(i,n,i.mark.options.timeFilter??`eq`);for(let n of i.nodes){let a=i.mark.render(t,e.scales,i.interp,n.dimensions,i);if(a){let e=pH(i,a);n.$node.replaceWith(e),n.$node=e}}}}function gH(e,t){let n=e.$root,i=n.ownerDocument.defaultView,[a,o]=t.domain,s=o-a,c=t.initial,l=t.playbackRate,u=t.loop,d=t.autoplay===!1,f=!1,p;function m(){n.dispatchEvent(new i.Event(`timeupdate`,{bubbles:!0}))}function h(n){c=n,hH(e,t,c),m()}function g(e){let n=c+e/t.duration*s*l;n>=a&&n<=o?h(n):u?h(l<0?o:a):(d=!0,f=!0,h(l<0?a:o))}let _=!1,v=0;function y(e){let t=n.isConnected;_||=t,t?(d===!1&&s>0&&p!==void 0&&g(e-p),p=e,i.requestAnimationFrame(y)):_===!1&&v<600&&(v++,i.requestAnimationFrame(y))}i.requestAnimationFrame(y),n.play=()=>(d=!1,f=!1,Promise.resolve()),n.pause=()=>{d=!0},Object.defineProperty(n,"paused",{get:()=>d}),Object.defineProperty(n,"ended",{get:()=>f}),Object.defineProperty(n,"duration",{get:()=>t.duration/1e3}),Object.defineProperty(n,"currentTime",{get:()=>t.holdsDates?new Date(c):c,set:e=>{f=!1,h(Math.max(a,Math.min(o,Number(e))))}}),Object.defineProperty(n,"playbackRate",{get:()=>l,set:e=>{l=Number(e)}}),Object.defineProperty(n,"loop",{get:()=>u,set:e=>{u=e===!0}})}const _H=Math.PI/2;function vH(e,t){return[e,t]}function yH(e,t){return[e,Math.log(Math.tan((_H+t)/2))]}function bH(e,t){return[Math.cos(t)*Math.sin(e),Math.sin(t)]}function xH(e,t){let n=Math.cos(t),i=1+n*Math.cos(e);return[n*Math.sin(e)/i,Math.sin(t)/i]}function SH(e,t){let n=Math.cos(t),i=Math.cos(e)*n;return[n*Math.sin(e)/i,Math.sin(t)/i]}function CH(e,t){return TH(e,t,e=>(e=Math.acos(e))&&e/Math.sin(e))}function wH(e,t){return TH(e,t,e=>Math.sqrt(2/(1+e)))}function TH(e,t,n){let i=Math.cos(e),a=Math.cos(t),o=n(i*a);return Number.isFinite(o)?[o*a*Math.sin(e),o*Math.sin(t)]:[0,0]}const EH=1.340264,DH=-.081106,OH=893e-6,kH=.003796,AH=Math.sqrt(3)/2;function jH(e,t){let n=Math.asin(AH*Math.sin(t)),i=n*n,a=i*i*i;return[e*Math.cos(n)/(AH*(EH+3*DH*i+a*(7*OH+9*kH*i))),n*(EH+DH*i+a*(OH+kH*i))]}function MH(e){let[t,n]=e.map(e=>e*Math.PI/180),i=Math.sin(t),a=(i+Math.sin(n))/2;if(Math.abs(a)<1e-6)return NH(t);{let e=1+i*(2*a-i),t=Math.sqrt(e)/a;return(n,i)=>{let o=Math.sqrt(e-2*a*Math.sin(i))/a,s=n*a;return[o*Math.sin(s),t-o*Math.cos(s)]}}}function NH(e){let t=Math.cos(e);return(e,n)=>[e*t,Math.sin(n)/t]}const PH=Math.PI/180;function FH(e){let[t=0,n=0,i=0]=e??[],a=t*PH,o=n*PH,s=i*PH,c=Math.cos(o),l=Math.sin(o),u=Math.cos(s),d=Math.sin(s);return e=>{let t=e[0]+a,n=e[1];if(o!==0||s!==0){let e=Math.cos(n),i=Math.cos(t)*e,a=Math.sin(t)*e,o=Math.sin(n),s=o*c+i*l;t=Math.atan2(a*u-s*d,i*c-o*l),n=Math.asin(Math.max(-1,Math.min(1,s*u+a*d)))}else t=IH(t);return[IH(t),n]}}function IH(e){return Math.abs(e)<=Math.PI?e:e-Math.round(e/(2*Math.PI))*2*Math.PI}const LH=Math.PI/180;function RH(e,t,n,i,a){let o=MH(n);return{raw:o,rotateTo:FH(e),middle:o(t[0]*LH,t[1]*LH),offset:i,extent:a}}const zH=[RH([96,0],[-.6,38.7],[29.5,45.5],[0,0],[-.455,-.238,.455,.238]),RH([154,0],[-2,58.5],[55,65],[-.307,.201],[-.425,.12,-.214,.234]),RH([157,0],[-3,19.9],[8,18],[-.205,.212],[-.214,.166,-.115,.234])],BH=[1,.35,1];function VH(e,t){let[n,i]=t;return(t,a)=>{for(let o=0;o<zH.length;o++){let{raw:s,rotateTo:c,middle:l,offset:u,extent:d}=zH[o],[f,p]=s(...c([t,a])),m=e*BH[o],h=(f-l[0])*m+n+u[0]*e,g=i-(p-l[1])*m+u[1]*e,[_,v,y,b]=d;if(h>=n+_*e&&h<=n+y*e&&g>=i+v*e&&g<=i+b*e)return[h,g]}}}const HH=Math.PI/180;function UH(e,t){let n=1/0,i=1/0,a=-1/0,o=-1/0;function s(t){let s=e.planar?[t[0],t[1]]:e.rotate([t[0]*HH,t[1]*HH]),c=e.forward(s);c&&Number.isFinite(c[0])&&Number.isFinite(c[1])&&(n=Math.min(n,c[0]),i=Math.min(i,c[1]),a=Math.max(a,c[0]),o=Math.max(o,c[1]))}function c(e,t){Array.isArray(e)&&(t===0?s(e):e.forEach(e=>c(e,t-1)))}function l(e){if(e){let t=e.type;t===`FeatureCollection`?e.features.forEach(l):t===`Feature`?l(e.geometry):t===`GeometryCollection`?e.geometries.forEach(l):t===`Point`?c(e.coordinates,0):t===`MultiPoint`||t===`LineString`?c(e.coordinates,1):t===`MultiLineString`||t===`Polygon`?c(e.coordinates,2):t===`MultiPolygon`&&c(e.coordinates,3)}}return l(t),[[n,i],[a,o]]}const WH=Math.PI/180,GH=Math.PI,KH=2*GH,qH={equirectangular:{project:()=>vH,kx:KH,ky:GH},mercator:{project:()=>yH,kx:KH,ky:KH,clampPhi:85.0511287798},"equal-earth":{project:()=>jH,kx:5.4133,ky:2.6347},orthographic:{project:()=>bH,kx:2,ky:2,clipAngle:90},stereographic:{project:()=>xH,kx:2,ky:2,clipAngle:135},gnomonic:{project:()=>SH,kx:3.4641,ky:3.4641,clipAngle:60},"azimuthal-equidistant":{project:()=>CH,kx:KH,ky:KH},"azimuthal-equal-area":{project:()=>wH,kx:4,ky:4},"conic-equal-area":{project:e=>MH(e.parallels??[0,60]),kx:6.1702,ky:2.9781},albers:{project:e=>MH(e.parallels??[29.5,45.5]),kx:.7463,ky:.4673,rotate:[96,0],center:[-.6,38.7]},"albers-usa":{composite:VH,kx:.7463,ky:.4673},identity:{planar:!0,kx:1,ky:1},"reflect-y":{planar:!0,flipY:!0,kx:1,ky:1}};function JH(e){let t=String(e).toLowerCase();if(qH[t])return qH[t];throw Error(`projection `+t+` is not implemented`)}function YH(e){if(e!=null){if(typeof e==`function`)return .618;if(typeof e==`object`)return e.type===void 0?void 0:YH(e.type);{let t=JH(e);return t.ky/t.kx}}}function XH(e,t){if(e!=null)return ZH(typeof e==`object`&&typeof e!=`function`?e:{type:e},t)}function ZH(e,t){let{width:n,height:i,marginTop:a,marginRight:o,marginBottom:s,marginLeft:c}=t,l=e.inset??0,u=n-c-o-l*2,d=i-a-s-l*2,f=c+l,p=a+l;if(typeof e.type==`function`)return QH(e,{frameWidth:u,frameHeight:d,originX:f,originY:p});let m=JH(e.type),h=Math.min(u/m.kx,d/m.ky),g=[u/2,d/2],_=FH(e.rotate??m.rotate),v=e.clip??m.clipAngle,y=typeof v==`number`?v*WH:void 0,b=m.clampPhi===void 0?void 0:m.clampPhi*WH,x;if(m.composite){let e=m.composite(h,[f+g[0],p+g[1]]);x=t=>e(t[0],t[1])}else if(m.planar){let e=m.flipY?-1:1;x=t=>[f+t[0],p+t[1]*e]}else{let t=m.project(e),n=e.center??m.center,i=n?t(n[0]*WH,n[1]*WH):[0,0];x=e=>{let n=b===void 0?e[1]:Math.max(-b,Math.min(b,e[1])),[a,o]=t(e[0],n);return[f+g[0]+(a-i[0])*h,p+g[1]-(o-i[1])*h]}}let S={planar:m.planar===!0,rotate:_,clipAngle:y,forward:x,aspectRatio:m.ky/m.kx};return e.domain?$H(S,e.domain,{frameWidth:u,frameHeight:d,originX:f,originY:p}):S}function QH(e,t){let n=e.type({width:t.frameWidth,height:t.frameHeight});if(typeof n!=`function`)throw Error(`a projection function must return a projection`);let i=180/Math.PI,a={planar:!1,rotate:e=>e,clipAngle:void 0,forward:e=>{let a=n([e[0]*i,e[1]*i]);if(a&&Number.isFinite(a[0])&&Number.isFinite(a[1]))return[a[0]+t.originX,a[1]+t.originY]},aspectRatio:t.frameHeight/t.frameWidth};return e.domain?$H(a,e.domain,t):a}function $H(e,t,n){let[[i,a],[o,s]]=UH(e,t),c=Math.min(n.frameWidth/(o-i),n.frameHeight/(s-a));if(Number.isFinite(c)&&c>0){let t=n.originX+(n.frameWidth-c*(i+o-2*n.originX))/2-n.originX*c,l=n.originY+(n.frameHeight-c*(a+s-2*n.originY))/2-n.originY*c,u=e.forward;return{...e,forward:e=>{let n=u(e);if(n)return[n[0]*c+t,n[1]*c+l]}}}return e}function eU(e){let t=t=>({axis:e.axis,padding:e.padding,...t}),n=e.facet??{},i=e=>({label:n.label,...t(e)}),a={x:t(e.x),y:t(e.y),fx:i(e.fx),fy:i(e.fy),color:e.color??{},r:e.r??{},opacity:e.opacity??{},length:e.length??{},symbol:e.symbol??{}};for(let e of Object.keys(a))a[e].percent===!0&&a[e].transform===void 0&&(a[e]={...a[e],transform:e=>e*100}),a[e].interval!==void 0&&a[e].transform===void 0&&(a[e]={...a[e],transform:KB(a[e].interval).floor});return{configs:a,facetOptions:n}}const tU={a:56,b:63,c:57,d:63,e:58,f:37,g:62,h:60,i:26,j:26,k:55,l:26,m:88,n:60,o:60,p:62,q:62,r:39,s:54,t:38,u:60,v:55,w:79,x:54,y:55,z:55,A:69,B:67,C:73,D:74,E:61,F:58,G:76,H:75,I:28,J:55,K:67,L:58,M:89,N:75,O:78,P:65,Q:78,R:67,S:65,T:65,U:75,V:69,W:98,X:69,Y:67,Z:67,0:64,1:48,2:62,3:64,4:66,5:63,6:65,7:58,8:65,9:65," ":29,"!":32,'"':49,"'":31,"(":39,")":39,",":31,"-":48,".":31,"/":32,":":31,";":31,"?":52,"‘":31,"’":31,"“":47,"”":47,"…":82};function nU(e){let t=0;for(let n of e)t+=tU[n]??tU.e;return t}function*rU(e){let t=0,n=0;for(;n<e.length;){let i=e[n];if(i===``||i===`-`)n+=1,yield[t,n,!1],t=n;else if(i===` `){for(yield[t,n,!1];e[n+1]===` `;)n+=1;n+=1,t=n}else i===`
|
|
457
463
|
`||i===`\r`?(yield[t,n,!0],n+=i===`\r`&&e[n+1]===`
|
|
458
|
-
`?2:1,t=n):n+=1}yield[t,n,!0]}function JV(e,t,n){return e[n-1]===``?e.slice(t,n)+`-`:e.slice(t,n)}function YV(e,t=1/0){if(t===1/0)return e.split(/\r\n?|\n/g);{let n=t*100,i=[],a,o=0;for(let[t,s,c]of qV(e))a===void 0&&(a=t),o>a&&KV(e.slice(a,s))>n&&(i.push(JV(e,a,o)),a=t),c?(i.push(JV(e,a,s)),a=void 0,o=0):o=s;return i}}function XV(e,t){let n=[];for(let i of Object.keys(e.channels))if(i!==`px`&&i!==`py`&&e.channels[i].constant===void 0){let a=e.raw[i]?.[t];a!=null&&n.push({name:e.channels[i].label??ZV(e.channels[i].value,i),value:QV(a),swatch:e.channels[i].scale===`color`?e.values[i][t]:void 0})}return n}function ZV(e,t){return typeof e==`string`?e:t}function QV(e){return typeof e==`number`?MI(e):e instanceof Date?e.toISOString().slice(0,10):String(e)}function $V(e,t={}){return BB({type:`tip`,data:e,options:t,layer:5,channels:{x:{value:t.x,scale:`x`},y:{value:t.y,scale:`y`},...UB(t,{fill:$.fill})},render(e,t,n,i,a){let o=uL(),s=qB(t.x),c=qB(t.y);for(let t of e){let e=XV(a,t),l=Math.max(...e.map(eH))+16,u=e.length*13+16,d=n.x?n.x[t]+s:i.width/2,f=n.y?n.y[t]+c:i.height/2,p=d+l+12<i.width?d+12:d-l-12,m=f-u/2<0?0:Math.min(f-u/2,i.height-u);o.appendChild(dL({x:p,y:m,width:l,height:u,rx:3,fill:`var(--plot-background, white)`,stroke:`#ccc`})),e.forEach((e,t)=>tH(o,e,p,m+t*13))}return o}})}function eH(e){return KV(e.name+` `+e.value)/100*$.fontSize+(e.swatch?12:0)}function tH(e,t,n,i){let a=pL({x:n+8,y:i+8+13-4,fontSize:$.fontSize,fill:`currentColor`});a.appendChild(gL({textContent:t.name,fontWeight:`bold`})),a.appendChild(gL({textContent:` `+t.value})),e.appendChild(a),t.swatch&&e.appendChild(dL({x:n+8+KV(t.name+` `+t.value)/100*$.fontSize+4,y:i+8+3,width:8,height:8,fill:t.swatch}))}function nH(e,t){let n=(e.marks??[]).flat(1/0).filter(Boolean);function i(e){if(t.data!==void 0&&e.data===t.data&&e.channels.fx===void 0&&e.channels.fy===void 0){let n={...e.channels};return t.x!==void 0&&(n.fx={value:t.x,scale:`fx`,type:`band`}),t.y!==void 0&&(n.fy={value:t.y,scale:`fy`,type:`band`}),{...e,channels:n}}return e}let a=[];for(let e of n){let t=i(e);if(a.push(t),t.options.tip){let{tip:e,...n}=t.options;a.push($V(t.data,TL(n)))}}return a}function rH(e,t){let n={};for(let i of Object.keys(t))t[i].value!==void 0&&(n[i]=Oz(e,t[i].value));return n}function iH(e,t){let n={};for(let i of Object.keys(e))n[i]=e[i][t];return n}function aH(e,t={}){let n={};for(let t of Object.keys(e))n[t]=e[t].value===void 0?e[t]:{...e[t],value:t,label:e[t].label??cH(e[t].value)??null};return{...n,...t}}function oH(e,t,n={}){let i={};for(let n of Object.keys(e))if(t[n]===void 0)i[n]=e[n];else{let a=t[n];i[n]={...e[n],value:(e,t)=>a[t],label:e[n].label??cH(e[n].value)??null}}return{...i,...n}}function sH(e,t={}){return{...t,value:(t,n)=>e[n]}}function cH(e){if(typeof e==`string`)return e}function lH(e,t,n){let i=[String(e[n]?.[t])];for(let n of[`fx`,`fy`])e[n]!==void 0&&i.push(String(e[n][t]));return i.join(` `)}const uH={x:`x`,x1:`x`,x2:`x`,y:`y`,y1:`y`,y2:`y`,fill:`color`,stroke:`color`,r:`r`,opacity:`opacity`,fx:`fx`,fy:`fy`};function dH(e,t){let n=new Map;for(let i=0;i<t;i++){let t=fH(e,i);n.has(t)?n.get(t).push(i):n.set(t,[i])}return[...n.values()]}function fH(e,t){let n=[];for(let i of[`z`,`fill`,`stroke`,`fx`,`fy`])e[i]!==void 0&&n.push(String(e[i][t]));return n.join(` `)}function pH(e){return e.channels=!0,e}function mH(e,t,n){if(e.channels===!0)return e(t,n);{let i=e(t,[t.map((e,t)=>t)])??{},a=i.data??t;return{data:(i.facets?i.facets.flat():a.map((e,t)=>t)).map(e=>a[e]),channels:n}}}function hH(e){return e!=null&&Number.isNaN(e)===!1}function gH(e,t){return hH(e)===hH(t)?e<t?-1:+(e>t):hH(e)?-1:1}function _H(e,t){if(t.filter!==void 0&&t.filter!==null){let n=Oz(e,t.filter);return e.map((e,t)=>!!n[t])}}function vH(e,t,n){let i=e.map((e,t)=>t);return i.sort((e,i)=>n?gH(t[i],t[e]):gH(t[e],t[i])),i.map(t=>e[t])}function yH(e,t,n){let i=t.sort,a=typeof i==`object`&&!!i&&i.channel!==void 0,o=typeof i==`object`&&!!i&&a===!1,s=e;if(a){let e=String(i.channel).replace(/^-/,``),t=String(i.channel).startsWith(`-`)||i.order===`descending`,a=n[e];a!==void 0&&a.value!==void 0&&(s=vH(s,Oz(s,a.value),t))}else if(i!=null&&o===!1){if(typeof i==`function`&&i.length!==1)s=[...s].sort(i);else{let e=typeof i==`string`&&i.startsWith(`-`),t=typeof i==`string`?i.replace(/^-/,``):i;s=vH(s,Oz(s,t),e)}}return t.reverse===!0&&(s=[...s].reverse()),s}function bH(e){let t=Ez(e.data),n=e.channels;if(e.transform){let i=mH(e.transform,t,n);t=Ez(i.data),n=i.channels}t=yH(t,e.options,n);let i={};for(let e of Object.keys(n))n[e].constant===void 0&&(i[e]=Oz(t,n[e].value));return{mark:e,data:t,channels:n,raw:i,values:{},length:t.length,shown:_H(t,e.options)}}function xH(e,t){for(let n of e)for(let e of Object.keys(n.channels)){let i=n.channels[e].scale,a=i===void 0?void 0:t[i].transform;a&&n.raw[e]&&(n.raw[e]=n.raw[e].map(a))}}function SH(e,t,n){let i={};for(let t of e)for(let e of Object.keys(t.channels)){let n=t.channels[e];n.scale&&t.raw[e]&&(i[n.scale]===void 0&&(i[n.scale]=[]),i[n.scale].push({values:t.raw[e],type:n.type,zero:n.zero,nice:n.nice,domain:n.domain,radius:n.radius,hint:n.hint,label:n.label===void 0?kz(n.value):n.label}))}n!==void 0&&(delete i.x,delete i.y);for(let e of Object.keys(t))t[e].domain!==void 0&&i[e]===void 0&&(i[e]=[{values:Ez(t[e].domain)}]);return i}const CH={count:e=>e.length,sum:eR,mean:nR,median:iR,min:QL,max:$L,deviation:aR,first:e=>e[0],last:e=>e[e.length-1],distinct:e=>sR(e).length,defined:tR,variance:lR,mode:uR,proportion:eR,"proportion-facet":eR};function wH(e,t,n,i){return typeof e==`function`?e(t,n):typeof e==`object`&&e?wH(e.reduce??`count`,t,n,i):DH(e)&&i?t.length:(CH[e]??CH.count)(t,n)}function TH(e){if(typeof e==`object`&&e)return e.value}function EH(e,t){let n=typeof t==`object`&&t?t.reduce:t;return n===`count`?`Frequency`:typeof n==`string`?n.charAt(0).toUpperCase()+n.slice(1):e}function DH(e){let t=typeof e==`object`&&e?e.reduce:e;return t===`proportion`||t===`proportion-facet`}function OH(e){return(typeof e==`object`&&e?e.reduce:e)===`proportion-facet`?`facet`:`plot`}function kH(e,t,n,i,a){let o=e[t],s=e=>n===`facet`?String(i?.[e])+` `+String(a?.[e]):``,c=new Map;for(let e=0;e<o.length;e++)c.set(s(e),(c.get(s(e))??0)+Number(o[e]));for(let e=0;e<o.length;e++){let t=c.get(s(e));o[e]=t===0?0:Number(o[e])/t}}function AH(e,t,n){let i=typeof n==`string`?{value:n}:{value:n.value??n.channel,...n},a=String(i.value).replace(/^-/,``),o=String(i.value).startsWith(`-`)||i.order===`descending`,s=e.raw[t],c=e.raw[a];if(s!==void 0&&c!==void 0){let e=new Map;for(let t=0;t<s.length;t++)e.has(s[t])?e.get(s[t]).push(c[t]):e.set(s[t],[c[t]]);let t=[...e].map(([e,t])=>[e,wH(i.reduce??`max`,t)]),n=(e,t)=>e<t?-1:+(e>t);return t.sort((e,t)=>(o?t[1]-e[1]:e[1]-t[1])||n(e[0],t[0])),t.map(([e])=>e)}}function jH(e,t){return Object.keys(e.channels).find(n=>e.channels[n].scale===t)}function MH(e,t){function n(e,n,i){if(t[n]&&t[n].domain===void 0){let a=AH(e,jH(e,n),i);a&&(t[n]={...t[n],domain:a})}}for(let t of e){let e=t.mark.options.sort;if(e&&typeof e==`object`&&e.channel===void 0)for(let i of Object.keys(e))n(t,i,e[i])}}function NH(e=0){let t=Number(e);return Math.abs(t)>=10?{rotate:t,padding:$.tickPadding+4*Math.cos(t*Math.PI/180),textAnchor:t>0?`start`:`end`,dominantBaseline:`middle`}:{rotate:0,padding:$.tickPadding,textAnchor:`middle`,dominantBaseline:`hanging`}}function PH(e={}){return BB({type:`axisX`,facet:!1,layer:1,options:e,render(t,n,i,a){let o=n.x,s=a.cell;if(o&&s.isBottom){let t=uL({transform:`translate(0, ${XI(a.height)})`,fontSize:$.fontSize}),i=hB(o,e,a.tickCountX),c=typeof e.ticks==`number`?e.ticks:a.tickCountX,l=KI(e.tickFormat,o,i,c),u=e.tickSize??$.tickSize,d=NH(e.tickRotate);for(let e of i){let n=gB(o,e);if(Number.isFinite(n)){u>0&&t.appendChild(fL({x1:n,y1:0,x2:n,y2:u,stroke:$.axisStroke}));let i=l(e);if(i!==``){let e=u+d.padding;t.appendChild(pL({x:n,y:e,textContent:i,transform:d.rotate===0?void 0:`rotate(`+d.rotate+`, `+XI(n)+`, `+XI(e)+`)`,textAnchor:d.textAnchor,dominantBaseline:d.dominantBaseline,fill:$.axisStroke,fillOpacity:$.axisTextOpacity}))}}}e.line===!0&&t.appendChild(fL({x1:0,y1:0,x2:a.width,y2:0,stroke:$.axisStroke}));let f=mB(e,o);return f&&s.isRight&&n.fx===void 0&&(pB(o)?t.appendChild(pL({x:a.width/2,y:a.marginBottom-3,textContent:f,textAnchor:`middle`,dominantBaseline:`auto`,fill:$.axisStroke,fontSize:$.fontSize})):t.appendChild(pL({x:a.width,y:a.marginBottom-3,textContent:f+` →`,textAnchor:`end`,dominantBaseline:`auto`,fill:$.axisStroke,fontSize:$.fontSize}))),t}return null}})}function FH(e=0,t){let n=Number(e);return Math.abs(n)>60?{rotate:n,padding:$.tickPadding+4*Math.cos(n*Math.PI/180),textAnchor:`middle`,dominantBaseline:n>0?`hanging`:`auto`}:{rotate:n,padding:$.tickPadding,textAnchor:t?`start`:`end`,dominantBaseline:`middle`}}function IH(e={}){let t=e.axis===`right`;return BB({type:`axisY`,facet:!1,layer:1,options:e,render(n,i,a,o){let s=i.y,c=o.cell;if(s&&(t?c.isRight:c.isLeft)){let n=t?o.width:0,a=t?1:-1,l=uL({fontSize:$.fontSize}),u=hB(s,e,o.tickCountY),d=typeof e.ticks==`number`?e.ticks:o.tickCountY,f=KI(e.tickFormat,s,u,d),p=e.tickSize??$.tickSize,m=FH(e.tickRotate,t);for(let e of u){let t=gB(s,e);if(Number.isFinite(t)){p>0&&l.appendChild(fL({x1:n,y1:t,x2:n+a*p,y2:t,stroke:$.axisStroke}));let i=f(e);if(i!==``){let e=n+a*(p+m.padding);l.appendChild(pL({x:e,y:t,textContent:i,transform:m.rotate===0?void 0:`rotate(`+m.rotate+`, `+e+`, `+t+`)`,textAnchor:m.textAnchor,dominantBaseline:m.dominantBaseline,fill:$.axisStroke,fillOpacity:$.axisTextOpacity}))}}}e.line===!0&&l.appendChild(fL({x1:n,y1:0,x2:n,y2:o.height,stroke:$.axisStroke}));let h=mB(e,s);if(h&&c.isTop&&i.fy===void 0){if(pB(s)){let e=n+a*(o[t?`marginRight`:`marginLeft`]-3),i=o.height/2;l.appendChild(pL({x:e,y:i,textContent:h,transform:`rotate(-90, `+e+`, `+i+`)`,textAnchor:`middle`,dominantBaseline:`hanging`,fill:$.axisStroke,fontSize:$.fontSize}))}else l.appendChild(pL({x:n+a*(o[t?`marginRight`:`marginLeft`]-3),y:-(o.marginTop-3),textContent:t?h+` ↑`:`↑ `+h,textAnchor:t?`end`:`start`,dominantBaseline:`hanging`,fill:$.axisStroke,fontSize:$.fontSize}))}return l}return null}})}function LH(e={}){let t=e.anchor!==`bottom`;return BB({type:`axisFx`,facet:!1,layer:1,options:e,render(n,i,a,o){let s=o.cell,c=t?s.isTop:s.isBottom;if(i.fx&&c){let n=uL({fontSize:$.fontSize}),a=e.offset??(t===!1&&i.x?$.tickSize+$.fontSize+8:6),c=t?-a:o.height+a,l=t?-1:1,u=eV(i.fx.domain.length,o.plotWidth,$.tickSpacingX,e.ticks);e.ticks!==null&&s.column%u===0&&n.appendChild(pL({x:o.width/2,y:c,textContent:GI(s.fx,e.tickFormat),textAnchor:`middle`,dominantBaseline:t?`auto`:`hanging`,fill:$.axisStroke}));let d=e.label??i.fx.label;return d&&s.isRight&&n.appendChild(pL({x:o.plotWidth/2-s.x,y:c+l*($.fontSize+4),textContent:d,textAnchor:`middle`,dominantBaseline:t?`auto`:`hanging`,fill:$.axisStroke,fillOpacity:$.axisTextOpacity})),n}return null}})}function RH(e={}){let t=e.anchor===`left`;return BB({type:`axisFy`,facet:!1,layer:1,options:e,render(n,i,a,o){let s=o.cell,c=t?s.isLeft:s.isRight;if(i.fy&&c){let n=uL({fontSize:$.fontSize}),a=e.offset??6,c=t?-a:o.width+a,l=eV(i.fy.domain.length,o.plotHeight,$.tickSpacingY,e.ticks);e.ticks!==null&&s.row%l===0&&n.appendChild(pL({x:c,y:o.height/2,textContent:GI(s.fy,e.tickFormat),textAnchor:t?`end`:`start`,dominantBaseline:`middle`,fill:$.axisStroke}));let u=e.label??i.fy.label;if(u&&s.isTop){let e=t?o.marginLeft:o.marginRight,i=t?-(e-3):o.width+e-3,a=o.plotHeight/2-s.y;n.appendChild(pL({x:i,y:a,textContent:u,transform:`rotate(-90, `+i+`, `+a+`)`,textAnchor:`middle`,dominantBaseline:t?`hanging`:`auto`,fill:$.axisStroke,fillOpacity:$.axisTextOpacity}))}return n}return null}})}function zH(e={}){return BB({type:`gridX`,facet:!1,layer:-1,options:e,render(t,n,i,a){let o=n.x;if(o){let t=uL();for(let n of hB(o,e,a.tickCountX)){let i=gB(o,n);Number.isFinite(i)&&t.appendChild(fL({x1:i,y1:0,x2:i,y2:a.height,stroke:e.stroke??$.gridStroke,strokeOpacity:e.strokeOpacity??$.gridStrokeOpacity}))}return t}return null}})}function BH(e={}){return BB({type:`gridY`,facet:!1,layer:-1,options:e,render(t,n,i,a){let o=n.y;if(o){let t=uL();for(let n of hB(o,e,a.tickCountY)){let i=gB(o,n);Number.isFinite(i)&&t.appendChild(fL({x1:0,y1:i,x2:a.width,y2:i,stroke:e.stroke??$.gridStroke,strokeOpacity:e.strokeOpacity??$.gridStrokeOpacity}))}return t}return null}})}function VH(e={}){return BB({type:`gridFx`,facet:!1,layer:-1,options:e,render(t,n,i,a){let o=a.cell,s=n.fx?eV(n.fx.domain.length,a.plotWidth,$.tickSpacingX,e.ticks):1;if(n.fx&&o.isTop&&o.column%s===0){let t=a.width/2;return fL({x1:t,x2:t,y1:-o.y,y2:a.plotHeight-o.y,stroke:e.stroke??$.gridStroke,strokeOpacity:e.strokeOpacity??$.gridStrokeOpacity})}return null}})}function HH(e={}){return BB({type:`gridFy`,facet:!1,layer:-1,options:e,render(t,n,i,a){let o=a.cell,s=n.fy?eV(n.fy.domain.length,a.plotHeight,$.tickSpacingY,e.ticks):1;if(n.fy&&o.isLeft&&o.row%s===0){let t=a.height/2;return fL({x1:-o.x,x2:a.plotWidth-o.x,y1:t,y2:t,stroke:e.stroke??$.gridStroke,strokeOpacity:e.strokeOpacity??$.gridStrokeOpacity})}return null}})}function UH(e,t){return{axis:e.axis!==null&&e.axis!==!1,grid:e.grid===!0||t===!0&&e.grid!==!1}}function WH(e){let{transform:t,...n}=e;return n}function GH(e,t,n){let i={x:[`top`,`bottom`],y:[`right`,`left`]};function a(e,n){let a=t[e].axis;return i[e[1]].includes(a)?a:n?i[e[1]][0]:i[e[1]][1]}let o=n=>e[n]!==void 0&&t[n].axis!==null&&t[n].axis!==!1;return{fx:{shown:o(`fx`),anchor:a(`fx`,e.x!==void 0&&UH(t.x,n).axis)},fy:{shown:o(`fy`),anchor:a(`fy`,e.y!==void 0&&UH(t.y,n).axis)}}}function KH(e,t,n,i){let a=[];if(e.x){let e=UH(t.x,n);e.grid&&a.push(zH(WH(t.x))),e.axis&&a.push(PH(WH(t.x)))}if(e.y){let e=UH(t.y,n);e.grid&&a.push(BH(WH(t.y))),e.axis&&a.push(IH(WH(t.y)))}return e.fx&&(t.fx.grid===!0&&a.push(VH(WH(t.fx))),i.fx.shown&&a.push(LH({...WH(t.fx),anchor:i.fx.anchor}))),e.fy&&(t.fy.grid===!0&&a.push(HH(WH(t.fy))),i.fy.shown&&a.push(RH({...WH(t.fy),anchor:i.fy.anchor}))),a}function qH(e,t){let n=e.fy?_B(`fy`,e.fy,t.fy)??1:1,i;if(e.y===void 0&&e.fy===void 0)i=0;else if(e.y===void 0)i=Math.max(1,Math.min(60,n));else{let a=_B(`y`,e.y,t.y);i=Math.max(1,Math.min(60,(a??Math.max(7,17/n))*n))}return Math.round(i*$.bandHeight+(e.fx?30:0)+60)}function JH({options:e,facetOptions:t,collected:n,configs:i,facets:a,aspectRatio:o}){let s=n.x!==void 0&&UH(i.x,e.grid).axis,c=n.y!==void 0&&UH(i.y,e.grid).axis,l=e.width??640,u=i.y.axis===`right`?`right`:`left`,d=a.fy.shown&&a.fy.anchor===`right`,f=a.fy.shown&&a.fy.anchor===`left`,p=Math.max(c?20:0,a.fx.shown&&a.fx.anchor===`top`?30:0),m=d?t.marginRight??60:Math.max(s?20:0,c&&u===`right`?40:0),h=Math.max(s?30:0,c?20:0)+(a.fx.shown&&a.fx.anchor===`bottom`?16:0),g=Math.max(c&&u===`left`?40:0,s?20:0,f?40:0),_=e.marginTop??e.margin??p,v=e.marginRight??e.margin??m,y=e.marginBottom??e.margin??h,b=e.marginLeft??e.margin??g,x=n.fx?_B(`fx`,n.fx,i.fx)??1:1,S=n.fy?_B(`fy`,n.fy,i.fy)??1:1,C=o===void 0?void 0:Math.max(.1,Math.min(10,o*(1.1*S-.1)/(1.1*x-.1))),w=e.height??(C===void 0?qH(n,i)-p-h+_+y:Math.round((l-b-v)*C+_+y));return{width:l,height:w,plotWidth:Math.max(1,l-b-v),plotHeight:Math.max(1,w-_-y),marginTop:_,marginRight:v,marginBottom:y,marginLeft:b}}function YH({collected:e,configs:t,layout:n,projectionOption:i,domains:a={}}){let o=(e,t)=>a[e]?{...t,domain:a[e]}:t,s={};e.fx&&(s.fx=fB({name:`fx`,channels:e.fx,config:{padding:$.facetPadding,paddingOuter:0,...t.fx},range:[0,n.plotWidth]})),e.fy&&(s.fy=fB({name:`fy`,channels:e.fy,config:{padding:$.facetPadding,paddingOuter:0,...t.fy},range:[0,n.plotHeight]}));let c=s.fx?s.fx.bandwidth():n.plotWidth,l=s.fy?s.fy.bandwidth():n.plotHeight,u=BV(i,{width:c,height:l,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0}),d=Math.max(2,Math.round(c/80)),f=Math.max(2,Math.round(l/40));return e.x&&(s.x=fB({name:`x`,channels:e.x,config:o(`x`,{ticks:d,...t.x}),range:[0,c]})),e.y&&(s.y=fB({name:`y`,channels:e.y,config:o(`y`,{ticks:f,...t.y}),range:[l,0],ordinalRange:[0,l]})),e.color&&(s.color=fB({name:`color`,channels:e.color,config:t.color})),e.r&&(s.r=fB({name:`r`,channels:e.r,config:t.r,range:[0,Math.min(c,l)/16]})),e.opacity&&(s.opacity=fB({name:`opacity`,channels:e.opacity,config:t.opacity})),e.length&&(s.length=fB({name:`length`,channels:e.length,config:t.length})),e.symbol&&(s.symbol=fB({name:`symbol`,channels:e.symbol,config:t.symbol})),{scales:s,cellWidth:c,cellHeight:l,tickCountX:d,tickCountY:f,projection:u}}const XH=Math.PI/180,ZH=180/Math.PI;function QH(e,t=[]){if(e){let n=e.type;n===`FeatureCollection`?e.features.forEach(e=>QH(e,t)):n===`Feature`?QH(e.geometry,t):n===`GeometryCollection`?e.geometries.forEach(e=>QH(e,t)):n===`Point`?t.push([e.coordinates]):n===`MultiPoint`||n===`LineString`?t.push(e.coordinates):n===`MultiLineString`||n===`Polygon`?e.coordinates.forEach(e=>t.push(e)):n===`MultiPolygon`&&e.coordinates.forEach(e=>t.push(e[0]))}return t}function $H(e,t){let n=0,i=0,a=0,o=0,s=0,c=0;for(let l of QH(t)){let t=[];for(let n of l){let i=e.planar?[n[0],n[1]]:e.rotate([n[0]*XH,n[1]*XH]),a=e.forward(i);a&&Number.isFinite(a[0])&&Number.isFinite(a[1])&&(t.push(a),o+=a[0],s+=a[1],c+=1)}for(let e=0;e<t.length;e++){let[o,s]=t[e],[c,l]=t[(e+1)%t.length],u=o*l-c*s;n+=u,i+=(o+c)*u,a+=(s+l)*u}}return Math.abs(n)>1e-9?[i/(3*n),a/(3*n)]:c>0?[o/c,s/c]:[NaN,NaN]}function eU(e){let t=0,n=0,i=0,a=0;for(let o of QH(e))for(let e=0;e<o.length;e++){let[s,c]=o[e],l=s*XH,u=c*XH,d=Math.cos(u),f=o[e===0?o.length-1:e-1],p=Math.hypot(s-f[0],c-f[1])+1e-9;t+=Math.cos(l)*d*p,n+=Math.sin(l)*d*p,i+=Math.sin(u)*p,a+=p}if(a>0){let e=Math.hypot(t,n,i);if(e>0)return[Math.atan2(n,t)*ZH,Math.asin(Math.max(-1,Math.min(1,i/e)))*ZH]}return[NaN,NaN]}function tU(e,t){for(let n of Object.keys(e.channels)){let i=e.channels[n];if(i.constant!==void 0)e.values[n]=Array(e.length).fill(i.constant);else if(i.scale&&t[i.scale]){let a=t[i.scale];e.values[n]=e.raw[n].map(e=>a(e))}else e.values[n]=e.raw[n]}}function nU(e,t){let n=Math.PI/180;if(e.raw.x&&e.raw.y){let i=Array(e.length),a=Array(e.length),o=e.channels.x.value?.centroid===!0;for(let s=0;s<e.length;s++){let c;if(o)c=$H(t,e.raw.x[s]);else{let i=Number(e.raw.x[s]),a=Number(e.raw.y[s]),o=t.planar?[i,a]:t.rotate([i*n,a*n]);c=t.forward(o)??[NaN,NaN]}i[s]=c[0],a[s]=c[1]}e.values.x=i,e.values.y=a}}function rU(e,t,n){for(let i of e)tU(i,t),n&&i.placed!==!0&&nU(i,n)}let iU=0;function aU(e){let{layout:t,cellWidth:n,cellHeight:i,projection:a,states:o,options:s}=e,c=lL({width:t.width,height:t.height,style:{fontFamily:$.fontFamily,fontSize:$.fontSize+`px`,maxWidth:`100%`,height:`auto`,overflow:`visible`}}),l=uL({transform:`translate(${XI(t.marginLeft)}, ${XI(t.marginTop)})`});c.appendChild(l);let u;if(a||s.zoom){u=`plot-clip-`+ ++iU;let e=_L(),t=vL({id:u});t.appendChild(dL({x:0,y:0,width:n,height:i})),e.appendChild(t),c.appendChild(e);for(let e of o)e.clipped=!0}return{$svg:c,$plot:l,clipId:u}}function oU(e){e.original===void 0?e.original={data:e.data,channels:e.channels,raw:e.raw,length:e.length}:Object.assign(e,e.original)}function sU(e,t){let n=e.states.filter(e=>e.mark.options.rebin);if(n.length!==0){let i={...t};for(let t of n){oU(t),t.scales=e.scales;let n=t.mark.options.rebin(t);t.data=n.data,t.channels=n.channels,t.placed=n.placed===!0,t.length=n.data.length,t.raw={};for(let e of Object.keys(t.channels))t.channels[e].constant===void 0&&(t.raw[e]=Oz(t.data,t.channels[e].value));t.values={};for(let e of Object.keys(t.channels)){let n=t.channels[e];n.scale!==void 0&&n.scale!==`x`&&n.scale!==`y`&&t.raw[e]&&(i[n.scale]=[...i[n.scale]??[],{values:t.raw[e],type:n.type,zero:n.zero,radius:n.radius,label:n.label===void 0?kz(n.value):n.label}])}}return i}}function cU(e,t){t!==void 0&&(e.domains=t??{});let n=t=>Object.assign(e,YH({collected:t,configs:e.configs,layout:e.layout,projectionOption:e.options.projection,domains:e.domains}));n(e.collected),rU(e.states,e.scales,e.projection);let i=sU(e,e.collected);i&&(n(i),rU(e.states,e.scales,e.projection)),e.selection=void 0,e.$svg?e.$plot.replaceChildren():Object.assign(e,aU(e)),iV(e)}function lU(e){let t=new Map;return e.map(e=>{let n=t.get(e)??0;return t.set(e,n+1),n})}function uU(e){let t=e.raw.time.some(e=>e instanceof Date),n=e.raw.time.map(Number),i=sR(n).sort(XL),a=new Map(i.map(e=>[e,[]]));for(let e=0;e<n.length;e++)a.get(n[e]).push(e);let o=Math.max(...i.map(e=>a.get(e).length));return{holdsDates:t,times:n,keys:e.raw.key??lU(n),keyframeDomain:i,rowsAt:a,interpLength:e.length+o*2}}function dU(e,t={}){let n=e.filter(e=>e.raw.time&&e.length>0);if(n.length>0){let e=!1;for(let t of n)Object.assign(t,uU(t)),t.interp={},e||=t.holdsDates;let i=ZL(n.flatMap(e=>e.keyframeDomain));return{states:n,domain:i,holdsDates:e,duration:t.duration??5e3,autoplay:t.autoplay!==!1,loop:t.loop!==!1,playbackRate:t.playbackRate??1,initial:t.initial===void 0?i[0]:Number(t.initial)}}}function fU(e={}){let{configs:t,facetOptions:n}=WV(e),i=nH(e,n).map(bH);xH(i,t);let a=zV(e.projection),o=SH(i,t,a);MH(i,t);let s=GH(o,t,e.grid),c=KH(o,t,e.grid,s).map(bH),l=[...c,...i].sort((e,t)=>e.mark.layer-t.mark.layer),u={options:e,configs:t,facetOptions:n,states:i,collected:o,facets:s,decorationStates:c,ordered:l,layout:JH({options:e,facetOptions:n,collected:o,configs:t,facets:s,aspectRatio:a}),domains:{},pointerTargets:[],redraw(e){cU(u,e)},publishValue(e){if(QI&&u.$root){let t=u.$root.ownerDocument.defaultView;u.$root.value=e,u.$svg.value=e,u.$root.dispatchEvent(new t.Event(`input`,{bubbles:!0}))}}};for(let e of l)e.chart=u;cU(u),QI&&u.pointerTargets.length>0&&jL(u.$svg,u.pointerTargets),QI&&e.zoom&&NB(u,{pan:i.some(e=>e.mark.type===`brush`)===!1,...e.zoom===!0?{}:e.zoom});let d=[];u.scales.color&&t.color.legend===!0&&d.push({scale:u.scales.color,config:t.color}),u.scales.symbol&&t.symbol.legend===!0&&d.push({scale:u.scales.symbol,config:t.symbol,colorScale:u.scales.color}),u.$root=TB({$svg:u.$svg,legends:d,title:e.title,subtitle:e.subtitle,caption:e.caption});let f=dU(i,e.time);return f&&(aV(u,f,f.initial),QI&&oV(u,f)),e.container&&e.container.appendChild(u.$root),(e.mode??(QI?`dom`:`string`))===`string`?String(u.$root):u.$root}function pU(e){return e.map(e=>Q(e.x,e.y)).join(` L `)}function mU(e){return e.length===0?``:e.length===1?`M ${pU(e)} Z`:`M ${pU(e)}`}function hU(e){return e.length===0?``:`M ${pU(e)} Z`}function gU(e){if(e.length<2)return mU(e);{let t=`M ${Q(e[0].x,e[0].y)}`;for(let n=1;n<e.length;n++){let i=(e[n-1].x+e[n].x)/2;t+=` H ${XI(i)} V ${XI(e[n].y)}`}return`${t} H ${XI(e[e.length-1].x)}`}}function _U(e){if(e.length<2)return mU(e);{let t=`M ${Q(e[0].x,e[0].y)}`;for(let n=1;n<e.length;n++)t+=` V ${XI(e[n].y)} H ${XI(e[n].x)}`;return t}}function vU(e){if(e.length<2)return mU(e);{let t=`M ${Q(e[0].x,e[0].y)}`;for(let n=1;n<e.length;n++)t+=` H ${XI(e[n].x)} V ${XI(e[n].y)}`;return t}}function yU(e){let t=e.length-1,n=Array(t),i=Array(t),a=Array(t);n[0]=0,i[0]=2,a[0]=e[0]+2*e[1];for(let o=1;o<t-1;o++)n[o]=1,i[o]=4,a[o]=4*e[o]+2*e[o+1];n[t-1]=2,i[t-1]=7,a[t-1]=8*e[t-1]+e[t];for(let e=1;e<t;e++){let t=n[e]/i[e-1];i[e]-=t,a[e]-=t*a[e-1]}let o=Array(t),s=Array(t);o[t-1]=a[t-1]/i[t-1];for(let e=t-2;e>=0;e--)o[e]=(a[e]-o[e+1])/i[e];s[t-1]=(e[t]+o[t-1])/2;for(let n=0;n<t-1;n++)s[n]=2*e[n+1]-o[n+1];return[o,s]}function bU(e){if(e.length<3)return mU(e);{let[t,n]=yU(e.map(e=>e.x)),[i,a]=yU(e.map(e=>e.y)),o=`M ${Q(e[0].x,e[0].y)}`;for(let s=0;s<e.length-1;s++)o+=` C ${Q(t[s],i[s])} ${Q(n[s],a[s])} ${Q(e[s+1].x,e[s+1].y)}`;return o}}function xU(e,t,n){return` C ${Q((2*e.x+t.x)/3,(2*e.y+t.y)/3)} ${Q((e.x+2*t.x)/3,(e.y+2*t.y)/3)} ${SU(e,t,n)}`}function SU(e,t,n){return Q((e.x+4*t.x+n.x)/6,(e.y+4*t.y+n.y)/6)}function CU(e){if(e.length<3)return mU(e);{let t=e.length-1,n=`M ${Q(e[0].x,e[0].y)}`;n+=` L ${Q((5*e[0].x+e[1].x)/6,(5*e[0].y+e[1].y)/6)}`;for(let i=2;i<=t;i++)n+=xU(e[i-2],e[i-1],e[i]);return n+=xU(e[t-1],e[t],e[t]),n+=` L ${Q(e[t].x,e[t].y)}`,n}}function wU(e){if(e.length<3)return``;if(e.length===3)return`M ${SU(e[0],e[1],e[2])} Z`;{let t=`M ${SU(e[0],e[1],e[2])}`;for(let n=3;n<e.length;n++)t+=xU(e[n-2],e[n-1],e[n]);return t}}function TU(e){return e.length<3?hU(e):wU(e.concat(e.slice(0,3)))}function EU(e,t={}){let n=t.tension??t.beta??.85;if(e.length<2)return``;{let t=e.length-1,i=e[0],a=e[t].x-i.x,o=e[t].y-i.y;return CU(e.map((e,s)=>({x:n*e.x+(1-n)*(i.x+s/t*a),y:n*e.y+(1-n)*(i.y+s/t*o)})))}}function DU(e,t,n,i,a){let o=(1-a)/6,s=e?{x:t.x+o*(n.x-e.x),y:t.y+o*(n.y-e.y)}:t,c=i?{x:n.x+o*(t.x-i.x),y:n.y+o*(t.y-i.y)}:n;return` C ${Q(s.x,s.y)} ${Q(c.x,c.y)} ${Q(n.x,n.y)}`}function OU(e,t={}){let n=t.tension??0;if(e.length<3)return mU(e);{let t=e.length-1,i=`M ${Q(e[0].x,e[0].y)}`;for(let a=0;a<t;a++){let o=a===0?null:e[a-1],s=a===t-1?null:e[a+2];i+=DU(o,e[a],e[a+1],s,n)}return i}}function kU(e,t={}){let n=t.tension??0;if(e.length<3)return``;if(e.length===3)return`M ${Q(e[1].x,e[1].y)} Z`;{let t=`M ${Q(e[1].x,e[1].y)}`;for(let i=3;i<e.length;i++)t+=DU(e[i-3],e[i-2],e[i-1],e[i],n);return t}}function AU(e,t={}){return e.length<3?hU(e):kU(e.concat(e.slice(0,3)),t)}const jU=1e-12;function MU(e,t,n){let i=t.x-e.x,a=t.y-e.y,o=(i*i+a*a)**+n;return{squared:o,length:Math.sqrt(o)}}function NU(e,t,n,i,a){let o=e?MU(e,t,a):{squared:0,length:0},s=MU(t,n,a),c=i?MU(n,i,a):{squared:0,length:0},l={x:t.x,y:t.y},u={x:n.x,y:n.y};if(o.length>jU){let i=2*o.squared+3*o.length*s.length+s.squared,a=3*o.length*(o.length+s.length);l={x:(t.x*i-e.x*s.squared+n.x*o.squared)/a,y:(t.y*i-e.y*s.squared+n.y*o.squared)/a}}if(c.length>jU){let e=2*c.squared+3*c.length*s.length+s.squared,a=3*c.length*(c.length+s.length);u={x:(n.x*e+t.x*c.squared-i.x*s.squared)/a,y:(n.y*e+t.y*c.squared-i.y*s.squared)/a}}return` C ${Q(l.x,l.y)} ${Q(u.x,u.y)} ${Q(n.x,n.y)}`}function PU(e,t={}){let n=t.tension??t.alpha??.5;if(e.length<3)return mU(e);{let t=e.length-1,i=`M ${Q(e[0].x,e[0].y)}`;for(let a=0;a<t;a++){let o=a===0?null:e[a-1],s=a===t-1?null:e[a+2];i+=NU(o,e[a],e[a+1],s,n)}return i}}function FU(e,t={}){let n=t.tension??t.alpha??.5;if(e.length<3)return``;if(e.length===3)return`M ${Q(e[1].x,e[1].y)} Z`;{let t=`M ${Q(e[1].x,e[1].y)}`;for(let i=3;i<e.length;i++)t+=NU(e[i-3],e[i-2],e[i-1],e[i],n);return t}}function IU(e,t={}){return e.length<3?hU(e):FU(e.concat(e.slice(0,3)),t)}function LU(e){return e}function RU(e){return{x:e.y,y:e.x}}function zU(e){return Q(e.x,e.y)}function BU(e){return e<0?-1:1}function VU(e){return e.filter((t,n)=>n===0||t.x!==e[n-1].x||t.y!==e[n-1].y)}function HU(e,t,n){return t===0?e/(n<0?-0:0):e/t}function UU(e,t,n,i){let a=(e*i+t*n)/(n+i);return(BU(e)+BU(t))*Math.min(Math.abs(e),Math.abs(t),.5*Math.abs(a))||0}function WU(e,t,n){return t===0?n:(e/t*3-n)/2}function GU(e){let t=e.length-1,n=Array(e.length);for(let i=1;i<t;i++){let t=e[i].x-e[i-1].x,a=e[i+1].x-e[i].x,o=HU(e[i].y-e[i-1].y,t,a),s=HU(e[i+1].y-e[i].y,a,t);n[i]=UU(o,s,t,a)}return n[0]=WU(e[1].y-e[0].y,e[1].x-e[0].x,n[1]),n[t]=WU(e[t].y-e[t-1].y,e[t].x-e[t-1].x,n[t-1]),n}function KU(e,t={}){let n=t.axis===`y`?RU:LU,i=VU(e),a=i.map(n);if(a.length<3)return mU(i);{let e=GU(a),t=`M ${zU(i[0])}`;for(let i=0;i<a.length-1;i++){let o=a[i],s=a[i+1],c=(s.x-o.x)/3;t+=` C ${zU(n({x:o.x+c,y:o.y+c*e[i]}))} ${zU(n({x:s.x-c,y:s.y-c*e[i+1]}))} ${zU(n(s))}`}return t}}function qU(e){return KU(e,{axis:`x`})}function JU(e){return KU(e,{axis:`y`})}function YU(e){return e}function XU(e){return{x:e.y,y:e.x}}function ZU(e){return Q(e.x,e.y)}function QU(e,t={}){let n=t.axis===`y`?XU:YU,i=e.map(n);if(i.length<2)return mU(e);{let t=`M ${ZU(e[0])}`;for(let e=1;e<i.length;e++){let a=i[e-1],o=i[e],s=(a.x+o.x)/2;t+=` C ${ZU(n({x:s,y:a.y}))} ${ZU(n({x:s,y:o.y}))} ${ZU(n(o))}`}return t}}function $U(e){return QU(e,{axis:`x`})}function eW(e){return QU(e,{axis:`y`})}const tW={auto:mU,basis:CU,"basis-closed":TU,"basis-open":wU,"bump-x":$U,"bump-y":eW,bundle:EU,cardinal:OU,"cardinal-closed":AU,"cardinal-open":kU,"catmull-rom":PU,"catmull-rom-closed":IU,"catmull-rom-open":FU,linear:mU,"linear-closed":hU,"monotone-x":qU,"monotone-y":JU,natural:bU,step:gU,"step-after":vU,"step-before":_U};function nW(e=`linear`,t={}){if(typeof e==`function`)return n=>e(n,t);{let n=tW[String(e).toLowerCase()];if(n)return e=>n(e,t);throw Error(`unknown curve: `+e)}}function rW(e={}){let t=e.top??[],n=e.bottom??[],i=nW(e.curve,e);if(t.length===0)return``;{let e=i(n.slice().reverse());return i(t)+` `+e.replace(/^M /,`L `)+` Z`}}let iW=0;function aW(e){return t=>{let n=sL(`marker`,{viewBox:`-5 -5 10 10`,markerWidth:6.67,markerHeight:6.67,orient:e,fill:`none`,stroke:t,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`});return n.appendChild(hL({d:`M-1.5,-3l3,3l-3,3`})),n}}function oW(e){let t=sL(`marker`,{viewBox:`-5 -5 10 10`,markerWidth:6.67,markerHeight:6.67,fill:e,stroke:`none`});return t.appendChild(mL({r:2.5})),t}function sW(e){let t=sL(`marker`,{viewBox:`-5 -5 10 10`,markerWidth:6.67,markerHeight:6.67,fill:e,stroke:$.background,strokeWidth:1.5});return t.appendChild(mL({r:3})),t}function cW(e){let t=sL(`marker`,{viewBox:`-5 -5 10 10`,markerWidth:6.67,markerHeight:6.67,fill:$.background,stroke:e,strokeWidth:1.5});return t.appendChild(mL({r:3})),t}function lW(e){return t=>{let n=sL(`marker`,{viewBox:`-3 -3 6 6`,markerWidth:6,markerHeight:6,orient:e,stroke:t});return n.appendChild(hL({d:`M0,-3v6`})),n}}const uW={arrow:aW(`auto`),"arrow-reverse":aW(`auto-start-reverse`),dot:oW,circle:sW,"circle-fill":sW,"circle-stroke":cW,tick:lW(`auto`),"tick-x":lW(90),"tick-y":lW(0)};function dW(e){if(e!=null&&e!==!1&&e!==`none`)return e===!0?sW:typeof e==`function`?e:uW[String(e).toLowerCase()]}function fW(e){let t=e.marker;return{start:dW(e.markerStart??t),mid:dW(e.markerMid??t),end:dW(e.markerEnd??t)}}function pW(e,t,n,i){t.has(n)===!1&&t.set(n,new Map);let a=t.get(n);if(a.has(i)===!1){let t=n(i),o=`plot-marker-`+ ++iW;t.setAttribute(`id`,o),e.appendChild(t),a.set(i,`url(#`+o+`)`)}return a.get(i)}function mW(e,t,n,i){let a={};return t.start&&(a.markerStart=pW(e,n,t.start,i)),t.mid&&(a.markerMid=pW(e,n,t.mid,i)),t.end&&(a.markerEnd=pW(e,n,t.end,i)),a}function hW(e,t,n){let i=t?e.x:e.y,a=e.fill!==void 0&&e.fill===i;if(!(e.z===null||e.z===void 0&&a))return e.z??n}function gW(e,t={}){let n=Sz(t),i=Az(n.fill,$.fill),a=n.x1!==void 0||n.x2!==void 0,o=hW(n,a,i.value),s=a?`y`:`x`,c=a?`x`:`y`,l=a?n.x2??n.x:n.y2??n.y,u=a?n.x1:n.y1;return BB({type:`area`,data:e,options:n,channels:{[s]:{value:n[s],scale:s},[c]:{value:l,scale:c,zero:u===void 0},[c+`1`]:u===void 0?void 0:{value:u,scale:c,zero:!0},[c+`2`]:{value:n[c+`2`],scale:c},z:o===void 0?void 0:{value:o},...UB(n,{fill:$.fill,fillOpacity:.8})},render(e,t,i,o){let l=uL(),u=qB(t[s]),d=t[c](0),f=fW(n),p=new Map,m=(e,t)=>a?{x:t,y:e}:{x:e,y:t},h=i[c+`1`],g=i[c+`2`]??i[c],_=e=>Number.isFinite(i[s][e])&&Number.isFinite(g[e]);for(let t of XB(e,i.z)){let e=[...t].sort((e,t)=>i[s][e]-i[s][t]);for(let t of YB(e,i)){let e=JB(t,_).map(e=>rW({top:e.map(e=>m(i[s][e]+u,g[e])),bottom:e.map(e=>m(i[s][e]+u,h?h[e]:d)),curve:n.curve,tension:n.tension})),a=GB(i,t[0]);l.appendChild(hL({d:e.join(` `),...a,...mW(l,f,p,a.stroke)}))}}return l}})}function _W(e,t={}){return BB({type:`boxY`,data:e,options:t,channels:{x:{value:t.x,scale:`x`,type:`band`},y:{value:t.y??bz,scale:`y`,zero:!0},...UB(t,{fill:$.boxFill,stroke:$.stroke})},render(e,n,i,a,o){let s=uL(),c=n.x&&n.x.bandwidth?n.x.bandwidth():a.width,l=c*$.boxWidth,u=(c-l)/2,d=new Map;for(let t of e){let e=i.x?i.x[t]:0;d.has(e)?d.get(e).push(t):d.set(e,[t])}for(let[e,t]of d)f(s,e,t);return s;function f(e,a,s){let d=s.map(e=>o.raw.y[e]),f=rR(d,.25),p=rR(d,.5),m=rR(d,.75),h=m-f,g=d.filter(e=>e>=f-h*1.5&&e<=m+h*1.5),_=a+c/2,v=GB(i,s[0]);e.appendChild(fL({x1:_,x2:_,y1:n.y(QL(g)),y2:n.y($L(g)),stroke:v.stroke,strokeOpacity:v.strokeOpacity,opacity:v.opacity})),e.appendChild(dL({x:a+u,y:n.y(m),width:l,height:Math.abs(n.y(f)-n.y(m)),fill:v.fill,fillOpacity:v.fillOpacity,opacity:v.opacity})),e.appendChild(fL({x1:a+u,x2:a+u+l,y1:n.y(p),y2:n.y(p),stroke:v.stroke,strokeOpacity:v.strokeOpacity,opacity:v.opacity,strokeWidth:$.medianStrokeWidth}));for(let i of d)g.includes(i)===!1&&e.appendChild(mL({cx:_,cy:n.y(i),r:t.r??$.dotRadius,fill:`none`,stroke:v.stroke,strokeOpacity:v.strokeOpacity,opacity:v.opacity}))}}})}function vW(e,t){let n=t[e],i=(typeof n==`object`&&n?n.interval:void 0)??t.interval,a=t[e+`1`]!==void 0||t[e+`2`]!==void 0;if(n==null||i===void 0||a)return t;{let a=Iz(i),o=Dz(n),s=kz(n),c=(e,t)=>a.floor(o(e,t));return{...t,[e]:void 0,[e+`1`]:{value:c,label:s},[e+`2`]:{value:(e,t)=>a.offset(c(e,t)),label:s}}}}function yW(e){let{interval:t,...n}=e;return n}function bW(e){return yW(vW(`x`,e))}function xW(e){return yW(vW(`y`,e))}function SW(e){return yW(vW(`x`,vW(`y`,e)))}function CW(e,t={}){let n=SW(Sz(t)),i=n.x===void 0&&n.y===void 0,a=i?e=>e[0]:n.x,o=i?e=>e[1]:n.y,s=n.inset??0,c=n.insetTop??s,l=n.insetRight??s,u=n.insetBottom??s,d=n.insetLeft??s;return BB({type:`cell`,data:e,options:n,channels:{x:{value:a,scale:`x`,type:`band`},y:{value:o,scale:`y`,type:`band`},...UB(n,{fill:$.fill})},render(e,t,i,a){let o=uL(),s=t.x?.bandwidth?t.x.bandwidth():a.width,f=t.y?.bandwidth?t.y.bandwidth():a.height;for(let t of e)o.appendChild(dL({x:(i.x?i.x[t]:0)+d,y:(i.y?i.y[t]:0)+c,width:s-d-l,height:f-c-u,rx:n.rx,ry:n.ry,...GB(i,t)}));return o}})}function wW(e,t={}){let n={...t,x:(e,t)=>t};return t.fill===void 0&&t.stroke===void 0&&(n.fill=bz),CW(e,n)}function TW(e){let t=e.symbol;if(t!==void 0)return typeof t==`string`&&Qz.includes(t)?{constant:t}:{value:t,scale:`symbol`,hint:e.fill===void 0?`stroke`:`fill`}}function EW(e,t={}){let n=Sz(t),i=n.r!==void 0&&n.sort===void 0&&n.reverse===void 0?{...n,sort:{channel:`-r`}}:n;return BB({type:`dot`,data:e,options:i,channels:{x:{value:i.x,scale:`x`},y:{value:i.y,scale:`y`},r:jz(i.r,$.dotRadius,`r`),symbol:TW(i),...UB(i,{fill:`none`,stroke:$.stroke,strokeWidth:$.strokeWidth})},render(e,t,n,i){let a=uL(),o=qB(t.x),s=qB(t.y);for(let t of e){let e=n.x?n.x[t]+o:i.width/2,c=n.y?n.y[t]+s:i.height/2;n.symbol?a.appendChild(hL({d:tB(n.symbol[t],Math.PI*n.r[t]*n.r[t]),transform:`translate(${XI(e)}, ${XI(c)})`,strokeLinecap:`round`,strokeLinejoin:`round`,...GB(n,t)})):a.appendChild(mL({cx:e,cy:c,r:n.r[t],...GB(n,t)}))}return a}})}function DW(e,t={}){return EW(e,{x:bz,...t})}function OW(e,t={}){return EW(e,{y:bz,...t})}function kW(e={}){return BB({type:`frame`,facet:!1,layer:-1,options:e,render(t,n,i,a){return dL({x:0,y:0,width:a.width,height:a.height,fill:e.fill??`none`,stroke:e.stroke??$.frameStroke,strokeOpacity:e.strokeOpacity??$.frameStrokeOpacity,rx:e.rx,ry:e.ry})}})}const AW=Math.PI,jW=AW/2;function MW(e,t,n,i){let a=Math.sin(e-n);if(Math.abs(a)>1e-6){let o=Math.cos(t),s=Math.cos(i);return Math.atan((Math.sin(t)*s*Math.sin(n)-Math.sin(i)*o*Math.sin(e))/(o*s*a))}return(t+i)/2}function NW(e,t){let n=[],i=[],a=0;for(let t=0;t<e.length;t++){let[o,s]=e[t];if(t>0){let[c,l]=e[t-1],u=o-c;if(a+=u>AW?u-2*AW:u<-AW?u+2*AW:u,Math.abs(u)>AW){let e=c<o?-AW:AW,t=MW(c,l,o,s);i.push([e,t]),n.push(i),i=[[-e,t]]}}i.push([o,s])}return n.push(i),n.length===1?n:t?PW(n,a):n}function PW(e,t){let n=[[...e[e.length-1].slice(0,-1),...e[0]],...e.slice(1,-1)];if(Math.abs(t)>AW){let e=t>0?-jW:jW;for(let t of n){let n=t[0],i=t[t.length-1];t.push([i[0],e],[n[0],e])}}return n}function FW(e,t,n){let i=Math.cos(t),a=e.map(([e,t])=>Math.cos(t)*Math.cos(e)>i);if(a.every(e=>e))return[e];if(a.every(e=>e===!1))return[];{let i=[],o=[];for(let n=0;n<e.length;n++){let s=n===0?e.length-1:n-1;a[n]&&a[s]===!1&&(o=[IW(e[s],e[n],t)]),a[n]&&o.push(e[n]),a[n]===!1&&a[s]&&(o.push(IW(e[n],e[s],t)),i.push(o),o=[])}if(o.length>0&&i.push(o),n)for(let e of i)e.push(...RW(e[e.length-1],e[0],t));return i}}function IW(e,t,n){let i=0,a=1;for(let o=0;o<24;o++){let o=(i+a)/2,s=LW(e,t,o);Math.cos(s[1])*Math.cos(s[0])>Math.cos(n)?a=o:i=o}return LW(e,t,a)}function LW(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function RW(e,t,n){let i=Math.atan2(Math.sin(e[1]),Math.cos(e[1])*Math.sin(e[0])),a=Math.atan2(Math.sin(t[1]),Math.cos(t[1])*Math.sin(t[0]))-i;a>AW&&(a-=2*AW),a<-AW&&(a+=2*AW);let o=Math.max(2,Math.ceil(Math.abs(a)/.1)),s=[];for(let e=1;e<=o;e++){let t=i+a*e/o,c=Math.sin(n)*Math.sin(t),l=Math.sin(n)*Math.cos(t),u=Math.cos(n);s.push([Math.atan2(l,u),Math.asin(Math.max(-1,Math.min(1,c)))])}return s}const zW=Math.PI/180;function BW(e,t=3){let n=[];function i(t,i){for(let a of UW(e,t))a.length>1&&n.push(`M${a.map(([e,t])=>Q(e,t)).join(`L`)}${i?`Z`:``}`)}function a(t,n){for(let a of HW(e,t,n))i(a,n)}function o(i){let a=e.forward(VW(e,i));if(a){let[e,i]=a,o=t;n.push(`M${Q(e+o,i)}A${XI(o)},${XI(o)} 0 1 1 ${Q(e-o,i)}A${XI(o)},${XI(o)} 0 1 1 ${Q(e+o,i)}Z`)}}function s(t){a(t.map(t=>VW(e,t)),!0)}function c(t){a(t.map(t=>VW(e,t)),!1)}function l(t){if(t){let n=t.type;n===`FeatureCollection`?t.features.forEach(l):n===`Feature`?l(t.geometry):n===`GeometryCollection`?t.geometries.forEach(l):n===`Point`?o(t.coordinates):n===`MultiPoint`?t.coordinates.forEach(o):n===`LineString`?c(t.coordinates):n===`MultiLineString`?t.coordinates.forEach(c):n===`Polygon`?t.coordinates.forEach(s):n===`MultiPolygon`?t.coordinates.forEach(e=>e.forEach(s)):n===`Sphere`&&i(KW(e),!0)}}return function(e){return n.length=0,l(e),n.join(``)}}function VW(e,t){return e.planar?[t[0],t[1]]:e.rotate([t[0]*zW,t[1]*zW])}function HW(e,t,n){return e.planar?[t]:e.clipAngle===void 0?NW(t,n):FW(t,e.clipAngle,n)}function UW(e,t){let n=[],i=[];for(let a=0;a<t.length;a++){let o=e.forward(t[a]);o&&Number.isFinite(o[0])&&Number.isFinite(o[1])?i.length>0&&e.planar===!1?WW(e,t[a-1],t[a],i,16):i.push(o):i.length>0&&(n.push(i),i=[])}return i.length>0&&n.push(i),n}function WW(e,t,n,i,a){let o=i[i.length-1],s=e.forward(n),c=GW(t,n),l=e.forward(c);if(s===void 0||l===void 0)return;let u=s[0]-o[0],d=s[1]-o[1],f=u*u+d*d,p=(l[0]-o[0])*d-(l[1]-o[1])*u;a>0&&p*p>.5*f?(WW(e,t,c,i,a-1),WW(e,c,n,i,a-1)):i.push(s)}function GW(e,t){let[n,i]=e,[a,o]=t,s=Math.cos(i),c=Math.cos(o),l=Math.cos(n)*s+Math.cos(a)*c,u=Math.sin(n)*s+Math.sin(a)*c,d=Math.sin(i)+Math.sin(o),f=Math.sqrt(l*l+u*u+d*d);return f>0?[Math.atan2(u,l),Math.asin(Math.max(-1,Math.min(1,d/f)))]:[(n+a)/2,(i+o)/2]}function KW(e){let t=Math.PI,n=[];if(e.clipAngle!==void 0){let i=e.clipAngle;for(let e=0;e<=180;e++){let a=e/180*2*t,o=Math.sin(i)*Math.sin(a),s=Math.sin(i)*Math.cos(a);n.push([Math.atan2(s,Math.cos(i)),Math.asin(o)])}}else{for(let e=0;e<=90;e++)n.push([-t+2*t*e/90,t/2]);for(let e=0;e<=90;e++)n.push([t,t/2-t*e/90]);for(let e=0;e<=90;e++)n.push([t-2*t*e/90,-t/2]);for(let e=0;e<=90;e++)n.push([-t,-t/2+t*e/90])}return n}function qW(e,t={}){return BB({type:`geo`,data:e,options:t,channels:{geometry:{value:t.geometry??bz},...UB(t,{fill:`none`,stroke:$.stroke,strokeWidth:1})},render(e,n,i,a){let o=a.projection;if(o){let n=uL({strokeLinecap:`round`,strokeLinejoin:`round`}),a=BW(o,t.r??3);for(let t of e){let e=a(i.geometry[t]);e&&n.appendChild(hL({d:e,...GB(i,t)}))}return n}throw Error(`a geo mark needs a projection: Plot.plot({projection: "equirectangular", ...})`)}})}const JW=2.5;function YW(e,t,n){let i=[];for(let a=t;a<=n+1e-6;a+=JW)i.push([e,Math.min(n,a)]);return i}function XW(e,t,n){let i=[];for(let a=t;a<=n+1e-6;a+=JW)i.push([Math.min(n,a),e]);return i}function ZW(){let e=[];for(let t=-180;t<=180;t+=10)Math.abs(t%90)>1e-6&&e.push(YW(t,-80,80));for(let t=-180;t<=180;t+=90)e.push(YW(t,-90,90));for(let t=-80;t<=80;t+=10)e.push(XW(t,-180,180));return{type:`MultiLineString`,coordinates:e}}const QW={type:`Sphere`};function $W(e={}){return qW(ZW(),{strokeOpacity:.1,...e})}function eG(e={}){return qW(QW,{strokeWidth:1.5,...e})}function tG(e={}){let t=e.points??[];return nW(e.curve,e)(t)}function nG(e,t={}){let n=Sz(t),i=Az(n.stroke,$.stroke),a=n.z===null?void 0:n.z??i.value;return BB({type:`line`,data:e,options:n,channels:{x:{value:n.x,scale:`x`},y:{value:n.y,scale:`y`},z:a===void 0?void 0:{value:a},...UB(n,{stroke:$.stroke,strokeWidth:$.strokeWidth})},render(e,t,i,a){let o=uL(),s=qB(t.x),c=qB(t.y),l=fW(n),u=new Map,d=e=>Number.isFinite(i.x[e])&&Number.isFinite(i.y[e]);for(let t of XB(e,i.z)){let e=n.sort===!1?t:[...t].sort((e,t)=>i.x[e]-i.x[t]);for(let t of YB(e,i)){let e=JB(t,d).map(e=>tG({points:e.map(e=>({x:i.x[e]+s,y:i.y[e]+c})),curve:n.curve,tension:n.tension})),a=GB(i,t[0]);o.appendChild(hL({d:e.join(` `),strokeLinejoin:`round`,strokeLinecap:`round`,...a,...mW(o,l,u,a.stroke)}))}}return o}})}function rG(e,t={}){return BB({type:`linearRegressionY`,data:e,options:t,channels:{x:{value:t.x,scale:`x`},y:{value:t.y,scale:`y`},...UB(t,{stroke:$.stroke,strokeWidth:$.strokeWidth})},render(e,t,n,i,a){if(e.length>1){let i=e.map(e=>a.raw.x[e]),o=e.map(e=>a.raw.y[e]),s=i.reduce((e,t)=>e+t,0)/i.length,c=o.reduce((e,t)=>e+t,0)/o.length,l=0,u=0;for(let e=0;e<i.length;e++)l+=(i[e]-s)*(o[e]-c),u+=(i[e]-s)**2;let d=u===0?0:l/u,f=c-d*s,[p,m]=ZL(i),h=uL();return h.appendChild(fL({x1:t.x(p),y1:t.y(d*p+f),x2:t.x(m),y2:t.y(d*m+f),...GB(n,e[0])})),h}return null}})}function iG(e,t={}){let n=SW(t);return BB({type:`rect`,data:e,options:n,channels:{x1:{value:n.x1??n.x,scale:`x`,type:n.x===void 0?void 0:`band`},x2:{value:n.x2,scale:`x`},y1:{value:n.y1,scale:`y`,zero:!0},y2:{value:n.y2??n.y,scale:`y`,zero:!0},...UB(n,{fill:$.fill})},render(e,t,i,a){let o=uL(),s=t.x&&t.x.bandwidth?t.x.bandwidth():0,c=t.y===void 0,l=t.x===void 0,u=c?a.height:t.y(0),d=l?0:t.x(0),f=n.insetLeft??n.inset??0,p=n.insetRight??n.inset??0,m=n.insetTop??n.inset??0,h=n.insetBottom??n.inset??0;for(let t of e){let e=i.x1?i.x1[t]:l?0:i.x[t],g=i.x2?i.x2[t]:i.x1?e+s:l?a.width:d,_=i.y2?i.y2[t]:i.y?i.y[t]:c?0:u,v=i.y1?i.y1[t]:c?a.height:u;o.appendChild(dL({x:Math.min(e,g)+f,y:Math.min(_,v)+m,width:Math.max(0,Math.abs(g-e)-f-p),height:Math.max(0,Math.abs(v-_)-m-h),rx:n.rx,ry:n.ry,...GB(i,t)}))}return o}})}function aG(e,t={}){let n=xW(t);return BB({type:`ruleX`,data:e,options:n,channels:{x:{value:n.x??bz,scale:`x`},y1:{value:n.y1,scale:`y`},y2:{value:n.y2,scale:`y`},...UB(n,{stroke:$.stroke})},render(e,t,i,a){let o=uL(),s=fW(n),c=new Map,l=qB(t.x);for(let t of e){let e=i.x[t]+l;o.appendChild(fL({x1:e,x2:e,y1:i.y1?i.y1[t]:0,y2:i.y2?i.y2[t]:a.height,...GB(i,t),...mW(o,s,c,i.stroke?i.stroke[t]:void 0)}))}return o}})}function oG(e,t={}){let n=bW(t);return BB({type:`ruleY`,data:e,options:n,channels:{y:{value:n.y??bz,scale:`y`},x1:{value:n.x1,scale:`x`},x2:{value:n.x2,scale:`x`},...UB(n,{stroke:$.stroke})},render(e,t,i,a){let o=uL(),s=fW(n),c=new Map,l=qB(t.y);for(let t of e){let e=i.y[t]+l;o.appendChild(fL({x1:i.x1?i.x1[t]:0,x2:i.x2?i.x2[t]:a.width,y1:e,y2:e,...GB(i,t),...mW(o,s,c,i.stroke?i.stroke[t]:void 0)}))}return o}})}function sG(e,t={}){let n=t.symbol??`circle`,i=typeof n==`string`&&Qz.includes(n);return BB({type:`symbol`,data:e,options:t,channels:{x:{value:t.x,scale:`x`},y:{value:t.y,scale:`y`},size:jz(t.size,64),shape:i?{constant:n}:{value:n},...UB(t,{fill:$.fill})},render(e,t,n,i){let a=uL(),o=qB(t.x),s=qB(t.y);for(let t of e)a.appendChild(hL({d:tB(n.shape[t],n.size[t]),transform:`translate(${XI(n.x[t]+o)}, ${XI(n.y[t]+s)})`,...GB(n,t)}));return a}})}function cG(e,t){return typeof e==`string`||typeof e==`number`?e:t}function lG(e,t={}){let n=Sz(t),i=n.frameAnchor??`middle`;return BB({type:`text`,data:e,options:n,channels:{x:{value:n.x,scale:`x`},y:{value:n.y,scale:`y`},text:{value:t.text??t.y??cG},...UB(n.stroke===void 0?n:{strokeWidth:3,...n},{fill:$.fill})},render(e,t,a,o){let s=uL(),c=qB(t.x),l=qB(t.y),u=KB(i,o),d=n.lineHeight??1,f=Number(n.rotate??0);for(let t of e){let e=a.x?a.x[t]+c:u.x,o=a.y?a.y[t]+l:u.y,p=YV(String(a.text[t]),n.lineWidth??1/0),m=pL({x:e,y:o,transform:f===0?void 0:`rotate(`+f+`, `+XI(e)+`, `+XI(o)+`)`,textContent:p.length===1?p[0]:``,textAnchor:n.textAnchor??(/right$/.test(i)?`end`:/left$/.test(i)?`start`:`middle`),dominantBaseline:n.dominantBaseline??(/^top/.test(i)?`hanging`:/^bottom/.test(i)?`auto`:`middle`),fontSize:n.fontSize??$.fontSize,fontWeight:n.fontWeight,...GB(a,t),paintOrder:`stroke`,strokeLinejoin:`round`});if(p.length>1){let t=/^top/.test(i)?0:/^bottom/.test(i)?1-p.length:(1-p.length)/2;for(let n=0;n<p.length;n++)m.appendChild(gL({x:e,dy:(n===0?t:1)*d+`em`,textContent:p[n]}))}s.appendChild(m)}return s}})}function uG(e,t={}){return lG(e,{x:bz,...t})}function dG(e,t={}){return lG(e,{y:bz,...t})}function fG(e,t={}){let n=xW(t);return BB({type:`tickX`,data:e,options:n,channels:{x:{value:n.x??bz,scale:`x`},y:{value:n.y,scale:`y`,type:`band`},...UB(n,{stroke:$.stroke,strokeWidth:$.strokeWidth})},render(e,t,i,a){let o=uL(),s=fW(n),c=new Map,l=t.y&&t.y.bandwidth?t.y.bandwidth():a.height,u=(n.tickLength??l)/2,d=qB(t.y),f=qB(t.x);for(let t of e){let e=i.y?i.y[t]+d:a.height/2,n=i.x[t]+f;o.appendChild(fL({x1:n,x2:n,y1:e-u,y2:e+u,...GB(i,t),...mW(o,s,c,i.stroke?i.stroke[t]:void 0)}))}return o}})}function pG(e,t={}){let n=bW(t);return BB({type:`tickY`,data:e,options:n,channels:{y:{value:n.y??bz,scale:`y`},x:{value:n.x,scale:`x`,type:`band`},...UB(n,{stroke:$.stroke,strokeWidth:$.strokeWidth})},render(e,t,i,a){let o=uL(),s=fW(n),c=new Map,l=t.x&&t.x.bandwidth?t.x.bandwidth():a.width,u=(n.tickLength??l)/2,d=qB(t.x),f=qB(t.y);for(let t of e){let e=i.x?i.x[t]+d:a.width/2,n=i.y[t]+f;o.appendChild(fL({x1:e-u,x2:e+u,y1:n,y2:n,...GB(i,t),...mW(o,s,c,i.stroke?i.stroke[t]:void 0)}))}return o}})}const mG=$.vectorRadius*5;function hG(e,t){let n=e*t/mG;return`M0,0L0,`+-e+`M`+-n+`,`+(n-e)+`L0,`+-e+`L`+n+`,`+(n-e)}function gG(e,t){return`M`+-t+`,0L0,`+-e+`L`+t+`,0`}function _G(e,t){return e===`start`?0:e===`end`?t:t/2}function vG(e,t={}){let n=Sz(t),i=n.anchor??`middle`,a=n.r??$.vectorRadius,o=n.shape===`spike`?gG:hG;return BB({type:`vector`,data:e,options:n,channels:{x:{value:n.x,scale:`x`},y:{value:n.y,scale:`y`},length:jz(n.length,$.vectorLength,`length`),rotate:jz(n.rotate,0),...UB(n,{fill:`none`,stroke:$.stroke,strokeWidth:$.strokeWidth})},render(e,t,s,c){let l=uL(),u=qB(t.x),d=qB(t.y),f=KB(n.frameAnchor,c);for(let t of e){let e=s.length[t],n=s.x?s.x[t]+u:f.x,c=s.y?s.y[t]+d:f.y;l.appendChild(hL({d:o(e,a),transform:`translate(${XI(n)}, ${XI(c)}) rotate(${XI(s.rotate[t])}) translate(0, `+_G(i,e)+`)`,strokeLinejoin:`round`,strokeLinecap:`round`,...GB(s,t)}))}return l}})}function yG(e,t={}){return vG(e,{x:bz,...t})}function bG(e,t={}){return vG(e,{y:bz,...t})}function xG(e,t={}){return vG(e,{strokeWidth:1,fill:t.stroke??$.stroke,fillOpacity:.3,...t,shape:`spike`,anchor:`start`})}const SG=.5;function CG(e,t,n){let i=n,a=n*1.5/Math.sqrt(3),o=(t-0)/a,s=Math.round(o),c=(e-SG)/i-(s&1)/2,l=Math.round(c),u=o-s;if(Math.abs(u)*3>1){let e=c-l,t=l+(c<l?-1:1)/2,n=s+(o<s?-1:1),i=c-t,a=o-n;e*e+u*u>i*i+a*a&&(l=t+(s&1?1:-1)/2,s=n)}return{key:l+`,`+s,x:(l+(s&1)/2)*i+SG,y:s*a+0}}function wG(e={fill:`count`},t={}){let n=t.binWidth??20,{binWidth:i,...a}=t;return{...a,fill:e.fill===void 0?a.fill:a.fill??[],symbol:a.symbol??`hexagon`,r:a.r??(e.r===void 0?n/2:void 0),rebin(t){let i=[`fx`,`fy`,`z`,`fill`,`stroke`,`symbol`].filter(n=>t.raw[n]!==void 0&&e[n]===void 0),a=new Map;for(let e=0;e<t.length;e++){let o=t.values.x[e],s=t.values.y[e];if(Number.isFinite(o)&&Number.isFinite(s)){let c=CG(o,s,n),l=i.map(n=>String(t.raw[n][e])).join(` `)+` `+c.key;a.has(l)?a.get(l).members.push(e):a.set(l,{hex:c,first:e,members:[e]})}}let o=t.scales.x===void 0||t.scales.y===void 0,s=[];for(let n of a.values()){let a=o?{x:n.hex.x,y:n.hex.y}:{x:t.scales.x.invert(n.hex.x),y:t.scales.y.invert(n.hex.y)};for(let e of i)a[e]=t.raw[e][n.first];for(let i of Object.keys(e)){let o=TH(e[i])??i,s=t.raw[o],c=s===void 0?n.members:n.members.map(e=>s[e]);a[i]=wH(e[i],c,n.members.map(e=>t.data[e]),s===void 0)}s.push(a)}let c={x:{value:`x`,scale:o?void 0:`x`,label:t.channels.x?.label},y:{value:`y`,scale:o?void 0:`y`,label:t.channels.y?.label}};for(let e of i)c[e]={...t.channels[e],value:e};for(let t of Object.keys(e))c[t]={value:t,scale:uH[t]??`color`,radius:t===`r`?n/2:void 0,label:EH(t,e[t])};for(let e of Object.keys(t.channels))c[e]===void 0&&t.channels[e].constant!==void 0&&(c[e]=t.channels[e]);return{data:s,channels:c,placed:o}}}}function TG(e={}){let t=e.binWidth??20;return BB({type:`hexgrid`,data:[0],facet:!1,options:e,channels:{},render(n,i,a,o){let s=t/2,c=s*2/Math.sqrt(3),l=c/2,u=s*2,d=c*1.5,f=Math.floor(-.5/u),p=Math.ceil((o.width-SG)/u),m=Math.floor((l-0)/d),h=Math.ceil((o.height-l-0)/d)+1,g=`m0,${XI(-c)}l${XI(s)},${XI(l)}v${XI(c)}l${XI(-s)},${XI(l)}`,_=g;for(let e=m;e<h;e++)for(let t=f;t<p;t++)_=_+`M`+XI(t*u+(e&1)*s)+`,`+XI(e*d)+g;let v=uL({transform:`translate(0.5, 0)`});return v.appendChild(hL({d:_,fill:`none`,stroke:e.stroke??$.axisStroke,strokeOpacity:e.strokeOpacity??.1})),v}})}function EG(e,t,n,i,a){return(e.x-t)*i+(e.y-n)*a}function DG(e,t,n,i,a){let o=i-t,s=a-n,c=(t+i)/2,l=(n+a)/2,u=[];for(let t=0;t<e.length;t++){let n=e[t],i=e[(t+1)%e.length],a=EG(n,c,l,o,s),d=EG(i,c,l,o,s);if(a<=0&&u.push(n),a<=0!=d<=0){let e=a/(a-d);u.push({x:n.x+(i.x-n.x)*e,y:n.y+(i.y-n.y)*e})}}return u}function OG(e,t){let n=[{x:t.x1,y:t.y1},{x:t.x2,y:t.y1},{x:t.x2,y:t.y2},{x:t.x1,y:t.y2}];return e.map((t,i)=>{let a=n;for(let n=0;n<e.length&&a.length>0;n++)if(n!==i){let o=e[n];o.x!==t.x||o.y!==t.y?a=DG(a,t.x,t.y,o.x,o.y):n<i&&(a=[])}return a.length>2?a:null})}function kG(e){let t=new Set,n=[],i=e=>Math.round(e*1e6)/1e6;for(let a of e)if(a)for(let e=0;e<a.length;e++){let o=a[e],s=a[(e+1)%a.length],c=[i(o.x)+`,`+i(o.y),i(s.x)+`,`+i(s.y)].sort().join(` `);t.has(c)===!1&&(t.add(c),n.push([o,s]))}return n}function AG(e,t={}){let n=Sz(t);return BB({type:`voronoi`,data:e,options:n,channels:{x:{value:n.x,scale:`x`},y:{value:n.y,scale:`y`},z:{value:n.z},...UB(n,{stroke:$.axisStroke,fill:`none`})},render(e,t,n,i){let a=uL();for(let[o,s]of MG(e,t,n,i))s&&a.appendChild(hL({d:jG(s),strokeMiterlimit:1,...GB(n,o)}));return a}})}function jG(e){return`M `+e.map(e=>Q(e.x,e.y)).join(` L `)+` Z`}function MG(e,t,n,i){let a=qB(t.x),o=qB(t.y),s={x1:0,y1:0,x2:i.width,y2:i.height},c=e.filter(e=>Number.isFinite(n.x[e])&&Number.isFinite(n.y[e])),l=new Map;for(let e of c){let t=n.z?String(n.z[e]):``;l.has(t)?l.get(t).push(e):l.set(t,[e])}let u=[];for(let e of l.values()){let t=OG(e.map(e=>({x:n.x[e]+a,y:n.y[e]+o})),s);for(let n=0;n<e.length;n++)u.push([e[n],t[n]])}return u}function NG(e,t={}){let n=Sz(t);return BB({type:`voronoiMesh`,data:e,options:n,channels:{x:{value:n.x,scale:`x`},y:{value:n.y,scale:`y`},z:{value:n.z},...UB({strokeOpacity:.2,...n},{stroke:$.axisStroke,fill:`none`})},render(e,t,n,i){let a=uL(),o=kG(MG(e,t,n,i).map(([,e])=>e)).map(([e,t])=>`M `+Q(e.x,e.y)+` L `+Q(t.x,t.y));return o.length>0&&a.appendChild(hL({d:o.join(` `),fill:`none`,...GB(n,e[0])})),a}})}let PG=0;function FG(e,t,n){if(e.length<2)return``;{let i=e[0],a=e[e.length-1];return tG({points:e,curve:n})+` L `+Q(a.x,t)+` L `+Q(i.x,t)+` Z`}}function IG(e,t={}){let n=t.x??((e,t)=>t);return BB({type:`differenceY`,data:e,options:t,channels:{x1:{value:t.x1??n,scale:`x`},x2:{value:t.x2??n,scale:`x`},y1:{value:t.y1??t.y,scale:`y`,zero:!0},y2:{value:t.y2??t.y,scale:`y`,zero:!0},...UB(t,{})},render(e,n,i,a){let o=uL(),s=qB(n.x),c=qB(n.y),l=e.filter(e=>Number.isFinite(i.x1[e])&&Number.isFinite(i.x2[e])&&Number.isFinite(i.y1[e])&&Number.isFinite(i.y2[e])),u=l.every(e=>i.x1[e]===i.x2[e]&&i.y1[e]===i.y2[e]),d=n.y(0),f=l.map(e=>({x:i.x1[e]+s,y:u?d:i.y1[e]+c})),p=l.map(e=>({x:i.x2[e]+s,y:i.y2[e]+c})),m=a.height,h=[{fill:t.positiveFill??`#3ca951`,clip:FG(p,m,t.curve),shape:FG(f,0,t.curve)},{fill:t.negativeFill??`#4269d0`,clip:FG(f,m,t.curve),shape:FG(p,0,t.curve)}];for(let e of h)if(e.clip!==``&&e.fill!==`none`){let n=`plot-difference-`+ ++PG,i=vL({id:n});i.appendChild(hL({d:e.clip})),o.appendChild(i),o.appendChild(hL({d:e.shape,fill:e.fill,fillOpacity:t.fillOpacity,clipPath:`url(#`+n+`)`}))}return t.stroke!==void 0&&t.stroke!==`none`&&o.appendChild(hL({d:tG({points:p,curve:t.curve}),fill:`none`,...GB(i,l[0])})),o}})}const LG={cumsum(e){let t=0;return e.map(e=>t+=Number(e))},rank:dR,quantile(e){let t=e.length-1;return dR(e).map(e=>t>0?e/t:0)}};function RG(e){if(typeof e==`function`)return e;if(LG[e])return LG[e];throw Error(`invalid map: `+e)}const zG={x1:`x`,x2:`x`,y1:`y`,y2:`y`};function BG(e={},t={}){let n=t.transform;return{...t,transform:pH(function(t,i){let a=n?mH(n,t,i):{data:t,channels:i},o=a.data,s=a.channels,c=typeof e==`function`?e(s):e,l=rH(o,s),u=dH(l,o.length),d={};for(let e of Object.keys(c)){let t=l[e]??l[zG[e]],n=RG(c[e]);d[e]=Array(o.length);for(let i of u){let a=n(i.map(e=>t[e]));for(let t=0;t<i.length;t++)d[e][i[t]]=a[t]}}let f=o.map((e,t)=>{let n=iH(l,t);for(let e of Object.keys(d))n[e]=d[e][t];return n}),p={};for(let e of Object.keys(c))s[e]===void 0&&(p[e]={...s[zG[e]],value:e,label:null,scale:uH[e]});return{data:f,channels:aH(s,p)}})}}function VG(e,t={}){return UG([`x`,`x1`,`x2`],e,t)}function HG(e,t={}){return UG([`y`,`y1`,`y2`],e,t)}function UG(e,t,n){return BG(function(n){let i=e.filter(e=>n[e]!==void 0&&n[e].value!==void 0),a=i.length>0?i:[e[0]],o={};for(let e of a)o[e]=t;return o},e.some(e=>n[e]!==void 0)||n.transform!==void 0?n:{...n,[e[0]]:e=>e})}const WG={sum:eR,mean:nR,median:iR,min:QL,max:$L,deviation:aR,variance:lR,mode:uR,first:e=>e[0],last:e=>e[e.length-1],difference:e=>Number(e[e.length-1])-Number(e[0]),ratio:e=>Number(e[e.length-1])/Number(e[0])};function GG(e=`mean`){if(typeof e==`function`)return e;if(/^p\d{2}$/i.test(e))return t=>rR(t,Number(e.slice(1))/100);if(WG[e])return WG[e];throw Error(`invalid reduce: `+e)}function KG(e,t,n){let i=e??{centered:`middle`,leading:`start`,trailing:`end`}[t]??`middle`;if(i===`middle`)return n-1>>1;if(i===`start`)return 0;if(i===`end`)return n-1;throw Error(`invalid anchor: `+i)}function qG(e={}){let t=typeof e==`number`?{k:e}:e,n=Math.floor(t.k??7);if(!(n>0))throw Error(`invalid k: `+t.k);let i=KG(t.anchor,t.shift,n),a=GG(t.reduce),o=t.strict===!0;return function(e){let t=Array(e.length);if(o)for(let o=0;o+n<=e.length;o++)t[o+i]=a(e.slice(o,o+n));else for(let o=-i;o<e.length-i;o++)t[o+i]=a(e.slice(Math.max(0,o),o+n));return t}}function JG(e={}){let t=e.n??20,n=e.k??0;return qG({k:t,reduce:e=>nR(e)+n*(aR(e)||0),strict:e.strict??!0,anchor:e.anchor??`end`})}function YG(e,t={}){let{n,k:i=2,strict:a,anchor:o,color:s=`currentColor`,opacity:c=.2,...l}=t,u=t.x??bz,d={n,strict:a,anchor:o},f=l.fill??s,p=l.stroke??s,m=[];return f!==`none`&&m.push(gW(e,BG({x1:JG({...d,k:-i}),x2:JG({...d,k:i})},{...l,y:t.y,x1:u,x2:u,fill:f,fillOpacity:l.fillOpacity??c,stroke:`none`}))),p!==`none`&&m.push(nG(e,BG({x:JG(d)},{...l,y:t.y,x:u,stroke:p,fill:`none`}))),m}function XG(e,t={}){let{n,k:i=2,strict:a,anchor:o,color:s=`currentColor`,opacity:c=.2,...l}=t,u=t.y??bz,d={n,strict:a,anchor:o},f=l.fill??s,p=l.stroke??s,m=[];return f!==`none`&&m.push(gW(e,BG({y1:JG({...d,k:-i}),y2:JG({...d,k:i})},{...l,x:t.x,y1:u,y2:u,fill:f,fillOpacity:l.fillOpacity??c,stroke:`none`}))),p!==`none`&&m.push(nG(e,BG({y:JG(d)},{...l,x:t.x,y:u,stroke:p,fill:`none`}))),m}function ZG(e,t={}){return BB({type:`link`,data:e,options:t,channels:{x1:{value:t.x1??t.x,scale:`x`},y1:{value:t.y1??t.y,scale:`y`},x2:{value:t.x2??t.x1??t.x,scale:`x`},y2:{value:t.y2??t.y1??t.y,scale:`y`},...UB(t,{stroke:$.stroke,fill:`none`})},render(e,n,i){let a=uL(),o=fW(t),s=new Map,c=qB(n.x),l=qB(n.y);for(let n of e){let e=[{x:i.x1[n]+c,y:i.y1[n]+l},{x:i.x2[n]+c,y:i.y2[n]+l}],u=GB(i,n);e.every(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))&&a.appendChild(hL({d:tG({points:e,curve:t.curve}),fill:`none`,...u,...mW(a,o,s,u.stroke)}))}return a}})}function QG(e){return{id:e,data:void 0,parent:null,children:[],depth:0,height:0,x:0,y:0}}function $G(e){let t=String(e),n=t.endsWith(`/`)&&t.endsWith(`\\/`)===!1?t.slice(0,-1):t;return n.startsWith(`/`)?n:`/`+n}function eK(e){let t=e.length;if(t<2)return``;for(;--t>1&&(e[t]!==`/`||e[t-1]===`\\`););return e.slice(0,t)}function tK(e){return e.slice(eK(e).length).replace(/^\//,``).replace(/\\\//g,`/`)}function nK(e,t){let n=new Map,i=e=>(n.has(e)===!1&&n.set(e,QG(e)),n.get(e));for(let a=0;a<e.length;a++){let o=$G(t(e[a],a));i(o).data=e[a];let s=o,c=eK(s);for(;c!==``;){let e=i(c),t=n.get(s);t.parent===null&&(t.parent=e,e.children.push(t)),s=c,c=eK(s)}}let a=n.get(`/`)??QG(`/`);for(;a.data===void 0&&a.children.length===1;)a=a.children[0];return a.parent=null,rK(a,e=>{e.depth=e.parent===null?0:e.parent.depth+1}),iK(a,e=>{e.height=e.children.length===0?0:1+Math.max(...e.children.map(e=>e.height))}),a}function rK(e,t){let n=[e];for(;n.length>0;){let e=n.pop();t(e);for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}}function iK(e,t){let n=[e],i=[];for(;n.length>0;){let e=n.pop();i.push(e);for(let t of e.children)n.push(t)}for(let e=i.length-1;e>=0;e--)t(i[e])}function aK(e){let t=[];return rK(e,e=>t.push(e)),t}function oK(e){return aK(e).filter(e=>e.parent!==null).map(e=>({source:e.parent,target:e}))}function sK(e,t){iK(e,e=>e.children.sort(t))}function cK(e,t){return e.parent===t.parent?1:2}function lK(e,t){return{node:e,position:t,parent:null,children:[],ancestor:null,thread:null,z:0,m:0,c:0,s:0}}function uK(e){let t=lK(e,0);t.ancestor=t;let n=[t];for(;n.length>0;){let e=n.pop();for(let t=0;t<e.node.children.length;t++){let i=lK(e.node.children[t],t);i.ancestor=i,i.parent=e,e.children.push(i),n.push(i)}}let i=lK(null,0);return i.ancestor=i,i.children=[t],t.parent=i,t}function dK(e){return e.children.length>0?e.children[0]:e.thread}function fK(e){return e.children.length>0?e.children[e.children.length-1]:e.thread}function pK(e,t,n){let i=n/(t.position-e.position);t.c-=i,t.s+=n,e.c+=i,t.z+=n,t.m+=n}function mK(e){let t=0,n=0;for(let i=e.children.length-1;i>=0;i--){let a=e.children[i];a.z+=t,a.m+=t,n+=a.c,t=t+a.s+n}}function hK(e,t,n){return e.ancestor.parent===t.parent?e.ancestor:n}function gK(e,t,n){if(t===null)return n;{let i=e,a=e,o=t,s=i.parent.children[0],c=i.m,l=a.m,u=o.m,d=s.m,f=n;for(o=fK(o),i=dK(i);o&&i;){s=dK(s),a=fK(a),a.ancestor=e;let t=o.z+u-i.z-c+cK(o.node,i.node);t>0&&(pK(hK(o,e,f),e,t),c+=t,l+=t),u+=o.m,c+=i.m,d+=s.m,l+=a.m,o=fK(o),i=dK(i)}return o&&fK(a)===null&&(a.thread=o,a.m=a.m+u-l),i&&dK(s)===null&&(s.thread=i,s.m=s.m+c-d,f=e),f}}function _K(e,t){let n=[],i=[e];for(;i.length>0;){let e=i.pop();n.push(e);for(let t of e.children)i.push(t)}for(let e=n.length-1;e>=0;e--)t(n[e])}function vK(e,t){let n=[e];for(;n.length>0;){let e=n.pop();t(e);for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}}function yK(e){let t=uK(e);return _K(t,function(e){let t=e.parent.children,n=e.position>0?t[e.position-1]:null;if(e.children.length>0){mK(e);let t=(e.children[0].z+e.children[e.children.length-1].z)/2;n?(e.z=n.z+cK(e.node,n.node),e.m=e.z-t):e.z=t}else n&&(e.z=n.z+cK(e.node,n.node));e.parent.ancestor=gK(e,n,e.parent.ancestor??t[0])}),t.parent.m=-t.z,vK(t,function(e){e.node.x=e.z+e.parent.m,e.m+=e.parent.m}),rK(e,e=>{e.y=e.depth}),e}function bK(e){let t=null,n=0;iK(e,e=>{e.children.length>0?(e.x=(e.children[0].x+e.children[e.children.length-1].x)/2,e.y=Math.max(...e.children.map(e=>e.y))+1):(n=t===null?0:n+cK(e,t),e.x=n,e.y=0,t=e)});let i=e.x,a=e.y;return rK(e,e=>{e.x-=i,e.y=a-e.y}),e}const xK={tree:yK,cluster:bK},SK={left:{dx:6,position:e=>({x:e.y,y:-e.x})},right:{dx:-6,position:e=>({x:-e.y,y:-e.x})}};function CK(e=`left`){if(SK[e])return SK[e];throw Error(`invalid tree anchor: `+e)}const wK={name:e=>tK(e.id),path:e=>e.id,depth:e=>e.depth,height:e=>e.height,internal:e=>e.children.length>0||void 0,external:e=>e.children.length>0?void 0:!0};function TK(e){if(typeof e==`string`&&(e.startsWith(`node:`)||e.startsWith(`parent:`))){let[t,n]=e.split(`:`),i=wK[n];if(i===void 0)throw Error(`invalid node value: `+e);return{side:t,read:i}}}function EK(e){if(e!=null){if(typeof e==`function`)return e;{let t=TK(e),n=t?t.read:t=>t.data?.[e];return(e,t)=>XL(n(e),n(t))}}}function DK(e,t){let n=Oz(e,t.path??bz),i=t.delimiter??`/`,a=nK(e.map((e,t)=>t),e=>i===`/`?String(n[e]):String(n[e]).split(i).join(`/`)),o=EK(t.treeSort);return o&&sK(a,(e,t)=>o(e,t)),(typeof t.treeLayout==`function`?t.treeLayout:xK[t.treeLayout??`tree`])(a),a}function OK(e={}){let t=CK(e.treeAnchor);return{...e,curve:e.curve??`bump-x`,stroke:e.stroke??`currentColor`,strokeWidth:e.strokeWidth??1.5,strokeOpacity:e.strokeOpacity??.5,transform:pH(function(n,i){let a=DK(n,e),o=rH(n,i),s={};for(let e of Object.keys(i)){let t=TK(i[e].value);t&&(s[e]=t)}let c=[];for(let{source:e,target:n}of oK(a)){let i=n.data===void 0?{}:iH(o,n.data),a=t.position(e),l=t.position(n);i.x1=a.x,i.y1=a.y,i.x2=l.x,i.y2=l.y;for(let t of Object.keys(s))i[t]=s[t].read(s[t].side===`parent`?e:n);c.push(i)}let l=aH(i,{x1:{value:`x1`,scale:`x`,label:null},y1:{value:`y1`,scale:`y`,label:null},x2:{value:`x2`,scale:`x`,label:null},y2:{value:`y2`,scale:`y`,label:null}});for(let e of Object.keys(s))l[e]={...l[e],value:e,label:null};return{data:c,channels:l}})}}function kK(e={}){let t=CK(e.treeAnchor);return{...e,dx:e.dx??t.dx,transform:pH(function(n,i){let a=DK(n,e),o=rH(n,i),s={};for(let e of Object.keys(i)){let t=TK(i[e].value);t&&(s[e]=t.read)}let c=TK(e.treeFilter),l=[];for(let e of aK(a).filter(e=>c===void 0||c.read(e))){let n=e.data===void 0?{}:iH(o,e.data),i=t.position(e);n.x=i.x,n.y=i.y;for(let t of Object.keys(s))n[t]=s[t](e);l.push(n)}let u=aH(i,{x:{value:`x`,scale:`x`,label:null},y:{value:`y`,scale:`y`,label:null}});for(let e of Object.keys(s))u[e]={...u[e],value:e,label:null};return{data:l,channels:u}})}}function AK(e,t={}){let n=t.dx??CK(t.treeAnchor).dx,i={path:t.path,delimiter:t.delimiter,treeLayout:t.treeLayout,treeAnchor:t.treeAnchor,treeSort:t.treeSort},a=(n,a,o)=>lG(e,kK({...i,text:t.text??`node:name`,fill:t.fill??`currentColor`,treeFilter:n,textAnchor:a,dx:o,dy:t.dy}));return[ZG(e,OK({...i,stroke:t.stroke,strokeWidth:t.strokeWidth,curve:t.curve})),EW(e,kK({...i,fill:t.fill??`node:internal`,r:t.r})),a(`node:external`,`start`,n),a(`node:internal`,`end`,-n)]}function jK(e,t={}){return AK(e,{treeLayout:`cluster`,...t})}function MK(e){let t=!1;if(e){for(let n of e)if(n!=null){let e=typeof n;t=e===`string`||e===`boolean`;break}}return t}function NK(e){let t=!1;if(e){for(let n of e)if(n!=null){t=typeof n==`number`;break}}return t}function PK(e){let t=!0;if(e){let n,i;for(let a of e)if(a!=null){if(n===void 0)n=a;else{let e=Math.sign(XL(n,a));if(e){if(i!==void 0&&e!==i){t=!1;break}n=a,i=e}}}}return t}function FK(e){let t=!1;return e&&(t=new Set(e).size>e.length>>1),t}function IK(e){return e?.toString===Object.prototype.toString}function LK(e){return IK(e)&&typeof e.transform!=`function`}function RK(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function zK(e){return/^(?:first|last|mode)$/i.test(e)}function BK(e){return e==null||typeof e==`function`?!1:IK(e)&&typeof e.reduce==`function`||/^p\d{2}$/i.test(e)?!0:`${e}`.toLowerCase()in CH}function VK(e){return BK(e)?{reduce:e}:{value:e}}function HK(e={}){let{x:t,y:n,color:i,size:a,fx:o,fy:s,mark:c}=e;return LK(t)===!1&&(t=VK(t)),LK(n)===!1&&(n=VK(n)),LK(i)===!1&&(i=typeof i==`string`&&pz(i)?{color:i}:VK(i)),LK(a)===!1&&(a=VK(a)),LK(o)&&(o=o.value),LK(s)&&(s=s.value),c!=null&&(c=`${c}`.toLowerCase()),{x:t,y:n,color:i,size:a,fx:o,fy:s,mark:c}}function UK(e,t){let n;return t.value!==null&&t.value!==void 0&&(n=Oz(e,t.value),n.label=kz(t.value)),n}function WK(e){let{sizeValue:t,sizeReduce:n,xValue:i,yValue:a,xReduce:o,yReduce:s,colorReduce:c,X:l,Y:u}=e;if(t!==null||n!==null)return`dot`;if(RK(o)||RK(s)||c!==null)return`bar`;if(i!==null&&a!==null){let e=MK(l)||MK(u),t=o===null&&s===null&&PK(l)===!1&&PK(u)===!1;return e||t?`dot`:`line`}return`rule`}function GK(e){let{X:t,Y:n,xZero:i,yZero:a,xReduce:o,yReduce:s}=e;return t&&n||o!==null||s!==null?a||s!==null||t&&PK(t)?`lineY`:i||o!==null||n&&PK(n)?`lineX`:`line`:t?`lineX`:`lineY`}function KK(e){let{X:t,Y:n,xReduce:i,yReduce:a,colorReduce:o,sizeReduce:s}=e;return i===null?a===null?o!==null||s!==null?t&&MK(t)&&n&&MK(n)?`cell`:t&&MK(t)?`barY`:n&&MK(n)?`barX`:`rect`:t&&NK(t)&&(n&&NK(n))===!1?`barX`:n&&NK(n)&&(t&&NK(t))===!1?`barY`:`cell`:MK(t)?zK(a)&&n&&MK(n)?`cell`:`barY`:`rectY`:MK(n)?zK(i)&&t&&MK(t)?`cell`:`barX`:`rectX`}function qK(e){let{X:t,Y:n,xReduce:i,yReduce:a,colorReduce:o,sizeReduce:s}=e;if(a!==null)return MK(t)?`groupX`:`binX`;if(i!==null)return MK(n)?`groupY`:`binY`;if(o!==null||s!==null)return t&&n?MK(t)&&MK(n)?`group`:MK(t)?`binY`:MK(n)?`binX`:`bin`:t?MK(t)?`groupX`:`binX`:n?MK(n)?`groupY`:`binY`:void 0}const JK=new Set([`barX`,`areaX`,`rectX`,`ruleY`]),YK=new Set([`barY`,`areaY`,`rectY`,`ruleX`]);function XK(e,t){let n=HK(t),i=UK(e,n.x),a=UK(e,n.y),o=UK(e,n.color),s=UK(e,n.size),{fx:c,fy:l}=n,{value:u=null,reduce:d,zero:f,...p}=n.x,{value:m=null,reduce:h,zero:g,..._}=n.y,{value:v=null,color:y,reduce:b}=n.color,{value:x=null,reduce:S}=n.size,C=b??null,w=d??null;d===void 0&&(w=(h??null)===null&&u===null&&x===null&&m!==null?`count`:null);let T=h??null;h===void 0&&(T=w===null&&m===null&&x===null&&u!==null?`count`:null);let E=S??null;if(S===void 0){let e=x===null&&C===null&&w===null&&T===null,t=(u===null||MK(i))&&(m===null||MK(a));E=e&&t?`count`:null}let D=f;f===void 0&&RK(w)&&(D=!0);let O=g;if(g===void 0&&RK(T)&&(O=!0),u===null&&m===null)throw Error(`must specify x or y`);if(w!==null&&m===null)throw Error(`reducing x requires y`);if(T!==null&&u===null)throw Error(`reducing y requires x`);if(w!==null&&T!==null)throw Error(`cannot reduce both x and y`);let ee={X:i,Y:a,C:o,S:s,xValue:u,yValue:m,sizeValue:x,xReduce:w,yReduce:T,colorReduce:C,sizeReduce:E,xZero:D,yZero:O},te=n.mark??WK(ee),k,ne,re=!1;if(te===`dot`)k=`dot`,ne=`stroke`;else if(te===`line`)k=GK(ee),ne=`stroke`,re=FK(o);else if(te===`area`)k=(O||T!==null)===!1&&(D||w!==null||a&&PK(a))?`areaX`:`areaY`,ne=`fill`,re=FK(o);else if(te===`rule`)k=i?`ruleX`:`ruleY`,ne=`stroke`;else if(te===`bar`)k=KK(ee),ne=`fill`;else throw Error(`invalid mark: ${te}`);let ie=qK(ee),A=ie===`bin`||ie===`binX`,ae=ie===`bin`||ie===`binY`,oe={fx:c,fy:l,x:i??void 0,y:a??void 0,[ne]:o??y,z:re?null:void 0,r:s??void 0,tip:!0,...A?p:{},...ae?_:{}},se={[ne]:C??void 0,r:E??void 0};return T!==null&&(se.y=T),w!==null&&(se.x=w),D===void 0&&(D=!!i&&A===!1&&JK.has(k)),O===void 0&&(O=!!a&&ae===!1&&YK.has(k)),{fx:c??null,fy:l??null,x:{value:u,reduce:w,zero:!!D,...p},y:{value:m,reduce:T,zero:!!O,..._},color:{value:v,reduce:C,...y===void 0?{}:{color:y}},size:{value:x,reduce:E},mark:te,markImpl:k,markOptions:oe,transformImpl:ie,transformOptions:se,colorMode:ne}}function ZK(e,t){if(Number.isFinite(t)===!1)return-1;let n=-1;for(;n+1<e.length-1&&t>=e[n+1];)n+=1;return Math.max(0,n)}function QK(e,t){let[n,i]=ZL(e),a=LL(n??0,i??1,t??cR(e));return(a.length===0||a[0]>n)&&a.unshift(n??0),a[a.length-1]<i&&a.push(i??1),a}function $K(e,t,n){let{filter:i,...a}=t,o=`filter`in t&&i===null;return{...n,transform:pH(function(t,i){let s={},c={};for(let i of e)c[i]=Oz(t,n[i]),s[i]=QK(c[i],n.thresholds);let l=e.map(e=>s[e].length-1),u=e=>e.reduce((e,t,n)=>e*l[n]+t,0),d=t=>{let n=Array(e.length),i=t;for(let t=e.length-1;t>=0;t--)n[t]=i%l[t],i=Math.floor(i/l[t]);return n},f=l.reduce((e,t)=>e*t,1),p={};for(let e of Object.keys(a)){let n=TH(a[e])??i[e]?.value;p[e]=n===void 0?void 0:Oz(t,n)}let m=[`fill`,`stroke`,`fx`,`fy`,`z`].filter(e=>{let t=i[e];return t!==void 0&&t.value!==void 0&&a[e]===void 0}),h={};for(let e of m)h[e]=Oz(t,i[e].value);let g=new Map,_=new Set;for(let n=0;n<t.length;n++){let t=e.map(e=>ZK(s[e],c[e][n]));if(t.every(e=>e>=0)){let e=m.map(e=>String(h[e][n])).join(` `);_.add(e);let i=e+` `+t.join(`,`);g.has(i)?g.get(i).members.push(n):g.set(i,{slots:t,seriesName:e,first:n,members:[n]})}}function v(t,n,i){return s[n][t.slots[e.indexOf(n)]+i-1]}let y={};for(let t of e)y[t]=e=>(v(e,t,1)+v(e,t,2))/2,y[t+`1`]=e=>v(e,t,1),y[t+`2`]=e=>v(e,t,2);function b(e){let t=[...g.values()].filter(t=>t.seriesName===e);if(o){let n=new Map(t.map(e=>[u(e.slots),e])),i=[];for(let a=0;a<f;a++)i.push(n.get(a)??{slots:d(a),seriesName:e,first:t[0]?.first??0,members:[]});return i}return t.sort((e,t)=>u(e.slots)-u(t.slots))}let x=[];for(let n of _)for(let i of b(n)){let n={};for(let t of e)n[t+`1`]=v(i,t,1),n[t+`2`]=v(i,t,2),n[t]=(n[t+`1`]+n[t+`2`])/2;for(let e of m)n[e]=h[e][i.first];for(let e of Object.keys(a)){let o=y[a[e]];if(o)n[e]=o(i);else{let o=p[e]===void 0?i.members:i.members.map(t=>p[e][t]);n[e]=wH(a[e],o,i.members.map(e=>t[e]),p[e]===void 0)}}x.push(n)}for(let e of Object.keys(a))if(DH(a[e])){let t=x.map(t=>t[e]);kH({[e]:t},e,OH(a[e]),x.map(e=>e.fx),x.map(e=>e.fy)),x.forEach((n,i)=>{n[e]=t[i]})}let S={};for(let t of e){let e=typeof n[t]==`string`?n[t]:void 0;S[t+`1`]={value:e=>e[t+`1`],scale:t,nice:!1,label:e},S[t+`2`]={value:e=>e[t+`2`],scale:t,nice:!1},S[t]={value:e=>e[t],scale:t,nice:!1,label:e}}for(let e of m)S[e]={...i[e],value:t=>t[e]};for(let t of Object.keys(a)){let n=y[a[t]]!==void 0,i=t.replace(/[12]$/,``),o=(i===`x`||i===`y`)&&e.includes(i)===!1;S[t]={value:e=>e[t],scale:o?i:uH[t]??`color`,zero:o&&!n,label:n?void 0:EH(t,a[t])}}for(let e of Object.keys(i))S[e]===void 0&&i[e].constant!==void 0&&(S[e]=i[e]);return{data:x,channels:S}})}}function eq(e,t,n){let i=e.inset??e[t]??e[n];return{[t]:i??.5,[n]:i??.5}}function tq(e={fill:`count`},t={}){let n=Sz(t);return{...$K([`x`,`y`],e,n),...eq(n,`insetLeft`,`insetRight`),...eq(n,`insetTop`,`insetBottom`)}}function nq(e={y:`count`},t={}){let n={...t,x:t.x??bz},i=e.y1!==void 0||e.y2!==void 0;return{...$K([`x`],e,n),...eq(n,`insetLeft`,`insetRight`),stacked:n.stacked===!0||i}}function rq(e={x:`count`},t={}){let n={...t,y:t.y??bz},i=e.x1!==void 0||e.x2!==void 0;return{...$K([`y`],e,n),...eq(n,`insetTop`,`insetBottom`),stacked:n.stacked===!0||i}}function iq(e){if(typeof e==`string`)return e}function aq(e,t){return t.flatMap(t=>e[t]===void 0?[t+`1`,t+`2`].filter(t=>e[t]!==void 0):[t])}function oq(e,t,n){let i=new Set([...t,`fill`,`stroke`,`fx`,`fy`,`z`]);return Object.keys(e).filter(t=>{let a=Object.prototype.hasOwnProperty.call(n,t);return i.has(t)&&!a&&e[t].value!==void 0})}function sq(e,t,n){let i=[`x1`,`x2`,`y1`,`y2`].some(e=>t[e]!==void 0);return{...n,stacked:n.stacked===!0||i,transform:pH(function(n,i){let a=aq(i,e),o=oq(i,a,t),s={};for(let e of Object.keys(i))i[e].value!==void 0&&(s[e]=Oz(n,i[e].value));let c={};for(let e of Object.keys(t)){let i=TH(t[e]);c[e]=i===void 0?s[e]:Oz(n,i)}let l=new Map;for(let e=0;e<n.length;e++){let t=o.map(t=>String(s[t][e])).join(` `);l.has(t)?l.get(t).push(e):l.set(t,[e])}let u=[],d={};for(let e of[...o,...Object.keys(t)])d[e]=[];for(let e of l.values()){u.push(e.map(e=>n[e]));for(let t of o)d[t].push(s[t][e[0]]);for(let i of Object.keys(t)){let a=c[i]===void 0?e:e.map(e=>c[i][e]);d[i].push(wH(t[i],a,e.map(e=>n[e]),c[i]===void 0))}}for(let e of Object.keys(t))DH(t[e])&&kH(d,e,OH(t[e]),d.fx,d.fy);let f=o.filter(e=>a.includes(e)===!1);if(f.length>0){let e=e=>f.map(t=>String(d[t][e])).join(` `),t=u.map((e,t)=>t);t.sort((t,n)=>e(t)<e(n)?-1:+(e(t)>e(n)));let n=t.map(e=>u[e]);u.length=0,u.push(...n);for(let e of Object.keys(d))d[e]=t.map(t=>d[e][t])}let p={};for(let e of o)p[e]=sH(d[e],{...i[e],label:i[e].label??iq(i[e].value)??null});for(let e of Object.keys(t)){let{constant:n,...a}=i[e]??{};p[e]=sH(d[e],{...a,scale:a.scale??uH[e],zero:a.zero??(e===`y`||e===`x`),label:EH(e,t[e])})}for(let e of Object.keys(i))p[e]===void 0&&i[e].constant!==void 0&&(p[e]=i[e]);return{data:u,channels:p}})}}function cq(e={fill:`count`},t={}){return sq([`x`,`y`],e,Sz(t))}function lq(e={y:`count`},t={}){return sq([`x`],e,{...t,x:t.x??bz})}function uq(e={x:`count`},t={}){return sq([`y`],e,{...t,y:t.y??bz})}function dq(e,t={}){let n=bW(t);return BB({type:`barX`,data:e,options:n,channels:{x:{value:n.x,scale:`x`,zero:!0},y:{value:n.y,scale:`y`,type:`band`},x1:{value:n.x1,scale:`x`,zero:!0},x2:{value:n.x2,scale:`x`,zero:!0},...UB(n,{fill:$.fill})},render(e,t,i,a){let o=uL(),s=t.y===void 0?a.height:t.y.bandwidth?t.y.bandwidth():10,c=t.x(0),l=n.insetLeft??n.inset??0,u=n.insetRight??n.inset??0,d=n.insetTop??n.inset??0,f=n.insetBottom??n.inset??0;for(let t of e){let e=i.x2?i.x2[t]:i.x[t],a=i.x1?i.x1[t]:c,p=Math.min(e,a),m=Math.max(e,a);o.appendChild(dL({x:p+l,y:(i.y?i.y[t]:0)+d,width:Math.max(0,m-p-l-u),height:Math.max(0,s-d-f),rx:n.rx,ry:n.ry,...GB(i,t)}))}return o}})}function fq(e,t={}){let n=xW(t);return BB({type:`barY`,data:e,options:n,channels:{x:{value:n.x,scale:`x`,type:`band`},y:{value:n.y,scale:`y`,zero:!0},y1:{value:n.y1,scale:`y`,zero:!0},y2:{value:n.y2,scale:`y`,zero:!0},...UB(n,{fill:$.fill})},render(e,t,i,a){let o=uL(),s=t.x===void 0?a.width:t.x.bandwidth?t.x.bandwidth():10,c=t.y(0),l=n.insetLeft??n.inset??0,u=n.insetRight??n.inset??0,d=n.insetTop??n.inset??0,f=n.insetBottom??n.inset??0;for(let t of e){let e=i.y2?i.y2[t]:i.y[t],a=i.y1?i.y1[t]:c,p=Math.min(e,a),m=Math.max(e,a);o.appendChild(dL({x:(i.x?i.x[t]:0)+l,y:p+d,width:Math.max(0,s-l-u),height:Math.max(0,m-p-d-f),rx:n.rx,ry:n.ry,...GB(i,t)}))}return o}})}function pq(e,t,n){let i=new Map;for(let a=0;a<t;a++){let t=lH(e,a,n);i.has(t)?i.get(t).push(a):i.set(t,[a])}return[...i.values()]}function mq(e){let t=0;for(let n of e)t+=n;return t}function hq(e,t){let n=0,i=0;for(let a of e)n=Math.min(n,t[a]),i=Math.max(i,t[a]);return[n,i]}function gq(e,t,n){for(let i of e){let[e,a]=hq(i,n),o=1/(a-e||1);for(let a of i)t[a]=o*(t[a]-e),n[a]=o*(n[a]-e)}}function _q(e,t,n){let i=1/0;for(let n of e)for(let e of n)i=Math.min(i,t[e]);for(let a of e)for(let e of a)t[e]=t[e]-i,n[e]=n[e]-i}function vq(e,t,n){for(let i of e){let[e,a]=hq(i,n),o=(e+a)/2;for(let e of i)t[e]=t[e]-o,n[e]=n[e]-o}_q(e,t,n)}function yq(e,t,n,i){let a=new Map,o=0;for(let s of e){let e=s.map(e=>Math.abs(n[e]-t[e])),c=s.map((e,o)=>{let s=i?i[e]:o,c=n[e]-t[e],l=a.has(s)?c-a.get(s):0;return a.set(s,c),l});for(let e of s)t[e]=t[e]+o,n[e]=n[e]+o;let l=mq(e);if(l!==0){let t=0,n=0;for(let i=0;i<e.length;i++)n+=(c[i]/2+t)*e[i],t+=c[i];o-=n/l}}_q(e,t,n)}const bq={expand:gq,normalize:gq,center:vq,silhouette:vq,wiggle:yq};function xq(e,t,n,i,a){if(e!=null){if(typeof e==`function`)return e([t],n,i,a);{let o=bq[String(e).toLowerCase()];if(o)return o(t,n,i,a);throw Error(`unknown offset: ${e}`)}}}function Sq(e,t,n){let i=new Map,a=new Map;e.forEach((e,o)=>{for(let s of e){let e=n[s],c=Number(t[s]);a.set(e,(a.get(e)??0)+c),(i.has(e)===!1||c>i.get(e).value)&&i.set(e,{value:c,position:o})}});let o=(e,t)=>e<t?-1:+(e>t),s=[...a.keys()].sort((e,t)=>i.get(e).position-i.get(t).position||o(e,t)),c=[],l=[],u=0;for(let e of s)u<0?(u+=a.get(e),c.push(e)):(u-=a.get(e),l.push(e));return new Map(l.reverse().concat(c).map((e,t)=>[e,t]))}function Cq(e){let t=[...e].sort((e,t)=>kq(e[1],t[1])).map(([e])=>e);return e=>n=>t.indexOf(e[n])}function wq(e,t,n){let i=new Map;for(let a of e)for(let e of a)i.set(n[e],(i.get(n[e])??0)+Number(t[e]));return i}function Tq(e,t,n,i){let a=new Map;return e.forEach((e,o)=>{for(let s of e){let e=a.get(n[s]),c=i?i[s]:o;(e===void 0||Number(t[s])>e.value)&&a.set(n[s],{value:Number(t[s]),at:c})}}),new Map([...a].map(([e,t])=>[e,t.at]))}function Eq(e,t,n,i,a,o,s){let c=typeof e==`string`?e.replace(/^-/,``).toLowerCase():e;if(Array.isArray(e)&&a)return t=>e.indexOf(a[t]);if(c===`value`||c===t)return e=>Number(i[e]);if(c===`z`&&a){let e=[...new Set(a)].sort();return t=>e.indexOf(a[t])}if(c===`sum`&&a)return Cq(wq(n,i,a))(a);if(c===`appearance`&&a)return Cq(Tq(n,i,a,s))(a);if(c===`inside-out`&&a){let e=Sq(n,i,a);return t=>e.get(a[t])}if(typeof e==`function`)return t=>e(o[t]);if(typeof e==`string`)return t=>o[t]?.[e]}function Dq(e){let{offset:t,order:n,reverse:i,...a}=e;return[{offset:t,order:n,reverse:i},a]}function Oq(e,t,n,i,a,o,s){let c=e.offset!==void 0&&e.offset!==null&&String(e.offset).toLowerCase()===`wiggle`,l=e.order??(c?`inside-out`:void 0),u=typeof l==`string`&&l.startsWith(`-`),d=l==null?void 0:Eq(l,t,n,i,a,o,s);if(d)for(let e of n)e.sort((e,t)=>u?kq(d(t),d(e)):kq(d(e),d(t)));if(e.reverse===!0)for(let e of n)e.reverse()}function kq(e,t){return e<t?-1:+(e>t)}function Aq(e){return typeof e==`string`?pz(e)===!1:typeof e==`function`}function jq(e){let t=Aq(e.fill)||Aq(e.stroke)||e.z!==void 0,n=e.x1!==void 0||e.x2!==void 0;return t&&n===!1&&e.stacked!==!0?Mq(e):e}function Mq(e={},t){let[n,i]=t===void 0?Dq(e):[e,t],a=i.transform;return{...i,stacked:!0,transform:pH(function(e,t){let i=a?mH(a,e,t):{data:e,channels:t},o=i.data,s=i.channels,c=rH(o,s),l=s.x?.label??kz(s.x?.value),u=c.z??c.fill??c.stroke,d=c.x??c.x2,f=pq(c,o.length,c.y?`y`:`y1`),p=c.y??c.y1;Oq(n,`x`,f,d,u,o,p);let m=Array(o.length).fill(0),h=Array(o.length).fill(0);for(let e of f){let t=0,n=0;for(let i of e){let e=Number(d[i]);e<0?(m[i]=t,t+=e,h[i]=t):(m[i]=n,n+=e,h[i]=n)}}xq(n.offset,f,m,h,u);let g=m.map((e,t)=>(e+h[t])/2);return{data:o,channels:oH(s,c,{x1:sH(m,{scale:`x`,zero:!0,label:l}),x2:sH(h,{scale:`x`,zero:!0,label:l}),x:sH(g,{scale:`x`,zero:!0,label:l})})}})}}function Nq(e){return typeof e==`string`?pz(e)===!1:typeof e==`function`}function Pq(e){let t=Nq(e.fill)||Nq(e.stroke)||e.z!==void 0,n=e.y1!==void 0||e.y2!==void 0;return t&&n===!1&&e.stacked!==!0?Fq(e):e}function Fq(e={},t){let[n,i]=t===void 0?Dq(e):[e,t],a=i.transform;return{...i,stacked:!0,transform:pH(function(e,t){let i=a?mH(a,e,t):{data:e,channels:t},o=i.data,s=i.channels,c=rH(o,s),l=s.y?.label??kz(s.y?.value),u=c.z??c.fill??c.stroke,d=c.y??c.y2,f=pq(c,o.length,c.x?`x`:`x1`),p=c.x??c.x1;Oq(n,`y`,f,d,u,o,p);let m=Array(o.length).fill(0),h=Array(o.length).fill(0);for(let e of f){let t=0,n=0;for(let i of e){let e=Number(d[i]);e<0?(m[i]=t,t+=e,h[i]=t):(m[i]=n,n+=e,h[i]=n)}}xq(n.offset,f,m,h,u);let g=m.map((e,t)=>(e+h[t])/2);return{data:o,channels:oH(s,c,{y1:sH(m,{scale:`y`,zero:!0,label:l}),y2:sH(h,{scale:`y`,zero:!0,label:l}),y:sH(g,{scale:`y`,zero:!0,label:l})})}})}}const Iq=(e,t)=>t;function Lq(e){let t=e.x!==void 0||e.x1!==void 0||e.x2!==void 0,n=e.y!==void 0||e.y1!==void 0||e.y2!==void 0;return t?e:n?{...e,x:Iq}:{...e,x:Iq,y:bz}}function Rq(e){let t=e.x!==void 0||e.x1!==void 0||e.x2!==void 0;return e.y!==void 0||e.y1!==void 0||e.y2!==void 0?e:t?{...e,y:Iq}:{...e,x:bz,y:Iq}}function zq(e){return e.x1===void 0&&e.x2===void 0?{...e,x1:0,x2:e.x}:e}const Bq=(e,t)=>(n,i={})=>e(n,Pq(Lq(t(i)))),Vq=Bq(gW,bW),Hq=Bq(iG,bW),Uq=Bq(fq,xW),Wq=(e,t={})=>nG(e,Lq(t)),Gq=(e,t={})=>nG(e,Rq(t)),Kq=(e,t={})=>gW(e,zq(jq(Rq(xW(t))))),qq=(e,t={})=>iG(e,zq(jq(Rq(xW(t))))),Jq=(e,t={})=>dq(e,jq(bW(t))),Yq={dot:EW,line:nG,lineX:Gq,lineY:Wq,areaX:Kq,areaY:Vq,ruleX:aG,ruleY:oG,barX:Jq,barY:Uq,rect:iG,rectX:qq,rectY:Hq,cell:CW,bin:tq,binX:nq,binY:rq,group:cq,groupX:lq,groupY:uq};function Xq(e,t){let n=XK(e,t),i=Yq[n.markImpl],a=Yq[n.transformImpl],o=n.fx!==null||n.fy!==null?kW({strokeOpacity:.1}):null,s=[n.x.zero?aG([0]):null,n.y.zero?oG([0]):null],c=n.markOptions;a&&(c=a(n.transformOptions,n.markOptions));let l=i(e,c);return n.colorMode===`stroke`?[o,s,l]:[o,l,s]}const Zq=[`x`,`y`,`fx`,`fy`,`color`,`r`,`opacity`,`symbol`,`length`];function Qq(e={}){let t=Zq.find(t=>e[t]!==void 0);if(t===void 0)throw Error(`invalid scale definition; no scale found`);{let n=fB({name:t,channels:[],config:e[t]}),i={type:n.type,domain:n.domain,range:n.range,label:n.label,apply:e=>n(e)};return n.invert&&(i.invert=e=>n.invert(e)),n.bandwidth&&(i.bandwidth=n.bandwidth(),i.step=n.step()),i}}const $q=[`symbol`,`color`,`opacity`];function eJ(e){return typeof e==`object`&&!!e&&Array.isArray(e)===!1}function tJ(e,t){return fB({name:e,channels:[],config:t[e]})}function nJ(e={}){let t=$q.find(t=>eJ(e[t]));if(t===void 0)throw Error(`unknown legend type; no scale found`);{let{symbol:n,color:i,opacity:a,...o}=e,s={...o,...e[t]},c=t===`symbol`&&eJ(e.color)?tJ(`color`,e):void 0;return wB(tJ(t,e),s,c)}}function rJ(e,t,n={}){let{x:i,y:a,maxRadius:o,...s}=n,c=e({px:i,py:a,maxRadius:o}),l={strokeOpacity:n.strokeOpacity??.2},u=[];return i!==void 0&&u.push(aG(t,{...s,...c,...l,x:i})),a!==void 0&&u.push(oG(t,{...s,...c,...l,y:a})),i!==void 0&&u.push(lG(t,{...s,...c,x:i,text:i,frameAnchor:`bottom`,dy:9,fill:$.axisStroke})),a!==void 0&&u.push(lG(t,{...s,...c,y:a,text:a,frameAnchor:`left`,dx:-9,textAnchor:`end`,fill:$.axisStroke})),u}function iJ(e,t={}){return rJ(TL,e,t)}function aJ(e,t={}){return rJ(EL,e,t)}function oJ(e,t={}){return rJ(DL,e,t)}function sJ(e,t,n,i,a){if(n.bandwidth){let o=n.bandwidth();e[t]=n.domain.filter(e=>i<n(e)+o&&n(e)<a)}else if(n.invert){let o=[n.invert(i),n.invert(a)].sort(XL);e[t+`1`]=o[0],e[t+`2`]=o[1]}}function cJ(e,t,n,i,a,o){return a&&n.x&&sJ(e,`x`,n.x,t.x1,t.x2),o&&n.y&&sJ(e,`y`,n.y,t.y1,t.y2),i.fx!==void 0&&(e.fx=i.fx),i.fy!==void 0&&(e.fy=i.fy),e}function lJ(e,t){if(t){let n={...e.values};for(let i of Object.keys(t))n[i]=Array(e.length).fill(t[i]);return n}return e.values}function uJ(e,t,n,i,a,o){let s=n.mark.render(a,t.scales,lJ(n,o),i.dimensions,n);s&&e.appendChild(s)}function dJ(e,t,n,i,a,o){let s;if(i){let c=n.index.filter(e=>i.has(t.data[e])),l=n.index.filter(e=>i.has(t.data[e])===!1);s=uL(),uJ(s,e,t,n,l,o),uJ(s,e,t,n,c,a)}else s=t.mark.render(n.index,e.scales,t.values,n.dimensions,t);if(s){let e=rV(t,s);n.$node.replaceWith(e),n.$node=e}}function fJ(e,t,n){let{selected:i,unselected:a}=t.mark.options;if(i||a){let o=n&&new Set(n.map(e=>t.data[e]));for(let n of e.states)if(n!==t&&n.data===t.data)for(let t of n.nodes)dJ(e,n,t,o,i,a)}}function pJ(e,t,n,i={}){return BB({type:`brush`,data:n,options:i,layer:4,channels:{x:{value:i.x,scale:`x`},y:{value:i.y,scale:`y`}},render(n,a,o,s,c){let l=uL(),u=dL({x:0,y:0,width:0,height:0,fill:`currentColor`,fillOpacity:.1,stroke:`currentColor`,strokeOpacity:.3,pointerEvents:`none`}),d=dL({x:0,y:0,width:s.width,height:s.height,fill:`none`,pointerEvents:`all`,cursor:`crosshair`});return l.appendChild(d),l.appendChild(u),QI&&hJ({$surface:d,$selection:u,index:n,scales:a,values:o,state:c,dimensions:s,horizontal:e,vertical:t,options:i}),l}})}function mJ(e,t,n,i,a){if(e[n+`1`]&&e[n+`2`]){let i=e[n+`1`][t],a=e[n+`2`][t];return[Math.min(i,a),Math.max(i,a)]}if(e[n]){let a=e[n][t];return i&&i.bandwidth?[a,a+i.bandwidth()]:[a,a]}return[a,a]}function hJ(e){let{$surface:t,$selection:n,index:i,scales:a,values:o,state:s,dimensions:c,horizontal:l,vertical:u,options:d}=e,f=s.chart,p={originX:c.marginLeft+c.cell.x,originY:c.marginTop+c.cell.y},m;function h(e){return AL(e,t.ownerSVGElement,p)}function g(e,t){return{x1:l?Math.min(e[0],t[0]):0,x2:l?Math.max(e[0],t[0]):c.width,y1:u?Math.min(e[1],t[1]):0,y2:u?Math.max(e[1],t[1]):c.height}}function _(e){n.setAttribute(`x`,e.x1),n.setAttribute(`y`,e.y1),n.setAttribute(`width`,e.x2-e.x1),n.setAttribute(`height`,e.y2-e.y1)}function v(e){let t=[];for(let n of i){let[i,s]=mJ(o,n,`x`,a.x,c.width/2),[l,u]=mJ(o,n,`y`,a.y,c.height/2);s>=e.x1&&i<=e.x2&&u>=e.y1&&l<=e.y2&&t.push(n)}return t}function y(e,t,n){let i=null;t.length>0&&(i=t.map(e=>s.data[e]),cJ(i,e,a,c.cell,l,u),i.done=n),f.selection=i===null?void 0:{data:s.data,index:t},fJ(f,s,i===null?void 0:t),f.publishValue(i),d.onbrush&&d.onbrush(e,i??[])}t.addEventListener(`pointerdown`,e=>{m=h(e),t.setPointerCapture&&t.setPointerCapture(e.pointerId),_(g(m,m))}),t.addEventListener(`pointermove`,e=>{if(m){let t=g(m,h(e));_(t),y(t,v(t),!1)}}),t.addEventListener(`pointerup`,e=>{if(m){let t=g(m,h(e)),n=t.x2-t.x1<1&&t.y2-t.y1<1;m=void 0,n?(_({x1:0,y1:0,x2:0,y2:0}),y(void 0,[],!0)):y(t,v(t),!0)}})}function gJ(e,t={}){return pJ(!0,!0,e,t)}function _J(e,t={}){return pJ(!0,!1,e,t)}function vJ(e,t={}){return pJ(!1,!0,e,t)}const yJ=Math.PI/180;function bJ(e=1){let t=(e,t)=>e<t?-1:+(e>t);if(typeof e==`number`)return()=>Math.sign(e);if(typeof e==`function`)return(t,n,i,a)=>Math.sign(e(t,n,i,a));if(e===`+x`)return(e,n,i)=>t(e,i);if(e===`-x`)return(e,n,i)=>t(i,e);if(e===`+y`)return(e,n,i,a)=>t(n,a);if(e===`-y`)return(e,n,i,a)=>t(a,n);throw Error(`unknown sweep: ${e}`)}function xJ(e,t={}){let n=t.bend===!0?22.5:Math.max(-90,Math.min(90,t.bend??0)),i=t.headAngle??60,a=t.headLength??8,o=bJ(t.sweep),s=i/2*yJ,c=a/1.5;return BB({type:`arrow`,data:e,options:t,channels:{x:{value:t.x,scale:`x`},y:{value:t.y,scale:`y`},x1:{value:t.x1??t.x,scale:`x`},y1:{value:t.y1??t.y,scale:`y`},x2:{value:t.x2??t.x,scale:`x`},y2:{value:t.y2??t.y,scale:`y`},...UB(t,{stroke:$.stroke,strokeWidth:$.strokeWidth})},render(e,t,i,a){let l=uL(),u=qB(t.x),d=qB(t.y),f=i.x1??i.x,p=i.x2??i.x,m=i.y1??i.y,h=i.y2??i.y;for(let t of e){let e=f[t]+u,a=m[t]+d,g=p[t]+u,_=h[t]+d,v=Math.hypot(g-e,_-a);if(v>0){let u=i.strokeWidth?i.strokeWidth[t]:$.strokeWidth,d=Math.min(c*u,v/3),f=o(e,a,g,_)*n*yJ,p=Math.hypot(v/Math.tan(f),v)/2,m=Math.atan2(_-a,g-e)+f,h=e=>Q(g-d*Math.cos(m+e),_-d*Math.sin(m+e)),y=p<1e5?`A${XI(p)},${XI(p)} 0,0,${+(f>0)} `:`L`,b=d>0?`M${h(s)}L${Q(g,_)}L${h(-s)}`:``;l.appendChild(hL({d:`M${Q(e,a)}${y}${Q(g,_)}${b}`,strokeLinejoin:`round`,strokeLinecap:`round`,...GB(i,t)}))}}return l}})}function SJ(e,t={}){return BB({type:`boxX`,data:e,options:t,channels:{x:{value:t.x??bz,scale:`x`,zero:!0},y:{value:t.y,scale:`y`,type:`band`},...UB(t,{fill:$.boxFill,stroke:$.stroke})},render(e,n,i,a,o){let s=uL(),c=n.y&&n.y.bandwidth?n.y.bandwidth():a.height,l=c*$.boxWidth,u=(c-l)/2,d=new Map;for(let t of e){let e=i.y?i.y[t]:0;d.has(e)?d.get(e).push(t):d.set(e,[t])}for(let[e,t]of d)f(s,e,t);return s;function f(e,a,s){let d=s.map(e=>o.raw.x[e]),f=rR(d,.25),p=rR(d,.5),m=rR(d,.75),h=m-f,g=d.filter(e=>e>=f-h*1.5&&e<=m+h*1.5),_=a+c/2,v=GB(i,s[0]);e.appendChild(fL({y1:_,y2:_,x1:n.x(QL(g)),x2:n.x($L(g)),stroke:v.stroke,strokeOpacity:v.strokeOpacity,opacity:v.opacity})),e.appendChild(dL({x:n.x(f),y:a+u,width:Math.abs(n.x(m)-n.x(f)),height:l,fill:v.fill,fillOpacity:v.fillOpacity,opacity:v.opacity})),e.appendChild(fL({y1:a+u,y2:a+u+l,x1:n.x(p),x2:n.x(p),stroke:v.stroke,strokeOpacity:v.strokeOpacity,opacity:v.opacity,strokeWidth:$.medianStrokeWidth}));for(let i of d)g.includes(i)===!1&&e.appendChild(mL({cx:n.x(i),cy:_,r:t.r??$.dotRadius,fill:`none`,stroke:v.stroke,strokeOpacity:v.strokeOpacity,opacity:v.opacity}))}}})}function CJ(e={},t={}){return sq([],e,t)}function wJ(e){return function(t,n){let i=n.findIndex(e);if(!(i<0))return t[i]}}function TJ(e,t,n){let i=e.transform;return{...e,transform:pH(function(e,a){let o=i(e,a);return o.channels[t]={...o.channels[n]},o})}}function EJ(e={}){return TJ(Mq(e),`x`,`x1`)}function DJ(e={}){return TJ(Mq(e),`x`,`x2`)}function OJ(e={}){return TJ(Fq(e),`y`,`y1`)}function kJ(e={}){return TJ(Fq(e),`y`,`y2`)}function AJ(e,t,n){let i=e===`y`?n.height:n.width;return t===`top`||t===`left`?{direction:1,baseline:0}:t===`middle`?{direction:0,baseline:i/2}:{direction:-1,baseline:i}}function jJ(e,t,n,i){return t+e(n)+e(i)}function MJ(e){return e===0?(e,t)=>Math.abs(e)-Math.abs(t):XL}function NJ(e,t={},n={}){let i=e===`y`?`x`:`y`,a=t.padding??1,o=t.anchor??(e===`y`?`bottom`:`left`);return{...n,initialize(t,n,s,c){let l=s[i],u=e=>s.r?s.r[e]:3,{direction:d,baseline:f}=AJ(e,o,c);s[e]===void 0&&(s[e]=Array(l.length).fill(0));let p=s[e],m=[];for(let e of t.filter(e=>Number.isFinite(l[e]))){let t=d===0?0:u(e)+a,n=[0,0];for(let i of m){let o=jJ(u,a,e,i),s=l[e]-l[i];if(Math.abs(s)<o){let e=Math.sqrt(o*o-s*s),a=p[i]-t;n.push(a-e,a+e)}}let i=d===0?[...n]:n.filter(e=>e>=0);i.sort(MJ(d));for(let a of i){let i=!0;for(let e=0;e<n.length;e+=2)if(n[e]+1e-6<a&&a<n[e+1]-1e-6){i=!1;break}if(i){p[e]=a+t;break}}m.push(e)}let h=d===0?1:d;for(let e of t)p[e]=p[e]*h+f}}}function PJ(e,t){if(t===void 0){let{anchor:t,padding:n,...i}=e;return[{anchor:t,padding:n},i]}return[e,t]}function FJ(e={},t){let[n,i]=PJ(e,t);return NJ(`x`,n,i)}function IJ(e={},t){let[n,i]=PJ(e,t);return NJ(`y`,n,i)}const LJ={sum:eR,mean:nR,median:iR,min:QL,max:$L,deviation:aR,first:e=>e.find(RJ),last:e=>[...e].reverse().find(RJ)};function RJ(e){return e!=null&&Number.isNaN(e)===!1}function zJ(e=`first`){if(e===`extent`)return function(e){let t=QL(e),n=$L(e)-t;return e.map(e=>n===0?0:(Number(e)-t)/n)};if(e===`deviation`)return function(e){let t=nR(e),n=aR(e);return e.map(e=>n?(Number(e)-t)/n:0)};{let t=BJ(e);return function(e){let n=Number(t(e));return e.map(e=>n===0?0:Number(e)/n)}}}function BJ(e){if(typeof e==`function`)return e;if(/^p\d{2}$/i.test(e))return t=>rR(t,Number(e.slice(1))/100);if(LJ[e])return LJ[e];throw Error(`invalid basis: `+e)}function VJ(e=`first`,t){let[n,i]=t===void 0&&typeof e==`object`?[`first`,e]:[e,t??{}];return VG(zJ(n),i)}function HJ(e=`first`,t){let[n,i]=t===void 0&&typeof e==`object`?[`first`,e]:[e,t??{}];return HG(zJ(n),i)}function UJ(e={},t){let[n,i]=t===void 0&&typeof e==`object`&&e.k===void 0&&e.reduce===void 0?[{},e]:[e,t??{}];return VG(qG(n),i)}function WJ(e={},t){let[n,i]=t===void 0&&typeof e==`object`&&e.k===void 0&&e.reduce===void 0?[{},e]:[e,t??{}];return HG(qG(n),i)}function GJ(e){if(typeof e==`number`)return{count:e,offset:(e,t)=>Number(e)+t};{let t=String(e).startsWith(`-`)?-1:1,n=Iz(typeof e==`string`?String(e).replace(/^[+-]/,``):e);return{count:t,offset:(e,t)=>n.offset(e,t)}}}function KJ(e,t,n){let{count:i,offset:a}=GJ(t),o=e+`1`,s=e+`2`,c=BG({[o]:e=>e.map(e=>a(e,i)),[s]:e=>e},n),l=c.transform;return{...c,transform:pH(function(e,t){let n=l(e,t),[o,c]=ZL(n.data.map(e=>e[s])),u=i<0?[o,a(c,i)]:[a(o,i),c];return n.channels[s]={...n.channels[s],domain:u},n})}}function qJ(e,t={}){return KJ(`x`,e,t)}function JJ(e,t={}){return KJ(`y`,e,t)}function YJ(e={}){let t=e.geometry??bz;return{...e,x:{value:t,centroid:!0},y:{value:t,centroid:!0}}}function XJ(e={}){let t=e.geometry??bz,n=new Map,i=e=>(n.has(e)===!1&&n.set(e,eU(typeof t==`function`?t(e):e[t])),n.get(e));return{...e,x:e=>i(e)[0],y:e=>i(e)[1]}}function ZJ(e,t={}){return{...t,filter:e}}function QJ(e={}){let t=e.transform;return{...e,transform:pH(function(e,n){let i=t?mH(t,e,n):{data:e,channels:n};return{data:[...i.data].reverse(),channels:i.channels}})}}function $J(e=0){let t=(0<=e&&e<1?e/1.0000000000000002:Math.abs(e))*4294967296%4294967296;return function(){return t=(1664525*t+1013904223)%4294967296,t/4294967296}}function eY(e={}){let t=e.transform,n=e.seed===void 0?Math.random:$J(e.seed);return{...e,transform:pH(function(e,i){let a=t?mH(t,e,i):{data:e,channels:i},o=[...a.data];for(let e=o.length-1;e>0;e--){let t=Math.floor(n()*(e+1)),i=o[e];o[e]=o[t],o[t]=i}return{data:o,channels:a.channels}})}}function tY(e,t={}){return{...t,sort:e}}function nY(e,t,n){return{...n,transform:pH(function(e,t){let n=rH(e,t),a=new Map;for(let t=0;t<e.length;t++){let e=fH(n,t);a.has(e)?a.get(e).push(t):a.set(e,[t])}let o=[];for(let e of a.values())o.push(iH(n,i(e,n)));return{data:o,channels:aH(t)}})};function i(n,i){return e===`first`?n[0]:e===`last`?n[n.length-1]:e===`min`?[...n].sort((e,n)=>XL(i[t][e],i[t][n]))[0]:[...n].sort((e,n)=>XL(i[t][n],i[t][e]))[0]}}function rY(e,t={}){if(typeof e==`string`)return nY(e,void 0,t);{let[n]=Object.keys(e);return nY(e[n],n,t)}}function iY(e={}){return nY(`first`,`y`,e)}function aY(e={}){return nY(`last`,`y`,e)}function oY(e={}){return nY(`min`,`x`,e)}function sY(e={}){return nY(`max`,`x`,e)}function cY(e={}){return nY(`min`,`y`,e)}function lY(e={}){return nY(`max`,`y`,e)}const uY={plot:fU,scale:Qq,legend:nJ,identity:bz,formatMonth:qI,formatWeekday:JI,formatIsoDate:YI,auto:Xq,autoSpec:XK,area:gW,areaX:Kq,areaY:Vq,arrow:xJ,axisFx:LH,axisFy:RH,axisX:PH,axisY:IH,barX:Jq,barY:Uq,boxX:SJ,boxY:_W,cell:CW,cellX:wW,dot:EW,dotX:DW,dotY:OW,frame:kW,geo:qW,graticule:$W,sphere:eG,gridX:zH,gridY:BH,line:nG,lineX:Gq,lineY:Wq,linearRegressionY:rG,rect:iG,rectX:qq,rectY:Hq,ruleX:aG,ruleY:oG,symbol:sG,text:lG,textX:uG,textY:dG,tickX:fG,tickY:pG,tip:$V,vector:vG,vectorX:yG,vectorY:bG,spike:xG,hexgrid:TG,link:ZG,tree:AK,cluster:jK,voronoi:AG,voronoiMesh:NG,differenceY:IG,bollingerX:YG,bollingerY:XG,bin:tq,binX:nq,binY:rq,hexbin:wG,group:cq,groupX:lq,groupY:uq,groupZ:CJ,find:wJ,stackX:Mq,stackX1:EJ,stackX2:DJ,stackY:Fq,stackY1:OJ,stackY2:kJ,dodgeX:FJ,dodgeY:IJ,normalize:zJ,normalizeX:VJ,normalizeY:HJ,window:qG,windowX:UJ,windowY:WJ,map:BG,mapX:VG,mapY:HG,shiftX:qJ,shiftY:JJ,centroid:YJ,geoCentroid:XJ,filter:ZJ,reverse:QJ,shuffle:eY,sort:tY,select:rY,selectFirst:iY,selectLast:aY,selectMinX:oY,selectMaxX:sY,selectMinY:cY,selectMaxY:lY,treeNode:kK,treeLink:OK,bollinger:JG,pointer:TL,pointerX:EL,pointerY:DL,crosshair:iJ,crosshairX:aJ,crosshairY:oJ,brush:gJ,brushX:_J,brushY:vJ};function dY(e,t,n){let i=(n-e.length*80)/2;return`<g class="legend" transform="translate(0, 0)">${e.map((e,n)=>{let a=i+n*80;return`<rect x="${a}" y="0" width="12" height="12" rx="2" fill="${t[n]}"/>
|
|
464
|
+
`?2:1,t=n):n+=1}yield[t,n,!0]}function iU(e,t,n){return e[n-1]===``?e.slice(t,n)+`-`:e.slice(t,n)}function aU(e,t=1/0){if(t===1/0)return e.split(/\r\n?|\n/g);{let n=t*100,i=[],a,o=0;for(let[t,s,c]of rU(e))a===void 0&&(a=t),o>a&&nU(e.slice(a,s))>n&&(i.push(iU(e,a,o)),a=t),c?(i.push(iU(e,a,s)),a=void 0,o=0):o=s;return i}}function oU(e,t){let n=[];for(let i of Object.keys(e.channels))if(i!==`px`&&i!==`py`&&e.channels[i].constant===void 0){let a=e.raw[i]?.[t];a!=null&&n.push({name:e.channels[i].label??sU(e.channels[i].value,i),value:cU(a),swatch:e.channels[i].scale===`color`?e.values[i][t]:void 0})}return n}function sU(e,t){return typeof e==`string`?e:t}function cU(e){return typeof e==`number`?HL(e):e instanceof Date?e.toISOString().slice(0,10):String(e)}function lU(e,t={}){return XV({type:`tip`,data:e,options:t,layer:5,channels:{x:{value:t.x,scale:`x`},y:{value:t.y,scale:`y`},...$V(t,{fill:$.fill})},render(e,t,n,i,a){let o=bR(),s=rH(t.x),c=rH(t.y);for(let t of e){let e=oU(a,t),l=Math.max(...e.map(uU))+16,u=e.length*13+16,d=n.x?n.x[t]+s:i.width/2,f=n.y?n.y[t]+c:i.height/2,p=d+l+12<i.width?d+12:d-l-12,m=f-u/2<0?0:Math.min(f-u/2,i.height-u);o.appendChild(xR({x:p,y:m,width:l,height:u,rx:3,fill:`var(--plot-background, white)`,stroke:`#ccc`})),e.forEach((e,t)=>dU(o,e,p,m+t*13))}return o}})}function uU(e){return nU(e.name+` `+e.value)/100*$.fontSize+(e.swatch?12:0)}function dU(e,t,n,i){let a=CR({x:n+8,y:i+8+13-4,fontSize:$.fontSize,fill:`currentColor`});a.appendChild(ER({textContent:t.name,fontWeight:`bold`})),a.appendChild(ER({textContent:` `+t.value})),e.appendChild(a),t.swatch&&e.appendChild(xR({x:n+8+nU(t.name+` `+t.value)/100*$.fontSize+4,y:i+8+3,width:8,height:8,fill:t.swatch}))}function fU(e,t){let n=(e.marks??[]).flat(1/0).filter(Boolean);function i(e){if(t.data!==void 0&&e.data===t.data&&e.channels.fx===void 0&&e.channels.fy===void 0){let n={...e.channels};return t.x!==void 0&&(n.fx={value:t.x,scale:`fx`,type:`band`}),t.y!==void 0&&(n.fy={value:t.y,scale:`fy`,type:`band`}),{...e,channels:n}}return e}let a=[];for(let e of n){let t=i(e);if(a.push(t),t.options.tip){let{tip:e,...n}=t.options;a.push(lU(t.data,FR(n)))}}return a}function pU(e,t){let n={};for(let i of Object.keys(t))t[i].value!==void 0&&(n[i]=RB(e,t[i].value));return n}function mU(e,t){let n={};for(let i of Object.keys(e))n[i]=e[i][t];return n}function hU(e,t={}){let n={};for(let t of Object.keys(e))n[t]=e[t].value===void 0?e[t]:{...e[t],value:t,label:e[t].label??vU(e[t].value)??null};return{...n,...t}}function gU(e,t,n={}){let i={};for(let n of Object.keys(e))if(t[n]===void 0)i[n]=e[n];else{let a=t[n];i[n]={...e[n],value:(e,t)=>a[t],label:e[n].label??vU(e[n].value)??null}}return{...i,...n}}function _U(e,t={}){return{...t,value:(t,n)=>e[n]}}function vU(e){if(typeof e==`string`)return e}function yU(e,t,n){let i=[String(e[n]?.[t])];for(let n of[`fx`,`fy`])e[n]!==void 0&&i.push(String(e[n][t]));return i.join(` `)}const bU={x:`x`,x1:`x`,x2:`x`,y:`y`,y1:`y`,y2:`y`,fill:`color`,stroke:`color`,r:`r`,opacity:`opacity`,fx:`fx`,fy:`fy`};function xU(e,t){let n=new Map;for(let i=0;i<t;i++){let t=SU(e,i);n.has(t)?n.get(t).push(i):n.set(t,[i])}return[...n.values()]}function SU(e,t){let n=[];for(let i of[`z`,`fill`,`stroke`,`fx`,`fy`])e[i]!==void 0&&n.push(String(e[i][t]));return n.join(` `)}function CU(e){return e.channels=!0,e}function wU(e,t,n){if(e.channels===!0)return e(t,n);{let i=e(t,[t.map((e,t)=>t)])??{},a=i.data??t;return{data:(i.facets?i.facets.flat():a.map((e,t)=>t)).map(e=>a[e]),channels:n}}}function TU(e){return e!=null&&Number.isNaN(e)===!1}function EU(e,t){return TU(e)===TU(t)?e<t?-1:+(e>t):TU(e)?-1:1}function DU(e,t){if(t.filter!==void 0&&t.filter!==null){let n=RB(e,t.filter);return e.map((e,t)=>!!n[t])}}function OU(e,t,n){let i=e.map((e,t)=>t);return i.sort((e,i)=>n?EU(t[i],t[e]):EU(t[e],t[i])),i.map(t=>e[t])}function kU(e,t,n){let i=t.sort,a=typeof i==`object`&&!!i&&i.channel!==void 0,o=typeof i==`object`&&!!i&&a===!1,s=e;if(a){let e=String(i.channel).replace(/^-/,``),t=String(i.channel).startsWith(`-`)||i.order===`descending`,a=n[e];a!==void 0&&a.value!==void 0&&(s=OU(s,RB(s,a.value),t))}else if(i!=null&&o===!1){if(typeof i==`function`&&i.length!==1)s=[...s].sort(i);else{let e=typeof i==`string`&&i.startsWith(`-`),t=typeof i==`string`?i.replace(/^-/,``):i;s=OU(s,RB(s,t),e)}}return t.reverse===!0&&(s=[...s].reverse()),s}function AU(e){let t=IB(e.data),n=e.channels;if(e.transform){let i=wU(e.transform,t,n);t=IB(i.data),n=i.channels}t=kU(t,e.options,n);let i={};for(let e of Object.keys(n))n[e].constant===void 0&&(i[e]=RB(t,n[e].value));return{mark:e,data:t,channels:n,raw:i,values:{},length:t.length,shown:DU(t,e.options)}}function jU(e,t){for(let n of e)for(let e of Object.keys(n.channels)){let i=n.channels[e].scale,a=i===void 0?void 0:t[i].transform;a&&n.raw[e]&&(n.raw[e]=n.raw[e].map(a))}}function MU(e,t,n){let i={};for(let t of e)for(let e of Object.keys(t.channels)){let n=t.channels[e];n.scale&&t.raw[e]&&(i[n.scale]===void 0&&(i[n.scale]=[]),i[n.scale].push({values:t.raw[e],type:n.type,zero:n.zero,nice:n.nice,domain:n.domain,radius:n.radius,hint:n.hint,label:n.label===void 0?zB(n.value):n.label}))}n!==void 0&&(delete i.x,delete i.y);for(let e of Object.keys(t))t[e].domain!==void 0&&i[e]===void 0&&(i[e]=[{values:IB(t[e].domain)}]);return i}const NU={count:e=>e.length,sum:uz,mean:fz,median:mz,min:cz,max:lz,deviation:hz,first:e=>e[0],last:e=>e[e.length-1],distinct:e=>_z(e).length,defined:dz,variance:yz,mode:bz,proportion:uz,"proportion-facet":uz};function PU(e,t,n,i){return typeof e==`function`?e(t,n):typeof e==`object`&&e?PU(e.reduce??`count`,t,n,i):LU(e)&&i?t.length:(NU[e]??NU.count)(t,n)}function FU(e){if(typeof e==`object`&&e)return e.value}function IU(e,t){let n=typeof t==`object`&&t?t.reduce:t;return n===`count`?`Frequency`:typeof n==`string`?n.charAt(0).toUpperCase()+n.slice(1):e}function LU(e){let t=typeof e==`object`&&e?e.reduce:e;return t===`proportion`||t===`proportion-facet`}function RU(e){return(typeof e==`object`&&e?e.reduce:e)===`proportion-facet`?`facet`:`plot`}function zU(e,t,n,i,a){let o=e[t],s=e=>n===`facet`?String(i?.[e])+` `+String(a?.[e]):``,c=new Map;for(let e=0;e<o.length;e++)c.set(s(e),(c.get(s(e))??0)+Number(o[e]));for(let e=0;e<o.length;e++){let t=c.get(s(e));o[e]=t===0?0:Number(o[e])/t}}function BU(e,t,n){let i=typeof n==`string`?{value:n}:{value:n.value??n.channel,...n},a=String(i.value).replace(/^-/,``),o=String(i.value).startsWith(`-`)||i.order===`descending`,s=e.raw[t],c=e.raw[a];if(s!==void 0&&c!==void 0){let e=new Map;for(let t=0;t<s.length;t++)e.has(s[t])?e.get(s[t]).push(c[t]):e.set(s[t],[c[t]]);let t=[...e].map(([e,t])=>[e,PU(i.reduce??`max`,t)]),n=(e,t)=>e<t?-1:+(e>t);return t.sort((e,t)=>(o?t[1]-e[1]:e[1]-t[1])||n(e[0],t[0])),t.map(([e])=>e)}}function VU(e,t){return Object.keys(e.channels).find(n=>e.channels[n].scale===t)}function HU(e,t){function n(e,n,i){if(t[n]&&t[n].domain===void 0){let a=BU(e,VU(e,n),i);a&&(t[n]={...t[n],domain:a})}}for(let t of e){let e=t.mark.options.sort;if(e&&typeof e==`object`&&e.channel===void 0)for(let i of Object.keys(e))n(t,i,e[i])}}function UU(e=0){let t=Number(e);return Math.abs(t)>=10?{rotate:t,padding:$.tickPadding+4*Math.cos(t*Math.PI/180),textAnchor:t>0?`start`:`end`,dominantBaseline:`middle`}:{rotate:0,padding:$.tickPadding,textAnchor:`middle`,dominantBaseline:`hanging`}}function WU(e={}){return XV({type:`axisX`,facet:!1,layer:1,options:e,render(t,n,i,a){let o=n.x,s=a.cell;if(o&&s.isBottom){let t=bR({transform:`translate(0, ${oR(a.height)})`,fontSize:$.fontSize}),i=TV(o,e,a.tickCountX),c=typeof e.ticks==`number`?e.ticks:a.tickCountX,l=nR(e.tickFormat,o,i,c),u=e.tickSize??$.tickSize,d=UU(e.tickRotate);for(let e of i){let n=EV(o,e);if(Number.isFinite(n)){u>0&&t.appendChild(SR({x1:n,y1:0,x2:n,y2:u,stroke:$.axisStroke}));let i=l(e);if(i!==``){let e=u+d.padding;t.appendChild(CR({x:n,y:e,textContent:i,transform:d.rotate===0?void 0:`rotate(`+d.rotate+`, `+oR(n)+`, `+oR(e)+`)`,textAnchor:d.textAnchor,dominantBaseline:d.dominantBaseline,fill:$.axisStroke,fillOpacity:$.axisTextOpacity}))}}}e.line===!0&&t.appendChild(SR({x1:0,y1:0,x2:a.width,y2:0,stroke:$.axisStroke}));let f=wV(e,o);return f&&s.isRight&&n.fx===void 0&&(CV(o)?t.appendChild(CR({x:a.width/2,y:a.marginBottom-3,textContent:f,textAnchor:`middle`,dominantBaseline:`auto`,fill:$.axisStroke,fontSize:$.fontSize})):t.appendChild(CR({x:a.width,y:a.marginBottom-3,textContent:f+` →`,textAnchor:`end`,dominantBaseline:`auto`,fill:$.axisStroke,fontSize:$.fontSize}))),t}return null}})}function GU(e=0,t){let n=Number(e);return Math.abs(n)>60?{rotate:n,padding:$.tickPadding+4*Math.cos(n*Math.PI/180),textAnchor:`middle`,dominantBaseline:n>0?`hanging`:`auto`}:{rotate:n,padding:$.tickPadding,textAnchor:t?`start`:`end`,dominantBaseline:`middle`}}function KU(e={}){let t=e.axis===`right`;return XV({type:`axisY`,facet:!1,layer:1,options:e,render(n,i,a,o){let s=i.y,c=o.cell;if(s&&(t?c.isRight:c.isLeft)){let n=t?o.width:0,a=t?1:-1,l=bR({fontSize:$.fontSize}),u=TV(s,e,o.tickCountY),d=typeof e.ticks==`number`?e.ticks:o.tickCountY,f=nR(e.tickFormat,s,u,d),p=e.tickSize??$.tickSize,m=GU(e.tickRotate,t);for(let e of u){let t=EV(s,e);if(Number.isFinite(t)){p>0&&l.appendChild(SR({x1:n,y1:t,x2:n+a*p,y2:t,stroke:$.axisStroke}));let i=f(e);if(i!==``){let e=n+a*(p+m.padding);l.appendChild(CR({x:e,y:t,textContent:i,transform:m.rotate===0?void 0:`rotate(`+m.rotate+`, `+e+`, `+t+`)`,textAnchor:m.textAnchor,dominantBaseline:m.dominantBaseline,fill:$.axisStroke,fillOpacity:$.axisTextOpacity}))}}}e.line===!0&&l.appendChild(SR({x1:n,y1:0,x2:n,y2:o.height,stroke:$.axisStroke}));let h=wV(e,s);if(h&&c.isTop&&i.fy===void 0){if(CV(s)){let e=n+a*(o[t?`marginRight`:`marginLeft`]-3),i=o.height/2;l.appendChild(CR({x:e,y:i,textContent:h,transform:`rotate(-90, `+e+`, `+i+`)`,textAnchor:`middle`,dominantBaseline:`hanging`,fill:$.axisStroke,fontSize:$.fontSize}))}else l.appendChild(CR({x:n+a*(o[t?`marginRight`:`marginLeft`]-3),y:-(o.marginTop-3),textContent:t?h+` ↑`:`↑ `+h,textAnchor:t?`end`:`start`,dominantBaseline:`hanging`,fill:$.axisStroke,fontSize:$.fontSize}))}return l}return null}})}function qU(e={}){let t=e.anchor!==`bottom`;return XV({type:`axisFx`,facet:!1,layer:1,options:e,render(n,i,a,o){let s=o.cell,c=t?s.isTop:s.isBottom;if(i.fx&&c){let n=bR({fontSize:$.fontSize}),a=e.offset??(t===!1&&i.x?$.tickSize+$.fontSize+8:6),c=t?-a:o.height+a,l=t?-1:1,u=uH(i.fx.domain.length,o.plotWidth,$.tickSpacingX,e.ticks);e.ticks!==null&&s.column%u===0&&n.appendChild(CR({x:o.width/2,y:c,textContent:tR(s.fx,e.tickFormat),textAnchor:`middle`,dominantBaseline:t?`auto`:`hanging`,fill:$.axisStroke}));let d=e.label??i.fx.label;return d&&s.isRight&&n.appendChild(CR({x:o.plotWidth/2-s.x,y:c+l*($.fontSize+4),textContent:d,textAnchor:`middle`,dominantBaseline:t?`auto`:`hanging`,fill:$.axisStroke,fillOpacity:$.axisTextOpacity})),n}return null}})}function JU(e={}){let t=e.anchor===`left`;return XV({type:`axisFy`,facet:!1,layer:1,options:e,render(n,i,a,o){let s=o.cell,c=t?s.isLeft:s.isRight;if(i.fy&&c){let n=bR({fontSize:$.fontSize}),a=e.offset??6,c=t?-a:o.width+a,l=uH(i.fy.domain.length,o.plotHeight,$.tickSpacingY,e.ticks);e.ticks!==null&&s.row%l===0&&n.appendChild(CR({x:c,y:o.height/2,textContent:tR(s.fy,e.tickFormat),textAnchor:t?`end`:`start`,dominantBaseline:`middle`,fill:$.axisStroke}));let u=e.label??i.fy.label;if(u&&s.isTop){let e=t?o.marginLeft:o.marginRight,i=t?-(e-3):o.width+e-3,a=o.plotHeight/2-s.y;n.appendChild(CR({x:i,y:a,textContent:u,transform:`rotate(-90, `+i+`, `+a+`)`,textAnchor:`middle`,dominantBaseline:t?`hanging`:`auto`,fill:$.axisStroke,fillOpacity:$.axisTextOpacity}))}return n}return null}})}function YU(e={}){return XV({type:`gridX`,facet:!1,layer:-1,options:e,render(t,n,i,a){let o=n.x;if(o){let t=bR();for(let n of TV(o,e,a.tickCountX)){let i=EV(o,n);Number.isFinite(i)&&t.appendChild(SR({x1:i,y1:0,x2:i,y2:a.height,stroke:e.stroke??$.gridStroke,strokeOpacity:e.strokeOpacity??$.gridStrokeOpacity}))}return t}return null}})}function XU(e={}){return XV({type:`gridY`,facet:!1,layer:-1,options:e,render(t,n,i,a){let o=n.y;if(o){let t=bR();for(let n of TV(o,e,a.tickCountY)){let i=EV(o,n);Number.isFinite(i)&&t.appendChild(SR({x1:0,y1:i,x2:a.width,y2:i,stroke:e.stroke??$.gridStroke,strokeOpacity:e.strokeOpacity??$.gridStrokeOpacity}))}return t}return null}})}function ZU(e={}){return XV({type:`gridFx`,facet:!1,layer:-1,options:e,render(t,n,i,a){let o=a.cell,s=n.fx?uH(n.fx.domain.length,a.plotWidth,$.tickSpacingX,e.ticks):1;if(n.fx&&o.isTop&&o.column%s===0){let t=a.width/2;return SR({x1:t,x2:t,y1:-o.y,y2:a.plotHeight-o.y,stroke:e.stroke??$.gridStroke,strokeOpacity:e.strokeOpacity??$.gridStrokeOpacity})}return null}})}function QU(e={}){return XV({type:`gridFy`,facet:!1,layer:-1,options:e,render(t,n,i,a){let o=a.cell,s=n.fy?uH(n.fy.domain.length,a.plotHeight,$.tickSpacingY,e.ticks):1;if(n.fy&&o.isLeft&&o.row%s===0){let t=a.height/2;return SR({x1:-o.x,x2:a.plotWidth-o.x,y1:t,y2:t,stroke:e.stroke??$.gridStroke,strokeOpacity:e.strokeOpacity??$.gridStrokeOpacity})}return null}})}function $U(e,t){return{axis:e.axis!==null&&e.axis!==!1,grid:e.grid===!0||t===!0&&e.grid!==!1}}function eW(e){let{transform:t,...n}=e;return n}function tW(e,t,n){let i={x:[`top`,`bottom`],y:[`right`,`left`]};function a(e,n){let a=t[e].axis;return i[e[1]].includes(a)?a:n?i[e[1]][0]:i[e[1]][1]}let o=n=>e[n]!==void 0&&t[n].axis!==null&&t[n].axis!==!1;return{fx:{shown:o(`fx`),anchor:a(`fx`,e.x!==void 0&&$U(t.x,n).axis)},fy:{shown:o(`fy`),anchor:a(`fy`,e.y!==void 0&&$U(t.y,n).axis)}}}function nW(e,t,n,i){let a=[];if(e.x){let e=$U(t.x,n);e.grid&&a.push(YU(eW(t.x))),e.axis&&a.push(WU(eW(t.x)))}if(e.y){let e=$U(t.y,n);e.grid&&a.push(XU(eW(t.y))),e.axis&&a.push(KU(eW(t.y)))}return e.fx&&(t.fx.grid===!0&&a.push(ZU(eW(t.fx))),i.fx.shown&&a.push(qU({...eW(t.fx),anchor:i.fx.anchor}))),e.fy&&(t.fy.grid===!0&&a.push(QU(eW(t.fy))),i.fy.shown&&a.push(JU({...eW(t.fy),anchor:i.fy.anchor}))),a}function rW(e,t){let n=e.fy?DV(`fy`,e.fy,t.fy)??1:1,i;if(e.y===void 0&&e.fy===void 0)i=0;else if(e.y===void 0)i=Math.max(1,Math.min(60,n));else{let a=DV(`y`,e.y,t.y);i=Math.max(1,Math.min(60,(a??Math.max(7,17/n))*n))}return Math.round(i*$.bandHeight+(e.fx?30:0)+60)}function iW({options:e,facetOptions:t,collected:n,configs:i,facets:a,aspectRatio:o}){let s=n.x!==void 0&&$U(i.x,e.grid).axis,c=n.y!==void 0&&$U(i.y,e.grid).axis,l=e.width??640,u=i.y.axis===`right`?`right`:`left`,d=a.fy.shown&&a.fy.anchor===`right`,f=a.fy.shown&&a.fy.anchor===`left`,p=Math.max(c?20:0,a.fx.shown&&a.fx.anchor===`top`?30:0),m=d?t.marginRight??60:Math.max(s?20:0,c&&u===`right`?40:0),h=Math.max(s?30:0,c?20:0)+(a.fx.shown&&a.fx.anchor===`bottom`?16:0),g=Math.max(c&&u===`left`?40:0,s?20:0,f?40:0),_=e.marginTop??e.margin??p,v=e.marginRight??e.margin??m,y=e.marginBottom??e.margin??h,b=e.marginLeft??e.margin??g,x=n.fx?DV(`fx`,n.fx,i.fx)??1:1,S=n.fy?DV(`fy`,n.fy,i.fy)??1:1,C=o===void 0?void 0:Math.max(.1,Math.min(10,o*(1.1*S-.1)/(1.1*x-.1))),w=e.height??(C===void 0?rW(n,i)-p-h+_+y:Math.round((l-b-v)*C+_+y));return{width:l,height:w,plotWidth:Math.max(1,l-b-v),plotHeight:Math.max(1,w-_-y),marginTop:_,marginRight:v,marginBottom:y,marginLeft:b}}function aW({collected:e,configs:t,layout:n,projectionOption:i,domains:a={}}){let o=(e,t)=>a[e]?{...t,domain:a[e]}:t,s={};e.fx&&(s.fx=SV({name:`fx`,channels:e.fx,config:{padding:$.facetPadding,paddingOuter:0,...t.fx},range:[0,n.plotWidth]})),e.fy&&(s.fy=SV({name:`fy`,channels:e.fy,config:{padding:$.facetPadding,paddingOuter:0,...t.fy},range:[0,n.plotHeight]}));let c=s.fx?s.fx.bandwidth():n.plotWidth,l=s.fy?s.fy.bandwidth():n.plotHeight,u=XH(i,{width:c,height:l,marginTop:0,marginRight:0,marginBottom:0,marginLeft:0}),d=Math.max(2,Math.round(c/80)),f=Math.max(2,Math.round(l/40));return e.x&&(s.x=SV({name:`x`,channels:e.x,config:o(`x`,{ticks:d,...t.x}),range:[0,c]})),e.y&&(s.y=SV({name:`y`,channels:e.y,config:o(`y`,{ticks:f,...t.y}),range:[l,0],ordinalRange:[0,l]})),e.color&&(s.color=SV({name:`color`,channels:e.color,config:t.color})),e.r&&(s.r=SV({name:`r`,channels:e.r,config:t.r,range:[0,Math.min(c,l)/16]})),e.opacity&&(s.opacity=SV({name:`opacity`,channels:e.opacity,config:t.opacity})),e.length&&(s.length=SV({name:`length`,channels:e.length,config:t.length})),e.symbol&&(s.symbol=SV({name:`symbol`,channels:e.symbol,config:t.symbol})),{scales:s,cellWidth:c,cellHeight:l,tickCountX:d,tickCountY:f,projection:u}}const oW=Math.PI/180,sW=180/Math.PI;function cW(e,t=[]){if(e){let n=e.type;n===`FeatureCollection`?e.features.forEach(e=>cW(e,t)):n===`Feature`?cW(e.geometry,t):n===`GeometryCollection`?e.geometries.forEach(e=>cW(e,t)):n===`Point`?t.push([e.coordinates]):n===`MultiPoint`||n===`LineString`?t.push(e.coordinates):n===`MultiLineString`||n===`Polygon`?e.coordinates.forEach(e=>t.push(e)):n===`MultiPolygon`&&e.coordinates.forEach(e=>t.push(e[0]))}return t}function lW(e,t){let n=0,i=0,a=0,o=0,s=0,c=0;for(let l of cW(t)){let t=[];for(let n of l){let i=e.planar?[n[0],n[1]]:e.rotate([n[0]*oW,n[1]*oW]),a=e.forward(i);a&&Number.isFinite(a[0])&&Number.isFinite(a[1])&&(t.push(a),o+=a[0],s+=a[1],c+=1)}for(let e=0;e<t.length;e++){let[o,s]=t[e],[c,l]=t[(e+1)%t.length],u=o*l-c*s;n+=u,i+=(o+c)*u,a+=(s+l)*u}}return Math.abs(n)>1e-9?[i/(3*n),a/(3*n)]:c>0?[o/c,s/c]:[NaN,NaN]}function uW(e){let t=0,n=0,i=0,a=0;for(let o of cW(e))for(let e=0;e<o.length;e++){let[s,c]=o[e],l=s*oW,u=c*oW,d=Math.cos(u),f=o[e===0?o.length-1:e-1],p=Math.hypot(s-f[0],c-f[1])+1e-9;t+=Math.cos(l)*d*p,n+=Math.sin(l)*d*p,i+=Math.sin(u)*p,a+=p}if(a>0){let e=Math.hypot(t,n,i);if(e>0)return[Math.atan2(n,t)*sW,Math.asin(Math.max(-1,Math.min(1,i/e)))*sW]}return[NaN,NaN]}function dW(e,t){for(let n of Object.keys(e.channels)){let i=e.channels[n];if(i.constant!==void 0)e.values[n]=Array(e.length).fill(i.constant);else if(i.scale&&t[i.scale]){let a=t[i.scale];e.values[n]=e.raw[n].map(e=>a(e))}else e.values[n]=e.raw[n]}}function fW(e,t){let n=Math.PI/180;if(e.raw.x&&e.raw.y){let i=Array(e.length),a=Array(e.length),o=e.channels.x.value?.centroid===!0;for(let s=0;s<e.length;s++){let c;if(o)c=lW(t,e.raw.x[s]);else{let i=Number(e.raw.x[s]),a=Number(e.raw.y[s]),o=t.planar?[i,a]:t.rotate([i*n,a*n]);c=t.forward(o)??[NaN,NaN]}i[s]=c[0],a[s]=c[1]}e.values.x=i,e.values.y=a}}function pW(e,t,n){for(let i of e)dW(i,t),n&&i.placed!==!0&&fW(i,n)}let mW=0;function hW(e){let{layout:t,cellWidth:n,cellHeight:i,projection:a,states:o,options:s}=e,c=yR({width:t.width,height:t.height,style:{fontFamily:$.fontFamily,fontSize:$.fontSize+`px`,maxWidth:`100%`,height:`auto`,overflow:`visible`}}),l=bR({transform:`translate(${oR(t.marginLeft)}, ${oR(t.marginTop)})`});c.appendChild(l);let u;if(a||s.zoom){u=`plot-clip-`+ ++mW;let e=DR(),t=OR({id:u});t.appendChild(xR({x:0,y:0,width:n,height:i})),e.appendChild(t),c.appendChild(e);for(let e of o)e.clipped=!0}return{$svg:c,$plot:l,clipId:u}}function gW(e){e.original===void 0?e.original={data:e.data,channels:e.channels,raw:e.raw,length:e.length}:Object.assign(e,e.original)}function _W(e,t){let n=e.states.filter(e=>e.mark.options.rebin);if(n.length!==0){let i={...t};for(let t of n){gW(t),t.scales=e.scales;let n=t.mark.options.rebin(t);t.data=n.data,t.channels=n.channels,t.placed=n.placed===!0,t.length=n.data.length,t.raw={};for(let e of Object.keys(t.channels))t.channels[e].constant===void 0&&(t.raw[e]=RB(t.data,t.channels[e].value));t.values={};for(let e of Object.keys(t.channels)){let n=t.channels[e];n.scale!==void 0&&n.scale!==`x`&&n.scale!==`y`&&t.raw[e]&&(i[n.scale]=[...i[n.scale]??[],{values:t.raw[e],type:n.type,zero:n.zero,radius:n.radius,label:n.label===void 0?zB(n.value):n.label}])}}return i}}function vW(e,t){t!==void 0&&(e.domains=t??{});let n=t=>Object.assign(e,aW({collected:t,configs:e.configs,layout:e.layout,projectionOption:e.options.projection,domains:e.domains}));n(e.collected),pW(e.states,e.scales,e.projection);let i=_W(e,e.collected);i&&(n(i),pW(e.states,e.scales,e.projection)),e.selection=void 0,e.$svg?e.$plot.replaceChildren():Object.assign(e,hW(e)),mH(e)}function yW(e){let t=new Map;return e.map(e=>{let n=t.get(e)??0;return t.set(e,n+1),n})}function bW(e){let t=e.raw.time.some(e=>e instanceof Date),n=e.raw.time.map(Number),i=_z(n).sort(oz),a=new Map(i.map(e=>[e,[]]));for(let e=0;e<n.length;e++)a.get(n[e]).push(e);let o=Math.max(...i.map(e=>a.get(e).length));return{holdsDates:t,times:n,keys:e.raw.key??yW(n),keyframeDomain:i,rowsAt:a,interpLength:e.length+o*2}}function xW(e,t={}){let n=e.filter(e=>e.raw.time&&e.length>0);if(n.length>0){let e=!1;for(let t of n)Object.assign(t,bW(t)),t.interp={},e||=t.holdsDates;let i=sz(n.flatMap(e=>e.keyframeDomain));return{states:n,domain:i,holdsDates:e,duration:t.duration??5e3,autoplay:t.autoplay!==!1,loop:t.loop!==!1,playbackRate:t.playbackRate??1,initial:t.initial===void 0?i[0]:Number(t.initial)}}}function SW(e={}){let{configs:t,facetOptions:n}=eU(e),i=fU(e,n).map(AU);jU(i,t);let a=YH(e.projection),o=MU(i,t,a);HU(i,t);let s=tW(o,t,e.grid),c=nW(o,t,e.grid,s).map(AU),l=[...c,...i].sort((e,t)=>e.mark.layer-t.mark.layer),u={options:e,configs:t,facetOptions:n,states:i,collected:o,facets:s,decorationStates:c,ordered:l,layout:iW({options:e,facetOptions:n,collected:o,configs:t,facets:s,aspectRatio:a}),domains:{},pointerTargets:[],redraw(e){vW(u,e)},publishValue(e){if(cR&&u.$root){let t=u.$root.ownerDocument.defaultView;u.$root.value=e,u.$svg.value=e,u.$root.dispatchEvent(new t.Event(`input`,{bubbles:!0}))}}};for(let e of l)e.chart=u;vW(u),cR&&u.pointerTargets.length>0&&VR(u.$svg,u.pointerTargets),cR&&e.zoom&&UV(u,{pan:i.some(e=>e.mark.type===`brush`)===!1,...e.zoom===!0?{}:e.zoom});let d=[];u.scales.color&&t.color.legend===!0&&d.push({scale:u.scales.color,config:t.color}),u.scales.symbol&&t.symbol.legend===!0&&d.push({scale:u.scales.symbol,config:t.symbol,colorScale:u.scales.color}),u.$root=FV({$svg:u.$svg,legends:d,title:e.title,subtitle:e.subtitle,caption:e.caption});let f=xW(i,e.time);return f&&(hH(u,f,f.initial),cR&&gH(u,f)),e.container&&e.container.appendChild(u.$root),(e.mode??(cR?`dom`:`string`))===`string`?String(u.$root):u.$root}function CW(e){return e.map(e=>Q(e.x,e.y)).join(` L `)}function wW(e){return e.length===0?``:e.length===1?`M ${CW(e)} Z`:`M ${CW(e)}`}function TW(e){return e.length===0?``:`M ${CW(e)} Z`}function EW(e){if(e.length<2)return wW(e);{let t=`M ${Q(e[0].x,e[0].y)}`;for(let n=1;n<e.length;n++){let i=(e[n-1].x+e[n].x)/2;t+=` H ${oR(i)} V ${oR(e[n].y)}`}return`${t} H ${oR(e[e.length-1].x)}`}}function DW(e){if(e.length<2)return wW(e);{let t=`M ${Q(e[0].x,e[0].y)}`;for(let n=1;n<e.length;n++)t+=` V ${oR(e[n].y)} H ${oR(e[n].x)}`;return t}}function OW(e){if(e.length<2)return wW(e);{let t=`M ${Q(e[0].x,e[0].y)}`;for(let n=1;n<e.length;n++)t+=` H ${oR(e[n].x)} V ${oR(e[n].y)}`;return t}}function kW(e){let t=e.length-1,n=Array(t),i=Array(t),a=Array(t);n[0]=0,i[0]=2,a[0]=e[0]+2*e[1];for(let o=1;o<t-1;o++)n[o]=1,i[o]=4,a[o]=4*e[o]+2*e[o+1];n[t-1]=2,i[t-1]=7,a[t-1]=8*e[t-1]+e[t];for(let e=1;e<t;e++){let t=n[e]/i[e-1];i[e]-=t,a[e]-=t*a[e-1]}let o=Array(t),s=Array(t);o[t-1]=a[t-1]/i[t-1];for(let e=t-2;e>=0;e--)o[e]=(a[e]-o[e+1])/i[e];s[t-1]=(e[t]+o[t-1])/2;for(let n=0;n<t-1;n++)s[n]=2*e[n+1]-o[n+1];return[o,s]}function AW(e){if(e.length<3)return wW(e);{let[t,n]=kW(e.map(e=>e.x)),[i,a]=kW(e.map(e=>e.y)),o=`M ${Q(e[0].x,e[0].y)}`;for(let s=0;s<e.length-1;s++)o+=` C ${Q(t[s],i[s])} ${Q(n[s],a[s])} ${Q(e[s+1].x,e[s+1].y)}`;return o}}function jW(e,t,n){return` C ${Q((2*e.x+t.x)/3,(2*e.y+t.y)/3)} ${Q((e.x+2*t.x)/3,(e.y+2*t.y)/3)} ${MW(e,t,n)}`}function MW(e,t,n){return Q((e.x+4*t.x+n.x)/6,(e.y+4*t.y+n.y)/6)}function NW(e){if(e.length<3)return wW(e);{let t=e.length-1,n=`M ${Q(e[0].x,e[0].y)}`;n+=` L ${Q((5*e[0].x+e[1].x)/6,(5*e[0].y+e[1].y)/6)}`;for(let i=2;i<=t;i++)n+=jW(e[i-2],e[i-1],e[i]);return n+=jW(e[t-1],e[t],e[t]),n+=` L ${Q(e[t].x,e[t].y)}`,n}}function PW(e){if(e.length<3)return``;if(e.length===3)return`M ${MW(e[0],e[1],e[2])} Z`;{let t=`M ${MW(e[0],e[1],e[2])}`;for(let n=3;n<e.length;n++)t+=jW(e[n-2],e[n-1],e[n]);return t}}function FW(e){return e.length<3?TW(e):PW(e.concat(e.slice(0,3)))}function IW(e,t={}){let n=t.tension??t.beta??.85;if(e.length<2)return``;{let t=e.length-1,i=e[0],a=e[t].x-i.x,o=e[t].y-i.y;return NW(e.map((e,s)=>({x:n*e.x+(1-n)*(i.x+s/t*a),y:n*e.y+(1-n)*(i.y+s/t*o)})))}}function LW(e,t,n,i,a){let o=(1-a)/6,s=e?{x:t.x+o*(n.x-e.x),y:t.y+o*(n.y-e.y)}:t,c=i?{x:n.x+o*(t.x-i.x),y:n.y+o*(t.y-i.y)}:n;return` C ${Q(s.x,s.y)} ${Q(c.x,c.y)} ${Q(n.x,n.y)}`}function RW(e,t={}){let n=t.tension??0;if(e.length<3)return wW(e);{let t=e.length-1,i=`M ${Q(e[0].x,e[0].y)}`;for(let a=0;a<t;a++){let o=a===0?null:e[a-1],s=a===t-1?null:e[a+2];i+=LW(o,e[a],e[a+1],s,n)}return i}}function zW(e,t={}){let n=t.tension??0;if(e.length<3)return``;if(e.length===3)return`M ${Q(e[1].x,e[1].y)} Z`;{let t=`M ${Q(e[1].x,e[1].y)}`;for(let i=3;i<e.length;i++)t+=LW(e[i-3],e[i-2],e[i-1],e[i],n);return t}}function BW(e,t={}){return e.length<3?TW(e):zW(e.concat(e.slice(0,3)),t)}const VW=1e-12;function HW(e,t,n){let i=t.x-e.x,a=t.y-e.y,o=(i*i+a*a)**+n;return{squared:o,length:Math.sqrt(o)}}function UW(e,t,n,i,a){let o=e?HW(e,t,a):{squared:0,length:0},s=HW(t,n,a),c=i?HW(n,i,a):{squared:0,length:0},l={x:t.x,y:t.y},u={x:n.x,y:n.y};if(o.length>VW){let i=2*o.squared+3*o.length*s.length+s.squared,a=3*o.length*(o.length+s.length);l={x:(t.x*i-e.x*s.squared+n.x*o.squared)/a,y:(t.y*i-e.y*s.squared+n.y*o.squared)/a}}if(c.length>VW){let e=2*c.squared+3*c.length*s.length+s.squared,a=3*c.length*(c.length+s.length);u={x:(n.x*e+t.x*c.squared-i.x*s.squared)/a,y:(n.y*e+t.y*c.squared-i.y*s.squared)/a}}return` C ${Q(l.x,l.y)} ${Q(u.x,u.y)} ${Q(n.x,n.y)}`}function WW(e,t={}){let n=t.tension??t.alpha??.5;if(e.length<3)return wW(e);{let t=e.length-1,i=`M ${Q(e[0].x,e[0].y)}`;for(let a=0;a<t;a++){let o=a===0?null:e[a-1],s=a===t-1?null:e[a+2];i+=UW(o,e[a],e[a+1],s,n)}return i}}function GW(e,t={}){let n=t.tension??t.alpha??.5;if(e.length<3)return``;if(e.length===3)return`M ${Q(e[1].x,e[1].y)} Z`;{let t=`M ${Q(e[1].x,e[1].y)}`;for(let i=3;i<e.length;i++)t+=UW(e[i-3],e[i-2],e[i-1],e[i],n);return t}}function KW(e,t={}){return e.length<3?TW(e):GW(e.concat(e.slice(0,3)),t)}function qW(e){return e}function JW(e){return{x:e.y,y:e.x}}function YW(e){return Q(e.x,e.y)}function XW(e){return e<0?-1:1}function ZW(e){return e.filter((t,n)=>n===0||t.x!==e[n-1].x||t.y!==e[n-1].y)}function QW(e,t,n){return t===0?e/(n<0?-0:0):e/t}function $W(e,t,n,i){let a=(e*i+t*n)/(n+i);return(XW(e)+XW(t))*Math.min(Math.abs(e),Math.abs(t),.5*Math.abs(a))||0}function eG(e,t,n){return t===0?n:(e/t*3-n)/2}function tG(e){let t=e.length-1,n=Array(e.length);for(let i=1;i<t;i++){let t=e[i].x-e[i-1].x,a=e[i+1].x-e[i].x,o=QW(e[i].y-e[i-1].y,t,a),s=QW(e[i+1].y-e[i].y,a,t);n[i]=$W(o,s,t,a)}return n[0]=eG(e[1].y-e[0].y,e[1].x-e[0].x,n[1]),n[t]=eG(e[t].y-e[t-1].y,e[t].x-e[t-1].x,n[t-1]),n}function nG(e,t={}){let n=t.axis===`y`?JW:qW,i=ZW(e),a=i.map(n);if(a.length<3)return wW(i);{let e=tG(a),t=`M ${YW(i[0])}`;for(let i=0;i<a.length-1;i++){let o=a[i],s=a[i+1],c=(s.x-o.x)/3;t+=` C ${YW(n({x:o.x+c,y:o.y+c*e[i]}))} ${YW(n({x:s.x-c,y:s.y-c*e[i+1]}))} ${YW(n(s))}`}return t}}function rG(e){return nG(e,{axis:`x`})}function iG(e){return nG(e,{axis:`y`})}function aG(e){return e}function oG(e){return{x:e.y,y:e.x}}function sG(e){return Q(e.x,e.y)}function cG(e,t={}){let n=t.axis===`y`?oG:aG,i=e.map(n);if(i.length<2)return wW(e);{let t=`M ${sG(e[0])}`;for(let e=1;e<i.length;e++){let a=i[e-1],o=i[e],s=(a.x+o.x)/2;t+=` C ${sG(n({x:s,y:a.y}))} ${sG(n({x:s,y:o.y}))} ${sG(n(o))}`}return t}}function lG(e){return cG(e,{axis:`x`})}function uG(e){return cG(e,{axis:`y`})}const dG={auto:wW,basis:NW,"basis-closed":FW,"basis-open":PW,"bump-x":lG,"bump-y":uG,bundle:IW,cardinal:RW,"cardinal-closed":BW,"cardinal-open":zW,"catmull-rom":WW,"catmull-rom-closed":KW,"catmull-rom-open":GW,linear:wW,"linear-closed":TW,"monotone-x":rG,"monotone-y":iG,natural:AW,step:EW,"step-after":OW,"step-before":DW};function fG(e=`linear`,t={}){if(typeof e==`function`)return n=>e(n,t);{let n=dG[String(e).toLowerCase()];if(n)return e=>n(e,t);throw Error(`unknown curve: `+e)}}function pG(e={}){let t=e.top??[],n=e.bottom??[],i=fG(e.curve,e);if(t.length===0)return``;{let e=i(n.slice().reverse());return i(t)+` `+e.replace(/^M /,`L `)+` Z`}}let mG=0;function hG(e){return t=>{let n=_R(`marker`,{viewBox:`-5 -5 10 10`,markerWidth:6.67,markerHeight:6.67,orient:e,fill:`none`,stroke:t,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`});return n.appendChild(TR({d:`M-1.5,-3l3,3l-3,3`})),n}}function gG(e){let t=_R(`marker`,{viewBox:`-5 -5 10 10`,markerWidth:6.67,markerHeight:6.67,fill:e,stroke:`none`});return t.appendChild(wR({r:2.5})),t}function _G(e){let t=_R(`marker`,{viewBox:`-5 -5 10 10`,markerWidth:6.67,markerHeight:6.67,fill:e,stroke:$.background,strokeWidth:1.5});return t.appendChild(wR({r:3})),t}function vG(e){let t=_R(`marker`,{viewBox:`-5 -5 10 10`,markerWidth:6.67,markerHeight:6.67,fill:$.background,stroke:e,strokeWidth:1.5});return t.appendChild(wR({r:3})),t}function yG(e){return t=>{let n=_R(`marker`,{viewBox:`-3 -3 6 6`,markerWidth:6,markerHeight:6,orient:e,stroke:t});return n.appendChild(TR({d:`M0,-3v6`})),n}}const bG={arrow:hG(`auto`),"arrow-reverse":hG(`auto-start-reverse`),dot:gG,circle:_G,"circle-fill":_G,"circle-stroke":vG,tick:yG(`auto`),"tick-x":yG(90),"tick-y":yG(0)};function xG(e){if(e!=null&&e!==!1&&e!==`none`)return e===!0?_G:typeof e==`function`?e:bG[String(e).toLowerCase()]}function SG(e){let t=e.marker;return{start:xG(e.markerStart??t),mid:xG(e.markerMid??t),end:xG(e.markerEnd??t)}}function CG(e,t,n,i){t.has(n)===!1&&t.set(n,new Map);let a=t.get(n);if(a.has(i)===!1){let t=n(i),o=`plot-marker-`+ ++mG;t.setAttribute(`id`,o),e.appendChild(t),a.set(i,`url(#`+o+`)`)}return a.get(i)}function wG(e,t,n,i){let a={};return t.start&&(a.markerStart=CG(e,n,t.start,i)),t.mid&&(a.markerMid=CG(e,n,t.mid,i)),t.end&&(a.markerEnd=CG(e,n,t.end,i)),a}function TG(e,t,n){let i=t?e.x:e.y,a=e.fill!==void 0&&e.fill===i;if(!(e.z===null||e.z===void 0&&a))return e.z??n}function EG(e,t={}){let n=MB(t),i=BB(n.fill,$.fill),a=n.x1!==void 0||n.x2!==void 0,o=TG(n,a,i.value),s=a?`y`:`x`,c=a?`x`:`y`,l=a?n.x2??n.x:n.y2??n.y,u=a?n.x1:n.y1;return XV({type:`area`,data:e,options:n,channels:{[s]:{value:n[s],scale:s},[c]:{value:l,scale:c,zero:u===void 0},[c+`1`]:u===void 0?void 0:{value:u,scale:c,zero:!0},[c+`2`]:{value:n[c+`2`],scale:c},z:o===void 0?void 0:{value:o},...$V(n,{fill:$.fill,fillOpacity:.8})},render(e,t,i,o){let l=bR(),u=rH(t[s]),d=t[c](0),f=SG(n),p=new Map,m=(e,t)=>a?{x:t,y:e}:{x:e,y:t},h=i[c+`1`],g=i[c+`2`]??i[c],_=e=>Number.isFinite(i[s][e])&&Number.isFinite(g[e]);for(let t of oH(e,i.z)){let e=[...t].sort((e,t)=>i[s][e]-i[s][t]);for(let t of aH(e,i)){let e=iH(t,_).map(e=>pG({top:e.map(e=>m(i[s][e]+u,g[e])),bottom:e.map(e=>m(i[s][e]+u,h?h[e]:d)),curve:n.curve,tension:n.tension})),a=tH(i,t[0]);l.appendChild(TR({d:e.join(` `),...a,...wG(l,f,p,a.stroke)}))}}return l}})}function DG(e,t={}){return XV({type:`boxY`,data:e,options:t,channels:{x:{value:t.x,scale:`x`,type:`band`},y:{value:t.y??AB,scale:`y`,zero:!0},...$V(t,{fill:$.boxFill,stroke:$.stroke})},render(e,n,i,a,o){let s=bR(),c=n.x&&n.x.bandwidth?n.x.bandwidth():a.width,l=c*$.boxWidth,u=(c-l)/2,d=new Map;for(let t of e){let e=i.x?i.x[t]:0;d.has(e)?d.get(e).push(t):d.set(e,[t])}for(let[e,t]of d)f(s,e,t);return s;function f(e,a,s){let d=s.map(e=>o.raw.y[e]),f=pz(d,.25),p=pz(d,.5),m=pz(d,.75),h=m-f,g=d.filter(e=>e>=f-h*1.5&&e<=m+h*1.5),_=a+c/2,v=tH(i,s[0]);e.appendChild(SR({x1:_,x2:_,y1:n.y(cz(g)),y2:n.y(lz(g)),stroke:v.stroke,strokeOpacity:v.strokeOpacity,opacity:v.opacity})),e.appendChild(xR({x:a+u,y:n.y(m),width:l,height:Math.abs(n.y(f)-n.y(m)),fill:v.fill,fillOpacity:v.fillOpacity,opacity:v.opacity})),e.appendChild(SR({x1:a+u,x2:a+u+l,y1:n.y(p),y2:n.y(p),stroke:v.stroke,strokeOpacity:v.strokeOpacity,opacity:v.opacity,strokeWidth:$.medianStrokeWidth}));for(let i of d)g.includes(i)===!1&&e.appendChild(wR({cx:_,cy:n.y(i),r:t.r??$.dotRadius,fill:`none`,stroke:v.stroke,strokeOpacity:v.strokeOpacity,opacity:v.opacity}))}}})}function OG(e,t){let n=t[e],i=(typeof n==`object`&&n?n.interval:void 0)??t.interval,a=t[e+`1`]!==void 0||t[e+`2`]!==void 0;if(n==null||i===void 0||a)return t;{let a=KB(i),o=LB(n),s=zB(n),c=(e,t)=>a.floor(o(e,t));return{...t,[e]:void 0,[e+`1`]:{value:c,label:s},[e+`2`]:{value:(e,t)=>a.offset(c(e,t)),label:s}}}}function kG(e){let{interval:t,...n}=e;return n}function AG(e){return kG(OG(`x`,e))}function jG(e){return kG(OG(`y`,e))}function MG(e){return kG(OG(`x`,OG(`y`,e)))}function NG(e,t={}){let n=MG(MB(t)),i=n.x===void 0&&n.y===void 0,a=i?e=>e[0]:n.x,o=i?e=>e[1]:n.y,s=n.inset??0,c=n.insetTop??s,l=n.insetRight??s,u=n.insetBottom??s,d=n.insetLeft??s;return XV({type:`cell`,data:e,options:n,channels:{x:{value:a,scale:`x`,type:`band`},y:{value:o,scale:`y`,type:`band`},...$V(n,{fill:$.fill})},render(e,t,i,a){let o=bR(),s=t.x?.bandwidth?t.x.bandwidth():a.width,f=t.y?.bandwidth?t.y.bandwidth():a.height;for(let t of e)o.appendChild(xR({x:(i.x?i.x[t]:0)+d,y:(i.y?i.y[t]:0)+c,width:s-d-l,height:f-c-u,rx:n.rx,ry:n.ry,...tH(i,t)}));return o}})}function PG(e,t={}){let n={...t,x:(e,t)=>t};return t.fill===void 0&&t.stroke===void 0&&(n.fill=AB),NG(e,n)}function FG(e){let t=e.symbol;if(t!==void 0)return typeof t==`string`&&cV.includes(t)?{constant:t}:{value:t,scale:`symbol`,hint:e.fill===void 0?`stroke`:`fill`}}function IG(e,t={}){let n=MB(t),i=n.r!==void 0&&n.sort===void 0&&n.reverse===void 0?{...n,sort:{channel:`-r`}}:n;return XV({type:`dot`,data:e,options:i,channels:{x:{value:i.x,scale:`x`},y:{value:i.y,scale:`y`},r:VB(i.r,$.dotRadius,`r`),symbol:FG(i),...$V(i,{fill:`none`,stroke:$.stroke,strokeWidth:$.strokeWidth})},render(e,t,n,i){let a=bR(),o=rH(t.x),s=rH(t.y);for(let t of e){let e=n.x?n.x[t]+o:i.width/2,c=n.y?n.y[t]+s:i.height/2;n.symbol?a.appendChild(TR({d:dV(n.symbol[t],Math.PI*n.r[t]*n.r[t]),transform:`translate(${oR(e)}, ${oR(c)})`,strokeLinecap:`round`,strokeLinejoin:`round`,...tH(n,t)})):a.appendChild(wR({cx:e,cy:c,r:n.r[t],...tH(n,t)}))}return a}})}function LG(e,t={}){return IG(e,{x:AB,...t})}function RG(e,t={}){return IG(e,{y:AB,...t})}function zG(e={}){return XV({type:`frame`,facet:!1,layer:-1,options:e,render(t,n,i,a){return xR({x:0,y:0,width:a.width,height:a.height,fill:e.fill??`none`,stroke:e.stroke??$.frameStroke,strokeOpacity:e.strokeOpacity??$.frameStrokeOpacity,rx:e.rx,ry:e.ry})}})}const BG=Math.PI,VG=BG/2;function HG(e,t,n,i){let a=Math.sin(e-n);if(Math.abs(a)>1e-6){let o=Math.cos(t),s=Math.cos(i);return Math.atan((Math.sin(t)*s*Math.sin(n)-Math.sin(i)*o*Math.sin(e))/(o*s*a))}return(t+i)/2}function UG(e,t){let n=[],i=[],a=0;for(let t=0;t<e.length;t++){let[o,s]=e[t];if(t>0){let[c,l]=e[t-1],u=o-c;if(a+=u>BG?u-2*BG:u<-BG?u+2*BG:u,Math.abs(u)>BG){let e=c<o?-BG:BG,t=HG(c,l,o,s);i.push([e,t]),n.push(i),i=[[-e,t]]}}i.push([o,s])}return n.push(i),n.length===1?n:t?WG(n,a):n}function WG(e,t){let n=[[...e[e.length-1].slice(0,-1),...e[0]],...e.slice(1,-1)];if(Math.abs(t)>BG){let e=t>0?-VG:VG;for(let t of n){let n=t[0],i=t[t.length-1];t.push([i[0],e],[n[0],e])}}return n}function GG(e,t,n){let i=Math.cos(t),a=e.map(([e,t])=>Math.cos(t)*Math.cos(e)>i);if(a.every(e=>e))return[e];if(a.every(e=>e===!1))return[];{let i=[],o=[];for(let n=0;n<e.length;n++){let s=n===0?e.length-1:n-1;a[n]&&a[s]===!1&&(o=[KG(e[s],e[n],t)]),a[n]&&o.push(e[n]),a[n]===!1&&a[s]&&(o.push(KG(e[n],e[s],t)),i.push(o),o=[])}if(o.length>0&&i.push(o),n)for(let e of i)e.push(...JG(e[e.length-1],e[0],t));return i}}function KG(e,t,n){let i=0,a=1;for(let o=0;o<24;o++){let o=(i+a)/2,s=qG(e,t,o);Math.cos(s[1])*Math.cos(s[0])>Math.cos(n)?a=o:i=o}return qG(e,t,a)}function qG(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function JG(e,t,n){let i=Math.atan2(Math.sin(e[1]),Math.cos(e[1])*Math.sin(e[0])),a=Math.atan2(Math.sin(t[1]),Math.cos(t[1])*Math.sin(t[0]))-i;a>BG&&(a-=2*BG),a<-BG&&(a+=2*BG);let o=Math.max(2,Math.ceil(Math.abs(a)/.1)),s=[];for(let e=1;e<=o;e++){let t=i+a*e/o,c=Math.sin(n)*Math.sin(t),l=Math.sin(n)*Math.cos(t),u=Math.cos(n);s.push([Math.atan2(l,u),Math.asin(Math.max(-1,Math.min(1,c)))])}return s}const YG=Math.PI/180;function XG(e,t=3){let n=[];function i(t,i){for(let a of $G(e,t))a.length>1&&n.push(`M${a.map(([e,t])=>Q(e,t)).join(`L`)}${i?`Z`:``}`)}function a(t,n){for(let a of QG(e,t,n))i(a,n)}function o(i){let a=e.forward(ZG(e,i));if(a){let[e,i]=a,o=t;n.push(`M${Q(e+o,i)}A${oR(o)},${oR(o)} 0 1 1 ${Q(e-o,i)}A${oR(o)},${oR(o)} 0 1 1 ${Q(e+o,i)}Z`)}}function s(t){a(t.map(t=>ZG(e,t)),!0)}function c(t){a(t.map(t=>ZG(e,t)),!1)}function l(t){if(t){let n=t.type;n===`FeatureCollection`?t.features.forEach(l):n===`Feature`?l(t.geometry):n===`GeometryCollection`?t.geometries.forEach(l):n===`Point`?o(t.coordinates):n===`MultiPoint`?t.coordinates.forEach(o):n===`LineString`?c(t.coordinates):n===`MultiLineString`?t.coordinates.forEach(c):n===`Polygon`?t.coordinates.forEach(s):n===`MultiPolygon`?t.coordinates.forEach(e=>e.forEach(s)):n===`Sphere`&&i(nK(e),!0)}}return function(e){return n.length=0,l(e),n.join(``)}}function ZG(e,t){return e.planar?[t[0],t[1]]:e.rotate([t[0]*YG,t[1]*YG])}function QG(e,t,n){return e.planar?[t]:e.clipAngle===void 0?UG(t,n):GG(t,e.clipAngle,n)}function $G(e,t){let n=[],i=[];for(let a=0;a<t.length;a++){let o=e.forward(t[a]);o&&Number.isFinite(o[0])&&Number.isFinite(o[1])?i.length>0&&e.planar===!1?eK(e,t[a-1],t[a],i,16):i.push(o):i.length>0&&(n.push(i),i=[])}return i.length>0&&n.push(i),n}function eK(e,t,n,i,a){let o=i[i.length-1],s=e.forward(n),c=tK(t,n),l=e.forward(c);if(s===void 0||l===void 0)return;let u=s[0]-o[0],d=s[1]-o[1],f=u*u+d*d,p=(l[0]-o[0])*d-(l[1]-o[1])*u;a>0&&p*p>.5*f?(eK(e,t,c,i,a-1),eK(e,c,n,i,a-1)):i.push(s)}function tK(e,t){let[n,i]=e,[a,o]=t,s=Math.cos(i),c=Math.cos(o),l=Math.cos(n)*s+Math.cos(a)*c,u=Math.sin(n)*s+Math.sin(a)*c,d=Math.sin(i)+Math.sin(o),f=Math.sqrt(l*l+u*u+d*d);return f>0?[Math.atan2(u,l),Math.asin(Math.max(-1,Math.min(1,d/f)))]:[(n+a)/2,(i+o)/2]}function nK(e){let t=Math.PI,n=[];if(e.clipAngle!==void 0){let i=e.clipAngle;for(let e=0;e<=180;e++){let a=e/180*2*t,o=Math.sin(i)*Math.sin(a),s=Math.sin(i)*Math.cos(a);n.push([Math.atan2(s,Math.cos(i)),Math.asin(o)])}}else{for(let e=0;e<=90;e++)n.push([-t+2*t*e/90,t/2]);for(let e=0;e<=90;e++)n.push([t,t/2-t*e/90]);for(let e=0;e<=90;e++)n.push([t-2*t*e/90,-t/2]);for(let e=0;e<=90;e++)n.push([-t,-t/2+t*e/90])}return n}function rK(e,t={}){return XV({type:`geo`,data:e,options:t,channels:{geometry:{value:t.geometry??AB},...$V(t,{fill:`none`,stroke:$.stroke,strokeWidth:1})},render(e,n,i,a){let o=a.projection;if(o){let n=bR({strokeLinecap:`round`,strokeLinejoin:`round`}),a=XG(o,t.r??3);for(let t of e){let e=a(i.geometry[t]);e&&n.appendChild(TR({d:e,...tH(i,t)}))}return n}throw Error(`a geo mark needs a projection: Plot.plot({projection: "equirectangular", ...})`)}})}const iK=2.5;function aK(e,t,n){let i=[];for(let a=t;a<=n+1e-6;a+=iK)i.push([e,Math.min(n,a)]);return i}function oK(e,t,n){let i=[];for(let a=t;a<=n+1e-6;a+=iK)i.push([Math.min(n,a),e]);return i}function sK(){let e=[];for(let t=-180;t<=180;t+=10)Math.abs(t%90)>1e-6&&e.push(aK(t,-80,80));for(let t=-180;t<=180;t+=90)e.push(aK(t,-90,90));for(let t=-80;t<=80;t+=10)e.push(oK(t,-180,180));return{type:`MultiLineString`,coordinates:e}}const cK={type:`Sphere`};function lK(e={}){return rK(sK(),{strokeOpacity:.1,...e})}function uK(e={}){return rK(cK,{strokeWidth:1.5,...e})}function dK(e={}){let t=e.points??[];return fG(e.curve,e)(t)}function fK(e,t={}){let n=MB(t),i=BB(n.stroke,$.stroke),a=n.z===null?void 0:n.z??i.value;return XV({type:`line`,data:e,options:n,channels:{x:{value:n.x,scale:`x`},y:{value:n.y,scale:`y`},z:a===void 0?void 0:{value:a},...$V(n,{stroke:$.stroke,strokeWidth:$.strokeWidth})},render(e,t,i,a){let o=bR(),s=rH(t.x),c=rH(t.y),l=SG(n),u=new Map,d=e=>Number.isFinite(i.x[e])&&Number.isFinite(i.y[e]);for(let t of oH(e,i.z)){let e=n.sort===!1?t:[...t].sort((e,t)=>i.x[e]-i.x[t]);for(let t of aH(e,i)){let e=iH(t,d).map(e=>dK({points:e.map(e=>({x:i.x[e]+s,y:i.y[e]+c})),curve:n.curve,tension:n.tension})),a=tH(i,t[0]);o.appendChild(TR({d:e.join(` `),strokeLinejoin:`round`,strokeLinecap:`round`,...a,...wG(o,l,u,a.stroke)}))}}return o}})}function pK(e,t={}){return XV({type:`linearRegressionY`,data:e,options:t,channels:{x:{value:t.x,scale:`x`},y:{value:t.y,scale:`y`},...$V(t,{stroke:$.stroke,strokeWidth:$.strokeWidth})},render(e,t,n,i,a){if(e.length>1){let i=e.map(e=>a.raw.x[e]),o=e.map(e=>a.raw.y[e]),s=i.reduce((e,t)=>e+t,0)/i.length,c=o.reduce((e,t)=>e+t,0)/o.length,l=0,u=0;for(let e=0;e<i.length;e++)l+=(i[e]-s)*(o[e]-c),u+=(i[e]-s)**2;let d=u===0?0:l/u,f=c-d*s,[p,m]=sz(i),h=bR();return h.appendChild(SR({x1:t.x(p),y1:t.y(d*p+f),x2:t.x(m),y2:t.y(d*m+f),...tH(n,e[0])})),h}return null}})}function mK(e,t={}){let n=MG(t);return XV({type:`rect`,data:e,options:n,channels:{x1:{value:n.x1??n.x,scale:`x`,type:n.x===void 0?void 0:`band`},x2:{value:n.x2,scale:`x`},y1:{value:n.y1,scale:`y`,zero:!0},y2:{value:n.y2??n.y,scale:`y`,zero:!0},...$V(n,{fill:$.fill})},render(e,t,i,a){let o=bR(),s=t.x&&t.x.bandwidth?t.x.bandwidth():0,c=t.y===void 0,l=t.x===void 0,u=c?a.height:t.y(0),d=l?0:t.x(0),f=n.insetLeft??n.inset??0,p=n.insetRight??n.inset??0,m=n.insetTop??n.inset??0,h=n.insetBottom??n.inset??0;for(let t of e){let e=i.x1?i.x1[t]:l?0:i.x[t],g=i.x2?i.x2[t]:i.x1?e+s:l?a.width:d,_=i.y2?i.y2[t]:i.y?i.y[t]:c?0:u,v=i.y1?i.y1[t]:c?a.height:u;o.appendChild(xR({x:Math.min(e,g)+f,y:Math.min(_,v)+m,width:Math.max(0,Math.abs(g-e)-f-p),height:Math.max(0,Math.abs(v-_)-m-h),rx:n.rx,ry:n.ry,...tH(i,t)}))}return o}})}function hK(e,t={}){let n=jG(t);return XV({type:`ruleX`,data:e,options:n,channels:{x:{value:n.x??AB,scale:`x`},y1:{value:n.y1,scale:`y`},y2:{value:n.y2,scale:`y`},...$V(n,{stroke:$.stroke})},render(e,t,i,a){let o=bR(),s=SG(n),c=new Map,l=rH(t.x);for(let t of e){let e=i.x[t]+l;o.appendChild(SR({x1:e,x2:e,y1:i.y1?i.y1[t]:0,y2:i.y2?i.y2[t]:a.height,...tH(i,t),...wG(o,s,c,i.stroke?i.stroke[t]:void 0)}))}return o}})}function gK(e,t={}){let n=AG(t);return XV({type:`ruleY`,data:e,options:n,channels:{y:{value:n.y??AB,scale:`y`},x1:{value:n.x1,scale:`x`},x2:{value:n.x2,scale:`x`},...$V(n,{stroke:$.stroke})},render(e,t,i,a){let o=bR(),s=SG(n),c=new Map,l=rH(t.y);for(let t of e){let e=i.y[t]+l;o.appendChild(SR({x1:i.x1?i.x1[t]:0,x2:i.x2?i.x2[t]:a.width,y1:e,y2:e,...tH(i,t),...wG(o,s,c,i.stroke?i.stroke[t]:void 0)}))}return o}})}function _K(e,t={}){let n=t.symbol??`circle`,i=typeof n==`string`&&cV.includes(n);return XV({type:`symbol`,data:e,options:t,channels:{x:{value:t.x,scale:`x`},y:{value:t.y,scale:`y`},size:VB(t.size,64),shape:i?{constant:n}:{value:n},...$V(t,{fill:$.fill})},render(e,t,n,i){let a=bR(),o=rH(t.x),s=rH(t.y);for(let t of e)a.appendChild(TR({d:dV(n.shape[t],n.size[t]),transform:`translate(${oR(n.x[t]+o)}, ${oR(n.y[t]+s)})`,...tH(n,t)}));return a}})}function vK(e,t){return typeof e==`string`||typeof e==`number`?e:t}function yK(e,t={}){let n=MB(t),i=n.frameAnchor??`middle`;return XV({type:`text`,data:e,options:n,channels:{x:{value:n.x,scale:`x`},y:{value:n.y,scale:`y`},text:{value:t.text??t.y??vK},...$V(n.stroke===void 0?n:{strokeWidth:3,...n},{fill:$.fill})},render(e,t,a,o){let s=bR(),c=rH(t.x),l=rH(t.y),u=nH(i,o),d=n.lineHeight??1,f=Number(n.rotate??0);for(let t of e){let e=a.x?a.x[t]+c:u.x,o=a.y?a.y[t]+l:u.y,p=aU(String(a.text[t]),n.lineWidth??1/0),m=CR({x:e,y:o,transform:f===0?void 0:`rotate(`+f+`, `+oR(e)+`, `+oR(o)+`)`,textContent:p.length===1?p[0]:``,textAnchor:n.textAnchor??(/right$/.test(i)?`end`:/left$/.test(i)?`start`:`middle`),dominantBaseline:n.dominantBaseline??(/^top/.test(i)?`hanging`:/^bottom/.test(i)?`auto`:`middle`),fontSize:n.fontSize??$.fontSize,fontWeight:n.fontWeight,...tH(a,t),paintOrder:`stroke`,strokeLinejoin:`round`});if(p.length>1){let t=/^top/.test(i)?0:/^bottom/.test(i)?1-p.length:(1-p.length)/2;for(let n=0;n<p.length;n++)m.appendChild(ER({x:e,dy:(n===0?t:1)*d+`em`,textContent:p[n]}))}s.appendChild(m)}return s}})}function bK(e,t={}){return yK(e,{x:AB,...t})}function xK(e,t={}){return yK(e,{y:AB,...t})}function SK(e,t={}){let n=jG(t);return XV({type:`tickX`,data:e,options:n,channels:{x:{value:n.x??AB,scale:`x`},y:{value:n.y,scale:`y`,type:`band`},...$V(n,{stroke:$.stroke,strokeWidth:$.strokeWidth})},render(e,t,i,a){let o=bR(),s=SG(n),c=new Map,l=t.y&&t.y.bandwidth?t.y.bandwidth():a.height,u=(n.tickLength??l)/2,d=rH(t.y),f=rH(t.x);for(let t of e){let e=i.y?i.y[t]+d:a.height/2,n=i.x[t]+f;o.appendChild(SR({x1:n,x2:n,y1:e-u,y2:e+u,...tH(i,t),...wG(o,s,c,i.stroke?i.stroke[t]:void 0)}))}return o}})}function CK(e,t={}){let n=AG(t);return XV({type:`tickY`,data:e,options:n,channels:{y:{value:n.y??AB,scale:`y`},x:{value:n.x,scale:`x`,type:`band`},...$V(n,{stroke:$.stroke,strokeWidth:$.strokeWidth})},render(e,t,i,a){let o=bR(),s=SG(n),c=new Map,l=t.x&&t.x.bandwidth?t.x.bandwidth():a.width,u=(n.tickLength??l)/2,d=rH(t.x),f=rH(t.y);for(let t of e){let e=i.x?i.x[t]+d:a.width/2,n=i.y[t]+f;o.appendChild(SR({x1:e-u,x2:e+u,y1:n,y2:n,...tH(i,t),...wG(o,s,c,i.stroke?i.stroke[t]:void 0)}))}return o}})}const wK=$.vectorRadius*5;function TK(e,t){let n=e*t/wK;return`M0,0L0,`+-e+`M`+-n+`,`+(n-e)+`L0,`+-e+`L`+n+`,`+(n-e)}function EK(e,t){return`M`+-t+`,0L0,`+-e+`L`+t+`,0`}function DK(e,t){return e===`start`?0:e===`end`?t:t/2}function OK(e,t={}){let n=MB(t),i=n.anchor??`middle`,a=n.r??$.vectorRadius,o=n.shape===`spike`?EK:TK;return XV({type:`vector`,data:e,options:n,channels:{x:{value:n.x,scale:`x`},y:{value:n.y,scale:`y`},length:VB(n.length,$.vectorLength,`length`),rotate:VB(n.rotate,0),...$V(n,{fill:`none`,stroke:$.stroke,strokeWidth:$.strokeWidth})},render(e,t,s,c){let l=bR(),u=rH(t.x),d=rH(t.y),f=nH(n.frameAnchor,c);for(let t of e){let e=s.length[t],n=s.x?s.x[t]+u:f.x,c=s.y?s.y[t]+d:f.y;l.appendChild(TR({d:o(e,a),transform:`translate(${oR(n)}, ${oR(c)}) rotate(${oR(s.rotate[t])}) translate(0, `+DK(i,e)+`)`,strokeLinejoin:`round`,strokeLinecap:`round`,...tH(s,t)}))}return l}})}function kK(e,t={}){return OK(e,{x:AB,...t})}function AK(e,t={}){return OK(e,{y:AB,...t})}function jK(e,t={}){return OK(e,{strokeWidth:1,fill:t.stroke??$.stroke,fillOpacity:.3,...t,shape:`spike`,anchor:`start`})}const MK=.5;function NK(e,t,n){let i=n,a=n*1.5/Math.sqrt(3),o=(t-0)/a,s=Math.round(o),c=(e-MK)/i-(s&1)/2,l=Math.round(c),u=o-s;if(Math.abs(u)*3>1){let e=c-l,t=l+(c<l?-1:1)/2,n=s+(o<s?-1:1),i=c-t,a=o-n;e*e+u*u>i*i+a*a&&(l=t+(s&1?1:-1)/2,s=n)}return{key:l+`,`+s,x:(l+(s&1)/2)*i+MK,y:s*a+0}}function PK(e={fill:`count`},t={}){let n=t.binWidth??20,{binWidth:i,...a}=t;return{...a,fill:e.fill===void 0?a.fill:a.fill??[],symbol:a.symbol??`hexagon`,r:a.r??(e.r===void 0?n/2:void 0),rebin(t){let i=[`fx`,`fy`,`z`,`fill`,`stroke`,`symbol`].filter(n=>t.raw[n]!==void 0&&e[n]===void 0),a=new Map;for(let e=0;e<t.length;e++){let o=t.values.x[e],s=t.values.y[e];if(Number.isFinite(o)&&Number.isFinite(s)){let c=NK(o,s,n),l=i.map(n=>String(t.raw[n][e])).join(` `)+` `+c.key;a.has(l)?a.get(l).members.push(e):a.set(l,{hex:c,first:e,members:[e]})}}let o=t.scales.x===void 0||t.scales.y===void 0,s=[];for(let n of a.values()){let a=o?{x:n.hex.x,y:n.hex.y}:{x:t.scales.x.invert(n.hex.x),y:t.scales.y.invert(n.hex.y)};for(let e of i)a[e]=t.raw[e][n.first];for(let i of Object.keys(e)){let o=FU(e[i])??i,s=t.raw[o],c=s===void 0?n.members:n.members.map(e=>s[e]);a[i]=PU(e[i],c,n.members.map(e=>t.data[e]),s===void 0)}s.push(a)}let c={x:{value:`x`,scale:o?void 0:`x`,label:t.channels.x?.label},y:{value:`y`,scale:o?void 0:`y`,label:t.channels.y?.label}};for(let e of i)c[e]={...t.channels[e],value:e};for(let t of Object.keys(e))c[t]={value:t,scale:bU[t]??`color`,radius:t===`r`?n/2:void 0,label:IU(t,e[t])};for(let e of Object.keys(t.channels))c[e]===void 0&&t.channels[e].constant!==void 0&&(c[e]=t.channels[e]);return{data:s,channels:c,placed:o}}}}function FK(e={}){let t=e.binWidth??20;return XV({type:`hexgrid`,data:[0],facet:!1,options:e,channels:{},render(n,i,a,o){let s=t/2,c=s*2/Math.sqrt(3),l=c/2,u=s*2,d=c*1.5,f=Math.floor(-.5/u),p=Math.ceil((o.width-MK)/u),m=Math.floor((l-0)/d),h=Math.ceil((o.height-l-0)/d)+1,g=`m0,${oR(-c)}l${oR(s)},${oR(l)}v${oR(c)}l${oR(-s)},${oR(l)}`,_=g;for(let e=m;e<h;e++)for(let t=f;t<p;t++)_=_+`M`+oR(t*u+(e&1)*s)+`,`+oR(e*d)+g;let v=bR({transform:`translate(0.5, 0)`});return v.appendChild(TR({d:_,fill:`none`,stroke:e.stroke??$.axisStroke,strokeOpacity:e.strokeOpacity??.1})),v}})}function IK(e,t,n,i,a){return(e.x-t)*i+(e.y-n)*a}function LK(e,t,n,i,a){let o=i-t,s=a-n,c=(t+i)/2,l=(n+a)/2,u=[];for(let t=0;t<e.length;t++){let n=e[t],i=e[(t+1)%e.length],a=IK(n,c,l,o,s),d=IK(i,c,l,o,s);if(a<=0&&u.push(n),a<=0!=d<=0){let e=a/(a-d);u.push({x:n.x+(i.x-n.x)*e,y:n.y+(i.y-n.y)*e})}}return u}function RK(e,t){let n=[{x:t.x1,y:t.y1},{x:t.x2,y:t.y1},{x:t.x2,y:t.y2},{x:t.x1,y:t.y2}];return e.map((t,i)=>{let a=n;for(let n=0;n<e.length&&a.length>0;n++)if(n!==i){let o=e[n];o.x!==t.x||o.y!==t.y?a=LK(a,t.x,t.y,o.x,o.y):n<i&&(a=[])}return a.length>2?a:null})}function zK(e){let t=new Set,n=[],i=e=>Math.round(e*1e6)/1e6;for(let a of e)if(a)for(let e=0;e<a.length;e++){let o=a[e],s=a[(e+1)%a.length],c=[i(o.x)+`,`+i(o.y),i(s.x)+`,`+i(s.y)].sort().join(` `);t.has(c)===!1&&(t.add(c),n.push([o,s]))}return n}function BK(e,t={}){let n=MB(t);return XV({type:`voronoi`,data:e,options:n,channels:{x:{value:n.x,scale:`x`},y:{value:n.y,scale:`y`},z:{value:n.z},...$V(n,{stroke:$.axisStroke,fill:`none`})},render(e,t,n,i){let a=bR();for(let[o,s]of HK(e,t,n,i))s&&a.appendChild(TR({d:VK(s),strokeMiterlimit:1,...tH(n,o)}));return a}})}function VK(e){return`M `+e.map(e=>Q(e.x,e.y)).join(` L `)+` Z`}function HK(e,t,n,i){let a=rH(t.x),o=rH(t.y),s={x1:0,y1:0,x2:i.width,y2:i.height},c=e.filter(e=>Number.isFinite(n.x[e])&&Number.isFinite(n.y[e])),l=new Map;for(let e of c){let t=n.z?String(n.z[e]):``;l.has(t)?l.get(t).push(e):l.set(t,[e])}let u=[];for(let e of l.values()){let t=RK(e.map(e=>({x:n.x[e]+a,y:n.y[e]+o})),s);for(let n=0;n<e.length;n++)u.push([e[n],t[n]])}return u}function UK(e,t={}){let n=MB(t);return XV({type:`voronoiMesh`,data:e,options:n,channels:{x:{value:n.x,scale:`x`},y:{value:n.y,scale:`y`},z:{value:n.z},...$V({strokeOpacity:.2,...n},{stroke:$.axisStroke,fill:`none`})},render(e,t,n,i){let a=bR(),o=zK(HK(e,t,n,i).map(([,e])=>e)).map(([e,t])=>`M `+Q(e.x,e.y)+` L `+Q(t.x,t.y));return o.length>0&&a.appendChild(TR({d:o.join(` `),fill:`none`,...tH(n,e[0])})),a}})}let WK=0;function GK(e,t,n){if(e.length<2)return``;{let i=e[0],a=e[e.length-1];return dK({points:e,curve:n})+` L `+Q(a.x,t)+` L `+Q(i.x,t)+` Z`}}function KK(e,t={}){let n=t.x??((e,t)=>t);return XV({type:`differenceY`,data:e,options:t,channels:{x1:{value:t.x1??n,scale:`x`},x2:{value:t.x2??n,scale:`x`},y1:{value:t.y1??t.y,scale:`y`,zero:!0},y2:{value:t.y2??t.y,scale:`y`,zero:!0},...$V(t,{})},render(e,n,i,a){let o=bR(),s=rH(n.x),c=rH(n.y),l=e.filter(e=>Number.isFinite(i.x1[e])&&Number.isFinite(i.x2[e])&&Number.isFinite(i.y1[e])&&Number.isFinite(i.y2[e])),u=l.every(e=>i.x1[e]===i.x2[e]&&i.y1[e]===i.y2[e]),d=n.y(0),f=l.map(e=>({x:i.x1[e]+s,y:u?d:i.y1[e]+c})),p=l.map(e=>({x:i.x2[e]+s,y:i.y2[e]+c})),m=a.height,h=[{fill:t.positiveFill??`#3ca951`,clip:GK(p,m,t.curve),shape:GK(f,0,t.curve)},{fill:t.negativeFill??`#4269d0`,clip:GK(f,m,t.curve),shape:GK(p,0,t.curve)}];for(let e of h)if(e.clip!==``&&e.fill!==`none`){let n=`plot-difference-`+ ++WK,i=OR({id:n});i.appendChild(TR({d:e.clip})),o.appendChild(i),o.appendChild(TR({d:e.shape,fill:e.fill,fillOpacity:t.fillOpacity,clipPath:`url(#`+n+`)`}))}return t.stroke!==void 0&&t.stroke!==`none`&&o.appendChild(TR({d:dK({points:p,curve:t.curve}),fill:`none`,...tH(i,l[0])})),o}})}const qK={cumsum(e){let t=0;return e.map(e=>t+=Number(e))},rank:xz,quantile(e){let t=e.length-1;return xz(e).map(e=>t>0?e/t:0)}};function JK(e){if(typeof e==`function`)return e;if(qK[e])return qK[e];throw Error(`invalid map: `+e)}const YK={x1:`x`,x2:`x`,y1:`y`,y2:`y`};function XK(e={},t={}){let n=t.transform;return{...t,transform:CU(function(t,i){let a=n?wU(n,t,i):{data:t,channels:i},o=a.data,s=a.channels,c=typeof e==`function`?e(s):e,l=pU(o,s),u=xU(l,o.length),d={};for(let e of Object.keys(c)){let t=l[e]??l[YK[e]],n=JK(c[e]);d[e]=Array(o.length);for(let i of u){let a=n(i.map(e=>t[e]));for(let t=0;t<i.length;t++)d[e][i[t]]=a[t]}}let f=o.map((e,t)=>{let n=mU(l,t);for(let e of Object.keys(d))n[e]=d[e][t];return n}),p={};for(let e of Object.keys(c))s[e]===void 0&&(p[e]={...s[YK[e]],value:e,label:null,scale:bU[e]});return{data:f,channels:hU(s,p)}})}}function ZK(e,t={}){return $K([`x`,`x1`,`x2`],e,t)}function QK(e,t={}){return $K([`y`,`y1`,`y2`],e,t)}function $K(e,t,n){return XK(function(n){let i=e.filter(e=>n[e]!==void 0&&n[e].value!==void 0),a=i.length>0?i:[e[0]],o={};for(let e of a)o[e]=t;return o},e.some(e=>n[e]!==void 0)||n.transform!==void 0?n:{...n,[e[0]]:e=>e})}const eq={sum:uz,mean:fz,median:mz,min:cz,max:lz,deviation:hz,variance:yz,mode:bz,first:e=>e[0],last:e=>e[e.length-1],difference:e=>Number(e[e.length-1])-Number(e[0]),ratio:e=>Number(e[e.length-1])/Number(e[0])};function tq(e=`mean`){if(typeof e==`function`)return e;if(/^p\d{2}$/i.test(e))return t=>pz(t,Number(e.slice(1))/100);if(eq[e])return eq[e];throw Error(`invalid reduce: `+e)}function nq(e,t,n){let i=e??{centered:`middle`,leading:`start`,trailing:`end`}[t]??`middle`;if(i===`middle`)return n-1>>1;if(i===`start`)return 0;if(i===`end`)return n-1;throw Error(`invalid anchor: `+i)}function rq(e={}){let t=typeof e==`number`?{k:e}:e,n=Math.floor(t.k??7);if(!(n>0))throw Error(`invalid k: `+t.k);let i=nq(t.anchor,t.shift,n),a=tq(t.reduce),o=t.strict===!0;return function(e){let t=Array(e.length);if(o)for(let o=0;o+n<=e.length;o++)t[o+i]=a(e.slice(o,o+n));else for(let o=-i;o<e.length-i;o++)t[o+i]=a(e.slice(Math.max(0,o),o+n));return t}}function iq(e={}){let t=e.n??20,n=e.k??0;return rq({k:t,reduce:e=>fz(e)+n*(hz(e)||0),strict:e.strict??!0,anchor:e.anchor??`end`})}function aq(e,t={}){let{n,k:i=2,strict:a,anchor:o,color:s=`currentColor`,opacity:c=.2,...l}=t,u=t.x??AB,d={n,strict:a,anchor:o},f=l.fill??s,p=l.stroke??s,m=[];return f!==`none`&&m.push(EG(e,XK({x1:iq({...d,k:-i}),x2:iq({...d,k:i})},{...l,y:t.y,x1:u,x2:u,fill:f,fillOpacity:l.fillOpacity??c,stroke:`none`}))),p!==`none`&&m.push(fK(e,XK({x:iq(d)},{...l,y:t.y,x:u,stroke:p,fill:`none`}))),m}function oq(e,t={}){let{n,k:i=2,strict:a,anchor:o,color:s=`currentColor`,opacity:c=.2,...l}=t,u=t.y??AB,d={n,strict:a,anchor:o},f=l.fill??s,p=l.stroke??s,m=[];return f!==`none`&&m.push(EG(e,XK({y1:iq({...d,k:-i}),y2:iq({...d,k:i})},{...l,x:t.x,y1:u,y2:u,fill:f,fillOpacity:l.fillOpacity??c,stroke:`none`}))),p!==`none`&&m.push(fK(e,XK({y:iq(d)},{...l,x:t.x,y:u,stroke:p,fill:`none`}))),m}function sq(e,t={}){return XV({type:`link`,data:e,options:t,channels:{x1:{value:t.x1??t.x,scale:`x`},y1:{value:t.y1??t.y,scale:`y`},x2:{value:t.x2??t.x1??t.x,scale:`x`},y2:{value:t.y2??t.y1??t.y,scale:`y`},...$V(t,{stroke:$.stroke,fill:`none`})},render(e,n,i){let a=bR(),o=SG(t),s=new Map,c=rH(n.x),l=rH(n.y);for(let n of e){let e=[{x:i.x1[n]+c,y:i.y1[n]+l},{x:i.x2[n]+c,y:i.y2[n]+l}],u=tH(i,n);e.every(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))&&a.appendChild(TR({d:dK({points:e,curve:t.curve}),fill:`none`,...u,...wG(a,o,s,u.stroke)}))}return a}})}function cq(e){return{id:e,data:void 0,parent:null,children:[],depth:0,height:0,x:0,y:0}}function lq(e){let t=String(e),n=t.endsWith(`/`)&&t.endsWith(`\\/`)===!1?t.slice(0,-1):t;return n.startsWith(`/`)?n:`/`+n}function uq(e){let t=e.length;if(t<2)return``;for(;--t>1&&(e[t]!==`/`||e[t-1]===`\\`););return e.slice(0,t)}function dq(e){return e.slice(uq(e).length).replace(/^\//,``).replace(/\\\//g,`/`)}function fq(e,t){let n=new Map,i=e=>(n.has(e)===!1&&n.set(e,cq(e)),n.get(e));for(let a=0;a<e.length;a++){let o=lq(t(e[a],a));i(o).data=e[a];let s=o,c=uq(s);for(;c!==``;){let e=i(c),t=n.get(s);t.parent===null&&(t.parent=e,e.children.push(t)),s=c,c=uq(s)}}let a=n.get(`/`)??cq(`/`);for(;a.data===void 0&&a.children.length===1;)a=a.children[0];return a.parent=null,pq(a,e=>{e.depth=e.parent===null?0:e.parent.depth+1}),mq(a,e=>{e.height=e.children.length===0?0:1+Math.max(...e.children.map(e=>e.height))}),a}function pq(e,t){let n=[e];for(;n.length>0;){let e=n.pop();t(e);for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}}function mq(e,t){let n=[e],i=[];for(;n.length>0;){let e=n.pop();i.push(e);for(let t of e.children)n.push(t)}for(let e=i.length-1;e>=0;e--)t(i[e])}function hq(e){let t=[];return pq(e,e=>t.push(e)),t}function gq(e){return hq(e).filter(e=>e.parent!==null).map(e=>({source:e.parent,target:e}))}function _q(e,t){mq(e,e=>e.children.sort(t))}function vq(e,t){return e.parent===t.parent?1:2}function yq(e,t){return{node:e,position:t,parent:null,children:[],ancestor:null,thread:null,z:0,m:0,c:0,s:0}}function bq(e){let t=yq(e,0);t.ancestor=t;let n=[t];for(;n.length>0;){let e=n.pop();for(let t=0;t<e.node.children.length;t++){let i=yq(e.node.children[t],t);i.ancestor=i,i.parent=e,e.children.push(i),n.push(i)}}let i=yq(null,0);return i.ancestor=i,i.children=[t],t.parent=i,t}function xq(e){return e.children.length>0?e.children[0]:e.thread}function Sq(e){return e.children.length>0?e.children[e.children.length-1]:e.thread}function Cq(e,t,n){let i=n/(t.position-e.position);t.c-=i,t.s+=n,e.c+=i,t.z+=n,t.m+=n}function wq(e){let t=0,n=0;for(let i=e.children.length-1;i>=0;i--){let a=e.children[i];a.z+=t,a.m+=t,n+=a.c,t=t+a.s+n}}function Tq(e,t,n){return e.ancestor.parent===t.parent?e.ancestor:n}function Eq(e,t,n){if(t===null)return n;{let i=e,a=e,o=t,s=i.parent.children[0],c=i.m,l=a.m,u=o.m,d=s.m,f=n;for(o=Sq(o),i=xq(i);o&&i;){s=xq(s),a=Sq(a),a.ancestor=e;let t=o.z+u-i.z-c+vq(o.node,i.node);t>0&&(Cq(Tq(o,e,f),e,t),c+=t,l+=t),u+=o.m,c+=i.m,d+=s.m,l+=a.m,o=Sq(o),i=xq(i)}return o&&Sq(a)===null&&(a.thread=o,a.m=a.m+u-l),i&&xq(s)===null&&(s.thread=i,s.m=s.m+c-d,f=e),f}}function Dq(e,t){let n=[],i=[e];for(;i.length>0;){let e=i.pop();n.push(e);for(let t of e.children)i.push(t)}for(let e=n.length-1;e>=0;e--)t(n[e])}function Oq(e,t){let n=[e];for(;n.length>0;){let e=n.pop();t(e);for(let t=e.children.length-1;t>=0;t--)n.push(e.children[t])}}function kq(e){let t=bq(e);return Dq(t,function(e){let t=e.parent.children,n=e.position>0?t[e.position-1]:null;if(e.children.length>0){wq(e);let t=(e.children[0].z+e.children[e.children.length-1].z)/2;n?(e.z=n.z+vq(e.node,n.node),e.m=e.z-t):e.z=t}else n&&(e.z=n.z+vq(e.node,n.node));e.parent.ancestor=Eq(e,n,e.parent.ancestor??t[0])}),t.parent.m=-t.z,Oq(t,function(e){e.node.x=e.z+e.parent.m,e.m+=e.parent.m}),pq(e,e=>{e.y=e.depth}),e}function Aq(e){let t=null,n=0;mq(e,e=>{e.children.length>0?(e.x=(e.children[0].x+e.children[e.children.length-1].x)/2,e.y=Math.max(...e.children.map(e=>e.y))+1):(n=t===null?0:n+vq(e,t),e.x=n,e.y=0,t=e)});let i=e.x,a=e.y;return pq(e,e=>{e.x-=i,e.y=a-e.y}),e}const jq={tree:kq,cluster:Aq},Mq={left:{dx:6,position:e=>({x:e.y,y:-e.x})},right:{dx:-6,position:e=>({x:-e.y,y:-e.x})}};function Nq(e=`left`){if(Mq[e])return Mq[e];throw Error(`invalid tree anchor: `+e)}const Pq={name:e=>dq(e.id),path:e=>e.id,depth:e=>e.depth,height:e=>e.height,internal:e=>e.children.length>0||void 0,external:e=>e.children.length>0?void 0:!0};function Fq(e){if(typeof e==`string`&&(e.startsWith(`node:`)||e.startsWith(`parent:`))){let[t,n]=e.split(`:`),i=Pq[n];if(i===void 0)throw Error(`invalid node value: `+e);return{side:t,read:i}}}function Iq(e){if(e!=null){if(typeof e==`function`)return e;{let t=Fq(e),n=t?t.read:t=>t.data?.[e];return(e,t)=>oz(n(e),n(t))}}}function Lq(e,t){let n=RB(e,t.path??AB),i=t.delimiter??`/`,a=fq(e.map((e,t)=>t),e=>i===`/`?String(n[e]):String(n[e]).split(i).join(`/`)),o=Iq(t.treeSort);return o&&_q(a,(e,t)=>o(e,t)),(typeof t.treeLayout==`function`?t.treeLayout:jq[t.treeLayout??`tree`])(a),a}function Rq(e={}){let t=Nq(e.treeAnchor);return{...e,curve:e.curve??`bump-x`,stroke:e.stroke??`currentColor`,strokeWidth:e.strokeWidth??1.5,strokeOpacity:e.strokeOpacity??.5,transform:CU(function(n,i){let a=Lq(n,e),o=pU(n,i),s={};for(let e of Object.keys(i)){let t=Fq(i[e].value);t&&(s[e]=t)}let c=[];for(let{source:e,target:n}of gq(a)){let i=n.data===void 0?{}:mU(o,n.data),a=t.position(e),l=t.position(n);i.x1=a.x,i.y1=a.y,i.x2=l.x,i.y2=l.y;for(let t of Object.keys(s))i[t]=s[t].read(s[t].side===`parent`?e:n);c.push(i)}let l=hU(i,{x1:{value:`x1`,scale:`x`,label:null},y1:{value:`y1`,scale:`y`,label:null},x2:{value:`x2`,scale:`x`,label:null},y2:{value:`y2`,scale:`y`,label:null}});for(let e of Object.keys(s))l[e]={...l[e],value:e,label:null};return{data:c,channels:l}})}}function zq(e={}){let t=Nq(e.treeAnchor);return{...e,dx:e.dx??t.dx,transform:CU(function(n,i){let a=Lq(n,e),o=pU(n,i),s={};for(let e of Object.keys(i)){let t=Fq(i[e].value);t&&(s[e]=t.read)}let c=Fq(e.treeFilter),l=[];for(let e of hq(a).filter(e=>c===void 0||c.read(e))){let n=e.data===void 0?{}:mU(o,e.data),i=t.position(e);n.x=i.x,n.y=i.y;for(let t of Object.keys(s))n[t]=s[t](e);l.push(n)}let u=hU(i,{x:{value:`x`,scale:`x`,label:null},y:{value:`y`,scale:`y`,label:null}});for(let e of Object.keys(s))u[e]={...u[e],value:e,label:null};return{data:l,channels:u}})}}function Bq(e,t={}){let n=t.dx??Nq(t.treeAnchor).dx,i={path:t.path,delimiter:t.delimiter,treeLayout:t.treeLayout,treeAnchor:t.treeAnchor,treeSort:t.treeSort},a=(n,a,o)=>yK(e,zq({...i,text:t.text??`node:name`,fill:t.fill??`currentColor`,treeFilter:n,textAnchor:a,dx:o,dy:t.dy}));return[sq(e,Rq({...i,stroke:t.stroke,strokeWidth:t.strokeWidth,curve:t.curve})),IG(e,zq({...i,fill:t.fill??`node:internal`,r:t.r})),a(`node:external`,`start`,n),a(`node:internal`,`end`,-n)]}function Vq(e,t={}){return Bq(e,{treeLayout:`cluster`,...t})}function Hq(e){let t=!1;if(e){for(let n of e)if(n!=null){let e=typeof n;t=e===`string`||e===`boolean`;break}}return t}function Uq(e){let t=!1;if(e){for(let n of e)if(n!=null){t=typeof n==`number`;break}}return t}function Wq(e){let t=!0;if(e){let n,i;for(let a of e)if(a!=null){if(n===void 0)n=a;else{let e=Math.sign(oz(n,a));if(e){if(i!==void 0&&e!==i){t=!1;break}n=a,i=e}}}}return t}function Gq(e){let t=!1;return e&&(t=new Set(e).size>e.length>>1),t}function Kq(e){return e?.toString===Object.prototype.toString}function qq(e){return Kq(e)&&typeof e.transform!=`function`}function Jq(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function Yq(e){return/^(?:first|last|mode)$/i.test(e)}function Xq(e){return e==null||typeof e==`function`?!1:Kq(e)&&typeof e.reduce==`function`||/^p\d{2}$/i.test(e)?!0:`${e}`.toLowerCase()in NU}function Zq(e){return Xq(e)?{reduce:e}:{value:e}}function Qq(e={}){let{x:t,y:n,color:i,size:a,fx:o,fy:s,mark:c}=e;return qq(t)===!1&&(t=Zq(t)),qq(n)===!1&&(n=Zq(n)),qq(i)===!1&&(i=typeof i==`string`&&CB(i)?{color:i}:Zq(i)),qq(a)===!1&&(a=Zq(a)),qq(o)&&(o=o.value),qq(s)&&(s=s.value),c!=null&&(c=`${c}`.toLowerCase()),{x:t,y:n,color:i,size:a,fx:o,fy:s,mark:c}}function $q(e,t){let n;return t.value!==null&&t.value!==void 0&&(n=RB(e,t.value),n.label=zB(t.value)),n}function eJ(e){let{sizeValue:t,sizeReduce:n,xValue:i,yValue:a,xReduce:o,yReduce:s,colorReduce:c,X:l,Y:u}=e;if(t!==null||n!==null)return`dot`;if(Jq(o)||Jq(s)||c!==null)return`bar`;if(i!==null&&a!==null){let e=Hq(l)||Hq(u),t=o===null&&s===null&&Wq(l)===!1&&Wq(u)===!1;return e||t?`dot`:`line`}return`rule`}function tJ(e){let{X:t,Y:n,xZero:i,yZero:a,xReduce:o,yReduce:s}=e;return t&&n||o!==null||s!==null?a||s!==null||t&&Wq(t)?`lineY`:i||o!==null||n&&Wq(n)?`lineX`:`line`:t?`lineX`:`lineY`}function nJ(e){let{X:t,Y:n,xReduce:i,yReduce:a,colorReduce:o,sizeReduce:s}=e;return i===null?a===null?o!==null||s!==null?t&&Hq(t)&&n&&Hq(n)?`cell`:t&&Hq(t)?`barY`:n&&Hq(n)?`barX`:`rect`:t&&Uq(t)&&(n&&Uq(n))===!1?`barX`:n&&Uq(n)&&(t&&Uq(t))===!1?`barY`:`cell`:Hq(t)?Yq(a)&&n&&Hq(n)?`cell`:`barY`:`rectY`:Hq(n)?Yq(i)&&t&&Hq(t)?`cell`:`barX`:`rectX`}function rJ(e){let{X:t,Y:n,xReduce:i,yReduce:a,colorReduce:o,sizeReduce:s}=e;if(a!==null)return Hq(t)?`groupX`:`binX`;if(i!==null)return Hq(n)?`groupY`:`binY`;if(o!==null||s!==null)return t&&n?Hq(t)&&Hq(n)?`group`:Hq(t)?`binY`:Hq(n)?`binX`:`bin`:t?Hq(t)?`groupX`:`binX`:n?Hq(n)?`groupY`:`binY`:void 0}const iJ=new Set([`barX`,`areaX`,`rectX`,`ruleY`]),aJ=new Set([`barY`,`areaY`,`rectY`,`ruleX`]);function oJ(e,t){let n=Qq(t),i=$q(e,n.x),a=$q(e,n.y),o=$q(e,n.color),s=$q(e,n.size),{fx:c,fy:l}=n,{value:u=null,reduce:d,zero:f,...p}=n.x,{value:m=null,reduce:h,zero:g,..._}=n.y,{value:v=null,color:y,reduce:b}=n.color,{value:x=null,reduce:S}=n.size,C=b??null,w=d??null;d===void 0&&(w=(h??null)===null&&u===null&&x===null&&m!==null?`count`:null);let T=h??null;h===void 0&&(T=w===null&&m===null&&x===null&&u!==null?`count`:null);let E=S??null;if(S===void 0){let e=x===null&&C===null&&w===null&&T===null,t=(u===null||Hq(i))&&(m===null||Hq(a));E=e&&t?`count`:null}let D=f;f===void 0&&Jq(w)&&(D=!0);let O=g;if(g===void 0&&Jq(T)&&(O=!0),u===null&&m===null)throw Error(`must specify x or y`);if(w!==null&&m===null)throw Error(`reducing x requires y`);if(T!==null&&u===null)throw Error(`reducing y requires x`);if(w!==null&&T!==null)throw Error(`cannot reduce both x and y`);let ee={X:i,Y:a,C:o,S:s,xValue:u,yValue:m,sizeValue:x,xReduce:w,yReduce:T,colorReduce:C,sizeReduce:E,xZero:D,yZero:O},te=n.mark??eJ(ee),k,ne,re=!1;if(te===`dot`)k=`dot`,ne=`stroke`;else if(te===`line`)k=tJ(ee),ne=`stroke`,re=Gq(o);else if(te===`area`)k=(O||T!==null)===!1&&(D||w!==null||a&&Wq(a))?`areaX`:`areaY`,ne=`fill`,re=Gq(o);else if(te===`rule`)k=i?`ruleX`:`ruleY`,ne=`stroke`;else if(te===`bar`)k=nJ(ee),ne=`fill`;else throw Error(`invalid mark: ${te}`);let ie=rJ(ee),A=ie===`bin`||ie===`binX`,ae=ie===`bin`||ie===`binY`,oe={fx:c,fy:l,x:i??void 0,y:a??void 0,[ne]:o??y,z:re?null:void 0,r:s??void 0,tip:!0,...A?p:{},...ae?_:{}},se={[ne]:C??void 0,r:E??void 0};return T!==null&&(se.y=T),w!==null&&(se.x=w),D===void 0&&(D=!!i&&A===!1&&iJ.has(k)),O===void 0&&(O=!!a&&ae===!1&&aJ.has(k)),{fx:c??null,fy:l??null,x:{value:u,reduce:w,zero:!!D,...p},y:{value:m,reduce:T,zero:!!O,..._},color:{value:v,reduce:C,...y===void 0?{}:{color:y}},size:{value:x,reduce:E},mark:te,markImpl:k,markOptions:oe,transformImpl:ie,transformOptions:se,colorMode:ne}}function sJ(e,t){if(Number.isFinite(t)===!1)return-1;let n=-1;for(;n+1<e.length-1&&t>=e[n+1];)n+=1;return Math.max(0,n)}function cJ(e,t){let[n,i]=sz(e),a=qR(n??0,i??1,t??vz(e));return(a.length===0||a[0]>n)&&a.unshift(n??0),a[a.length-1]<i&&a.push(i??1),a}function lJ(e,t,n){let{filter:i,...a}=t,o=`filter`in t&&i===null;return{...n,transform:CU(function(t,i){let s={},c={};for(let i of e)c[i]=RB(t,n[i]),s[i]=cJ(c[i],n.thresholds);let l=e.map(e=>s[e].length-1),u=e=>e.reduce((e,t,n)=>e*l[n]+t,0),d=t=>{let n=Array(e.length),i=t;for(let t=e.length-1;t>=0;t--)n[t]=i%l[t],i=Math.floor(i/l[t]);return n},f=l.reduce((e,t)=>e*t,1),p={};for(let e of Object.keys(a)){let n=FU(a[e])??i[e]?.value;p[e]=n===void 0?void 0:RB(t,n)}let m=[`fill`,`stroke`,`fx`,`fy`,`z`].filter(e=>{let t=i[e];return t!==void 0&&t.value!==void 0&&a[e]===void 0}),h={};for(let e of m)h[e]=RB(t,i[e].value);let g=new Map,_=new Set;for(let n=0;n<t.length;n++){let t=e.map(e=>sJ(s[e],c[e][n]));if(t.every(e=>e>=0)){let e=m.map(e=>String(h[e][n])).join(` `);_.add(e);let i=e+` `+t.join(`,`);g.has(i)?g.get(i).members.push(n):g.set(i,{slots:t,seriesName:e,first:n,members:[n]})}}function v(t,n,i){return s[n][t.slots[e.indexOf(n)]+i-1]}let y={};for(let t of e)y[t]=e=>(v(e,t,1)+v(e,t,2))/2,y[t+`1`]=e=>v(e,t,1),y[t+`2`]=e=>v(e,t,2);function b(e){let t=[...g.values()].filter(t=>t.seriesName===e);if(o){let n=new Map(t.map(e=>[u(e.slots),e])),i=[];for(let a=0;a<f;a++)i.push(n.get(a)??{slots:d(a),seriesName:e,first:t[0]?.first??0,members:[]});return i}return t.sort((e,t)=>u(e.slots)-u(t.slots))}let x=[];for(let n of _)for(let i of b(n)){let n={};for(let t of e)n[t+`1`]=v(i,t,1),n[t+`2`]=v(i,t,2),n[t]=(n[t+`1`]+n[t+`2`])/2;for(let e of m)n[e]=h[e][i.first];for(let e of Object.keys(a)){let o=y[a[e]];if(o)n[e]=o(i);else{let o=p[e]===void 0?i.members:i.members.map(t=>p[e][t]);n[e]=PU(a[e],o,i.members.map(e=>t[e]),p[e]===void 0)}}x.push(n)}for(let e of Object.keys(a))if(LU(a[e])){let t=x.map(t=>t[e]);zU({[e]:t},e,RU(a[e]),x.map(e=>e.fx),x.map(e=>e.fy)),x.forEach((n,i)=>{n[e]=t[i]})}let S={};for(let t of e){let e=typeof n[t]==`string`?n[t]:void 0;S[t+`1`]={value:e=>e[t+`1`],scale:t,nice:!1,label:e},S[t+`2`]={value:e=>e[t+`2`],scale:t,nice:!1},S[t]={value:e=>e[t],scale:t,nice:!1,label:e}}for(let e of m)S[e]={...i[e],value:t=>t[e]};for(let t of Object.keys(a)){let n=y[a[t]]!==void 0,i=t.replace(/[12]$/,``),o=(i===`x`||i===`y`)&&e.includes(i)===!1;S[t]={value:e=>e[t],scale:o?i:bU[t]??`color`,zero:o&&!n,label:n?void 0:IU(t,a[t])}}for(let e of Object.keys(i))S[e]===void 0&&i[e].constant!==void 0&&(S[e]=i[e]);return{data:x,channels:S}})}}function uJ(e,t,n){let i=e.inset??e[t]??e[n];return{[t]:i??.5,[n]:i??.5}}function dJ(e={fill:`count`},t={}){let n=MB(t);return{...lJ([`x`,`y`],e,n),...uJ(n,`insetLeft`,`insetRight`),...uJ(n,`insetTop`,`insetBottom`)}}function fJ(e={y:`count`},t={}){let n={...t,x:t.x??AB},i=e.y1!==void 0||e.y2!==void 0;return{...lJ([`x`],e,n),...uJ(n,`insetLeft`,`insetRight`),stacked:n.stacked===!0||i}}function pJ(e={x:`count`},t={}){let n={...t,y:t.y??AB},i=e.x1!==void 0||e.x2!==void 0;return{...lJ([`y`],e,n),...uJ(n,`insetTop`,`insetBottom`),stacked:n.stacked===!0||i}}function mJ(e){if(typeof e==`string`)return e}function hJ(e,t){return t.flatMap(t=>e[t]===void 0?[t+`1`,t+`2`].filter(t=>e[t]!==void 0):[t])}function gJ(e,t,n){let i=new Set([...t,`fill`,`stroke`,`fx`,`fy`,`z`]);return Object.keys(e).filter(t=>{let a=Object.prototype.hasOwnProperty.call(n,t);return i.has(t)&&!a&&e[t].value!==void 0})}function _J(e,t,n){let i=[`x1`,`x2`,`y1`,`y2`].some(e=>t[e]!==void 0);return{...n,stacked:n.stacked===!0||i,transform:CU(function(n,i){let a=hJ(i,e),o=gJ(i,a,t),s={};for(let e of Object.keys(i))i[e].value!==void 0&&(s[e]=RB(n,i[e].value));let c={};for(let e of Object.keys(t)){let i=FU(t[e]);c[e]=i===void 0?s[e]:RB(n,i)}let l=new Map;for(let e=0;e<n.length;e++){let t=o.map(t=>String(s[t][e])).join(` `);l.has(t)?l.get(t).push(e):l.set(t,[e])}let u=[],d={};for(let e of[...o,...Object.keys(t)])d[e]=[];for(let e of l.values()){u.push(e.map(e=>n[e]));for(let t of o)d[t].push(s[t][e[0]]);for(let i of Object.keys(t)){let a=c[i]===void 0?e:e.map(e=>c[i][e]);d[i].push(PU(t[i],a,e.map(e=>n[e]),c[i]===void 0))}}for(let e of Object.keys(t))LU(t[e])&&zU(d,e,RU(t[e]),d.fx,d.fy);let f=o.filter(e=>a.includes(e)===!1);if(f.length>0){let e=e=>f.map(t=>String(d[t][e])).join(` `),t=u.map((e,t)=>t);t.sort((t,n)=>e(t)<e(n)?-1:+(e(t)>e(n)));let n=t.map(e=>u[e]);u.length=0,u.push(...n);for(let e of Object.keys(d))d[e]=t.map(t=>d[e][t])}let p={};for(let e of o)p[e]=_U(d[e],{...i[e],label:i[e].label??mJ(i[e].value)??null});for(let e of Object.keys(t)){let{constant:n,...a}=i[e]??{};p[e]=_U(d[e],{...a,scale:a.scale??bU[e],zero:a.zero??(e===`y`||e===`x`),label:IU(e,t[e])})}for(let e of Object.keys(i))p[e]===void 0&&i[e].constant!==void 0&&(p[e]=i[e]);return{data:u,channels:p}})}}function vJ(e={fill:`count`},t={}){return _J([`x`,`y`],e,MB(t))}function yJ(e={y:`count`},t={}){return _J([`x`],e,{...t,x:t.x??AB})}function bJ(e={x:`count`},t={}){return _J([`y`],e,{...t,y:t.y??AB})}function xJ(e,t={}){let n=AG(t);return XV({type:`barX`,data:e,options:n,channels:{x:{value:n.x,scale:`x`,zero:!0},y:{value:n.y,scale:`y`,type:`band`},x1:{value:n.x1,scale:`x`,zero:!0},x2:{value:n.x2,scale:`x`,zero:!0},...$V(n,{fill:$.fill})},render(e,t,i,a){let o=bR(),s=t.y===void 0?a.height:t.y.bandwidth?t.y.bandwidth():10,c=t.x(0),l=n.insetLeft??n.inset??0,u=n.insetRight??n.inset??0,d=n.insetTop??n.inset??0,f=n.insetBottom??n.inset??0;for(let t of e){let e=i.x2?i.x2[t]:i.x[t],a=i.x1?i.x1[t]:c,p=Math.min(e,a),m=Math.max(e,a);o.appendChild(xR({x:p+l,y:(i.y?i.y[t]:0)+d,width:Math.max(0,m-p-l-u),height:Math.max(0,s-d-f),rx:n.rx,ry:n.ry,...tH(i,t)}))}return o}})}function SJ(e,t={}){let n=jG(t);return XV({type:`barY`,data:e,options:n,channels:{x:{value:n.x,scale:`x`,type:`band`},y:{value:n.y,scale:`y`,zero:!0},y1:{value:n.y1,scale:`y`,zero:!0},y2:{value:n.y2,scale:`y`,zero:!0},...$V(n,{fill:$.fill})},render(e,t,i,a){let o=bR(),s=t.x===void 0?a.width:t.x.bandwidth?t.x.bandwidth():10,c=t.y(0),l=n.insetLeft??n.inset??0,u=n.insetRight??n.inset??0,d=n.insetTop??n.inset??0,f=n.insetBottom??n.inset??0;for(let t of e){let e=i.y2?i.y2[t]:i.y[t],a=i.y1?i.y1[t]:c,p=Math.min(e,a),m=Math.max(e,a);o.appendChild(xR({x:(i.x?i.x[t]:0)+l,y:p+d,width:Math.max(0,s-l-u),height:Math.max(0,m-p-d-f),rx:n.rx,ry:n.ry,...tH(i,t)}))}return o}})}function CJ(e,t,n){let i=new Map;for(let a=0;a<t;a++){let t=yU(e,a,n);i.has(t)?i.get(t).push(a):i.set(t,[a])}return[...i.values()]}function wJ(e){let t=0;for(let n of e)t+=n;return t}function TJ(e,t){let n=0,i=0;for(let a of e)n=Math.min(n,t[a]),i=Math.max(i,t[a]);return[n,i]}function EJ(e,t,n){for(let i of e){let[e,a]=TJ(i,n),o=1/(a-e||1);for(let a of i)t[a]=o*(t[a]-e),n[a]=o*(n[a]-e)}}function DJ(e,t,n){let i=1/0;for(let n of e)for(let e of n)i=Math.min(i,t[e]);for(let a of e)for(let e of a)t[e]=t[e]-i,n[e]=n[e]-i}function OJ(e,t,n){for(let i of e){let[e,a]=TJ(i,n),o=(e+a)/2;for(let e of i)t[e]=t[e]-o,n[e]=n[e]-o}DJ(e,t,n)}function kJ(e,t,n,i){let a=new Map,o=0;for(let s of e){let e=s.map(e=>Math.abs(n[e]-t[e])),c=s.map((e,o)=>{let s=i?i[e]:o,c=n[e]-t[e],l=a.has(s)?c-a.get(s):0;return a.set(s,c),l});for(let e of s)t[e]=t[e]+o,n[e]=n[e]+o;let l=wJ(e);if(l!==0){let t=0,n=0;for(let i=0;i<e.length;i++)n+=(c[i]/2+t)*e[i],t+=c[i];o-=n/l}}DJ(e,t,n)}const AJ={expand:EJ,normalize:EJ,center:OJ,silhouette:OJ,wiggle:kJ};function jJ(e,t,n,i,a){if(e!=null){if(typeof e==`function`)return e([t],n,i,a);{let o=AJ[String(e).toLowerCase()];if(o)return o(t,n,i,a);throw Error(`unknown offset: ${e}`)}}}function MJ(e,t,n){let i=new Map,a=new Map;e.forEach((e,o)=>{for(let s of e){let e=n[s],c=Number(t[s]);a.set(e,(a.get(e)??0)+c),(i.has(e)===!1||c>i.get(e).value)&&i.set(e,{value:c,position:o})}});let o=(e,t)=>e<t?-1:+(e>t),s=[...a.keys()].sort((e,t)=>i.get(e).position-i.get(t).position||o(e,t)),c=[],l=[],u=0;for(let e of s)u<0?(u+=a.get(e),c.push(e)):(u-=a.get(e),l.push(e));return new Map(l.reverse().concat(c).map((e,t)=>[e,t]))}function NJ(e){let t=[...e].sort((e,t)=>zJ(e[1],t[1])).map(([e])=>e);return e=>n=>t.indexOf(e[n])}function PJ(e,t,n){let i=new Map;for(let a of e)for(let e of a)i.set(n[e],(i.get(n[e])??0)+Number(t[e]));return i}function FJ(e,t,n,i){let a=new Map;return e.forEach((e,o)=>{for(let s of e){let e=a.get(n[s]),c=i?i[s]:o;(e===void 0||Number(t[s])>e.value)&&a.set(n[s],{value:Number(t[s]),at:c})}}),new Map([...a].map(([e,t])=>[e,t.at]))}function IJ(e,t,n,i,a,o,s){let c=typeof e==`string`?e.replace(/^-/,``).toLowerCase():e;if(Array.isArray(e)&&a)return t=>e.indexOf(a[t]);if(c===`value`||c===t)return e=>Number(i[e]);if(c===`z`&&a){let e=[...new Set(a)].sort();return t=>e.indexOf(a[t])}if(c===`sum`&&a)return NJ(PJ(n,i,a))(a);if(c===`appearance`&&a)return NJ(FJ(n,i,a,s))(a);if(c===`inside-out`&&a){let e=MJ(n,i,a);return t=>e.get(a[t])}if(typeof e==`function`)return t=>e(o[t]);if(typeof e==`string`)return t=>o[t]?.[e]}function LJ(e){let{offset:t,order:n,reverse:i,...a}=e;return[{offset:t,order:n,reverse:i},a]}function RJ(e,t,n,i,a,o,s){let c=e.offset!==void 0&&e.offset!==null&&String(e.offset).toLowerCase()===`wiggle`,l=e.order??(c?`inside-out`:void 0),u=typeof l==`string`&&l.startsWith(`-`),d=l==null?void 0:IJ(l,t,n,i,a,o,s);if(d)for(let e of n)e.sort((e,t)=>u?zJ(d(t),d(e)):zJ(d(e),d(t)));if(e.reverse===!0)for(let e of n)e.reverse()}function zJ(e,t){return e<t?-1:+(e>t)}function BJ(e){return typeof e==`string`?CB(e)===!1:typeof e==`function`}function VJ(e){let t=BJ(e.fill)||BJ(e.stroke)||e.z!==void 0,n=e.x1!==void 0||e.x2!==void 0;return t&&n===!1&&e.stacked!==!0?HJ(e):e}function HJ(e={},t){let[n,i]=t===void 0?LJ(e):[e,t],a=i.transform;return{...i,stacked:!0,transform:CU(function(e,t){let i=a?wU(a,e,t):{data:e,channels:t},o=i.data,s=i.channels,c=pU(o,s),l=s.x?.label??zB(s.x?.value),u=c.z??c.fill??c.stroke,d=c.x??c.x2,f=CJ(c,o.length,c.y?`y`:`y1`),p=c.y??c.y1;RJ(n,`x`,f,d,u,o,p);let m=Array(o.length).fill(0),h=Array(o.length).fill(0);for(let e of f){let t=0,n=0;for(let i of e){let e=Number(d[i]);e<0?(m[i]=t,t+=e,h[i]=t):(m[i]=n,n+=e,h[i]=n)}}jJ(n.offset,f,m,h,u);let g=m.map((e,t)=>(e+h[t])/2);return{data:o,channels:gU(s,c,{x1:_U(m,{scale:`x`,zero:!0,label:l}),x2:_U(h,{scale:`x`,zero:!0,label:l}),x:_U(g,{scale:`x`,zero:!0,label:l})})}})}}function UJ(e){return typeof e==`string`?CB(e)===!1:typeof e==`function`}function WJ(e){let t=UJ(e.fill)||UJ(e.stroke)||e.z!==void 0,n=e.y1!==void 0||e.y2!==void 0;return t&&n===!1&&e.stacked!==!0?GJ(e):e}function GJ(e={},t){let[n,i]=t===void 0?LJ(e):[e,t],a=i.transform;return{...i,stacked:!0,transform:CU(function(e,t){let i=a?wU(a,e,t):{data:e,channels:t},o=i.data,s=i.channels,c=pU(o,s),l=s.y?.label??zB(s.y?.value),u=c.z??c.fill??c.stroke,d=c.y??c.y2,f=CJ(c,o.length,c.x?`x`:`x1`),p=c.x??c.x1;RJ(n,`y`,f,d,u,o,p);let m=Array(o.length).fill(0),h=Array(o.length).fill(0);for(let e of f){let t=0,n=0;for(let i of e){let e=Number(d[i]);e<0?(m[i]=t,t+=e,h[i]=t):(m[i]=n,n+=e,h[i]=n)}}jJ(n.offset,f,m,h,u);let g=m.map((e,t)=>(e+h[t])/2);return{data:o,channels:gU(s,c,{y1:_U(m,{scale:`y`,zero:!0,label:l}),y2:_U(h,{scale:`y`,zero:!0,label:l}),y:_U(g,{scale:`y`,zero:!0,label:l})})}})}}const KJ=(e,t)=>t;function qJ(e){let t=e.x!==void 0||e.x1!==void 0||e.x2!==void 0,n=e.y!==void 0||e.y1!==void 0||e.y2!==void 0;return t?e:n?{...e,x:KJ}:{...e,x:KJ,y:AB}}function JJ(e){let t=e.x!==void 0||e.x1!==void 0||e.x2!==void 0;return e.y!==void 0||e.y1!==void 0||e.y2!==void 0?e:t?{...e,y:KJ}:{...e,x:AB,y:KJ}}function YJ(e){return e.x1===void 0&&e.x2===void 0?{...e,x1:0,x2:e.x}:e}const XJ=(e,t)=>(n,i={})=>e(n,WJ(qJ(t(i)))),ZJ=XJ(EG,AG),QJ=XJ(mK,AG),$J=XJ(SJ,jG),eY=(e,t={})=>fK(e,qJ(t)),tY=(e,t={})=>fK(e,JJ(t)),nY=(e,t={})=>EG(e,YJ(VJ(JJ(jG(t))))),rY=(e,t={})=>mK(e,YJ(VJ(JJ(jG(t))))),iY=(e,t={})=>xJ(e,VJ(AG(t))),aY={dot:IG,line:fK,lineX:tY,lineY:eY,areaX:nY,areaY:ZJ,ruleX:hK,ruleY:gK,barX:iY,barY:$J,rect:mK,rectX:rY,rectY:QJ,cell:NG,bin:dJ,binX:fJ,binY:pJ,group:vJ,groupX:yJ,groupY:bJ};function oY(e,t){let n=oJ(e,t),i=aY[n.markImpl],a=aY[n.transformImpl],o=n.fx!==null||n.fy!==null?zG({strokeOpacity:.1}):null,s=[n.x.zero?hK([0]):null,n.y.zero?gK([0]):null],c=n.markOptions;a&&(c=a(n.transformOptions,n.markOptions));let l=i(e,c);return n.colorMode===`stroke`?[o,s,l]:[o,l,s]}const sY=[`x`,`y`,`fx`,`fy`,`color`,`r`,`opacity`,`symbol`,`length`];function cY(e={}){let t=sY.find(t=>e[t]!==void 0);if(t===void 0)throw Error(`invalid scale definition; no scale found`);{let n=SV({name:t,channels:[],config:e[t]}),i={type:n.type,domain:n.domain,range:n.range,label:n.label,apply:e=>n(e)};return n.invert&&(i.invert=e=>n.invert(e)),n.bandwidth&&(i.bandwidth=n.bandwidth(),i.step=n.step()),i}}const lY=[`symbol`,`color`,`opacity`];function uY(e){return typeof e==`object`&&!!e&&Array.isArray(e)===!1}function dY(e,t){return SV({name:e,channels:[],config:t[e]})}function fY(e={}){let t=lY.find(t=>uY(e[t]));if(t===void 0)throw Error(`unknown legend type; no scale found`);{let{symbol:n,color:i,opacity:a,...o}=e,s={...o,...e[t]},c=t===`symbol`&&uY(e.color)?dY(`color`,e):void 0;return PV(dY(t,e),s,c)}}function pY(e,t,n={}){let{x:i,y:a,maxRadius:o,...s}=n,c=e({px:i,py:a,maxRadius:o}),l={strokeOpacity:n.strokeOpacity??.2},u=[];return i!==void 0&&u.push(hK(t,{...s,...c,...l,x:i})),a!==void 0&&u.push(gK(t,{...s,...c,...l,y:a})),i!==void 0&&u.push(yK(t,{...s,...c,x:i,text:i,frameAnchor:`bottom`,dy:9,fill:$.axisStroke})),a!==void 0&&u.push(yK(t,{...s,...c,y:a,text:a,frameAnchor:`left`,dx:-9,textAnchor:`end`,fill:$.axisStroke})),u}function mY(e,t={}){return pY(FR,e,t)}function hY(e,t={}){return pY(IR,e,t)}function gY(e,t={}){return pY(LR,e,t)}function _Y(e,t,n,i,a){if(n.bandwidth){let o=n.bandwidth();e[t]=n.domain.filter(e=>i<n(e)+o&&n(e)<a)}else if(n.invert){let o=[n.invert(i),n.invert(a)].sort(oz);e[t+`1`]=o[0],e[t+`2`]=o[1]}}function vY(e,t,n,i,a,o){return a&&n.x&&_Y(e,`x`,n.x,t.x1,t.x2),o&&n.y&&_Y(e,`y`,n.y,t.y1,t.y2),i.fx!==void 0&&(e.fx=i.fx),i.fy!==void 0&&(e.fy=i.fy),e}function yY(e,t){if(t){let n={...e.values};for(let i of Object.keys(t))n[i]=Array(e.length).fill(t[i]);return n}return e.values}function bY(e,t,n,i,a,o){let s=n.mark.render(a,t.scales,yY(n,o),i.dimensions,n);s&&e.appendChild(s)}function xY(e,t,n,i,a,o){let s;if(i){let c=n.index.filter(e=>i.has(t.data[e])),l=n.index.filter(e=>i.has(t.data[e])===!1);s=bR(),bY(s,e,t,n,l,o),bY(s,e,t,n,c,a)}else s=t.mark.render(n.index,e.scales,t.values,n.dimensions,t);if(s){let e=pH(t,s);n.$node.replaceWith(e),n.$node=e}}function SY(e,t,n){let{selected:i,unselected:a}=t.mark.options;if(i||a){let o=n&&new Set(n.map(e=>t.data[e]));for(let n of e.states)if(n!==t&&n.data===t.data)for(let t of n.nodes)xY(e,n,t,o,i,a)}}function CY(e,t,n,i={}){return XV({type:`brush`,data:n,options:i,layer:4,channels:{x:{value:i.x,scale:`x`},y:{value:i.y,scale:`y`}},render(n,a,o,s,c){let l=bR(),u=xR({x:0,y:0,width:0,height:0,fill:`currentColor`,fillOpacity:.1,stroke:`currentColor`,strokeOpacity:.3,pointerEvents:`none`}),d=xR({x:0,y:0,width:s.width,height:s.height,fill:`none`,pointerEvents:`all`,cursor:`crosshair`});return l.appendChild(d),l.appendChild(u),cR&&TY({$surface:d,$selection:u,index:n,scales:a,values:o,state:c,dimensions:s,horizontal:e,vertical:t,options:i}),l}})}function wY(e,t,n,i,a){if(e[n+`1`]&&e[n+`2`]){let i=e[n+`1`][t],a=e[n+`2`][t];return[Math.min(i,a),Math.max(i,a)]}if(e[n]){let a=e[n][t];return i&&i.bandwidth?[a,a+i.bandwidth()]:[a,a]}return[a,a]}function TY(e){let{$surface:t,$selection:n,index:i,scales:a,values:o,state:s,dimensions:c,horizontal:l,vertical:u,options:d}=e,f=s.chart,p={originX:c.marginLeft+c.cell.x,originY:c.marginTop+c.cell.y},m;function h(e){return BR(e,t.ownerSVGElement,p)}function g(e,t){return{x1:l?Math.min(e[0],t[0]):0,x2:l?Math.max(e[0],t[0]):c.width,y1:u?Math.min(e[1],t[1]):0,y2:u?Math.max(e[1],t[1]):c.height}}function _(e){n.setAttribute(`x`,e.x1),n.setAttribute(`y`,e.y1),n.setAttribute(`width`,e.x2-e.x1),n.setAttribute(`height`,e.y2-e.y1)}function v(e){let t=[];for(let n of i){let[i,s]=wY(o,n,`x`,a.x,c.width/2),[l,u]=wY(o,n,`y`,a.y,c.height/2);s>=e.x1&&i<=e.x2&&u>=e.y1&&l<=e.y2&&t.push(n)}return t}function y(e,t,n){let i=null;t.length>0&&(i=t.map(e=>s.data[e]),vY(i,e,a,c.cell,l,u),i.done=n),f.selection=i===null?void 0:{data:s.data,index:t},SY(f,s,i===null?void 0:t),f.publishValue(i),d.onbrush&&d.onbrush(e,i??[])}t.addEventListener(`pointerdown`,e=>{m=h(e),t.setPointerCapture&&t.setPointerCapture(e.pointerId),_(g(m,m))}),t.addEventListener(`pointermove`,e=>{if(m){let t=g(m,h(e));_(t),y(t,v(t),!1)}}),t.addEventListener(`pointerup`,e=>{if(m){let t=g(m,h(e)),n=t.x2-t.x1<1&&t.y2-t.y1<1;m=void 0,n?(_({x1:0,y1:0,x2:0,y2:0}),y(void 0,[],!0)):y(t,v(t),!0)}})}function EY(e,t={}){return CY(!0,!0,e,t)}function DY(e,t={}){return CY(!0,!1,e,t)}function OY(e,t={}){return CY(!1,!0,e,t)}const kY=Math.PI/180;function AY(e=1){let t=(e,t)=>e<t?-1:+(e>t);if(typeof e==`number`)return()=>Math.sign(e);if(typeof e==`function`)return(t,n,i,a)=>Math.sign(e(t,n,i,a));if(e===`+x`)return(e,n,i)=>t(e,i);if(e===`-x`)return(e,n,i)=>t(i,e);if(e===`+y`)return(e,n,i,a)=>t(n,a);if(e===`-y`)return(e,n,i,a)=>t(a,n);throw Error(`unknown sweep: ${e}`)}function jY(e,t={}){let n=t.bend===!0?22.5:Math.max(-90,Math.min(90,t.bend??0)),i=t.headAngle??60,a=t.headLength??8,o=AY(t.sweep),s=i/2*kY,c=a/1.5;return XV({type:`arrow`,data:e,options:t,channels:{x:{value:t.x,scale:`x`},y:{value:t.y,scale:`y`},x1:{value:t.x1??t.x,scale:`x`},y1:{value:t.y1??t.y,scale:`y`},x2:{value:t.x2??t.x,scale:`x`},y2:{value:t.y2??t.y,scale:`y`},...$V(t,{stroke:$.stroke,strokeWidth:$.strokeWidth})},render(e,t,i,a){let l=bR(),u=rH(t.x),d=rH(t.y),f=i.x1??i.x,p=i.x2??i.x,m=i.y1??i.y,h=i.y2??i.y;for(let t of e){let e=f[t]+u,a=m[t]+d,g=p[t]+u,_=h[t]+d,v=Math.hypot(g-e,_-a);if(v>0){let u=i.strokeWidth?i.strokeWidth[t]:$.strokeWidth,d=Math.min(c*u,v/3),f=o(e,a,g,_)*n*kY,p=Math.hypot(v/Math.tan(f),v)/2,m=Math.atan2(_-a,g-e)+f,h=e=>Q(g-d*Math.cos(m+e),_-d*Math.sin(m+e)),y=p<1e5?`A${oR(p)},${oR(p)} 0,0,${+(f>0)} `:`L`,b=d>0?`M${h(s)}L${Q(g,_)}L${h(-s)}`:``;l.appendChild(TR({d:`M${Q(e,a)}${y}${Q(g,_)}${b}`,strokeLinejoin:`round`,strokeLinecap:`round`,...tH(i,t)}))}}return l}})}function MY(e,t={}){return XV({type:`boxX`,data:e,options:t,channels:{x:{value:t.x??AB,scale:`x`,zero:!0},y:{value:t.y,scale:`y`,type:`band`},...$V(t,{fill:$.boxFill,stroke:$.stroke})},render(e,n,i,a,o){let s=bR(),c=n.y&&n.y.bandwidth?n.y.bandwidth():a.height,l=c*$.boxWidth,u=(c-l)/2,d=new Map;for(let t of e){let e=i.y?i.y[t]:0;d.has(e)?d.get(e).push(t):d.set(e,[t])}for(let[e,t]of d)f(s,e,t);return s;function f(e,a,s){let d=s.map(e=>o.raw.x[e]),f=pz(d,.25),p=pz(d,.5),m=pz(d,.75),h=m-f,g=d.filter(e=>e>=f-h*1.5&&e<=m+h*1.5),_=a+c/2,v=tH(i,s[0]);e.appendChild(SR({y1:_,y2:_,x1:n.x(cz(g)),x2:n.x(lz(g)),stroke:v.stroke,strokeOpacity:v.strokeOpacity,opacity:v.opacity})),e.appendChild(xR({x:n.x(f),y:a+u,width:Math.abs(n.x(m)-n.x(f)),height:l,fill:v.fill,fillOpacity:v.fillOpacity,opacity:v.opacity})),e.appendChild(SR({y1:a+u,y2:a+u+l,x1:n.x(p),x2:n.x(p),stroke:v.stroke,strokeOpacity:v.strokeOpacity,opacity:v.opacity,strokeWidth:$.medianStrokeWidth}));for(let i of d)g.includes(i)===!1&&e.appendChild(wR({cx:n.x(i),cy:_,r:t.r??$.dotRadius,fill:`none`,stroke:v.stroke,strokeOpacity:v.strokeOpacity,opacity:v.opacity}))}}})}function NY(e={},t={}){return _J([],e,t)}function PY(e){return function(t,n){let i=n.findIndex(e);if(!(i<0))return t[i]}}function FY(e,t,n){let i=e.transform;return{...e,transform:CU(function(e,a){let o=i(e,a);return o.channels[t]={...o.channels[n]},o})}}function IY(e={}){return FY(HJ(e),`x`,`x1`)}function LY(e={}){return FY(HJ(e),`x`,`x2`)}function RY(e={}){return FY(GJ(e),`y`,`y1`)}function zY(e={}){return FY(GJ(e),`y`,`y2`)}function BY(e,t,n){let i=e===`y`?n.height:n.width;return t===`top`||t===`left`?{direction:1,baseline:0}:t===`middle`?{direction:0,baseline:i/2}:{direction:-1,baseline:i}}function VY(e,t,n,i){return t+e(n)+e(i)}function HY(e){return e===0?(e,t)=>Math.abs(e)-Math.abs(t):oz}function UY(e,t={},n={}){let i=e===`y`?`x`:`y`,a=t.padding??1,o=t.anchor??(e===`y`?`bottom`:`left`);return{...n,initialize(t,n,s,c){let l=s[i],u=e=>s.r?s.r[e]:3,{direction:d,baseline:f}=BY(e,o,c);s[e]===void 0&&(s[e]=Array(l.length).fill(0));let p=s[e],m=[];for(let e of t.filter(e=>Number.isFinite(l[e]))){let t=d===0?0:u(e)+a,n=[0,0];for(let i of m){let o=VY(u,a,e,i),s=l[e]-l[i];if(Math.abs(s)<o){let e=Math.sqrt(o*o-s*s),a=p[i]-t;n.push(a-e,a+e)}}let i=d===0?[...n]:n.filter(e=>e>=0);i.sort(HY(d));for(let a of i){let i=!0;for(let e=0;e<n.length;e+=2)if(n[e]+1e-6<a&&a<n[e+1]-1e-6){i=!1;break}if(i){p[e]=a+t;break}}m.push(e)}let h=d===0?1:d;for(let e of t)p[e]=p[e]*h+f}}}function WY(e,t){if(t===void 0){let{anchor:t,padding:n,...i}=e;return[{anchor:t,padding:n},i]}return[e,t]}function GY(e={},t){let[n,i]=WY(e,t);return UY(`x`,n,i)}function KY(e={},t){let[n,i]=WY(e,t);return UY(`y`,n,i)}const qY={sum:uz,mean:fz,median:mz,min:cz,max:lz,deviation:hz,first:e=>e.find(JY),last:e=>[...e].reverse().find(JY)};function JY(e){return e!=null&&Number.isNaN(e)===!1}function YY(e=`first`){if(e===`extent`)return function(e){let t=cz(e),n=lz(e)-t;return e.map(e=>n===0?0:(Number(e)-t)/n)};if(e===`deviation`)return function(e){let t=fz(e),n=hz(e);return e.map(e=>n?(Number(e)-t)/n:0)};{let t=XY(e);return function(e){let n=Number(t(e));return e.map(e=>n===0?0:Number(e)/n)}}}function XY(e){if(typeof e==`function`)return e;if(/^p\d{2}$/i.test(e))return t=>pz(t,Number(e.slice(1))/100);if(qY[e])return qY[e];throw Error(`invalid basis: `+e)}function ZY(e=`first`,t){let[n,i]=t===void 0&&typeof e==`object`?[`first`,e]:[e,t??{}];return ZK(YY(n),i)}function QY(e=`first`,t){let[n,i]=t===void 0&&typeof e==`object`?[`first`,e]:[e,t??{}];return QK(YY(n),i)}function $Y(e={},t){let[n,i]=t===void 0&&typeof e==`object`&&e.k===void 0&&e.reduce===void 0?[{},e]:[e,t??{}];return ZK(rq(n),i)}function eX(e={},t){let[n,i]=t===void 0&&typeof e==`object`&&e.k===void 0&&e.reduce===void 0?[{},e]:[e,t??{}];return QK(rq(n),i)}function tX(e){if(typeof e==`number`)return{count:e,offset:(e,t)=>Number(e)+t};{let t=String(e).startsWith(`-`)?-1:1,n=KB(typeof e==`string`?String(e).replace(/^[+-]/,``):e);return{count:t,offset:(e,t)=>n.offset(e,t)}}}function nX(e,t,n){let{count:i,offset:a}=tX(t),o=e+`1`,s=e+`2`,c=XK({[o]:e=>e.map(e=>a(e,i)),[s]:e=>e},n),l=c.transform;return{...c,transform:CU(function(e,t){let n=l(e,t),[o,c]=sz(n.data.map(e=>e[s])),u=i<0?[o,a(c,i)]:[a(o,i),c];return n.channels[s]={...n.channels[s],domain:u},n})}}function rX(e,t={}){return nX(`x`,e,t)}function iX(e,t={}){return nX(`y`,e,t)}function aX(e={}){let t=e.geometry??AB;return{...e,x:{value:t,centroid:!0},y:{value:t,centroid:!0}}}function oX(e={}){let t=e.geometry??AB,n=new Map,i=e=>(n.has(e)===!1&&n.set(e,uW(typeof t==`function`?t(e):e[t])),n.get(e));return{...e,x:e=>i(e)[0],y:e=>i(e)[1]}}function sX(e,t={}){return{...t,filter:e}}function cX(e={}){let t=e.transform;return{...e,transform:CU(function(e,n){let i=t?wU(t,e,n):{data:e,channels:n};return{data:[...i.data].reverse(),channels:i.channels}})}}function lX(e=0){let t=(0<=e&&e<1?e/1.0000000000000002:Math.abs(e))*4294967296%4294967296;return function(){return t=(1664525*t+1013904223)%4294967296,t/4294967296}}function uX(e={}){let t=e.transform,n=e.seed===void 0?Math.random:lX(e.seed);return{...e,transform:CU(function(e,i){let a=t?wU(t,e,i):{data:e,channels:i},o=[...a.data];for(let e=o.length-1;e>0;e--){let t=Math.floor(n()*(e+1)),i=o[e];o[e]=o[t],o[t]=i}return{data:o,channels:a.channels}})}}function dX(e,t={}){return{...t,sort:e}}function fX(e,t,n){return{...n,transform:CU(function(e,t){let n=pU(e,t),a=new Map;for(let t=0;t<e.length;t++){let e=SU(n,t);a.has(e)?a.get(e).push(t):a.set(e,[t])}let o=[];for(let e of a.values())o.push(mU(n,i(e,n)));return{data:o,channels:hU(t)}})};function i(n,i){return e===`first`?n[0]:e===`last`?n[n.length-1]:e===`min`?[...n].sort((e,n)=>oz(i[t][e],i[t][n]))[0]:[...n].sort((e,n)=>oz(i[t][n],i[t][e]))[0]}}function pX(e,t={}){if(typeof e==`string`)return fX(e,void 0,t);{let[n]=Object.keys(e);return fX(e[n],n,t)}}function mX(e={}){return fX(`first`,`y`,e)}function hX(e={}){return fX(`last`,`y`,e)}function gX(e={}){return fX(`min`,`x`,e)}function _X(e={}){return fX(`max`,`x`,e)}function vX(e={}){return fX(`min`,`y`,e)}function yX(e={}){return fX(`max`,`y`,e)}const bX={plot:SW,scale:cY,legend:fY,identity:AB,formatMonth:rR,formatWeekday:iR,formatIsoDate:aR,auto:oY,autoSpec:oJ,area:EG,areaX:nY,areaY:ZJ,arrow:jY,axisFx:qU,axisFy:JU,axisX:WU,axisY:KU,barX:iY,barY:$J,boxX:MY,boxY:DG,cell:NG,cellX:PG,dot:IG,dotX:LG,dotY:RG,frame:zG,geo:rK,graticule:lK,sphere:uK,gridX:YU,gridY:XU,line:fK,lineX:tY,lineY:eY,linearRegressionY:pK,rect:mK,rectX:rY,rectY:QJ,ruleX:hK,ruleY:gK,symbol:_K,text:yK,textX:bK,textY:xK,tickX:SK,tickY:CK,tip:lU,vector:OK,vectorX:kK,vectorY:AK,spike:jK,hexgrid:FK,link:sq,tree:Bq,cluster:Vq,voronoi:BK,voronoiMesh:UK,differenceY:KK,bollingerX:aq,bollingerY:oq,bin:dJ,binX:fJ,binY:pJ,hexbin:PK,group:vJ,groupX:yJ,groupY:bJ,groupZ:NY,find:PY,stackX:HJ,stackX1:IY,stackX2:LY,stackY:GJ,stackY1:RY,stackY2:zY,dodgeX:GY,dodgeY:KY,normalize:YY,normalizeX:ZY,normalizeY:QY,window:rq,windowX:$Y,windowY:eX,map:XK,mapX:ZK,mapY:QK,shiftX:rX,shiftY:iX,centroid:aX,geoCentroid:oX,filter:sX,reverse:cX,shuffle:uX,sort:dX,select:pX,selectFirst:mX,selectLast:hX,selectMinX:gX,selectMaxX:_X,selectMinY:vX,selectMaxY:yX,treeNode:zq,treeLink:Rq,bollinger:iq,pointer:FR,pointerX:IR,pointerY:LR,crosshair:mY,crosshairX:hY,crosshairY:gY,brush:EY,brushX:DY,brushY:OY};function xX(e,t,n){let i=(n-e.length*80)/2;return`<g class="legend" transform="translate(0, 0)">${e.map((e,n)=>{let a=i+n*80;return`<rect x="${a}" y="0" width="12" height="12" rx="2" fill="${t[n]}"/>
|
|
459
465
|
<text x="${a+12+5}" y="10" font-size="10" fill="currentColor">${e}</text>`}).join(`
|
|
460
|
-
`)}</g>`}function
|
|
466
|
+
`)}</g>`}function SX(e){return e.tagName===`FIGURE`?e.querySelector(`svg`):e}function CX(e,t={}){let{width:n=640,height:i=400}=t,a=e.series.map(e=>e.name),o=e.series.map(e=>`#${e.color}`),s=e.series.flatMap(t=>t.values.map((n,i)=>({category:e.categories[i],value:n,series:t.name}))),c=Math.max(...s.map(e=>e.value)),l=[0,c*.25,c*.5,c*.75,c],u=i-30,d=SX(bX.plot({width:n,height:u,marginBottom:20,x:{label:null,axis:null},y:{label:null,grid:!0,ticks:l},fx:{label:null,padding:.3},color:{domain:a,range:o,legend:!1},marks:[bX.barY(s,{x:`series`,y:`value`,fx:`category`,fill:`series`,rx:4}),bX.ruleY([0])]})).outerHTML,f=xX(a,o,n);return d.replace(/height="[^"]*"/,`height="${i}"`).replace(/viewBox="([^"]*)"/,(e,t)=>{let[n,a,o]=t.split(` `);return`viewBox="${n} ${a} ${o} ${i}"`}).replace(/<\/svg>/,`<g transform="translate(0, ${u+10})">${f}</g></svg>`)}function wX(e,t={}){let{width:n=640,height:i=400}=t,a=e.series[0];if(!a)return``;let o=a.values.map((t,n)=>({category:e.categories[n],value:t}));return SX(bX.plot({width:n,height:i,marks:[bX.barY(o,{x:`category`,y:`value`,fill:`category`})]})).outerHTML}function TX(e,t={}){let{width:n=640,height:i=400}=t,a=e.series.map(e=>e.name),o=e.series.map(e=>`#${e.color}`),s=e.series.flatMap(t=>t.values.map((n,i)=>({category:e.categories[i],categoryIndex:i,value:n,series:t.name,color:t.color}))),c=e.legend!==null,l=i-(c?30:0),u=SX(bX.plot({width:n,height:l,x:{label:null},y:{grid:!0},color:{domain:a,range:o,legend:!1},marks:[bX.line(s,{x:`categoryIndex`,y:`value`,stroke:`series`}),bX.dot(s,{x:`categoryIndex`,y:`value`,fill:`series`})]})).outerHTML;if(c){let e=xX(a,o,n);return u.replace(/height="[^"]*"/,`height="${i}"`).replace(/viewBox="([^"]*)"/,(e,t)=>{let[n,a,o]=t.split(` `);return`viewBox="${n} ${a} ${o} ${i}"`}).replace(/<\/svg>/,`<g transform="translate(0, ${l+10})">${e}</g></svg>`)}return u}function EX(e,t={}){let{type:n}=e;return n===`barChart`?CX(e,t):n===`pieChart`||n===`doughnutChart`?wX(e,t):n===`lineChart`?TX(e,t):CX(e,t)}const DX=[`c:barChart`,`c:lineChart`,`c:pieChart`,`c:areaChart`,`c:scatterChart`,`c:bubbleChart`,`c:radarChart`,`c:stockChart`,`c:surfaceChart`,`c:doughnutChart`];function OX(e){let{$chartSpace:t,$colorStyle:n,$chartStyle:i,theme:a,upstreams:o=[],resolveColor:s}=e,c=J(t,sL.chart),l=Y(t,[sL.chart,sL.plotArea]),u=v(l),d=y(l,u),f=b(c),p=x(c),m=S(l,sL.catAx),h=S(l,sL.valAx),g=n?jL({$colorStyle:n,theme:a,upstreams:o}):null,_=i?ML({$chartStyle:i,theme:a,upstreams:o}):null;function v(e){if(e){for(let t of e.children)if(DX.includes(t.name))return t.name.replace(`c:`,``)}return`barChart`}function y(e,t){let n=[];if(e){let i=J(e,`c:`+t);if(i)for(let e of i.children)e.name===sL.ser&&n.push(EL(e,{theme:a,upstreams:o}))}return n}function b(e){let t=Y(e,[sL.title]);if(t){let e=J(t,`c:txPr`);if(e){let t=Y(e,[X.p]);if(t){let e=J(t,X.r);if(e){let t=J(e,X.t);if(t)return Dk(t)}}}let n=J(t,sL.tx);if(n){let e=J(n,`c:rich`);if(e){let t=J(e,X.p);if(t){let e=J(t,X.r);if(e){let t=J(e,X.t);if(t)return Dk(t)}}}}}return null}function x(e){let t=Y(e,[sL.legend]);return t?{position:J(t,sL.legendPos)?.attributes?.val??`b`}:null}function S(e,t){let n=J(e,t);if(n){let e=J(n,sL.scaling);return{orientation:(e?J(e,sL.orientation):null)?.attributes?.val??`minMax`}}return null}function C(e){let t=d[e];if(t?.fill){if(t.fill.type===`scheme`&&s)return s(t.fill.value);if(t.fill.type===`rgb`)return t.fill.value}if(g&&s)return g.getSeriesColor(e,s);let n=[`#4472C4`,`#ED7D31`,`#A5A5A5`,`#FFC000`,`#5B9BD5`,`#70AD47`];return n[e%n.length]}function w(){let e=d[0]?.categories||[];return{type:u,title:f,series:d.map((e,t)=>({name:e.name?.[0]||`Series ${t+1}`,values:e.values,color:C(t)})),categories:e,legend:p}}function T(e={}){let{xform:t}=e;return EX(w(),{width:t?.width||640,height:t?.height||400})}return{chartType:u,series:d,title:f,legend:p,catAxis:m,valAxis:h,chartColors:g,chartStyle:_,getSeriesColor:C,toPlotData:w,render:T}}function kX(e){let{$sp:t,$graphicFrame:n,relationships:i,parent:a,upstreams:o,presentation:s,layout:c,master:l,theme:u}=e,d=mL({...e,cNvName:Z.nvGraphicFramePr,xfrmPaths:[Z.xfrm]});dL(d,{type:`graphicFrame`,position:null,content:null,renderContent:m});let f=Y(n,[X.graphic,X.graphicData]),p=f?.children??[];for(let e of p){let n=e.name;if(X.tbl===n){let e=J(f,X.tbl);e&&(d.content=wL({$sp:t,$tbl:e,relationships:i,shape:d,upstreams:o,theme:u,presentation:s}))}else if(sL.chart===n){d.contentType=`chart`;let t=e.attributes?.[`r:id`];if(t&&i&&s){let e=i.getChartTarget(t);if(e){let t=s.getDom(e);if(t){let n=e.replace(`.xml`,`.xml.rels`).replace(`/charts/`,`/charts/_rels/`),i=s.getDom(n),a=null,f=null;if(i)for(let t of i.children??[]){let n=t.attributes?.Type??``,i=t.attributes?.Target??``;if(n.includes(`chartColorStyle`)){let t=e.replace(/[^/]+$/,i);a=s.getDom(t)}else if(n.includes(`chartStyle`)){let t=e.replace(/[^/]+$/,i);f=s.getDom(t)}}d.content=OX({$chartSpace:t,$colorStyle:a,$chartStyle:f,theme:u,upstreams:o,resolveColor:e=>c?.resolveColor?c.resolveColor(e):l?.resolveColor?l.resolveColor(e):null})}}}}}function m(e){if(d.contentType===`chart`&&d.content){let{width:t,height:n}=e;return`<g class="chart">${d.content.render({xform:{width:t,height:n}}).replace(/<svg[^>]*>/,``).replace(/<\/svg>$/,``)}</g>`}return d?.content?.render(e)}return d.svg=function(){if(!d.position||!d.slideSize)return``;let{x:e,y:t,width:n,height:i}=d.position;if(d.contentType===`table`&&d.content?.rows){let a=d.content,o=i/a.rows.length,s=` <g transform="translate(${e}, ${t})">
|
|
461
467
|
<rect x="0" y="0" width="${n}" height="${i}" fill="white" stroke="#ddd" stroke-width="1"/>
|
|
462
468
|
`;return a.rows.forEach((e,t)=>{let i=e.cells?.length||0,a=n/i,c=t*o;e.cells?.forEach((e,t)=>{let n=t*a,i=e.text||``,l=Math.max(10,o/4);s+=` <rect x="${n}" y="${c}" width="${a}" height="${o}" fill="none" stroke="#ddd" stroke-width="1"/>
|
|
463
|
-
<text x="${n+a/2}" y="${c+o/2}" text-anchor="middle" dominant-baseline="middle" font-size="${l}" fill="#333">${
|
|
464
|
-
`})}),s+=` </g>`,s}return``},d}const bY={titleStyle:{font:`Arial`,size:5400,color:`#111111`},bodyStyle:{font:`Calibri`,size:3600,color:`#333333`},otherStyle:{font:`Verdana`,size:3200,color:`#666666`}},xY={latin:`Calibri`,ea:`MS Gothic`,cs:`Arial`},SY={lt:`latin`,ea:`ea`,cs:`cs`};async function CY({$dom:e,presentation:t}){return{$dom:e,presentation:t,getStyle:n,getAlignment:i,getAnchor:a,getBackground:s,resolveBackground:c,getBulletColor:x,getBulletFontSize:S,getBulletStyle:l,getFontFamily:d,getFontSize:p,getColor:m,getPosition:h,getStroke:g,getStrokeWidth:_,getShapeFill:o,getFontFamilyByDash:u,getMarginLeft:v,getIndentValue:y,getEffectOuterShadow:b,getXForm:C,resolveSchemeColor:f,getBodyProperty:w};function n(t){let n=Y(e,[X.objectDefaults,X.spDef,X.lstStyle,X.defPPr,X.defRPr]);if(n?.attributes?.sz)return n?.attributes?.sz;switch(t){case`title`:case`ctrTitle`:return bY.titleStyle||{};case`body`:return bY.bodyStyle||{};default:return bY.otherStyle||{}}}function i(e){return t.getAlignment()}function a(){return t.getAnchor()}function o(){}function s(){}function c(t){return Y(e,[X.themeElements,X.fmtScheme,X.bgFillStyleLst,t])}function l(){}function u(e=`+mj-lt`){if(e===`mj`)return d(`mj`,`latin`);if([`latin`,`ea`,`cs`].includes(e))return d(`mj`,e);let t=e.match(/\+(\w+)-(\w+)/);if(t){let e=t[1],n=SY[t[2]];return d(e,n)}return e}function d(t,n){let i=t===`mj`||t===`major`?X.majorFont:X.minorFont;return xO(e,[X.themeElements,X.fontScheme,i,`a:${n}`],`typeface`)||xY[n]||xY.latin}function f(t){if(t){let n=xO(e,[X.themeElements,X.clrScheme,`a:${t}`,X.srgbClr],`val`);if(n)return n;let i=xO(e,[X.themeElements,X.clrScheme,`a:${t}`,X.sysClr],`lastClr`);if(i)return i}}function p(n){return qF(e,[X.objectDefaults,X.spDefm,X.lstStyle,X.defPPr,X.defRPr],`sz`)??(n&&t.getFontSize())}function m(e){return e&&t.getFontSize()}function h(){}function g(){return`ffffff`}function _(t){return xO(e,[X.themeElements,X.fmtScheme,X.lnStyleLst,t,X.ln],`w`)||1}function v(){}function y(){}function b(){}function x(){}function S(){}function C(){}function w(){}}async function wY({presentation:e}){let{getDoms:t}=e,n={},i=await t(`ppt/theme/theme\\d+\\.xml$`),a;for(let[t,o]of Object.entries(i))n[t]=await CY({$dom:o,presentation:e}),a??=n[t];return{themes:n,theme0:a,getTheme:o};function o(e){return n[e]}}function TY(e){let{$sp:t,relationships:n,parent:i=`slide`,upstreams:a,theme:o,presentation:s}=e,c=iI(e);Y(t,[Z.spPr]);let l=Y(t,[Z.txBody]);return tI(c,{type:`shape`,renderContent:d,textContent:u,getLevelTextStyle:f}),c.txBody=uI({$sp:t,$txBody:l,relationships:n,shape:c,upstreams:a,theme:o,presentation:s}),c;function u(e){return c.txBody?c.txBody.render(e):``}function d(e){return[c.geometry.render(e)]}function f(e){let n=Y(t,[Z.txBody,X.lstStyle,`a:lvl${e+1}pPr`,X.defRPr]);return RunProperty({$defRPr:n})}}function EY(e){let{$cxnSp:t,$sp:n,relationships:i,parent:a=`slide`,upstreams:o,presentation:s,layout:c,master:l,theme:u}=e,d=iI({...e,cNvName:Z.nvCxnSpPr}),f=Y(t,[Z.style,X.lnRef]),p=J(f,X.schemeClr)?.attributes?.val,m=parseInt(f?.attributes?.idx||`1`,10);return tI(d,{parent:a,type:`connector`,xform:QF(Y(n,[Z.spPr,X.xfrm])),lineSchemeColor:p,lineIdx:m,renderContent:h}),d;function h({xform:e}){if(e){let{x:n=0,y:i=0,width:a,height:c,flipH:l,flipV:f,rotation:p}=e,m=nI({$sp:t,shape:d,width:a,height:c,upstreams:o,theme:u,presentation:s}),h=[];return h.push(m.render()),d.geometry.getStroke(),m.getTailEnd(),m.getHeadEnd(),h}return[]}}function DY({$spTree:e,relationships:t,upstreams:n,presentation:i,layout:a,master:o,theme:s,parent:c=`slide`}){let l=[],u=e?.children??[];for(let e of u){let u=e.name;if(Z.sp===u){let u=TY({$sp:e,relationships:t,parent:c,upstreams:n,presentation:i,layout:a,master:o,theme:s});u&&l.push(u)}else if(u===Z.cxnSp){let u=EY({$sp:e,$cxnSp:e,relationships:t,parent:c,upstreams:n,presentation:i,layout:a,master:o,theme:s});u&&l.push(u)}else if(e.name===Z.pic){let u=aI({$sp:e,$pic:e,relationships:t,parent:c,upstreams:n,presentation:i,layout:a,master:o,theme:s});u&&l.push(u)}else if(e.name===Z.graphicFrame){let u=yY({$sp:e,$graphicFrame:e,relationships:t,parent:c,upstreams:n,presentation:i,layout:a,master:o,theme:s});u&&l.push(u)}}return l}function OY(e,{presentation:t,theme:n,master:i,layout:a,slide:o}){e.forEach(e=>{e.presentation=t,e.theme=n,e.master=i,e.layout=a,e.slide=o})}function kY(e){let{$dom:t}=e,n={};for(let e of t?.children??[])if(e.name===`Relationship`){let t=e.attributes.Id,i=e.attributes.Target,a=e.attributes.Type,o=i.replace(`..`,`ppt`);t&&(n[t]={target:i,type:a,normalizedTarget:o,targetMode:e.attributes.TargetMode},a?.includes(`hyperlink`)&&(n[t]=i))}async function i(t){let i=n[t]?.normalizedTarget;return await e.getMedia(i)}function a(e){return n[e]?.target}function o(){return(Object.values(n).find(e=>e.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme`)?.target??``).replace(`..`,`ppt`)}function s(){return(Object.values(n).find(e=>e.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster`)?.target??``).replace(`..`,`ppt`)}function c(){return(Object.values(n).find(e=>e.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout`)?.target??``).replace(`..`,`ppt`)}function l(e){let t=n[e];return t?.type?.includes(`chart`)?t.normalizedTarget:null}function u(e){return n[e]}return{$dom:t,getThemeTarget:o,getMasterTarget:s,getLayoutTarget:c,getMedia:i,getTarget:a,getChartTarget:l,getRelationship:u}}function AY(e){let{$dom:t,upstream:n}=e,i=Y(t,[Z.cSld,Z.bg,Z.bgPr]);if(i)return jY({...e,$bgPr:i});let a=Y(t,[Z.cSld,Z.bg,Z.bgRef]),o=bO(a,[],`idx`);if(o){if(o<1e3)return n?.resolveBackground(o);if(o===1e3)return jY({...e,noFill:!0});if(o===1001)return jY({...e,$solidFill:a});if(o===1002)return jY({...e,$gradFill:a});if(o===1003)return jY({...e,$pattFill:a})}return n?.getBackground(e)}function jY(e){let{$bgPr:t,width:n,height:i,relationships:a,upstreams:o,theme:s}=e;return tI(e,{type:null,fill:null,render:c}),e;async function c(c){if(t){if(e.noFill)return``;let c=LF(t,[X.solidFill],o,s);if(c)return`<rect x="0" y="0" width="${n}" height="${i}" style="fill: ${c}"/>`;let l=e.$blipFill??Y(t,[X.blipFill]);if(l){let e=SO(l,[X.blip],[`r:embed`,`r:link`]),t=await a.getMedia(e);if(t)return`<image x="0" y="0" width="${n}" height="${i}" preserveAspectRatio="xMidYMid slice" href="${t}"/>`;console.warn(`${e} not exist in relationship`)}}return``}}function MY({$clrMap:e,theme:t}){let n=e?.attributes;function i(e){if(n){let i=n[e];if(i)return t.resolveSchemeColor(i)}return t.resolveSchemeColor(e)}return{resolveColor:i,attributes:n}}function NY({$dom:e,filename:t,presentation:n,theme:i,master:a,relationships:o}){let s=DY({$spTree:Y(e,[Z.cSld,Z.spTree]),relationships:o,parent:`layout`,presentation:n,theme:i,master:a,upstreams:[]}),c=MY({$clrMap:Y(e,[Z.clrMap]),theme:i}),l={};for(let e of s)e.placeholderIndex!==void 0&&(l[e.placeholderIndex]=e),e.placeholderType!==void 0&&(l[e.placeholderType]=e);return{type:`layout`,presentation:n,master:a,theme:i,filename:t,shapes:s.filter(e=>e.notPlaceHolder),placeholder2Shapes:l,$dom:e,background:void 0,getBodyProperty:v,getBackground:f,resolveBackground:d,getPlaceholderForShape:u,getFontSize:p,getBulletStyle:m,getParagraphStyle:g,getPosition:_,clrMap:c,getTextStyle:y,getListStyle:h,resolveColor:b};function u(e){let{placeholderIndex:t,placeholderType:n}=e;return t!==void 0&&l[t]?l[t]:n!==void 0&&l[n]?l[n]:null}function d(e){}function f(t){return AY({...t,$dom:e,upstream:a,relationships:o})}function p(e,t){return h(e,t,[X.defRPr],X.sz)}function m(e,t){return u(e)?.txBody?.getBulletStyle(t)??a.getBulletStyle(e,t)}function h(e,t,n,i){return(u(e)?.txBody)?.getListStyle(t,n,i)??a.getListStyle(e,t,n,i)}function g(e,t){return u(e)?.txBody?.getParagraphStyle(t)??a.getParagraphStyle(e,t)}function _(e){return u(e)?.position??a?.getPosition(e)}function v(e,t){return u(e)?.txBody?.getBodyProperty(t)??a.getBodyProperty(e,t)}function y(e,t){return u(e)?.getLevelTextStyle(t)??{}}function b(e){return c.resolveColor(e)??a.resolveColor(e)}}async function PY({presentation:e,masters:t}){let{getDom:n,getDoms:i}=e,a={},o=await i(`ppt/slideLayouts/slideLayout\\d+\\.xml$`);for(let[i,s]of Object.entries(o)){let o=i.replace(`.xml`,`.xml.rels`).replace(`/slideLayouts/`,`/slideLayouts/_rels/`),c=i.split(`/`).at(-1),l=await n(o),u=kY({...e,$dom:l}),d=u.getMasterTarget(),f=t.getMaster(d),p=f.theme,m=NY({$dom:s,presentation:e,theme:p,filename:c,master:f,relationships:u});a[i]=m,OY(m.shapes,{presentation:e,theme:p,master:f,layout:m})}return{layouts:a,getLayout:s};function s(e){return a[e]}}const FY={rot:0,spcFirstLastPara:!1,vertOverflow:`overflow`,horzOverflow:`overflow`,vert:`horz`,wrap:`square`,lIns:91440,tIns:45720,rIns:91440,bIns:45720,numCol:1,spcCol:0,rtlCol:!1,fromWordArt:!1,anchor:`t`,anchorCtr:!1,forceAA:!1,upright:!1,compatLnSpc:!1},IY={marL:0,indent:0,algn:`l`,defTabSz:457200,lnSpc:{spcPct:1e5},spcBef:{spcPts:0},spcAft:{spcPts:0},buChar:`•`,buSzTx:null,buClrTx:null,defRPr:{sz:1800,b:0,i:0},tabLst:[{pos:457200,algn:`l`}]};function LY({$defRPr:e,upstreams:t,theme:n}){let i={};return i.fontSize??=qF(e,`sz`),i.color??=xO(e,[X.solidFill,X.srgbClr],`val`),i.schemeColor??=xO(e,[X.solidFill,X.srgbClr],`val`),i.latin??=xO(e,[X.latin],`typeface`),i.ea??=xO(e,[X.ea],`typeface`),i.cs??=xO(e,[X.cs],`typeface`),i.toCSS=o,i;function a(e,t){return e.includes(`body`)?`body-lvl${t+1}`:e.includes(`title`)?`title-lvl${t+1}`:`other-lvl${t+1}`}function o(i,o,s){let c=a(i,o),l=[],u=qF(e);xO(e,[X.solidFill,X.schemeClr],`val`),u&&l.push(`font-size: ${u}px;`);let d=LF(e,[X.solidFill],t,n);d&&l.push(`fill: ${d};`);let f=[`.${c} { ${l.join(``)} }`],p=xO(e,[X.latin],`typeface`),m=n.getFontFamilyByDash(p);p&&f.push(`.${c}.latin {font-family: "${m}", sans-serif; }`);let h=xO(e,[X.ea],`typeface`),g=n.getFontFamilyByDash(h);h&&f.push(`.${c}.ea {font-family: "${g}", sans-serif; }`);let _=xO(e,[X.cs],`typeface`),v=n.getFontFamilyByDash(_);return _&&f.push(`.${c}.cs {font-family: "${v}", sans-serif; }`),f}}const RY={title:44,ctrTitle:44,subTitle:32,body:32,obj:32,dt:12,ftr:12,sldNum:12};function zY({$dom:e,theme:t,relationships:n,presentation:i}){let a=MY({$clrMap:Y(e,[Z.clrMap]),theme:t}),o=DY({$spTree:Y(e,[Z.cSld,Z.spTree]),relationships:n,parent:`master`,theme:t,presentation:i,upstreams:[]}),s={};for(let e of o)e.placeholderIndex!==void 0&&(s[e.placeholderIndex]=e),e.placeholderType!==void 0&&(s[e.placeholderType]=e);function c(i){return AY({...i,$dom:e,upstream:t,relationships:n})}function l(e){let{placeholderIndex:t,placeholderType:n}=e;return t!==void 0&&s[t]?s[t]:n!==void 0&&s[n]?s[n]:null}let u={type:`master`,$dom:e,theme:t,shapes:o.filter(e=>e.notPlaceHolder),clrMap:a,placeholder2Shapes:s,resolveColor:D,getBodyProperty:y,getBackground:c,getPlaceholderForShape:l,getTxStyle:h,getFontSize:S,getBulletStyle:w,getBulletStyles:f,getParagraphStyle:d,getPosition:v,getTextStyle:T,getColor:C,getListStyle:_,mapSchemeColor:p,generateCSS:E};return u;function d(e,t){return{marL:_(e,t,[],OF.marL),indent:_(e,t,[],OF.indent),algn:_(e,t,[],OF.algn)}}function f(){let t={body:{},title:{},other:{}},n=[{key:`body`,path:Z.bodyStyle},{key:`title`,path:Z.titleStyle},{key:`other`,path:Z.otherStyle}];for(let{key:i,path:a}of n)for(let n=1;n<=9;n++){let o=Y(e,[Z.txStyles,a,`a:lvl${n}pPr`]);if(o){let e=J(o,X.buFont);e?.attributes?.typeface&&(t[i][n]={font:e.attributes.typeface})}}return t}function p(e){return colorMap&&colorMap[e]?colorMap[e]:e}function m(e,t,n){for(let n of t)e=e?.[n];return e&&Array.isArray(n)?Object.fromEntries(n.map(t=>[t,e?.[t]])):e?.[n]}function h(t){let n=x(t);return Y(e,[Z.txStyles,n])}function g(t,n,i,a){let o=x(t),s=Y(e,[Z.txStyles,o,`a:lvl${n+1}pPr`]);for(let e of i)if(s=J(s,e),!s)break;if(s)return Array.isArray(a)?Object.fromEntries(a.map(e=>[e,s?.attributes?.[e]])):s?.attributes?.[a]}function _(e,t,n,i){let a=l(e)?.txBody?.getListStyle(t,n,i);if(a!==void 0)return a;{let a=g(e,t,n,i);return a===void 0?m(IY,n,i):a}}function v(e){return l(e)?.position}function y(e,t){return l(e)?.txBody?.getBodyProperty(t)??FY[t]}function b(e){return e.placeholderType?e.placeholderType:l(e)?.placeholderType||null}function x(e){let t=e.getEffectivePlaceholderType();return[`subTitle`,`title`,`ctrTitle`].includes(t)?Z.titleStyle:[`body`,`obj`,`tbl`].includes(t)?Z.bodyStyle:Z.otherStyle}function S(e,t){let n=_(e,t,[X.defRPr],OF.sz);return n?qF(n):RY[b(e)]||18}function C(e,t){let n=_(e,t,[X.defRPr,X.solidFill,X.schemeClr],`val`);return _(e,t,[X.defRPr,X.solidFill,X.srgbClr],`val`)??D(n)}function w(e,t){let n=_(e,t,[X.buChar],OF.char);if(n)return{type:`char`,char:n,font:_(e,t,[X.buFont],OF.typeface)};{let n=_(e,t,[X.buAutoNum],OF.type);return n?{type:`number`,scheme:n}:null}}function T(e,t){return l(e)?.getLevelTextStyle(t)??{}}function E(){let t=u.theme,n=[];n.push(`.ppt-text { dominant-baseline: text-before-edge; position: relative;}`);let i=t?.getFontFamily?.(`minor`,`latin`)||`Calibri`,a=t?.getFontFamily?.(`minor`,`ea`)||`MS Gothic`,o=t?.getFontFamily?.(`minor`,`cs`)||`Arial`;n.push(`.latin { font-family: "${i}", sans-serif; }`),n.push(`.ea { font-family: "${a}", "PingFang SC", sans-serif; }`),n.push(`.cs { font-family: "${o}", sans-serif; }`);let s=Y(e,[Z.txStyles]);if(s)for(let e of[Z.titleStyle,Z.bodyStyle,Z.otherStyle])for(let i=0;i<9;i++){let a=Y(s,[e,`a:lvl${i+1}pPr`,X.defRPr]);if(a){let o=LY({$defRPr:a,theme:t,upstreams:[u]});n.push(...o.toCSS(e,i,u))}}let c=f?.();if(c)for(let[e,t]of Object.entries(c))for(let[i,a]of Object.entries(t))a.font&&n.push(`.${e}-lvl${i} .bullet { font-family: '${a.font}'; position: absolute;}`);return n.join(`
|
|
465
|
-
`)}function D(e){return a.resolveColor(e)}}async function
|
|
469
|
+
<text x="${n+a/2}" y="${c+o/2}" text-anchor="middle" dominant-baseline="middle" font-size="${l}" fill="#333">${Nk(i)}</text>
|
|
470
|
+
`})}),s+=` </g>`,s}return``},d}const AX={titleStyle:{font:`Arial`,size:5400,color:`#111111`},bodyStyle:{font:`Calibri`,size:3600,color:`#333333`},otherStyle:{font:`Verdana`,size:3200,color:`#666666`}},jX={latin:`Calibri`,ea:`MS Gothic`,cs:`Arial`},MX={lt:`latin`,ea:`ea`,cs:`cs`};async function NX({$dom:e,presentation:t}){return{$dom:e,presentation:t,getStyle:n,getAlignment:i,getAnchor:a,getBackground:s,resolveBackground:c,getBulletColor:x,getBulletFontSize:S,getBulletStyle:l,getFontFamily:d,getFontSize:p,getColor:m,getPosition:h,getStroke:g,getStrokeWidth:_,getShapeFill:o,getFontFamilyByDash:u,getMarginLeft:v,getIndentValue:y,getEffectOuterShadow:b,getXForm:C,resolveSchemeColor:f,getBodyProperty:w};function n(t){let n=Y(e,[X.objectDefaults,X.spDef,X.lstStyle,X.defPPr,X.defRPr]);if(n?.attributes?.sz)return n?.attributes?.sz;switch(t){case`title`:case`ctrTitle`:return AX.titleStyle||{};case`body`:return AX.bodyStyle||{};default:return AX.otherStyle||{}}}function i(e){return t.getAlignment()}function a(){return t.getAnchor()}function o(){}function s(){}function c(t){return Y(e,[X.themeElements,X.fmtScheme,X.bgFillStyleLst,t])}function l(){}function u(e=`+mj-lt`){if(e===`mj`)return d(`mj`,`latin`);if([`latin`,`ea`,`cs`].includes(e))return d(`mj`,e);let t=e.match(/\+(\w+)-(\w+)/);if(t){let e=t[1],n=MX[t[2]];return d(e,n)}return e}function d(t,n){let i=t===`mj`||t===`major`?X.majorFont:X.minorFont;return jk(e,[X.themeElements,X.fontScheme,i,`a:${n}`],`typeface`)||jX[n]||jX.latin}function f(t){if(t){let n=jk(e,[X.themeElements,X.clrScheme,`a:${t}`,X.srgbClr],`val`);if(n)return n;let i=jk(e,[X.themeElements,X.clrScheme,`a:${t}`,X.sysClr],`lastClr`);if(i)return i}}function p(n){return rL(e,[X.objectDefaults,X.spDefm,X.lstStyle,X.defPPr,X.defRPr],`sz`)??(n&&t.getFontSize())}function m(e){return e&&t.getFontSize()}function h(){}function g(){return`ffffff`}function _(t){return jk(e,[X.themeElements,X.fmtScheme,X.lnStyleLst,t,X.ln],`w`)||1}function v(){}function y(){}function b(){}function x(){}function S(){}function C(){}function w(){}}async function PX({presentation:e}){let{getDoms:t}=e,n={},i=await t(`ppt/theme/theme\\d+\\.xml$`),a;for(let[t,o]of Object.entries(i))n[t]=await NX({$dom:o,presentation:e}),a??=n[t];return{themes:n,theme0:a,getTheme:o};function o(e){return n[e]}}function FX(e){let{$sp:t,relationships:n,parent:i=`slide`,upstreams:a,theme:o,presentation:s}=e,c=mL(e);Y(t,[Z.spPr]);let l=Y(t,[Z.txBody]);return dL(c,{type:`shape`,renderContent:d,textContent:u,getLevelTextStyle:f}),c.txBody=bL({$sp:t,$txBody:l,relationships:n,shape:c,upstreams:a,theme:o,presentation:s}),c;function u(e){return c.txBody?c.txBody.render(e):``}function d(e){return[c.geometry.render(e)]}function f(e){let n=Y(t,[Z.txBody,X.lstStyle,`a:lvl${e+1}pPr`,X.defRPr]);return RunProperty({$defRPr:n})}}function IX(e){let{$cxnSp:t,$sp:n,relationships:i,parent:a=`slide`,upstreams:o,presentation:s,layout:c,master:l,theme:u}=e,d=mL({...e,cNvName:Z.nvCxnSpPr}),f=Y(t,[Z.style,X.lnRef]),p=J(f,X.schemeClr)?.attributes?.val,m=parseInt(f?.attributes?.idx||`1`,10);return dL(d,{parent:a,type:`connector`,xform:cL(Y(n,[Z.spPr,X.xfrm])),lineSchemeColor:p,lineIdx:m,renderContent:h}),d;function h({xform:e}){if(e){let{x:n=0,y:i=0,width:a,height:c,flipH:l,flipV:f,rotation:p}=e,m=fL({$sp:t,shape:d,width:a,height:c,upstreams:o,theme:u,presentation:s}),h=[];return h.push(m.render()),d.geometry.getStroke(),m.getTailEnd(),m.getHeadEnd(),h}return[]}}function LX({$spTree:e,relationships:t,upstreams:n,presentation:i,layout:a,master:o,theme:s,parent:c=`slide`}){let l=[],u=e?.children??[];for(let e of u){let u=e.name;if(Z.sp===u){let u=FX({$sp:e,relationships:t,parent:c,upstreams:n,presentation:i,layout:a,master:o,theme:s});u&&l.push(u)}else if(u===Z.cxnSp){let u=IX({$sp:e,$cxnSp:e,relationships:t,parent:c,upstreams:n,presentation:i,layout:a,master:o,theme:s});u&&l.push(u)}else if(e.name===Z.pic){let u=hL({$sp:e,$pic:e,relationships:t,parent:c,upstreams:n,presentation:i,layout:a,master:o,theme:s});u&&l.push(u)}else if(e.name===Z.graphicFrame){let u=kX({$sp:e,$graphicFrame:e,relationships:t,parent:c,upstreams:n,presentation:i,layout:a,master:o,theme:s});u&&l.push(u)}}return l}function RX(e,{presentation:t,theme:n,master:i,layout:a,slide:o}){e.forEach(e=>{e.presentation=t,e.theme=n,e.master=i,e.layout=a,e.slide=o})}function zX(e){let{$dom:t}=e,n={};for(let e of t?.children??[])if(e.name===`Relationship`){let t=e.attributes.Id,i=e.attributes.Target,a=e.attributes.Type,o=i.replace(`..`,`ppt`);t&&(n[t]={target:i,type:a,normalizedTarget:o,targetMode:e.attributes.TargetMode},a?.includes(`hyperlink`)&&(n[t]=i))}async function i(t){let i=n[t]?.normalizedTarget;return await e.getMedia(i)}function a(e){return n[e]?.target}function o(){return(Object.values(n).find(e=>e.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme`)?.target??``).replace(`..`,`ppt`)}function s(){return(Object.values(n).find(e=>e.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster`)?.target??``).replace(`..`,`ppt`)}function c(){return(Object.values(n).find(e=>e.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout`)?.target??``).replace(`..`,`ppt`)}function l(e){let t=n[e];return t?.type?.includes(`chart`)?t.normalizedTarget:null}function u(e){return n[e]}return{$dom:t,getThemeTarget:o,getMasterTarget:s,getLayoutTarget:c,getMedia:i,getTarget:a,getChartTarget:l,getRelationship:u}}function BX(e){let{$dom:t,upstream:n}=e,i=Y(t,[Z.cSld,Z.bg,Z.bgPr]);if(i)return VX({...e,$bgPr:i});let a=Y(t,[Z.cSld,Z.bg,Z.bgRef]),o=Ak(a,[],`idx`);if(o){if(o<1e3)return n?.resolveBackground(o);if(o===1e3)return VX({...e,noFill:!0});if(o===1001)return VX({...e,$solidFill:a});if(o===1002)return VX({...e,$gradFill:a});if(o===1003)return VX({...e,$pattFill:a})}return n?.getBackground(e)}function VX(e){let{$bgPr:t,width:n,height:i,relationships:a,upstreams:o,theme:s}=e;return dL(e,{type:null,fill:null,render:c}),e;async function c(c){if(t){if(e.noFill)return``;let c=qI(t,[X.solidFill],o,s);if(c)return`<rect x="0" y="0" width="${n}" height="${i}" style="fill: ${c}"/>`;let l=e.$blipFill??Y(t,[X.blipFill]);if(l){let e=Mk(l,[X.blip],[`r:embed`,`r:link`]),t=await a.getMedia(e);if(t)return`<image x="0" y="0" width="${n}" height="${i}" preserveAspectRatio="xMidYMid slice" href="${t}"/>`;console.warn(`${e} not exist in relationship`)}}return``}}function HX({$clrMap:e,theme:t}){let n=e?.attributes;function i(e){if(n){let i=n[e];if(i)return t.resolveSchemeColor(i)}return t.resolveSchemeColor(e)}return{resolveColor:i,attributes:n}}function UX({$dom:e,filename:t,presentation:n,theme:i,master:a,relationships:o}){let s=LX({$spTree:Y(e,[Z.cSld,Z.spTree]),relationships:o,parent:`layout`,presentation:n,theme:i,master:a,upstreams:[]}),c=HX({$clrMap:Y(e,[Z.clrMap]),theme:i}),l={};for(let e of s)e.placeholderIndex!==void 0&&(l[e.placeholderIndex]=e),e.placeholderType!==void 0&&(l[e.placeholderType]=e);return{type:`layout`,presentation:n,master:a,theme:i,filename:t,shapes:s.filter(e=>e.notPlaceHolder),placeholder2Shapes:l,$dom:e,background:void 0,getBodyProperty:v,getBackground:f,resolveBackground:d,getPlaceholderForShape:u,getFontSize:p,getBulletStyle:m,getParagraphStyle:g,getPosition:_,clrMap:c,getTextStyle:y,getListStyle:h,resolveColor:b};function u(e){let{placeholderIndex:t,placeholderType:n}=e;return t!==void 0&&l[t]?l[t]:n!==void 0&&l[n]?l[n]:null}function d(e){}function f(t){return BX({...t,$dom:e,upstream:a,relationships:o})}function p(e,t){return h(e,t,[X.defRPr],X.sz)}function m(e,t){return u(e)?.txBody?.getBulletStyle(t)??a.getBulletStyle(e,t)}function h(e,t,n,i){return(u(e)?.txBody)?.getListStyle(t,n,i)??a.getListStyle(e,t,n,i)}function g(e,t){return u(e)?.txBody?.getParagraphStyle(t)??a.getParagraphStyle(e,t)}function _(e){return u(e)?.position??a?.getPosition(e)}function v(e,t){return u(e)?.txBody?.getBodyProperty(t)??a.getBodyProperty(e,t)}function y(e,t){return u(e)?.getLevelTextStyle(t)??{}}function b(e){return c.resolveColor(e)??a.resolveColor(e)}}async function WX({presentation:e,masters:t}){let{getDom:n,getDoms:i}=e,a={},o=await i(`ppt/slideLayouts/slideLayout\\d+\\.xml$`);for(let[i,s]of Object.entries(o)){let o=i.replace(`.xml`,`.xml.rels`).replace(`/slideLayouts/`,`/slideLayouts/_rels/`),c=i.split(`/`).at(-1),l=await n(o),u=zX({...e,$dom:l}),d=u.getMasterTarget(),f=t.getMaster(d),p=f.theme,m=UX({$dom:s,presentation:e,theme:p,filename:c,master:f,relationships:u});a[i]=m,RX(m.shapes,{presentation:e,theme:p,master:f,layout:m})}return{layouts:a,getLayout:s};function s(e){return a[e]}}const GX={rot:0,spcFirstLastPara:!1,vertOverflow:`overflow`,horzOverflow:`overflow`,vert:`horz`,wrap:`square`,lIns:91440,tIns:45720,rIns:91440,bIns:45720,numCol:1,spcCol:0,rtlCol:!1,fromWordArt:!1,anchor:`t`,anchorCtr:!1,forceAA:!1,upright:!1,compatLnSpc:!1},KX={marL:0,indent:0,algn:`l`,defTabSz:457200,lnSpc:{spcPct:1e5},spcBef:{spcPts:0},spcAft:{spcPts:0},buChar:`•`,buSzTx:null,buClrTx:null,defRPr:{sz:1800,b:0,i:0},tabLst:[{pos:457200,algn:`l`}]};function qX({$defRPr:e,upstreams:t,theme:n}){let i={};return i.fontSize??=rL(e,`sz`),i.color??=jk(e,[X.solidFill,X.srgbClr],`val`),i.schemeColor??=jk(e,[X.solidFill,X.srgbClr],`val`),i.latin??=jk(e,[X.latin],`typeface`),i.ea??=jk(e,[X.ea],`typeface`),i.cs??=jk(e,[X.cs],`typeface`),i.toCSS=o,i;function a(e,t){return e.includes(`body`)?`body-lvl${t+1}`:e.includes(`title`)?`title-lvl${t+1}`:`other-lvl${t+1}`}function o(i,o,s){let c=a(i,o),l=[],u=rL(e);jk(e,[X.solidFill,X.schemeClr],`val`),u&&l.push(`font-size: ${u}px;`);let d=qI(e,[X.solidFill],t,n);d&&l.push(`fill: ${d};`);let f=[`.${c} { ${l.join(``)} }`],p=jk(e,[X.latin],`typeface`),m=n.getFontFamilyByDash(p);p&&f.push(`.${c}.latin {font-family: "${m}", sans-serif; }`);let h=jk(e,[X.ea],`typeface`),g=n.getFontFamilyByDash(h);h&&f.push(`.${c}.ea {font-family: "${g}", sans-serif; }`);let _=jk(e,[X.cs],`typeface`),v=n.getFontFamilyByDash(_);return _&&f.push(`.${c}.cs {font-family: "${v}", sans-serif; }`),f}}const JX={title:44,ctrTitle:44,subTitle:32,body:32,obj:32,dt:12,ftr:12,sldNum:12};function YX({$dom:e,theme:t,relationships:n,presentation:i}){let a=HX({$clrMap:Y(e,[Z.clrMap]),theme:t}),o=LX({$spTree:Y(e,[Z.cSld,Z.spTree]),relationships:n,parent:`master`,theme:t,presentation:i,upstreams:[]}),s={};for(let e of o)e.placeholderIndex!==void 0&&(s[e.placeholderIndex]=e),e.placeholderType!==void 0&&(s[e.placeholderType]=e);function c(i){return BX({...i,$dom:e,upstream:t,relationships:n})}function l(e){let{placeholderIndex:t,placeholderType:n}=e;return t!==void 0&&s[t]?s[t]:n!==void 0&&s[n]?s[n]:null}let u={type:`master`,$dom:e,theme:t,shapes:o.filter(e=>e.notPlaceHolder),clrMap:a,placeholder2Shapes:s,resolveColor:D,getBodyProperty:y,getBackground:c,getPlaceholderForShape:l,getTxStyle:h,getFontSize:S,getBulletStyle:w,getBulletStyles:f,getParagraphStyle:d,getPosition:v,getTextStyle:T,getColor:C,getListStyle:_,mapSchemeColor:p,generateCSS:E};return u;function d(e,t){return{marL:_(e,t,[],RI.marL),indent:_(e,t,[],RI.indent),algn:_(e,t,[],RI.algn)}}function f(){let t={body:{},title:{},other:{}},n=[{key:`body`,path:Z.bodyStyle},{key:`title`,path:Z.titleStyle},{key:`other`,path:Z.otherStyle}];for(let{key:i,path:a}of n)for(let n=1;n<=9;n++){let o=Y(e,[Z.txStyles,a,`a:lvl${n}pPr`]);if(o){let e=J(o,X.buFont);e?.attributes?.typeface&&(t[i][n]={font:e.attributes.typeface})}}return t}function p(e){return colorMap&&colorMap[e]?colorMap[e]:e}function m(e,t,n){for(let n of t)e=e?.[n];return e&&Array.isArray(n)?Object.fromEntries(n.map(t=>[t,e?.[t]])):e?.[n]}function h(t){let n=x(t);return Y(e,[Z.txStyles,n])}function g(t,n,i,a){let o=x(t),s=Y(e,[Z.txStyles,o,`a:lvl${n+1}pPr`]);for(let e of i)if(s=J(s,e),!s)break;if(s)return Array.isArray(a)?Object.fromEntries(a.map(e=>[e,s?.attributes?.[e]])):s?.attributes?.[a]}function _(e,t,n,i){let a=l(e)?.txBody?.getListStyle(t,n,i);if(a!==void 0)return a;{let a=g(e,t,n,i);return a===void 0?m(KX,n,i):a}}function v(e){return l(e)?.position}function y(e,t){return l(e)?.txBody?.getBodyProperty(t)??GX[t]}function b(e){return e.placeholderType?e.placeholderType:l(e)?.placeholderType||null}function x(e){let t=e.getEffectivePlaceholderType();return[`subTitle`,`title`,`ctrTitle`].includes(t)?Z.titleStyle:[`body`,`obj`,`tbl`].includes(t)?Z.bodyStyle:Z.otherStyle}function S(e,t){let n=_(e,t,[X.defRPr],RI.sz);return n?rL(n):JX[b(e)]||18}function C(e,t){let n=_(e,t,[X.defRPr,X.solidFill,X.schemeClr],`val`);return _(e,t,[X.defRPr,X.solidFill,X.srgbClr],`val`)??D(n)}function w(e,t){let n=_(e,t,[X.buChar],RI.char);if(n)return{type:`char`,char:n,font:_(e,t,[X.buFont],RI.typeface)};{let n=_(e,t,[X.buAutoNum],RI.type);return n?{type:`number`,scheme:n}:null}}function T(e,t){return l(e)?.getLevelTextStyle(t)??{}}function E(){let t=u.theme,n=[];n.push(`.ppt-text { dominant-baseline: text-before-edge; position: relative;}`);let i=t?.getFontFamily?.(`minor`,`latin`)||`Calibri`,a=t?.getFontFamily?.(`minor`,`ea`)||`MS Gothic`,o=t?.getFontFamily?.(`minor`,`cs`)||`Arial`;n.push(`.latin { font-family: "${i}", sans-serif; }`),n.push(`.ea { font-family: "${a}", "PingFang SC", sans-serif; }`),n.push(`.cs { font-family: "${o}", sans-serif; }`);let s=Y(e,[Z.txStyles]);if(s)for(let e of[Z.titleStyle,Z.bodyStyle,Z.otherStyle])for(let i=0;i<9;i++){let a=Y(s,[e,`a:lvl${i+1}pPr`,X.defRPr]);if(a){let o=qX({$defRPr:a,theme:t,upstreams:[u]});n.push(...o.toCSS(e,i,u))}}let c=f?.();if(c)for(let[e,t]of Object.entries(c))for(let[i,a]of Object.entries(t))a.font&&n.push(`.${e}-lvl${i} .bullet { font-family: '${a.font}'; position: absolute;}`);return n.join(`
|
|
471
|
+
`)}function D(e){return a.resolveColor(e)}}async function XX({presentation:e,themes:t}){let{getDom:n,getDoms:i}=e,a={},o=await i(`ppt/slideMasters/slideMaster\\d+\\.xml$`),s;for(let[i,c]of Object.entries(o)){let o=await n(i.replace(`.xml`,`.xml.rels`).replace(`/slideMasters/`,`/slideMasters/_rels/`)),l=zX({...e,$dom:o}),u=l.getThemeTarget(),d=t.getTheme(u),f=await YX({$dom:c,relationships:l,theme:d});s??=f,a[i]=f,RX(f.shapes,{presentation:e,master:f,theme:d})}return{master0:s,masters:a,getMaster:c};function c(e){return a[e]}}function ZX({$dom:e,filename:t,slideNum:n,upstreams:i,presentation:a,layout:o,master:s,theme:c,relationships:l}){let{width:u,height:d}=a.slideSize,f=Y(e,[Z.cSld,Z.spTree]),p=HX({$clrMap:Y(e,[Z.clrMap]),theme:c}),m=LX({$spTree:f,relationships:l,parent:`slide`,upstreams:i,layout:o,master:s,theme:c,presentation:a});return{type:`slide`,presentation:a,layout:o,master:o?.master,slideNumber:n,filename:t,shapes:m,$dom:e,render:_,text:v,resolveColor:g};function h(){return BX({$dom:e,upstream:o,upstreams:i,width:u,height:d,relationships:l})}function g(e){return p.resolveColor(e)??o.resolveColor(e)}async function _(e){let t=[];async function n(e){for(let n of e){let e=(await n.render()).trim();e&&t.push(e)}}await n(s.shapes),await n(o.shapes),await n(m);let a=h(),c=a?await a.render(``,i):``,l=s.generateCSS();return[`<svg viewBox="0 0 ${u} ${d}" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="width: 100%; height: 100%;" class="slide-content">`,`<style>\n${l}\n</style>`,`
|
|
466
472
|
<defs>
|
|
467
473
|
<filter id="bulletShadow" x="-100%" y="-100%"
|
|
468
474
|
width="300%" height="300%"
|
|
@@ -479,13 +485,13 @@ l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
479
485
|
`,c,t.join(`
|
|
480
486
|
`),`<text x="${u/2}" y="${d}" style="dominant-baseline: ideographic">${e}</text>`,`</svg>`].filter(e=>e).join(`
|
|
481
487
|
`)}function v(){let e=[];for(let t of m)t.text&&e.push(t.text());return e.join(`
|
|
482
|
-
`)}}async function
|
|
483
|
-
`))}let s=
|
|
488
|
+
`)}}async function QX({presentation:e,layouts:t}){let{getDom:n,getMedia:i,getEntry:a,getDoms:o,sldFiles:s}=e,c=[];for(let a=0;a<s.length;a++){let o=s[a],l=o.split(`/`).at(-1),u=await n(o),d=a+1,f=zX({$dom:await n(o.replace(`.xml`,`.xml.rels`).replace(`/slides/`,`/slides/_rels/`)),getMedia:i}),p=f.getLayoutTarget(),m=t.getLayout(p),h=m?.master,g=h?.theme,_=ZX({$dom:u,filename:l,upstreams:[m,h],slideNum:d,presentation:e,layout:m,master:h,theme:g,relationships:f});c.push(_)}return c}async function $X(e){let{slides:t,slideSize:n}=e,i=(n.height/n.width*100).toFixed(2),a=`${`width: calc(0.5 * 100vh * ${(100/parseFloat(i)).toFixed(4)})`}; ${`aspect-ratio: ${(100/parseFloat(i)).toFixed(4)}`};`,o=[];for(let e=0,n=t.length;e<n;e+=1){let n=t[e],i=e+1,s=await n.render(e+1),c=`data-index="${i}" data-slide="${n.filename}" data-layout="${n?.layout?.filename}"`;o.push([`<div class="slide" ${c} style="${a}">`,s,`</div>`].join(`
|
|
489
|
+
`))}let s=eZ(i),c=e.tableStyle.generateCSS();return`<!DOCTYPE html>
|
|
484
490
|
<html lang="en">
|
|
485
491
|
<head>
|
|
486
492
|
<meta charset="UTF-8">
|
|
487
493
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
488
|
-
<title>${
|
|
494
|
+
<title>${gL(t[0]?.title||`Presentation`)}</title>
|
|
489
495
|
<style>
|
|
490
496
|
${s}
|
|
491
497
|
${c}
|
|
@@ -514,7 +520,7 @@ ${o.join(`
|
|
|
514
520
|
</div>
|
|
515
521
|
|
|
516
522
|
</body>
|
|
517
|
-
</html>`}function
|
|
523
|
+
</html>`}function eZ(e){return`
|
|
518
524
|
:root {
|
|
519
525
|
--color-border: rgba(120, 120, 120, 0.5);
|
|
520
526
|
}
|
|
@@ -630,19 +636,19 @@ body {
|
|
|
630
636
|
}
|
|
631
637
|
|
|
632
638
|
|
|
633
|
-
${
|
|
634
|
-
`}async function
|
|
635
|
-
`);return{html:await
|
|
636
|
-
`)}}function
|
|
637
|
-
`)}function l(){return`<div class="worksheet grid-table" id="sheet-${t}">${c()}</div>`}}function
|
|
639
|
+
${LI()}
|
|
640
|
+
`}async function tZ(e){let{getEntry:t,getMedia:n,getDom:i,getDoms:a}=e instanceof ArrayBuffer?await Hk(e):e,o=await i(`ppt/presentation.xml`),s=rL(J(o,Z.defaultTextStyle)?.attributes?.sz),c=J(o,Z.sldSz),l=c?{width:eL(c.attributes.cx),height:eL(c.attributes.cy)}:{width:960,height:640},u=zX({$dom:await i(`ppt/_rels/presentation.xml.rels`),getMedia:n}),d={type:`pptx`,slideSize:l,sldFiles:Ok(o,[Z.sldIdLst,Z.sldId]).map(e=>{let t=e.attributes[`r:id`];return`ppt/`+u.getTarget(t)}),getDom:i,getDoms:a,getMedia:n,getFontSize:h,getAlignment:()=>`t`,getAnchor:()=>`l`};d.themes=await PX({getMedia:n,presentation:d}),d.masters=await XX({getMedia:n,presentation:d,themes:d.themes}),d.layouts=await WX({getMedia:n,presentation:d,masters:d.masters}),d.slides=await QX({getMedia:n,presentation:d,layouts:d.layouts});let f=d.masters.master0,p=d.themes.theme0;d.tableStyle=CL({$tblStyleLst:await i(`ppt/tableStyles.xml`),upstreams:[f],theme:p});let m=d.slides.map(e=>e.text()).join(`
|
|
641
|
+
`);return{html:await $X(d),text:m};function h(){return s??18}}function nZ(e){let t=``;for(let n of e.children)if(n.name===`t`)t+=Dk(n);else if(n.name===`r`){let e=n.children.find(e=>e.name===`t`);e&&(t+=Dk(e))}return t}function rZ(e){let t=[];for(let n of e.children)if(n.name===`si`){let e=nZ(n);t.push(e)}return t}function iZ({$dom:e}){let t={};for(let n of e?.children??[])if(n.name===`Relationship`){let e=n.attributes.Id,i=n.attributes.Target,a=n.attributes.Type;e&&(t[e]={target:i,type:a,targetMode:n.attributes.TargetMode},a?.includes(`hyperlink`)&&(t[e]=i))}function n(e){let n=t[e];return i(n.target)}function i(e){return e?`xl/${e}`:``}function a(e){return i(Object.values(t).find(t=>t.type===e).target)}function o(){return a(`http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles`)}function s(){return a(`http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme`)}return{$dom:e,getTarget:n,getThemeTarget:s,getStyleTarget:o,getTargetByType:a}}function aZ(e,t){let n=e.attributes.r||``,i=e.attributes.t||``,a=e.children.find(e=>e.name===`v`),o=a?Dk(a):``;i===`s`&&o&&(o=t[parseInt(o)]||``);let s=e.children.find(e=>e.name===`f`),c=s?Dk(s):null;return{ref:n,value:o,type:i,formula:c,toHtml:l};function l(e,t,n,i,a,s){let c=[`grid-cell`];return n&&c.push(`first-row`),i&&c.push(`last-row`),a&&c.push(`first-col`),s&&c.push(`last-col`),`<div data-row="${e}" data-col="${t}" class="${c.join(` `)}" >${gL(o)}</div>`}}function oZ(e,t){let n=e.attributes.r||``,i=[];for(let n of e.children)if(n.name===`c`){let e=aZ(n,t);i.push(e)}return{rowNum:n,toHtml:a,cells:i};function a(e,t,n){let a=i.length-1;return i.map((i,o)=>i.toHtml(e,o,t,n,o===0,o===a)).join(`
|
|
642
|
+
`)}}function sZ({$dom:e,id:t,name:n,sharedStrings:i,relationships:a}){let o=Y(e,[`sheetData`]),s=[];if(o){for(let e of o.children)if(e.name===`row`){let t=oZ(e,i);s.push(t)}}return{id:t,name:n,rows:s,toHtml:l,innerHTML:c};function c(){let e=s.length-1;return s.map((t,n)=>t.toHtml(n,n===0,n===e)).join(`
|
|
643
|
+
`)}function l(){return`<div class="worksheet grid-table" id="sheet-${t}">${c()}</div>`}}function cZ({title:e,sheets:t}){let n=t.map(({id:e,name:t})=>`<div class="workbook-tab" id="tab-${e}">${t}</div>`).join(``),i=t.map(e=>e.toHtml()||``).join(`
|
|
638
644
|
`);return`<!DOCTYPE html>
|
|
639
645
|
<html lang="en">
|
|
640
646
|
<head>
|
|
641
647
|
<meta charset="UTF-8">
|
|
642
648
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
643
|
-
<title>${
|
|
649
|
+
<title>${gL(e||`Excel`)}</title>
|
|
644
650
|
<style>
|
|
645
|
-
${
|
|
651
|
+
${lZ()}
|
|
646
652
|
</style>
|
|
647
653
|
</head>
|
|
648
654
|
<body>
|
|
@@ -650,9 +656,9 @@ ${$Y()}
|
|
|
650
656
|
<div class="workbook-tabs">${n}</div>
|
|
651
657
|
${i}
|
|
652
658
|
</div>
|
|
653
|
-
<script>${
|
|
659
|
+
<script>${uZ()}<\/script>
|
|
654
660
|
</body>
|
|
655
|
-
</html>`}function
|
|
661
|
+
</html>`}function lZ(){return`
|
|
656
662
|
:root {
|
|
657
663
|
--color-border: rgba(120, 120, 120, 0.5);
|
|
658
664
|
}
|
|
@@ -743,7 +749,7 @@ body {
|
|
|
743
749
|
font-weight: 600;
|
|
744
750
|
background: #f5f5f5;
|
|
745
751
|
}
|
|
746
|
-
`}function
|
|
752
|
+
`}function uZ(){return`
|
|
747
753
|
const $tabs = document.querySelectorAll('.workbook-tab')
|
|
748
754
|
const $sheets = document.querySelectorAll('.worksheet')
|
|
749
755
|
if ($tabs[0]) $tabs[0].classList.add('active')
|
|
@@ -757,17 +763,17 @@ body {
|
|
|
757
763
|
const $targetSheet = document.querySelector(\`#sheet-\${id}\`)
|
|
758
764
|
$targetSheet.classList.add('active')
|
|
759
765
|
}
|
|
760
|
-
}) `}async function
|
|
761
|
-
`)}}function
|
|
762
|
-
`)}function i(){return`<div class="worksheet grid-table">${n()}</div>`}}function
|
|
766
|
+
}) `}async function dZ(e){let{getEntry:t,getMedia:n,getDom:i,getDoms:a}=e instanceof ArrayBuffer?await Hk(e):e,o=await i(`xl/workbook.xml`),s=rZ(await i(`xl/sharedStrings.xml`)),c=iZ({$dom:await i(`xl/_rels/workbook.xml.rels`)}),l=Ok(o,[`sheets`,`sheet`])||[],u=[];for(let e of l){let t=jk(e,[],lL.id),n=jk(e,[],`name`),a=jk(e,[],`sheetId`),o=await i(c.getTarget(t));u.push(sZ({$dom:o,id:t,name:n,sheetId:a,sharedStrings:s,relationships:c}))}return{html:cZ({sheets:u})}}const fZ=II(`w`,`w:`,`after.anchor.b.before.body.bookmarkEnd.bookmarkStart.bottom.br.color.cols.docGrid.document.drawing.firstColumn.firstRow.footer.gridCol.gridSpan.gutter.h.header.history.hyperlink.i.id.ilvl.lastColumn.lastRenderedPageBreak.lastRow.left.line.linePitch.lineRule.name.noHBand.noProof.noVBand.num.numId.numPr.p.pPr.pStyle.pgMar.pgSz.r.rPr.rStyle.right.rsidP.rsidRDefault.rsidRPr.rsidSect.rsidTr.sectPr.space.spacing.sz.t.tab.tbl.tblCellMar.tblGrid.tblHeader.tblInd.tblLook.tblPr.tblStyle.tblW.tc.tcPr.tcW.top.tr.trPr.type.u.val.w`.split(`.`));II(`w`,``,[]);const pZ=II(`wp`,`wp:`,[`anchor`,`inline`,`extent`,`docPr`,`positionH`,`positionV`,`posOffset`,`wrapSquare`,`simplePos`]);function mZ(e,t={},n){let i={text:``,formatting:{},toHtml:s},a=e.children.find(e=>e.name===`w:rPr`);if(a){i.formatting.bold=a.children.some(e=>e.name===`w:b`),i.formatting.italic=a.children.some(e=>e.name===`w:i`),i.formatting.underline=a.children.some(e=>e.name===`w:u`);let e=a.children.find(e=>e.name===`w:color`);if(e){let t=e.attributes[`w:val`];t&&t!==`auto`&&(i.formatting.color=`#`+t)}let t=a.children.find(e=>e.name===`w:sz`);if(t){let e=t.attributes[`w:val`];e&&(i.formatting.fontSize=parseInt(e)/2)}}let o=Y(e,[fZ.drawing]);if(o){let e=hZ(o,t,n);if(e)return i.image=e,i.text=``,i.toHtml=function(){return s(i)},i}return i.text=e.children.filter(e=>e.name===`w:t`).map(e=>Dk(e)).join(``),i;function s(){if(i.image){let e=i.image,t=e.width?` width="${e.width}"`:``,n=e.height?` height="${e.height}"`:``,a=e.alt?` alt="${gL(e.alt)}"`:``;return`<img src="${e.dataUrl}"${t}${n}${a} style="vertical-align: middle; margin: 0 4px;">`}let e=gL(i.text),t=[];return i.formatting&&(i.formatting.color&&t.push(`color: ${i.formatting.color}`),i.formatting.fontSize&&t.push(`font-size: ${i.formatting.fontSize}pt`),i.formatting.bold&&(e=`<b>${e}</b>`),i.formatting.italic&&(e=`<i>${e}</i>`),i.formatting.underline&&(e=`<u>${e}</u>`)),i.hyperlink&&i.url&&(e=`<a href="${i.url}" target="_blank" class="link-block">${e}</a>`),t.length>0&&(e=`<span style="${t.join(`; `)}">${e}</span>`),e}}async function hZ(e,t,n){try{let i=Ek(e,X.blip)[0];if(!i)return null;let a=i.attributes[lL.embed]||i.attributes[lL.link];if(!a)return null;let o=t[a];if(!o)return null;let s=o.target||o;if(!s)return null;let c=await n(s)||await n(`word/`+s);if(!c)return null;let l=Ek(e,pZ.extent)[0],u=null,d=null;if(l){let e=l.attributes.cx,t=l.attributes.cy;e&&(u=Math.round(parseInt(e)/914400*96)),t&&(d=Math.round(parseInt(t)/914400*96))}let f=Ek(e,pZ.docPr)[0]?.attributes.descr||``;return{dataUrl:c,width:u,height:d,alt:f}}catch(e){return console.error(`Error extracting image:`,e),null}}function gZ(e,t={},n){let i=[],a=``,o=null,s=jk(e,[fZ.pPr,fZ.pStyle],fZ.val),c=jk(e,[fZ.bookmarkStart],fZ.name),l=Y(e,[fZ.pPr,fZ.numPr]);if(l){let e=Y(l,[fZ.ilvl]),t=Y(l,[fZ.numId]);o={level:e?parseInt(e.attributes[fZ.val]):0,numId:t?parseInt(t.attributes[fZ.val]):1}}for(let o of e.children)if(o.name===fZ.r){let e=mZ(o,t,n);i.push(e),a+=e.text}else if(o.name===fZ.hyperlink){let e=_Z(o,t);i.push(e),a+=e.text}return{text:a,runs:i,style:s,bullet:o,toHtml:u};function u(){let e=s?` class="${s}"`:``,t=o?o.level*24:0,n=``,a=c?`id="${c}"`:``;for(let e of i)n+=e.toHtml();return o?`<div class="bullet-item" ${a} style="margin-left: ${t}px"${e}><span class="bullet-marker">•</span><span class="bullet-content">${n}</span></div>`:`<p${e} ${a} >${n}</p>`}}function _Z(e,t){let n=``,i={};for(let t of e.children)if(t.name===fZ.r){let e=mZ(t);n+=e.text,Object.keys(e.formatting).length>0&&(i=e.formatting)}let a=e.attributes[lL.id],o=jk(e,[],fZ.anchor),s=t[a],c=s?.type===`hyperlink`?s.target:typeof s==`string`?s:null,l={text:n,anchor:o,hyperlink:!0,url:c,formatting:i};return l.toHtml=function(){return vZ(l)},l}function vZ(e){let t=gL(e.text),n=[];return e.formatting&&(e.formatting.color&&n.push(`color: ${e.formatting.color}`),e.formatting.fontSize&&n.push(`font-size: ${e.formatting.fontSize}pt`),e.formatting.bold&&(t=`<b>${t}</b>`),e.formatting.italic&&(t=`<i>${t}</i>`),e.formatting.underline&&(t=`<u>${t}</u>`)),e.url?t=`<a href="${e.url}" target="_blank" class="link-block">${t}</a>`:e.anchor&&(t=`<a href="#${e.anchor}" class="link-block">${t}</a>`),n.length>0&&(t=`<span style="${n.join(`; `)}">${t}</span>`),t}function yZ(e){let t=``,n=1;for(let i of e.children)if(i.name===fZ.p){let e=gZ(i);t+=e.text+` `}else if(i.name===fZ.tcPr){for(let e of i.children)if(e.name===fZ.gridSpan){let t=e.attributes[fZ.val];t&&(n=parseInt(t,10))}}return{text:t.trim(),gridSpan:n,toHtml:i};function i(e,n,i,a,o,s){let c=[`grid-cell`];return i&&c.push(`first-row`),a&&c.push(`last-row`),o&&c.push(`first-col`),s&&c.push(`last-col`),`<div data-row="${e}" data-col="${n}" class="${c.join(` `)}" >${gL(t)}</div>`}}function bZ(e){let t=[];for(let n of e.children)if(n.name===fZ.tc){let e=yZ(n);t.push(e)}return{toHtml:n,cells:t};function n(e,n,i){let a=t.length-1;return t.map((t,o)=>t.toHtml(e,o,n,i,o===0,o===a)).join(`
|
|
767
|
+
`)}}function xZ(e){let t=[];for(let n of e.children)if(n.name===fZ.tr){let e=bZ(n);t.push(e)}return{rows:t,toHtml:i,innerHTML:n};function n(){let e=t.length-1;return t.map((t,n)=>t.toHtml(n,n===0,n===e)).join(`
|
|
768
|
+
`)}function i(){return`<div class="worksheet grid-table">${n()}</div>`}}function SZ({content:e,title:t}){let n=e.map(e=>e.data.toHtml()).join(`
|
|
763
769
|
`);return`<!DOCTYPE html>
|
|
764
770
|
<html lang="en">
|
|
765
771
|
<head>
|
|
766
772
|
<meta charset="UTF-8">
|
|
767
773
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
768
|
-
<title>${
|
|
774
|
+
<title>${gL(t||`Excel`)}</title>
|
|
769
775
|
<style>
|
|
770
|
-
${
|
|
776
|
+
${CZ()}
|
|
771
777
|
</style>
|
|
772
778
|
</head>
|
|
773
779
|
<body >
|
|
@@ -777,7 +783,7 @@ ${pX()}
|
|
|
777
783
|
</div>
|
|
778
784
|
</div>
|
|
779
785
|
</body>
|
|
780
|
-
</html>`}function
|
|
786
|
+
</html>`}function CZ(){return`
|
|
781
787
|
:root {
|
|
782
788
|
--color-border: rgba(120, 120, 120, 0.5);
|
|
783
789
|
}
|
|
@@ -872,16 +878,15 @@ body {
|
|
|
872
878
|
font-weight: 600;
|
|
873
879
|
}
|
|
874
880
|
|
|
875
|
-
${
|
|
876
|
-
`}async function
|
|
877
|
-
`).forEach((a,o)=>{(o>0||n===null)&&i(),n.fontUnits=Math.max(n.fontUnits,e),a.length>0&&n.segments.push({text:a,run:t})})}else i();return t.map(t=>({alignCode:e.alignCode,...t}))}function
|
|
878
|
-
`)}function
|
|
881
|
+
${LI()}
|
|
882
|
+
`}async function wZ(e){let{getEntry:t,getMedia:n,getDom:i,getDoms:a}=e instanceof ArrayBuffer?await Hk(e):e,o=J(await i(`word/document.xml`),fZ.body),s=TZ(await i(`word/_rels/document.xml.rels`)),c=[],l=[],u=[];if(o?.children){for(let e of o.children)if(e.name===fZ.p){let t=gZ(e,s,n);(t.text||t.runs.length>0)&&(c.push(t),u.push({type:`paragraph`,data:t}))}else if(e.name===fZ.tbl){let t=xZ(e);l.push(t),u.push({type:`table`,data:t})}}return{html:SZ({content:u,paragraphs:c,tables:l})}}function TZ(e){let t={};if(!e)return t;for(let n of e.children)if(n.name===`Relationship`){let e=n.attributes.Id,i=n.attributes.Target,a=n.attributes.Type;a&&a.includes(`hyperlink`)?t[e]={type:`hyperlink`,target:i}:a&&a.includes(`image`)&&(t[e]={type:`image`,target:i})}return t}function EZ(e,t){let n=e.readUInt16LE(t),i=n&15,a=n>>4,o=e.readUInt16LE(t+2),s=e.readUInt32LE(t+4);return{version:i,instance:a,recordType:o,recordLength:s,dataStart:t+8,dataEnd:t+8+s,isContainer:i===15}}function DZ(e,t){let n=0;for(;n+8<=e.length;){let i=EZ(e,n);i.dataEnd<=e.length?(t(i),n=i.dataEnd):n=e.length}}function OZ(e,t,n){let i=n||[];return DZ(e,n=>{n.recordType===t&&i.push({header:n,data:e.slice(n.dataStart,n.dataEnd)}),n.isContainer&&OZ(e.slice(n.dataStart,n.dataEnd),t,i)}),i}const kZ={Document:1e3,DocumentAtom:1001,Slide:1006,SlideAtom:1007,Notes:1008,MainMaster:1016,List:2e3,TextHeaderAtom:3999,TextCharsAtom:4e3,TextBytesAtom:4008,StyleTextPropAtom:4001,SlideListWithText:4080,SlidePersistAtom:4083,UserEditAtom:4085,PersistDirectoryAtom:6002,OfficeArtDgContainer:61442,OfficeArtSpgrContainer:61443,OfficeArtSpContainer:61444,OfficeArtFsp:61450,OfficeArtFspgr:61449,OfficeArtFopt:61451,OfficeArtClientTextbox:61453,OfficeArtClientAnchor:61456,OfficeArtChildAnchor:61455},AZ={pictureBlipIndex:260,fillColor:385,fillStyleBooleans:447};function jZ(e){let t=new Map,n=0;for(;n+6<=e.length;){let i=e.readUInt16LE(n),a=e.readUInt32LE(n+2),o=i&16383;t.set(o,a),n+=6}return t}function MZ(e){let t=null;if(e.length>=8){let n=e.readInt16LE(0),i=e.readInt16LE(2),a=e.readInt16LE(4),o=e.readInt16LE(6);t={left:i,top:n,width:a-i,height:o-n}}return t}function NZ(e){let t={shapeId:0,shapeType:0,isGroup:!1,anchor:null,pictureIndex:0,fillColor:null,fillFilled:!1,textBoxData:null},n=0;for(;n+8<=e.length;){let i=EZ(e,n),a=e.slice(i.dataStart,i.dataEnd);if(i.recordType===kZ.OfficeArtFsp)t.shapeType=i.instance,t.shapeId=a.readUInt32LE(0),t.isGroup=!!(a.readUInt32LE(4)&1);else if(i.recordType===kZ.OfficeArtFopt){let e=jZ(a);e.has(AZ.pictureBlipIndex)&&(t.pictureIndex=e.get(AZ.pictureBlipIndex)),e.has(AZ.fillColor)&&(t.fillColor=e.get(AZ.fillColor));let n=e.get(AZ.fillStyleBooleans);if(n!==void 0){let e=!!(n&16),i=!!(n>>16&16);t.fillFilled=e&&i}else t.fillFilled=t.fillColor!==null}else i.recordType===kZ.OfficeArtClientAnchor?t.anchor=MZ(a):i.recordType===kZ.OfficeArtClientTextbox&&(t.textBoxData=a);n=i.dataEnd}return t}function PZ(e,t){let n=0;for(;n+8<=e.length;){let i=EZ(e,n),a=e.slice(i.dataStart,i.dataEnd);i.recordType===kZ.OfficeArtSpContainer?t.push(NZ(a)):i.isContainer&&PZ(a,t),n=i.dataEnd}return t}function FZ(e){let t=OZ(e,kZ.OfficeArtDgContainer),n=[];for(let e of t)PZ(e.data,n);return n.filter(e=>e.isGroup===!1)}const IZ={61466:{extension:`emf`,mimeType:`image/x-emf`,twoUidInstance:981},61467:{extension:`wmf`,mimeType:`image/x-wmf`,twoUidInstance:535},61468:{extension:`pict`,mimeType:`image/pict`,twoUidInstance:1347},61469:{extension:`jpg`,mimeType:`image/jpeg`,twoUidInstance:1131},61470:{extension:`png`,mimeType:`image/png`,twoUidInstance:1761},61471:{extension:`dib`,mimeType:`image/bmp`,twoUidInstance:1961},61481:{extension:`tiff`,mimeType:`image/tiff`,twoUidInstance:1765},61480:{extension:`jpg`,mimeType:`image/jpeg`,twoUidInstance:1131}};function LZ(e){let t=[],n=0;for(;n+8<=e.length;){let i=EZ(e,n),a=IZ[i.recordType],o=i.dataEnd<=e.length;if(a&&o){let o=(i.instance===a.twoUidInstance?32:16)+(i.recordType<=61468?34:1),s=i.dataStart+o,c=e.slice(s,i.dataEnd);t.push({index:t.length+1,extension:a.extension,mimeType:a.mimeType,data:c}),n=i.dataEnd}else n=e.length}return t}const RZ=[[`flags`,15,2],[`bulletChar`,128,2],[`bulletFont`,16,2],[`bulletSize`,64,2],[`bulletColor`,32,4],[`alignment`,2048,2],[`lineSpacing`,4096,2],[`spaceBefore`,8192,2],[`spaceAfter`,16384,2],[`leftMargin`,256,2],[`indent`,512,2],[`defaultTabSize`,1024,2],[`fontAlign`,65536,2],[`wrapFlags`,917504,2],[`textDirection`,2097152,2]],zZ=[[`flags`,65535,2],[`fontIndex`,65536,2],[`asianFont`,2097152,2],[`ansiFont`,4194304,2],[`symbolFont`,8388608,2],[`fontSize`,131072,2],[`color`,262144,4],[`superscript`,524288,2]];function BZ(e,t,n){let i={},a=t,o=e.readUInt32LE(a);a+=4;for(let[t,s,c]of n)(o&s)!==0&&(i[t]=c===4?e.readUInt32LE(a):e.readUInt16LE(a),a+=c);return{values:i,position:a}}function VZ(e,t){let n=[],i=[],a=0,o=0;for(;a+6<=e.length&&o<t;){let t=e.readUInt32LE(a),i=BZ(e,a+6,RZ),s=i.values;n.push({count:t,alignment:s.alignment===void 0?null:s.alignment}),a=i.position,o+=t}for(o=0;a+4<=e.length&&o<t;){let t=e.readUInt32LE(a),n=BZ(e,a+4,zZ),s=n.values,c=s.flags||0;i.push({count:t,fontSize:s.fontSize===void 0?null:s.fontSize,color:s.color===void 0?null:s.color,bold:!!(c&1),italic:!!(c&2),underline:!!(c&4)}),a=n.position,o+=t}return{paragraphRuns:n,characterRuns:i}}const HZ=[16777215,0,8421504,0,10079487,13434879,11711154,2777241];function UZ(e){let t=HZ.slice(),n=OZ(e,2032),i=n.find(e=>e.header.instance===1)||n[0];if(i){let e=[];for(let t=0;t+4<=i.data.length;t+=4)e.push(i.data.readUInt32LE(t)&16777215);e.length>=8&&(t=e)}return t}function WZ(e){return[e&255,e>>8&255,e>>16&255].map(e=>e.toString(16).padStart(2,`0`)).join(``)}function GZ(e,t){let n=null;if(e!=null){let i=e>>>24&255;n=i===255?null:WZ(i===254?e&16777215:i<t.length?t[i]:0)}return n}function KZ(e,t){let n=null;if(e!=null){if(e>>>24&8){let i=e&255;n=WZ(i<t.length?t[i]:0)}else n=WZ(e&16777215)}return n}function qZ(e){let t=a(e),n=()=>new DataView(t.buffer,t.byteOffset,t.byteLength);function i(e){let t=e.map(a),n=0;for(let e of t)n+=e.length;let i=new Uint8Array(n),o=0;for(let e of t)i.set(e,o),o+=e.length;return i}function a(e){return e instanceof ArrayBuffer?new Uint8Array(e):e&&e.data instanceof Uint8Array?e.data:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)?i(e):new Uint8Array(e)}function o(e,t=`utf8`){let n;return n=t===`hex`?Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``):t===`latin1`||t===`binary`?s(e):t===`base64`?btoa(s(e)):t===`utf16le`||t===`ucs2`?new TextDecoder(`utf-16le`).decode(e):new TextDecoder(`utf-8`).decode(e),n}function s(e){let t=``,n=32768;for(let i=0;i<e.length;i+=n){let a=e.subarray(i,i+n);t+=String.fromCharCode.apply(null,a)}return t}return{data:t,length:t.length,readUInt8:e=>t[e],readUInt16LE:e=>n().getUint16(e,!0),readInt16LE:e=>n().getInt16(e,!0),readUInt32LE:e=>n().getUint32(e,!0),readInt32LE:e=>n().getInt32(e,!0),slice:(e,n)=>qZ(t.subarray(e,n)),toString:e=>o(t,e)}}const JZ=4294967294,YZ=4294967295;function XZ(e){let t=qZ(e),n=t.slice(0,8).toString(`hex`),i=n===`d0cf11e0a1b11ae1`,a=new Map;if(i){let e=1<<t.readUInt16LE(30),n=1<<t.readUInt16LE(32),i=t.readUInt32LE(48),o=t.readUInt32LE(56),s=t.readUInt32LE(60),c=t.readUInt32LE(68),l=t=>e+t*e,u=n=>t.slice(l(n),l(n)+e),d=[];for(let e=0;e<109;e++){let n=t.readUInt32LE(76+e*4);n!==YZ&&d.push(n)}let f=c;for(;f!==JZ&&f!==YZ;){let t=u(f),n=e/4-1;for(let e=0;e<n;e++){let n=t.readUInt32LE(e*4);n!==YZ&&d.push(n)}f=t.readUInt32LE(e-4)}let p=[];for(let t of d){let n=u(t);for(let t=0;t<e/4;t++)p.push(n.readUInt32LE(t*4))}let m=(e,t)=>{let n=[],i=e,a=0;for(;i!==JZ&&i!==YZ&&a<1e6;)n.push(i),i=t[i],a++;return n},h=(e,t)=>qZ(m(e,p).map(u)).slice(0,t),g=[];for(let t of m(s,p)){let n=u(t);for(let t=0;t<e/4;t++)g.push(n.readUInt32LE(t*4))}let _=qZ(m(i,p).map(u)),v=h(_.readUInt32LE(116),_.readUInt32LE(120)),y=(e,t)=>qZ(m(e,g).map(e=>v.slice(e*n,e*n+n))).slice(0,t),b=Math.floor(_.length/128);for(let e=0;e<b;e++){let t=e*128,n=_.readUInt16LE(t+64);if(_.readUInt8(t+66)===2&&n>0){let e=_.slice(t,t+n-2).toString(`utf16le`),i=_.readUInt32LE(t+116),s=_.readUInt32LE(t+120),c=s<o?y(i,s):h(i,s);a.set(e,c)}}}else throw Error(`not a compound file (.ppt): bad signature ${n}`);return{streams:a}}function ZZ(e){return String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}const QZ=1.2;function $Z(e){return e*8}function eQ(e,t){let n=e.anchor||{left:0,top:0,width:t.width,height:t.height};return{left:n.left,top:n.top,width:Math.max(n.width,1),height:Math.max(n.height,1)}}function tQ(e,t){let n=``;return e.fillHex&&(n=`<rect x="${t.left}" y="${t.top}" width="${t.width}" height="${t.height}" fill="#${e.fillHex}"/>`),n}function nQ(e,t,n){let i=``,a=e.pictureIndex>0?n[e.pictureIndex-1]:null;if(a){let e=`data:${a.mimeType};base64,${a.data.toString(`base64`)}`;i=`<image x="${t.left}" y="${t.top}" width="${t.width}" height="${t.height}" preserveAspectRatio="none" href="${e}"/>`}return i}function rQ(e){let t=[],n=null,i=()=>{n={fontUnits:$Z(18),segments:[]},t.push(n)};if(e.runs.length>0)for(let t of e.runs){let e=$Z(t.fontSize||18);t.text.split(`
|
|
883
|
+
`).forEach((a,o)=>{(o>0||n===null)&&i(),n.fontUnits=Math.max(n.fontUnits,e),a.length>0&&n.segments.push({text:a,run:t})})}else i();return t.map(t=>({alignCode:e.alignCode,...t}))}function iQ(e,t){let n={x:t.left,anchor:`start`};return e===`ctr`?n={x:t.left+t.width/2,anchor:`middle`}:(e===`r`||e===`just`)&&(n={x:t.left+t.width,anchor:`end`}),n}function aQ(e){let t=e.run,n=[`font-size="${Math.round($Z(t.fontSize||18))}"`];return t.bold&&n.push(`font-weight="bold"`),t.italic&&n.push(`font-style="italic"`),t.underline&&n.push(`text-decoration="underline"`),t.colorHex&&n.push(`fill="#${t.colorHex}"`),`<tspan ${n.join(` `)}>${ZZ(e.text)}</tspan>`}function oQ(e,t){let n=e.paragraphs.flatMap(rQ),i=n.reduce((e,t)=>e+t.fontUnits*QZ,0),a=t.top+Math.max((t.height-i)/2,0),o=[];for(let e of n){let n=a+e.fontUnits*.85;if(e.segments.length>0){let i=iQ(e.alignCode,t),a=e.segments.map(aQ).join(``);o.push(`<text x="${Math.round(i.x)}" y="${Math.round(n)}" text-anchor="${i.anchor}">${a}</text>`)}a+=e.fontUnits*QZ}return o.join(``)}function sQ(e,t,n){let i=eQ(e,t);return[tQ(e,i),nQ(e,i,n),oQ(e,i)].filter(e=>e.length>0).join(`
|
|
884
|
+
`)}function cQ(e,t,n,i){let a=e.shapes.map(e=>sQ(e,t,n)).filter(e=>e.length>0).join(`
|
|
879
885
|
`);return[`<svg viewBox="0 0 ${t.width} ${t.height}" xmlns="http://www.w3.org/2000/svg" class="slide-content" style="width: 100%; height: 100%;">`,`<rect x="0" y="0" width="${t.width}" height="${t.height}" fill="#ffffff"/>`,a,`<text x="${t.width/2}" y="${t.height-40}" text-anchor="middle" font-size="120" fill="#c8c8c8">${i}</text>`,`</svg>`].join(`
|
|
880
|
-
`)}function
|
|
881
|
-
`)}function
|
|
882
|
-
`);return[`<!DOCTYPE html>`,`<html lang="en">`,`<head>`,`<meta charset="UTF-8">`,`<meta name="viewport" content="width=device-width, initial-scale=1.0">`,`<title>${
|
|
883
|
-
`)}function
|
|
884
|
-
`:i,fontSize:o.fontSize||null,bold:o.bold||!1,italic:o.italic||!1,underline:o.underline||!1,colorHex:
|
|
885
|
-
`).length:null}function CZ(e,t){let n=[],i=e.rows;if(Array.isArray(i)&&i.length>0){let e=i[0];if(typeof e==`object`&&e){let a=Object.keys(e),o=new Map;for(let e of a)DM({title:e,body:``,ext:t},o);let s=i.slice(0,10);for(let e of s)for(let n of a){let i=e[n];typeof i==`string`&&i.length>0&&i.length<200&&DM({title:``,body:i,ext:t},o)}for(let[e,t]of o.entries())n.push({keyword:e,score:t})}}return n}function wZ(e,t=1){if(e&&typeof e==`object`){let n=t;for(let i of Object.keys(e)){let a=wZ(e[i],t+1);a>n&&(n=a)}return n}return t}function TZ(e,t){let n={},i=e.rows;if(t===`csv`||t===`parquet`){if(Array.isArray(i)&&i.length>0){n.rowCount=i.length;let t=i[0];if(t&&typeof t==`object`){let i=e.columns||Object.keys(t).map(e=>({name:e}));n.colCount=i.length,n.columns=i}}else e.columns&&(n.colCount=e.columns.length,n.columns=e.columns)}else if(t===`json`||t===`jsonl`||t===`ndjson`){let t=e.rows;if(!t&&e.text)try{t=JSON.parse(e.text)}catch{}t&&typeof t==`object`&&(n.keyCount=Array.isArray(t)?t.length:Object.keys(t).length,n.depth=wZ(t))}else if(t===`markdown`||t===`md`||t===`mark`){let t=e.text||``;t&&(n.wordCount=t.split(/\s+/).filter(Boolean).length)}else if(e.metadata){let t=e.metadata,i=t.width??t.Width??t.imageWidth,a=t.height??t.Height??t.imageHeight;i&&(n.width=i),a&&(n.height=a)}return n}function EZ(e){let t={},n=e.payload;if(Array.isArray(n)){t.rowCount=n.length;let i=n[0];if(i&&typeof i==`object`){let a=e.columns||Object.keys(i).map(e=>({name:e}));t.colCount=a.length,t.columns=a.slice(0,6).map(e=>({name:e.name})),t.sample=n.slice(0,12)}else t.colCount=1,t.columns=[{name:`value`}],t.sample=n.slice(0,12).map(e=>({value:e}))}else if(n&&typeof n==`object`){let e=Object.keys(n);t.rowCount=e.length,t.colCount=2,t.columns=[{name:`key`},{name:`value`}],t.sample=e.slice(0,12).map(e=>({key:e,value:n[e]}))}return t}function DZ(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&t.payload!==void 0?t:null}catch{return null}}function OZ(e){let{serviceType:t,ext:n,url:i,file:a}=e;return vZ[n]??yZ[t]}self.onmessage=async e=>{console.log(e);let{data:t}=e;if(t.type===`graph`){let e=await wF(t);self.postMessage({type:`graph`,graph:e,requestId:t.requestId})}else if(t.type===`openObject`){let{serviceType:e,ext:n,url:i,file:a}=t,o=OZ(t);console.log({ext:n,parser:o,url:i,file:a});let s=pZ(),c,l,u=0;if(a)c=await a.arrayBuffer(),u=s();else{let e=t.preview?2e6:_Z[n]??3e7,a=`/api${i}`.replace(`//`,`/`),o=await fetch(a);if(!o.ok){let e=await o.text(),n={};try{n=(e?JSON.parse(e):{}).error||{}}catch(t){console.warn(`worker: answer is not json`,a,e.slice(0,200),t)}return self.postMessage({...t,type:`error`,error:n.message||`${a} answered ${o.status}`,status:o.status,authFailed:!!n.authFailed,platform:n.platform})}let d=o.headers;l=xZ(d);let f=d.get(`content-type`),p=Number(d.get(`content-length`)||0),m=d.get(`X-Auth-Failed`);if(m&&(t.authStale={platform:m,message:decodeURIComponent(d.get(`X-Auth-Message`)||``)}),f===`application/json`&&!t.preview){let e=await o.text(),n=DZ(e);if(n){let e={fetchMs:s(),bytes:p,lines:l?.lines};return self.postMessage({...t,type:`parsed`,stat:l,...n,metrics:e})}c=new TextEncoder().encode(e).buffer,l.lines=SZ(c,f),u=s()}else if(p>e)return self.postMessage({...t,type:`error`,message:`failed to fetch arrayBuffer for ${i}`});else c=await o.arrayBuffer(),l.lines=SZ(c,f),u=s()}if(o){let e=await o(c,t),i=s(),a={fetchMs:u,parseMs:i,bytes:c?.byteLength??0,lines:l?.lines};t.preview&&(e.previewMeta=EZ(e),Array.isArray(e.payload)&&(e.payload=e.payload.slice(0,8)),typeof e.text==`string`&&(e.text=e.text.split(`
|
|
886
|
+
`)}function lQ(e){let t=(e.width/e.height).toFixed(4);return[`* { margin: 0; padding: 0; box-sizing: border-box; }`,`body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }`,`.slides { display: flex; flex-direction: column; align-items: center; gap: 20px;`,` padding: 40px 20px; background: #1a1a1a; min-height: 100vh; }`,`.slide { position: relative; background: #ffffff; width: min(90vw, calc(85vh * ${t}));`,` aspect-ratio: ${t}; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }`,`.slide svg.slide-content { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }`,`.slide-content text { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }`].join(`
|
|
887
|
+
`)}function uQ(e){return ZZ(e)}function dQ(e){let t=e.slides.map((t,n)=>{let i=cQ(t,e.slideSize,e.pictures,n+1);return`<div class="slide" data-index="${n+1}">\n${i}\n</div>`}).join(`
|
|
888
|
+
`);return[`<!DOCTYPE html>`,`<html lang="en">`,`<head>`,`<meta charset="UTF-8">`,`<meta name="viewport" content="width=device-width, initial-scale=1.0">`,`<title>${uQ(e.info&&e.info.title||`Presentation`)}</title>`,`<style>\n${lQ(e.slideSize)}\n</style>`,`</head>`,`<body>`,`<div class="slides">`,t,`</div>`,`</body>`,`</html>`].join(`
|
|
889
|
+
`)}function fQ(e){let t=``,n=OZ(e,kZ.TextCharsAtom),i=OZ(e,kZ.TextBytesAtom);return n.length>0?t=n.map(e=>e.data.toString(`utf16le`)).join(``):i.length>0&&(t=i.map(e=>e.data.toString(`latin1`)).join(``)),t.replace(/\x00/g,``)}function pQ(e){let t=3,n=OZ(e,kZ.TextHeaderAtom);return n.length>0&&n[0].data.length>=4&&(t=n[0].data.readInt32LE(0)),t}function mQ(e,t){return{0:`l`,1:`ctr`,2:`r`,3:`just`}[e??+(t===4||t===5)]||`l`}function hQ(e,t){let n=[];for(let i of e)for(let e=0;e<i.count&&n.length<t;e++)n.push(i);for(;n.length<t;)n.push(e.length>0?e[e.length-1]:{});return n}function gQ(e,t){return e.fontSize===t.fontSize&&e.bold===t.bold&&e.italic===t.italic&&e.underline===t.underline&&e.colorHex===t.colorHex}function _Q(e,t){let n=fQ(e),i=pQ(e),a=OZ(e,kZ.StyleTextPropAtom),o=a.length>0?VZ(a[0].data,n.length):{paragraphRuns:[],characterRuns:[]},s=hQ(o.characterRuns,n.length),c=hQ(o.paragraphRuns,n.length),l=[],u=0,d=n.split(`\r`);return d.forEach((e,n)=>{if(n!==d.length-1||e.length!==0){let n=c[u]?c[u].alignment:null,a=[];for(let n=0;n<e.length;n++){let i=e[n],o=s[u+n]||{},c={text:i===`\v`?`
|
|
890
|
+
`:i,fontSize:o.fontSize||null,bold:o.bold||!1,italic:o.italic||!1,underline:o.underline||!1,colorHex:GZ(o.color,t)},l=a[a.length-1];l&&gQ(l,c)?l.text+=c.text:a.push(c)}l.push({alignCode:mQ(n,i),runs:a})}u+=e.length+1}),l}function vQ(e){let t={width:5760,height:4320},n=OZ(e,kZ.DocumentAtom);if(n.length>0){let e=n[0].data;t={width:e.readInt32LE(0),height:e.readInt32LE(4)}}return t}function yQ(e,t){let n=UZ(e),i=FZ(e),a=[];for(let e of i){let t=e.pictureIndex>0,i=e.textBoxData?_Q(e.textBoxData,n):[],o=i.some(e=>e.runs.some(e=>e.text.trim().length>0));if(t||o){let t=e.fillFilled?KZ(e.fillColor,n):null;a.push({anchor:e.anchor,pictureIndex:e.pictureIndex,fillHex:t,paragraphs:i})}}return{slideNumber:t,shapes:a}}function bQ(e){let t={title:``,author:``};if(e&&e.length>48){let n=e.readUInt32LE(44),i=e.readUInt32LE(n+4),a={2:`title`,4:`author`};for(let o=0;o<i;o++){let i=n+8+o*8,s=e.readUInt32LE(i),c=n+e.readUInt32LE(i+4),l=a[s];if(l&&e.readUInt32LE(c)===30){let n=e.readUInt32LE(c+4);t[l]=e.slice(c+8,c+8+n).toString(`latin1`).replace(/\x00+$/,``)}}}return t}function xQ(e){let t=e.get(`PowerPoint Document`),n=e.get(`Pictures`),i=n?LZ(n):[];return{slideSize:vQ(t),slides:OZ(t,kZ.Slide).map((e,t)=>yQ(e.data,t+1)),pictures:i,info:bQ(e.get(`SummaryInformation`))}}function SQ(e){let{streams:t}=XZ(e);return{html:dQ(xQ(t))}}function CQ(){let e=performance.now();return function(){let t=performance.now(),n=t-e;return e=t,n}}console.log(`tracer`);const wQ=VN(),TQ=[{exts:`csv`,Parser:c},{exts:`json jsonl ndjson`,Parser:v},{exts:`parquet`,Parser:gt},{exts:`avro`,Parser:cn},{exts:`orc`,Parser:_r},{exts:`arrow feather ipc`,Parser:li},{exts:`h5 hdf5 he5 nc nc4 cdf`,Parser:Na},{exts:`yaml yml`,Parser:vs},{exts:`sav`,Parser:ic},{exts:`xpt`,Parser:Mc},{exts:`sas7bdat`,Parser:yl},{exts:`jpg jpeg`,Parser:ou},{exts:`png`,Parser:Nu},{exts:`ico`,Parser:Pu},{exts:`svg`,Parser:Fu},{exts:`webp`,Parser:$u},{exts:`3gpp m4a mp3 bwf wav aiff aif flac`,Parser:Ff},{exts:`excalidraw`,Parser:Jf},{exts:`ipynb`,Parser:VE},{exts:`txt text js py pub`,Parser:QE},{exts:`pdf`,Parser:aO},{exts:`html`,Parser:oO},{exts:`markdown md mark`,Parser:MM},{exts:`xml xsl`,Parser:FM},{exts:`mmd mermaid`,Parser:IM},{exts:`evernote ever`,Parser:zN},{exts:`epub`,Parser:XA},{exts:`fb2 fbz`,Parser:wj},{exts:`cbz cbt cbr`,Parser:Uj},{exts:`mobi prc azw azw3`,Parser:bM},{exts:`pptx potx ppsx`,Parser:tZ},{exts:`ppt pot pps`,Parser:SQ},{exts:`xlsx xltx`,Parser:dZ},{exts:`docx dotx`,Parser:wZ},{exts:`zip`,Parser:wQ.Parser},{exts:`plist provisionprofile`,Parser:iN},{exts:`ds_store`,Parser:PN},{exts:`folded collapsed`,Parser:aN}],EQ=[{serviceTypes:`gcp-gcf`,Parser:v},{serviceTypes:`gcp-firestore`,Parser:v},{serviceTypes:`gcp-pubsub`,Parser:v},{serviceTypes:`gcp-vpc`,Parser:v},{serviceTypes:`gcp-iam`,Parser:v},{serviceTypes:`gcp-logging`,Parser:v},{serviceTypes:`gcp-monitoring`,Parser:v},{serviceTypes:`gcp-gke`,Parser:v},{serviceTypes:`folder`,Parser:v}],DQ=Object.fromEntries(`cbz cbt cbr`.split(` `).map(e=>[e,3e8])),OQ=Object.fromEntries(TQ.flatMap(({exts:e,Parser:t})=>e.split(` `).map(e=>[e,t]))),kQ=Object.fromEntries(EQ.flatMap(({serviceTypes:e,Parser:t})=>e.split(` `).map(e=>[e,t]))),AQ={};function jQ(e){let t={size:Number(e.get(`content-length`)||0)};return e.get(`x-mtime`)&&(t.mtime=Number(e.get(`x-mtime`)),t.ctime=Number(e.get(`x-ctime`)||0),t.birthtime=Number(e.get(`x-birthtime`)||0),t.mode=Number(e.get(`x-mode`)||0),t.user=e.get(`x-user`)||``,t.group=e.get(`x-group`)||``),t}function MQ(e,t){if(t&&(t.startsWith(`text/`)||/json|javascript|xml|yaml|sql|csv/.test(t))&&e){let t=new Uint8Array(e),n=1;for(let e=0;e<t.length;e++)t[e]===10&&(n+=1);return n}return null}function NQ(e,t){let n=[],i=e.rows;if(Array.isArray(i)&&i.length>0){let e=i[0];if(typeof e==`object`&&e){let a=Object.keys(e),o=new Map;for(let e of a)LN({title:e,body:``,ext:t},o);let s=i.slice(0,10);for(let e of s)for(let n of a){let i=e[n];typeof i==`string`&&i.length>0&&i.length<200&&LN({title:``,body:i,ext:t},o)}for(let[e,t]of o.entries())n.push({keyword:e,score:t})}}return n}function PQ(e,t=1){if(e&&typeof e==`object`){let n=t;for(let i of Object.keys(e)){let a=PQ(e[i],t+1);a>n&&(n=a)}return n}return t}function FQ(e,t){let n={},i=e.rows;if(t===`csv`||t===`parquet`){if(Array.isArray(i)&&i.length>0){n.rowCount=i.length;let t=i[0];if(t&&typeof t==`object`){let i=e.columns||Object.keys(t).map(e=>({name:e}));n.colCount=i.length,n.columns=i}}else e.columns&&(n.colCount=e.columns.length,n.columns=e.columns)}else if(t===`json`||t===`jsonl`||t===`ndjson`){let t=e.rows;if(!t&&e.text)try{t=JSON.parse(e.text)}catch{}t&&typeof t==`object`&&(n.keyCount=Array.isArray(t)?t.length:Object.keys(t).length,n.depth=PQ(t))}else if(t===`markdown`||t===`md`||t===`mark`){let t=e.text||``;t&&(n.wordCount=t.split(/\s+/).filter(Boolean).length)}else if(e.metadata){let t=e.metadata,i=t.width??t.Width??t.imageWidth,a=t.height??t.Height??t.imageHeight;i&&(n.width=i),a&&(n.height=a)}return n}function IQ(e){let t={},n=e.payload;if(Array.isArray(n)){t.rowCount=n.length;let i=n[0];if(i&&typeof i==`object`){let a=e.columns||Object.keys(i).map(e=>({name:e}));t.colCount=a.length,t.columns=a.slice(0,6).map(e=>({name:e.name})),t.sample=n.slice(0,12)}else t.colCount=1,t.columns=[{name:`value`}],t.sample=n.slice(0,12).map(e=>({value:e}))}else if(n&&typeof n==`object`){let e=Object.keys(n);t.rowCount=e.length,t.colCount=2,t.columns=[{name:`key`},{name:`value`}],t.sample=e.slice(0,12).map(e=>({key:e,value:n[e]}))}return t}function LQ(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&t.payload!==void 0?t:null}catch{return null}}function RQ(e){let{serviceType:t,ext:n,url:i,file:a}=e;return OQ[n]??kQ[t]}self.onmessage=async e=>{console.log(e);let{data:t}=e;if(t.type===`graph`){let e=await PI(t);self.postMessage({type:`graph`,graph:e,requestId:t.requestId})}else if(t.type===`openObject`){let{serviceType:e,ext:n,url:i,file:a}=t,o=t.raw?void 0:RQ(t);console.log({ext:n,parser:o,url:i,file:a});let s=CQ(),c,l,u=0,d=t.preview?2e6:DQ[n]??3e7;if(a){if(a.size>d)return self.postMessage({...t,type:`error`,tooLarge:!0,size:a.size,limitBytes:d,error:`${a.name} is ${a.size} bytes, past the ${d} this reads into the page`});c=await a.arrayBuffer(),u=s()}else{let e=`/api${i}`.replace(`//`,`/`),n=await fetch(e);if(!n.ok){let i=await n.text(),a={};try{a=(i?JSON.parse(i):{}).error||{}}catch(t){console.warn(`worker: answer is not json`,e,i.slice(0,200),t)}return self.postMessage({...t,type:`error`,error:a.message||`${e} answered ${n.status}`,status:n.status,authFailed:!!a.authFailed,platform:a.platform})}let a=n.headers;l=jQ(a);let o=a.get(`content-type`),f=Number(a.get(`content-length`)||0),p=a.get(`X-Auth-Failed`);if(p&&(t.authStale={platform:p,message:decodeURIComponent(a.get(`X-Auth-Message`)||``)}),o===`application/json`&&!t.preview){let e=await n.text(),i=LQ(e);if(i){let e={fetchMs:s(),bytes:f,lines:l?.lines};return self.postMessage({...t,type:`parsed`,stat:l,...i,metrics:e})}c=new TextEncoder().encode(e).buffer,l.lines=MQ(c,o),u=s()}else if(f>d)return await n.body?.cancel(),self.postMessage({...t,type:`error`,tooLarge:!0,size:f,limitBytes:d,error:`${i} is ${f} bytes, past the ${d} this reads into the page`});else c=await n.arrayBuffer(),l.lines=MQ(c,o),u=s()}if(o){let e=await o(c,t),i=s(),a={fetchMs:u,parseMs:i,bytes:c?.byteLength??0,lines:l?.lines};t.preview&&(e.previewMeta=IQ(e),Array.isArray(e.payload)&&(e.payload=e.payload.slice(0,8)),typeof e.text==`string`&&(e.text=e.text.split(`
|
|
886
891
|
`).slice(0,24).join(`
|
|
887
|
-
`)));let d=
|
|
892
|
+
`)));let d=FQ(e,n);self.postMessage({...t,type:`parsed`,stat:l,...e,summary:d,arrayBuffer:c,metrics:a},[c]);let f=NQ(e,n);f.length>0&&self.postMessage({...t,type:`indexed`,records:f})}else{let e={fetchMs:u,bytes:c?.byteLength??0,lines:l?.lines};self.postMessage({...t,type:`fetched`,stat:l,arrayBuffer:c,metrics:e},[c])}}else if(t.type===`getEntries`){let{object:e}=t,n=DP(e),i={children:[]};if(n){e.file&&(AQ[n.archivePath]=e.file);let t=e.file??AQ[n.archivePath];i=n.kind===`apkg`&&t&&t.size>15e7?{error:`apkg too large to open in the browser: ${t.size} bytes`}:(await n.getEntries(t)).payload}self.postMessage({...t,type:`getEntries`,payload:i})}else if(t.type===`getEntry`){let{object:e,offset:n,limit:i}=t,a=DP(e),o=AQ[a.archivePath]??e.file??e.dbFile,s=await a.getEntry(o,n,i);s?.payload?self.postMessage({...t,type:`getEntry`,payload:s.payload}):self.postMessage({...t,type:`getEntry`,bytes:s},[s.buffer])}else if(t.type===`zipEntry`){let{path:e,entryPath:n}=t,i=wQ.getCache[e];if(i){let t=`${e}!${n}`,a=null;try{a=(await i.getEntry(n)).slice()}catch(e){console.warn(`zipEntry failed`,n,e.message)}a?self.postMessage({type:`entry`,key:t,data:a},[a.buffer]):self.postMessage({type:`entry`,key:t,data:null})}}else if(t.type.startsWith(`raw`)){let e=await gk(t),n=[e.bytes,e.blocks].filter(Boolean).map(e=>e.buffer);self.postMessage({requestId:t.requestId,type:t.type,...e},n)}else if(t.type===`releaseZip`){let{path:e}=t;console.log(`releasing zip`,e),wQ.releaseZip(e)}},self.postMessage({type:`ready`});
|