@heycys/gallery 0.1.2 → 0.2.0
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/THIRD-PARTY-NOTICES.md +2 -2
- package/browser/editor/components/align.mjs +58 -0
- package/browser/editor/components/code/index.mjs +1 -1
- package/browser/editor/components/embed/page.mjs +1 -1
- package/browser/editor/components/file/page.mjs +4 -4
- package/browser/editor/components/heading/index.mjs +7 -6
- package/browser/editor/components/icons.mjs +3 -0
- package/browser/editor/components/image/index.mjs +2 -0
- package/browser/editor/components/image/page.mjs +172 -90
- package/browser/editor/components/installed/index.mjs +6 -2
- package/browser/editor/components/installed/page.mjs +80 -13
- package/browser/editor/components/media/icons.mjs +13 -8
- package/browser/editor/components/media/page.mjs +5 -3
- package/browser/editor/components/media/toolbar.mjs +12 -3
- package/browser/editor/components/paragraph/index.mjs +4 -3
- package/browser/editor/components/registry.mjs +17 -5
- package/browser/editor/components/table/index.mjs +4 -2
- package/browser/editor/page/after/index.mjs +288 -0
- package/browser/editor/page/align.mjs +91 -0
- package/browser/editor/page/beside.mjs +5 -6
- package/browser/editor/page/block-menu/index.mjs +6 -3
- package/browser/editor/page/blocks.mjs +3 -1
- package/browser/editor/page/board/hint.mjs +64 -27
- package/browser/editor/page/board/index.mjs +160 -71
- package/browser/editor/page/board/motion.mjs +177 -0
- package/browser/editor/page/board/settings.mjs +4 -3
- package/browser/editor/page/clipboard/index.mjs +10 -3
- package/browser/editor/page/clipboard/own/blocks.mjs +3 -4
- package/browser/editor/page/clipboard/own/describe.mjs +6 -2
- package/browser/editor/page/commit.mjs +2 -2
- package/browser/editor/page/core.mjs +3 -1
- package/browser/editor/page/custom-page.mjs +15 -11
- package/browser/editor/page/editor.mjs +31 -14
- package/browser/editor/page/history.mjs +19 -4
- package/browser/editor/page/insert/index.mjs +20 -22
- package/browser/editor/page/menu.mjs +15 -7
- package/browser/editor/page/page-objects.mjs +3 -7
- package/browser/editor/page/present-links.mjs +5 -4
- package/browser/editor/page/present-shell.mjs +63 -0
- package/browser/editor/page/selection/index.mjs +10 -2
- package/browser/editor/page/table/binding.mjs +87 -0
- package/browser/editor/page/table/icons.mjs +0 -2
- package/browser/editor/page/table/index.mjs +10 -14
- package/browser/editor/page/table/views.mjs +5 -52
- package/browser/editor/page/table/widths.mjs +82 -10
- package/browser/editor/page/typing/index.mjs +44 -12
- package/browser/editor/page/typing/leave.mjs +19 -5
- package/browser/shared/block-packs.mjs +23 -8
- package/browser/shared/component-catalog.mjs +15 -8
- package/browser/shared/component-source.mjs +3 -1
- package/browser/shared/components/heading.mjs +2 -1
- package/browser/shared/components/installed.mjs +1 -1
- package/browser/shared/components/page.mjs +2 -0
- package/browser/shared/components/paragraph.mjs +8 -1
- package/browser/shared/components/table.mjs +1 -0
- package/browser/shared/emoji/line-icons.mjs +37 -0
- package/browser/shared/http.mjs +9 -0
- package/browser/shared/i18n/en.mjs +40 -17
- package/browser/shared/outline.mjs +30 -2
- package/browser/shared/pack-manifest.mjs +12 -1
- package/browser/shared/pages.mjs +169 -57
- package/browser/shared/pinyin.mjs +92 -0
- package/browser/shared/present-step.mjs +17 -0
- package/browser/shared/sidebar-head.mjs +70 -0
- package/browser/shared/web-links.mjs +5 -0
- package/dist/chunk-2OHANJ6Q.mjs +2 -0
- package/dist/{chunk-QOUEFUCH.mjs → chunk-3MBRL2PM.mjs} +1 -1
- package/dist/{chunk-NWR2LT5B.mjs → chunk-4OKWZY5E.mjs} +1 -1
- package/dist/{chunk-RMECZA2K.mjs → chunk-5K44HLTZ.mjs} +1 -1
- package/dist/{chunk-NFMCP2HI.mjs → chunk-5XA2ZBAE.mjs} +2 -2
- package/dist/{chunk-OUUP3WKT.mjs → chunk-67N2QJYT.mjs} +1 -1
- package/dist/chunk-6KBYRA2C.mjs +2 -0
- package/dist/{chunk-SX4LJYT6.mjs → chunk-6N3PX4XX.mjs} +1 -1
- package/dist/{chunk-RFDZXFJF.mjs → chunk-7JDX4E65.mjs} +1 -1
- package/dist/chunk-7M2BQQGZ.mjs +2 -0
- package/dist/{chunk-ZUNVAXLH.mjs → chunk-7OG26PGF.mjs} +1 -1
- package/dist/{chunk-B4P2CM2J.mjs → chunk-AHN3NFKJ.mjs} +1 -1
- package/dist/chunk-ALZ6ZENZ.mjs +3 -0
- package/dist/{chunk-UGWYKHBL.mjs → chunk-AR5D57ZD.mjs} +2 -2
- package/dist/{chunk-W3BGBJQW.mjs → chunk-BFJGHSQN.mjs} +1 -1
- package/dist/{chunk-HLYV7RIH.mjs → chunk-CMA72MAG.mjs} +1 -1
- package/dist/{chunk-D4CKRD3V.mjs → chunk-DAZL73VK.mjs} +2 -2
- package/dist/{chunk-6VTU6KEO.mjs → chunk-DJISHPUL.mjs} +1 -1
- package/dist/{chunk-BPL64HGA.mjs → chunk-EAIFITAV.mjs} +1 -1
- package/dist/chunk-EP25HDAJ.mjs +2 -0
- package/dist/{chunk-6EZ7FNIK.mjs → chunk-F4ZA6JRZ.mjs} +1 -1
- package/dist/{chunk-3KJHLHUO.mjs → chunk-F6HVDZR4.mjs} +1 -1
- package/dist/{chunk-3NJACR4W.mjs → chunk-FDMAXMQA.mjs} +1 -1
- package/dist/chunk-FETSREUN.mjs +5 -0
- package/dist/{chunk-RKPWLGZ3.mjs → chunk-GHOYKMQ3.mjs} +1 -1
- package/dist/chunk-HDWTZ763.mjs +12 -0
- package/dist/{chunk-VTKNEYT3.mjs → chunk-HPOI4ZX7.mjs} +1 -1
- package/dist/{chunk-OW5NWPOJ.mjs → chunk-HXG7EOPJ.mjs} +1 -1
- package/dist/{chunk-V6RIYQZZ.mjs → chunk-ITOH5EGO.mjs} +1 -1
- package/dist/{chunk-ZWPMCK7P.mjs → chunk-IV64FFI4.mjs} +1 -1
- package/dist/chunk-J43Z6LSS.mjs +2 -0
- package/dist/chunk-J5PUIV3Y.mjs +4 -0
- package/dist/{chunk-KTKHRC6H.mjs → chunk-JA7G53PC.mjs} +1 -1
- package/dist/{chunk-NWFBE2YA.mjs → chunk-JLTZF4LA.mjs} +1 -1
- package/dist/{chunk-GY3FAUVM.mjs → chunk-JZT7I2OJ.mjs} +1 -1
- package/dist/{chunk-QKXMPUXC.mjs → chunk-K5XATEOO.mjs} +1 -1
- package/dist/chunk-L2SUIS5S.mjs +2 -0
- package/dist/{chunk-TEZAWDSQ.mjs → chunk-LM4XFQHZ.mjs} +1 -1
- package/dist/{chunk-5ZJA7CXT.mjs → chunk-MN7BZL4R.mjs} +1 -1
- package/dist/chunk-MTYYHM2G.mjs +15 -0
- package/dist/{chunk-HMYTM3GT.mjs → chunk-MXUBKDRO.mjs} +1 -1
- package/dist/{chunk-MHW7ZKOU.mjs → chunk-OEXWRJME.mjs} +1 -1
- package/dist/{chunk-CRJEG7MT.mjs → chunk-OFHXGWOX.mjs} +1 -1
- package/dist/chunk-ORID3AE7.mjs +166 -0
- package/dist/{chunk-32ZUEFZ7.mjs → chunk-PGDE24N5.mjs} +1 -1
- package/dist/{chunk-UNOYVIYR.mjs → chunk-POTA2FV4.mjs} +1 -1
- package/dist/{chunk-N7AZZLGT.mjs → chunk-QE5RG76S.mjs} +18 -17
- package/dist/{chunk-N76HWBA3.mjs → chunk-R2ZDLJYT.mjs} +1 -1
- package/dist/chunk-SWUTTZCN.mjs +2 -0
- package/dist/{chunk-POQSE4C2.mjs → chunk-TR7TWGHB.mjs} +1 -1
- package/dist/chunk-U5XL7D6A.mjs +3 -0
- package/dist/{chunk-PVER7LSC.mjs → chunk-U7NZI6N4.mjs} +2 -2
- package/dist/{chunk-Q47PLKIJ.mjs → chunk-UGWMMEJ5.mjs} +1 -1
- package/dist/chunk-UJQJKNGK.mjs +2 -0
- package/dist/chunk-UYVCQK3H.mjs +22 -0
- package/dist/{chunk-FJYN7RTH.mjs → chunk-VFX2KNHP.mjs} +1 -1
- package/dist/{chunk-UBBRTJ2R.mjs → chunk-VS7JIGJW.mjs} +1 -1
- package/dist/{chunk-NVRNLK25.mjs → chunk-W7665ZEC.mjs} +2 -2
- package/dist/{chunk-NG375ILQ.mjs → chunk-WQDQWCX5.mjs} +1 -1
- package/dist/chunk-YLPSMDIS.mjs +5 -0
- package/dist/{chunk-VXACTLO3.mjs → chunk-YNAWBAYN.mjs} +1 -1
- package/dist/{chunk-ZB4H7ZN4.mjs → chunk-YROX2O22.mjs} +1 -1
- package/dist/{chunk-YQGT4AB2.mjs → chunk-ZDLPUOAG.mjs} +1 -1
- package/dist/chunk-ZQS6H473.mjs +16 -0
- package/dist/{chunk-OJKMINIU.mjs → chunk-ZWWC4KLF.mjs} +15 -15
- package/dist/cli.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/worker.mjs +1 -1
- package/kit/board.css +5 -5
- package/kit/code.js +15 -15
- package/kit/report.css +120 -41
- package/kit/runtime.js +45 -7
- package/kit/tables.js +2 -0
- package/kit/ui.js +2 -0
- package/package.json +1 -1
- package/packs/gallery/chart-view/kit.js +3 -3
- package/packs/gallery/chart-view/writing.md +1 -1
- package/packs/gallery/countdown/component.json +1 -1
- package/packs/gallery/countdown/kit.js +89 -29
- package/packs/gallery/countdown/preview.svg +1 -1
- package/packs/gallery/countdown/style.css +88 -100
- package/packs/gallery/countdown/writing.md +2 -2
- package/packs/gallery/habit/component.json +3 -3
- package/packs/gallery/habit/kit.js +114 -75
- package/packs/gallery/habit/preview.svg +1 -1
- package/packs/gallery/habit/style.css +133 -205
- package/packs/gallery/habit/writing.md +2 -2
- package/packs/gallery/heatmap/component.json +2 -2
- package/packs/gallery/heatmap/kit.js +335 -173
- package/packs/gallery/heatmap/preview.svg +1 -1
- package/packs/gallery/heatmap/style.css +158 -170
- package/packs/gallery/heatmap/writing.md +2 -2
- package/packs/gallery/kanban/kit.js +3 -3
- package/packs/gallery/kanban/writing.md +1 -1
- package/packs/gallery/metric/kit.js +3 -3
- package/packs/gallery/metric/writing.md +1 -1
- package/packs/gallery/note/component.json +3 -3
- package/packs/gallery/note/kit.js +40 -13
- package/packs/gallery/note/preview.svg +1 -1
- package/packs/gallery/note/style.css +51 -30
- package/packs/gallery/note/writing.md +2 -2
- package/packs/gallery/recent/component.json +2 -2
- package/packs/gallery/recent/kit.js +141 -86
- package/packs/gallery/recent/preview.svg +1 -1
- package/packs/gallery/recent/style.css +53 -126
- package/packs/gallery/recent/writing.md +2 -2
- package/packs/gallery/static/component.json +2 -2
- package/packs/gallery/static/preview.svg +1 -1
- package/packs/gallery/static/style.css +99 -66
- package/packs/gallery/static/writing.md +2 -2
- package/packs/gallery/stats/component.json +3 -3
- package/packs/gallery/stats/kit.js +253 -72
- package/packs/gallery/stats/preview.svg +1 -1
- package/packs/gallery/stats/style.css +64 -142
- package/packs/gallery/stats/writing.md +2 -2
- package/packs/gallery/today/component.json +2 -2
- package/packs/gallery/today/kit.js +62 -27
- package/packs/gallery/today/preview.svg +1 -1
- package/packs/gallery/today/style.css +101 -72
- package/packs/gallery/today/writing.md +2 -2
- package/packs/gallery/todos/component.json +1 -1
- package/packs/gallery/todos/kit.js +218 -71
- package/packs/gallery/todos/preview.svg +1 -1
- package/packs/gallery/todos/style.css +170 -223
- package/packs/gallery/todos/writing.md +1 -1
- package/packs/gallery/weather/component.json +2 -2
- package/packs/gallery/weather/kit.js +165 -90
- package/packs/gallery/weather/preview.svg +1 -1
- package/packs/gallery/weather/style.css +100 -218
- package/packs/gallery/weather/writing.md +1 -1
- package/packs/gallery-soft/countdown/component.json +18 -0
- package/packs/gallery-soft/countdown/example.html +3 -0
- package/packs/gallery-soft/countdown/kit.js +206 -0
- package/packs/gallery-soft/countdown/preview.svg +1 -0
- package/packs/gallery-soft/countdown/style.css +211 -0
- package/packs/gallery-soft/countdown/template.html +3 -0
- package/packs/gallery-soft/countdown/writing.md +24 -0
- package/packs/gallery-soft/habit/component.json +14 -0
- package/packs/gallery-soft/habit/example.html +3 -0
- package/packs/gallery-soft/habit/kit.js +366 -0
- package/packs/gallery-soft/habit/preview.svg +1 -0
- package/packs/gallery-soft/habit/style.css +251 -0
- package/packs/gallery-soft/habit/template.html +3 -0
- package/packs/gallery-soft/habit/writing.md +23 -0
- package/packs/gallery-soft/heatmap/component.json +18 -0
- package/packs/gallery-soft/heatmap/example.html +3 -0
- package/packs/gallery-soft/heatmap/kit.js +498 -0
- package/packs/gallery-soft/heatmap/preview.svg +1 -0
- package/packs/gallery-soft/heatmap/style.css +181 -0
- package/packs/gallery-soft/heatmap/template.html +3 -0
- package/packs/gallery-soft/heatmap/writing.md +23 -0
- package/packs/gallery-soft/note/component.json +14 -0
- package/packs/gallery-soft/note/example.html +3 -0
- package/packs/gallery-soft/note/kit.js +162 -0
- package/packs/gallery-soft/note/preview.svg +1 -0
- package/packs/gallery-soft/note/style.css +148 -0
- package/packs/gallery-soft/note/template.html +3 -0
- package/packs/gallery-soft/note/writing.md +20 -0
- package/packs/gallery-soft/recent/component.json +13 -0
- package/packs/gallery-soft/recent/example.html +1 -0
- package/packs/gallery-soft/recent/kit.js +335 -0
- package/packs/gallery-soft/recent/preview.svg +1 -0
- package/packs/gallery-soft/recent/style.css +160 -0
- package/packs/gallery-soft/recent/template.html +1 -0
- package/packs/gallery-soft/recent/writing.md +17 -0
- package/packs/gallery-soft/static/component.json +13 -0
- package/packs/gallery-soft/static/example.html +12 -0
- package/packs/gallery-soft/static/preview.svg +1 -0
- package/packs/gallery-soft/static/style.css +186 -0
- package/packs/gallery-soft/static/template.html +1 -0
- package/packs/gallery-soft/static/writing.md +20 -0
- package/packs/gallery-soft/stats/component.json +13 -0
- package/packs/gallery-soft/stats/example.html +1 -0
- package/packs/gallery-soft/stats/kit.js +341 -0
- package/packs/gallery-soft/stats/preview.svg +1 -0
- package/packs/gallery-soft/stats/style.css +119 -0
- package/packs/gallery-soft/stats/template.html +1 -0
- package/packs/gallery-soft/stats/writing.md +13 -0
- package/packs/gallery-soft/today/component.json +12 -0
- package/packs/gallery-soft/today/example.html +1 -0
- package/packs/gallery-soft/today/kit.js +222 -0
- package/packs/gallery-soft/today/preview.svg +1 -0
- package/packs/gallery-soft/today/style.css +178 -0
- package/packs/gallery-soft/today/template.html +1 -0
- package/packs/gallery-soft/today/writing.md +16 -0
- package/packs/gallery-soft/todos/component.json +19 -0
- package/packs/gallery-soft/todos/example.html +3 -0
- package/packs/gallery-soft/todos/kit.js +527 -0
- package/packs/gallery-soft/todos/preview.svg +1 -0
- package/packs/gallery-soft/todos/style.css +212 -0
- package/packs/gallery-soft/todos/template.html +3 -0
- package/packs/gallery-soft/todos/writing.md +32 -0
- package/packs/gallery-soft/weather/component.json +19 -0
- package/packs/gallery-soft/weather/example.html +3 -0
- package/packs/gallery-soft/weather/kit.js +411 -0
- package/packs/gallery-soft/weather/preview.svg +1 -0
- package/packs/gallery-soft/weather/style.css +185 -0
- package/packs/gallery-soft/weather/template.html +3 -0
- package/packs/gallery-soft/weather/writing.md +28 -0
- package/release.json +9 -9
- package/skill/SKILL.md +12 -12
- package/skill/references/building-blocks.md +4 -4
- package/skill/references/pages-and-data.md +13 -9
- package/skill/references/writing-html.md +2 -0
- package/web/assets/index-BM_K-Auu.css +1 -0
- package/web/assets/index-DRslOBiv.js +15 -0
- package/web/index.html +2 -2
- package/dist/chunk-2NRBY6AJ.mjs +0 -2
- package/dist/chunk-35NQ4PLQ.mjs +0 -2
- package/dist/chunk-4AV456RQ.mjs +0 -2
- package/dist/chunk-5XYHDBJ5.mjs +0 -2
- package/dist/chunk-6A53MZYZ.mjs +0 -2
- package/dist/chunk-6EXH3ORZ.mjs +0 -166
- package/dist/chunk-BVEFGE4B.mjs +0 -2
- package/dist/chunk-D4EURAX4.mjs +0 -4
- package/dist/chunk-DQCE7TJY.mjs +0 -5
- package/dist/chunk-FWNRPMCJ.mjs +0 -12
- package/dist/chunk-FWW4CSAZ.mjs +0 -2
- package/dist/chunk-JVHHHGEA.mjs +0 -3
- package/dist/chunk-PZDLJJTJ.mjs +0 -3
- package/dist/chunk-SXHBYZST.mjs +0 -16
- package/dist/chunk-UFNYFFKO.mjs +0 -20
- package/dist/chunk-UKSHDZZ6.mjs +0 -2
- package/dist/chunk-VJPFVNNW.mjs +0 -15
- package/dist/chunk-VS3ZMVGX.mjs +0 -5
- package/web/assets/index-BK2e_07w.js +0 -13
- package/web/assets/index-CWFI83mF.css +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{a as fe,b as At}from"./chunk-342HXE3Q.mjs";import{c as ue,d as pe}from"./chunk-BPL64HGA.mjs";import{b as ae}from"./chunk-OUUP3WKT.mjs";import{a as ie,b as re,c as le,d as ce,f as Dt,g as de,h as he}from"./chunk-PUOQ65NC.mjs";import{b as _t,c as ee,d as oe,f as ne,h as se}from"./chunk-6VTU6KEO.mjs";import{b as Wt,j as Qt}from"./chunk-4OZWXZE5.mjs";import{g as te}from"./chunk-OW5NWPOJ.mjs";import{a as Zt}from"./chunk-HYMEEXKN.mjs";import{a as Vt}from"./chunk-UMHUSOPJ.mjs";import{spawnSync as Le}from"node:child_process";import vt from"node:fs/promises";import ht from"node:path";import{pathToFileURL as Ie}from"node:url";import{MATH_IGNORED_TAGS as Fe}from"../browser/shared/components/math.mjs";import{exportPackagesOf as Pe,exportSourceOf as Ve,packagesSaid as _e}from"../browser/shared/export-wrap.mjs";import{sha256 as ge}from"../browser/shared/files.mjs";import{attr as me}from"../browser/shared/html-tree.mjs";import{projectRoot as De,qaDirectory as He,reportsDirectory as Rt}from"../browser/shared/paths.mjs";import{documentDirectory as Lt,documentFiles as It}from"../browser/shared/workspace.mjs";import{KINDS as Yo,LEVELS as Bt,LOOKS as we,WIDE as Ko,WIDTHS as $e,layoutNotesOf as ze,levelOf as Ee}from"../browser/shared/qa-levels.mjs";import{tableHidesScript as Ue}from"../browser/shared/table-hides.mjs";var Ge=new Set(["code-scrolls","formula-scrolls"]),qe=(e,n)=>e.level??Ee(e.kind,n),Ye=(e,n)=>["fail","warn"].includes(qe(e,n))||Ge.has(e.kind)&&Ee(e.kind,n)==="info",Ke=4,Ae=12,Xe=8,Je=2,xe=200,Qe=2e3,ye=600;function Ze({block:e,above:n=null,below:s=null}){let l=[e,n,s].filter(Boolean),i=Math.min(...l.map(u=>u.left)),d=Math.max(...l.map(u=>u.right)),w=n?Math.max(Math.min(n.top,e.top),e.top-xe):e.top,f=s?Math.min(Math.max(s.bottom,e.bottom),e.bottom+xe):e.bottom,x=(u,A)=>({x:Math.max(0,i),y:Math.max(0,u),width:d-i,height:A-Math.max(0,u)});return e.bottom-e.top<=Qe?[{part:"",clip:x(w,f)}]:[{part:"top",clip:x(w,e.top+ye)},{part:"bottom",clip:x(e.bottom-ye,f)}]}function be(e,n=""){if(e.startsWith("data:"))return`${e.slice(0,30)}\u2026 (${e.length} characters)`;let s=n.slice(0,n.lastIndexOf("/")+1);if(s&&e.startsWith(s)&&e.length>s.length)try{return decodeURIComponent(e.slice(s.length))}catch{return e.slice(s.length)}return e.length>60?`\u2026${e.slice(-59)}`:e}var Ft=e=>String(e??"").replace(/\s+/g," ").trim(),Mt=(e,n=40)=>{let s=Ft(e);return`"${s.length>n?`${s.slice(0,n-1)}\u2026`:s}"`},to=e=>String(e??"").replace(/\s+/g,"").slice(0,120);function eo(e,n="doc.html"){let s=new Map,l=new Map,i=new Map,d=(x,u)=>(u&&x.sourceCodeLocation.attrs?.[u]||x.sourceCodeLocation).startLine,w=new Map,f=x=>{if(x.nodeName==="#text")return x.value;if(!x.tagName&&x.nodeName!=="#document"||x.tagName==="template")return"";let u=(x.childNodes??[]).map(f).join("");if(!x.tagName||!x.sourceCodeLocation)return u;let A=me(x,"data-block-id");A!==void 0&&!s.has(A)&&s.set(A,d(x,"data-block-id"));let j=me(x,"id");j!==void 0&&!l.has(j)&&l.set(j,d(x,"id"));let K=to(u);if(K.length>=2){let m=`${x.tagName}|${K}`;w.has(m)||w.set(m,[]),w.get(m).push(x.sourceCodeLocation)}return u};f(Zt(e));for(let[x,u]of w)i.set(x,u.sort((A,j)=>A.startOffset-j.startOffset).map(A=>A.startLine));return{blocks:s,ids:l,texts:i,name:n}}function oo(e,n){if(!e)return"the page";let s=n.name??"doc.html",l=u=>{let A=u&&n.texts.get(`${u.tag}|${u.words}`);return A?.[Math.min(u.nth??0,A.length-1)]},i=e.table||e.header?.text,d=e.card?` card ${Mt(e.card.text)}`:i?` table ${Mt(i)}`:"",w=e.blocks?.find(u=>n.blocks.has(u));if(w!==void 0)return`${s}:${n.blocks.get(w)} [data-block-id="${w}"]${d}`;if(l(e.card))return`${s}:${l(e.card)} card ${Mt(e.card.text)}`;if(l(e.header))return`${s}:${l(e.header)} table ${Mt(i)}`;let f=e.texts?.find(l);if(f)return`${s}:${l(f)} ${f===e.texts[0]&&f.tag===e.tag?"":`${e.element} in `}<${f.tag}> ${Mt(f.text,32)}`;let x=e.ids?.find(u=>n.ids.has(u));return x!==void 0?`${s}:${n.ids.get(x)} #${x}${d}`:l(e.section)?`${s}:${l(e.section)} ${e.element} in the section ${Mt(e.section.text)}`:`${e.element}${d} (not found in ${s})`}function Yt(e){let n=new Date(e),s=d=>String(d).padStart(2,"0"),l=-n.getTimezoneOffset(),i=`${l<0?"-":"+"}${s(Math.floor(Math.abs(l)/60))}:${s(Math.abs(l)%60)}`;return`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())}T${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}${i}`}function no(e,n,s={said:"",now:""}){return e===n?s.said===s.now?{stale:!1,why:""}:{stale:!0,packaged:!0,why:`it holds ${s.said||"no custom block"}, the workspace has ${s.now||"none of them"}`}:{stale:!0,why:e?`made from a text whose sha256 is ${e.slice(0,12)}\u2026, the file's is ${n.slice(0,12)}\u2026`:"it does not say which text it was made from: made before exports said it, or before the kit's names were doc-* (2026-10-26), whose pages gallery qa no longer reads"}}async function Kt(e,{made:n=!1}={}){let s=It(Lt(e,Rt)).html,l=At(e),[i,d]=await Promise.all([vt.readFile(s).catch(()=>null),vt.stat(l).catch(()=>null)]);if(!i)return{problem:`${e}: no document (${s})`};if(!d)return{problem:`${e}: no export (${l}): run gallery export ${e} first`,missing:!0};let w=await vt.readFile(l),f=w.toString("utf8"),x=Ve(f),u={said:Pe(f),now:_e(te(i.toString("utf8")))},{stale:A,why:j,packaged:K=!1}=no(x,ge(i),u);return A&&!n?{problem:`${e}: ${l} is not of ${s} as it is now (${j}): run gallery export ${e} first`,stale:!0,why:j,edited:!!x&&!K,packaged:K}:{file:l,sha256:ge(w),time:d.mtimeMs}}function so(e,n){let s=e.map((w,f)=>({length:1,weight:n[f],previous:-1})),l=(w,f)=>w.length>f.length||w.length===f.length&&w.weight>f.weight;e.forEach((w,f)=>{for(let x=0;x<f;x++){if(e[x]>=w)continue;let u={length:s[x].length+1,weight:s[x].weight+n[f],previous:x};l(u,s[f])&&(s[f]=u)}});let i=-1;s.forEach((w,f)=>{(i<0||l(w,s[i]))&&(i=f)});let d=[];for(let w=i;w>=0;w=s[w].previous)d.unshift(w);return d}function Be(e,n){let s=n?.places??{},l=new Set((n?.moved??[]).filter(d=>e.has(d))),i=new Map;for(let[d,{parent:w,size:f=0}]of e){let x=s[d];if(x){if(x[0]!==w){l.add(d);continue}i.has(w)||i.set(w,[]),i.get(w).push({id:d,at:x[1],size:f})}}for(let d of i.values()){let w=new Set(so(d.map(({at:f})=>f),d.map(({size:f})=>f)).map(f=>d[f].id));for(let{id:f}of d)w.has(f)||l.add(f)}return l}function ao(e,n,s,{named:l=null,verified:i=!0,failed:d=!1,seen:w=null,page:f=void 0,packages:x=void 0}={}){if(!i||d||l&&!n)return null;let u=w??new Set([...s.ids,...[...s.held?.values()??[]].flat()]),A=!n,j=A||s.pageChanged?s.cards??[]:[],K=[...n?.unseen??[],...j],m={blocks:{},places:{},moved:A?[]:[...Be(e,n)].filter($=>!u.has($)),unseen:[...new Set(K)].filter($=>e.has($)&&!u.has($))};for(let[$,{hash:Y,parent:X,at:gt}]of e){let N=A||u.has($)?Y:n.blocks[$];N!==void 0&&(m.blocks[$]=N),m.places[$]=[X,gt]}let E=!A&&(l||s.tiles)?n.page:f;typeof E=="string"&&(m.page=E);let z=!A&&(l||s.tiles)?n.packages:x&&Object.fromEntries(Object.entries(x).map(([$,Y])=>[$,(s.restyled?.get($)??[]).every(X=>u.has(X))?Y:n.packages[$]]));return z&&Object.keys(z).length&&(m.packages=z),m}function Oe(e){let n=new Map;for(let s of e){let l=new Set(s.held?.covered??[]);for(let i of s.held?.missed??[])l.has(i)||n.set(i,[...n.get(i)??[],s.label??String(s.width)])}return n}function io(e,n){let s=Oe(n);return new Set([...e.ids,...[...e.held?.values()??[]].flat().filter(l=>!s.has(l))])}function Se(e){let n=e.time?` of ${Yt(e.time)}`:"";return e.from==="export"?`the export${n} (the document before these changes)`:e.from==="preview"?`gallery open${n} (the document before these changes)`:"the last look"}var ro=3;function lo(e,n,s=null,{tiles:l=!1,page:i=void 0,packages:d=void 0}={}){let w={rest:[],unknown:[],moved:new Set,around:new Map,held:new Map,groups:[],cards:[],pageChanged:!1,changed:new Set,restyled:new Map,left:null},f=[...e.keys()],x=new Map(f.map((a,M)=>[a,M])),u=n?Be(e,n):new Set,A=a=>typeof n?.packages?.[a]=="string"&&typeof d?.[a]=="string"&&n.packages[a]!==d[a],j=n?f.filter(a=>A(e.get(a).package)&&n.blocks[a]===e.get(a).hash&&!u.has(a)):[],K=new Map;for(let a of j)K.set(e.get(a).package,[...K.get(e.get(a).package)??[],a]);let m=new Set(j),E=n?f.filter(a=>n.blocks[a]!==e.get(a).hash||u.has(a)||m.has(a)):[],z=new Set((n?.unseen??[]).filter(a=>e.has(a)&&!E.includes(a))),$=(a,M)=>{let G=null;for(let et=e.get(a).parent;et!==null&&e.has(et);et=e.get(et).parent)M.has(et)&&(G=et);return G},Y=new Set(E),X=new Set(E.filter(a=>e.get(a).card||u.has(a))),gt=a=>Y.has(a)&&!u.has(a)&&$(a,X)===null,N=new Map;for(let a of f)for(let M=e.get(a).parent;M!==null&&e.has(M);M=e.get(M).parent){let G=N.get(M)??{all:0,changed:0};G.all+=1,gt(a)&&(G.changed+=1),N.set(M,G)}let Q=f.filter(a=>!e.get(a).card&&N.has(a)&&N.get(a).changed>=ro&&N.get(a).changed*2>=N.get(a).all);if(s){let a=[...new Set(s)].filter(o=>e.has(o)),M=new Set(a),G=new Map;for(let o of f){let r=M.has(o)?null:$(o,M);r!==null&&G.set(r,[...G.get(r)??[],o])}let et="the blocks named",$t=new Set([...a,...[...G.values()].flat()]),yt=!!n&&typeof n.page=="string"&&typeof i=="string"&&n.page!==i,xt=new Set([...E.filter(o=>e.get(o).card||u.has(o)),...Q]),bt=!n||yt?f.filter(o=>e.get(o).card&&!E.includes(o)):[],Pt=new Set([...xt,...bt]),Nt=[...E,...Q.filter(o=>!Y.has(o))].sort((o,r)=>x.get(o)-x.get(r)).filter(o=>!$t.has(o)&&$(o,xt)===null),Tt=Nt.filter(o=>m.has(o)),t={changed:Nt.filter(o=>!m.has(o)),...Tt.length?{restyled:Tt,packages:[...new Set(Tt.map(o=>e.get(o).package))]}:{},cards:bt.filter(o=>!$t.has(o)&&$(o,Pt)===null).sort((o,r)=>e.get(o).rank-e.get(r).rank||x.get(o)-x.get(r)),since:n?Se(n):"",first:!n};return{...w,ids:a,why:et,groups:[{kind:"named",why:et,ids:a,rest:[]}],held:G,pageChanged:yt,changed:new Set(E),restyled:K,left:t,unknown:[...new Set(s)].filter(o=>!e.has(o))}}if(e.size===0)return{...w,ids:[],why:"the document has no block ids (never handed in): the whole page in tiles instead",tiles:!0};if(l)return{...w,ids:[],why:null,tiles:!0};let h=(...a)=>(M,G)=>a.reduce((et,$t)=>et||$t(M)-$t(G),0),B=a=>e.get(a).rank,_=a=>x.get(a),tt=n?Se(n):"",C=!!n&&typeof n.page=="string"&&typeof i=="string"&&n.page!==i,v=f.filter(a=>e.get(a).card&&!E.includes(a)),L=!n||C||E.length===0?v:v.filter(a=>z.has(a)),it=new Set([...E.filter(a=>e.get(a).card||u.has(a)),...Q]),dt=new Set([...it,...L]),Z=new Map,at=(a,M)=>a.filter(G=>{let et=$(G,M);return et!==null&&Z.set(et,[...Z.get(et)??[],G]),et===null}),V=[...at(E,it),...Q.filter(a=>!Y.has(a)&&$(a,it)===null)].sort(h(a=>+!u.has(a),B,_)),pt=V.filter(a=>m.has(a)),lt=V.filter(a=>!m.has(a)),st=at(L,dt).sort(h(a=>+!z.has(a),B,_)),ct="the cards (chart cards, code blocks, whole blocks, components, flowcharts and Sheet areas, then columns and the other figures, then tables)",y=st.some(a=>z.has(a))?", those no look has pictured yet first":"",D=typeof n?.page=="string"&&typeof i=="string",F=n?C?`${ct.replace("the cards","the cards, not changed themselves")}${y}: the document's own <script> or <style> changed since ${tt}, which may draw any of them`:E.length?"the cards no look has pictured yet (not changed themselves)":`${ct}${y}: no block changed since ${tt}${D?", nor the document's own <script> or <style>":""}`:`${ct}: no earlier look to compare with`,J=[...lt.length?[{kind:"changed",why:`the blocks changed since ${tt}${u.size?" (a moved block pictured with the edges of the blocks before and after it, the moved ones first)":""}`,all:lt}]:[],...pt.length?[{kind:"changed",why:`the instances of a custom block changed since ${tt} (${[...new Set(pt.map(a=>e.get(a).package))].join(", ")})`,all:pt}]:[],...st.length||!V.length?[{kind:"cards",why:F,all:st}]:[]],R=Ae;for(let a of J)a.ids=a.all.slice(0,R),a.rest=a.all.slice(a.ids.length),R-=a.ids.length,delete a.all;let I=J.flatMap(a=>a.ids),k=a=>{let{parent:M,at:G}=e.get(a),et=$t=>f.find(yt=>e.get(yt).parent===M&&e.get(yt).at===G+$t)??null;return[et(-1),et(1)]},H=new Map(I.filter(a=>u.has(a)).map(a=>[a,k(a)])),c=new Map(I.filter(a=>Z.has(a)).map(a=>[a,Z.get(a)]));return{...w,ids:I,why:J[0].why,groups:J,rest:J.flatMap(a=>a.rest),moved:new Set(I.filter(a=>u.has(a))),around:H,held:c,cards:L,pageChanged:C,changed:new Set(E),restyled:K}}function co(e){let n=m=>!!m.closest("[data-doc-dev]"),s=[...document.querySelectorAll("details")].filter(m=>!n(m)),l=s.filter(m=>!m.open).length;s.forEach(m=>{m.open||m.setAttribute("data-qa-closed",""),m.open=!0});let i=[...document.images].filter(m=>!n(m));i.forEach(m=>{m.loading==="lazy"&&(m.loading="eager")});let d=[...document.querySelectorAll("dialog")].filter(m=>!n(m)&&!m.open);d.forEach((m,E)=>{m.dataset.qaCard=String(E)});let w=m=>m.parentElement?.closest("dialog[data-qa-card]")??null,f=[...document.querySelectorAll("[data-doc-sheets] > .doc-sheet-tabs > [data-sheet-tab]")].filter(m=>!n(m));f.forEach((m,E)=>{m.dataset.qaTab=String(E)});let x=m=>m.parentElement.parentElement,u=m=>{let E=[];for(let z=m.closest("[data-doc-sheet]");z;z=z.parentElement.closest("[data-doc-sheet]")){let $=f.find(Y=>x(Y)===z.parentElement&&Y.getAttribute("data-sheet-tab")===z.getAttribute("data-doc-sheet"));$&&E.unshift(Number($.dataset.qaTab))}return E},A=f.map((m,E)=>{let z=[...u(x(m)),E],$=[...x(m).children].find(X=>X.getAttribute("data-doc-sheet")===m.getAttribute("data-sheet-tab"));$&&($.dataset.qaPanel=String(E));let Y=w(m);return{index:E,chain:z,card:Y?Number(Y.dataset.qaCard):null,label:(m.textContent??"").replace(/\s+/g," ").trim(),shown:z.every(X=>f[X].getAttribute("aria-selected")==="true"),panel:!!$}}),j=d.map((m,E)=>{let z=`[href="#${CSS.escape(m.id)}"]`,$=[...m.querySelectorAll("h1, h2, h3, h4")].find(X=>X.textContent.trim())??document.querySelector(z),Y=[];for(let X=w(m);X;X=w(X))Y.unshift(Number(X.dataset.qaCard));return{index:E,chain:u(m),within:Y,label:($?.textContent||m.id||"").replace(/\s+/g," ").trim()}}),K=Promise.all(i.map(m=>m.decode().catch(()=>{})));return Promise.race([K.then(()=>!0),new Promise(m=>setTimeout(()=>m(!1),e))]).then(m=>({details:s.length,closed:l,images:i.length,loaded:m,sheets:A,cards:j}))}function ke(e){let n=document.querySelector(`[data-qa-card="${e}"]`);return n?(n.open||(globalThis.DocDialogs?globalThis.DocDialogs.open(n,null):typeof n.showModal=="function"?n.showModal():n.setAttribute("open","")),document.activeElement?.blur?.(),Promise.all(n.getAnimations({subtree:!0}).map(s=>s.finished.catch(()=>{}))).then(()=>n.open&&n.getClientRects().length>0)):Promise.resolve(!1)}function Ht(e){let n=document.querySelector(`[data-qa-card="${e}"]`);n?.open&&(globalThis.DocDialogs?globalThis.DocDialogs.close(n):typeof n.close=="function"?n.close():n.removeAttribute("open"))}async function ho({selector:e,up:n=0,margin:s=0,frames:l=2}){let i=document.querySelector(e);for(let v=0;v<n&&i;v++)i=i.parentElement;if(!i||i.getClientRects().length===0)return null;let d=i.getBoundingClientRect();i.scrollIntoView({block:"nearest",inline:"nearest"});let w=i.getBoundingClientRect();if(d.top!==w.top||d.left!==w.left){let v=()=>new Promise(U=>{requestAnimationFrame(()=>U()),setTimeout(U,100)});for(let U=0;U<l;U++)await v()}let f=v=>v===document.body||v===document.documentElement,x=(v,U,L)=>{let{left:it,top:dt,right:Z,bottom:at}=v;for(let V=U;V&&!f(V);V=V.parentElement){let pt=getComputedStyle(V),lt=pt.overflowX!=="visible",st=pt.overflowY!=="visible";if(lt||st){let ct=V.getBoundingClientRect();lt&&([it,Z]=[Math.max(it,ct.left),Math.min(Z,ct.right)]),st&&([dt,at]=[Math.max(dt,ct.top),Math.min(at,ct.bottom)])}if(V===L)break}return Z>it&&at>dt?{left:it,top:dt,right:Z,bottom:at}:null},u=v=>parseFloat(v)||0,A=(v,U)=>{let L=getComputedStyle(v,U);if(["none","normal"].includes(L.content)||L.display==="none"||!["absolute","fixed"].includes(L.position))return null;let it=L.position==="fixed"?null:getComputedStyle(v).position!=="static"?v:v.offsetParent,dt=it?it.getBoundingClientRect():{left:0,top:0,right:innerWidth,bottom:innerHeight},Z=it?getComputedStyle(it):null,at={left:dt.left+u(Z?.borderLeftWidth),top:dt.top+u(Z?.borderTopWidth),right:dt.right-u(Z?.borderRightWidth),bottom:dt.bottom-u(Z?.borderBottomWidth)},V=(y,D)=>L.boxSizing==="border-box"?0:u(L[`padding${y}`])+u(L[`padding${D}`])+u(L[`border${y}Width`])+u(L[`border${D}Width`]),pt=u(L.width)+V("Left","Right"),lt=u(L.height)+V("Top","Bottom"),st=L.left!=="auto"?at.left+u(L.left)+u(L.marginLeft):L.right!=="auto"?at.right-u(L.right)-u(L.marginRight)-pt:null,ct=L.top!=="auto"?at.top+u(L.top)+u(L.marginTop):L.bottom!=="auto"?at.bottom-u(L.bottom)-u(L.marginBottom)-lt:null;return st===null||ct===null||!(pt>0)||!(lt>0)?null:x({left:st,top:ct,right:st+pt,bottom:ct+lt},v,i)},j=[i.getBoundingClientRect()],K=[i];for(let v of i.querySelectorAll("*"))v instanceof SVGElement&&v.ownerSVGElement||v.matches("script, style, template")||v.getClientRects().length===0||getComputedStyle(v).visibility!=="hidden"&&(K.push(v),j.push(x(v.getBoundingClientRect(),v.parentElement,i)));for(let v of K)j.push(A(v,"::before"),A(v,"::after"));let m=document.createRange(),E=document.createTreeWalker(i,NodeFilter.SHOW_TEXT);for(let v=E.nextNode();v;v=E.nextNode())if(!(!v.nodeValue.trim()||!v.parentElement||v.parentElement.closest("svg, script, style, template"))){m.selectNodeContents(v);for(let U of m.getClientRects())j.push(x(U,v.parentElement,i))}m.detach();let z=j.filter(Boolean),$={left:Math.min(...z.map(v=>v.left)),top:Math.min(...z.map(v=>v.top)),right:Math.max(...z.map(v=>v.right)),bottom:Math.max(...z.map(v=>v.bottom))},Y=x($,i.parentElement,null)??$,X=!1;for(let v=i;v&&!X;v=v.parentElement)X=getComputedStyle(v).position==="fixed";let gt=visualViewport.pageLeft,N=visualViewport.pageTop,[Q,h]=X?[gt+innerWidth,N+innerHeight]:[document.documentElement.scrollWidth,document.documentElement.scrollHeight],B=Math.max(X?gt:0,Y.left+gt-s),_=Math.max(X?N:0,Y.top+N-s),tt=Math.min(Q,Y.right+gt+s),C=Math.min(h,Y.bottom+N+s);return tt>B&&C>_?{clip:{x:B,y:_,width:tt-B,height:C-_},fixed:X}:null}function ve(e){for(let s of e){let l=document.querySelector(`[data-qa-tab="${s}"]`);l&&l.getAttribute("aria-selected")!=="true"&&l.click()}let n=document.querySelector(`[data-qa-panel="${e.at(-1)}"]`);return!!(n&&!n.hidden&&n.getClientRects().length>0)}function zt({scope:e,next:n,ignored:s=[],place:l,slack:i=4,whole:d=[],drawn:w=[]}){let f=e?document.querySelector(e):document.body,x=[];if(!f)return{found:x,next:n};let u=document.documentElement.clientWidth,A=Math.round,j=t=>String(t??"").replace(/\s+/g," ").trim(),K=(t,o=32)=>{let r=j(t);return`"${r.length>o?`${r.slice(0,o-1)}\u2026`:r}"`},m=t=>!!t.closest?.("[data-doc-dev]"),E=t=>{if(!t.isConnected||t.getClientRects().length===0)return!1;for(let o=t;o&&o.nodeType===1;o=o.parentElement){let r=getComputedStyle(o);if(r.visibility==="hidden"||r.display==="none"||Number(r.opacity)===0||o.matches(".katex-mathml, .sr-only, [role=tooltip], [data-doc-dev]"))return!1}return!0},z=t=>`${t.localName}${[...t.classList].filter(o=>!o.startsWith("is-")).slice(0,2).map(o=>`.${o}`).join("")}`,$=t=>(t.textContent??"").replace(/\s+/g,"").slice(0,120),Y=new Map,X=t=>{let o=$(t);if(!Y.has(t.localName)){let b=new Map;for(let O of document.getElementsByTagName(t.localName)){if(m(O))continue;let W=$(O);b.has(W)||b.set(W,[]),b.get(W).push(O)}Y.set(t.localName,b)}let r=Y.get(t.localName).get(o)?.indexOf(t)??0;return{tag:t.localName,words:o,nth:Math.max(0,r),text:j(t.textContent).slice(0,80)}},gt=t=>{let o=t.cloneNode(!0);for(let r of o.querySelectorAll(".doc-tab"))r.before(" \xB7 ");return j(o.textContent).replace(/^· /,"")},N=t=>{let o=t.matches("table")?t:t.querySelector("table"),r=t.closest(".doc-table-wrap")??t,b=r.getAttribute("data-doc-chart-source")?.trim(),W=(b?[...document.querySelectorAll("[data-doc-chart-data]")].find(S=>S.getAttribute("data-doc-chart-data").trim()===b&&!m(S)):null)?.closest("figure")?.querySelector(":scope > h2, :scope > h3, :scope > h4, :scope > figcaption"),p=r.previousElementSibling;return j(o?.caption?.textContent)||j(W?.textContent)||(p?.matches("p.doc-note")?gt(p):"")||j(o?.querySelector("th")?.textContent??o?.rows[0]?.cells[0]?.textContent)},Q=t=>{let o=t.nodeType===1?t:t.parentElement,r=[],b=[];for(let g=o;g&&g!==document.documentElement;g=g.parentElement)g.hasAttribute("data-block-id")&&r.push(g.getAttribute("data-block-id")),g.id&&!g.hasAttribute("data-qa-tab")&&!g.hasAttribute("data-qa-panel")&&b.push(g.id);let O=[];for(let g=o,T=0;g&&T<4&&!g.matches("body, main, section, [data-doc-sheet], [data-doc-sheets], .doc-columns, .doc-column");g=g.parentElement,T++){let ot=X(g);ot.words.length>=2&&O.push(ot)}let W=o.closest("figure")?.querySelector(":scope > h3, :scope > figcaption, :scope > .doc-figure-caption"),p=o.closest(".doc-table-wrap, table"),S=p?.querySelector("th"),q=o.closest("section")?.querySelector(":scope > h2, :scope > h3, :scope > h4");return{blocks:r,ids:b,texts:O,tag:o.localName,element:z(o),card:W?X(W):null,header:S?X(S):null,table:p?N(p).slice(0,80):null,section:q?X(q):null}};if(l){let t=document.querySelector(l);return{found:x,next:n,anchor:t?Q(t):null}}let h=t=>(t.dataset.qaShot||(t.dataset.qaShot=String(++n)),Number(t.dataset.qaShot)),B=(t,o,r,{picture:b=o,url:O,measured:W,scroll:p,level:S}={})=>x.push({kind:t,what:r,anchor:o?Q(o):null,shot:b?h(b):null,seen:!!(b&&E(b)),url:O,measured:W,scroll:p,...S?{level:S}:{}}),_=t=>t.closest("figure")??t.closest("[data-doc-chart]")??t,tt=t=>{let o=t.getBoundingClientRect();return o.width>0&&o.height>0},C=(t,o,{x:r=!0,y:b=!0}={})=>Math.max(r?o.left-t.left:-1/0,r?t.right-o.right:-1/0,b?o.top-t.top:-1/0,b?t.bottom-o.bottom:-1/0),v=t=>({left:Math.min(...t.map(o=>o.x)),right:Math.max(...t.map(o=>o.x)),top:Math.min(...t.map(o=>o.y)),bottom:Math.max(...t.map(o=>o.y))}),U=t=>{let o=t.getBBox(),r=t.getScreenCTM();return v([[o.x,o.y],[o.x+o.width,o.y],[o.x+o.width,o.y+o.height],[o.x,o.y+o.height]].map(([b,O])=>new DOMPoint(b,O).matrixTransform(r)))},L=t=>{let o=[];for(let r=t.parentElement;r&&r!==document.documentElement;r=r.parentElement){let b=getComputedStyle(r);r instanceof SVGSVGElement&&b.overflow!=="visible"&&o.push(["the svg's edge",r.getBoundingClientRect(),{}]);let O=/url\(\s*["']?#([^)"']+)/.exec(`${r.getAttribute?.("clip-path")??""} ${b.clipPath??""}`)?.[1],W=O?document.getElementById(O):null,p=W?.getAttribute("clipPathUnits")!=="objectBoundingBox"?W?.querySelector("rect"):null;if(p&&r.getScreenCTM){let[S,q,g,T]=["x","y","width","height"].map(ot=>p[ot].baseVal.value);o.push(["a clip-path",v([[S,q],[S+g,q+T]].map(([ot,rt])=>new DOMPoint(ot,rt).matrixTransform(r.getScreenCTM()))),{}])}if(!(r instanceof SVGElement)){let S=/hidden|clip/.test(b.overflowX),q=/hidden|clip/.test(b.overflowY);(S||q)&&o.push([z(r),r.getBoundingClientRect(),{x:S,y:q}])}}return o},it=t=>`${t.slice(0,4).join("; ")}${t.length>4?`; ${t.length-4} more`:""}`,dt=t=>!t.matches("script, [data-doc-dev]")&&(t.matches("svg, canvas")||t.querySelector("svg, canvas")||E(t)&&tt(t));for(let t of f.querySelectorAll("[data-doc-chart]"))m(t)||!E(t)||[...t.children].some(dt)||B("chart-empty",t,`the ${t.getAttribute("data-doc-chart")||"chart"} chart drew nothing`,{picture:_(t)});let Z=[...f.querySelectorAll("svg")].filter(t=>{if(t.parentElement.closest("svg")||m(t)||t.closest(".katex, .doc-icon, button")||!E(t))return!1;let o=t.getBoundingClientRect();return t.closest("[data-doc-chart], figure")||o.width>=120&&o.height>=60}),at={across:.6,down:.25},V=new Map;for(let t of Z){let o=_(t),r=o.getBoundingClientRect(),b=[],O=[],W=[...t.querySelectorAll("text")].filter(q=>!q.closest("defs, clipPath, mask, pattern, marker, symbol")&&j(q.textContent)&&E(q));for(let q of W){let g=U(q),T=L(q).map(([ot,rt,ut])=>[ot,C(g,rt,ut)]).find(([,ot])=>ot>1.5);T?b.push(`${K(q.textContent,24)} ${A(T[1])}px past ${T[0]}`):C(g,r)>1.5&&O.push(`${K(q.textContent,24)} ${A(C(g,r))}px past the card's edge`)}b.length&&B("chart-text-clipped",t,it(b),{picture:o}),O.length&&B("chart-text-outside",t,it(O),{picture:o});let p=q=>{let g=/^(-?)[$¥€£]?(\d[\d,]*(?:\.\d+)?)\s*(?:%|‰|[kKMBG]|万|亿)?$/.exec(q.replace(/[−–]/g,"-"));return g?+`${g[1]}${g[2].replace(/,/g,"")}`:NaN},S=q=>q.every(Number.isFinite)&&q[1]!==q[0]&&q.slice(2).every((g,T)=>Math.abs(g-q[T+1]-(q[1]-q[0]))<=1e-9*Math.max(1,Math.abs(g)));for(let q of t.querySelectorAll("g")){let g=[...q.children].filter(P=>P.matches("g.tick")&&E(P)),T=g.map(P=>P.querySelector("text")).filter(P=>P&&j(P.textContent)&&E(P)),ot=T.map(P=>j(P.textContent));if(ot.length<2||ot.length!==g.length||!S(ot.map(p)))continue;let rt=T.map(P=>{let kt=P.getScreenCTM(),je=(parseFloat(getComputedStyle(P).fontSize)||0)*(kt?Math.hypot(kt.c,kt.d):1);return{label:P,box:U(P),size:je,turned:!!kt&&Math.abs(kt.b)>.001*Math.abs(kt.a)}});if(rt.some(P=>P.turned||!(P.size>0)))continue;let ut=rt.map(({box:P})=>[(P.left+P.right)/2,(P.top+P.bottom)/2]),nt=Math.max(...ut.map(([P])=>P))-Math.min(...ut.map(([P])=>P))>=Math.max(...ut.map(([,P])=>P))-Math.min(...ut.map(([,P])=>P)),mt=({box:P,size:kt})=>nt?[P.left,P.right]:[(P.top+P.bottom-kt)/2,(P.top+P.bottom+kt)/2],St=[...rt].sort((P,kt)=>mt(P)[0]-mt(kt)[0]),wt=null;for(let P=1;P<St.length;P++){let kt=mt(St[P])[0]-mt(St[P-1])[1];(!wt||kt<wt.gap)&&(wt={gap:kt,pair:[St[P-1],St[P]]})}let Ct=Math.max(...rt.map(P=>P.size));if(!wt||wt.gap>=at[nt?"across":"down"]*Ct)continue;for(let{label:P}of rt)V.set(P,q);let[Ot,qt]=wt.pair.map(({label:P})=>K(P.textContent,16)),We=wt.gap<0?`${Ot} and ${qt} overlapping by ${A(-wt.gap)}px`:`${Ot} and ${qt} ${A(wt.gap)}px apart`;B("ticks",t,`${ot.length} tick labels ${nt?"across":"down"} a ${A(nt?t.getBoundingClientRect().width:t.getBoundingClientRect().height)}px chart crowd: ${We}, under ${nt?"a digit's width and a hair":"a quarter of a line"} at their ${A(Ct)}px (${ot.slice(0,6).join(", ")}${ot.length>6?", \u2026":""})`,{picture:o})}}let pt=t=>{let o=t.getBBox(),r=t instanceof SVGTextElement&&parseFloat(getComputedStyle(t).fontSize)||o.height,b=o.y+Math.max(0,(o.height-r)/2),O=b+Math.min(o.height,r),W=t.getScreenCTM();return[[o.x,b],[o.x+o.width,b],[o.x+o.width,O],[o.x,O]].map(([p,S])=>new DOMPoint(p,S).matrixTransform(W))},lt=(t,o)=>{let r=1/0;for(let b of[t,o])for(let O=0;O<b.length;O++){let W=b[O],p=b[(O+1)%b.length],S=Math.hypot(p.x-W.x,p.y-W.y);if(S===0)continue;let q={x:-(p.y-W.y)/S,y:(p.x-W.x)/S},g=ut=>ut.map(nt=>nt.x*q.x+nt.y*q.y),[T,ot]=[g(t),g(o)],rt=Math.min(Math.max(...T),Math.max(...ot))-Math.max(Math.min(...T),Math.min(...ot));if(rt<=0)return 0;r=Math.min(r,rt)}return r===1/0?0:r},st=t=>[...t.querySelectorAll("text")].filter(o=>!o.closest("defs, clipPath, mask, pattern, marker, symbol")&&j(o.textContent)&&E(o));for(let t of Z){let o=st(t).map(b=>({label:b,outline:pt(b)})),r=[];o.forEach(({label:b,outline:O},W)=>{for(let p of o.slice(W+1))V.has(b)&&V.get(b)===V.get(p.label)||lt(O,p.outline)>1.5&&r.push(`${K(b.textContent,20)} and ${K(p.label.textContent,20)} overlap`)}),r.length&&B("chart-text-overlap",t,it(r),{picture:_(t)})}let ct=11;for(let t of Z){if(!t.hasAttribute("viewBox"))continue;let o=[];for(let O of st(t)){let W=O.getScreenCTM(),p=parseFloat(getComputedStyle(O).fontSize);if(!W||!(p>0))continue;let S=p*Math.hypot(W.c,W.d);S<ct-.05&&o.push(`${K(O.textContent,24)} at ${S.toFixed(1)}px (font-size ${+p.toFixed(2)})`)}if(!o.length)continue;let r=t.viewBox.baseVal,b=`${o.length} text${o.length>1?"s":""}`;B("svg-text-small",t,`${b} of a drawing scaled by its viewBox (${+r.width.toFixed(2)}\xD7${+r.height.toFixed(2)} drawn ${A(t.getBoundingClientRect().width)}px wide) render below ${ct}px: ${it(o)}`,{picture:_(t)})}let y=new Set;for(let t of f.querySelectorAll(".doc-table-wrap")){if(m(t)||!E(t))continue;y.add(t);let o=t.querySelector("table");if(!o)continue;let r=Math.max(t.clientWidth,o.offsetWidth),b=Math.max(t.clientHeight,o.offsetHeight),O=r>t.clientWidth+i,W=b>t.clientHeight+i,p=N(t);(O||W)&&B("table-scrolls",t,[O&&`${r}px wide in a ${t.clientWidth}px frame`,W&&`${b}px tall in a ${t.clientHeight}px frame`].filter(Boolean).join(", "),{scroll:{sideways:O,down:W,name:p}});let S=globalThis.__qaTableHides(t,o);S.said&&B("table-columns",t,`${S.said}: the table is ${r}px wide in a ${t.clientWidth}px frame`),S.shown<S.rows&&!t.style.getPropertyValue("--doc-table-height")&&B("table-rows",t,`the frame shows ${S.shown} of ${S.rows} rows: a reader scrolls inside it for the other ${S.rows-S.shown}; style="--doc-table-height: none" on its div.doc-table-wrap shows every row (or split the table where its content divides)`)}let D=t=>!!t.closest("details[data-qa-closed]"),F="in a disclosure closed in the file: a reader who opens it scrolls";for(let t of f.querySelectorAll(".doc-code, .doc-diff")){if(m(t)||!E(t))continue;let o=t.querySelector(":scope > pre, :scope > .doc-diff-body");if(o&&E(o)){let b=D(t);if(o.scrollHeight>o.clientHeight+i){let O=[t,o].map(q=>q.style.getPropertyValue("--doc-code-height").trim()).find(Boolean),W=o.getBoundingClientRect().top+o.clientTop+o.clientHeight,p=[...o.querySelectorAll(".doc-code-line")].filter(q=>q.getClientRects().length>0&&q.getBoundingClientRect().top>=W-1).length,S=b?`, ${F} inside it for the rest`:O?`, the block's own height (--doc-code-height: ${O}, the author's or the reader's): a reader scrolls inside it for the rest`:": a reader scrolls inside it for the rest";B("code-scrolls",t,`the code is ${o.scrollHeight}px tall, its frame ${o.clientHeight}px${p?` (its last ${p} line${p===1?"":"s"} below it)`:""}${S}`,{level:b||O?"info":void 0})}if(o.scrollWidth>o.clientWidth+i){let O=t.classList.contains("doc-code--nowrap"),W=b?`, ${F} sideways for the rest`:O?", its lines left unwrapped (doc-code--nowrap, the author's or the reader's choice): a reader scrolls sideways for the rest of its long lines":": a reader scrolls sideways for the rest";B("code-scrolls",t,`the code is ${o.scrollWidth}px wide, its frame ${o.clientWidth}px${W}`,{level:b||O?"info":void 0})}}let r=t.querySelector(":scope > .doc-code-title");r&&E(r)&&r.scrollWidth>r.clientWidth+1&&B("code-title-cut",t,`its title ${K(r.textContent,48)} is cut to fit its header (${r.scrollWidth}px of words in ${r.clientWidth}px)`)}for(let t of f.querySelectorAll(".doc-math-block")){if(m(t)||!E(t)||t.scrollWidth<=t.clientWidth+i)continue;let o=D(t);B("formula-scrolls",t,`the formula is ${t.scrollWidth}px wide, its frame ${t.clientWidth}px${o?`, ${F} it sideways for the rest`:": a reader scrolls it sideways for the rest"}`,{level:o?"info":void 0})}for(let t of f.querySelectorAll("[data-doc-layout]"))m(t)||!E(t)||B("layout",t,t.getAttribute("data-doc-layout"),{picture:t.closest("figure, .doc-table-wrap")??t,measured:y.has(t)});let J=document.createTreeWalker(f,NodeFilter.SHOW_TEXT),R=new Map;for(let t=J.nextNode();t;t=J.nextNode()){if(!/\\\(|\\\[|\$\$/.test(t.nodeValue))continue;let o=t.parentElement;if(!o||o.closest([...s,".katex","[data-doc-dev]"].join(", "))||!E(o))continue;let r=o.closest("p, li, h1, h2, h3, h4, td, th, figcaption, summary, blockquote, dd, dt")??o;R.has(r)||R.set(r,t.nodeValue)}for(let[t,o]of R){let r=o.search(/\\\(|\\\[|\$\$/);B("raw-formula",t,`${K(o.slice(r,r+40),40)} is shown as written: the kit's math did not render it`)}for(let t of f.querySelectorAll(".katex-error"))m(t)||!E(t)||B("formula-error",t,`${K(t.textContent,32)}: ${j(t.getAttribute("title"))||"KaTeX could not read it"}`);let I=t=>`"${globalThis.__qaUrlName?.(t,document.baseURI)??t}"`,k=t=>{try{return new URL(t,document.baseURI).href}catch{return t}},H=t=>[...["src","href","poster","data"].filter(o=>t.hasAttribute(o)&&!(o==="href"&&t.matches("a, area"))).map(o=>t.getAttribute(o)),...(t.getAttribute("srcset")??"").split(",").map(o=>o.trim().split(/\s+/)[0]),...[t.getAttribute("style"),t.localName==="style"?t.textContent:""].flatMap(o=>[...String(o??"").matchAll(/url\(\s*["']?([^"')]+)/g)].map(r=>r[1]))].filter(o=>o&&!o.trim().startsWith("#")).map(k),c=[...document.querySelectorAll("*")].filter(t=>!m(t)).flatMap(t=>H(t).map(o=>({node:t,address:o}))),a=new Set;for(let{url:t,directive:o}of globalThis.__qaViolations??[]){let r=/^[a-z][a-z\d+.-]*$/i.test(t)?`${t.toLowerCase()}:`:null,b=c.find(W=>r?!a.has(W)&&W.address.startsWith(r):W.address===t);b&&r&&a.add(b);let O=b?.node??null;e&&!(O&&f.contains(O))||B("blocked",O,`${o} blocked ${I(b?.address??t)}${O?` (${z(O)})`:""}: the export holds every file it shows`,{url:b?.address??t})}for(let t of f.querySelectorAll("img")){if(m(t)||t.complete&&t.naturalWidth>0)continue;let o=t.currentSrc||t.src?k(t.currentSrc||t.src):"";B("image",t,`${o?I(o):"a picture with no src"} did not load`,{picture:t.closest("figure")??t,url:o})}let M=new Set(d),G=new Set(w),et=document.createRange(),$t="button, select, input, textarea, [data-doc-dev]",yt=(t,o)=>t!==o&&(t.matches($t)||[...t.classList].some(r=>r.startsWith("doc-"))),xt=(t,o,r)=>{let b=[],O=!1;for(let W=t,p=!0;W&&W!==document.body&&W!==document.documentElement;W=W.parentElement,p=!1){let S=getComputedStyle(W);if((!p||r)&&(O&&(S.position!=="static"||S.transform!=="none")&&(O=!1),!O)){if(/auto|scroll/.test(S.overflowY))break;/hidden|clip/.test(S.overflowY)&&!yt(W,o)&&b.push(W)}if(S.position==="fixed")break;S.position==="absolute"&&(O=!0)}return b},bt=t=>t.getBoundingClientRect().bottom-(parseFloat(getComputedStyle(t).borderBottomWidth)||0),Pt=t=>{let o=getComputedStyle(t),r=b=>!/^(transparent|rgba\(.*,\s*0\))$/.test(b);return r(o.backgroundColor)||o.backgroundImage!=="none"||["Top","Right","Bottom","Left"].some(b=>parseFloat(o[`border${b}Width`])>0&&o[`border${b}Style`]!=="none"&&r(o[`border${b}Color`]))},Nt="rect, circle, ellipse, line, polyline, polygon, path, use",Tt=(t,o)=>{let r=new Map,b=(p,S,q,g)=>{if(!r.has(p)&&r.size>=3)return;let T=r.get(p)??{words:[],marks:[],depth:0,height:p.getBoundingClientRect().height};q&&T.words.push(q),g&&T.marks.push(g),T.depth=Math.max(T.depth,S),r.set(p,T)},O=p=>p.getBoundingClientRect().height>1.5,W=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let p=W.nextNode();p;p=W.nextNode()){let S=p.parentElement;if(!p.nodeValue.trim()||!S||S.closest("svg, script, style, template, .katex")||!E(S)||o(S))continue;let q=xt(S,t,!0).filter(O);if(q.length===0)continue;let g=getComputedStyle(S),T=parseFloat(g.lineHeight);for(let ot of p.nodeValue.matchAll(/\S+/g)){let rt=ot.index+ot[0].length;et.setStart(p,ot.index),et.setEnd(p,rt);let ut=[...et.getClientRects()];for(let nt of ut){let mt=Number.isFinite(T)?Math.max(0,(nt.height-T)/2):0,St=q.find(Ct=>nt.bottom-bt(Ct)>1.5+mt);if(!St)continue;let wt=ot.index;if(ut.length>1){let Ct=bt(St)+1.5+mt;for(let Ot=rt-1;wt<Ot;){let qt=wt+Ot>>1;et.setStart(p,qt),et.setEnd(p,qt+1),(et.getClientRects()[0]?.bottom??0)>Ct?Ot=qt:wt=qt+1}}b(St,Math.max(...ut.map(Ct=>Ct.bottom))-bt(St),p.nodeValue.slice(wt,rt),null);break}}}for(let p of t.querySelectorAll("*")){let S=p instanceof SVGElement&&p.matches(Nt)&&!p.closest("defs, clipPath, mask, pattern, marker, symbol"),q=!S&&!(p instanceof SVGElement)&&!p.matches("img, picture, video, canvas, iframe, object, embed, script, style, template")&&p.children.length===0&&!p.textContent.trim()&&Pt(p);if(!S&&!q||!E(p))continue;let g=p.getBoundingClientRect();if(g.width<=0&&g.height<=0)continue;let T=S?p.ownerSVGElement:null,ot=[...T&&getComputedStyle(T).overflowY!=="visible"?[T]:[],...xt(T??p,t,!!T)].filter(O),rt=nt=>{let mt=nt.getBoundingClientRect();return g.left>=mt.left-1.5&&g.right<=mt.right+1.5&&g.top>=mt.top-1.5},ut=ot.find(nt=>g.bottom-bt(nt)>1.5&&rt(nt));ut&&b(ut,g.bottom-bt(ut),null,S?p.localName:z(p))}return r};for(let t of f.querySelectorAll("[data-block-id]")){let o=t.getAttribute("data-block-id"),r=G.has(o);if(!r&&!M.has(o)||m(t)||!E(t))continue;let b=p=>p.closest(".doc-chart-message")||p.closest("h2, h3, h4, p, figcaption")?.parentElement===t,O=new Map,W=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let p=W.nextNode();p&&O.size<3;p=W.nextNode()){let S=p.parentElement;if(!p.nodeValue.trim()||!S||S.closest("svg, script, style, template, .katex")||!E(S)||r&&b(S))continue;let q=S;for(;q!==t&&["inline","contents"].includes(getComputedStyle(q).display);)q=q.parentElement;let g=!1;for(let nt=S;nt&&!g;nt=nt===t?null:nt.parentElement){let mt=getComputedStyle(nt);g=mt.overflowX!=="visible"||mt.overflowY!=="visible"}if(g)continue;let T=getComputedStyle(q),ot=q.getBoundingClientRect(),rt=ot.left+parseFloat(T.borderLeftWidth)+parseFloat(T.paddingLeft),ut=ot.right-parseFloat(T.borderRightWidth)-parseFloat(T.paddingRight);for(let nt of p.nodeValue.matchAll(/\S+/g)){et.setStart(p,nt.index),et.setEnd(p,nt.index+nt[0].length);let mt=[...et.getClientRects()],St=Math.max(0,...mt.flatMap(Ct=>[Ct.right-ut,rt-Ct.left]));if(St<=1.5||mt.some(Ct=>Ct.right>u+1))continue;let wt=O.get(q)??{words:[],reach:0,width:ut-rt};wt.words.push(nt[0]),wt.reach=Math.max(wt.reach,St),O.set(q,wt)}}for(let[p,{words:S,reach:q,width:g}]of O)B("overflow-in-block",p,`the words ${K(S.join(" "),40)} run ${A(q)}px past the side of ${z(p)} (${A(g)}px wide for its words), over what is beside it`,{picture:t});for(let[p,{words:S,marks:q,depth:g,height:T}]of Tt(t,r?b:()=>!1)){let ot=[S.length&&`the words ${K(S.join(" "),40)}`,q.length&&`${q.length===1?"a mark":`${q.length} marks`} (${[...new Set(q)].slice(0,3).join(", ")})`].filter(Boolean).join(" and "),rt=S.length===0&&q.length===1;B("cut-in-block",p,`${ot} ${rt?"reaches":"reach"} ${A(g)}px past the bottom of ${z(p)} (${A(T)}px tall, its overflow ${getComputedStyle(p).overflowY}), cut off there`,{picture:t})}}if(et.detach(),document.documentElement.scrollWidth>u+1){let t=g=>{for(let T=g.parentElement;T&&T!==document.body;T=T.parentElement)if(getComputedStyle(T).overflowX!=="visible")return!1;return g.nodeType!==1||getComputedStyle(g).position!=="fixed"},o=[...f.querySelectorAll("*")].filter(g=>!(g instanceof SVGElement&&g.ownerSVGElement)&&!m(g)&&g.getBoundingClientRect().right>u+1&&E(g)&&t(g)),r=o.filter(g=>!o.includes(g.parentElement)).slice(0,3),b=`the page is ${document.documentElement.scrollWidth}px wide in a ${u}px window`,O=new Set(o),W=g=>{for(let T=g.parentElement;T;T=T.parentElement)if(O.has(T))return!0;return!1},p=new Map,S=document.createRange(),q=document.createTreeWalker(f,NodeFilter.SHOW_TEXT);for(let g=q.nextNode();g&&p.size<3;g=q.nextNode()){let T=g.parentElement;if(!T||!g.nodeValue.trim()||T.closest("svg, script, style, template")||m(T)||W(g)||!E(T)||!t(g)||(S.selectNodeContents(g),![...S.getClientRects()].some(nt=>nt.right>u+1)))continue;let ot=T.closest("[data-block-id]")??T;if(p.has(ot))continue;let rt=[],ut=0;for(let nt of g.nodeValue.matchAll(/\S+/g)){S.setStart(g,nt.index),S.setEnd(g,nt.index+nt[0].length);let mt=Math.max(...[...S.getClientRects()].map(St=>St.right),0);mt<=u+1||(rt.push(nt[0]),ut=Math.max(ut,mt))}rt.length&&p.set(ot,{node:T,words:rt.join(" "),right:ut})}S.detach(),r.length===0&&p.size===0&&!e&&B("overflow",null,b);for(let g of r)B("overflow",g,`${b}: ${z(g)} ${K(g.textContent,24)} reaches ${A(g.getBoundingClientRect().right)}px`);for(let[g,{node:T,words:ot,right:rt}]of p)B("overflow",T,`${b}: the words ${K(ot,60)} in ${z(g)} run past its edge to ${A(rt)}px (a text that cannot break)`,{picture:g})}return{found:x,next:n}}function fo(){let e=s=>!!s.closest("[data-doc-dev]"),n=s=>[...document.querySelectorAll(s)].filter(l=>!e(l)).length;return{charts:n("[data-doc-chart], [data-doc-component='gallery/chart-view']"),tables:n(".doc-table-wrap"),height:document.documentElement.scrollHeight}}var Et=2e4,Me=1800;function jt(e,n,s){let l=0,i=new Promise((d,w)=>{l=setTimeout(()=>w(new Error(`${s}: no answer in ${n/1e3}s`)),n)});return Promise.race([e,i]).finally(()=>clearTimeout(l))}var Xt=e=>`${e.kind}|${JSON.stringify(e.anchor)}|${e.what}`;async function uo(e,n,s,{out:l,tiles:i=!1,blocks:d=[],around:w=new Map,held:f=new Map,whole:x=[],drawn:u=[],known:A=null}){let{width:j,height:K=900,label:m=String(j)}=typeof s=="number"?{width:s}:s,E=m.replace("\xD7","x"),z,$;try{z=await jt(e.createBrowserContext(),Et,"a browser context opened"),$=await jt(z.newPage(),Et,"a tab opened")}catch(y){return await Dt(z?.close()),{findings:[{kind:"unverified",what:`the browser did not open a page: ${y.message}`,anchor:null,shot:null,seen:!1,state:""}],counts:null,pictures:[],held:{covered:[],missed:[]}}}$.setDefaultTimeout(Et);let Y=[],X=[],gt=new Set,N=new Map,Q=new Set,h=new Set,B=new Set,_="",tt=0,C=(y,D,F={})=>Y.push({kind:y,what:D,anchor:null,shot:null,seen:!1,state:_,...F}),v=Ie(n).href,U=y=>`"${be(y,v)}"`,L=y=>l.folders?.get(y)??l.blocks,it=y=>y.replace(/[^\w-]/g,"_");$.on("pageerror",y=>C("error",`uncaught ${Ft(y.message).slice(0,200)}`)),$.on("console",y=>{y.type()==="error"&&le(y,v)&&C("error",`console: ${Ft(y.text()).slice(0,200)}`)}),$.on("requestfailed",y=>{y.frame()===$.mainFrame()&&C("request",`${U(y.url())}: ${y.failure()?.errorText??"failed"}`,{url:y.url()})}),$.on("response",y=>{y.status()>=400&&y.request().frame()===$.mainFrame()&&C("request",`${U(y.url())}: HTTP ${y.status()}`,{url:y.url()})}),await ce($),await $.evaluateOnNewDocument(`globalThis.__qaUrlName = ${be}; globalThis.__qaTableHides = ${Ue()};`),await $.setViewport({width:j,height:K}),await $.emulateMediaFeatures([{name:"prefers-color-scheme",value:"light"}]);let dt=async y=>{for(let D of await he($,{timeout:Et}))C("unverified",`${y}: waited for ${D}`)},Z=async(y,D,F,J)=>jt($.screenshot({path:F,clip:y,captureBeyondViewport:!D}),Et,"the picture").then(()=>!0,R=>(C("unverified",`no picture of ${J} (${R.message})`),!1)),at=async(y,D,F,J=0)=>{let R=await $.evaluate(ho,{selector:y,up:J,margin:Xe,frames:Je}).catch(I=>({error:I}));return R?.clip?await Z(R.clip,R.fixed,D,F)?R.clip:null:(C("unverified",`no picture of ${F} (${R?.error?.message??"the element is gone or shows nothing"})`),null)},V=(y,D)=>y.left<D.x+D.width&&y.right>D.x&&y.top<D.y+D.height&&y.bottom>D.y,pt=async()=>{let y=d.filter(F=>!Q.has(F)),D=await $.evaluate((F,J,R)=>{let I=new Map(F.map((M,G)=>[M,G])),k=M=>!!M&&!M.closest("[data-doc-dev], dialog:not([open])")&&M.getClientRects().length>0,H=M=>M===null?null:[...document.querySelectorAll("[data-block-id]")].find(G=>G.getAttribute("data-block-id")===M&&k(G))??null,c=M=>{if(!M)return null;let G=M.getBoundingClientRect();return{left:G.left+scrollX,right:G.right+scrollX,top:G.top+scrollY,bottom:G.bottom+scrollY}},a=[];for(let M of document.querySelectorAll("[data-block-id]")){let G=I.get(M.getAttribute("data-block-id"));if(G===void 0||!k(M))continue;I.delete(M.getAttribute("data-block-id")),M.setAttribute("data-qa-block",String(G));let[et,$t]=J[G]??[],yt=(R[G]??[]).map(xt=>[xt,[...M.querySelectorAll("[data-block-id]")].find(bt=>bt.getAttribute("data-block-id")===xt&&k(bt))]).filter(([,xt])=>xt);a.push({index:G,boxes:J[G]?{block:c(M),above:c(H(et)),below:c(H($t))}:null,held:yt.map(([xt,bt])=>({id:xt,box:c(bt)}))})}return a},y,y.map(F=>w.get(F)??null),y.map(F=>f.get(F)??[]));for(let{index:F,boxes:J,held:R}of D){let I=y[F];Q.add(I);let k=`${E}-${it(I)}`,H=[];if(!J){let c=ht.join(L(I),`${k}.png`),a=await at(`[data-qa-block="${F}"]`,c,`the block ${I}`);a&&(X.push({block:I,file:c}),H.push(a))}for(let{part:c,clip:a}of J?Ze(J):[]){let M=ht.join(L(I),`${k}${c?`-${c}`:""}.png`);await Z(a,!1,M,`the block ${I}${c?` (its ${c})`:""}`)&&(X.push({block:I,file:M}),H.push(a))}for(let{id:c,box:a}of R)H.some(M=>V(a,M))?h.add(c):h.has(c)||B.add(c);await $.evaluate(c=>document.querySelector(`[data-qa-block="${c}"]`)?.removeAttribute("data-qa-block"),F)}},lt=async(y,D,F)=>{let J=[...f].filter(([I])=>Q.has(I)).map(([I,k])=>[I,k.filter(H=>!h.has(H))]).filter(([,I])=>I.length);if(!J.length)return;let R=await $.evaluate((I,k)=>{let H=document.querySelector(I);if(!H)return[];let c=a=>[...H.querySelectorAll("[data-block-id]")].some(M=>M.getAttribute("data-block-id")===a&&M.getClientRects().length>0);return k.map(([a,M])=>[a,M.filter(c)]).filter(([,a])=>a.length)},y,J);for(let[I,k]of R){let H=ht.join(L(I),`${E}-${it(I)}-${D}.png`);if(await at(y,H,`the block ${I} (${D})`,F)){X.push({block:I,part:D,file:H});for(let c of k)h.add(c),B.delete(c)}}},st=async y=>{let D=await $.evaluate(zt,{scope:y,next:tt,ignored:Fe,slack:Ke,whole:x,drawn:u});tt=D.next;let F=D.found.flatMap(R=>R.kind!=="layout"?[R]:ze(R.what,j).filter(({kind:I})=>!(R.measured&&["table-columns","table-rows"].includes(I))).map(({kind:I,note:k})=>({...R,kind:I,what:`the kit notes ${k}`})));for(let R of F){let I=R.shot===null?null:`${R.kind}|${R.shot}|${R.what}`,k=I&&N.get(I);if(k)!k.seen&&R.seen&&Object.assign(k,R,{state:_});else{let H={...R,state:_};Y.push(H),I&&N.set(I,H)}}let J=new Set(Y.filter(R=>R.kind==="blocked").map(R=>R.url));for(let R of Y){if(R.shot===null||!R.seen||gt.has(R.shot)||!Ye(R,j)||A?.has(Xt(R))||["request","image"].includes(R.kind)&&J.has(R.url))continue;gt.add(R.shot);let I=ht.join(l.flagged,`${E}-${String(R.shot).padStart(2,"0")}-${R.kind}.png`);await at(`[data-qa-shot="${R.shot}"]`,I,R.kind)&&X.push({shot:R.shot,file:I})}d.length&&await pt()},ct=y=>{let D=new Set(Y.filter(J=>J.kind==="blocked").map(J=>J.url));return{findings:Y.filter(J=>!(["request","image"].includes(J.kind)&&D.has(J.url))&&!A?.has(Xt(J))),counts:y,pictures:X,held:{covered:[...h],missed:[...B]}}};try{try{let k=new Promise(c=>$.once("domcontentloaded",c)),H=$.goto(v,{waitUntil:"load",timeout:6e4});if(H.catch(()=>{}),await Promise.race([k,H]),$.url()!==v)throw new Error(`the browser shows ${$.url()}`)}catch(k){return C("unverified",`the page did not load: ${k.message}`),ct(null)}await dt("the page as it opens");let y=await $.evaluate(co,Et);y.loaded||C("unverified",`the pictures (${y.images}) not all loaded in ${Et/1e3}s`),y.closed&&await dt(`the page with its ${y.closed} closed disclosure${y.closed===1?"":"s"} opened`),await st(null);let D=async(k,H,c,a=null)=>{for(let M=k,G=1;M<H;M+=Me,G++){let et=ht.join(l.tiles,`${E}-${c}${String(G).padStart(2,"0")}.png`);await jt($.screenshot({path:et,clip:{x:0,y:M,width:j,height:Math.min(Me,H-M)},captureBeyondViewport:!0}),Et,"a tile").then(()=>X.push({tile:!0,sheet:a,file:et}),$t=>C("unverified",`no tile ${c}${G} (${$t.message})`))}};i&&await D(0,await $.evaluate(()=>document.documentElement.scrollHeight),"");let F=async(k,H=null)=>{if(!await $.evaluate(ve,k.chain)){let{anchor:c}=await $.evaluate(zt,{next:tt,place:`[data-qa-tab="${k.index}"]`});return C("unverified","this Sheet could not be shown: its tab was clicked and its panel stayed hidden",{anchor:c}),!1}if(await dt("the Sheet shown"),await st(`[data-qa-panel="${k.index}"]`),await lt(`[data-qa-panel="${k.index}"]`,`sheet${k.index+1}`,1),i&&H)await J(H,`sheet${k.index+1}-`);else if(i){let c=await $.evaluate(a=>{let M=document.querySelector(`[data-qa-panel="${a}"]`)?.getBoundingClientRect();return M&&M.height>0?{top:Math.max(0,M.top+scrollY),bottom:M.bottom+scrollY}:null},k.index);c&&await D(c.top,c.bottom,`sheet${k.index+1}-`,{number:k.index+1,label:k.label})}return!0},J=async(k,H="")=>{for(let c=1;c<=20;c++){let a=await $.evaluate((G,et)=>{let $t=document.querySelector(`[data-qa-card="${G}"]`),yt=$t?.querySelector(".doc-dialog-content")??$t;if(!yt)return null;if(et)yt.scrollTop=0;else{let bt=yt.scrollTop;if(yt.scrollTop+=Math.max(40,yt.clientHeight-24),yt.scrollTop===bt)return null}let xt=$t.getBoundingClientRect();return{x:xt.left+visualViewport.pageLeft,y:xt.top+visualViewport.pageTop,width:xt.width,height:xt.height}},k.index,c===1);if(!a)break;let M=ht.join(l.tiles,`${E}-card${k.index+1}-${H}${String(c).padStart(2,"0")}.png`);await Z(a,!0,M,`the detail card ${Mt(k.label,24)}, tile ${H}${c}`)&&X.push({tile:!0,card:{number:k.index+1,label:k.label,part:H},file:M})}},R=0;for(let k of y.sheets)k.shown||!k.panel||k.card!==null||(_=`Sheet ${Mt(k.label,24)}`,await F(k)&&(R+=1));let I=0;for(let k of y.cards){_=`detail card ${Mt(k.label,24)}`;let H=`[data-qa-card="${k.index}"]`;k.chain.length&&await $.evaluate(ve,k.chain);for(let c of k.within)await $.evaluate(ke,c);if(!await $.evaluate(ke,k.index)){let{anchor:c}=await $.evaluate(zt,{next:tt,place:H});C("unverified","this detail card could not be opened",{anchor:c});for(let a of k.within.toReversed())await $.evaluate(Ht,a);continue}I+=1,await dt("the detail card opened"),await st(H),await lt(H,`card${k.index+1}`,0),i&&await J(k);for(let c of y.sheets)c.card!==k.index||c.shown||!c.panel||(_=`detail card ${Mt(k.label,24)}, Sheet ${Mt(c.label,24)}`,await F(c,k)&&(R+=1));await $.evaluate(Ht,k.index);for(let c of k.within.toReversed())await $.evaluate(Ht,c)}return _="",ct({...await $.evaluate(fo),details:y.details,closed:y.closed,sheets:R,cards:y.cards.length,cardsOpened:I})}catch(y){return C("unverified",`the look ended early: ${y.message}`),ct(null)}finally{await Dt(z.close())}}var Jt=e=>e.split(ht.sep).join("/"),ft=(e,n,s=`${n}s`)=>`${e} ${e===1?n:s}`,Ut=e=>`${e.join(", ")}px`,po=e=>e.includes("\xD7")?e:`${e}px`;function go({details:e,closed:n}){if(e===0)return"0 disclosures";let s=n===0?"open in the file":`${n===e?"":`${n} `}closed in the file, opened for the pictures`;return`${ft(e,"disclosure")} (${s})`}function Re(e,n=null){let s=new Map;for(let l of e){let i=n?ht.relative(n,l):"",d=Jt(n&&i&&!i.startsWith("..")&&!ht.isAbsolute(i)?i:l),w=/^(.*\/)?(\d+(?:x\d+)?)-([^/]+)$/.exec(d),f=w?`${w[1]??""}\0${w[3]}`:d;s.has(f)||s.set(f,w?{head:w[1]??"",tail:w[3],looks:[]}:{whole:d});let x=s.get(f);w&&!x.looks.includes(w[2])&&x.looks.push(w[2])}return[...s.values()].map(l=>l.whole??`${l.head}${l.looks.length>1?`{${l.looks.join(",")}}`:l.looks[0]}-${l.tail}`)}function mo(e){let n=e.map(({folder:l,files:i})=>({folder:l,files:[...new Set(i)]})).filter(({files:l})=>l.length);if(!n.length)return null;let s=n.reduce((l,{files:i})=>l+i.length,0);return`Not opened yet: ${ft(s,"picture")} of this run, none looked at for you; open each, and in the handoff name those you opened: ${n.flatMap(({folder:l,files:i})=>Re(i,l).map(d=>ht.isAbsolute(d)?d:`${Jt(l)}/${d}`)).join(", ")}`}var Te=(e="<slug>")=>`more pictures: gallery qa ${e} --tiles (the page, each Sheet panel and each detail card in tiles), gallery qa ${e} --blocks <id,\u2026> (the blocks you name)`,nn=Te(),Ne=fe,Ce='look at the export yourself at 1024, 736 and 360px, its disclosures and detail cards opened (SKILL.md, "Export, check and look"), and say so when you hand the document over.',wo=e=>Ft(e?.message).replace(/\s*Use a different `?userDataDir`? or stop the running browser first\.?/gi,"").slice(0,300),Gt={overflow:"a reader scrolls the whole page sideways. Words that cannot break where they stand (a long path, URL or name): wrap each in <code>, which breaks where it must and keeps it whole for the reader to copy; an element wider than the window (a picture, a drawing, a width of your own): let it fit (max-width: 100%) or put it in a frame that scrolls; never cut or rewrite a path to silence this","table-columns":"not a failure. If the reader must see the column on a desktop, write its long values compactly (a cell of numbers stays on one line, so its longest value sets the column's width: a range as a\u2013b, fewer digits), move a unit out of its header into the line above the table, shorten the header, or split the table; never delete a column to silence this","chart-text-overlap":"not a failure. If the reader must read both, shorten the labels (a unit belongs in the axis's title), move one (above its row, or a leader line) or give the drawing more room at this width; never delete a label or a category to silence this","code-scrolls":'not a failure. A reader scrolls inside the frame (40 lines) for the rest; if every line must show at once, write style="--doc-code-height: none" on its <pre>; never delete code to silence this',"formula-scrolls":"not a failure. A reader scrolls the formula sideways for the rest; if it must show whole at this width, break it into lines (\\begin{aligned} \u2026 \\end{aligned}) or into two formulas; never cut a term to silence this","overflow-in-block":"not a failure. If the words run over others in the picture, give their box room at this width (a wider column in an @media rule of your <style>, or a smaller font there), or let them break (a dash or a space where a line may end); never cut the words to silence this","cut-in-block":"not a failure. If the reader must see what is cut, let the box grow with what it holds (min-height instead of height or max-height, or none), give it room at this width in an @media rule of your <style>, or let it scroll (overflow: auto); never delete the words to silence this",ticks:"not a failure. If the numbers crowd in the picture, give that axis fewer ticks at this width with axis.tickValues([...]), at most four on a phone (the domain's ends and middle; ticks(n) is only a hint to d3 and can still draw five or more), or shorter numbers (the unit in the axis's title: 2k, 1.5\u4E07); never take the axis out to silence this","svg-text-small":"not a failure. The viewBox scales the drawing's text with it: give the text a larger font-size in the viewBox's units (a viewBox 800 wide drawn 340px wide scales by 0.43, so 26 units read as 11px), or lay the drawing out for narrow widths (a viewBox of its own under an @media rule, a chart of your own drawn from its width, or HTML that wraps); never drop the labels to silence this"},$o='not a failure. A reader scrolls sideways for the rest of its long lines; if the reader must see them whole at this width, let them wrap (take data-wrap="false" off its <pre>) or break them where the code allows; a tree or a log whose lines must stay whole may scroll; never cut a line to silence this';function xo(e){if(e.kind!=="code-scrolls")return Gt[e.kind]?[Gt[e.kind]]:[];let n=[...e.said.keys()],s=n.some(l=>/ wide, its frame /.test(l));return[...!s||n.some(l=>/ tall, its frame /.test(l))?[Gt["code-scrolls"]]:[],...s?[$o]:[]]}var yo="none is a failure: each says what to do if it matters to the reader (never delete a column or a label to silence one)",bo="a reader scrolls it: not a problem";function So(e,n,s=null,{folder:l=null,slug:i="<slug>"}={}){let d=[],w=Object.fromEntries(Bt.map(h=>[h,0])),f=new Map,x=new Set,u=new Map,A=[],j=h=>Re(h,l),K=h=>h.label??String(h.width),m=new Map(e.flatMap(h=>h.pictures.filter(B=>B.shot!==void 0).map(B=>[`${K(h)}|${B.shot}`,B.file])));for(let h of e){let{width:B,findings:_,counts:tt}=h,C=K(h),v=new Set,U=Object.fromEntries(Bt.map(V=>[V,0])),L={right:0,down:0,all:0};for(let V of _){let pt=`${V.kind}|${V.shot??""}|${V.what}`;if(v.has(pt))continue;v.add(pt);let lt=qe(V,B);U[lt]+=1;let st=oo(V.anchor,n);if(V.kind==="table-scrolls"){let{sideways:R=!1,down:I=!1,name:k=""}=V.scroll??{};Object.assign(L,{all:L.all+1,right:L.right+Number(R),down:L.down+Number(I)});let H=`${st}|${k}`;u.has(H)||u.set(H,{place:st,name:k,right:[],down:[]}),R&&!u.get(H).right.includes(C)&&u.get(H).right.push(C),I&&!u.get(H).down.includes(C)&&u.get(H).down.push(C)}if(lt==="info"&&x.add(`${V.kind}|${st}`),lt==="info"&&["table-scrolls","table-columns","table-rows"].includes(V.kind))continue;let ct=`${Bt.indexOf(lt)}|${V.kind}|${st}`;f.has(ct)||(f.set(ct,{level:lt,kind:V.kind,place:st,said:new Map}),lt!=="info"&&(w[lt]+=1));let y=f.get(ct).said,D=`${V.state?`[${V.state}] `:""}${V.what}`;y.has(D)||y.set(D,{labels:[],pictures:[]});let F=y.get(D);F.labels.includes(C)||F.labels.push(C);let J=m.get(`${C}|${V.shot}`);J&&!F.pictures.includes(J)&&F.pictures.push(J)}let it=[L.right&&`\u2192 ${L.right}`,L.down&&`\u2193 ${L.down}`].filter(Boolean).join(", "),dt=`${ft(L.all,"table scrolls","tables scroll")}${it?` (${it})`:""}`,Z=tt?.cards?`, ${ft(tt.cards,"detail card")} (${tt.cardsOpened===tt.cards?"closed in the file, opened in turn":`${tt.cardsOpened??0} of them opened`})`:"",at=h.laptop?"; only what the 1024px look did not find":tt?`; ${ft(tt.charts,"chart")}, ${ft(tt.tables,"table")}, ${go(tt)}, ${ft(tt.sheets,"Sheet")} shown besides the first${Z}, page ${tt.height}px tall`:"";A.push({label:C,fail:U.fail,warn:U.warn,line:`${h.laptop?C:`${C.padStart(4)}px`} fail ${U.fail} \xB7 warn ${U.warn} \xB7 unverified ${U.unverified} \xB7 ${dt}${at}`})}let E=[...f.values()].sort((h,B)=>Bt.indexOf(h.level)-Bt.indexOf(B.level)),z=e.flatMap(h=>h.pictures);if(l&&z.length&&d.push(`Pictures of this run in ${Jt(l)}/ (each path below is in it):`),s){let h=new Map;for(let C of z)C.block!==void 0&&h.set(C.block,[...h.get(C.block)??[],C.file]);let B=Oe(e),_=C=>`${s.tags?.get(C)?`${s.tags.get(C)} `:""}${C}`,tt=`at ${$e.slice(0,-1).join(", ")} and ${$e.at(-1)}px`;s.tiles&&s.why&&d.push(`${s.why[0].toUpperCase()}${s.why.slice(1)}.`);for(let C of s.groups??[]){if(!C.ids.length&&!C.rest.length)continue;let v=!C.ids.length&&s.groups.some(U=>U!==C&&U.ids.length)?`: none this run (the ${Ae} blocks a run pictures went to the changed blocks above)`:"";d.push(`${C.why[0].toUpperCase()}${C.why.slice(1)}${C.ids.length?`, ${tt}`:v}:`);for(let U of C.ids){let L=n.blocks.get(U),it=`${L?`${n.name??"doc.html"}:${L}`:`(not in ${n.name??"doc.html"})`} ${U}${s.tags?.get(U)?` ${s.tags.get(U)}`:""}`,dt=h.get(U)??[],Z=s.moved?.has(U)?" (moved: with the edges of the blocks before and after it)":"",at=s.held?.get(U)??[],V=at.filter(F=>s.changed?.has(F)).length,pt=C.kind==="named"?ft(at.length,"block"):[V&&ft(V,"changed block"),at.length-V&&ft(at.length-V,"card")].filter(Boolean).join(" and "),lt=z.some(F=>F.block===U&&F.part)?", pictured again with each Sheet panel or detail card that holds one":"",st=at.filter(F=>B.has(F)),ct=[...new Set(st.flatMap(F=>B.get(F)))].map(F=>F.includes("\xD7")?F:`${F}px`).join(", "),y=st.length?`; ${st.length} of them not pictured at ${ct}: gallery qa ${i} --blocks ${st.join(",")}`:"",D=at.length?` (with the ${pt} it holds${lt}${y})`:"";d.push(dt.length?` ${it}${Z}${D}: ${j(dt).join(", ")}`:` ${it}${Z}${D}: not shown at any width (hidden)`)}if(C.rest.length){let U=ft(C.rest.length,{changed:"changed block",cards:"card"}[C.kind]??"block"),L=`${C.rest.slice(0,6).map(_).join(", ")}${C.rest.length>6?", \u2026":""}`;d.push(` ${C.ids.length?"and ":""}${U}${C.ids.length?" more":""}, not pictured (${L}): gallery qa ${i} --blocks ${C.rest.join(",")}`)}}s.unknown.length&&d.push(` no block of ${n.name??"doc.html"} has the id${s.unknown.length===1?"":"s"} ${s.unknown.join(", ")}`)}let $=[];for(let h of E)for(let{pictures:B}of h.said.values())$.push(...B.filter(_=>!$.includes(_)));$.length&&d.push("The elements flagged below, look at these first:",...j($).map(h=>` ${h}`));let Y=z.filter(h=>h.tile),X=Y.filter(h=>!h.sheet&&!h.card);X.length&&d.push(`The page as it opens (each Sheet area with the panel it shows first): ${ft(X.length,"tile")} in ${j([ht.dirname(X[0].file)])[0]}/ (<width>-<n>.png)`);let gt=new Map;for(let{sheet:h}of Y)h&>.set(h.number,{...h,count:(gt.get(h.number)?.count??0)+1});gt.size&&d.push(`Each other Sheet panel, shown in turn: ${ft(Y.filter(h=>h.sheet).length,"tile")} in ${j([ht.dirname(Y.find(h=>h.sheet).file)])[0]}/ (<width>-sheet<i>-<n>.png): ${[...gt.values()].map(({number:h,label:B,count:_})=>`sheet${h} ${Mt(B,24)} ${ft(_,"tile")}`).join(", ")}`);let N=new Map;for(let{card:h}of Y)h&&N.set(h.number,{...h,count:(N.get(h.number)?.count??0)+1});N.size&&d.push(`Each detail card, opened in turn as the window shows it, its content scrolled a tile at a time: ${ft(Y.filter(h=>h.card).length,"tile")} in ${j([ht.dirname(Y.find(h=>h.card).file)])[0]}/ (<width>-card<i>-<n>.png${Y.some(h=>h.card?.part)?"; with another panel of a Sheet in it shown, <width>-card<i>-sheet<j>-<n>.png":""}): ${[...N.values()].map(({number:h,label:B,count:_})=>`card${h} ${Mt(B,24)} ${ft(_,"tile")}`).join(", ")}`);for(let{place:h,name:B,right:_,down:tt}of u.values()){let C=/^(?:doc|report)\.html:\d+/.exec(h)?.[0]??h;d.push(`${"INFO".padEnd(10)} table-scrolls: ${C}${B?` ${Mt(B,32)}`:""}: ${[_.length&&`\u2192 ${Ut(_)}`,tt.length&&`\u2193 ${Ut(tt)}`].filter(Boolean).join("; ")} (${bo})`)}for(let h of E){d.push(`${h.level.toUpperCase().padEnd(10)} ${h.kind}: ${h.place}`);for(let[B,{labels:_,pictures:tt}]of h.said)d.push(` ${Ut(_)}: ${B}${tt.length?` (${j(tt).join(", ")})`:""}`);for(let B of xo(h))d.push(` ${B}`)}d.push(...A.map(({line:h})=>h));let Q=ko(s,i);return Q&&d.push(Q),w.info=x.size,{lines:d,levels:w,looks:A.map(({label:h,fail:B,warn:_})=>({label:h,fail:B,warn:_}))}}function ko(e,n="<slug>"){let{changed:s=[],restyled:l=[],packages:i=[],cards:d=[],since:w="the last look",first:f=!1}=e?.left??{};if(!s.length&&!l.length&&!d.length)return null;let x=A=>`${A.slice(0,6).map(j=>`${e.tags?.get(j)?`${e.tags.get(j)} `:""}${j}`).join(", ")}${A.length>6?", \u2026":""}`;return`Not pictured by this run, which pictures the blocks named alone: ${[s.length&&`${ft(s.length,"block")} changed or moved since ${w} (${x(s)})`,l.length&&`${ft(l.length,"instance")} of a custom block changed since ${w}, ${i.join(", ")} (${x(l)})`,d.length&&(f?`no earlier look: ${ft(d.length,"card")} never pictured (${x(d)})`:`${ft(d.length,"card")} the change of the document's own <script> or <style> since ${w} may draw again (${x(d)})`)].filter(Boolean).join("; ")}. gallery qa ${n} pictures them.`}function vo(e,n,s=[],{unpictured:l=!1}={}){let i=n.map(({label:A,fail:j,warn:K})=>`${po(A)} fail ${j}, warn ${K}`).join("; "),d=i?` (${i})`:"",w=Te(s.length===1?s[0].slug:void 0),f={stale:"its file had changed since its export",missing:"it had none yet"},x=s.filter(({first:A})=>A).map(({slug:A,first:j})=>`${s.length>1?`${A} was`:"It was"} exported first by this run (${f[j]}).`),u=`${x.length?`. ${x.join(" ")}`:""}${s.map(({file:A})=>`
|
|
2
|
+
import{a as fe,b as At}from"./chunk-342HXE3Q.mjs";import{c as ue,d as pe}from"./chunk-EAIFITAV.mjs";import{b as ae}from"./chunk-67N2QJYT.mjs";import{a as ie,b as re,c as le,d as ce,f as Dt,g as de,h as he}from"./chunk-PUOQ65NC.mjs";import{b as _t,c as ee,d as oe,f as ne,h as se}from"./chunk-DJISHPUL.mjs";import{b as Wt,j as Qt}from"./chunk-4OZWXZE5.mjs";import{g as te}from"./chunk-HXG7EOPJ.mjs";import{a as Zt}from"./chunk-HYMEEXKN.mjs";import{a as Vt}from"./chunk-UMHUSOPJ.mjs";import{spawnSync as Le}from"node:child_process";import vt from"node:fs/promises";import ht from"node:path";import{pathToFileURL as Ie}from"node:url";import{MATH_IGNORED_TAGS as Fe}from"../browser/shared/components/math.mjs";import{exportPackagesOf as Pe,exportSourceOf as Ve,packagesSaid as _e}from"../browser/shared/export-wrap.mjs";import{sha256 as ge}from"../browser/shared/files.mjs";import{attr as me}from"../browser/shared/html-tree.mjs";import{projectRoot as De,qaDirectory as He,reportsDirectory as Rt}from"../browser/shared/paths.mjs";import{documentDirectory as Lt,documentFiles as It}from"../browser/shared/workspace.mjs";import{KINDS as Yo,LEVELS as Bt,LOOKS as we,WIDE as Ko,WIDTHS as $e,layoutNotesOf as ze,levelOf as Ee}from"../browser/shared/qa-levels.mjs";import{tableHidesScript as Ue}from"../browser/shared/table-hides.mjs";var Ge=new Set(["code-scrolls","formula-scrolls"]),qe=(e,n)=>e.level??Ee(e.kind,n),Ye=(e,n)=>["fail","warn"].includes(qe(e,n))||Ge.has(e.kind)&&Ee(e.kind,n)==="info",Ke=4,Ae=12,Xe=8,Je=2,xe=200,Qe=2e3,ye=600;function Ze({block:e,above:n=null,below:s=null}){let l=[e,n,s].filter(Boolean),i=Math.min(...l.map(u=>u.left)),d=Math.max(...l.map(u=>u.right)),w=n?Math.max(Math.min(n.top,e.top),e.top-xe):e.top,f=s?Math.min(Math.max(s.bottom,e.bottom),e.bottom+xe):e.bottom,x=(u,A)=>({x:Math.max(0,i),y:Math.max(0,u),width:d-i,height:A-Math.max(0,u)});return e.bottom-e.top<=Qe?[{part:"",clip:x(w,f)}]:[{part:"top",clip:x(w,e.top+ye)},{part:"bottom",clip:x(e.bottom-ye,f)}]}function be(e,n=""){if(e.startsWith("data:"))return`${e.slice(0,30)}\u2026 (${e.length} characters)`;let s=n.slice(0,n.lastIndexOf("/")+1);if(s&&e.startsWith(s)&&e.length>s.length)try{return decodeURIComponent(e.slice(s.length))}catch{return e.slice(s.length)}return e.length>60?`\u2026${e.slice(-59)}`:e}var Ft=e=>String(e??"").replace(/\s+/g," ").trim(),Mt=(e,n=40)=>{let s=Ft(e);return`"${s.length>n?`${s.slice(0,n-1)}\u2026`:s}"`},to=e=>String(e??"").replace(/\s+/g,"").slice(0,120);function eo(e,n="doc.html"){let s=new Map,l=new Map,i=new Map,d=(x,u)=>(u&&x.sourceCodeLocation.attrs?.[u]||x.sourceCodeLocation).startLine,w=new Map,f=x=>{if(x.nodeName==="#text")return x.value;if(!x.tagName&&x.nodeName!=="#document"||x.tagName==="template")return"";let u=(x.childNodes??[]).map(f).join("");if(!x.tagName||!x.sourceCodeLocation)return u;let A=me(x,"data-block-id");A!==void 0&&!s.has(A)&&s.set(A,d(x,"data-block-id"));let j=me(x,"id");j!==void 0&&!l.has(j)&&l.set(j,d(x,"id"));let K=to(u);if(K.length>=2){let m=`${x.tagName}|${K}`;w.has(m)||w.set(m,[]),w.get(m).push(x.sourceCodeLocation)}return u};f(Zt(e));for(let[x,u]of w)i.set(x,u.sort((A,j)=>A.startOffset-j.startOffset).map(A=>A.startLine));return{blocks:s,ids:l,texts:i,name:n}}function oo(e,n){if(!e)return"the page";let s=n.name??"doc.html",l=u=>{let A=u&&n.texts.get(`${u.tag}|${u.words}`);return A?.[Math.min(u.nth??0,A.length-1)]},i=e.table||e.header?.text,d=e.card?` card ${Mt(e.card.text)}`:i?` table ${Mt(i)}`:"",w=e.blocks?.find(u=>n.blocks.has(u));if(w!==void 0)return`${s}:${n.blocks.get(w)} [data-block-id="${w}"]${d}`;if(l(e.card))return`${s}:${l(e.card)} card ${Mt(e.card.text)}`;if(l(e.header))return`${s}:${l(e.header)} table ${Mt(i)}`;let f=e.texts?.find(l);if(f)return`${s}:${l(f)} ${f===e.texts[0]&&f.tag===e.tag?"":`${e.element} in `}<${f.tag}> ${Mt(f.text,32)}`;let x=e.ids?.find(u=>n.ids.has(u));return x!==void 0?`${s}:${n.ids.get(x)} #${x}${d}`:l(e.section)?`${s}:${l(e.section)} ${e.element} in the section ${Mt(e.section.text)}`:`${e.element}${d} (not found in ${s})`}function Yt(e){let n=new Date(e),s=d=>String(d).padStart(2,"0"),l=-n.getTimezoneOffset(),i=`${l<0?"-":"+"}${s(Math.floor(Math.abs(l)/60))}:${s(Math.abs(l)%60)}`;return`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())}T${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}${i}`}function no(e,n,s={said:"",now:""}){return e===n?s.said===s.now?{stale:!1,why:""}:{stale:!0,packaged:!0,why:`it holds ${s.said||"no custom block"}, the workspace has ${s.now||"none of them"}`}:{stale:!0,why:e?`made from a text whose sha256 is ${e.slice(0,12)}\u2026, the file's is ${n.slice(0,12)}\u2026`:"it does not say which text it was made from: made before exports said it, or before the kit's names were doc-* (2026-10-26), whose pages gallery qa no longer reads"}}async function Kt(e,{made:n=!1}={}){let s=It(Lt(e,Rt)).html,l=At(e),[i,d]=await Promise.all([vt.readFile(s).catch(()=>null),vt.stat(l).catch(()=>null)]);if(!i)return{problem:`${e}: no document (${s})`};if(!d)return{problem:`${e}: no export (${l}): run gallery export ${e} first`,missing:!0};let w=await vt.readFile(l),f=w.toString("utf8"),x=Ve(f),u={said:Pe(f),now:_e(te(i.toString("utf8")))},{stale:A,why:j,packaged:K=!1}=no(x,ge(i),u);return A&&!n?{problem:`${e}: ${l} is not of ${s} as it is now (${j}): run gallery export ${e} first`,stale:!0,why:j,edited:!!x&&!K,packaged:K}:{file:l,sha256:ge(w),time:d.mtimeMs}}function so(e,n){let s=e.map((w,f)=>({length:1,weight:n[f],previous:-1})),l=(w,f)=>w.length>f.length||w.length===f.length&&w.weight>f.weight;e.forEach((w,f)=>{for(let x=0;x<f;x++){if(e[x]>=w)continue;let u={length:s[x].length+1,weight:s[x].weight+n[f],previous:x};l(u,s[f])&&(s[f]=u)}});let i=-1;s.forEach((w,f)=>{(i<0||l(w,s[i]))&&(i=f)});let d=[];for(let w=i;w>=0;w=s[w].previous)d.unshift(w);return d}function Be(e,n){let s=n?.places??{},l=new Set((n?.moved??[]).filter(d=>e.has(d))),i=new Map;for(let[d,{parent:w,size:f=0}]of e){let x=s[d];if(x){if(x[0]!==w){l.add(d);continue}i.has(w)||i.set(w,[]),i.get(w).push({id:d,at:x[1],size:f})}}for(let d of i.values()){let w=new Set(so(d.map(({at:f})=>f),d.map(({size:f})=>f)).map(f=>d[f].id));for(let{id:f}of d)w.has(f)||l.add(f)}return l}function ao(e,n,s,{named:l=null,verified:i=!0,failed:d=!1,seen:w=null,page:f=void 0,packages:x=void 0}={}){if(!i||d||l&&!n)return null;let u=w??new Set([...s.ids,...[...s.held?.values()??[]].flat()]),A=!n,j=A||s.pageChanged?s.cards??[]:[],K=[...n?.unseen??[],...j],m={blocks:{},places:{},moved:A?[]:[...Be(e,n)].filter($=>!u.has($)),unseen:[...new Set(K)].filter($=>e.has($)&&!u.has($))};for(let[$,{hash:Y,parent:X,at:gt}]of e){let N=A||u.has($)?Y:n.blocks[$];N!==void 0&&(m.blocks[$]=N),m.places[$]=[X,gt]}let E=!A&&(l||s.tiles)?n.page:f;typeof E=="string"&&(m.page=E);let z=!A&&(l||s.tiles)?n.packages:x&&Object.fromEntries(Object.entries(x).map(([$,Y])=>[$,(s.restyled?.get($)??[]).every(X=>u.has(X))?Y:n.packages[$]]));return z&&Object.keys(z).length&&(m.packages=z),m}function Oe(e){let n=new Map;for(let s of e){let l=new Set(s.held?.covered??[]);for(let i of s.held?.missed??[])l.has(i)||n.set(i,[...n.get(i)??[],s.label??String(s.width)])}return n}function io(e,n){let s=Oe(n);return new Set([...e.ids,...[...e.held?.values()??[]].flat().filter(l=>!s.has(l))])}function Se(e){let n=e.time?` of ${Yt(e.time)}`:"";return e.from==="export"?`the export${n} (the document before these changes)`:e.from==="preview"?`gallery open${n} (the document before these changes)`:"the last look"}var ro=3;function lo(e,n,s=null,{tiles:l=!1,page:i=void 0,packages:d=void 0}={}){let w={rest:[],unknown:[],moved:new Set,around:new Map,held:new Map,groups:[],cards:[],pageChanged:!1,changed:new Set,restyled:new Map,left:null},f=[...e.keys()],x=new Map(f.map((a,M)=>[a,M])),u=n?Be(e,n):new Set,A=a=>typeof n?.packages?.[a]=="string"&&typeof d?.[a]=="string"&&n.packages[a]!==d[a],j=n?f.filter(a=>A(e.get(a).package)&&n.blocks[a]===e.get(a).hash&&!u.has(a)):[],K=new Map;for(let a of j)K.set(e.get(a).package,[...K.get(e.get(a).package)??[],a]);let m=new Set(j),E=n?f.filter(a=>n.blocks[a]!==e.get(a).hash||u.has(a)||m.has(a)):[],z=new Set((n?.unseen??[]).filter(a=>e.has(a)&&!E.includes(a))),$=(a,M)=>{let G=null;for(let et=e.get(a).parent;et!==null&&e.has(et);et=e.get(et).parent)M.has(et)&&(G=et);return G},Y=new Set(E),X=new Set(E.filter(a=>e.get(a).card||u.has(a))),gt=a=>Y.has(a)&&!u.has(a)&&$(a,X)===null,N=new Map;for(let a of f)for(let M=e.get(a).parent;M!==null&&e.has(M);M=e.get(M).parent){let G=N.get(M)??{all:0,changed:0};G.all+=1,gt(a)&&(G.changed+=1),N.set(M,G)}let Q=f.filter(a=>!e.get(a).card&&N.has(a)&&N.get(a).changed>=ro&&N.get(a).changed*2>=N.get(a).all);if(s){let a=[...new Set(s)].filter(o=>e.has(o)),M=new Set(a),G=new Map;for(let o of f){let r=M.has(o)?null:$(o,M);r!==null&&G.set(r,[...G.get(r)??[],o])}let et="the blocks named",$t=new Set([...a,...[...G.values()].flat()]),yt=!!n&&typeof n.page=="string"&&typeof i=="string"&&n.page!==i,xt=new Set([...E.filter(o=>e.get(o).card||u.has(o)),...Q]),bt=!n||yt?f.filter(o=>e.get(o).card&&!E.includes(o)):[],Pt=new Set([...xt,...bt]),Nt=[...E,...Q.filter(o=>!Y.has(o))].sort((o,r)=>x.get(o)-x.get(r)).filter(o=>!$t.has(o)&&$(o,xt)===null),Tt=Nt.filter(o=>m.has(o)),t={changed:Nt.filter(o=>!m.has(o)),...Tt.length?{restyled:Tt,packages:[...new Set(Tt.map(o=>e.get(o).package))]}:{},cards:bt.filter(o=>!$t.has(o)&&$(o,Pt)===null).sort((o,r)=>e.get(o).rank-e.get(r).rank||x.get(o)-x.get(r)),since:n?Se(n):"",first:!n};return{...w,ids:a,why:et,groups:[{kind:"named",why:et,ids:a,rest:[]}],held:G,pageChanged:yt,changed:new Set(E),restyled:K,left:t,unknown:[...new Set(s)].filter(o=>!e.has(o))}}if(e.size===0)return{...w,ids:[],why:"the document has no block ids (never handed in): the whole page in tiles instead",tiles:!0};if(l)return{...w,ids:[],why:null,tiles:!0};let h=(...a)=>(M,G)=>a.reduce((et,$t)=>et||$t(M)-$t(G),0),B=a=>e.get(a).rank,_=a=>x.get(a),tt=n?Se(n):"",C=!!n&&typeof n.page=="string"&&typeof i=="string"&&n.page!==i,v=f.filter(a=>e.get(a).card&&!E.includes(a)),L=!n||C||E.length===0?v:v.filter(a=>z.has(a)),it=new Set([...E.filter(a=>e.get(a).card||u.has(a)),...Q]),dt=new Set([...it,...L]),Z=new Map,at=(a,M)=>a.filter(G=>{let et=$(G,M);return et!==null&&Z.set(et,[...Z.get(et)??[],G]),et===null}),V=[...at(E,it),...Q.filter(a=>!Y.has(a)&&$(a,it)===null)].sort(h(a=>+!u.has(a),B,_)),pt=V.filter(a=>m.has(a)),lt=V.filter(a=>!m.has(a)),st=at(L,dt).sort(h(a=>+!z.has(a),B,_)),ct="the cards (chart cards, code blocks, whole blocks, components, flowcharts and Sheet areas, then columns and the other figures, then tables)",y=st.some(a=>z.has(a))?", those no look has pictured yet first":"",D=typeof n?.page=="string"&&typeof i=="string",F=n?C?`${ct.replace("the cards","the cards, not changed themselves")}${y}: the document's own <script> or <style> changed since ${tt}, which may draw any of them`:E.length?"the cards no look has pictured yet (not changed themselves)":`${ct}${y}: no block changed since ${tt}${D?", nor the document's own <script> or <style>":""}`:`${ct}: no earlier look to compare with`,J=[...lt.length?[{kind:"changed",why:`the blocks changed since ${tt}${u.size?" (a moved block pictured with the edges of the blocks before and after it, the moved ones first)":""}`,all:lt}]:[],...pt.length?[{kind:"changed",why:`the instances of a custom block changed since ${tt} (${[...new Set(pt.map(a=>e.get(a).package))].join(", ")})`,all:pt}]:[],...st.length||!V.length?[{kind:"cards",why:F,all:st}]:[]],R=Ae;for(let a of J)a.ids=a.all.slice(0,R),a.rest=a.all.slice(a.ids.length),R-=a.ids.length,delete a.all;let I=J.flatMap(a=>a.ids),k=a=>{let{parent:M,at:G}=e.get(a),et=$t=>f.find(yt=>e.get(yt).parent===M&&e.get(yt).at===G+$t)??null;return[et(-1),et(1)]},H=new Map(I.filter(a=>u.has(a)).map(a=>[a,k(a)])),c=new Map(I.filter(a=>Z.has(a)).map(a=>[a,Z.get(a)]));return{...w,ids:I,why:J[0].why,groups:J,rest:J.flatMap(a=>a.rest),moved:new Set(I.filter(a=>u.has(a))),around:H,held:c,cards:L,pageChanged:C,changed:new Set(E),restyled:K}}function co(e){let n=m=>!!m.closest("[data-doc-dev]"),s=[...document.querySelectorAll("details")].filter(m=>!n(m)),l=s.filter(m=>!m.open).length;s.forEach(m=>{m.open||m.setAttribute("data-qa-closed",""),m.open=!0});let i=[...document.images].filter(m=>!n(m));i.forEach(m=>{m.loading==="lazy"&&(m.loading="eager")});let d=[...document.querySelectorAll("dialog")].filter(m=>!n(m)&&!m.open);d.forEach((m,E)=>{m.dataset.qaCard=String(E)});let w=m=>m.parentElement?.closest("dialog[data-qa-card]")??null,f=[...document.querySelectorAll("[data-doc-sheets] > .doc-sheet-tabs > [data-sheet-tab]")].filter(m=>!n(m));f.forEach((m,E)=>{m.dataset.qaTab=String(E)});let x=m=>m.parentElement.parentElement,u=m=>{let E=[];for(let z=m.closest("[data-doc-sheet]");z;z=z.parentElement.closest("[data-doc-sheet]")){let $=f.find(Y=>x(Y)===z.parentElement&&Y.getAttribute("data-sheet-tab")===z.getAttribute("data-doc-sheet"));$&&E.unshift(Number($.dataset.qaTab))}return E},A=f.map((m,E)=>{let z=[...u(x(m)),E],$=[...x(m).children].find(X=>X.getAttribute("data-doc-sheet")===m.getAttribute("data-sheet-tab"));$&&($.dataset.qaPanel=String(E));let Y=w(m);return{index:E,chain:z,card:Y?Number(Y.dataset.qaCard):null,label:(m.textContent??"").replace(/\s+/g," ").trim(),shown:z.every(X=>f[X].getAttribute("aria-selected")==="true"),panel:!!$}}),j=d.map((m,E)=>{let z=`[href="#${CSS.escape(m.id)}"]`,$=[...m.querySelectorAll("h1, h2, h3, h4")].find(X=>X.textContent.trim())??document.querySelector(z),Y=[];for(let X=w(m);X;X=w(X))Y.unshift(Number(X.dataset.qaCard));return{index:E,chain:u(m),within:Y,label:($?.textContent||m.id||"").replace(/\s+/g," ").trim()}}),K=Promise.all(i.map(m=>m.decode().catch(()=>{})));return Promise.race([K.then(()=>!0),new Promise(m=>setTimeout(()=>m(!1),e))]).then(m=>({details:s.length,closed:l,images:i.length,loaded:m,sheets:A,cards:j}))}function ke(e){let n=document.querySelector(`[data-qa-card="${e}"]`);return n?(n.open||(globalThis.DocDialogs?globalThis.DocDialogs.open(n,null):typeof n.showModal=="function"?n.showModal():n.setAttribute("open","")),document.activeElement?.blur?.(),Promise.all(n.getAnimations({subtree:!0}).map(s=>s.finished.catch(()=>{}))).then(()=>n.open&&n.getClientRects().length>0)):Promise.resolve(!1)}function Ht(e){let n=document.querySelector(`[data-qa-card="${e}"]`);n?.open&&(globalThis.DocDialogs?globalThis.DocDialogs.close(n):typeof n.close=="function"?n.close():n.removeAttribute("open"))}async function ho({selector:e,up:n=0,margin:s=0,frames:l=2}){let i=document.querySelector(e);for(let v=0;v<n&&i;v++)i=i.parentElement;if(!i||i.getClientRects().length===0)return null;let d=i.getBoundingClientRect();i.scrollIntoView({block:"nearest",inline:"nearest"});let w=i.getBoundingClientRect();if(d.top!==w.top||d.left!==w.left){let v=()=>new Promise(U=>{requestAnimationFrame(()=>U()),setTimeout(U,100)});for(let U=0;U<l;U++)await v()}let f=v=>v===document.body||v===document.documentElement,x=(v,U,L)=>{let{left:it,top:dt,right:Z,bottom:at}=v;for(let V=U;V&&!f(V);V=V.parentElement){let pt=getComputedStyle(V),lt=pt.overflowX!=="visible",st=pt.overflowY!=="visible";if(lt||st){let ct=V.getBoundingClientRect();lt&&([it,Z]=[Math.max(it,ct.left),Math.min(Z,ct.right)]),st&&([dt,at]=[Math.max(dt,ct.top),Math.min(at,ct.bottom)])}if(V===L)break}return Z>it&&at>dt?{left:it,top:dt,right:Z,bottom:at}:null},u=v=>parseFloat(v)||0,A=(v,U)=>{let L=getComputedStyle(v,U);if(["none","normal"].includes(L.content)||L.display==="none"||!["absolute","fixed"].includes(L.position))return null;let it=L.position==="fixed"?null:getComputedStyle(v).position!=="static"?v:v.offsetParent,dt=it?it.getBoundingClientRect():{left:0,top:0,right:innerWidth,bottom:innerHeight},Z=it?getComputedStyle(it):null,at={left:dt.left+u(Z?.borderLeftWidth),top:dt.top+u(Z?.borderTopWidth),right:dt.right-u(Z?.borderRightWidth),bottom:dt.bottom-u(Z?.borderBottomWidth)},V=(y,D)=>L.boxSizing==="border-box"?0:u(L[`padding${y}`])+u(L[`padding${D}`])+u(L[`border${y}Width`])+u(L[`border${D}Width`]),pt=u(L.width)+V("Left","Right"),lt=u(L.height)+V("Top","Bottom"),st=L.left!=="auto"?at.left+u(L.left)+u(L.marginLeft):L.right!=="auto"?at.right-u(L.right)-u(L.marginRight)-pt:null,ct=L.top!=="auto"?at.top+u(L.top)+u(L.marginTop):L.bottom!=="auto"?at.bottom-u(L.bottom)-u(L.marginBottom)-lt:null;return st===null||ct===null||!(pt>0)||!(lt>0)?null:x({left:st,top:ct,right:st+pt,bottom:ct+lt},v,i)},j=[i.getBoundingClientRect()],K=[i];for(let v of i.querySelectorAll("*"))v instanceof SVGElement&&v.ownerSVGElement||v.matches("script, style, template")||v.getClientRects().length===0||getComputedStyle(v).visibility!=="hidden"&&(K.push(v),j.push(x(v.getBoundingClientRect(),v.parentElement,i)));for(let v of K)j.push(A(v,"::before"),A(v,"::after"));let m=document.createRange(),E=document.createTreeWalker(i,NodeFilter.SHOW_TEXT);for(let v=E.nextNode();v;v=E.nextNode())if(!(!v.nodeValue.trim()||!v.parentElement||v.parentElement.closest("svg, script, style, template"))){m.selectNodeContents(v);for(let U of m.getClientRects())j.push(x(U,v.parentElement,i))}m.detach();let z=j.filter(Boolean),$={left:Math.min(...z.map(v=>v.left)),top:Math.min(...z.map(v=>v.top)),right:Math.max(...z.map(v=>v.right)),bottom:Math.max(...z.map(v=>v.bottom))},Y=x($,i.parentElement,null)??$,X=!1;for(let v=i;v&&!X;v=v.parentElement)X=getComputedStyle(v).position==="fixed";let gt=visualViewport.pageLeft,N=visualViewport.pageTop,[Q,h]=X?[gt+innerWidth,N+innerHeight]:[document.documentElement.scrollWidth,document.documentElement.scrollHeight],B=Math.max(X?gt:0,Y.left+gt-s),_=Math.max(X?N:0,Y.top+N-s),tt=Math.min(Q,Y.right+gt+s),C=Math.min(h,Y.bottom+N+s);return tt>B&&C>_?{clip:{x:B,y:_,width:tt-B,height:C-_},fixed:X}:null}function ve(e){for(let s of e){let l=document.querySelector(`[data-qa-tab="${s}"]`);l&&l.getAttribute("aria-selected")!=="true"&&l.click()}let n=document.querySelector(`[data-qa-panel="${e.at(-1)}"]`);return!!(n&&!n.hidden&&n.getClientRects().length>0)}function zt({scope:e,next:n,ignored:s=[],place:l,slack:i=4,whole:d=[],drawn:w=[]}){let f=e?document.querySelector(e):document.body,x=[];if(!f)return{found:x,next:n};let u=document.documentElement.clientWidth,A=Math.round,j=t=>String(t??"").replace(/\s+/g," ").trim(),K=(t,o=32)=>{let r=j(t);return`"${r.length>o?`${r.slice(0,o-1)}\u2026`:r}"`},m=t=>!!t.closest?.("[data-doc-dev]"),E=t=>{if(!t.isConnected||t.getClientRects().length===0)return!1;for(let o=t;o&&o.nodeType===1;o=o.parentElement){let r=getComputedStyle(o);if(r.visibility==="hidden"||r.display==="none"||Number(r.opacity)===0||o.matches(".katex-mathml, .sr-only, [role=tooltip], [data-doc-dev]"))return!1}return!0},z=t=>`${t.localName}${[...t.classList].filter(o=>!o.startsWith("is-")).slice(0,2).map(o=>`.${o}`).join("")}`,$=t=>(t.textContent??"").replace(/\s+/g,"").slice(0,120),Y=new Map,X=t=>{let o=$(t);if(!Y.has(t.localName)){let b=new Map;for(let O of document.getElementsByTagName(t.localName)){if(m(O))continue;let W=$(O);b.has(W)||b.set(W,[]),b.get(W).push(O)}Y.set(t.localName,b)}let r=Y.get(t.localName).get(o)?.indexOf(t)??0;return{tag:t.localName,words:o,nth:Math.max(0,r),text:j(t.textContent).slice(0,80)}},gt=t=>{let o=t.cloneNode(!0);for(let r of o.querySelectorAll(".doc-tab"))r.before(" \xB7 ");return j(o.textContent).replace(/^· /,"")},N=t=>{let o=t.matches("table")?t:t.querySelector("table"),r=t.closest(".doc-table-wrap")??t,b=r.getAttribute("data-doc-chart-source")?.trim(),W=(b?[...document.querySelectorAll("[data-doc-chart-data]")].find(S=>S.getAttribute("data-doc-chart-data").trim()===b&&!m(S)):null)?.closest("figure")?.querySelector(":scope > h2, :scope > h3, :scope > h4, :scope > figcaption"),p=r.previousElementSibling;return j(o?.caption?.textContent)||j(W?.textContent)||(p?.matches("p.doc-note")?gt(p):"")||j(o?.querySelector("th")?.textContent??o?.rows[0]?.cells[0]?.textContent)},Q=t=>{let o=t.nodeType===1?t:t.parentElement,r=[],b=[];for(let g=o;g&&g!==document.documentElement;g=g.parentElement)g.hasAttribute("data-block-id")&&r.push(g.getAttribute("data-block-id")),g.id&&!g.hasAttribute("data-qa-tab")&&!g.hasAttribute("data-qa-panel")&&b.push(g.id);let O=[];for(let g=o,T=0;g&&T<4&&!g.matches("body, main, section, [data-doc-sheet], [data-doc-sheets], .doc-columns, .doc-column");g=g.parentElement,T++){let ot=X(g);ot.words.length>=2&&O.push(ot)}let W=o.closest("figure")?.querySelector(":scope > h3, :scope > figcaption, :scope > .doc-figure-caption"),p=o.closest(".doc-table-wrap, table"),S=p?.querySelector("th"),q=o.closest("section")?.querySelector(":scope > h2, :scope > h3, :scope > h4");return{blocks:r,ids:b,texts:O,tag:o.localName,element:z(o),card:W?X(W):null,header:S?X(S):null,table:p?N(p).slice(0,80):null,section:q?X(q):null}};if(l){let t=document.querySelector(l);return{found:x,next:n,anchor:t?Q(t):null}}let h=t=>(t.dataset.qaShot||(t.dataset.qaShot=String(++n)),Number(t.dataset.qaShot)),B=(t,o,r,{picture:b=o,url:O,measured:W,scroll:p,level:S}={})=>x.push({kind:t,what:r,anchor:o?Q(o):null,shot:b?h(b):null,seen:!!(b&&E(b)),url:O,measured:W,scroll:p,...S?{level:S}:{}}),_=t=>t.closest("figure")??t.closest("[data-doc-chart]")??t,tt=t=>{let o=t.getBoundingClientRect();return o.width>0&&o.height>0},C=(t,o,{x:r=!0,y:b=!0}={})=>Math.max(r?o.left-t.left:-1/0,r?t.right-o.right:-1/0,b?o.top-t.top:-1/0,b?t.bottom-o.bottom:-1/0),v=t=>({left:Math.min(...t.map(o=>o.x)),right:Math.max(...t.map(o=>o.x)),top:Math.min(...t.map(o=>o.y)),bottom:Math.max(...t.map(o=>o.y))}),U=t=>{let o=t.getBBox(),r=t.getScreenCTM();return v([[o.x,o.y],[o.x+o.width,o.y],[o.x+o.width,o.y+o.height],[o.x,o.y+o.height]].map(([b,O])=>new DOMPoint(b,O).matrixTransform(r)))},L=t=>{let o=[];for(let r=t.parentElement;r&&r!==document.documentElement;r=r.parentElement){let b=getComputedStyle(r);r instanceof SVGSVGElement&&b.overflow!=="visible"&&o.push(["the svg's edge",r.getBoundingClientRect(),{}]);let O=/url\(\s*["']?#([^)"']+)/.exec(`${r.getAttribute?.("clip-path")??""} ${b.clipPath??""}`)?.[1],W=O?document.getElementById(O):null,p=W?.getAttribute("clipPathUnits")!=="objectBoundingBox"?W?.querySelector("rect"):null;if(p&&r.getScreenCTM){let[S,q,g,T]=["x","y","width","height"].map(ot=>p[ot].baseVal.value);o.push(["a clip-path",v([[S,q],[S+g,q+T]].map(([ot,rt])=>new DOMPoint(ot,rt).matrixTransform(r.getScreenCTM()))),{}])}if(!(r instanceof SVGElement)){let S=/hidden|clip/.test(b.overflowX),q=/hidden|clip/.test(b.overflowY);(S||q)&&o.push([z(r),r.getBoundingClientRect(),{x:S,y:q}])}}return o},it=t=>`${t.slice(0,4).join("; ")}${t.length>4?`; ${t.length-4} more`:""}`,dt=t=>!t.matches("script, [data-doc-dev]")&&(t.matches("svg, canvas")||t.querySelector("svg, canvas")||E(t)&&tt(t));for(let t of f.querySelectorAll("[data-doc-chart]"))m(t)||!E(t)||[...t.children].some(dt)||B("chart-empty",t,`the ${t.getAttribute("data-doc-chart")||"chart"} chart drew nothing`,{picture:_(t)});let Z=[...f.querySelectorAll("svg")].filter(t=>{if(t.parentElement.closest("svg")||m(t)||t.closest(".katex, .doc-icon, button")||!E(t))return!1;let o=t.getBoundingClientRect();return t.closest("[data-doc-chart], figure")||o.width>=120&&o.height>=60}),at={across:.6,down:.25},V=new Map;for(let t of Z){let o=_(t),r=o.getBoundingClientRect(),b=[],O=[],W=[...t.querySelectorAll("text")].filter(q=>!q.closest("defs, clipPath, mask, pattern, marker, symbol")&&j(q.textContent)&&E(q));for(let q of W){let g=U(q),T=L(q).map(([ot,rt,ut])=>[ot,C(g,rt,ut)]).find(([,ot])=>ot>1.5);T?b.push(`${K(q.textContent,24)} ${A(T[1])}px past ${T[0]}`):C(g,r)>1.5&&O.push(`${K(q.textContent,24)} ${A(C(g,r))}px past the card's edge`)}b.length&&B("chart-text-clipped",t,it(b),{picture:o}),O.length&&B("chart-text-outside",t,it(O),{picture:o});let p=q=>{let g=/^(-?)[$¥€£]?(\d[\d,]*(?:\.\d+)?)\s*(?:%|‰|[kKMBG]|万|亿)?$/.exec(q.replace(/[−–]/g,"-"));return g?+`${g[1]}${g[2].replace(/,/g,"")}`:NaN},S=q=>q.every(Number.isFinite)&&q[1]!==q[0]&&q.slice(2).every((g,T)=>Math.abs(g-q[T+1]-(q[1]-q[0]))<=1e-9*Math.max(1,Math.abs(g)));for(let q of t.querySelectorAll("g")){let g=[...q.children].filter(P=>P.matches("g.tick")&&E(P)),T=g.map(P=>P.querySelector("text")).filter(P=>P&&j(P.textContent)&&E(P)),ot=T.map(P=>j(P.textContent));if(ot.length<2||ot.length!==g.length||!S(ot.map(p)))continue;let rt=T.map(P=>{let kt=P.getScreenCTM(),je=(parseFloat(getComputedStyle(P).fontSize)||0)*(kt?Math.hypot(kt.c,kt.d):1);return{label:P,box:U(P),size:je,turned:!!kt&&Math.abs(kt.b)>.001*Math.abs(kt.a)}});if(rt.some(P=>P.turned||!(P.size>0)))continue;let ut=rt.map(({box:P})=>[(P.left+P.right)/2,(P.top+P.bottom)/2]),nt=Math.max(...ut.map(([P])=>P))-Math.min(...ut.map(([P])=>P))>=Math.max(...ut.map(([,P])=>P))-Math.min(...ut.map(([,P])=>P)),mt=({box:P,size:kt})=>nt?[P.left,P.right]:[(P.top+P.bottom-kt)/2,(P.top+P.bottom+kt)/2],St=[...rt].sort((P,kt)=>mt(P)[0]-mt(kt)[0]),wt=null;for(let P=1;P<St.length;P++){let kt=mt(St[P])[0]-mt(St[P-1])[1];(!wt||kt<wt.gap)&&(wt={gap:kt,pair:[St[P-1],St[P]]})}let Ct=Math.max(...rt.map(P=>P.size));if(!wt||wt.gap>=at[nt?"across":"down"]*Ct)continue;for(let{label:P}of rt)V.set(P,q);let[Ot,qt]=wt.pair.map(({label:P})=>K(P.textContent,16)),We=wt.gap<0?`${Ot} and ${qt} overlapping by ${A(-wt.gap)}px`:`${Ot} and ${qt} ${A(wt.gap)}px apart`;B("ticks",t,`${ot.length} tick labels ${nt?"across":"down"} a ${A(nt?t.getBoundingClientRect().width:t.getBoundingClientRect().height)}px chart crowd: ${We}, under ${nt?"a digit's width and a hair":"a quarter of a line"} at their ${A(Ct)}px (${ot.slice(0,6).join(", ")}${ot.length>6?", \u2026":""})`,{picture:o})}}let pt=t=>{let o=t.getBBox(),r=t instanceof SVGTextElement&&parseFloat(getComputedStyle(t).fontSize)||o.height,b=o.y+Math.max(0,(o.height-r)/2),O=b+Math.min(o.height,r),W=t.getScreenCTM();return[[o.x,b],[o.x+o.width,b],[o.x+o.width,O],[o.x,O]].map(([p,S])=>new DOMPoint(p,S).matrixTransform(W))},lt=(t,o)=>{let r=1/0;for(let b of[t,o])for(let O=0;O<b.length;O++){let W=b[O],p=b[(O+1)%b.length],S=Math.hypot(p.x-W.x,p.y-W.y);if(S===0)continue;let q={x:-(p.y-W.y)/S,y:(p.x-W.x)/S},g=ut=>ut.map(nt=>nt.x*q.x+nt.y*q.y),[T,ot]=[g(t),g(o)],rt=Math.min(Math.max(...T),Math.max(...ot))-Math.max(Math.min(...T),Math.min(...ot));if(rt<=0)return 0;r=Math.min(r,rt)}return r===1/0?0:r},st=t=>[...t.querySelectorAll("text")].filter(o=>!o.closest("defs, clipPath, mask, pattern, marker, symbol")&&j(o.textContent)&&E(o));for(let t of Z){let o=st(t).map(b=>({label:b,outline:pt(b)})),r=[];o.forEach(({label:b,outline:O},W)=>{for(let p of o.slice(W+1))V.has(b)&&V.get(b)===V.get(p.label)||lt(O,p.outline)>1.5&&r.push(`${K(b.textContent,20)} and ${K(p.label.textContent,20)} overlap`)}),r.length&&B("chart-text-overlap",t,it(r),{picture:_(t)})}let ct=11;for(let t of Z){if(!t.hasAttribute("viewBox"))continue;let o=[];for(let O of st(t)){let W=O.getScreenCTM(),p=parseFloat(getComputedStyle(O).fontSize);if(!W||!(p>0))continue;let S=p*Math.hypot(W.c,W.d);S<ct-.05&&o.push(`${K(O.textContent,24)} at ${S.toFixed(1)}px (font-size ${+p.toFixed(2)})`)}if(!o.length)continue;let r=t.viewBox.baseVal,b=`${o.length} text${o.length>1?"s":""}`;B("svg-text-small",t,`${b} of a drawing scaled by its viewBox (${+r.width.toFixed(2)}\xD7${+r.height.toFixed(2)} drawn ${A(t.getBoundingClientRect().width)}px wide) render below ${ct}px: ${it(o)}`,{picture:_(t)})}let y=new Set;for(let t of f.querySelectorAll(".doc-table-wrap")){if(m(t)||!E(t))continue;y.add(t);let o=t.querySelector("table");if(!o)continue;let r=Math.max(t.clientWidth,o.offsetWidth),b=Math.max(t.clientHeight,o.offsetHeight),O=r>t.clientWidth+i,W=b>t.clientHeight+i,p=N(t);(O||W)&&B("table-scrolls",t,[O&&`${r}px wide in a ${t.clientWidth}px frame`,W&&`${b}px tall in a ${t.clientHeight}px frame`].filter(Boolean).join(", "),{scroll:{sideways:O,down:W,name:p}});let S=globalThis.__qaTableHides(t,o);S.said&&B("table-columns",t,`${S.said}: the table is ${r}px wide in a ${t.clientWidth}px frame`),S.shown<S.rows&&!t.style.getPropertyValue("--doc-table-height")&&B("table-rows",t,`the frame shows ${S.shown} of ${S.rows} rows: a reader scrolls inside it for the other ${S.rows-S.shown}; style="--doc-table-height: none" on its div.doc-table-wrap shows every row (or split the table where its content divides)`)}let D=t=>!!t.closest("details[data-qa-closed]"),F="in a disclosure closed in the file: a reader who opens it scrolls";for(let t of f.querySelectorAll(".doc-code, .doc-diff")){if(m(t)||!E(t))continue;let o=t.querySelector(":scope > pre, :scope > .doc-diff-body");if(o&&E(o)){let b=D(t);if(o.scrollHeight>o.clientHeight+i){let O=[t,o].map(q=>q.style.getPropertyValue("--doc-code-height").trim()).find(Boolean),W=o.getBoundingClientRect().top+o.clientTop+o.clientHeight,p=[...o.querySelectorAll(".doc-code-line")].filter(q=>q.getClientRects().length>0&&q.getBoundingClientRect().top>=W-1).length,S=b?`, ${F} inside it for the rest`:O?`, the block's own height (--doc-code-height: ${O}, the author's or the reader's): a reader scrolls inside it for the rest`:": a reader scrolls inside it for the rest";B("code-scrolls",t,`the code is ${o.scrollHeight}px tall, its frame ${o.clientHeight}px${p?` (its last ${p} line${p===1?"":"s"} below it)`:""}${S}`,{level:b||O?"info":void 0})}if(o.scrollWidth>o.clientWidth+i){let O=t.classList.contains("doc-code--nowrap"),W=b?`, ${F} sideways for the rest`:O?", its lines left unwrapped (doc-code--nowrap, the author's or the reader's choice): a reader scrolls sideways for the rest of its long lines":": a reader scrolls sideways for the rest";B("code-scrolls",t,`the code is ${o.scrollWidth}px wide, its frame ${o.clientWidth}px${W}`,{level:b||O?"info":void 0})}}let r=t.querySelector(":scope > .doc-code-title");r&&E(r)&&r.scrollWidth>r.clientWidth+1&&B("code-title-cut",t,`its title ${K(r.textContent,48)} is cut to fit its header (${r.scrollWidth}px of words in ${r.clientWidth}px)`)}for(let t of f.querySelectorAll(".doc-math-block")){if(m(t)||!E(t)||t.scrollWidth<=t.clientWidth+i)continue;let o=D(t);B("formula-scrolls",t,`the formula is ${t.scrollWidth}px wide, its frame ${t.clientWidth}px${o?`, ${F} it sideways for the rest`:": a reader scrolls it sideways for the rest"}`,{level:o?"info":void 0})}for(let t of f.querySelectorAll("[data-doc-layout]"))m(t)||!E(t)||B("layout",t,t.getAttribute("data-doc-layout"),{picture:t.closest("figure, .doc-table-wrap")??t,measured:y.has(t)});let J=document.createTreeWalker(f,NodeFilter.SHOW_TEXT),R=new Map;for(let t=J.nextNode();t;t=J.nextNode()){if(!/\\\(|\\\[|\$\$/.test(t.nodeValue))continue;let o=t.parentElement;if(!o||o.closest([...s,".katex","[data-doc-dev]"].join(", "))||!E(o))continue;let r=o.closest("p, li, h1, h2, h3, h4, td, th, figcaption, summary, blockquote, dd, dt")??o;R.has(r)||R.set(r,t.nodeValue)}for(let[t,o]of R){let r=o.search(/\\\(|\\\[|\$\$/);B("raw-formula",t,`${K(o.slice(r,r+40),40)} is shown as written: the kit's math did not render it`)}for(let t of f.querySelectorAll(".katex-error"))m(t)||!E(t)||B("formula-error",t,`${K(t.textContent,32)}: ${j(t.getAttribute("title"))||"KaTeX could not read it"}`);let I=t=>`"${globalThis.__qaUrlName?.(t,document.baseURI)??t}"`,k=t=>{try{return new URL(t,document.baseURI).href}catch{return t}},H=t=>[...["src","href","poster","data"].filter(o=>t.hasAttribute(o)&&!(o==="href"&&t.matches("a, area"))).map(o=>t.getAttribute(o)),...(t.getAttribute("srcset")??"").split(",").map(o=>o.trim().split(/\s+/)[0]),...[t.getAttribute("style"),t.localName==="style"?t.textContent:""].flatMap(o=>[...String(o??"").matchAll(/url\(\s*["']?([^"')]+)/g)].map(r=>r[1]))].filter(o=>o&&!o.trim().startsWith("#")).map(k),c=[...document.querySelectorAll("*")].filter(t=>!m(t)).flatMap(t=>H(t).map(o=>({node:t,address:o}))),a=new Set;for(let{url:t,directive:o}of globalThis.__qaViolations??[]){let r=/^[a-z][a-z\d+.-]*$/i.test(t)?`${t.toLowerCase()}:`:null,b=c.find(W=>r?!a.has(W)&&W.address.startsWith(r):W.address===t);b&&r&&a.add(b);let O=b?.node??null;e&&!(O&&f.contains(O))||B("blocked",O,`${o} blocked ${I(b?.address??t)}${O?` (${z(O)})`:""}: the export holds every file it shows`,{url:b?.address??t})}for(let t of f.querySelectorAll("img")){if(m(t)||t.complete&&t.naturalWidth>0)continue;let o=t.currentSrc||t.src?k(t.currentSrc||t.src):"";B("image",t,`${o?I(o):"a picture with no src"} did not load`,{picture:t.closest("figure")??t,url:o})}let M=new Set(d),G=new Set(w),et=document.createRange(),$t="button, select, input, textarea, [data-doc-dev]",yt=(t,o)=>t!==o&&(t.matches($t)||[...t.classList].some(r=>r.startsWith("doc-"))),xt=(t,o,r)=>{let b=[],O=!1;for(let W=t,p=!0;W&&W!==document.body&&W!==document.documentElement;W=W.parentElement,p=!1){let S=getComputedStyle(W);if((!p||r)&&(O&&(S.position!=="static"||S.transform!=="none")&&(O=!1),!O)){if(/auto|scroll/.test(S.overflowY))break;/hidden|clip/.test(S.overflowY)&&!yt(W,o)&&b.push(W)}if(S.position==="fixed")break;S.position==="absolute"&&(O=!0)}return b},bt=t=>t.getBoundingClientRect().bottom-(parseFloat(getComputedStyle(t).borderBottomWidth)||0),Pt=t=>{let o=getComputedStyle(t),r=b=>!/^(transparent|rgba\(.*,\s*0\))$/.test(b);return r(o.backgroundColor)||o.backgroundImage!=="none"||["Top","Right","Bottom","Left"].some(b=>parseFloat(o[`border${b}Width`])>0&&o[`border${b}Style`]!=="none"&&r(o[`border${b}Color`]))},Nt="rect, circle, ellipse, line, polyline, polygon, path, use",Tt=(t,o)=>{let r=new Map,b=(p,S,q,g)=>{if(!r.has(p)&&r.size>=3)return;let T=r.get(p)??{words:[],marks:[],depth:0,height:p.getBoundingClientRect().height};q&&T.words.push(q),g&&T.marks.push(g),T.depth=Math.max(T.depth,S),r.set(p,T)},O=p=>p.getBoundingClientRect().height>1.5,W=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let p=W.nextNode();p;p=W.nextNode()){let S=p.parentElement;if(!p.nodeValue.trim()||!S||S.closest("svg, script, style, template, .katex")||!E(S)||o(S))continue;let q=xt(S,t,!0).filter(O);if(q.length===0)continue;let g=getComputedStyle(S),T=parseFloat(g.lineHeight);for(let ot of p.nodeValue.matchAll(/\S+/g)){let rt=ot.index+ot[0].length;et.setStart(p,ot.index),et.setEnd(p,rt);let ut=[...et.getClientRects()];for(let nt of ut){let mt=Number.isFinite(T)?Math.max(0,(nt.height-T)/2):0,St=q.find(Ct=>nt.bottom-bt(Ct)>1.5+mt);if(!St)continue;let wt=ot.index;if(ut.length>1){let Ct=bt(St)+1.5+mt;for(let Ot=rt-1;wt<Ot;){let qt=wt+Ot>>1;et.setStart(p,qt),et.setEnd(p,qt+1),(et.getClientRects()[0]?.bottom??0)>Ct?Ot=qt:wt=qt+1}}b(St,Math.max(...ut.map(Ct=>Ct.bottom))-bt(St),p.nodeValue.slice(wt,rt),null);break}}}for(let p of t.querySelectorAll("*")){let S=p instanceof SVGElement&&p.matches(Nt)&&!p.closest("defs, clipPath, mask, pattern, marker, symbol"),q=!S&&!(p instanceof SVGElement)&&!p.matches("img, picture, video, canvas, iframe, object, embed, script, style, template")&&p.children.length===0&&!p.textContent.trim()&&Pt(p);if(!S&&!q||!E(p))continue;let g=p.getBoundingClientRect();if(g.width<=0&&g.height<=0)continue;let T=S?p.ownerSVGElement:null,ot=[...T&&getComputedStyle(T).overflowY!=="visible"?[T]:[],...xt(T??p,t,!!T)].filter(O),rt=nt=>{let mt=nt.getBoundingClientRect();return g.left>=mt.left-1.5&&g.right<=mt.right+1.5&&g.top>=mt.top-1.5},ut=ot.find(nt=>g.bottom-bt(nt)>1.5&&rt(nt));ut&&b(ut,g.bottom-bt(ut),null,S?p.localName:z(p))}return r};for(let t of f.querySelectorAll("[data-block-id]")){let o=t.getAttribute("data-block-id"),r=G.has(o);if(!r&&!M.has(o)||m(t)||!E(t))continue;let b=p=>p.closest(".doc-chart-message")||p.closest("h2, h3, h4, p, figcaption")?.parentElement===t,O=new Map,W=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let p=W.nextNode();p&&O.size<3;p=W.nextNode()){let S=p.parentElement;if(!p.nodeValue.trim()||!S||S.closest("svg, script, style, template, .katex")||!E(S)||r&&b(S))continue;let q=S;for(;q!==t&&["inline","contents"].includes(getComputedStyle(q).display);)q=q.parentElement;let g=!1;for(let nt=S;nt&&!g;nt=nt===t?null:nt.parentElement){let mt=getComputedStyle(nt);g=mt.overflowX!=="visible"||mt.overflowY!=="visible"}if(g)continue;let T=getComputedStyle(q),ot=q.getBoundingClientRect(),rt=ot.left+parseFloat(T.borderLeftWidth)+parseFloat(T.paddingLeft),ut=ot.right-parseFloat(T.borderRightWidth)-parseFloat(T.paddingRight);for(let nt of p.nodeValue.matchAll(/\S+/g)){et.setStart(p,nt.index),et.setEnd(p,nt.index+nt[0].length);let mt=[...et.getClientRects()],St=Math.max(0,...mt.flatMap(Ct=>[Ct.right-ut,rt-Ct.left]));if(St<=1.5||mt.some(Ct=>Ct.right>u+1))continue;let wt=O.get(q)??{words:[],reach:0,width:ut-rt};wt.words.push(nt[0]),wt.reach=Math.max(wt.reach,St),O.set(q,wt)}}for(let[p,{words:S,reach:q,width:g}]of O)B("overflow-in-block",p,`the words ${K(S.join(" "),40)} run ${A(q)}px past the side of ${z(p)} (${A(g)}px wide for its words), over what is beside it`,{picture:t});for(let[p,{words:S,marks:q,depth:g,height:T}]of Tt(t,r?b:()=>!1)){let ot=[S.length&&`the words ${K(S.join(" "),40)}`,q.length&&`${q.length===1?"a mark":`${q.length} marks`} (${[...new Set(q)].slice(0,3).join(", ")})`].filter(Boolean).join(" and "),rt=S.length===0&&q.length===1;B("cut-in-block",p,`${ot} ${rt?"reaches":"reach"} ${A(g)}px past the bottom of ${z(p)} (${A(T)}px tall, its overflow ${getComputedStyle(p).overflowY}), cut off there`,{picture:t})}}if(et.detach(),document.documentElement.scrollWidth>u+1){let t=g=>{for(let T=g.parentElement;T&&T!==document.body;T=T.parentElement)if(getComputedStyle(T).overflowX!=="visible")return!1;return g.nodeType!==1||getComputedStyle(g).position!=="fixed"},o=[...f.querySelectorAll("*")].filter(g=>!(g instanceof SVGElement&&g.ownerSVGElement)&&!m(g)&&g.getBoundingClientRect().right>u+1&&E(g)&&t(g)),r=o.filter(g=>!o.includes(g.parentElement)).slice(0,3),b=`the page is ${document.documentElement.scrollWidth}px wide in a ${u}px window`,O=new Set(o),W=g=>{for(let T=g.parentElement;T;T=T.parentElement)if(O.has(T))return!0;return!1},p=new Map,S=document.createRange(),q=document.createTreeWalker(f,NodeFilter.SHOW_TEXT);for(let g=q.nextNode();g&&p.size<3;g=q.nextNode()){let T=g.parentElement;if(!T||!g.nodeValue.trim()||T.closest("svg, script, style, template")||m(T)||W(g)||!E(T)||!t(g)||(S.selectNodeContents(g),![...S.getClientRects()].some(nt=>nt.right>u+1)))continue;let ot=T.closest("[data-block-id]")??T;if(p.has(ot))continue;let rt=[],ut=0;for(let nt of g.nodeValue.matchAll(/\S+/g)){S.setStart(g,nt.index),S.setEnd(g,nt.index+nt[0].length);let mt=Math.max(...[...S.getClientRects()].map(St=>St.right),0);mt<=u+1||(rt.push(nt[0]),ut=Math.max(ut,mt))}rt.length&&p.set(ot,{node:T,words:rt.join(" "),right:ut})}S.detach(),r.length===0&&p.size===0&&!e&&B("overflow",null,b);for(let g of r)B("overflow",g,`${b}: ${z(g)} ${K(g.textContent,24)} reaches ${A(g.getBoundingClientRect().right)}px`);for(let[g,{node:T,words:ot,right:rt}]of p)B("overflow",T,`${b}: the words ${K(ot,60)} in ${z(g)} run past its edge to ${A(rt)}px (a text that cannot break)`,{picture:g})}return{found:x,next:n}}function fo(){let e=s=>!!s.closest("[data-doc-dev]"),n=s=>[...document.querySelectorAll(s)].filter(l=>!e(l)).length;return{charts:n("[data-doc-chart], [data-doc-component='gallery/chart-view']"),tables:n(".doc-table-wrap"),height:document.documentElement.scrollHeight}}var Et=2e4,Me=1800;function jt(e,n,s){let l=0,i=new Promise((d,w)=>{l=setTimeout(()=>w(new Error(`${s}: no answer in ${n/1e3}s`)),n)});return Promise.race([e,i]).finally(()=>clearTimeout(l))}var Xt=e=>`${e.kind}|${JSON.stringify(e.anchor)}|${e.what}`;async function uo(e,n,s,{out:l,tiles:i=!1,blocks:d=[],around:w=new Map,held:f=new Map,whole:x=[],drawn:u=[],known:A=null}){let{width:j,height:K=900,label:m=String(j)}=typeof s=="number"?{width:s}:s,E=m.replace("\xD7","x"),z,$;try{z=await jt(e.createBrowserContext(),Et,"a browser context opened"),$=await jt(z.newPage(),Et,"a tab opened")}catch(y){return await Dt(z?.close()),{findings:[{kind:"unverified",what:`the browser did not open a page: ${y.message}`,anchor:null,shot:null,seen:!1,state:""}],counts:null,pictures:[],held:{covered:[],missed:[]}}}$.setDefaultTimeout(Et);let Y=[],X=[],gt=new Set,N=new Map,Q=new Set,h=new Set,B=new Set,_="",tt=0,C=(y,D,F={})=>Y.push({kind:y,what:D,anchor:null,shot:null,seen:!1,state:_,...F}),v=Ie(n).href,U=y=>`"${be(y,v)}"`,L=y=>l.folders?.get(y)??l.blocks,it=y=>y.replace(/[^\w-]/g,"_");$.on("pageerror",y=>C("error",`uncaught ${Ft(y.message).slice(0,200)}`)),$.on("console",y=>{y.type()==="error"&&le(y,v)&&C("error",`console: ${Ft(y.text()).slice(0,200)}`)}),$.on("requestfailed",y=>{y.frame()===$.mainFrame()&&C("request",`${U(y.url())}: ${y.failure()?.errorText??"failed"}`,{url:y.url()})}),$.on("response",y=>{y.status()>=400&&y.request().frame()===$.mainFrame()&&C("request",`${U(y.url())}: HTTP ${y.status()}`,{url:y.url()})}),await ce($),await $.evaluateOnNewDocument(`globalThis.__qaUrlName = ${be}; globalThis.__qaTableHides = ${Ue()};`),await $.setViewport({width:j,height:K}),await $.emulateMediaFeatures([{name:"prefers-color-scheme",value:"light"}]);let dt=async y=>{for(let D of await he($,{timeout:Et}))C("unverified",`${y}: waited for ${D}`)},Z=async(y,D,F,J)=>jt($.screenshot({path:F,clip:y,captureBeyondViewport:!D}),Et,"the picture").then(()=>!0,R=>(C("unverified",`no picture of ${J} (${R.message})`),!1)),at=async(y,D,F,J=0)=>{let R=await $.evaluate(ho,{selector:y,up:J,margin:Xe,frames:Je}).catch(I=>({error:I}));return R?.clip?await Z(R.clip,R.fixed,D,F)?R.clip:null:(C("unverified",`no picture of ${F} (${R?.error?.message??"the element is gone or shows nothing"})`),null)},V=(y,D)=>y.left<D.x+D.width&&y.right>D.x&&y.top<D.y+D.height&&y.bottom>D.y,pt=async()=>{let y=d.filter(F=>!Q.has(F)),D=await $.evaluate((F,J,R)=>{let I=new Map(F.map((M,G)=>[M,G])),k=M=>!!M&&!M.closest("[data-doc-dev], dialog:not([open])")&&M.getClientRects().length>0,H=M=>M===null?null:[...document.querySelectorAll("[data-block-id]")].find(G=>G.getAttribute("data-block-id")===M&&k(G))??null,c=M=>{if(!M)return null;let G=M.getBoundingClientRect();return{left:G.left+scrollX,right:G.right+scrollX,top:G.top+scrollY,bottom:G.bottom+scrollY}},a=[];for(let M of document.querySelectorAll("[data-block-id]")){let G=I.get(M.getAttribute("data-block-id"));if(G===void 0||!k(M))continue;I.delete(M.getAttribute("data-block-id")),M.setAttribute("data-qa-block",String(G));let[et,$t]=J[G]??[],yt=(R[G]??[]).map(xt=>[xt,[...M.querySelectorAll("[data-block-id]")].find(bt=>bt.getAttribute("data-block-id")===xt&&k(bt))]).filter(([,xt])=>xt);a.push({index:G,boxes:J[G]?{block:c(M),above:c(H(et)),below:c(H($t))}:null,held:yt.map(([xt,bt])=>({id:xt,box:c(bt)}))})}return a},y,y.map(F=>w.get(F)??null),y.map(F=>f.get(F)??[]));for(let{index:F,boxes:J,held:R}of D){let I=y[F];Q.add(I);let k=`${E}-${it(I)}`,H=[];if(!J){let c=ht.join(L(I),`${k}.png`),a=await at(`[data-qa-block="${F}"]`,c,`the block ${I}`);a&&(X.push({block:I,file:c}),H.push(a))}for(let{part:c,clip:a}of J?Ze(J):[]){let M=ht.join(L(I),`${k}${c?`-${c}`:""}.png`);await Z(a,!1,M,`the block ${I}${c?` (its ${c})`:""}`)&&(X.push({block:I,file:M}),H.push(a))}for(let{id:c,box:a}of R)H.some(M=>V(a,M))?h.add(c):h.has(c)||B.add(c);await $.evaluate(c=>document.querySelector(`[data-qa-block="${c}"]`)?.removeAttribute("data-qa-block"),F)}},lt=async(y,D,F)=>{let J=[...f].filter(([I])=>Q.has(I)).map(([I,k])=>[I,k.filter(H=>!h.has(H))]).filter(([,I])=>I.length);if(!J.length)return;let R=await $.evaluate((I,k)=>{let H=document.querySelector(I);if(!H)return[];let c=a=>[...H.querySelectorAll("[data-block-id]")].some(M=>M.getAttribute("data-block-id")===a&&M.getClientRects().length>0);return k.map(([a,M])=>[a,M.filter(c)]).filter(([,a])=>a.length)},y,J);for(let[I,k]of R){let H=ht.join(L(I),`${E}-${it(I)}-${D}.png`);if(await at(y,H,`the block ${I} (${D})`,F)){X.push({block:I,part:D,file:H});for(let c of k)h.add(c),B.delete(c)}}},st=async y=>{let D=await $.evaluate(zt,{scope:y,next:tt,ignored:Fe,slack:Ke,whole:x,drawn:u});tt=D.next;let F=D.found.flatMap(R=>R.kind!=="layout"?[R]:ze(R.what,j).filter(({kind:I})=>!(R.measured&&["table-columns","table-rows"].includes(I))).map(({kind:I,note:k})=>({...R,kind:I,what:`the kit notes ${k}`})));for(let R of F){let I=R.shot===null?null:`${R.kind}|${R.shot}|${R.what}`,k=I&&N.get(I);if(k)!k.seen&&R.seen&&Object.assign(k,R,{state:_});else{let H={...R,state:_};Y.push(H),I&&N.set(I,H)}}let J=new Set(Y.filter(R=>R.kind==="blocked").map(R=>R.url));for(let R of Y){if(R.shot===null||!R.seen||gt.has(R.shot)||!Ye(R,j)||A?.has(Xt(R))||["request","image"].includes(R.kind)&&J.has(R.url))continue;gt.add(R.shot);let I=ht.join(l.flagged,`${E}-${String(R.shot).padStart(2,"0")}-${R.kind}.png`);await at(`[data-qa-shot="${R.shot}"]`,I,R.kind)&&X.push({shot:R.shot,file:I})}d.length&&await pt()},ct=y=>{let D=new Set(Y.filter(J=>J.kind==="blocked").map(J=>J.url));return{findings:Y.filter(J=>!(["request","image"].includes(J.kind)&&D.has(J.url))&&!A?.has(Xt(J))),counts:y,pictures:X,held:{covered:[...h],missed:[...B]}}};try{try{let k=new Promise(c=>$.once("domcontentloaded",c)),H=$.goto(v,{waitUntil:"load",timeout:6e4});if(H.catch(()=>{}),await Promise.race([k,H]),$.url()!==v)throw new Error(`the browser shows ${$.url()}`)}catch(k){return C("unverified",`the page did not load: ${k.message}`),ct(null)}await dt("the page as it opens");let y=await $.evaluate(co,Et);y.loaded||C("unverified",`the pictures (${y.images}) not all loaded in ${Et/1e3}s`),y.closed&&await dt(`the page with its ${y.closed} closed disclosure${y.closed===1?"":"s"} opened`),await st(null);let D=async(k,H,c,a=null)=>{for(let M=k,G=1;M<H;M+=Me,G++){let et=ht.join(l.tiles,`${E}-${c}${String(G).padStart(2,"0")}.png`);await jt($.screenshot({path:et,clip:{x:0,y:M,width:j,height:Math.min(Me,H-M)},captureBeyondViewport:!0}),Et,"a tile").then(()=>X.push({tile:!0,sheet:a,file:et}),$t=>C("unverified",`no tile ${c}${G} (${$t.message})`))}};i&&await D(0,await $.evaluate(()=>document.documentElement.scrollHeight),"");let F=async(k,H=null)=>{if(!await $.evaluate(ve,k.chain)){let{anchor:c}=await $.evaluate(zt,{next:tt,place:`[data-qa-tab="${k.index}"]`});return C("unverified","this Sheet could not be shown: its tab was clicked and its panel stayed hidden",{anchor:c}),!1}if(await dt("the Sheet shown"),await st(`[data-qa-panel="${k.index}"]`),await lt(`[data-qa-panel="${k.index}"]`,`sheet${k.index+1}`,1),i&&H)await J(H,`sheet${k.index+1}-`);else if(i){let c=await $.evaluate(a=>{let M=document.querySelector(`[data-qa-panel="${a}"]`)?.getBoundingClientRect();return M&&M.height>0?{top:Math.max(0,M.top+scrollY),bottom:M.bottom+scrollY}:null},k.index);c&&await D(c.top,c.bottom,`sheet${k.index+1}-`,{number:k.index+1,label:k.label})}return!0},J=async(k,H="")=>{for(let c=1;c<=20;c++){let a=await $.evaluate((G,et)=>{let $t=document.querySelector(`[data-qa-card="${G}"]`),yt=$t?.querySelector(".doc-dialog-content")??$t;if(!yt)return null;if(et)yt.scrollTop=0;else{let bt=yt.scrollTop;if(yt.scrollTop+=Math.max(40,yt.clientHeight-24),yt.scrollTop===bt)return null}let xt=$t.getBoundingClientRect();return{x:xt.left+visualViewport.pageLeft,y:xt.top+visualViewport.pageTop,width:xt.width,height:xt.height}},k.index,c===1);if(!a)break;let M=ht.join(l.tiles,`${E}-card${k.index+1}-${H}${String(c).padStart(2,"0")}.png`);await Z(a,!0,M,`the detail card ${Mt(k.label,24)}, tile ${H}${c}`)&&X.push({tile:!0,card:{number:k.index+1,label:k.label,part:H},file:M})}},R=0;for(let k of y.sheets)k.shown||!k.panel||k.card!==null||(_=`Sheet ${Mt(k.label,24)}`,await F(k)&&(R+=1));let I=0;for(let k of y.cards){_=`detail card ${Mt(k.label,24)}`;let H=`[data-qa-card="${k.index}"]`;k.chain.length&&await $.evaluate(ve,k.chain);for(let c of k.within)await $.evaluate(ke,c);if(!await $.evaluate(ke,k.index)){let{anchor:c}=await $.evaluate(zt,{next:tt,place:H});C("unverified","this detail card could not be opened",{anchor:c});for(let a of k.within.toReversed())await $.evaluate(Ht,a);continue}I+=1,await dt("the detail card opened"),await st(H),await lt(H,`card${k.index+1}`,0),i&&await J(k);for(let c of y.sheets)c.card!==k.index||c.shown||!c.panel||(_=`detail card ${Mt(k.label,24)}, Sheet ${Mt(c.label,24)}`,await F(c,k)&&(R+=1));await $.evaluate(Ht,k.index);for(let c of k.within.toReversed())await $.evaluate(Ht,c)}return _="",ct({...await $.evaluate(fo),details:y.details,closed:y.closed,sheets:R,cards:y.cards.length,cardsOpened:I})}catch(y){return C("unverified",`the look ended early: ${y.message}`),ct(null)}finally{await Dt(z.close())}}var Jt=e=>e.split(ht.sep).join("/"),ft=(e,n,s=`${n}s`)=>`${e} ${e===1?n:s}`,Ut=e=>`${e.join(", ")}px`,po=e=>e.includes("\xD7")?e:`${e}px`;function go({details:e,closed:n}){if(e===0)return"0 disclosures";let s=n===0?"open in the file":`${n===e?"":`${n} `}closed in the file, opened for the pictures`;return`${ft(e,"disclosure")} (${s})`}function Re(e,n=null){let s=new Map;for(let l of e){let i=n?ht.relative(n,l):"",d=Jt(n&&i&&!i.startsWith("..")&&!ht.isAbsolute(i)?i:l),w=/^(.*\/)?(\d+(?:x\d+)?)-([^/]+)$/.exec(d),f=w?`${w[1]??""}\0${w[3]}`:d;s.has(f)||s.set(f,w?{head:w[1]??"",tail:w[3],looks:[]}:{whole:d});let x=s.get(f);w&&!x.looks.includes(w[2])&&x.looks.push(w[2])}return[...s.values()].map(l=>l.whole??`${l.head}${l.looks.length>1?`{${l.looks.join(",")}}`:l.looks[0]}-${l.tail}`)}function mo(e){let n=e.map(({folder:l,files:i})=>({folder:l,files:[...new Set(i)]})).filter(({files:l})=>l.length);if(!n.length)return null;let s=n.reduce((l,{files:i})=>l+i.length,0);return`Not opened yet: ${ft(s,"picture")} of this run, none looked at for you; open each, and in the handoff name those you opened: ${n.flatMap(({folder:l,files:i})=>Re(i,l).map(d=>ht.isAbsolute(d)?d:`${Jt(l)}/${d}`)).join(", ")}`}var Te=(e="<slug>")=>`more pictures: gallery qa ${e} --tiles (the page, each Sheet panel and each detail card in tiles), gallery qa ${e} --blocks <id,\u2026> (the blocks you name)`,nn=Te(),Ne=fe,Ce='look at the export yourself at 1024, 736 and 360px, its disclosures and detail cards opened (SKILL.md, "Export, check and look"), and say so when you hand the document over.',wo=e=>Ft(e?.message).replace(/\s*Use a different `?userDataDir`? or stop the running browser first\.?/gi,"").slice(0,300),Gt={overflow:"a reader scrolls the whole page sideways. Words that cannot break where they stand (a long path, URL or name): wrap each in <code>, which breaks where it must and keeps it whole for the reader to copy; an element wider than the window (a picture, a drawing, a width of your own): let it fit (max-width: 100%) or put it in a frame that scrolls; never cut or rewrite a path to silence this","table-columns":"not a failure. If the reader must see the column on a desktop, write its long values compactly (a cell of numbers stays on one line, so its longest value sets the column's width: a range as a\u2013b, fewer digits), move a unit out of its header into the line above the table, shorten the header, or split the table; never delete a column to silence this","chart-text-overlap":"not a failure. If the reader must read both, shorten the labels (a unit belongs in the axis's title), move one (above its row, or a leader line) or give the drawing more room at this width; never delete a label or a category to silence this","code-scrolls":'not a failure. A reader scrolls inside the frame (40 lines) for the rest; if every line must show at once, write style="--doc-code-height: none" on its <pre>; never delete code to silence this',"formula-scrolls":"not a failure. A reader scrolls the formula sideways for the rest; if it must show whole at this width, break it into lines (\\begin{aligned} \u2026 \\end{aligned}) or into two formulas; never cut a term to silence this","overflow-in-block":"not a failure. If the words run over others in the picture, give their box room at this width (a wider column in an @media rule of your <style>, or a smaller font there), or let them break (a dash or a space where a line may end); never cut the words to silence this","cut-in-block":"not a failure. If the reader must see what is cut, let the box grow with what it holds (min-height instead of height or max-height, or none), give it room at this width in an @media rule of your <style>, or let it scroll (overflow: auto); never delete the words to silence this",ticks:"not a failure. If the numbers crowd in the picture, give that axis fewer ticks at this width with axis.tickValues([...]), at most four on a phone (the domain's ends and middle; ticks(n) is only a hint to d3 and can still draw five or more), or shorter numbers (the unit in the axis's title: 2k, 1.5\u4E07); never take the axis out to silence this","svg-text-small":"not a failure. The viewBox scales the drawing's text with it: give the text a larger font-size in the viewBox's units (a viewBox 800 wide drawn 340px wide scales by 0.43, so 26 units read as 11px), or lay the drawing out for narrow widths (a viewBox of its own under an @media rule, a chart of your own drawn from its width, or HTML that wraps); never drop the labels to silence this"},$o='not a failure. A reader scrolls sideways for the rest of its long lines; if the reader must see them whole at this width, let them wrap (take data-wrap="false" off its <pre>) or break them where the code allows; a tree or a log whose lines must stay whole may scroll; never cut a line to silence this';function xo(e){if(e.kind!=="code-scrolls")return Gt[e.kind]?[Gt[e.kind]]:[];let n=[...e.said.keys()],s=n.some(l=>/ wide, its frame /.test(l));return[...!s||n.some(l=>/ tall, its frame /.test(l))?[Gt["code-scrolls"]]:[],...s?[$o]:[]]}var yo="none is a failure: each says what to do if it matters to the reader (never delete a column or a label to silence one)",bo="a reader scrolls it: not a problem";function So(e,n,s=null,{folder:l=null,slug:i="<slug>"}={}){let d=[],w=Object.fromEntries(Bt.map(h=>[h,0])),f=new Map,x=new Set,u=new Map,A=[],j=h=>Re(h,l),K=h=>h.label??String(h.width),m=new Map(e.flatMap(h=>h.pictures.filter(B=>B.shot!==void 0).map(B=>[`${K(h)}|${B.shot}`,B.file])));for(let h of e){let{width:B,findings:_,counts:tt}=h,C=K(h),v=new Set,U=Object.fromEntries(Bt.map(V=>[V,0])),L={right:0,down:0,all:0};for(let V of _){let pt=`${V.kind}|${V.shot??""}|${V.what}`;if(v.has(pt))continue;v.add(pt);let lt=qe(V,B);U[lt]+=1;let st=oo(V.anchor,n);if(V.kind==="table-scrolls"){let{sideways:R=!1,down:I=!1,name:k=""}=V.scroll??{};Object.assign(L,{all:L.all+1,right:L.right+Number(R),down:L.down+Number(I)});let H=`${st}|${k}`;u.has(H)||u.set(H,{place:st,name:k,right:[],down:[]}),R&&!u.get(H).right.includes(C)&&u.get(H).right.push(C),I&&!u.get(H).down.includes(C)&&u.get(H).down.push(C)}if(lt==="info"&&x.add(`${V.kind}|${st}`),lt==="info"&&["table-scrolls","table-columns","table-rows"].includes(V.kind))continue;let ct=`${Bt.indexOf(lt)}|${V.kind}|${st}`;f.has(ct)||(f.set(ct,{level:lt,kind:V.kind,place:st,said:new Map}),lt!=="info"&&(w[lt]+=1));let y=f.get(ct).said,D=`${V.state?`[${V.state}] `:""}${V.what}`;y.has(D)||y.set(D,{labels:[],pictures:[]});let F=y.get(D);F.labels.includes(C)||F.labels.push(C);let J=m.get(`${C}|${V.shot}`);J&&!F.pictures.includes(J)&&F.pictures.push(J)}let it=[L.right&&`\u2192 ${L.right}`,L.down&&`\u2193 ${L.down}`].filter(Boolean).join(", "),dt=`${ft(L.all,"table scrolls","tables scroll")}${it?` (${it})`:""}`,Z=tt?.cards?`, ${ft(tt.cards,"detail card")} (${tt.cardsOpened===tt.cards?"closed in the file, opened in turn":`${tt.cardsOpened??0} of them opened`})`:"",at=h.laptop?"; only what the 1024px look did not find":tt?`; ${ft(tt.charts,"chart")}, ${ft(tt.tables,"table")}, ${go(tt)}, ${ft(tt.sheets,"Sheet")} shown besides the first${Z}, page ${tt.height}px tall`:"";A.push({label:C,fail:U.fail,warn:U.warn,line:`${h.laptop?C:`${C.padStart(4)}px`} fail ${U.fail} \xB7 warn ${U.warn} \xB7 unverified ${U.unverified} \xB7 ${dt}${at}`})}let E=[...f.values()].sort((h,B)=>Bt.indexOf(h.level)-Bt.indexOf(B.level)),z=e.flatMap(h=>h.pictures);if(l&&z.length&&d.push(`Pictures of this run in ${Jt(l)}/ (each path below is in it):`),s){let h=new Map;for(let C of z)C.block!==void 0&&h.set(C.block,[...h.get(C.block)??[],C.file]);let B=Oe(e),_=C=>`${s.tags?.get(C)?`${s.tags.get(C)} `:""}${C}`,tt=`at ${$e.slice(0,-1).join(", ")} and ${$e.at(-1)}px`;s.tiles&&s.why&&d.push(`${s.why[0].toUpperCase()}${s.why.slice(1)}.`);for(let C of s.groups??[]){if(!C.ids.length&&!C.rest.length)continue;let v=!C.ids.length&&s.groups.some(U=>U!==C&&U.ids.length)?`: none this run (the ${Ae} blocks a run pictures went to the changed blocks above)`:"";d.push(`${C.why[0].toUpperCase()}${C.why.slice(1)}${C.ids.length?`, ${tt}`:v}:`);for(let U of C.ids){let L=n.blocks.get(U),it=`${L?`${n.name??"doc.html"}:${L}`:`(not in ${n.name??"doc.html"})`} ${U}${s.tags?.get(U)?` ${s.tags.get(U)}`:""}`,dt=h.get(U)??[],Z=s.moved?.has(U)?" (moved: with the edges of the blocks before and after it)":"",at=s.held?.get(U)??[],V=at.filter(F=>s.changed?.has(F)).length,pt=C.kind==="named"?ft(at.length,"block"):[V&&ft(V,"changed block"),at.length-V&&ft(at.length-V,"card")].filter(Boolean).join(" and "),lt=z.some(F=>F.block===U&&F.part)?", pictured again with each Sheet panel or detail card that holds one":"",st=at.filter(F=>B.has(F)),ct=[...new Set(st.flatMap(F=>B.get(F)))].map(F=>F.includes("\xD7")?F:`${F}px`).join(", "),y=st.length?`; ${st.length} of them not pictured at ${ct}: gallery qa ${i} --blocks ${st.join(",")}`:"",D=at.length?` (with the ${pt} it holds${lt}${y})`:"";d.push(dt.length?` ${it}${Z}${D}: ${j(dt).join(", ")}`:` ${it}${Z}${D}: not shown at any width (hidden)`)}if(C.rest.length){let U=ft(C.rest.length,{changed:"changed block",cards:"card"}[C.kind]??"block"),L=`${C.rest.slice(0,6).map(_).join(", ")}${C.rest.length>6?", \u2026":""}`;d.push(` ${C.ids.length?"and ":""}${U}${C.ids.length?" more":""}, not pictured (${L}): gallery qa ${i} --blocks ${C.rest.join(",")}`)}}s.unknown.length&&d.push(` no block of ${n.name??"doc.html"} has the id${s.unknown.length===1?"":"s"} ${s.unknown.join(", ")}`)}let $=[];for(let h of E)for(let{pictures:B}of h.said.values())$.push(...B.filter(_=>!$.includes(_)));$.length&&d.push("The elements flagged below, look at these first:",...j($).map(h=>` ${h}`));let Y=z.filter(h=>h.tile),X=Y.filter(h=>!h.sheet&&!h.card);X.length&&d.push(`The page as it opens (each Sheet area with the panel it shows first): ${ft(X.length,"tile")} in ${j([ht.dirname(X[0].file)])[0]}/ (<width>-<n>.png)`);let gt=new Map;for(let{sheet:h}of Y)h&>.set(h.number,{...h,count:(gt.get(h.number)?.count??0)+1});gt.size&&d.push(`Each other Sheet panel, shown in turn: ${ft(Y.filter(h=>h.sheet).length,"tile")} in ${j([ht.dirname(Y.find(h=>h.sheet).file)])[0]}/ (<width>-sheet<i>-<n>.png): ${[...gt.values()].map(({number:h,label:B,count:_})=>`sheet${h} ${Mt(B,24)} ${ft(_,"tile")}`).join(", ")}`);let N=new Map;for(let{card:h}of Y)h&&N.set(h.number,{...h,count:(N.get(h.number)?.count??0)+1});N.size&&d.push(`Each detail card, opened in turn as the window shows it, its content scrolled a tile at a time: ${ft(Y.filter(h=>h.card).length,"tile")} in ${j([ht.dirname(Y.find(h=>h.card).file)])[0]}/ (<width>-card<i>-<n>.png${Y.some(h=>h.card?.part)?"; with another panel of a Sheet in it shown, <width>-card<i>-sheet<j>-<n>.png":""}): ${[...N.values()].map(({number:h,label:B,count:_})=>`card${h} ${Mt(B,24)} ${ft(_,"tile")}`).join(", ")}`);for(let{place:h,name:B,right:_,down:tt}of u.values()){let C=/^(?:doc|report)\.html:\d+/.exec(h)?.[0]??h;d.push(`${"INFO".padEnd(10)} table-scrolls: ${C}${B?` ${Mt(B,32)}`:""}: ${[_.length&&`\u2192 ${Ut(_)}`,tt.length&&`\u2193 ${Ut(tt)}`].filter(Boolean).join("; ")} (${bo})`)}for(let h of E){d.push(`${h.level.toUpperCase().padEnd(10)} ${h.kind}: ${h.place}`);for(let[B,{labels:_,pictures:tt}]of h.said)d.push(` ${Ut(_)}: ${B}${tt.length?` (${j(tt).join(", ")})`:""}`);for(let B of xo(h))d.push(` ${B}`)}d.push(...A.map(({line:h})=>h));let Q=ko(s,i);return Q&&d.push(Q),w.info=x.size,{lines:d,levels:w,looks:A.map(({label:h,fail:B,warn:_})=>({label:h,fail:B,warn:_}))}}function ko(e,n="<slug>"){let{changed:s=[],restyled:l=[],packages:i=[],cards:d=[],since:w="the last look",first:f=!1}=e?.left??{};if(!s.length&&!l.length&&!d.length)return null;let x=A=>`${A.slice(0,6).map(j=>`${e.tags?.get(j)?`${e.tags.get(j)} `:""}${j}`).join(", ")}${A.length>6?", \u2026":""}`;return`Not pictured by this run, which pictures the blocks named alone: ${[s.length&&`${ft(s.length,"block")} changed or moved since ${w} (${x(s)})`,l.length&&`${ft(l.length,"instance")} of a custom block changed since ${w}, ${i.join(", ")} (${x(l)})`,d.length&&(f?`no earlier look: ${ft(d.length,"card")} never pictured (${x(d)})`:`${ft(d.length,"card")} the change of the document's own <script> or <style> since ${w} may draw again (${x(d)})`)].filter(Boolean).join("; ")}. gallery qa ${n} pictures them.`}function vo(e,n,s=[],{unpictured:l=!1}={}){let i=n.map(({label:A,fail:j,warn:K})=>`${po(A)} fail ${j}, warn ${K}`).join("; "),d=i?` (${i})`:"",w=Te(s.length===1?s[0].slug:void 0),f={stale:"its file had changed since its export",missing:"it had none yet"},x=s.filter(({first:A})=>A).map(({slug:A,first:j})=>`${s.length>1?`${A} was`:"It was"} exported first by this run (${f[j]}).`),u=`${x.length?`. ${x.join(" ")}`:""}${s.map(({file:A})=>`
|
|
3
3
|
${Ne}${A}`).join("")}`;if(e.fail)return`failures at ${ft(e.fail,"place")}${d}: fix them in the document's doc.html (report.html in an older document), then run this again (it exports first); ${w}${u}`;if(e.unverified)return`nothing failed${d}; not verified at ${ft(e.unverified,"place")}: say so when you hand the document over; ${w}${u}`;if(e.warn)return`nothing failed${d}; warnings at ${ft(e.warn,"place")} to look at, ${yo}; ${w}${u}`;if(l){let A=s.length===1?s[0].slug:"<slug>";return`nothing found${d}, and no picture taken: a plain run pictures the cards and the blocks changed since the last look, and the document has no card (a chart or a drawing, code, a whole block, a component, a flowchart, a Sheet area, columns, a figure, a table) and no block changed; run gallery qa ${A} --tiles to picture the page, each Sheet panel and each detail card in tiles, open those pictures and look at the document once yourself; gallery qa ${A} --blocks <id,\u2026> pictures the blocks you name${u}`}return`nothing found${d}: open the pictures above and look at the document once yourself; ${w}${u}`}function Mo(e,{missing:n=!1,edited:s=!1,packaged:l=!1}={}){let i=At(e),d=ht.basename(It(Lt(e,Rt)).html);return`exporting first: ${n?`no export yet (${i})`:s?`${d} changed since the last export (${i})`:l?`a custom block it uses changed since the last export (${i})`:`the last export (${i}) does not say which text it was made from (an older Gallery's)`}, as gallery export ${e} does (--no-export: refuse instead)`}async function Co(e){for(let[i,{missing:d,edited:w,packaged:f}]of e)console.log(`${i}: ${Mo(i,{missing:d,edited:w,packaged:f})}`);let n=new Map(await Promise.all(e.map(async([i])=>[i,await vt.stat(At(i)).then(d=>d.mtimeMs,()=>null)]))),s=Le(process.execPath,[ht.join(De,"bin","gallery.mjs"),"export",...e.map(([i])=>i)],{cwd:Rt,encoding:"utf8",env:{...process.env,GALLERY_WORKSPACE:Rt},maxBuffer:256*1024*1024});s.stdout&&process.stdout.write(s.stdout),s.stderr&&process.stderr.write(s.stderr),s.error&&console.error(`the export did not run: ${s.error.message}`);let l=[];for(let[i]of e){let d=await vt.stat(At(i)).then(w=>w.mtimeMs,()=>null);d!==null&&d!==n.get(i)&&!(await Kt(i,{made:!0})).problem&&l.push(i)}return l}var Eo=e=>String(e??"").split(/[\s,]+/).filter(Boolean);function qo(e,n){let s=_t(e);return[...new Set(n)].filter(l=>!s.has(l))}var Ao=(e,n)=>`--blocks: no block of ${e} has the id${n.length===1?"":"s"} ${n.join(", ")}: nothing was looked at and no picture removed. Name ids as gallery qa prints them (data-block-id in the file).`;async function sn(e){let{slugs:n,options:s,values:l}=await Qt({options:["--tiles","--no-export"],values:["--blocks"],argv:e}),i=l.has("--blocks")?Eo(l.get("--blocks")):null;if(i?.length===0)throw new Wt("--blocks takes block ids: --blocks <id,\u2026>");if(i&&n.length!==1)throw new Wt("--blocks names blocks of one document: name one.");let d=new Map,w=[];for(let N of n){let Q=await Kt(N);Q.problem&&!((Q.stale||Q.missing)&&!s.has("--no-export"))&&w.push(Q.problem),d.set(N,Q)}if(w.length&&(console.error(w.join(`
|
|
4
4
|
`)),process.exit(2)),i){let N=It(Lt(n[0],Rt)).html,Q=qo(Vt(await vt.readFile(N,"utf8").catch(()=>"")),i);if(Q.length)throw new Wt(Ao(ht.resolve(N),Q))}await ae(n),await ue(n),await pe(n);let f=[...d].filter(([,N])=>N.stale||N.missing),x=new Map(f.map(([N,Q])=>[N,Q.missing?"missing":"stale"]));if(f.length){let N=await Co(f),Q=f.map(([h])=>h).filter(h=>!N.includes(h));for(let h of N)d.set(h,await Kt(h,{made:!0}));Q.length&&(console.error(`${Q.join(", ")}: the export failed (above), so nothing was looked at: fix what it says, then run this again`),process.exit(1))}let u=d,A=[...u].map(([N,{file:Q}])=>({slug:N,file:Q,first:x.get(N)??null})),j=(N,Q)=>{for(let[h,{sha256:B,time:_}]of u)console.log(`${h}: ${At(h)} sha256 ${B}, exported ${Yt(_)}`);console.log(`UNVERIFIED ${N}: nothing was looked at. ${Q}`);for(let{file:h}of A)console.log(`${Ne}${h}`);process.exit(3)},K=ie();K||j("no Chrome, Edge or Chromium found (GALLERY_BROWSER=<its executable> picks one)",`Install Chrome or Edge, or ${Ce}`);let m=await de({executablePath:K,args:re()}).catch(N=>j(`the browser ${K} did not start, twice, each time with a fresh profile (${wo(N)}; GALLERY_BROWSER=<its executable> picks another)`,`Run gallery qa once more; if it says UNVERIFIED again, ${Ce}`)),{browser:E}=m,z=Object.fromEntries(Bt.map(N=>[N,0])),$=new Map,Y=!1,X=[];try{for(let[N,{file:Q,sha256:h,time:B}]of u){let _=ht.join(He,N),tt=ht.join(_,"blocks.json");console.log(`${N}: ${At(N)} sha256 ${h}, exported ${Yt(B)} (${ht.basename(K)}, headless)`);let C=It(Lt(N,Rt)).html,v=Vt(await vt.readFile(C,"utf8")),U=_t(v),L=se(U,ne(await vt.readFile(tt,"utf8").catch(()=>null))),it=ee(v),dt=oe(v),Z=lo(U,L,i,{tiles:s.has("--tiles")&&!i,page:it,packages:dt}),at=s.has("--tiles")||!!Z.tiles;(at||Z.ids.length)&&(Y=!0);let V={flagged:ht.join(_,"flagged"),blocks:ht.join(_,i?"blocks":"changed"),tiles:ht.join(_,"tiles")},pt=ht.join(_,"cards");V.folders=new Map(Z.groups.flatMap(c=>c.ids.map(a=>[a,c.kind==="cards"?pt:V.blocks])));let lt=[V.flagged,...i?[V.blocks]:Z.tiles?[]:[V.blocks,pt],...at?[V.tiles]:[]],st=(await Promise.all(lt.map(async c=>[c,(await vt.readdir(c).catch(()=>[])).filter(a=>a.endsWith(".png")).length]))).filter(([,c])=>c>0);st.length&&console.log(`The pictures of the run before in ${st.map(([c])=>`${ht.basename(c)}/`).join(", ")} (${ft(st.reduce((c,[,a])=>c+a,0),"file")}) were removed: this run's replace them.`);for(let c of lt)await vt.rm(c,{recursive:!0,force:!0});for(let c of await vt.readdir(_).catch(()=>[]))c.endsWith(".png")&&await vt.rm(ht.join(_,c),{force:!0});for(let c of lt)await vt.mkdir(c,{recursive:!0});let ct=[...U].filter(([,{whole:c}])=>c).map(([c])=>c),y=[...U].filter(([,{figure:c}])=>c).map(([c])=>c),D=[],F=null;for(let c of we){let a=await uo(E,Q,c,{out:V,tiles:at&&!c.laptop,blocks:c.laptop?[]:Z.ids,around:Z.around,held:c.laptop?new Map:Z.held,whole:ct,drawn:y,known:c.laptop?F:null});D.push({...c,...a}),a.pictures.length&&(Y=!0),X.push({folder:_,files:a.pictures.map(({file:M})=>M)}),!c.laptop&&c.width===we.find(M=>M.laptop)?.width&&(F=new Set(a.findings.map(Xt)))}let{lines:J,levels:R,looks:I}=So(D,eo(v,ht.basename(C)),{...Z,tags:new Map([...U].map(([c,{tag:a}])=>[c,a]))},{folder:_,slug:N});console.log(J.join(`
|
|
5
5
|
`));for(let c of Bt)z[c]+=R[c];for(let{label:c,fail:a,warn:M}of I){let G=$.get(c)??{label:c,fail:0,warn:0};$.set(c,{label:c,fail:G.fail+a,warn:G.warn+M})}let k=D.every(c=>c.counts&&!c.findings.some(a=>a.kind==="unverified")),H=ao(U,L,Z,{named:i,verified:k,failed:R.fail>0,seen:io(Z,D),page:it,packages:dt})??L;H&&await vt.writeFile(tt,`${JSON.stringify(H)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{a as i,l as C}from"./chunk-
|
|
2
|
+
import{a as i,l as C}from"./chunk-6N3PX4XX.mjs";import{a as g,c as w}from"./chunk-HYMEEXKN.mjs";import{g as j,o as A,p as S}from"./chunk-HDWTZ763.mjs";import f from"node:path";import{attr as P,hasClass as z,walk as D}from"../browser/shared/html-tree.mjs";import{projectRoot as F,sdkDirectory as O,typeRoots as Y}from"../browser/shared/paths.mjs";var H=new Set(["application/ecmascript","application/javascript","application/x-ecmascript","application/x-javascript","text/ecmascript","text/javascript","text/javascript1.0","text/javascript1.1","text/javascript1.2","text/javascript1.3","text/javascript1.4","text/javascript1.5","text/jscript","text/livescript","text/x-ecmascript","text/x-javascript"]);function y(t,{diffs:s=!1,tree:r=g(t)}={}){let n=[];return D(r,a=>{if(a.tagName!=="script"||P(a,"src")!==void 0)return;let o=(P(a,"type")||"").trim().toLowerCase(),l=s&&o==="application/json"&&a.parentNode?.tagName?a.parentNode:null,e=l&&z(l,"doc-diff")?"__declaredDiff(":void 0;if(!e&&o&&o!=="module"&&!H.has(o))return;let{startTag:c,endTag:p}=a.sourceCodeLocation??{};c&&n.push({start:c.endOffset,end:p?.startOffset??t.length,module:o==="module",...e?{call:e}:{}})},{inTemplates:!1}),n}function L(t,s,r=[]){let n=[],a=0,o="",l=e=>e.replace(/[^\r\n]/g," ");for(let{start:e,end:c,call:p}of s){let u=o+l(t.slice(a+o.length,e));if(p){let h=V(u,p,o.length);if(h===null){r.push(e);continue}u=h}n.push(u,t.slice(e,c)),a=c,o=p?");":""}return n.push(o+l(t.slice(a+o.length)),`
|
|
3
3
|
export {};
|
|
4
4
|
`),n.join("")}function V(t,s,r){let n=t.length;for(;;){let a=Math.max(t.lastIndexOf(`
|
|
5
5
|
`,n-1)+1,r),o=t[n-1]==="\r"?n-1:n;if(o-a>=s.length)return t.slice(0,o-s.length)+s+t.slice(o);if(a<=r)return null;n=a-1}}function Pt(t,s=g(t)){return L(t,y(t,{tree:s}))}var q=new Set(["href","src","action","formaction"]),X=t=>{try{return decodeURIComponent(t)}catch{return t}};function Z(t,s){let r=y(t,{tree:s}).map(({start:n,end:a})=>({code:t.slice(n,a),start:n,where:"the document's script"}));return D(s,n=>{for(let{name:a,value:o}of n.attrs){let l=n.sourceCodeLocation?.attrs?.[a]?.startLine??n.sourceCodeLocation?.startLine,e=q.has(a)?o.replace(/[\t\n\r]/g,"").replace(/^[\u0000-\u0020]+/,""):"";/^on[a-z]+$/.test(a)?r.push({code:o,line:l,where:`the ${a} attribute of <${n.tagName}>`}):/^javascript:/i.test(e)&&r.push({code:X(e.slice(11)),line:l,where:`the javascript: address of <${n.tagName} ${a}>`})}},{inTemplates:!1}),r}var R=new Set(["fetch","XMLHttpRequest","WebSocket","EventSource","sendBeacon","import"]),E=new Set(["window","globalThis","self"]),Q=t=>i.isIdentifier(t)?t.text==="navigator":i.isPropertyAccessExpression(t)&&t.name.text==="navigator"&&i.isIdentifier(t.expression)&&E.has(t.expression.text);function I(t){let{initializer:s}=i.walkUpBindingElementsAndPatterns(t);return!!s&&i.isIdentifier(s)&&E.has(s.text)}function tt(t){let s=t.parent;return i.isPropertyAccessExpression(s)&&s.name===t?i.isIdentifier(s.expression)&&E.has(s.expression.text):i.isBindingElement(s)&&s.propertyName===t?I(s):!((i.isPropertyAssignment(s)||i.isMethodDeclaration(s)||i.isPropertyDeclaration(s)||i.isGetAccessorDeclaration(s)||i.isSetAccessorDeclaration(s))&&s.name===t)}function et(t,s){return i.isIdentifier(t)&&s.has(t.text)&&tt(t)?{name:t.text,reference:i.isPropertyAccessExpression(t.parent)&&t.parent.name===t?t.parent:t}:i.isElementAccessExpression(t)&&i.isIdentifier(t.expression)&&E.has(t.expression.text)&&i.isStringLiteralLike(t.argumentExpression)&&s.has(t.argumentExpression.text)?{name:t.argumentExpression.text,reference:t}:i.isPropertyAccessExpression(t)&&s.has(t.name.text)&&t.name.text==="sendBeacon"&&Q(t.expression)?{name:"sendBeacon",reference:t}:s.has("import")&&i.isCallExpression(t)&&t.expression.kind===i.SyntaxKind.ImportKeyword?{name:"import",reference:t.expression}:null}function st(t,s){let r=new Map,n=(e,c)=>{let p=e.parent;for(;p&&!c(p);)p=p.parent;return p??t},a=e=>i.isFunctionLike(e)||i.isBlock(e)||i.isCaseBlock(e)||i.isForStatement(e)||i.isForInStatement(e)||i.isForOfStatement(e),o=e=>i.isFunctionExpression(e)||i.isClassExpression(e)?e:i.isFunctionDeclaration(e)||i.isClassDeclaration(e)?n(e,a):i.isCatchClause(e.parent)?e.parent:n(e,i.getCombinedNodeFlags(e)&i.NodeFlags.BlockScoped?a:i.isFunctionLike),l=e=>{(i.isParameter(e)||i.isVariableDeclaration(e)||i.isBindingElement(e)||i.isFunctionDeclaration(e)||i.isClassDeclaration(e)||i.isFunctionExpression(e)||i.isClassExpression(e))&&e.name&&i.isIdentifier(e.name)&&s.has(e.name.text)&&!(i.isBindingElement(e)&&I(e))&&r.set(e.name.text,[...r.get(e.name.text)??[],o(e)]),i.forEachChild(e,l)};return l(t),r}function rt(t,s=[]){for(let r=t;r;r=r.parent)if(s.includes(r))return!0;return!1}function Nt(t,s,{tree:r=g(t)}={}){let n=[];for(let{code:a,start:o,line:l,where:e}of Z(t,r))for(let{name:c,how:p,at:u}of k(a,s))n.push({name:c,how:p,line:l??w(t,o+u),where:e});return n.sort((a,o)=>a.line-o.line)}function k(t,s){if(![...s].some(l=>t.includes(l)))return[];let r=[],n=i.createSourceFile("code.js",t,i.ScriptTarget.Latest,!0,i.ScriptKind.JS),a=st(n,s),o=l=>{let e=et(l,s),c=e?.reference.parent;if(e&&!i.isTypeOfExpression(c)&&!(i.isIdentifier(e.reference)&&rt(l,a.get(e.name)))){let p=(i.isCallExpression(c)||i.isNewExpression(c))&&c.expression===e.reference?i.isNewExpression(c)?"new":"call":"use";r.push({name:e.name,how:p,at:l.getStart(n)})}i.forEachChild(l,o)};return o(n),r}var nt=new Set([2304,2552]),it=new Set([2300,2451,2448,2449,2450]),M=t=>nt.has(t)||it.has(t)||t>=1e3&&t<2e3;function at(t,s,r){if(!t.file||r.has(t)||M(t.code))return!1;let n=t.start??-1;return s.some(a=>!a.call&&a.start<=n&&n<a.end)}var ot=(t,s)=>/\bNumberValue\b/.test(t)||/\bd3\.(?:min|max|extent)\(/.test(s)?"; here d3 reads values of no type as strings: give the data its shape once with JSDoc, /** @type {Array<{ label: string, value: number }>} */ const rows = data;, and d3.min or d3.max may give undefined (?? 0)":"";function B(t){let s={allowJs:!0,checkJs:!0,noEmit:!0,allowUmdGlobalAccess:!0,strict:!0,noImplicitAny:!1,target:i.ScriptTarget.ES2022,module:i.ModuleKind.ESNext,moduleResolution:i.ModuleResolutionKind.Bundler,lib:["lib.es2022.d.ts","lib.dom.d.ts","lib.dom.iterable.d.ts"],types:["d3"],typeRoots:Y,skipLibCheck:!1},r=i.createCompilerHost(s),n=r.readFile.bind(r),a=r.fileExists.bind(r);return r.readFile=o=>t.get(f.resolve(o))??n(o),r.fileExists=o=>t.has(f.resolve(o))||a(o),i.createProgram([f.join(O,"index.d.ts"),...t.keys()],s,r)}var ct=/\bDoc[A-Z]\w*/,lt=(t,s)=>ct.test(s)||(t.relatedInformation??[]).some(({file:r})=>r&&f.resolve(r.fileName).startsWith(O+f.sep)),N={katex:"katex","katex-auto-render":"renderMathInElement"};function Dt(t,{assets:s=[]}={}){let r=f.join(F,"reports","__package__","kit.js"),n=t.replace(/^([ \t]*)(?:<!--|-->)/gm,"$1//"),a=s.filter(c=>Object.hasOwn(N,c)).map(c=>`declare const ${N[c]}: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{a as U,b as Z,c as ot,d as q}from"./chunk-
|
|
2
|
+
import{a as U,b as Z,c as ot,d as q}from"./chunk-R2ZDLJYT.mjs";import{e as L}from"./chunk-VFX2KNHP.mjs";import{D as nt,a as _,b as V,l as tt,m as D,o as et}from"./chunk-VS7JIGJW.mjs";import{b as J,c as P,e as Q}from"./chunk-A55HN5OK.mjs";import{IDENTITY as Ne}from"../browser/editor/components/registry.mjs";function gt(e){let{blocks:a,locks:r,units:n,boxes:c}=L(e),l=wt(e,[...a.map(t=>({at:t.innerStart-1,text:` data-ge-block="${t.id}"`})),...r.map(t=>({at:t.at,text:` data-ge-lock="${t.reason}"`})),...n.map(t=>({at:t.at,text:` data-ge-unit="${t.id}"${t.grid?" data-ge-grid":""}${t.keep?` data-ge-keep="${t.keep.reason}"${t.keep.own?" data-ge-keep-own":""}`:""}`})),...n.filter(t=>t.lead!==null).map(t=>({at:t.lead,text:` data-ge-lead="${t.id}"`})),...c.map(t=>({at:t.at,text:` data-ge-box="${t.id}"${t.pure?" data-ge-pure":""}`}))]),p={version:_(e),blocks:a.map(t=>({id:t.id,tag:t.tag,kind:t.kind,caps:Object.keys(t.caps),inner:e.slice(t.innerStart,t.innerEnd),atoms:t.atoms,unit:t.unit,...t.path?{path:t.path}:{},...t.self!==null?{self:!0}:{}})),units:n.map(t=>({id:t.id,kind:t.kind,parent:t.parent,hash:D(e,t),...t.blockId?{blockId:t.blockId}:{},...t.keep?{keep:t.keep}:{},...t.grid?{grid:!0}:{},...t.parts?{parts:t.parts}:{}})),boxes:c.map(t=>({id:t.id,kind:t.kind,unit:t.unit,...t.key!==null?{key:t.key}:{}}))};return{html:l,map:p}}function wt(e,a,r=!0){let n=[],c=0;for(let l of[...a].sort((p,t)=>p.at-t.at)){if(e[l.at]!==">"){if(r)throw new Error(`Unexpected start tag before offset ${l.at}.`);continue}let p=et(e,l.at);n.push(e.slice(c,p),l.text),c=p}return n.push(e.slice(c)),n.join("")}Q();import{COMPONENTS as kt,instancesOf as xt,partOf as st}from"../browser/shared/components/index.mjs";import{attr as rt}from"../browser/shared/html-tree.mjs";var at=new Set(["main","section","article","aside","nav","header","footer","div","details","dialog","figure","blockquote","table","ul","ol","dl"]),Nt=new Set(["script","style","template","textarea","title","xmp","iframe","noembed","noframes","noscript","plaintext","pre","code","kbd","samp","var","svg","math"]),It=kt.filter(e=>e.match&&e.pairs);function Ot(e){let a=e.replace(/^/," "),r=J(a,{sourceCodeLocationInfo:!0}),n=f=>a.slice(0,f).split(`
|
|
3
3
|
`).length,c=[],l=(f,d,s)=>c.push({key:f,tag:a.slice(d,s).replace(/\s+/g," "),line:n(d),offset:d});V(r,"main")||l("no <main> in the file",0,0);let p=[],t=new Set,k=f=>{for(let d of f.childNodes??[]){let s=d.sourceCodeLocation;if(d.nodeName==="#comment"){s&&p.push([s.startOffset,s.endOffset]);continue}if(d.tagName){if(s?.startTag&&p.push([s.startTag.startOffset,s.startTag.endOffset]),Nt.has(d.tagName)){s&&p.push([s.startOffset,s.endOffset??a.length]);continue}s?.endTag&&t.add(s.endTag.startOffset),at.has(d.tagName)&&s?.startTag&&!s.endTag&&l(`<${d.tagName}> not closed`,s.startTag.startOffset,s.startTag.endOffset),k(d)}}};k(r),p.sort((f,d)=>f[0]-d[0]);let N="",h=0;for(let[f,d]of p)d<=h||(N+=a.slice(h,Math.max(h,f))+" ".repeat(d-Math.max(h,f)),h=d);N+=a.slice(h);for(let f of N.matchAll(/<\/([A-Za-z][A-Za-z0-9]*)[^<>]*>?/g)){let d=f[1].toLowerCase();at.has(d)&&!t.has(f.index)&&l(`</${d}> closes nothing`,f.index,f.index+f[0].length)}for(let f of It)for(let d of xt(r,f))for(let{a:s,attrA:g,b:x,attrB:A}of f.pairs){let o=st(d,f.parts[s].at).map(M=>rt(M,g)),u=st(d,f.parts[x].at).map(M=>rt(M,A)),j=M=>new Set(M).size===M.length,I=j(o)&&j(u)&&o.length===u.length&&o.every(M=>u.includes(M)),b=d.sourceCodeLocation;!I&&b&&l(`${f.id}: ${s} and ${x} do not pair`,b.startOffset,b.startTag?.endOffset??b.startOffset)}return c.sort((f,d)=>f.offset-d.offset).map(({key:f,tag:d,line:s})=>({key:f,tag:d,line:s,text:`${f} (line ${s})`}))}Q();import{treeText as z}from"../browser/shared/annotations.mjs";import{attr as F}from"../browser/shared/html-tree.mjs";var it=2e3*2e3,G=2e3,ct=50,lt=1500;function ft(e,a,r,n){let c="",l=a;for(let p of n)p.end<=l||p.start>=r||(p.start>l&&(c+=e.slice(l,p.start)),l=Math.max(l,p.end));return c+e.slice(l,r)}var dt=e=>e.replace(/\s+/g," ").trim(),bt=e=>/\S/.test(e.replace(/<!--[^]*?-->/g,"").replace(/<[^>]*>/g,"").replace(/\u0000/g,"")),pt=e=>e.companion?[{start:e.start,end:e.end},{start:e.companion.start,end:e.companion.end}]:[{start:e.start,end:e.end}];function H(e){let a=L(e),{units:r,blocks:n}=a,c=r[0]?.node??n[0]?.node??null;for(;c?.parentNode;)c=c.parentNode;let l=c?tt(e,[c]):[],p=[...r].sort((o,u)=>o.start-u.start||u.end-o.end),t=new Map,k=[];for(let o of p){for(;k.length&&k.at(-1).end<=o.start;)k.pop();t.set(o,k.at(-1)??null),k.push(o)}for(let o of r.filter(u=>u.companion)){let{start:u,end:j}=o.companion;for(let I of r){if(I===o||I.start<u||I.end>j)continue;let b=t.get(I);(!b||b.start<u)&&t.set(I,o)}}let N=new Map;for(let o of r){let u=t.get(o);u&&N.set(u,[...N.get(u)??[],o])}let h=n.find(o=>o.kind==="title")??null,f=[...r.map(o=>({unit:o,at:o.elStart})),...h?[{unit:null,at:h.start}]:[]].sort((o,u)=>o.at-u.at),d=new Map(f.map((o,u)=>[o.unit,u])),s=new Map;for(let o of r)o.blockId&&s.set(o.blockId,(s.get(o.blockId)??0)+1);let g=f.map(({unit:o})=>{if(!o){let $=dt(ft(e,h.start,h.end,l));return{unit:null,title:!0,kind:"title",key:`title\0${$}`,own:$,counts:1,parent:null,blockId:null,text:z(h.node).slice(0,G)}}let u=N.get(o)??[],j=[...u.flatMap(pt),...l].sort(($,R)=>$.start-R.start),I=dt(pt(o).map(({start:$,end:R})=>ft(e,$,R,j)).join("\0")),b=u.length>0&&!bt(I),M=t.get(o);return{unit:o,kind:o.kind,key:`${o.kind}\0${I}`,own:I,counts:b?0:1,parent:M?d.get(M):null,blockId:o.blockId,text:z(o.node).slice(0,G)}}),x=null;return{rows:g,scanned:a,ref:o=>o.title?{title:!0}:o.blockId&&s.get(o.blockId)===1?{id:o.blockId}:(x??=(()=>{let u=new Map,j=new Map;for(let{unit:I}of f){if(!I)continue;let b=D(e,I);j.set(I,{hash:b,nth:u.get(b)??0}),u.set(b,(u.get(b)??0)+1)}return j})(),x.get(o.unit))}}function St(e,a){if(e.length*a.length<=it)return Z(e,a);let r=s=>s.reduce((g,x)=>g.set(x,(g.get(x)??0)+1),new Map),[n,c]=[r(e),r(a)],l=new Map;a.forEach((s,g)=>{c.get(s)===1&&n.get(s)===1&&l.set(s,g)});let p=[];e.forEach((s,g)=>{l.has(s)&&p.push([g,l.get(s)])});let t=[],k=[];p.forEach(([,s],g)=>{let x=0,A=t.length;for(;x<A;){let o=x+A>>1;p[t[o]][1]<s?x=o+1:A=o}k[g]=x>0?t[x-1]:-1,t[x]=g});let N=[];for(let s=t.at(-1)??-1;s>=0;s=k[s])N.unshift(p[s]);let h=[],[f,d]=[0,0];for(let[s,g]of[...N,[e.length,a.length]]){if((s-f)*(g-d)<=it)for(let[x,A]of Z(e.slice(f,s),a.slice(d,g)))h.push([f+x,d+A]);s<e.length&&h.push([s,g]),[f,d]=[s+1,g+1]}return h}var ut=(e,a)=>a.nested?z(P(e.slice(a.innerStart,a.innerEnd))):z(a.node),mt=e=>e.match(/[A-Za-z0-9]+|\s+|[^A-Za-z0-9\s]/gu)?.length??0,ht=({scanned:e},a)=>(a.title?e.blocks.filter(r=>r.kind==="title"):e.blocks.filter(r=>r.unit===a.unit.id)).sort((r,n)=>r.innerStart-n.innerStart);function yt(e){let a=[],r=n=>{for(let c of n.childNodes??[])c.tagName==="tr"?a.push((c.childNodes??[]).filter(l=>l.tagName==="td"||l.tagName==="th").map(l=>z(l).replace(/\s+/g," ")).join(" \xB7 ")):c.tagName&&r(c.tagName==="template"?c.content:c)};return r(e),a.length?a.join(`
|
|
4
4
|
`):z(e)}function Mt(e,a,r){let n=e[a],c=0;for(let N=n.parent;N!==null;N=e[N].parent)r(N)&&(c+=1);let l=n.title?"h1":n.unit.node.tagName,p=n.title?n.text:yt(P(n.own.replace(/\u0000/g," "))).slice(0,G),t={kind:n.kind,tag:l,depth:c,text:p},k=l==="li"?n.unit.node.parentNode:null;if((k?.tagName==="ul"||k?.tagName==="ol")&&(t.marker=k.tagName,k.tagName==="ol")){let N=(k.childNodes??[]).filter(h=>h.tagName==="li");t.number=(Number.parseInt(F(k,"start")??"1",10)||1)+N.indexOf(n.unit.node)}return t}function $t(e,a){if(e===a)return null;let r=H(e),n=H(a),[c,l]=[r.rows.map(i=>i.key),n.rows.map(i=>i.key)],p=St(c,l);if(p.length===c.length&&p.length===l.length)return null;let t=i=>{let w=new Map;for(let S of i)S.blockId&&w.set(S.blockId,(w.get(S.blockId)??0)+1);return S=>!!S.blockId&&w.get(S.blockId)===1},[k,N]=[t(r.rows),t(n.rows)],h=[],[f,d]=[0,0];for(let[i,w]of[...p,[c.length,l.length]]){let S=new Map;for(let m=d;m<w;m++)N(n.rows[m])&&S.set(n.rows[m].blockId,m);let T=[],v=d-1;for(let m=f;m<i;m++){let O=k(r.rows[m])?S.get(r.rows[m].blockId):void 0;O!==void 0&&O>v&&(T.push([m,O]),v=O)}let B=[],[y,E]=[f,d];for(let[m,O]of[...T,[i,w]]){for(;y<m;y++){let C=r.rows[y];for(let W=E;W<O;W++){let Y=n.rows[W];if(Y.kind===C.kind&&(C.title||ot(C.own,Y.own))){B.push([y,W]),E=W+1;break}}}m<i&&B.push([m,O]),[y,E]=[m+1,O+1]}B.sort((m,O)=>m[0]-O[0]),[y,E]=[f,d];for(let[m,O]of[...B,[i,w]]){for(;y<m;y++)h.push({type:"del",i:y});for(;E<O;E++)h.push({type:"ins",j:E});m<i&&h.push({type:"chg",i:m,j:O}),[y,E]=[m+1,O+1]}i<c.length&&h.push({type:"same",i,j:w}),[f,d]=[i+1,w+1]}let s=new Set(h.filter(i=>i.type==="ins").map(i=>i.j)),g=new Set(h.filter(i=>i.type==="del").map(i=>i.i)),x=(i,w)=>{let S=new Set;for(let T of w)if(i[T].counts)for(let v=i[T].parent;v!==null;v=i[v].parent)S.add(v);return T=>i[T].counts||(S.has(T)?0:1)},[A,o]=[x(n.rows,s),x(r.rows,g)],u={added:0,changed:0,removed:0},j=[],I=[],b=[],M,$=null,R=null,K=i=>{if(!$)return;let w=Math.max(0,$.rows.length-ct);b.push({...i!==null?{before:n.ref(n.rows[i])}:R!==null?{after:n.ref(n.rows[R])}:{into:"main"},count:$.count,rows:$.rows.slice(0,ct),...w?{more:w}:{}}),$=null},X=i=>g.has(i)&&r.rows[i].counts>0;for(let i of h){if(i.type==="del"){$??={count:0,rows:[]},$.count+=o(i.i),u.removed+=o(i.i),X(i.i)&&$.rows.push(Mt(r.rows,i.i,X));continue}if(K(i.j),R=i.j,i.type==="ins"){let w=n.rows[i.j];u.added+=A(i.j),(w.parent===null||!s.has(w.parent))&&j.push({ref:n.ref(w)})}else if(i.type==="chg"){let[w,S]=[r.rows[i.i],n.rows[i.j]];u.changed+=1;let T=ht(r,w),v=ht(n,S),B=[],y=T.length!==v.length||T.length===0||T.some((E,m)=>E.tag!==v[m].tag);y||(T.forEach((E,m)=>{let[O,C]=[ut(e,E),ut(a,v[m])];mt(O)>lt||mt(C)>lt?y=!0:O!==C&&B.push({nth:m,base:O})}),B.length===0&&(y=!0)),y&&(B=[]),I.push({ref:n.ref(S),...y?{whole:!0}:{texts:B}}),S.title&&(M={base:w.text})}}return K(null),{counts:u,added:j,changed:I,...M?{title:M}:{},removed:b}}function Tt(e){let{units:a}=L(e),r=c=>{for(let l=c;l;l=l.parentNode)if(l.tagName&&(F(l,"data-doc-placeholder")!==void 0||l.tagName==="header"||(F(l,"class")??"").split(/\s+/).includes("doc-header")))return!1;return!0},n=c=>/^(img|picture|svg|canvas|video|audio|iframe|object|embed)$/.test(c.tagName??"")||(c.childNodes??[]).some(n);return!a.some(c=>r(c.node)&&(z(c.node)!==""||n(c.node)))}function jt(e,a){try{return q({current:e,ids:!0,...a}).text}catch{return e}}function Et(e,a){try{let r=L(e).blocks.find(c=>c.kind==="title");if(!r)return e;let n=U({current:e,edits:[{id:r.id,parts:[{keep:!0,html:a}]}],ids:!1});return n.ok?n.text:e}catch{return e}}var we=(e,a,r,n)=>nt.installed.rewrite(e,a,r,{packages:n});export{gt as a,Ot as b,$t as c,Tt as d,jt as e,Et as f,we as g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{c as i,d as u}from"./chunk-
|
|
2
|
+
import{c as i,d as u}from"./chunk-GHOYKMQ3.mjs";import{j as f,k as p}from"./chunk-UYVCQK3H.mjs";import{u as c}from"./chunk-J5PUIV3Y.mjs";import{b as d,f as h}from"./chunk-4OZWXZE5.mjs";import w from"node:fs/promises";import y from"node:path";import{reportsDirectory as b}from"../browser/shared/paths.mjs";import{sameDirectory as x}from"../browser/shared/preview-server.mjs";import{copyOldDocuments as j,ensureWorkspace as v,layoutOf as D}from"../browser/shared/workspace.mjs";import{nameProblem as G,writeWorkspaceName as N}from"../browser/shared/workspace-name.mjs";import{registerQuietly as O}from"../browser/shared/workspace-registry.mjs";var g=(o,t)=>`${o} ${t}${o===1?"":"s"}`;function C(o,t,r){let{preferences:s}=D(r);return[o.copied.length?`Copied ${g(o.copied.length,"document")} from ${t}: ${o.copied.join(", ")}`:`Copied no documents from ${t}.`,...o.skipped.length?[`Skipped (the slug is taken here, or the folder's name is no slug): ${o.skipped.join(", ")}`]:[],...o.kept.length?[`Left behind (a name a workspace keeps for itself, for its custom blocks here, which no new document takes): ${o.kept.join(", ")}`]:[],...o.preferences==="copied"?[`\u5199\u4F5C\u504F\u597D\uFF1Acopied (${s})`]:o.preferences==="kept"?[`\u5199\u4F5C\u504F\u597D\uFF1Akept the workspace's (${s}); the old one was not copied`]:[],...o.outline?[`Sidebar order: ${o.outline}`]:[],...o.page?[`\u5199\u4F5C\u504F\u597D's page: ${o.page==="copied"?"copied":"kept the workspace's"}`]:[],...o.emoji?[`Emoji library: ${o.emoji} added`]:[],...o.history?[`Recent versions: ${g(o.history,"document")}`]:[],...o.packages.length?[`Custom blocks: ${o.packages.join(", ")}`]:[]]}async function U(o){let{values:t}=h({values:["--from","--name"],argv:o}),r=b,s=t.get("--name"),l=s===void 0?null:G(s);if(l)throw new d(l);let m;try{let{made:e,ours:n,reads:k}=await v(r);n||(console.error(u(r,k)),process.exit(1)),m=e}catch(e){if(!e.code)throw e;console.error(i(r,e.code)),process.exit(1)}if(console.log(`\u5DE5\u4F5C\u533A\uFF1A${r}\uFF08${m?"\u65B0\u5EFA":"\u5DF2\u6709"}\uFF09`),s!==void 0)try{let e=await N(r,s);console.log(`\u540D\u5B57\uFF1A${e.name}${e.before&&e.before!==e.name?` (it was "${e.before}")`:""}`)}catch(e){console.error(e.code?i(r,e.code):e.message),process.exit(1)}if(await O(r),t.has("--from")){let e=y.resolve(t.get("--from"));await w.stat(e).then(n=>n.isDirectory(),()=>!1)||(console.error(`No such folder: ${e} (--from names an older Gallery's reports/ folder).`),process.exit(1)),x(e,r)&&(console.error(`${e} is this workspace: --from names another folder (an older Gallery's reports/).`),process.exit(1));for(let n of C(await j({from:e,to:r}),e,r))console.log(n)}let $=await c(r);for(let e of $.packs)e.failed?console.warn(`\u5757\u5305\uFF1AGallery's pack ${e.id} was not installed (${e.failed}); a later start tries again.`):e.first&&console.log(`\u5757\u5305\uFF1A${e.name.zh} (${e.id} ${e.version}, ${e.added.length+e.same.length+e.updated.length} blocks)${e.id==="gallery-soft"?", switched off: \u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868 turns it on":""}`);let a=await f(r);a.did==="made"?console.log(`\u9996\u9875\uFF1A${a.file} (the home page, its cards Gallery's today and note; the workbench opens it first)`):a.did==="failed"&&console.warn(`\u9996\u9875\uFF1A${p(a)}`),console.log('Next: gallery new <slug> "<title>" makes a document; gallery open opens the workbench.')}export{C as a,U as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{a,b,c,d,e,f,g,h}from"./chunk-W7665ZEC.mjs";import"./chunk-7JDX4E65.mjs";import"./chunk-3MBRL2PM.mjs";import"./chunk-HPOI4ZX7.mjs";import"./chunk-342HXE3Q.mjs";import"./chunk-EAIFITAV.mjs";import"./chunk-EP25HDAJ.mjs";import"./chunk-AR5D57ZD.mjs";import"./chunk-67N2QJYT.mjs";import"./chunk-5XA2ZBAE.mjs";import"./chunk-JEUK3ZO7.mjs";import"./chunk-JLTZF4LA.mjs";import"./chunk-PUOQ65NC.mjs";import"./chunk-7OG26PGF.mjs";import"./chunk-DJISHPUL.mjs";import"./chunk-ZWWC4KLF.mjs";import"./chunk-IA4PSIMD.mjs";import"./chunk-2OHANJ6Q.mjs";import"./chunk-F4ZA6JRZ.mjs";import"./chunk-7M2BQQGZ.mjs";import"./chunk-ITOH5EGO.mjs";import"./chunk-ZQS6H473.mjs";import"./chunk-QE5RG76S.mjs";import"./chunk-UYVCQK3H.mjs";import"./chunk-J5PUIV3Y.mjs";import"./chunk-4OZWXZE5.mjs";import"./chunk-MXUBKDRO.mjs";import"./chunk-HXG7EOPJ.mjs";import"./chunk-ZTHICSSF.mjs";import"./chunk-6N3PX4XX.mjs";import"./chunk-PAREWQGB.mjs";import"./chunk-BFJGHSQN.mjs";import"./chunk-U5XL7D6A.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-UMHUSOPJ.mjs";import"./chunk-R2ZDLJYT.mjs";import"./chunk-VFX2KNHP.mjs";import"./chunk-VS7JIGJW.mjs";import"./chunk-HDWTZ763.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";export{a as PAGE_ASIDE,b as PAGE_INSIDE_ALONE,e as cardChangesOf,c as firstInstance,d as outsideWhat,g as pageHost,f as pageSaves,h as pageTryCommand};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{b as V,c as ce,e as le,j as X}from"./chunk-HDWTZ763.mjs";import{createHash as $e}from"node:crypto";import v from"node:fs";import h from"node:path";import{packsDirectory as T}from"../browser/shared/paths.mjs";import{PACKAGE_MANIFEST as M,layoutOf as Q}from"../browser/shared/workspace.mjs";var je="gallery",ee=/^(?:\.DS_Store|\._.*|Thumbs\.db|ehthumbs\.db|desktop\.ini)$/i,W=n=>ee.test(n);function G(n){return v.readdirSync(n,{recursive:!0,withFileTypes:!0}).filter(e=>e.isFile()&&!ee.test(e.name)).map(e=>h.relative(n,h.join(e.parentPath,e.name)).split(h.sep).join("/")).sort()}var Y=n=>[...n.filter(e=>e!==M),...n.includes(M)?[M]:[]];function E(n){return v.existsSync(n)?z(G(n).map(e=>({name:e,data:v.readFileSync(h.join(n,e))}))):null}function z(n){let e=$e("sha256"),t=n.filter(({name:i})=>!ee.test(i.split("/").at(-1))).sort((i,s)=>i.name<s.name?-1:i.name>s.name?1:0);for(let{name:i,data:s}of t)e.update(`${i}\0`).update(s).update(`
|
|
3
|
+
`);return e.digest("hex").slice(0,16)}var Z=n=>{try{return v.readdirSync(n,{withFileTypes:!0}).filter(e=>e.isDirectory()).map(e=>e.name).sort()}catch{return[]}},_=(n=T)=>Z(n);function D(n=T){return Z(n).flatMap(e=>Z(h.join(n,e)).flatMap(t=>{let i=h.join(n,e,t);try{let s=JSON.parse(v.readFileSync(h.join(i,M),"utf8"));return s.id!==`${e}/${t}`?[]:[{name:t,id:s.id,pack:e,folder:i,version:s.version,title:s.name,description:s.description,places:s.places??["document"]}]}catch{return[]}}))}function Ue(n,e=T){let t=n.includes("/")?n:`${je}/${n}`;return D(e).find(i=>i.id===t)??null}var Ve=(n,e=T)=>_(e).includes(String(n).split("/")[0]);function P(n){try{let e=JSON.parse(v.readFileSync(Q(n).blocks,"utf8"));return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function K(n,e){let t=Q(n).blocks;v.mkdirSync(h.dirname(t),{recursive:!0}),v.writeFileSync(t,`${JSON.stringify(e,null,2)}
|
|
4
|
+
`)}var he=(n,e)=>h.join(Q(n).components,...e.split("/"));function ne(n,e){let t=he(n,e.id),i=E(t);if(i===null)return{added:!1,version:null,changed:!1,behind:!1};let s=null;try{s=JSON.parse(v.readFileSync(h.join(t,M),"utf8")).version??null}catch{}let a=P(n)[e.id],c=E(e.folder),o=i!==c&&i!==a?.fingerprint;return{added:!0,version:s,changed:o,behind:!o&&i!==c}}function xe(n,e){let t=he(n,e.id),i=ne(n,e);if(i.changed)throw Object.assign(new Error(`${e.id} was changed after it was added`),{code:"changed",folder:t});let s=E(e.folder),a=P(n);if(i.added&&!i.behind)return a[e.id]?.fingerprint!==s&&K(n,{...a,[e.id]:{version:e.version,fingerprint:s}}),{did:"same",folder:t};let c=G(e.folder);if(i.added)for(let o of G(t))c.includes(o)||v.rmSync(h.join(t,o));for(let o of Y(c))v.mkdirSync(h.dirname(h.join(t,o)),{recursive:!0}),v.copyFileSync(h.join(e.folder,o),h.join(t,o));return K(n,{...a,[e.id]:{version:e.version,fingerprint:s}}),{did:i.added?"updated":"added",from:i.version,folder:t}}var ae=n=>/^\d+\.\d+\.\d+$/.test(String(n??""))?n.split(".").map(Number):null;function L(n,e){let[t,i]=[ae(n),ae(e)];if(!t||!i)return n!==e;let s=t.findIndex((a,c)=>a!==i[c]);return s!==-1&&t[s]>i[s]}function Xe(n,e){let t=ne(n,e);return t.changed&&L(e.version,t.version)?e.version:null}var fe=new Map,me=()=>{};function Oe(n,{updated:e,kept:t,failed:i}){let s=[];e.length&&s.push(`Gallery's own blocks in ${n}, as they were added, updated to this Gallery's: ${e.map(({id:a,from:c,to:o})=>`${a} ${c??"?"} -> ${o}`).join(", ")}`);for(let{id:a,version:c,shipped:o}of t)s.push(`${a} in ${n} was changed after it was added, so it stays at ${c??"its version"}: Gallery's is ${o} (\u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868 says how to take it)`);for(let{id:a,to:c,why:o}of i)s.push(`${a} in ${n} could not be updated to Gallery's ${c}: ${o}`);return s}function Fe(n,{ids:e=null,directory:t=T,log:i=null}={}){let s={updated:[],kept:[],failed:[]},a=h.resolve(n);for(let c of D(t)){if(e&&!e.includes(c.id))continue;let o=`${a}\0${h.resolve(c.folder)}`;if(fe.get(o)!==c.version){fe.set(o,c.version);try{let r=ne(n,c);if(r.changed&&L(c.version,r.version)&&s.kept.push({id:c.id,version:r.version,shipped:c.version}),!r.behind)continue;xe(n,c).did==="updated"&&s.updated.push({id:c.id,from:r.version,to:c.version})}catch(r){s.failed.push({id:c.id,to:c.version,why:r?.message??String(r)})}}}for(let c of Oe(a,s))(i??me)(c);return s}var de=new Set,pe=n=>process.platform==="win32"?h.resolve(n).toLowerCase():h.resolve(n);function Ze(n,e){de.add(pe(n)),me=e,le((t,i)=>{de.has(pe(t))&&Fe(t,{ids:i})},_())}var ue=n=>[n,n.replace("/","-")],be=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function Qe(n,e,t=T){for(let i of D(t)){if(i.id===e)continue;let s;try{s=v.readFileSync(h.join(i.folder,"preview.svg"))}catch{continue}if(s.equals(n)||Buffer.from(Ae(i,e)["preview.svg"]??"").equals(n))return i}return null}function Ae(n,e){let[t,i]=[ue(n.id),ue(e)],s=new RegExp(t.map(be).join("|"),"g"),a={};for(let c of G(n.folder)){let o=v.readFileSync(h.join(n.folder,c));if(/\.(?:json|html|md|css|js|svg)$/.test(c)){let r=o.toString("utf8").replace(s,f=>i[t.indexOf(f)]);c===M&&(r=r.replace(/"version":\s*"[^"]*"/,'"version": "0.1.0"')),a[c]=r}else a[c]=o}return Object.fromEntries(Y(Object.keys(a)).map(c=>[c,a[c]]))}import m from"node:fs";import u from"node:path";import{refusal as Pe,said as k}from"../browser/shared/i18n/index.mjs";import{DEFAULT_PACK as Ee,OWN_SCOPE as te,PACK_FILE as F,PACK_ID as ye,readPackManifest as ie}from"../browser/shared/pack-manifest.mjs";import{packsDirectory as ge}from"../browser/shared/paths.mjs";import{DEVICE_NAMES as _e,PACKAGE_MANIFEST as R,layoutOf as H,markerOf as Ne,packageFolders as Ie}from"../browser/shared/workspace.mjs";var oe=Object.freeze(["gallery-soft"]);function fn(n,e={}){let t=P(n).packs;return oe.filter(i=>e?.[i]===void 0&&!b(t?.[i]))}var Me="GALLERY_NO_PACKS",Ge=(n=process.env)=>!["","0","false",void 0].includes(n[Me]),q=2e3,re=64*1024*1024,Se=/^[a-z0-9][a-z0-9-]*$/,b=n=>typeof n=="object"&&n!==null&&!Array.isArray(n),j=(n,e)=>{throw Pe(e,{code:n})};function Te(n){let e=[];for(let t of m.readdirSync(n,{recursive:!0,withFileTypes:!0})){if(!t.isFile())continue;e.length>=q&&j("size",k("\u5757\u5305\u592A\u5927\uFF1A\u6700\u591A {0} \u4E2A\u6587\u4EF6\u3001{1} MB",q,re/1024/1024));let i=u.relative(n,u.join(t.parentPath,t.name)).split(u.sep).join("/");e.push({name:i,data:m.readFileSync(u.join(n,...i.split("/")))})}return e}function Ce(n,{refuse:e=()=>{}}={}){let t=[],i=0;for(let{name:r,data:f}of n){let d=String(r).replace(/\\/g,"/");if(d.endsWith("/"))continue;let y=d.split("/");(d.startsWith("/")||/^[A-Za-z]:/.test(d)||d.includes("\0")||y.some(l=>l===""||l==="."||l===".."))&&j("path",k("{0} \u6307\u5411\u5757\u5305\u5916\u9762\uFF0C\u4E0D\u80FD\u88C5",String(r))),!(y[0]==="__MACOSX"||W(y.at(-1)))&&(i+=f.length,t.push({name:d,data:f}))}(t.length>q||i>re)&&j("size",k("\u5757\u5305\u592A\u5927\uFF1A\u6700\u591A {0} \u4E2A\u6587\u4EF6\u3001{1} MB",q,re/1024/1024));let s=t;if(!t.some(({name:r})=>r===F)){let r=new Set(t.map(({name:d})=>d.split("/")[0])),[f]=r;(r.size!==1||!t.some(({name:d})=>d===`${f}/${F}`))&&j("manifest",k("\u6700\u4E0A\u4E00\u5C42\u6CA1\u6709 pack.json\uFF1A\u5757\u5305\u662F\u4E00\u4E2A\u6587\u4EF6\u5939\uFF0C\u6700\u4E0A\u4E00\u5C42\u653E pack.json\uFF0C\u6BCF\u4E2A\u5757\u4E00\u4E2A\u6587\u4EF6\u5939")),s=t.map(({name:d,data:y})=>({name:d.slice(f.length+1),data:y}))}let a=ie(s.find(({name:r})=>r===F).data.toString("utf8"));e(a);let c=new Map,o=[];for(let r of s){let[f,...d]=r.name.split("/");if(d.length===0){o.push(r);continue}c.has(f)||c.set(f,[]),c.get(f).push({name:d.join("/"),data:r.data})}for(let[r,f]of c){(!Se.test(r)||_e.has(r))&&j("block",k("{0} \u4E0D\u662F\u5757\u7684\u6587\u4EF6\u5939\u540D\uFF1A\u53EA\u7528\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u8FDE\u5B57\u7B26",r));let d=f.find(l=>l.name===R);d||j("block",k("{0}/ \u91CC\u6CA1\u6709 component.json",r));let y;try{y=JSON.parse(d.data.toString("utf8").replace(/^/,"")).id}catch{j("block",k("{0}/component.json \u4E0D\u662F JSON",r))}y!==`${a.id}/${r}`&&j("block",k("{0}/component.json \u7684 id \u8981\u5199\u6210 {1}",r,`${a.id}/${r}`))}return{manifest:a,blocks:c,own:o}}function Ke(n){try{let e=JSON.parse(n.find(({name:t})=>t===R).data.toString("utf8").replace(/^/,"")).version;return typeof e=="string"?e:null}catch{return null}}function ve(n){try{return m.readdirSync(n,{withFileTypes:!0}).filter(e=>e.isFile()&&!W(e.name)).map(e=>e.name).sort()}catch{return[]}}function ke(n){let e=ve(n);return e.length?z(e.map(t=>({name:t,data:m.readFileSync(u.join(n,t))}))):null}function ze(n){try{return m.readdirSync(n).some(e=>!W(e))}catch{return!1}}function se(n,e,{replacing:t=!1,last:i=R}={}){let s=e.map(({name:o})=>o);if(t)for(let o of G(n))s.includes(o)||m.rmSync(u.join(n,...o.split("/")),{force:!0});let a=new Map(e.map(o=>[o.name,o.data])),c=i===R?Y(s):[...s.filter(o=>o!==i),...s.includes(i)?[i]:[]];for(let o of c){let r=u.join(n,...o.split("/"));m.mkdirSync(u.dirname(r),{recursive:!0}),m.writeFileSync(r,a.get(o))}}function De(n,e,{official:t=!1,shippedIds:i=_()}={}){let{manifest:s,blocks:a,own:c}=Ce(e,{refuse:({id:g})=>{!t&&i.includes(g)&&j("official",k("{0} \u662F Gallery \u81EA\u5E26\u7684\u5757\u5305\u7528\u7684 id\uFF1A\u6362\u4E00\u4E2A id \u518D\u88C5",g))}}),{id:o}=s,r=u.join(H(n).components,o),f=P(n),d=b(f.packs)?f.packs:{},y=b(d[o])?d[o]:null;!t&&!y&&ze(r)&&j("taken",k("\u5DE5\u4F5C\u533A\u91CC\u5DF2\u7ECF\u6709 components/{0}\uFF1A\u8FD9\u4E2A\u540D\u5B57\u88AB\u522B\u7684\u5757\u5305\u6216\u522B\u4EBA\u5199\u7684\u5757\u7528\u7740\uFF0C\u6362\u4E00\u4E2A id\uFF0C\u6216\u5148\u628A\u90A3\u4E2A\u6587\u4EF6\u5939\u632A\u8D70",o));let l={id:o,name:s.name,version:s.version,from:y?.version??null,folder:r,added:[],updated:[],same:[],kept:[],removed:[],skipped:[],ownKept:!1},w=[...a.keys()].sort();for(let g of w){let p=`${o}/${g}`,O=a.get(g),$=u.join(r,g),B=z(O),I=E($),J=b(f[p])?f[p]:null;if(I===null){if(t&&J){l.skipped.push(p);continue}se($,O),l.added.push(p)}else if(I===B)l.same.push(p);else if(J&&I===J.fingerprint)se($,O,{replacing:!0}),l.updated.push(p);else{l.kept.push(p);continue}f[p]={version:Ke(O),fingerprint:B}}for(let g of Array.isArray(y?.blocks)?y.blocks:[]){let p=String(g).split("/")[1];if(!p||a.has(p)||!Se.test(p))continue;let O=u.join(r,p),$=E(O);if($!==null&&$!==f[g]?.fingerprint){l.kept.push(g);continue}$!==null&&(m.rmSync(O,{recursive:!0,force:!0,maxRetries:5,retryDelay:100}),l.removed.push(g)),delete f[g]}let x=ke(r),A=z(c);if(x!==A)if(x===null||x===y?.fingerprint){let g=c.map(({name:p})=>p);for(let p of ve(r))g.includes(p)||m.rmSync(u.join(r,p),{force:!0});m.mkdirSync(r,{recursive:!0}),se(r,c,{last:F})}else l.ownKept=!0;let N=l.added.length+l.updated.length+l.removed.length>0||x!==A&&!l.ownKept;return l.did=y?N?"updated":"same":"installed",f.packs={...d,[o]:{version:s.version,fingerprint:l.ownKept?y.fingerprint:A,blocks:w.map(g=>`${o}/${g}`),...t?{official:!0}:{}}},K(n,f),l}function dn(n,e,{shippedIds:t=_()}={}){t.includes(e)&&j("official",k("{0} \u662F Gallery \u81EA\u5E26\u7684\u5757\u5305\uFF0C\u4E0D\u80FD\u5220\u9664\uFF1A\u5728 \u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868 \u91CC\u628A\u5B83\u5173\u6389",e));let i=u.join(H(n).components,e);(!ye.test(e)||!m.existsSync(i))&&j("missing",k("\u5DE5\u4F5C\u533A\u91CC\u6CA1\u6709\u5757\u5305 {0}",e));let s=P(n),a=b(s.packs)&&b(s.packs[e])?s.packs[e]:null;a||j("own",k("components/{0} \u4E0D\u662F\u88C5\u8FDB\u6765\u7684\u5757\u5305\uFF0C\u91CC\u9762\u7684\u5757\u662F\u6709\u4EBA\u5728\u8FD9\u4E2A\u5DE5\u4F5C\u533A\u5199\u7684\uFF1A\u8981\u5220\u5C31\u81EA\u5DF1\u5220\u6389\u8FD9\u4E2A\u6587\u4EF6\u5939",e)),m.rmSync(i,{recursive:!0,force:!0,maxRetries:5,retryDelay:100});for(let r of Object.keys(s))r.startsWith(`${e}/`)&&delete s[r];let{[e]:c,...o}=s.packs;return K(n,{...s,packs:o}),{id:e,version:a.version??null,blocks:Array.isArray(a.blocks)?a.blocks:[]}}var Le=n=>({zh:X("zh",n),en:X("en",n)});function pn(n,{settings:e=null,shippedIds:t=_(),directory:i=ge}={}){let{components:s}=H(n),a=P(n),c=b(a.packs)?a.packs:{},o=Ie(n),r=new Set([te,...o.map(({id:l})=>l.split("/")[0])]);try{for(let l of m.readdirSync(s))ye.test(l)&&m.existsSync(u.join(s,l,F))&&r.add(l)}catch{}let f=(e??V(n)).packs??{},d=[...r].map(l=>{let w=u.join(s,l),x=null,A=null;if(m.existsSync(u.join(w,F)))try{x=ie(m.readFileSync(u.join(w,F),"utf8")),x.id!==l&&(A=k("pack.json \u7684 id \u662F {0}\uFF0C\u5B83\u7684\u6587\u4EF6\u5939\u5374\u662F components/{1}",x.id,l),x=null)}catch(S){A=S}let N=b(c[l])?c[l]:null,g=o.filter(S=>S.id.startsWith(`${l}/`)),p=N?g.filter(S=>b(a[S.id])&&E(S.folder)!==a[S.id].fingerprint).map(S=>S.id):[];N&&ke(w)!==N.fingerprint&&p.push(`${l}/${F}`);let O=t.includes(l),$=null;if(O)try{$=ie(m.readFileSync(u.join(i,l,F),"utf8"))}catch{}let B=S=>{try{return JSON.parse(m.readFileSync(u.join(s,...S.split("/"),R),"utf8")).version??null}catch{return null}},I=O?D(i):[],we=O&&$&&p.some(S=>S.endsWith(`/${F}`)?L($.version,x?.version??null):I.some(U=>U.id===S)&&L(I.find(U=>U.id===S).version,B(S)))?$.version:null,C=l===te?Ee:x??(A?null:$);return{id:l,name:C?.name??{zh:l,en:l},description:C?.description??null,version:x?.version??null,author:C?.author??null,homepage:C?.homepage??null,icon:C?.icon??null,kind:l===te?"default":O?"official":N?"installed":"own",problem:A?Le(A):null,blocks:g.length,enabled:f[l]!==!1,changed:p,newer:we}}),y=({id:l,kind:w})=>w==="default"?-1:w==="official"?t.indexOf(l):w==="installed"?1e3:2e3;return d.sort((l,w)=>y(l)-y(w)||(l.id<w.id?-1:1))}function Re(n,e,t){let i=[],s=u.resolve(n);return t?i.push(`Gallery's pack ${e.id} ${e.version} installed in ${s} (${e.added.length+e.same.length+e.updated.length} blocks)${oe.includes(e.id)?", switched off: \u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868 turns it on":""}`):(e.added.length&&i.push(`Gallery's pack ${e.id} in ${s} has new blocks: ${e.added.join(", ")}`),e.updated.length&&i.push(`Gallery's pack ${e.id} in ${s}, its blocks as they were installed, updated to this Gallery's: ${e.updated.join(", ")}`),e.removed.length&&i.push(`Gallery's pack ${e.id} in ${s}: ${e.removed.join(", ")} no longer in it, taken out`)),i}async function un(n,{directory:e=ge,env:t=process.env,log:i=()=>{}}={}){if(Ge(t))return{did:"off",packs:[]};let s={ours:!1};try{s=Ne(m.readFileSync(H(n).marker,"utf8"))}catch{}if(!s.ours)return{did:"unread",packs:[]};let a=_(e),c=[];for(let o of a)try{let r=!b(P(n).packs?.[o]);r&&oe.includes(o)&&V(n).packs[o]===void 0&&await ce(n,{pack:o,enabled:!1});let f=De(n,Te(u.join(e,o)),{official:!0,shippedIds:a});c.push({...f,first:r});for(let d of Re(n,f,r))i(d)}catch(r){i(`Gallery's pack ${o} could not be installed in ${u.resolve(n)}: ${r?.message??r}`),c.push({id:o,failed:r?.message??String(r)})}return{did:"done",packs:c}}export{je as a,Y as b,_ as c,D as d,Ue as e,Ve as f,P as g,ne as h,xe as i,L as j,Xe as k,Fe as l,Ze as m,Qe as n,Ae as o,fn as p,Te as q,De as r,dn as s,pn as t,un as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{a as D,b as M}from"./chunk-YI43RG4P.mjs";import{c as v,d as j}from"./chunk-
|
|
2
|
+
import{a as D,b as M}from"./chunk-YI43RG4P.mjs";import{c as v,d as j}from"./chunk-GHOYKMQ3.mjs";import{b as k,f as A}from"./chunk-4OZWXZE5.mjs";import L from"node:fs/promises";import y from"node:path";import{readAnnouncement as _}from"../browser/shared/preview-server.mjs";import{nameProblem as B,nameStops as b,ownName as K,workspaceLabels as Q,workspaceName as x,writeWorkspaceName as R}from"../browser/shared/workspace-name.mjs";import{forgetWorkspace as U,isTemporary as q,isWorkspace as C,isWorkspaceId as z,readRegistry as F,registerQuietly as W,registerWorkspace as G,SCAN_DEPTH as P,SCAN_LIMIT as J,scanForWorkspaces as V,workspaceId as X,workspaceKey as l}from"../browser/shared/workspace-registry.mjs";import{defaultWorkspace as Y,documentsFolder as T,ensureWorkspace as Z,layoutOf as ee}from"../browser/shared/workspace.mjs";import{clashingIds as oe}from"../browser/shared/drafts.mjs";var $=(o,r)=>`${o} ${r}${o===1?"":"s"}`,I=(o,r)=>l(o)===l(r);function se(o){if(K(o)||I(o,Y()))return null;let{name:r}=x(o,{stops:b()});return`\u5DE5\u4F5C\u533A\u540D\u5B57\uFF1A\u6CA1\u6709\uFF08\u522B\u5904\u6309\u6587\u4EF6\u5939\u53EB\u5B83"${r}"\uFF09\uFF1B\u8FD9\u4E2A\u5DE5\u4F5C\u533A\u662F\u4E3A\u4E00\u4E2A\u9879\u76EE\u5EFA\u7684\uFF0C\u5C31\u7528 gallery workspaces --name "<\u9879\u76EE\u540D>" \u5199\u4E0A\u9879\u76EE\u540D`}async function re(o,r){let c=B(r);if(c)throw new k(c);try{let{ours:t,reads:i}=await Z(o);t||(console.error(j(o,i)),process.exit(1))}catch(t){if(!t.code)throw t;console.error(v(o,t.code)),process.exit(1)}let s;try{s=await R(o,r)}catch(t){console.error(t.code?v(o,t.code):t.message),process.exit(1)}await W(o),console.log(`\u5DE5\u4F5C\u533A\uFF1A${o}`),console.log(`\u540D\u5B57\uFF1A${s.name} (in ${ee(o).marker}${s.before&&s.before!==s.name?`; it was "${s.before}"`:""}): the sidebar and gallery workspaces call it so.`)}async function te(o,r){let c=await U(o);c.length||(console.error(`No registered workspace is ${z(o)?o:y.resolve(o)}: gallery workspaces lists them, with their paths and ws- ids.`),process.exit(1));for(let s of c)console.log(`Forgot ${s} (only the registry changed: nothing on disk).${I(s,r)?" It is the current workspace: the next command run in it registers it again.":""}`)}async function ne(o){let r=y.resolve(o??T());await L.stat(r).then(n=>n.isDirectory(),()=>!1)||(console.error(`No such folder: ${r} (--scan names a folder to look in).`),process.exit(1));let c=new Set(F().workspaces.map(({root:n})=>l(n))),{found:s,read:t,cut:i}=await V(r);console.log(`Scanned ${r}, ${P} levels down (${$(t,"folder")}): ${s.length?`${$(s.length,"workspace")}.`:"no workspace."}`);let f=b();for(let n of s){let{name:h}=x(n,{stops:f});if(c.has(l(n))){await W(n),console.log(` \u5DF2\u767B\u8BB0\uFF1A${n}\uFF08${h}\uFF09`);continue}let g;try{g=await G(n)}catch(m){console.log(` \u6CA1\u80FD\u767B\u8BB0\uFF08${m.code??m.message}\uFF09\uFF1A${n}`);continue}console.log(g==="temporary"?` \u4E0D\u767B\u8BB0\uFF08\u5728\u7CFB\u7EDF\u7684\u4E34\u65F6\u6587\u4EF6\u5939\u91CC\uFF09\uFF1A${n}`:` \u65B0\u767B\u8BB0\uFF1A${n}\uFF08${h}\uFF09`)}i&&console.log(`Stopped after ${$(J,"folder")}: gallery workspaces --scan <a folder further down> looks at the rest.`),s.length&&console.log("gallery workspaces lists them; gallery list <words> --all searches their documents.")}async function ae(o){let r=C(o),c=q(o);r&&await W(o);let s=F().workspaces,t=[o,...s.map(({root:e})=>e).filter(e=>!I(e,o))],i=new Map(s.map(({root:e,seen:a})=>[l(e),Date.parse(a)])),f=T(),n=b({documents:f}),h=await Promise.all(t.map(async e=>{let a=C(e),w=a?await D(e):[],p=a?await _({reportsDirectory:e}):null;return{root:e,there:a,count:w.length,edited:w.reduce((d,{edited:u})=>Math.max(d,u),0),port:p?.port??null,named:{root:e,...x(e,{stops:n})}}})),[g,...m]=h;m.sort((e,a)=>a.there-e.there||a.edited-e.edited||(i.get(l(a.root))??0)-(i.get(l(e.root))??0));let N=[g,...m],E=new Map(Q(N.map(({named:e})=>e)).map(e=>[l(e.root),e])),O=s.length;console.log(`${$(O,"workspace")} on this machine's registry; the current one first (*):`);for(let e of N){let{name:a,own:w,above:p}=E.get(l(e.root)),d=e===g,u=[...w||!e.there?[]:["\u6CA1\u6709\u8D77\u540D\uFF1A\u7528\u7684\u662F\u6587\u4EF6\u5939\u7684\u540D\u5B57"],...e.there?[]:[d?"\u8FD8\u6CA1\u6709\u5EFA":"\u4E0D\u5728\u4E86\uFF1A\u6587\u4EF6\u5939\u6216\u5B83\u7684 gallery.json \u627E\u4E0D\u5230\u4E86"],...d&&e.there&&c?["\u5728\u7CFB\u7EDF\u7684\u4E34\u65F6\u6587\u4EF6\u5939\u91CC\uFF1A\u4E0D\u767B\u8BB0"]:[]],H=p?y.isAbsolute(p)?`\uFF08${p}\uFF09`:`\uFF08\u4E0A\u4E00\u7EA7\uFF1A${p}\uFF09`:"";console.log(`${d?"*":" "} ${a}${H} ${X(e.root)}${u.length?` \uFF08${u.join("\uFF1B")}\uFF09`:""}`),console.log(` \u8DEF\u5F84\uFF1A${e.root}`),e.there&&console.log(` \u6587\u6863\uFF1A${e.count?`${e.count} \u7BC7\uFF1B\u4E0A\u6B21\u7F16\u8F91\uFF1A${M(e.edited)}`:"\u6CA1\u6709"}`),e.port&&console.log(` \u670D\u52A1\uFF1Ahttp://127.0.0.1:${e.port}/`)}for(let{id:e,roots:a}of oe())console.log(`${e} \u662F ${a.length} \u4E2A\u767B\u8BB0\u7684\u5DE5\u4F5C\u533A\u5171\u7528\u7684\u7F16\u53F7\uFF08${a.join("\u3001")}\uFF09\uFF1A\u4FA7\u8FB9\u680F\u91CC\u5B83\u4EEC\u7684\u5E95\u7A3F\u90FD\u627E\u4E0D\u5230\uFF1Bgallery workspaces --forget <\u8DEF\u5F84> \u53BB\u6389\u5176\u4E2D\u4E00\u4E2A`);let S=r?se(o):null;S&&console.log(S),m.some(({there:e})=>!e)&&console.log("One no longer there stays registered (a drive may come back): gallery workspaces --forget <\u8DEF\u5F84> takes it off, nothing on disk changed."),O<=1&&console.log(`gallery workspaces --scan registers the workspaces already on this machine (in the Documents folder, ${P} levels down; or --scan <folder>).`),console.log("gallery list <words> --all searches the documents of them all; every command takes --workspace <\u8DEF\u5F84> to work in one.")}async function ue(o,r){let{positional:c,options:s,values:t}=A({options:["--scan"],values:["--name","--forget"],argv:o});if([s.has("--scan"),t.has("--name"),t.has("--forget")].filter(Boolean).length>1)throw new k("One of --scan, --name and --forget at a time.");if(c.length>(s.has("--scan")?1:0))throw new k(s.has("--scan")?"--scan takes one folder at most.":"gallery workspaces names no folder: --scan <folder> looks in one, --workspace <dir> names the current workspace.");let f=y.resolve(r.workspace);return t.has("--name")?re(f,t.get("--name")):t.has("--forget")?te(t.get("--forget"),f):s.has("--scan")?ne(c[0]):ae(f)}export{se as a,ue as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{e as H,f as K,g as Q}from"./chunk-
|
|
2
|
+
import{e as H,f as K,g as Q}from"./chunk-ZWWC4KLF.mjs";import{d as D,f as E,g as T,h as F}from"./chunk-HDWTZ763.mjs";import{existsSync as R}from"node:fs";var U=120;function W(n,I){let p=({packages:s,problems:c})=>new Map([...s,...c].map(([a,{stamp:t}])=>[a,t])),[l,f]=[p(n),p(I)];return[...new Set([...l.keys(),...f.keys()])].filter(s=>l.get(s)!==f.get(s)).sort()}function A({root:n,tell:I,delay:p=U,quiet:l=Q,hold:f=H,limit:s=K,now:c=Date.now,timers:a={set:(t,m)=>setTimeout(t,m),clear:t=>clearTimeout(t)}}){let t=null,m=0,u=null,r=new Map;T(n);let M=i=>{t&&m<=c()+i||(a.clear(t),m=c()+i,t=a.set(w,i),t.unref?.())};function w({settled:i=!1}={}){t=null;let d=T(n),o=E(n,d.settings),b=c();o.stamp!==u?.stamp&&(u={stamp:o.stamp,at:b});let y=b-u.at;if(y<l&&!i)return M(l-y);let g=new Map(o.packages),k=new Map(o.problems),h=1/0;for(let[e,L]of d.packages){if(!(!o.settings.disabled.includes(e)&&(k.has(e)||!g.has(e)&&R(L.folder)))){r.delete(e);continue}r.has(e)||r.set(e,u.at);let O=Math.min(f-y,s-(b-r.get(e)));if(O<=0){r.delete(e);continue}g.set(e,L),k.delete(e),h=Math.min(h,O)}let{settings:C,packs:S}=o,x=D({packages:g,problems:k,settings:C,packs:S});if(x!==d.stamp){let e={packages:g,problems:k,settings:C,packs:S,stamp:x};F(n,e),I(e,W(d,e))}h!==1/0&&M(h)}return{changed:()=>M(p),taken(){a.clear(t),w({settled:!0})},close(){a.clear(t),t=null}}}export{U as a,A as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{a as h,b as v,d as p,e as j,h as I,j as A}from"./chunk-NAMN3RAF.mjs";import{a as O}from"./chunk-JEUK3ZO7.mjs";import{a as E}from"./chunk-
|
|
2
|
+
import{a as h,b as v,d as p,e as j,h as I,j as A}from"./chunk-NAMN3RAF.mjs";import{a as O}from"./chunk-JEUK3ZO7.mjs";import{a as E}from"./chunk-MTYYHM2G.mjs";import"./chunk-ALZ6ZENZ.mjs";import"./chunk-IA4PSIMD.mjs";import{g as C}from"./chunk-7M2BQQGZ.mjs";import{b as i,f as g,i as y}from"./chunk-4OZWXZE5.mjs";import"./chunk-ZTHICSSF.mjs";import"./chunk-UMHUSOPJ.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";import D from"node:path";import{pageLinks as F,pageOfLink as J}from"../browser/shared/page-links.mjs";import{reportsDirectory as x}from"../browser/shared/paths.mjs";import{findPreviewServer as K}from"../browser/shared/preview-server.mjs";import{topOf as M}from"../browser/shared/outline-shape.mjs";import{LINK_FILE as U,linkAddress as P,linkIcon as T}from"../browser/shared/web-links.mjs";var $=t=>t.replace(/\s+/g," ").trim(),k=t=>t==null?"none":JSON.stringify(t);async function L(t,e){let n=await K({reportsDirectory:x}),o=n?await I(n,e,t):null;if(o)return o;let[,s]=await E({edits:{},reports:{},reportsDirectory:x,web:{icon:a=>C(a)}}).run(t,e);return s}function _(t,e){let n=[...t.documents.values()].filter(({url:a})=>a!==void 0),o=J(F(n),e.replace(/^.*#/,""));return o?{slug:o,link:t.documents.get(o)}:{refused:t.documents.get(e)?`${p(t,e)} is a document, not a web link: gallery set changes a document.`:`No web link "${e}": gallery list --tree shows the sidebar's entries.`}}var W=(t,e)=>t.groups.find(n=>[v(n),n.id].some(o=>o.toLowerCase()===$(e).toLowerCase()))??null;async function B(t,e,n){if(t.length!==2)throw new i('Name the address and the name: gallery link add <url> "<name>".');let[o,s]=t,a=P(o);if(a.refused)throw new i(`Not an address a web link takes: ${o} (${{url:"no address",scheme:"http or https only",long:"2048 characters at most"}[a.refused]}).`);if(!$(s))throw new i("The name is never empty.");let d=n.get("--column"),u=n.get("--under"),l=n.get("--after"),c=n.get("--icon");if(d!==void 0&&u!==void 0)throw new i("--column and --under are two places: give one.");if(l!==void 0&&e.has("--first"))throw new i("--after and --first are two places: give one.");if(c!==void 0&&!T(c))throw new i(`Not an icon a web link takes: ${c} (an emoji, or an icon of the \u56FE\u6807 tab as /icons/<name>_<color>.svg).`);let f=await h(),w;if(d!==void 0){let S=W(f,d);S||(console.error(`No column "${d}" in the sidebar (${f.groups.map(v).join(", ")}): nothing added.`),process.exit(1)),w=M(S.id)}u!==void 0&&(w=(await y(u)).slug);let r=l===void 0?null:(await y(l)).slug,q=e.has("--first")||u===void 0&&r===null,m=await L("link",{url:a.url,title:$(s),...c?{icon:c}:{},...w!==void 0?{parent:w}:{},after:r,first:q});m?.ok||(console.error(`Not added: ${m?.message??m?.reason??"no answer"}.`),process.exit(1));let b=await h(),{slug:N,url:z}=m.link;console.log(`Added the web link ${p(b,N)}: ${z}`),console.log(`Placed it ${A(b,{parent:m.parent,index:m.index})}.`),console.log(j(b,N)),console.log(`It is ${O(D.join(x,N,U))}; the workbench shows the page beside the sidebar (a site that refuses frames: \u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00).`)}async function G(t,e){if(t.length!==1)throw new i("Name one web link, then what to set: --url, --title, --icon.");if(!["--url","--title","--icon"].some(r=>e.has(r)))throw new i('Say what to set: --url <address>, --title "<name>", --icon <emoji|none>.');let n=e.has("--title")?$(e.get("--title")):void 0;if(n==="")throw new i("--title takes the words of the name: a web link's name is never empty.");let o;if(e.has("--url")){let r=P(e.get("--url"));if(r.refused)throw new i(`Not an address a web link takes: ${e.get("--url")}.`);o=r.url}let s;if(e.has("--icon")){let r=e.get("--icon").trim();if(r!=="none"&&!T(r))throw new i(`Not an icon a web link takes: ${r} (an emoji, none, or an icon of the \u56FE\u6807 tab).`);s=r==="none"?null:r}let a=await h(),d=_(a,t[0]);d.refused&&(console.error(d.refused),process.exit(1));let{slug:u,link:l}=d,c=await L("link-set",{slug:u,...o!==void 0?{url:o}:{},...n!==void 0?{title:n}:{},...s!==void 0?{icon:s}:{}});c?.ok||(console.error(`Not set: ${c?.message??c?.reason??"no answer"}.`),process.exit(1));let f=c.link,w=[...n!==void 0&&n!==l.title?[` title: ${k(l.title)} \u2192 ${k(f.title)}`]:[],...o!==void 0&&f.url!==l.url?[` url: ${l.url} \u2192 ${f.url}`]:[],...s!==void 0&&(f.icon??null)!==(l.icon??null)?[` icon: ${k(l.icon)} \u2192 ${k(f.icon??null)}`]:[]];if(!w.length)return void console.log(`Nothing to change: ${u} has ${e.size===1?"that already":"those already"}.`);console.log(`Set the web link ${u}:`);for(let r of w)console.log(r)}async function H(t){if(t.length!==1)throw new i("Name one web link to move to the trash.");let e=await h(),n=_(e,t[0]);n.refused&&(console.error(n.refused),process.exit(1));let o=await L("trash",{slug:n.slug,kind:"link"});o?.ok||(console.error(`Not moved to the trash: ${o?.message??o?.reason??"no answer"}.`),process.exit(1)),console.log(`Moved the web link ${p(e,n.slug)} to the trash: the workbench's \u8BBE\u7F6E \u203A \u56DE\u6536\u533A restores it where it was.`)}async function se(t){let[e,...n]=t;if(e==="add"){let{positional:o,options:s,values:a}=g({options:["--first"],values:["--column","--under","--after","--icon"],argv:n});return B(o,s,a)}if(e==="set"){let{positional:o,values:s}=g({values:["--url","--title","--icon"],argv:n});return G(o,s)}if(e==="remove"){let{positional:o}=g({argv:n});return H(o)}throw new i(e?`No such action: link ${e} (add, set, remove).`:"Say what to do: gallery link add, set or remove.")}export{se as run};
|