import{Inspector as v,Runtime as S}from"./runtime.js";import{Generators as d,resize as L,FileAttachment as x,Mutable as E,registerFile as _}from"./stdlib.js";const g=document.createElement("template");g.innerHTML='',$();function $(){for(const e of document.querySelectorAll("pre:not([data-copy=none])")){const t=e.parentNode;if(t.classList.contains("observablehq-pre-container"))continue;const a=t.insertBefore(document.createElement("div"),e);a.className="observablehq-pre-container",Object.assign(a.dataset,e.dataset),a.appendChild(g.content.cloneNode(!0).firstChild).addEventListener("click",A),a.appendChild(e)}}async function A({currentTarget:e}){await navigator.clipboard.writeText(e.parentElement.textContent.trimEnd())}const i=document.querySelector("#observablehq-sidebar-toggle");if(i){let e=i.indeterminate;i.onclick=()=>{const a=matchMedia("(min-width: calc(640px + 6rem + 272px))").matches;e?(i.checked=!a,e=!1):i.checked===a&&(e=!0),i.indeterminate=e,e?sessionStorage.removeItem("observablehq-sidebar"):sessionStorage.setItem("observablehq-sidebar",i.checked)},addEventListener("keypress",a=>{a.code==="KeyB"&&(a.metaKey||a.altKey)&&!a.ctrlKey&&(a.target===document.body||a.target===i||a.target?.closest("#observablehq-sidebar"))&&(i.click(),a.preventDefault())});const t=`Toggle sidebar ${/Mac|iPhone/.test(navigator.platform)?/Firefox/.test(navigator.userAgent)?"\u2325":"\u2318":"Alt-"}B`;for(const a of document.querySelectorAll("#observablehq-sidebar-toggle, label[for='observablehq-sidebar-toggle']"))a.title=t}function D(e){e.detail>1&&e.preventDefault()}function B(){sessionStorage.setItem(`observablehq-sidebar:${this.firstElementChild.textContent}`,this.open)}for(const e of document.querySelectorAll("#observablehq-sidebar summary"))e.onmousedown=D,e.parentElement.ontoggle=B;const u=document.querySelector("#observablehq-toc");if(u){const e=u.appendChild(document.createElement("div"));e.classList.add("observablehq-secondary-link-highlight");const t=Array.from(document.querySelectorAll(u.dataset.selector)).reverse(),a=u.querySelectorAll(".observablehq-secondary-link"),l=()=>{for(const c of a)c.classList.remove("observablehq-secondary-link-active");if(location.hash)for(const c of t){const f=c.querySelector("a[href]")?.hash;if(f===location.hash){const n=c.getBoundingClientRect().top;if(0=innerHeight*.5)continue;const f=c.querySelector("a[href]")?.hash;for(const n of a)if(n.querySelector("a[href]")?.hash===f)return n.classList.add("observablehq-secondary-link-active"),n;break}},b=()=>{const c=l();e.style.cssText=c?`top: ${c.offsetTop}px; height: ${c.offsetHeight}px;`:""},p=new IntersectionObserver(b,{rootMargin:"0px 0px -50% 0px"});for(const c of t)p.observe(c)}function M(e){const t=new v(document.createElement("div"));return t.fulfilled(e),t._node.firstChild}function z(e){const t=new v(document.createElement("div"));t.rejected(e);const a=t._node.firstChild;return a.classList.add("observablehq--error"),a}const j=()=>import("https://cdn.jsdelivr.net/npm/lodash@4.17.21/+esm").then(e=>e.default),I=()=>import("https://cdn.jsdelivr.net/npm/arquero@5.4.0/+esm"),T=()=>import("https://cdn.jsdelivr.net/npm/apache-arrow@13.0.0/+esm"),H=()=>import("https://cdn.jsdelivr.net/npm/d3@7.8.5/+esm"),O=()=>import("./stdlib/dot.js").then(e=>e.default),P=()=>import("https://cdn.jsdelivr.net/npm/@duckdb/duckdb-wasm@1.28.0/+esm"),Q=()=>import("./stdlib/duckdb.js").then(e=>e.DuckDBClient),F=()=>import("https://cdn.jsdelivr.net/npm/htl@0.3.1/+esm"),K=()=>import("https://cdn.jsdelivr.net/npm/htl@0.3.1/+esm").then(e=>e.html),N=()=>import("https://cdn.jsdelivr.net/npm/htl@0.3.1/+esm").then(e=>e.svg),R=()=>import("./stdlib/inputs.js"),V=()=>import("https://cdn.jsdelivr.net/npm/leaflet@1.9.4/+esm"),G=()=>import("https://cdn.jsdelivr.net/npm/mapbox-gl@3.1.2/+esm").then(e=>e.default),Z=()=>import("./stdlib/mermaid.js").then(e=>e.default),J=()=>import("https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6.13/+esm"),U=()=>import("./stdlib/sqlite.js").then(e=>e.default),W=()=>import("./stdlib/sqlite.js").then(e=>e.SQLiteDatabaseClient),X=()=>import("./stdlib/tex.js").then(e=>e.default),Y=()=>import("https://cdn.jsdelivr.net/npm/topojson-client@3.1.0/+esm"),ee=()=>import("./stdlib/vega-lite.js").then(e=>e.default);var te=Object.freeze({__proto__:null,Arrow:T,DuckDBClient:Q,Inputs:R,L:V,Plot:J,SQLite:U,SQLiteDatabaseClient:W,_:j,aq:I,d3:H,dot:O,duckdb:P,htl:F,html:K,mapboxgl:G,mermaid:Z,svg:N,tex:X,topojson:Y,vl:ee});const ae=()=>s("https://static.observableusercontent.com/files/3ccff97fd2d93da734e76829b2b066eafdaac6a1fafdec0faf6ebc443271cfc109d29e80dd217468fcb2aff1e6bffdc73f356cc48feb657f35378e6abbbb63b9",!0),oe=()=>s("https://static.observableusercontent.com/files/75d52e6c3130b1cae83cda89305e17b50f33e7420ef205587a135e8562bcfd22e483cf4fa2fb5df6dff66f9c5d19740be1cfaf47406286e2eb6574b49ffc685d",!0),ce=()=>s("https://static.observableusercontent.com/files/048ec3dfd528110c0665dfa363dd28bc516ffb7247231f3ab25005036717f5c4c232a5efc7bb74bc03037155cb72b1abe85a33d86eb9f1a336196030443be4f6",!0),ne=()=>s("https://static.observableusercontent.com/files/39837ec5121fcc163131dbc2fe8c1a2e0b3423a5d1e96b5ce371e2ac2e20a290d78b71a4fb08b9fa6a0107776e17fb78af313b8ea70f4cc6648fad68ddf06f7a",!0),se=()=>s("https://static.observableusercontent.com/files/87942b1f5d061a21fa4bb8f2162db44e3ef0f7391301f867ab5ba718b225a63091af20675f0bfe7f922db097b217b377135203a7eab34651e21a8d09f4e37252",!0),re=()=>s("https://static.observableusercontent.com/files/a6b0d94a7f5828fd133765a934f4c9746d2010e2f342d335923991f31b14120de96b5cb4f160d509d8dc627f0107d7f5b5070d2516f01e4c862b5b4867533000",!0),ie=()=>s("https://static.observableusercontent.com/files/76f13741128340cc88798c0a0b7fa5a2df8370f57554000774ab8ee9ae785ffa2903010cad670d4939af3e9c17e5e18e7e05ed2b38b848ac2fc1a0066aa0005f",!0),fe=()=>pe("https://static.observableusercontent.com/files/31d904f6e21d42d4963ece9c8cc4fbd75efcbdc404bf511bc79906f0a1be68b5a01e935f65123670ed04e35ca8cae3c2b943f82bf8db49c5a67c85cbb58db052"),le=()=>s("https://static.observableusercontent.com/files/31ca24545a0603dce099d10ee89ee5ae72d29fa55e8fc7c9ffb5ded87ac83060d80f1d9e21f4ae8eb04c1e8940b7287d179fe8060d887fb1f055f430e210007c",!0),be=()=>s("https://static.observableusercontent.com/files/715db1223e067f00500780077febc6cebbdd90c151d3d78317c802732252052ab0e367039872ab9c77d6ef99e5f55a0724b35ddc898a1c99cb14c31a379af80a",!0),de=()=>s("https://static.observableusercontent.com/files/c653108ab176088cacbb338eaf2344c4f5781681702bd6afb55697a3f91b511c6686ff469f3e3a27c75400001a2334dbd39a4499fe46b50a8b3c278b7d2f7fb5",!0),ue=()=>s("https://static.observableusercontent.com/files/693a46b22b33db0f042728700e0c73e836fa13d55446df89120682d55339c6db7cc9e574d3d73f24ecc9bc7eb9ac9a1e7e104a1ee52c00aab1e77eb102913c1f",!0);async function pe(e){const t=await fetch(e);if(!t.ok)throw new Error(`unable to fetch ${e}: status ${t.status}`);return t.json()}async function he(e){const t=await fetch(e);if(!t.ok)throw new Error(`unable to fetch ${e}: status ${t.status}`);return t.text()}async function s(e,t){const[a,l]=await Promise.all([he(e),import("https://cdn.jsdelivr.net/npm/d3-dsv@3.0.1/+esm")]);return l.csvParse(a,t&&l.autoType)}var me=Object.freeze({__proto__:null,aapl:ae,alphabet:oe,cars:ce,citywages:ne,diamonds:se,flare:re,industries:ie,miserables:fe,olympians:le,penguins:be,pizza:de,weather:ue});const ve={now:()=>d.now(),width:()=>d.width(document.querySelector("main")),resize:()=>L,FileAttachment:()=>x,Generators:()=>d,Mutable:()=>E,...te,...me},ge=new S(ve),y=ge.module(),q=new Map;function ye(e){const{id:t,inline:a,inputs:l=[],outputs:b=[],files:p=[],body:c}=e,f=[];q.get(t)?.variables.forEach(o=>o.delete()),q.set(t,{cell:e,variables:f});const n=document.querySelector(`#cell-${t}`);let r=null;const C=()=>(n.innerHTML="",n.classList.remove("observablehq--loading"),r=null),h=a?o=>(r?.(),w(o)||typeof o=="string"||!o?.[Symbol.iterator]?n.append(o):n.append(...o),o):o=>(r?.(),n.append(w(o)?o:M(o)),o),m=y.variable({_node:n,pending:()=>r=C,fulfilled:()=>r?.(),rejected:o=>(r?.(),console.error(o),n.append(z(o)))},{shadow:{display:()=>h,view:()=>o=>d.input(h(o))}});m.define(b.length?`cell ${t}`:null,l,c),f.push(m);for(const o of b)f.push(y.variable(!0).define(o,[`cell ${t}`],k=>k[o]));for(const o of p)_(o.name,o)}function w(e){return e instanceof Node&&e instanceof e.constructor}export{ye as define};